Skip to content

Commit 2632152

Browse files
committed
Update dev dependencies
1 parent 84fa0ec commit 2632152

35 files changed

Lines changed: 106 additions & 129 deletions

lib/arguments/command-file.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ const escapeWindowsCommand = parsed => {
4343
assertNoLineBreak(value);
4444
}
4545

46-
const doubleEscape = resolvedFile !== undefined && batchFileRegExp.test(resolvedFile);
46+
const isDoubleEscape = resolvedFile !== undefined && batchFileRegExp.test(resolvedFile);
4747
// POSIX separators must become Windows ones (`foo/bar` -> `foo\bar`), otherwise resolution always fails with ENOENT
4848
const escapedFile = escapeMetaChars(path.normalize(parsed.file));
49-
const escapedArguments = parsed.commandArguments.map(argument => escapeArgument(argument, doubleEscape));
49+
const escapedArguments = parsed.commandArguments.map(argument => escapeArgument(argument, isDoubleEscape));
5050
const commandLine = `"${[escapedFile, ...escapedArguments].join(' ')}"`;
5151

5252
// Let `node:child_process` pass the already-escaped command line through untouched
@@ -149,8 +149,8 @@ const escapeArgument = (rawArgument, doubleEscape) => {
149149
const argument = `${rawArgument}`
150150
.replaceAll(backslashRunRegExp, (backslashes, offset, string) => {
151151
const nextCharacter = string[offset + backslashes.length];
152-
const precedesDoubleQuote = nextCharacter === '"' || nextCharacter === undefined;
153-
return precedesDoubleQuote ? backslashes.repeat(2) : backslashes;
152+
const isPrecedesDoubleQuote = nextCharacter === '"' || nextCharacter === undefined;
153+
return isPrecedesDoubleQuote ? backslashes.repeat(2) : backslashes;
154154
})
155155
.replaceAll('"', '\\"');
156156

lib/arguments/encoding-option.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Please rename it to one of: ${correctEncodings}.`);
1717

1818
const TEXT_ENCODINGS = new Set(['utf8', 'utf16le']);
1919
export const BINARY_ENCODINGS = new Set(['buffer', 'hex', 'base64', 'base64url', 'latin1', 'ascii']);
20-
const ENCODINGS = new Set([...TEXT_ENCODINGS, ...BINARY_ENCODINGS]);
20+
const ENCODINGS = TEXT_ENCODINGS.union(BINARY_ENCODINGS);
2121

2222
const getCorrectEncoding = encoding => {
2323
if (encoding === null) {

lib/ipc/graceful.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ export const getCancelSignal = async ({anyProcess, channel, isSubprocess, ipc})
2929
};
3030

3131
const startIpc = async ({anyProcess, channel, isSubprocess, ipc}) => {
32-
if (cancelListening) {
32+
if (isCancelListening) {
3333
return;
3434
}
3535

36-
cancelListening = true;
36+
isCancelListening = true;
3737

3838
if (!ipc) {
3939
throwOnMissingParent();
@@ -49,7 +49,7 @@ const startIpc = async ({anyProcess, channel, isSubprocess, ipc}) => {
4949
await scheduler.yield();
5050
};
5151

52-
let cancelListening = false;
52+
let isCancelListening = false;
5353

5454
// Reception of IPC message to perform a graceful termination
5555
export const handleAbort = wrappedMessage => {

lib/ipc/methods.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,15 +13,15 @@ export const addIpcMethods = (target, subprocess, {ipc}) => {
1313
export const getIpcExport = () => {
1414
const anyProcess = process;
1515
const isSubprocess = true;
16-
const ipc = process.channel !== undefined;
16+
const isIpc = process.channel !== undefined;
1717

1818
return {
19-
...getIpcMethods(anyProcess, isSubprocess, ipc),
19+
...getIpcMethods(anyProcess, isSubprocess, isIpc),
2020
getCancelSignal: getCancelSignal.bind(undefined, {
2121
anyProcess,
2222
channel: anyProcess.channel,
2323
isSubprocess,
24-
ipc,
24+
ipc: isIpc,
2525
}),
2626
};
2727
};

lib/methods/template.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const splitByWhitespaces = (template, rawTemplate) => {
5959

6060
const nextTokens = [];
6161
let templateStart = 0;
62-
const leadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
62+
const isLeadingWhitespaces = DELIMITERS.has(rawTemplate[0]);
6363

6464
for (
6565
let templateIndex = 0, rawIndex = 0;
@@ -87,12 +87,12 @@ const splitByWhitespaces = (template, rawTemplate) => {
8787
}
8888
}
8989

90-
const trailingWhitespaces = templateStart === template.length;
91-
if (!trailingWhitespaces) {
90+
const isTrailingWhitespaces = templateStart === template.length;
91+
if (!isTrailingWhitespaces) {
9292
nextTokens.push(template.slice(templateStart));
9393
}
9494

95-
return {nextTokens, leadingWhitespaces, trailingWhitespaces};
95+
return {nextTokens, leadingWhitespaces: isLeadingWhitespaces, trailingWhitespaces: isTrailingWhitespaces};
9696
};
9797

9898
const DELIMITERS = new Set([' ', '\t', '\r', '\n']);

lib/resolve/exit-sync.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,13 @@ import {isFailedExit} from './exit-async.js';
55
// Retrieve exit code, signal name and error information, with synchronous methods
66
export const getExitResultSync = ({error, status: exitCode, signal, output}, {maxBuffer}) => {
77
const resultError = getResultError(error, exitCode, signal);
8-
const timedOut = resultError?.code === 'ETIMEDOUT';
8+
const isTimedOut = resultError?.code === 'ETIMEDOUT';
99
const isMaxBuffer = isMaxBufferSync(resultError, output, maxBuffer);
1010
return {
1111
resultError,
1212
exitCode,
1313
signal,
14-
timedOut,
14+
timedOut: isTimedOut,
1515
isMaxBuffer,
1616
};
1717
};

lib/transform/split.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -32,18 +32,20 @@ const splitGenerator = function * (state, preserveNewlines, chunk) {
3232
let start = -1;
3333

3434
for (let end = 0; end < chunk.length; end += 1) {
35-
if (chunk[end] === '\n') {
36-
const newlineLength = getNewlineLength(chunk, end, preserveNewlines, state);
37-
let line = chunk.slice(start + 1, end + 1 - newlineLength);
35+
if (chunk[end] !== '\n') {
36+
continue;
37+
}
3838

39-
if (previousChunks.length > 0) {
40-
line = concatString(previousChunks, line);
41-
previousChunks = '';
42-
}
39+
const newlineLength = getNewlineLength(chunk, end, preserveNewlines, state);
40+
let line = chunk.slice(start + 1, end + 1 - newlineLength);
4341

44-
yield line;
45-
start = end;
42+
if (previousChunks.length > 0) {
43+
line = concatString(previousChunks, line);
44+
previousChunks = '';
4645
}
46+
47+
yield line;
48+
start = end;
4749
}
4850

4951
if (start !== chunk.length - 1) {

lib/verbose/output.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,15 @@ import {isFullVerbose} from './values.js';
1111
export const shouldLogOutput = ({stdioItems, encoding, verboseInfo, fdNumber}) => fdNumber !== 'all'
1212
&& isFullVerbose(verboseInfo, fdNumber)
1313
&& !BINARY_ENCODINGS.has(encoding)
14-
&& fdUsesVerbose(fdNumber)
14+
&& isFdVerbose(fdNumber)
1515
&& (stdioItems.some(({type, value}) => type === 'native' && PIPED_STDIO_VALUES.has(value))
1616
|| stdioItems.every(({type}) => TRANSFORM_TYPES.has(type)));
1717

1818
// Printing input streams would be confusing.
1919
// Files and streams can produce big outputs, which we don't want to print.
2020
// We could print `stdio[3+]` but it often is redirected to files and streams, with the same issue.
2121
// So we only print stdout and stderr.
22-
const fdUsesVerbose = fdNumber => fdNumber === 1 || fdNumber === 2;
22+
const isFdVerbose = fdNumber => fdNumber === 1 || fdNumber === 2;
2323

2424
const PIPED_STDIO_VALUES = new Set(['pipe', 'overlapped']);
2525

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@
7777
"tempfile": "^6.0.1",
7878
"tsd": "^0.33.0",
7979
"typescript": "^6.0.3",
80-
"xo": "^3.0.2"
80+
"xo": "^4.0.0"
8181
},
8282
"c8": {
8383
"reporter": [

test-d/return/result-stdio.test-d.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ expectType<undefined>(inputFdFd3Result.stdio[3]);
123123
const outputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe'}]});
124124
expectType<string>(outputPipeFd3Result.stdio[3]);
125125

126-
const input = true as boolean;
127-
const booleanInputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe', input}]});
126+
const isInput = true as boolean;
127+
const booleanInputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', {value: 'pipe', input: isInput}]});
128128
expectType<string | undefined>(booleanInputPipeFd3Result.stdio[3]);
129129

130-
const optionalInputPipe: {readonly value: 'pipe'; readonly input?: boolean} = {value: 'pipe', input};
130+
const optionalInputPipe: {readonly value: 'pipe'; readonly input?: boolean} = {value: 'pipe', input: isInput};
131131
const optionalInputPipeFd3Result = await execa('unicorns', {stdio: ['pipe', 'pipe', 'pipe', optionalInputPipe]});
132132
expectType<string | undefined>(optionalInputPipeFd3Result.stdio[3]);
133133

0 commit comments

Comments
 (0)