esm: unflag --experimental-wasm-modules · nodejs/node@b919fe0

@@ -701,34 +701,23 @@ imported from the same path.

701701702702

## Wasm modules

703703704-

> Stability: 1 - Experimental

704+

<!-- YAML

705+

changes:

706+

- version: REPLACEME

707+

pr-url: https://github.com/nodejs/node/pull/57038

708+

description: Wasm modules no longer require the `--experimental-wasm-modules` flag.

709+

-->

705710706711

Importing both WebAssembly module instances and WebAssembly source phase

707-

imports are supported under the `--experimental-wasm-modules` flag.

712+

imports is supported.

708713709714

Both of these integrations are in line with the

710715

[ES Module Integration Proposal for WebAssembly][].

711716712-

Instance imports allow any `.wasm` files to be imported as normal modules,

713-

supporting their module imports in turn.

714-715-

For example, an `index.js` containing:

716-717-

```js

718-

import * as M from './library.wasm';

719-

console.log(M);

720-

```

721-722-

executed under:

723-724-

```bash

725-

node --experimental-wasm-modules index.mjs

726-

```

727-728-

would provide the exports interface for the instantiation of `library.wasm`.

729-730717

### Wasm Source Phase Imports

731718719+

> Stability: 1.2 - Release candidate

720+732721

<!-- YAML

733722

added: v24.0.0

734723

-->

@@ -762,6 +751,8 @@ const instance = await WebAssembly.instantiate(dynamicLibrary, importObject);

762751763752

### JavaScript String Builtins

764753754+

> Stability: 1.2 - Release candidate

755+765756

<!-- YAML

766757

added: REPLACEME

767758

-->

@@ -811,14 +802,36 @@ const { exports: { getLength } } = await WebAssembly.instantiate(mod, {});

811802

getLength('foo'); // Also returns 3.

812803

```

813804805+

### Wasm Instance Phase Imports

806+807+

> Stability: 1.1 - Active development

808+809+

Instance imports allow any `.wasm` files to be imported as normal modules,

810+

supporting their module imports in turn.

811+812+

For example, an `index.js` containing:

813+814+

```js

815+

import * as M from './library.wasm';

816+

console.log(M);

817+

```

818+819+

executed under:

820+821+

```bash

822+

node index.mjs

823+

```

824+825+

would provide the exports interface for the instantiation of `library.wasm`.

826+814827

### Reserved Wasm Namespaces

815828816829

<!-- YAML

817830

added: REPLACEME

818831

-->

819832820-

When importing WebAssembly modules through the ESM Integration, they cannot use

821-

import module names or import/export names that start with reserved prefixes:

833+

When importing WebAssembly module instances, they cannot use import module

834+

names or import/export names that start with reserved prefixes:

822835823836

* `wasm-js:` - reserved in all module import names, module names and export

824837

names.

@@ -1185,7 +1198,7 @@ _isImports_, _conditions_)

11851198

> 1. Return _"commonjs"_.

11861199

> 4. If _url_ ends in _".json"_, then

11871200

> 1. Return _"json"_.

1188-

> 5. If `--experimental-wasm-modules` is enabled and _url_ ends in

1201+

> 5. If _url_ ends in

11891202

> _".wasm"_, then

11901203

> 1. Return _"wasm"_.

11911204

> 6. If `--experimental-addon-modules` is enabled and _url_ ends in

@@ -1203,9 +1216,8 @@ _isImports_, _conditions_)

12031216

> 1. Return _"module"_.

12041217

> 3. Return _"commonjs"_.

12051218

> 12. If _url_ does not have any extension, then

1206-

> 1. If _packageType_ is _"module"_ and `--experimental-wasm-modules` is

1207-

> enabled and the file at _url_ contains the header for a WebAssembly

1208-

> module, then

1219+

> 1. If _packageType_ is _"module"_ and the file at _url_ contains the

1220+

> "application/wasm" content type header for a WebAssembly module, then

12091221

> 1. Return _"wasm"_.

12101222

> 2. If _packageType_ is not **null**, then

12111223

> 1. Return _packageType_.