@hot-updater/cloudflare 1.0.0-rc.1 → 1.0.0-rc.3
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 +281 -161
- package/dist/iac/index.d.cts +1 -5
- package/dist/iac/index.d.mts +1 -5
- package/dist/iac/index.mjs +277 -157
- package/dist/index.cjs +69 -14
- package/dist/index.d.cts +1 -3
- package/dist/index.d.mts +1 -3
- package/dist/index.mjs +67 -12
- package/dist/worker/index.cjs +71 -15
- package/dist/worker/index.d.cts +2 -3
- package/dist/worker/index.d.mts +2 -3
- package/dist/worker/index.mjs +71 -15
- package/package.json +6 -6
- package/sql/bundles.sql +29 -7
- package/src/d1Database.spec.ts +99 -0
- package/src/d1Database.ts +7 -1
- package/src/d1Implementation.spec.ts +90 -0
- package/src/d1Implementation.ts +42 -3
- package/src/d1Query.ts +3 -0
- package/src/d1Rows.spec.ts +35 -3
- package/src/d1Rows.ts +35 -0
- package/src/worker/d1Database.spec.ts +37 -1
- package/src/worker/d1Database.ts +9 -1
- package/worker/dist/README.md +1 -1
- package/worker/dist/index.js +1196 -858
- package/worker/dist/index.js.map +4 -4
- package/worker/migrations/0001_hot-updater_1.0.0.sql +30 -13
- package/worker/src/databaseMigration.integration.spec.ts +62 -1
- package/worker/src/databasePlugins.integration.spec.ts +35 -1
- package/worker/src/insightsMovement.integration.spec.ts +73 -0
package/dist/iac/index.cjs
CHANGED
|
@@ -6,7 +6,7 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
6
6
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
7
7
|
var __getProtoOf = Object.getPrototypeOf;
|
|
8
8
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
9
|
-
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
9
|
+
var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
|
|
10
10
|
var __copyProps = (to, from, except, desc) => {
|
|
11
11
|
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
12
12
|
key = keys[i];
|
|
@@ -17,21 +17,21 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
17
17
|
}
|
|
18
18
|
return to;
|
|
19
19
|
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
20
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
|
|
21
21
|
value: mod,
|
|
22
22
|
enumerable: true
|
|
23
23
|
}) : target, mod));
|
|
24
24
|
//#endregion
|
|
25
25
|
let crypto = require("crypto");
|
|
26
|
-
crypto = __toESM(crypto);
|
|
26
|
+
crypto = __toESM(crypto, 1);
|
|
27
27
|
let fs_promises = require("fs/promises");
|
|
28
|
-
fs_promises = __toESM(fs_promises);
|
|
28
|
+
fs_promises = __toESM(fs_promises, 1);
|
|
29
29
|
let path = require("path");
|
|
30
|
-
path = __toESM(path);
|
|
30
|
+
path = __toESM(path, 1);
|
|
31
31
|
let _hot_updater_cli_tools = require("@hot-updater/cli-tools");
|
|
32
32
|
let _hot_updater_server = require("@hot-updater/server");
|
|
33
33
|
let cloudflare = require("cloudflare");
|
|
34
|
-
cloudflare = __toESM(cloudflare);
|
|
34
|
+
cloudflare = __toESM(cloudflare, 1);
|
|
35
35
|
let _hot_updater_plugin_core = require("@hot-updater/plugin-core");
|
|
36
36
|
let _hot_updater_plugin_core_internal = require("@hot-updater/plugin-core/internal");
|
|
37
37
|
let node_url = require("node:url");
|
|
@@ -39,13 +39,13 @@ let node_child_process = require("node:child_process");
|
|
|
39
39
|
let node_string_decoder = require("node:string_decoder");
|
|
40
40
|
let node_util = require("node:util");
|
|
41
41
|
let node_process = require("node:process");
|
|
42
|
-
node_process = __toESM(node_process);
|
|
42
|
+
node_process = __toESM(node_process, 1);
|
|
43
43
|
let node_tty = require("node:tty");
|
|
44
|
-
node_tty = __toESM(node_tty);
|
|
44
|
+
node_tty = __toESM(node_tty, 1);
|
|
45
45
|
let node_path = require("node:path");
|
|
46
|
-
node_path = __toESM(node_path);
|
|
46
|
+
node_path = __toESM(node_path, 1);
|
|
47
47
|
let fs = require("fs");
|
|
48
|
-
fs = __toESM(fs);
|
|
48
|
+
fs = __toESM(fs, 1);
|
|
49
49
|
let node_timers_promises = require("node:timers/promises");
|
|
50
50
|
let node_os = require("node:os");
|
|
51
51
|
let node_events = require("node:events");
|
|
@@ -56,7 +56,7 @@ let node_stream = require("node:stream");
|
|
|
56
56
|
let node_buffer = require("node:buffer");
|
|
57
57
|
let cloudflare_error = require("cloudflare/error");
|
|
58
58
|
let os = require("os");
|
|
59
|
-
os = __toESM(os);
|
|
59
|
+
os = __toESM(os, 1);
|
|
60
60
|
//#region src/d1Rows.ts
|
|
61
61
|
var InvalidD1RowError = class extends Error {
|
|
62
62
|
name = "InvalidD1RowError";
|
|
@@ -164,6 +164,29 @@ const eventRow = (row) => {
|
|
|
164
164
|
received_at_ms: numberValue(row, "received_at_ms", "bundle_events")
|
|
165
165
|
};
|
|
166
166
|
};
|
|
167
|
+
const installationRow = (row) => {
|
|
168
|
+
const type = stringValue(row, "type", "bundle_installations");
|
|
169
|
+
const platform = stringValue(row, "platform", "bundle_installations");
|
|
170
|
+
if (![
|
|
171
|
+
"UPDATE_APPLIED",
|
|
172
|
+
"RECOVERED",
|
|
173
|
+
"RELEASE_ADOPTED",
|
|
174
|
+
"UNCHANGED"
|
|
175
|
+
].includes(type) || platform !== "ios" && platform !== "android") throw new InvalidD1RowError("bundle_installations");
|
|
176
|
+
return {
|
|
177
|
+
id: stringValue(row, "id", "bundle_installations"),
|
|
178
|
+
install_id: stringValue(row, "install_id", "bundle_installations"),
|
|
179
|
+
user_id: nullableString(row, "user_id", "bundle_installations"),
|
|
180
|
+
username: nullableString(row, "username", "bundle_installations"),
|
|
181
|
+
to_bundle_id: stringValue(row, "to_bundle_id", "bundle_installations"),
|
|
182
|
+
type,
|
|
183
|
+
platform,
|
|
184
|
+
app_version: stringValue(row, "app_version", "bundle_installations"),
|
|
185
|
+
channel: stringValue(row, "channel", "bundle_installations"),
|
|
186
|
+
cohort: stringValue(row, "cohort", "bundle_installations"),
|
|
187
|
+
received_at_ms: numberValue(row, "received_at_ms", "bundle_installations")
|
|
188
|
+
};
|
|
189
|
+
};
|
|
167
190
|
const apiKeyRow = (row) => {
|
|
168
191
|
const role = stringValue(row, "role", "api_keys");
|
|
169
192
|
if (role !== "client") throw new InvalidD1RowError("api_keys");
|
|
@@ -238,6 +261,7 @@ function parseD1Row(model, value) {
|
|
|
238
261
|
case "bundle_patches": return patchRow(value);
|
|
239
262
|
case "channels": return channelRow(value);
|
|
240
263
|
case "bundle_events": return eventRow(value);
|
|
264
|
+
case "bundle_installations": return installationRow(value);
|
|
241
265
|
case "api_keys": return apiKeyRow(value);
|
|
242
266
|
case "releases": return releaseRow(value);
|
|
243
267
|
case "release_catalogs": return releaseCatalogRow(value);
|
|
@@ -274,7 +298,8 @@ const stringPredicate = (condition, operator) => {
|
|
|
274
298
|
};
|
|
275
299
|
}
|
|
276
300
|
const literal = escapeLikePattern(condition.value);
|
|
277
|
-
const
|
|
301
|
+
const pattern = operator === "contains" ? `%${literal}%` : operator === "starts_with" ? `${literal}%` : `%${literal}`;
|
|
302
|
+
const parameter = bind(pattern);
|
|
278
303
|
return {
|
|
279
304
|
sql: `lower(${condition.field}) LIKE lower(${parameter.sql}) ESCAPE '\\'`,
|
|
280
305
|
params: parameter.params
|
|
@@ -359,11 +384,13 @@ const d1TableNames = {
|
|
|
359
384
|
bundle_patches: "bundle_patches",
|
|
360
385
|
channels: "channels",
|
|
361
386
|
bundle_events: "bundle_events",
|
|
387
|
+
bundle_installations: "bundle_installations",
|
|
362
388
|
api_keys: "api_keys",
|
|
363
389
|
release_catalogs: "release_catalogs",
|
|
364
390
|
releases: "releases"
|
|
365
391
|
};
|
|
366
392
|
var D1QueryResultError = class extends Error {
|
|
393
|
+
result;
|
|
367
394
|
name = "D1QueryResultError";
|
|
368
395
|
operation = "count";
|
|
369
396
|
constructor(result) {
|
|
@@ -394,6 +421,7 @@ const findManyD1Rows = async (executor, input) => {
|
|
|
394
421
|
case "bundle_patches": return rows.map((row) => parseD1Row("bundle_patches", row));
|
|
395
422
|
case "channels": return rows.map((row) => parseD1Row("channels", row));
|
|
396
423
|
case "bundle_events": return rows.map((row) => parseD1Row("bundle_events", row));
|
|
424
|
+
case "bundle_installations": return rows.map((row) => parseD1Row("bundle_installations", row));
|
|
397
425
|
case "api_keys": return rows.map((row) => parseD1Row("api_keys", row));
|
|
398
426
|
case "releases": return rows.map((row) => parseD1Row("releases", row));
|
|
399
427
|
case "release_catalogs": return rows.map((row) => parseD1Row("release_catalogs", row));
|
|
@@ -401,6 +429,12 @@ const findManyD1Rows = async (executor, input) => {
|
|
|
401
429
|
};
|
|
402
430
|
//#endregion
|
|
403
431
|
//#region src/d1Implementation.ts
|
|
432
|
+
var D1ExecutionError = class extends Error {
|
|
433
|
+
name = "D1ExecutionError";
|
|
434
|
+
constructor() {
|
|
435
|
+
super("D1 did not successfully execute every requested statement");
|
|
436
|
+
}
|
|
437
|
+
};
|
|
404
438
|
const EXPECTATION_CONFLICT_MARKER = "HOT_UPDATER_COMMIT_EXPECTATION_CONFLICT";
|
|
405
439
|
const expectationGuard = (expectations) => {
|
|
406
440
|
const clauses = [];
|
|
@@ -438,7 +472,8 @@ const expectationConflict = async (executor, expectations) => {
|
|
|
438
472
|
const versionField = isRelease ? "revision" : "generation";
|
|
439
473
|
const key = isRelease ? expectation.id : expectation.scopeKey;
|
|
440
474
|
const expectedVersion = isRelease ? expectation.revision : expectation.generation;
|
|
441
|
-
const
|
|
475
|
+
const rows = await executor.query(`SELECT ${versionField} FROM ${table} WHERE ${keyField} = json_extract(?, '$') LIMIT 1`, encodeD1Values([key]));
|
|
476
|
+
const actualVersion = readVersion(rows[0], versionField);
|
|
442
477
|
if (actualVersion !== expectedVersion) return {
|
|
443
478
|
committed: false,
|
|
444
479
|
conflict: {
|
|
@@ -517,14 +552,14 @@ const insertQuery = (input, guard, conflictMode = "returnExisting") => {
|
|
|
517
552
|
values = channelValues(input.data);
|
|
518
553
|
break;
|
|
519
554
|
case "bundle_events":
|
|
555
|
+
case "bundle_installations":
|
|
520
556
|
case "api_keys":
|
|
521
557
|
case "release_catalogs":
|
|
522
558
|
case "releases":
|
|
523
559
|
columns = Object.keys(input.data);
|
|
524
560
|
values = Object.values(input.data);
|
|
525
|
-
break;
|
|
526
561
|
}
|
|
527
|
-
const conflict = input.onConflict !== "ignore" ? "" : input.model === "channels" ? conflictMode === "ignore" ? " ON CONFLICT(name) DO NOTHING" : " ON CONFLICT(name) DO UPDATE SET name = excluded.name" : input.model === "api_keys" ? conflictMode === "ignore" ? " ON CONFLICT(hash) DO NOTHING" : " ON CONFLICT(hash) DO UPDATE SET hash = excluded.hash" : "";
|
|
562
|
+
const conflict = input.onConflict !== "ignore" ? "" : input.model === "channels" ? conflictMode === "ignore" ? " ON CONFLICT(name) DO NOTHING" : " ON CONFLICT(name) DO UPDATE SET name = excluded.name" : input.model === "api_keys" ? conflictMode === "ignore" ? " ON CONFLICT(hash) DO NOTHING" : " ON CONFLICT(hash) DO UPDATE SET hash = excluded.hash" : " ON CONFLICT(install_id) DO UPDATE SET install_id = excluded.install_id";
|
|
528
563
|
return {
|
|
529
564
|
sql: `INSERT INTO ${d1TableNames[input.model]} (${columns.join(", ")}) ${guard === void 0 ? `VALUES (${d1Placeholders(values.length)})` : `SELECT ${d1Placeholders(values.length)} WHERE ${guard.sql}`}${conflict} RETURNING *`,
|
|
530
565
|
params: [...encodeD1Values(values), ...guard?.params ?? []]
|
|
@@ -588,9 +623,7 @@ const channelDeletePrecondition = (changes, changeIndex, channelId) => {
|
|
|
588
623
|
releaseEffects.set(change.row.id, change.row.channel_id);
|
|
589
624
|
break;
|
|
590
625
|
case "update": break;
|
|
591
|
-
case "delete":
|
|
592
|
-
releaseEffects.set(change.where.id, null);
|
|
593
|
-
break;
|
|
626
|
+
case "delete": releaseEffects.set(change.where.id, null);
|
|
594
627
|
}
|
|
595
628
|
}
|
|
596
629
|
return {
|
|
@@ -665,10 +698,6 @@ const changeQuery = (change, guard) => {
|
|
|
665
698
|
sql: `DELETE FROM channels WHERE id = json_extract(?, '$') AND NOT EXISTS (SELECT 1 FROM releases WHERE channel_id = json_extract(?, '$')) AND ${guard.sql}`,
|
|
666
699
|
params: [...encodeD1Values([change.where.id, change.where.id]), ...guard.params]
|
|
667
700
|
};
|
|
668
|
-
case "analytics": return insertQuery({
|
|
669
|
-
model: "bundle_events",
|
|
670
|
-
data: change.row
|
|
671
|
-
}, guard);
|
|
672
701
|
case "apiKeys": return change.operation === "insert" ? insertQuery({
|
|
673
702
|
model: "api_keys",
|
|
674
703
|
data: change.row,
|
|
@@ -837,6 +866,25 @@ const deleteChannel = async (executor, input) => {
|
|
|
837
866
|
};
|
|
838
867
|
};
|
|
839
868
|
const createD1Implementation = (executor) => ({
|
|
869
|
+
async recordInsights({ event, installation }) {
|
|
870
|
+
const columns = Object.keys(installation);
|
|
871
|
+
const eventInsert = insertQuery({
|
|
872
|
+
model: "bundle_events",
|
|
873
|
+
data: event
|
|
874
|
+
});
|
|
875
|
+
await executor.batch([{
|
|
876
|
+
sql: `INSERT INTO bundle_installations (${columns.join(", ")})
|
|
877
|
+
SELECT ${d1Placeholders(columns.length)}
|
|
878
|
+
WHERE NOT EXISTS (SELECT 1 FROM bundle_events WHERE id = json_extract(?, '$'))
|
|
879
|
+
ON CONFLICT(install_id) DO UPDATE SET ${columns.filter((column) => column !== "install_id").map((column) => `${column} = excluded.${column}`).join(", ")}
|
|
880
|
+
WHERE (excluded.received_at_ms, excluded.id) >
|
|
881
|
+
(bundle_installations.received_at_ms, bundle_installations.id)`,
|
|
882
|
+
params: encodeD1Values([...Object.values(installation), event.id])
|
|
883
|
+
}, {
|
|
884
|
+
...eventInsert,
|
|
885
|
+
sql: eventInsert.sql.replace(" RETURNING *", " ON CONFLICT(id) DO NOTHING")
|
|
886
|
+
}]);
|
|
887
|
+
},
|
|
840
888
|
async create(input) {
|
|
841
889
|
const query = insertQuery(input);
|
|
842
890
|
const rows = await executor.query(query.sql, query.params);
|
|
@@ -845,6 +893,7 @@ const createD1Implementation = (executor) => ({
|
|
|
845
893
|
case "bundle_patches": return parseD1Row("bundle_patches", rows[0]);
|
|
846
894
|
case "channels": return parseD1Row("channels", rows[0]);
|
|
847
895
|
case "bundle_events": return parseD1Row("bundle_events", rows[0]);
|
|
896
|
+
case "bundle_installations": return parseD1Row("bundle_installations", rows[0]);
|
|
848
897
|
case "api_keys": return parseD1Row("api_keys", rows[0]);
|
|
849
898
|
case "releases": return parseD1Row("releases", rows[0]);
|
|
850
899
|
case "release_catalogs": return parseD1Row("release_catalogs", rows[0]);
|
|
@@ -859,6 +908,7 @@ const createD1Implementation = (executor) => ({
|
|
|
859
908
|
case "api_keys": return parseD1Row("api_keys", rows[0]);
|
|
860
909
|
case "releases": return parseD1Row("releases", rows[0]);
|
|
861
910
|
case "release_catalogs": return parseD1Row("release_catalogs", rows[0]);
|
|
911
|
+
case "bundle_installations": return parseD1Row("bundle_installations", rows[0]);
|
|
862
912
|
}
|
|
863
913
|
},
|
|
864
914
|
async delete(input) {
|
|
@@ -877,6 +927,7 @@ const createD1Implementation = (executor) => ({
|
|
|
877
927
|
case "api_keys": return parseD1Row("api_keys", rows[0]);
|
|
878
928
|
case "releases": return parseD1Row("releases", rows[0]);
|
|
879
929
|
case "release_catalogs": return parseD1Row("release_catalogs", rows[0]);
|
|
930
|
+
case "bundle_installations": return parseD1Row("bundle_installations", rows[0]);
|
|
880
931
|
}
|
|
881
932
|
},
|
|
882
933
|
findMany: (input) => findManyD1Rows(executor, input),
|
|
@@ -926,7 +977,11 @@ const d1Database = (config) => {
|
|
|
926
977
|
};
|
|
927
978
|
const page = await cloudflare$1.d1.database.query(config.databaseId, { ...body });
|
|
928
979
|
const results = [];
|
|
929
|
-
for await (const resultPage of page.iterPages()) for (const result of resultPage.result)
|
|
980
|
+
for await (const resultPage of page.iterPages()) for (const result of resultPage.result) {
|
|
981
|
+
if (result.success === false) throw new D1ExecutionError();
|
|
982
|
+
results.push(result.results ?? []);
|
|
983
|
+
}
|
|
984
|
+
if (results.length !== statements.length) throw new D1ExecutionError();
|
|
930
985
|
return results;
|
|
931
986
|
};
|
|
932
987
|
const adapter = (0, _hot_updater_plugin_core_internal.createDatabasePluginAdapter)("d1Database", createD1Implementation({
|
|
@@ -1044,7 +1099,8 @@ const parseTemplate = ({ templates, expressions, tokens, index, template }) => {
|
|
|
1044
1099
|
const newTokens = concatTokens(tokens, nextTokens, leadingWhitespaces);
|
|
1045
1100
|
if (index === expressions.length) return newTokens;
|
|
1046
1101
|
const expression = expressions[index];
|
|
1047
|
-
|
|
1102
|
+
const expressionTokens = Array.isArray(expression) ? expression.map((expression) => parseExpression(expression)) : [parseExpression(expression)];
|
|
1103
|
+
return concatTokens(newTokens, expressionTokens, trailingWhitespaces);
|
|
1048
1104
|
};
|
|
1049
1105
|
const splitByWhitespaces = (template, rawTemplate) => {
|
|
1050
1106
|
if (rawTemplate.length === 0) return {
|
|
@@ -1077,7 +1133,7 @@ const splitByWhitespaces = (template, rawTemplate) => {
|
|
|
1077
1133
|
trailingWhitespaces
|
|
1078
1134
|
};
|
|
1079
1135
|
};
|
|
1080
|
-
const DELIMITERS = new Set([
|
|
1136
|
+
const DELIMITERS = /* @__PURE__ */ new Set([
|
|
1081
1137
|
" ",
|
|
1082
1138
|
" ",
|
|
1083
1139
|
"\r",
|
|
@@ -1129,7 +1185,8 @@ const normalizeFdSpecificOptions = (options) => {
|
|
|
1129
1185
|
};
|
|
1130
1186
|
const normalizeFdSpecificOption = (options, optionName) => {
|
|
1131
1187
|
const optionBaseArray = Array.from({ length: getStdioLength(options) + 1 });
|
|
1132
|
-
|
|
1188
|
+
const optionArray = normalizeFdSpecificValue(options[optionName], optionBaseArray, optionName);
|
|
1189
|
+
return addDefaultValue$1(optionArray, optionName);
|
|
1133
1190
|
};
|
|
1134
1191
|
const getStdioLength = ({ stdio }) => Array.isArray(stdio) ? Math.max(stdio.length, STANDARD_STREAMS_ALIASES.length) : STANDARD_STREAMS_ALIASES.length;
|
|
1135
1192
|
const normalizeFdSpecificValue = (optionValue, optionArray, optionName) => isPlainObject(optionValue) ? normalizeOptionObject(optionValue, optionArray, optionName) : optionArray.fill(optionValue);
|
|
@@ -1162,7 +1219,7 @@ const addDefaultValue$1 = (optionArray, optionName) => optionArray.map((optionVa
|
|
|
1162
1219
|
const DEFAULT_OPTIONS = {
|
|
1163
1220
|
lines: false,
|
|
1164
1221
|
buffer: true,
|
|
1165
|
-
maxBuffer:
|
|
1222
|
+
maxBuffer: 1e8,
|
|
1166
1223
|
verbose: (0, node_util.debuglog)("execa").enabled ? "full" : "none",
|
|
1167
1224
|
stripFinalNewline: true
|
|
1168
1225
|
};
|
|
@@ -1210,7 +1267,7 @@ const escapeControlCharacter = (character) => {
|
|
|
1210
1267
|
};
|
|
1211
1268
|
const getSpecialCharRegExp = () => {
|
|
1212
1269
|
try {
|
|
1213
|
-
return
|
|
1270
|
+
return new RegExp("\\p{Separator}|\\p{Other}", "gu");
|
|
1214
1271
|
} catch {
|
|
1215
1272
|
return /[\s\u0000-\u001F\u007F-\u009F\u00AD]/g;
|
|
1216
1273
|
}
|
|
@@ -1630,11 +1687,13 @@ const appendNewline = (printedLine) => printedLine.endsWith("\n") ? printedLine
|
|
|
1630
1687
|
//#endregion
|
|
1631
1688
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/log.js
|
|
1632
1689
|
const verboseLog = ({ type, verboseMessage, fdNumber, verboseInfo, result }) => {
|
|
1633
|
-
const
|
|
1690
|
+
const verboseObject = getVerboseObject({
|
|
1634
1691
|
type,
|
|
1635
1692
|
result,
|
|
1636
1693
|
verboseInfo
|
|
1637
|
-
})
|
|
1694
|
+
});
|
|
1695
|
+
const printedLines = getPrintedLines(verboseMessage, verboseObject);
|
|
1696
|
+
const finalLines = applyVerboseOnLines(printedLines, verboseInfo, fdNumber);
|
|
1638
1697
|
if (finalLines !== "") console.warn(finalLines.slice(0, -1));
|
|
1639
1698
|
};
|
|
1640
1699
|
const getVerboseObject = ({ type, result, verboseInfo: { escapedCommand, commandId, rawOptions: { piped = false, ...options } } }) => ({
|
|
@@ -1657,7 +1716,8 @@ const getPrintedLine = (verboseObject) => {
|
|
|
1657
1716
|
};
|
|
1658
1717
|
};
|
|
1659
1718
|
const serializeVerboseMessage = (message) => {
|
|
1660
|
-
|
|
1719
|
+
const messageString = typeof message === "string" ? message : (0, node_util.inspect)(message);
|
|
1720
|
+
return escapeLines(messageString).replaceAll(" ", " ".repeat(TAB_SIZE));
|
|
1661
1721
|
};
|
|
1662
1722
|
const TAB_SIZE = 2;
|
|
1663
1723
|
//#endregion
|
|
@@ -1702,7 +1762,8 @@ const getDurationMs = (startTime) => Number(node_process.hrtime.bigint() - start
|
|
|
1702
1762
|
const handleCommand = (filePath, rawArguments, rawOptions) => {
|
|
1703
1763
|
const startTime = getStartTime();
|
|
1704
1764
|
const { command, escapedCommand } = joinCommand(filePath, rawArguments);
|
|
1705
|
-
const
|
|
1765
|
+
const verbose = normalizeFdSpecificOption(rawOptions, "verbose");
|
|
1766
|
+
const verboseInfo = getVerboseInfo(verbose, escapedCommand, { ...rawOptions });
|
|
1706
1767
|
logCommand(escapedCommand, verboseInfo);
|
|
1707
1768
|
return {
|
|
1708
1769
|
command,
|
|
@@ -1823,7 +1884,8 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1823
1884
|
const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
|
|
1824
1885
|
const getPathInfo = (cmd, opt) => {
|
|
1825
1886
|
const colon = opt.colon || COLON;
|
|
1826
|
-
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
1887
|
+
const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
|
|
1888
|
+
/* istanbul ignore next: very unusual */ "").split(colon)];
|
|
1827
1889
|
const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
1828
1890
|
const pathExt = isWindows ? pathExtExe.split(colon) : [""];
|
|
1829
1891
|
if (isWindows) {
|
|
@@ -1848,14 +1910,17 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1848
1910
|
const ppRaw = pathEnv[i];
|
|
1849
1911
|
const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
|
|
1850
1912
|
const pCmd = path$13.join(pathPart, cmd);
|
|
1851
|
-
|
|
1913
|
+
const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
|
|
1914
|
+
resolve(subStep(p, i, 0));
|
|
1852
1915
|
});
|
|
1853
1916
|
const subStep = (p, i, ii) => new Promise((resolve, reject) => {
|
|
1854
1917
|
if (ii === pathExt.length) return resolve(step(i + 1));
|
|
1855
1918
|
const ext = pathExt[ii];
|
|
1856
1919
|
isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
|
|
1857
|
-
if (!er && is)
|
|
1858
|
-
|
|
1920
|
+
if (!er && is) {
|
|
1921
|
+
if (opt.all) found.push(p + ext);
|
|
1922
|
+
else return resolve(p + ext);
|
|
1923
|
+
}
|
|
1859
1924
|
return resolve(subStep(p, i, ii + 1));
|
|
1860
1925
|
});
|
|
1861
1926
|
});
|
|
@@ -1873,8 +1938,10 @@ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
1873
1938
|
for (let j = 0; j < pathExt.length; j++) {
|
|
1874
1939
|
const cur = p + pathExt[j];
|
|
1875
1940
|
try {
|
|
1876
|
-
if (isexe.sync(cur, { pathExt: pathExtExe }))
|
|
1877
|
-
|
|
1941
|
+
if (isexe.sync(cur, { pathExt: pathExtExe })) {
|
|
1942
|
+
if (opt.all) found.push(cur);
|
|
1943
|
+
else return cur;
|
|
1944
|
+
}
|
|
1878
1945
|
} catch (ex) {}
|
|
1879
1946
|
}
|
|
1880
1947
|
}
|
|
@@ -2565,7 +2632,7 @@ const normalizeForceKillAfterDelay = (forceKillAfterDelay) => {
|
|
|
2565
2632
|
if (!Number.isFinite(forceKillAfterDelay) || forceKillAfterDelay < 0) throw new TypeError(`Expected the \`forceKillAfterDelay\` option to be a non-negative integer, got \`${forceKillAfterDelay}\` (${typeof forceKillAfterDelay})`);
|
|
2566
2633
|
return forceKillAfterDelay;
|
|
2567
2634
|
};
|
|
2568
|
-
const DEFAULT_FORCE_KILL_TIMEOUT =
|
|
2635
|
+
const DEFAULT_FORCE_KILL_TIMEOUT = 5e3;
|
|
2569
2636
|
const subprocessKill = ({ kill, options: { forceKillAfterDelay, killSignal }, onInternalError, context, controller }, signalOrError, errorArgument) => {
|
|
2570
2637
|
const { signal, error } = parseKillArguments(signalOrError, errorArgument, killSignal);
|
|
2571
2638
|
emitKillError(error, onInternalError);
|
|
@@ -2667,7 +2734,7 @@ const handleSerializationError = ({ error, methodName, isSubprocess, message })
|
|
|
2667
2734
|
if (isSerializationError(error)) throw new Error(`${getMethodName(methodName, isSubprocess)}'s argument type is invalid: the message cannot be serialized: ${String(message)}.`, { cause: error });
|
|
2668
2735
|
};
|
|
2669
2736
|
const isSerializationError = ({ code, message }) => SERIALIZATION_ERROR_CODES.has(code) || SERIALIZATION_ERROR_MESSAGES.some((serializationErrorMessage) => message.includes(serializationErrorMessage));
|
|
2670
|
-
const SERIALIZATION_ERROR_CODES = new Set(["ERR_MISSING_ARGS", "ERR_INVALID_ARG_TYPE"]);
|
|
2737
|
+
const SERIALIZATION_ERROR_CODES = /* @__PURE__ */ new Set(["ERR_MISSING_ARGS", "ERR_INVALID_ARG_TYPE"]);
|
|
2671
2738
|
const SERIALIZATION_ERROR_MESSAGES = [
|
|
2672
2739
|
"could not be cloned",
|
|
2673
2740
|
"circular structure",
|
|
@@ -2877,7 +2944,8 @@ const isConnected = (anyProcess) => {
|
|
|
2877
2944
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/ipc/strict.js
|
|
2878
2945
|
const handleSendStrict = ({ anyProcess, channel, isSubprocess, message, strict }) => {
|
|
2879
2946
|
if (!strict) return message;
|
|
2880
|
-
const
|
|
2947
|
+
const ipcEmitter = getIpcEmitter(anyProcess, channel, isSubprocess);
|
|
2948
|
+
const hasListeners = hasMessageListeners(anyProcess, ipcEmitter);
|
|
2881
2949
|
return {
|
|
2882
2950
|
id: count++,
|
|
2883
2951
|
type: REQUEST_TYPE,
|
|
@@ -3109,7 +3177,8 @@ const throwOnGracefulCancel = ({ subprocess, cancelSignal, gracefulCancel, force
|
|
|
3109
3177
|
})] : [];
|
|
3110
3178
|
const sendOnAbort = async ({ subprocess, cancelSignal, forceKillAfterDelay, context, controller: { signal } }) => {
|
|
3111
3179
|
await onAbortedSignal(cancelSignal, signal);
|
|
3112
|
-
|
|
3180
|
+
const reason = getReason(cancelSignal);
|
|
3181
|
+
await sendAbort(subprocess, reason);
|
|
3113
3182
|
killOnTimeout({
|
|
3114
3183
|
kill: subprocess.kill,
|
|
3115
3184
|
forceKillAfterDelay,
|
|
@@ -3221,8 +3290,8 @@ Please rename it to ${serializeEncoding(correctEncoding)}.`);
|
|
|
3221
3290
|
throw new TypeError(`Invalid option \`encoding: ${serializeEncoding(encoding)}\`.
|
|
3222
3291
|
Please rename it to one of: ${correctEncodings}.`);
|
|
3223
3292
|
};
|
|
3224
|
-
const TEXT_ENCODINGS = new Set(["utf8", "utf16le"]);
|
|
3225
|
-
const BINARY_ENCODINGS = new Set([
|
|
3293
|
+
const TEXT_ENCODINGS = /* @__PURE__ */ new Set(["utf8", "utf16le"]);
|
|
3294
|
+
const BINARY_ENCODINGS = /* @__PURE__ */ new Set([
|
|
3226
3295
|
"buffer",
|
|
3227
3296
|
"hex",
|
|
3228
3297
|
"base64",
|
|
@@ -3230,7 +3299,7 @@ const BINARY_ENCODINGS = new Set([
|
|
|
3230
3299
|
"latin1",
|
|
3231
3300
|
"ascii"
|
|
3232
3301
|
]);
|
|
3233
|
-
const ENCODINGS = new Set([...TEXT_ENCODINGS, ...BINARY_ENCODINGS]);
|
|
3302
|
+
const ENCODINGS = /* @__PURE__ */ new Set([...TEXT_ENCODINGS, ...BINARY_ENCODINGS]);
|
|
3234
3303
|
const getCorrectEncoding = (encoding) => {
|
|
3235
3304
|
if (encoding === null) return "buffer";
|
|
3236
3305
|
if (typeof encoding !== "string") return;
|
|
@@ -3277,7 +3346,8 @@ const normalizeOptions = (filePath, rawArguments, rawOptions) => {
|
|
|
3277
3346
|
rawOptions.cwd = normalizeCwd(rawOptions.cwd);
|
|
3278
3347
|
const [processedFile, processedArguments, processedOptions] = handleNodeOption(filePath, rawArguments, rawOptions);
|
|
3279
3348
|
const { command: file, args: commandArguments, options: initialOptions } = import_cross_spawn.default._parse(processedFile, processedArguments, processedOptions);
|
|
3280
|
-
const
|
|
3349
|
+
const fdOptions = normalizeFdSpecificOptions(initialOptions);
|
|
3350
|
+
const options = addDefaultOptions(fdOptions);
|
|
3281
3351
|
validateTimeout(options);
|
|
3282
3352
|
validateEncoding(options);
|
|
3283
3353
|
validateIpcInputOption(options);
|
|
@@ -3478,14 +3548,17 @@ const getStreamContents$1 = async (stream, { init, convertChunk, getSize, trunca
|
|
|
3478
3548
|
const state = init();
|
|
3479
3549
|
state.length = 0;
|
|
3480
3550
|
try {
|
|
3481
|
-
for await (const chunk of asyncIterable)
|
|
3482
|
-
convertedChunk
|
|
3483
|
-
|
|
3484
|
-
|
|
3485
|
-
|
|
3486
|
-
|
|
3487
|
-
|
|
3488
|
-
|
|
3551
|
+
for await (const chunk of asyncIterable) {
|
|
3552
|
+
const convertedChunk = convertChunk[getChunkType(chunk)](chunk, state);
|
|
3553
|
+
appendChunk({
|
|
3554
|
+
convertedChunk,
|
|
3555
|
+
state,
|
|
3556
|
+
getSize,
|
|
3557
|
+
truncateChunk,
|
|
3558
|
+
addChunk,
|
|
3559
|
+
maxBuffer
|
|
3560
|
+
});
|
|
3561
|
+
}
|
|
3489
3562
|
appendFinalChunk({
|
|
3490
3563
|
state,
|
|
3491
3564
|
convertChunk,
|
|
@@ -3771,7 +3844,8 @@ const getErrorPrefix = ({ originalError, timedOut, timeout, isMaxBuffer, maxBuff
|
|
|
3771
3844
|
const getForcefulSuffix = (isForcefullyTerminated, forceKillAfterDelay) => isForcefullyTerminated ? ` and was forcefully terminated after ${forceKillAfterDelay} milliseconds` : "";
|
|
3772
3845
|
const getOriginalMessage = (originalError, cwd) => {
|
|
3773
3846
|
if (originalError instanceof DiscardedError) return;
|
|
3774
|
-
const
|
|
3847
|
+
const originalMessage = isExecaError(originalError) ? originalError.originalMessage : String(originalError?.message ?? originalError);
|
|
3848
|
+
const escapedOriginalMessage = escapeLines(fixCwdError(originalMessage, cwd));
|
|
3775
3849
|
return escapedOriginalMessage === "" ? void 0 : escapedOriginalMessage;
|
|
3776
3850
|
};
|
|
3777
3851
|
const serializeIpcMessage = (ipcMessage) => typeof ipcMessage === "string" ? ipcMessage : (0, node_util.inspect)(ipcMessage);
|
|
@@ -3982,26 +4056,28 @@ function prettyMilliseconds(milliseconds, options) {
|
|
|
3982
4056
|
add(Number(parsed.hours), "hour", "h");
|
|
3983
4057
|
}
|
|
3984
4058
|
add(Number(parsed.minutes), "minute", "m");
|
|
3985
|
-
if (!options.hideSeconds)
|
|
3986
|
-
|
|
3987
|
-
|
|
3988
|
-
|
|
3989
|
-
|
|
3990
|
-
|
|
3991
|
-
|
|
3992
|
-
|
|
3993
|
-
|
|
3994
|
-
|
|
4059
|
+
if (!options.hideSeconds) {
|
|
4060
|
+
if (options.separateMilliseconds || options.formatSubMilliseconds || !options.colonNotation && milliseconds < 1e3 && !options.subSecondsAsDecimals) {
|
|
4061
|
+
const seconds = Number(parsed.seconds);
|
|
4062
|
+
const milliseconds = Number(parsed.milliseconds);
|
|
4063
|
+
const microseconds = Number(parsed.microseconds);
|
|
4064
|
+
const nanoseconds = Number(parsed.nanoseconds);
|
|
4065
|
+
add(seconds, "second", "s");
|
|
4066
|
+
if (options.formatSubMilliseconds) {
|
|
4067
|
+
add(milliseconds, "millisecond", "ms");
|
|
4068
|
+
add(microseconds, "microsecond", "µs");
|
|
4069
|
+
add(nanoseconds, "nanosecond", "ns");
|
|
4070
|
+
} else {
|
|
4071
|
+
const millisecondsAndBelow = milliseconds + microseconds / 1e3 + nanoseconds / 1e6;
|
|
4072
|
+
const millisecondsDecimalDigits = typeof options.millisecondsDecimalDigits === "number" ? options.millisecondsDecimalDigits : 0;
|
|
4073
|
+
const millisecondsString = millisecondsDecimalDigits ? millisecondsAndBelow.toFixed(millisecondsDecimalDigits) : millisecondsAndBelow >= 1 ? Math.round(millisecondsAndBelow) : Math.ceil(millisecondsAndBelow);
|
|
4074
|
+
add(Number.parseFloat(millisecondsString), "millisecond", "ms", millisecondsString);
|
|
4075
|
+
}
|
|
3995
4076
|
} else {
|
|
3996
|
-
const
|
|
3997
|
-
const
|
|
3998
|
-
|
|
3999
|
-
add(Number.parseFloat(millisecondsString), "millisecond", "ms", millisecondsString);
|
|
4077
|
+
const secondsFixed = floorDecimals((isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds) / 1e3 % 60, typeof options.secondsDecimalDigits === "number" ? options.secondsDecimalDigits : 1);
|
|
4078
|
+
const secondsString = options.keepDecimalsOnWholeSeconds ? secondsFixed : secondsFixed.replace(/\.0+$/, "");
|
|
4079
|
+
add(Number.parseFloat(secondsString), "second", "s", secondsString);
|
|
4000
4080
|
}
|
|
4001
|
-
} else {
|
|
4002
|
-
const secondsFixed = floorDecimals((isBigInt ? Number(milliseconds % ONE_DAY_IN_MILLISECONDS) : milliseconds) / 1e3 % 60, typeof options.secondsDecimalDigits === "number" ? options.secondsDecimalDigits : 1);
|
|
4003
|
-
const secondsString = options.keepDecimalsOnWholeSeconds ? secondsFixed : secondsFixed.replace(/\.0+$/, "");
|
|
4004
|
-
add(Number.parseFloat(secondsString), "second", "s", secondsString);
|
|
4005
4081
|
}
|
|
4006
4082
|
if (result.length === 0) return sign + "0" + (options.verbose ? " milliseconds" : "ms");
|
|
4007
4083
|
const separator = options.colonNotation ? ":" : " ";
|
|
@@ -4026,9 +4102,10 @@ const logResult = (result, verboseInfo) => {
|
|
|
4026
4102
|
logDuration(result, verboseInfo);
|
|
4027
4103
|
};
|
|
4028
4104
|
const logDuration = (result, verboseInfo) => {
|
|
4105
|
+
const verboseMessage = `(done in ${prettyMilliseconds(result.durationMs)})`;
|
|
4029
4106
|
verboseLog({
|
|
4030
4107
|
type: "duration",
|
|
4031
|
-
verboseMessage
|
|
4108
|
+
verboseMessage,
|
|
4032
4109
|
verboseInfo,
|
|
4033
4110
|
result
|
|
4034
4111
|
});
|
|
@@ -4096,10 +4173,10 @@ const isTransformOptions = (value) => isPlainObject(value) && (value.transform !
|
|
|
4096
4173
|
const isUrl = (value) => Object.prototype.toString.call(value) === "[object URL]";
|
|
4097
4174
|
const isRegularUrl = (value) => isUrl(value) && value.protocol !== "file:";
|
|
4098
4175
|
const isFilePathObject = (value) => isPlainObject(value) && Object.keys(value).length > 0 && Object.keys(value).every((key) => FILE_PATH_KEYS.has(key)) && isFilePathString(value.file);
|
|
4099
|
-
const FILE_PATH_KEYS = new Set(["file", "append"]);
|
|
4176
|
+
const FILE_PATH_KEYS = /* @__PURE__ */ new Set(["file", "append"]);
|
|
4100
4177
|
const isFilePathString = (file) => typeof file === "string";
|
|
4101
4178
|
const isUnknownStdioString = (type, value) => type === "native" && typeof value === "string" && !KNOWN_STDIO_STRINGS.has(value);
|
|
4102
|
-
const KNOWN_STDIO_STRINGS = new Set([
|
|
4179
|
+
const KNOWN_STDIO_STRINGS = /* @__PURE__ */ new Set([
|
|
4103
4180
|
"ipc",
|
|
4104
4181
|
"ignore",
|
|
4105
4182
|
"inherit",
|
|
@@ -4113,24 +4190,24 @@ const isTransformStream = (value) => isReadableStream(value?.readable) && isWrit
|
|
|
4113
4190
|
const isAsyncIterableObject = (value) => isObject(value) && typeof value[Symbol.asyncIterator] === "function";
|
|
4114
4191
|
const isIterableObject = (value) => isObject(value) && typeof value[Symbol.iterator] === "function";
|
|
4115
4192
|
const isObject = (value) => typeof value === "object" && value !== null;
|
|
4116
|
-
const TRANSFORM_TYPES = new Set([
|
|
4193
|
+
const TRANSFORM_TYPES = /* @__PURE__ */ new Set([
|
|
4117
4194
|
"generator",
|
|
4118
4195
|
"asyncGenerator",
|
|
4119
4196
|
"duplex",
|
|
4120
4197
|
"webTransform"
|
|
4121
4198
|
]);
|
|
4122
|
-
const FILE_TYPES = new Set([
|
|
4199
|
+
const FILE_TYPES = /* @__PURE__ */ new Set([
|
|
4123
4200
|
"fileUrl",
|
|
4124
4201
|
"filePath",
|
|
4125
4202
|
"fileNumber"
|
|
4126
4203
|
]);
|
|
4127
|
-
const SPECIAL_DUPLICATE_TYPES_SYNC = new Set(["fileUrl", "filePath"]);
|
|
4128
|
-
const SPECIAL_DUPLICATE_TYPES = new Set([
|
|
4204
|
+
const SPECIAL_DUPLICATE_TYPES_SYNC = /* @__PURE__ */ new Set(["fileUrl", "filePath"]);
|
|
4205
|
+
const SPECIAL_DUPLICATE_TYPES = /* @__PURE__ */ new Set([
|
|
4129
4206
|
...SPECIAL_DUPLICATE_TYPES_SYNC,
|
|
4130
4207
|
"webStream",
|
|
4131
4208
|
"nodeStream"
|
|
4132
4209
|
]);
|
|
4133
|
-
const FORBID_DUPLICATE_TYPES = new Set(["webTransform", "duplex"]);
|
|
4210
|
+
const FORBID_DUPLICATE_TYPES = /* @__PURE__ */ new Set(["webTransform", "duplex"]);
|
|
4134
4211
|
const TYPE_TO_MESSAGE = {
|
|
4135
4212
|
generator: "a generator",
|
|
4136
4213
|
asyncGenerator: "an async generator",
|
|
@@ -4463,7 +4540,8 @@ const validateDuplicateStreamSync = ({ otherStdioItems, type, value, optionName,
|
|
|
4463
4540
|
const getDuplicateStreamInstance = ({ otherStdioItems, type, value, optionName, direction }) => {
|
|
4464
4541
|
const duplicateStdioItems = otherStdioItems.filter((stdioItem) => hasSameValue(stdioItem, value));
|
|
4465
4542
|
if (duplicateStdioItems.length === 0) return;
|
|
4466
|
-
|
|
4543
|
+
const differentStdioItem = duplicateStdioItems.find((stdioItem) => stdioItem.direction !== direction);
|
|
4544
|
+
throwOnDuplicateStream(differentStdioItem, optionName, type);
|
|
4467
4545
|
return direction === "output" ? duplicateStdioItems[0].stream : void 0;
|
|
4468
4546
|
};
|
|
4469
4547
|
const hasSameValue = ({ type, value }, secondValue) => {
|
|
@@ -4472,7 +4550,8 @@ const hasSameValue = ({ type, value }, secondValue) => {
|
|
|
4472
4550
|
return value === secondValue;
|
|
4473
4551
|
};
|
|
4474
4552
|
const validateDuplicateTransform = ({ otherStdioItems, type, value, optionName }) => {
|
|
4475
|
-
|
|
4553
|
+
const duplicateStdioItem = otherStdioItems.find(({ value: { transform } }) => transform === value.transform);
|
|
4554
|
+
throwOnDuplicateStream(duplicateStdioItem, optionName, type);
|
|
4476
4555
|
};
|
|
4477
4556
|
const throwOnDuplicateStream = (stdioItem, optionName, type) => {
|
|
4478
4557
|
if (stdioItem !== void 0) throw new TypeError(`The \`${stdioItem.optionName}\` and \`${optionName}\` options must not target ${TYPE_TO_MESSAGE[type]} that is the same.`);
|
|
@@ -4480,13 +4559,14 @@ const throwOnDuplicateStream = (stdioItem, optionName, type) => {
|
|
|
4480
4559
|
//#endregion
|
|
4481
4560
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/stdio/handle.js
|
|
4482
4561
|
const handleStdio = (addProperties, options, verboseInfo, isSync) => {
|
|
4562
|
+
const initialFileDescriptors = normalizeStdioOption(options, verboseInfo, isSync).map((stdioOption, fdNumber) => getFileDescriptor({
|
|
4563
|
+
stdioOption,
|
|
4564
|
+
fdNumber,
|
|
4565
|
+
options,
|
|
4566
|
+
isSync
|
|
4567
|
+
}));
|
|
4483
4568
|
const fileDescriptors = getFinalFileDescriptors({
|
|
4484
|
-
initialFileDescriptors
|
|
4485
|
-
stdioOption,
|
|
4486
|
-
fdNumber,
|
|
4487
|
-
options,
|
|
4488
|
-
isSync
|
|
4489
|
-
})),
|
|
4569
|
+
initialFileDescriptors,
|
|
4490
4570
|
addProperties,
|
|
4491
4571
|
options,
|
|
4492
4572
|
isSync
|
|
@@ -4503,13 +4583,14 @@ const getFileDescriptor = ({ stdioOption, fdNumber, options, isSync }) => {
|
|
|
4503
4583
|
optionName
|
|
4504
4584
|
});
|
|
4505
4585
|
const direction = getStreamDirection(initialStdioItems, fdNumber, optionName);
|
|
4506
|
-
const
|
|
4586
|
+
const stdioItems = initialStdioItems.map((stdioItem) => handleNativeStream({
|
|
4507
4587
|
stdioItem,
|
|
4508
4588
|
isStdioArray,
|
|
4509
4589
|
fdNumber,
|
|
4510
4590
|
direction,
|
|
4511
4591
|
isSync
|
|
4512
|
-
}))
|
|
4592
|
+
}));
|
|
4593
|
+
const normalizedStdioItems = normalizeTransforms(stdioItems, optionName, direction, options);
|
|
4513
4594
|
const objectMode = getFdObjectMode(normalizedStdioItems, direction);
|
|
4514
4595
|
validateFileObjectMode(normalizedStdioItems, objectMode);
|
|
4515
4596
|
return {
|
|
@@ -4519,7 +4600,8 @@ const getFileDescriptor = ({ stdioOption, fdNumber, options, isSync }) => {
|
|
|
4519
4600
|
};
|
|
4520
4601
|
};
|
|
4521
4602
|
const initializeStdioItems = ({ stdioOption, fdNumber, options, optionName }) => {
|
|
4522
|
-
const
|
|
4603
|
+
const initialStdioItems = [...(Array.isArray(stdioOption) ? stdioOption : [stdioOption]).map((value) => initializeStdioItem(value, optionName)), ...handleInputOptions(options, fdNumber)];
|
|
4604
|
+
const stdioItems = filterDuplicates(initialStdioItems);
|
|
4523
4605
|
const isStdioArray = stdioItems.length > 1;
|
|
4524
4606
|
validateStdioArray(stdioItems, isStdioArray, optionName);
|
|
4525
4607
|
validateStreams(stdioItems);
|
|
@@ -4538,7 +4620,7 @@ const validateStdioArray = (stdioItems, isStdioArray, optionName) => {
|
|
|
4538
4620
|
if (!isStdioArray) return;
|
|
4539
4621
|
for (const { value, optionName } of stdioItems) if (INVALID_STDIO_ARRAY_OPTIONS.has(value)) throw new Error(`The \`${optionName}\` option must not include \`${value}\`.`);
|
|
4540
4622
|
};
|
|
4541
|
-
const INVALID_STDIO_ARRAY_OPTIONS = new Set(["ignore", "ipc"]);
|
|
4623
|
+
const INVALID_STDIO_ARRAY_OPTIONS = /* @__PURE__ */ new Set(["ignore", "ipc"]);
|
|
4542
4624
|
const validateStreams = (stdioItems) => {
|
|
4543
4625
|
for (const stdioItem of stdioItems) validateFileStdio(stdioItem);
|
|
4544
4626
|
};
|
|
@@ -4867,7 +4949,10 @@ const generatorToStream = ({ value, value: { transform, final, writableObjectMod
|
|
|
4867
4949
|
const runGeneratorsSync = (chunks, stdioItems, encoding, isInput) => {
|
|
4868
4950
|
const generators = stdioItems.filter(({ type }) => type === "generator");
|
|
4869
4951
|
const reversedGenerators = isInput ? generators.reverse() : generators;
|
|
4870
|
-
for (const { value, optionName } of reversedGenerators)
|
|
4952
|
+
for (const { value, optionName } of reversedGenerators) {
|
|
4953
|
+
const generators = addInternalGenerators(value, encoding, optionName);
|
|
4954
|
+
chunks = runTransformSync(generators, chunks);
|
|
4955
|
+
}
|
|
4871
4956
|
return chunks;
|
|
4872
4957
|
};
|
|
4873
4958
|
const addInternalGenerators = ({ transform, final, binary, writableObjectMode, readableObjectMode, preserveNewlines }, encoding, optionName) => {
|
|
@@ -4903,7 +4988,8 @@ const addInputOptionSync = (fileDescriptors, fdNumber, options) => {
|
|
|
4903
4988
|
const [{ type, optionName }] = allStdioItems;
|
|
4904
4989
|
throw new TypeError(`Only the \`stdin\` option, not \`${optionName}\`, can be ${TYPE_TO_MESSAGE[type]} with synchronous methods.`);
|
|
4905
4990
|
}
|
|
4906
|
-
|
|
4991
|
+
const transformedContents = allStdioItems.map(({ contents }) => contents).map((contents) => applySingleInputGeneratorsSync(contents, stdioItems));
|
|
4992
|
+
options.input = joinToUint8Array(transformedContents);
|
|
4907
4993
|
};
|
|
4908
4994
|
const applySingleInputGeneratorsSync = (contents, stdioItems) => {
|
|
4909
4995
|
const newContents = runGeneratorsSync(contents, stdioItems, "utf8", true);
|
|
@@ -4918,7 +5004,7 @@ const validateSerializable = (newContents) => {
|
|
|
4918
5004
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/output.js
|
|
4919
5005
|
const shouldLogOutput = ({ stdioItems, encoding, verboseInfo, fdNumber }) => fdNumber !== "all" && isFullVerbose(verboseInfo, fdNumber) && !BINARY_ENCODINGS.has(encoding) && fdUsesVerbose(fdNumber) && (stdioItems.some(({ type, value }) => type === "native" && PIPED_STDIO_VALUES.has(value)) || stdioItems.every(({ type }) => TRANSFORM_TYPES.has(type)));
|
|
4920
5006
|
const fdUsesVerbose = (fdNumber) => fdNumber === 1 || fdNumber === 2;
|
|
4921
|
-
const PIPED_STDIO_VALUES = new Set(["pipe", "overlapped"]);
|
|
5007
|
+
const PIPED_STDIO_VALUES = /* @__PURE__ */ new Set(["pipe", "overlapped"]);
|
|
4922
5008
|
const logLines = async (linesIterable, stream, fdNumber, verboseInfo) => {
|
|
4923
5009
|
for await (const line of linesIterable) if (!isPipingStream(stream)) logLine(line, fdNumber, verboseInfo);
|
|
4924
5010
|
};
|
|
@@ -4927,9 +5013,10 @@ const logLinesSync = (linesArray, fdNumber, verboseInfo) => {
|
|
|
4927
5013
|
};
|
|
4928
5014
|
const isPipingStream = (stream) => stream._readableState.pipes.length > 0;
|
|
4929
5015
|
const logLine = (line, fdNumber, verboseInfo) => {
|
|
5016
|
+
const verboseMessage = serializeVerboseMessage(line);
|
|
4930
5017
|
verboseLog({
|
|
4931
5018
|
type: "output",
|
|
4932
|
-
verboseMessage
|
|
5019
|
+
verboseMessage,
|
|
4933
5020
|
fdNumber,
|
|
4934
5021
|
verboseInfo
|
|
4935
5022
|
});
|
|
@@ -4955,10 +5042,12 @@ const transformOutputSync = ({ fileDescriptors, syncResult: { output }, options,
|
|
|
4955
5042
|
};
|
|
4956
5043
|
const transformOutputResultSync = ({ result, fileDescriptors, fdNumber, state, outputFiles, isMaxBuffer, verboseInfo }, { buffer, encoding, lines, stripFinalNewline, maxBuffer }) => {
|
|
4957
5044
|
if (result === null) return;
|
|
4958
|
-
const
|
|
5045
|
+
const truncatedResult = truncateMaxBufferSync(result, isMaxBuffer, maxBuffer);
|
|
5046
|
+
const uint8ArrayResult = bufferToUint8Array(truncatedResult);
|
|
4959
5047
|
const { stdioItems, objectMode } = fileDescriptors[fdNumber];
|
|
5048
|
+
const chunks = runOutputGeneratorsSync([uint8ArrayResult], stdioItems, encoding, state);
|
|
4960
5049
|
const { serializedResult, finalResult = serializedResult } = serializeChunks({
|
|
4961
|
-
chunks
|
|
5050
|
+
chunks,
|
|
4962
5051
|
objectMode,
|
|
4963
5052
|
encoding,
|
|
4964
5053
|
lines,
|
|
@@ -5082,7 +5171,7 @@ const getResultError = (error, exitCode, signal) => {
|
|
|
5082
5171
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/methods/main-sync.js
|
|
5083
5172
|
const execaCoreSync = (rawFile, rawArguments, rawOptions) => {
|
|
5084
5173
|
const { file, commandArguments, command, escapedCommand, startTime, verboseInfo, options, fileDescriptors } = handleSyncArguments(rawFile, rawArguments, rawOptions);
|
|
5085
|
-
|
|
5174
|
+
const result = spawnSubprocessSync({
|
|
5086
5175
|
file,
|
|
5087
5176
|
commandArguments,
|
|
5088
5177
|
options,
|
|
@@ -5091,11 +5180,13 @@ const execaCoreSync = (rawFile, rawArguments, rawOptions) => {
|
|
|
5091
5180
|
verboseInfo,
|
|
5092
5181
|
fileDescriptors,
|
|
5093
5182
|
startTime
|
|
5094
|
-
})
|
|
5183
|
+
});
|
|
5184
|
+
return handleResult(result, verboseInfo, options);
|
|
5095
5185
|
};
|
|
5096
5186
|
const handleSyncArguments = (rawFile, rawArguments, rawOptions) => {
|
|
5097
5187
|
const { command, escapedCommand, startTime, verboseInfo } = handleCommand(rawFile, rawArguments, rawOptions);
|
|
5098
|
-
const
|
|
5188
|
+
const syncOptions = normalizeSyncOptions(rawOptions);
|
|
5189
|
+
const { file, commandArguments, options } = normalizeOptions(rawFile, rawArguments, syncOptions);
|
|
5099
5190
|
validateSyncOptions(options);
|
|
5100
5191
|
return {
|
|
5101
5192
|
file,
|
|
@@ -5140,14 +5231,16 @@ const spawnSubprocessSync = ({ file, commandArguments, options, command, escaped
|
|
|
5140
5231
|
isMaxBuffer,
|
|
5141
5232
|
verboseInfo
|
|
5142
5233
|
});
|
|
5234
|
+
const stdio = output.map((stdioOutput, fdNumber) => stripNewline(stdioOutput, options, fdNumber));
|
|
5235
|
+
const all = stripNewline(getAllSync(output, options), options, "all");
|
|
5143
5236
|
return getSyncResult({
|
|
5144
5237
|
error,
|
|
5145
5238
|
exitCode,
|
|
5146
5239
|
signal,
|
|
5147
5240
|
timedOut,
|
|
5148
5241
|
isMaxBuffer,
|
|
5149
|
-
stdio
|
|
5150
|
-
all
|
|
5242
|
+
stdio,
|
|
5243
|
+
all,
|
|
5151
5244
|
options,
|
|
5152
5245
|
command,
|
|
5153
5246
|
escapedCommand,
|
|
@@ -5157,7 +5250,8 @@ const spawnSubprocessSync = ({ file, commandArguments, options, command, escaped
|
|
|
5157
5250
|
const runSubprocessSync = ({ file, commandArguments, options, command, escapedCommand, fileDescriptors, startTime }) => {
|
|
5158
5251
|
try {
|
|
5159
5252
|
addInputOptionsSync(fileDescriptors, options);
|
|
5160
|
-
|
|
5253
|
+
const normalizedOptions = normalizeSpawnSyncOptions(options);
|
|
5254
|
+
return (0, node_child_process.spawnSync)(file, commandArguments, normalizedOptions);
|
|
5161
5255
|
} catch (error) {
|
|
5162
5256
|
return makeEarlyError({
|
|
5163
5257
|
error,
|
|
@@ -5371,17 +5465,18 @@ const handleEarlyError = ({ error, command, escapedCommand, fileDescriptors, opt
|
|
|
5371
5465
|
writable,
|
|
5372
5466
|
duplex
|
|
5373
5467
|
});
|
|
5468
|
+
const earlyError = makeEarlyError({
|
|
5469
|
+
error,
|
|
5470
|
+
command,
|
|
5471
|
+
escapedCommand,
|
|
5472
|
+
fileDescriptors,
|
|
5473
|
+
options,
|
|
5474
|
+
startTime,
|
|
5475
|
+
isSync: false
|
|
5476
|
+
});
|
|
5374
5477
|
return {
|
|
5375
5478
|
subprocess,
|
|
5376
|
-
promise: handleDummyPromise(
|
|
5377
|
-
error,
|
|
5378
|
-
command,
|
|
5379
|
-
escapedCommand,
|
|
5380
|
-
fileDescriptors,
|
|
5381
|
-
options,
|
|
5382
|
-
startTime,
|
|
5383
|
-
isSync: false
|
|
5384
|
-
}), verboseInfo, options)
|
|
5479
|
+
promise: handleDummyPromise(earlyError, verboseInfo, options)
|
|
5385
5480
|
};
|
|
5386
5481
|
};
|
|
5387
5482
|
const createDummyStreams = (subprocess, fileDescriptors) => {
|
|
@@ -5565,8 +5660,10 @@ const endWhenStreamsDone = async ({ passThroughStream, stream, streams, ended, a
|
|
|
5565
5660
|
controller.abort();
|
|
5566
5661
|
updateMaxListeners(passThroughStream, -PASSTHROUGH_LISTENERS_PER_STREAM);
|
|
5567
5662
|
}
|
|
5568
|
-
if (streams.size > 0 && streams.size === ended.size + aborted.size)
|
|
5569
|
-
|
|
5663
|
+
if (streams.size > 0 && streams.size === ended.size + aborted.size) {
|
|
5664
|
+
if (ended.size === 0 && aborted.size > 0) abortStream(passThroughStream);
|
|
5665
|
+
else endStream(passThroughStream);
|
|
5666
|
+
}
|
|
5570
5667
|
};
|
|
5571
5668
|
const afterMergedStreamFinished = async (onFinished, stream, { signal }) => {
|
|
5572
5669
|
try {
|
|
@@ -5672,7 +5769,10 @@ const pipeOutputAsync = (subprocess, fileDescriptors, controller) => {
|
|
|
5672
5769
|
controller
|
|
5673
5770
|
});
|
|
5674
5771
|
}
|
|
5675
|
-
for (const [outputStream, inputStreams] of pipeGroups.entries())
|
|
5772
|
+
for (const [outputStream, inputStreams] of pipeGroups.entries()) {
|
|
5773
|
+
const inputStream = inputStreams.length === 1 ? inputStreams[0] : mergeStreams(inputStreams);
|
|
5774
|
+
pipeStreams(inputStream, outputStream);
|
|
5775
|
+
}
|
|
5676
5776
|
};
|
|
5677
5777
|
const pipeTransform = (subprocess, stream, direction, fdNumber) => {
|
|
5678
5778
|
if (direction === "output") pipeStreams(subprocess.stdio[fdNumber], stream);
|
|
@@ -6161,12 +6261,13 @@ const stopReadingOnStreamEnd = async (onStreamEnd, controller, stream) => {
|
|
|
6161
6261
|
}
|
|
6162
6262
|
};
|
|
6163
6263
|
const iterateOnStream = ({ stream, controller, binary, shouldEncode, encoding, shouldSplit, preserveNewlines }) => {
|
|
6264
|
+
const onStdoutChunk = (0, node_events.on)(stream, "data", {
|
|
6265
|
+
signal: controller.signal,
|
|
6266
|
+
highWaterMark: HIGH_WATER_MARK,
|
|
6267
|
+
highWatermark: HIGH_WATER_MARK
|
|
6268
|
+
});
|
|
6164
6269
|
return iterateOnData({
|
|
6165
|
-
onStdoutChunk
|
|
6166
|
-
signal: controller.signal,
|
|
6167
|
-
highWaterMark: HIGH_WATER_MARK,
|
|
6168
|
-
highWatermark: HIGH_WATER_MARK
|
|
6169
|
-
}),
|
|
6270
|
+
onStdoutChunk,
|
|
6170
6271
|
controller,
|
|
6171
6272
|
binary,
|
|
6172
6273
|
shouldEncode,
|
|
@@ -6210,12 +6311,13 @@ const getStreamOutput = async ({ stream, onStreamEnd, fdNumber, encoding, buffer
|
|
|
6210
6311
|
await Promise.all([resumeStream(stream), logPromise]);
|
|
6211
6312
|
return;
|
|
6212
6313
|
}
|
|
6314
|
+
const stripFinalNewlineValue = getStripFinalNewline(stripFinalNewline, fdNumber);
|
|
6213
6315
|
const iterable = iterateForResult({
|
|
6214
6316
|
stream,
|
|
6215
6317
|
onStreamEnd,
|
|
6216
6318
|
lines,
|
|
6217
6319
|
encoding,
|
|
6218
|
-
stripFinalNewline:
|
|
6320
|
+
stripFinalNewline: stripFinalNewlineValue,
|
|
6219
6321
|
allMixed
|
|
6220
6322
|
});
|
|
6221
6323
|
const [output] = await Promise.all([getStreamContents({
|
|
@@ -6235,14 +6337,15 @@ const logOutputAsync = async ({ stream, onStreamEnd, fdNumber, encoding, allMixe
|
|
|
6235
6337
|
verboseInfo,
|
|
6236
6338
|
fdNumber
|
|
6237
6339
|
})) return;
|
|
6238
|
-
|
|
6340
|
+
const linesIterable = iterateForResult({
|
|
6239
6341
|
stream,
|
|
6240
6342
|
onStreamEnd,
|
|
6241
6343
|
lines: true,
|
|
6242
6344
|
encoding,
|
|
6243
6345
|
stripFinalNewline: true,
|
|
6244
6346
|
allMixed
|
|
6245
|
-
})
|
|
6347
|
+
});
|
|
6348
|
+
await logLines(linesIterable, stream, fdNumber, verboseInfo);
|
|
6246
6349
|
};
|
|
6247
6350
|
const resumeStream = async (stream) => {
|
|
6248
6351
|
await (0, node_timers_promises.setImmediate)();
|
|
@@ -6388,9 +6491,10 @@ const getAllMixed = ({ all, stdout, stderr }) => all && stdout && stderr && stdo
|
|
|
6388
6491
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/verbose/ipc.js
|
|
6389
6492
|
const shouldLogIpc = (verboseInfo) => isFullVerbose(verboseInfo, "ipc");
|
|
6390
6493
|
const logIpcOutput = (message, verboseInfo) => {
|
|
6494
|
+
const verboseMessage = serializeVerboseMessage(message);
|
|
6391
6495
|
verboseLog({
|
|
6392
6496
|
type: "ipc",
|
|
6393
|
-
verboseMessage
|
|
6497
|
+
verboseMessage,
|
|
6394
6498
|
fdNumber: "ipc",
|
|
6395
6499
|
verboseInfo
|
|
6396
6500
|
});
|
|
@@ -6786,14 +6890,15 @@ const onDuplexDestroy = async ({ subprocessStdout, subprocessStdin, subprocess,
|
|
|
6786
6890
|
const createIterable = (subprocess, encoding, { from, binary: binaryOption = false, preserveNewlines = false } = {}) => {
|
|
6787
6891
|
const binary = binaryOption || BINARY_ENCODINGS.has(encoding);
|
|
6788
6892
|
const subprocessStdout = getFromStream(subprocess, from);
|
|
6789
|
-
|
|
6893
|
+
const onStdoutData = iterateOnSubprocessStream({
|
|
6790
6894
|
subprocessStdout,
|
|
6791
6895
|
subprocess,
|
|
6792
6896
|
binary,
|
|
6793
6897
|
shouldEncode: true,
|
|
6794
6898
|
encoding,
|
|
6795
6899
|
preserveNewlines
|
|
6796
|
-
})
|
|
6900
|
+
});
|
|
6901
|
+
return iterateOnStdoutData(onStdoutData, subprocessStdout, subprocess);
|
|
6797
6902
|
};
|
|
6798
6903
|
const iterateOnStdoutData = async function* (onStdoutData, subprocessStdout, subprocess) {
|
|
6799
6904
|
try {
|
|
@@ -6953,19 +7058,22 @@ const handlePromise = async ({ subprocess, options, startTime, verboseInfo, file
|
|
|
6953
7058
|
});
|
|
6954
7059
|
controller.abort();
|
|
6955
7060
|
onInternalError.resolve();
|
|
6956
|
-
|
|
7061
|
+
const stdio = stdioResults.map((stdioResult, fdNumber) => stripNewline(stdioResult, options, fdNumber));
|
|
7062
|
+
const all = stripNewline(allResult, options, "all");
|
|
7063
|
+
const result = getAsyncResult({
|
|
6957
7064
|
errorInfo,
|
|
6958
7065
|
exitCode,
|
|
6959
7066
|
signal,
|
|
6960
|
-
stdio
|
|
6961
|
-
all
|
|
7067
|
+
stdio,
|
|
7068
|
+
all,
|
|
6962
7069
|
ipcOutput,
|
|
6963
7070
|
context,
|
|
6964
7071
|
options,
|
|
6965
7072
|
command,
|
|
6966
7073
|
escapedCommand,
|
|
6967
7074
|
startTime
|
|
6968
|
-
})
|
|
7075
|
+
});
|
|
7076
|
+
return handleResult(result, verboseInfo, options);
|
|
6969
7077
|
};
|
|
6970
7078
|
const getAsyncResult = ({ errorInfo, exitCode, signal, stdio, all, ipcOutput, context, options, command, escapedCommand, startTime }) => "error" in errorInfo ? makeError({
|
|
6971
7079
|
error: errorInfo.error,
|
|
@@ -7009,7 +7117,7 @@ const mergeOption = (optionName, boundOptionValue, optionValue) => {
|
|
|
7009
7117
|
};
|
|
7010
7118
|
return optionValue;
|
|
7011
7119
|
};
|
|
7012
|
-
const DEEP_OPTIONS = new Set(["env", ...FD_SPECIFIC_OPTIONS]);
|
|
7120
|
+
const DEEP_OPTIONS = /* @__PURE__ */ new Set(["env", ...FD_SPECIFIC_OPTIONS]);
|
|
7013
7121
|
//#endregion
|
|
7014
7122
|
//#region ../../node_modules/.pnpm/execa@9.5.2/node_modules/execa/lib/methods/create.js
|
|
7015
7123
|
const createExeca = (mapArguments, boundOptions, deepOptions, setBoundExeca) => {
|
|
@@ -7036,7 +7144,8 @@ const callBoundExeca = ({ mapArguments, deepOptions = {}, boundOptions = {}, set
|
|
|
7036
7144
|
return isSync ? execaCoreSync(file, commandArguments, options) : execaCoreAsync(file, commandArguments, options, createNested);
|
|
7037
7145
|
};
|
|
7038
7146
|
const parseArguments = ({ mapArguments, firstArgument, nextArguments, deepOptions, boundOptions }) => {
|
|
7039
|
-
const
|
|
7147
|
+
const callArguments = isTemplateString(firstArgument) ? parseTemplates(firstArgument, nextArguments) : [firstArgument, ...nextArguments];
|
|
7148
|
+
const [initialFile, initialArguments, initialOptions] = normalizeParameters(...callArguments);
|
|
7040
7149
|
const mergedOptions = mergeOptions(mergeOptions(deepOptions, boundOptions), initialOptions);
|
|
7041
7150
|
const { file = initialFile, commandArguments = initialArguments, options = mergedOptions, isSync = false } = mapArguments({
|
|
7042
7151
|
file: initialFile,
|
|
@@ -7150,6 +7259,8 @@ const isCloudflareAuthenticationError = (error) => {
|
|
|
7150
7259
|
].some((pattern) => pattern.test(getErrorOutput(error)));
|
|
7151
7260
|
};
|
|
7152
7261
|
var CloudflareAuthenticationError = class extends _hot_updater_cli_tools.InitError {
|
|
7262
|
+
source;
|
|
7263
|
+
accountId;
|
|
7153
7264
|
name = "CloudflareAuthenticationError";
|
|
7154
7265
|
constructor(source, accountId, options) {
|
|
7155
7266
|
super([
|
|
@@ -7164,6 +7275,7 @@ var CloudflareAuthenticationError = class extends _hot_updater_cli_tools.InitErr
|
|
|
7164
7275
|
}
|
|
7165
7276
|
};
|
|
7166
7277
|
var CloudflarePermissionError = class extends _hot_updater_cli_tools.InitError {
|
|
7278
|
+
source;
|
|
7167
7279
|
name = "CloudflarePermissionError";
|
|
7168
7280
|
constructor(source, { accountId, check, requiredPermission }, options) {
|
|
7169
7281
|
super([
|
|
@@ -9302,12 +9414,14 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
9302
9414
|
s2 = peg$FAILED;
|
|
9303
9415
|
if (peg$silentFails === 0) peg$fail(peg$c39);
|
|
9304
9416
|
}
|
|
9305
|
-
if (s2 === peg$FAILED)
|
|
9306
|
-
|
|
9307
|
-
|
|
9308
|
-
|
|
9309
|
-
|
|
9310
|
-
|
|
9417
|
+
if (s2 === peg$FAILED) {
|
|
9418
|
+
if (input.charCodeAt(peg$currPos) === 69) {
|
|
9419
|
+
s2 = peg$c40;
|
|
9420
|
+
peg$currPos++;
|
|
9421
|
+
} else {
|
|
9422
|
+
s2 = peg$FAILED;
|
|
9423
|
+
if (peg$silentFails === 0) peg$fail(peg$c41);
|
|
9424
|
+
}
|
|
9311
9425
|
}
|
|
9312
9426
|
if (s2 !== peg$FAILED) {
|
|
9313
9427
|
s3 = peg$parseinteger_text();
|
|
@@ -10476,12 +10590,14 @@ var require_parser = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
10476
10590
|
s11 = peg$FAILED;
|
|
10477
10591
|
if (peg$silentFails === 0) peg$fail(peg$c48);
|
|
10478
10592
|
}
|
|
10479
|
-
if (s11 === peg$FAILED)
|
|
10480
|
-
|
|
10481
|
-
|
|
10482
|
-
|
|
10483
|
-
|
|
10484
|
-
|
|
10593
|
+
if (s11 === peg$FAILED) {
|
|
10594
|
+
if (input.charCodeAt(peg$currPos) === 43) {
|
|
10595
|
+
s11 = peg$c44;
|
|
10596
|
+
peg$currPos++;
|
|
10597
|
+
} else {
|
|
10598
|
+
s11 = peg$FAILED;
|
|
10599
|
+
if (peg$silentFails === 0) peg$fail(peg$c45);
|
|
10600
|
+
}
|
|
10485
10601
|
}
|
|
10486
10602
|
if (s11 !== peg$FAILED) {
|
|
10487
10603
|
s12 = peg$parseDIGIT_OR_UNDER();
|
|
@@ -11238,9 +11354,7 @@ var require_compiler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11238
11354
|
case "ObjectPath":
|
|
11239
11355
|
setPath(node);
|
|
11240
11356
|
break;
|
|
11241
|
-
case "ArrayPath":
|
|
11242
|
-
addTableArray(node);
|
|
11243
|
-
break;
|
|
11357
|
+
case "ArrayPath": addTableArray(node);
|
|
11244
11358
|
}
|
|
11245
11359
|
}
|
|
11246
11360
|
return data;
|
|
@@ -11320,9 +11434,10 @@ var require_compiler = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
11320
11434
|
var key = keys[i];
|
|
11321
11435
|
traversed.push(key);
|
|
11322
11436
|
traversedPath = traversed.join(".");
|
|
11323
|
-
if (typeof ctx[key] === "undefined")
|
|
11324
|
-
|
|
11325
|
-
|
|
11437
|
+
if (typeof ctx[key] === "undefined") {
|
|
11438
|
+
if (i === keys.length - 1) ctx[key] = value;
|
|
11439
|
+
else ctx[key] = Object.create(null);
|
|
11440
|
+
} else if (i !== keys.length - 1 && valueAssignments.indexOf(traversedPath) > -1) genError("Cannot redefine existing key '" + traversedPath + "'.", line, column);
|
|
11326
11441
|
ctx = ctx[key];
|
|
11327
11442
|
if (ctx instanceof Array && ctx.length && i < keys.length - 1) ctx = ctx[ctx.length - 1];
|
|
11328
11443
|
}
|
|
@@ -12162,7 +12277,8 @@ export default App;`;
|
|
|
12162
12277
|
const deployWorker = async (apiToken, accountId, { credentialSource, d1DatabaseId, d1DatabaseName, nonInteractive, r2BucketName, workerName }) => {
|
|
12163
12278
|
const cwd = (0, _hot_updater_cli_tools.getCwd)();
|
|
12164
12279
|
const cloudflarePackagePath = require.resolve("@hot-updater/cloudflare/package.json", { paths: [cwd] });
|
|
12165
|
-
const
|
|
12280
|
+
const cloudflarePackageRoot = path.default.dirname(cloudflarePackagePath);
|
|
12281
|
+
const { tmpDir, removeTmpDir } = await (0, _hot_updater_cli_tools.copyDirToTmp)(cloudflarePackageRoot);
|
|
12166
12282
|
const workerRoot = path.default.join(tmpDir, "worker");
|
|
12167
12283
|
try {
|
|
12168
12284
|
const wranglerConfig = JSON.parse(await fs_promises.default.readFile(path.default.join(workerRoot, "wrangler.json"), "utf-8"));
|
|
@@ -12432,13 +12548,16 @@ const runInit = async ({ build, envFile }) => {
|
|
|
12432
12548
|
for await (const resultPage of page.iterPages()) for (const result of resultPage.result) rows.push(...result.results ?? []);
|
|
12433
12549
|
return rows;
|
|
12434
12550
|
};
|
|
12435
|
-
if (!createD1Database)
|
|
12551
|
+
if (!createD1Database) {
|
|
12552
|
+
const tables = await queryD1(`
|
|
12436
12553
|
SELECT name
|
|
12437
12554
|
FROM sqlite_schema
|
|
12438
12555
|
WHERE type = 'table'
|
|
12439
12556
|
AND name IN ('bundles', 'release_catalogs')
|
|
12440
12557
|
ORDER BY name
|
|
12441
|
-
`)
|
|
12558
|
+
`);
|
|
12559
|
+
assertCloudflareInfrastructureCanInitialize(tables.flatMap(({ name }) => typeof name === "string" ? [name] : []), d1DatabaseName);
|
|
12560
|
+
}
|
|
12442
12561
|
const workerScripts = await runCloudflareApiRequest({
|
|
12443
12562
|
request: () => cf.workers.scripts.list({ account_id: accountId }),
|
|
12444
12563
|
source: infrastructureCredentialSource
|
|
@@ -12465,13 +12584,14 @@ const runInit = async ({ build, envFile }) => {
|
|
|
12465
12584
|
secretAccessKey,
|
|
12466
12585
|
workerName
|
|
12467
12586
|
};
|
|
12587
|
+
const persistCredentialInputs = await (0, _hot_updater_cli_tools.confirmInitInputPersistence)({
|
|
12588
|
+
existingEnv: managedEnv,
|
|
12589
|
+
inputs: resolvedInputs,
|
|
12590
|
+
nonInteractive,
|
|
12591
|
+
provider: initProvider
|
|
12592
|
+
});
|
|
12468
12593
|
await (0, _hot_updater_cli_tools.makeEnv)({ ...(0, _hot_updater_cli_tools.getInitProviderEnvVars)({
|
|
12469
|
-
includeConsentInputs:
|
|
12470
|
-
existingEnv: managedEnv,
|
|
12471
|
-
inputs: resolvedInputs,
|
|
12472
|
-
nonInteractive,
|
|
12473
|
-
provider: initProvider
|
|
12474
|
-
}),
|
|
12594
|
+
includeConsentInputs: persistCredentialInputs,
|
|
12475
12595
|
inputs: resolvedInputs,
|
|
12476
12596
|
provider: initProvider
|
|
12477
12597
|
}) });
|