vite-plus 0.3.2 → 0.3.3
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/binding/index.cjs +137 -55
- package/binding/index.d.cts +40 -0
- package/dist/{agent-C59HKB4Y.js → agent-Cu6-tXIP.js} +2 -2
- package/dist/bin.js +5 -5
- package/dist/config/bin.js +2 -2
- package/dist/{constants-IhOditRA.js → constants-C2dTOTe-.js} +1 -1
- package/dist/create/bin.js +84 -65
- package/dist/{define-config-DpAPETDf.cjs → define-config-D0mevyb3.cjs} +1 -1
- package/dist/{define-config-DAaCa0U_.js → define-config-IgzmnvvV.js} +1 -1
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{editor-QOIGtmH4.js → editor-4sjlHmUh.js} +17 -6
- package/dist/index.cjs +1 -1
- package/dist/index.js +1 -1
- package/dist/lint-plugins.cjs +1 -1
- package/dist/migration/bin.js +6 -6
- package/dist/{oxlint-plugin-config-BU42tr8y.js → oxlint-plugin-config-BVqEe9KY.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +1 -1
- package/dist/{package-BB-Jh_z3.js → package-CHH8jWan.js} +1 -1
- package/dist/{prompts-CujFOJXu.js → prompts-k14KgthC.js} +1 -1
- package/dist/{resolve-vite-config-CHHjsjKJ.js → resolve-vite-config-BqvS2P98.js} +2 -2
- package/dist/{resolve-vite-config-6Nox70uP.js → resolve-vite-config-CTOTuqTi.js} +1 -1
- package/dist/staged/bin.js +1 -1
- package/dist/toolchain.js +7 -7
- package/dist/toolchain.json +7 -7
- package/dist/{tsconfig-DCtWfQPA.js → tsconfig-C3h9CVTA.js} +2 -2
- package/dist/{tsconfig-MXktI3SX.js → tsconfig-euB-GmIE.js} +1 -1
- package/dist/version.js +2 -2
- package/dist/versions.js +3 -3
- package/docs/config/staged.md +1 -2
- package/docs/guide/ci.md +28 -31
- package/docs/guide/commit-hooks.md +11 -34
- package/docs/guide/create.md +1 -2
- package/docs/guide/docker.md +20 -68
- package/docs/guide/env.md +30 -20
- package/docs/guide/global-cli.md +426 -0
- package/docs/guide/ide-integration.md +1 -2
- package/docs/guide/implode.md +14 -1
- package/docs/guide/index.md +37 -34
- package/docs/guide/install.md +17 -19
- package/docs/guide/lint.md +3 -9
- package/docs/guide/local-cli.md +123 -0
- package/docs/guide/migrate-rules.md +93 -290
- package/docs/guide/migrate.md +5 -48
- package/docs/guide/run.md +1 -1
- package/docs/guide/troubleshooting.md +3 -8
- package/docs/guide/upgrade-project.md +61 -0
- package/docs/guide/upgrade.md +17 -62
- package/package.json +17 -17
- package/docs/guide/installer-env-vars.md +0 -286
package/docs/guide/install.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Package Management
|
|
2
2
|
|
|
3
|
-
`vp
|
|
3
|
+
`vp` detects and runs the current workspace's package manager. These commands are available from both the [global CLI](/guide/global-cli) and the [project-local CLI](/guide/local-cli).
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
@@ -21,8 +21,6 @@ Vite+ detects the package manager from the workspace root in this order:
|
|
|
21
21
|
|
|
22
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
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.
|
|
25
|
-
|
|
26
24
|
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:
|
|
27
25
|
|
|
28
26
|
```json
|
|
@@ -41,13 +39,6 @@ A range resolves to an already-downloaded satisfying version when possible, othe
|
|
|
41
39
|
|
|
42
40
|
Vite+ currently downloads the declared package manager (the `onFail: "download"` behavior); the other `onFail` values are accepted but not yet differentiated.
|
|
43
41
|
|
|
44
|
-
A `packageManager` pin can carry an integrity hash (`yarn@4.17.1+sha512.…`). `corepack use` writes that hash. Vite+ hashes the same artifact as Corepack:
|
|
45
|
-
|
|
46
|
-
- the extracted CLI binary (`bin/yarn.js`) for Yarn 2 and later
|
|
47
|
-
- the npm package tarball for npm, pnpm, and Yarn Classic
|
|
48
|
-
|
|
49
|
-
Vite+ hashes the CLI once, when it installs Yarn, and records the pin it verified. A later command compares its own pin against that record. A pin that does not match the record fails the check, and the command stops. Corepack keeps the same kind of record for its own cache.
|
|
50
|
-
|
|
51
42
|
The explicit `packageManager` field (or the `devEngines.packageManager` declaration) also affects matching package-manager shims. If a project has `packageManager: "npm@10.9.4"`, `npm` and `npx` use npm 10.9.4. Other generated alias pairs behave the same way: `pnpm`/`pnpx`, `yarn`/`yarnpkg`, and `bun`/`bunx`. Mismatched tools are not translated; `npm` in a `pnpm` project still resolves as npm.
|
|
52
43
|
|
|
53
44
|
## Usage
|
|
@@ -83,8 +74,7 @@ Updates keep the version spec a package was installed with: a package installed
|
|
|
83
74
|
::: warning
|
|
84
75
|
These commands do **NOT** interact with the underlying package manager's global installation directory.
|
|
85
76
|
|
|
86
|
-
Instead, Vite+ stores its global packages in `packages/` under the resolved data
|
|
87
|
-
directory. These packages remain available across different Node.js versions.
|
|
77
|
+
Instead, Vite+ stores its global packages in `packages/` under the resolved data directory. These packages remain available across different Node.js versions.
|
|
88
78
|
|
|
89
79
|
As a result, commands such as `vp link` do not affect Vite+'s global packages and will not appear in `vp list -g`.
|
|
90
80
|
:::
|
|
@@ -122,6 +112,10 @@ Use `vp install` when you want to install exactly what the current `package.json
|
|
|
122
112
|
- `vp install --filter <pattern>` scopes install work in monorepos
|
|
123
113
|
- `vp install -w` installs in the workspace root
|
|
124
114
|
|
|
115
|
+
##### Git and remote tarball dependencies (npm v12+)
|
|
116
|
+
|
|
117
|
+
npm v12 stops resolving git dependencies (`github:`, `git+https:`) and remote tarball URLs by default; such installs fail with `EALLOWGIT` / `EALLOWREMOTE`. Opt back in per project with npm's `allow-git` / `allow-remote` config.
|
|
118
|
+
|
|
125
119
|
#### Global Install
|
|
126
120
|
|
|
127
121
|
Use these commands when you want package-manager-managed tools available outside a single project.
|
|
@@ -160,10 +154,7 @@ Use these when you need to understand the current state of dependencies.
|
|
|
160
154
|
- `vp why react` explains why `react` is installed
|
|
161
155
|
- `vp info react` shows registry metadata such as versions and dist-tags
|
|
162
156
|
|
|
163
|
-
These commands show the packages that the package manager installed. They do
|
|
164
|
-
not show tools that Vite+ bundles or compiles. Run `vp toolchain [tool]` to show
|
|
165
|
-
these tools, including Vite, Rolldown, and Oxc. For readable output, `vp why`
|
|
166
|
-
shows a hint when Vite+ also provides the package.
|
|
157
|
+
These commands show the packages that the package manager installed. They do not show tools that Vite+ bundles or compiles. Run `vp toolchain [tool]` to show these tools, including Vite, Rolldown, and Oxc. For readable output, `vp why` shows a hint when Vite+ also provides the package.
|
|
167
158
|
|
|
168
159
|
#### Rebuild
|
|
169
160
|
|
|
@@ -194,8 +185,6 @@ npm v12 skips dependency install scripts (`preinstall` / `install` / `postinstal
|
|
|
194
185
|
|
|
195
186
|
Approval only records the allowlist: scripts an earlier install skipped do not run until you run `vp rebuild <pkg>`. With npm 11.16 - 11.x the same commands work, but npm treats the allowlist as advisory and still runs scripts.
|
|
196
187
|
|
|
197
|
-
npm v12 also stops resolving git dependencies (`github:`, `git+https:`) and remote tarball URLs by default; such installs fail with `EALLOWGIT` / `EALLOWREMOTE`. Opt back in per project with npm's `allow-git` / `allow-remote` config.
|
|
198
|
-
|
|
199
188
|
#### Advanced
|
|
200
189
|
|
|
201
190
|
Use these when you need lower-level package-manager behavior.
|
|
@@ -228,3 +217,12 @@ vp pm stage reject <stage-id> # discard a staged version (2FA)
|
|
|
228
217
|
- pnpm (`pnpm stage`, requires pnpm ≥ 11.3) and npm (`npm stage`, requires npm ≥ 11.15 and Node ≥ 22.14) pass through directly.
|
|
229
218
|
- yarn (Berry) uses its npm plugin (`yarn npm publish --staged`, `yarn npm stage …`); `view`/`download` fall back to npm.
|
|
230
219
|
- yarn Classic and bun have no staged-publishing support and fall back to `npm stage`.
|
|
220
|
+
|
|
221
|
+
## Package-Manager Integrity Verification
|
|
222
|
+
|
|
223
|
+
A `packageManager` pin can carry an integrity hash (`yarn@4.17.1+sha512.…`). `corepack use` writes that hash. Vite+ hashes the same artifact as Corepack:
|
|
224
|
+
|
|
225
|
+
- the extracted CLI binary (`bin/yarn.js`) for Yarn 2 and later
|
|
226
|
+
- the npm package tarball for npm, pnpm, and Yarn Classic
|
|
227
|
+
|
|
228
|
+
Vite+ hashes the CLI once, when it installs Yarn, and records the pin it verified. A later command compares its own pin against that record. A pin that does not match the record fails the check, and the command stops. Corepack keeps the same kind of record for its own cache.
|
package/docs/guide/lint.md
CHANGED
|
@@ -96,14 +96,8 @@ export default defineConfig({
|
|
|
96
96
|
|
|
97
97
|
For rule tests, `RuleTester` is available from `vite-plus/lint/plugins-dev`.
|
|
98
98
|
|
|
99
|
-
Both entrypoints re-export the copy that ships with Vite+. The API therefore
|
|
100
|
-
always matches the bundled Oxlint.
|
|
99
|
+
Both entrypoints re-export the copy that ships with Vite+. The API therefore always matches the bundled Oxlint.
|
|
101
100
|
|
|
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.
|
|
101
|
+
Use them instead of adding `@oxlint/plugins` or `oxlint` as a direct dependency. A separately pinned copy can drift from the linter that loads your plugin. It also does not resolve from a plugin file under pnpm's strict layout, unless every package that holds a plugin declares it.
|
|
106
102
|
|
|
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.
|
|
103
|
+
`vp migrate` rewrites existing `oxlint` and `@oxlint/plugins` imports for you. See [Oxlint JS Plugin Imports](/guide/migrate-rules#oxlint-js-plugin-imports). The `vite-plus/prefer-vite-plus-imports` rule reports any that come back.
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
# Project-local CLI
|
|
2
|
+
|
|
3
|
+
Different from [global `vp` cli](/guide/global-cli), the `vite-plus` is a npm package which contains the project-local `vp` CLI and the integrated frontend toolchain. Install it as a development dependency when you want the toolchain version recorded in the project's manifest and lockfile, or when you do not want to install the standalone global CLI.
|
|
4
|
+
|
|
5
|
+
The local package includes Vite, Rolldown, Vitest, Oxlint, Oxfmt, tsdown, the Vite+ task runner, and package-manager commands. It requires an existing Node.js runtime and package manager.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
For most of use cases, we recommend to use Vite+ cli to install in a project or create a new project. Learn more in [Creating a Project](/guide/create) and [Migrate to Vite+](/guide/migrate).
|
|
10
|
+
|
|
11
|
+
::: code-group
|
|
12
|
+
|
|
13
|
+
```bash [pnpm]
|
|
14
|
+
pnpm dlx --package=vite-plus vp create
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
```bash [npm]
|
|
18
|
+
npx --package=vite-plus vp create
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
```bash [Yarn]
|
|
22
|
+
yarn dlx --package vite-plus vp create
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
```bash [Bun]
|
|
26
|
+
bunx --package vite-plus vp create
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
:::
|
|
30
|
+
|
|
31
|
+
Run its binary through your package manager. For example:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
./node_modules/.bin/vp migrate --help
|
|
35
|
+
./node_modules/.bin/vp check
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
The documentation uses bare `vp` commands for readability. Without the global CLI, prefix interactive commands with your package manager's local-binary executor, such as `pnpm exec`.
|
|
39
|
+
|
|
40
|
+
### Manual Installation
|
|
41
|
+
|
|
42
|
+
If you are manually migrating a project to Vite+, install these dev dependencies first:
|
|
43
|
+
|
|
44
|
+
```bash
|
|
45
|
+
vp install -D vite-plus
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
You need to add overrides to your package manager so that other packages resolve the Vite+ versions: alias `vite` to `@voidzero-dev/vite-plus-core`, and pin `vitest` to the version Vite+ bundles (run `vp --version`) so the whole project shares a single Vitest copy with `vp test`. Without the `vitest` pin, a dependency or workspace package can pull a different Vitest than the bundled runner, splitting Vitest's internals (mocks, `expect`, runner state):
|
|
49
|
+
|
|
50
|
+
::: code-group
|
|
51
|
+
|
|
52
|
+
```yaml [pnpm-workspace.yaml]
|
|
53
|
+
overrides:
|
|
54
|
+
vite: npm:@voidzero-dev/vite-plus-core@latest
|
|
55
|
+
vitest: 4.1.11
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
```json [npm / Bun package.json]
|
|
59
|
+
"overrides": {
|
|
60
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
61
|
+
"vitest": "4.1.11"
|
|
62
|
+
}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
```json [Yarn package.json]
|
|
66
|
+
"resolutions": {
|
|
67
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@latest",
|
|
68
|
+
"vitest": "4.1.11"
|
|
69
|
+
}
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
:::
|
|
73
|
+
|
|
74
|
+
::: details Why are these settings needed?
|
|
75
|
+
|
|
76
|
+
Dependencies and plugins can import `vite` or `vitest` directly, even when your own code imports from `vite-plus`. These overrides align their dependencies with the toolchain Vite+ uses:
|
|
77
|
+
|
|
78
|
+
- The `vite` alias directs those imports to Vite+'s core package. Separate Vite instances can break runtime identity checks: [issue #1391](https://github.com/voidzero-dev/vite-plus/issues/1391) reported TanStack Start returning 404s because an `instanceof` check crossed two copies. [PR #2617](https://github.com/voidzero-dev/vite-plus/pull/2617) addresses the CLI side by sharing Vite through the same alias.
|
|
79
|
+
- The exact `vitest` pin keeps dependencies and `vp test` on the same Vitest version, avoiding separate mocks, `expect` instances, and runner state. [PR #2365](https://github.com/voidzero-dev/vite-plus/pull/2365) documents this requirement for manual installation.
|
|
80
|
+
|
|
81
|
+
Keep the core alias aligned with your installed `vite-plus` version and update the Vitest pin to match its bundled version when upgrading. [Issue #2356](https://github.com/voidzero-dev/vite-plus/issues/2356) describes how dependency bots can update these packages independently and leave incompatible versions installed together.
|
|
82
|
+
|
|
83
|
+
:::
|
|
84
|
+
|
|
85
|
+
## Best Practices
|
|
86
|
+
|
|
87
|
+
We recommend using the [global CLI](/guide/global-cli) together with the project-local CLI. The global CLI makes `vp` available directly in your terminal and delegates development commands such as `vp dev`, `vp build`, and `vp test` to the project's installed `vite-plus` package. This gives you convenient access to the toolchain while keeping its version controlled by the project. You can also use only the project-local CLI if you prefer.
|
|
88
|
+
|
|
89
|
+
For open-source projects or any project with collaborators, we recommend adding `package.json` scripts that call `vp`, whether you use both CLIs or only the project-local CLI. Inside scripts, `vp` resolves automatically from `node_modules/.bin`:
|
|
90
|
+
|
|
91
|
+
```json [package.json]
|
|
92
|
+
{
|
|
93
|
+
"scripts": {
|
|
94
|
+
"dev": "vp dev",
|
|
95
|
+
"check": "vp check",
|
|
96
|
+
"test": "vp test",
|
|
97
|
+
"build": "vp build"
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
After installing the project's dependencies, contributors can run these scripts through their package manager, such as `pnpm run dev` or `npm run dev`, without being required to install the global CLI.
|
|
103
|
+
|
|
104
|
+
## What It Includes
|
|
105
|
+
|
|
106
|
+
The project-local CLI can be used independently for:
|
|
107
|
+
|
|
108
|
+
- [`vp dev`](/guide/dev), [`vp build`](/guide/build), and [`vp preview`](/guide/build) with Vite and Rolldown
|
|
109
|
+
- [`vp check`](/guide/check), [`vp lint`](/guide/lint), and [`vp fmt`](/guide/fmt) with Oxc
|
|
110
|
+
- [`vp test`](/guide/test) with Vitest
|
|
111
|
+
- [`vp pack`](/guide/pack) with tsdown
|
|
112
|
+
- [`vp toolchain`](/guide/upgrade#show-the-toolchain) for inspecting the versions bundled with the project-local package
|
|
113
|
+
- [`vp run`](/guide/run) and task caching across workspaces
|
|
114
|
+
- [package-manager commands](/guide/install) using the Node.js runtime already active in your shell
|
|
115
|
+
- [`vp create`](/guide/create), [`vp migrate`](/guide/migrate), and project configuration commands
|
|
116
|
+
|
|
117
|
+
The local package cannot manage the machine-level Vite+ installation. The `vp env`, `vp upgrade`, and `vp implode` commands require the [global CLI](/guide/global-cli). Upgrade or remove a local-only installation through your package manager.
|
|
118
|
+
|
|
119
|
+
## Add the Global CLI Later
|
|
120
|
+
|
|
121
|
+
You can install the global CLI at any time without changing the project's dependency. Commands such as `vp dev`, `vp build`, and `vp test` will continue to use the project's installed `vite-plus` version.
|
|
122
|
+
|
|
123
|
+
See [Use Both CLIs Together](/guide/global-cli#use-both-clis-together) for the selection rules.
|