|
19 | 19 | // can be created using NODE_MODULE_CONTEXT_AWARE_CPP() with the flag
|
20 | 20 | // NM_F_LINKED.
|
21 | 21 | // - internalBinding(): the private internal C++ binding loader, inaccessible
|
22 |
| -// from user land because they are only available from NativeModule.require() |
| 22 | +// from user land because they are only available from NativeModule.require(). |
23 | 23 | // These C++ bindings are created using NODE_MODULE_CONTEXT_AWARE_INTERNAL()
|
24 | 24 | // and have their nm_flags set to NM_F_INTERNAL.
|
25 | 25 | //
|
|
61 | 61 | keys: ObjectKeys,
|
62 | 62 | } = Object;
|
63 | 63 |
|
64 |
| - // Set up process.moduleLoadList |
| 64 | + // Set up process.moduleLoadList. |
65 | 65 | const moduleLoadList = [];
|
66 | 66 | ObjectDefineProperty(process, 'moduleLoadList', {
|
67 | 67 | value: moduleLoadList,
|
|
71 | 71 | });
|
72 | 72 |
|
73 | 73 | // internalBindingWhitelist contains the name of internalBinding modules
|
74 |
| - // that are whitelisted for access via process.binding()... this is used |
| 74 | + // that are whitelisted for access via process.binding()... This is used |
75 | 75 | // to provide a transition path for modules that are being moved over to
|
76 | 76 | // internalBinding.
|
77 | 77 | const internalBindingWhitelist = [
|
|
105 | 105 | // for checking existence in this list.
|
106 | 106 | let internalBindingWhitelistSet;
|
107 | 107 |
|
108 |
| - // Set up process.binding() and process._linkedBinding() |
| 108 | + // Set up process.binding() and process._linkedBinding(). |
109 | 109 | {
|
110 | 110 | const bindingObj = ObjectCreate(null);
|
111 | 111 |
|
|
133 | 133 | };
|
134 | 134 | }
|
135 | 135 |
|
136 |
| - // Set up internalBinding() in the closure |
| 136 | + // Set up internalBinding() in the closure. |
137 | 137 | let internalBinding;
|
138 | 138 | {
|
139 | 139 | const bindingObj = ObjectCreate(null);
|
|
147 | 147 | };
|
148 | 148 | }
|
149 | 149 |
|
150 |
| - // Create this WeakMap in js-land because V8 has no C++ API for WeakMap |
| 150 | + // Create this WeakMap in js-land because V8 has no C++ API for WeakMap. |
151 | 151 | internalBinding('module_wrap').callbackMap = new WeakMap();
|
152 | 152 |
|
153 |
| - // Set up NativeModule |
| 153 | + // Set up NativeModule. |
154 | 154 | function NativeModule(id) {
|
155 | 155 | this.filename = `${id}.js`;
|
156 | 156 | this.id = id;
|
|
184 | 184 | if (!NativeModule.exists(id)) {
|
185 | 185 | // Model the error off the internal/errors.js model, but
|
186 | 186 | // do not use that module given that it could actually be
|
187 |
| - // the one causing the error if there's a bug in Node.js |
| 187 | + // the one causing the error if there's a bug in Node.js. |
188 | 188 | // eslint-disable-next-line no-restricted-syntax
|
189 | 189 | const err = new Error(`No such built-in module: ${id}`);
|
190 | 190 | err.code = 'ERR_UNKNOWN_BUILTIN_MODULE';
|
|
225 | 225 |
|
226 | 226 | if (config.exposeInternals) {
|
227 | 227 | NativeModule.nonInternalExists = function(id) {
|
228 |
| - // Do not expose this to user land even with --expose-internals |
| 228 | + // Do not expose this to user land even with --expose-internals. |
229 | 229 | if (id === loaderId) {
|
230 | 230 | return false;
|
231 | 231 | }
|
232 | 232 | return NativeModule.exists(id);
|
233 | 233 | };
|
234 | 234 |
|
235 | 235 | NativeModule.isInternal = function(id) {
|
236 |
| - // Do not expose this to user land even with --expose-internals |
| 236 | + // Do not expose this to user land even with --expose-internals. |
237 | 237 | return id === loaderId;
|
238 | 238 | };
|
239 | 239 | } else {
|
|
267 | 267 | };
|
268 | 268 |
|
269 | 269 | // Provide named exports for all builtin libraries so that the libraries
|
270 |
| - // may be imported in a nicer way for esm users. The default export is left |
| 270 | + // may be imported in a nicer way for ESM users. The default export is left |
271 | 271 | // as the entire namespace (module.exports) and wrapped in a proxy such
|
272 | 272 | // that APMs and other behavior are still left intact.
|
273 | 273 | NativeModule.prototype.proxifyExports = function() {
|
|
352 | 352 | NativeModule._cache[this.id] = this;
|
353 | 353 | };
|
354 | 354 |
|
355 |
| - // coverage must be turned on early, so that we can collect |
| 355 | + // Coverage must be turned on early, so that we can collect |
356 | 356 | // it for Node.js' own internal libraries.
|
357 | 357 | if (process.env.NODE_V8_COVERAGE) {
|
358 | 358 | NativeModule.require('internal/process/coverage').setup();
|
|
0 commit comments