vite-plus 1.0.0-rc.0 → 1.0.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.
- package/README.md +3 -1
- package/binding/index.cjs +55 -54
- package/binding/index.d.cts +27 -4
- package/dist/{agent-Dinpyd-k.js → agent-CKMI1a8W.js} +2 -2
- package/dist/bin.js +32 -22
- package/dist/config/bin.js +3 -3
- package/dist/{constants-CiKwrA0v.js → constants-BqJiMVVU.js} +1 -1
- package/dist/create/bin.js +7 -7
- package/dist/{define-config-CBccpane.cjs → define-config-C_KGDLUZ.cjs} +7 -1
- package/dist/{define-config-B9usMnEa.d.ts → define-config-Cf_5GHmY.d.ts} +20 -15
- package/dist/{define-config-jhuYJ7Tb.js → define-config-DhEJaYRc.js} +8 -2
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/dist-BWiANxFS.js +8052 -0
- package/dist/{dist-BDYZP12R.js → dist-BsAzy8OW.js} +109 -105
- package/dist/{editor-DMBczTdj.js → editor-CHfGUhxP.js} +47 -13
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/lint-plugins.cjs +1 -1
- package/dist/migration/bin.js +13 -11
- package/dist/migration/compat/worker.js +1 -1
- package/dist/{oxlint-plugin-config-BgsDA6ua.js → oxlint-plugin-config-lMMD5fAC.js} +1 -1
- package/dist/oxlint-plugin.js +2 -2
- package/dist/pack-bin.js +1 -1
- package/dist/{package-B85H2Nw0.js → package-Cgdlhamw.js} +1 -1
- package/dist/{prompts-CQobX7uP.js → prompts-jMH8S4Wp.js} +2 -3
- package/dist/{report-CK5TnTsr.js → report-NhQk8VHb.js} +1 -0
- package/dist/{resolve-vite-config-BUFUmi8h.js → resolve-vite-config-BJYYtfY3.js} +2 -2
- package/dist/{resolve-vite-config-I8fmpR7I.js → resolve-vite-config-BPgpYMYp.js} +1 -1
- package/dist/staged/bin.js +2 -2
- package/dist/sync-versions/bin.js +1 -2
- package/dist/toolchain.js +8 -8
- package/dist/toolchain.json +8 -8
- package/dist/{tsconfig-Buo0RSzz.js → tsconfig-BoYTBNX_.js} +2 -2
- package/dist/{tsconfig-C1VeTG9k.js → tsconfig-CmKidmRD.js} +1 -1
- package/dist/version.js +2 -2
- package/dist/versions.js +3 -3
- package/docs/config/fmt.md +3 -1
- package/docs/config/lint.md +3 -1
- package/docs/config/run.md +61 -25
- package/docs/guide/automatic-data-tracking.md +20 -15
- package/docs/guide/cache.md +12 -8
- package/docs/guide/fmt.md +4 -2
- package/docs/guide/lint.md +4 -2
- package/docs/guide/migrate-rules.md +42 -0
- package/docs/guide/migrate.md +4 -4
- package/docs/guide/monorepo.md +4 -2
- package/docs/guide/run.md +3 -1
- package/docs/guide/troubleshooting.md +1 -1
- package/package.json +12 -12
- package/dist/dist-Dqv1-Clg.js +0 -3
- package/dist/semver-CaDAb8vV.js +0 -1400
package/docs/config/run.md
CHANGED
|
@@ -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`,
|
|
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
|
|
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
|
-
|
|
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
|
-
|
|
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
|
|
|
@@ -222,7 +242,7 @@ Vite Task passes a set of common environment variables to all tasks:
|
|
|
222
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
|
-
|
|
239
|
-
|
|
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
|
-
|
|
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
|
-
|
|
262
|
-
|
|
263
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
327
|
-
|
|
328
|
-
|
|
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
|
-
|
|
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
|
-
|
|
70
|
-
|
|
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
|
-
|
|
85
|
-
|
|
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
|
-
|
|
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
|
| ----------------------------------------------------------------- | ----------------------------------------------------------------------------------------------- |
|
package/docs/guide/cache.md
CHANGED
|
@@ -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
|
-
|
|
60
|
-
|
|
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
|
-
|
|
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
|
|
package/docs/guide/fmt.md
CHANGED
|
@@ -20,9 +20,11 @@ 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
|
-
|
|
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
|
-
|
|
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.
|
|
26
28
|
|
|
27
29
|
For editors, disable nested formatter configs to prevent per-file overrides:
|
|
28
30
|
|
package/docs/guide/lint.md
CHANGED
|
@@ -20,9 +20,11 @@ vp lint --type-aware
|
|
|
20
20
|
|
|
21
21
|
Put lint configuration directly in the `lint` block in the root `vite.config.ts` so all your configuration stays in one place. We do not recommend using `oxlint.config.ts` or `.oxlintrc.json` with Vite+.
|
|
22
22
|
|
|
23
|
-
|
|
23
|
+
`vp lint` finds its config from the working directory, so package directories without their own `lint` block use the root config. Relative file arguments retain their meaning. Use [`lint.overrides`](/guide/monorepo#root-config-with-overrides) for file- or package-specific rules instead of adding `lint` blocks to package configs.
|
|
24
24
|
|
|
25
|
-
|
|
25
|
+
`vp check` uses the workspace-root `lint` block when it exists, including from a package directory. Package configs cannot replace those lint settings in `vp check`.
|
|
26
|
+
|
|
27
|
+
An explicit `vp lint -c <path>` or `vp lint --config <path>` selects another config. Otherwise, Oxlint discovers the nearest `vite.config.*` file with a `lint` block. Supported extensions are `.js`, `.mjs`, `.ts`, `.cjs`, `.mts`, and `.cts`. Nested configs do not override settings for individual files.
|
|
26
28
|
|
|
27
29
|
For the upstream rule set, options, and compatibility details, see the [Oxlint docs](https://oxc.rs/docs/guide/usage/linter.html).
|
|
28
30
|
|
|
@@ -52,6 +52,48 @@ When `external` accompanies either `skipNodeModulesBundle` form, static matchers
|
|
|
52
52
|
|
|
53
53
|
The transform does not evaluate configuration code. Objects with spreads, computed keys, or duplicate keys, and conflicting old and new options require manual review. Dynamic boolean selectors remain unchanged. Unrelated Vite and plugin options remain unchanged. Run `vp pack` after migration to check the result. Node.js requirements, TypeScript module resolution, and programmatic `build()` return values require separate review.
|
|
54
54
|
|
|
55
|
+
## Task Cache Configuration
|
|
56
|
+
|
|
57
|
+
`vp migrate` moves `env`, `untrackedEnv`, `input`, and `output` from the top level of each task into the task's [`cache`](/config/run#cache) object. It updates static `run.tasks` objects in `vite.config.*`. This also runs on existing Vite+ projects without `--full`, including workspace packages.
|
|
58
|
+
|
|
59
|
+
| Previous task config | Updated task config |
|
|
60
|
+
| -------------------- | ---------------------------------------------- |
|
|
61
|
+
| No `cache` | Adds `cache` with the moved settings |
|
|
62
|
+
| `cache: true` | Replaces `true` with the moved settings |
|
|
63
|
+
| `cache: { ... }` | Adds the moved settings to the existing object |
|
|
64
|
+
|
|
65
|
+
```ts
|
|
66
|
+
// Before
|
|
67
|
+
build: {
|
|
68
|
+
command: 'vp build',
|
|
69
|
+
env: ['NODE_ENV'],
|
|
70
|
+
input: [{ auto: true }, '!dist/**'],
|
|
71
|
+
},
|
|
72
|
+
|
|
73
|
+
// After
|
|
74
|
+
build: {
|
|
75
|
+
command: 'vp build',
|
|
76
|
+
cache: {
|
|
77
|
+
env: ['NODE_ENV'],
|
|
78
|
+
input: [{ auto: true }, '!dist/**'],
|
|
79
|
+
},
|
|
80
|
+
},
|
|
81
|
+
```
|
|
82
|
+
|
|
83
|
+
Moved settings keep their text and indentation, and the formatting step described in [After the Migration](#after-the-migration) indents them inside `cache`. Comments on their own line above a moved setting, and `//` comments that follow it on the same line, move with it.
|
|
84
|
+
|
|
85
|
+
The transform does not evaluate configuration code. It leaves a task unchanged and prints a manual-migration warning when the task has:
|
|
86
|
+
|
|
87
|
+
- spreads, or computed, escaped, or duplicate keys;
|
|
88
|
+
- a moved setting written as a method, such as `input() { ... }`;
|
|
89
|
+
- a comment between a moved setting and its comma, or after the last setting in `cache`;
|
|
90
|
+
- a moved setting that already exists in `cache`;
|
|
91
|
+
- a `cache` value other than `true` or an object literal.
|
|
92
|
+
|
|
93
|
+
It also warns about tasks in a `vite.config.*` object that is not the exported config itself, such as a variable the config refers to or an object passed to `mergeConfig`. Tasks created in other modules, for example by a shared helper function, are not detected. Move their settings by hand; `vp run` lists every task that still needs it.
|
|
94
|
+
|
|
95
|
+
With `cache: false`, the moved settings would have no effect, so decide whether to remove them or enable caching. On a project that is otherwise up to date, `vp migrate` prints these warnings without running the rest of the migration.
|
|
96
|
+
|
|
55
97
|
## Dependency Rules
|
|
56
98
|
|
|
57
99
|
What happens to each toolchain dependency, at a glance:
|
package/docs/guide/migrate.md
CHANGED
|
@@ -95,21 +95,21 @@ Upgrade the [global CLI](./upgrade.md#global-vp) to your target 1.0 release, the
|
|
|
95
95
|
|
|
96
96
|
### Without the Global CLI
|
|
97
97
|
|
|
98
|
-
Use an existing Node.js runtime that satisfies `^22.18.0 || ^24.11.0 || >=26.0.0`. Run the target migrator through your package manager without adding it to the project first. For the `1.0.0
|
|
98
|
+
Use an existing Node.js runtime that satisfies `^22.18.0 || ^24.11.0 || >=26.0.0`. Run the target migrator through your package manager without adding it to the project first. For the `1.0.0` release:
|
|
99
99
|
|
|
100
100
|
::: code-group
|
|
101
101
|
|
|
102
102
|
```bash [pnpm]
|
|
103
|
-
pnpm dlx --package=vite-plus@1.0.0
|
|
103
|
+
pnpm dlx --package=vite-plus@1.0.0 vp migrate --no-interactive
|
|
104
104
|
```
|
|
105
105
|
|
|
106
106
|
```bash [npm]
|
|
107
|
-
npx --package=vite-plus@1.0.0
|
|
107
|
+
npx --package=vite-plus@1.0.0 vp migrate --no-interactive
|
|
108
108
|
```
|
|
109
109
|
|
|
110
110
|
:::
|
|
111
111
|
|
|
112
|
-
Replace `1.0.0
|
|
112
|
+
Replace `1.0.0` with your target release. For a preview, use the version from the PR and pass `--registry=https://registry-bridge.viteplus.dev` to `pnpm` or `npx` before the `vp` command. Keep the version in `--package` explicit so you run the target migrator rather than the old local CLI.
|
|
113
113
|
|
|
114
114
|
After migration, finish dependency installation and validate with the updated local CLI:
|
|
115
115
|
|
package/docs/guide/monorepo.md
CHANGED
|
@@ -8,9 +8,11 @@ Because `vite.config.ts` is just JavaScript, you can choose to put your entire c
|
|
|
8
8
|
|
|
9
9
|
Run `vp lint`, `vp fmt`, and `vp check` from the workspace root to apply the root lint and format settings across packages. These commands do not apply nested configs to individual files. Define file- or package-specific settings with overrides in the root `vite.config.ts`.
|
|
10
10
|
|
|
11
|
-
When run from a package directory, `vp lint
|
|
11
|
+
When run from a package directory, `vp lint` and `vp fmt` still use the root settings unless the package config defines its own `lint` or `fmt` block. We do not recommend package-level blocks; use overrides in the root config instead. File arguments remain relative to the package working directory.
|
|
12
12
|
|
|
13
|
-
|
|
13
|
+
`vp check` uses the root `lint` and `fmt` blocks when they exist. Package configs cannot replace root format settings, lint rules, or type-check options in `vp check`.
|
|
14
|
+
|
|
15
|
+
Use `-c <path>` or `--config <path>` with `vp lint` or `vp fmt` to select another config explicitly.
|
|
14
16
|
|
|
15
17
|
Use `lint.overrides` for Oxlint rules that only apply to some packages:
|
|
16
18
|
|
package/docs/guide/run.md
CHANGED
|
@@ -26,7 +26,7 @@ The Oxlint type checker path powered by `tsgolint` does not support `baseUrl`. `
|
|
|
26
26
|
|
|
27
27
|
## Nested lint or format config is not applied
|
|
28
28
|
|
|
29
|
-
When running `vp lint`, `vp fmt`, or `vp check`, configs in subdirectories do not override settings for individual files.
|
|
29
|
+
When running `vp lint`, `vp fmt`, or `vp check`, configs in subdirectories do not override settings for individual files. `vp lint` and `vp fmt` let Oxlint and Oxfmt discover configuration from the working directory, so a `lint` or `fmt` block in a package config takes effect when run from that package, which we do not recommend. `vp check` selects the workspace-root `lint` and `fmt` blocks when they exist. Use `-c <path>` or `--config <path>` with `vp lint` or `vp fmt` to select another config explicitly.
|
|
30
30
|
|
|
31
31
|
Keep lint and format settings in the root `vite.config.ts`. Use [`lint.overrides`](/guide/monorepo#root-config-with-overrides) and [`fmt.overrides`](/guide/monorepo#format-overrides) for file- or package-specific settings. You can also [import configuration objects](/guide/monorepo#composing-configuration-files) into the root config to keep settings in separate files.
|
|
32
32
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plus",
|
|
3
|
-
"version": "1.0.0
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "The Unified Toolchain for the Web",
|
|
5
5
|
"homepage": "https://viteplus.dev/guide",
|
|
6
6
|
"bugs": {
|
|
@@ -349,8 +349,8 @@
|
|
|
349
349
|
"@vitest/utils": "5.0.1",
|
|
350
350
|
"oxfmt": "=0.70.0",
|
|
351
351
|
"oxlint": "=1.85.0",
|
|
352
|
-
"oxlint-tsgolint": "=7.0.
|
|
353
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@1.0.0
|
|
352
|
+
"oxlint-tsgolint": "=7.0.2003",
|
|
353
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.0.0",
|
|
354
354
|
"vitest": "5.0.1"
|
|
355
355
|
},
|
|
356
356
|
"devDependencies": {
|
|
@@ -363,7 +363,7 @@
|
|
|
363
363
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
364
364
|
"@vitest/browser-playwright": "5.0.1",
|
|
365
365
|
"@vitest/browser-webdriverio": "5.0.0",
|
|
366
|
-
"@voidzero-dev/vite-plus-prompts": "1.0.0
|
|
366
|
+
"@voidzero-dev/vite-plus-prompts": "1.0.0",
|
|
367
367
|
"bingo": "^0.9.3",
|
|
368
368
|
"cac": "^7.0.0",
|
|
369
369
|
"cross-spawn": "^7.0.5",
|
|
@@ -411,14 +411,14 @@
|
|
|
411
411
|
"node": "^22.18.0 || ^24.11.0 || >=26.0.0"
|
|
412
412
|
},
|
|
413
413
|
"optionalDependencies": {
|
|
414
|
-
"@voidzero-dev/vite-plus-darwin-arm64": "1.0.0
|
|
415
|
-
"@voidzero-dev/vite-plus-darwin-x64": "1.0.0
|
|
416
|
-
"@voidzero-dev/vite-plus-linux-arm64-gnu": "1.0.0
|
|
417
|
-
"@voidzero-dev/vite-plus-linux-arm64-musl": "1.0.0
|
|
418
|
-
"@voidzero-dev/vite-plus-linux-x64-gnu": "1.0.0
|
|
419
|
-
"@voidzero-dev/vite-plus-linux-x64-musl": "1.0.0
|
|
420
|
-
"@voidzero-dev/vite-plus-win32-x64-msvc": "1.0.0
|
|
421
|
-
"@voidzero-dev/vite-plus-win32-arm64-msvc": "1.0.0
|
|
414
|
+
"@voidzero-dev/vite-plus-darwin-arm64": "1.0.0",
|
|
415
|
+
"@voidzero-dev/vite-plus-darwin-x64": "1.0.0",
|
|
416
|
+
"@voidzero-dev/vite-plus-linux-arm64-gnu": "1.0.0",
|
|
417
|
+
"@voidzero-dev/vite-plus-linux-arm64-musl": "1.0.0",
|
|
418
|
+
"@voidzero-dev/vite-plus-linux-x64-gnu": "1.0.0",
|
|
419
|
+
"@voidzero-dev/vite-plus-linux-x64-musl": "1.0.0",
|
|
420
|
+
"@voidzero-dev/vite-plus-win32-x64-msvc": "1.0.0",
|
|
421
|
+
"@voidzero-dev/vite-plus-win32-arm64-msvc": "1.0.0"
|
|
422
422
|
},
|
|
423
423
|
"scripts": {
|
|
424
424
|
"build": "oxnode -C dev ./build.ts",
|
package/dist/dist-Dqv1-Clg.js
DELETED