lib: enforce use of trailing commas

PR-URL: https://github.com/nodejs/node/pull/46881
Reviewed-By: Debadree Chatterjee <debadree333@gmail.com>
Reviewed-By: Moshe Atlow <moshe@atlow.co.il>
Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com>
Reviewed-By: Jacob Smith <jacob@frende.me>
This commit is contained in:
Antoine du Hamel committed 2023-03-06 10:44:14 +01:00
1 parent 57909654a9
commit ab8942848b
65 files changed
+246 -280

No files matched your search

-34
View File
@@ -2,13 +2,6 @@ env:
es6: true
rules:
comma-dangle: [error, {
arrays: always-multiline,
exports: always-multiline,
functions: always-multiline,
imports: always-multiline,
objects: only-multiline,
}]
prefer-object-spread: error
no-buffer-constructor: error
no-mixed-operators:
@@ -261,30 +254,3 @@ globals:
module: false
internalBinding: false
primordials: false
overrides:
- files:
- ./*/*.js
- ./*.js
- ./internal/child_process/*.js
- ./internal/cluster/*.js
- ./internal/debugger/*.js
- ./internal/events/*.js
- ./internal/fs/*.js
- ./internal/modules/*.js
- ./internal/per_context/*.js
- ./internal/perf/*.js
- ./internal/policy/*.js
- ./internal/process/*.js
- ./internal/readline/*.js
- ./internal/readme.md
- ./internal/repl/*.js
- ./internal/source_map/*.js
- ./internal/streams/*.js
- ./internal/test/*.js
- ./internal/test_runner/**/*.js
- ./internal/tls/*.js
- ./internal/util/parse_args/*.js
- ./internal/watch_mode/*.js
- ./internal/webstreams/*.js
rules:
comma-dangle: [error, always-multiline]
+5 -5
View File
@@ -38,7 +38,7 @@ const kReadableOperator = {
'Expected "actual" not to be reference-equal to "expected":',
notDeepEqual: 'Expected "actual" not to be loosely deep-equal to:',
notIdentical: 'Values have same structure but are not reference-equal:',
notDeepEqualUnequal: 'Expected values not to be loosely deep-equal:'
notDeepEqualUnequal: 'Expected values not to be loosely deep-equal:',
};
// Comparing short primitives should just show === / !== instead of using the
@@ -330,11 +330,11 @@ class AssertionError extends Error {
stackStartFn,
details,
// Compatibility with older versions.
stackStartFunction
stackStartFunction,
} = options;
let {
actual,
expected
expected,
} = options;
const limit = Error.stackTraceLimit;
@@ -429,7 +429,7 @@ class AssertionError extends Error {
value: 'AssertionError [ERR_ASSERTION]',
enumerable: false,
writable: true,
configurable: true
configurable: true,
});
this.code = 'ERR_ASSERTION';
if (details) {
@@ -478,7 +478,7 @@ class AssertionError extends Error {
const result = inspect(this, {
...ctx,
customInspect: false,
depth: 0
depth: 0,
});
// Reset the properties after inspection.
+2 -2
View File
@@ -63,7 +63,7 @@ class CallTrackerContext {
actual: this.#calls.length,
expected: this.#expected,
operator: this.#name,
stack: this.#stackTrace
stack: this.#stackTrace,
};
}
}
@@ -110,7 +110,7 @@ class CallTracker {
expected,
// eslint-disable-next-line no-restricted-syntax
stackTrace: new Error(),
name: fn.name || 'calls'
name: fn.name || 'calls',
});
const tracked = new Proxy(fn, {
__proto__: null,
+1 -1
View File
@@ -94,7 +94,7 @@ function exposeNamespace(target, name, namespaceObject) {
writable: true,
enumerable: false,
configurable: true,
value: namespaceObject
value: namespaceObject,
});
}
+3 -3
View File
@@ -68,7 +68,7 @@ ObjectDefineProperty(process, 'moduleLoadList', {
value: moduleLoadList,
configurable: true,
enumerable: true,
writable: false
writable: false,
});
@@ -181,7 +181,7 @@ let internalBinding;
const loaderId = 'internal/bootstrap/loaders';
const {
builtinIds,
compileFunction
compileFunction,
} = internalBinding('builtins');
const getOwn = (target, property, receiver) => {
@@ -349,7 +349,7 @@ class BuiltinModule {
const loaderExports = {
internalBinding,
BuiltinModule,
require: requireBuiltin
require: requireBuiltin,
};
function requireBuiltin(id) {
+11 -11
View File
@@ -209,7 +209,7 @@ internalBinding('async_wrap').setupHooks(nativeHooks);
const {
setupTaskQueue,
queueMicrotask
queueMicrotask,
} = require('internal/process/task_queues');
// Non-standard extensions:
@@ -248,11 +248,11 @@ ObjectDefineProperty(process, 'allowedNodeEnvironmentFlags', {
value,
configurable: true,
enumerable: true,
writable: true
writable: true,
});
},
enumerable: true,
configurable: true
configurable: true,
});
// process.assert
@@ -277,7 +277,7 @@ const features = {
// code cache even if the binary is built with embedded code cache.
get cached_builtins() {
return binding.hasCachedBuiltins();
}
},
};
ObjectDefineProperty(process, 'features', {
@@ -285,14 +285,14 @@ ObjectDefineProperty(process, 'features', {
enumerable: true,
writable: false,
configurable: false,
value: features
value: features,
});
{
const {
onGlobalUncaughtException,
setUncaughtExceptionCaptureCallback,
hasUncaughtExceptionCaptureCallback
hasUncaughtExceptionCaptureCallback,
} = require('internal/process/execution');
// For legacy reasons this is still called `_fatalException`, even
@@ -339,14 +339,14 @@ process.emitWarning = emitWarning;
function setupPrepareStackTrace() {
const {
setEnhanceStackForFatalException,
setPrepareStackTraceCallback
setPrepareStackTraceCallback,
} = internalBinding('errors');
const {
prepareStackTrace,
fatalExceptionStackEnhancers: {
beforeInspector,
afterInspector
}
afterInspector,
},
} = require('internal/errors');
// Tell our PrepareStackTraceCallback passed to the V8 API
// to call prepareStackTrace().
@@ -365,7 +365,7 @@ function setupProcessObject() {
enumerable: false,
writable: true,
configurable: false,
value: 'process'
value: 'process',
});
// Create global.process as getters so that we have a
@@ -391,7 +391,7 @@ function setupGlobalProxy() {
value: 'global',
writable: false,
enumerable: false,
configurable: true
configurable: true,
});
globalThis.global = globalThis;
}
@@ -23,7 +23,7 @@ if (credentials.implementsPosixCredentials) {
// ---- compare the setups side-by-side -----
const {
codes: { ERR_WORKER_UNSUPPORTED_OPERATION }
codes: { ERR_WORKER_UNSUPPORTED_OPERATION },
} = require('internal/errors');
function wrappedUmask(mask) {
@@ -25,18 +25,18 @@ if (credentials.implementsPosixCredentials) {
const {
parseFileMode,
validateArray,
validateString
validateString,
} = require('internal/validators');
function wrapPosixCredentialSetters(credentials) {
const {
codes: {
ERR_INVALID_ARG_TYPE,
ERR_UNKNOWN_CREDENTIAL
}
ERR_UNKNOWN_CREDENTIAL,
},
} = require('internal/errors');
const {
validateUint32
validateUint32,
} = require('internal/validators');
const {
@@ -45,7 +45,7 @@ function wrapPosixCredentialSetters(credentials) {
setegid: _setegid,
seteuid: _seteuid,
setgid: _setgid,
setuid: _setuid
setuid: _setuid,
} = credentials;
function initgroups(user, extraGroup) {
@@ -99,7 +99,7 @@ function wrapPosixCredentialSetters(credentials) {
setegid: wrapIdSetter('Group', _setegid),
seteuid: wrapIdSetter('User', _seteuid),
setgid: wrapIdSetter('Group', _setgid),
setuid: wrapIdSetter('User', _setuid)
setuid: wrapIdSetter('User', _setuid),
};
}
@@ -5,7 +5,7 @@ const rawMethods = internalBinding('process_methods');
const {
namespace: {
addSerializeCallback,
isBuildingSnapshot
isBuildingSnapshot,
},
} = require('internal/v8/startup_snapshot');
// TODO(joyeecheung): deprecate and remove these underscore methods
@@ -23,7 +23,7 @@ function defineStream(name, getter) {
__proto__: null,
configurable: true,
enumerable: true,
get: getter
get: getter,
});
}
@@ -34,7 +34,7 @@ defineStream('stderr', getStderr);
// Worker threads don't receive signals.
const {
startListeningIfSignal,
stopListeningIfSignal
stopListeningIfSignal,
} = require('internal/process/signal');
process.on('newListener', startListeningIfSignal);
process.on('removeListener', stopListeningIfSignal);
@@ -74,13 +74,13 @@ function createWritableStdioStream(fd) {
stream = new net.Socket({
handle: process[kChannelHandle],
readable: false,
writable: true
writable: true,
});
} else {
stream = new net.Socket({
fd,
readable: false,
writable: true
writable: true,
});
}
@@ -95,7 +95,7 @@ function createWritableStdioStream(fd) {
stream = new Writable({
write(buf, enc, cb) {
cb();
}
},
});
}
}
@@ -218,14 +218,14 @@ function getStdin() {
handle: process.channel,
readable: true,
writable: false,
manualStart: true
manualStart: true,
});
} else {
stdin = new net.Socket({
fd: fd,
readable: true,
writable: false,
manualStart: true
manualStart: true,
});
}
// Make sure the stdin can't be `.end()`-ed
@@ -10,7 +10,7 @@ function defineStream(name, getter) {
__proto__: null,
configurable: true,
enumerable: true,
get: getter
get: getter,
});
}
@@ -21,7 +21,7 @@ defineStream('stderr', getStderr);
// Worker threads don't receive signals.
const {
startListeningIfSignal,
stopListeningIfSignal
stopListeningIfSignal,
} = require('internal/process/signal');
process.removeListener('newListener', startListeningIfSignal);
process.removeListener('removeListener', stopListeningIfSignal);
@@ -30,7 +30,7 @@ process.removeListener('removeListener', stopListeningIfSignal);
// ---- compare the setups side-by-side -----
const {
createWorkerStdio
createWorkerStdio,
} = require('internal/worker/io');
let workerStdio;
+26 -26
View File
@@ -56,7 +56,7 @@ const { previewEntries } = internalBinding('util');
const { Buffer: { isBuffer } } = require('buffer');
const {
inspect,
formatWithOptions
formatWithOptions,
} = require('internal/util/inspect');
const {
isTypedArray, isSet, isMap, isSetIterator, isMapIterator,
@@ -108,7 +108,7 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) {
options = {
stdout: options,
stderr: arguments[1],
ignoreErrors: arguments[2]
ignoreErrors: arguments[2],
};
}
@@ -155,7 +155,7 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) {
this[key] = FunctionPrototypeBind(this[key], this);
ObjectDefineProperty(this[key], 'name', {
__proto__: null,
value: key
value: key,
});
});
@@ -166,7 +166,7 @@ function Console(options /* or: stdout, stderr, ignoreErrors = true */) {
const consolePropAttributes = {
writable: true,
enumerable: false,
configurable: true
configurable: true,
};
// Fixup global.console instanceof global.console.Console
@@ -174,7 +174,7 @@ ObjectDefineProperty(Console, SymbolHasInstance, {
__proto__: null,
value(instance) {
return instance[kIsConsole];
}
},
});
const kColorInspectOptions = { colors: true };
@@ -190,7 +190,7 @@ ObjectDefineProperties(Console.prototype, {
'_stdout': { __proto__: null, ...consolePropAttributes, value: stdout },
'_stderr': { __proto__: null, ...consolePropAttributes, value: stderr },
});
}
},
},
[kBindStreamsLazy]: {
__proto__: null,
@@ -209,7 +209,7 @@ ObjectDefineProperties(Console.prototype, {
if (!stdout) stdout = object.stdout;
return stdout;
},
set(value) { stdout = value; }
set(value) { stdout = value; },
},
'_stderr': {
__proto__: null,
@@ -219,10 +219,10 @@ ObjectDefineProperties(Console.prototype, {
if (!stderr) { stderr = object.stderr; }
return stderr;
},
set(value) { stderr = value; }
}
set(value) { stderr = value; },
},
});
}
},
},
[kBindProperties]: {
__proto__: null,
@@ -232,17 +232,17 @@ ObjectDefineProperties(Console.prototype, {
'_stdoutErrorHandler': {
__proto__: null,
...consolePropAttributes,
value: createWriteErrorHandler(this, kUseStdout)
value: createWriteErrorHandler(this, kUseStdout),
},
'_stderrErrorHandler': {
...consolePropAttributes,
__proto__: null,
value: createWriteErrorHandler(this, kUseStderr)
value: createWriteErrorHandler(this, kUseStderr),
},
'_ignoreErrors': {
__proto__: null,
...consolePropAttributes,
value: Boolean(ignoreErrors)
value: Boolean(ignoreErrors),
},
'_times': { __proto__: null, ...consolePropAttributes, value: new SafeMap() },
// Corresponds to https://console.spec.whatwg.org/#count-map
@@ -253,17 +253,17 @@ ObjectDefineProperties(Console.prototype, {
[kGroupIndentationWidth]: {
__proto__: null,
...consolePropAttributes,
value: groupIndentation
value: groupIndentation,
},
[SymbolToStringTag]: {
__proto__: null,
writable: false,
enumerable: false,
configurable: true,
value: 'console'
}
value: 'console',
},
});
}
},
},
[kWriteToConsole]: {
__proto__: null,
@@ -306,7 +306,7 @@ ObjectDefineProperties(Console.prototype, {
} finally {
stream.removeListener('error', noop);
}
}
},
},
[kGetInspectOptions]: {
__proto__: null,
@@ -328,7 +328,7 @@ ObjectDefineProperties(Console.prototype, {
}
return color ? kColorInspectOptions : kNoColorInspectOptions;
}
},
},
[kFormatForStdout]: {
__proto__: null,
@@ -337,7 +337,7 @@ ObjectDefineProperties(Console.prototype, {
const opts = this[kGetInspectOptions](this._stdout);
ArrayPrototypeUnshift(args, opts);
return ReflectApply(formatWithOptions, null, args);
}
},
},
[kFormatForStderr]: {
__proto__: null,
@@ -346,7 +346,7 @@ ObjectDefineProperties(Console.prototype, {
const opts = this[kGetInspectOptions](this._stderr);
ArrayPrototypeUnshift(args, opts);
return ReflectApply(formatWithOptions, null, args);
}
},
},
});
@@ -386,7 +386,7 @@ const consoleMethods = {
this[kWriteToConsole](kUseStdout, inspect(object, {
customInspect: false,
...this[kGetInspectOptions](this._stdout),
...options
...options,
}));
},
@@ -421,7 +421,7 @@ const consoleMethods = {
trace: function trace(...args) {
const err = {
name: 'Trace',
message: this[kFormatForStderr](args)
message: this[kFormatForStderr](args),
};
ErrorCaptureStackTrace(err, trace);
this.error(err.stack);
@@ -514,7 +514,7 @@ const consoleMethods = {
depth,
maxArrayLength: 3,
breakLength: Infinity,
...this[kGetInspectOptions](this._stdout)
...this[kGetInspectOptions](this._stdout),
};
return inspect(v, opt);
};
@@ -692,7 +692,7 @@ function initializeGlobalConsole(globalConsole) {
namespace: {
addSerializeCallback,
isBuildingSnapshot,
}
},
} = require('internal/v8/startup_snapshot');
if (!internalBinding('config').hasInspector || !isBuildingSnapshot()) {
@@ -722,5 +722,5 @@ module.exports = {
kBindStreamsLazy,
kBindProperties,
initializeGlobalConsole,
formatTime // exported for tests
formatTime, // exported for tests
};
+1 -1
View File
@@ -20,7 +20,7 @@ const {
} = primordials;
const {
Console
Console,
} = require('internal/console/constructor');
const globalConsole = { __proto__: {} };
+2 -2
View File
@@ -212,7 +212,7 @@ async function cfrgImportKey(
keyObject = createPublicKey({
key: keyData,
format: 'der',
type: 'spki'
type: 'spki',
});
} catch (err) {
throw lazyDOMException(
@@ -226,7 +226,7 @@ async function cfrgImportKey(
keyObject = createPrivateKey({
key: keyData,
format: 'der',
type: 'pkcs8'
type: 'pkcs8',
});
} catch (err) {
throw lazyDOMException(
+2 -2
View File
@@ -19,7 +19,7 @@ const {
crypto: {
RSA_PKCS1_OAEP_PADDING,
RSA_PKCS1_PADDING,
}
},
} = internalBinding('constants');
const {
@@ -28,7 +28,7 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_UNKNOWN_ENCODING,
}
},
} = require('internal/errors');
const {
+4 -4
View File
@@ -27,7 +27,7 @@ const {
ERR_CRYPTO_INVALID_KEY_OBJECT_TYPE,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
}
},
} = require('internal/errors');
const {
@@ -63,7 +63,7 @@ const {
POINT_CONVERSION_COMPRESSED,
POINT_CONVERSION_HYBRID,
POINT_CONVERSION_UNCOMPRESSED,
}
},
} = internalBinding('constants');
const DH_GENERATOR = 2;
@@ -124,7 +124,7 @@ function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {
__proto__: null,
enumerable: true,
value: this[kHandle].verifyError,
writable: false
writable: false,
});
}
@@ -137,7 +137,7 @@ function DiffieHellmanGroup(name) {
__proto__: null,
enumerable: true,
value: this[kHandle].verifyError,
writable: false
writable: false,
});
}
+3 -3
View File
@@ -173,7 +173,7 @@ async function ecImportKey(
keyObject = createPublicKey({
key: keyData,
format: 'der',
type: 'spki'
type: 'spki',
});
} catch (err) {
throw lazyDOMException(
@@ -187,7 +187,7 @@ async function ecImportKey(
keyObject = createPrivateKey({
key: keyData,
format: 'der',
type: 'pkcs8'
type: 'pkcs8',
});
} catch (err) {
throw lazyDOMException(
@@ -265,7 +265,7 @@ async function ecImportKey(
}
const {
namedCurve: checkNamedCurve
namedCurve: checkNamedCurve,
} = keyObject[kHandle].keyDetail({});
if (kNamedCurveAliases[namedCurve] !== checkNamedCurve)
throw lazyDOMException('Named curve mismatch', 'DataError');
+3 -3
View File
@@ -39,7 +39,7 @@ const {
ERR_CRYPTO_HASH_FINALIZED,
ERR_CRYPTO_HASH_UPDATE_FAILED,
ERR_INVALID_ARG_TYPE,
}
},
} = require('internal/errors');
const {
@@ -68,7 +68,7 @@ function Hash(algorithm, options) {
validateUint32(xofLen, 'options.outputLength');
this[kHandle] = new _Hash(algorithm, xofLen);
this[kState] = {
[kFinalized]: false
[kFinalized]: false,
};
ReflectApply(LazyTransform, this, [options]);
}
@@ -135,7 +135,7 @@ function Hmac(hmac, key, options) {
this[kHandle] = new _Hmac();
this[kHandle].init(hmac, key);
this[kState] = {
[kFinalized]: false
[kFinalized]: false,
};
ReflectApply(LazyTransform, this, [options]);
}
+1 -1
View File
@@ -49,7 +49,7 @@ const kHashNames = {
[kHashContextJwkRsaPss]: 'PS512',
[kHashContextJwkRsaOaep]: 'RSA-OAEP-512',
[kHashContextJwkHmac]: 'HS512',
}
},
};
{
+6 -6
View File
@@ -58,7 +58,7 @@ const {
ERR_INCOMPATIBLE_OPTION_PAIR,
ERR_INVALID_ARG_VALUE,
ERR_MISSING_OPTION,
}
},
} = require('internal/errors');
const { isArrayBufferView } = require('internal/util/types');
@@ -99,7 +99,7 @@ function generateKeyPair(type, options, callback) {
ObjectDefineProperty(generateKeyPair, customPromisifyArgs, {
__proto__: null,
value: ['publicKey', 'privateKey'],
enumerable: false
enumerable: false,
});
function generateKeyPairSync(type, options) {
@@ -119,7 +119,7 @@ function handleError(ret) {
// If no encoding was chosen, return key objects instead.
return {
publicKey: wrapKey(publicKey, PublicKeyObject),
privateKey: wrapKey(privateKey, PrivateKeyObject)
privateKey: wrapKey(privateKey, PrivateKeyObject),
};
}
@@ -132,7 +132,7 @@ function parseKeyEncoding(keyType, options = kEmptyObject) {
} else if (typeof publicKeyEncoding === 'object') {
({
format: publicFormat,
type: publicType
type: publicType,
} = parsePublicKeyEncoding(publicKeyEncoding, keyType,
'publicKeyEncoding'));
} else {
@@ -148,7 +148,7 @@ function parseKeyEncoding(keyType, options = kEmptyObject) {
format: privateFormat,
type: privateType,
cipher,
passphrase
passphrase,
} = parsePrivateKeyEncoding(privateKeyEncoding, keyType,
'privateKeyEncoding'));
} else {
@@ -199,7 +199,7 @@ function createJob(mode, type, options) {
}
const {
hash, mgf1Hash, hashAlgorithm, mgf1HashAlgorithm, saltLength
hash, mgf1Hash, hashAlgorithm, mgf1HashAlgorithm, saltLength,
} = options;
if (saltLength !== undefined)
+12 -12
View File
@@ -41,7 +41,7 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_INVALID_THIS,
}
},
} = require('internal/errors');
const {
@@ -115,7 +115,7 @@ const {
value: handle,
enumerable: false,
configurable: false,
writable: false
writable: false,
});
}
@@ -178,7 +178,7 @@ const {
return {
...details,
publicExponent:
bigIntArrayToUnsignedBigInt(new Uint8Array(details.publicExponent))
bigIntArrayToUnsignedBigInt(new Uint8Array(details.publicExponent)),
};
}
return details;
@@ -222,7 +222,7 @@ const {
}
const {
format,
type
type,
} = parsePublicKeyEncoding(options, this.asymmetricKeyType);
return this[kHandle].export(format, type);
}
@@ -245,7 +245,7 @@ const {
format,
type,
cipher,
passphrase
passphrase,
} = parsePrivateKeyEncoding(options, this.asymmetricKeyType);
return this[kHandle].export(format, type, cipher, passphrase);
}
@@ -327,7 +327,7 @@ function parseKeyEncoding(enc, keyType, isPublic, objName) {
const {
format,
type
type,
} = parseKeyFormatAndType(enc, keyType, isPublic, objName);
let cipher, passphrase, encoding;
@@ -477,7 +477,7 @@ function getKeyObjectHandleFromJwk(key, ctx) {
kty: key.kty,
crv: key.crv,
x: key.x,
y: key.y
y: key.y,
};
if (!isPublic) {
@@ -500,7 +500,7 @@ function getKeyObjectHandleFromJwk(key, ctx) {
const jwk = {
kty: key.kty,
n: key.n,
e: key.e
e: key.e,
};
if (!isPublic) {
@@ -561,7 +561,7 @@ function prepareAsymmetricKey(key, ctx) {
(ctx === kConsumePrivate || ctx === kCreatePrivate) ? false : undefined;
return {
data: getArrayBufferOrView(data, 'key', encoding),
...parseKeyEncoding(key, undefined, isPublic)
...parseKeyEncoding(key, undefined, isPublic),
};
}
throw new ERR_INVALID_ARG_TYPE(
@@ -655,14 +655,14 @@ class CryptoKey {
const opts = {
...options,
depth: options.depth == null ? null : options.depth - 1
depth: options.depth == null ? null : options.depth - 1,
};
return `CryptoKey ${inspect({
type: this.type,
extractable: this.extractable,
algorithm: this.algorithm,
usages: this.usages
usages: this.usages,
}, opts)}`;
}
@@ -739,7 +739,7 @@ class InternalCryptoKey {
usages,
extractable,
},
deserializeInfo: 'internal/crypto/keys:InternalCryptoKey'
deserializeInfo: 'internal/crypto/keys:InternalCryptoKey',
};
}
+1 -1
View File
@@ -42,7 +42,7 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_OUT_OF_RANGE,
ERR_OPERATION_FAILED,
}
},
} = require('internal/errors');
const {
+5 -5
View File
@@ -113,7 +113,7 @@ async function rsaKeyGenerate(
name,
modulusLength,
publicExponent,
hash
hash,
} = algorithm;
const usageSet = new SafeSet(keyUsages);
@@ -155,7 +155,7 @@ async function rsaKeyGenerate(
name,
modulusLength,
publicExponent,
hash: { name: hash.name }
hash: { name: hash.name },
};
let publicUsages;
@@ -213,7 +213,7 @@ async function rsaImportKey(
keyObject = createPublicKey({
key: keyData,
format: 'der',
type: 'spki'
type: 'spki',
});
} catch (err) {
throw lazyDOMException(
@@ -227,7 +227,7 @@ async function rsaImportKey(
keyObject = createPrivateKey({
key: keyData,
format: 'der',
type: 'pkcs8'
type: 'pkcs8',
});
} catch (err) {
throw lazyDOMException(
@@ -302,7 +302,7 @@ async function rsaImportKey(
name: algorithm.name,
modulusLength,
publicExponent: new Uint8Array(publicExponent),
hash: algorithm.hash
hash: algorithm.hash,
}, keyUsages, extractable);
}
+1 -1
View File
@@ -23,7 +23,7 @@ const {
codes: {
ERR_CRYPTO_SCRYPT_INVALID_PARAMETER,
ERR_CRYPTO_SCRYPT_NOT_SUPPORTED,
}
},
} = require('internal/errors');
const {
+4 -4
View File
@@ -11,7 +11,7 @@ const {
ERR_CRYPTO_SIGN_KEY_REQUIRED,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
}
},
} = require('internal/errors');
const {
@@ -161,7 +161,7 @@ function signOneShot(algorithm, data, key, callback) {
data: keyData,
format: keyFormat,
type: keyType,
passphrase: keyPassphrase
passphrase: keyPassphrase,
} = preparePrivateKey(key);
const job = new SignJob(
@@ -213,7 +213,7 @@ Verify.prototype.verify = function verify(options, signature, sigEncoding) {
data,
format,
type,
passphrase
passphrase,
} = preparePublicOrPrivateKey(options, true);
sigEncoding = sigEncoding || getDefaultEncoding();
@@ -267,7 +267,7 @@ function verifyOneShot(algorithm, data, key, signature, callback) {
data: keyData,
format: keyFormat,
type: keyType,
passphrase: keyPassphrase
passphrase: keyPassphrase,
} = preparePublicOrPrivateKey(key);
const job = new SignJob(
+4 -4
View File
@@ -35,8 +35,8 @@ const { getOptionValue } = require('internal/options');
const {
crypto: {
ENGINE_METHOD_ALL
}
ENGINE_METHOD_ALL,
},
} = internalBinding('constants');
const normalizeHashName = require('internal/crypto/hashnames');
@@ -48,13 +48,13 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
ERR_OUT_OF_RANGE,
}
},
} = require('internal/errors');
const {
validateArray,
validateNumber,
validateString
validateString,
} = require('internal/validators');
const { Buffer } = require('buffer');
+2 -2
View File
@@ -31,7 +31,7 @@ const {
codes: {
ERR_ILLEGAL_CONSTRUCTOR,
ERR_INVALID_THIS,
}
},
} = require('internal/errors');
const {
@@ -1115,7 +1115,7 @@ ObjectDefineProperties(
configurable: true,
writable: true,
value: unwrapKey,
}
},
});
module.exports = {
+3 -3
View File
@@ -44,7 +44,7 @@ const {
codes: {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
}
},
} = require('internal/errors');
const {
@@ -125,7 +125,7 @@ class X509Certificate extends JSTransferable {
const opts = {
...options,
depth: options.depth == null ? null : options.depth - 1
depth: options.depth == null ? null : options.depth - 1,
};
return `X509Certificate ${inspect({
@@ -147,7 +147,7 @@ class X509Certificate extends JSTransferable {
const handle = this[kHandle];
return {
data: { handle },
deserializeInfo: 'internal/crypto/x509:InternalX509Certificate'
deserializeInfo: 'internal/crypto/x509:InternalX509Certificate',
};
}
+3 -3
View File
@@ -4,7 +4,7 @@ const {
ObjectDefineProperty,
ReflectApply,
ArrayPrototypeMap,
Symbol
Symbol,
} = primordials;
const { toASCII } = require('internal/idna');
@@ -14,7 +14,7 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_ARG_VALUE,
},
dnsException
dnsException,
} = require('internal/errors');
const {
@@ -112,5 +112,5 @@ function resolve(hostname, rrtype, callback) {
}
module.exports = {
Resolver
Resolver,
};
+6 -6
View File
@@ -52,7 +52,7 @@ const {
getnameinfo,
GetAddrInfoReqWrap,
GetNameInfoReqWrap,
QueryReqWrap
QueryReqWrap,
} = internalBinding('cares_wrap');
const {
ERR_INVALID_ARG_TYPE,
@@ -103,7 +103,7 @@ function onlookupall(err, addresses) {
addresses[i] = {
address,
family: family || isIP(addresses[i])
family: family || isIP(addresses[i]),
};
}
@@ -226,8 +226,8 @@ function createLookupServicePromise(hostname, port) {
name: 'lookupService',
detail: {
host: hostname,
port
}
port,
},
});
}
});
@@ -283,8 +283,8 @@ function createResolverPromise(resolver, bindingName, hostname, ttl) {
name: bindingName,
detail: {
host: hostname,
ttl
}
ttl,
},
});
}
});
+2 -2
View File
@@ -305,7 +305,7 @@ function createResolverClass(resolver) {
return {
resolveMap,
Resolver
Resolver,
};
}
@@ -349,5 +349,5 @@ module.exports = {
setDefaultResultOrder,
errorCodes,
createResolverClass,
initializeDns
initializeDns,
};
+2 -2
View File
@@ -11,8 +11,8 @@ const {
EISDIR,
EINVAL,
ENOTDIR,
}
}
},
},
} = internalBinding('constants');
const {
ERR_FS_CP_DIR_TO_NON_DIR,
+2 -2
View File
@@ -31,8 +31,8 @@ const {
EISDIR,
EINVAL,
ENOTDIR,
}
}
},
},
} = internalBinding('constants');
const {
chmod,
+8 -8
View File
@@ -34,8 +34,8 @@ const {
HTTP_STATUS_EARLY_HINTS,
HTTP_STATUS_EXPECTATION_FAILED,
HTTP_STATUS_METHOD_NOT_ALLOWED,
HTTP_STATUS_OK
}
HTTP_STATUS_OK,
},
} = internalBinding('http2');
const {
codes: {
@@ -48,9 +48,9 @@ const {
ERR_HTTP2_STATUS_INVALID,
ERR_INVALID_ARG_VALUE,
ERR_INVALID_HTTP_TOKEN,
ERR_STREAM_WRITE_AFTER_END
ERR_STREAM_WRITE_AFTER_END,
},
hideStackFrames
hideStackFrames,
} = require('internal/errors');
const {
validateFunction,
@@ -63,7 +63,7 @@ const {
kRequest,
kProxySocket,
assertValidPseudoHeader,
getAuthority
getAuthority,
} = require('internal/http2/util');
const { _checkIsHttpToken: checkIsHttpToken } = require('_http_common');
@@ -283,7 +283,7 @@ const proxySocketHandler = {
return true;
}
}
}
},
};
function onStreamCloseRequest() {
@@ -831,7 +831,7 @@ class Http2ServerResponse extends Stream {
const options = {
endStream: state.ending,
waitForTrailers: true,
sendDate: state.sendDate
sendDate: state.sendDate,
};
this[kStream].respond(headers, options);
}
@@ -842,7 +842,7 @@ class Http2ServerResponse extends Stream {
if (stream.headersSent || this[kState].closed)
return false;
stream.additionalHeaders({
[HTTP2_HEADER_STATUS]: HTTP_STATUS_CONTINUE
[HTTP2_HEADER_STATUS]: HTTP_STATUS_CONTINUE,
});
return true;
}
+18 -18
View File
@@ -55,7 +55,7 @@ const { setImmediate, setTimeout, clearTimeout } = require('timers');
const {
kIncomingMessage,
_checkIsHttpToken: checkIsHttpToken
_checkIsHttpToken: checkIsHttpToken,
} = require('_http_common');
const { kServerResponse } = require('_http_server');
const JSStreamSocket = require('internal/js_stream_socket');
@@ -113,10 +113,10 @@ const {
ERR_INVALID_CHAR,
ERR_INVALID_HTTP_TOKEN,
ERR_OUT_OF_RANGE,
ERR_SOCKET_CLOSED
ERR_SOCKET_CLOSED,
},
hideStackFrames,
AbortError
AbortError,
} = require('internal/errors');
const {
isUint32,
@@ -159,7 +159,7 @@ const {
sessionName,
toHeaderObject,
updateOptionsBuffer,
updateSettingsBuffer
updateSettingsBuffer,
} = require('internal/http2/util');
const {
writeGeneric,
@@ -170,7 +170,7 @@ const {
kUpdateTimer,
kHandle,
kSession,
setStreamTimeout
setStreamTimeout,
} = require('internal/stream_base_commons');
const { kTimeout } = require('internal/timers');
const { isArrayBufferView } = require('internal/util/types');
@@ -181,7 +181,7 @@ const binding = internalBinding('http2');
const {
ShutdownWrap,
kReadBytesOrError,
streamBaseState
streamBaseState,
} = internalBinding('stream_wrap');
const { UV_EOF } = internalBinding('uv');
@@ -310,7 +310,7 @@ const {
HTTP_STATUS_MISDIRECTED_REQUEST,
STREAM_OPTION_EMPTY_PAYLOAD,
STREAM_OPTION_GET_TRAILERS
STREAM_OPTION_GET_TRAILERS,
} = constants;
const STREAM_FLAGS_PENDING = 0x0;
@@ -914,7 +914,7 @@ const proxySocketHandler = {
return true;
}
}
}
},
};
// pingCallback() returns a function that is invoked when an HTTP2 PING
@@ -1001,7 +1001,7 @@ function trackAssignmentsTypedArray(typedArray) {
modifiedEntries[prop] = 1;
}
return ReflectSet(obj, prop, value);
}
},
});
}
@@ -1233,7 +1233,7 @@ class Http2Session extends EventEmitter {
pendingAck: 0,
shutdownWritableCalled: false,
writeQueueSize: 0,
originSet: undefined
originSet: undefined,
};
this[kEncrypted] = undefined;
@@ -1405,7 +1405,7 @@ class Http2Session extends EventEmitter {
destroyed: this.destroyed,
state: this.state,
localSettings: this.localSettings,
remoteSettings: this.remoteSettings
remoteSettings: this.remoteSettings,
};
return `Http2Session ${format(obj)}`;
}
@@ -1979,7 +1979,7 @@ class Http2Stream extends Duplex {
rstCode: NGHTTP2_NO_ERROR,
writeQueueSize: 0,
trailersReady: false,
endAfterHeaders: false
endAfterHeaders: false,
};
// Fields used by the compat API to avoid megamorphisms.
@@ -2028,7 +2028,7 @@ class Http2Stream extends Duplex {
destroyed: this.destroyed,
state: this.state,
readableState: this._readableState,
writableState: this._writableState
writableState: this._writableState,
};
return `Http2Stream ${format(obj)}`;
}
@@ -2537,7 +2537,7 @@ function doSendFD(session, options, fd, headers, streamOptions, err, stat) {
const statOptions = {
offset: options.offset !== undefined ? options.offset : 0,
length: options.length !== undefined ? options.length : -1
length: options.length !== undefined ? options.length : -1,
};
// options.statCheck is a user-provided function that can be used to
@@ -2597,7 +2597,7 @@ function doSendFileFD(session, options, fd, headers, streamOptions, err, stat) {
const statOptions = {
offset: options.offset !== undefined ? options.offset : 0,
length: options.length !== undefined ? options.length : -1
length: options.length !== undefined ? options.length : -1,
};
// options.statCheck is a user-provided function that can be used to
@@ -2976,7 +2976,7 @@ const setTimeoutValue = {
configurable: true,
enumerable: true,
writable: true,
value: setStreamTimeout
value: setStreamTimeout,
};
ObjectDefineProperty(Http2Stream.prototype, 'setTimeout', setTimeoutValue);
ObjectDefineProperty(Http2Session.prototype, 'setTimeout', setTimeoutValue);
@@ -3313,7 +3313,7 @@ ObjectDefineProperty(connect, promisify.custom, {
return new Promise((resolve) => {
const server = connect(authority, options, () => resolve(server));
});
}
},
});
function createSecureServer(options, handler) {
@@ -3410,7 +3410,7 @@ module.exports = {
Http2Stream,
ServerHttp2Session,
Http2ServerRequest,
Http2ServerResponse
Http2ServerResponse,
};
/* eslint-enable no-use-before-define */
+6 -6
View File
@@ -26,7 +26,7 @@ const {
ERR_HTTP2_INVALID_PSEUDOHEADER,
ERR_HTTP2_INVALID_SETTING_VALUE,
ERR_INVALID_ARG_TYPE,
ERR_INVALID_HTTP_TOKEN
ERR_INVALID_HTTP_TOKEN,
},
captureLargerStackTrace,
getMessage,
@@ -98,7 +98,7 @@ const {
HTTP2_METHOD_DELETE,
HTTP2_METHOD_GET,
HTTP2_METHOD_HEAD
HTTP2_METHOD_HEAD,
} = binding.constants;
// This set is defined strictly by the HTTP/2 specification. Only
@@ -344,7 +344,7 @@ function getSettings(session, remote) {
maxHeaderListSize: settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE],
maxHeaderSize: settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE],
enableConnectProtocol:
!!settingsBuffer[IDX_SETTINGS_ENABLE_CONNECT_PROTOCOL]
!!settingsBuffer[IDX_SETTINGS_ENABLE_CONNECT_PROTOCOL],
};
}
@@ -418,7 +418,7 @@ function getSessionState(session) {
deflateDynamicTableSize:
sessionState[IDX_SESSION_STATE_HD_DEFLATE_DYNAMIC_TABLE_SIZE],
inflateDynamicTableSize:
sessionState[IDX_SESSION_STATE_HD_INFLATE_DYNAMIC_TABLE_SIZE]
sessionState[IDX_SESSION_STATE_HD_INFLATE_DYNAMIC_TABLE_SIZE],
};
}
@@ -430,7 +430,7 @@ function getStreamState(stream) {
sumDependencyWeight: streamState[IDX_STREAM_STATE_SUM_DEPENDENCY_WEIGHT],
localClose: streamState[IDX_STREAM_STATE_LOCAL_CLOSE],
remoteClose: streamState[IDX_STREAM_STATE_REMOTE_CLOSE],
localWindowSize: streamState[IDX_STREAM_STATE_LOCAL_WINDOW_SIZE]
localWindowSize: streamState[IDX_STREAM_STATE_LOCAL_WINDOW_SIZE],
};
}
@@ -678,5 +678,5 @@ module.exports = {
sessionName,
toHeaderObject,
updateOptionsBuffer,
updateSettingsBuffer
updateSettingsBuffer,
};
+1 -1
View File
@@ -32,5 +32,5 @@ module.exports = {
'isAnyArrayBuffer',
], key);
})));
}
},
};
+2 -2
View File
@@ -6,11 +6,11 @@
const { getOptionValue } = require('internal/options');
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
const {
readStdin
readStdin,
} = require('internal/process/execution');
const { pathToFileURL } = require('url');
+2 -2
View File
@@ -4,7 +4,7 @@
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
const { getOptionValue } = require('internal/options');
@@ -12,7 +12,7 @@ const { getOptionValue } = require('internal/options');
const {
evalModule,
evalScript,
readStdin
readStdin,
} = require('internal/process/execution');
prepareMainThreadExecution();
+1 -1
View File
@@ -11,7 +11,7 @@ const {
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
const { evalModule, evalScript } = require('internal/process/execution');
const { addBuiltinLibsToObject } = require('internal/modules/helpers');
+1 -1
View File
@@ -4,7 +4,7 @@
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
prepareMainThreadExecution();
+3 -3
View File
@@ -17,11 +17,11 @@ const {
} = binding;
const {
getOptionValue
getOptionValue,
} = require('internal/options');
const {
readFileSync
readFileSync,
} = require('fs');
const supportedModules = new SafeSet(new SafeArrayIterator([
@@ -117,7 +117,7 @@ function requireForUserSnapshot(id) {
function main() {
const {
prepareMainThreadExecution
prepareMainThreadExecution,
} = require('internal/process/pre_execution');
const path = require('path');
+5 -5
View File
@@ -21,7 +21,7 @@ const hasCrypto = Boolean(process.versions.openssl);
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
const typeLookup = [];
@@ -134,7 +134,7 @@ function format(
);
for (const {
0: name, 1: { helpText, type, value, defaultIsTrue }
0: name, 1: { helpText, type, value, defaultIsTrue },
} of sortedOptions) {
if (!helpText) continue;
@@ -190,7 +190,7 @@ function format(
options,
aliases,
firstColumn: maxFirstColumnUsed + 2,
secondColumn
secondColumn,
});
}
@@ -214,13 +214,13 @@ function print(stream) {
' node inspect [options] [ script.js | host:port ] [arguments]\n\n' +
'Options:\n');
stream.write(indent(format({
options, aliases, firstColumn, secondColumn
options, aliases, firstColumn, secondColumn,
}), 2));
stream.write('\nEnvironment variables:\n');
stream.write(format({
options: envVars, firstColumn, secondColumn
options: envVars, firstColumn, secondColumn,
}));
stream.write('\nDocumentation can be found at https://nodejs.org/\n');
+1 -1
View File
@@ -2,7 +2,7 @@
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
prepareMainThreadExecution();
+2 -2
View File
@@ -5,11 +5,11 @@
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
const {
evalScript
evalScript,
} = require('internal/process/execution');
const console = require('internal/console/global');
+1 -1
View File
@@ -4,7 +4,7 @@ const { RegExpPrototypeExec } = primordials;
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
prepareMainThreadExecution(true);
+1 -1
View File
@@ -1,7 +1,7 @@
'use strict';
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
const { getOptionValue } = require('internal/options');
const { isUsingInspector } = require('internal/util/inspector');
+1 -1
View File
@@ -10,7 +10,7 @@ const {
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
const {
triggerUncaughtException,
+8 -8
View File
@@ -19,12 +19,12 @@ const {
const {
prepareWorkerThreadExecution,
setupUserModules,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
const {
threadId,
getEnvMessagePort
getEnvMessagePort,
} = internalBinding('worker');
const workerIo = require('internal/worker/io');
@@ -40,11 +40,11 @@ const {
STDIO_PAYLOAD,
STDIO_WANTS_MORE_DATA,
},
kStdioWantsMoreDataCallback
kStdioWantsMoreDataCallback,
} = workerIo;
const {
onGlobalUncaughtException
onGlobalUncaughtException,
} = require('internal/process/execution');
let debug = require('internal/util/debuglog').debuglog('worker', (fn) => {
@@ -69,13 +69,13 @@ if (process.env.NODE_CHANNEL_FD) {
ObjectDefineProperty(process, 'channel', {
__proto__: null,
enumerable: false,
get: workerThreadSetup.unavailable('process.channel')
get: workerThreadSetup.unavailable('process.channel'),
});
ObjectDefineProperty(process, 'connected', {
__proto__: null,
enumerable: false,
get: workerThreadSetup.unavailable('process.connected')
get: workerThreadSetup.unavailable('process.connected'),
});
process.send = workerThreadSetup.unavailable('process.send()');
@@ -96,7 +96,7 @@ port.on('message', (message) => {
publicPort,
manifestSrc,
manifestURL,
hasStdin
hasStdin,
} = message;
if (argv !== undefined) {
@@ -218,7 +218,7 @@ function workerOnGlobalUncaughtException(error, fromPromise) {
if (serialized)
port.postMessage({
type: ERROR_MESSAGE,
error: serialized
error: serialized,
});
else
port.postMessage({ type: COULD_NOT_SERIALIZE_ERROR });
+6 -6
View File
@@ -146,7 +146,7 @@ const {
} = require('internal/constants');
const {
isProxy
isProxy,
} = require('internal/util/types');
const { kEvaluated } = internalBinding('module_wrap');
@@ -266,7 +266,7 @@ let wrapperProxy = new Proxy(wrapper, {
defineProperty(target, property, descriptor) {
patched = true;
return ObjectDefineProperty(target, property, descriptor);
}
},
});
ObjectDefineProperty(Module, 'wrap', {
@@ -278,7 +278,7 @@ ObjectDefineProperty(Module, 'wrap', {
set(value) {
patched = true;
wrap = value;
}
},
});
ObjectDefineProperty(Module, 'wrapper', {
@@ -290,7 +290,7 @@ ObjectDefineProperty(Module, 'wrapper', {
set(value) {
patched = true;
wrapperProxy = value;
}
},
});
const isPreloadingDesc = { get() { return isPreloading; } };
@@ -494,7 +494,7 @@ function tryFile(requestPath, isMain) {
function toRealPath(requestPath) {
return fs.realpathSync(requestPath, {
[internalFS.realpathCacheKey]: realpathCache
[internalFS.realpathCacheKey]: realpathCache,
});
}
@@ -882,7 +882,7 @@ const CircularRequirePrototypeWarningProxy = new Proxy({}, {
return ObjectGetOwnPropertyDescriptor(target, prop);
emitCircularRequireWarning(prop);
return undefined;
}
},
});
function getExportsForCircularRequire(module) {
@@ -37,5 +37,5 @@ function initializeImportMeta(meta, context) {
}
module.exports = {
initializeImportMeta
initializeImportMeta,
};
+1 -1
View File
@@ -125,7 +125,7 @@ class ESMLoader {
setCallbackForWrap(module, {
importModuleDynamically: (specifier, { url }, importAssertions) => {
return this.import(specifier, url, importAssertions);
}
},
});
return module;
+1 -1
View File
@@ -234,7 +234,7 @@ function finalizeResolution(resolved, base, preserveSymlinks) {
if (!preserveSymlinks) {
const real = realpathSync(path, {
[internalFS.realpathCacheKey]: realpathCache
[internalFS.realpathCacheKey]: realpathCache,
});
const { search, hash } = resolved;
resolved =
+3 -3
View File
@@ -33,7 +33,7 @@ const {
} = require('internal/modules/helpers');
const {
Module: CJSModule,
cjsParseCache
cjsParseCache,
} = require('internal/modules/cjs/loader');
const internalURLModule = require('internal/url');
const { fileURLToPath, URL } = require('url');
@@ -43,7 +43,7 @@ let debug = require('internal/util/debuglog').debuglog('esm', (fn) => {
const { emitExperimentalWarning } = require('internal/util');
const {
ERR_UNKNOWN_BUILTIN_MODULE,
ERR_INVALID_RETURN_PROPERTY_VALUE
ERR_INVALID_RETURN_PROPERTY_VALUE,
} = require('internal/errors').codes;
const { maybeCacheSourceMap } = require('internal/source_map/source_map_cache');
const moduleWrap = internalBinding('module_wrap');
@@ -298,7 +298,7 @@ translators.set('json', async function jsonStrategy(url, source) {
const exports = JSONParse(stripBOM(source));
module = {
exports,
loaded: true
loaded: true,
};
} catch (err) {
// TODO (BridgeAR): We could add a NodeCore error that wraps the JSON
+1 -1
View File
@@ -15,7 +15,7 @@ const { getOptionValue } = require('internal/options');
const {
setImportModuleDynamicallyCallback,
setInitializeImportMetaObjectCallback
setInitializeImportMetaObjectCallback,
} = internalBinding('module_wrap');
const {
getModuleFromWrap,
+1 -1
View File
@@ -19,7 +19,7 @@ module.exports = {
module.exports.clear = hasColors ? '\u001bc' : '';
module.exports.hasColors = hasColors;
}
}
},
};
module.exports.refresh();
+1 -1
View File
@@ -608,5 +608,5 @@ function isDeepStrictEqual(val1, val2) {
module.exports = {
isDeepEqual,
isDeepStrictEqual
isDeepStrictEqual,
};
+2 -2
View File
@@ -104,12 +104,12 @@ function debuglog(set, cb) {
return test();
},
configurable: true,
enumerable: true
enumerable: true,
});
return logger;
}
module.exports = {
debuglog,
initializeDebugEnv
initializeDebugEnv,
};
+9 -9
View File
@@ -114,11 +114,11 @@ const {
customInspectSymbol,
isError,
join,
removeColors
removeColors,
} = require('internal/util');
const {
isStackOverflowError
isStackOverflowError,
} = require('internal/errors');
const {
@@ -265,7 +265,7 @@ function getUserOptions(ctx, isCrossContext) {
sorted: ctx.sorted,
getters: ctx.getters,
numericSeparator: ctx.numericSeparator,
...ctx.userOptions
...ctx.userOptions,
};
// Typically, the target value will be an instance of `Object`. If that is
@@ -373,7 +373,7 @@ ObjectDefineProperty(inspect, 'defaultOptions', {
set(options) {
validateObject(options, 'options');
return ObjectAssign(inspectDefaultOptions, options);
}
},
});
// Set Graphics Rendition https://en.wikipedia.org/wiki/ANSI_escape_code#graphics
@@ -440,7 +440,7 @@ function defineColorAlias(target, alias) {
this[target] = value;
},
configurable: true,
enumerable: false
enumerable: false,
});
}
@@ -472,7 +472,7 @@ inspect.styles = ObjectAssign({ __proto__: null }, {
// "name": intentionally not styling
// TODO(BridgeAR): Highlight regular expressions properly.
regexp: 'red',
module: 'underline'
module: 'underline',
});
function addQuotes(str, quotes) {
@@ -625,7 +625,7 @@ function getConstructorName(obj, ctx, recurseTimes, protoProps) {
return `${res} <${inspect(firstProto, {
...ctx,
customInspect: false,
depth: -1
depth: -1,
})}>`;
}
@@ -2202,7 +2202,7 @@ function formatWithOptionsInternal(inspectOptions, args) {
...inspectOptions,
compact: 3,
colors: false,
depth: 0
depth: 0,
});
}
break;
@@ -2229,7 +2229,7 @@ function formatWithOptionsInternal(inspectOptions, args) {
...inspectOptions,
showHidden: true,
showProxy: true,
depth: 4
depth: 4,
});
break;
case 105: { // 'i'
+1 -1
View File
@@ -91,7 +91,7 @@ function wrapConsole(consoleFromNode) {
);
ObjectDefineProperty(consoleFromNode[key], 'name', {
__proto__: null,
value: key
value: key,
});
} else {
// Add additional console APIs from the inspector
+1 -1
View File
@@ -30,7 +30,7 @@ class IterableWeakMap {
this.#refSet.add(ref);
this.#finalizationGroup.register(key, {
set: this.#refSet,
ref
ref,
}, ref);
}
}
+3 -3
View File
@@ -89,7 +89,7 @@ ObjectDefineProperties(module.exports, {
}
return isKeyObject(obj);
}
},
},
isCryptoKey: {
__proto__: null,
@@ -105,6 +105,6 @@ ObjectDefineProperties(module.exports, {
}
return isCryptoKey(obj);
}
}
},
},
});
+4 -4
View File
@@ -5,7 +5,7 @@ const {
} = require('internal/validators');
const {
ERR_NOT_BUILDING_SNAPSHOT,
ERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTION
ERR_DUPLICATE_STARTUP_SNAPSHOT_MAIN_FUNCTION,
} = require('internal/errors');
const {
@@ -85,7 +85,7 @@ function setDeserializeMainFunction(callback, data) {
_setDeserializeMainFunction(function deserializeMain() {
const {
prepareMainThreadExecution,
markBootstrapComplete
markBootstrapComplete,
} = require('internal/process/pre_execution');
// This should be in sync with run_main_module.js until we make that
@@ -104,6 +104,6 @@ module.exports = {
addDeserializeCallback,
addSerializeCallback,
setDeserializeMainFunction,
isBuildingSnapshot
}
isBuildingSnapshot,
},
};
+1 -1
View File
@@ -242,7 +242,7 @@ class Module {
ObjectDefineProperty(o, SymbolToStringTag, {
__proto__: null,
value: constructor.name,
configurable: true
configurable: true,
});
// Lazy to avoid circular dependency
+12 -12
View File
@@ -27,7 +27,7 @@ const {
const {
handle_onclose: handleOnCloseSymbol,
oninit: onInitSymbol,
no_message_symbol: noMessageSymbol
no_message_symbol: noMessageSymbol,
} = internalBinding('symbols');
const {
MessagePort,
@@ -41,7 +41,7 @@ const {
DOMException,
} = internalBinding('messaging');
const {
getEnvMessagePort
getEnvMessagePort,
} = internalBinding('worker');
const { Readable, Writable } = require('stream');
@@ -61,7 +61,7 @@ const {
ERR_INVALID_ARG_TYPE,
ERR_INVALID_THIS,
ERR_MISSING_ARGS,
}
},
} = require('internal/errors');
const kData = Symbol('kData');
@@ -89,7 +89,7 @@ const messageTypes = {
ERROR_MESSAGE: 'errorMessage',
STDIO_PAYLOAD: 'stdioPayload',
STDIO_WANTS_MORE_DATA: 'stdioWantsMoreData',
LOAD_SCRIPT: 'loadScript'
LOAD_SCRIPT: 'loadScript',
};
// We have to mess with the MessagePort prototype a bit, so that a) we can make
@@ -240,7 +240,7 @@ ObjectDefineProperty(MessagePort.prototype, onInitSymbol, {
__proto__: null,
enumerable: true,
writable: false,
value: oninit
value: oninit,
});
class MessagePortCloseEvent extends Event {
@@ -258,7 +258,7 @@ ObjectDefineProperty(MessagePort.prototype, handleOnCloseSymbol, {
__proto__: null,
enumerable: false,
writable: false,
value: onclose
value: onclose,
});
MessagePort.prototype.close = function(cb) {
@@ -283,10 +283,10 @@ ObjectDefineProperty(MessagePort.prototype, inspect.custom, {
active: false,
} : {
active: true,
refed: ref
refed: ref,
},
this);
}
},
});
function setupPortReferencing(port, eventEmitter, eventName) {
@@ -352,7 +352,7 @@ class ReadableWorkerStdio extends Readable {
this[kPort].postMessage({
type: messageTypes.STDIO_WANTS_MORE_DATA,
stream: this[kName]
stream: this[kName],
});
}
}
@@ -381,7 +381,7 @@ class WritableWorkerStdio extends Writable {
this[kPort].postMessage({
type: messageTypes.STDIO_PAYLOAD,
stream: this[kName],
chunks: [ { chunk: null, encoding: '' } ]
chunks: [ { chunk: null, encoding: '' } ],
});
cb();
}
@@ -401,7 +401,7 @@ function createWorkerStdio() {
return {
stdin: new ReadableWorkerStdio(port, 'stdin'),
stdout: new WritableWorkerStdio(port, 'stdout'),
stderr: new WritableWorkerStdio(port, 'stderr')
stderr: new WritableWorkerStdio(port, 'stderr'),
};
}
@@ -445,7 +445,7 @@ class BroadcastChannel extends EventTarget {
const opts = {
...options,
depth: options.depth == null ? null : options.depth - 1
depth: options.depth == null ? null : options.depth - 1,
};
return `BroadcastChannel ${inspect({
+2 -2
View File
@@ -13,11 +13,11 @@ const {
messaging_deserialize_symbol,
messaging_transfer_symbol,
messaging_clone_symbol,
messaging_transfer_list_symbol
messaging_transfer_list_symbol,
} = internalBinding('symbols');
const {
JSTransferable,
setDeserializerCreateObjectFunction
setDeserializerCreateObjectFunction,
} = internalBinding('messaging');
function setup() {