sv 0.11.2 → 0.11.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/add-BWQarWDB.mjs +7000 -0
- package/dist/add-nRRWTjzp.d.mts +35 -0
- package/dist/bin.mjs +25 -1845
- package/dist/{index-7xp7FWpU.d.mts → core-CnPhgWST.d.mts} +294 -46
- package/dist/lib/core.d.mts +2 -0
- package/dist/lib/core.mjs +3 -0
- package/dist/lib/index.d.mts +16 -0
- package/dist/lib/index.mjs +4 -4
- package/dist/lib/testing.d.mts +108 -0
- package/dist/lib/testing.mjs +970 -927
- package/dist/{package-manager-CySZrSUa.mjs → package-manager-DkCPtZM1.mjs} +219 -1328
- package/dist/shared.json +30 -4
- package/dist/templates/addon/assets/DOT-gitignore +27 -0
- package/dist/templates/addon/assets/src/index.js +52 -0
- package/dist/templates/addon/assets/tests/addon.test.js +50 -0
- package/dist/templates/addon/assets/tests/setup/global.js +14 -0
- package/dist/templates/addon/assets/tests/setup/suite.js +130 -0
- package/dist/templates/addon/assets/vitest.config.js +16 -0
- package/dist/templates/addon/files.types=checkjs.json +1 -0
- package/dist/templates/addon/files.types=none.json +1 -0
- package/dist/templates/addon/files.types=typescript.json +1 -0
- package/dist/templates/addon/meta.json +4 -0
- package/dist/templates/addon/package.json +32 -0
- package/dist/templates/demo/files.types=checkjs.json +5 -5
- package/dist/templates/demo/files.types=none.json +5 -5
- package/dist/templates/demo/files.types=typescript.json +5 -5
- 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/{core-D715tamU.mjs → utils-DjBRIDJG.mjs} +26494 -25089
- package/package.json +7 -7
- package/dist/index.d.mts +0 -2
- package/dist/index2.d.mts +0 -65
- package/dist/lib/core/index.mjs +0 -4
- package/dist/official-P5OKi7QM.mjs +0 -2586
- package/dist/testing.d.mts +0 -50
|
@@ -1,14 +1,10 @@
|
|
|
1
1
|
import { i as __toESM, r as __require, t as __commonJSMin } from "./chunk-BjMGrMj9.mjs";
|
|
2
|
-
import {
|
|
2
|
+
import { Tt as Vu, dt as constructCommand, et as isVersionUnsupportedBelow, l as parse, lt as q, n as commonFilePaths, pt as De, t as color, ut as COMMANDS, wt as ze, xt as Ze } from "./utils-DjBRIDJG.mjs";
|
|
3
3
|
import { createRequire } from "node:module";
|
|
4
4
|
import fs, { existsSync } from "node:fs";
|
|
5
|
-
import path, {
|
|
5
|
+
import path, { dirname, isAbsolute, join, resolve } from "node:path";
|
|
6
6
|
import { fileURLToPath } from "node:url";
|
|
7
|
-
import
|
|
8
|
-
import { spawn } from "node:child_process";
|
|
9
|
-
import process$1, { cwd } from "node:process";
|
|
10
|
-
import { PassThrough } from "node:stream";
|
|
11
|
-
import c from "node:readline";
|
|
7
|
+
import process from "node:process";
|
|
12
8
|
import fs$1 from "node:fs/promises";
|
|
13
9
|
|
|
14
10
|
//#region lib/create/utils.ts
|
|
@@ -21,17 +17,21 @@ function mkdirp(dir) {
|
|
|
21
17
|
throw e;
|
|
22
18
|
}
|
|
23
19
|
}
|
|
24
|
-
function identity(x
|
|
25
|
-
return x
|
|
20
|
+
function identity(x) {
|
|
21
|
+
return x;
|
|
26
22
|
}
|
|
27
|
-
function
|
|
23
|
+
function replace(contents, kv$1) {
|
|
24
|
+
for (const [key, value] of Object.entries(kv$1)) contents = contents.replaceAll(key, value);
|
|
25
|
+
return contents;
|
|
26
|
+
}
|
|
27
|
+
function copy(from$1, to, rename = identity, kv$1 = {}) {
|
|
28
28
|
if (!fs.existsSync(from$1)) return;
|
|
29
29
|
if (fs.statSync(from$1).isDirectory()) fs.readdirSync(from$1).forEach((file) => {
|
|
30
|
-
copy(path.join(from$1, file), path.join(to, rename(file)));
|
|
30
|
+
copy(path.join(from$1, file), path.join(to, rename(file)), rename, kv$1);
|
|
31
31
|
});
|
|
32
32
|
else {
|
|
33
33
|
mkdirp(path.dirname(to));
|
|
34
|
-
fs.
|
|
34
|
+
fs.writeFileSync(to, replace(fs.readFileSync(from$1, "utf-8"), kv$1));
|
|
35
35
|
}
|
|
36
36
|
}
|
|
37
37
|
function dist(path$2) {
|
|
@@ -44,1022 +44,6 @@ function getSharedFiles() {
|
|
|
44
44
|
return files;
|
|
45
45
|
}
|
|
46
46
|
|
|
47
|
-
//#endregion
|
|
48
|
-
//#region ../../node_modules/.pnpm/tinyexec@1.0.2/node_modules/tinyexec/dist/main.js
|
|
49
|
-
var l = Object.create;
|
|
50
|
-
var u = Object.defineProperty;
|
|
51
|
-
var d = Object.getOwnPropertyDescriptor;
|
|
52
|
-
var f = Object.getOwnPropertyNames;
|
|
53
|
-
var p = Object.getPrototypeOf;
|
|
54
|
-
var m = Object.prototype.hasOwnProperty;
|
|
55
|
-
var h = (e, t) => () => (t || e((t = { exports: {} }).exports, t), t.exports);
|
|
56
|
-
var g = (e, t, n, r) => {
|
|
57
|
-
if (t && typeof t === "object" || typeof t === "function") for (var i = f(t), a = 0, o = i.length, s; a < o; a++) {
|
|
58
|
-
s = i[a];
|
|
59
|
-
if (!m.call(e, s) && s !== n) u(e, s, {
|
|
60
|
-
get: ((e$1) => t[e$1]).bind(null, s),
|
|
61
|
-
enumerable: !(r = d(t, s)) || r.enumerable
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
return e;
|
|
65
|
-
};
|
|
66
|
-
var _ = (e, t, n) => (n = e != null ? l(p(e)) : {}, g(t || !e || !e.__esModule ? u(n, "default", {
|
|
67
|
-
value: e,
|
|
68
|
-
enumerable: true
|
|
69
|
-
}) : n, e));
|
|
70
|
-
var v = /* @__PURE__ */ createRequire$1(import.meta.url);
|
|
71
|
-
const y = /^path$/i;
|
|
72
|
-
const b = {
|
|
73
|
-
key: "PATH",
|
|
74
|
-
value: ""
|
|
75
|
-
};
|
|
76
|
-
function x(e) {
|
|
77
|
-
for (const t in e) {
|
|
78
|
-
if (!Object.prototype.hasOwnProperty.call(e, t) || !y.test(t)) continue;
|
|
79
|
-
const n = e[t];
|
|
80
|
-
if (!n) return b;
|
|
81
|
-
return {
|
|
82
|
-
key: t,
|
|
83
|
-
value: n
|
|
84
|
-
};
|
|
85
|
-
}
|
|
86
|
-
return b;
|
|
87
|
-
}
|
|
88
|
-
function S(e, t) {
|
|
89
|
-
const i = t.value.split(delimiter);
|
|
90
|
-
let o = e;
|
|
91
|
-
let s;
|
|
92
|
-
do {
|
|
93
|
-
i.push(resolve(o, "node_modules", ".bin"));
|
|
94
|
-
s = o;
|
|
95
|
-
o = dirname(o);
|
|
96
|
-
} while (o !== s);
|
|
97
|
-
return {
|
|
98
|
-
key: t.key,
|
|
99
|
-
value: i.join(delimiter)
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
function C(e, t) {
|
|
103
|
-
const n = {
|
|
104
|
-
...process.env,
|
|
105
|
-
...t
|
|
106
|
-
};
|
|
107
|
-
const r = S(e, x(n));
|
|
108
|
-
n[r.key] = r.value;
|
|
109
|
-
return n;
|
|
110
|
-
}
|
|
111
|
-
const w = (e) => {
|
|
112
|
-
let t = e.length;
|
|
113
|
-
const n = new PassThrough();
|
|
114
|
-
const r = () => {
|
|
115
|
-
if (--t === 0) n.emit("end");
|
|
116
|
-
};
|
|
117
|
-
for (const t$1 of e) {
|
|
118
|
-
t$1.pipe(n, { end: false });
|
|
119
|
-
t$1.on("end", r);
|
|
120
|
-
}
|
|
121
|
-
return n;
|
|
122
|
-
};
|
|
123
|
-
var T = h((exports$1, t) => {
|
|
124
|
-
t.exports = a;
|
|
125
|
-
a.sync = o;
|
|
126
|
-
var n = v("fs");
|
|
127
|
-
function r(e, t$1) {
|
|
128
|
-
var n$1 = t$1.pathExt !== void 0 ? t$1.pathExt : process.env.PATHEXT;
|
|
129
|
-
if (!n$1) return true;
|
|
130
|
-
n$1 = n$1.split(";");
|
|
131
|
-
if (n$1.indexOf("") !== -1) return true;
|
|
132
|
-
for (var r$1 = 0; r$1 < n$1.length; r$1++) {
|
|
133
|
-
var i$1 = n$1[r$1].toLowerCase();
|
|
134
|
-
if (i$1 && e.substr(-i$1.length).toLowerCase() === i$1) return true;
|
|
135
|
-
}
|
|
136
|
-
return false;
|
|
137
|
-
}
|
|
138
|
-
function i(e, t$1, n$1) {
|
|
139
|
-
if (!e.isSymbolicLink() && !e.isFile()) return false;
|
|
140
|
-
return r(t$1, n$1);
|
|
141
|
-
}
|
|
142
|
-
function a(e, t$1, r$1) {
|
|
143
|
-
n.stat(e, function(n$1, a$1) {
|
|
144
|
-
r$1(n$1, n$1 ? false : i(a$1, e, t$1));
|
|
145
|
-
});
|
|
146
|
-
}
|
|
147
|
-
function o(e, t$1) {
|
|
148
|
-
return i(n.statSync(e), e, t$1);
|
|
149
|
-
}
|
|
150
|
-
});
|
|
151
|
-
var E = h((exports$1, t) => {
|
|
152
|
-
t.exports = r;
|
|
153
|
-
r.sync = i;
|
|
154
|
-
var n = v("fs");
|
|
155
|
-
function r(e, t$1, r$1) {
|
|
156
|
-
n.stat(e, function(e$1, n$1) {
|
|
157
|
-
r$1(e$1, e$1 ? false : a(n$1, t$1));
|
|
158
|
-
});
|
|
159
|
-
}
|
|
160
|
-
function i(e, t$1) {
|
|
161
|
-
return a(n.statSync(e), t$1);
|
|
162
|
-
}
|
|
163
|
-
function a(e, t$1) {
|
|
164
|
-
return e.isFile() && o(e, t$1);
|
|
165
|
-
}
|
|
166
|
-
function o(e, t$1) {
|
|
167
|
-
var n$1 = e.mode;
|
|
168
|
-
var r$1 = e.uid;
|
|
169
|
-
var i$1 = e.gid;
|
|
170
|
-
var a$1 = t$1.uid !== void 0 ? t$1.uid : process.getuid && process.getuid();
|
|
171
|
-
var o$1 = t$1.gid !== void 0 ? t$1.gid : process.getgid && process.getgid();
|
|
172
|
-
var s = parseInt("100", 8);
|
|
173
|
-
var c$1 = parseInt("010", 8);
|
|
174
|
-
var l$1 = parseInt("001", 8);
|
|
175
|
-
var u$1 = s | c$1;
|
|
176
|
-
return n$1 & l$1 || n$1 & c$1 && i$1 === o$1 || n$1 & s && r$1 === a$1 || n$1 & u$1 && a$1 === 0;
|
|
177
|
-
}
|
|
178
|
-
});
|
|
179
|
-
var D = h((exports$1, t) => {
|
|
180
|
-
v("fs");
|
|
181
|
-
var r;
|
|
182
|
-
if (process.platform === "win32" || global.TESTING_WINDOWS) r = T();
|
|
183
|
-
else r = E();
|
|
184
|
-
t.exports = i;
|
|
185
|
-
i.sync = a;
|
|
186
|
-
function i(e, t$1, n) {
|
|
187
|
-
if (typeof t$1 === "function") {
|
|
188
|
-
n = t$1;
|
|
189
|
-
t$1 = {};
|
|
190
|
-
}
|
|
191
|
-
if (!n) {
|
|
192
|
-
if (typeof Promise !== "function") throw new TypeError("callback not provided");
|
|
193
|
-
return new Promise(function(n$1, r$1) {
|
|
194
|
-
i(e, t$1 || {}, function(e$1, t$2) {
|
|
195
|
-
if (e$1) r$1(e$1);
|
|
196
|
-
else n$1(t$2);
|
|
197
|
-
});
|
|
198
|
-
});
|
|
199
|
-
}
|
|
200
|
-
r(e, t$1 || {}, function(e$1, r$1) {
|
|
201
|
-
if (e$1) {
|
|
202
|
-
if (e$1.code === "EACCES" || t$1 && t$1.ignoreErrors) {
|
|
203
|
-
e$1 = null;
|
|
204
|
-
r$1 = false;
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
n(e$1, r$1);
|
|
208
|
-
});
|
|
209
|
-
}
|
|
210
|
-
function a(e, t$1) {
|
|
211
|
-
try {
|
|
212
|
-
return r.sync(e, t$1 || {});
|
|
213
|
-
} catch (e$1) {
|
|
214
|
-
if (t$1 && t$1.ignoreErrors || e$1.code === "EACCES") return false;
|
|
215
|
-
else throw e$1;
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
});
|
|
219
|
-
var O = h((exports$1, t) => {
|
|
220
|
-
const n = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
|
|
221
|
-
const r = v("path");
|
|
222
|
-
const i = n ? ";" : ":";
|
|
223
|
-
const a = D();
|
|
224
|
-
const o = (e) => Object.assign(/* @__PURE__ */ new Error(`not found: ${e}`), { code: "ENOENT" });
|
|
225
|
-
const s = (e, t$1) => {
|
|
226
|
-
const r$1 = t$1.colon || i;
|
|
227
|
-
const a$1 = e.match(/\//) || n && e.match(/\\/) ? [""] : [...n ? [process.cwd()] : [], ...(t$1.path || process.env.PATH || "").split(r$1)];
|
|
228
|
-
const o$1 = n ? t$1.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
|
|
229
|
-
const s$1 = n ? o$1.split(r$1) : [""];
|
|
230
|
-
if (n) {
|
|
231
|
-
if (e.indexOf(".") !== -1 && s$1[0] !== "") s$1.unshift("");
|
|
232
|
-
}
|
|
233
|
-
return {
|
|
234
|
-
pathEnv: a$1,
|
|
235
|
-
pathExt: s$1,
|
|
236
|
-
pathExtExe: o$1
|
|
237
|
-
};
|
|
238
|
-
};
|
|
239
|
-
const c$1 = (e, t$1, n$1) => {
|
|
240
|
-
if (typeof t$1 === "function") {
|
|
241
|
-
n$1 = t$1;
|
|
242
|
-
t$1 = {};
|
|
243
|
-
}
|
|
244
|
-
if (!t$1) t$1 = {};
|
|
245
|
-
const { pathEnv: i$1, pathExt: c$2, pathExtExe: l$2 } = s(e, t$1);
|
|
246
|
-
const u$1 = [];
|
|
247
|
-
const d$1 = (n$2) => new Promise((a$1, s$1) => {
|
|
248
|
-
if (n$2 === i$1.length) return t$1.all && u$1.length ? a$1(u$1) : s$1(o(e));
|
|
249
|
-
const c$3 = i$1[n$2];
|
|
250
|
-
const l$3 = /^".*"$/.test(c$3) ? c$3.slice(1, -1) : c$3;
|
|
251
|
-
const d$2 = r.join(l$3, e);
|
|
252
|
-
a$1(f$1(!l$3 && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d$2 : d$2, n$2, 0));
|
|
253
|
-
});
|
|
254
|
-
const f$1 = (e$1, n$2, r$1) => new Promise((i$2, o$1) => {
|
|
255
|
-
if (r$1 === c$2.length) return i$2(d$1(n$2 + 1));
|
|
256
|
-
const s$1 = c$2[r$1];
|
|
257
|
-
a(e$1 + s$1, { pathExt: l$2 }, (a$1, o$2) => {
|
|
258
|
-
if (!a$1 && o$2) if (t$1.all) u$1.push(e$1 + s$1);
|
|
259
|
-
else return i$2(e$1 + s$1);
|
|
260
|
-
return i$2(f$1(e$1, n$2, r$1 + 1));
|
|
261
|
-
});
|
|
262
|
-
});
|
|
263
|
-
return n$1 ? d$1(0).then((e$1) => n$1(null, e$1), n$1) : d$1(0);
|
|
264
|
-
};
|
|
265
|
-
const l$1 = (e, t$1) => {
|
|
266
|
-
t$1 = t$1 || {};
|
|
267
|
-
const { pathEnv: n$1, pathExt: i$1, pathExtExe: c$2 } = s(e, t$1);
|
|
268
|
-
const l$2 = [];
|
|
269
|
-
for (let o$1 = 0; o$1 < n$1.length; o$1++) {
|
|
270
|
-
const s$1 = n$1[o$1];
|
|
271
|
-
const u$1 = /^".*"$/.test(s$1) ? s$1.slice(1, -1) : s$1;
|
|
272
|
-
const d$1 = r.join(u$1, e);
|
|
273
|
-
const f$1 = !u$1 && /^\.[\\\/]/.test(e) ? e.slice(0, 2) + d$1 : d$1;
|
|
274
|
-
for (let e$1 = 0; e$1 < i$1.length; e$1++) {
|
|
275
|
-
const n$2 = f$1 + i$1[e$1];
|
|
276
|
-
try {
|
|
277
|
-
if (a.sync(n$2, { pathExt: c$2 })) if (t$1.all) l$2.push(n$2);
|
|
278
|
-
else return n$2;
|
|
279
|
-
} catch (e$2) {}
|
|
280
|
-
}
|
|
281
|
-
}
|
|
282
|
-
if (t$1.all && l$2.length) return l$2;
|
|
283
|
-
if (t$1.nothrow) return null;
|
|
284
|
-
throw o(e);
|
|
285
|
-
};
|
|
286
|
-
t.exports = c$1;
|
|
287
|
-
c$1.sync = l$1;
|
|
288
|
-
});
|
|
289
|
-
var k = h((exports$1, t) => {
|
|
290
|
-
const n = (e = {}) => {
|
|
291
|
-
const t$1 = e.env || process.env;
|
|
292
|
-
if ((e.platform || process.platform) !== "win32") return "PATH";
|
|
293
|
-
return Object.keys(t$1).reverse().find((e$1) => e$1.toUpperCase() === "PATH") || "Path";
|
|
294
|
-
};
|
|
295
|
-
t.exports = n;
|
|
296
|
-
t.exports.default = n;
|
|
297
|
-
});
|
|
298
|
-
var A = h((exports$1, t) => {
|
|
299
|
-
const n = v("path");
|
|
300
|
-
const r = O();
|
|
301
|
-
const i = k();
|
|
302
|
-
function a(e, t$1) {
|
|
303
|
-
const a$1 = e.options.env || process.env;
|
|
304
|
-
const o$1 = process.cwd();
|
|
305
|
-
const s = e.options.cwd != null;
|
|
306
|
-
const c$1 = s && process.chdir !== void 0 && !process.chdir.disabled;
|
|
307
|
-
if (c$1) try {
|
|
308
|
-
process.chdir(e.options.cwd);
|
|
309
|
-
} catch (e$1) {}
|
|
310
|
-
let l$1;
|
|
311
|
-
try {
|
|
312
|
-
l$1 = r.sync(e.command, {
|
|
313
|
-
path: a$1[i({ env: a$1 })],
|
|
314
|
-
pathExt: t$1 ? n.delimiter : void 0
|
|
315
|
-
});
|
|
316
|
-
} catch (e$1) {} finally {
|
|
317
|
-
if (c$1) process.chdir(o$1);
|
|
318
|
-
}
|
|
319
|
-
if (l$1) l$1 = n.resolve(s ? e.options.cwd : "", l$1);
|
|
320
|
-
return l$1;
|
|
321
|
-
}
|
|
322
|
-
function o(e) {
|
|
323
|
-
return a(e) || a(e, true);
|
|
324
|
-
}
|
|
325
|
-
t.exports = o;
|
|
326
|
-
});
|
|
327
|
-
var j = h((exports$1, t) => {
|
|
328
|
-
const n = /([()\][%!^"`<>&|;, *?])/g;
|
|
329
|
-
function r(e) {
|
|
330
|
-
e = e.replace(n, "^$1");
|
|
331
|
-
return e;
|
|
332
|
-
}
|
|
333
|
-
function i(e, t$1) {
|
|
334
|
-
e = `${e}`;
|
|
335
|
-
e = e.replace(/(\\*)"/g, "$1$1\\\"");
|
|
336
|
-
e = e.replace(/(\\*)$/, "$1$1");
|
|
337
|
-
e = `"${e}"`;
|
|
338
|
-
e = e.replace(n, "^$1");
|
|
339
|
-
if (t$1) e = e.replace(n, "^$1");
|
|
340
|
-
return e;
|
|
341
|
-
}
|
|
342
|
-
t.exports.command = r;
|
|
343
|
-
t.exports.argument = i;
|
|
344
|
-
});
|
|
345
|
-
var M = h((exports$1, t) => {
|
|
346
|
-
t.exports = /^#!(.*)/;
|
|
347
|
-
});
|
|
348
|
-
var N = h((exports$1, t) => {
|
|
349
|
-
const n = M();
|
|
350
|
-
t.exports = (e = "") => {
|
|
351
|
-
const t$1 = e.match(n);
|
|
352
|
-
if (!t$1) return null;
|
|
353
|
-
const [r, i] = t$1[0].replace(/#! ?/, "").split(" ");
|
|
354
|
-
const a = r.split("/").pop();
|
|
355
|
-
if (a === "env") return i;
|
|
356
|
-
return i ? `${a} ${i}` : a;
|
|
357
|
-
};
|
|
358
|
-
});
|
|
359
|
-
var P = h((exports$1, t) => {
|
|
360
|
-
const n = v("fs");
|
|
361
|
-
const r = N();
|
|
362
|
-
function i(e) {
|
|
363
|
-
const t$1 = 150;
|
|
364
|
-
const i$1 = Buffer.alloc(t$1);
|
|
365
|
-
let a;
|
|
366
|
-
try {
|
|
367
|
-
a = n.openSync(e, "r");
|
|
368
|
-
n.readSync(a, i$1, 0, t$1, 0);
|
|
369
|
-
n.closeSync(a);
|
|
370
|
-
} catch (e$1) {}
|
|
371
|
-
return r(i$1.toString());
|
|
372
|
-
}
|
|
373
|
-
t.exports = i;
|
|
374
|
-
});
|
|
375
|
-
var F = h((exports$1, t) => {
|
|
376
|
-
const n = v("path");
|
|
377
|
-
const r = A();
|
|
378
|
-
const i = j();
|
|
379
|
-
const a = P();
|
|
380
|
-
const o = process.platform === "win32";
|
|
381
|
-
const s = /\.(?:com|exe)$/i;
|
|
382
|
-
const c$1 = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
383
|
-
function l$1(e) {
|
|
384
|
-
e.file = r(e);
|
|
385
|
-
const t$1 = e.file && a(e.file);
|
|
386
|
-
if (t$1) {
|
|
387
|
-
e.args.unshift(e.file);
|
|
388
|
-
e.command = t$1;
|
|
389
|
-
return r(e);
|
|
390
|
-
}
|
|
391
|
-
return e.file;
|
|
392
|
-
}
|
|
393
|
-
function u$1(e) {
|
|
394
|
-
if (!o) return e;
|
|
395
|
-
const t$1 = l$1(e);
|
|
396
|
-
const r$1 = !s.test(t$1);
|
|
397
|
-
if (e.options.forceShell || r$1) {
|
|
398
|
-
const r$2 = c$1.test(t$1);
|
|
399
|
-
e.command = n.normalize(e.command);
|
|
400
|
-
e.command = i.command(e.command);
|
|
401
|
-
e.args = e.args.map((e$1) => i.argument(e$1, r$2));
|
|
402
|
-
e.args = [
|
|
403
|
-
"/d",
|
|
404
|
-
"/s",
|
|
405
|
-
"/c",
|
|
406
|
-
`"${[e.command].concat(e.args).join(" ")}"`
|
|
407
|
-
];
|
|
408
|
-
e.command = process.env.comspec || "cmd.exe";
|
|
409
|
-
e.options.windowsVerbatimArguments = true;
|
|
410
|
-
}
|
|
411
|
-
return e;
|
|
412
|
-
}
|
|
413
|
-
function d$1(e, t$1, n$1) {
|
|
414
|
-
if (t$1 && !Array.isArray(t$1)) {
|
|
415
|
-
n$1 = t$1;
|
|
416
|
-
t$1 = null;
|
|
417
|
-
}
|
|
418
|
-
t$1 = t$1 ? t$1.slice(0) : [];
|
|
419
|
-
n$1 = Object.assign({}, n$1);
|
|
420
|
-
const r$1 = {
|
|
421
|
-
command: e,
|
|
422
|
-
args: t$1,
|
|
423
|
-
options: n$1,
|
|
424
|
-
file: void 0,
|
|
425
|
-
original: {
|
|
426
|
-
command: e,
|
|
427
|
-
args: t$1
|
|
428
|
-
}
|
|
429
|
-
};
|
|
430
|
-
return n$1.shell ? r$1 : u$1(r$1);
|
|
431
|
-
}
|
|
432
|
-
t.exports = d$1;
|
|
433
|
-
});
|
|
434
|
-
var I = h((exports$1, t) => {
|
|
435
|
-
const n = process.platform === "win32";
|
|
436
|
-
function r(e, t$1) {
|
|
437
|
-
return Object.assign(/* @__PURE__ */ new Error(`${t$1} ${e.command} ENOENT`), {
|
|
438
|
-
code: "ENOENT",
|
|
439
|
-
errno: "ENOENT",
|
|
440
|
-
syscall: `${t$1} ${e.command}`,
|
|
441
|
-
path: e.command,
|
|
442
|
-
spawnargs: e.args
|
|
443
|
-
});
|
|
444
|
-
}
|
|
445
|
-
function i(e, t$1) {
|
|
446
|
-
if (!n) return;
|
|
447
|
-
const r$1 = e.emit;
|
|
448
|
-
e.emit = function(n$1, i$1) {
|
|
449
|
-
if (n$1 === "exit") {
|
|
450
|
-
const n$2 = a(i$1, t$1, "spawn");
|
|
451
|
-
if (n$2) return r$1.call(e, "error", n$2);
|
|
452
|
-
}
|
|
453
|
-
return r$1.apply(e, arguments);
|
|
454
|
-
};
|
|
455
|
-
}
|
|
456
|
-
function a(e, t$1) {
|
|
457
|
-
if (n && e === 1 && !t$1.file) return r(t$1.original, "spawn");
|
|
458
|
-
return null;
|
|
459
|
-
}
|
|
460
|
-
function o(e, t$1) {
|
|
461
|
-
if (n && e === 1 && !t$1.file) return r(t$1.original, "spawnSync");
|
|
462
|
-
return null;
|
|
463
|
-
}
|
|
464
|
-
t.exports = {
|
|
465
|
-
hookChildProcess: i,
|
|
466
|
-
verifyENOENT: a,
|
|
467
|
-
verifyENOENTSync: o,
|
|
468
|
-
notFoundError: r
|
|
469
|
-
};
|
|
470
|
-
});
|
|
471
|
-
var R = _(h((exports$1, t) => {
|
|
472
|
-
const n = v("child_process");
|
|
473
|
-
const r = F();
|
|
474
|
-
const i = I();
|
|
475
|
-
function a(e, t$1, a$1) {
|
|
476
|
-
const o$1 = r(e, t$1, a$1);
|
|
477
|
-
const s = n.spawn(o$1.command, o$1.args, o$1.options);
|
|
478
|
-
i.hookChildProcess(s, o$1);
|
|
479
|
-
return s;
|
|
480
|
-
}
|
|
481
|
-
function o(e, t$1, a$1) {
|
|
482
|
-
const o$1 = r(e, t$1, a$1);
|
|
483
|
-
const s = n.spawnSync(o$1.command, o$1.args, o$1.options);
|
|
484
|
-
s.error = s.error || i.verifyENOENTSync(s.status, o$1);
|
|
485
|
-
return s;
|
|
486
|
-
}
|
|
487
|
-
t.exports = a;
|
|
488
|
-
t.exports.spawn = a;
|
|
489
|
-
t.exports.sync = o;
|
|
490
|
-
t.exports._parse = r;
|
|
491
|
-
t.exports._enoent = i;
|
|
492
|
-
})(), 1);
|
|
493
|
-
var z = class extends Error {
|
|
494
|
-
result;
|
|
495
|
-
output;
|
|
496
|
-
get exitCode() {
|
|
497
|
-
if (this.result.exitCode !== null) return this.result.exitCode;
|
|
498
|
-
}
|
|
499
|
-
constructor(e, t) {
|
|
500
|
-
super(`Process exited with non-zero status (${e.exitCode})`);
|
|
501
|
-
this.result = e;
|
|
502
|
-
this.output = t;
|
|
503
|
-
}
|
|
504
|
-
};
|
|
505
|
-
const B = {
|
|
506
|
-
timeout: void 0,
|
|
507
|
-
persist: false
|
|
508
|
-
};
|
|
509
|
-
const V = { windowsHide: true };
|
|
510
|
-
function H(e, t) {
|
|
511
|
-
return {
|
|
512
|
-
command: normalize(e),
|
|
513
|
-
args: t ?? []
|
|
514
|
-
};
|
|
515
|
-
}
|
|
516
|
-
function U(e) {
|
|
517
|
-
const t = new AbortController();
|
|
518
|
-
for (const n of e) {
|
|
519
|
-
if (n.aborted) {
|
|
520
|
-
t.abort();
|
|
521
|
-
return n;
|
|
522
|
-
}
|
|
523
|
-
const e$1 = () => {
|
|
524
|
-
t.abort(n.reason);
|
|
525
|
-
};
|
|
526
|
-
n.addEventListener("abort", e$1, { signal: t.signal });
|
|
527
|
-
}
|
|
528
|
-
return t.signal;
|
|
529
|
-
}
|
|
530
|
-
async function W(e) {
|
|
531
|
-
let t = "";
|
|
532
|
-
for await (const n of e) t += n.toString();
|
|
533
|
-
return t;
|
|
534
|
-
}
|
|
535
|
-
var G = class {
|
|
536
|
-
_process;
|
|
537
|
-
_aborted = false;
|
|
538
|
-
_options;
|
|
539
|
-
_command;
|
|
540
|
-
_args;
|
|
541
|
-
_resolveClose;
|
|
542
|
-
_processClosed;
|
|
543
|
-
_thrownError;
|
|
544
|
-
get process() {
|
|
545
|
-
return this._process;
|
|
546
|
-
}
|
|
547
|
-
get pid() {
|
|
548
|
-
return this._process?.pid;
|
|
549
|
-
}
|
|
550
|
-
get exitCode() {
|
|
551
|
-
if (this._process && this._process.exitCode !== null) return this._process.exitCode;
|
|
552
|
-
}
|
|
553
|
-
constructor(e, t, n) {
|
|
554
|
-
this._options = {
|
|
555
|
-
...B,
|
|
556
|
-
...n
|
|
557
|
-
};
|
|
558
|
-
this._command = e;
|
|
559
|
-
this._args = t ?? [];
|
|
560
|
-
this._processClosed = new Promise((e$1) => {
|
|
561
|
-
this._resolveClose = e$1;
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
kill(e) {
|
|
565
|
-
return this._process?.kill(e) === true;
|
|
566
|
-
}
|
|
567
|
-
get aborted() {
|
|
568
|
-
return this._aborted;
|
|
569
|
-
}
|
|
570
|
-
get killed() {
|
|
571
|
-
return this._process?.killed === true;
|
|
572
|
-
}
|
|
573
|
-
pipe(e, t, n) {
|
|
574
|
-
return q(e, t, {
|
|
575
|
-
...n,
|
|
576
|
-
stdin: this
|
|
577
|
-
});
|
|
578
|
-
}
|
|
579
|
-
async *[Symbol.asyncIterator]() {
|
|
580
|
-
const e = this._process;
|
|
581
|
-
if (!e) return;
|
|
582
|
-
const t = [];
|
|
583
|
-
if (this._streamErr) t.push(this._streamErr);
|
|
584
|
-
if (this._streamOut) t.push(this._streamOut);
|
|
585
|
-
const n = w(t);
|
|
586
|
-
const r = c.createInterface({ input: n });
|
|
587
|
-
for await (const e$1 of r) yield e$1.toString();
|
|
588
|
-
await this._processClosed;
|
|
589
|
-
e.removeAllListeners();
|
|
590
|
-
if (this._thrownError) throw this._thrownError;
|
|
591
|
-
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z(this);
|
|
592
|
-
}
|
|
593
|
-
async _waitForOutput() {
|
|
594
|
-
const e = this._process;
|
|
595
|
-
if (!e) throw new Error("No process was started");
|
|
596
|
-
const [t, n] = await Promise.all([this._streamOut ? W(this._streamOut) : "", this._streamErr ? W(this._streamErr) : ""]);
|
|
597
|
-
await this._processClosed;
|
|
598
|
-
if (this._options?.stdin) await this._options.stdin;
|
|
599
|
-
e.removeAllListeners();
|
|
600
|
-
if (this._thrownError) throw this._thrownError;
|
|
601
|
-
const r = {
|
|
602
|
-
stderr: n,
|
|
603
|
-
stdout: t,
|
|
604
|
-
exitCode: this.exitCode
|
|
605
|
-
};
|
|
606
|
-
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0) throw new z(this, r);
|
|
607
|
-
return r;
|
|
608
|
-
}
|
|
609
|
-
then(e, t) {
|
|
610
|
-
return this._waitForOutput().then(e, t);
|
|
611
|
-
}
|
|
612
|
-
_streamOut;
|
|
613
|
-
_streamErr;
|
|
614
|
-
spawn() {
|
|
615
|
-
const e = cwd();
|
|
616
|
-
const n = this._options;
|
|
617
|
-
const r = {
|
|
618
|
-
...V,
|
|
619
|
-
...n.nodeOptions
|
|
620
|
-
};
|
|
621
|
-
const i = [];
|
|
622
|
-
this._resetState();
|
|
623
|
-
if (n.timeout !== void 0) i.push(AbortSignal.timeout(n.timeout));
|
|
624
|
-
if (n.signal !== void 0) i.push(n.signal);
|
|
625
|
-
if (n.persist === true) r.detached = true;
|
|
626
|
-
if (i.length > 0) r.signal = U(i);
|
|
627
|
-
r.env = C(e, r.env);
|
|
628
|
-
const { command: a, args: s } = H(this._command, this._args);
|
|
629
|
-
const c$1 = (0, R._parse)(a, s, r);
|
|
630
|
-
const l$1 = spawn(c$1.command, c$1.args, c$1.options);
|
|
631
|
-
if (l$1.stderr) this._streamErr = l$1.stderr;
|
|
632
|
-
if (l$1.stdout) this._streamOut = l$1.stdout;
|
|
633
|
-
this._process = l$1;
|
|
634
|
-
l$1.once("error", this._onError);
|
|
635
|
-
l$1.once("close", this._onClose);
|
|
636
|
-
if (n.stdin !== void 0 && l$1.stdin && n.stdin.process) {
|
|
637
|
-
const { stdout: e$1 } = n.stdin.process;
|
|
638
|
-
if (e$1) e$1.pipe(l$1.stdin);
|
|
639
|
-
}
|
|
640
|
-
}
|
|
641
|
-
_resetState() {
|
|
642
|
-
this._aborted = false;
|
|
643
|
-
this._processClosed = new Promise((e) => {
|
|
644
|
-
this._resolveClose = e;
|
|
645
|
-
});
|
|
646
|
-
this._thrownError = void 0;
|
|
647
|
-
}
|
|
648
|
-
_onError = (e) => {
|
|
649
|
-
if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) {
|
|
650
|
-
this._aborted = true;
|
|
651
|
-
return;
|
|
652
|
-
}
|
|
653
|
-
this._thrownError = e;
|
|
654
|
-
};
|
|
655
|
-
_onClose = () => {
|
|
656
|
-
if (this._resolveClose) this._resolveClose();
|
|
657
|
-
};
|
|
658
|
-
};
|
|
659
|
-
const K = (e, t, n) => {
|
|
660
|
-
const r = new G(e, t, n);
|
|
661
|
-
r.spawn();
|
|
662
|
-
return r;
|
|
663
|
-
};
|
|
664
|
-
const q = K;
|
|
665
|
-
|
|
666
|
-
//#endregion
|
|
667
|
-
//#region ../../node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
668
|
-
function dashDashArg(agent, agentCommand) {
|
|
669
|
-
return (args) => {
|
|
670
|
-
if (args.length > 1) return [
|
|
671
|
-
agent,
|
|
672
|
-
agentCommand,
|
|
673
|
-
args[0],
|
|
674
|
-
"--",
|
|
675
|
-
...args.slice(1)
|
|
676
|
-
];
|
|
677
|
-
else return [
|
|
678
|
-
agent,
|
|
679
|
-
agentCommand,
|
|
680
|
-
args[0]
|
|
681
|
-
];
|
|
682
|
-
};
|
|
683
|
-
}
|
|
684
|
-
function denoExecute() {
|
|
685
|
-
return (args) => {
|
|
686
|
-
return [
|
|
687
|
-
"deno",
|
|
688
|
-
"run",
|
|
689
|
-
`npm:${args[0]}`,
|
|
690
|
-
...args.slice(1)
|
|
691
|
-
];
|
|
692
|
-
};
|
|
693
|
-
}
|
|
694
|
-
const npm = {
|
|
695
|
-
"agent": ["npm", 0],
|
|
696
|
-
"run": dashDashArg("npm", "run"),
|
|
697
|
-
"install": [
|
|
698
|
-
"npm",
|
|
699
|
-
"i",
|
|
700
|
-
0
|
|
701
|
-
],
|
|
702
|
-
"frozen": [
|
|
703
|
-
"npm",
|
|
704
|
-
"ci",
|
|
705
|
-
0
|
|
706
|
-
],
|
|
707
|
-
"global": [
|
|
708
|
-
"npm",
|
|
709
|
-
"i",
|
|
710
|
-
"-g",
|
|
711
|
-
0
|
|
712
|
-
],
|
|
713
|
-
"add": [
|
|
714
|
-
"npm",
|
|
715
|
-
"i",
|
|
716
|
-
0
|
|
717
|
-
],
|
|
718
|
-
"upgrade": [
|
|
719
|
-
"npm",
|
|
720
|
-
"update",
|
|
721
|
-
0
|
|
722
|
-
],
|
|
723
|
-
"upgrade-interactive": null,
|
|
724
|
-
"dedupe": [
|
|
725
|
-
"npm",
|
|
726
|
-
"dedupe",
|
|
727
|
-
0
|
|
728
|
-
],
|
|
729
|
-
"execute": ["npx", 0],
|
|
730
|
-
"execute-local": ["npx", 0],
|
|
731
|
-
"uninstall": [
|
|
732
|
-
"npm",
|
|
733
|
-
"uninstall",
|
|
734
|
-
0
|
|
735
|
-
],
|
|
736
|
-
"global_uninstall": [
|
|
737
|
-
"npm",
|
|
738
|
-
"uninstall",
|
|
739
|
-
"-g",
|
|
740
|
-
0
|
|
741
|
-
]
|
|
742
|
-
};
|
|
743
|
-
const yarn = {
|
|
744
|
-
"agent": ["yarn", 0],
|
|
745
|
-
"run": [
|
|
746
|
-
"yarn",
|
|
747
|
-
"run",
|
|
748
|
-
0
|
|
749
|
-
],
|
|
750
|
-
"install": [
|
|
751
|
-
"yarn",
|
|
752
|
-
"install",
|
|
753
|
-
0
|
|
754
|
-
],
|
|
755
|
-
"frozen": [
|
|
756
|
-
"yarn",
|
|
757
|
-
"install",
|
|
758
|
-
"--frozen-lockfile",
|
|
759
|
-
0
|
|
760
|
-
],
|
|
761
|
-
"global": [
|
|
762
|
-
"yarn",
|
|
763
|
-
"global",
|
|
764
|
-
"add",
|
|
765
|
-
0
|
|
766
|
-
],
|
|
767
|
-
"add": [
|
|
768
|
-
"yarn",
|
|
769
|
-
"add",
|
|
770
|
-
0
|
|
771
|
-
],
|
|
772
|
-
"upgrade": [
|
|
773
|
-
"yarn",
|
|
774
|
-
"upgrade",
|
|
775
|
-
0
|
|
776
|
-
],
|
|
777
|
-
"upgrade-interactive": [
|
|
778
|
-
"yarn",
|
|
779
|
-
"upgrade-interactive",
|
|
780
|
-
0
|
|
781
|
-
],
|
|
782
|
-
"dedupe": null,
|
|
783
|
-
"execute": ["npx", 0],
|
|
784
|
-
"execute-local": dashDashArg("yarn", "exec"),
|
|
785
|
-
"uninstall": [
|
|
786
|
-
"yarn",
|
|
787
|
-
"remove",
|
|
788
|
-
0
|
|
789
|
-
],
|
|
790
|
-
"global_uninstall": [
|
|
791
|
-
"yarn",
|
|
792
|
-
"global",
|
|
793
|
-
"remove",
|
|
794
|
-
0
|
|
795
|
-
]
|
|
796
|
-
};
|
|
797
|
-
const yarnBerry = {
|
|
798
|
-
...yarn,
|
|
799
|
-
"frozen": [
|
|
800
|
-
"yarn",
|
|
801
|
-
"install",
|
|
802
|
-
"--immutable",
|
|
803
|
-
0
|
|
804
|
-
],
|
|
805
|
-
"upgrade": [
|
|
806
|
-
"yarn",
|
|
807
|
-
"up",
|
|
808
|
-
0
|
|
809
|
-
],
|
|
810
|
-
"upgrade-interactive": [
|
|
811
|
-
"yarn",
|
|
812
|
-
"up",
|
|
813
|
-
"-i",
|
|
814
|
-
0
|
|
815
|
-
],
|
|
816
|
-
"dedupe": [
|
|
817
|
-
"yarn",
|
|
818
|
-
"dedupe",
|
|
819
|
-
0
|
|
820
|
-
],
|
|
821
|
-
"execute": [
|
|
822
|
-
"yarn",
|
|
823
|
-
"dlx",
|
|
824
|
-
0
|
|
825
|
-
],
|
|
826
|
-
"execute-local": [
|
|
827
|
-
"yarn",
|
|
828
|
-
"exec",
|
|
829
|
-
0
|
|
830
|
-
],
|
|
831
|
-
"global": [
|
|
832
|
-
"npm",
|
|
833
|
-
"i",
|
|
834
|
-
"-g",
|
|
835
|
-
0
|
|
836
|
-
],
|
|
837
|
-
"global_uninstall": [
|
|
838
|
-
"npm",
|
|
839
|
-
"uninstall",
|
|
840
|
-
"-g",
|
|
841
|
-
0
|
|
842
|
-
]
|
|
843
|
-
};
|
|
844
|
-
const pnpm = {
|
|
845
|
-
"agent": ["pnpm", 0],
|
|
846
|
-
"run": [
|
|
847
|
-
"pnpm",
|
|
848
|
-
"run",
|
|
849
|
-
0
|
|
850
|
-
],
|
|
851
|
-
"install": [
|
|
852
|
-
"pnpm",
|
|
853
|
-
"i",
|
|
854
|
-
0
|
|
855
|
-
],
|
|
856
|
-
"frozen": [
|
|
857
|
-
"pnpm",
|
|
858
|
-
"i",
|
|
859
|
-
"--frozen-lockfile",
|
|
860
|
-
0
|
|
861
|
-
],
|
|
862
|
-
"global": [
|
|
863
|
-
"pnpm",
|
|
864
|
-
"add",
|
|
865
|
-
"-g",
|
|
866
|
-
0
|
|
867
|
-
],
|
|
868
|
-
"add": [
|
|
869
|
-
"pnpm",
|
|
870
|
-
"add",
|
|
871
|
-
0
|
|
872
|
-
],
|
|
873
|
-
"upgrade": [
|
|
874
|
-
"pnpm",
|
|
875
|
-
"update",
|
|
876
|
-
0
|
|
877
|
-
],
|
|
878
|
-
"upgrade-interactive": [
|
|
879
|
-
"pnpm",
|
|
880
|
-
"update",
|
|
881
|
-
"-i",
|
|
882
|
-
0
|
|
883
|
-
],
|
|
884
|
-
"dedupe": [
|
|
885
|
-
"pnpm",
|
|
886
|
-
"dedupe",
|
|
887
|
-
0
|
|
888
|
-
],
|
|
889
|
-
"execute": [
|
|
890
|
-
"pnpm",
|
|
891
|
-
"dlx",
|
|
892
|
-
0
|
|
893
|
-
],
|
|
894
|
-
"execute-local": [
|
|
895
|
-
"pnpm",
|
|
896
|
-
"exec",
|
|
897
|
-
0
|
|
898
|
-
],
|
|
899
|
-
"uninstall": [
|
|
900
|
-
"pnpm",
|
|
901
|
-
"remove",
|
|
902
|
-
0
|
|
903
|
-
],
|
|
904
|
-
"global_uninstall": [
|
|
905
|
-
"pnpm",
|
|
906
|
-
"remove",
|
|
907
|
-
"--global",
|
|
908
|
-
0
|
|
909
|
-
]
|
|
910
|
-
};
|
|
911
|
-
const bun = {
|
|
912
|
-
"agent": ["bun", 0],
|
|
913
|
-
"run": [
|
|
914
|
-
"bun",
|
|
915
|
-
"run",
|
|
916
|
-
0
|
|
917
|
-
],
|
|
918
|
-
"install": [
|
|
919
|
-
"bun",
|
|
920
|
-
"install",
|
|
921
|
-
0
|
|
922
|
-
],
|
|
923
|
-
"frozen": [
|
|
924
|
-
"bun",
|
|
925
|
-
"install",
|
|
926
|
-
"--frozen-lockfile",
|
|
927
|
-
0
|
|
928
|
-
],
|
|
929
|
-
"global": [
|
|
930
|
-
"bun",
|
|
931
|
-
"add",
|
|
932
|
-
"-g",
|
|
933
|
-
0
|
|
934
|
-
],
|
|
935
|
-
"add": [
|
|
936
|
-
"bun",
|
|
937
|
-
"add",
|
|
938
|
-
0
|
|
939
|
-
],
|
|
940
|
-
"upgrade": [
|
|
941
|
-
"bun",
|
|
942
|
-
"update",
|
|
943
|
-
0
|
|
944
|
-
],
|
|
945
|
-
"upgrade-interactive": [
|
|
946
|
-
"bun",
|
|
947
|
-
"update",
|
|
948
|
-
"-i",
|
|
949
|
-
0
|
|
950
|
-
],
|
|
951
|
-
"dedupe": null,
|
|
952
|
-
"execute": [
|
|
953
|
-
"bun",
|
|
954
|
-
"x",
|
|
955
|
-
0
|
|
956
|
-
],
|
|
957
|
-
"execute-local": [
|
|
958
|
-
"bun",
|
|
959
|
-
"x",
|
|
960
|
-
0
|
|
961
|
-
],
|
|
962
|
-
"uninstall": [
|
|
963
|
-
"bun",
|
|
964
|
-
"remove",
|
|
965
|
-
0
|
|
966
|
-
],
|
|
967
|
-
"global_uninstall": [
|
|
968
|
-
"bun",
|
|
969
|
-
"remove",
|
|
970
|
-
"-g",
|
|
971
|
-
0
|
|
972
|
-
]
|
|
973
|
-
};
|
|
974
|
-
const deno = {
|
|
975
|
-
"agent": ["deno", 0],
|
|
976
|
-
"run": [
|
|
977
|
-
"deno",
|
|
978
|
-
"task",
|
|
979
|
-
0
|
|
980
|
-
],
|
|
981
|
-
"install": [
|
|
982
|
-
"deno",
|
|
983
|
-
"install",
|
|
984
|
-
0
|
|
985
|
-
],
|
|
986
|
-
"frozen": [
|
|
987
|
-
"deno",
|
|
988
|
-
"install",
|
|
989
|
-
"--frozen",
|
|
990
|
-
0
|
|
991
|
-
],
|
|
992
|
-
"global": [
|
|
993
|
-
"deno",
|
|
994
|
-
"install",
|
|
995
|
-
"-g",
|
|
996
|
-
0
|
|
997
|
-
],
|
|
998
|
-
"add": [
|
|
999
|
-
"deno",
|
|
1000
|
-
"add",
|
|
1001
|
-
0
|
|
1002
|
-
],
|
|
1003
|
-
"upgrade": [
|
|
1004
|
-
"deno",
|
|
1005
|
-
"outdated",
|
|
1006
|
-
"--update",
|
|
1007
|
-
0
|
|
1008
|
-
],
|
|
1009
|
-
"upgrade-interactive": [
|
|
1010
|
-
"deno",
|
|
1011
|
-
"outdated",
|
|
1012
|
-
"--update",
|
|
1013
|
-
0
|
|
1014
|
-
],
|
|
1015
|
-
"dedupe": null,
|
|
1016
|
-
"execute": denoExecute(),
|
|
1017
|
-
"execute-local": [
|
|
1018
|
-
"deno",
|
|
1019
|
-
"task",
|
|
1020
|
-
"--eval",
|
|
1021
|
-
0
|
|
1022
|
-
],
|
|
1023
|
-
"uninstall": [
|
|
1024
|
-
"deno",
|
|
1025
|
-
"remove",
|
|
1026
|
-
0
|
|
1027
|
-
],
|
|
1028
|
-
"global_uninstall": [
|
|
1029
|
-
"deno",
|
|
1030
|
-
"uninstall",
|
|
1031
|
-
"-g",
|
|
1032
|
-
0
|
|
1033
|
-
]
|
|
1034
|
-
};
|
|
1035
|
-
const COMMANDS = {
|
|
1036
|
-
"npm": npm,
|
|
1037
|
-
"yarn": yarn,
|
|
1038
|
-
"yarn@berry": yarnBerry,
|
|
1039
|
-
"pnpm": pnpm,
|
|
1040
|
-
"pnpm@6": {
|
|
1041
|
-
...pnpm,
|
|
1042
|
-
run: dashDashArg("pnpm", "run")
|
|
1043
|
-
},
|
|
1044
|
-
"bun": bun,
|
|
1045
|
-
"deno": deno
|
|
1046
|
-
};
|
|
1047
|
-
function resolveCommand(agent, command, args) {
|
|
1048
|
-
const value = COMMANDS[agent][command];
|
|
1049
|
-
return constructCommand(value, args);
|
|
1050
|
-
}
|
|
1051
|
-
function constructCommand(value, args) {
|
|
1052
|
-
if (value == null) return null;
|
|
1053
|
-
const list = typeof value === "function" ? value(args) : value.flatMap((v$1) => {
|
|
1054
|
-
if (typeof v$1 === "number") return args;
|
|
1055
|
-
return [v$1];
|
|
1056
|
-
});
|
|
1057
|
-
return {
|
|
1058
|
-
command: list[0],
|
|
1059
|
-
args: list.slice(1)
|
|
1060
|
-
};
|
|
1061
|
-
}
|
|
1062
|
-
|
|
1063
47
|
//#endregion
|
|
1064
48
|
//#region ../../node_modules/.pnpm/package-manager-detector@1.6.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
1065
49
|
const AGENTS = [
|
|
@@ -1103,7 +87,7 @@ async function pathExists(path2, type) {
|
|
|
1103
87
|
return false;
|
|
1104
88
|
}
|
|
1105
89
|
}
|
|
1106
|
-
function* lookup(cwd$1 = process
|
|
90
|
+
function* lookup(cwd$1 = process.cwd()) {
|
|
1107
91
|
let directory = path.resolve(cwd$1);
|
|
1108
92
|
const { root } = path.parse(directory);
|
|
1109
93
|
while (directory && directory !== root) {
|
|
@@ -1217,110 +201,6 @@ function isMetadataYarnClassic(metadataPath) {
|
|
|
1217
201
|
return metadataPath.endsWith(".yarn_integrity");
|
|
1218
202
|
}
|
|
1219
203
|
|
|
1220
|
-
//#endregion
|
|
1221
|
-
//#region lib/cli/add/utils.ts
|
|
1222
|
-
var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
|
|
1223
|
-
function getPackageJson(cwd$1) {
|
|
1224
|
-
const packageText = readFile(cwd$1, commonFilePaths.packageJson);
|
|
1225
|
-
if (!packageText) {
|
|
1226
|
-
const pkgPath = path.join(cwd$1, commonFilePaths.packageJson);
|
|
1227
|
-
throw new Error(`Invalid workspace: missing '${pkgPath}'`);
|
|
1228
|
-
}
|
|
1229
|
-
const { data, generateCode } = parseJson(packageText);
|
|
1230
|
-
return {
|
|
1231
|
-
source: packageText,
|
|
1232
|
-
data,
|
|
1233
|
-
generateCode
|
|
1234
|
-
};
|
|
1235
|
-
}
|
|
1236
|
-
async function formatFiles(options) {
|
|
1237
|
-
if (options.filesToFormat.length === 0) return;
|
|
1238
|
-
const { start, stop } = J();
|
|
1239
|
-
start("Formatting modified files");
|
|
1240
|
-
const args = [
|
|
1241
|
-
"prettier",
|
|
1242
|
-
"--write",
|
|
1243
|
-
"--ignore-unknown",
|
|
1244
|
-
...options.filesToFormat
|
|
1245
|
-
];
|
|
1246
|
-
const cmd = resolveCommand(options.packageManager, "execute-local", args);
|
|
1247
|
-
try {
|
|
1248
|
-
const result = await q(cmd.command, cmd.args, {
|
|
1249
|
-
nodeOptions: {
|
|
1250
|
-
cwd: options.cwd,
|
|
1251
|
-
stdio: "pipe"
|
|
1252
|
-
},
|
|
1253
|
-
throwOnError: true
|
|
1254
|
-
});
|
|
1255
|
-
if (result.exitCode !== 0) {
|
|
1256
|
-
stop("Failed to format files");
|
|
1257
|
-
T$1.error(result.stderr);
|
|
1258
|
-
return;
|
|
1259
|
-
}
|
|
1260
|
-
} catch (e) {
|
|
1261
|
-
stop("Failed to format files");
|
|
1262
|
-
T$1.error(e?.output?.stderr || "unknown error");
|
|
1263
|
-
return;
|
|
1264
|
-
}
|
|
1265
|
-
stop("Successfully formatted modified files");
|
|
1266
|
-
}
|
|
1267
|
-
function readFile(cwd$1, filePath) {
|
|
1268
|
-
const fullFilePath = path.resolve(cwd$1, filePath);
|
|
1269
|
-
if (!fileExists(cwd$1, filePath)) return "";
|
|
1270
|
-
return fs.readFileSync(fullFilePath, "utf8");
|
|
1271
|
-
}
|
|
1272
|
-
function installPackages(dependencies, workspace) {
|
|
1273
|
-
const { data, generateCode } = getPackageJson(workspace.cwd);
|
|
1274
|
-
for (const dependency of dependencies) if (dependency.dev) {
|
|
1275
|
-
data.devDependencies ??= {};
|
|
1276
|
-
data.devDependencies[dependency.pkg] = dependency.version;
|
|
1277
|
-
} else {
|
|
1278
|
-
data.dependencies ??= {};
|
|
1279
|
-
data.dependencies[dependency.pkg] = dependency.version;
|
|
1280
|
-
}
|
|
1281
|
-
if (data.dependencies) data.dependencies = alphabetizeProperties(data.dependencies);
|
|
1282
|
-
if (data.devDependencies) data.devDependencies = alphabetizeProperties(data.devDependencies);
|
|
1283
|
-
writeFile(workspace, commonFilePaths.packageJson, generateCode());
|
|
1284
|
-
return commonFilePaths.packageJson;
|
|
1285
|
-
}
|
|
1286
|
-
function alphabetizeProperties(obj) {
|
|
1287
|
-
const orderedObj = {};
|
|
1288
|
-
const sortedEntries = Object.entries(obj).sort(([a], [b$1]) => a.localeCompare(b$1));
|
|
1289
|
-
for (const [key, value] of sortedEntries) orderedObj[key] = value;
|
|
1290
|
-
return orderedObj;
|
|
1291
|
-
}
|
|
1292
|
-
function writeFile(workspace, filePath, content) {
|
|
1293
|
-
const fullFilePath = path.resolve(workspace.cwd, filePath);
|
|
1294
|
-
const fullDirectoryPath = path.dirname(fullFilePath);
|
|
1295
|
-
if (content && !content.endsWith("\n")) content += "\n";
|
|
1296
|
-
if (!fs.existsSync(fullDirectoryPath)) fs.mkdirSync(fullDirectoryPath, { recursive: true });
|
|
1297
|
-
fs.writeFileSync(fullFilePath, content, "utf8");
|
|
1298
|
-
}
|
|
1299
|
-
function fileExists(cwd$1, filePath) {
|
|
1300
|
-
const fullFilePath = path.resolve(cwd$1, filePath);
|
|
1301
|
-
return fs.existsSync(fullFilePath);
|
|
1302
|
-
}
|
|
1303
|
-
const commonFilePaths = {
|
|
1304
|
-
packageJson: "package.json",
|
|
1305
|
-
svelteConfig: "svelte.config.js",
|
|
1306
|
-
svelteConfigTS: "svelte.config.ts",
|
|
1307
|
-
jsconfig: "jsconfig.json",
|
|
1308
|
-
tsconfig: "tsconfig.json",
|
|
1309
|
-
viteConfig: "vite.config.js",
|
|
1310
|
-
viteConfigTS: "vite.config.ts"
|
|
1311
|
-
};
|
|
1312
|
-
function getHighlighter() {
|
|
1313
|
-
return {
|
|
1314
|
-
addon: (str) => import_picocolors.default.green(str),
|
|
1315
|
-
command: (str) => import_picocolors.default.bold(import_picocolors.default.cyanBright(str)),
|
|
1316
|
-
env: (str) => import_picocolors.default.yellow(str),
|
|
1317
|
-
path: (str) => import_picocolors.default.green(str),
|
|
1318
|
-
route: (str) => import_picocolors.default.bold(str),
|
|
1319
|
-
website: (str) => import_picocolors.default.whiteBright(str),
|
|
1320
|
-
optional: (str) => import_picocolors.default.gray(str)
|
|
1321
|
-
};
|
|
1322
|
-
}
|
|
1323
|
-
|
|
1324
204
|
//#endregion
|
|
1325
205
|
//#region lib/core/sanitize.ts
|
|
1326
206
|
/**
|
|
@@ -1346,7 +226,8 @@ function sanitizeName(name, style) {
|
|
|
1346
226
|
const templateTypes = [
|
|
1347
227
|
"minimal",
|
|
1348
228
|
"demo",
|
|
1349
|
-
"library"
|
|
229
|
+
"library",
|
|
230
|
+
"addon"
|
|
1350
231
|
];
|
|
1351
232
|
const languageTypes = [
|
|
1352
233
|
"typescript",
|
|
@@ -1357,6 +238,10 @@ function create(cwd$1, options) {
|
|
|
1357
238
|
mkdirp(cwd$1);
|
|
1358
239
|
write_template_files(options.template, options.types, options.name, cwd$1);
|
|
1359
240
|
write_common_files(cwd$1, options, options.name);
|
|
241
|
+
if (options.template === "addon") {
|
|
242
|
+
fs.rmSync(path.join(cwd$1, "svelte.config.js"));
|
|
243
|
+
fs.rmSync(path.join(cwd$1, "vite.config.js"));
|
|
244
|
+
}
|
|
1360
245
|
}
|
|
1361
246
|
const templates = templateTypes.map((dir) => {
|
|
1362
247
|
const meta_file = dist(`templates/${dir}/meta.json`);
|
|
@@ -1367,15 +252,22 @@ const templates = templateTypes.map((dir) => {
|
|
|
1367
252
|
description
|
|
1368
253
|
};
|
|
1369
254
|
});
|
|
255
|
+
const kv = (name) => {
|
|
256
|
+
const protocolName = name.startsWith("@") ? name.split("/")[0] : name;
|
|
257
|
+
return {
|
|
258
|
+
"~SV-PROTOCOL-NAME-TODO~": protocolName,
|
|
259
|
+
"~SV-NAME-TODO~": name
|
|
260
|
+
};
|
|
261
|
+
};
|
|
1370
262
|
function write_template_files(template, types, name, cwd$1) {
|
|
1371
263
|
const dir = dist(`templates/${template}`);
|
|
1372
|
-
copy(`${dir}/assets`, cwd$1, (name$1) => name$1.replace("DOT-", "."));
|
|
1373
|
-
copy(`${dir}/package.json`, `${cwd$1}/package.json
|
|
264
|
+
copy(`${dir}/assets`, cwd$1, (name$1) => name$1.replace("DOT-", "."), kv(name));
|
|
265
|
+
copy(`${dir}/package.json`, `${cwd$1}/package.json`, void 0, kv(name));
|
|
1374
266
|
const manifest = `${dir}/files.types=${types}.json`;
|
|
1375
267
|
JSON.parse(fs.readFileSync(manifest, "utf-8")).forEach((file) => {
|
|
1376
268
|
const dest = path.join(cwd$1, file.name);
|
|
1377
269
|
mkdirp(path.dirname(dest));
|
|
1378
|
-
fs.writeFileSync(dest, file.contents
|
|
270
|
+
fs.writeFileSync(dest, replace(file.contents, kv(name)));
|
|
1379
271
|
});
|
|
1380
272
|
}
|
|
1381
273
|
function write_common_files(cwd$1, options, name) {
|
|
@@ -1389,7 +281,7 @@ function write_common_files(cwd$1, options, name) {
|
|
|
1389
281
|
else {
|
|
1390
282
|
const dest = path.join(cwd$1, file.name);
|
|
1391
283
|
mkdirp(path.dirname(dest));
|
|
1392
|
-
fs.writeFileSync(dest, file.contents);
|
|
284
|
+
fs.writeFileSync(dest, replace(file.contents, kv(name)));
|
|
1393
285
|
}
|
|
1394
286
|
});
|
|
1395
287
|
pkg.dependencies = sort_keys(pkg.dependencies);
|
|
@@ -1431,89 +323,13 @@ function sort_files(files) {
|
|
|
1431
323
|
});
|
|
1432
324
|
}
|
|
1433
325
|
|
|
1434
|
-
//#endregion
|
|
1435
|
-
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/resolve.mjs
|
|
1436
|
-
/**
|
|
1437
|
-
* Resolve an absolute path from {@link root}, but only
|
|
1438
|
-
* if {@link input} isn't already absolute.
|
|
1439
|
-
*
|
|
1440
|
-
* @param input The path to resolve.
|
|
1441
|
-
* @param root The base path; default = process.cwd()
|
|
1442
|
-
* @returns The resolved absolute path.
|
|
1443
|
-
*/
|
|
1444
|
-
function absolute(input, root) {
|
|
1445
|
-
return isAbsolute(input) ? input : resolve(root || ".", input);
|
|
1446
|
-
}
|
|
1447
|
-
function from(root, ident, silent) {
|
|
1448
|
-
try {
|
|
1449
|
-
return createRequire(root instanceof URL || root.startsWith("file://") ? join(fileURLToPath(root), "noop.js") : join(absolute(root), "noop.js")).resolve(ident);
|
|
1450
|
-
} catch (err) {
|
|
1451
|
-
if (!silent) throw err;
|
|
1452
|
-
}
|
|
1453
|
-
}
|
|
1454
|
-
|
|
1455
|
-
//#endregion
|
|
1456
|
-
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/walk.mjs
|
|
1457
|
-
/**
|
|
1458
|
-
* Get all parent directories of {@link base}.
|
|
1459
|
-
* Stops after {@link Options['last']} is processed.
|
|
1460
|
-
*
|
|
1461
|
-
* @returns An array of absolute paths of all parent directories.
|
|
1462
|
-
*/
|
|
1463
|
-
function up$1(base, options) {
|
|
1464
|
-
let { last, cwd: cwd$1 } = options || {};
|
|
1465
|
-
let tmp = absolute(base, cwd$1);
|
|
1466
|
-
let root = absolute(last || "/", cwd$1);
|
|
1467
|
-
let prev, arr = [];
|
|
1468
|
-
while (prev !== root) {
|
|
1469
|
-
arr.push(tmp);
|
|
1470
|
-
tmp = dirname(prev = tmp);
|
|
1471
|
-
if (tmp === prev) break;
|
|
1472
|
-
}
|
|
1473
|
-
return arr;
|
|
1474
|
-
}
|
|
1475
|
-
|
|
1476
|
-
//#endregion
|
|
1477
|
-
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/find.mjs
|
|
1478
|
-
/**
|
|
1479
|
-
* Find an item by name, walking parent directories until found.
|
|
1480
|
-
*
|
|
1481
|
-
* @param name The item name to find.
|
|
1482
|
-
* @returns The absolute path to the item, if found.
|
|
1483
|
-
*/
|
|
1484
|
-
function up(name, options) {
|
|
1485
|
-
let dir, tmp;
|
|
1486
|
-
let start = options && options.cwd || "";
|
|
1487
|
-
for (dir of up$1(start, options)) {
|
|
1488
|
-
tmp = join(dir, name);
|
|
1489
|
-
if (existsSync(tmp)) return tmp;
|
|
1490
|
-
}
|
|
1491
|
-
}
|
|
1492
|
-
/**
|
|
1493
|
-
* Get the first path that matches any of the names provided.
|
|
1494
|
-
*
|
|
1495
|
-
* > [NOTE]
|
|
1496
|
-
* > The order of {@link names} is respected.
|
|
1497
|
-
*
|
|
1498
|
-
* @param names The item names to find.
|
|
1499
|
-
* @returns The absolute path of the first item found, if any.
|
|
1500
|
-
*/
|
|
1501
|
-
function any(names, options) {
|
|
1502
|
-
let dir, start = options && options.cwd || "";
|
|
1503
|
-
let j$1 = 0, len = names.length, tmp;
|
|
1504
|
-
for (dir of up$1(start, options)) for (j$1 = 0; j$1 < len; j$1++) {
|
|
1505
|
-
tmp = join(dir, names[j$1]);
|
|
1506
|
-
if (existsSync(tmp)) return tmp;
|
|
1507
|
-
}
|
|
1508
|
-
}
|
|
1509
|
-
|
|
1510
326
|
//#endregion
|
|
1511
327
|
//#region ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/lib/error.js
|
|
1512
328
|
var require_error = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1513
329
|
/**
|
|
1514
330
|
* CommanderError class
|
|
1515
331
|
*/
|
|
1516
|
-
var CommanderError
|
|
332
|
+
var CommanderError = class extends Error {
|
|
1517
333
|
/**
|
|
1518
334
|
* Constructs the CommanderError class
|
|
1519
335
|
* @param {number} exitCode suggested exit code which could be used with process.exit
|
|
@@ -1532,7 +348,7 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1532
348
|
/**
|
|
1533
349
|
* InvalidArgumentError class
|
|
1534
350
|
*/
|
|
1535
|
-
var InvalidArgumentError
|
|
351
|
+
var InvalidArgumentError = class extends CommanderError {
|
|
1536
352
|
/**
|
|
1537
353
|
* Constructs the InvalidArgumentError class
|
|
1538
354
|
* @param {string} [message] explanation of why argument is invalid
|
|
@@ -1543,15 +359,15 @@ var require_error = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1543
359
|
this.name = this.constructor.name;
|
|
1544
360
|
}
|
|
1545
361
|
};
|
|
1546
|
-
exports.CommanderError = CommanderError
|
|
1547
|
-
exports.InvalidArgumentError = InvalidArgumentError
|
|
362
|
+
exports.CommanderError = CommanderError;
|
|
363
|
+
exports.InvalidArgumentError = InvalidArgumentError;
|
|
1548
364
|
}));
|
|
1549
365
|
|
|
1550
366
|
//#endregion
|
|
1551
367
|
//#region ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/lib/argument.js
|
|
1552
368
|
var require_argument = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1553
|
-
const { InvalidArgumentError
|
|
1554
|
-
var Argument
|
|
369
|
+
const { InvalidArgumentError } = require_error();
|
|
370
|
+
var Argument = class {
|
|
1555
371
|
/**
|
|
1556
372
|
* Initialize a new command argument with the given name and description.
|
|
1557
373
|
* The default is that the argument is required, and you can explicitly
|
|
@@ -1633,7 +449,7 @@ var require_argument = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1633
449
|
choices(values) {
|
|
1634
450
|
this.argChoices = values.slice();
|
|
1635
451
|
this.parseArg = (arg, previous) => {
|
|
1636
|
-
if (!this.argChoices.includes(arg)) throw new InvalidArgumentError
|
|
452
|
+
if (!this.argChoices.includes(arg)) throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
|
|
1637
453
|
if (this.variadic) return this._collectValue(arg, previous);
|
|
1638
454
|
return arg;
|
|
1639
455
|
};
|
|
@@ -1665,18 +481,18 @@ var require_argument = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1665
481
|
* @return {string}
|
|
1666
482
|
* @private
|
|
1667
483
|
*/
|
|
1668
|
-
function humanReadableArgName
|
|
484
|
+
function humanReadableArgName(arg) {
|
|
1669
485
|
const nameOutput = arg.name() + (arg.variadic === true ? "..." : "");
|
|
1670
486
|
return arg.required ? "<" + nameOutput + ">" : "[" + nameOutput + "]";
|
|
1671
487
|
}
|
|
1672
|
-
exports.Argument = Argument
|
|
1673
|
-
exports.humanReadableArgName = humanReadableArgName
|
|
488
|
+
exports.Argument = Argument;
|
|
489
|
+
exports.humanReadableArgName = humanReadableArgName;
|
|
1674
490
|
}));
|
|
1675
491
|
|
|
1676
492
|
//#endregion
|
|
1677
493
|
//#region ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/lib/help.js
|
|
1678
494
|
var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
1679
|
-
const { humanReadableArgName
|
|
495
|
+
const { humanReadableArgName } = require_argument();
|
|
1680
496
|
/**
|
|
1681
497
|
* TypeScript import types for JSDoc, used by Visual Studio Code IntelliSense and `npm run typescript-checkJS`
|
|
1682
498
|
* https://www.typescriptlang.org/docs/handbook/jsdoc-supported-types.html#import-types
|
|
@@ -1684,7 +500,7 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1684
500
|
* @typedef { import("./command.js").Command } Command
|
|
1685
501
|
* @typedef { import("./option.js").Option } Option
|
|
1686
502
|
*/
|
|
1687
|
-
var Help
|
|
503
|
+
var Help = class {
|
|
1688
504
|
constructor() {
|
|
1689
505
|
this.helpWidth = void 0;
|
|
1690
506
|
this.minWidthToWrap = 40;
|
|
@@ -1713,8 +529,8 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1713
529
|
const visibleCommands = cmd.commands.filter((cmd$1) => !cmd$1._hidden);
|
|
1714
530
|
const helpCommand = cmd._getHelpCommand();
|
|
1715
531
|
if (helpCommand && !helpCommand._hidden) visibleCommands.push(helpCommand);
|
|
1716
|
-
if (this.sortSubcommands) visibleCommands.sort((a, b
|
|
1717
|
-
return a.name().localeCompare(b
|
|
532
|
+
if (this.sortSubcommands) visibleCommands.sort((a, b) => {
|
|
533
|
+
return a.name().localeCompare(b.name());
|
|
1718
534
|
});
|
|
1719
535
|
return visibleCommands;
|
|
1720
536
|
}
|
|
@@ -1725,11 +541,11 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1725
541
|
* @param {Option} b
|
|
1726
542
|
* @returns {number}
|
|
1727
543
|
*/
|
|
1728
|
-
compareOptions(a, b
|
|
544
|
+
compareOptions(a, b) {
|
|
1729
545
|
const getSortKey = (option) => {
|
|
1730
546
|
return option.short ? option.short.replace(/^-/, "") : option.long.replace(/^--/, "");
|
|
1731
547
|
};
|
|
1732
|
-
return getSortKey(a).localeCompare(getSortKey(b
|
|
548
|
+
return getSortKey(a).localeCompare(getSortKey(b));
|
|
1733
549
|
}
|
|
1734
550
|
/**
|
|
1735
551
|
* Get an array of the visible options. Includes a placeholder for the implicit help option, if there is one.
|
|
@@ -1786,7 +602,7 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
1786
602
|
* @returns {string}
|
|
1787
603
|
*/
|
|
1788
604
|
subcommandTerm(cmd) {
|
|
1789
|
-
const args = cmd.registeredArguments.map((arg) => humanReadableArgName
|
|
605
|
+
const args = cmd.registeredArguments.map((arg) => humanReadableArgName(arg)).join(" ");
|
|
1790
606
|
return cmd._name + (cmd._aliases[0] ? "|" + cmd._aliases[0] : "") + (cmd.options.length ? " [options]" : "") + (args ? " " + args : "");
|
|
1791
607
|
}
|
|
1792
608
|
/**
|
|
@@ -2009,7 +825,7 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2009
825
|
* @returns {number}
|
|
2010
826
|
*/
|
|
2011
827
|
displayWidth(str) {
|
|
2012
|
-
return stripColor
|
|
828
|
+
return stripColor(str).length;
|
|
2013
829
|
}
|
|
2014
830
|
/**
|
|
2015
831
|
* Style the title for displaying in the help. Called with 'Usage:', 'Options:', etc.
|
|
@@ -2157,18 +973,18 @@ var require_help = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2157
973
|
* @returns {string}
|
|
2158
974
|
* @package
|
|
2159
975
|
*/
|
|
2160
|
-
function stripColor
|
|
976
|
+
function stripColor(str) {
|
|
2161
977
|
return str.replace(/\x1b\[\d*(;\d*)*m/g, "");
|
|
2162
978
|
}
|
|
2163
|
-
exports.Help = Help
|
|
2164
|
-
exports.stripColor = stripColor
|
|
979
|
+
exports.Help = Help;
|
|
980
|
+
exports.stripColor = stripColor;
|
|
2165
981
|
}));
|
|
2166
982
|
|
|
2167
983
|
//#endregion
|
|
2168
984
|
//#region ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/lib/option.js
|
|
2169
985
|
var require_option = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2170
|
-
const { InvalidArgumentError
|
|
2171
|
-
var Option
|
|
986
|
+
const { InvalidArgumentError } = require_error();
|
|
987
|
+
var Option = class {
|
|
2172
988
|
/**
|
|
2173
989
|
* Initialize a new `Option` with the given `flags` and `description`.
|
|
2174
990
|
*
|
|
@@ -2319,7 +1135,7 @@ var require_option = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2319
1135
|
choices(values) {
|
|
2320
1136
|
this.argChoices = values.slice();
|
|
2321
1137
|
this.parseArg = (arg, previous) => {
|
|
2322
|
-
if (!this.argChoices.includes(arg)) throw new InvalidArgumentError
|
|
1138
|
+
if (!this.argChoices.includes(arg)) throw new InvalidArgumentError(`Allowed choices are ${this.argChoices.join(", ")}.`);
|
|
2323
1139
|
if (this.variadic) return this._collectValue(arg, previous);
|
|
2324
1140
|
return arg;
|
|
2325
1141
|
};
|
|
@@ -2383,7 +1199,7 @@ var require_option = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2383
1199
|
* use cases, but is tricky for others where we want separate behaviours despite
|
|
2384
1200
|
* the single shared option value.
|
|
2385
1201
|
*/
|
|
2386
|
-
var DualOptions
|
|
1202
|
+
var DualOptions = class {
|
|
2387
1203
|
/**
|
|
2388
1204
|
* @param {Option[]} options
|
|
2389
1205
|
*/
|
|
@@ -2464,27 +1280,27 @@ var require_option = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2464
1280
|
longFlag
|
|
2465
1281
|
};
|
|
2466
1282
|
}
|
|
2467
|
-
exports.Option = Option
|
|
2468
|
-
exports.DualOptions = DualOptions
|
|
1283
|
+
exports.Option = Option;
|
|
1284
|
+
exports.DualOptions = DualOptions;
|
|
2469
1285
|
}));
|
|
2470
1286
|
|
|
2471
1287
|
//#endregion
|
|
2472
1288
|
//#region ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/lib/suggestSimilar.js
|
|
2473
1289
|
var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
2474
1290
|
const maxDistance = 3;
|
|
2475
|
-
function editDistance(a, b
|
|
2476
|
-
if (Math.abs(a.length - b
|
|
2477
|
-
const d
|
|
2478
|
-
for (let i = 0; i <= a.length; i++) d
|
|
2479
|
-
for (let j
|
|
2480
|
-
for (let j
|
|
1291
|
+
function editDistance(a, b) {
|
|
1292
|
+
if (Math.abs(a.length - b.length) > maxDistance) return Math.max(a.length, b.length);
|
|
1293
|
+
const d = [];
|
|
1294
|
+
for (let i = 0; i <= a.length; i++) d[i] = [i];
|
|
1295
|
+
for (let j = 0; j <= b.length; j++) d[0][j] = j;
|
|
1296
|
+
for (let j = 1; j <= b.length; j++) for (let i = 1; i <= a.length; i++) {
|
|
2481
1297
|
let cost = 1;
|
|
2482
|
-
if (a[i - 1] === b
|
|
1298
|
+
if (a[i - 1] === b[j - 1]) cost = 0;
|
|
2483
1299
|
else cost = 1;
|
|
2484
|
-
d
|
|
2485
|
-
if (i > 1 && j
|
|
1300
|
+
d[i][j] = Math.min(d[i - 1][j] + 1, d[i][j - 1] + 1, d[i - 1][j - 1] + cost);
|
|
1301
|
+
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);
|
|
2486
1302
|
}
|
|
2487
|
-
return d
|
|
1303
|
+
return d[a.length][b.length];
|
|
2488
1304
|
}
|
|
2489
1305
|
/**
|
|
2490
1306
|
* Find close matches, restricted to same number of edits.
|
|
@@ -2493,7 +1309,7 @@ var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2493
1309
|
* @param {string[]} candidates
|
|
2494
1310
|
* @returns {string}
|
|
2495
1311
|
*/
|
|
2496
|
-
function suggestSimilar
|
|
1312
|
+
function suggestSimilar(word, candidates) {
|
|
2497
1313
|
if (!candidates || candidates.length === 0) return "";
|
|
2498
1314
|
candidates = Array.from(new Set(candidates));
|
|
2499
1315
|
const searchingOptions = word.startsWith("--");
|
|
@@ -2515,13 +1331,13 @@ var require_suggestSimilar = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2515
1331
|
} else if (distance === bestDistance) similar.push(candidate);
|
|
2516
1332
|
}
|
|
2517
1333
|
});
|
|
2518
|
-
similar.sort((a, b
|
|
1334
|
+
similar.sort((a, b) => a.localeCompare(b));
|
|
2519
1335
|
if (searchingOptions) similar = similar.map((candidate) => `--${candidate}`);
|
|
2520
1336
|
if (similar.length > 1) return `\n(Did you mean one of ${similar.join(", ")}?)`;
|
|
2521
1337
|
if (similar.length === 1) return `\n(Did you mean ${similar[0]}?)`;
|
|
2522
1338
|
return "";
|
|
2523
1339
|
}
|
|
2524
|
-
exports.suggestSimilar = suggestSimilar
|
|
1340
|
+
exports.suggestSimilar = suggestSimilar;
|
|
2525
1341
|
}));
|
|
2526
1342
|
|
|
2527
1343
|
//#endregion
|
|
@@ -2531,13 +1347,13 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2531
1347
|
const childProcess = __require("node:child_process");
|
|
2532
1348
|
const path$1 = __require("node:path");
|
|
2533
1349
|
const fs$2 = __require("node:fs");
|
|
2534
|
-
const process$
|
|
2535
|
-
const { Argument
|
|
2536
|
-
const { CommanderError
|
|
2537
|
-
const { Help
|
|
2538
|
-
const { Option
|
|
1350
|
+
const process$1 = __require("node:process");
|
|
1351
|
+
const { Argument, humanReadableArgName } = require_argument();
|
|
1352
|
+
const { CommanderError } = require_error();
|
|
1353
|
+
const { Help, stripColor } = require_help();
|
|
1354
|
+
const { Option, DualOptions } = require_option();
|
|
2539
1355
|
const { suggestSimilar } = require_suggestSimilar();
|
|
2540
|
-
var Command
|
|
1356
|
+
var Command = class Command extends EventEmitter {
|
|
2541
1357
|
/**
|
|
2542
1358
|
* Initialize a new `Command`.
|
|
2543
1359
|
*
|
|
@@ -2583,13 +1399,13 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2583
1399
|
this._showSuggestionAfterError = true;
|
|
2584
1400
|
this._savedState = null;
|
|
2585
1401
|
this._outputConfiguration = {
|
|
2586
|
-
writeOut: (str) => process$
|
|
2587
|
-
writeErr: (str) => process$
|
|
1402
|
+
writeOut: (str) => process$1.stdout.write(str),
|
|
1403
|
+
writeErr: (str) => process$1.stderr.write(str),
|
|
2588
1404
|
outputError: (str, write) => write(str),
|
|
2589
|
-
getOutHelpWidth: () => process$
|
|
2590
|
-
getErrHelpWidth: () => process$
|
|
2591
|
-
getOutHasColors: () => useColor() ?? (process$
|
|
2592
|
-
getErrHasColors: () => useColor() ?? (process$
|
|
1405
|
+
getOutHelpWidth: () => process$1.stdout.isTTY ? process$1.stdout.columns : void 0,
|
|
1406
|
+
getErrHelpWidth: () => process$1.stderr.isTTY ? process$1.stderr.columns : void 0,
|
|
1407
|
+
getOutHasColors: () => useColor() ?? (process$1.stdout.isTTY && process$1.stdout.hasColors?.()),
|
|
1408
|
+
getErrHasColors: () => useColor() ?? (process$1.stderr.isTTY && process$1.stderr.hasColors?.()),
|
|
2593
1409
|
stripColor: (str) => stripColor(str)
|
|
2594
1410
|
};
|
|
2595
1411
|
this._hidden = false;
|
|
@@ -2695,7 +1511,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2695
1511
|
* @return {Command} new command
|
|
2696
1512
|
*/
|
|
2697
1513
|
createCommand(name) {
|
|
2698
|
-
return new Command
|
|
1514
|
+
return new Command(name);
|
|
2699
1515
|
}
|
|
2700
1516
|
/**
|
|
2701
1517
|
* You can customise the help with a subclass of Help by overriding createHelp,
|
|
@@ -2704,7 +1520,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2704
1520
|
* @return {Help}
|
|
2705
1521
|
*/
|
|
2706
1522
|
createHelp() {
|
|
2707
|
-
return Object.assign(new Help
|
|
1523
|
+
return Object.assign(new Help(), this.configureHelp());
|
|
2708
1524
|
}
|
|
2709
1525
|
/**
|
|
2710
1526
|
* You can customise the help by overriding Help properties using configureHelp(),
|
|
@@ -2800,7 +1616,7 @@ var require_command = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
2800
1616
|
* @return {Argument} new argument
|
|
2801
1617
|
*/
|
|
2802
1618
|
createArgument(name, description) {
|
|
2803
|
-
return new Argument
|
|
1619
|
+
return new Argument(name, description);
|
|
2804
1620
|
}
|
|
2805
1621
|
/**
|
|
2806
1622
|
* Define argument syntax for command.
|
|
@@ -2957,8 +1773,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2957
1773
|
* @private
|
|
2958
1774
|
*/
|
|
2959
1775
|
_exit(exitCode, code, message) {
|
|
2960
|
-
if (this._exitCallback) this._exitCallback(new CommanderError
|
|
2961
|
-
process$
|
|
1776
|
+
if (this._exitCallback) this._exitCallback(new CommanderError(exitCode, code, message));
|
|
1777
|
+
process$1.exit(exitCode);
|
|
2962
1778
|
}
|
|
2963
1779
|
/**
|
|
2964
1780
|
* Register callback `fn` for the command.
|
|
@@ -2997,7 +1813,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
2997
1813
|
* @return {Option} new option
|
|
2998
1814
|
*/
|
|
2999
1815
|
createOption(flags, description) {
|
|
3000
|
-
return new Option
|
|
1816
|
+
return new Option(flags, description);
|
|
3001
1817
|
}
|
|
3002
1818
|
/**
|
|
3003
1819
|
* Wrap parseArgs to catch 'commander.invalidArgument'.
|
|
@@ -3098,15 +1914,15 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3098
1914
|
* @private
|
|
3099
1915
|
*/
|
|
3100
1916
|
_optionEx(config, flags, description, fn, defaultValue) {
|
|
3101
|
-
if (typeof flags === "object" && flags instanceof Option
|
|
1917
|
+
if (typeof flags === "object" && flags instanceof Option) throw new Error("To add an Option object use addOption() instead of option() or requiredOption()");
|
|
3102
1918
|
const option = this.createOption(flags, description);
|
|
3103
1919
|
option.makeOptionMandatory(!!config.mandatory);
|
|
3104
1920
|
if (typeof fn === "function") option.default(defaultValue).argParser(fn);
|
|
3105
1921
|
else if (fn instanceof RegExp) {
|
|
3106
1922
|
const regex = fn;
|
|
3107
1923
|
fn = (val, def) => {
|
|
3108
|
-
const m
|
|
3109
|
-
return m
|
|
1924
|
+
const m = regex.exec(val);
|
|
1925
|
+
return m ? m[0] : def;
|
|
3110
1926
|
};
|
|
3111
1927
|
option.default(defaultValue).argParser(fn);
|
|
3112
1928
|
} else option.default(fn);
|
|
@@ -3299,11 +2115,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3299
2115
|
if (argv !== void 0 && !Array.isArray(argv)) throw new Error("first parameter to parse must be array or undefined");
|
|
3300
2116
|
parseOptions = parseOptions || {};
|
|
3301
2117
|
if (argv === void 0 && parseOptions.from === void 0) {
|
|
3302
|
-
if (process$
|
|
3303
|
-
const execArgv = process$
|
|
2118
|
+
if (process$1.versions?.electron) parseOptions.from = "electron";
|
|
2119
|
+
const execArgv = process$1.execArgv ?? [];
|
|
3304
2120
|
if (execArgv.includes("-e") || execArgv.includes("--eval") || execArgv.includes("-p") || execArgv.includes("--print")) parseOptions.from = "eval";
|
|
3305
2121
|
}
|
|
3306
|
-
if (argv === void 0) argv = process$
|
|
2122
|
+
if (argv === void 0) argv = process$1.argv;
|
|
3307
2123
|
this.rawArgs = argv.slice();
|
|
3308
2124
|
let userArgs;
|
|
3309
2125
|
switch (parseOptions.from) {
|
|
@@ -3313,7 +2129,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3313
2129
|
userArgs = argv.slice(2);
|
|
3314
2130
|
break;
|
|
3315
2131
|
case "electron":
|
|
3316
|
-
if (process$
|
|
2132
|
+
if (process$1.defaultApp) {
|
|
3317
2133
|
this._scriptPath = argv[1];
|
|
3318
2134
|
userArgs = argv.slice(2);
|
|
3319
2135
|
} else userArgs = argv.slice(1);
|
|
@@ -3478,16 +2294,16 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3478
2294
|
}
|
|
3479
2295
|
launchWithNode = sourceExt.includes(path$1.extname(executableFile));
|
|
3480
2296
|
let proc;
|
|
3481
|
-
if (process$
|
|
2297
|
+
if (process$1.platform !== "win32") if (launchWithNode) {
|
|
3482
2298
|
args.unshift(executableFile);
|
|
3483
|
-
args = incrementNodeInspectorPort(process$
|
|
3484
|
-
proc = childProcess.spawn(process$
|
|
2299
|
+
args = incrementNodeInspectorPort(process$1.execArgv).concat(args);
|
|
2300
|
+
proc = childProcess.spawn(process$1.argv[0], args, { stdio: "inherit" });
|
|
3485
2301
|
} else proc = childProcess.spawn(executableFile, args, { stdio: "inherit" });
|
|
3486
2302
|
else {
|
|
3487
2303
|
this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
3488
2304
|
args.unshift(executableFile);
|
|
3489
|
-
args = incrementNodeInspectorPort(process$
|
|
3490
|
-
proc = childProcess.spawn(process$
|
|
2305
|
+
args = incrementNodeInspectorPort(process$1.execArgv).concat(args);
|
|
2306
|
+
proc = childProcess.spawn(process$1.execPath, args, { stdio: "inherit" });
|
|
3491
2307
|
}
|
|
3492
2308
|
if (!proc.killed) [
|
|
3493
2309
|
"SIGUSR1",
|
|
@@ -3496,22 +2312,22 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3496
2312
|
"SIGINT",
|
|
3497
2313
|
"SIGHUP"
|
|
3498
2314
|
].forEach((signal) => {
|
|
3499
|
-
process$
|
|
2315
|
+
process$1.on(signal, () => {
|
|
3500
2316
|
if (proc.killed === false && proc.exitCode === null) proc.kill(signal);
|
|
3501
2317
|
});
|
|
3502
2318
|
});
|
|
3503
2319
|
const exitCallback = this._exitCallback;
|
|
3504
2320
|
proc.on("close", (code) => {
|
|
3505
2321
|
code = code ?? 1;
|
|
3506
|
-
if (!exitCallback) process$
|
|
3507
|
-
else exitCallback(new CommanderError
|
|
2322
|
+
if (!exitCallback) process$1.exit(code);
|
|
2323
|
+
else exitCallback(new CommanderError(code, "commander.executeSubCommandAsync", "(close)"));
|
|
3508
2324
|
});
|
|
3509
2325
|
proc.on("error", (err) => {
|
|
3510
2326
|
if (err.code === "ENOENT") this._checkForMissingExecutable(executableFile, executableDir, subcommand._name);
|
|
3511
2327
|
else if (err.code === "EACCES") throw new Error(`'${executableFile}' not executable`);
|
|
3512
|
-
if (!exitCallback) process$
|
|
2328
|
+
if (!exitCallback) process$1.exit(1);
|
|
3513
2329
|
else {
|
|
3514
|
-
const wrappedError = new CommanderError
|
|
2330
|
+
const wrappedError = new CommanderError(1, "commander.executeSubCommandAsync", "(error)");
|
|
3515
2331
|
wrappedError.nestedError = err;
|
|
3516
2332
|
exitCallback(wrappedError);
|
|
3517
2333
|
}
|
|
@@ -3578,8 +2394,8 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3578
2394
|
if (declaredArg.variadic) {
|
|
3579
2395
|
if (index < this.args.length) {
|
|
3580
2396
|
value = this.args.slice(index);
|
|
3581
|
-
if (declaredArg.parseArg) value = value.reduce((processed, v
|
|
3582
|
-
return myParseArg(declaredArg, v
|
|
2397
|
+
if (declaredArg.parseArg) value = value.reduce((processed, v) => {
|
|
2398
|
+
return myParseArg(declaredArg, v, processed);
|
|
3583
2399
|
}, declaredArg.defaultValue);
|
|
3584
2400
|
} else if (value === void 0) value = [];
|
|
3585
2401
|
} else if (index < this.args.length) {
|
|
@@ -3921,13 +2737,13 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
3921
2737
|
*/
|
|
3922
2738
|
_parseOptionsEnv() {
|
|
3923
2739
|
this.options.forEach((option) => {
|
|
3924
|
-
if (option.envVar && option.envVar in process$
|
|
2740
|
+
if (option.envVar && option.envVar in process$1.env) {
|
|
3925
2741
|
const optionKey = option.attributeName();
|
|
3926
2742
|
if (this.getOptionValue(optionKey) === void 0 || [
|
|
3927
2743
|
"default",
|
|
3928
2744
|
"config",
|
|
3929
2745
|
"env"
|
|
3930
|
-
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$
|
|
2746
|
+
].includes(this.getOptionValueSource(optionKey))) if (option.required || option.optional) this.emit(`optionEnv:${option.name()}`, process$1.env[option.envVar]);
|
|
3931
2747
|
else this.emit(`optionEnv:${option.name()}`);
|
|
3932
2748
|
}
|
|
3933
2749
|
});
|
|
@@ -4406,7 +3222,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4406
3222
|
*/
|
|
4407
3223
|
help(contextOptions) {
|
|
4408
3224
|
this.outputHelp(contextOptions);
|
|
4409
|
-
let exitCode = Number(process$
|
|
3225
|
+
let exitCode = Number(process$1.exitCode ?? 0);
|
|
4410
3226
|
if (exitCode === 0 && contextOptions && typeof contextOptions !== "function" && contextOptions.error) exitCode = 1;
|
|
4411
3227
|
this._exit(exitCode, "commander.help", "(outputHelp)");
|
|
4412
3228
|
}
|
|
@@ -4496,35 +3312,35 @@ Expecting one of '${allowedValues.join("', '")}'`);
|
|
|
4496
3312
|
* @package
|
|
4497
3313
|
*/
|
|
4498
3314
|
function useColor() {
|
|
4499
|
-
if (process$
|
|
4500
|
-
if (process$
|
|
3315
|
+
if (process$1.env.NO_COLOR || process$1.env.FORCE_COLOR === "0" || process$1.env.FORCE_COLOR === "false") return false;
|
|
3316
|
+
if (process$1.env.FORCE_COLOR || process$1.env.CLICOLOR_FORCE !== void 0) return true;
|
|
4501
3317
|
}
|
|
4502
|
-
exports.Command = Command
|
|
3318
|
+
exports.Command = Command;
|
|
4503
3319
|
exports.useColor = useColor;
|
|
4504
3320
|
}));
|
|
4505
3321
|
|
|
4506
3322
|
//#endregion
|
|
4507
3323
|
//#region ../../node_modules/.pnpm/commander@14.0.2/node_modules/commander/index.js
|
|
4508
3324
|
var require_commander = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
4509
|
-
const { Argument
|
|
4510
|
-
const { Command
|
|
4511
|
-
const { CommanderError
|
|
4512
|
-
const { Help
|
|
4513
|
-
const { Option
|
|
4514
|
-
exports.program = new Command
|
|
4515
|
-
exports.createCommand = (name) => new Command
|
|
4516
|
-
exports.createOption = (flags, description) => new Option
|
|
4517
|
-
exports.createArgument = (name, description) => new Argument
|
|
3325
|
+
const { Argument } = require_argument();
|
|
3326
|
+
const { Command } = require_command();
|
|
3327
|
+
const { CommanderError, InvalidArgumentError } = require_error();
|
|
3328
|
+
const { Help } = require_help();
|
|
3329
|
+
const { Option } = require_option();
|
|
3330
|
+
exports.program = new Command();
|
|
3331
|
+
exports.createCommand = (name) => new Command(name);
|
|
3332
|
+
exports.createOption = (flags, description) => new Option(flags, description);
|
|
3333
|
+
exports.createArgument = (name, description) => new Argument(name, description);
|
|
4518
3334
|
/**
|
|
4519
3335
|
* Expose classes
|
|
4520
3336
|
*/
|
|
4521
|
-
exports.Command = Command
|
|
4522
|
-
exports.Option = Option
|
|
4523
|
-
exports.Argument = Argument
|
|
4524
|
-
exports.Help = Help
|
|
4525
|
-
exports.CommanderError = CommanderError
|
|
4526
|
-
exports.InvalidArgumentError = InvalidArgumentError
|
|
4527
|
-
exports.InvalidOptionArgumentError = InvalidArgumentError
|
|
3337
|
+
exports.Command = Command;
|
|
3338
|
+
exports.Option = Option;
|
|
3339
|
+
exports.Argument = Argument;
|
|
3340
|
+
exports.Help = Help;
|
|
3341
|
+
exports.CommanderError = CommanderError;
|
|
3342
|
+
exports.InvalidArgumentError = InvalidArgumentError;
|
|
3343
|
+
exports.InvalidOptionArgumentError = InvalidArgumentError;
|
|
4528
3344
|
}));
|
|
4529
3345
|
|
|
4530
3346
|
//#endregion
|
|
@@ -4532,6 +3348,82 @@ var require_commander = /* @__PURE__ */ __commonJSMin(((exports) => {
|
|
|
4532
3348
|
var import_commander = /* @__PURE__ */ __toESM(require_commander(), 1);
|
|
4533
3349
|
const { program, createCommand, createArgument, createOption, CommanderError, InvalidArgumentError, InvalidOptionArgumentError, Command, Argument, Option, Help } = import_commander.default;
|
|
4534
3350
|
|
|
3351
|
+
//#endregion
|
|
3352
|
+
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/resolve.mjs
|
|
3353
|
+
/**
|
|
3354
|
+
* Resolve an absolute path from {@link root}, but only
|
|
3355
|
+
* if {@link input} isn't already absolute.
|
|
3356
|
+
*
|
|
3357
|
+
* @param input The path to resolve.
|
|
3358
|
+
* @param root The base path; default = process.cwd()
|
|
3359
|
+
* @returns The resolved absolute path.
|
|
3360
|
+
*/
|
|
3361
|
+
function absolute(input, root) {
|
|
3362
|
+
return isAbsolute(input) ? input : resolve(root || ".", input);
|
|
3363
|
+
}
|
|
3364
|
+
function from(root, ident, silent) {
|
|
3365
|
+
try {
|
|
3366
|
+
return createRequire(root instanceof URL || root.startsWith("file://") ? join(fileURLToPath(root), "noop.js") : join(absolute(root), "noop.js")).resolve(ident);
|
|
3367
|
+
} catch (err) {
|
|
3368
|
+
if (!silent) throw err;
|
|
3369
|
+
}
|
|
3370
|
+
}
|
|
3371
|
+
|
|
3372
|
+
//#endregion
|
|
3373
|
+
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/walk.mjs
|
|
3374
|
+
/**
|
|
3375
|
+
* Get all parent directories of {@link base}.
|
|
3376
|
+
* Stops after {@link Options['last']} is processed.
|
|
3377
|
+
*
|
|
3378
|
+
* @returns An array of absolute paths of all parent directories.
|
|
3379
|
+
*/
|
|
3380
|
+
function up$1(base, options) {
|
|
3381
|
+
let { last, cwd: cwd$1 } = options || {};
|
|
3382
|
+
let tmp = absolute(base, cwd$1);
|
|
3383
|
+
let root = absolute(last || "/", cwd$1);
|
|
3384
|
+
let prev, arr = [];
|
|
3385
|
+
while (prev !== root) {
|
|
3386
|
+
arr.push(tmp);
|
|
3387
|
+
tmp = dirname(prev = tmp);
|
|
3388
|
+
if (tmp === prev) break;
|
|
3389
|
+
}
|
|
3390
|
+
return arr;
|
|
3391
|
+
}
|
|
3392
|
+
|
|
3393
|
+
//#endregion
|
|
3394
|
+
//#region ../../node_modules/.pnpm/empathic@2.0.0/node_modules/empathic/find.mjs
|
|
3395
|
+
/**
|
|
3396
|
+
* Find an item by name, walking parent directories until found.
|
|
3397
|
+
*
|
|
3398
|
+
* @param name The item name to find.
|
|
3399
|
+
* @returns The absolute path to the item, if found.
|
|
3400
|
+
*/
|
|
3401
|
+
function up(name, options) {
|
|
3402
|
+
let dir, tmp;
|
|
3403
|
+
let start = options && options.cwd || "";
|
|
3404
|
+
for (dir of up$1(start, options)) {
|
|
3405
|
+
tmp = join(dir, name);
|
|
3406
|
+
if (existsSync(tmp)) return tmp;
|
|
3407
|
+
}
|
|
3408
|
+
}
|
|
3409
|
+
/**
|
|
3410
|
+
* Get the first path that matches any of the names provided.
|
|
3411
|
+
*
|
|
3412
|
+
* > [NOTE]
|
|
3413
|
+
* > The order of {@link names} is respected.
|
|
3414
|
+
*
|
|
3415
|
+
* @param names The item names to find.
|
|
3416
|
+
* @returns The absolute path of the first item found, if any.
|
|
3417
|
+
*/
|
|
3418
|
+
function any(names, options) {
|
|
3419
|
+
let dir, start = options && options.cwd || "";
|
|
3420
|
+
let j = 0, len = names.length, tmp;
|
|
3421
|
+
for (dir of up$1(start, options)) for (j = 0; j < len; j++) {
|
|
3422
|
+
tmp = join(dir, names[j]);
|
|
3423
|
+
if (existsSync(tmp)) return tmp;
|
|
3424
|
+
}
|
|
3425
|
+
}
|
|
3426
|
+
|
|
4535
3427
|
//#endregion
|
|
4536
3428
|
//#region lib/cli/utils/package-manager.ts
|
|
4537
3429
|
const AGENT_NAMES = AGENTS.filter((agent) => !agent.includes("@"));
|
|
@@ -4546,7 +3438,7 @@ agentOptions.unshift({
|
|
|
4546
3438
|
const installOption = new Option("--install <package-manager>", "installs dependencies with a specified package manager").choices(AGENT_NAMES);
|
|
4547
3439
|
async function packageManagerPrompt(cwd$1) {
|
|
4548
3440
|
const agent = (await detect({ cwd: cwd$1 }))?.name ?? getUserAgent();
|
|
4549
|
-
if (!process
|
|
3441
|
+
if (!process.stdout.isTTY) return agent;
|
|
4550
3442
|
const pm = await ze({
|
|
4551
3443
|
message: "Which package manager do you want to install dependencies with?",
|
|
4552
3444
|
options: agentOptions,
|
|
@@ -4554,15 +3446,14 @@ async function packageManagerPrompt(cwd$1) {
|
|
|
4554
3446
|
});
|
|
4555
3447
|
if (Vu(pm)) {
|
|
4556
3448
|
De("Operation cancelled.");
|
|
4557
|
-
process
|
|
3449
|
+
process.exit(1);
|
|
4558
3450
|
}
|
|
4559
3451
|
return pm;
|
|
4560
3452
|
}
|
|
4561
3453
|
async function installDependencies(agent, cwd$1) {
|
|
4562
|
-
const highlighter = getHighlighter();
|
|
4563
3454
|
const task = Ze({
|
|
4564
|
-
title: `Installing dependencies with ${
|
|
4565
|
-
limit: Math.ceil(process
|
|
3455
|
+
title: `Installing dependencies with ${color.command(agent)}...`,
|
|
3456
|
+
limit: Math.ceil(process.stdout.rows / 2),
|
|
4566
3457
|
spacing: 0,
|
|
4567
3458
|
retainLog: true
|
|
4568
3459
|
});
|
|
@@ -4576,15 +3467,15 @@ async function installDependencies(agent, cwd$1) {
|
|
|
4576
3467
|
throwOnError: true
|
|
4577
3468
|
});
|
|
4578
3469
|
for await (const line of proc) task.message(line, { raw: true });
|
|
4579
|
-
task.success(`Successfully installed dependencies with ${
|
|
3470
|
+
task.success(`Successfully installed dependencies with ${color.command(agent)}`);
|
|
4580
3471
|
} catch {
|
|
4581
3472
|
task.error("Failed to install dependencies");
|
|
4582
3473
|
De("Operation failed.");
|
|
4583
|
-
process
|
|
3474
|
+
process.exit(2);
|
|
4584
3475
|
}
|
|
4585
3476
|
}
|
|
4586
3477
|
function getUserAgent() {
|
|
4587
|
-
const userAgent = process
|
|
3478
|
+
const userAgent = process.env.npm_config_user_agent;
|
|
4588
3479
|
if (!userAgent) return void 0;
|
|
4589
3480
|
const pmSpec = userAgent.split(" ")[0];
|
|
4590
3481
|
const separatorPos = pmSpec.lastIndexOf("/");
|
|
@@ -4599,11 +3490,11 @@ async function addPnpmBuildDependencies(cwd$1, packageManager, allowedPackages)
|
|
|
4599
3490
|
const found = up("pnpm-workspace.yaml", { cwd: cwd$1 });
|
|
4600
3491
|
if (confIn === "pnpm-workspace.yaml") {
|
|
4601
3492
|
const content = found ? fs.readFileSync(found, "utf-8") : "";
|
|
4602
|
-
const { data, generateCode } =
|
|
3493
|
+
const { data, generateCode } = parse.yaml(content);
|
|
4603
3494
|
const items = data.get("onlyBuiltDependencies")?.items ?? [];
|
|
4604
3495
|
for (const item of allowedPackages) {
|
|
4605
3496
|
if (items.includes(item)) continue;
|
|
4606
|
-
if (items.some((y
|
|
3497
|
+
if (items.some((y) => typeof y === "object" && y.value === item)) continue;
|
|
4607
3498
|
items.push(item);
|
|
4608
3499
|
}
|
|
4609
3500
|
data.set("onlyBuiltDependencies", items);
|
|
@@ -4614,7 +3505,7 @@ async function addPnpmBuildDependencies(cwd$1, packageManager, allowedPackages)
|
|
|
4614
3505
|
const rootDir = found ? path.dirname(found) : cwd$1;
|
|
4615
3506
|
const pkgPath = path.join(rootDir, "package.json");
|
|
4616
3507
|
const content = fs.readFileSync(pkgPath, "utf-8");
|
|
4617
|
-
const { data, generateCode } =
|
|
3508
|
+
const { data, generateCode } = parse.json(content);
|
|
4618
3509
|
data.pnpm ??= {};
|
|
4619
3510
|
data.pnpm.onlyBuiltDependencies ??= [];
|
|
4620
3511
|
for (const allowedPackage of allowedPackages) {
|
|
@@ -4626,12 +3517,12 @@ async function addPnpmBuildDependencies(cwd$1, packageManager, allowedPackages)
|
|
|
4626
3517
|
}
|
|
4627
3518
|
}
|
|
4628
3519
|
async function getPnpmVersion() {
|
|
4629
|
-
let v
|
|
3520
|
+
let v = void 0;
|
|
4630
3521
|
try {
|
|
4631
|
-
v
|
|
3522
|
+
v = (await q("pnpm", ["--version"], { throwOnError: true })).stdout.trim();
|
|
4632
3523
|
} catch {}
|
|
4633
|
-
return v
|
|
3524
|
+
return v;
|
|
4634
3525
|
}
|
|
4635
3526
|
|
|
4636
3527
|
//#endregion
|
|
4637
|
-
export {
|
|
3528
|
+
export { dist as _, installOption as a, up as c, Option as d, program as f, detect as g, sanitizeName as h, installDependencies as i, from as l, templates as m, addPnpmBuildDependencies as n, packageManagerPrompt as o, create as p, getUserAgent as r, any as s, AGENT_NAMES as t, Command as u, getSharedFiles as v };
|