GeezerVison is showing github.com — esm: unflag --experimental-wasm-modules · nodejs/node@b919fe0
File treeExpand file treeCollapse file tree Open diff view settings Expand file treeCollapse file tree Open diff view settings Collapse file Copy file name to clipboardExpand all lines: doc/api/cli.md +1-13Lines changed: 1 addition & 13 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -33,8 +33,7 @@ If a file is found, its path will be passed to the | 33 | 33 |
| 34 | 34 | * The program was started with a command-line flag that forces the entry | 35 | 35 | point to be loaded with ECMAScript module loader, such as `--import`. | 36 | | -* The file has an `.mjs` or `.wasm` (with `--experimental-wasm-modules`) | 37 | | - extension. | | 36 | +* The file has an `.mjs` or `.wasm` extension. | 38 | 37 | * The file does not have a `.cjs` extension, and the nearest parent | 39 | 38 | `package.json` file contains a top-level [`"type"`][] field with a value of | 40 | 39 | `"module"`. | @@ -49,7 +48,6 @@ entry point, the `node` command will accept as input only files with `.js`, | 49 | 48 | `.mjs`, or `.cjs` extensions. With the following flags, additional file | 50 | 49 | extensions are enabled: | 51 | 50 |
| 52 | | -* [`--experimental-wasm-modules`][] for files with `.wasm` extension. | 53 | 51 | * [`--experimental-addon-modules`][] for files with `.node` extension. | 54 | 52 |
| 55 | 53 | ## Options | @@ -1217,14 +1215,6 @@ changes: | 1217 | 1215 |
| 1218 | 1216 | Enable experimental WebAssembly System Interface (WASI) support. | 1219 | 1217 |
| 1220 | | -### `--experimental-wasm-modules` | 1221 | | - | 1222 | | -<!-- YAML | 1223 | | -added: v12.3.0 | 1224 | | ---> | 1225 | | - | 1226 | | -Enable experimental WebAssembly module support. | 1227 | | - | 1228 | 1218 | ### `--experimental-webstorage` | 1229 | 1219 |
| 1230 | 1220 | <!-- YAML | @@ -3364,7 +3354,6 @@ one is included in the list below. | 3364 | 3354 | * `--experimental-transform-types` | 3365 | 3355 | * `--experimental-vm-modules` | 3366 | 3356 | * `--experimental-wasi-unstable-preview1` | 3367 | | -* `--experimental-wasm-modules` | 3368 | 3357 | * `--experimental-webstorage` | 3369 | 3358 | * `--force-context-aware` | 3370 | 3359 | * `--force-fips` | @@ -3943,7 +3932,6 @@ node --stack-trace-limit=12 -p -e "Error.stackTraceLimit" # prints 12 | 3943 | 3932 | [`--env-file`]: #--env-filefile | 3944 | 3933 | [`--experimental-addon-modules`]: #--experimental-addon-modules | 3945 | 3934 | [`--experimental-sea-config`]: single-executable-applications.md#generating-single-executable-preparation-blobs | 3946 | | -[`--experimental-wasm-modules`]: #--experimental-wasm-modules | 3947 | 3935 | [`--heap-prof-dir`]: #--heap-prof-dir | 3948 | 3936 | [`--import`]: #--importmodule | 3949 | 3937 | [`--no-experimental-strip-types`]: #--no-experimental-strip-types | |
Collapse file Copy file name to clipboardExpand all lines: doc/api/esm.md +38-26Lines changed: 38 additions & 26 deletions - Display the source diff
- Display the rich diff
| Original file line number | Diff line number | Diff line change |
|---|
@@ -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_. | |
Collapse file Copy file name to clipboardExpand all lines: doc/node-config-schema.json -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
| 177 | 177 | "experimental-vm-modules": { | 178 | 178 | "type": "boolean" | 179 | 179 | }, | 180 | | - "experimental-wasm-modules": { | 181 | | - "type": "boolean" | 182 | | - }, | 183 | 180 | "experimental-websocket": { | 184 | 181 | "type": "boolean" | 185 | 182 | }, | |
Collapse file Copy file name to clipboardExpand all lines: doc/node.1 -3Lines changed: 0 additions & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -220,9 +220,6 @@ Enable experimental ES module support in VM module. | 220 | 220 | Enable experimental WebAssembly System Interface support. This | 221 | 221 | flag is no longer required as WASI is enabled by default. | 222 | 222 | . | 223 | | -.It Fl -experimental-wasm-modules | 224 | | -Enable experimental WebAssembly module support. | 225 | | -. | 226 | 223 | .It Fl -experimental-quic | 227 | 224 | Enable the experimental QUIC support. | 228 | 225 | . | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/modules/esm/formats.js +2-7Lines changed: 2 additions & 7 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -9,7 +9,6 @@ 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 | 12 | const experimentalAddonModules = getOptionValue('--experimental-addon-modules'); | 14 | 13 |
| 15 | 14 | const extensionFormatMap = { | @@ -18,12 +17,9 @@ const extensionFormatMap = { | 18 | 17 | '.js': 'module', | 19 | 18 | '.json': 'json', | 20 | 19 | '.mjs': 'module', | | 20 | + '.wasm': 'wasm', | 21 | 21 | }; | 22 | 22 |
| 23 | | -if (experimentalWasmModules) { | 24 | | - extensionFormatMap['.wasm'] = 'wasm'; | 25 | | -} | 26 | | - | 27 | 23 | if (experimentalAddonModules) { | 28 | 24 | extensionFormatMap['.node'] = 'addon'; | 29 | 25 | } | @@ -46,7 +42,7 @@ function mimeToFormat(mime) { | 46 | 42 | ) !== null | 47 | 43 | ) { return 'module'; } | 48 | 44 | if (mime === 'application/json') { return 'json'; } | 49 | | - if (experimentalWasmModules && mime === 'application/wasm') { return 'wasm'; } | | 45 | + if (mime === 'application/wasm') { return 'wasm'; } | 50 | 46 | return null; | 51 | 47 | } | 52 | 48 |
| @@ -58,7 +54,6 @@ function mimeToFormat(mime) { | 58 | 54 | * @returns {'wasm'|'module'} | 59 | 55 | */ | 60 | 56 | function getFormatOfExtensionlessFile(url) { | 61 | | - if (!experimentalWasmModules) { return 'module'; } | 62 | 57 | const path = getValidatedPath(url); | 63 | 58 | switch (fsBindings.getFormatOfExtensionlessFile(path)) { | 64 | 59 | case internalConstants.EXTENSIONLESS_FORMAT_WASM: | |
Collapse file Copy file name to clipboardExpand all lines: lib/internal/modules/esm/translators.js +1-2Lines changed: 1 addition & 2 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -495,8 +495,6 @@ translators.set('json', function jsonStrategy(url, source) { | 495 | 495 | */ | 496 | 496 | const wasmInstances = new SafeWeakMap(); | 497 | 497 | translators.set('wasm', async function(url, source) { | 498 | | - emitExperimentalWarning('Importing WebAssembly modules'); | 499 | | - | 500 | 498 | assertBufferSource(source, false, 'load'); | 501 | 499 |
| 502 | 500 | debug(`Translating WASMModule ${url}`); | @@ -546,6 +544,7 @@ translators.set('wasm', async function(url, source) { | 546 | 544 | const createDynamicModule = require('internal/modules/esm/create_dynamic_module'); | 547 | 545 |
| 548 | 546 | const { module } = createDynamicModule([...importsList], [...exportsList], url, (reflect) => { | | 547 | + emitExperimentalWarning('Importing WebAssembly module instances'); | 549 | 548 | for (const impt of importsList) { | 550 | 549 | const importNs = reflect.imports[impt]; | 551 | 550 | const wasmInstance = wasmInstances.get(importNs); | |
Collapse file Copy file name to clipboardExpand all lines: src/node.cc +1-3Lines changed: 1 addition & 3 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -773,9 +773,7 @@ static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args, | 773 | 773 | env_opts->abort_on_uncaught_exception = true; | 774 | 774 | } | 775 | 775 |
| 776 | | - if (env_opts->experimental_wasm_modules) { | 777 | | - v8_args.emplace_back("--js-source-phase-imports"); | 778 | | - } | | 776 | + v8_args.emplace_back("--js-source-phase-imports"); | 779 | 777 |
| 780 | 778 | #ifdef __POSIX__ | 781 | 779 | // Block SIGPROF signals when sleeping in epoll_wait/kevent/etc. Avoids the | |
Collapse file Copy file name to clipboardExpand all lines: src/node_options.cc +1-4Lines changed: 1 addition & 4 deletions | Original file line number | Diff line number | Diff line change |
|---|
@@ -536,10 +536,7 @@ EnvironmentOptionsParser::EnvironmentOptionsParser() { | 536 | 536 | kAllowedInEnvvar); | 537 | 537 | AddAlias("--loader", "--experimental-loader"); | 538 | 538 | AddOption("--experimental-modules", "", NoOp{}, kAllowedInEnvvar); | 539 | | - AddOption("--experimental-wasm-modules", | 540 | | - "experimental ES Module support for webassembly modules", | 541 | | - &EnvironmentOptions::experimental_wasm_modules, | 542 | | - kAllowedInEnvvar); | | 539 | + AddOption("--experimental-wasm-modules", "", NoOp{}, kAllowedInEnvvar); | 543 | 540 | AddOption("--experimental-import-meta-resolve", | 544 | 541 | "experimental ES Module import.meta.resolve() parentURL support", | 545 | 542 | &EnvironmentOptions::experimental_import_meta_resolve, | |
Collapse file Copy file name to clipboardExpand all lines: src/node_options.h -1Lines changed: 0 additions & 1 deletion | Original file line number | Diff line number | Diff line change |
|---|
@@ -133,7 +133,6 @@ class EnvironmentOptions : public Options { | 133 | 133 | std::string localstorage_file; | 134 | 134 | bool experimental_global_navigator = true; | 135 | 135 | bool experimental_global_web_crypto = true; | 136 | | - bool experimental_wasm_modules = false; | 137 | 136 | bool experimental_import_meta_resolve = false; | 138 | 137 | std::string input_type; // Value of --input-type | 139 | 138 | bool entry_is_url = false; | |
|