paqad-ai
Version:
Spec-driven development framework — AI agents that think before they type
8,030 lines • 283 kB
JavaScript
import { createRequire as __paqadCreateRequire } from 'module'; const require = __paqadCreateRequire(import.meta.url);
import {
init_esm_shims
} from "./chunk-IDFRWBMN.js";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/index.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/create.js
init_esm_shims();
// node_modules/.pnpm/is-plain-obj@4.1.0/node_modules/is-plain-obj/index.js
init_esm_shims();
function isPlainObject(value) {
if (typeof value !== "object" || value === null) {
return false;
}
const prototype = Object.getPrototypeOf(value);
return (prototype === null || prototype === Object.prototype || Object.getPrototypeOf(prototype) === null) && !(Symbol.toStringTag in value) && !(Symbol.iterator in value);
}
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/parameters.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/file-url.js
init_esm_shims();
import { fileURLToPath } from "url";
var safeNormalizeFileUrl = (file, name) => {
const fileString = normalizeFileUrl(normalizeDenoExecPath(file));
if (typeof fileString !== "string") {
throw new TypeError(`${name} must be a string or a file URL: ${fileString}.`);
}
return fileString;
};
var normalizeDenoExecPath = (file) => isDenoExecPath(file) ? file.toString() : file;
var isDenoExecPath = (file) => typeof file !== "string" && file && Object.getPrototypeOf(file) === String.prototype;
var normalizeFileUrl = (file) => file instanceof URL ? fileURLToPath(file) : file;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/parameters.js
var normalizeParameters = (rawFile, rawArguments = [], rawOptions, ...rawExtraArguments) => {
if (rawExtraArguments.length > 0) {
throw new TypeError("Execa accepts at most three arguments: file, arguments, options.");
}
if (rawOptions !== void 0 && isPlainObject(rawArguments)) {
throw new TypeError("Execa accepts at most one options object. Please merge the second and third arguments.");
}
const filePath = safeNormalizeFileUrl(rawFile, "First argument");
const [commandArguments, options = {}] = isPlainObject(rawArguments) ? [[], rawArguments] : [rawArguments, rawOptions];
if (!Array.isArray(commandArguments)) {
throw new TypeError(`Second argument must be either an array of arguments or an options object: ${commandArguments}`);
}
if (commandArguments.some((commandArgument) => typeof commandArgument === "object" && commandArgument !== null)) {
throw new TypeError(`Second argument must be an array of strings: ${commandArguments}`);
}
const normalizedArguments = commandArguments.map(String);
const nullByteArgument = normalizedArguments.find((normalizedArgument) => normalizedArgument.includes("\0"));
if (nullByteArgument !== void 0) {
throw new TypeError(`Arguments cannot contain null bytes ("\\0"): ${nullByteArgument}`);
}
if (!isPlainObject(options)) {
throw new TypeError(`Last argument must be an options object: ${options}`);
}
return [filePath, normalizedArguments, { __proto__: null, ...options }];
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/template.js
init_esm_shims();
import { ChildProcess } from "child_process";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/escape.js
init_esm_shims();
import { platform } from "process";
import { stripVTControlCharacters } from "util";
var joinCommand = (filePath, rawArguments, shell) => {
const fileAndArguments = [filePath, ...rawArguments];
const command = fileAndArguments.join(" ");
const escapedCommand = shell ? escapeControlCharacters(command) : fileAndArguments.map((fileAndArgument) => quoteString(escapeControlCharacters(fileAndArgument))).join(" ");
return { command, escapedCommand };
};
var escapeLines = (lines) => stripVTControlCharacters(lines).split("\n").map((line) => escapeControlCharacters(line)).join("\n");
var escapeControlCharacters = (line) => line.replaceAll(SPECIAL_CHAR_REGEXP, (character) => escapeControlCharacter(character));
var escapeControlCharacter = (character) => {
const commonEscape = COMMON_ESCAPES[character];
if (commonEscape !== void 0) {
return commonEscape;
}
const codepoint = character.codePointAt(0);
const codepointHex = codepoint.toString(16);
return codepoint <= ASTRAL_START ? `\\u${codepointHex.padStart(4, "0")}` : `\\U${codepointHex}`;
};
var getSpecialCharRegExp = () => {
try {
return new RegExp("\\p{Separator}|\\p{Other}", "gu");
} catch {
return /[\s\u0000-\u001F\u007F-\u009F\u00AD]/g;
}
};
var SPECIAL_CHAR_REGEXP = getSpecialCharRegExp();
var COMMON_ESCAPES = {
" ": " ",
"\b": "\\b",
"\f": "\\f",
"\n": "\\n",
"\r": "\\r",
" ": "\\t"
};
var ASTRAL_START = 65535;
var quoteString = (escapedArgument) => {
if (NO_ESCAPE_REGEXP.test(escapedArgument)) {
return escapedArgument;
}
return platform === "win32" ? `"${escapedArgument.replaceAll('"', '""')}"` : `'${escapedArgument.replaceAll("'", "'\\''")}'`;
};
var NO_ESCAPE_REGEXP = /^[\w\-./]+$/;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/utils/uint-array.js
init_esm_shims();
import { StringDecoder } from "string_decoder";
var { toString: objectToString } = Object.prototype;
var isArrayBuffer = (value) => objectToString.call(value) === "[object ArrayBuffer]";
var isUint8Array = (value) => objectToString.call(value) === "[object Uint8Array]";
var bufferToUint8Array = (buffer) => new Uint8Array(buffer.buffer, buffer.byteOffset, buffer.byteLength);
var textEncoder = new TextEncoder();
var stringToUint8Array = (string) => textEncoder.encode(string);
var textDecoder = new TextDecoder();
var uint8ArrayToString = (uint8Array) => textDecoder.decode(uint8Array);
var joinToString = (uint8ArraysOrStrings, encoding) => {
const strings = uint8ArraysToStrings(uint8ArraysOrStrings, encoding);
return strings.join("");
};
var uint8ArraysToStrings = (uint8ArraysOrStrings, encoding) => {
if (encoding === "utf8" && uint8ArraysOrStrings.every((uint8ArrayOrString) => typeof uint8ArrayOrString === "string")) {
return uint8ArraysOrStrings;
}
const decoder = new StringDecoder(encoding);
const strings = uint8ArraysOrStrings.map((uint8ArrayOrString) => typeof uint8ArrayOrString === "string" ? stringToUint8Array(uint8ArrayOrString) : uint8ArrayOrString).map((uint8Array) => decoder.write(uint8Array));
const finalString = decoder.end();
return finalString === "" ? strings : [...strings, finalString];
};
var joinToUint8Array = (uint8ArraysOrStrings) => uint8ArraysOrStrings.length === 1 && isUint8Array(uint8ArraysOrStrings[0]) ? uint8ArraysOrStrings[0] : concatUint8Arrays(stringsToUint8Arrays(uint8ArraysOrStrings));
var stringsToUint8Arrays = (uint8ArraysOrStrings) => uint8ArraysOrStrings.map((uint8ArrayOrString) => typeof uint8ArrayOrString === "string" ? stringToUint8Array(uint8ArrayOrString) : uint8ArrayOrString);
var concatUint8Arrays = (uint8Arrays) => {
const result = new Uint8Array(getJoinLength(uint8Arrays));
let index = 0;
for (const uint8Array of uint8Arrays) {
result.set(uint8Array, index);
index += uint8Array.length;
}
return result;
};
var getJoinLength = (uint8Arrays) => {
let joinLength = 0;
for (const uint8Array of uint8Arrays) {
joinLength += uint8Array.length;
}
return joinLength;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/return/final-error.js
init_esm_shims();
var getFinalError = (originalError, message, isSync) => {
const ErrorClass = isSync ? ExecaSyncError : ExecaError;
const options = originalError instanceof DiscardedError ? {} : { cause: originalError };
return new ErrorClass(message, options);
};
var DiscardedError = class extends Error {
};
var setErrorName = (ErrorClass, value) => {
Object.defineProperties(ErrorClass.prototype, {
name: {
value,
writable: true,
enumerable: false,
configurable: true
},
[execaErrorSymbol]: {
value: true,
writable: false,
enumerable: false,
configurable: false
}
});
};
var isExecaError = (error) => isErrorInstance(error) && execaErrorSymbol in error;
var execaErrorSymbol = /* @__PURE__ */ Symbol("isExecaError");
var isErrorInstance = (value) => value instanceof Error || Object.prototype.toString.call(value) === "[object Error]";
var ExecaError = class extends Error {
};
setErrorName(ExecaError, ExecaError.name);
var ExecaSyncError = class extends Error {
};
setErrorName(ExecaSyncError, ExecaSyncError.name);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/utils/type-name.js
init_esm_shims();
var getTypeName = (value) => value === null ? "null" : typeof value;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/template.js
var isTemplateString = (templates) => Array.isArray(templates) && Array.isArray(templates.raw);
var parseTemplates = (templates, expressions) => {
let tokens = [];
let isSeparated = false;
for (const [index, template] of templates.entries()) {
({ tokens, isSeparated } = parseTemplate({
templates,
expressions,
tokens,
isSeparated,
index,
template
}));
}
if (tokens.length === 0) {
throw new TypeError("Template script must not be empty");
}
const [file, ...commandArguments] = tokens;
return [file, commandArguments, {}];
};
var parseTemplate = ({ templates, expressions, tokens, isSeparated, index, template }) => {
if (template === void 0) {
throw new TypeError(`Invalid backslash sequence: ${templates.raw[index]}`);
}
const { nextTokens, leadingWhitespaces, trailingWhitespaces } = splitByWhitespaces(template, templates.raw[index]);
const newTokens = concatTokens(tokens, nextTokens, isSeparated || leadingWhitespaces);
const isTemplateSeparated = trailingWhitespaces || nextTokens.length === 0 && isSeparated;
if (index === expressions.length) {
return { tokens: newTokens, isSeparated: isTemplateSeparated };
}
const expression = expressions[index];
const expressionTokens = Array.isArray(expression) ? expression.map((expression2) => parseExpression(expression2)) : [parseExpression(expression)];
return {
tokens: concatTokens(newTokens, expressionTokens, isTemplateSeparated),
isSeparated: expressionTokens.length === 0 && isTemplateSeparated
};
};
var splitByWhitespaces = (template, rawTemplate) => {
if (template.length === 0) {
return { nextTokens: [], leadingWhitespaces: false, trailingWhitespaces: false };
}
const nextTokens = [];
let templateStart = 0;
let isLeadingWhitespaces = false;
for (let templateIndex = 0, rawIndex = 0; templateIndex < template.length; templateIndex += 1, rawIndex += 1) {
const rawCharacter = rawTemplate[rawIndex];
if (DELIMITERS.has(rawCharacter)) {
if (templateIndex === 0) {
isLeadingWhitespaces = true;
}
if (templateStart !== templateIndex) {
nextTokens.push(template.slice(templateStart, templateIndex));
}
templateStart = templateIndex + 1;
} else if (rawCharacter === "\\") {
const nextRawCharacter = rawTemplate[rawIndex + 1];
if (nextRawCharacter === "\n") {
templateIndex -= 1;
rawIndex += 1;
} else if (nextRawCharacter === "u" && rawTemplate[rawIndex + 2] === "{") {
const closingBraceIndex = rawTemplate.indexOf("}", rawIndex + 3);
if (isAstralEscape(rawTemplate.slice(rawIndex + 3, closingBraceIndex))) {
templateIndex += 1;
}
rawIndex = closingBraceIndex;
} else {
rawIndex += ESCAPE_LENGTH[nextRawCharacter] ?? 1;
}
}
}
const isTrailingWhitespaces = templateStart === template.length;
if (!isTrailingWhitespaces) {
nextTokens.push(template.slice(templateStart));
}
return { nextTokens, leadingWhitespaces: isLeadingWhitespaces, trailingWhitespaces: isTrailingWhitespaces };
};
var isAstralEscape = (codePointHex) => Number.parseInt(codePointHex, 16) > ASTRAL_START;
var DELIMITERS = /* @__PURE__ */ new Set([" ", " ", "\r", "\n"]);
var ESCAPE_LENGTH = { x: 3, u: 5 };
var concatTokens = (tokens, nextTokens, isSeparated) => isSeparated || tokens.length === 0 || nextTokens.length === 0 ? [...tokens, ...nextTokens] : [
...tokens.slice(0, -1),
`${tokens.at(-1)}${nextTokens[0]}`,
...nextTokens.slice(1)
];
var parseExpression = (expression) => {
const typeOfExpression = getTypeName(expression);
if (typeOfExpression === "string") {
return expression;
}
if (typeOfExpression === "number") {
return String(expression);
}
if ((isPlainObject(expression) || isExecaError(expression)) && (Object.hasOwn(expression, "stdout") || Object.hasOwn(expression, "isMaxBuffer"))) {
return getSubprocessResult(expression);
}
if (expression instanceof ChildProcess || Object.prototype.toString.call(expression) === "[object Promise]") {
throw new TypeError("Unexpected subprocess in template expression. Please use ${await subprocess} instead of ${subprocess}.");
}
throw new TypeError(`Unexpected "${typeOfExpression}" in template expression`);
};
var getSubprocessResult = (result) => {
const stdout = Object.hasOwn(result, "stdout") ? result.stdout : void 0;
if (typeof stdout === "string") {
return stdout;
}
if (isUint8Array(stdout)) {
return uint8ArrayToString(stdout);
}
if (stdout === void 0) {
throw new TypeError(`Missing result.stdout in template expression. This is probably due to the previous subprocess' "stdout" option.`);
}
throw new TypeError(`Unexpected "${getTypeName(stdout)}" stdout in template expression`);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/main-sync.js
init_esm_shims();
import { spawnSync } from "child_process";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/command.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/start.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/values.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/specific.js
init_esm_shims();
import { debuglog } from "util";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/utils/standard-stream.js
init_esm_shims();
import process2 from "process";
var isStandardStream = (stream) => STANDARD_STREAMS.includes(stream);
var STANDARD_STREAMS = [process2.stdin, process2.stdout, process2.stderr];
var STANDARD_STREAMS_ALIASES = ["stdin", "stdout", "stderr"];
var getStreamName = (fdNumber) => STANDARD_STREAMS_ALIASES[fdNumber] ?? `stdio[${fdNumber}]`;
var allStreamSymbol = /* @__PURE__ */ Symbol("execa.allStream");
var setAllStream = (stream) => Object.assign(stream, { [allStreamSymbol]: true });
var isAllStream = (stream) => stream?.[allStreamSymbol] === true;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/utils/options.js
init_esm_shims();
var copyOptions = (options = {}) => {
if (options === null) {
throw new TypeError("The options must be an object, not `null`.");
}
return { __proto__: null, ...options };
};
var checkBooleanOption = (value, optionName) => {
if (value !== void 0 && typeof value !== "boolean") {
throw new TypeError(`The \`${optionName}\` option must use a boolean.`);
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/specific.js
var normalizeFdSpecificOptions = (options) => {
const optionsCopy = { __proto__: null, ...options };
for (const optionName of FD_SPECIFIC_OPTIONS) {
optionsCopy[optionName] = normalizeFdSpecificOption(options, optionName);
}
return optionsCopy;
};
var normalizeFdSpecificOption = (options, optionName) => {
const stdioLength = getStdioLength(options);
const optionBaseArray = Array.from({ length: stdioLength + 1 });
const optionArray = normalizeFdSpecificValue(options[optionName], optionBaseArray, optionName, stdioLength);
return addDefaultValue(optionArray, optionName);
};
var getStdioLength = ({ stdio }) => Array.isArray(stdio) ? Math.max(stdio.length, STANDARD_STREAMS_ALIASES.length) : STANDARD_STREAMS_ALIASES.length;
var normalizeFdSpecificValue = (optionValue, optionArray, optionName, stdioLength) => {
if (isPlainObject(optionValue)) {
return normalizeOptionObject(optionValue, optionArray, optionName, stdioLength);
}
validateFdSpecificValue(optionValue, optionName);
return optionArray.fill(optionValue);
};
var normalizeOptionObject = (optionValue, optionArray, optionName, stdioLength) => {
for (const fdName of Object.keys(optionValue).sort(compareFdName)) {
validateFdSpecificValue(optionValue[fdName], optionName, `${optionName}.${fdName}`);
for (const fdNumber of parseFdName(fdName, optionName, stdioLength)) {
optionArray[fdNumber] = optionValue[fdName];
}
}
return optionArray;
};
var compareFdName = (fdNameA, fdNameB) => getFdNameOrder(fdNameA) < getFdNameOrder(fdNameB) ? 1 : -1;
var getFdNameOrder = (fdName) => {
if (fdName === "stdout" || fdName === "stderr") {
return 0;
}
return fdName === "all" ? 2 : 1;
};
var parseFdName = (fdName, optionName, stdioLength) => {
if (fdName === "ipc") {
return [stdioLength];
}
const fdNumber = parseFd(fdName);
if (fdNumber === void 0 || fdNumber === 0) {
throw new TypeError(`"${optionName}.${fdName}" is invalid.
It must be "${optionName}.stdout", "${optionName}.stderr", "${optionName}.all", "${optionName}.ipc", or "${optionName}.fd3", "${optionName}.fd4" (and so on).`);
}
if (fdNumber !== "all" && fdNumber >= stdioLength) {
throw new TypeError(`"${optionName}.${fdName}" is invalid: that file descriptor does not exist.
Please set the "stdio" option to ensure that file descriptor exists.`);
}
return fdNumber === "all" ? [1, 2] : [fdNumber];
};
var parseFd = (fdName) => {
if (fdName === "all") {
return fdName;
}
if (STANDARD_STREAMS_ALIASES.includes(fdName)) {
return STANDARD_STREAMS_ALIASES.indexOf(fdName);
}
const regexpResult = FD_REGEXP.exec(fdName);
if (regexpResult !== null) {
return Number(regexpResult.groups.fdNumber);
}
};
var FD_REGEXP = /^fd(?<fdNumber>\d+)$/;
var addDefaultValue = (optionArray, optionName) => optionArray.map((optionValue) => optionValue === void 0 ? DEFAULT_OPTIONS[optionName] : optionValue);
var BOOLEAN_FD_SPECIFIC_OPTIONS = /* @__PURE__ */ new Set(["lines", "buffer", "stripFinalNewline"]);
var validateFdSpecificValue = (optionValue, optionName, fullOptionName = optionName) => {
if (BOOLEAN_FD_SPECIFIC_OPTIONS.has(optionName)) {
checkBooleanOption(optionValue, fullOptionName);
} else if (optionName === "maxBuffer" && optionValue !== void 0 && (typeof optionValue !== "number" || Number.isNaN(optionValue))) {
throw new TypeError(`The \`${fullOptionName}\` option must use a number.`);
}
};
var verboseDefault = debuglog("execa").enabled ? "full" : "none";
var DEFAULT_OPTIONS = {
lines: false,
buffer: true,
maxBuffer: 1e3 * 1e3 * 100,
verbose: verboseDefault,
stripFinalNewline: true
};
var FD_SPECIFIC_OPTIONS = ["lines", "buffer", "maxBuffer", "verbose", "stripFinalNewline"];
var getFdSpecificValue = (optionArray, fdNumber) => fdNumber === "ipc" ? optionArray.at(-1) : optionArray[fdNumber];
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/values.js
var isVerbose = ({ verbose }, fdNumber) => getFdVerbose(verbose, fdNumber) !== "none";
var isFullVerbose = ({ verbose }, fdNumber) => !["none", "short"].includes(getFdVerbose(verbose, fdNumber));
var getVerboseFunction = ({ verbose }, fdNumber) => {
const fdVerbose = getFdVerbose(verbose, fdNumber);
return isVerboseFunction(fdVerbose) ? fdVerbose : void 0;
};
var getFdVerbose = (verbose, fdNumber) => fdNumber === void 0 ? getFdGenericVerbose(verbose) : getFdSpecificValue(verbose, fdNumber);
var getFdGenericVerbose = (verbose) => verbose.find((fdVerbose) => isVerboseFunction(fdVerbose)) ?? VERBOSE_VALUES.findLast((fdVerbose) => verbose.includes(fdVerbose));
var isVerboseFunction = (fdVerbose) => typeof fdVerbose === "function";
var VERBOSE_VALUES = ["none", "short", "full"];
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/log.js
init_esm_shims();
import { inspect } from "util";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/default.js
init_esm_shims();
import process4 from "process";
// node_modules/.pnpm/figures@6.1.0/node_modules/figures/index.js
init_esm_shims();
// node_modules/.pnpm/is-unicode-supported@2.1.0/node_modules/is-unicode-supported/index.js
init_esm_shims();
import process3 from "process";
function isUnicodeSupported() {
const { env } = process3;
const { TERM, TERM_PROGRAM } = env;
if (process3.platform !== "win32") {
return TERM !== "linux";
}
return Boolean(env.WT_SESSION) || Boolean(env.TERMINUS_SUBLIME) || env.ConEmuTask === "{cmd::Cmder}" || TERM_PROGRAM === "Terminus-Sublime" || TERM_PROGRAM === "vscode" || TERM === "xterm-256color" || TERM === "alacritty" || TERM === "rxvt-unicode" || TERM === "rxvt-unicode-256color" || env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
}
// node_modules/.pnpm/figures@6.1.0/node_modules/figures/index.js
var common = {
circleQuestionMark: "(?)",
questionMarkPrefix: "(?)",
square: "\u2588",
squareDarkShade: "\u2593",
squareMediumShade: "\u2592",
squareLightShade: "\u2591",
squareTop: "\u2580",
squareBottom: "\u2584",
squareLeft: "\u258C",
squareRight: "\u2590",
squareCenter: "\u25A0",
bullet: "\u25CF",
dot: "\u2024",
ellipsis: "\u2026",
pointerSmall: "\u203A",
triangleUp: "\u25B2",
triangleUpSmall: "\u25B4",
triangleDown: "\u25BC",
triangleDownSmall: "\u25BE",
triangleLeftSmall: "\u25C2",
triangleRightSmall: "\u25B8",
home: "\u2302",
heart: "\u2665",
musicNote: "\u266A",
musicNoteBeamed: "\u266B",
arrowUp: "\u2191",
arrowDown: "\u2193",
arrowLeft: "\u2190",
arrowRight: "\u2192",
arrowLeftRight: "\u2194",
arrowUpDown: "\u2195",
almostEqual: "\u2248",
notEqual: "\u2260",
lessOrEqual: "\u2264",
greaterOrEqual: "\u2265",
identical: "\u2261",
infinity: "\u221E",
subscriptZero: "\u2080",
subscriptOne: "\u2081",
subscriptTwo: "\u2082",
subscriptThree: "\u2083",
subscriptFour: "\u2084",
subscriptFive: "\u2085",
subscriptSix: "\u2086",
subscriptSeven: "\u2087",
subscriptEight: "\u2088",
subscriptNine: "\u2089",
oneHalf: "\xBD",
oneThird: "\u2153",
oneQuarter: "\xBC",
oneFifth: "\u2155",
oneSixth: "\u2159",
oneEighth: "\u215B",
twoThirds: "\u2154",
twoFifths: "\u2156",
threeQuarters: "\xBE",
threeFifths: "\u2157",
threeEighths: "\u215C",
fourFifths: "\u2158",
fiveSixths: "\u215A",
fiveEighths: "\u215D",
sevenEighths: "\u215E",
line: "\u2500",
lineBold: "\u2501",
lineDouble: "\u2550",
lineDashed0: "\u2504",
lineDashed1: "\u2505",
lineDashed2: "\u2508",
lineDashed3: "\u2509",
lineDashed4: "\u254C",
lineDashed5: "\u254D",
lineDashed6: "\u2574",
lineDashed7: "\u2576",
lineDashed8: "\u2578",
lineDashed9: "\u257A",
lineDashed10: "\u257C",
lineDashed11: "\u257E",
lineDashed12: "\u2212",
lineDashed13: "\u2013",
lineDashed14: "\u2010",
lineDashed15: "\u2043",
lineVertical: "\u2502",
lineVerticalBold: "\u2503",
lineVerticalDouble: "\u2551",
lineVerticalDashed0: "\u2506",
lineVerticalDashed1: "\u2507",
lineVerticalDashed2: "\u250A",
lineVerticalDashed3: "\u250B",
lineVerticalDashed4: "\u254E",
lineVerticalDashed5: "\u254F",
lineVerticalDashed6: "\u2575",
lineVerticalDashed7: "\u2577",
lineVerticalDashed8: "\u2579",
lineVerticalDashed9: "\u257B",
lineVerticalDashed10: "\u257D",
lineVerticalDashed11: "\u257F",
lineDownLeft: "\u2510",
lineDownLeftArc: "\u256E",
lineDownBoldLeftBold: "\u2513",
lineDownBoldLeft: "\u2512",
lineDownLeftBold: "\u2511",
lineDownDoubleLeftDouble: "\u2557",
lineDownDoubleLeft: "\u2556",
lineDownLeftDouble: "\u2555",
lineDownRight: "\u250C",
lineDownRightArc: "\u256D",
lineDownBoldRightBold: "\u250F",
lineDownBoldRight: "\u250E",
lineDownRightBold: "\u250D",
lineDownDoubleRightDouble: "\u2554",
lineDownDoubleRight: "\u2553",
lineDownRightDouble: "\u2552",
lineUpLeft: "\u2518",
lineUpLeftArc: "\u256F",
lineUpBoldLeftBold: "\u251B",
lineUpBoldLeft: "\u251A",
lineUpLeftBold: "\u2519",
lineUpDoubleLeftDouble: "\u255D",
lineUpDoubleLeft: "\u255C",
lineUpLeftDouble: "\u255B",
lineUpRight: "\u2514",
lineUpRightArc: "\u2570",
lineUpBoldRightBold: "\u2517",
lineUpBoldRight: "\u2516",
lineUpRightBold: "\u2515",
lineUpDoubleRightDouble: "\u255A",
lineUpDoubleRight: "\u2559",
lineUpRightDouble: "\u2558",
lineUpDownLeft: "\u2524",
lineUpBoldDownBoldLeftBold: "\u252B",
lineUpBoldDownBoldLeft: "\u2528",
lineUpDownLeftBold: "\u2525",
lineUpBoldDownLeftBold: "\u2529",
lineUpDownBoldLeftBold: "\u252A",
lineUpDownBoldLeft: "\u2527",
lineUpBoldDownLeft: "\u2526",
lineUpDoubleDownDoubleLeftDouble: "\u2563",
lineUpDoubleDownDoubleLeft: "\u2562",
lineUpDownLeftDouble: "\u2561",
lineUpDownRight: "\u251C",
lineUpBoldDownBoldRightBold: "\u2523",
lineUpBoldDownBoldRight: "\u2520",
lineUpDownRightBold: "\u251D",
lineUpBoldDownRightBold: "\u2521",
lineUpDownBoldRightBold: "\u2522",
lineUpDownBoldRight: "\u251F",
lineUpBoldDownRight: "\u251E",
lineUpDoubleDownDoubleRightDouble: "\u2560",
lineUpDoubleDownDoubleRight: "\u255F",
lineUpDownRightDouble: "\u255E",
lineDownLeftRight: "\u252C",
lineDownBoldLeftBoldRightBold: "\u2533",
lineDownLeftBoldRightBold: "\u252F",
lineDownBoldLeftRight: "\u2530",
lineDownBoldLeftBoldRight: "\u2531",
lineDownBoldLeftRightBold: "\u2532",
lineDownLeftRightBold: "\u252E",
lineDownLeftBoldRight: "\u252D",
lineDownDoubleLeftDoubleRightDouble: "\u2566",
lineDownDoubleLeftRight: "\u2565",
lineDownLeftDoubleRightDouble: "\u2564",
lineUpLeftRight: "\u2534",
lineUpBoldLeftBoldRightBold: "\u253B",
lineUpLeftBoldRightBold: "\u2537",
lineUpBoldLeftRight: "\u2538",
lineUpBoldLeftBoldRight: "\u2539",
lineUpBoldLeftRightBold: "\u253A",
lineUpLeftRightBold: "\u2536",
lineUpLeftBoldRight: "\u2535",
lineUpDoubleLeftDoubleRightDouble: "\u2569",
lineUpDoubleLeftRight: "\u2568",
lineUpLeftDoubleRightDouble: "\u2567",
lineUpDownLeftRight: "\u253C",
lineUpBoldDownBoldLeftBoldRightBold: "\u254B",
lineUpDownBoldLeftBoldRightBold: "\u2548",
lineUpBoldDownLeftBoldRightBold: "\u2547",
lineUpBoldDownBoldLeftRightBold: "\u254A",
lineUpBoldDownBoldLeftBoldRight: "\u2549",
lineUpBoldDownLeftRight: "\u2540",
lineUpDownBoldLeftRight: "\u2541",
lineUpDownLeftBoldRight: "\u253D",
lineUpDownLeftRightBold: "\u253E",
lineUpBoldDownBoldLeftRight: "\u2542",
lineUpDownLeftBoldRightBold: "\u253F",
lineUpBoldDownLeftBoldRight: "\u2543",
lineUpBoldDownLeftRightBold: "\u2544",
lineUpDownBoldLeftBoldRight: "\u2545",
lineUpDownBoldLeftRightBold: "\u2546",
lineUpDoubleDownDoubleLeftDoubleRightDouble: "\u256C",
lineUpDoubleDownDoubleLeftRight: "\u256B",
lineUpDownLeftDoubleRightDouble: "\u256A",
lineCross: "\u2573",
lineBackslash: "\u2572",
lineSlash: "\u2571"
};
var specialMainSymbols = {
tick: "\u2714",
info: "\u2139",
warning: "\u26A0",
cross: "\u2718",
squareSmall: "\u25FB",
squareSmallFilled: "\u25FC",
circle: "\u25EF",
circleFilled: "\u25C9",
circleDotted: "\u25CC",
circleDouble: "\u25CE",
circleCircle: "\u24DE",
circleCross: "\u24E7",
circlePipe: "\u24BE",
radioOn: "\u25C9",
radioOff: "\u25EF",
checkboxOn: "\u2612",
checkboxOff: "\u2610",
checkboxCircleOn: "\u24E7",
checkboxCircleOff: "\u24BE",
pointer: "\u276F",
triangleUpOutline: "\u25B3",
triangleLeft: "\u25C0",
triangleRight: "\u25B6",
lozenge: "\u25C6",
lozengeOutline: "\u25C7",
hamburger: "\u2630",
smiley: "\u32E1",
mustache: "\u0DF4",
star: "\u2605",
play: "\u25B6",
nodejs: "\u2B22",
oneSeventh: "\u2150",
oneNinth: "\u2151",
oneTenth: "\u2152"
};
var specialFallbackSymbols = {
tick: "\u221A",
info: "i",
warning: "\u203C",
cross: "\xD7",
squareSmall: "\u25A1",
squareSmallFilled: "\u25A0",
circle: "( )",
circleFilled: "(*)",
circleDotted: "( )",
circleDouble: "( )",
circleCircle: "(\u25CB)",
circleCross: "(\xD7)",
circlePipe: "(\u2502)",
radioOn: "(*)",
radioOff: "( )",
checkboxOn: "[\xD7]",
checkboxOff: "[ ]",
checkboxCircleOn: "(\xD7)",
checkboxCircleOff: "( )",
pointer: ">",
triangleUpOutline: "\u2206",
triangleLeft: "\u25C4",
triangleRight: "\u25BA",
lozenge: "\u2666",
lozengeOutline: "\u25CA",
hamburger: "\u2261",
smiley: "\u263A",
mustache: "\u250C\u2500\u2510",
star: "\u2736",
play: "\u25BA",
nodejs: "\u2666",
oneSeventh: "1/7",
oneNinth: "1/9",
oneTenth: "1/10"
};
var mainSymbols = { ...common, ...specialMainSymbols };
var fallbackSymbols = { ...common, ...specialFallbackSymbols };
var shouldUseMain = isUnicodeSupported();
var figures = shouldUseMain ? mainSymbols : fallbackSymbols;
var figures_default = figures;
var replacements = Object.entries(specialMainSymbols);
// node_modules/.pnpm/yoctocolors@2.2.0/node_modules/yoctocolors/base.js
init_esm_shims();
import tty from "tty";
var hasColors = tty?.WriteStream?.prototype?.hasColors?.() ?? false;
var format = (open, close) => {
if (!hasColors) {
return (input) => input;
}
const openCode = `\x1B[${open}m`;
const closeCode = `\x1B[${close}m`;
return (input) => {
const string = input + "";
let index = string.indexOf(closeCode);
if (index === -1) {
return openCode + string + closeCode;
}
let result = openCode;
let lastIndex = 0;
const reopenOnNestedClose = close === 22;
const replaceCode = (reopenOnNestedClose ? closeCode : "") + openCode;
while (index !== -1) {
result += string.slice(lastIndex, index) + replaceCode;
lastIndex = index + closeCode.length;
index = string.indexOf(closeCode, lastIndex);
}
result += string.slice(lastIndex) + closeCode;
return result;
};
};
var reset = format(0, 0);
var bold = format(1, 22);
var dim = format(2, 22);
var italic = format(3, 23);
var underline = format(4, 24);
var underlineDouble = format("4:2", 24);
var underlineCurly = format("4:3", 24);
var underlineDotted = format("4:4", 24);
var underlineDashed = format("4:5", 24);
var overline = format(53, 55);
var inverse = format(7, 27);
var hidden = format(8, 28);
var strikethrough = format(9, 29);
var black = format(30, 39);
var red = format(31, 39);
var green = format(32, 39);
var yellow = format(33, 39);
var blue = format(34, 39);
var magenta = format(35, 39);
var cyan = format(36, 39);
var white = format(37, 39);
var gray = format(90, 39);
var bgBlack = format(40, 49);
var bgRed = format(41, 49);
var bgGreen = format(42, 49);
var bgYellow = format(43, 49);
var bgBlue = format(44, 49);
var bgMagenta = format(45, 49);
var bgCyan = format(46, 49);
var bgWhite = format(47, 49);
var bgGray = format(100, 49);
var redBright = format(91, 39);
var greenBright = format(92, 39);
var yellowBright = format(93, 39);
var blueBright = format(94, 39);
var magentaBright = format(95, 39);
var cyanBright = format(96, 39);
var whiteBright = format(97, 39);
var bgRedBright = format(101, 49);
var bgGreenBright = format(102, 49);
var bgYellowBright = format(103, 49);
var bgBlueBright = format(104, 49);
var bgMagentaBright = format(105, 49);
var bgCyanBright = format(106, 49);
var bgWhiteBright = format(107, 49);
var underlineBlack = format("58;5;0", 59);
var underlineRed = format("58;5;1", 59);
var underlineGreen = format("58;5;2", 59);
var underlineYellow = format("58;5;3", 59);
var underlineBlue = format("58;5;4", 59);
var underlineMagenta = format("58;5;5", 59);
var underlineCyan = format("58;5;6", 59);
var underlineWhite = format("58;5;7", 59);
var underlineGray = format("58;5;8", 59);
var underlineRedBright = format("58;5;9", 59);
var underlineGreenBright = format("58;5;10", 59);
var underlineYellowBright = format("58;5;11", 59);
var underlineBlueBright = format("58;5;12", 59);
var underlineMagentaBright = format("58;5;13", 59);
var underlineCyanBright = format("58;5;14", 59);
var underlineWhiteBright = format("58;5;15", 59);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/default.js
var hasColors2 = process4.env.FORCE_COLOR !== void 0 || process4.stderr.isTTY === true;
var identity = (string) => string;
var getColor = (color) => hasColors2 ? color : identity;
var gray2 = getColor(gray);
var bold2 = getColor(bold);
var redBright2 = getColor(redBright);
var yellowBright2 = getColor(yellowBright);
var defaultVerboseFunction = ({
type,
message,
timestamp,
piped,
commandId,
result: { failed = false } = {},
options: { reject = true }
}) => {
const timestampString = serializeTimestamp(timestamp);
const icon = ICONS[type]({ failed, reject, piped });
const color = COLORS[type]({ reject });
return `${gray2(`[${timestampString}]`)} ${gray2(`[${commandId}]`)} ${color(icon)} ${color(message)}`;
};
var serializeTimestamp = (timestamp) => `${padField(timestamp.getHours(), 2)}:${padField(timestamp.getMinutes(), 2)}:${padField(timestamp.getSeconds(), 2)}.${padField(timestamp.getMilliseconds(), 3)}`;
var padField = (field, padding) => String(field).padStart(padding, "0");
var getFinalIcon = ({ failed, reject }) => {
if (!failed) {
return figures_default.tick;
}
return reject ? figures_default.cross : figures_default.warning;
};
var ICONS = {
command: ({ piped }) => piped ? "|" : "$",
output: () => " ",
ipc: () => "*",
error: getFinalIcon,
duration: getFinalIcon
};
var COLORS = {
command: () => bold2,
output: () => identity,
ipc: () => identity,
error: ({ reject }) => reject ? redBright2 : yellowBright2,
duration: () => gray2
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/custom.js
init_esm_shims();
var applyVerboseOnLines = (printedLines, verboseInfo, fdNumber) => {
const verboseFunction = getVerboseFunction(verboseInfo, fdNumber);
return printedLines.map(({ verboseLine, verboseObject }) => applyVerboseFunction(verboseLine, verboseObject, verboseFunction)).filter((printedLine) => printedLine !== void 0).map((printedLine) => appendNewline(printedLine)).join("");
};
var applyVerboseFunction = (verboseLine, verboseObject, verboseFunction) => {
if (verboseFunction === void 0) {
return verboseLine;
}
const printedLine = verboseFunction(verboseLine, verboseObject);
if (typeof printedLine === "string") {
return printedLine;
}
};
var appendNewline = (printedLine) => printedLine.endsWith("\n") ? printedLine : `${printedLine}
`;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/log.js
var verboseLog = ({ type, verboseMessage, fdNumber, verboseInfo, result }) => {
const verboseObject = getVerboseObject({ type, result, verboseInfo });
const printedLines = getPrintedLines(verboseMessage, verboseObject);
const finalLines = applyVerboseOnLines(printedLines, verboseInfo, fdNumber);
if (finalLines !== "") {
console.warn(finalLines.slice(0, -1));
}
};
var getVerboseObject = ({ type, result, verboseInfo }) => {
const { escapedCommand, commandId, rawOptions } = verboseInfo;
const { piped = false, ...options } = rawOptions;
return {
type,
escapedCommand,
commandId: `${commandId}`,
timestamp: /* @__PURE__ */ new Date(),
piped,
result,
options
};
};
var getPrintedLines = (verboseMessage, verboseObject) => verboseMessage.split("\n").map((message) => getPrintedLine({ ...verboseObject, message }));
var getPrintedLine = (verboseObject) => {
const verboseLine = defaultVerboseFunction(verboseObject);
return { verboseLine, verboseObject };
};
var serializeVerboseMessage = (message) => {
const messageString = typeof message === "string" ? message : inspect(message);
return escapeLines(messageString);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/start.js
var logCommand = (escapedCommand, verboseInfo) => {
if (!isVerbose(verboseInfo)) {
return;
}
verboseLog({
type: "command",
verboseMessage: escapedCommand,
verboseInfo
});
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/info.js
init_esm_shims();
var getVerboseInfo = (verbose, escapedCommand, rawOptions) => {
validateVerbose(verbose);
const commandId = getCommandId(verbose);
return {
verbose,
escapedCommand,
commandId,
rawOptions
};
};
var getCommandId = (verbose) => isVerbose({ verbose }) ? COMMAND_ID++ : void 0;
var COMMAND_ID = 0n;
var validateVerbose = (verbose) => {
for (const fdVerbose of verbose) {
if (fdVerbose === false) {
throw new TypeError(`The "verbose: false" option was renamed to "verbose: 'none'".`);
}
if (fdVerbose === true) {
throw new TypeError(`The "verbose: true" option was renamed to "verbose: 'short'".`);
}
if (!VERBOSE_VALUES.includes(fdVerbose) && !isVerboseFunction(fdVerbose)) {
const allowedValues = VERBOSE_VALUES.map((allowedValue) => `'${allowedValue}'`).join(", ");
throw new TypeError(`The "verbose" option must not be ${fdVerbose}. Allowed values are: ${allowedValues} or a function.`);
}
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/return/duration.js
init_esm_shims();
import { hrtime } from "process";
var getStartTime = () => hrtime.bigint();
var getDurationMs = (startTime) => Number(hrtime.bigint() - startTime) / 1e6;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/command.js
var handleCommand = (filePath, rawArguments, rawOptions) => {
const startTime = getStartTime();
const { command, escapedCommand } = joinCommand(filePath, rawArguments, rawOptions.shell && !rawOptions.node);
const verbose = normalizeFdSpecificOption(rawOptions, "verbose");
const verboseInfo = getVerboseInfo(verbose, escapedCommand, { __proto__: null, ...rawOptions });
logCommand(escapedCommand, verboseInfo);
return {
command,
escapedCommand,
startTime,
verboseInfo
};
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/options.js
init_esm_shims();
import path7 from "path";
import process9 from "process";
// node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
init_esm_shims();
import process5 from "process";
import path2 from "path";
// node_modules/.pnpm/path-key@4.0.0/node_modules/path-key/index.js
init_esm_shims();
function pathKey(options = {}) {
const {
env = process.env,
platform: platform2 = process.platform
} = options;
if (platform2 !== "win32") {
return "PATH";
}
return Object.keys(env).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
}
// node_modules/.pnpm/unicorn-magic@0.3.0/node_modules/unicorn-magic/node.js
init_esm_shims();
import { promisify } from "util";
import { execFile as execFileCallback, execFileSync as execFileSyncOriginal } from "child_process";
import path from "path";
import { fileURLToPath as fileURLToPath2 } from "url";
var execFileOriginal = promisify(execFileCallback);
function toPath(urlOrPath) {
return urlOrPath instanceof URL ? fileURLToPath2(urlOrPath) : urlOrPath;
}
function traversePathUp(startPath) {
return {
*[Symbol.iterator]() {
let currentPath = path.resolve(toPath(startPath));
let previousPath;
while (previousPath !== currentPath) {
yield currentPath;
previousPath = currentPath;
currentPath = path.resolve(currentPath, "..");
}
}
};
}
var TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
// node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
var npmRunPath = ({
cwd = process5.cwd(),
path: pathOption = process5.env[pathKey()],
preferLocal = true,
execPath: execPath2 = process5.execPath,
addExecPath = true
} = {}) => {
const cwdPath = path2.resolve(toPath(cwd));
const result = [];
const pathParts = pathOption.split(path2.delimiter);
if (preferLocal) {
applyPreferLocal(result, pathParts, cwdPath);
}
if (addExecPath) {
applyExecPath(result, pathParts, execPath2, cwdPath);
}
return pathOption === "" || pathOption === path2.delimiter ? `${result.join(path2.delimiter)}${pathOption}` : [...result, pathOption].join(path2.delimiter);
};
var applyPreferLocal = (result, pathParts, cwdPath) => {
for (const directory of traversePathUp(cwdPath)) {
const pathPart = path2.join(directory, "node_modules/.bin");
if (!pathParts.includes(pathPart)) {
result.push(pathPart);
}
}
};
var applyExecPath = (result, pathParts, execPath2, cwdPath) => {
const pathPart = path2.resolve(cwdPath, toPath(execPath2), "..");
if (!pathParts.includes(pathPart)) {
result.push(pathPart);
}
};
var npmRunPathEnv = ({ env = process5.env, ...options } = {}) => {
env = { ...env };
const pathName = pathKey({ env });
options.path = env[pathName];
env[pathName] = npmRunPath(options);
return env;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/kill.js
init_esm_shims();
import { setTimeout as setTimeout2 } from "timers/promises";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/signal.js
init_esm_shims();
import { constants as constants3 } from "os";
// node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/main.js
init_esm_shims();
import { constants as constants2 } from "os";
// node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/realtime.js
init_esm_shims();
var getRealtimeSignals = () => {
const length = SIGRTMAX - SIGRTMIN + 1;
return Array.from({ length }, getRealtimeSignal);
};
var getRealtimeSignal = (value, index) => ({
name: `SIGRT${index + 1}`,
number: SIGRTMIN + index,
action: "terminate",
description: "Application-specific signal (realtime)",
standard: "posix"
});
var SIGRTMIN = 34;
var SIGRTMAX = 64;
// node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/signals.js
init_esm_shims();
import { constants } from "os";
// node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/core.js
init_esm_shims();
var SIGNALS = [
{
name: "SIGHUP",
number: 1,
action: "terminate",
description: "Terminal closed",
standard: "posix"
},
{
name: "SIGINT",
number: 2,
action: "terminate",
description: "User interruption with CTRL-C",
standard: "ansi"
},
{
name: "SIGQUIT",
number: 3,
action: "core",
description: "User interruption with CTRL-\\",
standard: "posix"
},
{
name: "SIGILL",
number: 4,
action: "core",
description: "Invalid machine instruction",
standard: "ansi"
},
{
name: "SIGTRAP",
number: 5,
action: "core",
description: "Debugger breakpoint",
standard: "posix"
},
{
name: "SIGABRT",
number: 6,
action: "core",
description: "Aborted",
standard: "ansi"
},
{
name: "SIGIOT",
number: 6,
action: "core",
description: "Aborted",
standard: "bsd"
},
{
name: "SIGBUS",
number: 7,
action: "core",
description: "Bus error due to misaligned, non-existing address or paging error",
standard: "bsd"
},
{
name: "SIGEMT",
number: 7,
action: "terminate",
description: "Command should be emulated but is not implemented",
standard: "other"
},
{
name: "SIGFPE",
number: 8,
action: "core",
description: "Floating point arithmetic error",
standard: "ansi"
},
{
name: "SIGKILL",
number: 9,
action: "terminate",
description: "Forced termination",
standard: "posix",
forced: true
},
{
name: "SIGUSR1",
number: 10,
action: "terminate",
description: "Application-specific signal",
standard: "posix"
},
{
name: "SIGSEGV",
number: 11,
action: "core",
description: "Segmentation fault",
standard: "ansi"
},
{
name: "SIGUSR2",
number: 12,
action: "terminate",
description: "Application-specific signal",
standard: "posix"
},
{
name: "SIGPIPE",
number: 13,
action: "terminate",
description: "Broken pipe or socket",
standard: "posix"
},
{
name: "SIGALRM",
number: 14,
action: "terminate",
description: "Timeout or timer",
standard: "posix"
},
{
name: "SIGTERM",
number: 15,
action: "terminate",
description: "Termination",
standard: "ansi"
},
{
name: "SIGSTKFLT",
number: 16,
action: "terminate",
description: "Stack is empty or overflowed",
standard: "other"
},
{
name: "SIGCHLD",
number: 17,
action: "ignore",
description: "Child process terminated, paused or unpaused",
standard: "posix"
},
{
name: "SIGCLD",
number: 17,
action: "ignore",
description: "Child process terminated, paused or unpaused",
standard: "other"
},
{
name: "SIGCONT",
number: 18,
action: "unpause",
description: "Unpaused",
standard: "posix",
forced: true
},
{
name: "SIGSTOP",
number: 19,
action: "pause",
description: "Paused",
standard: "posix",
forced: true
},
{
name: "SIGTSTP",
number: 20,
action: "pause",
description: 'Paused using CTRL-Z or "suspend"',
standard: "posix"
},
{
name: "SIGTTIN",
number: 21,
action: "pause",
description: "Background process cannot read terminal input",
standard: "posix"
},
{
name: "SIGBREAK",
number: 21,
action: "terminate",
description: "User interruption with CTRL-BREAK",
standard: "other"
},
{
name: "SIGTTOU",
number: 22,
action: "pause",
description: "Background process cannot write to terminal output",
standard: "posix"
},
{
name: "SIGURG",
number: 23,
action: "ignore",
description: "Socket received out-of-band data",
standard: "bsd"
},
{
name: "SIGXCPU",
number: 24,
action: "core",
description: "Process timed out",
standard: "bsd"
},
{
name: "SIGXFSZ",
number: 25,
action: "core",
description: "File too big",
standard: "bsd"
},
{
name: "SIGVTALRM",
number: 26,
action: "terminate",
description: "Timeout or timer",
standard: "bsd"
},
{
name: "SIGPROF",
number: 27,
action: "terminate",
description: "Timeout or timer",
standard: "bsd"
},
{
name: "SIGWINCH",
number: 28,
action: "ignore",
description: "Terminal window size changed",
standard: "bsd"
},
{
name: "SIGIO",
number: 29,
action: "terminate",
description: "I/O is available",
standard: "other"
},
{
name: "SIGPOLL",
number: 29,
action: "terminate",
description: "Watched event",
standard: "other"
},
{
name: "SIGINFO",
number: 29,
action: "ignore",
description: "Request for process information",
standard: "other"
},
{
name: "SIGPWR",
number: 30,
action: "terminate",
description: "Device running out of power",
standard: "systemv"
},
{
name: "SIGSYS",
number: 31,
action: "core",
description: "Invalid system call",
standard: "other"
},
{
name: "SIGUNUSED",
number: 31,
action: "terminate",
description: "Invalid system call",
standard: "other"
}
];
// node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/signals.js
var getSignals = () => {
const realtimeSignals = getRealtimeSignals();
const signals2 = [...SIGNALS, ...realtimeSignals].map(normalizeSignal);
return signals2;
};
var normalizeSignal = ({
name,
number: defaultNumber,
description,
action,
forced = false,
standard
}) => {
const {
signals: { [name]: constantSignal }
} = constants;
const supported = constantSignal !== void 0;
const number = supported ? constantSignal : defaultNumber;
return { name, number, description, supported, action, forced, standard };
};
// node_modules/.pnpm/human-signals@8.0.1/node_modules/human-signals/build/src/main.js
var getSignalsByName = () => {
const signals2 = getSignals();
return Object.fromEntries(signals2.map(getSignalByName));
};
var getSignalByName = ({
name,
number,
description,
supported,
action,
forced,
standard
}) => [name, { name, number, description, supported, action, forced, standard }];
var signalsByName = getSignalsByName();
var getSignalsByNumber = () => {
const signals2 = getSignals();
const length = SIGRTMAX + 1;
const signalsA = Array.from(
{ length },
(value, number) => getSignalByNumber(number, signals2)
);
return Object.assign({}, ...signalsA);
};
var getSignalByNumber = (number, signals2) => {
const signal = findSignalByNumber(number, signals2);
if (signal === void 0) {
return {};
}
const { name, description, supported, action, forced, standard } = signal;
return {
[number]: {
name,
number,
description,
supported,
action,
forced,
standard
}
};
};
var findSignalByNumber = (number, signals2) => {
const signal = signals2.find(({ name }) => constants2.signals[name] === number);
if (signal !== void 0) {
return signal;
}
return signals2.find((signalA) => signalA.number === number);
};
var signalsByNumber = getSignalsByNumber();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/signal.js
var normalizeKillSignal = (killSignal) => {
const optionName = "option `killSignal`";
if (killSignal === 0) {
throw new TypeError(`Invalid ${optionName}: 0 cannot be used.`);
}
return normalizeSignal2(killSignal, optionName);
};
var normalizeSignalArgument = (signal) => signal === 0 ? signal : normalizeSignal2(signal, "`subprocess.kill()`'s argument");
var normalizeSignal2 = (signalNameOrInteger, optionName) => {
if (Number.isInteger(signalNameOrInteger)) {
return normalizeSignalInteger(signalNameOrInteger, optionName);
}
if (typeof signalNameOrInteger === "string") {
return normalizeSignalName(signalNameOrInteger, optionName);
}
throw new TypeError(`Invalid ${optionName} ${String(signalNameOrInteger)}: it must be a string or an integer.
${getAvailableSignals()}`);
};
var normalizeSignalInteger = (signalInteger, optionName) => {
if (signalsIntegerToName.has(signalInteger)) {
return signalsIntegerToName.get(signalInteger);
}
throw new TypeError(`Invalid ${optionName} ${signalInteger}: this signal integer does not exist.
${getAvailableSignals()}`);
};
var getSignalsIntegerToName = () => new Map(Object.entries(constants3.signals).reverse().map(([signalName, signalInteger]) => [signalInteger, signalName]));
var signalsIntegerToName = getSignalsIntegerToName();
var normalizeSignalName = (signalName, optionName) => {
if (signalName in constants3.signals) {
return signalName;
}
if (signalName.toUpperCase() in constants3.signals) {
throw new TypeError(`Invalid ${optionName} '${signalName}': please rename it to '${signalName.toUpperCase()}'.`);
}
throw new TypeError(`Invalid ${optionName} '${signalName}': this signal name does not exist.
${getAvailableSignals()}`);
};
var getAvailableSignals = () => `Available signal names: ${getAvailableSignalNames()}.
Available signal numbers: ${getAvailableSignalIntegers()}.`;
var getAvailableSignalNames = () => Object.keys(constants3.signals).sort().map((signalName) => `'${signalName}'`).join(", ");
var getAvailableSignalIntegers = () => [...new Set(Object.values(constants3.signals).sort((signalInteger, signalIntegerTwo) => signalInteger - signalIntegerTwo))].join(", ");
var getSignalDescription = (signal) => signalsByName[signal].description;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/timeout.js
init_esm_shims();
import { setTimeout } from "timers/promises";
var validateTimeout = ({ timeout }) => {
if (timeout !== void 0) {
validateDelay(timeout, "timeout");
}
};
var validateDelay = (delay, optionName) => {
if (!Number.isInteger(delay) || delay < 0 || delay > MAX_DELAY) {
throw new TypeError(`Expected the \`${optionName}\` option to be a non-negative integer up to ${MAX_DELAY}, got \`${delay}\` (${getTypeName(delay)})`);
}
};
var MAX_DELAY = 2 ** 31 - 1;
var throwOnTimeout = (kill, timeout, context, controller) => timeout === 0 || timeout === void 0 ? [] : [killAfterTimeout(kill, timeout, context, controller)];
var killAfterTimeout = async (kill, timeout, context, { signal }) => {
await setTimeout(timeout, void 0, { signal });
context.terminationReason ??= "timeout";
kill();
throw new DiscardedError();
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/kill.js
var normalizeForceKillAfterDelay = (forceKillAfterDelay) => {
if (forceKillAfterDelay === false) {
return forceKillAfterDelay;
}
if (forceKillAfterDelay === true) {
return DEFAULT_FORCE_KILL_TIMEOUT;
}
validateDelay(forceKillAfterDelay, "forceKillAfterDelay");
return forceKillAfterDelay;
};
var DEFAULT_FORCE_KILL_TIMEOUT = 1e3 * 5;
var subprocessKill = ({ kill, options: { forceKillAfterDelay, killSignal }, onInternalError, context, controller }, signalOrError, errorArgument) => {
const { signal, error } = parseKillArguments(signalOrError, errorArgument, killSignal);
emitKillError(error, onInternalError);
const killResult = kill(signal);
setKillTimeout({
kill,
signal,
forceKillAfterDelay,
killSignal,
killResult,
context,
controller
});
return killResult;
};
var parseKillArguments = (signalOrError, errorArgument, killSignal) => {
const [signal = killSignal, error] = isErrorInstance(signalOrError) ? [void 0, signalOrError] : [signalOrError, errorArgument];
if (typeof signal !== "string" && !Number.isInteger(signal)) {
throw new TypeError(`The first argument must be an error instance or a signal name string/integer: ${String(signal)}`);
}
if (error !== void 0 && !isErrorInstance(error)) {
throw new TypeError(`The second argument is optional. If specified, it must be an error instance: ${error}`);
}
return { signal: normalizeSignalArgument(signal), error };
};
var emitKillError = (error, onInternalError) => {
if (error !== void 0) {
onInternalError.reject(error);
}
};
var setKillTimeout = async ({ kill, signal, forceKillAfterDelay, killSignal, killResult, context, controller }) => {
if (signal === killSignal && killResult) {
killOnTimeout({
kill,
forceKillAfterDelay,
context,
controllerSignal: controller.signal
});
}
};
var killOnTimeout = async ({ kill, forceKillAfterDelay, context, controllerSignal }) => {
if (forceKillAfterDelay === false) {
return;
}
try {
await setTimeout2(forceKillAfterDelay, void 0, { signal: controllerSignal });
if (kill("SIGKILL")) {
context.isForcefullyTerminated ??= true;
}
} catch {
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/cancel.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/utils/abort-signal.js
init_esm_shims();
import { once } from "events";
var onAbortedSignal = async (mainSignal, stopSignal) => {
if (!mainSignal.aborted) {
await once(mainSignal, "abort", { signal: stopSignal });
}
};
var validateAbortSignal = (signal, optionName) => {
if (signal !== void 0 && Object.prototype.toString.call(signal) !== "[object AbortSignal]") {
throw new TypeError(`The \`${optionName}\` option must be an AbortSignal: ${String(signal)}.`);
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/cancel.js
var validateCancelSignal = ({ cancelSignal }) => {
validateAbortSignal(cancelSignal, "cancelSignal");
};
var validateRenamedSignalOption = ({ signal }) => {
if (signal !== void 0) {
throw new TypeError('The "signal" option has been renamed to "cancelSignal" instead.');
}
};
var throwOnCancel = ({ kill, cancelSignal, gracefulCancel, context, controller }) => cancelSignal === void 0 || gracefulCancel ? [] : [terminateOnCancel(kill, cancelSignal, context, controller)];
var terminateOnCancel = async (kill, cancelSignal, context, { signal }) => {
await onAbortedSignal(cancelSignal, signal);
context.terminationReason ??= "cancel";
kill();
throw cancelSignal.reason;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/graceful.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/graceful.js
init_esm_shims();
import { scheduler as scheduler2 } from "timers/promises";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/send.js
init_esm_shims();
import { promisify as promisify2 } from "util";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/validation.js
init_esm_shims();
import { inspect as inspect2 } from "util";
var validateIpcMethod = ({ methodName, isSubprocess, ipc, isConnected: isConnected2 }) => {
validateIpcOption(methodName, isSubprocess, ipc);
validateConnection(methodName, isSubprocess, isConnected2);
};
var validateIpcOption = (methodName, isSubprocess, ipc) => {
if (!ipc) {
throw new Error(`${getMethodName(methodName, isSubprocess)} can only be used if the \`ipc\` option is \`true\`.`);
}
};
var validateConnection = (methodName, isSubprocess, isConnected2) => {
if (!isConnected2) {
throw new Error(`${getMethodName(methodName, isSubprocess)} cannot be used: the ${getOtherProcessName(isSubprocess)} has already exited or disconnected.`);
}
};
var throwOnEarlyDisconnect = (isSubprocess) => {
throw new Error(`${getMethodName("getOneMessage", isSubprocess)} could not complete: the ${getOtherProcessName(isSubprocess)} exited or disconnected.`);
};
var throwOnStrictDeadlockError = (isSubprocess) => {
throw new Error(`${getMethodName("sendMessage", isSubprocess)} failed: the ${getOtherProcessName(isSubprocess)} is sending a message too, instead of listening to incoming messages.
This can be fixed by both sending a message and listening to incoming messages at the same time:
const [receivedMessage] = await Promise.all([
${getMethodName("getOneMessage", isSubprocess)},
${getMethodName("sendMessage", isSubprocess, "message, {strict: true}")},
]);`);
};
var getStrictResponseError = (error, isSubprocess) => new Error(`${getMethodName("sendMessage", isSubprocess)} failed when sending an acknowledgment response to the ${getOtherProcessName(isSubprocess)}.`, { cause: error });
var throwOnMissingStrict = (isSubprocess) => {
throw new Error(`${getMethodName("sendMessage", isSubprocess)} failed: the ${getOtherProcessName(isSubprocess)} is not listening to incoming messages.`);
};
var throwOnStrictDisconnect = (isSubprocess) => {
throw new Error(`${getMethodName("sendMessage", isSubprocess)} failed: the ${getOtherProcessName(isSubprocess)} exited without listening to incoming messages.`);
};
var getAbortDisconnectError = () => new Error(`\`cancelSignal\` aborted: the ${getOtherProcessName(true)} disconnected.`);
var throwOnMissingParent = () => {
throw new Error("`getCancelSignal()` cannot be used without setting the `gracefulCancel` option to `true`.");
};
var handleEpipeError = ({ error, methodName, isSubprocess }) => {
if (error.code === "EPIPE") {
throw new Error(`${getMethodName(methodName, isSubprocess)} cannot be used: the ${getOtherProcessName(isSubprocess)} is disconnecting.`, { cause: error });
}
};
var handleSerializationError = ({ error, methodName, isSubprocess, message }) => {
if (isSerializationError(error)) {
throw new Error(`${getMethodName(methodName, isSubprocess)}'s argument type is invalid: the message cannot be serialized: ${serializeInvalidMessage(message)}.`, { cause: error });
}
};
var serializeInvalidMessage = (message) => {
try {
return String(message);
} catch {
return inspect2(message);
}
};
var isSerializationError = ({ code, message }) => SERIALIZATION_ERROR_CODES.has(code) || SERIALIZATION_ERROR_MESSAGES.some((serializationErrorMessage) => message.includes(serializationErrorMessage));
var SERIALIZATION_ERROR_CODES = /* @__PURE__ */ new Set([
// Message is `undefined`
"ERR_MISSING_ARGS",
// Message is a function, a bigint, a symbol
"ERR_INVALID_ARG_TYPE"
]);
var SERIALIZATION_ERROR_MESSAGES = [
// Message is a promise or a proxy, with `serialization: 'advanced'`
"could not be cloned",
// Message has cycles, with `serialization: 'json'`
"circular structure",
// Message has cycles inside toJSON(), with `serialization: 'json'`
"call stack size exceeded"
];
var getMethodName = (methodName, isSubprocess, parameters = "") => methodName === "cancelSignal" ? "`cancelSignal`'s `controller.abort()`" : `${getNamespaceName(isSubprocess)}${methodName}(${parameters})`;
var getNamespaceName = (isSubprocess) => isSubprocess ? "" : "subprocess.";
var getOtherProcessName = (isSubprocess) => isSubprocess ? "parent process" : "subprocess";
var disconnect = (anyProcess) => {
if (anyProcess.connected) {
anyProcess.disconnect();
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/outgoing.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/utils/deferred.js
init_esm_shims();
var createDeferred = () => {
const methods = {};
const promise = new Promise((resolve, reject) => {
Object.assign(methods, { resolve, reject });
});
return Object.assign(promise, methods);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/strict.js
init_esm_shims();
import { once as once3 } from "events";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/utils/max-listeners.js
init_esm_shims();
import { addAbortListener } from "events";
var incrementMaxListeners = (eventEmitter, maxListenersIncrement, signal) => {
const maxListeners = eventEmitter.getMaxListeners();
if (maxListeners === 0 || maxListeners === Infinity) {
return;
}
eventEmitter.setMaxListeners(maxListeners + maxListenersIncrement);
addAbortListener(signal, () => {
eventEmitter.setMaxListeners(eventEmitter.getMaxListeners() - maxListenersIncrement);
});
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/forward.js
init_esm_shims();
import { EventEmitter } from "events";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/incoming.js
init_esm_shims();
import { once as once2 } from "events";
import { scheduler } from "timers/promises";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/reference.js
init_esm_shims();
var addReference = (channel, reference) => {
if (reference) {
addReferenceCount(channel);
}
};
var addReferenceCount = (channel) => {
channel.refCounted();
};
var removeReference = (channel, reference) => {
if (reference) {
removeReferenceCount(channel);
}
};
var removeReferenceCount = (channel) => {
channel.unrefCounted();
};
var undoAddedReferences = (channel, isSubprocess) => {
if (!isSubprocess) {
return;
}
removeReferenceCount(channel);
removeReferenceCount(channel);
};
var redoAddedReferences = (channel, isSubprocess) => {
if (!isSubprocess) {
return;
}
addReferenceCount(channel);
addReferenceCount(channel);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/incoming.js
var onMessage = async ({ anyProcess, channel, isSubprocess, ipcEmitter }, wrappedMessage) => {
if (handleStrictResponse(wrappedMessage, anyProcess) || isSubprocess && handleAbort(wrappedMessage)) {
return;
}
if (!INCOMING_MESSAGES.has(anyProcess)) {
INCOMING_MESSAGES.set(anyProcess, []);
}
const incomingMessages = INCOMING_MESSAGES.get(anyProcess);
incomingMessages.push(wrappedMessage);
if (incomingMessages.length > 1) {
return;
}
while (incomingMessages.length > 0) {
await waitForOutgoingMessages(anyProcess, ipcEmitter, incomingMessages[0]);
await scheduler.yield();
const message = await handleStrictRequest({
wrappedMessage: incomingMessages[0],
anyProcess,
channel,
isSubprocess,
ipcEmitter
});
incomingMessages.shift();
ipcEmitter.emit("message", message);
ipcEmitter.emit("message:done");
}
};
var onDisconnect = async ({ anyProcess, channel, isSubprocess, ipcEmitter, boundOnMessage }) => {
if (isSubprocess) {
abortOnDisconnect();
}
const incomingMessages = INCOMING_MESSAGES.get(anyProcess);
while (incomingMessages?.length > 0) {
await once2(ipcEmitter, "message:done");
}
anyProcess.removeListener("message", boundOnMessage);
redoAddedReferences(channel, isSubprocess);
ipcEmitter.connected = false;
ipcEmitter.emit("disconnect");
};
var INCOMING_MESSAGES = /* @__PURE__ */ new WeakMap();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/forward.js
var getIpcEmitter = (anyProcess, channel, isSubprocess) => {
if (IPC_EMITTERS.has(anyProcess)) {
return IPC_EMITTERS.get(anyProcess);
}
const ipcEmitter = new EventEmitter();
ipcEmitter.setMaxListeners(0);
ipcEmitter.connected = true;
IPC_EMITTERS.set(anyProcess, ipcEmitter);
forwardEvents({
ipcEmitter,
anyProcess,
channel,
isSubprocess
});
return ipcEmitter;
};
var IPC_EMITTERS = /* @__PURE__ */ new WeakMap();
var forwardEvents = ({ ipcEmitter, anyProcess, channel, isSubprocess }) => {
const boundOnMessage = onMessage.bind(void 0, {
anyProcess,
channel,
isSubprocess,
ipcEmitter
});
anyProcess.on("message", boundOnMessage);
anyProcess.once("disconnect", onDisconnect.bind(void 0, {
anyProcess,
channel,
isSubprocess,
ipcEmitter,
boundOnMessage
}));
undoAddedReferences(channel, isSubprocess);
};
var isConnected = (anyProcess) => {
const ipcEmitter = IPC_EMITTERS.get(anyProcess);
return ipcEmitter === void 0 ? anyProcess.channel !== void 0 && anyProcess.channel !== null : ipcEmitter.connected;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/strict.js
var handleSendStrict = ({ anyProcess, channel, isSubprocess, message, strict }) => {
if (!strict) {
return message;
}
const ipcEmitter = getIpcEmitter(anyProcess, channel, isSubprocess);
const hasListeners = hasMessageListeners(anyProcess, ipcEmitter);
return {
id: count++,
type: REQUEST_TYPE,
message,
hasListeners
};
};
var count = 0;
var validateStrictDeadlock = (outgoingMessages, wrappedMessage) => {
if (!isStrictRequest(wrappedMessage) || wrappedMessage.hasListeners) {
return;
}
for (const { id } of outgoingMessages) {
if (id !== void 0) {
STRICT_RESPONSES[id].deferred.resolve({ isDeadlock: true, hasListeners: false });
}
}
};
var handleStrictRequest = async ({ wrappedMessage, anyProcess, channel, isSubprocess, ipcEmitter }) => {
if (!isStrictRequest(wrappedMessage)) {
return wrappedMessage;
}
const { id, message } = wrappedMessage;
if (!anyProcess.connected) {
return message;
}
const response = { id, type: RESPONSE_TYPE, message: hasMessageListeners(anyProcess, ipcEmitter) };
try {
await sendMessage({
anyProcess,
channel,
isSubprocess,
ipc: true
}, response);
} catch (error) {
if (error.cause?.code !== "EPIPE") {
ipcEmitter.emit("strict:error", error);
}
}
return message;
};
var handleStrictResponse = (wrappedMessage, anyProcess) => {
if (wrappedMessage?.type !== RESPONSE_TYPE) {
return false;
}
const { id, message: hasListeners } = wrappedMessage;
const strictResponse = STRICT_RESPONSES[id];
if (strictResponse?.anyProcess === anyProcess) {
strictResponse.deferred.resolve({ isDeadlock: false, hasListeners });
}
return true;
};
var waitForStrictResponse = async (wrappedMessage, anyProcess, isSubprocess) => {
const deferred = createDeferred();
STRICT_RESPONSES[wrappedMessage.id] = { deferred, anyProcess };
const controller = new AbortController();
try {
const { isDeadlock, hasListeners } = await Promise.race([
deferred,
throwOnDisconnect(anyProcess, isSubprocess, controller)
]);
if (isDeadlock) {
throwOnStrictDeadlockError(isSubprocess);
}
if (!hasListeners) {
throwOnMissingStrict(isSubprocess);
}
} finally {
controller.abort();
delete STRICT_RESPONSES[wrappedMessage.id];
}
};
var STRICT_RESPONSES = { __proto__: null };
var throwOnDisconnect = async (anyProcess, isSubprocess, { signal }) => {
incrementMaxListeners(anyProcess, 1, signal);
await once3(anyProcess, "disconnect", { signal });
throwOnStrictDisconnect(isSubprocess);
};
var REQUEST_TYPE = "execa:ipc:request";
var RESPONSE_TYPE = "execa:ipc:response";
var isStrictRequest = (wrappedMessage) => wrappedMessage?.type === REQUEST_TYPE && Number.isInteger(wrappedMessage.id) && typeof wrappedMessage.hasListeners === "boolean";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/outgoing.js
var startSendMessage = (anyProcess, wrappedMessage, strict) => {
if (!OUTGOING_MESSAGES.has(anyProcess)) {
OUTGOING_MESSAGES.set(anyProcess, /* @__PURE__ */ new Set());
}
const outgoingMessages = OUTGOING_MESSAGES.get(anyProcess);
const onMessageSent = createDeferred();
const id = strict ? wrappedMessage.id : void 0;
const outgoingMessage = { onMessageSent, id };
outgoingMessages.add(outgoingMessage);
return { outgoingMessages, outgoingMessage };
};
var endSendMessage = ({ outgoingMessages, outgoingMessage }) => {
outgoingMessages.delete(outgoingMessage);
outgoingMessage.onMessageSent.resolve();
};
var waitForOutgoingMessages = async (anyProcess, ipcEmitter, wrappedMessage) => {
while (!hasMessageListeners(anyProcess, ipcEmitter) && OUTGOING_MESSAGES.get(anyProcess)?.size > 0) {
const outgoingMessages = [...OUTGOING_MESSAGES.get(anyProcess)];
validateStrictDeadlock(outgoingMessages, wrappedMessage);
await Promise.all(outgoingMessages.map(({ onMessageSent }) => onMessageSent));
}
};
var OUTGOING_MESSAGES = /* @__PURE__ */ new WeakMap();
var IPC_SUBPROCESS_OPTIONS = /* @__PURE__ */ new WeakMap();
var setIpcSubprocessOptions = (subprocess, options) => {
IPC_SUBPROCESS_OPTIONS.set(subprocess, options);
};
var hasMessageListeners = (anyProcess, ipcEmitter) => ipcEmitter.listenerCount("message") > getMinListenerCount(anyProcess);
var getMinListenerCount = (anyProcess) => getOptions(anyProcess) !== void 0 && !getFdSpecificValue(getOptions(anyProcess).buffer, "ipc") ? 1 : 0;
var getOptions = (anyProcess) => IPC_SUBPROCESS_OPTIONS.get(anyProcess);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/send.js
var sendMessage = ({ anyProcess, channel, isSubprocess, ipc }, message, options) => {
const { strict = false } = copyOptions(options);
checkBooleanOption(strict, "strict");
const methodName = "sendMessage";
validateIpcMethod({
methodName,
isSubprocess,
ipc,
isConnected: anyProcess.connected
});
return sendMessageAsync({
anyProcess,
channel,
methodName,
isSubprocess,
message,
strict
});
};
var sendMessageAsync = async ({ anyProcess, channel, methodName, isSubprocess, message, strict }) => {
const wrappedMessage = handleSendStrict({
anyProcess,
channel,
isSubprocess,
message,
strict
});
const outgoingMessagesState = startSendMessage(anyProcess, wrappedMessage, strict);
try {
await sendOneMessage({
anyProcess,
methodName,
isSubprocess,
wrappedMessage,
message,
strict
});
} catch (error) {
disconnect(anyProcess);
throw error;
} finally {
endSendMessage(outgoingMessagesState);
}
};
var sendOneMessage = async ({ anyProcess, methodName, isSubprocess, wrappedMessage, message, strict = false }) => {
const sendMethod = getSendMethod(anyProcess);
try {
await Promise.all([
// Only messages sent with the `strict` option wait for an acknowledgment response
strict ? waitForStrictResponse(wrappedMessage, anyProcess, isSubprocess) : void 0,
sendMethod(wrappedMessage)
]);
} catch (error) {
handleEpipeError({ error, methodName, isSubprocess });
handleSerializationError({
error,
methodName,
isSubprocess,
message
});
throw error;
}
};
var getSendMethod = (anyProcess) => {
if (PROCESS_SEND_METHODS.has(anyProcess)) {
return PROCESS_SEND_METHODS.get(anyProcess);
}
const sendMethod = promisify2(anyProcess.send.bind(anyProcess));
PROCESS_SEND_METHODS.set(anyProcess, sendMethod);
return sendMethod;
};
var PROCESS_SEND_METHODS = /* @__PURE__ */ new WeakMap();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/graceful.js
var sendAbort = (subprocess, message) => {
const methodName = "cancelSignal";
validateConnection(methodName, false, subprocess.connected);
return sendOneMessage({
anyProcess: subprocess,
methodName,
isSubprocess: false,
wrappedMessage: { type: GRACEFUL_CANCEL_TYPE, message },
message
});
};
var getCancelSignal = async ({ anyProcess, channel, isSubprocess, ipc }) => {
await startIpc({
anyProcess,
channel,
isSubprocess,
ipc
});
return cancelController.signal;
};
var startIpc = async ({ anyProcess, channel, isSubprocess, ipc }) => {
if (isCancelListening) {
return;
}
if (!ipc) {
throwOnMissingParent();
return;
}
isCancelListening = true;
if (!anyProcess.connected) {
abortOnDisconnect();
return;
}
getIpcEmitter(anyProcess, channel, isSubprocess);
await scheduler2.yield();
};
var isCancelListening = false;
var handleAbort = (wrappedMessage) => {
if (wrappedMessage?.type !== GRACEFUL_CANCEL_TYPE) {
return false;
}
cancelController.abort(wrappedMessage.message);
return true;
};
var GRACEFUL_CANCEL_TYPE = "execa:ipc:cancel";
var abortOnDisconnect = () => {
cancelController.abort(getAbortDisconnectError());
};
var cancelController = new AbortController();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/graceful.js
var validateGracefulCancel = ({ gracefulCancel, cancelSignal, ipc, serialization }) => {
if (!gracefulCancel) {
return;
}
if (cancelSignal === void 0) {
throw new Error("The `cancelSignal` option must be defined when setting the `gracefulCancel` option.");
}
if (!ipc) {
throw new Error("The `ipc` option cannot be false when setting the `gracefulCancel` option.");
}
if (serialization === "json") {
throw new Error("The `serialization` option cannot be 'json' when setting the `gracefulCancel` option.");
}
};
var throwOnGracefulCancel = ({
subprocess,
kill,
cancelSignal,
gracefulCancel,
forceKillAfterDelay,
context,
controller
}) => gracefulCancel ? [sendOnAbort({
subprocess,
kill,
cancelSignal,
forceKillAfterDelay,
context,
controller
})] : [];
var sendOnAbort = async ({ subprocess, kill, cancelSignal, forceKillAfterDelay, context, controller: { signal } }) => {
await onAbortedSignal(cancelSignal, signal);
const reason = getReason(cancelSignal);
await sendAbort(subprocess, reason);
killOnTimeout({
kill,
forceKillAfterDelay,
context,
controllerSignal: signal
});
context.terminationReason ??= "gracefulCancel";
throw cancelSignal.reason;
};
var getReason = ({ reason }) => {
if (!(reason instanceof DOMException)) {
return reason;
}
const error = new Error(reason.message);
Object.defineProperty(error, "stack", {
value: reason.stack,
enumerable: false,
configurable: true,
writable: true
});
return error;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/node.js
init_esm_shims();
import { execPath, execArgv } from "process";
import path3 from "path";
var mapNode = ({ options }) => {
if (options.node === false) {
throw new TypeError('The "node" option cannot be false with `execaNode()`.');
}
return { options: { __proto__: null, ...options, node: true } };
};
var getDefaultNodeOptions = () => {
const nodeOptions = [];
for (let index = 0; index < execArgv.length; index += 1) {
const nodeOption = execArgv[index];
if (REMOVED_OPTIONS_WITH_VALUE.has(nodeOption)) {
if (!execArgv[index + 1]?.startsWith("-")) {
index += 1;
}
} else if (!IGNORED_OPTIONS_REGEXP.test(nodeOption)) {
nodeOptions.push(nodeOption);
}
}
return nodeOptions;
};
var REMOVED_OPTIONS_WITH_VALUE = /* @__PURE__ */ new Set(["-e", "--eval", "-p", "--print", "-pe", "--input-type", "--inspect-port"]);
var IGNORED_OPTIONS_REGEXP = /^--(?:inspect|eval=|print=|input-type=)/;
var handleNodeOption = (file, commandArguments, {
node: shouldHandleNode = false,
nodePath = execPath,
nodeOptions = getDefaultNodeOptions(),
cwd,
execPath: formerNodePath,
...options
}) => {
if (formerNodePath !== void 0) {
throw new TypeError('The "execPath" option has been removed. Please use the "nodePath" option instead.');
}
if (!Array.isArray(nodeOptions) || nodeOptions.some((nodeOption) => typeof nodeOption !== "string")) {
throw new TypeError('The "nodeOptions" option must be an array of strings.');
}
const normalizedNodePath = safeNormalizeFileUrl(nodePath, 'The "nodePath" option');
const resolvedNodePath = path3.resolve(cwd, normalizedNodePath);
const newOptions = {
__proto__: null,
shell: false,
...options,
nodePath: resolvedNodePath,
node: shouldHandleNode,
cwd
};
if (!shouldHandleNode) {
return [file, commandArguments, newOptions];
}
if (path3.basename(file, ".exe") === "node") {
throw new TypeError('When the "node" option is true, the first argument does not need to be "node".');
}
return [
resolvedNodePath,
[
...nodeOptions,
file,
...commandArguments
],
{
__proto__: null,
...newOptions,
// Like other options, `undefined` uses the default value
ipc: newOptions.ipc === void 0 ? true : newOptions.ipc,
shell: false
}
];
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/ipc-input.js
init_esm_shims();
import { serialize } from "v8";
var validateIpcInputOption = ({ ipcInput, ipc, serialization }) => {
if (ipcInput === void 0) {
return;
}
if (!ipc) {
throw new Error("The `ipcInput` option cannot be set unless the `ipc` option is `true`.");
}
validateIpcInput[serialization]?.(ipcInput);
};
var validateAdvancedInput = (ipcInput) => {
try {
serialize(ipcInput);
} catch (error) {
throw new Error("The `ipcInput` option is not serializable with a structured clone.", { cause: error });
}
};
var validateJsonInput = (ipcInput) => {
try {
if (JSON.stringify(ipcInput) === void 0) {
throw new TypeError("The value cannot be represented as JSON.");
}
} catch (error) {
throw new Error("The `ipcInput` option is not serializable with JSON.", { cause: error });
}
};
var validateIpcInput = {
__proto__: null,
advanced: validateAdvancedInput,
json: validateJsonInput
};
var sendIpcInput = async (subprocess, ipcInput, ipc) => {
if (ipcInput === void 0) {
return;
}
await sendMessage({
anyProcess: subprocess,
channel: subprocess.channel,
isSubprocess: false,
ipc
}, ipcInput);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/encoding-option.js
init_esm_shims();
var validateEncoding = ({ encoding }) => {
if (ENCODINGS.has(encoding)) {
return;
}
const correctEncoding = getCorrectEncoding(encoding);
if (correctEncoding !== void 0) {
throw new TypeError(`Invalid option \`encoding: ${serializeEncoding(encoding)}\`.
Please rename it to ${serializeEncoding(correctEncoding)}.`);
}
const correctEncodings = [...ENCODINGS].map((correctEncoding2) => serializeEncoding(correctEncoding2)).join(", ");
throw new TypeError(`Invalid option \`encoding: ${serializeEncoding(encoding)}\`.
Please rename it to one of: ${correctEncodings}.`);
};
var TEXT_ENCODINGS = /* @__PURE__ */ new Set(["utf8", "utf16le"]);
var BINARY_ENCODINGS = /* @__PURE__ */ new Set(["buffer", "hex", "base64", "base64url", "latin1", "ascii"]);
var ENCODINGS = TEXT_ENCODINGS.union(BINARY_ENCODINGS);
var getStringEncoding = (binary, encoding) => binary || !TEXT_ENCODINGS.has(encoding) ? "utf8" : encoding;
var getInputEncoding = (encoding) => TEXT_ENCODINGS.has(encoding) ? "utf8" : encoding;
var getCorrectEncoding = (encoding) => {
if (encoding === null) {
return "buffer";
}
if (typeof encoding !== "string") {
return;
}
const lowerEncoding = encoding.toLowerCase();
if (lowerEncoding in ENCODING_ALIASES) {
return ENCODING_ALIASES[lowerEncoding];
}
if (ENCODINGS.has(lowerEncoding)) {
return lowerEncoding;
}
};
var ENCODING_ALIASES = {
__proto__: null,
// eslint-disable-next-line unicorn/text-encoding-identifier-case
"utf-8": "utf8",
"utf-16le": "utf16le",
"ucs-2": "utf16le",
ucs2: "utf16le",
binary: "latin1"
};
var serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encoding}"` : String(encoding);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/command-file.js
init_esm_shims();
import { openSync, readSync, closeSync } from "fs";
import { Buffer } from "buffer";
import path5 from "path";
import process7 from "process";
// node_modules/.pnpm/which-command@0.1.0/node_modules/which-command/index.js
init_esm_shims();
import fs from "fs";
import fsPromises from "fs/promises";
import path4 from "path";
import process6 from "process";
var isWindows = process6.platform === "win32";
var separatorPattern = isWindows ? new RegExp("[\\/\\\\]", "v") : new RegExp("\\/", "v");
var defaultPathExt = ".COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC";
function resolveOptions(command, options) {
if (typeof command !== "string" || command.length === 0) {
throw new TypeError("Expected a non-empty string.");
}
const {
cwd = process6.cwd(),
// On Windows, `process.env.PATH` can be undefined in some contexts (for example, worker threads), where it's only exposed as `Path`.
path: searchPath = process6.env.PATH ?? (isWindows ? process6.env.Path : void 0) ?? "",
// `||` (not `??`) so an empty `PATHEXT` falls back to the default instead of disabling all lookup on Windows.
pathExt = process6.env.PATHEXT || defaultPathExt
} = options;
return { cwd, searchPath, pathExt };
}
function windowsExtensions(command, pathExt) {
const extensions = pathExt.split(path4.delimiter).filter(Boolean);
const commandExtension = path4.extname(command).toLowerCase();
if (commandExtension !== "" && extensions.some((extension) => extension.toLowerCase() === commandExtension)) {
return ["", ...extensions];
}
return extensions;
}
function* candidatePaths(command, { cwd, searchPath, pathExt }) {
const extensions = isWindows ? windowsExtensions(command, pathExt) : [""];
if (separatorPattern.test(command)) {
const base = path4.resolve(cwd, command);
for (const extension of extensions) {
yield base + extension;
}
return;
}
const directories = [
// Windows searches the current directory before `PATH`.
...isWindows ? [cwd] : [],
...searchPath.split(path4.delimiter)
];
for (const directory of directories) {
const unquoted = isWindows && directory.length > 1 && directory.startsWith('"') && directory.endsWith('"') ? directory.slice(1, -1) : directory;
if (unquoted === "") {
continue;
}
const base = path4.resolve(cwd, unquoted, command);
for (const extension of extensions) {
yield base + extension;
}
}
}
function isExecutableSync(filePath) {
let stats;
try {
stats = fs.statSync(filePath);
} catch (error) {
return isWindows && error.code === "EACCES";
}
if (!stats.isFile()) {
return false;
}
if (isWindows) {
return true;
}
try {
fs.accessSync(filePath, fs.constants.X_OK);
return true;
} catch {
return false;
}
}
function whichCommandSync(command, options = {}) {
const resolved = resolveOptions(command, options);
for (const candidate of candidatePaths(command, resolved)) {
if (isExecutableSync(candidate)) {
return candidate;
}
}
return void 0;
}
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/command-file.js
var parseCommandFile = (file, commandArguments, options) => {
const parsed = { file, commandArguments: [...commandArguments], options };
return options.shell || process7.platform !== "win32" ? parsed : escapeWindowsCommand(parsed);
};
var directlyExecutableRegExp = /\.(?:com|exe)$/i;
var escapeWindowsCommand = (parsed) => {
const resolvedFile = resolveWithShebang(parsed);
if (resolvedFile !== void 0 && directlyExecutableRegExp.test(resolvedFile)) {
if (parsed.options.argv0 === void 0) {
parsed.options.argv0 = parsed.file;
}
parsed.file = resolvedFile;
return parsed;
}
for (const value of [parsed.file, ...parsed.commandArguments]) {
assertNoLineBreak(value);
}
const escapedFile = escapeMetaChars(path5.normalize(resolvedFile ?? parsed.file));
const escapedArguments = parsed.commandArguments.map((argument) => escapeArgument(argument));
const commandLine = `"${[escapedFile, ...escapedArguments].join(" ")}"`;
parsed.options.windowsVerbatimArguments = true;
return {
file: process7.env.comspec || "cmd.exe",
// `/e:on` enables the command extensions the `%` escaping relies on, and `/v:off` disables delayed expansion so `!` is literal, even when the registry changes either default
commandArguments: ["/d", "/e:on", "/v:off", "/s", "/c", commandLine],
options: parsed.options
};
};
var resolveWithShebang = (parsed) => {
const resolvedFile = resolvePath(parsed);
const interpreter = resolvedFile !== void 0 && readShebang(resolvedFile);
if (!interpreter) {
return resolvedFile;
}
parsed.commandArguments.unshift(resolvedFile);
parsed.file = interpreter;
return resolvePath(parsed);
};
var resolvePath = (parsed) => {
const environment = parsed.options.env || process7.env;
const cwd = parsed.options.cwd ?? process7.cwd();
const environmentPathExt = getWindowsEnvironmentValue(environment, "PATHEXT");
const commandExtension = path5.extname(parsed.file);
const pathExt = commandExtension === "" ? environmentPathExt : `${commandExtension}${path5.delimiter}${environmentPathExt ?? ""}`;
if (hasWindowsPathSeparator(parsed.file)) {
return whichCommandSync(path5.resolve(cwd, parsed.file), { cwd, pathExt });
}
const searchPath = getWindowsEnvironmentValue(environment, "PATH") ?? getWindowsEnvironmentValue(process7.env, "PATH") ?? "";
const resolveOptions2 = {
cwd,
path: searchPath,
pathExt
};
return shouldSearchCurrentDirectory(environment) ? whichCommandSync(parsed.file, resolveOptions2) : resolvePathDirectories(parsed.file, resolveOptions2);
};
var hasWindowsPathSeparator = (file) => file.includes("/") || file.includes("\\") || file.includes(":");
var shouldSearchCurrentDirectory = (environment) => getWindowsEnvironmentValue(process7.env, "NODEFAULTCURRENTDIRECTORYINEXEPATH") === void 0 && getWindowsEnvironmentValue(environment, "NODEFAULTCURRENTDIRECTORYINEXEPATH") === void 0;
var resolvePathDirectories = (file, { cwd, path: searchPath, pathExt }) => {
for (const directory of searchPath.split(path5.delimiter)) {
const unquotedDirectory = directory.length > 1 && directory.startsWith('"') && directory.endsWith('"') ? directory.slice(1, -1) : directory;
if (unquotedDirectory === "") {
continue;
}
const resolvedFile = whichCommandSync(path5.resolve(cwd, unquotedDirectory, file), { cwd, pathExt });
if (resolvedFile !== void 0) {
return resolvedFile;
}
}
};
var getWindowsEnvironmentValue = (environment, name) => {
const environmentKey = Object.keys(environment).sort().find((key) => key.toUpperCase() === name);
return environmentKey === void 0 ? void 0 : environment[environmentKey];
};
var SHEBANG_BYTE_LENGTH = 150;
var readShebang = (file) => {
const buffer = Buffer.alloc(SHEBANG_BYTE_LENGTH);
let bytesRead = 0;
try {
const fileDescriptor = openSync(file, "r");
try {
bytesRead = readSync(fileDescriptor, buffer, 0, SHEBANG_BYTE_LENGTH, 0);
} finally {
closeSync(fileDescriptor);
}
} catch {
return void 0;
}
return parseShebang(buffer.toString("utf8", 0, bytesRead));
};
var shebangRegExp = /^#!(?<line>.*)/;
var parseShebang = (contents) => {
const shebangLine = contents.match(shebangRegExp)?.groups.line.trim();
if (!shebangLine) {
return void 0;
}
const [interpreterPath, argument] = shebangLine.split(" ", 2);
const interpreter = interpreterPath.split("/").at(-1);
if (interpreter === "env") {
return argument;
}
return argument ? `${interpreter} ${argument}` : interpreter;
};
var lineBreakRegExp = /[\n\r]/;
var assertNoLineBreak = (value) => {
if (lineBreakRegExp.test(value)) {
throw new TypeError(`The command and its arguments cannot contain a line break on Windows without a shell.
This would allow a command injection with \`cmd.exe\`.
Invalid value: ${JSON.stringify(`${value}`)}`);
}
};
var metaCharsRegExp = /[()\][%!^"`<>&|;, *?]/g;
var escapeMetaChars = (value) => value.replaceAll(metaCharsRegExp, "^$&");
var backslashRunRegExp = /\\+/g;
var quotedCharacterRegExp = new RegExp("[^\\w#$*+\\-./:?@\\\\\\u{80}-\\u{10FFFF}]|\\p{Control}", "u");
var escapeArgument = (rawArgument) => {
const argument = `${rawArgument}`;
if (!shouldQuoteArgument(argument)) {
return argument;
}
const escapedArgument = argument.replaceAll(backslashRunRegExp, (backslashes, offset, string) => {
const nextCharacter = string[offset + backslashes.length];
const isPrecedesDoubleQuote = nextCharacter === '"' || nextCharacter === void 0;
return isPrecedesDoubleQuote ? backslashes.repeat(2) : backslashes;
}).replaceAll('"', '""').replaceAll("%", "%%cd:~,%");
return `"${escapedArgument}"`;
};
var shouldQuoteArgument = (argument) => argument === "" || argument.endsWith("\\") || quotedCharacterRegExp.test(argument);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/cwd.js
init_esm_shims();
import { statSync } from "fs";
import path6 from "path";
import process8 from "process";
var normalizeCwd = (cwd = getDefaultCwd()) => {
const cwdString = safeNormalizeFileUrl(cwd, 'The "cwd" option');
return path6.resolve(cwdString);
};
var getDefaultCwd = () => {
try {
return process8.cwd();
} catch (error) {
error.message = `The current directory does not exist.
${error.message}`;
throw error;
}
};
var getCurrentCwd = () => {
try {
return process8.cwd();
} catch {
}
};
var fixCwdError = (originalMessage, cwd) => {
if (cwd === getCurrentCwd()) {
return originalMessage;
}
let cwdStat;
try {
cwdStat = statSync(cwd);
} catch (error) {
return `The "cwd" option is invalid: ${cwd}.
${error.message}
${originalMessage}`;
}
return cwdStat.isDirectory() ? originalMessage : `The "cwd" option is not a directory: ${cwd}.
${originalMessage}`;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/options.js
var cmdExeRegExp = /^cmd(?:\.exe)?$/i;
var normalizeOptions = (filePath, rawArguments, rawOptions) => {
const sanitizedOptions = { __proto__: null, ...rawOptions };
sanitizedOptions.cwd = normalizeCwd(sanitizedOptions.cwd);
const [processedFile, processedArguments, processedOptions] = handleNodeOption(filePath, rawArguments, sanitizedOptions);
const fdOptions = normalizeFdSpecificOptions(processedOptions);
const options = addDefaultOptions(fdOptions);
validateBooleanOptions(options);
validateEnv(options);
options.env = getEnv(options);
const { file, commandArguments } = parseCommandFile(processedFile, processedArguments, options);
validateTimeout(options);
validateEncoding(options);
validateIpcInputOption(options);
validateCancelSignal(options);
validateRenamedSignalOption(options);
validateGracefulCancel(options);
options.shell = normalizeFileUrl(options.shell);
options.killSignal = normalizeKillSignal(options.killSignal);
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
if (process9.platform === "win32" && cmdExeRegExp.test(path7.basename(file))) {
commandArguments.unshift("/q");
}
return { file, commandArguments, options };
};
var BOOLEAN_OPTIONS = [
"extendEnv",
"preferLocal",
"reject",
"cleanup",
"killDescendants",
"all",
"gracefulCancel",
"ipc",
"node"
];
var validateBooleanOptions = (options) => {
for (const optionName of BOOLEAN_OPTIONS) {
checkBooleanOption(options[optionName], optionName);
}
};
var validateEnv = ({ env }) => {
if (env !== void 0 && (typeof env !== "object" || env === null || Array.isArray(env))) {
throw new TypeError(`The \`env\` option must be an object: ${String(env)}.`);
}
};
var addDefaultOptions = ({
extendEnv = true,
preferLocal = false,
cwd,
localDir: localDirectory = cwd,
encoding = "utf8",
reject = true,
cleanup = true,
killDescendants = false,
all = false,
windowsHide = true,
killSignal = "SIGTERM",
forceKillAfterDelay = true,
gracefulCancel = false,
ipcInput,
ipc = ipcInput !== void 0 || gracefulCancel,
serialization = "advanced",
...options
}) => ({
__proto__: null,
...options,
extendEnv,
preferLocal,
cwd,
localDirectory,
encoding,
reject,
cleanup,
killDescendants,
all,
windowsHide,
killSignal,
forceKillAfterDelay,
gracefulCancel,
ipcInput,
ipc,
serialization
});
var getEnv = (options) => ({ __proto__: null, ...computeEnv(options) });
var computeEnv = ({ env: envOption, extendEnv, preferLocal, node, localDirectory, nodePath }) => {
const env = { __proto__: null, ...extendEnv && process9.env, ...envOption };
if (preferLocal || node) {
return npmRunPathEnv({
env,
cwd: localDirectory,
execPath: nodePath,
preferLocal,
addExecPath: node
});
}
return env;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/shell.js
init_esm_shims();
var concatenateShell = (file, commandArguments, options) => options.shell && commandArguments.length > 0 ? [[file, ...commandArguments].join(" "), [], options] : [file, commandArguments, options];
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/return/result.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/all-sync.js
init_esm_shims();
import { Buffer as Buffer2 } from "buffer";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/transform/split.js
init_esm_shims();
var getSplitLinesGenerator = (binary, preserveNewlines, skipped, state) => binary || skipped ? void 0 : initializeSplitLines(preserveNewlines, state);
var splitLinesSync = (chunk, preserveNewlines, objectMode) => objectMode ? chunk.flatMap((item) => splitLinesItemSync(item, preserveNewlines)) : splitLinesItemSync(chunk, preserveNewlines);
var splitLinesItemSync = (chunk, preserveNewlines) => {
const { transform, final } = initializeSplitLines(preserveNewlines, {});
return [...transform(chunk), ...final()];
};
var initializeSplitLines = (preserveNewlines, state) => {
state.previousChunks = "";
return {
transform: splitGenerator.bind(void 0, state, preserveNewlines),
final: linesFinal.bind(void 0, state)
};
};
var splitGenerator = function* (state, preserveNewlines, chunk) {
if (typeof chunk !== "string") {
yield chunk;
return;
}
let { previousChunks } = state;
let start = -1;
for (let end = 0; end < chunk.length; end += 1) {
if (chunk[end] !== "\n") {
continue;
}
let line = chunk.slice(start + 1, preserveNewlines ? end + 1 : end);
if (previousChunks.length > 0) {
line = concatString(previousChunks, line);
previousChunks = "";
}
yield preserveNewlines ? line : stripCarriageReturn(line, state);
start = end;
}
if (start !== chunk.length - 1) {
previousChunks = concatString(previousChunks, chunk.slice(start + 1));
}
state.previousChunks = previousChunks;
};
var stripCarriageReturn = (line, state) => {
state.isWindowsNewline = line.endsWith("\r");
return state.isWindowsNewline ? line.slice(0, -1) : line;
};
var linesFinal = function* ({ previousChunks }) {
if (previousChunks.length > 0) {
yield previousChunks;
}
};
var getAppendNewlineGenerator = ({ binary, preserveNewlines, readableObjectMode, state, encoding }) => binary || preserveNewlines || readableObjectMode ? void 0 : { transform: appendNewlineGenerator.bind(void 0, state, getStringEncoding(binary, encoding)) };
var appendNewlineGenerator = function* ({ isWindowsNewline = false }, stringEncoding, chunk) {
const { unixNewline, windowsNewline, concat } = typeof chunk === "string" ? linesStringInfo : LINES_BYTES_INFO[stringEncoding];
if (endsWithNewline(chunk, unixNewline)) {
yield chunk;
return;
}
const newline = isWindowsNewline ? windowsNewline : unixNewline;
yield concat(chunk, newline);
};
var endsWithNewline = (chunk, unixNewline) => typeof chunk === "string" ? chunk.endsWith(unixNewline) : chunk.length >= unixNewline.length && chunk.subarray(-unixNewline.length).every((byte, index) => byte === unixNewline[index]);
var concatString = (firstChunk, secondChunk) => `${firstChunk}${secondChunk}`;
var linesStringInfo = {
windowsNewline: "\r\n",
unixNewline: "\n",
concat: concatString
};
var concatUint8Array = (firstChunk, secondChunk) => {
const chunk = new Uint8Array(firstChunk.length + secondChunk.length);
chunk.set(firstChunk, 0);
chunk.set(secondChunk, firstChunk.length);
return chunk;
};
var LINES_BYTES_INFO = {
__proto__: null,
utf8: {
windowsNewline: new Uint8Array([13, 10]),
unixNewline: new Uint8Array([10]),
concat: concatUint8Array
},
utf16le: {
windowsNewline: new Uint8Array([13, 0, 10, 0]),
unixNewline: new Uint8Array([10, 0]),
concat: concatUint8Array
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/strip-newline.js
init_esm_shims();
// node_modules/.pnpm/strip-final-newline@4.0.0/node_modules/strip-final-newline/index.js
init_esm_shims();
function stripFinalNewline(input) {
if (typeof input === "string") {
return stripFinalNewlineString(input);
}
if (!(ArrayBuffer.isView(input) && input.BYTES_PER_ELEMENT === 1)) {
throw new Error("Input must be a string or a Uint8Array");
}
return stripFinalNewlineBinary(input);
}
var stripFinalNewlineString = (input) => input.at(-1) === LF ? input.slice(0, input.at(-2) === CR ? -2 : -1) : input;
var stripFinalNewlineBinary = (input) => input.at(-1) === LF_BINARY ? input.subarray(0, input.at(-2) === CR_BINARY ? -2 : -1) : input;
var LF = "\n";
var LF_BINARY = LF.codePointAt(0);
var CR = "\r";
var CR_BINARY = CR.codePointAt(0);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/strip-newline.js
var stripNewline = (value, { stripFinalNewline: stripFinalNewline2 }, fdNumber, allFds) => value !== void 0 && !Array.isArray(value) && getStripFinalNewline(stripFinalNewline2, fdNumber, allFds) ? stripFinalNewline(value) : value;
var getStripFinalNewline = (stripFinalNewline2, fdNumber, allFds) => fdNumber === "all" ? allFds.some((allFd) => stripFinalNewline2[allFd]) : stripFinalNewline2[fdNumber];
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/all-sync.js
var getAllSyncFds = ([, stdout, stderr]) => [
...stdout === void 0 ? [] : [1],
...stderr === void 0 ? [] : [2]
];
var getAllSync = ([, stdout, stderr], allFds, options) => {
if (!options.all) {
return;
}
if (stdout === void 0) {
return splitAllLines(stderr, allFds, options);
}
if (stderr === void 0) {
return splitAllLines(stdout, allFds, options);
}
if (hasLines(options)) {
return [splitAllLines(stdout, allFds, options), splitAllLines(stderr, allFds, options)].flat();
}
if (Array.isArray(stdout) || Array.isArray(stderr)) {
return [stdout, stderr].filter((value) => value.length > 0).flat();
}
if (isUint8Array(stdout) && isUint8Array(stderr)) {
return concatUint8Arrays([stdout, stderr]);
}
return BASE64_ENCODINGS.has(options.encoding) ? concatBase64(stdout, stderr, options.encoding) : `${stdout}${stderr}`;
};
var concatBase64 = (stdout, stderr, encoding) => Buffer2.concat([Buffer2.from(stdout, encoding), Buffer2.from(stderr, encoding)]).toString(encoding);
var BASE64_ENCODINGS = /* @__PURE__ */ new Set(["base64", "base64url"]);
var hasLines = ({ lines }) => Boolean(lines[1] || lines[2]);
var splitAllLines = (value, allFds, options) => value === void 0 || Array.isArray(value) || !hasLines(options) ? value : splitLinesSync(value, !getStripFinalNewline(options.stripFinalNewline, "all", allFds), false);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/return/message.js
init_esm_shims();
import { inspect as inspect3 } from "util";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/max-buffer.js
init_esm_shims();
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/index.js
init_esm_shims();
import { on } from "events";
import { finished } from "stream/promises";
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/stream.js
init_esm_shims();
// node_modules/.pnpm/is-stream@4.0.1/node_modules/is-stream/index.js
init_esm_shims();
function isStream(stream, { checkOpen = true } = {}) {
return stream !== null && typeof stream === "object" && (stream.writable || stream.readable || !checkOpen || stream.writable === void 0 && stream.readable === void 0) && typeof stream.pipe === "function";
}
function isWritableStream(stream, { checkOpen = true } = {}) {
return isStream(stream, { checkOpen }) && (stream.writable || !checkOpen) && typeof stream.write === "function" && typeof stream.end === "function" && typeof stream.writable === "boolean" && typeof stream.writableObjectMode === "boolean" && typeof stream.destroy === "function" && typeof stream.destroyed === "boolean";
}
function isReadableStream(stream, { checkOpen = true } = {}) {
return isStream(stream, { checkOpen }) && (stream.readable || !checkOpen) && typeof stream.read === "function" && typeof stream.readable === "boolean" && typeof stream.readableObjectMode === "boolean" && typeof stream.destroy === "function" && typeof stream.destroyed === "boolean";
}
function isDuplexStream(stream, options) {
return isWritableStream(stream, options) && isReadableStream(stream, options);
}
// node_modules/.pnpm/@sec-ant+readable-stream@0.4.1/node_modules/@sec-ant/readable-stream/dist/ponyfill/index.js
init_esm_shims();
// node_modules/.pnpm/@sec-ant+readable-stream@0.4.1/node_modules/@sec-ant/readable-stream/dist/ponyfill/asyncIterator.js
init_esm_shims();
var a = Object.getPrototypeOf(
Object.getPrototypeOf(
/* istanbul ignore next */
async function* () {
}
).prototype
);
var c = class {
#t;
#n;
#r = false;
#e = void 0;
constructor(e, t) {
this.#t = e, this.#n = t;
}
next() {
const e = () => this.#s();
return this.#e = this.#e ? this.#e.then(e, e) : e(), this.#e;
}
return(e) {
const t = () => this.#i(e);
return this.#e ? this.#e.then(t, t) : t();
}
async #s() {
if (this.#r)
return {
done: true,
value: void 0
};
let e;
try {
e = await this.#t.read();
} catch (t) {
throw this.#e = void 0, this.#r = true, this.#t.releaseLock(), t;
}
return e.done && (this.#e = void 0, this.#r = true, this.#t.releaseLock()), e;
}
async #i(e) {
if (this.#r)
return {
done: true,
value: e
};
if (this.#r = true, !this.#n) {
const t = this.#t.cancel(e);
return this.#t.releaseLock(), await t, {
done: true,
value: e
};
}
return this.#t.releaseLock(), {
done: true,
value: e
};
}
};
var n = /* @__PURE__ */ Symbol();
function i() {
return this[n].next();
}
Object.defineProperty(i, "name", { value: "next" });
function o(r) {
return this[n].return(r);
}
Object.defineProperty(o, "name", { value: "return" });
var u = Object.create(a, {
next: {
enumerable: true,
configurable: true,
writable: true,
value: i
},
return: {
enumerable: true,
configurable: true,
writable: true,
value: o
}
});
function h({ preventCancel: r = false } = {}) {
const e = this.getReader(), t = new c(
e,
r
), s = Object.create(u);
return s[n] = t, s;
}
// node_modules/.pnpm/@sec-ant+readable-stream@0.4.1/node_modules/@sec-ant/readable-stream/dist/ponyfill/fromAnyIterable.js
init_esm_shims();
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/stream.js
var getAsyncIterable = (stream) => {
if (isReadableStream(stream, { checkOpen: false }) && nodeImports.on !== void 0) {
return getStreamIterable(stream);
}
if (typeof stream?.[Symbol.asyncIterator] === "function") {
return stream;
}
if (toString.call(stream) === "[object ReadableStream]") {
return h.call(stream);
}
throw new TypeError("The first argument must be a Readable, a ReadableStream, or an async iterable.");
};
var { toString } = Object.prototype;
var getStreamIterable = async function* (stream) {
const controller = new AbortController();
const state = {};
handleStreamEnd(stream, controller, state);
try {
for await (const [chunk] of nodeImports.on(stream, "data", { signal: controller.signal })) {
yield chunk;
}
} catch (error) {
if (state.error !== void 0) {
throw state.error;
} else if (!controller.signal.aborted) {
throw error;
}
} finally {
stream.destroy();
}
};
var handleStreamEnd = async (stream, controller, state) => {
try {
await nodeImports.finished(stream, {
cleanup: true,
readable: true,
writable: false,
error: false
});
} catch (error) {
state.error = error;
} finally {
controller.abort();
}
};
var nodeImports = {};
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/exports.js
init_esm_shims();
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/array.js
init_esm_shims();
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/contents.js
init_esm_shims();
var getStreamContents = async (stream, { init, convertChunk, getSize, truncateChunk, addChunk, getFinalChunk, finalize }, { maxBuffer = Number.POSITIVE_INFINITY } = {}) => {
const asyncIterable = getAsyncIterable(stream);
const state = init();
state.length = 0;
try {
for await (const chunk of asyncIterable) {
const chunkType = getChunkType(chunk);
const convertedChunk = convertChunk[chunkType](chunk, state);
appendChunk({
convertedChunk,
state,
getSize,
truncateChunk,
addChunk,
maxBuffer
});
}
appendFinalChunk({
state,
convertChunk,
getSize,
truncateChunk,
addChunk,
getFinalChunk,
maxBuffer
});
return finalize(state);
} catch (error) {
const normalizedError = typeof error === "object" && error !== null ? error : new Error(error);
normalizedError.bufferedData = finalize(state);
throw normalizedError;
}
};
var appendFinalChunk = ({ state, getSize, truncateChunk, addChunk, getFinalChunk, maxBuffer }) => {
const convertedChunk = getFinalChunk(state);
if (convertedChunk !== void 0) {
appendChunk({
convertedChunk,
state,
getSize,
truncateChunk,
addChunk,
maxBuffer
});
}
};
var appendChunk = ({ convertedChunk, state, getSize, truncateChunk, addChunk, maxBuffer }) => {
const chunkSize = getSize(convertedChunk);
const newLength = state.length + chunkSize;
if (newLength <= maxBuffer) {
addNewChunk(convertedChunk, state, addChunk, newLength);
return;
}
const truncatedChunk = truncateChunk(convertedChunk, maxBuffer - state.length);
if (truncatedChunk !== void 0) {
addNewChunk(truncatedChunk, state, addChunk, maxBuffer);
}
throw new MaxBufferError();
};
var addNewChunk = (convertedChunk, state, addChunk, newLength) => {
state.contents = addChunk(convertedChunk, state, newLength);
state.length = newLength;
};
var getChunkType = (chunk) => {
const typeOfChunk = typeof chunk;
if (typeOfChunk === "string") {
return "string";
}
if (typeOfChunk !== "object" || chunk === null) {
return "others";
}
if (globalThis.Buffer?.isBuffer(chunk)) {
return "buffer";
}
const prototypeName = objectToString2.call(chunk);
if (prototypeName === "[object ArrayBuffer]") {
return "arrayBuffer";
}
if (prototypeName === "[object DataView]") {
return "dataView";
}
if (Number.isInteger(chunk.byteLength) && Number.isInteger(chunk.byteOffset) && objectToString2.call(chunk.buffer) === "[object ArrayBuffer]") {
return "typedArray";
}
return "others";
};
var { toString: objectToString2 } = Object.prototype;
var MaxBufferError = class extends Error {
name = "MaxBufferError";
constructor() {
super("maxBuffer exceeded");
}
};
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/utils.js
init_esm_shims();
var identity2 = (value) => value;
var noop = () => void 0;
var getContentsProperty = ({ contents }) => contents;
var throwObjectStream = (chunk) => {
throw new Error(`Streams in object mode are not supported: ${String(chunk)}`);
};
var getLengthProperty = (convertedChunk) => convertedChunk.length;
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/array.js
async function getStreamAsArray(stream, options) {
return getStreamContents(stream, arrayMethods, options);
}
var initArray = () => ({ contents: [] });
var increment = () => 1;
var addArrayChunk = (convertedChunk, { contents }) => {
contents.push(convertedChunk);
return contents;
};
var arrayMethods = {
init: initArray,
convertChunk: {
string: identity2,
buffer: identity2,
arrayBuffer: identity2,
dataView: identity2,
typedArray: identity2,
others: identity2
},
getSize: increment,
truncateChunk: noop,
addChunk: addArrayChunk,
getFinalChunk: noop,
finalize: getContentsProperty
};
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/array-buffer.js
init_esm_shims();
async function getStreamAsArrayBuffer(stream, options) {
return getStreamContents(stream, arrayBufferMethods, options);
}
var initArrayBuffer = () => ({ contents: new ArrayBuffer(0) });
var useTextEncoder = (chunk) => textEncoder2.encode(chunk);
var textEncoder2 = new TextEncoder();
var useUint8Array = (chunk) => new Uint8Array(chunk);
var useUint8ArrayWithOffset = (chunk) => new Uint8Array(chunk.buffer, chunk.byteOffset, chunk.byteLength);
var truncateArrayBufferChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
var addArrayBufferChunk = (convertedChunk, { contents, length: previousLength }, length) => {
const newContents = hasArrayBufferResize() ? resizeArrayBuffer(contents, length) : resizeArrayBufferSlow(contents, length);
new Uint8Array(newContents).set(convertedChunk, previousLength);
return newContents;
};
var resizeArrayBufferSlow = (contents, length) => {
if (length <= contents.byteLength) {
return contents;
}
const arrayBuffer = new ArrayBuffer(getNewContentsLength(length));
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
return arrayBuffer;
};
var resizeArrayBuffer = (contents, length) => {
if (length <= contents.maxByteLength) {
contents.resize(length);
return contents;
}
const arrayBuffer = new ArrayBuffer(length, { maxByteLength: getNewContentsLength(length) });
new Uint8Array(arrayBuffer).set(new Uint8Array(contents), 0);
return arrayBuffer;
};
var getNewContentsLength = (length) => SCALE_FACTOR ** Math.ceil(Math.log(length) / Math.log(SCALE_FACTOR));
var SCALE_FACTOR = 2;
var finalizeArrayBuffer = ({ contents, length }) => hasArrayBufferResize() ? contents : contents.slice(0, length);
var hasArrayBufferResize = () => "resize" in ArrayBuffer.prototype;
var arrayBufferMethods = {
init: initArrayBuffer,
convertChunk: {
string: useTextEncoder,
buffer: useUint8Array,
arrayBuffer: useUint8Array,
dataView: useUint8ArrayWithOffset,
typedArray: useUint8ArrayWithOffset,
others: throwObjectStream
},
getSize: getLengthProperty,
truncateChunk: truncateArrayBufferChunk,
addChunk: addArrayBufferChunk,
getFinalChunk: noop,
finalize: finalizeArrayBuffer
};
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/string.js
init_esm_shims();
async function getStreamAsString(stream, options) {
return getStreamContents(stream, stringMethods, options);
}
var initString = () => ({ contents: "", textDecoder: new TextDecoder() });
var useTextDecoder = (chunk, { textDecoder: textDecoder2 }) => textDecoder2.decode(chunk, { stream: true });
var addStringChunk = (convertedChunk, { contents }) => contents + convertedChunk;
var truncateStringChunk = (convertedChunk, chunkSize) => convertedChunk.slice(0, chunkSize);
var getFinalStringChunk = ({ textDecoder: textDecoder2 }) => {
const finalChunk = textDecoder2.decode();
return finalChunk === "" ? void 0 : finalChunk;
};
var stringMethods = {
init: initString,
convertChunk: {
string: identity2,
buffer: useTextDecoder,
arrayBuffer: useTextDecoder,
dataView: useTextDecoder,
typedArray: useTextDecoder,
others: throwObjectStream
},
getSize: getLengthProperty,
truncateChunk: truncateStringChunk,
addChunk: addStringChunk,
getFinalChunk: getFinalStringChunk,
finalize: getContentsProperty
};
// node_modules/.pnpm/get-stream@9.0.1/node_modules/get-stream/source/index.js
Object.assign(nodeImports, { on, finished });
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/max-buffer.js
var handleMaxBuffer = ({ error, stream, readableObjectMode, lines, encoding, fdNumber }) => {
if (!(error instanceof MaxBufferError)) {
throw error;
}
if (fdNumber === "all") {
return error;
}
const unit = getMaxBufferUnit(readableObjectMode, lines, encoding);
error.maxBufferInfo = { fdNumber, unit };
stream.destroy();
throw error;
};
var getMaxBufferUnit = (readableObjectMode, lines, encoding) => {
if (readableObjectMode) {
return "objects";
}
if (lines) {
return "lines";
}
return encoding === "buffer" ? "bytes" : "characters";
};
var checkIpcMaxBuffer = (ipcOutput, maxBuffer) => {
if (ipcOutput.length + 1 <= maxBuffer) {
return;
}
const error = new MaxBufferError();
error.maxBufferInfo = { fdNumber: "ipc" };
throw error;
};
var getMaxBufferMessage = (error, maxBuffer) => {
const { streamName, threshold, unit } = getMaxBufferInfo(error, maxBuffer);
return `Command's ${streamName} was larger than ${threshold} ${unit}`;
};
var getMaxBufferInfo = (error, maxBuffer) => {
if (error?.maxBufferInfo === void 0) {
return { streamName: "output", threshold: maxBuffer[1], unit: "bytes" };
}
const { maxBufferInfo: { fdNumber, unit, threshold = getFdSpecificValue(maxBuffer, fdNumber) } } = error;
delete error.maxBufferInfo;
return fdNumber === "ipc" ? { streamName: "IPC output", threshold, unit: "messages" } : { streamName: getStreamName(fdNumber), threshold, unit };
};
var getMaxBufferSync = ([, stdoutMaxBuffer]) => stdoutMaxBuffer === 0 ? Number.MIN_VALUE : stdoutMaxBuffer;
var handleMaxBufferSync = ({ resultError, output, maxBuffer, buffer }) => {
const fdNumber = findMaxBufferSync(output, maxBuffer, buffer);
if (fdNumber === void 0) {
return { resultError, isMaxBuffer: resultError?.code === "ENOBUFS" };
}
const threshold = getMaxBufferValueSync(maxBuffer, fdNumber);
const error = resultError ?? Object.assign(new MaxBufferError(), { code: "ENOBUFS" });
error.maxBufferInfo = { fdNumber, unit: "bytes", threshold };
return { resultError: error, isMaxBuffer: true };
};
var findMaxBufferSync = (output, maxBuffer, buffer) => {
if (output === null) {
return;
}
const fdNumber = output.findIndex((result, index) => result !== null && buffer[index] && result.length > getMaxBufferValueSync(maxBuffer, index));
return fdNumber === -1 ? void 0 : fdNumber;
};
var getMaxBufferValueSync = (maxBuffer, fdNumber) => Math.min(maxBuffer[1], maxBuffer[fdNumber]);
var truncateMaxBufferSync = (result, fdNumber, { maxBuffer, buffer }) => {
const maxBufferValue = getMaxBufferValueSync(maxBuffer, fdNumber);
return buffer[fdNumber] && result.length > maxBufferValue ? result.slice(0, maxBufferValue) : result;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/return/message.js
var createMessages = ({
stdio,
all,
ipcOutput,
originalError,
signal,
signalDescription,
exitCode,
escapedCommand,
timedOut,
isCanceled,
isGracefullyCanceled,
isMaxBuffer,
isForcefullyTerminated,
forceKillAfterDelay,
killSignal,
maxBuffer,
timeout,
cwd
}) => {
const errorCode = getErrorCode(originalError);
const prefix = getErrorPrefix({
originalError,
timedOut,
timeout,
isMaxBuffer,
maxBuffer,
errorCode,
signal,
signalDescription,
exitCode,
isCanceled,
isGracefullyCanceled,
isForcefullyTerminated,
forceKillAfterDelay,
killSignal
});
const originalMessage = getOriginalMessage(originalError, cwd);
const suffix = originalMessage === void 0 ? "" : `
${originalMessage}`;
const shortMessage = `${prefix}: ${escapedCommand}${suffix}`;
const messageStdio = all === void 0 ? [stdio[2], stdio[1]] : [all];
const message = [
shortMessage,
...messageStdio,
...stdio.slice(3),
ipcOutput.map((ipcMessage) => serializeIpcMessage(ipcMessage)).join("\n")
].map((messagePart) => escapeLines(stripFinalNewline(serializeMessagePart(messagePart)))).filter(Boolean).join("\n\n");
return { originalMessage, shortMessage, message };
};
var getErrorCode = (error) => typeof error?.code === "string" ? error.code : void 0;
var getErrorPrefix = ({
originalError,
timedOut,
timeout,
isMaxBuffer,
maxBuffer,
errorCode,
signal,
signalDescription,
exitCode,
isCanceled,
isGracefullyCanceled,
isForcefullyTerminated,
forceKillAfterDelay,
killSignal
}) => {
const forcefulSuffix = getForcefulSuffix(isForcefullyTerminated, forceKillAfterDelay);
if (timedOut) {
return `Command timed out after ${timeout} milliseconds${forcefulSuffix}`;
}
if (isGracefullyCanceled) {
if (signal === void 0) {
return `Command was gracefully canceled with exit code ${exitCode}`;
}
return isForcefullyTerminated ? `Command was gracefully canceled${forcefulSuffix}` : `Command was gracefully canceled with ${signal} (${signalDescription})`;
}
if (isCanceled) {
return `Command was canceled${forcefulSuffix}`;
}
if (isMaxBuffer) {
return `${getMaxBufferMessage(originalError, maxBuffer)}${forcefulSuffix}`;
}
if (errorCode !== void 0) {
return `Command failed with ${errorCode}${forcefulSuffix}`;
}
if (isForcefullyTerminated) {
return `Command was killed with ${killSignal} (${getSignalDescription(killSignal)})${forcefulSuffix}`;
}
if (signal !== void 0) {
return `Command was killed with ${signal} (${signalDescription})`;
}
return exitCode === void 0 ? "Command failed" : `Command failed with exit code ${exitCode}`;
};
var getForcefulSuffix = (isForcefullyTerminated, forceKillAfterDelay) => isForcefullyTerminated ? ` and was forcefully terminated after ${forceKillAfterDelay} milliseconds` : "";
var getOriginalMessage = (originalError, cwd) => {
if (originalError instanceof DiscardedError) {
return;
}
const originalMessage = isExecaError(originalError) ? originalError.originalMessage ?? "" : String(originalError?.message ?? originalError);
const escapedOriginalMessage = escapeLines(fixCwdError(originalMessage, cwd));
return escapedOriginalMessage === "" ? void 0 : escapedOriginalMessage;
};
var serializeIpcMessage = (ipcMessage) => typeof ipcMessage === "string" ? ipcMessage : inspect3(ipcMessage);
var serializeMessagePart = (messagePart) => Array.isArray(messagePart) ? messagePart.filter((messageItem) => isTextItem(messageItem)).map((messageItem) => stripFinalNewline(serializeMessageItem(messageItem))).join("\n") : serializeMessageItem(messagePart);
var isTextItem = (messageItem) => typeof messageItem === "string" || isUint8Array(messageItem);
var serializeMessageItem = (messageItem) => {
if (typeof messageItem === "string") {
return messageItem;
}
return isUint8Array(messageItem) ? uint8ArrayToString(messageItem) : "";
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/return/result.js
var makeSuccessResult = ({
command,
escapedCommand,
stdio,
all,
ipcOutput,
options: { cwd },
startTime
}) => omitUndefinedProperties({
command,
escapedCommand,
cwd,
durationMs: getDurationMs(startTime),
failed: false,
timedOut: false,
isCanceled: false,
isGracefullyCanceled: false,
isTerminated: false,
isMaxBuffer: false,
isForcefullyTerminated: false,
exitCode: 0,
stdout: stdio[1],
stderr: stdio[2],
all,
stdio,
ipcOutput,
pipedFrom: []
});
var makeEarlyError = ({
error,
command,
escapedCommand,
fileDescriptors,
options,
startTime,
isSync,
stdio = Array.from({ length: fileDescriptors.length }),
all
}) => makeError({
error,
command,
escapedCommand,
startTime,
timedOut: false,
isCanceled: false,
isGracefullyCanceled: false,
isMaxBuffer: false,
isForcefullyTerminated: false,
stdio,
all,
ipcOutput: [],
options,
isSync
});
var getEarlyErrorOutput = (fileDescriptors, options) => {
const stdio = fileDescriptors.map((fileDescriptor, fdNumber) => getEmptyOutput(fileDescriptor, fdNumber, options));
return { stdio, all: getAllSync(stdio, getAllSyncFds(stdio), options) };
};
var getEmptyOutput = ({ direction, objectMode }, fdNumber, { stdio, buffer, lines, encoding }) => {
if (direction === "input" || !PIPED_STDIO.has(stdio[fdNumber]) || !buffer[fdNumber]) {
return;
}
if (objectMode || lines[fdNumber]) {
return [];
}
return encoding === "buffer" ? new Uint8Array() : "";
};
var PIPED_STDIO = /* @__PURE__ */ new Set(["pipe", "overlapped"]);
var makeError = ({
error: originalError,
command,
escapedCommand,
startTime,
timedOut,
isCanceled,
isGracefullyCanceled,
isMaxBuffer,
isForcefullyTerminated,
exitCode: rawExitCode,
signal: rawSignal,
stdio,
all,
ipcOutput,
options: {
timeoutDuration,
timeout = timeoutDuration,
forceKillAfterDelay,
killSignal,
cwd,
maxBuffer
},
isSync
}) => {
const { exitCode, signal, signalDescription } = normalizeExitPayload(rawExitCode, rawSignal);
const { originalMessage, shortMessage, message } = createMessages({
stdio,
all,
ipcOutput,
originalError,
signal,
signalDescription,
exitCode,
escapedCommand,
timedOut,
isCanceled,
isGracefullyCanceled,
isMaxBuffer,
isForcefullyTerminated,
forceKillAfterDelay,
killSignal,
maxBuffer,
timeout,
cwd
});
const error = getFinalError(originalError, message, isSync);
Object.assign(error, getErrorProperties({
error,
command,
escapedCommand,
startTime,
timedOut,
isCanceled,
isGracefullyCanceled,
isMaxBuffer,
isForcefullyTerminated,
exitCode,
signal,
signalDescription,
stdio,
all,
ipcOutput,
cwd,
originalMessage,
shortMessage
}));
return error;
};
var getErrorProperties = ({
error,
command,
escapedCommand,
startTime,
timedOut,
isCanceled,
isGracefullyCanceled,
isMaxBuffer,
isForcefullyTerminated,
exitCode,
signal,
signalDescription,
stdio,
all,
ipcOutput,
cwd,
originalMessage,
shortMessage
}) => omitUndefinedProperties({
shortMessage,
originalMessage,
command,
escapedCommand,
cwd,
durationMs: getDurationMs(startTime),
failed: true,
timedOut,
isCanceled,
isGracefullyCanceled,
isTerminated: signal !== void 0,
isMaxBuffer,
isForcefullyTerminated,
exitCode,
signal,
signalDescription,
code: getErrorCode(error.cause),
stdout: stdio[1],
stderr: stdio[2],
all,
stdio,
ipcOutput,
pipedFrom: []
});
var omitUndefinedProperties = (result) => Object.fromEntries(Object.entries(result).filter(([, value]) => value !== void 0));
var normalizeExitPayload = (rawExitCode, rawSignal) => {
const exitCode = rawExitCode === null ? void 0 : rawExitCode;
const signal = rawSignal === null ? void 0 : rawSignal;
const signalDescription = signal === void 0 ? void 0 : getSignalDescription(rawSignal);
return { exitCode, signal, signalDescription };
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/return/reject.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/complete.js
init_esm_shims();
// node_modules/.pnpm/pretty-ms@9.3.1/node_modules/pretty-ms/index.js
init_esm_shims();
// node_modules/.pnpm/parse-ms@4.0.0/node_modules/parse-ms/index.js
init_esm_shims();
var toZeroIfInfinity = (value) => Number.isFinite(value) ? value : 0;
function parseNumber(milliseconds) {
return {
days: Math.trunc(milliseconds / 864e5),
hours: Math.trunc(milliseconds / 36e5 % 24),
minutes: Math.trunc(milliseconds / 6e4 % 60),
seconds: Math.trunc(milliseconds / 1e3 % 60),
milliseconds: Math.trunc(milliseconds % 1e3),
microseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1e3) % 1e3),
nanoseconds: Math.trunc(toZeroIfInfinity(milliseconds * 1e6) % 1e3)
};
}
function parseBigint(milliseconds) {
return {
days: milliseconds / 86400000n,
hours: milliseconds / 3600000n % 24n,
minutes: milliseconds / 60000n % 60n,
seconds: milliseconds / 1000n % 60n,
milliseconds: milliseconds % 1000n,
microseconds: 0n,
nanoseconds: 0n
};
}
function parseMilliseconds(milliseconds) {
switch (typeof milliseconds) {
case "number": {
if (Number.isFinite(milliseconds)) {
return parseNumber(milliseconds);
}
break;
}
case "bigint": {
return parseBigint(milliseconds);
}
}
throw new TypeError("Expected a finite number or bigint");
}
// node_modules/.pnpm/pretty-ms@9.3.1/node_modules/pretty-ms/index.js
var isZero = (value) => value === 0 || value === 0n;
var pluralize = (word, count2) => count2 === 1 || count2 === 1n ? word : `${word}s`;
var SECOND_ROUNDING_EPSILON = 1e-7;
var ONE_DAY_IN_MILLISECONDS = 24n * 60n * 60n * 1000n;
function prettyMilliseconds(milliseconds, options) {
const isBigInt = typeof milliseconds === "bigint";
if (!isBigInt && !Number.isFinite(milliseconds)) {
throw new TypeError("Expected a finite number or bigint");
}
options = { ...options };
const sign = milliseconds < 0 ? "-" : "";
milliseconds = milliseconds < 0 ? -milliseconds : milliseconds;
if (options.colonNotation) {
options.compact = false;
options.formatSubMilliseconds = false;
options.separateMilliseconds = false;
options.verbose = false;
}
if (options.compact) {
options.unitCount = 1;
options.secondsDecimalDigits = 0;
options.millisecondsDecimalDigits = 0;
}
let result = [];
const floorDecimals = (value, decimalDigits) => {
const flooredInterimValue = Math.floor(value * 10 ** decimalDigits + SECOND_ROUNDING_EPSILON);
const flooredValue = Math.round(flooredInterimValue) / 10 ** decimalDigits;
return flooredValue.toFixed(decimalDigits);
};
const add = (value, long, short, valueString) => {
if ((result.length === 0 || !options.colonNotation) && isZero(value) && !(options.colonNotation && short === "m")) {
return;
}
valueString ??= String(value);
if (options.colonNotation) {
const wholeDigits = valueString.includes(".") ? valueString.split(".")[0].length : valueString.length;
const minLength = result.length > 0 ? 2 : 1;
valueString = "0".repeat(Math.max(0, minLength - wholeDigits)) + valueString;
} else {
valueString += options.verbose ? " " + pluralize(long, value) : short;
}
result.push(valueString);
};
const parsed = parseMilliseconds(milliseconds);
const days = BigInt(parsed.days);
if (options.hideYearAndDays) {
add(BigInt(days) * 24n + BigInt(parsed.hours), "hour", "h");
} else {
if (options.hideYear) {
add(days, "day", "d");
} else {
add(days / 365n, "year", "y");
add(days % 365n, "day", "d");
}
add(Number(parsed.hours), "hour", "h");
}
add(Number(parsed.minutes), "minute", "m");
if (!options.hideSeconds) {
if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3 && !options.subSecondsAsDecimals) {
const seconds = Number(parsed.seconds);
const milliseconds2 = Number(parsed.milliseconds);
const microseconds = Number(parsed.microseconds);
const nanoseconds = Number(parsed.nanoseconds);
add(seconds, "second", "s");
if (options.formatSubMilliseconds) {
add(milliseconds2, "millisecond", "ms");
add(microseconds, "microsecond", "\xB5s");
add(nanoseconds, "nanosecond", "ns");
} else {
const millisecondsAndBelow = milliseconds2 + microseconds / 1e3 + nanoseconds / 1e6;
const millisecondsDecimalDigits = typeof options.millisecondsDecimalDigits === "number" ? options.millisecondsDecimalDigits : 0;
const roundedMilliseconds = millisecondsAndBelow >= 1 ? Math.round(millisecondsAndBelow) : Math.ceil(millisecondsAndBelow);
const maximumMilliseconds = 1e3 - 10 ** -millisecondsDecimalDigits;
const millisecondsString = millisecondsDecimalDigits ? Math.min(millisecondsAndBelow, maximumMilliseconds).toFixed(millisecondsDecimalDigits) : Math.min(roundedMilliseconds, maximumMilliseconds);
add(
Number.parseFloat(millisecondsString),
"millisecond",
"ms",
millisecondsString
);
}
} else {
const seconds = (isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds) / 1e3 % 60;
const secondsDecimalDigits = typeof options.secondsDecimalDigits === "number" ? options.secondsDecimalDigits : 1;
const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
const secondsString = options.keepDecimalsOnWholeSeconds ? secondsFixed : secondsFixed.replace(/\.0+$/, "");
add(Number.parseFloat(secondsString), "second", "s", secondsString);
}
}
if (result.length === 0) {
return sign + "0" + (options.verbose ? " milliseconds" : "ms");
}
const separator = options.colonNotation ? ":" : " ";
if (typeof options.unitCount === "number") {
result = result.slice(0, Math.max(options.unitCount, 1));
}
return sign + result.join(separator);
}
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/error.js
init_esm_shims();
var logError = (result, verboseInfo) => {
if (result.failed) {
verboseLog({
type: "error",
verboseMessage: result.shortMessage,
verboseInfo,
result
});
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/complete.js
var logResult = (result, verboseInfo) => {
if (!isVerbose(verboseInfo)) {
return;
}
logError(result, verboseInfo);
logDuration(result, verboseInfo);
};
var logDuration = (result, verboseInfo) => {
const verboseMessage = `(done in ${prettyMilliseconds(result.durationMs)})`;
verboseLog({
type: "duration",
verboseMessage,
verboseInfo,
result
});
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/return/reject.js
var handleResult = (result, verboseInfo, { reject }) => {
logResult(result, verboseInfo);
if (reject && result.failed) {
throw result;
}
return result;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/handle-sync.js
init_esm_shims();
import { readFileSync as readFileSync2 } from "fs";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/handle.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/transform/normalize.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/type.js
init_esm_shims();
var getStdioItemType = (value, optionName) => {
if (isAsyncGenerator(value)) {
return "asyncGenerator";
}
if (isSyncGenerator(value)) {
return "generator";
}
if (isUrl(value)) {
return "fileUrl";
}
if (isFilePathObject(value)) {
return "filePath";
}
if (isWebStream(value)) {
return "webStream";
}
if (isStream(value, { checkOpen: false })) {
return "native";
}
if (isUint8Array(value)) {
return "uint8Array";
}
if (isAsyncIterableObject(value)) {
return "asyncIterable";
}
if (isIterableObject(value)) {
return "iterable";
}
if (isTransformStream(value)) {
return getTransformStreamType({ transform: value }, optionName);
}
return isTransformOptions(value) ? getTransformObjectType(value, optionName) : "native";
};
var getTransformObjectType = (value, optionName) => {
if (isDuplexStream(value.transform, { checkOpen: false })) {
return getDuplexType(value, optionName);
}
return isTransformStream(value.transform) ? getTransformStreamType(value, optionName) : getGeneratorObjectType(value, optionName);
};
var getDuplexType = (value, optionName) => {
validateNonGeneratorType(value, optionName, "Duplex stream");
return "duplex";
};
var getTransformStreamType = (value, optionName) => {
validateNonGeneratorType(value, optionName, "web TransformStream");
return "webTransform";
};
var validateNonGeneratorType = ({ final, binary, objectMode }, optionName, typeName) => {
checkUndefinedOption(final, `${optionName}.final`, typeName);
checkUndefinedOption(binary, `${optionName}.binary`, typeName);
checkBooleanOption(objectMode, `${optionName}.objectMode`);
};
var checkUndefinedOption = (value, optionName, typeName) => {
if (value !== void 0) {
throw new TypeError(`The \`${optionName}\` option can only be defined when using a generator, not a ${typeName}.`);
}
};
var getGeneratorObjectType = ({ transform, final, binary, objectMode }, optionName) => {
if (transform !== void 0 && !isGenerator(transform)) {
throw new TypeError(`The \`${optionName}.transform\` option must be a generator, a Duplex stream or a web TransformStream.`);
}
if (isDuplexStream(final, { checkOpen: false })) {
throw new TypeError(`The \`${optionName}.final\` option must not be a Duplex stream.`);
}
if (isTransformStream(final)) {
throw new TypeError(`The \`${optionName}.final\` option must not be a web TransformStream.`);
}
if (final !== void 0 && !isGenerator(final)) {
throw new TypeError(`The \`${optionName}.final\` option must be a generator.`);
}
checkBooleanOption(binary, `${optionName}.binary`);
checkBooleanOption(objectMode, `${optionName}.objectMode`);
return isAsyncGenerator(transform) || isAsyncGenerator(final) ? "asyncGenerator" : "generator";
};
var isGenerator = (value) => isAsyncGenerator(value) || isSyncGenerator(value);
var isAsyncGenerator = (value) => Object.prototype.toString.call(value) === "[object AsyncGeneratorFunction]";
var isSyncGenerator = (value) => Object.prototype.toString.call(value) === "[object GeneratorFunction]";
var isTransformOptions = (value) => isPlainObject(value) && (value.transform !== void 0 || value.final !== void 0);
var isUrl = (value) => Object.prototype.toString.call(value) === "[object URL]";
var isRegularUrl = (value) => isUrl(value) && value.protocol !== "file:";
var isFilePathObject = (value) => isPlainObject(value) && Object.keys(value).length > 0 && Object.keys(value).every((key) => FILE_PATH_KEYS.has(key)) && isFilePathString(value.file);
var FILE_PATH_KEYS = /* @__PURE__ */ new Set(["file", "append"]);
var isFilePathString = (file) => typeof file === "string";
var isStdioValueObject = (value) => isPlainObject(value) && Object.keys(value).length > 0 && Object.keys(value).every((key) => STDIO_VALUE_KEYS.has(key)) && "value" in value;
var STDIO_VALUE_KEYS = /* @__PURE__ */ new Set(["value", "input"]);
var isUnknownStdioString = (type, value) => type === "native" && typeof value === "string" && !KNOWN_STDIO_STRINGS.has(value);
var KNOWN_STDIO_STRINGS = /* @__PURE__ */ new Set(["ipc", "ignore", "inherit", "overlapped", "pipe"]);
var isReadableStream2 = (value) => Object.prototype.toString.call(value) === "[object ReadableStream]";
var isWritableStream2 = (value) => Object.prototype.toString.call(value) === "[object WritableStream]";
var isWebStream = (value) => isReadableStream2(value) || isWritableStream2(value);
var isTransformStream = (value) => isReadableStream2(value?.readable) && isWritableStream2(value?.writable);
var isAsyncIterableObject = (value) => isObject(value) && typeof value[Symbol.asyncIterator] === "function";
var isIterableObject = (value) => isObject(value) && typeof value[Symbol.iterator] === "function";
var isObject = (value) => typeof value === "object" && value !== null;
var TRANSFORM_TYPES = /* @__PURE__ */ new Set(["generator", "asyncGenerator", "duplex", "webTransform"]);
var FILE_TYPES = /* @__PURE__ */ new Set(["fileUrl", "filePath", "fileNumber"]);
var SPECIAL_DUPLICATE_TYPES_SYNC = /* @__PURE__ */ new Set(["fileUrl", "filePath"]);
var SPECIAL_DUPLICATE_TYPES = /* @__PURE__ */ new Set([...SPECIAL_DUPLICATE_TYPES_SYNC, "webStream", "nodeStream"]);
var FORBID_DUPLICATE_TYPES = /* @__PURE__ */ new Set(["webTransform", "duplex"]);
var TYPE_TO_MESSAGE = {
generator: "a generator",
asyncGenerator: "an async generator",
fileUrl: "a file URL",
filePath: "a file path string",
fileNumber: "a file descriptor number",
webStream: "a web stream",
nodeStream: "a Node.js stream",
webTransform: "a web TransformStream",
duplex: "a Duplex stream",
native: "any value",
iterable: "an iterable",
asyncIterable: "an async iterable",
string: "a string",
uint8Array: "a Uint8Array"
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/transform/object-mode.js
init_esm_shims();
var getTransformObjectModes = (objectMode, index, newTransforms, direction) => direction === "output" ? getOutputObjectModes(objectMode, index, newTransforms) : getInputObjectModes(objectMode, index, newTransforms);
var getOutputObjectModes = (objectMode, index, newTransforms) => {
const writableObjectMode = index !== 0 && newTransforms[index - 1].value.readableObjectMode;
const readableObjectMode = objectMode ?? writableObjectMode;
return { writableObjectMode, readableObjectMode };
};
var getInputObjectModes = (objectMode, index, newTransforms) => {
const writableObjectMode = index === 0 ? objectMode === true : newTransforms[index - 1].value.readableObjectMode;
const readableObjectMode = index !== newTransforms.length - 1 && (objectMode ?? writableObjectMode);
return { writableObjectMode, readableObjectMode };
};
var getFdObjectMode = (stdioItems, direction) => {
const lastTransform = stdioItems.findLast(({ type }) => TRANSFORM_TYPES.has(type));
if (lastTransform === void 0) {
return false;
}
return direction === "input" ? lastTransform.value.writableObjectMode : lastTransform.value.readableObjectMode;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/transform/normalize.js
var normalizeTransforms = (stdioItems, optionName, direction, options) => [
...stdioItems.filter(({ type }) => !TRANSFORM_TYPES.has(type)),
...getTransforms(stdioItems, optionName, direction, options)
];
var getTransforms = (stdioItems, optionName, direction, { encoding }) => {
const transforms = stdioItems.filter(({ type }) => TRANSFORM_TYPES.has(type));
const newTransforms = Array.from({ length: transforms.length });
for (const [index, stdioItem] of Object.entries(transforms)) {
newTransforms[index] = normalizeTransform({
stdioItem,
index: Number(index),
newTransforms,
optionName,
direction,
encoding
});
}
return sortTransforms(newTransforms, direction);
};
var normalizeTransform = ({ stdioItem, stdioItem: { type }, index, newTransforms, optionName, direction, encoding }) => {
if (type === "duplex") {
return normalizeDuplex({ stdioItem, optionName });
}
if (type === "webTransform") {
return normalizeTransformStream({
stdioItem,
index,
newTransforms,
direction
});
}
return normalizeGenerator({
stdioItem,
index,
newTransforms,
direction,
encoding
});
};
var normalizeDuplex = ({ stdioItem, optionName }) => {
const { value } = stdioItem;
const { transform } = value;
const { writableObjectMode, readableObjectMode } = transform;
const { objectMode = readableObjectMode } = value;
if (objectMode && !readableObjectMode) {
throw new TypeError(`The \`${optionName}.objectMode\` option can only be \`true\` if \`new Duplex({objectMode: true})\` is used.`);
}
if (!objectMode && readableObjectMode) {
throw new TypeError(`The \`${optionName}.objectMode\` option cannot be \`false\` if \`new Duplex({objectMode: true})\` is used.`);
}
return {
...stdioItem,
value: { transform, writableObjectMode, readableObjectMode }
};
};
var normalizeTransformStream = ({ stdioItem, stdioItem: { value }, index, newTransforms, direction }) => {
const { transform, objectMode } = isPlainObject(value) ? value : { transform: value };
const { writableObjectMode, readableObjectMode } = getTransformObjectModes(objectMode, index, newTransforms, direction);
return {
...stdioItem,
value: { transform, writableObjectMode, readableObjectMode }
};
};
var normalizeGenerator = ({ stdioItem, stdioItem: { value }, index, newTransforms, direction, encoding }) => {
const {
transform,
final,
binary: binaryOption = false,
preserveNewlines = false,
objectMode
} = isPlainObject(value) ? value : { transform: value };
const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
const { writableObjectMode, readableObjectMode } = getTransformObjectModes(objectMode, index, newTransforms, direction);
return {
...stdioItem,
value: {
transform,
final,
binary,
preserveNewlines,
writableObjectMode,
readableObjectMode
}
};
};
var sortTransforms = (newTransforms, direction) => direction === "input" ? newTransforms.reverse() : newTransforms;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/direction.js
init_esm_shims();
import process10 from "process";
var getStreamDirection = ({ stdioItems, isStdioArray, fdNumber, optionName }) => {
const directions = stdioItems.map((stdioItem) => getStdioItemDirection(stdioItem, fdNumber, isStdioArray));
if (directions.includes("input") && directions.includes("output")) {
throw new TypeError(`The \`${optionName}\` option must not be an array of both readable and writable values.`);
}
return directions.find(Boolean) ?? DEFAULT_DIRECTION;
};
var getStdioItemDirection = (stdioItem, fdNumber, isStdioArray) => {
const knownDirection = KNOWN_DIRECTIONS[fdNumber];
const direction = getRequestedDirection(stdioItem);
if (knownDirection === void 0) {
return direction;
}
validateKnownDirection(stdioItem, knownDirection, isStdioArray);
return knownDirection;
};
var getRequestedDirection = ({ type, value, direction, optionName }) => {
const guessedDirection = guessStreamDirection[type](value);
if (direction === "input" && guessedDirection === "output") {
throw new TypeError(`The \`${optionName}\` option is invalid: \`input: true\` cannot be used with a writable value, which is always an output.`);
}
return direction ?? guessedDirection;
};
var validateKnownDirection = ({ type, value, optionName }, knownDirection, isStdioArray) => {
if (!STREAM_TYPES.has(type) || !isStdioArray && getStandardStreamDirection(value) !== void 0) {
return;
}
const guessedDirection = guessStreamDirection[type](value);
if (guessedDirection === void 0 || guessedDirection === knownDirection) {
return;
}
const valueName = guessedDirection === "input" ? "readable" : "writable";
throw new TypeError(`The \`${optionName}\` option is invalid: a ${valueName} value is always an ${guessedDirection}, but \`${optionName}\` is an ${knownDirection}.`);
};
var STREAM_TYPES = /* @__PURE__ */ new Set(["native", "nodeStream", "webStream"]);
var KNOWN_DIRECTIONS = ["input", "output", "output"];
var anyDirection = () => void 0;
var alwaysInput = () => "input";
var guessStreamDirection = {
generator: anyDirection,
asyncGenerator: anyDirection,
fileUrl: anyDirection,
filePath: anyDirection,
iterable: alwaysInput,
asyncIterable: alwaysInput,
uint8Array: alwaysInput,
string: alwaysInput,
webStream: (value) => isWritableStream2(value) ? "output" : "input",
nodeStream(value) {
if (!isReadableStream(value, { checkOpen: false })) {
return "output";
}
return isWritableStream(value, { checkOpen: false }) ? void 0 : "input";
},
webTransform: anyDirection,
duplex: anyDirection,
native(value) {
const standardStreamDirection = getStandardStreamDirection(value);
if (standardStreamDirection !== void 0) {
return standardStreamDirection;
}
if (isStream(value, { checkOpen: false })) {
return guessStreamDirection.nodeStream(value);
}
}
};
var getStandardStreamDirection = (value) => {
if ([0, process10.stdin].includes(value)) {
return "input";
}
if ([1, 2, process10.stdout, process10.stderr].includes(value)) {
return "output";
}
};
var DEFAULT_DIRECTION = "output";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/stdio-option.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/array.js
init_esm_shims();
var normalizeIpcStdioArray = (stdioArray, ipc) => ipc ? [...stdioArray, "ipc"] : stdioArray;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/stdio-option.js
var normalizeStdioOption = (options, verboseInfo, isSync) => {
const { stdio, ipc, buffer } = options;
const stdioArray = getStdioArray(stdio, options).map((stdioOption, fdNumber) => addDefaultValue2(stdioOption, fdNumber));
validateIpcStdioOption(stdioArray);
return isSync ? normalizeStdioSync(stdioArray, buffer, verboseInfo) : normalizeIpcStdioArray(stdioArray, ipc);
};
var validateIpcStdioOption = (stdioArray) => {
if (stdioArray.some((stdioOption) => hasIpcStdioOption(stdioOption))) {
throw new Error("The `ipc: true` option must be used instead of `stdio: 'ipc'`.");
}
};
var hasIpcStdioOption = (stdioOption) => Array.isArray(stdioOption) ? stdioOption.some((item) => hasIpcStdioItem(item)) : hasIpcStdioItem(stdioOption);
var hasIpcStdioItem = (stdioOption) => isStdioValueObject(stdioOption) ? stdioOption.value === "ipc" : stdioOption === "ipc";
var getStdioArray = (stdio, options) => {
if (stdio === void 0) {
return STANDARD_STREAMS_ALIASES.map((alias) => options[alias]);
}
if (hasAlias(options)) {
throw new Error(`It's not possible to provide \`stdio\` in combination with one of ${STANDARD_STREAMS_ALIASES.map((alias) => `\`${alias}\``).join(", ")}`);
}
if (typeof stdio === "string") {
return [stdio, stdio, stdio];
}
if (!Array.isArray(stdio)) {
throw new TypeError(`Expected \`stdio\` to be of type \`string\` or \`Array\`, got \`${getTypeName(stdio)}\``);
}
const length = Math.max(stdio.length, STANDARD_STREAMS_ALIASES.length);
return Array.from({ length }, (_, fdNumber) => stdio[fdNumber]);
};
var hasAlias = (options) => STANDARD_STREAMS_ALIASES.some((alias) => options[alias] !== void 0);
var addDefaultValue2 = (stdioOption, fdNumber) => {
if (Array.isArray(stdioOption)) {
return stdioOption.map((item) => addDefaultValue2(item, fdNumber));
}
if (stdioOption === null || stdioOption === void 0) {
return fdNumber >= STANDARD_STREAMS_ALIASES.length ? "ignore" : "pipe";
}
return stdioOption;
};
var normalizeStdioSync = (stdioArray, buffer, verboseInfo) => stdioArray.map((stdioOption, fdNumber) => !buffer[fdNumber] && isStandardOutputFd(fdNumber) && !isFullVerbose(verboseInfo, fdNumber) && isOutputPipeOnly(stdioOption, fdNumber) ? "ignore" : stdioOption);
var isOutputPipeOnly = (stdioOption, fdNumber) => isOutputPipe(stdioOption, fdNumber) || Array.isArray(stdioOption) && stdioOption.length > 0 && stdioOption.every((item) => isOutputPipe(item, fdNumber));
var isOutputPipe = (stdioOption, fdNumber) => stdioOption === "pipe" || isOutputPipeObject(stdioOption, fdNumber);
var isOutputPipeObject = (stdioOption, fdNumber) => isStdioValueObject(stdioOption) && stdioOption.value === "pipe" && (stdioOption.input === void 0 || stdioOption.input === false || isFixedOutputPipe(fdNumber, stdioOption.input));
var isFixedOutputPipe = (fdNumber, input) => input === true && isStandardOutputFd(fdNumber);
var isStandardOutputFd = (fdNumber) => fdNumber === 1 || fdNumber === 2;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/native.js
init_esm_shims();
import { readFileSync } from "fs";
import tty2 from "tty";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/arguments/fd-options.js
init_esm_shims();
var getToStream = (destination, to = "stdin") => {
const isWritable = true;
const { options, fileDescriptors } = SUBPROCESS_OPTIONS.get(destination);
const fdNumber = getFdNumber(fileDescriptors, to, isWritable);
const destinationStream = destination.stdio[fdNumber];
if (destinationStream === null) {
throw new TypeError(getInvalidStdioOptionMessage(fdNumber, to, options, isWritable));
}
return destinationStream;
};
var getFromStream = (source, from = "stdout") => {
const isWritable = false;
const { options, fileDescriptors } = SUBPROCESS_OPTIONS.get(source);
const fdNumber = getFdNumber(fileDescriptors, from, isWritable);
const sourceStream = fdNumber === "all" ? source.all : source.stdio[fdNumber];
if (sourceStream === null || sourceStream === void 0) {
throw new TypeError(getInvalidStdioOptionMessage(fdNumber, from, options, isWritable));
}
return sourceStream;
};
var SUBPROCESS_OPTIONS = /* @__PURE__ */ new WeakMap();
var getFdNumber = (fileDescriptors, fdName, isWritable) => {
const fdNumber = parseFdNumber(fdName, isWritable);
validateFdNumber(fdNumber, fdName, isWritable, fileDescriptors);
return fdNumber;
};
var parseFdNumber = (fdName, isWritable) => {
const fdNumber = parseFd(fdName);
if (fdNumber !== void 0) {
return fdNumber;
}
const { validOptions, defaultValue } = isWritable ? { validOptions: '"stdin"', defaultValue: "stdin" } : { validOptions: '"stdout", "stderr", "all"', defaultValue: "stdout" };
throw new TypeError(`"${getOptionName(isWritable)}" must not be "${fdName}".
It must be ${validOptions} or "fd3", "fd4" (and so on).
It is optional and defaults to "${defaultValue}".`);
};
var validateFdNumber = (fdNumber, fdName, isWritable, fileDescriptors) => {
const fileDescriptor = fileDescriptors[getUsedDescriptor(fdNumber)];
if (fileDescriptor === void 0) {
throw new TypeError(`"${getOptionName(isWritable)}" must not be ${fdName}. That file descriptor does not exist.
Please set the "stdio" option to ensure that file descriptor exists.`);
}
if (!isWritable && fileDescriptor.direction === "input") {
throw new TypeError(`"${getOptionName(isWritable)}" must not be ${fdName}. It must be a readable stream, not writable.`);
}
if (isWritable && fileDescriptor.direction !== "input") {
throw new TypeError(`"${getOptionName(isWritable)}" must not be ${fdName}. It must be a writable stream, not readable.
If you meant to use it as input, please set its "stdio" option to \`{value: 'pipe', input: true}\`.`);
}
};
var getInvalidStdioOptionMessage = (fdNumber, fdName, options, isWritable) => {
if (fdNumber === "all" && !options.all) {
return `The "all" option must be true to use "from: 'all'".`;
}
const { optionName, optionValue } = getInvalidStdioOption(fdNumber, options);
return `The "${optionName}: ${serializeOptionValue(optionValue)}" option is incompatible with using "${getOptionName(isWritable)}: ${serializeOptionValue(fdName)}".
Please set this option with "pipe" instead.`;
};
var getInvalidStdioOption = (fdNumber, { stdin, stdout, stderr, stdio }) => {
const usedDescriptor = getUsedDescriptor(fdNumber);
if (usedDescriptor === 0 && stdin !== void 0) {
return { optionName: "stdin", optionValue: stdin };
}
if (usedDescriptor === 1 && stdout !== void 0) {
return { optionName: "stdout", optionValue: stdout };
}
return usedDescriptor === 2 && stderr !== void 0 ? { optionName: "stderr", optionValue: stderr } : { optionName: `stdio[${usedDescriptor}]`, optionValue: stdio[usedDescriptor] };
};
var getUsedDescriptor = (fdNumber) => fdNumber === "all" ? 1 : fdNumber;
var getOptionName = (isWritable) => isWritable ? "to" : "from";
var serializeOptionValue = (value) => {
if (typeof value === "string") {
return `'${value}'`;
}
return typeof value === "number" ? `${value}` : "Stream";
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/native.js
var handleNativeStream = ({ stdioItem, stdioItem: { type }, isStdioArray, fdNumber, direction, isSync }) => {
if (!isStdioArray || type !== "native") {
return stdioItem;
}
return isSync ? handleNativeStreamSync({ stdioItem, fdNumber, direction }) : handleNativeStreamAsync({ stdioItem, fdNumber });
};
var handleNativeStreamSync = ({ stdioItem, stdioItem: { value, optionName }, fdNumber, direction }) => {
const targetFd = getTargetFd({
value,
optionName,
fdNumber,
direction
});
if (targetFd !== void 0) {
return targetFd;
}
if (isStream(value, { checkOpen: false })) {
throw new TypeError(`The \`${optionName}: Stream\` option cannot both be an array and include a stream with synchronous methods.`);
}
return stdioItem;
};
var getTargetFd = ({ value, optionName, fdNumber, direction }) => {
const targetFdNumber = getTargetFdNumber(value, fdNumber);
if (targetFdNumber === void 0) {
return;
}
if (direction === "output") {
return { type: "fileNumber", value: targetFdNumber, optionName };
}
if (tty2.isatty(targetFdNumber)) {
throw new TypeError(`The \`${optionName}: ${serializeOptionValue(value)}\` option is invalid: it cannot be a TTY with synchronous methods.`);
}
return { type: "uint8Array", contents: () => [bufferToUint8Array(readFileSync(targetFdNumber))], optionName };
};
var getTargetFdNumber = (value, fdNumber) => {
if (value === "inherit") {
return fdNumber;
}
if (typeof value === "number") {
return value;
}
const standardStreamIndex = STANDARD_STREAMS.indexOf(value);
if (standardStreamIndex !== -1) {
return standardStreamIndex;
}
};
var handleNativeStreamAsync = ({ stdioItem, stdioItem: { value, optionName }, fdNumber }) => {
if (value === "inherit") {
return { type: "nodeStream", value: getStandardStream(fdNumber, value, optionName), optionName };
}
if (typeof value === "number") {
return { type: "nodeStream", value: getStandardStream(value, value, optionName), optionName };
}
return isStream(value, { checkOpen: false }) ? { type: "nodeStream", value, optionName } : stdioItem;
};
var getStandardStream = (fdNumber, value, optionName) => {
const standardStream = STANDARD_STREAMS[fdNumber];
if (standardStream === void 0) {
throw new TypeError(`The \`${optionName}: ${value}\` option is invalid: no such standard stream.`);
}
return standardStream;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/input-option.js
init_esm_shims();
var handleInputOptions = ({ input, inputFile }, fdNumber) => fdNumber === 0 ? [
...handleInputOption(input),
...handleInputFileOption(inputFile)
] : [];
var handleInputOption = (input) => input === void 0 ? [] : [{
type: getInputType(input),
value: input,
optionName: "input"
}];
var getInputType = (input) => {
if (isReadableStream(input, { checkOpen: false })) {
return "nodeStream";
}
if (typeof input === "string") {
return "string";
}
if (isUint8Array(input)) {
return "uint8Array";
}
throw new Error("The `input` option must be a string, a Uint8Array or a Node.js Readable stream.");
};
var handleInputFileOption = (inputFile) => inputFile === void 0 ? [] : [{
...getInputFileType(inputFile),
optionName: "inputFile"
}];
var getInputFileType = (inputFile) => {
if (isUrl(inputFile)) {
return { type: "fileUrl", value: inputFile };
}
if (isFilePathString(inputFile)) {
return { type: "filePath", value: { file: inputFile } };
}
throw new Error("The `inputFile` option must be a file path string or a file URL.");
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/duplicate.js
init_esm_shims();
import path8 from "path";
import { fileURLToPath as fileURLToPath3 } from "url";
var isFileType = (type) => SPECIAL_DUPLICATE_TYPES_SYNC.has(type);
var getFileTarget = ({ type, value }) => type === "filePath" ? path8.resolve(value.file) : fileURLToPath3(value);
var filterDuplicates = (stdioItems) => stdioItems.filter((stdioItemOne, indexOne) => stdioItems.every((stdioItemTwo, indexTwo) => !hasSameValueAndDirection(stdioItemOne, stdioItemTwo) || indexOne >= indexTwo || stdioItemOne.type === "generator" || stdioItemOne.type === "asyncGenerator"));
var hasSameValueAndDirection = (stdioItemOne, stdioItemTwo) => stdioItemOne.value === stdioItemTwo.value && stdioItemOne.direction === stdioItemTwo.direction;
var getDuplicateStream = ({ stdioItem: { type, value, optionName }, direction, fileDescriptors, isSync }) => {
const otherStdioItems = getOtherStdioItems(fileDescriptors, type);
if (otherStdioItems.length === 0) {
return;
}
if (isSync) {
validateDuplicateStreamSync({
otherStdioItems,
type,
value,
optionName,
direction
});
return;
}
if (SPECIAL_DUPLICATE_TYPES.has(type)) {
return getDuplicateStreamInstance({
otherStdioItems,
type,
value,
optionName,
direction
});
}
if (FORBID_DUPLICATE_TYPES.has(type)) {
validateDuplicateTransform({
otherStdioItems,
type,
value,
optionName
});
}
};
var getOtherStdioItems = (fileDescriptors, type) => fileDescriptors.flatMap(
({ direction, stdioItems }) => stdioItems.map((stdioItem) => ({ ...stdioItem, direction }))
).filter((stdioItem) => isSameDuplicateType(stdioItem.type, type));
var isSameDuplicateType = (otherType, type) => otherType === type || isFileType(otherType) && isFileType(type);
var validateDuplicateStreamSync = ({ otherStdioItems, type, value, optionName, direction }) => {
if (SPECIAL_DUPLICATE_TYPES_SYNC.has(type)) {
getDuplicateStreamInstance({
otherStdioItems,
type,
value,
optionName,
direction
});
}
};
var getDuplicateStreamInstance = ({ otherStdioItems, type, value, optionName, direction }) => {
const duplicateStdioItems = otherStdioItems.filter((stdioItem) => hasSameValue(stdioItem, type, value));
if (duplicateStdioItems.length === 0) {
return;
}
const differentStdioItem = duplicateStdioItems.find((stdioItem) => stdioItem.direction !== direction);
throwOnDuplicateStream(differentStdioItem, optionName, type);
return direction === "output" || type === "webStream" ? duplicateStdioItems[0].stream : void 0;
};
var hasSameValue = (otherStdioItem, type, value) => isFileType(otherStdioItem.type) ? getFileTarget(otherStdioItem) === getFileTarget({ type, value }) : otherStdioItem.value === value;
var validateDuplicateTransform = ({ otherStdioItems, type, value, optionName }) => {
const duplicateStdioItem = otherStdioItems.find(({ value: { transform } }) => transform === value.transform);
throwOnDuplicateStream(duplicateStdioItem, optionName, type);
};
var throwOnDuplicateStream = (stdioItem, optionName, type) => {
if (stdioItem !== void 0) {
throw new TypeError(`The \`${stdioItem.optionName}\` and \`${optionName}\` options must not target ${TYPE_TO_MESSAGE[type]} that is the same.`);
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/handle.js
var handleStdio = (addProperties3, options, verboseInfo, isSync) => {
const stdio = normalizeStdioOption(options, verboseInfo, isSync);
const initialFileDescriptors = stdio.map((stdioOption, fdNumber) => getFileDescriptor({
stdioOption,
fdNumber,
options,
isSync
}));
const fileDescriptors = getFinalFileDescriptors({
initialFileDescriptors,
addProperties: addProperties3,
options,
isSync
});
options.stdio = fileDescriptors.map(({ stdioItems }) => forwardStdio(stdioItems));
return fileDescriptors;
};
var getFileDescriptor = ({ stdioOption, fdNumber, options, isSync }) => {
const optionName = getStreamName(fdNumber);
const { stdioItems: initialStdioItems, isStdioArray } = initializeStdioItems({
stdioOption,
fdNumber,
options,
optionName
});
const direction = getStreamDirection({
stdioItems: initialStdioItems,
isStdioArray,
fdNumber,
optionName
});
const stdioItems = initialStdioItems.map((stdioItem) => handleNativeStream({
stdioItem,
isStdioArray,
fdNumber,
direction,
isSync
}));
const normalizedStdioItems = normalizeTransforms(stdioItems, optionName, direction, options);
const objectMode = getFdObjectMode(normalizedStdioItems, direction);
validateFileObjectMode(normalizedStdioItems, objectMode);
return { direction, objectMode, stdioItems: normalizedStdioItems };
};
var initializeStdioItems = ({ stdioOption, fdNumber, options, optionName }) => {
const values = Array.isArray(stdioOption) ? stdioOption : [stdioOption];
const inputStdioItems = handleInputOptions(options, fdNumber);
const initialStdioItems = [
...omitInheritedStdin(values.map((value) => initializeStdioItem(value, optionName)), inputStdioItems),
...inputStdioItems
];
const stdioItems = filterDuplicates(initialStdioItems);
const isStdioArray = stdioItems.length > 1;
validateStdioArray(stdioItems, isStdioArray, optionName);
validateStreams(stdioItems, isStdioArray);
return { stdioItems, isStdioArray };
};
var omitInheritedStdin = (stdioItems, inputStdioItems) => inputStdioItems.length > 0 && isInheritedStdinOnly(stdioItems) ? [] : stdioItems;
var isInheritedStdinOnly = (stdioItems) => stdioItems.length === 1 && stdioItems[0].type === "native" && stdioItems[0].value === "inherit";
var initializeStdioItem = (value, optionName) => {
if (isStdioValueObject(value)) {
return initializeStdioValueObject(value, optionName);
}
return {
type: getStdioItemType(value, optionName),
value,
optionName
};
};
var initializeStdioValueObject = ({ value, input }, optionName) => {
checkBooleanOption(input, `${optionName}.input`);
return {
type: getStdioItemType(value, optionName),
value,
direction: input ? "input" : void 0,
optionName
};
};
var validateStdioArray = (stdioItems, isStdioArray, optionName) => {
if (stdioItems.length === 0) {
throw new TypeError(`The \`${optionName}\` option must not be an empty array.`);
}
if (!isStdioArray) {
return;
}
for (const { value, optionName: optionName2 } of stdioItems) {
if (INVALID_STDIO_ARRAY_OPTIONS.has(value)) {
throw new Error(`The \`${optionName2}\` option must not include \`${value}\`.`);
}
}
};
var INVALID_STDIO_ARRAY_OPTIONS = /* @__PURE__ */ new Set(["ignore"]);
var validateStreams = (stdioItems, isStdioArray) => {
for (const stdioItem of stdioItems) {
validateFileStdio(stdioItem);
validateFileDescriptorStdio(stdioItem);
validateNativeStdio(stdioItem, isStdioArray);
}
};
var validateFileDescriptorStdio = ({ type, value, optionName }) => {
if (type !== "native") {
return;
}
const fileDescriptor = typeof value === "number" ? value : value?.fd;
if (typeof fileDescriptor === "number" && (!Number.isInteger(fileDescriptor) || fileDescriptor < 0 || fileDescriptor > MAX_FILE_DESCRIPTOR)) {
throw new TypeError(`The \`${optionName}\` option must be a non-negative 32-bit integer: got ${fileDescriptor}.`);
}
};
var MAX_FILE_DESCRIPTOR = 2 ** 31 - 1;
var validateNativeStdio = ({ type, value, optionName }, isStdioArray) => {
if (type !== "native") {
return;
}
if (isFileHandle(value)) {
if (isStdioArray) {
throw new TypeError(`The \`${optionName}\` option cannot combine file handles with other values.`);
}
return;
}
if (typeof value !== "string" && typeof value !== "number" && !isStream(value, { checkOpen: false })) {
throw new TypeError(`The \`${optionName}\` option is invalid: ${String(value)} (${typeof value}).`);
}
};
var isFileHandle = (value) => typeof value?.fd === "number" && !isStream(value, { checkOpen: false });
var validateFileStdio = ({ type, value, optionName }) => {
if (isRegularUrl(value)) {
throw new TypeError(`The \`${optionName}: URL\` option must use the \`file:\` scheme.
For example, you can use the \`pathToFileURL()\` method of the \`url\` core module.`);
}
if (isUnknownStdioString(type, value)) {
throw new TypeError(`The \`${optionName}: { file: '...' }\` option must be used instead of \`${optionName}: '...'\`.`);
}
};
var validateFileObjectMode = (stdioItems, objectMode) => {
if (!objectMode) {
return;
}
const fileStdioItem = stdioItems.find(({ type }) => FILE_TYPES.has(type));
if (fileStdioItem !== void 0) {
throw new TypeError(`The \`${fileStdioItem.optionName}\` option cannot use both files and transforms in objectMode.`);
}
};
var getFinalFileDescriptors = ({ initialFileDescriptors, addProperties: addProperties3, options, isSync }) => {
const fileDescriptors = [];
try {
for (const fileDescriptor of initialFileDescriptors) {
addFinalFileDescriptor({
fileDescriptor,
fileDescriptors,
addProperties: addProperties3,
options,
isSync
});
}
return fileDescriptors;
} catch (error) {
cleanupCustomStreams(fileDescriptors);
throw error;
}
};
var addFinalFileDescriptor = ({ fileDescriptor, fileDescriptors, addProperties: addProperties3, options, isSync }) => {
const { direction, objectMode, stdioItems } = fileDescriptor;
const finalFileDescriptor = { direction, objectMode, stdioItems: [] };
fileDescriptors.push(finalFileDescriptor);
for (const stdioItem of stdioItems) {
finalFileDescriptor.stdioItems.push(addStreamProperties({
stdioItem,
addProperties: addProperties3,
direction,
objectMode,
options,
fileDescriptors,
isSync
}));
}
};
var addStreamProperties = ({ stdioItem, addProperties: addProperties3, direction, objectMode, options, fileDescriptors, isSync }) => {
const duplicateStream = getDuplicateStream({
stdioItem,
direction,
fileDescriptors,
isSync
});
if (duplicateStream !== void 0) {
return { ...stdioItem, stream: duplicateStream };
}
return {
...stdioItem,
...addProperties3[direction][stdioItem.type](stdioItem, options, objectMode)
};
};
var cleanupCustomStreams = (fileDescriptors) => {
for (const { stream } of fileDescriptors.flatMap(({ stdioItems }) => stdioItems)) {
if (stream === void 0 || isStandardStream(stream)) {
continue;
}
stream.on("error", () => {
});
stream.destroy();
}
};
var forwardStdio = (stdioItems) => {
if (stdioItems.length > 1) {
return stdioItems.some(({ value: value2 }) => value2 === "overlapped") ? "overlapped" : "pipe";
}
const [{ type, value }] = stdioItems;
return type === "native" ? value : "pipe";
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/handle-sync.js
var handleStdioSync = (options, verboseInfo) => handleStdio(addPropertiesSync, options, verboseInfo, true);
var forbiddenIfSync = ({ type, optionName }) => {
throwInvalidSyncValue(optionName, TYPE_TO_MESSAGE[type]);
};
var forbiddenNativeIfSync = ({ optionName, value }) => {
if (value === "overlapped") {
throwInvalidSyncValue(optionName, `"${value}"`);
}
return {};
};
var forbiddenNativeInputIfSync = (stdioItem) => {
const { optionName, value } = stdioItem;
if (value === "pipe" && optionName !== "stdin") {
throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be an input pipe with synchronous methods.`);
}
return forbiddenNativeIfSync(stdioItem);
};
var forbiddenInputTransformIfSync = ({ optionName }) => {
if (optionName !== "stdin") {
throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be an input transform with synchronous methods.`);
}
};
var throwInvalidSyncValue = (optionName, value) => {
throw new TypeError(`The \`${optionName}\` option cannot be ${value} with synchronous methods.`);
};
var addProperties = {
generator() {
},
asyncGenerator: forbiddenIfSync,
webStream: forbiddenIfSync,
nodeStream: forbiddenIfSync,
webTransform: forbiddenIfSync,
duplex: forbiddenIfSync,
asyncIterable: forbiddenIfSync,
native: forbiddenNativeIfSync
};
var addPropertiesSync = {
input: {
...addProperties,
generator: forbiddenInputTransformIfSync,
native: forbiddenNativeInputIfSync,
// Files and iterables are read lazily, so that a file which cannot be read, or an iterable which throws, is reported like any other early error, instead of being thrown as a raw error
fileUrl: ({ value }) => ({ contents: () => [bufferToUint8Array(readFileSync2(value))] }),
filePath: ({ value: { file } }) => ({ contents: () => [bufferToUint8Array(readFileSync2(file))] }),
fileNumber: forbiddenIfSync,
iterable: ({ value }) => ({ contents: () => [...value] }),
string: ({ value }) => ({ contents: [value] }),
// `contents` is already set when reading from a file descriptor
uint8Array: ({ value, contents = [value] }) => ({ contents })
},
output: {
...addProperties,
fileUrl: ({ value }) => ({ path: value }),
filePath: ({ value: { file, append } }) => ({ path: file, append }),
fileNumber: ({ value }) => ({ path: value }),
iterable: forbiddenIfSync,
string: forbiddenIfSync,
uint8Array: forbiddenIfSync
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/input-sync.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/transform/generator.js
init_esm_shims();
import { Transform, getDefaultHighWaterMark } from "stream";
import { Buffer as Buffer5 } from "buffer";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/transform/validate.js
init_esm_shims();
import { Buffer as Buffer3 } from "buffer";
var getValidateTransformInput = (writableObjectMode, optionName) => writableObjectMode ? void 0 : validateStringTransformInput.bind(void 0, optionName);
var validateStringTransformInput = function* (optionName, chunk) {
if (typeof chunk !== "string" && !isUint8Array(chunk) && !Buffer3.isBuffer(chunk)) {
throw new TypeError(`The \`${optionName}\` option's transform must use "objectMode: true" to receive as input: ${typeof chunk}.`);
}
yield chunk;
};
var getValidateTransformReturn = (readableObjectMode, optionName) => readableObjectMode ? validateObjectTransformReturn.bind(void 0, optionName) : validateStringTransformReturn.bind(void 0, optionName);
var validateObjectTransformReturn = function* (optionName, chunk) {
validateEmptyReturn(optionName, chunk);
yield chunk;
};
var validateStringTransformReturn = function* (optionName, chunk) {
validateEmptyReturn(optionName, chunk);
if (typeof chunk !== "string" && !isUint8Array(chunk)) {
throw new TypeError(`The \`${optionName}\` option's function must yield a string or an Uint8Array, not ${typeof chunk}.`);
}
yield chunk;
};
var validateEmptyReturn = (optionName, chunk) => {
if (chunk === null || chunk === void 0) {
throw new TypeError(`The \`${optionName}\` option's function must not call \`yield ${chunk}\`.
Instead, \`yield\` should either be called with a value, or not be called at all. For example:
if (condition) { yield value; }`);
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/transform/encoding-transform.js
init_esm_shims();
import { Buffer as Buffer4 } from "buffer";
import { StringDecoder as StringDecoder2 } from "string_decoder";
var getEncodingTransformGenerator = (binary, encoding, skipped) => {
if (skipped) {
return;
}
if (binary) {
return { transform: encodingUint8ArrayGenerator.bind(void 0, new TextEncoder()) };
}
const stringDecoder = new StringDecoder2(encoding);
return {
transform: encodingStringGenerator.bind(void 0, stringDecoder),
final: encodingStringFinal.bind(void 0, stringDecoder)
};
};
var encodingUint8ArrayGenerator = function* (textEncoder3, chunk) {
if (Buffer4.isBuffer(chunk)) {
yield bufferToUint8Array(chunk);
} else if (typeof chunk === "string") {
yield textEncoder3.encode(chunk);
} else {
yield chunk;
}
};
var encodingStringGenerator = function* (stringDecoder, chunk) {
yield isUint8Array(chunk) ? stringDecoder.write(chunk) : chunk;
};
var encodingStringFinal = function* (stringDecoder) {
const lastChunk = stringDecoder.end();
if (lastChunk !== "") {
yield lastChunk;
}
};
var getStringToBytesGenerator = (binary, encoding, skipped) => skipped || encoding === "utf8" ? void 0 : { transform: stringToBytesGenerator.bind(void 0, getStringEncoding(binary, encoding)) };
var stringToBytesGenerator = function* (stringEncoding, chunk) {
yield typeof chunk === "string" ? bufferToUint8Array(Buffer4.from(chunk, stringEncoding)) : chunk;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/transform/run-async.js
init_esm_shims();
import { callbackify } from "util";
var pushChunks = callbackify(async (getChunks2, state, getChunksArguments, transformStream) => {
state.currentIterable = getChunks2(...getChunksArguments);
try {
for await (const chunk of state.currentIterable) {
transformStream.push(chunk);
}
} finally {
delete state.currentIterable;
}
});
var transformChunk = async function* (chunk, generators, index) {
if (index === generators.length) {
yield chunk;
return;
}
const { transform = identityGenerator } = generators[index];
for await (const transformedChunk of transform(chunk)) {
yield* transformChunk(transformedChunk, generators, index + 1);
}
};
var finalChunks = async function* (generators) {
for (const [index, { final }] of Object.entries(generators)) {
yield* generatorFinalChunks(final, Number(index), generators);
}
};
var generatorFinalChunks = async function* (final, index, generators) {
if (final === void 0) {
return;
}
for await (const finalChunk of final()) {
yield* transformChunk(finalChunk, generators, index + 1);
}
};
var destroyTransform = callbackify(async ({ currentIterable }, error) => {
if (currentIterable !== void 0) {
await (error ? currentIterable.throw(error) : currentIterable.return());
return;
}
if (error) {
throw error;
}
});
var identityGenerator = function* (chunk) {
yield chunk;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/transform/run-sync.js
init_esm_shims();
var pushChunksSync = (getChunksSync, getChunksArguments, transformStream, done) => {
try {
for (const chunk of getChunksSync(...getChunksArguments)) {
transformStream.push(chunk);
}
done();
} catch (error) {
done(normalizeTransformError(error));
}
};
var normalizeTransformError = (error) => error || Object.assign(new Error("Promise was rejected with falsy value"), {
code: "ERR_FALSY_VALUE_REJECTION",
reason: error
});
var runTransformSync = (generators, chunks) => {
try {
return [
...chunks.flatMap((chunk) => [...transformChunkSync(chunk, generators, 0)]),
...finalChunksSync(generators)
];
} catch (error) {
throw normalizeTransformError(error);
}
};
var transformChunkSync = function* (chunk, generators, index) {
if (index === generators.length) {
yield chunk;
return;
}
const { transform = identityGenerator2 } = generators[index];
for (const transformedChunk of transform(chunk)) {
yield* transformChunkSync(transformedChunk, generators, index + 1);
}
};
var finalChunksSync = function* (generators) {
for (const [index, { final }] of Object.entries(generators)) {
yield* generatorFinalChunksSync(final, Number(index), generators);
}
};
var generatorFinalChunksSync = function* (final, index, generators) {
if (final === void 0) {
return;
}
for (const finalChunk of final()) {
yield* transformChunkSync(finalChunk, generators, index + 1);
}
};
var identityGenerator2 = function* (chunk) {
yield chunk;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/transform/generator.js
var generatorToStream = ({
value,
value: {
transform,
final,
binary,
writableObjectMode,
readableObjectMode
},
optionName
}, { encoding }) => {
const state = {};
const generators = addInternalGenerators(value, encoding, optionName);
const transformAsync = isAsyncGenerator(transform);
const finalAsync = isAsyncGenerator(final);
const transformMethod = transformAsync ? pushChunks.bind(void 0, transformChunk, state) : pushChunksSync.bind(void 0, transformChunkSync);
const finalMethod = transformAsync || finalAsync ? pushChunks.bind(void 0, finalChunks, state) : pushChunksSync.bind(void 0, finalChunksSync);
const destroyMethod = transformAsync || finalAsync ? destroyTransform.bind(void 0, state) : void 0;
const stream = new Transform({
writableObjectMode,
writableHighWaterMark: getDefaultHighWaterMark(writableObjectMode),
readableObjectMode,
readableHighWaterMark: getDefaultHighWaterMark(readableObjectMode),
// A string written to the stream is converted to bytes with this encoding, which `getEncodingTransformGenerator()` then decodes with the `encoding` option
defaultEncoding: getStringEncoding(binary, encoding),
transform(chunk, encoding2, done) {
transformMethod([chunk, generators, 0], this, done);
},
flush(done) {
finalMethod([generators], this, done);
},
destroy: destroyMethod
});
return { stream };
};
var runGeneratorsSync = (chunks, stdioItems, encoding, isInput) => {
const generators = stdioItems.filter(({ type }) => type === "generator");
const reversedGenerators = isInput ? generators.reverse() : generators;
for (const { value, optionName } of reversedGenerators) {
if (!value.writableObjectMode) {
const stringEncoding = getStringEncoding(value.binary, encoding);
chunks = chunks.map((chunk) => typeof chunk === "string" ? Buffer5.from(chunk, stringEncoding) : chunk);
}
const generators2 = addInternalGenerators(value, encoding, optionName);
chunks = runTransformSync(generators2, chunks);
}
return chunks;
};
var addInternalGenerators = ({ transform, final, binary, writableObjectMode, readableObjectMode, preserveNewlines }, encoding, optionName) => {
const state = {};
return [
{ transform: getValidateTransformInput(writableObjectMode, optionName) },
getEncodingTransformGenerator(binary, encoding, writableObjectMode),
getSplitLinesGenerator(binary, preserveNewlines, writableObjectMode, state),
{ transform, final },
{ transform: getValidateTransformReturn(readableObjectMode, optionName) },
getAppendNewlineGenerator({
binary,
preserveNewlines,
readableObjectMode,
state,
encoding
}),
getStringToBytesGenerator(binary, encoding, readableObjectMode)
].filter(Boolean);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/input-sync.js
var addInputOptionsSync = (fileDescriptors, options) => {
for (const fdNumber of getInputFdNumbers(fileDescriptors)) {
addInputOptionSync(fileDescriptors, fdNumber, options);
}
};
var getInputFdNumbers = (fileDescriptors) => new Set(Object.entries(fileDescriptors).filter(([, { direction }]) => direction === "input").map(([fdNumber]) => Number(fdNumber)));
var addInputOptionSync = (fileDescriptors, fdNumber, options) => {
const { stdioItems } = fileDescriptors[fdNumber];
const allStdioItems = stdioItems.filter(({ contents }) => contents !== void 0);
if (allStdioItems.length === 0 && stdioItems.every(({ type }) => type !== "generator")) {
return;
}
if (fdNumber !== 0) {
const [{ type, optionName }] = allStdioItems;
throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be ${TYPE_TO_MESSAGE[type]} with synchronous methods.`);
}
const chunks = allStdioItems.flatMap(({ type, contents }) => getChunks(type, typeof contents === "function" ? contents() : contents));
options.input = applyInputGeneratorsSync(chunks, stdioItems, options.encoding);
};
var getChunks = (type, chunks) => type === "iterable" ? chunks : chunks.filter((chunk) => chunk.length > 0);
var applyInputGeneratorsSync = (chunks, stdioItems, encoding) => {
const newContents = runGeneratorsSync(chunks, stdioItems, getInputEncoding(encoding), true);
validateSerializable(newContents);
return joinToUint8Array(newContents);
};
var validateSerializable = (newContents) => {
const invalidItem = newContents.find((item) => !isSerializableInput(item));
if (invalidItem !== void 0) {
throwOnSerializableInput("stdin", invalidItem);
}
};
var isSerializableInput = (item) => typeof item === "string" || isUint8Array(item);
var throwOnSerializableInput = (optionName, invalidItem) => {
throw new TypeError(`The \`${optionName}\` option is invalid: when passing objects as input, a transform must be used to serialize them to strings or Uint8Arrays: ${invalidItem}.`);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/output-sync.js
init_esm_shims();
import { writeFileSync, appendFileSync } from "fs";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/output.js
init_esm_shims();
var shouldLogOutput = ({ stdioItems, encoding, verboseInfo, fdNumber }) => fdNumber !== "all" && isFullVerbose(verboseInfo, fdNumber) && !BINARY_ENCODINGS.has(encoding) && isFdVerbose(fdNumber) && (stdioItems.some(({ type, value }) => type === "native" && PIPED_STDIO_VALUES.has(value)) || stdioItems.every(({ type }) => TRANSFORM_TYPES.has(type)));
var isFdVerbose = (fdNumber) => fdNumber === 1 || fdNumber === 2;
var PIPED_STDIO_VALUES = /* @__PURE__ */ new Set(["pipe", "overlapped"]);
var logLines = async (linesIterable, stream, fdNumber, verboseInfo) => {
for await (const line of linesIterable) {
if (!isPipingStream(stream)) {
logLine(line, fdNumber, verboseInfo);
}
}
};
var logLinesSync = (linesArray, fdNumber, verboseInfo) => {
for (const line of linesArray) {
logLine(line, fdNumber, verboseInfo);
}
};
var isPipingStream = (stream) => stream._readableState.pipes.some((pipe) => !isAllStream(pipe) || isPipingStream(pipe));
var logLine = (line, fdNumber, verboseInfo) => {
const verboseMessage = serializeVerboseMessage(line);
verboseLog({
type: "output",
verboseMessage,
fdNumber,
verboseInfo
});
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/output-sync.js
var transformOutputSync = ({ fileDescriptors, syncResult, options, verboseInfo }) => {
const output = syncResult.output ?? getSpawnFailureOutput(options);
const outputFiles = /* @__PURE__ */ new Set();
const errors = [];
const transformedOutput = output.map((result, fdNumber) => transformOutputResultSync({
result,
fileDescriptors,
fdNumber,
errors,
outputFiles,
verboseInfo
}, options));
return { output: transformedOutput, error: errors.find((error) => error !== void 0) };
};
var getSpawnFailureOutput = ({ stdio }) => stdio.map((stdioOption, fdNumber) => fdNumber !== 0 && stdioOption === "pipe" ? new Uint8Array() : null);
var transformOutputResultSync = ({ result, fileDescriptors, fdNumber, errors, outputFiles, verboseInfo }, { buffer, encoding, lines, stripFinalNewline: stripFinalNewline2, maxBuffer }) => {
if (result === null) {
return;
}
const truncatedResult = truncateMaxBufferSync(result, fdNumber, { maxBuffer, buffer });
const uint8ArrayResult = bufferToUint8Array(truncatedResult);
const { stdioItems, objectMode } = fileDescriptors[fdNumber];
const { chunks, error: transformError } = runOutputGeneratorsSync(uint8ArrayResult.length === 0 ? [] : [uint8ArrayResult], stdioItems, encoding);
const { serializedResult, finalResult } = serializeChunks({
chunks,
objectMode,
encoding,
lines,
stripFinalNewline: stripFinalNewline2,
fdNumber
});
const logError2 = logOutputSync({
serializedResult,
fdNumber,
verboseInfo,
encoding,
stdioItems,
objectMode
});
const error = transformError ?? logError2;
errors.push(error);
const returnedResult = buffer[fdNumber] ? finalResult : void 0;
try {
if (error === void 0) {
writeToFiles(chunks, stdioItems, outputFiles);
}
return returnedResult;
} catch (writeError) {
errors.push(writeError);
return returnedResult;
}
};
var runOutputGeneratorsSync = (chunks, stdioItems, encoding) => {
try {
return { chunks: runGeneratorsSync(chunks, stdioItems, encoding, false), error: void 0 };
} catch (error) {
return { chunks: [], error };
}
};
var serializeChunks = ({ chunks, objectMode, encoding, lines, stripFinalNewline: stripFinalNewline2, fdNumber }) => {
if (objectMode) {
return { serializedResult: chunks, finalResult: chunks };
}
if (encoding === "buffer") {
const serializedResult2 = joinToUint8Array(chunks);
return { serializedResult: serializedResult2, finalResult: serializedResult2 };
}
const serializedResult = joinToString(chunks, encoding);
const finalResult = lines[fdNumber] ? splitLinesSync(serializedResult, !stripFinalNewline2[fdNumber], objectMode) : serializedResult;
return { serializedResult, finalResult };
};
var logOutputSync = ({ serializedResult, fdNumber, verboseInfo, encoding, stdioItems, objectMode }) => {
if (!shouldLogOutput({
stdioItems,
encoding,
verboseInfo,
fdNumber
})) {
return;
}
const linesArray = splitLinesSync(serializedResult, false, objectMode);
try {
logLinesSync(linesArray, fdNumber, verboseInfo);
} catch (error) {
return error;
}
};
var writeToFiles = (chunks, stdioItems, outputFiles) => {
const fileItems = stdioItems.filter(({ type }) => FILE_TYPES.has(type));
if (fileItems.length === 0) {
return;
}
const contents = joinToUint8Array(chunks);
const writtenPaths = /* @__PURE__ */ new Set();
for (const stdioItem of fileItems) {
const { type, append } = stdioItem;
const path10 = type === "fileNumber" ? stdioItem.path : getFileTarget(stdioItem);
if (writtenPaths.has(path10)) {
continue;
}
writtenPaths.add(path10);
if (append || outputFiles.has(path10)) {
appendFileSync(path10, contents);
} else {
writeFileSync(path10, contents);
}
outputFiles.add(path10);
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/exit-sync.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/exit-async.js
init_esm_shims();
import { once as once4 } from "events";
var waitForExit = async (subprocess, context) => {
const [exitCode, signal] = await waitForExitOrError(subprocess);
context.isForcefullyTerminated ??= false;
return [exitCode, signal];
};
var waitForExitOrError = async (subprocess) => {
const [spawnPayload, exitPayload] = await Promise.allSettled([
once4(subprocess, "spawn"),
once4(subprocess, "exit")
]);
if (spawnPayload.status === "rejected") {
return [];
}
return exitPayload.status === "rejected" ? waitForSubprocessExit(subprocess) : exitPayload.value;
};
var waitForSubprocessExit = async (subprocess) => {
try {
return await once4(subprocess, "exit");
} catch {
return waitForSubprocessExit(subprocess);
}
};
var waitForSuccessfulExit = async (exitPromise) => {
const [exitCode, signal] = await exitPromise;
if (!isSubprocessErrorExit(exitCode, signal) && isFailedExit(exitCode, signal)) {
throw new DiscardedError();
}
return [exitCode, signal];
};
var isSubprocessErrorExit = (exitCode, signal) => exitCode === void 0 && signal === void 0;
var isFailedExit = (exitCode, signal) => exitCode !== 0 || signal !== null;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/exit-sync.js
var getExitResultSync = ({ error, status: exitCode, signal, output }, { maxBuffer, buffer }) => {
const initialError = getResultError(error, exitCode, signal);
const isTimedOut = initialError?.code === "ETIMEDOUT";
const { resultError, isMaxBuffer } = isTimedOut ? { resultError: initialError, isMaxBuffer: false } : handleMaxBufferSync({
resultError: initialError,
output,
maxBuffer,
buffer
});
return {
resultError,
exitCode,
signal,
timedOut: isTimedOut,
isMaxBuffer
};
};
var getResultError = (error, exitCode, signal) => {
if (error !== void 0) {
return error;
}
return isFailedExit(exitCode, signal) ? new DiscardedError() : void 0;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/main-sync.js
var execaCoreSync = (rawFile, rawArguments, rawOptions) => {
const { file, commandArguments, command, escapedCommand, startTime, verboseInfo, options, fileDescriptors } = handleSyncArguments(rawFile, rawArguments, rawOptions);
const result = spawnSubprocessSync({
file,
commandArguments,
options,
command,
escapedCommand,
verboseInfo,
fileDescriptors,
startTime
});
return handleResult(result, verboseInfo, options);
};
var handleSyncArguments = (rawFile, rawArguments, rawOptions) => {
const { command, escapedCommand, startTime, verboseInfo } = handleCommand(rawFile, rawArguments, rawOptions);
const syncOptions = normalizeSyncOptions(rawOptions);
const { file, commandArguments, options } = normalizeOptions(rawFile, rawArguments, syncOptions);
validateSyncOptions(options);
const fileDescriptors = handleStdioSync(options, verboseInfo);
return {
file,
commandArguments,
command,
escapedCommand,
startTime,
verboseInfo,
options,
fileDescriptors
};
};
var normalizeSyncOptions = (options) => options.node && !options.ipc ? { ...options, ipc: false } : options;
var validateSyncOptions = ({ ipc, ipcInput, detached, cancelSignal, killDescendants }) => {
if (ipcInput !== void 0) {
throwInvalidSyncOption("ipcInput");
}
if (ipc) {
throwInvalidSyncOption("ipc: true");
}
if (detached) {
throwInvalidSyncOption("detached: true");
}
if (killDescendants) {
throwInvalidSyncOption("killDescendants: true");
}
if (cancelSignal) {
throwInvalidSyncOption("cancelSignal");
}
};
var throwInvalidSyncOption = (value) => {
throw new TypeError(`The "${value}" option cannot be used with synchronous methods.`);
};
var spawnSubprocessSync = ({ file, commandArguments, options, command, escapedCommand, verboseInfo, fileDescriptors, startTime }) => {
const syncResult = runSubprocessSync({
file,
commandArguments,
options,
command,
escapedCommand,
fileDescriptors,
startTime
});
if (syncResult.failed) {
return syncResult;
}
const { resultError, exitCode, signal, timedOut, isMaxBuffer } = getExitResultSync(syncResult, options);
const { output, error = resultError } = transformOutputSync({
fileDescriptors,
syncResult,
options,
verboseInfo
});
const stdio = output.map((stdioOutput, fdNumber) => stripNewline(stdioOutput, options, fdNumber));
const allFds = getAllSyncFds(output);
const all = stripNewline(getAllSync(output, allFds, options), options, "all", allFds);
return getSyncResult({
error,
exitCode,
signal,
timedOut,
isMaxBuffer,
stdio,
all,
options,
command,
escapedCommand,
startTime
});
};
var runSubprocessSync = ({ file, commandArguments, options, command, escapedCommand, fileDescriptors, startTime }) => {
try {
addInputOptionsSync(fileDescriptors, options);
const normalizedOptions = normalizeSpawnSyncOptions(options);
return { __proto__: null, ...spawnSync(...concatenateShell(file, commandArguments, normalizedOptions)) };
} catch (error) {
return makeEarlyError({
error,
command,
escapedCommand,
fileDescriptors,
options,
startTime,
isSync: true,
...getEarlyErrorOutput(fileDescriptors, options)
});
}
};
var normalizeSpawnSyncOptions = ({ encoding, maxBuffer, ...options }) => ({ ...options, encoding: "buffer", maxBuffer: getMaxBufferSync(maxBuffer) });
var getSyncResult = ({ error, exitCode, signal, timedOut, isMaxBuffer, stdio, all, options, command, escapedCommand, startTime }) => error === void 0 ? makeSuccessResult({
command,
escapedCommand,
stdio,
all,
ipcOutput: [],
options,
startTime
}) : makeError({
error,
command,
escapedCommand,
timedOut,
isCanceled: false,
isGracefullyCanceled: false,
isMaxBuffer,
isForcefullyTerminated: false,
exitCode,
signal,
stdio,
all,
ipcOutput: [],
options,
startTime,
isSync: true
});
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/main-async.js
init_esm_shims();
import { setMaxListeners, once as once9 } from "events";
import { spawn } from "child_process";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/methods.js
init_esm_shims();
import process11 from "process";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/get-one.js
init_esm_shims();
import { once as once5, on as on2 } from "events";
var internalGetOneMessageOptions = /* @__PURE__ */ Symbol("internalGetOneMessageOptions");
var getOneMessage = ({ anyProcess, channel, isSubprocess, ipc }, rawOptions) => {
const options = copyOptions(rawOptions);
const { reference = true, filter } = options;
const { signal } = options[internalGetOneMessageOptions] ?? {};
validateIpcMethod({
methodName: "getOneMessage",
isSubprocess,
ipc,
isConnected: isConnected(anyProcess)
});
return getOneMessageAsync({
anyProcess,
channel,
isSubprocess,
filter,
reference,
signal
});
};
var getOneMessageAsync = async ({ anyProcess, channel, isSubprocess, filter, reference, signal }) => {
addReference(channel, reference);
const ipcEmitter = getIpcEmitter(anyProcess, channel, isSubprocess);
const controller = new AbortController();
stopOnAbort(signal, controller);
try {
return await Promise.race([
getMessage(ipcEmitter, filter, controller),
throwOnDisconnect2(ipcEmitter, isSubprocess, controller),
throwOnStrictError(ipcEmitter, isSubprocess, controller)
]);
} catch (error) {
if (!signal?.aborted) {
disconnect(anyProcess);
}
throw error;
} finally {
controller.abort();
removeReference(channel, reference);
}
};
var stopOnAbort = (signal, controller) => {
if (signal === void 0) {
return;
}
if (signal.aborted) {
controller.abort();
return;
}
signal.addEventListener("abort", () => {
controller.abort();
}, { once: true, signal: controller.signal });
};
var getMessage = async (ipcEmitter, filter, { signal }) => {
if (filter === void 0) {
const [message] = await once5(ipcEmitter, "message", { signal });
return message;
}
for await (const [message] of on2(ipcEmitter, "message", { signal })) {
if (filter(message)) {
return message;
}
}
};
var throwOnDisconnect2 = async (ipcEmitter, isSubprocess, { signal }) => {
await once5(ipcEmitter, "disconnect", { signal });
throwOnEarlyDisconnect(isSubprocess);
};
var throwOnStrictError = async (ipcEmitter, isSubprocess, { signal }) => {
const [error] = await once5(ipcEmitter, "strict:error", { signal });
throw getStrictResponseError(error, isSubprocess);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/get-each.js
init_esm_shims();
import { once as once6, on as on3 } from "events";
var internalGetEachMessageOptions = /* @__PURE__ */ Symbol("internalGetEachMessageOptions");
var getEachMessage = (subprocessInfo, rawOptions) => {
const options = copyOptions(rawOptions);
const { reference = true } = options;
const { signal, shouldAwait = !subprocessInfo.isSubprocess } = options[internalGetEachMessageOptions] ?? {};
return loopOnMessages({
...subprocessInfo,
shouldAwait,
reference,
signal
});
};
var loopOnMessages = ({ anyProcess, waitProcess = anyProcess, channel, isSubprocess, ipc, shouldAwait, reference, signal }) => {
validateIpcMethod({
methodName: "getEachMessage",
isSubprocess,
ipc,
isConnected: isConnected(anyProcess)
});
addReference(channel, reference);
const ipcEmitter = getIpcEmitter(anyProcess, channel, isSubprocess);
const controller = new AbortController();
const state = {};
stopOnAbort2(signal, controller);
stopOnDisconnect(anyProcess, ipcEmitter, controller);
abortOnStrictError({
ipcEmitter,
isSubprocess,
controller,
state
});
return iterateOnMessages({
anyProcess,
waitProcess,
channel,
ipcEmitter,
isSubprocess,
shouldAwait,
controller,
state,
reference,
signal
});
};
var stopOnAbort2 = (signal, controller) => {
if (signal === void 0) {
return;
}
if (signal.aborted) {
controller.abort();
return;
}
signal.addEventListener("abort", () => {
controller.abort();
}, { once: true, signal: controller.signal });
};
var stopOnDisconnect = async (anyProcess, ipcEmitter, controller) => {
try {
await once6(ipcEmitter, "disconnect", { signal: controller.signal });
controller.abort();
} catch {
}
};
var abortOnStrictError = async ({ ipcEmitter, isSubprocess, controller, state }) => {
try {
const [error] = await once6(ipcEmitter, "strict:error", { signal: controller.signal });
state.error = getStrictResponseError(error, isSubprocess);
controller.abort();
} catch {
}
};
var iterateOnMessages = async function* ({ anyProcess, waitProcess, channel, ipcEmitter, isSubprocess, shouldAwait, controller, state, reference, signal }) {
try {
for await (const [message] of on3(ipcEmitter, "message", { signal: controller.signal })) {
throwIfStrictError(state);
yield message;
}
} catch {
throwIfStrictError(state);
} finally {
controller.abort();
removeReference(channel, reference);
if (!isSubprocess && !signal?.aborted) {
disconnect(anyProcess);
}
if (shouldAwait) {
await waitProcess;
}
}
};
var throwIfStrictError = ({ error }) => {
if (error) {
throw error;
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/methods.js
var addIpcMethods = (target, subprocess, { ipc }) => {
Object.assign(target, getIpcMethods(subprocess, false, ipc, target));
};
var getIpcExport = () => {
const anyProcess = process11;
const isSubprocess = true;
const isIpc = process11.channel !== void 0;
return {
...getIpcMethods(anyProcess, isSubprocess, isIpc),
getCancelSignal: getCancelSignal.bind(void 0, {
anyProcess,
channel: anyProcess.channel,
isSubprocess,
ipc: isIpc
})
};
};
var getIpcMethods = (anyProcess, isSubprocess, ipc, waitProcess = anyProcess) => ({
sendMessage: sendMessage.bind(void 0, {
anyProcess,
channel: anyProcess.channel,
isSubprocess,
ipc
}),
getOneMessage: getOneMessage.bind(void 0, {
anyProcess,
channel: anyProcess.channel,
isSubprocess,
ipc
}),
getEachMessage: getEachMessage.bind(void 0, {
anyProcess,
channel: anyProcess.channel,
isSubprocess,
ipc,
waitProcess
})
});
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/return/early-error.js
init_esm_shims();
import { ChildProcess as ChildProcess2 } from "child_process";
import { callbackify as callbackify2 } from "util";
import {
PassThrough,
Readable,
Writable,
Duplex
} from "stream";
var handleEarlyError = ({ error, command, escapedCommand, fileDescriptors, options, startTime, verboseInfo }) => {
cleanupCustomStreams(fileDescriptors);
const subprocess = new ChildProcess2();
subprocess.kill = () => false;
const all = createDummyStreams(subprocess, fileDescriptors);
const promise = handleDummyPromise({
error,
command,
escapedCommand,
fileDescriptors,
options,
startTime,
verboseInfo
});
return {
subprocess,
promise,
all: options.all ? all : void 0,
convertedStreams: getConvertedStreams(promise)
};
};
var createDummyStreams = (subprocess, fileDescriptors) => {
const stdin = createDummyStream();
const stdout = createDummyStream();
const stderr = createDummyStream();
const extraStdio = Array.from({ length: fileDescriptors.length - 3 }, createDummyStream);
const all = createDummyStream();
const stdio = [stdin, stdout, stderr, ...extraStdio];
Object.assign(subprocess, {
stdin,
stdout,
stderr,
stdio
});
return all;
};
var createDummyStream = () => {
const stream = new PassThrough();
stream.on("error", () => {
});
stream.end();
return stream;
};
var getConvertedStreams = (promise) => {
const waitForPromise = async () => {
await promise;
};
const endReadable = function() {
callbackify2(waitForPromise)((error) => {
if (error) {
this.destroy(error);
} else {
this.push(null);
}
});
};
const endWritable = callbackify2(waitForPromise);
const writeWritable = (chunk, encoding, done) => {
endWritable(done);
};
const readable = () => new Readable({ read: endReadable });
const writable = () => new Writable({ write: writeWritable, final: endWritable });
const duplex = () => new Duplex({ read: endReadable, write: writeWritable, final: endWritable });
const iterable = () => readable()[Symbol.asyncIterator]();
return {
readable,
writable,
duplex,
readableStream: () => Readable.toWeb(readable()),
writableStream: () => Writable.toWeb(writable()),
transformStream: () => Duplex.toWeb(duplex()),
iterable,
[Symbol.asyncIterator]: iterable
};
};
var handleDummyPromise = async ({ error, command, escapedCommand, fileDescriptors, options, startTime, verboseInfo }) => {
const earlyError = makeEarlyError({
error: await error,
command,
escapedCommand,
fileDescriptors,
options,
startTime,
isSync: false,
...getEarlyErrorOutput(fileDescriptors, options)
});
return handleResult(earlyError, verboseInfo, options);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/stdio/handle-async.js
init_esm_shims();
import { createReadStream, createWriteStream } from "fs";
import { Buffer as Buffer6 } from "buffer";
import { Readable as Readable2, Writable as Writable2, Duplex as Duplex2 } from "stream";
var handleStdioAsync = (options, verboseInfo) => handleStdio(addPropertiesAsync, options, verboseInfo, false);
var forbiddenIfAsync = ({ type, optionName }) => {
throw new TypeError(`The \`${optionName}\` option cannot be ${TYPE_TO_MESSAGE[type]}.`);
};
var addProperties2 = {
fileNumber: forbiddenIfAsync,
generator: generatorToStream,
asyncGenerator: generatorToStream,
nodeStream: ({ value }) => ({ stream: value }),
// `Duplex.fromWeb()` uses the same `objectMode` for both sides
webTransform: ({ value: { transform, writableObjectMode, readableObjectMode } }) => ({
stream: Duplex2.from({
writable: Writable2.fromWeb(transform.writable, { objectMode: writableObjectMode }),
readable: Readable2.fromWeb(transform.readable, { objectMode: readableObjectMode })
})
}),
duplex: ({ value: { transform } }) => ({ stream: transform }),
native() {
}
};
var validateIterable = function* (iterable, optionName) {
for (const value of iterable) {
validateIterableValue(value, optionName);
yield value;
}
};
var validateAsyncIterable = async function* (iterable, optionName) {
for await (const value of iterable) {
validateIterableValue(value, optionName);
yield value;
}
};
var validateIterableValue = (value, optionName) => {
if (!isSerializableInput(value)) {
throwOnSerializableInput(optionName, value);
}
};
var readableFromChunk = (chunk) => Readable2.from(chunk.length === 0 ? [] : [chunk]);
var generatorToInputStream = (stdioItem, { encoding }) => generatorToStream(stdioItem, { encoding: getInputEncoding(encoding) });
var addPropertiesAsync = {
input: {
...addProperties2,
generator: generatorToInputStream,
asyncGenerator: generatorToInputStream,
fileUrl: ({ value }) => ({ stream: createReadStream(value) }),
filePath: ({ value: { file } }) => ({ stream: createReadStream(file) }),
webStream: ({ value }, options, objectMode) => ({ stream: Readable2.fromWeb(value, { objectMode }) }),
iterable: ({ value, optionName }, options, objectMode) => ({ stream: Readable2.from(objectMode ? value : validateIterable(value, optionName)) }),
asyncIterable: ({ value, optionName }, options, objectMode) => ({ stream: Readable2.from(objectMode ? value : validateAsyncIterable(value, optionName)) }),
string: ({ value }) => ({ stream: readableFromChunk(value) }),
uint8Array: ({ value }) => ({ stream: readableFromChunk(Buffer6.from(value)) })
},
output: {
...addProperties2,
fileUrl: ({ value }) => ({ stream: createWriteStream(value) }),
filePath: ({ value: { file, append } }) => ({ stream: createWriteStream(file, append ? { flags: "a" } : {}) }),
// Web writers accept arbitrary chunks, including when a shared writer receives both bytes and objects.
webStream: ({ value }) => ({ stream: Writable2.fromWeb(value, { objectMode: true }) }),
iterable: forbiddenIfAsync,
asyncIterable: forbiddenIfAsync,
string: forbiddenIfAsync,
uint8Array: forbiddenIfAsync
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/output-async.js
init_esm_shims();
// node_modules/.pnpm/@sindresorhus+merge-streams@4.0.0/node_modules/@sindresorhus/merge-streams/index.js
init_esm_shims();
import { on as on4, once as once7 } from "events";
import { PassThrough as PassThroughStream, getDefaultHighWaterMark as getDefaultHighWaterMark2 } from "stream";
import { finished as finished2 } from "stream/promises";
function mergeStreams(streams) {
if (!Array.isArray(streams)) {
throw new TypeError(`Expected an array, got \`${typeof streams}\`.`);
}
for (const stream of streams) {
validateStream(stream);
}
const objectMode = streams.some(({ readableObjectMode }) => readableObjectMode);
const highWaterMark = getHighWaterMark(streams, objectMode);
const passThroughStream = new MergedStream({
objectMode,
writableHighWaterMark: highWaterMark,
readableHighWaterMark: highWaterMark
});
for (const stream of streams) {
passThroughStream.add(stream);
}
return passThroughStream;
}
var getHighWaterMark = (streams, objectMode) => {
if (streams.length === 0) {
return getDefaultHighWaterMark2(objectMode);
}
const highWaterMarks = streams.filter(({ readableObjectMode }) => readableObjectMode === objectMode).map(({ readableHighWaterMark }) => readableHighWaterMark);
return Math.max(...highWaterMarks);
};
var MergedStream = class extends PassThroughStream {
#streams = /* @__PURE__ */ new Set([]);
#ended = /* @__PURE__ */ new Set([]);
#aborted = /* @__PURE__ */ new Set([]);
#onFinished;
#unpipeEvent = /* @__PURE__ */ Symbol("unpipe");
#streamPromises = /* @__PURE__ */ new WeakMap();
add(stream) {
validateStream(stream);
if (this.#streams.has(stream)) {
return;
}
this.#streams.add(stream);
this.#onFinished ??= onMergedStreamFinished(this, this.#streams, this.#unpipeEvent);
const streamPromise = endWhenStreamsDone({
passThroughStream: this,
stream,
streams: this.#streams,
ended: this.#ended,
aborted: this.#aborted,
onFinished: this.#onFinished,
unpipeEvent: this.#unpipeEvent
});
this.#streamPromises.set(stream, streamPromise);
stream.pipe(this, { end: false });
}
async remove(stream) {
validateStream(stream);
if (!this.#streams.has(stream)) {
return false;
}
const streamPromise = this.#streamPromises.get(stream);
if (streamPromise === void 0) {
return false;
}
this.#streamPromises.delete(stream);
stream.unpipe(this);
await streamPromise;
return true;
}
};
var onMergedStreamFinished = async (passThroughStream, streams, unpipeEvent) => {
updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_COUNT);
const controller = new AbortController();
try {
await Promise.race([
onMergedStreamEnd(passThroughStream, controller),
onInputStreamsUnpipe(passThroughStream, streams, unpipeEvent, controller)
]);
} finally {
controller.abort();
updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_COUNT);
}
};
var onMergedStreamEnd = async (passThroughStream, { signal }) => {
try {
await finished2(passThroughStream, { signal, cleanup: true });
} catch (error) {
errorOrAbortStream(passThroughStream, error);
throw error;
}
};
var onInputStreamsUnpipe = async (passThroughStream, streams, unpipeEvent, { signal }) => {
for await (const [unpipedStream] of on4(passThroughStream, "unpipe", { signal })) {
if (streams.has(unpipedStream)) {
unpipedStream.emit(unpipeEvent);
}
}
};
var validateStream = (stream) => {
if (typeof stream?.pipe !== "function") {
throw new TypeError(`Expected a readable stream, got: \`${typeof stream}\`.`);
}
};
var endWhenStreamsDone = async ({ passThroughStream, stream, streams, ended, aborted: aborted2, onFinished, unpipeEvent }) => {
updateMaxListeners(passThroughStream, PASSTHROUGH_LISTENERS_PER_STREAM);
const controller = new AbortController();
try {
await Promise.race([
afterMergedStreamFinished(onFinished, stream, controller),
onInputStreamEnd({
passThroughStream,
stream,
streams,
ended,
aborted: aborted2,
controller
}),
onInputStreamUnpipe({
stream,
streams,
ended,
aborted: aborted2,
unpipeEvent,
controller
})
]);
} finally {
controller.abort();
updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_PER_STREAM);
}
if (streams.size > 0 && streams.size === ended.size + aborted2.size) {
if (ended.size === 0 && aborted2.size > 0) {
abortStream(passThroughStream);
} else {
endStream(passThroughStream);
}
}
};
var afterMergedStreamFinished = async (onFinished, stream, { signal }) => {
try {
await onFinished;
if (!signal.aborted) {
abortStream(stream);
}
} catch (error) {
if (!signal.aborted) {
errorOrAbortStream(stream, error);
}
}
};
var onInputStreamEnd = async ({ passThroughStream, stream, streams, ended, aborted: aborted2, controller: { signal } }) => {
try {
await finished2(stream, {
signal,
cleanup: true,
readable: true,
writable: false
});
if (streams.has(stream)) {
ended.add(stream);
}
} catch (error) {
if (signal.aborted || !streams.has(stream)) {
return;
}
if (isAbortError(error)) {
aborted2.add(stream);
} else {
errorStream(passThroughStream, error);
}
}
};
var onInputStreamUnpipe = async ({ stream, streams, ended, aborted: aborted2, unpipeEvent, controller: { signal } }) => {
await once7(stream, unpipeEvent, { signal });
if (!stream.readable) {
return once7(signal, "abort", { signal });
}
streams.delete(stream);
ended.delete(stream);
aborted2.delete(stream);
};
var endStream = (stream) => {
if (stream.writable) {
stream.end();
}
};
var errorOrAbortStream = (stream, error) => {
if (isAbortError(error)) {
abortStream(stream);
} else {
errorStream(stream, error);
}
};
var isAbortError = (error) => error?.code === "ERR_STREAM_PREMATURE_CLOSE";
var abortStream = (stream) => {
if (stream.readable || stream.writable) {
stream.destroy();
}
};
var errorStream = (stream, error) => {
if (!stream.destroyed) {
stream.once("error", noop2);
stream.destroy(error);
}
};
var noop2 = () => {
};
var updateMaxListeners = (passThroughStream, increment2) => {
const maxListeners = passThroughStream.getMaxListeners();
if (maxListeners !== 0 && maxListeners !== Number.POSITIVE_INFINITY) {
passThroughStream.setMaxListeners(maxListeners + increment2);
}
};
var PASSTHROUGH_LISTENERS_COUNT = 2;
var PASSTHROUGH_LISTENERS_PER_STREAM = 1;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/pipeline.js
init_esm_shims();
import { finished as finished3 } from "stream/promises";
var pipeStreams = (source, destination, onDestinationEnd) => {
source.pipe(destination);
onSourceFinish(source, destination);
onDestinationFinish(source, destination, onDestinationEnd);
};
var onSourceFinish = async (source, destination) => {
if (isStandardStream(source) || isStandardStream(destination)) {
return;
}
try {
await finished3(source, { cleanup: true, readable: true, writable: false });
} catch {
}
endDestinationStream(destination);
};
var endDestinationStream = (destination) => {
if (destination.writable) {
destination.end();
}
};
var onDestinationFinish = async (source, destination, onDestinationEnd) => {
if (isStandardStream(source) || isStandardStream(destination)) {
return;
}
try {
await finished3(destination, { cleanup: true, readable: false, writable: true });
} catch {
}
if (onDestinationEnd !== void 0) {
await onDestinationEnd();
}
abortSourceStream(source);
};
var abortSourceStream = (source) => {
if (source.readable) {
source.destroy();
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/output-async.js
var pipeOutputAsync = (subprocess, fileDescriptors, controller) => {
const pipeGroups = /* @__PURE__ */ new Map();
for (const [fdNumber, { stdioItems, direction }] of Object.entries(fileDescriptors)) {
const transformItems = stdioItems.filter(({ type }) => TRANSFORM_TYPES.has(type));
for (const { stream } of transformItems) {
pipeTransform(subprocess, stream, direction, fdNumber);
}
const nonTransformItems = stdioItems.filter(({ type }) => !TRANSFORM_TYPES.has(type));
for (const { stream } of nonTransformItems) {
pipeStdioItem({
subprocess,
stream,
direction,
fdNumber,
pipeGroups,
controller
});
}
}
for (const [outputStream, inputStreams] of pipeGroups) {
const inputStream = inputStreams.length === 1 ? inputStreams[0] : mergeStreams(inputStreams);
pipeStreams(inputStream, outputStream);
}
};
var pipeTransform = (subprocess, stream, direction, fdNumber) => {
if (direction === "output") {
pipeStreams(subprocess.stdio[fdNumber], stream);
} else {
pipeStreams(stream, subprocess.stdio[fdNumber]);
}
const streamProperty = SUBPROCESS_STREAM_PROPERTIES[fdNumber];
if (streamProperty !== void 0) {
subprocess[streamProperty] = stream;
}
subprocess.stdio[fdNumber] = stream;
};
var SUBPROCESS_STREAM_PROPERTIES = ["stdin", "stdout", "stderr"];
var pipeStdioItem = ({ subprocess, stream, direction, fdNumber, pipeGroups, controller }) => {
if (stream === void 0) {
return;
}
setStandardStreamMaxListeners(stream, controller);
const [inputStream, outputStream] = direction === "output" ? [stream, subprocess.stdio[fdNumber]] : [subprocess.stdio[fdNumber], stream];
const outputStreams = pipeGroups.get(inputStream) ?? [];
pipeGroups.set(inputStream, [...outputStreams, outputStream]);
};
var setStandardStreamMaxListeners = (stream, { signal }) => {
if (isStandardStream(stream)) {
incrementMaxListeners(stream, MAX_LISTENERS_INCREMENT, signal);
}
};
var MAX_LISTENERS_INCREMENT = 2;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/kill-descendants.js
init_esm_shims();
import process12 from "process";
import { execFile } from "child_process";
import path9 from "path/win32";
var isWindows2 = process12.platform === "win32";
var getSpawnOptions = (options) => !isWindows2 && options.killDescendants ? { ...options, detached: true } : options;
var getKillFunction = (subprocess, { killDescendants }) => {
if (!killDescendants) {
const killSubprocess = subprocess.kill.bind(subprocess);
return (...arguments_) => subprocess.pid === void 0 ? false : killSubprocess(...arguments_);
}
const killDescendantsFunction = isWindows2 ? killDescendantsWindows : killDescendantsUnix;
return killDescendantsFunction.bind(void 0, subprocess);
};
var isAbandoned = (subprocess) => subprocess.pid === void 0 || isWindows2 && hasExited(subprocess);
var hasExited = ({ exitCode, signalCode }) => exitCode !== null || signalCode !== null;
var killDescendantsUnix = (subprocess, signal) => {
if (isAbandoned(subprocess)) {
return false;
}
try {
return process12.kill(-subprocess.pid, signal);
} catch {
return subprocess.kill(signal);
}
};
var killDescendantsWindows = (subprocess, signal) => {
if (isAbandoned(subprocess)) {
return false;
}
const taskkillFile = getTaskkillFile();
if (taskkillFile === void 0) {
return subprocess.kill(signal);
}
execFile(taskkillFile, ["/pid", `${subprocess.pid}`, "/T", "/F"], (error) => {
if (error) {
subprocess.kill(signal);
}
});
return true;
};
var getTaskkillFile = () => {
const windowsDirectory = [process12.env.SystemRoot, process12.env.windir].find((directory) => directory && isWindowsDriveAbsolutePath(directory));
return windowsDirectory === void 0 ? void 0 : path9.join(windowsDirectory, "System32", "taskkill.exe");
};
var isWindowsDriveAbsolutePath = (directory) => {
const { root } = path9.parse(directory);
return /^[a-z]:[/\\]/i.test(root);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/cleanup.js
init_esm_shims();
import { addAbortListener as addAbortListener2 } from "events";
// node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
init_esm_shims();
// node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/signals.js
init_esm_shims();
var signals = [];
signals.push("SIGHUP", "SIGINT", "SIGTERM");
if (process.platform !== "win32") {
signals.push(
"SIGALRM",
"SIGABRT",
"SIGVTALRM",
"SIGXCPU",
"SIGXFSZ",
"SIGUSR2",
"SIGTRAP",
"SIGSYS",
"SIGQUIT",
"SIGIOT"
// should detect profiler and enable/disable accordingly.
// see #21
// 'SIGPROF'
);
}
if (process.platform === "linux") {
signals.push("SIGIO", "SIGPOLL", "SIGPWR", "SIGSTKFLT");
}
// node_modules/.pnpm/signal-exit@4.1.0/node_modules/signal-exit/dist/mjs/index.js
var processOk = (process14) => !!process14 && typeof process14 === "object" && typeof process14.removeListener === "function" && typeof process14.emit === "function" && typeof process14.reallyExit === "function" && typeof process14.listeners === "function" && typeof process14.kill === "function" && typeof process14.pid === "number" && typeof process14.on === "function";
var kExitEmitter = /* @__PURE__ */ Symbol.for("signal-exit emitter");
var global = globalThis;
var ObjectDefineProperty = Object.defineProperty.bind(Object);
var Emitter = class {
emitted = {
afterExit: false,
exit: false
};
listeners = {
afterExit: [],
exit: []
};
count = 0;
id = Math.random();
constructor() {
if (global[kExitEmitter]) {
return global[kExitEmitter];
}
ObjectDefineProperty(global, kExitEmitter, {
value: this,
writable: false,
enumerable: false,
configurable: false
});
}
on(ev, fn) {
this.listeners[ev].push(fn);
}
removeListener(ev, fn) {
const list = this.listeners[ev];
const i2 = list.indexOf(fn);
if (i2 === -1) {
return;
}
if (i2 === 0 && list.length === 1) {
list.length = 0;
} else {
list.splice(i2, 1);
}
}
emit(ev, code, signal) {
if (this.emitted[ev]) {
return false;
}
this.emitted[ev] = true;
let ret = false;
for (const fn of this.listeners[ev]) {
ret = fn(code, signal) === true || ret;
}
if (ev === "exit") {
ret = this.emit("afterExit", code, signal) || ret;
}
return ret;
}
};
var SignalExitBase = class {
};
var signalExitWrap = (handler) => {
return {
onExit(cb, opts) {
return handler.onExit(cb, opts);
},
load() {
return handler.load();
},
unload() {
return handler.unload();
}
};
};
var SignalExitFallback = class extends SignalExitBase {
onExit() {
return () => {
};
}
load() {
}
unload() {
}
};
var SignalExit = class extends SignalExitBase {
// "SIGHUP" throws an `ENOSYS` error on Windows,
// so use a supported signal instead
/* c8 ignore start */
#hupSig = process13.platform === "win32" ? "SIGINT" : "SIGHUP";
/* c8 ignore stop */
#emitter = new Emitter();
#process;
#originalProcessEmit;
#originalProcessReallyExit;
#sigListeners = {};
#loaded = false;
constructor(process14) {
super();
this.#process = process14;
this.#sigListeners = {};
for (const sig of signals) {
this.#sigListeners[sig] = () => {
const listeners = this.#process.listeners(sig);
let { count: count2 } = this.#emitter;
const p = process14;
if (typeof p.__signal_exit_emitter__ === "object" && typeof p.__signal_exit_emitter__.count === "number") {
count2 += p.__signal_exit_emitter__.count;
}
if (listeners.length === count2) {
this.unload();
const ret = this.#emitter.emit("exit", null, sig);
const s = sig === "SIGHUP" ? this.#hupSig : sig;
if (!ret)
process14.kill(process14.pid, s);
}
};
}
this.#originalProcessReallyExit = process14.reallyExit;
this.#originalProcessEmit = process14.emit;
}
onExit(cb, opts) {
if (!processOk(this.#process)) {
return () => {
};
}
if (this.#loaded === false) {
this.load();
}
const ev = opts?.alwaysLast ? "afterExit" : "exit";
this.#emitter.on(ev, cb);
return () => {
this.#emitter.removeListener(ev, cb);
if (this.#emitter.listeners["exit"].length === 0 && this.#emitter.listeners["afterExit"].length === 0) {
this.unload();
}
};
}
load() {
if (this.#loaded) {
return;
}
this.#loaded = true;
this.#emitter.count += 1;
for (const sig of signals) {
try {
const fn = this.#sigListeners[sig];
if (fn)
this.#process.on(sig, fn);
} catch (_) {
}
}
this.#process.emit = (ev, ...a2) => {
return this.#processEmit(ev, ...a2);
};
this.#process.reallyExit = (code) => {
return this.#processReallyExit(code);
};
}
unload() {
if (!this.#loaded) {
return;
}
this.#loaded = false;
signals.forEach((sig) => {
const listener = this.#sigListeners[sig];
if (!listener) {
throw new Error("Listener not defined for signal: " + sig);
}
try {
this.#process.removeListener(sig, listener);
} catch (_) {
}
});
this.#process.emit = this.#originalProcessEmit;
this.#process.reallyExit = this.#originalProcessReallyExit;
this.#emitter.count -= 1;
}
#processReallyExit(code) {
if (!processOk(this.#process)) {
return 0;
}
this.#process.exitCode = code || 0;
this.#emitter.emit("exit", this.#process.exitCode, null);
return this.#originalProcessReallyExit.call(this.#process, this.#process.exitCode);
}
#processEmit(ev, ...args) {
const og = this.#originalProcessEmit;
if (ev === "exit" && processOk(this.#process)) {
if (typeof args[0] === "number") {
this.#process.exitCode = args[0];
}
const ret = og.call(this.#process, ev, ...args);
this.#emitter.emit("exit", this.#process.exitCode, null);
return ret;
} else {
return og.call(this.#process, ev, ...args);
}
}
};
var process13 = globalThis.process;
var {
/**
* Called when the process is exiting, whether via signal, explicit
* exit, or running out of stuff to do.
*
* If the global process object is not suitable for instrumentation,
* then this will be a no-op.
*
* Returns a function that may be used to unload signal-exit.
*/
onExit,
/**
* Load the listeners. Likely you never need to call this, unless
* doing a rather deep integration with signal-exit functionality.
* Mostly exposed for the benefit of testing.
*
* @internal
*/
load,
/**
* Unload the listeners. Likely you never need to call this, unless
* doing a rather deep integration with signal-exit functionality.
* Mostly exposed for the benefit of testing.
*
* @internal
*/
unload
} = signalExitWrap(processOk(process13) ? new SignalExit(process13) : new SignalExitFallback());
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/terminate/cleanup.js
var cleanupOnExit = (kill, { cleanup, detached }, { signal }) => {
if (!cleanup || detached) {
return;
}
const removeExitHandler = onExit(() => {
kill();
});
addAbortListener2(signal, () => {
removeExitHandler();
});
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/pipe/setup.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/concurrent.js
init_esm_shims();
var initializeConcurrentStreams = () => ({
readableDestroy: /* @__PURE__ */ new WeakMap(),
writableFinal: /* @__PURE__ */ new WeakMap(),
writableDestroy: /* @__PURE__ */ new WeakMap()
});
var addConcurrentStream = (concurrentStreams, stream, waitName) => {
const weakMap = concurrentStreams[waitName];
if (!weakMap.has(stream)) {
weakMap.set(stream, []);
}
const promises = weakMap.get(stream);
const promise = createDeferred();
promises.push(promise);
const resolve = promise.resolve.bind(promise);
return { resolve, promises };
};
var waitForConcurrentStreams = async ({ resolve, promises }, subprocess) => {
resolve();
const [isSubprocessExit] = await Promise.race([
Promise.allSettled([true, subprocess]),
Promise.all([false, ...promises])
]);
return !isSubprocessExit;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/iterable.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/iterate.js
init_esm_shims();
import { on as on5 } from "events";
import { getDefaultHighWaterMark as getDefaultHighWaterMark3 } from "stream";
var iterateOnSubprocessStream = ({ subprocessStdout, subprocess, binary, shouldEncode, encoding, preserveNewlines }) => {
const controller = new AbortController();
stopReadingOnExit(subprocess, controller);
return iterateOnStream({
stream: subprocessStdout,
controller,
binary,
shouldEncode: !subprocessStdout.readableObjectMode && shouldEncode,
encoding,
shouldSplit: !subprocessStdout.readableObjectMode,
preserveNewlines
});
};
var stopReadingOnExit = async (subprocess, controller) => {
try {
await subprocess;
} catch {
} finally {
controller.abort();
}
};
var iterateForResult = ({ stream, onStreamEnd, lines, encoding, stripFinalNewline: stripFinalNewline2, allMixed }) => {
const controller = new AbortController();
stopReadingOnStreamEnd(onStreamEnd, controller, stream);
const objectMode = stream.readableObjectMode && !allMixed;
return iterateOnStream({
stream,
controller,
binary: encoding === "buffer",
shouldEncode: !objectMode,
encoding,
shouldSplit: !objectMode && lines,
preserveNewlines: !stripFinalNewline2
});
};
var stopReadingOnStreamEnd = async (onStreamEnd, controller, stream) => {
try {
await onStreamEnd;
} catch {
stream.destroy();
} finally {
controller.abort();
}
};
var iterateOnStream = ({ stream, controller, binary, shouldEncode, encoding, shouldSplit, preserveNewlines }) => {
const onStdoutChunk = on5(stream, "data", {
signal: controller.signal,
highWaterMark: HIGH_WATER_MARK,
// Backward compatibility with older name for this option
// See https://github.com/nodejs/node/pull/52080#discussion_r1525227861
// @todo Remove after removing support for Node 21
highWatermark: HIGH_WATER_MARK
});
return iterateOnData({
onStdoutChunk,
controller,
binary,
shouldEncode,
encoding,
shouldSplit,
preserveNewlines
});
};
var DEFAULT_OBJECT_HIGH_WATER_MARK = getDefaultHighWaterMark3(true);
var HIGH_WATER_MARK = DEFAULT_OBJECT_HIGH_WATER_MARK;
var iterateOnData = async function* ({ onStdoutChunk, controller, binary, shouldEncode, encoding, shouldSplit, preserveNewlines }) {
const generators = getGenerators({
binary,
shouldEncode,
encoding,
shouldSplit,
preserveNewlines
});
try {
for await (const [chunk] of onStdoutChunk) {
yield* transformChunkSync(chunk, generators, 0);
}
} catch (error) {
if (!controller.signal.aborted) {
throw error;
}
} finally {
yield* finalChunksSync(generators);
}
};
var getGenerators = ({ binary, shouldEncode, encoding, shouldSplit, preserveNewlines }) => [
getEncodingTransformGenerator(binary, encoding, !shouldEncode),
getSplitLinesGenerator(binary, preserveNewlines, !shouldSplit, {})
].filter(Boolean);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/iterable.js
var createIterable = (subprocess, encoding, options) => {
const { from, binary: binaryOption = false, preserveNewlines = false } = copyOptions(options);
checkBooleanOption(binaryOption, "binary");
checkBooleanOption(preserveNewlines, "preserveNewlines");
const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
const subprocessStdout = getFromStream(subprocess, from);
const onStdoutData = iterateOnSubprocessStream({
subprocessStdout,
subprocess,
binary,
shouldEncode: true,
encoding,
preserveNewlines
});
return iterateOnStdoutData(onStdoutData, subprocessStdout, subprocess);
};
var iterateOnStdoutData = async function* (onStdoutData, subprocessStdout, subprocess) {
try {
yield* onStdoutData;
} finally {
if (subprocessStdout.readable) {
subprocessStdout.destroy();
}
await subprocess;
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/readable.js
init_esm_shims();
import { Readable as Readable3 } from "stream";
import { callbackify as callbackify3 } from "util";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/shared.js
init_esm_shims();
import { finished as finished5 } from "stream/promises";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/wait-stream.js
init_esm_shims();
import { finished as finished4 } from "stream/promises";
var waitForStream = async (stream, fdNumber, streamInfo, {
isSameDirection,
stopOnExit = false,
readable = true,
writable = true
} = {}) => {
const state = handleStdinDestroy(stream, streamInfo);
const abortController = new AbortController();
try {
await Promise.race([
...stopOnExit ? [streamInfo.exitPromise] : [],
finished4(stream, {
cleanup: true,
signal: abortController.signal,
readable,
writable
})
]);
} catch (error) {
if (!state.stdinCleanedUp && !isInputTransformAbort(stream, fdNumber, streamInfo, error)) {
handleStreamError(error, fdNumber, streamInfo, isSameDirection);
}
} finally {
abortController.abort();
}
};
var handleStdinDestroy = (stream, { originalStreams, subprocess }) => {
const [originalStdin] = originalStreams;
const state = { stdinCleanedUp: false };
if (stream === originalStdin || stream === subprocess.stdin) {
spyOnStdinDestroy(stream, subprocess, state);
}
return state;
};
var spyOnStdinDestroy = (subprocessStdin, subprocess, state) => {
const { _destroy } = subprocessStdin;
subprocessStdin._destroy = (...destroyArguments) => {
setStdinCleanedUp(subprocess, state);
_destroy.call(subprocessStdin, ...destroyArguments);
};
};
var setStdinCleanedUp = ({ exitCode, signalCode }, state) => {
if (exitCode !== null || signalCode !== null) {
state.stdinCleanedUp = true;
}
};
var isInputTransformAbort = (stream, fdNumber, streamInfo, error) => {
const originalStream = streamInfo.originalStreams[fdNumber];
return stream !== originalStream && isInputFileDescriptor(streamInfo, fdNumber) && originalStream?.destroyed === true && (isStreamAbort(error) || error?.code === "ABORT_ERR");
};
var handleStreamError = (error, fdNumber, streamInfo, isSameDirection) => {
if (!shouldIgnoreStreamError(error, fdNumber, streamInfo, isSameDirection)) {
throw error;
}
};
var shouldIgnoreStreamError = (error, fdNumber, streamInfo, isSameDirection = true) => {
if (streamInfo.propagating) {
return isStreamEpipe(error) || isStreamAbort(error);
}
streamInfo.propagating = true;
return isInputFileDescriptor(streamInfo, fdNumber) === isSameDirection ? isStreamEpipe(error) : isStreamAbort(error);
};
var isInputFileDescriptor = ({ fileDescriptors }, fdNumber) => fdNumber !== "all" && fileDescriptors[fdNumber].direction === "input";
var isStreamAbort = (error) => error?.code === "ERR_STREAM_PREMATURE_CLOSE";
var isStreamEpipe = (error) => error?.code === "EPIPE";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/shared.js
var safeWaitForSubprocessStdin = async (subprocessStdin) => {
if (subprocessStdin === void 0) {
return;
}
try {
await waitForSubprocessStdin(subprocessStdin);
} catch {
}
};
var safeWaitForSubprocessStdout = async (subprocessStdout) => {
if (subprocessStdout === void 0) {
return;
}
try {
await waitForSubprocessStdout(subprocessStdout);
} catch {
}
};
var waitForSubprocessStdin = async (subprocessStdin) => {
await finished5(subprocessStdin, { cleanup: true, readable: false, writable: true });
};
var waitForSubprocessStdout = async (subprocessStdout) => {
await finished5(subprocessStdout, { cleanup: true, readable: true, writable: false });
};
var throwDestroyError = (error) => {
if (error) {
throw error;
}
};
var destroyOtherStream = (stream, isOpen, error) => {
if (error && !isStreamAbort(error)) {
stream.destroy(error);
} else if (isOpen) {
stream.destroy();
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/readable.js
var createReadable = ({ subprocess, concurrentStreams, encoding }, options) => {
const { from, binary: binaryOption = true, preserveNewlines = true } = copyOptions(options);
checkBooleanOption(binaryOption, "binary");
checkBooleanOption(preserveNewlines, "preserveNewlines");
const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
const subprocessStdout = getFromStream(subprocess, from);
const waitReadableDestroy = addConcurrentStream(concurrentStreams, subprocessStdout, "readableDestroy");
const { readableEncoding, readableObjectMode, readableHighWaterMark } = getReadableOptions(subprocessStdout, binary);
const { read, onStdoutDataDone } = getReadableMethods({
subprocessStdout,
subprocess,
binary,
encoding,
preserveNewlines
});
const readable = new Readable3({
read,
destroy: callbackify3(onReadableDestroy.bind(void 0, { subprocessStdout, subprocess, waitReadableDestroy })),
highWaterMark: readableHighWaterMark,
objectMode: readableObjectMode,
encoding: readableEncoding
});
onStdoutFinished({
subprocessStdout,
onStdoutDataDone,
readable,
subprocess
});
return readable;
};
var getReadableOptions = ({ readableEncoding, readableObjectMode, readableHighWaterMark }, binary) => binary ? { readableEncoding, readableObjectMode, readableHighWaterMark } : { readableEncoding, readableObjectMode: true, readableHighWaterMark: DEFAULT_OBJECT_HIGH_WATER_MARK };
var getReadableMethods = ({ subprocessStdout, subprocess, binary, encoding, preserveNewlines }) => {
const onStdoutDataDone = createDeferred();
const onStdoutData = iterateOnSubprocessStream({
subprocessStdout,
subprocess,
binary,
shouldEncode: !binary,
encoding,
preserveNewlines
});
return {
read() {
onRead(this, onStdoutData, onStdoutDataDone);
},
onStdoutDataDone
};
};
var onRead = async (readable, onStdoutData, onStdoutDataDone) => {
try {
const { value, done } = await onStdoutData.next();
if (done) {
onStdoutDataDone.resolve();
} else {
readable.push(value);
}
} catch {
}
};
var onStdoutFinished = async ({ subprocessStdout, onStdoutDataDone, readable, subprocess, subprocessStdin }) => {
try {
await waitForSubprocessStdout(subprocessStdout);
await subprocess;
await safeWaitForSubprocessStdin(subprocessStdin);
await onStdoutDataDone;
if (readable.readable) {
readable.push(null);
}
} catch (error) {
await safeWaitForSubprocessStdin(subprocessStdin);
destroyOtherReadable(readable, await getPrematureCloseError(subprocess, error));
}
};
var getPrematureCloseError = async (subprocess, error) => {
if (error.code !== "ERR_STREAM_PREMATURE_CLOSE") {
return error;
}
try {
await subprocess;
} catch (subprocessError) {
return subprocessError;
}
return error;
};
var onReadableDestroy = async ({ subprocessStdout, subprocess, waitReadableDestroy }, error) => {
if (await waitForConcurrentStreams(waitReadableDestroy, subprocess)) {
destroyOtherReadable(subprocessStdout, error?.code === "ABORT_ERR" ? void 0 : error);
await subprocess;
}
throwDestroyError(error);
};
var destroyOtherReadable = (stream, error) => {
destroyOtherStream(stream, stream.readable, error);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/web.js
init_esm_shims();
import { Readable as Readable4, Writable as Writable3, Duplex as Duplex3 } from "stream";
var createReadableStream = (subprocess, readableOptions) => Readable4.toWeb(subprocess.readable(readableOptions));
var createWritableStream = (subprocess, writableOptions) => Writable3.toWeb(subprocess.writable(writableOptions));
var createTransformStream = (subprocess, duplexOptions) => Duplex3.toWeb(subprocess.duplex(duplexOptions));
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/pipe/pipe-arguments.js
init_esm_shims();
var normalizePipeArguments = ({ source, sourcePromise, boundOptions, createNested }, ...pipeArguments) => {
const startTime = getStartTime();
const {
destination,
destinationStream,
destinationError,
from,
unpipeSignal
} = getDestinationStream(boundOptions, createNested, pipeArguments);
const { sourceStream, sourceError } = getSourceStream(source, from);
const { options: sourceOptions, fileDescriptors } = SUBPROCESS_OPTIONS.get(source);
return {
source,
sourcePromise,
sourceStream,
sourceOptions,
sourceError,
destination,
destinationStream,
destinationError,
unpipeSignal,
fileDescriptors,
startTime
};
};
var getDestinationStream = (boundOptions, createNested, pipeArguments) => {
let destinationInfo;
try {
destinationInfo = getDestination(boundOptions, createNested, ...pipeArguments);
} catch (error) {
return { destinationError: error };
}
const { destination, pipeOptions } = destinationInfo;
try {
const { from, to, unpipeSignal } = copyOptions(pipeOptions);
validateAbortSignal(unpipeSignal, "unpipeSignal");
const destinationStream = getToStream(destination, to);
return {
destination,
destinationStream,
from,
unpipeSignal
};
} catch (error) {
abortDestination(destination, pipeArguments[0]);
return { destinationError: error };
}
};
var abortDestination = (destination, firstArgument) => {
if (destination !== firstArgument) {
destination.kill();
}
destination.catch(() => {
});
};
var getDestination = (boundOptions, createNested, firstArgument, ...pipeArguments) => {
if (Array.isArray(firstArgument)) {
const destination = createNested(mapDestinationArguments, boundOptions)(firstArgument, ...pipeArguments);
return { destination, pipeOptions: boundOptions };
}
if (typeof firstArgument === "string" || firstArgument instanceof URL || isDenoExecPath(firstArgument)) {
if (Object.keys(boundOptions).length > 0) {
throw new TypeError('Please use .pipe("file", ..., options) or .pipe(execa("file", ..., options)) instead of .pipe(options)("file", ...).');
}
const [rawFile, rawArguments, rawOptions] = normalizeParameters(firstArgument, ...pipeArguments);
const destination = createNested(mapDestinationArguments)(rawFile, rawArguments, rawOptions);
return { destination, pipeOptions: rawOptions };
}
if (SUBPROCESS_OPTIONS.has(firstArgument)) {
if (Object.keys(boundOptions).length > 0) {
throw new TypeError("Please use .pipe(options)`command` or .pipe($(options)`command`) instead of .pipe(options)($`command`).");
}
return { destination: firstArgument, pipeOptions: pipeArguments[0] };
}
throw new TypeError(`The first argument must be a template string, an options object, or an Execa subprocess: ${firstArgument}`);
};
var mapDestinationArguments = ({ options }) => ({
options: {
__proto__: null,
...options,
// Piping writes to the destination's `stdin`, which is forced even if the user set another value.
// However, `stdin` cannot be combined with `stdio`, which is needed for `to: 'fd3'` and higher.
...options.stdio === void 0 && { stdin: "pipe" },
piped: true
}
});
var getSourceStream = (source, from) => {
try {
const sourceStream = getFromStream(source, from);
return { sourceStream };
} catch (error) {
return { sourceError: error };
}
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/pipe/throw.js
init_esm_shims();
var handlePipeArgumentsError = ({
sourceStream,
sourceError,
destinationStream,
destinationError,
fileDescriptors,
sourceOptions,
startTime
}) => {
const error = getPipeArgumentsError({
sourceStream,
sourceError,
destinationStream,
destinationError
});
if (error !== void 0) {
throw createNonCommandError({
error,
fileDescriptors,
sourceOptions,
startTime
});
}
};
var getPipeArgumentsError = ({ sourceStream, sourceError, destinationStream, destinationError }) => {
if (sourceError !== void 0 && destinationError !== void 0) {
return destinationError;
}
if (destinationError !== void 0) {
abortSourceStream(sourceStream);
return destinationError;
}
if (sourceError === void 0) {
return;
}
endDestinationStream(destinationStream);
return sourceError;
};
var createNonCommandError = ({ error, fileDescriptors, sourceOptions, startTime }) => makeEarlyError({
error,
command: PIPE_COMMAND_MESSAGE,
escapedCommand: PIPE_COMMAND_MESSAGE,
fileDescriptors,
options: sourceOptions,
startTime,
isSync: false
});
var PIPE_COMMAND_MESSAGE = "source.pipe(destination)";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/pipe/sequence.js
init_esm_shims();
var waitForBothSubprocesses = async (subprocessPromises) => {
const [
{ status: sourceStatus, reason: sourceReason, value: sourceResult = sourceReason },
{ status: destinationStatus, reason: destinationReason, value: destinationResult = destinationReason },
{ reason: pipedFromReason, value: pipedFromResult = pipedFromReason }
] = await subprocessPromises;
if (!destinationResult.pipedFrom.includes(pipedFromResult)) {
destinationResult.pipedFrom.push(pipedFromResult);
}
if (destinationStatus === "rejected") {
throw destinationResult;
}
if (sourceStatus === "rejected") {
throw sourceResult;
}
return destinationResult;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/pipe/streaming.js
init_esm_shims();
import { finished as finished6 } from "stream/promises";
var pipeSubprocessStream = (sourceStream, destinationStream, maxListenersController) => {
const mergedStream = MERGED_STREAMS.has(destinationStream) ? pipeMoreSubprocessStream(sourceStream, destinationStream) : pipeFirstSubprocessStream(sourceStream, destinationStream);
incrementMaxListeners(sourceStream, SOURCE_LISTENERS_PER_PIPE, maxListenersController.signal);
incrementMaxListeners(destinationStream, DESTINATION_LISTENERS_PER_PIPE, maxListenersController.signal);
cleanupMergedStreamsMap(destinationStream);
return mergedStream;
};
var pipeFirstSubprocessStream = (sourceStream, destinationStream) => {
const mergedStream = mergeStreams([sourceStream]);
addMergeSource(mergedStream, sourceStream);
pipeStreams(mergedStream, destinationStream, () => unpipeSourcesOnDestinationEnd(mergedStream));
MERGED_STREAMS.set(destinationStream, mergedStream);
return mergedStream;
};
var pipeMoreSubprocessStream = (sourceStream, destinationStream) => {
const mergedStream = MERGED_STREAMS.get(destinationStream);
mergedStream.add(sourceStream);
addMergeSource(mergedStream, sourceStream);
return mergedStream;
};
var MERGE_SOURCES = /* @__PURE__ */ new WeakMap();
var SOURCE_MERGES = /* @__PURE__ */ new WeakMap();
var addMergeSource = (mergedStream, sourceStream) => {
addToSetMap(MERGE_SOURCES, mergedStream, sourceStream);
addToSetMap(SOURCE_MERGES, sourceStream, mergedStream);
};
var addToSetMap = (map, key, value) => {
if (!map.has(key)) {
map.set(key, /* @__PURE__ */ new Set());
}
map.get(key).add(value);
};
var unpipeSubprocessStream = async (mergedStream, sourceStream) => {
MERGE_SOURCES.get(mergedStream)?.delete(sourceStream);
SOURCE_MERGES.get(sourceStream)?.delete(mergedStream);
await mergedStream.remove(sourceStream);
};
var unpipeSourcesOnDestinationEnd = async (mergedStream) => {
for (const sourceStream of MERGE_SOURCES.get(mergedStream)) {
const mergedStreams = SOURCE_MERGES.get(sourceStream);
mergedStreams.delete(mergedStream);
if (mergedStreams.size > 0) {
await mergedStream.remove(sourceStream);
}
}
};
var cleanupMergedStreamsMap = async (destinationStream) => {
try {
await finished6(destinationStream, { cleanup: true, readable: false, writable: true });
} catch {
}
MERGED_STREAMS.delete(destinationStream);
};
var MERGED_STREAMS = /* @__PURE__ */ new WeakMap();
var SOURCE_LISTENERS_PER_PIPE = 2;
var DESTINATION_LISTENERS_PER_PIPE = 1;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/pipe/abort.js
init_esm_shims();
import { aborted } from "util";
var unpipeOnAbort = (unpipeSignal, unpipeContext) => unpipeSignal === void 0 ? [] : [unpipeOnSignalAbort(unpipeSignal, unpipeContext)];
var unpipeOnSignalAbort = async (unpipeSignal, { sourceStream, mergedStream, fileDescriptors, sourceOptions, startTime }) => {
await aborted(unpipeSignal, sourceStream);
await unpipeSubprocessStream(mergedStream, sourceStream);
const error = new Error("Pipe canceled by `unpipeSignal` option.");
throw createNonCommandError({
error,
fileDescriptors,
sourceOptions,
startTime
});
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/pipe/setup.js
var pipeToSubprocess = (sourceInfo, ...pipeArguments) => {
if (isPlainObject(pipeArguments[0])) {
return pipeToSubprocess.bind(void 0, {
...sourceInfo,
boundOptions: { ...sourceInfo.boundOptions, ...pipeArguments[0] }
});
}
if (sourceInfo.source === void 0) {
return sourceInfo.sourcePromise;
}
const { destination, ...normalizedInfo } = normalizePipeArguments(sourceInfo, ...pipeArguments);
const pipeFailureController = new AbortController();
const promise = handlePipePromise({ ...normalizedInfo, destination, pipeFailureController });
promise.pipe = pipeToSubprocess.bind(void 0, {
...sourceInfo,
source: destination,
sourcePromise: promise,
boundOptions: {}
});
forwardDestinationMethods(promise, destination, pipeFailureController.signal);
return promise;
};
var forwardDestinationMethods = (promise, destination, pipeFailureSignal) => {
if (destination === void 0) {
return;
}
forwardReadableMethods(promise, destination);
forwardIpcMethods(promise, destination, pipeFailureSignal);
};
var forwardReadableMethods = (promise, destination) => {
const subprocessOptions = SUBPROCESS_OPTIONS.get(destination);
SUBPROCESS_OPTIONS.set(promise, subprocessOptions);
promise.stdio = destination.stdio;
promise.all = destination.all;
const { options: { encoding } } = subprocessOptions;
const concurrentStreams = initializeConcurrentStreams();
promise[Symbol.asyncIterator] = createIterable.bind(void 0, promise, encoding, {});
promise.iterable = createIterable.bind(void 0, promise, encoding);
promise.readable = createPipeReadable.bind(void 0, promise, {
subprocess: promise,
concurrentStreams,
encoding
});
promise.readableStream = createReadableStream.bind(void 0, promise);
forwardAll(promise, destination);
};
var forwardAll = (promise, destination) => {
if (destination.all === void 0) {
promise.all = void 0;
return;
}
Object.defineProperty(promise, "all", {
get() {
setAllProperty(promise, destination.all);
const all = promise.readable({ from: "all" });
all.on("error", () => {
});
setAllProperty(promise, all);
return all;
},
enumerable: true,
configurable: true
});
};
var setAllProperty = (promise, value) => {
Object.defineProperty(promise, "all", {
value,
writable: true,
enumerable: true,
configurable: true
});
};
var createPipeReadable = (promise, readableOptions, ...arguments_) => {
const readable = createReadable(readableOptions, ...arguments_);
destroyOnPipeFailure(promise, readable);
return readable;
};
var destroyOnPipeFailure = async (promise, readable) => {
try {
await promise;
} catch (error) {
readable.destroy(error);
}
};
var forwardIpcMethods = (promise, destination, pipeFailureSignal) => {
promise.sendMessage = destination.sendMessage;
promise.getOneMessage = getOnePipeMessage.bind(void 0, destination, pipeFailureSignal);
promise.getEachMessage = getEachPipeMessage.bind(void 0, promise, destination, pipeFailureSignal);
};
var getOnePipeMessage = (destination, pipeFailureSignal, ...arguments_) => {
const controller = new AbortController();
const messagePromise = destination.getOneMessage(...addPipeOptions(arguments_, controller.signal, internalGetOneMessageOptions));
return waitForOnePipeMessage(pipeFailureSignal, messagePromise, controller);
};
var waitForOnePipeMessage = async (pipeFailureSignal, messagePromise, controller) => {
try {
return await Promise.race([messagePromise, getSignalRejection(pipeFailureSignal, controller.signal)]);
} finally {
controller.abort();
}
};
var getSignalRejection = (signal, listenerSignal) => new Promise((_, reject) => {
if (signal.aborted) {
reject(signal.reason);
return;
}
signal.addEventListener("abort", () => {
reject(signal.reason);
}, { once: true, signal: listenerSignal });
});
var getEachPipeMessage = (promise, destination, pipeFailureSignal, ...arguments_) => {
const controller = new AbortController();
const iterator = destination.getEachMessage(...addPipeOptions(arguments_, controller.signal, internalGetEachMessageOptions));
abortOnSignal(pipeFailureSignal, controller);
return iterateOnPipeMessages(promise, iterator, controller);
};
var iterateOnPipeMessages = async function* (promise, iterator, controller) {
try {
yield* iterator;
} finally {
controller.abort();
await promise;
}
};
var addPipeOptions = (arguments_, signal, internalOptionsSymbol) => {
if (arguments_[0] === null) {
return arguments_;
}
const [options] = arguments_;
return [{ ...options, [internalOptionsSymbol]: { signal, shouldAwait: false } }];
};
var abortOnSignal = (signal, controller) => {
if (signal.aborted) {
controller.abort();
return;
}
signal.addEventListener("abort", () => {
controller.abort();
}, { once: true, signal: controller.signal });
};
var handlePipePromise = async ({
source,
sourcePromise,
sourceStream,
sourceOptions,
sourceError,
destination,
destinationStream,
destinationError,
unpipeSignal,
fileDescriptors,
startTime,
pipeFailureController
}) => {
const maxListenersController = new AbortController();
try {
const subprocessPromises = getSubprocessPromises(sourcePromise, destination, source);
handlePipeArgumentsError({
sourceStream,
sourceError,
destinationStream,
destinationError,
fileDescriptors,
sourceOptions,
startTime
});
const mergedStream = pipeSubprocessStream(sourceStream, destinationStream, maxListenersController);
return await Promise.race([
waitForBothSubprocesses(subprocessPromises),
...unpipeOnAbort(unpipeSignal, {
sourceStream,
mergedStream,
sourceOptions,
fileDescriptors,
startTime
})
]);
} catch (error) {
pipeFailureController.abort(error);
throw error;
} finally {
maxListenersController.abort();
}
};
var getSubprocessPromises = (sourcePromise, destination, source) => Promise.allSettled([sourcePromise, destination, source]);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/all-async.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/io/contents.js
init_esm_shims();
import { setImmediate } from "timers/promises";
var getStreamOutput = async ({ stream, onStreamEnd, fdNumber, encoding, buffer, maxBuffer, lines, allMixed, stripFinalNewline: stripFinalNewline2, allFds, verboseInfo, streamInfo }) => {
const logPromise = logOutputAsync({
stream,
onStreamEnd,
fdNumber,
encoding,
allMixed,
verboseInfo,
streamInfo
});
if (!buffer) {
await Promise.all([resumeStream(stream), logPromise]);
return;
}
const stripFinalNewlineValue = getStripFinalNewline(stripFinalNewline2, fdNumber, allFds);
const iterable = iterateForResult({
stream,
onStreamEnd,
lines,
encoding,
stripFinalNewline: stripFinalNewlineValue,
allMixed
});
const [output] = await Promise.all([
getStreamContents2({
stream,
iterable,
fdNumber,
encoding,
maxBuffer,
lines
}),
logPromise
]);
return output;
};
var logOutputAsync = async ({ stream, onStreamEnd, fdNumber, encoding, allMixed, verboseInfo, streamInfo: { fileDescriptors } }) => {
if (!shouldLogOutput({
stdioItems: fileDescriptors[fdNumber]?.stdioItems,
encoding,
verboseInfo,
fdNumber
})) {
return;
}
const linesIterable = iterateForResult({
stream,
onStreamEnd,
lines: true,
encoding,
stripFinalNewline: true,
allMixed
});
await logLines(linesIterable, stream, fdNumber, verboseInfo);
};
var resumeStream = async (stream) => {
await setImmediate();
if (stream.readableFlowing === null) {
stream.resume();
}
};
var getStreamContents2 = async ({ stream, stream: { readableObjectMode }, iterable, fdNumber, encoding, maxBuffer, lines }) => {
try {
if (readableObjectMode || lines) {
return await getStreamAsArray(iterable, { maxBuffer });
}
return encoding === "buffer" ? new Uint8Array(await getStreamAsArrayBuffer(iterable, { maxBuffer })) : await getStreamAsString(iterable, { maxBuffer });
} catch (error) {
return handleBufferedData(handleMaxBuffer({
error,
stream,
readableObjectMode,
lines,
encoding,
fdNumber
}));
}
};
var getBufferedData = async (streamPromise) => {
try {
return await streamPromise;
} catch (error) {
return handleBufferedData(error);
}
};
var handleBufferedData = (error) => isArrayBuffer(error?.bufferedData) ? new Uint8Array(error.bufferedData) : error?.bufferedData;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/stdio.js
init_esm_shims();
var waitForStdioStreams = ({ subprocess, encoding, buffer, maxBuffer, lines, stripFinalNewline: stripFinalNewline2, verboseInfo, streamInfo }) => subprocess.stdio.map((stream, fdNumber) => waitForSubprocessStream({
stream,
fdNumber,
encoding,
buffer: buffer[fdNumber],
maxBuffer: maxBuffer[fdNumber],
lines: lines[fdNumber],
allMixed: false,
stripFinalNewline: stripFinalNewline2,
verboseInfo,
streamInfo
}));
var waitForSubprocessStream = async ({ stream, fdNumber, encoding, buffer, maxBuffer, lines, allMixed, stripFinalNewline: stripFinalNewline2, allFds, verboseInfo, streamInfo }) => {
if (!stream) {
return;
}
const onStreamEnd = waitForStream(stream, fdNumber, streamInfo);
if (isInputFileDescriptor(streamInfo, fdNumber)) {
await onStreamEnd;
return;
}
const [output] = await Promise.all([
getStreamOutput({
stream,
onStreamEnd,
fdNumber,
encoding,
buffer,
maxBuffer,
lines,
allMixed,
stripFinalNewline: stripFinalNewline2,
allFds,
verboseInfo,
streamInfo
}),
onStreamEnd
]);
return output;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/all-async.js
var makeAllStream = ({ stdout, stderr }, { all }) => {
if (!all) {
return;
}
const fileDescriptors = [[stdout, 1], [stderr, 2]].filter(([stream]) => stream);
return fileDescriptors.length === 0 ? void 0 : setAllStream(mergeStreams(fileDescriptors.map(([stream]) => stream)));
};
var getAllFds = ({ stdout, stderr }, [, bufferStdout, bufferStderr]) => [
...stdout !== null && bufferStdout ? [1] : [],
...stderr !== null && bufferStderr ? [2] : []
];
var waitForAllStream = ({ subprocess, all, encoding, buffer, maxBuffer, lines, stripFinalNewline: stripFinalNewline2, verboseInfo, streamInfo }) => {
const { stream, buffer: bufferAll, drainedStream } = getAllStream(subprocess, all, buffer);
return Promise.all([
waitForSubprocessStream({
stream,
buffer: bufferAll,
fdNumber: "all",
encoding,
maxBuffer: maxBuffer[1] + maxBuffer[2],
lines: lines[1] || lines[2],
allFds: getAllFds(subprocess, buffer),
// A single buffered descriptor keeps its own object mode, even when the merged stream has mixed modes.
allMixed: stream === all && getAllMixed(subprocess, all),
stripFinalNewline: stripFinalNewline2,
verboseInfo,
streamInfo
}),
// When only one of the two file descriptors is buffered, its stream is read instead of the merged one.
// The merged one is then drained, otherwise it would apply backpressure on that file descriptor and hang the subprocess.
drainedStream === void 0 ? void 0 : resumeStream(drainedStream)
]).then(([output]) => output);
};
var getAllStream = ({ stdout, stderr }, all, [, bufferStdout, bufferStderr]) => {
const buffer = bufferStdout || bufferStderr;
if (!buffer) {
return { stream: all, buffer };
}
if (!all) {
return { stream: void 0, buffer };
}
if (!bufferStdout) {
return { stream: stderr, buffer, drainedStream: all };
}
return bufferStderr ? { stream: all, buffer } : { stream: stdout, buffer, drainedStream: all };
};
var getAllMixed = ({ stdout, stderr }, all) => all && stdout && stderr && stdout.readableObjectMode !== stderr.readableObjectMode;
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/wait-subprocess.js
init_esm_shims();
import { once as once8 } from "events";
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/buffer-messages.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/verbose/ipc.js
init_esm_shims();
var shouldLogIpc = (verboseInfo) => isFullVerbose(verboseInfo, "ipc");
var logIpcOutput = (message, verboseInfo) => {
const verboseMessage = serializeVerboseMessage(message);
verboseLog({
type: "ipc",
verboseMessage,
fdNumber: "ipc",
verboseInfo
});
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/ipc/buffer-messages.js
var waitForIpcOutput = async ({
subprocess,
buffer: bufferArray,
maxBuffer: maxBufferArray,
ipc,
ipcOutput,
verboseInfo
}) => {
if (!ipc) {
return ipcOutput;
}
const isVerbose2 = shouldLogIpc(verboseInfo);
const buffer = getFdSpecificValue(bufferArray, "ipc");
const maxBuffer = getFdSpecificValue(maxBufferArray, "ipc");
const logErrors = [];
for await (const message of loopOnMessages({
anyProcess: subprocess,
channel: subprocess.channel,
isSubprocess: false,
ipc,
shouldAwait: false,
reference: true
})) {
if (buffer) {
checkIpcMaxBuffer(ipcOutput, maxBuffer);
ipcOutput.push(message);
}
if (isVerbose2) {
try {
logIpcOutput(message, verboseInfo);
} catch (error) {
logErrors.push(error);
}
}
}
if (logErrors.length > 0) {
throw logErrors[0];
}
return ipcOutput;
};
var getBufferedIpcOutput = async (ipcOutputPromise, ipcOutput) => {
await Promise.allSettled([ipcOutputPromise]);
return ipcOutput;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/resolve/wait-subprocess.js
var waitForSubprocessResult = async ({
subprocess,
kill,
all,
options: {
encoding,
buffer,
maxBuffer,
lines,
timeoutDuration: timeout,
cancelSignal,
gracefulCancel,
forceKillAfterDelay,
stripFinalNewline: stripFinalNewline2,
ipc,
ipcInput
},
context,
verboseInfo,
fileDescriptors,
originalStreams,
onInternalError,
controller
}) => {
const exitPromise = waitForExit(subprocess, context);
const streamInfo = {
originalStreams,
fileDescriptors,
subprocess,
exitPromise,
propagating: false
};
const stdioPromises = waitForStdioStreams({
subprocess,
encoding,
buffer,
maxBuffer,
lines,
stripFinalNewline: stripFinalNewline2,
verboseInfo,
streamInfo
});
const allPromise = waitForAllStream({
subprocess,
all,
encoding,
buffer,
maxBuffer,
lines,
stripFinalNewline: stripFinalNewline2,
verboseInfo,
streamInfo
});
const ipcOutput = [];
const ipcOutputPromise = waitForIpcOutput({
subprocess,
buffer,
maxBuffer,
ipc,
ipcOutput,
verboseInfo
});
const originalPromises = waitForOriginalStreams(originalStreams, subprocess, streamInfo);
const customStreamsEndPromises = waitForCustomStreamsEnd(fileDescriptors, streamInfo);
try {
return await Promise.race([
Promise.all([
{},
waitForSuccessfulExit(exitPromise),
Promise.all(stdioPromises),
allPromise,
ipcOutputPromise,
sendIpcInput(subprocess, ipcInput, ipc),
...originalPromises,
...customStreamsEndPromises
]),
onInternalError,
throwOnSubprocessError(subprocess, controller),
...throwOnTimeout(kill, timeout, context, controller),
...throwOnCancel({
kill,
cancelSignal,
gracefulCancel,
context,
controller
}),
...throwOnGracefulCancel({
subprocess,
kill,
cancelSignal,
gracefulCancel,
forceKillAfterDelay,
context,
controller
})
]);
} catch (error) {
context.terminationReason ??= "other";
if (error instanceof MaxBufferError) {
kill();
}
return Promise.all([
{ error },
exitPromise,
Promise.all(stdioPromises.map((stdioPromise) => getBufferedData(stdioPromise))),
getBufferedData(allPromise),
getBufferedIpcOutput(ipcOutputPromise, ipcOutput),
Promise.allSettled(originalPromises),
Promise.allSettled(customStreamsEndPromises)
]);
}
};
var waitForOriginalStreams = (originalStreams, subprocess, streamInfo) => originalStreams.map((stream, fdNumber) => stream === subprocess.stdio[fdNumber] ? void 0 : waitForStream(stream, fdNumber, streamInfo));
var waitForCustomStreamsEnd = (fileDescriptors, streamInfo) => fileDescriptors.flatMap(({ stdioItems, direction }, fdNumber) => stdioItems.filter(({ value, stream = value }) => isStream(stream, { checkOpen: false }) && !isStandardStream(stream)).map(({ type, value, stream = value }) => waitForStream(stream, fdNumber, streamInfo, {
isSameDirection: TRANSFORM_TYPES.has(type),
stopOnExit: type === "native",
// Output streams are destinations which are handed back to the user: waiting for their readable side would mean waiting for the user to consume them.
readable: direction !== "output" || TRANSFORM_TYPES.has(type)
})));
var throwOnSubprocessError = async (subprocess, { signal }) => {
const [error] = await once8(subprocess, "error", { signal });
throw error;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/add.js
init_esm_shims();
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/writable.js
init_esm_shims();
import { Writable as Writable4 } from "stream";
import { callbackify as callbackify4 } from "util";
var createWritable = ({ subprocess, concurrentStreams }, options) => {
const { to } = copyOptions(options);
const subprocessStdin = getToStream(subprocess, to);
const { waitWritableFinal, waitWritableDestroy } = addWritableConcurrentStreams(concurrentStreams, subprocessStdin);
const writable = new Writable4({
...getWritableMethods(subprocessStdin, subprocess, waitWritableFinal),
destroy: callbackify4(onWritableDestroy.bind(void 0, {
subprocessStdin,
subprocess,
waitWritableFinal,
waitWritableDestroy
})),
highWaterMark: subprocessStdin.writableHighWaterMark,
objectMode: subprocessStdin.writableObjectMode
});
onStdinFinished(subprocessStdin, writable, void 0, subprocess);
return writable;
};
var addWritableConcurrentStreams = (concurrentStreams, subprocessStdin) => {
const waitWritableFinal = addConcurrentStream(concurrentStreams, subprocessStdin, "writableFinal");
const waitWritableDestroy = addConcurrentStream(concurrentStreams, subprocessStdin, "writableDestroy");
return { waitWritableFinal, waitWritableDestroy };
};
var getWritableMethods = (subprocessStdin, subprocess, waitWritableFinal) => ({
write: onWrite.bind(void 0, subprocessStdin),
final: callbackify4(onWritableFinal.bind(void 0, subprocessStdin, subprocess, waitWritableFinal))
});
var onWrite = (subprocessStdin, chunk, encoding, done) => {
if (subprocessStdin.write(chunk, encoding)) {
done();
} else {
subprocessStdin.once("drain", done);
}
};
var onWritableFinal = async (subprocessStdin, subprocess, waitWritableFinal) => {
if (!await waitForConcurrentStreams(waitWritableFinal, subprocess)) {
return;
}
if (subprocessStdin.writable) {
subprocessStdin.end();
}
await subprocess;
};
var onStdinFinished = async (subprocessStdin, writable, subprocessStdout, subprocess) => {
try {
await waitForSubprocessStdin(subprocessStdin);
await subprocess;
if (writable.writable) {
writable.end();
}
} catch (error) {
await safeWaitForSubprocessStdout(subprocessStdout);
destroyOtherStream(writable, !writable.writableFinished, await getSubprocessError(subprocess, error));
}
};
var getSubprocessError = async (subprocess, error) => {
if (!shouldUseSubprocessError(error)) {
return error;
}
try {
await subprocess;
} catch (subprocessError) {
return subprocessError;
}
return error;
};
var shouldUseSubprocessError = (error) => error === void 0 || isStreamAbort(error) || error.code === "EPIPE";
var onWritableDestroy = async ({ subprocessStdin, subprocess, waitWritableFinal, waitWritableDestroy }, error) => {
await waitForConcurrentStreams(waitWritableFinal, subprocess);
if (await waitForConcurrentStreams(waitWritableDestroy, subprocess)) {
destroyOtherWritable(subprocessStdin, error);
await subprocess;
}
throwDestroyError(error);
};
var destroyOtherWritable = (stream, error) => {
destroyOtherStream(stream, stream.writable, error);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/duplex.js
init_esm_shims();
import { Duplex as Duplex4 } from "stream";
import { callbackify as callbackify5 } from "util";
var createDuplex = ({ subprocess, concurrentStreams, encoding }, options) => {
const { from, to, binary: binaryOption = true, preserveNewlines = true } = copyOptions(options);
checkBooleanOption(binaryOption, "binary");
checkBooleanOption(preserveNewlines, "preserveNewlines");
const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
const subprocessStdout = getFromStream(subprocess, from);
const subprocessStdin = getToStream(subprocess, to);
const waitReadableDestroy = addConcurrentStream(concurrentStreams, subprocessStdout, "readableDestroy");
const { waitWritableFinal, waitWritableDestroy } = addWritableConcurrentStreams(concurrentStreams, subprocessStdin);
const { readableEncoding, readableObjectMode, readableHighWaterMark } = getReadableOptions(subprocessStdout, binary);
const { read, onStdoutDataDone } = getReadableMethods({
subprocessStdout,
subprocess,
binary,
encoding,
preserveNewlines
});
const duplex = new Duplex4({
read,
...getWritableMethods(subprocessStdin, subprocess, waitWritableFinal),
destroy: callbackify5(onDuplexDestroy.bind(void 0, {
subprocessStdout,
subprocessStdin,
subprocess,
waitReadableDestroy,
waitWritableFinal,
waitWritableDestroy
})),
readableHighWaterMark,
writableHighWaterMark: subprocessStdin.writableHighWaterMark,
readableObjectMode,
writableObjectMode: subprocessStdin.writableObjectMode,
encoding: readableEncoding
});
onStdoutFinished({
subprocessStdout,
onStdoutDataDone,
readable: duplex,
subprocess,
subprocessStdin
});
onStdinFinished(subprocessStdin, duplex, subprocessStdout, subprocess);
return duplex;
};
var onDuplexDestroy = async ({ subprocessStdout, subprocessStdin, subprocess, waitReadableDestroy, waitWritableFinal, waitWritableDestroy }, error) => {
await Promise.all([
onReadableDestroy({ subprocessStdout, subprocess, waitReadableDestroy }, error),
onWritableDestroy({
subprocessStdin,
subprocess,
waitWritableFinal,
waitWritableDestroy
}, error)
]);
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/convert/add.js
var addConvertedStreams = (subprocess, { encoding }) => {
const concurrentStreams = initializeConcurrentStreams();
subprocess.readable = createReadable.bind(void 0, { subprocess, concurrentStreams, encoding });
subprocess.writable = createWritable.bind(void 0, { subprocess, concurrentStreams });
subprocess.duplex = createDuplex.bind(void 0, { subprocess, concurrentStreams, encoding });
subprocess.readableStream = createReadableStream.bind(void 0, subprocess);
subprocess.writableStream = createWritableStream.bind(void 0, subprocess);
subprocess.transformStream = createTransformStream.bind(void 0, subprocess);
subprocess.iterable = createIterable.bind(void 0, subprocess, encoding);
subprocess[Symbol.asyncIterator] = createIterable.bind(void 0, subprocess, encoding, {});
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/promise.js
init_esm_shims();
var mergePromise = (promise, properties) => Object.assign(promise, properties);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/main-async.js
var execaCoreAsync = (rawFile, rawArguments, rawOptions, createNested) => {
const { file, commandArguments, command, escapedCommand, startTime, verboseInfo, options, fileDescriptors } = handleAsyncArguments(rawFile, rawArguments, rawOptions);
const { subprocess: nodeChildProcess, promise, kill, all, convertedStreams } = spawnSubprocessAsync({
file,
commandArguments,
options,
startTime,
verboseInfo,
command,
escapedCommand,
fileDescriptors
});
const subprocess = getSubprocessPromise({
promise,
nodeChildProcess,
kill,
all,
convertedStreams,
options
});
subprocess.pipe = pipeToSubprocess.bind(void 0, {
source: subprocess,
sourcePromise: promise,
boundOptions: {},
createNested
});
SUBPROCESS_OPTIONS.set(subprocess, { options, fileDescriptors });
return subprocess;
};
var handleAsyncArguments = (rawFile, rawArguments, rawOptions) => {
const { command, escapedCommand, startTime, verboseInfo } = handleCommand(rawFile, rawArguments, rawOptions);
const { file, commandArguments, options: normalizedOptions } = normalizeOptions(rawFile, rawArguments, rawOptions);
const options = handleAsyncOptions(normalizedOptions);
const fileDescriptors = handleStdioAsync(options, verboseInfo);
return {
file,
commandArguments,
command,
escapedCommand,
startTime,
verboseInfo,
options,
fileDescriptors
};
};
var handleAsyncOptions = ({ timeout, signal, ...options }) => ({ __proto__: null, ...options, timeoutDuration: timeout });
var spawnSubprocessAsync = ({ file, commandArguments, options, startTime, verboseInfo, command, escapedCommand, fileDescriptors }) => {
let subprocess;
try {
subprocess = spawn(...concatenateShell(file, commandArguments, getSpawnOptions(options)));
} catch (error) {
return handleEarlyError({
error,
command,
escapedCommand,
fileDescriptors,
options,
startTime,
verboseInfo
});
}
if (subprocess.stdio === void 0) {
return handleEarlyError({
error: once9(subprocess, "error").then(([error]) => error),
command,
escapedCommand,
fileDescriptors,
options,
startTime,
verboseInfo
});
}
const controller = new AbortController();
setMaxListeners(Infinity, controller.signal);
const originalStreams = [...subprocess.stdio];
pipeOutputAsync(subprocess, fileDescriptors, controller);
setIpcSubprocessOptions(subprocess, options);
const context = {};
const onInternalError = createDeferred();
const kill = subprocessKill.bind(void 0, {
kill: getKillFunction(subprocess, options),
options,
onInternalError,
context,
controller
});
cleanupOnExit(kill, options, controller);
const all = makeAllStream(subprocess, options);
const promise = handlePromise({
subprocess,
kill,
all,
options,
startTime,
verboseInfo,
fileDescriptors,
originalStreams,
command,
escapedCommand,
context,
onInternalError,
controller
});
return {
subprocess,
promise,
kill,
all
};
};
var getSubprocessPromise = ({ promise, nodeChildProcess, kill, all, convertedStreams, options }) => {
const subprocess = mergePromise(promise, getSubprocessProperties(nodeChildProcess, all));
subprocess.kill = kill ?? subprocess.kill;
if (convertedStreams === void 0) {
addConvertedStreams(subprocess, options);
} else {
Object.assign(subprocess, convertedStreams);
}
addIpcMethods(subprocess, nodeChildProcess, options);
return subprocess;
};
var getSubprocessProperties = (nodeChildProcess, all) => ({
nodeChildProcess,
pid: nodeChildProcess.pid,
stdin: nodeChildProcess.stdin,
stdout: nodeChildProcess.stdout,
stderr: nodeChildProcess.stderr,
stdio: nodeChildProcess.stdio,
all,
kill: nodeChildProcess.kill.bind(nodeChildProcess)
});
var handlePromise = async ({ subprocess, kill, all: allStream, options, startTime, verboseInfo, fileDescriptors, originalStreams, command, escapedCommand, context, onInternalError, controller }) => {
const [
errorInfo,
[exitCode, signal],
stdioResults,
allResult,
ipcOutput
] = await waitForSubprocessResult({
subprocess,
kill,
all: allStream,
options,
context,
verboseInfo,
fileDescriptors,
originalStreams,
onInternalError,
controller
});
controller.abort();
onInternalError.resolve();
const stdio = stdioResults.map((stdioResult, fdNumber) => stripNewline(stdioResult, options, fdNumber));
const all = stripNewline(allResult, options, "all", getAllFds(subprocess, options.buffer));
const result = getAsyncResult({
errorInfo,
exitCode,
signal,
stdio,
all,
ipcOutput,
context,
options,
command,
escapedCommand,
startTime
});
return handleResult(result, verboseInfo, options);
};
var getAsyncResult = ({ errorInfo, exitCode, signal, stdio, all, ipcOutput, context, options, command, escapedCommand, startTime }) => Object.hasOwn(errorInfo, "error") ? makeError({
error: errorInfo.error,
command,
escapedCommand,
timedOut: context.terminationReason === "timeout",
isCanceled: context.terminationReason === "cancel" || context.terminationReason === "gracefulCancel",
isGracefullyCanceled: context.terminationReason === "gracefulCancel",
isMaxBuffer: errorInfo.error instanceof MaxBufferError,
isForcefullyTerminated: context.isForcefullyTerminated,
exitCode,
signal,
stdio,
all,
ipcOutput,
options,
startTime,
isSync: false
}) : makeSuccessResult({
command,
escapedCommand,
stdio,
all,
ipcOutput,
options,
startTime
});
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/bind.js
init_esm_shims();
var mergeOptions = (boundOptions, options) => {
const safeBoundOptions = { __proto__: null, ...boundOptions };
const mergedOptions = Object.fromEntries(Object.entries(options).map(([optionName, optionValue]) => [
optionName,
mergeOption(optionName, safeBoundOptions[optionName], optionValue)
]));
return { __proto__: null, ...safeBoundOptions, ...mergedOptions };
};
var mergeOption = (optionName, boundOptionValue, optionValue) => DEEP_OPTIONS.has(optionName) && isPlainObject(boundOptionValue) && isPlainObject(optionValue) ? { ...boundOptionValue, ...optionValue } : optionValue;
var DEEP_OPTIONS = /* @__PURE__ */ new Set(["env", ...FD_SPECIFIC_OPTIONS]);
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/create.js
var createExeca = (mapArguments, boundOptions, deepOptions, setBoundExeca) => {
const createNested = (mapArguments2, boundOptions2, setBoundExeca2) => createExeca(mapArguments2, boundOptions2, deepOptions, setBoundExeca2);
const boundExeca = (...execaArguments) => callBoundExeca({
mapArguments,
deepOptions,
boundOptions,
setBoundExeca,
createNested
}, ...execaArguments);
if (setBoundExeca !== void 0) {
setBoundExeca(boundExeca, createNested, boundOptions);
}
return boundExeca;
};
var callBoundExeca = ({ mapArguments, deepOptions = {}, boundOptions = {}, setBoundExeca, createNested }, firstArgument, ...nextArguments) => {
if (isPlainObject(firstArgument)) {
return createNested(mapArguments, mergeOptions(boundOptions, firstArgument), setBoundExeca);
}
const { file, commandArguments, options, isSync } = parseArguments({
mapArguments,
firstArgument,
nextArguments,
deepOptions,
boundOptions
});
return isSync ? execaCoreSync(file, commandArguments, options) : execaCoreAsync(file, commandArguments, options, createNested);
};
var parseArguments = ({ mapArguments, firstArgument, nextArguments, deepOptions, boundOptions }) => {
const callArguments = isTemplateString(firstArgument) ? parseTemplates(firstArgument, nextArguments) : [firstArgument, ...nextArguments];
const [initialFile, initialArguments, initialOptions] = normalizeParameters(...callArguments);
const mergedOptions = mergeOptions(mergeOptions(deepOptions, boundOptions), initialOptions);
for (const [optionName, optionValue] of Object.entries(deepOptions)) {
if (mergedOptions[optionName] === void 0) {
mergedOptions[optionName] = optionValue;
}
}
const {
options = mergedOptions,
isSync = false
} = { __proto__: null, ...mapArguments({ options: mergedOptions }) };
return {
file: initialFile,
commandArguments: initialArguments,
options,
isSync
};
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/script.js
init_esm_shims();
var setScriptSync = (boundExeca, createNested, boundOptions) => {
boundExeca.sync = createNested(mapScriptSync, boundOptions);
boundExeca.s = boundExeca.sync;
};
var mapScriptAsync = ({ options }) => getScriptOptions(options);
var mapScriptSync = ({ options }) => ({ ...getScriptOptions(options), isSync: true });
var getScriptOptions = (options) => ({ options: { __proto__: null, ...options, ...getScriptStdinOption(options) } });
var getScriptStdinOption = ({ stdin = "inherit", input, inputFile, stdio }) => input === void 0 && inputFile === void 0 && stdio === void 0 ? { stdin } : {};
var deepScriptOptions = { preferLocal: true };
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/lib/methods/command.js
init_esm_shims();
var parseCommandString = (command) => {
if (typeof command !== "string") {
throw new TypeError(`The command must be a string: ${String(command)}.`);
}
return trimCommand(command).match(TOKEN_REGEXP)?.map((token) => token.replaceAll("\\ ", " ")) ?? [];
};
var TOKEN_REGEXP = /(?:\\ |[^ ])+/g;
var trimCommand = (command) => {
const trimmedCommand = command.trim();
const trimmedEnd = command.trimEnd();
return trimmedEnd.endsWith("\\") && command[trimmedEnd.length] === " " ? `${trimmedCommand} ` : trimmedCommand;
};
// node_modules/.pnpm/execa@10.2.1/node_modules/execa/index.js
var execa = createExeca(() => ({}));
var execaSync = createExeca(() => ({ isSync: true }));
var execaNode = createExeca(mapNode);
var $ = createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
var {
sendMessage: sendMessage2,
getOneMessage: getOneMessage2,
getEachMessage: getEachMessage2,
getCancelSignal: getCancelSignal2
} = getIpcExport();
export {
onExit,
parseCommandString,
execa
};