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.
Files changed (51) hide show
  1. package/binding/index.cjs +137 -55
  2. package/binding/index.d.cts +40 -0
  3. package/dist/{agent-C59HKB4Y.js → agent-Cu6-tXIP.js} +2 -2
  4. package/dist/bin.js +5 -5
  5. package/dist/config/bin.js +2 -2
  6. package/dist/{constants-IhOditRA.js → constants-C2dTOTe-.js} +1 -1
  7. package/dist/create/bin.js +84 -65
  8. package/dist/{define-config-DpAPETDf.cjs → define-config-D0mevyb3.cjs} +1 -1
  9. package/dist/{define-config-DAaCa0U_.js → define-config-IgzmnvvV.js} +1 -1
  10. package/dist/define-config.cjs +1 -1
  11. package/dist/define-config.js +1 -1
  12. package/dist/{editor-QOIGtmH4.js → editor-4sjlHmUh.js} +17 -6
  13. package/dist/index.cjs +1 -1
  14. package/dist/index.js +1 -1
  15. package/dist/lint-plugins.cjs +1 -1
  16. package/dist/migration/bin.js +6 -6
  17. package/dist/{oxlint-plugin-config-BU42tr8y.js → oxlint-plugin-config-BVqEe9KY.js} +1 -1
  18. package/dist/oxlint-plugin.js +1 -1
  19. package/dist/pack-bin.js +1 -1
  20. package/dist/{package-BB-Jh_z3.js → package-CHH8jWan.js} +1 -1
  21. package/dist/{prompts-CujFOJXu.js → prompts-k14KgthC.js} +1 -1
  22. package/dist/{resolve-vite-config-CHHjsjKJ.js → resolve-vite-config-BqvS2P98.js} +2 -2
  23. package/dist/{resolve-vite-config-6Nox70uP.js → resolve-vite-config-CTOTuqTi.js} +1 -1
  24. package/dist/staged/bin.js +1 -1
  25. package/dist/toolchain.js +7 -7
  26. package/dist/toolchain.json +7 -7
  27. package/dist/{tsconfig-DCtWfQPA.js → tsconfig-C3h9CVTA.js} +2 -2
  28. package/dist/{tsconfig-MXktI3SX.js → tsconfig-euB-GmIE.js} +1 -1
  29. package/dist/version.js +2 -2
  30. package/dist/versions.js +3 -3
  31. package/docs/config/staged.md +1 -2
  32. package/docs/guide/ci.md +28 -31
  33. package/docs/guide/commit-hooks.md +11 -34
  34. package/docs/guide/create.md +1 -2
  35. package/docs/guide/docker.md +20 -68
  36. package/docs/guide/env.md +30 -20
  37. package/docs/guide/global-cli.md +426 -0
  38. package/docs/guide/ide-integration.md +1 -2
  39. package/docs/guide/implode.md +14 -1
  40. package/docs/guide/index.md +37 -34
  41. package/docs/guide/install.md +17 -19
  42. package/docs/guide/lint.md +3 -9
  43. package/docs/guide/local-cli.md +123 -0
  44. package/docs/guide/migrate-rules.md +93 -290
  45. package/docs/guide/migrate.md +5 -48
  46. package/docs/guide/run.md +1 -1
  47. package/docs/guide/troubleshooting.md +3 -8
  48. package/docs/guide/upgrade-project.md +61 -0
  49. package/docs/guide/upgrade.md +17 -62
  50. package/package.json +17 -17
  51. package/docs/guide/installer-env-vars.md +0 -286
package/docs/guide/ci.md CHANGED
@@ -10,37 +10,7 @@ You can use `voidzero-dev/setup-vp` to use Vite+ in CI environments.
10
10
 
