create-vuetify 2.3.1 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.mjs +1110 -127
- package/package.json +26 -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 +14 -2
- package/template/javascript/default/package.json +10 -10
- package/template/javascript/default/src/components/AppFooter.vue +6 -3
- package/template/javascript/default/src/components/HelloWorld.vue +41 -108
- package/template/javascript/default/vite.config.mjs +8 -2
- 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 +13 -1
- package/template/typescript/default/README.md +1 -1
- package/template/typescript/default/package.json +12 -14
- package/template/typescript/default/src/components/HelloWorld.vue +41 -108
- package/template/typescript/default/vite.config.mts +6 -0
- 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 +18 -4
- 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 resolve4 } 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 resolve2 } 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,932 @@ 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
|
+
// src/utils/cli/pnpmIgnored.ts
|
|
931
|
+
import { execSync } from "node:child_process";
|
|
932
|
+
function pnpmIgnored(root) {
|
|
933
|
+
const pnpmVersion = execSync(`cd ${root} && pnpm -v`, { encoding: "utf8" }).trim();
|
|
934
|
+
const [major] = pnpmVersion.split(".").map(Number);
|
|
935
|
+
if (major && major >= 10) {
|
|
936
|
+
const detect2 = execSync(`cd ${root} && pnpm ignored-builds`, { encoding: "utf8" });
|
|
937
|
+
if (detect2.startsWith("Automatically ignored builds during installation:\n None")) return;
|
|
938
|
+
return detect2;
|
|
939
|
+
}
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// src/utils/installDependencies.ts
|
|
943
|
+
var userAgent = process.env.npm_config_user_agent ?? "";
|
|
944
|
+
var packageManager = /bun/.test(userAgent) ? "bun" : "pnpm";
|
|
945
|
+
async function installDependencies2(root = process.cwd(), manager = packageManager) {
|
|
946
|
+
await installDependencies({
|
|
947
|
+
packageManager: manager,
|
|
948
|
+
cwd: root,
|
|
949
|
+
silent: true
|
|
950
|
+
}).catch(() => {
|
|
951
|
+
console.error(
|
|
952
|
+
`Failed to install dependencies using ${manager}.`
|
|
953
|
+
);
|
|
954
|
+
}).then(() => {
|
|
955
|
+
if (manager === "pnpm") {
|
|
956
|
+
const detect2 = pnpmIgnored(root);
|
|
957
|
+
if (detect2) console.warn(detect2);
|
|
958
|
+
}
|
|
959
|
+
});
|
|
960
|
+
}
|
|
961
|
+
|
|
962
|
+
// src/utils/prompts.ts
|
|
37
963
|
import validate from "validate-npm-package-name";
|
|
38
964
|
var promptOptions = {
|
|
39
965
|
onCancel: () => {
|
|
@@ -54,9 +980,14 @@ var initPrompts = async (context) => {
|
|
|
54
980
|
type: "text",
|
|
55
981
|
message: "Project name:",
|
|
56
982
|
initial: "vuetify-project",
|
|
983
|
+
format: (v) => v.trim(),
|
|
57
984
|
validate: (v) => {
|
|
58
|
-
const { errors } = validate(String(v).trim());
|
|
59
|
-
|
|
985
|
+
const { errors, warnings, validForNewPackages: isValid } = validate(String(v).trim());
|
|
986
|
+
const error = isValid ? null : errors ? errors[0] : warnings[0];
|
|
987
|
+
if (!isValid) {
|
|
988
|
+
return `Package ${error}`;
|
|
989
|
+
}
|
|
990
|
+
return true;
|
|
60
991
|
}
|
|
61
992
|
},
|
|
62
993
|
{
|
|
@@ -65,10 +996,16 @@ var initPrompts = async (context) => {
|
|
|
65
996
|
inactive: "No",
|
|
66
997
|
initial: false,
|
|
67
998
|
type: (_, { projectName }) => {
|
|
68
|
-
const projectPath =
|
|
69
|
-
return !
|
|
999
|
+
const projectPath = join2(context.cwd, projectName);
|
|
1000
|
+
return !existsSync2(projectPath) || readdirSync(projectPath).length === 0 ? null : "toggle";
|
|
1001
|
+
},
|
|
1002
|
+
onState(a) {
|
|
1003
|
+
if (!a.value) {
|
|
1004
|
+
console.error("\n\n", red("\u2716") + " Target directory exists and is not empty.");
|
|
1005
|
+
process.exit(1);
|
|
1006
|
+
}
|
|
70
1007
|
},
|
|
71
|
-
message: (prev) => `The project path: ${
|
|
1008
|
+
message: (prev) => `The project path: ${resolve2(context.cwd, prev)} already exists, would you like to overwrite this directory?`
|
|
72
1009
|
},
|
|
73
1010
|
{
|
|
74
1011
|
name: "usePreset",
|
|
@@ -102,11 +1039,11 @@ var initPrompts = async (context) => {
|
|
|
102
1039
|
return p.startsWith("nuxt-") ? null : "select";
|
|
103
1040
|
},
|
|
104
1041
|
message: "Would you like to install dependencies with yarn, npm, pnpm, or bun?",
|
|
105
|
-
initial: 0,
|
|
1042
|
+
initial: packageManager === "bun" ? 3 : 0,
|
|
106
1043
|
choices: [
|
|
107
|
-
{ title: "yarn", value: "yarn" },
|
|
108
|
-
{ title: "npm", value: "npm" },
|
|
109
1044
|
{ title: "pnpm", value: "pnpm" },
|
|
1045
|
+
{ title: "npm", value: "npm" },
|
|
1046
|
+
{ title: "yarn", value: "yarn" },
|
|
110
1047
|
{ title: "bun", value: "bun" },
|
|
111
1048
|
{ title: "none", value: null }
|
|
112
1049
|
]
|
|
@@ -180,23 +1117,9 @@ var initPrompts = async (context) => {
|
|
|
180
1117
|
import { red as red2 } from "kolorist";
|
|
181
1118
|
import minimist from "minimist";
|
|
182
1119
|
|
|
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
1120
|
// src/utils/renderTemplate.ts
|
|
198
1121
|
import { copyFileSync, mkdirSync, readdirSync as readdirSync2, readFileSync, statSync, writeFileSync } from "fs";
|
|
199
|
-
import { basename, dirname, resolve as
|
|
1122
|
+
import { basename as basename2, dirname as dirname2, resolve as resolve3 } from "path";
|
|
200
1123
|
|
|
201
1124
|
// src/utils/deepMerge.ts
|
|
202
1125
|
var isObject = (v) => {
|
|
@@ -228,16 +1151,13 @@ function mergePkg(source, destination) {
|
|
|
228
1151
|
}
|
|
229
1152
|
function renderDirectory(source, destination) {
|
|
230
1153
|
mkdirSync(destination, { recursive: true });
|
|
231
|
-
readdirSync2(source).forEach((path4) => renderTemplate(
|
|
1154
|
+
readdirSync2(source).forEach((path4) => renderTemplate(resolve3(source, path4), resolve3(destination, path4)));
|
|
232
1155
|
}
|
|
233
1156
|
function renderFile(source, destination) {
|
|
234
|
-
const filename =
|
|
235
|
-
if (filename.startsWith("_"))
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
mergePkg(source, destination);
|
|
239
|
-
else
|
|
240
|
-
copyFileSync(source, destination);
|
|
1157
|
+
const filename = basename2(source);
|
|
1158
|
+
if (filename.startsWith("_")) destination = resolve3(dirname2(destination), filename.replace("_", "."));
|
|
1159
|
+
if (filename === "package.json") mergePkg(source, destination);
|
|
1160
|
+
else copyFileSync(source, destination);
|
|
241
1161
|
}
|
|
242
1162
|
function renderTemplate(source, destination) {
|
|
243
1163
|
if (statSync(source).isDirectory()) {
|
|
@@ -250,15 +1170,15 @@ function renderTemplate(source, destination) {
|
|
|
250
1170
|
// src/utils/nuxt/renderNuxtTemplate.ts
|
|
251
1171
|
import fs3 from "fs";
|
|
252
1172
|
import path3 from "path";
|
|
253
|
-
import { spawnSync as
|
|
1173
|
+
import { spawnSync as spawnSync2 } from "child_process";
|
|
254
1174
|
|
|
255
1175
|
// src/utils/nuxt/utils.ts
|
|
256
1176
|
import process2 from "process";
|
|
257
1177
|
import path from "path";
|
|
258
|
-
import { spawnSync
|
|
1178
|
+
import { spawnSync } from "child_process";
|
|
259
1179
|
import fs from "fs";
|
|
260
1180
|
|
|
261
|
-
// node_modules/.pnpm/package-manager-detector@0.
|
|
1181
|
+
// node_modules/.pnpm/package-manager-detector@1.0.0/node_modules/package-manager-detector/dist/commands.mjs
|
|
262
1182
|
function npmRun(agent) {
|
|
263
1183
|
return (args) => {
|
|
264
1184
|
if (args.length > 1) {
|
|
@@ -268,11 +1188,30 @@ function npmRun(agent) {
|
|
|
268
1188
|
}
|
|
269
1189
|
};
|
|
270
1190
|
}
|
|
1191
|
+
function denoExecute() {
|
|
1192
|
+
return (args) => {
|
|
1193
|
+
return ["deno", "run", `npm:${args[0]}`, ...args.slice(1)];
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
var npm = {
|
|
1197
|
+
"agent": ["npm", 0],
|
|
1198
|
+
"run": npmRun("npm"),
|
|
1199
|
+
"install": ["npm", "i", 0],
|
|
1200
|
+
"frozen": ["npm", "ci", 0],
|
|
1201
|
+
"global": ["npm", "i", "-g", 0],
|
|
1202
|
+
"add": ["npm", "i", 0],
|
|
1203
|
+
"upgrade": ["npm", "update", 0],
|
|
1204
|
+
"upgrade-interactive": null,
|
|
1205
|
+
"execute": ["npx", 0],
|
|
1206
|
+
"execute-local": ["npx", 0],
|
|
1207
|
+
"uninstall": ["npm", "uninstall", 0],
|
|
1208
|
+
"global_uninstall": ["npm", "uninstall", "-g", 0]
|
|
1209
|
+
};
|
|
271
1210
|
var yarn = {
|
|
272
1211
|
"agent": ["yarn", 0],
|
|
273
1212
|
"run": ["yarn", "run", 0],
|
|
274
1213
|
"install": ["yarn", "install", 0],
|
|
275
|
-
"frozen": ["yarn", "install", "--frozen-lockfile"],
|
|
1214
|
+
"frozen": ["yarn", "install", "--frozen-lockfile", 0],
|
|
276
1215
|
"global": ["yarn", "global", "add", 0],
|
|
277
1216
|
"add": ["yarn", "add", 0],
|
|
278
1217
|
"upgrade": ["yarn", "upgrade", 0],
|
|
@@ -282,11 +1221,22 @@ var yarn = {
|
|
|
282
1221
|
"uninstall": ["yarn", "remove", 0],
|
|
283
1222
|
"global_uninstall": ["yarn", "global", "remove", 0]
|
|
284
1223
|
};
|
|
1224
|
+
var yarnBerry = {
|
|
1225
|
+
...yarn,
|
|
1226
|
+
"frozen": ["yarn", "install", "--immutable", 0],
|
|
1227
|
+
"upgrade": ["yarn", "up", 0],
|
|
1228
|
+
"upgrade-interactive": ["yarn", "up", "-i", 0],
|
|
1229
|
+
"execute": ["yarn", "dlx", 0],
|
|
1230
|
+
"execute-local": ["yarn", "exec", 0],
|
|
1231
|
+
// Yarn 2+ removed 'global', see https://github.com/yarnpkg/berry/issues/821
|
|
1232
|
+
"global": ["npm", "i", "-g", 0],
|
|
1233
|
+
"global_uninstall": ["npm", "uninstall", "-g", 0]
|
|
1234
|
+
};
|
|
285
1235
|
var pnpm = {
|
|
286
1236
|
"agent": ["pnpm", 0],
|
|
287
1237
|
"run": ["pnpm", "run", 0],
|
|
288
1238
|
"install": ["pnpm", "i", 0],
|
|
289
|
-
"frozen": ["pnpm", "i", "--frozen-lockfile"],
|
|
1239
|
+
"frozen": ["pnpm", "i", "--frozen-lockfile", 0],
|
|
290
1240
|
"global": ["pnpm", "add", "-g", 0],
|
|
291
1241
|
"add": ["pnpm", "add", 0],
|
|
292
1242
|
"upgrade": ["pnpm", "update", 0],
|
|
@@ -300,7 +1250,7 @@ var bun = {
|
|
|
300
1250
|
"agent": ["bun", 0],
|
|
301
1251
|
"run": ["bun", "run", 0],
|
|
302
1252
|
"install": ["bun", "install", 0],
|
|
303
|
-
"frozen": ["bun", "install", "--frozen-lockfile"],
|
|
1253
|
+
"frozen": ["bun", "install", "--frozen-lockfile", 0],
|
|
304
1254
|
"global": ["bun", "add", "-g", 0],
|
|
305
1255
|
"add": ["bun", "add", 0],
|
|
306
1256
|
"upgrade": ["bun", "update", 0],
|
|
@@ -310,38 +1260,32 @@ var bun = {
|
|
|
310
1260
|
"uninstall": ["bun", "remove", 0],
|
|
311
1261
|
"global_uninstall": ["bun", "remove", "-g", 0]
|
|
312
1262
|
};
|
|
1263
|
+
var deno = {
|
|
1264
|
+
"agent": ["deno", 0],
|
|
1265
|
+
"run": ["deno", "task", 0],
|
|
1266
|
+
"install": ["deno", "install", 0],
|
|
1267
|
+
"frozen": ["deno", "install", "--frozen", 0],
|
|
1268
|
+
"global": ["deno", "install", "-g", 0],
|
|
1269
|
+
"add": ["deno", "add", 0],
|
|
1270
|
+
"upgrade": ["deno", "outdated", "--update", 0],
|
|
1271
|
+
"upgrade-interactive": ["deno", "outdated", "--update", 0],
|
|
1272
|
+
"execute": denoExecute(),
|
|
1273
|
+
"execute-local": ["deno", "task", "--eval", 0],
|
|
1274
|
+
"uninstall": ["deno", "remove", 0],
|
|
1275
|
+
"global_uninstall": ["deno", "uninstall", "-g", 0]
|
|
1276
|
+
};
|
|
313
1277
|
var COMMANDS = {
|
|
314
|
-
"npm":
|
|
315
|
-
"agent": ["npm", 0],
|
|
316
|
-
"run": npmRun("npm"),
|
|
317
|
-
"install": ["npm", "i", 0],
|
|
318
|
-
"frozen": ["npm", "ci"],
|
|
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
|
-
},
|
|
1278
|
+
"npm": npm,
|
|
328
1279
|
"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
|
-
},
|
|
1280
|
+
"yarn@berry": yarnBerry,
|
|
339
1281
|
"pnpm": pnpm,
|
|
1282
|
+
// pnpm v6.x or below
|
|
340
1283
|
"pnpm@6": {
|
|
341
1284
|
...pnpm,
|
|
342
1285
|
run: npmRun("pnpm")
|
|
343
1286
|
},
|
|
344
|
-
"bun": bun
|
|
1287
|
+
"bun": bun,
|
|
1288
|
+
"deno": deno
|
|
345
1289
|
};
|
|
346
1290
|
function resolveCommand(agent, command, args) {
|
|
347
1291
|
const value = COMMANDS[agent][command];
|
|
@@ -363,10 +1307,10 @@ function constructCommand(value, args) {
|
|
|
363
1307
|
|
|
364
1308
|
// src/utils/nuxt/utils.ts
|
|
365
1309
|
function detectPkgInfo() {
|
|
366
|
-
const
|
|
367
|
-
if (!
|
|
1310
|
+
const userAgent2 = process2.env.npm_config_user_agent;
|
|
1311
|
+
if (!userAgent2)
|
|
368
1312
|
return void 0;
|
|
369
|
-
const pkgSpec =
|
|
1313
|
+
const pkgSpec = userAgent2.split(" ")[0];
|
|
370
1314
|
const pkgSpecArr = pkgSpec.split("/");
|
|
371
1315
|
return {
|
|
372
1316
|
name: pkgSpecArr[0],
|
|
@@ -389,7 +1333,7 @@ function addPackageObject(key, entry, pkg, sort = true) {
|
|
|
389
1333
|
pkg[key][k] = v;
|
|
390
1334
|
});
|
|
391
1335
|
}
|
|
392
|
-
function runCommand(pmDetection, command, args,
|
|
1336
|
+
function runCommand(pmDetection, command, args, cwd2) {
|
|
393
1337
|
let runCommand2 = "npm";
|
|
394
1338
|
let runArgs = [command];
|
|
395
1339
|
if (pmDetection) {
|
|
@@ -397,11 +1341,11 @@ function runCommand(pmDetection, command, args, cwd) {
|
|
|
397
1341
|
runCommand2 = prepare.command;
|
|
398
1342
|
runArgs = prepare.args;
|
|
399
1343
|
}
|
|
400
|
-
const run2 =
|
|
1344
|
+
const run2 = spawnSync(
|
|
401
1345
|
runCommand2,
|
|
402
1346
|
runArgs.filter(Boolean),
|
|
403
1347
|
{
|
|
404
|
-
cwd,
|
|
1348
|
+
cwd: cwd2,
|
|
405
1349
|
stdio: ["inherit", "inherit", "pipe"],
|
|
406
1350
|
shell: true
|
|
407
1351
|
}
|
|
@@ -420,61 +1364,67 @@ function getPaths(rootPath, templateDir, v4) {
|
|
|
420
1364
|
|
|
421
1365
|
// src/utils/nuxt/versions.ts
|
|
422
1366
|
var versions = {
|
|
423
|
-
"vuetify": "^3.
|
|
1367
|
+
"vuetify": "^3.8.1",
|
|
424
1368
|
"typescript": "^5.6.3",
|
|
425
1369
|
"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.
|
|
1370
|
+
"sass-embedded": "^1.86.3",
|
|
1371
|
+
"@vuetify/loader-shared": "^2.1.0",
|
|
1372
|
+
"vite-plugin-vuetify": "^2.1.1",
|
|
1373
|
+
"vuetify-nuxt-module": "^0.18.6",
|
|
430
1374
|
"upath": "^2.0.1",
|
|
431
1375
|
"@mdi/font": "^7.4.47",
|
|
432
|
-
"@nuxt/fonts": "^0.
|
|
1376
|
+
"@nuxt/fonts": "^0.11.1"
|
|
433
1377
|
};
|
|
434
1378
|
|
|
435
|
-
// node_modules/.pnpm/package-manager-detector@0.
|
|
1379
|
+
// node_modules/.pnpm/package-manager-detector@1.0.0/node_modules/package-manager-detector/dist/constants.mjs
|
|
436
1380
|
var AGENTS = [
|
|
437
1381
|
"npm",
|
|
438
1382
|
"yarn",
|
|
439
1383
|
"yarn@berry",
|
|
440
1384
|
"pnpm",
|
|
441
1385
|
"pnpm@6",
|
|
442
|
-
"bun"
|
|
1386
|
+
"bun",
|
|
1387
|
+
"deno"
|
|
443
1388
|
];
|
|
444
1389
|
var LOCKS = {
|
|
1390
|
+
"bun.lock": "bun",
|
|
445
1391
|
"bun.lockb": "bun",
|
|
1392
|
+
"deno.lock": "deno",
|
|
446
1393
|
"pnpm-lock.yaml": "pnpm",
|
|
447
1394
|
"yarn.lock": "yarn",
|
|
448
1395
|
"package-lock.json": "npm",
|
|
449
1396
|
"npm-shrinkwrap.json": "npm"
|
|
450
1397
|
};
|
|
1398
|
+
var INSTALL_METADATA = {
|
|
1399
|
+
"node_modules/.deno/": "deno",
|
|
1400
|
+
"node_modules/.pnpm/": "pnpm",
|
|
1401
|
+
"node_modules/.yarn-state.yml": "yarn",
|
|
1402
|
+
// yarn v2+ (node-modules)
|
|
1403
|
+
"node_modules/.yarn_integrity": "yarn",
|
|
1404
|
+
// yarn v1
|
|
1405
|
+
"node_modules/.package-lock.json": "npm",
|
|
1406
|
+
".pnp.cjs": "yarn",
|
|
1407
|
+
// yarn v3+ (pnp)
|
|
1408
|
+
".pnp.js": "yarn",
|
|
1409
|
+
// yarn v2 (pnp)
|
|
1410
|
+
"bun.lock": "bun",
|
|
1411
|
+
"bun.lockb": "bun"
|
|
1412
|
+
};
|
|
451
1413
|
|
|
452
|
-
// node_modules/.pnpm/package-manager-detector@0.
|
|
1414
|
+
// node_modules/.pnpm/package-manager-detector@1.0.0/node_modules/package-manager-detector/dist/detect.mjs
|
|
453
1415
|
import fs2 from "node:fs";
|
|
454
|
-
import fsPromises from "node:fs/promises";
|
|
455
1416
|
import path2 from "node:path";
|
|
456
1417
|
import process3 from "node:process";
|
|
457
|
-
|
|
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;
|
|
1418
|
+
function pathExists(path22, type) {
|
|
1419
|
+
try {
|
|
1420
|
+
const stat = fs2.statSync(path22);
|
|
1421
|
+
return type === "file" ? stat.isFile() : stat.isDirectory();
|
|
1422
|
+
} catch {
|
|
1423
|
+
return false;
|
|
473
1424
|
}
|
|
474
|
-
return null;
|
|
475
1425
|
}
|
|
476
|
-
function* lookup(
|
|
477
|
-
let directory = path2.resolve(
|
|
1426
|
+
function* lookup(cwd2 = process3.cwd()) {
|
|
1427
|
+
let directory = path2.resolve(cwd2);
|
|
478
1428
|
const { root } = path2.parse(directory);
|
|
479
1429
|
while (directory && directory !== root) {
|
|
480
1430
|
yield directory;
|
|
@@ -482,11 +1432,51 @@ function* lookup(cwd = process3.cwd()) {
|
|
|
482
1432
|
}
|
|
483
1433
|
}
|
|
484
1434
|
async function parsePackageJson(filepath, onUnknown) {
|
|
485
|
-
return !filepath || !
|
|
1435
|
+
return !filepath || !pathExists(filepath, "file") ? null : await handlePackageManager(filepath, onUnknown);
|
|
486
1436
|
}
|
|
487
|
-
function
|
|
1437
|
+
async function detect(options = {}) {
|
|
1438
|
+
const { cwd: cwd2, strategies = ["lockfile", "packageManager-field"], onUnknown } = options;
|
|
1439
|
+
for (const directory of lookup(cwd2)) {
|
|
1440
|
+
for (const strategy of strategies) {
|
|
1441
|
+
switch (strategy) {
|
|
1442
|
+
case "lockfile": {
|
|
1443
|
+
for (const lock of Object.keys(LOCKS)) {
|
|
1444
|
+
if (await pathExists(path2.join(directory, lock), "file")) {
|
|
1445
|
+
const name = LOCKS[lock];
|
|
1446
|
+
const result = await parsePackageJson(path2.join(directory, "package.json"), onUnknown);
|
|
1447
|
+
if (result)
|
|
1448
|
+
return result;
|
|
1449
|
+
else
|
|
1450
|
+
return { name, agent: name };
|
|
1451
|
+
}
|
|
1452
|
+
}
|
|
1453
|
+
break;
|
|
1454
|
+
}
|
|
1455
|
+
case "packageManager-field": {
|
|
1456
|
+
const result = await parsePackageJson(path2.join(directory, "package.json"), onUnknown);
|
|
1457
|
+
if (result)
|
|
1458
|
+
return result;
|
|
1459
|
+
break;
|
|
1460
|
+
}
|
|
1461
|
+
case "install-metadata": {
|
|
1462
|
+
for (const metadata of Object.keys(INSTALL_METADATA)) {
|
|
1463
|
+
const fileOrDir = metadata.endsWith("/") ? "dir" : "file";
|
|
1464
|
+
if (await pathExists(path2.join(directory, metadata), fileOrDir)) {
|
|
1465
|
+
const name = INSTALL_METADATA[metadata];
|
|
1466
|
+
const agent = name === "yarn" ? isMetadataYarnClassic(metadata) ? "yarn" : "yarn@berry" : name;
|
|
1467
|
+
return { name, agent };
|
|
1468
|
+
}
|
|
1469
|
+
}
|
|
1470
|
+
break;
|
|
1471
|
+
}
|
|
1472
|
+
}
|
|
1473
|
+
}
|
|
1474
|
+
}
|
|
1475
|
+
return null;
|
|
1476
|
+
}
|
|
1477
|
+
async function handlePackageManager(filepath, onUnknown) {
|
|
488
1478
|
try {
|
|
489
|
-
const pkg = JSON.parse(fs2.
|
|
1479
|
+
const pkg = JSON.parse(await fs2.promises.readFile(filepath, "utf8"));
|
|
490
1480
|
let agent;
|
|
491
1481
|
if (typeof pkg.packageManager === "string") {
|
|
492
1482
|
const [name, ver] = pkg.packageManager.replace(/^\^/, "").split("@");
|
|
@@ -509,15 +1499,8 @@ function handlePackageManager(filepath, onUnknown) {
|
|
|
509
1499
|
}
|
|
510
1500
|
return null;
|
|
511
1501
|
}
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
const stats = await fsPromises.stat(filePath);
|
|
515
|
-
if (stats.isFile()) {
|
|
516
|
-
return true;
|
|
517
|
-
}
|
|
518
|
-
} catch {
|
|
519
|
-
}
|
|
520
|
-
return false;
|
|
1502
|
+
function isMetadataYarnClassic(metadataPath) {
|
|
1503
|
+
return metadataPath.endsWith(".yarn_integrity");
|
|
521
1504
|
}
|
|
522
1505
|
|
|
523
1506
|
// src/utils/nuxt/renderNuxtTemplate.ts
|
|
@@ -525,7 +1508,7 @@ import { generateCode, parseModule } from "magicast";
|
|
|
525
1508
|
import { addNuxtModule, getDefaultExportOptions } from "magicast/helpers";
|
|
526
1509
|
async function renderNuxtTemplate(ctx) {
|
|
527
1510
|
const {
|
|
528
|
-
cwd,
|
|
1511
|
+
cwd: cwd2,
|
|
529
1512
|
projectName,
|
|
530
1513
|
projectRoot,
|
|
531
1514
|
useNuxtV4Compat,
|
|
@@ -544,9 +1527,9 @@ async function renderNuxtTemplate(ctx) {
|
|
|
544
1527
|
return "bun x";
|
|
545
1528
|
return "npm exec";
|
|
546
1529
|
});
|
|
547
|
-
|
|
548
|
-
const nuxiCli =
|
|
549
|
-
cwd,
|
|
1530
|
+
const [command, ...args] = fullCustomCommand.split(" ");
|
|
1531
|
+
const nuxiCli = spawnSync2(command, args, {
|
|
1532
|
+
cwd: cwd2,
|
|
550
1533
|
stdio: ["inherit", "inherit", "pipe"],
|
|
551
1534
|
shell: true
|
|
552
1535
|
});
|
|
@@ -816,7 +1799,7 @@ ${banner}
|
|
|
816
1799
|
};
|
|
817
1800
|
const {
|
|
818
1801
|
canOverwrite,
|
|
819
|
-
cwd,
|
|
1802
|
+
cwd: cwd2,
|
|
820
1803
|
projectName,
|
|
821
1804
|
useTypeScript,
|
|
822
1805
|
usePackageManager,
|
|
@@ -829,16 +1812,16 @@ ${banner}
|
|
|
829
1812
|
useNuxtSSR,
|
|
830
1813
|
useNuxtSSRClientHints
|
|
831
1814
|
} = await initPrompts(context);
|
|
832
|
-
const projectRoot =
|
|
1815
|
+
const projectRoot = join3(cwd2, projectName);
|
|
833
1816
|
if (canOverwrite) {
|
|
834
1817
|
rmSync(projectRoot, { recursive: true });
|
|
835
1818
|
}
|
|
836
1819
|
const preset = context.usePreset ?? usePreset;
|
|
837
1820
|
if (preset.startsWith("nuxt-")) {
|
|
838
|
-
const templateRoot =
|
|
839
|
-
const templatePath =
|
|
1821
|
+
const templateRoot = resolve4(dirname3(fileURLToPath(import.meta.url)), "../template/typescript");
|
|
1822
|
+
const templatePath = resolve4(dirname3(fileURLToPath(import.meta.url)), "../template/typescript/nuxt");
|
|
840
1823
|
await renderNuxtTemplate({
|
|
841
|
-
cwd,
|
|
1824
|
+
cwd: cwd2,
|
|
842
1825
|
projectName,
|
|
843
1826
|
projectRoot,
|
|
844
1827
|
templateRoot,
|
|
@@ -851,21 +1834,21 @@ ${banner}
|
|
|
851
1834
|
});
|
|
852
1835
|
} else {
|
|
853
1836
|
mkdirSync2(projectRoot);
|
|
854
|
-
writeFileSync2(
|
|
1837
|
+
writeFileSync2(resolve4(projectRoot, "package.json"), JSON.stringify({ name: projectName }, null, 2));
|
|
855
1838
|
console.log("\n\u25CC Generating scaffold...");
|
|
856
1839
|
const jsOrTs = useTypeScript ? "typescript" : "javascript";
|
|
857
|
-
|
|
858
|
-
renderTemplate(
|
|
1840
|
+
const templatePath = resolve4(dirname3(fileURLToPath(import.meta.url)), "../template", jsOrTs);
|
|
1841
|
+
renderTemplate(resolve4(templatePath, "default"), projectRoot);
|
|
859
1842
|
if (["base", "essentials"].includes(usePreset)) {
|
|
860
|
-
renderTemplate(
|
|
1843
|
+
renderTemplate(resolve4(templatePath, "base"), projectRoot);
|
|
861
1844
|
}
|
|
862
1845
|
if (["essentials", "recommended"].includes(usePreset)) {
|
|
863
|
-
renderTemplate(
|
|
1846
|
+
renderTemplate(resolve4(templatePath, "essentials"), projectRoot);
|
|
864
1847
|
}
|
|
865
1848
|
if (usePackageManager && installDeps) {
|
|
866
1849
|
console.log(`\u25CC Installing dependencies with ${usePackageManager}...
|
|
867
1850
|
`);
|
|
868
|
-
|
|
1851
|
+
await installDependencies2(projectRoot, usePackageManager);
|
|
869
1852
|
}
|
|
870
1853
|
}
|
|
871
1854
|
console.log(`
|