mirror of
https://github.com/nodejs/node.git
synced 2026-10-14 10:26:26 -04:00
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:
14 files changed
+86
-81
No files matched your search
@@ -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 })
|
||||
|
||||
Reference in new issue
Block a user