summaryrefslogtreecommitdiff
path: root/lib/internal
diff options
context:
space:
mode:
authorGus Caplan <me@gus.host>2018-07-27 21:21:30 -0500
committerGus Caplan <me@gus.host>2018-07-31 10:23:03 -0500
commit2bdcdfc3cbf735ede8130901f58efcd4c6fe9697 (patch)
tree5f040a87e2f7ef06b67a4ef17a7478a89b5a985a /lib/internal
parent3b23b4d7c08e3e61f7e1ff3b91a6626b2bcfd5e3 (diff)
downloadandroid-node-v8-2bdcdfc3cbf735ede8130901f58efcd4c6fe9697.tar.gz
android-node-v8-2bdcdfc3cbf735ede8130901f58efcd4c6fe9697.tar.bz2
android-node-v8-2bdcdfc3cbf735ede8130901f58efcd4c6fe9697.zip
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>
Diffstat (limited to 'lib/internal')
-rw-r--r--lib/internal/process/esm_loader.js6
-rw-r--r--lib/internal/vm/source_text_module.js (renamed from lib/internal/vm/module.js)13
2 files changed, 10 insertions, 9 deletions
diff --git a/lib/internal/process/esm_loader.js b/lib/internal/process/esm_loader.js
index db28ca04b1..c622084415 100644
--- a/lib/internal/process/esm_loader.js
+++ b/lib/internal/process/esm_loader.js
@@ -13,7 +13,7 @@ const { URL } = require('url');
const {
initImportMetaMap,
wrapToModuleMap
-} = require('internal/vm/module');
+} = require('internal/vm/source_text_module');
function normalizeReferrerURL(referrer) {
if (typeof referrer === 'string' && path.isAbsolute(referrer)) {
@@ -30,8 +30,8 @@ function initializeImportMetaObject(wrap, meta) {
} else {
const initializeImportMeta = initImportMetaMap.get(vmModule);
if (initializeImportMeta !== undefined) {
- // This ModuleWrap belongs to vm.Module, initializer callback was
- // provided.
+ // This ModuleWrap belongs to vm.SourceTextModule,
+ // initializer callback was provided.
initializeImportMeta(meta, vmModule);
}
}
diff --git a/lib/internal/vm/module.js b/lib/internal/vm/source_text_module.js
index a799cf2c34..bea7d7c94a 100644
--- a/lib/internal/vm/module.js
+++ b/lib/internal/vm/source_text_module.js
@@ -44,15 +44,16 @@ const perContextModuleId = new WeakMap();
const wrapMap = new WeakMap();
const dependencyCacheMap = new WeakMap();
const linkingStatusMap = new WeakMap();
-// vm.Module -> function
+// vm.SourceTextModule -> function
const initImportMetaMap = new WeakMap();
-// ModuleWrap -> vm.Module
+// ModuleWrap -> vm.SourceTextModule
const wrapToModuleMap = new WeakMap();
const defaultModuleName = 'vm:module';
-class Module {
+// TODO(devsnek): figure out AbstractModule class or protocol
+class SourceTextModule {
constructor(src, options = {}) {
- emitExperimentalWarning('vm.Module');
+ emitExperimentalWarning('vm.SourceTextModule');
if (typeof src !== 'string')
throw new ERR_INVALID_ARG_TYPE('src', 'string', src);
@@ -229,7 +230,7 @@ class Module {
[customInspectSymbol](depth, options) {
let ctor = getConstructorOf(this);
- ctor = ctor === null ? Module : ctor;
+ ctor = ctor === null ? SourceTextModule : ctor;
if (typeof depth === 'number' && depth < 0)
return options.stylize(`[${ctor.name}]`, 'special');
@@ -244,7 +245,7 @@ class Module {
}
module.exports = {
- Module,
+ SourceTextModule,
initImportMetaMap,
wrapToModuleMap
};