vite-plus 0.3.2 → 1.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (149) hide show
  1. package/LICENSE +35 -146
  2. package/README.md +3 -3
  3. package/binding/index.cjs +140 -55
  4. package/binding/index.d.cts +49 -0
  5. package/dist/{agent-C59HKB4Y.js → agent-Dinpyd-k.js} +6 -5
  6. package/dist/bin.js +48 -18
  7. package/dist/config/bin.js +2 -2
  8. package/dist/constants-CiKwrA0v.js +356 -0
  9. package/dist/create/bin.js +96 -71
  10. package/dist/{define-config-DPNEJxPz.d.ts → define-config-B9usMnEa.d.ts} +51 -10
  11. package/dist/{define-config-DpAPETDf.cjs → define-config-CBccpane.cjs} +173 -44
  12. package/dist/{define-config-DAaCa0U_.js → define-config-jhuYJ7Tb.js} +158 -42
  13. package/dist/define-config.cjs +1 -1
  14. package/dist/define-config.d.ts +1 -1
  15. package/dist/define-config.js +1 -1
  16. package/dist/documentation-DqcZSthV.js +11 -0
  17. package/dist/{editor-QOIGtmH4.js → editor-DMBczTdj.js} +216 -152
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.d.ts +1 -1
  20. package/dist/index.js +1 -1
  21. package/dist/{json-cULBl7Pi.js → json-JP24qHUF.js} +14 -6
  22. package/dist/lint-plugins.cjs +1 -1
  23. package/dist/migration/bin.js +3122 -15
  24. package/dist/{oxlint-plugin-config-BU42tr8y.js → oxlint-plugin-config-BgsDA6ua.js} +1 -1
  25. package/dist/oxlint-plugin.js +9 -7
  26. package/dist/pack-bin.js +1 -1
  27. package/dist/{package-BB-Jh_z3.js → package-B85H2Nw0.js} +6 -2
  28. package/dist/{vitest-ecosystem-BiRqcaRI.js → package-overrides-Dpn4scvN.js} +1 -7
  29. package/dist/{prompts-CujFOJXu.js → prompts-CQobX7uP.js} +2 -2
  30. package/dist/{resolve-vite-config-CHHjsjKJ.js → resolve-vite-config-BUFUmi8h.js} +2 -2
  31. package/dist/{resolve-vite-config-6Nox70uP.js → resolve-vite-config-I8fmpR7I.js} +1 -1
  32. package/dist/staged/bin.js +1205 -3317
  33. package/dist/sync-versions/bin.js +3 -2
  34. package/dist/sync-versions/bin.mjs +17 -2
  35. package/dist/test/browser/context.js +1 -1
  36. package/dist/test/browser/providers/playwright/context.js +1 -1
  37. package/dist/test/browser/providers/preview/context.js +1 -1
  38. package/dist/test/browser-playwright/context.js +1 -1
  39. package/dist/test/browser-preview/context.js +1 -1
  40. package/dist/test/context.d.ts +2 -942
  41. package/dist/test/context.js +1 -1
  42. package/dist/test/internal/traces.js +1 -0
  43. package/dist/test/locators.d.ts +2 -294
  44. package/dist/test/matchers.d.ts +2 -29
  45. package/dist/test/mocker.d.ts +2 -0
  46. package/dist/test/mocker.js +1 -0
  47. package/dist/test/{browser-webdriverio/context.js → plugins/browser-context.d.ts} +1 -0
  48. package/dist/test/plugins/browser-context.js +1 -1
  49. package/dist/test/plugins/browser-locators.d.ts +2 -0
  50. package/dist/test/plugins/browser-playwright.d.ts +2 -0
  51. package/dist/test/plugins/browser-preview.d.ts +2 -0
  52. package/dist/test/plugins/browser.d.ts +2 -0
  53. package/dist/test/plugins/mocker-automock.d.ts +2 -0
  54. package/dist/test/plugins/mocker-browser.d.ts +2 -0
  55. package/dist/test/plugins/mocker-node.d.ts +2 -0
  56. package/dist/test/plugins/mocker-redirect.d.ts +2 -0
  57. package/dist/test/plugins/mocker-register.d.ts +2 -0
  58. package/dist/test/plugins/mocker-transforms.d.ts +2 -0
  59. package/dist/test/plugins/mocker.d.ts +2 -0
  60. package/dist/test/plugins/pretty-format.d.ts +2 -0
  61. package/dist/test/plugins/snapshot-environment.d.ts +2 -0
  62. package/dist/test/plugins/snapshot-manager.d.ts +2 -0
  63. package/dist/test/plugins/snapshot.d.ts +2 -0
  64. package/dist/test/plugins/spy.d.ts +2 -0
  65. package/dist/test/plugins/utils-constants.d.ts +2 -0
  66. package/dist/test/plugins/utils-diff.d.ts +2 -0
  67. package/dist/test/plugins/utils-display.d.ts +2 -0
  68. package/dist/test/plugins/utils-error.d.ts +2 -0
  69. package/dist/test/plugins/utils-helpers.d.ts +2 -0
  70. package/dist/test/plugins/utils-offset.d.ts +2 -0
  71. package/dist/test/plugins/utils-resolver.d.ts +2 -0
  72. package/dist/test/plugins/utils-serialize.d.ts +2 -0
  73. package/dist/test/plugins/utils-source-map-node.d.ts +2 -0
  74. package/dist/test/plugins/utils-source-map.d.ts +2 -0
  75. package/dist/test/plugins/utils-timers.d.ts +2 -0
  76. package/dist/test/plugins/utils.d.ts +2 -0
  77. package/dist/toolchain.js +10 -10
  78. package/dist/toolchain.json +10 -10
  79. package/dist/{tsconfig-DCtWfQPA.js → tsconfig-Buo0RSzz.js} +8 -4
  80. package/dist/{tsconfig-MXktI3SX.js → tsconfig-C1VeTG9k.js} +1 -1
  81. package/dist/version.js +5 -3
  82. package/dist/versions.js +5 -5
  83. package/dist/vitest-ecosystem-BU0AqZq-.js +23 -0
  84. package/dist/vitest-v5-entry-points-DthU1e_O.js +25 -0
  85. package/docs/config/fmt.md +2 -2
  86. package/docs/config/lint.md +2 -2
  87. package/docs/config/run.md +1 -1
  88. package/docs/config/staged.md +1 -2
  89. package/docs/guide/check.md +2 -0
  90. package/docs/guide/ci.md +28 -31
  91. package/docs/guide/commit-hooks.md +18 -34
  92. package/docs/guide/create.md +1 -2
  93. package/docs/guide/docker.md +20 -68
  94. package/docs/guide/env.md +47 -32
  95. package/docs/guide/fmt.md +4 -2
  96. package/docs/guide/global-cli.md +426 -0
  97. package/docs/guide/ide-integration.md +1 -2
  98. package/docs/guide/implode.md +14 -1
  99. package/docs/guide/index.md +38 -35
  100. package/docs/guide/install.md +18 -20
  101. package/docs/guide/lint.md +6 -10
  102. package/docs/guide/local-cli.md +123 -0
  103. package/docs/guide/migrate-rules.md +104 -297
  104. package/docs/guide/migrate.md +82 -59
  105. package/docs/guide/monorepo.md +5 -1
  106. package/docs/guide/run.md +1 -1
  107. package/docs/guide/test.md +2 -0
  108. package/docs/guide/troubleshooting.md +6 -11
  109. package/docs/guide/upgrade-project.md +61 -0
  110. package/docs/guide/upgrade.md +17 -62
  111. package/docs/guide/vitest-v5.md +221 -0
  112. package/package.json +67 -90
  113. package/bin/oxfmt +0 -33
  114. package/bin/oxlint +0 -38
  115. package/dist/cli-truncate-Bg3RDXpi.js +0 -865
  116. package/dist/constants-IhOditRA.js +0 -80
  117. package/dist/is-fullwidth-code-point-BUNlIICg.js +0 -8
  118. package/dist/log-update-CoW8Z4Dl.js +0 -491
  119. package/dist/strip-ansi-C3wrWz9t.js +0 -853
  120. package/dist/test/browser/providers/webdriverio/context.d.ts +0 -1
  121. package/dist/test/browser/providers/webdriverio/context.js +0 -1
  122. package/dist/test/browser/providers/webdriverio.d.ts +0 -77
  123. package/dist/test/browser/providers/webdriverio.js +0 -1
  124. package/dist/test/browser-webdriverio/context.d.ts +0 -1
  125. package/dist/test/browser-webdriverio.d.ts +0 -77
  126. package/dist/test/browser-webdriverio.js +0 -1
  127. package/dist/test/coverage.d.ts +0 -2
  128. package/dist/test/coverage.js +0 -1
  129. package/dist/test/environments.d.ts +0 -2
  130. package/dist/test/environments.js +0 -1
  131. package/dist/test/plugins/browser-webdriverio.js +0 -1
  132. package/dist/test/plugins/expect.js +0 -1
  133. package/dist/test/plugins/runner-types.js +0 -1
  134. package/dist/test/plugins/runner-utils.js +0 -1
  135. package/dist/test/plugins/runner.js +0 -1
  136. package/dist/test/reporters.d.ts +0 -2
  137. package/dist/test/reporters.js +0 -1
  138. package/dist/test/runners.d.ts +0 -2
  139. package/dist/test/runners.js +0 -1
  140. package/dist/test/snapshot.d.ts +0 -2
  141. package/dist/test/snapshot.js +0 -1
  142. package/dist/test/suite.d.ts +0 -2
  143. package/dist/test/suite.js +0 -1
  144. package/dist/tsgolint-path-CbDReEOx.js +0 -34
  145. package/dist/tsgolint-path.d.ts +0 -7
  146. package/dist/tsgolint-path.js +0 -2
  147. package/dist/wrap-ansi-DNjkuBEp.js +0 -157
  148. package/dist/wrap-ansi-DUi52C6W.js +0 -2
  149. package/docs/guide/installer-env-vars.md +0 -286
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
@@ -52,16 +65,16 @@ Package-manager selection uses this priority:
52
65
  4. `devEngines.packageManager`
