vite-plus 1.3.0 → 1.5.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 (106) hide show
  1. package/AGENTS.md +4 -0
  2. package/LICENSE +1 -878
  3. package/README.md +1 -1
  4. package/bin/vpx +9 -0
  5. package/binding/index.cjs +59 -54
  6. package/binding/index.d.cts +159 -2
  7. package/dist/{agent-97KmGCyL.js → agent-DkQD3xqe.js} +5 -7
  8. package/dist/bin.js +35 -34
  9. package/dist/{cli-parse-DHE8NrBU.js → cli-parse-aeUeFDlC.js} +2 -3
  10. package/dist/command-TjS_6y9O.js +1 -0
  11. package/dist/{command-CdMBoZFD.js → command-rY79K5NI.js} +28 -30
  12. package/dist/{comparison-CmVirWIW-DUGaiYqF.js → comparison-CmVirWIW-UlEf2maz.js} +1 -2
  13. package/dist/config/bin.js +8 -10
  14. package/dist/{constants-DR55DpRm.js → constants-D2P2aVKb.js} +8 -6
  15. package/dist/create/bin.d.ts +4 -8
  16. package/dist/create/bin.js +151 -120
  17. package/dist/{define-config-Bexdd6RZ.d.ts → define-config-BrvHRi-G.d.ts} +31 -13
  18. package/dist/{define-config-BxDc_9BK.cjs → define-config-CwtQqYC1.cjs} +41 -14
  19. package/dist/{define-config-CvE5pHqB.js → define-config-wR57OZG_.js} +34 -12
  20. package/dist/define-config.cjs +2 -1
  21. package/dist/define-config.d.ts +2 -2
  22. package/dist/define-config.js +1 -1
  23. package/dist/{dist-DIpm7mot.js → dist-Bs0SObNC.js} +73 -145
  24. package/dist/{dist-Cqz8OtiO.js → dist-CdkMvIiQ.js} +11 -5
  25. package/dist/dist-zDZV5eEc.js +3 -0
  26. package/dist/{documentation-DqcZSthV.js → documentation-cv_y0Auv.js} +1 -2
  27. package/dist/{editor-CtJGQP7C.js → editor-aOy1T15H.js} +2735 -5072
  28. package/dist/{help-BmKpeOP9.js → help-B03t_iQ4.js} +1 -2
  29. package/dist/hooks/bin.js +4 -5
  30. package/dist/{hooks-DhwsWb46.js → hooks-w_e2whkQ.js} +45 -25
  31. package/dist/index.cjs +5 -5
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.js +2 -2
  34. package/dist/{json-JP24qHUF.js → json-kl84kDyH.js} +9 -18
  35. package/dist/lint-plugins.cjs +1 -1
  36. package/dist/migration/bin.js +1782 -256
  37. package/dist/migration/compat/worker.js +4 -6
  38. package/dist/{oxlint-plugin-config-BIzrO2y2.js → oxlint-plugin-config-CHsI_zKo.js} +3 -4
  39. package/dist/oxlint-plugin.d.ts +0 -2
  40. package/dist/oxlint-plugin.js +33 -9
  41. package/dist/{pack-BK38MLVZ.d.ts → pack-ARPFMefW.d.ts} +0 -2
  42. package/dist/pack-bin.d.ts +1 -3
  43. package/dist/pack-bin.js +4 -5
  44. package/dist/pack.d.ts +1 -1
  45. package/dist/{package-CQDXTm6j.js → package-DfFo6-E-.js} +10 -95
  46. package/dist/{package-overrides-D1RcXSFl.js → package-overrides-Ci8GXouY.js} +5 -8
  47. package/dist/picomatch-DEUoj81q.js +1916 -0
  48. package/dist/{prompts-1xNz_ne0.js → prompts-C7DI63WP.js} +30 -50
  49. package/dist/{protocol-D99W10Qi.js → protocol-CkNmY-Mr.js} +1 -2
  50. package/dist/register.d.ts +1 -0
  51. package/dist/register.js +12 -0
  52. package/dist/{report-NhQk8VHb.js → report-BEdpIQvC.js} +4 -2
  53. package/dist/resolve-vite-config-33bzSaeT.js +1 -0
  54. package/dist/{resolve-vite-config-BVr1SUNg.js → resolve-vite-config-Cx3cnVVI.js} +9 -25
  55. package/dist/{rolldown-runtime-kJ_i4yPo.js → rolldown-runtime-DegdyBIC.js} +1 -2
  56. package/dist/script-esm-hooks.d.ts +11 -0
  57. package/dist/script-esm-hooks.js +27 -0
  58. package/dist/script-hooks-9Fof5UMY.js +176 -0
  59. package/dist/script-preload.cjs +491 -0
  60. package/dist/script-register.d.ts +1 -0
  61. package/dist/script-register.js +27 -0
  62. package/dist/script-watch.d.ts +1 -0
  63. package/dist/script-watch.js +2002 -0
  64. package/dist/staged/bin.js +53 -2011
  65. package/dist/sync-versions/bin.js +26 -48
  66. package/dist/sync-versions/bin.mjs +109 -217
  67. package/dist/{terminal-MKGAuy-p.js → terminal-BcuPUy-j.js} +1 -2
  68. package/dist/toolchain.js +38 -12
  69. package/dist/toolchain.json +38 -12
  70. package/dist/{tsconfig-zWgHiQ3X.js → tsconfig-BE3Wj9OX.js} +1 -1
  71. package/dist/{tsconfig-BZu7kl-x.js → tsconfig-shNmmCE_.js} +8 -10
  72. package/dist/version.d.ts +1 -3
  73. package/dist/version.js +5 -6
  74. package/dist/versions.js +7 -7
  75. package/dist/{vitest-ecosystem-BU0AqZq-.js → vitest-ecosystem-BeEYz-qF.js} +1 -2
  76. package/dist/{vitest-v5-entry-points-DthU1e_O.js → vitest-v5-entry-points-NyJsFeux.js} +1 -2
  77. package/dist/vpx-bin.d.ts +1 -0
  78. package/dist/vpx-bin.js +232 -0
  79. package/dist/vpx-script-EXgV5QOf.js +434 -0
  80. package/docs/config/check.md +2 -0
  81. package/docs/config/fmt.md +1 -1
  82. package/docs/config/lint.md +1 -1
  83. package/docs/config/run.md +10 -2
  84. package/docs/config/staged.md +1 -1
  85. package/docs/guide/check.md +6 -1
  86. package/docs/guide/ci.md +13 -3
  87. package/docs/guide/create.md +1 -1
  88. package/docs/guide/env.md +11 -4
  89. package/docs/guide/global-cli.md +59 -3
  90. package/docs/guide/homebrew.md +127 -0
  91. package/docs/guide/ide-integration.md +1 -3
  92. package/docs/guide/implode.md +5 -3
  93. package/docs/guide/local-cli.md +21 -0
  94. package/docs/guide/migrate-rules.md +120 -18
  95. package/docs/guide/migrate.md +9 -9
  96. package/docs/guide/package-management.md +1 -1
  97. package/docs/guide/run.md +23 -1
  98. package/docs/guide/test.md +1 -1
  99. package/docs/guide/troubleshooting.md +1 -1
  100. package/docs/guide/upgrade.md +12 -6
  101. package/docs/guide/vitest-v5.md +2 -2
  102. package/docs/guide/vpx.md +210 -9
  103. package/package.json +43 -34
  104. package/dist/command-DVTILtS-.js +0 -1
  105. package/dist/dist-Dhu07wmN.js +0 -3
  106. package/dist/resolve-vite-config-7WDtXO4G.js +0 -1
@@ -0,0 +1,434 @@
1
+ import path from "node:path";
2
+ import { accessSync, closeSync, constants, openSync, readSync, statSync } from "node:fs";
3
+ // src/vpx-script.ts
4
+ /**
5
+ * Script detection for the project-local `vpx` bin. Mirrors the global CLI in
6
+ * `crates/vp_global_cli/src/commands/vpx_script.rs`; keep the two in sync.
7
+ */
8
+ const SCRIPT_EXTENSIONS = [
9
+ ".ts",
10
+ ".mts",
11
+ ".cts",
12
+ ".tsx",
13
+ ".js",
14
+ ".mjs",
15
+ ".cjs",
16
+ ".jsx"
17
+ ];
18
+ const TS_EXTENSIONS = /* @__PURE__ */ new Set([
19
+ ".ts",
20
+ ".mts",
21
+ ".cts",
22
+ ".tsx"
23
+ ]);
24
+ /** Node.js options that take a required value, which may come as the next argument (best effort). */
25
+ const NODE_OPTIONS_WITH_VALUE = /* @__PURE__ */ new Set([
26
+ "-C",
27
+ "-e",
28
+ "-p",
29
+ "-pe",
30
+ "-r",
31
+ "--allow-fs-read",
32
+ "--allow-fs-write",
33
+ "--build-sea",
34
+ "--build-snapshot-config",
35
+ "--conditions",
36
+ "--cpu-prof-dir",
37
+ "--cpu-prof-interval",
38
+ "--cpu-prof-name",
39
+ "--debug-port",
40
+ "--diagnostic-dir",
41
+ "--disable-proto",
42
+ "--disable-warning",
43
+ "--dns-result-order",
44
+ "--env-file",
45
+ "--env-file-if-exists",
46
+ "--eval",
47
+ "--experimental-config-file",
48
+ "--experimental-default-type",
49
+ "--experimental-loader",
50
+ "--experimental-package-map",
51
+ "--experimental-sea-config",
52
+ "--experimental-test-isolation",
53
+ "--experimental-test-tag-filter",
54
+ "--heap-prof-dir",
55
+ "--heap-prof-interval",
56
+ "--heap-prof-name",
57
+ "--heapsnapshot-near-heap-limit",
58
+ "--heapsnapshot-signal",
59
+ "--icu-data-dir",
60
+ "--import",
61
+ "--input-type",
62
+ "--inspect-port",
63
+ "--inspect-publish-uid",
64
+ "--loader",
65
+ "--localstorage-file",
66
+ "--max-http-header-size",
67
+ "--max-old-space-size-percentage",
68
+ "--network-family-autoselection-attempt-timeout",
69
+ "--openssl-config",
70
+ "--print",
71
+ "--redirect-warnings",
72
+ "--report-dir",
73
+ "--report-directory",
74
+ "--report-filename",
75
+ "--report-signal",
76
+ "--require",
77
+ "--run",
78
+ "--secure-heap",
79
+ "--secure-heap-min",
80
+ "--snapshot-blob",
81
+ "--test-concurrency",
82
+ "--test-coverage-branches",
83
+ "--test-coverage-exclude",
84
+ "--test-coverage-functions",
85
+ "--test-coverage-include",
86
+ "--test-coverage-lines",
87
+ "--test-global-setup",
88
+ "--test-isolation",
89
+ "--test-name-pattern",
90
+ "--test-random-seed",
91
+ "--test-reporter",
92
+ "--test-reporter-destination",
93
+ "--test-rerun-failures",
94
+ "--test-shard",
95
+ "--test-skip-pattern",
96
+ "--test-timeout",
97
+ "--title",
98
+ "--tls-cipher-list",
99
+ "--tls-keylog",
100
+ "--trace-event-categories",
101
+ "--trace-event-file-pattern",
102
+ "--trace-require-module",
103
+ "--unhandled-rejections",
104
+ "--use-largepages",
105
+ "--v8-pool-size",
106
+ "--watch-kill-signal",
107
+ "--watch-path"
108
+ ]);
109
+ /**
110
+ * Node.js options after which positionals are not an entry file: the code of `--eval` /
111
+ * `--print` or the package script of `--run` runs instead, and `--test` takes test files
112
+ * and globs.
113
+ */
114
+ const NODE_OPTIONS_WITHOUT_ENTRY = /* @__PURE__ */ new Set([
115
+ "-e",
116
+ "--eval",
117
+ "-p",
118
+ "-pe",
119
+ "--print",
120
+ "--run",
121
+ "--test"
122
+ ]);
123
+ /**
124
+ * The watcher's options that take a value, which may come as the next argument, so that
125
+ * value is not taken for the script.
126
+ */
127
+ const WATCH_OPTIONS_WITH_VALUE = /* @__PURE__ */ new Set([
128
+ "--exclude",
129
+ "--ignore",
130
+ "--include",
131
+ "--kill-signal",
132
+ "--kill-timeout"
133
+ ]);
134
+ /**
135
+ * The option an argument names, without `=value`. Node.js accepts `_` for `-` in long
136
+ * option names, as in `--redirect_warnings`.
137
+ */
138
+ function nodeOptionName(arg) {
139
+ const name = arg.split("=", 1)[0];
140
+ return name.startsWith("--") ? `--${name.slice(2).replaceAll("_", "-")}` : name;
141
+ }
142
+ /**
143
+ * Whether the option `name`, given without `=value`, takes `next` as its value. Node.js
144
+ * 24.19, 26.1, and later read a bare `--experimental-config-file` as `node.config.json`,
145
+ * and older releases take the next argument as the config file, so that argument is its
146
+ * value only when it is a `.json` file, which cannot be the script either way. Mirrors
147
+ * `takes_next_arg` in the global CLI.
148
+ */
149
+ function takesNextArg(name, next) {
150
+ if (name === "--experimental-config-file") return next.endsWith(".json") && !next.startsWith("-");
151
+ return NODE_OPTIONS_WITH_VALUE.has(name) || WATCH_OPTIONS_WITH_VALUE.has(name);
152
+ }
153
+ /** npx-style: flags come before the first positional or unknown flag. */
154
+ function parseVpxArgs(args) {
155
+ const flags = {
156
+ packages: [],
157
+ shellMode: false,
158
+ silent: false,
159
+ help: false,
160
+ version: false
161
+ };
162
+ let index = 0;
163
+ for (; index < args.length; index++) {
164
+ const arg = args[index];
165
+ if (arg === "-p" || arg === "--package") {
166
+ index++;
167
+ if (index < args.length) flags.packages.push(args[index]);
168
+ } else if (arg.startsWith("--package=") || arg.startsWith("-p=")) flags.packages.push(arg.slice(arg.indexOf("=") + 1));
169
+ else if (arg === "-c" || arg === "--shell-mode") flags.shellMode = true;
170
+ else if (arg === "-s" || arg === "--silent") flags.silent = true;
171
+ else if (arg === "-h" || arg === "--help") flags.help = true;
172
+ else if (arg === "-v" || arg === "--version") flags.version = true;
173
+ else if (arg === "--tsconfig" && index + 1 < args.length) flags.tsconfig = args[++index];
174
+ else if (arg.startsWith("--tsconfig=")) flags.tsconfig = arg.slice(11);
175
+ else break;
176
+ }
177
+ return {
178
+ flags,
179
+ positional: args.slice(index)
180
+ };
181
+ }
182
+ var ScriptError = class extends Error {};
183
+ /**
184
+ * Decide whether `positional` runs a script; `undefined` means package mode.
185
+ * Throws {@link ScriptError} for a missing script, which must never fall
186
+ * through to a remote package download.
187
+ */
188
+ function detectScript(positional, cwd) {
189
+ const [first] = positional;
190
+ if (first === void 0) return;
191
+ if (!first.startsWith("-")) return isScript(first, cwd) ? { nodeArgs: [...positional] } : void 0;
192
+ const nodeArgs = [];
193
+ let tsconfig;
194
+ let watch = false;
195
+ let entry = true;
196
+ for (let index = 0; index < positional.length; index++) {
197
+ const arg = positional[index];
198
+ if (arg === "--" || arg === "-" || !arg.startsWith("-")) {
199
+ const script = arg === "--" ? positional[index + 1] : arg;
200
+ if (script !== void 0 && entry) checkScriptAfterOptions(script, cwd);
201
+ nodeArgs.push(...positional.slice(index));
202
+ break;
203
+ }
204
+ if (arg === "--tsconfig") {
205
+ if (positional[index + 1] === void 0) throw new ScriptError("--tsconfig requires a path");
206
+ tsconfig = positional[++index];
207
+ continue;
208
+ }
209
+ if (arg.startsWith("--tsconfig=")) {
210
+ tsconfig = arg.slice(11);
211
+ continue;
212
+ }
213
+ if (arg === "--watch") {
214
+ watch = true;
215
+ continue;
216
+ }
217
+ const name = nodeOptionName(arg);
218
+ watch ||= name === "--watch-path";
219
+ entry &&= !NODE_OPTIONS_WITHOUT_ENTRY.has(name);
220
+ nodeArgs.push(arg);
221
+ const next = positional[index + 1];
222
+ if (!arg.includes("=") && next !== void 0 && takesNextArg(name, next)) nodeArgs.push(positional[++index]);
223
+ }
224
+ return watch ? {
225
+ nodeArgs,
226
+ tsconfig,
227
+ watch
228
+ } : {
229
+ nodeArgs,
230
+ tsconfig
231
+ };
232
+ }
233
+ /**
234
+ * After Node.js options, only a missing explicit path is an error. A bare name may be
235
+ * the value of an option missing from `NODE_OPTIONS_WITH_VALUE`, such as a coverage
236
+ * glob, and this position never falls back to a package, so Node.js reports a missing
237
+ * one itself.
238
+ */
239
+ function checkScriptAfterOptions(token, cwd) {
240
+ if (isExplicitPath(token) && SCRIPT_EXTENSIONS.some((extension) => token.endsWith(extension)) && !isFile(path.resolve(cwd, token))) throw missingScript(token, path.resolve(cwd, token));
241
+ }
242
+ /** The error for a script path that is not a file. */
243
+ function missingScript(token, file) {
244
+ return new ScriptError(statSync(file, { throwIfNoEntry: false })?.isDirectory() ? `Script is a directory: ${token}` : `Script not found: ${token}`);
245
+ }
246
+ function isScript(token, cwd) {
247
+ const file = path.resolve(cwd, token);
248
+ const extension = SCRIPT_EXTENSIONS.find((candidate) => token.endsWith(candidate));
249
+ if (extension) {
250
+ if (isFile(file)) return true;
251
+ if (isExplicitPath(token) || TS_EXTENSIONS.has(extension)) throw missingScript(token, file);
252
+ return false;
253
+ }
254
+ if (!isExplicitPath(token)) return false;
255
+ const stats = statSync(file, { throwIfNoEntry: false });
256
+ if (!stats) throw new ScriptError(`Script not found: ${token}`);
257
+ return stats.isFile() && hasVpxShebang(file);
258
+ }
259
+ function isExplicitPath(token) {
260
+ if (token.startsWith("./") || token.startsWith("../") || token.startsWith("/")) return true;
261
+ return process.platform === "win32" && (token.startsWith(".\\") || token.startsWith("..\\") || /^(?:[a-zA-Z]:[\\/]|\\\\)/.test(token));
262
+ }
263
+ function isFile(file) {
264
+ return statSync(file, { throwIfNoEntry: false })?.isFile() ?? false;
265
+ }
266
+ /** The first `length` bytes of `file`, or none when it cannot be read. */
267
+ function readHead(file, length) {
268
+ const head = Buffer.alloc(length);
269
+ try {
270
+ const fd = openSync(file, "r");
271
+ try {
272
+ return head.subarray(0, readSync(fd, head, 0, length, 0));
273
+ } finally {
274
+ closeSync(fd);
275
+ }
276
+ } catch {
277
+ return head.subarray(0, 0);
278
+ }
279
+ }
280
+ function hasVpxShebang(file) {
281
+ const text = readHead(file, 256).toString("utf8");
282
+ if (!text.startsWith("#!")) return false;
283
+ return text.slice(2).split("\n", 1)[0].split(/\s+/).some((word) => {
284
+ const name = word.split(/[\\/]/).pop();
285
+ return name === "vpx" || name === "vpx.exe";
286
+ });
287
+ }
288
+ /** The magic numbers of executables the kernel runs: Mach-O (thin and fat) on macOS, ELF elsewhere. */
289
+ const NATIVE_MAGIC = process.platform === "darwin" ? [
290
+ "feedface",
291
+ "feedfacf",
292
+ "cefaedfe",
293
+ "cffaedfe",
294
+ "cafebabe",
295
+ "bebafeca"
296
+ ] : ["7f454c46"];
297
+ function isExecutableFile(file) {
298
+ try {
299
+ accessSync(file, constants.X_OK);
300
+ } catch {
301
+ return false;
302
+ }
303
+ return isFile(file);
304
+ }
305
+ function isNativeExecutable(file) {
306
+ return isExecutableFile(file) && NATIVE_MAGIC.includes(readHead(file, 4).toString("hex"));
307
+ }
308
+ /**
309
+ * Whether exec can run `file` itself: an executable native binary, or an executable
310
+ * script whose `#!` interpreter is one. A failed `process.execve()` aborts most supported
311
+ * Node.js versions instead of throwing, so the project-local bin runs anything else
312
+ * through `/bin/sh`, which reports a file it cannot run as a terminal does. The
313
+ * interpreter keeps a trailing `\r`, as the kernel reads it.
314
+ */
315
+ function canExecDirectly(file) {
316
+ if (!isExecutableFile(file)) return false;
317
+ const head = readHead(file, 256);
318
+ if (head.subarray(0, 2).toString("latin1") !== "#!") return isNativeExecutable(file);
319
+ const interpreter = head.subarray(2).toString("utf8").split("\n", 1)[0].replace(/^[ \t]+/, "").split(/[ \t]/, 1)[0];
320
+ return path.isAbsolute(interpreter) && isNativeExecutable(interpreter);
321
+ }
322
+ /** Whether a package spec names a version, as in `eslint@9` or `@vue/cli@5`. */
323
+ function hasVersionSpec(spec) {
324
+ if (spec.startsWith("@")) {
325
+ const slash = spec.indexOf("/");
326
+ return slash !== -1 && spec.slice(slash + 1).includes("@");
327
+ }
328
+ return spec.includes("@");
329
+ }
330
+ /** The binary name a package spec runs: `eslint@9` → `eslint`, `@vue/cli@5` → `cli`. */
331
+ function commandName(spec) {
332
+ if (spec.startsWith("@")) {
333
+ const slash = spec.indexOf("/");
334
+ return slash === -1 ? spec : spec.slice(slash + 1).split("@")[0];
335
+ }
336
+ return spec.split("@")[0];
337
+ }
338
+ /** Every `node_modules/.bin` path from `cwd` up to the root, nearest first, whether or not it exists. */
339
+ function nodeModulesBinPaths(cwd) {
340
+ const paths = [];
341
+ for (let dir = cwd;; dir = path.dirname(dir)) {
342
+ paths.push(path.join(dir, "node_modules", ".bin"));
343
+ if (path.dirname(dir) === dir) return paths;
344
+ }
345
+ }
346
+ /** The nearest `node_modules/.bin/<name>` from `cwd` up (`.cmd` on Windows), like the global CLI's `find_local_binary`. */
347
+ function findLocalBin(name, cwd) {
348
+ const fileName = process.platform === "win32" ? `${name}.cmd` : name;
349
+ for (const dir of nodeModulesBinPaths(cwd)) {
350
+ const file = path.join(dir, fileName);
351
+ const stats = statSync(file, { throwIfNoEntry: false });
352
+ if (stats?.isFile()) return {
353
+ file,
354
+ stats
355
+ };
356
+ }
357
+ }
358
+ /** An executable mode bit, as the global CLI checks; always true on Windows. */
359
+ function isExecutable(stats) {
360
+ return process.platform === "win32" || (stats.mode & 73) !== 0;
361
+ }
362
+ /**
363
+ * Package mode runs an explicit path as a program. An existing file must be executable,
364
+ * and a directory needs a package.json for `vp dlx`, so either fails here with a clear
365
+ * error instead of in `vp dlx`. Mirrors `check_explicit_program` in the global CLI.
366
+ */
367
+ function checkExplicitProgram(token, cwd) {
368
+ if (!isExplicitPath(token)) return;
369
+ const file = path.resolve(cwd, token);
370
+ const stats = statSync(file, { throwIfNoEntry: false });
371
+ if (stats?.isDirectory() && !isFile(path.join(file, "package.json"))) return { error: `'${token}' is a directory without a package.json` };
372
+ if (stats?.isFile() && !isExecutable(stats)) return {
373
+ error: `'${token}' is not executable`,
374
+ note: `Make it executable with \`chmod +x ${token}\`.`
375
+ };
376
+ }
377
+ /**
378
+ * How the project-local bin runs `vpx <pkg> [args...]`. The nearest binary in
379
+ * `node_modules/.bin`, or an existing executable file, runs directly, as the global CLI
380
+ * execs the path it finds. A versioned package, `--package`, `--shell-mode`, or a local
381
+ * package directory runs with this package's `vp dlx`. Global packages and `PATH` are
382
+ * not searched, so a binary that is not installed is an error rather than a download.
383
+ */
384
+ function packageInvocation(flags, [spec, ...rest], cwd) {
385
+ const silent = flags.silent ? ["--silent"] : [];
386
+ if (flags.packages.length > 0 || flags.shellMode || hasVersionSpec(spec)) return {
387
+ command: "dlx",
388
+ args: [
389
+ ...flags.packages.flatMap((name) => ["--package", name]),
390
+ ...flags.shellMode ? ["--shell-mode"] : [],
391
+ ...silent,
392
+ spec,
393
+ ...rest
394
+ ]
395
+ };
396
+ if (isExplicitPath(spec)) {
397
+ const problem = checkExplicitProgram(spec, cwd);
398
+ if (problem) return problem;
399
+ const file = path.resolve(cwd, spec);
400
+ return isFile(file) ? {
401
+ command: "run",
402
+ file,
403
+ args: rest
404
+ } : {
405
+ command: "dlx",
406
+ args: [
407
+ ...silent,
408
+ spec,
409
+ ...rest
410
+ ]
411
+ };
412
+ }
413
+ const name = commandName(spec);
414
+ const bin = findLocalBin(name, cwd);
415
+ if (bin) {
416
+ if (!isExecutable(bin.stats)) {
417
+ const relative = path.relative(cwd, bin.file);
418
+ return {
419
+ error: `'${relative}' is not executable`,
420
+ note: `Reinstall dependencies with \`vp install\`, or make it executable with \`chmod +x ${relative}\`.`
421
+ };
422
+ }
423
+ return {
424
+ command: "run",
425
+ file: bin.file,
426
+ args: rest
427
+ };
428
+ }
429
+ return {
430
+ error: `'${name}' is not installed in node_modules`,
431
+ note: `Add it to devDependencies, or run \`vp dlx ${spec}\` to download and run it.`
432
+ };
433
+ }
434
+ export { canExecDirectly as a, nodeModulesBinPaths as c, WATCH_OPTIONS_WITH_VALUE as i, packageInvocation as l, SCRIPT_EXTENSIONS as n, detectScript as o, ScriptError as r, isFile as s, NODE_OPTIONS_WITH_VALUE as t, parseVpxArgs as u };
@@ -2,6 +2,8 @@
2
2
 
