vite-plus 0.2.0 → 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.
- package/bin/oxfmt +6 -3
- package/bin/oxlint +6 -3
- package/bin/vpr +9 -0
- package/binding/index.cjs +53 -53
- package/binding/index.d.cts +86 -144
- package/dist/agent-D7O7mSeO.js +9456 -0
- package/dist/bin.js +10 -7
- package/dist/{cli-truncate-CWsmbK3p.js → cli-truncate-BVOlIIPy.js} +1 -1
- package/dist/config/bin.js +2 -2
- package/dist/{constants-CrfJQIUX.js → constants-NeTOxrzV.js} +7 -3
- package/dist/create/bin.js +22 -60
- package/dist/{define-config-2tfJoXr1.d.ts → define-config-BuMs_LKa.d.ts} +64 -9
- package/dist/{define-config-DJUehepE.js → define-config-CSgy0zML.js} +43 -18
- package/dist/{define-config-BGSjF6Xp.cjs → define-config-CrA3lZhQ.cjs} +61 -22
- package/dist/define-config.cjs +2 -1
- package/dist/define-config.d.ts +2 -2
- package/dist/define-config.js +2 -2
- package/dist/{dist-Oxo16Y0q.js → dist-CKz3vcoG.js} +4 -4
- package/dist/dist-CtM2JRbM.js +3 -0
- package/dist/editor-CPzssglc.js +584 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-Dn87fvjk.js → json-DiRs8ceZ.js} +13 -1
- package/dist/{log-update-lyIiuflf.js → log-update-DHZRyJ2m.js} +2 -2
- package/dist/migration/bin.d.ts +1 -10
- package/dist/migration/bin.js +531 -170
- package/dist/migration/compat/worker.d.ts +1 -0
- package/dist/migration/compat/worker.js +35 -0
- package/dist/{oxlint-plugin-config-q8a5PFch.js → oxlint-plugin-config-C2Rqc_WQ.js} +1 -1
- package/dist/oxlint-plugin.js +78 -9
- package/dist/pack-bin.js +1 -1
- package/dist/{package-BHirM1_v.js → package-CU2g7URl.js} +52 -3
- package/dist/protocol-D99W10Qi.js +4 -0
- package/dist/{report-BHSkWqRR.js → report-BS7ULx7A.js} +2 -0
- package/dist/{resolve-vite-config-CmdsfQzS.js → resolve-vite-config-r91rIaPs.js} +14 -10
- package/dist/{rolldown-runtime-DnnnRqeS.js → rolldown-runtime-C7HZzL1F.js} +1 -1
- package/dist/staged/bin.js +23 -19
- package/dist/{tsconfig-CJ_StdFc.js → tsconfig-fvpxgUq2.js} +395 -200
- package/dist/version.js +2 -5
- package/dist/versions.js +5 -5
- package/dist/{wrap-ansi-k7Dn4VtV.js → wrap-ansi-DNjkuBEp.js} +1 -1
- package/dist/wrap-ansi-DUi52C6W.js +2 -0
- package/docs/_data/team.ts +9 -0
- package/docs/config/check.md +35 -0
- package/docs/config/index.md +2 -0
- package/docs/config/run.md +61 -12
- package/docs/guide/automatic-data-tracking.md +145 -0
- package/docs/guide/cache.md +14 -35
- package/docs/guide/check.md +16 -0
- package/docs/guide/ci.md +4 -0
- package/docs/guide/docker.md +175 -0
- package/docs/guide/env.md +12 -0
- package/docs/guide/github-actions-cache.md +165 -0
- package/docs/guide/install.md +12 -2
- package/docs/guide/migrate-rules.md +347 -0
- package/docs/guide/migrate.md +14 -0
- package/docs/guide/pack.md +8 -0
- package/docs/guide/run.md +33 -3
- package/docs/guide/troubleshooting.md +1 -1
- package/docs/guide/upgrade.md +43 -21
- package/docs/package.json +1 -1
- package/package.json +21 -20
- package/dist/agent-BD31CsvU.js +0 -3341
- package/dist/compat-Cql3K40m.js +0 -14
- package/dist/dist-DRJUd9bL.js +0 -3
- package/dist/workspace-Cjoc1c_A.js +0 -5830
- package/dist/wrap-ansi-CeQuiQ31.js +0 -2
|
@@ -0,0 +1,347 @@
|
|
|
1
|
+
# Migration Rules
|
|
2
|
+
|
|
3
|
+
This reference describes exactly what `vp migrate` does to a project: how it
|
|
4
|
+
updates dependencies, rewrites source imports and package scripts, and adjusts
|
|
5
|
+
package-manager configuration. See the [migration guide](./migrate.md) for the
|
|
6
|
+
command overview and workflow.
|
|
7
|
+
|
|
8
|
+
Except for [Before You Migrate](#before-you-migrate), which lists steps you
|
|
9
|
+
take yourself, everything below describes automatic behavior.
|
|
10
|
+
|
|
11
|
+
## Before You Migrate
|
|
12
|
+
|
|
13
|
+
1. Run `vp upgrade` so the global CLI has the latest migration rules. A stale
|
|
14
|
+
local `vite-plus` is not a blocker: when the project's local copy is older,
|
|
15
|
+
migration delegates to the global CLI.
|
|
16
|
+
2. Upgrade the project to Vite 8+ and Vitest 4.1+ when necessary.
|
|
17
|
+
3. Run `vp migrate` from the workspace root. Use `--no-interactive` in
|
|
18
|
+
automated environments.
|
|
19
|
+
4. Review every changed manifest, package-manager config, source rewrite, and
|
|
20
|
+
generated lockfile.
|
|
21
|
+
5. Validate with `vp install`, `vp check`, `vp test`, and `vp build`.
|
|
22
|
+
|
|
23
|
+
Migration is idempotent: running it again after a successful migration should
|
|
24
|
+
not produce another diff.
|
|
25
|
+
|
|
26
|
+
## Upgrade vs. Full Setup
|
|
27
|
+
|
|
28
|
+
On a project that already depends on `vite-plus`, `vp migrate` performs an
|
|
29
|
+
upgrade only: it updates dependencies and package-manager configuration and
|
|
30
|
+
finalizes imports. It does not touch project setup.
|
|
31
|
+
|
|
32
|
+
- `--full` also runs the setup actions: git hooks, editor config, agent files,
|
|
33
|
+
ESLint and Prettier migration, framework shims, the tsconfig `baseUrl` fix,
|
|
34
|
+
and the `.nvmrc`/Volta to `.node-version` conversion.
|
|
35
|
+
- `--hooks`, `--agent`, and `--editor` opt into a single setup action without
|
|
36
|
+
`--full`.
|
|
37
|
+
|
|
38
|
+
When a default upgrade skips setup actions that would apply, it prints a hint
|
|
39
|
+
to run `vp migrate --full`. Fresh (non Vite+) projects always run the full
|
|
40
|
+
migration.
|
|
41
|
+
|
|
42
|
+
## Dependency Rules
|
|
43
|
+
|
|
44
|
+
What happens to each toolchain dependency, at a glance:
|
|
45
|
+
|
|
46
|
+
| Dependency | What happens |
|
|
47
|
+
| ------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
48
|
+
| `vite-plus` | Added where the package is migrated; plain ranges re-pinned to the concrete target, directly or through a catalog. |
|
|
49
|
+
| `vite` | Existing declarations kept and pointed at the core alias. Under pnpm, added as a direct dev dependency wherever needed (see [Vite and Overrides](#vite-and-overrides)). |
|
|
50
|
+
| `vitest` | Removed in the common node-mode case because `vite-plus` provides it transitively. Kept or added only when [directly required](#when-vitest-is-directly-required). |
|
|
51
|
+
| `@vitest/*` | Directly installed lockstep packages aligned to the bundled Vitest version (see [Vitest Ecosystem Packages](#vitest-ecosystem-packages)). |
|
|
52
|
+
| `@voidzero-dev/vite-plus-test` | Removed everywhere: dependencies, overrides, resolutions, and catalog aliases. Imports are rewritten to the current `vite-plus/test*` surface. |
|
|
53
|
+
|
|
54
|
+
### Version Selection
|
|
55
|
+
|
|
56
|
+
- `vite-plus` is pinned to the concrete version of the CLI running the
|
|
57
|
+
migration, never the `latest` dist-tag.
|
|
58
|
+
- The `vite` alias targets `@voidzero-dev/vite-plus-core` from the same Vite+
|
|
59
|
+
release.
|
|
60
|
+
- A catalog-backed manifest may contain `catalog:` or a named catalog
|
|
61
|
+
reference. Migration keeps the reference and updates the referenced catalog
|
|
62
|
+
value to the concrete toolchain target.
|
|
63
|
+
- Deliberate protocol pins are preserved: `workspace:`, `file:`, `link:`,
|
|
64
|
+
`npm:`, `github:`, Git URLs, and HTTP URLs.
|
|
65
|
+
- Migration reconciles every workspace package, not only the root manifest.
|
|
66
|
+
Shared overrides and catalogs stay at the workspace root; dependencies that
|
|
67
|
+
provide a peer belong in each package that needs them.
|
|
68
|
+
|
|
69
|
+
### Vite and Overrides
|
|
70
|
+
|
|
71
|
+
Package-manager overrides do not create dependency edges by themselves. Under
|
|
72
|
+
pnpm, a package that lists `vite-plus` in `dependencies` or `devDependencies`
|
|
73
|
+
but has no `vite` entry anywhere (`dependencies`, `devDependencies`,
|
|
74
|
+
`optionalDependencies`, or `peerDependencies`) lets pnpm auto-install upstream
|
|
75
|
+
Vite to satisfy Vitest's required `vite` peer, splitting the project across
|
|
76
|
+
separate Vite+, Vite, and Vitest instances. To prevent this, `vp migrate` adds
|
|
77
|
+
the missing `vite` entry to `devDependencies` of every such package; the
|
|
78
|
+
workspace override then redirects it to Vite+ core.
|
|
79
|
+
|
|
80
|
+
Related rules:
|
|
81
|
+
|
|
82
|
+
- A direct `vite` declaration is never removed merely because a root override
|
|
83
|
+
exists.
|
|
84
|
+
- Plain or stale aliases are normalized; named catalog references are kept.
|
|
85
|
+
- The direct-entry rule above is pnpm-specific. Bun mirrors its core alias as
|
|
86
|
+
a direct dependency for its peer resolver, and npm browser-provider layouts
|
|
87
|
+
may need a top-level `vite` edge so nested Vitest packages can resolve
|
|
88
|
+
`vite`.
|
|
89
|
+
|
|
90
|
+
### When Vitest Is Directly Required
|
|
91
|
+
|
|
92
|
+
Migration keeps or adds a package-local `vitest` at the exact bundled version
|
|
93
|
+
when any of the following is true:
|
|
94
|
+
|
|
95
|
+
- an installed dependency has a non-optional `vitest` peer, whether exact or a
|
|
96
|
+
range;
|
|
97
|
+
- the package uses Vitest browser mode or an opt-in browser provider;
|
|
98
|
+
- source or TypeScript configuration retains an upstream `vitest` reference;
|
|
99
|
+
- the package declares `@nuxt/test-utils`; or
|
|
100
|
+
- dependency metadata is unavailable and an existing direct `vitest` might be
|
|
101
|
+
satisfying an unknown required peer.
|
|
102
|
+
|
|
103
|
+
Detection reads installed peer metadata, so integrations such as
|
|
104
|
+
`vite-plugin-gherkin` are handled even though their names do not contain
|
|
105
|
+
`vitest`.
|
|
106
|
+
|
|
107
|
+
When a package qualifies, migration:
|
|
108
|
+
|
|
109
|
+
- adds `vitest` to that package, not indiscriminately to every workspace
|
|
110
|
+
package;
|
|
111
|
+
- uses the existing catalog reference when supported, otherwise the exact
|
|
112
|
+
bundled version; and
|
|
113
|
+
- keeps a matching workspace override or resolution so the graph resolves a
|
|
114
|
+
single Vitest version.
|
|
115
|
+
|
|
116
|
+
A peer declaration alone does not install Vitest. If a surviving
|
|
117
|
+
`peerDependencies.vitest` uses a catalog entry that migration will remove, it
|
|
118
|
+
is resolved to the public peer range first.
|
|
119
|
+
|
|
120
|
+
### Vitest Ecosystem Packages
|
|
121
|
+
|
|
122
|
+
Official current `@vitest/*` packages generally publish in lockstep with
|
|
123
|
+
Vitest. Migration aligns the ones the project directly installs, including
|
|
124
|
+
`@vitest/coverage-v8`, `@vitest/coverage-istanbul`, `@vitest/ui`, and
|
|
125
|
+
`@vitest/web-worker`:
|
|
126
|
+
|
|
127
|
+
- when the package manager supports catalogs, they are referenced through the
|
|
128
|
+
toolchain catalog: an existing `catalog:` / `catalog:<name>` reference is
|
|
129
|
+
preserved, a catalog entry is added for any package that lacks one, and each
|
|
130
|
+
entry is updated to the bundled Vitest version;
|
|
131
|
+
- when catalogs are unsupported (npm, a standalone bun project, or a
|
|
132
|
+
pre-catalog pnpm/Yarn), the concrete bundled version is written instead.
|
|
133
|
+
|
|
134
|
+
Packages that are **not** aligned:
|
|
135
|
+
|
|
136
|
+
- `@vitest/eslint-plugin` follows its own version line;
|
|
137
|
+
- `@vitest/coverage-c8` stopped at an older release and has no Vitest 4
|
|
138
|
+
version; and
|
|
139
|
+
- third-party `vitest-*` integrations keep their own compatible versions,
|
|
140
|
+
though their required Vitest peer may still trigger
|
|
141
|
+
[direct provisioning](#when-vitest-is-directly-required).
|
|
142
|
+
|
|
143
|
+
For browser mode, the base `@vitest/browser` runtime and
|
|
144
|
+
`@vitest/browser-preview` are bundled by Vite+ and are removed as direct
|
|
145
|
+
dependencies. The Playwright and WebdriverIO providers stay opt-in: a kept or
|
|
146
|
+
injected provider is referenced through the preferred toolchain catalog at the
|
|
147
|
+
bundled Vitest version (or written concretely when catalogs are unsupported),
|
|
148
|
+
and its `playwright` or `webdriverio` peer is installed alongside.
|
|
149
|
+
|
|
150
|
+
Providers are detected before imports are rewritten. This covers legacy
|
|
151
|
+
projects that aliased `vitest` to `@voidzero-dev/vite-plus-test` and import
|
|
152
|
+
from `vitest/browser-<provider>`, `vitest/browser/providers/<provider>`, or
|
|
153
|
+
`vitest/plugins/browser-<provider>`: those imports still install the
|
|
154
|
+
corresponding `@vitest/browser-playwright` or `@vitest/browser-webdriverio`
|
|
155
|
+
dependency and its framework peer.
|
|
156
|
+
|
|
157
|
+
Object-valued nested npm and Bun overrides are preserved: they are
|
|
158
|
+
user-defined scopes rather than scalar version pins.
|
|
159
|
+
|
|
160
|
+
## Source Rewrite Rules
|
|
161
|
+
|
|
162
|
+
### `vite` Imports
|
|
163
|
+
|
|
164
|
+
`vite` and `vite/*` imports are rewritten to `vite-plus` **only in config
|
|
165
|
+
entry files**: `vite.config.*`, `vitest.config.*`, and any config file the
|
|
166
|
+
migration resolved. Every other file keeps its `vite` imports, for two
|
|
167
|
+
reasons:
|
|
168
|
+
|
|
169
|
+
- `vite-plus` is not a guaranteed superset of Vite's exposed surface. It owns
|
|
170
|
+
only `defineConfig`, `defineProject`, and `lazyPlugins`, so rewriting a
|
|
171
|
+
pass-through symbol such as `createBuilder` or `loadConfigFromFile`
|
|
172
|
+
(including in `typeof import('vite')` type positions) can break.
|
|
173
|
+
- An unrewritten `vite` import still resolves through the
|
|
174
|
+
`@voidzero-dev/vite-plus-core` alias in a Vite+ project.
|
|
175
|
+
|
|
176
|
+
Plugin packages (an unscoped name starting with `vite-plugin-` or
|
|
177
|
+
`unplugin-`, or `vite` in `peerDependencies`/`dependencies`) skip the rewrite
|
|
178
|
+
even in config files. Only the `vite` specifier is in scope for this rule.
|
|
179
|
+
|
|
180
|
+
`declare module 'vite'` augmentations follow the same rule and are preserved
|
|
181
|
+
outside config files. Through the core alias they reach the same
|
|
182
|
+
`@voidzero-dev/vite-plus-core` module whose `UserConfig` types `defineConfig`
|
|
183
|
+
from `vite-plus`, so they keep working after migration; `vite-plus` itself
|
|
184
|
+
exports no `UserConfig` symbol, so a rewritten `declare module 'vite-plus'`
|
|
185
|
+
augmentation would merge with nothing. Extensions aimed at `vite-plus`'s own
|
|
186
|
+
surface are written against `vite-plus` by hand.
|
|
187
|
+
|
|
188
|
+
### `vitest` and Browser Imports
|
|
189
|
+
|
|
190
|
+
- Ordinary `vitest` and `vitest/*` imports are rewritten to
|
|
191
|
+
`vite-plus/test*`.
|
|
192
|
+
- Legacy Playwright and WebdriverIO provider imports are detected before this
|
|
193
|
+
rewrite so their optional provider dependencies are not lost.
|
|
194
|
+
- Scoped `@vitest/browser*` imports are rewritten to the corresponding
|
|
195
|
+
`vite-plus/test/browser*` exports, provisioning opt-in providers when
|
|
196
|
+
needed.
|
|
197
|
+
- Existing `vite-plus/test*` imports are left unchanged.
|
|
198
|
+
|
|
199
|
+
### What Is Never Rewritten
|
|
200
|
+
|
|
201
|
+
- `declare module 'vitest'` and `declare module '@vitest/browser*'`: module
|
|
202
|
+
augmentation must retain the upstream module identity.
|
|
203
|
+
- References that stay behind, such as `compilerOptions.types`,
|
|
204
|
+
`require.resolve`, `import.meta.resolve`, and `vitest/package.json`,
|
|
205
|
+
require package-local Vitest (see
|
|
206
|
+
[When Vitest Is Directly Required](#when-vitest-is-directly-required)).
|
|
207
|
+
- In a package that declares `@nuxt/test-utils`, every `vitest` and
|
|
208
|
+
`vitest/*` module specifier is preserved package-wide: the Nuxt transform
|
|
209
|
+
requires the upstream identity and can otherwise inject a duplicate `vi`
|
|
210
|
+
import. This exception does not apply to sibling packages or to scoped
|
|
211
|
+
`@vitest/browser*` imports.
|
|
212
|
+
|
|
213
|
+
The `prefer-vite-plus-imports` lint rule follows the same Nuxt exception, so
|
|
214
|
+
lint autofix preserves these imports too.
|
|
215
|
+
|
|
216
|
+
## Package Script Rewrite Rules
|
|
217
|
+
|
|
218
|
+
Migration rewrites commands provided by the Vite+ toolchain in `package.json`
|
|
219
|
+
scripts while preserving their arguments:
|
|
220
|
+
|
|
221
|
+
| Before | After |
|
|
222
|
+
| ------------- | ------------------------------------------- |
|
|
223
|
+
| `vite` | `vp dev`, or the matching `vp` subcommand |
|
|
224
|
+
| `vitest` | `vp test` |
|
|
225
|
+
| `oxlint` | `vp lint` |
|
|
226
|
+
| `oxfmt` | `vp fmt` |
|
|
227
|
+
| `tsdown` | `vp pack` |
|
|
228
|
+
| `lint-staged` | `vp staged` |
|
|
229
|
+
| `eslint` | `vp lint`, when its optional migration runs |
|
|
230
|
+
| `prettier` | `vp fmt`, when its optional migration runs |
|
|
231
|
+
|
|
232
|
+
For commands launched through `bunx`, migration preserves `bunx` and its
|
|
233
|
+
`--bun` flag (keeping the user's chosen runtime) and rewrites only the managed
|
|
234
|
+
command. This also works when `bunx` follows a command-launcher delimiter such
|
|
235
|
+
as `run` or `--`:
|
|
236
|
+
|
|
237
|
+
| Before | After |
|
|
238
|
+
| ------------------------------------------------------- | -------------------------------------------------------- |
|
|
239
|
+
| `bunx --bun vite build` | `bunx --bun vp build` |
|
|
240
|
+
| `bunx --bun vitest run` | `bunx --bun vp test run` |
|
|
241
|
+
| `portless --tailscale run bunx --bun vite` | `portless --tailscale run bunx --bun vp dev` |
|
|
242
|
+
| `dotenv -e .env.test -- bunx --bun oxlint --type-aware` | `dotenv -e .env.test -- bunx --bun vp lint --type-aware` |
|
|
243
|
+
|
|
244
|
+
Unrelated `bunx` commands and other package-executor forms remain unchanged.
|
|
245
|
+
|
|
246
|
+
## Node.js Version Rules
|
|
247
|
+
|
|
248
|
+
Migration converts legacy Node.js version-manager files to `.node-version`,
|
|
249
|
+
the format Vite+ reads. On an existing Vite+ project this conversion is part
|
|
250
|
+
of the full setup bucket, so it runs with `vp migrate --full`; fresh
|
|
251
|
+
migrations run it unconditionally.
|
|
252
|
+
|
|
253
|
+
- `.nvmrc` and Volta `volta.node` pins are converted to `.node-version`. An
|
|
254
|
+
existing `.node-version` is kept.
|
|
255
|
+
- When `.nvmrc` is removed, any `actions/setup-node` `node-version-file:
|
|
256
|
+
.nvmrc` reference in `.github/workflows/*.{yml,yaml}` and composite actions
|
|
257
|
+
(`.github/actions/**/action.{yml,yaml}`) is repointed to `.node-version` so
|
|
258
|
+
CI does not fail with "node version file ... does not exist".
|
|
259
|
+
|
|
260
|
+
## Package-Manager Rules
|
|
261
|
+
|
|
262
|
+
### pnpm
|
|
263
|
+
|
|
264
|
+
**Root settings location.** pnpm 10.6.2+ uses `pnpm-workspace.yaml` as the
|
|
265
|
+
single source for supported root settings. Migration moves recognized
|
|
266
|
+
`package.json#pnpm` fields there, including overrides, peer rules, patch
|
|
267
|
+
settings, package extensions, architecture and build policy, audit/update
|
|
268
|
+
configuration, and configuration dependencies. It removes the `pnpm` object
|
|
269
|
+
when it becomes empty and preserves unknown keys that may belong to other
|
|
270
|
+
tooling.
|
|
271
|
+
|
|
272
|
+
- When both files define the same migrated setting, object entries are merged
|
|
273
|
+
recursively and unique array entries are retained. Values from
|
|
274
|
+
`package.json#pnpm` win at conflicting scalar leaves, while workspace-only
|
|
275
|
+
sibling entries are preserved.
|
|
276
|
+
- Before pnpm 10.6.2, these settings stay in `package.json#pnpm`. (Workspace
|
|
277
|
+
settings support arrived incrementally: 10.5.0 in general, 10.5.1 for
|
|
278
|
+
overrides, 10.6.2 for `peerDependencyRules`. pnpm 11 no longer reads the
|
|
279
|
+
legacy `package.json` settings.)
|
|
280
|
+
|
|
281
|
+
**Catalogs.** Catalogs are a separate feature, supported from pnpm 9.5.0,
|
|
282
|
+
independent of the settings boundary above. Even below 10.6.2, where
|
|
283
|
+
overrides stay in `package.json#pnpm`, migration still rewrites the workspace
|
|
284
|
+
catalog off stale wrapper aliases and keeps `catalog:` overrides as
|
|
285
|
+
references rather than inlining them to concrete versions.
|
|
286
|
+
|
|
287
|
+
- Dependency references, default and named catalogs, overrides, and
|
|
288
|
+
`peerDependencyRules` are kept consistent with each other.
|
|
289
|
+
- pnpm accepts the logical default catalog as either top-level `catalog` or
|
|
290
|
+
`catalogs.default`, but not both. Migration preserves the existing form and
|
|
291
|
+
never creates the other form beside it.
|
|
292
|
+
- When an existing named catalog already owns `vite-plus`, `vite`, or
|
|
293
|
+
`vitest`, migration reuses that managed toolchain catalog for newly added
|
|
294
|
+
dependencies and overrides. It creates a top-level default catalog only
|
|
295
|
+
when no managed or default catalog can be reused.
|
|
296
|
+
|
|
297
|
+
**Other rules.**
|
|
298
|
+
|
|
299
|
+
- Each package that declares `vite-plus` also gets a direct `vite` dev
|
|
300
|
+
dependency (see [Vite and Overrides](#vite-and-overrides)).
|
|
301
|
+
- Unrelated selector-shaped and object-valued overrides are preserved.
|
|
302
|
+
|
|
303
|
+
### npm
|
|
304
|
+
|
|
305
|
+
- Direct aliases are normalized before the matching override is added, so npm
|
|
306
|
+
does not fail with `EOVERRIDE`.
|
|
307
|
+
- When a real Vite installation changes to the core alias, stale Vite install
|
|
308
|
+
and lockfile state is removed before reinstalling.
|
|
309
|
+
- Opt-in browser-provider layouts get a top-level `vite` edge when nested
|
|
310
|
+
Vitest packages otherwise cannot resolve it.
|
|
311
|
+
|
|
312
|
+
### Yarn
|
|
313
|
+
|
|
314
|
+
- Vite+ does not support Plug'n'Play. Migration detects explicit and implicit
|
|
315
|
+
PnP and converts the project to `nodeLinker: node-modules`, preserving all
|
|
316
|
+
unrelated `.yarnrc.yml` settings. `--no-interactive` accepts the
|
|
317
|
+
conversion; a process-level `YARN_NODE_LINKER=pnp` must be fixed by the
|
|
318
|
+
caller.
|
|
319
|
+
- Catalog references and user hoisting settings are preserved.
|
|
320
|
+
- Migration avoids split Vitest copies under workspace hoisting isolation: it
|
|
321
|
+
applies a package-level fix where possible and warns when the isolation
|
|
322
|
+
cannot be changed safely.
|
|
323
|
+
|
|
324
|
+
### Bun
|
|
325
|
+
|
|
326
|
+
- Bun catalogs only resolve inside a workspace (a root `package.json` with a
|
|
327
|
+
non-empty `workspaces`). In a bun workspace, existing top-level or
|
|
328
|
+
workspace catalog locations and named catalog references are preserved. A
|
|
329
|
+
standalone (single-package) bun project keeps concrete specs and gets no
|
|
330
|
+
catalog field, because `bun install` cannot resolve `catalog:` outside a
|
|
331
|
+
workspace.
|
|
332
|
+
- The core alias is mirrored as a direct `vite` dependency so Bun sees the
|
|
333
|
+
peer provider before applying overrides.
|
|
334
|
+
|
|
335
|
+
## After the Migration
|
|
336
|
+
|
|
337
|
+
- Each Vite config is inspected for Rolldown-incompatible patterns (such as
|
|
338
|
+
`manualChunks`). Anything found is reported as a warning; the config is not
|
|
339
|
+
changed.
|
|
340
|
+
- Dependencies are reinstalled once to refresh the lockfile. If installation
|
|
341
|
+
fails, migration reports the error and exits with a nonzero status.
|
|
342
|
+
- After a successful migration, `vp fmt` runs on the files changed during
|
|
343
|
+
migration, excluding paths that were already dirty in the Git worktree.
|
|
344
|
+
Oxfmt selects the supported formats; non-Git projects retain full-project
|
|
345
|
+
formatting. Formatting is skipped while the project still uses Prettier. A
|
|
346
|
+
formatter failure is reported as a warning so the migration result and the
|
|
347
|
+
manual formatting command remain available.
|
package/docs/guide/migrate.md
CHANGED
|
@@ -48,6 +48,10 @@ The `migrate` command is designed to move existing projects onto Vite+ quickly.
|
|
|
48
48
|
- Updates scripts to the Vite+ command surface
|
|
49
49
|
- Can set up commit hooks
|
|
50
50
|
- Can write agent and editor configuration files
|
|
51
|
+
- Formats the migrated project
|
|
52
|
+
|
|
53
|
+
See [Migration Rules](./migrate-rules.md) for the exact dependency, source
|
|
54
|
+
rewrite, and package-manager behavior.
|
|
51
55
|
|
|
52
56
|
Most projects will require further manual adjustments after running `vp migrate`.
|
|
53
57
|
|
|
@@ -166,6 +170,16 @@ export default defineConfig({
|
|
|
166
170
|
|
|
167
171
|
After migrating, remove lint-staged from your dependencies and delete any lint-staged config files. See the [Commit hooks guide](/guide/commit-hooks) and [Staged config reference](/config/staged) for details.
|
|
168
172
|
|
|
173
|
+
### Git hook tools
|
|
174
|
+
|
|
175
|
+
The `vp migrate` command can set up Vite+ commit hooks for you, but it doesn't automatically migrate every type of Git hook tool. This automatic migration path is specifically designed to handle Husky v9+ and lint-staged-style setups. Projects using Husky versions older than 9.0.0 are skipped and should upgrade to Husky v9 before using the automatic migration path.
|
|
176
|
+
|
|
177
|
+
If your project currently uses `lefthook`, `simple-git-hooks`, or `yorkie`, `vp migrate` will leave your existing configuration alone and show a warning. This happens even if you choose to set up hooks during the prompt or include the `--hooks` flag.
|
|
178
|
+
|
|
179
|
+
If you want to move one of those tools over to Vite+ manually, you can follow these steps. First, move your staged-file commands into the `staged` block within `vite.config.ts`. Then, update your lifecycle script so it runs `vp config`. You will also need to create a Vite+ hook at `.vite-hooks/pre-commit` that runs `vp staged`. Finally, once you have confirmed that the Vite+ hook is working as expected, you can remove the old tool's configuration and dependency.
|
|
180
|
+
|
|
181
|
+
You can find more details about the full Vite+ hook setup in the [Commit hooks guide](/guide/commit-hooks).
|
|
182
|
+
|
|
169
183
|
## Examples
|
|
170
184
|
|
|
171
185
|
```bash
|
package/docs/guide/pack.md
CHANGED
|
@@ -58,4 +58,12 @@ export default defineConfig({
|
|
|
58
58
|
});
|
|
59
59
|
```
|
|
60
60
|
|
|
61
|
+
Executable support is bundled into Vite+, so you do not need to install `@tsdown/exe` separately.
|
|
62
|
+
|
|
63
|
+
Building executables uses Node's [Single Executable Applications](https://nodejs.org/api/single-executable-applications.html) support and requires Node.js 25.7.0 or later. Switch the active runtime with `vp env use 26` if `vp pack --exe` reports an unsupported version.
|
|
64
|
+
|
|
61
65
|
See the official [tsdown executable docs](https://tsdown.dev/options/exe#executable) for details about configuring custom file names, embedded assets, and cross-platform targets.
|
|
66
|
+
|
|
67
|
+
## CSS Bundling
|
|
68
|
+
|
|
69
|
+
`vp pack` can transform and bundle CSS (including CSS Modules and [Lightning CSS](https://lightningcss.dev/) optimizations) for your entry points. This support is bundled into Vite+, so you do not need to install `@tsdown/css` or `lightningcss` separately, it works out of the box.
|
package/docs/guide/run.md
CHANGED
|
@@ -69,7 +69,7 @@ $ node compile-legacy-app.js ✗ cache miss: 'legacy/index.js' modified, executi
|
|
|
69
69
|
|
|
70
70
|
## Task Definitions
|
|
71
71
|
|
|
72
|
-
Vite Task automatically tracks
|
|
72
|
+
Vite Task [automatically tracks](/guide/automatic-data-tracking) what each task needs for caching. You can define tasks directly in `vite.config.ts` to enable caching by default or control which files and environment variables affect cache behavior.
|
|
73
73
|
|
|
74
74
|
```ts [vite.config.ts]
|
|
75
75
|
import { defineConfig } from 'vite-plus';
|
|
@@ -102,10 +102,40 @@ See [Run Config](/config/run) for the full `run` block reference.
|
|
|
102
102
|
|
|
103
103
|
## Task Dependencies
|
|
104
104
|
|
|
105
|
-
Use [`dependsOn`](#
|
|
105
|
+
Use [`dependsOn`](/config/run#dependson) to run tasks in the right order. Running `vp run deploy` with the config above runs `build` and `test` first.
|
|
106
|
+
|
|
107
|
+
String task names in `dependsOn` reference tasks in the current or another package:
|
|
108
|
+
|
|
109
|
+
```ts [vite.config.ts]
|
|
110
|
+
dependsOn: [
|
|
111
|
+
'build', // same package
|
|
112
|
+
'@my/core#build', // another package
|
|
113
|
+
];
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Use the object form when you need to reference all tasks with a given name from the current package's dependencies:
|
|
117
|
+
|
|
118
|
+
```ts [vite.config.ts]
|
|
119
|
+
import { defineConfig } from 'vite-plus';
|
|
120
|
+
|
|
121
|
+
export default defineConfig({
|
|
122
|
+
run: {
|
|
123
|
+
tasks: {
|
|
124
|
+
test: {
|
|
125
|
+
command: 'vp test',
|
|
126
|
+
dependsOn: [{ task: 'build', from: 'dependencies' }],
|
|
127
|
+
},
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
});
|
|
131
|
+
```
|
|
132
|
+
|
|
133
|
+
In this example, `vp run test` checks the current package's `dependencies`. For each direct workspace dependency that defines `build`, Vite Task runs that dependency's `build` task before `test`.
|
|
134
|
+
|
|
135
|
+
Use an array when you need more than one dependency field:
|
|
106
136
|
|
|
107
137
|
```ts [vite.config.ts]
|
|
108
|
-
dependsOn: ['
|
|
138
|
+
dependsOn: [{ task: 'build', from: ['dependencies', 'devDependencies'] }];
|
|
109
139
|
```
|
|
110
140
|
|
|
111
141
|
## Running in a Workspace
|
|
@@ -69,7 +69,7 @@ export default defineConfig({
|
|
|
69
69
|
|
|
70
70
|
When `vite.config.ts` imports plugins at the top level, they are evaluated for every command, including `vp lint`, `vp fmt`, editor integrations, and long-lived background processes. This can make config loading slow and may trigger plugin setup side effects, such as reading files, starting watchers, or connecting to services.
|
|
71
71
|
|
|
72
|
-
Use `lazyPlugins` to
|
|
72
|
+
Use `lazyPlugins` to skip the plugin factory when vite-plus loads your config only to read a metadata block (`lint`, `fmt`, `check`, `staged`, `pack`, `create`, the `run`/`cache` task lookup, and editor tooling). The plugins still load whenever Vite actually runs, `dev`, `build`, `test`, `preview`, and any build your own scripts spawn (a `vp run` task, `vp exec`):
|
|
73
73
|
|
|
74
74
|
```ts [vite.config.ts]
|
|
75
75
|
import { defineConfig, lazyPlugins } from 'vite-plus';
|
package/docs/guide/upgrade.md
CHANGED
|
@@ -32,48 +32,70 @@ Older versions are pruned automatically after each upgrade. The active version a
|
|
|
32
32
|
|
|
33
33
|
## Local `vite-plus`
|
|
34
34
|
|
|
35
|
-
|
|
35
|
+
The recommended way to upgrade an existing Vite+ project is `vp migrate`:
|
|
36
36
|
|
|
37
37
|
```bash
|
|
38
|
-
vp
|
|
38
|
+
vp migrate
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
-
|
|
41
|
+
On a project that is already on Vite+, migrate does a toolchain version upgrade only: it re-pins `vite-plus`, the `vite` -> `@voidzero-dev/vite-plus-core` alias, and the `vitest` pin to the versions the global `vp` now bundles, across every workspace package. It skips the first-time setup steps (git hooks, editor and agent files, lint migration), so a version bump does not re-touch things you already configured. Pass `--full` to also run that setup.
|
|
42
42
|
|
|
43
|
-
### Updating
|
|
43
|
+
### Updating the Vitest Pin
|
|
44
|
+
|
|
45
|
+
If you migrated with `vp migrate`, your project pins `vitest` to an exact version so the whole project shares a single Vitest copy with the bundled `vp test` runner. The pin lives in your package manager's override block:
|
|
44
46
|
|
|
45
|
-
|
|
47
|
+
- **npm / Bun:** a `vitest` entry under `overrides` in `package.json`
|
|
48
|
+
- **Yarn:** a `vitest` entry under `resolutions` in `package.json`
|
|
49
|
+
- **pnpm:** a `vitest` entry under `overrides` in `pnpm-workspace.yaml` — unless your `package.json` already had a `pnpm` field, in which case it lives under `pnpm.overrides` in `package.json` instead (pnpm ignores `pnpm-workspace.yaml` overrides when `package.json` defines `pnpm.overrides`)
|
|
46
50
|
|
|
47
|
-
|
|
51
|
+
A Vite+ release can bump the bundled Vitest. Because that pin also applies to `vite-plus`'s own `vitest` dependency, an out-of-date pin keeps installing the previous runner even after you upgrade `vite-plus` — splitting Vitest's internals (mocks, `expect`, runner state) between the pinned copy and the one `vp test` loads.
|
|
48
52
|
|
|
49
|
-
|
|
53
|
+
After upgrading `vite-plus`, re-pin `vitest` to the version Vite+ now bundles. Check that version with:
|
|
50
54
|
|
|
51
55
|
```bash
|
|
52
|
-
vp
|
|
56
|
+
vp --version
|
|
53
57
|
```
|
|
54
58
|
|
|
55
|
-
|
|
59
|
+
Then set the `vitest` override to that exact version, or rerun `vp migrate` to update the pin for you.
|
|
60
|
+
|
|
61
|
+
## Preview Builds
|
|
62
|
+
|
|
63
|
+
Some Vite+ pull requests publish temporary packages for testing before an npm release. Treat these as nightly or bleeding-edge builds: they are useful when you want to verify a specific fix, test a fresh upstream dependency bump, or confirm a change before the next release. For day-to-day work, prefer the published `latest` release.
|
|
64
|
+
|
|
65
|
+
Each commit on an eligible pull request is published to [pkg.pr.new](https://pkg.pr.new) and registered with the [registry bridge](https://registry-bridge.viteplus.dev/). The bridge serves these builds as ordinary npm versions of the form `0.0.0-commit.<sha>` and proxies every other package to the npm registry. That means you install a preview with normal version specs instead of mutable URLs, and the same versions resolve in CI.
|
|
66
|
+
|
|
67
|
+
Both `vite-plus` and `@voidzero-dev/vite-plus-core` publish under the same `0.0.0-commit.<sha>` version. Each pull request carries a comment listing the exact version for its latest commit, along with ready-to-copy install steps.
|
|
68
|
+
|
|
69
|
+
You can find preview builds in pull requests that automatically update upstream dependencies. For examples, search the merged pull requests for [upstream dependency updates](https://github.com/voidzero-dev/vite-plus/pulls?q=is%3Apr+is%3Amerged+upgrade+upstream+dependencies).
|
|
70
|
+
|
|
71
|
+
Preview builds are addressed by pull request number or commit SHA. They are not a stable version range, and you should avoid leaving them in long-lived branches unless a maintainer asks you to.
|
|
72
|
+
|
|
73
|
+
### Global `vp` Preview
|
|
74
|
+
|
|
75
|
+
Install a preview build of the global CLI by passing `VP_PR_VERSION` to the installer. Pass a pull request number or a commit SHA:
|
|
56
76
|
|
|
57
77
|
```bash
|
|
58
|
-
|
|
78
|
+
curl -fsSL https://vite.plus | VP_PR_VERSION=<pr-or-sha> bash
|
|
59
79
|
```
|
|
60
80
|
|
|
61
|
-
|
|
81
|
+
On Windows:
|
|
62
82
|
|
|
63
|
-
|
|
83
|
+
```powershell
|
|
84
|
+
$env:VP_PR_VERSION = "<pr-or-sha>"
|
|
85
|
+
irm https://vite.plus/ps1 | iex
|
|
86
|
+
Remove-Item Env:\VP_PR_VERSION
|
|
87
|
+
```
|
|
64
88
|
|
|
65
|
-
|
|
89
|
+
The installer resolves the ref to its `0.0.0-commit.<sha>` build through the registry bridge and installs it like any other version. Run `vp --version` afterward to confirm which build and bundled tool versions are active. When you are done testing, return to the published release with `vp upgrade --force` or by running the installer again without `VP_PR_VERSION`.
|
|
66
90
|
|
|
67
|
-
|
|
68
|
-
- **Yarn:** a `vitest` entry under `resolutions` in `package.json`
|
|
69
|
-
- **pnpm:** a `vitest` entry under `overrides` in `pnpm-workspace.yaml` — unless your `package.json` already had a `pnpm` field, in which case it lives under `pnpm.overrides` in `package.json` instead (pnpm ignores `pnpm-workspace.yaml` overrides when `package.json` defines `pnpm.overrides`)
|
|
70
|
-
|
|
71
|
-
A Vite+ release can bump the bundled Vitest. Because that pin also applies to `vite-plus`'s own `vitest` dependency, an out-of-date pin keeps installing the previous runner even after you upgrade `vite-plus` — splitting Vitest's internals (mocks, `expect`, runner state) between the pinned copy and the one `vp test` loads.
|
|
91
|
+
### Local `vite-plus` Preview
|
|
72
92
|
|
|
73
|
-
After
|
|
93
|
+
After installing the preview global CLI above, run migrate in the project to move its local `vite-plus` onto the same build:
|
|
74
94
|
|
|
75
95
|
```bash
|
|
76
|
-
vp
|
|
96
|
+
vp migrate
|
|
77
97
|
```
|
|
78
98
|
|
|
79
|
-
|
|
99
|
+
Migrate points the project at the bridge registry (writing it to `.npmrc`, or `.yarnrc.yml` for Yarn Berry) and pins `vite-plus` and the `vite` -> `@voidzero-dev/vite-plus-core` alias to the matching `0.0.0-commit.<sha>` version. That registry line is what lets the same versions resolve in the project's own CI, so commit it if you want CI to test the preview too.
|
|
100
|
+
|
|
101
|
+
After installing, check the bundled versions with `vp --version`. When testing is complete, restore the published release: set `vite-plus` back to `latest`, remove the bridge `registry` line from `.npmrc` (or `.yarnrc.yml`), and reinstall with `vp install`.
|
package/docs/package.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plus",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.2",
|
|
4
4
|
"description": "The Unified Toolchain for the Web",
|
|
5
5
|
"homepage": "https://viteplus.dev/guide",
|
|
6
6
|
"bugs": {
|
|
@@ -16,7 +16,8 @@
|
|
|
16
16
|
"bin": {
|
|
17
17
|
"oxfmt": "./bin/oxfmt",
|
|
18
18
|
"oxlint": "./bin/oxlint",
|
|
19
|
-
"vp": "./bin/vp"
|
|
19
|
+
"vp": "./bin/vp",
|
|
20
|
+
"vpr": "./bin/vpr"
|
|
20
21
|
},
|
|
21
22
|
"files": [
|
|
22
23
|
"AGENTS.md",
|
|
@@ -351,7 +352,7 @@
|
|
|
351
352
|
}
|
|
352
353
|
},
|
|
353
354
|
"dependencies": {
|
|
354
|
-
"@oxc-project/types": "=0.
|
|
355
|
+
"@oxc-project/types": "=0.138.0",
|
|
355
356
|
"@oxlint/plugins": "=1.68.0",
|
|
356
357
|
"@vitest/browser": "4.1.9",
|
|
357
358
|
"@vitest/browser-preview": "4.1.9",
|
|
@@ -362,14 +363,14 @@
|
|
|
362
363
|
"@vitest/snapshot": "4.1.9",
|
|
363
364
|
"@vitest/spy": "4.1.9",
|
|
364
365
|
"@vitest/utils": "4.1.9",
|
|
365
|
-
"oxfmt": "=0.
|
|
366
|
-
"oxlint": "=1.
|
|
367
|
-
"oxlint-tsgolint": "=0.
|
|
366
|
+
"oxfmt": "=0.57.0",
|
|
367
|
+
"oxlint": "=1.72.0",
|
|
368
|
+
"oxlint-tsgolint": "=0.24.0",
|
|
368
369
|
"vitest": "4.1.9",
|
|
369
|
-
"@voidzero-dev/vite-plus-core": "0.2.
|
|
370
|
+
"@voidzero-dev/vite-plus-core": "0.2.2"
|
|
370
371
|
},
|
|
371
372
|
"devDependencies": {
|
|
372
|
-
"@napi-rs/cli": "^3.7.
|
|
373
|
+
"@napi-rs/cli": "^3.7.2",
|
|
373
374
|
"@nkzw/safe-word-list": "^3.1.0",
|
|
374
375
|
"@oxc-node/core": "^0.1.0",
|
|
375
376
|
"@types/cross-spawn": "^6.0.6",
|
|
@@ -389,15 +390,15 @@
|
|
|
389
390
|
"mri": "^1.2.0",
|
|
390
391
|
"nanotar": "^0.3.0",
|
|
391
392
|
"picocolors": "^1.1.1",
|
|
392
|
-
"rolldown-plugin-dts": "^0.
|
|
393
|
+
"rolldown-plugin-dts": "^0.26.0",
|
|
393
394
|
"semver": "^7.8.0",
|
|
394
395
|
"tsdown": "^0.22.3",
|
|
395
396
|
"validate-npm-package-name": "^7.0.2",
|
|
396
397
|
"yaml": "^2.8.1",
|
|
397
398
|
"zod": "^3.25.76",
|
|
398
|
-
"@voidzero-dev/vite-plus-prompts": "0.0.0",
|
|
399
399
|
"@voidzero-dev/vite-plus-tools": "0.0.0",
|
|
400
|
-
"
|
|
400
|
+
"@voidzero-dev/vite-plus-prompts": "0.0.0",
|
|
401
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.2.2"
|
|
401
402
|
},
|
|
402
403
|
"peerDependencies": {
|
|
403
404
|
"@vitest/browser-playwright": "4.1.9",
|
|
@@ -426,17 +427,17 @@
|
|
|
426
427
|
]
|
|
427
428
|
},
|
|
428
429
|
"engines": {
|
|
429
|
-
"node": "^22.18.0 || >=24.11.0"
|
|
430
|
+
"node": "^20.19.0 || ^22.18.0 || >=24.11.0"
|
|
430
431
|
},
|
|
431
432
|
"optionalDependencies": {
|
|
432
|
-
"@voidzero-dev/vite-plus-darwin-arm64": "0.2.
|
|
433
|
-
"@voidzero-dev/vite-plus-darwin-x64": "0.2.
|
|
434
|
-
"@voidzero-dev/vite-plus-linux-arm64-gnu": "0.2.
|
|
435
|
-
"@voidzero-dev/vite-plus-linux-arm64-musl": "0.2.
|
|
436
|
-
"@voidzero-dev/vite-plus-linux-x64-gnu": "0.2.
|
|
437
|
-
"@voidzero-dev/vite-plus-linux-x64-musl": "0.2.
|
|
438
|
-
"@voidzero-dev/vite-plus-win32-x64-msvc": "0.2.
|
|
439
|
-
"@voidzero-dev/vite-plus-win32-arm64-msvc": "0.2.
|
|
433
|
+
"@voidzero-dev/vite-plus-darwin-arm64": "0.2.2",
|
|
434
|
+
"@voidzero-dev/vite-plus-darwin-x64": "0.2.2",
|
|
435
|
+
"@voidzero-dev/vite-plus-linux-arm64-gnu": "0.2.2",
|
|
436
|
+
"@voidzero-dev/vite-plus-linux-arm64-musl": "0.2.2",
|
|
437
|
+
"@voidzero-dev/vite-plus-linux-x64-gnu": "0.2.2",
|
|
438
|
+
"@voidzero-dev/vite-plus-linux-x64-musl": "0.2.2",
|
|
439
|
+
"@voidzero-dev/vite-plus-win32-x64-msvc": "0.2.2",
|
|
440
|
+
"@voidzero-dev/vite-plus-win32-arm64-msvc": "0.2.2"
|
|
440
441
|
},
|
|
441
442
|
"scripts": {
|
|
442
443
|
"build": "oxnode -C dev ./build.ts",
|