| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 177ed3b commit fa9a9e9
12 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -36,8 +36,7 @@ If a file is found, its path will be passed to the | |||
| 36 | 36 | point to be loaded with ECMAScript module loader, such as `--import` or | |
| 37 | 37 | [`--experimental-default-type=module`][]. | |
| 38 | 38 | * The file has an `.mjs` extension. | |
| 39 | - * The file has an `.mjs` or `.wasm` (with `--experimental-wasm-modules`) | ||
| 40 | - extension. | ||
| 39 | + * The file has an `.mjs` or `.wasm` extension. | ||
| 41 | 40 | * The file does not have a `.cjs` extension, and the nearest parent | |
| 42 | 41 | `package.json` file contains a top-level [`"type"`][] field with a value of | |
| 43 | 42 | `"module"`. | |
@@ -49,8 +48,7 @@ Otherwise, the file is loaded using the CommonJS module loader. See | |||
| 49 | 48 | ||
| 50 | 49 | When loading, the [ES module loader][Modules loaders] loads the program | |
| 51 | 50 | entry point, the `node` command will accept as input only files with `.js`, | |
| 52 | - `.mjs`, or `.cjs` extensions; with `.wasm` extensions when | ||
| 53 | - [`--experimental-wasm-modules`][] is enabled; and with no extension when | ||
| 51 | + `.mjs`, `.cjs` or `.wasm` extensions; and with no extension when | ||
| 54 | 52 | [`--experimental-default-type=module`][] is passed. | |
| 55 | 53 | ||
| 56 | 54 | ## Options | |
@@ -1015,8 +1013,7 @@ Node.js currently defaults to CommonJS to instead default to ECMAScript modules, | |||
| 1015 | 1013 | with the exception of folders and subfolders below `node_modules`, for backward | |
| 1016 | 1014 | compatibility. | |
| 1017 | 1015 | ||
| 1018 | - Under `--experimental-default-type=module` and `--experimental-wasm-modules`, | ||
| 1019 | - files with no extension will be treated as WebAssembly if they begin with the | ||
| 1016 | + Files with no extension will be treated as WebAssembly if they begin with the | ||
| 1020 | 1017 | WebAssembly magic number (`\0asm`); otherwise they will be treated as ES module | |
| 1021 | 1018 | JavaScript. | |
| 1022 | 1019 | ||
@@ -1233,14 +1230,6 @@ changes: | |||
| 1233 | 1230 | ||
| 1234 | 1231 | Enable experimental WebAssembly System Interface (WASI) support. | |
| 1235 | 1232 | ||
| 1236 | - ### `--experimental-wasm-modules` | ||
| 1237 | - | ||
| 1238 | - <!-- YAML | ||
| 1239 | - added: v12.3.0 | ||
| 1240 | - --> | ||
| 1241 | - | ||
| 1242 | - Enable experimental WebAssembly module support. | ||
| 1243 | - | ||
| 1244 | 1233 | ### `--experimental-webstorage` | |
| 1245 | 1234 | ||
| 1246 | 1235 | <!-- YAML | |
@@ -3356,7 +3345,6 @@ one is included in the list below. | |||
| 3356 | 3345 | * `--experimental-transform-types` | |
| 3357 | 3346 | * `--experimental-vm-modules` | |
| 3358 | 3347 | * `--experimental-wasi-unstable-preview1` | |
| 3359 | - * `--experimental-wasm-modules` | ||
| 3360 | 3348 | * `--experimental-webstorage` | |
| 3361 | 3349 | * `--force-context-aware` | |
| 3362 | 3350 | * `--force-fips` | |
@@ -3938,7 +3926,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 | |||
| 3938 | 3926 | [`--env-file`]: #--env-fileconfig | |
| 3939 | 3927 | [`--experimental-default-type=module`]: #--experimental-default-typetype | |
| 3940 | 3928 | [`--experimental-sea-config`]: single-executable-applications.md#generating-single-executable-preparation-blobs | |
| 3941 | - [`--experimental-wasm-modules`]: #--experimental-wasm-modules | ||
| 3942 | 3929 | [`--heap-prof-dir`]: #--heap-prof-dir | |
| 3943 | 3930 | [`--import`]: #--importmodule | |
| 3944 | 3931 | [`--no-experimental-strip-types`]: #--no-experimental-strip-types | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -672,10 +672,24 @@ imported from the same path. | |||
| 672 | 672 | ||
| 673 | 673 | ## Wasm modules | |
| 674 | 674 | ||
| 675 | + <!-- YAML | ||
| 676 | + changes: | ||
| 677 | + - version: REPLACEME | ||
| 678 | + pr-url: https://github.com/nodejs/node/pull/57038 | ||
| 679 | + description: Wasm modules no longer require the `--experimental-wasm-modules` flag. | ||
| 680 | + --> | ||
| 681 | + | ||
| 682 | + Importing both WebAssembly module instances and WebAssembly source phase | ||
| 683 | + imports is supported. | ||
| 684 | + | ||
| 685 | + This integration is in line with the | ||
| 686 | + [ES Module Integration Proposal for WebAssembly][]. | ||
| 687 | + | ||
| 688 | + ## Wasm modules | ||
| 689 | + | ||
| 675 | 690 | > Stability: 1 - Experimental | |
| 676 | 691 | ||
| 677 | - Importing WebAssembly modules is supported under the | ||
| 678 | - `--experimental-wasm-modules` flag, allowing any `.wasm` files to be | ||
| 692 | + Importing WebAssembly modules is supported allowing any `.wasm` files to be | ||
| 679 | 693 | imported as normal modules while also supporting their module imports. | |
| 680 | 694 | ||
| 681 | 695 | This integration is in line with the | |
@@ -691,7 +705,7 @@ console.log(M); | |||
| 691 | 705 | executed under: | |
| 692 | 706 | ||
| 693 | 707 | ```bash | |
| 694 | - node --experimental-wasm-modules index.mjs | ||
| 708 | + node index.mjs | ||
| 695 | 709 | ``` | |
| 696 | 710 | ||
| 697 | 711 | would provide the exports interface for the instantiation of `module.wasm`. | |
@@ -738,15 +752,6 @@ imports and they cannot be inspected via `WebAssembly.Module.imports(mod)` | |||
| 738 | 752 | or virtualized unless recompiling the module using the direct | |
| 739 | 753 | `WebAssembly.compile` API with string builtins disabled. | |
| 740 | 754 | ||
| 741 | - Importing a module in the source phase before it has been instantiated will also | ||
| 742 | - use the compile-time builtins automatically: | ||
| 743 | - | ||
| 744 | - ```js | ||
| 745 | - import source mod from './string-len.wasm'; | ||
| 746 | - const { exports: { getLength } } = await WebAssembly.instantiate(mod, {}); | ||
| 747 | - getLength('foo'); // Also returns 3. | ||
| 748 | - ``` | ||
| 749 | - | ||
| 750 | 755 | ### Reserved Wasm Namespaces | |
| 751 | 756 | ||
| 752 | 757 | <!-- YAML | |
@@ -1121,7 +1126,7 @@ _isImports_, _conditions_) | |||
| 1121 | 1126 | > 1. Return _"commonjs"_. | |
| 1122 | 1127 | > 4. If _url_ ends in _".json"_, then | |
| 1123 | 1128 | > 1. Return _"json"_. | |
| 1124 | - > 5. If `--experimental-wasm-modules` is enabled and _url_ ends in | ||
| 1129 | + > 5. If _url_ ends in | ||
| 1125 | 1130 | > _".wasm"_, then | |
| 1126 | 1131 | > 1. Return _"wasm"_. | |
| 1127 | 1132 | > 6. Let _packageURL_ be the result of **LOOKUP\_PACKAGE\_SCOPE**(_url_). | |
@@ -1136,9 +1141,8 @@ _isImports_, _conditions_) | |||
| 1136 | 1141 | > 1. Return _"module"_. | |
| 1137 | 1142 | > 3. Return _"commonjs"_. | |
| 1138 | 1143 | > 11. If _url_ does not have any extension, then | |
| 1139 | - > 1. If _packageType_ is _"module"_ and `--experimental-wasm-modules` is | ||
| 1140 | - > enabled and the file at _url_ contains the header for a WebAssembly | ||
| 1141 | - > module, then | ||
| 1144 | + > 1. If _packageType_ is _"module"_ and the file at _url_ contains the | ||
| 1145 | + > header for a WebAssembly module, then | ||
| 1142 | 1146 | > 1. Return _"wasm"_. | |
| 1143 | 1147 | > 2. If _packageType_ is not **null**, then | |
| 1144 | 1148 | > 1. Return _packageType_. | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -186,9 +186,6 @@ | |||
| 186 | 186 | "experimental-vm-modules": { | |
| 187 | 187 | "type": "boolean" | |
| 188 | 188 | }, | |
| 189 | - "experimental-wasm-modules": { | ||
| 190 | - "type": "boolean" | ||
| 191 | - }, | ||
| 192 | 189 | "experimental-websocket": { | |
| 193 | 190 | "type": "boolean" | |
| 194 | 191 | }, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -234,9 +234,6 @@ Enable experimental ES module support in VM module. | |||
| 234 | 234 | Enable experimental WebAssembly System Interface support. This | |
| 235 | 235 | flag is no longer required as WASI is enabled by default. | |
| 236 | 236 | . | |
| 237 | - .It Fl -experimental-wasm-modules | ||
| 238 | - Enable experimental WebAssembly module support. | ||
| 239 | - . | ||
| 240 | 237 | .It Fl -experimental-inspector-network-resource | |
| 241 | 238 | Enable experimental support for inspector network resources. | |
| 242 | 239 | . | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -9,20 +9,15 @@ const { getValidatedPath } = require('internal/fs/utils'); | |||
| 9 | 9 | const fsBindings = internalBinding('fs'); | |
| 10 | 10 | const { internal: internalConstants } = internalBinding('constants'); | |
| 11 | 11 | ||
| 12 | - const experimentalWasmModules = getOptionValue('--experimental-wasm-modules'); | ||
| 13 | - | ||
| 14 | 12 | const extensionFormatMap = { | |
| 15 | 13 | '__proto__': null, | |
| 16 | 14 | '.cjs': 'commonjs', | |
| 17 | 15 | '.js': 'module', | |
| 18 | 16 | '.json': 'json', | |
| 19 | 17 | '.mjs': 'module', | |
| 18 | + '.wasm': 'wasm', | ||
| 20 | 19 | }; | |
| 21 | 20 | ||
| 22 | - if (experimentalWasmModules) { | ||
| 23 | - extensionFormatMap['.wasm'] = 'wasm'; | ||
| 24 | - } | ||
| 25 | - | ||
| 26 | 21 | if (getOptionValue('--experimental-strip-types')) { | |
| 27 | 22 | extensionFormatMap['.ts'] = 'module-typescript'; | |
| 28 | 23 | extensionFormatMap['.mts'] = 'module-typescript'; | |
@@ -41,7 +36,7 @@ function mimeToFormat(mime) { | |||
| 41 | 36 | ) !== null | |
| 42 | 37 | ) { return 'module'; } | |
| 43 | 38 | if (mime === 'application/json') { return 'json'; } | |
| 44 | - if (experimentalWasmModules && mime === 'application/wasm') { return 'wasm'; } | ||
| 39 | + if (mime === 'application/wasm') { return 'wasm'; } | ||
| 45 | 40 | return null; | |
| 46 | 41 | } | |
| 47 | 42 | ||
@@ -52,7 +47,6 @@ function mimeToFormat(mime) { | |||
| 52 | 47 | * @param {URL} url | |
| 53 | 48 | */ | |
| 54 | 49 | function getFormatOfExtensionlessFile(url) { | |
| 55 | - if (!experimentalWasmModules) { return 'module'; } | ||
| 56 | 50 | const path = getValidatedPath(url); | |
| 57 | 51 | switch (fsBindings.getFormatOfExtensionlessFile(path)) { | |
| 58 | 52 | case internalConstants.EXTENSIONLESS_FORMAT_WASM: | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -433,8 +433,6 @@ translators.set('json', function jsonStrategy(url, source) { | |||
| 433 | 433 | */ | |
| 434 | 434 | const wasmInstances = new SafeWeakMap(); | |
| 435 | 435 | translators.set('wasm', async function(url, source) { | |
| 436 | - emitExperimentalWarning('Importing WebAssembly modules'); | ||
| 437 | - | ||
| 438 | 436 | assertBufferSource(source, false, 'load'); | |
| 439 | 437 | ||
| 440 | 438 | debug(`Translating WASMModule ${url}`); | |
@@ -483,6 +481,7 @@ translators.set('wasm', async function(url, source) { | |||
| 483 | 481 | const createDynamicModule = require('internal/modules/esm/create_dynamic_module'); | |
| 484 | 482 | ||
| 485 | 483 | const { module } = createDynamicModule([...importsList], [...exportsList], url, (reflect) => { | |
| 484 | + emitExperimentalWarning('Importing WebAssembly module instances'); | ||
| 486 | 485 | for (const impt of importsList) { | |
| 487 | 486 | const importNs = reflect.imports[impt]; | |
| 488 | 487 | const wasmInstance = wasmInstances.get(importNs); | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -479,10 +479,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | |||
| 479 | 479 | kAllowedInEnvvar); | |
| 480 | 480 | AddAlias("--loader", "--experimental-loader"); | |
| 481 | 481 | AddOption("--experimental-modules", "", NoOp{}, kAllowedInEnvvar); | |
| 482 | - AddOption("--experimental-wasm-modules", | ||
| 483 | - "experimental ES Module support for webassembly modules", | ||
| 484 | - &EnvironmentOptions::experimental_wasm_modules, | ||
| 485 | - kAllowedInEnvvar); | ||
| 482 | + AddOption("--experimental-wasm-modules", "", NoOp{}, kAllowedInEnvvar); | ||
| 486 | 483 | AddOption("--experimental-import-meta-resolve", | |
| 487 | 484 | "experimental ES Module import.meta.resolve() parentURL support", | |
| 488 | 485 | &EnvironmentOptions::experimental_import_meta_resolve, | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -130,7 +130,6 @@ class EnvironmentOptions : public Options { | |||
| 130 | 130 | bool experimental_global_customevent = true; | |
| 131 | 131 | bool experimental_global_navigator = true; | |
| 132 | 132 | bool experimental_global_web_crypto = true; | |
| 133 | - bool experimental_wasm_modules = false; | ||
| 134 | 133 | bool experimental_import_meta_resolve = false; | |
| 135 | 134 | std::string input_type; // Value of --input-type | |
| 136 | 135 | std::string type; // Value of --experimental-default-type | |
| Back | FazBrowse Home | New Git URL |
0 commit comments