diff options
author | Antoine du Hamel <duhamelantoine1995@gmail.com> | 2021-09-05 13:08:37 +0300 |
---|---|---|
committer | Node.js GitHub Bot <github-bot@iojs.org> | 2021-10-09 11:44:53 +0300 |
commit | 08ffbd115e5170274f3c0bea602378903fd03173 (patch) | |
tree | d70a374a90b2e1c7462b9f42627c0075c3fac307 /doc/api/vm.md | |
parent | 879ff775d039aa9b1becd548a99a7e19937521f5 (diff) |
vm: add support for import assertions in dynamic imports
PR-URL: https://github.com/nodejs/node/pull/40249
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
Reviewed-By: Guy Bedford <guybedford@gmail.com>
Reviewed-By: Gus Caplan <me@gus.host>
Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com>
Diffstat (limited to 'doc/api/vm.md')
-rw-r--r-- | doc/api/vm.md | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/doc/api/vm.md b/doc/api/vm.md index b7cde0e3b69..7a8dc946b1c 100644 --- a/doc/api/vm.md +++ b/doc/api/vm.md @@ -54,6 +54,10 @@ executed in specific contexts. <!-- YAML added: v0.3.1 changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/40249 + description: Added support for import assertions to the + `importModuleDynamically` parameter. - version: v10.6.0 pr-url: https://github.com/nodejs/node/pull/20300 description: The `produceCachedData` is deprecated in favour of @@ -91,6 +95,9 @@ changes: using it in a production environment. * `specifier` {string} specifier passed to `import()` * `script` {vm.Script} + * `importAssertions` {Object} The `"assert"` 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 recommended in order to take advantage of error tracking, and to avoid issues with namespaces that contain `then` function exports. @@ -642,6 +649,13 @@ The `vm.SourceTextModule` class provides the [Source Text Module Record][] as defined in the ECMAScript specification. ### `new vm.SourceTextModule(code[, options])` +<!-- YAML +changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/40249 + description: Added support for import assertions to the + `importModuleDynamically` parameter. +--> * `code` {string} JavaScript Module code to parse * `options` @@ -667,6 +681,9 @@ defined in the ECMAScript specification. `import()` will reject with [`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`][]. * `specifier` {string} specifier passed to `import()` * `module` {vm.Module} + * `importAssertions` {Object} The `"assert"` 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 recommended in order to take advantage of error tracking, and to avoid issues with namespaces that contain `then` function exports. @@ -852,6 +869,10 @@ const vm = require('vm'); <!-- YAML added: v10.10.0 changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/40249 + description: Added support for import assertions to the + `importModuleDynamically` parameter. - version: v15.9.0 pr-url: https://github.com/nodejs/node/pull/35431 description: Added `importModuleDynamically` option again. @@ -893,6 +914,9 @@ changes: considered stable. * `specifier` {string} specifier passed to `import()` * `function` {Function} + * `importAssertions` {Object} The `"assert"` 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 recommended in order to take advantage of error tracking, and to avoid issues with namespaces that contain `then` function exports. @@ -1068,6 +1092,10 @@ vm.measureMemory({ mode: 'detailed', execution: 'eager' }) <!-- YAML added: v0.3.1 changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/40249 + description: Added support for import assertions to the + `importModuleDynamically` parameter. - version: v6.3.0 pr-url: https://github.com/nodejs/node/pull/6635 description: The `breakOnSigint` option is supported now. @@ -1113,6 +1141,9 @@ changes: using it in a production environment. * `specifier` {string} specifier passed to `import()` * `script` {vm.Script} + * `importAssertions` {Object} The `"assert"` 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 recommended in order to take advantage of error tracking, and to avoid issues with namespaces that contain `then` function exports. @@ -1145,6 +1176,10 @@ console.log(contextObject); <!-- YAML added: v0.3.1 changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/40249 + description: Added support for import assertions to the + `importModuleDynamically` parameter. - version: v14.6.0 pr-url: https://github.com/nodejs/node/pull/34023 description: The `microtaskMode` option is supported now. @@ -1211,6 +1246,9 @@ changes: using it in a production environment. * `specifier` {string} specifier passed to `import()` * `script` {vm.Script} + * `importAssertions` {Object} The `"assert"` 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 recommended in order to take advantage of error tracking, and to avoid issues with namespaces that contain `then` function exports. @@ -1247,6 +1285,10 @@ console.log(contextObject); <!-- YAML added: v0.3.1 changes: + - version: REPLACEME + pr-url: https://github.com/nodejs/node/pull/40249 + description: Added support for import assertions to the + `importModuleDynamically` parameter. - version: v6.3.0 pr-url: https://github.com/nodejs/node/pull/6635 description: The `breakOnSigint` option is supported now. @@ -1290,6 +1332,9 @@ changes: using it in a production environment. * `specifier` {string} specifier passed to `import()` * `script` {vm.Script} + * `importAssertions` {Object} The `"assert"` 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 recommended in order to take advantage of error tracking, and to avoid issues with namespaces that contain `then` function exports. @@ -1452,6 +1497,7 @@ are not controllable through the timeout either. [`Error`]: errors.md#class-error [`URL`]: url.md#class-url [`eval()`]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/eval +[`optionsExpression`]: https://tc39.es/proposal-import-assertions/#sec-evaluate-import-call [`script.runInContext()`]: #scriptrunincontextcontextifiedobject-options [`script.runInThisContext()`]: #scriptruninthiscontextoptions [`url.origin`]: url.md#urlorigin |