vm: rename vm.Module to vm.SourceTextModule

At the last TC39 meeting, a new type of Module Records backed by
JavaScript source called Dynamic Module Records was discussed, and
it is now at Stage 1. Regardless of whether that proposal makes it
all the way into the spec, SourceTextModule is indeed a more
descriptive and accurate name for what this class represents.

PR-URL: https://github.com/nodejs/node/pull/22007
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Jan Krems <jan.krems@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Yuta Hiroto <hello@hiroppy.me>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: John-David Dalton <john.david.dalton@gmail.com>
Reviewed-By: Bradley Farias <bradley.meck@gmail.com>
This commit is contained in:
Gus Caplan committed 2018-07-31 10:23:03 -05:00
1 parent 3b23b4d7c0
commit 2bdcdfc3cb
14 files changed
+86 -81

No files matched your search

+4 -4
View File
@@ -4,7 +4,7 @@
const common = require('../common');
const assert = require('assert');
const { Module, createContext } = require('vm');
const { SourceTextModule, createContext } = require('vm');
(async function test1() {
const context = createContext({
@@ -12,7 +12,7 @@ const { Module, createContext } = require('vm');
baz: undefined,
typeofProcess: undefined,
});
const m = new Module(
const m = new SourceTextModule(
'baz = foo; typeofProcess = typeof process; typeof Object;',
{ context }
);
@@ -32,7 +32,7 @@ const { Module, createContext } = require('vm');
}());
(async () => {
const m = new Module(
const m = new SourceTextModule(
'global.vmResult = "foo"; Object.prototype.toString.call(process);'
);
await m.link(common.mustNotCall());
@@ -44,7 +44,7 @@ const { Module, createContext } = require('vm');
})();
(async () => {
const m = new Module('while (true) {}');
const m = new SourceTextModule('while (true) {}');
await m.link(common.mustNotCall());
m.instantiate();
await m.evaluate({ timeout: 500 })