sv 0.12.7 → 0.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bin.mjs +15 -18
- package/dist/{engine-v9g2eGJ2.mjs → engine-DOKagHfI.mjs} +1127 -935
- package/dist/{engine-BZ0rj9tz.d.mts → engine-M8NNzIgv.d.mts} +29 -48
- package/dist/{package-manager-BYzDyeam.mjs → package-manager-BU-MLhop.mjs} +946 -1503
- package/dist/shared.json +2 -2
- package/dist/src/index.d.mts +1 -1
- package/dist/src/index.mjs +3 -4
- package/dist/src/testing.d.mts +3 -6
- package/dist/src/testing.mjs +33 -47
- package/dist/templates/demo/files.types=checkjs.json +1 -1
- package/dist/templates/demo/files.types=none.json +1 -1
- package/dist/templates/demo/files.types=typescript.json +1 -1
- package/dist/templates/demo/package.json +1 -1
- package/dist/templates/library/package.json +1 -1
- package/dist/templates/minimal/package.json +1 -1
- package/dist/templates/svelte/files.types=none.json +1 -1
- package/dist/templates/svelte/files.types=typescript.json +1 -1
- package/package.json +2 -2
|
@@ -1,18 +1,16 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { AGENTS, COMMANDS, color, constructCommand, detect, isVersionUnsupportedBelow, parse, resolveCommand, sanitizeName } from "@sveltejs/sv-utils";
|
|
3
|
-
import fs, { existsSync
|
|
3
|
+
import fs, { existsSync } from "node:fs";
|
|
4
4
|
import path, { delimiter, dirname, isAbsolute, join, normalize, resolve } from "node:path";
|
|
5
5
|
import process$1, { cwd, stdin, stdout } from "node:process";
|
|
6
|
-
import * as k$
|
|
6
|
+
import * as k$1 from "node:readline";
|
|
7
7
|
import c from "node:readline";
|
|
8
8
|
import { ReadStream } from "node:tty";
|
|
9
9
|
import { stripVTControlCharacters } from "node:util";
|
|
10
|
-
import { createRequire as createRequire$1 } from "module";
|
|
11
10
|
import { spawn } from "node:child_process";
|
|
12
11
|
import { PassThrough } from "node:stream";
|
|
13
12
|
import { fileURLToPath } from "node:url";
|
|
14
|
-
|
|
15
|
-
//#region rolldown:runtime
|
|
13
|
+
//#region \0rolldown/runtime.js
|
|
16
14
|
var __create = Object.create;
|
|
17
15
|
var __defProp = Object.defineProperty;
|
|
18
16
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -20,17 +18,13 @@ var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
|
20
18
|
var __getProtoOf = Object.getPrototypeOf;
|
|
21
19
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
22
20
|
var __commonJSMin = (cb, mod) => () => (mod || cb((mod = { exports: {} }).exports, mod), mod.exports);
|
|
23
|
-
var __copyProps = (to, from
|
|
24
|
-
if (from
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
enumerable: !(desc = __getOwnPropDesc(from$1, key)) || desc.enumerable
|
|
31
|
-
});
|
|
32
|
-
}
|
|
33
|
-
}
|
|
21
|
+
var __copyProps = (to, from, except, desc) => {
|
|
22
|
+
if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
|
|
23
|
+
key = keys[i];
|
|
24
|
+
if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
|
|
25
|
+
get: ((k) => from[k]).bind(null, key),
|
|
26
|
+
enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
|
|
27
|
+
});
|
|
34
28
|
}
|
|
35
29
|
return to;
|
|
36
30
|
};
|
|
@@ -39,76 +33,74 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
39
33
|
enumerable: true
|
|
40
34
|
}) : target, mod));
|
|
41
35
|
var __require = /* @__PURE__ */ createRequire(import.meta.url);
|
|
42
|
-
|
|
43
36
|
//#endregion
|
|
44
37
|
//#region ../../node_modules/.pnpm/picocolors@1.1.1/node_modules/picocolors/picocolors.js
|
|
45
38
|
var require_picocolors = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
46
39
|
let p = process || {}, argv = p.argv || [], env = p.env || {};
|
|
47
40
|
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
|
|
41
|
+
let formatter = (open, close, replace = open) => (input) => {
|
|
49
42
|
let string = "" + input, index = string.indexOf(close, open.length);
|
|
50
|
-
return ~index ? open + replaceClose(string, close, replace
|
|
43
|
+
return ~index ? open + replaceClose(string, close, replace, index) + close : open + string + close;
|
|
51
44
|
};
|
|
52
|
-
let replaceClose = (string, close, replace
|
|
45
|
+
let replaceClose = (string, close, replace, index) => {
|
|
53
46
|
let result = "", cursor = 0;
|
|
54
47
|
do {
|
|
55
|
-
result += string.substring(cursor, index) + replace
|
|
48
|
+
result += string.substring(cursor, index) + replace;
|
|
56
49
|
cursor = index + close.length;
|
|
57
50
|
index = string.indexOf(close, cursor);
|
|
58
51
|
} while (~index);
|
|
59
52
|
return result + string.substring(cursor);
|
|
60
53
|
};
|
|
61
54
|
let createColors = (enabled = isColorSupported) => {
|
|
62
|
-
let f
|
|
55
|
+
let f = enabled ? formatter : () => String;
|
|
63
56
|
return {
|
|
64
57
|
isColorSupported: enabled,
|
|
65
|
-
reset: f
|
|
66
|
-
bold: f
|
|
67
|
-
dim: f
|
|
68
|
-
italic: f
|
|
69
|
-
underline: f
|
|
70
|
-
inverse: f
|
|
71
|
-
hidden: f
|
|
72
|
-
strikethrough: f
|
|
73
|
-
black: f
|
|
74
|
-
red: f
|
|
75
|
-
green: f
|
|
76
|
-
yellow: f
|
|
77
|
-
blue: f
|
|
78
|
-
magenta: f
|
|
79
|
-
cyan: f
|
|
80
|
-
white: f
|
|
81
|
-
gray: f
|
|
82
|
-
bgBlack: f
|
|
83
|
-
bgRed: f
|
|
84
|
-
bgGreen: f
|
|
85
|
-
bgYellow: f
|
|
86
|
-
bgBlue: f
|
|
87
|
-
bgMagenta: f
|
|
88
|
-
bgCyan: f
|
|
89
|
-
bgWhite: f
|
|
90
|
-
blackBright: f
|
|
91
|
-
redBright: f
|
|
92
|
-
greenBright: f
|
|
93
|
-
yellowBright: f
|
|
94
|
-
blueBright: f
|
|
95
|
-
magentaBright: f
|
|
96
|
-
cyanBright: f
|
|
97
|
-
whiteBright: f
|
|
98
|
-
bgBlackBright: f
|
|
99
|
-
bgRedBright: f
|
|
100
|
-
bgGreenBright: f
|
|
101
|
-
bgYellowBright: f
|
|
102
|
-
bgBlueBright: f
|
|
103
|
-
bgMagentaBright: f
|
|
104
|
-
bgCyanBright: f
|
|
105
|
-
bgWhiteBright: f
|
|
58
|
+
reset: f("\x1B[0m", "\x1B[0m"),
|
|
59
|
+
bold: f("\x1B[1m", "\x1B[22m", "\x1B[22m\x1B[1m"),
|
|
60
|
+
dim: f("\x1B[2m", "\x1B[22m", "\x1B[22m\x1B[2m"),
|
|
61
|
+
italic: f("\x1B[3m", "\x1B[23m"),
|
|
62
|
+
underline: f("\x1B[4m", "\x1B[24m"),
|
|
63
|
+
inverse: f("\x1B[7m", "\x1B[27m"),
|
|
64
|
+
hidden: f("\x1B[8m", "\x1B[28m"),
|
|
65
|
+
strikethrough: f("\x1B[9m", "\x1B[29m"),
|
|
66
|
+
black: f("\x1B[30m", "\x1B[39m"),
|
|
67
|
+
red: f("\x1B[31m", "\x1B[39m"),
|
|
68
|
+
green: f("\x1B[32m", "\x1B[39m"),
|
|
69
|
+
yellow: f("\x1B[33m", "\x1B[39m"),
|
|
70
|
+
blue: f("\x1B[34m", "\x1B[39m"),
|
|
71
|
+
magenta: f("\x1B[35m", "\x1B[39m"),
|
|
72
|
+
cyan: f("\x1B[36m", "\x1B[39m"),
|
|
73
|
+
white: f("\x1B[37m", "\x1B[39m"),
|
|
74
|
+
gray: f("\x1B[90m", "\x1B[39m"),
|
|
75
|
+
bgBlack: f("\x1B[40m", "\x1B[49m"),
|
|
76
|
+
bgRed: f("\x1B[41m", "\x1B[49m"),
|
|
77
|
+
bgGreen: f("\x1B[42m", "\x1B[49m"),
|
|
78
|
+
bgYellow: f("\x1B[43m", "\x1B[49m"),
|
|
79
|
+
bgBlue: f("\x1B[44m", "\x1B[49m"),
|
|
80
|
+
bgMagenta: f("\x1B[45m", "\x1B[49m"),
|
|
81
|
+
bgCyan: f("\x1B[46m", "\x1B[49m"),
|
|
82
|
+
bgWhite: f("\x1B[47m", "\x1B[49m"),
|
|
83
|
+
blackBright: f("\x1B[90m", "\x1B[39m"),
|
|
84
|
+
redBright: f("\x1B[91m", "\x1B[39m"),
|
|
85
|
+
greenBright: f("\x1B[92m", "\x1B[39m"),
|
|
86
|
+
yellowBright: f("\x1B[93m", "\x1B[39m"),
|
|
87
|
+
blueBright: f("\x1B[94m", "\x1B[39m"),
|
|
88
|
+
magentaBright: f("\x1B[95m", "\x1B[39m"),
|
|
89
|
+
cyanBright: f("\x1B[96m", "\x1B[39m"),
|
|
90
|
+
whiteBright: f("\x1B[97m", "\x1B[39m"),
|
|
91
|
+
bgBlackBright: f("\x1B[100m", "\x1B[49m"),
|
|
92
|
+
bgRedBright: f("\x1B[101m", "\x1B[49m"),
|
|
93
|
+
bgGreenBright: f("\x1B[102m", "\x1B[49m"),
|
|
94
|
+
bgYellowBright: f("\x1B[103m", "\x1B[49m"),
|
|
95
|
+
bgBlueBright: f("\x1B[104m", "\x1B[49m"),
|
|
96
|
+
bgMagentaBright: f("\x1B[105m", "\x1B[49m"),
|
|
97
|
+
bgCyanBright: f("\x1B[106m", "\x1B[49m"),
|
|
98
|
+
bgWhiteBright: f("\x1B[107m", "\x1B[49m")
|
|
106
99
|
};
|
|
107
100
|
};
|
|
108
101
|
module.exports = createColors();
|
|
109
102
|
module.exports.createColors = createColors;
|
|
110
103
|
}));
|
|
111
|
-
|
|
112
104
|
//#endregion
|
|
113
105
|
//#region ../../node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js
|
|
114
106
|
var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
@@ -116,16 +108,16 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
116
108
|
const CSI = `${ESC}[`;
|
|
117
109
|
const beep = "\x07";
|
|
118
110
|
const cursor = {
|
|
119
|
-
to(x
|
|
120
|
-
if (!y
|
|
121
|
-
return `${CSI}${y
|
|
111
|
+
to(x, y) {
|
|
112
|
+
if (!y) return `${CSI}${x + 1}G`;
|
|
113
|
+
return `${CSI}${y + 1};${x + 1}H`;
|
|
122
114
|
},
|
|
123
|
-
move(x
|
|
115
|
+
move(x, y) {
|
|
124
116
|
let ret = "";
|
|
125
|
-
if (x
|
|
126
|
-
else if (x
|
|
127
|
-
if (y
|
|
128
|
-
else if (y
|
|
117
|
+
if (x < 0) ret += `${CSI}${-x}D`;
|
|
118
|
+
else if (x > 0) ret += `${CSI}${x}C`;
|
|
119
|
+
if (y < 0) ret += `${CSI}${-y}A`;
|
|
120
|
+
else if (y > 0) ret += `${CSI}${y}B`;
|
|
129
121
|
return ret;
|
|
130
122
|
},
|
|
131
123
|
up: (count = 1) => `${CSI}${count}A`,
|
|
@@ -140,181 +132,178 @@ var require_src = /* @__PURE__ */ __commonJSMin(((exports, module) => {
|
|
|
140
132
|
save: `${ESC}7`,
|
|
141
133
|
restore: `${ESC}8`
|
|
142
134
|
};
|
|
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
135
|
module.exports = {
|
|
162
136
|
cursor,
|
|
163
|
-
scroll
|
|
164
|
-
|
|
137
|
+
scroll: {
|
|
138
|
+
up: (count = 1) => `${CSI}S`.repeat(count),
|
|
139
|
+
down: (count = 1) => `${CSI}T`.repeat(count)
|
|
140
|
+
},
|
|
141
|
+
erase: {
|
|
142
|
+
screen: `${CSI}2J`,
|
|
143
|
+
up: (count = 1) => `${CSI}1J`.repeat(count),
|
|
144
|
+
down: (count = 1) => `${CSI}J`.repeat(count),
|
|
145
|
+
line: `${CSI}2K`,
|
|
146
|
+
lineEnd: `${CSI}K`,
|
|
147
|
+
lineStart: `${CSI}1K`,
|
|
148
|
+
lines(count) {
|
|
149
|
+
let clear = "";
|
|
150
|
+
for (let i = 0; i < count; i++) clear += this.line + (i < count - 1 ? cursor.up() : "");
|
|
151
|
+
if (count) clear += cursor.left;
|
|
152
|
+
return clear;
|
|
153
|
+
}
|
|
154
|
+
},
|
|
165
155
|
beep
|
|
166
156
|
};
|
|
167
157
|
}));
|
|
168
|
-
|
|
169
158
|
//#endregion
|
|
170
159
|
//#region ../../node_modules/.pnpm/@clack+core@1.0.0/node_modules/@clack/core/dist/index.mjs
|
|
171
160
|
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
172
161
|
var import_src = require_src();
|
|
173
|
-
const at = (t
|
|
162
|
+
const at = (t) => t === 161 || t === 164 || t === 167 || t === 168 || t === 170 || t === 173 || t === 174 || t >= 176 && t <= 180 || t >= 182 && t <= 186 || t >= 188 && t <= 191 || t === 198 || t === 208 || t === 215 || t === 216 || t >= 222 && t <= 225 || t === 230 || t >= 232 && t <= 234 || t === 236 || t === 237 || t === 240 || t === 242 || t === 243 || t >= 247 && t <= 250 || t === 252 || t === 254 || t === 257 || t === 273 || t === 275 || t === 283 || t === 294 || t === 295 || t === 299 || t >= 305 && t <= 307 || t === 312 || t >= 319 && t <= 322 || t === 324 || t >= 328 && t <= 331 || t === 333 || t === 338 || t === 339 || t === 358 || t === 359 || t === 363 || t === 462 || t === 464 || t === 466 || t === 468 || t === 470 || t === 472 || t === 474 || t === 476 || t === 593 || t === 609 || t === 708 || t === 711 || t >= 713 && t <= 715 || t === 717 || t === 720 || t >= 728 && t <= 731 || t === 733 || t === 735 || t >= 768 && t <= 879 || t >= 913 && t <= 929 || t >= 931 && t <= 937 || t >= 945 && t <= 961 || t >= 963 && t <= 969 || t === 1025 || t >= 1040 && t <= 1103 || t === 1105 || t === 8208 || t >= 8211 && t <= 8214 || t === 8216 || t === 8217 || t === 8220 || t === 8221 || t >= 8224 && t <= 8226 || t >= 8228 && t <= 8231 || t === 8240 || t === 8242 || t === 8243 || t === 8245 || t === 8251 || t === 8254 || t === 8308 || t === 8319 || t >= 8321 && t <= 8324 || t === 8364 || t === 8451 || t === 8453 || t === 8457 || t === 8467 || t === 8470 || t === 8481 || t === 8482 || t === 8486 || t === 8491 || t === 8531 || t === 8532 || t >= 8539 && t <= 8542 || t >= 8544 && t <= 8555 || t >= 8560 && t <= 8569 || t === 8585 || t >= 8592 && t <= 8601 || t === 8632 || t === 8633 || t === 8658 || t === 8660 || t === 8679 || t === 8704 || t === 8706 || t === 8707 || t === 8711 || t === 8712 || t === 8715 || t === 8719 || t === 8721 || t === 8725 || t === 8730 || t >= 8733 && t <= 8736 || t === 8739 || t === 8741 || t >= 8743 && t <= 8748 || t === 8750 || t >= 8756 && t <= 8759 || t === 8764 || t === 8765 || t === 8776 || t === 8780 || t === 8786 || t === 8800 || t === 8801 || t >= 8804 && t <= 8807 || t === 8810 || t === 8811 || t === 8814 || t === 8815 || t === 8834 || t === 8835 || t === 8838 || t === 8839 || t === 8853 || t === 8857 || t === 8869 || t === 8895 || t === 8978 || t >= 9312 && t <= 9449 || t >= 9451 && t <= 9547 || t >= 9552 && t <= 9587 || t >= 9600 && t <= 9615 || t >= 9618 && t <= 9621 || t === 9632 || t === 9633 || t >= 9635 && t <= 9641 || t === 9650 || t === 9651 || t === 9654 || t === 9655 || t === 9660 || t === 9661 || t === 9664 || t === 9665 || t >= 9670 && t <= 9672 || t === 9675 || t >= 9678 && t <= 9681 || t >= 9698 && t <= 9701 || t === 9711 || t === 9733 || t === 9734 || t === 9737 || t === 9742 || t === 9743 || t === 9756 || t === 9758 || t === 9792 || t === 9794 || t === 9824 || t === 9825 || t >= 9827 && t <= 9829 || t >= 9831 && t <= 9834 || t === 9836 || t === 9837 || t === 9839 || t === 9886 || t === 9887 || t === 9919 || t >= 9926 && t <= 9933 || t >= 9935 && t <= 9939 || t >= 9941 && t <= 9953 || t === 9955 || t === 9960 || t === 9961 || t >= 9963 && t <= 9969 || t === 9972 || t >= 9974 && t <= 9977 || t === 9979 || t === 9980 || t === 9982 || t === 9983 || t === 10045 || t >= 10102 && t <= 10111 || t >= 11094 && t <= 11097 || t >= 12872 && t <= 12879 || t >= 57344 && t <= 63743 || t >= 65024 && t <= 65039 || t === 65533 || t >= 127232 && t <= 127242 || t >= 127248 && t <= 127277 || t >= 127280 && t <= 127337 || t >= 127344 && t <= 127373 || t === 127375 || t === 127376 || t >= 127387 && t <= 127404 || t >= 917760 && t <= 917999 || t >= 983040 && t <= 1048573 || t >= 1048576 && t <= 1114109, lt = (t) => t === 12288 || t >= 65281 && t <= 65376 || t >= 65504 && t <= 65510, ht$1 = (t) => t >= 4352 && t <= 4447 || t === 8986 || t === 8987 || t === 9001 || t === 9002 || t >= 9193 && t <= 9196 || t === 9200 || t === 9203 || t === 9725 || t === 9726 || t === 9748 || t === 9749 || t >= 9800 && t <= 9811 || t === 9855 || t === 9875 || t === 9889 || t === 9898 || t === 9899 || t === 9917 || t === 9918 || t === 9924 || t === 9925 || t === 9934 || t === 9940 || t === 9962 || t === 9970 || t === 9971 || t === 9973 || t === 9978 || t === 9981 || t === 9989 || t === 9994 || t === 9995 || t === 10024 || t === 10060 || t === 10062 || t >= 10067 && t <= 10069 || t === 10071 || t >= 10133 && t <= 10135 || t === 10160 || t === 10175 || t === 11035 || t === 11036 || t === 11088 || t === 11093 || t >= 11904 && t <= 11929 || t >= 11931 && t <= 12019 || t >= 12032 && t <= 12245 || t >= 12272 && t <= 12287 || t >= 12289 && t <= 12350 || t >= 12353 && t <= 12438 || t >= 12441 && t <= 12543 || t >= 12549 && t <= 12591 || t >= 12593 && t <= 12686 || t >= 12688 && t <= 12771 || t >= 12783 && t <= 12830 || t >= 12832 && t <= 12871 || t >= 12880 && t <= 19903 || t >= 19968 && t <= 42124 || t >= 42128 && t <= 42182 || t >= 43360 && t <= 43388 || t >= 44032 && t <= 55203 || t >= 63744 && t <= 64255 || t >= 65040 && t <= 65049 || t >= 65072 && t <= 65106 || t >= 65108 && t <= 65126 || t >= 65128 && t <= 65131 || t >= 94176 && t <= 94180 || t === 94192 || t === 94193 || t >= 94208 && t <= 100343 || t >= 100352 && t <= 101589 || t >= 101632 && t <= 101640 || t >= 110576 && t <= 110579 || t >= 110581 && t <= 110587 || t === 110589 || t === 110590 || t >= 110592 && t <= 110882 || t === 110898 || t >= 110928 && t <= 110930 || t === 110933 || t >= 110948 && t <= 110951 || t >= 110960 && t <= 111355 || t === 126980 || t === 127183 || t === 127374 || t >= 127377 && t <= 127386 || t >= 127488 && t <= 127490 || t >= 127504 && t <= 127547 || t >= 127552 && t <= 127560 || t === 127568 || t === 127569 || t >= 127584 && t <= 127589 || t >= 127744 && t <= 127776 || t >= 127789 && t <= 127797 || t >= 127799 && t <= 127868 || t >= 127870 && t <= 127891 || t >= 127904 && t <= 127946 || t >= 127951 && t <= 127955 || t >= 127968 && t <= 127984 || t === 127988 || t >= 127992 && t <= 128062 || t === 128064 || t >= 128066 && t <= 128252 || t >= 128255 && t <= 128317 || t >= 128331 && t <= 128334 || t >= 128336 && t <= 128359 || t === 128378 || t === 128405 || t === 128406 || t === 128420 || t >= 128507 && t <= 128591 || t >= 128640 && t <= 128709 || t === 128716 || t >= 128720 && t <= 128722 || t >= 128725 && t <= 128727 || t >= 128732 && t <= 128735 || t === 128747 || t === 128748 || t >= 128756 && t <= 128764 || t >= 128992 && t <= 129003 || t === 129008 || t >= 129292 && t <= 129338 || t >= 129340 && t <= 129349 || t >= 129351 && t <= 129535 || t >= 129648 && t <= 129660 || t >= 129664 && t <= 129672 || t >= 129680 && t <= 129725 || t >= 129727 && t <= 129733 || t >= 129742 && t <= 129755 || t >= 129760 && t <= 129768 || t >= 129776 && t <= 129784 || t >= 131072 && t <= 196605 || t >= 196608 && t <= 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$1 = /(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y, ct = /\p{M}+/gu, pt$1 = {
|
|
174
163
|
limit: Infinity,
|
|
175
164
|
ellipsis: ""
|
|
176
|
-
}, X = (t
|
|
177
|
-
const i = e.limit ?? Infinity, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, pt$1, s).width : 0), u
|
|
178
|
-
let h
|
|
165
|
+
}, X = (t, e = {}, s = {}) => {
|
|
166
|
+
const i = e.limit ?? Infinity, r = e.ellipsis ?? "", n = e?.ellipsisWidth ?? (r ? X(r, pt$1, s).width : 0), u = s.ansiWidth ?? 0, a = s.controlWidth ?? 0, l = s.tabWidth ?? 8, E = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, m = s.fullWidthWidth ?? 2, A = s.regularWidth ?? 1, V = s.wideWidth ?? 2;
|
|
167
|
+
let h = 0, o = 0, f = t.length, v = 0, F = !1, d = f, b = Math.max(0, i - n), C = 0, B = 0, c = 0, p = 0;
|
|
179
168
|
t: for (;;) {
|
|
180
|
-
if (B
|
|
181
|
-
const ut = t
|
|
182
|
-
v
|
|
183
|
-
for (const Y
|
|
184
|
-
const $ = Y
|
|
185
|
-
if (lt($) ? p
|
|
186
|
-
F
|
|
169
|
+
if (B > C || o >= f && o > h) {
|
|
170
|
+
const ut = t.slice(C, B) || t.slice(h, o);
|
|
171
|
+
v = 0;
|
|
172
|
+
for (const Y of ut.replaceAll(ct, "")) {
|
|
173
|
+
const $ = Y.codePointAt(0) || 0;
|
|
174
|
+
if (lt($) ? p = m : ht$1($) ? p = V : E !== A && at($) ? p = E : p = A, c + p > b && (d = Math.min(d, Math.max(C, h) + v)), c + p > i) {
|
|
175
|
+
F = !0;
|
|
187
176
|
break t;
|
|
188
177
|
}
|
|
189
|
-
v
|
|
178
|
+
v += Y.length, c += p;
|
|
190
179
|
}
|
|
191
|
-
C
|
|
180
|
+
C = B = 0;
|
|
192
181
|
}
|
|
193
|
-
if (o >= f
|
|
194
|
-
if (L.lastIndex = o, L.test(t
|
|
195
|
-
if (v
|
|
196
|
-
F
|
|
182
|
+
if (o >= f) break;
|
|
183
|
+
if (L$1.lastIndex = o, L$1.test(t)) {
|
|
184
|
+
if (v = L$1.lastIndex - o, p = v * A, c + p > b && (d = Math.min(d, o + Math.floor((b - c) / A))), c + p > i) {
|
|
185
|
+
F = !0;
|
|
197
186
|
break;
|
|
198
187
|
}
|
|
199
|
-
c
|
|
188
|
+
c += p, C = h, B = o, o = h = L$1.lastIndex;
|
|
200
189
|
continue;
|
|
201
190
|
}
|
|
202
|
-
if (O$1.lastIndex = o, O$1.test(t
|
|
203
|
-
if (c
|
|
204
|
-
F
|
|
191
|
+
if (O$1.lastIndex = o, O$1.test(t)) {
|
|
192
|
+
if (c + u > b && (d = Math.min(d, o)), c + u > i) {
|
|
193
|
+
F = !0;
|
|
205
194
|
break;
|
|
206
195
|
}
|
|
207
|
-
c
|
|
196
|
+
c += u, C = h, B = o, o = h = O$1.lastIndex;
|
|
208
197
|
continue;
|
|
209
198
|
}
|
|
210
|
-
if (y$1.lastIndex = o, y$1.test(t
|
|
211
|
-
if (v
|
|
212
|
-
F
|
|
199
|
+
if (y$1.lastIndex = o, y$1.test(t)) {
|
|
200
|
+
if (v = y$1.lastIndex - o, p = v * a, c + p > b && (d = Math.min(d, o + Math.floor((b - c) / a))), c + p > i) {
|
|
201
|
+
F = !0;
|
|
213
202
|
break;
|
|
214
203
|
}
|
|
215
|
-
c
|
|
204
|
+
c += p, C = h, B = o, o = h = y$1.lastIndex;
|
|
216
205
|
continue;
|
|
217
206
|
}
|
|
218
|
-
if (M$2.lastIndex = o, M$2.test(t
|
|
219
|
-
if (v
|
|
220
|
-
F
|
|
207
|
+
if (M$2.lastIndex = o, M$2.test(t)) {
|
|
208
|
+
if (v = M$2.lastIndex - o, p = v * l, c + p > b && (d = Math.min(d, o + Math.floor((b - c) / l))), c + p > i) {
|
|
209
|
+
F = !0;
|
|
221
210
|
break;
|
|
222
211
|
}
|
|
223
|
-
c
|
|
212
|
+
c += p, C = h, B = o, o = h = M$2.lastIndex;
|
|
224
213
|
continue;
|
|
225
214
|
}
|
|
226
|
-
if (P$1.lastIndex = o, P$1.test(t
|
|
227
|
-
if (c
|
|
228
|
-
F
|
|
215
|
+
if (P$1.lastIndex = o, P$1.test(t)) {
|
|
216
|
+
if (c + g > b && (d = Math.min(d, o)), c + g > i) {
|
|
217
|
+
F = !0;
|
|
229
218
|
break;
|
|
230
219
|
}
|
|
231
|
-
c
|
|
220
|
+
c += g, C = h, B = o, o = h = P$1.lastIndex;
|
|
232
221
|
continue;
|
|
233
222
|
}
|
|
234
223
|
o += 1;
|
|
235
224
|
}
|
|
236
225
|
return {
|
|
237
|
-
width: F
|
|
238
|
-
index: F
|
|
239
|
-
truncated: F
|
|
240
|
-
ellipsed: F
|
|
226
|
+
width: F ? b : c,
|
|
227
|
+
index: F ? d : f,
|
|
228
|
+
truncated: F,
|
|
229
|
+
ellipsed: F && i >= n
|
|
241
230
|
};
|
|
242
231
|
}, ft$1 = {
|
|
243
232
|
limit: Infinity,
|
|
244
233
|
ellipsis: "",
|
|
245
234
|
ellipsisWidth: 0
|
|
246
|
-
}, S$1 = (t
|
|
247
|
-
if (t
|
|
248
|
-
if (t
|
|
249
|
-
if (t
|
|
250
|
-
if (t
|
|
251
|
-
if (t
|
|
252
|
-
if (t
|
|
253
|
-
if (t
|
|
254
|
-
if (t
|
|
255
|
-
if (t
|
|
256
|
-
}, st = (t
|
|
235
|
+
}, S$1 = (t, e = {}) => X(t, ft$1, e).width, W = "\x1B", Z = "", Ft$1 = 39, j$1 = "\x07", Q$1 = "[", dt = "]", tt = "m", U = `${dt}8;;`, et = new RegExp(`(?:\\${Q$1}(?<code>\\d+)m|\\${U}(?<uri>.*)${j$1})`, "y"), mt$1 = (t) => {
|
|
236
|
+
if (t >= 30 && t <= 37 || t >= 90 && t <= 97) return 39;
|
|
237
|
+
if (t >= 40 && t <= 47 || t >= 100 && t <= 107) return 49;
|
|
238
|
+
if (t === 1 || t === 2) return 22;
|
|
239
|
+
if (t === 3) return 23;
|
|
240
|
+
if (t === 4) return 24;
|
|
241
|
+
if (t === 7) return 27;
|
|
242
|
+
if (t === 8) return 28;
|
|
243
|
+
if (t === 9) return 29;
|
|
244
|
+
if (t === 0) return 0;
|
|
245
|
+
}, st = (t) => `${W}${Q$1}${t}${tt}`, it = (t) => `${W}${U}${t}${j$1}`, gt$1 = (t) => t.map((e) => S$1(e)), G$1 = (t, e, s) => {
|
|
257
246
|
const i = e[Symbol.iterator]();
|
|
258
|
-
let r = !1, n = !1, u
|
|
259
|
-
for (; !l
|
|
260
|
-
const m
|
|
261
|
-
a + A
|
|
262
|
-
}
|
|
263
|
-
u
|
|
264
|
-
}, vt$1 = (t
|
|
265
|
-
const e = t
|
|
247
|
+
let r = !1, n = !1, u = t.at(-1), a = u === void 0 ? 0 : S$1(u), l = i.next(), E = i.next(), g = 0;
|
|
248
|
+
for (; !l.done;) {
|
|
249
|
+
const m = l.value, A = S$1(m);
|
|
250
|
+
a + A <= s ? t[t.length - 1] += m : (t.push(m), a = 0), (m === W || m === Z) && (r = !0, n = e.startsWith(U, g + 1)), r ? n ? m === j$1 && (r = !1, n = !1) : m === tt && (r = !1) : (a += A, a === s && !E.done && (t.push(""), a = 0)), l = E, E = i.next(), g += m.length;
|
|
251
|
+
}
|
|
252
|
+
u = t.at(-1), !a && u !== void 0 && u.length > 0 && t.length > 1 && (t[t.length - 2] += t.pop());
|
|
253
|
+
}, vt$1 = (t) => {
|
|
254
|
+
const e = t.split(" ");
|
|
266
255
|
let s = e.length;
|
|
267
256
|
for (; s > 0 && !(S$1(e[s - 1]) > 0);) s--;
|
|
268
|
-
return s === e.length ? t
|
|
269
|
-
}, Et$1 = (t
|
|
270
|
-
if (s.trim !== !1 && t
|
|
257
|
+
return s === e.length ? t : e.slice(0, s).join(" ") + e.slice(s).join("");
|
|
258
|
+
}, Et$1 = (t, e, s = {}) => {
|
|
259
|
+
if (s.trim !== !1 && t.trim() === "") return "";
|
|
271
260
|
let i = "", r, n;
|
|
272
|
-
const u
|
|
273
|
-
let l
|
|
274
|
-
for (const [h
|
|
275
|
-
s.trim !== !1 && (l
|
|
276
|
-
let f
|
|
277
|
-
if (h
|
|
278
|
-
const v
|
|
279
|
-
Math.floor((a[h
|
|
261
|
+
const u = t.split(" "), a = gt$1(u);
|
|
262
|
+
let l = [""];
|
|
263
|
+
for (const [h, o] of u.entries()) {
|
|
264
|
+
s.trim !== !1 && (l[l.length - 1] = (l.at(-1) ?? "").trimStart());
|
|
265
|
+
let f = S$1(l.at(-1) ?? "");
|
|
266
|
+
if (h !== 0 && (f >= e && (s.wordWrap === !1 || s.trim === !1) && (l.push(""), f = 0), (f > 0 || s.trim === !1) && (l[l.length - 1] += " ", f++)), s.hard && a[h] > e) {
|
|
267
|
+
const v = e - f, F = 1 + Math.floor((a[h] - v - 1) / e);
|
|
268
|
+
Math.floor((a[h] - 1) / e) < F && l.push(""), G$1(l, o, e);
|
|
280
269
|
continue;
|
|
281
270
|
}
|
|
282
|
-
if (f
|
|
283
|
-
if (s.wordWrap === !1 && f
|
|
284
|
-
G$
|
|
271
|
+
if (f + a[h] > e && f > 0 && a[h] > 0) {
|
|
272
|
+
if (s.wordWrap === !1 && f < e) {
|
|
273
|
+
G$1(l, o, e);
|
|
285
274
|
continue;
|
|
286
275
|
}
|
|
287
|
-
l
|
|
276
|
+
l.push("");
|
|
288
277
|
}
|
|
289
|
-
if (f
|
|
290
|
-
G$
|
|
278
|
+
if (f + a[h] > e && s.wordWrap === !1) {
|
|
279
|
+
G$1(l, o, e);
|
|
291
280
|
continue;
|
|
292
281
|
}
|
|
293
|
-
l
|
|
294
|
-
}
|
|
295
|
-
s.trim !== !1 && (l
|
|
296
|
-
const E
|
|
297
|
-
`), g
|
|
298
|
-
let m
|
|
299
|
-
for (; !m
|
|
300
|
-
const h
|
|
301
|
-
if (i += h
|
|
302
|
-
et.lastIndex = V
|
|
303
|
-
const F
|
|
304
|
-
if (F
|
|
305
|
-
const d
|
|
306
|
-
r = d
|
|
307
|
-
} else F
|
|
308
|
-
}
|
|
309
|
-
const f
|
|
282
|
+
l[l.length - 1] += o;
|
|
283
|
+
}
|
|
284
|
+
s.trim !== !1 && (l = l.map((h) => vt$1(h)));
|
|
285
|
+
const E = l.join(`
|
|
286
|
+
`), g = E[Symbol.iterator]();
|
|
287
|
+
let m = g.next(), A = g.next(), V = 0;
|
|
288
|
+
for (; !m.done;) {
|
|
289
|
+
const h = m.value, o = A.value;
|
|
290
|
+
if (i += h, h === W || h === Z) {
|
|
291
|
+
et.lastIndex = V + 1;
|
|
292
|
+
const F = et.exec(E)?.groups;
|
|
293
|
+
if (F?.code !== void 0) {
|
|
294
|
+
const d = Number.parseFloat(F.code);
|
|
295
|
+
r = d === Ft$1 ? void 0 : d;
|
|
296
|
+
} else F?.uri !== void 0 && (n = F.uri.length === 0 ? void 0 : F.uri);
|
|
297
|
+
}
|
|
298
|
+
const f = r ? mt$1(r) : void 0;
|
|
310
299
|
o === `
|
|
311
|
-
` ? (n && (i += it("")), r && f
|
|
312
|
-
` && (r && f
|
|
300
|
+
` ? (n && (i += it("")), r && f && (i += st(f))) : h === `
|
|
301
|
+
` && (r && f && (i += st(r)), n && (i += it(n))), V += h.length, m = A, A = g.next();
|
|
313
302
|
}
|
|
314
303
|
return i;
|
|
315
304
|
};
|
|
316
|
-
function K$
|
|
317
|
-
return String(t
|
|
305
|
+
function K$1(t, e, s) {
|
|
306
|
+
return String(t).normalize().replaceAll(`\r
|
|
318
307
|
`, `
|
|
319
308
|
`).split(`
|
|
320
309
|
`).map((i) => Et$1(i, e, s)).join(`
|
|
@@ -344,17 +333,17 @@ const _$1 = {
|
|
|
344
333
|
},
|
|
345
334
|
withGuide: !0
|
|
346
335
|
};
|
|
347
|
-
function H$
|
|
348
|
-
if (typeof t
|
|
349
|
-
for (const s of t
|
|
336
|
+
function H$1(t, e) {
|
|
337
|
+
if (typeof t == "string") return _$1.aliases.get(t) === e;
|
|
338
|
+
for (const s of t) if (s !== void 0 && H$1(s, e)) return !0;
|
|
350
339
|
return !1;
|
|
351
340
|
}
|
|
352
|
-
function _t$1(t
|
|
353
|
-
if (t
|
|
354
|
-
const s = t
|
|
341
|
+
function _t$1(t, e) {
|
|
342
|
+
if (t === e) return;
|
|
343
|
+
const s = t.split(`
|
|
355
344
|
`), i = e.split(`
|
|
356
345
|
`), r = Math.max(s.length, i.length), n = [];
|
|
357
|
-
for (let u
|
|
346
|
+
for (let u = 0; u < r; u++) s[u] !== i[u] && n.push(u);
|
|
358
347
|
return {
|
|
359
348
|
lines: n,
|
|
360
349
|
numLinesBefore: s.length,
|
|
@@ -363,49 +352,49 @@ function _t$1(t$1, e) {
|
|
|
363
352
|
};
|
|
364
353
|
}
|
|
365
354
|
const bt$1 = globalThis.process.platform.startsWith("win"), z$2 = Symbol("clack:cancel");
|
|
366
|
-
function Ct$1(t
|
|
367
|
-
return t
|
|
355
|
+
function Ct$1(t) {
|
|
356
|
+
return t === z$2;
|
|
368
357
|
}
|
|
369
|
-
function T$1(t
|
|
370
|
-
const s = t
|
|
358
|
+
function T$1(t, e) {
|
|
359
|
+
const s = t;
|
|
371
360
|
s.isTTY && s.setRawMode(e);
|
|
372
361
|
}
|
|
373
|
-
function xt$1({ input: t
|
|
374
|
-
const r = k$
|
|
375
|
-
input: t
|
|
362
|
+
function xt$1({ input: t = stdin, output: e = stdout, overwrite: s = !0, hideCursor: i = !0 } = {}) {
|
|
363
|
+
const r = k$1.createInterface({
|
|
364
|
+
input: t,
|
|
376
365
|
output: e,
|
|
377
366
|
prompt: "",
|
|
378
367
|
tabSize: 1
|
|
379
368
|
});
|
|
380
|
-
k$
|
|
381
|
-
const n = (u
|
|
382
|
-
if (H$
|
|
383
|
-
String(u
|
|
369
|
+
k$1.emitKeypressEvents(t, r), t instanceof ReadStream && t.isTTY && t.setRawMode(!0);
|
|
370
|
+
const n = (u, { name: a, sequence: l }) => {
|
|
371
|
+
if (H$1([
|
|
372
|
+
String(u),
|
|
384
373
|
a,
|
|
385
|
-
l
|
|
374
|
+
l
|
|
386
375
|
], "cancel")) {
|
|
387
376
|
i && e.write(import_src.cursor.show), process.exit(0);
|
|
388
377
|
return;
|
|
389
378
|
}
|
|
390
379
|
if (!s) return;
|
|
391
|
-
const g
|
|
392
|
-
k$
|
|
393
|
-
k$
|
|
394
|
-
t
|
|
380
|
+
const g = a === "return" ? 0 : -1, m = a === "return" ? -1 : 0;
|
|
381
|
+
k$1.moveCursor(e, g, m, () => {
|
|
382
|
+
k$1.clearLine(e, 1, () => {
|
|
383
|
+
t.once("keypress", n);
|
|
395
384
|
});
|
|
396
385
|
});
|
|
397
386
|
};
|
|
398
|
-
return i && e.write(import_src.cursor.hide), t
|
|
399
|
-
t
|
|
387
|
+
return i && e.write(import_src.cursor.hide), t.once("keypress", n), () => {
|
|
388
|
+
t.off("keypress", n), i && e.write(import_src.cursor.show), t instanceof ReadStream && t.isTTY && !bt$1 && t.setRawMode(!1), r.terminal = !1, r.close();
|
|
400
389
|
};
|
|
401
390
|
}
|
|
402
|
-
const rt = (t
|
|
403
|
-
function Bt$1(t
|
|
404
|
-
return K$
|
|
391
|
+
const rt = (t) => "columns" in t && typeof t.columns == "number" ? t.columns : 80, nt = (t) => "rows" in t && typeof t.rows == "number" ? t.rows : 20;
|
|
392
|
+
function Bt$1(t, e, s, i = s) {
|
|
393
|
+
return K$1(e, rt(t ?? stdout) - s.length, {
|
|
405
394
|
hard: !0,
|
|
406
395
|
trim: !1
|
|
407
396
|
}).split(`
|
|
408
|
-
`).map((n, u
|
|
397
|
+
`).map((n, u) => `${u === 0 ? i : s}${n}`).join(`
|
|
409
398
|
`);
|
|
410
399
|
}
|
|
411
400
|
var x$2 = class {
|
|
@@ -424,8 +413,8 @@ var x$2 = class {
|
|
|
424
413
|
value;
|
|
425
414
|
userInput = "";
|
|
426
415
|
constructor(e, s = !0) {
|
|
427
|
-
const { input: i = stdin, output: r = stdout, render: n, signal: u
|
|
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
|
|
416
|
+
const { input: i = stdin, output: r = stdout, render: n, signal: u, ...a } = e;
|
|
417
|
+
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, this.input = i, this.output = r;
|
|
429
418
|
}
|
|
430
419
|
unsubscribe() {
|
|
431
420
|
this._subscribers.clear();
|
|
@@ -495,7 +484,7 @@ var x$2 = class {
|
|
|
495
484
|
}
|
|
496
485
|
this.state !== "error" && (this.state = "submit");
|
|
497
486
|
}
|
|
498
|
-
H$
|
|
487
|
+
H$1([
|
|
499
488
|
e,
|
|
500
489
|
s?.name,
|
|
501
490
|
s?.sequence
|
|
@@ -506,7 +495,7 @@ var x$2 = class {
|
|
|
506
495
|
`), T$1(this.input, !1), this.rl?.close(), this.rl = void 0, this.emit(`${this.state}`, this.value), this.unsubscribe();
|
|
507
496
|
}
|
|
508
497
|
restoreCursor() {
|
|
509
|
-
const e = K$
|
|
498
|
+
const e = K$1(this._prevFrame, process.stdout.columns, {
|
|
510
499
|
hard: !0,
|
|
511
500
|
trim: !1
|
|
512
501
|
}).split(`
|
|
@@ -514,7 +503,7 @@ var x$2 = class {
|
|
|
514
503
|
this.output.write(import_src.cursor.move(-999, e * -1));
|
|
515
504
|
}
|
|
516
505
|
render() {
|
|
517
|
-
const e = K$
|
|
506
|
+
const e = K$1(this._render(this) ?? "", process.stdout.columns, {
|
|
518
507
|
hard: !0,
|
|
519
508
|
trim: !1
|
|
520
509
|
});
|
|
@@ -524,26 +513,26 @@ var x$2 = class {
|
|
|
524
513
|
const s = _t$1(this._prevFrame, e), i = nt(this.output);
|
|
525
514
|
if (this.restoreCursor(), s) {
|
|
526
515
|
const r = Math.max(0, s.numLinesAfter - i), n = Math.max(0, s.numLinesBefore - i);
|
|
527
|
-
let u
|
|
528
|
-
if (u
|
|
516
|
+
let u = s.lines.find((a) => a >= r);
|
|
517
|
+
if (u === void 0) {
|
|
529
518
|
this._prevFrame = e;
|
|
530
519
|
return;
|
|
531
520
|
}
|
|
532
521
|
if (s.lines.length === 1) {
|
|
533
|
-
this.output.write(import_src.cursor.move(0, u
|
|
522
|
+
this.output.write(import_src.cursor.move(0, u - n)), this.output.write(import_src.erase.lines(1));
|
|
534
523
|
const a = e.split(`
|
|
535
524
|
`);
|
|
536
|
-
this.output.write(a[u
|
|
525
|
+
this.output.write(a[u]), this._prevFrame = e, this.output.write(import_src.cursor.move(0, a.length - u - 1));
|
|
537
526
|
return;
|
|
538
527
|
} else if (s.lines.length > 1) {
|
|
539
|
-
if (r < n) u
|
|
528
|
+
if (r < n) u = r;
|
|
540
529
|
else {
|
|
541
|
-
const l
|
|
542
|
-
l
|
|
530
|
+
const l = u - n;
|
|
531
|
+
l > 0 && this.output.write(import_src.cursor.move(0, l));
|
|
543
532
|
}
|
|
544
533
|
this.output.write(import_src.erase.down());
|
|
545
534
|
const a = e.split(`
|
|
546
|
-
`).slice(u
|
|
535
|
+
`).slice(u);
|
|
547
536
|
this.output.write(a.join(`
|
|
548
537
|
`)), this._prevFrame = e;
|
|
549
538
|
return;
|
|
@@ -555,71 +544,6 @@ var x$2 = class {
|
|
|
555
544
|
}
|
|
556
545
|
}
|
|
557
546
|
};
|
|
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;
|
|
562
|
-
}
|
|
563
|
-
function Dt$1(t$1, e) {
|
|
564
|
-
return (e.label ?? String(e.value)).toLowerCase().includes(t$1.toLowerCase());
|
|
565
|
-
}
|
|
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
547
|
var kt$1 = class extends x$2 {
|
|
624
548
|
get cursor() {
|
|
625
549
|
return this.value ? 0 : 1;
|
|
@@ -637,59 +561,8 @@ var kt$1 = class extends x$2 {
|
|
|
637
561
|
});
|
|
638
562
|
}
|
|
639
563
|
};
|
|
640
|
-
|
|
641
|
-
|
|
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;
|
|
564
|
+
function D$1(t, e, s) {
|
|
565
|
+
const i = t + e, r = Math.max(s.length - 1, 0), n = i < 0 ? r : i > r ? 0 : i;
|
|
693
566
|
return s[n].disabled ? D$1(n, e < 0 ? -1 : 1, s) : n;
|
|
694
567
|
}
|
|
695
568
|
var Mt$1 = class extends x$2 {
|
|
@@ -736,30 +609,6 @@ var Mt$1 = class extends x$2 {
|
|
|
736
609
|
});
|
|
737
610
|
}
|
|
738
611
|
};
|
|
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
612
|
var Wt$1 = class extends x$2 {
|
|
764
613
|
options;
|
|
765
614
|
cursor = 0;
|
|
@@ -787,21 +636,6 @@ var Wt$1 = class extends x$2 {
|
|
|
787
636
|
});
|
|
788
637
|
}
|
|
789
638
|
};
|
|
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
639
|
var $t = class extends x$2 {
|
|
806
640
|
get userInputWithCursor() {
|
|
807
641
|
if (this.state === "submit") return this.userInput;
|
|
@@ -824,19 +658,25 @@ var $t = class extends x$2 {
|
|
|
824
658
|
});
|
|
825
659
|
}
|
|
826
660
|
};
|
|
827
|
-
|
|
828
661
|
//#endregion
|
|
829
662
|
//#region ../../node_modules/.pnpm/@clack+prompts@1.0.0/node_modules/@clack/prompts/dist/index.mjs
|
|
830
663
|
function ht() {
|
|
831
664
|
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
665
|
}
|
|
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
|
|
666
|
+
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 = w$1("◇", "o"), $e = w$1("┌", "T"), h$1 = w$1("│", "|"), x$1 = w$1("└", "—");
|
|
667
|
+
w$1("┐", "T");
|
|
668
|
+
w$1("┘", "—");
|
|
669
|
+
const Y = w$1("●", ">"), K = w$1("○", " "), te = w$1("◻", "[•]"), G = w$1("◼", "[+]"), z$1 = w$1("◻", "[ ]");
|
|
670
|
+
w$1("▪", "•");
|
|
671
|
+
const se = w$1("─", "-"), he = w$1("╮", "+"), Ne = w$1("├", "+"), me = w$1("╯", "+"), pe = w$1("╰", "+");
|
|
672
|
+
w$1("╭", "+");
|
|
673
|
+
const ge = w$1("●", "•"), fe = w$1("◆", "*"), Fe = w$1("▲", "!"), ye = w$1("■", "x"), N$1 = (e) => {
|
|
834
674
|
switch (e) {
|
|
835
675
|
case "initial":
|
|
836
676
|
case "active": return import_picocolors.default.cyan(Me);
|
|
837
677
|
case "cancel": return import_picocolors.default.red(ce);
|
|
838
678
|
case "error": return import_picocolors.default.yellow(de);
|
|
839
|
-
case "submit": return import_picocolors.default.green(k
|
|
679
|
+
case "submit": return import_picocolors.default.green(k);
|
|
840
680
|
}
|
|
841
681
|
}, Ee = (e) => {
|
|
842
682
|
switch (e) {
|
|
@@ -850,70 +690,70 @@ const ee = ht(), ue = () => process.env.CI === "true", Te = (e) => e.isTTY === !
|
|
|
850
690
|
limit: Infinity,
|
|
851
691
|
ellipsis: ""
|
|
852
692
|
}, Le = (e, r = {}, s = {}) => {
|
|
853
|
-
const i = r.limit ?? Infinity, n = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (n ? Le(n, Ft, s).width : 0), u
|
|
854
|
-
let $ = 0, c
|
|
693
|
+
const i = r.limit ?? Infinity, n = r.ellipsis ?? "", o = r?.ellipsisWidth ?? (n ? Le(n, Ft, s).width : 0), u = s.ansiWidth ?? 0, l = s.controlWidth ?? 0, a = s.tabWidth ?? 8, d = s.ambiguousWidth ?? 1, g = s.emojiWidth ?? 2, E = s.fullWidthWidth ?? 2, p = s.regularWidth ?? 1, y = s.wideWidth ?? 2;
|
|
694
|
+
let $ = 0, c = 0, m = e.length, f = 0, F = !1, v = m, S = Math.max(0, i - o), B = 0, b = 0, A = 0, C = 0;
|
|
855
695
|
e: for (;;) {
|
|
856
|
-
if (b
|
|
857
|
-
const _
|
|
858
|
-
f
|
|
859
|
-
for (const D
|
|
860
|
-
const T
|
|
861
|
-
if (pt(T
|
|
862
|
-
F
|
|
696
|
+
if (b > B || c >= m && c > $) {
|
|
697
|
+
const _ = e.slice(B, b) || e.slice($, c);
|
|
698
|
+
f = 0;
|
|
699
|
+
for (const D of _.replaceAll(ft, "")) {
|
|
700
|
+
const T = D.codePointAt(0) || 0;
|
|
701
|
+
if (pt(T) ? C = E : gt(T) ? C = y : d !== p && mt(T) ? C = d : C = p, A + C > S && (v = Math.min(v, Math.max(B, $) + f)), A + C > i) {
|
|
702
|
+
F = !0;
|
|
863
703
|
break e;
|
|
864
704
|
}
|
|
865
|
-
f
|
|
705
|
+
f += D.length, A += C;
|
|
866
706
|
}
|
|
867
|
-
B
|
|
707
|
+
B = b = 0;
|
|
868
708
|
}
|
|
869
|
-
if (c
|
|
870
|
-
if (ne.lastIndex = c
|
|
871
|
-
if (f
|
|
872
|
-
F
|
|
709
|
+
if (c >= m) break;
|
|
710
|
+
if (ne.lastIndex = c, ne.test(e)) {
|
|
711
|
+
if (f = ne.lastIndex - c, C = f * p, A + C > S && (v = Math.min(v, c + Math.floor((S - A) / p))), A + C > i) {
|
|
712
|
+
F = !0;
|
|
873
713
|
break;
|
|
874
714
|
}
|
|
875
|
-
A
|
|
715
|
+
A += C, B = $, b = c, c = $ = ne.lastIndex;
|
|
876
716
|
continue;
|
|
877
717
|
}
|
|
878
|
-
if (ve.lastIndex = c
|
|
879
|
-
if (A
|
|
880
|
-
F
|
|
718
|
+
if (ve.lastIndex = c, ve.test(e)) {
|
|
719
|
+
if (A + u > S && (v = Math.min(v, c)), A + u > i) {
|
|
720
|
+
F = !0;
|
|
881
721
|
break;
|
|
882
722
|
}
|
|
883
|
-
A
|
|
723
|
+
A += u, B = $, b = c, c = $ = ve.lastIndex;
|
|
884
724
|
continue;
|
|
885
725
|
}
|
|
886
|
-
if (re.lastIndex = c
|
|
887
|
-
if (f
|
|
888
|
-
F
|
|
726
|
+
if (re.lastIndex = c, re.test(e)) {
|
|
727
|
+
if (f = re.lastIndex - c, C = f * l, A + C > S && (v = Math.min(v, c + Math.floor((S - A) / l))), A + C > i) {
|
|
728
|
+
F = !0;
|
|
889
729
|
break;
|
|
890
730
|
}
|
|
891
|
-
A
|
|
731
|
+
A += C, B = $, b = c, c = $ = re.lastIndex;
|
|
892
732
|
continue;
|
|
893
733
|
}
|
|
894
|
-
if (ie.lastIndex = c
|
|
895
|
-
if (f
|
|
896
|
-
F
|
|
734
|
+
if (ie.lastIndex = c, ie.test(e)) {
|
|
735
|
+
if (f = ie.lastIndex - c, C = f * a, A + C > S && (v = Math.min(v, c + Math.floor((S - A) / a))), A + C > i) {
|
|
736
|
+
F = !0;
|
|
897
737
|
break;
|
|
898
738
|
}
|
|
899
|
-
A
|
|
739
|
+
A += C, B = $, b = c, c = $ = ie.lastIndex;
|
|
900
740
|
continue;
|
|
901
741
|
}
|
|
902
|
-
if (Ae.lastIndex = c
|
|
903
|
-
if (A
|
|
904
|
-
F
|
|
742
|
+
if (Ae.lastIndex = c, Ae.test(e)) {
|
|
743
|
+
if (A + g > S && (v = Math.min(v, c)), A + g > i) {
|
|
744
|
+
F = !0;
|
|
905
745
|
break;
|
|
906
746
|
}
|
|
907
|
-
A
|
|
747
|
+
A += g, B = $, b = c, c = $ = Ae.lastIndex;
|
|
908
748
|
continue;
|
|
909
749
|
}
|
|
910
|
-
c
|
|
750
|
+
c += 1;
|
|
911
751
|
}
|
|
912
752
|
return {
|
|
913
|
-
width: F
|
|
914
|
-
index: F
|
|
915
|
-
truncated: F
|
|
916
|
-
ellipsed: F
|
|
753
|
+
width: F ? S : A,
|
|
754
|
+
index: F ? v : m,
|
|
755
|
+
truncated: F,
|
|
756
|
+
ellipsed: F && i >= o
|
|
917
757
|
};
|
|
918
758
|
}, yt = {
|
|
919
759
|
limit: Infinity,
|
|
@@ -931,12 +771,12 @@ const ee = ht(), ue = () => process.env.CI === "true", Te = (e) => e.isTTY === !
|
|
|
931
771
|
if (e === 0) return 0;
|
|
932
772
|
}, 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
773
|
const i = r[Symbol.iterator]();
|
|
934
|
-
let n = !1, o = !1, u
|
|
774
|
+
let n = !1, o = !1, u = e.at(-1), l = u === void 0 ? 0 : M$1(u), a = i.next(), d = i.next(), g = 0;
|
|
935
775
|
for (; !a.done;) {
|
|
936
|
-
const E
|
|
937
|
-
l
|
|
776
|
+
const E = a.value, p = M$1(E);
|
|
777
|
+
l + p <= s ? e[e.length - 1] += E : (e.push(E), l = 0), (E === ae || E === je) && (n = !0, o = r.startsWith(we, g + 1)), n ? o ? E === Ce && (n = !1, o = !1) : E === ke && (n = !1) : (l += p, l === s && !d.done && (e.push(""), l = 0)), a = d, d = i.next(), g += E.length;
|
|
938
778
|
}
|
|
939
|
-
u
|
|
779
|
+
u = e.at(-1), !l && u !== void 0 && u.length > 0 && e.length > 1 && (e[e.length - 2] += e.pop());
|
|
940
780
|
}, wt = (e) => {
|
|
941
781
|
const r = e.split(" ");
|
|
942
782
|
let s = r.length;
|
|
@@ -945,51 +785,51 @@ const ee = ht(), ue = () => process.env.CI === "true", Te = (e) => e.isTTY === !
|
|
|
945
785
|
}, St = (e, r, s = {}) => {
|
|
946
786
|
if (s.trim !== !1 && e.trim() === "") return "";
|
|
947
787
|
let i = "", n, o;
|
|
948
|
-
const u
|
|
788
|
+
const u = e.split(" "), l = Ct(u);
|
|
949
789
|
let a = [""];
|
|
950
|
-
for (const [$, c
|
|
790
|
+
for (const [$, c] of u.entries()) {
|
|
951
791
|
s.trim !== !1 && (a[a.length - 1] = (a.at(-1) ?? "").trimStart());
|
|
952
|
-
let m
|
|
953
|
-
if ($ !== 0 && (m
|
|
954
|
-
const f
|
|
955
|
-
Math.floor((l
|
|
792
|
+
let m = M$1(a.at(-1) ?? "");
|
|
793
|
+
if ($ !== 0 && (m >= r && (s.wordWrap === !1 || s.trim === !1) && (a.push(""), m = 0), (m > 0 || s.trim === !1) && (a[a.length - 1] += " ", m++)), s.hard && l[$] > r) {
|
|
794
|
+
const f = r - m, F = 1 + Math.floor((l[$] - f - 1) / r);
|
|
795
|
+
Math.floor((l[$] - 1) / r) < F && a.push(""), Se(a, c, r);
|
|
956
796
|
continue;
|
|
957
797
|
}
|
|
958
|
-
if (m
|
|
959
|
-
if (s.wordWrap === !1 && m
|
|
960
|
-
Se(a, c
|
|
798
|
+
if (m + l[$] > r && m > 0 && l[$] > 0) {
|
|
799
|
+
if (s.wordWrap === !1 && m < r) {
|
|
800
|
+
Se(a, c, r);
|
|
961
801
|
continue;
|
|
962
802
|
}
|
|
963
803
|
a.push("");
|
|
964
804
|
}
|
|
965
|
-
if (m
|
|
966
|
-
Se(a, c
|
|
805
|
+
if (m + l[$] > r && s.wordWrap === !1) {
|
|
806
|
+
Se(a, c, r);
|
|
967
807
|
continue;
|
|
968
808
|
}
|
|
969
|
-
a[a.length - 1] += c
|
|
809
|
+
a[a.length - 1] += c;
|
|
970
810
|
}
|
|
971
811
|
s.trim !== !1 && (a = a.map(($) => wt($)));
|
|
972
|
-
const d
|
|
973
|
-
`), g
|
|
974
|
-
let E
|
|
975
|
-
for (; !E
|
|
976
|
-
const $ = E
|
|
812
|
+
const d = a.join(`
|
|
813
|
+
`), g = d[Symbol.iterator]();
|
|
814
|
+
let E = g.next(), p = g.next(), y = 0;
|
|
815
|
+
for (; !E.done;) {
|
|
816
|
+
const $ = E.value, c = p.value;
|
|
977
817
|
if (i += $, $ === ae || $ === je) {
|
|
978
|
-
Ge.lastIndex = y
|
|
979
|
-
const F
|
|
980
|
-
if (F
|
|
981
|
-
const v
|
|
982
|
-
n = v
|
|
983
|
-
} else F
|
|
984
|
-
}
|
|
985
|
-
const m
|
|
986
|
-
c
|
|
987
|
-
` ? (o && (i += Ue("")), n && m
|
|
988
|
-
` && (n && m
|
|
818
|
+
Ge.lastIndex = y + 1;
|
|
819
|
+
const F = Ge.exec(d)?.groups;
|
|
820
|
+
if (F?.code !== void 0) {
|
|
821
|
+
const v = Number.parseFloat(F.code);
|
|
822
|
+
n = v === Et ? void 0 : v;
|
|
823
|
+
} else F?.uri !== void 0 && (o = F.uri.length === 0 ? void 0 : F.uri);
|
|
824
|
+
}
|
|
825
|
+
const m = n ? At(n) : void 0;
|
|
826
|
+
c === `
|
|
827
|
+
` ? (o && (i += Ue("")), n && m && (i += He(m))) : $ === `
|
|
828
|
+
` && (n && m && (i += He(n)), o && (i += Ue(o))), y += $.length, E = p, p = g.next();
|
|
989
829
|
}
|
|
990
830
|
return i;
|
|
991
831
|
};
|
|
992
|
-
function q
|
|
832
|
+
function q(e, r, s) {
|
|
993
833
|
return String(e).normalize().replaceAll(`\r
|
|
994
834
|
`, `
|
|
995
835
|
`).split(`
|
|
@@ -997,212 +837,43 @@ function q$1(e, r, s) {
|
|
|
997
837
|
`);
|
|
998
838
|
}
|
|
999
839
|
const It = (e, r, s, i, n) => {
|
|
1000
|
-
let o = r, u
|
|
1001
|
-
for (let l
|
|
1002
|
-
const a = e[l
|
|
1003
|
-
if (o = o - a.length, u
|
|
840
|
+
let o = r, u = 0;
|
|
841
|
+
for (let l = s; l < i; l++) {
|
|
842
|
+
const a = e[l];
|
|
843
|
+
if (o = o - a.length, u++, o <= n) break;
|
|
1004
844
|
}
|
|
1005
845
|
return {
|
|
1006
846
|
lineCount: o,
|
|
1007
|
-
removals: u
|
|
847
|
+
removals: u
|
|
1008
848
|
};
|
|
1009
849
|
}, J = (e) => {
|
|
1010
|
-
const { cursor: r, options: s, style: i } = e, n = e.output ?? process.stdout, o = rt(n), u
|
|
850
|
+
const { cursor: r, options: s, style: i } = e, n = e.output ?? process.stdout, o = rt(n), u = e.columnPadding ?? 0, l = e.rowPadding ?? 4, a = o - u, d = nt(n), g = import_picocolors.default.dim("..."), E = e.maxItems ?? Number.POSITIVE_INFINITY, p = Math.max(d - l, 0), y = Math.max(Math.min(E, p), 5);
|
|
1011
851
|
let $ = 0;
|
|
1012
|
-
r >= y
|
|
1013
|
-
let c
|
|
1014
|
-
const f
|
|
1015
|
-
let v
|
|
1016
|
-
c
|
|
1017
|
-
const S
|
|
1018
|
-
for (let A
|
|
1019
|
-
const C
|
|
852
|
+
r >= y - 3 && ($ = Math.max(Math.min(r - y + 3, s.length - y), 0));
|
|
853
|
+
let c = y < s.length && $ > 0, m = y < s.length && $ + y < s.length;
|
|
854
|
+
const f = Math.min($ + y, s.length), F = [];
|
|
855
|
+
let v = 0;
|
|
856
|
+
c && v++, m && v++;
|
|
857
|
+
const S = $ + (c ? 1 : 0), B = f - (m ? 1 : 0);
|
|
858
|
+
for (let A = S; A < B; A++) {
|
|
859
|
+
const C = q(i(s[A], A === r), a, {
|
|
1020
860
|
hard: !0,
|
|
1021
861
|
trim: !1
|
|
1022
862
|
}).split(`
|
|
1023
863
|
`);
|
|
1024
|
-
F
|
|
864
|
+
F.push(C), v += C.length;
|
|
1025
865
|
}
|
|
1026
|
-
if (v
|
|
1027
|
-
let A
|
|
1028
|
-
const D
|
|
1029
|
-
c
|
|
866
|
+
if (v > p) {
|
|
867
|
+
let A = 0, C = 0, _ = v;
|
|
868
|
+
const D = r - S, T = (W, I) => It(F, _, W, I, p);
|
|
869
|
+
c ? ({lineCount: _, removals: A} = T(0, D), _ > p && ({lineCount: _, removals: C} = T(D + 1, F.length))) : ({lineCount: _, removals: C} = T(D + 1, F.length), _ > p && ({lineCount: _, removals: A} = T(0, D))), A > 0 && (c = !0, F.splice(0, A)), C > 0 && (m = !0, F.splice(F.length - C, C));
|
|
1030
870
|
}
|
|
1031
|
-
const b
|
|
1032
|
-
c
|
|
1033
|
-
for (const A
|
|
1034
|
-
return m
|
|
871
|
+
const b = [];
|
|
872
|
+
c && b.push(g);
|
|
873
|
+
for (const A of F) for (const C of A) b.push(C);
|
|
874
|
+
return m && b.push(g), b;
|
|
1035
875
|
};
|
|
1036
|
-
|
|
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) => {
|
|
876
|
+
const Mt = (e) => {
|
|
1206
877
|
const r = e.active ?? "Yes", s = e.inactive ?? "No";
|
|
1207
878
|
return new kt$1({
|
|
1208
879
|
active: r,
|
|
@@ -1219,7 +890,7 @@ ${N$1(this.state)} ${e.message}
|
|
|
1219
890
|
case "submit": return `${i}${import_picocolors.default.gray(h$1)} ${import_picocolors.default.dim(n)}`;
|
|
1220
891
|
case "cancel": return `${i}${import_picocolors.default.gray(h$1)} ${import_picocolors.default.strikethrough(import_picocolors.default.dim(n))}
|
|
1221
892
|
${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
|
|
893
|
+
default: return `${i}${import_picocolors.default.cyan(h$1)} ${this.value ? `${import_picocolors.default.green(Y)} ${r}` : `${import_picocolors.default.dim(K)} ${import_picocolors.default.dim(r)}`} ${import_picocolors.default.dim("/")} ${this.value ? `${import_picocolors.default.dim(K)} ${import_picocolors.default.dim(s)}` : `${import_picocolors.default.green(Y)} ${s}`}
|
|
1223
894
|
${import_picocolors.default.cyan(x$1)}
|
|
1224
895
|
`;
|
|
1225
896
|
}
|
|
@@ -1228,105 +899,28 @@ ${import_picocolors.default.cyan(x$1)}
|
|
|
1228
899
|
}, Rt = async (e, r) => {
|
|
1229
900
|
const s = {}, i = Object.keys(e);
|
|
1230
901
|
for (const n of i) {
|
|
1231
|
-
const o = e[n], u
|
|
1232
|
-
throw l
|
|
902
|
+
const o = e[n], u = await o({ results: s })?.catch((l) => {
|
|
903
|
+
throw l;
|
|
1233
904
|
});
|
|
1234
|
-
if (typeof r?.onCancel == "function" && Ct$1(u
|
|
905
|
+
if (typeof r?.onCancel == "function" && Ct$1(u)) {
|
|
1235
906
|
s[n] = "canceled", r.onCancel({ results: s });
|
|
1236
907
|
continue;
|
|
1237
908
|
}
|
|
1238
|
-
s[n] = u
|
|
909
|
+
s[n] = u;
|
|
1239
910
|
}
|
|
1240
911
|
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
912
|
}, R$1 = {
|
|
1319
913
|
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
|
|
1321
|
-
for (let p
|
|
1322
|
-
const E
|
|
914
|
+
const u = [], l = (o ?? _$1.withGuide) !== !1, a = l ? s : "", d = l ? `${r} ` : "", g = l ? `${s} ` : "";
|
|
915
|
+
for (let p = 0; p < n; p++) u.push(a);
|
|
916
|
+
const E = Array.isArray(e) ? e : e.split(`
|
|
1323
917
|
`);
|
|
1324
|
-
if (E
|
|
1325
|
-
const [p
|
|
1326
|
-
p
|
|
1327
|
-
for (const $ of y
|
|
918
|
+
if (E.length > 0) {
|
|
919
|
+
const [p, ...y] = E;
|
|
920
|
+
p.length > 0 ? u.push(`${d}${p}`) : u.push(l ? r : "");
|
|
921
|
+
for (const $ of y) $.length > 0 ? u.push(`${g}${$}`) : u.push(l ? s : "");
|
|
1328
922
|
}
|
|
1329
|
-
i.write(`${u
|
|
923
|
+
i.write(`${u.join(`
|
|
1330
924
|
`)}
|
|
1331
925
|
`);
|
|
1332
926
|
},
|
|
@@ -1345,7 +939,7 @@ ${import_picocolors.default.cyan(x$1)}
|
|
|
1345
939
|
step: (e, r) => {
|
|
1346
940
|
R$1.message(e, {
|
|
1347
941
|
...r,
|
|
1348
|
-
symbol: import_picocolors.default.green(k
|
|
942
|
+
symbol: import_picocolors.default.green(k)
|
|
1349
943
|
});
|
|
1350
944
|
},
|
|
1351
945
|
warn: (e, r) => {
|
|
@@ -1380,7 +974,7 @@ ${import_picocolors.default.gray(x$1)} ${e}
|
|
|
1380
974
|
`), Lt = (e) => {
|
|
1381
975
|
const r = (i, n) => {
|
|
1382
976
|
const o = i.label ?? String(i.value);
|
|
1383
|
-
return n === "disabled" ? `${import_picocolors.default.gray(z$1)} ${Q(o, (u
|
|
977
|
+
return n === "disabled" ? `${import_picocolors.default.gray(z$1)} ${Q(o, (u) => import_picocolors.default.strikethrough(import_picocolors.default.gray(u)))}${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)} ${Q(o, import_picocolors.default.dim)}${i.hint ? ` ${import_picocolors.default.dim(`(${i.hint})`)}` : ""}` : n === "cancelled" ? `${Q(o, (u) => import_picocolors.default.strikethrough(import_picocolors.default.dim(u)))}` : n === "active-selected" ? `${import_picocolors.default.green(G)} ${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
978
|
}, s = e.required ?? !0;
|
|
1385
979
|
return new Mt$1({
|
|
1386
980
|
options: e.options,
|
|
@@ -1397,54 +991,54 @@ ${import_picocolors.default.reset(import_picocolors.default.dim(`Press ${import_
|
|
|
1397
991
|
render() {
|
|
1398
992
|
const i = Bt$1(e.output, e.message, `${Ee(this.state)} `, `${N$1(this.state)} `), n = `${import_picocolors.default.gray(h$1)}
|
|
1399
993
|
${i}
|
|
1400
|
-
`, o = this.value ?? [], u
|
|
1401
|
-
if (l
|
|
1402
|
-
const d
|
|
1403
|
-
return a && d
|
|
994
|
+
`, o = this.value ?? [], u = (l, a) => {
|
|
995
|
+
if (l.disabled) return r(l, "disabled");
|
|
996
|
+
const d = o.includes(l.value);
|
|
997
|
+
return a && d ? r(l, "active-selected") : d ? r(l, "selected") : r(l, a ? "active" : "inactive");
|
|
1404
998
|
};
|
|
1405
999
|
switch (this.state) {
|
|
1406
1000
|
case "submit": {
|
|
1407
|
-
const l
|
|
1408
|
-
return `${n}${Bt$1(e.output, l
|
|
1001
|
+
const l = this.options.filter(({ value: d }) => o.includes(d)).map((d) => r(d, "submitted")).join(import_picocolors.default.dim(", ")) || import_picocolors.default.dim("none");
|
|
1002
|
+
return `${n}${Bt$1(e.output, l, `${import_picocolors.default.gray(h$1)} `)}`;
|
|
1409
1003
|
}
|
|
1410
1004
|
case "cancel": {
|
|
1411
|
-
const l
|
|
1412
|
-
if (l
|
|
1413
|
-
return `${n}${Bt$1(e.output, l
|
|
1005
|
+
const l = this.options.filter(({ value: d }) => o.includes(d)).map((d) => r(d, "cancelled")).join(import_picocolors.default.dim(", "));
|
|
1006
|
+
if (l.trim() === "") return `${n}${import_picocolors.default.gray(h$1)}`;
|
|
1007
|
+
return `${n}${Bt$1(e.output, l, `${import_picocolors.default.gray(h$1)} `)}
|
|
1414
1008
|
${import_picocolors.default.gray(h$1)}`;
|
|
1415
1009
|
}
|
|
1416
1010
|
case "error": {
|
|
1417
|
-
const l
|
|
1418
|
-
`).map((E
|
|
1419
|
-
`), d
|
|
1420
|
-
`).length, g
|
|
1011
|
+
const l = `${import_picocolors.default.yellow(h$1)} `, a = this.error.split(`
|
|
1012
|
+
`).map((E, p) => p === 0 ? `${import_picocolors.default.yellow(x$1)} ${import_picocolors.default.yellow(E)}` : ` ${E}`).join(`
|
|
1013
|
+
`), d = n.split(`
|
|
1014
|
+
`).length, g = a.split(`
|
|
1421
1015
|
`).length + 1;
|
|
1422
|
-
return `${n}${l
|
|
1016
|
+
return `${n}${l}${J({
|
|
1423
1017
|
output: e.output,
|
|
1424
1018
|
options: this.options,
|
|
1425
1019
|
cursor: this.cursor,
|
|
1426
1020
|
maxItems: e.maxItems,
|
|
1427
|
-
columnPadding: l
|
|
1428
|
-
rowPadding: d
|
|
1429
|
-
style: u
|
|
1021
|
+
columnPadding: l.length,
|
|
1022
|
+
rowPadding: d + g,
|
|
1023
|
+
style: u
|
|
1430
1024
|
}).join(`
|
|
1431
|
-
${l
|
|
1025
|
+
${l}`)}
|
|
1432
1026
|
${a}
|
|
1433
1027
|
`;
|
|
1434
1028
|
}
|
|
1435
1029
|
default: {
|
|
1436
|
-
const l
|
|
1030
|
+
const l = `${import_picocolors.default.cyan(h$1)} `, a = n.split(`
|
|
1437
1031
|
`).length;
|
|
1438
|
-
return `${n}${l
|
|
1032
|
+
return `${n}${l}${J({
|
|
1439
1033
|
output: e.output,
|
|
1440
1034
|
options: this.options,
|
|
1441
1035
|
cursor: this.cursor,
|
|
1442
1036
|
maxItems: e.maxItems,
|
|
1443
|
-
columnPadding: l
|
|
1037
|
+
columnPadding: l.length,
|
|
1444
1038
|
rowPadding: a + 2,
|
|
1445
|
-
style: u
|
|
1039
|
+
style: u
|
|
1446
1040
|
}).join(`
|
|
1447
|
-
${l
|
|
1041
|
+
${l}`)}
|
|
1448
1042
|
${import_picocolors.default.cyan(x$1)}
|
|
1449
1043
|
`;
|
|
1450
1044
|
}
|
|
@@ -1455,87 +1049,25 @@ ${import_picocolors.default.cyan(x$1)}
|
|
|
1455
1049
|
const i = {
|
|
1456
1050
|
hard: !0,
|
|
1457
1051
|
trim: !1
|
|
1458
|
-
}, n = q
|
|
1459
|
-
`), o = n.reduce((a, d
|
|
1460
|
-
return q
|
|
1052
|
+
}, n = q(e, r, i).split(`
|
|
1053
|
+
`), o = n.reduce((a, d) => Math.max(M$1(d), a), 0);
|
|
1054
|
+
return q(e, r - (n.map(s).reduce((a, d) => Math.max(M$1(d), a), 0) - o), i);
|
|
1461
1055
|
}, kt = (e = "", r = "", s) => {
|
|
1462
|
-
const i = s?.output ?? process$1.stdout, n = (s?.withGuide ?? _$1.withGuide) !== !1, o = s?.format ?? jt, u
|
|
1056
|
+
const i = s?.output ?? process$1.stdout, n = (s?.withGuide ?? _$1.withGuide) !== !1, o = s?.format ?? jt, u = [
|
|
1463
1057
|
"",
|
|
1464
1058
|
...Vt(e, rt(i) - 6, o).split(`
|
|
1465
1059
|
`).map(o),
|
|
1466
1060
|
""
|
|
1467
|
-
], l
|
|
1468
|
-
const $ = M$1(y
|
|
1469
|
-
return $ > p
|
|
1470
|
-
}, 0), l
|
|
1471
|
-
`), g
|
|
1472
|
-
` : "", E
|
|
1473
|
-
i.write(`${g
|
|
1474
|
-
${d
|
|
1475
|
-
${import_picocolors.default.gray(E
|
|
1061
|
+
], l = M$1(r), a = Math.max(u.reduce((p, y) => {
|
|
1062
|
+
const $ = M$1(y);
|
|
1063
|
+
return $ > p ? $ : p;
|
|
1064
|
+
}, 0), l) + 2, d = u.map((p) => `${import_picocolors.default.gray(h$1)} ${p}${" ".repeat(a - M$1(p))}${import_picocolors.default.gray(h$1)}`).join(`
|
|
1065
|
+
`), g = n ? `${import_picocolors.default.gray(h$1)}
|
|
1066
|
+
` : "", E = n ? Ne : pe;
|
|
1067
|
+
i.write(`${g}${import_picocolors.default.green(k)} ${import_picocolors.default.reset(r)} ${import_picocolors.default.gray(se.repeat(Math.max(a - l - 1, 1)) + he)}
|
|
1068
|
+
${d}
|
|
1069
|
+
${import_picocolors.default.gray(E + se.repeat(a + 2) + me)}
|
|
1476
1070
|
`);
|
|
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
|
-
`;
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
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
1071
|
}, Ut = import_picocolors.default.magenta, Ie = ({ indicator: e = "dots", onCancel: r, output: s = process.stdout, cancelMessage: i, errorMessage: n, frames: o = ee ? [
|
|
1540
1072
|
"◒",
|
|
1541
1073
|
"◐",
|
|
@@ -1546,76 +1078,73 @@ ${import_picocolors.default.cyan(x$1)}
|
|
|
1546
1078
|
"o",
|
|
1547
1079
|
"O",
|
|
1548
1080
|
"0"
|
|
1549
|
-
], delay: u
|
|
1550
|
-
const d
|
|
1551
|
-
let g
|
|
1552
|
-
const f
|
|
1553
|
-
const O
|
|
1554
|
-
y
|
|
1555
|
-
}, S
|
|
1556
|
-
process.on("uncaughtExceptionMonitor", S
|
|
1557
|
-
}, A
|
|
1558
|
-
process.removeListener("uncaughtExceptionMonitor", S
|
|
1559
|
-
}, C
|
|
1560
|
-
if (c
|
|
1561
|
-
d
|
|
1081
|
+
], delay: u = ee ? 80 : 120, signal: l, ...a } = {}) => {
|
|
1082
|
+
const d = ue();
|
|
1083
|
+
let g, E, p = !1, y = !1, $ = "", c, m = performance.now();
|
|
1084
|
+
const f = rt(s), F = a?.styleFrame ?? Ut, v = (I) => {
|
|
1085
|
+
const O = I > 1 ? n ?? _$1.messages.error : i ?? _$1.messages.cancel;
|
|
1086
|
+
y = I === 1, p && (W(O, I), y && typeof r == "function" && r());
|
|
1087
|
+
}, S = () => v(2), B = () => v(1), b = () => {
|
|
1088
|
+
process.on("uncaughtExceptionMonitor", S), process.on("unhandledRejection", S), process.on("SIGINT", B), process.on("SIGTERM", B), process.on("exit", v), l && l.addEventListener("abort", B);
|
|
1089
|
+
}, A = () => {
|
|
1090
|
+
process.removeListener("uncaughtExceptionMonitor", S), process.removeListener("unhandledRejection", S), process.removeListener("SIGINT", B), process.removeListener("SIGTERM", B), process.removeListener("exit", v), l && l.removeEventListener("abort", B);
|
|
1091
|
+
}, C = () => {
|
|
1092
|
+
if (c === void 0) return;
|
|
1093
|
+
d && s.write(`
|
|
1562
1094
|
`);
|
|
1563
|
-
const I
|
|
1095
|
+
const I = q(c, f, {
|
|
1564
1096
|
hard: !0,
|
|
1565
1097
|
trim: !1
|
|
1566
1098
|
}).split(`
|
|
1567
1099
|
`);
|
|
1568
|
-
I
|
|
1569
|
-
}, _
|
|
1570
|
-
const O
|
|
1571
|
-
return L
|
|
1572
|
-
}, T
|
|
1573
|
-
p
|
|
1100
|
+
I.length > 1 && s.write(import_src.cursor.up(I.length - 1)), s.write(import_src.cursor.to(0)), s.write(import_src.erase.down());
|
|
1101
|
+
}, _ = (I) => I.replace(/\.+$/, ""), D = (I) => {
|
|
1102
|
+
const O = (performance.now() - I) / 1e3, L = Math.floor(O / 60), j = Math.floor(O % 60);
|
|
1103
|
+
return L > 0 ? `[${L}m ${j}s]` : `[${j}s]`;
|
|
1104
|
+
}, T = (I = "") => {
|
|
1105
|
+
p = !0, g = xt$1({ output: s }), $ = _(I), m = performance.now(), s.write(`${import_picocolors.default.gray(h$1)}
|
|
1574
1106
|
`);
|
|
1575
|
-
let O
|
|
1576
|
-
b
|
|
1577
|
-
if (d
|
|
1578
|
-
C
|
|
1579
|
-
const j
|
|
1580
|
-
let Z
|
|
1581
|
-
if (d
|
|
1582
|
-
else if (e === "timer") Z
|
|
1107
|
+
let O = 0, L = 0;
|
|
1108
|
+
b(), E = setInterval(() => {
|
|
1109
|
+
if (d && $ === c) return;
|
|
1110
|
+
C(), c = $;
|
|
1111
|
+
const j = F(o[O]);
|
|
1112
|
+
let Z;
|
|
1113
|
+
if (d) Z = `${j} ${$}...`;
|
|
1114
|
+
else if (e === "timer") Z = `${j} ${$} ${D(m)}`;
|
|
1583
1115
|
else {
|
|
1584
|
-
const Ze = ".".repeat(Math.floor(L
|
|
1585
|
-
Z
|
|
1116
|
+
const Ze = ".".repeat(Math.floor(L)).slice(0, 3);
|
|
1117
|
+
Z = `${j} ${$}${Ze}`;
|
|
1586
1118
|
}
|
|
1587
|
-
const Qe = q
|
|
1119
|
+
const Qe = q(Z, f, {
|
|
1588
1120
|
hard: !0,
|
|
1589
1121
|
trim: !1
|
|
1590
1122
|
});
|
|
1591
|
-
s.write(Qe), O
|
|
1592
|
-
}, u
|
|
1593
|
-
}, W
|
|
1594
|
-
if (!p
|
|
1595
|
-
p
|
|
1596
|
-
const j
|
|
1597
|
-
$ = I
|
|
1598
|
-
`) : s.write(`${j
|
|
1599
|
-
`)), A
|
|
1123
|
+
s.write(Qe), O = O + 1 < o.length ? O + 1 : 0, L = L < 4 ? L + .125 : 0;
|
|
1124
|
+
}, u);
|
|
1125
|
+
}, W = (I = "", O = 0, L = !1) => {
|
|
1126
|
+
if (!p) return;
|
|
1127
|
+
p = !1, clearInterval(E), C();
|
|
1128
|
+
const j = O === 0 ? import_picocolors.default.green(k) : O === 1 ? import_picocolors.default.red(ce) : import_picocolors.default.red(de);
|
|
1129
|
+
$ = I ?? $, L || (e === "timer" ? s.write(`${j} ${$} ${D(m)}
|
|
1130
|
+
`) : s.write(`${j} ${$}
|
|
1131
|
+
`)), A(), g();
|
|
1600
1132
|
};
|
|
1601
1133
|
return {
|
|
1602
|
-
start: T
|
|
1603
|
-
stop: (I
|
|
1604
|
-
message: (I
|
|
1605
|
-
$ = _
|
|
1134
|
+
start: T,
|
|
1135
|
+
stop: (I = "") => W(I, 0),
|
|
1136
|
+
message: (I = "") => {
|
|
1137
|
+
$ = _(I ?? $);
|
|
1606
1138
|
},
|
|
1607
|
-
cancel: (I
|
|
1608
|
-
error: (I
|
|
1609
|
-
clear: () => W
|
|
1139
|
+
cancel: (I = "") => W(I, 1),
|
|
1140
|
+
error: (I = "") => W(I, 2),
|
|
1141
|
+
clear: () => W("", 0, !0),
|
|
1610
1142
|
get isCancelled() {
|
|
1611
|
-
return y
|
|
1143
|
+
return y;
|
|
1612
1144
|
}
|
|
1613
1145
|
};
|
|
1614
|
-
}, Ye = {
|
|
1615
|
-
light: w$1("─", "-"),
|
|
1616
|
-
heavy: w$1("━", "="),
|
|
1617
|
-
block: w$1("█", "#")
|
|
1618
1146
|
};
|
|
1147
|
+
w$1("─", "-"), w$1("━", "="), w$1("█", "#");
|
|
1619
1148
|
const oe = (e, r) => e.includes(`
|
|
1620
1149
|
`) ? e.split(`
|
|
1621
1150
|
`).map((s) => r(s)).join(`
|
|
@@ -1623,11 +1152,11 @@ const oe = (e, r) => e.includes(`
|
|
|
1623
1152
|
const r = (s, i) => {
|
|
1624
1153
|
const n = s.label ?? String(s.value);
|
|
1625
1154
|
switch (i) {
|
|
1626
|
-
case "disabled": return `${import_picocolors.default.gray(K
|
|
1155
|
+
case "disabled": return `${import_picocolors.default.gray(K)} ${oe(n, import_picocolors.default.gray)}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1627
1156
|
case "selected": return `${oe(n, import_picocolors.default.dim)}`;
|
|
1628
1157
|
case "active": return `${import_picocolors.default.green(Y)} ${n}${s.hint ? ` ${import_picocolors.default.dim(`(${s.hint})`)}` : ""}`;
|
|
1629
1158
|
case "cancelled": return `${oe(n, (o) => import_picocolors.default.strikethrough(import_picocolors.default.dim(o)))}`;
|
|
1630
|
-
default: return `${import_picocolors.default.dim(K
|
|
1159
|
+
default: return `${import_picocolors.default.dim(K)} ${oe(n, import_picocolors.default.dim)}`;
|
|
1631
1160
|
}
|
|
1632
1161
|
};
|
|
1633
1162
|
return new Wt$1({
|
|
@@ -1642,70 +1171,34 @@ ${n}
|
|
|
1642
1171
|
`;
|
|
1643
1172
|
switch (this.state) {
|
|
1644
1173
|
case "submit": {
|
|
1645
|
-
const u
|
|
1646
|
-
return `${o}${Bt$1(e.output, r(this.options[this.cursor], "selected"), u
|
|
1174
|
+
const u = `${import_picocolors.default.gray(h$1)} `;
|
|
1175
|
+
return `${o}${Bt$1(e.output, r(this.options[this.cursor], "selected"), u)}`;
|
|
1647
1176
|
}
|
|
1648
1177
|
case "cancel": {
|
|
1649
|
-
const u
|
|
1650
|
-
return `${o}${Bt$1(e.output, r(this.options[this.cursor], "cancelled"), u
|
|
1178
|
+
const u = `${import_picocolors.default.gray(h$1)} `;
|
|
1179
|
+
return `${o}${Bt$1(e.output, r(this.options[this.cursor], "cancelled"), u)}
|
|
1651
1180
|
${import_picocolors.default.gray(h$1)}`;
|
|
1652
1181
|
}
|
|
1653
1182
|
default: {
|
|
1654
|
-
const u
|
|
1183
|
+
const u = `${import_picocolors.default.cyan(h$1)} `, l = o.split(`
|
|
1655
1184
|
`).length;
|
|
1656
|
-
return `${o}${u
|
|
1185
|
+
return `${o}${u}${J({
|
|
1657
1186
|
output: e.output,
|
|
1658
1187
|
cursor: this.cursor,
|
|
1659
1188
|
options: this.options,
|
|
1660
1189
|
maxItems: e.maxItems,
|
|
1661
|
-
columnPadding: u
|
|
1662
|
-
rowPadding: l
|
|
1663
|
-
style: (a, d
|
|
1190
|
+
columnPadding: u.length,
|
|
1191
|
+
rowPadding: l + 2,
|
|
1192
|
+
style: (a, d) => r(a, a.disabled ? "disabled" : d ? "active" : "inactive")
|
|
1664
1193
|
}).join(`
|
|
1665
|
-
${u
|
|
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
|
-
`)}
|
|
1194
|
+
${u}`)}
|
|
1702
1195
|
${import_picocolors.default.cyan(x$1)}
|
|
1703
1196
|
`;
|
|
1704
1197
|
}
|
|
1705
1198
|
}
|
|
1706
1199
|
}
|
|
1707
1200
|
}).prompt();
|
|
1708
|
-
}, ze = `${import_picocolors.default.gray(h$1)} `, H
|
|
1201
|
+
}, ze = `${import_picocolors.default.gray(h$1)} `, H = {
|
|
1709
1202
|
message: async (e, { symbol: r = import_picocolors.default.gray(h$1) } = {}) => {
|
|
1710
1203
|
process.stdout.write(`${import_picocolors.default.gray(h$1)}
|
|
1711
1204
|
${r} `);
|
|
@@ -1722,137 +1215,129 @@ ${ze}${i.trimStart()}`), s = 3 + stripVTControlCharacters(i.trimStart()).length)
|
|
|
1722
1215
|
process.stdout.write(`
|
|
1723
1216
|
`);
|
|
1724
1217
|
},
|
|
1725
|
-
info: (e) => H
|
|
1726
|
-
success: (e) => H
|
|
1727
|
-
step: (e) => H
|
|
1728
|
-
warn: (e) => H
|
|
1729
|
-
warning: (e) => H
|
|
1730
|
-
error: (e) => H
|
|
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
|
-
}
|
|
1218
|
+
info: (e) => H.message(e, { symbol: import_picocolors.default.blue(ge) }),
|
|
1219
|
+
success: (e) => H.message(e, { symbol: import_picocolors.default.green(fe) }),
|
|
1220
|
+
step: (e) => H.message(e, { symbol: import_picocolors.default.green(k) }),
|
|
1221
|
+
warn: (e) => H.message(e, { symbol: import_picocolors.default.yellow(Fe) }),
|
|
1222
|
+
warning: (e) => H.warn(e),
|
|
1223
|
+
error: (e) => H.message(e, { symbol: import_picocolors.default.red(ye) })
|
|
1739
1224
|
}, 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
|
|
1225
|
+
const r = e.output ?? process.stdout, s = rt(r), i = import_picocolors.default.gray(h$1), n = e.spacing ?? 1, o = 3, u = e.retainLog === !0, l = !ue() && Te(r);
|
|
1741
1226
|
r.write(`${i}
|
|
1742
|
-
`), r.write(`${import_picocolors.default.green(k
|
|
1227
|
+
`), r.write(`${import_picocolors.default.green(k)} ${e.title}
|
|
1743
1228
|
`);
|
|
1744
|
-
for (let m
|
|
1229
|
+
for (let m = 0; m < n; m++) r.write(`${i}
|
|
1745
1230
|
`);
|
|
1746
1231
|
const a = [{
|
|
1747
1232
|
value: "",
|
|
1748
1233
|
full: ""
|
|
1749
1234
|
}];
|
|
1750
|
-
let d
|
|
1751
|
-
const g
|
|
1235
|
+
let d = !1;
|
|
1236
|
+
const g = (m) => {
|
|
1752
1237
|
if (a.length === 0) return;
|
|
1753
|
-
let f
|
|
1754
|
-
m
|
|
1755
|
-
for (const F
|
|
1756
|
-
const { value: v
|
|
1757
|
-
let B
|
|
1758
|
-
if (B
|
|
1759
|
-
S
|
|
1760
|
-
${F
|
|
1761
|
-
const b
|
|
1762
|
-
`).reduce((A
|
|
1763
|
-
f
|
|
1764
|
-
}
|
|
1765
|
-
f
|
|
1766
|
-
}, E
|
|
1767
|
-
const v
|
|
1768
|
-
${m
|
|
1769
|
-
m
|
|
1238
|
+
let f = 0;
|
|
1239
|
+
m && (f += n + 2);
|
|
1240
|
+
for (const F of a) {
|
|
1241
|
+
const { value: v, result: S } = F;
|
|
1242
|
+
let B = S?.message ?? v;
|
|
1243
|
+
if (B.length === 0) continue;
|
|
1244
|
+
S === void 0 && F.header !== void 0 && F.header !== "" && (B += `
|
|
1245
|
+
${F.header}`);
|
|
1246
|
+
const b = B.split(`
|
|
1247
|
+
`).reduce((A, C) => C === "" ? A + 1 : A + Math.ceil((C.length + o) / s), 0);
|
|
1248
|
+
f += b;
|
|
1249
|
+
}
|
|
1250
|
+
f > 0 && (f += 1, r.write(import_src.erase.lines(f)));
|
|
1251
|
+
}, E = (m, f, F) => {
|
|
1252
|
+
const v = F ? `${m.full}
|
|
1253
|
+
${m.value}` : m.value;
|
|
1254
|
+
m.header !== void 0 && m.header !== "" && R$1.message(m.header.split(`
|
|
1770
1255
|
`).map(import_picocolors.default.bold), {
|
|
1771
1256
|
output: r,
|
|
1772
1257
|
secondarySymbol: i,
|
|
1773
1258
|
symbol: i,
|
|
1774
1259
|
spacing: 0
|
|
1775
|
-
}), R$1.message(v
|
|
1260
|
+
}), R$1.message(v.split(`
|
|
1776
1261
|
`).map(import_picocolors.default.dim), {
|
|
1777
1262
|
output: r,
|
|
1778
1263
|
secondarySymbol: i,
|
|
1779
1264
|
symbol: i,
|
|
1780
|
-
spacing: f
|
|
1265
|
+
spacing: f ?? n
|
|
1781
1266
|
});
|
|
1782
|
-
}, p
|
|
1783
|
-
for (const m
|
|
1784
|
-
const { header: f
|
|
1785
|
-
(f
|
|
1786
|
-
}
|
|
1787
|
-
}, y
|
|
1788
|
-
if (g
|
|
1789
|
-
`), m
|
|
1790
|
-
const v
|
|
1791
|
-
`), S
|
|
1792
|
-
if (S
|
|
1793
|
-
const B
|
|
1794
|
-
u
|
|
1795
|
-
`) + B
|
|
1267
|
+
}, p = () => {
|
|
1268
|
+
for (const m of a) {
|
|
1269
|
+
const { header: f, value: F, full: v } = m;
|
|
1270
|
+
(f === void 0 || f.length === 0) && F.length === 0 || E(m, void 0, u === !0 && v.length > 0);
|
|
1271
|
+
}
|
|
1272
|
+
}, y = (m, f, F) => {
|
|
1273
|
+
if (g(!1), (F?.raw !== !0 || !d) && m.value !== "" && (m.value += `
|
|
1274
|
+
`), m.value += Yt(f), d = F?.raw === !0, e.limit !== void 0) {
|
|
1275
|
+
const v = m.value.split(`
|
|
1276
|
+
`), S = v.length - e.limit;
|
|
1277
|
+
if (S > 0) {
|
|
1278
|
+
const B = v.splice(0, S);
|
|
1279
|
+
u && (m.full += (m.full === "" ? "" : `
|
|
1280
|
+
`) + B.join(`
|
|
1796
1281
|
`));
|
|
1797
1282
|
}
|
|
1798
|
-
m
|
|
1283
|
+
m.value = v.join(`
|
|
1799
1284
|
`);
|
|
1800
1285
|
}
|
|
1801
|
-
l
|
|
1286
|
+
l && $();
|
|
1802
1287
|
}, $ = () => {
|
|
1803
|
-
for (const m
|
|
1288
|
+
for (const m of a) m.result ? m.result.status === "error" ? R$1.error(m.result.message, {
|
|
1804
1289
|
output: r,
|
|
1805
1290
|
secondarySymbol: i,
|
|
1806
1291
|
spacing: 0
|
|
1807
|
-
}) : R$1.success(m
|
|
1292
|
+
}) : R$1.success(m.result.message, {
|
|
1808
1293
|
output: r,
|
|
1809
1294
|
secondarySymbol: i,
|
|
1810
1295
|
spacing: 0
|
|
1811
|
-
}) : m
|
|
1812
|
-
}, c
|
|
1813
|
-
g
|
|
1296
|
+
}) : m.value !== "" && E(m, 0);
|
|
1297
|
+
}, c = (m, f) => {
|
|
1298
|
+
g(!1), m.result = f, l && $();
|
|
1814
1299
|
};
|
|
1815
1300
|
return {
|
|
1816
|
-
message(m
|
|
1817
|
-
y
|
|
1301
|
+
message(m, f) {
|
|
1302
|
+
y(a[0], m, f);
|
|
1818
1303
|
},
|
|
1819
|
-
group(m
|
|
1820
|
-
const f
|
|
1821
|
-
header: m
|
|
1304
|
+
group(m) {
|
|
1305
|
+
const f = {
|
|
1306
|
+
header: m,
|
|
1822
1307
|
value: "",
|
|
1823
1308
|
full: ""
|
|
1824
1309
|
};
|
|
1825
|
-
return a.push(f
|
|
1826
|
-
message(F
|
|
1827
|
-
y
|
|
1310
|
+
return a.push(f), {
|
|
1311
|
+
message(F, v) {
|
|
1312
|
+
y(f, F, v);
|
|
1828
1313
|
},
|
|
1829
|
-
error(F
|
|
1830
|
-
c
|
|
1314
|
+
error(F) {
|
|
1315
|
+
c(f, {
|
|
1831
1316
|
status: "error",
|
|
1832
|
-
message: F
|
|
1317
|
+
message: F
|
|
1833
1318
|
});
|
|
1834
1319
|
},
|
|
1835
|
-
success(F
|
|
1836
|
-
c
|
|
1320
|
+
success(F) {
|
|
1321
|
+
c(f, {
|
|
1837
1322
|
status: "success",
|
|
1838
|
-
message: F
|
|
1323
|
+
message: F
|
|
1839
1324
|
});
|
|
1840
1325
|
}
|
|
1841
1326
|
};
|
|
1842
1327
|
},
|
|
1843
|
-
error(m
|
|
1844
|
-
g
|
|
1328
|
+
error(m, f) {
|
|
1329
|
+
g(!0), R$1.error(m, {
|
|
1845
1330
|
output: r,
|
|
1846
1331
|
secondarySymbol: i,
|
|
1847
1332
|
spacing: 1
|
|
1848
|
-
}), f
|
|
1333
|
+
}), f?.showLog !== !1 && p(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
|
|
1849
1334
|
},
|
|
1850
|
-
success(m
|
|
1851
|
-
g
|
|
1335
|
+
success(m, f) {
|
|
1336
|
+
g(!0), R$1.success(m, {
|
|
1852
1337
|
output: r,
|
|
1853
1338
|
secondarySymbol: i,
|
|
1854
1339
|
spacing: 1
|
|
1855
|
-
}), f
|
|
1340
|
+
}), f?.showLog === !0 && p(), a.splice(1, a.length - 1), a[0].value = "", a[0].full = "";
|
|
1856
1341
|
}
|
|
1857
1342
|
};
|
|
1858
1343
|
}, Qt = (e) => new $t({
|
|
@@ -1869,20 +1354,20 @@ ${m$1.value}` : m$1.value;
|
|
|
1869
1354
|
`, 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
1355
|
switch (this.state) {
|
|
1871
1356
|
case "error": {
|
|
1872
|
-
const u
|
|
1357
|
+
const u = this.error ? ` ${import_picocolors.default.yellow(this.error)}` : "", l = r ? `${import_picocolors.default.yellow(h$1)} ` : "", a = r ? import_picocolors.default.yellow(x$1) : "";
|
|
1873
1358
|
return `${s.trim()}
|
|
1874
|
-
${l
|
|
1875
|
-
${a}${u
|
|
1359
|
+
${l}${n}
|
|
1360
|
+
${a}${u}
|
|
1876
1361
|
`;
|
|
1877
1362
|
}
|
|
1878
1363
|
case "submit": {
|
|
1879
|
-
const u
|
|
1880
|
-
return `${s}${r ? import_picocolors.default.gray(h$1) : ""}${u
|
|
1364
|
+
const u = o ? ` ${import_picocolors.default.dim(o)}` : "";
|
|
1365
|
+
return `${s}${r ? import_picocolors.default.gray(h$1) : ""}${u}`;
|
|
1881
1366
|
}
|
|
1882
1367
|
case "cancel": {
|
|
1883
|
-
const u
|
|
1884
|
-
return `${s}${l
|
|
1885
|
-
${l
|
|
1368
|
+
const u = o ? ` ${import_picocolors.default.strikethrough(import_picocolors.default.dim(o))}` : "", l = r ? import_picocolors.default.gray(h$1) : "";
|
|
1369
|
+
return `${s}${l}${u}${o.trim() ? `
|
|
1370
|
+
${l}` : ""}`;
|
|
1886
1371
|
}
|
|
1887
1372
|
default: return `${s}${r ? `${import_picocolors.default.cyan(h$1)} ` : ""}${n}
|
|
1888
1373
|
${r ? import_picocolors.default.cyan(x$1) : ""}
|
|
@@ -1890,362 +1375,343 @@ ${r ? import_picocolors.default.cyan(x$1) : ""}
|
|
|
1890
1375
|
}
|
|
1891
1376
|
}
|
|
1892
1377
|
}).prompt();
|
|
1893
|
-
|
|
1894
1378
|
//#endregion
|
|
1895
|
-
//#region ../../node_modules/.pnpm/tinyexec@1.0.
|
|
1896
|
-
var l =
|
|
1897
|
-
var u =
|
|
1898
|
-
|
|
1899
|
-
|
|
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 = {
|
|
1379
|
+
//#region ../../node_modules/.pnpm/tinyexec@1.0.4/node_modules/tinyexec/dist/main.mjs
|
|
1380
|
+
var l = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
|
|
1381
|
+
var u = /* @__PURE__ */ createRequire(import.meta.url);
|
|
1382
|
+
const d = /^path$/i;
|
|
1383
|
+
const f = {
|
|
1920
1384
|
key: "PATH",
|
|
1921
1385
|
value: ""
|
|
1922
1386
|
};
|
|
1923
|
-
function
|
|
1924
|
-
for (const t
|
|
1925
|
-
if (!Object.prototype.hasOwnProperty.call(e, t
|
|
1926
|
-
const n = e[t
|
|
1927
|
-
if (!n) return
|
|
1387
|
+
function p(e) {
|
|
1388
|
+
for (const t in e) {
|
|
1389
|
+
if (!Object.prototype.hasOwnProperty.call(e, t) || !d.test(t)) continue;
|
|
1390
|
+
const n = e[t];
|
|
1391
|
+
if (!n) return f;
|
|
1928
1392
|
return {
|
|
1929
|
-
key: t
|
|
1393
|
+
key: t,
|
|
1930
1394
|
value: n
|
|
1931
1395
|
};
|
|
1932
1396
|
}
|
|
1933
|
-
return
|
|
1397
|
+
return f;
|
|
1934
1398
|
}
|
|
1935
|
-
function
|
|
1936
|
-
const i = t
|
|
1937
|
-
|
|
1938
|
-
let s;
|
|
1399
|
+
function m(e, t) {
|
|
1400
|
+
const i = t.value.split(delimiter);
|
|
1401
|
+
const o = [];
|
|
1402
|
+
let s = e;
|
|
1403
|
+
let c;
|
|
1939
1404
|
do {
|
|
1940
|
-
|
|
1941
|
-
|
|
1942
|
-
|
|
1943
|
-
} while (
|
|
1405
|
+
o.push(resolve(s, "node_modules", ".bin"));
|
|
1406
|
+
c = s;
|
|
1407
|
+
s = dirname(s);
|
|
1408
|
+
} while (s !== c);
|
|
1409
|
+
const l = o.concat(i).join(delimiter);
|
|
1944
1410
|
return {
|
|
1945
|
-
key: t
|
|
1946
|
-
value:
|
|
1411
|
+
key: t.key,
|
|
1412
|
+
value: l
|
|
1947
1413
|
};
|
|
1948
1414
|
}
|
|
1949
|
-
function
|
|
1415
|
+
function h(e, t) {
|
|
1950
1416
|
const n = {
|
|
1951
1417
|
...process.env,
|
|
1952
|
-
...t
|
|
1418
|
+
...t
|
|
1953
1419
|
};
|
|
1954
|
-
const r =
|
|
1420
|
+
const r = m(e, p(n));
|
|
1955
1421
|
n[r.key] = r.value;
|
|
1956
1422
|
return n;
|
|
1957
1423
|
}
|
|
1958
|
-
const
|
|
1959
|
-
let t
|
|
1424
|
+
const g = (e) => {
|
|
1425
|
+
let t = e.length;
|
|
1960
1426
|
const n = new PassThrough();
|
|
1961
1427
|
const r = () => {
|
|
1962
|
-
if (--t
|
|
1428
|
+
if (--t === 0) n.emit("end");
|
|
1963
1429
|
};
|
|
1964
|
-
for (const t
|
|
1965
|
-
t
|
|
1966
|
-
t
|
|
1430
|
+
for (const t of e) {
|
|
1431
|
+
t.pipe(n, { end: false });
|
|
1432
|
+
t.on("end", r);
|
|
1967
1433
|
}
|
|
1968
1434
|
return n;
|
|
1969
1435
|
};
|
|
1970
|
-
var
|
|
1971
|
-
t
|
|
1436
|
+
var _ = /* @__PURE__ */ l(((e, t) => {
|
|
1437
|
+
t.exports = a;
|
|
1972
1438
|
a.sync = o;
|
|
1973
|
-
var n =
|
|
1974
|
-
function r(e, t
|
|
1975
|
-
var n
|
|
1976
|
-
if (!n
|
|
1977
|
-
n
|
|
1978
|
-
if (n
|
|
1979
|
-
for (var r
|
|
1980
|
-
var i
|
|
1981
|
-
if (i
|
|
1439
|
+
var n = u("fs");
|
|
1440
|
+
function r(e, t) {
|
|
1441
|
+
var n = t.pathExt !== void 0 ? t.pathExt : process.env.PATHEXT;
|
|
1442
|
+
if (!n) return true;
|
|
1443
|
+
n = n.split(";");
|
|
1444
|
+
if (n.indexOf("") !== -1) return true;
|
|
1445
|
+
for (var r = 0; r < n.length; r++) {
|
|
1446
|
+
var i = n[r].toLowerCase();
|
|
1447
|
+
if (i && e.substr(-i.length).toLowerCase() === i) return true;
|
|
1982
1448
|
}
|
|
1983
1449
|
return false;
|
|
1984
1450
|
}
|
|
1985
|
-
function i(e, t
|
|
1451
|
+
function i(e, t, n) {
|
|
1986
1452
|
if (!e.isSymbolicLink() && !e.isFile()) return false;
|
|
1987
|
-
return r(t
|
|
1453
|
+
return r(t, n);
|
|
1988
1454
|
}
|
|
1989
|
-
function a(e, t
|
|
1990
|
-
n.stat(e, function(n
|
|
1991
|
-
r
|
|
1455
|
+
function a(e, t, r) {
|
|
1456
|
+
n.stat(e, function(n, a) {
|
|
1457
|
+
r(n, n ? false : i(a, e, t));
|
|
1992
1458
|
});
|
|
1993
1459
|
}
|
|
1994
|
-
function o(e, t
|
|
1995
|
-
return i(n.statSync(e), e, t
|
|
1460
|
+
function o(e, t) {
|
|
1461
|
+
return i(n.statSync(e), e, t);
|
|
1996
1462
|
}
|
|
1997
|
-
});
|
|
1998
|
-
var
|
|
1999
|
-
t
|
|
1463
|
+
}));
|
|
1464
|
+
var v = /* @__PURE__ */ l(((e, t) => {
|
|
1465
|
+
t.exports = r;
|
|
2000
1466
|
r.sync = i;
|
|
2001
|
-
var n =
|
|
2002
|
-
function r(e, t
|
|
2003
|
-
n.stat(e, function(e
|
|
2004
|
-
r
|
|
1467
|
+
var n = u("fs");
|
|
1468
|
+
function r(e, t, r) {
|
|
1469
|
+
n.stat(e, function(e, n) {
|
|
1470
|
+
r(e, e ? false : a(n, t));
|
|
2005
1471
|
});
|
|
2006
1472
|
}
|
|
2007
|
-
function i(e, t
|
|
2008
|
-
return a(n.statSync(e), t
|
|
1473
|
+
function i(e, t) {
|
|
1474
|
+
return a(n.statSync(e), t);
|
|
2009
1475
|
}
|
|
2010
|
-
function a(e, t
|
|
2011
|
-
return e.isFile() && o(e, t
|
|
1476
|
+
function a(e, t) {
|
|
1477
|
+
return e.isFile() && o(e, t);
|
|
2012
1478
|
}
|
|
2013
|
-
function o(e, t
|
|
2014
|
-
var n
|
|
2015
|
-
var r
|
|
2016
|
-
var i
|
|
2017
|
-
var a
|
|
2018
|
-
var o
|
|
1479
|
+
function o(e, t) {
|
|
1480
|
+
var n = e.mode;
|
|
1481
|
+
var r = e.uid;
|
|
1482
|
+
var i = e.gid;
|
|
1483
|
+
var a = t.uid !== void 0 ? t.uid : process.getuid && process.getuid();
|
|
1484
|
+
var o = t.gid !== void 0 ? t.gid : process.getgid && process.getgid();
|
|
2019
1485
|
var s = parseInt("100", 8);
|
|
2020
|
-
var c
|
|
2021
|
-
var l
|
|
2022
|
-
var u
|
|
2023
|
-
return n
|
|
1486
|
+
var c = parseInt("010", 8);
|
|
1487
|
+
var l = parseInt("001", 8);
|
|
1488
|
+
var u = s | c;
|
|
1489
|
+
return n & l || n & c && i === o || n & s && r === a || n & u && a === 0;
|
|
2024
1490
|
}
|
|
2025
|
-
});
|
|
2026
|
-
var
|
|
2027
|
-
|
|
2028
|
-
var
|
|
2029
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS)
|
|
2030
|
-
else
|
|
2031
|
-
t
|
|
2032
|
-
|
|
2033
|
-
function
|
|
2034
|
-
if (typeof t
|
|
2035
|
-
|
|
2036
|
-
t
|
|
2037
|
-
}
|
|
2038
|
-
if (!
|
|
1491
|
+
}));
|
|
1492
|
+
var y = /* @__PURE__ */ l(((e, t) => {
|
|
1493
|
+
u("fs");
|
|
1494
|
+
var n;
|
|
1495
|
+
if (process.platform === "win32" || global.TESTING_WINDOWS) n = _();
|
|
1496
|
+
else n = v();
|
|
1497
|
+
t.exports = r;
|
|
1498
|
+
r.sync = i;
|
|
1499
|
+
function r(e, t, i) {
|
|
1500
|
+
if (typeof t === "function") {
|
|
1501
|
+
i = t;
|
|
1502
|
+
t = {};
|
|
1503
|
+
}
|
|
1504
|
+
if (!i) {
|
|
2039
1505
|
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
2040
|
-
return new Promise(function(n
|
|
2041
|
-
|
|
2042
|
-
if (e
|
|
2043
|
-
else n
|
|
1506
|
+
return new Promise(function(n, i) {
|
|
1507
|
+
r(e, t || {}, function(e, t) {
|
|
1508
|
+
if (e) i(e);
|
|
1509
|
+
else n(t);
|
|
2044
1510
|
});
|
|
2045
1511
|
});
|
|
2046
1512
|
}
|
|
2047
|
-
|
|
2048
|
-
if (e
|
|
2049
|
-
if (e
|
|
2050
|
-
e
|
|
2051
|
-
|
|
1513
|
+
n(e, t || {}, function(e, n) {
|
|
1514
|
+
if (e) {
|
|
1515
|
+
if (e.code === "EACCES" || t && t.ignoreErrors) {
|
|
1516
|
+
e = null;
|
|
1517
|
+
n = false;
|
|
2052
1518
|
}
|
|
2053
1519
|
}
|
|
2054
|
-
|
|
1520
|
+
i(e, n);
|
|
2055
1521
|
});
|
|
2056
1522
|
}
|
|
2057
|
-
function
|
|
1523
|
+
function i(e, t) {
|
|
2058
1524
|
try {
|
|
2059
|
-
return
|
|
2060
|
-
} catch (e
|
|
2061
|
-
if (t
|
|
2062
|
-
else throw e
|
|
1525
|
+
return n.sync(e, t || {});
|
|
1526
|
+
} catch (e) {
|
|
1527
|
+
if (t && t.ignoreErrors || e.code === "EACCES") return false;
|
|
1528
|
+
else throw e;
|
|
2063
1529
|
}
|
|
2064
1530
|
}
|
|
2065
|
-
});
|
|
2066
|
-
var
|
|
1531
|
+
}));
|
|
1532
|
+
var b = /* @__PURE__ */ l(((e, t) => {
|
|
2067
1533
|
const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
2068
|
-
const r =
|
|
1534
|
+
const r = u("path");
|
|
2069
1535
|
const i = n ? ";" : ":";
|
|
2070
|
-
const a =
|
|
1536
|
+
const a = y();
|
|
2071
1537
|
const o = (e) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), { code: "ENOENT" });
|
|
2072
|
-
const s = (e, t
|
|
2073
|
-
const r
|
|
2074
|
-
const a
|
|
2075
|
-
const o
|
|
2076
|
-
const s
|
|
1538
|
+
const s = (e, t) => {
|
|
1539
|
+
const r = t.colon || i;
|
|
1540
|
+
const a = e.match(/\//) || n && e.match(/\\/) ? [""] : [...n ? [process.cwd()] : [], ...(t.path || process.env.PATH || "").split(r)];
|
|
1541
|
+
const o = n ? t.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
1542
|
+
const s = n ? o.split(r) : [""];
|
|
2077
1543
|
if (n) {
|
|
2078
|
-
if (e.indexOf(".") !== -1 && s
|
|
1544
|
+
if (e.indexOf(".") !== -1 && s[0] !== "") s.unshift("");
|
|
2079
1545
|
}
|
|
2080
1546
|
return {
|
|
2081
|
-
pathEnv: a
|
|
2082
|
-
pathExt: s
|
|
2083
|
-
pathExtExe: o
|
|
1547
|
+
pathEnv: a,
|
|
1548
|
+
pathExt: s,
|
|
1549
|
+
pathExtExe: o
|
|
2084
1550
|
};
|
|
2085
1551
|
};
|
|
2086
|
-
const c
|
|
2087
|
-
if (typeof t
|
|
2088
|
-
n
|
|
2089
|
-
t
|
|
2090
|
-
}
|
|
2091
|
-
if (!t
|
|
2092
|
-
const { pathEnv: i
|
|
2093
|
-
const u
|
|
2094
|
-
const d
|
|
2095
|
-
if (n
|
|
2096
|
-
const c
|
|
2097
|
-
const l
|
|
2098
|
-
const d
|
|
2099
|
-
a
|
|
1552
|
+
const c = (e, t, n) => {
|
|
1553
|
+
if (typeof t === "function") {
|
|
1554
|
+
n = t;
|
|
1555
|
+
t = {};
|
|
1556
|
+
}
|
|
1557
|
+
if (!t) t = {};
|
|
1558
|
+
const { pathEnv: i, pathExt: c, pathExtExe: l } = s(e, t);
|
|
1559
|
+
const u = [];
|
|
1560
|
+
const d = (n) => new Promise((a, s) => {
|
|
1561
|
+
if (n === i.length) return t.all && u.length ? a(u) : s(o(e));
|
|
1562
|
+
const c = i[n];
|
|
1563
|
+
const l = /^".*"$/.test(c) ? c.slice(1, -1) : c;
|
|
1564
|
+
const d = r.join(l, e);
|
|
1565
|
+
a(f(!l && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d, n, 0));
|
|
2100
1566
|
});
|
|
2101
|
-
const f
|
|
2102
|
-
if (r
|
|
2103
|
-
const s
|
|
2104
|
-
a(e
|
|
2105
|
-
if (!a
|
|
2106
|
-
else return i
|
|
2107
|
-
return i
|
|
1567
|
+
const f = (e, n, r) => new Promise((i, o) => {
|
|
1568
|
+
if (r === c.length) return i(d(n + 1));
|
|
1569
|
+
const s = c[r];
|
|
1570
|
+
a(e + s, { pathExt: l }, (a, o) => {
|
|
1571
|
+
if (!a && o) if (t.all) u.push(e + s);
|
|
1572
|
+
else return i(e + s);
|
|
1573
|
+
return i(f(e, n, r + 1));
|
|
2108
1574
|
});
|
|
2109
1575
|
});
|
|
2110
|
-
return n
|
|
1576
|
+
return n ? d(0).then((e) => n(null, e), n) : d(0);
|
|
2111
1577
|
};
|
|
2112
|
-
const l
|
|
2113
|
-
t
|
|
2114
|
-
const { pathEnv: n
|
|
2115
|
-
const l
|
|
2116
|
-
for (let o
|
|
2117
|
-
const s
|
|
2118
|
-
const u
|
|
2119
|
-
const d
|
|
2120
|
-
const f
|
|
2121
|
-
for (let e
|
|
2122
|
-
const n
|
|
1578
|
+
const l = (e, t) => {
|
|
1579
|
+
t = t || {};
|
|
1580
|
+
const { pathEnv: n, pathExt: i, pathExtExe: c } = s(e, t);
|
|
1581
|
+
const l = [];
|
|
1582
|
+
for (let o = 0; o < n.length; o++) {
|
|
1583
|
+
const s = n[o];
|
|
1584
|
+
const u = /^".*"$/.test(s) ? s.slice(1, -1) : s;
|
|
1585
|
+
const d = r.join(u, e);
|
|
1586
|
+
const f = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
|
|
1587
|
+
for (let e = 0; e < i.length; e++) {
|
|
1588
|
+
const n = f + i[e];
|
|
2123
1589
|
try {
|
|
2124
|
-
if (a.sync(n
|
|
2125
|
-
else return n
|
|
2126
|
-
} catch (e
|
|
1590
|
+
if (a.sync(n, { pathExt: c })) if (t.all) l.push(n);
|
|
1591
|
+
else return n;
|
|
1592
|
+
} catch (e) {}
|
|
2127
1593
|
}
|
|
2128
1594
|
}
|
|
2129
|
-
if (t
|
|
2130
|
-
if (t
|
|
1595
|
+
if (t.all && l.length) return l;
|
|
1596
|
+
if (t.nothrow) return null;
|
|
2131
1597
|
throw o(e);
|
|
2132
1598
|
};
|
|
2133
|
-
t
|
|
2134
|
-
c
|
|
2135
|
-
});
|
|
2136
|
-
var
|
|
1599
|
+
t.exports = c;
|
|
1600
|
+
c.sync = l;
|
|
1601
|
+
}));
|
|
1602
|
+
var x = /* @__PURE__ */ l(((e, t) => {
|
|
2137
1603
|
const n = (e = {}) => {
|
|
2138
|
-
const t
|
|
1604
|
+
const t = e.env || process.env;
|
|
2139
1605
|
if ((e.platform || process.platform) !== "win32") return "PATH";
|
|
2140
|
-
return Object.keys(t
|
|
1606
|
+
return Object.keys(t).reverse().find((e) => e.toUpperCase() === "PATH") || "Path";
|
|
2141
1607
|
};
|
|
2142
|
-
t
|
|
2143
|
-
t
|
|
2144
|
-
});
|
|
2145
|
-
var
|
|
2146
|
-
const n =
|
|
2147
|
-
const r =
|
|
2148
|
-
const i =
|
|
2149
|
-
function a(e, t
|
|
2150
|
-
const a
|
|
2151
|
-
const o
|
|
1608
|
+
t.exports = n;
|
|
1609
|
+
t.exports.default = n;
|
|
1610
|
+
}));
|
|
1611
|
+
var S = /* @__PURE__ */ l(((e, t) => {
|
|
1612
|
+
const n = u("path");
|
|
1613
|
+
const r = b();
|
|
1614
|
+
const i = x();
|
|
1615
|
+
function a(e, t) {
|
|
1616
|
+
const a = e.options.env || process.env;
|
|
1617
|
+
const o = process.cwd();
|
|
2152
1618
|
const s = e.options.cwd != null;
|
|
2153
|
-
const c
|
|
2154
|
-
if (c
|
|
1619
|
+
const c = s && process.chdir !== void 0 && !process.chdir.disabled;
|
|
1620
|
+
if (c) try {
|
|
2155
1621
|
process.chdir(e.options.cwd);
|
|
2156
|
-
} catch (e
|
|
2157
|
-
let l
|
|
1622
|
+
} catch (e) {}
|
|
1623
|
+
let l;
|
|
2158
1624
|
try {
|
|
2159
|
-
l
|
|
2160
|
-
path: a
|
|
2161
|
-
pathExt: t
|
|
1625
|
+
l = r.sync(e.command, {
|
|
1626
|
+
path: a[i({ env: a })],
|
|
1627
|
+
pathExt: t ? n.delimiter : void 0
|
|
2162
1628
|
});
|
|
2163
|
-
} catch (e
|
|
2164
|
-
if (c
|
|
1629
|
+
} catch (e) {} finally {
|
|
1630
|
+
if (c) process.chdir(o);
|
|
2165
1631
|
}
|
|
2166
|
-
if (l
|
|
2167
|
-
return l
|
|
1632
|
+
if (l) l = n.resolve(s ? e.options.cwd : "", l);
|
|
1633
|
+
return l;
|
|
2168
1634
|
}
|
|
2169
1635
|
function o(e) {
|
|
2170
1636
|
return a(e) || a(e, true);
|
|
2171
1637
|
}
|
|
2172
|
-
t
|
|
2173
|
-
});
|
|
2174
|
-
var
|
|
1638
|
+
t.exports = o;
|
|
1639
|
+
}));
|
|
1640
|
+
var C = /* @__PURE__ */ l(((e, t) => {
|
|
2175
1641
|
const n = /([()\][%!^"`<>&|;, *?])/g;
|
|
2176
1642
|
function r(e) {
|
|
2177
1643
|
e = e.replace(n, "^$1");
|
|
2178
1644
|
return e;
|
|
2179
1645
|
}
|
|
2180
|
-
function i(e, t
|
|
1646
|
+
function i(e, t) {
|
|
2181
1647
|
e = `${e}`;
|
|
2182
|
-
e = e.replace(/(
|
|
2183
|
-
e = e.replace(/(
|
|
1648
|
+
e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
1649
|
+
e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
2184
1650
|
e = `"${e}"`;
|
|
2185
1651
|
e = e.replace(n, "^$1");
|
|
2186
|
-
if (t
|
|
1652
|
+
if (t) e = e.replace(n, "^$1");
|
|
2187
1653
|
return e;
|
|
2188
1654
|
}
|
|
2189
|
-
t
|
|
2190
|
-
t
|
|
2191
|
-
});
|
|
2192
|
-
var
|
|
2193
|
-
t
|
|
2194
|
-
});
|
|
2195
|
-
var
|
|
2196
|
-
const n =
|
|
2197
|
-
t
|
|
2198
|
-
const t
|
|
2199
|
-
if (!t
|
|
2200
|
-
const [r, i] = t
|
|
1655
|
+
t.exports.command = r;
|
|
1656
|
+
t.exports.argument = i;
|
|
1657
|
+
}));
|
|
1658
|
+
var w = /* @__PURE__ */ l(((e, t) => {
|
|
1659
|
+
t.exports = /^#!(.*)/;
|
|
1660
|
+
}));
|
|
1661
|
+
var T = /* @__PURE__ */ l(((e, t) => {
|
|
1662
|
+
const n = w();
|
|
1663
|
+
t.exports = (e = "") => {
|
|
1664
|
+
const t = e.match(n);
|
|
1665
|
+
if (!t) return null;
|
|
1666
|
+
const [r, i] = t[0].replace(/#! ?/, "").split(" ");
|
|
2201
1667
|
const a = r.split("/").pop();
|
|
2202
1668
|
if (a === "env") return i;
|
|
2203
1669
|
return i ? `${a} ${i}` : a;
|
|
2204
1670
|
};
|
|
2205
|
-
});
|
|
2206
|
-
var
|
|
2207
|
-
const n =
|
|
2208
|
-
const r =
|
|
1671
|
+
}));
|
|
1672
|
+
var E = /* @__PURE__ */ l(((e, t) => {
|
|
1673
|
+
const n = u("fs");
|
|
1674
|
+
const r = T();
|
|
2209
1675
|
function i(e) {
|
|
2210
|
-
const t
|
|
2211
|
-
const i
|
|
1676
|
+
const t = 150;
|
|
1677
|
+
const i = Buffer.alloc(t);
|
|
2212
1678
|
let a;
|
|
2213
1679
|
try {
|
|
2214
1680
|
a = n.openSync(e, "r");
|
|
2215
|
-
n.readSync(a, i
|
|
1681
|
+
n.readSync(a, i, 0, t, 0);
|
|
2216
1682
|
n.closeSync(a);
|
|
2217
|
-
} catch (e
|
|
2218
|
-
return r(i
|
|
1683
|
+
} catch (e) {}
|
|
1684
|
+
return r(i.toString());
|
|
2219
1685
|
}
|
|
2220
|
-
t
|
|
2221
|
-
});
|
|
2222
|
-
var
|
|
2223
|
-
const n =
|
|
2224
|
-
const r =
|
|
2225
|
-
const i =
|
|
2226
|
-
const a =
|
|
1686
|
+
t.exports = i;
|
|
1687
|
+
}));
|
|
1688
|
+
var D = /* @__PURE__ */ l(((e, t) => {
|
|
1689
|
+
const n = u("path");
|
|
1690
|
+
const r = S();
|
|
1691
|
+
const i = C();
|
|
1692
|
+
const a = E();
|
|
2227
1693
|
const o = process.platform === "win32";
|
|
2228
1694
|
const s = /\.(?:com|exe)$/i;
|
|
2229
|
-
const c
|
|
2230
|
-
function l
|
|
1695
|
+
const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
1696
|
+
function l(e) {
|
|
2231
1697
|
e.file = r(e);
|
|
2232
|
-
const t
|
|
2233
|
-
if (t
|
|
1698
|
+
const t = e.file && a(e.file);
|
|
1699
|
+
if (t) {
|
|
2234
1700
|
e.args.unshift(e.file);
|
|
2235
|
-
e.command = t
|
|
1701
|
+
e.command = t;
|
|
2236
1702
|
return r(e);
|
|
2237
1703
|
}
|
|
2238
1704
|
return e.file;
|
|
2239
1705
|
}
|
|
2240
|
-
function
|
|
1706
|
+
function d(e) {
|
|
2241
1707
|
if (!o) return e;
|
|
2242
|
-
const t
|
|
2243
|
-
const r
|
|
2244
|
-
if (e.options.forceShell || r
|
|
2245
|
-
const r
|
|
1708
|
+
const t = l(e);
|
|
1709
|
+
const r = !s.test(t);
|
|
1710
|
+
if (e.options.forceShell || r) {
|
|
1711
|
+
const r = c.test(t);
|
|
2246
1712
|
e.command = n.normalize(e.command);
|
|
2247
1713
|
e.command = i.command(e.command);
|
|
2248
|
-
e.args = e.args.map((e
|
|
1714
|
+
e.args = e.args.map((e) => i.argument(e, r));
|
|
2249
1715
|
e.args = [
|
|
2250
1716
|
"/d",
|
|
2251
1717
|
"/s",
|
|
@@ -2257,129 +1723,129 @@ var F = h((exports$1, t$1) => {
|
|
|
2257
1723
|
}
|
|
2258
1724
|
return e;
|
|
2259
1725
|
}
|
|
2260
|
-
function
|
|
2261
|
-
if (t
|
|
2262
|
-
n
|
|
2263
|
-
t
|
|
2264
|
-
}
|
|
2265
|
-
t
|
|
2266
|
-
n
|
|
2267
|
-
const r
|
|
1726
|
+
function f(e, t, n) {
|
|
1727
|
+
if (t && !Array.isArray(t)) {
|
|
1728
|
+
n = t;
|
|
1729
|
+
t = null;
|
|
1730
|
+
}
|
|
1731
|
+
t = t ? t.slice(0) : [];
|
|
1732
|
+
n = Object.assign({}, n);
|
|
1733
|
+
const r = {
|
|
2268
1734
|
command: e,
|
|
2269
|
-
args: t
|
|
2270
|
-
options: n
|
|
1735
|
+
args: t,
|
|
1736
|
+
options: n,
|
|
2271
1737
|
file: void 0,
|
|
2272
1738
|
original: {
|
|
2273
1739
|
command: e,
|
|
2274
|
-
args: t
|
|
1740
|
+
args: t
|
|
2275
1741
|
}
|
|
2276
1742
|
};
|
|
2277
|
-
return n
|
|
1743
|
+
return n.shell ? r : d(r);
|
|
2278
1744
|
}
|
|
2279
|
-
t
|
|
2280
|
-
});
|
|
2281
|
-
var
|
|
1745
|
+
t.exports = f;
|
|
1746
|
+
}));
|
|
1747
|
+
var O = /* @__PURE__ */ l(((e, t) => {
|
|
2282
1748
|
const n = process.platform === "win32";
|
|
2283
|
-
function r(e, t
|
|
2284
|
-
return Object.assign(/* @__PURE__ */ new Error(`${t
|
|
1749
|
+
function r(e, t) {
|
|
1750
|
+
return Object.assign(/* @__PURE__ */ new Error(`${t} ${e.command} ENOENT`), {
|
|
2285
1751
|
code: "ENOENT",
|
|
2286
1752
|
errno: "ENOENT",
|
|
2287
|
-
syscall: `${t
|
|
1753
|
+
syscall: `${t} ${e.command}`,
|
|
2288
1754
|
path: e.command,
|
|
2289
1755
|
spawnargs: e.args
|
|
2290
1756
|
});
|
|
2291
1757
|
}
|
|
2292
|
-
function i(e, t
|
|
1758
|
+
function i(e, t) {
|
|
2293
1759
|
if (!n) return;
|
|
2294
|
-
const r
|
|
2295
|
-
e.emit = function(n
|
|
2296
|
-
if (n
|
|
2297
|
-
const n
|
|
2298
|
-
if (n
|
|
1760
|
+
const r = e.emit;
|
|
1761
|
+
e.emit = function(n, i) {
|
|
1762
|
+
if (n === "exit") {
|
|
1763
|
+
const n = a(i, t);
|
|
1764
|
+
if (n) return r.call(e, "error", n);
|
|
2299
1765
|
}
|
|
2300
|
-
return r
|
|
1766
|
+
return r.apply(e, arguments);
|
|
2301
1767
|
};
|
|
2302
1768
|
}
|
|
2303
|
-
function a(e, t
|
|
2304
|
-
if (n && e === 1 && !t
|
|
1769
|
+
function a(e, t) {
|
|
1770
|
+
if (n && e === 1 && !t.file) return r(t.original, "spawn");
|
|
2305
1771
|
return null;
|
|
2306
1772
|
}
|
|
2307
|
-
function o(e, t
|
|
2308
|
-
if (n && e === 1 && !t
|
|
1773
|
+
function o(e, t) {
|
|
1774
|
+
if (n && e === 1 && !t.file) return r(t.original, "spawnSync");
|
|
2309
1775
|
return null;
|
|
2310
1776
|
}
|
|
2311
|
-
t
|
|
1777
|
+
t.exports = {
|
|
2312
1778
|
hookChildProcess: i,
|
|
2313
1779
|
verifyENOENT: a,
|
|
2314
1780
|
verifyENOENTSync: o,
|
|
2315
1781
|
notFoundError: r
|
|
2316
1782
|
};
|
|
2317
|
-
});
|
|
2318
|
-
var
|
|
2319
|
-
const n =
|
|
2320
|
-
const r =
|
|
2321
|
-
const i =
|
|
2322
|
-
function a(e, t
|
|
2323
|
-
const o
|
|
2324
|
-
const s = n.spawn(o
|
|
2325
|
-
i.hookChildProcess(s, o
|
|
1783
|
+
}));
|
|
1784
|
+
var A = (/* @__PURE__ */ l(((e, t) => {
|
|
1785
|
+
const n = u("child_process");
|
|
1786
|
+
const r = D();
|
|
1787
|
+
const i = O();
|
|
1788
|
+
function a(e, t, a) {
|
|
1789
|
+
const o = r(e, t, a);
|
|
1790
|
+
const s = n.spawn(o.command, o.args, o.options);
|
|
1791
|
+
i.hookChildProcess(s, o);
|
|
2326
1792
|
return s;
|
|
2327
1793
|
}
|
|
2328
|
-
function o(e, t
|
|
2329
|
-
const o
|
|
2330
|
-
const s = n.spawnSync(o
|
|
2331
|
-
s.error = s.error || i.verifyENOENTSync(s.status, o
|
|
1794
|
+
function o(e, t, a) {
|
|
1795
|
+
const o = r(e, t, a);
|
|
1796
|
+
const s = n.spawnSync(o.command, o.args, o.options);
|
|
1797
|
+
s.error = s.error || i.verifyENOENTSync(s.status, o);
|
|
2332
1798
|
return s;
|
|
2333
1799
|
}
|
|
2334
|
-
t
|
|
2335
|
-
t
|
|
2336
|
-
t
|
|
2337
|
-
t
|
|
2338
|
-
t
|
|
2339
|
-
})()
|
|
2340
|
-
var
|
|
1800
|
+
t.exports = a;
|
|
1801
|
+
t.exports.spawn = a;
|
|
1802
|
+
t.exports.sync = o;
|
|
1803
|
+
t.exports._parse = r;
|
|
1804
|
+
t.exports._enoent = i;
|
|
1805
|
+
})))();
|
|
1806
|
+
var j = class extends Error {
|
|
2341
1807
|
result;
|
|
2342
1808
|
output;
|
|
2343
1809
|
get exitCode() {
|
|
2344
1810
|
if (this.result.exitCode !== null) return this.result.exitCode;
|
|
2345
1811
|
}
|
|
2346
|
-
constructor(e, t
|
|
1812
|
+
constructor(e, t) {
|
|
2347
1813
|
super(`Process exited with non-zero status (${e.exitCode})`);
|
|
2348
1814
|
this.result = e;
|
|
2349
|
-
this.output = t
|
|
1815
|
+
this.output = t;
|
|
2350
1816
|
}
|
|
2351
1817
|
};
|
|
2352
|
-
const
|
|
1818
|
+
const M = {
|
|
2353
1819
|
timeout: void 0,
|
|
2354
1820
|
persist: false
|
|
2355
1821
|
};
|
|
2356
|
-
const
|
|
2357
|
-
function
|
|
1822
|
+
const N = { windowsHide: true };
|
|
1823
|
+
function P(e, t) {
|
|
2358
1824
|
return {
|
|
2359
1825
|
command: normalize(e),
|
|
2360
|
-
args: t
|
|
1826
|
+
args: t ?? []
|
|
2361
1827
|
};
|
|
2362
1828
|
}
|
|
2363
|
-
function
|
|
2364
|
-
const t
|
|
1829
|
+
function F(e) {
|
|
1830
|
+
const t = new AbortController();
|
|
2365
1831
|
for (const n of e) {
|
|
2366
1832
|
if (n.aborted) {
|
|
2367
|
-
t
|
|
1833
|
+
t.abort();
|
|
2368
1834
|
return n;
|
|
2369
1835
|
}
|
|
2370
|
-
const e
|
|
2371
|
-
t
|
|
1836
|
+
const e = () => {
|
|
1837
|
+
t.abort(n.reason);
|
|
2372
1838
|
};
|
|
2373
|
-
n.addEventListener("abort", e
|
|
1839
|
+
n.addEventListener("abort", e, { signal: t.signal });
|
|
2374
1840
|
}
|
|
2375
|
-
return t
|
|
1841
|
+
return t.signal;
|
|
2376
1842
|
}
|
|
2377
|
-
async function
|
|
2378
|
-
let t
|
|
2379
|
-
for await (const n of e) t
|
|
2380
|
-
return t
|
|
1843
|
+
async function I(e) {
|
|
1844
|
+
let t = "";
|
|
1845
|
+
for await (const n of e) t += n.toString();
|
|
1846
|
+
return t;
|
|
2381
1847
|
}
|
|
2382
|
-
var
|
|
1848
|
+
var L = class {
|
|
2383
1849
|
_process;
|
|
2384
1850
|
_aborted = false;
|
|
2385
1851
|
_options;
|
|
@@ -2397,15 +1863,15 @@ var G = class {
|
|
|
2397
1863
|
get exitCode() {
|
|
2398
1864
|
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
2399
1865
|
}
|
|
2400
|
-
constructor(e, t
|
|
1866
|
+
constructor(e, t, n) {
|
|
2401
1867
|
this._options = {
|
|
2402
|
-
...
|
|
1868
|
+
...M,
|
|
2403
1869
|
...n
|
|
2404
1870
|
};
|
|
2405
1871
|
this._command = e;
|
|
2406
|
-
this._args = t
|
|
2407
|
-
this._processClosed = new Promise((e
|
|
2408
|
-
this._resolveClose = e
|
|
1872
|
+
this._args = t ?? [];
|
|
1873
|
+
this._processClosed = new Promise((e) => {
|
|
1874
|
+
this._resolveClose = e;
|
|
2409
1875
|
});
|
|
2410
1876
|
}
|
|
2411
1877
|
kill(e) {
|
|
@@ -2417,8 +1883,8 @@ var G = class {
|
|
|
2417
1883
|
get killed() {
|
|
2418
1884
|
return this._process?.killed === true;
|
|
2419
1885
|
}
|
|
2420
|
-
pipe(e, t
|
|
2421
|
-
return
|
|
1886
|
+
pipe(e, t, n) {
|
|
1887
|
+
return z(e, t, {
|
|
2422
1888
|
...n,
|
|
2423
1889
|
stdin: this
|
|
2424
1890
|
});
|
|
@@ -2426,35 +1892,35 @@ var G = class {
|
|
|
2426
1892
|
async *[Symbol.asyncIterator]() {
|
|
2427
1893
|
const e = this._process;
|
|
2428
1894
|
if (!e) return;
|
|
2429
|
-
const t
|
|
2430
|
-
if (this._streamErr) t
|
|
2431
|
-
if (this._streamOut) t
|
|
2432
|
-
const n =
|
|
1895
|
+
const t = [];
|
|
1896
|
+
if (this._streamErr) t.push(this._streamErr);
|
|
1897
|
+
if (this._streamOut) t.push(this._streamOut);
|
|
1898
|
+
const n = g(t);
|
|
2433
1899
|
const r = c.createInterface({ input: n });
|
|
2434
|
-
for await (const e
|
|
1900
|
+
for await (const e of r) yield e.toString();
|
|
2435
1901
|
await this._processClosed;
|
|
2436
1902
|
e.removeAllListeners();
|
|
2437
1903
|
if (this._thrownError) throw this._thrownError;
|
|
2438
|
-
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
1904
|
+
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new j(this);
|
|
2439
1905
|
}
|
|
2440
1906
|
async _waitForOutput() {
|
|
2441
1907
|
const e = this._process;
|
|
2442
1908
|
if (!e) throw new Error("No process was started");
|
|
2443
|
-
const [t
|
|
1909
|
+
const [t, n] = await Promise.all([this._streamOut ? I(this._streamOut) : "", this._streamErr ? I(this._streamErr) : ""]);
|
|
2444
1910
|
await this._processClosed;
|
|
2445
1911
|
if (this._options?.stdin) await this._options.stdin;
|
|
2446
1912
|
e.removeAllListeners();
|
|
2447
1913
|
if (this._thrownError) throw this._thrownError;
|
|
2448
1914
|
const r = {
|
|
2449
1915
|
stderr: n,
|
|
2450
|
-
stdout: t
|
|
1916
|
+
stdout: t,
|
|
2451
1917
|
exitCode: this.exitCode
|
|
2452
1918
|
};
|
|
2453
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new
|
|
1919
|
+
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new j(this, r);
|
|
2454
1920
|
return r;
|
|
2455
1921
|
}
|
|
2456
|
-
then(e, t
|
|
2457
|
-
return this._waitForOutput().then(e, t
|
|
1922
|
+
then(e, t) {
|
|
1923
|
+
return this._waitForOutput().then(e, t);
|
|
2458
1924
|
}
|
|
2459
1925
|
_streamOut;
|
|
2460
1926
|
_streamErr;
|
|
@@ -2462,7 +1928,7 @@ var G = class {
|
|
|
2462
1928
|
const e = cwd();
|
|
2463
1929
|
const n = this._options;
|
|
2464
1930
|
const r = {
|
|
2465
|
-
...
|
|
1931
|
+
...N,
|
|
2466
1932
|
...n.nodeOptions
|
|
2467
1933
|
};
|
|
2468
1934
|
const i = [];
|
|
@@ -2470,19 +1936,19 @@ var G = class {
|
|
|
2470
1936
|
if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout));
|
|
2471
1937
|
if (n.signal !== void 0) i.push(n.signal);
|
|
2472
1938
|
if (n.persist === true) r.detached = true;
|
|
2473
|
-
if (i.length > 0) r.signal =
|
|
2474
|
-
r.env =
|
|
2475
|
-
const { command: a, args: s } =
|
|
2476
|
-
const c
|
|
2477
|
-
const l
|
|
2478
|
-
if (l
|
|
2479
|
-
if (l
|
|
2480
|
-
this._process = l
|
|
2481
|
-
l
|
|
2482
|
-
l
|
|
2483
|
-
if (n.stdin !== void 0 && l
|
|
2484
|
-
const { stdout: e
|
|
2485
|
-
if (e
|
|
1939
|
+
if (i.length > 0) r.signal = F(i);
|
|
1940
|
+
r.env = h(e, r.env);
|
|
1941
|
+
const { command: a, args: s } = P(this._command, this._args);
|
|
1942
|
+
const c = (0, A._parse)(a, s, r);
|
|
1943
|
+
const l = spawn(c.command, c.args, c.options);
|
|
1944
|
+
if (l.stderr) this._streamErr = l.stderr;
|
|
1945
|
+
if (l.stdout) this._streamOut = l.stdout;
|
|
1946
|
+
this._process = l;
|
|
1947
|
+
l.once("error", this._onError);
|
|
1948
|
+
l.once("close", this._onClose);
|
|
1949
|
+
if (n.stdin !== void 0 && l.stdin && n.stdin.process) {
|
|
1950
|
+
const { stdout: e } = n.stdin.process;
|
|
1951
|
+
if (e) e.pipe(l.stdin);
|
|
2486
1952
|
}
|
|
2487
1953
|
}
|
|
2488
1954
|
_resetState() {
|
|
@@ -2503,19 +1969,18 @@ var G = class {
|
|
|
2503
1969
|
if (this._resolveClose) this._resolveClose();
|
|
2504
1970
|
};
|
|
2505
1971
|
};
|
|
2506
|
-
const
|
|
2507
|
-
const r = new
|
|
1972
|
+
const R = (e, t, n) => {
|
|
1973
|
+
const r = new L(e, t, n);
|
|
2508
1974
|
r.spawn();
|
|
2509
1975
|
return r;
|
|
2510
1976
|
};
|
|
2511
|
-
const
|
|
2512
|
-
|
|
1977
|
+
const z = R;
|
|
2513
1978
|
//#endregion
|
|
2514
1979
|
//#region src/core/files.ts
|
|
2515
|
-
function getPackageJson(cwd
|
|
2516
|
-
const packageText = readFile(cwd
|
|
1980
|
+
function getPackageJson(cwd) {
|
|
1981
|
+
const packageText = readFile(cwd, commonFilePaths.packageJson);
|
|
2517
1982
|
if (!packageText) {
|
|
2518
|
-
const pkgPath = path.join(cwd
|
|
1983
|
+
const pkgPath = path.join(cwd, commonFilePaths.packageJson);
|
|
2519
1984
|
throw new Error(`Invalid workspace: missing '${pkgPath}'`);
|
|
2520
1985
|
}
|
|
2521
1986
|
const { data, generateCode } = parse.json(packageText);
|
|
@@ -2537,7 +2002,7 @@ async function formatFiles(options) {
|
|
|
2537
2002
|
];
|
|
2538
2003
|
const cmd = resolveCommand(options.packageManager, "execute-local", args);
|
|
2539
2004
|
try {
|
|
2540
|
-
const result = await
|
|
2005
|
+
const result = await z(cmd.command, cmd.args, {
|
|
2541
2006
|
nodeOptions: {
|
|
2542
2007
|
cwd: options.cwd,
|
|
2543
2008
|
stdio: "pipe"
|
|
@@ -2556,9 +2021,9 @@ async function formatFiles(options) {
|
|
|
2556
2021
|
}
|
|
2557
2022
|
stop("Successfully formatted modified files");
|
|
2558
2023
|
}
|
|
2559
|
-
function readFile(cwd
|
|
2560
|
-
const fullFilePath = path.resolve(cwd
|
|
2561
|
-
if (!fileExists(cwd
|
|
2024
|
+
function readFile(cwd, filePath) {
|
|
2025
|
+
const fullFilePath = path.resolve(cwd, filePath);
|
|
2026
|
+
if (!fileExists(cwd, filePath)) return "";
|
|
2562
2027
|
return fs.readFileSync(fullFilePath, "utf8");
|
|
2563
2028
|
}
|
|
2564
2029
|
function installPackages(dependencies, workspace) {
|
|
@@ -2577,7 +2042,7 @@ function installPackages(dependencies, workspace) {
|
|
|
2577
2042
|
}
|
|
2578
2043
|
function alphabetizeProperties(obj) {
|
|
2579
2044
|
const orderedObj = {};
|
|
2580
|
-
const sortedEntries = Object.entries(obj).sort(([a], [b
|
|
2045
|
+
const sortedEntries = Object.entries(obj).sort(([a], [b]) => a.localeCompare(b));
|
|
2581
2046
|
for (const [key, value] of sortedEntries) orderedObj[key] = value;
|
|
2582
2047
|
return orderedObj;
|
|
2583
2048
|
}
|
|
@@ -2588,8 +2053,8 @@ function writeFile(workspace, filePath, content) {
|
|
|
2588
2053
|
if (!fs.existsSync(fullDirectoryPath)) fs.mkdirSync(fullDirectoryPath, { recursive: true });
|
|
2589
2054
|
fs.writeFileSync(fullFilePath, content, "utf8");
|
|
2590
2055
|
}
|
|
2591
|
-
function fileExists(cwd
|
|
2592
|
-
const fullFilePath = path.resolve(cwd
|
|
2056
|
+
function fileExists(cwd, filePath) {
|
|
2057
|
+
const fullFilePath = path.resolve(cwd, filePath);
|
|
2593
2058
|
return fs.existsSync(fullFilePath);
|
|
2594
2059
|
}
|
|
2595
2060
|
const commonFilePaths = {
|
|
@@ -2601,7 +2066,6 @@ const commonFilePaths = {
|
|
|
2601
2066
|
viteConfig: "vite.config.js",
|
|
2602
2067
|
viteConfigTS: "vite.config.ts"
|
|
2603
2068
|
};
|
|
2604
|
-
|
|
2605
2069
|
//#endregion
|
|
2606
2070
|
//#region src/create/utils.ts
|
|
2607
2071
|
function mkdirp(dir) {
|
|
@@ -2613,11 +2077,11 @@ function mkdirp(dir) {
|
|
|
2613
2077
|
throw e;
|
|
2614
2078
|
}
|
|
2615
2079
|
}
|
|
2616
|
-
function identity(x
|
|
2617
|
-
return x
|
|
2080
|
+
function identity(x) {
|
|
2081
|
+
return x;
|
|
2618
2082
|
}
|
|
2619
|
-
function replace(contents, kv
|
|
2620
|
-
for (const [key, value] of Object.entries(kv
|
|
2083
|
+
function replace(contents, kv) {
|
|
2084
|
+
for (const [key, value] of Object.entries(kv)) contents = contents.replaceAll(key, value);
|
|
2621
2085
|
return contents;
|
|
2622
2086
|
}
|
|
2623
2087
|
function kv(name) {
|
|
@@ -2633,27 +2097,26 @@ const withReplaceExtensions = [
|
|
|
2633
2097
|
".ts",
|
|
2634
2098
|
".json"
|
|
2635
2099
|
];
|
|
2636
|
-
function copy(from
|
|
2637
|
-
if (!fs.existsSync(from
|
|
2638
|
-
if (fs.statSync(from
|
|
2639
|
-
copy(path.join(from
|
|
2100
|
+
function copy(from, to, rename = identity, kv = {}) {
|
|
2101
|
+
if (!fs.existsSync(from)) return;
|
|
2102
|
+
if (fs.statSync(from).isDirectory()) fs.readdirSync(from).forEach((file) => {
|
|
2103
|
+
copy(path.join(from, file), path.join(to, rename(file)), rename, kv);
|
|
2640
2104
|
});
|
|
2641
2105
|
else {
|
|
2642
2106
|
mkdirp(path.dirname(to));
|
|
2643
|
-
if (withReplaceExtensions.some((ext) => from
|
|
2644
|
-
else fs.copyFileSync(from
|
|
2107
|
+
if (withReplaceExtensions.some((ext) => from.endsWith(ext))) fs.writeFileSync(to, replace(fs.readFileSync(from, "utf-8"), kv));
|
|
2108
|
+
else fs.copyFileSync(from, to);
|
|
2645
2109
|
}
|
|
2646
2110
|
}
|
|
2647
|
-
function dist(path
|
|
2111
|
+
function dist(path) {
|
|
2648
2112
|
const insideDistFolder = import.meta.url.includes("dist");
|
|
2649
|
-
return fileURLToPath(new URL(`./${!insideDistFolder ? "dist/" : ""}${path
|
|
2113
|
+
return fileURLToPath(new URL(`./${!insideDistFolder ? "dist/" : ""}${path}`, import.meta.url).href);
|
|
2650
2114
|
}
|
|
2651
2115
|
function getSharedFiles() {
|
|
2652
2116
|
const shared = dist("shared.json");
|
|
2653
2117
|
const { files } = JSON.parse(fs.readFileSync(shared, "utf-8"));
|
|
2654
2118
|
return files;
|
|
2655
2119
|
}
|
|
2656
|
-
|
|
2657
2120
|
//#endregion
|
|
2658
2121
|
//#region src/create/index.ts
|
|
2659
2122
|
const publicTemplateTypes = [
|
|
@@ -2674,13 +2137,13 @@ const languageTypes = [
|
|
|
2674
2137
|
"checkjs",
|
|
2675
2138
|
"none"
|
|
2676
2139
|
];
|
|
2677
|
-
function create(cwd
|
|
2678
|
-
mkdirp(cwd
|
|
2679
|
-
write_template_files(options.template, options.types, options.name, cwd
|
|
2680
|
-
if (options.template !== "svelte") write_common_files(cwd
|
|
2140
|
+
function create(cwd, options) {
|
|
2141
|
+
mkdirp(cwd);
|
|
2142
|
+
write_template_files(options.template, options.types, options.name, cwd);
|
|
2143
|
+
if (options.template !== "svelte") write_common_files(cwd, options, options.name);
|
|
2681
2144
|
if (options.template === "addon") {
|
|
2682
|
-
fs.rmSync(path.join(cwd
|
|
2683
|
-
fs.rmSync(path.join(cwd
|
|
2145
|
+
fs.rmSync(path.join(cwd, "svelte.config.js"));
|
|
2146
|
+
fs.rmSync(path.join(cwd, "vite.config.js"));
|
|
2684
2147
|
}
|
|
2685
2148
|
}
|
|
2686
2149
|
const templates = publicTemplateTypes.map((dir) => {
|
|
@@ -2692,27 +2155,27 @@ const templates = publicTemplateTypes.map((dir) => {
|
|
|
2692
2155
|
description
|
|
2693
2156
|
};
|
|
2694
2157
|
});
|
|
2695
|
-
function write_template_files(template, types, name, cwd
|
|
2158
|
+
function write_template_files(template, types, name, cwd) {
|
|
2696
2159
|
const dir = dist(`templates/${template}`);
|
|
2697
|
-
copy(`${dir}/assets`, cwd
|
|
2698
|
-
copy(`${dir}/package.json`, `${cwd
|
|
2160
|
+
copy(`${dir}/assets`, cwd, (name) => name.replace("DOT-", "."), kv(name));
|
|
2161
|
+
copy(`${dir}/package.json`, `${cwd}/package.json`, void 0, kv(name));
|
|
2699
2162
|
const manifest = `${dir}/files.types=${types}.json`;
|
|
2700
2163
|
JSON.parse(fs.readFileSync(manifest, "utf-8")).forEach((file) => {
|
|
2701
|
-
const dest = path.join(cwd
|
|
2164
|
+
const dest = path.join(cwd, file.name);
|
|
2702
2165
|
mkdirp(path.dirname(dest));
|
|
2703
2166
|
fs.writeFileSync(dest, replace(file.contents, kv(name)));
|
|
2704
2167
|
});
|
|
2705
2168
|
}
|
|
2706
|
-
function write_common_files(cwd
|
|
2169
|
+
function write_common_files(cwd, options, name) {
|
|
2707
2170
|
const files = getSharedFiles();
|
|
2708
|
-
const pkg_file = path.join(cwd
|
|
2171
|
+
const pkg_file = path.join(cwd, commonFilePaths.packageJson);
|
|
2709
2172
|
const pkg = JSON.parse(fs.readFileSync(pkg_file, "utf-8"));
|
|
2710
2173
|
sort_files(files).forEach((file) => {
|
|
2711
2174
|
const include = file.include.every((condition) => matches_condition(condition, options));
|
|
2712
2175
|
if (file.exclude.some((condition) => matches_condition(condition, options)) || !include) return;
|
|
2713
2176
|
if (file.name === commonFilePaths.packageJson) merge(pkg, JSON.parse(file.contents));
|
|
2714
2177
|
else {
|
|
2715
|
-
const dest = path.join(cwd
|
|
2178
|
+
const dest = path.join(cwd, file.name);
|
|
2716
2179
|
mkdirp(path.dirname(dest));
|
|
2717
2180
|
fs.writeFileSync(dest, replace(file.contents, kv(name)));
|
|
2718
2181
|
}
|
|
@@ -2755,9 +2218,8 @@ function sort_files(files) {
|
|
|
2755
2218
|
return f1_more_generic && f2_more_generic || !f1_more_generic && !f2_more_generic ? 0 : f1_more_generic ? -1 : 1;
|
|
2756
2219
|
});
|
|
2757
2220
|
}
|
|
2758
|
-
|
|
2759
2221
|
//#endregion
|
|
2760
|
-
//#region ../../node_modules/.pnpm/commander@14.0.
|
|
2222
|
+
//#region ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/error.js
|
|
2761
2223
|
var require_error = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2762
2224
|
/**
|
|
2763
2225
|
* CommanderError class
|
|
@@ -2795,9 +2257,8 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2795
2257
|
exports.CommanderError = CommanderError;
|
|
2796
2258
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
2797
2259
|
}));
|
|
2798
|
-
|
|
2799
2260
|
//#endregion
|
|
2800
|
-
//#region ../../node_modules/.pnpm/commander@14.0.
|
|
2261
|
+
//#region ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/argument.js
|
|
2801
2262
|
var require_argument = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2802
2263
|
const { InvalidArgumentError } = require_error();
|
|
2803
2264
|
var Argument = class {
|
|
@@ -2921,9 +2382,8 @@ var require_argument = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2921
2382
|
exports.Argument = Argument;
|
|
2922
2383
|
exports.humanReadableArgName = humanReadableArgName;
|
|
2923
2384
|
}));
|
|
2924
|
-
|
|
2925
2385
|
//#endregion
|
|
2926
|
-
//#region ../../node_modules/.pnpm/commander@14.0.
|
|
2386
|
+
//#region ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/help.js
|
|
2927
2387
|
var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2928
2388
|
const { humanReadableArgName } = require_argument();
|
|
2929
2389
|
/**
|
|
@@ -2959,11 +2419,11 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2959
2419
|
* @returns {Command[]}
|
|
2960
2420
|
*/
|
|
2961
2421
|
visibleCommands(cmd) {
|
|
2962
|
-
const visibleCommands = cmd.commands.filter((cmd
|
|
2422
|
+
const visibleCommands = cmd.commands.filter((cmd) => !cmd._hidden);
|
|
2963
2423
|
const helpCommand = cmd._getHelpCommand();
|
|
2964
2424
|
if (helpCommand && !helpCommand._hidden) visibleCommands.push(helpCommand);
|
|
2965
|
-
if (this.sortSubcommands) visibleCommands.sort((a, b
|
|
2966
|
-
return a.name().localeCompare(b
|
|
2425
|
+
if (this.sortSubcommands) visibleCommands.sort((a, b) => {
|
|
2426
|
+
return a.name().localeCompare(b.name());
|
|
2967
2427
|
});
|
|
2968
2428
|
return visibleCommands;
|
|
2969
2429
|
}
|
|
@@ -2974,11 +2434,11 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2974
2434
|
* @param {Option} b
|
|
2975
2435
|
* @returns {number}
|
|
2976
2436
|
*/
|
|
2977
|
-
compareOptions(a, b
|
|
2437
|
+
compareOptions(a, b) {
|
|
2978
2438
|
const getSortKey = (option) => {
|
|
2979
2439
|
return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
|
|
2980
2440
|
};
|
|
2981
|
-
return getSortKey(a).localeCompare(getSortKey(b
|
|
2441
|
+
return getSortKey(a).localeCompare(getSortKey(b));
|
|
2982
2442
|
}
|
|
2983
2443
|
/**
|
|
2984
2444
|
* Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.
|
|
@@ -3412,9 +2872,8 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3412
2872
|
exports.Help = Help;
|
|
3413
2873
|
exports.stripColor = stripColor;
|
|
3414
2874
|
}));
|
|
3415
|
-
|
|
3416
2875
|
//#endregion
|
|
3417
|
-
//#region ../../node_modules/.pnpm/commander@14.0.
|
|
2876
|
+
//#region ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/option.js
|
|
3418
2877
|
var require_option = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3419
2878
|
const { InvalidArgumentError } = require_error();
|
|
3420
2879
|
var Option = class {
|
|
@@ -3671,8 +3130,8 @@ var require_option = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3671
3130
|
* @private
|
|
3672
3131
|
*/
|
|
3673
3132
|
function camelcase(str) {
|
|
3674
|
-
return str.split("-").reduce((str
|
|
3675
|
-
return str
|
|
3133
|
+
return str.split("-").reduce((str, word) => {
|
|
3134
|
+
return str + word[0].toUpperCase() + word.slice(1);
|
|
3676
3135
|
});
|
|
3677
3136
|
}
|
|
3678
3137
|
/**
|
|
@@ -3716,24 +3175,23 @@ var require_option = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3716
3175
|
exports.Option = Option;
|
|
3717
3176
|
exports.DualOptions = DualOptions;
|
|
3718
3177
|
}));
|
|
3719
|
-
|
|
3720
3178
|
//#endregion
|
|
3721
|
-
//#region ../../node_modules/.pnpm/commander@14.0.
|
|
3179
|
+
//#region ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/suggestSimilar.js
|
|
3722
3180
|
var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3723
3181
|
const maxDistance = 3;
|
|
3724
|
-
function editDistance(a, b
|
|
3725
|
-
if (Math.abs(a.length - b
|
|
3726
|
-
const d
|
|
3727
|
-
for (let i = 0; i <= a.length; i++) d
|
|
3728
|
-
for (let j
|
|
3729
|
-
for (let j
|
|
3182
|
+
function editDistance(a, b) {
|
|
3183
|
+
if (Math.abs(a.length - b.length) > maxDistance) return Math.max(a.length, b.length);
|
|
3184
|
+
const d = [];
|
|
3185
|
+
for (let i = 0; i <= a.length; i++) d[i] = [i];
|
|
3186
|
+
for (let j = 0; j <= b.length; j++) d[0][j] = j;
|
|
3187
|
+
for (let j = 1; j <= b.length; j++) for (let i = 1; i <= a.length; i++) {
|
|
3730
3188
|
let cost = 1;
|
|
3731
|
-
if (a[i - 1] === b
|
|
3189
|
+
if (a[i - 1] === b[j - 1]) cost = 0;
|
|
3732
3190
|
else cost = 1;
|
|
3733
|
-
d
|
|
3734
|
-
if (i > 1 && j
|
|
3191
|
+
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
|
|
3192
|
+
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);
|
|
3735
3193
|
}
|
|
3736
|
-
return d
|
|
3194
|
+
return d[a.length][b.length];
|
|
3737
3195
|
}
|
|
3738
3196
|
/**
|
|
3739
3197
|
* Find close matches, restricted to same number of edits.
|
|
@@ -3764,7 +3222,7 @@ var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3764
3222
|
} else if (distance === bestDistance) similar.push(candidate);
|
|
3765
3223
|
}
|
|
3766
3224
|
});
|
|
3767
|
-
similar.sort((a, b
|
|
3225
|
+
similar.sort((a, b) => a.localeCompare(b));
|
|
3768
3226
|
if (searchingOptions) similar = similar.map((candidate) => `--${candidate}`);
|
|
3769
3227
|
if (similar.length > 1) return `\n(Did you mean one of ${similar.join(", ")}?)`;
|
|
3770
3228
|
if (similar.length === 1) return `\n(Did you mean ${similar[0]}?)`;
|
|
@@ -3772,9 +3230,8 @@ var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
3772
3230
|
}
|
|
3773
3231
|
exports.suggestSimilar = suggestSimilar;
|
|
3774
3232
|
}));
|
|
3775
|
-
|
|
3776
3233
|
//#endregion
|
|
3777
|
-
//#region ../../node_modules/.pnpm/commander@14.0.
|
|
3234
|
+
//#region ../../node_modules/.pnpm/commander@14.0.3/node_modules/commander/lib/command.js
|
|
3778
3235
|
var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
3779
3236
|
const EventEmitter = __require("node:events").EventEmitter;
|
|
3780
3237
|
const childProcess = __require("node:child_process");
|
|
@@ -4354,8 +3811,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4354
3811
|
else if (fn instanceof RegExp) {
|
|
4355
3812
|
const regex = fn;
|
|
4356
3813
|
fn = (val, def) => {
|
|
4357
|
-
const m
|
|
4358
|
-
return m
|
|
3814
|
+
const m = regex.exec(val);
|
|
3815
|
+
return m ? m[0] : def;
|
|
4359
3816
|
};
|
|
4360
3817
|
option.default(defaultValue).argParser(fn);
|
|
4361
3818
|
} else option.default(fn);
|
|
@@ -4827,8 +4284,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4827
4284
|
if (declaredArg.variadic) {
|
|
4828
4285
|
if (index < this.args.length) {
|
|
4829
4286
|
value = this.args.slice(index);
|
|
4830
|
-
if (declaredArg.parseArg) value = value.reduce((processed, v
|
|
4831
|
-
return myParseArg(declaredArg, v
|
|
4287
|
+
if (declaredArg.parseArg) value = value.reduce((processed, v) => {
|
|
4288
|
+
return myParseArg(declaredArg, v, processed);
|
|
4832
4289
|
}, declaredArg.defaultValue);
|
|
4833
4290
|
} else if (value === void 0) value = [];
|
|
4834
4291
|
} else if (index < this.args.length) {
|
|
@@ -5235,16 +4692,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
5235
4692
|
* @private
|
|
5236
4693
|
*/
|
|
5237
4694
|
_conflictingOption(option, conflictingOption) {
|
|
5238
|
-
const findBestOptionFromValue = (option
|
|
5239
|
-
const optionKey = option
|
|
4695
|
+
const findBestOptionFromValue = (option) => {
|
|
4696
|
+
const optionKey = option.attributeName();
|
|
5240
4697
|
const optionValue = this.getOptionValue(optionKey);
|
|
5241
4698
|
const negativeOption = this.options.find((target) => target.negate && optionKey === target.attributeName());
|
|
5242
4699
|
const positiveOption = this.options.find((target) => !target.negate && optionKey === target.attributeName());
|
|
5243
4700
|
if (negativeOption && (negativeOption.presetArg === void 0 && optionValue === false || negativeOption.presetArg !== void 0 && optionValue === negativeOption.presetArg)) return negativeOption;
|
|
5244
|
-
return positiveOption || option
|
|
4701
|
+
return positiveOption || option;
|
|
5245
4702
|
};
|
|
5246
|
-
const getErrorMessage = (option
|
|
5247
|
-
const bestOption = findBestOptionFromValue(option
|
|
4703
|
+
const getErrorMessage = (option) => {
|
|
4704
|
+
const bestOption = findBestOptionFromValue(option);
|
|
5248
4705
|
const optionKey = bestOption.attributeName();
|
|
5249
4706
|
if (this.getOptionValueSource(optionKey) === "env") return `environment variable '${bestOption.envVar}'`;
|
|
5250
4707
|
return `option '${bestOption.flags}'`;
|
|
@@ -5507,9 +4964,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
5507
4964
|
* @param {string} [path]
|
|
5508
4965
|
* @return {(string|null|Command)}
|
|
5509
4966
|
*/
|
|
5510
|
-
executableDir(path
|
|
5511
|
-
if (path
|
|
5512
|
-
this._executableDir = path
|
|
4967
|
+
executableDir(path) {
|
|
4968
|
+
if (path === void 0) return this._executableDir;
|
|
4969
|
+
this._executableDir = path;
|
|
5513
4970
|
return this;
|
|
5514
4971
|
}
|
|
5515
4972
|
/**
|
|
@@ -5526,9 +4983,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
5526
4983
|
helpWidth: context.helpWidth,
|
|
5527
4984
|
outputHasColors: context.hasColors
|
|
5528
4985
|
});
|
|
5529
|
-
const text
|
|
5530
|
-
if (context.hasColors) return text
|
|
5531
|
-
return this._outputConfiguration.stripColor(text
|
|
4986
|
+
const text = helper.formatHelp(this, helper);
|
|
4987
|
+
if (context.hasColors) return text;
|
|
4988
|
+
return this._outputConfiguration.stripColor(text);
|
|
5532
4989
|
}
|
|
5533
4990
|
/**
|
|
5534
4991
|
* @typedef HelpContext
|
|
@@ -5677,7 +5134,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
5677
5134
|
* @param {(string | Function)} text - string to add, or a function returning a string
|
|
5678
5135
|
* @return {Command} `this` command for chaining
|
|
5679
5136
|
*/
|
|
5680
|
-
addHelpText(position, text
|
|
5137
|
+
addHelpText(position, text) {
|
|
5681
5138
|
const allowedValues = [
|
|
5682
5139
|
"beforeAll",
|
|
5683
5140
|
"before",
|
|
@@ -5689,11 +5146,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
5689
5146
|
const helpEvent = `${position}Help`;
|
|
5690
5147
|
this.on(helpEvent, (context) => {
|
|
5691
5148
|
let helpStr;
|
|
5692
|
-
if (typeof text
|
|
5149
|
+
if (typeof text === "function") helpStr = text({
|
|
5693
5150
|
error: context.error,
|
|
5694
5151
|
command: context.command
|
|
5695
5152
|
});
|
|
5696
|
-
else helpStr = text
|
|
5153
|
+
else helpStr = text;
|
|
5697
5154
|
if (helpStr) context.write(`${helpStr}\n`);
|
|
5698
5155
|
});
|
|
5699
5156
|
return this;
|
|
@@ -5751,10 +5208,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
5751
5208
|
exports.Command = Command;
|
|
5752
5209
|
exports.useColor = useColor;
|
|
5753
5210
|
}));
|
|
5754
|
-
|
|
5755
|
-
//#endregion
|
|
5756
|
-
//#region ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/index.js
|
|
5757
|
-
var require_commander = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5211
|
+
const { program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help } = (/* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports) => {
|
|
5758
5212
|
const { Argument } = require_argument();
|
|
5759
5213
|
const { Command } = require_command();
|
|
5760
5214
|
const { CommanderError, InvalidArgumentError } = require_error();
|
|
@@ -5774,13 +5228,7 @@ var require_commander = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
5774
5228
|
exports.CommanderError = CommanderError;
|
|
5775
5229
|
exports.InvalidArgumentError = InvalidArgumentError;
|
|
5776
5230
|
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
5777
|
-
}));
|
|
5778
|
-
|
|
5779
|
-
//#endregion
|
|
5780
|
-
//#region ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/esm.mjs
|
|
5781
|
-
var import_commander = /* @__PURE__ */ __toESM(require_commander(), 1);
|
|
5782
|
-
const { program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help } = import_commander.default;
|
|
5783
|
-
|
|
5231
|
+
})))(), 1)).default;
|
|
5784
5232
|
//#endregion
|
|
5785
5233
|
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/resolve.mjs
|
|
5786
5234
|
/**
|
|
@@ -5801,7 +5249,6 @@ function from(root, ident, silent) {
|
|
|
5801
5249
|
if (!silent) throw err;
|
|
5802
5250
|
}
|
|
5803
5251
|
}
|
|
5804
|
-
|
|
5805
5252
|
//#endregion
|
|
5806
5253
|
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/walk.mjs
|
|
5807
5254
|
/**
|
|
@@ -5811,9 +5258,9 @@ function from(root, ident, silent) {
|
|
|
5811
5258
|
* @returns An array of absolute paths of all parent directories.
|
|
5812
5259
|
*/
|
|
5813
5260
|
function up$1(base, options) {
|
|
5814
|
-
let { last, cwd
|
|
5815
|
-
let tmp = absolute(base, cwd
|
|
5816
|
-
let root = absolute(last || "/", cwd
|
|
5261
|
+
let { last, cwd } = options || {};
|
|
5262
|
+
let tmp = absolute(base, cwd);
|
|
5263
|
+
let root = absolute(last || "/", cwd);
|
|
5817
5264
|
let prev, arr = [];
|
|
5818
5265
|
while (prev !== root) {
|
|
5819
5266
|
arr.push(tmp);
|
|
@@ -5822,7 +5269,6 @@ function up$1(base, options) {
|
|
|
5822
5269
|
}
|
|
5823
5270
|
return arr;
|
|
5824
5271
|
}
|
|
5825
|
-
|
|
5826
5272
|
//#endregion
|
|
5827
5273
|
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/find.mjs
|
|
5828
5274
|
/**
|
|
@@ -5833,8 +5279,7 @@ function up$1(base, options) {
|
|
|
5833
5279
|
*/
|
|
5834
5280
|
function up(name, options) {
|
|
5835
5281
|
let dir, tmp;
|
|
5836
|
-
|
|
5837
|
-
for (dir of up$1(start, options)) {
|
|
5282
|
+
for (dir of up$1(options && options.cwd || "", options)) {
|
|
5838
5283
|
tmp = join(dir, name);
|
|
5839
5284
|
if (existsSync(tmp)) return tmp;
|
|
5840
5285
|
}
|
|
@@ -5850,13 +5295,12 @@ function up(name, options) {
|
|
|
5850
5295
|
*/
|
|
5851
5296
|
function any(names, options) {
|
|
5852
5297
|
let dir, start = options && options.cwd || "";
|
|
5853
|
-
let j
|
|
5854
|
-
for (dir of up$1(start, options)) for (j
|
|
5855
|
-
tmp = join(dir, names[j
|
|
5298
|
+
let j = 0, len = names.length, tmp;
|
|
5299
|
+
for (dir of up$1(start, options)) for (j = 0; j < len; j++) {
|
|
5300
|
+
tmp = join(dir, names[j]);
|
|
5856
5301
|
if (existsSync(tmp)) return tmp;
|
|
5857
5302
|
}
|
|
5858
5303
|
}
|
|
5859
|
-
|
|
5860
5304
|
//#endregion
|
|
5861
5305
|
//#region src/core/package-manager.ts
|
|
5862
5306
|
const AGENT_NAMES = AGENTS.filter((agent) => !agent.includes("@"));
|
|
@@ -5869,8 +5313,8 @@ agentOptions.unshift({
|
|
|
5869
5313
|
value: void 0
|
|
5870
5314
|
});
|
|
5871
5315
|
const installOption = new Option("--install <package-manager>", "installs dependencies with a specified package manager").choices(AGENT_NAMES);
|
|
5872
|
-
async function packageManagerPrompt(cwd
|
|
5873
|
-
const agent = (await detect({ cwd
|
|
5316
|
+
async function packageManagerPrompt(cwd) {
|
|
5317
|
+
const agent = (await detect({ cwd }))?.name ?? getUserAgent();
|
|
5874
5318
|
if (!process$1.stdout.isTTY) return agent;
|
|
5875
5319
|
const pm = await qt({
|
|
5876
5320
|
message: "Which package manager do you want to install dependencies with?",
|
|
@@ -5883,7 +5327,7 @@ async function packageManagerPrompt(cwd$1) {
|
|
|
5883
5327
|
}
|
|
5884
5328
|
return pm;
|
|
5885
5329
|
}
|
|
5886
|
-
async function installDependencies(agent, cwd
|
|
5330
|
+
async function installDependencies(agent, cwd) {
|
|
5887
5331
|
const task = zt({
|
|
5888
5332
|
title: `Installing dependencies with ${color.command(agent)}...`,
|
|
5889
5333
|
limit: Math.ceil(process$1.stdout.rows / 2),
|
|
@@ -5892,9 +5336,9 @@ async function installDependencies(agent, cwd$1) {
|
|
|
5892
5336
|
});
|
|
5893
5337
|
try {
|
|
5894
5338
|
const { command, args } = constructCommand(COMMANDS[agent].install, []);
|
|
5895
|
-
const proc =
|
|
5339
|
+
const proc = z(command, args, {
|
|
5896
5340
|
nodeOptions: {
|
|
5897
|
-
cwd
|
|
5341
|
+
cwd,
|
|
5898
5342
|
stdio: "pipe"
|
|
5899
5343
|
},
|
|
5900
5344
|
throwOnError: true
|
|
@@ -5907,8 +5351,8 @@ async function installDependencies(agent, cwd$1) {
|
|
|
5907
5351
|
process$1.exit(2);
|
|
5908
5352
|
}
|
|
5909
5353
|
}
|
|
5910
|
-
async function detectPackageManager(cwd
|
|
5911
|
-
return (await detect({ cwd
|
|
5354
|
+
async function detectPackageManager(cwd) {
|
|
5355
|
+
return (await detect({ cwd }))?.name ?? getUserAgent() ?? "npm";
|
|
5912
5356
|
}
|
|
5913
5357
|
function getUserAgent() {
|
|
5914
5358
|
const userAgent = process$1.env.npm_config_user_agent;
|
|
@@ -5918,27 +5362,27 @@ function getUserAgent() {
|
|
|
5918
5362
|
const name = pmSpec.substring(0, separatorPos);
|
|
5919
5363
|
return AGENTS.includes(name) ? name : void 0;
|
|
5920
5364
|
}
|
|
5921
|
-
async function addPnpmBuildDependencies(cwd
|
|
5365
|
+
async function addPnpmBuildDependencies(cwd, packageManager, allowedPackages) {
|
|
5922
5366
|
if (!packageManager || packageManager !== "pnpm" || allowedPackages.length === 0) return;
|
|
5923
5367
|
let confIn = "package.json";
|
|
5924
5368
|
const pnpmVersion = await getPnpmVersion();
|
|
5925
5369
|
if (pnpmVersion) confIn = isVersionUnsupportedBelow(pnpmVersion, "10.5") ? "package.json" : "pnpm-workspace.yaml";
|
|
5926
|
-
const found = up("pnpm-workspace.yaml", { cwd
|
|
5370
|
+
const found = up("pnpm-workspace.yaml", { cwd });
|
|
5927
5371
|
if (confIn === "pnpm-workspace.yaml") {
|
|
5928
5372
|
const content = found ? fs.readFileSync(found, "utf-8") : "";
|
|
5929
5373
|
const { data, generateCode } = parse.yaml(content);
|
|
5930
5374
|
const items = data.get("onlyBuiltDependencies")?.items ?? [];
|
|
5931
5375
|
for (const item of allowedPackages) {
|
|
5932
5376
|
if (items.includes(item)) continue;
|
|
5933
|
-
if (items.some((y
|
|
5377
|
+
if (items.some((y) => typeof y === "object" && y.value === item)) continue;
|
|
5934
5378
|
items.push(item);
|
|
5935
5379
|
}
|
|
5936
5380
|
data.set("onlyBuiltDependencies", items);
|
|
5937
5381
|
const newContent = generateCode();
|
|
5938
|
-
const pnpmWorkspacePath = found ?? path.join(cwd
|
|
5382
|
+
const pnpmWorkspacePath = found ?? path.join(cwd, "pnpm-workspace.yaml");
|
|
5939
5383
|
if (newContent !== content) fs.writeFileSync(pnpmWorkspacePath, newContent, "utf-8");
|
|
5940
5384
|
} else {
|
|
5941
|
-
const rootDir = found ? path.dirname(found) : cwd
|
|
5385
|
+
const rootDir = found ? path.dirname(found) : cwd;
|
|
5942
5386
|
const pkgPath = path.join(rootDir, "package.json");
|
|
5943
5387
|
const content = fs.readFileSync(pkgPath, "utf-8");
|
|
5944
5388
|
const { data, generateCode } = parse.json(content);
|
|
@@ -5953,12 +5397,11 @@ async function addPnpmBuildDependencies(cwd$1, packageManager, allowedPackages)
|
|
|
5953
5397
|
}
|
|
5954
5398
|
}
|
|
5955
5399
|
async function getPnpmVersion() {
|
|
5956
|
-
let v
|
|
5400
|
+
let v = void 0;
|
|
5957
5401
|
try {
|
|
5958
|
-
v
|
|
5402
|
+
v = (await z("pnpm", ["--version"], { throwOnError: true })).stdout.trim();
|
|
5959
5403
|
} catch {}
|
|
5960
|
-
return v
|
|
5404
|
+
return v;
|
|
5961
5405
|
}
|
|
5962
|
-
|
|
5963
5406
|
//#endregion
|
|
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,
|
|
5407
|
+
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, z 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, R as w, installPackages as x, formatFiles as y, __require as z };
|