lib: add trailing commas to all public core modules

PR-URL: https://github.com/nodejs/node/pull/46848
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Anatoli Papirovski <apapirovski@mac.com>
Reviewed-By: Benjamin Gruenbaum <benjamingr@gmail.com>
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Jiawen Geng <technicalcute@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Yongsheng Zhang <zyszys98@gmail.com>
This commit is contained in:
Antoine du Hamel 2023-02-12 19:26:21 +01:00
parent 1101713cc2
commit 9dbb1623ff
No known key found for this signature in database
GPG key ID: 21D900FFDB233756
30 changed files with 212 additions and 243 deletions

View file

@ -264,58 +264,27 @@ globals:
overrides: overrides:
- files: - files:
- ./*/*.js - ./*/*.js
- ./_*.js - ./*.js
- ./child_process.js
- ./cluster.js
- ./console.js
- ./constants.js
- ./events.js
- ./fs.js
- ./internal/assert.js
- ./internal/child_process.js
- ./internal/child_process/*.js - ./internal/child_process/*.js
- ./internal/cli_table.js
- ./internal/cluster/*.js - ./internal/cluster/*.js
- ./internal/debugger/*.js - ./internal/debugger/*.js
- ./internal/event_target.js
- ./internal/events/*.js - ./internal/events/*.js
- ./internal/fixed_queue.js
- ./internal/freelist.js
- ./internal/fs/*.js - ./internal/fs/*.js
- ./internal/heap_utils.js
- ./internal/http.js
- ./internal/idna.js
- ./internal/js_stream_socket.js
- ./internal/mime.js
- ./internal/modules/*.js - ./internal/modules/*.js
- ./internal/per_context/*.js - ./internal/per_context/*.js
- ./internal/perf/*.js - ./internal/perf/*.js
- ./internal/policy/*.js - ./internal/policy/*.js
- ./internal/priority_queue.js
- ./internal/process/*.js - ./internal/process/*.js
- ./internal/readline/*.js - ./internal/readline/*.js
- ./internal/readme.md - ./internal/readme.md
- ./internal/repl.js
- ./internal/repl/*.js - ./internal/repl/*.js
- ./internal/source_map/*.js - ./internal/source_map/*.js
- ./internal/streams/*.js - ./internal/streams/*.js
- ./internal/structured_clone.js
- ./internal/test/*.js - ./internal/test/*.js
- ./internal/test_runner/**/*.js - ./internal/test_runner/**/*.js
- ./internal/tls/*.js - ./internal/tls/*.js
- ./internal/util/parse_args/*.js - ./internal/util/parse_args/*.js
- ./internal/v8_prof_processor.js
- ./internal/vm.js
- ./internal/watch_mode/*.js - ./internal/watch_mode/*.js
- ./internal/webidl.js
- ./internal/webstreams/*.js - ./internal/webstreams/*.js
- ./module.js
- ./process.js
- ./punycode.js
- ./repl.js
- ./sys.js
- ./test.js
- ./tls.js
- ./url.js
rules: rules:
comma-dangle: [error, always-multiline] comma-dangle: [error, always-multiline]

View file

@ -163,7 +163,7 @@ function fail(actual, expected, message, operator, stackStartFn) {
expected, expected,
operator: operator === undefined ? 'fail' : operator, operator: operator === undefined ? 'fail' : operator,
stackStartFn: stackStartFn || fail, stackStartFn: stackStartFn || fail,
message message,
}; };
const err = new AssertionError(errArgs); const err = new AssertionError(errArgs);
if (internalMessage) { if (internalMessage) {
@ -393,7 +393,7 @@ function innerOk(fn, argLen, value, message) {
expected: true, expected: true,
message, message,
operator: '==', operator: '==',
stackStartFn: fn stackStartFn: fn,
}); });
err.generatedMessage = generatedMessage; err.generatedMessage = generatedMessage;
throw err; throw err;
@ -430,7 +430,7 @@ assert.equal = function equal(actual, expected, message) {
expected, expected,
message, message,
operator: '==', operator: '==',
stackStartFn: equal stackStartFn: equal,
}); });
} }
}; };
@ -454,7 +454,7 @@ assert.notEqual = function notEqual(actual, expected, message) {
expected, expected,
message, message,
operator: '!=', operator: '!=',
stackStartFn: notEqual stackStartFn: notEqual,
}); });
} }
}; };
@ -477,7 +477,7 @@ assert.deepEqual = function deepEqual(actual, expected, message) {
expected, expected,
message, message,
operator: 'deepEqual', operator: 'deepEqual',
stackStartFn: deepEqual stackStartFn: deepEqual,
}); });
} }
}; };
@ -500,7 +500,7 @@ assert.notDeepEqual = function notDeepEqual(actual, expected, message) {
expected, expected,
message, message,
operator: 'notDeepEqual', operator: 'notDeepEqual',
stackStartFn: notDeepEqual stackStartFn: notDeepEqual,
}); });
} }
}; };
@ -525,7 +525,7 @@ assert.deepStrictEqual = function deepStrictEqual(actual, expected, message) {
expected, expected,
message, message,
operator: 'deepStrictEqual', operator: 'deepStrictEqual',
stackStartFn: deepStrictEqual stackStartFn: deepStrictEqual,
}); });
} }
}; };
@ -550,7 +550,7 @@ function notDeepStrictEqual(actual, expected, message) {
expected, expected,
message, message,
operator: 'notDeepStrictEqual', operator: 'notDeepStrictEqual',
stackStartFn: notDeepStrictEqual stackStartFn: notDeepStrictEqual,
}); });
} }
} }
@ -572,7 +572,7 @@ assert.strictEqual = function strictEqual(actual, expected, message) {
expected, expected,
message, message,
operator: 'strictEqual', operator: 'strictEqual',
stackStartFn: strictEqual stackStartFn: strictEqual,
}); });
} }
}; };
@ -594,7 +594,7 @@ assert.notStrictEqual = function notStrictEqual(actual, expected, message) {
expected, expected,
message, message,
operator: 'notStrictEqual', operator: 'notStrictEqual',
stackStartFn: notStrictEqual stackStartFn: notStrictEqual,
}); });
} }
}; };
@ -627,7 +627,7 @@ function compareExceptionKey(actual, expected, key, message, keys, fn) {
actual: a, actual: a,
expected: b, expected: b,
operator: 'deepStrictEqual', operator: 'deepStrictEqual',
stackStartFn: fn stackStartFn: fn,
}); });
err.actual = actual; err.actual = actual;
err.expected = expected; err.expected = expected;
@ -639,7 +639,7 @@ function compareExceptionKey(actual, expected, key, message, keys, fn) {
expected, expected,
message, message,
operator: fn.name, operator: fn.name,
stackStartFn: fn stackStartFn: fn,
}); });
} }
} }
@ -668,7 +668,7 @@ function expectedException(actual, expected, message, fn) {
expected, expected,
message, message,
operator: 'deepStrictEqual', operator: 'deepStrictEqual',
stackStartFn: fn stackStartFn: fn,
}); });
err.operator = fn.name; err.operator = fn.name;
throw err; throw err;
@ -743,7 +743,7 @@ function expectedException(actual, expected, message, fn) {
expected, expected,
message, message,
operator: fn.name, operator: fn.name,
stackStartFn: fn stackStartFn: fn,
}); });
err.generatedMessage = generatedMessage; err.generatedMessage = generatedMessage;
throw err; throw err;
@ -837,7 +837,7 @@ function expectsError(stackStartFn, actual, error, message) {
expected: error, expected: error,
operator: stackStartFn.name, operator: stackStartFn.name,
message: `Missing expected ${fnType}${details}`, message: `Missing expected ${fnType}${details}`,
stackStartFn stackStartFn,
}); });
} }
@ -886,7 +886,7 @@ function expectsNoError(stackStartFn, actual, error, message) {
operator: stackStartFn.name, operator: stackStartFn.name,
message: `Got unwanted ${fnType}${details}\n` + message: `Got unwanted ${fnType}${details}\n` +
`Actual message: "${actual && actual.message}"`, `Actual message: "${actual && actual.message}"`,
stackStartFn stackStartFn,
}); });
} }
throw actual; throw actual;
@ -955,7 +955,7 @@ assert.ifError = function ifError(err) {
expected: null, expected: null,
operator: 'ifError', operator: 'ifError',
message, message,
stackStartFn: ifError stackStartFn: ifError,
}); });
// Make sure we actually have a stack trace! // Make sure we actually have a stack trace!
@ -1020,7 +1020,7 @@ function internalMatch(string, regexp, message, fn) {
expected: regexp, expected: regexp,
message, message,
operator: fn.name, operator: fn.name,
stackStartFn: fn stackStartFn: fn,
}); });
err.generatedMessage = generatedMessage; err.generatedMessage = generatedMessage;
throw err; throw err;
@ -1064,7 +1064,7 @@ assert.strict = ObjectAssign(strict, assert, {
equal: assert.strictEqual, equal: assert.strictEqual,
deepEqual: assert.deepStrictEqual, deepEqual: assert.deepStrictEqual,
notEqual: assert.notStrictEqual, notEqual: assert.notStrictEqual,
notDeepEqual: assert.notDeepStrictEqual notDeepEqual: assert.notDeepStrictEqual,
}); });
assert.strict.strict = assert.strict; assert.strict.strict = assert.strict;

View file

@ -18,7 +18,7 @@ const {
const { const {
ERR_ASYNC_CALLBACK, ERR_ASYNC_CALLBACK,
ERR_ASYNC_TYPE, ERR_ASYNC_TYPE,
ERR_INVALID_ASYNC_ID ERR_INVALID_ASYNC_ID,
} = require('internal/errors').codes; } = require('internal/errors').codes;
const { const {
deprecate, deprecate,
@ -61,7 +61,7 @@ const {
const { const {
async_id_symbol, trigger_async_id_symbol, async_id_symbol, trigger_async_id_symbol,
init_symbol, before_symbol, after_symbol, destroy_symbol, init_symbol, before_symbol, after_symbol, destroy_symbol,
promise_resolve_symbol promise_resolve_symbol,
} = internal_async_hooks.symbols; } = internal_async_hooks.symbols;
// Get constants // Get constants
@ -259,7 +259,7 @@ class AsyncResource {
set: deprecate(function(val) { set: deprecate(function(val) {
self = val; self = val;
}, 'The asyncResource property on bound functions is deprecated', 'DEP0172'), }, 'The asyncResource property on bound functions is deprecated', 'DEP0172'),
} },
}); });
return bound; return bound;
} }
@ -278,7 +278,7 @@ const storageHook = createHook({
for (let i = 0; i < storageList.length; ++i) { for (let i = 0; i < storageList.length; ++i) {
storageList[i]._propagate(resource, currentResource, type); storageList[i]._propagate(resource, currentResource, type);
} }
} },
}); });
class AsyncLocalStorage { class AsyncLocalStorage {

View file

@ -69,7 +69,7 @@ const {
swap32: _swap32, swap32: _swap32,
swap64: _swap64, swap64: _swap64,
kMaxLength, kMaxLength,
kStringMaxLength kStringMaxLength,
} = internalBinding('buffer'); } = internalBinding('buffer');
const { const {
constants: { constants: {
@ -93,7 +93,7 @@ const {
isTypedArray, isTypedArray,
} = require('internal/util/types'); } = require('internal/util/types');
const { const {
inspect: utilInspect inspect: utilInspect,
} = require('internal/util/inspect'); } = require('internal/util/inspect');
const { encodings } = internalBinding('string_decoder'); const { encodings } = internalBinding('string_decoder');
@ -105,7 +105,7 @@ const {
ERR_INVALID_BUFFER_SIZE, ERR_INVALID_BUFFER_SIZE,
ERR_OUT_OF_RANGE, ERR_OUT_OF_RANGE,
ERR_MISSING_ARGS, ERR_MISSING_ARGS,
ERR_UNKNOWN_ENCODING ERR_UNKNOWN_ENCODING,
}, },
genericNodeError, genericNodeError,
hideStackFrames, hideStackFrames,
@ -125,7 +125,7 @@ const {
FastBuffer, FastBuffer,
markAsUntransferable, markAsUntransferable,
addBufferPrototypeMethods, addBufferPrototypeMethods,
createUnsafeBuffer createUnsafeBuffer,
} = require('internal/buffer'); } = require('internal/buffer');
FastBuffer.prototype.constructor = Buffer; FastBuffer.prototype.constructor = Buffer;
@ -137,14 +137,14 @@ const constants = ObjectDefineProperties({}, {
__proto__: null, __proto__: null,
value: kMaxLength, value: kMaxLength,
writable: false, writable: false,
enumerable: true enumerable: true,
}, },
MAX_STRING_LENGTH: { MAX_STRING_LENGTH: {
__proto__: null, __proto__: null,
value: kStringMaxLength, value: kStringMaxLength,
writable: false, writable: false,
enumerable: true enumerable: true,
} },
}); });
Buffer.poolSize = 8 * 1024; Buffer.poolSize = 8 * 1024;
@ -289,7 +289,7 @@ ObjectDefineProperty(Buffer, SymbolSpecies, {
__proto__: null, __proto__: null,
enumerable: false, enumerable: false,
configurable: true, configurable: true,
get() { return FastBuffer; } get() { return FastBuffer; },
}); });
/** /**
@ -639,7 +639,7 @@ const encodingOps = {
write: (buf, string, offset, len) => buf.utf8Write(string, offset, len), write: (buf, string, offset, len) => buf.utf8Write(string, offset, len),
slice: (buf, start, end) => buf.utf8Slice(start, end), slice: (buf, start, end) => buf.utf8Slice(start, end),
indexOf: (buf, val, byteOffset, dir) => indexOf: (buf, val, byteOffset, dir) =>
indexOfString(buf, val, byteOffset, encodingsMap.utf8, dir) indexOfString(buf, val, byteOffset, encodingsMap.utf8, dir),
}, },
ucs2: { ucs2: {
encoding: 'ucs2', encoding: 'ucs2',
@ -648,7 +648,7 @@ const encodingOps = {
write: (buf, string, offset, len) => buf.ucs2Write(string, offset, len), write: (buf, string, offset, len) => buf.ucs2Write(string, offset, len),
slice: (buf, start, end) => buf.ucs2Slice(start, end), slice: (buf, start, end) => buf.ucs2Slice(start, end),
indexOf: (buf, val, byteOffset, dir) => indexOf: (buf, val, byteOffset, dir) =>
indexOfString(buf, val, byteOffset, encodingsMap.utf16le, dir) indexOfString(buf, val, byteOffset, encodingsMap.utf16le, dir),
}, },
utf16le: { utf16le: {
encoding: 'utf16le', encoding: 'utf16le',
@ -657,7 +657,7 @@ const encodingOps = {
write: (buf, string, offset, len) => buf.ucs2Write(string, offset, len), write: (buf, string, offset, len) => buf.ucs2Write(string, offset, len),
slice: (buf, start, end) => buf.ucs2Slice(start, end), slice: (buf, start, end) => buf.ucs2Slice(start, end),
indexOf: (buf, val, byteOffset, dir) => indexOf: (buf, val, byteOffset, dir) =>
indexOfString(buf, val, byteOffset, encodingsMap.utf16le, dir) indexOfString(buf, val, byteOffset, encodingsMap.utf16le, dir),
}, },
latin1: { latin1: {
encoding: 'latin1', encoding: 'latin1',
@ -666,7 +666,7 @@ const encodingOps = {
write: (buf, string, offset, len) => buf.latin1Write(string, offset, len), write: (buf, string, offset, len) => buf.latin1Write(string, offset, len),
slice: (buf, start, end) => buf.latin1Slice(start, end), slice: (buf, start, end) => buf.latin1Slice(start, end),
indexOf: (buf, val, byteOffset, dir) => indexOf: (buf, val, byteOffset, dir) =>
indexOfString(buf, val, byteOffset, encodingsMap.latin1, dir) indexOfString(buf, val, byteOffset, encodingsMap.latin1, dir),
}, },
ascii: { ascii: {
encoding: 'ascii', encoding: 'ascii',
@ -679,7 +679,7 @@ const encodingOps = {
fromStringFast(val, encodingOps.ascii), fromStringFast(val, encodingOps.ascii),
byteOffset, byteOffset,
encodingsMap.ascii, encodingsMap.ascii,
dir) dir),
}, },
base64: { base64: {
encoding: 'base64', encoding: 'base64',
@ -692,7 +692,7 @@ const encodingOps = {
fromStringFast(val, encodingOps.base64), fromStringFast(val, encodingOps.base64),
byteOffset, byteOffset,
encodingsMap.base64, encodingsMap.base64,
dir) dir),
}, },
base64url: { base64url: {
encoding: 'base64url', encoding: 'base64url',
@ -706,7 +706,7 @@ const encodingOps = {
fromStringFast(val, encodingOps.base64url), fromStringFast(val, encodingOps.base64url),
byteOffset, byteOffset,
encodingsMap.base64url, encodingsMap.base64url,
dir) dir),
}, },
hex: { hex: {
encoding: 'hex', encoding: 'hex',
@ -719,8 +719,8 @@ const encodingOps = {
fromStringFast(val, encodingOps.hex), fromStringFast(val, encodingOps.hex),
byteOffset, byteOffset,
encodingsMap.hex, encodingsMap.hex,
dir) dir),
} },
}; };
function getEncodingOps(encoding) { function getEncodingOps(encoding) {
encoding += ''; encoding += '';
@ -806,7 +806,7 @@ ObjectDefineProperty(Buffer.prototype, 'parent', {
if (!(this instanceof Buffer)) if (!(this instanceof Buffer))
return undefined; return undefined;
return this.buffer; return this.buffer;
} },
}); });
ObjectDefineProperty(Buffer.prototype, 'offset', { ObjectDefineProperty(Buffer.prototype, 'offset', {
__proto__: null, __proto__: null,
@ -815,7 +815,7 @@ ObjectDefineProperty(Buffer.prototype, 'offset', {
if (!(this instanceof Buffer)) if (!(this instanceof Buffer))
return undefined; return undefined;
return this.byteOffset; return this.byteOffset;
} },
}); });
Buffer.prototype.copy = Buffer.prototype.copy =
@ -902,7 +902,7 @@ Buffer.prototype[customInspectSymbol] = function inspect(recurseTimes, ctx) {
str += StringPrototypeSlice(utilInspect(obj, { str += StringPrototypeSlice(utilInspect(obj, {
...ctx, ...ctx,
breakLength: Infinity, breakLength: Infinity,
compact: true compact: true,
}), 27, -2); }), 27, -2);
} }
} }
@ -1235,7 +1235,7 @@ let transcode;
if (internalBinding('config').hasIntl) { if (internalBinding('config').hasIntl) {
const { const {
icuErrName, icuErrName,
transcode: _transcode transcode: _transcode,
} = internalBinding('icu'); } = internalBinding('icu');
// Transcodes the Buffer from one encoding to another, returning a new // Transcodes the Buffer from one encoding to another, returning a new
@ -1394,15 +1394,15 @@ ObjectDefineProperties(module.exports, {
__proto__: null, __proto__: null,
configurable: false, configurable: false,
enumerable: true, enumerable: true,
value: constants value: constants,
}, },
INSPECT_MAX_BYTES: { INSPECT_MAX_BYTES: {
__proto__: null, __proto__: null,
configurable: true, configurable: true,
enumerable: true, enumerable: true,
get() { return INSPECT_MAX_BYTES; }, get() { return INSPECT_MAX_BYTES; },
set(val) { INSPECT_MAX_BYTES = val; } set(val) { INSPECT_MAX_BYTES = val; },
} },
}); });
defineLazyProperties( defineLazyProperties(

View file

@ -31,7 +31,7 @@ const {
const { const {
assertCrypto, assertCrypto,
deprecate deprecate,
} = require('internal/util'); } = require('internal/util');
assertCrypto(); assertCrypto();
@ -59,15 +59,15 @@ const {
} = require('internal/crypto/random'); } = require('internal/crypto/random');
const { const {
pbkdf2, pbkdf2,
pbkdf2Sync pbkdf2Sync,
} = require('internal/crypto/pbkdf2'); } = require('internal/crypto/pbkdf2');
const { const {
scrypt, scrypt,
scryptSync scryptSync,
} = require('internal/crypto/scrypt'); } = require('internal/crypto/scrypt');
const { const {
hkdf, hkdf,
hkdfSync hkdfSync,
} = require('internal/crypto/hkdf'); } = require('internal/crypto/hkdf');
const { const {
generateKeyPair, generateKeyPair,
@ -85,7 +85,7 @@ const {
DiffieHellman, DiffieHellman,
DiffieHellmanGroup, DiffieHellmanGroup,
ECDH, ECDH,
diffieHellman diffieHellman,
} = require('internal/crypto/diffiehellman'); } = require('internal/crypto/diffiehellman');
const { const {
Cipher, Cipher,
@ -102,14 +102,14 @@ const {
Sign, Sign,
signOneShot, signOneShot,
Verify, Verify,
verifyOneShot verifyOneShot,
} = require('internal/crypto/sig'); } = require('internal/crypto/sig');
const { const {
Hash, Hash,
Hmac Hmac,
} = require('internal/crypto/hash'); } = require('internal/crypto/hash');
const { const {
X509Certificate X509Certificate,
} = require('internal/crypto/x509'); } = require('internal/crypto/x509');
const { const {
getCiphers, getCiphers,
@ -277,7 +277,7 @@ ObjectDefineProperty(constants, 'defaultCipherList', {
writable: true, writable: true,
configurable: true, configurable: true,
enumerable: true, enumerable: true,
value value,
}); });
return value; return value;
}, },
@ -287,7 +287,7 @@ ObjectDefineProperty(constants, 'defaultCipherList', {
writable: true, writable: true,
configurable: true, configurable: true,
enumerable: true, enumerable: true,
value: val value: val,
}); });
}, },
configurable: true, configurable: true,
@ -316,7 +316,7 @@ function getRandomBytesAlias(key) {
enumerable: false, enumerable: false,
configurable: true, configurable: true,
writable: true, writable: true,
value: value value: value,
}, },
); );
return value; return value;
@ -330,10 +330,10 @@ function getRandomBytesAlias(key) {
enumerable: true, enumerable: true,
configurable: true, configurable: true,
writable: true, writable: true,
value value,
}, },
); );
} },
}; };
} }
@ -342,13 +342,13 @@ ObjectDefineProperties(module.exports, {
__proto__: null, __proto__: null,
enumerable: false, enumerable: false,
value: deprecate(createCipher, value: deprecate(createCipher,
'crypto.createCipher is deprecated.', 'DEP0106') 'crypto.createCipher is deprecated.', 'DEP0106'),
}, },
createDecipher: { createDecipher: {
__proto__: null, __proto__: null,
enumerable: false, enumerable: false,
value: deprecate(createDecipher, value: deprecate(createDecipher,
'crypto.createDecipher is deprecated.', 'DEP0106') 'crypto.createDecipher is deprecated.', 'DEP0106'),
}, },
// crypto.fips is deprecated. DEP0093. Use crypto.getFips()/crypto.setFips() // crypto.fips is deprecated. DEP0093. Use crypto.getFips()/crypto.setFips()
fips: { fips: {
@ -363,13 +363,13 @@ ObjectDefineProperties(module.exports, {
get: deprecate(getDefaultEncoding, get: deprecate(getDefaultEncoding,
'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091'), 'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091'),
set: deprecate(setDefaultEncoding, set: deprecate(setDefaultEncoding,
'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091') 'crypto.DEFAULT_ENCODING is deprecated.', 'DEP0091'),
}, },
constants: { constants: {
__proto__: null, __proto__: null,
configurable: false, configurable: false,
enumerable: true, enumerable: true,
value: constants value: constants,
}, },
webcrypto: { webcrypto: {
@ -400,5 +400,5 @@ ObjectDefineProperties(module.exports, {
// The ecosystem needs those to exist for backwards compatibility. // The ecosystem needs those to exist for backwards compatibility.
prng: getRandomBytesAlias('prng'), prng: getRandomBytesAlias('prng'),
pseudoRandomBytes: getRandomBytesAlias('pseudoRandomBytes'), pseudoRandomBytes: getRandomBytesAlias('pseudoRandomBytes'),
rng: getRandomBytesAlias('rng') rng: getRandomBytesAlias('rng'),
}); });

View file

@ -49,7 +49,7 @@ const {
ERR_SOCKET_DGRAM_IS_CONNECTED, ERR_SOCKET_DGRAM_IS_CONNECTED,
ERR_SOCKET_DGRAM_NOT_CONNECTED, ERR_SOCKET_DGRAM_NOT_CONNECTED,
ERR_SOCKET_DGRAM_NOT_RUNNING, ERR_SOCKET_DGRAM_NOT_RUNNING,
ERR_INVALID_FD_TYPE ERR_INVALID_FD_TYPE,
} = errors.codes; } = errors.codes;
const { const {
isInt32, isInt32,
@ -64,14 +64,14 @@ const { isArrayBufferView } = require('internal/util/types');
const EventEmitter = require('events'); const EventEmitter = require('events');
const { const {
defaultTriggerAsyncIdScope, defaultTriggerAsyncIdScope,
symbols: { async_id_symbol, owner_symbol } symbols: { async_id_symbol, owner_symbol },
} = require('internal/async_hooks'); } = require('internal/async_hooks');
const { UV_UDP_REUSEADDR } = internalBinding('constants').os; const { UV_UDP_REUSEADDR } = internalBinding('constants').os;
const { const {
constants: { UV_UDP_IPV6ONLY }, constants: { UV_UDP_IPV6ONLY },
UDP, UDP,
SendWrap SendWrap,
} = internalBinding('udp_wrap'); } = internalBinding('udp_wrap');
const dc = require('diagnostics_channel'); const dc = require('diagnostics_channel');
@ -132,7 +132,7 @@ function Socket(type, listener) {
reuseAddr: options && options.reuseAddr, // Use UV_UDP_REUSEADDR if true. reuseAddr: options && options.reuseAddr, // Use UV_UDP_REUSEADDR if true.
ipv6Only: options && options.ipv6Only, ipv6Only: options && options.ipv6Only,
recvBufferSize, recvBufferSize,
sendBufferSize sendBufferSize,
}; };
if (options?.signal !== undefined) { if (options?.signal !== undefined) {
@ -282,7 +282,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
port: null, port: null,
addressType: this.type, addressType: this.type,
fd, fd,
flags: null flags: null,
}, (err) => { }, (err) => {
// Callback to handle error. // Callback to handle error.
const ex = errnoException(err, 'open'); const ex = errnoException(err, 'open');
@ -346,7 +346,7 @@ Socket.prototype.bind = function(port_, address_ /* , callback */) {
port: port, port: port,
addressType: this.type, addressType: this.type,
fd: -1, fd: -1,
flags: flags flags: flags,
}, (err) => { }, (err) => {
// Callback to handle error. // Callback to handle error.
const ex = exceptionWithHostPort(err, 'bind', ip, port); const ex = exceptionWithHostPort(err, 'bind', ip, port);
@ -995,7 +995,7 @@ ObjectDefineProperty(Socket.prototype, '_handle', {
}, 'Socket.prototype._handle is deprecated', 'DEP0112'), }, 'Socket.prototype._handle is deprecated', 'DEP0112'),
set: deprecate(function(val) { set: deprecate(function(val) {
this[kStateSymbol].handle = val; this[kStateSymbol].handle = val;
}, 'Socket.prototype._handle is deprecated', 'DEP0112') }, 'Socket.prototype._handle is deprecated', 'DEP0112'),
}); });
@ -1006,7 +1006,7 @@ ObjectDefineProperty(Socket.prototype, '_receiving', {
}, 'Socket.prototype._receiving is deprecated', 'DEP0112'), }, 'Socket.prototype._receiving is deprecated', 'DEP0112'),
set: deprecate(function(val) { set: deprecate(function(val) {
this[kStateSymbol].receiving = val; this[kStateSymbol].receiving = val;
}, 'Socket.prototype._receiving is deprecated', 'DEP0112') }, 'Socket.prototype._receiving is deprecated', 'DEP0112'),
}); });
@ -1017,7 +1017,7 @@ ObjectDefineProperty(Socket.prototype, '_bindState', {
}, 'Socket.prototype._bindState is deprecated', 'DEP0112'), }, 'Socket.prototype._bindState is deprecated', 'DEP0112'),
set: deprecate(function(val) { set: deprecate(function(val) {
this[kStateSymbol].bindState = val; this[kStateSymbol].bindState = val;
}, 'Socket.prototype._bindState is deprecated', 'DEP0112') }, 'Socket.prototype._bindState is deprecated', 'DEP0112'),
}); });
@ -1028,7 +1028,7 @@ ObjectDefineProperty(Socket.prototype, '_queue', {
}, 'Socket.prototype._queue is deprecated', 'DEP0112'), }, 'Socket.prototype._queue is deprecated', 'DEP0112'),
set: deprecate(function(val) { set: deprecate(function(val) {
this[kStateSymbol].queue = val; this[kStateSymbol].queue = val;
}, 'Socket.prototype._queue is deprecated', 'DEP0112') }, 'Socket.prototype._queue is deprecated', 'DEP0112'),
}); });
@ -1039,7 +1039,7 @@ ObjectDefineProperty(Socket.prototype, '_reuseAddr', {
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'), }, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'),
set: deprecate(function(val) { set: deprecate(function(val) {
this[kStateSymbol].reuseAddr = val; this[kStateSymbol].reuseAddr = val;
}, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112') }, 'Socket.prototype._reuseAddr is deprecated', 'DEP0112'),
}); });
@ -1058,7 +1058,7 @@ Socket.prototype._stopReceiving = deprecate(function() {
ObjectDefineProperty(UDP.prototype, 'owner', { ObjectDefineProperty(UDP.prototype, 'owner', {
__proto__: null, __proto__: null,
get() { return this[owner_symbol]; }, get() { return this[owner_symbol]; },
set(v) { return this[owner_symbol] = v; } set(v) { return this[owner_symbol] = v; },
}); });
@ -1069,5 +1069,5 @@ module.exports = {
'DEP0112', 'DEP0112',
), ),
createSocket, createSocket,
Socket Socket,
}; };

