Permalink
Browse files
src,lib: make process.binding('config') internal
PR-URL: #23400
Refs: #22160
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Gireesh Punathil <gpunathi@in.ibm.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Backport-PR-URL: #25446
Reviewed-By: Anna Henningsen <anna@addaleax.net>
- Loading branch information...
|
|
@@ -57,7 +57,7 @@ const { |
|
|
|
} = require('internal/util/types'); |
|
|
|
const { |
|
|
|
pendingDeprecation |
|
|
|
} = process.binding('config'); |
|
|
|
} = internalBinding('config'); |
|
|
|
const { |
|
|
|
formatProperty, |
|
|
|
kObjectType |
|
|
@@ -1083,7 +1083,7 @@ Buffer.prototype.swap64 = function swap64() { |
|
|
|
Buffer.prototype.toLocaleString = Buffer.prototype.toString; |
|
|
|
|
|
|
|
let transcode; |
|
|
|
if (process.binding('config').hasIntl) { |
|
|
|
if (internalBinding('config').hasIntl) { |
|
|
|
const { |
|
|
|
icuErrName, |
|
|
|
transcode: _transcode |
|
|
|
|
|
@@ -40,7 +40,7 @@ const pendingDeprecation = getOptionValue('--pending-deprecation'); |
|
|
|
const { |
|
|
|
fipsMode, |
|
|
|
fipsForced |
|
|
|
} = process.binding('config'); |
|
|
|
} = internalBinding('config'); |
|
|
|
const { getFipsCrypto, setFipsCrypto } = internalBinding('crypto'); |
|
|
|
const { |
|
|
|
randomBytes, |
|
|
|
|
|
@@ -107,7 +107,7 @@ function fatalError(e) { |
|
|
|
Error.captureStackTrace(o, fatalError); |
|
|
|
process._rawDebug(o.stack); |
|
|
|
} |
|
|
|
if (process.binding('config').shouldAbortOnUncaughtException) { |
|
|
|
if (internalBinding('config').shouldAbortOnUncaughtException) { |
|
|
|
process.abort(); |
|
|
|
} |
|
|
|
process.exit(1); |
|
|
|
|
|
@@ -73,6 +73,7 @@ ObjectDefineProperty(process, 'moduleLoadList', { |
|
|
|
writable: false |
|
|
|
}); |
|
|
|
|
|
|
|
|
|
|
|
// internalBindingWhitelist contains the name of internalBinding modules |
|
|
|
// that are whitelisted for access via process.binding()... This is used |
|
|
|
// to provide a transition path for modules that are being moved over to |
|
|
@@ -81,6 +82,7 @@ const internalBindingWhitelist = [ |
|
|
|
'async_wrap', |
|
|
|
'buffer', |
|
|
|
'cares_wrap', |
|
|
|
'config', |
|
|
|
'constants', |
|
|
|
'contextify', |
|
|
|
'crypto', |
|
|
@@ -168,7 +170,7 @@ function NativeModule(id) { |
|
|
|
NativeModule._source = getInternalBinding('natives'); |
|
|
|
NativeModule._cache = {}; |
|
|
|
|
|
|
|
const config = getBinding('config'); |
|
|
|
const config = getInternalBinding('config'); |
|
|
|
|
|
|
|
// Think of this as module.exports in this file even though it is not |
|
|
|
// written in CommonJS style. |
|
|
|
|
|
@@ -176,7 +176,7 @@ function startup() { |
|
|
|
{ |
|
|
|
// Install legacy getters on the `util` binding for typechecking. |
|
|
|
// TODO(addaleax): Turn into a full runtime deprecation. |
|
|
|
const { pendingDeprecation } = process.binding('config'); |
|
|
|
const { pendingDeprecation } = internalBinding('config'); |
|
|
|
const utilBinding = internalBinding('util'); |
|
|
|
const types = internalBinding('types'); |
|
|
|
for (const name of [ |
|
|
@@ -638,7 +638,7 @@ function setupProcessFatal() { |
|
|
|
} |
|
|
|
|
|
|
|
function setupProcessICUVersions() { |
|
|
|
const icu = process.binding('config').hasIntl ? |
|
|
|
const icu = internalBinding('config').hasIntl ? |
|
|
|
internalBinding('icu') : undefined; |
|
|
|
if (!icu) return; // no Intl/ICU: nothing to add here. |
|
|
|
// With no argument, getVersion() returns a comma separated list |
|
|
|
|
|
@@ -342,7 +342,7 @@ Object.defineProperties( |
|
|
|
} }); |
|
|
|
|
|
|
|
const TextDecoder = |
|
|
|
process.binding('config').hasIntl ? |
|
|
|
internalBinding('config').hasIntl ? |
|
|
|
makeTextDecoderICU() : |
|
|
|
makeTextDecoderJS(); |
|
|
|
|
|
|
|
|
|
@@ -12,7 +12,7 @@ let config; |
|
|
|
|
|
|
|
function lazyHookCreation() { |
|
|
|
const { createHook } = require('async_hooks'); |
|
|
|
config = process.binding('config'); |
|
|
|
config = internalBinding('config'); |
|
|
|
|
|
|
|
hook = createHook({ |
|
|
|
init(asyncId, type, triggerAsyncId, resource) { |
|
|
|
|
|
@@ -9,7 +9,7 @@ for (const key of Object.keys(types)) |
|
|
|
|
|
|
|
// Environment variables are parsed ad-hoc throughout the code base, |
|
|
|
// so we gather the documentation here. |
|
|
|
const { hasIntl, hasSmallICU, hasNodeOptions } = process.binding('config'); |
|
|
|
const { hasIntl, hasSmallICU, hasNodeOptions } = internalBinding('config'); |
|
|
|
const envVars = new Map([ |
|
|
|
['NODE_DEBUG', { helpText: "','-separated list of core modules that " + |
|
|
|
'should print debug information' }], |
|
|
|
|
|
@@ -30,7 +30,7 @@ CSI.kClearToEnd = CSI`0K`; |
|
|
|
CSI.kClearLine = CSI`2K`; |
|
|
|
CSI.kClearScreenDown = CSI`0J`; |
|
|
|
|
|
|
|
if (process.binding('config').hasIntl) { |
|
|
|
if (internalBinding('config').hasIntl) { |
|
|
|
const icu = internalBinding('icu'); |
|
|
|
getStringWidth = function getStringWidth(str, options) { |
|
|
|
options = options || {}; |
|
|
|
|
|
@@ -1,6 +1,6 @@ |
|
|
|
'use strict'; |
|
|
|
|
|
|
|
const { hasTracing } = process.binding('config'); |
|
|
|
const { hasTracing } = internalBinding('config'); |
|
|
|
const kHandle = Symbol('handle'); |
|
|
|
const kEnabled = Symbol('enabled'); |
|
|
|
const kCategories = Symbol('categories'); |
|
|
|
|
|
@@ -21,7 +21,7 @@ |
|
|
|
|
|
|
|
'use strict'; |
|
|
|
|
|
|
|
const { toASCII } = process.binding('config').hasIntl ? |
|
|
|
const { toASCII } = internalBinding('config').hasIntl ? |
|
|
|
internalBinding('icu') : require('punycode'); |
|
|
|
|
|
|
|
const { hexTable } = require('internal/querystring'); |
|
|
|
|
|
@@ -106,4 +106,4 @@ static void Initialize(Local<Object> target, |
|
|
|
|
|
|
|
} // namespace node |
|
|
|
|
|
|
|
NODE_BUILTIN_MODULE_CONTEXT_AWARE(config, node::Initialize) |
|
|
|
NODE_MODULE_CONTEXT_AWARE_INTERNAL(config, node::Initialize) |
|
|
@@ -1,8 +1,10 @@ |
|
|
|
// Flags: --expose-internals |
|
|
|
'use strict'; |
|
|
|
const { internalBinding } = require('internal/test/binding'); |
|
|
|
const common = require('../common'); |
|
|
|
const os = require('os'); |
|
|
|
|
|
|
|
const { hasSmallICU } = process.binding('config'); |
|
|
|
const { hasSmallICU } = internalBinding('config'); |
|
|
|
if (!(common.hasIntl && hasSmallICU)) |
|
|
|
common.skip('missing Intl'); |
|
|
|
|
|
|
|
|
|
@@ -3,7 +3,8 @@ |
|
|
|
|
|
|
|
require('../common'); |
|
|
|
const assert = require('assert'); |
|
|
|
const config = process.binding('config'); |
|
|
|
const { internalBinding } = require('internal/test/binding'); |
|
|
|
const config = internalBinding('config'); |
|
|
|
|
|
|
|
console.log(config, process.argv); |
|
|
|
|
|
|
|
|
|
@@ -1,4 +1,6 @@ |
|
|
|
// Flags: --expose-internals |
|
|
|
'use strict'; |
|
|
|
const { internalBinding } = require('internal/test/binding'); |
|
|
|
require('../common'); |
|
|
|
const { PassThrough } = require('stream'); |
|
|
|
const readline = require('readline'); |
|
|
@@ -23,7 +25,7 @@ const ctrlU = { ctrl: true, name: 'u' }; |
|
|
|
// The non-ICU JS implementation of character width calculation is only aware |
|
|
|
// of the wide/narrow distinction. Only test these more advanced cases when |
|
|
|
// ICU is available. |
|
|
|
if (process.binding('config').hasIntl) { |
|
|
|
if (internalBinding('config').hasIntl) { |
|
|
|
tests.push( |
|
|
|
[0, '\u0301'], // COMBINING ACUTE ACCENT |
|
|
|
[1, 'a\u0301'], // á |
|
|
|
0 comments on commit
7480864