11
11
  Set `<setup-vp-version>` in each example to an exact version from the [`setup-vp` releases page](https://github.com/voidzero-dev/setup-vp/releases). You can use a commit SHA instead. Do not use the `v1` tag. The `v1` tag no longer receives updates.
12
12
 
13
- Run `vp migrate` to replace exact `voidzero-dev/setup-vp@v1` references in
14
- GitHub Actions workflows and composite actions under `.github` with the latest
15
- exact release known to your Vite+ version. Existing exact versions and commit
16
- SHAs remain unchanged.
17
-
18
- ### Automatic Version Updates
19
-
20
- Dependabot and Renovate can update exact versions in GitHub Actions workflows.
21
-
22
- To use [Dependabot version updates](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates), add a `github-actions` entry to `.github/dependabot.yml`:
23
-
24
- ```yaml [.github/dependabot.yml]
25
- version: 2
26
- updates:
27
- - package-ecosystem: github-actions
28
- directory: /
29
- schedule:
30
- interval: weekly
31
- ```
32
-
33
- Dependabot checks `uses:` entries in `.github/workflows` each week.
34
-
35
- [Renovate's GitHub Actions manager](https://docs.renovatebot.com/modules/manager/github-actions/) detects `uses:` entries by default. You do not need a package rule for `setup-vp`.
36
-
37
- When you use a commit SHA, add the exact release tag in a comment. Renovate uses the comment to find updates:
38
-
39
- ```yaml
40
- - uses: voidzero-dev/setup-vp@<commit-sha> # <setup-vp-version>
41
- ```
42
-
43
- These settings apply only to GitHub Actions workflows. For GitLab CI/CD and Azure Pipelines, update both version values together.
13
+ Run `vp migrate` to replace exact `voidzero-dev/setup-vp@v1` references in GitHub Actions workflows and composite actions under `.github` with the latest exact release known to your Vite+ version. Existing exact versions and commit SHAs remain unchanged.
44
14
 
45
15
  ## GitHub Actions
46
16
 
@@ -125,6 +95,33 @@ The Azure Pipelines template supports Microsoft-hosted Linux, macOS, and Windows
125
95
 
126
96
  For advanced configuration and the complete parameter reference, see the [`setup-vp` Azure Pipelines documentation](https://github.com/voidzero-dev/setup-vp#azure-pipelines).
127
97
 
98
+ ## Automatic Version Updates
99
+
100
+ Dependabot and Renovate can update exact versions in GitHub Actions workflows.
101
+
102
+ To use [Dependabot version updates](https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuring-dependabot-version-updates), add a `github-actions` entry to `.github/dependabot.yml`:
103
+
104
+ ```yaml [.github/dependabot.yml]
105
+ version: 2
106
+ updates:
107
+ - package-ecosystem: github-actions
108
+ directory: /
109
+ schedule:
110
+ interval: weekly
111
+ ```
112
+
113
+ Dependabot checks `uses:` entries in `.github/workflows` each week.
114
+
115
+ [Renovate's GitHub Actions manager](https://docs.renovatebot.com/modules/manager/github-actions/) detects `uses:` entries by default. You do not need a package rule for `setup-vp`.
116
+
117
+ When you use a commit SHA, add the exact release tag in a comment. Renovate uses the comment to find updates:
118
+
119
+ ```yaml
120
+ - uses: voidzero-dev/setup-vp@<commit-sha> # <setup-vp-version>
121
+ ```
122
+
123
+ These settings apply only to GitHub Actions workflows. For GitLab CI/CD and Azure Pipelines, update both version values together.
124
+
128
125
  ## Simplifying Existing Workflows
129
126
 
130
127
  If you are migrating an existing GitHub Actions workflow, you can often replace large blocks of Node, package-manager, and cache setup with a single `setup-vp` step.
@@ -1,7 +1,6 @@
1
1
  # Commit Hooks
2
2
 
3
- Use `vp hooks` to manage the Git hook dispatcher, `vp config` for project setup
4
- (hooks + agent integration), and `vp staged` to run checks on staged files.
3
+ Use `vp hooks` to manage the Git hook dispatcher, `vp config` for project setup (hooks + agent integration), and `vp staged` to run checks on staged files.
5
4
 
6
5
  ## Overview
7
6
 
@@ -64,10 +63,7 @@ Check the `Dispatcher` and `core.hooksPath` lines to see whether hooks are actua
64
63
 
65
64
  ### `vp config`
66
65
 
67
- `vp config` configures Vite+ for the current project. It installs the generated Git hook
68
- dispatcher (unless hooks were disabled with `vp hooks disable`) and can also handle related
69
- project integration such as agent setup. The hooks directory defaults to `.vite-hooks`, or the
70
- last directory used by `vp hooks` / `vp config` in this clone:
66
+ `vp config` configures Vite+ for the current project. It installs the generated Git hook dispatcher (unless hooks were disabled with `vp hooks disable`) and can also handle related project integration such as agent setup. The hooks directory defaults to `.vite-hooks`, or the last directory used by `vp hooks` / `vp config` in this clone:
71
67
 
72
68
  ```bash
73
69
  vp config
@@ -76,24 +72,15 @@ vp config --no-hooks
76
72
  vp config --no-agent
77
73
  ```
78
74
 
79
- Use `--no-hooks` when you want `vp config` to leave the Git hook dispatcher unchanged. Use
80
- `--no-agent` when you want it to skip updates to existing coding agent instruction files. You can
81
- pass both flags when you want `vp config` to skip both setup steps. After `vp hooks disable`,
82
- `vp config` skips reinstalling the dispatcher and points you at `vp hooks enable` instead of
83
- prompting again.
75
+ Use `--no-hooks` when you want `vp config` to leave the Git hook dispatcher unchanged. Use `--no-agent` when you want it to skip updates to existing coding agent instruction files. You can pass both flags when you want `vp config` to skip both setup steps. After `vp hooks disable`, `vp config` skips reinstalling the dispatcher and points you at `vp hooks enable` instead of prompting again.
84
76
 
85
- You can also set `VP_GIT_HOOKS=0` to disable hook installation from lifecycle scripts such as
86
- `prepare` or `postinstall`.
77
+ You can also set `VP_GIT_HOOKS=0` to disable hook installation from lifecycle scripts such as `prepare` or `postinstall`.
87
78
 
88
- Project-owned hook scripts such as `.vite-hooks/pre-commit` should be committed to the repository.
89
- The generated dispatcher and shims under `.vite-hooks/_` are ignored and recreated by `vp config`
90
- or `vp hooks enable`. Neither command creates or modifies project hook scripts or staged-file
91
- configuration.
79
+ Project-owned hook scripts such as `.vite-hooks/pre-commit` should be committed to the repository. The generated dispatcher and shims under `.vite-hooks/_` are ignored and recreated by `vp config` or `vp hooks enable`. Neither command creates or modifies project hook scripts or staged-file configuration.
92
80
 
93
81
  ### `vp staged`
94
82
 
95
- `vp staged` runs staged-file checks using the `staged` config from `vite.config.ts`. To run it
96
- before each commit, add it to the project-owned pre-commit hook:
83
+ `vp staged` runs staged-file checks using the `staged` config from `vite.config.ts`. To run it before each commit, add it to the project-owned pre-commit hook:
97
84
 
98
85
  ```bash
99
86
  vp staged
@@ -119,12 +106,7 @@ export default defineConfig({
119
106
  });
120
107
  ```
121
108
 
122
- This is the default Vite+ approach and should replace separate `lint-staged` configuration in most
123
- projects. When you opt into hooks during `vp create`, Vite+ scaffolds both this configuration and
124
- the corresponding pre-commit hook. During `vp migrate`, existing hook policy is preserved, and
125
- the default is introduced only when no existing hook policy is found. Because
126
- `vp staged` reads from `vite.config.ts`, your staged-file checks stay in the same place as your
127
- lint, format, test, build, and task-runner config.
109
+ This is the default Vite+ approach and should replace separate `lint-staged` configuration in most projects. When you opt into hooks during `vp create`, Vite+ scaffolds both this configuration and the corresponding pre-commit hook. During `vp migrate`, existing hook policy is preserved, and the default is introduced only when no existing hook policy is found. Because `vp staged` reads from `vite.config.ts`, your staged-file checks stay in the same place as your lint, format, test, build, and task-runner config.
128
110
 
129
111
  ## Disabling Hooks in Specific Environments
130
112
 
@@ -157,8 +139,7 @@ Because the hook itself reads this file, it works even when the committing proce
157
139
 
158
140
  ## Removing commit hooks
159
141
 
160
- To stop using the Vite+ hook dispatcher in this clone (and keep `prepare` / `vp config` from
161
- reinstalling it):
142
+ To stop using the Vite+ hook dispatcher in this clone (and keep `prepare` / `vp config` from reinstalling it):
162
143
 
163
144
  ```bash
164
145
  vp hooks disable
@@ -170,8 +151,7 @@ This:
170
151
 
171
152
  1. Unsets `core.hooksPath` when it points at the Vite+ dispatcher
172
153
  2. Removes the generated `<hooks-dir>/_` directory
173
- 3. Records a **local** disable preference so lifecycle scripts skip reinstall until you run
174
- `vp hooks enable` again
154
+ 3. Records a **local** disable preference so lifecycle scripts skip reinstall until you run `vp hooks enable` again
175
155
 
176
156
  To re-enable:
177
157
 
@@ -179,8 +159,7 @@ To re-enable:
179
159
  vp hooks enable
180
160
  ```
181
161
 
182
- If you no longer want hooks for the project at all (shared with teammates), also remove `vp config`
183
- from the `prepare` or `postinstall` script in `package.json`.
162
+ If you no longer want hooks for the project at all (shared with teammates), also remove `vp config` from the `prepare` or `postinstall` script in `package.json`.
184
163
 
185
164
  ### Manual equivalent
186
165
 
@@ -195,6 +174,4 @@ git config --local vp.hooks.disabled true
195
174
  # git config --local vp.hooks.dir .vite-hooks
196
175
  ```
197
176
 
198
- Project-owned scripts such as `.vite-hooks/pre-commit` and the `staged` block in `vite.config.ts`
199
- can remain for later use, or you can remove them separately if the project no longer needs them.
200
- `vp hooks disable` does **not** delete those project-owned files.
177
+ Project-owned scripts such as `.vite-hooks/pre-commit` and the `staged` block in `vite.config.ts` can remain for later use, or you can remove them separately if the project no longer needs them. `vp hooks disable` does **not** delete those project-owned files.
@@ -57,8 +57,7 @@ Run `vp create --list` to see the built-in templates and the common shorthand te
57
57
  - `--hooks` enables pre-commit hook setup (dispatcher + `.vite-hooks` + `staged` config)
58
58
  - `--no-hooks` skips hook setup
59
59
 
60
- After create, manage the dispatcher with `vp hooks status`, `vp hooks disable`, and `vp hooks enable`.
61
- See the [Commit hooks guide](/guide/commit-hooks).
60
+ After create, manage the dispatcher with `vp hooks status`, `vp hooks disable`, and `vp hooks enable`. See the [Commit hooks guide](/guide/commit-hooks).
62
61
 
63
62
  ### Dependency build scripts
64
63
 
@@ -6,16 +6,11 @@ Vite+ publishes an official Docker image with the `vp` CLI preinstalled:
6
6
  ghcr.io/voidzero-dev/vite-plus
7
7
  ```
8
8
 
9
- Use it for builds, CI, and devcontainers. It is not intended as a production
10
- runtime image.
9
+ Use it for builds, CI, and devcontainers. It is not intended as a production runtime image.
11
10
 
12
- `vp` resolves the Node.js version from your project (`.node-version`,
13
- `devEngines.runtime`, or `engines.node`) and downloads that exact version during
14
- install/build. This means the image does not need Node-version-specific tags.
11
+ `vp` resolves the Node.js version from your project (`.node-version`, `devEngines.runtime`, or `engines.node`) and downloads that exact version during install/build. This means the image does not need Node-version-specific tags.
15
12
 
16
- For production, use a multi-stage build: build the app with the Vite+ image, then
17
- copy only the resolved Node.js binary, build output, and production dependencies
18
- into a smaller runtime image.
13
+ For production, use a multi-stage build: build the app with the Vite+ image, then copy only the resolved Node.js binary, build output, and production dependencies into a smaller runtime image.
19
14
 
20
15
  ## Image tags
21
16
 
@@ -28,19 +23,13 @@ Tags track the `vp` version:
28
23
  | `ghcr.io/voidzero-dev/vite-plus:<major>.<minor>` | Latest minor |
29
24
  | `ghcr.io/voidzero-dev/vite-plus:<major>.<minor>.<patch>` | Exact version |
30
25
 
31
- The examples use `:latest` to track the newest release; pin an exact tag or a
32
- digest if you need reproducible builds. The image is published for `linux/amd64`
33
- and `linux/arm64` and runs as the non-root `vp` user by default. That user has
34
- passwordless `sudo`, so build/CI steps that need root (extra apt packages,
35
- `playwright install --with-deps`) work without changing the image user.
26
+ The examples use `:latest` to track the newest release; pin an exact tag or a digest if you need reproducible builds. The image is published for `linux/amd64` and `linux/arm64` and runs as the non-root `vp` user by default. That user has passwordless `sudo`, so build/CI steps that need root (extra apt packages, `playwright install --with-deps`) work without changing the image user.
36
27
 
37
28
  Browse all published versions and digests on the [GitHub package page](https://github.com/voidzero-dev/vite-plus/pkgs/container/vite-plus).
38
29
 
39
30
  ## Production: SSR / Node.js server app
40
31
 
41
- For apps that run Node.js in production (SvelteKit, Nuxt, a custom Vite SSR
42
- server, and so on), build with the toolchain image and copy the resolved Node.js
43
- and the built app into a slim runtime stage:
32
+ For apps that run Node.js in production (SvelteKit, Nuxt, a custom Vite SSR server, and so on), build with the toolchain image and copy the resolved Node.js and the built app into a slim runtime stage:
44
33
 
45
34
  ```dockerfile [Dockerfile]
46
35
  # syntax=docker/dockerfile:1
@@ -86,28 +75,19 @@ EXPOSE 3000
86
75
  CMD ["node", "dist/server.js"]
87
76
  ```
88
77
 
89
- The deployed image contains only Node.js plus your app and production
90
- dependencies, and matches `.node-version` exactly. It is much smaller than the
91
- default `node:*` image; see the distroless tip below for the smallest result.
78
+ The deployed image contains only Node.js plus your app and production dependencies, and matches `.node-version` exactly. It is much smaller than the default `node:*` image; see the distroless tip below for the smallest result.
92
79
 
93
80
  ::: warning Prune production dependencies in a separate stage
94
- Install production dependencies in their own `deps` stage as shown. Running
95
- `vp install --prod` after a full `vp install` in the same stage does not remove
96
- the already-installed devDependencies, so the `vite-plus` toolchain would be
97
- copied into the runtime image. If your server bundle is fully self-contained (no
98
- un-bundled runtime dependencies), you can skip copying `node_modules` entirely.
81
+ Install production dependencies in their own `deps` stage as shown. Running `vp install --prod` after a full `vp install` in the same stage does not remove the already-installed devDependencies, so the `vite-plus` toolchain would be copied into the runtime image. If your server bundle is fully self-contained (no un-bundled runtime dependencies), you can skip copying `node_modules` entirely.
99
82
  :::
100
83
 
101
84
  ::: tip Smaller still
102
- For a shell-less, minimal-CVE runtime, swap the runtime base for distroless
103
- (`gcr.io/distroless/cc`) and keep an `ENTRYPOINT` in vector form. It is glibc
104
- based, so the copied Node.js binary remains compatible.
85
+ For a shell-less, minimal-CVE runtime, swap the runtime base for distroless (`gcr.io/distroless/cc`) and keep an `ENTRYPOINT` in vector form. It is glibc based, so the copied Node.js binary remains compatible.
105
86
  :::
106
87
 
107
88
  ## Production: static SPA / SSG
108
89
 
109
- A static site needs no Node.js at runtime; serve the build output with any static
110
- server:
90
+ A static site needs no Node.js at runtime; serve the build output with any static server:
111
91
 
112
92
  ```dockerfile [Dockerfile]
113
93
  FROM ghcr.io/voidzero-dev/vite-plus:latest AS build
@@ -123,8 +103,7 @@ COPY --from=build /app/dist /usr/share/nginx/html
123
103
 
124
104
  ## Continuous integration
125
105
 
126
- Use the image directly in container-based CI (GitLab CI, Buildkite, CircleCI,
127
- Jenkins, and others):
106
+ Use the image directly in container-based CI (GitLab CI, Buildkite, CircleCI, Jenkins, and others):
128
107
 
129
108
  ```yaml [.gitlab-ci.yml]
130
109
  build:
@@ -140,11 +119,7 @@ On GitHub Actions, prefer [`setup-vp`](./ci) instead of the image.
140
119
 
141
120
  ## Browser mode tests (Vitest / Playwright)
142
121
 
143
- Running as the non-root `vp` user is what you want for browsers: Chromium keeps
144
- its sandbox (running a browser as root disables it). Install the browser and its
145
- system libraries in the job. `playwright install --with-deps` needs root to
146
- `apt-get install` those libraries. The `vp` user has passwordless `sudo`, so
147
- Playwright uses it to install them without changing the image user:
122
+ Running as the non-root `vp` user is what you want for browsers: Chromium keeps its sandbox (running a browser as root disables it). Install the browser and its system libraries in the job. `playwright install --with-deps` needs root to `apt-get install` those libraries. The `vp` user has passwordless `sudo`, so Playwright uses it to install them without changing the image user:
148
123
 
149
124
  ```yaml [.gitlab-ci.yml]
150
125
  test:
@@ -155,15 +130,9 @@ test:
155
130
  - vp test
156
131
  ```
157
132
 
158
- `vp exec` runs the project's own Playwright (from your lockfile), so it installs
159
- the browser revision your tests expect. Prefer it over `vpx playwright install`,
160
- which would download whatever Playwright is latest and can fetch a different
161
- browser revision.
133
+ `vp exec` runs the project's own Playwright (from your lockfile), so it installs the browser revision your tests expect. Prefer it over `vpx playwright install`, which would download whatever Playwright is latest and can fetch a different browser revision.
162
134
 
163
- To bake the browser and its libraries into a derived image instead of installing
164
- them on every run, install the project dependencies first so the baked browser
165
- matches your lockfile, then install with the project's Playwright (root is
166
- available through `sudo`):
135
+ To bake the browser and its libraries into a derived image instead of installing them on every run, install the project dependencies first so the baked browser matches your lockfile, then install with the project's Playwright (root is available through `sudo`):
167
136
 
168
137
  ```dockerfile [Dockerfile]
169
138
  FROM ghcr.io/voidzero-dev/vite-plus:latest
@@ -173,13 +142,11 @@ RUN vp install --frozen-lockfile
173
142
  RUN vp exec playwright install --with-deps chromium
174
143
  ```
175
144
 
176
- If Chromium crashes under load in CI, give the container more shared memory with
177
- `--ipc=host`; see the [Playwright Docker docs](https://playwright.dev/docs/docker).
145
+ If Chromium crashes under load in CI, give the container more shared memory with `--ipc=host`; see the [Playwright Docker docs](https://playwright.dev/docs/docker).
178
146
 
179
147
  ## Devcontainers
180
148
 
181
- Use the image as a ready-to-go development container with the toolchain
182
- preinstalled:
149
+ Use the image as a ready-to-go development container with the toolchain preinstalled:
183
150
 
184
151
  ```jsonc [.devcontainer/devcontainer.json]
185
152
  {
@@ -197,23 +164,8 @@ docker run --rm -it -v "$PWD:/app" -w /app ghcr.io/voidzero-dev/vite-plus vp bui
197
164
 
198
165
  ## Notes
199
166
 
200
- - **Node.js version**: provisioned from `.node-version`, `engines.node`, or
201
- `devEngines.runtime` at build time, so there is no Node.js-specific image tag. The
202
- dependency `COPY` uses a `.node-version*` glob so the file is optional: projects
203
- that pin via `engines.node`/`devEngines.runtime` need no `.node-version`, and
204
- those that use one have it available in every stage.
205
- - **Non-root user**: the image runs as the non-root `vp` user, so copy sources
206
- with `COPY --chown=vp:vp ...` as shown. Without it, `COPY` writes root-owned
207
- files that `vp install` cannot update (permission denied). The `vp` user has
208
- passwordless `sudo` for the occasional root step (installing extra apt packages
209
- or `playwright install --with-deps`), so you rarely need to switch the image
210
- user. The production runtime stage is a separate, vp-free base image, so this
211
- convenience does not reach your deployed image.
212
- - **Native addons**: the image includes a C/C++ build toolchain (`build-essential`,
213
- `python3`), so native dependencies such as `better-sqlite3` compile during
214
- `vp install`.
215
- - **glibc**: the image is glibc based so it uses the official, signature-verified
216
- Node.js builds.
217
- - **Custom base image**: to add `vp` to your own base image instead, run the
218
- installer: `curl -fsSL https://vite.plus | bash` (set `VP_VERSION` to pin a
219
- version).
167
+ - **Node.js version**: provisioned from `.node-version`, `engines.node`, or `devEngines.runtime` at build time, so there is no Node.js-specific image tag. The dependency `COPY` uses a `.node-version*` glob so the file is optional: projects that pin via `engines.node`/`devEngines.runtime` need no `.node-version`, and those that use one have it available in every stage.
168
+ - **Non-root user**: the image runs as the non-root `vp` user, so copy sources with `COPY --chown=vp:vp ...` as shown. Without it, `COPY` writes root-owned files that `vp install` cannot update (permission denied). The `vp` user has passwordless `sudo` for the occasional root step (installing extra apt packages or `playwright install --with-deps`), so you rarely need to switch the image user. The production runtime stage is a separate, vp-free base image, so this convenience does not reach your deployed image.
169
+ - **Native addons**: the image includes a C/C++ build toolchain (`build-essential`, `python3`), so native dependencies such as `better-sqlite3` compile during `vp install`.
170
+ - **glibc**: the image is glibc based so it uses the official, signature-verified Node.js builds.
171
+ - **Custom base image**: to add `vp` to your own base image instead, run the installer: `curl -fsSL https://vite.plus | bash` (set `VP_VERSION` to pin a version).
package/docs/guide/env.md CHANGED
@@ -1,12 +1,21 @@
1
1
  # Environment
2
2
 
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.
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. It belongs to the [global CLI](/guide/global-cli) and is not included in the project-local `vite-plus` package.
4
4
 
5
5
  ## Overview
6
6
 
7
+ Think of the project environment as two independently selected components:
8
+
9
+ - **Node.js** is the runtime used to execute JavaScript tools and scripts. Each project can declare the Node.js version it needs.
10
+ - **The package manager** installs and manages project dependencies. Each project can select npm, pnpm, Yarn, or Bun and declare its version.
11
+
12
+ For example, a project can use Node.js 24 with pnpm 10. Changing its Node.js version does not change its package-manager selection, and switching from pnpm to Yarn does not change its Node.js version. Vite+ resolves both components when you run a command so that you can move between projects without manually switching tools.
13
+
14
+ Vite+ connects these selections to your shell through **shims**: small launchers named `node`, `npm`, `pnpm`, `yarn`, and `bun`, along with their aliases. In managed mode, a shim resolves and launches the appropriate tool for the current project. Commands such as `vp install` use the project's selected package manager; invoking `pnpm` directly always runs pnpm, even in a project that selects another manager.
15
+
7
16
  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
17
 
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.
18
+ Use `vp env off` to disable managed mode for Node.js and package managers. See [Environment Modes](#environment-modes) below for details and how to switch to system tools.
10
19
 
11
20
  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
21
 
@@ -19,16 +28,18 @@ vp env pin node@24 pnpm@12 # Both components
19
28
  vp env pin 22.0.0 pnpm@10.18.0 # Also both components
20
29
  ```
21
30
 
22
- Vite+ checks the current directory first, then walks up through its parents. The nearest directory
23
- with a supported declaration wins. Within each directory, sources are checked in this order:
31
+ Use `vp env pin` to save a project's versions, `vp env default` to set fallback versions, and `vp env use` to override versions for the current shell. Run `vp env current` to see the resolved environment.
32
+
33
+ ## Node.js Selection
34
+
35
+ To select the project's Node.js version, Vite+ checks the current directory first, then walks up through its parents. The nearest directory with a supported declaration wins. Within each directory, sources are checked in this order:
24
36
 
25
37
  1. `.node-version` file
26
38
  2. `devEngines.runtime` in `package.json` (the [devEngines standard](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#devengines))
27
39
  3. `engines.node` in `package.json`
28
40
  4. `.nvmrc` file
29
41
 
30
- If no directory declares a version, Vite+ uses the global default (`vp env default`) and then the
31
- latest LTS.
42
+ If no directory declares a version, Vite+ uses the global default (`vp env default`) and then the latest LTS.
32
43
 
33
44
  `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.
34
45
 
@@ -44,6 +55,8 @@ pnpm config set --global runtimeOnFail ignore
44
55
  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
56
  :::
46
57
 
58
+ ## Package-Manager Selection
59
+
47
60
  Package-manager selection uses this priority:
48
61
 
49
62
  1. Explicit command override
@@ -76,16 +89,17 @@ VP_PNPM_VERSION=10.20.0 pnpm --version
76
89
 
77
90
  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
91
 
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.
92
+ 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 directly invoked npm shim keeps its Node-bundled fallback, while an explicit `vp env ... npm` family scope uses standalone npm's latest release.
93
+
94
+ ::: details Latest-version caching
95
+ When a named shim falls back to the latest release, the resolved version is cached for one hour. An expired cache remains available when the registry cannot be reached.
96
+ :::
80
97
 
81
- A fresh install uses the split platform layout by default. On Unix, Vite+
82
- stores managed runtimes and related files in `~/.local/share/vite-plus`. It
83
- stores executables in the Vite+-owned `~/.local/share/vite-plus/bin` directory.
84
- On Windows, Vite+ uses `%LOCALAPPDATA%\vite-plus\data` for data and
85
- `%LOCALAPPDATA%\vite-plus\bin` for executables. Vite+ does not move an existing
86
- `~/.vite-plus` install. `VP_HOME` puts all categories under one custom root.
98
+ ## Environment Modes
99
+
100
+ 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.
87
101
 
88
- If you want to keep that behavior, run:
102
+ To enable managed mode, run:
89
103
 
90
104
  ```bash
91
105
  vp env on
@@ -124,8 +138,7 @@ PowerShell needs to dot-source the generated setup script in the current shell b
124
138
  . "$env:APPDATA\vite-plus\env.ps1"
125
139
  ```
126
140
 
127
- If an older Vite+ install uses `%USERPROFILE%\.vite-plus`, source the `env.ps1`
128
- file in that directory instead.
141
+ If an older Vite+ install uses `%USERPROFILE%\.vite-plus`, source the `env.ps1` file in that directory instead.
129
142
 
130
143
  Add that line to the end of your PowerShell `$PROFILE` to apply it automatically in new shells. It does not require elevated privileges.
131
144
 
@@ -151,10 +164,7 @@ vp-use --unset
151
164
 
152
165
  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.
153
166
 
154
- In CI, `vp env use` can run without shell initialization. It writes a temporary
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.
167
+ In CI, `vp env use` can run without shell initialization. It writes a temporary session file per runtime or package manager in the resolved state directory, such as `.session-node-version` or `.session-pnpm-version`. Later shim calls in the same job use these files to resolve the same environment.
158
168
 
159
169
  ### Manage
160
170