View file

@ -12,7 +12,7 @@ const {
const { const {
codes: { codes: {
ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_TYPE,
} },
} = require('internal/errors'); } = require('internal/errors');
const { const {
validateFunction, validateFunction,
@ -143,5 +143,5 @@ module.exports = {
hasSubscribers, hasSubscribers,
subscribe, subscribe,
unsubscribe, unsubscribe,
Channel Channel,
}; };

View file

@ -42,7 +42,7 @@ const {
errorCodes: dnsErrorCodes, errorCodes: dnsErrorCodes,
} = require('internal/dns/utils'); } = require('internal/dns/utils');
const { const {
Resolver Resolver,
} = require('internal/dns/callback_resolver'); } = require('internal/dns/callback_resolver');
const { const {
NODATA, NODATA,
@ -123,7 +123,7 @@ function onlookupall(err, addresses) {
const addr = addresses[i]; const addr = addresses[i];
addresses[i] = { addresses[i] = {
address: addr, address: addr,
family: family || isIP(addr) family: family || isIP(addr),
}; };
} }
@ -352,6 +352,6 @@ ObjectDefineProperties(module.exports, {
promises = require('internal/dns/promises'); promises = require('internal/dns/promises');
} }
return promises; return promises;
} },
} },
}); });

View file

@ -47,7 +47,7 @@ const EventEmitter = require('events');
const { const {
ERR_DOMAIN_CALLBACK_NOT_AVAILABLE, ERR_DOMAIN_CALLBACK_NOT_AVAILABLE,
ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE, ERR_DOMAIN_CANNOT_SET_UNCAUGHT_EXCEPTION_CAPTURE,
ERR_UNHANDLED_ERROR ERR_UNHANDLED_ERROR,
} = require('internal/errors').codes; } = require('internal/errors').codes;
const { createHook } = require('async_hooks'); const { createHook } = require('async_hooks');
const { useDomainTrampoline } = require('internal/async_hooks'); const { useDomainTrampoline } = require('internal/async_hooks');
@ -67,7 +67,7 @@ ObjectDefineProperty(process, 'domain', {
}, },
set: function(arg) { set: function(arg) {
return _domain[0] = arg; return _domain[0] = arg;
} },
}); });
const vmPromises = new SafeWeakMap(); const vmPromises = new SafeWeakMap();
@ -85,7 +85,7 @@ const asyncHook = createHook({
configurable: true, configurable: true,
enumerable: false, enumerable: false,
value: process.domain, value: process.domain,
writable: true writable: true,
}); });
// Because promises from other contexts don't get a domain field, // Because promises from other contexts don't get a domain field,
// the domain needs to be held alive another way. Stuffing it in a // the domain needs to be held alive another way. Stuffing it in a
@ -116,7 +116,7 @@ const asyncHook = createHook({
}, },
destroy(asyncId) { destroy(asyncId) {
pairing.delete(asyncId); // cleaning up pairing.delete(asyncId); // cleaning up
} },
}); });
// When domains are in use, they claim full ownership of the // When domains are in use, they claim full ownership of the
@ -244,7 +244,7 @@ Domain.prototype._errorHandler = function(er) {
configurable: true, configurable: true,
enumerable: false, enumerable: false,
value: this, value: this,
writable: true writable: true,
}); });
er.domainThrown = true; er.domainThrown = true;
} }
@ -370,7 +370,7 @@ Domain.prototype.add = function(ee) {
configurable: true, configurable: true,
enumerable: false, enumerable: false,
value: this, value: this,
writable: true writable: true,
}); });
ArrayPrototypePush(this.members, ee); ArrayPrototypePush(this.members, ee);
}; };
@ -403,7 +403,7 @@ function intercepted(_this, self, cb, fnargs) {
configurable: true, configurable: true,
enumerable: false, enumerable: false,
value: self, value: self,
writable: true writable: true,
}); });
self.emit('error', er); self.emit('error', er);
return; return;
@ -449,7 +449,7 @@ Domain.prototype.bind = function(cb) {
configurable: true, configurable: true,
enumerable: false, enumerable: false,
value: this, value: this,
writable: true writable: true,
}); });
return runBound; return runBound;
@ -465,7 +465,7 @@ EventEmitter.init = function(opts) {
configurable: true, configurable: true,
enumerable: false, enumerable: false,
value: null, value: null,
writable: true writable: true,
}); });
if (exports.active && !(this instanceof exports.Domain)) { if (exports.active && !(this instanceof exports.Domain)) {
this.domain = exports.active; this.domain = exports.active;
@ -500,7 +500,7 @@ EventEmitter.prototype.emit = function emit(...args) {
configurable: true, configurable: true,
enumerable: false, enumerable: false,
value: domain, value: domain,
writable: true writable: true,
}); });
er.domainThrown = false; er.domainThrown = false;
} }

View file

@ -35,13 +35,13 @@ const { IncomingMessage } = require('_http_incoming');
const { const {
validateHeaderName, validateHeaderName,
validateHeaderValue, validateHeaderValue,
OutgoingMessage OutgoingMessage,
} = require('_http_outgoing'); } = require('_http_outgoing');
const { const {
_connectionListener, _connectionListener,
STATUS_CODES, STATUS_CODES,
Server, Server,
ServerResponse ServerResponse,
} = require('_http_server'); } = require('_http_server');
let maxHeaderSize; let maxHeaderSize;
@ -130,7 +130,7 @@ module.exports = {
setMaxIdleHTTPParsers(max) { setMaxIdleHTTPParsers(max) {
validateInteger(max, 'max', 1); validateInteger(max, 'max', 1);
parsers.max = max; parsers.max = max;
} },
}; };
ObjectDefineProperty(module.exports, 'maxHeaderSize', { ObjectDefineProperty(module.exports, 'maxHeaderSize', {
@ -144,7 +144,7 @@ ObjectDefineProperty(module.exports, 'maxHeaderSize', {
} }
return maxHeaderSize; return maxHeaderSize;
} },
}); });
ObjectDefineProperty(module.exports, 'globalAgent', { ObjectDefineProperty(module.exports, 'globalAgent', {
@ -156,5 +156,5 @@ ObjectDefineProperty(module.exports, 'globalAgent', {
}, },
set(value) { set(value) {
httpAgent.globalAgent = value; httpAgent.globalAgent = value;
} },
}); });

