create-vuetify 2.3.1 → 2.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +10 -3
- package/dist/index.mjs +1704 -137
- package/package.json +27 -29
- package/template/javascript/base/eslint.config.js +1 -23
- package/template/javascript/base/package.json +5 -9
- package/template/javascript/base/src/components/HelloWorld.vue +42 -109
- package/template/javascript/base/src/router/index.js +0 -1
- package/template/javascript/base/vite.config.mjs +24 -9
- package/template/javascript/default/package.json +11 -11
- package/template/javascript/default/src/components/AppFooter.vue +6 -3
- package/template/javascript/default/src/components/HelloWorld.vue +41 -108
- package/template/javascript/default/src/main.js +3 -0
- package/template/javascript/default/vite.config.mjs +18 -9
- package/template/javascript/essentials/_eslintrc-auto-import.json +11 -1
- package/template/javascript/essentials/package.json +3 -3
- package/template/javascript/essentials/src/layouts/README.md +1 -1
- package/template/javascript/essentials/vite.config.mjs +20 -4
- package/template/typescript/base/eslint.config.js +1 -36
- package/template/typescript/base/package.json +4 -9
- package/template/typescript/base/src/components/HelloWorld.vue +42 -109
- package/template/typescript/base/vite.config.mts +28 -9
- package/template/typescript/default/README.md +1 -1
- package/template/typescript/default/package.json +13 -15
- package/template/typescript/default/src/components/HelloWorld.vue +41 -108
- package/template/typescript/default/src/main.ts +3 -0
- package/template/typescript/default/vite.config.mts +16 -7
- package/template/typescript/essentials/_eslintrc-auto-import.json +13 -0
- package/template/typescript/essentials/env.d.ts +1 -1
- package/template/typescript/essentials/package.json +3 -3
- package/template/typescript/essentials/src/auto-imports.d.ts +16 -66
- package/template/typescript/essentials/src/components/AppFooter.vue +6 -3
- package/template/typescript/essentials/src/layouts/README.md +1 -1
- package/template/typescript/essentials/vite.config.mts +25 -8
- package/template/typescript/nuxt/assets/logo.png +0 -0
- package/template/typescript/nuxt/assets/logo.svg +6 -0
- package/template/typescript/nuxt/components/AppFooter.vue +38 -35
- package/template/typescript/nuxt/components/HelloWorld.vue +44 -107
- package/template/typescript/nuxt/modules/vuetify.ts +35 -10
- package/template/typescript/nuxt/pages/index.vue +0 -1
- package/template/typescript/nuxt/plugins/vuetify-nuxt.ts +2 -2
- package/template/typescript/nuxt/plugins/vuetify.ts +1 -1
- package/dist/output.cjs +0 -303
package/dist/index.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
// src/index.ts
|
|
2
|
-
import { dirname as
|
|
2
|
+
import { dirname as dirname3, join as join3, resolve as resolve5 } from "path";
|
|
3
3
|
import { fileURLToPath } from "url";
|
|
4
4
|
import { mkdirSync as mkdirSync2, rmSync, writeFileSync as writeFileSync2 } from "fs";
|
|
5
5
|
|
|
6
6
|
// src/utils/prompts.ts
|
|
7
|
-
import {
|
|
8
|
-
import { existsSync, readdirSync } from "fs";
|
|
7
|
+
import { join as join2, resolve as resolve3 } from "path";
|
|
8
|
+
import { existsSync as existsSync2, readdirSync } from "fs";
|
|
9
9
|
|
|
10
10
|
// src/utils/presets.ts
|
|
11
11
|
var defaultContext = {
|
|
@@ -34,6 +34,1498 @@ var presets = {
|
|
|
34
34
|
// src/utils/prompts.ts
|
|
35
35
|
import { red } from "kolorist";
|
|
36
36
|
import prompts from "prompts";
|
|
37
|
+
|
|
38
|
+
// node_modules/.pnpm/pathe@2.0.3/node_modules/pathe/dist/shared/pathe.M-eThtNZ.mjs
|
|
39
|
+
var _DRIVE_LETTER_START_RE = /^[A-Za-z]:\//;
|
|
40
|
+
function normalizeWindowsPath(input = "") {
|
|
41
|
+
if (!input) {
|
|
42
|
+
return input;
|
|
43
|
+
}
|
|
44
|
+
return input.replace(/\\/g, "/").replace(_DRIVE_LETTER_START_RE, (r) => r.toUpperCase());
|
|
45
|
+
}
|
|
46
|
+
var _UNC_REGEX = /^[/\\]{2}/;
|
|
47
|
+
var _IS_ABSOLUTE_RE = /^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/;
|
|
48
|
+
var _DRIVE_LETTER_RE = /^[A-Za-z]:$/;
|
|
49
|
+
var normalize = function(path4) {
|
|
50
|
+
if (path4.length === 0) {
|
|
51
|
+
return ".";
|
|
52
|
+
}
|
|
53
|
+
path4 = normalizeWindowsPath(path4);
|
|
54
|
+
const isUNCPath = path4.match(_UNC_REGEX);
|
|
55
|
+
const isPathAbsolute = isAbsolute(path4);
|
|
56
|
+
const trailingSeparator = path4[path4.length - 1] === "/";
|
|
57
|
+
path4 = normalizeString(path4, !isPathAbsolute);
|
|
58
|
+
if (path4.length === 0) {
|
|
59
|
+
if (isPathAbsolute) {
|
|
60
|
+
return "/";
|
|
61
|
+
}
|
|
62
|
+
return trailingSeparator ? "./" : ".";
|
|
63
|
+
}
|
|
64
|
+
if (trailingSeparator) {
|
|
65
|
+
path4 += "/";
|
|
66
|
+
}
|
|
67
|
+
if (_DRIVE_LETTER_RE.test(path4)) {
|
|
68
|
+
path4 += "/";
|
|
69
|
+
}
|
|
70
|
+
if (isUNCPath) {
|
|
71
|
+
if (!isPathAbsolute) {
|
|
72
|
+
return `//./${path4}`;
|
|
73
|
+
}
|
|
74
|
+
return `//${path4}`;
|
|
75
|
+
}
|
|
76
|
+
return isPathAbsolute && !isAbsolute(path4) ? `/${path4}` : path4;
|
|
77
|
+
};
|
|
78
|
+
var join = function(...segments) {
|
|
79
|
+
let path4 = "";
|
|
80
|
+
for (const seg of segments) {
|
|
81
|
+
if (!seg) {
|
|
82
|
+
continue;
|
|
83
|
+
}
|
|
84
|
+
if (path4.length > 0) {
|
|
85
|
+
const pathTrailing = path4[path4.length - 1] === "/";
|
|
86
|
+
const segLeading = seg[0] === "/";
|
|
87
|
+
const both = pathTrailing && segLeading;
|
|
88
|
+
if (both) {
|
|
89
|
+
path4 += seg.slice(1);
|
|
90
|
+
} else {
|
|
91
|
+
path4 += pathTrailing || segLeading ? seg : `/${seg}`;
|
|
92
|
+
}
|
|
93
|
+
} else {
|
|
94
|
+
path4 += seg;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return normalize(path4);
|
|
98
|
+
};
|
|
99
|
+
function cwd() {
|
|
100
|
+
if (typeof process !== "undefined" && typeof process.cwd === "function") {
|
|
101
|
+
return process.cwd().replace(/\\/g, "/");
|
|
102
|
+
}
|
|
103
|
+
return "/";
|
|
104
|
+
}
|
|
105
|
+
var resolve = function(...arguments_) {
|
|
106
|
+
arguments_ = arguments_.map((argument) => normalizeWindowsPath(argument));
|
|
107
|
+
let resolvedPath = "";
|
|
108
|
+
let resolvedAbsolute = false;
|
|
109
|
+
for (let index = arguments_.length - 1; index >= -1 && !resolvedAbsolute; index--) {
|
|
110
|
+
const path4 = index >= 0 ? arguments_[index] : cwd();
|
|
111
|
+
if (!path4 || path4.length === 0) {
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
resolvedPath = `${path4}/${resolvedPath}`;
|
|
115
|
+
resolvedAbsolute = isAbsolute(path4);
|
|
116
|
+
}
|
|
117
|
+
resolvedPath = normalizeString(resolvedPath, !resolvedAbsolute);
|
|
118
|
+
if (resolvedAbsolute && !isAbsolute(resolvedPath)) {
|
|
119
|
+
return `/${resolvedPath}`;
|
|
120
|
+
}
|
|
121
|
+
return resolvedPath.length > 0 ? resolvedPath : ".";
|
|
122
|
+
};
|
|
123
|
+
function normalizeString(path4, allowAboveRoot) {
|
|
124
|
+
let res = "";
|
|
125
|
+
let lastSegmentLength = 0;
|
|
126
|
+
let lastSlash = -1;
|
|
127
|
+
let dots = 0;
|
|
128
|
+
let char = null;
|
|
129
|
+
for (let index = 0; index <= path4.length; ++index) {
|
|
130
|
+
if (index < path4.length) {
|
|
131
|
+
char = path4[index];
|
|
132
|
+
} else if (char === "/") {
|
|
133
|
+
break;
|
|
134
|
+
} else {
|
|
135
|
+
char = "/";
|
|
136
|
+
}
|
|
137
|
+
if (char === "/") {
|
|
138
|
+
if (lastSlash === index - 1 || dots === 1) ;
|
|
139
|
+
else if (dots === 2) {
|
|
140
|
+
if (res.length < 2 || lastSegmentLength !== 2 || res[res.length - 1] !== "." || res[res.length - 2] !== ".") {
|
|
141
|
+
if (res.length > 2) {
|
|
142
|
+
const lastSlashIndex = res.lastIndexOf("/");
|
|
143
|
+
if (lastSlashIndex === -1) {
|
|
144
|
+
res = "";
|
|
145
|
+
lastSegmentLength = 0;
|
|
146
|
+
} else {
|
|
147
|
+
res = res.slice(0, lastSlashIndex);
|
|
148
|
+
lastSegmentLength = res.length - 1 - res.lastIndexOf("/");
|
|
149
|
+
}
|
|
150
|
+
lastSlash = index;
|
|
151
|
+
dots = 0;
|
|
152
|
+
continue;
|
|
153
|
+
} else if (res.length > 0) {
|
|
154
|
+
res = "";
|
|
155
|
+
lastSegmentLength = 0;
|
|
156
|
+
lastSlash = index;
|
|
157
|
+
dots = 0;
|
|
158
|
+
continue;
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
if (allowAboveRoot) {
|
|
162
|
+
res += res.length > 0 ? "/.." : "..";
|
|
163
|
+
lastSegmentLength = 2;
|
|
164
|
+
}
|
|
165
|
+
} else {
|
|
166
|
+
if (res.length > 0) {
|
|
167
|
+
res += `/${path4.slice(lastSlash + 1, index)}`;
|
|
168
|
+
} else {
|
|
169
|
+
res = path4.slice(lastSlash + 1, index);
|
|
170
|
+
}
|
|
171
|
+
lastSegmentLength = index - lastSlash - 1;
|
|
172
|
+
}
|
|
173
|
+
lastSlash = index;
|
|
174
|
+
dots = 0;
|
|
175
|
+
} else if (char === "." && dots !== -1) {
|
|
176
|
+
++dots;
|
|
177
|
+
} else {
|
|
178
|
+
dots = -1;
|
|
179
|
+
}
|
|
180
|
+
}
|
|
181
|
+
return res;
|
|
182
|
+
}
|
|
183
|
+
var isAbsolute = function(p) {
|
|
184
|
+
return _IS_ABSOLUTE_RE.test(p);
|
|
185
|
+
};
|
|
186
|
+
|
|
187
|
+
// node_modules/.pnpm/tinyexec@0.3.2/node_modules/tinyexec/dist/main.js
|
|
188
|
+
import { createRequire as __tinyexec_cr } from "node:module";
|
|
189
|
+
import { spawn as de } from "child_process";
|
|
190
|
+
import { normalize as fe } from "path";
|
|
191
|
+
import { cwd as he } from "process";
|
|
192
|
+
import {
|
|
193
|
+
delimiter as N,
|
|
194
|
+
resolve as qt,
|
|
195
|
+
dirname as It
|
|
196
|
+
} from "path";
|
|
197
|
+
import { PassThrough as zt } from "stream";
|
|
198
|
+
import me from "readline";
|
|
199
|
+
var require2 = __tinyexec_cr(import.meta.url);
|
|
200
|
+
var St = Object.create;
|
|
201
|
+
var $ = Object.defineProperty;
|
|
202
|
+
var kt = Object.getOwnPropertyDescriptor;
|
|
203
|
+
var Tt = Object.getOwnPropertyNames;
|
|
204
|
+
var At = Object.getPrototypeOf;
|
|
205
|
+
var Rt = Object.prototype.hasOwnProperty;
|
|
206
|
+
var h = /* @__PURE__ */ ((t) => typeof require2 < "u" ? require2 : typeof Proxy < "u" ? new Proxy(t, {
|
|
207
|
+
get: (e, n) => (typeof require2 < "u" ? require2 : e)[n]
|
|
208
|
+
}) : t)(function(t) {
|
|
209
|
+
if (typeof require2 < "u") return require2.apply(this, arguments);
|
|
210
|
+
throw Error('Dynamic require of "' + t + '" is not supported');
|
|
211
|
+
});
|
|
212
|
+
var l = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
|
|
213
|
+
var $t = (t, e, n, r) => {
|
|
214
|
+
if (e && typeof e == "object" || typeof e == "function")
|
|
215
|
+
for (let s of Tt(e))
|
|
216
|
+
!Rt.call(t, s) && s !== n && $(t, s, { get: () => e[s], enumerable: !(r = kt(e, s)) || r.enumerable });
|
|
217
|
+
return t;
|
|
218
|
+
};
|
|
219
|
+
var Nt = (t, e, n) => (n = t != null ? St(At(t)) : {}, $t(
|
|
220
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
221
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
222
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
223
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
224
|
+
e || !t || !t.__esModule ? $(n, "default", { value: t, enumerable: true }) : n,
|
|
225
|
+
t
|
|
226
|
+
));
|
|
227
|
+
var W = l((Se, H) => {
|
|
228
|
+
"use strict";
|
|
229
|
+
H.exports = z;
|
|
230
|
+
z.sync = Wt;
|
|
231
|
+
var j = h("fs");
|
|
232
|
+
function Ht(t, e) {
|
|
233
|
+
var n = e.pathExt !== void 0 ? e.pathExt : process.env.PATHEXT;
|
|
234
|
+
if (!n || (n = n.split(";"), n.indexOf("") !== -1))
|
|
235
|
+
return true;
|
|
236
|
+
for (var r = 0; r < n.length; r++) {
|
|
237
|
+
var s = n[r].toLowerCase();
|
|
238
|
+
if (s && t.substr(-s.length).toLowerCase() === s)
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
return false;
|
|
242
|
+
}
|
|
243
|
+
function F(t, e, n) {
|
|
244
|
+
return !t.isSymbolicLink() && !t.isFile() ? false : Ht(e, n);
|
|
245
|
+
}
|
|
246
|
+
function z(t, e, n) {
|
|
247
|
+
j.stat(t, function(r, s) {
|
|
248
|
+
n(r, r ? false : F(s, t, e));
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
function Wt(t, e) {
|
|
252
|
+
return F(j.statSync(t), t, e);
|
|
253
|
+
}
|
|
254
|
+
});
|
|
255
|
+
var X = l((ke, B) => {
|
|
256
|
+
"use strict";
|
|
257
|
+
B.exports = K;
|
|
258
|
+
K.sync = Dt;
|
|
259
|
+
var D = h("fs");
|
|
260
|
+
function K(t, e, n) {
|
|
261
|
+
D.stat(t, function(r, s) {
|
|
262
|
+
n(r, r ? false : M(s, e));
|
|
263
|
+
});
|
|
264
|
+
}
|
|
265
|
+
function Dt(t, e) {
|
|
266
|
+
return M(D.statSync(t), e);
|
|
267
|
+
}
|
|
268
|
+
function M(t, e) {
|
|
269
|
+
return t.isFile() && Kt(t, e);
|
|
270
|
+
}
|
|
271
|
+
function Kt(t, e) {
|
|
272
|
+
var n = t.mode, r = t.uid, s = t.gid, o = e.uid !== void 0 ? e.uid : process.getuid && process.getuid(), i = e.gid !== void 0 ? e.gid : process.getgid && process.getgid(), a = parseInt("100", 8), c = parseInt("010", 8), u = parseInt("001", 8), f = a | c, p = n & u || n & c && s === i || n & a && r === o || n & f && o === 0;
|
|
273
|
+
return p;
|
|
274
|
+
}
|
|
275
|
+
});
|
|
276
|
+
var U = l((Ae, G) => {
|
|
277
|
+
"use strict";
|
|
278
|
+
var Te = h("fs"), v;
|
|
279
|
+
process.platform === "win32" || global.TESTING_WINDOWS ? v = W() : v = X();
|
|
280
|
+
G.exports = y;
|
|
281
|
+
y.sync = Mt;
|
|
282
|
+
function y(t, e, n) {
|
|
283
|
+
if (typeof e == "function" && (n = e, e = {}), !n) {
|
|
284
|
+
if (typeof Promise != "function")
|
|
285
|
+
throw new TypeError("callback not provided");
|
|
286
|
+
return new Promise(function(r, s) {
|
|
287
|
+
y(t, e || {}, function(o, i) {
|
|
288
|
+
o ? s(o) : r(i);
|
|
289
|
+
});
|
|
290
|
+
});
|
|
291
|
+
}
|
|
292
|
+
v(t, e || {}, function(r, s) {
|
|
293
|
+
r && (r.code === "EACCES" || e && e.ignoreErrors) && (r = null, s = false), n(r, s);
|
|
294
|
+
});
|
|
295
|
+
}
|
|
296
|
+
function Mt(t, e) {
|
|
297
|
+
try {
|
|
298
|
+
return v.sync(t, e || {});
|
|
299
|
+
} catch (n) {
|
|
300
|
+
if (e && e.ignoreErrors || n.code === "EACCES")
|
|
301
|
+
return false;
|
|
302
|
+
throw n;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
});
|
|
306
|
+
var et = l((Re, tt) => {
|
|
307
|
+
"use strict";
|
|
308
|
+
var g = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", Y = h("path"), Bt = g ? ";" : ":", V = U(), J = (t) => Object.assign(new Error(`not found: ${t}`), { code: "ENOENT" }), Q = (t, e) => {
|
|
309
|
+
let n = e.colon || Bt, r = t.match(/\//) || g && t.match(/\\/) ? [""] : [
|
|
310
|
+
// windows always checks the cwd first
|
|
311
|
+
...g ? [process.cwd()] : [],
|
|
312
|
+
...(e.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
313
|
+
"").split(n)
|
|
314
|
+
], s = g ? e.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "", o = g ? s.split(n) : [""];
|
|
315
|
+
return g && t.indexOf(".") !== -1 && o[0] !== "" && o.unshift(""), {
|
|
316
|
+
pathEnv: r,
|
|
317
|
+
pathExt: o,
|
|
318
|
+
pathExtExe: s
|
|
319
|
+
};
|
|
320
|
+
}, Z = (t, e, n) => {
|
|
321
|
+
typeof e == "function" && (n = e, e = {}), e || (e = {});
|
|
322
|
+
let { pathEnv: r, pathExt: s, pathExtExe: o } = Q(t, e), i = [], a = (u) => new Promise((f, p) => {
|
|
323
|
+
if (u === r.length)
|
|
324
|
+
return e.all && i.length ? f(i) : p(J(t));
|
|
325
|
+
let d = r[u], w = /^".*"$/.test(d) ? d.slice(1, -1) : d, m = Y.join(w, t), b = !w && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + m : m;
|
|
326
|
+
f(c(b, u, 0));
|
|
327
|
+
}), c = (u, f, p) => new Promise((d, w) => {
|
|
328
|
+
if (p === s.length)
|
|
329
|
+
return d(a(f + 1));
|
|
330
|
+
let m = s[p];
|
|
331
|
+
V(u + m, { pathExt: o }, (b, Ot) => {
|
|
332
|
+
if (!b && Ot)
|
|
333
|
+
if (e.all)
|
|
334
|
+
i.push(u + m);
|
|
335
|
+
else
|
|
336
|
+
return d(u + m);
|
|
337
|
+
return d(c(u, f, p + 1));
|
|
338
|
+
});
|
|
339
|
+
});
|
|
340
|
+
return n ? a(0).then((u) => n(null, u), n) : a(0);
|
|
341
|
+
}, Xt = (t, e) => {
|
|
342
|
+
e = e || {};
|
|
343
|
+
let { pathEnv: n, pathExt: r, pathExtExe: s } = Q(t, e), o = [];
|
|
344
|
+
for (let i = 0; i < n.length; i++) {
|
|
345
|
+
let a = n[i], c = /^".*"$/.test(a) ? a.slice(1, -1) : a, u = Y.join(c, t), f = !c && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + u : u;
|
|
346
|
+
for (let p = 0; p < r.length; p++) {
|
|
347
|
+
let d = f + r[p];
|
|
348
|
+
try {
|
|
349
|
+
if (V.sync(d, { pathExt: s }))
|
|
350
|
+
if (e.all)
|
|
351
|
+
o.push(d);
|
|
352
|
+
else
|
|
353
|
+
return d;
|
|
354
|
+
} catch {
|
|
355
|
+
}
|
|
356
|
+
}
|
|
357
|
+
}
|
|
358
|
+
if (e.all && o.length)
|
|
359
|
+
return o;
|
|
360
|
+
if (e.nothrow)
|
|
361
|
+
return null;
|
|
362
|
+
throw J(t);
|
|
363
|
+
};
|
|
364
|
+
tt.exports = Z;
|
|
365
|
+
Z.sync = Xt;
|
|
366
|
+
});
|
|
367
|
+
var rt = l(($e, _) => {
|
|
368
|
+
"use strict";
|
|
369
|
+
var nt = (t = {}) => {
|
|
370
|
+
let e = t.env || process.env;
|
|
371
|
+
return (t.platform || process.platform) !== "win32" ? "PATH" : Object.keys(e).reverse().find((r) => r.toUpperCase() === "PATH") || "Path";
|
|
372
|
+
};
|
|
373
|
+
_.exports = nt;
|
|
374
|
+
_.exports.default = nt;
|
|
375
|
+
});
|
|
376
|
+
var ct = l((Ne, it) => {
|
|
377
|
+
"use strict";
|
|
378
|
+
var st = h("path"), Gt = et(), Ut = rt();
|
|
379
|
+
function ot(t, e) {
|
|
380
|
+
let n = t.options.env || process.env, r = process.cwd(), s = t.options.cwd != null, o = s && process.chdir !== void 0 && !process.chdir.disabled;
|
|
381
|
+
if (o)
|
|
382
|
+
try {
|
|
383
|
+
process.chdir(t.options.cwd);
|
|
384
|
+
} catch {
|
|
385
|
+
}
|
|
386
|
+
let i;
|
|
387
|
+
try {
|
|
388
|
+
i = Gt.sync(t.command, {
|
|
389
|
+
path: n[Ut({ env: n })],
|
|
390
|
+
pathExt: e ? st.delimiter : void 0
|
|
391
|
+
});
|
|
392
|
+
} catch {
|
|
393
|
+
} finally {
|
|
394
|
+
o && process.chdir(r);
|
|
395
|
+
}
|
|
396
|
+
return i && (i = st.resolve(s ? t.options.cwd : "", i)), i;
|
|
397
|
+
}
|
|
398
|
+
function Yt(t) {
|
|
399
|
+
return ot(t) || ot(t, true);
|
|
400
|
+
}
|
|
401
|
+
it.exports = Yt;
|
|
402
|
+
});
|
|
403
|
+
var ut = l((qe, P) => {
|
|
404
|
+
"use strict";
|
|
405
|
+
var C = /([()\][%!^"`<>&|;, *?])/g;
|
|
406
|
+
function Vt(t) {
|
|
407
|
+
return t = t.replace(C, "^$1"), t;
|
|
408
|
+
}
|
|
409
|
+
function Jt(t, e) {
|
|
410
|
+
return t = `${t}`, t = t.replace(/(\\*)"/g, '$1$1\\"'), t = t.replace(/(\\*)$/, "$1$1"), t = `"${t}"`, t = t.replace(C, "^$1"), e && (t = t.replace(C, "^$1")), t;
|
|
411
|
+
}
|
|
412
|
+
P.exports.command = Vt;
|
|
413
|
+
P.exports.argument = Jt;
|
|
414
|
+
});
|
|
415
|
+
var lt = l((Ie, at) => {
|
|
416
|
+
"use strict";
|
|
417
|
+
at.exports = /^#!(.*)/;
|
|
418
|
+
});
|
|
419
|
+
var dt = l((Le, pt) => {
|
|
420
|
+
"use strict";
|
|
421
|
+
var Qt = lt();
|
|
422
|
+
pt.exports = (t = "") => {
|
|
423
|
+
let e = t.match(Qt);
|
|
424
|
+
if (!e)
|
|
425
|
+
return null;
|
|
426
|
+
let [n, r] = e[0].replace(/#! ?/, "").split(" "), s = n.split("/").pop();
|
|
427
|
+
return s === "env" ? r : r ? `${s} ${r}` : s;
|
|
428
|
+
};
|
|
429
|
+
});
|
|
430
|
+
var ht = l((je, ft) => {
|
|
431
|
+
"use strict";
|
|
432
|
+
var O = h("fs"), Zt = dt();
|
|
433
|
+
function te(t) {
|
|
434
|
+
let n = Buffer.alloc(150), r;
|
|
435
|
+
try {
|
|
436
|
+
r = O.openSync(t, "r"), O.readSync(r, n, 0, 150, 0), O.closeSync(r);
|
|
437
|
+
} catch {
|
|
438
|
+
}
|
|
439
|
+
return Zt(n.toString());
|
|
440
|
+
}
|
|
441
|
+
ft.exports = te;
|
|
442
|
+
});
|
|
443
|
+
var wt = l((Fe, Et) => {
|
|
444
|
+
"use strict";
|
|
445
|
+
var ee = h("path"), mt = ct(), gt = ut(), ne = ht(), re = process.platform === "win32", se = /\.(?:com|exe)$/i, oe = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
446
|
+
function ie(t) {
|
|
447
|
+
t.file = mt(t);
|
|
448
|
+
let e = t.file && ne(t.file);
|
|
449
|
+
return e ? (t.args.unshift(t.file), t.command = e, mt(t)) : t.file;
|
|
450
|
+
}
|
|
451
|
+
function ce(t) {
|
|
452
|
+
if (!re)
|
|
453
|
+
return t;
|
|
454
|
+
let e = ie(t), n = !se.test(e);
|
|
455
|
+
if (t.options.forceShell || n) {
|
|
456
|
+
let r = oe.test(e);
|
|
457
|
+
t.command = ee.normalize(t.command), t.command = gt.command(t.command), t.args = t.args.map((o) => gt.argument(o, r));
|
|
458
|
+
let s = [t.command].concat(t.args).join(" ");
|
|
459
|
+
t.args = ["/d", "/s", "/c", `"${s}"`], t.command = process.env.comspec || "cmd.exe", t.options.windowsVerbatimArguments = true;
|
|
460
|
+
}
|
|
461
|
+
return t;
|
|
462
|
+
}
|
|
463
|
+
function ue(t, e, n) {
|
|
464
|
+
e && !Array.isArray(e) && (n = e, e = null), e = e ? e.slice(0) : [], n = Object.assign({}, n);
|
|
465
|
+
let r = {
|
|
466
|
+
command: t,
|
|
467
|
+
args: e,
|
|
468
|
+
options: n,
|
|
469
|
+
file: void 0,
|
|
470
|
+
original: {
|
|
471
|
+
command: t,
|
|
472
|
+
args: e
|
|
473
|
+
}
|
|
474
|
+
};
|
|
475
|
+
return n.shell ? r : ce(r);
|
|
476
|
+
}
|
|
477
|
+
Et.exports = ue;
|
|
478
|
+
});
|
|
479
|
+
var bt = l((ze, vt) => {
|
|
480
|
+
"use strict";
|
|
481
|
+
var S = process.platform === "win32";
|
|
482
|
+
function k(t, e) {
|
|
483
|
+
return Object.assign(new Error(`${e} ${t.command} ENOENT`), {
|
|
484
|
+
code: "ENOENT",
|
|
485
|
+
errno: "ENOENT",
|
|
486
|
+
syscall: `${e} ${t.command}`,
|
|
487
|
+
path: t.command,
|
|
488
|
+
spawnargs: t.args
|
|
489
|
+
});
|
|
490
|
+
}
|
|
491
|
+
function ae(t, e) {
|
|
492
|
+
if (!S)
|
|
493
|
+
return;
|
|
494
|
+
let n = t.emit;
|
|
495
|
+
t.emit = function(r, s) {
|
|
496
|
+
if (r === "exit") {
|
|
497
|
+
let o = xt(s, e, "spawn");
|
|
498
|
+
if (o)
|
|
499
|
+
return n.call(t, "error", o);
|
|
500
|
+
}
|
|
501
|
+
return n.apply(t, arguments);
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
function xt(t, e) {
|
|
505
|
+
return S && t === 1 && !e.file ? k(e.original, "spawn") : null;
|
|
506
|
+
}
|
|
507
|
+
function le(t, e) {
|
|
508
|
+
return S && t === 1 && !e.file ? k(e.original, "spawnSync") : null;
|
|
509
|
+
}
|
|
510
|
+
vt.exports = {
|
|
511
|
+
hookChildProcess: ae,
|
|
512
|
+
verifyENOENT: xt,
|
|
513
|
+
verifyENOENTSync: le,
|
|
514
|
+
notFoundError: k
|
|
515
|
+
};
|
|
516
|
+
});
|
|
517
|
+
var Ct = l((He, E) => {
|
|
518
|
+
"use strict";
|
|
519
|
+
var yt = h("child_process"), T = wt(), A = bt();
|
|
520
|
+
function _t(t, e, n) {
|
|
521
|
+
let r = T(t, e, n), s = yt.spawn(r.command, r.args, r.options);
|
|
522
|
+
return A.hookChildProcess(s, r), s;
|
|
523
|
+
}
|
|
524
|
+
function pe(t, e, n) {
|
|
525
|
+
let r = T(t, e, n), s = yt.spawnSync(r.command, r.args, r.options);
|
|
526
|
+
return s.error = s.error || A.verifyENOENTSync(s.status, r), s;
|
|
527
|
+
}
|
|
528
|
+
E.exports = _t;
|
|
529
|
+
E.exports.spawn = _t;
|
|
530
|
+
E.exports.sync = pe;
|
|
531
|
+
E.exports._parse = T;
|
|
532
|
+
E.exports._enoent = A;
|
|
533
|
+
});
|
|
534
|
+
var Lt = /^path$/i;
|
|
535
|
+
var q = { key: "PATH", value: "" };
|
|
536
|
+
function jt(t) {
|
|
537
|
+
for (let e in t) {
|
|
538
|
+
if (!Object.prototype.hasOwnProperty.call(t, e) || !Lt.test(e))
|
|
539
|
+
continue;
|
|
540
|
+
let n = t[e];
|
|
541
|
+
return n ? { key: e, value: n } : q;
|
|
542
|
+
}
|
|
543
|
+
return q;
|
|
544
|
+
}
|
|
545
|
+
function Ft(t, e) {
|
|
546
|
+
let n = e.value.split(N), r = t, s;
|
|
547
|
+
do
|
|
548
|
+
n.push(qt(r, "node_modules", ".bin")), s = r, r = It(r);
|
|
549
|
+
while (r !== s);
|
|
550
|
+
return { key: e.key, value: n.join(N) };
|
|
551
|
+
}
|
|
552
|
+
function I(t, e) {
|
|
553
|
+
let n = {
|
|
554
|
+
...process.env,
|
|
555
|
+
...e
|
|
556
|
+
}, r = Ft(t, jt(n));
|
|
557
|
+
return n[r.key] = r.value, n;
|
|
558
|
+
}
|
|
559
|
+
var L = (t) => {
|
|
560
|
+
let e = t.length, n = new zt(), r = () => {
|
|
561
|
+
--e === 0 && n.emit("end");
|
|
562
|
+
};
|
|
563
|
+
for (let s of t)
|
|
564
|
+
s.pipe(n, { end: false }), s.on("end", r);
|
|
565
|
+
return n;
|
|
566
|
+
};
|
|
567
|
+
var Pt = Nt(Ct(), 1);
|
|
568
|
+
var x = class extends Error {
|
|
569
|
+
result;
|
|
570
|
+
output;
|
|
571
|
+
get exitCode() {
|
|
572
|
+
if (this.result.exitCode !== null)
|
|
573
|
+
return this.result.exitCode;
|
|
574
|
+
}
|
|
575
|
+
constructor(e, n) {
|
|
576
|
+
super(`Process exited with non-zero status (${e.exitCode})`), this.result = e, this.output = n;
|
|
577
|
+
}
|
|
578
|
+
};
|
|
579
|
+
var ge = {
|
|
580
|
+
timeout: void 0,
|
|
581
|
+
persist: false
|
|
582
|
+
};
|
|
583
|
+
var Ee = {
|
|
584
|
+
windowsHide: true
|
|
585
|
+
};
|
|
586
|
+
function we(t, e) {
|
|
587
|
+
return {
|
|
588
|
+
command: fe(t),
|
|
589
|
+
args: e ?? []
|
|
590
|
+
};
|
|
591
|
+
}
|
|
592
|
+
function xe(t) {
|
|
593
|
+
let e = new AbortController();
|
|
594
|
+
for (let n of t) {
|
|
595
|
+
if (n.aborted)
|
|
596
|
+
return e.abort(), n;
|
|
597
|
+
let r = () => {
|
|
598
|
+
e.abort(n.reason);
|
|
599
|
+
};
|
|
600
|
+
n.addEventListener("abort", r, {
|
|
601
|
+
signal: e.signal
|
|
602
|
+
});
|
|
603
|
+
}
|
|
604
|
+
return e.signal;
|
|
605
|
+
}
|
|
606
|
+
var R = class {
|
|
607
|
+
_process;
|
|
608
|
+
_aborted = false;
|
|
609
|
+
_options;
|
|
610
|
+
_command;
|
|
611
|
+
_args;
|
|
612
|
+
_resolveClose;
|
|
613
|
+
_processClosed;
|
|
614
|
+
_thrownError;
|
|
615
|
+
get process() {
|
|
616
|
+
return this._process;
|
|
617
|
+
}
|
|
618
|
+
get pid() {
|
|
619
|
+
return this._process?.pid;
|
|
620
|
+
}
|
|
621
|
+
get exitCode() {
|
|
622
|
+
if (this._process && this._process.exitCode !== null)
|
|
623
|
+
return this._process.exitCode;
|
|
624
|
+
}
|
|
625
|
+
constructor(e, n, r) {
|
|
626
|
+
this._options = {
|
|
627
|
+
...ge,
|
|
628
|
+
...r
|
|
629
|
+
}, this._command = e, this._args = n ?? [], this._processClosed = new Promise((s) => {
|
|
630
|
+
this._resolveClose = s;
|
|
631
|
+
});
|
|
632
|
+
}
|
|
633
|
+
kill(e) {
|
|
634
|
+
return this._process?.kill(e) === true;
|
|
635
|
+
}
|
|
636
|
+
get aborted() {
|
|
637
|
+
return this._aborted;
|
|
638
|
+
}
|
|
639
|
+
get killed() {
|
|
640
|
+
return this._process?.killed === true;
|
|
641
|
+
}
|
|
642
|
+
pipe(e, n, r) {
|
|
643
|
+
return be(e, n, {
|
|
644
|
+
...r,
|
|
645
|
+
stdin: this
|
|
646
|
+
});
|
|
647
|
+
}
|
|
648
|
+
async *[Symbol.asyncIterator]() {
|
|
649
|
+
let e = this._process;
|
|
650
|
+
if (!e)
|
|
651
|
+
return;
|
|
652
|
+
let n = [];
|
|
653
|
+
this._streamErr && n.push(this._streamErr), this._streamOut && n.push(this._streamOut);
|
|
654
|
+
let r = L(n), s = me.createInterface({
|
|
655
|
+
input: r
|
|
656
|
+
});
|
|
657
|
+
for await (let o of s)
|
|
658
|
+
yield o.toString();
|
|
659
|
+
if (await this._processClosed, e.removeAllListeners(), this._thrownError)
|
|
660
|
+
throw this._thrownError;
|
|
661
|
+
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0)
|
|
662
|
+
throw new x(this);
|
|
663
|
+
}
|
|
664
|
+
async _waitForOutput() {
|
|
665
|
+
let e = this._process;
|
|
666
|
+
if (!e)
|
|
667
|
+
throw new Error("No process was started");
|
|
668
|
+
let n = "", r = "";
|
|
669
|
+
if (this._streamOut)
|
|
670
|
+
for await (let o of this._streamOut)
|
|
671
|
+
r += o.toString();
|
|
672
|
+
if (this._streamErr)
|
|
673
|
+
for await (let o of this._streamErr)
|
|
674
|
+
n += o.toString();
|
|
675
|
+
if (await this._processClosed, this._options?.stdin && await this._options.stdin, e.removeAllListeners(), this._thrownError)
|
|
676
|
+
throw this._thrownError;
|
|
677
|
+
let s = {
|
|
678
|
+
stderr: n,
|
|
679
|
+
stdout: r,
|
|
680
|
+
exitCode: this.exitCode
|
|
681
|
+
};
|
|
682
|
+
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0)
|
|
683
|
+
throw new x(this, s);
|
|
684
|
+
return s;
|
|
685
|
+
}
|
|
686
|
+
then(e, n) {
|
|
687
|
+
return this._waitForOutput().then(e, n);
|
|
688
|
+
}
|
|
689
|
+
_streamOut;
|
|
690
|
+
_streamErr;
|
|
691
|
+
spawn() {
|
|
692
|
+
let e = he(), n = this._options, r = {
|
|
693
|
+
...Ee,
|
|
694
|
+
...n.nodeOptions
|
|
695
|
+
}, s = [];
|
|
696
|
+
this._resetState(), n.timeout !== void 0 && s.push(AbortSignal.timeout(n.timeout)), n.signal !== void 0 && s.push(n.signal), n.persist === true && (r.detached = true), s.length > 0 && (r.signal = xe(s)), r.env = I(e, r.env);
|
|
697
|
+
let { command: o, args: i } = we(this._command, this._args), a = (0, Pt._parse)(o, i, r), c = de(
|
|
698
|
+
a.command,
|
|
699
|
+
a.args,
|
|
700
|
+
a.options
|
|
701
|
+
);
|
|
702
|
+
if (c.stderr && (this._streamErr = c.stderr), c.stdout && (this._streamOut = c.stdout), this._process = c, c.once("error", this._onError), c.once("close", this._onClose), n.stdin !== void 0 && c.stdin && n.stdin.process) {
|
|
703
|
+
let { stdout: u } = n.stdin.process;
|
|
704
|
+
u && u.pipe(c.stdin);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
_resetState() {
|
|
708
|
+
this._aborted = false, this._processClosed = new Promise((e) => {
|
|
709
|
+
this._resolveClose = e;
|
|
710
|
+
}), this._thrownError = void 0;
|
|
711
|
+
}
|
|
712
|
+
_onError = (e) => {
|
|
713
|
+
if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) {
|
|
714
|
+
this._aborted = true;
|
|
715
|
+
return;
|
|
716
|
+
}
|
|
717
|
+
this._thrownError = e;
|
|
718
|
+
};
|
|
719
|
+
_onClose = () => {
|
|
720
|
+
this._resolveClose && this._resolveClose();
|
|
721
|
+
};
|
|
722
|
+
};
|
|
723
|
+
var ve = (t, e, n) => {
|
|
724
|
+
let r = new R(t, e, n);
|
|
725
|
+
return r.spawn(), r;
|
|
726
|
+
};
|
|
727
|
+
var be = ve;
|
|
728
|
+
|
|
729
|
+
// node_modules/.pnpm/nypm@0.6.0/node_modules/nypm/dist/shared/nypm.Bcw9TJOu.mjs
|
|
730
|
+
import { existsSync } from "node:fs";
|
|
731
|
+
import { readFile } from "node:fs/promises";
|
|
732
|
+
async function findup(cwd2, match, options = {}) {
|
|
733
|
+
const segments = normalize(cwd2).split("/");
|
|
734
|
+
while (segments.length > 0) {
|
|
735
|
+
const path4 = segments.join("/") || "/";
|
|
736
|
+
const result = await match(path4);
|
|
737
|
+
if (result || !options.includeParentDirs) {
|
|
738
|
+
return result;
|
|
739
|
+
}
|
|
740
|
+
segments.pop();
|
|
741
|
+
}
|
|
742
|
+
}
|
|
743
|
+
function cached(fn) {
|
|
744
|
+
let v;
|
|
745
|
+
return () => {
|
|
746
|
+
if (v === void 0) {
|
|
747
|
+
v = fn().then((r) => {
|
|
748
|
+
v = r;
|
|
749
|
+
return v;
|
|
750
|
+
});
|
|
751
|
+
}
|
|
752
|
+
return v;
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
var hasCorepack = cached(async () => {
|
|
756
|
+
if (globalThis.process?.versions?.webcontainer) {
|
|
757
|
+
return false;
|
|
758
|
+
}
|
|
759
|
+
try {
|
|
760
|
+
const { exitCode } = await ve("corepack", ["--version"]);
|
|
761
|
+
return exitCode === 0;
|
|
762
|
+
} catch {
|
|
763
|
+
return false;
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
async function executeCommand(command, args, options = {}) {
|
|
767
|
+
const xArgs = command === "npm" || command === "bun" || command === "deno" || !await hasCorepack() ? [command, args] : ["corepack", [command, ...args]];
|
|
768
|
+
const { exitCode, stdout, stderr } = await ve(xArgs[0], xArgs[1], {
|
|
769
|
+
nodeOptions: {
|
|
770
|
+
cwd: resolve(options.cwd || process.cwd()),
|
|
771
|
+
stdio: options.silent ? "pipe" : "inherit"
|
|
772
|
+
}
|
|
773
|
+
});
|
|
774
|
+
if (exitCode !== 0) {
|
|
775
|
+
throw new Error(
|
|
776
|
+
`\`${xArgs.flat().join(" ")}\` failed.${options.silent ? ["", stdout, stderr].join("\n") : ""}`
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
}
|
|
780
|
+
var NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG = "No package manager auto-detected.";
|
|
781
|
+
async function resolveOperationOptions(options = {}) {
|
|
782
|
+
const cwd2 = options.cwd || process.cwd();
|
|
783
|
+
const packageManager2 = (typeof options.packageManager === "string" ? packageManagers.find((pm) => pm.name === options.packageManager) : options.packageManager) || await detectPackageManager(options.cwd || process.cwd());
|
|
784
|
+
if (!packageManager2) {
|
|
785
|
+
throw new Error(NO_PACKAGE_MANAGER_DETECTED_ERROR_MSG);
|
|
786
|
+
}
|
|
787
|
+
return {
|
|
788
|
+
cwd: cwd2,
|
|
789
|
+
silent: options.silent ?? false,
|
|
790
|
+
packageManager: packageManager2,
|
|
791
|
+
dev: options.dev ?? false,
|
|
792
|
+
workspace: options.workspace,
|
|
793
|
+
global: options.global ?? false
|
|
794
|
+
};
|
|
795
|
+
}
|
|
796
|
+
function parsePackageManagerField(packageManager2) {
|
|
797
|
+
const [name, _version] = (packageManager2 || "").split("@");
|
|
798
|
+
const [version, buildMeta] = _version?.split("+") || [];
|
|
799
|
+
if (name && name !== "-" && /^(@[a-z0-9-~][a-z0-9-._~]*\/)?[a-z0-9-~][a-z0-9-._~]*$/.test(name)) {
|
|
800
|
+
return { name, version, buildMeta };
|
|
801
|
+
}
|
|
802
|
+
const sanitized = name.replace(/\W+/g, "");
|
|
803
|
+
const warnings = [
|
|
804
|
+
`Abnormal characters found in \`packageManager\` field, sanitizing from \`${name}\` to \`${sanitized}\``
|
|
805
|
+
];
|
|
806
|
+
return {
|
|
807
|
+
name: sanitized,
|
|
808
|
+
version,
|
|
809
|
+
buildMeta,
|
|
810
|
+
warnings
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
var packageManagers = [
|
|
814
|
+
{
|
|
815
|
+
name: "npm",
|
|
816
|
+
command: "npm",
|
|
817
|
+
lockFile: "package-lock.json"
|
|
818
|
+
},
|
|
819
|
+
{
|
|
820
|
+
name: "pnpm",
|
|
821
|
+
command: "pnpm",
|
|
822
|
+
lockFile: "pnpm-lock.yaml",
|
|
823
|
+
files: ["pnpm-workspace.yaml"]
|
|
824
|
+
},
|
|
825
|
+
{
|
|
826
|
+
name: "bun",
|
|
827
|
+
command: "bun",
|
|
828
|
+
lockFile: ["bun.lockb", "bun.lock"]
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
name: "yarn",
|
|
832
|
+
command: "yarn",
|
|
833
|
+
lockFile: "yarn.lock",
|
|
834
|
+
files: [".yarnrc.yml"]
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
name: "deno",
|
|
838
|
+
command: "deno",
|
|
839
|
+
lockFile: "deno.lock",
|
|
840
|
+
files: ["deno.json"]
|
|
841
|
+
}
|
|
842
|
+
];
|
|
843
|
+
async function detectPackageManager(cwd2, options = {}) {
|
|
844
|
+
const detected = await findup(
|
|
845
|
+
resolve(cwd2 || "."),
|
|
846
|
+
async (path4) => {
|
|
847
|
+
if (!options.ignorePackageJSON) {
|
|
848
|
+
const packageJSONPath = join(path4, "package.json");
|
|
849
|
+
if (existsSync(packageJSONPath)) {
|
|
850
|
+
const packageJSON = JSON.parse(
|
|
851
|
+
await readFile(packageJSONPath, "utf8")
|
|
852
|
+
);
|
|
853
|
+
if (packageJSON?.packageManager) {
|
|
854
|
+
const {
|
|
855
|
+
name,
|
|
856
|
+
version = "0.0.0",
|
|
857
|
+
buildMeta,
|
|
858
|
+
warnings
|
|
859
|
+
} = parsePackageManagerField(packageJSON.packageManager);
|
|
860
|
+
if (name) {
|
|
861
|
+
const majorVersion = version.split(".")[0];
|
|
862
|
+
const packageManager2 = packageManagers.find(
|
|
863
|
+
(pm) => pm.name === name && pm.majorVersion === majorVersion
|
|
864
|
+
) || packageManagers.find((pm) => pm.name === name);
|
|
865
|
+
return {
|
|
866
|
+
name,
|
|
867
|
+
command: name,
|
|
868
|
+
version,
|
|
869
|
+
majorVersion,
|
|
870
|
+
buildMeta,
|
|
871
|
+
warnings,
|
|
872
|
+
files: packageManager2?.files,
|
|
873
|
+
lockFile: packageManager2?.lockFile
|
|
874
|
+
};
|
|
875
|
+
}
|
|
876
|
+
}
|
|
877
|
+
}
|
|
878
|
+
const denoJSONPath = join(path4, "deno.json");
|
|
879
|
+
if (existsSync(denoJSONPath)) {
|
|
880
|
+
return packageManagers.find((pm) => pm.name === "deno");
|
|
881
|
+
}
|
|
882
|
+
}
|
|
883
|
+
if (!options.ignoreLockFile) {
|
|
884
|
+
for (const packageManager2 of packageManagers) {
|
|
885
|
+
const detectionsFiles = [
|
|
886
|
+
packageManager2.lockFile,
|
|
887
|
+
packageManager2.files
|
|
888
|
+
].flat().filter(Boolean);
|
|
889
|
+
if (detectionsFiles.some((file) => existsSync(resolve(path4, file)))) {
|
|
890
|
+
return {
|
|
891
|
+
...packageManager2
|
|
892
|
+
};
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
}
|
|
896
|
+
},
|
|
897
|
+
{
|
|
898
|
+
includeParentDirs: options.includeParentDirs ?? true
|
|
899
|
+
}
|
|
900
|
+
);
|
|
901
|
+
if (!detected && !options.ignoreArgv) {
|
|
902
|
+
const scriptArg = process.argv[1];
|
|
903
|
+
if (scriptArg) {
|
|
904
|
+
for (const packageManager2 of packageManagers) {
|
|
905
|
+
const re = new RegExp(`[/\\\\]\\.?${packageManager2.command}`);
|
|
906
|
+
if (re.test(scriptArg)) {
|
|
907
|
+
return packageManager2;
|
|
908
|
+
}
|
|
909
|
+
}
|
|
910
|
+
}
|
|
911
|
+
}
|
|
912
|
+
return detected;
|
|
913
|
+
}
|
|
914
|
+
async function installDependencies(options = {}) {
|
|
915
|
+
const resolvedOptions = await resolveOperationOptions(options);
|
|
916
|
+
const pmToFrozenLockfileInstallCommand = {
|
|
917
|
+
npm: ["ci"],
|
|
918
|
+
yarn: ["install", "--immutable"],
|
|
919
|
+
bun: ["install", "--frozen-lockfile"],
|
|
920
|
+
pnpm: ["install", "--frozen-lockfile"],
|
|
921
|
+
deno: ["install", "--frozen"]
|
|
922
|
+
};
|
|
923
|
+
const commandArgs = options.frozenLockFile ? pmToFrozenLockfileInstallCommand[resolvedOptions.packageManager.name] : ["install"];
|
|
924
|
+
await executeCommand(resolvedOptions.packageManager.command, commandArgs, {
|
|
925
|
+
cwd: resolvedOptions.cwd,
|
|
926
|
+
silent: resolvedOptions.silent
|
|
927
|
+
});
|
|
928
|
+
}
|
|
929
|
+
|
|
930
|
+
// node_modules/.pnpm/tinyexec@1.0.1/node_modules/tinyexec/dist/main.js
|
|
931
|
+
import { createRequire as __tinyexec_cr2 } from "node:module";
|
|
932
|
+
import { spawn as de2 } from "child_process";
|
|
933
|
+
import { normalize as fe2 } from "path";
|
|
934
|
+
import { cwd as he2 } from "process";
|
|
935
|
+
import {
|
|
936
|
+
delimiter as N2,
|
|
937
|
+
resolve as qt2,
|
|
938
|
+
dirname as It2
|
|
939
|
+
} from "path";
|
|
940
|
+
import { PassThrough as zt2 } from "stream";
|
|
941
|
+
import me2 from "readline";
|
|
942
|
+
var require3 = __tinyexec_cr2(import.meta.url);
|
|
943
|
+
var St2 = Object.create;
|
|
944
|
+
var $2 = Object.defineProperty;
|
|
945
|
+
var kt2 = Object.getOwnPropertyDescriptor;
|
|
946
|
+
var Tt2 = Object.getOwnPropertyNames;
|
|
947
|
+
var At2 = Object.getPrototypeOf;
|
|
948
|
+
var Rt2 = Object.prototype.hasOwnProperty;
|
|
949
|
+
var h2 = /* @__PURE__ */ ((t) => typeof require3 < "u" ? require3 : typeof Proxy < "u" ? new Proxy(t, {
|
|
950
|
+
get: (e, n) => (typeof require3 < "u" ? require3 : e)[n]
|
|
951
|
+
}) : t)(function(t) {
|
|
952
|
+
if (typeof require3 < "u") return require3.apply(this, arguments);
|
|
953
|
+
throw Error('Dynamic require of "' + t + '" is not supported');
|
|
954
|
+
});
|
|
955
|
+
var l2 = (t, e) => () => (e || t((e = { exports: {} }).exports, e), e.exports);
|
|
956
|
+
var $t2 = (t, e, n, r) => {
|
|
957
|
+
if (e && typeof e == "object" || typeof e == "function")
|
|
958
|
+
for (let s of Tt2(e))
|
|
959
|
+
!Rt2.call(t, s) && s !== n && $2(t, s, { get: () => e[s], enumerable: !(r = kt2(e, s)) || r.enumerable });
|
|
960
|
+
return t;
|
|
961
|
+
};
|
|
962
|
+
var Nt2 = (t, e, n) => (n = t != null ? St2(At2(t)) : {}, $t2(
|
|
963
|
+
// If the importer is in node compatibility mode or this is not an ESM
|
|
964
|
+
// file that has been converted to a CommonJS file using a Babel-
|
|
965
|
+
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
966
|
+
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
967
|
+
e || !t || !t.__esModule ? $2(n, "default", { value: t, enumerable: true }) : n,
|
|
968
|
+
t
|
|
969
|
+
));
|
|
970
|
+
var W2 = l2((Se, H) => {
|
|
971
|
+
"use strict";
|
|
972
|
+
H.exports = z;
|
|
973
|
+
z.sync = Wt;
|
|
974
|
+
var j = h2("fs");
|
|
975
|
+
function Ht(t, e) {
|
|
976
|
+
var n = e.pathExt !== void 0 ? e.pathExt : process.env.PATHEXT;
|
|
977
|
+
if (!n || (n = n.split(";"), n.indexOf("") !== -1))
|
|
978
|
+
return true;
|
|
979
|
+
for (var r = 0; r < n.length; r++) {
|
|
980
|
+
var s = n[r].toLowerCase();
|
|
981
|
+
if (s && t.substr(-s.length).toLowerCase() === s)
|
|
982
|
+
return true;
|
|
983
|
+
}
|
|
984
|
+
return false;
|
|
985
|
+
}
|
|
986
|
+
function F(t, e, n) {
|
|
987
|
+
return !t.isSymbolicLink() && !t.isFile() ? false : Ht(e, n);
|
|
988
|
+
}
|
|
989
|
+
function z(t, e, n) {
|
|
990
|
+
j.stat(t, function(r, s) {
|
|
991
|
+
n(r, r ? false : F(s, t, e));
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
function Wt(t, e) {
|
|
995
|
+
return F(j.statSync(t), t, e);
|
|
996
|
+
}
|
|
997
|
+
});
|
|
998
|
+
var X2 = l2((ke, B) => {
|
|
999
|
+
"use strict";
|
|
1000
|
+
B.exports = K;
|
|
1001
|
+
K.sync = Dt;
|
|
1002
|
+
var D = h2("fs");
|
|
1003
|
+
function K(t, e, n) {
|
|
1004
|
+
D.stat(t, function(r, s) {
|
|
1005
|
+
n(r, r ? false : M(s, e));
|
|
1006
|
+
});
|
|
1007
|
+
}
|
|
1008
|
+
function Dt(t, e) {
|
|
1009
|
+
return M(D.statSync(t), e);
|
|
1010
|
+
}
|
|
1011
|
+
function M(t, e) {
|
|
1012
|
+
return t.isFile() && Kt(t, e);
|
|
1013
|
+
}
|
|
1014
|
+
function Kt(t, e) {
|
|
1015
|
+
var n = t.mode, r = t.uid, s = t.gid, o = e.uid !== void 0 ? e.uid : process.getuid && process.getuid(), i = e.gid !== void 0 ? e.gid : process.getgid && process.getgid(), a = parseInt("100", 8), c = parseInt("010", 8), u = parseInt("001", 8), f = a | c, p = n & u || n & c && s === i || n & a && r === o || n & f && o === 0;
|
|
1016
|
+
return p;
|
|
1017
|
+
}
|
|
1018
|
+
});
|
|
1019
|
+
var U2 = l2((Ae, G) => {
|
|
1020
|
+
"use strict";
|
|
1021
|
+
var Te = h2("fs"), v;
|
|
1022
|
+
process.platform === "win32" || global.TESTING_WINDOWS ? v = W2() : v = X2();
|
|
1023
|
+
G.exports = y;
|
|
1024
|
+
y.sync = Mt;
|
|
1025
|
+
function y(t, e, n) {
|
|
1026
|
+
if (typeof e == "function" && (n = e, e = {}), !n) {
|
|
1027
|
+
if (typeof Promise != "function")
|
|
1028
|
+
throw new TypeError("callback not provided");
|
|
1029
|
+
return new Promise(function(r, s) {
|
|
1030
|
+
y(t, e || {}, function(o, i) {
|
|
1031
|
+
o ? s(o) : r(i);
|
|
1032
|
+
});
|
|
1033
|
+
});
|
|
1034
|
+
}
|
|
1035
|
+
v(t, e || {}, function(r, s) {
|
|
1036
|
+
r && (r.code === "EACCES" || e && e.ignoreErrors) && (r = null, s = false), n(r, s);
|
|
1037
|
+
});
|
|
1038
|
+
}
|
|
1039
|
+
function Mt(t, e) {
|
|
1040
|
+
try {
|
|
1041
|
+
return v.sync(t, e || {});
|
|
1042
|
+
} catch (n) {
|
|
1043
|
+
if (e && e.ignoreErrors || n.code === "EACCES")
|
|
1044
|
+
return false;
|
|
1045
|
+
throw n;
|
|
1046
|
+
}
|
|
1047
|
+
}
|
|
1048
|
+
});
|
|
1049
|
+
var et2 = l2((Re, tt) => {
|
|
1050
|
+
"use strict";
|
|
1051
|
+
var g = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys", Y = h2("path"), Bt = g ? ";" : ":", V = U2(), J = (t) => Object.assign(new Error(`not found: ${t}`), { code: "ENOENT" }), Q = (t, e) => {
|
|
1052
|
+
let n = e.colon || Bt, r = t.match(/\//) || g && t.match(/\\/) ? [""] : [
|
|
1053
|
+
// windows always checks the cwd first
|
|
1054
|
+
...g ? [process.cwd()] : [],
|
|
1055
|
+
...(e.path || process.env.PATH || /* istanbul ignore next: very unusual */
|
|
1056
|
+
"").split(n)
|
|
1057
|
+
], s = g ? e.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "", o = g ? s.split(n) : [""];
|
|
1058
|
+
return g && t.indexOf(".") !== -1 && o[0] !== "" && o.unshift(""), {
|
|
1059
|
+
pathEnv: r,
|
|
1060
|
+
pathExt: o,
|
|
1061
|
+
pathExtExe: s
|
|
1062
|
+
};
|
|
1063
|
+
}, Z = (t, e, n) => {
|
|
1064
|
+
typeof e == "function" && (n = e, e = {}), e || (e = {});
|
|
1065
|
+
let { pathEnv: r, pathExt: s, pathExtExe: o } = Q(t, e), i = [], a = (u) => new Promise((f, p) => {
|
|
1066
|
+
if (u === r.length)
|
|
1067
|
+
return e.all && i.length ? f(i) : p(J(t));
|
|
1068
|
+
let d = r[u], w = /^".*"$/.test(d) ? d.slice(1, -1) : d, m = Y.join(w, t), b = !w && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + m : m;
|
|
1069
|
+
f(c(b, u, 0));
|
|
1070
|
+
}), c = (u, f, p) => new Promise((d, w) => {
|
|
1071
|
+
if (p === s.length)
|
|
1072
|
+
return d(a(f + 1));
|
|
1073
|
+
let m = s[p];
|
|
1074
|
+
V(u + m, { pathExt: o }, (b, Ot) => {
|
|
1075
|
+
if (!b && Ot)
|
|
1076
|
+
if (e.all)
|
|
1077
|
+
i.push(u + m);
|
|
1078
|
+
else
|
|
1079
|
+
return d(u + m);
|
|
1080
|
+
return d(c(u, f, p + 1));
|
|
1081
|
+
});
|
|
1082
|
+
});
|
|
1083
|
+
return n ? a(0).then((u) => n(null, u), n) : a(0);
|
|
1084
|
+
}, Xt = (t, e) => {
|
|
1085
|
+
e = e || {};
|
|
1086
|
+
let { pathEnv: n, pathExt: r, pathExtExe: s } = Q(t, e), o = [];
|
|
1087
|
+
for (let i = 0; i < n.length; i++) {
|
|
1088
|
+
let a = n[i], c = /^".*"$/.test(a) ? a.slice(1, -1) : a, u = Y.join(c, t), f = !c && /^\.[\\\/]/.test(t) ? t.slice(0, 2) + u : u;
|
|
1089
|
+
for (let p = 0; p < r.length; p++) {
|
|
1090
|
+
let d = f + r[p];
|
|
1091
|
+
try {
|
|
1092
|
+
if (V.sync(d, { pathExt: s }))
|
|
1093
|
+
if (e.all)
|
|
1094
|
+
o.push(d);
|
|
1095
|
+
else
|
|
1096
|
+
return d;
|
|
1097
|
+
} catch {
|
|
1098
|
+
}
|
|
1099
|
+
}
|
|
1100
|
+
}
|
|
1101
|
+
if (e.all && o.length)
|
|
1102
|
+
return o;
|
|
1103
|
+
if (e.nothrow)
|
|
1104
|
+
return null;
|
|
1105
|
+
throw J(t);
|
|
1106
|
+
};
|
|
1107
|
+
tt.exports = Z;
|
|
1108
|
+
Z.sync = Xt;
|
|
1109
|
+
});
|
|
1110
|
+
var rt2 = l2(($e, _) => {
|
|
1111
|
+
"use strict";
|
|
1112
|
+
var nt = (t = {}) => {
|
|
1113
|
+
let e = t.env || process.env;
|
|
1114
|
+
return (t.platform || process.platform) !== "win32" ? "PATH" : Object.keys(e).reverse().find((r) => r.toUpperCase() === "PATH") || "Path";
|
|
1115
|
+
};
|
|
1116
|
+
_.exports = nt;
|
|
1117
|
+
_.exports.default = nt;
|
|
1118
|
+
});
|
|
1119
|
+
var ct2 = l2((Ne, it) => {
|
|
1120
|
+
"use strict";
|
|
1121
|
+
var st = h2("path"), Gt = et2(), Ut = rt2();
|
|
1122
|
+
function ot(t, e) {
|
|
1123
|
+
let n = t.options.env || process.env, r = process.cwd(), s = t.options.cwd != null, o = s && process.chdir !== void 0 && !process.chdir.disabled;
|
|
1124
|
+
if (o)
|
|
1125
|
+
try {
|
|
1126
|
+
process.chdir(t.options.cwd);
|
|
1127
|
+
} catch {
|
|
1128
|
+
}
|
|
1129
|
+
let i;
|
|
1130
|
+
try {
|
|
1131
|
+
i = Gt.sync(t.command, {
|
|
1132
|
+
path: n[Ut({ env: n })],
|
|
1133
|
+
pathExt: e ? st.delimiter : void 0
|
|
1134
|
+
});
|
|
1135
|
+
} catch {
|
|
1136
|
+
} finally {
|
|
1137
|
+
o && process.chdir(r);
|
|
1138
|
+
}
|
|
1139
|
+
return i && (i = st.resolve(s ? t.options.cwd : "", i)), i;
|
|
1140
|
+
}
|
|
1141
|
+
function Yt(t) {
|
|
1142
|
+
return ot(t) || ot(t, true);
|
|
1143
|
+
}
|
|
1144
|
+
it.exports = Yt;
|
|
1145
|
+
});
|
|
1146
|
+
var ut2 = l2((qe, P) => {
|
|
1147
|
+
"use strict";
|
|
1148
|
+
var C = /([()\][%!^"`<>&|;, *?])/g;
|
|
1149
|
+
function Vt(t) {
|
|
1150
|
+
return t = t.replace(C, "^$1"), t;
|
|
1151
|
+
}
|
|
1152
|
+
function Jt(t, e) {
|
|
1153
|
+
return t = `${t}`, t = t.replace(/(\\*)"/g, '$1$1\\"'), t = t.replace(/(\\*)$/, "$1$1"), t = `"${t}"`, t = t.replace(C, "^$1"), e && (t = t.replace(C, "^$1")), t;
|
|
1154
|
+
}
|
|
1155
|
+
P.exports.command = Vt;
|
|
1156
|
+
P.exports.argument = Jt;
|
|
1157
|
+
});
|
|
1158
|
+
var lt2 = l2((Ie, at) => {
|
|
1159
|
+
"use strict";
|
|
1160
|
+
at.exports = /^#!(.*)/;
|
|
1161
|
+
});
|
|
1162
|
+
var dt2 = l2((Le, pt) => {
|
|
1163
|
+
"use strict";
|
|
1164
|
+
var Qt = lt2();
|
|
1165
|
+
pt.exports = (t = "") => {
|
|
1166
|
+
let e = t.match(Qt);
|
|
1167
|
+
if (!e)
|
|
1168
|
+
return null;
|
|
1169
|
+
let [n, r] = e[0].replace(/#! ?/, "").split(" "), s = n.split("/").pop();
|
|
1170
|
+
return s === "env" ? r : r ? `${s} ${r}` : s;
|
|
1171
|
+
};
|
|
1172
|
+
});
|
|
1173
|
+
var ht2 = l2((je, ft) => {
|
|
1174
|
+
"use strict";
|
|
1175
|
+
var O = h2("fs"), Zt = dt2();
|
|
1176
|
+
function te(t) {
|
|
1177
|
+
let n = Buffer.alloc(150), r;
|
|
1178
|
+
try {
|
|
1179
|
+
r = O.openSync(t, "r"), O.readSync(r, n, 0, 150, 0), O.closeSync(r);
|
|
1180
|
+
} catch {
|
|
1181
|
+
}
|
|
1182
|
+
return Zt(n.toString());
|
|
1183
|
+
}
|
|
1184
|
+
ft.exports = te;
|
|
1185
|
+
});
|
|
1186
|
+
var wt2 = l2((Fe, Et) => {
|
|
1187
|
+
"use strict";
|
|
1188
|
+
var ee = h2("path"), mt = ct2(), gt = ut2(), ne = ht2(), re = process.platform === "win32", se = /\.(?:com|exe)$/i, oe = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
|
|
1189
|
+
function ie(t) {
|
|
1190
|
+
t.file = mt(t);
|
|
1191
|
+
let e = t.file && ne(t.file);
|
|
1192
|
+
return e ? (t.args.unshift(t.file), t.command = e, mt(t)) : t.file;
|
|
1193
|
+
}
|
|
1194
|
+
function ce(t) {
|
|
1195
|
+
if (!re)
|
|
1196
|
+
return t;
|
|
1197
|
+
let e = ie(t), n = !se.test(e);
|
|
1198
|
+
if (t.options.forceShell || n) {
|
|
1199
|
+
let r = oe.test(e);
|
|
1200
|
+
t.command = ee.normalize(t.command), t.command = gt.command(t.command), t.args = t.args.map((o) => gt.argument(o, r));
|
|
1201
|
+
let s = [t.command].concat(t.args).join(" ");
|
|
1202
|
+
t.args = ["/d", "/s", "/c", `"${s}"`], t.command = process.env.comspec || "cmd.exe", t.options.windowsVerbatimArguments = true;
|
|
1203
|
+
}
|
|
1204
|
+
return t;
|
|
1205
|
+
}
|
|
1206
|
+
function ue(t, e, n) {
|
|
1207
|
+
e && !Array.isArray(e) && (n = e, e = null), e = e ? e.slice(0) : [], n = Object.assign({}, n);
|
|
1208
|
+
let r = {
|
|
1209
|
+
command: t,
|
|
1210
|
+
args: e,
|
|
1211
|
+
options: n,
|
|
1212
|
+
file: void 0,
|
|
1213
|
+
original: {
|
|
1214
|
+
command: t,
|
|
1215
|
+
args: e
|
|
1216
|
+
}
|
|
1217
|
+
};
|
|
1218
|
+
return n.shell ? r : ce(r);
|
|
1219
|
+
}
|
|
1220
|
+
Et.exports = ue;
|
|
1221
|
+
});
|
|
1222
|
+
var bt2 = l2((ze, vt) => {
|
|
1223
|
+
"use strict";
|
|
1224
|
+
var S = process.platform === "win32";
|
|
1225
|
+
function k(t, e) {
|
|
1226
|
+
return Object.assign(new Error(`${e} ${t.command} ENOENT`), {
|
|
1227
|
+
code: "ENOENT",
|
|
1228
|
+
errno: "ENOENT",
|
|
1229
|
+
syscall: `${e} ${t.command}`,
|
|
1230
|
+
path: t.command,
|
|
1231
|
+
spawnargs: t.args
|
|
1232
|
+
});
|
|
1233
|
+
}
|
|
1234
|
+
function ae(t, e) {
|
|
1235
|
+
if (!S)
|
|
1236
|
+
return;
|
|
1237
|
+
let n = t.emit;
|
|
1238
|
+
t.emit = function(r, s) {
|
|
1239
|
+
if (r === "exit") {
|
|
1240
|
+
let o = xt(s, e, "spawn");
|
|
1241
|
+
if (o)
|
|
1242
|
+
return n.call(t, "error", o);
|
|
1243
|
+
}
|
|
1244
|
+
return n.apply(t, arguments);
|
|
1245
|
+
};
|
|
1246
|
+
}
|
|
1247
|
+
function xt(t, e) {
|
|
1248
|
+
return S && t === 1 && !e.file ? k(e.original, "spawn") : null;
|
|
1249
|
+
}
|
|
1250
|
+
function le(t, e) {
|
|
1251
|
+
return S && t === 1 && !e.file ? k(e.original, "spawnSync") : null;
|
|
1252
|
+
}
|
|
1253
|
+
vt.exports = {
|
|
1254
|
+
hookChildProcess: ae,
|
|
1255
|
+
verifyENOENT: xt,
|
|
1256
|
+
verifyENOENTSync: le,
|
|
1257
|
+
notFoundError: k
|
|
1258
|
+
};
|
|
1259
|
+
});
|
|
1260
|
+
var Ct2 = l2((He, E) => {
|
|
1261
|
+
"use strict";
|
|
1262
|
+
var yt = h2("child_process"), T = wt2(), A = bt2();
|
|
1263
|
+
function _t(t, e, n) {
|
|
1264
|
+
let r = T(t, e, n), s = yt.spawn(r.command, r.args, r.options);
|
|
1265
|
+
return A.hookChildProcess(s, r), s;
|
|
1266
|
+
}
|
|
1267
|
+
function pe(t, e, n) {
|
|
1268
|
+
let r = T(t, e, n), s = yt.spawnSync(r.command, r.args, r.options);
|
|
1269
|
+
return s.error = s.error || A.verifyENOENTSync(s.status, r), s;
|
|
1270
|
+
}
|
|
1271
|
+
E.exports = _t;
|
|
1272
|
+
E.exports.spawn = _t;
|
|
1273
|
+
E.exports.sync = pe;
|
|
1274
|
+
E.exports._parse = T;
|
|
1275
|
+
E.exports._enoent = A;
|
|
1276
|
+
});
|
|
1277
|
+
var Lt2 = /^path$/i;
|
|
1278
|
+
var q2 = { key: "PATH", value: "" };
|
|
1279
|
+
function jt2(t) {
|
|
1280
|
+
for (let e in t) {
|
|
1281
|
+
if (!Object.prototype.hasOwnProperty.call(t, e) || !Lt2.test(e))
|
|
1282
|
+
continue;
|
|
1283
|
+
let n = t[e];
|
|
1284
|
+
return n ? { key: e, value: n } : q2;
|
|
1285
|
+
}
|
|
1286
|
+
return q2;
|
|
1287
|
+
}
|
|
1288
|
+
function Ft2(t, e) {
|
|
1289
|
+
let n = e.value.split(N2), r = t, s;
|
|
1290
|
+
do
|
|
1291
|
+
n.push(qt2(r, "node_modules", ".bin")), s = r, r = It2(r);
|
|
1292
|
+
while (r !== s);
|
|
1293
|
+
return { key: e.key, value: n.join(N2) };
|
|
1294
|
+
}
|
|
1295
|
+
function I2(t, e) {
|
|
1296
|
+
let n = {
|
|
1297
|
+
...process.env,
|
|
1298
|
+
...e
|
|
1299
|
+
}, r = Ft2(t, jt2(n));
|
|
1300
|
+
return n[r.key] = r.value, n;
|
|
1301
|
+
}
|
|
1302
|
+
var L2 = (t) => {
|
|
1303
|
+
let e = t.length, n = new zt2(), r = () => {
|
|
1304
|
+
--e === 0 && n.emit("end");
|
|
1305
|
+
};
|
|
1306
|
+
for (let s of t)
|
|
1307
|
+
s.pipe(n, { end: false }), s.on("end", r);
|
|
1308
|
+
return n;
|
|
1309
|
+
};
|
|
1310
|
+
var Pt2 = Nt2(Ct2(), 1);
|
|
1311
|
+
var x2 = class extends Error {
|
|
1312
|
+
result;
|
|
1313
|
+
output;
|
|
1314
|
+
get exitCode() {
|
|
1315
|
+
if (this.result.exitCode !== null)
|
|
1316
|
+
return this.result.exitCode;
|
|
1317
|
+
}
|
|
1318
|
+
constructor(e, n) {
|
|
1319
|
+
super(`Process exited with non-zero status (${e.exitCode})`), this.result = e, this.output = n;
|
|
1320
|
+
}
|
|
1321
|
+
};
|
|
1322
|
+
var ge2 = {
|
|
1323
|
+
timeout: void 0,
|
|
1324
|
+
persist: false
|
|
1325
|
+
};
|
|
1326
|
+
var Ee2 = {
|
|
1327
|
+
windowsHide: true
|
|
1328
|
+
};
|
|
1329
|
+
function we2(t, e) {
|
|
1330
|
+
return {
|
|
1331
|
+
command: fe2(t),
|
|
1332
|
+
args: e ?? []
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
function xe2(t) {
|
|
1336
|
+
let e = new AbortController();
|
|
1337
|
+
for (let n of t) {
|
|
1338
|
+
if (n.aborted)
|
|
1339
|
+
return e.abort(), n;
|
|
1340
|
+
let r = () => {
|
|
1341
|
+
e.abort(n.reason);
|
|
1342
|
+
};
|
|
1343
|
+
n.addEventListener("abort", r, {
|
|
1344
|
+
signal: e.signal
|
|
1345
|
+
});
|
|
1346
|
+
}
|
|
1347
|
+
return e.signal;
|
|
1348
|
+
}
|
|
1349
|
+
var R2 = class {
|
|
1350
|
+
_process;
|
|
1351
|
+
_aborted = false;
|
|
1352
|
+
_options;
|
|
1353
|
+
_command;
|
|
1354
|
+
_args;
|
|
1355
|
+
_resolveClose;
|
|
1356
|
+
_processClosed;
|
|
1357
|
+
_thrownError;
|
|
1358
|
+
get process() {
|
|
1359
|
+
return this._process;
|
|
1360
|
+
}
|
|
1361
|
+
get pid() {
|
|
1362
|
+
return this._process?.pid;
|
|
1363
|
+
}
|
|
1364
|
+
get exitCode() {
|
|
1365
|
+
if (this._process && this._process.exitCode !== null)
|
|
1366
|
+
return this._process.exitCode;
|
|
1367
|
+
}
|
|
1368
|
+
constructor(e, n, r) {
|
|
1369
|
+
this._options = {
|
|
1370
|
+
...ge2,
|
|
1371
|
+
...r
|
|
1372
|
+
}, this._command = e, this._args = n ?? [], this._processClosed = new Promise((s) => {
|
|
1373
|
+
this._resolveClose = s;
|
|
1374
|
+
});
|
|
1375
|
+
}
|
|
1376
|
+
kill(e) {
|
|
1377
|
+
return this._process?.kill(e) === true;
|
|
1378
|
+
}
|
|
1379
|
+
get aborted() {
|
|
1380
|
+
return this._aborted;
|
|
1381
|
+
}
|
|
1382
|
+
get killed() {
|
|
1383
|
+
return this._process?.killed === true;
|
|
1384
|
+
}
|
|
1385
|
+
pipe(e, n, r) {
|
|
1386
|
+
return be2(e, n, {
|
|
1387
|
+
...r,
|
|
1388
|
+
stdin: this
|
|
1389
|
+
});
|
|
1390
|
+
}
|
|
1391
|
+
async *[Symbol.asyncIterator]() {
|
|
1392
|
+
let e = this._process;
|
|
1393
|
+
if (!e)
|
|
1394
|
+
return;
|
|
1395
|
+
let n = [];
|
|
1396
|
+
this._streamErr && n.push(this._streamErr), this._streamOut && n.push(this._streamOut);
|
|
1397
|
+
let r = L2(n), s = me2.createInterface({
|
|
1398
|
+
input: r
|
|
1399
|
+
});
|
|
1400
|
+
for await (let o of s)
|
|
1401
|
+
yield o.toString();
|
|
1402
|
+
if (await this._processClosed, e.removeAllListeners(), this._thrownError)
|
|
1403
|
+
throw this._thrownError;
|
|
1404
|
+
if (this._options?.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0)
|
|
1405
|
+
throw new x2(this);
|
|
1406
|
+
}
|
|
1407
|
+
async _waitForOutput() {
|
|
1408
|
+
let e = this._process;
|
|
1409
|
+
if (!e)
|
|
1410
|
+
throw new Error("No process was started");
|
|
1411
|
+
let n = "", r = "";
|
|
1412
|
+
if (this._streamOut)
|
|
1413
|
+
for await (let o of this._streamOut)
|
|
1414
|
+
r += o.toString();
|
|
1415
|
+
if (this._streamErr)
|
|
1416
|
+
for await (let o of this._streamErr)
|
|
1417
|
+
n += o.toString();
|
|
1418
|
+
if (await this._processClosed, this._options?.stdin && await this._options.stdin, e.removeAllListeners(), this._thrownError)
|
|
1419
|
+
throw this._thrownError;
|
|
1420
|
+
let s = {
|
|
1421
|
+
stderr: n,
|
|
1422
|
+
stdout: r,
|
|
1423
|
+
exitCode: this.exitCode
|
|
1424
|
+
};
|
|
1425
|
+
if (this._options.throwOnError && this.exitCode !== 0 && this.exitCode !== void 0)
|
|
1426
|
+
throw new x2(this, s);
|
|
1427
|
+
return s;
|
|
1428
|
+
}
|
|
1429
|
+
then(e, n) {
|
|
1430
|
+
return this._waitForOutput().then(e, n);
|
|
1431
|
+
}
|
|
1432
|
+
_streamOut;
|
|
1433
|
+
_streamErr;
|
|
1434
|
+
spawn() {
|
|
1435
|
+
let e = he2(), n = this._options, r = {
|
|
1436
|
+
...Ee2,
|
|
1437
|
+
...n.nodeOptions
|
|
1438
|
+
}, s = [];
|
|
1439
|
+
this._resetState(), n.timeout !== void 0 && s.push(AbortSignal.timeout(n.timeout)), n.signal !== void 0 && s.push(n.signal), n.persist === true && (r.detached = true), s.length > 0 && (r.signal = xe2(s)), r.env = I2(e, r.env);
|
|
1440
|
+
let { command: o, args: i } = we2(this._command, this._args), a = (0, Pt2._parse)(o, i, r), c = de2(
|
|
1441
|
+
a.command,
|
|
1442
|
+
a.args,
|
|
1443
|
+
a.options
|
|
1444
|
+
);
|
|
1445
|
+
if (c.stderr && (this._streamErr = c.stderr), c.stdout && (this._streamOut = c.stdout), this._process = c, c.once("error", this._onError), c.once("close", this._onClose), n.stdin !== void 0 && c.stdin && n.stdin.process) {
|
|
1446
|
+
let { stdout: u } = n.stdin.process;
|
|
1447
|
+
u && u.pipe(c.stdin);
|
|
1448
|
+
}
|
|
1449
|
+
}
|
|
1450
|
+
_resetState() {
|
|
1451
|
+
this._aborted = false, this._processClosed = new Promise((e) => {
|
|
1452
|
+
this._resolveClose = e;
|
|
1453
|
+
}), this._thrownError = void 0;
|
|
1454
|
+
}
|
|
1455
|
+
_onError = (e) => {
|
|
1456
|
+
if (e.name === "AbortError" && (!(e.cause instanceof Error) || e.cause.name !== "TimeoutError")) {
|
|
1457
|
+
this._aborted = true;
|
|
1458
|
+
return;
|
|
1459
|
+
}
|
|
1460
|
+
this._thrownError = e;
|
|
1461
|
+
};
|
|
1462
|
+
_onClose = () => {
|
|
1463
|
+
this._resolveClose && this._resolveClose();
|
|
1464
|
+
};
|
|
1465
|
+
};
|
|
1466
|
+
var ve2 = (t, e, n) => {
|
|
1467
|
+
let r = new R2(t, e, n);
|
|
1468
|
+
return r.spawn(), r;
|
|
1469
|
+
};
|
|
1470
|
+
var be2 = ve2;
|
|
1471
|
+
|
|
1472
|
+
// src/utils/cli/postinstall/pnpm.ts
|
|
1473
|
+
async function pnpmIgnored(root) {
|
|
1474
|
+
const pnpmVersion = (await ve2(`pnpm`, ["-v"], { nodeOptions: { cwd: root } })).stdout.trim();
|
|
1475
|
+
const [major] = pnpmVersion.split(".").map(Number);
|
|
1476
|
+
if (major && major >= 10) {
|
|
1477
|
+
const detect2 = (await ve2("pnpm", ["ignored-builds"], { nodeOptions: { cwd: root } })).stdout;
|
|
1478
|
+
if (detect2.startsWith("Automatically ignored builds during installation:\n None")) return;
|
|
1479
|
+
return detect2;
|
|
1480
|
+
}
|
|
1481
|
+
}
|
|
1482
|
+
async function pnpm(root) {
|
|
1483
|
+
const detect2 = await pnpmIgnored(root);
|
|
1484
|
+
if (detect2) console.warn(detect2);
|
|
1485
|
+
}
|
|
1486
|
+
|
|
1487
|
+
// src/utils/cli/preinstall/yarn.ts
|
|
1488
|
+
import { appendFileSync } from "node:fs";
|
|
1489
|
+
import { resolve as resolve2 } from "node:path";
|
|
1490
|
+
var templateToAppend = `
|
|
1491
|
+
packageExtensions:
|
|
1492
|
+
unplugin-vue-router@*:
|
|
1493
|
+
dependencies:
|
|
1494
|
+
"@vue/compiler-sfc": "*"
|
|
1495
|
+
`;
|
|
1496
|
+
async function yarnFile(root) {
|
|
1497
|
+
const pnpmVersion = (await ve2("yarn", ["-v"], { nodeOptions: { cwd: root } })).stdout.trim();
|
|
1498
|
+
const [major] = pnpmVersion.split(".").map(Number);
|
|
1499
|
+
if (major && major >= 2) {
|
|
1500
|
+
appendFileSync(resolve2(root, ".yarnrc.yml"), templateToAppend);
|
|
1501
|
+
}
|
|
1502
|
+
}
|
|
1503
|
+
async function yarn(root) {
|
|
1504
|
+
await yarnFile(root);
|
|
1505
|
+
}
|
|
1506
|
+
|
|
1507
|
+
// src/utils/installDependencies.ts
|
|
1508
|
+
var userAgent = process.env.npm_config_user_agent ?? "";
|
|
1509
|
+
var packageManager = /bun/.test(userAgent) ? "bun" : "pnpm";
|
|
1510
|
+
async function installDependencies2(root = process.cwd(), manager = packageManager) {
|
|
1511
|
+
if (manager === "yarn") {
|
|
1512
|
+
await yarn(root);
|
|
1513
|
+
}
|
|
1514
|
+
await installDependencies({
|
|
1515
|
+
packageManager: manager,
|
|
1516
|
+
cwd: root,
|
|
1517
|
+
silent: true
|
|
1518
|
+
}).catch(() => {
|
|
1519
|
+
console.error(
|
|
1520
|
+
`Failed to install dependencies using ${manager}.`
|
|
1521
|
+
);
|
|
1522
|
+
});
|
|
1523
|
+
if (manager === "pnpm") {
|
|
1524
|
+
await pnpm(root);
|
|
1525
|
+
}
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
// src/utils/prompts.ts
|
|
37
1529
|
import validate from "validate-npm-package-name";
|
|
38
1530
|
var promptOptions = {
|
|
39
1531
|
onCancel: () => {
|
|
@@ -54,9 +1546,14 @@ var initPrompts = async (context) => {
|
|
|
54
1546
|
type: "text",
|
|
55
1547
|
message: "Project name:",
|
|
56
1548
|
initial: "vuetify-project",
|
|
1549
|
+
format: (v) => v.trim(),
|
|
57
1550
|
validate: (v) => {
|
|
58
|
-
const { errors } = validate(String(v).trim());
|
|
59
|
-
|
|
1551
|
+
const { errors, warnings, validForNewPackages: isValid } = validate(String(v).trim());
|
|
1552
|
+
const error = isValid ? null : errors ? errors[0] : warnings[0];
|
|
1553
|
+
if (!isValid) {
|
|
1554
|
+
return `Package ${error}`;
|
|
1555
|
+
}
|
|
1556
|
+
return true;
|
|
60
1557
|
}
|
|
61
1558
|
},
|
|
62
1559
|
{
|
|
@@ -65,10 +1562,16 @@ var initPrompts = async (context) => {
|
|
|
65
1562
|
inactive: "No",
|
|
66
1563
|
initial: false,
|
|
67
1564
|
type: (_, { projectName }) => {
|
|
68
|
-
const projectPath =
|
|
69
|
-
return !
|
|
1565
|
+
const projectPath = join2(context.cwd, projectName);
|
|
1566
|
+
return !existsSync2(projectPath) || readdirSync(projectPath).length === 0 ? null : "toggle";
|
|
1567
|
+
},
|
|
1568
|
+
onState(a) {
|
|
1569
|
+
if (!a.value) {
|
|
1570
|
+
console.error("\n\n", red("\u2716") + " Target directory exists and is not empty.");
|
|
1571
|
+
process.exit(1);
|
|
1572
|
+
}
|
|
70
1573
|
},
|
|
71
|
-
message: (prev) => `The project path: ${
|
|
1574
|
+
message: (prev) => `The project path: ${resolve3(context.cwd, prev)} already exists, would you like to overwrite this directory?`
|
|
72
1575
|
},
|
|
73
1576
|
{
|
|
74
1577
|
name: "usePreset",
|
|
@@ -102,11 +1605,11 @@ var initPrompts = async (context) => {
|
|
|
102
1605
|
return p.startsWith("nuxt-") ? null : "select";
|
|
103
1606
|
},
|
|
104
1607
|
message: "Would you like to install dependencies with yarn, npm, pnpm, or bun?",
|
|
105
|
-
initial: 0,
|
|
1608
|
+
initial: packageManager === "bun" ? 3 : 0,
|
|
106
1609
|
choices: [
|
|
107
|
-
{ title: "yarn", value: "yarn" },
|
|
108
|
-
{ title: "npm", value: "npm" },
|
|
109
1610
|
{ title: "pnpm", value: "pnpm" },
|
|
1611
|
+
{ title: "npm", value: "npm" },
|
|
1612
|
+
{ title: "yarn", value: "yarn" },
|
|
110
1613
|
{ title: "bun", value: "bun" },
|
|
111
1614
|
{ title: "none", value: null }
|
|
112
1615
|
]
|
|
@@ -180,23 +1683,9 @@ var initPrompts = async (context) => {
|
|
|
180
1683
|
import { red as red2 } from "kolorist";
|
|
181
1684
|
import minimist from "minimist";
|
|
182
1685
|
|
|
183
|
-
// src/utils/installDependencies.ts
|
|
184
|
-
import { spawnSync } from "child_process";
|
|
185
|
-
function installDependencies(projectRoot, packageManager) {
|
|
186
|
-
const cmd = packageManager === "npm" ? "npm install" : packageManager === "yarn" ? "yarn" : packageManager === "bun" ? "bun install" : "pnpm install";
|
|
187
|
-
const spawn = spawnSync(cmd, {
|
|
188
|
-
cwd: projectRoot,
|
|
189
|
-
stdio: ["inherit", "inherit", "pipe"],
|
|
190
|
-
shell: true
|
|
191
|
-
});
|
|
192
|
-
if (spawn.error) {
|
|
193
|
-
throw spawn.error;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
1686
|
// src/utils/renderTemplate.ts
|
|
198
1687
|
import { copyFileSync, mkdirSync, readdirSync as readdirSync2, readFileSync, statSync, writeFileSync } from "fs";
|
|
199
|
-
import { basename, dirname, resolve as
|
|
1688
|
+
import { basename as basename2, dirname as dirname2, resolve as resolve4 } from "path";
|
|
200
1689
|
|
|
201
1690
|
// src/utils/deepMerge.ts
|
|
202
1691
|
var isObject = (v) => {
|
|
@@ -228,16 +1717,13 @@ function mergePkg(source, destination) {
|
|
|
228
1717
|
}
|
|
229
1718
|
function renderDirectory(source, destination) {
|
|
230
1719
|
mkdirSync(destination, { recursive: true });
|
|
231
|
-
readdirSync2(source).forEach((path4) => renderTemplate(
|
|
1720
|
+
readdirSync2(source).forEach((path4) => renderTemplate(resolve4(source, path4), resolve4(destination, path4)));
|
|
232
1721
|
}
|
|
233
1722
|
function renderFile(source, destination) {
|
|
234
|
-
const filename =
|
|
235
|
-
if (filename.startsWith("_"))
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
mergePkg(source, destination);
|
|
239
|
-
else
|
|
240
|
-
copyFileSync(source, destination);
|
|
1723
|
+
const filename = basename2(source);
|
|
1724
|
+
if (filename.startsWith("_")) destination = resolve4(dirname2(destination), filename.replace("_", "."));
|
|
1725
|
+
if (filename === "package.json") mergePkg(source, destination);
|
|
1726
|
+
else copyFileSync(source, destination);
|
|
241
1727
|
}
|
|
242
1728
|
function renderTemplate(source, destination) {
|
|
243
1729
|
if (statSync(source).isDirectory()) {
|
|
@@ -250,15 +1736,15 @@ function renderTemplate(source, destination) {
|
|
|
250
1736
|
// src/utils/nuxt/renderNuxtTemplate.ts
|
|
251
1737
|
import fs3 from "fs";
|
|
252
1738
|
import path3 from "path";
|
|
253
|
-
import { spawnSync as
|
|
1739
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
254
1740
|
|
|
255
1741
|
// src/utils/nuxt/utils.ts
|
|
256
1742
|
import process2 from "process";
|
|
257
1743
|
import path from "path";
|
|
258
|
-
import { spawnSync
|
|
1744
|
+
import { spawnSync } from "child_process";
|
|
259
1745
|
import fs from "fs";
|
|
260
1746
|
|
|
261
|
-
// node_modules/.pnpm/package-manager-detector@
|
|
1747
|
+
// node_modules/.pnpm/package-manager-detector@1.2.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
262
1748
|
function npmRun(agent) {
|
|
263
1749
|
return (args) => {
|
|
264
1750
|
if (args.length > 1) {
|
|
@@ -268,11 +1754,30 @@ function npmRun(agent) {
|
|
|
268
1754
|
}
|
|
269
1755
|
};
|
|
270
1756
|
}
|
|
271
|
-
|
|
1757
|
+
function denoExecute() {
|
|
1758
|
+
return (args) => {
|
|
1759
|
+
return ["deno", "run", `npm:${args[0]}`, ...args.slice(1)];
|
|
1760
|
+
};
|
|
1761
|
+
}
|
|
1762
|
+
var npm = {
|
|
1763
|
+
"agent": ["npm", 0],
|
|
1764
|
+
"run": npmRun("npm"),
|
|
1765
|
+
"install": ["npm", "i", 0],
|
|
1766
|
+
"frozen": ["npm", "ci", 0],
|
|
1767
|
+
"global": ["npm", "i", "-g", 0],
|
|
1768
|
+
"add": ["npm", "i", 0],
|
|
1769
|
+
"upgrade": ["npm", "update", 0],
|
|
1770
|
+
"upgrade-interactive": null,
|
|
1771
|
+
"execute": ["npx", 0],
|
|
1772
|
+
"execute-local": ["npx", 0],
|
|
1773
|
+
"uninstall": ["npm", "uninstall", 0],
|
|
1774
|
+
"global_uninstall": ["npm", "uninstall", "-g", 0]
|
|
1775
|
+
};
|
|
1776
|
+
var yarn2 = {
|
|
272
1777
|
"agent": ["yarn", 0],
|
|
273
1778
|
"run": ["yarn", "run", 0],
|
|
274
1779
|
"install": ["yarn", "install", 0],
|
|
275
|
-
"frozen": ["yarn", "install", "--frozen-lockfile"],
|
|
1780
|
+
"frozen": ["yarn", "install", "--frozen-lockfile", 0],
|
|
276
1781
|
"global": ["yarn", "global", "add", 0],
|
|
277
1782
|
"add": ["yarn", "add", 0],
|
|
278
1783
|
"upgrade": ["yarn", "upgrade", 0],
|
|
@@ -282,11 +1787,22 @@ var yarn = {
|
|
|
282
1787
|
"uninstall": ["yarn", "remove", 0],
|
|
283
1788
|
"global_uninstall": ["yarn", "global", "remove", 0]
|
|
284
1789
|
};
|
|
285
|
-
var
|
|
1790
|
+
var yarnBerry = {
|
|
1791
|
+
...yarn2,
|
|
1792
|
+
"frozen": ["yarn", "install", "--immutable", 0],
|
|
1793
|
+
"upgrade": ["yarn", "up", 0],
|
|
1794
|
+
"upgrade-interactive": ["yarn", "up", "-i", 0],
|
|
1795
|
+
"execute": ["yarn", "dlx", 0],
|
|
1796
|
+
"execute-local": ["yarn", "exec", 0],
|
|
1797
|
+
// Yarn 2+ removed 'global', see https://github.com/yarnpkg/berry/issues/821
|
|
1798
|
+
"global": ["npm", "i", "-g", 0],
|
|
1799
|
+
"global_uninstall": ["npm", "uninstall", "-g", 0]
|
|
1800
|
+
};
|
|
1801
|
+
var pnpm2 = {
|
|
286
1802
|
"agent": ["pnpm", 0],
|
|
287
1803
|
"run": ["pnpm", "run", 0],
|
|
288
1804
|
"install": ["pnpm", "i", 0],
|
|
289
|
-
"frozen": ["pnpm", "i", "--frozen-lockfile"],
|
|
1805
|
+
"frozen": ["pnpm", "i", "--frozen-lockfile", 0],
|
|
290
1806
|
"global": ["pnpm", "add", "-g", 0],
|
|
291
1807
|
"add": ["pnpm", "add", 0],
|
|
292
1808
|
"upgrade": ["pnpm", "update", 0],
|
|
@@ -300,7 +1816,7 @@ var bun = {
|
|
|
300
1816
|
"agent": ["bun", 0],
|
|
301
1817
|
"run": ["bun", "run", 0],
|
|
302
1818
|
"install": ["bun", "install", 0],
|
|
303
|
-
"frozen": ["bun", "install", "--frozen-lockfile"],
|
|
1819
|
+
"frozen": ["bun", "install", "--frozen-lockfile", 0],
|
|
304
1820
|
"global": ["bun", "add", "-g", 0],
|
|
305
1821
|
"add": ["bun", "add", 0],
|
|
306
1822
|
"upgrade": ["bun", "update", 0],
|
|
@@ -310,38 +1826,32 @@ var bun = {
|
|
|
310
1826
|
"uninstall": ["bun", "remove", 0],
|
|
311
1827
|
"global_uninstall": ["bun", "remove", "-g", 0]
|
|
312
1828
|
};
|
|
1829
|
+
var deno = {
|
|
1830
|
+
"agent": ["deno", 0],
|
|
1831
|
+
"run": ["deno", "task", 0],
|
|
1832
|
+
"install": ["deno", "install", 0],
|
|
1833
|
+
"frozen": ["deno", "install", "--frozen", 0],
|
|
1834
|
+
"global": ["deno", "install", "-g", 0],
|
|
1835
|
+
"add": ["deno", "add", 0],
|
|
1836
|
+
"upgrade": ["deno", "outdated", "--update", 0],
|
|
1837
|
+
"upgrade-interactive": ["deno", "outdated", "--update", 0],
|
|
1838
|
+
"execute": denoExecute(),
|
|
1839
|
+
"execute-local": ["deno", "task", "--eval", 0],
|
|
1840
|
+
"uninstall": ["deno", "remove", 0],
|
|
1841
|
+
"global_uninstall": ["deno", "uninstall", "-g", 0]
|
|
1842
|
+
};
|
|
313
1843
|
var COMMANDS = {
|
|
314
|
-
"npm":
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
"global": ["npm", "i", "-g", 0],
|
|
320
|
-
"add": ["npm", "i", 0],
|
|
321
|
-
"upgrade": ["npm", "update", 0],
|
|
322
|
-
"upgrade-interactive": null,
|
|
323
|
-
"execute": ["npx", 0],
|
|
324
|
-
"execute-local": ["npx", 0],
|
|
325
|
-
"uninstall": ["npm", "uninstall", 0],
|
|
326
|
-
"global_uninstall": ["npm", "uninstall", "-g", 0]
|
|
327
|
-
},
|
|
328
|
-
"yarn": yarn,
|
|
329
|
-
"yarn@berry": {
|
|
330
|
-
...yarn,
|
|
331
|
-
"frozen": ["yarn", "install", "--immutable"],
|
|
332
|
-
"upgrade": ["yarn", "up", 0],
|
|
333
|
-
"upgrade-interactive": ["yarn", "up", "-i", 0],
|
|
334
|
-
"execute": ["yarn", "dlx", 0],
|
|
335
|
-
"execute-local": ["yarn", "exec", 0],
|
|
336
|
-
"global": ["npm", "i", "-g", 0],
|
|
337
|
-
"global_uninstall": ["npm", "uninstall", "-g", 0]
|
|
338
|
-
},
|
|
339
|
-
"pnpm": pnpm,
|
|
1844
|
+
"npm": npm,
|
|
1845
|
+
"yarn": yarn2,
|
|
1846
|
+
"yarn@berry": yarnBerry,
|
|
1847
|
+
"pnpm": pnpm2,
|
|
1848
|
+
// pnpm v6.x or below
|
|
340
1849
|
"pnpm@6": {
|
|
341
|
-
...
|
|
1850
|
+
...pnpm2,
|
|
342
1851
|
run: npmRun("pnpm")
|
|
343
1852
|
},
|
|
344
|
-
"bun": bun
|
|
1853
|
+
"bun": bun,
|
|
1854
|
+
"deno": deno
|
|
345
1855
|
};
|
|
346
1856
|
function resolveCommand(agent, command, args) {
|
|
347
1857
|
const value = COMMANDS[agent][command];
|
|
@@ -363,10 +1873,10 @@ function constructCommand(value, args) {
|
|
|
363
1873
|
|
|
364
1874
|
// src/utils/nuxt/utils.ts
|
|
365
1875
|
function detectPkgInfo() {
|
|
366
|
-
const
|
|
367
|
-
if (!
|
|
1876
|
+
const userAgent2 = process2.env.npm_config_user_agent;
|
|
1877
|
+
if (!userAgent2)
|
|
368
1878
|
return void 0;
|
|
369
|
-
const pkgSpec =
|
|
1879
|
+
const pkgSpec = userAgent2.split(" ")[0];
|
|
370
1880
|
const pkgSpecArr = pkgSpec.split("/");
|
|
371
1881
|
return {
|
|
372
1882
|
name: pkgSpecArr[0],
|
|
@@ -389,7 +1899,7 @@ function addPackageObject(key, entry, pkg, sort = true) {
|
|
|
389
1899
|
pkg[key][k] = v;
|
|
390
1900
|
});
|
|
391
1901
|
}
|
|
392
|
-
function runCommand(pmDetection, command, args,
|
|
1902
|
+
function runCommand(pmDetection, command, args, cwd2) {
|
|
393
1903
|
let runCommand2 = "npm";
|
|
394
1904
|
let runArgs = [command];
|
|
395
1905
|
if (pmDetection) {
|
|
@@ -397,11 +1907,11 @@ function runCommand(pmDetection, command, args, cwd) {
|
|
|
397
1907
|
runCommand2 = prepare.command;
|
|
398
1908
|
runArgs = prepare.args;
|
|
399
1909
|
}
|
|
400
|
-
const run2 =
|
|
1910
|
+
const run2 = spawnSync(
|
|
401
1911
|
runCommand2,
|
|
402
1912
|
runArgs.filter(Boolean),
|
|
403
1913
|
{
|
|
404
|
-
cwd,
|
|
1914
|
+
cwd: cwd2,
|
|
405
1915
|
stdio: ["inherit", "inherit", "pipe"],
|
|
406
1916
|
shell: true
|
|
407
1917
|
}
|
|
@@ -420,61 +1930,68 @@ function getPaths(rootPath, templateDir, v4) {
|
|
|
420
1930
|
|
|
421
1931
|
// src/utils/nuxt/versions.ts
|
|
422
1932
|
var versions = {
|
|
423
|
-
"vuetify": "^3.
|
|
1933
|
+
"vuetify": "^3.8.1",
|
|
424
1934
|
"typescript": "^5.6.3",
|
|
425
1935
|
"vue-tsc": "^2.1.6",
|
|
426
|
-
"sass-embedded": "^1.
|
|
427
|
-
"@vuetify/loader-shared": "^2.0
|
|
428
|
-
"vite-plugin-vuetify": "^2.
|
|
429
|
-
"vuetify-nuxt-module": "^0.18.
|
|
1936
|
+
"sass-embedded": "^1.86.3",
|
|
1937
|
+
"@vuetify/loader-shared": "^2.1.0",
|
|
1938
|
+
"vite-plugin-vuetify": "^2.1.1",
|
|
1939
|
+
"vuetify-nuxt-module": "^0.18.6",
|
|
430
1940
|
"upath": "^2.0.1",
|
|
431
1941
|
"@mdi/font": "^7.4.47",
|
|
432
|
-
"@nuxt/fonts": "^0.
|
|
1942
|
+
"@nuxt/fonts": "^0.11.1"
|
|
433
1943
|
};
|
|
434
1944
|
|
|
435
|
-
// node_modules/.pnpm/package-manager-detector@
|
|
1945
|
+
// node_modules/.pnpm/package-manager-detector@1.2.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
436
1946
|
var AGENTS = [
|
|
437
1947
|
"npm",
|
|
438
1948
|
"yarn",
|
|
439
1949
|
"yarn@berry",
|
|
440
1950
|
"pnpm",
|
|
441
1951
|
"pnpm@6",
|
|
442
|
-
"bun"
|
|
1952
|
+
"bun",
|
|
1953
|
+
"deno"
|
|
443
1954
|
];
|
|
444
1955
|
var LOCKS = {
|
|
1956
|
+
"bun.lock": "bun",
|
|
445
1957
|
"bun.lockb": "bun",
|
|
1958
|
+
"deno.lock": "deno",
|
|
446
1959
|
"pnpm-lock.yaml": "pnpm",
|
|
1960
|
+
"pnpm-workspace.yaml": "pnpm",
|
|
447
1961
|
"yarn.lock": "yarn",
|
|
448
1962
|
"package-lock.json": "npm",
|
|
449
1963
|
"npm-shrinkwrap.json": "npm"
|
|
450
1964
|
};
|
|
1965
|
+
var INSTALL_METADATA = {
|
|
1966
|
+
"node_modules/.deno/": "deno",
|
|
1967
|
+
"node_modules/.pnpm/": "pnpm",
|
|
1968
|
+
"node_modules/.yarn-state.yml": "yarn",
|
|
1969
|
+
// yarn v2+ (node-modules)
|
|
1970
|
+
"node_modules/.yarn_integrity": "yarn",
|
|
1971
|
+
// yarn v1
|
|
1972
|
+
"node_modules/.package-lock.json": "npm",
|
|
1973
|
+
".pnp.cjs": "yarn",
|
|
1974
|
+
// yarn v3+ (pnp)
|
|
1975
|
+
".pnp.js": "yarn",
|
|
1976
|
+
// yarn v2 (pnp)
|
|
1977
|
+
"bun.lock": "bun",
|
|
1978
|
+
"bun.lockb": "bun"
|
|
1979
|
+
};
|
|
451
1980
|
|
|
452
|
-
// node_modules/.pnpm/package-manager-detector@
|
|
453
|
-
import fs2 from "node:fs";
|
|
454
|
-
import fsPromises from "node:fs/promises";
|
|
1981
|
+
// node_modules/.pnpm/package-manager-detector@1.2.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
1982
|
+
import fs2 from "node:fs/promises";
|
|
455
1983
|
import path2 from "node:path";
|
|
456
1984
|
import process3 from "node:process";
|
|
457
|
-
async function
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
const result2 = await parsePackageJson(path2.join(directory, "package.json"), onUnknown);
|
|
464
|
-
if (result2)
|
|
465
|
-
return result2;
|
|
466
|
-
else
|
|
467
|
-
return { name, agent: name };
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
const result = await parsePackageJson(path2.join(directory, "package.json"), onUnknown);
|
|
471
|
-
if (result)
|
|
472
|
-
return result;
|
|
1985
|
+
async function pathExists(path22, type) {
|
|
1986
|
+
try {
|
|
1987
|
+
const stat = await fs2.stat(path22);
|
|
1988
|
+
return type === "file" ? stat.isFile() : stat.isDirectory();
|
|
1989
|
+
} catch {
|
|
1990
|
+
return false;
|
|
473
1991
|
}
|
|
474
|
-
return null;
|
|
475
1992
|
}
|
|
476
|
-
function* lookup(
|
|
477
|
-
let directory = path2.resolve(
|
|
1993
|
+
function* lookup(cwd2 = process3.cwd()) {
|
|
1994
|
+
let directory = path2.resolve(cwd2);
|
|
478
1995
|
const { root } = path2.parse(directory);
|
|
479
1996
|
while (directory && directory !== root) {
|
|
480
1997
|
yield directory;
|
|
@@ -482,20 +1999,77 @@ function* lookup(cwd = process3.cwd()) {
|
|
|
482
1999
|
}
|
|
483
2000
|
}
|
|
484
2001
|
async function parsePackageJson(filepath, onUnknown) {
|
|
485
|
-
return !filepath || !
|
|
2002
|
+
return !filepath || !pathExists(filepath, "file") ? null : await handlePackageManager(filepath, onUnknown);
|
|
486
2003
|
}
|
|
487
|
-
function
|
|
2004
|
+
async function detect(options = {}) {
|
|
2005
|
+
const { cwd: cwd2, strategies = ["lockfile", "packageManager-field", "devEngines-field"], onUnknown } = options;
|
|
2006
|
+
for (const directory of lookup(cwd2)) {
|
|
2007
|
+
for (const strategy of strategies) {
|
|
2008
|
+
switch (strategy) {
|
|
2009
|
+
case "lockfile": {
|
|
2010
|
+
for (const lock of Object.keys(LOCKS)) {
|
|
2011
|
+
if (await pathExists(path2.join(directory, lock), "file")) {
|
|
2012
|
+
const name = LOCKS[lock];
|
|
2013
|
+
const result = await parsePackageJson(path2.join(directory, "package.json"), onUnknown);
|
|
2014
|
+
if (result)
|
|
2015
|
+
return result;
|
|
2016
|
+
else
|
|
2017
|
+
return { name, agent: name };
|
|
2018
|
+
}
|
|
2019
|
+
}
|
|
2020
|
+
break;
|
|
2021
|
+
}
|
|
2022
|
+
case "packageManager-field":
|
|
2023
|
+
case "devEngines-field": {
|
|
2024
|
+
const result = await parsePackageJson(path2.join(directory, "package.json"), onUnknown);
|
|
2025
|
+
if (result)
|
|
2026
|
+
return result;
|
|
2027
|
+
break;
|
|
2028
|
+
}
|
|
2029
|
+
case "install-metadata": {
|
|
2030
|
+
for (const metadata of Object.keys(INSTALL_METADATA)) {
|
|
2031
|
+
const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
|
|
2032
|
+
if (await pathExists(path2.join(directory, metadata), fileOrDir)) {
|
|
2033
|
+
const name = INSTALL_METADATA[metadata];
|
|
2034
|
+
const agent = name === "yarn" ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name;
|
|
2035
|
+
return { name, agent };
|
|
2036
|
+
}
|
|
2037
|
+
}
|
|
2038
|
+
break;
|
|
2039
|
+
}
|
|
2040
|
+
}
|
|
2041
|
+
}
|
|
2042
|
+
}
|
|
2043
|
+
return null;
|
|
2044
|
+
}
|
|
2045
|
+
function getNameAndVer(pkg) {
|
|
2046
|
+
const handelVer = (version) => version?.match(/\d+(\.\d+){0,2}/)?.[0] ?? version;
|
|
2047
|
+
if (typeof pkg.packageManager === "string") {
|
|
2048
|
+
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
2049
|
+
return { name, ver: handelVer(ver) };
|
|
2050
|
+
}
|
|
2051
|
+
if (typeof pkg.devEngines?.packageManager?.name === "string") {
|
|
2052
|
+
return {
|
|
2053
|
+
name: pkg.devEngines.packageManager.name,
|
|
2054
|
+
ver: handelVer(pkg.devEngines.packageManager.version)
|
|
2055
|
+
};
|
|
2056
|
+
}
|
|
2057
|
+
return void 0;
|
|
2058
|
+
}
|
|
2059
|
+
async function handlePackageManager(filepath, onUnknown) {
|
|
488
2060
|
try {
|
|
489
|
-
const pkg = JSON.parse(fs2.
|
|
2061
|
+
const pkg = JSON.parse(await fs2.readFile(filepath, "utf8"));
|
|
490
2062
|
let agent;
|
|
491
|
-
|
|
492
|
-
|
|
2063
|
+
const nameAndVer = getNameAndVer(pkg);
|
|
2064
|
+
if (nameAndVer) {
|
|
2065
|
+
const name = nameAndVer.name;
|
|
2066
|
+
const ver = nameAndVer.ver;
|
|
493
2067
|
let version = ver;
|
|
494
|
-
if (name === "yarn" && Number.parseInt(ver) > 1) {
|
|
2068
|
+
if (name === "yarn" && ver && Number.parseInt(ver) > 1) {
|
|
495
2069
|
agent = "yarn@berry";
|
|
496
2070
|
version = "berry";
|
|
497
2071
|
return { name, agent, version };
|
|
498
|
-
} else if (name === "pnpm" && Number.parseInt(ver) < 7) {
|
|
2072
|
+
} else if (name === "pnpm" && ver && Number.parseInt(ver) < 7) {
|
|
499
2073
|
agent = "pnpm@6";
|
|
500
2074
|
return { name, agent, version };
|
|
501
2075
|
} else if (AGENTS.includes(name)) {
|
|
@@ -509,15 +2083,8 @@ function handlePackageManager(filepath, onUnknown) {
|
|
|
509
2083
|
}
|
|
510
2084
|
return null;
|
|
511
2085
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
const stats = await fsPromises.stat(filePath);
|
|
515
|
-
if (stats.isFile()) {
|
|
516
|
-
return true;
|
|
517
|
-
}
|
|
518
|
-
} catch {
|
|
519
|
-
}
|
|
520
|
-
return false;
|
|
2086
|
+
function isMetadataYarnClassic(metadataPath) {
|
|
2087
|
+
return metadataPath.endsWith(".yarn_integrity");
|
|
521
2088
|
}
|
|
522
2089
|
|
|
523
2090
|
// src/utils/nuxt/renderNuxtTemplate.ts
|
|
@@ -525,7 +2092,7 @@ import { generateCode, parseModule } from "magicast";
|
|
|
525
2092
|
import { addNuxtModule, getDefaultExportOptions } from "magicast/helpers";
|
|
526
2093
|
async function renderNuxtTemplate(ctx) {
|
|
527
2094
|
const {
|
|
528
|
-
cwd,
|
|
2095
|
+
cwd: cwd2,
|
|
529
2096
|
projectName,
|
|
530
2097
|
projectRoot,
|
|
531
2098
|
useNuxtV4Compat,
|
|
@@ -544,9 +2111,9 @@ async function renderNuxtTemplate(ctx) {
|
|
|
544
2111
|
return "bun x";
|
|
545
2112
|
return "npm exec";
|
|
546
2113
|
});
|
|
547
|
-
|
|
548
|
-
const nuxiCli =
|
|
549
|
-
cwd,
|
|
2114
|
+
const [command, ...args] = fullCustomCommand.split(" ");
|
|
2115
|
+
const nuxiCli = spawnSync2(command, args, {
|
|
2116
|
+
cwd: cwd2,
|
|
550
2117
|
stdio: ["inherit", "inherit", "pipe"],
|
|
551
2118
|
shell: true
|
|
552
2119
|
});
|
|
@@ -816,7 +2383,7 @@ ${banner}
|
|
|
816
2383
|
};
|
|
817
2384
|
const {
|
|
818
2385
|
canOverwrite,
|
|
819
|
-
cwd,
|
|
2386
|
+
cwd: cwd2,
|
|
820
2387
|
projectName,
|
|
821
2388
|
useTypeScript,
|
|
822
2389
|
usePackageManager,
|
|
@@ -829,16 +2396,16 @@ ${banner}
|
|
|
829
2396
|
useNuxtSSR,
|
|
830
2397
|
useNuxtSSRClientHints
|
|
831
2398
|
} = await initPrompts(context);
|
|
832
|
-
const projectRoot =
|
|
2399
|
+
const projectRoot = join3(cwd2, projectName);
|
|
833
2400
|
if (canOverwrite) {
|
|
834
2401
|
rmSync(projectRoot, { recursive: true });
|
|
835
2402
|
}
|
|
836
2403
|
const preset = context.usePreset ?? usePreset;
|
|
837
2404
|
if (preset.startsWith("nuxt-")) {
|
|
838
|
-
const templateRoot =
|
|
839
|
-
const templatePath =
|
|
2405
|
+
const templateRoot = resolve5(dirname3(fileURLToPath(import.meta.url)), "../template/typescript");
|
|
2406
|
+
const templatePath = resolve5(dirname3(fileURLToPath(import.meta.url)), "../template/typescript/nuxt");
|
|
840
2407
|
await renderNuxtTemplate({
|
|
841
|
-
cwd,
|
|
2408
|
+
cwd: cwd2,
|
|
842
2409
|
projectName,
|
|
843
2410
|
projectRoot,
|
|
844
2411
|
templateRoot,
|
|
@@ -851,21 +2418,21 @@ ${banner}
|
|
|
851
2418
|
});
|
|
852
2419
|
} else {
|
|
853
2420
|
mkdirSync2(projectRoot);
|
|
854
|
-
writeFileSync2(
|
|
2421
|
+
writeFileSync2(resolve5(projectRoot, "package.json"), JSON.stringify({ name: projectName }, null, 2));
|
|
855
2422
|
console.log("\n\u25CC Generating scaffold...");
|
|
856
2423
|
const jsOrTs = useTypeScript ? "typescript" : "javascript";
|
|
857
|
-
|
|
858
|
-
renderTemplate(
|
|
2424
|
+
const templatePath = resolve5(dirname3(fileURLToPath(import.meta.url)), "../template", jsOrTs);
|
|
2425
|
+
renderTemplate(resolve5(templatePath, "default"), projectRoot);
|
|
859
2426
|
if (["base", "essentials"].includes(usePreset)) {
|
|
860
|
-
renderTemplate(
|
|
2427
|
+
renderTemplate(resolve5(templatePath, "base"), projectRoot);
|
|
861
2428
|
}
|
|
862
2429
|
if (["essentials", "recommended"].includes(usePreset)) {
|
|
863
|
-
renderTemplate(
|
|
2430
|
+
renderTemplate(resolve5(templatePath, "essentials"), projectRoot);
|
|
864
2431
|
}
|
|
865
2432
|
if (usePackageManager && installDeps) {
|
|
866
2433
|
console.log(`\u25CC Installing dependencies with ${usePackageManager}...
|
|
867
2434
|
`);
|
|
868
|
-
|
|
2435
|
+
await installDependencies2(projectRoot, usePackageManager);
|
|
869
2436
|
}
|
|
870
2437
|
}
|
|
871
2438
|
console.log(`
|