vite-plus 0.2.9 → 0.3.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.
Files changed (58) hide show
  1. package/README.md +4 -3
  2. package/binding/index.cjs +57 -54
  3. package/binding/index.d.cts +93 -0
  4. package/dist/{agent-DQU8uS6P.js → agent-Wqx0MPk0.js} +1 -1
  5. package/dist/bin.js +16 -6
  6. package/dist/command-CLJK5jGW.js +2 -0
  7. package/dist/command-CguLh2KL.js +471 -0
  8. package/dist/config/bin.js +7 -5
  9. package/dist/{constants-CG513DRa.js → constants-Bn-U8o4v.js} +5 -3
  10. package/dist/create/bin.js +28 -52
  11. package/dist/{define-config-CV4bQG_8.js → define-config-GXUdVT-0.js} +2 -2
  12. package/dist/{define-config-DyNLA_f0.cjs → define-config-WiVlryJ2.cjs} +2 -2
  13. package/dist/define-config.cjs +1 -1
  14. package/dist/define-config.js +1 -1
  15. package/dist/{editor-g4PosU99.js → editor-CC4DqODz.js} +562 -59
  16. package/dist/{terminal-Bz-ps6rJ.js → help-BmKpeOP9.js} +1 -38
  17. package/dist/hooks/bin.js +3 -2
  18. package/dist/{hooks-pNCBWtFT.js → hooks-DFqViZqZ.js} +5 -2
  19. package/dist/index.cjs +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/migration/bin.js +60 -11
  22. package/dist/migration/compat/worker.js +1 -1
  23. package/dist/{oxlint-plugin-config-BEZ9IUf7.js → oxlint-plugin-config-DX5ezKbB.js} +1 -1
  24. package/dist/oxlint-plugin.js +1 -1
  25. package/dist/pack-bin.js +5 -4
  26. package/dist/{package-B4T8RGMG.js → package-CBe9EWPY.js} +2 -2
  27. package/dist/{prompts-CHz_98bJ.js → prompts-DF3yU-eU.js} +6 -474
  28. package/dist/{report-BS7ULx7A.js → report-ZNR1Mk6h.js} +1 -0
  29. package/dist/{resolve-vite-config-Dmeyeyj-.js → resolve-vite-config-ipGb39Jo.js} +2 -2
  30. package/dist/staged/bin.js +77 -47
  31. package/dist/terminal-MKGAuy-p.js +39 -0
  32. package/dist/toolchain.js +9 -9
  33. package/dist/toolchain.json +9 -9
  34. package/dist/tsconfig-BVHG3DpR.js +2 -0
  35. package/dist/{tsconfig-7v_BHagU.js → tsconfig-LD2QhQ0O.js} +5 -4
  36. package/dist/version.js +4 -3
  37. package/dist/versions.js +5 -5
  38. package/docs/guide/env.md +20 -6
  39. package/docs/guide/install.md +2 -1
  40. package/docs/guide/installer-env-vars.md +41 -5
  41. package/docs/guide/migrate-rules.md +9 -0
  42. package/docs/guide/migrate.md +5 -5
  43. package/docs/guide/test.md +8 -0
  44. package/docs/guide/upgrade.md +48 -1
  45. package/package.json +32 -33
  46. package/docs/_data/team.ts +0 -131
  47. package/docs/package.json +0 -30
  48. package/docs/pnpm-lock.yaml +0 -4003
  49. package/docs/pnpm-workspace.yaml +0 -13
  50. package/docs/public/checkmark.svg +0 -1
  51. package/docs/public/cta-background.jpg +0 -0
  52. package/docs/public/favicon.svg +0 -1
  53. package/docs/public/icon.svg +0 -1
  54. package/docs/public/logo.svg +0 -1
  55. package/docs/public/og.jpg +0 -0
  56. package/docs/vite.config.ts +0 -20
  57. package/dist/{json-qlK6UH0r.js → json-cULBl7Pi.js} +107 -107
  58. package/dist/{log-update-CoW8Z4Dl.js → log-update-DHZRyJ2m.js} +1 -1
@@ -1,486 +1,18 @@
1
- import { n as __require, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-CMFfr-1z.js";
2
- import { t as accent } from "./terminal-Bz-ps6rJ.js";
3
- import { u as VITE_PLUS_VERSION } from "./constants-CG513DRa.js";
4
- import { a as writeJsonFile, i as readJsonFile } from "./json-qlK6UH0r.js";
1
+ import { r as __toESM, t as __commonJSMin } from "./rolldown-runtime-CMFfr-1z.js";
2
+ import { t as accent } from "./terminal-MKGAuy-p.js";
3
+ import { f as VITE_PLUS_VERSION } from "./constants-Bn-U8o4v.js";
4
+ import { a as writeJsonFile, i as readJsonFile } from "./json-cULBl7Pi.js";
5
+ import { n as runCommandSilently } from "./command-CguLh2KL.js";
5
6
  import { t as require_dist } from "./dist-BDYZP12R.js";
6
7
  import path from "node:path";
7
8
  import { downloadPackageManager } from "../binding/index.js";
8
9
  import { stripVTControlCharacters, styleText } from "node:util";
9
10
  import fs from "node:fs";
10
- import { constants as constants$1 } from "node:os";
11
11
  import process$1, { stdin, stdout } from "node:process";
12
12
  import * as l from "node:readline";
13
13
  import l__default from "node:readline";
14
14
  import { ReadStream } from "node:tty";
15
15
  import { randomBytes } from "node:crypto";
16
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
17
- var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
18
- module.exports = isexe;
19
- isexe.sync = sync;
20
- var fs$3 = __require("fs");
21
- function checkPathExt(path, options) {
22
- var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
23
- if (!pathext) return true;
24
- pathext = pathext.split(";");
25
- if (pathext.indexOf("") !== -1) return true;
26
- for (var i = 0; i < pathext.length; i++) {
27
- var p = pathext[i].toLowerCase();
28
- if (p && path.substr(-p.length).toLowerCase() === p) return true;
29
- }
30
- return false;
31
- }
32
- function checkStat(stat, path, options) {
33
- if (!stat.isSymbolicLink() && !stat.isFile()) return false;
34
- return checkPathExt(path, options);
35
- }
36
- function isexe(path, options, cb) {
37
- fs$3.stat(path, function(er, stat) {
38
- cb(er, er ? false : checkStat(stat, path, options));
39
- });
40
- }
41
- function sync(path, options) {
42
- return checkStat(fs$3.statSync(path), path, options);
43
- }
44
- }));
45
- //#endregion
46
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
47
- var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
48
- module.exports = isexe;
49
- isexe.sync = sync;
50
- var fs$2 = __require("fs");
51
- function isexe(path, options, cb) {
52
- fs$2.stat(path, function(er, stat) {
53
- cb(er, er ? false : checkStat(stat, options));
54
- });
55
- }
56
- function sync(path, options) {
57
- return checkStat(fs$2.statSync(path), options);
58
- }
59
- function checkStat(stat, options) {
60
- return stat.isFile() && checkMode(stat, options);
61
- }
62
- function checkMode(stat, options) {
63
- var mod = stat.mode;
64
- var uid = stat.uid;
65
- var gid = stat.gid;
66
- var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
67
- var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
68
- var u = parseInt("100", 8);
69
- var g = parseInt("010", 8);
70
- var o = parseInt("001", 8);
71
- var ug = u | g;
72
- return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
73
- }
74
- }));
75
- //#endregion
76
- //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
77
- var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
78
- __require("fs");
79
- var core;
80
- if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
81
- else core = require_mode();
82
- module.exports = isexe;
83
- isexe.sync = sync;
84
- function isexe(path, options, cb) {
85
- if (typeof options === "function") {
86
- cb = options;
87
- options = {};
88
- }
89
- if (!cb) {
90
- if (typeof Promise !== "function") throw new TypeError("callback not provided");
91
- return new Promise(function(resolve, reject) {
92
- isexe(path, options || {}, function(er, is) {
93
- if (er) reject(er);
94
- else resolve(is);
95
- });
96
- });
97
- }
98
- core(path, options || {}, function(er, is) {
99
- if (er) {
100
- if (er.code === "EACCES" || options && options.ignoreErrors) {
101
- er = null;
102
- is = false;
103
- }
104
- }
105
- cb(er, is);
106
- });
107
- }
108
- function sync(path, options) {
109
- try {
110
- return core.sync(path, options || {});
111
- } catch (er) {
112
- if (options && options.ignoreErrors || er.code === "EACCES") return false;
113
- else throw er;
114
- }
115
- }
116
- }));
117
- //#endregion
118
- //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
119
- var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
120
- const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
121
- const path$3 = __require("path");
122
- const COLON = isWindows ? ";" : ":";
123
- const isexe = require_isexe();
124
- const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
125
- const getPathInfo = (cmd, opt) => {
126
- const colon = opt.colon || COLON;
127
- const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
128
- /* istanbul ignore next: very unusual */ "").split(colon)];
129
- const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
130
- const pathExt = isWindows ? pathExtExe.split(colon) : [""];
131
- if (isWindows) {
132
- if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
133
- }
134
- return {
135
- pathEnv,
136
- pathExt,
137
- pathExtExe
138
- };
139
- };
140
- const which = (cmd, opt, cb) => {
141
- if (typeof opt === "function") {
142
- cb = opt;
143
- opt = {};
144
- }
145
- if (!opt) opt = {};
146
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
147
- const found = [];
148
- const step = (i) => new Promise((resolve, reject) => {
149
- if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
150
- const ppRaw = pathEnv[i];
151
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
152
- const pCmd = path$3.join(pathPart, cmd);
153
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
154
- resolve(subStep(p, i, 0));
155
- });
156
- const subStep = (p, i, ii) => new Promise((resolve, reject) => {
157
- if (ii === pathExt.length) return resolve(step(i + 1));
158
- const ext = pathExt[ii];
159
- isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
160
- if (!er && is) {
161
- if (opt.all) found.push(p + ext);
162
- else return resolve(p + ext);
163
- }
164
- return resolve(subStep(p, i, ii + 1));
165
- });
166
- });
167
- return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
168
- };
169
- const whichSync = (cmd, opt) => {
170
- opt = opt || {};
171
- const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
172
- const found = [];
173
- for (let i = 0; i < pathEnv.length; i++) {
174
- const ppRaw = pathEnv[i];
175
- const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
176
- const pCmd = path$3.join(pathPart, cmd);
177
- const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
178
- for (let j = 0; j < pathExt.length; j++) {
179
- const cur = p + pathExt[j];
180
- try {
181
- if (isexe.sync(cur, { pathExt: pathExtExe })) {
182
- if (opt.all) found.push(cur);
183
- else return cur;
184
- }
185
- } catch (ex) {}
186
- }
187
- }
188
- if (opt.all && found.length) return found;
189
- if (opt.nothrow) return null;
190
- throw getNotFoundError(cmd);
191
- };
192
- module.exports = which;
193
- which.sync = whichSync;
194
- }));
195
- //#endregion
196
- //#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
197
- var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
198
- const pathKey = (options = {}) => {
199
- const environment = options.env || process.env;
200
- if ((options.platform || process.platform) !== "win32") return "PATH";
201
- return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
202
- };
203
- module.exports = pathKey;
204
- module.exports.default = pathKey;
205
- }));
206
- //#endregion
207
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
208
- var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
209
- const path$2 = __require("path");
210
- const which = require_which();
211
- const getPathKey = require_path_key();
212
- function resolveCommandAttempt(parsed, withoutPathExt) {
213
- const env = parsed.options.env || process.env;
214
- const cwd = process.cwd();
215
- const hasCustomCwd = parsed.options.cwd != null;
216
- const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
217
- if (shouldSwitchCwd) try {
218
- process.chdir(parsed.options.cwd);
219
- } catch (err) {}
220
- let resolved;
221
- try {
222
- resolved = which.sync(parsed.command, {
223
- path: env[getPathKey({ env })],
224
- pathExt: withoutPathExt ? path$2.delimiter : void 0
225
- });
226
- } catch (e) {} finally {
227
- if (shouldSwitchCwd) process.chdir(cwd);
228
- }
229
- if (resolved) resolved = path$2.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
230
- return resolved;
231
- }
232
- function resolveCommand(parsed) {
233
- return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
234
- }
235
- module.exports = resolveCommand;
236
- }));
237
- //#endregion
238
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
239
- var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
240
- const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
241
- function escapeCommand(arg) {
242
- arg = arg.replace(metaCharsRegExp, "^$1");
243
- return arg;
244
- }
245
- function escapeArgument(arg, doubleEscapeMetaChars) {
246
- arg = `${arg}`;
247
- arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
248
- arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
249
- arg = `"${arg}"`;
250
- arg = arg.replace(metaCharsRegExp, "^$1");
251
- if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
252
- return arg;
253
- }
254
- module.exports.command = escapeCommand;
255
- module.exports.argument = escapeArgument;
256
- }));
257
- //#endregion
258
- //#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
259
- var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
260
- module.exports = /^#!(.*)/;
261
- }));
262
- //#endregion
263
- //#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
264
- var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
265
- const shebangRegex = require_shebang_regex();
266
- module.exports = (string = "") => {
267
- const match = string.match(shebangRegex);
268
- if (!match) return null;
269
- const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
270
- const binary = path.split("/").pop();
271
- if (binary === "env") return argument;
272
- return argument ? `${binary} ${argument}` : binary;
273
- };
274
- }));
275
- //#endregion
276
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
277
- var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
278
- const fs$1 = __require("fs");
279
- const shebangCommand = require_shebang_command();
280
- function readShebang(command) {
281
- const size = 150;
282
- const buffer = Buffer.alloc(size);
283
- let fd;
284
- try {
285
- fd = fs$1.openSync(command, "r");
286
- fs$1.readSync(fd, buffer, 0, size, 0);
287
- fs$1.closeSync(fd);
288
- } catch (e) {}
289
- return shebangCommand(buffer.toString());
290
- }
291
- module.exports = readShebang;
292
- }));
293
- //#endregion
294
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
295
- var require_parse$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
296
- const path$1 = __require("path");
297
- const resolveCommand = require_resolveCommand();
298
- const escape = require_escape();
299
- const readShebang = require_readShebang();
300
- const isWin = process.platform === "win32";
301
- const isExecutableRegExp = /\.(?:com|exe)$/i;
302
- const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
303
- function detectShebang(parsed) {
304
- parsed.file = resolveCommand(parsed);
305
- const shebang = parsed.file && readShebang(parsed.file);
306
- if (shebang) {
307
- parsed.args.unshift(parsed.file);
308
- parsed.command = shebang;
309
- return resolveCommand(parsed);
310
- }
311
- return parsed.file;
312
- }
313
- function parseNonShell(parsed) {
314
- if (!isWin) return parsed;
315
- const commandFile = detectShebang(parsed);
316
- const needsShell = !isExecutableRegExp.test(commandFile);
317
- if (parsed.options.forceShell || needsShell) {
318
- const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
319
- parsed.command = path$1.normalize(parsed.command);
320
- parsed.command = escape.command(parsed.command);
321
- parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
322
- parsed.args = [
323
- "/d",
324
- "/s",
325
- "/c",
326
- `"${[parsed.command].concat(parsed.args).join(" ")}"`
327
- ];
328
- parsed.command = process.env.comspec || "cmd.exe";
329
- parsed.options.windowsVerbatimArguments = true;
330
- }
331
- return parsed;
332
- }
333
- function parse(command, args, options) {
334
- if (args && !Array.isArray(args)) {
335
- options = args;
336
- args = null;
337
- }
338
- args = args ? args.slice(0) : [];
339
- options = Object.assign({}, options);
340
- const parsed = {
341
- command,
342
- args,
343
- options,
344
- file: void 0,
345
- original: {
346
- command,
347
- args
348
- }
349
- };
350
- return options.shell ? parsed : parseNonShell(parsed);
351
- }
352
- module.exports = parse;
353
- }));
354
- //#endregion
355
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
356
- var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
357
- const isWin = process.platform === "win32";
358
- function notFoundError(original, syscall) {
359
- return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
360
- code: "ENOENT",
361
- errno: "ENOENT",
362
- syscall: `${syscall} ${original.command}`,
363
- path: original.command,
364
- spawnargs: original.args
365
- });
366
- }
367
- function hookChildProcess(cp, parsed) {
368
- if (!isWin) return;
369
- const originalEmit = cp.emit;
370
- cp.emit = function(name, arg1) {
371
- if (name === "exit") {
372
- const err = verifyENOENT(arg1, parsed);
373
- if (err) return originalEmit.call(cp, "error", err);
374
- }
375
- return originalEmit.apply(cp, arguments);
376
- };
377
- }
378
- function verifyENOENT(status, parsed) {
379
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
380
- return null;
381
- }
382
- function verifyENOENTSync(status, parsed) {
383
- if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
384
- return null;
385
- }
386
- module.exports = {
387
- hookChildProcess,
388
- verifyENOENT,
389
- verifyENOENTSync,
390
- notFoundError
391
- };
392
- }));
393
- //#endregion
394
- //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
395
- var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
396
- const cp = __require("child_process");
397
- const parse = require_parse$1();
398
- const enoent = require_enoent();
399
- function spawn(command, args, options) {
400
- const parsed = parse(command, args, options);
401
- const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
402
- enoent.hookChildProcess(spawned, parsed);
403
- return spawned;
404
- }
405
- function spawnSync(command, args, options) {
406
- const parsed = parse(command, args, options);
407
- const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
408
- result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
409
- return result;
410
- }
411
- module.exports = spawn;
412
- module.exports.spawn = spawn;
413
- module.exports.sync = spawnSync;
414
- module.exports._parse = parse;
415
- module.exports._enoent = enoent;
416
- }));
417
- //#endregion
418
- //#region src/utils/command.ts
419
- var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
420
- function exitCodeFromClose(code, signal) {
421
- if (code !== null) return code;
422
- const signalNumber = signal && constants$1.signals[signal];
423
- return signalNumber ? 128 + signalNumber : 1;
424
- }
425
- async function runCommandSilently(options) {
426
- const child = (0, import_cross_spawn.default)(options.command, options.args, {
427
- stdio: [
428
- "ignore",
429
- "pipe",
430
- "pipe"
431
- ],
432
- cwd: options.cwd,
433
- env: options.envs
434
- });
435
- return await new Promise((resolve, reject) => {
436
- const stdout = [];
437
- const stderr = [];
438
- let timedOut = false;
439
- const timer = options.timeoutMs === void 0 ? void 0 : setTimeout(() => {
440
- timedOut = true;
441
- child.kill("SIGKILL");
442
- }, options.timeoutMs);
443
- timer?.unref();
444
- child.stdout?.on("data", (data) => {
445
- stdout.push(data);
446
- });
447
- child.stderr?.on("data", (data) => {
448
- stderr.push(data);
449
- });
450
- child.on("close", (code, signal) => {
451
- clearTimeout(timer);
452
- if (timedOut) {
453
- reject(/* @__PURE__ */ new Error(`Command timed out after ${options.timeoutMs}ms: ${options.command}`));
454
- return;
455
- }
456
- resolve({
457
- exitCode: exitCodeFromClose(code, signal),
458
- stdout: Buffer.concat(stdout),
459
- stderr: Buffer.concat(stderr)
460
- });
461
- });
462
- child.on("error", (err) => {
463
- clearTimeout(timer);
464
- reject(err);
465
- });
466
- });
467
- }
468
- async function runCommand$1(options) {
469
- const child = (0, import_cross_spawn.default)(options.command, options.args, {
470
- stdio: "inherit",
471
- cwd: options.cwd,
472
- env: options.envs
473
- });
474
- return new Promise((resolve, reject) => {
475
- child.on("close", (code, signal) => {
476
- resolve({ exitCode: exitCodeFromClose(code, signal) });
477
- });
478
- child.on("error", (err) => {
479
- reject(err);
480
- });
481
- });
482
- }
483
- //#endregion
484
16
  //#region ../../node_modules/.pnpm/fast-string-truncated-width@3.0.3/node_modules/fast-string-truncated-width/dist/utils.js
