-
Notifications
You must be signed in to change notification settings - Fork 31.3k
esm: Source Phase Imports for WebAssembly #56919
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
Conversation
Review requested:
|
c485531
to
8b3ce05
Compare
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #56919 +/- ##
==========================================
- Coverage 90.26% 90.24% -0.03%
==========================================
Files 630 630
Lines 184690 184891 +201
Branches 36142 36173 +31
==========================================
+ Hits 166712 166854 +142
- Misses 11021 11064 +43
- Partials 6957 6973 +16
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
lgtm
I'm working on corresponding patch to emscripten to enable source phase imports: emscripten-core/emscripten#23175 As such, I would love to see this patch landed so we can start testing it! |
Co-authored-by: Antoine du Hamel <[email protected]> Co-authored-by: Michaël Zasso <[email protected]>
This reverts commit 009373d.
81890a1
to
b9794f7
Compare
This comment was marked as outdated.
This comment was marked as outdated.
PR-URL: #56919 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Stephen Belanger <[email protected]>
Landed in db4dcc0. |
Now that node support has been landed we can test this, at least against the latest node canary builds. See nodejs/node#56919 Fixes: emscripten-core#23047
Now that node support has been landed we can test this, at least against the latest node canary builds. See nodejs/node#56919 Fixes: emscripten-core#23047
Now that node support has been landed we can test this, at least against the latest node canary builds. See nodejs/node#56919 Fixes: emscripten-core#23047
Now that node support has been landed we can test this, at least against the latest node canary builds. See nodejs/node#56919 Fixes: emscripten-core#23047
Now that node support has been landed we can test this, at least against the latest node canary builds. See nodejs/node#56919 Fixes: #23047
PR-URL: #56919 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Stephen Belanger <[email protected]>
PR-URL: #56919 Reviewed-By: Matteo Collina <[email protected]> Reviewed-By: Michaël Zasso <[email protected]> Reviewed-By: Stephen Belanger <[email protected]>
This implements the Stage 3 Source Phase Imports proposal for Node.js (with latest specification at tc39/ecma262#3492), based on the new V8 parser and module loading APIs for this feature.
Phases in the module pipeline represent the ability to load uninstantiated modules (and in future with import defer, unexecuted modules as well).
While we are still waiting for progression on https://github.com/tc39/proposal-esm-phase-imports for JS Source Phase objects, this implements only the WebAssembly source phase per the Wasm ESM Integration Phase 3 proposal (https://github.com/webassembly/esm-integration).
This PR adds support both for dynamic and static source phase syntax:
This allows obtaining a Wasm module through the ESM integration, without it being instantiated through the Node.js resolver, to permit custom instantiations:
The dynamic source phase support is a one-line TODO, which is pending #56842. When this lands the skipped tests have been tested against that branch to fully pass.
When a source phase representation for a module is not available, a new
ERR_SOURCE_PHASE_NOT_DEFINED
SyntaxError is thrown as per the standard.The VM API is updated to take a string phase argument as its last argument, although the ability to define source phase representations for virtual modules is not currently supported, and left as a future integration point. Perhaps this will simplify with ESM Phase Imports in future as well allowing handles to modules outside of the VM graph.
Resolves #53178.
@nodejs/loaders