mirror of https://github.com/nodejs/node.git
lib: enforce use of trailing commas for functions
PR-URL: https://github.com/nodejs/node/pull/46629 Reviewed-By: Jacob Smith <jacob@frende.me> Reviewed-By: Geoffrey Booth <webadmin@geoffreybooth.com> Reviewed-By: Chengzhong Wu <legendecas@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
This commit is contained in:
parent
3acdeb1f7a
commit
fe514bf960
|
@ -5,7 +5,7 @@ rules:
|
|||
comma-dangle: [error, {
|
||||
arrays: always-multiline,
|
||||
exports: always-multiline,
|
||||
functions: only-multiline,
|
||||
functions: always-multiline,
|
||||
imports: always-multiline,
|
||||
objects: only-multiline,
|
||||
}]
|
||||
|
|
|
@ -396,7 +396,7 @@ function installListeners(agent, s, options) {
|
|||
// TODO(ronag): Always destroy, even if not in free list.
|
||||
const sockets = agent.freeSockets;
|
||||
if (ArrayPrototypeSome(ObjectKeys(sockets), (name) =>
|
||||
ArrayPrototypeIncludes(sockets[name], s)
|
||||
ArrayPrototypeIncludes(sockets[name], s),
|
||||
)) {
|
||||
return s.destroy();
|
||||
}
|
||||
|
|
|
@ -609,7 +609,7 @@ function checkConnections() {
|
|||
|
||||
function connectionListener(socket) {
|
||||
defaultTriggerAsyncIdScope(
|
||||
getOrSetAsyncId(socket), connectionListenerInternal, this, socket
|
||||
getOrSetAsyncId(socket), connectionListenerInternal, this, socket,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -812,15 +812,15 @@ function onParserTimeout(server, socket) {
|
|||
const noop = () => {};
|
||||
const badRequestResponse = Buffer.from(
|
||||
`HTTP/1.1 400 ${STATUS_CODES[400]}\r\n` +
|
||||
'Connection: close\r\n\r\n', 'ascii'
|
||||
'Connection: close\r\n\r\n', 'ascii',
|
||||
);
|
||||
const requestTimeoutResponse = Buffer.from(
|
||||
`HTTP/1.1 408 ${STATUS_CODES[408]}\r\n` +
|
||||
'Connection: close\r\n\r\n', 'ascii'
|
||||
'Connection: close\r\n\r\n', 'ascii',
|
||||
);
|
||||
const requestHeaderFieldsTooLargeResponse = Buffer.from(
|
||||
`HTTP/1.1 431 ${STATUS_CODES[431]}\r\n` +
|
||||
'Connection: close\r\n\r\n', 'ascii'
|
||||
'Connection: close\r\n\r\n', 'ascii',
|
||||
);
|
||||
function socketOnError(e) {
|
||||
// Ignore further errors
|
||||
|
|
|
@ -171,7 +171,7 @@ function onhandshakedone() {
|
|||
function loadSession(hello) {
|
||||
debug('server onclienthello',
|
||||
'sessionid.len', hello.sessionId.length,
|
||||
'ticket?', hello.tlsTicket
|
||||
'ticket?', hello.tlsTicket,
|
||||
);
|
||||
const owner = this[owner_symbol];
|
||||
|
||||
|
@ -350,7 +350,7 @@ function onPskServerCallback(identity, maxPskLen) {
|
|||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'ret',
|
||||
['Object', 'Buffer', 'TypedArray', 'DataView'],
|
||||
ret
|
||||
ret,
|
||||
);
|
||||
}
|
||||
psk = ret.psk;
|
||||
|
@ -361,7 +361,7 @@ function onPskServerCallback(identity, maxPskLen) {
|
|||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'psk',
|
||||
psk,
|
||||
`Pre-shared key exceeds ${maxPskLen} bytes`
|
||||
`Pre-shared key exceeds ${maxPskLen} bytes`,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -381,7 +381,7 @@ function onPskClientCallback(hint, maxPskLen, maxIdentityLen) {
|
|||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'psk',
|
||||
ret.psk,
|
||||
`Pre-shared key exceeds ${maxPskLen} bytes`
|
||||
`Pre-shared key exceeds ${maxPskLen} bytes`,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -390,7 +390,7 @@ function onPskClientCallback(hint, maxPskLen, maxIdentityLen) {
|
|||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'identity',
|
||||
ret.identity,
|
||||
`PSK identity exceeds ${maxIdentityLen} bytes`
|
||||
`PSK identity exceeds ${maxIdentityLen} bytes`,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -447,7 +447,7 @@ function initRead(tlsSocket, socket) {
|
|||
debug('%s initRead',
|
||||
tlsSocket._tlsOptions.isServer ? 'server' : 'client',
|
||||
'handle?', !!tlsSocket._handle,
|
||||
'buffered?', !!socket && socket.readableLength
|
||||
'buffered?', !!socket && socket.readableLength,
|
||||
);
|
||||
// If we were destroyed already don't bother reading
|
||||
if (!tlsSocket._handle)
|
||||
|
@ -689,7 +689,7 @@ TLSSocket.prototype._init = function(socket, wrap) {
|
|||
|
||||
debug('%s _init',
|
||||
options.isServer ? 'server' : 'client',
|
||||
'handle?', !!ssl
|
||||
'handle?', !!ssl,
|
||||
);
|
||||
|
||||
// Clients (!isServer) always request a cert, servers request a client cert
|
||||
|
@ -846,7 +846,7 @@ TLSSocket.prototype.renegotiate = function(options, callback) {
|
|||
|
||||
debug('%s renegotiate()',
|
||||
this._tlsOptions.isServer ? 'server' : 'client',
|
||||
'destroyed?', this.destroyed
|
||||
'destroyed?', this.destroyed,
|
||||
);
|
||||
|
||||
if (this.destroyed)
|
||||
|
@ -1456,7 +1456,7 @@ Server.prototype.addContext = function(servername, context) {
|
|||
|
||||
const re = new RegExp('^' + StringPrototypeReplaceAll(
|
||||
RegExpPrototypeSymbolReplace(/([.^$+?\-\\[\]{}])/g, servername, '\\$1'),
|
||||
'*', '[^.]*'
|
||||
'*', '[^.]*',
|
||||
) + '$');
|
||||
ArrayPrototypePush(this._contexts,
|
||||
[re, tls.createSecureContext(context).context]);
|
||||
|
@ -1680,7 +1680,7 @@ exports.connect = function connect(...args) {
|
|||
'Setting the TLS ServerName to an IP address is not permitted by ' +
|
||||
'RFC 6066. This will be ignored in a future version.',
|
||||
'DeprecationWarning',
|
||||
'DEP0123'
|
||||
'DEP0123',
|
||||
);
|
||||
ipServernameWarned = true;
|
||||
}
|
||||
|
|
|
@ -148,7 +148,7 @@ function fail(actual, expected, message, operator, stackStartFn) {
|
|||
'assert.fail() with more than one argument is deprecated. ' +
|
||||
'Please use assert.strictEqual() instead or only pass a message.',
|
||||
'DeprecationWarning',
|
||||
'DEP0094'
|
||||
'DEP0094',
|
||||
);
|
||||
}
|
||||
if (argsLen === 2)
|
||||
|
@ -807,13 +807,13 @@ function expectsError(stackStartFn, actual, error, message) {
|
|||
if (actual.message === error) {
|
||||
throw new ERR_AMBIGUOUS_ARGUMENT(
|
||||
'error/message',
|
||||
`The error message "${actual.message}" is identical to the message.`
|
||||
`The error message "${actual.message}" is identical to the message.`,
|
||||
);
|
||||
}
|
||||
} else if (actual === error) {
|
||||
throw new ERR_AMBIGUOUS_ARGUMENT(
|
||||
'error/message',
|
||||
`The error "${actual}" is identical to the message.`
|
||||
`The error "${actual}" is identical to the message.`,
|
||||
);
|
||||
}
|
||||
message = error;
|
||||
|
@ -855,7 +855,7 @@ function hasMatchingError(actual, expected) {
|
|||
return RegExpPrototypeExec(expected, str) !== null;
|
||||
}
|
||||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'expected', ['Function', 'RegExp'], expected
|
||||
'expected', ['Function', 'RegExp'], expected,
|
||||
);
|
||||
}
|
||||
// Guard instanceof against arrow functions as they don't have a prototype.
|
||||
|
@ -970,7 +970,7 @@ assert.ifError = function ifError(err) {
|
|||
if (origStackStart !== -1) {
|
||||
const originalFrames = StringPrototypeSplit(
|
||||
StringPrototypeSlice(origStack, origStackStart + 1),
|
||||
'\n'
|
||||
'\n',
|
||||
);
|
||||
// Filter all frames existing in err.stack.
|
||||
let newFrames = StringPrototypeSplit(newErr.stack, '\n');
|
||||
|
@ -996,7 +996,7 @@ assert.ifError = function ifError(err) {
|
|||
function internalMatch(string, regexp, message, fn) {
|
||||
if (!isRegExp(regexp)) {
|
||||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'regexp', 'RegExp', regexp
|
||||
'regexp', 'RegExp', regexp,
|
||||
);
|
||||
}
|
||||
const match = fn === assert.match;
|
||||
|
|
|
@ -326,7 +326,7 @@ Buffer.from = function from(value, encodingOrOffset, length) {
|
|||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'first argument',
|
||||
['string', 'Buffer', 'ArrayBuffer', 'Array', 'Array-like Object'],
|
||||
value
|
||||
value,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -733,7 +733,7 @@ function byteLength(string, encoding) {
|
|||
}
|
||||
|
||||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'string', ['string', 'Buffer', 'ArrayBuffer'], string
|
||||
'string', ['string', 'Buffer', 'ArrayBuffer'], string,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -954,7 +954,7 @@ function bidirectionalIndexOf(buffer, val, byteOffset, encoding, dir) {
|
|||
}
|
||||
|
||||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'value', ['number', 'string', 'Buffer', 'Uint8Array'], val
|
||||
'value', ['number', 'string', 'Buffer', 'Uint8Array'], val,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1210,7 +1210,7 @@ if (internalBinding('config').hasIntl) {
|
|||
const code = icuErrName(result);
|
||||
const err = genericNodeError(
|
||||
`Unable to transcode Buffer [${code}]`,
|
||||
{ code: code, errno: result }
|
||||
{ code: code, errno: result },
|
||||
);
|
||||
throw err;
|
||||
};
|
||||
|
@ -1362,10 +1362,10 @@ ObjectDefineProperties(module.exports, {
|
|||
defineLazyProperties(
|
||||
module.exports,
|
||||
'internal/blob',
|
||||
['Blob', 'resolveObjectURL']
|
||||
['Blob', 'resolveObjectURL'],
|
||||
);
|
||||
defineLazyProperties(
|
||||
module.exports,
|
||||
'internal/file',
|
||||
['File']
|
||||
['File'],
|
||||
);
|
||||
|
|
|
@ -56,7 +56,7 @@ let debug = require('internal/util/debuglog').debuglog(
|
|||
'child_process',
|
||||
(fn) => {
|
||||
debug = fn;
|
||||
}
|
||||
},
|
||||
);
|
||||
const { Buffer } = require('buffer');
|
||||
const { Pipe, constants: PipeConstants } = internalBinding('pipe_wrap');
|
||||
|
@ -686,7 +686,7 @@ function normalizeSpawnArguments(file, args, options) {
|
|||
}
|
||||
sawKey.add(uppercaseKey);
|
||||
return true;
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -317,7 +317,7 @@ function getRandomBytesAlias(key) {
|
|||
configurable: true,
|
||||
writable: true,
|
||||
value: value
|
||||
}
|
||||
},
|
||||
);
|
||||
return value;
|
||||
},
|
||||
|
@ -331,7 +331,7 @@ function getRandomBytesAlias(key) {
|
|||
configurable: true,
|
||||
writable: true,
|
||||
value
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -412,7 +412,7 @@ function _connect(port, address, callback) {
|
|||
defaultTriggerAsyncIdScope(
|
||||
this[async_id_symbol],
|
||||
doConnect,
|
||||
ex, this, ip, address, port, callback
|
||||
ex, this, ip, address, port, callback,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -662,7 +662,7 @@ Socket.prototype.send = function(buffer,
|
|||
defaultTriggerAsyncIdScope(
|
||||
this[async_id_symbol],
|
||||
doSend,
|
||||
ex, this, ip, list, address, port, callback
|
||||
ex, this, ip, list, address, port, callback,
|
||||
);
|
||||
};
|
||||
|
||||
|
@ -1066,7 +1066,7 @@ module.exports = {
|
|||
_createSocketHandle: deprecate(
|
||||
_createSocketHandle,
|
||||
'dgram._createSocketHandle() is deprecated',
|
||||
'DEP0112'
|
||||
'DEP0112',
|
||||
),
|
||||
createSocket,
|
||||
Socket
|
||||
|
|
|
@ -219,7 +219,7 @@ function lookup(hostname, options, callback) {
|
|||
req.oncomplete = all ? onlookupall : onlookup;
|
||||
|
||||
const err = cares.getaddrinfo(
|
||||
req, toASCII(hostname), family, hints, verbatim
|
||||
req, toASCII(hostname), family, hints, verbatim,
|
||||
);
|
||||
if (err) {
|
||||
process.nextTick(callback, dnsException(err, 'getaddrinfo', hostname));
|
||||
|
|
|
@ -3109,7 +3109,7 @@ module.exports = fs = {
|
|||
defineLazyProperties(
|
||||
fs,
|
||||
'internal/fs/dir',
|
||||
['Dir', 'opendir', 'opendirSync']
|
||||
['Dir', 'opendir', 'opendirSync'],
|
||||
);
|
||||
|
||||
ObjectDefineProperties(fs, {
|
||||
|
|
|
@ -72,7 +72,7 @@ function inspectValue(val) {
|
|||
sorted: true,
|
||||
// Inspect getters as we also check them when comparing entries.
|
||||
getters: true,
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -201,7 +201,7 @@ function emitInitNative(asyncId, type, triggerAsyncId, resource) {
|
|||
if (typeof active_hooks.array[i][init_symbol] === 'function') {
|
||||
active_hooks.array[i][init_symbol](
|
||||
asyncId, type, triggerAsyncId,
|
||||
resource
|
||||
resource,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -201,7 +201,7 @@ class BuiltinModule {
|
|||
* @type {Map<string, BuiltinModule>}
|
||||
*/
|
||||
static map = new SafeMap(
|
||||
ArrayPrototypeMap(builtinIds, (id) => [id, new BuiltinModule(id)])
|
||||
ArrayPrototypeMap(builtinIds, (id) => [id, new BuiltinModule(id)]),
|
||||
);
|
||||
|
||||
constructor(id) {
|
||||
|
|
|
@ -223,13 +223,13 @@ defineOperation(globalThis, 'setImmediate', timers.setImmediate);
|
|||
defineLazyProperties(
|
||||
globalThis,
|
||||
'internal/structured_clone',
|
||||
['structuredClone']
|
||||
['structuredClone'],
|
||||
);
|
||||
|
||||
exposeLazyInterfaces(
|
||||
globalThis,
|
||||
'internal/worker/io',
|
||||
['BroadcastChannel']
|
||||
['BroadcastChannel'],
|
||||
);
|
||||
// Set the per-Environment callback that will be called
|
||||
// when the TrackingTraceStateObserver updates trace state.
|
||||
|
|
|
@ -947,7 +947,7 @@ function setupChannel(target, channel, serializationMode) {
|
|||
|
||||
ArrayPrototypePush(
|
||||
target.channel[kPendingMessages],
|
||||
[event, message, handle]
|
||||
[event, message, handle],
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -82,11 +82,11 @@ const advanced = {
|
|||
channel[kMessageBuffer][0] :
|
||||
Buffer.concat(
|
||||
channel[kMessageBuffer],
|
||||
channel[kMessageBufferSize]
|
||||
channel[kMessageBufferSize],
|
||||
);
|
||||
|
||||
const deserializer = new ChildProcessDeserializer(
|
||||
TypedArrayPrototypeSubarray(concatenatedBuffer, 4, fullMessageSize)
|
||||
TypedArrayPrototypeSubarray(concatenatedBuffer, 4, fullMessageSize),
|
||||
);
|
||||
|
||||
messageBufferHead = TypedArrayPrototypeSubarray(concatenatedBuffer, fullMessageSize);
|
||||
|
|
|
@ -29,10 +29,10 @@ function Worker(options) {
|
|||
if (options.process) {
|
||||
this.process = options.process;
|
||||
this.process.on('error', (code, signal) =>
|
||||
this.emit('error', code, signal)
|
||||
this.emit('error', code, signal),
|
||||
);
|
||||
this.process.on('message', (message, handle) =>
|
||||
this.emit('message', message, handle)
|
||||
this.emit('message', message, handle),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -490,7 +490,7 @@ const consoleMethods = {
|
|||
this[kGroupIndent] = StringPrototypeSlice(
|
||||
this[kGroupIndent],
|
||||
0,
|
||||
this[kGroupIndent].length - this[kGroupIndentationWidth]
|
||||
this[kGroupIndent].length - this[kGroupIndentationWidth],
|
||||
);
|
||||
},
|
||||
|
||||
|
@ -653,7 +653,7 @@ function formatTime(ms) {
|
|||
if (hours !== 0 || minutes !== 0) {
|
||||
({ 0: seconds, 1: ms } = StringPrototypeSplit(
|
||||
NumberPrototypeToFixed(seconds, 3),
|
||||
'.'
|
||||
'.',
|
||||
));
|
||||
const res = hours !== 0 ? `${hours}:${pad(minutes)}` : minutes;
|
||||
return `${res}:${pad(seconds)}.${ms} (${hours !== 0 ? 'h:m' : ''}m:ss.mmm)`;
|
||||
|
|
|
@ -79,7 +79,7 @@ function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {
|
|||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'sizeOrKey',
|
||||
['number', 'string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'],
|
||||
sizeOrKey
|
||||
sizeOrKey,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -114,7 +114,7 @@ function DiffieHellman(sizeOrKey, keyEncoding, generator, genEncoding) {
|
|||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'generator',
|
||||
['number', 'string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'],
|
||||
generator
|
||||
generator,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -203,7 +203,7 @@ const {
|
|||
case 'ec':
|
||||
return this[kAsymmetricKeyDetails] ||
|
||||
(this[kAsymmetricKeyDetails] = normalizeKeyDetails(
|
||||
this[kHandle].keyDetail({})
|
||||
this[kHandle].keyDetail({}),
|
||||
));
|
||||
default:
|
||||
return {};
|
||||
|
@ -382,7 +382,7 @@ function getKeyObjectHandle(key, ctx) {
|
|||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'key',
|
||||
['string', 'ArrayBuffer', 'Buffer', 'TypedArray', 'DataView'],
|
||||
key
|
||||
key,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -231,7 +231,7 @@ function randomInt(min, max, callback) {
|
|||
}
|
||||
if (max <= min) {
|
||||
throw new ERR_OUT_OF_RANGE(
|
||||
'max', `greater than the value of "min" (${min})`, max
|
||||
'max', `greater than the value of "min" (${min})`, max,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -547,7 +547,7 @@ function checkPrime(candidate, options = kEmptyObject, callback) {
|
|||
'DataView',
|
||||
'bigint',
|
||||
],
|
||||
candidate
|
||||
candidate,
|
||||
);
|
||||
}
|
||||
if (typeof options === 'function') {
|
||||
|
@ -580,7 +580,7 @@ function checkPrimeSync(candidate, options = kEmptyObject) {
|
|||
'DataView',
|
||||
'bigint',
|
||||
],
|
||||
candidate
|
||||
candidate,
|
||||
);
|
||||
}
|
||||
validateObject(options, 'options');
|
||||
|
|
|
@ -244,7 +244,7 @@ function verifyOneShot(algorithm, data, key, signature, callback) {
|
|||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'data',
|
||||
['Buffer', 'TypedArray', 'DataView'],
|
||||
data
|
||||
data,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -259,7 +259,7 @@ function verifyOneShot(algorithm, data, key, signature, callback) {
|
|||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'signature',
|
||||
['Buffer', 'TypedArray', 'DataView'],
|
||||
signature
|
||||
signature,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -132,7 +132,7 @@ const getArrayBufferOrView = hideStackFrames((buffer, name, encoding) => {
|
|||
'TypedArray',
|
||||
'DataView',
|
||||
],
|
||||
buffer
|
||||
buffer,
|
||||
);
|
||||
}
|
||||
return buffer;
|
||||
|
|
|
@ -278,7 +278,7 @@ class NodeInspector {
|
|||
|
||||
if (StringPrototypeEndsWith(
|
||||
textToPrint,
|
||||
'Waiting for the debugger to disconnect...\n'
|
||||
'Waiting for the debugger to disconnect...\n',
|
||||
)) {
|
||||
this.killChild();
|
||||
}
|
||||
|
|
|
@ -55,7 +55,7 @@ function validateHandshake(requestKey, responseKey) {
|
|||
|
||||
if (shabuf.toString('base64') !== responseKey) {
|
||||
throw new ERR_DEBUGGER_ERROR(
|
||||
`WebSocket secret mismatch: ${requestKey} did not match ${responseKey}`
|
||||
`WebSocket secret mismatch: ${requestKey} did not match ${responseKey}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -521,7 +521,7 @@ function createRepl(inspector) {
|
|||
return SafePromiseAllReturnArrayLike(
|
||||
ArrayPrototypeFilter(
|
||||
this.scopeChain,
|
||||
(scope) => scope.type !== 'global'
|
||||
(scope) => scope.type !== 'global',
|
||||
),
|
||||
async (scope) => {
|
||||
const { objectId } = scope.object;
|
||||
|
@ -566,7 +566,7 @@ function createRepl(inspector) {
|
|||
(callFrame) =>
|
||||
(callFrame instanceof CallFrame ?
|
||||
callFrame :
|
||||
new CallFrame(callFrame))
|
||||
new CallFrame(callFrame)),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -624,7 +624,7 @@ function createRepl(inspector) {
|
|||
FunctionPrototypeCall(
|
||||
then, result,
|
||||
(result) => returnToCallback(null, result),
|
||||
returnToCallback
|
||||
returnToCallback,
|
||||
);
|
||||
} else {
|
||||
returnToCallback(null, result);
|
||||
|
@ -643,7 +643,7 @@ function createRepl(inspector) {
|
|||
|
||||
PromisePrototypeThen(evalInCurrentContext(input),
|
||||
(result) => returnToCallback(null, result),
|
||||
returnToCallback
|
||||
returnToCallback,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -926,7 +926,7 @@ function createRepl(inspector) {
|
|||
Profile.createAndRegister({ profile });
|
||||
print(
|
||||
'Captured new CPU profile.\n' +
|
||||
`Access it with profiles[${profiles.length - 1}]`
|
||||
`Access it with profiles[${profiles.length - 1}]`,
|
||||
);
|
||||
});
|
||||
|
||||
|
@ -1010,7 +1010,7 @@ function createRepl(inspector) {
|
|||
takeHeapSnapshot(filename = 'node.heapsnapshot') {
|
||||
if (heapSnapshotPromise) {
|
||||
print(
|
||||
'Cannot take heap snapshot because another snapshot is in progress.'
|
||||
'Cannot take heap snapshot because another snapshot is in progress.',
|
||||
);
|
||||
return heapSnapshotPromise;
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ function emitInvalidHostnameWarning(hostname) {
|
|||
`The provided hostname "${hostname}" is not a valid ` +
|
||||
'hostname, and is supported in the dns module solely for compatibility.',
|
||||
'DeprecationWarning',
|
||||
'DEP0118'
|
||||
'DEP0118',
|
||||
);
|
||||
invalidHostnameWarningEmitted = true;
|
||||
}
|
||||
|
|
|
@ -445,7 +445,7 @@ function getMessage(key, args, self) {
|
|||
assert(
|
||||
msg.length <= args.length, // Default options do not count.
|
||||
`Code: ${key}; The provided arguments length (${args.length}) does not ` +
|
||||
`match the required ones (${msg.length}).`
|
||||
`match the required ones (${msg.length}).`,
|
||||
);
|
||||
return ReflectApply(msg, self, args);
|
||||
}
|
||||
|
@ -456,7 +456,7 @@ function getMessage(key, args, self) {
|
|||
assert(
|
||||
expectedLength === args.length,
|
||||
`Code: ${key}; The provided arguments length (${args.length}) does not ` +
|
||||
`match the required ones (${expectedLength}).`
|
||||
`match the required ones (${expectedLength}).`,
|
||||
);
|
||||
if (args.length === 0)
|
||||
return msg;
|
||||
|
@ -833,7 +833,7 @@ function hideInternalStackFrames(error) {
|
|||
frames = ArrayPrototypeFilter(
|
||||
stackFrames,
|
||||
(frm) => !StringPrototypeStartsWith(frm.getFileName() || '',
|
||||
'node:internal')
|
||||
'node:internal'),
|
||||
);
|
||||
}
|
||||
ArrayPrototypeUnshift(frames, error);
|
||||
|
@ -1395,7 +1395,7 @@ E(
|
|||
'"%s" did not call the next hook in its chain and did not' +
|
||||
' explicitly signal a short circuit. If this is intentional, include' +
|
||||
' `shortCircuit: true` in the hook\'s return.',
|
||||
Error
|
||||
Error,
|
||||
);
|
||||
E('ERR_MANIFEST_ASSERT_INTEGRITY',
|
||||
(moduleURL, realIntegrities) => {
|
||||
|
@ -1406,7 +1406,7 @@ E('ERR_MANIFEST_ASSERT_INTEGRITY',
|
|||
const sri = ArrayPrototypeJoin(
|
||||
ArrayFrom(realIntegrities.entries(),
|
||||
({ 0: alg, 1: dgs }) => `${alg}-${dgs}`),
|
||||
' '
|
||||
' ',
|
||||
);
|
||||
msg += ` Integrities found are: ${sri}`;
|
||||
} else {
|
||||
|
@ -1442,7 +1442,7 @@ E('ERR_MISSING_ARGS',
|
|||
args,
|
||||
(a) => (ArrayIsArray(a) ?
|
||||
ArrayPrototypeJoin(ArrayPrototypeMap(a, wrap), ' or ') :
|
||||
wrap(a))
|
||||
wrap(a)),
|
||||
);
|
||||
msg += `${formatList(args)} argument${len > 1 ? 's' : ''}`;
|
||||
return `${msg} must be specified`;
|
||||
|
|
|
@ -405,7 +405,7 @@ let weakListenersState = null;
|
|||
let objectToWeakListenerMap = null;
|
||||
function weakListeners() {
|
||||
weakListenersState ??= new SafeFinalizationRegistry(
|
||||
(listener) => listener.remove()
|
||||
(listener) => listener.remove(),
|
||||
);
|
||||
objectToWeakListenerMap ??= new SafeWeakMap();
|
||||
return { registry: weakListenersState, map: objectToWeakListenerMap };
|
||||
|
|
|
@ -215,7 +215,7 @@ module.exports = function() {
|
|||
IteratorPrototype, // 27.1.2 IteratorPrototype
|
||||
// 27.1.3 AsyncIteratorPrototype
|
||||
ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf(
|
||||
(async function*() {})()
|
||||
(async function*() {})(),
|
||||
))),
|
||||
PromisePrototype, // 27.2
|
||||
|
||||
|
@ -324,7 +324,7 @@ module.exports = function() {
|
|||
ObjectGetPrototypeOf(ArrayIteratorPrototype), // 27.1.2 IteratorPrototype
|
||||
// 27.1.3 AsyncIteratorPrototype
|
||||
ObjectGetPrototypeOf(ObjectGetPrototypeOf(ObjectGetPrototypeOf(
|
||||
(async function*() {})()
|
||||
(async function*() {})(),
|
||||
))),
|
||||
Promise, // 27.2
|
||||
// 27.3 GeneratorFunction
|
||||
|
@ -497,7 +497,7 @@ module.exports = function() {
|
|||
if (obj === this) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
throw new TypeError(
|
||||
`Cannot assign to read only property '${prop}' of object '${obj}'`
|
||||
`Cannot assign to read only property '${prop}' of object '${obj}'`,
|
||||
);
|
||||
}
|
||||
if (ObjectPrototypeHasOwnProperty(this, prop)) {
|
||||
|
|
|
@ -128,7 +128,7 @@ class Dir {
|
|||
this[kDirHandle].read(
|
||||
this[kDirOptions].encoding,
|
||||
this[kDirOptions].bufferSize,
|
||||
req
|
||||
req,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -152,7 +152,7 @@ class Dir {
|
|||
this[kDirOptions].encoding,
|
||||
this[kDirOptions].bufferSize,
|
||||
undefined,
|
||||
ctx
|
||||
ctx,
|
||||
);
|
||||
handleErrorFromBinding(ctx);
|
||||
|
||||
|
@ -256,7 +256,7 @@ function opendir(path, options, callback) {
|
|||
dirBinding.opendir(
|
||||
pathModule.toNamespacedPath(path),
|
||||
options.encoding,
|
||||
req
|
||||
req,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ function opendirSync(path, options) {
|
|||
pathModule.toNamespacedPath(path),
|
||||
options.encoding,
|
||||
undefined,
|
||||
ctx
|
||||
ctx,
|
||||
);
|
||||
handleErrorFromBinding(ctx);
|
||||
|
||||
|
|
|
@ -225,7 +225,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {
|
|||
this[kFd] = -1;
|
||||
this[kClosePromise] = SafePromisePrototypeFinally(
|
||||
this[kHandle].close(),
|
||||
() => { this[kClosePromise] = undefined; }
|
||||
() => { this[kClosePromise] = undefined; },
|
||||
);
|
||||
} else {
|
||||
this[kClosePromise] = SafePromisePrototypeFinally(
|
||||
|
@ -236,7 +236,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {
|
|||
this[kClosePromise] = undefined;
|
||||
this[kCloseReject] = undefined;
|
||||
this[kCloseResolve] = undefined;
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -347,7 +347,7 @@ class FileHandle extends EventEmitterMixin(JSTransferable) {
|
|||
PromisePrototypeThen(
|
||||
this[kHandle].close(),
|
||||
this[kCloseResolve],
|
||||
this[kCloseReject]
|
||||
this[kCloseReject],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -361,8 +361,8 @@ async function handleFdClose(fileOpPromise, closeFunc) {
|
|||
PromisePrototypeThen(
|
||||
closeFunc(),
|
||||
() => PromiseReject(opError),
|
||||
(closeError) => PromiseReject(aggregateTwoErrors(closeError, opError))
|
||||
)
|
||||
(closeError) => PromiseReject(aggregateTwoErrors(closeError, opError)),
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -421,7 +421,7 @@ async function writeFileHandle(filehandle, data, signal, encoding) {
|
|||
data = new Uint8Array(
|
||||
data.buffer,
|
||||
data.byteOffset + bytesWritten,
|
||||
data.byteLength - bytesWritten
|
||||
data.byteLength - bytesWritten,
|
||||
);
|
||||
} while (remaining > 0);
|
||||
}
|
||||
|
|
|
@ -204,7 +204,7 @@ function ReadStream(path, options) {
|
|||
throw new ERR_OUT_OF_RANGE(
|
||||
'start',
|
||||
`<= "end" (here: ${this.end})`,
|
||||
this.start
|
||||
this.start,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ const kMinimumCopyMode = MathMin(
|
|||
kDefaultCopyMode,
|
||||
COPYFILE_EXCL,
|
||||
COPYFILE_FICLONE,
|
||||
COPYFILE_FICLONE_FORCE
|
||||
COPYFILE_FICLONE_FORCE,
|
||||
);
|
||||
const kMaximumCopyMode = COPYFILE_EXCL |
|
||||
COPYFILE_FICLONE |
|
||||
|
@ -370,7 +370,7 @@ const nullCheck = hideStackFrames((path, propName, throwError = true) => {
|
|||
const err = new ERR_INVALID_ARG_VALUE(
|
||||
propName,
|
||||
path,
|
||||
'must be a string or Uint8Array without null bytes'
|
||||
'must be a string or Uint8Array without null bytes',
|
||||
);
|
||||
if (throwError) {
|
||||
throw err;
|
||||
|
@ -541,7 +541,7 @@ function getStatsFromBinding(stats, offset = 0) {
|
|||
nsFromTimeSpecBigInt(stats[10 + offset], stats[11 + offset]),
|
||||
nsFromTimeSpecBigInt(stats[12 + offset], stats[13 + offset]),
|
||||
nsFromTimeSpecBigInt(stats[14 + offset], stats[15 + offset]),
|
||||
nsFromTimeSpecBigInt(stats[16 + offset], stats[17 + offset])
|
||||
nsFromTimeSpecBigInt(stats[16 + offset], stats[17 + offset]),
|
||||
);
|
||||
}
|
||||
return new Stats(
|
||||
|
@ -552,7 +552,7 @@ function getStatsFromBinding(stats, offset = 0) {
|
|||
msFromTimeSpec(stats[10 + offset], stats[11 + offset]),
|
||||
msFromTimeSpec(stats[12 + offset], stats[13 + offset]),
|
||||
msFromTimeSpec(stats[14 + offset], stats[15 + offset]),
|
||||
msFromTimeSpec(stats[16 + offset], stats[17 + offset])
|
||||
msFromTimeSpec(stats[16 + offset], stats[17 + offset]),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -570,7 +570,7 @@ class StatFs {
|
|||
|
||||
function getStatFsFromBinding(stats) {
|
||||
return new StatFs(
|
||||
stats[0], stats[1], stats[2], stats[3], stats[4], stats[5], stats[6]
|
||||
stats[0], stats[1], stats[2], stats[3], stats[4], stats[5], stats[6],
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -666,7 +666,7 @@ const validateOffsetLengthRead = hideStackFrames(
|
|||
throw new ERR_OUT_OF_RANGE('length',
|
||||
`<= ${bufferLength - offset}`, length);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const validateOffsetLengthWrite = hideStackFrames(
|
||||
|
@ -684,7 +684,7 @@ const validateOffsetLengthWrite = hideStackFrames(
|
|||
}
|
||||
|
||||
validateInt32(length, 'length', 0);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const validatePath = hideStackFrames((path, propName = 'path') => {
|
||||
|
@ -844,7 +844,7 @@ function emitRecursiveRmdirWarning() {
|
|||
'In future versions of Node.js, fs.rmdir(path, { recursive: true }) ' +
|
||||
'will be removed. Use fs.rm(path, { recursive: true }) instead',
|
||||
'DeprecationWarning',
|
||||
'DEP0147'
|
||||
'DEP0147',
|
||||
);
|
||||
recursiveRmdirWarned = true;
|
||||
}
|
||||
|
@ -888,7 +888,7 @@ const validateStringAfterArrayBufferView = hideStackFrames((buffer, name) => {
|
|||
throw new ERR_INVALID_ARG_TYPE(
|
||||
name,
|
||||
['string', 'Buffer', 'TypedArray', 'DataView'],
|
||||
buffer
|
||||
buffer,
|
||||
);
|
||||
}
|
||||
});
|
||||
|
|
|
@ -119,7 +119,7 @@ function statusMessageWarn() {
|
|||
if (statusMessageWarned === false) {
|
||||
process.emitWarning(
|
||||
'Status message is not supported by HTTP/2 (RFC7540 8.1.2.4)',
|
||||
'UnsupportedWarning'
|
||||
'UnsupportedWarning',
|
||||
);
|
||||
statusMessageWarned = true;
|
||||
}
|
||||
|
@ -136,7 +136,7 @@ function connectionHeaderMessageWarn() {
|
|||
'The provided connection header is not valid, ' +
|
||||
'the value will be dropped from the header and ' +
|
||||
'will never be in use.',
|
||||
'UnsupportedWarning'
|
||||
'UnsupportedWarning',
|
||||
);
|
||||
statusConnectionHeaderWarned = true;
|
||||
}
|
||||
|
|
|
@ -539,7 +539,7 @@ function onStreamClose(code) {
|
|||
|
||||
debugStreamObj(
|
||||
stream, 'closed with code %d, closed %s, readable %s',
|
||||
code, stream.closed, stream.readable
|
||||
code, stream.closed, stream.readable,
|
||||
);
|
||||
|
||||
if (!stream.closed)
|
||||
|
@ -2123,7 +2123,7 @@ class Http2Stream extends Duplex {
|
|||
this.once(
|
||||
'ready',
|
||||
FunctionPrototypeBind(this[kWriteGeneric],
|
||||
this, writev, data, encoding, cb)
|
||||
this, writev, data, encoding, cb),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -3096,7 +3096,7 @@ function initializeOptions(options) {
|
|||
if (options.maxSessionRejectedStreams !== undefined) {
|
||||
validateUint32(
|
||||
options.maxSessionRejectedStreams,
|
||||
'maxSessionRejectedStreams'
|
||||
'maxSessionRejectedStreams',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -3233,7 +3233,7 @@ function setupCompat(ev) {
|
|||
this.on('stream', FunctionPrototypeBind(onServerStream,
|
||||
this,
|
||||
this[kOptions].Http2ServerRequest,
|
||||
this[kOptions].Http2ServerResponse)
|
||||
this[kOptions].Http2ServerResponse),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -3393,7 +3393,7 @@ binding.setCallbackFunctions(
|
|||
onAltSvc,
|
||||
onOrigin,
|
||||
onStreamTrailers,
|
||||
onStreamClose
|
||||
onStreamClose,
|
||||
);
|
||||
|
||||
// Exports
|
||||
|
|
|
@ -376,7 +376,7 @@ function updateSettingsBuffer(settings) {
|
|||
if (settings.maxHeaderSize !== undefined &&
|
||||
(settings.maxHeaderSize !== settings.maxHeaderListSize)) {
|
||||
process.emitWarning(
|
||||
'settings.maxHeaderSize overwrite settings.maxHeaderListSize'
|
||||
'settings.maxHeaderSize overwrite settings.maxHeaderListSize',
|
||||
);
|
||||
settingsBuffer[IDX_SETTINGS_MAX_HEADER_LIST_SIZE] =
|
||||
settings.maxHeaderSize;
|
||||
|
@ -583,7 +583,7 @@ const assertWithinRange = hideStackFrames(
|
|||
throw new ERR_HTTP2_INVALID_SETTING_VALUE.RangeError(
|
||||
name, value, min, max);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
function toHeaderObject(headers, sensitiveHeaders) {
|
||||
|
|
|
@ -13,7 +13,7 @@ let debug = require('internal/util/debuglog').debuglog(
|
|||
'stream_socket',
|
||||
(fn) => {
|
||||
debug = fn;
|
||||
}
|
||||
},
|
||||
);
|
||||
const { owner_symbol } = require('internal/async_hooks').symbols;
|
||||
const { ERR_STREAM_WRAP } = require('internal/errors').codes;
|
||||
|
|
|
@ -99,7 +99,7 @@ function requireForUserSnapshot(id) {
|
|||
if (!BuiltinModule.canBeRequiredByUsers(id)) {
|
||||
// eslint-disable-next-line no-restricted-syntax
|
||||
const err = new Error(
|
||||
`Cannot find module '${id}'. `
|
||||
`Cannot find module '${id}'. `,
|
||||
);
|
||||
err.code = 'MODULE_NOT_FOUND';
|
||||
throw err;
|
||||
|
|
|
@ -91,7 +91,7 @@ function fold(text, width) {
|
|||
return RegExpPrototypeSymbolReplace(
|
||||
new RegExp(`([^\n]{0,${width}})( |$)`, 'g'),
|
||||
text,
|
||||
(_, newLine, end) => newLine + (end === ' ' ? '\n' : '')
|
||||
(_, newLine, end) => newLine + (end === ' ' ? '\n' : ''),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -115,7 +115,7 @@ function getArgDescription(type) {
|
|||
}
|
||||
|
||||
function format(
|
||||
{ options, aliases = new SafeMap(), firstColumn, secondColumn }
|
||||
{ options, aliases = new SafeMap(), firstColumn, secondColumn },
|
||||
) {
|
||||
let text = '';
|
||||
let maxFirstColumnUsed = 0;
|
||||
|
|
|
@ -167,7 +167,7 @@ port.on('message', (message) => {
|
|||
} else {
|
||||
assert(
|
||||
message.type === STDIO_WANTS_MORE_DATA,
|
||||
`Unknown worker message type ${message.type}`
|
||||
`Unknown worker message type ${message.type}`,
|
||||
);
|
||||
const { stream } = message;
|
||||
process[stream][kStdioWantsMoreDataCallback]();
|
||||
|
|
|
@ -194,21 +194,21 @@ class MIMEParams {
|
|||
const paramsMap = params.#data;
|
||||
const endOfSource = SafeStringPrototypeSearch(
|
||||
StringPrototypeSlice(str, position),
|
||||
START_ENDING_WHITESPACE
|
||||
START_ENDING_WHITESPACE,
|
||||
) + position;
|
||||
while (position < endOfSource) {
|
||||
// Skip any whitespace before parameter
|
||||
position += SafeStringPrototypeSearch(
|
||||
StringPrototypeSlice(str, position),
|
||||
END_BEGINNING_WHITESPACE
|
||||
END_BEGINNING_WHITESPACE,
|
||||
);
|
||||
// Read until ';' or '='
|
||||
const afterParameterName = SafeStringPrototypeSearch(
|
||||
StringPrototypeSlice(str, position),
|
||||
EQUALS_SEMICOLON_OR_END
|
||||
EQUALS_SEMICOLON_OR_END,
|
||||
) + position;
|
||||
const parameterString = toASCIILower(
|
||||
StringPrototypeSlice(str, position, afterParameterName)
|
||||
StringPrototypeSlice(str, position, afterParameterName),
|
||||
);
|
||||
position = afterParameterName;
|
||||
// If we found a terminating character
|
||||
|
@ -258,7 +258,7 @@ class MIMEParams {
|
|||
const trimmedValue = StringPrototypeSlice(
|
||||
rawValue,
|
||||
0,
|
||||
SafeStringPrototypeSearch(rawValue, START_ENDING_WHITESPACE)
|
||||
SafeStringPrototypeSearch(rawValue, START_ENDING_WHITESPACE),
|
||||
);
|
||||
// Ignore parameters without values
|
||||
if (trimmedValue === '') continue;
|
||||
|
|
|
@ -108,12 +108,12 @@ const {
|
|||
const packageJsonReader = require('internal/modules/package_json_reader');
|
||||
const { getOptionValue, getEmbedderOptions } = require('internal/options');
|
||||
const policy = getLazy(
|
||||
() => (getOptionValue('--experimental-policy') ? require('internal/process/policy') : null)
|
||||
() => (getOptionValue('--experimental-policy') ? require('internal/process/policy') : null),
|
||||
);
|
||||
const shouldReportRequiredModules = getLazy(() => process.env.WATCH_REPORT_DEPENDENCIES);
|
||||
|
||||
const getCascadedLoader = getLazy(
|
||||
() => require('internal/process/esm_loader').esmLoader
|
||||
() => require('internal/process/esm_loader').esmLoader,
|
||||
);
|
||||
|
||||
// Whether any user-provided CJS modules had been loaded (executed).
|
||||
|
@ -289,13 +289,13 @@ function initializeCJS() {
|
|||
getModuleParent,
|
||||
'module.parent is deprecated due to accuracy issues. Please use ' +
|
||||
'require.main to find program entry point instead.',
|
||||
'DEP0144'
|
||||
'DEP0144',
|
||||
) : getModuleParent,
|
||||
set: pendingDeprecation ? deprecate(
|
||||
setModuleParent,
|
||||
'module.parent is deprecated due to accuracy issues. Please use ' +
|
||||
'require.main to find program entry point instead.',
|
||||
'DEP0144'
|
||||
'DEP0144',
|
||||
) : setModuleParent,
|
||||
});
|
||||
Module._debug = deprecate(debug, 'Module._debug is deprecated.', 'DEP0077');
|
||||
|
@ -308,7 +308,7 @@ function initializeCJS() {
|
|||
}
|
||||
|
||||
const allBuiltins = new SafeSet(
|
||||
ArrayPrototypeFlatMap(builtinModules, (bm) => [bm, `node:${bm}`])
|
||||
ArrayPrototypeFlatMap(builtinModules, (bm) => [bm, `node:${bm}`]),
|
||||
);
|
||||
BuiltinModule.getSchemeOnlyModuleNames().forEach((builtin) => allBuiltins.add(`node:${builtin}`));
|
||||
ObjectFreeze(builtinModules);
|
||||
|
@ -418,7 +418,7 @@ function tryPackage(requestPath, exts, isMain, originalPath) {
|
|||
// eslint-disable-next-line no-restricted-syntax
|
||||
const err = new Error(
|
||||
`Cannot find module '${filename}'. ` +
|
||||
'Please verify that the package.json has a valid "main" entry'
|
||||
'Please verify that the package.json has a valid "main" entry',
|
||||
);
|
||||
err.code = 'MODULE_NOT_FOUND';
|
||||
err.path = path.resolve(requestPath, 'package.json');
|
||||
|
@ -431,7 +431,7 @@ function tryPackage(requestPath, exts, isMain, originalPath) {
|
|||
`Invalid 'main' field in '${jsonPath}' of '${pkg}'. ` +
|
||||
'Please either fix that or report it to the module author',
|
||||
'DeprecationWarning',
|
||||
'DEP0128'
|
||||
'DEP0128',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -712,7 +712,7 @@ if (isWindows) {
|
|||
if (p !== nmLen)
|
||||
ArrayPrototypePush(
|
||||
paths,
|
||||
StringPrototypeSlice(from, 0, last) + '\\node_modules'
|
||||
StringPrototypeSlice(from, 0, last) + '\\node_modules',
|
||||
);
|
||||
last = i;
|
||||
p = 0;
|
||||
|
@ -747,7 +747,7 @@ if (isWindows) {
|
|||
if (p !== nmLen)
|
||||
ArrayPrototypePush(
|
||||
paths,
|
||||
StringPrototypeSlice(from, 0, last) + '/node_modules'
|
||||
StringPrototypeSlice(from, 0, last) + '/node_modules',
|
||||
);
|
||||
last = i;
|
||||
p = 0;
|
||||
|
@ -818,7 +818,7 @@ Module._resolveLookupPaths = function(request, parent) {
|
|||
function emitCircularRequireWarning(prop) {
|
||||
process.emitWarning(
|
||||
`Accessing non-existent property '${String(prop)}' of module exports ` +
|
||||
'inside circular dependency'
|
||||
'inside circular dependency',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1393,7 +1393,7 @@ Module._initPaths = function() {
|
|||
if (nodePath) {
|
||||
ArrayPrototypeUnshiftApply(paths, ArrayPrototypeFilter(
|
||||
StringPrototypeSplit(nodePath, path.delimiter),
|
||||
Boolean
|
||||
Boolean,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -136,7 +136,7 @@ function fetchWithRedirects(parsed) {
|
|||
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
||||
res.headers.location,
|
||||
parsed.href,
|
||||
'cannot redirect to non-network location'
|
||||
'cannot redirect to non-network location',
|
||||
);
|
||||
}
|
||||
const entry = await fetchWithRedirects(location);
|
||||
|
@ -161,7 +161,7 @@ function fetchWithRedirects(parsed) {
|
|||
if (!contentType) {
|
||||
throw new ERR_NETWORK_IMPORT_BAD_RESPONSE(
|
||||
parsed.href,
|
||||
"the 'Content-Type' header is required"
|
||||
"the 'Content-Type' header is required",
|
||||
);
|
||||
}
|
||||
/**
|
||||
|
@ -252,7 +252,7 @@ function fetchModule(parsed, { parentURL }) {
|
|||
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
||||
href,
|
||||
parentURL,
|
||||
'http can only be used to load local resources (use https instead).'
|
||||
'http can only be used to load local resources (use https instead).',
|
||||
);
|
||||
}
|
||||
return fetchWithRedirects(parsed);
|
||||
|
|
|
@ -27,7 +27,7 @@ function mimeToFormat(mime) {
|
|||
if (
|
||||
RegExpPrototypeExec(
|
||||
/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i,
|
||||
mime
|
||||
mime,
|
||||
) !== null
|
||||
) return 'module';
|
||||
if (mime === 'application/json') return 'json';
|
||||
|
|
|
@ -86,7 +86,7 @@ function getHttpProtocolModuleFormat(url, context) {
|
|||
PromiseResolve(fetchModule(url, context)),
|
||||
(entry) => {
|
||||
return mimeToFormat(entry.headers['content-type']);
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -188,7 +188,7 @@ class Hooks {
|
|||
['getBuiltin', 'port', 'setImportMetaCallback'],
|
||||
{
|
||||
filename: '<preload>',
|
||||
}
|
||||
},
|
||||
);
|
||||
const { BuiltinModule } = require('internal/bootstrap/loaders');
|
||||
// We only allow replacing the importMetaInitializer during preload;
|
||||
|
@ -504,7 +504,7 @@ class Hooks {
|
|||
'a string, an ArrayBuffer, or a TypedArray',
|
||||
hookErrIdentifier,
|
||||
'source',
|
||||
source
|
||||
source,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -543,7 +543,7 @@ function pluckHooks({
|
|||
globalPreload ??= getGlobalPreloadCode;
|
||||
|
||||
process.emitWarning(
|
||||
'Loader hook "getGlobalPreloadCode" has been renamed to "globalPreload"'
|
||||
'Loader hook "getGlobalPreloadCode" has been renamed to "globalPreload"',
|
||||
);
|
||||
}
|
||||
if (dynamicInstantiate) {
|
||||
|
@ -630,7 +630,7 @@ function nextHookFactory(chain, meta, { validateArgs, validateOutput }) {
|
|||
// eslint-disable-next-line func-name-matching
|
||||
nextNextHook = function chainAdvancedTooFar() {
|
||||
throw new ERR_INTERNAL_ASSERTION(
|
||||
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`
|
||||
`ESM custom loader '${hookName}' advanced beyond the end of the chain.`,
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -16,7 +16,7 @@ function createImportMetaResolve(defaultParentUrl) {
|
|||
({ url }) => url,
|
||||
(error) => (
|
||||
error.code === 'ERR_UNSUPPORTED_DIR_IMPORT' ?
|
||||
error.url : PromiseReject(error))
|
||||
error.url : PromiseReject(error)),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
|
|
@ -116,7 +116,7 @@ class ESMLoader {
|
|||
|
||||
async eval(
|
||||
source,
|
||||
url = pathToFileURL(`${process.cwd()}/[eval${++this.evalIndex}]`).href
|
||||
url = pathToFileURL(`${process.cwd()}/[eval${++this.evalIndex}]`).href,
|
||||
) {
|
||||
const evalInstance = (url) => {
|
||||
const { ModuleWrap } = internalBinding('module_wrap');
|
||||
|
@ -234,7 +234,7 @@ class ESMLoader {
|
|||
importAssertions,
|
||||
moduleProvider,
|
||||
parentURL === undefined,
|
||||
inspectBrk
|
||||
inspectBrk,
|
||||
);
|
||||
|
||||
this.moduleMap.set(url, importAssertions.type, job);
|
||||
|
|
|
@ -42,7 +42,7 @@ const CJSGlobalLike = [
|
|||
const isCommonJSGlobalLikeNotDefinedError = (errorMessage) =>
|
||||
ArrayPrototypeSome(
|
||||
CJSGlobalLike,
|
||||
(globalLike) => errorMessage === `${globalLike} is not defined`
|
||||
(globalLike) => errorMessage === `${globalLike} is not defined`,
|
||||
);
|
||||
|
||||
/* A ModuleJob tracks the loading of a single Module, and the ModuleJobs of
|
||||
|
@ -135,7 +135,7 @@ class ModuleJob {
|
|||
const parentFileUrl = RegExpPrototypeSymbolReplace(
|
||||
/:\d+$/,
|
||||
splitStack[0],
|
||||
''
|
||||
'',
|
||||
);
|
||||
const { 1: childSpecifier, 2: name } = RegExpPrototypeExec(
|
||||
/module '(.*)' does not provide an export named '(.+)'/,
|
||||
|
|
|
@ -64,7 +64,7 @@ function getPackageConfig(path, specifier, base) {
|
|||
throw new ERR_INVALID_PACKAGE_CONFIG(
|
||||
path,
|
||||
(base ? `"${specifier}" from ` : '') + fileURLToPath(base || specifier),
|
||||
error.message
|
||||
error.message,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -78,7 +78,7 @@ function emitTrailingSlashPatternDeprecation(match, pjsonUrl, base) {
|
|||
base ? ` imported from ${fileURLToPath(base)}` :
|
||||
''}. Mapping specifiers ending in "/" is no longer supported.`,
|
||||
'DeprecationWarning',
|
||||
'DEP0155'
|
||||
'DEP0155',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -94,7 +94,7 @@ function emitInvalidSegmentDeprecation(target, request, match, pjsonUrl, interna
|
|||
}in the "${internal ? 'imports' : 'exports'}" field module resolution of the package at ${
|
||||
pjsonPath}${base ? ` imported from ${fileURLToPath(base)}` : ''}.`,
|
||||
'DeprecationWarning',
|
||||
'DEP0166'
|
||||
'DEP0166',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -120,7 +120,7 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) {
|
|||
basePath}.\n Automatic extension resolution of the "main" field is ` +
|
||||
'deprecated for ES modules.',
|
||||
'DeprecationWarning',
|
||||
'DEP0151'
|
||||
'DEP0151',
|
||||
);
|
||||
else
|
||||
process.emitWarning(
|
||||
|
@ -129,7 +129,7 @@ function emitLegacyIndexDeprecation(url, packageJSONUrl, base, main) {
|
|||
StringPrototypeSlice(path, pkgPath.length)}", imported from ${basePath
|
||||
}.\nDefault "index" lookups for the main are deprecated for ES modules.`,
|
||||
'DeprecationWarning',
|
||||
'DEP0151'
|
||||
'DEP0151',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -391,7 +391,7 @@ function resolvePackageTargetString(
|
|||
|
||||
if (pattern) {
|
||||
return new URL(
|
||||
RegExpPrototypeSymbolReplace(patternRegEx, resolved.href, () => subpath)
|
||||
RegExpPrototypeSymbolReplace(patternRegEx, resolved.href, () => subpath),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -539,7 +539,7 @@ function packageExportsResolve(
|
|||
const target = exports[packageSubpath];
|
||||
const resolveResult = resolvePackageTarget(
|
||||
packageJSONUrl, target, '', packageSubpath, base, false, false, false,
|
||||
conditions
|
||||
conditions,
|
||||
);
|
||||
|
||||
if (resolveResult == null) {
|
||||
|
@ -638,7 +638,7 @@ function packageImportsResolve(name, base, conditions) {
|
|||
!StringPrototypeIncludes(name, '*')) {
|
||||
const resolveResult = resolvePackageTarget(
|
||||
packageJSONUrl, imports[name], '', name, base, false, true, false,
|
||||
conditions
|
||||
conditions,
|
||||
);
|
||||
if (resolveResult != null) {
|
||||
return resolveResult;
|
||||
|
@ -781,7 +781,7 @@ function packageResolve(specifier, base, conditions) {
|
|||
return legacyMainResolve(
|
||||
packageJSONUrl,
|
||||
packageConfig,
|
||||
base
|
||||
base,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -913,7 +913,7 @@ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) {
|
|||
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
||||
specifier,
|
||||
parsedParentURL,
|
||||
'remote imports cannot import from a local location.'
|
||||
'remote imports cannot import from a local location.',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -924,14 +924,14 @@ function checkIfDisallowedImport(specifier, parsed, parsedParentURL) {
|
|||
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
||||
specifier,
|
||||
parsedParentURL,
|
||||
'remote imports cannot import from a local location.'
|
||||
'remote imports cannot import from a local location.',
|
||||
);
|
||||
}
|
||||
|
||||
throw new ERR_NETWORK_IMPORT_DISALLOWED(
|
||||
specifier,
|
||||
parsedParentURL,
|
||||
'only relative and absolute specifiers are supported.'
|
||||
'only relative and absolute specifiers are supported.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -986,7 +986,7 @@ async function defaultResolve(specifier, context = {}) {
|
|||
reaction(new ERR_MANIFEST_DEPENDENCY_MISSING(
|
||||
parentURL,
|
||||
specifier,
|
||||
ArrayPrototypeJoin([...conditions], ', '))
|
||||
ArrayPrototypeJoin([...conditions], ', ')),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1059,7 +1059,7 @@ async function defaultResolve(specifier, context = {}) {
|
|||
specifier,
|
||||
parentURL,
|
||||
conditions,
|
||||
isMain ? preserveSymlinksMain : preserveSymlinks
|
||||
isMain ? preserveSymlinksMain : preserveSymlinks,
|
||||
);
|
||||
} catch (error) {
|
||||
// Try to give the user a hint of what would have been the
|
||||
|
@ -1113,7 +1113,7 @@ if (policy) {
|
|||
const $defaultResolve = defaultResolve;
|
||||
module.exports.defaultResolve = async function defaultResolve(
|
||||
specifier,
|
||||
context
|
||||
context,
|
||||
) {
|
||||
const ret = await $defaultResolve(specifier, context);
|
||||
// This is a preflight check to avoid data exfiltration by query params etc.
|
||||
|
@ -1121,8 +1121,8 @@ if (policy) {
|
|||
new ERR_MANIFEST_DEPENDENCY_MISSING(
|
||||
context.parentURL,
|
||||
specifier,
|
||||
context.conditions
|
||||
)
|
||||
context.conditions,
|
||||
),
|
||||
);
|
||||
return ret;
|
||||
};
|
||||
|
|
|
@ -84,7 +84,7 @@ function assertBufferSource(body, allowString, hookName) {
|
|||
`${allowString ? 'string, ' : ''}array buffer, or typed array`,
|
||||
hookName,
|
||||
'source',
|
||||
body
|
||||
body,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -136,7 +136,7 @@ function enrichCJSError(err, content, filename) {
|
|||
// asynchronous warning would be emitted.
|
||||
emitWarningSync(
|
||||
'To load an ES module, set "type": "module" in the package.json or use ' +
|
||||
'the .mjs extension.'
|
||||
'the .mjs extension.',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,7 +102,7 @@ function makeRequireFunction(mod, redirects) {
|
|||
reaction(new ERR_MANIFEST_DEPENDENCY_MISSING(
|
||||
id,
|
||||
specifier,
|
||||
ArrayPrototypeJoin([...conditions], ', ')
|
||||
ArrayPrototypeJoin([...conditions], ', '),
|
||||
));
|
||||
}
|
||||
return mod.require(specifier);
|
||||
|
|
|
@ -19,7 +19,7 @@ function read(jsonPath) {
|
|||
}
|
||||
|
||||
const { 0: string, 1: containsKeys } = internalModuleReadJSON(
|
||||
toNamespacedPath(jsonPath)
|
||||
toNamespacedPath(jsonPath),
|
||||
);
|
||||
const result = { string, containsKeys };
|
||||
const { getOptionValue } = require('internal/options');
|
||||
|
|
|
@ -330,11 +330,11 @@ const createSafeIterator = (factory, next) => {
|
|||
|
||||
primordials.SafeArrayIterator = createSafeIterator(
|
||||
primordials.ArrayPrototypeSymbolIterator,
|
||||
primordials.ArrayIteratorPrototypeNext
|
||||
primordials.ArrayIteratorPrototypeNext,
|
||||
);
|
||||
primordials.SafeStringIterator = createSafeIterator(
|
||||
primordials.StringPrototypeSymbolIterator,
|
||||
primordials.StringIteratorPrototypeNext
|
||||
primordials.StringIteratorPrototypeNext,
|
||||
);
|
||||
|
||||
const copyProps = (src, dest) => {
|
||||
|
@ -394,26 +394,26 @@ primordials.SafeMap = makeSafe(
|
|||
Map,
|
||||
class SafeMap extends Map {
|
||||
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
|
||||
}
|
||||
},
|
||||
);
|
||||
primordials.SafeWeakMap = makeSafe(
|
||||
WeakMap,
|
||||
class SafeWeakMap extends WeakMap {
|
||||
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
primordials.SafeSet = makeSafe(
|
||||
Set,
|
||||
class SafeSet extends Set {
|
||||
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
|
||||
}
|
||||
},
|
||||
);
|
||||
primordials.SafeWeakSet = makeSafe(
|
||||
WeakSet,
|
||||
class SafeWeakSet extends WeakSet {
|
||||
constructor(i) { super(i); } // eslint-disable-line no-useless-constructor
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
primordials.SafeFinalizationRegistry = makeSafe(
|
||||
|
@ -421,14 +421,14 @@ primordials.SafeFinalizationRegistry = makeSafe(
|
|||
class SafeFinalizationRegistry extends FinalizationRegistry {
|
||||
// eslint-disable-next-line no-useless-constructor
|
||||
constructor(cleanupCallback) { super(cleanupCallback); }
|
||||
}
|
||||
},
|
||||
);
|
||||
primordials.SafeWeakRef = makeSafe(
|
||||
WeakRef,
|
||||
class SafeWeakRef extends WeakRef {
|
||||
// eslint-disable-next-line no-useless-constructor
|
||||
constructor(target) { super(target); }
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
const SafePromise = makeSafe(
|
||||
|
@ -436,7 +436,7 @@ const SafePromise = makeSafe(
|
|||
class SafePromise extends Promise {
|
||||
// eslint-disable-next-line no-useless-constructor
|
||||
constructor(executor) { super(executor); }
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -454,7 +454,7 @@ primordials.SafePromisePrototypeFinally = (thisPromise, onFinally) =>
|
|||
new Promise((a, b) =>
|
||||
new SafePromise((a, b) => PromisePrototypeThen(thisPromise, a, b))
|
||||
.finally(onFinally)
|
||||
.then(a, b)
|
||||
.then(a, b),
|
||||
);
|
||||
|
||||
primordials.AsyncIteratorPrototype =
|
||||
|
@ -467,8 +467,8 @@ const arrayToSafePromiseIterable = (promises, mapFn) =>
|
|||
ArrayPrototypeMap(
|
||||
promises,
|
||||
(promise, i) =>
|
||||
new SafePromise((a, b) => PromisePrototypeThen(mapFn == null ? promise : mapFn(promise, i), a, b))
|
||||
)
|
||||
new SafePromise((a, b) => PromisePrototypeThen(mapFn == null ? promise : mapFn(promise, i), a, b)),
|
||||
),
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -481,7 +481,7 @@ primordials.SafePromiseAll = (promises, mapFn) =>
|
|||
// Wrapping on a new Promise is necessary to not expose the SafePromise
|
||||
// prototype to user-land.
|
||||
new Promise((a, b) =>
|
||||
SafePromise.all(arrayToSafePromiseIterable(promises, mapFn)).then(a, b)
|
||||
SafePromise.all(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -541,7 +541,7 @@ primordials.SafePromiseAllSettled = (promises, mapFn) =>
|
|||
// Wrapping on a new Promise is necessary to not expose the SafePromise
|
||||
// prototype to user-land.
|
||||
new Promise((a, b) =>
|
||||
SafePromise.allSettled(arrayToSafePromiseIterable(promises, mapFn)).then(a, b)
|
||||
SafePromise.allSettled(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -572,7 +572,7 @@ primordials.SafePromiseAny = (promises, mapFn) =>
|
|||
// Wrapping on a new Promise is necessary to not expose the SafePromise
|
||||
// prototype to user-land.
|
||||
new Promise((a, b) =>
|
||||
SafePromise.any(arrayToSafePromiseIterable(promises, mapFn)).then(a, b)
|
||||
SafePromise.any(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -585,7 +585,7 @@ primordials.SafePromiseRace = (promises, mapFn) =>
|
|||
// Wrapping on a new Promise is necessary to not expose the SafePromise
|
||||
// prototype to user-land.
|
||||
new Promise((a, b) =>
|
||||
SafePromise.race(arrayToSafePromiseIterable(promises, mapFn)).then(a, b)
|
||||
SafePromise.race(arrayToSafePromiseIterable(promises, mapFn)).then(a, b),
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -15,7 +15,7 @@ function eventLoopUtilization(util1, util2) {
|
|||
milestones[NODE_PERFORMANCE_MILESTONE_LOOP_START] / 1e6,
|
||||
loopIdleTime(),
|
||||
util1,
|
||||
util2
|
||||
util2,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -453,7 +453,7 @@ function bufferResourceTiming(entry) {
|
|||
// Calculate the number of items to be pushed to the global buffer.
|
||||
const numbersToPreserve = MathMax(
|
||||
MathMin(resourceTimingBufferSizeLimit - resourceTimingBuffer.length, resourceTimingSecondaryBuffer.length),
|
||||
0
|
||||
0,
|
||||
);
|
||||
const excessNumberAfter = resourceTimingSecondaryBuffer.length - numbersToPreserve;
|
||||
for (let idx = 0; idx < numbersToPreserve; idx++) {
|
||||
|
|
|
@ -37,7 +37,7 @@ const BufferToString = uncurryThis(Buffer.prototype.toString);
|
|||
const kRelativeURLStringPattern = /^\.{0,2}\//;
|
||||
const { getOptionValue } = require('internal/options');
|
||||
const shouldAbortOnUncaughtException = getOptionValue(
|
||||
'--abort-on-uncaught-exception'
|
||||
'--abort-on-uncaught-exception',
|
||||
);
|
||||
const { exitCodes: { kGenericUserError } } = internalBinding('errors');
|
||||
|
||||
|
@ -139,7 +139,7 @@ class DependencyMapperInstance {
|
|||
if (!target) {
|
||||
throw new ERR_MANIFEST_INVALID_SPECIFIER(
|
||||
this.href,
|
||||
`${target}, pattern needs to have a single trailing "*" in target`
|
||||
`${target}, pattern needs to have a single trailing "*" in target`,
|
||||
);
|
||||
}
|
||||
const prefix = target[1];
|
||||
|
@ -193,7 +193,7 @@ class DependencyMapperInstance {
|
|||
const to = searchDependencies(
|
||||
this.href,
|
||||
dependencies[normalizedSpecifier],
|
||||
conditions
|
||||
conditions,
|
||||
);
|
||||
debug({ to });
|
||||
if (to === true) {
|
||||
|
@ -218,7 +218,7 @@ class DependencyMapperInstance {
|
|||
if (parentDependencyMapper === undefined) {
|
||||
parentDependencyMapper = manifest.getScopeDependencyMapper(
|
||||
this.href,
|
||||
this.allowSameHREFScope
|
||||
this.allowSameHREFScope,
|
||||
);
|
||||
this.#parentDependencyMapper = parentDependencyMapper;
|
||||
}
|
||||
|
@ -228,7 +228,7 @@ class DependencyMapperInstance {
|
|||
return parentDependencyMapper._resolveAlreadyNormalized(
|
||||
normalizedSpecifier,
|
||||
conditions,
|
||||
manifest
|
||||
manifest,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -237,13 +237,13 @@ const kArbitraryDependencies = new DependencyMapperInstance(
|
|||
'arbitrary dependencies',
|
||||
kFallThrough,
|
||||
false,
|
||||
true
|
||||
true,
|
||||
);
|
||||
const kNoDependencies = new DependencyMapperInstance(
|
||||
'no dependencies',
|
||||
null,
|
||||
false,
|
||||
true
|
||||
true,
|
||||
);
|
||||
/**
|
||||
* @param {string} href
|
||||
|
@ -257,7 +257,7 @@ const insertDependencyMap = (
|
|||
dependencies,
|
||||
cascade,
|
||||
allowSameHREFScope,
|
||||
store
|
||||
store,
|
||||
) => {
|
||||
if (cascade !== undefined && typeof cascade !== 'boolean') {
|
||||
throw new ERR_MANIFEST_INVALID_RESOURCE_FIELD(href, 'cascade');
|
||||
|
@ -271,7 +271,7 @@ const insertDependencyMap = (
|
|||
href,
|
||||
cascade ?
|
||||
new DependencyMapperInstance(href, null, true, allowSameHREFScope) :
|
||||
kNoDependencies
|
||||
kNoDependencies,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -282,8 +282,8 @@ const insertDependencyMap = (
|
|||
href,
|
||||
dependencies,
|
||||
cascade,
|
||||
allowSameHREFScope
|
||||
)
|
||||
allowSameHREFScope,
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -442,7 +442,7 @@ class Manifest {
|
|||
|
||||
this.#reaction = reaction;
|
||||
const jsonResourcesEntries = ObjectEntries(
|
||||
obj.resources ?? { __proto__: null }
|
||||
obj.resources ?? { __proto__: null },
|
||||
);
|
||||
const jsonScopesEntries = ObjectEntries(obj.scopes ?? { __proto__: null });
|
||||
const defaultDependencies = obj.dependencies ?? { __proto__: null };
|
||||
|
@ -450,7 +450,7 @@ class Manifest {
|
|||
this.#defaultDependencies = new DependencyMapperInstance(
|
||||
'default',
|
||||
defaultDependencies === true ? kFallThrough : defaultDependencies,
|
||||
false
|
||||
false,
|
||||
);
|
||||
|
||||
for (let i = 0; i < jsonResourcesEntries.length; i++) {
|
||||
|
@ -475,7 +475,7 @@ class Manifest {
|
|||
dependencies,
|
||||
cascade,
|
||||
true,
|
||||
resourceDependencies
|
||||
resourceDependencies,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -519,12 +519,12 @@ class Manifest {
|
|||
resolve: (specifier, conditions) => {
|
||||
const normalizedSpecifier = canonicalizeSpecifier(
|
||||
specifier,
|
||||
requesterHREF
|
||||
requesterHREF,
|
||||
);
|
||||
const result = instance._resolveAlreadyNormalized(
|
||||
normalizedSpecifier,
|
||||
conditions,
|
||||
this
|
||||
this,
|
||||
);
|
||||
if (result === kFallThrough) return true;
|
||||
return result;
|
||||
|
@ -640,7 +640,7 @@ class Manifest {
|
|||
const scopeHREF = findScopeHREF(
|
||||
href,
|
||||
this.#scopeDependencies,
|
||||
allowSameHREFScope
|
||||
allowSameHREFScope,
|
||||
);
|
||||
if (scopeHREF === null) return this.#defaultDependencies;
|
||||
return this.#scopeDependencies.get(scopeHREF);
|
||||
|
@ -694,7 +694,7 @@ const emptyOrProtocolOrResolve = (resourceHREF, base) => {
|
|||
// eslint-disable-next-line
|
||||
/^[\x00-\x1F\x20]|\x09\x0A\x0D|[\x00-\x1F\x20]$/g,
|
||||
resourceHREF,
|
||||
''
|
||||
'',
|
||||
);
|
||||
if (RegExpPrototypeExec(/^[a-zA-Z][a-zA-Z+\-.]*:$/, resourceHREF) !== null) {
|
||||
return resourceHREF;
|
||||
|
|
|
@ -99,7 +99,7 @@ exports.loadESM = async function loadESM(callback) {
|
|||
}
|
||||
internalBinding('errors').triggerUncaughtException(
|
||||
err,
|
||||
true /* fromPromise */
|
||||
true, /* fromPromise */
|
||||
);
|
||||
}
|
||||
};
|
||||
|
|
|
@ -371,7 +371,7 @@ function buildAllowedFlags() {
|
|||
forEach(callback, thisArg = undefined) {
|
||||
ArrayPrototypeForEach(
|
||||
this[kInternal].array,
|
||||
(v) => ReflectApply(callback, thisArg, [v, v, this])
|
||||
(v) => ReflectApply(callback, thisArg, [v, v, this]),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -399,7 +399,7 @@ function buildAllowedFlags() {
|
|||
ObjectFreeze(NodeEnvironmentFlagsSet.prototype);
|
||||
|
||||
return ObjectFreeze(new NodeEnvironmentFlagsSet(
|
||||
allowedNodeEnvironmentFlags
|
||||
allowedNodeEnvironmentFlags,
|
||||
));
|
||||
}
|
||||
|
||||
|
|
|
@ -280,11 +280,11 @@ function setupWebCrypto() {
|
|||
if (this !== globalThis && this != null)
|
||||
throw new ERR_INVALID_THIS(
|
||||
'nullish or must be the global object');
|
||||
}
|
||||
},
|
||||
);
|
||||
exposeLazyInterfaces(
|
||||
globalThis, 'internal/crypto/webcrypto',
|
||||
['Crypto', 'CryptoKey', 'SubtleCrypto']
|
||||
['Crypto', 'CryptoKey', 'SubtleCrypto'],
|
||||
);
|
||||
} else {
|
||||
ObjectDefineProperty(globalThis, 'crypto',
|
||||
|
|
|
@ -130,7 +130,7 @@ function promiseRejectHandler(type, promise, reason) {
|
|||
const multipleResolvesDeprecate = deprecate(
|
||||
() => {},
|
||||
'The multipleResolves event has been deprecated.',
|
||||
'DEP0160'
|
||||
'DEP0160',
|
||||
);
|
||||
function resolveError(type, promise, reason) {
|
||||
// We have to wrap this in a next tick. Otherwise the error could be caught by
|
||||
|
@ -193,7 +193,7 @@ function emitUnhandledRejectionWarning(uid, reason) {
|
|||
'To terminate the node process on unhandled promise ' +
|
||||
'rejection, use the CLI flag `--unhandled-rejections=strict` (see ' +
|
||||
'https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). ' +
|
||||
`(rejection id: ${uid})`
|
||||
`(rejection id: ${uid})`,
|
||||
);
|
||||
try {
|
||||
if (isErrorLike(reason)) {
|
||||
|
@ -250,7 +250,7 @@ function processPromiseRejections() {
|
|||
pushAsyncContext(
|
||||
promiseAsyncId,
|
||||
promiseTriggerAsyncId,
|
||||
promise
|
||||
promise,
|
||||
);
|
||||
}
|
||||
try {
|
||||
|
@ -264,7 +264,7 @@ function processPromiseRejections() {
|
|||
pushAsyncContext(
|
||||
promise[kAsyncIdSymbol],
|
||||
promise[kTriggerAsyncIdSymbol],
|
||||
promise
|
||||
promise,
|
||||
);
|
||||
}
|
||||
const handled = emit(reason, promise, promiseInfo);
|
||||
|
|
|
@ -151,7 +151,7 @@ function queueMicrotask(callback) {
|
|||
|
||||
const asyncResource = new AsyncResource(
|
||||
'Microtask',
|
||||
defaultMicrotaskResourceOpts
|
||||
defaultMicrotaskResourceOpts,
|
||||
);
|
||||
asyncResource.callback = callback;
|
||||
|
||||
|
|
|
@ -169,7 +169,7 @@ function InterfaceConstructor(input, output, completer, terminal) {
|
|||
} else {
|
||||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'input.escapeCodeTimeout',
|
||||
this.escapeCodeTimeout
|
||||
this.escapeCodeTimeout,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -625,7 +625,7 @@ class Interface extends InterfaceConstructor {
|
|||
const end = StringPrototypeSlice(
|
||||
this.line,
|
||||
this.cursor,
|
||||
this.line.length
|
||||
this.line.length,
|
||||
);
|
||||
this.line = beg + c + end;
|
||||
this.cursor += c.length;
|
||||
|
@ -668,7 +668,7 @@ class Interface extends InterfaceConstructor {
|
|||
|
||||
// If there is a common prefix to all matches, then apply that portion.
|
||||
const prefix = commonPrefix(
|
||||
ArrayPrototypeFilter(completions, (e) => e !== '')
|
||||
ArrayPrototypeFilter(completions, (e) => e !== ''),
|
||||
);
|
||||
if (StringPrototypeStartsWith(prefix, completeOn) &&
|
||||
prefix.length > completeOn.length) {
|
||||
|
@ -695,7 +695,7 @@ class Interface extends InterfaceConstructor {
|
|||
|
||||
// Apply/show completions.
|
||||
const completionsWidth = ArrayPrototypeMap(completions, (e) =>
|
||||
getStringWidth(e)
|
||||
getStringWidth(e),
|
||||
);
|
||||
const width = MathMaxApply(completionsWidth) + 2; // 2 space padding
|
||||
let maxColumns = MathFloor(this.columns / width) || 1;
|
||||
|
@ -736,7 +736,7 @@ class Interface extends InterfaceConstructor {
|
|||
const leading = StringPrototypeSlice(this.line, 0, this.cursor);
|
||||
const reversed = ArrayPrototypeJoin(
|
||||
ArrayPrototypeReverse(ArrayFrom(leading)),
|
||||
''
|
||||
'',
|
||||
);
|
||||
const match = RegExpPrototypeExec(/^\s*(?:[^\w\s]+|\w+)?/, reversed);
|
||||
this[kMoveCursor](-match[0].length);
|
||||
|
@ -775,7 +775,7 @@ class Interface extends InterfaceConstructor {
|
|||
StringPrototypeSlice(
|
||||
this.line,
|
||||
this.cursor + charSize,
|
||||
this.line.length
|
||||
this.line.length,
|
||||
);
|
||||
this[kRefreshLine]();
|
||||
}
|
||||
|
@ -789,13 +789,13 @@ class Interface extends InterfaceConstructor {
|
|||
let leading = StringPrototypeSlice(this.line, 0, this.cursor);
|
||||
const reversed = ArrayPrototypeJoin(
|
||||
ArrayPrototypeReverse(ArrayFrom(leading)),
|
||||
''
|
||||
'',
|
||||
);
|
||||
const match = RegExpPrototypeExec(/^\s*(?:[^\w\s]+|\w+)?/, reversed);
|
||||
leading = StringPrototypeSlice(
|
||||
leading,
|
||||
0,
|
||||
leading.length - match[0].length
|
||||
leading.length - match[0].length,
|
||||
);
|
||||
this.line =
|
||||
leading +
|
||||
|
@ -1073,7 +1073,7 @@ class Interface extends InterfaceConstructor {
|
|||
this[kSubstringSearch] = StringPrototypeSlice(
|
||||
this.line,
|
||||
0,
|
||||
this.cursor
|
||||
this.cursor,
|
||||
);
|
||||
}
|
||||
} else if (this[kSubstringSearch] !== null) {
|
||||
|
|
|
@ -336,7 +336,7 @@ function* emitKeys(stream) {
|
|||
} else if (!escaped && ch <= '\x1a') {
|
||||
// ctrl+letter
|
||||
key.name = StringFromCharCode(
|
||||
StringPrototypeCharCodeAt(ch) + StringPrototypeCharCodeAt('a') - 1
|
||||
StringPrototypeCharCodeAt(ch) + StringPrototypeCharCodeAt('a') - 1,
|
||||
);
|
||||
key.ctrl = true;
|
||||
} else if (RegExpPrototypeExec(/^[0-9A-Za-z]$/, ch) !== null) {
|
||||
|
|
|
@ -33,7 +33,7 @@ const visitorsWithoutAncestors = {
|
|||
state.prepend(node, `${node.id.name}=`);
|
||||
ArrayPrototypePush(
|
||||
state.hoistedDeclarationStatements,
|
||||
`let ${node.id.name}; `
|
||||
`let ${node.id.name}; `,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -49,7 +49,7 @@ const visitorsWithoutAncestors = {
|
|||
state.prepend(node, `this.${node.id.name} = ${node.id.name}; `);
|
||||
ArrayPrototypePush(
|
||||
state.hoistedDeclarationStatements,
|
||||
`var ${node.id.name}; `
|
||||
`var ${node.id.name}; `,
|
||||
);
|
||||
},
|
||||
FunctionExpression: noop,
|
||||
|
@ -67,7 +67,7 @@ const visitorsWithoutAncestors = {
|
|||
const variableKind = node.kind;
|
||||
const isIterableForDeclaration = ArrayPrototypeIncludes(
|
||||
['ForOfStatement', 'ForInStatement'],
|
||||
state.ancestors[state.ancestors.length - 2].type
|
||||
state.ancestors[state.ancestors.length - 2].type,
|
||||
);
|
||||
|
||||
if (variableKind === 'var' || isTopLevelDeclaration(state)) {
|
||||
|
@ -76,7 +76,7 @@ const visitorsWithoutAncestors = {
|
|||
node.start + variableKind.length + (isIterableForDeclaration ? 1 : 0),
|
||||
variableKind === 'var' && isIterableForDeclaration ?
|
||||
'' :
|
||||
'void' + (node.declarations.length === 1 ? '' : ' (')
|
||||
'void' + (node.declarations.length === 1 ? '' : ' ('),
|
||||
);
|
||||
|
||||
if (!isIterableForDeclaration) {
|
||||
|
@ -99,7 +99,7 @@ const visitorsWithoutAncestors = {
|
|||
case 'Identifier':
|
||||
ArrayPrototypePush(
|
||||
variableIdentifiersToHoist[variableKind === 'var' ? 0 : 1][1],
|
||||
node.name
|
||||
node.name,
|
||||
);
|
||||
break;
|
||||
case 'ObjectPattern':
|
||||
|
@ -125,10 +125,10 @@ const visitorsWithoutAncestors = {
|
|||
if (identifiers.length > 0) {
|
||||
ArrayPrototypePush(
|
||||
state.hoistedDeclarationStatements,
|
||||
`${kind} ${ArrayPrototypeJoin(identifiers, ', ')}; `
|
||||
`${kind} ${ArrayPrototypeJoin(identifiers, ', ')}; `,
|
||||
);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -167,7 +167,7 @@ function _replHistoryMessage() {
|
|||
this,
|
||||
'\nPersistent history support disabled. ' +
|
||||
'Set the NODE_REPL_HISTORY environment\nvariable to ' +
|
||||
'a valid, user-writable path to enable.\n'
|
||||
'a valid, user-writable path to enable.\n',
|
||||
);
|
||||
}
|
||||
this._historyPrev = Interface.prototype._historyPrev;
|
||||
|
|
|
@ -123,7 +123,7 @@ function isRecoverableError(e, code) {
|
|||
super.raise(pos, message);
|
||||
}
|
||||
};
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// Try to parse the code with acorn. If the parse fails, ignore the acorn
|
||||
|
@ -291,7 +291,7 @@ function setupPreview(repl, contextSymbol, bufferSymbol, active) {
|
|||
(e) => StringPrototypeReplaceAll(
|
||||
StringPrototypeToLowerCase(e),
|
||||
'_',
|
||||
'-'
|
||||
'-',
|
||||
)),
|
||||
'--use-strict');
|
||||
}
|
||||
|
|
|
@ -115,7 +115,7 @@ function getOriginalSymbolName(sourceMap, trace, curIndex) {
|
|||
// First check for a symbol name associated with the enclosing function:
|
||||
const enclosingEntry = sourceMap.findEntry(
|
||||
trace[curIndex].getEnclosingLineNumber() - 1,
|
||||
trace[curIndex].getEnclosingColumnNumber() - 1
|
||||
trace[curIndex].getEnclosingColumnNumber() - 1,
|
||||
);
|
||||
if (enclosingEntry.name) return enclosingEntry.name;
|
||||
// Fallback to using the symbol name attached to the next stack frame:
|
||||
|
@ -124,7 +124,7 @@ function getOriginalSymbolName(sourceMap, trace, curIndex) {
|
|||
if (nextCallSite && currentFileName === nextCallSite.getFileName()) {
|
||||
const { name } = sourceMap.findEntry(
|
||||
nextCallSite.getLineNumber() - 1,
|
||||
nextCallSite.getColumnNumber() - 1
|
||||
nextCallSite.getColumnNumber() - 1,
|
||||
);
|
||||
return name;
|
||||
}
|
||||
|
@ -137,14 +137,14 @@ function getErrorSource(
|
|||
sourceMap,
|
||||
originalSourcePath,
|
||||
originalLine,
|
||||
originalColumn
|
||||
originalColumn,
|
||||
) {
|
||||
const originalSourcePathNoScheme =
|
||||
StringPrototypeStartsWith(originalSourcePath, 'file://') ?
|
||||
fileURLToPath(originalSourcePath) : originalSourcePath;
|
||||
const source = getOriginalSource(
|
||||
sourceMap.payload,
|
||||
originalSourcePath
|
||||
originalSourcePath,
|
||||
);
|
||||
if (typeof source !== 'string') {
|
||||
return;
|
||||
|
|
|
@ -264,7 +264,7 @@ class SourceMap {
|
|||
ArrayPrototypePush(
|
||||
this.#mappings,
|
||||
[lineNumber, columnNumber, sourceURL, sourceLineNumber,
|
||||
sourceColumnNumber, name]
|
||||
sourceColumnNumber, name],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,14 +45,14 @@ module.exports = function compose(...streams) {
|
|||
throw new ERR_INVALID_ARG_VALUE(
|
||||
`streams[${n}]`,
|
||||
orgStreams[n],
|
||||
'must be readable'
|
||||
'must be readable',
|
||||
);
|
||||
}
|
||||
if (n > 0 && !isWritable(streams[n])) {
|
||||
throw new ERR_INVALID_ARG_VALUE(
|
||||
`streams[${n}]`,
|
||||
orgStreams[n],
|
||||
'must be writable'
|
||||
'must be writable',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -109,7 +109,7 @@ module.exports = function duplexify(body, name) {
|
|||
},
|
||||
(err) => {
|
||||
destroyer(d, err);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return d = new Duplexify({
|
||||
|
@ -186,7 +186,7 @@ module.exports = function duplexify(body, name) {
|
|||
},
|
||||
(err) => {
|
||||
destroyer(d, err);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
return d = new Duplexify({
|
||||
|
|
|
@ -288,7 +288,7 @@ function eosWeb(stream, options, callback) {
|
|||
PromisePrototypeThen(
|
||||
stream[kIsClosedPromise].promise,
|
||||
resolverFn,
|
||||
resolverFn
|
||||
resolverFn,
|
||||
);
|
||||
return nop;
|
||||
}
|
||||
|
|
|
@ -56,7 +56,7 @@ function compose(stream, options) {
|
|||
// Not validating as we already validated before
|
||||
addAbortSignalNoValidate(
|
||||
options.signal,
|
||||
composedStream
|
||||
composedStream,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -679,7 +679,7 @@ Readable.prototype.pipe = function(dest, pipeOpts) {
|
|||
if (!state.multiAwaitDrain) {
|
||||
state.multiAwaitDrain = true;
|
||||
state.awaitDrainWriters = new SafeSet(
|
||||
state.awaitDrainWriters ? [state.awaitDrainWriters] : []
|
||||
state.awaitDrainWriters ? [state.awaitDrainWriters] : [],
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -221,15 +221,15 @@ class TestCoverage {
|
|||
|
||||
coverageSummary.totals.coveredLinePercent = toPercentage(
|
||||
coverageSummary.totals.coveredLineCount,
|
||||
coverageSummary.totals.totalLineCount
|
||||
coverageSummary.totals.totalLineCount,
|
||||
);
|
||||
coverageSummary.totals.coveredBranchPercent = toPercentage(
|
||||
coverageSummary.totals.coveredBranchCount,
|
||||
coverageSummary.totals.totalBranchCount
|
||||
coverageSummary.totals.totalBranchCount,
|
||||
);
|
||||
coverageSummary.totals.coveredFunctionPercent = toPercentage(
|
||||
coverageSummary.totals.coveredFunctionCount,
|
||||
coverageSummary.totals.totalFunctionCount
|
||||
coverageSummary.totals.totalFunctionCount,
|
||||
);
|
||||
coverageSummary.files.sort(sortCoverageFiles);
|
||||
|
||||
|
|
|
@ -161,7 +161,7 @@ class MockTracker {
|
|||
|
||||
if (setter && getter) {
|
||||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'options.setter', setter, "cannot be used with 'options.getter'"
|
||||
'options.setter', setter, "cannot be used with 'options.getter'",
|
||||
);
|
||||
}
|
||||
const descriptor = findMethodOnPrototypeChain(objectOrFunction, methodName);
|
||||
|
@ -178,7 +178,7 @@ class MockTracker {
|
|||
|
||||
if (typeof original !== 'function') {
|
||||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'methodName', original, 'must be a method'
|
||||
'methodName', original, 'must be a method',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -213,7 +213,7 @@ class MockTracker {
|
|||
object,
|
||||
methodName,
|
||||
implementation = kDefaultFunction,
|
||||
options = kEmptyObject
|
||||
options = kEmptyObject,
|
||||
) {
|
||||
if (implementation !== null && typeof implementation === 'object') {
|
||||
options = implementation;
|
||||
|
@ -226,7 +226,7 @@ class MockTracker {
|
|||
|
||||
if (getter === false) {
|
||||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'options.getter', getter, 'cannot be false'
|
||||
'options.getter', getter, 'cannot be false',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -240,7 +240,7 @@ class MockTracker {
|
|||
object,
|
||||
methodName,
|
||||
implementation = kDefaultFunction,
|
||||
options = kEmptyObject
|
||||
options = kEmptyObject,
|
||||
) {
|
||||
if (implementation !== null && typeof implementation === 'object') {
|
||||
options = implementation;
|
||||
|
@ -253,7 +253,7 @@ class MockTracker {
|
|||
|
||||
if (setter === false) {
|
||||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'options.setter', setter, 'cannot be false'
|
||||
'options.setter', setter, 'cannot be false',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -243,13 +243,13 @@ function jsToYaml(indent, name, value) {
|
|||
const processed = RegExpPrototypeSymbolReplace(
|
||||
kFrameStartRegExp,
|
||||
frame,
|
||||
''
|
||||
'',
|
||||
);
|
||||
|
||||
if (processed.length > 0 && processed.length !== frame.length) {
|
||||
ArrayPrototypePush(frames, processed);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
if (frames.length > 0) {
|
||||
|
|
|
@ -181,7 +181,7 @@ class FileTest extends Test {
|
|||
node.id,
|
||||
node.description,
|
||||
YAMLToJs(node.diagnostics),
|
||||
directive
|
||||
directive,
|
||||
);
|
||||
} else {
|
||||
this.reporter.fail(
|
||||
|
@ -190,7 +190,7 @@ class FileTest extends Test {
|
|||
node.id,
|
||||
node.description,
|
||||
YAMLToJs(node.diagnostics),
|
||||
directive
|
||||
directive,
|
||||
);
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -24,7 +24,7 @@ class TAPValidationStrategy {
|
|||
#validateVersion(ast) {
|
||||
const entry = ArrayPrototypeFind(
|
||||
ast,
|
||||
(node) => node.kind === TokenKind.TAP_VERSION
|
||||
(node) => node.kind === TokenKind.TAP_VERSION,
|
||||
);
|
||||
|
||||
if (!entry) {
|
||||
|
@ -42,7 +42,7 @@ class TAPValidationStrategy {
|
|||
#validatePlan(ast) {
|
||||
const entry = ArrayPrototypeFind(
|
||||
ast,
|
||||
(node) => node.kind === TokenKind.TAP_PLAN
|
||||
(node) => node.kind === TokenKind.TAP_PLAN,
|
||||
);
|
||||
|
||||
if (!entry) {
|
||||
|
@ -64,7 +64,7 @@ class TAPValidationStrategy {
|
|||
|
||||
if (planEnd !== 0 && planStart > planEnd) {
|
||||
throw new ERR_TAP_VALIDATION_ERROR(
|
||||
`plan start ${planStart} is greater than plan end ${planEnd}`
|
||||
`plan start ${planStart} is greater than plan end ${planEnd}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -76,15 +76,15 @@ class TAPValidationStrategy {
|
|||
#validateTestPoints(ast) {
|
||||
const bailoutEntry = ArrayPrototypeFind(
|
||||
ast,
|
||||
(node) => node.kind === TokenKind.TAP_BAIL_OUT
|
||||
(node) => node.kind === TokenKind.TAP_BAIL_OUT,
|
||||
);
|
||||
const planEntry = ArrayPrototypeFind(
|
||||
ast,
|
||||
(node) => node.kind === TokenKind.TAP_PLAN
|
||||
(node) => node.kind === TokenKind.TAP_PLAN,
|
||||
);
|
||||
const testPointEntries = ArrayPrototypeFilter(
|
||||
ast,
|
||||
(node) => node.kind === TokenKind.TAP_TEST_POINT
|
||||
(node) => node.kind === TokenKind.TAP_TEST_POINT,
|
||||
);
|
||||
|
||||
const plan = planEntry.node;
|
||||
|
@ -96,7 +96,7 @@ class TAPValidationStrategy {
|
|||
throw new ERR_TAP_VALIDATION_ERROR(
|
||||
`found ${testPointEntries.length} Test Point${
|
||||
testPointEntries.length > 1 ? 's' : ''
|
||||
} but plan is ${planStart}..0`
|
||||
} but plan is ${planStart}..0`,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -107,7 +107,7 @@ class TAPValidationStrategy {
|
|||
|
||||
if (!bailoutEntry && testPointEntries.length !== planEnd) {
|
||||
throw new ERR_TAP_VALIDATION_ERROR(
|
||||
`test Points count ${testPointEntries.length} does not match plan count ${planEnd}`
|
||||
`test Points count ${testPointEntries.length} does not match plan count ${planEnd}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -117,7 +117,7 @@ class TAPValidationStrategy {
|
|||
|
||||
if (testId < planStart || testId > planEnd) {
|
||||
throw new ERR_TAP_VALIDATION_ERROR(
|
||||
`test ${testId} is out of plan range ${planStart}..${planEnd}`
|
||||
`test ${testId} is out of plan range ${planStart}..${planEnd}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -200,7 +200,7 @@ class TapLexer {
|
|||
throw new ERR_TAP_LEXER_ERROR(
|
||||
`Unexpected character: ${char} at line ${this.#line}, column ${
|
||||
this.#column
|
||||
}`
|
||||
}`,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -141,7 +141,7 @@ class TapParser extends Transform {
|
|||
// TODO(@manekinekko): when running in async mode, it doesn't make sense to
|
||||
// validate the current chunk. Validation needs to whole AST to be available.
|
||||
throw new ERR_TAP_VALIDATION_ERROR(
|
||||
'TAP validation is not supported for async parsing'
|
||||
'TAP validation is not supported for async parsing',
|
||||
);
|
||||
}
|
||||
// ----------------------------------------------------------------------//
|
||||
|
@ -158,12 +158,12 @@ class TapParser extends Transform {
|
|||
chunkAsString = StringPrototypeReplaceAll(
|
||||
chunkAsString,
|
||||
'[out] ',
|
||||
''
|
||||
'',
|
||||
);
|
||||
chunkAsString = StringPrototypeReplaceAll(
|
||||
chunkAsString,
|
||||
'[err] ',
|
||||
''
|
||||
'',
|
||||
);
|
||||
if (StringPrototypeEndsWith(chunkAsString, '\n')) {
|
||||
chunkAsString = StringPrototypeSlice(chunkAsString, 0, -1);
|
||||
|
@ -303,7 +303,7 @@ class TapParser extends Transform {
|
|||
message,
|
||||
`, received "${token.value}" (${token.kind})`,
|
||||
token,
|
||||
this.#input
|
||||
this.#input,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -356,7 +356,7 @@ class TapParser extends Transform {
|
|||
TokenKind.WHITESPACE,
|
||||
TokenKind.ESCAPE,
|
||||
],
|
||||
nextToken.kind
|
||||
nextToken.kind,
|
||||
)
|
||||
) {
|
||||
const word = this.#next(false).value;
|
||||
|
@ -419,7 +419,7 @@ class TapParser extends Transform {
|
|||
if (this.#bufferedComments.length > 0) {
|
||||
currentNode.comments = ArrayPrototypeMap(
|
||||
this.#bufferedComments,
|
||||
(c) => c.node.comment
|
||||
(c) => c.node.comment,
|
||||
);
|
||||
this.#bufferedComments = [];
|
||||
}
|
||||
|
@ -496,7 +496,7 @@ class TapParser extends Transform {
|
|||
// Buffer this node (and also add any pending comments to it)
|
||||
ArrayPrototypePush(
|
||||
this.#bufferedTestPoints,
|
||||
this.#addCommentsToCurrentNode(currentNode)
|
||||
this.#addCommentsToCurrentNode(currentNode),
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -510,7 +510,7 @@ class TapParser extends Transform {
|
|||
case TokenKind.TAP_YAML_END:
|
||||
// Emit either the last updated test point (w/ diagnostics) or the current diagnostics node alone
|
||||
this.#emit(
|
||||
this.#addDiagnosticsToLastTestPoint(currentNode) || currentNode
|
||||
this.#addDiagnosticsToLastTestPoint(currentNode) || currentNode,
|
||||
);
|
||||
break;
|
||||
|
||||
|
@ -528,11 +528,11 @@ class TapParser extends Transform {
|
|||
ArrayPrototypeFilter(
|
||||
chunk,
|
||||
(token) =>
|
||||
token.kind !== TokenKind.NEWLINE && token.kind !== TokenKind.EOF
|
||||
token.kind !== TokenKind.NEWLINE && token.kind !== TokenKind.EOF,
|
||||
),
|
||||
(token) => token.value
|
||||
(token) => token.value,
|
||||
),
|
||||
''
|
||||
'',
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -947,7 +947,7 @@ class TapParser extends Transform {
|
|||
nextToken &&
|
||||
ArrayPrototypeIncludes(
|
||||
[TokenKind.NEWLINE, TokenKind.EOF, TokenKind.EOL],
|
||||
nextToken.kind
|
||||
nextToken.kind,
|
||||
) === false
|
||||
) {
|
||||
let isEnabled = true;
|
||||
|
|
|
@ -71,7 +71,7 @@ const testNamePatternFlag = isTestRunner ? null :
|
|||
const testNamePatterns = testNamePatternFlag?.length > 0 ?
|
||||
ArrayPrototypeMap(
|
||||
testNamePatternFlag,
|
||||
(re) => convertStringToRegExp(re, '--test-name-pattern')
|
||||
(re) => convertStringToRegExp(re, '--test-name-pattern'),
|
||||
) : null;
|
||||
const kShouldAbort = Symbol('kShouldAbort');
|
||||
const kFilename = process.argv?.[1];
|
||||
|
@ -88,7 +88,7 @@ function stopTest(timeout, signal) {
|
|||
return PromisePrototypeThen(setTimeout(timeout, null, { ref: false, signal }), () => {
|
||||
throw new ERR_TEST_FAILURE(
|
||||
`test timed out after ${timeout}ms`,
|
||||
kTestTimeoutFailure
|
||||
kTestTimeoutFailure,
|
||||
);
|
||||
});
|
||||
}
|
||||
|
@ -238,7 +238,7 @@ class Test extends AsyncResource {
|
|||
// eslint-disable-next-line no-use-before-define
|
||||
const match = this instanceof TestHook || ArrayPrototypeSome(
|
||||
testNamePatterns,
|
||||
(re) => RegExpPrototypeExec(re, name) !== null
|
||||
(re) => RegExpPrototypeExec(re, name) !== null,
|
||||
);
|
||||
|
||||
if (!match) {
|
||||
|
@ -380,8 +380,8 @@ class Test extends AsyncResource {
|
|||
test.fail(
|
||||
new ERR_TEST_FAILURE(
|
||||
'test could not be started because its parent finished',
|
||||
kParentAlreadyFinished
|
||||
)
|
||||
kParentAlreadyFinished,
|
||||
),
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -401,8 +401,8 @@ class Test extends AsyncResource {
|
|||
this.fail(error ||
|
||||
new ERR_TEST_FAILURE(
|
||||
'test did not finish before its parent and was cancelled',
|
||||
kCancelledByParent
|
||||
)
|
||||
kCancelledByParent,
|
||||
),
|
||||
);
|
||||
this.startTime = this.startTime || this.endTime; // If a test was canceled before it was started, e.g inside a hook
|
||||
this.cancelled = true;
|
||||
|
@ -538,7 +538,7 @@ class Test extends AsyncResource {
|
|||
if (isPromise(ret)) {
|
||||
this.fail(new ERR_TEST_FAILURE(
|
||||
'passed a callback but also returned a Promise',
|
||||
kCallbackAndPromisePresent
|
||||
kCallbackAndPromisePresent,
|
||||
));
|
||||
await SafePromiseRace([ret, stopPromise]);
|
||||
} else {
|
||||
|
|
|
@ -47,7 +47,7 @@ function createDeferredCallback() {
|
|||
if (calledCount === 2) {
|
||||
throw new ERR_TEST_FAILURE(
|
||||
'callback invoked multiple times',
|
||||
kMultipleCallbackInvocations
|
||||
kMultipleCallbackInvocations,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -81,7 +81,7 @@ function convertStringToRegExp(str, name) {
|
|||
throw new ERR_INVALID_ARG_VALUE(
|
||||
name,
|
||||
str,
|
||||
`is an invalid regular expression.${msg ? ` ${msg}` : ''}`
|
||||
`is an invalid regular expression.${msg ? ` ${msg}` : ''}`,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -81,7 +81,7 @@ function validateKeyOrCertOption(name, value) {
|
|||
'TypedArray',
|
||||
'DataView',
|
||||
],
|
||||
value
|
||||
value,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -94,7 +94,7 @@ function warnOnDeactivatedColors(env) {
|
|||
if (name !== '') {
|
||||
process.emitWarning(
|
||||
`The '${name}' env is ignored due to the 'FORCE_COLOR' env being set.`,
|
||||
'Warning'
|
||||
'Warning',
|
||||
);
|
||||
warned = true;
|
||||
}
|
||||
|
|
|
@ -260,7 +260,7 @@ class URLSearchParams {
|
|||
const length = ArrayPrototypeReduce(
|
||||
output,
|
||||
(prev, cur) => prev + removeColors(cur).length + separator.length,
|
||||
-separator.length
|
||||
-separator.length,
|
||||
);
|
||||
if (length > ctx.breakLength) {
|
||||
return `${this.constructor.name} {\n` +
|
||||
|
@ -1158,7 +1158,7 @@ defineIDLClass(URLSearchParamsIteratorPrototype, 'URLSearchParams Iterator', {
|
|||
}
|
||||
return prev;
|
||||
},
|
||||
[]
|
||||
[],
|
||||
);
|
||||
const breakLn = StringPrototypeIncludes(inspect(output, innerOpts), '\n');
|
||||
const outputStrs = ArrayPrototypeMap(output, (p) => inspect(p, innerOpts));
|
||||
|
@ -1222,7 +1222,7 @@ function getPathFromURLWin32(url) {
|
|||
if ((pathname[n + 1] === '2' && third === 102) || // 2f 2F /
|
||||
(pathname[n + 1] === '5' && third === 99)) { // 5c 5C \
|
||||
throw new ERR_INVALID_FILE_URL_PATH(
|
||||
'must not include encoded \\ or / characters'
|
||||
'must not include encoded \\ or / characters',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1258,7 +1258,7 @@ function getPathFromURLPosix(url) {
|
|||
const third = StringPrototypeCodePointAt(pathname, n + 2) | 0x20;
|
||||
if (pathname[n + 1] === '2' && third === 102) {
|
||||
throw new ERR_INVALID_FILE_URL_PATH(
|
||||
'must not include encoded / characters'
|
||||
'must not include encoded / characters',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -1317,14 +1317,14 @@ function pathToFileURL(filepath) {
|
|||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'filepath',
|
||||
filepath,
|
||||
'Missing UNC resource path'
|
||||
'Missing UNC resource path',
|
||||
);
|
||||
}
|
||||
if (hostnameEndIndex === 2) {
|
||||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'filepath',
|
||||
filepath,
|
||||
'Empty UNC servername'
|
||||
'Empty UNC servername',
|
||||
);
|
||||
}
|
||||
const hostname = StringPrototypeSlice(filepath, 2, hostnameEndIndex);
|
||||
|
|
|
@ -259,7 +259,7 @@ function innerDeepEqual(val1, val2, strict, memos) {
|
|||
function getEnumerables(val, keys) {
|
||||
return ArrayPrototypeFilter(
|
||||
keys,
|
||||
(k) => ObjectPrototypePropertyIsEnumerable(val, k)
|
||||
(k) => ObjectPrototypePropertyIsEnumerable(val, k),
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -167,8 +167,8 @@ function pathToFileUrlHref(filepath) {
|
|||
const builtInObjects = new SafeSet(
|
||||
ArrayPrototypeFilter(
|
||||
ObjectGetOwnPropertyNames(globalThis),
|
||||
(e) => RegExpPrototypeExec(/^[A-Z][a-zA-Z0-9]+$/, e) !== null
|
||||
)
|
||||
(e) => RegExpPrototypeExec(/^[A-Z][a-zA-Z0-9]+$/, e) !== null,
|
||||
),
|
||||
);
|
||||
|
||||
// https://tc39.es/ecma262/#sec-IsHTMLDDA-internal-slot
|
||||
|
@ -807,7 +807,7 @@ function formatValue(ctx, value, recurseTimes, typedArray) {
|
|||
context,
|
||||
depth,
|
||||
getUserOptions(ctx, isCrossContext),
|
||||
inspect
|
||||
inspect,
|
||||
);
|
||||
// If the custom inspection method returned `this`, don't go into
|
||||
// infinite recursion.
|
||||
|
@ -861,7 +861,7 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
|
|||
(ctx.showHidden ?
|
||||
ObjectPrototypeHasOwnProperty :
|
||||
ObjectPrototypePropertyIsEnumerable)(
|
||||
value, SymbolToStringTag
|
||||
value, SymbolToStringTag,
|
||||
))) {
|
||||
tag = '';
|
||||
}
|
||||
|
@ -961,7 +961,7 @@ function formatRaw(ctx, value, recurseTimes, typedArray) {
|
|||
} else if (isRegExp(value)) {
|
||||
// Make RegExps say that they are RegExps
|
||||
base = RegExpPrototypeToString(
|
||||
constructor !== null ? value : new RegExp(value)
|
||||
constructor !== null ? value : new RegExp(value),
|
||||
);
|
||||
const prefix = getPrefix(constructor, tag, 'RegExp');
|
||||
if (prefix !== 'RegExp ')
|
||||
|
@ -1468,8 +1468,8 @@ function groupArrayElements(ctx, output, value) {
|
|||
// The added bias increases the columns for short entries.
|
||||
MathRound(
|
||||
MathSqrt(
|
||||
approxCharHeights * biasedMax * outputLength
|
||||
) / biasedMax
|
||||
approxCharHeights * biasedMax * outputLength,
|
||||
) / biasedMax,
|
||||
),
|
||||
// Do not exceed the breakLength.
|
||||
MathFloor((ctx.breakLength - ctx.indentationLvl) / actualMax),
|
||||
|
@ -1477,7 +1477,7 @@ function groupArrayElements(ctx, output, value) {
|
|||
// minimal grouping.
|
||||
ctx.compact * 4,
|
||||
// Limit the columns to a maximum of fifteen.
|
||||
15
|
||||
15,
|
||||
);
|
||||
// Return with the original output if no grouping should happen.
|
||||
if (columns <= 1) {
|
||||
|
@ -1542,7 +1542,7 @@ function handleMaxCallStackSize(ctx, err, constructorName, indentationLvl) {
|
|||
return ctx.stylize(
|
||||
`[${constructorName}: Inspection interrupted ` +
|
||||
'prematurely. Maximum call stack size exceeded.]',
|
||||
'special'
|
||||
'special',
|
||||
);
|
||||
}
|
||||
/* c8 ignore next */
|
||||
|
@ -1597,7 +1597,7 @@ function formatNumber(fn, number, numericSeparator) {
|
|||
addNumericSeparator(string)
|
||||
}.${
|
||||
addNumericSeparatorEnd(
|
||||
StringPrototypeSlice(String(number), string.length + 1)
|
||||
StringPrototypeSlice(String(number), string.length + 1),
|
||||
)
|
||||
}`, 'number');
|
||||
}
|
||||
|
@ -1978,7 +1978,7 @@ function formatProperty(ctx, value, recurseTimes, key, type, desc,
|
|||
const tmp = RegExpPrototypeSymbolReplace(
|
||||
strEscapeSequencesReplacer,
|
||||
SymbolPrototypeToString(key),
|
||||
escapeFn
|
||||
escapeFn,
|
||||
);
|
||||
name = `[${ctx.stylize(tmp, 'symbol')}]`;
|
||||
} else if (key === '__proto__') {
|
||||
|
@ -2157,7 +2157,7 @@ function formatNumberNoColor(number, options) {
|
|||
return formatNumber(
|
||||
stylizeNoColor,
|
||||
number,
|
||||
options?.numericSeparator ?? inspectDefaultOptions.numericSeparator
|
||||
options?.numericSeparator ?? inspectDefaultOptions.numericSeparator,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2165,7 +2165,7 @@ function formatBigIntNoColor(bigint, options) {
|
|||
return formatBigInt(
|
||||
stylizeNoColor,
|
||||
bigint,
|
||||
options?.numericSeparator ?? inspectDefaultOptions.numericSeparator
|
||||
options?.numericSeparator ?? inspectDefaultOptions.numericSeparator,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -87,7 +87,7 @@ function wrapConsole(consoleFromNode) {
|
|||
consoleCall,
|
||||
consoleFromNode,
|
||||
consoleFromVM[key],
|
||||
consoleFromNode[key]
|
||||
consoleFromNode[key],
|
||||
);
|
||||
ObjectDefineProperty(consoleFromNode[key], 'name', {
|
||||
__proto__: null,
|
||||
|
|
|
@ -195,7 +195,7 @@ function argsToTokens(args, options) {
|
|||
ArrayPrototypePushApply(
|
||||
tokens, ArrayPrototypeMap(remainingArgs, (arg) => {
|
||||
return { kind: 'positional', index: ++index, value: arg };
|
||||
})
|
||||
}),
|
||||
);
|
||||
break; // Finished processing args, leave while loop.
|
||||
}
|
||||
|
@ -321,7 +321,7 @@ const parseArgs = (config = kEmptyObject) => {
|
|||
throw new ERR_INVALID_ARG_VALUE(
|
||||
`options.${longOption}.short`,
|
||||
shortOption,
|
||||
'must be a single character'
|
||||
'must be a single character',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -345,7 +345,7 @@ const parseArgs = (config = kEmptyObject) => {
|
|||
}
|
||||
validator(defaultValue, `options.${longOption}.default`);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
// Phase 1: identify tokens
|
||||
|
|
|
@ -165,7 +165,7 @@ function findLongOptionForShort(shortOption, options) {
|
|||
validateObject(options, 'options');
|
||||
const longOptionEntry = ArrayPrototypeFind(
|
||||
ObjectEntries(options),
|
||||
({ 1: optionConfig }) => objectGetOwn(optionConfig, 'short') === shortOption
|
||||
({ 1: optionConfig }) => objectGetOwn(optionConfig, 'short') === shortOption,
|
||||
);
|
||||
return longOptionEntry?.[0] ?? shortOption;
|
||||
}
|
||||
|
|
|
@ -98,7 +98,7 @@ const validateInteger = hideStackFrames(
|
|||
throw new ERR_OUT_OF_RANGE(name, 'an integer', value);
|
||||
if (value < min || value > max)
|
||||
throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -123,7 +123,7 @@ const validateInt32 = hideStackFrames(
|
|||
if (value < min || value > max) {
|
||||
throw new ERR_OUT_OF_RANGE(name, `>= ${min} && <= ${max}`, value);
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
|
||||
/**
|
||||
|
@ -473,7 +473,7 @@ function validateLinkHeaderFormat(value, name) {
|
|||
throw new ERR_INVALID_ARG_VALUE(
|
||||
name,
|
||||
value,
|
||||
'must be an array or string of format "</styles.css>; rel=preload; as=style"'
|
||||
'must be an array or string of format "</styles.css>; rel=preload; as=style"',
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -516,7 +516,7 @@ function validateLinkHeaderValue(hints) {
|
|||
throw new ERR_INVALID_ARG_VALUE(
|
||||
'hints',
|
||||
hints,
|
||||
'must be an array or string of format "</styles.css>; rel=preload; as=style"'
|
||||
'must be an array or string of format "</styles.css>; rel=preload; as=style"',
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -60,7 +60,7 @@ function internalCompileFunction(code, params, options) {
|
|||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'options.parsingContext',
|
||||
'Context',
|
||||
parsingContext
|
||||
parsingContext,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -79,7 +79,7 @@ function internalCompileFunction(code, params, options) {
|
|||
produceCachedData,
|
||||
parsingContext,
|
||||
contextExtensions,
|
||||
params
|
||||
params,
|
||||
);
|
||||
|
||||
if (produceCachedData) {
|
||||
|
|
|
@ -219,7 +219,7 @@ class Module {
|
|||
status !== kEvaluated &&
|
||||
status !== kErrored) {
|
||||
throw new ERR_VM_MODULE_STATUS(
|
||||
'must be one of linked, evaluated, or errored'
|
||||
'must be one of linked, evaluated, or errored',
|
||||
);
|
||||
}
|
||||
await this[kWrap].evaluate(timeout, breakOnSigint);
|
||||
|
|
|
@ -111,7 +111,7 @@ function newWritableStreamFromStreamWritable(streamWritable) {
|
|||
throw new ERR_INVALID_ARG_TYPE(
|
||||
'streamWritable',
|
||||
'stream.Writable',
|
||||
streamWritable
|
||||
streamWritable,
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -52,7 +52,7 @@ const nameDescriptor = { __proto__: null, value: 'size' };
|
|||
const byteSizeFunction = ObjectDefineProperty(
|
||||
(chunk) => chunk.byteLength,
|
||||
'name',
|
||||
nameDescriptor
|
||||
nameDescriptor,
|
||||
);
|
||||
const countSizeFunction = ObjectDefineProperty(() => 1, 'name', nameDescriptor);
|
||||
|
||||
|
|
|
@ -756,7 +756,7 @@ function createReadableStreamBYOBRequest(controller, view) {
|
|||
};
|
||||
},
|
||||
[],
|
||||
ReadableStreamBYOBRequest
|
||||
ReadableStreamBYOBRequest,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1592,7 +1592,7 @@ function readableByteStreamTee(stream) {
|
|||
if (!canceled1 || !canceled2) {
|
||||
cancelDeferred.resolve();
|
||||
}
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -1617,11 +1617,11 @@ function readableByteStreamTee(stream) {
|
|||
} catch (error) {
|
||||
readableByteStreamControllerError(
|
||||
branch1[kState].controller,
|
||||
error
|
||||
error,
|
||||
);
|
||||
readableByteStreamControllerError(
|
||||
branch2[kState].controller,
|
||||
error
|
||||
error,
|
||||
);
|
||||
cancelDeferred.resolve(readableStreamCancel(stream, error));
|
||||
return;
|
||||
|
@ -1630,13 +1630,13 @@ function readableByteStreamTee(stream) {
|
|||
if (!canceled1) {
|
||||
readableByteStreamControllerEnqueue(
|
||||
branch1[kState].controller,
|
||||
chunk1
|
||||
chunk1,
|
||||
);
|
||||
}
|
||||
if (!canceled2) {
|
||||
readableByteStreamControllerEnqueue(
|
||||
branch2[kState].controller,
|
||||
chunk2
|
||||
chunk2,
|
||||
);
|
||||
}
|
||||
reading = false;
|
||||
|
@ -1700,11 +1700,11 @@ function readableByteStreamTee(stream) {
|
|||
} catch (error) {
|
||||
readableByteStreamControllerError(
|
||||
byobBranch[kState].controller,
|
||||
error
|
||||
error,
|
||||
);
|
||||
readableByteStreamControllerError(
|
||||
otherBranch[kState].controller,
|
||||
error
|
||||
error,
|
||||
);
|
||||
cancelDeferred.resolve(readableStreamCancel(stream, error));
|
||||
return;
|
||||
|
@ -1712,18 +1712,18 @@ function readableByteStreamTee(stream) {
|
|||
if (!byobCanceled) {
|
||||
readableByteStreamControllerRespondWithNewView(
|
||||
byobBranch[kState].controller,
|
||||
chunk
|
||||
chunk,
|
||||
);
|
||||
}
|
||||
|
||||
readableByteStreamControllerEnqueue(
|
||||
otherBranch[kState].controller,
|
||||
clonedChunk
|
||||
clonedChunk,
|
||||
);
|
||||
} else if (!byobCanceled) {
|
||||
readableByteStreamControllerRespondWithNewView(
|
||||
byobBranch[kState].controller,
|
||||
chunk
|
||||
chunk,
|
||||
);
|
||||
}
|
||||
reading = false;
|
||||
|
@ -1751,7 +1751,7 @@ function readableByteStreamTee(stream) {
|
|||
if (!byobCanceled) {
|
||||
readableByteStreamControllerRespondWithNewView(
|
||||
byobBranch[kState].controller,
|
||||
chunk
|
||||
chunk,
|
||||
);
|
||||
}
|
||||
if (
|
||||
|
@ -1760,7 +1760,7 @@ function readableByteStreamTee(stream) {
|
|||
) {
|
||||
readableByteStreamControllerRespond(
|
||||
otherBranch[kState].controller,
|
||||
0
|
||||
0,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2673,13 +2673,13 @@ function readableByteStreamControllerEnqueue(controller, chunk) {
|
|||
readableByteStreamControllerInvalidateBYOBRequest(controller);
|
||||
|
||||
firstPendingPullInto.buffer = transferArrayBuffer(
|
||||
firstPendingPullInto.buffer
|
||||
firstPendingPullInto.buffer,
|
||||
);
|
||||
|
||||
if (firstPendingPullInto.type === 'none') {
|
||||
readableByteStreamControllerEnqueueDetachedPullIntoToQueue(
|
||||
controller,
|
||||
firstPendingPullInto
|
||||
firstPendingPullInto,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
@ -2725,14 +2725,14 @@ function readableByteStreamControllerEnqueueClonedChunkToQueue(
|
|||
controller,
|
||||
buffer,
|
||||
byteOffset,
|
||||
byteLength
|
||||
byteLength,
|
||||
) {
|
||||
let cloneResult;
|
||||
try {
|
||||
cloneResult = ArrayBufferPrototypeSlice(
|
||||
buffer,
|
||||
byteOffset,
|
||||
byteOffset + byteLength
|
||||
byteOffset + byteLength,
|
||||
);
|
||||
} catch (error) {
|
||||
readableByteStreamControllerError(controller, error);
|
||||
|
@ -2742,7 +2742,7 @@ function readableByteStreamControllerEnqueueClonedChunkToQueue(
|
|||
controller,
|
||||
cloneResult,
|
||||
0,
|
||||
byteLength
|
||||
byteLength,
|
||||
);
|
||||
}
|
||||
|
||||
|
@ -2763,7 +2763,7 @@ function readableByteStreamControllerEnqueueChunkToQueue(
|
|||
|
||||
function readableByteStreamControllerEnqueueDetachedPullIntoToQueue(
|
||||
controller,
|
||||
desc
|
||||
desc,
|
||||
) {
|
||||
const {
|
||||
buffer,
|
||||
|
@ -2778,7 +2778,7 @@ function readableByteStreamControllerEnqueueDetachedPullIntoToQueue(
|
|||
controller,
|
||||
buffer,
|
||||
byteOffset,
|
||||
bytesFilled
|
||||
bytesFilled,
|
||||
);
|
||||
}
|
||||
readableByteStreamControllerShiftPendingPullInto(controller);
|
||||
|
@ -2893,10 +2893,10 @@ function readableByteStreamControllerRespondInReadableState(
|
|||
if (type === 'none') {
|
||||
readableByteStreamControllerEnqueueDetachedPullIntoToQueue(
|
||||
controller,
|
||||
desc
|
||||
desc,
|
||||
);
|
||||
readableByteStreamControllerProcessPullIntoDescriptorsUsingQueue(
|
||||
controller
|
||||
controller,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
@ -3068,7 +3068,7 @@ function readableByteStreamControllerPullSteps(controller, readRequest) {
|
|||
assert(!readableStreamGetNumReadRequests(stream));
|
||||
readableByteStreamControllerFillReadRequestFromQueue(
|
||||
controller,
|
||||
readRequest
|
||||
readRequest,
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue