vite-plus 0.2.9 → 0.3.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.
Files changed (98) hide show
  1. package/LICENSE +29 -29
  2. package/README.md +6 -5
  3. package/binding/index.cjs +63 -55
  4. package/binding/index.d.cts +218 -14
  5. package/dist/{agent-DQU8uS6P.js → agent-C5jMYVfB.js} +3 -2
  6. package/dist/bin.js +101 -60
  7. package/dist/cli-parse-DHE8NrBU.js +13 -0
  8. package/dist/client/bundledDevClient.mjs +1 -1
  9. package/dist/client/client.mjs +1 -1
  10. package/dist/client/env.mjs +1 -1
  11. package/dist/client.d.ts +1 -1
  12. package/dist/command-CLJK5jGW.js +2 -0
  13. package/dist/command-CguLh2KL.js +471 -0
  14. package/dist/config/bin.js +85 -55
  15. package/dist/{constants-CG513DRa.js → constants-0IAVgpox.js} +5 -3
  16. package/dist/create/bin.d.ts +13 -5
  17. package/dist/create/bin.js +55 -232
  18. package/dist/{define-config-DyNLA_f0.cjs → define-config-DIE9de46.cjs} +2 -2
  19. package/dist/{define-config-DWoAkNdp.d.ts → define-config-DPNEJxPz.d.ts} +5 -9
  20. package/dist/{define-config-CV4bQG_8.js → define-config-U3_xg7i-.js} +2 -2
  21. package/dist/define-config.cjs +1 -1
  22. package/dist/define-config.d.ts +1 -1
  23. package/dist/define-config.js +1 -1
  24. package/dist/dist-DfmT__Aw.js +619 -0
  25. package/dist/{editor-g4PosU99.js → editor-B5-lvRaU.js} +619 -88
  26. package/dist/{terminal-Bz-ps6rJ.js → help-BmKpeOP9.js} +1 -38
  27. package/dist/hooks/bin.js +9 -113
  28. package/dist/{hooks-pNCBWtFT.js → hooks-C-4gykWR.js} +5 -2
  29. package/dist/index.cjs +2 -2
  30. package/dist/index.d.ts +2 -2
  31. package/dist/index.js +2 -2
  32. package/dist/internal.d.ts +1 -1
  33. package/dist/internal.js +1 -1
  34. package/dist/migration/bin.js +76 -146
  35. package/dist/migration/compat/worker.js +1 -1
  36. package/dist/module-runner.d.ts +1 -1
  37. package/dist/module-runner.js +1 -1
  38. package/dist/{oxlint-plugin-config-BEZ9IUf7.js → oxlint-plugin-config-Drdl67Xp.js} +1 -1
  39. package/dist/oxlint-plugin.d.ts +2 -2
  40. package/dist/oxlint-plugin.js +1 -1
  41. package/dist/{pack-PvUg_xpv.d.ts → pack-BK38MLVZ.d.ts} +1 -1
  42. package/dist/pack-bin.d.ts +2 -3
  43. package/dist/pack-bin.js +9 -625
  44. package/dist/pack-client.d.ts +1 -1
  45. package/dist/pack.d.ts +2 -2
  46. package/dist/pack.js +1 -1
  47. package/dist/{package-B4T8RGMG.js → package-BZz2Ij68.js} +2 -2
  48. package/dist/{prompts-CHz_98bJ.js → prompts-CtzEgFY-.js} +7 -1872
  49. package/dist/{report-BS7ULx7A.js → report-CK5TnTsr.js} +2 -0
  50. package/dist/{resolve-vite-config-Dmeyeyj-.js → resolve-vite-config-CGks1xR7.js} +3 -3
  51. package/dist/resolve-vite-config-Dnmc-lBc.js +2 -0
  52. package/dist/semver-CaDAb8vV.js +1400 -0
  53. package/dist/staged/bin.js +82 -187
  54. package/dist/sync-versions/bin.d.ts +1 -0
  55. package/dist/sync-versions/bin.js +3884 -0
  56. package/dist/sync-versions/bin.mjs +13323 -0
  57. package/dist/terminal-MKGAuy-p.js +39 -0
  58. package/dist/toolchain.js +11 -11
  59. package/dist/toolchain.json +11 -11
  60. package/dist/{tsconfig-7v_BHagU.js → tsconfig-CUggNuJR.js} +5 -4
  61. package/dist/tsconfig-VAbm4ZzJ.js +2 -0
  62. package/dist/tsgolint-path.d.ts +3 -4
  63. package/dist/types/customEvent.d.ts +1 -1
  64. package/dist/types/hmrPayload.d.ts +1 -1
  65. package/dist/types/hot.d.ts +1 -1
  66. package/dist/types/import-meta.d.ts +1 -1
  67. package/dist/types/importGlob.d.ts +1 -1
  68. package/dist/types/importMeta.d.ts +1 -1
  69. package/dist/types/metadata.d.ts +1 -1
  70. package/dist/version.d.ts +2 -3
  71. package/dist/version.js +4 -3
  72. package/dist/versions.js +6 -6
  73. package/dist/vitest-ecosystem-BiRqcaRI.js +23 -0
  74. package/docs/guide/check.md +1 -0
  75. package/docs/guide/ci.md +42 -2
  76. package/docs/guide/env.md +136 -50
  77. package/docs/guide/ide-integration.md +14 -2
  78. package/docs/guide/index.md +1 -1
  79. package/docs/guide/install.md +5 -2
  80. package/docs/guide/installer-env-vars.md +51 -5
  81. package/docs/guide/migrate-rules.md +66 -2
  82. package/docs/guide/migrate.md +5 -5
  83. package/docs/guide/test.md +8 -0
  84. package/docs/guide/upgrade.md +48 -1
  85. package/package.json +34 -37
  86. package/dist/lib-L3DWSRQp.js +0 -75
  87. package/docs/_data/team.ts +0 -131
  88. package/docs/package.json +0 -30
  89. package/docs/pnpm-lock.yaml +0 -4003
  90. package/docs/pnpm-workspace.yaml +0 -13
  91. package/docs/public/checkmark.svg +0 -1
  92. package/docs/public/cta-background.jpg +0 -0
  93. package/docs/public/favicon.svg +0 -1
  94. package/docs/public/icon.svg +0 -1
  95. package/docs/public/logo.svg +0 -1
  96. package/docs/public/og.jpg +0 -0
  97. package/docs/vite.config.ts +0 -20
  98. package/dist/{json-qlK6UH0r.js → json-cULBl7Pi.js} +107 -107
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-core/dist/client/client.mjs';
1
+ export * from 'vite/dist/client/client.mjs';
@@ -1 +1 @@
1
- export * from '@voidzero-dev/vite-plus-core/dist/client/env.mjs';
1
+ export * from 'vite/dist/client/env.mjs';
package/dist/client.d.ts CHANGED
@@ -1 +1 @@
1
- /// <reference types="@voidzero-dev/vite-plus-core/client" />
1
+ /// <reference types="vite/client" />
@@ -0,0 +1,2 @@
1
+ import { n as runCommandSilently } from "./command-CguLh2KL.js";
2
+ export { runCommandSilently };
@@ -0,0 +1,471 @@
1
+ import { n as __require, r as __toESM, t as __commonJSMin } from "./rolldown-runtime-CMFfr-1z.js";
2
+ import { constants } from "node:os";
3
+ //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/windows.js
4
+ var require_windows = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ module.exports = isexe;
6
+ isexe.sync = sync;
7
+ var fs$2 = __require("fs");
8
+ function checkPathExt(path, options) {
9
+ var pathext = options.pathExt !== void 0 ? options.pathExt : process.env.PATHEXT;
10
+ if (!pathext) return true;
11
+ pathext = pathext.split(";");
12
+ if (pathext.indexOf("") !== -1) return true;
13
+ for (var i = 0; i < pathext.length; i++) {
14
+ var p = pathext[i].toLowerCase();
15
+ if (p && path.substr(-p.length).toLowerCase() === p) return true;
16
+ }
17
+ return false;
18
+ }
19
+ function checkStat(stat, path, options) {
20
+ if (!stat.isSymbolicLink() && !stat.isFile()) return false;
21
+ return checkPathExt(path, options);
22
+ }
23
+ function isexe(path, options, cb) {
24
+ fs$2.stat(path, function(er, stat) {
25
+ cb(er, er ? false : checkStat(stat, path, options));
26
+ });
27
+ }
28
+ function sync(path, options) {
29
+ return checkStat(fs$2.statSync(path), path, options);
30
+ }
31
+ }));
32
+ //#endregion
33
+ //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/mode.js
34
+ var require_mode = /* @__PURE__ */ __commonJSMin(((exports, module) => {
35
+ module.exports = isexe;
36
+ isexe.sync = sync;
37
+ var fs$1 = __require("fs");
38
+ function isexe(path, options, cb) {
39
+ fs$1.stat(path, function(er, stat) {
40
+ cb(er, er ? false : checkStat(stat, options));
41
+ });
42
+ }
43
+ function sync(path, options) {
44
+ return checkStat(fs$1.statSync(path), options);
45
+ }
46
+ function checkStat(stat, options) {
47
+ return stat.isFile() && checkMode(stat, options);
48
+ }
49
+ function checkMode(stat, options) {
50
+ var mod = stat.mode;
51
+ var uid = stat.uid;
52
+ var gid = stat.gid;
53
+ var myUid = options.uid !== void 0 ? options.uid : process.getuid && process.getuid();
54
+ var myGid = options.gid !== void 0 ? options.gid : process.getgid && process.getgid();
55
+ var u = parseInt("100", 8);
56
+ var g = parseInt("010", 8);
57
+ var o = parseInt("001", 8);
58
+ var ug = u | g;
59
+ return mod & o || mod & g && gid === myGid || mod & u && uid === myUid || mod & ug && myUid === 0;
60
+ }
61
+ }));
62
+ //#endregion
63
+ //#region ../../node_modules/.pnpm/isexe@2.0.0/node_modules/isexe/index.js
64
+ var require_isexe = /* @__PURE__ */ __commonJSMin(((exports, module) => {
65
+ __require("fs");
66
+ var core;
67
+ if (process.platform === "win32" || global.TESTING_WINDOWS) core = require_windows();
68
+ else core = require_mode();
69
+ module.exports = isexe;
70
+ isexe.sync = sync;
71
+ function isexe(path, options, cb) {
72
+ if (typeof options === "function") {
73
+ cb = options;
74
+ options = {};
75
+ }
76
+ if (!cb) {
77
+ if (typeof Promise !== "function") throw new TypeError("callback not provided");
78
+ return new Promise(function(resolve, reject) {
79
+ isexe(path, options || {}, function(er, is) {
80
+ if (er) reject(er);
81
+ else resolve(is);
82
+ });
83
+ });
84
+ }
85
+ core(path, options || {}, function(er, is) {
86
+ if (er) {
87
+ if (er.code === "EACCES" || options && options.ignoreErrors) {
88
+ er = null;
89
+ is = false;
90
+ }
91
+ }
92
+ cb(er, is);
93
+ });
94
+ }
95
+ function sync(path, options) {
96
+ try {
97
+ return core.sync(path, options || {});
98
+ } catch (er) {
99
+ if (options && options.ignoreErrors || er.code === "EACCES") return false;
100
+ else throw er;
101
+ }
102
+ }
103
+ }));
104
+ //#endregion
105
+ //#region ../../node_modules/.pnpm/which@2.0.2/node_modules/which/which.js
106
+ var require_which = /* @__PURE__ */ __commonJSMin(((exports, module) => {
107
+ const isWindows = process.platform === "win32" || process.env.OSTYPE === "cygwin" || process.env.OSTYPE === "msys";
108
+ const path$2 = __require("path");
109
+ const COLON = isWindows ? ";" : ":";
110
+ const isexe = require_isexe();
111
+ const getNotFoundError = (cmd) => Object.assign(/* @__PURE__ */ new Error(`not found: ${cmd}`), { code: "ENOENT" });
112
+ const getPathInfo = (cmd, opt) => {
113
+ const colon = opt.colon || COLON;
114
+ const pathEnv = cmd.match(/\//) || isWindows && cmd.match(/\\/) ? [""] : [...isWindows ? [process.cwd()] : [], ...(opt.path || process.env.PATH ||
115
+ /* istanbul ignore next: very unusual */ "").split(colon)];
116
+ const pathExtExe = isWindows ? opt.pathExt || process.env.PATHEXT || ".EXE;.CMD;.BAT;.COM" : "";
117
+ const pathExt = isWindows ? pathExtExe.split(colon) : [""];
118
+ if (isWindows) {
119
+ if (cmd.indexOf(".") !== -1 && pathExt[0] !== "") pathExt.unshift("");
120
+ }
121
+ return {
122
+ pathEnv,
123
+ pathExt,
124
+ pathExtExe
125
+ };
126
+ };
127
+ const which = (cmd, opt, cb) => {
128
+ if (typeof opt === "function") {
129
+ cb = opt;
130
+ opt = {};
131
+ }
132
+ if (!opt) opt = {};
133
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
134
+ const found = [];
135
+ const step = (i) => new Promise((resolve, reject) => {
136
+ if (i === pathEnv.length) return opt.all && found.length ? resolve(found) : reject(getNotFoundError(cmd));
137
+ const ppRaw = pathEnv[i];
138
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
139
+ const pCmd = path$2.join(pathPart, cmd);
140
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
141
+ resolve(subStep(p, i, 0));
142
+ });
143
+ const subStep = (p, i, ii) => new Promise((resolve, reject) => {
144
+ if (ii === pathExt.length) return resolve(step(i + 1));
145
+ const ext = pathExt[ii];
146
+ isexe(p + ext, { pathExt: pathExtExe }, (er, is) => {
147
+ if (!er && is) {
148
+ if (opt.all) found.push(p + ext);
149
+ else return resolve(p + ext);
150
+ }
151
+ return resolve(subStep(p, i, ii + 1));
152
+ });
153
+ });
154
+ return cb ? step(0).then((res) => cb(null, res), cb) : step(0);
155
+ };
156
+ const whichSync = (cmd, opt) => {
157
+ opt = opt || {};
158
+ const { pathEnv, pathExt, pathExtExe } = getPathInfo(cmd, opt);
159
+ const found = [];
160
+ for (let i = 0; i < pathEnv.length; i++) {
161
+ const ppRaw = pathEnv[i];
162
+ const pathPart = /^".*"$/.test(ppRaw) ? ppRaw.slice(1, -1) : ppRaw;
163
+ const pCmd = path$2.join(pathPart, cmd);
164
+ const p = !pathPart && /^\.[\\\/]/.test(cmd) ? cmd.slice(0, 2) + pCmd : pCmd;
165
+ for (let j = 0; j < pathExt.length; j++) {
166
+ const cur = p + pathExt[j];
167
+ try {
168
+ if (isexe.sync(cur, { pathExt: pathExtExe })) {
169
+ if (opt.all) found.push(cur);
170
+ else return cur;
171
+ }
172
+ } catch (ex) {}
173
+ }
174
+ }
175
+ if (opt.all && found.length) return found;
176
+ if (opt.nothrow) return null;
177
+ throw getNotFoundError(cmd);
178
+ };
179
+ module.exports = which;
180
+ which.sync = whichSync;
181
+ }));
182
+ //#endregion
183
+ //#region ../../node_modules/.pnpm/path-key@3.1.1/node_modules/path-key/index.js
184
+ var require_path_key = /* @__PURE__ */ __commonJSMin(((exports, module) => {
185
+ const pathKey = (options = {}) => {
186
+ const environment = options.env || process.env;
187
+ if ((options.platform || process.platform) !== "win32") return "PATH";
188
+ return Object.keys(environment).reverse().find((key) => key.toUpperCase() === "PATH") || "Path";
189
+ };
190
+ module.exports = pathKey;
191
+ module.exports.default = pathKey;
192
+ }));
193
+ //#endregion
194
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/resolveCommand.js
195
+ var require_resolveCommand = /* @__PURE__ */ __commonJSMin(((exports, module) => {
196
+ const path$1 = __require("path");
197
+ const which = require_which();
198
+ const getPathKey = require_path_key();
199
+ function resolveCommandAttempt(parsed, withoutPathExt) {
200
+ const env = parsed.options.env || process.env;
201
+ const cwd = process.cwd();
202
+ const hasCustomCwd = parsed.options.cwd != null;
203
+ const shouldSwitchCwd = hasCustomCwd && process.chdir !== void 0 && !process.chdir.disabled;
204
+ if (shouldSwitchCwd) try {
205
+ process.chdir(parsed.options.cwd);
206
+ } catch (err) {}
207
+ let resolved;
208
+ try {
209
+ resolved = which.sync(parsed.command, {
210
+ path: env[getPathKey({ env })],
211
+ pathExt: withoutPathExt ? path$1.delimiter : void 0
212
+ });
213
+ } catch (e) {} finally {
214
+ if (shouldSwitchCwd) process.chdir(cwd);
215
+ }
216
+ if (resolved) resolved = path$1.resolve(hasCustomCwd ? parsed.options.cwd : "", resolved);
217
+ return resolved;
218
+ }
219
+ function resolveCommand(parsed) {
220
+ return resolveCommandAttempt(parsed) || resolveCommandAttempt(parsed, true);
221
+ }
222
+ module.exports = resolveCommand;
223
+ }));
224
+ //#endregion
225
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/escape.js
226
+ var require_escape = /* @__PURE__ */ __commonJSMin(((exports, module) => {
227
+ const metaCharsRegExp = /([()\][%!^"`<>&|;, *?])/g;
228
+ function escapeCommand(arg) {
229
+ arg = arg.replace(metaCharsRegExp, "^$1");
230
+ return arg;
231
+ }
232
+ function escapeArgument(arg, doubleEscapeMetaChars) {
233
+ arg = `${arg}`;
234
+ arg = arg.replace(/(?=(\\+?)?)\1"/g, "$1$1\\\"");
235
+ arg = arg.replace(/(?=(\\+?)?)\1$/, "$1$1");
236
+ arg = `"${arg}"`;
237
+ arg = arg.replace(metaCharsRegExp, "^$1");
238
+ if (doubleEscapeMetaChars) arg = arg.replace(metaCharsRegExp, "^$1");
239
+ return arg;
240
+ }
241
+ module.exports.command = escapeCommand;
242
+ module.exports.argument = escapeArgument;
243
+ }));
244
+ //#endregion
245
+ //#region ../../node_modules/.pnpm/shebang-regex@3.0.0/node_modules/shebang-regex/index.js
246
+ var require_shebang_regex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
247
+ module.exports = /^#!(.*)/;
248
+ }));
249
+ //#endregion
250
+ //#region ../../node_modules/.pnpm/shebang-command@2.0.0/node_modules/shebang-command/index.js
251
+ var require_shebang_command = /* @__PURE__ */ __commonJSMin(((exports, module) => {
252
+ const shebangRegex = require_shebang_regex();
253
+ module.exports = (string = "") => {
254
+ const match = string.match(shebangRegex);
255
+ if (!match) return null;
256
+ const [path, argument] = match[0].replace(/#! ?/, "").split(" ");
257
+ const binary = path.split("/").pop();
258
+ if (binary === "env") return argument;
259
+ return argument ? `${binary} ${argument}` : binary;
260
+ };
261
+ }));
262
+ //#endregion
263
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/util/readShebang.js
264
+ var require_readShebang = /* @__PURE__ */ __commonJSMin(((exports, module) => {
265
+ const fs = __require("fs");
266
+ const shebangCommand = require_shebang_command();
267
+ function readShebang(command) {
268
+ const size = 150;
269
+ const buffer = Buffer.alloc(size);
270
+ let fd;
271
+ try {
272
+ fd = fs.openSync(command, "r");
273
+ fs.readSync(fd, buffer, 0, size, 0);
274
+ fs.closeSync(fd);
275
+ } catch (e) {}
276
+ return shebangCommand(buffer.toString());
277
+ }
278
+ module.exports = readShebang;
279
+ }));
280
+ //#endregion
281
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/parse.js
282
+ var require_parse = /* @__PURE__ */ __commonJSMin(((exports, module) => {
283
+ const path = __require("path");
284
+ const resolveCommand = require_resolveCommand();
285
+ const escape = require_escape();
286
+ const readShebang = require_readShebang();
287
+ const isWin = process.platform === "win32";
288
+ const isExecutableRegExp = /\.(?:com|exe)$/i;
289
+ const isCmdShimRegExp = /node_modules[\\/].bin[\\/][^\\/]+\.cmd$/i;
290
+ function detectShebang(parsed) {
291
+ parsed.file = resolveCommand(parsed);
292
+ const shebang = parsed.file && readShebang(parsed.file);
293
+ if (shebang) {
294
+ parsed.args.unshift(parsed.file);
295
+ parsed.command = shebang;
296
+ return resolveCommand(parsed);
297
+ }
298
+ return parsed.file;
299
+ }
300
+ function parseNonShell(parsed) {
301
+ if (!isWin) return parsed;
302
+ const commandFile = detectShebang(parsed);
303
+ const needsShell = !isExecutableRegExp.test(commandFile);
304
+ if (parsed.options.forceShell || needsShell) {
305
+ const needsDoubleEscapeMetaChars = isCmdShimRegExp.test(commandFile);
306
+ parsed.command = path.normalize(parsed.command);
307
+ parsed.command = escape.command(parsed.command);
308
+ parsed.args = parsed.args.map((arg) => escape.argument(arg, needsDoubleEscapeMetaChars));
309
+ parsed.args = [
310
+ "/d",
311
+ "/s",
312
+ "/c",
313
+ `"${[parsed.command].concat(parsed.args).join(" ")}"`
314
+ ];
315
+ parsed.command = process.env.comspec || "cmd.exe";
316
+ parsed.options.windowsVerbatimArguments = true;
317
+ }
318
+ return parsed;
319
+ }
320
+ function parse(command, args, options) {
321
+ if (args && !Array.isArray(args)) {
322
+ options = args;
323
+ args = null;
324
+ }
325
+ args = args ? args.slice(0) : [];
326
+ options = Object.assign({}, options);
327
+ const parsed = {
328
+ command,
329
+ args,
330
+ options,
331
+ file: void 0,
332
+ original: {
333
+ command,
334
+ args
335
+ }
336
+ };
337
+ return options.shell ? parsed : parseNonShell(parsed);
338
+ }
339
+ module.exports = parse;
340
+ }));
341
+ //#endregion
342
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/lib/enoent.js
343
+ var require_enoent = /* @__PURE__ */ __commonJSMin(((exports, module) => {
344
+ const isWin = process.platform === "win32";
345
+ function notFoundError(original, syscall) {
346
+ return Object.assign(/* @__PURE__ */ new Error(`${syscall} ${original.command} ENOENT`), {
347
+ code: "ENOENT",
348
+ errno: "ENOENT",
349
+ syscall: `${syscall} ${original.command}`,
350
+ path: original.command,
351
+ spawnargs: original.args
352
+ });
353
+ }
354
+ function hookChildProcess(cp, parsed) {
355
+ if (!isWin) return;
356
+ const originalEmit = cp.emit;
357
+ cp.emit = function(name, arg1) {
358
+ if (name === "exit") {
359
+ const err = verifyENOENT(arg1, parsed);
360
+ if (err) return originalEmit.call(cp, "error", err);
361
+ }
362
+ return originalEmit.apply(cp, arguments);
363
+ };
364
+ }
365
+ function verifyENOENT(status, parsed) {
366
+ if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawn");
367
+ return null;
368
+ }
369
+ function verifyENOENTSync(status, parsed) {
370
+ if (isWin && status === 1 && !parsed.file) return notFoundError(parsed.original, "spawnSync");
371
+ return null;
372
+ }
373
+ module.exports = {
374
+ hookChildProcess,
375
+ verifyENOENT,
376
+ verifyENOENTSync,
377
+ notFoundError
378
+ };
379
+ }));
380
+ //#endregion
381
+ //#region ../../node_modules/.pnpm/cross-spawn@7.0.6/node_modules/cross-spawn/index.js
382
+ var require_cross_spawn = /* @__PURE__ */ __commonJSMin(((exports, module) => {
383
+ const cp = __require("child_process");
384
+ const parse = require_parse();
385
+ const enoent = require_enoent();
386
+ function spawn(command, args, options) {
387
+ const parsed = parse(command, args, options);
388
+ const spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
389
+ enoent.hookChildProcess(spawned, parsed);
390
+ return spawned;
391
+ }
392
+ function spawnSync(command, args, options) {
393
+ const parsed = parse(command, args, options);
394
+ const result = cp.spawnSync(parsed.command, parsed.args, parsed.options);
395
+ result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
396
+ return result;
397
+ }
398
+ module.exports = spawn;
399
+ module.exports.spawn = spawn;
400
+ module.exports.sync = spawnSync;
401
+ module.exports._parse = parse;
402
+ module.exports._enoent = enoent;
403
+ }));
404
+ //#endregion
405
+ //#region src/utils/command.ts
406
+ var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
407
+ function exitCodeFromClose(code, signal) {
408
+ if (code !== null) return code;
409
+ const signalNumber = signal && constants.signals[signal];
410
+ return signalNumber ? 128 + signalNumber : 1;
411
+ }
412
+ async function runCommandSilently(options) {
413
+ const child = (0, import_cross_spawn.default)(options.command, options.args, {
414
+ stdio: [
415
+ "ignore",
416
+ "pipe",
417
+ "pipe"
418
+ ],
419
+ cwd: options.cwd,
420
+ env: options.envs
421
+ });
422
+ return await new Promise((resolve, reject) => {
423
+ const stdout = [];
424
+ const stderr = [];
425
+ let timedOut = false;
426
+ const timer = options.timeoutMs === void 0 ? void 0 : setTimeout(() => {
427
+ timedOut = true;
428
+ child.kill("SIGKILL");
429
+ }, options.timeoutMs);
430
+ timer?.unref();
431
+ child.stdout?.on("data", (data) => {
432
+ stdout.push(data);
433
+ });
434
+ child.stderr?.on("data", (data) => {
435
+ stderr.push(data);
436
+ });
437
+ child.on("close", (code, signal) => {
438
+ clearTimeout(timer);
439
+ if (timedOut) {
440
+ reject(/* @__PURE__ */ new Error(`Command timed out after ${options.timeoutMs}ms: ${options.command}`));
441
+ return;
442
+ }
443
+ resolve({
444
+ exitCode: exitCodeFromClose(code, signal),
445
+ stdout: Buffer.concat(stdout),
446
+ stderr: Buffer.concat(stderr)
447
+ });
448
+ });
449
+ child.on("error", (err) => {
450
+ clearTimeout(timer);
451
+ reject(err);
452
+ });
453
+ });
454
+ }
455
+ async function runCommand(options) {
456
+ const child = (0, import_cross_spawn.default)(options.command, options.args, {
457
+ stdio: "inherit",
458
+ cwd: options.cwd,
459
+ env: options.envs
460
+ });
461
+ return new Promise((resolve, reject) => {
462
+ child.on("close", (code, signal) => {
463
+ resolve({ exitCode: exitCodeFromClose(code, signal) });
464
+ });
465
+ child.on("error", (err) => {
466
+ reject(err);
467
+ });
468
+ });
469
+ }
470
+ //#endregion
471
+ export { runCommandSilently as n, require_cross_spawn as r, runCommand as t };
@@ -1,66 +1,96 @@
1
- import { i as log, l as renderCliDoc, o as printHeader } from "../terminal-Bz-ps6rJ.js";
2
- import { i as promptGitHooks, n as defaultInteractive } from "../prompts-CHz_98bJ.js";
3
- import { t as lib_default } from "../lib-L3DWSRQp.js";
4
- import { o as updateExistingAgentInstructions } from "../agent-DQU8uS6P.js";
5
- import { c as resolveHooksLocation, o as install, s as isHooksUserDisabled } from "../hooks-pNCBWtFT.js";
6
- import { join } from "node:path";
7
- import { existsSync } from "node:fs";
8
- //#region src/config/bin.ts
9
- async function main() {
10
- const args = lib_default(process.argv.slice(3), {
11
- boolean: [
12
- "help",
13
- "hooks",
14
- "agent"
15
- ],
16
- string: ["hooks-dir"],
17
- alias: { h: "help" }
18
- });
19
- if (args.help) {
20
- const helpMessage = renderCliDoc({
21
- usage: "vp config [OPTIONS]",
22
- summary: "Configure Vite+ for the current project (hook dispatcher + agent integration).",
23
- documentationUrl: "https://viteplus.dev/guide/commit-hooks",
24
- sections: [{
25
- title: "Options",
26
- rows: [
27
- {
28
- label: "--hooks-dir <path>",
29
- description: "Custom hooks directory (default: .vite-hooks, or last used in this clone)"
30
- },
31
- {
32
- label: "--no-hooks",
33
- description: "Skip hook dispatcher installation"
34
- },
35
- {
36
- label: "--no-agent",
37
- description: "Skip updating coding agent instructions"
38
- },
39
- {
40
- label: "-h, --help",
41
- description: "Show this help message"
42
- }
43
- ]
44
- }, {
45
- title: "Environment",
46
- rows: [{
47
- label: "VP_GIT_HOOKS=0",
48
- description: "Skip hook dispatcher installation"
49
- }]
50
- }]
51
- });
52
- printHeader();
53
- log(helpMessage);
1
+ import { i as log, n as errorMsg } from "../terminal-MKGAuy-p.js";
2
+ import { i as promptGitHooks, n as defaultInteractive } from "../prompts-CtzEgFY-.js";
3
+ import { o as updateExistingAgentInstructions } from "../agent-C5jMYVfB.js";
4
+ import { t as require_dist } from "../dist-BDYZP12R.js";
5
+ import { a as install, c as resolveHooksLocation, o as isGitHooksEnvDisabled, s as isHooksUserDisabled } from "../hooks-C-4gykWR.js";
6
+ import { t as unwrapCliParseOutcome } from "../cli-parse-DHE8NrBU.js";
7
+ import path, { join, relative } from "node:path";
8
+ import { parseConfigArgs } from "../../binding/index.js";
9
+ import fs, { existsSync } from "node:fs";
10
+ //#region src/utils/legacy-vitest-alias.ts
11
+ var import_dist = require_dist();
12
+ const LEGACY_VITEST_ALIAS = "npm:@voidzero-dev/vite-plus-test";
13
+ function containsLegacyVitestAlias(value, visited = /* @__PURE__ */ new Set()) {
14
+ if (typeof value === "string") return value === LEGACY_VITEST_ALIAS || value.startsWith(`${LEGACY_VITEST_ALIAS}@`);
15
+ if (value === null || typeof value !== "object" || visited.has(value)) return false;
16
+ visited.add(value);
17
+ return Object.values(value).some((entry) => containsLegacyVitestAlias(entry, visited));
18
+ }
19
+ function asRecord(value) {
20
+ return value !== null && typeof value === "object" && !Array.isArray(value) ? value : void 0;
21
+ }
22
+ function containsAliasInFields(config, fields) {
23
+ const record = asRecord(config);
24
+ return fields.some((field) => containsLegacyVitestAlias(record?.[field]));
25
+ }
26
+ function containsPackageAlias(config) {
27
+ return containsAliasInFields(config, [
28
+ "dependencies",
29
+ "devDependencies",
30
+ "optionalDependencies",
31
+ "peerDependencies",
32
+ "overrides",
33
+ "resolutions",
34
+ "catalog",
35
+ "catalogs"
36
+ ]) || containsAliasInFields(config?.pnpm, ["overrides"]) || containsAliasInFields(config?.workspaces, ["catalog", "catalogs"]);
37
+ }
38
+ function readConfigFile(filePath) {
39
+ try {
40
+ const source = fs.readFileSync(filePath, "utf8");
41
+ return asRecord(path.basename(filePath) === "package.json" ? JSON.parse(source) : (0, import_dist.parse)(source));
42
+ } catch {
54
43
  return;
55
44
  }
56
- const dir = args["hooks-dir"];
45
+ }
46
+ /**
47
+ * Find a package-manager setting that still aliases Vitest to the deleted
48
+ * `@voidzero-dev/vite-plus-test` wrapper. Check the nearest package and its
49
+ * workspace root, without inspecting unrelated ancestor package settings.
50
+ */
51
+ function findLegacyVitestAliasConfig(startDir) {
52
+ let currentDir = path.resolve(startDir);
53
+ let foundPackage = false;
54
+ while (true) {
55
+ const packagePath = path.join(currentDir, "package.json");
56
+ const pkg = readConfigFile(packagePath);
57
+ const isNearestPackage = !foundPackage && fs.existsSync(packagePath);
58
+ if (isNearestPackage) foundPackage = true;
59
+ const workspacePath = path.join(currentDir, "pnpm-workspace.yaml");
60
+ const isWorkspaceRoot = fs.existsSync(workspacePath) || pkg !== void 0 && Object.hasOwn(pkg, "workspaces");
61
+ if ((isNearestPackage || isWorkspaceRoot) && containsPackageAlias(pkg)) return packagePath;
62
+ if (isWorkspaceRoot) {
63
+ if (containsAliasInFields(readConfigFile(workspacePath), [
64
+ "catalog",
65
+ "catalogs",
66
+ "overrides"
67
+ ])) return workspacePath;
68
+ return;
69
+ }
70
+ const parentDir = path.dirname(currentDir);
71
+ if (parentDir === currentDir) return;
72
+ currentDir = parentDir;
73
+ }
74
+ }
75
+ //#endregion
76
+ //#region src/config/bin.ts
77
+ async function main() {
78
+ const args = unwrapCliParseOutcome(parseConfigArgs(process.argv.slice(3)));
79
+ const dir = args.hooksDir;
57
80
  const skipHooks = args.hooks === false;
58
81
  const skipAgent = args.agent === false;
59
82
  const interactive = defaultInteractive();
60
83
  const lifecycleEvent = process.env.npm_lifecycle_event;
61
84
  const isLifecycleScript = lifecycleEvent === "prepare" || lifecycleEvent === "postinstall";
62
85
  const root = process.cwd();
63
- if (!skipHooks) {
86
+ const staleVitestAliasConfig = findLegacyVitestAliasConfig(root);
87
+ if (staleVitestAliasConfig) {
88
+ const relativeConfigPath = relative(root, staleVitestAliasConfig);
89
+ errorMsg(`Found a stale Vitest alias in ${relativeConfigPath} that points to the removed \`@voidzero-dev/vite-plus-test\` package. Run \`vp migrate\` to update the project before installing dependencies.`);
90
+ process.exit(1);
91
+ }
92
+ if (!skipHooks && isGitHooksEnvDisabled()) log("skip install (git hooks disabled)");
93
+ else if (!skipHooks) {
64
94
  const location = resolveHooksLocation(dir);
65
95
  if ("isError" in location) {
66
96
  if (location.message) log(location.message);
@@ -1,6 +1,6 @@
1
1
  import { createRequire } from "node:module";
2
2
  //#region package.json
3
- var version = "0.2.9";
3
+ var version = "0.3.1";
4
4
  //#endregion
5
5
  //#region src/utils/constants.ts
6
6
  const VITE_PLUS_NAME = "vite-plus";
@@ -13,7 +13,9 @@ const VITE_CONFIG_FILES = [
13
13
  "vite.config.mts",
14
14
  "vite.config.cts"
15
15
  ];
16
- const VITEST_VERSION = "4.1.10";
16
+ const VITEST_VERSION = "4.1.11";
17
+ const SETUP_VP_VERSION = "v1.19.0";
18
+ const TSDOWN_MIGRATION_SKILL_URL = "https://github.com/rolldown/tsdown/blob/main/skills/tsdown-migrate/SKILL.md";
17
19
  const VITE_PLUS_OVERRIDE_PACKAGES = process.env.VP_OVERRIDE_PACKAGES ? JSON.parse(process.env.VP_OVERRIDE_PACKAGES) : {
18
20
  vite: `npm:@voidzero-dev/vite-plus-core@${VITE_PLUS_VERSION}`,
19
21
  vitest: VITEST_VERSION
@@ -75,4 +77,4 @@ const DEFAULT_ENVS = {
75
77
  };
76
78
  const CONFIG_METADATA_ENV = "VP_RESOLVING_CONFIG_METADATA";
77
79
  //#endregion
78
- export { VITEST_AGE_GATE_EXEMPT_PACKAGES as a, VITE_PLUS_NAME as c, createBaseUrlTsconfigFixArgs as d, isForceOverrideMode as f, version as h, DEFAULT_ENVS as i, VITE_PLUS_OVERRIDE_PACKAGES as l, resolveBundled as m, BASEURL_TSCONFIG_WARNING as n, VITEST_VERSION as o, resolve as p, CONFIG_METADATA_ENV as r, VITE_CONFIG_FILES as s, BASEURL_TSCONFIG_FIX_PACKAGE as t, VITE_PLUS_VERSION as u };
80
+ export { version as _, SETUP_VP_VERSION as a, VITEST_VERSION as c, VITE_PLUS_OVERRIDE_PACKAGES as d, VITE_PLUS_VERSION as f, resolveBundled as g, resolve as h, DEFAULT_ENVS as i, VITE_CONFIG_FILES as l, isForceOverrideMode as m, BASEURL_TSCONFIG_WARNING as n, TSDOWN_MIGRATION_SKILL_URL as o, createBaseUrlTsconfigFixArgs as p, CONFIG_METADATA_ENV as r, VITEST_AGE_GATE_EXEMPT_PACKAGES as s, BASEURL_TSCONFIG_FIX_PACKAGE as t, VITE_PLUS_NAME as u };