@hot-updater/rock 0.20.11 → 0.20.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/dist/index.cjs +139 -238
  2. package/dist/index.js +153 -252
  3. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,5 +1,4 @@
1
1
  import { createRequire } from "node:module";
2
- import path from "path";
3
2
  import { log } from "@hot-updater/plugin-core";
4
3
  import { fileURLToPath } from "node:url";
5
4
  import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
@@ -7,7 +6,8 @@ import { StringDecoder } from "node:string_decoder";
7
6
  import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
8
7
  import process$1, { execArgv, execPath, hrtime, platform } from "node:process";
9
8
  import tty from "node:tty";
10
- import path$1 from "node:path";
9
+ import path from "node:path";
10
+ import path$1 from "path";
11
11
  import { scheduler, setImmediate, setTimeout } from "node:timers/promises";
12
12
  import { constants } from "node:os";
13
13
  import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:events";
@@ -92,8 +92,7 @@ const stringToUint8Array = (string) => textEncoder$1.encode(string);
92
92
  const textDecoder = new TextDecoder();
93
93
  const uint8ArrayToString = (uint8Array) => textDecoder.decode(uint8Array);
94
94
  const joinToString = (uint8ArraysOrStrings, encoding) => {
95
- const strings = uint8ArraysToStrings(uint8ArraysOrStrings, encoding);
96
- return strings.join("");
95
+ return uint8ArraysToStrings(uint8ArraysOrStrings, encoding).join("");
97
96
  };
