Skip to content

Commit c7962dc

Browse files
committed
src: move process.binding('uv') to internalBinding
PR-URL: #22163 Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de> Reviewed-By: Gus Caplan <me@gus.host> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Tiancheng "Timothy" Gu <timothygu99@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Jon Moss <me@jonathanmoss.me>
1 parent 2fd71f9 commit c7962dc

25 files changed

+143
-84
lines changed

lib/internal/child_process.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ const { HTTPParser } = process.binding('http_parser');
3636
const { freeParser } = require('_http_common');
3737
const { kStateSymbol } = require('internal/dgram');
3838

39+
const { internalBinding } = require('internal/bootstrap/loaders');
40+
3941
const {
4042
UV_EACCES,
4143
UV_EAGAIN,
@@ -45,7 +47,7 @@ const {
4547
UV_ENOENT,
4648
UV_ENOSYS,
4749
UV_ESRCH
48-
} = process.binding('uv');
50+
} = internalBinding('uv');
4951

5052
const { SocketListSend, SocketListReceive } = SocketList;
5153

lib/internal/cluster/round_robin_handle.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ const assert = require('assert');
33
const net = require('net');
44
const { sendHelper } = require('internal/cluster/utils');
55
const getOwnPropertyNames = Object.getOwnPropertyNames;
6-
const uv = process.binding('uv');
6+
const { internalBinding } = require('internal/bootstrap/loaders');
7+
const uv = internalBinding('uv');
78

89
module.exports = RoundRobinHandle;
910

lib/internal/dgram.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,8 @@ const { codes } = require('internal/errors');
33
const { UDP } = process.binding('udp_wrap');
44
const { isInt32 } = require('internal/validators');
55
const TTYWrap = process.binding('tty_wrap');
6-
const { UV_EINVAL } = process.binding('uv');
6+
const { internalBinding } = require('internal/bootstrap/loaders');
7+
const { UV_EINVAL } = internalBinding('uv');
78
const { ERR_INVALID_ARG_TYPE, ERR_SOCKET_BAD_TYPE } = codes;
89
const kStateSymbol = Symbol('state symbol');
910
let dns; // Lazy load for startup performance.

lib/internal/errors.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,12 @@ const kInfo = Symbol('info');
1515
const messages = new Map();
1616
const codes = {};
1717

18+
const { internalBinding } = require('internal/bootstrap/loaders');
1819
const {
1920
errmap,
2021
UV_EAI_NODATA,
2122
UV_EAI_NONAME
22-
} = process.binding('uv');
23+
} = internalBinding('uv');
2324
const { kMaxLength } = process.binding('buffer');
2425
const { defineProperty } = Object;
2526

lib/internal/http2/core.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ const { isArrayBufferView } = require('internal/util/types');
114114
const { FileHandle } = process.binding('fs');
115115
const binding = process.binding('http2');
116116
const { ShutdownWrap } = process.binding('stream_wrap');
117-
const { UV_EOF } = process.binding('uv');
117+
const { UV_EOF } = internalBinding('uv');
118118

119119
const { StreamPipe } = internalBinding('stream_pipe');
120120
const { _connectionListener: httpConnectionListener } = http;

lib/internal/util.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ const {
1313
arrow_message_private_symbol: kArrowMessagePrivateSymbolIndex,
1414
decorated_private_symbol: kDecoratedPrivateSymbolIndex
1515
} = process.binding('util');
16-
const { errmap } = process.binding('uv');
16+
17+
const { internalBinding } = require('internal/bootstrap/loaders');
18+
const { errmap } = internalBinding('uv');
1719

1820
const noCrypto = !process.versions.openssl;
1921

lib/internal/wrap_js_stream.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,8 @@ const assert = require('assert');
44
const util = require('util');
55
const { Socket } = require('net');
66
const { JSStream } = process.binding('js_stream');
7-
const uv = process.binding('uv');
7+
const { internalBinding } = require('internal/bootstrap/loaders');
8+
const uv = internalBinding('uv');
89
const debug = util.debuglog('stream_wrap');
910
const { owner_symbol } = require('internal/async_hooks').symbols;
1011
const { ERR_STREAM_WRAP } = require('internal/errors').codes;

lib/net.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,11 +34,12 @@ const {
3434
makeSyncWrite
3535
} = require('internal/net');
3636
const assert = require('assert');
37+
const { internalBinding } = require('internal/bootstrap/loaders');
3738
const {
3839
UV_EADDRINUSE,
3940
UV_EINVAL,
4041
UV_EOF
41-
} = process.binding('uv');
42+
} = internalBinding('uv');
4243

4344
const { Buffer } = require('buffer');
4445
const TTYWrap = process.binding('tty_wrap');

src/uv.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,4 +82,4 @@ void Initialize(Local<Object> target,
8282
} // anonymous namespace
8383
} // namespace node
8484

85-
NODE_BUILTIN_MODULE_CONTEXT_AWARE(uv, node::Initialize)
85+
NODE_MODULE_CONTEXT_AWARE_INTERNAL(uv, node::Initialize)

test/parallel/test-dgram-cluster-bind-error.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
1+
// Flags: --expose-internals
12
'use strict';
23
const common = require('../common');
34
const assert = require('assert');
45
const cluster = require('cluster');
56
const dgram = require('dgram');
6-
const { UV_UNKNOWN } = process.binding('uv');
7+
const { internalBinding } = require('internal/test/binding');
8+
const { UV_UNKNOWN } = internalBinding('uv');
79

810
if (cluster.isMaster) {
911
cluster.fork();

0 commit comments

Comments
 (0)