vite-plus 0.2.1 → 0.2.2

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 (68) hide show
  1. package/bin/oxfmt +6 -3
  2. package/bin/oxlint +6 -3
  3. package/bin/vpr +9 -0
  4. package/binding/index.cjs +53 -53
  5. package/binding/index.d.cts +86 -144
  6. package/dist/agent-D7O7mSeO.js +9456 -0
  7. package/dist/bin.js +10 -7
  8. package/dist/{cli-truncate-CWsmbK3p.js → cli-truncate-BVOlIIPy.js} +1 -1
  9. package/dist/config/bin.js +2 -2
  10. package/dist/{constants-CrfJQIUX.js → constants-NeTOxrzV.js} +7 -3
  11. package/dist/create/bin.js +22 -60
  12. package/dist/{define-config-2tfJoXr1.d.ts → define-config-BuMs_LKa.d.ts} +64 -9
  13. package/dist/{define-config-DJUehepE.js → define-config-CSgy0zML.js} +43 -18
  14. package/dist/{define-config-BGSjF6Xp.cjs → define-config-CrA3lZhQ.cjs} +61 -22
  15. package/dist/define-config.cjs +2 -1
  16. package/dist/define-config.d.ts +2 -2
  17. package/dist/define-config.js +2 -2
  18. package/dist/{dist-Oxo16Y0q.js → dist-CKz3vcoG.js} +4 -4
  19. package/dist/dist-CtM2JRbM.js +3 -0
  20. package/dist/editor-CPzssglc.js +584 -0
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/{json-Dn87fvjk.js → json-DiRs8ceZ.js} +13 -1
  25. package/dist/{log-update-lyIiuflf.js → log-update-DHZRyJ2m.js} +2 -2
  26. package/dist/migration/bin.d.ts +1 -10
  27. package/dist/migration/bin.js +531 -170
  28. package/dist/migration/compat/worker.d.ts +1 -0
  29. package/dist/migration/compat/worker.js +35 -0
  30. package/dist/{oxlint-plugin-config-q8a5PFch.js → oxlint-plugin-config-C2Rqc_WQ.js} +1 -1
  31. package/dist/oxlint-plugin.js +78 -9
  32. package/dist/pack-bin.js +1 -1
  33. package/dist/{package-BHirM1_v.js → package-CU2g7URl.js} +52 -3
  34. package/dist/protocol-D99W10Qi.js +4 -0
  35. package/dist/{report-BHSkWqRR.js → report-BS7ULx7A.js} +2 -0
  36. package/dist/{resolve-vite-config-CmdsfQzS.js → resolve-vite-config-r91rIaPs.js} +14 -10
  37. package/dist/{rolldown-runtime-DnnnRqeS.js → rolldown-runtime-C7HZzL1F.js} +1 -1
  38. package/dist/staged/bin.js +23 -19
  39. package/dist/{tsconfig-BWQPmGKz.js → tsconfig-fvpxgUq2.js} +395 -200
  40. package/dist/version.js +2 -5
  41. package/dist/versions.js +5 -5
  42. package/dist/{wrap-ansi-k7Dn4VtV.js → wrap-ansi-DNjkuBEp.js} +1 -1
  43. package/dist/wrap-ansi-DUi52C6W.js +2 -0
  44. package/docs/_data/team.ts +9 -0
  45. package/docs/config/check.md +35 -0
  46. package/docs/config/index.md +2 -0
  47. package/docs/config/run.md +61 -12
  48. package/docs/guide/automatic-data-tracking.md +145 -0
  49. package/docs/guide/cache.md +14 -35
  50. package/docs/guide/check.md +16 -0
  51. package/docs/guide/ci.md +4 -0
  52. package/docs/guide/docker.md +175 -0
  53. package/docs/guide/env.md +12 -0
  54. package/docs/guide/github-actions-cache.md +165 -0
  55. package/docs/guide/install.md +12 -2
  56. package/docs/guide/migrate-rules.md +347 -0
  57. package/docs/guide/migrate.md +14 -0
  58. package/docs/guide/pack.md +8 -0
  59. package/docs/guide/run.md +33 -3
  60. package/docs/guide/troubleshooting.md +1 -1
  61. package/docs/guide/upgrade.md +43 -21
  62. package/docs/package.json +1 -1
  63. package/package.json +20 -19
  64. package/dist/agent--cKmgD_n.js +0 -3341
  65. package/dist/compat-Cql3K40m.js +0 -14
  66. package/dist/dist-DRJUd9bL.js +0 -3
  67. package/dist/workspace-D0AVy4fu.js +0 -5830
  68. package/dist/wrap-ansi-CeQuiQ31.js +0 -2