98
97
  const uint8ArraysToStrings = (uint8ArraysOrStrings, encoding) => {
99
98
  if (encoding === "utf8" && uint8ArraysOrStrings.every((uint8ArrayOrString) => typeof uint8ArrayOrString === "string")) return uint8ArraysOrStrings;
@@ -148,8 +147,7 @@ const parseTemplate = ({ templates, expressions, tokens, index, template }) => {
148
147
  const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
149
148
  if (index === expressions.length) return newTokens;
150
149
  const expression = expressions[index];
151
- const expressionTokens = Array.isArray(expression) ? expression.map((expression$1) => parseExpression(expression$1)) : [parseExpression(expression)];
152
- return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
150
+ return concatTokens(newTokens, Array.isArray(expression) ? expression.map((expression$1) => parseExpression(expression$1)) : [parseExpression(expression)], trailingWhitespaces);
153
151
  };
154
152
  const splitByWhitespaces = (template, rawTemplate) => {
155
153
  if (rawTemplate.length === 0) return {
@@ -236,8 +234,7 @@ const normalizeFdSpecificOptions = (options) => {
236
234
  };
237
235
  const normalizeFdSpecificOption = (options, optionName) => {
238
236
  const optionBaseArray = Array.from({ length: getStdioLength(options) + 1 });
239
- const optionArray = normalizeFdSpecificValue(options[optionName], optionBaseArray, optionName);
240
- return addDefaultValue$1(optionArray, optionName);
237
+ return addDefaultValue$1(normalizeFdSpecificValue(options[optionName], optionBaseArray, optionName), optionName);
241
238
  };
242
239
  const getStdioLength = ({ stdio }) => Array.isArray(stdio) ? Math.max(stdio.length, STANDARD_STREAMS_ALIASES.length) : STANDARD_STREAMS_ALIASES.length;
243
240
  const normalizeFdSpecificValue = (optionValue, optionArray, optionName) => isPlainObject(optionValue) ? normalizeOptionObject(optionValue, optionArray, optionName) : optionArray.fill(optionValue);
@@ -267,12 +264,11 @@ const parseFd = (fdName) => {
267
264
  };
268
265
  const FD_REGEXP = /^fd(\d+)$/;
269
266
  const addDefaultValue$1 = (optionArray, optionName) => optionArray.map((optionValue) => optionValue === void 0 ? DEFAULT_OPTIONS[optionName] : optionValue);
270
- const verboseDefault = debuglog("execa").enabled ? "full" : "none";
271
267
  const DEFAULT_OPTIONS = {
272
268
  lines: false,
273
269
  buffer: true,
274
270
  maxBuffer: 1e3 * 1e3 * 100,
275
- verbose: verboseDefault,
271
+ verbose: debuglog("execa").enabled ? "full" : "none",
276
272
  stripFinalNewline: true
277
273
  };
278
274
  const FD_SPECIFIC_OPTIONS = [
@@ -305,11 +301,9 @@ const VERBOSE_VALUES = [
305
301
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/arguments/escape.js
306
302
  const joinCommand = (filePath, rawArguments) => {
307
303
  const fileAndArguments = [filePath, ...rawArguments];
308
- const command = fileAndArguments.join(" ");
309
- const escapedCommand = fileAndArguments.map((fileAndArgument) => quoteString(escapeControlCharacters(fileAndArgument))).join(" ");
310
304
  return {
311
- command,
312
- escapedCommand
305
+ command: fileAndArguments.join(" "),
306
+ escapedCommand: fileAndArguments.map((fileAndArgument) => quoteString(escapeControlCharacters(fileAndArgument))).join(" ")
313
307
  };
314
308
  };
315
309
  const escapeLines = (lines) => stripVTControlCharacters(lines).split("\n").map((line) => escapeControlCharacters(line)).join("\n");
@@ -750,13 +744,11 @@ const appendNewline = (printedLine) => printedLine.endsWith("\n") ? printedLine
750
744
  //#endregion
751
745
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/log.js
752
746
  const verboseLog = ({ type, verboseMessage, fdNumber, verboseInfo, result }) => {
753
- const verboseObject = getVerboseObject({
747
+ const finalLines = applyVerboseOnLines(getPrintedLines(verboseMessage, getVerboseObject({
754
748
  type,
755
749
  result,
756
750
  verboseInfo
757
- });
758
- const printedLines = getPrintedLines(verboseMessage, verboseObject);
759
- const finalLines = applyVerboseOnLines(printedLines, verboseInfo, fdNumber);
751
+ })), verboseInfo, fdNumber);
760
752
  if (finalLines !== "") console.warn(finalLines.slice(0, -1));
761
753
  };
762
754
  const getVerboseObject = ({ type, result, verboseInfo: { escapedCommand, commandId, rawOptions: { piped = false,...options } } }) => ({
@@ -773,16 +765,13 @@ const getPrintedLines = (verboseMessage, verboseObject) => verboseMessage.split(
773
765
  message
774
766
  }));
775
767
  const getPrintedLine = (verboseObject) => {
776
- const verboseLine = defaultVerboseFunction(verboseObject);
777
768
  return {
778
- verboseLine,
769
+ verboseLine: defaultVerboseFunction(verboseObject),
779
770
  verboseObject
780
771
  };
781
772
  };
782
773
  const serializeVerboseMessage = (message) => {
783
- const messageString = typeof message === "string" ? message : inspect(message);
784
- const escapedMessage = escapeLines(messageString);
785
- return escapedMessage.replaceAll(" ", " ".repeat(TAB_SIZE));
774
+ return escapeLines(typeof message === "string" ? message : inspect(message)).replaceAll(" ", " ".repeat(TAB_SIZE));
786
775
  };
787
776
  const TAB_SIZE = 2;
788
777
 
@@ -801,11 +790,10 @@ const logCommand = (escapedCommand, verboseInfo) => {
801
790
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/info.js
802
791
  const getVerboseInfo = (verbose, escapedCommand, rawOptions) => {
803
792
  validateVerbose(verbose);
804
- const commandId = getCommandId(verbose);
805
793
  return {
806
794
  verbose,
807
795
  escapedCommand,
808
- commandId,
796
+ commandId: getCommandId(verbose),
809
797
  rawOptions
810
798
  };
811
799
  };
@@ -832,8 +820,7 @@ const getDurationMs = (startTime) => Number(hrtime.bigint() - startTime) / 1e6;
832
820
  const handleCommand = (filePath, rawArguments, rawOptions) => {
833
821
  const startTime = getStartTime();
834
822
  const { command, escapedCommand } = joinCommand(filePath, rawArguments);
835
- const verbose = normalizeFdSpecificOption(rawOptions, "verbose");
836
- const verboseInfo = getVerboseInfo(verbose, escapedCommand, { ...rawOptions });
823
+ const verboseInfo = getVerboseInfo(normalizeFdSpecificOption(rawOptions, "verbose"), escapedCommand, { ...rawOptions });
837
824
  logCommand(escapedCommand, verboseInfo);
838
825
  return {
839
826
  command,
@@ -901,8 +888,7 @@ var require_mode = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/isexe@
901
888
  var g = parseInt("010", 8);
902
889
  var o$1 = parseInt("001", 8);
903
890
  var ug = u$1 | g;
904
- var ret = mod & o$1 || mod & g && gid === myGid || mod & u$1 && uid === myUid || mod & ug && myUid === 0;
905
- return ret;
891
+ return mod & o$1 || mod & g && gid === myGid || mod & u$1 && uid === myUid || mod & ug && myUid === 0;
906
892
  }
907
893
  }) });
908
894
 
@@ -984,8 +970,7 @@ var require_which = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/which
984
970
  const ppRaw = pathEnv[i$1];
985
971
  const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
986
972
  const pCmd = path$4.join(pathPart, cmd);
987
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
988
- resolve(subStep(p, i$1, 0));
973
+ resolve(subStep(!pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd, i$1, 0));
989
974
  });
990
975
  const subStep = (p, i$1, ii) => new Promise((resolve, reject) => {
991
976
  if (ii === pathExt.length) return resolve(step(i$1 + 1));
@@ -1010,8 +995,7 @@ var require_which = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/which
1010
995
  for (let j = 0; j < pathExt.length; j++) {
1011
996
  const cur = p + pathExt[j];
1012
997
  try {
1013
- const is = isexe.sync(cur, { pathExt: pathExtExe });
1014
- if (is) if (opt.all) found.push(cur);
998
+ if (isexe.sync(cur, { pathExt: pathExtExe })) if (opt.all) found.push(cur);
1015
999
  else return cur;
1016
1000
  } catch (ex) {}
1017
1001
  }
@@ -1029,8 +1013,7 @@ var require_which = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/which
1029
1013
  var require_path_key = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js": ((exports, module) => {
1030
1014
  const pathKey$1 = (options = {}) => {
1031
1015
  const environment = options.env || process.env;
1032
- const platform$1 = options.platform || process.platform;
1033
- if (platform$1 !== "win32") return "PATH";
1016
+ if ((options.platform || process.platform) !== "win32") return "PATH";
1034
1017
  return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
1035
1018
  };
1036
1019
  module.exports = pathKey$1;
@@ -1158,12 +1141,11 @@ var require_parse = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/cross
1158
1141
  parsed.command = path$2.normalize(parsed.command);
1159
1142
  parsed.command = escape.command(parsed.command);
1160
1143
  parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
1161
- const shellCommand = [parsed.command].concat(parsed.args).join(" ");
1162
1144
  parsed.args = [
1163
1145
  "/d",
1164
1146
  "/s",
1165
1147
  "/c",
1166
- `"${shellCommand}"`
1148
+ `"${[parsed.command].concat(parsed.args).join(" ")}"`
1167
1149
  ];
1168
1150
  parsed.command = process.env.comspec || "cmd.exe";
1169
1151
  parsed.options.windowsVerbatimArguments = true;
@@ -1274,12 +1256,12 @@ function toPath(urlOrPath) {
1274
1256
  }
1275
1257
  function traversePathUp(startPath) {
1276
1258
  return { *[Symbol.iterator]() {
1277
- let currentPath = path$1.resolve(toPath(startPath));
1259
+ let currentPath = path.resolve(toPath(startPath));
1278
1260
  let previousPath;
1279
1261
  while (previousPath !== currentPath) {
1280
1262
  yield currentPath;
1281
1263
  previousPath = currentPath;
1282
- currentPath = path$1.resolve(currentPath, "..");
1264
+ currentPath = path.resolve(currentPath, "..");
1283
1265
  }
1284
1266
  } };
1285
1267
  }
@@ -1288,21 +1270,21 @@ const TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
1288
1270
  //#endregion
1289
1271
  //#region ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
1290
1272
  const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath: execPath$1 = process$1.execPath, addExecPath = true } = {}) => {
1291
- const cwdPath = path$1.resolve(toPath(cwd));
1273
+ const cwdPath = path.resolve(toPath(cwd));
1292
1274
  const result = [];
1293
- const pathParts = pathOption.split(path$1.delimiter);
1275
+ const pathParts = pathOption.split(path.delimiter);
1294
1276
  if (preferLocal) applyPreferLocal(result, pathParts, cwdPath);
1295
1277
  if (addExecPath) applyExecPath(result, pathParts, execPath$1, cwdPath);
1296
- return pathOption === "" || pathOption === path$1.delimiter ? `${result.join(path$1.delimiter)}${pathOption}` : [...result, pathOption].join(path$1.delimiter);
1278
+ return pathOption === "" || pathOption === path.delimiter ? `${result.join(path.delimiter)}${pathOption}` : [...result, pathOption].join(path.delimiter);
1297
1279
  };
1298
1280
  const applyPreferLocal = (result, pathParts, cwdPath) => {
1299
1281
  for (const directory of traversePathUp(cwdPath)) {
1300
- const pathPart = path$1.join(directory, "node_modules/.bin");
1282
+ const pathPart = path.join(directory, "node_modules/.bin");
1301
1283
  if (!pathParts.includes(pathPart)) result.push(pathPart);
1302
1284
  }
1303
1285
  };
1304
1286
  const applyExecPath = (result, pathParts, execPath$1, cwdPath) => {
1305
- const pathPart = path$1.resolve(cwdPath, toPath(execPath$1), "..");
1287
+ const pathPart = path.resolve(cwdPath, toPath(execPath$1), "..");
1306
1288
  if (!pathParts.includes(pathPart)) result.push(pathPart);
1307
1289
  };
1308
1290
  const npmRunPathEnv = ({ env = process$1.env,...options } = {}) => {
@@ -1316,9 +1298,7 @@ const npmRunPathEnv = ({ env = process$1.env,...options } = {}) => {
1316
1298
  //#endregion
1317
1299
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/return/final-error.js
1318
1300
  const getFinalError = (originalError, message, isSync) => {
1319
- const ErrorClass = isSync ? ExecaSyncError : ExecaError;
1320
- const options = originalError instanceof DiscardedError ? {} : { cause: originalError };
1321
- return new ErrorClass(message, options);
1301
+ return new (isSync ? ExecaSyncError : ExecaError)(message, originalError instanceof DiscardedError ? {} : { cause: originalError });
1322
1302
  };
1323
1303
  var DiscardedError = class extends Error {};
1324
1304
  const setErrorName = (ErrorClass, value) => {
@@ -1637,16 +1617,14 @@ const SIGNALS = [
1637
1617
  //#region ../../node_modules/.pnpm/human-signals@8.0.0/node_modules/human-signals/build/src/signals.js
1638
1618
  const getSignals = () => {
1639
1619
  const realtimeSignals = getRealtimeSignals();
1640
- const signals$1 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal$1);
1641
- return signals$1;
1620
+ return [...SIGNALS, ...realtimeSignals].map(normalizeSignal$1);
1642
1621
  };
1643
1622
  const normalizeSignal$1 = ({ name, number: defaultNumber, description, action, forced = false, standard }) => {
1644
1623
  const { signals: { [name]: constantSignal } } = constants;
1645
1624
  const supported = constantSignal !== void 0;
1646
- const number = supported ? constantSignal : defaultNumber;
1647
1625
  return {
1648
1626
  name,
1649
- number,
1627
+ number: supported ? constantSignal : defaultNumber,
1650
1628
  description,
1651
1629
  supported,
1652
1630
  action,
@@ -2058,8 +2036,7 @@ const isConnected = (anyProcess) => {
2058
2036
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/strict.js
2059
2037
  const handleSendStrict = ({ anyProcess, channel, isSubprocess, message, strict }) => {
2060
2038
  if (!strict) return message;
2061
- const ipcEmitter = getIpcEmitter(anyProcess, channel, isSubprocess);
2062
- const hasListeners = hasMessageListeners(anyProcess, ipcEmitter);
2039
+ const hasListeners = hasMessageListeners(anyProcess, getIpcEmitter(anyProcess, channel, isSubprocess));
2063
2040
  return {
2064
2041
  id: count++,
2065
2042
  type: REQUEST_TYPE,
@@ -2132,11 +2109,9 @@ const RESPONSE_TYPE = "execa:ipc:response";
2132
2109
  const startSendMessage = (anyProcess, wrappedMessage, strict) => {
2133
2110
  if (!OUTGOING_MESSAGES.has(anyProcess)) OUTGOING_MESSAGES.set(anyProcess, /* @__PURE__ */ new Set());
2134
2111
  const outgoingMessages = OUTGOING_MESSAGES.get(anyProcess);
2135
- const onMessageSent = createDeferred();
2136
- const id = strict ? wrappedMessage.id : void 0;
2137
2112
  const outgoingMessage = {
2138
- onMessageSent,
2139
- id
2113
+ onMessageSent: createDeferred(),
2114
+ id: strict ? wrappedMessage.id : void 0
2140
2115
  };
2141
2116
  outgoingMessages.add(outgoingMessage);
2142
2117
  return {
@@ -2297,8 +2272,7 @@ const throwOnGracefulCancel = ({ subprocess, cancelSignal, gracefulCancel, force
2297
2272
  })] : [];
2298
2273
  const sendOnAbort = async ({ subprocess, cancelSignal, forceKillAfterDelay, context, controller: { signal } }) => {
2299
2274
  await onAbortedSignal(cancelSignal, signal);
2300
- const reason = getReason(cancelSignal);
2301
- await sendAbort(subprocess, reason);
2275
+ await sendAbort(subprocess, getReason(cancelSignal));
2302
2276
  killOnTimeout({
2303
2277
  kill: subprocess.kill,
2304
2278
  forceKillAfterDelay,
@@ -2345,7 +2319,7 @@ const mapNode = ({ options }) => {
2345
2319
  const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = false, nodePath = execPath, nodeOptions = execArgv.filter((nodeOption) => !nodeOption.startsWith("--inspect")), cwd, execPath: formerNodePath,...options }) => {
2346
2320
  if (formerNodePath !== void 0) throw new TypeError("The \"execPath\" option has been removed. Please use the \"nodePath\" option instead.");
2347
2321
  const normalizedNodePath = safeNormalizeFileUrl(nodePath, "The \"nodePath\" option");
2348
- const resolvedNodePath = path$1.resolve(cwd, normalizedNodePath);
2322
+ const resolvedNodePath = path.resolve(cwd, normalizedNodePath);
2349
2323
  const newOptions = {
2350
2324
  ...options,
2351
2325
  nodePath: resolvedNodePath,
@@ -2357,7 +2331,7 @@ const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = fal
2357
2331
  commandArguments,
2358
2332
  newOptions
2359
2333
  ];
2360
- if (path$1.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
2334
+ if (path.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
2361
2335
  return [
2362
2336
  resolvedNodePath,
2363
2337
  [
@@ -2444,7 +2418,7 @@ const serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encod
2444
2418
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/arguments/cwd.js
2445
2419
  const normalizeCwd = (cwd = getDefaultCwd()) => {
2446
2420
  const cwdString = safeNormalizeFileUrl(cwd, "The \"cwd\" option");
2447
- return path$1.resolve(cwdString);
2421
+ return path.resolve(cwdString);
2448
2422
  };
2449
2423
  const getDefaultCwd = () => {
2450
2424
  try {
@@ -2472,8 +2446,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
2472
2446
  rawOptions.cwd = normalizeCwd(rawOptions.cwd);
2473
2447
  const [processedFile, processedArguments, processedOptions] = handleNodeOption(filePath, rawArguments, rawOptions);
2474
2448
  const { command: file, args: commandArguments, options: initialOptions } = import_cross_spawn.default._parse(processedFile, processedArguments, processedOptions);
2475
- const fdOptions = normalizeFdSpecificOptions(initialOptions);
2476
- const options = addDefaultOptions(fdOptions);
2449
+ const options = addDefaultOptions(normalizeFdSpecificOptions(initialOptions));
2477
2450
  validateTimeout(options);
2478
2451
  validateEncoding(options);
2479
2452
  validateIpcInputOption(options);
@@ -2484,7 +2457,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
2484
2457
  options.killSignal = normalizeKillSignal(options.killSignal);
2485
2458
  options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
2486
2459
  options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
2487
- if (process$1.platform === "win32" && path$1.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
2460
+ if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
2488
2461
  return {
2489
2462
  file,
2490
2463
  commandArguments,
@@ -2630,7 +2603,7 @@ const u = Object.create(a, {
2630
2603
  }
2631
2604
  });
2632
2605
  function h({ preventCancel: r = !1 } = {}) {
2633
- const e = this.getReader(), t = new c(e, r), s = Object.create(u);
2606
+ const t = new c(this.getReader(), r), s = Object.create(u);
2634
2607
  return s[n] = t, s;
2635
2608
  }
2636
2609
 
@@ -2679,18 +2652,14 @@ const getStreamContents$1 = async (stream, { init, convertChunk, getSize, trunca
2679
2652
  const state = init();
2680
2653
  state.length = 0;
2681
2654
  try {
2682
- for await (const chunk of asyncIterable) {
2683
- const chunkType = getChunkType(chunk);
2684
- const convertedChunk = convertChunk[chunkType](chunk, state);
2685
- appendChunk({
2686
- convertedChunk,
2687
- state,
2688
- getSize,
2689
- truncateChunk,
2690
- addChunk,
2691
- maxBuffer
2692
- });
2693
- }
2655
+ for await (const chunk of asyncIterable) appendChunk({
2656
+ convertedChunk: convertChunk[getChunkType(chunk)](chunk, state),
2657
+ state,
2658
+ getSize,
2659
+ truncateChunk,
2660
+ addChunk,
2661
+ maxBuffer
2662
+ });
2694
2663
  appendFinalChunk({
2695
2664
  state,
2696
2665
  convertChunk,
@@ -2880,10 +2849,9 @@ const stringMethods = {
2880
2849
  const handleMaxBuffer = ({ error, stream, readableObjectMode, lines, encoding, fdNumber }) => {
2881
2850
  if (!(error instanceof MaxBufferError)) throw error;
2882
2851
  if (fdNumber === "all") return error;
2883
- const unit = getMaxBufferUnit(readableObjectMode, lines, encoding);
2884
2852
  error.maxBufferInfo = {
2885
2853
  fdNumber,
2886
- unit
2854
+ unit: getMaxBufferUnit(readableObjectMode, lines, encoding)
2887
2855
  };
2888
2856
  stream.destroy();
2889
2857
  throw error;
@@ -2953,19 +2921,16 @@ const createMessages = ({ stdio, all, ipcOutput, originalError, signal, signalDe
2953
2921
  killSignal
2954
2922
  });
2955
2923
  const originalMessage = getOriginalMessage(originalError, cwd);
2956
- const suffix = originalMessage === void 0 ? "" : `\n${originalMessage}`;
2957
- const shortMessage = `${prefix}: ${escapedCommand}${suffix}`;
2958
- const messageStdio = all === void 0 ? [stdio[2], stdio[1]] : [all];
2959
- const message = [
2960
- shortMessage,
2961
- ...messageStdio,
2962
- ...stdio.slice(3),
2963
- ipcOutput.map((ipcMessage) => serializeIpcMessage(ipcMessage)).join("\n")
2964
- ].map((messagePart) => escapeLines(stripFinalNewline(serializeMessagePart(messagePart)))).filter(Boolean).join("\n\n");
2924
+ const shortMessage = `${prefix}: ${escapedCommand}${originalMessage === void 0 ? "" : `\n${originalMessage}`}`;
2965
2925
  return {
2966
2926
  originalMessage,
2967
2927
  shortMessage,
2968
- message
2928
+ message: [
2929
+ shortMessage,
2930
+ ...all === void 0 ? [stdio[2], stdio[1]] : [all],
2931
+ ...stdio.slice(3),
2932
+ ipcOutput.map((ipcMessage) => serializeIpcMessage(ipcMessage)).join("\n")
2933
+ ].map((messagePart) => escapeLines(stripFinalNewline(serializeMessagePart(messagePart)))).filter(Boolean).join("\n\n")
2969
2934
  };
2970
2935
  };
2971
2936
  const getErrorPrefix = ({ originalError, timedOut, timeout, isMaxBuffer, maxBuffer, errorCode, signal, signalDescription, exitCode, isCanceled, isGracefullyCanceled, isForcefullyTerminated, forceKillAfterDelay, killSignal }) => {
@@ -2986,8 +2951,7 @@ const getErrorPrefix = ({ originalError, timedOut, timeout, isMaxBuffer, maxBuff
2986
2951
  const getForcefulSuffix = (isForcefullyTerminated, forceKillAfterDelay) => isForcefullyTerminated ? ` and was forcefully terminated after ${forceKillAfterDelay} milliseconds` : "";
2987
2952
  const getOriginalMessage = (originalError, cwd) => {
2988
2953
  if (originalError instanceof DiscardedError) return;
2989
- const originalMessage = isExecaError(originalError) ? originalError.originalMessage : String(originalError?.message ?? originalError);
2990
- const escapedOriginalMessage = escapeLines(fixCwdError(originalMessage, cwd));
2954
+ const escapedOriginalMessage = escapeLines(fixCwdError(isExecaError(originalError) ? originalError.originalMessage : String(originalError?.message ?? originalError), cwd));
2991
2955
  return escapedOriginalMessage === "" ? void 0 : escapedOriginalMessage;
2992
2956
  };
2993
2957
  const serializeIpcMessage = (ipcMessage) => typeof ipcMessage === "string" ? ipcMessage : inspect(ipcMessage);
@@ -3109,11 +3073,10 @@ const omitUndefinedProperties = (result) => Object.fromEntries(Object.entries(re
3109
3073
  const normalizeExitPayload = (rawExitCode, rawSignal) => {
3110
3074
  const exitCode = rawExitCode === null ? void 0 : rawExitCode;
3111
3075
  const signal = rawSignal === null ? void 0 : rawSignal;
3112
- const signalDescription = signal === void 0 ? void 0 : getSignalDescription(rawSignal);
3113
3076
  return {
3114
3077
  exitCode,
3115
3078
  signal,
3116
- signalDescription
3079
+ signalDescription: signal === void 0 ? void 0 : getSignalDescription(rawSignal)
3117
3080
  };
3118
3081
  };
3119
3082
 
@@ -3178,8 +3141,7 @@ function prettyMilliseconds(milliseconds, options) {
3178
3141
  let result = [];
3179
3142
  const floorDecimals = (value, decimalDigits) => {
3180
3143
  const flooredInterimValue = Math.floor(value * 10 ** decimalDigits + SECOND_ROUNDING_EPSILON);
3181
- const flooredValue = Math.round(flooredInterimValue) / 10 ** decimalDigits;
3182
- return flooredValue.toFixed(decimalDigits);
3144
+ return (Math.round(flooredInterimValue) / 10 ** decimalDigits).toFixed(decimalDigits);
3183
3145
  };
3184
3146
  const add = (value, long, short, valueString) => {
3185
3147
  if ((result.length === 0 || !options.colonNotation) && isZero(value) && !(options.colonNotation && short === "m")) return;
@@ -3216,14 +3178,11 @@ function prettyMilliseconds(milliseconds, options) {
3216
3178
  } else {
3217
3179
  const millisecondsAndBelow = milliseconds$1 + microseconds / 1e3 + nanoseconds / 1e6;
3218
3180
  const millisecondsDecimalDigits = typeof options.millisecondsDecimalDigits === "number" ? options.millisecondsDecimalDigits : 0;
3219
- const roundedMilliseconds = millisecondsAndBelow >= 1 ? Math.round(millisecondsAndBelow) : Math.ceil(millisecondsAndBelow);
3220
- const millisecondsString = millisecondsDecimalDigits ? millisecondsAndBelow.toFixed(millisecondsDecimalDigits) : roundedMilliseconds;
3181
+ const millisecondsString = millisecondsDecimalDigits ? millisecondsAndBelow.toFixed(millisecondsDecimalDigits) : millisecondsAndBelow >= 1 ? Math.round(millisecondsAndBelow) : Math.ceil(millisecondsAndBelow);
3221
3182
  add(Number.parseFloat(millisecondsString), "millisecond", "ms", millisecondsString);
3222
3183
  }
3223
3184
  } else {
3224
- const seconds = (isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds) / 1e3 % 60;
3225
- const secondsDecimalDigits = typeof options.secondsDecimalDigits === "number" ? options.secondsDecimalDigits : 1;
3226
- const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
3185
+ const secondsFixed = floorDecimals((isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds) / 1e3 % 60, typeof options.secondsDecimalDigits === "number" ? options.secondsDecimalDigits : 1);
3227
3186
  const secondsString = options.keepDecimalsOnWholeSeconds ? secondsFixed : secondsFixed.replace(/\.0+$/, "");
3228
3187
  add(Number.parseFloat(secondsString), "second", "s", secondsString);
3229
3188
  }
@@ -3252,10 +3211,9 @@ const logResult = (result, verboseInfo) => {
3252
3211
  logDuration(result, verboseInfo);
3253
3212
  };
3254
3213
  const logDuration = (result, verboseInfo) => {
3255
- const verboseMessage = `(done in ${prettyMilliseconds(result.durationMs)})`;
3256
3214
  verboseLog({
3257
3215
  type: "duration",
3258
- verboseMessage,
3216
+ verboseMessage: `(done in ${prettyMilliseconds(result.durationMs)})`,
3259
3217
  verboseInfo,
3260
3218
  result
3261
3219
  });
@@ -3382,18 +3340,16 @@ const TYPE_TO_MESSAGE = {
3382
3340
  const getTransformObjectModes = (objectMode, index, newTransforms, direction) => direction === "output" ? getOutputObjectModes(objectMode, index, newTransforms) : getInputObjectModes(objectMode, index, newTransforms);
3383
3341
  const getOutputObjectModes = (objectMode, index, newTransforms) => {
3384
3342
  const writableObjectMode = index !== 0 && newTransforms[index - 1].value.readableObjectMode;
3385
- const readableObjectMode = objectMode ?? writableObjectMode;
3386
3343
  return {
3387
3344
  writableObjectMode,
3388
- readableObjectMode
3345
+ readableObjectMode: objectMode ?? writableObjectMode
3389
3346
  };
3390
3347
  };
3391
3348
  const getInputObjectModes = (objectMode, index, newTransforms) => {
3392
3349
  const writableObjectMode = index === 0 ? objectMode === true : newTransforms[index - 1].value.readableObjectMode;
3393
- const readableObjectMode = index !== newTransforms.length - 1 && (objectMode ?? writableObjectMode);
3394
3350
  return {
3395
3351
  writableObjectMode,
3396
- readableObjectMode
3352
+ readableObjectMode: index !== newTransforms.length - 1 && (objectMode ?? writableObjectMode)
3397
3353
  };
3398
3354
  };
3399
3355
  const getFdObjectMode = (stdioItems, direction) => {
@@ -3702,8 +3658,7 @@ const validateDuplicateStreamSync = ({ otherStdioItems, type, value, optionName,
3702
3658
  const getDuplicateStreamInstance = ({ otherStdioItems, type, value, optionName, direction }) => {
3703
3659
  const duplicateStdioItems = otherStdioItems.filter((stdioItem) => hasSameValue(stdioItem, value));
3704
3660
  if (duplicateStdioItems.length === 0) return;
3705
- const differentStdioItem = duplicateStdioItems.find((stdioItem) => stdioItem.direction !== direction);
3706
- throwOnDuplicateStream(differentStdioItem, optionName, type);
3661
+ throwOnDuplicateStream(duplicateStdioItems.find((stdioItem) => stdioItem.direction !== direction), optionName, type);
3707
3662
  return direction === "output" ? duplicateStdioItems[0].stream : void 0;
3708
3663
  };
3709
3664
  const hasSameValue = ({ type, value }, secondValue) => {
@@ -3712,8 +3667,7 @@ const hasSameValue = ({ type, value }, secondValue) => {
3712
3667
  return value === secondValue;
3713
3668
  };
3714
3669
  const validateDuplicateTransform = ({ otherStdioItems, type, value, optionName }) => {
3715
- const duplicateStdioItem = otherStdioItems.find(({ value: { transform } }) => transform === value.transform);
3716
- throwOnDuplicateStream(duplicateStdioItem, optionName, type);
3670
+ throwOnDuplicateStream(otherStdioItems.find(({ value: { transform } }) => transform === value.transform), optionName, type);
3717
3671
  };
3718
3672
  const throwOnDuplicateStream = (stdioItem, optionName, type) => {
3719
3673
  if (stdioItem !== void 0) throw new TypeError(`The \`${stdioItem.optionName}\` and \`${optionName}\` options must not target ${TYPE_TO_MESSAGE[type]} that is the same.`);
@@ -3722,15 +3676,13 @@ const throwOnDuplicateStream = (stdioItem, optionName, type) => {
3722
3676
  //#endregion
3723
3677
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/stdio/handle.js
3724
3678
  const handleStdio = (addProperties$2, options, verboseInfo, isSync) => {
3725
- const stdio = normalizeStdioOption(options, verboseInfo, isSync);
3726
- const initialFileDescriptors = stdio.map((stdioOption, fdNumber) => getFileDescriptor({
3727
- stdioOption,
3728
- fdNumber,
3729
- options,
3730
- isSync
3731
- }));
3732
3679
  const fileDescriptors = getFinalFileDescriptors({
3733
- initialFileDescriptors,
3680
+ initialFileDescriptors: normalizeStdioOption(options, verboseInfo, isSync).map((stdioOption, fdNumber) => getFileDescriptor({
3681
+ stdioOption,
3682
+ fdNumber,
3683
+ options,
3684
+ isSync
3685
+ })),
3734
3686
  addProperties: addProperties$2,
3735
3687
  options,
3736
3688
  isSync
@@ -3747,14 +3699,13 @@ const getFileDescriptor = ({ stdioOption, fdNumber, options, isSync }) => {
3747
3699
  optionName
3748
3700
  });
3749
3701
  const direction = getStreamDirection(initialStdioItems, fdNumber, optionName);
3750
- const stdioItems = initialStdioItems.map((stdioItem) => handleNativeStream({
3702
+ const normalizedStdioItems = normalizeTransforms(initialStdioItems.map((stdioItem) => handleNativeStream({
3751
3703
  stdioItem,
3752
3704
  isStdioArray,
3753
3705
  fdNumber,
3754
3706
  direction,
3755
3707
  isSync
3756
- }));
3757
- const normalizedStdioItems = normalizeTransforms(stdioItems, optionName, direction, options);
3708
+ })), optionName, direction, options);
3758
3709
  const objectMode = getFdObjectMode(normalizedStdioItems, direction);
3759
3710
  validateFileObjectMode(normalizedStdioItems, objectMode);
3760
3711
  return {
@@ -3764,9 +3715,7 @@ const getFileDescriptor = ({ stdioOption, fdNumber, options, isSync }) => {
3764
3715
  };
3765
3716
  };
3766
3717
  const initializeStdioItems = ({ stdioOption, fdNumber, options, optionName }) => {
3767
- const values = Array.isArray(stdioOption) ? stdioOption : [stdioOption];
3768
- const initialStdioItems = [...values.map((value) => initializeStdioItem(value, optionName)), ...handleInputOptions(options, fdNumber)];
3769
- const stdioItems = filterDuplicates(initialStdioItems);
3718
+ const stdioItems = filterDuplicates([...(Array.isArray(stdioOption) ? stdioOption : [stdioOption]).map((value) => initializeStdioItem(value, optionName)), ...handleInputOptions(options, fdNumber)]);
3770
3719
  const isStdioArray = stdioItems.length > 1;
3771
3720
  validateStdioArray(stdioItems, isStdioArray, optionName);
3772
3721
  validateStreams(stdioItems);
@@ -3816,18 +3765,17 @@ const getFinalFileDescriptors = ({ initialFileDescriptors, addProperties: addPro
3816
3765
  }
3817
3766
  };
3818
3767
  const getFinalFileDescriptor = ({ fileDescriptor: { direction, objectMode, stdioItems }, fileDescriptors, addProperties: addProperties$2, options, isSync }) => {
3819
- const finalStdioItems = stdioItems.map((stdioItem) => addStreamProperties({
3820
- stdioItem,
3821
- addProperties: addProperties$2,
3822
- direction,
3823
- options,
3824
- fileDescriptors,
3825
- isSync
3826
- }));
3827
3768
  return {
3828
3769
  direction,
3829
3770
  objectMode,
3830
- stdioItems: finalStdioItems
3771
+ stdioItems: stdioItems.map((stdioItem) => addStreamProperties({
3772
+ stdioItem,
3773
+ addProperties: addProperties$2,
3774
+ direction,
3775
+ options,
3776
+ fileDescriptors,
3777
+ isSync
3778
+ }))
3831
3779
  };
3832
3780
  };
3833
3781
  const addStreamProperties = ({ stdioItem, addProperties: addProperties$2, direction, options, fileDescriptors, isSync }) => {
@@ -3957,8 +3905,7 @@ const appendNewlineGenerator = function* ({ isWindowsNewline = false }, chunk) {
3957
3905
  yield chunk;
3958
3906
  return;
3959
3907
  }
3960
- const newline = isWindowsNewline ? windowsNewline : unixNewline;
3961
- yield concatBytes(chunk, newline);
3908
+ yield concatBytes(chunk, isWindowsNewline ? windowsNewline : unixNewline);
3962
3909
  };
3963
3910
  const concatString = (firstChunk, secondChunk) => `${firstChunk}${secondChunk}`;
3964
3911
  const linesStringInfo = {
@@ -4103,7 +4050,7 @@ const generatorToStream = ({ value, value: { transform, final, writableObjectMod
4103
4050
  const transformMethod = transformAsync ? pushChunks.bind(void 0, transformChunk, state) : pushChunksSync.bind(void 0, transformChunkSync);
4104
4051
  const finalMethod = transformAsync || finalAsync ? pushChunks.bind(void 0, finalChunks, state) : pushChunksSync.bind(void 0, finalChunksSync);
4105
4052
  const destroyMethod = transformAsync || finalAsync ? destroyTransform.bind(void 0, state) : void 0;
4106
- const stream = new Transform({
4053
+ return { stream: new Transform({
4107
4054
  writableObjectMode,
4108
4055
  writableHighWaterMark: getDefaultHighWaterMark(writableObjectMode),
4109
4056
  readableObjectMode,
@@ -4119,16 +4066,12 @@ const generatorToStream = ({ value, value: { transform, final, writableObjectMod
4119
4066
  finalMethod([generators], this, done);
4120
4067
  },
4121
4068
  destroy: destroyMethod
4122
- });
4123
- return { stream };
4069
+ }) };
4124
4070
  };
4125
4071
  const runGeneratorsSync = (chunks, stdioItems, encoding, isInput) => {
4126
4072
  const generators = stdioItems.filter(({ type }) => type === "generator");
4127
4073
  const reversedGenerators = isInput ? generators.reverse() : generators;
4128
- for (const { value, optionName } of reversedGenerators) {
4129
- const generators$1 = addInternalGenerators(value, encoding, optionName);
4130
- chunks = runTransformSync(generators$1, chunks);
4131
- }
4074
+ for (const { value, optionName } of reversedGenerators) chunks = runTransformSync(addInternalGenerators(value, encoding, optionName), chunks);
4132
4075
  return chunks;
4133
4076
  };
4134
4077
  const addInternalGenerators = ({ transform, final, binary, writableObjectMode, readableObjectMode, preserveNewlines }, encoding, optionName) => {
@@ -4165,9 +4108,7 @@ const addInputOptionSync = (fileDescriptors, fdNumber, options) => {
4165
4108
  const [{ type, optionName }] = allStdioItems;
4166
4109
  throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be ${TYPE_TO_MESSAGE[type]} with synchronous methods.`);
4167
4110
  }
4168
- const allContents = allStdioItems.map(({ contents }) => contents);
4169
- const transformedContents = allContents.map((contents) => applySingleInputGeneratorsSync(contents, stdioItems));
4170
- options.input = joinToUint8Array(transformedContents);
4111
+ options.input = joinToUint8Array(allStdioItems.map(({ contents }) => contents).map((contents) => applySingleInputGeneratorsSync(contents, stdioItems)));
4171
4112
  };
4172
4113
  const applySingleInputGeneratorsSync = (contents, stdioItems) => {
4173
4114
  const newContents = runGeneratorsSync(contents, stdioItems, "utf8", true);
@@ -4192,10 +4133,9 @@ const logLinesSync = (linesArray, fdNumber, verboseInfo) => {
4192
4133
  };
4193
4134
  const isPipingStream = (stream) => stream._readableState.pipes.length > 0;
4194
4135
  const logLine = (line, fdNumber, verboseInfo) => {
4195
- const verboseMessage = serializeVerboseMessage(line);
4196
4136
  verboseLog({
4197
4137
  type: "output",
4198
- verboseMessage,
4138
+ verboseMessage: serializeVerboseMessage(line),
4199
4139
  fdNumber,
4200
4140
  verboseInfo
4201
4141
  });
@@ -4207,28 +4147,25 @@ const transformOutputSync = ({ fileDescriptors, syncResult: { output }, options,
4207
4147
  if (output === null) return { output: Array.from({ length: 3 }) };
4208
4148
  const state = {};
4209
4149
  const outputFiles = /* @__PURE__ */ new Set([]);
4210
- const transformedOutput = output.map((result, fdNumber) => transformOutputResultSync({
4211
- result,
4212
- fileDescriptors,
4213
- fdNumber,
4214
- state,
4215
- outputFiles,
4216
- isMaxBuffer,
4217
- verboseInfo
4218
- }, options));
4219
4150
  return {
4220
- output: transformedOutput,
4151
+ output: output.map((result, fdNumber) => transformOutputResultSync({
4152
+ result,
4153
+ fileDescriptors,
4154
+ fdNumber,
4155
+ state,
4156
+ outputFiles,
4157
+ isMaxBuffer,
4158
+ verboseInfo
4159
+ }, options)),
4221
4160
  ...state
4222
4161
  };
4223
4162
  };
4224
4163
  const transformOutputResultSync = ({ result, fileDescriptors, fdNumber, state, outputFiles, isMaxBuffer, verboseInfo }, { buffer, encoding, lines, stripFinalNewline: stripFinalNewline$1, maxBuffer }) => {
4225
4164
  if (result === null) return;
4226
- const truncatedResult = truncateMaxBufferSync(result, isMaxBuffer, maxBuffer);
4227
- const uint8ArrayResult = bufferToUint8Array(truncatedResult);
4165
+ const uint8ArrayResult = bufferToUint8Array(truncateMaxBufferSync(result, isMaxBuffer, maxBuffer));
4228
4166
  const { stdioItems, objectMode } = fileDescriptors[fdNumber];
4229
- const chunks = runOutputGeneratorsSync([uint8ArrayResult], stdioItems, encoding, state);
4230
4167
  const { serializedResult, finalResult = serializedResult } = serializeChunks({
4231
- chunks,
4168
+ chunks: runOutputGeneratorsSync([uint8ArrayResult], stdioItems, encoding, state),
4232
4169
  objectMode,
4233
4170
  encoding,
4234
4171
  lines,
@@ -4339,14 +4276,12 @@ const isFailedExit = (exitCode, signal) => exitCode !== 0 || signal !== null;
4339
4276
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/resolve/exit-sync.js
4340
4277
  const getExitResultSync = ({ error, status: exitCode, signal, output }, { maxBuffer }) => {
4341
4278
  const resultError = getResultError(error, exitCode, signal);
4342
- const timedOut = resultError?.code === "ETIMEDOUT";
4343
- const isMaxBuffer = isMaxBufferSync(resultError, output, maxBuffer);
4344
4279
  return {
4345
4280
  resultError,
4346
4281
  exitCode,
4347
4282
  signal,
4348
- timedOut,
4349
- isMaxBuffer
4283
+ timedOut: resultError?.code === "ETIMEDOUT",
4284
+ isMaxBuffer: isMaxBufferSync(resultError, output, maxBuffer)
4350
4285
  };
4351
4286
  };
4352
4287
  const getResultError = (error, exitCode, signal) => {
@@ -4358,7 +4293,7 @@ const getResultError = (error, exitCode, signal) => {
4358
4293
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/methods/main-sync.js
4359
4294
  const execaCoreSync = (rawFile, rawArguments, rawOptions) => {
4360
4295
  const { file, commandArguments, command, escapedCommand, startTime, verboseInfo, options, fileDescriptors } = handleSyncArguments(rawFile, rawArguments, rawOptions);
4361
- const result = spawnSubprocessSync({
4296
+ return handleResult(spawnSubprocessSync({
4362
4297
  file,
4363
4298
  commandArguments,
4364
4299
  options,
@@ -4367,15 +4302,12 @@ const execaCoreSync = (rawFile, rawArguments, rawOptions) => {
4367
4302
  verboseInfo,
4368
4303
  fileDescriptors,
4369
4304
  startTime
4370
- });
4371
- return handleResult(result, verboseInfo, options);
4305
+ }), verboseInfo, options);
4372
4306
  };
4373
4307
  const handleSyncArguments = (rawFile, rawArguments, rawOptions) => {
4374
4308
  const { command, escapedCommand, startTime, verboseInfo } = handleCommand(rawFile, rawArguments, rawOptions);
4375
- const syncOptions = normalizeSyncOptions(rawOptions);
4376
- const { file, commandArguments, options } = normalizeOptions(rawFile, rawArguments, syncOptions);
4309
+ const { file, commandArguments, options } = normalizeOptions(rawFile, rawArguments, normalizeSyncOptions(rawOptions));
4377
4310
  validateSyncOptions(options);
4378
- const fileDescriptors = handleStdioSync(options, verboseInfo);
4379
4311
  return {
4380
4312
  file,
4381
4313
  commandArguments,
@@ -4384,7 +4316,7 @@ const handleSyncArguments = (rawFile, rawArguments, rawOptions) => {
4384
4316
  startTime,
4385
4317
  verboseInfo,
4386
4318
  options,
4387
- fileDescriptors
4319
+ fileDescriptors: handleStdioSync(options, verboseInfo)
4388
4320
  };
4389
4321
  };
4390
4322
  const normalizeSyncOptions = (options) => options.node && !options.ipc ? {
@@ -4419,16 +4351,14 @@ const spawnSubprocessSync = ({ file, commandArguments, options, command, escaped
4419
4351
  isMaxBuffer,
4420
4352
  verboseInfo
4421
4353
  });
4422
- const stdio = output.map((stdioOutput, fdNumber) => stripNewline(stdioOutput, options, fdNumber));
4423
- const all = stripNewline(getAllSync(output, options), options, "all");
4424
4354
  return getSyncResult({
4425
4355
  error,
4426
4356
  exitCode,
4427
4357
  signal,
4428
4358
  timedOut,
4429
4359
  isMaxBuffer,
4430
- stdio,
4431
- all,
4360
+ stdio: output.map((stdioOutput, fdNumber) => stripNewline(stdioOutput, options, fdNumber)),
4361
+ all: stripNewline(getAllSync(output, options), options, "all"),
4432
4362
  options,
4433
4363
  command,
4434
4364
  escapedCommand,
@@ -4438,8 +4368,7 @@ const spawnSubprocessSync = ({ file, commandArguments, options, command, escaped
4438
4368
  const runSubprocessSync = ({ file, commandArguments, options, command, escapedCommand, fileDescriptors, startTime }) => {
4439
4369
  try {
4440
4370
  addInputOptionsSync(fileDescriptors, options);
4441
- const normalizedOptions = normalizeSpawnSyncOptions(options);
4442
- return spawnSync(file, commandArguments, normalizedOptions);
4371
+ return spawnSync(file, commandArguments, normalizeSpawnSyncOptions(options));
4443
4372
  } catch (error) {
4444
4373
  return makeEarlyError({
4445
4374
  error,
@@ -4657,19 +4586,17 @@ const handleEarlyError = ({ error, command, escapedCommand, fileDescriptors, opt
4657
4586
  writable,
4658
4587
  duplex
4659
4588
  });
4660
- const earlyError = makeEarlyError({
4661
- error,
4662
- command,
4663
- escapedCommand,
4664
- fileDescriptors,
4665
- options,
4666
- startTime,
4667
- isSync: false
4668
- });
4669
- const promise = handleDummyPromise(earlyError, verboseInfo, options);
4670
4589
  return {
4671
4590
  subprocess,
4672
- promise
4591
+ promise: handleDummyPromise(makeEarlyError({
4592
+ error,
4593
+ command,
4594
+ escapedCommand,
4595
+ fileDescriptors,
4596
+ options,
4597
+ startTime,
4598
+ isSync: false
4599
+ }), verboseInfo, options)
4673
4600
  };
4674
4601
  };
4675
4602
  const createDummyStreams = (subprocess, fileDescriptors) => {
@@ -4718,8 +4645,7 @@ const addProperties = {
4718
4645
  nodeStream: ({ value }) => ({ stream: value }),
4719
4646
  webTransform({ value: { transform, writableObjectMode, readableObjectMode } }) {
4720
4647
  const objectMode = writableObjectMode || readableObjectMode;
4721
- const stream = Duplex.fromWeb(transform, { objectMode });
4722
- return { stream };
4648
+ return { stream: Duplex.fromWeb(transform, { objectMode }) };
4723
4649
  },
4724
4650
  duplex: ({ value: { transform } }) => ({ stream: transform }),
4725
4651
  native() {}
@@ -4965,10 +4891,7 @@ const pipeOutputAsync = (subprocess, fileDescriptors, controller) => {
4965
4891
  controller
4966
4892
  });
4967
4893
  }
4968
- for (const [outputStream, inputStreams] of pipeGroups.entries()) {
4969
- const inputStream = inputStreams.length === 1 ? inputStreams[0] : mergeStreams(inputStreams);
4970
- pipeStreams(inputStream, outputStream);
4971
- }
4894
+ for (const [outputStream, inputStreams] of pipeGroups.entries()) pipeStreams(inputStreams.length === 1 ? inputStreams[0] : mergeStreams(inputStreams), outputStream);
4972
4895
  };
4973
4896
  const pipeTransform = (subprocess, stream, direction, fdNumber) => {
4974
4897
  if (direction === "output") pipeStreams(subprocess.stdio[fdNumber], stream);
@@ -5230,10 +5153,9 @@ const normalizePipeArguments = ({ source, sourcePromise, boundOptions, createNes
5230
5153
  const getDestinationStream = (boundOptions, createNested, pipeArguments) => {
5231
5154
  try {
5232
5155
  const { destination, pipeOptions: { from, to, unpipeSignal } = {} } = getDestination(boundOptions, createNested, ...pipeArguments);
5233
- const destinationStream = getToStream(destination, to);
5234
5156
  return {
5235
5157
  destination,
5236
- destinationStream,
5158
+ destinationStream: getToStream(destination, to),
5237
5159
  from,
5238
5160
  unpipeSignal
5239
5161
  };
@@ -5242,19 +5164,15 @@ const getDestinationStream = (boundOptions, createNested, pipeArguments) => {
5242
5164
  }
5243
5165
  };
5244
5166
  const getDestination = (boundOptions, createNested, firstArgument, ...pipeArguments) => {
5245
- if (Array.isArray(firstArgument)) {
5246
- const destination = createNested(mapDestinationArguments, boundOptions)(firstArgument, ...pipeArguments);
5247
- return {
5248
- destination,
5249
- pipeOptions: boundOptions
5250
- };
5251
- }
5167
+ if (Array.isArray(firstArgument)) return {
5168
+ destination: createNested(mapDestinationArguments, boundOptions)(firstArgument, ...pipeArguments),
5169
+ pipeOptions: boundOptions
5170
+ };
5252
5171
  if (typeof firstArgument === "string" || firstArgument instanceof URL || isDenoExecPath(firstArgument)) {
5253
5172
  if (Object.keys(boundOptions).length > 0) throw new TypeError("Please use .pipe(\"file\", ..., options) or .pipe(execa(\"file\", ..., options)) instead of .pipe(options)(\"file\", ...).");
5254
5173
  const [rawFile, rawArguments, rawOptions] = normalizeParameters(firstArgument, ...pipeArguments);
5255
- const destination = createNested(mapDestinationArguments)(rawFile, rawArguments, rawOptions);
5256
5174
  return {
5257
- destination,
5175
+ destination: createNested(mapDestinationArguments)(rawFile, rawArguments, rawOptions),
5258
5176
  pipeOptions: rawOptions
5259
5177
  };
5260
5178
  }
@@ -5274,8 +5192,7 @@ const mapDestinationArguments = ({ options }) => ({ options: {
5274
5192
  } });
5275
5193
  const getSourceStream = (source, from) => {
5276
5194
  try {
5277
- const sourceStream = getFromStream(source, from);
5278
- return { sourceStream };
5195
+ return { sourceStream: getFromStream(source, from) };
5279
5196
  } catch (error) {
5280
5197
  return { sourceError: error };
5281
5198
  }
@@ -5369,9 +5286,8 @@ const unpipeOnAbort = (unpipeSignal, unpipeContext) => unpipeSignal === void 0 ?
5369
5286
  const unpipeOnSignalAbort = async (unpipeSignal, { sourceStream, mergedStream, fileDescriptors, sourceOptions, startTime }) => {
5370
5287
  await aborted(unpipeSignal, sourceStream);
5371
5288
  await mergedStream.remove(sourceStream);
5372
- const error = /* @__PURE__ */ new Error("Pipe canceled by `unpipeSignal` option.");
5373
5289
  throw createNonCommandError({
5374
- error,
5290
+ error: /* @__PURE__ */ new Error("Pipe canceled by `unpipeSignal` option."),
5375
5291
  fileDescriptors,
5376
5292
  sourceOptions,
5377
5293
  startTime
@@ -5474,13 +5390,12 @@ const stopReadingOnStreamEnd = async (onStreamEnd, controller, stream) => {
5474
5390
  }
5475
5391
  };
5476
5392
  const iterateOnStream = ({ stream, controller, binary, shouldEncode, encoding, shouldSplit, preserveNewlines }) => {
5477
- const onStdoutChunk = on(stream, "data", {
5478
- signal: controller.signal,
5479
- highWaterMark: HIGH_WATER_MARK,
5480
- highWatermark: HIGH_WATER_MARK
5481
- });
5482
5393
  return iterateOnData({
5483
- onStdoutChunk,
5394
+ onStdoutChunk: on(stream, "data", {
5395
+ signal: controller.signal,
5396
+ highWaterMark: HIGH_WATER_MARK,
5397
+ highWatermark: HIGH_WATER_MARK
5398
+ }),
5484
5399
  controller,
5485
5400
  binary,
5486
5401
  shouldEncode,
@@ -5525,13 +5440,12 @@ const getStreamOutput = async ({ stream, onStreamEnd, fdNumber, encoding, buffer
5525
5440
  await Promise.all([resumeStream(stream), logPromise]);
5526
5441
  return;
5527
5442
  }
5528
- const stripFinalNewlineValue = getStripFinalNewline(stripFinalNewline$1, fdNumber);
5529
5443
  const iterable = iterateForResult({
5530
5444
  stream,
5531
5445
  onStreamEnd,
5532
5446
  lines,
5533
5447
  encoding,
5534
- stripFinalNewline: stripFinalNewlineValue,
5448
+ stripFinalNewline: getStripFinalNewline(stripFinalNewline$1, fdNumber),
5535
5449
  allMixed
5536
5450
  });
5537
5451
  const [output] = await Promise.all([getStreamContents({
@@ -5551,15 +5465,14 @@ const logOutputAsync = async ({ stream, onStreamEnd, fdNumber, encoding, allMixe
5551
5465
  verboseInfo,
5552
5466
  fdNumber
5553
5467
  })) return;
5554
- const linesIterable = iterateForResult({
5468
+ await logLines(iterateForResult({
5555
5469
  stream,
5556
5470
  onStreamEnd,
5557
5471
  lines: true,
5558
5472
  encoding,
5559
5473
  stripFinalNewline: true,
5560
5474
  allMixed
5561
- });
5562
- await logLines(linesIterable, stream, fdNumber, verboseInfo);
5475
+ }), stream, fdNumber, verboseInfo);
5563
5476
  };
5564
5477
  const resumeStream = async (stream) => {
5565
5478
  await setImmediate();
@@ -5709,10 +5622,9 @@ const getAllMixed = ({ all, stdout, stderr }) => all && stdout && stderr && stdo
5709
5622
  //#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/ipc.js
5710
5623
  const shouldLogIpc = (verboseInfo) => isFullVerbose(verboseInfo, "ipc");
5711
5624
  const logIpcOutput = (message, verboseInfo) => {
5712
- const verboseMessage = serializeVerboseMessage(message);
5713
5625
  verboseLog({
5714
5626
  type: "ipc",
5715
- verboseMessage,
5627
+ verboseMessage: serializeVerboseMessage(message),
5716
5628
  fdNumber: "ipc",
5717
5629
  verboseInfo
5718
5630
  });
@@ -5855,9 +5767,8 @@ const addConcurrentStream = (concurrentStreams, stream, waitName) => {
5855
5767
  const promises = weakMap.get(stream);
5856
5768
  const promise = createDeferred();
5857
5769
  promises.push(promise);
5858
- const resolve = promise.resolve.bind(promise);
5859
5770
  return {
5860
- resolve,
5771
+ resolve: promise.resolve.bind(promise),
5861
5772
  promises
5862
5773
  };
5863
5774
  };
@@ -5938,10 +5849,9 @@ const createReadable = ({ subprocess, concurrentStreams, encoding }, { from, bin
5938
5849
  };
5939
5850
  const getSubprocessStdout = (subprocess, from, concurrentStreams) => {
5940
5851
  const subprocessStdout = getFromStream(subprocess, from);
5941
- const waitReadableDestroy = addConcurrentStream(concurrentStreams, subprocessStdout, "readableDestroy");
5942
5852
  return {
5943
5853
  subprocessStdout,
5944
- waitReadableDestroy
5854
+ waitReadableDestroy: addConcurrentStream(concurrentStreams, subprocessStdout, "readableDestroy")
5945
5855
  };
5946
5856
  };
5947
5857
  const getReadableOptions = ({ readableEncoding, readableObjectMode, readableHighWaterMark }, binary) => binary ? {
@@ -6019,12 +5929,10 @@ const createWritable = ({ subprocess, concurrentStreams }, { to } = {}) => {
6019
5929
  };
6020
5930
  const getSubprocessStdin = (subprocess, to, concurrentStreams) => {
6021
5931
  const subprocessStdin = getToStream(subprocess, to);
6022
- const waitWritableFinal = addConcurrentStream(concurrentStreams, subprocessStdin, "writableFinal");
6023
- const waitWritableDestroy = addConcurrentStream(concurrentStreams, subprocessStdin, "writableDestroy");
6024
5932
  return {
6025
5933
  subprocessStdin,
6026
- waitWritableFinal,
6027
- waitWritableDestroy
5934
+ waitWritableFinal: addConcurrentStream(concurrentStreams, subprocessStdin, "writableFinal"),
5935
+ waitWritableDestroy: addConcurrentStream(concurrentStreams, subprocessStdin, "writableDestroy")
6028
5936
  };
6029
5937
  };
6030
5938
  const getWritableMethods = (subprocessStdin, subprocess, waitWritableFinal) => ({
@@ -6120,15 +6028,14 @@ const onDuplexDestroy = async ({ subprocessStdout, subprocessStdin, subprocess,
6120
6028
  const createIterable = (subprocess, encoding, { from, binary: binaryOption = false, preserveNewlines = false } = {}) => {
6121
6029
  const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
6122
6030
  const subprocessStdout = getFromStream(subprocess, from);
6123
- const onStdoutData = iterateOnSubprocessStream({
6031
+ return iterateOnStdoutData(iterateOnSubprocessStream({
6124
6032
  subprocessStdout,
6125
6033
  subprocess,
6126
6034
  binary,
6127
6035
  shouldEncode: true,
6128
6036
  encoding,
6129
6037
  preserveNewlines
6130
- });
6131
- return iterateOnStdoutData(onStdoutData, subprocessStdout, subprocess);
6038
+ }), subprocessStdout, subprocess);
6132
6039
  };
6133
6040
  const iterateOnStdoutData = async function* (onStdoutData, subprocessStdout, subprocess) {
6134
6041
  try {
@@ -6210,7 +6117,6 @@ const handleAsyncArguments = (rawFile, rawArguments, rawOptions) => {
6210
6117
  const { command, escapedCommand, startTime, verboseInfo } = handleCommand(rawFile, rawArguments, rawOptions);
6211
6118
  const { file, commandArguments, options: normalizedOptions } = normalizeOptions(rawFile, rawArguments, rawOptions);
6212
6119
  const options = handleAsyncOptions(normalizedOptions);
6213
- const fileDescriptors = handleStdioAsync(options, verboseInfo);
6214
6120
  return {
6215
6121
  file,
6216
6122
  commandArguments,
@@ -6219,7 +6125,7 @@ const handleAsyncArguments = (rawFile, rawArguments, rawOptions) => {
6219
6125
  startTime,
6220
6126
  verboseInfo,
6221
6127
  options,
6222
- fileDescriptors
6128
+ fileDescriptors: handleStdioAsync(options, verboseInfo)
6223
6129
  };
6224
6130
  };
6225
6131
  const handleAsyncOptions = ({ timeout, signal,...options }) => {
@@ -6292,22 +6198,19 @@ const handlePromise = async ({ subprocess, options, startTime, verboseInfo, file
6292
6198
  });
6293
6199
  controller.abort();
6294
6200
  onInternalError.resolve();
6295
- const stdio = stdioResults.map((stdioResult, fdNumber) => stripNewline(stdioResult, options, fdNumber));
6296
- const all = stripNewline(allResult, options, "all");
6297
- const result = getAsyncResult({
6201
+ return handleResult(getAsyncResult({
6298
6202
  errorInfo,
6299
6203
  exitCode,
6300
6204
  signal,
6301
- stdio,
6302
- all,
6205
+ stdio: stdioResults.map((stdioResult, fdNumber) => stripNewline(stdioResult, options, fdNumber)),
6206
+ all: stripNewline(allResult, options, "all"),
6303
6207
  ipcOutput,
6304
6208
  context,
6305
6209
  options,
6306
6210
  command,
6307
6211
  escapedCommand,
6308
6212
  startTime
6309
- });
6310
- return handleResult(result, verboseInfo, options);
6213
+ }), verboseInfo, options);
6311
6214
  };
6312
6215
  const getAsyncResult = ({ errorInfo, exitCode, signal, stdio, all, ipcOutput, context, options, command, escapedCommand, startTime }) => "error" in errorInfo ? makeError({
6313
6216
  error: errorInfo.error,
@@ -6380,8 +6283,7 @@ const callBoundExeca = ({ mapArguments, deepOptions = {}, boundOptions = {}, set
6380
6283
  return isSync ? execaCoreSync(file, commandArguments, options) : execaCoreAsync(file, commandArguments, options, createNested);
6381
6284
  };
6382
6285
  const parseArguments = ({ mapArguments, firstArgument, nextArguments, deepOptions, boundOptions }) => {
6383
- const callArguments = isTemplateString(firstArgument) ? parseTemplates(firstArgument, nextArguments) : [firstArgument, ...nextArguments];
6384
- const [initialFile, initialArguments, initialOptions] = normalizeParameters(...callArguments);
6286
+ const [initialFile, initialArguments, initialOptions] = normalizeParameters(...isTemplateString(firstArgument) ? parseTemplates(firstArgument, nextArguments) : [firstArgument, ...nextArguments]);
6385
6287
  const mergedOptions = mergeOptions(mergeOptions(deepOptions, boundOptions), initialOptions);
6386
6288
  const { file = initialFile, commandArguments = initialArguments, options = mergedOptions, isSync = false } = mapArguments({
6387
6289
  file: initialFile,
@@ -6457,7 +6359,7 @@ const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcEx
6457
6359
  //#region src/index.ts
6458
6360
  const runBundle = async ({ entryFile, cwd, platform: platform$1, buildPath, sourcemap, hermes }) => {
6459
6361
  const filename = `index.${platform$1}`;
6460
- const bundleOutput = path.join(buildPath, `${filename}.bundle`);
6362
+ const bundleOutput = path$1.join(buildPath, `${filename}.bundle`);
6461
6363
  const args = [
6462
6364
  "rock",
6463
6365
  "bundle",
@@ -6477,19 +6379,18 @@ const runBundle = async ({ entryFile, cwd, platform: platform$1, buildPath, sour
6477
6379
  log.normal("\n");
6478
6380
  let stdout = null;
6479
6381
  try {
6480
- const result = await execa("npx", args, {
6382
+ stdout = (await execa("npx", args, {
6481
6383
  cwd,
6482
6384
  env: {
6483
6385
  ...process.env,
6484
6386
  BUILD_OUT_DIR: buildPath
6485
6387
  },
6486
6388
  reject: true
6487
- });
6488
- stdout = result.stdout;
6389
+ })).stdout;
6489
6390
  } catch (error) {
6490
6391
  if (error instanceof ExecaError) throw error.stderr;
6491
6392
  }
6492
- const bundleId = await fs.readFile(path.join(buildPath, "BUNDLE_ID"), "utf-8").catch(() => null);
6393
+ const bundleId = await fs.readFile(path$1.join(buildPath, "BUNDLE_ID"), "utf-8").catch(() => null);
6493
6394
  if (!bundleId) throw new Error(`If you are using Babel, please check if 'hot-updater/babel-plugin' is configured in babel.config.js
6494
6395
  Example:
6495
6396
  module.exports = {
@@ -6521,7 +6422,7 @@ const rock = (config = {
6521
6422
  const { outDir = "dist", sourcemap = false, entryFile = "index.js", hermes = true } = config;
6522
6423
  return {
6523
6424
  build: async ({ platform: platform$1 }) => {
6524
- const buildPath = path.join(cwd, outDir);
6425
+ const buildPath = path$1.join(cwd, outDir);
6525
6426
  await fs.rm(buildPath, {
6526
6427
  recursive: true,
6527
6428
  force: true