Skip to content

Commit

Permalink
icu: make process.binding('icu') internal
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
cjihrig authored and jasnell committed Oct 17, 2018
1 parent 2285177 commit 8f3cfc8
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1078,7 +1078,7 @@ if (process.binding('config').hasIntl) {
const {
icuErrName,
transcode: _transcode
} = process.binding('icu');
} = internalBinding('icu');

// Transcodes the Buffer from one encoding to another, returning a new
// Buffer instance.
Expand Down
3 changes: 2 additions & 1 deletion lib/internal/bootstrap/node.js
Original file line number Diff line number Diff line change
Expand Up @@ -394,6 +394,7 @@
new SafeSet([
'cares_wrap',
'fs_event_wrap',
'icu',
'udp_wrap',
'uv',
'pipe_wrap',
Expand Down Expand Up @@ -654,7 +655,7 @@

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

class TextDecoder {
constructor(encoding = 'utf-8', options = {}) {
Expand Down
2 changes: 1 addition & 1 deletion lib/internal/readline.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ CSI.kClearLine = CSI`2K`;
CSI.kClearScreenDown = CSI`0J`;

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

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

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

Expand Down
2 changes: 1 addition & 1 deletion src/node_i18n.cc
Original file line number Diff line number Diff line change
Expand Up @@ -882,6 +882,6 @@ void Initialize(Local<Object> target,
} // namespace i18n
} // namespace node

NODE_BUILTIN_MODULE_CONTEXT_AWARE(icu, node::i18n::Initialize)
NODE_MODULE_CONTEXT_AWARE_INTERNAL(icu, node::i18n::Initialize)

#endif // NODE_HAVE_I18N_SUPPORT
4 changes: 3 additions & 1 deletion test/parallel/test-icu-punycode.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
'use strict';
// Flags: --expose-internals
const common = require('../common');

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

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

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

0 comments on commit 8f3cfc8

Please sign in to comment.