This PR supports basic top level await support via jiti.import() and jiti <path> CLI.
Implementation is fairly basic and adds support by wrapping the module into an async function instead of function that Node.js does.
In order to allow chained usage, since jiti transforms all imports to require internally, we replace = require( patterns to = await require in async contexts to make sure they are resolved. (this is more of a workaround but better than not having it!)
This PR supports basic top level await support via
jiti.import()
andjiti <path>
CLI.Implementation is fairly basic and adds support by wrapping the module into an
async function
instead offunction
that Node.js does.In order to allow chained usage, since jiti transforms all imports to require internally, we replace
= require(
patterns to= await require
in async contexts to make sure they are resolved. (this is more of a workaround but better than not having it!)