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