@freecodecamp/universe-cli 0.5.1 → 0.6.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 +844 -106
- package/dist/index.js +180 -18
- 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,175 @@ 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
|
+
var O = (r) => "columns" in r && typeof r.columns == "number" ? r.columns : 80;
|
|
8425
|
+
var A = (r) => "rows" in r && typeof r.rows == "number" ? r.rows : 20;
|
|
8426
|
+
function R(r, t2, e, s = e) {
|
|
8427
|
+
const i = O(r ?? import_node_process.stdout);
|
|
8428
|
+
return wrapAnsi(t2, i - e.length, { hard: true, trim: false }).split(`
|
|
8429
|
+
`).map((n, o) => `${o === 0 ? s : e}${n}`).join(`
|
|
8430
|
+
`);
|
|
8431
|
+
}
|
|
8432
|
+
var p = class {
|
|
8433
|
+
input;
|
|
8434
|
+
output;
|
|
8435
|
+
_abortSignal;
|
|
8436
|
+
rl;
|
|
8437
|
+
opts;
|
|
8438
|
+
_render;
|
|
8439
|
+
_track = false;
|
|
8440
|
+
_prevFrame = "";
|
|
8441
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
8442
|
+
_cursor = 0;
|
|
8443
|
+
state = "initial";
|
|
8444
|
+
error = "";
|
|
8445
|
+
value;
|
|
8446
|
+
userInput = "";
|
|
8447
|
+
constructor(t2, e = true) {
|
|
8448
|
+
const { input: s = import_node_process.stdin, output: i = import_node_process.stdout, render: n, signal: o, ...a } = t2;
|
|
8449
|
+
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;
|
|
8450
|
+
}
|
|
8451
|
+
unsubscribe() {
|
|
8452
|
+
this._subscribers.clear();
|
|
8453
|
+
}
|
|
8454
|
+
setSubscriber(t2, e) {
|
|
8455
|
+
const s = this._subscribers.get(t2) ?? [];
|
|
8456
|
+
s.push(e), this._subscribers.set(t2, s);
|
|
8457
|
+
}
|
|
8458
|
+
on(t2, e) {
|
|
8459
|
+
this.setSubscriber(t2, { cb: e });
|
|
8460
|
+
}
|
|
8461
|
+
once(t2, e) {
|
|
8462
|
+
this.setSubscriber(t2, { cb: e, once: true });
|
|
8463
|
+
}
|
|
8464
|
+
emit(t2, ...e) {
|
|
8465
|
+
const s = this._subscribers.get(t2) ?? [], i = [];
|
|
8466
|
+
for (const n of s) n.cb(...e), n.once && i.push(() => s.splice(s.indexOf(n), 1));
|
|
8467
|
+
for (const n of i) n();
|
|
8468
|
+
}
|
|
8469
|
+
prompt() {
|
|
8470
|
+
return new Promise((t2) => {
|
|
8471
|
+
if (this._abortSignal) {
|
|
8472
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), t2(C);
|
|
8473
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
8474
|
+
this.state = "cancel", this.close();
|
|
8475
|
+
}, { once: true });
|
|
8476
|
+
}
|
|
8477
|
+
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", () => {
|
|
8478
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t2(this.value);
|
|
8479
|
+
}), this.once("cancel", () => {
|
|
8480
|
+
this.output.write(import_sisteransi.cursor.show), this.output.off("resize", this.render), w(this.input, false), t2(C);
|
|
8481
|
+
});
|
|
8482
|
+
});
|
|
8483
|
+
}
|
|
8484
|
+
_isActionKey(t2, e) {
|
|
8485
|
+
return t2 === " ";
|
|
8486
|
+
}
|
|
8487
|
+
_setValue(t2) {
|
|
8488
|
+
this.value = t2, this.emit("value", this.value);
|
|
8489
|
+
}
|
|
8490
|
+
_setUserInput(t2, e) {
|
|
8491
|
+
this.userInput = t2 ?? "", this.emit("userInput", this.userInput), e && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
8492
|
+
}
|
|
8493
|
+
_clearUserInput() {
|
|
8494
|
+
this.rl?.write(null, { ctrl: true, name: "u" }), this._setUserInput("");
|
|
8495
|
+
}
|
|
8496
|
+
onKeypress(t2, e) {
|
|
8497
|
+
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") {
|
|
8498
|
+
if (this.opts.validate) {
|
|
8499
|
+
const s = this.opts.validate(this.value);
|
|
8500
|
+
s && (this.error = s instanceof Error ? s.message : s, this.state = "error", this.rl?.write(this.userInput));
|
|
8501
|
+
}
|
|
8502
|
+
this.state !== "error" && (this.state = "submit");
|
|
8503
|
+
}
|
|
8504
|
+
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();
|
|
8505
|
+
}
|
|
8506
|
+
close() {
|
|
8507
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
8508
|
+
`), w(this.input, false), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
8509
|
+
}
|
|
8510
|
+
restoreCursor() {
|
|
8511
|
+
const t2 = wrapAnsi(this._prevFrame, process.stdout.columns, { hard: true, trim: false }).split(`
|
|
8512
|
+
`).length - 1;
|
|
8513
|
+
this.output.write(import_sisteransi.cursor.move(-999, t2 * -1));
|
|
8514
|
+
}
|
|
8515
|
+
render() {
|
|
8516
|
+
const t2 = wrapAnsi(this._render(this) ?? "", process.stdout.columns, { hard: true, trim: false });
|
|
8517
|
+
if (t2 !== this._prevFrame) {
|
|
8518
|
+
if (this.state === "initial") this.output.write(import_sisteransi.cursor.hide);
|
|
8519
|
+
else {
|
|
8520
|
+
const e = j(this._prevFrame, t2), s = A(this.output);
|
|
8521
|
+
if (this.restoreCursor(), e) {
|
|
8522
|
+
const i = Math.max(0, e.numLinesAfter - s), n = Math.max(0, e.numLinesBefore - s);
|
|
8523
|
+
let o = e.lines.find((a) => a >= i);
|
|
8524
|
+
if (o === void 0) {
|
|
8525
|
+
this._prevFrame = t2;
|
|
8526
|
+
return;
|
|
8527
|
+
}
|
|
8528
|
+
if (e.lines.length === 1) {
|
|
8529
|
+
this.output.write(import_sisteransi.cursor.move(0, o - n)), this.output.write(import_sisteransi.erase.lines(1));
|
|
8530
|
+
const a = t2.split(`
|
|
8531
|
+
`);
|
|
8532
|
+
this.output.write(a[o]), this._prevFrame = t2, this.output.write(import_sisteransi.cursor.move(0, a.length - o - 1));
|
|
8533
|
+
return;
|
|
8534
|
+
} else if (e.lines.length > 1) {
|
|
8535
|
+
if (i < n) o = i;
|
|
8536
|
+
else {
|
|
8537
|
+
const h = o - n;
|
|
8538
|
+
h > 0 && this.output.write(import_sisteransi.cursor.move(0, h));
|
|
8539
|
+
}
|
|
8540
|
+
this.output.write(import_sisteransi.erase.down());
|
|
8541
|
+
const a = t2.split(`
|
|
8542
|
+
`).slice(o);
|
|
8543
|
+
this.output.write(a.join(`
|
|
8544
|
+
`)), this._prevFrame = t2;
|
|
8545
|
+
return;
|
|
8546
|
+
}
|
|
8547
|
+
}
|
|
8548
|
+
this.output.write(import_sisteransi.erase.down());
|
|
8549
|
+
}
|
|
8550
|
+
this.output.write(t2), this.state === "initial" && (this.state = "active"), this._prevFrame = t2;
|
|
8551
|
+
}
|
|
8552
|
+
}
|
|
8553
|
+
};
|
|
8554
|
+
var Q = class extends p {
|
|
8555
|
+
get cursor() {
|
|
8556
|
+
return this.value ? 0 : 1;
|
|
8557
|
+
}
|
|
8558
|
+
get _value() {
|
|
8559
|
+
return this.cursor === 0;
|
|
8560
|
+
}
|
|
8561
|
+
constructor(t2) {
|
|
8562
|
+
super(t2, false), this.value = !!t2.initialValue, this.on("userInput", () => {
|
|
8563
|
+
this.value = this._value;
|
|
8564
|
+
}), this.on("confirm", (e) => {
|
|
8565
|
+
this.output.write(import_sisteransi.cursor.move(0, -1)), this.value = e, this.state = "submit", this.close();
|
|
8566
|
+
}), this.on("cursor", () => {
|
|
8567
|
+
this.value = !this.value;
|
|
8568
|
+
});
|
|
8569
|
+
}
|
|
8570
|
+
};
|
|
8035
8571
|
|
|
8036
8572
|
// node_modules/.pnpm/@clack+prompts@1.2.0/node_modules/@clack/prompts/dist/index.mjs
|
|
8037
8573
|
var import_node_util2 = require("util");
|
|
@@ -8043,40 +8579,80 @@ function Ze() {
|
|
|
8043
8579
|
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
8580
|
}
|
|
8045
8581
|
var ee = Ze();
|
|
8046
|
-
var
|
|
8047
|
-
var _e =
|
|
8048
|
-
var oe =
|
|
8049
|
-
var ue =
|
|
8050
|
-
var F =
|
|
8051
|
-
var le =
|
|
8052
|
-
var d =
|
|
8053
|
-
var E2 =
|
|
8054
|
-
var Ie =
|
|
8055
|
-
var Ee =
|
|
8056
|
-
var z2 =
|
|
8057
|
-
var H2 =
|
|
8058
|
-
var te =
|
|
8059
|
-
var U =
|
|
8060
|
-
var J =
|
|
8061
|
-
var xe =
|
|
8062
|
-
var se =
|
|
8063
|
-
var ce =
|
|
8064
|
-
var Ge =
|
|
8065
|
-
var $e =
|
|
8066
|
-
var de =
|
|
8067
|
-
var Oe =
|
|
8068
|
-
var he =
|
|
8069
|
-
var pe =
|
|
8070
|
-
var me =
|
|
8071
|
-
var ge =
|
|
8582
|
+
var w2 = (e, i) => ee ? e : i;
|
|
8583
|
+
var _e = w2("\u25C6", "*");
|
|
8584
|
+
var oe = w2("\u25A0", "x");
|
|
8585
|
+
var ue = w2("\u25B2", "x");
|
|
8586
|
+
var F = w2("\u25C7", "o");
|
|
8587
|
+
var le = w2("\u250C", "T");
|
|
8588
|
+
var d = w2("\u2502", "|");
|
|
8589
|
+
var E2 = w2("\u2514", "\u2014");
|
|
8590
|
+
var Ie = w2("\u2510", "T");
|
|
8591
|
+
var Ee = w2("\u2518", "\u2014");
|
|
8592
|
+
var z2 = w2("\u25CF", ">");
|
|
8593
|
+
var H2 = w2("\u25CB", " ");
|
|
8594
|
+
var te = w2("\u25FB", "[\u2022]");
|
|
8595
|
+
var U = w2("\u25FC", "[+]");
|
|
8596
|
+
var J = w2("\u25FB", "[ ]");
|
|
8597
|
+
var xe = w2("\u25AA", "\u2022");
|
|
8598
|
+
var se = w2("\u2500", "-");
|
|
8599
|
+
var ce = w2("\u256E", "+");
|
|
8600
|
+
var Ge = w2("\u251C", "+");
|
|
8601
|
+
var $e = w2("\u256F", "+");
|
|
8602
|
+
var de = w2("\u2570", "+");
|
|
8603
|
+
var Oe = w2("\u256D", "+");
|
|
8604
|
+
var he = w2("\u25CF", "\u2022");
|
|
8605
|
+
var pe = w2("\u25C6", "*");
|
|
8606
|
+
var me = w2("\u25B2", "!");
|
|
8607
|
+
var ge = w2("\u25A0", "x");
|
|
8608
|
+
var V2 = (e) => {
|
|
8609
|
+
switch (e) {
|
|
8610
|
+
case "initial":
|
|
8611
|
+
case "active":
|
|
8612
|
+
return (0, import_node_util2.styleText)("cyan", _e);
|
|
8613
|
+
case "cancel":
|
|
8614
|
+
return (0, import_node_util2.styleText)("red", oe);
|
|
8615
|
+
case "error":
|
|
8616
|
+
return (0, import_node_util2.styleText)("yellow", ue);
|
|
8617
|
+
case "submit":
|
|
8618
|
+
return (0, import_node_util2.styleText)("green", F);
|
|
8619
|
+
}
|
|
8620
|
+
};
|
|
8621
|
+
var ot2 = (e) => {
|
|
8622
|
+
const i = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
8623
|
+
return new Q({ active: i, inactive: s, signal: e.signal, input: e.input, output: e.output, initialValue: e.initialValue ?? true, render() {
|
|
8624
|
+
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)}
|
|
8625
|
+
` : ""}${o}
|
|
8626
|
+
`, a = this.value ? i : s;
|
|
8627
|
+
switch (this.state) {
|
|
8628
|
+
case "submit": {
|
|
8629
|
+
const l = r ? `${(0, import_node_util2.styleText)("gray", d)} ` : "";
|
|
8630
|
+
return `${c2}${l}${(0, import_node_util2.styleText)("dim", a)}`;
|
|
8631
|
+
}
|
|
8632
|
+
case "cancel": {
|
|
8633
|
+
const l = r ? `${(0, import_node_util2.styleText)("gray", d)} ` : "";
|
|
8634
|
+
return `${c2}${l}${(0, import_node_util2.styleText)(["strikethrough", "dim"], a)}${r ? `
|
|
8635
|
+
${(0, import_node_util2.styleText)("gray", d)}` : ""}`;
|
|
8636
|
+
}
|
|
8637
|
+
default: {
|
|
8638
|
+
const l = r ? `${(0, import_node_util2.styleText)("cyan", d)} ` : "", $2 = r ? (0, import_node_util2.styleText)("cyan", E2) : "";
|
|
8639
|
+
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 ? `
|
|
8640
|
+
${(0, import_node_util2.styleText)("cyan", d)} ` : `
|
|
8641
|
+
` : ` ${(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}`}
|
|
8642
|
+
${$2}
|
|
8643
|
+
`;
|
|
8644
|
+
}
|
|
8645
|
+
}
|
|
8646
|
+
} }).prompt();
|
|
8647
|
+
};
|
|
8072
8648
|
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
8649
|
const o = [], c2 = n ?? u.withGuide, a = c2 ? s : "", l = c2 ? `${i} ` : "", $2 = c2 ? `${s} ` : "";
|
|
8074
|
-
for (let
|
|
8650
|
+
for (let p2 = 0; p2 < u2; p2++) o.push(a);
|
|
8075
8651
|
const y2 = Array.isArray(e) ? e : e.split(`
|
|
8076
8652
|
`);
|
|
8077
8653
|
if (y2.length > 0) {
|
|
8078
|
-
const [
|
|
8079
|
-
|
|
8654
|
+
const [p2, ...m] = y2;
|
|
8655
|
+
p2.length > 0 ? o.push(`${l}${p2}`) : o.push(c2 ? i : "");
|
|
8080
8656
|
for (const g of m) g.length > 0 ? o.push(`${$2}${g}`) : o.push(c2 ? s : "");
|
|
8081
8657
|
}
|
|
8082
8658
|
r.write(`${o.join(`
|
|
@@ -8095,7 +8671,7 @@ var O2 = { message: (e = [], { symbol: i = (0, import_node_util2.styleText)("gra
|
|
|
8095
8671
|
}, error: (e, i) => {
|
|
8096
8672
|
O2.message(e, { ...i, symbol: (0, import_node_util2.styleText)("red", ge) });
|
|
8097
8673
|
} };
|
|
8098
|
-
var Ve = { light:
|
|
8674
|
+
var Ve = { light: w2("\u2500", "-"), heavy: w2("\u2501", "="), block: w2("\u2588", "#") };
|
|
8099
8675
|
var je = `${(0, import_node_util2.styleText)("gray", d)} `;
|
|
8100
8676
|
|
|
8101
8677
|
// src/output/exit-codes.ts
|
|
@@ -8215,14 +8791,14 @@ async function ensureDirectory(absPath) {
|
|
|
8215
8791
|
}
|
|
8216
8792
|
}
|
|
8217
8793
|
async function runBuild(options, deps = {}) {
|
|
8218
|
-
const
|
|
8794
|
+
const exec2 = deps.exec ?? defaultExec;
|
|
8219
8795
|
const absCwd = (0, import_node_path3.isAbsolute)(options.cwd) ? options.cwd : (0, import_node_path3.resolve)(options.cwd);
|
|
8220
8796
|
const absOutput = (0, import_node_path3.isAbsolute)(options.outputDir) ? options.outputDir : (0, import_node_path3.resolve)(absCwd, options.outputDir);
|
|
8221
8797
|
if (!options.command) {
|
|
8222
8798
|
await ensureDirectory(absOutput);
|
|
8223
8799
|
return { skipped: true, outputDir: absOutput };
|
|
8224
8800
|
}
|
|
8225
|
-
const code = await
|
|
8801
|
+
const code = await exec2({ command: options.command, cwd: absCwd });
|
|
8226
8802
|
if (code !== 0) {
|
|
8227
8803
|
throw new ConfigError(
|
|
8228
8804
|
`build command failed with exit code ${code}: ${options.command}`
|
|
@@ -8372,7 +8948,7 @@ function normalize(rel) {
|
|
|
8372
8948
|
return out;
|
|
8373
8949
|
}
|
|
8374
8950
|
function createIgnoreFilter(patterns) {
|
|
8375
|
-
const compiled = patterns.filter((
|
|
8951
|
+
const compiled = patterns.filter((p2) => p2.length > 0).map(compilePattern);
|
|
8376
8952
|
return (relPath) => {
|
|
8377
8953
|
const norm = normalize(relPath);
|
|
8378
8954
|
for (const c2 of compiled) {
|
|
@@ -11532,7 +12108,7 @@ var $ZodUnion = /* @__PURE__ */ $constructor("$ZodUnion", (inst, def) => {
|
|
|
11532
12108
|
defineLazy(inst._zod, "pattern", () => {
|
|
11533
12109
|
if (def.options.every((o) => o._zod.pattern)) {
|
|
11534
12110
|
const patterns = def.options.map((o) => o._zod.pattern);
|
|
11535
|
-
return new RegExp(`^(${patterns.map((
|
|
12111
|
+
return new RegExp(`^(${patterns.map((p2) => cleanRegex(p2.source)).join("|")})$`);
|
|
11536
12112
|
}
|
|
11537
12113
|
return void 0;
|
|
11538
12114
|
});
|
|
@@ -18209,9 +18785,9 @@ var $ZodRegistry = class {
|
|
|
18209
18785
|
return this;
|
|
18210
18786
|
}
|
|
18211
18787
|
get(schema) {
|
|
18212
|
-
const
|
|
18213
|
-
if (
|
|
18214
|
-
const pm = { ...this.get(
|
|
18788
|
+
const p2 = schema._zod.parent;
|
|
18789
|
+
if (p2) {
|
|
18790
|
+
const pm = { ...this.get(p2) ?? {} };
|
|
18215
18791
|
delete pm.id;
|
|
18216
18792
|
const f = { ...pm, ...this._map.get(schema) };
|
|
18217
18793
|
return Object.keys(f).length ? f : void 0;
|
|
@@ -22249,17 +22825,17 @@ function editDistance(a, b) {
|
|
|
22249
22825
|
() => new Array(n + 1).fill(0)
|
|
22250
22826
|
);
|
|
22251
22827
|
for (let i = 0; i <= m; i++) d2[i][0] = i;
|
|
22252
|
-
for (let
|
|
22828
|
+
for (let j2 = 0; j2 <= n; j2++) d2[0][j2] = j2;
|
|
22253
22829
|
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][
|
|
22830
|
+
for (let j2 = 1; j2 <= n; j2++) {
|
|
22831
|
+
const cost = a[i - 1] === b[j2 - 1] ? 0 : 1;
|
|
22832
|
+
d2[i][j2] = Math.min(
|
|
22833
|
+
d2[i - 1][j2] + 1,
|
|
22834
|
+
d2[i][j2 - 1] + 1,
|
|
22835
|
+
d2[i - 1][j2 - 1] + cost
|
|
22260
22836
|
);
|
|
22261
|
-
if (i > 1 &&
|
|
22262
|
-
d2[i][
|
|
22837
|
+
if (i > 1 && j2 > 1 && a[i - 1] === b[j2 - 2] && a[i - 2] === b[j2 - 1]) {
|
|
22838
|
+
d2[i][j2] = Math.min(d2[i][j2], d2[i - 2][j2 - 2] + 1);
|
|
22263
22839
|
}
|
|
22264
22840
|
}
|
|
22265
22841
|
}
|
|
@@ -22297,6 +22873,13 @@ var ProxyError = class extends CliError {
|
|
|
22297
22873
|
this.exitCode = mapExitCode(status);
|
|
22298
22874
|
}
|
|
22299
22875
|
};
|
|
22876
|
+
var AliasDriftError = class extends ProxyError {
|
|
22877
|
+
current;
|
|
22878
|
+
constructor(message, current) {
|
|
22879
|
+
super(409, "alias_drift", message);
|
|
22880
|
+
this.current = current;
|
|
22881
|
+
}
|
|
22882
|
+
};
|
|
22300
22883
|
function mapExitCode(status) {
|
|
22301
22884
|
if (status === 401 || status === 403) return EXIT_CREDENTIALS;
|
|
22302
22885
|
if (status === 422 || status === 0 || status >= 500) return EXIT_STORAGE;
|
|
@@ -22332,9 +22915,11 @@ async function readErrorEnvelope(response) {
|
|
|
22332
22915
|
};
|
|
22333
22916
|
}
|
|
22334
22917
|
if (isProxyErrorEnvelope(raw) && raw.error) {
|
|
22918
|
+
const current = typeof raw.current === "string" ? raw.current : void 0;
|
|
22335
22919
|
return {
|
|
22336
22920
|
code: raw.error.code ?? `http_${status}`,
|
|
22337
|
-
message: raw.error.message ?? response.statusText ?? "request failed"
|
|
22921
|
+
message: raw.error.message ?? response.statusText ?? "request failed",
|
|
22922
|
+
...current === void 0 ? {} : { current }
|
|
22338
22923
|
};
|
|
22339
22924
|
}
|
|
22340
22925
|
return {
|
|
@@ -22342,6 +22927,12 @@ async function readErrorEnvelope(response) {
|
|
|
22342
22927
|
message: response.statusText || "request failed"
|
|
22343
22928
|
};
|
|
22344
22929
|
}
|
|
22930
|
+
function throwProxyError(status, env) {
|
|
22931
|
+
if (status === 409 && env.code === "alias_drift") {
|
|
22932
|
+
throw new AliasDriftError(env.message, env.current ?? "");
|
|
22933
|
+
}
|
|
22934
|
+
throw new ProxyError(status, env.code, env.message);
|
|
22935
|
+
}
|
|
22345
22936
|
function stripTrailingSlash(url2) {
|
|
22346
22937
|
return url2.endsWith("/") ? url2.slice(0, -1) : url2;
|
|
22347
22938
|
}
|
|
@@ -22362,7 +22953,7 @@ function createProxyClient(cfg) {
|
|
|
22362
22953
|
}
|
|
22363
22954
|
if (!response.ok) {
|
|
22364
22955
|
const env = await readErrorEnvelope(response);
|
|
22365
|
-
|
|
22956
|
+
throwProxyError(response.status, env);
|
|
22366
22957
|
}
|
|
22367
22958
|
if (response.status === 204) {
|
|
22368
22959
|
return void 0;
|
|
@@ -22426,18 +23017,55 @@ function createProxyClient(cfg) {
|
|
|
22426
23017
|
}
|
|
22427
23018
|
});
|
|
22428
23019
|
},
|
|
23020
|
+
async getAlias(req) {
|
|
23021
|
+
const url2 = `${base}/api/site/${encodeURIComponent(req.site)}/alias/${encodeURIComponent(req.mode)}`;
|
|
23022
|
+
let response;
|
|
23023
|
+
try {
|
|
23024
|
+
response = await fetchImpl(url2, {
|
|
23025
|
+
method: "GET",
|
|
23026
|
+
headers: {
|
|
23027
|
+
Authorization: await userBearer(),
|
|
23028
|
+
Accept: "application/json"
|
|
23029
|
+
}
|
|
23030
|
+
});
|
|
23031
|
+
} catch (err) {
|
|
23032
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
23033
|
+
throw new ProxyError(
|
|
23034
|
+
0,
|
|
23035
|
+
"network_error",
|
|
23036
|
+
`proxy unreachable: ${message}`
|
|
23037
|
+
);
|
|
23038
|
+
}
|
|
23039
|
+
if (response.status === 404) return null;
|
|
23040
|
+
if (!response.ok) {
|
|
23041
|
+
const env = await readErrorEnvelope(response);
|
|
23042
|
+
throwProxyError(response.status, env);
|
|
23043
|
+
}
|
|
23044
|
+
return await response.json();
|
|
23045
|
+
},
|
|
22429
23046
|
async sitePromote(req) {
|
|
22430
23047
|
const url2 = `${base}/api/site/${encodeURIComponent(req.site)}/promote`;
|
|
23048
|
+
const headers = {
|
|
23049
|
+
Authorization: await userBearer(),
|
|
23050
|
+
Accept: "application/json"
|
|
23051
|
+
};
|
|
23052
|
+
const body = {};
|
|
23053
|
+
if (req.deployId !== void 0) body.deployId = req.deployId;
|
|
23054
|
+
if (req.expectedCurrent !== void 0)
|
|
23055
|
+
body.expectedCurrent = req.expectedCurrent;
|
|
23056
|
+
const hasBody = Object.keys(body).length > 0;
|
|
23057
|
+
if (hasBody) headers["Content-Type"] = "application/json";
|
|
22431
23058
|
return call(url2, {
|
|
22432
23059
|
method: "POST",
|
|
22433
|
-
headers
|
|
22434
|
-
|
|
22435
|
-
Accept: "application/json"
|
|
22436
|
-
}
|
|
23060
|
+
headers,
|
|
23061
|
+
...hasBody ? { body: JSON.stringify(body) } : {}
|
|
22437
23062
|
});
|
|
22438
23063
|
},
|
|
22439
23064
|
async siteRollback(req) {
|
|
22440
23065
|
const url2 = `${base}/api/site/${encodeURIComponent(req.site)}/rollback`;
|
|
23066
|
+
const body = { to: req.to };
|
|
23067
|
+
if (req.expectedCurrent !== void 0)
|
|
23068
|
+
body.expectedCurrent = req.expectedCurrent;
|
|
22441
23069
|
return call(url2, {
|
|
22442
23070
|
method: "POST",
|
|
22443
23071
|
headers: {
|
|
@@ -22445,7 +23073,7 @@ function createProxyClient(cfg) {
|
|
|
22445
23073
|
Accept: "application/json",
|
|
22446
23074
|
"Content-Type": "application/json"
|
|
22447
23075
|
},
|
|
22448
|
-
body: JSON.stringify(
|
|
23076
|
+
body: JSON.stringify(body)
|
|
22449
23077
|
});
|
|
22450
23078
|
},
|
|
22451
23079
|
async registerSite(req) {
|
|
@@ -23077,7 +23705,7 @@ var defaultReadPlatformYaml2 = async (cwd) => {
|
|
|
23077
23705
|
function emitJson4(envelope) {
|
|
23078
23706
|
process.stdout.write(JSON.stringify(envelope) + "\n");
|
|
23079
23707
|
}
|
|
23080
|
-
var DEPLOY_ID_RE = /^(\d{8})-(\d{6})-(
|
|
23708
|
+
var DEPLOY_ID_RE = /^(\d{8})-(\d{6})-(\S+)$/;
|
|
23081
23709
|
function parseDeployId(deployId) {
|
|
23082
23710
|
const m = DEPLOY_ID_RE.exec(deployId);
|
|
23083
23711
|
if (!m) return { deployId, timestamp: null, sha: null };
|
|
@@ -23179,6 +23807,11 @@ async function ls(options, deps = {}) {
|
|
|
23179
23807
|
// src/commands/promote.ts
|
|
23180
23808
|
var import_promises6 = require("fs/promises");
|
|
23181
23809
|
var import_node_path7 = require("path");
|
|
23810
|
+
var defaultPromptConfirm = async (msg) => {
|
|
23811
|
+
const r = await ot2({ message: msg, initialValue: false });
|
|
23812
|
+
if (q(r)) return false;
|
|
23813
|
+
return r === true;
|
|
23814
|
+
};
|
|
23182
23815
|
var defaultReadPlatformYaml3 = async (cwd) => {
|
|
23183
23816
|
return (0, import_promises6.readFile)((0, import_node_path7.resolve)(cwd, "platform.yaml"), "utf-8");
|
|
23184
23817
|
};
|
|
@@ -23210,6 +23843,7 @@ async function promote(options, deps = {}) {
|
|
|
23210
23843
|
const success2 = deps.logSuccess ?? ((s) => O2.success(s));
|
|
23211
23844
|
const error48 = deps.logError ?? ((s) => O2.error(s));
|
|
23212
23845
|
const exit = deps.exit ?? exitWithCode;
|
|
23846
|
+
const promptConfirm = deps.promptConfirm ?? defaultPromptConfirm;
|
|
23213
23847
|
try {
|
|
23214
23848
|
const identity = await resolveId({ env });
|
|
23215
23849
|
if (!identity) {
|
|
@@ -23225,12 +23859,75 @@ async function promote(options, deps = {}) {
|
|
|
23225
23859
|
});
|
|
23226
23860
|
let result;
|
|
23227
23861
|
if (options.from) {
|
|
23228
|
-
|
|
23862
|
+
const prod = await client.getAlias({
|
|
23229
23863
|
site: config2.site,
|
|
23230
|
-
|
|
23864
|
+
mode: "production"
|
|
23231
23865
|
});
|
|
23866
|
+
const initialExpected = prod?.deployId ?? "";
|
|
23867
|
+
try {
|
|
23868
|
+
result = await client.siteRollback({
|
|
23869
|
+
site: config2.site,
|
|
23870
|
+
to: options.from,
|
|
23871
|
+
expectedCurrent: initialExpected
|
|
23872
|
+
});
|
|
23873
|
+
} catch (err) {
|
|
23874
|
+
if (!(err instanceof AliasDriftError)) throw err;
|
|
23875
|
+
if (options.json) throw err;
|
|
23876
|
+
error48(
|
|
23877
|
+
`drift: production moved to ${err.current}, expected ${initialExpected}`
|
|
23878
|
+
);
|
|
23879
|
+
const ok = await promptConfirm(
|
|
23880
|
+
`Retry promote --from with expectedCurrent='${err.current}'?`
|
|
23881
|
+
);
|
|
23882
|
+
if (!ok) throw err;
|
|
23883
|
+
result = await client.siteRollback({
|
|
23884
|
+
site: config2.site,
|
|
23885
|
+
to: options.from,
|
|
23886
|
+
expectedCurrent: err.current
|
|
23887
|
+
});
|
|
23888
|
+
}
|
|
23232
23889
|
} else {
|
|
23233
|
-
|
|
23890
|
+
const preview = await client.getAlias({
|
|
23891
|
+
site: config2.site,
|
|
23892
|
+
mode: "preview"
|
|
23893
|
+
});
|
|
23894
|
+
if (preview === null) {
|
|
23895
|
+
throw new ConfigError(
|
|
23896
|
+
"no preview alias to promote \u2014 run `universe static deploy` first"
|
|
23897
|
+
);
|
|
23898
|
+
}
|
|
23899
|
+
const prod = await client.getAlias({
|
|
23900
|
+
site: config2.site,
|
|
23901
|
+
mode: "production"
|
|
23902
|
+
});
|
|
23903
|
+
if (!options.json) {
|
|
23904
|
+
success2(
|
|
23905
|
+
`Promoting ${preview.deployId} \u2192 ${prod?.deployId ?? "<none>"}`
|
|
23906
|
+
);
|
|
23907
|
+
}
|
|
23908
|
+
const initialExpected = prod?.deployId ?? "";
|
|
23909
|
+
try {
|
|
23910
|
+
result = await client.sitePromote({
|
|
23911
|
+
site: config2.site,
|
|
23912
|
+
deployId: preview.deployId,
|
|
23913
|
+
expectedCurrent: initialExpected
|
|
23914
|
+
});
|
|
23915
|
+
} catch (err) {
|
|
23916
|
+
if (!(err instanceof AliasDriftError)) throw err;
|
|
23917
|
+
if (options.json) throw err;
|
|
23918
|
+
error48(
|
|
23919
|
+
`drift: production moved to ${err.current}, expected ${initialExpected}`
|
|
23920
|
+
);
|
|
23921
|
+
const ok = await promptConfirm(
|
|
23922
|
+
`Retry promote with expectedCurrent='${err.current}'?`
|
|
23923
|
+
);
|
|
23924
|
+
if (!ok) throw err;
|
|
23925
|
+
result = await client.sitePromote({
|
|
23926
|
+
site: config2.site,
|
|
23927
|
+
deployId: preview.deployId,
|
|
23928
|
+
expectedCurrent: err.current
|
|
23929
|
+
});
|
|
23930
|
+
}
|
|
23234
23931
|
}
|
|
23235
23932
|
if (options.json) {
|
|
23236
23933
|
emitJson5(
|
|
@@ -23257,7 +23954,12 @@ async function promote(options, deps = {}) {
|
|
|
23257
23954
|
} catch (err) {
|
|
23258
23955
|
const { code, message } = wrapProxyError("promote", err);
|
|
23259
23956
|
if (options.json) {
|
|
23260
|
-
|
|
23957
|
+
const envelope = buildErrorEnvelope("promote", code, message);
|
|
23958
|
+
if (err instanceof AliasDriftError) {
|
|
23959
|
+
emitJson5({ ...envelope, current: err.current });
|
|
23960
|
+
} else {
|
|
23961
|
+
emitJson5(envelope);
|
|
23962
|
+
}
|
|
23261
23963
|
} else {
|
|
23262
23964
|
error48(message);
|
|
23263
23965
|
}
|
|
@@ -23268,6 +23970,11 @@ async function promote(options, deps = {}) {
|
|
|
23268
23970
|
// src/commands/rollback.ts
|
|
23269
23971
|
var import_promises7 = require("fs/promises");
|
|
23270
23972
|
var import_node_path8 = require("path");
|
|
23973
|
+
var defaultPromptConfirm2 = async (msg) => {
|
|
23974
|
+
const r = await ot2({ message: msg, initialValue: false });
|
|
23975
|
+
if (q(r)) return false;
|
|
23976
|
+
return r === true;
|
|
23977
|
+
};
|
|
23271
23978
|
var defaultReadPlatformYaml4 = async (cwd) => {
|
|
23272
23979
|
return (0, import_promises7.readFile)((0, import_node_path8.resolve)(cwd, "platform.yaml"), "utf-8");
|
|
23273
23980
|
};
|
|
@@ -23299,6 +24006,7 @@ async function rollback(options, deps = {}) {
|
|
|
23299
24006
|
const success2 = deps.logSuccess ?? ((s) => O2.success(s));
|
|
23300
24007
|
const error48 = deps.logError ?? ((s) => O2.error(s));
|
|
23301
24008
|
const exit = deps.exit ?? exitWithCode;
|
|
24009
|
+
const promptConfirm = deps.promptConfirm ?? defaultPromptConfirm2;
|
|
23302
24010
|
try {
|
|
23303
24011
|
if (!options.to || options.to.trim().length === 0) {
|
|
23304
24012
|
throw new UsageError(
|
|
@@ -23317,10 +24025,35 @@ async function rollback(options, deps = {}) {
|
|
|
23317
24025
|
baseUrl,
|
|
23318
24026
|
getAuthToken: () => identity.token
|
|
23319
24027
|
});
|
|
23320
|
-
const
|
|
24028
|
+
const to = options.to.trim();
|
|
24029
|
+
const prod = await client.getAlias({
|
|
23321
24030
|
site: config2.site,
|
|
23322
|
-
|
|
24031
|
+
mode: "production"
|
|
23323
24032
|
});
|
|
24033
|
+
const initialExpected = prod?.deployId ?? "";
|
|
24034
|
+
let result;
|
|
24035
|
+
try {
|
|
24036
|
+
result = await client.siteRollback({
|
|
24037
|
+
site: config2.site,
|
|
24038
|
+
to,
|
|
24039
|
+
expectedCurrent: initialExpected
|
|
24040
|
+
});
|
|
24041
|
+
} catch (err) {
|
|
24042
|
+
if (!(err instanceof AliasDriftError)) throw err;
|
|
24043
|
+
if (options.json) throw err;
|
|
24044
|
+
error48(
|
|
24045
|
+
`drift: production moved to ${err.current}, expected ${initialExpected}`
|
|
24046
|
+
);
|
|
24047
|
+
const ok = await promptConfirm(
|
|
24048
|
+
`Retry rollback with expectedCurrent='${err.current}'?`
|
|
24049
|
+
);
|
|
24050
|
+
if (!ok) throw err;
|
|
24051
|
+
result = await client.siteRollback({
|
|
24052
|
+
site: config2.site,
|
|
24053
|
+
to,
|
|
24054
|
+
expectedCurrent: err.current
|
|
24055
|
+
});
|
|
24056
|
+
}
|
|
23324
24057
|
if (options.json) {
|
|
23325
24058
|
emitJson6(
|
|
23326
24059
|
buildEnvelope("rollback", true, {
|
|
@@ -23344,7 +24077,12 @@ async function rollback(options, deps = {}) {
|
|
|
23344
24077
|
} catch (err) {
|
|
23345
24078
|
const { code, message } = wrapProxyError("rollback", err);
|
|
23346
24079
|
if (options.json) {
|
|
23347
|
-
|
|
24080
|
+
const envelope = buildErrorEnvelope("rollback", code, message);
|
|
24081
|
+
if (err instanceof AliasDriftError) {
|
|
24082
|
+
emitJson6({ ...envelope, current: err.current });
|
|
24083
|
+
} else {
|
|
24084
|
+
emitJson6(envelope);
|
|
24085
|
+
}
|
|
23348
24086
|
} else {
|
|
23349
24087
|
error48(message);
|
|
23350
24088
|
}
|
|
@@ -23694,7 +24432,7 @@ function outputError(ctx, code, message, issues) {
|
|
|
23694
24432
|
}
|
|
23695
24433
|
|
|
23696
24434
|
// src/cli.ts
|
|
23697
|
-
var version2 = true ? "0.
|
|
24435
|
+
var version2 = true ? "0.6.0" : "0.0.0";
|
|
23698
24436
|
function handleActionError(command, json2, err) {
|
|
23699
24437
|
const ctx = { json: json2, command };
|
|
23700
24438
|
const message = err instanceof Error ? err.message : "unknown error";
|