lib: fix comment nits in bootstrap\loaders.js
PR-URL: https://github.com/nodejs/node/pull/24641 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Franziska Hinkelmann <franziska.hinkelmann@gmail.com>
This commit is contained in:
parent
11c17e4bc9
commit
1db808ca5f
@ -19,7 +19,7 @@
|
|||||||
// can be created using NODE_MODULE_CONTEXT_AWARE_CPP() with the flag
|
// can be created using NODE_MODULE_CONTEXT_AWARE_CPP() with the flag
|
||||||
// NM_F_LINKED.
|
// NM_F_LINKED.
|
||||||
// - internalBinding(): the private internal C++ binding loader, inaccessible
|
// - internalBinding(): the private internal C++ binding loader, inaccessible
|
||||||
// from user land because they are only available from NativeModule.require()
|
// from user land because they are only available from NativeModule.require().
|
||||||
// These C++ bindings are created using NODE_MODULE_CONTEXT_AWARE_INTERNAL()
|
// These C++ bindings are created using NODE_MODULE_CONTEXT_AWARE_INTERNAL()
|
||||||
// and have their nm_flags set to NM_F_INTERNAL.
|
// and have their nm_flags set to NM_F_INTERNAL.
|
||||||
//
|
//
|
||||||
@ -61,7 +61,7 @@
|
|||||||
keys: ObjectKeys,
|
keys: ObjectKeys,
|
||||||
} = Object;
|
} = Object;
|
||||||
|
|
||||||
// Set up process.moduleLoadList
|
// Set up process.moduleLoadList.
|
||||||
const moduleLoadList = [];
|
const moduleLoadList = [];
|
||||||
ObjectDefineProperty(process, 'moduleLoadList', {
|
ObjectDefineProperty(process, 'moduleLoadList', {
|
||||||
value: moduleLoadList,
|
value: moduleLoadList,
|
||||||
@ -71,7 +71,7 @@
|
|||||||
});
|
});
|
||||||
|
|
||||||
// internalBindingWhitelist contains the name of internalBinding modules
|
// internalBindingWhitelist contains the name of internalBinding modules
|
||||||
// that are whitelisted for access via process.binding()... this is used
|
// that are whitelisted for access via process.binding()... This is used
|
||||||
// to provide a transition path for modules that are being moved over to
|
// to provide a transition path for modules that are being moved over to
|
||||||
// internalBinding.
|
// internalBinding.
|
||||||
const internalBindingWhitelist = [
|
const internalBindingWhitelist = [
|
||||||
@ -106,7 +106,7 @@
|
|||||||
// for checking existence in this list.
|
// for checking existence in this list.
|
||||||
let internalBindingWhitelistSet;
|
let internalBindingWhitelistSet;
|
||||||
|
|
||||||
// Set up process.binding() and process._linkedBinding()
|
// Set up process.binding() and process._linkedBinding().
|
||||||
{
|
{
|
||||||
const bindingObj = ObjectCreate(null);
|
const bindingObj = ObjectCreate(null);
|
||||||
|
|
||||||
@ -134,7 +134,7 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Set up internalBinding() in the closure
|
// Set up internalBinding() in the closure.
|
||||||
let internalBinding;
|
let internalBinding;
|
||||||
{
|
{
|
||||||
const bindingObj = ObjectCreate(null);
|
const bindingObj = ObjectCreate(null);
|
||||||
@ -148,10 +148,10 @@
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
// Create this WeakMap in js-land because V8 has no C++ API for WeakMap
|
// Create this WeakMap in js-land because V8 has no C++ API for WeakMap.
|
||||||
internalBinding('module_wrap').callbackMap = new WeakMap();
|
internalBinding('module_wrap').callbackMap = new WeakMap();
|
||||||
|
|
||||||
// Set up NativeModule
|
// Set up NativeModule.
|
||||||
function NativeModule(id) {
|
function NativeModule(id) {
|
||||||
this.filename = `${id}.js`;
|
this.filename = `${id}.js`;
|
||||||
this.id = id;
|
this.id = id;
|
||||||
@ -185,7 +185,7 @@
|
|||||||
if (!NativeModule.exists(id)) {
|
if (!NativeModule.exists(id)) {
|
||||||
// Model the error off the internal/errors.js model, but
|
// Model the error off the internal/errors.js model, but
|
||||||
// do not use that module given that it could actually be
|
// do not use that module given that it could actually be
|
||||||
// the one causing the error if there's a bug in Node.js
|
// the one causing the error if there's a bug in Node.js.
|
||||||
// eslint-disable-next-line no-restricted-syntax
|
// eslint-disable-next-line no-restricted-syntax
|
||||||
const err = new Error(`No such built-in module: ${id}`);
|
const err = new Error(`No such built-in module: ${id}`);
|
||||||
err.code = 'ERR_UNKNOWN_BUILTIN_MODULE';
|
err.code = 'ERR_UNKNOWN_BUILTIN_MODULE';
|
||||||
@ -226,7 +226,7 @@
|
|||||||
|
|
||||||
if (config.exposeInternals) {
|
if (config.exposeInternals) {
|
||||||
NativeModule.nonInternalExists = function(id) {
|
NativeModule.nonInternalExists = function(id) {
|
||||||
// Do not expose this to user land even with --expose-internals
|
// Do not expose this to user land even with --expose-internals.
|
||||||
if (id === loaderId) {
|
if (id === loaderId) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
@ -234,7 +234,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
NativeModule.isInternal = function(id) {
|
NativeModule.isInternal = function(id) {
|
||||||
// Do not expose this to user land even with --expose-internals
|
// Do not expose this to user land even with --expose-internals.
|
||||||
return id === loaderId;
|
return id === loaderId;
|
||||||
};
|
};
|
||||||
} else {
|
} else {
|
||||||
@ -268,7 +268,7 @@
|
|||||||
};
|
};
|
||||||
|
|
||||||
// Provide named exports for all builtin libraries so that the libraries
|
// Provide named exports for all builtin libraries so that the libraries
|
||||||
// may be imported in a nicer way for esm users. The default export is left
|
// may be imported in a nicer way for ESM users. The default export is left
|
||||||
// as the entire namespace (module.exports) and wrapped in a proxy such
|
// as the entire namespace (module.exports) and wrapped in a proxy such
|
||||||
// that APMs and other behavior are still left intact.
|
// that APMs and other behavior are still left intact.
|
||||||
NativeModule.prototype.proxifyExports = function() {
|
NativeModule.prototype.proxifyExports = function() {
|
||||||
@ -353,7 +353,7 @@
|
|||||||
NativeModule._cache[this.id] = this;
|
NativeModule._cache[this.id] = this;
|
||||||
};
|
};
|
||||||
|
|
||||||
// coverage must be turned on early, so that we can collect
|
// Coverage must be turned on early, so that we can collect
|
||||||
// it for Node.js' own internal libraries.
|
// it for Node.js' own internal libraries.
|
||||||
if (process.env.NODE_V8_COVERAGE) {
|
if (process.env.NODE_V8_COVERAGE) {
|
||||||
NativeModule.require('internal/process/coverage').setup();
|
NativeModule.require('internal/process/coverage').setup();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user