vite-plus 0.3.0 → 0.3.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/LICENSE +29 -29
- package/README.md +3 -3
- package/bin/vp +1 -1
- package/binding/index.cjs +60 -56
- package/binding/index.d.cts +137 -14
- package/dist/{agent-Wqx0MPk0.js → agent-C59HKB4Y.js} +3 -2
- package/dist/bin.js +90 -58
- package/dist/cli-parse-DHE8NrBU.js +13 -0
- package/dist/client/bundledDevClient.mjs +1 -1
- package/dist/client/client.mjs +1 -1
- package/dist/client/env.mjs +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/config/bin.js +83 -55
- package/dist/{constants-Bn-U8o4v.js → constants-IhOditRA.js} +3 -3
- package/dist/create/bin.d.ts +13 -5
- package/dist/create/bin.js +50 -193
- package/dist/{define-config-GXUdVT-0.js → define-config-DAaCa0U_.js} +2 -2
- package/dist/{define-config-DWoAkNdp.d.ts → define-config-DPNEJxPz.d.ts} +5 -9
- package/dist/{define-config-WiVlryJ2.cjs → define-config-DpAPETDf.cjs} +1 -1
- 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-DfmT__Aw.js +619 -0
- package/dist/{editor-CC4DqODz.js → editor-QOIGtmH4.js} +205 -70
- package/dist/hooks/bin.js +9 -114
- package/dist/{hooks-DFqViZqZ.js → hooks-C-4gykWR.js} +1 -1
- package/dist/index.cjs +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/internal.d.ts +1 -1
- package/dist/internal.js +1 -1
- package/dist/lint-plugins-dev.d.ts +3 -0
- package/dist/lint-plugins-dev.js +2 -0
- package/dist/lint-plugins.cjs +21 -0
- package/dist/lint-plugins.d.ts +3 -0
- package/dist/lint-plugins.js +2 -0
- package/dist/migration/bin.js +25 -144
- package/dist/migration/compat/worker.js +1 -1
- package/dist/module-runner.d.ts +1 -1
- package/dist/module-runner.js +1 -1
- package/dist/{oxlint-plugin-config-DX5ezKbB.js → oxlint-plugin-config-BU42tr8y.js} +1 -1
- package/dist/oxlint-plugin.d.ts +2 -2
- package/dist/oxlint-plugin.js +93 -32
- package/dist/{pack-PvUg_xpv.d.ts → pack-BK38MLVZ.d.ts} +1 -1
- package/dist/pack-bin.d.ts +2 -3
- package/dist/pack-bin.js +5 -622
- package/dist/pack-client.d.ts +1 -1
- package/dist/pack.d.ts +2 -2
- package/dist/pack.js +1 -1
- package/dist/{package-CBe9EWPY.js → package-BB-Jh_z3.js} +1 -1
- package/dist/{prompts-DF3yU-eU.js → prompts-CujFOJXu.js} +3 -1400
- package/dist/{report-ZNR1Mk6h.js → report-CK5TnTsr.js} +1 -0
- package/dist/resolve-vite-config-6Nox70uP.js +2 -0
- package/dist/{resolve-vite-config-ipGb39Jo.js → resolve-vite-config-CHHjsjKJ.js} +3 -3
- package/dist/semver-CaDAb8vV.js +1400 -0
- package/dist/staged/bin.js +83 -218
- package/dist/sync-versions/bin.d.ts +1 -0
- package/dist/sync-versions/bin.js +3884 -0
- package/dist/sync-versions/bin.mjs +13323 -0
- package/dist/toolchain.js +10 -10
- package/dist/toolchain.json +10 -10
- package/dist/{tsconfig-LD2QhQ0O.js → tsconfig-DCtWfQPA.js} +2 -2
- package/dist/{tsconfig-BVHG3DpR.js → tsconfig-MXktI3SX.js} +1 -1
- package/dist/tsgolint-path.d.ts +3 -4
- package/dist/types/customEvent.d.ts +1 -1
- package/dist/types/hmrPayload.d.ts +1 -1
- package/dist/types/hot.d.ts +1 -1
- package/dist/types/import-meta.d.ts +1 -1
- package/dist/types/importGlob.d.ts +1 -1
- package/dist/types/importMeta.d.ts +1 -1
- package/dist/types/metadata.d.ts +1 -1
- package/dist/version.d.ts +2 -3
- package/dist/version.js +2 -2
- package/dist/versions.js +5 -5
- package/dist/vitest-ecosystem-BiRqcaRI.js +23 -0
- package/docs/config/fmt.md +4 -2
- package/docs/config/lint.md +4 -2
- package/docs/guide/check.md +1 -0
- package/docs/guide/ci.md +42 -2
- package/docs/guide/env.md +148 -52
- package/docs/guide/fmt.md +3 -1
- package/docs/guide/ide-integration.md +14 -2
- package/docs/guide/index.md +1 -1
- package/docs/guide/install.md +4 -1
- package/docs/guide/installer-env-vars.md +45 -1
- package/docs/guide/lint.md +58 -1
- package/docs/guide/migrate-rules.md +95 -2
- package/docs/guide/migrate.md +1 -1
- package/docs/guide/monorepo.md +2 -0
- package/docs/guide/troubleshooting.md +14 -0
- package/package.json +27 -20
- package/templates/generator/README.md +14 -0
- package/templates/generator/bin/index.ts +54 -5
- package/dist/lib-L3DWSRQp.js +0 -75
- package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
package/docs/guide/env.md
CHANGED
|
@@ -1,10 +1,23 @@
|
|
|
1
1
|
# Environment
|
|
2
2
|
|
|
3
|
-
`vp env` manages Node.js
|
|
3
|
+
`vp env` manages the complete JavaScript environment: one Node.js runtime and one selected package manager. npm, pnpm, Yarn, and Bun are peer package-manager families.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
Managed mode is on by default, so
|
|
7
|
+
Managed mode is on by default, so Node.js and configured package-manager shims resolve through Vite+ and pick the right versions for the current project. Fresh installers record managed mode for npm, pnpm, Yarn, and Bun after the user enables environment management.
|
|
8
|
+
|
|
9
|
+
When an upgrade adds a package-manager shim that has no recorded mode, its first interactive invocation asks what to do only when the corresponding system binary is already on PATH. The current family defaults to managed mode; choosing a system tool or applying a choice to every family remains explicit. Non-interactive invocations use managed mode without recording a choice.
|
|
10
|
+
|
|
11
|
+
Most commands operate on both components when no selector is given. Add `node`, `pm`, `npm`, `pnpm`, `yarn`, or `bun` to narrow the command. `pm` means all four families for listing and cleanup, but the single selected package manager for project operations.
|
|
12
|
+
|
|
13
|
+
Unqualified versions remain Node.js versions for compatibility:
|
|
14
|
+
|
|
15
|
+
```bash
|
|
16
|
+
vp env pin 22.0.0 # Node.js only
|
|
17
|
+
vp env pin pnpm@10.18.0 # pnpm only
|
|
18
|
+
vp env pin node@24 pnpm@12 # Both components
|
|
19
|
+
vp env pin 22.0.0 pnpm@10.18.0 # Also both components
|
|
20
|
+
```
|
|
8
21
|
|
|
9
22
|
Vite+ checks the current directory first, then walks up through its parents. The nearest directory
|
|
10
23
|
with a supported declaration wins. Within each directory, sources are checked in this order:
|
|
@@ -19,7 +32,51 @@ latest LTS.
|
|
|
19
32
|
|
|
20
33
|
`devEngines.runtime` ranks above `engines.node` because it declares the development-environment requirement, while `engines.node` is a consumer-facing support range. `vp env doctor` warns when declared sources conflict.
|
|
21
34
|
|
|
22
|
-
|
|
35
|
+
::: tip Using pnpm with Vite+ runtime management
|
|
36
|
+
pnpm can also manage the runtime declared in `devEngines.runtime`. When both pnpm and Vite+ manage Node.js, they can download the same version separately or select different versions, causing inconsistent behavior between commands.
|
|
37
|
+
|
|
38
|
+
If you want Vite+ to manage Node.js, pnpm 11+ supports disabling pnpm's automatic runtime management globally with [`runtimeOnFail`](https://pnpm.io/settings/cli#runtimeonfail):
|
|
39
|
+
|
|
40
|
+
```bash
|
|
41
|
+
pnpm config set --global runtimeOnFail ignore
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
This setting also disables pnpm's automatic management of other declared runtimes, including Bun and Deno. Consider whether any of your projects rely on that behavior before setting it globally.
|
|
45
|
+
:::
|
|
46
|
+
|
|
47
|
+
Package-manager selection uses this priority:
|
|
48
|
+
|
|
49
|
+
1. Explicit command override
|
|
50
|
+
2. `VP_PACKAGE_MANAGER`
|
|
51
|
+
3. Top-level `packageManager`
|
|
52
|
+
4. `devEngines.packageManager`
|
|
53
|
+
5. Lockfile or manager-specific configuration
|
|
54
|
+
6. The named package manager's global default version
|
|
55
|
+
7. The named shim's latest release
|
|
56
|
+
|
|
57
|
+
`VP_PACKAGE_MANAGER` selects the manager and version for commands such as `vp install`. Direct package-manager shims ignore this variable and use independent version overrides:
|
|
58
|
+
|
|
59
|
+
| Variable | Shims |
|
|
60
|
+
| ----------------- | ----------------- |
|
|
61
|
+
| `VP_NPM_VERSION` | `npm`, `npx` |
|
|
62
|
+
| `VP_PNPM_VERSION` | `pnpm`, `pnpx` |
|
|
63
|
+
| `VP_YARN_VERSION` | `yarn`, `yarnpkg` |
|
|
64
|
+
| `VP_BUN_VERSION` | `bun`, `bunx` |
|
|
65
|
+
|
|
66
|
+
These variables accept a version or range, such as `10.18.0`, `10`, or `latest`, and override the matching shim's project and default versions. They do not change the manager or version selected by `vp install`.
|
|
67
|
+
|
|
68
|
+
`vp env use pnpm@10.20.0` sets `VP_PNPM_VERSION` for the current shell, just as `vp env use node@22` sets `VP_NODE_VERSION`. Each package manager has its own override, so switching Yarn does not clear a pnpm override. `vp env use` does not set or clear `VP_PACKAGE_MANAGER`.
|
|
69
|
+
|
|
70
|
+
Direct shims resolve their version from the matching environment variable, then the matching session file when no shell wrapper is available, then project configuration and the family default. `vp env current pnpm` and `vp env which pnpm` inspect this shim selection; `vp env current pm` reports the manager selected for vp commands.
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
VP_PACKAGE_MANAGER=pnpm@10.18.0 vp install
|
|
74
|
+
VP_PNPM_VERSION=10.20.0 pnpm --version
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
The overrides apply in managed mode. A package manager can also perform its own version switching after Vite+ launches it; for example, pnpm's `managePackageManagerVersions` setting may switch back to the version in `package.json`.
|
|
78
|
+
|
|
79
|
+
A project selection applies only to its matching shims. For example, pnpm controls `pnpm` and `pnpx`; invoking `npm` still resolves npm independently. Without a matching project selection, a named shim uses its configured default version and otherwise uses the latest release without prompting. The resolved version is cached for one hour and an expired cache remains available when the registry cannot be reached. The directly invoked npm shim keeps its Node-bundled fallback, while an explicit `vp env ... npm` family scope uses standalone npm's latest release.
|
|
23
80
|
|
|
24
81
|
A fresh install uses the split platform layout by default. On Unix, Vite+
|
|
25
82
|
stores managed runtimes and related files in `~/.local/share/vite-plus`. It
|
|
@@ -34,7 +91,14 @@ If you want to keep that behavior, run:
|
|
|
34
91
|
vp env on
|
|
35
92
|
```
|
|
36
93
|
|
|
37
|
-
This enables managed mode
|
|
94
|
+
This enables managed mode for both components. Their modes can also be changed independently, including one package-manager family:
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
vp env on node
|
|
98
|
+
vp env off pm
|
|
99
|
+
vp env off pnpm
|
|
100
|
+
vp env on bun
|
|
101
|
+
```
|
|
38
102
|
|
|
39
103
|
If you do not want Vite+ to manage Node.js first, run:
|
|
40
104
|
|
|
@@ -42,16 +106,17 @@ If you do not want Vite+ to manage Node.js first, run:
|
|
|
42
106
|
vp env off
|
|
43
107
|
```
|
|
44
108
|
|
|
45
|
-
This switches to system-first mode
|
|
109
|
+
This switches both components to system-first mode. Vite+ prefers system tools and falls back to managed installations. Mixed configurations compose: a system package-manager launcher receives the Node.js selected by the Node mode.
|
|
110
|
+
|
|
111
|
+
Using `pm` records the selected mode for all currently supported package managers and replaces their individual choices. An unscoped `on` or `off` does the same while also changing Node.js. A family without a recorded mode remains undecided until its shim is first used or an `on` / `off` command configures it.
|
|
46
112
|
|
|
47
113
|
## Commands
|
|
48
114
|
|
|
49
115
|
### Setup
|
|
50
116
|
|
|
51
|
-
- `vp env setup` creates or updates shims in the resolved bin directory. It writes shell setup scripts in the config directory.
|
|
52
|
-
- `vp env on`
|
|
53
|
-
- `vp env
|
|
54
|
-
- `vp env print` prints the shell snippet for the current session
|
|
117
|
+
- `vp env setup` creates or updates the `node`, `npm`, `npx`, `pnpm`, `pnpx`, `yarn`, `yarnpkg`, `bun`, `bunx`, `vpx`, and `vpr` shims in the resolved bin directory. It writes shell setup scripts in the config directory.
|
|
118
|
+
- `vp env on` / `vp env off` changes both modes; append `node`, `pm`, `npm`, `pnpm`, `yarn`, or `bun` to narrow the change
|
|
119
|
+
- `vp env print` prints PATH setup for both components; append a selector to print one
|
|
55
120
|
|
|
56
121
|
PowerShell needs to dot-source the generated setup script in the current shell before `vp env use` can affect only that shell session:
|
|
57
122
|
|
|
@@ -87,28 +152,29 @@ vp-use --unset
|
|
|
87
152
|
Only `vp env use` needs this alternate command. Other `vp env` commands work normally in Command Prompt. `vp env setup` creates `vp-use.cmd` in the bin directory on Windows.
|
|
88
153
|
|
|
89
154
|
In CI, `vp env use` can run without shell initialization. It writes a temporary
|
|
90
|
-
session file
|
|
91
|
-
|
|
155
|
+
session file per runtime or package manager in the resolved state directory,
|
|
156
|
+
such as `.session-node-version` or `.session-pnpm-version`. Later
|
|
157
|
+
shim calls in the same job use these files to resolve the same environment.
|
|
92
158
|
|
|
93
159
|
### Manage
|
|
94
160
|
|
|
95
|
-
- `vp env default`
|
|
96
|
-
- `vp env pin`
|
|
97
|
-
- `vp env unpin` removes
|
|
98
|
-
- `vp env use`
|
|
99
|
-
- `vp env install` installs a
|
|
100
|
-
- `vp env uninstall` removes
|
|
101
|
-
- `vp env clean` removes unused
|
|
102
|
-
- `vp env exec` runs a command
|
|
103
|
-
- `vp node`
|
|
161
|
+
- `vp env default` shows the global Node.js default and each configured package-manager version. Bare versions set Node.js; qualified specs such as `pnpm@10.18.0` set that package manager's shim default without replacing the defaults for Bun, Yarn, or npm. `--unset` clears all defaults unless scoped.
|
|
162
|
+
- `vp env pin` shows or writes project pins. Existing `.node-version` and top-level `packageManager` fields keep being updated for compatibility. An existing `.nvmrc` is updated when it is the effective Node source in the current directory; its comments and other non-version content are preserved. Otherwise Vite+ writes the matching `devEngines` entry. Use `--target node-version`, `--target nvmrc`, `--target dev-engines`, or `--target package-manager` to choose explicitly. Pinning in a child directory does not modify an inherited `.nvmrc`.
|
|
163
|
+
- `vp env unpin` removes both effective pins by default; append a selector to remove one. Lower-priority declarations are not deleted.
|
|
164
|
+
- `vp env use` activates the complete project environment. Explicit specs override selected components; `--unset` clears both unless scoped.
|
|
165
|
+
- `vp env install` installs the complete resolved environment, a selected component, or explicit specs.
|
|
166
|
+
- `vp env uninstall` removes explicit exact Node.js or qualified package-manager versions.
|
|
167
|
+
- `vp env clean` removes unused installs. Use `clean node`, `clean pm`, or a concrete manager. Current and configured-default versions are preserved.
|
|
168
|
+
- `vp env exec` runs a command in the resolved environment. Use `--node` and `--package-manager`; `--npm` is an alias for `--package-manager npm@…`.
|
|
169
|
+
- `vp node` uses the resolved Node.js runtime and exposes the selected package-manager path to child processes.
|
|
104
170
|
|
|
105
171
|
### Inspect
|
|
106
172
|
|
|
107
173
|
- `vp env current` shows the current resolved environment
|
|
108
174
|
- `vp env doctor` runs environment diagnostics
|
|
109
175
|
- `vp env which` shows which tool path will be used
|
|
110
|
-
- `vp env list` shows
|
|
111
|
-
- `vp env list-remote`
|
|
176
|
+
- `vp env list` shows separate Node.js, npm, pnpm, Yarn, and Bun sections; selectors narrow output
|
|
177
|
+
- `vp env list-remote` fetches Node.js and all four PM registries concurrently; selectors narrow network work. `--lts` implicitly selects Node.js.
|
|
112
178
|
|
|
113
179
|
## Project Setup
|
|
114
180
|
|
|
@@ -120,54 +186,84 @@ use this file to select the Node.js version.
|
|
|
120
186
|
|
|
121
187
|
```bash
|
|
122
188
|
# Setup
|
|
123
|
-
vp env setup # Create
|
|
124
|
-
vp env on #
|
|
125
|
-
vp env
|
|
189
|
+
vp env setup # Create Node.js and package-manager shims
|
|
190
|
+
vp env on # Manage Node.js and package managers
|
|
191
|
+
vp env off pm # Prefer system package managers only
|
|
192
|
+
vp env off pnpm # Prefer system pnpm only
|
|
193
|
+
vp env print # Print PATH setup for both components
|
|
126
194
|
|
|
127
195
|
# Manage
|
|
128
|
-
vp env pin lts
|
|
129
|
-
vp env install # Install the
|
|
130
|
-
vp env default
|
|
131
|
-
vp env
|
|
132
|
-
vp env use
|
|
133
|
-
vp env
|
|
196
|
+
vp env pin lts pnpm@10 # Pin both project components to exact versions
|
|
197
|
+
vp env install # Install the complete resolved environment
|
|
198
|
+
vp env default node@24 # Set the global Node.js default
|
|
199
|
+
vp env default pnpm@10 # Set pnpm's global default version
|
|
200
|
+
vp env use 20 pnpm@10 # Override both components for this shell
|
|
201
|
+
vp env use --unset pnpm # Remove only the pnpm session version
|
|
202
|
+
vp env use --unset pm # Remove all package-manager session versions
|
|
203
|
+
vp env clean # Remove unused managed Node.js and package manager versions
|
|
134
204
|
|
|
135
205
|
# Inspect
|
|
136
206
|
vp env current # Show current resolved environment
|
|
137
207
|
vp env current --json # JSON output for automation
|
|
138
208
|
vp env which node # Show which node binary will be used
|
|
139
209
|
vp env which npx # Show pinned package-manager alias when packageManager matches
|
|
140
|
-
vp env list
|
|
210
|
+
vp env list # Show every locally installed component
|
|
211
|
+
vp env list node # Show only Node.js installations
|
|
212
|
+
vp env list-remote --lts # List only Node.js LTS versions
|
|
141
213
|
|
|
142
214
|
# Execute
|
|
143
|
-
vp env exec --node lts
|
|
215
|
+
vp env exec --node lts --package-manager pnpm@10 pnpm install
|
|
144
216
|
vp env exec node -v # Use shim mode with automatic version resolution
|
|
145
217
|
vp node script.js # Shorthand: run a Node.js script with the resolved version
|
|
146
218
|
vp node -e "console.log(1+1)" # Shorthand: forward any node flag or argument
|
|
147
219
|
```
|
|
148
220
|
|
|
149
|
-
##
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
221
|
+
## JSON output
|
|
222
|
+
|
|
223
|
+
The JSON output for `current`, `list`, and `list-remote` is organized by component. `current --json` returns sibling `node` and `package_manager` objects:
|
|
224
|
+
|
|
225
|
+
```json
|
|
226
|
+
{
|
|
227
|
+
"node": {
|
|
228
|
+
"version": "22.0.0",
|
|
229
|
+
"source": "devEngines.runtime",
|
|
230
|
+
"source_path": "/project/package.json",
|
|
231
|
+
"project_root": "/project",
|
|
232
|
+
"bin_path": "/home/.vite-plus/js_runtime/node/22.0.0/bin/node",
|
|
233
|
+
"installed": true,
|
|
234
|
+
"mode": "managed"
|
|
235
|
+
},
|
|
236
|
+
"package_manager": {
|
|
237
|
+
"name": "pnpm",
|
|
238
|
+
"version": "10.18.0",
|
|
239
|
+
"source": "packageManager",
|
|
240
|
+
"source_path": "/project/package.json",
|
|
241
|
+
"project_root": "/project",
|
|
242
|
+
"bin_paths": {
|
|
243
|
+
"pnpm": "/home/.vite-plus/package_manager/pnpm/10.18.0/pnpm/bin/pnpm",
|
|
244
|
+
"pnpx": "/home/.vite-plus/package_manager/pnpm/10.18.0/pnpm/bin/pnpx"
|
|
245
|
+
},
|
|
246
|
+
"installed": true,
|
|
247
|
+
"mode": "managed"
|
|
248
|
+
}
|
|
249
|
+
}
|
|
166
250
|
```
|
|
167
251
|
|
|
168
|
-
|
|
252
|
+
`list --json` and `list-remote --json` group the component arrays:
|
|
253
|
+
|
|
254
|
+
```json
|
|
255
|
+
{
|
|
256
|
+
"node": [],
|
|
257
|
+
"package_managers": {
|
|
258
|
+
"npm": [],
|
|
259
|
+
"pnpm": [],
|
|
260
|
+
"yarn": [],
|
|
261
|
+
"bun": []
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
```
|
|
169
265
|
|
|
170
|
-
|
|
266
|
+
Selectors omit unselected top-level fields or PM families. Registry listing is all-or-error: Vite+ prints no partial human or JSON result when any selected registry request fails.
|
|
171
267
|
|
|
172
268
|
## Custom Node.js Mirror
|
|
173
269
|
|
package/docs/guide/fmt.md
CHANGED
|
@@ -18,7 +18,9 @@ vp fmt . --write
|
|
|
18
18
|
|
|
19
19
|
## Configuration
|
|
20
20
|
|
|
21
|
-
Put formatting configuration directly in the `fmt` block in `vite.config.ts` so all your configuration stays in one place. We do not recommend using `.oxfmtrc.json` with Vite+.
|
|
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
|
+
|
|
23
|
+
Vite+ does not currently support nested format configuration. For now, use [`fmt.overrides`](/guide/monorepo#format-overrides) in the root `vite.config.ts` for file- or package-specific options. The long-term behavior is open for discussion; [share your use case and expectations](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) to help shape it.
|
|
22
24
|
|
|
23
25
|
For editors, disable nested formatter configs so format-on-save uses the root Vite+ `fmt` block:
|
|
24
26
|
|
|
@@ -82,14 +82,26 @@ You can also manually set up the Zed config:
|
|
|
82
82
|
"JavaScript": {
|
|
83
83
|
"format_on_save": "on",
|
|
84
84
|
"prettier": { "allowed": false },
|
|
85
|
-
"formatter": [
|
|
86
|
-
|
|
85
|
+
"formatter": [
|
|
86
|
+
{ "language_server": { "name": "oxfmt" } },
|
|
87
|
+
{ "code_action": "source.fixAll.oxc" }
|
|
88
|
+
]
|
|
89
|
+
},
|
|
90
|
+
"JSX": {
|
|
91
|
+
"format_on_save": "on",
|
|
92
|
+
"prettier": { "allowed": false },
|
|
93
|
+
"formatter": [{ "language_server": { "name": "oxfmt" } }]
|
|
87
94
|
},
|
|
88
95
|
"TypeScript": {
|
|
89
96
|
"format_on_save": "on",
|
|
90
97
|
"prettier": { "allowed": false },
|
|
91
98
|
"formatter": [{ "language_server": { "name": "oxfmt" } }]
|
|
92
99
|
},
|
|
100
|
+
"TSX": {
|
|
101
|
+
"format_on_save": "on",
|
|
102
|
+
"prettier": { "allowed": false },
|
|
103
|
+
"formatter": [{ "language_server": { "name": "oxfmt" } }]
|
|
104
|
+
},
|
|
93
105
|
"Vue.js": {
|
|
94
106
|
"format_on_save": "on",
|
|
95
107
|
"prettier": { "allowed": false },
|
package/docs/guide/index.md
CHANGED
|
@@ -96,7 +96,7 @@ Vite+ can handle the entire local frontend development cycle from starting a pro
|
|
|
96
96
|
- [`vp hooks`](/guide/commit-hooks) manages the Git hook dispatcher (`enable`, `disable`, `status`).
|
|
97
97
|
- [`vp staged`](/guide/commit-hooks) runs checks on staged files.
|
|
98
98
|
- [`vp install`](/guide/install) installs dependencies with the right package manager.
|
|
99
|
-
- [`vp env`](/guide/env) manages Node.js
|
|
99
|
+
- [`vp env`](/guide/env) manages Node.js and package-manager environments.
|
|
100
100
|
|
|
101
101
|
### Develop
|
|
102
102
|
|
package/docs/guide/install.md
CHANGED
|
@@ -19,7 +19,9 @@ Vite+ detects the package manager from the workspace root in this order:
|
|
|
19
19
|
9. `bunfig.toml`
|
|
20
20
|
10. `yarn.config.cjs`
|
|
21
21
|
|
|
22
|
-
If none of those files are present, `vp` falls back to `pnpm` by default. Vite+ automatically downloads the matching package manager and uses it for the command you ran
|
|
22
|
+
If none of those files are present, `vp` falls back to `pnpm` by default. Vite+ automatically downloads the matching package manager and uses it for the command you ran, but package-manager detection never rewrites `package.json`. Use `vp env pin <package-manager>@<version>` when the project should declare an exact version explicitly.
|
|
23
|
+
|
|
24
|
+
After selecting the package manager, Vite+ forwards the command without separately validating whether `package.json` exists. Missing-manifest behavior therefore matches the selected package manager.
|
|
23
25
|
|
|
24
26
|
The [`devEngines.packageManager`](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#devengines) field accepts a single object or an array of objects, and its `version` may be a semver range:
|
|
25
27
|
|
|
@@ -138,6 +140,7 @@ Use `vp add` and `vp remove` for day-to-day dependency edits instead of editing
|
|
|
138
140
|
- `vp add -D typescript vitest`
|
|
139
141
|
- `vp add -O fsevents`
|
|
140
142
|
- `vp add --save-peer react`
|
|
143
|
+
- `vp add react --ignore-scripts`
|
|
141
144
|
- `vp remove react`
|
|
142
145
|
- `vp remove --filter web react`
|
|
143
146
|
|
|
@@ -81,7 +81,7 @@ These variables control the installer scripts and the standalone Windows install
|
|
|
81
81
|
|
|
82
82
|
### `VP_NODE_MANAGER`
|
|
83
83
|
|
|
84
|
-
- **Purpose**: Control Node.js version manager setup during installation
|
|
84
|
+
- **Purpose**: Control Node.js version manager setup during installation.
|
|
85
85
|
- **Values**: `yes` or `no`
|
|
86
86
|
- **Default**: Auto-detected
|
|
87
87
|
- **CLI equivalent**: `--no-node-manager` (inverted)
|
|
@@ -91,6 +91,40 @@ These variables control the installer scripts and the standalone Windows install
|
|
|
91
91
|
curl -fsSL https://vite.plus | VP_NODE_MANAGER=no bash
|
|
92
92
|
```
|
|
93
93
|
|
|
94
|
+
### `VP_PM_MANAGER`
|
|
95
|
+
|
|
96
|
+
- **Purpose**: Set the management preference for all four package-manager
|
|
97
|
+
families: npm, pnpm, Yarn, and Bun.
|
|
98
|
+
- **Values**: `yes` uses Vite+ management; `no` prefers system tools, with
|
|
99
|
+
managed tools as a fallback when a system tool is unavailable.
|
|
100
|
+
- **Default**: Unset. The installer's combined Node.js and package-manager
|
|
101
|
+
choice remains the default. With the script installers, setting only
|
|
102
|
+
`VP_NODE_MANAGER` preserves existing package-manager preferences.
|
|
103
|
+
|
|
104
|
+
### `VP_NPM_MANAGER` / `VP_PNPM_MANAGER` / `VP_YARN_MANAGER` / `VP_BUN_MANAGER`
|
|
105
|
+
|
|
106
|
+
- **Purpose**: Set the management preference for an individual package-manager
|
|
107
|
+
family. Each variable overrides `VP_PM_MANAGER` for that family.
|
|
108
|
+
- **Values**: `yes` or `no`, with the same meaning as `VP_PM_MANAGER`.
|
|
109
|
+
- **Default**: Unset (use `VP_PM_MANAGER`, then the combined installer choice,
|
|
110
|
+
or preserve the existing preference).
|
|
111
|
+
- **Example**:
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# Keep system Node.js and package managers, but let Vite+ manage pnpm.
|
|
115
|
+
curl -fsSL https://vite.plus | VP_NODE_MANAGER=no VP_PM_MANAGER=no VP_PNPM_MANAGER=yes bash
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
These management variables are installation choices, saved in Vite+'s config.
|
|
119
|
+
The interactive prompt still controls both Node.js and package managers;
|
|
120
|
+
explicit package-manager variables override that combined choice. The standalone
|
|
121
|
+
`vp-setup` installer uses its existing combined option as the default for both
|
|
122
|
+
variables, in interactive and silent installations alike.
|
|
123
|
+
In-place upgrades preserve the saved choices. Unrecognized values are ignored.
|
|
124
|
+
They select management behavior, not package-manager versions, and do not
|
|
125
|
+
prevent the installer from creating shims. Older releases installed through
|
|
126
|
+
the legacy installer retain their original behavior.
|
|
127
|
+
|
|
94
128
|
### `VP_PR_VERSION`
|
|
95
129
|
|
|
96
130
|
- **Purpose**: Install a preview build from a pull request or commit SHA
|
|
@@ -127,6 +161,16 @@ These variables configure the installed Vite+ CLI. `VP_HOME` (above) also applie
|
|
|
127
161
|
VP_NODE_VERSION=22 vp env exec node -v
|
|
128
162
|
```
|
|
129
163
|
|
|
164
|
+
### `VP_PACKAGE_MANAGER`
|
|
165
|
+
|
|
166
|
+
- **Purpose**: Override the selected package manager and version
|
|
167
|
+
- **Default**: None (resolved from the project or global default)
|
|
168
|
+
- **Format**: `npm|pnpm|yarn|bun@<version>`
|
|
169
|
+
- **Example**:
|
|
170
|
+
```bash
|
|
171
|
+
VP_PACKAGE_MANAGER=pnpm@10.18.0 vp install
|
|
172
|
+
```
|
|
173
|
+
|
|
130
174
|
### `VP_NODE_SKIP_SIGNATURE_VERIFY`
|
|
131
175
|
|
|
132
176
|
- **Purpose**: Skip PGP signature verification of Node.js downloads
|
package/docs/guide/lint.md
CHANGED
|
@@ -18,7 +18,9 @@ vp lint --type-aware
|
|
|
18
18
|
|
|
19
19
|
## Configuration
|
|
20
20
|
|
|
21
|
-
Put lint configuration directly in the `lint` block in `vite.config.ts` so all your configuration stays in one place. We do not recommend using `oxlint.config.ts` or `.oxlintrc.json` with Vite+.
|
|
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
|
+
|
|
23
|
+
Vite+ does not currently support nested lint configuration. For now, use [`lint.overrides`](/guide/monorepo#root-config-with-overrides) in the root `vite.config.ts` for file- or package-specific rules. The long-term behavior is open for discussion; [share your use case and expectations](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) to help shape it.
|
|
22
24
|
|
|
23
25
|
For the upstream rule set, options, and compatibility details, see the [Oxlint docs](https://oxc.rs/docs/guide/usage/linter.html).
|
|
24
26
|
|
|
@@ -50,3 +52,58 @@ This path is powered by [tsgolint](https://github.com/oxc-project/tsgolint) on t
|
|
|
50
52
|
If you are migrating from ESLint and still depend on a few critical JavaScript-based ESLint plugins, Oxlint has [JS plugin support](https://oxc.rs/docs/guide/usage/linter/js-plugins) that can help you keep those plugins running while you complete the migration.
|
|
51
53
|
|
|
52
54
|
JS Plugins also enable [writing your own custom rules](https://oxc.rs/docs/guide/usage/linter/writing-js-plugins.html) for Oxlint.
|
|
55
|
+
|
|
56
|
+
### Writing Your Own Rules
|
|
57
|
+
|
|
58
|
+
Import the plugin authoring API from `vite-plus/lint/plugins`:
|
|
59
|
+
|
|
60
|
+
```js [lint/my-plugin.js]
|
|
61
|
+
import { definePlugin, defineRule } from 'vite-plus/lint/plugins';
|
|
62
|
+
|
|
63
|
+
const noFoo = defineRule({
|
|
64
|
+
meta: { messages: { noFoo: 'Do not name things "foo".' } },
|
|
65
|
+
create(context) {
|
|
66
|
+
return {
|
|
67
|
+
Identifier(node) {
|
|
68
|
+
if (node.name === 'foo') {
|
|
69
|
+
context.report({ node, messageId: 'noFoo' });
|
|
70
|
+
}
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
},
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
export default definePlugin({
|
|
77
|
+
meta: { name: 'my' },
|
|
78
|
+
rules: { 'no-foo': noFoo },
|
|
79
|
+
});
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
Register it under `lint.jsPlugins` and enable its rules:
|
|
83
|
+
|
|
84
|
+
```ts [vite.config.ts]
|
|
85
|
+
import { defineConfig } from 'vite-plus';
|
|
86
|
+
|
|
87
|
+
export default defineConfig({
|
|
88
|
+
lint: {
|
|
89
|
+
jsPlugins: ['./lint/my-plugin.js'],
|
|
90
|
+
rules: {
|
|
91
|
+
'my/no-foo': 'error',
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
});
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
For rule tests, `RuleTester` is available from `vite-plus/lint/plugins-dev`.
|
|
98
|
+
|
|
99
|
+
Both entrypoints re-export the copy that ships with Vite+. The API therefore
|
|
100
|
+
always matches the bundled Oxlint.
|
|
101
|
+
|
|
102
|
+
Use them instead of adding `@oxlint/plugins` or `oxlint` as a direct
|
|
103
|
+
dependency. A separately pinned copy can drift from the linter that loads your
|
|
104
|
+
plugin. It also does not resolve from a plugin file under pnpm's strict layout,
|
|
105
|
+
unless every package that holds a plugin declares it.
|
|
106
|
+
|
|
107
|
+
`vp migrate` rewrites existing `oxlint` and `@oxlint/plugins` imports for you.
|
|
108
|
+
See [Oxlint JS Plugin Imports](/guide/migrate-rules#oxlint-js-plugin-imports).
|
|
109
|
+
The `vite-plus/prefer-vite-plus-imports` rule reports any that come back.
|
|
@@ -39,6 +39,52 @@ When a default upgrade skips setup actions that would apply, it prints a hint
|
|
|
39
39
|
to run `vp migrate --full`. Fresh (non Vite+) projects always run the full
|
|
40
40
|
migration.
|
|
41
41
|
|
|
42
|
+
## Pack Configuration
|
|
43
|
+
|
|
44
|
+
`vp migrate` updates static `pack` objects in `vite.config.*` and exported
|
|
45
|
+
objects in `tsdown.config.*` for [tsdown 0.23](https://github.com/rolldown/tsdown/releases/tag/v0.23.0).
|
|
46
|
+
This also runs on existing Vite+ projects without `--full`, including workspace
|
|
47
|
+
packages. Arrays and direct objects returned by `defineConfig` callbacks are
|
|
48
|
+
supported. JSON tsdown configs receive the same updates after they merge into
|
|
49
|
+
`vite.config.ts`.
|
|
50
|
+
|
|
51
|
+
| Previous option | Updated option |
|
|
52
|
+
| ------------------------------------------------------------------ | ------------------------------------------------------------------------------------- |
|
|
53
|
+
| `bundle: false` | `unbundle: true` |
|
|
54
|
+
| `bundle: true` | Removed; bundling remains the default |
|
|
55
|
+
| `outExtension` | `outExtensions` |
|
|
56
|
+
| `publicDir` | `copy` |
|
|
57
|
+
| `removeNodeProtocol: true` | `nodeProtocol: 'strip'` |
|
|
58
|
+
| `injectStyle` | `css.inject` |
|
|
59
|
+
| `inlineOnly` / `deps.onlyAllowBundle` | `deps.onlyBundle` |
|
|
60
|
+
| `noExternal` | `deps.alwaysBundle` |
|
|
61
|
+
| `skipNodeModulesBundle: true` / `deps.skipNodeModulesBundle: true` | `deps.neverBundle: true` |
|
|
62
|
+
| `dts.tsgo` / `dts.oxc` | Select with `dts.generator`; retain generator option objects and remove boolean flags |
|
|
63
|
+
| `dts.cjsReexport` | Removed; tsdown generates CJS declarations separately |
|
|
64
|
+
| `--public-dir` in `tsdown` or `vp pack` scripts | `--copy` |
|
|
65
|
+
|
|
66
|
+
Migration preserves the previous defaults by setting `deps.resolveDepSubpath`
|
|
67
|
+
to `true` when absent. Enabled ATTW checks receive `profile: 'strict'` when
|
|
68
|
+
no profile is set. Explicit values, including `false`, remain unchanged.
|
|
69
|
+
|
|
70
|
+
`noExternal` moves to `deps.alwaysBundle`, preserving matcher expressions,
|
|
71
|
+
references, and callback methods. Existing `deps.alwaysBundle` values remain
|
|
72
|
+
unchanged.
|
|
73
|
+
|
|
74
|
+
When `external` accompanies either `skipNodeModulesBundle` form, static matchers
|
|
75
|
+
and references to local constants move to `inputOptions.external` before
|
|
76
|
+
`deps.neverBundle` is set. Constant declarations and references stay intact.
|
|
77
|
+
This preserves the original matching rules, including external file paths. Unsupported matchers,
|
|
78
|
+
conflicting `inputOptions`, and declaration-specific dependency rules leave the
|
|
79
|
+
pack object unchanged and produce a manual-migration warning.
|
|
80
|
+
|
|
81
|
+
The transform does not evaluate configuration code. Objects with spreads,
|
|
82
|
+
computed keys, or duplicate keys, and conflicting old and new options require
|
|
83
|
+
manual review. Dynamic boolean selectors remain unchanged. Unrelated Vite and
|
|
84
|
+
plugin options remain unchanged. Run `vp pack` after migration to check the
|
|
85
|
+
result. Node.js requirements, TypeScript module resolution, and programmatic
|
|
86
|
+
`build()` return values require separate review.
|
|
87
|
+
|
|
42
88
|
## Dependency Rules
|
|
43
89
|
|
|
44
90
|
What happens to each toolchain dependency, at a glance:
|
|
@@ -204,6 +250,44 @@ surface are written against `vite-plus` by hand.
|
|
|
204
250
|
needed.
|
|
205
251
|
- Existing `vite-plus/test*` imports are left unchanged.
|
|
206
252
|
|
|
253
|
+
### Oxlint JS Plugin Imports
|
|
254
|
+
|
|
255
|
+
Vite+ bundles Oxlint, so the migration removes a standalone `oxlint`
|
|
256
|
+
dependency. Your own Oxlint JS plugins import the authoring API by name. That
|
|
257
|
+
import stops resolving when the dependency goes away. `vp lint` then fails to
|
|
258
|
+
load the plugin.
|
|
259
|
+
|
|
260
|
+
The migration repoints those imports at Vite+:
|
|
261
|
+
|
|
262
|
+
- It rewrites `@oxlint/plugins` to `vite-plus/lint/plugins`.
|
|
263
|
+
- It rewrites `oxlint/plugins-dev` to `vite-plus/lint/plugins-dev`.
|
|
264
|
+
- It rewrites `oxlint` to `vite-plus/lint/plugins` when the import names a
|
|
265
|
+
binding from the authoring API, such as `defineRule`, `definePlugin`, or
|
|
266
|
+
`Context`. Older Oxlint releases exposed that API from the main entry. It now
|
|
267
|
+
lives in `@oxlint/plugins`.
|
|
268
|
+
|
|
269
|
+
An import through Vite+ always matches the version of Oxlint that Vite+
|
|
270
|
+
bundles. You pin no second package. The import also resolves from any package
|
|
271
|
+
that already depends on `vite-plus`.
|
|
272
|
+
|
|
273
|
+
The migration leaves three forms alone:
|
|
274
|
+
|
|
275
|
+
- `oxlint` imports that name only the config surface, such as `defineConfig`,
|
|
276
|
+
`OxlintConfig`, or `OxlintOverride`. These still resolve against the
|
|
277
|
+
standalone package.
|
|
278
|
+
- Default and namespace `oxlint` imports. They name no binding, so the
|
|
279
|
+
migration cannot tell the two surfaces apart.
|
|
280
|
+
- Bare side-effect `oxlint` imports, for the same reason.
|
|
281
|
+
|
|
282
|
+
The migration also skips a package that declares `oxlint` or `@oxlint/plugins`
|
|
283
|
+
in `dependencies` or `peerDependencies`, or `@oxlint/plugins` in
|
|
284
|
+
`optionalDependencies`. These dependencies can supply a published Oxlint plugin.
|
|
285
|
+
Its consumers may not run Vite+.
|
|
286
|
+
|
|
287
|
+
The cleanup retains a development dependency on `@oxlint/plugins` when source,
|
|
288
|
+
package import aliases, or built plugins still reference it. This includes
|
|
289
|
+
ignored output in directories such as `dist`, `build`, and `out`.
|
|
290
|
+
|
|
207
291
|
### What Is Never Rewritten
|
|
208
292
|
|
|
209
293
|
- `declare module 'vitest'` and `declare module '@vitest/browser*'`: module
|
|
@@ -252,6 +336,14 @@ as `run` or `--`:
|
|
|
252
336
|
|
|
253
337
|
Unrelated `bunx` commands and other package-executor forms remain unchanged.
|
|
254
338
|
|
|
339
|
+
## Continuous Integration Rules
|
|
340
|
+
|
|
341
|
+
Migration replaces exact `voidzero-dev/setup-vp@v1` references in GitHub
|
|
342
|
+
Actions workflows and composite actions under `.github` with the latest exact
|
|
343
|
+
`setup-vp` release known to that Vite+ version. The frozen `v1` tag does not
|
|
344
|
+
receive new releases. Existing exact versions and commit SHAs are left
|
|
345
|
+
unchanged.
|
|
346
|
+
|
|
255
347
|
## Node.js Version Rules
|
|
256
348
|
|
|
257
349
|
Migration converts legacy Node.js version-manager files to `.node-version`,
|
|
@@ -263,8 +355,9 @@ migrations run it unconditionally.
|
|
|
263
355
|
existing `.node-version` is kept.
|
|
264
356
|
- When `.nvmrc` is removed, any `actions/setup-node` `node-version-file:
|
|
265
357
|
.nvmrc` reference in `.github/workflows/*.{yml,yaml}` and composite actions
|
|
266
|
-
(`.github
|
|
267
|
-
CI does not fail with "node version file ... does not
|
|
358
|
+
under `.github` (`.github/**/action.{yml,yaml}`) is repointed to
|
|
359
|
+
`.node-version` so CI does not fail with "node version file ... does not
|
|
360
|
+
exist".
|
|
268
361
|
|
|
269
362
|
## Package-Manager Rules
|
|
270
363
|
|
package/docs/guide/migrate.md
CHANGED
|
@@ -117,7 +117,7 @@ After the migration:
|
|
|
117
117
|
|
|
118
118
|
- Confirm `vite` imports were rewritten to `vite-plus` where needed
|
|
119
119
|
- Confirm `vitest` imports were rewritten to `vite-plus/test` (and `@vitest/browser*` to `vite-plus/test/browser*`) where needed
|
|
120
|
-
-
|
|
120
|
+
- On pnpm, keep the `vite`, `vitest` dependency entries configured by `vp migrate` so the workspace aliases and overrides stay effective; with other package managers, you can remove them once those rewrites are confirmed
|
|
121
121
|
- Move remaining tool-specific config into the appropriate blocks in `vite.config.ts`
|
|
122
122
|
|
|
123
123
|
Command mapping to keep in mind:
|
package/docs/guide/monorepo.md
CHANGED
|
@@ -6,6 +6,8 @@ Because `vite.config.ts` is just JavaScript, you can choose to put your entire c
|
|
|
6
6
|
|
|
7
7
|
## Root Config With Overrides
|
|
8
8
|
|
|
9
|
+
Vite+ does not currently support nested lint or format configuration. Package-level `lint` and `fmt` blocks are not automatically applied. For now, define file- or package-specific settings with overrides in the root `vite.config.ts`. The long-term behavior is open for discussion; [share your use case and expectations](/guide/troubleshooting#nested-lint-or-format-config-is-not-applied) to help shape it.
|
|
10
|
+
|
|
9
11
|
Use `lint.overrides` for Oxlint rules that only apply to some packages:
|
|
10
12
|
|
|
11
13
|
```ts [vite.config.ts]
|