summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaeyeon Jeong <daeyeon.dev@gmail.com>2022-11-29 20:21:59 +0900
committerDanielle Adams <adamzdanielle@gmail.com>2023-01-04 20:31:53 -0500
commit0cc72b30971f04a9ea15ffdfab54c1dde52cc4af (patch)
tree66845b27092dabcd62ef35f2576a975171d955b3
parentb8c4bff7b9e7619d4039afd882b1a7ad5657a79f (diff)
downloadnode-new-0cc72b30971f04a9ea15ffdfab54c1dde52cc4af.tar.gz
lib: disambiguate `native module` to `builtin module`
Signed-off-by: Daeyeon Jeong <daeyeon.dev@gmail.com> PR-URL: https://github.com/nodejs/node/pull/45673 Refs: https://github.com/nodejs/node/pull/44135 Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
-rw-r--r--lib/internal/bootstrap/loaders.js16
1 files changed, 8 insertions, 8 deletions
diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js
index f25fb7c9f4..47bd830570 100644
--- a/lib/internal/bootstrap/loaders.js
+++ b/lib/internal/bootstrap/loaders.js
@@ -144,7 +144,7 @@ const schemelessBlockList = new SafeSet([
'DEP0111');
}
if (legacyWrapperList.has(module)) {
- return nativeModuleRequire('internal/legacy/processbinding')[module]();
+ return requireBuiltin('internal/legacy/processbinding')[module]();
}
return internalBinding(module);
}
@@ -285,14 +285,14 @@ class BuiltinModule {
// TODO(aduh95): move this to C++, alongside the initialization of the class.
ObjectSetPrototypeOf(ModuleWrap.prototype, null);
const url = `node:${this.id}`;
- const nativeModule = this;
+ const builtin = this;
const exportsKeys = ArrayPrototypeSlice(this.exportKeys);
ArrayPrototypePush(exportsKeys, 'default');
this.module = new ModuleWrap(
url, undefined, exportsKeys,
function() {
- nativeModule.syncExports();
- this.setExport('default', nativeModule.exports);
+ builtin.syncExports();
+ this.setExport('default', builtin.exports);
});
// Ensure immediate sync execution to capture exports now
this.module.instantiate();
@@ -326,7 +326,7 @@ class BuiltinModule {
try {
const requireFn = StringPrototypeStartsWith(this.id, 'internal/deps/') ?
- requireWithFallbackInDeps : nativeModuleRequire;
+ requireWithFallbackInDeps : requireBuiltin;
const fn = compileFunction(id);
// Arguments must match the parameters specified in
@@ -350,10 +350,10 @@ class BuiltinModule {
const loaderExports = {
internalBinding,
BuiltinModule,
- require: nativeModuleRequire
+ require: requireBuiltin
};
-function nativeModuleRequire(id) {
+function requireBuiltin(id) {
if (id === loaderId) {
return loaderExports;
}
@@ -371,7 +371,7 @@ function requireWithFallbackInDeps(request) {
if (!BuiltinModule.map.has(request)) {
request = `internal/deps/${request}`;
}
- return nativeModuleRequire(request);
+ return requireBuiltin(request);
}
// Pass the exports back to C++ land for C++ internals to use.