Skip to content

Commit 9cb5138

Browse files
aduh95nicolo-ribaudo
authored andcommitted
vm: use import attributes instead of import assertions
The old import assertions proposal has been renamed to "import attributes" with the following major changes: 1. The keyword is now `with` instead of `assert`. 2. Unknown assertions cause an error rather than being ignored. This PR updates the documentation to encourage folks to use the new syntax, and add aliases to preserve backward compatibility. PR-URL: #50141 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
1 parent b9d4d7c commit 9cb5138

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/api/vm.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ changes:
101101
using it in a production environment.
102102
* `specifier` {string} specifier passed to `import()`
103103
* `script` {vm.Script}
104-
* `importAttributes` {Object} The `"assert"` value passed to the
104+
* `importAttributes` {Object} The `"with"` value passed to the
105105
[`optionsExpression`][] optional parameter, or an empty object if no value
106106
was provided.
107107
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
@@ -633,7 +633,7 @@ changes:
633633
* `extra` {Object}
634634
* `attributes` {Object} The data from the attribute:
635635
```mjs
636-
import foo from 'foo' assert { name: 'value' };
636+
import foo from 'foo' with { name: 'value' };
637637
// ^^^^^^^^^^^^^^^^^ the attribute
638638
```
639639
Per ECMA-262, hosts are expected to trigger an error if an
@@ -1025,7 +1025,7 @@ changes:
10251025
considered stable.
10261026
* `specifier` {string} specifier passed to `import()`
10271027
* `function` {Function}
1028-
* `importAttributes` {Object} The `"assert"` value passed to the
1028+
* `importAttributes` {Object} The `"with"` value passed to the
10291029
[`optionsExpression`][] optional parameter, or an empty object if no value
10301030
was provided.
10311031
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
@@ -1249,7 +1249,7 @@ changes:
12491249
using it in a production environment.
12501250
* `specifier` {string} specifier passed to `import()`
12511251
* `script` {vm.Script}
1252-
* `importAttributes` {Object} The `"assert"` value passed to the
1252+
* `importAttributes` {Object} The `"with"` value passed to the
12531253
[`optionsExpression`][] optional parameter, or an empty object if no value
12541254
was provided.
12551255
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
@@ -1348,7 +1348,7 @@ changes:
13481348
using it in a production environment.
13491349
* `specifier` {string} specifier passed to `import()`
13501350
* `script` {vm.Script}
1351-
* `importAttributes` {Object} The `"assert"` value passed to the
1351+
* `importAttributes` {Object} The `"with"` value passed to the
13521352
[`optionsExpression`][] optional parameter, or an empty object if no value
13531353
was provided.
13541354
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
@@ -1428,7 +1428,7 @@ changes:
14281428
using it in a production environment.
14291429
* `specifier` {string} specifier passed to `import()`
14301430
* `script` {vm.Script}
1431-
* `importAttributes` {Object} The `"assert"` value passed to the
1431+
* `importAttributes` {Object} The `"with"` value passed to the
14321432
[`optionsExpression`][] optional parameter, or an empty object if no value
14331433
was provided.
14341434
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is

0 commit comments

Comments
 (0)