Skip to content

Commit

Permalink
Revert "src,lib: make process.binding('config') internal"
Browse files Browse the repository at this point in the history
This reverts commit 88a5449.

PR-URL: #25446
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
joyeecheung authored and addaleax committed Jan 14, 2019
1 parent 42a7eaf commit 577da83
Show file tree
Hide file tree
Showing 15 changed files with 17 additions and 23 deletions.
4 changes: 2 additions & 2 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ const {
} = require('internal/util/types');
const {
pendingDeprecation
} = internalBinding('config');
} = process.binding('config');
const {
formatProperty,
kObjectType
Expand Down Expand Up @@ -1083,7 +1083,7 @@ Buffer.prototype.swap64 = function swap64() {
Buffer.prototype.toLocaleString = Buffer.prototype.toString;

let transcode;
if (internalBinding('config').hasIntl) {
if (process.binding('config').hasIntl) {
const {
icuErrName,
transcode: _transcode
Expand Down
2 changes: 1 addition & 1 deletion lib/crypto.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ const pendingDeprecation = getOptionValue('--pending-deprecation');
const {
fipsMode,
fipsForced
} = internalBinding('config');
} = process.binding('config');
const { getFipsCrypto, setFipsCrypto } = internalBinding('crypto');
const {
randomBytes,
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/async_hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ function fatalError(e) {
Error.captureStackTrace(o, fatalError);
process._rawDebug(o.stack);
}
if (internalBinding('config').shouldAbortOnUncaughtException) {
if (process.binding('config').shouldAbortOnUncaughtException) {
process.abort();
}
process.exit(1);
Expand Down
3 changes: 1 addition & 2 deletions lib/internal/bootstrap/loaders.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,6 @@
'buffer',
'cares_wrap',
'constants',
'config',
'contextify',
'crypto',
'fs_event_wrap',
Expand Down Expand Up @@ -165,7 +164,7 @@
NativeModule._source = getInternalBinding('natives');
NativeModule._cache = {};

const config = getInternalBinding('config');
const config = getBinding('config');

// Think of this as module.exports in this file even though it is not
// written in CommonJS style.
Expand Down
4 changes: 2 additions & 2 deletions lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@
{
// Install legacy getters on the `util` binding for typechecking.
// TODO(addaleax): Turn into a full runtime deprecation.
const { pendingDeprecation } = internalBinding('config');
const { pendingDeprecation } = process.binding('config');
const utilBinding = internalBinding('util');
const types = internalBinding('types');
for (const name of [
Expand Down Expand Up @@ -637,7 +637,7 @@
}

function setupProcessICUVersions() {
const icu = internalBinding('config').hasIntl ?
const icu = process.binding('config').hasIntl ?
internalBinding('icu') : undefined;
if (!icu) return; // no Intl/ICU: nothing to add here.
// With no argument, getVersion() returns a comma separated list
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/encoding.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ Object.defineProperties(
} });

const TextDecoder =
internalBinding('config').hasIntl ?
process.binding('config').hasIntl ?
makeTextDecoderICU() :
makeTextDecoderJS();

Expand Down
2 changes: 1 addition & 1 deletion lib/internal/inspector_async_hook.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ let config;

function lazyHookCreation() {
const { createHook } = require('async_hooks');
config = internalBinding('config');
config = process.binding('config');

hook = createHook({
init(asyncId, type, triggerAsyncId, resource) {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/print_help.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 } = internalBinding('config');
const { hasIntl, hasSmallICU, hasNodeOptions } = process.binding('config');
const envVars = new Map([
['NODE_DEBUG', { helpText: "','-separated list of core modules that " +
'should print debug information' }],
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ CSI.kClearToEnd = CSI`0K`;
CSI.kClearLine = CSI`2K`;
CSI.kClearScreenDown = CSI`0J`;

if (internalBinding('config').hasIntl) {
if (process.binding('config').hasIntl) {
const icu = internalBinding('icu');
getStringWidth = function getStringWidth(str, options) {
options = options || {};
Expand Down
2 changes: 1 addition & 1 deletion lib/trace_events.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
'use strict';

const { hasTracing } = internalBinding('config');
const { hasTracing } = process.binding('config');
const kHandle = Symbol('handle');
const kEnabled = Symbol('enabled');
const kCategories = Symbol('categories');
Expand Down
2 changes: 1 addition & 1 deletion lib/url.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

'use strict';

const { toASCII } = internalBinding('config').hasIntl ?
const { toASCII } = process.binding('config').hasIntl ?
internalBinding('icu') : require('punycode');

const { hexTable } = require('internal/querystring');
Expand Down
2 changes: 1 addition & 1 deletion src/node_config.cc
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,4 @@ static void Initialize(Local<Object> target,

} // namespace node

NODE_MODULE_CONTEXT_AWARE_INTERNAL(config, node::Initialize)
NODE_BUILTIN_MODULE_CONTEXT_AWARE(config, node::Initialize)
4 changes: 1 addition & 3 deletions test/parallel/test-icu-data-dir.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
// Flags: --expose-internals
'use strict';
const { internalBinding } = require('internal/test/binding');
const common = require('../common');
const os = require('os');

const { hasSmallICU } = internalBinding('config');
const { hasSmallICU } = process.binding('config');
if (!(common.hasIntl && hasSmallICU))
common.skip('missing Intl');

Expand Down
3 changes: 1 addition & 2 deletions test/parallel/test-internal-modules-expose.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@

require('../common');
const assert = require('assert');
const { internalBinding } = require('internal/test/binding');
const config = internalBinding('config');
const config = process.binding('config');

console.log(config, process.argv);

Expand Down
4 changes: 1 addition & 3 deletions test/parallel/test-readline-position.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
// Flags: --expose-internals
'use strict';
const { internalBinding } = require('internal/test/binding');
require('../common');
const { PassThrough } = require('stream');
const readline = require('readline');
Expand All @@ -25,7 +23,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 (internalBinding('config').hasIntl) {
if (process.binding('config').hasIntl) {
tests.push(
[0, '\u0301'], // COMBINING ACUTE ACCENT
[1, 'a\u0301'], // á
Expand Down

0 comments on commit 577da83

Please sign in to comment.