create-rstack 2.1.2 → 2.1.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +41 -1
- package/dist/index.js +489 -766
- package/package.json +17 -19
- package/template-biome/package.json +1 -1
- package/template-eslint/react-js/package.json +1 -1
- package/template-eslint/react-ts/package.json +2 -2
- package/template-eslint/svelte-js/package.json +1 -1
- package/template-eslint/svelte-ts/package.json +2 -2
- package/template-eslint/vanilla-js/package.json +1 -1
- package/template-eslint/vanilla-ts/package.json +2 -2
- package/template-eslint/vue-js/package.json +2 -2
- package/template-eslint/vue-ts/package.json +3 -3
- package/template-rslint/react-js/package.json +1 -1
- package/template-rslint/react-ts/package.json +1 -1
- package/template-rslint/vanilla-js/package.json +1 -1
- package/template-rslint/vanilla-ts/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
1
|
import "node:module";
|
|
2
|
-
import node_fs from "node:fs";
|
|
3
|
-
import node_path, { delimiter, dirname, resolve } from "node:path";
|
|
2
|
+
import node_fs, { closeSync, openSync, readSync, statSync } from "node:fs";
|
|
3
|
+
import node_path, { basename, delimiter, dirname, normalize as external_node_path_normalize, resolve } from "node:path";
|
|
4
4
|
import { fileURLToPath } from "node:url";
|
|
5
5
|
import node_util, { styleText } from "node:util";
|
|
6
6
|
import node_process, { cwd as external_node_process_cwd, stdin, stdout } from "node:process";
|
|
7
7
|
import node_readline from "node:readline";
|
|
8
8
|
import node_tty from "node:tty";
|
|
9
9
|
import node_os from "node:os";
|
|
10
|
-
import { createRequire } from "node:module";
|
|
11
10
|
import { execFileSync, spawn } from "node:child_process";
|
|
12
11
|
import { pipeline } from "node:stream/promises";
|
|
13
12
|
import { PassThrough } from "node:stream";
|
|
@@ -834,10 +833,10 @@ function wrapAnsi(string, columns, options) {
|
|
|
834
833
|
return String(string).normalize().split(CRLF_OR_LF).map((line)=>exec(line, columns, options)).join('\n');
|
|
835
834
|
}
|
|
836
835
|
const src = __webpack_require__("./node_modules/.pnpm/sisteransi@1.0.5/node_modules/sisteransi/src/index.js");
|
|
837
|
-
function
|
|
836
|
+
function dist_f(r, t, s) {
|
|
838
837
|
if (!s.some((o)=>!o.disabled)) return r;
|
|
839
838
|
const e = r + t, i = Math.max(s.length - 1, 0), n = e < 0 ? i : e > i ? 0 : e;
|
|
840
|
-
return s[n].disabled ?
|
|
839
|
+
return s[n].disabled ? dist_f(n, t < 0 ? -1 : 1, s) : n;
|
|
841
840
|
}
|
|
842
841
|
const dist_G = [
|
|
843
842
|
"up",
|
|
@@ -926,7 +925,7 @@ function z(r, t) {
|
|
|
926
925
|
}
|
|
927
926
|
globalThis.process.platform.startsWith("win");
|
|
928
927
|
const dist_k = Symbol("clack:cancel");
|
|
929
|
-
function
|
|
928
|
+
function q(r) {
|
|
930
929
|
return r === dist_k;
|
|
931
930
|
}
|
|
932
931
|
function w(r, t) {
|
|
@@ -934,19 +933,19 @@ function w(r, t) {
|
|
|
934
933
|
s.isTTY && s.setRawMode(t);
|
|
935
934
|
}
|
|
936
935
|
const dist_A = (r)=>"columns" in r && "number" == typeof r.columns ? r.columns : 80, dist_L = (r)=>"rows" in r && "number" == typeof r.rows ? r.rows : 20;
|
|
937
|
-
function dist_W(r, t, s, e = s, i) {
|
|
938
|
-
const
|
|
939
|
-
return wrapAnsi(t,
|
|
936
|
+
function dist_W(r, t, s, e = s, i = s, n) {
|
|
937
|
+
const o = dist_A(r ?? stdout);
|
|
938
|
+
return wrapAnsi(t, o - s.length, {
|
|
940
939
|
hard: !0,
|
|
941
940
|
trim: !1
|
|
942
941
|
}).split(`
|
|
943
|
-
`).map((
|
|
944
|
-
const
|
|
945
|
-
return
|
|
942
|
+
`).map((u, a, l)=>{
|
|
943
|
+
const c = n ? n(u, a) : u;
|
|
944
|
+
return 0 === a ? `${e}${c}` : a === l.length - 1 ? `${i}${c}` : `${s}${c}`;
|
|
946
945
|
}).join(`
|
|
947
946
|
`);
|
|
948
947
|
}
|
|
949
|
-
let
|
|
948
|
+
let dist_m = class {
|
|
950
949
|
input;
|
|
951
950
|
output;
|
|
952
951
|
_abortSignal;
|
|
@@ -1106,13 +1105,13 @@ function dist_B(r, t) {
|
|
|
1106
1105
|
const s = t.findIndex((e)=>e.value === r);
|
|
1107
1106
|
return -1 !== s ? s : 0;
|
|
1108
1107
|
}
|
|
1109
|
-
function
|
|
1108
|
+
function dist_J(r, t) {
|
|
1110
1109
|
return (t.label ?? String(t.value)).toLowerCase().includes(r.toLowerCase());
|
|
1111
1110
|
}
|
|
1112
1111
|
function H(r, t) {
|
|
1113
1112
|
if (t) return r ? t : t[0];
|
|
1114
1113
|
}
|
|
1115
|
-
let Q = class extends
|
|
1114
|
+
let Q = class extends dist_m {
|
|
1116
1115
|
filteredOptions;
|
|
1117
1116
|
multiple;
|
|
1118
1117
|
isNavigating = !1;
|
|
@@ -1143,7 +1142,7 @@ let Q = class extends dist_p {
|
|
|
1143
1142
|
const s = this.options;
|
|
1144
1143
|
this.filteredOptions = [
|
|
1145
1144
|
...s
|
|
1146
|
-
], this.multiple = !0 === t.multiple, this.#t = "function" == typeof t.options ? t.filter : t.filter ??
|
|
1145
|
+
], this.multiple = !0 === t.multiple, this.#t = "function" == typeof t.options ? t.filter : t.filter ?? dist_J;
|
|
1147
1146
|
let e;
|
|
1148
1147
|
if (t.initialValue && Array.isArray(t.initialValue) ? this.multiple ? e = t.initialValue : e = t.initialValue.slice(0, 1) : !this.multiple && this.options.length > 0 && (e = [
|
|
1149
1148
|
this.options[0].value
|
|
@@ -1157,12 +1156,12 @@ let Q = class extends dist_p {
|
|
|
1157
1156
|
return " " === t || this.multiple && this.isNavigating && "space" === s.name && void 0 !== t && "" !== t;
|
|
1158
1157
|
}
|
|
1159
1158
|
#e(t, s) {
|
|
1160
|
-
const e = "up" === s.name, i = "down" === s.name, n = "return" === s.name, o = "" === this.userInput || " " === this.userInput, u = this.#u, a = this.options, l = void 0 !== u && "" !== u && a.some((
|
|
1159
|
+
const e = "up" === s.name, i = "down" === s.name, n = "return" === s.name, o = "" === this.userInput || " " === this.userInput, u = this.#u, a = this.options, l = void 0 !== u && "" !== u && a.some((c)=>!c.disabled && (this.#t ? this.#t(u, c) : !0));
|
|
1161
1160
|
if ("tab" === s.name && o && l) {
|
|
1162
1161
|
" " === this.userInput && this._clearUserInput(), this._setUserInput(u, !0), this.isNavigating = !1;
|
|
1163
1162
|
return;
|
|
1164
1163
|
}
|
|
1165
|
-
e || i ? (this.#s =
|
|
1164
|
+
e || i ? (this.#s = dist_f(this.#s, e ? -1 : 1, this.filteredOptions), this.focusedValue = this.filteredOptions[this.#s]?.value, this.multiple || (this.selectedValues = [
|
|
1166
1165
|
this.focusedValue
|
|
1167
1166
|
]), this.isNavigating = !0) : n ? this.value = H(this.multiple, this.selectedValues) : this.multiple ? void 0 !== this.focusedValue && ("tab" === s.name || this.isNavigating && "space" === s.name) ? this.toggleSelected(this.focusedValue) : this.isNavigating = !1 : (this.focusedValue && (this.selectedValues = [
|
|
1168
1167
|
this.focusedValue
|
|
@@ -1187,13 +1186,13 @@ let Q = class extends dist_p {
|
|
|
1187
1186
|
...s
|
|
1188
1187
|
];
|
|
1189
1188
|
const e = dist_B(this.focusedValue, this.filteredOptions);
|
|
1190
|
-
this.#s =
|
|
1189
|
+
this.#s = dist_f(e, 0, this.filteredOptions);
|
|
1191
1190
|
const i = this.filteredOptions[this.#s];
|
|
1192
1191
|
i && !i.disabled ? this.focusedValue = i.value : this.focusedValue = void 0, this.multiple || (void 0 !== this.focusedValue ? this.toggleSelected(this.focusedValue) : this.deselectAll());
|
|
1193
1192
|
}
|
|
1194
1193
|
}
|
|
1195
1194
|
};
|
|
1196
|
-
class it extends
|
|
1195
|
+
class it extends dist_m {
|
|
1197
1196
|
options;
|
|
1198
1197
|
cursor = 0;
|
|
1199
1198
|
#s;
|
|
@@ -1260,7 +1259,7 @@ class it extends dist_p {
|
|
|
1260
1259
|
});
|
|
1261
1260
|
}
|
|
1262
1261
|
}
|
|
1263
|
-
let dist_nt = class extends
|
|
1262
|
+
let dist_nt = class extends dist_m {
|
|
1264
1263
|
options;
|
|
1265
1264
|
cursor = 0;
|
|
1266
1265
|
get _value() {
|
|
@@ -1292,17 +1291,17 @@ let dist_nt = class extends dist_p {
|
|
|
1292
1291
|
...t.initialValues ?? []
|
|
1293
1292
|
];
|
|
1294
1293
|
const s = Math.max(this.options.findIndex(({ value: e })=>e === t.cursorAt), 0);
|
|
1295
|
-
this.cursor = this.options[s].disabled ?
|
|
1294
|
+
this.cursor = this.options[s].disabled ? dist_f(s, 1, this.options) : s, this.on("key", (e)=>{
|
|
1296
1295
|
"a" === e && this.toggleAll(), "i" === e && this.toggleInvert();
|
|
1297
1296
|
}), this.on("cursor", (e)=>{
|
|
1298
1297
|
switch(e){
|
|
1299
1298
|
case "left":
|
|
1300
1299
|
case "up":
|
|
1301
|
-
this.cursor =
|
|
1300
|
+
this.cursor = dist_f(this.cursor, -1, this.options);
|
|
1302
1301
|
break;
|
|
1303
1302
|
case "down":
|
|
1304
1303
|
case "right":
|
|
1305
|
-
this.cursor =
|
|
1304
|
+
this.cursor = dist_f(this.cursor, 1, this.options);
|
|
1306
1305
|
break;
|
|
1307
1306
|
case "space":
|
|
1308
1307
|
this.toggleValue();
|
|
@@ -1311,7 +1310,7 @@ let dist_nt = class extends dist_p {
|
|
|
1311
1310
|
});
|
|
1312
1311
|
}
|
|
1313
1312
|
};
|
|
1314
|
-
class ut extends
|
|
1313
|
+
class ut extends dist_m {
|
|
1315
1314
|
options;
|
|
1316
1315
|
cursor = 0;
|
|
1317
1316
|
get _selectedValue() {
|
|
@@ -1323,22 +1322,22 @@ class ut extends dist_p {
|
|
|
1323
1322
|
constructor(t){
|
|
1324
1323
|
super(t, !1), this.options = t.options;
|
|
1325
1324
|
const s = this.options.findIndex(({ value: i })=>i === t.initialValue), e = -1 === s ? 0 : s;
|
|
1326
|
-
this.cursor = this.options[e].disabled ?
|
|
1325
|
+
this.cursor = this.options[e].disabled ? dist_f(e, 1, this.options) : e, this.changeValue(), this.on("cursor", (i)=>{
|
|
1327
1326
|
switch(i){
|
|
1328
1327
|
case "left":
|
|
1329
1328
|
case "up":
|
|
1330
|
-
this.cursor =
|
|
1329
|
+
this.cursor = dist_f(this.cursor, -1, this.options);
|
|
1331
1330
|
break;
|
|
1332
1331
|
case "down":
|
|
1333
1332
|
case "right":
|
|
1334
|
-
this.cursor =
|
|
1333
|
+
this.cursor = dist_f(this.cursor, 1, this.options);
|
|
1335
1334
|
break;
|
|
1336
1335
|
}
|
|
1337
1336
|
this.changeValue();
|
|
1338
1337
|
});
|
|
1339
1338
|
}
|
|
1340
1339
|
}
|
|
1341
|
-
class ht extends
|
|
1340
|
+
class ht extends dist_m {
|
|
1342
1341
|
get userInputWithCursor() {
|
|
1343
1342
|
if ("submit" === this.state) return this.userInput;
|
|
1344
1343
|
const t = this.userInput;
|
|
@@ -1360,20 +1359,20 @@ class ht extends dist_p {
|
|
|
1360
1359
|
});
|
|
1361
1360
|
}
|
|
1362
1361
|
}
|
|
1363
|
-
function
|
|
1362
|
+
function ee() {
|
|
1364
1363
|
return "win32" !== node_process.platform ? "linux" !== node_process.env.TERM : !!node_process.env.CI || !!node_process.env.WT_SESSION || !!node_process.env.TERMINUS_SUBLIME || "{cmd::Cmder}" === node_process.env.ConEmuTask || "Terminus-Sublime" === node_process.env.TERM_PROGRAM || "vscode" === node_process.env.TERM_PROGRAM || "xterm-256color" === node_process.env.TERM || "alacritty" === node_process.env.TERM || "JetBrains-JediTerm" === node_process.env.TERMINAL_EMULATOR;
|
|
1365
1364
|
}
|
|
1366
|
-
const dist_tt =
|
|
1365
|
+
const dist_tt = ee(), dist_ot = ()=>"true" === process.env.CI, It = (t)=>!0 === t.isTTY, dist_w = (t, i)=>dist_tt ? t : i, Tt = dist_w("\u25C6", "*"), dist_at = dist_w("\u25A0", "x"), dist_ut = dist_w("\u25B2", "x"), dist_H = dist_w("\u25C7", "o"), dist_$ = (dist_w("\u250C", "T"), dist_w("\u2502", "|")), dist_x = dist_w("\u2514", "\u2014"), dist_z = (dist_w("\u2510", "T"), dist_w("\u2518", "\u2014"), dist_w("\u25CF", ">")), dist_U = dist_w("\u25CB", " "), dist_et = dist_w("\u25FB", "[\u2022]"), dist_K = dist_w("\u25FC", "[+]"), dist_Y = dist_w("\u25FB", "[ ]"), dist_st = (dist_w("\u25AA", "\u2022"), dist_w("\u2500", "-")), ct = dist_w("\u256E", "+"), Gt = dist_w("\u251C", "+"), $t = dist_w("\u256F", "+"), dt = dist_w("\u2570", "+"), dist_ht = (dist_w("\u256D", "+"), dist_w("\u25CF", "\u2022")), pt = dist_w("\u25C6", "*"), mt = dist_w("\u25B2", "!"), gt = dist_w("\u25A0", "x"), dist_P = (t)=>{
|
|
1367
1366
|
switch(t){
|
|
1368
1367
|
case "initial":
|
|
1369
1368
|
case "active":
|
|
1370
|
-
return styleText("cyan",
|
|
1369
|
+
return styleText("cyan", Tt);
|
|
1371
1370
|
case "cancel":
|
|
1372
|
-
return styleText("red",
|
|
1371
|
+
return styleText("red", dist_at);
|
|
1373
1372
|
case "error":
|
|
1374
1373
|
return styleText("yellow", dist_ut);
|
|
1375
1374
|
case "submit":
|
|
1376
|
-
return styleText("green",
|
|
1375
|
+
return styleText("green", dist_H);
|
|
1377
1376
|
}
|
|
1378
1377
|
}, yt = (t)=>{
|
|
1379
1378
|
switch(t){
|
|
@@ -1387,54 +1386,54 @@ const dist_tt = te(), dist_at = ()=>"true" === process.env.CI, Tt = (t)=>!0 ===
|
|
|
1387
1386
|
case "submit":
|
|
1388
1387
|
return styleText("green", dist_$);
|
|
1389
1388
|
}
|
|
1390
|
-
},
|
|
1391
|
-
let
|
|
1392
|
-
for(let
|
|
1393
|
-
|
|
1394
|
-
if (n -= a.length, o++, n <= u) break;
|
|
1395
|
-
}
|
|
1389
|
+
}, Ot = (t, i, s, r, u, n = !1)=>{
|
|
1390
|
+
let a = i, c = 0;
|
|
1391
|
+
if (n) for(let o = r - 1; o >= s && (a -= t[o].length, c++, !(a <= u)); o--);
|
|
1392
|
+
else for(let o = s; o < r && (a -= t[o].length, c++, !(a <= u)); o++);
|
|
1396
1393
|
return {
|
|
1397
|
-
lineCount:
|
|
1398
|
-
removals:
|
|
1394
|
+
lineCount: a,
|
|
1395
|
+
removals: c
|
|
1399
1396
|
};
|
|
1400
|
-
},
|
|
1401
|
-
const c = dist_A(
|
|
1397
|
+
}, dist_F = ({ cursor: t, options: i, style: s, output: r = process.stdout, maxItems: u = 1 / 0, columnPadding: n = 0, rowPadding: a = 4 })=>{
|
|
1398
|
+
const c = dist_A(r) - n, o = dist_L(r), l = styleText("dim", "..."), d = Math.max(o - a, 0), g = Math.max(Math.min(u, d), 5);
|
|
1402
1399
|
let p = 0;
|
|
1403
|
-
t >=
|
|
1404
|
-
let
|
|
1405
|
-
const
|
|
1406
|
-
let
|
|
1407
|
-
|
|
1408
|
-
const v = p + (
|
|
1409
|
-
for(let b = v; b <
|
|
1410
|
-
const G = wrapAnsi(s(
|
|
1400
|
+
t >= g - 3 && (p = Math.max(Math.min(t - g + 3, i.length - g), 0));
|
|
1401
|
+
let f = g < i.length && p > 0, h = g < i.length && p + g < i.length;
|
|
1402
|
+
const I = Math.min(p + g, i.length), m = [];
|
|
1403
|
+
let y = 0;
|
|
1404
|
+
f && y++, h && y++;
|
|
1405
|
+
const v = p + (f ? 1 : 0), C = I - (h ? 1 : 0);
|
|
1406
|
+
for(let b = v; b < C; b++){
|
|
1407
|
+
const G = wrapAnsi(s(i[b], b === t), c, {
|
|
1411
1408
|
hard: !0,
|
|
1412
1409
|
trim: !1
|
|
1413
1410
|
}).split(`
|
|
1414
1411
|
`);
|
|
1415
|
-
|
|
1416
|
-
}
|
|
1417
|
-
if (
|
|
1418
|
-
let b = 0, G = 0,
|
|
1419
|
-
const
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1412
|
+
m.push(G), y += G.length;
|
|
1413
|
+
}
|
|
1414
|
+
if (y > d) {
|
|
1415
|
+
let b = 0, G = 0, M = y;
|
|
1416
|
+
const N = t - v;
|
|
1417
|
+
let O = d;
|
|
1418
|
+
const j = ()=>Ot(m, M, 0, N, O), k = ()=>Ot(m, M, N + 1, m.length, O, !0);
|
|
1419
|
+
f ? ({ lineCount: M, removals: b } = j(), M > O && (h || (O -= 1), { lineCount: M, removals: G } = k())) : (h || (O -= 1), { lineCount: M, removals: G } = k(), M > O && (O -= 1, { lineCount: M, removals: b } = j())), b > 0 && (f = !0, m.splice(0, b)), G > 0 && (h = !0, m.splice(m.length - G, G));
|
|
1420
|
+
}
|
|
1421
|
+
const S = [];
|
|
1422
|
+
f && S.push(l);
|
|
1423
|
+
for (const b of m)for (const G of b)S.push(G);
|
|
1424
|
+
return h && S.push(l), S;
|
|
1426
1425
|
};
|
|
1427
|
-
function
|
|
1426
|
+
function Pt(t) {
|
|
1428
1427
|
return t.label ?? String(t.value ?? "");
|
|
1429
1428
|
}
|
|
1430
|
-
function Rt(t,
|
|
1429
|
+
function Rt(t, i) {
|
|
1431
1430
|
if (!t) return !0;
|
|
1432
|
-
const s = (
|
|
1433
|
-
return s.includes(n) ||
|
|
1431
|
+
const s = (i.label ?? String(i.value ?? "")).toLowerCase(), r = (i.hint ?? "").toLowerCase(), u = String(i.value).toLowerCase(), n = t.toLowerCase();
|
|
1432
|
+
return s.includes(n) || r.includes(n) || u.includes(n);
|
|
1434
1433
|
}
|
|
1435
|
-
function se(t,
|
|
1434
|
+
function se(t, i) {
|
|
1436
1435
|
const s = [];
|
|
1437
|
-
for (const
|
|
1436
|
+
for (const r of i)t.includes(r.value) && s.push(r);
|
|
1438
1437
|
return s;
|
|
1439
1438
|
}
|
|
1440
1439
|
const At = (t)=>new Q({
|
|
@@ -1444,26 +1443,26 @@ const At = (t)=>new Q({
|
|
|
1444
1443
|
] : void 0,
|
|
1445
1444
|
initialUserInput: t.initialUserInput,
|
|
1446
1445
|
placeholder: t.placeholder,
|
|
1447
|
-
filter: t.filter ?? ((
|
|
1446
|
+
filter: t.filter ?? ((i, s)=>Rt(i, s)),
|
|
1448
1447
|
signal: t.signal,
|
|
1449
1448
|
input: t.input,
|
|
1450
1449
|
output: t.output,
|
|
1451
1450
|
validate: t.validate,
|
|
1452
1451
|
render () {
|
|
1453
|
-
const
|
|
1452
|
+
const i = t.withGuide ?? dist_h.withGuide, s = i ? [
|
|
1454
1453
|
`${styleText("gray", dist_$)}`,
|
|
1455
|
-
`${
|
|
1454
|
+
`${dist_P(this.state)} ${t.message}`
|
|
1456
1455
|
] : [
|
|
1457
|
-
`${
|
|
1458
|
-
],
|
|
1459
|
-
const d =
|
|
1456
|
+
`${dist_P(this.state)} ${t.message}`
|
|
1457
|
+
], r = this.userInput, u = this.options, n = t.placeholder, a = "" === r && void 0 !== n, c = (o, l)=>{
|
|
1458
|
+
const d = Pt(o), g = o.hint && o.value === this.focusedValue ? styleText("dim", ` (${o.hint})`) : "";
|
|
1460
1459
|
switch(l){
|
|
1461
1460
|
case "active":
|
|
1462
|
-
return `${styleText("green", dist_z)} ${d}${
|
|
1461
|
+
return `${styleText("green", dist_z)} ${d}${g}`;
|
|
1463
1462
|
case "inactive":
|
|
1464
|
-
return `${styleText("dim",
|
|
1463
|
+
return `${styleText("dim", dist_U)} ${styleText("dim", d)}`;
|
|
1465
1464
|
case "disabled":
|
|
1466
|
-
return `${styleText("gray",
|
|
1465
|
+
return `${styleText("gray", dist_U)} ${styleText([
|
|
1467
1466
|
"strikethrough",
|
|
1468
1467
|
"gray"
|
|
1469
1468
|
], d)}`;
|
|
@@ -1472,55 +1471,55 @@ const At = (t)=>new Q({
|
|
|
1472
1471
|
switch(this.state){
|
|
1473
1472
|
case "submit":
|
|
1474
1473
|
{
|
|
1475
|
-
const
|
|
1474
|
+
const o = se(this.selectedValues, u), l = o.length > 0 ? ` ${styleText("dim", o.map(Pt).join(", "))}` : "", d = i ? styleText("gray", dist_$) : "";
|
|
1476
1475
|
return `${s.join(`
|
|
1477
1476
|
`)}
|
|
1478
1477
|
${d}${l}`;
|
|
1479
1478
|
}
|
|
1480
1479
|
case "cancel":
|
|
1481
1480
|
{
|
|
1482
|
-
const
|
|
1481
|
+
const o = r ? ` ${styleText([
|
|
1483
1482
|
"strikethrough",
|
|
1484
1483
|
"dim"
|
|
1485
|
-
],
|
|
1484
|
+
], r)}` : "", l = i ? styleText("gray", dist_$) : "";
|
|
1486
1485
|
return `${s.join(`
|
|
1487
1486
|
`)}
|
|
1488
|
-
${l}${
|
|
1487
|
+
${l}${o}`;
|
|
1489
1488
|
}
|
|
1490
1489
|
default:
|
|
1491
1490
|
{
|
|
1492
|
-
const
|
|
1493
|
-
let
|
|
1494
|
-
if (this.isNavigating ||
|
|
1495
|
-
const v =
|
|
1496
|
-
|
|
1497
|
-
} else
|
|
1498
|
-
const p = this.filteredOptions.length !== u.length ? styleText("dim", ` (${this.filteredOptions.length} match${1 === this.filteredOptions.length ? "" : "es"})`) : "",
|
|
1491
|
+
const o = "error" === this.state ? "yellow" : "cyan", l = i ? `${styleText(o, dist_$)} ` : "", d = i ? styleText(o, dist_x) : "";
|
|
1492
|
+
let g = "";
|
|
1493
|
+
if (this.isNavigating || a) {
|
|
1494
|
+
const v = a ? n : r;
|
|
1495
|
+
g = "" !== v ? ` ${styleText("dim", v)}` : "";
|
|
1496
|
+
} else g = ` ${this.userInputWithCursor}`;
|
|
1497
|
+
const p = this.filteredOptions.length !== u.length ? styleText("dim", ` (${this.filteredOptions.length} match${1 === this.filteredOptions.length ? "" : "es"})`) : "", f = 0 === this.filteredOptions.length && r ? [
|
|
1499
1498
|
`${l}${styleText("yellow", "No matches found")}`
|
|
1500
|
-
] : [],
|
|
1499
|
+
] : [], h = "error" === this.state ? [
|
|
1501
1500
|
`${l}${styleText("yellow", this.error)}`
|
|
1502
1501
|
] : [];
|
|
1503
|
-
|
|
1504
|
-
const
|
|
1502
|
+
i && s.push(`${l.trimEnd()}`), s.push(`${l}${styleText("dim", "Search:")}${g}${p}`, ...f, ...h);
|
|
1503
|
+
const I = [
|
|
1505
1504
|
`${styleText("dim", "\u2191/\u2193")} to select`,
|
|
1506
1505
|
`${styleText("dim", "Enter:")} confirm`,
|
|
1507
1506
|
`${styleText("dim", "Type:")} to search`
|
|
1508
|
-
],
|
|
1509
|
-
`${l}${
|
|
1507
|
+
], m = [
|
|
1508
|
+
`${l}${I.join(" \u2022 ")}`,
|
|
1510
1509
|
d
|
|
1511
|
-
],
|
|
1510
|
+
], y = 0 === this.filteredOptions.length ? [] : dist_F({
|
|
1512
1511
|
cursor: this.cursor,
|
|
1513
1512
|
options: this.filteredOptions,
|
|
1514
|
-
columnPadding:
|
|
1515
|
-
rowPadding: s.length +
|
|
1516
|
-
style: (v,
|
|
1513
|
+
columnPadding: i ? 3 : 0,
|
|
1514
|
+
rowPadding: s.length + m.length,
|
|
1515
|
+
style: (v, C)=>c(v, v.disabled ? "disabled" : C ? "active" : "inactive"),
|
|
1517
1516
|
maxItems: t.maxItems,
|
|
1518
1517
|
output: t.output
|
|
1519
1518
|
});
|
|
1520
1519
|
return [
|
|
1521
1520
|
...s,
|
|
1522
|
-
...
|
|
1523
|
-
...
|
|
1521
|
+
...y.map((v)=>`${l}${v}`),
|
|
1522
|
+
...m
|
|
1524
1523
|
].join(`
|
|
1525
1524
|
`);
|
|
1526
1525
|
}
|
|
@@ -1528,31 +1527,29 @@ ${l}${a}`;
|
|
|
1528
1527
|
}
|
|
1529
1528
|
}).prompt();
|
|
1530
1529
|
const pe = (t)=>{
|
|
1531
|
-
const { selectableGroups:
|
|
1532
|
-
const
|
|
1530
|
+
const { selectableGroups: i = !0, groupSpacing: s = 0 } = t, r = (n, a, c = [])=>{
|
|
1531
|
+
const o = n.label ?? String(n.value), l = "string" == typeof n.group, d = l && (c[c.indexOf(n) + 1] ?? {
|
|
1533
1532
|
group: !0
|
|
1534
|
-
}),
|
|
1535
|
-
let
|
|
1536
|
-
|
|
1537
|
-
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
}
|
|
1541
|
-
if ("active" ===
|
|
1542
|
-
if ("
|
|
1543
|
-
|
|
1544
|
-
|
|
1545
|
-
|
|
1546
|
-
|
|
1547
|
-
}
|
|
1548
|
-
if ("cancelled" === o) return `${styleText([
|
|
1533
|
+
}), g = l && d && !0 === d.group;
|
|
1534
|
+
let p = "", f = "";
|
|
1535
|
+
l && (i ? (p = g ? `${dist_x} ` : `${dist_$} `, f = g ? " " : `${dist_$} `) : p = " ");
|
|
1536
|
+
let h = "";
|
|
1537
|
+
if (s > 0 && !l && (h = `
|
|
1538
|
+
`.repeat(s)), "active" === a) return dist_W(t.output, `${o}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`, `${h}${styleText("dim", p)} `, `${h}${styleText("dim", p)}${styleText("cyan", dist_et)} `, `${h}${styleText("dim", f)} `);
|
|
1539
|
+
if ("group-active" === a) return dist_W(t.output, o, `${h}${p} `, `${h}${p}${styleText("cyan", dist_et)} `, `${h}${f} `, (m)=>styleText("dim", m));
|
|
1540
|
+
if ("group-active-selected" === a) return dist_W(t.output, o, `${h}${p} `, `${h}${p}${styleText("green", dist_K)} `, `${h}${f} `, (m)=>styleText("dim", m));
|
|
1541
|
+
if ("selected" === a) {
|
|
1542
|
+
const m = l || i ? styleText("green", dist_K) : "";
|
|
1543
|
+
return dist_W(t.output, `${o}${n.hint ? ` (${n.hint})` : ""}`, `${h}${styleText("dim", p)} `, `${h}${styleText("dim", p)}${m} `, `${h}${styleText("dim", f)} `, (y)=>styleText("dim", y));
|
|
1544
|
+
}
|
|
1545
|
+
if ("cancelled" === a) return `${styleText([
|
|
1549
1546
|
"strikethrough",
|
|
1550
1547
|
"dim"
|
|
1551
|
-
],
|
|
1552
|
-
if ("active-selected" ===
|
|
1553
|
-
if ("submitted" ===
|
|
1554
|
-
const
|
|
1555
|
-
return `${
|
|
1548
|
+
], o)}`;
|
|
1549
|
+
if ("active-selected" === a) return dist_W(t.output, `${o}${n.hint ? ` ${styleText("dim", `(${n.hint})`)}` : ""}`, `${h}${styleText("dim", p)} `, `${h}${styleText("dim", p)}${styleText("green", dist_K)} `, `${h}${styleText("dim", f)} `);
|
|
1550
|
+
if ("submitted" === a) return `${styleText("dim", o)}`;
|
|
1551
|
+
const I = l || i ? styleText("dim", dist_Y) : "";
|
|
1552
|
+
return dist_W(t.output, o, `${h}${styleText("dim", p)} `, `${h}${styleText("dim", p)}${I} `, `${h}${styleText("dim", f)} `, (m)=>styleText("dim", m));
|
|
1556
1553
|
}, u = t.required ?? !0;
|
|
1557
1554
|
return new it({
|
|
1558
1555
|
options: t.options,
|
|
@@ -1562,7 +1559,7 @@ ${styleText("cyan", dist_$)}`;
|
|
|
1562
1559
|
initialValues: t.initialValues,
|
|
1563
1560
|
required: u,
|
|
1564
1561
|
cursorAt: t.cursorAt,
|
|
1565
|
-
selectableGroups:
|
|
1562
|
+
selectableGroups: i,
|
|
1566
1563
|
validate (n) {
|
|
1567
1564
|
if (u && (void 0 === n || 0 === n.length)) return `Please select at least one option.
|
|
1568
1565
|
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
@@ -1575,122 +1572,135 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
|
|
|
1575
1572
|
], " enter "))} to submit`))}`;
|
|
1576
1573
|
},
|
|
1577
1574
|
render () {
|
|
1578
|
-
const n = t.withGuide ?? dist_h.withGuide,
|
|
1579
|
-
` : ""}${
|
|
1580
|
-
`, c = this.value ?? []
|
|
1575
|
+
const n = t.withGuide ?? dist_h.withGuide, a = `${n ? `${styleText("gray", dist_$)}
|
|
1576
|
+
` : ""}${dist_P(this.state)} ${t.message}
|
|
1577
|
+
`, c = this.value ?? [], o = (l, d)=>{
|
|
1578
|
+
const g = this.options, p = c.includes(l.value) || !0 === l.group && this.isGroupSelected(`${l.value}`);
|
|
1579
|
+
return d || "string" != typeof l.group || this.options[this.cursor].value !== l.group ? d && p ? r(l, "active-selected", g) : p ? r(l, "selected", g) : r(l, d ? "active" : "inactive", g) : r(l, p ? "group-active-selected" : "group-active", g);
|
|
1580
|
+
};
|
|
1581
1581
|
switch(this.state){
|
|
1582
1582
|
case "submit":
|
|
1583
1583
|
{
|
|
1584
|
-
const
|
|
1585
|
-
return `${
|
|
1584
|
+
const l = this.options.filter(({ value: g })=>c.includes(g)).map((g)=>r(g, "submitted")), d = 0 === l.length ? "" : ` ${l.join(styleText("dim", ", "))}`;
|
|
1585
|
+
return `${a}${n ? styleText("gray", dist_$) : ""}${d}`;
|
|
1586
1586
|
}
|
|
1587
1587
|
case "cancel":
|
|
1588
1588
|
{
|
|
1589
|
-
const
|
|
1590
|
-
return `${
|
|
1589
|
+
const l = this.options.filter(({ value: d })=>c.includes(d)).map((d)=>r(d, "cancelled")).join(styleText("dim", ", "));
|
|
1590
|
+
return `${a}${n ? `${styleText("gray", dist_$)} ` : ""}${l.trim() ? `${l}${n ? `
|
|
1591
1591
|
${styleText("gray", dist_$)}` : ""}` : ""}`;
|
|
1592
1592
|
}
|
|
1593
1593
|
case "error":
|
|
1594
1594
|
{
|
|
1595
|
-
const
|
|
1596
|
-
`).map((
|
|
1597
|
-
`)
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1595
|
+
const l = n ? `${styleText("yellow", dist_$)} ` : "", d = this.error.split(`
|
|
1596
|
+
`).map((h, I)=>0 === I ? `${n ? `${styleText("yellow", dist_x)} ` : ""}${styleText("yellow", h)}` : ` ${h}`).join(`
|
|
1597
|
+
`), g = a.split(`
|
|
1598
|
+
`).length, p = d.split(`
|
|
1599
|
+
`).length + 1, f = dist_F({
|
|
1600
|
+
output: t.output,
|
|
1601
|
+
options: this.options,
|
|
1602
|
+
cursor: this.cursor,
|
|
1603
|
+
maxItems: t.maxItems,
|
|
1604
|
+
columnPadding: l.length,
|
|
1605
|
+
rowPadding: g + p,
|
|
1606
|
+
style: o
|
|
1601
1607
|
}).join(`
|
|
1602
|
-
${
|
|
1603
|
-
|
|
1608
|
+
${l}`);
|
|
1609
|
+
return `${a}${l}${f}
|
|
1610
|
+
${d}
|
|
1604
1611
|
`;
|
|
1605
1612
|
}
|
|
1606
1613
|
default:
|
|
1607
1614
|
{
|
|
1608
|
-
const
|
|
1609
|
-
|
|
1610
|
-
|
|
1611
|
-
|
|
1612
|
-
|
|
1615
|
+
const l = n ? `${styleText("cyan", dist_$)} ` : "", d = a.split(`
|
|
1616
|
+
`).length, g = (n ? 1 : 0) + 1, p = dist_F({
|
|
1617
|
+
output: t.output,
|
|
1618
|
+
options: this.options,
|
|
1619
|
+
cursor: this.cursor,
|
|
1620
|
+
maxItems: t.maxItems,
|
|
1621
|
+
columnPadding: l.length,
|
|
1622
|
+
rowPadding: d + g,
|
|
1623
|
+
style: o
|
|
1613
1624
|
}).join(`
|
|
1614
|
-
${
|
|
1615
|
-
|
|
1616
|
-
|
|
1617
|
-
${n ? styleText("cyan", E) : ""}
|
|
1625
|
+
${l}`);
|
|
1626
|
+
return `${a}${l}${p}
|
|
1627
|
+
${n ? styleText("cyan", dist_x) : ""}
|
|
1618
1628
|
`;
|
|
1619
1629
|
}
|
|
1620
1630
|
}
|
|
1621
1631
|
}
|
|
1622
1632
|
}).prompt();
|
|
1623
1633
|
}, dist_R = {
|
|
1624
|
-
message: (t = [], { symbol:
|
|
1625
|
-
const
|
|
1626
|
-
for(let p = 0; p < u; p++)
|
|
1627
|
-
const
|
|
1634
|
+
message: (t = [], { symbol: i = styleText("gray", dist_$), secondarySymbol: s = styleText("gray", dist_$), output: r = process.stdout, spacing: u = 1, withGuide: n } = {})=>{
|
|
1635
|
+
const a = [], c = n ?? dist_h.withGuide, o = c ? s : "", l = c ? `${i} ` : "", d = c ? `${s} ` : "";
|
|
1636
|
+
for(let p = 0; p < u; p++)a.push(o);
|
|
1637
|
+
const g = Array.isArray(t) ? t : t.split(`
|
|
1628
1638
|
`);
|
|
1629
|
-
if (
|
|
1630
|
-
const [p, ...
|
|
1631
|
-
p.length > 0 ?
|
|
1632
|
-
for (const
|
|
1639
|
+
if (g.length > 0) {
|
|
1640
|
+
const [p, ...f] = g;
|
|
1641
|
+
p.length > 0 ? a.push(`${l}${p}`) : a.push(c ? i : "");
|
|
1642
|
+
for (const h of f)h.length > 0 ? a.push(`${d}${h}`) : a.push(c ? s : "");
|
|
1633
1643
|
}
|
|
1634
|
-
|
|
1644
|
+
r.write(`${a.join(`
|
|
1635
1645
|
`)}
|
|
1636
1646
|
`);
|
|
1637
1647
|
},
|
|
1638
|
-
info: (t,
|
|
1648
|
+
info: (t, i)=>{
|
|
1639
1649
|
dist_R.message(t, {
|
|
1640
|
-
...
|
|
1650
|
+
...i,
|
|
1641
1651
|
symbol: styleText("blue", dist_ht)
|
|
1642
1652
|
});
|
|
1643
1653
|
},
|
|
1644
|
-
success: (t,
|
|
1654
|
+
success: (t, i)=>{
|
|
1645
1655
|
dist_R.message(t, {
|
|
1646
|
-
...
|
|
1656
|
+
...i,
|
|
1647
1657
|
symbol: styleText("green", pt)
|
|
1648
1658
|
});
|
|
1649
1659
|
},
|
|
1650
|
-
step: (t,
|
|
1660
|
+
step: (t, i)=>{
|
|
1651
1661
|
dist_R.message(t, {
|
|
1652
|
-
...
|
|
1653
|
-
symbol: styleText("green",
|
|
1662
|
+
...i,
|
|
1663
|
+
symbol: styleText("green", dist_H)
|
|
1654
1664
|
});
|
|
1655
1665
|
},
|
|
1656
|
-
warn: (t,
|
|
1666
|
+
warn: (t, i)=>{
|
|
1657
1667
|
dist_R.message(t, {
|
|
1658
|
-
...
|
|
1668
|
+
...i,
|
|
1659
1669
|
symbol: styleText("yellow", mt)
|
|
1660
1670
|
});
|
|
1661
1671
|
},
|
|
1662
|
-
warning: (t,
|
|
1663
|
-
dist_R.warn(t,
|
|
1672
|
+
warning: (t, i)=>{
|
|
1673
|
+
dist_R.warn(t, i);
|
|
1664
1674
|
},
|
|
1665
|
-
error: (t,
|
|
1675
|
+
error: (t, i)=>{
|
|
1666
1676
|
dist_R.message(t, {
|
|
1667
|
-
...
|
|
1677
|
+
...i,
|
|
1668
1678
|
symbol: styleText("red", gt)
|
|
1669
1679
|
});
|
|
1670
1680
|
}
|
|
1671
|
-
}, me = (t = "",
|
|
1672
|
-
const s =
|
|
1673
|
-
s.write(`${
|
|
1681
|
+
}, me = (t = "", i)=>{
|
|
1682
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_h.withGuide ? `${styleText("gray", dist_x)} ` : "";
|
|
1683
|
+
s.write(`${r}${styleText("red", t)}
|
|
1674
1684
|
|
|
1675
1685
|
`);
|
|
1676
|
-
}, ye = (t = "",
|
|
1677
|
-
const s =
|
|
1678
|
-
${styleText("gray",
|
|
1679
|
-
s.write(`${
|
|
1686
|
+
}, ye = (t = "", i)=>{
|
|
1687
|
+
const s = i?.output ?? process.stdout, r = i?.withGuide ?? dist_h.withGuide ? `${styleText("gray", dist_$)}
|
|
1688
|
+
${styleText("gray", dist_x)} ` : "";
|
|
1689
|
+
s.write(`${r}${t}
|
|
1680
1690
|
|
|
1681
1691
|
`);
|
|
1682
|
-
}, dist_Q = (t,
|
|
1683
|
-
`).map((s)=>
|
|
1692
|
+
}, dist_Q = (t, i)=>t.split(`
|
|
1693
|
+
`).map((s)=>i(s)).join(`
|
|
1684
1694
|
`), ve = (t)=>{
|
|
1685
|
-
const
|
|
1686
|
-
const n =
|
|
1687
|
-
return "disabled" === u ? `${styleText("gray",
|
|
1695
|
+
const i = (r, u)=>{
|
|
1696
|
+
const n = r.label ?? String(r.value);
|
|
1697
|
+
return "disabled" === u ? `${styleText("gray", dist_Y)} ${dist_Q(n, (a)=>styleText([
|
|
1688
1698
|
"strikethrough",
|
|
1689
1699
|
"gray"
|
|
1690
|
-
],
|
|
1700
|
+
], a))}${r.hint ? ` ${styleText("dim", `(${r.hint ?? "disabled"})`)}` : ""}` : "active" === u ? `${styleText("cyan", dist_et)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : "selected" === u ? `${styleText("green", dist_K)} ${dist_Q(n, (a)=>styleText("dim", a))}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : "cancelled" === u ? `${dist_Q(n, (a)=>styleText([
|
|
1691
1701
|
"strikethrough",
|
|
1692
1702
|
"dim"
|
|
1693
|
-
],
|
|
1703
|
+
], a))}` : "active-selected" === u ? `${styleText("green", dist_K)} ${n}${r.hint ? ` ${styleText("dim", `(${r.hint})`)}` : ""}` : "submitted" === u ? `${dist_Q(n, (a)=>styleText("dim", a))}` : `${styleText("dim", dist_Y)} ${dist_Q(n, (a)=>styleText("dim", a))}`;
|
|
1694
1704
|
}, s = t.required ?? !0;
|
|
1695
1705
|
return new dist_nt({
|
|
1696
1706
|
options: t.options,
|
|
@@ -1700,8 +1710,8 @@ ${styleText("gray", E)} ` : "";
|
|
|
1700
1710
|
initialValues: t.initialValues,
|
|
1701
1711
|
required: s,
|
|
1702
1712
|
cursorAt: t.cursorAt,
|
|
1703
|
-
validate (
|
|
1704
|
-
if (s && (void 0 ===
|
|
1713
|
+
validate (r) {
|
|
1714
|
+
if (s && (void 0 === r || 0 === r.length)) return `Please select at least one option.
|
|
1705
1715
|
${styleText("reset", styleText("dim", `Press ${styleText([
|
|
1706
1716
|
"gray",
|
|
1707
1717
|
"bgWhite",
|
|
@@ -1709,101 +1719,101 @@ ${styleText("reset", styleText("dim", `Press ${styleText([
|
|
|
1709
1719
|
], " space ")} to select, ${styleText("gray", styleText("bgWhite", styleText("inverse", " enter ")))} to submit`))}`;
|
|
1710
1720
|
},
|
|
1711
1721
|
render () {
|
|
1712
|
-
const
|
|
1722
|
+
const r = t.withGuide ?? dist_h.withGuide, u = dist_W(t.output, t.message, r ? `${yt(this.state)} ` : "", `${dist_P(this.state)} `), n = `${r ? `${styleText("gray", dist_$)}
|
|
1713
1723
|
` : ""}${u}
|
|
1714
|
-
`,
|
|
1715
|
-
if (
|
|
1716
|
-
const d =
|
|
1717
|
-
return l && d ?
|
|
1724
|
+
`, a = this.value ?? [], c = (o, l)=>{
|
|
1725
|
+
if (o.disabled) return i(o, "disabled");
|
|
1726
|
+
const d = a.includes(o.value);
|
|
1727
|
+
return l && d ? i(o, "active-selected") : d ? i(o, "selected") : i(o, l ? "active" : "inactive");
|
|
1718
1728
|
};
|
|
1719
1729
|
switch(this.state){
|
|
1720
1730
|
case "submit":
|
|
1721
1731
|
{
|
|
1722
|
-
const
|
|
1732
|
+
const o = this.options.filter(({ value: d })=>a.includes(d)).map((d)=>i(d, "submitted")).join(styleText("dim", ", ")) || styleText("dim", "none"), l = dist_W(t.output, o, r ? `${styleText("gray", dist_$)} ` : "");
|
|
1723
1733
|
return `${n}${l}`;
|
|
1724
1734
|
}
|
|
1725
1735
|
case "cancel":
|
|
1726
1736
|
{
|
|
1727
|
-
const
|
|
1728
|
-
if ("" ===
|
|
1729
|
-
const l = dist_W(t.output,
|
|
1730
|
-
return `${n}${l}${
|
|
1737
|
+
const o = this.options.filter(({ value: d })=>a.includes(d)).map((d)=>i(d, "cancelled")).join(styleText("dim", ", "));
|
|
1738
|
+
if ("" === o.trim()) return `${n}${styleText("gray", dist_$)}`;
|
|
1739
|
+
const l = dist_W(t.output, o, r ? `${styleText("gray", dist_$)} ` : "");
|
|
1740
|
+
return `${n}${l}${r ? `
|
|
1731
1741
|
${styleText("gray", dist_$)}` : ""}`;
|
|
1732
1742
|
}
|
|
1733
1743
|
case "error":
|
|
1734
1744
|
{
|
|
1735
|
-
const
|
|
1736
|
-
`).map((p,
|
|
1745
|
+
const o = r ? `${styleText("yellow", dist_$)} ` : "", l = this.error.split(`
|
|
1746
|
+
`).map((p, f)=>0 === f ? `${r ? `${styleText("yellow", dist_x)} ` : ""}${styleText("yellow", p)}` : ` ${p}`).join(`
|
|
1737
1747
|
`), d = n.split(`
|
|
1738
|
-
`).length,
|
|
1748
|
+
`).length, g = l.split(`
|
|
1739
1749
|
`).length + 1;
|
|
1740
|
-
return `${n}${
|
|
1750
|
+
return `${n}${o}${dist_F({
|
|
1741
1751
|
output: t.output,
|
|
1742
1752
|
options: this.options,
|
|
1743
1753
|
cursor: this.cursor,
|
|
1744
1754
|
maxItems: t.maxItems,
|
|
1745
|
-
columnPadding:
|
|
1746
|
-
rowPadding: d +
|
|
1755
|
+
columnPadding: o.length,
|
|
1756
|
+
rowPadding: d + g,
|
|
1747
1757
|
style: c
|
|
1748
1758
|
}).join(`
|
|
1749
|
-
${
|
|
1759
|
+
${o}`)}
|
|
1750
1760
|
${l}
|
|
1751
1761
|
`;
|
|
1752
1762
|
}
|
|
1753
1763
|
default:
|
|
1754
1764
|
{
|
|
1755
|
-
const
|
|
1756
|
-
`).length, d =
|
|
1757
|
-
return `${n}${
|
|
1765
|
+
const o = r ? `${styleText("cyan", dist_$)} ` : "", l = n.split(`
|
|
1766
|
+
`).length, d = r ? 2 : 1;
|
|
1767
|
+
return `${n}${o}${dist_F({
|
|
1758
1768
|
output: t.output,
|
|
1759
1769
|
options: this.options,
|
|
1760
1770
|
cursor: this.cursor,
|
|
1761
1771
|
maxItems: t.maxItems,
|
|
1762
|
-
columnPadding:
|
|
1772
|
+
columnPadding: o.length,
|
|
1763
1773
|
rowPadding: l + d,
|
|
1764
1774
|
style: c
|
|
1765
1775
|
}).join(`
|
|
1766
|
-
${
|
|
1767
|
-
${
|
|
1776
|
+
${o}`)}
|
|
1777
|
+
${r ? styleText("cyan", dist_x) : ""}
|
|
1768
1778
|
`;
|
|
1769
1779
|
}
|
|
1770
1780
|
}
|
|
1771
1781
|
}
|
|
1772
1782
|
}).prompt();
|
|
1773
|
-
}, we = (t)=>styleText("dim", t), be = (t,
|
|
1774
|
-
const
|
|
1783
|
+
}, we = (t)=>styleText("dim", t), be = (t, i, s)=>{
|
|
1784
|
+
const r = {
|
|
1775
1785
|
hard: !0,
|
|
1776
1786
|
trim: !1
|
|
1777
|
-
}, u = wrapAnsi(t,
|
|
1778
|
-
`), n = u.reduce((
|
|
1779
|
-
return wrapAnsi(t, c,
|
|
1780
|
-
}, Se = (t = "",
|
|
1781
|
-
const
|
|
1787
|
+
}, u = wrapAnsi(t, i, r).split(`
|
|
1788
|
+
`), n = u.reduce((o, l)=>Math.max(fast_string_width_dist(l), o), 0), a = u.map(s).reduce((o, l)=>Math.max(fast_string_width_dist(l), o), 0), c = i - (a - n);
|
|
1789
|
+
return wrapAnsi(t, c, r);
|
|
1790
|
+
}, Se = (t = "", i = "", s)=>{
|
|
1791
|
+
const r = s?.output ?? node_process.stdout, u = s?.withGuide ?? dist_h.withGuide, n = s?.format ?? we, a = [
|
|
1782
1792
|
"",
|
|
1783
|
-
...be(t, dist_A(
|
|
1793
|
+
...be(t, dist_A(r) - 6, n).split(`
|
|
1784
1794
|
`).map(n),
|
|
1785
1795
|
""
|
|
1786
|
-
], c = fast_string_width_dist(
|
|
1787
|
-
const
|
|
1788
|
-
return
|
|
1789
|
-
}, 0), c) + 2, l =
|
|
1796
|
+
], c = fast_string_width_dist(i), o = Math.max(a.reduce((p, f)=>{
|
|
1797
|
+
const h = fast_string_width_dist(f);
|
|
1798
|
+
return h > p ? h : p;
|
|
1799
|
+
}, 0), c) + 2, l = a.map((p)=>`${styleText("gray", dist_$)} ${p}${" ".repeat(o - fast_string_width_dist(p))}${styleText("gray", dist_$)}`).join(`
|
|
1790
1800
|
`), d = u ? `${styleText("gray", dist_$)}
|
|
1791
|
-
` : "",
|
|
1792
|
-
|
|
1801
|
+
` : "", g = u ? Gt : dt;
|
|
1802
|
+
r.write(`${d}${styleText("green", dist_H)} ${styleText("reset", i)} ${styleText("gray", dist_st.repeat(Math.max(o - c - 1, 1)) + ct)}
|
|
1793
1803
|
${l}
|
|
1794
|
-
${styleText("gray",
|
|
1804
|
+
${styleText("gray", g + dist_st.repeat(o + 2) + $t)}
|
|
1795
1805
|
`);
|
|
1796
1806
|
};
|
|
1797
1807
|
dist_w("\u2500", "-"), dist_w("\u2501", "="), dist_w("\u2588", "#");
|
|
1798
|
-
const dist_it = (t,
|
|
1808
|
+
const dist_it = (t, i)=>t.includes(`
|
|
1799
1809
|
`) ? t.split(`
|
|
1800
|
-
`).map((s)=>
|
|
1801
|
-
`) :
|
|
1802
|
-
const
|
|
1810
|
+
`).map((s)=>i(s)).join(`
|
|
1811
|
+
`) : i(t), xe = (t)=>{
|
|
1812
|
+
const i = (s, r)=>{
|
|
1803
1813
|
const u = s.label ?? String(s.value);
|
|
1804
|
-
switch(
|
|
1814
|
+
switch(r){
|
|
1805
1815
|
case "disabled":
|
|
1806
|
-
return `${styleText("gray",
|
|
1816
|
+
return `${styleText("gray", dist_U)} ${dist_it(u, (n)=>styleText("gray", n))}${s.hint ? ` ${styleText("dim", `(${s.hint ?? "disabled"})`)}` : ""}`;
|
|
1807
1817
|
case "selected":
|
|
1808
1818
|
return `${dist_it(u, (n)=>styleText("dim", n))}`;
|
|
1809
1819
|
case "active":
|
|
@@ -1814,7 +1824,7 @@ const dist_it = (t, r)=>t.includes(`
|
|
|
1814
1824
|
"dim"
|
|
1815
1825
|
], n))}`;
|
|
1816
1826
|
default:
|
|
1817
|
-
return `${styleText("dim",
|
|
1827
|
+
return `${styleText("dim", dist_U)} ${dist_it(u, (n)=>styleText("dim", n))}`;
|
|
1818
1828
|
}
|
|
1819
1829
|
};
|
|
1820
1830
|
return new ut({
|
|
@@ -1824,163 +1834,163 @@ const dist_it = (t, r)=>t.includes(`
|
|
|
1824
1834
|
output: t.output,
|
|
1825
1835
|
initialValue: t.initialValue,
|
|
1826
1836
|
render () {
|
|
1827
|
-
const s = t.withGuide ?? dist_h.withGuide,
|
|
1837
|
+
const s = t.withGuide ?? dist_h.withGuide, r = `${dist_P(this.state)} `, u = `${yt(this.state)} `, n = dist_W(t.output, t.message, u, r), a = `${s ? `${styleText("gray", dist_$)}
|
|
1828
1838
|
` : ""}${n}
|
|
1829
1839
|
`;
|
|
1830
1840
|
switch(this.state){
|
|
1831
1841
|
case "submit":
|
|
1832
1842
|
{
|
|
1833
|
-
const c = s ? `${styleText("gray", dist_$)} ` : "",
|
|
1834
|
-
return `${
|
|
1843
|
+
const c = s ? `${styleText("gray", dist_$)} ` : "", o = dist_W(t.output, i(this.options[this.cursor], "selected"), c);
|
|
1844
|
+
return `${a}${o}`;
|
|
1835
1845
|
}
|
|
1836
1846
|
case "cancel":
|
|
1837
1847
|
{
|
|
1838
|
-
const c = s ? `${styleText("gray", dist_$)} ` : "",
|
|
1839
|
-
return `${
|
|
1848
|
+
const c = s ? `${styleText("gray", dist_$)} ` : "", o = dist_W(t.output, i(this.options[this.cursor], "cancelled"), c);
|
|
1849
|
+
return `${a}${o}${s ? `
|
|
1840
1850
|
${styleText("gray", dist_$)}` : ""}`;
|
|
1841
1851
|
}
|
|
1842
1852
|
default:
|
|
1843
1853
|
{
|
|
1844
|
-
const c = s ? `${styleText("cyan", dist_$)} ` : "",
|
|
1854
|
+
const c = s ? `${styleText("cyan", dist_$)} ` : "", o = s ? styleText("cyan", dist_x) : "", l = a.split(`
|
|
1845
1855
|
`).length, d = s ? 2 : 1;
|
|
1846
|
-
return `${
|
|
1856
|
+
return `${a}${c}${dist_F({
|
|
1847
1857
|
output: t.output,
|
|
1848
1858
|
cursor: this.cursor,
|
|
1849
1859
|
options: this.options,
|
|
1850
1860
|
maxItems: t.maxItems,
|
|
1851
1861
|
columnPadding: c.length,
|
|
1852
1862
|
rowPadding: l + d,
|
|
1853
|
-
style: (
|
|
1863
|
+
style: (g, p)=>i(g, g.disabled ? "disabled" : p ? "active" : "inactive")
|
|
1854
1864
|
}).join(`
|
|
1855
1865
|
${c}`)}
|
|
1856
|
-
${
|
|
1866
|
+
${o}
|
|
1857
1867
|
`;
|
|
1858
1868
|
}
|
|
1859
1869
|
}
|
|
1860
1870
|
}
|
|
1861
1871
|
}).prompt();
|
|
1862
|
-
},
|
|
1863
|
-
const
|
|
1864
|
-
|
|
1865
|
-
`),
|
|
1872
|
+
}, Me = (styleText("gray", dist_$), (t)=>t.replace(/\x1b\[(?:\d+;)*\d*[ABCDEFGHfJKSTsu]|\x1b\[(s|u)/g, "")), Oe = (t)=>{
|
|
1873
|
+
const i = t.output ?? process.stdout, s = dist_A(i), r = styleText("gray", dist_$), u = t.spacing ?? 1, n = 3, a = !0 === t.retainLog, c = !dist_ot() && It(i);
|
|
1874
|
+
i.write(`${r}
|
|
1875
|
+
`), i.write(`${styleText("green", dist_H)} ${t.title}
|
|
1866
1876
|
`);
|
|
1867
|
-
for(let
|
|
1877
|
+
for(let m = 0; m < u; m++)i.write(`${r}
|
|
1868
1878
|
`);
|
|
1869
|
-
const
|
|
1879
|
+
const o = [
|
|
1870
1880
|
{
|
|
1871
1881
|
value: "",
|
|
1872
1882
|
full: ""
|
|
1873
1883
|
}
|
|
1874
1884
|
];
|
|
1875
1885
|
let l = !1;
|
|
1876
|
-
const d = (
|
|
1877
|
-
if (0 ===
|
|
1878
|
-
let
|
|
1879
|
-
|
|
1880
|
-
for (const v of
|
|
1881
|
-
const { value:
|
|
1882
|
-
let b =
|
|
1886
|
+
const d = (m)=>{
|
|
1887
|
+
if (0 === o.length) return;
|
|
1888
|
+
let y = 0;
|
|
1889
|
+
m && (y += u + 2);
|
|
1890
|
+
for (const v of o){
|
|
1891
|
+
const { value: C, result: S } = v;
|
|
1892
|
+
let b = S?.message ?? C;
|
|
1883
1893
|
if (0 === b.length) continue;
|
|
1884
|
-
void 0 ===
|
|
1894
|
+
void 0 === S && void 0 !== v.header && "" !== v.header && (b += `
|
|
1885
1895
|
${v.header}`);
|
|
1886
1896
|
const G = b.split(`
|
|
1887
|
-
`).reduce((
|
|
1888
|
-
|
|
1889
|
-
}
|
|
1890
|
-
|
|
1891
|
-
},
|
|
1892
|
-
const
|
|
1893
|
-
${
|
|
1894
|
-
void 0 !==
|
|
1895
|
-
`).map((
|
|
1896
|
-
output:
|
|
1897
|
-
secondarySymbol:
|
|
1898
|
-
symbol:
|
|
1897
|
+
`).reduce((M, N)=>"" === N ? M + 1 : M + Math.ceil((N.length + n) / s), 0);
|
|
1898
|
+
y += G;
|
|
1899
|
+
}
|
|
1900
|
+
y > 0 && (y += 1, i.write(src.erase.lines(y)));
|
|
1901
|
+
}, g = (m, y, v)=>{
|
|
1902
|
+
const C = v ? `${m.full}
|
|
1903
|
+
${m.value}` : m.value;
|
|
1904
|
+
void 0 !== m.header && "" !== m.header && dist_R.message(m.header.split(`
|
|
1905
|
+
`).map((S)=>styleText("bold", S)), {
|
|
1906
|
+
output: i,
|
|
1907
|
+
secondarySymbol: r,
|
|
1908
|
+
symbol: r,
|
|
1899
1909
|
spacing: 0
|
|
1900
|
-
}), dist_R.message(
|
|
1901
|
-
`).map((
|
|
1902
|
-
output:
|
|
1903
|
-
secondarySymbol:
|
|
1904
|
-
symbol:
|
|
1905
|
-
spacing:
|
|
1910
|
+
}), dist_R.message(C.split(`
|
|
1911
|
+
`).map((S)=>styleText("dim", S)), {
|
|
1912
|
+
output: i,
|
|
1913
|
+
secondarySymbol: r,
|
|
1914
|
+
symbol: r,
|
|
1915
|
+
spacing: y ?? u
|
|
1906
1916
|
});
|
|
1907
1917
|
}, p = ()=>{
|
|
1908
|
-
for (const
|
|
1909
|
-
const { header:
|
|
1910
|
-
(void 0 ===
|
|
1911
|
-
}
|
|
1912
|
-
},
|
|
1913
|
-
if (d(!1), v?.raw === !0 && l || "" ===
|
|
1914
|
-
`),
|
|
1915
|
-
const
|
|
1916
|
-
`),
|
|
1917
|
-
if (
|
|
1918
|
-
const b =
|
|
1919
|
-
|
|
1918
|
+
for (const m of o){
|
|
1919
|
+
const { header: y, value: v, full: C } = m;
|
|
1920
|
+
(void 0 === y || 0 === y.length) && 0 === v.length || g(m, void 0, !0 === a && C.length > 0);
|
|
1921
|
+
}
|
|
1922
|
+
}, f = (m, y, v)=>{
|
|
1923
|
+
if (d(!1), v?.raw === !0 && l || "" === m.value || (m.value += `
|
|
1924
|
+
`), m.value += Me(y), l = v?.raw === !0, void 0 !== t.limit) {
|
|
1925
|
+
const C = m.value.split(`
|
|
1926
|
+
`), S = C.length - t.limit;
|
|
1927
|
+
if (S > 0) {
|
|
1928
|
+
const b = C.splice(0, S);
|
|
1929
|
+
a && (m.full += ("" === m.full ? "" : `
|
|
1920
1930
|
`) + b.join(`
|
|
1921
1931
|
`));
|
|
1922
1932
|
}
|
|
1923
|
-
|
|
1933
|
+
m.value = C.join(`
|
|
1924
1934
|
`);
|
|
1925
1935
|
}
|
|
1926
|
-
c &&
|
|
1927
|
-
},
|
|
1928
|
-
for (const
|
|
1929
|
-
output:
|
|
1930
|
-
secondarySymbol:
|
|
1936
|
+
c && h();
|
|
1937
|
+
}, h = ()=>{
|
|
1938
|
+
for (const m of o)m.result ? "error" === m.result.status ? dist_R.error(m.result.message, {
|
|
1939
|
+
output: i,
|
|
1940
|
+
secondarySymbol: r,
|
|
1931
1941
|
spacing: 0
|
|
1932
|
-
}) : dist_R.success(
|
|
1933
|
-
output:
|
|
1934
|
-
secondarySymbol:
|
|
1942
|
+
}) : dist_R.success(m.result.message, {
|
|
1943
|
+
output: i,
|
|
1944
|
+
secondarySymbol: r,
|
|
1935
1945
|
spacing: 0
|
|
1936
|
-
}) : "" !==
|
|
1937
|
-
},
|
|
1938
|
-
d(!1),
|
|
1946
|
+
}) : "" !== m.value && g(m, 0);
|
|
1947
|
+
}, I = (m, y)=>{
|
|
1948
|
+
d(!1), m.result = y, c && h();
|
|
1939
1949
|
};
|
|
1940
1950
|
return {
|
|
1941
|
-
message (
|
|
1942
|
-
|
|
1951
|
+
message (m, y) {
|
|
1952
|
+
f(o[0], m, y);
|
|
1943
1953
|
},
|
|
1944
|
-
group (
|
|
1945
|
-
const
|
|
1946
|
-
header:
|
|
1954
|
+
group (m) {
|
|
1955
|
+
const y = {
|
|
1956
|
+
header: m,
|
|
1947
1957
|
value: "",
|
|
1948
1958
|
full: ""
|
|
1949
1959
|
};
|
|
1950
|
-
return
|
|
1951
|
-
message (v,
|
|
1952
|
-
|
|
1960
|
+
return o.push(y), {
|
|
1961
|
+
message (v, C) {
|
|
1962
|
+
f(y, v, C);
|
|
1953
1963
|
},
|
|
1954
1964
|
error (v) {
|
|
1955
|
-
|
|
1965
|
+
I(y, {
|
|
1956
1966
|
status: "error",
|
|
1957
1967
|
message: v
|
|
1958
1968
|
});
|
|
1959
1969
|
},
|
|
1960
1970
|
success (v) {
|
|
1961
|
-
|
|
1971
|
+
I(y, {
|
|
1962
1972
|
status: "success",
|
|
1963
1973
|
message: v
|
|
1964
1974
|
});
|
|
1965
1975
|
}
|
|
1966
1976
|
};
|
|
1967
1977
|
},
|
|
1968
|
-
error (
|
|
1969
|
-
d(!0), dist_R.error(
|
|
1970
|
-
output:
|
|
1971
|
-
secondarySymbol:
|
|
1978
|
+
error (m, y) {
|
|
1979
|
+
d(!0), dist_R.error(m, {
|
|
1980
|
+
output: i,
|
|
1981
|
+
secondarySymbol: r,
|
|
1972
1982
|
spacing: 1
|
|
1973
|
-
}),
|
|
1983
|
+
}), y?.showLog !== !1 && p(), o.splice(1, o.length - 1), o[0].value = "", o[0].full = "";
|
|
1974
1984
|
},
|
|
1975
|
-
success (
|
|
1976
|
-
d(!0), dist_R.success(
|
|
1977
|
-
output:
|
|
1978
|
-
secondarySymbol:
|
|
1985
|
+
success (m, y) {
|
|
1986
|
+
d(!0), dist_R.success(m, {
|
|
1987
|
+
output: i,
|
|
1988
|
+
secondarySymbol: r,
|
|
1979
1989
|
spacing: 1
|
|
1980
|
-
}),
|
|
1990
|
+
}), y?.showLog === !0 && p(), o.splice(1, o.length - 1), o[0].value = "", o[0].full = "";
|
|
1981
1991
|
}
|
|
1982
1992
|
};
|
|
1983
|
-
},
|
|
1993
|
+
}, Pe = (t)=>new ht({
|
|
1984
1994
|
validate: t.validate,
|
|
1985
1995
|
placeholder: t.placeholder,
|
|
1986
1996
|
defaultValue: t.defaultValue,
|
|
@@ -1989,39 +1999,39 @@ ${h.value}` : h.value;
|
|
|
1989
1999
|
signal: t.signal,
|
|
1990
2000
|
input: t.input,
|
|
1991
2001
|
render () {
|
|
1992
|
-
const
|
|
1993
|
-
` : ""}${
|
|
1994
|
-
`,
|
|
2002
|
+
const i = t?.withGuide ?? dist_h.withGuide, s = `${i ? `${styleText("gray", dist_$)}
|
|
2003
|
+
` : ""}${dist_P(this.state)} ${t.message}
|
|
2004
|
+
`, r = t.placeholder ? styleText("inverse", t.placeholder[0]) + styleText("dim", t.placeholder.slice(1)) : styleText([
|
|
1995
2005
|
"inverse",
|
|
1996
2006
|
"hidden"
|
|
1997
|
-
], "_"), u = this.userInput ? this.userInputWithCursor :
|
|
2007
|
+
], "_"), u = this.userInput ? this.userInputWithCursor : r, n = this.value ?? "";
|
|
1998
2008
|
switch(this.state){
|
|
1999
2009
|
case "error":
|
|
2000
2010
|
{
|
|
2001
|
-
const
|
|
2011
|
+
const a = this.error ? ` ${styleText("yellow", this.error)}` : "", c = i ? `${styleText("yellow", dist_$)} ` : "", o = i ? styleText("yellow", dist_x) : "";
|
|
2002
2012
|
return `${s.trim()}
|
|
2003
2013
|
${c}${u}
|
|
2004
|
-
${
|
|
2014
|
+
${o}${a}
|
|
2005
2015
|
`;
|
|
2006
2016
|
}
|
|
2007
2017
|
case "submit":
|
|
2008
2018
|
{
|
|
2009
|
-
const
|
|
2010
|
-
return `${s}${c}${
|
|
2019
|
+
const a = n ? ` ${styleText("dim", n)}` : "", c = i ? styleText("gray", dist_$) : "";
|
|
2020
|
+
return `${s}${c}${a}`;
|
|
2011
2021
|
}
|
|
2012
2022
|
case "cancel":
|
|
2013
2023
|
{
|
|
2014
|
-
const
|
|
2024
|
+
const a = n ? ` ${styleText([
|
|
2015
2025
|
"strikethrough",
|
|
2016
2026
|
"dim"
|
|
2017
|
-
], n)}` : "", c =
|
|
2018
|
-
return `${s}${c}${
|
|
2027
|
+
], n)}` : "", c = i ? styleText("gray", dist_$) : "";
|
|
2028
|
+
return `${s}${c}${a}${n.trim() ? `
|
|
2019
2029
|
${c}` : ""}`;
|
|
2020
2030
|
}
|
|
2021
2031
|
default:
|
|
2022
2032
|
{
|
|
2023
|
-
const
|
|
2024
|
-
return `${s}${
|
|
2033
|
+
const a = i ? `${styleText("cyan", dist_$)} ` : "", c = i ? styleText("cyan", dist_x) : "";
|
|
2034
|
+
return `${s}${a}${u}
|
|
2025
2035
|
${c}
|
|
2026
2036
|
`;
|
|
2027
2037
|
}
|
|
@@ -2299,18 +2309,14 @@ let createLogger = (options = {})=>{
|
|
|
2299
2309
|
return logger;
|
|
2300
2310
|
};
|
|
2301
2311
|
let src_logger = createLogger();
|
|
2302
|
-
|
|
2303
|
-
|
|
2304
|
-
}).exports, t), e = null), t.exports);
|
|
2305
|
-
var main_d = /* @__PURE__ */ createRequire(import.meta.url);
|
|
2306
|
-
const main_f = /^path$/i;
|
|
2307
|
-
const main_p = {
|
|
2312
|
+
const main_h = /^path$/i;
|
|
2313
|
+
const main_g = {
|
|
2308
2314
|
key: "PATH",
|
|
2309
2315
|
value: ""
|
|
2310
2316
|
};
|
|
2311
|
-
function
|
|
2317
|
+
function main_(e) {
|
|
2312
2318
|
for(const t in e){
|
|
2313
|
-
if (!Object.prototype.hasOwnProperty.call(e, t) || !
|
|
2319
|
+
if (!Object.prototype.hasOwnProperty.call(e, t) || !main_h.test(t)) continue;
|
|
2314
2320
|
const n = e[t];
|
|
2315
2321
|
if (!n) break;
|
|
2316
2322
|
return {
|
|
@@ -2318,18 +2324,18 @@ function main_m(e) {
|
|
|
2318
2324
|
value: n
|
|
2319
2325
|
};
|
|
2320
2326
|
}
|
|
2321
|
-
return
|
|
2327
|
+
return main_g;
|
|
2322
2328
|
}
|
|
2323
|
-
function
|
|
2329
|
+
function main_v(e, t) {
|
|
2324
2330
|
const n = t.value.split(delimiter);
|
|
2325
2331
|
const r = [];
|
|
2326
|
-
let
|
|
2332
|
+
let o = e;
|
|
2327
2333
|
let c;
|
|
2328
2334
|
do {
|
|
2329
|
-
r.push(resolve(
|
|
2330
|
-
c =
|
|
2331
|
-
|
|
2332
|
-
}while (
|
|
2335
|
+
r.push(resolve(o, "node_modules", ".bin"));
|
|
2336
|
+
c = o;
|
|
2337
|
+
o = dirname(o);
|
|
2338
|
+
}while (o !== c);
|
|
2333
2339
|
r.push(dirname(process.execPath));
|
|
2334
2340
|
const l = r.concat(n).join(delimiter);
|
|
2335
2341
|
return {
|
|
@@ -2337,16 +2343,17 @@ function main_h(e, t) {
|
|
|
2337
2343
|
value: l
|
|
2338
2344
|
};
|
|
2339
2345
|
}
|
|
2340
|
-
function
|
|
2341
|
-
const
|
|
2346
|
+
function main_y(e, t, n = true) {
|
|
2347
|
+
const r = {
|
|
2342
2348
|
...process.env,
|
|
2343
2349
|
...t
|
|
2344
2350
|
};
|
|
2345
|
-
|
|
2346
|
-
|
|
2347
|
-
|
|
2351
|
+
if (!n) return r;
|
|
2352
|
+
const i = main_v(e, main_(r));
|
|
2353
|
+
r[i.key] = i.value;
|
|
2354
|
+
return r;
|
|
2348
2355
|
}
|
|
2349
|
-
const
|
|
2356
|
+
const main_b = (e)=>{
|
|
2350
2357
|
let t = e.length;
|
|
2351
2358
|
const n = new PassThrough();
|
|
2352
2359
|
const r = ()=>{
|
|
@@ -2357,396 +2364,112 @@ const main_ = (e)=>{
|
|
|
2357
2364
|
}).then(r).catch(r);
|
|
2358
2365
|
return n;
|
|
2359
2366
|
};
|
|
2360
|
-
|
|
2361
|
-
|
|
2362
|
-
|
|
2363
|
-
|
|
2364
|
-
|
|
2365
|
-
|
|
2366
|
-
|
|
2367
|
-
|
|
2368
|
-
|
|
2369
|
-
|
|
2370
|
-
|
|
2371
|
-
|
|
2372
|
-
|
|
2373
|
-
|
|
2374
|
-
|
|
2375
|
-
|
|
2376
|
-
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2380
|
-
|
|
2381
|
-
|
|
2382
|
-
|
|
2383
|
-
}
|
|
2384
|
-
function o(e, t) {
|
|
2385
|
-
return i(n.statSync(e), e, t);
|
|
2386
|
-
}
|
|
2387
|
-
});
|
|
2388
|
-
var main_y = /* @__PURE__ */ main_u((e, t)=>{
|
|
2389
|
-
t.exports = r;
|
|
2390
|
-
r.sync = i;
|
|
2391
|
-
var n = main_d("fs");
|
|
2392
|
-
function r(e, t, r) {
|
|
2393
|
-
n.stat(e, function(e, n) {
|
|
2394
|
-
r(e, e ? false : a(n, t));
|
|
2395
|
-
});
|
|
2396
|
-
}
|
|
2397
|
-
function i(e, t) {
|
|
2398
|
-
return a(n.statSync(e), t);
|
|
2399
|
-
}
|
|
2400
|
-
function a(e, t) {
|
|
2401
|
-
return e.isFile() && o(e, t);
|
|
2402
|
-
}
|
|
2403
|
-
function o(e, t) {
|
|
2404
|
-
var n = e.mode;
|
|
2405
|
-
var r = e.uid;
|
|
2406
|
-
var i = e.gid;
|
|
2407
|
-
var a = void 0 !== t.uid ? t.uid : process.getuid && process.getuid();
|
|
2408
|
-
var o = void 0 !== t.gid ? t.gid : process.getgid && process.getgid();
|
|
2409
|
-
var s = parseInt("100", 8);
|
|
2410
|
-
var c = parseInt("010", 8);
|
|
2411
|
-
var l = parseInt("001", 8);
|
|
2412
|
-
var u = s | c;
|
|
2413
|
-
return n & l || n & c && i === o || n & s && r === a || n & u && 0 === a;
|
|
2414
|
-
}
|
|
2415
|
-
});
|
|
2416
|
-
var main_b = /* @__PURE__ */ main_u((e, t)=>{
|
|
2417
|
-
main_d("fs");
|
|
2418
|
-
var n;
|
|
2419
|
-
n = "win32" === process.platform || global.TESTING_WINDOWS ? main_v() : main_y();
|
|
2420
|
-
t.exports = r;
|
|
2421
|
-
r.sync = i;
|
|
2422
|
-
function r(e, t, i) {
|
|
2423
|
-
if ("function" == typeof t) {
|
|
2424
|
-
i = t;
|
|
2425
|
-
t = {};
|
|
2426
|
-
}
|
|
2427
|
-
if (!i) {
|
|
2428
|
-
if ("function" != typeof Promise) throw new TypeError("callback not provided");
|
|
2429
|
-
return new Promise(function(n, i) {
|
|
2430
|
-
r(e, t || {}, function(e, t) {
|
|
2431
|
-
if (e) i(e);
|
|
2432
|
-
else n(t);
|
|
2433
|
-
});
|
|
2434
|
-
});
|
|
2435
|
-
}
|
|
2436
|
-
n(e, t || {}, function(e, n) {
|
|
2437
|
-
if (e) {
|
|
2438
|
-
if ("EACCES" === e.code || t && t.ignoreErrors) {
|
|
2439
|
-
e = null;
|
|
2440
|
-
n = false;
|
|
2441
|
-
}
|
|
2442
|
-
}
|
|
2443
|
-
i(e, n);
|
|
2444
|
-
});
|
|
2445
|
-
}
|
|
2446
|
-
function i(e, t) {
|
|
2367
|
+
const main_x = /([()\][%!^"`<>&|;, *?])/g;
|
|
2368
|
+
const main_S = /^#!\s*(.+)/;
|
|
2369
|
+
const main_C = /\.(?:com|exe)$/i;
|
|
2370
|
+
const main_w = /node_modules[\\/]\.bin[\\/][^\\/]+\.cmd$/i;
|
|
2371
|
+
const main_T = "win32" === process.platform;
|
|
2372
|
+
const main_E = [
|
|
2373
|
+
".EXE",
|
|
2374
|
+
".CMD",
|
|
2375
|
+
".BAT",
|
|
2376
|
+
".COM"
|
|
2377
|
+
];
|
|
2378
|
+
function main_D(e, t = [], n = {}) {
|
|
2379
|
+
if (true === n.shell || !main_T) return {
|
|
2380
|
+
command: e,
|
|
2381
|
+
args: t,
|
|
2382
|
+
options: n
|
|
2383
|
+
};
|
|
2384
|
+
let i = main_O(e, n);
|
|
2385
|
+
let a = null;
|
|
2386
|
+
if (null !== i) {
|
|
2387
|
+
const e = 150;
|
|
2388
|
+
const t = Buffer.alloc(e);
|
|
2389
|
+
let n = null;
|
|
2447
2390
|
try {
|
|
2448
|
-
|
|
2449
|
-
|
|
2450
|
-
|
|
2451
|
-
|
|
2452
|
-
}
|
|
2453
|
-
|
|
2454
|
-
|
|
2455
|
-
|
|
2456
|
-
|
|
2457
|
-
|
|
2458
|
-
|
|
2459
|
-
|
|
2460
|
-
|
|
2461
|
-
|
|
2462
|
-
|
|
2463
|
-
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
] : [
|
|
2468
|
-
...n ? [
|
|
2469
|
-
process.cwd()
|
|
2470
|
-
] : [],
|
|
2471
|
-
...(t.path || process.env.PATH || "").split(r)
|
|
2391
|
+
n = openSync(i, "r");
|
|
2392
|
+
readSync(n, t, 0, e, 0);
|
|
2393
|
+
} catch {} finally{
|
|
2394
|
+
if (null !== n) closeSync(n);
|
|
2395
|
+
}
|
|
2396
|
+
const o = t.toString().match(main_S);
|
|
2397
|
+
if (null !== o) {
|
|
2398
|
+
const e = o[1].trim();
|
|
2399
|
+
const t = e.indexOf(" ");
|
|
2400
|
+
const n = -1 !== t ? e.slice(0, t) : e;
|
|
2401
|
+
const i = -1 !== t ? e.slice(t + 1) : "";
|
|
2402
|
+
const s = basename(n);
|
|
2403
|
+
a = "env" === s ? i || null : s;
|
|
2404
|
+
}
|
|
2405
|
+
}
|
|
2406
|
+
if (null !== a && null !== i) {
|
|
2407
|
+
t = [
|
|
2408
|
+
i,
|
|
2409
|
+
...t
|
|
2472
2410
|
];
|
|
2473
|
-
|
|
2474
|
-
|
|
2475
|
-
|
|
2411
|
+
e = a;
|
|
2412
|
+
i = main_O(e, n);
|
|
2413
|
+
}
|
|
2414
|
+
if (null === i || !main_C.test(i)) {
|
|
2415
|
+
const r = null !== i && main_w.test(i);
|
|
2416
|
+
e = external_node_path_normalize(e);
|
|
2417
|
+
e = e.replace(main_x, "^$1");
|
|
2418
|
+
t = t.map((e)=>{
|
|
2419
|
+
e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
2420
|
+
e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
2421
|
+
e = `"${e}"`;
|
|
2422
|
+
e = e.replace(main_x, "^$1");
|
|
2423
|
+
if (r) e = e.replace(main_x, "^$1");
|
|
2424
|
+
return e;
|
|
2425
|
+
});
|
|
2426
|
+
t = [
|
|
2427
|
+
"/d",
|
|
2428
|
+
"/s",
|
|
2429
|
+
"/c",
|
|
2430
|
+
`"${[
|
|
2431
|
+
e,
|
|
2432
|
+
...t
|
|
2433
|
+
].join(" ")}"`
|
|
2476
2434
|
];
|
|
2477
|
-
|
|
2478
|
-
|
|
2479
|
-
|
|
2480
|
-
|
|
2481
|
-
pathEnv: a,
|
|
2482
|
-
pathExt: s,
|
|
2483
|
-
pathExtExe: o
|
|
2435
|
+
e = n.env?.comspec ?? "cmd.exe";
|
|
2436
|
+
n = {
|
|
2437
|
+
...n,
|
|
2438
|
+
windowsVerbatimArguments: true
|
|
2484
2439
|
};
|
|
2485
|
-
};
|
|
2486
|
-
const c = (e, t, n)=>{
|
|
2487
|
-
if ("function" == typeof t) {
|
|
2488
|
-
n = t;
|
|
2489
|
-
t = {};
|
|
2490
|
-
}
|
|
2491
|
-
if (!t) t = {};
|
|
2492
|
-
const { pathEnv: i, pathExt: c, pathExtExe: l } = s(e, t);
|
|
2493
|
-
const u = [];
|
|
2494
|
-
const d = (n)=>new Promise((a, s)=>{
|
|
2495
|
-
if (n === i.length) return t.all && u.length ? a(u) : s(o(e));
|
|
2496
|
-
const c = i[n];
|
|
2497
|
-
const l = /^".*"$/.test(c) ? c.slice(1, -1) : c;
|
|
2498
|
-
const d = r.join(l, e);
|
|
2499
|
-
a(f(!l && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d, n, 0));
|
|
2500
|
-
});
|
|
2501
|
-
const f = (e, n, r)=>new Promise((i, o)=>{
|
|
2502
|
-
if (r === c.length) return i(d(n + 1));
|
|
2503
|
-
const s = c[r];
|
|
2504
|
-
a(e + s, {
|
|
2505
|
-
pathExt: l
|
|
2506
|
-
}, (a, o)=>{
|
|
2507
|
-
if (!a && o) if (!t.all) return i(e + s);
|
|
2508
|
-
else u.push(e + s);
|
|
2509
|
-
return i(f(e, n, r + 1));
|
|
2510
|
-
});
|
|
2511
|
-
});
|
|
2512
|
-
return n ? d(0).then((e)=>n(null, e), n) : d(0);
|
|
2513
|
-
};
|
|
2514
|
-
const l = (e, t)=>{
|
|
2515
|
-
t = t || {};
|
|
2516
|
-
const { pathEnv: n, pathExt: i, pathExtExe: c } = s(e, t);
|
|
2517
|
-
const l = [];
|
|
2518
|
-
for(let o = 0; o < n.length; o++){
|
|
2519
|
-
const s = n[o];
|
|
2520
|
-
const u = /^".*"$/.test(s) ? s.slice(1, -1) : s;
|
|
2521
|
-
const d = r.join(u, e);
|
|
2522
|
-
const f = !u && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d : d;
|
|
2523
|
-
for(let e = 0; e < i.length; e++){
|
|
2524
|
-
const n = f + i[e];
|
|
2525
|
-
try {
|
|
2526
|
-
if (a.sync(n, {
|
|
2527
|
-
pathExt: c
|
|
2528
|
-
})) if (!t.all) return n;
|
|
2529
|
-
else l.push(n);
|
|
2530
|
-
} catch (e) {}
|
|
2531
|
-
}
|
|
2532
|
-
}
|
|
2533
|
-
if (t.all && l.length) return l;
|
|
2534
|
-
if (t.nothrow) return null;
|
|
2535
|
-
throw o(e);
|
|
2536
|
-
};
|
|
2537
|
-
t.exports = c;
|
|
2538
|
-
c.sync = l;
|
|
2539
|
-
});
|
|
2540
|
-
var main_S = /* @__PURE__ */ main_u((e, t)=>{
|
|
2541
|
-
const n = (e = {})=>{
|
|
2542
|
-
const t = e.env || process.env;
|
|
2543
|
-
if ("win32" !== (e.platform || process.platform)) return "PATH";
|
|
2544
|
-
return Object.keys(t).reverse().find((e)=>"PATH" === e.toUpperCase()) || "Path";
|
|
2545
|
-
};
|
|
2546
|
-
t.exports = n;
|
|
2547
|
-
t.exports.default = n;
|
|
2548
|
-
});
|
|
2549
|
-
var main_C = /* @__PURE__ */ main_u((e, t)=>{
|
|
2550
|
-
const n = main_d("path");
|
|
2551
|
-
const r = main_x();
|
|
2552
|
-
const i = main_S();
|
|
2553
|
-
function a(e, t) {
|
|
2554
|
-
const a = e.options.env || process.env;
|
|
2555
|
-
const o = process.cwd();
|
|
2556
|
-
const s = null != e.options.cwd;
|
|
2557
|
-
const c = s && void 0 !== process.chdir && !process.chdir.disabled;
|
|
2558
|
-
if (c) try {
|
|
2559
|
-
process.chdir(e.options.cwd);
|
|
2560
|
-
} catch (e) {}
|
|
2561
|
-
let l;
|
|
2562
|
-
try {
|
|
2563
|
-
l = r.sync(e.command, {
|
|
2564
|
-
path: a[i({
|
|
2565
|
-
env: a
|
|
2566
|
-
})],
|
|
2567
|
-
pathExt: t ? n.delimiter : void 0
|
|
2568
|
-
});
|
|
2569
|
-
} catch (e) {} finally{
|
|
2570
|
-
if (c) process.chdir(o);
|
|
2571
|
-
}
|
|
2572
|
-
if (l) l = n.resolve(s ? e.options.cwd : "", l);
|
|
2573
|
-
return l;
|
|
2574
|
-
}
|
|
2575
|
-
function o(e) {
|
|
2576
|
-
return a(e) || a(e, true);
|
|
2577
2440
|
}
|
|
2578
|
-
|
|
2579
|
-
|
|
2580
|
-
|
|
2581
|
-
|
|
2582
|
-
function r(e) {
|
|
2583
|
-
e = e.replace(n, "^$1");
|
|
2584
|
-
return e;
|
|
2585
|
-
}
|
|
2586
|
-
function i(e, t) {
|
|
2587
|
-
e = `${e}`;
|
|
2588
|
-
e = e.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
|
|
2589
|
-
e = e.replace(/(?=(\\+?)?)\1$/, "$1$1");
|
|
2590
|
-
e = `"${e}"`;
|
|
2591
|
-
e = e.replace(n, "^$1");
|
|
2592
|
-
if (t) e = e.replace(n, "^$1");
|
|
2593
|
-
return e;
|
|
2594
|
-
}
|
|
2595
|
-
t.exports.command = r;
|
|
2596
|
-
t.exports.argument = i;
|
|
2597
|
-
});
|
|
2598
|
-
var main_T = /* @__PURE__ */ main_u((e, t)=>{
|
|
2599
|
-
t.exports = /^#!(.*)/;
|
|
2600
|
-
});
|
|
2601
|
-
var main_E = /* @__PURE__ */ main_u((e, t)=>{
|
|
2602
|
-
const n = main_T();
|
|
2603
|
-
t.exports = (e = "")=>{
|
|
2604
|
-
const t = e.match(n);
|
|
2605
|
-
if (!t) return null;
|
|
2606
|
-
const [r, i] = t[0].replace(/#! ?/, "").split(" ");
|
|
2607
|
-
const a = r.split("/").pop();
|
|
2608
|
-
if ("env" === a) return i;
|
|
2609
|
-
return i ? `${a} ${i}` : a;
|
|
2441
|
+
return {
|
|
2442
|
+
command: e,
|
|
2443
|
+
args: t,
|
|
2444
|
+
options: n
|
|
2610
2445
|
};
|
|
2611
|
-
}
|
|
2612
|
-
|
|
2613
|
-
const
|
|
2614
|
-
const
|
|
2615
|
-
|
|
2616
|
-
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
|
|
2620
|
-
|
|
2621
|
-
|
|
2622
|
-
|
|
2623
|
-
|
|
2624
|
-
|
|
2625
|
-
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
|
|
2629
|
-
|
|
2630
|
-
|
|
2631
|
-
|
|
2632
|
-
const a = main_D();
|
|
2633
|
-
const o = "win32" === process.platform;
|
|
2634
|
-
const s = /\.(?:com|exe)$/i;
|
|
2635
|
-
const c = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
2636
|
-
function l(e) {
|
|
2637
|
-
e.file = r(e);
|
|
2638
|
-
const t = e.file && a(e.file);
|
|
2639
|
-
if (t) {
|
|
2640
|
-
e.args.unshift(e.file);
|
|
2641
|
-
e.command = t;
|
|
2642
|
-
return r(e);
|
|
2643
|
-
}
|
|
2644
|
-
return e.file;
|
|
2645
|
-
}
|
|
2646
|
-
function u(e) {
|
|
2647
|
-
if (!o) return e;
|
|
2648
|
-
const t = l(e);
|
|
2649
|
-
const r = !s.test(t);
|
|
2650
|
-
if (e.options.forceShell || r) {
|
|
2651
|
-
const r = c.test(t);
|
|
2652
|
-
e.command = n.normalize(e.command);
|
|
2653
|
-
e.command = i.command(e.command);
|
|
2654
|
-
e.args = e.args.map((e)=>i.argument(e, r));
|
|
2655
|
-
e.args = [
|
|
2656
|
-
"/d",
|
|
2657
|
-
"/s",
|
|
2658
|
-
"/c",
|
|
2659
|
-
`"${[
|
|
2660
|
-
e.command
|
|
2661
|
-
].concat(e.args).join(" ")}"`
|
|
2662
|
-
];
|
|
2663
|
-
e.command = process.env.comspec || "cmd.exe";
|
|
2664
|
-
e.options.windowsVerbatimArguments = true;
|
|
2665
|
-
}
|
|
2666
|
-
return e;
|
|
2667
|
-
}
|
|
2668
|
-
function f(e, t, n) {
|
|
2669
|
-
if (t && !Array.isArray(t)) {
|
|
2670
|
-
n = t;
|
|
2671
|
-
t = null;
|
|
2672
|
-
}
|
|
2673
|
-
t = t ? t.slice(0) : [];
|
|
2674
|
-
n = Object.assign({}, n);
|
|
2675
|
-
const r = {
|
|
2676
|
-
command: e,
|
|
2677
|
-
args: t,
|
|
2678
|
-
options: n,
|
|
2679
|
-
file: void 0,
|
|
2680
|
-
original: {
|
|
2681
|
-
command: e,
|
|
2682
|
-
args: t
|
|
2683
|
-
}
|
|
2684
|
-
};
|
|
2685
|
-
return n.shell ? r : u(r);
|
|
2686
|
-
}
|
|
2687
|
-
t.exports = f;
|
|
2688
|
-
});
|
|
2689
|
-
var main_k = /* @__PURE__ */ main_u((e, t)=>{
|
|
2690
|
-
const n = "win32" === process.platform;
|
|
2691
|
-
function r(e, t) {
|
|
2692
|
-
return Object.assign(/* @__PURE__ */ new Error(`${t} ${e.command} ENOENT`), {
|
|
2693
|
-
code: "ENOENT",
|
|
2694
|
-
errno: "ENOENT",
|
|
2695
|
-
syscall: `${t} ${e.command}`,
|
|
2696
|
-
path: e.command,
|
|
2697
|
-
spawnargs: e.args
|
|
2698
|
-
});
|
|
2699
|
-
}
|
|
2700
|
-
function i(e, t) {
|
|
2701
|
-
if (!n) return;
|
|
2702
|
-
const r = e.emit;
|
|
2703
|
-
e.emit = function(n, i) {
|
|
2704
|
-
if ("exit" === n) {
|
|
2705
|
-
const n = a(i, t);
|
|
2706
|
-
if (n) return r.call(e, "error", n);
|
|
2707
|
-
}
|
|
2708
|
-
return r.apply(e, arguments);
|
|
2709
|
-
};
|
|
2710
|
-
}
|
|
2711
|
-
function a(e, t) {
|
|
2712
|
-
if (n && 1 === e && !t.file) return r(t.original, "spawn");
|
|
2713
|
-
return null;
|
|
2714
|
-
}
|
|
2715
|
-
function o(e, t) {
|
|
2716
|
-
if (n && 1 === e && !t.file) return r(t.original, "spawnSync");
|
|
2717
|
-
return null;
|
|
2446
|
+
}
|
|
2447
|
+
function main_O(e, t) {
|
|
2448
|
+
const r = (t.cwd ?? external_node_process_cwd()).toString();
|
|
2449
|
+
const a = t.env ?? process.env;
|
|
2450
|
+
const o = main_(a).value;
|
|
2451
|
+
const c = e.includes("/") || e.includes("\\") ? [
|
|
2452
|
+
""
|
|
2453
|
+
] : [
|
|
2454
|
+
r,
|
|
2455
|
+
...o.split(delimiter)
|
|
2456
|
+
];
|
|
2457
|
+
const l = a.PATHEXT ? a.PATHEXT.split(delimiter) : main_E;
|
|
2458
|
+
if (e.includes(".") && "" !== l[0]) l.unshift("");
|
|
2459
|
+
for (const t of c){
|
|
2460
|
+
const n = resolve(r, t.startsWith("\"") && t.endsWith("\"") && t.length > 1 ? t.slice(1, -1) : t, e);
|
|
2461
|
+
for (const e of l){
|
|
2462
|
+
const t = n + e;
|
|
2463
|
+
try {
|
|
2464
|
+
if (statSync(t).isFile()) return t;
|
|
2465
|
+
} catch {}
|
|
2466
|
+
}
|
|
2718
2467
|
}
|
|
2719
|
-
|
|
2720
|
-
|
|
2721
|
-
|
|
2722
|
-
|
|
2723
|
-
|
|
2724
|
-
};
|
|
2725
|
-
});
|
|
2726
|
-
var main_A = /* @__PURE__ */ main_u((e, t)=>{
|
|
2727
|
-
const n = main_d("child_process");
|
|
2728
|
-
const r = main_O();
|
|
2729
|
-
const i = main_k();
|
|
2730
|
-
function a(e, t, a) {
|
|
2731
|
-
const o = r(e, t, a);
|
|
2732
|
-
const s = n.spawn(o.command, o.args, o.options);
|
|
2733
|
-
i.hookChildProcess(s, o);
|
|
2734
|
-
return s;
|
|
2735
|
-
}
|
|
2736
|
-
function o(e, t, a) {
|
|
2737
|
-
const o = r(e, t, a);
|
|
2738
|
-
const s = n.spawnSync(o.command, o.args, o.options);
|
|
2739
|
-
s.error = s.error || i.verifyENOENTSync(s.status, o);
|
|
2740
|
-
return s;
|
|
2741
|
-
}
|
|
2742
|
-
t.exports = a;
|
|
2743
|
-
t.exports.spawn = a;
|
|
2744
|
-
t.exports.sync = o;
|
|
2745
|
-
t.exports._parse = r;
|
|
2746
|
-
t.exports._enoent = i;
|
|
2747
|
-
});
|
|
2748
|
-
var main_j = main_A();
|
|
2749
|
-
var main_M = class extends Error {
|
|
2468
|
+
return null;
|
|
2469
|
+
}
|
|
2470
|
+
var main_k = class extends Error {
|
|
2471
|
+
result;
|
|
2472
|
+
output;
|
|
2750
2473
|
get exitCode() {
|
|
2751
2474
|
if (null !== this.result.exitCode) return this.result.exitCode;
|
|
2752
2475
|
}
|
|
@@ -2756,14 +2479,14 @@ var main_M = class extends Error {
|
|
|
2756
2479
|
this.output = t;
|
|
2757
2480
|
}
|
|
2758
2481
|
};
|
|
2759
|
-
const
|
|
2482
|
+
const main_j = {
|
|
2760
2483
|
timeout: void 0,
|
|
2761
2484
|
persist: false
|
|
2762
2485
|
};
|
|
2763
|
-
const
|
|
2486
|
+
const main_N = {
|
|
2764
2487
|
windowsHide: true
|
|
2765
2488
|
};
|
|
2766
|
-
function
|
|
2489
|
+
function main_P(e) {
|
|
2767
2490
|
const t = new AbortController();
|
|
2768
2491
|
for (const n of e){
|
|
2769
2492
|
if (n.aborted) {
|
|
@@ -2779,14 +2502,14 @@ function main_L(e) {
|
|
|
2779
2502
|
}
|
|
2780
2503
|
return t.signal;
|
|
2781
2504
|
}
|
|
2782
|
-
async function
|
|
2505
|
+
async function main_F(e) {
|
|
2783
2506
|
let t = "";
|
|
2784
2507
|
try {
|
|
2785
2508
|
for await (const n of e)t += n.toString();
|
|
2786
2509
|
} catch {}
|
|
2787
2510
|
return t;
|
|
2788
2511
|
}
|
|
2789
|
-
var
|
|
2512
|
+
var main_I = class {
|
|
2790
2513
|
_process;
|
|
2791
2514
|
_aborted = false;
|
|
2792
2515
|
_options;
|
|
@@ -2806,7 +2529,7 @@ var main_z = class {
|
|
|
2806
2529
|
}
|
|
2807
2530
|
constructor(e, t, n){
|
|
2808
2531
|
this._options = {
|
|
2809
|
-
...
|
|
2532
|
+
...main_j,
|
|
2810
2533
|
...n
|
|
2811
2534
|
};
|
|
2812
2535
|
this._command = e;
|
|
@@ -2825,7 +2548,7 @@ var main_z = class {
|
|
|
2825
2548
|
return this._process?.killed === true;
|
|
2826
2549
|
}
|
|
2827
2550
|
pipe(e, t, n) {
|
|
2828
|
-
return
|
|
2551
|
+
return main_z(e, t, {
|
|
2829
2552
|
...n,
|
|
2830
2553
|
stdin: this
|
|
2831
2554
|
});
|
|
@@ -2836,7 +2559,7 @@ var main_z = class {
|
|
|
2836
2559
|
const t = [];
|
|
2837
2560
|
if (this._streamErr) t.push(this._streamErr);
|
|
2838
2561
|
if (this._streamOut) t.push(this._streamOut);
|
|
2839
|
-
const n =
|
|
2562
|
+
const n = main_b(t);
|
|
2840
2563
|
const r = node_readline.createInterface({
|
|
2841
2564
|
input: n
|
|
2842
2565
|
});
|
|
@@ -2844,14 +2567,14 @@ var main_z = class {
|
|
|
2844
2567
|
await this._processClosed;
|
|
2845
2568
|
e.removeAllListeners();
|
|
2846
2569
|
if (this._thrownError) throw this._thrownError;
|
|
2847
|
-
if (this._options?.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new
|
|
2570
|
+
if (this._options?.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new main_k(this);
|
|
2848
2571
|
}
|
|
2849
2572
|
async _waitForOutput() {
|
|
2850
2573
|
const e = this._process;
|
|
2851
2574
|
if (!e) throw new Error("No process was started");
|
|
2852
2575
|
const [t, n] = await Promise.all([
|
|
2853
|
-
this._streamOut ?
|
|
2854
|
-
this._streamErr ?
|
|
2576
|
+
this._streamOut ? main_F(this._streamOut) : "",
|
|
2577
|
+
this._streamErr ? main_F(this._streamErr) : ""
|
|
2855
2578
|
]);
|
|
2856
2579
|
await this._processClosed;
|
|
2857
2580
|
const { stdin: r } = this._options;
|
|
@@ -2863,7 +2586,7 @@ var main_z = class {
|
|
|
2863
2586
|
stdout: t,
|
|
2864
2587
|
exitCode: this.exitCode
|
|
2865
2588
|
};
|
|
2866
|
-
if (this._options.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new
|
|
2589
|
+
if (this._options.throwOnError && 0 !== this.exitCode && void 0 !== this.exitCode) throw new main_k(this, i);
|
|
2867
2590
|
return i;
|
|
2868
2591
|
}
|
|
2869
2592
|
then(e, t) {
|
|
@@ -2872,20 +2595,20 @@ var main_z = class {
|
|
|
2872
2595
|
_streamOut;
|
|
2873
2596
|
_streamErr;
|
|
2874
2597
|
spawn() {
|
|
2875
|
-
const
|
|
2876
|
-
const
|
|
2598
|
+
const t = external_node_process_cwd();
|
|
2599
|
+
const r = this._options;
|
|
2877
2600
|
const i = {
|
|
2878
|
-
...
|
|
2879
|
-
...
|
|
2601
|
+
...main_N,
|
|
2602
|
+
...r.nodeOptions
|
|
2880
2603
|
};
|
|
2881
2604
|
const a = [];
|
|
2882
2605
|
this._resetState();
|
|
2883
|
-
if (void 0 !==
|
|
2884
|
-
if (void 0 !==
|
|
2885
|
-
if (true ===
|
|
2886
|
-
if (a.length > 0) i.signal =
|
|
2887
|
-
i.env =
|
|
2888
|
-
const o = (
|
|
2606
|
+
if (void 0 !== r.timeout) a.push(AbortSignal.timeout(r.timeout));
|
|
2607
|
+
if (void 0 !== r.signal) a.push(r.signal);
|
|
2608
|
+
if (true === r.persist) i.detached = true;
|
|
2609
|
+
if (a.length > 0) i.signal = main_P(a);
|
|
2610
|
+
i.env = main_y(t, i.env, r.nodePath);
|
|
2611
|
+
const o = main_D(this._command, this._args, i);
|
|
2889
2612
|
const s = spawn(o.command, o.args, o.options);
|
|
2890
2613
|
if (s.stderr) this._streamErr = s.stderr;
|
|
2891
2614
|
if (s.stdout) this._streamOut = s.stdout;
|
|
@@ -2893,7 +2616,7 @@ var main_z = class {
|
|
|
2893
2616
|
s.once("error", this._onError);
|
|
2894
2617
|
s.once("close", this._onClose);
|
|
2895
2618
|
if (s.stdin) {
|
|
2896
|
-
const { stdin: e } =
|
|
2619
|
+
const { stdin: e } = r;
|
|
2897
2620
|
if ("string" == typeof e) s.stdin.end(e);
|
|
2898
2621
|
else e?.process?.stdout?.pipe(s.stdin);
|
|
2899
2622
|
}
|
|
@@ -2916,12 +2639,12 @@ var main_z = class {
|
|
|
2916
2639
|
if (this._resolveClose) this._resolveClose();
|
|
2917
2640
|
};
|
|
2918
2641
|
};
|
|
2919
|
-
const
|
|
2920
|
-
const r = new
|
|
2642
|
+
const main_R = (e, t, n)=>{
|
|
2643
|
+
const r = new main_I(e, t, n);
|
|
2921
2644
|
r.spawn();
|
|
2922
2645
|
return r;
|
|
2923
2646
|
};
|
|
2924
|
-
const
|
|
2647
|
+
const main_z = main_R;
|
|
2925
2648
|
const NPM_TEMPLATE_PREFIX = 'npm:';
|
|
2926
2649
|
const VALID_NPM_NAME = /^(@[\w.-]+\/)?[\w.-]+$/;
|
|
2927
2650
|
const VALID_NPM_VERSION = /^[\w.\-+^~>=<* ]+$/;
|
|
@@ -3019,7 +2742,7 @@ function cancelAndExit() {
|
|
|
3019
2742
|
process.exit(0);
|
|
3020
2743
|
}
|
|
3021
2744
|
function checkCancel(value) {
|
|
3022
|
-
if (
|
|
2745
|
+
if (q(value)) cancelAndExit();
|
|
3023
2746
|
return value;
|
|
3024
2747
|
}
|
|
3025
2748
|
function formatProjectName(input) {
|
|
@@ -3206,7 +2929,7 @@ async function runCommand(command, cwd, packageManager) {
|
|
|
3206
2929
|
if (replacement) command = command.replace('npm create ', replacement).replace(' -- --', ' --');
|
|
3207
2930
|
if ('yarn' === packageManager) command = command.replace('@latest', '');
|
|
3208
2931
|
}
|
|
3209
|
-
const result = await
|
|
2932
|
+
const result = await main_R(command, [], {
|
|
3210
2933
|
nodeOptions: {
|
|
3211
2934
|
shell: true,
|
|
3212
2935
|
stdio: 'inherit',
|
|
@@ -3242,10 +2965,10 @@ async function runSkillCommand(skills, cwd) {
|
|
|
3242
2965
|
dist_R.info(`Running skill install command: ${color.dim(command)}`);
|
|
3243
2966
|
const skillLabel = skills.map((skill)=>skill.value).join(', ');
|
|
3244
2967
|
const skillNoun = 1 === skills.length ? 'skill' : 'skills';
|
|
3245
|
-
const installationTaskLog =
|
|
2968
|
+
const installationTaskLog = Oe({
|
|
3246
2969
|
title: `Installing ${skillNoun} ${skillLabel}`
|
|
3247
2970
|
});
|
|
3248
|
-
const proc =
|
|
2971
|
+
const proc = main_R('npx', args, {
|
|
3249
2972
|
nodeOptions: {
|
|
3250
2973
|
cwd,
|
|
3251
2974
|
stdio: 'pipe'
|
|
@@ -3287,7 +3010,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
3287
3010
|
packageManager
|
|
3288
3011
|
};
|
|
3289
3012
|
if (!version) version = (await readPackageJson(root)).version;
|
|
3290
|
-
const projectName = argv.dir ?? checkCancel(await
|
|
3013
|
+
const projectName = argv.dir ?? checkCancel(await Pe({
|
|
3291
3014
|
message: 'Project name or path',
|
|
3292
3015
|
placeholder: `${name.toLowerCase()}-project`,
|
|
3293
3016
|
defaultValue: `${name.toLowerCase()}-project`,
|
|
@@ -3300,7 +3023,7 @@ async function create({ name, root, templates, skipFiles, getTemplateName, mapES
|
|
|
3300
3023
|
const packageName = argv.packageName || formatted.packageName;
|
|
3301
3024
|
const distFolder = node_path.isAbsolute(targetDir) ? targetDir : node_path.join(cwd, targetDir);
|
|
3302
3025
|
if (!argv.override && node_fs.existsSync(distFolder) && !isEmptyDir(distFolder)) {
|
|
3303
|
-
const option = checkCancel(await
|
|
3026
|
+
const option = checkCancel(await xe({
|
|
3304
3027
|
message: `"${targetDir}" is not empty, please choose:`,
|
|
3305
3028
|
options: [
|
|
3306
3029
|
{
|
|
@@ -3603,4 +3326,4 @@ function collectAgentsFiles(agentsMdSearchDirs) {
|
|
|
3603
3326
|
}
|
|
3604
3327
|
return agentsFiles;
|
|
3605
3328
|
}
|
|
3606
|
-
export { At as autocomplete, BUILTIN_TOOLS,
|
|
3329
|
+
export { At as autocomplete, BUILTIN_TOOLS, Pe as text, checkCancel, collectAgentsFiles, copyFolder, create, isNpmTemplate, mergeAgentsFiles, mergePackageJson, pe as groupMultiselect, resolveCustomTemplate, resolveNpmTemplate, sanitizeCacheKey, ve as multiselect, xe as select };
|