Skip to content

Commit 8f3cfc8

Browse files
cjihrigjasnell
authored andcommitted
icu: make process.binding('icu') internal
PR-URL: #23234 Refs: #22160 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>
1 parent 2285177 commit 8f3cfc8

File tree

7 files changed

+10
-7
lines changed

7 files changed

+10
-7
lines changed

lib/buffer.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1078,7 +1078,7 @@ if (process.binding('config').hasIntl) {
10781078
const {
10791079
icuErrName,
10801080
transcode: _transcode
1081-
} = process.binding('icu');
1081+
} = internalBinding('icu');
10821082

10831083
// Transcodes the Buffer from one encoding to another, returning a new
10841084
// Buffer instance.

lib/internal/bootstrap/node.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@
394394
new SafeSet([
395395
'cares_wrap',
396396
'fs_event_wrap',
397+
'icu',
397398
'udp_wrap',
398399
'uv',
399400
'pipe_wrap',
@@ -654,7 +655,7 @@
654655

655656
function setupProcessICUVersions() {
656657
const icu = process.binding('config').hasIntl ?
657-
process.binding('icu') : undefined;
658+
internalBinding('icu') : undefined;
658659
if (!icu) return; // no Intl/ICU: nothing to add here.
659660
// With no argument, getVersion() returns a comma separated list
660661
// of possible types.

lib/internal/encoding.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ function makeTextDecoderICU() {
356356
decode: _decode,
357357
getConverter,
358358
hasConverter
359-
} = process.binding('icu');
359+
} = internalBinding('icu');
360360

361361
class TextDecoder {
362362
constructor(encoding = 'utf-8', options = {}) {

lib/internal/readline.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ CSI.kClearLine = CSI`2K`;
3131
CSI.kClearScreenDown = CSI`0J`;
3232

3333
if (process.binding('config').hasIntl) {
34-
const icu = process.binding('icu');
34+
const icu = internalBinding('icu');
3535
getStringWidth = function getStringWidth(str, options) {
3636
options = options || {};
3737
if (!Number.isInteger(str))

lib/url.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
'use strict';
2323

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

2727
const { hexTable } = require('internal/querystring');
2828

src/node_i18n.cc

+1-1
Original file line numberDiff line numberDiff line change
@@ -882,6 +882,6 @@ void Initialize(Local<Object> target,
882882
} // namespace i18n
883883
} // namespace node
884884

885-
NODE_BUILTIN_MODULE_CONTEXT_AWARE(icu, node::i18n::Initialize)
885+
NODE_MODULE_CONTEXT_AWARE_INTERNAL(icu, node::i18n::Initialize)
886886

887887
#endif // NODE_HAVE_I18N_SUPPORT

test/parallel/test-icu-punycode.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
'use strict';
2+
// Flags: --expose-internals
23
const common = require('../common');
34

45
if (!common.hasIntl)
56
common.skip('missing Intl');
67

7-
const icu = process.binding('icu');
8+
const { internalBinding } = require('internal/test/binding');
9+
const icu = internalBinding('icu');
810
const assert = require('assert');
911

1012
const tests = require('../fixtures/url-idna.js');

0 commit comments

Comments
 (0)