Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 06646e1

Browse filesBrowse files
aduh95richardlau
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 Backport-PR-URL: #51136 Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Vinícius Lourenço Claro Cardoso <contact@viniciusl.com.br>
1 parent a193be3 commit 06646e1
Copy full SHA for 06646e1

File tree

Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Open diff view settings
Filter options
Expand file treeCollapse file tree

1 file changed

+6
-6
lines changed
Open diff view settings
Collapse file

‎doc/api/vm.md‎

Copy file name to clipboardExpand all lines: doc/api/vm.md
+6-6Lines changed: 6 additions & 6 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ changes:
103103
[`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG`][].
104104
* `specifier` {string} specifier passed to `import()`
105105
* `script` {vm.Script}
106-
* `importAttributes` {Object} The `"assert"` value passed to the
106+
* `importAttributes` {Object} The `"with"` value passed to the
107107
[`optionsExpression`][] optional parameter, or an empty object if no value
108108
was provided.
109109
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
@@ -635,7 +635,7 @@ changes:
635635
* `extra` {Object}
636636
* `attributes` {Object} The data from the attribute:
637637
```mjs
638-
import foo from 'foo' assert { name: 'value' };
638+
import foo from 'foo' with { name: 'value' };
639639
// ^^^^^^^^^^^^^^^^^ the attribute
640640
```
641641
Per ECMA-262, hosts are expected to trigger an error if an
@@ -1032,7 +1032,7 @@ changes:
10321032
[`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG`][].
10331033
* `specifier` {string} specifier passed to `import()`
10341034
* `function` {Function}
1035-
* `importAttributes` {Object} The `"assert"` value passed to the
1035+
* `importAttributes` {Object} The `"with"` value passed to the
10361036
[`optionsExpression`][] optional parameter, or an empty object if no value
10371037
was provided.
10381038
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
@@ -1258,7 +1258,7 @@ changes:
12581258
[`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG`][].
12591259
* `specifier` {string} specifier passed to `import()`
12601260
* `script` {vm.Script}
1261-
* `importAttributes` {Object} The `"assert"` value passed to the
1261+
* `importAttributes` {Object} The `"with"` value passed to the
12621262
[`optionsExpression`][] optional parameter, or an empty object if no value
12631263
was provided.
12641264
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
@@ -1359,7 +1359,7 @@ changes:
13591359
[`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG`][].
13601360
* `specifier` {string} specifier passed to `import()`
13611361
* `script` {vm.Script}
1362-
* `importAttributes` {Object} The `"assert"` value passed to the
1362+
* `importAttributes` {Object} The `"with"` value passed to the
13631363
[`optionsExpression`][] optional parameter, or an empty object if no value
13641364
was provided.
13651365
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is
@@ -1441,7 +1441,7 @@ changes:
14411441
[`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING_FLAG`][].
14421442
* `specifier` {string} specifier passed to `import()`
14431443
* `script` {vm.Script}
1444-
* `importAttributes` {Object} The `"assert"` value passed to the
1444+
* `importAttributes` {Object} The `"with"` value passed to the
14451445
[`optionsExpression`][] optional parameter, or an empty object if no value
14461446
was provided.
14471447
* Returns: {Module Namespace Object|vm.Module} Returning a `vm.Module` is

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.