Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nodejs/node.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGus Caplan <me@gus.host>2020-04-22 00:43:58 +0300
committerGus Caplan <me@gus.host>2020-04-25 17:49:53 +0300
commit74c393dd93cc0e461e3796fbcc09545fcacdecaf (patch)
tree75c9f468f6d53280cd9a2bdc0262e3f95d6eadb4 /doc/api/vm.md
parent24a4e6153dae01cc7d5b28a21a105d680e9a5037 (diff)
vm: add importModuleDynamically option to compileFunction
Fixes: https://github.com/nodejs/node/issues/31860 PR-URL: https://github.com/nodejs/node/pull/32985 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Michaƫl Zasso <targos@protonmail.com>
Diffstat (limited to 'doc/api/vm.md')
-rw-r--r--doc/api/vm.md16
1 files changed, 15 insertions, 1 deletions
diff --git a/doc/api/vm.md b/doc/api/vm.md
index ec731ffd36c..e959ebc66ff 100644
--- a/doc/api/vm.md
+++ b/doc/api/vm.md
@@ -88,7 +88,7 @@ changes:
This option is part of the experimental modules API, and should not be
considered stable.
* `specifier` {string} specifier passed to `import()`
- * `module` {vm.Module}
+ * `script` {vm.Script}
* 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.
@@ -773,6 +773,10 @@ const vm = require('vm');
## `vm.compileFunction(code[, params[, options]])`
<!-- YAML
added: v10.10.0
+changes:
+ - version: REPLACEME
+ pr-url: https://github.com/nodejs/node/pull/32985
+ description: The `importModuleDynamically` option is now supported.
-->
* `code` {string} The body of the function to compile.
@@ -795,6 +799,16 @@ added: v10.10.0
* `contextExtensions` {Object[]} An array containing a collection of context
extensions (objects wrapping the current scope) to be applied while
compiling. **Default:** `[]`.
+ * `importModuleDynamically` {Function} Called during evaluation of this module
+ when `import()` is called. If this option is not specified, calls to
+ `import()` will reject with [`ERR_VM_DYNAMIC_IMPORT_CALLBACK_MISSING`][].
+ This option is part of the experimental modules API, and should not be
+ considered stable.
+ * `specifier` {string} specifier passed to `import()`
+ * `function` {Function}
+ * 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.
* Returns: {Function}
Compiles the given code into the provided context (if no context is