sv 0.12.2 → 0.12.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +5 -5
- package/dist/engine-BZ0rj9tz.d.mts +359 -0
- package/dist/{add-RNKqR0_d.mjs → engine-BmcQ5Tk6.mjs} +2252 -2101
- package/dist/{package-manager-B3sMOeTk.mjs → package-manager-BYzDyeam.mjs} +2650 -231
- package/dist/shared.json +3 -3
- package/dist/src/index.d.mts +25 -0
- package/dist/src/index.mjs +4 -0
- package/dist/{lib → src}/testing.d.mts +4 -5
- package/dist/{lib → src}/testing.mjs +2 -4
- package/dist/templates/addon/assets/src/index.js +2 -1
- package/dist/templates/addon/package.json +2 -1
- package/dist/templates/demo/assets/DOT-vscode/extensions.json +3 -0
- package/dist/templates/library/assets/DOT-vscode/extensions.json +3 -0
- package/dist/templates/minimal/assets/DOT-vscode/extensions.json +3 -0
- package/package.json +11 -22
- package/dist/add-BP-WJ6Sw.d.mts +0 -38
- package/dist/chunk-BcJDCUAU.mjs +0 -45
- package/dist/core-VSHdSalh.d.mts +0 -788
- package/dist/lib/core.d.mts +0 -2
- package/dist/lib/core.mjs +0 -3
- package/dist/lib/index.d.mts +0 -16
- package/dist/lib/index.mjs +0 -5
- package/dist/utils-D-OWcBXG.mjs +0 -41170
|
@@ -1,170 +1,2609 @@
|
|
|
1
|
-
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-BcJDCUAU.mjs";
|
|
2
|
-
import { Dt as qt, G as isVersionUnsupportedBelow, Ot as zt, ht as constructCommand, kt as Ct, l as parse, mt as COMMANDS, n as commonFilePaths, pt as q, t as color, xt as Pt } from "./utils-D-OWcBXG.mjs";
|
|
3
1
|
import { createRequire } from "node:module";
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
2
|
+
import { AGENTS, COMMANDS, color, constructCommand, detect, isVersionUnsupportedBelow, parse, resolveCommand, sanitizeName } from "@sveltejs/sv-utils";
|
|
3
|
+
import fs, { existsSync, lstatSync, readdirSync } from "node:fs";
|
|
4
|
+
import path, { delimiter, dirname, isAbsolute, join, normalize, resolve } from "node:path";
|
|
5
|
+
import process$1, { cwd, stdin, stdout } from "node:process";
|
|
6
|
+
import * as k$2 from "node:readline";
|
|
7
|
+
import c from "node:readline";
|
|
8
|
+
import { ReadStream } from "node:tty";
|
|
9
|
+
import { stripVTControlCharacters } from "node:util";
|
|
10
|
+
import { createRequire as createRequire$1 } from "module";
|
|
11
|
+
import { spawn } from "node:child_process";
|
|
12
|
+
import { PassThrough } from "node:stream";
|
|
8
13
|
import { fileURLToPath } from "node:url";
|
|
9
14
|
|
|
10
|
-
//#region
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
"node_modules/.deno/": "deno",
|
|
32
|
-
"node_modules/.pnpm/": "pnpm",
|
|
33
|
-
"node_modules/.yarn-state.yml": "yarn",
|
|
34
|
-
"node_modules/.yarn_integrity": "yarn",
|
|
35
|
-
"node_modules/.package-lock.json": "npm",
|
|
36
|
-
".pnp.cjs": "yarn",
|
|
37
|
-
".pnp.js": "yarn",
|
|
38
|
-
"bun.lock": "bun",
|
|
39
|
-
"bun.lockb": "bun"
|
|
15
|
+
//#region rolldown:runtime
|
|
16
|
+
var __create = Object.create;
|
|
17
|
+
var __defProp = Object.defineProperty;
|
|
18
|
+
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
19
|
+
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
20
|
+
var __getProtoOf = Object.getPrototypeOf;
|
|
21
|
+
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
22
|
+
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
23
|
+
var __copyProps = (to, from$1, except, desc) => {
|
|
24
|
+
if (from$1 && typeof from$1 === "object" || typeof from$1 === "function") {
|
|
25
|
+
for (var keys = __getOwnPropNames(from$1), i = 0, n = keys.length, key; i < n; i++) {
|
|
26
|
+
key = keys[i];
|
|
27
|
+
if (!__hasOwnProp.call(to, key) && key !== except) {
|
|
28
|
+
__defProp(to, key, {
|
|
29
|
+
get: ((k$3) => from$1[k$3]).bind(null, key),
|
|
30
|
+
enumerable: !(desc = __getOwnPropDesc(from$1, key)) || desc.enumerable
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
return to;
|
|
40
36
|
};
|
|
37
|
+
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", {
|
|
38
|
+
value: mod,
|
|
39
|
+
enumerable: true
|
|
40
|
+
}) : target, mod));
|
|
41
|
+
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
41
42
|
|
|
42
43
|
//#endregion
|
|
43
|
-
//#region ../../node_modules/.pnpm/
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
return
|
|
44
|
+
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
45
|
+
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
46
|
+
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
47
|
+
let isColorSupported = !(!!env.NO_COLOR || argv.includes("--no-color")) && (!!env.FORCE_COLOR || argv.includes("--color") || p.platform === "win32" || (p.stdout || {}).isTTY && env.TERM !== "dumb" || !!env.CI);
|
|
48
|
+
let formatter = (open, close, replace$1 = open) => (input) => {
|
|
49
|
+
let string = "" + input, index = string.indexOf(close, open.length);
|
|
50
|
+
return ~index ? open + replaceClose(string, close, replace$1, index) + close : open + string + close;
|
|
51
|
+
};
|
|
52
|
+
let replaceClose = (string, close, replace$1, index) => {
|
|
53
|
+
let result = "", cursor = 0;
|
|
54
|
+
do {
|
|
55
|
+
result += string.substring(cursor, index) + replace$1;
|
|
56
|
+
cursor = index + close.length;
|
|
57
|
+
index = string.indexOf(close, cursor);
|
|
58
|
+
} while (~index);
|
|
59
|
+
return result + string.substring(cursor);
|
|
60
|
+
};
|
|
61
|
+
let createColors = (enabled = isColorSupported) => {
|
|
62
|
+
let f$1 = enabled ? formatter : () => String;
|
|
63
|
+
return {
|
|
64
|
+
isColorSupported: enabled,
|
|
65
|
+
reset: f$1("\x1B[0m", "\x1B[0m"),
|
|
66
|
+
bold: f$1("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
67
|
+
dim: f$1("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
68
|
+
italic: f$1("\x1B[3m", "\x1B[23m"),
|
|
69
|
+
underline: f$1("\x1B[4m", "\x1B[24m"),
|
|
70
|
+
inverse: f$1("\x1B[7m", "\x1B[27m"),
|
|
71
|
+
hidden: f$1("\x1B[8m", "\x1B[28m"),
|
|
72
|
+
strikethrough: f$1("\x1B[9m", "\x1B[29m"),
|
|
73
|
+
black: f$1("\x1B[30m", "\x1B[39m"),
|
|
74
|
+
red: f$1("\x1B[31m", "\x1B[39m"),
|
|
75
|
+
green: f$1("\x1B[32m", "\x1B[39m"),
|
|
76
|
+
yellow: f$1("\x1B[33m", "\x1B[39m"),
|
|
77
|
+
blue: f$1("\x1B[34m", "\x1B[39m"),
|
|
78
|
+
magenta: f$1("\x1B[35m", "\x1B[39m"),
|
|
79
|
+
cyan: f$1("\x1B[36m", "\x1B[39m"),
|
|
80
|
+
white: f$1("\x1B[37m", "\x1B[39m"),
|
|
81
|
+
gray: f$1("\x1B[90m", "\x1B[39m"),
|
|
82
|
+
bgBlack: f$1("\x1B[40m", "\x1B[49m"),
|
|
83
|
+
bgRed: f$1("\x1B[41m", "\x1B[49m"),
|
|
84
|
+
bgGreen: f$1("\x1B[42m", "\x1B[49m"),
|
|
85
|
+
bgYellow: f$1("\x1B[43m", "\x1B[49m"),
|
|
86
|
+
bgBlue: f$1("\x1B[44m", "\x1B[49m"),
|
|
87
|
+
bgMagenta: f$1("\x1B[45m", "\x1B[49m"),
|
|
88
|
+
bgCyan: f$1("\x1B[46m", "\x1B[49m"),
|
|
89
|
+
bgWhite: f$1("\x1B[47m", "\x1B[49m"),
|
|
90
|
+
blackBright: f$1("\x1B[90m", "\x1B[39m"),
|
|
91
|
+
redBright: f$1("\x1B[91m", "\x1B[39m"),
|
|
92
|
+
greenBright: f$1("\x1B[92m", "\x1B[39m"),
|
|
93
|
+
yellowBright: f$1("\x1B[93m", "\x1B[39m"),
|
|
94
|
+
blueBright: f$1("\x1B[94m", "\x1B[39m"),
|
|
95
|
+
magentaBright: f$1("\x1B[95m", "\x1B[39m"),
|
|
96
|
+
cyanBright: f$1("\x1B[96m", "\x1B[39m"),
|
|
97
|
+
whiteBright: f$1("\x1B[97m", "\x1B[39m"),
|
|
98
|
+
bgBlackBright: f$1("\x1B[100m", "\x1B[49m"),
|
|
99
|
+
bgRedBright: f$1("\x1B[101m", "\x1B[49m"),
|
|
100
|
+
bgGreenBright: f$1("\x1B[102m", "\x1B[49m"),
|
|
101
|
+
bgYellowBright: f$1("\x1B[103m", "\x1B[49m"),
|
|
102
|
+
bgBlueBright: f$1("\x1B[104m", "\x1B[49m"),
|
|
103
|
+
bgMagentaBright: f$1("\x1B[105m", "\x1B[49m"),
|
|
104
|
+
bgCyanBright: f$1("\x1B[106m", "\x1B[49m"),
|
|
105
|
+
bgWhiteBright: f$1("\x1B[107m", "\x1B[49m")
|
|
106
|
+
};
|
|
107
|
+
};
|
|
108
|
+
module.exports = createColors();
|
|
109
|
+
module.exports.createColors = createColors;
|
|
110
|
+
}));
|
|
111
|
+
|
|
112
|
+
//#endregion
|
|
113
|
+
//#region ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
114
|
+
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
115
|
+
const ESC = "\x1B";
|
|
116
|
+
const CSI = `${ESC}[`;
|
|
117
|
+
const beep = "\x07";
|
|
118
|
+
const cursor = {
|
|
119
|
+
to(x$3, y$2) {
|
|
120
|
+
if (!y$2) return `${CSI}${x$3 + 1}G`;
|
|
121
|
+
return `${CSI}${y$2 + 1};${x$3 + 1}H`;
|
|
122
|
+
},
|
|
123
|
+
move(x$3, y$2) {
|
|
124
|
+
let ret = "";
|
|
125
|
+
if (x$3 < 0) ret += `${CSI}${-x$3}D`;
|
|
126
|
+
else if (x$3 > 0) ret += `${CSI}${x$3}C`;
|
|
127
|
+
if (y$2 < 0) ret += `${CSI}${-y$2}A`;
|
|
128
|
+
else if (y$2 > 0) ret += `${CSI}${y$2}B`;
|
|
129
|
+
return ret;
|
|
130
|
+
},
|
|
131
|
+
up: (count = 1) => `${CSI}${count}A`,
|
|
132
|
+
down: (count = 1) => `${CSI}${count}B`,
|
|
133
|
+
forward: (count = 1) => `${CSI}${count}C`,
|
|
134
|
+
backward: (count = 1) => `${CSI}${count}D`,
|
|
135
|
+
nextLine: (count = 1) => `${CSI}E`.repeat(count),
|
|
136
|
+
prevLine: (count = 1) => `${CSI}F`.repeat(count),
|
|
137
|
+
left: `${CSI}G`,
|
|
138
|
+
hide: `${CSI}?25l`,
|
|
139
|
+
show: `${CSI}?25h`,
|
|
140
|
+
save: `${ESC}7`,
|
|
141
|
+
restore: `${ESC}8`
|
|
142
|
+
};
|
|
143
|
+
const scroll = {
|
|
144
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
145
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
146
|
+
};
|
|
147
|
+
const erase = {
|
|
148
|
+
screen: `${CSI}2J`,
|
|
149
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
150
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
151
|
+
line: `${CSI}2K`,
|
|
152
|
+
lineEnd: `${CSI}K`,
|
|
153
|
+
lineStart: `${CSI}1K`,
|
|
154
|
+
lines(count) {
|
|
155
|
+
let clear = "";
|
|
156
|
+
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
157
|
+
if (count) clear += cursor.left;
|
|
158
|
+
return clear;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
module.exports = {
|
|
162
|
+
cursor,
|
|
163
|
+
scroll,
|
|
164
|
+
erase,
|
|
165
|
+
beep
|
|
166
|
+
};
|
|
167
|
+
}));
|
|
168
|
+
|
|
169
|
+
//#endregion
|
|
170
|
+
//#region ../../node_modules/.pnpm/@clack+core@1.0.0/node_modules/@clack/core/dist/index.mjs
|
|
171
|
+
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
172
|
+
var import_src = require_src();
|
|
173
|
+
const at = (t$1) => t$1 === 161 || t$1 === 164 || t$1 === 167 || t$1 === 168 || t$1 === 170 || t$1 === 173 || t$1 === 174 || t$1 >= 176 && t$1 <= 180 || t$1 >= 182 && t$1 <= 186 || t$1 >= 188 && t$1 <= 191 || t$1 === 198 || t$1 === 208 || t$1 === 215 || t$1 === 216 || t$1 >= 222 && t$1 <= 225 || t$1 === 230 || t$1 >= 232 && t$1 <= 234 || t$1 === 236 || t$1 === 237 || t$1 === 240 || t$1 === 242 || t$1 === 243 || t$1 >= 247 && t$1 <= 250 || t$1 === 252 || t$1 === 254 || t$1 === 257 || t$1 === 273 || t$1 === 275 || t$1 === 283 || t$1 === 294 || t$1 === 295 || t$1 === 299 || t$1 >= 305 && t$1 <= 307 || t$1 === 312 || t$1 >= 319 && t$1 <= 322 || t$1 === 324 || t$1 >= 328 && t$1 <= 331 || t$1 === 333 || t$1 === 338 || t$1 === 339 || t$1 === 358 || t$1 === 359 || t$1 === 363 || t$1 === 462 || t$1 === 464 || t$1 === 466 || t$1 === 468 || t$1 === 470 || t$1 === 472 || t$1 === 474 || t$1 === 476 || t$1 === 593 || t$1 === 609 || t$1 === 708 || t$1 === 711 || t$1 >= 713 && t$1 <= 715 || t$1 === 717 || t$1 === 720 || t$1 >= 728 && t$1 <= 731 || t$1 === 733 || t$1 === 735 || t$1 >= 768 && t$1 <= 879 || t$1 >= 913 && t$1 <= 929 || t$1 >= 931 && t$1 <= 937 || t$1 >= 945 && t$1 <= 961 || t$1 >= 963 && t$1 <= 969 || t$1 === 1025 || t$1 >= 1040 && t$1 <= 1103 || t$1 === 1105 || t$1 === 8208 || t$1 >= 8211 && t$1 <= 8214 || t$1 === 8216 || t$1 === 8217 || t$1 === 8220 || t$1 === 8221 || t$1 >= 8224 && t$1 <= 8226 || t$1 >= 8228 && t$1 <= 8231 || t$1 === 8240 || t$1 === 8242 || t$1 === 8243 || t$1 === 8245 || t$1 === 8251 || t$1 === 8254 || t$1 === 8308 || t$1 === 8319 || t$1 >= 8321 && t$1 <= 8324 || t$1 === 8364 || t$1 === 8451 || t$1 === 8453 || t$1 === 8457 || t$1 === 8467 || t$1 === 8470 || t$1 === 8481 || t$1 === 8482 || t$1 === 8486 || t$1 === 8491 || t$1 === 8531 || t$1 === 8532 || t$1 >= 8539 && t$1 <= 8542 || t$1 >= 8544 && t$1 <= 8555 || t$1 >= 8560 && t$1 <= 8569 || t$1 === 8585 || t$1 >= 8592 && t$1 <= 8601 || t$1 === 8632 || t$1 === 8633 || t$1 === 8658 || t$1 === 8660 || t$1 === 8679 || t$1 === 8704 || t$1 === 8706 || t$1 === 8707 || t$1 === 8711 || t$1 === 8712 || t$1 === 8715 || t$1 === 8719 || t$1 === 8721 || t$1 === 8725 || t$1 === 8730 || t$1 >= 8733 && t$1 <= 8736 || t$1 === 8739 || t$1 === 8741 || t$1 >= 8743 && t$1 <= 8748 || t$1 === 8750 || t$1 >= 8756 && t$1 <= 8759 || t$1 === 8764 || t$1 === 8765 || t$1 === 8776 || t$1 === 8780 || t$1 === 8786 || t$1 === 8800 || t$1 === 8801 || t$1 >= 8804 && t$1 <= 8807 || t$1 === 8810 || t$1 === 8811 || t$1 === 8814 || t$1 === 8815 || t$1 === 8834 || t$1 === 8835 || t$1 === 8838 || t$1 === 8839 || t$1 === 8853 || t$1 === 8857 || t$1 === 8869 || t$1 === 8895 || t$1 === 8978 || t$1 >= 9312 && t$1 <= 9449 || t$1 >= 9451 && t$1 <= 9547 || t$1 >= 9552 && t$1 <= 9587 || t$1 >= 9600 && t$1 <= 9615 || t$1 >= 9618 && t$1 <= 9621 || t$1 === 9632 || t$1 === 9633 || t$1 >= 9635 && t$1 <= 9641 || t$1 === 9650 || t$1 === 9651 || t$1 === 9654 || t$1 === 9655 || t$1 === 9660 || t$1 === 9661 || t$1 === 9664 || t$1 === 9665 || t$1 >= 9670 && t$1 <= 9672 || t$1 === 9675 || t$1 >= 9678 && t$1 <= 9681 || t$1 >= 9698 && t$1 <= 9701 || t$1 === 9711 || t$1 === 9733 || t$1 === 9734 || t$1 === 9737 || t$1 === 9742 || t$1 === 9743 || t$1 === 9756 || t$1 === 9758 || t$1 === 9792 || t$1 === 9794 || t$1 === 9824 || t$1 === 9825 || t$1 >= 9827 && t$1 <= 9829 || t$1 >= 9831 && t$1 <= 9834 || t$1 === 9836 || t$1 === 9837 || t$1 === 9839 || t$1 === 9886 || t$1 === 9887 || t$1 === 9919 || t$1 >= 9926 && t$1 <= 9933 || t$1 >= 9935 && t$1 <= 9939 || t$1 >= 9941 && t$1 <= 9953 || t$1 === 9955 || t$1 === 9960 || t$1 === 9961 || t$1 >= 9963 && t$1 <= 9969 || t$1 === 9972 || t$1 >= 9974 && t$1 <= 9977 || t$1 === 9979 || t$1 === 9980 || t$1 === 9982 || t$1 === 9983 || t$1 === 10045 || t$1 >= 10102 && t$1 <= 10111 || t$1 >= 11094 && t$1 <= 11097 || t$1 >= 12872 && t$1 <= 12879 || t$1 >= 57344 && t$1 <= 63743 || t$1 >= 65024 && t$1 <= 65039 || t$1 === 65533 || t$1 >= 127232 && t$1 <= 127242 || t$1 >= 127248 && t$1 <= 127277 || t$1 >= 127280 && t$1 <= 127337 || t$1 >= 127344 && t$1 <= 127373 || t$1 === 127375 || t$1 === 127376 || t$1 >= 127387 && t$1 <= 127404 || t$1 >= 917760 && t$1 <= 917999 || t$1 >= 983040 && t$1 <= 1048573 || t$1 >= 1048576 && t$1 <= 1114109, lt = (t$1) => t$1 === 12288 || t$1 >= 65281 && t$1 <= 65376 || t$1 >= 65504 && t$1 <= 65510, ht$1 = (t$1) => t$1 >= 4352 && t$1 <= 4447 || t$1 === 8986 || t$1 === 8987 || t$1 === 9001 || t$1 === 9002 || t$1 >= 9193 && t$1 <= 9196 || t$1 === 9200 || t$1 === 9203 || t$1 === 9725 || t$1 === 9726 || t$1 === 9748 || t$1 === 9749 || t$1 >= 9800 && t$1 <= 9811 || t$1 === 9855 || t$1 === 9875 || t$1 === 9889 || t$1 === 9898 || t$1 === 9899 || t$1 === 9917 || t$1 === 9918 || t$1 === 9924 || t$1 === 9925 || t$1 === 9934 || t$1 === 9940 || t$1 === 9962 || t$1 === 9970 || t$1 === 9971 || t$1 === 9973 || t$1 === 9978 || t$1 === 9981 || t$1 === 9989 || t$1 === 9994 || t$1 === 9995 || t$1 === 10024 || t$1 === 10060 || t$1 === 10062 || t$1 >= 10067 && t$1 <= 10069 || t$1 === 10071 || t$1 >= 10133 && t$1 <= 10135 || t$1 === 10160 || t$1 === 10175 || t$1 === 11035 || t$1 === 11036 || t$1 === 11088 || t$1 === 11093 || t$1 >= 11904 && t$1 <= 11929 || t$1 >= 11931 && t$1 <= 12019 || t$1 >= 12032 && t$1 <= 12245 || t$1 >= 12272 && t$1 <= 12287 || t$1 >= 12289 && t$1 <= 12350 || t$1 >= 12353 && t$1 <= 12438 || t$1 >= 12441 && t$1 <= 12543 || t$1 >= 12549 && t$1 <= 12591 || t$1 >= 12593 && t$1 <= 12686 || t$1 >= 12688 && t$1 <= 12771 || t$1 >= 12783 && t$1 <= 12830 || t$1 >= 12832 && t$1 <= 12871 || t$1 >= 12880 && t$1 <= 19903 || t$1 >= 19968 && t$1 <= 42124 || t$1 >= 42128 && t$1 <= 42182 || t$1 >= 43360 && t$1 <= 43388 || t$1 >= 44032 && t$1 <= 55203 || t$1 >= 63744 && t$1 <= 64255 || t$1 >= 65040 && t$1 <= 65049 || t$1 >= 65072 && t$1 <= 65106 || t$1 >= 65108 && t$1 <= 65126 || t$1 >= 65128 && t$1 <= 65131 || t$1 >= 94176 && t$1 <= 94180 || t$1 === 94192 || t$1 === 94193 || t$1 >= 94208 && t$1 <= 100343 || t$1 >= 100352 && t$1 <= 101589 || t$1 >= 101632 && t$1 <= 101640 || t$1 >= 110576 && t$1 <= 110579 || t$1 >= 110581 && t$1 <= 110587 || t$1 === 110589 || t$1 === 110590 || t$1 >= 110592 && t$1 <= 110882 || t$1 === 110898 || t$1 >= 110928 && t$1 <= 110930 || t$1 === 110933 || t$1 >= 110948 && t$1 <= 110951 || t$1 >= 110960 && t$1 <= 111355 || t$1 === 126980 || t$1 === 127183 || t$1 === 127374 || t$1 >= 127377 && t$1 <= 127386 || t$1 >= 127488 && t$1 <= 127490 || t$1 >= 127504 && t$1 <= 127547 || t$1 >= 127552 && t$1 <= 127560 || t$1 === 127568 || t$1 === 127569 || t$1 >= 127584 && t$1 <= 127589 || t$1 >= 127744 && t$1 <= 127776 || t$1 >= 127789 && t$1 <= 127797 || t$1 >= 127799 && t$1 <= 127868 || t$1 >= 127870 && t$1 <= 127891 || t$1 >= 127904 && t$1 <= 127946 || t$1 >= 127951 && t$1 <= 127955 || t$1 >= 127968 && t$1 <= 127984 || t$1 === 127988 || t$1 >= 127992 && t$1 <= 128062 || t$1 === 128064 || t$1 >= 128066 && t$1 <= 128252 || t$1 >= 128255 && t$1 <= 128317 || t$1 >= 128331 && t$1 <= 128334 || t$1 >= 128336 && t$1 <= 128359 || t$1 === 128378 || t$1 === 128405 || t$1 === 128406 || t$1 === 128420 || t$1 >= 128507 && t$1 <= 128591 || t$1 >= 128640 && t$1 <= 128709 || t$1 === 128716 || t$1 >= 128720 && t$1 <= 128722 || t$1 >= 128725 && t$1 <= 128727 || t$1 >= 128732 && t$1 <= 128735 || t$1 === 128747 || t$1 === 128748 || t$1 >= 128756 && t$1 <= 128764 || t$1 >= 128992 && t$1 <= 129003 || t$1 === 129008 || t$1 >= 129292 && t$1 <= 129338 || t$1 >= 129340 && t$1 <= 129349 || t$1 >= 129351 && t$1 <= 129535 || t$1 >= 129648 && t$1 <= 129660 || t$1 >= 129664 && t$1 <= 129672 || t$1 >= 129680 && t$1 <= 129725 || t$1 >= 129727 && t$1 <= 129733 || t$1 >= 129742 && t$1 <= 129755 || t$1 >= 129760 && t$1 <= 129768 || t$1 >= 129776 && t$1 <= 129784 || t$1 >= 131072 && t$1 <= 196605 || t$1 >= 196608 && t$1 <= 262141, O$1 = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, y$1 = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, M$2 = /\t{1,1000}/y, P$1 = /[\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?))*/uy, L = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct = /\p{M}+/gu, pt$1 = {
|
|
174
|
+
limit: Infinity,
|
|
175
|
+
ellipsis: ""
|
|
176
|
+
}, X = (t$1, e = {}, s = {}) => {
|
|
177
|
+
const i = e.limit ?? Infinity, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, pt$1, s).width : 0), u$1 = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l$1 = s.tabWidth ?? 8, E$1 = s.ambiguousWidth ?? 1, g$1 = s.emojiWidth ?? 2, m$1 = s.fullWidthWidth ?? 2, A$1 = s.regularWidth ?? 1, V$1 = s.wideWidth ?? 2;
|
|
178
|
+
let h$2 = 0, o = 0, f$1 = t$1.length, v$1 = 0, F$1 = !1, d$1 = f$1, b$1 = Math.max(0, i - n), C$1 = 0, B$1 = 0, c$1 = 0, p$1 = 0;
|
|
179
|
+
t: for (;;) {
|
|
180
|
+
if (B$1 > C$1 || o >= f$1 && o > h$2) {
|
|
181
|
+
const ut = t$1.slice(C$1, B$1) || t$1.slice(h$2, o);
|
|
182
|
+
v$1 = 0;
|
|
183
|
+
for (const Y$1 of ut.replaceAll(ct, "")) {
|
|
184
|
+
const $ = Y$1.codePointAt(0) || 0;
|
|
185
|
+
if (lt($) ? p$1 = m$1 : ht$1($) ? p$1 = V$1 : E$1 !== A$1 && at($) ? p$1 = E$1 : p$1 = A$1, c$1 + p$1 > b$1 && (d$1 = Math.min(d$1, Math.max(C$1, h$2) + v$1)), c$1 + p$1 > i) {
|
|
186
|
+
F$1 = !0;
|
|
187
|
+
break t;
|
|
188
|
+
}
|
|
189
|
+
v$1 += Y$1.length, c$1 += p$1;
|
|
190
|
+
}
|
|
191
|
+
C$1 = B$1 = 0;
|
|
192
|
+
}
|
|
193
|
+
if (o >= f$1) break;
|
|
194
|
+
if (L.lastIndex = o, L.test(t$1)) {
|
|
195
|
+
if (v$1 = L.lastIndex - o, p$1 = v$1 * A$1, c$1 + p$1 > b$1 && (d$1 = Math.min(d$1, o + Math.floor((b$1 - c$1) / A$1))), c$1 + p$1 > i) {
|
|
196
|
+
F$1 = !0;
|
|
197
|
+
break;
|
|
198
|
+
}
|
|
199
|
+
c$1 += p$1, C$1 = h$2, B$1 = o, o = h$2 = L.lastIndex;
|
|
200
|
+
continue;
|
|
201
|
+
}
|
|
202
|
+
if (O$1.lastIndex = o, O$1.test(t$1)) {
|
|
203
|
+
if (c$1 + u$1 > b$1 && (d$1 = Math.min(d$1, o)), c$1 + u$1 > i) {
|
|
204
|
+
F$1 = !0;
|
|
205
|
+
break;
|
|
206
|
+
}
|
|
207
|
+
c$1 += u$1, C$1 = h$2, B$1 = o, o = h$2 = O$1.lastIndex;
|
|
208
|
+
continue;
|
|
209
|
+
}
|
|
210
|
+
if (y$1.lastIndex = o, y$1.test(t$1)) {
|
|
211
|
+
if (v$1 = y$1.lastIndex - o, p$1 = v$1 * a, c$1 + p$1 > b$1 && (d$1 = Math.min(d$1, o + Math.floor((b$1 - c$1) / a))), c$1 + p$1 > i) {
|
|
212
|
+
F$1 = !0;
|
|
213
|
+
break;
|
|
214
|
+
}
|
|
215
|
+
c$1 += p$1, C$1 = h$2, B$1 = o, o = h$2 = y$1.lastIndex;
|
|
216
|
+
continue;
|
|
217
|
+
}
|
|
218
|
+
if (M$2.lastIndex = o, M$2.test(t$1)) {
|
|
219
|
+
if (v$1 = M$2.lastIndex - o, p$1 = v$1 * l$1, c$1 + p$1 > b$1 && (d$1 = Math.min(d$1, o + Math.floor((b$1 - c$1) / l$1))), c$1 + p$1 > i) {
|
|
220
|
+
F$1 = !0;
|
|
221
|
+
break;
|
|
222
|
+
}
|
|
223
|
+
c$1 += p$1, C$1 = h$2, B$1 = o, o = h$2 = M$2.lastIndex;
|
|
224
|
+
continue;
|
|
225
|
+
}
|
|
226
|
+
if (P$1.lastIndex = o, P$1.test(t$1)) {
|
|
227
|
+
if (c$1 + g$1 > b$1 && (d$1 = Math.min(d$1, o)), c$1 + g$1 > i) {
|
|
228
|
+
F$1 = !0;
|
|
229
|
+
break;
|
|
230
|
+
}
|
|
231
|
+
c$1 += g$1, C$1 = h$2, B$1 = o, o = h$2 = P$1.lastIndex;
|
|
232
|
+
continue;
|
|
233
|
+
}
|
|
234
|
+
o += 1;
|
|
235
|
+
}
|
|
236
|
+
return {
|
|
237
|
+
width: F$1 ? b$1 : c$1,
|
|
238
|
+
index: F$1 ? d$1 : f$1,
|
|
239
|
+
truncated: F$1,
|
|
240
|
+
ellipsed: F$1 && i >= n
|
|
241
|
+
};
|
|
242
|
+
}, ft$1 = {
|
|
243
|
+
limit: Infinity,
|
|
244
|
+
ellipsis: "",
|
|
245
|
+
ellipsisWidth: 0
|
|
246
|
+
}, S$1 = (t$1, e = {}) => X(t$1, ft$1, e).width, W$1 = "\x1B", Z = "", Ft$1 = 39, j$1 = "\x07", Q$1 = "[", dt = "]", tt = "m", U$1 = `${dt}8;;`, et = new RegExp(`(?:\\${Q$1}(?<code>\\d+)m|\\${U$1}(?<uri>.*)${j$1})`, "y"), mt$1 = (t$1) => {
|
|
247
|
+
if (t$1 >= 30 && t$1 <= 37 || t$1 >= 90 && t$1 <= 97) return 39;
|
|
248
|
+
if (t$1 >= 40 && t$1 <= 47 || t$1 >= 100 && t$1 <= 107) return 49;
|
|
249
|
+
if (t$1 === 1 || t$1 === 2) return 22;
|
|
250
|
+
if (t$1 === 3) return 23;
|
|
251
|
+
if (t$1 === 4) return 24;
|
|
252
|
+
if (t$1 === 7) return 27;
|
|
253
|
+
if (t$1 === 8) return 28;
|
|
254
|
+
if (t$1 === 9) return 29;
|
|
255
|
+
if (t$1 === 0) return 0;
|
|
256
|
+
}, st = (t$1) => `${W$1}${Q$1}${t$1}${tt}`, it = (t$1) => `${W$1}${U$1}${t$1}${j$1}`, gt$1 = (t$1) => t$1.map((e) => S$1(e)), G$2 = (t$1, e, s) => {
|
|
257
|
+
const i = e[Symbol.iterator]();
|
|
258
|
+
let r = !1, n = !1, u$1 = t$1.at(-1), a = u$1 === void 0 ? 0 : S$1(u$1), l$1 = i.next(), E$1 = i.next(), g$1 = 0;
|
|
259
|
+
for (; !l$1.done;) {
|
|
260
|
+
const m$1 = l$1.value, A$1 = S$1(m$1);
|
|
261
|
+
a + A$1 <= s ? t$1[t$1.length - 1] += m$1 : (t$1.push(m$1), a = 0), (m$1 === W$1 || m$1 === Z) && (r = !0, n = e.startsWith(U$1, g$1 + 1)), r ? n ? m$1 === j$1 && (r = !1, n = !1) : m$1 === tt && (r = !1) : (a += A$1, a === s && !E$1.done && (t$1.push(""), a = 0)), l$1 = E$1, E$1 = i.next(), g$1 += m$1.length;
|
|
262
|
+
}
|
|
263
|
+
u$1 = t$1.at(-1), !a && u$1 !== void 0 && u$1.length > 0 && t$1.length > 1 && (t$1[t$1.length - 2] += t$1.pop());
|
|
264
|
+
}, vt$1 = (t$1) => {
|
|
265
|
+
const e = t$1.split(" ");
|
|
266
|
+
let s = e.length;
|
|
267
|
+
for (; s > 0 && !(S$1(e[s - 1]) > 0);) s--;
|
|
268
|
+
return s === e.length ? t$1 : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
269
|
+
}, Et$1 = (t$1, e, s = {}) => {
|
|
270
|
+
if (s.trim !== !1 && t$1.trim() === "") return "";
|
|
271
|
+
let i = "", r, n;
|
|
272
|
+
const u$1 = t$1.split(" "), a = gt$1(u$1);
|
|
273
|
+
let l$1 = [""];
|
|
274
|
+
for (const [h$2, o] of u$1.entries()) {
|
|
275
|
+
s.trim !== !1 && (l$1[l$1.length - 1] = (l$1.at(-1) ?? "").trimStart());
|
|
276
|
+
let f$1 = S$1(l$1.at(-1) ?? "");
|
|
277
|
+
if (h$2 !== 0 && (f$1 >= e && (s.wordWrap === !1 || s.trim === !1) && (l$1.push(""), f$1 = 0), (f$1 > 0 || s.trim === !1) && (l$1[l$1.length - 1] += " ", f$1++)), s.hard && a[h$2] > e) {
|
|
278
|
+
const v$1 = e - f$1, F$1 = 1 + Math.floor((a[h$2] - v$1 - 1) / e);
|
|
279
|
+
Math.floor((a[h$2] - 1) / e) < F$1 && l$1.push(""), G$2(l$1, o, e);
|
|
280
|
+
continue;
|
|
281
|
+
}
|
|
282
|
+
if (f$1 + a[h$2] > e && f$1 > 0 && a[h$2] > 0) {
|
|
283
|
+
if (s.wordWrap === !1 && f$1 < e) {
|
|
284
|
+
G$2(l$1, o, e);
|
|
285
|
+
continue;
|
|
286
|
+
}
|
|
287
|
+
l$1.push("");
|
|
288
|
+
}
|
|
289
|
+
if (f$1 + a[h$2] > e && s.wordWrap === !1) {
|
|
290
|
+
G$2(l$1, o, e);
|
|
291
|
+
continue;
|
|
292
|
+
}
|
|
293
|
+
l$1[l$1.length - 1] += o;
|
|
294
|
+
}
|
|
295
|
+
s.trim !== !1 && (l$1 = l$1.map((h$2) => vt$1(h$2)));
|
|
296
|
+
const E$1 = l$1.join(`
|
|
297
|
+
`), g$1 = E$1[Symbol.iterator]();
|
|
298
|
+
let m$1 = g$1.next(), A$1 = g$1.next(), V$1 = 0;
|
|
299
|
+
for (; !m$1.done;) {
|
|
300
|
+
const h$2 = m$1.value, o = A$1.value;
|
|
301
|
+
if (i += h$2, h$2 === W$1 || h$2 === Z) {
|
|
302
|
+
et.lastIndex = V$1 + 1;
|
|
303
|
+
const F$1 = et.exec(E$1)?.groups;
|
|
304
|
+
if (F$1?.code !== void 0) {
|
|
305
|
+
const d$1 = Number.parseFloat(F$1.code);
|
|
306
|
+
r = d$1 === Ft$1 ? void 0 : d$1;
|
|
307
|
+
} else F$1?.uri !== void 0 && (n = F$1.uri.length === 0 ? void 0 : F$1.uri);
|
|
308
|
+
}
|
|
309
|
+
const f$1 = r ? mt$1(r) : void 0;
|
|
310
|
+
o === `
|
|
311
|
+
` ? (n && (i += it("")), r && f$1 && (i += st(f$1))) : h$2 === `
|
|
312
|
+
` && (r && f$1 && (i += st(r)), n && (i += it(n))), V$1 += h$2.length, m$1 = A$1, A$1 = g$1.next();
|
|
50
313
|
}
|
|
314
|
+
return i;
|
|
315
|
+
};
|
|
316
|
+
function K$2(t$1, e, s) {
|
|
317
|
+
return String(t$1).normalize().replaceAll(`\r
|
|
318
|
+
`, `
|
|
319
|
+
`).split(`
|
|
320
|
+
`).map((i) => Et$1(i, e, s)).join(`
|
|
321
|
+
`);
|
|
51
322
|
}
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
323
|
+
const _$1 = {
|
|
324
|
+
actions: new Set([
|
|
325
|
+
"up",
|
|
326
|
+
"down",
|
|
327
|
+
"left",
|
|
328
|
+
"right",
|
|
329
|
+
"space",
|
|
330
|
+
"enter",
|
|
331
|
+
"cancel"
|
|
332
|
+
]),
|
|
333
|
+
aliases: new Map([
|
|
334
|
+
["k", "up"],
|
|
335
|
+
["j", "down"],
|
|
336
|
+
["h", "left"],
|
|
337
|
+
["l", "right"],
|
|
338
|
+
["", "cancel"],
|
|
339
|
+
["escape", "cancel"]
|
|
340
|
+
]),
|
|
341
|
+
messages: {
|
|
342
|
+
cancel: "Canceled",
|
|
343
|
+
error: "Something went wrong"
|
|
344
|
+
},
|
|
345
|
+
withGuide: !0
|
|
346
|
+
};
|
|
347
|
+
function H$2(t$1, e) {
|
|
348
|
+
if (typeof t$1 == "string") return _$1.aliases.get(t$1) === e;
|
|
349
|
+
for (const s of t$1) if (s !== void 0 && H$2(s, e)) return !0;
|
|
350
|
+
return !1;
|
|
351
|
+
}
|
|
352
|
+
function _t$1(t$1, e) {
|
|
353
|
+
if (t$1 === e) return;
|
|
354
|
+
const s = t$1.split(`
|
|
355
|
+
`), i = e.split(`
|
|
356
|
+
`), r = Math.max(s.length, i.length), n = [];
|
|
357
|
+
for (let u$1 = 0; u$1 < r; u$1++) s[u$1] !== i[u$1] && n.push(u$1);
|
|
358
|
+
return {
|
|
359
|
+
lines: n,
|
|
360
|
+
numLinesBefore: s.length,
|
|
361
|
+
numLinesAfter: i.length,
|
|
362
|
+
numLines: r
|
|
363
|
+
};
|
|
364
|
+
}
|
|
365
|
+
const bt$1 = globalThis.process.platform.startsWith("win"), z$2 = Symbol("clack:cancel");
|
|
366
|
+
function Ct$1(t$1) {
|
|
367
|
+
return t$1 === z$2;
|
|
368
|
+
}
|
|
369
|
+
function T$1(t$1, e) {
|
|
370
|
+
const s = t$1;
|
|
371
|
+
s.isTTY && s.setRawMode(e);
|
|
372
|
+
}
|
|
373
|
+
function xt$1({ input: t$1 = stdin, output: e = stdout, overwrite: s = !0, hideCursor: i = !0 } = {}) {
|
|
374
|
+
const r = k$2.createInterface({
|
|
375
|
+
input: t$1,
|
|
376
|
+
output: e,
|
|
377
|
+
prompt: "",
|
|
378
|
+
tabSize: 1
|
|
379
|
+
});
|
|
380
|
+
k$2.emitKeypressEvents(t$1, r), t$1 instanceof ReadStream && t$1.isTTY && t$1.setRawMode(!0);
|
|
381
|
+
const n = (u$1, { name: a, sequence: l$1 }) => {
|
|
382
|
+
if (H$2([
|
|
383
|
+
String(u$1),
|
|
384
|
+
a,
|
|
385
|
+
l$1
|
|
386
|
+
], "cancel")) {
|
|
387
|
+
i && e.write(import_src.cursor.show), process.exit(0);
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
if (!s) return;
|
|
391
|
+
const g$1 = a === "return" ? 0 : -1, m$1 = a === "return" ? -1 : 0;
|
|
392
|
+
k$2.moveCursor(e, g$1, m$1, () => {
|
|
393
|
+
k$2.clearLine(e, 1, () => {
|
|
394
|
+
t$1.once("keypress", n);
|
|
395
|
+
});
|
|
396
|
+
});
|
|
397
|
+
};
|
|
398
|
+
return i && e.write(import_src.cursor.hide), t$1.once("keypress", n), () => {
|
|
399
|
+
t$1.off("keypress", n), i && e.write(import_src.cursor.show), t$1 instanceof ReadStream && t$1.isTTY && !bt$1 && t$1.setRawMode(!1), r.terminal = !1, r.close();
|
|
400
|
+
};
|
|
401
|
+
}
|
|
402
|
+
const rt = (t$1) => "columns" in t$1 && typeof t$1.columns == "number" ? t$1.columns : 80, nt = (t$1) => "rows" in t$1 && typeof t$1.rows == "number" ? t$1.rows : 20;
|
|
403
|
+
function Bt$1(t$1, e, s, i = s) {
|
|
404
|
+
return K$2(e, rt(t$1 ?? stdout) - s.length, {
|
|
405
|
+
hard: !0,
|
|
406
|
+
trim: !1
|
|
407
|
+
}).split(`
|
|
408
|
+
`).map((n, u$1) => `${u$1 === 0 ? i : s}${n}`).join(`
|
|
409
|
+
`);
|
|
410
|
+
}
|
|
411
|
+
var x$2 = class {
|
|
412
|
+
input;
|
|
413
|
+
output;
|
|
414
|
+
_abortSignal;
|
|
415
|
+
rl;
|
|
416
|
+
opts;
|
|
417
|
+
_render;
|
|
418
|
+
_track = !1;
|
|
419
|
+
_prevFrame = "";
|
|
420
|
+
_subscribers = /* @__PURE__ */ new Map();
|
|
421
|
+
_cursor = 0;
|
|
422
|
+
state = "initial";
|
|
423
|
+
error = "";
|
|
424
|
+
value;
|
|
425
|
+
userInput = "";
|
|
426
|
+
constructor(e, s = !0) {
|
|
427
|
+
const { input: i = stdin, output: r = stdout, render: n, signal: u$1, ...a } = e;
|
|
428
|
+
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 = s, this._abortSignal = u$1, this.input = i, this.output = r;
|
|
429
|
+
}
|
|
430
|
+
unsubscribe() {
|
|
431
|
+
this._subscribers.clear();
|
|
432
|
+
}
|
|
433
|
+
setSubscriber(e, s) {
|
|
434
|
+
const i = this._subscribers.get(e) ?? [];
|
|
435
|
+
i.push(s), this._subscribers.set(e, i);
|
|
436
|
+
}
|
|
437
|
+
on(e, s) {
|
|
438
|
+
this.setSubscriber(e, { cb: s });
|
|
439
|
+
}
|
|
440
|
+
once(e, s) {
|
|
441
|
+
this.setSubscriber(e, {
|
|
442
|
+
cb: s,
|
|
443
|
+
once: !0
|
|
444
|
+
});
|
|
445
|
+
}
|
|
446
|
+
emit(e, ...s) {
|
|
447
|
+
const i = this._subscribers.get(e) ?? [], r = [];
|
|
448
|
+
for (const n of i) n.cb(...s), n.once && r.push(() => i.splice(i.indexOf(n), 1));
|
|
449
|
+
for (const n of r) n();
|
|
450
|
+
}
|
|
451
|
+
prompt() {
|
|
452
|
+
return new Promise((e) => {
|
|
453
|
+
if (this._abortSignal) {
|
|
454
|
+
if (this._abortSignal.aborted) return this.state = "cancel", this.close(), e(z$2);
|
|
455
|
+
this._abortSignal.addEventListener("abort", () => {
|
|
456
|
+
this.state = "cancel", this.close();
|
|
457
|
+
}, { once: !0 });
|
|
458
|
+
}
|
|
459
|
+
this.rl = c.createInterface({
|
|
460
|
+
input: this.input,
|
|
461
|
+
tabSize: 2,
|
|
462
|
+
prompt: "",
|
|
463
|
+
escapeCodeTimeout: 50,
|
|
464
|
+
terminal: !0
|
|
465
|
+
}), this.rl.prompt(), this.opts.initialUserInput !== void 0 && this._setUserInput(this.opts.initialUserInput, !0), this.input.on("keypress", this.onKeypress), T$1(this.input, !0), this.output.on("resize", this.render), this.render(), this.once("submit", () => {
|
|
466
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), T$1(this.input, !1), e(this.value);
|
|
467
|
+
}), this.once("cancel", () => {
|
|
468
|
+
this.output.write(import_src.cursor.show), this.output.off("resize", this.render), T$1(this.input, !1), e(z$2);
|
|
469
|
+
});
|
|
470
|
+
});
|
|
471
|
+
}
|
|
472
|
+
_isActionKey(e, s) {
|
|
473
|
+
return e === " ";
|
|
474
|
+
}
|
|
475
|
+
_setValue(e) {
|
|
476
|
+
this.value = e, this.emit("value", this.value);
|
|
477
|
+
}
|
|
478
|
+
_setUserInput(e, s) {
|
|
479
|
+
this.userInput = e ?? "", this.emit("userInput", this.userInput), s && this._track && this.rl && (this.rl.write(this.userInput), this._cursor = this.rl.cursor);
|
|
480
|
+
}
|
|
481
|
+
_clearUserInput() {
|
|
482
|
+
this.rl?.write(null, {
|
|
483
|
+
ctrl: !0,
|
|
484
|
+
name: "u"
|
|
485
|
+
}), this._setUserInput("");
|
|
486
|
+
}
|
|
487
|
+
onKeypress(e, s) {
|
|
488
|
+
if (this._track && s.name !== "return" && (s.name && this._isActionKey(e, s) && this.rl?.write(null, {
|
|
489
|
+
ctrl: !0,
|
|
490
|
+
name: "h"
|
|
491
|
+
}), this._cursor = this.rl?.cursor ?? 0, this._setUserInput(this.rl?.line)), this.state === "error" && (this.state = "active"), s?.name && (!this._track && _$1.aliases.has(s.name) && this.emit("cursor", _$1.aliases.get(s.name)), _$1.actions.has(s.name) && this.emit("cursor", s.name)), e && (e.toLowerCase() === "y" || e.toLowerCase() === "n") && this.emit("confirm", e.toLowerCase() === "y"), this.emit("key", e?.toLowerCase(), s), s?.name === "return") {
|
|
492
|
+
if (this.opts.validate) {
|
|
493
|
+
const i = this.opts.validate(this.value);
|
|
494
|
+
i && (this.error = i instanceof Error ? i.message : i, this.state = "error", this.rl?.write(this.userInput));
|
|
495
|
+
}
|
|
496
|
+
this.state !== "error" && (this.state = "submit");
|
|
497
|
+
}
|
|
498
|
+
H$2([
|
|
499
|
+
e,
|
|
500
|
+
s?.name,
|
|
501
|
+
s?.sequence
|
|
502
|
+
], "cancel") && (this.state = "cancel"), (this.state === "submit" || this.state === "cancel") && this.emit("finalize"), this.render(), (this.state === "submit" || this.state === "cancel") && this.close();
|
|
503
|
+
}
|
|
504
|
+
close() {
|
|
505
|
+
this.input.unpipe(), this.input.removeListener("keypress", this.onKeypress), this.output.write(`
|
|
506
|
+
`), T$1(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
58
507
|
}
|
|
508
|
+
restoreCursor() {
|
|
509
|
+
const e = K$2(this._prevFrame, process.stdout.columns, {
|
|
510
|
+
hard: !0,
|
|
511
|
+
trim: !1
|
|
512
|
+
}).split(`
|
|
513
|
+
`).length - 1;
|
|
514
|
+
this.output.write(import_src.cursor.move(-999, e * -1));
|
|
515
|
+
}
|
|
516
|
+
render() {
|
|
517
|
+
const e = K$2(this._render(this) ?? "", process.stdout.columns, {
|
|
518
|
+
hard: !0,
|
|
519
|
+
trim: !1
|
|
520
|
+
});
|
|
521
|
+
if (e !== this._prevFrame) {
|
|
522
|
+
if (this.state === "initial") this.output.write(import_src.cursor.hide);
|
|
523
|
+
else {
|
|
524
|
+
const s = _t$1(this._prevFrame, e), i = nt(this.output);
|
|
525
|
+
if (this.restoreCursor(), s) {
|
|
526
|
+
const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
|
|
527
|
+
let u$1 = s.lines.find((a) => a >= r);
|
|
528
|
+
if (u$1 === void 0) {
|
|
529
|
+
this._prevFrame = e;
|
|
530
|
+
return;
|
|
531
|
+
}
|
|
532
|
+
if (s.lines.length === 1) {
|
|
533
|
+
this.output.write(import_src.cursor.move(0, u$1 - n)), this.output.write(import_src.erase.lines(1));
|
|
534
|
+
const a = e.split(`
|
|
535
|
+
`);
|
|
536
|
+
this.output.write(a[u$1]), this._prevFrame = e, this.output.write(import_src.cursor.move(0, a.length - u$1 - 1));
|
|
537
|
+
return;
|
|
538
|
+
} else if (s.lines.length > 1) {
|
|
539
|
+
if (r < n) u$1 = r;
|
|
540
|
+
else {
|
|
541
|
+
const l$1 = u$1 - n;
|
|
542
|
+
l$1 > 0 && this.output.write(import_src.cursor.move(0, l$1));
|
|
543
|
+
}
|
|
544
|
+
this.output.write(import_src.erase.down());
|
|
545
|
+
const a = e.split(`
|
|
546
|
+
`).slice(u$1);
|
|
547
|
+
this.output.write(a.join(`
|
|
548
|
+
`)), this._prevFrame = e;
|
|
549
|
+
return;
|
|
550
|
+
}
|
|
551
|
+
}
|
|
552
|
+
this.output.write(import_src.erase.down());
|
|
553
|
+
}
|
|
554
|
+
this.output.write(e), this.state === "initial" && (this.state = "active"), this._prevFrame = e;
|
|
555
|
+
}
|
|
556
|
+
}
|
|
557
|
+
};
|
|
558
|
+
function wt$1(t$1, e) {
|
|
559
|
+
if (t$1 === void 0 || e.length === 0) return 0;
|
|
560
|
+
const s = e.findIndex((i) => i.value === t$1);
|
|
561
|
+
return s !== -1 ? s : 0;
|
|
59
562
|
}
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
return await handlePackageManager(filepath, options);
|
|
563
|
+
function Dt$1(t$1, e) {
|
|
564
|
+
return (e.label ?? String(e.value)).toLowerCase().includes(t$1.toLowerCase());
|
|
63
565
|
}
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
566
|
+
function St$1(t$1, e) {
|
|
567
|
+
if (e) return t$1 ? e : e[0];
|
|
568
|
+
}
|
|
569
|
+
var Vt$1 = class extends x$2 {
|
|
570
|
+
filteredOptions;
|
|
571
|
+
multiple;
|
|
572
|
+
isNavigating = !1;
|
|
573
|
+
selectedValues = [];
|
|
574
|
+
focusedValue;
|
|
575
|
+
#t = 0;
|
|
576
|
+
#s = "";
|
|
577
|
+
#i;
|
|
578
|
+
#e;
|
|
579
|
+
get cursor() {
|
|
580
|
+
return this.#t;
|
|
581
|
+
}
|
|
582
|
+
get userInputWithCursor() {
|
|
583
|
+
if (!this.userInput) return import_picocolors.default.inverse(import_picocolors.default.hidden("_"));
|
|
584
|
+
if (this._cursor >= this.userInput.length) return `${this.userInput}\u2588`;
|
|
585
|
+
const e = this.userInput.slice(0, this._cursor), [s, ...i] = this.userInput.slice(this._cursor);
|
|
586
|
+
return `${e}${import_picocolors.default.inverse(s)}${i.join("")}`;
|
|
587
|
+
}
|
|
588
|
+
get options() {
|
|
589
|
+
return typeof this.#e == "function" ? this.#e() : this.#e;
|
|
590
|
+
}
|
|
591
|
+
constructor(e) {
|
|
592
|
+
super(e), this.#e = e.options;
|
|
593
|
+
const s = this.options;
|
|
594
|
+
this.filteredOptions = [...s], this.multiple = e.multiple === !0, this.#i = e.filter ?? Dt$1;
|
|
595
|
+
let i;
|
|
596
|
+
if (e.initialValue && Array.isArray(e.initialValue) ? this.multiple ? i = e.initialValue : i = e.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (i = [this.options[0].value]), i) for (const r of i) {
|
|
597
|
+
const n = s.findIndex((u$1) => u$1.value === r);
|
|
598
|
+
n !== -1 && (this.toggleSelected(r), this.#t = n);
|
|
599
|
+
}
|
|
600
|
+
this.focusedValue = this.options[this.#t]?.value, this.on("key", (r, n) => this.#r(r, n)), this.on("userInput", (r) => this.#n(r));
|
|
601
|
+
}
|
|
602
|
+
_isActionKey(e, s) {
|
|
603
|
+
return e === " " || this.multiple && this.isNavigating && s.name === "space" && e !== void 0 && e !== "";
|
|
604
|
+
}
|
|
605
|
+
#r(e, s) {
|
|
606
|
+
const i = s.name === "up", r = s.name === "down", n = s.name === "return";
|
|
607
|
+
i || r ? (this.#t = Math.max(0, Math.min(this.#t + (i ? -1 : 1), this.filteredOptions.length - 1)), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.selectedValues = [this.focusedValue]), this.isNavigating = !0) : n ? this.value = St$1(this.multiple, this.selectedValues) : this.multiple ? this.focusedValue !== void 0 && (s.name === "tab" || this.isNavigating && s.name === "space") ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [this.focusedValue]), this.isNavigating = !1);
|
|
608
|
+
}
|
|
609
|
+
deselectAll() {
|
|
610
|
+
this.selectedValues = [];
|
|
611
|
+
}
|
|
612
|
+
toggleSelected(e) {
|
|
613
|
+
this.filteredOptions.length !== 0 && (this.multiple ? this.selectedValues.includes(e) ? this.selectedValues = this.selectedValues.filter((s) => s !== e) : this.selectedValues = [...this.selectedValues, e] : this.selectedValues = [e]);
|
|
614
|
+
}
|
|
615
|
+
#n(e) {
|
|
616
|
+
if (e !== this.#s) {
|
|
617
|
+
this.#s = e;
|
|
618
|
+
const s = this.options;
|
|
619
|
+
e ? this.filteredOptions = s.filter((i) => this.#i(e, i)) : this.filteredOptions = [...s], this.#t = wt$1(this.focusedValue, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#t]?.value, this.multiple || (this.focusedValue !== void 0 ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
620
|
+
}
|
|
621
|
+
}
|
|
622
|
+
};
|
|
623
|
+
var kt$1 = class extends x$2 {
|
|
624
|
+
get cursor() {
|
|
625
|
+
return this.value ? 0 : 1;
|
|
626
|
+
}
|
|
627
|
+
get _value() {
|
|
628
|
+
return this.cursor === 0;
|
|
629
|
+
}
|
|
630
|
+
constructor(e) {
|
|
631
|
+
super(e, !1), this.value = !!e.initialValue, this.on("userInput", () => {
|
|
632
|
+
this.value = this._value;
|
|
633
|
+
}), this.on("confirm", (s) => {
|
|
634
|
+
this.output.write(import_src.cursor.move(0, -1)), this.value = s, this.state = "submit", this.close();
|
|
635
|
+
}), this.on("cursor", () => {
|
|
636
|
+
this.value = !this.value;
|
|
637
|
+
});
|
|
638
|
+
}
|
|
639
|
+
};
|
|
640
|
+
var yt$1 = class extends x$2 {
|
|
641
|
+
options;
|
|
642
|
+
cursor = 0;
|
|
643
|
+
#t;
|
|
644
|
+
getGroupItems(e) {
|
|
645
|
+
return this.options.filter((s) => s.group === e);
|
|
646
|
+
}
|
|
647
|
+
isGroupSelected(e) {
|
|
648
|
+
const s = this.getGroupItems(e), i = this.value;
|
|
649
|
+
return i === void 0 ? !1 : s.every((r) => i.includes(r.value));
|
|
650
|
+
}
|
|
651
|
+
toggleValue() {
|
|
652
|
+
const e = this.options[this.cursor];
|
|
653
|
+
if (this.value === void 0 && (this.value = []), e.group === !0) {
|
|
654
|
+
const s = e.value, i = this.getGroupItems(s);
|
|
655
|
+
this.isGroupSelected(s) ? this.value = this.value.filter((r) => i.findIndex((n) => n.value === r) === -1) : this.value = [...this.value, ...i.map((r) => r.value)], this.value = Array.from(new Set(this.value));
|
|
656
|
+
} else this.value = this.value.includes(e.value) ? this.value.filter((i) => i !== e.value) : [...this.value, e.value];
|
|
657
|
+
}
|
|
658
|
+
constructor(e) {
|
|
659
|
+
super(e, !1);
|
|
660
|
+
const { options: s } = e;
|
|
661
|
+
this.#t = e.selectableGroups !== !1, this.options = Object.entries(s).flatMap(([i, r]) => [{
|
|
662
|
+
value: i,
|
|
663
|
+
group: !0,
|
|
664
|
+
label: i
|
|
665
|
+
}, ...r.map((n) => ({
|
|
666
|
+
...n,
|
|
667
|
+
group: i
|
|
668
|
+
}))]), this.value = [...e.initialValues ?? []], this.cursor = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), this.#t ? 0 : 1), this.on("cursor", (i) => {
|
|
669
|
+
switch (i) {
|
|
670
|
+
case "left":
|
|
671
|
+
case "up": {
|
|
672
|
+
this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1;
|
|
673
|
+
const r = this.options[this.cursor]?.group === !0;
|
|
674
|
+
!this.#t && r && (this.cursor = this.cursor === 0 ? this.options.length - 1 : this.cursor - 1);
|
|
675
|
+
break;
|
|
676
|
+
}
|
|
677
|
+
case "down":
|
|
678
|
+
case "right": {
|
|
679
|
+
this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1;
|
|
680
|
+
const r = this.options[this.cursor]?.group === !0;
|
|
681
|
+
!this.#t && r && (this.cursor = this.cursor === this.options.length - 1 ? 0 : this.cursor + 1);
|
|
682
|
+
break;
|
|
683
|
+
}
|
|
684
|
+
case "space":
|
|
685
|
+
this.toggleValue();
|
|
686
|
+
break;
|
|
687
|
+
}
|
|
688
|
+
});
|
|
689
|
+
}
|
|
690
|
+
};
|
|
691
|
+
function D$1(t$1, e, s) {
|
|
692
|
+
const i = t$1 + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
693
|
+
return s[n].disabled ? D$1(n, e < 0 ? -1 : 1, s) : n;
|
|
694
|
+
}
|
|
695
|
+
var Mt$1 = class extends x$2 {
|
|
696
|
+
options;
|
|
697
|
+
cursor = 0;
|
|
698
|
+
get _value() {
|
|
699
|
+
return this.options[this.cursor].value;
|
|
700
|
+
}
|
|
701
|
+
get _enabledOptions() {
|
|
702
|
+
return this.options.filter((e) => e.disabled !== !0);
|
|
703
|
+
}
|
|
704
|
+
toggleAll() {
|
|
705
|
+
const e = this._enabledOptions;
|
|
706
|
+
this.value = this.value !== void 0 && this.value.length === e.length ? [] : e.map((i) => i.value);
|
|
707
|
+
}
|
|
708
|
+
toggleInvert() {
|
|
709
|
+
const e = this.value;
|
|
710
|
+
if (!e) return;
|
|
711
|
+
this.value = this._enabledOptions.filter((i) => !e.includes(i.value)).map((i) => i.value);
|
|
712
|
+
}
|
|
713
|
+
toggleValue() {
|
|
714
|
+
this.value === void 0 && (this.value = []);
|
|
715
|
+
this.value = this.value.includes(this._value) ? this.value.filter((s) => s !== this._value) : [...this.value, this._value];
|
|
716
|
+
}
|
|
717
|
+
constructor(e) {
|
|
718
|
+
super(e, !1), this.options = e.options, this.value = [...e.initialValues ?? []];
|
|
719
|
+
const s = Math.max(this.options.findIndex(({ value: i }) => i === e.cursorAt), 0);
|
|
720
|
+
this.cursor = this.options[s].disabled ? D$1(s, 1, this.options) : s, this.on("key", (i) => {
|
|
721
|
+
i === "a" && this.toggleAll(), i === "i" && this.toggleInvert();
|
|
722
|
+
}), this.on("cursor", (i) => {
|
|
723
|
+
switch (i) {
|
|
724
|
+
case "left":
|
|
725
|
+
case "up":
|
|
726
|
+
this.cursor = D$1(this.cursor, -1, this.options);
|
|
727
|
+
break;
|
|
728
|
+
case "down":
|
|
729
|
+
case "right":
|
|
730
|
+
this.cursor = D$1(this.cursor, 1, this.options);
|
|
731
|
+
break;
|
|
732
|
+
case "space":
|
|
733
|
+
this.toggleValue();
|
|
734
|
+
break;
|
|
735
|
+
}
|
|
736
|
+
});
|
|
737
|
+
}
|
|
738
|
+
};
|
|
739
|
+
let Lt$1 = class extends x$2 {
|
|
740
|
+
_mask = "•";
|
|
741
|
+
get cursor() {
|
|
742
|
+
return this._cursor;
|
|
743
|
+
}
|
|
744
|
+
get masked() {
|
|
745
|
+
return this.userInput.replaceAll(/./g, this._mask);
|
|
746
|
+
}
|
|
747
|
+
get userInputWithCursor() {
|
|
748
|
+
if (this.state === "submit" || this.state === "cancel") return this.masked;
|
|
749
|
+
const e = this.userInput;
|
|
750
|
+
if (this.cursor >= e.length) return `${this.masked}${import_picocolors.default.inverse(import_picocolors.default.hidden("_"))}`;
|
|
751
|
+
const s = this.masked, i = s.slice(0, this.cursor), r = s.slice(this.cursor);
|
|
752
|
+
return `${i}${import_picocolors.default.inverse(r[0])}${r.slice(1)}`;
|
|
753
|
+
}
|
|
754
|
+
clear() {
|
|
755
|
+
this._clearUserInput();
|
|
756
|
+
}
|
|
757
|
+
constructor({ mask: e, ...s }) {
|
|
758
|
+
super(s), this._mask = e ?? "•", this.on("userInput", (i) => {
|
|
759
|
+
this._setValue(i);
|
|
760
|
+
});
|
|
761
|
+
}
|
|
762
|
+
};
|
|
763
|
+
var Wt$1 = class extends x$2 {
|
|
764
|
+
options;
|
|
765
|
+
cursor = 0;
|
|
766
|
+
get _selectedValue() {
|
|
767
|
+
return this.options[this.cursor];
|
|
768
|
+
}
|
|
769
|
+
changeValue() {
|
|
770
|
+
this.value = this._selectedValue.value;
|
|
771
|
+
}
|
|
772
|
+
constructor(e) {
|
|
773
|
+
super(e, !1), this.options = e.options;
|
|
774
|
+
const s = this.options.findIndex(({ value: r }) => r === e.initialValue), i = s === -1 ? 0 : s;
|
|
775
|
+
this.cursor = this.options[i].disabled ? D$1(i, 1, this.options) : i, this.changeValue(), this.on("cursor", (r) => {
|
|
776
|
+
switch (r) {
|
|
777
|
+
case "left":
|
|
778
|
+
case "up":
|
|
779
|
+
this.cursor = D$1(this.cursor, -1, this.options);
|
|
780
|
+
break;
|
|
781
|
+
case "down":
|
|
782
|
+
case "right":
|
|
783
|
+
this.cursor = D$1(this.cursor, 1, this.options);
|
|
784
|
+
break;
|
|
785
|
+
}
|
|
786
|
+
this.changeValue();
|
|
787
|
+
});
|
|
788
|
+
}
|
|
789
|
+
};
|
|
790
|
+
var Tt$1 = class extends x$2 {
|
|
791
|
+
options;
|
|
792
|
+
cursor = 0;
|
|
793
|
+
constructor(e) {
|
|
794
|
+
super(e, !1), this.options = e.options;
|
|
795
|
+
const s = e.caseSensitive === !0, i = this.options.map(({ value: [r] }) => s ? r : r?.toLowerCase());
|
|
796
|
+
this.cursor = Math.max(i.indexOf(e.initialValue), 0), this.on("key", (r, n) => {
|
|
797
|
+
if (!r) return;
|
|
798
|
+
const u$1 = s && n.shift ? r.toUpperCase() : r;
|
|
799
|
+
if (!i.includes(u$1)) return;
|
|
800
|
+
const a = this.options.find(({ value: [l$1] }) => s ? l$1 === u$1 : l$1?.toLowerCase() === r);
|
|
801
|
+
a && (this.value = a.value, this.state = "submit", this.emit("submit"));
|
|
802
|
+
});
|
|
803
|
+
}
|
|
804
|
+
};
|
|
805
|
+
var $t = class extends x$2 {
|
|
806
|
+
get userInputWithCursor() {
|
|
807
|
+
if (this.state === "submit") return this.userInput;
|
|
808
|
+
const e = this.userInput;
|
|
809
|
+
if (this.cursor >= e.length) return `${this.userInput}\u2588`;
|
|
810
|
+
const s = e.slice(0, this.cursor), [i, ...r] = e.slice(this.cursor);
|
|
811
|
+
return `${s}${import_picocolors.default.inverse(i)}${r.join("")}`;
|
|
812
|
+
}
|
|
813
|
+
get cursor() {
|
|
814
|
+
return this._cursor;
|
|
815
|
+
}
|
|
816
|
+
constructor(e) {
|
|
817
|
+
super({
|
|
818
|
+
...e,
|
|
819
|
+
initialUserInput: e.initialUserInput ?? e.initialValue
|
|
820
|
+
}), this.on("userInput", (s) => {
|
|
821
|
+
this._setValue(s);
|
|
822
|
+
}), this.on("finalize", () => {
|
|
823
|
+
this.value || (this.value = e.defaultValue), this.value === void 0 && (this.value = "");
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
};
|
|
827
|
+
|
|
828
|
+
//#endregion
|
|
829
|
+
//#region ../../node_modules/.pnpm/@clack+prompts@1.0.0/node_modules/@clack/prompts/dist/index.mjs
|
|
830
|
+
function ht() {
|
|
831
|
+
return process$1.platform !== "win32" ? process$1.env.TERM !== "linux" : !!process$1.env.CI || !!process$1.env.WT_SESSION || !!process$1.env.TERMINUS_SUBLIME || process$1.env.ConEmuTask === "{cmd::Cmder}" || process$1.env.TERM_PROGRAM === "Terminus-Sublime" || process$1.env.TERM_PROGRAM === "vscode" || process$1.env.TERM === "xterm-256color" || process$1.env.TERM === "alacritty" || process$1.env.TERMINAL_EMULATOR === "JetBrains-JediTerm";
|
|
832
|
+
}
|
|
833
|
+
const ee = ht(), ue = () => process.env.CI === "true", Te = (e) => e.isTTY === !0, w$1 = (e, r) => ee ? e : r, Me = w$1("◆", "*"), ce = w$1("■", "x"), de = w$1("▲", "x"), k$1 = w$1("◇", "o"), $e = w$1("┌", "T"), h$1 = w$1("│", "|"), x$1 = w$1("└", "—"), Re = w$1("┐", "T"), Oe = w$1("┘", "—"), Y = w$1("●", ">"), K$1 = w$1("○", " "), te = w$1("◻", "[•]"), G$1 = w$1("◼", "[+]"), z$1 = w$1("◻", "[ ]"), Pe = w$1("▪", "•"), se = w$1("─", "-"), he = w$1("╮", "+"), Ne = w$1("├", "+"), me = w$1("╯", "+"), pe = w$1("╰", "+"), We = w$1("╭", "+"), ge = w$1("●", "•"), fe = w$1("◆", "*"), Fe = w$1("▲", "!"), ye = w$1("■", "x"), N$1 = (e) => {
|
|
834
|
+
switch (e) {
|
|
835
|
+
case "initial":
|
|
836
|
+
case "active": return import_picocolors.default.cyan(Me);
|
|
837
|
+
case "cancel": return import_picocolors.default.red(ce);
|
|
838
|
+
case "error": return import_picocolors.default.yellow(de);
|
|
839
|
+
case "submit": return import_picocolors.default.green(k$1);
|
|
840
|
+
}
|
|
841
|
+
}, Ee = (e) => {
|
|
842
|
+
switch (e) {
|
|
843
|
+
case "initial":
|
|
844
|
+
case "active": return import_picocolors.default.cyan(h$1);
|
|
845
|
+
case "cancel": return import_picocolors.default.red(h$1);
|
|
846
|
+
case "error": return import_picocolors.default.yellow(h$1);
|
|
847
|
+
case "submit": return import_picocolors.default.green(h$1);
|
|
848
|
+
}
|
|
849
|
+
}, mt = (e) => e === 161 || e === 164 || e === 167 || e === 168 || e === 170 || e === 173 || e === 174 || e >= 176 && e <= 180 || e >= 182 && e <= 186 || e >= 188 && e <= 191 || e === 198 || e === 208 || e === 215 || e === 216 || e >= 222 && e <= 225 || e === 230 || e >= 232 && e <= 234 || e === 236 || e === 237 || e === 240 || e === 242 || e === 243 || e >= 247 && e <= 250 || e === 252 || e === 254 || e === 257 || e === 273 || e === 275 || e === 283 || e === 294 || e === 295 || e === 299 || e >= 305 && e <= 307 || e === 312 || e >= 319 && e <= 322 || e === 324 || e >= 328 && e <= 331 || e === 333 || e === 338 || e === 339 || e === 358 || e === 359 || e === 363 || e === 462 || e === 464 || e === 466 || e === 468 || e === 470 || e === 472 || e === 474 || e === 476 || e === 593 || e === 609 || e === 708 || e === 711 || e >= 713 && e <= 715 || e === 717 || e === 720 || e >= 728 && e <= 731 || e === 733 || e === 735 || e >= 768 && e <= 879 || e >= 913 && e <= 929 || e >= 931 && e <= 937 || e >= 945 && e <= 961 || e >= 963 && e <= 969 || e === 1025 || e >= 1040 && e <= 1103 || e === 1105 || e === 8208 || e >= 8211 && e <= 8214 || e === 8216 || e === 8217 || e === 8220 || e === 8221 || e >= 8224 && e <= 8226 || e >= 8228 && e <= 8231 || e === 8240 || e === 8242 || e === 8243 || e === 8245 || e === 8251 || e === 8254 || e === 8308 || e === 8319 || e >= 8321 && e <= 8324 || e === 8364 || e === 8451 || e === 8453 || e === 8457 || e === 8467 || e === 8470 || e === 8481 || e === 8482 || e === 8486 || e === 8491 || e === 8531 || e === 8532 || e >= 8539 && e <= 8542 || e >= 8544 && e <= 8555 || e >= 8560 && e <= 8569 || e === 8585 || e >= 8592 && e <= 8601 || e === 8632 || e === 8633 || e === 8658 || e === 8660 || e === 8679 || e === 8704 || e === 8706 || e === 8707 || e === 8711 || e === 8712 || e === 8715 || e === 8719 || e === 8721 || e === 8725 || e === 8730 || e >= 8733 && e <= 8736 || e === 8739 || e === 8741 || e >= 8743 && e <= 8748 || e === 8750 || e >= 8756 && e <= 8759 || e === 8764 || e === 8765 || e === 8776 || e === 8780 || e === 8786 || e === 8800 || e === 8801 || e >= 8804 && e <= 8807 || e === 8810 || e === 8811 || e === 8814 || e === 8815 || e === 8834 || e === 8835 || e === 8838 || e === 8839 || e === 8853 || e === 8857 || e === 8869 || e === 8895 || e === 8978 || e >= 9312 && e <= 9449 || e >= 9451 && e <= 9547 || e >= 9552 && e <= 9587 || e >= 9600 && e <= 9615 || e >= 9618 && e <= 9621 || e === 9632 || e === 9633 || e >= 9635 && e <= 9641 || e === 9650 || e === 9651 || e === 9654 || e === 9655 || e === 9660 || e === 9661 || e === 9664 || e === 9665 || e >= 9670 && e <= 9672 || e === 9675 || e >= 9678 && e <= 9681 || e >= 9698 && e <= 9701 || e === 9711 || e === 9733 || e === 9734 || e === 9737 || e === 9742 || e === 9743 || e === 9756 || e === 9758 || e === 9792 || e === 9794 || e === 9824 || e === 9825 || e >= 9827 && e <= 9829 || e >= 9831 && e <= 9834 || e === 9836 || e === 9837 || e === 9839 || e === 9886 || e === 9887 || e === 9919 || e >= 9926 && e <= 9933 || e >= 9935 && e <= 9939 || e >= 9941 && e <= 9953 || e === 9955 || e === 9960 || e === 9961 || e >= 9963 && e <= 9969 || e === 9972 || e >= 9974 && e <= 9977 || e === 9979 || e === 9980 || e === 9982 || e === 9983 || e === 10045 || e >= 10102 && e <= 10111 || e >= 11094 && e <= 11097 || e >= 12872 && e <= 12879 || e >= 57344 && e <= 63743 || e >= 65024 && e <= 65039 || e === 65533 || e >= 127232 && e <= 127242 || e >= 127248 && e <= 127277 || e >= 127280 && e <= 127337 || e >= 127344 && e <= 127373 || e === 127375 || e === 127376 || e >= 127387 && e <= 127404 || e >= 917760 && e <= 917999 || e >= 983040 && e <= 1048573 || e >= 1048576 && e <= 1114109, pt = (e) => e === 12288 || e >= 65281 && e <= 65376 || e >= 65504 && e <= 65510, gt = (e) => e >= 4352 && e <= 4447 || e === 8986 || e === 8987 || e === 9001 || e === 9002 || e >= 9193 && e <= 9196 || e === 9200 || e === 9203 || e === 9725 || e === 9726 || e === 9748 || e === 9749 || e >= 9800 && e <= 9811 || e === 9855 || e === 9875 || e === 9889 || e === 9898 || e === 9899 || e === 9917 || e === 9918 || e === 9924 || e === 9925 || e === 9934 || e === 9940 || e === 9962 || e === 9970 || e === 9971 || e === 9973 || e === 9978 || e === 9981 || e === 9989 || e === 9994 || e === 9995 || e === 10024 || e === 10060 || e === 10062 || e >= 10067 && e <= 10069 || e === 10071 || e >= 10133 && e <= 10135 || e === 10160 || e === 10175 || e === 11035 || e === 11036 || e === 11088 || e === 11093 || e >= 11904 && e <= 11929 || e >= 11931 && e <= 12019 || e >= 12032 && e <= 12245 || e >= 12272 && e <= 12287 || e >= 12289 && e <= 12350 || e >= 12353 && e <= 12438 || e >= 12441 && e <= 12543 || e >= 12549 && e <= 12591 || e >= 12593 && e <= 12686 || e >= 12688 && e <= 12771 || e >= 12783 && e <= 12830 || e >= 12832 && e <= 12871 || e >= 12880 && e <= 19903 || e >= 19968 && e <= 42124 || e >= 42128 && e <= 42182 || e >= 43360 && e <= 43388 || e >= 44032 && e <= 55203 || e >= 63744 && e <= 64255 || e >= 65040 && e <= 65049 || e >= 65072 && e <= 65106 || e >= 65108 && e <= 65126 || e >= 65128 && e <= 65131 || e >= 94176 && e <= 94180 || e === 94192 || e === 94193 || e >= 94208 && e <= 100343 || e >= 100352 && e <= 101589 || e >= 101632 && e <= 101640 || e >= 110576 && e <= 110579 || e >= 110581 && e <= 110587 || e === 110589 || e === 110590 || e >= 110592 && e <= 110882 || e === 110898 || e >= 110928 && e <= 110930 || e === 110933 || e >= 110948 && e <= 110951 || e >= 110960 && e <= 111355 || e === 126980 || e === 127183 || e === 127374 || e >= 127377 && e <= 127386 || e >= 127488 && e <= 127490 || e >= 127504 && e <= 127547 || e >= 127552 && e <= 127560 || e === 127568 || e === 127569 || e >= 127584 && e <= 127589 || e >= 127744 && e <= 127776 || e >= 127789 && e <= 127797 || e >= 127799 && e <= 127868 || e >= 127870 && e <= 127891 || e >= 127904 && e <= 127946 || e >= 127951 && e <= 127955 || e >= 127968 && e <= 127984 || e === 127988 || e >= 127992 && e <= 128062 || e === 128064 || e >= 128066 && e <= 128252 || e >= 128255 && e <= 128317 || e >= 128331 && e <= 128334 || e >= 128336 && e <= 128359 || e === 128378 || e === 128405 || e === 128406 || e === 128420 || e >= 128507 && e <= 128591 || e >= 128640 && e <= 128709 || e === 128716 || e >= 128720 && e <= 128722 || e >= 128725 && e <= 128727 || e >= 128732 && e <= 128735 || e === 128747 || e === 128748 || e >= 128756 && e <= 128764 || e >= 128992 && e <= 129003 || e === 129008 || e >= 129292 && e <= 129338 || e >= 129340 && e <= 129349 || e >= 129351 && e <= 129535 || e >= 129648 && e <= 129660 || e >= 129664 && e <= 129672 || e >= 129680 && e <= 129725 || e >= 129727 && e <= 129733 || e >= 129742 && e <= 129755 || e >= 129760 && e <= 129768 || e >= 129776 && e <= 129784 || e >= 131072 && e <= 196605 || e >= 196608 && e <= 262141, ve = /[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]/y, re = /[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y, ie = /\t{1,1000}/y, Ae = /[\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?))*/uy, ne = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ft = /\p{M}+/gu, Ft = {
|
|
850
|
+
limit: Infinity,
|
|
851
|
+
ellipsis: ""
|
|
852
|
+
}, Le = (e, r = {}, s = {}) => {
|
|
853
|
+
const i = r.limit ?? Infinity, n = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (n ? Le(n, Ft, s).width : 0), u$1 = s.ansiWidth ?? 0, l$1 = s.controlWidth ?? 0, a = s.tabWidth ?? 8, d$1 = s.ambiguousWidth ?? 1, g$1 = s.emojiWidth ?? 2, E$1 = s.fullWidthWidth ?? 2, p$1 = s.regularWidth ?? 1, y$2 = s.wideWidth ?? 2;
|
|
854
|
+
let $ = 0, c$1 = 0, m$1 = e.length, f$1 = 0, F$1 = !1, v$1 = m$1, S$2 = Math.max(0, i - o), B$1 = 0, b$1 = 0, A$1 = 0, C$1 = 0;
|
|
855
|
+
e: for (;;) {
|
|
856
|
+
if (b$1 > B$1 || c$1 >= m$1 && c$1 > $) {
|
|
857
|
+
const _$2 = e.slice(B$1, b$1) || e.slice($, c$1);
|
|
858
|
+
f$1 = 0;
|
|
859
|
+
for (const D$2 of _$2.replaceAll(ft, "")) {
|
|
860
|
+
const T$2 = D$2.codePointAt(0) || 0;
|
|
861
|
+
if (pt(T$2) ? C$1 = E$1 : gt(T$2) ? C$1 = y$2 : d$1 !== p$1 && mt(T$2) ? C$1 = d$1 : C$1 = p$1, A$1 + C$1 > S$2 && (v$1 = Math.min(v$1, Math.max(B$1, $) + f$1)), A$1 + C$1 > i) {
|
|
862
|
+
F$1 = !0;
|
|
863
|
+
break e;
|
|
86
864
|
}
|
|
865
|
+
f$1 += D$2.length, A$1 += C$1;
|
|
866
|
+
}
|
|
867
|
+
B$1 = b$1 = 0;
|
|
868
|
+
}
|
|
869
|
+
if (c$1 >= m$1) break;
|
|
870
|
+
if (ne.lastIndex = c$1, ne.test(e)) {
|
|
871
|
+
if (f$1 = ne.lastIndex - c$1, C$1 = f$1 * p$1, A$1 + C$1 > S$2 && (v$1 = Math.min(v$1, c$1 + Math.floor((S$2 - A$1) / p$1))), A$1 + C$1 > i) {
|
|
872
|
+
F$1 = !0;
|
|
873
|
+
break;
|
|
874
|
+
}
|
|
875
|
+
A$1 += C$1, B$1 = $, b$1 = c$1, c$1 = $ = ne.lastIndex;
|
|
876
|
+
continue;
|
|
877
|
+
}
|
|
878
|
+
if (ve.lastIndex = c$1, ve.test(e)) {
|
|
879
|
+
if (A$1 + u$1 > S$2 && (v$1 = Math.min(v$1, c$1)), A$1 + u$1 > i) {
|
|
880
|
+
F$1 = !0;
|
|
87
881
|
break;
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
882
|
+
}
|
|
883
|
+
A$1 += u$1, B$1 = $, b$1 = c$1, c$1 = $ = ve.lastIndex;
|
|
884
|
+
continue;
|
|
885
|
+
}
|
|
886
|
+
if (re.lastIndex = c$1, re.test(e)) {
|
|
887
|
+
if (f$1 = re.lastIndex - c$1, C$1 = f$1 * l$1, A$1 + C$1 > S$2 && (v$1 = Math.min(v$1, c$1 + Math.floor((S$2 - A$1) / l$1))), A$1 + C$1 > i) {
|
|
888
|
+
F$1 = !0;
|
|
92
889
|
break;
|
|
93
890
|
}
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
name,
|
|
101
|
-
agent: name === "yarn" ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
}
|
|
891
|
+
A$1 += C$1, B$1 = $, b$1 = c$1, c$1 = $ = re.lastIndex;
|
|
892
|
+
continue;
|
|
893
|
+
}
|
|
894
|
+
if (ie.lastIndex = c$1, ie.test(e)) {
|
|
895
|
+
if (f$1 = ie.lastIndex - c$1, C$1 = f$1 * a, A$1 + C$1 > S$2 && (v$1 = Math.min(v$1, c$1 + Math.floor((S$2 - A$1) / a))), A$1 + C$1 > i) {
|
|
896
|
+
F$1 = !0;
|
|
105
897
|
break;
|
|
898
|
+
}
|
|
899
|
+
A$1 += C$1, B$1 = $, b$1 = c$1, c$1 = $ = ie.lastIndex;
|
|
900
|
+
continue;
|
|
901
|
+
}
|
|
902
|
+
if (Ae.lastIndex = c$1, Ae.test(e)) {
|
|
903
|
+
if (A$1 + g$1 > S$2 && (v$1 = Math.min(v$1, c$1)), A$1 + g$1 > i) {
|
|
904
|
+
F$1 = !0;
|
|
905
|
+
break;
|
|
906
|
+
}
|
|
907
|
+
A$1 += g$1, B$1 = $, b$1 = c$1, c$1 = $ = Ae.lastIndex;
|
|
908
|
+
continue;
|
|
909
|
+
}
|
|
910
|
+
c$1 += 1;
|
|
911
|
+
}
|
|
912
|
+
return {
|
|
913
|
+
width: F$1 ? S$2 : A$1,
|
|
914
|
+
index: F$1 ? v$1 : m$1,
|
|
915
|
+
truncated: F$1,
|
|
916
|
+
ellipsed: F$1 && i >= o
|
|
917
|
+
};
|
|
918
|
+
}, yt = {
|
|
919
|
+
limit: Infinity,
|
|
920
|
+
ellipsis: "",
|
|
921
|
+
ellipsisWidth: 0
|
|
922
|
+
}, M$1 = (e, r = {}) => Le(e, yt, r).width, ae = "\x1B", je = "", Et = 39, Ce = "\x07", Ve = "[", vt = "]", ke = "m", we = `${vt}8;;`, Ge = new RegExp(`(?:\\${Ve}(?<code>\\d+)m|\\${we}(?<uri>.*)${Ce})`, "y"), At = (e) => {
|
|
923
|
+
if (e >= 30 && e <= 37 || e >= 90 && e <= 97) return 39;
|
|
924
|
+
if (e >= 40 && e <= 47 || e >= 100 && e <= 107) return 49;
|
|
925
|
+
if (e === 1 || e === 2) return 22;
|
|
926
|
+
if (e === 3) return 23;
|
|
927
|
+
if (e === 4) return 24;
|
|
928
|
+
if (e === 7) return 27;
|
|
929
|
+
if (e === 8) return 28;
|
|
930
|
+
if (e === 9) return 29;
|
|
931
|
+
if (e === 0) return 0;
|
|
932
|
+
}, He = (e) => `${ae}${Ve}${e}${ke}`, Ue = (e) => `${ae}${we}${e}${Ce}`, Ct = (e) => e.map((r) => M$1(r)), Se = (e, r, s) => {
|
|
933
|
+
const i = r[Symbol.iterator]();
|
|
934
|
+
let n = !1, o = !1, u$1 = e.at(-1), l$1 = u$1 === void 0 ? 0 : M$1(u$1), a = i.next(), d$1 = i.next(), g$1 = 0;
|
|
935
|
+
for (; !a.done;) {
|
|
936
|
+
const E$1 = a.value, p$1 = M$1(E$1);
|
|
937
|
+
l$1 + p$1 <= s ? e[e.length - 1] += E$1 : (e.push(E$1), l$1 = 0), (E$1 === ae || E$1 === je) && (n = !0, o = r.startsWith(we, g$1 + 1)), n ? o ? E$1 === Ce && (n = !1, o = !1) : E$1 === ke && (n = !1) : (l$1 += p$1, l$1 === s && !d$1.done && (e.push(""), l$1 = 0)), a = d$1, d$1 = i.next(), g$1 += E$1.length;
|
|
938
|
+
}
|
|
939
|
+
u$1 = e.at(-1), !l$1 && u$1 !== void 0 && u$1.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
940
|
+
}, wt = (e) => {
|
|
941
|
+
const r = e.split(" ");
|
|
942
|
+
let s = r.length;
|
|
943
|
+
for (; s > 0 && !(M$1(r[s - 1]) > 0);) s--;
|
|
944
|
+
return s === r.length ? e : r.slice(0, s).join(" ") + r.slice(s).join("");
|
|
945
|
+
}, St = (e, r, s = {}) => {
|
|
946
|
+
if (s.trim !== !1 && e.trim() === "") return "";
|
|
947
|
+
let i = "", n, o;
|
|
948
|
+
const u$1 = e.split(" "), l$1 = Ct(u$1);
|
|
949
|
+
let a = [""];
|
|
950
|
+
for (const [$, c$1] of u$1.entries()) {
|
|
951
|
+
s.trim !== !1 && (a[a.length - 1] = (a.at(-1) ?? "").trimStart());
|
|
952
|
+
let m$1 = M$1(a.at(-1) ?? "");
|
|
953
|
+
if ($ !== 0 && (m$1 >= r && (s.wordWrap === !1 || s.trim === !1) && (a.push(""), m$1 = 0), (m$1 > 0 || s.trim === !1) && (a[a.length - 1] += " ", m$1++)), s.hard && l$1[$] > r) {
|
|
954
|
+
const f$1 = r - m$1, F$1 = 1 + Math.floor((l$1[$] - f$1 - 1) / r);
|
|
955
|
+
Math.floor((l$1[$] - 1) / r) < F$1 && a.push(""), Se(a, c$1, r);
|
|
956
|
+
continue;
|
|
957
|
+
}
|
|
958
|
+
if (m$1 + l$1[$] > r && m$1 > 0 && l$1[$] > 0) {
|
|
959
|
+
if (s.wordWrap === !1 && m$1 < r) {
|
|
960
|
+
Se(a, c$1, r);
|
|
961
|
+
continue;
|
|
962
|
+
}
|
|
963
|
+
a.push("");
|
|
964
|
+
}
|
|
965
|
+
if (m$1 + l$1[$] > r && s.wordWrap === !1) {
|
|
966
|
+
Se(a, c$1, r);
|
|
967
|
+
continue;
|
|
968
|
+
}
|
|
969
|
+
a[a.length - 1] += c$1;
|
|
970
|
+
}
|
|
971
|
+
s.trim !== !1 && (a = a.map(($) => wt($)));
|
|
972
|
+
const d$1 = a.join(`
|
|
973
|
+
`), g$1 = d$1[Symbol.iterator]();
|
|
974
|
+
let E$1 = g$1.next(), p$1 = g$1.next(), y$2 = 0;
|
|
975
|
+
for (; !E$1.done;) {
|
|
976
|
+
const $ = E$1.value, c$1 = p$1.value;
|
|
977
|
+
if (i += $, $ === ae || $ === je) {
|
|
978
|
+
Ge.lastIndex = y$2 + 1;
|
|
979
|
+
const F$1 = Ge.exec(d$1)?.groups;
|
|
980
|
+
if (F$1?.code !== void 0) {
|
|
981
|
+
const v$1 = Number.parseFloat(F$1.code);
|
|
982
|
+
n = v$1 === Et ? void 0 : v$1;
|
|
983
|
+
} else F$1?.uri !== void 0 && (o = F$1.uri.length === 0 ? void 0 : F$1.uri);
|
|
984
|
+
}
|
|
985
|
+
const m$1 = n ? At(n) : void 0;
|
|
986
|
+
c$1 === `
|
|
987
|
+
` ? (o && (i += Ue("")), n && m$1 && (i += He(m$1))) : $ === `
|
|
988
|
+
` && (n && m$1 && (i += He(n)), o && (i += Ue(o))), y$2 += $.length, E$1 = p$1, p$1 = g$1.next();
|
|
989
|
+
}
|
|
990
|
+
return i;
|
|
991
|
+
};
|
|
992
|
+
function q$1(e, r, s) {
|
|
993
|
+
return String(e).normalize().replaceAll(`\r
|
|
994
|
+
`, `
|
|
995
|
+
`).split(`
|
|
996
|
+
`).map((i) => St(i, r, s)).join(`
|
|
997
|
+
`);
|
|
998
|
+
}
|
|
999
|
+
const It = (e, r, s, i, n) => {
|
|
1000
|
+
let o = r, u$1 = 0;
|
|
1001
|
+
for (let l$1 = s; l$1 < i; l$1++) {
|
|
1002
|
+
const a = e[l$1];
|
|
1003
|
+
if (o = o - a.length, u$1++, o <= n) break;
|
|
1004
|
+
}
|
|
1005
|
+
return {
|
|
1006
|
+
lineCount: o,
|
|
1007
|
+
removals: u$1
|
|
1008
|
+
};
|
|
1009
|
+
}, J = (e) => {
|
|
1010
|
+
const { cursor: r, options: s, style: i } = e, n = e.output ?? process.stdout, o = rt(n), u$1 = e.columnPadding ?? 0, l$1 = e.rowPadding ?? 4, a = o - u$1, d$1 = nt(n), g$1 = import_picocolors.default.dim("..."), E$1 = e.maxItems ?? Number.POSITIVE_INFINITY, p$1 = Math.max(d$1 - l$1, 0), y$2 = Math.max(Math.min(E$1, p$1), 5);
|
|
1011
|
+
let $ = 0;
|
|
1012
|
+
r >= y$2 - 3 && ($ = Math.max(Math.min(r - y$2 + 3, s.length - y$2), 0));
|
|
1013
|
+
let c$1 = y$2 < s.length && $ > 0, m$1 = y$2 < s.length && $ + y$2 < s.length;
|
|
1014
|
+
const f$1 = Math.min($ + y$2, s.length), F$1 = [];
|
|
1015
|
+
let v$1 = 0;
|
|
1016
|
+
c$1 && v$1++, m$1 && v$1++;
|
|
1017
|
+
const S$2 = $ + (c$1 ? 1 : 0), B$1 = f$1 - (m$1 ? 1 : 0);
|
|
1018
|
+
for (let A$1 = S$2; A$1 < B$1; A$1++) {
|
|
1019
|
+
const C$1 = q$1(i(s[A$1], A$1 === r), a, {
|
|
1020
|
+
hard: !0,
|
|
1021
|
+
trim: !1
|
|
1022
|
+
}).split(`
|
|
1023
|
+
`);
|
|
1024
|
+
F$1.push(C$1), v$1 += C$1.length;
|
|
1025
|
+
}
|
|
1026
|
+
if (v$1 > p$1) {
|
|
1027
|
+
let A$1 = 0, C$1 = 0, _$2 = v$1;
|
|
1028
|
+
const D$2 = r - S$2, T$2 = (W$2, I$2) => It(F$1, _$2, W$2, I$2, p$1);
|
|
1029
|
+
c$1 ? ({lineCount: _$2, removals: A$1} = T$2(0, D$2), _$2 > p$1 && ({lineCount: _$2, removals: C$1} = T$2(D$2 + 1, F$1.length))) : ({lineCount: _$2, removals: C$1} = T$2(D$2 + 1, F$1.length), _$2 > p$1 && ({lineCount: _$2, removals: A$1} = T$2(0, D$2))), A$1 > 0 && (c$1 = !0, F$1.splice(0, A$1)), C$1 > 0 && (m$1 = !0, F$1.splice(F$1.length - C$1, C$1));
|
|
1030
|
+
}
|
|
1031
|
+
const b$1 = [];
|
|
1032
|
+
c$1 && b$1.push(g$1);
|
|
1033
|
+
for (const A$1 of F$1) for (const C$1 of A$1) b$1.push(C$1);
|
|
1034
|
+
return m$1 && b$1.push(g$1), b$1;
|
|
1035
|
+
};
|
|
1036
|
+
function Ke(e) {
|
|
1037
|
+
return e.label ?? String(e.value ?? "");
|
|
1038
|
+
}
|
|
1039
|
+
function qe(e, r) {
|
|
1040
|
+
if (!e) return !0;
|
|
1041
|
+
const s = (r.label ?? String(r.value ?? "")).toLowerCase(), i = (r.hint ?? "").toLowerCase(), n = String(r.value).toLowerCase(), o = e.toLowerCase();
|
|
1042
|
+
return s.includes(o) || i.includes(o) || n.includes(o);
|
|
1043
|
+
}
|
|
1044
|
+
function Bt(e, r) {
|
|
1045
|
+
const s = [];
|
|
1046
|
+
for (const i of r) e.includes(i.value) && s.push(i);
|
|
1047
|
+
return s;
|
|
1048
|
+
}
|
|
1049
|
+
const Je = (e) => new Vt$1({
|
|
1050
|
+
options: e.options,
|
|
1051
|
+
initialValue: e.initialValue ? [e.initialValue] : void 0,
|
|
1052
|
+
initialUserInput: e.initialUserInput,
|
|
1053
|
+
filter: e.filter ?? ((r, s) => qe(r, s)),
|
|
1054
|
+
signal: e.signal,
|
|
1055
|
+
input: e.input,
|
|
1056
|
+
output: e.output,
|
|
1057
|
+
validate: e.validate,
|
|
1058
|
+
render() {
|
|
1059
|
+
const r = [`${import_picocolors.default.gray(h$1)}`, `${N$1(this.state)} ${e.message}`], s = this.userInput, i = this.options, n = e.placeholder, o = s === "" && n !== void 0;
|
|
1060
|
+
switch (this.state) {
|
|
1061
|
+
case "submit": {
|
|
1062
|
+
const u$1 = Bt(this.selectedValues, i), l$1 = u$1.length > 0 ? ` ${import_picocolors.default.dim(u$1.map(Ke).join(", "))}` : "";
|
|
1063
|
+
return `${r.join(`
|
|
1064
|
+
`)}
|
|
1065
|
+
${import_picocolors.default.gray(h$1)}${l$1}`;
|
|
1066
|
+
}
|
|
1067
|
+
case "cancel": {
|
|
1068
|
+
const u$1 = s ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(s))}` : "";
|
|
1069
|
+
return `${r.join(`
|
|
1070
|
+
`)}
|
|
1071
|
+
${import_picocolors.default.gray(h$1)}${u$1}`;
|
|
1072
|
+
}
|
|
1073
|
+
default: {
|
|
1074
|
+
const u$1 = `${(this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan)(h$1)} `, l$1 = (this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan)(x$1);
|
|
1075
|
+
let a = "";
|
|
1076
|
+
if (this.isNavigating || o) {
|
|
1077
|
+
const c$1 = o ? n : s;
|
|
1078
|
+
a = c$1 !== "" ? ` ${import_picocolors.default.dim(c$1)}` : "";
|
|
1079
|
+
} else a = ` ${this.userInputWithCursor}`;
|
|
1080
|
+
const d$1 = this.filteredOptions.length !== i.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "", g$1 = this.filteredOptions.length === 0 && s ? [`${u$1}${import_picocolors.default.yellow("No matches found")}`] : [], E$1 = this.state === "error" ? [`${u$1}${import_picocolors.default.yellow(this.error)}`] : [];
|
|
1081
|
+
r.push(`${u$1.trimEnd()}`, `${u$1}${import_picocolors.default.dim("Search:")}${a}${d$1}`, ...g$1, ...E$1);
|
|
1082
|
+
const p$1 = [
|
|
1083
|
+
`${import_picocolors.default.dim("↑/↓")} to select`,
|
|
1084
|
+
`${import_picocolors.default.dim("Enter:")} confirm`,
|
|
1085
|
+
`${import_picocolors.default.dim("Type:")} to search`
|
|
1086
|
+
], y$2 = [`${u$1}${import_picocolors.default.dim(p$1.join(" • "))}`, `${l$1}`], $ = this.filteredOptions.length === 0 ? [] : J({
|
|
1087
|
+
cursor: this.cursor,
|
|
1088
|
+
options: this.filteredOptions,
|
|
1089
|
+
columnPadding: 3,
|
|
1090
|
+
rowPadding: r.length + y$2.length,
|
|
1091
|
+
style: (c$1, m$1) => {
|
|
1092
|
+
const f$1 = Ke(c$1), F$1 = c$1.hint && c$1.value === this.focusedValue ? import_picocolors.default.dim(` (${c$1.hint})`) : "";
|
|
1093
|
+
return m$1 ? `${import_picocolors.default.green(Y)} ${f$1}${F$1}` : `${import_picocolors.default.dim(K$1)} ${import_picocolors.default.dim(f$1)}${F$1}`;
|
|
1094
|
+
},
|
|
1095
|
+
maxItems: e.maxItems,
|
|
1096
|
+
output: e.output
|
|
1097
|
+
});
|
|
1098
|
+
return [
|
|
1099
|
+
...r,
|
|
1100
|
+
...$.map((c$1) => `${u$1}${c$1}`),
|
|
1101
|
+
...y$2
|
|
1102
|
+
].join(`
|
|
1103
|
+
`);
|
|
1104
|
+
}
|
|
1105
|
+
}
|
|
1106
|
+
}
|
|
1107
|
+
}).prompt(), bt = (e) => {
|
|
1108
|
+
const r = (i, n, o, u$1) => {
|
|
1109
|
+
const l$1 = o.includes(i.value), a = i.label ?? String(i.value ?? ""), d$1 = i.hint && u$1 !== void 0 && i.value === u$1 ? import_picocolors.default.dim(` (${i.hint})`) : "", g$1 = l$1 ? import_picocolors.default.green(G$1) : import_picocolors.default.dim(z$1);
|
|
1110
|
+
return n ? `${g$1} ${a}${d$1}` : `${g$1} ${import_picocolors.default.dim(a)}`;
|
|
1111
|
+
}, s = new Vt$1({
|
|
1112
|
+
options: e.options,
|
|
1113
|
+
multiple: !0,
|
|
1114
|
+
filter: e.filter ?? ((i, n) => qe(i, n)),
|
|
1115
|
+
validate: () => {
|
|
1116
|
+
if (e.required && s.selectedValues.length === 0) return "Please select at least one item";
|
|
1117
|
+
},
|
|
1118
|
+
initialValue: e.initialValues,
|
|
1119
|
+
signal: e.signal,
|
|
1120
|
+
input: e.input,
|
|
1121
|
+
output: e.output,
|
|
1122
|
+
render() {
|
|
1123
|
+
const i = `${import_picocolors.default.gray(h$1)}
|
|
1124
|
+
${N$1(this.state)} ${e.message}
|
|
1125
|
+
`, n = this.userInput, o = e.placeholder, u$1 = n === "" && o !== void 0, l$1 = this.isNavigating || u$1 ? import_picocolors.default.dim(u$1 ? o : n) : this.userInputWithCursor, a = this.options, d$1 = this.filteredOptions.length !== a.length ? import_picocolors.default.dim(` (${this.filteredOptions.length} match${this.filteredOptions.length === 1 ? "" : "es"})`) : "";
|
|
1126
|
+
switch (this.state) {
|
|
1127
|
+
case "submit": return `${i}${import_picocolors.default.gray(h$1)} ${import_picocolors.default.dim(`${this.selectedValues.length} items selected`)}`;
|
|
1128
|
+
case "cancel": return `${i}${import_picocolors.default.gray(h$1)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(n))}`;
|
|
1129
|
+
default: {
|
|
1130
|
+
const g$1 = this.state === "error" ? import_picocolors.default.yellow : import_picocolors.default.cyan, E$1 = [
|
|
1131
|
+
`${import_picocolors.default.dim("↑/↓")} to navigate`,
|
|
1132
|
+
`${import_picocolors.default.dim(this.isNavigating ? "Space/Tab:" : "Tab:")} select`,
|
|
1133
|
+
`${import_picocolors.default.dim("Enter:")} confirm`,
|
|
1134
|
+
`${import_picocolors.default.dim("Type:")} to search`
|
|
1135
|
+
], p$1 = this.filteredOptions.length === 0 && n ? [`${g$1(h$1)} ${import_picocolors.default.yellow("No matches found")}`] : [], y$2 = this.state === "error" ? [`${g$1(h$1)} ${import_picocolors.default.yellow(this.error)}`] : [], $ = [
|
|
1136
|
+
...`${i}${g$1(h$1)}`.split(`
|
|
1137
|
+
`),
|
|
1138
|
+
`${g$1(h$1)} ${import_picocolors.default.dim("Search:")} ${l$1}${d$1}`,
|
|
1139
|
+
...p$1,
|
|
1140
|
+
...y$2
|
|
1141
|
+
], c$1 = [`${g$1(h$1)} ${import_picocolors.default.dim(E$1.join(" • "))}`, `${g$1(x$1)}`], m$1 = J({
|
|
1142
|
+
cursor: this.cursor,
|
|
1143
|
+
options: this.filteredOptions,
|
|
1144
|
+
style: (f$1, F$1) => r(f$1, F$1, this.selectedValues, this.focusedValue),
|
|
1145
|
+
maxItems: e.maxItems,
|
|
1146
|
+
output: e.output,
|
|
1147
|
+
rowPadding: $.length + c$1.length
|
|
1148
|
+
});
|
|
1149
|
+
return [
|
|
1150
|
+
...$,
|
|
1151
|
+
...m$1.map((f$1) => `${g$1(h$1)} ${f$1}`),
|
|
1152
|
+
...c$1
|
|
1153
|
+
].join(`
|
|
1154
|
+
`);
|
|
1155
|
+
}
|
|
1156
|
+
}
|
|
1157
|
+
}
|
|
1158
|
+
});
|
|
1159
|
+
return s.prompt();
|
|
1160
|
+
}, xt = [
|
|
1161
|
+
We,
|
|
1162
|
+
he,
|
|
1163
|
+
pe,
|
|
1164
|
+
me
|
|
1165
|
+
], _t = [
|
|
1166
|
+
$e,
|
|
1167
|
+
Re,
|
|
1168
|
+
x$1,
|
|
1169
|
+
Oe
|
|
1170
|
+
];
|
|
1171
|
+
function Xe(e, r, s, i) {
|
|
1172
|
+
let n = s, o = s;
|
|
1173
|
+
return i === "center" ? n = Math.floor((r - e) / 2) : i === "right" && (n = r - e - s), o = r - n - e, [n, o];
|
|
1174
|
+
}
|
|
1175
|
+
const Dt = (e) => e, Tt = (e = "", r = "", s) => {
|
|
1176
|
+
const i = s?.output ?? process.stdout, n = rt(i), o = 2, u$1 = s?.titlePadding ?? 1, l$1 = s?.contentPadding ?? 2, a = s?.width === void 0 || s.width === "auto" ? 1 : Math.min(1, s.width), d$1 = (s?.withGuide ?? _$1.withGuide) !== !1 ? `${h$1} ` : "", g$1 = s?.formatBorder ?? Dt, E$1 = (s?.rounded ? xt : _t).map(g$1), p$1 = g$1(se), y$2 = g$1(h$1), $ = M$1(d$1), c$1 = M$1(r), m$1 = n - $;
|
|
1177
|
+
let f$1 = Math.floor(n * a) - $;
|
|
1178
|
+
if (s?.width === "auto") {
|
|
1179
|
+
const _$2 = e.split(`
|
|
1180
|
+
`);
|
|
1181
|
+
let D$2 = c$1 + u$1 * 2;
|
|
1182
|
+
for (const W$2 of _$2) {
|
|
1183
|
+
const I$2 = M$1(W$2) + l$1 * 2;
|
|
1184
|
+
I$2 > D$2 && (D$2 = I$2);
|
|
1185
|
+
}
|
|
1186
|
+
const T$2 = D$2 + o;
|
|
1187
|
+
T$2 < f$1 && (f$1 = T$2);
|
|
1188
|
+
}
|
|
1189
|
+
f$1 % 2 !== 0 && (f$1 < m$1 ? f$1++ : f$1--);
|
|
1190
|
+
const F$1 = f$1 - o, v$1 = F$1 - u$1 * 2, S$2 = c$1 > v$1 ? `${r.slice(0, v$1 - 3)}...` : r, [B$1, b$1] = Xe(M$1(S$2), F$1, u$1, s?.titleAlign), A$1 = q$1(e, F$1 - l$1 * 2, {
|
|
1191
|
+
hard: !0,
|
|
1192
|
+
trim: !1
|
|
1193
|
+
});
|
|
1194
|
+
i.write(`${d$1}${E$1[0]}${p$1.repeat(B$1)}${S$2}${p$1.repeat(b$1)}${E$1[1]}
|
|
1195
|
+
`);
|
|
1196
|
+
const C$1 = A$1.split(`
|
|
1197
|
+
`);
|
|
1198
|
+
for (const _$2 of C$1) {
|
|
1199
|
+
const [D$2, T$2] = Xe(M$1(_$2), F$1, l$1, s?.contentAlign);
|
|
1200
|
+
i.write(`${d$1}${y$2}${" ".repeat(D$2)}${_$2}${" ".repeat(T$2)}${y$2}
|
|
1201
|
+
`);
|
|
1202
|
+
}
|
|
1203
|
+
i.write(`${d$1}${E$1[2]}${p$1.repeat(F$1)}${E$1[3]}
|
|
1204
|
+
`);
|
|
1205
|
+
}, Mt = (e) => {
|
|
1206
|
+
const r = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1207
|
+
return new kt$1({
|
|
1208
|
+
active: r,
|
|
1209
|
+
inactive: s,
|
|
1210
|
+
signal: e.signal,
|
|
1211
|
+
input: e.input,
|
|
1212
|
+
output: e.output,
|
|
1213
|
+
initialValue: e.initialValue ?? !0,
|
|
1214
|
+
render() {
|
|
1215
|
+
const i = `${import_picocolors.default.gray(h$1)}
|
|
1216
|
+
${N$1(this.state)} ${e.message}
|
|
1217
|
+
`, n = this.value ? r : s;
|
|
1218
|
+
switch (this.state) {
|
|
1219
|
+
case "submit": return `${i}${import_picocolors.default.gray(h$1)} ${import_picocolors.default.dim(n)}`;
|
|
1220
|
+
case "cancel": return `${i}${import_picocolors.default.gray(h$1)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(n))}
|
|
1221
|
+
${import_picocolors.default.gray(h$1)}`;
|
|
1222
|
+
default: return `${i}${import_picocolors.default.cyan(h$1)} ${this.value ? `${import_picocolors.default.green(Y)} ${r}` : `${import_picocolors.default.dim(K$1)} ${import_picocolors.default.dim(r)}`} ${import_picocolors.default.dim("/")} ${this.value ? `${import_picocolors.default.dim(K$1)} ${import_picocolors.default.dim(s)}` : `${import_picocolors.default.green(Y)} ${s}`}
|
|
1223
|
+
${import_picocolors.default.cyan(x$1)}
|
|
1224
|
+
`;
|
|
1225
|
+
}
|
|
1226
|
+
}
|
|
1227
|
+
}).prompt();
|
|
1228
|
+
}, Rt = async (e, r) => {
|
|
1229
|
+
const s = {}, i = Object.keys(e);
|
|
1230
|
+
for (const n of i) {
|
|
1231
|
+
const o = e[n], u$1 = await o({ results: s })?.catch((l$1) => {
|
|
1232
|
+
throw l$1;
|
|
1233
|
+
});
|
|
1234
|
+
if (typeof r?.onCancel == "function" && Ct$1(u$1)) {
|
|
1235
|
+
s[n] = "canceled", r.onCancel({ results: s });
|
|
1236
|
+
continue;
|
|
1237
|
+
}
|
|
1238
|
+
s[n] = u$1;
|
|
1239
|
+
}
|
|
1240
|
+
return s;
|
|
1241
|
+
}, Ot = (e) => {
|
|
1242
|
+
const { selectableGroups: r = !0, groupSpacing: s = 0 } = e, i = (o, u$1, l$1 = []) => {
|
|
1243
|
+
const a = o.label ?? String(o.value), d$1 = typeof o.group == "string", g$1 = d$1 && (l$1[l$1.indexOf(o) + 1] ?? { group: !0 }), E$1 = d$1 && g$1 && g$1.group === !0, p$1 = d$1 ? r ? `${E$1 ? x$1 : h$1} ` : " " : "";
|
|
1244
|
+
let y$2 = "";
|
|
1245
|
+
if (s > 0 && !d$1) {
|
|
1246
|
+
const c$1 = `
|
|
1247
|
+
${import_picocolors.default.cyan(h$1)}`;
|
|
1248
|
+
y$2 = `${c$1.repeat(s - 1)}${c$1} `;
|
|
1249
|
+
}
|
|
1250
|
+
if (u$1 === "active") return `${y$2}${import_picocolors.default.dim(p$1)}${import_picocolors.default.cyan(te)} ${a}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
|
|
1251
|
+
if (u$1 === "group-active") return `${y$2}${p$1}${import_picocolors.default.cyan(te)} ${import_picocolors.default.dim(a)}`;
|
|
1252
|
+
if (u$1 === "group-active-selected") return `${y$2}${p$1}${import_picocolors.default.green(G$1)} ${import_picocolors.default.dim(a)}`;
|
|
1253
|
+
if (u$1 === "selected") {
|
|
1254
|
+
const c$1 = d$1 || r ? import_picocolors.default.green(G$1) : "";
|
|
1255
|
+
return `${y$2}${import_picocolors.default.dim(p$1)}${c$1} ${import_picocolors.default.dim(a)}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
|
|
1256
|
+
}
|
|
1257
|
+
if (u$1 === "cancelled") return `${import_picocolors.default.strikethrough(import_picocolors.default.dim(a))}`;
|
|
1258
|
+
if (u$1 === "active-selected") return `${y$2}${import_picocolors.default.dim(p$1)}${import_picocolors.default.green(G$1)} ${a}${o.hint ? ` ${import_picocolors.default.dim(`(${o.hint})`)}` : ""}`;
|
|
1259
|
+
if (u$1 === "submitted") return `${import_picocolors.default.dim(a)}`;
|
|
1260
|
+
const $ = d$1 || r ? import_picocolors.default.dim(z$1) : "";
|
|
1261
|
+
return `${y$2}${import_picocolors.default.dim(p$1)}${$} ${import_picocolors.default.dim(a)}`;
|
|
1262
|
+
}, n = e.required ?? !0;
|
|
1263
|
+
return new yt$1({
|
|
1264
|
+
options: e.options,
|
|
1265
|
+
signal: e.signal,
|
|
1266
|
+
input: e.input,
|
|
1267
|
+
output: e.output,
|
|
1268
|
+
initialValues: e.initialValues,
|
|
1269
|
+
required: n,
|
|
1270
|
+
cursorAt: e.cursorAt,
|
|
1271
|
+
selectableGroups: r,
|
|
1272
|
+
validate(o) {
|
|
1273
|
+
if (n && (o === void 0 || o.length === 0)) return `Please select at least one option.
|
|
1274
|
+
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
1275
|
+
},
|
|
1276
|
+
render() {
|
|
1277
|
+
const o = `${import_picocolors.default.gray(h$1)}
|
|
1278
|
+
${N$1(this.state)} ${e.message}
|
|
1279
|
+
`, u$1 = this.value ?? [];
|
|
1280
|
+
switch (this.state) {
|
|
1281
|
+
case "submit": {
|
|
1282
|
+
const l$1 = this.options.filter(({ value: d$1 }) => u$1.includes(d$1)).map((d$1) => i(d$1, "submitted")), a = l$1.length === 0 ? "" : ` ${l$1.join(import_picocolors.default.dim(", "))}`;
|
|
1283
|
+
return `${o}${import_picocolors.default.gray(h$1)}${a}`;
|
|
1284
|
+
}
|
|
1285
|
+
case "cancel": {
|
|
1286
|
+
const l$1 = this.options.filter(({ value: a }) => u$1.includes(a)).map((a) => i(a, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
1287
|
+
return `${o}${import_picocolors.default.gray(h$1)} ${l$1.trim() ? `${l$1}
|
|
1288
|
+
${import_picocolors.default.gray(h$1)}` : ""}`;
|
|
1289
|
+
}
|
|
1290
|
+
case "error": {
|
|
1291
|
+
const l$1 = this.error.split(`
|
|
1292
|
+
`).map((a, d$1) => d$1 === 0 ? `${import_picocolors.default.yellow(x$1)} ${import_picocolors.default.yellow(a)}` : ` ${a}`).join(`
|
|
1293
|
+
`);
|
|
1294
|
+
return `${o}${import_picocolors.default.yellow(h$1)} ${this.options.map((a, d$1, g$1) => {
|
|
1295
|
+
const E$1 = u$1.includes(a.value) || a.group === !0 && this.isGroupSelected(`${a.value}`), p$1 = d$1 === this.cursor;
|
|
1296
|
+
return !p$1 && typeof a.group == "string" && this.options[this.cursor].value === a.group ? i(a, E$1 ? "group-active-selected" : "group-active", g$1) : p$1 && E$1 ? i(a, "active-selected", g$1) : E$1 ? i(a, "selected", g$1) : i(a, p$1 ? "active" : "inactive", g$1);
|
|
1297
|
+
}).join(`
|
|
1298
|
+
${import_picocolors.default.yellow(h$1)} `)}
|
|
1299
|
+
${l$1}
|
|
1300
|
+
`;
|
|
1301
|
+
}
|
|
1302
|
+
default: {
|
|
1303
|
+
const l$1 = this.options.map((d$1, g$1, E$1) => {
|
|
1304
|
+
const p$1 = u$1.includes(d$1.value) || d$1.group === !0 && this.isGroupSelected(`${d$1.value}`), y$2 = g$1 === this.cursor, $ = !y$2 && typeof d$1.group == "string" && this.options[this.cursor].value === d$1.group;
|
|
1305
|
+
let c$1 = "";
|
|
1306
|
+
return $ ? c$1 = i(d$1, p$1 ? "group-active-selected" : "group-active", E$1) : y$2 && p$1 ? c$1 = i(d$1, "active-selected", E$1) : p$1 ? c$1 = i(d$1, "selected", E$1) : c$1 = i(d$1, y$2 ? "active" : "inactive", E$1), `${g$1 !== 0 && !c$1.startsWith(`
|
|
1307
|
+
`) ? " " : ""}${c$1}`;
|
|
1308
|
+
}).join(`
|
|
1309
|
+
${import_picocolors.default.cyan(h$1)}`), a = l$1.startsWith(`
|
|
1310
|
+
`) ? "" : " ";
|
|
1311
|
+
return `${o}${import_picocolors.default.cyan(h$1)}${a}${l$1}
|
|
1312
|
+
${import_picocolors.default.cyan(x$1)}
|
|
1313
|
+
`;
|
|
1314
|
+
}
|
|
1315
|
+
}
|
|
1316
|
+
}
|
|
1317
|
+
}).prompt();
|
|
1318
|
+
}, R$1 = {
|
|
1319
|
+
message: (e = [], { symbol: r = import_picocolors.default.gray(h$1), secondarySymbol: s = import_picocolors.default.gray(h$1), output: i = process.stdout, spacing: n = 1, withGuide: o } = {}) => {
|
|
1320
|
+
const u$1 = [], l$1 = (o ?? _$1.withGuide) !== !1, a = l$1 ? s : "", d$1 = l$1 ? `${r} ` : "", g$1 = l$1 ? `${s} ` : "";
|
|
1321
|
+
for (let p$1 = 0; p$1 < n; p$1++) u$1.push(a);
|
|
1322
|
+
const E$1 = Array.isArray(e) ? e : e.split(`
|
|
1323
|
+
`);
|
|
1324
|
+
if (E$1.length > 0) {
|
|
1325
|
+
const [p$1, ...y$2] = E$1;
|
|
1326
|
+
p$1.length > 0 ? u$1.push(`${d$1}${p$1}`) : u$1.push(l$1 ? r : "");
|
|
1327
|
+
for (const $ of y$2) $.length > 0 ? u$1.push(`${g$1}${$}`) : u$1.push(l$1 ? s : "");
|
|
1328
|
+
}
|
|
1329
|
+
i.write(`${u$1.join(`
|
|
1330
|
+
`)}
|
|
1331
|
+
`);
|
|
1332
|
+
},
|
|
1333
|
+
info: (e, r) => {
|
|
1334
|
+
R$1.message(e, {
|
|
1335
|
+
...r,
|
|
1336
|
+
symbol: import_picocolors.default.blue(ge)
|
|
1337
|
+
});
|
|
1338
|
+
},
|
|
1339
|
+
success: (e, r) => {
|
|
1340
|
+
R$1.message(e, {
|
|
1341
|
+
...r,
|
|
1342
|
+
symbol: import_picocolors.default.green(fe)
|
|
1343
|
+
});
|
|
1344
|
+
},
|
|
1345
|
+
step: (e, r) => {
|
|
1346
|
+
R$1.message(e, {
|
|
1347
|
+
...r,
|
|
1348
|
+
symbol: import_picocolors.default.green(k$1)
|
|
1349
|
+
});
|
|
1350
|
+
},
|
|
1351
|
+
warn: (e, r) => {
|
|
1352
|
+
R$1.message(e, {
|
|
1353
|
+
...r,
|
|
1354
|
+
symbol: import_picocolors.default.yellow(Fe)
|
|
1355
|
+
});
|
|
1356
|
+
},
|
|
1357
|
+
warning: (e, r) => {
|
|
1358
|
+
R$1.warn(e, r);
|
|
1359
|
+
},
|
|
1360
|
+
error: (e, r) => {
|
|
1361
|
+
R$1.message(e, {
|
|
1362
|
+
...r,
|
|
1363
|
+
symbol: import_picocolors.default.red(ye)
|
|
1364
|
+
});
|
|
1365
|
+
}
|
|
1366
|
+
}, Pt = (e = "", r) => {
|
|
1367
|
+
(r?.output ?? process.stdout).write(`${import_picocolors.default.gray(x$1)} ${import_picocolors.default.red(e)}
|
|
1368
|
+
|
|
1369
|
+
`);
|
|
1370
|
+
}, Nt = (e = "", r) => {
|
|
1371
|
+
(r?.output ?? process.stdout).write(`${import_picocolors.default.gray($e)} ${e}
|
|
1372
|
+
`);
|
|
1373
|
+
}, Wt = (e = "", r) => {
|
|
1374
|
+
(r?.output ?? process.stdout).write(`${import_picocolors.default.gray(h$1)}
|
|
1375
|
+
${import_picocolors.default.gray(x$1)} ${e}
|
|
1376
|
+
|
|
1377
|
+
`);
|
|
1378
|
+
}, Q = (e, r) => e.split(`
|
|
1379
|
+
`).map((s) => r(s)).join(`
|
|
1380
|
+
`), Lt = (e) => {
|
|
1381
|
+
const r = (i, n) => {
|
|
1382
|
+
const o = i.label ?? String(i.value);
|
|
1383
|
+
return n === "disabled" ? `${import_picocolors.default.gray(z$1)} ${Q(o, (u$1) => import_picocolors.default.strikethrough(import_picocolors.default.gray(u$1)))}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint ?? "disabled"})`)}` : ""}` : n === "active" ? `${import_picocolors.default.cyan(te)} ${o}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : n === "selected" ? `${import_picocolors.default.green(G$1)} ${Q(o, import_picocolors.default.dim)}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : n === "cancelled" ? `${Q(o, (u$1) => import_picocolors.default.strikethrough(import_picocolors.default.dim(u$1)))}` : n === "active-selected" ? `${import_picocolors.default.green(G$1)} ${o}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : n === "submitted" ? `${Q(o, import_picocolors.default.dim)}` : `${import_picocolors.default.dim(z$1)} ${Q(o, import_picocolors.default.dim)}`;
|
|
1384
|
+
}, s = e.required ?? !0;
|
|
1385
|
+
return new Mt$1({
|
|
1386
|
+
options: e.options,
|
|
1387
|
+
signal: e.signal,
|
|
1388
|
+
input: e.input,
|
|
1389
|
+
output: e.output,
|
|
1390
|
+
initialValues: e.initialValues,
|
|
1391
|
+
required: s,
|
|
1392
|
+
cursorAt: e.cursorAt,
|
|
1393
|
+
validate(i) {
|
|
1394
|
+
if (s && (i === void 0 || i.length === 0)) return `Please select at least one option.
|
|
1395
|
+
${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" space ")))} to select, ${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(" enter ")))} to submit`))}`;
|
|
1396
|
+
},
|
|
1397
|
+
render() {
|
|
1398
|
+
const i = Bt$1(e.output, e.message, `${Ee(this.state)} `, `${N$1(this.state)} `), n = `${import_picocolors.default.gray(h$1)}
|
|
1399
|
+
${i}
|
|
1400
|
+
`, o = this.value ?? [], u$1 = (l$1, a) => {
|
|
1401
|
+
if (l$1.disabled) return r(l$1, "disabled");
|
|
1402
|
+
const d$1 = o.includes(l$1.value);
|
|
1403
|
+
return a && d$1 ? r(l$1, "active-selected") : d$1 ? r(l$1, "selected") : r(l$1, a ? "active" : "inactive");
|
|
1404
|
+
};
|
|
1405
|
+
switch (this.state) {
|
|
1406
|
+
case "submit": {
|
|
1407
|
+
const l$1 = this.options.filter(({ value: d$1 }) => o.includes(d$1)).map((d$1) => r(d$1, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none");
|
|
1408
|
+
return `${n}${Bt$1(e.output, l$1, `${import_picocolors.default.gray(h$1)} `)}`;
|
|
1409
|
+
}
|
|
1410
|
+
case "cancel": {
|
|
1411
|
+
const l$1 = this.options.filter(({ value: d$1 }) => o.includes(d$1)).map((d$1) => r(d$1, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
1412
|
+
if (l$1.trim() === "") return `${n}${import_picocolors.default.gray(h$1)}`;
|
|
1413
|
+
return `${n}${Bt$1(e.output, l$1, `${import_picocolors.default.gray(h$1)} `)}
|
|
1414
|
+
${import_picocolors.default.gray(h$1)}`;
|
|
1415
|
+
}
|
|
1416
|
+
case "error": {
|
|
1417
|
+
const l$1 = `${import_picocolors.default.yellow(h$1)} `, a = this.error.split(`
|
|
1418
|
+
`).map((E$1, p$1) => p$1 === 0 ? `${import_picocolors.default.yellow(x$1)} ${import_picocolors.default.yellow(E$1)}` : ` ${E$1}`).join(`
|
|
1419
|
+
`), d$1 = n.split(`
|
|
1420
|
+
`).length, g$1 = a.split(`
|
|
1421
|
+
`).length + 1;
|
|
1422
|
+
return `${n}${l$1}${J({
|
|
1423
|
+
output: e.output,
|
|
1424
|
+
options: this.options,
|
|
1425
|
+
cursor: this.cursor,
|
|
1426
|
+
maxItems: e.maxItems,
|
|
1427
|
+
columnPadding: l$1.length,
|
|
1428
|
+
rowPadding: d$1 + g$1,
|
|
1429
|
+
style: u$1
|
|
1430
|
+
}).join(`
|
|
1431
|
+
${l$1}`)}
|
|
1432
|
+
${a}
|
|
1433
|
+
`;
|
|
1434
|
+
}
|
|
1435
|
+
default: {
|
|
1436
|
+
const l$1 = `${import_picocolors.default.cyan(h$1)} `, a = n.split(`
|
|
1437
|
+
`).length;
|
|
1438
|
+
return `${n}${l$1}${J({
|
|
1439
|
+
output: e.output,
|
|
1440
|
+
options: this.options,
|
|
1441
|
+
cursor: this.cursor,
|
|
1442
|
+
maxItems: e.maxItems,
|
|
1443
|
+
columnPadding: l$1.length,
|
|
1444
|
+
rowPadding: a + 2,
|
|
1445
|
+
style: u$1
|
|
1446
|
+
}).join(`
|
|
1447
|
+
${l$1}`)}
|
|
1448
|
+
${import_picocolors.default.cyan(x$1)}
|
|
1449
|
+
`;
|
|
1450
|
+
}
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
}).prompt();
|
|
1454
|
+
}, jt = (e) => import_picocolors.default.dim(e), Vt = (e, r, s) => {
|
|
1455
|
+
const i = {
|
|
1456
|
+
hard: !0,
|
|
1457
|
+
trim: !1
|
|
1458
|
+
}, n = q$1(e, r, i).split(`
|
|
1459
|
+
`), o = n.reduce((a, d$1) => Math.max(M$1(d$1), a), 0);
|
|
1460
|
+
return q$1(e, r - (n.map(s).reduce((a, d$1) => Math.max(M$1(d$1), a), 0) - o), i);
|
|
1461
|
+
}, kt = (e = "", r = "", s) => {
|
|
1462
|
+
const i = s?.output ?? process$1.stdout, n = (s?.withGuide ?? _$1.withGuide) !== !1, o = s?.format ?? jt, u$1 = [
|
|
1463
|
+
"",
|
|
1464
|
+
...Vt(e, rt(i) - 6, o).split(`
|
|
1465
|
+
`).map(o),
|
|
1466
|
+
""
|
|
1467
|
+
], l$1 = M$1(r), a = Math.max(u$1.reduce((p$1, y$2) => {
|
|
1468
|
+
const $ = M$1(y$2);
|
|
1469
|
+
return $ > p$1 ? $ : p$1;
|
|
1470
|
+
}, 0), l$1) + 2, d$1 = u$1.map((p$1) => `${import_picocolors.default.gray(h$1)} ${p$1}${" ".repeat(a - M$1(p$1))}${import_picocolors.default.gray(h$1)}`).join(`
|
|
1471
|
+
`), g$1 = n ? `${import_picocolors.default.gray(h$1)}
|
|
1472
|
+
` : "", E$1 = n ? Ne : pe;
|
|
1473
|
+
i.write(`${g$1}${import_picocolors.default.green(k$1)} ${import_picocolors.default.reset(r)} ${import_picocolors.default.gray(se.repeat(Math.max(a - l$1 - 1, 1)) + he)}
|
|
1474
|
+
${d$1}
|
|
1475
|
+
${import_picocolors.default.gray(E$1 + se.repeat(a + 2) + me)}
|
|
1476
|
+
`);
|
|
1477
|
+
}, Gt = (e) => new Lt$1({
|
|
1478
|
+
validate: e.validate,
|
|
1479
|
+
mask: e.mask ?? Pe,
|
|
1480
|
+
signal: e.signal,
|
|
1481
|
+
input: e.input,
|
|
1482
|
+
output: e.output,
|
|
1483
|
+
render() {
|
|
1484
|
+
const r = `${import_picocolors.default.gray(h$1)}
|
|
1485
|
+
${N$1(this.state)} ${e.message}
|
|
1486
|
+
`, s = this.userInputWithCursor, i = this.masked;
|
|
1487
|
+
switch (this.state) {
|
|
1488
|
+
case "error": {
|
|
1489
|
+
const n = i ? ` ${i}` : "";
|
|
1490
|
+
return e.clearOnError && this.clear(), `${r.trim()}
|
|
1491
|
+
${import_picocolors.default.yellow(h$1)}${n}
|
|
1492
|
+
${import_picocolors.default.yellow(x$1)} ${import_picocolors.default.yellow(this.error)}
|
|
1493
|
+
`;
|
|
1494
|
+
}
|
|
1495
|
+
case "submit": {
|
|
1496
|
+
const n = i ? ` ${import_picocolors.default.dim(i)}` : "";
|
|
1497
|
+
return `${r}${import_picocolors.default.gray(h$1)}${n}`;
|
|
1498
|
+
}
|
|
1499
|
+
case "cancel": {
|
|
1500
|
+
const n = i ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(i))}` : "";
|
|
1501
|
+
return `${r}${import_picocolors.default.gray(h$1)}${n}${i ? `
|
|
1502
|
+
${import_picocolors.default.gray(h$1)}` : ""}`;
|
|
1503
|
+
}
|
|
1504
|
+
default: return `${r}${import_picocolors.default.cyan(h$1)} ${s}
|
|
1505
|
+
${import_picocolors.default.cyan(x$1)}
|
|
1506
|
+
`;
|
|
106
1507
|
}
|
|
107
|
-
if (stopDir?.(directory)) break;
|
|
108
1508
|
}
|
|
109
|
-
|
|
1509
|
+
}).prompt(), Ht = (e) => {
|
|
1510
|
+
const r = e.validate;
|
|
1511
|
+
return Je({
|
|
1512
|
+
...e,
|
|
1513
|
+
initialUserInput: e.initialValue ?? e.root ?? process.cwd(),
|
|
1514
|
+
maxItems: 5,
|
|
1515
|
+
validate(s) {
|
|
1516
|
+
if (!Array.isArray(s)) {
|
|
1517
|
+
if (!s) return "Please select a path";
|
|
1518
|
+
if (r) return r(s);
|
|
1519
|
+
}
|
|
1520
|
+
},
|
|
1521
|
+
options() {
|
|
1522
|
+
const s = this.userInput;
|
|
1523
|
+
if (s === "") return [];
|
|
1524
|
+
try {
|
|
1525
|
+
let i;
|
|
1526
|
+
return existsSync(s) ? lstatSync(s).isDirectory() ? i = s : i = dirname(s) : i = dirname(s), readdirSync(i).map((n) => {
|
|
1527
|
+
const o = join(i, n);
|
|
1528
|
+
return {
|
|
1529
|
+
name: n,
|
|
1530
|
+
path: o,
|
|
1531
|
+
isDirectory: lstatSync(o).isDirectory()
|
|
1532
|
+
};
|
|
1533
|
+
}).filter(({ path: n, isDirectory: o }) => n.startsWith(s) && (e.directory || !o)).map((n) => ({ value: n.path }));
|
|
1534
|
+
} catch {
|
|
1535
|
+
return [];
|
|
1536
|
+
}
|
|
1537
|
+
}
|
|
1538
|
+
});
|
|
1539
|
+
}, Ut = import_picocolors.default.magenta, Ie = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: n, frames: o = ee ? [
|
|
1540
|
+
"◒",
|
|
1541
|
+
"◐",
|
|
1542
|
+
"◓",
|
|
1543
|
+
"◑"
|
|
1544
|
+
] : [
|
|
1545
|
+
"•",
|
|
1546
|
+
"o",
|
|
1547
|
+
"O",
|
|
1548
|
+
"0"
|
|
1549
|
+
], delay: u$1 = ee ? 80 : 120, signal: l$1, ...a } = {}) => {
|
|
1550
|
+
const d$1 = ue();
|
|
1551
|
+
let g$1, E$1, p$1 = !1, y$2 = !1, $ = "", c$1, m$1 = performance.now();
|
|
1552
|
+
const f$1 = rt(s), F$1 = a?.styleFrame ?? Ut, v$1 = (I$2) => {
|
|
1553
|
+
const O$2 = I$2 > 1 ? n ?? _$1.messages.error : i ?? _$1.messages.cancel;
|
|
1554
|
+
y$2 = I$2 === 1, p$1 && (W$2(O$2, I$2), y$2 && typeof r == "function" && r());
|
|
1555
|
+
}, S$2 = () => v$1(2), B$1 = () => v$1(1), b$1 = () => {
|
|
1556
|
+
process.on("uncaughtExceptionMonitor", S$2), process.on("unhandledRejection", S$2), process.on("SIGINT", B$1), process.on("SIGTERM", B$1), process.on("exit", v$1), l$1 && l$1.addEventListener("abort", B$1);
|
|
1557
|
+
}, A$1 = () => {
|
|
1558
|
+
process.removeListener("uncaughtExceptionMonitor", S$2), process.removeListener("unhandledRejection", S$2), process.removeListener("SIGINT", B$1), process.removeListener("SIGTERM", B$1), process.removeListener("exit", v$1), l$1 && l$1.removeEventListener("abort", B$1);
|
|
1559
|
+
}, C$1 = () => {
|
|
1560
|
+
if (c$1 === void 0) return;
|
|
1561
|
+
d$1 && s.write(`
|
|
1562
|
+
`);
|
|
1563
|
+
const I$2 = q$1(c$1, f$1, {
|
|
1564
|
+
hard: !0,
|
|
1565
|
+
trim: !1
|
|
1566
|
+
}).split(`
|
|
1567
|
+
`);
|
|
1568
|
+
I$2.length > 1 && s.write(import_src.cursor.up(I$2.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
|
|
1569
|
+
}, _$2 = (I$2) => I$2.replace(/\.+$/, ""), D$2 = (I$2) => {
|
|
1570
|
+
const O$2 = (performance.now() - I$2) / 1e3, L$1 = Math.floor(O$2 / 60), j$2 = Math.floor(O$2 % 60);
|
|
1571
|
+
return L$1 > 0 ? `[${L$1}m ${j$2}s]` : `[${j$2}s]`;
|
|
1572
|
+
}, T$2 = (I$2 = "") => {
|
|
1573
|
+
p$1 = !0, g$1 = xt$1({ output: s }), $ = _$2(I$2), m$1 = performance.now(), s.write(`${import_picocolors.default.gray(h$1)}
|
|
1574
|
+
`);
|
|
1575
|
+
let O$2 = 0, L$1 = 0;
|
|
1576
|
+
b$1(), E$1 = setInterval(() => {
|
|
1577
|
+
if (d$1 && $ === c$1) return;
|
|
1578
|
+
C$1(), c$1 = $;
|
|
1579
|
+
const j$2 = F$1(o[O$2]);
|
|
1580
|
+
let Z$1;
|
|
1581
|
+
if (d$1) Z$1 = `${j$2} ${$}...`;
|
|
1582
|
+
else if (e === "timer") Z$1 = `${j$2} ${$} ${D$2(m$1)}`;
|
|
1583
|
+
else {
|
|
1584
|
+
const Ze = ".".repeat(Math.floor(L$1)).slice(0, 3);
|
|
1585
|
+
Z$1 = `${j$2} ${$}${Ze}`;
|
|
1586
|
+
}
|
|
1587
|
+
const Qe = q$1(Z$1, f$1, {
|
|
1588
|
+
hard: !0,
|
|
1589
|
+
trim: !1
|
|
1590
|
+
});
|
|
1591
|
+
s.write(Qe), O$2 = O$2 + 1 < o.length ? O$2 + 1 : 0, L$1 = L$1 < 4 ? L$1 + .125 : 0;
|
|
1592
|
+
}, u$1);
|
|
1593
|
+
}, W$2 = (I$2 = "", O$2 = 0, L$1 = !1) => {
|
|
1594
|
+
if (!p$1) return;
|
|
1595
|
+
p$1 = !1, clearInterval(E$1), C$1();
|
|
1596
|
+
const j$2 = O$2 === 0 ? import_picocolors.default.green(k$1) : O$2 === 1 ? import_picocolors.default.red(ce) : import_picocolors.default.red(de);
|
|
1597
|
+
$ = I$2 ?? $, L$1 || (e === "timer" ? s.write(`${j$2} ${$} ${D$2(m$1)}
|
|
1598
|
+
`) : s.write(`${j$2} ${$}
|
|
1599
|
+
`)), A$1(), g$1();
|
|
1600
|
+
};
|
|
1601
|
+
return {
|
|
1602
|
+
start: T$2,
|
|
1603
|
+
stop: (I$2 = "") => W$2(I$2, 0),
|
|
1604
|
+
message: (I$2 = "") => {
|
|
1605
|
+
$ = _$2(I$2 ?? $);
|
|
1606
|
+
},
|
|
1607
|
+
cancel: (I$2 = "") => W$2(I$2, 1),
|
|
1608
|
+
error: (I$2 = "") => W$2(I$2, 2),
|
|
1609
|
+
clear: () => W$2("", 0, !0),
|
|
1610
|
+
get isCancelled() {
|
|
1611
|
+
return y$2;
|
|
1612
|
+
}
|
|
1613
|
+
};
|
|
1614
|
+
}, Ye = {
|
|
1615
|
+
light: w$1("─", "-"),
|
|
1616
|
+
heavy: w$1("━", "="),
|
|
1617
|
+
block: w$1("█", "#")
|
|
1618
|
+
};
|
|
1619
|
+
const oe = (e, r) => e.includes(`
|
|
1620
|
+
`) ? e.split(`
|
|
1621
|
+
`).map((s) => r(s)).join(`
|
|
1622
|
+
`) : r(e), qt = (e) => {
|
|
1623
|
+
const r = (s, i) => {
|
|
1624
|
+
const n = s.label ?? String(s.value);
|
|
1625
|
+
switch (i) {
|
|
1626
|
+
case "disabled": return `${import_picocolors.default.gray(K$1)} ${oe(n, import_picocolors.default.gray)}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1627
|
+
case "selected": return `${oe(n, import_picocolors.default.dim)}`;
|
|
1628
|
+
case "active": return `${import_picocolors.default.green(Y)} ${n}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
|
|
1629
|
+
case "cancelled": return `${oe(n, (o) => import_picocolors.default.strikethrough(import_picocolors.default.dim(o)))}`;
|
|
1630
|
+
default: return `${import_picocolors.default.dim(K$1)} ${oe(n, import_picocolors.default.dim)}`;
|
|
1631
|
+
}
|
|
1632
|
+
};
|
|
1633
|
+
return new Wt$1({
|
|
1634
|
+
options: e.options,
|
|
1635
|
+
signal: e.signal,
|
|
1636
|
+
input: e.input,
|
|
1637
|
+
output: e.output,
|
|
1638
|
+
initialValue: e.initialValue,
|
|
1639
|
+
render() {
|
|
1640
|
+
const s = `${N$1(this.state)} `, i = `${Ee(this.state)} `, n = Bt$1(e.output, e.message, i, s), o = `${import_picocolors.default.gray(h$1)}
|
|
1641
|
+
${n}
|
|
1642
|
+
`;
|
|
1643
|
+
switch (this.state) {
|
|
1644
|
+
case "submit": {
|
|
1645
|
+
const u$1 = `${import_picocolors.default.gray(h$1)} `;
|
|
1646
|
+
return `${o}${Bt$1(e.output, r(this.options[this.cursor], "selected"), u$1)}`;
|
|
1647
|
+
}
|
|
1648
|
+
case "cancel": {
|
|
1649
|
+
const u$1 = `${import_picocolors.default.gray(h$1)} `;
|
|
1650
|
+
return `${o}${Bt$1(e.output, r(this.options[this.cursor], "cancelled"), u$1)}
|
|
1651
|
+
${import_picocolors.default.gray(h$1)}`;
|
|
1652
|
+
}
|
|
1653
|
+
default: {
|
|
1654
|
+
const u$1 = `${import_picocolors.default.cyan(h$1)} `, l$1 = o.split(`
|
|
1655
|
+
`).length;
|
|
1656
|
+
return `${o}${u$1}${J({
|
|
1657
|
+
output: e.output,
|
|
1658
|
+
cursor: this.cursor,
|
|
1659
|
+
options: this.options,
|
|
1660
|
+
maxItems: e.maxItems,
|
|
1661
|
+
columnPadding: u$1.length,
|
|
1662
|
+
rowPadding: l$1 + 2,
|
|
1663
|
+
style: (a, d$1) => r(a, a.disabled ? "disabled" : d$1 ? "active" : "inactive")
|
|
1664
|
+
}).join(`
|
|
1665
|
+
${u$1}`)}
|
|
1666
|
+
${import_picocolors.default.cyan(x$1)}
|
|
1667
|
+
`;
|
|
1668
|
+
}
|
|
1669
|
+
}
|
|
1670
|
+
}
|
|
1671
|
+
}).prompt();
|
|
1672
|
+
}, Jt = (e) => {
|
|
1673
|
+
const r = (s, i = "inactive") => {
|
|
1674
|
+
const n = s.label ?? String(s.value);
|
|
1675
|
+
return i === "selected" ? `${import_picocolors.default.dim(n)}` : i === "cancelled" ? `${import_picocolors.default.strikethrough(import_picocolors.default.dim(n))}` : i === "active" ? `${import_picocolors.default.bgCyan(import_picocolors.default.gray(` ${s.value} `))} ${n}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}` : `${import_picocolors.default.gray(import_picocolors.default.bgWhite(import_picocolors.default.inverse(` ${s.value} `)))} ${n}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
|
|
1676
|
+
};
|
|
1677
|
+
return new Tt$1({
|
|
1678
|
+
options: e.options,
|
|
1679
|
+
signal: e.signal,
|
|
1680
|
+
input: e.input,
|
|
1681
|
+
output: e.output,
|
|
1682
|
+
initialValue: e.initialValue,
|
|
1683
|
+
caseSensitive: e.caseSensitive,
|
|
1684
|
+
render() {
|
|
1685
|
+
const s = `${import_picocolors.default.gray(h$1)}
|
|
1686
|
+
${N$1(this.state)} ${e.message}
|
|
1687
|
+
`;
|
|
1688
|
+
switch (this.state) {
|
|
1689
|
+
case "submit": {
|
|
1690
|
+
const i = `${import_picocolors.default.gray(h$1)} `, n = this.options.find((u$1) => u$1.value === this.value) ?? e.options[0];
|
|
1691
|
+
return `${s}${Bt$1(e.output, r(n, "selected"), i)}`;
|
|
1692
|
+
}
|
|
1693
|
+
case "cancel": {
|
|
1694
|
+
const i = `${import_picocolors.default.gray(h$1)} `;
|
|
1695
|
+
return `${s}${Bt$1(e.output, r(this.options[0], "cancelled"), i)}
|
|
1696
|
+
${import_picocolors.default.gray(h$1)}`;
|
|
1697
|
+
}
|
|
1698
|
+
default: {
|
|
1699
|
+
const i = `${import_picocolors.default.cyan(h$1)} `;
|
|
1700
|
+
return `${s}${this.options.map((o, u$1) => Bt$1(e.output, r(o, u$1 === this.cursor ? "active" : "inactive"), i)).join(`
|
|
1701
|
+
`)}
|
|
1702
|
+
${import_picocolors.default.cyan(x$1)}
|
|
1703
|
+
`;
|
|
1704
|
+
}
|
|
1705
|
+
}
|
|
1706
|
+
}
|
|
1707
|
+
}).prompt();
|
|
1708
|
+
}, ze = `${import_picocolors.default.gray(h$1)} `, H$1 = {
|
|
1709
|
+
message: async (e, { symbol: r = import_picocolors.default.gray(h$1) } = {}) => {
|
|
1710
|
+
process.stdout.write(`${import_picocolors.default.gray(h$1)}
|
|
1711
|
+
${r} `);
|
|
1712
|
+
let s = 3;
|
|
1713
|
+
for await (let i of e) {
|
|
1714
|
+
i = i.replace(/\n/g, `
|
|
1715
|
+
${ze}`), i.includes(`
|
|
1716
|
+
`) && (s = 3 + stripVTControlCharacters(i.slice(i.lastIndexOf(`
|
|
1717
|
+
`))).length);
|
|
1718
|
+
const n = stripVTControlCharacters(i).length;
|
|
1719
|
+
s + n < process.stdout.columns ? (s += n, process.stdout.write(i)) : (process.stdout.write(`
|
|
1720
|
+
${ze}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length);
|
|
1721
|
+
}
|
|
1722
|
+
process.stdout.write(`
|
|
1723
|
+
`);
|
|
1724
|
+
},
|
|
1725
|
+
info: (e) => H$1.message(e, { symbol: import_picocolors.default.blue(ge) }),
|
|
1726
|
+
success: (e) => H$1.message(e, { symbol: import_picocolors.default.green(fe) }),
|
|
1727
|
+
step: (e) => H$1.message(e, { symbol: import_picocolors.default.green(k$1) }),
|
|
1728
|
+
warn: (e) => H$1.message(e, { symbol: import_picocolors.default.yellow(Fe) }),
|
|
1729
|
+
warning: (e) => H$1.warn(e),
|
|
1730
|
+
error: (e) => H$1.message(e, { symbol: import_picocolors.default.red(ye) })
|
|
1731
|
+
}, Xt = async (e, r) => {
|
|
1732
|
+
for (const s of e) {
|
|
1733
|
+
if (s.enabled === !1) continue;
|
|
1734
|
+
const i = Ie(r);
|
|
1735
|
+
i.start(s.title);
|
|
1736
|
+
const n = await s.task(i.message);
|
|
1737
|
+
i.stop(n || s.title);
|
|
1738
|
+
}
|
|
1739
|
+
}, Yt = (e) => e.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, ""), zt = (e) => {
|
|
1740
|
+
const r = e.output ?? process.stdout, s = rt(r), i = import_picocolors.default.gray(h$1), n = e.spacing ?? 1, o = 3, u$1 = e.retainLog === !0, l$1 = !ue() && Te(r);
|
|
1741
|
+
r.write(`${i}
|
|
1742
|
+
`), r.write(`${import_picocolors.default.green(k$1)} ${e.title}
|
|
1743
|
+
`);
|
|
1744
|
+
for (let m$1 = 0; m$1 < n; m$1++) r.write(`${i}
|
|
1745
|
+
`);
|
|
1746
|
+
const a = [{
|
|
1747
|
+
value: "",
|
|
1748
|
+
full: ""
|
|
1749
|
+
}];
|
|
1750
|
+
let d$1 = !1;
|
|
1751
|
+
const g$1 = (m$1) => {
|
|
1752
|
+
if (a.length === 0) return;
|
|
1753
|
+
let f$1 = 0;
|
|
1754
|
+
m$1 && (f$1 += n + 2);
|
|
1755
|
+
for (const F$1 of a) {
|
|
1756
|
+
const { value: v$1, result: S$2 } = F$1;
|
|
1757
|
+
let B$1 = S$2?.message ?? v$1;
|
|
1758
|
+
if (B$1.length === 0) continue;
|
|
1759
|
+
S$2 === void 0 && F$1.header !== void 0 && F$1.header !== "" && (B$1 += `
|
|
1760
|
+
${F$1.header}`);
|
|
1761
|
+
const b$1 = B$1.split(`
|
|
1762
|
+
`).reduce((A$1, C$1) => C$1 === "" ? A$1 + 1 : A$1 + Math.ceil((C$1.length + o) / s), 0);
|
|
1763
|
+
f$1 += b$1;
|
|
1764
|
+
}
|
|
1765
|
+
f$1 > 0 && (f$1 += 1, r.write(import_src.erase.lines(f$1)));
|
|
1766
|
+
}, E$1 = (m$1, f$1, F$1) => {
|
|
1767
|
+
const v$1 = F$1 ? `${m$1.full}
|
|
1768
|
+
${m$1.value}` : m$1.value;
|
|
1769
|
+
m$1.header !== void 0 && m$1.header !== "" && R$1.message(m$1.header.split(`
|
|
1770
|
+
`).map(import_picocolors.default.bold), {
|
|
1771
|
+
output: r,
|
|
1772
|
+
secondarySymbol: i,
|
|
1773
|
+
symbol: i,
|
|
1774
|
+
spacing: 0
|
|
1775
|
+
}), R$1.message(v$1.split(`
|
|
1776
|
+
`).map(import_picocolors.default.dim), {
|
|
1777
|
+
output: r,
|
|
1778
|
+
secondarySymbol: i,
|
|
1779
|
+
symbol: i,
|
|
1780
|
+
spacing: f$1 ?? n
|
|
1781
|
+
});
|
|
1782
|
+
}, p$1 = () => {
|
|
1783
|
+
for (const m$1 of a) {
|
|
1784
|
+
const { header: f$1, value: F$1, full: v$1 } = m$1;
|
|
1785
|
+
(f$1 === void 0 || f$1.length === 0) && F$1.length === 0 || E$1(m$1, void 0, u$1 === !0 && v$1.length > 0);
|
|
1786
|
+
}
|
|
1787
|
+
}, y$2 = (m$1, f$1, F$1) => {
|
|
1788
|
+
if (g$1(!1), (F$1?.raw !== !0 || !d$1) && m$1.value !== "" && (m$1.value += `
|
|
1789
|
+
`), m$1.value += Yt(f$1), d$1 = F$1?.raw === !0, e.limit !== void 0) {
|
|
1790
|
+
const v$1 = m$1.value.split(`
|
|
1791
|
+
`), S$2 = v$1.length - e.limit;
|
|
1792
|
+
if (S$2 > 0) {
|
|
1793
|
+
const B$1 = v$1.splice(0, S$2);
|
|
1794
|
+
u$1 && (m$1.full += (m$1.full === "" ? "" : `
|
|
1795
|
+
`) + B$1.join(`
|
|
1796
|
+
`));
|
|
1797
|
+
}
|
|
1798
|
+
m$1.value = v$1.join(`
|
|
1799
|
+
`);
|
|
1800
|
+
}
|
|
1801
|
+
l$1 && $();
|
|
1802
|
+
}, $ = () => {
|
|
1803
|
+
for (const m$1 of a) m$1.result ? m$1.result.status === "error" ? R$1.error(m$1.result.message, {
|
|
1804
|
+
output: r,
|
|
1805
|
+
secondarySymbol: i,
|
|
1806
|
+
spacing: 0
|
|
1807
|
+
}) : R$1.success(m$1.result.message, {
|
|
1808
|
+
output: r,
|
|
1809
|
+
secondarySymbol: i,
|
|
1810
|
+
spacing: 0
|
|
1811
|
+
}) : m$1.value !== "" && E$1(m$1, 0);
|
|
1812
|
+
}, c$1 = (m$1, f$1) => {
|
|
1813
|
+
g$1(!1), m$1.result = f$1, l$1 && $();
|
|
1814
|
+
};
|
|
1815
|
+
return {
|
|
1816
|
+
message(m$1, f$1) {
|
|
1817
|
+
y$2(a[0], m$1, f$1);
|
|
1818
|
+
},
|
|
1819
|
+
group(m$1) {
|
|
1820
|
+
const f$1 = {
|
|
1821
|
+
header: m$1,
|
|
1822
|
+
value: "",
|
|
1823
|
+
full: ""
|
|
1824
|
+
};
|
|
1825
|
+
return a.push(f$1), {
|
|
1826
|
+
message(F$1, v$1) {
|
|
1827
|
+
y$2(f$1, F$1, v$1);
|
|
1828
|
+
},
|
|
1829
|
+
error(F$1) {
|
|
1830
|
+
c$1(f$1, {
|
|
1831
|
+
status: "error",
|
|
1832
|
+
message: F$1
|
|
1833
|
+
});
|
|
1834
|
+
},
|
|
1835
|
+
success(F$1) {
|
|
1836
|
+
c$1(f$1, {
|
|
1837
|
+
status: "success",
|
|
1838
|
+
message: F$1
|
|
1839
|
+
});
|
|
1840
|
+
}
|
|
1841
|
+
};
|
|
1842
|
+
},
|
|
1843
|
+
error(m$1, f$1) {
|
|
1844
|
+
g$1(!0), R$1.error(m$1, {
|
|
1845
|
+
output: r,
|
|
1846
|
+
secondarySymbol: i,
|
|
1847
|
+
spacing: 1
|
|
1848
|
+
}), f$1?.showLog !== !1 && p$1(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
|
|
1849
|
+
},
|
|
1850
|
+
success(m$1, f$1) {
|
|
1851
|
+
g$1(!0), R$1.success(m$1, {
|
|
1852
|
+
output: r,
|
|
1853
|
+
secondarySymbol: i,
|
|
1854
|
+
spacing: 1
|
|
1855
|
+
}), f$1?.showLog === !0 && p$1(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
|
|
1856
|
+
}
|
|
1857
|
+
};
|
|
1858
|
+
}, Qt = (e) => new $t({
|
|
1859
|
+
validate: e.validate,
|
|
1860
|
+
placeholder: e.placeholder,
|
|
1861
|
+
defaultValue: e.defaultValue,
|
|
1862
|
+
initialValue: e.initialValue,
|
|
1863
|
+
output: e.output,
|
|
1864
|
+
signal: e.signal,
|
|
1865
|
+
input: e.input,
|
|
1866
|
+
render() {
|
|
1867
|
+
const r = (e?.withGuide ?? _$1.withGuide) !== !1, s = `${`${r ? `${import_picocolors.default.gray(h$1)}
|
|
1868
|
+
` : ""}${N$1(this.state)} `}${e.message}
|
|
1869
|
+
`, i = e.placeholder ? import_picocolors.default.inverse(e.placeholder[0]) + import_picocolors.default.dim(e.placeholder.slice(1)) : import_picocolors.default.inverse(import_picocolors.default.hidden("_")), n = this.userInput ? this.userInputWithCursor : i, o = this.value ?? "";
|
|
1870
|
+
switch (this.state) {
|
|
1871
|
+
case "error": {
|
|
1872
|
+
const u$1 = this.error ? ` ${import_picocolors.default.yellow(this.error)}` : "", l$1 = r ? `${import_picocolors.default.yellow(h$1)} ` : "", a = r ? import_picocolors.default.yellow(x$1) : "";
|
|
1873
|
+
return `${s.trim()}
|
|
1874
|
+
${l$1}${n}
|
|
1875
|
+
${a}${u$1}
|
|
1876
|
+
`;
|
|
1877
|
+
}
|
|
1878
|
+
case "submit": {
|
|
1879
|
+
const u$1 = o ? ` ${import_picocolors.default.dim(o)}` : "";
|
|
1880
|
+
return `${s}${r ? import_picocolors.default.gray(h$1) : ""}${u$1}`;
|
|
1881
|
+
}
|
|
1882
|
+
case "cancel": {
|
|
1883
|
+
const u$1 = o ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(o))}` : "", l$1 = r ? import_picocolors.default.gray(h$1) : "";
|
|
1884
|
+
return `${s}${l$1}${u$1}${o.trim() ? `
|
|
1885
|
+
${l$1}` : ""}`;
|
|
1886
|
+
}
|
|
1887
|
+
default: return `${s}${r ? `${import_picocolors.default.cyan(h$1)} ` : ""}${n}
|
|
1888
|
+
${r ? import_picocolors.default.cyan(x$1) : ""}
|
|
1889
|
+
`;
|
|
1890
|
+
}
|
|
1891
|
+
}
|
|
1892
|
+
}).prompt();
|
|
1893
|
+
|
|
1894
|
+
//#endregion
|
|
1895
|
+
//#region ../../node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.js
|
|
1896
|
+
var l = Object.create;
|
|
1897
|
+
var u = Object.defineProperty;
|
|
1898
|
+
var d = Object.getOwnPropertyDescriptor;
|
|
1899
|
+
var f = Object.getOwnPropertyNames;
|
|
1900
|
+
var p = Object.getPrototypeOf;
|
|
1901
|
+
var m = Object.prototype.hasOwnProperty;
|
|
1902
|
+
var h = (e, t$1) => () => (t$1 || e((t$1 = { exports: {} }).exports, t$1), t$1.exports);
|
|
1903
|
+
var g = (e, t$1, n, r) => {
|
|
1904
|
+
if (t$1 && typeof t$1 === "object" || typeof t$1 === "function") for (var i = f(t$1), a = 0, o = i.length, s; a < o; a++) {
|
|
1905
|
+
s = i[a];
|
|
1906
|
+
if (!m.call(e, s) && s !== n) u(e, s, {
|
|
1907
|
+
get: ((e$1) => t$1[e$1]).bind(null, s),
|
|
1908
|
+
enumerable: !(r = d(t$1, s)) || r.enumerable
|
|
1909
|
+
});
|
|
1910
|
+
}
|
|
1911
|
+
return e;
|
|
1912
|
+
};
|
|
1913
|
+
var _ = (e, t$1, n) => (n = e != null ? l(p(e)) : {}, g(t$1 || !e || !e.__esModule ? u(n, "default", {
|
|
1914
|
+
value: e,
|
|
1915
|
+
enumerable: true
|
|
1916
|
+
}) : n, e));
|
|
1917
|
+
var v = /* @__PURE__ */ createRequire$1(import.meta.url);
|
|
1918
|
+
const y = /^path$/i;
|
|
1919
|
+
const b = {
|
|
1920
|
+
key: "PATH",
|
|
1921
|
+
value: ""
|
|
1922
|
+
};
|
|
1923
|
+
function x(e) {
|
|
1924
|
+
for (const t$1 in e) {
|
|
1925
|
+
if (!Object.prototype.hasOwnProperty.call(e, t$1) || !y.test(t$1)) continue;
|
|
1926
|
+
const n = e[t$1];
|
|
1927
|
+
if (!n) return b;
|
|
1928
|
+
return {
|
|
1929
|
+
key: t$1,
|
|
1930
|
+
value: n
|
|
1931
|
+
};
|
|
1932
|
+
}
|
|
1933
|
+
return b;
|
|
110
1934
|
}
|
|
111
|
-
function
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
|
|
1935
|
+
function S(e, t$1) {
|
|
1936
|
+
const i = t$1.value.split(delimiter);
|
|
1937
|
+
let o = e;
|
|
1938
|
+
let s;
|
|
1939
|
+
do {
|
|
1940
|
+
i.push(resolve(o, "node_modules", ".bin"));
|
|
1941
|
+
s = o;
|
|
1942
|
+
o = dirname(o);
|
|
1943
|
+
} while (o !== s);
|
|
1944
|
+
return {
|
|
1945
|
+
key: t$1.key,
|
|
1946
|
+
value: i.join(delimiter)
|
|
1947
|
+
};
|
|
1948
|
+
}
|
|
1949
|
+
function C(e, t$1) {
|
|
1950
|
+
const n = {
|
|
1951
|
+
...process.env,
|
|
1952
|
+
...t$1
|
|
1953
|
+
};
|
|
1954
|
+
const r = S(e, x(n));
|
|
1955
|
+
n[r.key] = r.value;
|
|
1956
|
+
return n;
|
|
1957
|
+
}
|
|
1958
|
+
const w = (e) => {
|
|
1959
|
+
let t$1 = e.length;
|
|
1960
|
+
const n = new PassThrough();
|
|
1961
|
+
const r = () => {
|
|
1962
|
+
if (--t$1 === 0) n.emit("end");
|
|
1963
|
+
};
|
|
1964
|
+
for (const t$2 of e) {
|
|
1965
|
+
t$2.pipe(n, { end: false });
|
|
1966
|
+
t$2.on("end", r);
|
|
1967
|
+
}
|
|
1968
|
+
return n;
|
|
1969
|
+
};
|
|
1970
|
+
var T = h((exports$1, t$1) => {
|
|
1971
|
+
t$1.exports = a;
|
|
1972
|
+
a.sync = o;
|
|
1973
|
+
var n = v("fs");
|
|
1974
|
+
function r(e, t$2) {
|
|
1975
|
+
var n$1 = t$2.pathExt !== void 0 ? t$2.pathExt : process.env.PATHEXT;
|
|
1976
|
+
if (!n$1) return true;
|
|
1977
|
+
n$1 = n$1.split(";");
|
|
1978
|
+
if (n$1.indexOf("") !== -1) return true;
|
|
1979
|
+
for (var r$1 = 0; r$1 < n$1.length; r$1++) {
|
|
1980
|
+
var i$1 = n$1[r$1].toLowerCase();
|
|
1981
|
+
if (i$1 && e.substr(-i$1.length).toLowerCase() === i$1) return true;
|
|
1982
|
+
}
|
|
1983
|
+
return false;
|
|
1984
|
+
}
|
|
1985
|
+
function i(e, t$2, n$1) {
|
|
1986
|
+
if (!e.isSymbolicLink() && !e.isFile()) return false;
|
|
1987
|
+
return r(t$2, n$1);
|
|
1988
|
+
}
|
|
1989
|
+
function a(e, t$2, r$1) {
|
|
1990
|
+
n.stat(e, function(n$1, a$1) {
|
|
1991
|
+
r$1(n$1, n$1 ? false : i(a$1, e, t$2));
|
|
1992
|
+
});
|
|
1993
|
+
}
|
|
1994
|
+
function o(e, t$2) {
|
|
1995
|
+
return i(n.statSync(e), e, t$2);
|
|
1996
|
+
}
|
|
1997
|
+
});
|
|
1998
|
+
var E = h((exports$1, t$1) => {
|
|
1999
|
+
t$1.exports = r;
|
|
2000
|
+
r.sync = i;
|
|
2001
|
+
var n = v("fs");
|
|
2002
|
+
function r(e, t$2, r$1) {
|
|
2003
|
+
n.stat(e, function(e$1, n$1) {
|
|
2004
|
+
r$1(e$1, e$1 ? false : a(n$1, t$2));
|
|
2005
|
+
});
|
|
2006
|
+
}
|
|
2007
|
+
function i(e, t$2) {
|
|
2008
|
+
return a(n.statSync(e), t$2);
|
|
2009
|
+
}
|
|
2010
|
+
function a(e, t$2) {
|
|
2011
|
+
return e.isFile() && o(e, t$2);
|
|
2012
|
+
}
|
|
2013
|
+
function o(e, t$2) {
|
|
2014
|
+
var n$1 = e.mode;
|
|
2015
|
+
var r$1 = e.uid;
|
|
2016
|
+
var i$1 = e.gid;
|
|
2017
|
+
var a$1 = t$2.uid !== void 0 ? t$2.uid : process.getuid && process.getuid();
|
|
2018
|
+
var o$1 = t$2.gid !== void 0 ? t$2.gid : process.getgid && process.getgid();
|
|
2019
|
+
var s = parseInt("100", 8);
|
|
2020
|
+
var c$1 = parseInt("010", 8);
|
|
2021
|
+
var l$1 = parseInt("001", 8);
|
|
2022
|
+
var u$1 = s | c$1;
|
|
2023
|
+
return n$1 & l$1 || n$1 & c$1 && i$1 === o$1 || n$1 & s && r$1 === a$1 || n$1 & u$1 && a$1 === 0;
|
|
2024
|
+
}
|
|
2025
|
+
});
|
|
2026
|
+
var D = h((exports$1, t$1) => {
|
|
2027
|
+
v("fs");
|
|
2028
|
+
var r;
|
|
2029
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) r = T();
|
|
2030
|
+
else r = E();
|
|
2031
|
+
t$1.exports = i;
|
|
2032
|
+
i.sync = a;
|
|
2033
|
+
function i(e, t$2, n) {
|
|
2034
|
+
if (typeof t$2 === "function") {
|
|
2035
|
+
n = t$2;
|
|
2036
|
+
t$2 = {};
|
|
2037
|
+
}
|
|
2038
|
+
if (!n) {
|
|
2039
|
+
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
2040
|
+
return new Promise(function(n$1, r$1) {
|
|
2041
|
+
i(e, t$2 || {}, function(e$1, t$3) {
|
|
2042
|
+
if (e$1) r$1(e$1);
|
|
2043
|
+
else n$1(t$3);
|
|
2044
|
+
});
|
|
2045
|
+
});
|
|
2046
|
+
}
|
|
2047
|
+
r(e, t$2 || {}, function(e$1, r$1) {
|
|
2048
|
+
if (e$1) {
|
|
2049
|
+
if (e$1.code === "EACCES" || t$2 && t$2.ignoreErrors) {
|
|
2050
|
+
e$1 = null;
|
|
2051
|
+
r$1 = false;
|
|
2052
|
+
}
|
|
2053
|
+
}
|
|
2054
|
+
n(e$1, r$1);
|
|
2055
|
+
});
|
|
2056
|
+
}
|
|
2057
|
+
function a(e, t$2) {
|
|
2058
|
+
try {
|
|
2059
|
+
return r.sync(e, t$2 || {});
|
|
2060
|
+
} catch (e$1) {
|
|
2061
|
+
if (t$2 && t$2.ignoreErrors || e$1.code === "EACCES") return false;
|
|
2062
|
+
else throw e$1;
|
|
2063
|
+
}
|
|
2064
|
+
}
|
|
2065
|
+
});
|
|
2066
|
+
var O = h((exports$1, t$1) => {
|
|
2067
|
+
const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
2068
|
+
const r = v("path");
|
|
2069
|
+
const i = n ? ";" : ":";
|
|
2070
|
+
const a = D();
|
|
2071
|
+
const o = (e) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), { code: "ENOENT" });
|
|
2072
|
+
const s = (e, t$2) => {
|
|
2073
|
+
const r$1 = t$2.colon || i;
|
|
2074
|
+
const a$1 = e.match(/\//) || n && e.match(/\\/) ? [""] : [...n ? [process.cwd()] : [], ...(t$2.path || process.env.PATH || "").split(r$1)];
|
|
2075
|
+
const o$1 = n ? t$2.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
2076
|
+
const s$1 = n ? o$1.split(r$1) : [""];
|
|
2077
|
+
if (n) {
|
|
2078
|
+
if (e.indexOf(".") !== -1 && s$1[0] !== "") s$1.unshift("");
|
|
2079
|
+
}
|
|
115
2080
|
return {
|
|
116
|
-
|
|
117
|
-
|
|
2081
|
+
pathEnv: a$1,
|
|
2082
|
+
pathExt: s$1,
|
|
2083
|
+
pathExtExe: o$1
|
|
118
2084
|
};
|
|
2085
|
+
};
|
|
2086
|
+
const c$1 = (e, t$2, n$1) => {
|
|
2087
|
+
if (typeof t$2 === "function") {
|
|
2088
|
+
n$1 = t$2;
|
|
2089
|
+
t$2 = {};
|
|
2090
|
+
}
|
|
2091
|
+
if (!t$2) t$2 = {};
|
|
2092
|
+
const { pathEnv: i$1, pathExt: c$2, pathExtExe: l$2 } = s(e, t$2);
|
|
2093
|
+
const u$1 = [];
|
|
2094
|
+
const d$1 = (n$2) => new Promise((a$1, s$1) => {
|
|
2095
|
+
if (n$2 === i$1.length) return t$2.all && u$1.length ? a$1(u$1) : s$1(o(e));
|
|
2096
|
+
const c$3 = i$1[n$2];
|
|
2097
|
+
const l$3 = /^".*"$/.test(c$3) ? c$3.slice(1, -1) : c$3;
|
|
2098
|
+
const d$2 = r.join(l$3, e);
|
|
2099
|
+
a$1(f$1(!l$3 && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d$2 : d$2, n$2, 0));
|
|
2100
|
+
});
|
|
2101
|
+
const f$1 = (e$1, n$2, r$1) => new Promise((i$2, o$1) => {
|
|
2102
|
+
if (r$1 === c$2.length) return i$2(d$1(n$2 + 1));
|
|
2103
|
+
const s$1 = c$2[r$1];
|
|
2104
|
+
a(e$1 + s$1, { pathExt: l$2 }, (a$1, o$2) => {
|
|
2105
|
+
if (!a$1 && o$2) if (t$2.all) u$1.push(e$1 + s$1);
|
|
2106
|
+
else return i$2(e$1 + s$1);
|
|
2107
|
+
return i$2(f$1(e$1, n$2, r$1 + 1));
|
|
2108
|
+
});
|
|
2109
|
+
});
|
|
2110
|
+
return n$1 ? d$1(0).then((e$1) => n$1(null, e$1), n$1) : d$1(0);
|
|
2111
|
+
};
|
|
2112
|
+
const l$1 = (e, t$2) => {
|
|
2113
|
+
t$2 = t$2 || {};
|
|
2114
|
+
const { pathEnv: n$1, pathExt: i$1, pathExtExe: c$2 } = s(e, t$2);
|
|
2115
|
+
const l$2 = [];
|
|
2116
|
+
for (let o$1 = 0; o$1 < n$1.length; o$1++) {
|
|
2117
|
+
const s$1 = n$1[o$1];
|
|
2118
|
+
const u$1 = /^".*"$/.test(s$1) ? s$1.slice(1, -1) : s$1;
|
|
2119
|
+
const d$1 = r.join(u$1, e);
|
|
2120
|
+
const f$1 = !u$1 && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d$1 : d$1;
|
|
2121
|
+
for (let e$1 = 0; e$1 < i$1.length; e$1++) {
|
|
2122
|
+
const n$2 = f$1 + i$1[e$1];
|
|
2123
|
+
try {
|
|
2124
|
+
if (a.sync(n$2, { pathExt: c$2 })) if (t$2.all) l$2.push(n$2);
|
|
2125
|
+
else return n$2;
|
|
2126
|
+
} catch (e$2) {}
|
|
2127
|
+
}
|
|
2128
|
+
}
|
|
2129
|
+
if (t$2.all && l$2.length) return l$2;
|
|
2130
|
+
if (t$2.nothrow) return null;
|
|
2131
|
+
throw o(e);
|
|
2132
|
+
};
|
|
2133
|
+
t$1.exports = c$1;
|
|
2134
|
+
c$1.sync = l$1;
|
|
2135
|
+
});
|
|
2136
|
+
var k = h((exports$1, t$1) => {
|
|
2137
|
+
const n = (e = {}) => {
|
|
2138
|
+
const t$2 = e.env || process.env;
|
|
2139
|
+
if ((e.platform || process.platform) !== "win32") return "PATH";
|
|
2140
|
+
return Object.keys(t$2).reverse().find((e$1) => e$1.toUpperCase() === "PATH") || "Path";
|
|
2141
|
+
};
|
|
2142
|
+
t$1.exports = n;
|
|
2143
|
+
t$1.exports.default = n;
|
|
2144
|
+
});
|
|
2145
|
+
var A = h((exports$1, t$1) => {
|
|
2146
|
+
const n = v("path");
|
|
2147
|
+
const r = O();
|
|
2148
|
+
const i = k();
|
|
2149
|
+
function a(e, t$2) {
|
|
2150
|
+
const a$1 = e.options.env || process.env;
|
|
2151
|
+
const o$1 = process.cwd();
|
|
2152
|
+
const s = e.options.cwd != null;
|
|
2153
|
+
const c$1 = s && process.chdir !== void 0 && !process.chdir.disabled;
|
|
2154
|
+
if (c$1) try {
|
|
2155
|
+
process.chdir(e.options.cwd);
|
|
2156
|
+
} catch (e$1) {}
|
|
2157
|
+
let l$1;
|
|
2158
|
+
try {
|
|
2159
|
+
l$1 = r.sync(e.command, {
|
|
2160
|
+
path: a$1[i({ env: a$1 })],
|
|
2161
|
+
pathExt: t$2 ? n.delimiter : void 0
|
|
2162
|
+
});
|
|
2163
|
+
} catch (e$1) {} finally {
|
|
2164
|
+
if (c$1) process.chdir(o$1);
|
|
2165
|
+
}
|
|
2166
|
+
if (l$1) l$1 = n.resolve(s ? e.options.cwd : "", l$1);
|
|
2167
|
+
return l$1;
|
|
2168
|
+
}
|
|
2169
|
+
function o(e) {
|
|
2170
|
+
return a(e) || a(e, true);
|
|
2171
|
+
}
|
|
2172
|
+
t$1.exports = o;
|
|
2173
|
+
});
|
|
2174
|
+
var j = h((exports$1, t$1) => {
|
|
2175
|
+
const n = /([()\][%!^"`<>&|;, *?])/g;
|
|
2176
|
+
function r(e) {
|
|
2177
|
+
e = e.replace(n, "^$1");
|
|
2178
|
+
return e;
|
|
119
2179
|
}
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
2180
|
+
function i(e, t$2) {
|
|
2181
|
+
e = `${e}`;
|
|
2182
|
+
e = e.replace(/(\\*)"/g, "$1$1\\\"");
|
|
2183
|
+
e = e.replace(/(\\*)$/, "$1$1");
|
|
2184
|
+
e = `"${e}"`;
|
|
2185
|
+
e = e.replace(n, "^$1");
|
|
2186
|
+
if (t$2) e = e.replace(n, "^$1");
|
|
2187
|
+
return e;
|
|
2188
|
+
}
|
|
2189
|
+
t$1.exports.command = r;
|
|
2190
|
+
t$1.exports.argument = i;
|
|
2191
|
+
});
|
|
2192
|
+
var M = h((exports$1, t$1) => {
|
|
2193
|
+
t$1.exports = /^#!(.*)/;
|
|
2194
|
+
});
|
|
2195
|
+
var N = h((exports$1, t$1) => {
|
|
2196
|
+
const n = M();
|
|
2197
|
+
t$1.exports = (e = "") => {
|
|
2198
|
+
const t$2 = e.match(n);
|
|
2199
|
+
if (!t$2) return null;
|
|
2200
|
+
const [r, i] = t$2[0].replace(/#! ?/, "").split(" ");
|
|
2201
|
+
const a = r.split("/").pop();
|
|
2202
|
+
if (a === "env") return i;
|
|
2203
|
+
return i ? `${a} ${i}` : a;
|
|
2204
|
+
};
|
|
2205
|
+
});
|
|
2206
|
+
var P = h((exports$1, t$1) => {
|
|
2207
|
+
const n = v("fs");
|
|
2208
|
+
const r = N();
|
|
2209
|
+
function i(e) {
|
|
2210
|
+
const t$2 = 150;
|
|
2211
|
+
const i$1 = Buffer.alloc(t$2);
|
|
2212
|
+
let a;
|
|
2213
|
+
try {
|
|
2214
|
+
a = n.openSync(e, "r");
|
|
2215
|
+
n.readSync(a, i$1, 0, t$2, 0);
|
|
2216
|
+
n.closeSync(a);
|
|
2217
|
+
} catch (e$1) {}
|
|
2218
|
+
return r(i$1.toString());
|
|
2219
|
+
}
|
|
2220
|
+
t$1.exports = i;
|
|
2221
|
+
});
|
|
2222
|
+
var F = h((exports$1, t$1) => {
|
|
2223
|
+
const n = v("path");
|
|
2224
|
+
const r = A();
|
|
2225
|
+
const i = j();
|
|
2226
|
+
const a = P();
|
|
2227
|
+
const o = process.platform === "win32";
|
|
2228
|
+
const s = /\.(?:com|exe)$/i;
|
|
2229
|
+
const c$1 = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
2230
|
+
function l$1(e) {
|
|
2231
|
+
e.file = r(e);
|
|
2232
|
+
const t$2 = e.file && a(e.file);
|
|
2233
|
+
if (t$2) {
|
|
2234
|
+
e.args.unshift(e.file);
|
|
2235
|
+
e.command = t$2;
|
|
2236
|
+
return r(e);
|
|
2237
|
+
}
|
|
2238
|
+
return e.file;
|
|
2239
|
+
}
|
|
2240
|
+
function u$1(e) {
|
|
2241
|
+
if (!o) return e;
|
|
2242
|
+
const t$2 = l$1(e);
|
|
2243
|
+
const r$1 = !s.test(t$2);
|
|
2244
|
+
if (e.options.forceShell || r$1) {
|
|
2245
|
+
const r$2 = c$1.test(t$2);
|
|
2246
|
+
e.command = n.normalize(e.command);
|
|
2247
|
+
e.command = i.command(e.command);
|
|
2248
|
+
e.args = e.args.map((e$1) => i.argument(e$1, r$2));
|
|
2249
|
+
e.args = [
|
|
2250
|
+
"/d",
|
|
2251
|
+
"/s",
|
|
2252
|
+
"/c",
|
|
2253
|
+
`"${[e.command].concat(e.args).join(" ")}"`
|
|
2254
|
+
];
|
|
2255
|
+
e.command = process.env.comspec || "cmd.exe";
|
|
2256
|
+
e.options.windowsVerbatimArguments = true;
|
|
2257
|
+
}
|
|
2258
|
+
return e;
|
|
2259
|
+
}
|
|
2260
|
+
function d$1(e, t$2, n$1) {
|
|
2261
|
+
if (t$2 && !Array.isArray(t$2)) {
|
|
2262
|
+
n$1 = t$2;
|
|
2263
|
+
t$2 = null;
|
|
2264
|
+
}
|
|
2265
|
+
t$2 = t$2 ? t$2.slice(0) : [];
|
|
2266
|
+
n$1 = Object.assign({}, n$1);
|
|
2267
|
+
const r$1 = {
|
|
2268
|
+
command: e,
|
|
2269
|
+
args: t$2,
|
|
2270
|
+
options: n$1,
|
|
2271
|
+
file: void 0,
|
|
2272
|
+
original: {
|
|
2273
|
+
command: e,
|
|
2274
|
+
args: t$2
|
|
2275
|
+
}
|
|
2276
|
+
};
|
|
2277
|
+
return n$1.shell ? r$1 : u$1(r$1);
|
|
2278
|
+
}
|
|
2279
|
+
t$1.exports = d$1;
|
|
2280
|
+
});
|
|
2281
|
+
var I = h((exports$1, t$1) => {
|
|
2282
|
+
const n = process.platform === "win32";
|
|
2283
|
+
function r(e, t$2) {
|
|
2284
|
+
return Object.assign(/* @__PURE__ */ new Error(`${t$2} ${e.command} ENOENT`), {
|
|
2285
|
+
code: "ENOENT",
|
|
2286
|
+
errno: "ENOENT",
|
|
2287
|
+
syscall: `${t$2} ${e.command}`,
|
|
2288
|
+
path: e.command,
|
|
2289
|
+
spawnargs: e.args
|
|
2290
|
+
});
|
|
2291
|
+
}
|
|
2292
|
+
function i(e, t$2) {
|
|
2293
|
+
if (!n) return;
|
|
2294
|
+
const r$1 = e.emit;
|
|
2295
|
+
e.emit = function(n$1, i$1) {
|
|
2296
|
+
if (n$1 === "exit") {
|
|
2297
|
+
const n$2 = a(i$1, t$2, "spawn");
|
|
2298
|
+
if (n$2) return r$1.call(e, "error", n$2);
|
|
2299
|
+
}
|
|
2300
|
+
return r$1.apply(e, arguments);
|
|
2301
|
+
};
|
|
2302
|
+
}
|
|
2303
|
+
function a(e, t$2) {
|
|
2304
|
+
if (n && e === 1 && !t$2.file) return r(t$2.original, "spawn");
|
|
2305
|
+
return null;
|
|
2306
|
+
}
|
|
2307
|
+
function o(e, t$2) {
|
|
2308
|
+
if (n && e === 1 && !t$2.file) return r(t$2.original, "spawnSync");
|
|
2309
|
+
return null;
|
|
2310
|
+
}
|
|
2311
|
+
t$1.exports = {
|
|
2312
|
+
hookChildProcess: i,
|
|
2313
|
+
verifyENOENT: a,
|
|
2314
|
+
verifyENOENTSync: o,
|
|
2315
|
+
notFoundError: r
|
|
2316
|
+
};
|
|
2317
|
+
});
|
|
2318
|
+
var R = _(h((exports$1, t$1) => {
|
|
2319
|
+
const n = v("child_process");
|
|
2320
|
+
const r = F();
|
|
2321
|
+
const i = I();
|
|
2322
|
+
function a(e, t$2, a$1) {
|
|
2323
|
+
const o$1 = r(e, t$2, a$1);
|
|
2324
|
+
const s = n.spawn(o$1.command, o$1.args, o$1.options);
|
|
2325
|
+
i.hookChildProcess(s, o$1);
|
|
2326
|
+
return s;
|
|
2327
|
+
}
|
|
2328
|
+
function o(e, t$2, a$1) {
|
|
2329
|
+
const o$1 = r(e, t$2, a$1);
|
|
2330
|
+
const s = n.spawnSync(o$1.command, o$1.args, o$1.options);
|
|
2331
|
+
s.error = s.error || i.verifyENOENTSync(s.status, o$1);
|
|
2332
|
+
return s;
|
|
2333
|
+
}
|
|
2334
|
+
t$1.exports = a;
|
|
2335
|
+
t$1.exports.spawn = a;
|
|
2336
|
+
t$1.exports.sync = o;
|
|
2337
|
+
t$1.exports._parse = r;
|
|
2338
|
+
t$1.exports._enoent = i;
|
|
2339
|
+
})(), 1);
|
|
2340
|
+
var z = class extends Error {
|
|
2341
|
+
result;
|
|
2342
|
+
output;
|
|
2343
|
+
get exitCode() {
|
|
2344
|
+
if (this.result.exitCode !== null) return this.result.exitCode;
|
|
2345
|
+
}
|
|
2346
|
+
constructor(e, t$1) {
|
|
2347
|
+
super(`Process exited with non-zero status (${e.exitCode})`);
|
|
2348
|
+
this.result = e;
|
|
2349
|
+
this.output = t$1;
|
|
2350
|
+
}
|
|
2351
|
+
};
|
|
2352
|
+
const B = {
|
|
2353
|
+
timeout: void 0,
|
|
2354
|
+
persist: false
|
|
2355
|
+
};
|
|
2356
|
+
const V = { windowsHide: true };
|
|
2357
|
+
function H(e, t$1) {
|
|
2358
|
+
return {
|
|
2359
|
+
command: normalize(e),
|
|
2360
|
+
args: t$1 ?? []
|
|
123
2361
|
};
|
|
124
2362
|
}
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
2363
|
+
function U(e) {
|
|
2364
|
+
const t$1 = new AbortController();
|
|
2365
|
+
for (const n of e) {
|
|
2366
|
+
if (n.aborted) {
|
|
2367
|
+
t$1.abort();
|
|
2368
|
+
return n;
|
|
2369
|
+
}
|
|
2370
|
+
const e$1 = () => {
|
|
2371
|
+
t$1.abort(n.reason);
|
|
2372
|
+
};
|
|
2373
|
+
n.addEventListener("abort", e$1, { signal: t$1.signal });
|
|
2374
|
+
}
|
|
2375
|
+
return t$1.signal;
|
|
2376
|
+
}
|
|
2377
|
+
async function W(e) {
|
|
2378
|
+
let t$1 = "";
|
|
2379
|
+
for await (const n of e) t$1 += n.toString();
|
|
2380
|
+
return t$1;
|
|
2381
|
+
}
|
|
2382
|
+
var G = class {
|
|
2383
|
+
_process;
|
|
2384
|
+
_aborted = false;
|
|
2385
|
+
_options;
|
|
2386
|
+
_command;
|
|
2387
|
+
_args;
|
|
2388
|
+
_resolveClose;
|
|
2389
|
+
_processClosed;
|
|
2390
|
+
_thrownError;
|
|
2391
|
+
get process() {
|
|
2392
|
+
return this._process;
|
|
2393
|
+
}
|
|
2394
|
+
get pid() {
|
|
2395
|
+
return this._process?.pid;
|
|
2396
|
+
}
|
|
2397
|
+
get exitCode() {
|
|
2398
|
+
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
2399
|
+
}
|
|
2400
|
+
constructor(e, t$1, n) {
|
|
2401
|
+
this._options = {
|
|
2402
|
+
...B,
|
|
2403
|
+
...n
|
|
2404
|
+
};
|
|
2405
|
+
this._command = e;
|
|
2406
|
+
this._args = t$1 ?? [];
|
|
2407
|
+
this._processClosed = new Promise((e$1) => {
|
|
2408
|
+
this._resolveClose = e$1;
|
|
2409
|
+
});
|
|
2410
|
+
}
|
|
2411
|
+
kill(e) {
|
|
2412
|
+
return this._process?.kill(e) === true;
|
|
2413
|
+
}
|
|
2414
|
+
get aborted() {
|
|
2415
|
+
return this._aborted;
|
|
2416
|
+
}
|
|
2417
|
+
get killed() {
|
|
2418
|
+
return this._process?.killed === true;
|
|
2419
|
+
}
|
|
2420
|
+
pipe(e, t$1, n) {
|
|
2421
|
+
return q(e, t$1, {
|
|
2422
|
+
...n,
|
|
2423
|
+
stdin: this
|
|
2424
|
+
});
|
|
2425
|
+
}
|
|
2426
|
+
async *[Symbol.asyncIterator]() {
|
|
2427
|
+
const e = this._process;
|
|
2428
|
+
if (!e) return;
|
|
2429
|
+
const t$1 = [];
|
|
2430
|
+
if (this._streamErr) t$1.push(this._streamErr);
|
|
2431
|
+
if (this._streamOut) t$1.push(this._streamOut);
|
|
2432
|
+
const n = w(t$1);
|
|
2433
|
+
const r = c.createInterface({ input: n });
|
|
2434
|
+
for await (const e$1 of r) yield e$1.toString();
|
|
2435
|
+
await this._processClosed;
|
|
2436
|
+
e.removeAllListeners();
|
|
2437
|
+
if (this._thrownError) throw this._thrownError;
|
|
2438
|
+
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z(this);
|
|
2439
|
+
}
|
|
2440
|
+
async _waitForOutput() {
|
|
2441
|
+
const e = this._process;
|
|
2442
|
+
if (!e) throw new Error("No process was started");
|
|
2443
|
+
const [t$1, n] = await Promise.all([this._streamOut ? W(this._streamOut) : "", this._streamErr ? W(this._streamErr) : ""]);
|
|
2444
|
+
await this._processClosed;
|
|
2445
|
+
if (this._options?.stdin) await this._options.stdin;
|
|
2446
|
+
e.removeAllListeners();
|
|
2447
|
+
if (this._thrownError) throw this._thrownError;
|
|
2448
|
+
const r = {
|
|
2449
|
+
stderr: n,
|
|
2450
|
+
stdout: t$1,
|
|
2451
|
+
exitCode: this.exitCode
|
|
2452
|
+
};
|
|
2453
|
+
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z(this, r);
|
|
2454
|
+
return r;
|
|
2455
|
+
}
|
|
2456
|
+
then(e, t$1) {
|
|
2457
|
+
return this._waitForOutput().then(e, t$1);
|
|
2458
|
+
}
|
|
2459
|
+
_streamOut;
|
|
2460
|
+
_streamErr;
|
|
2461
|
+
spawn() {
|
|
2462
|
+
const e = cwd();
|
|
2463
|
+
const n = this._options;
|
|
2464
|
+
const r = {
|
|
2465
|
+
...V,
|
|
2466
|
+
...n.nodeOptions
|
|
2467
|
+
};
|
|
2468
|
+
const i = [];
|
|
2469
|
+
this._resetState();
|
|
2470
|
+
if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout));
|
|
2471
|
+
if (n.signal !== void 0) i.push(n.signal);
|
|
2472
|
+
if (n.persist === true) r.detached = true;
|
|
2473
|
+
if (i.length > 0) r.signal = U(i);
|
|
2474
|
+
r.env = C(e, r.env);
|
|
2475
|
+
const { command: a, args: s } = H(this._command, this._args);
|
|
2476
|
+
const c$1 = (0, R._parse)(a, s, r);
|
|
2477
|
+
const l$1 = spawn(c$1.command, c$1.args, c$1.options);
|
|
2478
|
+
if (l$1.stderr) this._streamErr = l$1.stderr;
|
|
2479
|
+
if (l$1.stdout) this._streamOut = l$1.stdout;
|
|
2480
|
+
this._process = l$1;
|
|
2481
|
+
l$1.once("error", this._onError);
|
|
2482
|
+
l$1.once("close", this._onClose);
|
|
2483
|
+
if (n.stdin !== void 0 && l$1.stdin && n.stdin.process) {
|
|
2484
|
+
const { stdout: e$1 } = n.stdin.process;
|
|
2485
|
+
if (e$1) e$1.pipe(l$1.stdin);
|
|
158
2486
|
}
|
|
159
|
-
}
|
|
160
|
-
|
|
2487
|
+
}
|
|
2488
|
+
_resetState() {
|
|
2489
|
+
this._aborted = false;
|
|
2490
|
+
this._processClosed = new Promise((e) => {
|
|
2491
|
+
this._resolveClose = e;
|
|
2492
|
+
});
|
|
2493
|
+
this._thrownError = void 0;
|
|
2494
|
+
}
|
|
2495
|
+
_onError = (e) => {
|
|
2496
|
+
if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) {
|
|
2497
|
+
this._aborted = true;
|
|
2498
|
+
return;
|
|
2499
|
+
}
|
|
2500
|
+
this._thrownError = e;
|
|
2501
|
+
};
|
|
2502
|
+
_onClose = () => {
|
|
2503
|
+
if (this._resolveClose) this._resolveClose();
|
|
2504
|
+
};
|
|
2505
|
+
};
|
|
2506
|
+
const K = (e, t$1, n) => {
|
|
2507
|
+
const r = new G(e, t$1, n);
|
|
2508
|
+
r.spawn();
|
|
2509
|
+
return r;
|
|
2510
|
+
};
|
|
2511
|
+
const q = K;
|
|
2512
|
+
|
|
2513
|
+
//#endregion
|
|
2514
|
+
//#region src/core/files.ts
|
|
2515
|
+
function getPackageJson(cwd$1) {
|
|
2516
|
+
const packageText = readFile(cwd$1, commonFilePaths.packageJson);
|
|
2517
|
+
if (!packageText) {
|
|
2518
|
+
const pkgPath = path.join(cwd$1, commonFilePaths.packageJson);
|
|
2519
|
+
throw new Error(`Invalid workspace: missing '${pkgPath}'`);
|
|
2520
|
+
}
|
|
2521
|
+
const { data, generateCode } = parse.json(packageText);
|
|
2522
|
+
return {
|
|
2523
|
+
source: packageText,
|
|
2524
|
+
data,
|
|
2525
|
+
generateCode
|
|
2526
|
+
};
|
|
161
2527
|
}
|
|
162
|
-
function
|
|
163
|
-
|
|
2528
|
+
async function formatFiles(options) {
|
|
2529
|
+
if (options.filesToFormat.length === 0) return;
|
|
2530
|
+
const { start, stop } = Ie();
|
|
2531
|
+
start("Formatting modified files");
|
|
2532
|
+
const args = [
|
|
2533
|
+
"prettier",
|
|
2534
|
+
"--write",
|
|
2535
|
+
"--ignore-unknown",
|
|
2536
|
+
...options.filesToFormat
|
|
2537
|
+
];
|
|
2538
|
+
const cmd = resolveCommand(options.packageManager, "execute-local", args);
|
|
2539
|
+
try {
|
|
2540
|
+
const result = await q(cmd.command, cmd.args, {
|
|
2541
|
+
nodeOptions: {
|
|
2542
|
+
cwd: options.cwd,
|
|
2543
|
+
stdio: "pipe"
|
|
2544
|
+
},
|
|
2545
|
+
throwOnError: true
|
|
2546
|
+
});
|
|
2547
|
+
if (result.exitCode !== 0) {
|
|
2548
|
+
stop("Failed to format files");
|
|
2549
|
+
R$1.error(result.stderr);
|
|
2550
|
+
return;
|
|
2551
|
+
}
|
|
2552
|
+
} catch (e) {
|
|
2553
|
+
stop("Failed to format files");
|
|
2554
|
+
R$1.error(e?.output?.stderr || "unknown error");
|
|
2555
|
+
return;
|
|
2556
|
+
}
|
|
2557
|
+
stop("Successfully formatted modified files");
|
|
164
2558
|
}
|
|
2559
|
+
function readFile(cwd$1, filePath) {
|
|
2560
|
+
const fullFilePath = path.resolve(cwd$1, filePath);
|
|
2561
|
+
if (!fileExists(cwd$1, filePath)) return "";
|
|
2562
|
+
return fs.readFileSync(fullFilePath, "utf8");
|
|
2563
|
+
}
|
|
2564
|
+
function installPackages(dependencies, workspace) {
|
|
2565
|
+
const { data, generateCode } = getPackageJson(workspace.cwd);
|
|
2566
|
+
for (const dependency of dependencies) if (dependency.dev) {
|
|
2567
|
+
data.devDependencies ??= {};
|
|
2568
|
+
data.devDependencies[dependency.pkg] = dependency.version;
|
|
2569
|
+
} else {
|
|
2570
|
+
data.dependencies ??= {};
|
|
2571
|
+
data.dependencies[dependency.pkg] = dependency.version;
|
|
2572
|
+
}
|
|
2573
|
+
if (data.dependencies) data.dependencies = alphabetizeProperties(data.dependencies);
|
|
2574
|
+
if (data.devDependencies) data.devDependencies = alphabetizeProperties(data.devDependencies);
|
|
2575
|
+
writeFile(workspace, commonFilePaths.packageJson, generateCode());
|
|
2576
|
+
return commonFilePaths.packageJson;
|
|
2577
|
+
}
|
|
2578
|
+
function alphabetizeProperties(obj) {
|
|
2579
|
+
const orderedObj = {};
|
|
2580
|
+
const sortedEntries = Object.entries(obj).sort(([a], [b$1]) => a.localeCompare(b$1));
|
|
2581
|
+
for (const [key, value] of sortedEntries) orderedObj[key] = value;
|
|
2582
|
+
return orderedObj;
|
|
2583
|
+
}
|
|
2584
|
+
function writeFile(workspace, filePath, content) {
|
|
2585
|
+
const fullFilePath = path.resolve(workspace.cwd, filePath);
|
|
2586
|
+
const fullDirectoryPath = path.dirname(fullFilePath);
|
|
2587
|
+
if (content && !content.endsWith("\n")) content += "\n";
|
|
2588
|
+
if (!fs.existsSync(fullDirectoryPath)) fs.mkdirSync(fullDirectoryPath, { recursive: true });
|
|
2589
|
+
fs.writeFileSync(fullFilePath, content, "utf8");
|
|
2590
|
+
}
|
|
2591
|
+
function fileExists(cwd$1, filePath) {
|
|
2592
|
+
const fullFilePath = path.resolve(cwd$1, filePath);
|
|
2593
|
+
return fs.existsSync(fullFilePath);
|
|
2594
|
+
}
|
|
2595
|
+
const commonFilePaths = {
|
|
2596
|
+
packageJson: "package.json",
|
|
2597
|
+
svelteConfig: "svelte.config.js",
|
|
2598
|
+
svelteConfigTS: "svelte.config.ts",
|
|
2599
|
+
jsconfig: "jsconfig.json",
|
|
2600
|
+
tsconfig: "tsconfig.json",
|
|
2601
|
+
viteConfig: "vite.config.js",
|
|
2602
|
+
viteConfigTS: "vite.config.ts"
|
|
2603
|
+
};
|
|
165
2604
|
|
|
166
2605
|
//#endregion
|
|
167
|
-
//#region
|
|
2606
|
+
//#region src/create/utils.ts
|
|
168
2607
|
function mkdirp(dir) {
|
|
169
2608
|
try {
|
|
170
2609
|
fs.mkdirSync(dir, { recursive: true });
|
|
@@ -174,8 +2613,8 @@ function mkdirp(dir) {
|
|
|
174
2613
|
throw e;
|
|
175
2614
|
}
|
|
176
2615
|
}
|
|
177
|
-
function identity(x) {
|
|
178
|
-
return x;
|
|
2616
|
+
function identity(x$3) {
|
|
2617
|
+
return x$3;
|
|
179
2618
|
}
|
|
180
2619
|
function replace(contents, kv$1) {
|
|
181
2620
|
for (const [key, value] of Object.entries(kv$1)) contents = contents.replaceAll(key, value);
|
|
@@ -216,27 +2655,7 @@ function getSharedFiles() {
|
|
|
216
2655
|
}
|
|
217
2656
|
|
|
218
2657
|
//#endregion
|
|
219
|
-
//#region
|
|
220
|
-
/**
|
|
221
|
-
* @param name - The name to sanitize.
|
|
222
|
-
* @param style - The sanitization style.
|
|
223
|
-
* - `package` for package.json
|
|
224
|
-
* - `wrangler` for Cloudflare Wrangler compatibility
|
|
225
|
-
* @returns The sanitized name.
|
|
226
|
-
*/
|
|
227
|
-
function sanitizeName(name, style) {
|
|
228
|
-
let sanitized = name.trim().toLowerCase().replace(/\s+/g, "-");
|
|
229
|
-
if (style === "package") {
|
|
230
|
-
const hasLeadingAt = sanitized.startsWith("@");
|
|
231
|
-
sanitized = sanitized.replace(/\s+/g, "-").replace(/^[._]/, "").replace(/[^a-z0-9~./-]+/g, "-");
|
|
232
|
-
if (hasLeadingAt) sanitized = "@" + sanitized.slice(1);
|
|
233
|
-
} else if (style === "wrangler") sanitized = sanitized.replace(/[^a-z0-9-]/g, "-").replace(/-+/g, "-").slice(0, 63).replace(/^-|-$/g, "");
|
|
234
|
-
else throw new Error(`Invalid kind: ${style}`);
|
|
235
|
-
return sanitized || "undefined-sv-name";
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
//#endregion
|
|
239
|
-
//#region lib/create/index.ts
|
|
2658
|
+
//#region src/create/index.ts
|
|
240
2659
|
const publicTemplateTypes = [
|
|
241
2660
|
"minimal",
|
|
242
2661
|
"demo",
|
|
@@ -543,8 +2962,8 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
543
2962
|
const visibleCommands = cmd.commands.filter((cmd$1) => !cmd$1._hidden);
|
|
544
2963
|
const helpCommand = cmd._getHelpCommand();
|
|
545
2964
|
if (helpCommand && !helpCommand._hidden) visibleCommands.push(helpCommand);
|
|
546
|
-
if (this.sortSubcommands) visibleCommands.sort((a, b) => {
|
|
547
|
-
return a.name().localeCompare(b.name());
|
|
2965
|
+
if (this.sortSubcommands) visibleCommands.sort((a, b$1) => {
|
|
2966
|
+
return a.name().localeCompare(b$1.name());
|
|
548
2967
|
});
|
|
549
2968
|
return visibleCommands;
|
|
550
2969
|
}
|
|
@@ -555,11 +2974,11 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
555
2974
|
* @param {Option} b
|
|
556
2975
|
* @returns {number}
|
|
557
2976
|
*/
|
|
558
|
-
compareOptions(a, b) {
|
|
2977
|
+
compareOptions(a, b$1) {
|
|
559
2978
|
const getSortKey = (option) => {
|
|
560
2979
|
return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
|
|
561
2980
|
};
|
|
562
|
-
return getSortKey(a).localeCompare(getSortKey(b));
|
|
2981
|
+
return getSortKey(a).localeCompare(getSortKey(b$1));
|
|
563
2982
|
}
|
|
564
2983
|
/**
|
|
565
2984
|
* Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.
|
|
@@ -1302,19 +3721,19 @@ var require_option = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1302
3721
|
//#region ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/lib/suggestSimilar.js
|
|
1303
3722
|
var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1304
3723
|
const maxDistance = 3;
|
|
1305
|
-
function editDistance(a, b) {
|
|
1306
|
-
if (Math.abs(a.length - b.length) > maxDistance) return Math.max(a.length, b.length);
|
|
1307
|
-
const d = [];
|
|
1308
|
-
for (let i = 0; i <= a.length; i++) d[i] = [i];
|
|
1309
|
-
for (let j = 0; j <= b.length; j++) d[0][j] = j;
|
|
1310
|
-
for (let j = 1; j <= b.length; j++) for (let i = 1; i <= a.length; i++) {
|
|
3724
|
+
function editDistance(a, b$1) {
|
|
3725
|
+
if (Math.abs(a.length - b$1.length) > maxDistance) return Math.max(a.length, b$1.length);
|
|
3726
|
+
const d$1 = [];
|
|
3727
|
+
for (let i = 0; i <= a.length; i++) d$1[i] = [i];
|
|
3728
|
+
for (let j$2 = 0; j$2 <= b$1.length; j$2++) d$1[0][j$2] = j$2;
|
|
3729
|
+
for (let j$2 = 1; j$2 <= b$1.length; j$2++) for (let i = 1; i <= a.length; i++) {
|
|
1311
3730
|
let cost = 1;
|
|
1312
|
-
if (a[i - 1] === b[j - 1]) cost = 0;
|
|
3731
|
+
if (a[i - 1] === b$1[j$2 - 1]) cost = 0;
|
|
1313
3732
|
else cost = 1;
|
|
1314
|
-
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
|
|
1315
|
-
if (i > 1 && j > 1 && a[i - 1] === b[j - 2] && a[i - 2] === b[j - 1]) d[i][j] = Math.min(d[i][j], d[i - 2][j - 2] + 1);
|
|
3733
|
+
d$1[i][j$2] = Math.min(d$1[i - 1][j$2] + 1, d$1[i][j$2 - 1] + 1, d$1[i - 1][j$2 - 1] + cost);
|
|
3734
|
+
if (i > 1 && j$2 > 1 && a[i - 1] === b$1[j$2 - 2] && a[i - 2] === b$1[j$2 - 1]) d$1[i][j$2] = Math.min(d$1[i][j$2], d$1[i - 2][j$2 - 2] + 1);
|
|
1316
3735
|
}
|
|
1317
|
-
return d[a.length][b.length];
|
|
3736
|
+
return d$1[a.length][b$1.length];
|
|
1318
3737
|
}
|
|
1319
3738
|
/**
|
|
1320
3739
|
* Find close matches, restricted to same number of edits.
|
|
@@ -1345,7 +3764,7 @@ var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1345
3764
|
} else if (distance === bestDistance) similar.push(candidate);
|
|
1346
3765
|
}
|
|
1347
3766
|
});
|
|
1348
|
-
similar.sort((a, b) => a.localeCompare(b));
|
|
3767
|
+
similar.sort((a, b$1) => a.localeCompare(b$1));
|
|
1349
3768
|
if (searchingOptions) similar = similar.map((candidate) => `--${candidate}`);
|
|
1350
3769
|
if (similar.length > 1) return `\n(Did you mean one of ${similar.join(", ")}?)`;
|
|
1351
3770
|
if (similar.length === 1) return `\n(Did you mean ${similar[0]}?)`;
|
|
@@ -1360,8 +3779,8 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1360
3779
|
const EventEmitter = __require("node:events").EventEmitter;
|
|
1361
3780
|
const childProcess = __require("node:child_process");
|
|
1362
3781
|
const path$1 = __require("node:path");
|
|
1363
|
-
const fs$
|
|
1364
|
-
const process$
|
|
3782
|
+
const fs$1 = __require("node:fs");
|
|
3783
|
+
const process$2 = __require("node:process");
|
|
1365
3784
|
const { Argument, humanReadableArgName } = require_argument();
|
|
1366
3785
|
const { CommanderError } = require_error();
|
|
1367
3786
|
const { Help, stripColor } = require_help();
|
|
@@ -1413,13 +3832,13 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1413
3832
|
this._showSuggestionAfterError = true;
|
|
1414
3833
|
this._savedState = null;
|
|
1415
3834
|
this._outputConfiguration = {
|
|
1416
|
-
writeOut: (str) => process$
|
|
1417
|
-
writeErr: (str) => process$
|
|
3835
|
+
writeOut: (str) => process$2.stdout.write(str),
|
|
3836
|
+
writeErr: (str) => process$2.stderr.write(str),
|
|
1418
3837
|
outputError: (str, write) => write(str),
|
|
1419
|
-
getOutHelpWidth: () => process$
|
|
1420
|
-
getErrHelpWidth: () => process$
|
|
1421
|
-
getOutHasColors: () => useColor() ?? (process$
|
|
1422
|
-
getErrHasColors: () => useColor() ?? (process$
|
|
3838
|
+
getOutHelpWidth: () => process$2.stdout.isTTY ? process$2.stdout.columns : void 0,
|
|
3839
|
+
getErrHelpWidth: () => process$2.stderr.isTTY ? process$2.stderr.columns : void 0,
|
|
3840
|
+
getOutHasColors: () => useColor() ?? (process$2.stdout.isTTY && process$2.stdout.hasColors?.()),
|
|
3841
|
+
getErrHasColors: () => useColor() ?? (process$2.stderr.isTTY && process$2.stderr.hasColors?.()),
|
|
1423
3842
|
stripColor: (str) => stripColor(str)
|
|
1424
3843
|
};
|
|
1425
3844
|
this._hidden = false;
|
|
@@ -1788,7 +4207,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1788
4207
|
*/
|
|
1789
4208
|
_exit(exitCode, code, message) {
|
|
1790
4209
|
if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code, message));
|
|
1791
|
-
process$
|
|
4210
|
+
process$2.exit(exitCode);
|
|
1792
4211
|
}
|
|
1793
4212
|
/**
|
|
1794
4213
|
* Register callback `fn` for the command.
|
|
@@ -1935,8 +4354,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
1935
4354
|
else if (fn instanceof RegExp) {
|
|
1936
4355
|
const regex = fn;
|
|
1937
4356
|
fn = (val, def) => {
|
|
1938
|
-
const m = regex.exec(val);
|
|
1939
|
-
return m ? m[0] : def;
|
|
4357
|
+
const m$1 = regex.exec(val);
|
|
4358
|
+
return m$1 ? m$1[0] : def;
|
|
1940
4359
|
};
|
|
1941
4360
|
option.default(defaultValue).argParser(fn);
|
|
1942
4361
|
} else option.default(fn);
|
|
@@ -2129,11 +4548,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2129
4548
|
if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
|
|
2130
4549
|
parseOptions = parseOptions || {};
|
|
2131
4550
|
if (argv === void 0 && parseOptions.from === void 0) {
|
|
2132
|
-
if (process$
|
|
2133
|
-
const execArgv = process$
|
|
4551
|
+
if (process$2.versions?.electron) parseOptions.from = "electron";
|
|
4552
|
+
const execArgv = process$2.execArgv ?? [];
|
|
2134
4553
|
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) parseOptions.from = "eval";
|
|
2135
4554
|
}
|
|
2136
|
-
if (argv === void 0) argv = process$
|
|
4555
|
+
if (argv === void 0) argv = process$2.argv;
|
|
2137
4556
|
this.rawArgs = argv.slice();
|
|
2138
4557
|
let userArgs;
|
|
2139
4558
|
switch (parseOptions.from) {
|
|
@@ -2143,7 +4562,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2143
4562
|
userArgs = argv.slice(2);
|
|
2144
4563
|
break;
|
|
2145
4564
|
case "electron":
|
|
2146
|
-
if (process$
|
|
4565
|
+
if (process$2.defaultApp) {
|
|
2147
4566
|
this._scriptPath = argv[1];
|
|
2148
4567
|
userArgs = argv.slice(2);
|
|
2149
4568
|
} else userArgs = argv.slice(1);
|
|
@@ -2256,7 +4675,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2256
4675
|
* @param {string} subcommandName
|
|
2257
4676
|
*/
|
|
2258
4677
|
_checkForMissingExecutable(executableFile, executableDir, subcommandName) {
|
|
2259
|
-
if (fs$
|
|
4678
|
+
if (fs$1.existsSync(executableFile)) return;
|
|
2260
4679
|
const executableMissing = `'${executableFile}' does not exist
|
|
2261
4680
|
- if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
|
|
2262
4681
|
- if the default executable name is not suitable, use the executableFile option to supply a custom name or path
|
|
@@ -2280,9 +4699,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2280
4699
|
];
|
|
2281
4700
|
function findFile(baseDir, baseName) {
|
|
2282
4701
|
const localBin = path$1.resolve(baseDir, baseName);
|
|
2283
|
-
if (fs$
|
|
4702
|
+
if (fs$1.existsSync(localBin)) return localBin;
|
|
2284
4703
|
if (sourceExt.includes(path$1.extname(baseName))) return void 0;
|
|
2285
|
-
const foundExt = sourceExt.find((ext) => fs$
|
|
4704
|
+
const foundExt = sourceExt.find((ext) => fs$1.existsSync(`${localBin}${ext}`));
|
|
2286
4705
|
if (foundExt) return `${localBin}${foundExt}`;
|
|
2287
4706
|
}
|
|
2288
4707
|
this._checkForMissingMandatoryOptions();
|
|
@@ -2292,7 +4711,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2292
4711
|
if (this._scriptPath) {
|
|
2293
4712
|
let resolvedScriptPath;
|
|
2294
4713
|
try {
|
|
2295
|
-
resolvedScriptPath = fs$
|
|
4714
|
+
resolvedScriptPath = fs$1.realpathSync(this._scriptPath);
|
|
2296
4715
|
} catch {
|
|
2297
4716
|
resolvedScriptPath = this._scriptPath;
|
|
2298
4717
|
}
|
|
@@ -2308,16 +4727,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2308
4727
|
}
|
|
2309
4728
|
launchWithNode = sourceExt.includes(path$1.extname(executableFile));
|
|
2310
4729
|
let proc;
|
|
2311
|
-
if (process$
|
|
4730
|
+
if (process$2.platform !== "win32") if (launchWithNode) {
|
|
2312
4731
|
args.unshift(executableFile);
|
|
2313
|
-
args = incrementNodeInspectorPort(process$
|
|
2314
|
-
proc = childProcess.spawn(process$
|
|
4732
|
+
args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
|
|
4733
|
+
proc = childProcess.spawn(process$2.argv[0], args, { stdio: "inherit" });
|
|
2315
4734
|
} else proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
|
|
2316
4735
|
else {
|
|
2317
4736
|
this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
2318
4737
|
args.unshift(executableFile);
|
|
2319
|
-
args = incrementNodeInspectorPort(process$
|
|
2320
|
-
proc = childProcess.spawn(process$
|
|
4738
|
+
args = incrementNodeInspectorPort(process$2.execArgv).concat(args);
|
|
4739
|
+
proc = childProcess.spawn(process$2.execPath, args, { stdio: "inherit" });
|
|
2321
4740
|
}
|
|
2322
4741
|
if (!proc.killed) [
|
|
2323
4742
|
"SIGUSR1",
|
|
@@ -2326,20 +4745,20 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2326
4745
|
"SIGINT",
|
|
2327
4746
|
"SIGHUP"
|
|
2328
4747
|
].forEach((signal) => {
|
|
2329
|
-
process$
|
|
4748
|
+
process$2.on(signal, () => {
|
|
2330
4749
|
if (proc.killed === false && proc.exitCode === null) proc.kill(signal);
|
|
2331
4750
|
});
|
|
2332
4751
|
});
|
|
2333
4752
|
const exitCallback = this._exitCallback;
|
|
2334
4753
|
proc.on("close", (code) => {
|
|
2335
4754
|
code = code ?? 1;
|
|
2336
|
-
if (!exitCallback) process$
|
|
4755
|
+
if (!exitCallback) process$2.exit(code);
|
|
2337
4756
|
else exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
|
|
2338
4757
|
});
|
|
2339
4758
|
proc.on("error", (err) => {
|
|
2340
4759
|
if (err.code === "ENOENT") this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
2341
4760
|
else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
|
|
2342
|
-
if (!exitCallback) process$
|
|
4761
|
+
if (!exitCallback) process$2.exit(1);
|
|
2343
4762
|
else {
|
|
2344
4763
|
const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
|
|
2345
4764
|
wrappedError.nestedError = err;
|
|
@@ -2408,8 +4827,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2408
4827
|
if (declaredArg.variadic) {
|
|
2409
4828
|
if (index < this.args.length) {
|
|
2410
4829
|
value = this.args.slice(index);
|
|
2411
|
-
if (declaredArg.parseArg) value = value.reduce((processed, v) => {
|
|
2412
|
-
return myParseArg(declaredArg, v, processed);
|
|
4830
|
+
if (declaredArg.parseArg) value = value.reduce((processed, v$1) => {
|
|
4831
|
+
return myParseArg(declaredArg, v$1, processed);
|
|
2413
4832
|
}, declaredArg.defaultValue);
|
|
2414
4833
|
} else if (value === void 0) value = [];
|
|
2415
4834
|
} else if (index < this.args.length) {
|
|
@@ -2751,13 +5170,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2751
5170
|
*/
|
|
2752
5171
|
_parseOptionsEnv() {
|
|
2753
5172
|
this.options.forEach((option) => {
|
|
2754
|
-
if (option.envVar && option.envVar in process$
|
|
5173
|
+
if (option.envVar && option.envVar in process$2.env) {
|
|
2755
5174
|
const optionKey = option.attributeName();
|
|
2756
5175
|
if (this.getOptionValue(optionKey) === void 0 || [
|
|
2757
5176
|
"default",
|
|
2758
5177
|
"config",
|
|
2759
5178
|
"env"
|
|
2760
|
-
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$
|
|
5179
|
+
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$2.env[option.envVar]);
|
|
2761
5180
|
else this.emit(`optionEnv:${option.name()}`);
|
|
2762
5181
|
}
|
|
2763
5182
|
});
|
|
@@ -3107,9 +5526,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3107
5526
|
helpWidth: context.helpWidth,
|
|
3108
5527
|
outputHasColors: context.hasColors
|
|
3109
5528
|
});
|
|
3110
|
-
const text = helper.formatHelp(this, helper);
|
|
3111
|
-
if (context.hasColors) return text;
|
|
3112
|
-
return this._outputConfiguration.stripColor(text);
|
|
5529
|
+
const text$1 = helper.formatHelp(this, helper);
|
|
5530
|
+
if (context.hasColors) return text$1;
|
|
5531
|
+
return this._outputConfiguration.stripColor(text$1);
|
|
3113
5532
|
}
|
|
3114
5533
|
/**
|
|
3115
5534
|
* @typedef HelpContext
|
|
@@ -3236,7 +5655,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3236
5655
|
*/
|
|
3237
5656
|
help(contextOptions) {
|
|
3238
5657
|
this.outputHelp(contextOptions);
|
|
3239
|
-
let exitCode = Number(process$
|
|
5658
|
+
let exitCode = Number(process$2.exitCode ?? 0);
|
|
3240
5659
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
|
|
3241
5660
|
this._exit(exitCode, "commander.help", "(outputHelp)");
|
|
3242
5661
|
}
|
|
@@ -3258,7 +5677,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3258
5677
|
* @param {(string | Function)} text - string to add, or a function returning a string
|
|
3259
5678
|
* @return {Command} `this` command for chaining
|
|
3260
5679
|
*/
|
|
3261
|
-
addHelpText(position, text) {
|
|
5680
|
+
addHelpText(position, text$1) {
|
|
3262
5681
|
const allowedValues = [
|
|
3263
5682
|
"beforeAll",
|
|
3264
5683
|
"before",
|
|
@@ -3270,11 +5689,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3270
5689
|
const helpEvent = `${position}Help`;
|
|
3271
5690
|
this.on(helpEvent, (context) => {
|
|
3272
5691
|
let helpStr;
|
|
3273
|
-
if (typeof text === "function") helpStr = text({
|
|
5692
|
+
if (typeof text$1 === "function") helpStr = text$1({
|
|
3274
5693
|
error: context.error,
|
|
3275
5694
|
command: context.command
|
|
3276
5695
|
});
|
|
3277
|
-
else helpStr = text;
|
|
5696
|
+
else helpStr = text$1;
|
|
3278
5697
|
if (helpStr) context.write(`${helpStr}\n`);
|
|
3279
5698
|
});
|
|
3280
5699
|
return this;
|
|
@@ -3326,8 +5745,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3326
5745
|
* @package
|
|
3327
5746
|
*/
|
|
3328
5747
|
function useColor() {
|
|
3329
|
-
if (process$
|
|
3330
|
-
if (process$
|
|
5748
|
+
if (process$2.env.NO_COLOR || process$2.env.FORCE_COLOR === "0" || process$2.env.FORCE_COLOR === "false") return false;
|
|
5749
|
+
if (process$2.env.FORCE_COLOR || process$2.env.CLICOLOR_FORCE !== void 0) return true;
|
|
3331
5750
|
}
|
|
3332
5751
|
exports.Command = Command;
|
|
3333
5752
|
exports.useColor = useColor;
|
|
@@ -3431,15 +5850,15 @@ function up(name, options) {
|
|
|
3431
5850
|
*/
|
|
3432
5851
|
function any(names, options) {
|
|
3433
5852
|
let dir, start = options && options.cwd || "";
|
|
3434
|
-
let j = 0, len = names.length, tmp;
|
|
3435
|
-
for (dir of up$1(start, options)) for (j = 0; j < len; j++) {
|
|
3436
|
-
tmp = join(dir, names[j]);
|
|
5853
|
+
let j$2 = 0, len = names.length, tmp;
|
|
5854
|
+
for (dir of up$1(start, options)) for (j$2 = 0; j$2 < len; j$2++) {
|
|
5855
|
+
tmp = join(dir, names[j$2]);
|
|
3437
5856
|
if (existsSync(tmp)) return tmp;
|
|
3438
5857
|
}
|
|
3439
5858
|
}
|
|
3440
5859
|
|
|
3441
5860
|
//#endregion
|
|
3442
|
-
//#region
|
|
5861
|
+
//#region src/core/package-manager.ts
|
|
3443
5862
|
const AGENT_NAMES = AGENTS.filter((agent) => !agent.includes("@"));
|
|
3444
5863
|
const agentOptions = AGENT_NAMES.map((pm) => ({
|
|
3445
5864
|
value: pm,
|
|
@@ -3452,22 +5871,22 @@ agentOptions.unshift({
|
|
|
3452
5871
|
const installOption = new Option("--install <package-manager>", "installs dependencies with a specified package manager").choices(AGENT_NAMES);
|
|
3453
5872
|
async function packageManagerPrompt(cwd$1) {
|
|
3454
5873
|
const agent = (await detect({ cwd: cwd$1 }))?.name ?? getUserAgent();
|
|
3455
|
-
if (!process.stdout.isTTY) return agent;
|
|
5874
|
+
if (!process$1.stdout.isTTY) return agent;
|
|
3456
5875
|
const pm = await qt({
|
|
3457
5876
|
message: "Which package manager do you want to install dependencies with?",
|
|
3458
5877
|
options: agentOptions,
|
|
3459
5878
|
initialValue: agent
|
|
3460
5879
|
});
|
|
3461
|
-
if (Ct(pm)) {
|
|
5880
|
+
if (Ct$1(pm)) {
|
|
3462
5881
|
Pt("Operation cancelled.");
|
|
3463
|
-
process.exit(1);
|
|
5882
|
+
process$1.exit(1);
|
|
3464
5883
|
}
|
|
3465
5884
|
return pm;
|
|
3466
5885
|
}
|
|
3467
5886
|
async function installDependencies(agent, cwd$1) {
|
|
3468
5887
|
const task = zt({
|
|
3469
5888
|
title: `Installing dependencies with ${color.command(agent)}...`,
|
|
3470
|
-
limit: Math.ceil(process.stdout.rows / 2),
|
|
5889
|
+
limit: Math.ceil(process$1.stdout.rows / 2),
|
|
3471
5890
|
spacing: 0,
|
|
3472
5891
|
retainLog: true
|
|
3473
5892
|
});
|
|
@@ -3485,14 +5904,14 @@ async function installDependencies(agent, cwd$1) {
|
|
|
3485
5904
|
} catch {
|
|
3486
5905
|
task.error("Failed to install dependencies");
|
|
3487
5906
|
Pt("Operation failed.");
|
|
3488
|
-
process.exit(2);
|
|
5907
|
+
process$1.exit(2);
|
|
3489
5908
|
}
|
|
3490
5909
|
}
|
|
3491
5910
|
async function detectPackageManager(cwd$1) {
|
|
3492
5911
|
return (await detect({ cwd: cwd$1 }))?.name ?? getUserAgent() ?? "npm";
|
|
3493
5912
|
}
|
|
3494
5913
|
function getUserAgent() {
|
|
3495
|
-
const userAgent = process.env.npm_config_user_agent;
|
|
5914
|
+
const userAgent = process$1.env.npm_config_user_agent;
|
|
3496
5915
|
if (!userAgent) return void 0;
|
|
3497
5916
|
const pmSpec = userAgent.split(" ")[0];
|
|
3498
5917
|
const separatorPos = pmSpec.lastIndexOf("/");
|
|
@@ -3511,7 +5930,7 @@ async function addPnpmBuildDependencies(cwd$1, packageManager, allowedPackages)
|
|
|
3511
5930
|
const items = data.get("onlyBuiltDependencies")?.items ?? [];
|
|
3512
5931
|
for (const item of allowedPackages) {
|
|
3513
5932
|
if (items.includes(item)) continue;
|
|
3514
|
-
if (items.some((y) => typeof y === "object" && y.value === item)) continue;
|
|
5933
|
+
if (items.some((y$2) => typeof y$2 === "object" && y$2.value === item)) continue;
|
|
3515
5934
|
items.push(item);
|
|
3516
5935
|
}
|
|
3517
5936
|
data.set("onlyBuiltDependencies", items);
|
|
@@ -3534,12 +5953,12 @@ async function addPnpmBuildDependencies(cwd$1, packageManager, allowedPackages)
|
|
|
3534
5953
|
}
|
|
3535
5954
|
}
|
|
3536
5955
|
async function getPnpmVersion() {
|
|
3537
|
-
let v = void 0;
|
|
5956
|
+
let v$1 = void 0;
|
|
3538
5957
|
try {
|
|
3539
|
-
v = (await q("pnpm", ["--version"], { throwOnError: true })).stdout.trim();
|
|
5958
|
+
v$1 = (await q("pnpm", ["--version"], { throwOnError: true })).stdout.trim();
|
|
3540
5959
|
} catch {}
|
|
3541
|
-
return v;
|
|
5960
|
+
return v$1;
|
|
3542
5961
|
}
|
|
3543
5962
|
|
|
3544
5963
|
//#endregion
|
|
3545
|
-
export {
|
|
5964
|
+
export { Pt as A, __toESM as B, writeFile as C, Lt as D, Ie as E, kt as F, qt as I, Ct$1 as L, R$1 as M, Rt as N, Mt as O, Wt as P, __commonJSMin as R, readFile as S, q as T, commonFilePaths as _, installOption as a, getPackageJson as b, up as c, Option as d, program as f, getSharedFiles as g, dist as h, installDependencies as i, Qt as j, Nt as k, from as l, templates as m, addPnpmBuildDependencies as n, packageManagerPrompt as o, create as p, detectPackageManager as r, any as s, AGENT_NAMES as t, Command as u, fileExists as v, K as w, installPackages as x, formatFiles as y, __require as z };
|