| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
There was a problem hiding this comment.
Note that this is slightly different than the standards track semantics, as it doesn't take a turn on the event loop during Instantiation. However, I don't expect this to affect most programs. I would also encourage you to write several more tests before landing.
Sorry, something went wrong.
There was a problem hiding this comment.
In a cycle-closing edge, will reflect.imports usually be an empty object? If so, this will be basically the right semantics.
Sorry, something went wrong.
There was a problem hiding this comment.
On the unexecuted cycle edge, reflect.imports would contain all the imported module namespaces, with their named exports, but all of those named exports would be undefined. Function exports would be supported in cycles here though just like ES modules.
Sorry, something went wrong.
There was a problem hiding this comment.
Actually cycles would throw for any accesses to uninitialized let bindings on the namespaces, since these would be in TDZ.
Sorry, something went wrong.
There was a problem hiding this comment.
To summarize:
Sorry, something went wrong.
There was a problem hiding this comment.
And specifically these errors are only thrown if the WASM module actually attempts to access the given binding.
Sorry, something went wrong.
There was a problem hiding this comment.
Right, so in particular, Wasm exports should always act like const bindings, and all imports are accessed during Instantiate (in the ESM evaluate phase). Does this implementation do that?
Sorry, something went wrong.
There was a problem hiding this comment.
yep! reflect.imports is namespace objects so the imports are accessed directly.
Sorry, something went wrong.
There was a problem hiding this comment.
please upload a wat source for simple.wasm with a comment in the top with the command used to produce simple.wasm
example: https://github.com/nodejs/node/blob/master/test/fixtures/shared-memory.wat
Sorry, something went wrong.
There was a problem hiding this comment.
Sorry, something went wrong.
declare a wasm start function in your wasm module this reminds me, @guybedford can you make a test which verifies that start functions run at the correct time?
at the moment, import() |
Sorry, something went wrong.
|
@devsnek so node somethingWithStart.wasm will work? I'll rephrase the question - how might one synchronously consume wasm modules in cjs? |
Sorry, something went wrong.
yes
not possible atm. if require(esm) happens that would work i guess. |
Sorry, something went wrong.
There was a problem hiding this comment.
actually... can you add a test that verifies that the wasm start function runs during the evaluate phase? in wat, you can specify it with (start $funcname)
Sorry, something went wrong.
|
Sure, I've added a start function test. |
Sorry, something went wrong.
There was a problem hiding this comment.
LGTM
Sorry, something went wrong.
There was a problem hiding this comment.
There's one additional mention of the non-existent --entry-type CLI flag 7 lines below this one. Is this the right PR to remove or update that material?
Sorry, something went wrong.
There was a problem hiding this comment.
Nice work @guybedford!
Sorry, something went wrong.
Sorry, something went wrong.
PR-URL: #27659 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
PR-URL: #27659 Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Michaël Zasso <targos@protonmail.com> Reviewed-By: Myles Borins <myles.borins@gmail.com> Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Notable changes:
* esm:
* Added the `--experimental-wasm-modules` flag to support
WebAssembly modules (Myles Borins & Guy Bedford)
#27659
* process:
* Log errors using `util.inspect` in case of fatal exceptions
(Ruben Bridgewater) #27243
* repl:
* Add `process.on('uncaughtException')` support (Ruben Bridgewater)
#27151
* stream:
* Implemented `Readable.from` async iterator utility (Guy Bedford)
#27660
* tls:
* Expose built-in root certificates (Ben Noordhuis)
#26415
* Support `net.Server` options (Luigi Pinca)
#27665
* Expose `keylog` event on TLSSocket (Alba Mendez)
#27654
* worker:
* Added the ability to unshift messages from the `MessagePort`
(Anna Henningsen) #27294
PR-URL: #27799
Notable changes:
* esm:
* Added the `--experimental-wasm-modules` flag to support
WebAssembly modules (Myles Borins & Guy Bedford)
#27659
* process:
* Log errors using `util.inspect` in case of fatal exceptions
(Ruben Bridgewater) #27243
* repl:
* Add `process.on('uncaughtException')` support (Ruben Bridgewater)
#27151
* stream:
* Implemented `Readable.from` async iterator utility (Guy Bedford)
#27660
* tls:
* Expose built-in root certificates (Ben Noordhuis)
#26415
* Support `net.Server` options (Luigi Pinca)
#27665
* Expose `keylog` event on TLSSocket (Alba Mendez)
#27654
* worker:
* Added the ability to unshift messages from the `MessagePort`
(Anna Henningsen) #27294
PR-URL: #27799
|
Ahem, very interesting! 😄 Any guidelines or examples on how to start playing with it in Node.js? |
Sorry, something went wrong.
|
I've created an example project using '--experimental-wasm-modules' for those who're interested. |
Sorry, something went wrong.
PR-URL: #27948 Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Guy Bedford <guybedford@gmail.com> Reviewed-By: Shingo Inoue <leko.noor@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
| Back | FazBrowse Home | New Git URL |
This PR provides support for node --experimental-modules --experimental-wasm-modules to support the ES module integration of WebAssembly modules through eg import './module.wasm'.
The semantics match the proposed ES module integration semantics for Web Assembly as specified in https://github.com/webassembly/esm-integration.
At the previous modules group meeting we got consensus approval for upstreaming this feature under the --experimental-wasm-modules flag.
//cc @nodejs/modules
Checklist