53
66
  5. Lockfile or manager-specific configuration
54
67
  6. The named package manager's global default version
55
- 7. The named shim's latest release
68
+ 7. The named shim's latest release (Node.js' bundled version for `npm`)
56
69
 
57
70
  `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
71
 
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` |
72
+ | Variable | Shims |
73
+ | ----------------- | --------------------------- |
74
+ | `VP_NPM_VERSION` | `npm`, `npx` |
75
+ | `VP_PNPM_VERSION` | `pnpm`, `pnpx`, `pn`, `pnx` |
76
+ | `VP_YARN_VERSION` | `yarn`, `yarnpkg` |
77
+ | `VP_BUN_VERSION` | `bun`, `bunx` |
65
78
 
66
79
  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
80
 
@@ -76,16 +89,19 @@ 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`, `pnpx`, `pn`, and `pnx`; 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 npm shim falls back to Node's bundled npm. `vp env use npm` selects standalone npm's latest release for the current shell when no project version or global default is configured.
80
93
 
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.
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
+ :::
97
+
98
+ `pn` runs the same managed binary as `pnpm`, and `pnx` runs the same managed binary as `pnpx` (`pnpm dlx`). These aliases also work with managed pnpm versions older than v11.
99
+
100
+ ## Environment Modes
87
101
 
88
- If you want to keep that behavior, run:
102
+ 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.
103
+
104
+ To enable managed mode, run:
89
105
 
90
106
  ```bash
