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
package/dist/bin.js CHANGED
@@ -1,10 +1,9 @@
1
- import { c as warnMsg, i as log, l as renderCliDoc, n as errorMsg, o as printHeader, t as accent } from "./terminal-Bz-ps6rJ.js";
2
- import { c as VITE_PLUS_NAME, i as DEFAULT_ENVS, m as resolveBundled, n as BASEURL_TSCONFIG_WARNING, p as resolve$1, r as CONFIG_METADATA_ENV, s as VITE_CONFIG_FILES } from "./constants-CG513DRa.js";
3
- import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-BEZ9IUf7.js";
4
- import { M as runCommandSilently } from "./prompts-CHz_98bJ.js";
5
- import { i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig } from "./tsconfig-7v_BHagU.js";
1
+ import { t as renderCliDoc } from "./help-BmKpeOP9.js";
2
+ import { c as warnMsg, i as log, n as errorMsg, o as printHeader, t as accent } from "./terminal-MKGAuy-p.js";
3
+ import { g as resolveBundled, h as resolve$1, i as DEFAULT_ENVS, l as VITE_CONFIG_FILES, n as BASEURL_TSCONFIG_WARNING, r as CONFIG_METADATA_ENV, u as VITE_PLUS_NAME } from "./constants-Bn-U8o4v.js";
4
+ import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-DX5ezKbB.js";
6
5
  import { t as resolveTsgolintExecutable } from "./tsgolint-path-CbDReEOx.js";
7
- import { i as resolveUniversalViteConfig } from "./resolve-vite-config-Dmeyeyj-.js";
6
+ import { i as resolveUniversalViteConfig } from "./resolve-vite-config-ipGb39Jo.js";
8
7
  import path, { dirname, join } from "node:path";
9
8
  import { fileURLToPath } from "node:url";
10
9
  import { ensureBlockingStdio, hasConfigKey, mergeJsonConfig, run } from "../binding/index.js";
@@ -978,6 +977,10 @@ const commandHelpDocs = {
978
977
  {
979
978
  title: "Options",
980
979
  rows: [
980
+ {
981
+ label: "--no-config",
982
+ description: "Disable config file"
983
+ },
981
984
  {
982
985
  label: "-f, --format <format>",
983
986
  description: "Bundle format: esm, cjs, iife, umd (default: esm)"
@@ -1453,6 +1456,7 @@ export default defineConfig({});
1453
1456
  return viteConfigPath;
1454
1457
  }
1455
1458
  async function vpFmt(cwd, filePath) {
1459
+ const { runCommandSilently } = await import("./command-CLJK5jGW.js");
1456
1460
  const { binPath, envs } = await fmt();
1457
1461
  const result = await runCommandSilently({
1458
1462
  command: binPath,
@@ -1511,6 +1515,7 @@ async function applyToolInitConfigToViteConfig(command, args, projectPath = proc
1511
1515
  }
1512
1516
  if (spec.configKey === "lint" && hasTriggerFlag(args, ["--init"])) {
1513
1517
  const lintInitConfigPath = path.join(projectPath, ".vite-plus-lint-init.oxlintrc.json");
1518
+ const { fixBaseUrlInTsconfig, hasBaseUrlInTsconfig } = await import("./tsconfig-BVHG3DpR.js");
1514
1519
  await fixBaseUrlInTsconfig(projectPath);
1515
1520
  const hasBaseUrl = hasBaseUrlInTsconfig(projectPath);
1516
1521
  const initConfig = createDefaultVitePlusLintConfig({ includeTypeAwareDefaults: !hasBaseUrl });
@@ -1735,7 +1740,11 @@ function getErrorMessage(err) {
1735
1740
  return String(err);
1736
1741
  }
1737
1742
  let args = process.argv.slice(2);
1743
+ const explicitChdirMarker = process.env.VP_EXPLICIT_CHDIR;
1744
+ let explicitChdir = explicitChdirMarker === "1";
1745
+ if (explicitChdirMarker !== void 0) delete process.env.VP_EXPLICIT_CHDIR;
1738
1746
  if (args[0]?.startsWith("-C")) {
1747
+ explicitChdir = true;
1739
1748
  const inline = args[0].length > 2;
1740
1749
  const dir = inline ? args[0].slice(args[0][2] === "=" ? 3 : 2) : args[1];
1741
1750
  if (!dir) {
@@ -1793,6 +1802,7 @@ else try {
1793
1802
  toolchainManifestPath: path.join(cliDistDir, "toolchain.json"),
1794
1803
  vitePlusPackagePath,
1795
1804
  resolveUniversalViteConfig,
1805
+ explicitChdir,
1796
1806
  args: rustCliArgs
1797
1807
  });
1798
1808
  let finalExitCode = exitCode;
@@ -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,8 +1,9 @@
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";
1
+ import { t as renderCliDoc } from "../help-BmKpeOP9.js";
2
+ import { i as log, o as printHeader } from "../terminal-MKGAuy-p.js";
3
+ import { i as promptGitHooks, n as defaultInteractive } from "../prompts-DF3yU-eU.js";
3
4
  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";
5
+ import { o as updateExistingAgentInstructions } from "../agent-Wqx0MPk0.js";
6
+ import { c as isHooksUserDisabled, l as resolveHooksLocation, o as install, s as isGitHooksEnvDisabled } from "../hooks-DFqViZqZ.js";
6
7
  import { join } from "node:path";
7
8
  import { existsSync } from "node:fs";
8
9
  //#region src/config/bin.ts
@@ -60,7 +61,8 @@ async function main() {
60
61
  const lifecycleEvent = process.env.npm_lifecycle_event;
61
62
  const isLifecycleScript = lifecycleEvent === "prepare" || lifecycleEvent === "postinstall";
62
63
  const root = process.cwd();
63
- if (!skipHooks) {
64
+ if (!skipHooks && isGitHooksEnvDisabled()) log("skip install (git hooks disabled)");
65
+ else if (!skipHooks) {
64
66
  const location = resolveHooksLocation(dir);
65
67
  if ("isError" in location) {
66
68
  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.0";
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 TSDOWN_MIGRATE_VERSION = "0.23.0-rc.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 _, TSDOWN_MIGRATE_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 };