package/dist/version.js CHANGED
@@ -1,12 +1,9 @@
1
- import "./constants-CrfJQIUX.js";
1
+ import { m as version } from "./constants-NeTOxrzV.js";
2
2
  import { a as printHeader, r as log, t as accent } from "./terminal-uTv0ZaMr.js";
3
- import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-BHirM1_v.js";
3
+ import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-CU2g7URl.js";
4
4
  import { t as renderCliDoc } from "./help-YP84FSEz.js";
5
5
  import path from "node:path";
6
6
  import fs from "node:fs";
7
- //#region package.json
8
- var version = "0.2.1";
9
- //#endregion
10
7
  //#region src/version.ts
11
8
  /** Tool display names in the order shown by `vp --version`. */
12
9
  const TOOL_DISPLAY_ORDER = [
package/dist/versions.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export const versions = {
2
- "vite": "8.0.16",
3
- "rolldown": "1.1.1",
2
+ "vite": "8.1.2",
3
+ "rolldown": "1.1.4",
4
4
  "tsdown": "0.22.3",
5
- "oxlint": "1.70.0",
6
- "oxfmt": "0.55.0",
7
- "oxlint-tsgolint": "0.23.0",
5
+ "oxlint": "1.72.0",
6
+ "oxfmt": "0.57.0",
7
+ "oxlint-tsgolint": "0.24.0",
8
8
  "vitest": "4.1.9"
9
9
  };
@@ -32,7 +32,7 @@ function stringWidth(string, options = {}) {
32
32
  }
33
33
  //#endregion
34
34
  //#region ../../node_modules/.pnpm/wrap-ansi@9.0.2/node_modules/wrap-ansi/index.js
35
- const ESCAPES = new Set(["\x1B", "›"]);
35
+ const ESCAPES = /* @__PURE__ */ new Set(["\x1B", "›"]);
36
36
  const END_CODE = 39;
37
37
  const ANSI_ESCAPE_BELL = "\x07";
38
38
  const ANSI_CSI = "[";
@@ -0,0 +1,2 @@
1
+ import { t as wrapAnsi } from "./wrap-ansi-DNjkuBEp.js";
2
+ export { wrapAnsi as default };
@@ -117,6 +117,15 @@ export const core: DefaultTheme.TeamMember[] = [
117
117
  { icon: 'linkedin', link: 'https://www.linkedin.com/in/jong-kyung' },
118
118
  ],
119
119
  },
120
+ {
121
+ avatar: 'https://github.com/liangmiQwQ.png',
122
+ name: 'Liang',
123
+ links: [
124
+ { icon: 'github', link: 'https://github.com/liangmiQwQ' },
125
+ { icon: 'x', link: 'https://x.com/liangmiQwQ' },
126
+ { icon: 'bluesky', link: 'https://bsky.app/profile/liangmi.dev' },
127
+ ],
128
+ },
120
129
  ];
121
130
 
122
131
  export const emeriti: DefaultTheme.TeamMember[] = [];
@@ -0,0 +1,35 @@
1
+ # Check Config
2
+
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
+
5
+ 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
+
7
+ ## Example
8
+
9
+ ```ts [vite.config.ts]
10
+ import { defineConfig } from 'vite-plus';
11
+
12
+ export default defineConfig({
13
+ check: {
14
+ // Skip the format step in `vp check`. Defaults to true.
15
+ fmt: false,
16
+ // Skip lint rules in `vp check`. Type-check still runs when both
17
+ // `lint.options.typeAware` and `lint.options.typeCheck` are enabled.
18
+ // Defaults to true.
19
+ lint: true,
20
+ },
21
+ });
22
+ ```
23
+
24
+ When a step is disabled here, `vp check` prints a short `note:` line so it is clear why the step did not run. With the `check.fmt: false` config above:
25
+
26
+ ```bash
27
+ $ vp check
28
+ note: Format skipped (check.fmt: false in vite.config.ts)
29
+ pass: Found no warnings or lint errors in 1 file (12ms, 8 threads)
30
+ ```
31
+
32
+ ## Scope and precedence
33
+
34
+ - These options only affect the composite `vp check`. Standalone [`vp fmt`](/config/fmt) and [`vp lint`](/config/lint) are unaffected, so you can still run a disabled tool directly when you need it once. Note that any `vp check` invocation honors these defaults, including one run from a pre-commit hook: if your [`staged`](/config/staged) tasks call `vp check`, that step is skipped there too.
35
+ - A step is skipped if the config disables it **or** the matching CLI flag is passed. There is no flag to re-enable a step disabled in config; run `vp fmt` or `vp lint` directly instead.
@@ -14,6 +14,7 @@ export default defineConfig({
14
14
  run: {},
15
15
  fmt: {},
16
16
  lint: {},
17
+ check: {},
17
18
  test: {},
18
19
  pack: {},
19
20
  staged: {},
@@ -28,6 +29,7 @@ Vite+ extends the basic Vite configuration with these additions:
28
29
  - [`run`](/config/run) for Vite Task
29
30
  - [`fmt`](/config/fmt) for Oxfmt
30
31
  - [`lint`](/config/lint) for Oxlint
32
+ - [`check`](/config/check) for `vp check` defaults
31
33
  - [`test`](/config/test) for Vitest
32
34
  - [`pack`](/config/pack) for tsdown
33
35
  - [`staged`](/config/staged) for staged-file checks
@@ -120,9 +120,11 @@ Commands joined with `&&` (or supplied as an array) are automatically split into
120
120
 
121
121
  ### `dependsOn`
122
122
 
123
- - **Type:** `string[]`
123
+ - **Type:** `Array<string | { task: string, from: DependsOnFrom }>`
124
124
  - **Default:** `[]`
125
125
 
126
+ `from` accepts the dependency types `"dependencies"`, `"devDependencies"`, `"peerDependencies"`, or an array of those values, such as `["dependencies", "devDependencies"]`.
127
+
126
128
  Tasks that must complete successfully before this one starts.
127
129
 
128
130
  ```ts [vite.config.ts]
@@ -140,6 +142,19 @@ Dependencies can reference tasks in other packages using the `package#task` form
140
142
  dependsOn: ['@my/core#build', '@my/utils#lint'];
141
143
  ```
142
144
 
145
+ Use the object form `{ task: string, from: DependsOnFrom }` to reference tasks from all dependencies:
146
+
147
+ ```ts [vite.config.ts]
148
+ tasks: {
149
+ test: {
150
+ command: 'vp test',
151
+ dependsOn: [{ task: 'build', from: ['dependencies', 'devDependencies'] }],
152
+ },
153
+ }
154
+ ```
155
+
156
+ For the example above, Vite Task reads the declaring package's direct `dependencies` and `devDependencies`, and runs the `build` task in each dependency that defines one. Packages without `build` are skipped.
157
+
143
158
  See [Task Dependencies](/guide/run#task-dependencies) for details on how explicit and topological dependencies interact.
144
159
 
145
160
  ### `cache`
@@ -168,17 +183,19 @@ Environment variables included in the cache fingerprint. When any listed variabl
168
183
  ```ts [vite.config.ts]
169
184
  tasks: {
170
185
  build: {
171
- command: 'vp build',
186
+ command: 'node build.mjs',
172
187
  env: ['NODE_ENV'],
173
188
  },
174
189
  }
175
190
  ```
176
191
 
177
- Wildcard patterns are supported: `VITE_*` matches all variables starting with `VITE_`.
192
+ Wildcard patterns and `!` exclusion patterns are supported: `VITE_*` matches all variables starting with `VITE_`, and `!VITE_SECRET` excludes the `VITE_SECRET` variable from the match.
193
+
194
+ For `vp build`, Vite reports Vite environment variables through [automatic tracking](/guide/automatic-data-tracking#cooperative-tracking). Do not add `VITE_*` or `NODE_ENV` here for a standard Vite build unless your project has extra build behavior Vite cannot report.
178
195
 
179
196
  ```bash
180
197
  $ NODE_ENV=development vp run build # first run
181
- $ NODE_ENV=production vp run build # cache miss: variable changed
198
+ $ NODE_ENV=production vp run build # cache miss: env 'NODE_ENV' changed
182
199
  ```
183
200
 
184
201
  ### `untrackedEnv`
@@ -191,13 +208,17 @@ Environment variables passed to the task process but **not** included in the cac
191
208
  ```ts [vite.config.ts]
192
209
  tasks: {
193
210
  build: {
194
- command: 'vp build',
211
+ command: 'node build.mjs',
195
212
  untrackedEnv: ['CI', 'GITHUB_ACTIONS'],
196
213
  },
197
214
  }
198
215
  ```
199
216
 
200
- A set of common environment variables are automatically passed through to all tasks:
217
+ `untrackedEnv` accepts the same wildcard and `!` exclusion patterns as [`env`](#env).
218
+
219
+ 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`.
220
+
221
+ Vite Task passes a set of common environment variables to all tasks:
201
222
 
202
223
  - **System:** `HOME`, `USER`, `PATH`, `SHELL`, `LANG`, `TZ`
203
224
  - **Node.js:** `NODE_OPTIONS`, `COREPACK_HOME`, `PNPM_HOME`
@@ -209,7 +230,7 @@ A set of common environment variables are automatically passed through to all ta
209
230
  - **Type:** `Array<string | { auto: boolean } | { pattern: string, base: "workspace" | "package" }>`
210
231
  - **Default:** `[{ auto: true }]` (auto-inferred)
211
232
 
212
- Vite Task automatically detects which files are used by a command (see [Automatic File Tracking](/guide/cache#automatic-file-tracking)). The `input` option can be used to explicitly include or exclude certain files.
233
+ Vite Task automatically detects which files a command uses. See [Automatic Data Tracking](/guide/automatic-data-tracking) for the details and when to add manual config.
213
234
 
214
235
  **Exclude files** from automatic tracking:
215
236
 
@@ -270,26 +291,41 @@ String glob patterns are resolved relative to the package directory by default.
270
291
 
271
292
  ### `output`
272
293
 
273
- - **Type:** `Array<string | { pattern: string, base: "workspace" | "package" }>`
274
- - **Default:** `[]` (nothing is archived)
294
+ - **Type:** `Array<string | { auto: boolean } | { pattern: string, base: "workspace" | "package" }>`
295
+ - **Default:** automatic write tracking
296
+
297
+ Vite Task automatically archives files generated by a successful task run and restores them on a cache hit.
275
298
 
276
- Files the task produces. They get archived after a successful run and restored on a cache hit, so you don't have to rebuild them. Leave it empty (or omit it) and nothing is archived.
299
+ If you omit `output`, Vite Task uses automatic write tracking to choose those files. Add explicit `output` entries when you need to override which files are restored.
277
300
 
278
301
  ```ts [vite.config.ts]
279
302
  tasks: {
280
303
  build: {
281
- command: 'vp build',
304
+ command: 'node build.mjs',
282
305
  output: ['dist/**', '!dist/cache/**'],
283
306
  },
284
307
  }
285
308
  ```
286
309
 
310
+ Use `{ auto: true }` to keep automatic write tracking while adding explicit output globs.
311
+
312
+ This is useful when a task writes files that should not be restored from the cache. For example, exclude TypeScript `.tsbuildinfo` files:
313
+
314
+ ```ts [vite.config.ts]
315
+ tasks: {
316
+ typecheck: {
317
+ command: 'tsc --build',
318
+ output: [{ auto: true }, '!*.tsbuildinfo'],
319
+ },
320
+ }
321
+ ```
322
+
287
323
  If a task writes outside its own package, use the object form with `base: "workspace"`:
288
324
 
289
325
  ```ts [vite.config.ts]
290
326
  tasks: {
291
327
  build: {
292
- command: 'vp build',
328
+ command: 'node build.mjs',
293
329
  output: [
294
330
  'dist/**',
295
331
  { pattern: 'shared-artifacts/**', base: 'workspace' },
@@ -298,6 +334,19 @@ tasks: {
298
334
  }
299
335
  ```
300
336
 
337
+ Set `output: []` to disable output restoration for a cached task:
338
+
339
+ ```ts [vite.config.ts]
340
+ tasks: {
341
+ report: {
342
+ command: 'node scripts/report.mjs',
343
+ output: [],
344
+ },
345
+ }
346
+ ```
347
+
348
+ Unlike `cache: false`, `output: []` still lets Vite Task fingerprint the task. On a cache hit, Vite Task skips the command and replays its terminal output. Use this for local caches when the task's output files are already there and do not need to be restored.
349
+
301
350
  ### `cwd`
302
351
 
303
352
  - **Type:** `string`
@@ -0,0 +1,145 @@
1
+ # Automatic Data Tracking
2
+
3
+ Automatic data tracking is how Vite Task learns what inputs a task needs for caching outputs without explicit config.
4
+
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
+
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.
8
+
9
+ ## Tracking Tiers
10
+
11
+ Automatic data tracking has two tiers:
12
+
13
+ | Tier | Applies to | Records |
14
+ | -------------------- | ---------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------- |
15
+ | File system tracking | All tasks with cache enabled | <ul><li>Files read by the command</li><li>Missing-file probes</li><li>Directory listings</li><li>Written output files</li></ul> |
16
+ | Cooperative tracking | Cache-reporting tools (`vp build` today) | <ul><li>Environment variables reported by the tool</li><li>Tool-managed paths that should not be inputs or outputs, such as `node_modules/.vite-temp`</li></ul> |
17
+
18
+ Vite Task starts with file system tracking for any command. A cache-reporting tool can add information that only the tool knows while it runs.
19
+
20
+ ## File System Tracking
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:
23
+
24
+ ```ts [vite.config.ts]
25
+ import { defineConfig } from 'vite-plus';
26
+
27
+ export default defineConfig({
28
+ run: {
29
+ tasks: {
30
+ build: {
31
+ command: 'tsc',
32
+ },
33
+ },
34
+ },
35
+ });
36
+ ```
37
+
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
+
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.
41
+
42
+ ### Limitations
43
+
44
+ Vite Task cannot track environment variable reads, and it cannot always tell which tracked paths are stable inputs, generated outputs, or tool-managed cache paths that should not become inputs or outputs.
45
+
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
+
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.
49
+
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
+
52
+ ### Override Inputs And Outputs
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.
55
+
56
+ Both options use the same syntax and can be configured separately.
57
+
58
+ - Omit the option to keep automatic tracking.
59
+ - Add `{ auto: true }` to keep automatic tracking while adding glob rules.
60
+ - Use string globs to include paths.
61
+ - Use `!` globs to exclude paths.
62
+ - Use `[]` to replace automatic tracking with an empty list.
63
+
64
+ ```ts [vite.config.ts]
65
+ tasks: {
66
+ build: {
67
+ command: 'node build.mjs',
68
+
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/**'],
74
+ },
75
+ }
76
+ ```
77
+
78
+ Use explicit `input` globs only when you know the command's full input set. This lint task overrides inputs only, so output tracking stays automatic:
79
+
80
+ ```ts [vite.config.ts]
81
+ tasks: {
82
+ lint: {
83
+ command: 'vp lint',
84
+ // Disable automatic input tracking and fingerprint only these files.
85
+ input: ['src/**', 'vite.config.ts'],
86
+ },
87
+ }
88
+ ```
89
+
90
+ Set `input: []` when no files should affect the cache fingerprint. This is rarely useful. For example, a download task can be cached when the same URL always serves the same file. No input files should be fingerprinted for this task, but changing the URL still invalidates the cache:
91
+
92
+ ```ts [vite.config.ts]
93
+ tasks: {
94
+ downloadSchema: {
95
+ command: 'curl -O https://example.com/schema.json',
96
+ input: [],
97
+ },
98
+ }
99
+ ```
100
+
101
+ Set `output: []` when no files should be restored on a cache hit.
102
+
103
+ ## Cooperative Tracking
104
+
105
+ File system tracking records access. It cannot know why a tool used each path.
106
+
107
+ `vp build` knows more about a Vite build than Vite Task can infer from file access. When `vp build` runs with cache enabled, Vite reports that metadata to Vite Task. Vite Task merges the report with file system tracking to build a more accurate cache fingerprint.
108
+
109
+ For a standard Vite build, you do not need to add these entries yourself because Vite reports them automatically at runtime:
110
+
111
+ - `env: ['VITE_*']` or `env: ['NODE_ENV']`
112
+ - `output: ['dist/**']`
113
+ - input or output exclusions for temporary paths like `node_modules/.vite-temp`
114
+
115
+ You only need to define the task with `vp build`:
116
+
117
+ ```ts [vite.config.ts]
118
+ import { defineConfig } from 'vite-plus';
119
+
120
+ export default defineConfig({
121
+ run: {
122
+ tasks: {
123
+ frontendBuild: 'vp build',
124
+ },
125
+ },
126
+ });
127
+ ```
128
+
129
+ Run this task with `vpr frontendBuild` or `vp run frontendBuild`.
130
+
131
+ Manual config overrides reported metadata. Add `input`, `output`, `env`, or `untrackedEnv` when your project has behavior that Vite cannot report.
132
+
133
+ 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
+
135
+ ## When To Add Manual Config
136
+
137
+ Add config when your project has behavior the command or tool cannot know.
138
+
139
+ | Case | Example |
140
+ | ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
141
+ | Exclude an output directory from inputs | `input: [{ auto: true }, '!dist/**']` |
142
+ | Exclude a temporary generated file from input and output tracking | `input: [{ auto: true }, '!.tmp/config.mjs']`<br>`output: [{ auto: true }, '!.tmp/config.mjs']` |
143
+ | Avoid automatic file tracking for a task | `input: ['src/**']`<br>`output: ['dist/**']` |
144
+ | Track and pass an env var | `env: ['NODE_ENV']` |
145
+ | Pass an env var without fingerprinting it | `untrackedEnv: ['GITHUB_ACTIONS']` |
@@ -4,32 +4,19 @@ Vite Task can automatically track dependencies and cache tasks run through `vp r
4
4
 
5
5
  ## Overview
6
6
 
7
- When a task runs successfully (exit code 0), its terminal output (stdout/stderr) is saved. On the next run, Vite Task checks if anything changed:
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
10
  2. **Environment variables:** did any [fingerprinted env vars](/config/run#env) change?
11
- 3. **Input files:** did any file that the command reads change?
11
+ 3. **Inputs:** did any input file that the command reads change?
12
12
 
13
- If everything matches, the cached output is replayed instantly, and the command does not run.
14
-
15
- ::: info
16
- By default, only terminal output is cached and replayed. To cache files produced by a task, configure [`output`](/config/run#output) globs. Matching files are archived after a successful run and restored on a cache hit.
17
- :::
18
-
19
- ```ts [vite.config.ts]
20
- tasks: {
21
- build: {
22
- command: 'vp build',
23
- output: ['dist/**'],
24
- },
25
- }
26
- ```
13
+ When all checks match, Vite Task replays the cached terminal output, restores saved output files, and skips the command.
27
14
 
28
15
  When a cache miss occurs, Vite Task tells you exactly why:
29
16
 
30
17
  ```
31
18
  $ vp lint ✗ cache miss: 'src/utils.ts' modified, executing
32
- $ vp build ✗ cache miss: env changed, executing
19
+ $ vp build ✗ cache miss: env 'VITE_GREETING' changed, executing
33
20
  $ vp test ✗ cache miss: args changed, executing
34
21
  ```
35
22
 
@@ -45,7 +32,7 @@ A task can set [`cache: false`](/config/run#cache) to opt out. This cannot be ov
45
32
 
46
33
  ### 2. CLI flags
47
34
 
48
- `--no-cache` disables caching for everything. `--cache` enables caching for both tasks and scripts, which is equivalent to setting [`run.cache: true`](/config/run#run-cache) for that invocation.
35
+ `--no-cache` disables caching for every task and script in that run. `--cache` enables caching for both tasks and scripts, which is equivalent to setting [`run.cache: true`](/config/run#run-cache) for that invocation.
49
36
 
50
37
  ### 3. Workspace config
51
38
 
@@ -56,29 +43,21 @@ The [`run.cache`](/config/run#run-cache) option in your root `vite.config.ts` co
56
43
  | `cache.tasks` | `true` | Cache tasks defined in `vite.config.ts` |
57
44
  | `cache.scripts` | `false` | Cache `package.json` scripts |
58
45
 
59
- ## Automatic File Tracking
60
-
61
- Vite Task tracks which files each command reads during execution. When a task runs, it records which files the process opens, such as your `.ts` source files, `vite.config.ts`, and `package.json`, and records their content hashes. On the next run, it re-checks those hashes to determine if anything changed.
62
-
63
- This means caching works out of the box for most commands without any configuration. Vite Task also records:
46
+ ## Automatic Data Tracking
64
47
 
65
- - **Missing files:** if a command probes for a file that doesn't exist, such as `utils.ts` during module resolution, creating that file later correctly invalidates the cache.
66
- - **Directory listings:** if a command scans a directory, such as a test runner looking for `*.test.ts`, adding or removing files in that directory invalidates the cache.
48
+ Vite Task uses [automatic data tracking](/guide/automatic-data-tracking) to learn what each task needs for caching so you don't have to configure it manually. Automatic data tracking has two tiers:
67
49
 
68
- ### Avoiding Overly Broad Input Tracking
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
+ - **Cooperative tracking:** cache-reporting tools can report metadata that file system tracking cannot infer. Vite+ supports this for `vp build` today.
69
52
 
70
- Automatic tracking can sometimes include more files than necessary, causing unnecessary cache misses:
71
-
72
- - **Tool cache files:** some tools maintain their own cache, such as TypeScript's `.tsbuildinfo` or Cargo's `target/`. These files may change between runs even when your source code has not, causing unnecessary cache invalidation.
73
- - **Directory listings:** when a command scans a directory, such as when globbing for `**/*.js`, Vite Task sees the directory read but not the glob pattern. Any file added or removed in that directory, even unrelated ones, invalidates the cache.
74
-
75
- Use the [`input`](/config/run#input) option to exclude files or to replace automatic tracking with explicit file patterns:
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.
76
54
 
77
55
  ```ts [vite.config.ts]
78
56
  tasks: {
79
57
  build: {
80
- command: 'tsc',
81
- input: [{ auto: true }, '!**/*.tsbuildinfo'],
58
+ command: 'node build.mjs',
59
+ input: [{ auto: true }, '!dist/**'],
60
+ output: ['dist/**'],
82
61
  },
83
62
  }
84
63
  ```
@@ -98,7 +77,7 @@ tasks: {
98
77
  }
99
78
  ```
100
79
 
101
- To pass a variable to the task **without** affecting cache behavior, use [`untrackedEnv`](/config/run#untracked-env). This is useful for variables like `CI` or `GITHUB_ACTIONS` that should be available in the task, but do not generally affect caching behavior.
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.
102
81
 
103
82
  See [Run Config](/config/run#env) for details on wildcard patterns and the full list of automatically passed-through variables.
104
83
 
@@ -42,3 +42,19 @@ export default defineConfig({
42
42
  },
43
43
  });
44
44
  ```
45
+
46
+ ### Disabling a step by default
47
+
48
+ To make `vp check` skip formatting or linting without passing a flag every time, set the [`check`](/config/check) block in `vite.config.ts`. This is handy when a project wants the rest of the toolchain but not, say, formatting:
49
+
50
+ ```ts [vite.config.ts]
51
+ import { defineConfig } from 'vite-plus';
52
+
53
+ export default defineConfig({
54
+ check: {
55
+ fmt: false, // `vp check` lints (and type-checks) but does not format
56
+ },
57
+ });
58
+ ```
59
+
60
+ 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
@@ -23,6 +23,10 @@ That means you usually do not need separate `setup-node`, package-manager setup,
23
23
 
24
24
  With `cache: true`, `setup-vp` handles dependency caching for you automatically.
25
25
 
26
+ ::: tip
27
+ `setup-vp` caches package-manager data. To reuse Vite Task results across CI runs, add a separate [GitHub Actions cache for Vite Task](/guide/github-actions-cache).
28
+ :::
29
+
26
30
  ## Simplifying Existing Workflows
27
31
 
28
32
  If you are migrating an existing GitHub Actions workflow, you can often replace large blocks of Node, package-manager, and cache setup with a single `setup-vp` step.