|
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 = [
|
|
106 | 106 | // for checking existence in this list.
|
107 | 107 | let internalBindingWhitelistSet;
|
108 | 108 |
|
109 |
| - // Set up process.binding() and process._linkedBinding() |
| 109 | + // Set up process.binding() and process._linkedBinding(). |
110 | 110 | {
|
111 | 111 | const bindingObj = ObjectCreate(null);
|
112 | 112 |
|
|
134 | 134 | };
|
135 | 135 | }
|
136 | 136 |
|
137 |
| - // Set up internalBinding() in the closure |
| 137 | + // Set up internalBinding() in the closure. |
138 | 138 | let internalBinding;
|
139 | 139 | {
|
140 | 140 | const bindingObj = ObjectCreate(null);
|
|
148 | 148 | };
|
149 | 149 | }
|
150 | 150 |
|
151 |
| - // Create this WeakMap in js-land because V8 has no C++ API for WeakMap |
| 151 | + // Create this WeakMap in js-land because V8 has no C++ API for WeakMap. |
152 | 152 | internalBinding('module_wrap').callbackMap = new WeakMap();
|
153 | 153 |
|
154 |
| - // Set up NativeModule |
| 154 | + // Set up NativeModule. |
155 | 155 | function NativeModule(id) {
|
156 | 156 | this.filename = `${id}.js`;
|
157 | 157 | this.id = id;
|
|
185 | 185 | if (!NativeModule.exists(id)) {
|
186 | 186 | // Model the error off the internal/errors.js model, but
|
187 | 187 | // do not use that module given that it could actually be
|
188 |
| - // the one causing the error if there's a bug in Node.js |
| 188 | + // the one causing the error if there's a bug in Node.js. |
189 | 189 | // eslint-disable-next-line no-restricted-syntax
|
190 | 190 | const err = new Error(`No such built-in module: ${id}`);
|
191 | 191 | err.code = 'ERR_UNKNOWN_BUILTIN_MODULE';
|
|
226 | 226 |
|
227 | 227 | if (config.exposeInternals) {
|
228 | 228 | NativeModule.nonInternalExists = function(id) {
|
229 |
| - // Do not expose this to user land even with --expose-internals |
| 229 | + // Do not expose this to user land even with --expose-internals. |
230 | 230 | if (id === loaderId) {
|
231 | 231 | return false;
|
232 | 232 | }
|
233 | 233 | return NativeModule.exists(id);
|
234 | 234 | };
|
235 | 235 |
|
236 | 236 | NativeModule.isInternal = function(id) {
|
237 |
| - // Do not expose this to user land even with --expose-internals |
| 237 | + // Do not expose this to user land even with --expose-internals. |
238 | 238 | return id === loaderId;
|
239 | 239 | };
|
240 | 240 | } else {
|
|
268 | 268 | };
|
269 | 269 |
|
270 | 270 | // Provide named exports for all builtin libraries so that the libraries
|
271 |
| - // may be imported in a nicer way for esm users. The default export is left |
| 271 | + // may be imported in a nicer way for ESM users. The default export is left |
272 | 272 | // as the entire namespace (module.exports) and wrapped in a proxy such
|
273 | 273 | // that APMs and other behavior are still left intact.
|
274 | 274 | NativeModule.prototype.proxifyExports = function() {
|
|
353 | 353 | NativeModule._cache[this.id] = this;
|
354 | 354 | };
|
355 | 355 |
|
356 |
| - // coverage must be turned on early, so that we can collect |
| 356 | + // Coverage must be turned on early, so that we can collect |
357 | 357 | // it for Node.js' own internal libraries.
|
358 | 358 | if (process.env.NODE_V8_COVERAGE) {
|
359 | 359 | NativeModule.require('internal/process/coverage').setup();
|
|
0 commit comments