3
3
  `vp check` runs format, lint, and type checks together. The `check` block in `vite.config.ts` sets defaults for the composite command, mirroring the `--no-fmt` and `--no-lint` CLI flags.
4
4
 
5
+ See [Check usage](/guide/check#usage) for the execution order and how to skip formatting after a failure.
6
+
5
7
  This is useful when a project wants to keep most of the toolchain but skip one step by default. For example, a team that lints but does not format can disable `check.fmt` so a plain `vp check` (the command agents and contributors run most) only lints, without anyone needing to remember `--no-fmt`.
6
8
 
7
9
  ## Example
@@ -21,4 +21,4 @@ export default defineConfig({
21
21
 
22
22
  For file- or package-specific formatting settings, use [`fmt.overrides`](/guide/monorepo#format-overrides) from the root `vite.config.ts`.
23
23
 
24
- Oxfmt disables nested configs in Vite+ mode, so nested format configs do not override settings for individual files. See [troubleshooting](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) for details.
24
+ Oxfmt disables nested configs in Vite+ mode, so nested format configs do not override settings for individual files. See [Troubleshooting](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) for details.
@@ -27,4 +27,4 @@ We recommend enabling both `options.typeAware` and `options.typeCheck` so `vp li
27
27
 
28
28
  For file- or package-specific lint rules, use [`lint.overrides`](/guide/monorepo#root-config-with-overrides) from the root `vite.config.ts`.
29
29
 
30
- Oxlint disables nested configs in Vite+ mode, so nested lint configs do not override settings for individual files. See [troubleshooting](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) for details.
30
+ Oxlint disables nested configs in Vite+ mode, so nested lint configs do not override settings for individual files. See [Troubleshooting](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) for details.
@@ -56,6 +56,10 @@ export default defineConfig({
56
56
 
57
57
  `cache: true` enables both task and script caching, `cache: false` disables both.
58
58
 
59
+ ::: warning
60
+ This option can only be set in the workspace root's `vite.config.ts`. Setting it in a package's config will result in an error.
61
+ :::
62
+
59
63
  ## `run.tasks`
60
64
 
61
65
  - **Type:** `Record<string, Task | string | string[]>`
@@ -86,7 +90,11 @@ Use the object form when a task needs other fields like `cache`, `dependsOn`, or
86
90
 
87
91
  - **Type:** `string | string[]`
88
92
 
89
- Defines the shell command to run for the task. The string is interpreted by a shell, so spaces, quoting, `&&`, pipes, and redirects all work as written on the command line.
93
+ Defines the command to run for the task.
94
+
95
+ ::: info
96
+ Vite Task parses simple commands and `&&` chains itself instead of passing them to a shell, so they behave the same on every platform. Other shell syntax, such as pipes or redirects, may behave differently across platforms.
97
+ :::
90
98
 
91
99
  ```ts [vite.config.ts]
92
100
  tasks: {
@@ -113,7 +121,7 @@ tasks: {
113
121
 
114
122
  Each task defined in `vite.config.ts` must include its own `command`. You cannot define a task in both `vite.config.ts` and `package.json` with the same task name.
115
123
 
116
- Commands joined with `&&` (or supplied as an array) are automatically split into independently cached sub-tasks. See [Compound Commands](/guide/run#compound-commands).
124
+ Array entries, and `&&` chains without other shell syntax, are automatically split into independently cached sub-tasks. See [Compound Commands](/guide/run#compound-commands).
117
125
 
118
126
  ### `dependsOn`
119
127
 
@@ -1,6 +1,6 @@
1
1
  # Staged Config
2
2
 
3
- `vp staged` reads staged-file rules from the `staged` block in `vite.config.ts`. See the [Commit hooks guide](/guide/commit-hooks).
3
+ `vp staged` reads staged-file rules from the `staged` block in `vite.config.ts`. See the [Commit Hooks](/guide/commit-hooks).
4
4
 
5
5
  ## Example
6
6
 
@@ -16,11 +16,16 @@ We recommend turning both `typeAware` and `typeCheck` on so `vp check` becomes t
16
16
  vp check
17
17
  vp check --fix # Format and run autofixers.
18
18
  vp check --quiet # Hide lint warnings; still report and fail on errors.
19
+ vp check --deny-warnings # Treat lint warnings as errors.
19
20
  vp check --no-fmt # Skip format; run lint (and type-check if enabled).
20
21
  vp check --no-lint # Skip lint rules; keep type-check when enabled.
21
22
  vp check --no-fmt --no-lint # Type-check only (requires both `typeAware` and `typeCheck` enabled).
22
23
  ```
23
24
 
25
+ If formatting fails, `vp check` stops before lint and type checks run. To fix formatting and apply available lint fixes, run `vp check --fix`. This command changes files. To skip formatting and run the remaining enabled checks, run `vp check --no-fmt`.
26
+
27
+ Put `vp check` flags before file paths. For example, use `vp check --fix src/index.ts`. Arguments after the first path go to the format and lint tools instead of `vp check`.
28
+
24
29
  ## Configuration
25
30
 
26
31
  `vp check` uses the same configuration you already define for linting and formatting:
@@ -60,4 +65,4 @@ export default defineConfig({
60
65
  });
61
66
  ```
62
67
 
63
- These options only affect `vp check`; standalone `vp fmt` and `vp lint` still run normally. A step is skipped if it is disabled in config or the matching `--no-fmt` / `--no-lint` flag is passed. Because the defaults apply to every `vp check` run, a pre-commit hook that calls `vp check` will skip the disabled step too. See [Check config](/config/check) for the full reference.
68
+ These options only affect `vp check`; standalone `vp fmt` and `vp lint` still run normally. A step is skipped if it is disabled in config or the matching `--no-fmt` / `--no-lint` flag is passed. Because the defaults apply to every `vp check` run, a pre-commit hook that calls `vp check` will skip the disabled step too. See [Check Config](/config/check) for the full reference.
package/docs/guide/ci.md CHANGED
@@ -4,7 +4,7 @@ You can use `voidzero-dev/setup-vp` to use Vite+ in CI environments.
4
4
 
5
5
  ## Overview
6
6
 
7
- [`voidzero-dev/setup-vp`](https://github.com/voidzero-dev/setup-vp) provides integrations for GitHub Actions, GitLab CI/CD, and Azure Pipelines. All three install Vite+ and can install project dependencies. The GitHub Action and Azure Pipelines template can also set up Node.js and cache package manager data automatically, while the GitLab CI/CD template uses the Node.js runtime and cache configuration provided by the job.
7
+ [`voidzero-dev/setup-vp`](https://github.com/voidzero-dev/setup-vp) provides integrations for GitHub Actions, GitLab CI/CD, and Azure Pipelines. All three install Vite+, can select the project's Node.js version, and can install project dependencies. The GitHub Action and Azure Pipelines template can also cache package-manager data automatically. GitLab CI/CD uses the job's native cache configuration and requires Node.js to start the setup runtime.
8
8
 
9
9
  ## setup-vp Versioning
10
10
 
@@ -12,6 +12,16 @@ Set `<setup-vp-version>` in each example to an exact version from the [`setup-vp
12
12
 
13
13
  Run `vp migrate` to replace exact `voidzero-dev/setup-vp@v1` references in GitHub Actions workflows and composite actions under `.github` with the latest exact release known to your Vite+ version. Existing exact versions and commit SHAs remain unchanged.
14
14
 
15
+ ## Node.js During Installation
16
+
17
+ The Vite+ installer uses the Node.js version pinned in the repository's [`.node-version`](https://github.com/voidzero-dev/vite-plus/blob/main/.node-version) by default. Each Vite+ release embeds this version at build time. The dependency-upgrade workflow keeps this pin up to date. With versions that support [`VP_SETUP_NODE_VERSION`](/guide/global-cli#vp-setup-node-version), `setup-vp` can use the project's version for installation too. This avoids a second Node.js download when that version supports both the global CLI and its pinned `pnpm`.
18
+
19
+ `setup-vp` selects the version before it starts the installer. An explicit Node.js version takes precedence over a version-file input. Without either input, it checks the working directory and its parents using the [project declaration order](/guide/env#node-js-selection). The integration passes the selection through `VP_SETUP_NODE_VERSION`; the installer itself does not read project declarations.
20
+
21
+ Without a selection, with Node.js management disabled, or when the selected version is incompatible, installation uses the embedded default. Older installers keep their existing behavior. Automatic project discovery does not create a session override, so later commands retain normal directory-based version selection.
22
+
23
+ The integration handles these installer variables automatically. Configure `node-version` or `node-version-file` in GitHub Actions and GitLab CI/CD, or `nodeVersion` or `nodeVersionFile` in Azure Pipelines. See the [`setup-vp` documentation](https://github.com/voidzero-dev/setup-vp#inputs) for the complete input reference.
24
+
15
25
  ## GitHub Actions
16
26
 
17
27
  The GitHub Action sets up Vite+, the required Node.js version, and the package manager. This means you usually do not need separate `setup-node`, package-manager setup, dependency installation, or manual dependency caching steps in your workflow.
@@ -53,7 +63,7 @@ test:
53
63
 
54
64
  The GitLab CI/CD integration differs from the GitHub Action in a few ways:
55
65
 
56
- - The template does not install Node.js. Use a Node.js image, as shown above, or otherwise provide Node.js in the job.
66
+ - The template requires Node.js to start the setup runtime. Use a Node.js image, as shown above, or otherwise provide Node.js in the job. Use `node-version` or `node-version-file` to select a managed project runtime with `vp env use`.
57
67
  - Configure dependency caching with the job's GitLab [`cache`](https://docs.gitlab.com/ci/yaml/#cache) keyword.
58
68
  - Use a Unix-like runner environment with Bash and either `curl` or `wget`.
59
69
 
@@ -90,7 +100,7 @@ steps:
90
100
 
91
101
  Pin `ref` and `setupRef` to the same tag or commit SHA for strict reproducibility.
92
102
 
93
- The Azure Pipelines template supports Microsoft-hosted Linux, macOS, and Windows agents. It uses Azure's native `UseNode@1` and `Cache@2` tasks to set up Node.js and cache package-manager data.
103
+ The Azure Pipelines template supports Microsoft-hosted Linux, macOS, and Windows agents. `UseNode@1` provides Node.js to start the setup runtime through `bootstrapNodeVersion`. The `nodeVersion` and `nodeVersionFile` parameters select the managed project runtime with `vp env use`. `Cache@2` caches package-manager data.
94
104
 
95
105
  For advanced configuration and the complete parameter reference, see the [`setup-vp` Azure Pipelines documentation](https://github.com/voidzero-dev/setup-vp#azure-pipelines).
96
106
 
@@ -95,7 +95,7 @@ Run `vp create --list` to see the built-in templates and the common shorthand te
95
95
  `--git` and `--no-git` are not available when adding a package to an existing monorepo.
96
96
  :::
97
97
 
98
- After create, manage the dispatcher with `vp hooks status`, `vp hooks disable`, and `vp hooks enable`. See the [Commit hooks guide](/guide/commit-hooks).
98
+ After create, manage the dispatcher with `vp hooks status`, `vp hooks disable`, and `vp hooks enable`. See the [Commit Hooks](/guide/commit-hooks).
99
99
 
100
100
  ### Dependency build scripts
101
101
 
package/docs/guide/env.md CHANGED
@@ -41,6 +41,8 @@ To select the project's Node.js version, Vite+ checks the current directory firs
41
41
 
42
42
  If no directory declares a version, Vite+ uses the global default (`vp env default`) and then the latest LTS.
43
43
 
44
+ The `lts` alias selects the newest LTS release. The `latest` alias selects the newest stable release, LTS or not, and skips pre-releases such as `27.0.0-alpha.0.0.0`. To use a pre-release, specify its exact version.
45
+
44
46
  `devEngines.runtime` ranks above `engines.node` because it declares the development-environment requirement, while `engines.node` is a consumer-facing support range. `vp env doctor` warns when declared sources conflict.
45
47
 
46
48
  ::: tip Using pnpm with Vite+ runtime management
@@ -181,20 +183,25 @@ In CI, `vp env use` can run without shell initialization. It writes a temporary
181
183
  The global CLI supports Tab completion in Bash, Zsh, Fish, Nushell, and PowerShell. Run `vp env setup` and follow its printed shell setup instructions to enable it. Press Tab to complete commands, or project task names after `vp run` and `vpr`.
182
184
 
183
185
  - **Zsh**: Run `autoload -Uz compinit; compinit` before loading the setup script if your shell has not initialized completion.
184
- - **Nushell**: Completion requires `fish` on `PATH`.
186
+ - **Nushell**: Completion requires `fish` on `PATH`. Use Nushell 0.112.1 or later; see [Nushell version](/guide/global-cli#nushell-version).
185
187
 
186
188
  ### Manage
187
189
 
188
190
  - `vp env default` shows the global Node.js default and each configured package-manager version. Bare versions set Node.js; qualified specs such as `pnpm@10.18.0` set that package manager's shim default without replacing the defaults for Bun, Yarn, or npm. `--unset` clears all defaults unless scoped.
189
191
  - `vp env default <lts|latest>` and package-manager dist-tags such as `pnpm@latest` or `pnpm@latest-10` re-resolve on each use, so the default follows the tag, including new majors for `latest`. Other versions and ranges, such as `24` or `pnpm@10`, resolve to an exact version when set.
190
- - `vp env pin` shows or writes project pins. Existing `.node-version` and top-level `packageManager` fields keep being updated for compatibility. An existing `.nvmrc` is updated when it is the effective Node source in the current directory; its comments and other non-version content are preserved. Otherwise Vite+ writes the matching `devEngines` entry. Use `--target node-version`, `--target nvmrc`, `--target dev-engines`, or `--target package-manager` to choose explicitly. Pinning in a child directory does not modify an inherited `.nvmrc`.
191
- - `vp env unpin` removes both effective pins by default; append a selector to remove one. Lower-priority declarations are not deleted.
192
+ - `vp env pin` shows or writes project pins. Node.js pins use the current directory. Package-manager pins use the workspace root `package.json`, or the current project `package.json` outside a workspace. Pinning both components can update two different files.
193
+
194
+ Existing `.node-version` and top-level `packageManager` fields keep being updated for compatibility. An existing `.nvmrc` is updated when it is the effective Node source in the current directory. Its comments and other non-version content are preserved. Otherwise Vite+ writes the matching `devEngines` entry.
195
+
196
+ Use `--target node-version`, `--target nvmrc`, `--target dev-engines`, or `--target package-manager` to choose the pin source explicitly. This does not change the project directory. Package-manager output shows the file path relative to the current working directory and the field that was updated, or the target before an existing overwrite prompt. Pinning in a child directory does not modify an inherited `.nvmrc`.
197
+
198
+ - `vp env unpin` (alias for `vp env pin --unpin`) removes both effective pins by default. Append a selector to remove one. Node.js removal uses the current directory. Package-manager removal uses the workspace root manifest, or the current project manifest outside a workspace. `--target` selects the pin source within that scope. The output identifies the removed package-manager field, or the fields checked when no matching pin is found. Lower-priority declarations are not deleted.
192
199
  - `vp env use` activates the complete project environment. Explicit specs override selected components; `--unset` clears both unless scoped.
193
200
  - `vp env install` installs the complete resolved environment, a selected component, or explicit specs.
194
201
  - `vp env uninstall` removes the Node.js version resolved from an explicit version or selector, such as `22` or `lts`. Package managers require a qualified exact version, such as `pnpm@10.18.0`.
195
202
  - `vp env clean` removes unused installs. Use `clean node`, `clean pm`, or a concrete manager. Current and configured-default versions are preserved.
196
203
  - `vp env exec` runs a command in the resolved environment. Use `--node` and `--package-manager`; `--npm` is an alias for `--package-manager npm@…`.
197
- - `vp node` uses the resolved Node.js runtime and exposes the selected package-manager path to child processes.
204
+ - `vp node` uses the resolved Node.js runtime and exposes the selected package-manager path to child processes. It runs Node.js as is, so TypeScript files get Node.js type stripping only; [`vpx <file>`](/guide/vpx#running-scripts) runs them on the same runtime with full TypeScript support.
198
205
 
199
206
  ### Inspect
200
207