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

esm: improve check for ESM syntax #5

Closed
wants to merge 8 commits into from

Conversation

GeoffreyBooth
Copy link
Owner

No description provided.

joyeecheung and others added 5 commits October 11, 2023 20:05
Set a default host-defined option for vm.compileFunction so that
it's consistent with vm.Script.
Instead of using the public versions of the vm APIs internally,
use the internal versions so that we can skip unnecessary
argument validation.

The public versions would need special care to the generation
of host-defined options to hit the isolate compilation cache
when imporModuleDynamically isn't used, while internally it's
almost always used, so this allows us to handle the host-defined
options separately.
Users cannot access any API that can be used to return a module or
module namespace in this callback without --experimental-vm-modules
anyway, so this would eventually lead to a rejection. This patch
rejects in this case with our own error message and use a constant
host-defined option for the rejection, so that scripts with the
same source can still be compiled using the compilation cache
if no `import()` is actually called in the script.
src/node_contextify.cc Outdated Show resolved Hide resolved
@GeoffreyBooth GeoffreyBooth force-pushed the better-esm-check-3 branch 2 times, most recently from 72ec7eb to 87b2ba7 Compare October 14, 2023 18:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants