Skip to content

Commit e872089

Browse files
devsnekMylesBorins
authored andcommitted
bootstrapper: move internalBinding to NativeModule
internalBinding is used so often that it should just automatically be available for usage in internals. PR-URL: #23025 Refs: 2a9eb31 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: James M Snell <jasnell@gmail.com> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Backport-PR-URL: #23661 Backport-Reviewed-By: Gus Caplan <me@gus.host> Backport-Reviewed-By: Richard Lau <riclau@uk.ibm.com> Backport-Reviewed-By: Michaël Zasso <targos@protonmail.com> Backport-Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com> Backport-Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
1 parent c854879 commit e872089

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

51 files changed

+59
-67
lines changed

lib/.eslintrc.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,3 +44,4 @@ globals:
4444
DCHECK_LE: false
4545
DCHECK_LT: false
4646
DCHECK_NE: false
47+
internalBinding: false

lib/_http_client.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
const util = require('util');
2525
const net = require('net');
2626
const url = require('url');
27-
const { HTTPParser } = process.binding('http_parser');
27+
const { HTTPParser } = internalBinding('http_parser');
2828
const assert = require('assert').ok;
2929
const {
3030
_checkIsHttpToken: checkIsHttpToken,

lib/_http_common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
'use strict';
2323

24-
const { methods, HTTPParser } = process.binding('http_parser');
24+
const { methods, HTTPParser } = internalBinding('http_parser');
2525

2626
const FreeList = require('internal/freelist');
2727
const { ondrain } = require('internal/http');

lib/_http_server.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
const util = require('util');
2525
const net = require('net');
26-
const { HTTPParser } = process.binding('http_parser');
26+
const { HTTPParser } = internalBinding('http_parser');
2727
const assert = require('assert').ok;
2828
const {
2929
parsers,

lib/_tls_common.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ const { SSL_OP_CIPHER_SERVER_PREFERENCE } = process.binding('constants').crypto;
3434
// Lazily loaded
3535
var crypto = null;
3636

37-
const { SecureContext: NativeSecureContext } = process.binding('crypto');
37+
const { SecureContext: NativeSecureContext } = internalBinding('crypto');
3838

3939
function SecureContext(secureProtocol, secureOptions, context) {
4040
if (!(this instanceof SecureContext)) {

lib/_tls_wrap.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,9 +32,9 @@ const common = require('_tls_common');
3232
const { StreamWrap } = require('_stream_wrap');
3333
const { Buffer } = require('buffer');
3434
const debug = util.debuglog('tls');
35-
const tls_wrap = process.binding('tls_wrap');
36-
const { TCP, constants: TCPConstants } = process.binding('tcp_wrap');
37-
const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap');
35+
const { TCP, constants: TCPConstants } = internalBinding('tcp_wrap');
36+
const tls_wrap = internalBinding('tls_wrap');
37+
const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap');
3838
const { owner_symbol } = require('internal/async_hooks').symbols;
3939
const {
4040
SecureContext: NativeSecureContext

lib/buffer.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,6 @@ const {
4141
// that test/parallel/test-buffer-bindingobj-no-zerofill.js is written.
4242
let isAnyArrayBuffer;
4343
try {
44-
const { internalBinding } = require('internal/bootstrap/loaders');
4544
isAnyArrayBuffer = internalBinding('types').isAnyArrayBuffer;
4645
} catch (e) {
4746
isAnyArrayBuffer = require('util').types.isAnyArrayBuffer;

lib/child_process.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ const {
2828
const { isArrayBufferView } = require('internal/util/types');
2929
const debug = util.debuglog('child_process');
3030
const { Buffer } = require('buffer');
31-
const { Pipe, constants: PipeConstants } = process.binding('pipe_wrap');
31+
const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap');
3232
const {
3333
ERR_INVALID_ARG_VALUE,
3434
ERR_CHILD_PROCESS_IPC_REQUIRED,

lib/console.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ const {
2929
ERR_INVALID_ARG_VALUE,
3030
},
3131
} = require('internal/errors');
32-
const { previewEntries } = process.binding('util');
32+
const { previewEntries } = internalBinding('util');
3333
const { Buffer: { isBuffer } } = require('buffer');
3434
const util = require('util');
3535
const {

lib/dns.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
'use strict';
2323

24-
const cares = process.binding('cares_wrap');
24+
const cares = internalBinding('cares_wrap');
2525
const { isIP, isIPv4, isLegalPort } = require('internal/net');
2626
const { customPromisifyArgs } = require('internal/util');
2727
const errors = require('internal/errors');

0 commit comments

Comments
 (0)