@hot-updater/cloudflare 0.20.11 → 0.20.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/iac/index.cjs +190 -329
- package/dist/iac/index.js +206 -345
- package/dist/index.cjs +170 -281
- package/dist/index.js +181 -292
- package/package.json +4 -4
- package/sql/prepareSql.ts +1 -1
- package/worker/dist/README.md +1 -1
- package/worker/dist/index.js +54 -80
- package/worker/dist/index.js.map +3 -3
package/dist/index.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { calculatePagination, createDatabasePlugin, createStorageKeyBuilder } from "@hot-updater/plugin-core";
|
|
3
3
|
import Cloudflare from "cloudflare";
|
|
4
|
-
import path from "path";
|
|
5
4
|
import { fileURLToPath } from "node:url";
|
|
6
5
|
import { ChildProcess, execFile, spawn, spawnSync } from "node:child_process";
|
|
7
6
|
import { StringDecoder } from "node:string_decoder";
|
|
8
7
|
import { aborted, callbackify, debuglog, inspect, promisify, stripVTControlCharacters } from "node:util";
|
|
9
8
|
import process$1, { execArgv, execPath, hrtime, platform } from "node:process";
|
|
10
9
|
import tty from "node:tty";
|
|
11
|
-
import path
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import path$1 from "path";
|
|
12
12
|
import { scheduler, setImmediate, setTimeout } from "node:timers/promises";
|
|
13
13
|
import { constants } from "node:os";
|
|
14
14
|
import { EventEmitter, addAbortListener, on, once, setMaxListeners } from "node:events";
|
|
@@ -120,14 +120,13 @@ var require_error = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/pg-mi
|
|
|
120
120
|
SQLParsingError$1.prototype.toString = function(level) {
|
|
121
121
|
level = level > 0 ? parseInt(level) : 0;
|
|
122
122
|
const gap = messageGap(level + 1);
|
|
123
|
-
|
|
123
|
+
return [
|
|
124
124
|
"SQLParsingError {",
|
|
125
125
|
`${gap}code: parsingErrorCode.${errorMessages[this.code].name}`,
|
|
126
126
|
`${gap}error: "${this.error}"`,
|
|
127
127
|
`${gap}position: {line: ${this.position.line}, col: ${this.position.column}}`,
|
|
128
128
|
`${messageGap(level)}}`
|
|
129
|
-
];
|
|
130
|
-
return lines.join(EOL);
|
|
129
|
+
].join(EOL);
|
|
131
130
|
};
|
|
132
131
|
addInspection(SQLParsingError$1.prototype, function() {
|
|
133
132
|
return this.toString();
|
|
@@ -262,8 +261,7 @@ var require_parser = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/pg-m
|
|
|
262
261
|
}
|
|
263
262
|
}
|
|
264
263
|
function throwError(code) {
|
|
265
|
-
|
|
266
|
-
throw new SQLParsingError(code, position);
|
|
264
|
+
throw new SQLParsingError(code, getIndexPos(sql, idx));
|
|
267
265
|
}
|
|
268
266
|
}
|
|
269
267
|
function isGap(s) {
|
|
@@ -304,9 +302,8 @@ function buildWhereClause(conditions) {
|
|
|
304
302
|
clauses.push("platform = ?");
|
|
305
303
|
params.push(conditions.platform);
|
|
306
304
|
}
|
|
307
|
-
const whereClause = clauses.length > 0 ? ` WHERE ${clauses.join(" AND ")}` : "";
|
|
308
305
|
return {
|
|
309
|
-
sql:
|
|
306
|
+
sql: clauses.length > 0 ? ` WHERE ${clauses.join(" AND ")}` : "",
|
|
310
307
|
params
|
|
311
308
|
};
|
|
312
309
|
}
|
|
@@ -331,13 +328,11 @@ const d1Database = (config, hooks) => {
|
|
|
331
328
|
async function getTotalCount(context, conditions) {
|
|
332
329
|
const { sql: whereClause, params } = buildWhereClause(conditions);
|
|
333
330
|
const countSql = (0, import_lib.default)(`SELECT COUNT(*) as total FROM bundles${whereClause}`);
|
|
334
|
-
|
|
331
|
+
return (await resolvePage(await context.cf.d1.database.query(config.databaseId, {
|
|
335
332
|
account_id: config.accountId,
|
|
336
333
|
sql: countSql,
|
|
337
334
|
params
|
|
338
|
-
});
|
|
339
|
-
const rows = await resolvePage(countResult);
|
|
340
|
-
return rows[0]?.total || 0;
|
|
335
|
+
})))[0]?.total || 0;
|
|
341
336
|
}
|
|
342
337
|
async function getPaginatedBundles(context, conditions, limit, offset) {
|
|
343
338
|
const { sql: whereClause, params } = buildWhereClause(conditions);
|
|
@@ -349,13 +344,11 @@ const d1Database = (config, hooks) => {
|
|
|
349
344
|
OFFSET ?
|
|
350
345
|
`);
|
|
351
346
|
params.push(limit, offset);
|
|
352
|
-
|
|
347
|
+
return (await resolvePage(await context.cf.d1.database.query(config.databaseId, {
|
|
353
348
|
account_id: config.accountId,
|
|
354
349
|
sql,
|
|
355
350
|
params
|
|
356
|
-
});
|
|
357
|
-
const rows = await resolvePage(result);
|
|
358
|
-
return rows.map(transformRowToBundle);
|
|
351
|
+
}))).map(transformRowToBundle);
|
|
359
352
|
}
|
|
360
353
|
return createDatabasePlugin("d1Database", {
|
|
361
354
|
getContext: () => ({ cf: new Cloudflare({ apiToken: config.cloudflareApiToken }) }),
|
|
@@ -364,12 +357,11 @@ const d1Database = (config, hooks) => {
|
|
|
364
357
|
if (found) return found;
|
|
365
358
|
const sql = (0, import_lib.default)(`
|
|
366
359
|
SELECT * FROM bundles WHERE id = ? LIMIT 1`);
|
|
367
|
-
const
|
|
360
|
+
const rows = await resolvePage(await context.cf.d1.database.query(config.databaseId, {
|
|
368
361
|
account_id: config.accountId,
|
|
369
362
|
sql,
|
|
370
363
|
params: [bundleId]
|
|
371
|
-
});
|
|
372
|
-
const rows = await resolvePage(singlePage);
|
|
364
|
+
}));
|
|
373
365
|
if (rows.length === 0) return null;
|
|
374
366
|
return transformRowToBundle(rows[0]);
|
|
375
367
|
},
|
|
@@ -377,11 +369,10 @@ const d1Database = (config, hooks) => {
|
|
|
377
369
|
const { where = {}, limit, offset } = options;
|
|
378
370
|
const totalCount = await getTotalCount(context, where);
|
|
379
371
|
bundles = await getPaginatedBundles(context, where, limit, offset);
|
|
380
|
-
const
|
|
372
|
+
const pagination = calculatePagination(totalCount, {
|
|
381
373
|
limit,
|
|
382
374
|
offset
|
|
383
|
-
};
|
|
384
|
-
const pagination = calculatePagination(totalCount, paginationOptions);
|
|
375
|
+
});
|
|
385
376
|
return {
|
|
386
377
|
data: bundles,
|
|
387
378
|
pagination
|
|
@@ -391,13 +382,11 @@ const d1Database = (config, hooks) => {
|
|
|
391
382
|
const sql = (0, import_lib.default)(`
|
|
392
383
|
SELECT channel FROM bundles GROUP BY channel
|
|
393
384
|
`);
|
|
394
|
-
|
|
385
|
+
return (await resolvePage(await context.cf.d1.database.query(config.databaseId, {
|
|
395
386
|
account_id: config.accountId,
|
|
396
387
|
sql,
|
|
397
388
|
params: []
|
|
398
|
-
});
|
|
399
|
-
const rows = await resolvePage(singlePage);
|
|
400
|
-
return rows.map((row) => row.channel);
|
|
389
|
+
}))).map((row) => row.channel);
|
|
401
390
|
},
|
|
402
391
|
async commitBundle(context, { changedSets }) {
|
|
403
392
|
if (changedSets.length === 0) return;
|
|
@@ -503,8 +492,7 @@ const stringToUint8Array = (string) => textEncoder$1.encode(string);
|
|
|
503
492
|
const textDecoder = new TextDecoder();
|
|
504
493
|
const uint8ArrayToString = (uint8Array) => textDecoder.decode(uint8Array);
|
|
505
494
|
const joinToString = (uint8ArraysOrStrings, encoding) => {
|
|
506
|
-
|
|
507
|
-
return strings.join("");
|
|
495
|
+
return uint8ArraysToStrings(uint8ArraysOrStrings, encoding).join("");
|
|
508
496
|
};
|
|
509
497
|
const uint8ArraysToStrings = (uint8ArraysOrStrings, encoding) => {
|
|
510
498
|
if (encoding === "utf8" && uint8ArraysOrStrings.every((uint8ArrayOrString) => typeof uint8ArrayOrString === "string")) return uint8ArraysOrStrings;
|
|
@@ -559,8 +547,7 @@ const parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
|
559
547
|
const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
|
|
560
548
|
if (index === expressions.length) return newTokens;
|
|
561
549
|
const expression = expressions[index];
|
|
562
|
-
|
|
563
|
-
return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
|
|
550
|
+
return concatTokens(newTokens, Array.isArray(expression) ? expression.map((expression$1) => parseExpression(expression$1)) : [parseExpression(expression)], trailingWhitespaces);
|
|
564
551
|
};
|
|
565
552
|
const splitByWhitespaces = (template, rawTemplate) => {
|
|
566
553
|
if (rawTemplate.length === 0) return {
|
|
@@ -647,8 +634,7 @@ const normalizeFdSpecificOptions = (options) => {
|
|
|
647
634
|
};
|
|
648
635
|
const normalizeFdSpecificOption = (options, optionName) => {
|
|
649
636
|
const optionBaseArray = Array.from({ length: getStdioLength(options) + 1 });
|
|
650
|
-
|
|
651
|
-
return addDefaultValue$1(optionArray, optionName);
|
|
637
|
+
return addDefaultValue$1(normalizeFdSpecificValue(options[optionName], optionBaseArray, optionName), optionName);
|
|
652
638
|
};
|
|
653
639
|
const getStdioLength = ({ stdio }) => Array.isArray(stdio) ? Math.max(stdio.length, STANDARD_STREAMS_ALIASES.length) : STANDARD_STREAMS_ALIASES.length;
|
|
654
640
|
const normalizeFdSpecificValue = (optionValue, optionArray, optionName) => isPlainObject(optionValue) ? normalizeOptionObject(optionValue, optionArray, optionName) : optionArray.fill(optionValue);
|
|
@@ -678,12 +664,11 @@ const parseFd = (fdName) => {
|
|
|
678
664
|
};
|
|
679
665
|
const FD_REGEXP = /^fd(\d+)$/;
|
|
680
666
|
const addDefaultValue$1 = (optionArray, optionName) => optionArray.map((optionValue) => optionValue === void 0 ? DEFAULT_OPTIONS[optionName] : optionValue);
|
|
681
|
-
const verboseDefault = debuglog("execa").enabled ? "full" : "none";
|
|
682
667
|
const DEFAULT_OPTIONS = {
|
|
683
668
|
lines: false,
|
|
684
669
|
buffer: true,
|
|
685
670
|
maxBuffer: 1e3 * 1e3 * 100,
|
|
686
|
-
verbose:
|
|
671
|
+
verbose: debuglog("execa").enabled ? "full" : "none",
|
|
687
672
|
stripFinalNewline: true
|
|
688
673
|
};
|
|
689
674
|
const FD_SPECIFIC_OPTIONS = [
|
|
@@ -716,11 +701,9 @@ const VERBOSE_VALUES = [
|
|
|
716
701
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/arguments/escape.js
|
|
717
702
|
const joinCommand = (filePath, rawArguments) => {
|
|
718
703
|
const fileAndArguments = [filePath, ...rawArguments];
|
|
719
|
-
const command = fileAndArguments.join(" ");
|
|
720
|
-
const escapedCommand = fileAndArguments.map((fileAndArgument) => quoteString(escapeControlCharacters(fileAndArgument))).join(" ");
|
|
721
704
|
return {
|
|
722
|
-
command,
|
|
723
|
-
escapedCommand
|
|
705
|
+
command: fileAndArguments.join(" "),
|
|
706
|
+
escapedCommand: fileAndArguments.map((fileAndArgument) => quoteString(escapeControlCharacters(fileAndArgument))).join(" ")
|
|
724
707
|
};
|
|
725
708
|
};
|
|
726
709
|
const escapeLines = (lines) => stripVTControlCharacters(lines).split("\n").map((line) => escapeControlCharacters(line)).join("\n");
|
|
@@ -1161,13 +1144,11 @@ const appendNewline = (printedLine) => printedLine.endsWith("\n") ? printedLine
|
|
|
1161
1144
|
//#endregion
|
|
1162
1145
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/log.js
|
|
1163
1146
|
const verboseLog = ({ type, verboseMessage, fdNumber, verboseInfo, result }) => {
|
|
1164
|
-
const
|
|
1147
|
+
const finalLines = applyVerboseOnLines(getPrintedLines(verboseMessage, getVerboseObject({
|
|
1165
1148
|
type,
|
|
1166
1149
|
result,
|
|
1167
1150
|
verboseInfo
|
|
1168
|
-
});
|
|
1169
|
-
const printedLines = getPrintedLines(verboseMessage, verboseObject);
|
|
1170
|
-
const finalLines = applyVerboseOnLines(printedLines, verboseInfo, fdNumber);
|
|
1151
|
+
})), verboseInfo, fdNumber);
|
|
1171
1152
|
if (finalLines !== "") console.warn(finalLines.slice(0, -1));
|
|
1172
1153
|
};
|
|
1173
1154
|
const getVerboseObject = ({ type, result, verboseInfo: { escapedCommand, commandId, rawOptions: { piped = false,...options } } }) => ({
|
|
@@ -1184,16 +1165,13 @@ const getPrintedLines = (verboseMessage, verboseObject) => verboseMessage.split(
|
|
|
1184
1165
|
message
|
|
1185
1166
|
}));
|
|
1186
1167
|
const getPrintedLine = (verboseObject) => {
|
|
1187
|
-
const verboseLine = defaultVerboseFunction(verboseObject);
|
|
1188
1168
|
return {
|
|
1189
|
-
verboseLine,
|
|
1169
|
+
verboseLine: defaultVerboseFunction(verboseObject),
|
|
1190
1170
|
verboseObject
|
|
1191
1171
|
};
|
|
1192
1172
|
};
|
|
1193
1173
|
const serializeVerboseMessage = (message) => {
|
|
1194
|
-
|
|
1195
|
-
const escapedMessage = escapeLines(messageString);
|
|
1196
|
-
return escapedMessage.replaceAll(" ", " ".repeat(TAB_SIZE));
|
|
1174
|
+
return escapeLines(typeof message === "string" ? message : inspect(message)).replaceAll(" ", " ".repeat(TAB_SIZE));
|
|
1197
1175
|
};
|
|
1198
1176
|
const TAB_SIZE = 2;
|
|
1199
1177
|
|
|
@@ -1212,11 +1190,10 @@ const logCommand = (escapedCommand, verboseInfo) => {
|
|
|
1212
1190
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/info.js
|
|
1213
1191
|
const getVerboseInfo = (verbose, escapedCommand, rawOptions) => {
|
|
1214
1192
|
validateVerbose(verbose);
|
|
1215
|
-
const commandId = getCommandId(verbose);
|
|
1216
1193
|
return {
|
|
1217
1194
|
verbose,
|
|
1218
1195
|
escapedCommand,
|
|
1219
|
-
commandId,
|
|
1196
|
+
commandId: getCommandId(verbose),
|
|
1220
1197
|
rawOptions
|
|
1221
1198
|
};
|
|
1222
1199
|
};
|
|
@@ -1243,8 +1220,7 @@ const getDurationMs = (startTime) => Number(hrtime.bigint() - startTime) / 1e6;
|
|
|
1243
1220
|
const handleCommand = (filePath, rawArguments, rawOptions) => {
|
|
1244
1221
|
const startTime = getStartTime();
|
|
1245
1222
|
const { command, escapedCommand } = joinCommand(filePath, rawArguments);
|
|
1246
|
-
const
|
|
1247
|
-
const verboseInfo = getVerboseInfo(verbose, escapedCommand, { ...rawOptions });
|
|
1223
|
+
const verboseInfo = getVerboseInfo(normalizeFdSpecificOption(rawOptions, "verbose"), escapedCommand, { ...rawOptions });
|
|
1248
1224
|
logCommand(escapedCommand, verboseInfo);
|
|
1249
1225
|
return {
|
|
1250
1226
|
command,
|
|
@@ -1312,8 +1288,7 @@ var require_mode = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/isexe@
|
|
|
1312
1288
|
var g = parseInt("010", 8);
|
|
1313
1289
|
var o$1 = parseInt("001", 8);
|
|
1314
1290
|
var ug = u$1 | g;
|
|
1315
|
-
|
|
1316
|
-
return ret;
|
|
1291
|
+
return mod & o$1 || mod & g && gid === myGid || mod & u$1 && uid === myUid || mod & ug && myUid === 0;
|
|
1317
1292
|
}
|
|
1318
1293
|
}) });
|
|
1319
1294
|
|
|
@@ -1395,8 +1370,7 @@ var require_which = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/which
|
|
|
1395
1370
|
const ppRaw = pathEnv[i$1];
|
|
1396
1371
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
1397
1372
|
const pCmd = path$4.join(pathPart, cmd);
|
|
1398
|
-
|
|
1399
|
-
resolve(subStep(p, i$1, 0));
|
|
1373
|
+
resolve(subStep(!pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd, i$1, 0));
|
|
1400
1374
|
});
|
|
1401
1375
|
const subStep = (p, i$1, ii) => new Promise((resolve, reject) => {
|
|
1402
1376
|
if (ii === pathExt.length) return resolve(step(i$1 + 1));
|
|
@@ -1421,8 +1395,7 @@ var require_which = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/which
|
|
|
1421
1395
|
for (let j = 0; j < pathExt.length; j++) {
|
|
1422
1396
|
const cur = p + pathExt[j];
|
|
1423
1397
|
try {
|
|
1424
|
-
|
|
1425
|
-
if (is) if (opt.all) found.push(cur);
|
|
1398
|
+
if (isexe.sync(cur, { pathExt: pathExtExe })) if (opt.all) found.push(cur);
|
|
1426
1399
|
else return cur;
|
|
1427
1400
|
} catch (ex) {}
|
|
1428
1401
|
}
|
|
@@ -1440,8 +1413,7 @@ var require_which = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/which
|
|
|
1440
1413
|
var require_path_key = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js": ((exports, module) => {
|
|
1441
1414
|
const pathKey$1 = (options = {}) => {
|
|
1442
1415
|
const environment = options.env || process.env;
|
|
1443
|
-
|
|
1444
|
-
if (platform$1 !== "win32") return "PATH";
|
|
1416
|
+
if ((options.platform || process.platform) !== "win32") return "PATH";
|
|
1445
1417
|
return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
|
|
1446
1418
|
};
|
|
1447
1419
|
module.exports = pathKey$1;
|
|
@@ -1569,12 +1541,11 @@ var require_parse = /* @__PURE__ */ __commonJS({ "../../node_modules/.pnpm/cross
|
|
|
1569
1541
|
parsed.command = path$2.normalize(parsed.command);
|
|
1570
1542
|
parsed.command = escape.command(parsed.command);
|
|
1571
1543
|
parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
|
|
1572
|
-
const shellCommand = [parsed.command].concat(parsed.args).join(" ");
|
|
1573
1544
|
parsed.args = [
|
|
1574
1545
|
"/d",
|
|
1575
1546
|
"/s",
|
|
1576
1547
|
"/c",
|
|
1577
|
-
`"${
|
|
1548
|
+
`"${[parsed.command].concat(parsed.args).join(" ")}"`
|
|
1578
1549
|
];
|
|
1579
1550
|
parsed.command = process.env.comspec || "cmd.exe";
|
|
1580
1551
|
parsed.options.windowsVerbatimArguments = true;
|
|
@@ -1685,12 +1656,12 @@ function toPath(urlOrPath) {
|
|
|
1685
1656
|
}
|
|
1686
1657
|
function traversePathUp(startPath) {
|
|
1687
1658
|
return { *[Symbol.iterator]() {
|
|
1688
|
-
let currentPath = path
|
|
1659
|
+
let currentPath = path.resolve(toPath(startPath));
|
|
1689
1660
|
let previousPath;
|
|
1690
1661
|
while (previousPath !== currentPath) {
|
|
1691
1662
|
yield currentPath;
|
|
1692
1663
|
previousPath = currentPath;
|
|
1693
|
-
currentPath = path
|
|
1664
|
+
currentPath = path.resolve(currentPath, "..");
|
|
1694
1665
|
}
|
|
1695
1666
|
} };
|
|
1696
1667
|
}
|
|
@@ -1699,21 +1670,21 @@ const TEN_MEGABYTES_IN_BYTES = 10 * 1024 * 1024;
|
|
|
1699
1670
|
//#endregion
|
|
1700
1671
|
//#region ../../node_modules/.pnpm/npm-run-path@6.0.0/node_modules/npm-run-path/index.js
|
|
1701
1672
|
const npmRunPath = ({ cwd = process$1.cwd(), path: pathOption = process$1.env[pathKey()], preferLocal = true, execPath: execPath$1 = process$1.execPath, addExecPath = true } = {}) => {
|
|
1702
|
-
const cwdPath = path
|
|
1673
|
+
const cwdPath = path.resolve(toPath(cwd));
|
|
1703
1674
|
const result = [];
|
|
1704
|
-
const pathParts = pathOption.split(path
|
|
1675
|
+
const pathParts = pathOption.split(path.delimiter);
|
|
1705
1676
|
if (preferLocal) applyPreferLocal(result, pathParts, cwdPath);
|
|
1706
1677
|
if (addExecPath) applyExecPath(result, pathParts, execPath$1, cwdPath);
|
|
1707
|
-
return pathOption === "" || pathOption === path
|
|
1678
|
+
return pathOption === "" || pathOption === path.delimiter ? `${result.join(path.delimiter)}${pathOption}` : [...result, pathOption].join(path.delimiter);
|
|
1708
1679
|
};
|
|
1709
1680
|
const applyPreferLocal = (result, pathParts, cwdPath) => {
|
|
1710
1681
|
for (const directory of traversePathUp(cwdPath)) {
|
|
1711
|
-
const pathPart = path
|
|
1682
|
+
const pathPart = path.join(directory, "node_modules/.bin");
|
|
1712
1683
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
1713
1684
|
}
|
|
1714
1685
|
};
|
|
1715
1686
|
const applyExecPath = (result, pathParts, execPath$1, cwdPath) => {
|
|
1716
|
-
const pathPart = path
|
|
1687
|
+
const pathPart = path.resolve(cwdPath, toPath(execPath$1), "..");
|
|
1717
1688
|
if (!pathParts.includes(pathPart)) result.push(pathPart);
|
|
1718
1689
|
};
|
|
1719
1690
|
const npmRunPathEnv = ({ env = process$1.env,...options } = {}) => {
|
|
@@ -1727,9 +1698,7 @@ const npmRunPathEnv = ({ env = process$1.env,...options } = {}) => {
|
|
|
1727
1698
|
//#endregion
|
|
1728
1699
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/return/final-error.js
|
|
1729
1700
|
const getFinalError = (originalError, message, isSync) => {
|
|
1730
|
-
|
|
1731
|
-
const options = originalError instanceof DiscardedError ? {} : { cause: originalError };
|
|
1732
|
-
return new ErrorClass(message, options);
|
|
1701
|
+
return new (isSync ? ExecaSyncError : ExecaError)(message, originalError instanceof DiscardedError ? {} : { cause: originalError });
|
|
1733
1702
|
};
|
|
1734
1703
|
var DiscardedError = class extends Error {};
|
|
1735
1704
|
const setErrorName = (ErrorClass, value) => {
|
|
@@ -2048,16 +2017,14 @@ const SIGNALS = [
|
|
|
2048
2017
|
//#region ../../node_modules/.pnpm/human-signals@8.0.0/node_modules/human-signals/build/src/signals.js
|
|
2049
2018
|
const getSignals = () => {
|
|
2050
2019
|
const realtimeSignals = getRealtimeSignals();
|
|
2051
|
-
|
|
2052
|
-
return signals$1;
|
|
2020
|
+
return [...SIGNALS, ...realtimeSignals].map(normalizeSignal$1);
|
|
2053
2021
|
};
|
|
2054
2022
|
const normalizeSignal$1 = ({ name, number: defaultNumber, description, action, forced = false, standard }) => {
|
|
2055
2023
|
const { signals: { [name]: constantSignal } } = constants;
|
|
2056
2024
|
const supported = constantSignal !== void 0;
|
|
2057
|
-
const number = supported ? constantSignal : defaultNumber;
|
|
2058
2025
|
return {
|
|
2059
2026
|
name,
|
|
2060
|
-
number,
|
|
2027
|
+
number: supported ? constantSignal : defaultNumber,
|
|
2061
2028
|
description,
|
|
2062
2029
|
supported,
|
|
2063
2030
|
action,
|
|
@@ -2469,8 +2436,7 @@ const isConnected = (anyProcess) => {
|
|
|
2469
2436
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/strict.js
|
|
2470
2437
|
const handleSendStrict = ({ anyProcess, channel, isSubprocess, message, strict }) => {
|
|
2471
2438
|
if (!strict) return message;
|
|
2472
|
-
const
|
|
2473
|
-
const hasListeners = hasMessageListeners(anyProcess, ipcEmitter);
|
|
2439
|
+
const hasListeners = hasMessageListeners(anyProcess, getIpcEmitter(anyProcess, channel, isSubprocess));
|
|
2474
2440
|
return {
|
|
2475
2441
|
id: count++,
|
|
2476
2442
|
type: REQUEST_TYPE,
|
|
@@ -2543,11 +2509,9 @@ const RESPONSE_TYPE = "execa:ipc:response";
|
|
|
2543
2509
|
const startSendMessage = (anyProcess, wrappedMessage, strict) => {
|
|
2544
2510
|
if (!OUTGOING_MESSAGES.has(anyProcess)) OUTGOING_MESSAGES.set(anyProcess, /* @__PURE__ */ new Set());
|
|
2545
2511
|
const outgoingMessages = OUTGOING_MESSAGES.get(anyProcess);
|
|
2546
|
-
const onMessageSent = createDeferred();
|
|
2547
|
-
const id = strict ? wrappedMessage.id : void 0;
|
|
2548
2512
|
const outgoingMessage = {
|
|
2549
|
-
onMessageSent,
|
|
2550
|
-
id
|
|
2513
|
+
onMessageSent: createDeferred(),
|
|
2514
|
+
id: strict ? wrappedMessage.id : void 0
|
|
2551
2515
|
};
|
|
2552
2516
|
outgoingMessages.add(outgoingMessage);
|
|
2553
2517
|
return {
|
|
@@ -2708,8 +2672,7 @@ const throwOnGracefulCancel = ({ subprocess, cancelSignal, gracefulCancel, force
|
|
|
2708
2672
|
})] : [];
|
|
2709
2673
|
const sendOnAbort = async ({ subprocess, cancelSignal, forceKillAfterDelay, context, controller: { signal } }) => {
|
|
2710
2674
|
await onAbortedSignal(cancelSignal, signal);
|
|
2711
|
-
|
|
2712
|
-
await sendAbort(subprocess, reason);
|
|
2675
|
+
await sendAbort(subprocess, getReason(cancelSignal));
|
|
2713
2676
|
killOnTimeout({
|
|
2714
2677
|
kill: subprocess.kill,
|
|
2715
2678
|
forceKillAfterDelay,
|
|
@@ -2756,7 +2719,7 @@ const mapNode = ({ options }) => {
|
|
|
2756
2719
|
const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = false, nodePath = execPath, nodeOptions = execArgv.filter((nodeOption) => !nodeOption.startsWith("--inspect")), cwd, execPath: formerNodePath,...options }) => {
|
|
2757
2720
|
if (formerNodePath !== void 0) throw new TypeError("The \"execPath\" option has been removed. Please use the \"nodePath\" option instead.");
|
|
2758
2721
|
const normalizedNodePath = safeNormalizeFileUrl(nodePath, "The \"nodePath\" option");
|
|
2759
|
-
const resolvedNodePath = path
|
|
2722
|
+
const resolvedNodePath = path.resolve(cwd, normalizedNodePath);
|
|
2760
2723
|
const newOptions = {
|
|
2761
2724
|
...options,
|
|
2762
2725
|
nodePath: resolvedNodePath,
|
|
@@ -2768,7 +2731,7 @@ const handleNodeOption = (file, commandArguments, { node: shouldHandleNode = fal
|
|
|
2768
2731
|
commandArguments,
|
|
2769
2732
|
newOptions
|
|
2770
2733
|
];
|
|
2771
|
-
if (path
|
|
2734
|
+
if (path.basename(file, ".exe") === "node") throw new TypeError("When the \"node\" option is true, the first argument does not need to be \"node\".");
|
|
2772
2735
|
return [
|
|
2773
2736
|
resolvedNodePath,
|
|
2774
2737
|
[
|
|
@@ -2855,7 +2818,7 @@ const serializeEncoding = (encoding) => typeof encoding === "string" ? `"${encod
|
|
|
2855
2818
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/arguments/cwd.js
|
|
2856
2819
|
const normalizeCwd = (cwd = getDefaultCwd()) => {
|
|
2857
2820
|
const cwdString = safeNormalizeFileUrl(cwd, "The \"cwd\" option");
|
|
2858
|
-
return path
|
|
2821
|
+
return path.resolve(cwdString);
|
|
2859
2822
|
};
|
|
2860
2823
|
const getDefaultCwd = () => {
|
|
2861
2824
|
try {
|
|
@@ -2883,8 +2846,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
2883
2846
|
rawOptions.cwd = normalizeCwd(rawOptions.cwd);
|
|
2884
2847
|
const [processedFile, processedArguments, processedOptions] = handleNodeOption(filePath, rawArguments, rawOptions);
|
|
2885
2848
|
const { command: file, args: commandArguments, options: initialOptions } = import_cross_spawn.default._parse(processedFile, processedArguments, processedOptions);
|
|
2886
|
-
const
|
|
2887
|
-
const options = addDefaultOptions(fdOptions);
|
|
2849
|
+
const options = addDefaultOptions(normalizeFdSpecificOptions(initialOptions));
|
|
2888
2850
|
validateTimeout(options);
|
|
2889
2851
|
validateEncoding(options);
|
|
2890
2852
|
validateIpcInputOption(options);
|
|
@@ -2895,7 +2857,7 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
2895
2857
|
options.killSignal = normalizeKillSignal(options.killSignal);
|
|
2896
2858
|
options.forceKillAfterDelay = normalizeForceKillAfterDelay(options.forceKillAfterDelay);
|
|
2897
2859
|
options.lines = options.lines.map((lines, fdNumber) => lines && !BINARY_ENCODINGS.has(options.encoding) && options.buffer[fdNumber]);
|
|
2898
|
-
if (process$1.platform === "win32" && path
|
|
2860
|
+
if (process$1.platform === "win32" && path.basename(file, ".exe") === "cmd") commandArguments.unshift("/q");
|
|
2899
2861
|
return {
|
|
2900
2862
|
file,
|
|
2901
2863
|
commandArguments,
|
|
@@ -3041,7 +3003,7 @@ const u = Object.create(a, {
|
|
|
3041
3003
|
}
|
|
3042
3004
|
});
|
|
3043
3005
|
function h({ preventCancel: r = !1 } = {}) {
|
|
3044
|
-
const
|
|
3006
|
+
const t = new c(this.getReader(), r), s = Object.create(u);
|
|
3045
3007
|
return s[n] = t, s;
|
|
3046
3008
|
}
|
|
3047
3009
|
|
|
@@ -3090,18 +3052,14 @@ const getStreamContents$1 = async (stream, { init, convertChunk, getSize, trunca
|
|
|
3090
3052
|
const state = init();
|
|
3091
3053
|
state.length = 0;
|
|
3092
3054
|
try {
|
|
3093
|
-
for await (const chunk of asyncIterable) {
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3097
|
-
|
|
3098
|
-
|
|
3099
|
-
|
|
3100
|
-
|
|
3101
|
-
addChunk,
|
|
3102
|
-
maxBuffer
|
|
3103
|
-
});
|
|
3104
|
-
}
|
|
3055
|
+
for await (const chunk of asyncIterable) appendChunk({
|
|
3056
|
+
convertedChunk: convertChunk[getChunkType(chunk)](chunk, state),
|
|
3057
|
+
state,
|
|
3058
|
+
getSize,
|
|
3059
|
+
truncateChunk,
|
|
3060
|
+
addChunk,
|
|
3061
|
+
maxBuffer
|
|
3062
|
+
});
|
|
3105
3063
|
appendFinalChunk({
|
|
3106
3064
|
state,
|
|
3107
3065
|
convertChunk,
|
|
@@ -3291,10 +3249,9 @@ const stringMethods = {
|
|
|
3291
3249
|
const handleMaxBuffer = ({ error: error$1, stream, readableObjectMode, lines, encoding, fdNumber }) => {
|
|
3292
3250
|
if (!(error$1 instanceof MaxBufferError)) throw error$1;
|
|
3293
3251
|
if (fdNumber === "all") return error$1;
|
|
3294
|
-
const unit = getMaxBufferUnit(readableObjectMode, lines, encoding);
|
|
3295
3252
|
error$1.maxBufferInfo = {
|
|
3296
3253
|
fdNumber,
|
|
3297
|
-
unit
|
|
3254
|
+
unit: getMaxBufferUnit(readableObjectMode, lines, encoding)
|
|
3298
3255
|
};
|
|
3299
3256
|
stream.destroy();
|
|
3300
3257
|
throw error$1;
|
|
@@ -3364,19 +3321,16 @@ const createMessages = ({ stdio, all, ipcOutput, originalError, signal, signalDe
|
|
|
3364
3321
|
killSignal
|
|
3365
3322
|
});
|
|
3366
3323
|
const originalMessage = getOriginalMessage(originalError, cwd);
|
|
3367
|
-
const
|
|
3368
|
-
const shortMessage = `${prefix}: ${escapedCommand}${suffix}`;
|
|
3369
|
-
const messageStdio = all === void 0 ? [stdio[2], stdio[1]] : [all];
|
|
3370
|
-
const message = [
|
|
3371
|
-
shortMessage,
|
|
3372
|
-
...messageStdio,
|
|
3373
|
-
...stdio.slice(3),
|
|
3374
|
-
ipcOutput.map((ipcMessage) => serializeIpcMessage(ipcMessage)).join("\n")
|
|
3375
|
-
].map((messagePart) => escapeLines(stripFinalNewline(serializeMessagePart(messagePart)))).filter(Boolean).join("\n\n");
|
|
3324
|
+
const shortMessage = `${prefix}: ${escapedCommand}${originalMessage === void 0 ? "" : `\n${originalMessage}`}`;
|
|
3376
3325
|
return {
|
|
3377
3326
|
originalMessage,
|
|
3378
3327
|
shortMessage,
|
|
3379
|
-
message
|
|
3328
|
+
message: [
|
|
3329
|
+
shortMessage,
|
|
3330
|
+
...all === void 0 ? [stdio[2], stdio[1]] : [all],
|
|
3331
|
+
...stdio.slice(3),
|
|
3332
|
+
ipcOutput.map((ipcMessage) => serializeIpcMessage(ipcMessage)).join("\n")
|
|
3333
|
+
].map((messagePart) => escapeLines(stripFinalNewline(serializeMessagePart(messagePart)))).filter(Boolean).join("\n\n")
|
|
3380
3334
|
};
|
|
3381
3335
|
};
|
|
3382
3336
|
const getErrorPrefix = ({ originalError, timedOut, timeout, isMaxBuffer, maxBuffer, errorCode, signal, signalDescription, exitCode, isCanceled, isGracefullyCanceled, isForcefullyTerminated, forceKillAfterDelay, killSignal }) => {
|
|
@@ -3397,8 +3351,7 @@ const getErrorPrefix = ({ originalError, timedOut, timeout, isMaxBuffer, maxBuff
|
|
|
3397
3351
|
const getForcefulSuffix = (isForcefullyTerminated, forceKillAfterDelay) => isForcefullyTerminated ? ` and was forcefully terminated after ${forceKillAfterDelay} milliseconds` : "";
|
|
3398
3352
|
const getOriginalMessage = (originalError, cwd) => {
|
|
3399
3353
|
if (originalError instanceof DiscardedError) return;
|
|
3400
|
-
const
|
|
3401
|
-
const escapedOriginalMessage = escapeLines(fixCwdError(originalMessage, cwd));
|
|
3354
|
+
const escapedOriginalMessage = escapeLines(fixCwdError(isExecaError(originalError) ? originalError.originalMessage : String(originalError?.message ?? originalError), cwd));
|
|
3402
3355
|
return escapedOriginalMessage === "" ? void 0 : escapedOriginalMessage;
|
|
3403
3356
|
};
|
|
3404
3357
|
const serializeIpcMessage = (ipcMessage) => typeof ipcMessage === "string" ? ipcMessage : inspect(ipcMessage);
|
|
@@ -3520,11 +3473,10 @@ const omitUndefinedProperties = (result) => Object.fromEntries(Object.entries(re
|
|
|
3520
3473
|
const normalizeExitPayload = (rawExitCode, rawSignal) => {
|
|
3521
3474
|
const exitCode = rawExitCode === null ? void 0 : rawExitCode;
|
|
3522
3475
|
const signal = rawSignal === null ? void 0 : rawSignal;
|
|
3523
|
-
const signalDescription = signal === void 0 ? void 0 : getSignalDescription(rawSignal);
|
|
3524
3476
|
return {
|
|
3525
3477
|
exitCode,
|
|
3526
3478
|
signal,
|
|
3527
|
-
signalDescription
|
|
3479
|
+
signalDescription: signal === void 0 ? void 0 : getSignalDescription(rawSignal)
|
|
3528
3480
|
};
|
|
3529
3481
|
};
|
|
3530
3482
|
|
|
@@ -3589,8 +3541,7 @@ function prettyMilliseconds(milliseconds, options) {
|
|
|
3589
3541
|
let result = [];
|
|
3590
3542
|
const floorDecimals = (value, decimalDigits) => {
|
|
3591
3543
|
const flooredInterimValue = Math.floor(value * 10 ** decimalDigits + SECOND_ROUNDING_EPSILON);
|
|
3592
|
-
|
|
3593
|
-
return flooredValue.toFixed(decimalDigits);
|
|
3544
|
+
return (Math.round(flooredInterimValue) / 10 ** decimalDigits).toFixed(decimalDigits);
|
|
3594
3545
|
};
|
|
3595
3546
|
const add = (value, long, short, valueString) => {
|
|
3596
3547
|
if ((result.length === 0 || !options.colonNotation) && isZero(value) && !(options.colonNotation && short === "m")) return;
|
|
@@ -3627,14 +3578,11 @@ function prettyMilliseconds(milliseconds, options) {
|
|
|
3627
3578
|
} else {
|
|
3628
3579
|
const millisecondsAndBelow = milliseconds$1 + microseconds / 1e3 + nanoseconds / 1e6;
|
|
3629
3580
|
const millisecondsDecimalDigits = typeof options.millisecondsDecimalDigits === "number" ? options.millisecondsDecimalDigits : 0;
|
|
3630
|
-
const
|
|
3631
|
-
const millisecondsString = millisecondsDecimalDigits ? millisecondsAndBelow.toFixed(millisecondsDecimalDigits) : roundedMilliseconds;
|
|
3581
|
+
const millisecondsString = millisecondsDecimalDigits ? millisecondsAndBelow.toFixed(millisecondsDecimalDigits) : millisecondsAndBelow >= 1 ? Math.round(millisecondsAndBelow) : Math.ceil(millisecondsAndBelow);
|
|
3632
3582
|
add(Number.parseFloat(millisecondsString), "millisecond", "ms", millisecondsString);
|
|
3633
3583
|
}
|
|
3634
3584
|
} else {
|
|
3635
|
-
const
|
|
3636
|
-
const secondsDecimalDigits = typeof options.secondsDecimalDigits === "number" ? options.secondsDecimalDigits : 1;
|
|
3637
|
-
const secondsFixed = floorDecimals(seconds, secondsDecimalDigits);
|
|
3585
|
+
const secondsFixed = floorDecimals((isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds) / 1e3 % 60, typeof options.secondsDecimalDigits === "number" ? options.secondsDecimalDigits : 1);
|
|
3638
3586
|
const secondsString = options.keepDecimalsOnWholeSeconds ? secondsFixed : secondsFixed.replace(/\.0+$/, "");
|
|
3639
3587
|
add(Number.parseFloat(secondsString), "second", "s", secondsString);
|
|
3640
3588
|
}
|
|
@@ -3663,10 +3611,9 @@ const logResult = (result, verboseInfo) => {
|
|
|
3663
3611
|
logDuration(result, verboseInfo);
|
|
3664
3612
|
};
|
|
3665
3613
|
const logDuration = (result, verboseInfo) => {
|
|
3666
|
-
const verboseMessage = `(done in ${prettyMilliseconds(result.durationMs)})`;
|
|
3667
3614
|
verboseLog({
|
|
3668
3615
|
type: "duration",
|
|
3669
|
-
verboseMessage
|
|
3616
|
+
verboseMessage: `(done in ${prettyMilliseconds(result.durationMs)})`,
|
|
3670
3617
|
verboseInfo,
|
|
3671
3618
|
result
|
|
3672
3619
|
});
|
|
@@ -3793,18 +3740,16 @@ const TYPE_TO_MESSAGE = {
|
|
|
3793
3740
|
const getTransformObjectModes = (objectMode, index, newTransforms, direction) => direction === "output" ? getOutputObjectModes(objectMode, index, newTransforms) : getInputObjectModes(objectMode, index, newTransforms);
|
|
3794
3741
|
const getOutputObjectModes = (objectMode, index, newTransforms) => {
|
|
3795
3742
|
const writableObjectMode = index !== 0 && newTransforms[index - 1].value.readableObjectMode;
|
|
3796
|
-
const readableObjectMode = objectMode ?? writableObjectMode;
|
|
3797
3743
|
return {
|
|
3798
3744
|
writableObjectMode,
|
|
3799
|
-
readableObjectMode
|
|
3745
|
+
readableObjectMode: objectMode ?? writableObjectMode
|
|
3800
3746
|
};
|
|
3801
3747
|
};
|
|
3802
3748
|
const getInputObjectModes = (objectMode, index, newTransforms) => {
|
|
3803
3749
|
const writableObjectMode = index === 0 ? objectMode === true : newTransforms[index - 1].value.readableObjectMode;
|
|
3804
|
-
const readableObjectMode = index !== newTransforms.length - 1 && (objectMode ?? writableObjectMode);
|
|
3805
3750
|
return {
|
|
3806
3751
|
writableObjectMode,
|
|
3807
|
-
readableObjectMode
|
|
3752
|
+
readableObjectMode: index !== newTransforms.length - 1 && (objectMode ?? writableObjectMode)
|
|
3808
3753
|
};
|
|
3809
3754
|
};
|
|
3810
3755
|
const getFdObjectMode = (stdioItems, direction) => {
|
|
@@ -4113,8 +4058,7 @@ const validateDuplicateStreamSync = ({ otherStdioItems, type, value, optionName,
|
|
|
4113
4058
|
const getDuplicateStreamInstance = ({ otherStdioItems, type, value, optionName, direction }) => {
|
|
4114
4059
|
const duplicateStdioItems = otherStdioItems.filter((stdioItem) => hasSameValue(stdioItem, value));
|
|
4115
4060
|
if (duplicateStdioItems.length === 0) return;
|
|
4116
|
-
|
|
4117
|
-
throwOnDuplicateStream(differentStdioItem, optionName, type);
|
|
4061
|
+
throwOnDuplicateStream(duplicateStdioItems.find((stdioItem) => stdioItem.direction !== direction), optionName, type);
|
|
4118
4062
|
return direction === "output" ? duplicateStdioItems[0].stream : void 0;
|
|
4119
4063
|
};
|
|
4120
4064
|
const hasSameValue = ({ type, value }, secondValue) => {
|
|
@@ -4123,8 +4067,7 @@ const hasSameValue = ({ type, value }, secondValue) => {
|
|
|
4123
4067
|
return value === secondValue;
|
|
4124
4068
|
};
|
|
4125
4069
|
const validateDuplicateTransform = ({ otherStdioItems, type, value, optionName }) => {
|
|
4126
|
-
|
|
4127
|
-
throwOnDuplicateStream(duplicateStdioItem, optionName, type);
|
|
4070
|
+
throwOnDuplicateStream(otherStdioItems.find(({ value: { transform } }) => transform === value.transform), optionName, type);
|
|
4128
4071
|
};
|
|
4129
4072
|
const throwOnDuplicateStream = (stdioItem, optionName, type) => {
|
|
4130
4073
|
if (stdioItem !== void 0) throw new TypeError(`The \`${stdioItem.optionName}\` and \`${optionName}\` options must not target ${TYPE_TO_MESSAGE[type]} that is the same.`);
|
|
@@ -4133,15 +4076,13 @@ const throwOnDuplicateStream = (stdioItem, optionName, type) => {
|
|
|
4133
4076
|
//#endregion
|
|
4134
4077
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/stdio/handle.js
|
|
4135
4078
|
const handleStdio = (addProperties$2, options, verboseInfo, isSync) => {
|
|
4136
|
-
const stdio = normalizeStdioOption(options, verboseInfo, isSync);
|
|
4137
|
-
const initialFileDescriptors = stdio.map((stdioOption, fdNumber) => getFileDescriptor({
|
|
4138
|
-
stdioOption,
|
|
4139
|
-
fdNumber,
|
|
4140
|
-
options,
|
|
4141
|
-
isSync
|
|
4142
|
-
}));
|
|
4143
4079
|
const fileDescriptors = getFinalFileDescriptors({
|
|
4144
|
-
initialFileDescriptors,
|
|
4080
|
+
initialFileDescriptors: normalizeStdioOption(options, verboseInfo, isSync).map((stdioOption, fdNumber) => getFileDescriptor({
|
|
4081
|
+
stdioOption,
|
|
4082
|
+
fdNumber,
|
|
4083
|
+
options,
|
|
4084
|
+
isSync
|
|
4085
|
+
})),
|
|
4145
4086
|
addProperties: addProperties$2,
|
|
4146
4087
|
options,
|
|
4147
4088
|
isSync
|
|
@@ -4158,14 +4099,13 @@ const getFileDescriptor = ({ stdioOption, fdNumber, options, isSync }) => {
|
|
|
4158
4099
|
optionName
|
|
4159
4100
|
});
|
|
4160
4101
|
const direction = getStreamDirection(initialStdioItems, fdNumber, optionName);
|
|
4161
|
-
const
|
|
4102
|
+
const normalizedStdioItems = normalizeTransforms(initialStdioItems.map((stdioItem) => handleNativeStream({
|
|
4162
4103
|
stdioItem,
|
|
4163
4104
|
isStdioArray,
|
|
4164
4105
|
fdNumber,
|
|
4165
4106
|
direction,
|
|
4166
4107
|
isSync
|
|
4167
|
-
}));
|
|
4168
|
-
const normalizedStdioItems = normalizeTransforms(stdioItems, optionName, direction, options);
|
|
4108
|
+
})), optionName, direction, options);
|
|
4169
4109
|
const objectMode = getFdObjectMode(normalizedStdioItems, direction);
|
|
4170
4110
|
validateFileObjectMode(normalizedStdioItems, objectMode);
|
|
4171
4111
|
return {
|
|
@@ -4175,9 +4115,7 @@ const getFileDescriptor = ({ stdioOption, fdNumber, options, isSync }) => {
|
|
|
4175
4115
|
};
|
|
4176
4116
|
};
|
|
4177
4117
|
const initializeStdioItems = ({ stdioOption, fdNumber, options, optionName }) => {
|
|
4178
|
-
const
|
|
4179
|
-
const initialStdioItems = [...values.map((value) => initializeStdioItem(value, optionName)), ...handleInputOptions(options, fdNumber)];
|
|
4180
|
-
const stdioItems = filterDuplicates(initialStdioItems);
|
|
4118
|
+
const stdioItems = filterDuplicates([...(Array.isArray(stdioOption) ? stdioOption : [stdioOption]).map((value) => initializeStdioItem(value, optionName)), ...handleInputOptions(options, fdNumber)]);
|
|
4181
4119
|
const isStdioArray = stdioItems.length > 1;
|
|
4182
4120
|
validateStdioArray(stdioItems, isStdioArray, optionName);
|
|
4183
4121
|
validateStreams(stdioItems);
|
|
@@ -4227,18 +4165,17 @@ const getFinalFileDescriptors = ({ initialFileDescriptors, addProperties: addPro
|
|
|
4227
4165
|
}
|
|
4228
4166
|
};
|
|
4229
4167
|
const getFinalFileDescriptor = ({ fileDescriptor: { direction, objectMode, stdioItems }, fileDescriptors, addProperties: addProperties$2, options, isSync }) => {
|
|
4230
|
-
const finalStdioItems = stdioItems.map((stdioItem) => addStreamProperties({
|
|
4231
|
-
stdioItem,
|
|
4232
|
-
addProperties: addProperties$2,
|
|
4233
|
-
direction,
|
|
4234
|
-
options,
|
|
4235
|
-
fileDescriptors,
|
|
4236
|
-
isSync
|
|
4237
|
-
}));
|
|
4238
4168
|
return {
|
|
4239
4169
|
direction,
|
|
4240
4170
|
objectMode,
|
|
4241
|
-
stdioItems:
|
|
4171
|
+
stdioItems: stdioItems.map((stdioItem) => addStreamProperties({
|
|
4172
|
+
stdioItem,
|
|
4173
|
+
addProperties: addProperties$2,
|
|
4174
|
+
direction,
|
|
4175
|
+
options,
|
|
4176
|
+
fileDescriptors,
|
|
4177
|
+
isSync
|
|
4178
|
+
}))
|
|
4242
4179
|
};
|
|
4243
4180
|
};
|
|
4244
4181
|
const addStreamProperties = ({ stdioItem, addProperties: addProperties$2, direction, options, fileDescriptors, isSync }) => {
|
|
@@ -4368,8 +4305,7 @@ const appendNewlineGenerator = function* ({ isWindowsNewline = false }, chunk) {
|
|
|
4368
4305
|
yield chunk;
|
|
4369
4306
|
return;
|
|
4370
4307
|
}
|
|
4371
|
-
|
|
4372
|
-
yield concatBytes(chunk, newline);
|
|
4308
|
+
yield concatBytes(chunk, isWindowsNewline ? windowsNewline : unixNewline);
|
|
4373
4309
|
};
|
|
4374
4310
|
const concatString = (firstChunk, secondChunk) => `${firstChunk}${secondChunk}`;
|
|
4375
4311
|
const linesStringInfo = {
|
|
@@ -4514,7 +4450,7 @@ const generatorToStream = ({ value, value: { transform, final, writableObjectMod
|
|
|
4514
4450
|
const transformMethod = transformAsync ? pushChunks.bind(void 0, transformChunk, state) : pushChunksSync.bind(void 0, transformChunkSync);
|
|
4515
4451
|
const finalMethod = transformAsync || finalAsync ? pushChunks.bind(void 0, finalChunks, state) : pushChunksSync.bind(void 0, finalChunksSync);
|
|
4516
4452
|
const destroyMethod = transformAsync || finalAsync ? destroyTransform.bind(void 0, state) : void 0;
|
|
4517
|
-
|
|
4453
|
+
return { stream: new Transform({
|
|
4518
4454
|
writableObjectMode,
|
|
4519
4455
|
writableHighWaterMark: getDefaultHighWaterMark(writableObjectMode),
|
|
4520
4456
|
readableObjectMode,
|
|
@@ -4530,16 +4466,12 @@ const generatorToStream = ({ value, value: { transform, final, writableObjectMod
|
|
|
4530
4466
|
finalMethod([generators], this, done);
|
|
4531
4467
|
},
|
|
4532
4468
|
destroy: destroyMethod
|
|
4533
|
-
});
|
|
4534
|
-
return { stream };
|
|
4469
|
+
}) };
|
|
4535
4470
|
};
|
|
4536
4471
|
const runGeneratorsSync = (chunks, stdioItems, encoding, isInput) => {
|
|
4537
4472
|
const generators = stdioItems.filter(({ type }) => type === "generator");
|
|
4538
4473
|
const reversedGenerators = isInput ? generators.reverse() : generators;
|
|
4539
|
-
for (const { value, optionName } of reversedGenerators)
|
|
4540
|
-
const generators$1 = addInternalGenerators(value, encoding, optionName);
|
|
4541
|
-
chunks = runTransformSync(generators$1, chunks);
|
|
4542
|
-
}
|
|
4474
|
+
for (const { value, optionName } of reversedGenerators) chunks = runTransformSync(addInternalGenerators(value, encoding, optionName), chunks);
|
|
4543
4475
|
return chunks;
|
|
4544
4476
|
};
|
|
4545
4477
|
const addInternalGenerators = ({ transform, final, binary, writableObjectMode, readableObjectMode, preserveNewlines }, encoding, optionName) => {
|
|
@@ -4576,9 +4508,7 @@ const addInputOptionSync = (fileDescriptors, fdNumber, options) => {
|
|
|
4576
4508
|
const [{ type, optionName }] = allStdioItems;
|
|
4577
4509
|
throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be ${TYPE_TO_MESSAGE[type]} with synchronous methods.`);
|
|
4578
4510
|
}
|
|
4579
|
-
|
|
4580
|
-
const transformedContents = allContents.map((contents) => applySingleInputGeneratorsSync(contents, stdioItems));
|
|
4581
|
-
options.input = joinToUint8Array(transformedContents);
|
|
4511
|
+
options.input = joinToUint8Array(allStdioItems.map(({ contents }) => contents).map((contents) => applySingleInputGeneratorsSync(contents, stdioItems)));
|
|
4582
4512
|
};
|
|
4583
4513
|
const applySingleInputGeneratorsSync = (contents, stdioItems) => {
|
|
4584
4514
|
const newContents = runGeneratorsSync(contents, stdioItems, "utf8", true);
|
|
@@ -4603,10 +4533,9 @@ const logLinesSync = (linesArray, fdNumber, verboseInfo) => {
|
|
|
4603
4533
|
};
|
|
4604
4534
|
const isPipingStream = (stream) => stream._readableState.pipes.length > 0;
|
|
4605
4535
|
const logLine = (line, fdNumber, verboseInfo) => {
|
|
4606
|
-
const verboseMessage = serializeVerboseMessage(line);
|
|
4607
4536
|
verboseLog({
|
|
4608
4537
|
type: "output",
|
|
4609
|
-
verboseMessage,
|
|
4538
|
+
verboseMessage: serializeVerboseMessage(line),
|
|
4610
4539
|
fdNumber,
|
|
4611
4540
|
verboseInfo
|
|
4612
4541
|
});
|
|
@@ -4618,28 +4547,25 @@ const transformOutputSync = ({ fileDescriptors, syncResult: { output }, options,
|
|
|
4618
4547
|
if (output === null) return { output: Array.from({ length: 3 }) };
|
|
4619
4548
|
const state = {};
|
|
4620
4549
|
const outputFiles = /* @__PURE__ */ new Set([]);
|
|
4621
|
-
const transformedOutput = output.map((result, fdNumber) => transformOutputResultSync({
|
|
4622
|
-
result,
|
|
4623
|
-
fileDescriptors,
|
|
4624
|
-
fdNumber,
|
|
4625
|
-
state,
|
|
4626
|
-
outputFiles,
|
|
4627
|
-
isMaxBuffer,
|
|
4628
|
-
verboseInfo
|
|
4629
|
-
}, options));
|
|
4630
4550
|
return {
|
|
4631
|
-
output:
|
|
4551
|
+
output: output.map((result, fdNumber) => transformOutputResultSync({
|
|
4552
|
+
result,
|
|
4553
|
+
fileDescriptors,
|
|
4554
|
+
fdNumber,
|
|
4555
|
+
state,
|
|
4556
|
+
outputFiles,
|
|
4557
|
+
isMaxBuffer,
|
|
4558
|
+
verboseInfo
|
|
4559
|
+
}, options)),
|
|
4632
4560
|
...state
|
|
4633
4561
|
};
|
|
4634
4562
|
};
|
|
4635
4563
|
const transformOutputResultSync = ({ result, fileDescriptors, fdNumber, state, outputFiles, isMaxBuffer, verboseInfo }, { buffer, encoding, lines, stripFinalNewline: stripFinalNewline$1, maxBuffer }) => {
|
|
4636
4564
|
if (result === null) return;
|
|
4637
|
-
const
|
|
4638
|
-
const uint8ArrayResult = bufferToUint8Array(truncatedResult);
|
|
4565
|
+
const uint8ArrayResult = bufferToUint8Array(truncateMaxBufferSync(result, isMaxBuffer, maxBuffer));
|
|
4639
4566
|
const { stdioItems, objectMode } = fileDescriptors[fdNumber];
|
|
4640
|
-
const chunks = runOutputGeneratorsSync([uint8ArrayResult], stdioItems, encoding, state);
|
|
4641
4567
|
const { serializedResult, finalResult = serializedResult } = serializeChunks({
|
|
4642
|
-
chunks,
|
|
4568
|
+
chunks: runOutputGeneratorsSync([uint8ArrayResult], stdioItems, encoding, state),
|
|
4643
4569
|
objectMode,
|
|
4644
4570
|
encoding,
|
|
4645
4571
|
lines,
|
|
@@ -4750,14 +4676,12 @@ const isFailedExit = (exitCode, signal) => exitCode !== 0 || signal !== null;
|
|
|
4750
4676
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/resolve/exit-sync.js
|
|
4751
4677
|
const getExitResultSync = ({ error: error$1, status: exitCode, signal, output }, { maxBuffer }) => {
|
|
4752
4678
|
const resultError = getResultError(error$1, exitCode, signal);
|
|
4753
|
-
const timedOut = resultError?.code === "ETIMEDOUT";
|
|
4754
|
-
const isMaxBuffer = isMaxBufferSync(resultError, output, maxBuffer);
|
|
4755
4679
|
return {
|
|
4756
4680
|
resultError,
|
|
4757
4681
|
exitCode,
|
|
4758
4682
|
signal,
|
|
4759
|
-
timedOut,
|
|
4760
|
-
isMaxBuffer
|
|
4683
|
+
timedOut: resultError?.code === "ETIMEDOUT",
|
|
4684
|
+
isMaxBuffer: isMaxBufferSync(resultError, output, maxBuffer)
|
|
4761
4685
|
};
|
|
4762
4686
|
};
|
|
4763
4687
|
const getResultError = (error$1, exitCode, signal) => {
|
|
@@ -4769,7 +4693,7 @@ const getResultError = (error$1, exitCode, signal) => {
|
|
|
4769
4693
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/methods/main-sync.js
|
|
4770
4694
|
const execaCoreSync = (rawFile, rawArguments, rawOptions) => {
|
|
4771
4695
|
const { file, commandArguments, command, escapedCommand, startTime, verboseInfo, options, fileDescriptors } = handleSyncArguments(rawFile, rawArguments, rawOptions);
|
|
4772
|
-
|
|
4696
|
+
return handleResult(spawnSubprocessSync({
|
|
4773
4697
|
file,
|
|
4774
4698
|
commandArguments,
|
|
4775
4699
|
options,
|
|
@@ -4778,15 +4702,12 @@ const execaCoreSync = (rawFile, rawArguments, rawOptions) => {
|
|
|
4778
4702
|
verboseInfo,
|
|
4779
4703
|
fileDescriptors,
|
|
4780
4704
|
startTime
|
|
4781
|
-
});
|
|
4782
|
-
return handleResult(result, verboseInfo, options);
|
|
4705
|
+
}), verboseInfo, options);
|
|
4783
4706
|
};
|
|
4784
4707
|
const handleSyncArguments = (rawFile, rawArguments, rawOptions) => {
|
|
4785
4708
|
const { command, escapedCommand, startTime, verboseInfo } = handleCommand(rawFile, rawArguments, rawOptions);
|
|
4786
|
-
const
|
|
4787
|
-
const { file, commandArguments, options } = normalizeOptions(rawFile, rawArguments, syncOptions);
|
|
4709
|
+
const { file, commandArguments, options } = normalizeOptions(rawFile, rawArguments, normalizeSyncOptions(rawOptions));
|
|
4788
4710
|
validateSyncOptions(options);
|
|
4789
|
-
const fileDescriptors = handleStdioSync(options, verboseInfo);
|
|
4790
4711
|
return {
|
|
4791
4712
|
file,
|
|
4792
4713
|
commandArguments,
|
|
@@ -4795,7 +4716,7 @@ const handleSyncArguments = (rawFile, rawArguments, rawOptions) => {
|
|
|
4795
4716
|
startTime,
|
|
4796
4717
|
verboseInfo,
|
|
4797
4718
|
options,
|
|
4798
|
-
fileDescriptors
|
|
4719
|
+
fileDescriptors: handleStdioSync(options, verboseInfo)
|
|
4799
4720
|
};
|
|
4800
4721
|
};
|
|
4801
4722
|
const normalizeSyncOptions = (options) => options.node && !options.ipc ? {
|
|
@@ -4830,16 +4751,14 @@ const spawnSubprocessSync = ({ file, commandArguments, options, command, escaped
|
|
|
4830
4751
|
isMaxBuffer,
|
|
4831
4752
|
verboseInfo
|
|
4832
4753
|
});
|
|
4833
|
-
const stdio = output.map((stdioOutput, fdNumber) => stripNewline(stdioOutput, options, fdNumber));
|
|
4834
|
-
const all = stripNewline(getAllSync(output, options), options, "all");
|
|
4835
4754
|
return getSyncResult({
|
|
4836
4755
|
error: error$1,
|
|
4837
4756
|
exitCode,
|
|
4838
4757
|
signal,
|
|
4839
4758
|
timedOut,
|
|
4840
4759
|
isMaxBuffer,
|
|
4841
|
-
stdio,
|
|
4842
|
-
all,
|
|
4760
|
+
stdio: output.map((stdioOutput, fdNumber) => stripNewline(stdioOutput, options, fdNumber)),
|
|
4761
|
+
all: stripNewline(getAllSync(output, options), options, "all"),
|
|
4843
4762
|
options,
|
|
4844
4763
|
command,
|
|
4845
4764
|
escapedCommand,
|
|
@@ -4849,8 +4768,7 @@ const spawnSubprocessSync = ({ file, commandArguments, options, command, escaped
|
|
|
4849
4768
|
const runSubprocessSync = ({ file, commandArguments, options, command, escapedCommand, fileDescriptors, startTime }) => {
|
|
4850
4769
|
try {
|
|
4851
4770
|
addInputOptionsSync(fileDescriptors, options);
|
|
4852
|
-
|
|
4853
|
-
return spawnSync(file, commandArguments, normalizedOptions);
|
|
4771
|
+
return spawnSync(file, commandArguments, normalizeSpawnSyncOptions(options));
|
|
4854
4772
|
} catch (error$1) {
|
|
4855
4773
|
return makeEarlyError({
|
|
4856
4774
|
error: error$1,
|
|
@@ -5068,19 +4986,17 @@ const handleEarlyError = ({ error: error$1, command, escapedCommand, fileDescrip
|
|
|
5068
4986
|
writable,
|
|
5069
4987
|
duplex
|
|
5070
4988
|
});
|
|
5071
|
-
const earlyError = makeEarlyError({
|
|
5072
|
-
error: error$1,
|
|
5073
|
-
command,
|
|
5074
|
-
escapedCommand,
|
|
5075
|
-
fileDescriptors,
|
|
5076
|
-
options,
|
|
5077
|
-
startTime,
|
|
5078
|
-
isSync: false
|
|
5079
|
-
});
|
|
5080
|
-
const promise = handleDummyPromise(earlyError, verboseInfo, options);
|
|
5081
4989
|
return {
|
|
5082
4990
|
subprocess,
|
|
5083
|
-
promise
|
|
4991
|
+
promise: handleDummyPromise(makeEarlyError({
|
|
4992
|
+
error: error$1,
|
|
4993
|
+
command,
|
|
4994
|
+
escapedCommand,
|
|
4995
|
+
fileDescriptors,
|
|
4996
|
+
options,
|
|
4997
|
+
startTime,
|
|
4998
|
+
isSync: false
|
|
4999
|
+
}), verboseInfo, options)
|
|
5084
5000
|
};
|
|
5085
5001
|
};
|
|
5086
5002
|
const createDummyStreams = (subprocess, fileDescriptors) => {
|
|
@@ -5129,8 +5045,7 @@ const addProperties = {
|
|
|
5129
5045
|
nodeStream: ({ value }) => ({ stream: value }),
|
|
5130
5046
|
webTransform({ value: { transform, writableObjectMode, readableObjectMode } }) {
|
|
5131
5047
|
const objectMode = writableObjectMode || readableObjectMode;
|
|
5132
|
-
|
|
5133
|
-
return { stream };
|
|
5048
|
+
return { stream: Duplex.fromWeb(transform, { objectMode }) };
|
|
5134
5049
|
},
|
|
5135
5050
|
duplex: ({ value: { transform } }) => ({ stream: transform }),
|
|
5136
5051
|
native() {}
|
|
@@ -5376,10 +5291,7 @@ const pipeOutputAsync = (subprocess, fileDescriptors, controller) => {
|
|
|
5376
5291
|
controller
|
|
5377
5292
|
});
|
|
5378
5293
|
}
|
|
5379
|
-
for (const [outputStream, inputStreams] of pipeGroups.entries())
|
|
5380
|
-
const inputStream = inputStreams.length === 1 ? inputStreams[0] : mergeStreams(inputStreams);
|
|
5381
|
-
pipeStreams(inputStream, outputStream);
|
|
5382
|
-
}
|
|
5294
|
+
for (const [outputStream, inputStreams] of pipeGroups.entries()) pipeStreams(inputStreams.length === 1 ? inputStreams[0] : mergeStreams(inputStreams), outputStream);
|
|
5383
5295
|
};
|
|
5384
5296
|
const pipeTransform = (subprocess, stream, direction, fdNumber) => {
|
|
5385
5297
|
if (direction === "output") pipeStreams(subprocess.stdio[fdNumber], stream);
|
|
@@ -5641,10 +5553,9 @@ const normalizePipeArguments = ({ source, sourcePromise, boundOptions, createNes
|
|
|
5641
5553
|
const getDestinationStream = (boundOptions, createNested, pipeArguments) => {
|
|
5642
5554
|
try {
|
|
5643
5555
|
const { destination, pipeOptions: { from, to, unpipeSignal } = {} } = getDestination(boundOptions, createNested, ...pipeArguments);
|
|
5644
|
-
const destinationStream = getToStream(destination, to);
|
|
5645
5556
|
return {
|
|
5646
5557
|
destination,
|
|
5647
|
-
destinationStream,
|
|
5558
|
+
destinationStream: getToStream(destination, to),
|
|
5648
5559
|
from,
|
|
5649
5560
|
unpipeSignal
|
|
5650
5561
|
};
|
|
@@ -5653,19 +5564,15 @@ const getDestinationStream = (boundOptions, createNested, pipeArguments) => {
|
|
|
5653
5564
|
}
|
|
5654
5565
|
};
|
|
5655
5566
|
const getDestination = (boundOptions, createNested, firstArgument, ...pipeArguments) => {
|
|
5656
|
-
if (Array.isArray(firstArgument)) {
|
|
5657
|
-
|
|
5658
|
-
|
|
5659
|
-
|
|
5660
|
-
pipeOptions: boundOptions
|
|
5661
|
-
};
|
|
5662
|
-
}
|
|
5567
|
+
if (Array.isArray(firstArgument)) return {
|
|
5568
|
+
destination: createNested(mapDestinationArguments, boundOptions)(firstArgument, ...pipeArguments),
|
|
5569
|
+
pipeOptions: boundOptions
|
|
5570
|
+
};
|
|
5663
5571
|
if (typeof firstArgument === "string" || firstArgument instanceof URL || isDenoExecPath(firstArgument)) {
|
|
5664
5572
|
if (Object.keys(boundOptions).length > 0) throw new TypeError("Please use .pipe(\"file\", ..., options) or .pipe(execa(\"file\", ..., options)) instead of .pipe(options)(\"file\", ...).");
|
|
5665
5573
|
const [rawFile, rawArguments, rawOptions] = normalizeParameters(firstArgument, ...pipeArguments);
|
|
5666
|
-
const destination = createNested(mapDestinationArguments)(rawFile, rawArguments, rawOptions);
|
|
5667
5574
|
return {
|
|
5668
|
-
destination,
|
|
5575
|
+
destination: createNested(mapDestinationArguments)(rawFile, rawArguments, rawOptions),
|
|
5669
5576
|
pipeOptions: rawOptions
|
|
5670
5577
|
};
|
|
5671
5578
|
}
|
|
@@ -5685,8 +5592,7 @@ const mapDestinationArguments = ({ options }) => ({ options: {
|
|
|
5685
5592
|
} });
|
|
5686
5593
|
const getSourceStream = (source, from) => {
|
|
5687
5594
|
try {
|
|
5688
|
-
|
|
5689
|
-
return { sourceStream };
|
|
5595
|
+
return { sourceStream: getFromStream(source, from) };
|
|
5690
5596
|
} catch (error$1) {
|
|
5691
5597
|
return { sourceError: error$1 };
|
|
5692
5598
|
}
|
|
@@ -5780,9 +5686,8 @@ const unpipeOnAbort = (unpipeSignal, unpipeContext) => unpipeSignal === void 0 ?
|
|
|
5780
5686
|
const unpipeOnSignalAbort = async (unpipeSignal, { sourceStream, mergedStream, fileDescriptors, sourceOptions, startTime }) => {
|
|
5781
5687
|
await aborted(unpipeSignal, sourceStream);
|
|
5782
5688
|
await mergedStream.remove(sourceStream);
|
|
5783
|
-
const error$1 = /* @__PURE__ */ new Error("Pipe canceled by `unpipeSignal` option.");
|
|
5784
5689
|
throw createNonCommandError({
|
|
5785
|
-
error:
|
|
5690
|
+
error: /* @__PURE__ */ new Error("Pipe canceled by `unpipeSignal` option."),
|
|
5786
5691
|
fileDescriptors,
|
|
5787
5692
|
sourceOptions,
|
|
5788
5693
|
startTime
|
|
@@ -5885,13 +5790,12 @@ const stopReadingOnStreamEnd = async (onStreamEnd, controller, stream) => {
|
|
|
5885
5790
|
}
|
|
5886
5791
|
};
|
|
5887
5792
|
const iterateOnStream = ({ stream, controller, binary, shouldEncode, encoding, shouldSplit, preserveNewlines }) => {
|
|
5888
|
-
const onStdoutChunk = on(stream, "data", {
|
|
5889
|
-
signal: controller.signal,
|
|
5890
|
-
highWaterMark: HIGH_WATER_MARK,
|
|
5891
|
-
highWatermark: HIGH_WATER_MARK
|
|
5892
|
-
});
|
|
5893
5793
|
return iterateOnData({
|
|
5894
|
-
onStdoutChunk,
|
|
5794
|
+
onStdoutChunk: on(stream, "data", {
|
|
5795
|
+
signal: controller.signal,
|
|
5796
|
+
highWaterMark: HIGH_WATER_MARK,
|
|
5797
|
+
highWatermark: HIGH_WATER_MARK
|
|
5798
|
+
}),
|
|
5895
5799
|
controller,
|
|
5896
5800
|
binary,
|
|
5897
5801
|
shouldEncode,
|
|
@@ -5936,13 +5840,12 @@ const getStreamOutput = async ({ stream, onStreamEnd, fdNumber, encoding, buffer
|
|
|
5936
5840
|
await Promise.all([resumeStream(stream), logPromise]);
|
|
5937
5841
|
return;
|
|
5938
5842
|
}
|
|
5939
|
-
const stripFinalNewlineValue = getStripFinalNewline(stripFinalNewline$1, fdNumber);
|
|
5940
5843
|
const iterable = iterateForResult({
|
|
5941
5844
|
stream,
|
|
5942
5845
|
onStreamEnd,
|
|
5943
5846
|
lines,
|
|
5944
5847
|
encoding,
|
|
5945
|
-
stripFinalNewline:
|
|
5848
|
+
stripFinalNewline: getStripFinalNewline(stripFinalNewline$1, fdNumber),
|
|
5946
5849
|
allMixed
|
|
5947
5850
|
});
|
|
5948
5851
|
const [output] = await Promise.all([getStreamContents({
|
|
@@ -5962,15 +5865,14 @@ const logOutputAsync = async ({ stream, onStreamEnd, fdNumber, encoding, allMixe
|
|
|
5962
5865
|
verboseInfo,
|
|
5963
5866
|
fdNumber
|
|
5964
5867
|
})) return;
|
|
5965
|
-
|
|
5868
|
+
await logLines(iterateForResult({
|
|
5966
5869
|
stream,
|
|
5967
5870
|
onStreamEnd,
|
|
5968
5871
|
lines: true,
|
|
5969
5872
|
encoding,
|
|
5970
5873
|
stripFinalNewline: true,
|
|
5971
5874
|
allMixed
|
|
5972
|
-
});
|
|
5973
|
-
await logLines(linesIterable, stream, fdNumber, verboseInfo);
|
|
5875
|
+
}), stream, fdNumber, verboseInfo);
|
|
5974
5876
|
};
|
|
5975
5877
|
const resumeStream = async (stream) => {
|
|
5976
5878
|
await setImmediate();
|
|
@@ -6120,10 +6022,9 @@ const getAllMixed = ({ all, stdout, stderr }) => all && stdout && stderr && stdo
|
|
|
6120
6022
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/ipc.js
|
|
6121
6023
|
const shouldLogIpc = (verboseInfo) => isFullVerbose(verboseInfo, "ipc");
|
|
6122
6024
|
const logIpcOutput = (message, verboseInfo) => {
|
|
6123
|
-
const verboseMessage = serializeVerboseMessage(message);
|
|
6124
6025
|
verboseLog({
|
|
6125
6026
|
type: "ipc",
|
|
6126
|
-
verboseMessage,
|
|
6027
|
+
verboseMessage: serializeVerboseMessage(message),
|
|
6127
6028
|
fdNumber: "ipc",
|
|
6128
6029
|
verboseInfo
|
|
6129
6030
|
});
|
|
@@ -6266,9 +6167,8 @@ const addConcurrentStream = (concurrentStreams, stream, waitName) => {
|
|
|
6266
6167
|
const promises = weakMap.get(stream);
|
|
6267
6168
|
const promise = createDeferred();
|
|
6268
6169
|
promises.push(promise);
|
|
6269
|
-
const resolve = promise.resolve.bind(promise);
|
|
6270
6170
|
return {
|
|
6271
|
-
resolve,
|
|
6171
|
+
resolve: promise.resolve.bind(promise),
|
|
6272
6172
|
promises
|
|
6273
6173
|
};
|
|
6274
6174
|
};
|
|
@@ -6349,10 +6249,9 @@ const createReadable = ({ subprocess, concurrentStreams, encoding }, { from, bin
|
|
|
6349
6249
|
};
|
|
6350
6250
|
const getSubprocessStdout = (subprocess, from, concurrentStreams) => {
|
|
6351
6251
|
const subprocessStdout = getFromStream(subprocess, from);
|
|
6352
|
-
const waitReadableDestroy = addConcurrentStream(concurrentStreams, subprocessStdout, "readableDestroy");
|
|
6353
6252
|
return {
|
|
6354
6253
|
subprocessStdout,
|
|
6355
|
-
waitReadableDestroy
|
|
6254
|
+
waitReadableDestroy: addConcurrentStream(concurrentStreams, subprocessStdout, "readableDestroy")
|
|
6356
6255
|
};
|
|
6357
6256
|
};
|
|
6358
6257
|
const getReadableOptions = ({ readableEncoding, readableObjectMode, readableHighWaterMark }, binary) => binary ? {
|
|
@@ -6430,12 +6329,10 @@ const createWritable = ({ subprocess, concurrentStreams }, { to } = {}) => {
|
|
|
6430
6329
|
};
|
|
6431
6330
|
const getSubprocessStdin = (subprocess, to, concurrentStreams) => {
|
|
6432
6331
|
const subprocessStdin = getToStream(subprocess, to);
|
|
6433
|
-
const waitWritableFinal = addConcurrentStream(concurrentStreams, subprocessStdin, "writableFinal");
|
|
6434
|
-
const waitWritableDestroy = addConcurrentStream(concurrentStreams, subprocessStdin, "writableDestroy");
|
|
6435
6332
|
return {
|
|
6436
6333
|
subprocessStdin,
|
|
6437
|
-
waitWritableFinal,
|
|
6438
|
-
waitWritableDestroy
|
|
6334
|
+
waitWritableFinal: addConcurrentStream(concurrentStreams, subprocessStdin, "writableFinal"),
|
|
6335
|
+
waitWritableDestroy: addConcurrentStream(concurrentStreams, subprocessStdin, "writableDestroy")
|
|
6439
6336
|
};
|
|
6440
6337
|
};
|
|
6441
6338
|
const getWritableMethods = (subprocessStdin, subprocess, waitWritableFinal) => ({
|
|
@@ -6531,15 +6428,14 @@ const onDuplexDestroy = async ({ subprocessStdout, subprocessStdin, subprocess,
|
|
|
6531
6428
|
const createIterable = (subprocess, encoding, { from, binary: binaryOption = false, preserveNewlines = false } = {}) => {
|
|
6532
6429
|
const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
|
|
6533
6430
|
const subprocessStdout = getFromStream(subprocess, from);
|
|
6534
|
-
|
|
6431
|
+
return iterateOnStdoutData(iterateOnSubprocessStream({
|
|
6535
6432
|
subprocessStdout,
|
|
6536
6433
|
subprocess,
|
|
6537
6434
|
binary,
|
|
6538
6435
|
shouldEncode: true,
|
|
6539
6436
|
encoding,
|
|
6540
6437
|
preserveNewlines
|
|
6541
|
-
});
|
|
6542
|
-
return iterateOnStdoutData(onStdoutData, subprocessStdout, subprocess);
|
|
6438
|
+
}), subprocessStdout, subprocess);
|
|
6543
6439
|
};
|
|
6544
6440
|
const iterateOnStdoutData = async function* (onStdoutData, subprocessStdout, subprocess) {
|
|
6545
6441
|
try {
|
|
@@ -6621,7 +6517,6 @@ const handleAsyncArguments = (rawFile, rawArguments, rawOptions) => {
|
|
|
6621
6517
|
const { command, escapedCommand, startTime, verboseInfo } = handleCommand(rawFile, rawArguments, rawOptions);
|
|
6622
6518
|
const { file, commandArguments, options: normalizedOptions } = normalizeOptions(rawFile, rawArguments, rawOptions);
|
|
6623
6519
|
const options = handleAsyncOptions(normalizedOptions);
|
|
6624
|
-
const fileDescriptors = handleStdioAsync(options, verboseInfo);
|
|
6625
6520
|
return {
|
|
6626
6521
|
file,
|
|
6627
6522
|
commandArguments,
|
|
@@ -6630,7 +6525,7 @@ const handleAsyncArguments = (rawFile, rawArguments, rawOptions) => {
|
|
|
6630
6525
|
startTime,
|
|
6631
6526
|
verboseInfo,
|
|
6632
6527
|
options,
|
|
6633
|
-
fileDescriptors
|
|
6528
|
+
fileDescriptors: handleStdioAsync(options, verboseInfo)
|
|
6634
6529
|
};
|
|
6635
6530
|
};
|
|
6636
6531
|
const handleAsyncOptions = ({ timeout, signal,...options }) => {
|
|
@@ -6703,22 +6598,19 @@ const handlePromise = async ({ subprocess, options, startTime, verboseInfo, file
|
|
|
6703
6598
|
});
|
|
6704
6599
|
controller.abort();
|
|
6705
6600
|
onInternalError.resolve();
|
|
6706
|
-
|
|
6707
|
-
const all = stripNewline(allResult, options, "all");
|
|
6708
|
-
const result = getAsyncResult({
|
|
6601
|
+
return handleResult(getAsyncResult({
|
|
6709
6602
|
errorInfo,
|
|
6710
6603
|
exitCode,
|
|
6711
6604
|
signal,
|
|
6712
|
-
stdio,
|
|
6713
|
-
all,
|
|
6605
|
+
stdio: stdioResults.map((stdioResult, fdNumber) => stripNewline(stdioResult, options, fdNumber)),
|
|
6606
|
+
all: stripNewline(allResult, options, "all"),
|
|
6714
6607
|
ipcOutput,
|
|
6715
6608
|
context,
|
|
6716
6609
|
options,
|
|
6717
6610
|
command,
|
|
6718
6611
|
escapedCommand,
|
|
6719
6612
|
startTime
|
|
6720
|
-
});
|
|
6721
|
-
return handleResult(result, verboseInfo, options);
|
|
6613
|
+
}), verboseInfo, options);
|
|
6722
6614
|
};
|
|
6723
6615
|
const getAsyncResult = ({ errorInfo, exitCode, signal, stdio, all, ipcOutput, context, options, command, escapedCommand, startTime }) => "error" in errorInfo ? makeError({
|
|
6724
6616
|
error: errorInfo.error,
|
|
@@ -6791,8 +6683,7 @@ const callBoundExeca = ({ mapArguments, deepOptions = {}, boundOptions = {}, set
|
|
|
6791
6683
|
return isSync ? execaCoreSync(file, commandArguments, options) : execaCoreAsync(file, commandArguments, options, createNested);
|
|
6792
6684
|
};
|
|
6793
6685
|
const parseArguments = ({ mapArguments, firstArgument, nextArguments, deepOptions, boundOptions }) => {
|
|
6794
|
-
const
|
|
6795
|
-
const [initialFile, initialArguments, initialOptions] = normalizeParameters(...callArguments);
|
|
6686
|
+
const [initialFile, initialArguments, initialOptions] = normalizeParameters(...isTemplateString(firstArgument) ? parseTemplates(firstArgument, nextArguments) : [firstArgument, ...nextArguments]);
|
|
6796
6687
|
const mergedOptions = mergeOptions(mergeOptions(deepOptions, boundOptions), initialOptions);
|
|
6797
6688
|
const { file = initialFile, commandArguments = initialArguments, options = mergedOptions, isSync = false } = mapArguments({
|
|
6798
6689
|
file: initialFile,
|
|
@@ -6864,22 +6755,6 @@ const execaNode = createExeca(mapNode);
|
|
|
6864
6755
|
const $ = createExeca(mapScriptAsync, {}, deepScriptOptions, setScriptSync);
|
|
6865
6756
|
const { sendMessage, getOneMessage, getEachMessage, getCancelSignal } = getIpcExport();
|
|
6866
6757
|
|
|
6867
|
-
//#endregion
|
|
6868
|
-
//#region src/utils/createWrangler.ts
|
|
6869
|
-
const createWrangler = ({ stdio, accountId, cloudflareApiToken, cwd }) => {
|
|
6870
|
-
const $$1 = execa({
|
|
6871
|
-
stdio,
|
|
6872
|
-
extendsEnv: true,
|
|
6873
|
-
shell: stdio === "inherit",
|
|
6874
|
-
cwd,
|
|
6875
|
-
env: {
|
|
6876
|
-
CLOUDFLARE_ACCOUNT_ID: accountId,
|
|
6877
|
-
CLOUDFLARE_API_TOKEN: cloudflareApiToken
|
|
6878
|
-
}
|
|
6879
|
-
});
|
|
6880
|
-
return (...command) => $$1("npx", ["wrangler", ...command]);
|
|
6881
|
-
};
|
|
6882
|
-
|
|
6883
6758
|
//#endregion
|
|
6884
6759
|
//#region ../../node_modules/.pnpm/mime@4.0.4/node_modules/mime/dist/types/other.js
|
|
6885
6760
|
const types$1 = {
|
|
@@ -8184,8 +8059,7 @@ var Mime = class {
|
|
|
8184
8059
|
const last = path$5.replace(/^.*[/\\]/, "").toLowerCase();
|
|
8185
8060
|
const ext = last.replace(/^.*\./, "").toLowerCase();
|
|
8186
8061
|
const hasPath = last.length < path$5.length;
|
|
8187
|
-
|
|
8188
|
-
if (!hasDot && hasPath) return null;
|
|
8062
|
+
if (!(ext.length < last.length - 1) && hasPath) return null;
|
|
8189
8063
|
return __classPrivateFieldGet(this, _Mime_extensionToType, "f").get(ext) ?? null;
|
|
8190
8064
|
}
|
|
8191
8065
|
getExtension(type) {
|
|
@@ -8219,6 +8093,22 @@ var Mime_default = Mime;
|
|
|
8219
8093
|
//#region ../../node_modules/.pnpm/mime@4.0.4/node_modules/mime/dist/src/index.js
|
|
8220
8094
|
var src_default = new Mime_default(standard_default, other_default)._freeze();
|
|
8221
8095
|
|
|
8096
|
+
//#endregion
|
|
8097
|
+
//#region src/utils/createWrangler.ts
|
|
8098
|
+
const createWrangler = ({ stdio, accountId, cloudflareApiToken, cwd }) => {
|
|
8099
|
+
const $$1 = execa({
|
|
8100
|
+
stdio,
|
|
8101
|
+
extendsEnv: true,
|
|
8102
|
+
shell: stdio === "inherit",
|
|
8103
|
+
cwd,
|
|
8104
|
+
env: {
|
|
8105
|
+
CLOUDFLARE_ACCOUNT_ID: accountId,
|
|
8106
|
+
CLOUDFLARE_API_TOKEN: cloudflareApiToken
|
|
8107
|
+
}
|
|
8108
|
+
});
|
|
8109
|
+
return (...command) => $$1("npx", ["wrangler", ...command]);
|
|
8110
|
+
};
|
|
8111
|
+
|
|
8222
8112
|
//#endregion
|
|
8223
8113
|
//#region src/r2Storage.ts
|
|
8224
8114
|
const r2Storage = (config, hooks) => (_) => {
|
|
@@ -8236,14 +8126,13 @@ const r2Storage = (config, hooks) => (_) => {
|
|
|
8236
8126
|
try {
|
|
8237
8127
|
await wrangler("r2", "object", "delete", [bucketName, Key].join("/"), "--remote");
|
|
8238
8128
|
return { storageUri: `r2://${bucketName}/${Key}` };
|
|
8239
|
-
} catch
|
|
8129
|
+
} catch {
|
|
8240
8130
|
throw new Error("Can not delete bundle");
|
|
8241
8131
|
}
|
|
8242
8132
|
},
|
|
8243
8133
|
async uploadBundle(bundleId, bundlePath) {
|
|
8244
8134
|
const contentType = src_default.getType(bundlePath) ?? void 0;
|
|
8245
|
-
const
|
|
8246
|
-
const Key = getStorageKey(bundleId, filename);
|
|
8135
|
+
const Key = getStorageKey(bundleId, path$1.basename(bundlePath));
|
|
8247
8136
|
try {
|
|
8248
8137
|
const { stderr, exitCode } = await wrangler("r2", "object", "put", [bucketName, Key].join("/"), "--file", bundlePath, ...contentType ? ["--content-type", contentType] : [], "--remote");
|
|
8249
8138
|
if (exitCode !== 0 && stderr) throw new Error(stderr);
|