Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: cli: allow imports with explicit extension #2875

Conversation

fabianhjr
Copy link
Contributor

Changes proposed in this pull request:
⯈ Allow imports with explicit extension set

Eg, deno / bun allow and prefer something like

export { Parser0 } from "./parsers/Parser0.ts";
export { Parser } from "./parsers/Parser.ts";
export { ParserResult } from "./parsers/ParserResult.ts";

But AssemblyScript complains:

ERROR TS6054: File 'src/parsers/Parser0.ts.ts' not found.
   :
 1 │ export { Parser0 } from "./parsers/Parser0.ts";
   │                         ~~~~~~~~~~~~~~~~~~~~~~
   └─ in src/index.ts(1,25)

ERROR TS6054: File 'src/parsers/Parser.ts.ts' not found.
   :
 2 │ export { Parser } from "./parsers/Parser.ts";
   │                        ~~~~~~~~~~~~~~~~~~~~~
   └─ in src/index.ts(2,24)

ERROR TS6054: File 'src/parsers/ParserResult.ts.ts' not found.
   :
 3 │ export { ParserResult } from "./parsers/ParserResult.ts";
   │                              ~~~~~~~~~~~~~~~~~~~~~~~~~~~
   └─ in src/index.ts(3,30)
  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

@fabianhjr fabianhjr changed the title cli: allow imports with explicit extension feat: cli: allow imports with explicit extension Oct 11, 2024
@fabianhjr fabianhjr closed this Oct 11, 2024
@fabianhjr
Copy link
Contributor Author

During testing noticed some errors due to program/ast/parser expecting imports not to have extension however seems to be more involved than originally expected.

@fabianhjr
Copy link
Contributor Author

▌ Whoops, the AssemblyScript compiler has crashed during initialize :-(
▌ 
▌ Here is the stack trace hinting at the problem, perhaps it's useful?
▌ 
▌ AssertionError: assertion failed
▌     at Z.assert (/nix/store/l39m7jqnl54p2h7a50knvwfm602cnipm-assemblyscript-0.27.30/lib/node_modules/assemblyscript/std/portable/index.js:216:11)
▌     at Un.initialize (/nix/store/l39m7jqnl54p2h7a50knvwfm602cnipm-assemblyscript-0.27.30/lib/node_modules/assemblyscript/src/program.ts:1241:29)
▌     at Module.B0 (/nix/store/l39m7jqnl54p2h7a50knvwfm602cnipm-assemblyscript-0.27.30/lib/node_modules/assemblyscript/src/index-wasm.ts:352:11)
▌     at Module.Me (/nix/store/l39m7jqnl54p2h7a50knvwfm602cnipm-assemblyscript-0.27.30/lib/node_modules/assemblyscript/cli/index.js:717:22)
▌     at async file:///nix/store/l39m7jqnl54p2h7a50knvwfm602cnipm-assemblyscript-0.27.30/lib/node_modules/assemblyscript/bin/asc.js:33:22
▌ 
▌ If you see where the error is, feel free to send us a pull request. If not,
▌ please let us know: https://github.com/AssemblyScript/assemblyscript/issues
▌ 

in particular foreginPath now comes with .ts when it previously didn't which throws a wrench into resolution/matching.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant