mirror of https://github.com/nodejs/node.git
icu: make process.binding('icu') internal
PR-URL: https://github.com/nodejs/node/pull/23234 Refs: https://github.com/nodejs/node/issues/22160 Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Daniel Bevenius <daniel.bevenius@gmail.com> Reviewed-By: Gus Caplan <me@gus.host>pull/23234/head
parent
9930529805
commit
2498c7b18b
|
@ -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.
|
||||
|
|
|
@ -394,6 +394,7 @@
|
|||
new SafeSet([
|
||||
'cares_wrap',
|
||||
'fs_event_wrap',
|
||||
'icu',
|
||||
'udp_wrap',
|
||||
'uv',
|
||||
'pipe_wrap',
|
||||
|
@ -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.
|
||||
|
|
|
@ -356,7 +356,7 @@ function makeTextDecoderICU() {
|
|||
decode: _decode,
|
||||
getConverter,
|
||||
hasConverter
|
||||
} = process.binding('icu');
|
||||
} = internalBinding('icu');
|
||||
|
||||
class TextDecoder {
|
||||
constructor(encoding = 'utf-8', options = {}) {
|
||||
|
|
|
@ -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))
|
||||
|
|
|
@ -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');
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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');
|
||||
|
|
Loading…
Reference in New Issue