View file

@ -10,7 +10,7 @@ const {
getUnpackedSettings, getUnpackedSettings,
sensitiveHeaders, sensitiveHeaders,
Http2ServerRequest, Http2ServerRequest,
Http2ServerResponse Http2ServerResponse,
} = require('internal/http2/core'); } = require('internal/http2/core');
module.exports = { module.exports = {
@ -23,5 +23,5 @@ module.exports = {
getUnpackedSettings, getUnpackedSettings,
sensitiveHeaders, sensitiveHeaders,
Http2ServerRequest, Http2ServerRequest,
Http2ServerResponse Http2ServerResponse,
}; };

View file

@ -148,7 +148,7 @@ function createConnection(port, host, options) {
debug('reuse session for %j', options._agentKey); debug('reuse session for %j', options._agentKey);
options = { options = {
session, session,
...options ...options,
}; };
} }
} }
@ -199,7 +199,7 @@ function Agent(options) {
this._sessionCache = { this._sessionCache = {
map: {}, map: {},
list: [] list: [],
}; };
} }
ObjectSetPrototypeOf(Agent.prototype, HttpAgent.prototype); ObjectSetPrototypeOf(Agent.prototype, HttpAgent.prototype);
@ -408,5 +408,5 @@ module.exports = {
Server, Server,
createServer, createServer,
get, get,
request request,
}; };

