DanielXMoore / Civet

A TypeScript superset that favors more types and less typing
https://civet.dev
MIT License
1.33k stars 28 forks source link

More comptime #1219

Closed edemaine closed 1 month ago

edemaine commented 1 month ago

Switching to vm actually makes dynamic import work too, on Node 21.7+. But it generates a warning, so I haven't added a test. Here's a demo:

$ civet -c --comptime                  (node-shim ?$)
Civet 0.7.5 REPL.  Enter a blank line to transpile code.
šŸˆ> x = comptime
...   import { readFile } from 'fs/promises'
...   JSON.parse(await readFile 'package.json').version
...
(node:33596) ExperimentalWarning: vm.USE_MAIN_CONTEXT_DEFAULT_LOADER is an experimental feature and might change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
x = "0.7.5"
šŸˆ>