91
107
  vp env on
@@ -106,17 +122,20 @@ If you do not want Vite+ to manage Node.js first, run:
106
122
  vp env off
107
123
  ```
108
124
 
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.
125
+ This switches both components to system-first mode. Vite+ prefers system tools and falls back to managed installations. Mixed configurations compose: package-manager launchers that look up Node.js through PATH receive the runtime selected by the Node mode.
110
126
 
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.
127
+ 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.
112
128
 
113
129
  ## Commands
114
130
 
115
131
  ### Setup
116
132
 
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
133
+ - `vp env setup` creates tool shims and writes shell setup scripts.
134
+ - `vp env setup --refresh` recreates Vite+ shims and regenerates shell setup scripts using your saved preferences.
135
+ - `vp env on` / `vp env off` switches between Vite+-managed and system-first modes; append `node`, `pm`, `npm`, `pnpm`, `yarn`, or `bun` to narrow the change.
136
+ - `vp env print` prints PATH setup for both components; append a selector to print one.
137
+
138
+ Upgrades refresh the setup automatically. Open a new terminal or reload your shell setup script afterward.
120
139
 
121
140
  PowerShell needs to dot-source the generated setup script in the current shell before `vp env use` can affect only that shell session:
122
141
 
@@ -124,8 +143,7 @@ PowerShell needs to dot-source the generated setup script in the current shell b
124
143
  . "$env:APPDATA\vite-plus\env.ps1"
125
144
  ```
126
145
 
127
- If an older Vite+ install uses `%USERPROFILE%\.vite-plus`, source the `env.ps1`
128
- file in that directory instead.
146
+ If an older Vite+ install uses `%USERPROFILE%\.vite-plus`, source the `env.ps1` file in that directory instead.
129
147
 
130
148
  Add that line to the end of your PowerShell `$PROFILE` to apply it automatically in new shells. It does not require elevated privileges.
131
149
 
@@ -151,10 +169,7 @@ vp-use --unset
151
169
 
152
170
  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
171
 
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.
172
+ 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
173
 
159
174
  ### Manage
160
175
 
package/docs/guide/fmt.md CHANGED
@@ -20,9 +20,11 @@ vp fmt . --write
20
20
 
21
21
  Put formatting configuration directly in the `fmt` block in the root `vite.config.ts` so all your configuration stays in one place. We do not recommend using `.oxfmtrc.json` with Vite+.
22
22
 
23
- 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.
23
+ When the workspace-root config has a `fmt` block, `vp fmt` and `vp check` use it even when run from a package directory. Package configs cannot replace the root format settings. Commands keep the package working directory, so relative file arguments retain their meaning. Use [`fmt.overrides`](/guide/monorepo#format-overrides) for file- or package-specific options.
24
24
 
25
- For editors, disable nested formatter configs so format-on-save uses the root Vite+ `fmt` block:
25
+ An explicit `vp fmt -c <path>` or `vp fmt --config <path>` selects another config. Otherwise, when running from the workspace root or when the root config has no `fmt` block, Oxfmt discovers the nearest `vite.config.*` file with a `fmt` block. Supported extensions are `.js`, `.mjs`, `.ts`, `.cjs`, `.mts`, and `.cts`. Nested configs do not override settings for individual files.
26
+
27
+ For editors, disable nested formatter configs to prevent per-file overrides:
26
28
 
27
29
  ```json [.vscode/settings.json]
28
30
  {
@@ -0,0 +1,426 @@
1
+ <script setup lang="ts">
2
+ import { getScrollOffset } from 'vitepress';
3
+ import { nextTick, onMounted, onUnmounted } from 'vue';
4
+
5
+ function openTarget() {
6
+ let target: HTMLElement | null;
7
+ try {
8
+ target = document.getElementById(decodeURIComponent(location.hash.slice(1)));
9
+ } catch {
10
+ return;
11
+ }
12
+ if (!target?.closest('details')) return;
13
+
14
+ for (let details = target.closest('details'); details; details = details.parentElement?.closest('details') ?? null) {
15
+ details.open = true;
16
+ }
17
+
18
+ // VitePress cannot measure a heading inside closed details. Correct the scroll after revealing it.
19
+ requestAnimationFrame(() => {
20
+ if (!target.isConnected) return;
21
+ const top = window.scrollY + target.getBoundingClientRect().top - getScrollOffset()
22
+ + Number.parseInt(window.getComputedStyle(target).paddingTop, 10);
23
+ window.scrollTo(0, top);
24
+ });
25
+ }
26
+
27
+ function onAnchorClick(event: MouseEvent) {
28
+ if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) return;
29
+ const link = event.target instanceof Element ? event.target.closest('a') : null;
30
+ // Clicking the current hash again does not emit hashchange.
31
+ if (link?.href === location.href) openTarget();
32
+ }
33
+
34
+ onMounted(async () => {
35
+ window.addEventListener('hashchange', openTarget);
36
+ document.addEventListener('click', onAnchorClick);
37
+ await nextTick();
38
+ openTarget();
39
+ });
40
+
41
+ onUnmounted(() => {
42
+ window.removeEventListener('hashchange', openTarget);
43
+ document.removeEventListener('click', onAnchorClick);
44
+ });
45
+ </script>
46
+
47
+ # Global CLI
48
+
49
+ The global CLI is a standalone `vp` binary for machine-level runtime and package management. It includes a Vite+ toolchain, does not require Node.js to be installed first, and can be used without adding `vite-plus` to a project.
50
+
51
+ Choose the global CLI when you want one command available across projects for any combination of:
52
+
53
+ - managing Node.js and package-manager versions
54
+ - selecting and downloading package managers
55
+ - installing dependencies and running package binaries
56
+ - running `package.json` scripts and cached workspace tasks
57
+ - using the Vite+ frontend toolchain without pinning it in every project
58
+
59
+ Installing the global CLI does not require you to adopt the project-local package. You can use it only for runtime management, package management, and the task runner if that is all you need.
60
+
61
+ ## Install
62
+
63
+ ::: code-group
64
+
65
+ ```bash [macOS / Linux]
66
+ curl -fsSL https://vite.plus | bash
67
+ ```
68
+
69
+ ```powershell [Windows]
70
+ irm https://vite.plus/ps1 | iex
71
+ ```
72
+
73
+ :::
74
+
75
+ On Windows, you can instead download and run [`vp-setup.exe`](https://setup.viteplus.dev).
76
+
77
+ After installation, open a new shell and run:
78
+
79
+ ```bash
80
+ vp help
81
+ ```
82
+
83
+ When you enable environment management during installation, Vite+ records managed mode for Node.js and the npm, pnpm, Yarn, and Bun shims. Run `vp env off` to prefer system tools, or scope the change with `vp env off node` or `vp env off pm`.
84
+
85
+ ::: details Installer Environment Variables & Options
86
+
87
+ The Vite+ installers (`vp-setup.exe`, `install.ps1`, and `install.sh`) and the installed `vp` CLI read the environment variables below.
88
+
89
+ ### Installation Variables
90
+
91
+ These variables control the installer scripts and the standalone Windows installer (`vp-setup.exe`).
92
+
93
+ #### `VP_VERSION`
94
+
95
+ - **Purpose**: Version to install
96
+ - **Default**: `latest`
97
+ - **CLI equivalent**: `--version`
98
+ - **Note**: Vite+ 0.2.x and earlier do not support the split directory layout. The installer always puts these releases in the monolithic root (`VP_HOME` or `~/.vite-plus`). This rule also applies to a fresh machine. The installer checks the downloaded binary and prints a notice.
99
+ - **Example**:
100
+
101
+ ```bash
102
+ # Unix
103
+ curl -fsSL https://vite.plus | VP_VERSION=1.2.3 bash
104
+ ```
105
+
106
+ ```powershell
107
+ # PowerShell
108
+ $env:VP_VERSION = "1.2.3"; irm https://vite.plus/ps1 | iex
109
+ ```
110
+
111
+ #### `VP_HOME`
112
+
113
+ - **Purpose**: Optional pin for the single-root layout. Set it to an absolute path. Vite+ then puts bin, data, cache, config, and state under that directory. The installed CLI reads the same variable. See [Environment](/guide/env).
114
+ - **Default**: unset. Vite+ reuses an existing install in `~/.vite-plus` on Unix or `%USERPROFILE%\.vite-plus` on Windows. The directory must contain a `current` link. Otherwise, a fresh install uses the split platform layout. On Unix, it uses `~/.local/share/vite-plus` and its Vite+-owned `bin` subdirectory. On Windows, it uses `%LOCALAPPDATA%\vite-plus\data` and `%LOCALAPPDATA%\vite-plus\bin`.
115
+ - **Example**:
116
+
117
+ ```bash
118
+ # Unix
119
+ curl -fsSL https://vite.plus | VP_HOME=/opt/vite-plus bash
120
+ ```
121
+
122
+ ```powershell
123
+ # PowerShell
124
+ $env:VP_HOME = "D:\vite-plus"; irm https://vite.plus/ps1 | iex
125
+ ```
126
+
127
+ #### `VP_BIN_DIR` / `VP_DATA_DIR` / `VP_CACHE_DIR`
128
+
129
+ - **Purpose**: Internal absolute directory overrides for integrations that must pin a split install. Set all three variables together. The installer rejects an incomplete group. Vite+ ignores the group when `VP_HOME` is set or when it reuses an existing `~/.vite-plus` install.
130
+ - **Default**: unset (XDG / platform defaults)
131
+ - **Persistence**: The generated environment file does not export these variables. An integration that uses them must provide the complete group to each Vite+ process.
132
+ - **Example**:
133
+
134
+ ```bash
135
+ export VP_DATA_DIR=$HOME/vite-plus-data
136
+ export VP_BIN_DIR=$VP_DATA_DIR/bin
137
+ export VP_CACHE_DIR=$HOME/.cache/vite-plus
138
+ curl -fsSL https://vite.plus | bash
139
+ ```
140
+
141
+ #### `NPM_CONFIG_REGISTRY`
142
+
143
+ - **Purpose**: Custom npm registry URL
144
+ - **Default**: `https://registry.npmjs.org`
145
+ - **CLI equivalent**: `--registry`
146
+ - **Example**:
147
+ ```bash
148
+ curl -fsSL https://vite.plus | NPM_CONFIG_REGISTRY=https://registry.npmmirror.com bash
149
+ ```
150
+
151
+ #### `VP_NODE_MANAGER`
152
+
153
+ - **Purpose**: Control Node.js version manager setup during installation.
154
+ - **Values**: `yes` or `no`
155
+ - **Default**: Auto-detected
156
+ - **CLI equivalent**: `--no-node-manager` (inverted)
157
+ - **Example**:
158
+ ```bash
159
+ # Skip Node.js manager setup in CI
160
+ curl -fsSL https://vite.plus | VP_NODE_MANAGER=no bash
161
+ ```
162
+
163
+ #### `VP_PM_MANAGER`
164
+
165
+ - **Purpose**: Set the management preference for all four package-manager families: npm, pnpm, Yarn, and Bun.
166
+ - **Values**: `yes` uses Vite+ management; `no` prefers system tools, with managed tools as a fallback when a system tool is unavailable.
167
+ - **Default**: Unset. The installer's combined Node.js and package-manager choice remains the default. With the script installers, setting only `VP_NODE_MANAGER` preserves existing package-manager preferences.
168
+
169
+ #### `VP_NPM_MANAGER` / `VP_PNPM_MANAGER` / `VP_YARN_MANAGER` / `VP_BUN_MANAGER`
170
+
171
+ - **Purpose**: Set the management preference for an individual package-manager family. Each variable overrides `VP_PM_MANAGER` for that family.
172
+ - **Values**: `yes` or `no`, with the same meaning as `VP_PM_MANAGER`.
173
+ - **Default**: Unset (use `VP_PM_MANAGER`, then the combined installer choice, or preserve the existing preference).
174
+ - **Example**:
175
+
176
+ ```bash
177
+ # Keep system Node.js and package managers, but let Vite+ manage pnpm.
178
+ curl -fsSL https://vite.plus | VP_NODE_MANAGER=no VP_PM_MANAGER=no VP_PNPM_MANAGER=yes bash
179
+ ```
180
+
181
+ These management variables are installation choices, saved in Vite+'s config. The interactive prompt still controls both Node.js and package managers; explicit package-manager variables override that combined choice. The standalone `vp-setup` installer uses its existing combined option as the default for both variables, in interactive and silent installations alike. In-place upgrades preserve the saved choices. Unrecognized values are ignored. They select management behavior, not package-manager versions, and do not prevent the installer from creating shims. Older releases installed through the legacy installer retain their original behavior.
182
+
183
+ #### `VP_PR_VERSION`
184
+
185
+ - **Purpose**: Install a preview build from a pull request or commit SHA
186
+ - **Values**: PR number or commit SHA
187
+ - **Default**: None
188
+ - **Details**: [Global `vp` Preview](/guide/upgrade#global-vp-preview)
189
+
190
+ #### Development variables
191
+
192
+ Use `VP_LOCAL_TGZ` and `VP_LOCAL_BINARY` when you develop Vite+ itself. `VP_LOCAL_TGZ` specifies a local `vite-plus.tgz` file. `VP_LOCAL_BINARY` specifies a local `vp` binary. The installers use these files for the local build. They use `VP_DUMP_DIRS=1` to get the layout mode and all five `EnvConfig` category roots from the selected binary. They do not resolve the directory variables. The installers set `VP_INSTALL_STOP`; do not set it manually.
193
+
194
+ ### Runtime Variables
195
+
196
+ These variables configure the installed Vite+ CLI. `VP_HOME` (above) also applies at runtime.
197
+
198
+ #### `VP_NODE_DIST_MIRROR`
199
+
200
+ - **Purpose**: Node.js distribution mirror URL
201
+ - **Default**: `https://nodejs.org/dist`
202
+ - **Details**: [Custom Node.js Mirror](/guide/env#custom-node-js-mirror)
203
+
204
+ #### `VP_NODE_VERSION`
205
+
206
+ - **Purpose**: Override Node.js version
207
+ - **Default**: None (auto-detected)
208
+ - **Example**:
209
+ ```bash
210
+ # Run a command with a specific Node.js version
211
+ VP_NODE_VERSION=22 vp env exec node -v
212
+ ```
213
+
214
+ #### `VP_PACKAGE_MANAGER`
215
+
216
+ - **Purpose**: Override the selected package manager and version
217
+ - **Default**: None (resolved from the project or global default)
218
+ - **Format**: `npm|pnpm|yarn|bun@<version>`
219
+ - **Example**:
220
+ ```bash
221
+ VP_PACKAGE_MANAGER=pnpm@10.18.0 vp install
222
+ ```
223
+
224
+ #### `VP_NODE_SKIP_SIGNATURE_VERIFY`
225
+
226
+ - **Purpose**: Skip PGP signature verification of Node.js downloads
227
+ - **Values**: Any non-empty value
228
+ - **Default**: None (verification enabled)
229
+ - **Details**: [Node.js Signature Verification](/guide/env#node-js-signature-verification)
230
+
231
+ #### `VP_DOWNLOAD_TIMEOUT`
232
+
233
+ - **Purpose**: Per-request timeout, in seconds, for large downloads such as Node.js runtimes and package-manager tarballs
234
+ - **Values**: Positive integer, at most `86400` (24 hours); invalid values are ignored with a warning
235
+ - **Default**: `600` (10 minutes)
236
+ - **Example**:
237
+ ```bash
238
+ # Allow up to 30 minutes per download on a slow connection
239
+ VP_DOWNLOAD_TIMEOUT=1800 vp env install 22
240
+ ```
241
+
242
+ #### `VP_SHELL`
243
+
244
+ - **Purpose**: Specify the current shell
245
+ - **Default**: Auto-detected
246
+ - **Example**:
247
+ ```bash
248
+ VP_SHELL=bash vp env print
249
+ ```
250
+
251
+ #### `VP_BYPASS`
252
+
253
+ - **Purpose**: Bypass the Vite+ shim and use the system tool
254
+ - **Values**: `PATH`-style list of directories to bypass
255
+ - **Default**: None
256
+ - **Example**:
257
+ ```bash
258
+ VP_BYPASS=/usr/local/bin node -v
259
+ ```
260
+
261
+ #### Internal variables
262
+
263
+ Vite+ sets additional `VP_*` variables during shim dispatch and shell integration (recursion guards, active-version records, wrapper flags); do not set them manually.
264
+
265
+ ### TLS/CA Configuration
266
+
267
+ #### `SSL_CERT_FILE` / `NODE_EXTRA_CA_CERTS`
268
+
269
+ - **Purpose**: Path to PEM bundle of extra CA certificates (`NODE_EXTRA_CA_CERTS` is the Node.js convention)
270
+ - **Default**: System trust store
271
+ - **Example**:
272
+ ```bash
273
+ export SSL_CERT_FILE=/path/to/custom-ca.pem
274
+ ```
275
+
276
+ #### `VP_INSECURE_TLS`
277
+
278
+ - **Purpose**: Disable HTTPS certificate verification
279
+ - **Values**: Any non-empty value (`1`, `true`, `yes`)
280
+ - **Default**: None (verification enabled)
281
+ - **Warning**: Diagnostic escape hatch only; do not use in production
282
+ - **Example**:
283
+ ```bash
284
+ VP_INSECURE_TLS=1 vp env install 22
285
+ ```
286
+
287
+ ### Logging and Debugging
288
+
289
+ #### `VP_LOG`
290
+
291
+ - **Purpose**: Log filter string for `tracing_subscriber`
292
+ - **Installer behavior**: When `CI=true`, `install.sh` hides shell file errors. Set `VP_LOG=trace` to show these errors.
293
+ - **Default**: None
294
+ - **Example**:
295
+ ```bash
296
+ VP_LOG=debug vp dev
297
+ VP_LOG=vt=trace vp build
298
+ ```
299
+
300
+ #### `VP_DEBUG_SHIM`
301
+
302
+ - **Purpose**: Enable debug output for shim dispatch
303
+ - **Values**: Any non-empty value
304
+ - **Default**: None
305
+ - **Example**:
306
+ ```bash
307
+ VP_DEBUG_SHIM=1 node -v
308
+ ```
309
+
310
+ ### Standard Environment Variables
311
+
312
+ Vite+ also respects these standard environment variables:
313
+
314
+ #### Nushell and XDG directories
315
+
316
+ If you customize `XDG_DATA_HOME` or `XDG_CONFIG_HOME`, set them **before starting Nushell**, through your terminal application, operating system, or parent shell. This is a [Nushell startup requirement](https://www.nushell.sh/book/configuration.html#changing-default-directories); setting them only in `config.nu` or `env.nu` does not configure the running session's startup directories.
317
+
318
+ Assignments in those files still affect child processes. The Vite+ installer starts a child Nushell to locate its vendor autoload directory, so it can write `vite-plus.nu` to a directory that normal new sessions do not read. Installation can succeed while `vp` remains unavailable in those sessions.
319
+
320
+ If this happens, open your Nushell configuration with `config nu` and add a `source` line pointing to the installed Vite+ `env.nu` file. For a default fresh macOS or Linux installation without a custom `XDG_CONFIG_HOME`, use:
321
+
322
+ ```nu
323
+ source ~/.config/vite-plus/env.nu
324
+ ```
325
+
326
+ For a custom `XDG_CONFIG_HOME`, use the absolute path to `<XDG_CONFIG_HOME>/vite-plus/env.nu` as resolved during installation. For an installation under `VP_HOME` or an existing `~/.vite-plus` installation, use `<VP_HOME>/env.nu` or `~/.vite-plus/env.nu` instead. Replace placeholders with actual paths and quote paths containing spaces. Open a new Nushell session and run `vp help` to verify the configuration.
327
+
328
+ #### `CI`
329
+
330
+ - **Purpose**: Indicates running in CI environment
331
+ - **Effect**: Enables silent mode (`--yes`) for installers
332
+
333
+ #### `NO_COLOR`
334
+
335
+ - **Purpose**: Disable colored output
336
+ - **Effect**: Disables ANSI color codes
337
+
338
+ #### `HOME` / `USERPROFILE`
339
+
340
+ - **Purpose**: User home directory
341
+ - **Effect**: Base for the existing-install probe (`~/.vite-plus`) and for split platform defaults
342
+
343
+ ### Precedence
344
+
345
+ 1. CLI flags (highest priority)
346
+ 2. Environment variables
347
+ 3. Default values (lowest priority)
348
+
349
+ For example, `VP_VERSION=1.0.0 vp-setup.exe --version 2.0.0` installs version 2.0.0.
350
+
351
+ :::
352
+
353
+ ### Homebrew
354
+
355
+ For a Homebrew installation, the first `vp` command sets up your shell, shims, and environment-management preferences. It reuses Homebrew's binary and bundled JavaScript. Setup stores its completion state in your user directories and does not need write access to the Homebrew prefix.
356
+
357
+ Later commands reuse that setup while the installed binary remains unchanged. Generated shims follow Homebrew's public `vp` entrypoint when Homebrew replaces a version. Setup preserves your saved management preferences during this replacement.
358
+
359
+ To prefer your existing Node.js and package managers during the first run, use:
360
+
361
+ ```bash
362
+ VP_NODE_MANAGER=no VP_PM_MANAGER=no vp help
363
+ ```
364
+
365
+ After setup, use `vp env off` to change this preference. Commands that need missing runtimes or project dependencies can still download them.
366
+
367
+ Use Homebrew to [upgrade](/guide/upgrade#homebrew) or [remove](/guide/implode#homebrew) its package.
368
+
369
+ `vp env doctor` identifies the Homebrew installation and its binary path. It checks the `vp` command and the user shim directory on `PATH` separately. If only the shim directory is missing, follow its shell setup instructions to enable the shims.
370
+
371
+ ## Use It Without a Local Package
372
+
373
+ The global installation is enough for runtime, package-manager, and task-runner workflows:
374
+
375
+ ```bash
376
+ vp env pin lts # Pin and install Node.js for this project
377
+ vp install # Use the package manager declared by the project
378
+ vp run build # Run a package.json script or configured task
379
+ vp dlx create-vite # Download and run a package binary
380
+ ```
381
+
382
+ You do not need a local `vite-plus` dependency to run existing `package.json` scripts. Add the [project-local CLI](/guide/local-cli) when you want the frontend toolchain version recorded in the project's manifest and lockfile.
383
+
384
+ ## Use Both CLIs Together
385
+
386
+ The global CLI and the project-local `vite-plus` package work together. You keep using the same `vp` command, while each project can choose its own toolchain version.
387
+
388
+ For development commands such as `vp dev`, `vp build`, `vp test`, and `vp run`, the global CLI delegates to the project's installed version when available:
389
+
390
+ | Current project | Toolchain used by `vp` |
391
+ | ----------------------------------- | --------------------------------- |
392
+ | Has `vite-plus` installed locally | The project's installed toolchain |
393
+ | Does not have `vite-plus` installed | The globally installed toolchain |
394
+
395
+ In a monorepo, the local installation can be shared at the workspace root. You do not need to install `vite-plus` separately in every package.
396
+
397
+ For example, if a project has Vite+ version A installed and your global installation is version B, `vp build` uses version A's toolchain. Upgrading the global installation does not change that project's installed toolchain.
398
+
399
+ Package-manager commands such as `vp install` and `vp add` use the global CLI. Commands for managing your environment or global installation, such as `vp env`, `vp upgrade`, and `vp implode`, also stay with the global CLI regardless of the project's version.
400
+
401
+ To see which toolchain is selected for your current project, run `vp toolchain`. Use `vp toolchain --global` to inspect the global installation.
402
+
403
+ ## Next Steps
404
+
405
+ - [Environment](/guide/env) covers Node.js and package-manager selection, pinning, shims, and managed installations.
406
+ - [Package Management](/guide/install) covers pnpm, npm, Yarn, and Bun workflows.
407
+ - [Run](/guide/run) covers package scripts and cached workspace tasks.
408
+ - [Upgrading Vite+](/guide/upgrade) explains global CLI upgrades. See [Update Vite+](/guide/upgrade-project) for project-local upgrades.
409
+ - [Removing Vite+](/guide/implode) removes the global binary and its managed data.
410
+
411
+ ::: details Platform support
412
+
413
+ Prebuilt binaries are distributed for:
414
+
415
+ - Linux x64 and arm64 with glibc
416
+ - Windows x64 and arm64
417
+ - macOS x64 and arm64
418
+ - Linux x64 and arm64 with musl
419
+
420
+ If a prebuilt binary is not available for your platform, installation fails with an error. On Alpine Linux, install `libstdc++` before using the managed [unofficial Node.js builds](https://unofficial-builds.nodejs.org/):
421
+
422
+ ```sh
423
+ apk add libstdc++
424
+ ```
425
+
426
+ :::
@@ -120,8 +120,7 @@ For the best Vite+ experience with JetBrains IDEs such as IntelliJ & WebStorm, i
120
120
  When you create or migrate a project, Vite+ prompts you to choose whether you want the editor config written for JetBrains IDEs.
121
121
 
122
122
  ::: tip Vite+ does not merge with existing config files
123
- Due to some complexities with merging XML files, Vite+ currently does not merge your current files if the files already exist.
124
- You'll be given the opportunity to replace any existing files, instead of merging.
123
+ Due to some complexities with merging XML files, Vite+ currently does not merge your current files if the files already exist. You'll be given the opportunity to replace any existing files, instead of merging.
125
124
  :::
126
125
 
127
126
  You can also manually set up the IDE configuration to match your Vite+ setup:
@@ -1,6 +1,6 @@
1
1
  # Removing Vite+
2
2
 
3
- Use `vp implode` to remove `vp` and all related Vite+ data from your machine.
3
+ Use `vp implode` to remove the Vite+-managed [global `vp` installation](/guide/global-cli) and related user data from your machine. It does not remove `vite-plus` dependencies from projects or packages owned by Homebrew.
4
4
 
5
5
  ## Overview
6
6
 
@@ -21,3 +21,16 @@ Skip the confirmation prompt with:
21
21
  ```bash
22
22
  vp implode --yes
23
23
  ```
24
+
25
+ ## Homebrew
26
+
27
+ Run `vp implode` first to remove Vite+-managed runtimes, global packages, configuration, shims, and shell entries. Then remove the Homebrew package:
28
+
29
+ ```bash
30
+ vp implode
31
+ brew uninstall vite-plus
32
+ ```
33
+
34
+ The confirmation prompt explains that the Homebrew package will remain installed. After cleanup, `vp implode` directs you to `brew uninstall vite-plus`.
35
+
36
+ Restart your terminal before you run `vp` again. In Bash, you can run `hash -r` instead to clear cached command paths. If the Homebrew package is still installed, the next `vp` command starts first-run setup again.