View file

@ -200,5 +200,5 @@ module.exports = {
url, url,
waitForDebugger: inspectorWaitForDebugger, waitForDebugger: inspectorWaitForDebugger,
console, console,
Session Session,
}; };

View file

@ -47,14 +47,14 @@ const {
isIPv4, isIPv4,
isIPv6, isIPv6,
normalizedArgsSymbol, normalizedArgsSymbol,
makeSyncWrite makeSyncWrite,
} = require('internal/net'); } = require('internal/net');
const assert = require('internal/assert'); const assert = require('internal/assert');
const { const {
UV_EADDRINUSE, UV_EADDRINUSE,
UV_EINVAL, UV_EINVAL,
UV_ENOTCONN, UV_ENOTCONN,
UV_ECANCELED UV_ECANCELED,
} = internalBinding('uv'); } = internalBinding('uv');
const { Buffer } = require('buffer'); const { Buffer } = require('buffer');
@ -63,17 +63,17 @@ const { ShutdownWrap } = internalBinding('stream_wrap');
const { const {
TCP, TCP,
TCPConnectWrap, TCPConnectWrap,
constants: TCPConstants constants: TCPConstants,
} = internalBinding('tcp_wrap'); } = internalBinding('tcp_wrap');
const { const {
Pipe, Pipe,
PipeConnectWrap, PipeConnectWrap,
constants: PipeConstants constants: PipeConstants,
} = internalBinding('pipe_wrap'); } = internalBinding('pipe_wrap');
const { const {
newAsyncId, newAsyncId,
defaultTriggerAsyncIdScope, defaultTriggerAsyncIdScope,
symbols: { async_id_symbol, owner_symbol } symbols: { async_id_symbol, owner_symbol },
} = require('internal/async_hooks'); } = require('internal/async_hooks');
const { const {
writevGeneric, writevGeneric,
@ -85,7 +85,7 @@ const {
setStreamTimeout, setStreamTimeout,
kBuffer, kBuffer,
kBufferCb, kBufferCb,
kBufferGen kBufferGen,
} = require('internal/stream_base_commons'); } = require('internal/stream_base_commons');
const { const {
codes: { codes: {
@ -117,7 +117,7 @@ const {
validateInt32, validateInt32,
validateNumber, validateNumber,
validatePort, validatePort,
validateString validateString,
} = require('internal/validators'); } = require('internal/validators');
const kLastWriteQueueSize = Symbol('lastWriteQueueSize'); const kLastWriteQueueSize = Symbol('lastWriteQueueSize');
const { getOptionValue } = require('internal/options'); const { getOptionValue } = require('internal/options');
@ -438,7 +438,7 @@ function Socket(options) {
// property. // property.
ObjectDefineProperty(this._handle, 'bytesWritten', { ObjectDefineProperty(this._handle, 'bytesWritten', {
__proto__: null, __proto__: null,
value: 0, writable: true value: 0, writable: true,
}); });
} }
} }
@ -637,7 +637,7 @@ ObjectDefineProperty(Socket.prototype, '_connecting', {
__proto__: null, __proto__: null,
get: function() { get: function() {
return this.connecting; return this.connecting;
} },
}); });
ObjectDefineProperty(Socket.prototype, 'pending', { ObjectDefineProperty(Socket.prototype, 'pending', {
@ -645,7 +645,7 @@ ObjectDefineProperty(Socket.prototype, 'pending', {
get() { get() {
return !this._handle || this.connecting; return !this._handle || this.connecting;
}, },
configurable: true configurable: true,
}); });
@ -662,7 +662,7 @@ ObjectDefineProperty(Socket.prototype, 'readyState', {
return 'writeOnly'; return 'writeOnly';
} }
return 'closed'; return 'closed';
} },
}); });
@ -672,14 +672,14 @@ ObjectDefineProperty(Socket.prototype, 'bufferSize', {
if (this._handle) { if (this._handle) {
return this.writableLength; return this.writableLength;
} }
} },
}); });
ObjectDefineProperty(Socket.prototype, kUpdateTimer, { ObjectDefineProperty(Socket.prototype, kUpdateTimer, {
__proto__: null, __proto__: null,
get: function() { get: function() {
return this._unrefTimer; return this._unrefTimer;
} },
}); });
@ -859,7 +859,7 @@ function protoGetter(name, callback) {
__proto__: null, __proto__: null,
configurable: false, configurable: false,
enumerable: true, enumerable: true,
get: callback get: callback,
}); });
} }
@ -1294,7 +1294,7 @@ function lookupAndConnect(self, options) {
if (dns === undefined) dns = require('dns'); if (dns === undefined) dns = require('dns');
const dnsopts = { const dnsopts = {
family: socketToDnsFamily(options.family), family: socketToDnsFamily(options.family),
hints: options.hints || 0 hints: options.hints || 0,
}; };
if (!isWindows && if (!isWindows &&
@ -1980,7 +1980,7 @@ ObjectDefineProperty(Server.prototype, 'listening', {
return !!this._handle; return !!this._handle;
}, },
configurable: true, configurable: true,
enumerable: true enumerable: true,
}); });
Server.prototype.address = function() { Server.prototype.address = function() {
@ -2038,7 +2038,7 @@ function onconnection(err, clientHandle) {
allowHalfOpen: self.allowHalfOpen, allowHalfOpen: self.allowHalfOpen,
pauseOnCreate: self.pauseOnConnect, pauseOnCreate: self.pauseOnConnect,
readable: true, readable: true,
writable: true writable: true,
}); });
if (self.noDelay && clientHandle.setNoDelay) { if (self.noDelay && clientHandle.setNoDelay) {
@ -2185,13 +2185,13 @@ Server.prototype[EventEmitter.captureRejectionSymbol] = function(
ObjectDefineProperty(TCP.prototype, 'owner', { ObjectDefineProperty(TCP.prototype, 'owner', {
__proto__: null, __proto__: null,
get() { return this[owner_symbol]; }, get() { return this[owner_symbol]; },
set(v) { return this[owner_symbol] = v; } set(v) { return this[owner_symbol] = v; },
}); });
ObjectDefineProperty(Socket.prototype, '_handle', { ObjectDefineProperty(Socket.prototype, '_handle', {
__proto__: null, __proto__: null,
get() { return this[kHandle]; }, get() { return this[kHandle]; },
set(v) { return this[kHandle] = v; } set(v) { return this[kHandle] = v; },
}); });
Server.prototype._setupWorker = function(socketList) { Server.prototype._setupWorker = function(socketList) {

View file

@ -37,9 +37,9 @@ const isWindows = process.platform === 'win32';
const { const {
codes: { codes: {
ERR_SYSTEM_ERROR ERR_SYSTEM_ERROR,
}, },
hideStackFrames hideStackFrames,
} = require('internal/errors'); } = require('internal/errors');
const { validateInt32 } = require('internal/validators'); const { validateInt32 } = require('internal/validators');
@ -57,7 +57,7 @@ const {
getUserInfo, getUserInfo,
getUptime: _getUptime, getUptime: _getUptime,
isBigEndian, isBigEndian,
setPriority: _setPriority setPriority: _setPriority,
} = internalBinding('os'); } = internalBinding('os');
function getCheckedFunction(fn) { function getCheckedFunction(fn) {
@ -153,8 +153,8 @@ function cpus() {
nice: data[i++], nice: data[i++],
sys: data[i++], sys: data[i++],
idle: data[i++], idle: data[i++],
irq: data[i++] irq: data[i++],
} },
}); });
} }
return result; return result;
@ -288,7 +288,7 @@ function networkInterfaces() {
family: data[i + 3], family: data[i + 3],
mac: data[i + 4], mac: data[i + 4],
internal: data[i + 5], internal: data[i + 5],
cidr: getCIDR(data[i + 1], data[i + 2], data[i + 3]) cidr: getCIDR(data[i + 1], data[i + 2], data[i + 3]),
}; };
const scopeid = data[i + 6]; const scopeid = data[i + 6];
if (scopeid !== -1) if (scopeid !== -1)
@ -401,7 +401,7 @@ ObjectDefineProperties(module.exports, {
__proto__: null, __proto__: null,
configurable: false, configurable: false,
enumerable: true, enumerable: true,
value: constants value: constants,
}, },
EOL: { EOL: {
@ -409,7 +409,7 @@ ObjectDefineProperties(module.exports, {
configurable: true, configurable: true,
enumerable: true, enumerable: true,
writable: false, writable: false,
value: isWindows ? '\r\n' : '\n' value: isWindows ? '\r\n' : '\n',
}, },
devNull: { devNull: {
@ -417,6 +417,6 @@ ObjectDefineProperties(module.exports, {
configurable: true, configurable: true,
enumerable: true, enumerable: true,
writable: false, writable: false,
value: isWindows ? '\\\\.\\nul' : '/dev/null' value: isWindows ? '\\\\.\\nul' : '/dev/null',
} },
}); });

