| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent c1a8ae3 commit e96f7ef
3 files changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -62,7 +62,7 @@ changes: | |||
| 62 | 62 | - v17.0.0 | |
| 63 | 63 | - v16.12.0 | |
| 64 | 64 | pr-url: https://github.com/nodejs/node/pull/40249 | |
| 65 | - description: Added support for import assertions to the | ||
| 65 | + description: Added support for import attributes to the | ||
| 66 | 66 | `importModuleDynamically` parameter. | |
| 67 | 67 | - version: v10.6.0 | |
| 68 | 68 | pr-url: https://github.com/nodejs/node/pull/20300 | |
@@ -101,7 +101,7 @@ changes: | |||
| 101 | 101 | using it in a production environment. | |
| 102 | 102 | * `specifier` {string} specifier passed to `import()` | |
| 103 | 103 | * `script` {vm.Script} | |
| 104 | - * `importAssertions` {Object} The `"assert"` value passed to the | ||
| 104 | + * `importAttributes` {Object} The `"assert"` value passed to the | ||
| 105 | 105 | [`optionsExpression`][] optional parameter, or an empty object if no value | |
| 106 | 106 | was provided. | |
| 107 | 107 | * Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is | |
@@ -613,6 +613,14 @@ The identifier of the current module, as set in the constructor. | |||
| 613 | 613 | ||
| 614 | 614 | ### `module.link(linker)` | |
| 615 | 615 | ||
| 616 | + <!-- YAML | ||
| 617 | + changes: | ||
| 618 | + - version: REPLACEME | ||
| 619 | + pr-url: https://github.com/nodejs/node/pull/50141 | ||
| 620 | + description: The option `extra.assert` is renamed to `extra.attributes`. The | ||
| 621 | + former name is still provided for backward compatibility. | ||
| 622 | + --> | ||
| 623 | + | ||
| 616 | 624 | * `linker` {Function} | |
| 617 | 625 | * `specifier` {string} The specifier of the requested module: | |
| 618 | 626 | ```mjs | |
@@ -623,15 +631,14 @@ The identifier of the current module, as set in the constructor. | |||
| 623 | 631 | * `referencingModule` {vm.Module} The `Module` object `link()` is called on. | |
| 624 | 632 | ||
| 625 | 633 | * `extra` {Object} | |
| 626 | - * `assert` {Object} The data from the assertion: | ||
| 627 | - <!-- eslint-skip --> | ||
| 628 | - ```js | ||
| 634 | + * `attributes` {Object} The data from the attribute: | ||
| 635 | + ```mjs | ||
| 629 | 636 | import foo from 'foo' assert { name: 'value' }; | |
| 630 | - // ^^^^^^^^^^^^^^^^^ the assertion | ||
| 637 | + // ^^^^^^^^^^^^^^^^^ the attribute | ||
| 631 | 638 | ``` | |
| 632 | - Per ECMA-262, hosts are expected to ignore assertions that they do not | ||
| 633 | - support, as opposed to, for example, triggering an error if an | ||
| 634 | - unsupported assertion is present. | ||
| 639 | + Per ECMA-262, hosts are expected to trigger an error if an | ||
| 640 | + unsupported attribute is present. | ||
| 641 | + * `assert` {Object} Alias for `extra.attributes`. | ||
| 635 | 642 | ||
| 636 | 643 | * Returns: {vm.Module|Promise} | |
| 637 | 644 | * Returns: {Promise} | |
@@ -730,7 +737,7 @@ changes: | |||
| 730 | 737 | - v17.0.0 | |
| 731 | 738 | - v16.12.0 | |
| 732 | 739 | pr-url: https://github.com/nodejs/node/pull/40249 | |
| 733 | - description: Added support for import assertions to the | ||
| 740 | + description: Added support for import attributes to the | ||
| 734 | 741 | `importModuleDynamically` parameter. | |
| 735 | 742 | --> | |
| 736 | 743 | ||
@@ -760,7 +767,7 @@ changes: | |||
| 760 | 767 | `import()` will reject with [`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`][]. | |
| 761 | 768 | * `specifier` {string} specifier passed to `import()` | |
| 762 | 769 | * `module` {vm.Module} | |
| 763 | - * `importAssertions` {Object} The `"assert"` value passed to the | ||
| 770 | + * `importAttributes` {Object} The `"assert"` value passed to the | ||
| 764 | 771 | [`optionsExpression`][] optional parameter, or an empty object if no value | |
| 765 | 772 | was provided. | |
| 766 | 773 | * Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is | |
@@ -974,7 +981,7 @@ changes: | |||
| 974 | 981 | - v17.0.0 | |
| 975 | 982 | - v16.12.0 | |
| 976 | 983 | pr-url: https://github.com/nodejs/node/pull/40249 | |
| 977 | - description: Added support for import assertions to the | ||
| 984 | + description: Added support for import attributes to the | ||
| 978 | 985 | `importModuleDynamically` parameter. | |
| 979 | 986 | - version: v15.9.0 | |
| 980 | 987 | pr-url: https://github.com/nodejs/node/pull/35431 | |
@@ -1018,7 +1025,7 @@ changes: | |||
| 1018 | 1025 | considered stable. | |
| 1019 | 1026 | * `specifier` {string} specifier passed to `import()` | |
| 1020 | 1027 | * `function` {Function} | |
| 1021 | - * `importAssertions` {Object} The `"assert"` value passed to the | ||
| 1028 | + * `importAttributes` {Object} The `"assert"` value passed to the | ||
| 1022 | 1029 | [`optionsExpression`][] optional parameter, or an empty object if no value | |
| 1023 | 1030 | was provided. | |
| 1024 | 1031 | * Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is | |
@@ -1204,7 +1211,7 @@ changes: | |||
| 1204 | 1211 | - v17.0.0 | |
| 1205 | 1212 | - v16.12.0 | |
| 1206 | 1213 | pr-url: https://github.com/nodejs/node/pull/40249 | |
| 1207 | - description: Added support for import assertions to the | ||
| 1214 | + description: Added support for import attributes to the | ||
| 1208 | 1215 | `importModuleDynamically` parameter. | |
| 1209 | 1216 | - version: v6.3.0 | |
| 1210 | 1217 | pr-url: https://github.com/nodejs/node/pull/6635 | |
@@ -1242,7 +1249,7 @@ changes: | |||
| 1242 | 1249 | using it in a production environment. | |
| 1243 | 1250 | * `specifier` {string} specifier passed to `import()` | |
| 1244 | 1251 | * `script` {vm.Script} | |
| 1245 | - * `importAssertions` {Object} The `"assert"` value passed to the | ||
| 1252 | + * `importAttributes` {Object} The `"assert"` value passed to the | ||
| 1246 | 1253 | [`optionsExpression`][] optional parameter, or an empty object if no value | |
| 1247 | 1254 | was provided. | |
| 1248 | 1255 | * Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is | |
@@ -1282,7 +1289,7 @@ changes: | |||
| 1282 | 1289 | - v17.0.0 | |
| 1283 | 1290 | - v16.12.0 | |
| 1284 | 1291 | pr-url: https://github.com/nodejs/node/pull/40249 | |
| 1285 | - description: Added support for import assertions to the | ||
| 1292 | + description: Added support for import attributes to the | ||
| 1286 | 1293 | `importModuleDynamically` parameter. | |
| 1287 | 1294 | - version: v14.6.0 | |
| 1288 | 1295 | pr-url: https://github.com/nodejs/node/pull/34023 | |
@@ -1341,7 +1348,7 @@ changes: | |||
| 1341 | 1348 | using it in a production environment. | |
| 1342 | 1349 | * `specifier` {string} specifier passed to `import()` | |
| 1343 | 1350 | * `script` {vm.Script} | |
| 1344 | - * `importAssertions` {Object} The `"assert"` value passed to the | ||
| 1351 | + * `importAttributes` {Object} The `"assert"` value passed to the | ||
| 1345 | 1352 | [`optionsExpression`][] optional parameter, or an empty object if no value | |
| 1346 | 1353 | was provided. | |
| 1347 | 1354 | * Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is | |
@@ -1385,7 +1392,7 @@ changes: | |||
| 1385 | 1392 | - v17.0.0 | |
| 1386 | 1393 | - v16.12.0 | |
| 1387 | 1394 | pr-url: https://github.com/nodejs/node/pull/40249 | |
| 1388 | - description: Added support for import assertions to the | ||
| 1395 | + description: Added support for import attributes to the | ||
| 1389 | 1396 | `importModuleDynamically` parameter. | |
| 1390 | 1397 | - version: v6.3.0 | |
| 1391 | 1398 | pr-url: https://github.com/nodejs/node/pull/6635 | |
@@ -1421,7 +1428,7 @@ changes: | |||
| 1421 | 1428 | using it in a production environment. | |
| 1422 | 1429 | * `specifier` {string} specifier passed to `import()` | |
| 1423 | 1430 | * `script` {vm.Script} | |
| 1424 | - * `importAssertions` {Object} The `"assert"` value passed to the | ||
| 1431 | + * `importAttributes` {Object} The `"assert"` value passed to the | ||
| 1425 | 1432 | [`optionsExpression`][] optional parameter, or an empty object if no value | |
| 1426 | 1433 | was provided. | |
| 1427 | 1434 | * Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -302,8 +302,8 @@ class SourceTextModule extends Module { | |||
| 302 | 302 | this[kLink] = async (linker) => { | |
| 303 | 303 | this.#statusOverride = 'linking'; | |
| 304 | 304 | ||
| 305 | - const promises = this[kWrap].link(async (identifier, assert) => { | ||
| 306 | - const module = await linker(identifier, this, { assert }); | ||
| 305 | + const promises = this[kWrap].link(async (identifier, attributes) => { | ||
| 306 | + const module = await linker(identifier, this, { attributes, assert: attributes }); | ||
| 307 | 307 | if (module[kWrap] === undefined) { | |
| 308 | 308 | throw new ERR_VM_MODULE_NOT_MODULE(); | |
| 309 | 309 | } | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -131,7 +131,9 @@ async function asserts() { | |||
| 131 | 131 | await m.link((s, r, p) => { | |
| 132 | 132 | assert.strictEqual(s, 'foo'); | |
| 133 | 133 | assert.strictEqual(r.identifier, 'm'); | |
| 134 | + assert.strictEqual(p.attributes.n1, 'v1'); | ||
| 134 | 135 | assert.strictEqual(p.assert.n1, 'v1'); | |
| 136 | + assert.strictEqual(p.attributes.n2, 'v2'); | ||
| 135 | 137 | assert.strictEqual(p.assert.n2, 'v2'); | |
| 136 | 138 | return new SourceTextModule(''); | |
| 137 | 139 | }); | |
| Back | FazBrowse Home | New Git URL |
0 commit comments