vite-plus 0.3.3 → 1.0.0-rc.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 (147) hide show
  1. package/LICENSE +35 -146
  2. package/README.md +6 -4
  3. package/binding/index.cjs +58 -54
  4. package/binding/index.d.cts +36 -4
  5. package/dist/{agent-Cu6-tXIP.js → agent-DIwEez_1.js} +6 -5
  6. package/dist/bin.js +75 -35
  7. package/dist/config/bin.js +3 -3
  8. package/dist/constants-BAsBfS1J.js +356 -0
  9. package/dist/create/bin.js +19 -13
  10. package/dist/{define-config-IgzmnvvV.js → define-config-Bz6dc3fm.js} +165 -43
  11. package/dist/{define-config-D0mevyb3.cjs → define-config-CAeeMTvb.cjs} +179 -44
  12. package/dist/{define-config-DPNEJxPz.d.ts → define-config-Cf_5GHmY.d.ts} +71 -25
  13. package/dist/define-config.cjs +1 -1
  14. package/dist/define-config.d.ts +1 -1
  15. package/dist/define-config.js +1 -1
  16. package/dist/dist-BWiANxFS.js +8052 -0
  17. package/dist/{dist-BDYZP12R.js → dist-BsAzy8OW.js} +109 -105
  18. package/dist/documentation-DqcZSthV.js +11 -0
  19. package/dist/{editor-4sjlHmUh.js → editor-DWgrWTbN.js} +246 -159
  20. package/dist/index.cjs +1 -1
  21. package/dist/index.d.ts +1 -1
  22. package/dist/index.js +1 -1
  23. package/dist/{json-cULBl7Pi.js → json-JP24qHUF.js} +14 -6
  24. package/dist/lint-plugins.cjs +1 -1
  25. package/dist/migration/bin.js +3127 -18
  26. package/dist/migration/compat/worker.js +1 -1
  27. package/dist/{oxlint-plugin-config-BVqEe9KY.js → oxlint-plugin-config-B-P1a_0g.js} +1 -1
  28. package/dist/oxlint-plugin.js +9 -7
  29. package/dist/pack-bin.js +1 -1
  30. package/dist/{package-CHH8jWan.js → package-BrupPpWA.js} +6 -2
  31. package/dist/{vitest-ecosystem-BiRqcaRI.js → package-overrides-Dpn4scvN.js} +1 -7
  32. package/dist/{prompts-k14KgthC.js → prompts-BW7_fDGJ.js} +3 -4
  33. package/dist/{report-CK5TnTsr.js → report-NhQk8VHb.js} +1 -0
  34. package/dist/{resolve-vite-config-CTOTuqTi.js → resolve-vite-config-D3XIVT6s.js} +1 -1
  35. package/dist/{resolve-vite-config-BqvS2P98.js → resolve-vite-config-DcsMQaYy.js} +2 -2
  36. package/dist/staged/bin.js +1206 -3318
  37. package/dist/sync-versions/bin.js +4 -4
  38. package/dist/sync-versions/bin.mjs +17 -2
  39. package/dist/test/browser/context.js +1 -1
  40. package/dist/test/browser/providers/playwright/context.js +1 -1
  41. package/dist/test/browser/providers/preview/context.js +1 -1
  42. package/dist/test/browser-playwright/context.js +1 -1
  43. package/dist/test/browser-preview/context.js +1 -1
  44. package/dist/test/context.d.ts +2 -942
  45. package/dist/test/context.js +1 -1
  46. package/dist/test/internal/traces.js +1 -0
  47. package/dist/test/locators.d.ts +2 -294
  48. package/dist/test/matchers.d.ts +2 -29
  49. package/dist/test/mocker.d.ts +2 -0
  50. package/dist/test/mocker.js +1 -0
  51. package/dist/test/{browser-webdriverio/context.js → plugins/browser-context.d.ts} +1 -0
  52. package/dist/test/plugins/browser-context.js +1 -1
  53. package/dist/test/plugins/browser-locators.d.ts +2 -0
  54. package/dist/test/plugins/browser-playwright.d.ts +2 -0
  55. package/dist/test/plugins/browser-preview.d.ts +2 -0
  56. package/dist/test/plugins/browser.d.ts +2 -0
  57. package/dist/test/plugins/mocker-automock.d.ts +2 -0
  58. package/dist/test/plugins/mocker-browser.d.ts +2 -0
  59. package/dist/test/plugins/mocker-node.d.ts +2 -0
  60. package/dist/test/plugins/mocker-redirect.d.ts +2 -0
  61. package/dist/test/plugins/mocker-register.d.ts +2 -0
  62. package/dist/test/plugins/mocker-transforms.d.ts +2 -0
  63. package/dist/test/plugins/mocker.d.ts +2 -0
  64. package/dist/test/plugins/pretty-format.d.ts +2 -0
  65. package/dist/test/plugins/snapshot-environment.d.ts +2 -0
  66. package/dist/test/plugins/snapshot-manager.d.ts +2 -0
  67. package/dist/test/plugins/snapshot.d.ts +2 -0
  68. package/dist/test/plugins/spy.d.ts +2 -0
  69. package/dist/test/plugins/utils-constants.d.ts +2 -0
  70. package/dist/test/plugins/utils-diff.d.ts +2 -0
  71. package/dist/test/plugins/utils-display.d.ts +2 -0
  72. package/dist/test/plugins/utils-error.d.ts +2 -0
  73. package/dist/test/plugins/utils-helpers.d.ts +2 -0
  74. package/dist/test/plugins/utils-offset.d.ts +2 -0
  75. package/dist/test/plugins/utils-resolver.d.ts +2 -0
  76. package/dist/test/plugins/utils-serialize.d.ts +2 -0
  77. package/dist/test/plugins/utils-source-map-node.d.ts +2 -0
  78. package/dist/test/plugins/utils-source-map.d.ts +2 -0
  79. package/dist/test/plugins/utils-timers.d.ts +2 -0
  80. package/dist/test/plugins/utils.d.ts +2 -0
  81. package/dist/toolchain.js +11 -11
  82. package/dist/toolchain.json +11 -11
  83. package/dist/{tsconfig-euB-GmIE.js → tsconfig-DESFDzWP.js} +1 -1
  84. package/dist/{tsconfig-C3h9CVTA.js → tsconfig-piorpNV7.js} +8 -4
  85. package/dist/version.js +5 -3
  86. package/dist/versions.js +6 -6
  87. package/dist/vitest-ecosystem-BU0AqZq-.js +23 -0
  88. package/dist/vitest-v5-entry-points-DthU1e_O.js +25 -0
  89. package/docs/config/fmt.md +4 -2
  90. package/docs/config/lint.md +4 -2
  91. package/docs/config/run.md +62 -26
  92. package/docs/guide/automatic-data-tracking.md +20 -15
  93. package/docs/guide/cache.md +12 -8
  94. package/docs/guide/check.md +2 -0
  95. package/docs/guide/commit-hooks.md +8 -1
  96. package/docs/guide/env.md +18 -13
  97. package/docs/guide/fmt.md +6 -2
  98. package/docs/guide/index.md +1 -1
  99. package/docs/guide/install.md +1 -1
  100. package/docs/guide/lint.md +5 -1
  101. package/docs/guide/local-cli.md +3 -3
  102. package/docs/guide/migrate-rules.md +58 -12
  103. package/docs/guide/migrate.md +86 -20
  104. package/docs/guide/monorepo.md +7 -1
  105. package/docs/guide/run.md +3 -1
  106. package/docs/guide/test.md +2 -0
  107. package/docs/guide/troubleshooting.md +3 -3
  108. package/docs/guide/vitest-v5.md +221 -0
  109. package/package.json +64 -87
  110. package/bin/oxfmt +0 -33
  111. package/bin/oxlint +0 -38
  112. package/dist/cli-truncate-Bg3RDXpi.js +0 -865
  113. package/dist/constants-C2dTOTe-.js +0 -80
  114. package/dist/dist-Dqv1-Clg.js +0 -3
  115. package/dist/is-fullwidth-code-point-BUNlIICg.js +0 -8
  116. package/dist/log-update-CoW8Z4Dl.js +0 -491
  117. package/dist/semver-CaDAb8vV.js +0 -1400
  118. package/dist/strip-ansi-C3wrWz9t.js +0 -853
  119. package/dist/test/browser/providers/webdriverio/context.d.ts +0 -1
  120. package/dist/test/browser/providers/webdriverio/context.js +0 -1
  121. package/dist/test/browser/providers/webdriverio.d.ts +0 -77
  122. package/dist/test/browser/providers/webdriverio.js +0 -1
  123. package/dist/test/browser-webdriverio/context.d.ts +0 -1
  124. package/dist/test/browser-webdriverio.d.ts +0 -77
  125. package/dist/test/browser-webdriverio.js +0 -1
  126. package/dist/test/coverage.d.ts +0 -2
  127. package/dist/test/coverage.js +0 -1
  128. package/dist/test/environments.d.ts +0 -2
  129. package/dist/test/environments.js +0 -1
  130. package/dist/test/plugins/browser-webdriverio.js +0 -1
  131. package/dist/test/plugins/expect.js +0 -1
  132. package/dist/test/plugins/runner-types.js +0 -1
  133. package/dist/test/plugins/runner-utils.js +0 -1
  134. package/dist/test/plugins/runner.js +0 -1
  135. package/dist/test/reporters.d.ts +0 -2
  136. package/dist/test/reporters.js +0 -1
  137. package/dist/test/runners.d.ts +0 -2
  138. package/dist/test/runners.js +0 -1
  139. package/dist/test/snapshot.d.ts +0 -2
  140. package/dist/test/snapshot.js +0 -1
  141. package/dist/test/suite.d.ts +0 -2
  142. package/dist/test/suite.js +0 -1
  143. package/dist/tsgolint-path-CbDReEOx.js +0 -34
  144. package/dist/tsgolint-path.d.ts +0 -7
  145. package/dist/tsgolint-path.js +0 -2
  146. package/dist/wrap-ansi-DNjkuBEp.js +0 -157
  147. package/dist/wrap-ansi-DUi52C6W.js +0 -2
@@ -1,6 +1,7 @@
1
- import { p as createBaseUrlTsconfigFixArgs, t as BASEURL_TSCONFIG_FIX_PACKAGE } from "./constants-C2dTOTe-.js";
2
- import { c as parse, o as applyEdits, s as modify } from "./json-cULBl7Pi.js";
3
- import { S as log, b as confirm, k as isCancel, t as cancelAndExit } from "./prompts-k14KgthC.js";
1
+ import { p as createBaseUrlTsconfigFixArgs, t as BASEURL_TSCONFIG_FIX_PACKAGE } from "./constants-BAsBfS1J.js";
2
+ import { c as modify, l as parse, o as applyEdits } from "./json-JP24qHUF.js";
3
+ import { t as vitest_v5_entry_points_default } from "./vitest-v5-entry-points-DthU1e_O.js";
4
+ import { S as log, b as confirm, k as isCancel, t as cancelAndExit } from "./prompts-BW7_fDGJ.js";
4
5
  import { n as runCommandSilently } from "./command-CguLh2KL.js";
5
6
  import path from "node:path";
6
7
  import { styleText } from "node:util";
@@ -100,7 +101,10 @@ function removeDeprecatedTsconfigFalseOption(filePath, optionName) {
100
101
  fs.writeFileSync(filePath, newText);
101
102
  return true;
102
103
  }
103
- const TSCONFIG_TYPE_REPLACEMENTS = { "tsdown/client": "vite-plus/pack/client" };
104
+ const TSCONFIG_TYPE_REPLACEMENTS = {
105
+ "tsdown/client": "vite-plus/pack/client",
106
+ ...Object.fromEntries(Object.entries(vitest_v5_entry_points_default).filter(([source]) => source.startsWith("vite-plus/")))
107
+ };
104
108
  function hasTypesToRewriteInTsconfig(filePath) {
105
109
  let text;
106
110
  try {
package/dist/version.js CHANGED
@@ -1,8 +1,9 @@
1
1
  import { t as renderCliDoc } from "./help-BmKpeOP9.js";
2
2
  import { i as log, o as printHeader, t as accent } from "./terminal-MKGAuy-p.js";
3
- import { _ as version } from "./constants-C2dTOTe-.js";
4
- import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-CHH8jWan.js";
3
+ import { y as version } from "./constants-BAsBfS1J.js";
4
+ import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-BrupPpWA.js";
5
5
  import path from "node:path";
6
+ import { pathToFileURL } from "node:url";
6
7
  import fs from "node:fs";
7
8
  //#region src/version.ts
8
9
  /** Tool display names in the order shown by `vp --version`. */
@@ -45,7 +46,8 @@ function isVitePlusDeclaredInAncestors(cwd) {
45
46
  */
46
47
  async function resolveToolVersions(localPackagePath) {
47
48
  try {
48
- const mod = await import(`${localPackagePath}/dist/versions.js`);
49
+ const file = path.join(localPackagePath, "dist", "versions.js");
50
+ const mod = await import(pathToFileURL(file).href);
49
51
  if (mod.versions && typeof mod.versions === "object") return mod.versions;
50
52
  } catch {}
51
53
  return {};
package/dist/versions.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export const versions = {
2
- "vite": "8.3.0",
3
- "rolldown": "1.2.9",
4
- "vitest": "4.1.11",
5
- "oxfmt": "0.68.0",
6
- "oxlint": "1.83.0",
7
- "oxlint-tsgolint": "7.0.2001",
2
+ "vite": "8.3.1",
3
+ "rolldown": "1.2.11",
4
+ "vitest": "5.0.1",
5
+ "oxfmt": "0.70.0",
6
+ "oxlint": "1.85.0",
7
+ "oxlint-tsgolint": "7.0.2003",
8
8
  "tsdown": "0.23.0"
9
9
  };
@@ -0,0 +1,23 @@
1
+ //#region src/utils/vitest-ecosystem.ts
2
+ /** Official packages that share the bundled runner's release version. */
3
+ const VITEST_EXACT_VERSION_PACKAGES = /* @__PURE__ */ new Set([
4
+ "@vitest/browser",
5
+ "@vitest/browser-playwright",
6
+ "@vitest/browser-preview",
7
+ "@vitest/coverage-v8",
8
+ "@vitest/coverage-istanbul",
9
+ "@vitest/mocker",
10
+ "@vitest/pretty-format",
11
+ "@vitest/snapshot",
12
+ "@vitest/spy",
13
+ "@vitest/ui",
14
+ "@vitest/utils",
15
+ "@vitest/web-worker"
16
+ ]);
17
+ /** Optional peers fall back to the project; unrelated @vitest packages do not redirect. */
18
+ const VITEST_RESOLVER_PACKAGES = /* @__PURE__ */ new Set(["vitest", ...VITEST_EXACT_VERSION_PACKAGES]);
19
+ function isAlignableVitestEcosystemPackage(name) {
20
+ return VITEST_EXACT_VERSION_PACKAGES.has(name);
21
+ }
22
+ //#endregion
23
+ export { isAlignableVitestEcosystemPackage as n, VITEST_RESOLVER_PACKAGES as t };
@@ -0,0 +1,25 @@
1
+ //#region src/vitest-v5-entry-points.json
2
+ var vitest_v5_entry_points_default = {
3
+ "vitest/coverage": "vite-plus/test/node",
4
+ "vitest/reporters": "vite-plus/test/node",
5
+ "vitest/environments": "vite-plus/test/runtime",
6
+ "vitest/snapshot": "vite-plus/test/runtime",
7
+ "vitest/mocker": "vite-plus/test/mocker",
8
+ "vite-plus/test/coverage": "vite-plus/test/node",
9
+ "vite-plus/test/reporters": "vite-plus/test/node",
10
+ "vite-plus/test/environments": "vite-plus/test/runtime",
11
+ "vite-plus/test/snapshot": "vite-plus/test/runtime",
12
+ "vitest/browser-webdriverio": "@vitest/browser-webdriverio",
13
+ "vitest/browser-webdriverio/context": "vite-plus/test/browser/context",
14
+ "vitest/browser/providers/webdriverio": "@vitest/browser-webdriverio",
15
+ "vitest/browser/providers/webdriverio/context": "vite-plus/test/browser/context",
16
+ "vitest/plugins/browser-webdriverio": "@vitest/browser-webdriverio",
17
+ "vite-plus/test/browser-webdriverio": "@vitest/browser-webdriverio",
18
+ "vite-plus/test/browser-webdriverio/context": "vite-plus/test/browser/context",
19
+ "vite-plus/test/browser/providers/webdriverio": "@vitest/browser-webdriverio",
20
+ "vite-plus/test/browser/providers/webdriverio/context": "vite-plus/test/browser/context",
21
+ "vite-plus/test/plugins/browser-webdriverio": "@vitest/browser-webdriverio",
22
+ "@vitest/browser/providers/webdriverio": "@vitest/browser-webdriverio"
23
+ };
24
+ //#endregion
25
+ export { vitest_v5_entry_points_default as t };
@@ -1,6 +1,8 @@
1
1
  # Format Config
2
2
 
3
- `vp fmt` and `vp check` read Oxfmt settings from the `fmt` block in the root `vite.config.ts`. See [Oxfmt's configuration](https://oxc.rs/docs/guide/usage/formatter/config.html) for details.
3
+ `vp fmt` uses Oxfmt's [native config discovery](/guide/fmt#configuration) from the working directory. Use `vp fmt -c <path>` or `vp fmt --config <path>` to select another config. See [Oxfmt's configuration](https://oxc.rs/docs/guide/usage/formatter/config.html) for details.
4
+
5
+ `vp check` uses the workspace-root `fmt` block when it exists, including from a package directory. Package configs do not replace these format settings in `vp check`.
4
6
 
5
7
  ## Example
6
8
 
@@ -19,4 +21,4 @@ export default defineConfig({
19
21
 
20
22
  For file- or package-specific formatting settings, use [`fmt.overrides`](/guide/monorepo#format-overrides) from the root `vite.config.ts`.
21
23
 
22
- Vite+ does not currently support nested format configuration. See [troubleshooting](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) for details and how to give feedback on future support.
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.
@@ -1,6 +1,8 @@
1
1
  # Lint Config
2
2
 
3
- `vp lint` and `vp check` read Oxlint settings from the `lint` block in the root `vite.config.ts`. See [Oxlint's configuration](https://oxc.rs/docs/guide/usage/linter/config.html) for details.
3
+ `vp lint` uses Oxlint's [native config discovery](/guide/lint#configuration) from the working directory. Use `vp lint -c <path>` or `vp lint --config <path>` to select another config. See [Oxlint's configuration](https://oxc.rs/docs/guide/usage/linter/config.html) for details.
4
+
5
+ `vp check` uses the workspace-root `lint` block when it exists, including from a package directory. Package configs do not replace these lint settings in `vp check`.
4
6
 
5
7
  ## Example
6
8
 
@@ -25,4 +27,4 @@ We recommend enabling both `options.typeAware` and `options.typeCheck` so `vp li
25
27
 
26
28
  For file- or package-specific lint rules, use [`lint.overrides`](/guide/monorepo#root-config-with-overrides) from the root `vite.config.ts`.
27
29
 
28
- Vite+ does not currently support nested lint configuration. See [troubleshooting](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) for details and how to give feedback on future support.
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.
@@ -80,7 +80,7 @@ tasks: {
80
80
  }
81
81
  ```
82
82
 
83
- Use the object form when a task needs other fields like `cache`, `dependsOn`, `env`, or `input`.
83
+ Use the object form when a task needs other fields like `cache`, `dependsOn`, or `cwd`.
84
84
 
85
85
  ### `command`
86
86
 
@@ -156,10 +156,26 @@ See [Task Dependencies](/guide/run#task-dependencies) for details on how explici
156
156
 
157
157
  ### `cache`
158
158
 
159
- - **Type:** `boolean`
159
+ - **Type:** `boolean | { env?: string[], untrackedEnv?: string[], input?: Array<...>, output?: Array<...> }`
160
160
  - **Default:** `true`
161
161
 
162
- Whether to cache this task's output. Set to `false` for tasks that should never be cached, like dev servers:
162
+ Whether and how to cache this task. Caching is enabled with default settings when `cache` is omitted, `true`, or `{}`.
163
+
164
+ Use an object to configure how the task is cached with [`cache.env`](#cache-env), [`cache.untrackedEnv`](#cache-untrackedenv), [`cache.input`](#cache-input), and [`cache.output`](#cache-output):
165
+
166
+ ```ts [vite.config.ts]
167
+ tasks: {
168
+ build: {
169
+ command: 'node build.mjs',
170
+ cache: {
171
+ env: ['NODE_ENV'],
172
+ input: [{ auto: true }, '!dist/**'],
173
+ },
174
+ },
175
+ }
176
+ ```
177
+
178
+ Set `cache` to `false` for tasks that should never be cached, like dev servers:
163
179
 
164
180
  ```ts [vite.config.ts]
165
181
  tasks: {
@@ -170,7 +186,7 @@ tasks: {
170
186
  }
171
187
  ```
172
188
 
173
- ### `env`
189
+ ### `cache.env`
174
190
 
175
191
  - **Type:** `string[]`
176
192
  - **Default:** `[]`
@@ -181,7 +197,9 @@ Environment variables included in the cache fingerprint. When any listed variabl
181
197
  tasks: {
182
198
  build: {
183
199
  command: 'node build.mjs',
184
- env: ['NODE_ENV'],
200
+ cache: {
201
+ env: ['NODE_ENV'],
202
+ },
185
203
  },
186
204
  }
187
205
  ```
@@ -195,7 +213,7 @@ $ NODE_ENV=development vp run build # first run
195
213
  $ NODE_ENV=production vp run build # cache miss: env 'NODE_ENV' changed
196
214
  ```
197
215
 
198
- ### `untrackedEnv`
216
+ ### `cache.untrackedEnv`
199
217
 
200
218
  - **Type:** `string[]`
201
219
  - **Default:** see below
@@ -206,12 +224,14 @@ Environment variables passed to the task process but **not** included in the cac
206
224
  tasks: {
207
225
  build: {
208
226
  command: 'node build.mjs',
209
- untrackedEnv: ['CI', 'GITHUB_ACTIONS'],
227
+ cache: {
228
+ untrackedEnv: ['CI', 'GITHUB_ACTIONS'],
229
+ },
210
230
  },
211
231
  }
212
232
  ```
213
233
 
214
- `untrackedEnv` accepts the same wildcard and `!` exclusion patterns as [`env`](#env).
234
+ `untrackedEnv` accepts the same wildcard and `!` exclusion patterns as [`env`](#cache-env).
215
235
 
216
236
  Do not put a variable in `untrackedEnv` if its value changes the task result. If a cache-reporting tool covers the variable through [automatic tracking](/guide/automatic-data-tracking#cooperative-tracking), leave it out of both `env` and `untrackedEnv`.
217
237
 
@@ -219,10 +239,10 @@ Vite Task passes a set of common environment variables to all tasks:
219
239
 
220
240
  - **System:** `HOME`, `USER`, `PATH`, `SHELL`, `LANG`, `TZ`
221
241
  - **Node.js:** `NODE_OPTIONS`, `COREPACK_HOME`, `PNPM_HOME`
222
- - **CI/CD:** `CI`, `VERCEL_*`, `NEXT_*`
242
+ - **CI/CD:** `CI`, `VERCEL_*`, `NEXT_*`, `GITHUB_*`, `RUNNER_*`, `ACTIONS_ID_TOKEN_REQUEST_URL`, `ACTIONS_ID_TOKEN_REQUEST_TOKEN`
223
243
  - **Terminal:** Color variables (`FORCE_COLOR`, `NO_COLOR`, `COLORTERM`, `TERM`, `TERM_PROGRAM`) aren't passed to tasks unless you list them under `env` (the value gets fingerprinted, so changing it invalidates the cache) or `untrackedEnv` (passed without fingerprinting). If `FORCE_COLOR` isn't in either list, the child gets `FORCE_COLOR=1` so cached logs stay colored. Colors get stripped on display when the terminal can't render them.
224
244
 
225
- ### `input`
245
+ ### `cache.input`
226
246
 
227
247
  - **Type:** `Array<string | { auto: boolean } | { pattern: string, base: "workspace" | "package" }>`
228
248
  - **Default:** `[{ auto: true }]` (auto-inferred)
@@ -235,8 +255,10 @@ Vite Task automatically detects which files a command uses. See [Automatic Data
235
255
  tasks: {
236
256
  build: {
237
257
  command: 'vp build',
238
- // Use `{ auto: true }` to use automatic fingerprinting (default).
239
- input: [{ auto: true }, '!**/*.tsbuildinfo', '!dist/**'],
258
+ cache: {
259
+ // Use `{ auto: true }` to use automatic fingerprinting (default).
260
+ input: [{ auto: true }, '!**/*.tsbuildinfo', '!dist/**'],
261
+ },
240
262
  },
241
263
  }
242
264
  ```
@@ -247,7 +269,9 @@ tasks: {
247
269
  tasks: {
248
270
  build: {
249
271
  command: 'vp build',
250
- input: ['src/**/*.ts', 'vite.config.ts'],
272
+ cache: {
273
+ input: ['src/**/*.ts', 'vite.config.ts'],
274
+ },
251
275
  },
252
276
  }
253
277
  ```
@@ -258,10 +282,12 @@ tasks: {
258
282
  tasks: {
259
283
  build: {
260
284
  command: 'vp build',
261
- input: [
262
- { auto: true },
263
- { pattern: 'shared-config/**', base: 'workspace' },
264
- ],
285
+ cache: {
286
+ input: [
287
+ { auto: true },
288
+ { pattern: 'shared-config/**', base: 'workspace' },
289
+ ],
290
+ },
265
291
  },
266
292
  }
267
293
  ```
@@ -277,7 +303,9 @@ The `base` field is required and controls how the glob pattern is resolved:
277
303
  tasks: {
278
304
  greet: {
279
305
  command: 'node greet.mjs',
280
- input: [],
306
+ cache: {
307
+ input: [],
308
+ },
281
309
  },
282
310
  }
283
311
  ```
@@ -286,7 +314,7 @@ tasks: {
286
314
  String glob patterns are resolved relative to the package directory by default. Use the object form with `base: "workspace"` to resolve relative to the workspace root.
287
315
  :::
288
316
 
289
- ### `output`
317
+ ### `cache.output`
290
318
 
291
319
  - **Type:** `Array<string | { auto: boolean } | { pattern: string, base: "workspace" | "package" }>`
292
320
  - **Default:** automatic write tracking
@@ -299,7 +327,9 @@ If you omit `output`, Vite Task uses automatic write tracking to choose those fi
299
327
  tasks: {
300
328
  build: {
301
329
  command: 'node build.mjs',
302
- output: ['dist/**', '!dist/cache/**'],
330
+ cache: {
331
+ output: ['dist/**', '!dist/cache/**'],
332
+ },
303
333
  },
304
334
  }
305
335
  ```
@@ -312,7 +342,9 @@ This is useful when a task writes files that should not be restored from the cac
312
342
  tasks: {
313
343
  typecheck: {
314
344
  command: 'tsc --build',
315
- output: [{ auto: true }, '!*.tsbuildinfo'],
345
+ cache: {
346
+ output: [{ auto: true }, '!*.tsbuildinfo'],
347
+ },
316
348
  },
317
349
  }
318
350
  ```
@@ -323,10 +355,12 @@ If a task writes outside its own package, use the object form with `base: "works
323
355
  tasks: {
324
356
  build: {
325
357
  command: 'node build.mjs',
326
- output: [
327
- 'dist/**',
328
- { pattern: 'shared-artifacts/**', base: 'workspace' },
329
- ],
358
+ cache: {
359
+ output: [
360
+ 'dist/**',
361
+ { pattern: 'shared-artifacts/**', base: 'workspace' },
362
+ ],
363
+ },
330
364
  },
331
365
  }
332
366
  ```
@@ -337,7 +371,9 @@ Set `output: []` to disable output restoration for a cached task:
337
371
  tasks: {
338
372
  report: {
339
373
  command: 'node scripts/report.mjs',
340
- output: [],
374
+ cache: {
375
+ output: [],
376
+ },
341
377
  },
342
378
  }
343
379
  ```
@@ -4,7 +4,7 @@ Automatic data tracking is how Vite Task learns what inputs a task needs for cac
4
4
 
5
5
  When you run a cache-enabled task, Vite Task observes the task's execution and records what files were read and written, as well as any metadata reported by the task. On the next run, Vite Task uses the recorded fingerprint to decide whether to replay the cache or run the task.
6
6
 
7
- Use this page when you need to understand why a task hits or misses the cache, or when you need to decide whether to add `input`, `output`, `env`, or `untrackedEnv` config.
7
+ Use this page when you need to understand why a task hits or misses the cache, or when you need to decide whether to add `cache.input`, `cache.output`, `cache.env`, or `cache.untrackedEnv` config.
8
8
 
9
9
  ## Tracking Tiers
10
10
 
@@ -19,7 +19,7 @@ Vite Task starts with file system tracking for any command. A cache-reporting to
19
19
 
20
20
  ## File System Tracking
21
21
 
22
- File system tracking applies to every cache-enabled task. If you omit [`input`](/config/run#input), Vite Task tracks the files a command reads while it runs:
22
+ File system tracking applies to every cache-enabled task. If you omit [`cache.input`](/config/run#cache-input), Vite Task tracks the files a command reads while it runs:
23
23
 
24
24
  ```ts [vite.config.ts]
25
25
  import { defineConfig } from 'vite-plus';
@@ -37,7 +37,7 @@ export default defineConfig({
37
37
 
38
38
  For this task, Vite Task records source files, config files, missing files the command checked, and directories the command scanned. Subsequent runs re-run the task when one of those tracked inputs changes.
39
39
 
40
- File system tracking also tracks outputs. If you omit [`output`](/config/run#output), Vite Task archives files the command writes after a successful run and restores them on a cache hit.
40
+ File system tracking also tracks outputs. If you omit [`cache.output`](/config/run#cache-output), Vite Task archives files the command writes after a successful run and restores them on a cache hit.
41
41
 
42
42
  ### Limitations
43
43
 
@@ -45,13 +45,13 @@ Vite Task cannot track environment variable reads, and it cannot always tell whi
45
45
 
46
46
  Use [Override Inputs And Outputs](#override-inputs-and-outputs) when file system tracking includes files that should not affect the cache, misses files that should, or restores the wrong outputs.
47
47
 
48
- Use [`env`](/config/run#env) when a command needs an environment variable and the value should affect the cache, or [`untrackedEnv`](/config/run#untrackedenv) when the value should not affect the cache.
48
+ Use [`cache.env`](/config/run#cache-env) when a command needs an environment variable and the value should affect the cache, or [`cache.untrackedEnv`](/config/run#cache-untrackedenv) when the value should not affect the cache.
49
49
 
50
50
  These limitations do not apply to `vp build`: Vite reports [Cooperative Tracking](#cooperative-tracking) metadata automatically, including `VITE_*`, `NODE_ENV`, and Vite-managed cache paths that should not become inputs or outputs. A standard `vp build` task does not need manual `input`, `output`, or `env`.
51
51
 
52
52
  ### Override Inputs And Outputs
53
53
 
54
- [`input`](/config/run#input) controls what invalidates the cache. [`output`](/config/run#output) controls which files Vite Task restores on a cache hit.
54
+ [`cache.input`](/config/run#cache-input) controls what invalidates the cache. [`cache.output`](/config/run#cache-output) controls which files Vite Task restores on a cache hit.
55
55
 
56
56
  Both options use the same syntax and can be configured separately.
57
57
 
@@ -65,12 +65,13 @@ Both options use the same syntax and can be configured separately.
65
65
  tasks: {
66
66
  build: {
67
67
  command: 'node build.mjs',
68
+ cache: {
69
+ // Keep automatic input tracking, but exclude `dist` from inputs.
70
+ input: [{ auto: true }, '!dist/**'],
68
71
 
69
- // Keep automatic input tracking, but exclude `dist` from inputs.
70
- input: [{ auto: true }, '!dist/**'],
71
-
72
- // Disable automatic output tracking and restore only `dist/**` on a cache hit.
73
- output: ['dist/**'],
72
+ // Disable automatic output tracking and restore only `dist/**` on a cache hit.
73
+ output: ['dist/**'],
74
+ },
74
75
  },
75
76
  }
76
77
  ```
@@ -81,8 +82,10 @@ Use explicit `input` globs only when you know the command's full input set. This
81
82
  tasks: {
82
83
  lint: {
83
84
  command: 'vp lint',
84
- // Disable automatic input tracking and fingerprint only these files.
85
- input: ['src/**', 'vite.config.ts'],
85
+ cache: {
86
+ // Disable automatic input tracking and fingerprint only these files.
87
+ input: ['src/**', 'vite.config.ts'],
88
+ },
86
89
  },
87
90
  }
88
91
  ```
@@ -93,7 +96,9 @@ Set `input: []` when no files should affect the cache fingerprint. This is rarel
93
96
  tasks: {
94
97
  downloadSchema: {
95
98
  command: 'curl -O https://example.com/schema.json',
96
- input: [],
99
+ cache: {
100
+ input: [],
101
+ },
97
102
  },
98
103
  }
99
104
  ```
@@ -128,13 +133,13 @@ export default defineConfig({
128
133
 
129
134
  Run this task with `vpr frontendBuild` or `vp run frontendBuild`.
130
135
 
131
- Manual config overrides reported metadata. Add `input`, `output`, `env`, or `untrackedEnv` when your project has behavior that Vite cannot report.
136
+ Manual config overrides reported metadata. Add `cache.input`, `cache.output`, `cache.env`, or `cache.untrackedEnv` when your project has behavior that Vite cannot report.
132
137
 
133
138
  Vite+ supports cooperative tracking for `vp build` today. It will extend this support to more first-party tools in the future. Third-party tools can report cache metadata with [`@voidzero-dev/vite-task-client`](https://npmx.dev/package/@voidzero-dev/vite-task-client).
134
139
 
135
140
  ## When To Add Manual Config
136
141
 
137
- Add config when your project has behavior the command or tool cannot know.
142
+ Add config when your project has behavior the command or tool cannot know. These options go under the task's [`cache`](/config/run#cache) object.
138
143
 
139
144
  | Case | Example |
140
145
  | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
@@ -7,7 +7,7 @@ Vite Task can automatically track dependencies and cache tasks run through `vp r
7
7
  When a task runs successfully (exit code 0), its terminal output (stdout/stderr) and all written files (output files) are saved. On the next run, Vite Task checks if anything changed:
8
8
 
9
9
  1. **Arguments:** did the [additional arguments](/guide/run#additional-arguments) passed to the task change?
10
- 2. **Environment variables:** did any [fingerprinted env vars](/config/run#env) change?
10
+ 2. **Environment variables:** did any [fingerprinted env vars](/config/run#cache-env) change?
11
11
  3. **Inputs:** did any input file that the command reads change?
12
12
 
13
13
  When all checks match, Vite Task replays the cached terminal output, restores saved output files, and skips the command.
@@ -50,14 +50,16 @@ Vite Task uses [automatic data tracking](/guide/automatic-data-tracking) to lear
50
50
  - **File system tracking:** Vite Task records file reads, missing-file probes, directory listings, and written output files for every task with cache enabled.
51
51
  - **Cooperative tracking:** cache-reporting tools can report metadata that file system tracking cannot infer. Vite+ supports this for `vp build` today.
52
52
 
53
- Use [`input`](/config/run#input) or [`output`](/config/run#output) when a task needs manual tracking rules. `input` controls what invalidates the cache. `output` controls which files Vite Task restores on a cache hit.
53
+ Use [`cache.input`](/config/run#cache-input) or [`cache.output`](/config/run#cache-output) when a task needs manual tracking rules. `input` controls what invalidates the cache. `output` controls which files Vite Task restores on a cache hit.
54
54
 
55
55
  ```ts [vite.config.ts]
56
56
  tasks: {
57
57
  build: {
58
58
  command: 'node build.mjs',
59
- input: [{ auto: true }, '!dist/**'],
60
- output: ['dist/**'],
59
+ cache: {
60
+ input: [{ auto: true }, '!dist/**'],
61
+ output: ['dist/**'],
62
+ },
61
63
  },
62
64
  }
63
65
  ```
@@ -66,20 +68,22 @@ tasks: {
66
68
 
67
69
  By default, tasks run in a clean environment. Only a small set of common variables, such as `PATH`, `HOME`, and `CI`, are passed through. Other environment variables are neither visible to the task nor included in the cache fingerprint.
68
70
 
69
- To add an environment variable to the cache key, add it to [`env`](/config/run#env). Changing its value then invalidates the cache:
71
+ To add an environment variable to the cache key, add it to [`cache.env`](/config/run#cache-env). Changing its value then invalidates the cache:
70
72
 
71
73
  ```ts [vite.config.ts]
72
74
  tasks: {
73
75
  build: {
74
76
  command: 'webpack --mode production',
75
- env: ['NODE_ENV'],
77
+ cache: {
78
+ env: ['NODE_ENV'],
79
+ },
76
80
  },
77
81
  }
78
82
  ```
79
83
 
80
- To pass a variable to the task **without** affecting cache behavior, use [`untrackedEnv`](/config/run#untrackedenv). This is useful for variables like `CI` or `GITHUB_ACTIONS` that should be available in the task, but do not affect caching behavior.
84
+ To pass a variable to the task **without** affecting cache behavior, use [`cache.untrackedEnv`](/config/run#cache-untrackedenv). This is useful for variables like `CI` or `GITHUB_ACTIONS` that should be available in the task, but do not affect caching behavior.
81
85
 
82
- See [Run Config](/config/run#env) for details on wildcard patterns and the full list of automatically passed-through variables.
86
+ See [Run Config](/config/run#cache-env) for details on wildcard patterns and the full list of automatically passed-through variables.
83
87
 
84
88
  ## Cache Sharing
85
89
 
@@ -29,6 +29,8 @@ vp check --no-fmt --no-lint # Type-check only (requires `typeCheck` enabled).
29
29
  - [`fmt`](/guide/fmt#configuration) block in `vite.config.ts`
30
30
  - TypeScript project structure and tsconfig files for type-aware linting
31
31
 
32
+ When run from a workspace package, `vp check` uses the workspace-root `lint` and `fmt` blocks. Package configs cannot replace root format settings, lint rules, or type-check options. File paths and TypeScript projects are still resolved from the package working directory.
33
+
32
34
  Recommended base `lint` config:
33
35
 
34
36
  ```ts [vite.config.ts]
@@ -80,7 +80,14 @@ Project-owned hook scripts such as `.vite-hooks/pre-commit` should be committed
80
80
 
81
81
  ### `vp staged`
82
82
 
83
- `vp staged` runs staged-file checks using the `staged` config from `vite.config.ts`. To run it before each commit, add it to the project-owned pre-commit hook:
83
+ `vp staged` runs staged-file checks using the `staged` config from `vite.config.ts`. It bundles `lint-staged` 17 and requires:
84
+
85
+ - Node.js `22.22.1` or later in the `22.x` line, or `24.11.0` or later
86
+ - Git `2.32.0` or later
87
+
88
+ Node.js `20.x` is no longer supported for staged checks. These requirements also apply when a pre-commit hook runs `vp staged`. Upgrade the project's Node.js runtime and the Git installation on developer machines and CI runners before using the command. See the [lint-staged 17 release notes](https://github.com/lint-staged/lint-staged/releases/tag/v17.0.0) for the upstream changes.
89
+
90
+ To run it before each commit, add it to the project-owned pre-commit hook:
84
91
 
85
92
  ```bash
86
93
  vp staged
package/docs/guide/env.md CHANGED
@@ -65,16 +65,16 @@ Package-manager selection uses this priority:
65
65
  4. `devEngines.packageManager`
66
66
  5. Lockfile or manager-specific configuration
67
67
  6. The named package manager's global default version
68
- 7. The named shim's latest release
68
+ 7. The named shim's latest release (Node.js' bundled version for `npm`)
69
69
 
70
70
  `VP_PACKAGE_MANAGER` selects the manager and version for commands such as `vp install`. Direct package-manager shims ignore this variable and use independent version overrides:
71
71
 
72
- | Variable | Shims |
73
- | ----------------- | ----------------- |
74
- | `VP_NPM_VERSION` | `npm`, `npx` |
75
- | `VP_PNPM_VERSION` | `pnpm`, `pnpx` |
76
- | `VP_YARN_VERSION` | `yarn`, `yarnpkg` |
77
- | `VP_BUN_VERSION` | `bun`, `bunx` |
72
+ | Variable | Shims |
73
+ | ----------------- | --------------------------- |
74
+ | `VP_NPM_VERSION` | `npm`, `npx` |
75
+ | `VP_PNPM_VERSION` | `pnpm`, `pnpx`, `pn`, `pnx` |
76
+ | `VP_YARN_VERSION` | `yarn`, `yarnpkg` |
77
+ | `VP_BUN_VERSION` | `bun`, `bunx` |
78
78
 
79
79
  These variables accept a version or range, such as `10.18.0`, `10`, or `latest`, and override the matching shim's project and default versions. They do not change the manager or version selected by `vp install`.
80
80
 
@@ -89,12 +89,14 @@ VP_PNPM_VERSION=10.20.0 pnpm --version
89
89
 
90
90
  The overrides apply in managed mode. A package manager can also perform its own version switching after Vite+ launches it; for example, pnpm's `managePackageManagerVersions` setting may switch back to the version in `package.json`.
91
91
 
92
- A project selection applies only to its matching shims. For example, pnpm controls `pnpm` and `pnpx`; invoking `npm` still resolves npm independently. Without a matching project selection, a named shim uses its configured default version and otherwise uses the latest release without prompting. The directly invoked npm shim keeps its Node-bundled fallback, while an explicit `vp env ... npm` family scope uses standalone npm's latest release.
92
+ A project selection applies only to its matching shims. For example, pnpm controls `pnpm`, `pnpx`, `pn`, and `pnx`; invoking `npm` still resolves npm independently. Without a matching project selection, a named shim uses its configured default version and otherwise uses the latest release without prompting. The npm shim falls back to Node's bundled npm. `vp env use npm` selects standalone npm's latest release for the current shell when no project version or global default is configured.
93
93
 
94
94
  ::: details Latest-version caching
95
95
  When a named shim falls back to the latest release, the resolved version is cached for one hour. An expired cache remains available when the registry cannot be reached.
96
96
  :::
97
97
 
98
+ `pn` runs the same managed binary as `pnpm`, and `pnx` runs the same managed binary as `pnpx` (`pnpm dlx`). These aliases also work with managed pnpm versions older than v11.
99
+
98
100
  ## Environment Modes
99
101
 
100
102
  Managed mode is on by default, so Node.js and configured package-manager shims resolve through Vite+ and pick the right versions for the current project. Fresh installers record managed mode for npm, pnpm, Yarn, and Bun after the user enables environment management.
@@ -120,17 +122,20 @@ If you do not want Vite+ to manage Node.js first, run:
120
122
  vp env off
121
123
  ```
122
124
 
123
- This switches both components to system-first mode. Vite+ prefers system tools and falls back to managed installations. Mixed configurations compose: a system package-manager launcher receives the Node.js selected by the Node mode.
125
+ This switches both components to system-first mode. Vite+ prefers system tools and falls back to managed installations. Mixed configurations compose: package-manager launchers that look up Node.js through PATH receive the runtime selected by the Node mode.
124
126
 
125
- Using `pm` records the selected mode for all currently supported package managers and replaces their individual choices. An unscoped `on` or `off` does the same while also changing Node.js. A family without a recorded mode remains undecided until its shim is first used or an `on` / `off` command configures it.
127
+ Using `pm` records the selected mode for all currently supported package managers and replaces their individual choices. An unscoped `on` or `off` does the same while also changing Node.js.
126
128
 
127
129
  ## Commands
128
130
 
129
131
  ### Setup
130
132
 
131
- - `vp env setup` creates or updates the `node`, `npm`, `npx`, `pnpm`, `pnpx`, `yarn`, `yarnpkg`, `bun`, `bunx`, `vpx`, and `vpr` shims in the resolved bin directory. It writes shell setup scripts in the config directory.
132
- - `vp env on` / `vp env off` changes both modes; append `node`, `pm`, `npm`, `pnpm`, `yarn`, or `bun` to narrow the change
133
- - `vp env print` prints PATH setup for both components; append a selector to print one
133
+ - `vp env setup` creates tool shims and writes shell setup scripts.
134
+ - `vp env setup --refresh` recreates Vite+ shims and regenerates shell setup scripts using your saved preferences.
135
+ - `vp env on` / `vp env off` switches between Vite+-managed and system-first modes; append `node`, `pm`, `npm`, `pnpm`, `yarn`, or `bun` to narrow the change.
136
+ - `vp env print` prints PATH setup for both components; append a selector to print one.
137
+
138
+ Upgrades refresh the setup automatically. Open a new terminal or reload your shell setup script afterward.
134
139
 
135
140
  PowerShell needs to dot-source the generated setup script in the current shell before `vp env use` can affect only that shell session:
136
141
 
package/docs/guide/fmt.md CHANGED
@@ -20,9 +20,13 @@ vp fmt . --write
20
20
 
21
21
  Put formatting configuration directly in the `fmt` block in the root `vite.config.ts` so all your configuration stays in one place. We do not recommend using `.oxfmtrc.json` with Vite+.
22
22
 
23
- Vite+ does not currently support nested format configuration. For now, use [`fmt.overrides`](/guide/monorepo#format-overrides) in the root `vite.config.ts` for file- or package-specific options. The long-term behavior is open for discussion; [share your use case and expectations](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) to help shape it.
23
+ `vp fmt` finds its config from the working directory, so package directories without their own `fmt` block use the root config. Relative file arguments retain their meaning. Use [`fmt.overrides`](/guide/monorepo#format-overrides) for file- or package-specific options instead of adding `fmt` blocks to package configs.
24
24
 
25
- For editors, disable nested formatter configs so format-on-save uses the root Vite+ `fmt` block:
25
+ `vp check` uses the workspace-root `fmt` block when it exists, including from a package directory. Package configs cannot replace those format settings in `vp check`.
26
+
27
+ An explicit `vp fmt -c <path>` or `vp fmt --config <path>` selects another config. Otherwise, Oxfmt discovers the nearest `vite.config.*` file with a `fmt` block. Supported extensions are `.js`, `.mjs`, `.ts`, `.cjs`, `.mts`, and `.cts`. Nested configs do not override settings for individual files.
28
+
29
+ For editors, disable nested formatter configs to prevent per-file overrides:
26
30
 
27
31
  ```json [.vscode/settings.json]
28
32
  {
@@ -8,7 +8,7 @@ Vite+ also ships a [global `vp` CLI](/guide/global-cli) that manages Node.js and
8
8
 
9
9
  If you already have a Vite project, run [`vp migrate`](/guide/migrate) to migrate it to Vite+, or give your coding agent our [migration prompt](/guide/migrate#migration-prompt).
10
10
 
11
- Building with an AI assistant? View and copy a ready-made setup prompt:
11
+ Building with an AI assistant? View and copy a prompt to create a new project, migrate an existing project, or upgrade Vite+:
12
12
 
13
13
  <CopyPrompt />
14
14