View file

@ -1068,7 +1068,7 @@ const win32 = {
sep: '\\', sep: '\\',
delimiter: ';', delimiter: ';',
win32: null, win32: null,
posix: null posix: null,
}; };
const posixCwd = (() => { const posixCwd = (() => {
@ -1534,7 +1534,7 @@ const posix = {
sep: '/', sep: '/',
delimiter: ':', delimiter: ':',
win32: null, win32: null,
posix: null posix: null,
}; };
posix.win32 = win32.win32 = win32; posix.win32 = win32.win32 = win32;

View file

@ -24,7 +24,7 @@ const {
} = require('internal/perf/performance'); } = require('internal/perf/performance');
const { const {
createHistogram createHistogram,
} = require('internal/histogram'); } = require('internal/histogram');
const monitorEventLoopDelay = require('internal/perf/event_loop_delay'); const monitorEventLoopDelay = require('internal/perf/event_loop_delay');
@ -46,5 +46,5 @@ ObjectDefineProperty(module.exports, 'constants', {
__proto__: null, __proto__: null,
configurable: false, configurable: false,
enumerable: true, enumerable: true,
value: constants value: constants,
}); });

View file

@ -40,7 +40,7 @@ const { Buffer } = require('buffer');
const { const {
encodeStr, encodeStr,
hexTable, hexTable,
isHexTable isHexTable,
} = require('internal/querystring'); } = require('internal/querystring');
const QueryString = module.exports = { const QueryString = module.exports = {
unescapeBuffer, unescapeBuffer,
@ -54,7 +54,7 @@ const QueryString = module.exports = {
encode: stringify, encode: stringify,
parse, parse,
decode: parse decode: parse,
}; };
const unhexTable = new Int8Array([ const unhexTable = new Int8Array([

View file

@ -218,133 +218,133 @@ ObjectDefineProperties(Interface.prototype, {
__proto__: null, __proto__: null,
get() { get() {
return this._setRawMode; return this._setRawMode;
} },
}, },
[kOnLine]: { [kOnLine]: {
__proto__: null, __proto__: null,
get() { get() {
return this._onLine; return this._onLine;
} },
}, },
[kWriteToOutput]: { [kWriteToOutput]: {
__proto__: null, __proto__: null,
get() { get() {
return this._writeToOutput; return this._writeToOutput;
} },
}, },
[kAddHistory]: { [kAddHistory]: {
__proto__: null, __proto__: null,
get() { get() {
return this._addHistory; return this._addHistory;
} },
}, },
[kRefreshLine]: { [kRefreshLine]: {
__proto__: null, __proto__: null,
get() { get() {
return this._refreshLine; return this._refreshLine;
} },
}, },
[kNormalWrite]: { [kNormalWrite]: {
__proto__: null, __proto__: null,
get() { get() {
return this._normalWrite; return this._normalWrite;
} },
}, },
[kInsertString]: { [kInsertString]: {
__proto__: null, __proto__: null,
get() { get() {
return this._insertString; return this._insertString;
} },
}, },
[kTabComplete]: { [kTabComplete]: {
__proto__: null, __proto__: null,
get() { get() {
return this._tabComplete; return this._tabComplete;
} },
}, },
[kWordLeft]: { [kWordLeft]: {
__proto__: null, __proto__: null,
get() { get() {
return this._wordLeft; return this._wordLeft;
} },
}, },
[kWordRight]: { [kWordRight]: {
__proto__: null, __proto__: null,
get() { get() {
return this._wordRight; return this._wordRight;
} },
}, },
[kDeleteLeft]: { [kDeleteLeft]: {
__proto__: null, __proto__: null,
get() { get() {
return this._deleteLeft; return this._deleteLeft;
} },
}, },
[kDeleteRight]: { [kDeleteRight]: {
__proto__: null, __proto__: null,
get() { get() {
return this._deleteRight; return this._deleteRight;
} },
}, },
[kDeleteWordLeft]: { [kDeleteWordLeft]: {
__proto__: null, __proto__: null,
get() { get() {
return this._deleteWordLeft; return this._deleteWordLeft;
} },
}, },
[kDeleteWordRight]: { [kDeleteWordRight]: {
__proto__: null, __proto__: null,
get() { get() {
return this._deleteWordRight; return this._deleteWordRight;
} },
}, },
[kDeleteLineLeft]: { [kDeleteLineLeft]: {
__proto__: null, __proto__: null,
get() { get() {
return this._deleteLineLeft; return this._deleteLineLeft;
} },
}, },
[kDeleteLineRight]: { [kDeleteLineRight]: {
__proto__: null, __proto__: null,
get() { get() {
return this._deleteLineRight; return this._deleteLineRight;
} },
}, },
[kLine]: { [kLine]: {
__proto__: null, __proto__: null,
get() { get() {
return this._line; return this._line;
} },
}, },
[kHistoryNext]: { [kHistoryNext]: {
__proto__: null, __proto__: null,
get() { get() {
return this._historyNext; return this._historyNext;
} },
}, },
[kHistoryPrev]: { [kHistoryPrev]: {
__proto__: null, __proto__: null,
get() { get() {
return this._historyPrev; return this._historyPrev;
} },
}, },
[kGetDisplayPos]: { [kGetDisplayPos]: {
__proto__: null, __proto__: null,
get() { get() {
return this._getDisplayPos; return this._getDisplayPos;
} },
}, },
[kMoveCursor]: { [kMoveCursor]: {
__proto__: null, __proto__: null,
get() { get() {
return this._moveCursor; return this._moveCursor;
} },
}, },
[kTtyWrite]: { [kTtyWrite]: {
__proto__: null, __proto__: null,
get() { get() {
return this._ttyWrite; return this._ttyWrite;
} },
}, },
// Defining proxies for the internal instance properties for backward // Defining proxies for the internal instance properties for backward

View file

@ -108,7 +108,7 @@ ObjectDefineProperty(Stream, 'promises', {
enumerable: true, enumerable: true,
get() { get() {
return promises; return promises;
} },
}); });
ObjectDefineProperty(pipeline, customPromisify, { ObjectDefineProperty(pipeline, customPromisify, {
@ -116,7 +116,7 @@ ObjectDefineProperty(pipeline, customPromisify, {
enumerable: true, enumerable: true,
get() { get() {
return promises.pipeline; return promises.pipeline;
} },
}); });
ObjectDefineProperty(eos, customPromisify, { ObjectDefineProperty(eos, customPromisify, {
@ -124,7 +124,7 @@ ObjectDefineProperty(eos, customPromisify, {
enumerable: true, enumerable: true,
get() { get() {
return promises.finished; return promises.finished;
} },
}); });
// Backwards-compat with node 0.4.x // Backwards-compat with node 0.4.x

View file

@ -38,13 +38,13 @@ const {
kSize, kSize,
decode, decode,
flush, flush,
encodings encodings,
} = internalBinding('string_decoder'); } = internalBinding('string_decoder');
const internalUtil = require('internal/util'); const internalUtil = require('internal/util');
const { const {
ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_TYPE,
ERR_INVALID_THIS, ERR_INVALID_THIS,
ERR_UNKNOWN_ENCODING ERR_UNKNOWN_ENCODING,
} = require('internal/errors').codes; } = require('internal/errors').codes;
const isEncoding = Buffer[internalUtil.kIsEncodingSymbol]; const isEncoding = Buffer[internalUtil.kIsEncodingSymbol];
@ -147,7 +147,7 @@ ObjectDefineProperties(StringDecoder.prototype, {
return TypedArrayPrototypeSubarray(this[kNativeDecoder], return TypedArrayPrototypeSubarray(this[kNativeDecoder],
kIncompleteCharactersStart, kIncompleteCharactersStart,
kIncompleteCharactersEnd); kIncompleteCharactersEnd);
} },
}, },
lastNeed: { lastNeed: {
__proto__: null, __proto__: null,
@ -155,7 +155,7 @@ ObjectDefineProperties(StringDecoder.prototype, {
enumerable: true, enumerable: true,
get() { get() {
return this[kNativeDecoder][kMissingBytes]; return this[kNativeDecoder][kMissingBytes];
} },
}, },
lastTotal: { lastTotal: {
__proto__: null, __proto__: null,
@ -164,8 +164,8 @@ ObjectDefineProperties(StringDecoder.prototype, {
get() { get() {
return this[kNativeDecoder][kBufferedBytes] + return this[kNativeDecoder][kBufferedBytes] +
this[kNativeDecoder][kMissingBytes]; this[kNativeDecoder][kMissingBytes];
} },
} },
}); });
exports.StringDecoder = StringDecoder; exports.StringDecoder = StringDecoder;

View file

@ -24,7 +24,7 @@
const { const {
MathTrunc, MathTrunc,
ObjectDefineProperty, ObjectDefineProperty,
SymbolToPrimitive SymbolToPrimitive,
} = primordials; } = primordials;
const binding = internalBinding('timers'); const binding = internalBinding('timers');
@ -39,7 +39,7 @@ const {
decRefCount, decRefCount,
immediateInfoFields: { immediateInfoFields: {
kCount, kCount,
kRefCount kRefCount,
}, },
kRefed, kRefed,
kHasPrimitive, kHasPrimitive,
@ -49,11 +49,11 @@ const {
immediateQueue, immediateQueue,
active, active,
unrefActive, unrefActive,
insert insert,
} = require('internal/timers'); } = require('internal/timers');
const { const {
promisify: { custom: customPromisify }, promisify: { custom: customPromisify },
deprecate deprecate,
} = require('internal/util'); } = require('internal/util');
let debug = require('internal/util/debuglog').debuglog('timer', (fn) => { let debug = require('internal/util/debuglog').debuglog('timer', (fn) => {
debug = fn; debug = fn;
@ -65,7 +65,7 @@ let timersPromises;
const { const {
destroyHooksExist, destroyHooksExist,
// The needed emit*() functions. // The needed emit*() functions.
emitDestroy emitDestroy,
} = require('internal/async_hooks'); } = require('internal/async_hooks');
// This stores all the known timer async ids to allow users to clearTimeout and // This stores all the known timer async ids to allow users to clearTimeout and
@ -173,7 +173,7 @@ ObjectDefineProperty(setTimeout, customPromisify, {
if (!timersPromises) if (!timersPromises)
timersPromises = require('timers/promises'); timersPromises = require('timers/promises');
return timersPromises.setTimeout; return timersPromises.setTimeout;
} },
}); });
/** /**
@ -308,7 +308,7 @@ ObjectDefineProperty(setImmediate, customPromisify, {
if (!timersPromises) if (!timersPromises)
timersPromises = require('timers/promises'); timersPromises = require('timers/promises');
return timersPromises.setImmediate; return timersPromises.setImmediate;
} },
}); });
/** /**
@ -361,5 +361,5 @@ module.exports = {
enroll: deprecate( enroll: deprecate(
enroll, enroll,
'timers.enroll() is deprecated. Please use setTimeout instead.', 'timers.enroll() is deprecated. Please use setTimeout instead.',
'DEP0095') 'DEP0095'),
}; };

View file

@ -75,7 +75,7 @@ class Tracing {
const obj = { const obj = {
enabled: this.enabled, enabled: this.enabled,
categories: this.categories categories: this.categories,
}; };
return `Tracing ${format(obj)}`; return `Tracing ${format(obj)}`;
} }
@ -93,5 +93,5 @@ function createTracing(options) {
module.exports = { module.exports = {
createTracing, createTracing,
getEnabledCategories getEnabledCategories,
}; };

View file

@ -33,7 +33,7 @@ const errors = require('internal/errors');
const { ERR_INVALID_FD, ERR_TTY_INIT_FAILED } = errors.codes; const { ERR_INVALID_FD, ERR_TTY_INIT_FAILED } = errors.codes;
const { const {
getColorDepth, getColorDepth,
hasColors hasColors,
} = require('internal/tty'); } = require('internal/tty');
// Lazy loaded for startup performance. // Lazy loaded for startup performance.
@ -60,7 +60,7 @@ function ReadStream(fd, options) {
readableHighWaterMark: 0, readableHighWaterMark: 0,
handle: tty, handle: tty,
manualStart: true, manualStart: true,
...options ...options,
}); });
this.isRaw = false; this.isRaw = false;
@ -96,7 +96,7 @@ function WriteStream(fd) {
net.Socket.call(this, { net.Socket.call(this, {
readableHighWaterMark: 0, readableHighWaterMark: 0,
handle: tty, handle: tty,
manualStart: true manualStart: true,
}); });
// Prevents interleaved or dropped stdout/stderr output for terminals. // Prevents interleaved or dropped stdout/stderr output for terminals.

View file

@ -49,11 +49,11 @@ const {
codes: { codes: {
ERR_FALSY_VALUE_REJECTION, ERR_FALSY_VALUE_REJECTION,
ERR_INVALID_ARG_TYPE, ERR_INVALID_ARG_TYPE,
ERR_OUT_OF_RANGE ERR_OUT_OF_RANGE,
}, },
errnoException, errnoException,
exceptionWithHostPort, exceptionWithHostPort,
hideStackFrames hideStackFrames,
} = require('internal/errors'); } = require('internal/errors');
const { const {
format, format,
@ -254,7 +254,7 @@ function inherits(ctor, superCtor) {
__proto__: null, __proto__: null,
value: superCtor, value: superCtor,
writable: true, writable: true,
configurable: true configurable: true,
}); });
ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype); ObjectSetPrototypeOf(ctor.prototype, superCtor.prototype);
} }
@ -396,7 +396,7 @@ module.exports = {
get aborted() { get aborted() {
return lazyAbortController().aborted; return lazyAbortController().aborted;
}, },
types types,
}; };
defineLazyProperties( defineLazyProperties(

View file

@ -36,10 +36,10 @@ const { Buffer } = require('buffer');
const { validateString, validateUint32 } = require('internal/validators'); const { validateString, validateUint32 } = require('internal/validators');
const { const {
Serializer, Serializer,
Deserializer Deserializer,
} = internalBinding('serdes'); } = internalBinding('serdes');
const { const {
namespace: startupSnapshot namespace: startupSnapshot,
} = require('internal/v8/startup_snapshot'); } = require('internal/v8/startup_snapshot');
let profiler = {}; let profiler = {};
@ -55,11 +55,11 @@ const { getValidatedPath } = require('internal/fs/utils');
const { toNamespacedPath } = require('path'); const { toNamespacedPath } = require('path');
const { const {
createHeapSnapshotStream, createHeapSnapshotStream,
triggerHeapSnapshot triggerHeapSnapshot,
} = internalBinding('heap_utils'); } = internalBinding('heap_utils');
const { const {
HeapSnapshotStream, HeapSnapshotStream,
getHeapSnapshotOptions getHeapSnapshotOptions,
} = require('internal/heap_utils'); } = require('internal/heap_utils');
const promiseHooks = require('internal/promise_hooks'); const promiseHooks = require('internal/promise_hooks');
const { getOptionValue } = require('internal/options'); const { getOptionValue } = require('internal/options');
@ -188,7 +188,7 @@ function getHeapStatistics() {
number_of_detached_contexts: buffer[kNumberOfDetachedContextsIndex], number_of_detached_contexts: buffer[kNumberOfDetachedContextsIndex],
total_global_handles_size: buffer[kTotalGlobalHandlesSizeIndex], total_global_handles_size: buffer[kTotalGlobalHandlesSizeIndex],
used_global_handles_size: buffer[kUsedGlobalHandlesSizeIndex], used_global_handles_size: buffer[kUsedGlobalHandlesSizeIndex],
external_memory: buffer[kExternalMemoryIndex] external_memory: buffer[kExternalMemoryIndex],
}; };
} }
@ -213,7 +213,7 @@ function getHeapSpaceStatistics() {
space_size: buffer[kSpaceSizeIndex], space_size: buffer[kSpaceSizeIndex],
space_used_size: buffer[kSpaceUsedSizeIndex], space_used_size: buffer[kSpaceUsedSizeIndex],
space_available_size: buffer[kSpaceAvailableSizeIndex], space_available_size: buffer[kSpaceAvailableSizeIndex],
physical_space_size: buffer[kPhysicalSpaceSizeIndex] physical_space_size: buffer[kPhysicalSpaceSizeIndex],
}; };
} }

View file

@ -218,7 +218,7 @@ function createContext(contextObject = {}, options = kEmptyObject) {
name = `VM Context ${defaultContextNameIndex++}`, name = `VM Context ${defaultContextNameIndex++}`,
origin, origin,
codeGeneration, codeGeneration,
microtaskMode microtaskMode,
} = options; } = options;
validateString(name, 'options.name'); validateString(name, 'options.name');
@ -275,7 +275,7 @@ function runInContext(code, contextifiedObject, options) {
if (typeof options === 'string') { if (typeof options === 'string') {
options = { options = {
filename: options, filename: options,
[kParsingContext]: contextifiedObject [kParsingContext]: contextifiedObject,
}; };
} else { } else {
options = { ...options, [kParsingContext]: contextifiedObject }; options = { ...options, [kParsingContext]: contextifiedObject };

View file

@ -11,7 +11,7 @@ const {
const { const {
ERR_INVALID_ARG_VALUE, ERR_INVALID_ARG_VALUE,
ERR_WASI_ALREADY_STARTED ERR_WASI_ALREADY_STARTED,
} = require('internal/errors').codes; } = require('internal/errors').codes;
const { const {
emitExperimentalWarning, emitExperimentalWarning,

View file

@ -7,7 +7,7 @@ const {
setEnvironmentData, setEnvironmentData,
getEnvironmentData, getEnvironmentData,
threadId, threadId,
Worker Worker,
} = require('internal/worker'); } = require('internal/worker');
const { const {

View file

@ -55,7 +55,7 @@ const {
} = require('internal/errors'); } = require('internal/errors');
const { Transform, finished } = require('stream'); const { Transform, finished } = require('stream');
const { const {
deprecate deprecate,
} = require('internal/util'); } = require('internal/util');
const { const {
isArrayBufferView, isArrayBufferView,
@ -66,7 +66,7 @@ const binding = internalBinding('zlib');
const assert = require('internal/assert'); const assert = require('internal/assert');
const { const {
Buffer, Buffer,
kMaxLength kMaxLength,
} = require('buffer'); } = require('buffer');
const { owner_symbol } = require('internal/async_hooks').symbols; const { owner_symbol } = require('internal/async_hooks').symbols;
const { const {
@ -103,7 +103,7 @@ const codes = {
Z_DATA_ERROR: constants.Z_DATA_ERROR, Z_DATA_ERROR: constants.Z_DATA_ERROR,
Z_MEM_ERROR: constants.Z_MEM_ERROR, Z_MEM_ERROR: constants.Z_MEM_ERROR,
Z_BUF_ERROR: constants.Z_BUF_ERROR, Z_BUF_ERROR: constants.Z_BUF_ERROR,
Z_VERSION_ERROR: constants.Z_VERSION_ERROR Z_VERSION_ERROR: constants.Z_VERSION_ERROR,
}; };
for (const ckey of ObjectKeys(codes)) { for (const ckey of ObjectKeys(codes)) {
@ -313,7 +313,7 @@ ObjectDefineProperty(ZlibBase.prototype, '_closed', {
enumerable: true, enumerable: true,
get() { get() {
return !this._handle; return !this._handle;
} },
}); });
// `bytesRead` made sense as a name when looking from the zlib engine's // `bytesRead` made sense as a name when looking from the zlib engine's
@ -331,7 +331,7 @@ ObjectDefineProperty(ZlibBase.prototype, 'bytesRead', {
set: deprecate(function(value) { set: deprecate(function(value) {
this.bytesWritten = value; this.bytesWritten = value;
}, 'Setting zlib.bytesRead is deprecated. ' + }, 'Setting zlib.bytesRead is deprecated. ' +
'This feature will be removed in the future.', 'DEP0108') 'This feature will be removed in the future.', 'DEP0108'),
}); });
ZlibBase.prototype.reset = function() { ZlibBase.prototype.reset = function() {
@ -625,7 +625,7 @@ function _close(engine) {
const zlibDefaultOpts = { const zlibDefaultOpts = {
flush: Z_NO_FLUSH, flush: Z_NO_FLUSH,
finishFlush: Z_FINISH, finishFlush: Z_FINISH,
fullFlush: Z_FULL_FLUSH fullFlush: Z_FULL_FLUSH,
}; };
// Base class for all streams actually backed by zlib and using zlib-specific // Base class for all streams actually backed by zlib and using zlib-specific
// parameters. // parameters.
@ -813,7 +813,7 @@ const brotliInitParamsArray = new Uint32Array(kMaxBrotliParam + 1);
const brotliDefaultOpts = { const brotliDefaultOpts = {
flush: BROTLI_OPERATION_PROCESS, flush: BROTLI_OPERATION_PROCESS,
finishFlush: BROTLI_OPERATION_FINISH, finishFlush: BROTLI_OPERATION_FINISH,
fullFlush: BROTLI_OPERATION_FLUSH fullFlush: BROTLI_OPERATION_FLUSH,
}; };
function Brotli(opts, mode) { function Brotli(opts, mode) {
assert(mode === BROTLI_DECODE || mode === BROTLI_ENCODE); assert(mode === BROTLI_DECODE || mode === BROTLI_ENCODE);
@ -878,7 +878,7 @@ function createProperty(ctor) {
enumerable: true, enumerable: true,
value: function(options) { value: function(options) {
return new ctor(options); return new ctor(options);
} },
}; };
} }
@ -887,7 +887,7 @@ function createProperty(ctor) {
ObjectDefineProperty(binding.Zlib.prototype, 'jsref', { ObjectDefineProperty(binding.Zlib.prototype, 'jsref', {
__proto__: null, __proto__: null,
get() { return this[owner_symbol]; }, get() { return this[owner_symbol]; },
set(v) { return this[owner_symbol] = v; } set(v) { return this[owner_symbol] = v; },
}); });
module.exports = { module.exports = {
@ -937,14 +937,14 @@ ObjectDefineProperties(module.exports, {
__proto__: null, __proto__: null,
configurable: false, configurable: false,
enumerable: true, enumerable: true,
value: constants value: constants,
}, },
codes: { codes: {
__proto__: null, __proto__: null,
enumerable: true, enumerable: true,
writable: false, writable: false,
value: ObjectFreeze(codes) value: ObjectFreeze(codes),
} },
}); });
// These should be considered deprecated // These should be considered deprecated
@ -953,6 +953,6 @@ for (const bkey of ObjectKeys(constants)) {
if (StringPrototypeStartsWith(bkey, 'BROTLI')) continue; if (StringPrototypeStartsWith(bkey, 'BROTLI')) continue;
ObjectDefineProperty(module.exports, bkey, { ObjectDefineProperty(module.exports, bkey, {
__proto__: null, __proto__: null,
enumerable: false, value: constants[bkey], writable: false enumerable: false, value: constants[bkey], writable: false,
}); });
} }