@freecodecamp/universe-cli 0.5.1 → 0.7.0
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/README.md +3 -43
- package/dist/index.cjs +1123 -244
- package/dist/index.js +422 -194
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -34,45 +34,45 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
34
34
|
var require_src = __commonJS({
|
|
35
35
|
"node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js"(exports2, module2) {
|
|
36
36
|
"use strict";
|
|
37
|
-
var
|
|
38
|
-
var
|
|
37
|
+
var ESC2 = "\x1B";
|
|
38
|
+
var CSI2 = `${ESC2}[`;
|
|
39
39
|
var beep = "\x07";
|
|
40
40
|
var cursor = {
|
|
41
41
|
to(x, y2) {
|
|
42
|
-
if (!y2) return `${
|
|
43
|
-
return `${
|
|
42
|
+
if (!y2) return `${CSI2}${x + 1}G`;
|
|
43
|
+
return `${CSI2}${y2 + 1};${x + 1}H`;
|
|
44
44
|
},
|
|
45
45
|
move(x, y2) {
|
|
46
46
|
let ret = "";
|
|
47
|
-
if (x < 0) ret += `${
|
|
48
|
-
else if (x > 0) ret += `${
|
|
49
|
-
if (y2 < 0) ret += `${
|
|
50
|
-
else if (y2 > 0) ret += `${
|
|
47
|
+
if (x < 0) ret += `${CSI2}${-x}D`;
|
|
48
|
+
else if (x > 0) ret += `${CSI2}${x}C`;
|
|
49
|
+
if (y2 < 0) ret += `${CSI2}${-y2}A`;
|
|
50
|
+
else if (y2 > 0) ret += `${CSI2}${y2}B`;
|
|
51
51
|
return ret;
|
|
52
52
|
},
|
|
53
|
-
up: (count = 1) => `${
|
|
54
|
-
down: (count = 1) => `${
|
|
55
|
-
forward: (count = 1) => `${
|
|
56
|
-
backward: (count = 1) => `${
|
|
57
|
-
nextLine: (count = 1) => `${
|
|
58
|
-
prevLine: (count = 1) => `${
|
|
59
|
-
left: `${
|
|
60
|
-
hide: `${
|
|
61
|
-
show: `${
|
|
62
|
-
save: `${
|
|
63
|
-
restore: `${
|
|
53
|
+
up: (count = 1) => `${CSI2}${count}A`,
|
|
54
|
+
down: (count = 1) => `${CSI2}${count}B`,
|
|
55
|
+
forward: (count = 1) => `${CSI2}${count}C`,
|
|
56
|
+
backward: (count = 1) => `${CSI2}${count}D`,
|
|
57
|
+
nextLine: (count = 1) => `${CSI2}E`.repeat(count),
|
|
58
|
+
prevLine: (count = 1) => `${CSI2}F`.repeat(count),
|
|
59
|
+
left: `${CSI2}G`,
|
|
60
|
+
hide: `${CSI2}?25l`,
|
|
61
|
+
show: `${CSI2}?25h`,
|
|
62
|
+
save: `${ESC2}7`,
|
|
63
|
+
restore: `${ESC2}8`
|
|
64
64
|
};
|
|
65
65
|
var scroll = {
|
|
66
|
-
up: (count = 1) => `${
|
|
67
|
-
down: (count = 1) => `${
|
|
66
|
+
up: (count = 1) => `${CSI2}S`.repeat(count),
|
|
67
|
+
down: (count = 1) => `${CSI2}T`.repeat(count)
|
|
68
68
|
};
|
|
69
69
|
var erase = {
|
|
70
|
-
screen: `${
|
|
71
|
-
up: (count = 1) => `${
|
|
72
|
-
down: (count = 1) => `${
|
|
73
|
-
line: `${
|
|
74
|
-
lineEnd: `${
|
|
75
|
-
lineStart: `${
|
|
70
|
+
screen: `${CSI2}2J`,
|
|
71
|
+
up: (count = 1) => `${CSI2}1J`.repeat(count),
|
|
72
|
+
down: (count = 1) => `${CSI2}J`.repeat(count),
|
|
73
|
+
line: `${CSI2}2K`,
|
|
74
|
+
lineEnd: `${CSI2}K`,
|
|
75
|
+
lineStart: `${CSI2}1K`,
|
|
76
76
|
lines(count) {
|
|
77
77
|
let clear = "";
|
|
78
78
|
for (let i = 0; i < count; i++)
|
|
@@ -1117,12 +1117,12 @@ var require_foldFlowLines = __commonJS({
|
|
|
1117
1117
|
ch = text[i += 1];
|
|
1118
1118
|
overflow = true;
|
|
1119
1119
|
}
|
|
1120
|
-
const
|
|
1121
|
-
if (escapedFolds[
|
|
1120
|
+
const j2 = i > escEnd + 1 ? i - 2 : escStart - 1;
|
|
1121
|
+
if (escapedFolds[j2])
|
|
1122
1122
|
return text;
|
|
1123
|
-
folds.push(
|
|
1124
|
-
escapedFolds[
|
|
1125
|
-
end =
|
|
1123
|
+
folds.push(j2);
|
|
1124
|
+
escapedFolds[j2] = true;
|
|
1125
|
+
end = j2 + endStep;
|
|
1126
1126
|
split = void 0;
|
|
1127
1127
|
} else {
|
|
1128
1128
|
overflow = true;
|
|
@@ -3110,7 +3110,7 @@ var require_timestamp = __commonJS({
|
|
|
3110
3110
|
const sign = str[0];
|
|
3111
3111
|
const parts = sign === "-" || sign === "+" ? str.substring(1) : str;
|
|
3112
3112
|
const num = (n) => asBigInt ? BigInt(n) : Number(n);
|
|
3113
|
-
const res = parts.replace(/_/g, "").split(":").reduce((res2,
|
|
3113
|
+
const res = parts.replace(/_/g, "").split(":").reduce((res2, p2) => res2 * num(60) + num(p2), num(0));
|
|
3114
3114
|
return sign === "-" ? num(-1) * res : res;
|
|
3115
3115
|
}
|
|
3116
3116
|
function stringifySexagesimal(node) {
|
|
@@ -7400,7 +7400,7 @@ function lib_default(args, opts) {
|
|
|
7400
7400
|
args = args || [];
|
|
7401
7401
|
opts = opts || {};
|
|
7402
7402
|
var k, arr, arg, name, val, out = { _: [] };
|
|
7403
|
-
var i = 0,
|
|
7403
|
+
var i = 0, j2 = 0, idx = 0, len = args.length;
|
|
7404
7404
|
const alibi = opts.alias !== void 0;
|
|
7405
7405
|
const strict = opts.unknown !== void 0;
|
|
7406
7406
|
const defaults = opts.default !== void 0;
|
|
@@ -7413,11 +7413,11 @@ function lib_default(args, opts) {
|
|
|
7413
7413
|
}
|
|
7414
7414
|
for (i = opts.boolean.length; i-- > 0; ) {
|
|
7415
7415
|
arr = opts.alias[opts.boolean[i]] || [];
|
|
7416
|
-
for (
|
|
7416
|
+
for (j2 = arr.length; j2-- > 0; ) opts.boolean.push(arr[j2]);
|
|
7417
7417
|
}
|
|
7418
7418
|
for (i = opts.string.length; i-- > 0; ) {
|
|
7419
7419
|
arr = opts.alias[opts.string[i]] || [];
|
|
7420
|
-
for (
|
|
7420
|
+
for (j2 = arr.length; j2-- > 0; ) opts.string.push(arr[j2]);
|
|
7421
7421
|
}
|
|
7422
7422
|
if (defaults) for (k in opts.default) {
|
|
7423
7423
|
name = typeof opts.default[k];
|
|
@@ -7434,20 +7434,20 @@ function lib_default(args, opts) {
|
|
|
7434
7434
|
out._ = out._.concat(args.slice(++i));
|
|
7435
7435
|
break;
|
|
7436
7436
|
}
|
|
7437
|
-
for (
|
|
7438
|
-
if (
|
|
7439
|
-
else if (arg.substring(
|
|
7440
|
-
name = arg.substring(
|
|
7437
|
+
for (j2 = 0; j2 < arg.length; j2++) if (arg.charCodeAt(j2) !== 45) break;
|
|
7438
|
+
if (j2 === 0) out._.push(arg);
|
|
7439
|
+
else if (arg.substring(j2, j2 + 3) === "no-") {
|
|
7440
|
+
name = arg.substring(j2 + 3);
|
|
7441
7441
|
if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
|
|
7442
7442
|
out[name] = false;
|
|
7443
7443
|
} else {
|
|
7444
|
-
for (idx =
|
|
7445
|
-
name = arg.substring(
|
|
7444
|
+
for (idx = j2 + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
|
|
7445
|
+
name = arg.substring(j2, idx);
|
|
7446
7446
|
val = arg.substring(++idx) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
|
|
7447
|
-
arr =
|
|
7447
|
+
arr = j2 === 2 ? [name] : name;
|
|
7448
7448
|
for (idx = 0; idx < arr.length; idx++) {
|
|
7449
7449
|
name = arr[idx];
|
|
7450
|
-
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(
|
|
7450
|
+
if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j2) + name);
|
|
7451
7451
|
toVal(out, name, idx + 1 < arr.length || val, opts);
|
|
7452
7452
|
}
|
|
7453
7453
|
}
|
|
@@ -8014,16 +8014,384 @@ var import_node_process = require("process");
|
|
|
8014
8014
|
var _ = __toESM(require("readline"), 1);
|
|
8015
8015
|
var import_node_readline = __toESM(require("readline"), 1);
|
|
8016
8016
|
|
|
8017
|
+
// node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/utils.js
|
|
8018
|
+
var isAmbiguous = (x) => {
|
|
8019
|
+
return x === 161 || x === 164 || x === 167 || x === 168 || x === 170 || x === 173 || x === 174 || x >= 176 && x <= 180 || x >= 182 && x <= 186 || x >= 188 && x <= 191 || x === 198 || x === 208 || x === 215 || x === 216 || x >= 222 && x <= 225 || x === 230 || x >= 232 && x <= 234 || x === 236 || x === 237 || x === 240 || x === 242 || x === 243 || x >= 247 && x <= 250 || x === 252 || x === 254 || x === 257 || x === 273 || x === 275 || x === 283 || x === 294 || x === 295 || x === 299 || x >= 305 && x <= 307 || x === 312 || x >= 319 && x <= 322 || x === 324 || x >= 328 && x <= 331 || x === 333 || x === 338 || x === 339 || x === 358 || x === 359 || x === 363 || x === 462 || x === 464 || x === 466 || x === 468 || x === 470 || x === 472 || x === 474 || x === 476 || x === 593 || x === 609 || x === 708 || x === 711 || x >= 713 && x <= 715 || x === 717 || x === 720 || x >= 728 && x <= 731 || x === 733 || x === 735 || x >= 768 && x <= 879 || x >= 913 && x <= 929 || x >= 931 && x <= 937 || x >= 945 && x <= 961 || x >= 963 && x <= 969 || x === 1025 || x >= 1040 && x <= 1103 || x === 1105 || x === 8208 || x >= 8211 && x <= 8214 || x === 8216 || x === 8217 || x === 8220 || x === 8221 || x >= 8224 && x <= 8226 || x >= 8228 && x <= 8231 || x === 8240 || x === 8242 || x === 8243 || x === 8245 || x === 8251 || x === 8254 || x === 8308 || x === 8319 || x >= 8321 && x <= 8324 || x === 8364 || x === 8451 || x === 8453 || x === 8457 || x === 8467 || x === 8470 || x === 8481 || x === 8482 || x === 8486 || x === 8491 || x === 8531 || x === 8532 || x >= 8539 && x <= 8542 || x >= 8544 && x <= 8555 || x >= 8560 && x <= 8569 || x === 8585 || x >= 8592 && x <= 8601 || x === 8632 || x === 8633 || x === 8658 || x === 8660 || x === 8679 || x === 8704 || x === 8706 || x === 8707 || x === 8711 || x === 8712 || x === 8715 || x === 8719 || x === 8721 || x === 8725 || x === 8730 || x >= 8733 && x <= 8736 || x === 8739 || x === 8741 || x >= 8743 && x <= 8748 || x === 8750 || x >= 8756 && x <= 8759 || x === 8764 || x === 8765 || x === 8776 || x === 8780 || x === 8786 || x === 8800 || x === 8801 || x >= 8804 && x <= 8807 || x === 8810 || x === 8811 || x === 8814 || x === 8815 || x === 8834 || x === 8835 || x === 8838 || x === 8839 || x === 8853 || x === 8857 || x === 8869 || x === 8895 || x === 8978 || x >= 9312 && x <= 9449 || x >= 9451 && x <= 9547 || x >= 9552 && x <= 9587 || x >= 9600 && x <= 9615 || x >= 9618 && x <= 9621 || x === 9632 || x === 9633 || x >= 9635 && x <= 9641 || x === 9650 || x === 9651 || x === 9654 || x === 9655 || x === 9660 || x === 9661 || x === 9664 || x === 9665 || x >= 9670 && x <= 9672 || x === 9675 || x >= 9678 && x <= 9681 || x >= 9698 && x <= 9701 || x === 9711 || x === 9733 || x === 9734 || x === 9737 || x === 9742 || x === 9743 || x === 9756 || x === 9758 || x === 9792 || x === 9794 || x === 9824 || x === 9825 || x >= 9827 && x <= 9829 || x >= 9831 && x <= 9834 || x === 9836 || x === 9837 || x === 9839 || x === 9886 || x === 9887 || x === 9919 || x >= 9926 && x <= 9933 || x >= 9935 && x <= 9939 || x >= 9941 && x <= 9953 || x === 9955 || x === 9960 || x === 9961 || x >= 9963 && x <= 9969 || x === 9972 || x >= 9974 && x <= 9977 || x === 9979 || x === 9980 || x === 9982 || x === 9983 || x === 10045 || x >= 10102 && x <= 10111 || x >= 11094 && x <= 11097 || x >= 12872 && x <= 12879 || x >= 57344 && x <= 63743 || x >= 65024 && x <= 65039 || x === 65533 || x >= 127232 && x <= 127242 || x >= 127248 && x <= 127277 || x >= 127280 && x <= 127337 || x >= 127344 && x <= 127373 || x === 127375 || x === 127376 || x >= 127387 && x <= 127404 || x >= 917760 && x <= 917999 || x >= 983040 && x <= 1048573 || x >= 1048576 && x <= 1114109;
|
|
8020
|
+
};
|
|
8021
|
+
var isFullWidth = (x) => {
|
|
8022
|
+
return x === 12288 || x >= 65281 && x <= 65376 || x >= 65504 && x <= 65510;
|
|
8023
|
+
};
|
|
8024
|
+
var isWide = (x) => {
|
|
8025
|
+
return x >= 4352 && x <= 4447 || x === 8986 || x === 8987 || x === 9001 || x === 9002 || x >= 9193 && x <= 9196 || x === 9200 || x === 9203 || x === 9725 || x === 9726 || x === 9748 || x === 9749 || x >= 9800 && x <= 9811 || x === 9855 || x === 9875 || x === 9889 || x === 9898 || x === 9899 || x === 9917 || x === 9918 || x === 9924 || x === 9925 || x === 9934 || x === 9940 || x === 9962 || x === 9970 || x === 9971 || x === 9973 || x === 9978 || x === 9981 || x === 9989 || x === 9994 || x === 9995 || x === 10024 || x === 10060 || x === 10062 || x >= 10067 && x <= 10069 || x === 10071 || x >= 10133 && x <= 10135 || x === 10160 || x === 10175 || x === 11035 || x === 11036 || x === 11088 || x === 11093 || x >= 11904 && x <= 11929 || x >= 11931 && x <= 12019 || x >= 12032 && x <= 12245 || x >= 12272 && x <= 12287 || x >= 12289 && x <= 12350 || x >= 12353 && x <= 12438 || x >= 12441 && x <= 12543 || x >= 12549 && x <= 12591 || x >= 12593 && x <= 12686 || x >= 12688 && x <= 12771 || x >= 12783 && x <= 12830 || x >= 12832 && x <= 12871 || x >= 12880 && x <= 19903 || x >= 19968 && x <= 42124 || x >= 42128 && x <= 42182 || x >= 43360 && x <= 43388 || x >= 44032 && x <= 55203 || x >= 63744 && x <= 64255 || x >= 65040 && x <= 65049 || x >= 65072 && x <= 65106 || x >= 65108 && x <= 65126 || x >= 65128 && x <= 65131 || x >= 94176 && x <= 94180 || x === 94192 || x === 94193 || x >= 94208 && x <= 100343 || x >= 100352 && x <= 101589 || x >= 101632 && x <= 101640 || x >= 110576 && x <= 110579 || x >= 110581 && x <= 110587 || x === 110589 || x === 110590 || x >= 110592 && x <= 110882 || x === 110898 || x >= 110928 && x <= 110930 || x === 110933 || x >= 110948 && x <= 110951 || x >= 110960 && x <= 111355 || x === 126980 || x === 127183 || x === 127374 || x >= 127377 && x <= 127386 || x >= 127488 && x <= 127490 || x >= 127504 && x <= 127547 || x >= 127552 && x <= 127560 || x === 127568 || x === 127569 || x >= 127584 && x <= 127589 || x >= 127744 && x <= 127776 || x >= 127789 && x <= 127797 || x >= 127799 && x <= 127868 || x >= 127870 && x <= 127891 || x >= 127904 && x <= 127946 || x >= 127951 && x <= 127955 || x >= 127968 && x <= 127984 || x === 127988 || x >= 127992 && x <= 128062 || x === 128064 || x >= 128066 && x <= 128252 || x >= 128255 && x <= 128317 || x >= 128331 && x <= 128334 || x >= 128336 && x <= 128359 || x === 128378 || x === 128405 || x === 128406 || x === 128420 || x >= 128507 && x <= 128591 || x >= 128640 && x <= 128709 || x === 128716 || x >= 128720 && x <= 128722 || x >= 128725 && x <= 128727 || x >= 128732 && x <= 128735 || x === 128747 || x === 128748 || x >= 128756 && x <= 128764 || x >= 128992 && x <= 129003 || x === 129008 || x >= 129292 && x <= 129338 || x >= 129340 && x <= 129349 || x >= 129351 && x <= 129535 || x >= 129648 && x <= 129660 || x >= 129664 && x <= 129672 || x >= 129680 && x <= 129725 || x >= 129727 && x <= 129733 || x >= 129742 && x <= 129755 || x >= 129760 && x <= 129768 || x >= 129776 && x <= 129784 || x >= 131072 && x <= 196605 || x >= 196608 && x <= 262141;
|
|
8026
|
+
};
|
|
8027
|
+
|
|
8017
8028
|
// node_modules/.pnpm/fast-string-truncated-width@1.2.1/node_modules/fast-string-truncated-width/dist/index.js
|
|
8029
|
+
var ANSI_RE = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y;
|
|
8030
|
+
var CONTROL_RE = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y;
|
|
8031
|
+
var TAB_RE = /\t{1,1000}/y;
|
|
8018
8032
|
var EMOJI_RE = new RegExp("[\\u{1F1E6}-\\u{1F1FF}]{2}|\\u{1F3F4}[\\u{E0061}-\\u{E007A}]{2}[\\u{E0030}-\\u{E0039}\\u{E0061}-\\u{E007A}]{1,3}\\u{E007F}|(?:\\p{Emoji}\\uFE0F\\u20E3?|\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation})(?:\\u200D(?:\\p{Emoji_Modifier_Base}\\p{Emoji_Modifier}?|\\p{Emoji_Presentation}|\\p{Emoji}\\uFE0F\\u20E3?))*", "yu");
|
|
8033
|
+
var LATIN_RE = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y;
|
|
8019
8034
|
var MODIFIER_RE = new RegExp("\\p{M}+", "gu");
|
|
8035
|
+
var NO_TRUNCATION = { limit: Infinity, ellipsis: "" };
|
|
8036
|
+
var getStringTruncatedWidth = (input, truncationOptions = {}, widthOptions = {}) => {
|
|
8037
|
+
const LIMIT = truncationOptions.limit ?? Infinity;
|
|
8038
|
+
const ELLIPSIS = truncationOptions.ellipsis ?? "";
|
|
8039
|
+
const ELLIPSIS_WIDTH = truncationOptions?.ellipsisWidth ?? (ELLIPSIS ? getStringTruncatedWidth(ELLIPSIS, NO_TRUNCATION, widthOptions).width : 0);
|
|
8040
|
+
const ANSI_WIDTH = widthOptions.ansiWidth ?? 0;
|
|
8041
|
+
const CONTROL_WIDTH = widthOptions.controlWidth ?? 0;
|
|
8042
|
+
const TAB_WIDTH = widthOptions.tabWidth ?? 8;
|
|
8043
|
+
const AMBIGUOUS_WIDTH = widthOptions.ambiguousWidth ?? 1;
|
|
8044
|
+
const EMOJI_WIDTH = widthOptions.emojiWidth ?? 2;
|
|
8045
|
+
const FULL_WIDTH_WIDTH = widthOptions.fullWidthWidth ?? 2;
|
|
8046
|
+
const REGULAR_WIDTH = widthOptions.regularWidth ?? 1;
|
|
8047
|
+
const WIDE_WIDTH = widthOptions.wideWidth ?? 2;
|
|
8048
|
+
let indexPrev = 0;
|
|
8049
|
+
let index = 0;
|
|
8050
|
+
let length = input.length;
|
|
8051
|
+
let lengthExtra = 0;
|
|
8052
|
+
let truncationEnabled = false;
|
|
8053
|
+
let truncationIndex = length;
|
|
8054
|
+
let truncationLimit = Math.max(0, LIMIT - ELLIPSIS_WIDTH);
|
|
8055
|
+
let unmatchedStart = 0;
|
|
8056
|
+
let unmatchedEnd = 0;
|
|
8057
|
+
let width = 0;
|
|
8058
|
+
let widthExtra = 0;
|
|
8059
|
+
outer: while (true) {
|
|
8060
|
+
if (unmatchedEnd > unmatchedStart || index >= length && index > indexPrev) {
|
|
8061
|
+
const unmatched = input.slice(unmatchedStart, unmatchedEnd) || input.slice(indexPrev, index);
|
|
8062
|
+
lengthExtra = 0;
|
|
8063
|
+
for (const char of unmatched.replaceAll(MODIFIER_RE, "")) {
|
|
8064
|
+
const codePoint = char.codePointAt(0) || 0;
|
|
8065
|
+
if (isFullWidth(codePoint)) {
|
|
8066
|
+
widthExtra = FULL_WIDTH_WIDTH;
|
|
8067
|
+
} else if (isWide(codePoint)) {
|
|
8068
|
+
widthExtra = WIDE_WIDTH;
|
|
8069
|
+
} else if (AMBIGUOUS_WIDTH !== REGULAR_WIDTH && isAmbiguous(codePoint)) {
|
|
8070
|
+
widthExtra = AMBIGUOUS_WIDTH;
|
|
8071
|
+
} else {
|
|
8072
|
+
widthExtra = REGULAR_WIDTH;
|
|
8073
|
+
}
|
|
8074
|
+
if (width + widthExtra > truncationLimit) {
|
|
8075
|
+
truncationIndex = Math.min(truncationIndex, Math.max(unmatchedStart, indexPrev) + lengthExtra);
|
|
8076
|
+
}
|
|
8077
|
+
if (width + widthExtra > LIMIT) {
|
|
8078
|
+
truncationEnabled = true;
|
|
8079
|
+
break outer;
|
|
8080
|
+
}
|
|
8081
|
+
lengthExtra += char.length;
|
|
8082
|
+
width += widthExtra;
|
|
8083
|
+
}
|
|
8084
|
+
unmatchedStart = unmatchedEnd = 0;
|
|
8085
|
+
}
|
|
8086
|
+
if (index >= length)
|
|
8087
|
+
break;
|
|
8088
|
+
LATIN_RE.lastIndex = index;
|
|
8089
|
+
if (LATIN_RE.test(input)) {
|
|
8090
|
+
lengthExtra = LATIN_RE.lastIndex - index;
|
|
8091
|
+
widthExtra = lengthExtra * REGULAR_WIDTH;
|
|
8092
|
+
if (width + widthExtra > truncationLimit) {
|
|
8093
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / REGULAR_WIDTH));
|
|
8094
|
+
}
|
|
8095
|
+
if (width + widthExtra > LIMIT) {
|
|
8096
|
+
truncationEnabled = true;
|
|
8097
|
+
break;
|
|
8098
|
+
}
|
|
8099
|
+
width += widthExtra;
|
|
8100
|
+
unmatchedStart = indexPrev;
|
|
8101
|
+
unmatchedEnd = index;
|
|
8102
|
+
index = indexPrev = LATIN_RE.lastIndex;
|
|
8103
|
+
continue;
|
|
8104
|
+
}
|
|
8105
|
+
ANSI_RE.lastIndex = index;
|
|
8106
|
+
if (ANSI_RE.test(input)) {
|
|
8107
|
+
if (width + ANSI_WIDTH > truncationLimit) {
|
|
8108
|
+
truncationIndex = Math.min(truncationIndex, index);
|
|
8109
|
+
}
|
|
8110
|
+
if (width + ANSI_WIDTH > LIMIT) {
|
|
8111
|
+
truncationEnabled = true;
|
|
8112
|
+
break;
|
|
8113
|
+
}
|
|
8114
|
+
width += ANSI_WIDTH;
|
|
8115
|
+
unmatchedStart = indexPrev;
|
|
8116
|
+
unmatchedEnd = index;
|
|
8117
|
+
index = indexPrev = ANSI_RE.lastIndex;
|
|
8118
|
+
continue;
|
|
8119
|
+
}
|
|
8120
|
+
CONTROL_RE.lastIndex = index;
|
|
8121
|
+
if (CONTROL_RE.test(input)) {
|
|
8122
|
+
lengthExtra = CONTROL_RE.lastIndex - index;
|
|
8123
|
+
widthExtra = lengthExtra * CONTROL_WIDTH;
|
|
8124
|
+
if (width + widthExtra > truncationLimit) {
|
|
8125
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / CONTROL_WIDTH));
|
|
8126
|
+
}
|
|
8127
|
+
if (width + widthExtra > LIMIT) {
|
|
8128
|
+
truncationEnabled = true;
|
|
8129
|
+
break;
|
|
8130
|
+
}
|
|
8131
|
+
width += widthExtra;
|
|
8132
|
+
unmatchedStart = indexPrev;
|
|
8133
|
+
unmatchedEnd = index;
|
|
8134
|
+
index = indexPrev = CONTROL_RE.lastIndex;
|
|
8135
|
+
continue;
|
|
8136
|
+
}
|
|
8137
|
+
TAB_RE.lastIndex = index;
|
|
8138
|
+
if (TAB_RE.test(input)) {
|
|
8139
|
+
lengthExtra = TAB_RE.lastIndex - index;
|
|
8140
|
+
widthExtra = lengthExtra * TAB_WIDTH;
|
|
8141
|
+
if (width + widthExtra > truncationLimit) {
|
|
8142
|
+
truncationIndex = Math.min(truncationIndex, index + Math.floor((truncationLimit - width) / TAB_WIDTH));
|
|
8143
|
+
}
|
|
8144
|
+
if (width + widthExtra > LIMIT) {
|
|
8145
|
+
truncationEnabled = true;
|
|
8146
|
+
break;
|
|
8147
|
+
}
|
|
8148
|
+
width += widthExtra;
|
|
8149
|
+
unmatchedStart = indexPrev;
|
|
8150
|
+
unmatchedEnd = index;
|
|
8151
|
+
index = indexPrev = TAB_RE.lastIndex;
|
|
8152
|
+
continue;
|
|
8153
|
+
}
|
|
8154
|
+
EMOJI_RE.lastIndex = index;
|
|
8155
|
+
if (EMOJI_RE.test(input)) {
|
|
8156
|
+
if (width + EMOJI_WIDTH > truncationLimit) {
|
|
8157
|
+
truncationIndex = Math.min(truncationIndex, index);
|
|
8158
|
+
}
|
|
8159
|
+
if (width + EMOJI_WIDTH > LIMIT) {
|
|
8160
|
+
truncationEnabled = true;
|
|
8161
|
+
break;
|
|
8162
|
+
}
|
|
8163
|
+
width += EMOJI_WIDTH;
|
|
8164
|
+
unmatchedStart = indexPrev;
|
|
8165
|
+
unmatchedEnd = index;
|
|
8166
|
+
index = indexPrev = EMOJI_RE.lastIndex;
|
|
8167
|
+
continue;
|
|
8168
|
+
}
|
|
8169
|
+
index += 1;
|
|
8170
|
+
}
|
|
8171
|
+
return {
|
|
8172
|
+
width: truncationEnabled ? truncationLimit : width,
|
|
8173
|
+
index: truncationEnabled ? truncationIndex : length,
|
|
8174
|
+
truncated: truncationEnabled,
|
|
8175
|
+
ellipsed: truncationEnabled && LIMIT >= ELLIPSIS_WIDTH
|
|
8176
|
+
};
|
|
8177
|
+
};
|
|
8178
|
+
var dist_default = getStringTruncatedWidth;
|
|
8179
|
+
|
|
8180
|
+
// node_modules/.pnpm/fast-string-width@1.1.0/node_modules/fast-string-width/dist/index.js
|
|
8181
|
+
var NO_TRUNCATION2 = {
|
|
8182
|
+
limit: Infinity,
|
|
8183
|
+
ellipsis: "",
|
|
8184
|
+
ellipsisWidth: 0
|
|
8185
|
+
};
|
|
8186
|
+
var fastStringWidth = (input, options = {}) => {
|
|
8187
|
+
return dist_default(input, NO_TRUNCATION2, options).width;
|
|
8188
|
+
};
|
|
8189
|
+
var dist_default2 = fastStringWidth;
|
|
8020
8190
|
|
|
8021
8191
|
// node_modules/.pnpm/fast-wrap-ansi@0.1.6/node_modules/fast-wrap-ansi/lib/main.js
|
|
8192
|
+
var ESC = "\x1B";
|
|
8193
|
+
var CSI = "\x9B";
|
|
8194
|
+
var END_CODE = 39;
|
|
8022
8195
|
var ANSI_ESCAPE_BELL = "\x07";
|
|
8023
8196
|
var ANSI_CSI = "[";
|
|
8024
8197
|
var ANSI_OSC = "]";
|
|
8198
|
+
var ANSI_SGR_TERMINATOR = "m";
|
|
8025
8199
|
var ANSI_ESCAPE_LINK = `${ANSI_OSC}8;;`;
|
|
8026
8200
|
var GROUP_REGEX = new RegExp(`(?:\\${ANSI_CSI}(?<code>\\d+)m|\\${ANSI_ESCAPE_LINK}(?<uri>.*)${ANSI_ESCAPE_BELL})`, "y");
|
|
8201
|
+
var getClosingCode = (openingCode) => {
|
|
8202
|
+
if (openingCode >= 30 && openingCode <= 37)
|
|
8203
|
+
return 39;
|
|
8204
|
+
if (openingCode >= 90 && openingCode <= 97)
|
|
8205
|
+
return 39;
|
|
8206
|
+
if (openingCode >= 40 && openingCode <= 47)
|
|
8207
|
+
return 49;
|
|
8208
|
+
if (openingCode >= 100 && openingCode <= 107)
|
|
8209
|
+
return 49;
|
|
8210
|
+
if (openingCode === 1 || openingCode === 2)
|
|
8211
|
+
return 22;
|
|
8212
|
+
if (openingCode === 3)
|
|
8213
|
+
return 23;
|
|
8214
|
+
if (openingCode === 4)
|
|
8215
|
+
return 24;
|
|
8216
|
+
if (openingCode === 7)
|
|
8217
|
+
return 27;
|
|
8218
|
+
if (openingCode === 8)
|
|
8219
|
+
return 28;
|
|
8220
|
+
if (openingCode === 9)
|
|
8221
|
+
return 29;
|
|
8222
|
+
if (openingCode === 0)
|
|
8223
|
+
return 0;
|
|
8224
|
+
return void 0;
|
|
8225
|
+
};
|
|
8226
|
+
var wrapAnsiCode = (code) => `${ESC}${ANSI_CSI}${code}${ANSI_SGR_TERMINATOR}`;
|
|
8227
|
+
var wrapAnsiHyperlink = (url2) => `${ESC}${ANSI_ESCAPE_LINK}${url2}${ANSI_ESCAPE_BELL}`;
|
|
8228
|
+
var wrapWord = (rows, word, columns) => {
|
|
8229
|
+
const characters = word[Symbol.iterator]();
|
|
8230
|
+
let isInsideEscape = false;
|
|
8231
|
+
let isInsideLinkEscape = false;
|
|
8232
|
+
let lastRow = rows.at(-1);
|
|
8233
|
+
let visible = lastRow === void 0 ? 0 : dist_default2(lastRow);
|
|
8234
|
+
let currentCharacter = characters.next();
|
|
8235
|
+
let nextCharacter = characters.next();
|
|
8236
|
+
let rawCharacterIndex = 0;
|
|
8237
|
+
while (!currentCharacter.done) {
|
|
8238
|
+
const character = currentCharacter.value;
|
|
8239
|
+
const characterLength = dist_default2(character);
|
|
8240
|
+
if (visible + characterLength <= columns) {
|
|
8241
|
+
rows[rows.length - 1] += character;
|
|
8242
|
+
} else {
|
|
8243
|
+
rows.push(character);
|
|
8244
|
+
visible = 0;
|
|
8245
|
+
}
|
|
8246
|
+
if (character === ESC || character === CSI) {
|
|
8247
|
+
isInsideEscape = true;
|
|
8248
|
+
isInsideLinkEscape = word.startsWith(ANSI_ESCAPE_LINK, rawCharacterIndex + 1);
|
|
8249
|
+
}
|
|
8250
|
+
if (isInsideEscape) {
|
|
8251
|
+
if (isInsideLinkEscape) {
|
|
8252
|
+
if (character === ANSI_ESCAPE_BELL) {
|
|
8253
|
+
isInsideEscape = false;
|
|
8254
|
+
isInsideLinkEscape = false;
|
|
8255
|
+
}
|
|
8256
|
+
} else if (character === ANSI_SGR_TERMINATOR) {
|
|
8257
|
+
isInsideEscape = false;
|
|
8258
|
+
}
|
|
8259
|
+
} else {
|
|
8260
|
+
visible += characterLength;
|
|
8261
|
+
if (visible === columns && !nextCharacter.done) {
|
|
8262
|
+
rows.push("");
|
|
8263
|
+
visible = 0;
|
|
8264
|
+
}
|
|
8265
|
+
}
|
|
8266
|
+
currentCharacter = nextCharacter;
|
|
8267
|
+
nextCharacter = characters.next();
|
|
8268
|
+
rawCharacterIndex += character.length;
|
|
8269
|
+
}
|
|
8270
|
+
lastRow = rows.at(-1);
|
|
8271
|
+
if (!visible && lastRow !== void 0 && lastRow.length && rows.length > 1) {
|
|
8272
|
+
rows[rows.length - 2] += rows.pop();
|
|
8273
|
+
}
|
|
8274
|
+
};
|
|
8275
|
+
var stringVisibleTrimSpacesRight = (string4) => {
|
|
8276
|
+
const words = string4.split(" ");
|
|
8277
|
+
let last = words.length;
|
|
8278
|
+
while (last) {
|
|
8279
|
+
if (dist_default2(words[last - 1])) {
|
|
8280
|
+
break;
|
|
8281
|
+
}
|
|
8282
|
+
last--;
|
|
8283
|
+
}
|
|
8284
|
+
if (last === words.length) {
|
|
8285
|
+
return string4;
|
|
8286
|
+
}
|
|
8287
|
+
return words.slice(0, last).join(" ") + words.slice(last).join("");
|
|
8288
|
+
};
|
|
8289
|
+
var exec = (string4, columns, options = {}) => {
|
|
8290
|
+
if (options.trim !== false && string4.trim() === "") {
|
|
8291
|
+
return "";
|
|
8292
|
+
}
|
|
8293
|
+
let returnValue = "";
|
|
8294
|
+
let escapeCode;
|
|
8295
|
+
let escapeUrl;
|
|
8296
|
+
const words = string4.split(" ");
|
|
8297
|
+
let rows = [""];
|
|
8298
|
+
let rowLength = 0;
|
|
8299
|
+
for (let index = 0; index < words.length; index++) {
|
|
8300
|
+
const word = words[index];
|
|
8301
|
+
if (options.trim !== false) {
|
|
8302
|
+
const row = rows.at(-1) ?? "";
|
|
8303
|
+
const trimmed = row.trimStart();
|
|
8304
|
+
if (row.length !== trimmed.length) {
|
|
8305
|
+
rows[rows.length - 1] = trimmed;
|
|
8306
|
+
rowLength = dist_default2(trimmed);
|
|
8307
|
+
}
|
|
8308
|
+
}
|
|
8309
|
+
if (index !== 0) {
|
|
8310
|
+
if (rowLength >= columns && (options.wordWrap === false || options.trim === false)) {
|
|
8311
|
+
rows.push("");
|
|
8312
|
+
rowLength = 0;
|
|
8313
|
+
}
|
|
8314
|
+
if (rowLength || options.trim === false) {
|
|
8315
|
+
rows[rows.length - 1] += " ";
|
|
8316
|
+
rowLength++;
|
|
8317
|
+
}
|
|
8318
|
+
}
|
|
8319
|
+
const wordLength = dist_default2(word);
|
|
8320
|
+
if (options.hard && wordLength > columns) {
|
|
8321
|
+
const remainingColumns = columns - rowLength;
|
|
8322
|
+
const breaksStartingThisLine = 1 + Math.floor((wordLength - remainingColumns - 1) / columns);
|
|
8323
|
+
const breaksStartingNextLine = Math.floor((wordLength - 1) / columns);
|
|
8324
|
+
if (breaksStartingNextLine < breaksStartingThisLine) {
|
|
8325
|
+
rows.push("");
|
|
8326
|
+
}
|
|
8327
|
+
wrapWord(rows, word, columns);
|
|
8328
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
8329
|
+
continue;
|
|
8330
|
+
}
|
|
8331
|
+
if (rowLength + wordLength > columns && rowLength && wordLength) {
|
|
8332
|
+
if (options.wordWrap === false && rowLength < columns) {
|
|
8333
|
+
wrapWord(rows, word, columns);
|
|
8334
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
8335
|
+
continue;
|
|
8336
|
+
}
|
|
8337
|
+
rows.push("");
|
|
8338
|
+
rowLength = 0;
|
|
8339
|
+
}
|
|
8340
|
+
if (rowLength + wordLength > columns && options.wordWrap === false) {
|
|
8341
|
+
wrapWord(rows, word, columns);
|
|
8342
|
+
rowLength = dist_default2(rows.at(-1) ?? "");
|
|
8343
|
+
continue;
|
|
8344
|
+
}
|
|
8345
|
+
rows[rows.length - 1] += word;
|
|
8346
|
+
rowLength += wordLength;
|
|
8347
|
+
}
|
|
8348
|
+
if (options.trim !== false) {
|
|
8349
|
+
rows = rows.map((row) => stringVisibleTrimSpacesRight(row));
|
|
8350
|
+
}
|
|
8351
|
+
const preString = rows.join("\n");
|
|
8352
|
+
let inSurrogate = false;
|
|
8353
|
+
for (let i = 0; i < preString.length; i++) {
|
|
8354
|
+
const character = preString[i];
|
|
8355
|
+
returnValue += character;
|
|
8356
|
+
if (!inSurrogate) {
|
|
8357
|
+
inSurrogate = character >= "\uD800" && character <= "\uDBFF";
|
|
8358
|
+
} else {
|
|
8359
|
+
continue;
|
|
8360
|
+
}
|
|
8361
|
+
if (character === ESC || character === CSI) {
|
|
8362
|
+
GROUP_REGEX.lastIndex = i + 1;
|
|
8363
|
+
const groupsResult = GROUP_REGEX.exec(preString);
|
|
8364
|
+
const groups = groupsResult?.groups;
|
|
8365
|
+
if (groups?.code !== void 0) {
|
|
8366
|
+
const code = Number.parseFloat(groups.code);
|
|
8367
|
+
escapeCode = code === END_CODE ? void 0 : code;
|
|
8368
|
+
} else if (groups?.uri !== void 0) {
|
|
8369
|
+
escapeUrl = groups.uri.length === 0 ? void 0 : groups.uri;
|
|
8370
|
+
}
|
|
8371
|
+
}
|
|
8372
|
+
if (preString[i + 1] === "\n") {
|
|
8373
|
+
if (escapeUrl) {
|
|
8374
|
+
returnValue += wrapAnsiHyperlink("");
|
|
8375
|
+
}
|
|
8376
|
+
const closingCode = escapeCode ? getClosingCode(escapeCode) : void 0;
|
|
8377
|
+
if (escapeCode && closingCode) {
|
|
8378
|
+
returnValue += wrapAnsiCode(closingCode);
|
|
8379
|
+
}
|
|
8380
|
+
} else if (character === "\n") {
|
|
8381
|
+
if (escapeCode && getClosingCode(escapeCode)) {
|
|
8382
|
+
returnValue += wrapAnsiCode(escapeCode);
|
|
8383
|
+
}
|
|
8384
|
+
if (escapeUrl) {
|
|
8385
|
+
returnValue += wrapAnsiHyperlink(escapeUrl);
|
|
8386
|
+
}
|
|
8387
|
+
}
|
|
8388
|
+
}
|
|
8389
|
+
return returnValue;
|
|
8390
|
+
};
|
|
8391
|
+
var CRLF_OR_LF = /\r?\n/;
|
|
8392
|
+
function wrapAnsi(string4, columns, options) {
|
|
8393
|
+
return String(string4).normalize().split(CRLF_OR_LF).map((line) => exec(line, columns, options)).join("\n");
|
|
8394
|
+
}
|
|
8027
8395
|
|
|
8028
8396
|
// node_modules/.pnpm/@clack+core@1.2.0/node_modules/@clack/core/dist/index.mjs
|
|
8029
8397
|
var import_sisteransi = __toESM(require_src(), 1);
|
|
@@ -8031,7 +8399,196 @@ var import_node_tty = require("tty");
|
|
|
8031
8399
|
var E = ["up", "down", "left", "right", "space", "enter", "cancel"];
|
|
8032
8400
|
var G = ["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"];
|
|
8033
8401
|
var u = { actions: new Set(E), aliases: /* @__PURE__ */ new Map([["k", "up"], ["j", "down"], ["h", "left"], ["l", "right"], ["", "cancel"], ["escape", "cancel"]]), messages: { cancel: "Canceled", error: "Something went wrong" }, withGuide: true, date: { monthNames: [...G], messages: { required: "Please enter a valid date", invalidMonth: "There are only 12 months in a year", invalidDay: (r, t2) => `There are only ${r} days in ${t2}`, afterMin: (r) => `Date must be on or after ${r.toISOString().slice(0, 10)}`, beforeMax: (r) => `Date must be on or before ${r.toISOString().slice(0, 10)}` } } };
|
|
8402
|
+
function V(r, t2) {
|
|
8403
|
+
if (typeof r == "string") return u.aliases.get(r) === t2;
|
|
8404
|
+
for (const e of r) if (e !== void 0 && V(e, t2)) return true;
|
|
8405
|
+
return false;
|
|
8406
|
+
}
|
|
8407
|
+
function j(r, t2) {
|
|
8408
|
+
if (r === t2) return;
|
|
8409
|
+
const e = r.split(`
|
|
8410
|
+
`), s = t2.split(`
|
|
8411
|
+
`), i = Math.max(e.length, s.length), n = [];
|
|
8412
|
+
for (let o = 0; o < i; o++) e[o] !== s[o] && n.push(o);
|
|
8413
|
+
return { lines: n, numLinesBefore: e.length, numLinesAfter: s.length, numLines: i };
|
|
8414
|
+
}
|
|
8034
8415
|
var Y = globalThis.process.platform.startsWith("win");
|
|
8416
|
+
var C = /* @__PURE__ */ Symbol("clack:cancel");
|
|
8417
|
+
function q(r) {
|
|
8418
|
+
return r === C;
|
|
8419
|
+
}
|
|
8420
|
+
function w(r, t2) {
|
|
8421
|
+
const e = r;
|
|
8422
|
+
e.isTTY && e.setRawMode(t2);
|
|
8423
|
+
}
|
|
8424
|
+
function z({ input: r = import_node_process.stdin, output: t2 = import_node_process.stdout, overwrite: e = true, hideCursor: s = true } = {}) {
|
|
8425
|
+
const i = _.createInterface({ input: r, output: t2, prompt: "", tabSize: 1 });
|
|
8426
|
+
_.emitKeypressEvents(r, i), r instanceof import_node_tty.ReadStream && r.isTTY && r.setRawMode(true);
|
|
8427
|
+
const n = (o, { name: a, sequence: h }) => {
|
|
8428
|
+
const l = String(o);
|
|
8429
|
+
if (V([l, a, h], "cancel")) {
|
|
8430
|
+
s && t2.write(import_sisteransi.cursor.show), process.exit(0);
|
|
8431
|
+
return;
|
|
8432
|
+
}
|
|
8433
|
+
if (!e) return;
|
|
8434
|
+
const f = a === "return" ? 0 : -1, v = a === "return" ? -1 : 0;
|
|
8435
|
+
_.moveCursor(t2, f, v, () => {
|
|
8436
|
+
_.clearLine(t2, 1, () => {
|
|
8437
|
+
r.once("keypress", n);
|
|
8438
|
+
});
|
|
8439
|
+
});
|
|
8440
|
+
};
|
|
8441
|
+
return s && t2.write(import_sisteransi.cursor.hide), r.once("keypress", n), () => {
|
|
8442
|
+
r.off("keypress", n), s && t2.write(import_sisteransi.cursor.show), r instanceof import_node_tty.ReadStream && r.isTTY && !Y && r.setRawMode(false), i.terminal = false, i.close();
|
|
8443
|
+
};
|
|
8444
|
+
}
|
|
8445
|
+
var O = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80;
|
|
8446
|
+
var A = (r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20;
|
|
8447
|
+
function R(r, t2, e, s = e) {
|
|
8448
|
+
const i = O(r ?? import_node_process.stdout);
|
|
8449
|
+
return wrapAnsi(t2, i - e.length, { hard: true, trim: false }).split(`
|
|
8450
|
+
`).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
|
|
8451
|
+
`);
|
|
8452
|
+
}
|
|
8453
|
+
var p = class {
|
|
8454
|
+
input;
|
|
8455
|
+
output;
|
|
8456
|
+
_abortSignal;
|
|
8457
|
+
rl;
|
|
8458
|
+
opts;
|
|
8459
|
+
_render;
|
|
8460
|
+
_track = false;
|
|
8461
|
+
_prevFrame = "";
|
|
8462
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
8463
|
+
_cursor = 0;
|
|
8464
|
+
state = "initial";
|
|
8465
|
+
error = "";
|
|
8466
|
+
value;
|
|
8467
|
+
userInput = "";
|
|
8468
|
+
constructor(t2, e = true) {
|
|
8469
|
+
const { input: s = import_node_process.stdin, output: i = import_node_process.stdout, render: n, signal: o, ...a } = t2;
|
|
8470
|
+
this.opts = a, this.onKeypress = this.onKeypress.bind(this), this.close = this.close.bind(this), this.render = this.render.bind(this), this._render = n.bind(this), this._track = e, this._abortSignal = o, this.input = s, this.output = i;
|
|
8471
|
+
}
|
|
8472
|
+
unsubscribe() {
|
|
8473
|
+
this._subscribers.clear();
|
|
8474
|
+
}
|
|
8475
|
+
setSubscriber(t2, e) {
|
|
8476
|
+
const s = this._subscribers.get(t2) ?? [];
|
|
8477
|
+
s.push(e), this._subscribers.set(t2, s);
|
|
8478
|
+
}
|
|
8479
|
+
on(t2, e) {
|
|
8480
|
+
this.setSubscriber(t2, { cb: e });
|
|
8481
|
+
}
|
|
8482
|
+
once(t2, e) {
|
|
8483
|
+
this.setSubscriber(t2, { cb: e, once: true });
|
|
8484
|
+
}
|
|
8485
|
+
emit(t2, ...e) {
|
|
8486
|
+
const s = this._subscribers.get(t2) ?? [], i = [];
|
|
8487
|
+
for (const n of s) n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
|
|
8488
|
+
for (const n of i) n();
|
|
8489
|
+
}
|
|
8490
|
+
prompt() {
|
|
8491
|
+
return new Promise((t2) => {
|
|
8492
|
+
if (this._abortSignal) {
|
|
8493
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t2(C);
|
|
8494
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
8495
|
+
this.state = "cancel", this.close();
|
|
8496
|
+
}, { once: true });
|
|
8497
|
+
}
|
|
8498
|
+
this.rl = import_node_readline.default.createInterface({ input: this.input, tabSize: 2, prompt: "", escapeCodeTimeout: 50, terminal: true }), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, true), this.input.on("keypress", this.onKeypress), w(this.input, true), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
8499
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t2(this.value);
|
|
8500
|
+
}), this.once("cancel", () => {
|
|
8501
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t2(C);
|
|
8502
|
+
});
|
|
8503
|
+
});
|
|
8504
|
+
}
|
|
8505
|
+
_isActionKey(t2, e) {
|
|
8506
|
+
return t2 === " ";
|
|
8507
|
+
}
|
|
8508
|
+
_setValue(t2) {
|
|
8509
|
+
this.value = t2, this.emit("value", this.value);
|
|
8510
|
+
}
|
|
8511
|
+
_setUserInput(t2, e) {
|
|
8512
|
+
this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
8513
|
+
}
|
|
8514
|
+
_clearUserInput() {
|
|
8515
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
8516
|
+
}
|
|
8517
|
+
onKeypress(t2, e) {
|
|
8518
|
+
if (this._track && e.name !== "return" && (e.name && this._isActionKey(t2, e) && this.rl?.write(null, { ctrl: true, name: "h" }), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), e?.name && (!this._track && u.aliases.has(e.name) && this.emit("cursor", u.aliases.get(e.name)), u.actions.has(e.name) && this.emit("cursor", e.name)), t2 && (t2.toLowerCase() === "y" || t2.toLowerCase() === "n") && this.emit("confirm", t2.toLowerCase() === "y"), this.emit("key", t2?.toLowerCase(), e), e?.name === "return") {
|
|
8519
|
+
if (this.opts.validate) {
|
|
8520
|
+
const s = this.opts.validate(this.value);
|
|
8521
|
+
s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
8522
|
+
}
|
|
8523
|
+
this.state !== "error" && (this.state = "submit");
|
|
8524
|
+
}
|
|
8525
|
+
V([t2, e?.name, e?.sequence], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
8526
|
+
}
|
|
8527
|
+
close() {
|
|
8528
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
8529
|
+
`), w(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
8530
|
+
}
|
|
8531
|
+
restoreCursor() {
|
|
8532
|
+
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
8533
|
+
`).length - 1;
|
|
8534
|
+
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
8535
|
+
}
|
|
8536
|
+
render() {
|
|
8537
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
|
|
8538
|
+
if (t2 !== this._prevFrame) {
|
|
8539
|
+
if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
|
|
8540
|
+
else {
|
|
8541
|
+
const e = j(this._prevFrame, t2), s = A(this.output);
|
|
8542
|
+
if (this.restoreCursor(), e) {
|
|
8543
|
+
const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
|
|
8544
|
+
let o = e.lines.find((a) => a >= i);
|
|
8545
|
+
if (o === void 0) {
|
|
8546
|
+
this._prevFrame = t2;
|
|
8547
|
+
return;
|
|
8548
|
+
}
|
|
8549
|
+
if (e.lines.length === 1) {
|
|
8550
|
+
this.output.write(import_sisteransi.cursor.move(0, o - n)), this.output.write(import_sisteransi.erase.lines(1));
|
|
8551
|
+
const a = t2.split(`
|
|
8552
|
+
`);
|
|
8553
|
+
this.output.write(a[o]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, a.length - o - 1));
|
|
8554
|
+
return;
|
|
8555
|
+
} else if (e.lines.length > 1) {
|
|
8556
|
+
if (i < n) o = i;
|
|
8557
|
+
else {
|
|
8558
|
+
const h = o - n;
|
|
8559
|
+
h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
|
|
8560
|
+
}
|
|
8561
|
+
this.output.write(import_sisteransi.erase.down());
|
|
8562
|
+
const a = t2.split(`
|
|
8563
|
+
`).slice(o);
|
|
8564
|
+
this.output.write(a.join(`
|
|
8565
|
+
`)), this._prevFrame = t2;
|
|
8566
|
+
return;
|
|
8567
|
+
}
|
|
8568
|
+
}
|
|
8569
|
+
this.output.write(import_sisteransi.erase.down());
|
|
8570
|
+
}
|
|
8571
|
+
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
8572
|
+
}
|
|
8573
|
+
}
|
|
8574
|
+
};
|
|
8575
|
+
var Q = class extends p {
|
|
8576
|
+
get cursor() {
|
|
8577
|
+
return this.value ? 0 : 1;
|
|
8578
|
+
}
|
|
8579
|
+
get _value() {
|
|
8580
|
+
return this.cursor === 0;
|
|
8581
|
+
}
|
|
8582
|
+
constructor(t2) {
|
|
8583
|
+
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
8584
|
+
this.value = this._value;
|
|
8585
|
+
}), this.on("confirm", (e) => {
|
|
8586
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
|
|
8587
|
+
}), this.on("cursor", () => {
|
|
8588
|
+
this.value = !this.value;
|
|
8589
|
+
});
|
|
8590
|
+
}
|
|
8591
|
+
};
|
|
8035
8592
|
|
|
8036
8593
|
// node_modules/.pnpm/@clack+prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs
|
|
8037
8594
|
var import_node_util2 = require("util");
|
|
@@ -8043,40 +8600,81 @@ function Ze() {
|
|
|
8043
8600
|
return import_node_process2.default.platform !== "win32" ? import_node_process2.default.env.TERM !== "linux" : !!import_node_process2.default.env.CI || !!import_node_process2.default.env.WT_SESSION || !!import_node_process2.default.env.TERMINUS_SUBLIME || import_node_process2.default.env.ConEmuTask === "{cmd::Cmder}" || import_node_process2.default.env.TERM_PROGRAM === "Terminus-Sublime" || import_node_process2.default.env.TERM_PROGRAM === "vscode" || import_node_process2.default.env.TERM === "xterm-256color" || import_node_process2.default.env.TERM === "alacritty" || import_node_process2.default.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
8044
8601
|
}
|
|
8045
8602
|
var ee = Ze();
|
|
8046
|
-
var
|
|
8047
|
-
var
|
|
8048
|
-
var
|
|
8049
|
-
var
|
|
8050
|
-
var
|
|
8051
|
-
var
|
|
8052
|
-
var
|
|
8053
|
-
var
|
|
8054
|
-
var
|
|
8055
|
-
var
|
|
8056
|
-
var
|
|
8057
|
-
var
|
|
8058
|
-
var
|
|
8059
|
-
var
|
|
8060
|
-
var
|
|
8061
|
-
var
|
|
8062
|
-
var
|
|
8063
|
-
var
|
|
8064
|
-
var
|
|
8065
|
-
var
|
|
8066
|
-
var
|
|
8067
|
-
var
|
|
8068
|
-
var
|
|
8069
|
-
var
|
|
8070
|
-
var
|
|
8071
|
-
var
|
|
8603
|
+
var ae = () => process.env.CI === "true";
|
|
8604
|
+
var w2 = (e, i) => ee ? e : i;
|
|
8605
|
+
var _e = w2("\u25C6", "*");
|
|
8606
|
+
var oe = w2("\u25A0", "x");
|
|
8607
|
+
var ue = w2("\u25B2", "x");
|
|
8608
|
+
var F = w2("\u25C7", "o");
|
|
8609
|
+
var le = w2("\u250C", "T");
|
|
8610
|
+
var d = w2("\u2502", "|");
|
|
8611
|
+
var E2 = w2("\u2514", "\u2014");
|
|
8612
|
+
var Ie = w2("\u2510", "T");
|
|
8613
|
+
var Ee = w2("\u2518", "\u2014");
|
|
8614
|
+
var z2 = w2("\u25CF", ">");
|
|
8615
|
+
var H2 = w2("\u25CB", " ");
|
|
8616
|
+
var te = w2("\u25FB", "[\u2022]");
|
|
8617
|
+
var U = w2("\u25FC", "[+]");
|
|
8618
|
+
var J = w2("\u25FB", "[ ]");
|
|
8619
|
+
var xe = w2("\u25AA", "\u2022");
|
|
8620
|
+
var se = w2("\u2500", "-");
|
|
8621
|
+
var ce = w2("\u256E", "+");
|
|
8622
|
+
var Ge = w2("\u251C", "+");
|
|
8623
|
+
var $e = w2("\u256F", "+");
|
|
8624
|
+
var de = w2("\u2570", "+");
|
|
8625
|
+
var Oe = w2("\u256D", "+");
|
|
8626
|
+
var he = w2("\u25CF", "\u2022");
|
|
8627
|
+
var pe = w2("\u25C6", "*");
|
|
8628
|
+
var me = w2("\u25B2", "!");
|
|
8629
|
+
var ge = w2("\u25A0", "x");
|
|
8630
|
+
var V2 = (e) => {
|
|
8631
|
+
switch (e) {
|
|
8632
|
+
case "initial":
|
|
8633
|
+
case "active":
|
|
8634
|
+
return (0, import_node_util2.styleText)("cyan", _e);
|
|
8635
|
+
case "cancel":
|
|
8636
|
+
return (0, import_node_util2.styleText)("red", oe);
|
|
8637
|
+
case "error":
|
|
8638
|
+
return (0, import_node_util2.styleText)("yellow", ue);
|
|
8639
|
+
case "submit":
|
|
8640
|
+
return (0, import_node_util2.styleText)("green", F);
|
|
8641
|
+
}
|
|
8642
|
+
};
|
|
8643
|
+
var ot2 = (e) => {
|
|
8644
|
+
const i = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
8645
|
+
return new Q({ active: i, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
|
|
8646
|
+
const r = e.withGuide ?? u.withGuide, u2 = `${V2(this.state)} `, n = r ? `${(0, import_node_util2.styleText)("gray", d)} ` : "", o = R(e.output, e.message, n, u2), c2 = `${r ? `${(0, import_node_util2.styleText)("gray", d)}
|
|
8647
|
+
` : ""}${o}
|
|
8648
|
+
`, a = this.value ? i : s;
|
|
8649
|
+
switch (this.state) {
|
|
8650
|
+
case "submit": {
|
|
8651
|
+
const l = r ? `${(0, import_node_util2.styleText)("gray", d)} ` : "";
|
|
8652
|
+
return `${c2}${l}${(0, import_node_util2.styleText)("dim", a)}`;
|
|
8653
|
+
}
|
|
8654
|
+
case "cancel": {
|
|
8655
|
+
const l = r ? `${(0, import_node_util2.styleText)("gray", d)} ` : "";
|
|
8656
|
+
return `${c2}${l}${(0, import_node_util2.styleText)(["strikethrough", "dim"], a)}${r ? `
|
|
8657
|
+
${(0, import_node_util2.styleText)("gray", d)}` : ""}`;
|
|
8658
|
+
}
|
|
8659
|
+
default: {
|
|
8660
|
+
const l = r ? `${(0, import_node_util2.styleText)("cyan", d)} ` : "", $2 = r ? (0, import_node_util2.styleText)("cyan", E2) : "";
|
|
8661
|
+
return `${c2}${l}${this.value ? `${(0, import_node_util2.styleText)("green", z2)} ${i}` : `${(0, import_node_util2.styleText)("dim", H2)} ${(0, import_node_util2.styleText)("dim", i)}`}${e.vertical ? r ? `
|
|
8662
|
+
${(0, import_node_util2.styleText)("cyan", d)} ` : `
|
|
8663
|
+
` : ` ${(0, import_node_util2.styleText)("dim", "/")} `}${this.value ? `${(0, import_node_util2.styleText)("dim", H2)} ${(0, import_node_util2.styleText)("dim", s)}` : `${(0, import_node_util2.styleText)("green", z2)} ${s}`}
|
|
8664
|
+
${$2}
|
|
8665
|
+
`;
|
|
8666
|
+
}
|
|
8667
|
+
}
|
|
8668
|
+
} }).prompt();
|
|
8669
|
+
};
|
|
8072
8670
|
var O2 = { message: (e = [], { symbol: i = (0, import_node_util2.styleText)("gray", d), secondarySymbol: s = (0, import_node_util2.styleText)("gray", d), output: r = process.stdout, spacing: u2 = 1, withGuide: n } = {}) => {
|
|
8073
8671
|
const o = [], c2 = n ?? u.withGuide, a = c2 ? s : "", l = c2 ? `${i} ` : "", $2 = c2 ? `${s} ` : "";
|
|
8074
|
-
for (let
|
|
8672
|
+
for (let p2 = 0; p2 < u2; p2++) o.push(a);
|
|
8075
8673
|
const y2 = Array.isArray(e) ? e : e.split(`
|
|
8076
8674
|
`);
|
|
8077
8675
|
if (y2.length > 0) {
|
|
8078
|
-
const [
|
|
8079
|
-
|
|
8676
|
+
const [p2, ...m] = y2;
|
|
8677
|
+
p2.length > 0 ? o.push(`${l}${p2}`) : o.push(c2 ? i : "");
|
|
8080
8678
|
for (const g of m) g.length > 0 ? o.push(`${$2}${g}`) : o.push(c2 ? s : "");
|
|
8081
8679
|
}
|
|
8082
8680
|
r.write(`${o.join(`
|
|
@@ -8095,7 +8693,60 @@ var O2 = { message: (e = [], { symbol: i = (0, import_node_util2.styleText)("gra
|
|
|
8095
8693
|
}, error: (e, i) => {
|
|
8096
8694
|
O2.message(e, { ...i, symbol: (0, import_node_util2.styleText)("red", ge) });
|
|
8097
8695
|
} };
|
|
8098
|
-
var
|
|
8696
|
+
var Ct = (e) => (0, import_node_util2.styleText)("magenta", e);
|
|
8697
|
+
var fe = ({ indicator: e = "dots", onCancel: i, output: s = process.stdout, cancelMessage: r, errorMessage: u2, frames: n = ee ? ["\u25D2", "\u25D0", "\u25D3", "\u25D1"] : ["\u2022", "o", "O", "0"], delay: o = ee ? 80 : 120, signal: c2, ...a } = {}) => {
|
|
8698
|
+
const l = ae();
|
|
8699
|
+
let $2, y2, p2 = false, m = false, g = "", S2, h = performance.now();
|
|
8700
|
+
const f = O(s), v = a?.styleFrame ?? Ct, T = (_2) => {
|
|
8701
|
+
const A2 = _2 > 1 ? u2 ?? u.messages.error : r ?? u.messages.cancel;
|
|
8702
|
+
m = _2 === 1, p2 && (W(A2, _2), m && typeof i == "function" && i());
|
|
8703
|
+
}, C2 = () => T(2), b = () => T(1), x = () => {
|
|
8704
|
+
process.on("uncaughtExceptionMonitor", C2), process.on("unhandledRejection", C2), process.on("SIGINT", b), process.on("SIGTERM", b), process.on("exit", T), c2 && c2.addEventListener("abort", b);
|
|
8705
|
+
}, G2 = () => {
|
|
8706
|
+
process.removeListener("uncaughtExceptionMonitor", C2), process.removeListener("unhandledRejection", C2), process.removeListener("SIGINT", b), process.removeListener("SIGTERM", b), process.removeListener("exit", T), c2 && c2.removeEventListener("abort", b);
|
|
8707
|
+
}, M2 = () => {
|
|
8708
|
+
if (S2 === void 0) return;
|
|
8709
|
+
l && s.write(`
|
|
8710
|
+
`);
|
|
8711
|
+
const _2 = wrapAnsi(S2, f, { hard: true, trim: false }).split(`
|
|
8712
|
+
`);
|
|
8713
|
+
_2.length > 1 && s.write(import_sisteransi2.cursor.up(_2.length - 1)), s.write(import_sisteransi2.cursor.to(0)), s.write(import_sisteransi2.erase.down());
|
|
8714
|
+
}, R2 = (_2) => _2.replace(/\.+$/, ""), j2 = (_2) => {
|
|
8715
|
+
const A2 = (performance.now() - _2) / 1e3, k = Math.floor(A2 / 60), L = Math.floor(A2 % 60);
|
|
8716
|
+
return k > 0 ? `[${k}m ${L}s]` : `[${L}s]`;
|
|
8717
|
+
}, D2 = a.withGuide ?? u.withGuide, ie = (_2 = "") => {
|
|
8718
|
+
p2 = true, $2 = z({ output: s }), g = R2(_2), h = performance.now(), D2 && s.write(`${(0, import_node_util2.styleText)("gray", d)}
|
|
8719
|
+
`);
|
|
8720
|
+
let A2 = 0, k = 0;
|
|
8721
|
+
x(), y2 = setInterval(() => {
|
|
8722
|
+
if (l && g === S2) return;
|
|
8723
|
+
M2(), S2 = g;
|
|
8724
|
+
const L = v(n[A2]);
|
|
8725
|
+
let Z;
|
|
8726
|
+
if (l) Z = `${L} ${g}...`;
|
|
8727
|
+
else if (e === "timer") Z = `${L} ${g} ${j2(h)}`;
|
|
8728
|
+
else {
|
|
8729
|
+
const Be = ".".repeat(Math.floor(k)).slice(0, 3);
|
|
8730
|
+
Z = `${L} ${g}${Be}`;
|
|
8731
|
+
}
|
|
8732
|
+
const Ne = wrapAnsi(Z, f, { hard: true, trim: false });
|
|
8733
|
+
s.write(Ne), A2 = A2 + 1 < n.length ? A2 + 1 : 0, k = k < 4 ? k + 0.125 : 0;
|
|
8734
|
+
}, o);
|
|
8735
|
+
}, W = (_2 = "", A2 = 0, k = false) => {
|
|
8736
|
+
if (!p2) return;
|
|
8737
|
+
p2 = false, clearInterval(y2), M2();
|
|
8738
|
+
const L = A2 === 0 ? (0, import_node_util2.styleText)("green", F) : A2 === 1 ? (0, import_node_util2.styleText)("red", oe) : (0, import_node_util2.styleText)("red", ue);
|
|
8739
|
+
g = _2 ?? g, k || (e === "timer" ? s.write(`${L} ${g} ${j2(h)}
|
|
8740
|
+
`) : s.write(`${L} ${g}
|
|
8741
|
+
`)), G2(), $2();
|
|
8742
|
+
};
|
|
8743
|
+
return { start: ie, stop: (_2 = "") => W(_2, 0), message: (_2 = "") => {
|
|
8744
|
+
g = R2(_2 ?? g);
|
|
8745
|
+
}, cancel: (_2 = "") => W(_2, 1), error: (_2 = "") => W(_2, 2), clear: () => W("", 0, true), get isCancelled() {
|
|
8746
|
+
return m;
|
|
8747
|
+
} };
|
|
8748
|
+
};
|
|
8749
|
+
var Ve = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
|
|
8099
8750
|
var je = `${(0, import_node_util2.styleText)("gray", d)} `;
|
|
8100
8751
|
|
|
8101
8752
|
// src/output/exit-codes.ts
|
|
@@ -8215,14 +8866,14 @@ async function ensureDirectory(absPath) {
|
|
|
8215
8866
|
}
|
|
8216
8867
|
}
|
|
8217
8868
|
async function runBuild(options, deps = {}) {
|
|
8218
|
-
const
|
|
8869
|
+
const exec2 = deps.exec ?? defaultExec;
|
|
8219
8870
|
const absCwd = (0, import_node_path3.isAbsolute)(options.cwd) ? options.cwd : (0, import_node_path3.resolve)(options.cwd);
|
|
8220
8871
|
const absOutput = (0, import_node_path3.isAbsolute)(options.outputDir) ? options.outputDir : (0, import_node_path3.resolve)(absCwd, options.outputDir);
|
|
8221
8872
|
if (!options.command) {
|
|
8222
8873
|
await ensureDirectory(absOutput);
|
|
8223
8874
|
return { skipped: true, outputDir: absOutput };
|
|
8224
8875
|
}
|
|
8225
|
-
const code = await
|
|
8876
|
+
const code = await exec2({ command: options.command, cwd: absCwd });
|
|
8226
8877
|
if (code !== 0) {
|
|
8227
8878
|
throw new ConfigError(
|
|
8228
8879
|
`build command failed with exit code ${code}: ${options.command}`
|
|
@@ -8372,7 +9023,7 @@ function normalize(rel) {
|
|
|
8372
9023
|
return out;
|
|
8373
9024
|
}
|
|
8374
9025
|
function createIgnoreFilter(patterns) {
|
|
8375
|
-
const compiled = patterns.filter((
|
|
9026
|
+
const compiled = patterns.filter((p2) => p2.length > 0).map(compilePattern);
|
|
8376
9027
|
return (relPath) => {
|
|
8377
9028
|
const norm = normalize(relPath);
|
|
8378
9029
|
for (const c2 of compiled) {
|
|
@@ -11532,7 +12183,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
11532
12183
|
defineLazy(inst._zod, "pattern", () => {
|
|
11533
12184
|
if (def.options.every((o) => o._zod.pattern)) {
|
|
11534
12185
|
const patterns = def.options.map((o) => o._zod.pattern);
|
|
11535
|
-
return new RegExp(`^(${patterns.map((
|
|
12186
|
+
return new RegExp(`^(${patterns.map((p2) => cleanRegex(p2.source)).join("|")})$`);
|
|
11536
12187
|
}
|
|
11537
12188
|
return void 0;
|
|
11538
12189
|
});
|
|
@@ -18209,9 +18860,9 @@ var $ZodRegistry = class {
|
|
|
18209
18860
|
return this;
|
|
18210
18861
|
}
|
|
18211
18862
|
get(schema) {
|
|
18212
|
-
const
|
|
18213
|
-
if (
|
|
18214
|
-
const pm = { ...this.get(
|
|
18863
|
+
const p2 = schema._zod.parent;
|
|
18864
|
+
if (p2) {
|
|
18865
|
+
const pm = { ...this.get(p2) ?? {} };
|
|
18215
18866
|
delete pm.id;
|
|
18216
18867
|
const f = { ...pm, ...this._map.get(schema) };
|
|
18217
18868
|
return Object.keys(f).length ? f : void 0;
|
|
@@ -22249,17 +22900,17 @@ function editDistance(a, b) {
|
|
|
22249
22900
|
() => new Array(n + 1).fill(0)
|
|
22250
22901
|
);
|
|
22251
22902
|
for (let i = 0; i <= m; i++) d2[i][0] = i;
|
|
22252
|
-
for (let
|
|
22903
|
+
for (let j2 = 0; j2 <= n; j2++) d2[0][j2] = j2;
|
|
22253
22904
|
for (let i = 1; i <= m; i++) {
|
|
22254
|
-
for (let
|
|
22255
|
-
const cost = a[i - 1] === b[
|
|
22256
|
-
d2[i][
|
|
22257
|
-
d2[i - 1][
|
|
22258
|
-
d2[i][
|
|
22259
|
-
d2[i - 1][
|
|
22905
|
+
for (let j2 = 1; j2 <= n; j2++) {
|
|
22906
|
+
const cost = a[i - 1] === b[j2 - 1] ? 0 : 1;
|
|
22907
|
+
d2[i][j2] = Math.min(
|
|
22908
|
+
d2[i - 1][j2] + 1,
|
|
22909
|
+
d2[i][j2 - 1] + 1,
|
|
22910
|
+
d2[i - 1][j2 - 1] + cost
|
|
22260
22911
|
);
|
|
22261
|
-
if (i > 1 &&
|
|
22262
|
-
d2[i][
|
|
22912
|
+
if (i > 1 && j2 > 1 && a[i - 1] === b[j2 - 2] && a[i - 2] === b[j2 - 1]) {
|
|
22913
|
+
d2[i][j2] = Math.min(d2[i][j2], d2[i - 2][j2 - 2] + 1);
|
|
22263
22914
|
}
|
|
22264
22915
|
}
|
|
22265
22916
|
}
|
|
@@ -22286,6 +22937,14 @@ function suggest(target, candidates, threshold = 2) {
|
|
|
22286
22937
|
}
|
|
22287
22938
|
|
|
22288
22939
|
// src/lib/proxy-client.ts
|
|
22940
|
+
var DEFAULT_FETCH_TIMEOUT_MS = 3e4;
|
|
22941
|
+
function parseFetchTimeoutMs(env) {
|
|
22942
|
+
const raw = env["UNIVERSE_FETCH_TIMEOUT_MS"];
|
|
22943
|
+
if (raw === void 0 || raw === "") return void 0;
|
|
22944
|
+
const n = Number(raw);
|
|
22945
|
+
if (!Number.isFinite(n) || n < 0) return void 0;
|
|
22946
|
+
return Math.floor(n);
|
|
22947
|
+
}
|
|
22289
22948
|
var ProxyError = class extends CliError {
|
|
22290
22949
|
exitCode;
|
|
22291
22950
|
status;
|
|
@@ -22297,6 +22956,13 @@ var ProxyError = class extends CliError {
|
|
|
22297
22956
|
this.exitCode = mapExitCode(status);
|
|
22298
22957
|
}
|
|
22299
22958
|
};
|
|
22959
|
+
var AliasDriftError = class extends ProxyError {
|
|
22960
|
+
current;
|
|
22961
|
+
constructor(message, current) {
|
|
22962
|
+
super(409, "alias_drift", message);
|
|
22963
|
+
this.current = current;
|
|
22964
|
+
}
|
|
22965
|
+
};
|
|
22300
22966
|
function mapExitCode(status) {
|
|
22301
22967
|
if (status === 401 || status === 403) return EXIT_CREDENTIALS;
|
|
22302
22968
|
if (status === 422 || status === 0 || status >= 500) return EXIT_STORAGE;
|
|
@@ -22332,9 +22998,11 @@ async function readErrorEnvelope(response) {
|
|
|
22332
22998
|
};
|
|
22333
22999
|
}
|
|
22334
23000
|
if (isProxyErrorEnvelope(raw) && raw.error) {
|
|
23001
|
+
const current = typeof raw.current === "string" ? raw.current : void 0;
|
|
22335
23002
|
return {
|
|
22336
23003
|
code: raw.error.code ?? `http_${status}`,
|
|
22337
|
-
message: raw.error.message ?? response.statusText ?? "request failed"
|
|
23004
|
+
message: raw.error.message ?? response.statusText ?? "request failed",
|
|
23005
|
+
...current === void 0 ? {} : { current }
|
|
22338
23006
|
};
|
|
22339
23007
|
}
|
|
22340
23008
|
return {
|
|
@@ -22342,12 +23010,36 @@ async function readErrorEnvelope(response) {
|
|
|
22342
23010
|
message: response.statusText || "request failed"
|
|
22343
23011
|
};
|
|
22344
23012
|
}
|
|
23013
|
+
function throwProxyError(status, env) {
|
|
23014
|
+
if (status === 409 && env.code === "alias_drift") {
|
|
23015
|
+
throw new AliasDriftError(env.message, env.current ?? "");
|
|
23016
|
+
}
|
|
23017
|
+
throw new ProxyError(status, env.code, env.message);
|
|
23018
|
+
}
|
|
22345
23019
|
function stripTrailingSlash(url2) {
|
|
22346
23020
|
return url2.endsWith("/") ? url2.slice(0, -1) : url2;
|
|
22347
23021
|
}
|
|
22348
23022
|
function createProxyClient(cfg) {
|
|
22349
23023
|
const base = stripTrailingSlash(cfg.baseUrl);
|
|
22350
23024
|
const fetchImpl = cfg.fetch ?? globalThis.fetch.bind(globalThis);
|
|
23025
|
+
const timeoutMs = cfg.timeoutMs ?? DEFAULT_FETCH_TIMEOUT_MS;
|
|
23026
|
+
function withTimeoutSignal(init) {
|
|
23027
|
+
if (timeoutMs <= 0) return init;
|
|
23028
|
+
const timeoutSignal = AbortSignal.timeout(timeoutMs);
|
|
23029
|
+
const merged = init.signal ? AbortSignal.any([init.signal, timeoutSignal]) : timeoutSignal;
|
|
23030
|
+
return { ...init, signal: merged };
|
|
23031
|
+
}
|
|
23032
|
+
function translateFetchError(err) {
|
|
23033
|
+
if (err instanceof DOMException && (err.name === "TimeoutError" || err.name === "AbortError")) {
|
|
23034
|
+
throw new ProxyError(
|
|
23035
|
+
0,
|
|
23036
|
+
"timeout",
|
|
23037
|
+
`proxy timed out after ${timeoutMs}ms`
|
|
23038
|
+
);
|
|
23039
|
+
}
|
|
23040
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
23041
|
+
throw new ProxyError(0, "network_error", `proxy unreachable: ${message}`);
|
|
23042
|
+
}
|
|
22351
23043
|
async function userBearer() {
|
|
22352
23044
|
const tok = await cfg.getAuthToken();
|
|
22353
23045
|
return `Bearer ${tok}`;
|
|
@@ -22355,14 +23047,13 @@ function createProxyClient(cfg) {
|
|
|
22355
23047
|
async function call(url2, init) {
|
|
22356
23048
|
let response;
|
|
22357
23049
|
try {
|
|
22358
|
-
response = await fetchImpl(url2, init);
|
|
23050
|
+
response = await fetchImpl(url2, withTimeoutSignal(init));
|
|
22359
23051
|
} catch (err) {
|
|
22360
|
-
|
|
22361
|
-
throw new ProxyError(0, "network_error", `proxy unreachable: ${message}`);
|
|
23052
|
+
translateFetchError(err);
|
|
22362
23053
|
}
|
|
22363
23054
|
if (!response.ok) {
|
|
22364
23055
|
const env = await readErrorEnvelope(response);
|
|
22365
|
-
|
|
23056
|
+
throwProxyError(response.status, env);
|
|
22366
23057
|
}
|
|
22367
23058
|
if (response.status === 204) {
|
|
22368
23059
|
return void 0;
|
|
@@ -22426,18 +23117,53 @@ function createProxyClient(cfg) {
|
|
|
22426
23117
|
}
|
|
22427
23118
|
});
|
|
22428
23119
|
},
|
|
23120
|
+
async getAlias(req) {
|
|
23121
|
+
const url2 = `${base}/api/site/${encodeURIComponent(req.site)}/alias/${encodeURIComponent(req.mode)}`;
|
|
23122
|
+
let response;
|
|
23123
|
+
try {
|
|
23124
|
+
response = await fetchImpl(
|
|
23125
|
+
url2,
|
|
23126
|
+
withTimeoutSignal({
|
|
23127
|
+
method: "GET",
|
|
23128
|
+
headers: {
|
|
23129
|
+
Authorization: await userBearer(),
|
|
23130
|
+
Accept: "application/json"
|
|
23131
|
+
}
|
|
23132
|
+
})
|
|
23133
|
+
);
|
|
23134
|
+
} catch (err) {
|
|
23135
|
+
translateFetchError(err);
|
|
23136
|
+
}
|
|
23137
|
+
if (response.status === 404) return null;
|
|
23138
|
+
if (!response.ok) {
|
|
23139
|
+
const env = await readErrorEnvelope(response);
|
|
23140
|
+
throwProxyError(response.status, env);
|
|
23141
|
+
}
|
|
23142
|
+
return await response.json();
|
|
23143
|
+
},
|
|
22429
23144
|
async sitePromote(req) {
|
|
22430
23145
|
const url2 = `${base}/api/site/${encodeURIComponent(req.site)}/promote`;
|
|
23146
|
+
const headers = {
|
|
23147
|
+
Authorization: await userBearer(),
|
|
23148
|
+
Accept: "application/json"
|
|
23149
|
+
};
|
|
23150
|
+
const body = {};
|
|
23151
|
+
if (req.deployId !== void 0) body.deployId = req.deployId;
|
|
23152
|
+
if (req.expectedCurrent !== void 0)
|
|
23153
|
+
body.expectedCurrent = req.expectedCurrent;
|
|
23154
|
+
const hasBody = Object.keys(body).length > 0;
|
|
23155
|
+
if (hasBody) headers["Content-Type"] = "application/json";
|
|
22431
23156
|
return call(url2, {
|
|
22432
23157
|
method: "POST",
|
|
22433
|
-
headers
|
|
22434
|
-
|
|
22435
|
-
Accept: "application/json"
|
|
22436
|
-
}
|
|
23158
|
+
headers,
|
|
23159
|
+
...hasBody ? { body: JSON.stringify(body) } : {}
|
|
22437
23160
|
});
|
|
22438
23161
|
},
|
|
22439
23162
|
async siteRollback(req) {
|
|
22440
23163
|
const url2 = `${base}/api/site/${encodeURIComponent(req.site)}/rollback`;
|
|
23164
|
+
const body = { to: req.to };
|
|
23165
|
+
if (req.expectedCurrent !== void 0)
|
|
23166
|
+
body.expectedCurrent = req.expectedCurrent;
|
|
22441
23167
|
return call(url2, {
|
|
22442
23168
|
method: "POST",
|
|
22443
23169
|
headers: {
|
|
@@ -22445,7 +23171,7 @@ function createProxyClient(cfg) {
|
|
|
22445
23171
|
Accept: "application/json",
|
|
22446
23172
|
"Content-Type": "application/json"
|
|
22447
23173
|
},
|
|
22448
|
-
body: JSON.stringify(
|
|
23174
|
+
body: JSON.stringify(body)
|
|
22449
23175
|
});
|
|
22450
23176
|
},
|
|
22451
23177
|
async registerSite(req) {
|
|
@@ -22650,6 +23376,103 @@ function buildErrorEnvelope(command, code, message, issues) {
|
|
|
22650
23376
|
};
|
|
22651
23377
|
}
|
|
22652
23378
|
|
|
23379
|
+
// src/output/redact.ts
|
|
23380
|
+
var AWS_KEY_PREFIX_PATTERN = /(?:AKIA|ASIA|AROA|AIDA|ACCA|ANPA|ABIA|AGPA)[A-Z0-9]{12,}/g;
|
|
23381
|
+
var URL_CREDS_PATTERN = /https?:\/\/[^@\s]+@/g;
|
|
23382
|
+
var CREDENTIAL_CONTEXT_PATTERN = /(?:access_key_id|secret_access_key|accessKeyId|secretAccessKey|secret|password|token|key|credential|auth)\s*[=:]\s*([A-Za-z0-9/+=]{21,})/gi;
|
|
23383
|
+
var HEX_CREDENTIAL_CONTEXT_PATTERN = /(?:secret|password|token|key|credential|auth|access_key_id|secret_access_key)\s*[=:]\s*([a-f0-9]{32,})/gi;
|
|
23384
|
+
var JSON_CREDENTIAL_PATTERN = /"(?:secret|password|token|key|credential|auth|access_key_id|secret_access_key|accessKeyId|secretAccessKey)"\s*:\s*"[^"]+"/gi;
|
|
23385
|
+
var BEARER_PATTERN = /\bBearer\s+[A-Za-z0-9._~+/=-]+/gi;
|
|
23386
|
+
var CREDENTIAL_KEY_PATTERN = /(?:secret|password|token|key|credential|auth)/i;
|
|
23387
|
+
var EXACT_CREDENTIAL_KEYS = /* @__PURE__ */ new Set([
|
|
23388
|
+
"accesskeyid",
|
|
23389
|
+
"secretaccesskey",
|
|
23390
|
+
"access_key_id",
|
|
23391
|
+
"secret_access_key"
|
|
23392
|
+
]);
|
|
23393
|
+
var STANDALONE_LONG_SECRET = /^[A-Za-z0-9/+=]{21,}$/;
|
|
23394
|
+
function maskAwsKey(match) {
|
|
23395
|
+
return match.slice(0, 4) + "****" + match.slice(-4);
|
|
23396
|
+
}
|
|
23397
|
+
function maskUrlCreds(match) {
|
|
23398
|
+
const atIndex = match.lastIndexOf("@");
|
|
23399
|
+
const protocolEnd = match.indexOf("://") + 3;
|
|
23400
|
+
return match.slice(0, protocolEnd) + "****:****@" + match.slice(atIndex + 1);
|
|
23401
|
+
}
|
|
23402
|
+
function redact(value) {
|
|
23403
|
+
let result = value;
|
|
23404
|
+
result = result.replace(URL_CREDS_PATTERN, maskUrlCreds);
|
|
23405
|
+
result = result.replace(AWS_KEY_PREFIX_PATTERN, maskAwsKey);
|
|
23406
|
+
result = result.replace(BEARER_PATTERN, "Bearer ****");
|
|
23407
|
+
result = result.replace(JSON_CREDENTIAL_PATTERN, (match) => {
|
|
23408
|
+
const colonIndex = match.indexOf(":");
|
|
23409
|
+
return match.slice(0, colonIndex + 1) + '"****"';
|
|
23410
|
+
});
|
|
23411
|
+
result = result.replace(
|
|
23412
|
+
CREDENTIAL_CONTEXT_PATTERN,
|
|
23413
|
+
(_match, _secret, _offset, _full) => {
|
|
23414
|
+
const eqIndex = _match.indexOf("=");
|
|
23415
|
+
const colonIndex = _match.indexOf(":");
|
|
23416
|
+
const sepIndex = eqIndex >= 0 && colonIndex >= 0 ? Math.min(eqIndex, colonIndex) : eqIndex >= 0 ? eqIndex : colonIndex;
|
|
23417
|
+
const prefix = _match.slice(0, sepIndex + 1);
|
|
23418
|
+
return prefix + "****";
|
|
23419
|
+
}
|
|
23420
|
+
);
|
|
23421
|
+
result = result.replace(HEX_CREDENTIAL_CONTEXT_PATTERN, (_match, _secret) => {
|
|
23422
|
+
const eqIndex = _match.indexOf("=");
|
|
23423
|
+
const colonIndex = _match.indexOf(":");
|
|
23424
|
+
const sepIndex = eqIndex >= 0 && colonIndex >= 0 ? Math.min(eqIndex, colonIndex) : eqIndex >= 0 ? eqIndex : colonIndex;
|
|
23425
|
+
const prefix = _match.slice(0, sepIndex + 1);
|
|
23426
|
+
return prefix + "****";
|
|
23427
|
+
});
|
|
23428
|
+
return result;
|
|
23429
|
+
}
|
|
23430
|
+
function redactValue(value, keyName) {
|
|
23431
|
+
if (typeof value === "string") {
|
|
23432
|
+
if (keyName && EXACT_CREDENTIAL_KEYS.has(keyName.toLowerCase())) {
|
|
23433
|
+
return "****";
|
|
23434
|
+
}
|
|
23435
|
+
const redacted = redact(value);
|
|
23436
|
+
if (redacted === value && keyName && CREDENTIAL_KEY_PATTERN.test(keyName) && STANDALONE_LONG_SECRET.test(value)) {
|
|
23437
|
+
return "****";
|
|
23438
|
+
}
|
|
23439
|
+
return redacted;
|
|
23440
|
+
}
|
|
23441
|
+
if (Array.isArray(value)) {
|
|
23442
|
+
return value.map((v) => redactValue(v, keyName));
|
|
23443
|
+
}
|
|
23444
|
+
if (value !== null && typeof value === "object") {
|
|
23445
|
+
return redactObject(value);
|
|
23446
|
+
}
|
|
23447
|
+
return value;
|
|
23448
|
+
}
|
|
23449
|
+
function redactObject(obj) {
|
|
23450
|
+
const result = {};
|
|
23451
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
23452
|
+
result[key] = redactValue(value, key);
|
|
23453
|
+
}
|
|
23454
|
+
return result;
|
|
23455
|
+
}
|
|
23456
|
+
|
|
23457
|
+
// src/output/format.ts
|
|
23458
|
+
function outputError(ctx, code, message, optsOrIssues) {
|
|
23459
|
+
const opts = Array.isArray(optsOrIssues) ? { issues: optsOrIssues } : optsOrIssues ?? {};
|
|
23460
|
+
const redactedMessage = redact(message);
|
|
23461
|
+
const redactedIssues = opts.issues?.map(redact);
|
|
23462
|
+
if (ctx.json) {
|
|
23463
|
+
const envelope = buildErrorEnvelope(
|
|
23464
|
+
ctx.command,
|
|
23465
|
+
code,
|
|
23466
|
+
redactedMessage,
|
|
23467
|
+
redactedIssues
|
|
23468
|
+
);
|
|
23469
|
+
const payload = opts.extras ? { ...envelope, ...redactObject(opts.extras) } : envelope;
|
|
23470
|
+
process.stdout.write(JSON.stringify(payload) + "\n");
|
|
23471
|
+
} else {
|
|
23472
|
+
(opts.logError ?? ((m) => O2.error(m)))(redactedMessage);
|
|
23473
|
+
}
|
|
23474
|
+
}
|
|
23475
|
+
|
|
22653
23476
|
// src/commands/deploy.ts
|
|
22654
23477
|
var defaultReadPlatformYaml = async (cwd) => {
|
|
22655
23478
|
return (0, import_promises4.readFile)((0, import_node_path5.resolve)(cwd, "platform.yaml"), "utf-8");
|
|
@@ -22743,6 +23566,7 @@ async function deploy(options, deps = {}) {
|
|
|
22743
23566
|
const build = deps.runBuild ?? runBuild;
|
|
22744
23567
|
const walk = deps.walkFiles ?? walkFiles;
|
|
22745
23568
|
const upload = deps.uploadFiles ?? uploadFiles;
|
|
23569
|
+
const mkSpinner = deps.createSpinner ?? (() => fe());
|
|
22746
23570
|
const success2 = deps.logSuccess ?? ((s) => O2.success(s));
|
|
22747
23571
|
const info = deps.logInfo ?? ((s) => O2.info(s));
|
|
22748
23572
|
const warn = deps.logWarn ?? ((s) => O2.warn(s));
|
|
@@ -22759,7 +23583,8 @@ async function deploy(options, deps = {}) {
|
|
|
22759
23583
|
const baseUrl = env["UNIVERSE_PROXY_URL"] ?? DEFAULT_PROXY_URL;
|
|
22760
23584
|
const client = mkClient({
|
|
22761
23585
|
baseUrl,
|
|
22762
|
-
getAuthToken: () => identity.token
|
|
23586
|
+
getAuthToken: () => identity.token,
|
|
23587
|
+
timeoutMs: parseFetchTimeoutMs(env)
|
|
22763
23588
|
});
|
|
22764
23589
|
let me2;
|
|
22765
23590
|
try {
|
|
@@ -22810,17 +23635,22 @@ async function deploy(options, deps = {}) {
|
|
|
22810
23635
|
} catch (err) {
|
|
22811
23636
|
rethrowProxy("deploy init failed", err);
|
|
22812
23637
|
}
|
|
23638
|
+
const spin = options.json ? null : mkSpinner();
|
|
23639
|
+
spin?.start(`Uploading 0/${filtered.length} files`);
|
|
22813
23640
|
const uploadResult = await upload({
|
|
22814
23641
|
client,
|
|
22815
23642
|
deployId: initResult.deployId,
|
|
22816
23643
|
jwt: initResult.jwt,
|
|
22817
|
-
files: filtered
|
|
23644
|
+
files: filtered,
|
|
23645
|
+
onProgress: spin ? (p2) => spin.message(`Uploading ${p2.uploaded}/${p2.total} \u2014 ${p2.current}`) : void 0
|
|
22818
23646
|
});
|
|
22819
23647
|
if (uploadResult.errors.length > 0) {
|
|
23648
|
+
spin?.error(`Upload failed: ${uploadResult.errors.length} file(s)`);
|
|
22820
23649
|
const message = `Upload partially failed: ${uploadResult.errors.length} file(s) failed:
|
|
22821
23650
|
- ${uploadResult.errors.join("\n - ")}`;
|
|
22822
23651
|
throw new PartialUploadError(message);
|
|
22823
23652
|
}
|
|
23653
|
+
spin?.stop(`Uploaded ${uploadResult.fileCount} files`);
|
|
22824
23654
|
const mode = options.promote ? "production" : "preview";
|
|
22825
23655
|
let finalizeResult;
|
|
22826
23656
|
try {
|
|
@@ -22833,6 +23663,25 @@ async function deploy(options, deps = {}) {
|
|
|
22833
23663
|
} catch (err) {
|
|
22834
23664
|
rethrowProxy("deploy finalize failed", err);
|
|
22835
23665
|
}
|
|
23666
|
+
if (options.promote && !options.json) {
|
|
23667
|
+
try {
|
|
23668
|
+
const preview = await client.getAlias({
|
|
23669
|
+
site: config2.site,
|
|
23670
|
+
mode: "preview"
|
|
23671
|
+
});
|
|
23672
|
+
if (preview && preview.deployId !== finalizeResult.deployId) {
|
|
23673
|
+
warn(
|
|
23674
|
+
`Preview alias still points to ${preview.deployId}; it will not auto-update. Run \`universe static deploy\` (without --promote) to refresh preview.`
|
|
23675
|
+
);
|
|
23676
|
+
}
|
|
23677
|
+
} catch (err) {
|
|
23678
|
+
if (err instanceof ProxyError && (err.status === 401 || err.status === 403)) {
|
|
23679
|
+
warn(
|
|
23680
|
+
`Preview alias probe got ${err.status} (${err.code}) \u2014 token may need rotation: ${err.message}`
|
|
23681
|
+
);
|
|
23682
|
+
}
|
|
23683
|
+
}
|
|
23684
|
+
}
|
|
22836
23685
|
if (options.json) {
|
|
22837
23686
|
emitJson(
|
|
22838
23687
|
buildEnvelope("deploy", true, {
|
|
@@ -22879,11 +23728,9 @@ async function deploy(options, deps = {}) {
|
|
|
22879
23728
|
code = EXIT_USAGE;
|
|
22880
23729
|
message = String(err);
|
|
22881
23730
|
}
|
|
22882
|
-
|
|
22883
|
-
|
|
22884
|
-
}
|
|
22885
|
-
error48(message);
|
|
22886
|
-
}
|
|
23731
|
+
outputError({ json: options.json, command: "deploy" }, code, message, {
|
|
23732
|
+
logError: error48
|
|
23733
|
+
});
|
|
22887
23734
|
exit(code);
|
|
22888
23735
|
}
|
|
22889
23736
|
}
|
|
@@ -23024,17 +23871,12 @@ async function login(options, deps = {}) {
|
|
|
23024
23871
|
});
|
|
23025
23872
|
} catch (err) {
|
|
23026
23873
|
const message = err instanceof Error ? err.message : String(err);
|
|
23027
|
-
|
|
23028
|
-
|
|
23029
|
-
|
|
23030
|
-
|
|
23031
|
-
|
|
23032
|
-
|
|
23033
|
-
error: { code: EXIT_CREDENTIALS, message }
|
|
23034
|
-
});
|
|
23035
|
-
} else {
|
|
23036
|
-
error48(message);
|
|
23037
|
-
}
|
|
23874
|
+
outputError(
|
|
23875
|
+
{ json: options.json, command: "login" },
|
|
23876
|
+
EXIT_CREDENTIALS,
|
|
23877
|
+
message,
|
|
23878
|
+
{ logError: error48 }
|
|
23879
|
+
);
|
|
23038
23880
|
exit(EXIT_CREDENTIALS);
|
|
23039
23881
|
return;
|
|
23040
23882
|
}
|
|
@@ -23077,7 +23919,7 @@ var defaultReadPlatformYaml2 = async (cwd) => {
|
|
|
23077
23919
|
function emitJson4(envelope) {
|
|
23078
23920
|
process.stdout.write(JSON.stringify(envelope) + "\n");
|
|
23079
23921
|
}
|
|
23080
|
-
var DEPLOY_ID_RE = /^(\d{8})-(\d{6})-(
|
|
23922
|
+
var DEPLOY_ID_RE = /^(\d{8})-(\d{6})-(\S+)$/;
|
|
23081
23923
|
function parseDeployId(deployId) {
|
|
23082
23924
|
const m = DEPLOY_ID_RE.exec(deployId);
|
|
23083
23925
|
if (!m) return { deployId, timestamp: null, sha: null };
|
|
@@ -23143,7 +23985,8 @@ async function ls(options, deps = {}) {
|
|
|
23143
23985
|
const baseUrl = env["UNIVERSE_PROXY_URL"] ?? DEFAULT_PROXY_URL;
|
|
23144
23986
|
const client = mkClient({
|
|
23145
23987
|
baseUrl,
|
|
23146
|
-
getAuthToken: () => identity.token
|
|
23988
|
+
getAuthToken: () => identity.token,
|
|
23989
|
+
timeoutMs: parseFetchTimeoutMs(env)
|
|
23147
23990
|
});
|
|
23148
23991
|
const raw = await client.siteDeploys({ site });
|
|
23149
23992
|
const sorted = [...raw].sort(
|
|
@@ -23167,11 +24010,9 @@ async function ls(options, deps = {}) {
|
|
|
23167
24010
|
success2(formatTable(deploys));
|
|
23168
24011
|
} catch (err) {
|
|
23169
24012
|
const { code, message } = wrapProxyError("ls", err);
|
|
23170
|
-
|
|
23171
|
-
|
|
23172
|
-
}
|
|
23173
|
-
error48(message);
|
|
23174
|
-
}
|
|
24013
|
+
outputError({ json: options.json, command: "ls" }, code, message, {
|
|
24014
|
+
logError: error48
|
|
24015
|
+
});
|
|
23175
24016
|
exit(code);
|
|
23176
24017
|
}
|
|
23177
24018
|
}
|
|
@@ -23179,6 +24020,11 @@ async function ls(options, deps = {}) {
|
|
|
23179
24020
|
// src/commands/promote.ts
|
|
23180
24021
|
var import_promises6 = require("fs/promises");
|
|
23181
24022
|
var import_node_path7 = require("path");
|
|
24023
|
+
var defaultPromptConfirm = async (msg) => {
|
|
24024
|
+
const r = await ot2({ message: msg, initialValue: false });
|
|
24025
|
+
if (q(r)) return false;
|
|
24026
|
+
return r === true;
|
|
24027
|
+
};
|
|
23182
24028
|
var defaultReadPlatformYaml3 = async (cwd) => {
|
|
23183
24029
|
return (0, import_promises6.readFile)((0, import_node_path7.resolve)(cwd, "platform.yaml"), "utf-8");
|
|
23184
24030
|
};
|
|
@@ -23210,6 +24056,7 @@ async function promote(options, deps = {}) {
|
|
|
23210
24056
|
const success2 = deps.logSuccess ?? ((s) => O2.success(s));
|
|
23211
24057
|
const error48 = deps.logError ?? ((s) => O2.error(s));
|
|
23212
24058
|
const exit = deps.exit ?? exitWithCode;
|
|
24059
|
+
const promptConfirm = deps.promptConfirm ?? defaultPromptConfirm;
|
|
23213
24060
|
try {
|
|
23214
24061
|
const identity = await resolveId({ env });
|
|
23215
24062
|
if (!identity) {
|
|
@@ -23221,16 +24068,80 @@ async function promote(options, deps = {}) {
|
|
|
23221
24068
|
const baseUrl = env["UNIVERSE_PROXY_URL"] ?? DEFAULT_PROXY_URL;
|
|
23222
24069
|
const client = mkClient({
|
|
23223
24070
|
baseUrl,
|
|
23224
|
-
getAuthToken: () => identity.token
|
|
24071
|
+
getAuthToken: () => identity.token,
|
|
24072
|
+
timeoutMs: parseFetchTimeoutMs(env)
|
|
23225
24073
|
});
|
|
23226
24074
|
let result;
|
|
23227
24075
|
if (options.from) {
|
|
23228
|
-
|
|
24076
|
+
const prod = await client.getAlias({
|
|
23229
24077
|
site: config2.site,
|
|
23230
|
-
|
|
24078
|
+
mode: "production"
|
|
23231
24079
|
});
|
|
24080
|
+
const initialExpected = prod?.deployId ?? "";
|
|
24081
|
+
try {
|
|
24082
|
+
result = await client.siteRollback({
|
|
24083
|
+
site: config2.site,
|
|
24084
|
+
to: options.from,
|
|
24085
|
+
expectedCurrent: initialExpected
|
|
24086
|
+
});
|
|
24087
|
+
} catch (err) {
|
|
24088
|
+
if (!(err instanceof AliasDriftError)) throw err;
|
|
24089
|
+
if (options.json) throw err;
|
|
24090
|
+
error48(
|
|
24091
|
+
`drift: production moved to ${err.current}, expected ${initialExpected}`
|
|
24092
|
+
);
|
|
24093
|
+
const ok = await promptConfirm(
|
|
24094
|
+
`Retry promote --from with expectedCurrent='${err.current}'?`
|
|
24095
|
+
);
|
|
24096
|
+
if (!ok) throw err;
|
|
24097
|
+
result = await client.siteRollback({
|
|
24098
|
+
site: config2.site,
|
|
24099
|
+
to: options.from,
|
|
24100
|
+
expectedCurrent: err.current
|
|
24101
|
+
});
|
|
24102
|
+
}
|
|
23232
24103
|
} else {
|
|
23233
|
-
|
|
24104
|
+
const preview = await client.getAlias({
|
|
24105
|
+
site: config2.site,
|
|
24106
|
+
mode: "preview"
|
|
24107
|
+
});
|
|
24108
|
+
if (preview === null) {
|
|
24109
|
+
throw new ConfigError(
|
|
24110
|
+
"no preview alias to promote \u2014 run `universe static deploy` first"
|
|
24111
|
+
);
|
|
24112
|
+
}
|
|
24113
|
+
const prod = await client.getAlias({
|
|
24114
|
+
site: config2.site,
|
|
24115
|
+
mode: "production"
|
|
24116
|
+
});
|
|
24117
|
+
if (!options.json) {
|
|
24118
|
+
success2(
|
|
24119
|
+
`Promoting ${preview.deployId} \u2192 ${prod?.deployId ?? "<none>"}`
|
|
24120
|
+
);
|
|
24121
|
+
}
|
|
24122
|
+
const initialExpected = prod?.deployId ?? "";
|
|
24123
|
+
try {
|
|
24124
|
+
result = await client.sitePromote({
|
|
24125
|
+
site: config2.site,
|
|
24126
|
+
deployId: preview.deployId,
|
|
24127
|
+
expectedCurrent: initialExpected
|
|
24128
|
+
});
|
|
24129
|
+
} catch (err) {
|
|
24130
|
+
if (!(err instanceof AliasDriftError)) throw err;
|
|
24131
|
+
if (options.json) throw err;
|
|
24132
|
+
error48(
|
|
24133
|
+
`drift: production moved to ${err.current}, expected ${initialExpected}`
|
|
24134
|
+
);
|
|
24135
|
+
const ok = await promptConfirm(
|
|
24136
|
+
`Retry promote with expectedCurrent='${err.current}'?`
|
|
24137
|
+
);
|
|
24138
|
+
if (!ok) throw err;
|
|
24139
|
+
result = await client.sitePromote({
|
|
24140
|
+
site: config2.site,
|
|
24141
|
+
deployId: preview.deployId,
|
|
24142
|
+
expectedCurrent: err.current
|
|
24143
|
+
});
|
|
24144
|
+
}
|
|
23234
24145
|
}
|
|
23235
24146
|
if (options.json) {
|
|
23236
24147
|
emitJson5(
|
|
@@ -23256,11 +24167,11 @@ async function promote(options, deps = {}) {
|
|
|
23256
24167
|
}
|
|
23257
24168
|
} catch (err) {
|
|
23258
24169
|
const { code, message } = wrapProxyError("promote", err);
|
|
23259
|
-
|
|
23260
|
-
|
|
23261
|
-
|
|
23262
|
-
|
|
23263
|
-
}
|
|
24170
|
+
const extras = err instanceof AliasDriftError ? { current: err.current } : void 0;
|
|
24171
|
+
outputError({ json: options.json, command: "promote" }, code, message, {
|
|
24172
|
+
logError: error48,
|
|
24173
|
+
extras
|
|
24174
|
+
});
|
|
23264
24175
|
exit(code);
|
|
23265
24176
|
}
|
|
23266
24177
|
}
|
|
@@ -23268,6 +24179,11 @@ async function promote(options, deps = {}) {
|
|
|
23268
24179
|
// src/commands/rollback.ts
|
|
23269
24180
|
var import_promises7 = require("fs/promises");
|
|
23270
24181
|
var import_node_path8 = require("path");
|
|
24182
|
+
var defaultPromptConfirm2 = async (msg) => {
|
|
24183
|
+
const r = await ot2({ message: msg, initialValue: false });
|
|
24184
|
+
if (q(r)) return false;
|
|
24185
|
+
return r === true;
|
|
24186
|
+
};
|
|
23271
24187
|
var defaultReadPlatformYaml4 = async (cwd) => {
|
|
23272
24188
|
return (0, import_promises7.readFile)((0, import_node_path8.resolve)(cwd, "platform.yaml"), "utf-8");
|
|
23273
24189
|
};
|
|
@@ -23299,6 +24215,7 @@ async function rollback(options, deps = {}) {
|
|
|
23299
24215
|
const success2 = deps.logSuccess ?? ((s) => O2.success(s));
|
|
23300
24216
|
const error48 = deps.logError ?? ((s) => O2.error(s));
|
|
23301
24217
|
const exit = deps.exit ?? exitWithCode;
|
|
24218
|
+
const promptConfirm = deps.promptConfirm ?? defaultPromptConfirm2;
|
|
23302
24219
|
try {
|
|
23303
24220
|
if (!options.to || options.to.trim().length === 0) {
|
|
23304
24221
|
throw new UsageError(
|
|
@@ -23315,12 +24232,38 @@ async function rollback(options, deps = {}) {
|
|
|
23315
24232
|
const baseUrl = env["UNIVERSE_PROXY_URL"] ?? DEFAULT_PROXY_URL;
|
|
23316
24233
|
const client = mkClient({
|
|
23317
24234
|
baseUrl,
|
|
23318
|
-
getAuthToken: () => identity.token
|
|
24235
|
+
getAuthToken: () => identity.token,
|
|
24236
|
+
timeoutMs: parseFetchTimeoutMs(env)
|
|
23319
24237
|
});
|
|
23320
|
-
const
|
|
24238
|
+
const to = options.to.trim();
|
|
24239
|
+
const prod = await client.getAlias({
|
|
23321
24240
|
site: config2.site,
|
|
23322
|
-
|
|
24241
|
+
mode: "production"
|
|
23323
24242
|
});
|
|
24243
|
+
const initialExpected = prod?.deployId ?? "";
|
|
24244
|
+
let result;
|
|
24245
|
+
try {
|
|
24246
|
+
result = await client.siteRollback({
|
|
24247
|
+
site: config2.site,
|
|
24248
|
+
to,
|
|
24249
|
+
expectedCurrent: initialExpected
|
|
24250
|
+
});
|
|
24251
|
+
} catch (err) {
|
|
24252
|
+
if (!(err instanceof AliasDriftError)) throw err;
|
|
24253
|
+
if (options.json) throw err;
|
|
24254
|
+
error48(
|
|
24255
|
+
`drift: production moved to ${err.current}, expected ${initialExpected}`
|
|
24256
|
+
);
|
|
24257
|
+
const ok = await promptConfirm(
|
|
24258
|
+
`Retry rollback with expectedCurrent='${err.current}'?`
|
|
24259
|
+
);
|
|
24260
|
+
if (!ok) throw err;
|
|
24261
|
+
result = await client.siteRollback({
|
|
24262
|
+
site: config2.site,
|
|
24263
|
+
to,
|
|
24264
|
+
expectedCurrent: err.current
|
|
24265
|
+
});
|
|
24266
|
+
}
|
|
23324
24267
|
if (options.json) {
|
|
23325
24268
|
emitJson6(
|
|
23326
24269
|
buildEnvelope("rollback", true, {
|
|
@@ -23343,11 +24286,11 @@ async function rollback(options, deps = {}) {
|
|
|
23343
24286
|
}
|
|
23344
24287
|
} catch (err) {
|
|
23345
24288
|
const { code, message } = wrapProxyError("rollback", err);
|
|
23346
|
-
|
|
23347
|
-
|
|
23348
|
-
|
|
23349
|
-
|
|
23350
|
-
}
|
|
24289
|
+
const extras = err instanceof AliasDriftError ? { current: err.current } : void 0;
|
|
24290
|
+
outputError({ json: options.json, command: "rollback" }, code, message, {
|
|
24291
|
+
logError: error48,
|
|
24292
|
+
extras
|
|
24293
|
+
});
|
|
23351
24294
|
exit(code);
|
|
23352
24295
|
}
|
|
23353
24296
|
}
|
|
@@ -23367,18 +24310,20 @@ async function whoami(options, deps = {}) {
|
|
|
23367
24310
|
const identity = await resolve6({ env });
|
|
23368
24311
|
if (!identity) {
|
|
23369
24312
|
const msg = "No GitHub identity available. Run `universe login`, set $GITHUB_TOKEN, or install the gh CLI.";
|
|
23370
|
-
|
|
23371
|
-
|
|
23372
|
-
|
|
23373
|
-
|
|
23374
|
-
|
|
24313
|
+
outputError(
|
|
24314
|
+
{ json: options.json, command: "whoami" },
|
|
24315
|
+
EXIT_CREDENTIALS,
|
|
24316
|
+
msg,
|
|
24317
|
+
{ logError: error48 }
|
|
24318
|
+
);
|
|
23375
24319
|
exit(EXIT_CREDENTIALS);
|
|
23376
24320
|
return;
|
|
23377
24321
|
}
|
|
23378
24322
|
const baseUrl = env["UNIVERSE_PROXY_URL"] ?? DEFAULT_PROXY_URL2;
|
|
23379
24323
|
const client = mkClient({
|
|
23380
24324
|
baseUrl,
|
|
23381
|
-
getAuthToken: () => identity.token
|
|
24325
|
+
getAuthToken: () => identity.token,
|
|
24326
|
+
timeoutMs: parseFetchTimeoutMs(env)
|
|
23382
24327
|
});
|
|
23383
24328
|
try {
|
|
23384
24329
|
const result = await client.whoami();
|
|
@@ -23404,11 +24349,9 @@ async function whoami(options, deps = {}) {
|
|
|
23404
24349
|
} catch (err) {
|
|
23405
24350
|
const exitCode = err instanceof CliError ? err.exitCode : EXIT_CREDENTIALS;
|
|
23406
24351
|
const message = err instanceof ProxyError ? `whoami failed (${err.code}): ${err.message}` : err instanceof Error ? err.message : String(err);
|
|
23407
|
-
|
|
23408
|
-
|
|
23409
|
-
}
|
|
23410
|
-
error48(message);
|
|
23411
|
-
}
|
|
24352
|
+
outputError({ json: options.json, command: "whoami" }, exitCode, message, {
|
|
24353
|
+
logError: error48
|
|
24354
|
+
});
|
|
23412
24355
|
exit(exitCode);
|
|
23413
24356
|
}
|
|
23414
24357
|
}
|
|
@@ -23435,7 +24378,8 @@ async function setupClient(deps) {
|
|
|
23435
24378
|
const baseUrl = env["UNIVERSE_PROXY_URL"] ?? DEFAULT_PROXY_URL;
|
|
23436
24379
|
const client = mkClient({
|
|
23437
24380
|
baseUrl,
|
|
23438
|
-
getAuthToken: () => identity.token
|
|
24381
|
+
getAuthToken: () => identity.token,
|
|
24382
|
+
timeoutMs: parseFetchTimeoutMs(env)
|
|
23439
24383
|
});
|
|
23440
24384
|
return { client, identitySource: identity.source };
|
|
23441
24385
|
}
|
|
@@ -23462,7 +24406,7 @@ async function ls2(options, deps = {}) {
|
|
|
23462
24406
|
const error48 = deps.logError ?? ((s) => O2.error(s));
|
|
23463
24407
|
const exit = deps.exit ?? exitWithCode;
|
|
23464
24408
|
try {
|
|
23465
|
-
const { client } = await setupClient(deps);
|
|
24409
|
+
const { client, identitySource } = await setupClient(deps);
|
|
23466
24410
|
let rows = await client.listSites();
|
|
23467
24411
|
let scope = "all";
|
|
23468
24412
|
if (options.mine) {
|
|
@@ -23476,7 +24420,8 @@ async function ls2(options, deps = {}) {
|
|
|
23476
24420
|
buildEnvelope(command, true, {
|
|
23477
24421
|
count: rows.length,
|
|
23478
24422
|
scope,
|
|
23479
|
-
sites: rows
|
|
24423
|
+
sites: rows,
|
|
24424
|
+
identitySource
|
|
23480
24425
|
})
|
|
23481
24426
|
);
|
|
23482
24427
|
} else {
|
|
@@ -23484,11 +24429,9 @@ async function ls2(options, deps = {}) {
|
|
|
23484
24429
|
}
|
|
23485
24430
|
} catch (err) {
|
|
23486
24431
|
const { code, message } = wrapProxyError(command, err);
|
|
23487
|
-
|
|
23488
|
-
|
|
23489
|
-
}
|
|
23490
|
-
error48(message);
|
|
23491
|
-
}
|
|
24432
|
+
outputError({ json: options.json, command }, code, message, {
|
|
24433
|
+
logError: error48
|
|
24434
|
+
});
|
|
23492
24435
|
exit(code);
|
|
23493
24436
|
}
|
|
23494
24437
|
}
|
|
@@ -23504,7 +24447,7 @@ async function register(options, deps = {}) {
|
|
|
23504
24447
|
throw new UsageError("slug is required (positional argument)");
|
|
23505
24448
|
}
|
|
23506
24449
|
const teams = parseTeamsFlag(options.team);
|
|
23507
|
-
const { client } = await setupClient(deps);
|
|
24450
|
+
const { client, identitySource } = await setupClient(deps);
|
|
23508
24451
|
const row = await client.registerSite({
|
|
23509
24452
|
slug: options.slug,
|
|
23510
24453
|
teams: teams.length > 0 ? teams : void 0
|
|
@@ -23515,7 +24458,8 @@ async function register(options, deps = {}) {
|
|
|
23515
24458
|
slug: row.slug,
|
|
23516
24459
|
teams: row.teams,
|
|
23517
24460
|
createdAt: row.createdAt,
|
|
23518
|
-
createdBy: row.createdBy
|
|
24461
|
+
createdBy: row.createdBy,
|
|
24462
|
+
identitySource
|
|
23519
24463
|
})
|
|
23520
24464
|
);
|
|
23521
24465
|
} else {
|
|
@@ -23532,11 +24476,9 @@ async function register(options, deps = {}) {
|
|
|
23532
24476
|
}
|
|
23533
24477
|
} catch (err) {
|
|
23534
24478
|
const { code, message } = wrapProxyError(command, err);
|
|
23535
|
-
|
|
23536
|
-
|
|
23537
|
-
}
|
|
23538
|
-
error48(message);
|
|
23539
|
-
}
|
|
24479
|
+
outputError({ json: options.json, command }, code, message, {
|
|
24480
|
+
logError: error48
|
|
24481
|
+
});
|
|
23540
24482
|
exit(code);
|
|
23541
24483
|
}
|
|
23542
24484
|
}
|
|
@@ -23551,13 +24493,14 @@ async function rm2(options, deps = {}) {
|
|
|
23551
24493
|
if (!options.slug || options.slug.trim().length === 0) {
|
|
23552
24494
|
throw new UsageError("slug is required (positional argument)");
|
|
23553
24495
|
}
|
|
23554
|
-
const { client } = await setupClient(deps);
|
|
24496
|
+
const { client, identitySource } = await setupClient(deps);
|
|
23555
24497
|
await client.deleteSite({ slug: options.slug });
|
|
23556
24498
|
if (options.json) {
|
|
23557
24499
|
emitJson8(
|
|
23558
24500
|
buildEnvelope(command, true, {
|
|
23559
24501
|
slug: options.slug,
|
|
23560
|
-
deleted: true
|
|
24502
|
+
deleted: true,
|
|
24503
|
+
identitySource
|
|
23561
24504
|
})
|
|
23562
24505
|
);
|
|
23563
24506
|
} else {
|
|
@@ -23572,11 +24515,9 @@ async function rm2(options, deps = {}) {
|
|
|
23572
24515
|
}
|
|
23573
24516
|
} catch (err) {
|
|
23574
24517
|
const { code, message } = wrapProxyError(command, err);
|
|
23575
|
-
|
|
23576
|
-
|
|
23577
|
-
}
|
|
23578
|
-
error48(message);
|
|
23579
|
-
}
|
|
24518
|
+
outputError({ json: options.json, command }, code, message, {
|
|
24519
|
+
logError: error48
|
|
24520
|
+
});
|
|
23580
24521
|
exit(code);
|
|
23581
24522
|
}
|
|
23582
24523
|
}
|
|
@@ -23597,7 +24538,7 @@ async function update(options, deps = {}) {
|
|
|
23597
24538
|
"--team is required with at least one slug; use `sites rm` to remove a site"
|
|
23598
24539
|
);
|
|
23599
24540
|
}
|
|
23600
|
-
const { client } = await setupClient(deps);
|
|
24541
|
+
const { client, identitySource } = await setupClient(deps);
|
|
23601
24542
|
const row = await client.updateSite({
|
|
23602
24543
|
slug: options.slug,
|
|
23603
24544
|
teams
|
|
@@ -23607,7 +24548,8 @@ async function update(options, deps = {}) {
|
|
|
23607
24548
|
buildEnvelope(command, true, {
|
|
23608
24549
|
slug: row.slug,
|
|
23609
24550
|
teams: row.teams,
|
|
23610
|
-
updatedAt: row.updatedAt
|
|
24551
|
+
updatedAt: row.updatedAt,
|
|
24552
|
+
identitySource
|
|
23611
24553
|
})
|
|
23612
24554
|
);
|
|
23613
24555
|
} else {
|
|
@@ -23623,78 +24565,15 @@ async function update(options, deps = {}) {
|
|
|
23623
24565
|
}
|
|
23624
24566
|
} catch (err) {
|
|
23625
24567
|
const { code, message } = wrapProxyError(command, err);
|
|
23626
|
-
|
|
23627
|
-
|
|
23628
|
-
}
|
|
23629
|
-
error48(message);
|
|
23630
|
-
}
|
|
24568
|
+
outputError({ json: options.json, command }, code, message, {
|
|
24569
|
+
logError: error48
|
|
24570
|
+
});
|
|
23631
24571
|
exit(code);
|
|
23632
24572
|
}
|
|
23633
24573
|
}
|
|
23634
24574
|
|
|
23635
|
-
// src/output/redact.ts
|
|
23636
|
-
var AWS_KEY_PREFIX_PATTERN = /(?:AKIA|ASIA|AROA|AIDA|ACCA|ANPA|ABIA|AGPA)[A-Z0-9]{12,}/g;
|
|
23637
|
-
var URL_CREDS_PATTERN = /https?:\/\/[^@\s]+@/g;
|
|
23638
|
-
var CREDENTIAL_CONTEXT_PATTERN = /(?:access_key_id|secret_access_key|accessKeyId|secretAccessKey|secret|password|token|key|credential|auth)\s*[=:]\s*([A-Za-z0-9/+=]{21,})/gi;
|
|
23639
|
-
var HEX_CREDENTIAL_CONTEXT_PATTERN = /(?:secret|password|token|key|credential|auth|access_key_id|secret_access_key)\s*[=:]\s*([a-f0-9]{32,})/gi;
|
|
23640
|
-
var JSON_CREDENTIAL_PATTERN = /"(?:secret|password|token|key|credential|auth|access_key_id|secret_access_key|accessKeyId|secretAccessKey)"\s*:\s*"[^"]+"/gi;
|
|
23641
|
-
var BEARER_PATTERN = /\bBearer\s+[A-Za-z0-9._~+/=-]+/gi;
|
|
23642
|
-
function maskAwsKey(match) {
|
|
23643
|
-
return match.slice(0, 4) + "****" + match.slice(-4);
|
|
23644
|
-
}
|
|
23645
|
-
function maskUrlCreds(match) {
|
|
23646
|
-
const atIndex = match.lastIndexOf("@");
|
|
23647
|
-
const protocolEnd = match.indexOf("://") + 3;
|
|
23648
|
-
return match.slice(0, protocolEnd) + "****:****@" + match.slice(atIndex + 1);
|
|
23649
|
-
}
|
|
23650
|
-
function redact(value) {
|
|
23651
|
-
let result = value;
|
|
23652
|
-
result = result.replace(URL_CREDS_PATTERN, maskUrlCreds);
|
|
23653
|
-
result = result.replace(AWS_KEY_PREFIX_PATTERN, maskAwsKey);
|
|
23654
|
-
result = result.replace(BEARER_PATTERN, "Bearer ****");
|
|
23655
|
-
result = result.replace(JSON_CREDENTIAL_PATTERN, (match) => {
|
|
23656
|
-
const colonIndex = match.indexOf(":");
|
|
23657
|
-
return match.slice(0, colonIndex + 1) + '"****"';
|
|
23658
|
-
});
|
|
23659
|
-
result = result.replace(
|
|
23660
|
-
CREDENTIAL_CONTEXT_PATTERN,
|
|
23661
|
-
(_match, _secret, _offset, _full) => {
|
|
23662
|
-
const eqIndex = _match.indexOf("=");
|
|
23663
|
-
const colonIndex = _match.indexOf(":");
|
|
23664
|
-
const sepIndex = eqIndex >= 0 && colonIndex >= 0 ? Math.min(eqIndex, colonIndex) : eqIndex >= 0 ? eqIndex : colonIndex;
|
|
23665
|
-
const prefix = _match.slice(0, sepIndex + 1);
|
|
23666
|
-
return prefix + "****";
|
|
23667
|
-
}
|
|
23668
|
-
);
|
|
23669
|
-
result = result.replace(HEX_CREDENTIAL_CONTEXT_PATTERN, (_match, _secret) => {
|
|
23670
|
-
const eqIndex = _match.indexOf("=");
|
|
23671
|
-
const colonIndex = _match.indexOf(":");
|
|
23672
|
-
const sepIndex = eqIndex >= 0 && colonIndex >= 0 ? Math.min(eqIndex, colonIndex) : eqIndex >= 0 ? eqIndex : colonIndex;
|
|
23673
|
-
const prefix = _match.slice(0, sepIndex + 1);
|
|
23674
|
-
return prefix + "****";
|
|
23675
|
-
});
|
|
23676
|
-
return result;
|
|
23677
|
-
}
|
|
23678
|
-
|
|
23679
|
-
// src/output/format.ts
|
|
23680
|
-
function outputError(ctx, code, message, issues) {
|
|
23681
|
-
const redactedMessage = redact(message);
|
|
23682
|
-
const redactedIssues = issues?.map(redact);
|
|
23683
|
-
if (ctx.json) {
|
|
23684
|
-
const envelope = buildErrorEnvelope(
|
|
23685
|
-
ctx.command,
|
|
23686
|
-
code,
|
|
23687
|
-
redactedMessage,
|
|
23688
|
-
redactedIssues
|
|
23689
|
-
);
|
|
23690
|
-
process.stdout.write(JSON.stringify(envelope) + "\n");
|
|
23691
|
-
} else {
|
|
23692
|
-
O2.error(redactedMessage);
|
|
23693
|
-
}
|
|
23694
|
-
}
|
|
23695
|
-
|
|
23696
24575
|
// src/cli.ts
|
|
23697
|
-
var version2 = true ? "0.
|
|
24576
|
+
var version2 = true ? "0.7.0" : "0.0.0";
|
|
23698
24577
|
function handleActionError(command, json2, err) {
|
|
23699
24578
|
const ctx = { json: json2, command };
|
|
23700
24579
|
const message = err instanceof Error ? err.message : "unknown error";
|