Skip to content

Commit 353339a

Browse files
daeyeontargos
authored andcommitted
lib: disambiguate native module to builtin module
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com> PR-URL: #45673 Refs: #44135 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
1 parent 8c728d2 commit 353339a

1 file changed

Lines changed: 8 additions & 8 deletions

File tree

‎lib/internal/bootstrap/loaders.js‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ const schemelessBlockList = new SafeSet([
144144
'DEP0111');
145145
}
146146
if(legacyWrapperList.has(module)){
147-
returnnativeModuleRequire('internal/legacy/processbinding')[module]();
147+
returnrequireBuiltin('internal/legacy/processbinding')[module]();
148148
}
149149
returninternalBinding(module);
150150
}
@@ -285,14 +285,14 @@ class BuiltinModule {
285285
// TODO(aduh95): move this to C++, alongside the initialization of the class.
286286
ObjectSetPrototypeOf(ModuleWrap.prototype,null);
287287
consturl=`node:${this.id}`;
288-
constnativeModule=this;
288+
constbuiltin=this;
289289
constexportsKeys=ArrayPrototypeSlice(this.exportKeys);
290290
ArrayPrototypePush(exportsKeys,'default');
291291
this.module=newModuleWrap(
292292
url,undefined,exportsKeys,
293293
function(){
294-
nativeModule.syncExports();
295-
this.setExport('default',nativeModule.exports);
294+
builtin.syncExports();
295+
this.setExport('default',builtin.exports);
296296
});
297297
// Ensure immediate sync execution to capture exports now
298298
this.module.instantiate();
@@ -326,7 +326,7 @@ class BuiltinModule {
326326

327327
try{
328328
constrequireFn=StringPrototypeStartsWith(this.id,'internal/deps/') ?
329-
requireWithFallbackInDeps : nativeModuleRequire;
329+
requireWithFallbackInDeps : requireBuiltin;
330330

331331
constfn=compileFunction(id);
332332
// Arguments must match the parameters specified in
@@ -350,10 +350,10 @@ class BuiltinModule {
350350
constloaderExports={
351351
internalBinding,
352352
BuiltinModule,
353-
require: nativeModuleRequire
353+
require: requireBuiltin
354354
};
355355

356-
functionnativeModuleRequire(id){
356+
functionrequireBuiltin(id){
357357
if(id===loaderId){
358358
returnloaderExports;
359359
}
@@ -371,7 +371,7 @@ function requireWithFallbackInDeps(request) {
371371
if(!BuiltinModule.map.has(request)){
372372
request=`internal/deps/${request}`;
373373
}
374-
returnnativeModuleRequire(request);
374+
returnrequireBuiltin(request);
375375
}
376376

377377
// Pass the exports back to C++ land for C++ internals to use.

0 commit comments

Comments
 (0)