485
17
  const getCodePointsLength$1 = (() => {
486
18
  const SURROGATE_PAIR_RE = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
@@ -4354,4 +3886,4 @@ function defaultInteractive() {
4354
3886
  return !process.env.CI && process.stdin.isTTY;
4355
3887
  }
4356
3888
  //#endregion
4357
- export { isCancel as A, log as C, spinner as D, select as E, runCommandSilently as M, require_cross_spawn as N, text as O, intro as S, outro as T, getSpinner as _, resolveGitInit as a, require_semver as b, selectPackageManager as c, readYamlFile as d, scalarString as f, getSilentSpinner as g, resolveApproveBuildTargets as h, promptGitHooks as i, runCommand$1 as j, require_picocolors as k, upgradeYarn as l, detectGatedBuilds as m, defaultInteractive as n, runViteFmt as o, approveBuilds as p, downloadPackageManager$1 as r, runViteInstall as s, cancelAndExit as t, editYamlFile as u, DependencyType as v, multiselect as w, confirm as x, PackageManager as y };
3889
+ export { isCancel as A, log as C, spinner as D, select as E, text as O, intro as S, outro as T, getSpinner as _, resolveGitInit as a, require_semver as b, selectPackageManager as c, readYamlFile as d, scalarString as f, getSilentSpinner as g, resolveApproveBuildTargets as h, promptGitHooks as i, require_picocolors as k, upgradeYarn as l, detectGatedBuilds as m, defaultInteractive as n, runViteFmt as o, approveBuilds as p, downloadPackageManager$1 as r, runViteInstall as s, cancelAndExit as t, editYamlFile as u, DependencyType as v, multiselect as w, confirm as x, PackageManager as y };
@@ -12,6 +12,7 @@ function createMigrationReport() {
12
12
  preservedUpstreamVitestImportFileCount: 0,
13
13
  rewrittenImportErrors: [],
14
14
  eslintMigrated: false,
15
+ tsupMigrated: false,
15
16
  prettierMigrated: false,
16
17
  nodeVersionFileMigrated: false,
17
18
  gitHooksConfigured: false,
@@ -1,5 +1,5 @@
1
- import { s as VITE_CONFIG_FILES } from "./constants-CG513DRa.js";
2
- import { u as withConfigMetadataResolution } from "./define-config-CV4bQG_8.js";
1
+ import { l as VITE_CONFIG_FILES } from "./constants-Bn-U8o4v.js";
2
+ import { u as withConfigMetadataResolution } from "./define-config-GXUdVT-0.js";
3
3
  import path from "node:path";
4
4
  import fs from "node:fs";
5
5
  //#region src/resolve-vite-config.ts
@@ -1,17 +1,18 @@
1
1
  import { r as __toESM, t as __commonJSMin } from "../rolldown-runtime-CMFfr-1z.js";
2
- import { i as log, l as renderCliDoc, n as errorMsg, o as printHeader } from "../terminal-Bz-ps6rJ.js";
3
- import { a as resolveViteConfig } from "../resolve-vite-config-Dmeyeyj-.js";
2
+ import { t as renderCliDoc } from "../help-BmKpeOP9.js";
3
+ import { i as log, n as errorMsg, o as printHeader } from "../terminal-MKGAuy-p.js";
4
+ import { a as resolveViteConfig } from "../resolve-vite-config-ipGb39Jo.js";
4
5
  import { t as lib_default } from "../lib-L3DWSRQp.js";
5
6
  import { createRequire } from "node:module";
6
7
  import path, { basename, delimiter, dirname, normalize, resolve } from "node:path";
7
8
  import { pathToFileURL } from "node:url";
8
9
  import { formatWithOptions, inspect, promisify } from "node:util";
9
10
  import { closeSync, constants, openSync, readSync, statSync } from "node:fs";
10
- import { EOL } from "node:os";
11
11
  import { cwd } from "node:process";
12
12
  import l__default from "node:readline";
13
13
  import nodeTty from "node:tty";
14
14
  import crypto from "node:crypto";
15
+ import { EOL } from "node:os";
15
16
  import fsPromises, { constants as constants$2 } from "node:fs/promises";
16
17
  import { PassThrough, Writable } from "node:stream";
17
18
  import { exec, spawn } from "node:child_process";
@@ -1558,7 +1559,7 @@ var DefaultRenderer = class DefaultRenderer {
1558
1559
  this.logger.options.color = this.options.color;
1559
1560
  }
1560
1561
  async render() {
1561
- const { createLogUpdate } = await import("../log-update-CoW8Z4Dl.js");
1562
+ const { createLogUpdate } = await import("../log-update-DHZRyJ2m.js");
1562
1563
  const { default: truncate } = await import("../cli-truncate-Bg3RDXpi.js");
1563
1564
  const { default: wrap } = await import("../wrap-ansi-DUi52C6W.js");
1564
1565
  this.updater = createLogUpdate(this.logger.process.stdout);
@@ -6641,37 +6642,66 @@ const lintStaged = async ({ allowEmpty = false, color = SUPPORTS_COLOR, concurre
6641
6642
  }
6642
6643
  };
6643
6644
  //#endregion
6645
+ //#region src/staged/args.ts
6646
+ function parseStagedArgs(argv) {
6647
+ return lib_default(argv, {
6648
+ alias: {
6649
+ h: "help",
6650
+ p: "concurrent",
6651
+ d: "debug",
6652
+ q: "quiet",
6653
+ r: "relative",
6654
+ v: "verbose"
6655
+ },
6656
+ boolean: [
6657
+ "help",
6658
+ "allow-empty",
6659
+ "debug",
6660
+ "continue-on-error",
6661
+ "fail-on-changes",
6662
+ "hide-partially-staged",
6663
+ "hide-unstaged",
6664
+ "quiet",
6665
+ "relative",
6666
+ "revert",
6667
+ "stash",
6668
+ "verbose"
6669
+ ],
6670
+ string: [
6671
+ "concurrent",
6672
+ "cwd",
6673
+ "diff",
6674
+ "diff-filter"
6675
+ ]
6676
+ });
6677
+ }
6678
+ function normalizeStagedArgs(args) {
6679
+ return {
6680
+ concurrent: normalizeConcurrent(args.concurrent),
6681
+ cwd: normalizeStringOption(args.cwd, "cwd", "path"),
6682
+ diff: normalizeStringOption(args.diff, "diff", "string"),
6683
+ diffFilter: normalizeStringOption(args["diff-filter"], "diff-filter", "string")
6684
+ };
6685
+ }
6686
+ function normalizeConcurrent(value) {
6687
+ if (value == null) return;
6688
+ if (value === true || value === false) return value;
6689
+ if (value === "") return true;
6690
+ if (value === "true") return true;
6691
+ if (value === "false") return false;
6692
+ const number = Number(value);
6693
+ if (Number.isFinite(number) && number > 0) return number;
6694
+ throw new Error("Option \"--concurrent\" must be true, false, or a number greater than 0.");
6695
+ }
6696
+ function normalizeStringOption(value, option, valueName) {
6697
+ if (value == null) return;
6698
+ if (value === false) throw new Error(`Option "--no-${option}" is not supported. Use "--${option} <${valueName}>".`);
6699
+ if (typeof value !== "string" || value === "") throw new Error(`Option "--${option}" requires a value.`);
6700
+ return value;
6701
+ }
6702
+ //#endregion
6644
6703
  //#region src/staged/bin.ts
6645
- const args = lib_default(process.argv.slice(3), {
6646
- alias: {
6647
- h: "help",
6648
- p: "concurrent",
6649
- d: "debug",
6650
- q: "quiet",
6651
- r: "relative",
6652
- v: "verbose"
6653
- },
6654
- boolean: [
6655
- "help",
6656
- "allow-empty",
6657
- "debug",
6658
- "continue-on-error",
6659
- "fail-on-changes",
6660
- "hide-partially-staged",
6661
- "hide-unstaged",
6662
- "quiet",
6663
- "relative",
6664
- "revert",
6665
- "stash",
6666
- "verbose"
6667
- ],
6668
- string: [
6669
- "concurrent",
6670
- "cwd",
6671
- "diff",
6672
- "diff-filter"
6673
- ]
6674
- });
6704
+ const args = parseStagedArgs(process.argv.slice(3));
6675
6705
  if (args.help) {
6676
6706
  const helpMessage = renderCliDoc({
6677
6707
  usage: "vp staged [options]",
@@ -6750,6 +6780,14 @@ if (args.help) {
6750
6780
  printHeader();
6751
6781
  log(helpMessage);
6752
6782
  } else {
6783
+ let normalizedArgs;
6784
+ try {
6785
+ normalizedArgs = normalizeStagedArgs(args);
6786
+ } catch (err) {
6787
+ printHeader();
6788
+ errorMsg(err instanceof Error ? err.message : String(err));
6789
+ process.exit(1);
6790
+ }
6753
6791
  const options = {};
6754
6792
  if (args["allow-empty"] != null) options.allowEmpty = args["allow-empty"];
6755
6793
  if (args.debug != null) options.debug = args.debug;
@@ -6764,7 +6802,7 @@ if (args.help) {
6764
6802
  if (args.verbose != null) options.verbose = args.verbose;
6765
6803
  let stagedConfig;
6766
6804
  try {
6767
- stagedConfig = (await resolveViteConfig(args.cwd ?? process.cwd())).staged;
6805
+ stagedConfig = (await resolveViteConfig(normalizedArgs.cwd ?? process.cwd())).staged;
6768
6806
  } catch (err) {
6769
6807
  const message = err instanceof Error ? err.message : String(err);
6770
6808
  log(`Failed to load vite.config: ${message}`);
@@ -6781,18 +6819,10 @@ if (args.help) {
6781
6819
  log(" });");
6782
6820
  process.exit(1);
6783
6821
  }
6784
- if (args.cwd != null) options.cwd = args.cwd;
6785
- if (args.diff != null) options.diff = args.diff;
6786
- if (args["diff-filter"] != null) options.diffFilter = args["diff-filter"];
6787
- if (args.concurrent != null) {
6788
- const val = args.concurrent;
6789
- if (val === "true") options.concurrent = true;
6790
- else if (val === "false") options.concurrent = false;
6791
- else {
6792
- const num = Number(val);
6793
- options.concurrent = Number.isNaN(num) || val === "" ? true : num;
6794
- }
6795
- }
6822
+ if (normalizedArgs.cwd != null) options.cwd = normalizedArgs.cwd;
6823
+ if (normalizedArgs.diff != null) options.diff = normalizedArgs.diff;
6824
+ if (normalizedArgs.diffFilter != null) options.diffFilter = normalizedArgs.diffFilter;
6825
+ if (normalizedArgs.concurrent != null) options.concurrent = normalizedArgs.concurrent;
6796
6826
  const success = await lintStaged(options);
6797
6827
  process.exit(success ? 0 : 1);
6798
6828
  }