From 152d00a3998aed0abba4d5d6e818a16858636d22 Mon Sep 17 00:00:00 2001 From: Yagiz Nizipli Date: Sun, 2 Apr 2023 14:05:46 -0400 Subject: [PATCH] lib: rename internalBinding to _internalBinding --- lib/internal/bootstrap/loaders.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/lib/internal/bootstrap/loaders.js b/lib/internal/bootstrap/loaders.js index f628b791db4929..a75f1a6f41d9ec 100644 --- a/lib/internal/bootstrap/loaders.js +++ b/lib/internal/bootstrap/loaders.js @@ -161,11 +161,12 @@ const schemelessBlockList = new SafeSet([ } // Set up internalBinding() in the closure. -let internalBinding; +// Do not use `internalBinding` variable name due to the breakage of TypeScript autocompletion. +let _internalBinding; { const bindingObj = { __proto__: null }; // eslint-disable-next-line no-global-assign - internalBinding = function internalBinding(module) { + _internalBinding = function internalBinding(module) { let mod = bindingObj[module]; if (typeof mod !== 'object') { mod = bindingObj[module] = getInternalBinding(module); @@ -180,7 +181,7 @@ const { builtinIds, compileFunction, setInternalLoaders, -} = internalBinding('builtins'); +} = _internalBinding('builtins'); const getOwn = (target, property, receiver) => { return ObjectPrototypeHasOwnProperty(target, property) ? @@ -278,7 +279,7 @@ class BuiltinModule { getESMFacade() { if (this.module) return this.module; - const { ModuleWrap } = internalBinding('module_wrap'); + const { ModuleWrap } = _internalBinding('module_wrap'); // TODO(aduh95): move this to C++, alongside the initialization of the class. ObjectSetPrototypeOf(ModuleWrap.prototype, null); const url = `node:${this.id}`; @@ -328,7 +329,7 @@ class BuiltinModule { const fn = compileFunction(id); // Arguments must match the parameters specified in // BuiltinLoader::LookupAndCompile(). - fn(this.exports, requireFn, this, process, internalBinding, primordials); + fn(this.exports, requireFn, this, process, _internalBinding, primordials); this.loaded = true; } finally { @@ -345,7 +346,7 @@ class BuiltinModule { // Think of this as module.exports in this file even though it is not // written in CommonJS style. const loaderExports = { - internalBinding, + internalBinding: _internalBinding, BuiltinModule, require: requireBuiltin, }; @@ -372,4 +373,4 @@ function requireWithFallbackInDeps(request) { } // Store the internal loaders in C++. -setInternalLoaders(internalBinding, requireBuiltin); +setInternalLoaders(_internalBinding, requireBuiltin);