mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00
esm: unflag --experimental-wasm-modules
PR-URL: https://github.com/nodejs/node/pull/57038 Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Stephen Belanger <admin@stephenbelanger.com> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com>
This commit is contained in:
parent
ec2b74a7dc
commit
0df15188d7
13 changed files with 49 additions and 89 deletions
|
@ -33,8 +33,7 @@ If a file is found, its path will be passed to the
|
|||
|
||||
* The program was started with a command-line flag that forces the entry
|
||||
point to be loaded with ECMAScript module loader, such as `--import`.
|
||||
* The file has an `.mjs` or `.wasm` (with `--experimental-wasm-modules`)
|
||||
extension.
|
||||
* The file has an `.mjs` or `.wasm` extension.
|
||||
* The file does not have a `.cjs` extension, and the nearest parent
|
||||
`package.json` file contains a top-level [`"type"`][] field with a value of
|
||||
`"module"`.
|
||||
|
@ -49,7 +48,6 @@ entry point, the `node` command will accept as input only files with `.js`,
|
|||
`.mjs`, or `.cjs` extensions. With the following flags, additional file
|
||||
extensions are enabled:
|
||||
|
||||
* [`--experimental-wasm-modules`][] for files with `.wasm` extension.
|
||||
* [`--experimental-addon-modules`][] for files with `.node` extension.
|
||||
|
||||
## Options
|
||||
|
@ -1255,14 +1253,6 @@ changes:
|
|||
|
||||
Enable experimental WebAssembly System Interface (WASI) support.
|
||||
|
||||
### `--experimental-wasm-modules`
|
||||
|
||||
<!-- YAML
|
||||
added: v12.3.0
|
||||
-->
|
||||
|
||||
Enable experimental WebAssembly module support.
|
||||
|
||||
### `--experimental-webstorage`
|
||||
|
||||
<!-- YAML
|
||||
|
@ -3404,7 +3394,6 @@ one is included in the list below.
|
|||
* `--experimental-transform-types`
|
||||
* `--experimental-vm-modules`
|
||||
* `--experimental-wasi-unstable-preview1`
|
||||
* `--experimental-wasm-modules`
|
||||
* `--experimental-webstorage`
|
||||
* `--force-context-aware`
|
||||
* `--force-fips`
|
||||
|
@ -3984,7 +3973,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12
|
|||
[`--env-file`]: #--env-filefile
|
||||
[`--experimental-addon-modules`]: #--experimental-addon-modules
|
||||
[`--experimental-sea-config`]: single-executable-applications.md#generating-single-executable-preparation-blobs
|
||||
[`--experimental-wasm-modules`]: #--experimental-wasm-modules
|
||||
[`--heap-prof-dir`]: #--heap-prof-dir
|
||||
[`--import`]: #--importmodule
|
||||
[`--no-experimental-strip-types`]: #--no-experimental-strip-types
|
||||
|
|
|
@ -705,34 +705,23 @@ imported from the same path.
|
|||
|
||||
## Wasm modules
|
||||
|
||||
> Stability: 1 - Experimental
|
||||
<!-- YAML
|
||||
changes:
|
||||
- version: REPLACEME
|
||||
pr-url: https://github.com/nodejs/node/pull/57038
|
||||
description: Wasm modules no longer require the `--experimental-wasm-modules` flag.
|
||||
-->
|
||||
|
||||
Importing both WebAssembly module instances and WebAssembly source phase
|
||||
imports are supported under the `--experimental-wasm-modules` flag.
|
||||
imports is supported.
|
||||
|
||||
Both of these integrations are in line with the
|
||||
[ES Module Integration Proposal for WebAssembly][].
|
||||
|
||||
Instance imports allow any `.wasm` files to be imported as normal modules,
|
||||
supporting their module imports in turn.
|
||||
|
||||
For example, an `index.js` containing:
|
||||
|
||||
```js
|
||||
import * as M from './library.wasm';
|
||||
console.log(M);
|
||||
```
|
||||
|
||||
executed under:
|
||||
|
||||
```bash
|
||||
node --experimental-wasm-modules index.mjs
|
||||
```
|
||||
|
||||
would provide the exports interface for the instantiation of `library.wasm`.
|
||||
|
||||
### Wasm Source Phase Imports
|
||||
|
||||
> Stability: 1.2 - Release candidate
|
||||
|
||||
<!-- YAML
|
||||
added: v24.0.0
|
||||
-->
|
||||
|
@ -766,6 +755,8 @@ const instance = await WebAssembly.instantiate(dynamicLibrary, importObject);
|
|||
|
||||
### JavaScript String Builtins
|
||||
|
||||
> Stability: 1.2 - Release candidate
|
||||
|
||||
<!-- YAML
|
||||
added: REPLACEME
|
||||
-->
|
||||
|
@ -815,14 +806,36 @@ const { exports: { getLength } } = await WebAssembly.instantiate(mod, {});
|
|||
getLength('foo'); // Also returns 3.
|
||||
```
|
||||
|
||||
### Wasm Instance Phase Imports
|
||||
|
||||
> Stability: 1.1 - Active development
|
||||
|
||||
Instance imports allow any `.wasm` files to be imported as normal modules,
|
||||
supporting their module imports in turn.
|
||||
|
||||
For example, an `index.js` containing:
|
||||
|
||||
```js
|
||||
import * as M from './library.wasm';
|
||||
console.log(M);
|
||||
```
|
||||
|
||||
executed under:
|
||||
|
||||
```bash
|
||||
node index.mjs
|
||||
```
|
||||
|
||||
would provide the exports interface for the instantiation of `library.wasm`.
|
||||
|
||||
### Reserved Wasm Namespaces
|
||||
|
||||
<!-- YAML
|
||||
added: REPLACEME
|
||||
-->
|
||||
|
||||
When importing WebAssembly modules through the ESM Integration, they cannot use
|
||||
import module names or import/export names that start with reserved prefixes:
|
||||
When importing WebAssembly module instances, they cannot use import module
|
||||
names or import/export names that start with reserved prefixes:
|
||||
|
||||
* `wasm-js:` - reserved in all module import names, module names and export
|
||||
names.
|
||||
|
@ -1189,7 +1202,7 @@ _isImports_, _conditions_)
|
|||
> 1. Return _"commonjs"_.
|
||||
> 4. If _url_ ends in _".json"_, then
|
||||
> 1. Return _"json"_.
|
||||
> 5. If `--experimental-wasm-modules` is enabled and _url_ ends in
|
||||
> 5. If _url_ ends in
|
||||
> _".wasm"_, then
|
||||
> 1. Return _"wasm"_.
|
||||
> 6. If `--experimental-addon-modules` is enabled and _url_ ends in
|
||||
|
@ -1207,9 +1220,8 @@ _isImports_, _conditions_)
|
|||
> 1. Return _"module"_.
|
||||
> 3. Return _"commonjs"_.
|
||||
> 12. If _url_ does not have any extension, then
|
||||
> 1. If _packageType_ is _"module"_ and `--experimental-wasm-modules` is
|
||||
> enabled and the file at _url_ contains the header for a WebAssembly
|
||||
> module, then
|
||||
> 1. If _packageType_ is _"module"_ and the file at _url_ contains the
|
||||
> "application/wasm" content type header for a WebAssembly module, then
|
||||
> 1. Return _"wasm"_.
|
||||
> 2. If _packageType_ is not **null**, then
|
||||
> 1. Return _packageType_.
|
||||
|
|
|
@ -180,9 +180,6 @@
|
|||
"experimental-vm-modules": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"experimental-wasm-modules": {
|
||||
"type": "boolean"
|
||||
},
|
||||
"experimental-websocket": {
|
||||
"type": "boolean"
|
||||
},
|
||||
|
|
|
@ -223,9 +223,6 @@ Enable experimental ES module support in VM module.
|
|||
Enable experimental WebAssembly System Interface support. This
|
||||
flag is no longer required as WASI is enabled by default.
|
||||
.
|
||||
.It Fl -experimental-wasm-modules
|
||||
Enable experimental WebAssembly module support.
|
||||
.
|
||||
.It Fl -experimental-quic
|
||||
Enable the experimental QUIC support.
|
||||
.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue