Skip to content

Commit

Permalink
vm: use import attributes instead of import assertions
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
aduh95 authored and nicolo-ribaudo committed Dec 12, 2023
1 parent b9d4d7c commit 9cb5138
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions doc/api/vm.md
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ changes:
using it in a production environment.
* `specifier` {string} specifier passed to `import()`
* `script` {vm.Script}
* `importAttributes` {Object} The `"assert"` value passed to the
* `importAttributes` {Object} The `"with"` value passed to the
[`optionsExpression`][] optional parameter, or an empty object if no value
was provided.
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
Expand Down Expand Up @@ -633,7 +633,7 @@ changes:
* `extra` {Object}
* `attributes` {Object} The data from the attribute:
```mjs
import foo from 'foo' assert { name: 'value' };
import foo from 'foo' with { name: 'value' };
// ^^^^^^^^^^^^^^^^^ the attribute
```
Per ECMA-262, hosts are expected to trigger an error if an
Expand Down Expand Up @@ -1025,7 +1025,7 @@ changes:
considered stable.
* `specifier` {string} specifier passed to `import()`
* `function` {Function}
* `importAttributes` {Object} The `"assert"` value passed to the
* `importAttributes` {Object} The `"with"` value passed to the
[`optionsExpression`][] optional parameter, or an empty object if no value
was provided.
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
Expand Down Expand Up @@ -1249,7 +1249,7 @@ changes:
using it in a production environment.
* `specifier` {string} specifier passed to `import()`
* `script` {vm.Script}
* `importAttributes` {Object} The `"assert"` value passed to the
* `importAttributes` {Object} The `"with"` value passed to the
[`optionsExpression`][] optional parameter, or an empty object if no value
was provided.
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
Expand Down Expand Up @@ -1348,7 +1348,7 @@ changes:
using it in a production environment.
* `specifier` {string} specifier passed to `import()`
* `script` {vm.Script}
* `importAttributes` {Object} The `"assert"` value passed to the
* `importAttributes` {Object} The `"with"` value passed to the
[`optionsExpression`][] optional parameter, or an empty object if no value
was provided.
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
Expand Down Expand Up @@ -1428,7 +1428,7 @@ changes:
using it in a production environment.
* `specifier` {string} specifier passed to `import()`
* `script` {vm.Script}
* `importAttributes` {Object} The `"assert"` value passed to the
* `importAttributes` {Object} The `"with"` value passed to the
[`optionsExpression`][] optional parameter, or an empty object if no value
was provided.
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
Expand Down

0 comments on commit 9cb5138

Please sign in to comment.