vm: use import attributes instead of import assertions · nodejs/node@8f7eb15 · GitHub
Skip to content

Commit 8f7eb15

Browse files
aduh95targos
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 a9ca7b3 commit 8f7eb15

3 files changed

Lines changed: 33 additions & 24 deletions

File tree

doc/api/vm.md

Lines changed: 27 additions & 20 deletions

lib/internal/vm/module.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -305,8 +305,8 @@ class SourceTextModule extends Module {
305305
this[kLink] = async (linker) => {
306306
this.#statusOverride = 'linking';
307307

308-
const promises = this[kWrap].link(async (identifier, assert) => {
309-
const module = await linker(identifier, this, { assert });
308+
const promises = this[kWrap].link(async (identifier, attributes) => {
309+
const module = await linker(identifier, this, { attributes, assert: attributes });
310310
if (module[kWrap] === undefined) {
311311
throw new ERR_VM_MODULE_NOT_MODULE();
312312
}

test/parallel/test-vm-module-link.js

Lines changed: 4 additions & 2 deletions

0 commit comments

Comments
 (0)