@@ -701,34 +701,23 @@ imported from the same path.
701
701
702
702
## Wasm modules
703
703
704
- > 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
+ -->
705
710
706
711
Importing both WebAssembly module instances and WebAssembly source phase
707
- imports are supported under the ` -- experimental - wasm - modules ` flag .
712
+ imports is supported.
708
713
709
714
Both of these integrations are in line with the
710
715
[ES Module Integration Proposal for WebAssembly][].
711
716
712
- 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
-
730
717
### Wasm Source Phase Imports
731
718
719
+ > Stability: 1.2 - Release candidate
720
+
732
721
<!-- YAML
733
722
added: v24.0.0
734
723
-->
@@ -762,6 +751,8 @@ const instance = await WebAssembly.instantiate(dynamicLibrary, importObject);
762
751
763
752
### JavaScript String Builtins
764
753
754
+ > Stability: 1.2 - Release candidate
755
+
765
756
<!-- YAML
766
757
added: REPLACEME
767
758
-->
@@ -811,14 +802,36 @@ const { exports: { getLength } } = await WebAssembly.instantiate(mod, {});
811
802
getLength (' foo' ); // Also returns 3.
812
803
` ` `
813
804
805
+ ### 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
+
814
827
### Reserved Wasm Namespaces
815
828
816
829
<!-- YAML
817
830
added: REPLACEME
818
831
-->
819
832
820
- 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:
822
835
823
836
* ` wasm- js: ` - reserved in all module import names, module names and export
824
837
names.
@@ -1185,7 +1198,7 @@ _isImports_, _conditions_)
1185
1198
> 1. Return _"commonjs"_.
1186
1199
> 4. If _url_ ends in _".json"_, then
1187
1200
> 1. Return _"json"_.
1188
- > 5. If ` -- experimental - wasm - modules ` is enabled and _url_ ends in
1201
+ > 5. If _url_ ends in
1189
1202
> _".wasm"_, then
1190
1203
> 1. Return _"wasm"_.
1191
1204
> 6. If ` -- experimental- addon- modules` is enabled and _url_ ends in
@@ -1203,9 +1216,8 @@ _isImports_, _conditions_)
1203
1216
> 1. Return _"module"_.
1204
1217
> 3. Return _"commonjs"_.
1205
1218
> 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
1209
1221
> 1. Return _"wasm"_.
1210
1222
> 2. If _packageType_ is not **null**, then
1211
1223
> 1. Return _packageType_.
0 commit comments