vite-plus 0.2.6 → 0.2.8
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/AGENTS.md +4 -0
- package/LICENSE +5 -1
- package/README.md +1 -1
- package/bin/vpr +3 -2
- package/binding/index.cjs +193 -80
- package/binding/index.d.cts +99 -8
- package/dist/agent-CI79DuSy.js +600 -0
- package/dist/bin.js +1367 -11
- package/dist/{cli-truncate-BVOlIIPy.js → cli-truncate-Bg3RDXpi.js} +0 -2
- package/dist/client/bundledDevClient.mjs +1 -0
- package/dist/config/bin.js +13 -126
- package/dist/{constants-CaXMuYUG.js → constants-BppDcRc1.js} +1 -1
- package/dist/create/bin.js +90 -77
- package/dist/{define-config-iGV0CGUk.cjs → define-config-CEm_MtvJ.cjs} +1 -1
- package/dist/{define-config-hV8qyU8p.js → define-config-DPnHe1Mx.js} +2 -2
- package/dist/{define-config-eLQH9us2.d.ts → define-config-DWoAkNdp.d.ts} +16 -0
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{dist-CKz3vcoG.js → dist-CSQWHI6y.js} +3 -8
- package/dist/dist-DT25H9pj.js +3 -0
- package/dist/{agent-0gFJkIKu.js → editor-CGWdbLgD.js} +709 -579
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-DiRs8ceZ.js → json-BU88uu6o.js} +2 -6
- package/dist/migration/bin.js +60 -50
- package/dist/{oxlint-plugin-config-CMSCIkks.js → oxlint-plugin-config-BHOzlwMw.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +2 -2
- package/dist/{package-CP5EUXlu.js → package-hV-77cBb.js} +2 -2
- package/dist/{tsconfig-Cac-NNdT.js → prompts-DYap08te.js} +32 -174
- package/dist/{resolve-vite-config-BY7PB-LW.js → resolve-vite-config-EWXclqvV.js} +1 -1
- package/dist/{rolldown-runtime-C7HZzL1F.js → rolldown-runtime-CMFfr-1z.js} +1 -1
- package/dist/staged/bin.js +20 -23
- package/dist/{help-YP84FSEz.js → terminal-CrqqK8WT.js} +39 -2
- package/dist/tsconfig-CVUKLfL8.js +151 -0
- package/dist/{tsgolint-path-B-yOos8p.js → tsgolint-path-eMZT-oea.js} +4 -2
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +5 -5
- package/dist/versions.js +5 -5
- package/docs/config/index.md +13 -0
- package/docs/config/staged.md +2 -1
- package/docs/guide/build.md +1 -1
- package/docs/guide/ci.md +28 -3
- package/docs/guide/commit-hooks.md +76 -9
- package/docs/guide/dev.md +4 -0
- package/docs/guide/env.md +8 -4
- package/docs/guide/index.md +1 -1
- package/docs/guide/install.md +2 -0
- package/docs/guide/installer-env-vars.md +3 -3
- package/docs/guide/migrate.md +11 -3
- package/docs/guide/monorepo.md +94 -6
- package/docs/guide/run.md +15 -0
- package/docs/guide/test.md +4 -0
- package/docs/guide/troubleshooting.md +9 -5
- package/package.json +18 -24
- package/dist/dist-CtM2JRbM.js +0 -3
- package/dist/editor-D4T70tKk.js +0 -675
- package/dist/terminal-uTv0ZaMr.js +0 -33
- package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
package/dist/version.js
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-
|
|
4
|
-
import { t as renderCliDoc } from "./help-YP84FSEz.js";
|
|
1
|
+
import { a as printHeader, c as renderCliDoc, r as log, t as accent } from "./terminal-CrqqK8WT.js";
|
|
2
|
+
import { m as version } from "./constants-BppDcRc1.js";
|
|
3
|
+
import { i as hasVitePlusDependency, n as detectPackageMetadata } from "./package-hV-77cBb.js";
|
|
5
4
|
import path from "node:path";
|
|
6
5
|
import fs from "node:fs";
|
|
7
6
|
//#region src/version.ts
|
|
@@ -30,7 +29,8 @@ function isVitePlusDeclaredInAncestors(cwd) {
|
|
|
30
29
|
while (true) {
|
|
31
30
|
const packageJsonPath = path.join(currentDir, "package.json");
|
|
32
31
|
try {
|
|
33
|
-
|
|
32
|
+
const pkg = JSON.parse(fs.readFileSync(packageJsonPath, "utf8"));
|
|
33
|
+
if (hasVitePlusDependency(pkg)) return true;
|
|
34
34
|
} catch {}
|
|
35
35
|
const parentDir = path.dirname(currentDir);
|
|
36
36
|
if (parentDir === currentDir) break;
|
package/dist/versions.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
export const versions = {
|
|
2
|
-
"vite": "8.
|
|
3
|
-
"rolldown": "1.2.
|
|
4
|
-
"tsdown": "0.22.
|
|
5
|
-
"oxlint": "1.
|
|
6
|
-
"oxfmt": "0.
|
|
2
|
+
"vite": "8.2.0",
|
|
3
|
+
"rolldown": "1.2.2",
|
|
4
|
+
"tsdown": "0.22.14",
|
|
5
|
+
"oxlint": "1.76.0",
|
|
6
|
+
"oxfmt": "0.61.0",
|
|
7
7
|
"oxlint-tsgolint": "7.0.2001",
|
|
8
8
|
"vitest": "4.1.10"
|
|
9
9
|
};
|
package/docs/config/index.md
CHANGED
|
@@ -33,3 +33,16 @@ Vite+ extends the basic Vite configuration with these additions:
|
|
|
33
33
|
- [`test`](/config/test) for Vitest
|
|
34
34
|
- [`pack`](/config/pack) for tsdown
|
|
35
35
|
- [`staged`](/config/staged) for staged-file checks
|
|
36
|
+
- [`defaultPackage`](#defaultpackage) for the default target of bare app commands at a workspace root
|
|
37
|
+
|
|
38
|
+
## defaultPackage
|
|
39
|
+
|
|
40
|
+
Default target directory for `vp dev` / `vp build` / `vp preview` / `vp pack` when you invoke them bare in the directory containing the config, an implicit [`vp -C <dir>`](/guide/monorepo#app-commands):
|
|
41
|
+
|
|
42
|
+
```ts [vite.config.ts]
|
|
43
|
+
export default {
|
|
44
|
+
defaultPackage: './frontend',
|
|
45
|
+
};
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
vp reads the values without executing the config, so `defaultPackage` also works at repository roots with no vite-plus dependency (for example a Laravel or Rails repo whose Vite app lives in `frontend/`, with vite-plus installed only there). That static read is why the values must stay plain string literals rather than expressions. An explicit `-C` or positional target always wins over the config.
|
package/docs/config/staged.md
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
# Staged Config
|
|
2
2
|
|
|
3
|
-
`vp staged`
|
|
3
|
+
`vp staged` reads staged-file rules from the `staged` block in `vite.config.ts`. See the
|
|
4
|
+
[Commit hooks guide](/guide/commit-hooks).
|
|
4
5
|
|
|
5
6
|
## Example
|
|
6
7
|
|
package/docs/guide/build.md
CHANGED
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
`vp build` runs the standard Vite production build through Vite+. Since it is directly based on Vite, the build pipeline and configuration model are the same as Vite. For more information about how Vite production builds work, see the [Vite guide](https://vite.dev/guide/build). Note that Vite+ uses Vite 8 and [Rolldown](https://rolldown.rs/) for builds.
|
|
8
8
|
|
|
9
9
|
::: info
|
|
10
|
-
`vp build` always runs the built-in Vite production build. If your project also has a `build` script in `package.json`, run `vp run build` when you want to run that script instead.
|
|
10
|
+
`vp build` always runs the built-in Vite production build. If your project also has a `build` script in `package.json`, run `vp run build` when you want to run that script instead. See [Built-in Commands vs Scripts](/guide/run#built-in-commands-vs-scripts).
|
|
11
11
|
:::
|
|
12
12
|
|
|
13
13
|
## Usage
|
package/docs/guide/ci.md
CHANGED
|
@@ -4,12 +4,12 @@ You can use `voidzero-dev/setup-vp` to use Vite+ in CI environments.
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
That means you usually do not need separate `setup-node`, package-manager setup, and manual dependency-cache steps in your workflow.
|
|
7
|
+
[`voidzero-dev/setup-vp`](https://github.com/voidzero-dev/setup-vp) provides integrations for GitHub Actions and GitLab CI/CD. Both install Vite+ and can install project dependencies. The GitHub Action can also set up Node.js and cache package manager data automatically, while the GitLab CI/CD template uses the Node.js runtime and cache configuration provided by the job.
|
|
10
8
|
|
|
11
9
|
## GitHub Actions
|
|
12
10
|
|
|
11
|
+
The GitHub Action sets up Vite+, the required Node.js version, and the package manager. This means you usually do not need separate `setup-node`, package-manager setup, or manual dependency caching steps in your workflow.
|
|
12
|
+
|
|
13
13
|
```yaml [.github/workflows/ci.yml]
|
|
14
14
|
- uses: voidzero-dev/setup-vp@v1
|
|
15
15
|
with:
|
|
@@ -27,6 +27,31 @@ With `cache: true`, `setup-vp` handles dependency caching for you automatically.
|
|
|
27
27
|
`setup-vp` caches package-manager data. To reuse Vite Task results across CI runs, add a separate [GitHub Actions cache for Vite Task](/guide/github-actions-cache).
|
|
28
28
|
:::
|
|
29
29
|
|
|
30
|
+
## GitLab CI/CD
|
|
31
|
+
|
|
32
|
+
Use the reusable `setup-vp` remote template in your GitLab CI/CD configuration:
|
|
33
|
+
|
|
34
|
+
```yaml [.gitlab-ci.yml]
|
|
35
|
+
include:
|
|
36
|
+
- remote: 'https://raw.githubusercontent.com/voidzero-dev/setup-vp/v1/gitlab/setup-vp.yml'
|
|
37
|
+
|
|
38
|
+
test:
|
|
39
|
+
extends: .setup-vp
|
|
40
|
+
image: node:24
|
|
41
|
+
script:
|
|
42
|
+
- vp check
|
|
43
|
+
- vp test
|
|
44
|
+
- vp build
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
The GitLab CI/CD integration differs from the GitHub Action in a few ways:
|
|
48
|
+
|
|
49
|
+
- The template does not install Node.js. Use a Node.js image, as shown above, or otherwise provide Node.js in the job.
|
|
50
|
+
- Configure dependency caching with the job's GitLab [`cache`](https://docs.gitlab.com/ci/yaml/#cache) keyword.
|
|
51
|
+
- Use a Unix-like runner environment with Bash and either `curl` or `wget`.
|
|
52
|
+
|
|
53
|
+
For advanced configuration and the complete input reference, see the [`setup-vp` GitLab CI/CD documentation](https://github.com/voidzero-dev/setup-vp#gitlab-cicd).
|
|
54
|
+
|
|
30
55
|
## Simplifying Existing Workflows
|
|
31
56
|
|
|
32
57
|
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,6 +1,7 @@
|
|
|
1
1
|
# Commit Hooks
|
|
2
2
|
|
|
3
|
-
Use `vp config` to install
|
|
3
|
+
Use `vp config` to install the Git hook dispatcher, and `vp staged` to run checks on staged
|
|
4
|
+
files.
|
|
4
5
|
|
|
5
6
|
## Overview
|
|
6
7
|
|
|
@@ -8,7 +9,7 @@ Vite+ supports commit hooks and staged-file checks without additional tooling.
|
|
|
8
9
|
|
|
9
10
|
Use:
|
|
10
11
|
|
|
11
|
-
- `vp config` to
|
|
12
|
+
- `vp config` to install generated hook infrastructure and related integrations
|
|
12
13
|
- `vp staged` to run checks against the files currently staged in Git
|
|
13
14
|
|
|
14
15
|
If you use [`vp create`](/guide/create) or [`vp migrate`](/guide/migrate), Vite+ prompts you to set this up for your project automatically.
|
|
@@ -17,7 +18,9 @@ If you use [`vp create`](/guide/create) or [`vp migrate`](/guide/migrate), Vite+
|
|
|
17
18
|
|
|
18
19
|
### `vp config`
|
|
19
20
|
|
|
20
|
-
`vp config` configures Vite+ for the current project. It installs
|
|
21
|
+
`vp config` configures Vite+ for the current project. It installs the generated Git hook
|
|
22
|
+
dispatcher and can also handle related project integration such as agent setup. By default,
|
|
23
|
+
project hooks are read from `.vite-hooks`:
|
|
21
24
|
|
|
22
25
|
```bash
|
|
23
26
|
vp config
|
|
@@ -26,16 +29,21 @@ vp config --no-hooks
|
|
|
26
29
|
vp config --no-agent
|
|
27
30
|
```
|
|
28
31
|
|
|
29
|
-
Use `--no-hooks` when you want `vp config` to leave
|
|
30
|
-
`--no-agent` when you want it to skip updates to existing coding agent instruction files. You
|
|
31
|
-
|
|
32
|
+
Use `--no-hooks` when you want `vp config` to leave the Git hook dispatcher unchanged. Use
|
|
33
|
+
`--no-agent` when you want it to skip updates to existing coding agent instruction files. You can
|
|
34
|
+
pass both flags when you want `vp config` to skip both setup steps.
|
|
32
35
|
|
|
33
|
-
You can also set `
|
|
36
|
+
You can also set `VP_GIT_HOOKS=0` to disable hook installation from lifecycle scripts such as
|
|
34
37
|
`prepare` or `postinstall`.
|
|
35
38
|
|
|
39
|
+
Project-owned hook scripts such as `.vite-hooks/pre-commit` should be committed to the repository.
|
|
40
|
+
The generated dispatcher and shims under `.vite-hooks/_` are ignored and recreated by `vp config`.
|
|
41
|
+
`vp config` does not create or modify project hook scripts or staged-file configuration.
|
|
42
|
+
|
|
36
43
|
### `vp staged`
|
|
37
44
|
|
|
38
|
-
`vp staged` runs staged-file checks using the `staged` config from `vite.config.ts`.
|
|
45
|
+
`vp staged` runs staged-file checks using the `staged` config from `vite.config.ts`. To run it
|
|
46
|
+
before each commit, add it to the project-owned pre-commit hook:
|
|
39
47
|
|
|
40
48
|
```bash
|
|
41
49
|
vp staged
|
|
@@ -43,6 +51,10 @@ vp staged --verbose
|
|
|
43
51
|
vp staged --fail-on-changes
|
|
44
52
|
```
|
|
45
53
|
|
|
54
|
+
```sh [.vite-hooks/pre-commit]
|
|
55
|
+
vp staged
|
|
56
|
+
```
|
|
57
|
+
|
|
46
58
|
## Configuration
|
|
47
59
|
|
|
48
60
|
Define staged-file checks in the `staged` block in `vite.config.ts`:
|
|
@@ -57,4 +69,59 @@ export default defineConfig({
|
|
|
57
69
|
});
|
|
58
70
|
```
|
|
59
71
|
|
|
60
|
-
This is the default Vite+ approach and should replace separate `lint-staged` configuration in most
|
|
72
|
+
This is the default Vite+ approach and should replace separate `lint-staged` configuration in most
|
|
73
|
+
projects. When you opt into hooks during `vp create`, Vite+ scaffolds both this configuration and
|
|
74
|
+
the corresponding pre-commit hook. During `vp migrate`, existing hook policy is preserved, and
|
|
75
|
+
the default is introduced only when no existing hook policy is found. Because
|
|
76
|
+
`vp staged` reads from `vite.config.ts`, your staged-file checks stay in the same place as your
|
|
77
|
+
lint, format, test, build, and task-runner config.
|
|
78
|
+
|
|
79
|
+
## Disabling Hooks in Specific Environments
|
|
80
|
+
|
|
81
|
+
The installed hooks check the environment on every run, so you can disable them per machine or per process without uninstalling anything. This is useful when commits happen outside development, for example through a flat file CMS or other processes.
|
|
82
|
+
|
|
83
|
+
### Environment variable
|
|
84
|
+
|
|
85
|
+
Set `VP_GIT_HOOKS=0` in the environment of the process that runs `git commit`, and every Vite+ hook exits immediately without running:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
VP_GIT_HOOKS=0 git commit -m "content update"
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`HUSKY=0` is honored the same way for ecosystem tooling compatibility. Setting `VP_GIT_HOOKS=0` in an environment also keeps `vp config` from reinstalling hooks there when a lifecycle script such as `prepare` runs.
|
|
92
|
+
|
|
93
|
+
### Init script
|
|
94
|
+
|
|
95
|
+
Before checking the environment variable, each hook sources an init script if one exists:
|
|
96
|
+
|
|
97
|
+
1. `$XDG_CONFIG_HOME/vite-plus/hooks-init.sh` (defaults to `~/.config/vite-plus/hooks-init.sh`)
|
|
98
|
+
2. `$XDG_CONFIG_HOME/husky/init.sh` as a fallback
|
|
99
|
+
|
|
100
|
+
To disable hooks for a whole machine, create the init script and export the variable there:
|
|
101
|
+
|
|
102
|
+
```sh [~/.config/vite-plus/hooks-init.sh]
|
|
103
|
+
export VP_GIT_HOOKS=0
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
Because the hook itself reads this file, it works even when the committing process does not inherit your shell environment, for example if a daemon or web server is making commits.
|
|
107
|
+
|
|
108
|
+
## Removing commit hooks
|
|
109
|
+
|
|
110
|
+
To stop using the Vite+ hook dispatcher:
|
|
111
|
+
|
|
112
|
+
1. Remove `vp config` from the `prepare` or `postinstall` script in `package.json`.
|
|
113
|
+
|
|
114
|
+
2. Unset the Git hooks path that points at the Vite+ dispatcher:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
git config --unset core.hooksPath
|
|
118
|
+
```
|
|
119
|
+
|
|
120
|
+
3. Remove the generated dispatcher directory (use your `--hooks-dir` value if you changed it):
|
|
121
|
+
|
|
122
|
+
```bash
|
|
123
|
+
rm -rf .vite-hooks/_
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Project-owned scripts such as `.vite-hooks/pre-commit` and the `staged` block in `vite.config.ts`
|
|
127
|
+
can remain for later use, or you can remove them separately if the project no longer needs them.
|
package/docs/guide/dev.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
`vp dev` runs the standard Vite development server through Vite+, so you keep the normal Vite dev experience while using the same CLI entry point as the rest of the toolchain. For more information about using and configuring the dev server, see the [Vite guide](https://vite.dev/guide/).
|
|
8
8
|
|
|
9
|
+
::: info
|
|
10
|
+
`vp dev` always runs the built-in Vite dev server. If your project also has a `dev` script in `package.json`, run `vp run dev` when you want to run that script instead. See [Built-in Commands vs Scripts](/guide/run#built-in-commands-vs-scripts).
|
|
11
|
+
:::
|
|
12
|
+
|
|
9
13
|
## Usage
|
|
10
14
|
|
|
11
15
|
```bash
|
package/docs/guide/env.md
CHANGED
|
@@ -6,12 +6,16 @@
|
|
|
6
6
|
|
|
7
7
|
Managed mode is on by default, so `node`, `npm`, and related shims resolve through Vite+ and pick the right Node.js version for the current project.
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Vite+ checks the current directory first, then walks up through its parents. The nearest directory
|
|
10
|
+
with a supported declaration wins. Within each directory, sources are checked in this order:
|
|
10
11
|
|
|
11
|
-
1. `.node-version` file
|
|
12
|
+
1. `.node-version` file
|
|
12
13
|
2. `devEngines.runtime` in `package.json` (the [devEngines standard](https://docs.npmjs.com/cli/v11/configuring-npm/package-json#devengines))
|
|
13
14
|
3. `engines.node` in `package.json`
|
|
14
|
-
4.
|
|
15
|
+
4. `.nvmrc` file
|
|
16
|
+
|
|
17
|
+
If no directory declares a version, Vite+ uses the global default (`vp env default`) and then the
|
|
18
|
+
latest LTS.
|
|
15
19
|
|
|
16
20
|
`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.
|
|
17
21
|
|
|
@@ -112,7 +116,7 @@ vp env print # Print shell snippet for this session
|
|
|
112
116
|
|
|
113
117
|
# Manage
|
|
114
118
|
vp env pin lts # Pin the project to the latest LTS release
|
|
115
|
-
vp env install # Install the version from .node-version or
|
|
119
|
+
vp env install # Install the version from .node-version, package.json, or .nvmrc
|
|
116
120
|
vp env default lts # Set the global default version
|
|
117
121
|
vp env use 20 # Use Node.js 20 for the current shell session
|
|
118
122
|
vp env use --unset # Remove the session override
|
package/docs/guide/index.md
CHANGED
|
@@ -92,7 +92,7 @@ Vite+ can handle the entire local frontend development cycle from starting a pro
|
|
|
92
92
|
|
|
93
93
|
- [`vp create`](/guide/create) creates new apps, packages, and monorepos.
|
|
94
94
|
- [`vp migrate`](/guide/migrate) moves existing projects onto Vite+.
|
|
95
|
-
- [`vp config`](/guide/commit-hooks)
|
|
95
|
+
- [`vp config`](/guide/commit-hooks) installs the Git hook dispatcher and configures agent integration.
|
|
96
96
|
- [`vp staged`](/guide/commit-hooks) runs checks on staged files.
|
|
97
97
|
- [`vp install`](/guide/install) installs dependencies with the right package manager.
|
|
98
98
|
- [`vp env`](/guide/env) manages Node.js versions.
|
package/docs/guide/install.md
CHANGED
|
@@ -69,6 +69,8 @@ Use the `-g` flag for installing, updating or removing globally installed packag
|
|
|
69
69
|
- `vp list -g [pkg]` lists global packages
|
|
70
70
|
- `vp outdated -g [pkg]` prints outdated packages
|
|
71
71
|
|
|
72
|
+
Updates keep the version spec a package was installed with: a package installed from a dist-tag (e.g. `vp install -g some-pkg@nightly`) updates to the newest version of that tag, and a version range stays within the range. Reinstall with a different spec (e.g. `vp update -g some-pkg@latest`) to switch, or pass `--latest` to `vp update -g` to move packages to the `latest` tag and clear their recorded specs. `vp outdated -g` reports both the newest version matching the recorded spec (`Wanted`) and the newest version on the `latest` tag.
|
|
73
|
+
|
|
72
74
|
::: warning
|
|
73
75
|
These commands do **NOT** interact with the underlying package manager's global installation directory.
|
|
74
76
|
|
|
@@ -147,14 +147,14 @@ Vite+ sets additional `VP_*` variables during shim dispatch and shell integratio
|
|
|
147
147
|
|
|
148
148
|
## Logging and Debugging
|
|
149
149
|
|
|
150
|
-
### `
|
|
150
|
+
### `VP_LOG`
|
|
151
151
|
|
|
152
152
|
- **Purpose**: Log filter string for `tracing_subscriber`
|
|
153
153
|
- **Default**: None
|
|
154
154
|
- **Example**:
|
|
155
155
|
```bash
|
|
156
|
-
|
|
157
|
-
|
|
156
|
+
VP_LOG=debug vp dev
|
|
157
|
+
VP_LOG=vite_task=trace vp build
|
|
158
158
|
```
|
|
159
159
|
|
|
160
160
|
### `VP_DEBUG_SHIM`
|
package/docs/guide/migrate.md
CHANGED
|
@@ -86,7 +86,7 @@ After the migration:
|
|
|
86
86
|
Command mapping to keep in mind:
|
|
87
87
|
|
|
88
88
|
- `vp run <script>` is the equivalent of `pnpm run <script>`
|
|
89
|
-
- `vp test`
|
|
89
|
+
- `vp dev` and `vp test` always run the built-ins; `vp run dev` and `vp run test` run the `dev` and `test` scripts from `package.json`
|
|
90
90
|
- `vp install`, `vp add`, and `vp remove` delegate through the package manager declared by `packageManager`
|
|
91
91
|
- `vp dev`, `vp build`, `vp preview`, `vp lint`, `vp fmt`, `vp check`, and `vp pack` replace the corresponding standalone tools
|
|
92
92
|
- Prefer `vp check` for validation loops
|
|
@@ -168,11 +168,19 @@ export default defineConfig({
|
|
|
168
168
|
});
|
|
169
169
|
```
|
|
170
170
|
|
|
171
|
-
|
|
171
|
+
When no existing hook policy owns the workflow, `vp migrate` can move supported lint-staged rules
|
|
172
|
+
and remove the old configuration and dependency. If an existing hook tool is preserved, keep
|
|
173
|
+
lint-staged in place until you convert that hook policy manually. See the
|
|
174
|
+
[Commit hooks guide](/guide/commit-hooks) and [Staged config reference](/config/staged) for details.
|
|
172
175
|
|
|
173
176
|
### Git hook tools
|
|
174
177
|
|
|
175
|
-
The `vp migrate` command
|
|
178
|
+
The `vp migrate` command does not automatically convert Husky setups. When Husky is detected,
|
|
179
|
+
Vite+ leaves its hooks, lifecycle scripts, configuration, and dependencies unchanged and shows a
|
|
180
|
+
warning. You can migrate the project manually using the [Commit hooks guide](/guide/commit-hooks).
|
|
181
|
+
|
|
182
|
+
Existing project-owned Vite+ hooks are also preserved. The default staged workflow is introduced
|
|
183
|
+
only when no existing hook policy is found.
|
|
176
184
|
|
|
177
185
|
If your project currently uses `lefthook`, `simple-git-hooks`, or `yorkie`, `vp migrate` will leave your existing configuration alone and show a warning. This happens even if you choose to set up hooks during the prompt or include the `--hooks` flag.
|
|
178
186
|
|
package/docs/guide/monorepo.md
CHANGED
|
@@ -145,16 +145,104 @@ This keeps the behavior centralized while letting each team or package own the p
|
|
|
145
145
|
|
|
146
146
|
## App Commands
|
|
147
147
|
|
|
148
|
-
The root `vite.config.ts` is most valuable for shared linting, formatting, staged checks, and task definitions.
|
|
148
|
+
The root `vite.config.ts` is most valuable for shared linting, formatting, staged checks, and task definitions. Development, build, preview, and packaging still act on a single app, so Vite+ makes the built-in commands monorepo-aware instead of forcing you to `cd` between packages.
|
|
149
149
|
|
|
150
|
-
|
|
150
|
+
### Running at the workspace root
|
|
151
|
+
|
|
152
|
+
`vp dev`, `vp build`, `vp preview`, and `vp pack` never silently act on the workspace root, which usually has no app of its own. Run them at the top of the monorepo and Vite+ works out which app you mean.
|
|
153
|
+
|
|
154
|
+
When exactly one package looks like an app, vp runs it and shows you the direct command for next time:
|
|
155
|
+
|
|
156
|
+
```
|
|
157
|
+
$ vp dev
|
|
158
|
+
Selected package: web (apps/web)
|
|
159
|
+
Tip: run this directly with `vp -C apps/web dev`
|
|
160
|
+
|
|
161
|
+
VITE+ v0.2.2
|
|
162
|
+
|
|
163
|
+
➜ Local: http://localhost:5173/
|
|
164
|
+
➜ Network: use --host to expose
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
When several packages could be the target, vp opens a fuzzy package picker (the same selector as `vp run`); typing filters, Enter runs the selection:
|
|
168
|
+
|
|
169
|
+
```
|
|
170
|
+
$ vp build
|
|
171
|
+
Select a package to build (↑/↓, Enter to run, type to search):
|
|
172
|
+
|
|
173
|
+
› admin apps/admin
|
|
174
|
+
web apps/web
|
|
175
|
+
ui packages/ui
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
```
|
|
179
|
+
Selected package: web (apps/web)
|
|
180
|
+
Tip: run this directly with `vp -C apps/web build`
|
|
181
|
+
|
|
182
|
+
✓ built in 187ms
|
|
183
|
+
```
|
|
184
|
+
|
|
185
|
+
In non-interactive shells (CI, pipes, redirection), vp prints the same packages as a plain listing with ready-to-copy commands and exits 1:
|
|
186
|
+
|
|
187
|
+
```
|
|
188
|
+
$ vp build | cat
|
|
189
|
+
error: `vp build` at the workspace root needs a target package.
|
|
190
|
+
|
|
191
|
+
Packages in this workspace:
|
|
192
|
+
admin apps/admin
|
|
193
|
+
web apps/web
|
|
194
|
+
@shop/ui packages/ui
|
|
195
|
+
|
|
196
|
+
Pass a directory: vp -C apps/admin build
|
|
197
|
+
Or run every package's build script: vp run -r build
|
|
198
|
+
```
|
|
199
|
+
|
|
200
|
+
vp ranks packages that look runnable for the command first in both the picker and the listing: a `vite.config.*` or root `index.html` for `dev` / `build` / `preview`, and a `pack` config block or tsdown's default `src/index.ts` entry for `pack`.
|
|
201
|
+
|
|
202
|
+
### Targeting a package with `-C`
|
|
203
|
+
|
|
204
|
+
The global `-C` flag runs any vp command as if you had `cd`'d into the package first, identical to `cd <dir> && vp <command>`:
|
|
151
205
|
|
|
152
206
|
```bash
|
|
153
|
-
vp
|
|
154
|
-
vp
|
|
207
|
+
vp -C apps/web dev
|
|
208
|
+
vp -C apps/web build
|
|
209
|
+
vp -C packages/ui pack
|
|
155
210
|
```
|
|
156
211
|
|
|
157
|
-
|
|
212
|
+
Passing a folder as a positional (`vp dev apps/web`) still works, but keeps upstream Vite semantics: it sets Vite's `root` option without changing the working directory, so `process.cwd()` reads in configs and plugins resolve from where you ran vp. Prefer `-C` when the package should behave as if you had `cd`'d into it. When a directory positional is used, vp prints a one-line note pointing at the `-C` form.
|
|
213
|
+
|
|
214
|
+
### A fixed default with `defaultPackage`
|
|
215
|
+
|
|
216
|
+
To always target one directory and skip the resolution above, set [`defaultPackage`](/config/#defaultpackage) in the root config:
|
|
217
|
+
|
|
218
|
+
```ts [vite.config.ts]
|
|
219
|
+
export default {
|
|
220
|
+
defaultPackage: './apps/web',
|
|
221
|
+
};
|
|
222
|
+
```
|
|
223
|
+
|
|
224
|
+
```
|
|
225
|
+
$ vp dev
|
|
226
|
+
note: vp dev: using ./apps/web (defaultPackage in vite.config.ts)
|
|
227
|
+
|
|
228
|
+
VITE+ v0.2.2
|
|
229
|
+
|
|
230
|
+
➜ Local: http://localhost:5173/
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
This is the right choice for framework monorepos that are not JavaScript workspaces, such as a Laravel or Rails app with a `frontend/` directory: there is no package list to resolve, so `defaultPackage` points vp straight at the app. Because vp reads it without executing the config, it works even when `vite-plus` is installed only inside that subdirectory.
|
|
234
|
+
|
|
235
|
+
An object form maps commands individually, so `vp pack` can target a library while `vp dev` targets an app; a command absent from the object falls through to the resolution above:
|
|
236
|
+
|
|
237
|
+
```ts [vite.config.ts]
|
|
238
|
+
export default {
|
|
239
|
+
defaultPackage: { dev: './apps/web', pack: './packages/ui' },
|
|
240
|
+
};
|
|
241
|
+
```
|
|
242
|
+
|
|
243
|
+
### Package scripts and workspace-wide tasks
|
|
244
|
+
|
|
245
|
+
Keep package-specific scripts in each package when the command differs per app:
|
|
158
246
|
|
|
159
247
|
```json [apps/api/package.json]
|
|
160
248
|
{
|
|
@@ -165,7 +253,7 @@ vp build apps/web
|
|
|
165
253
|
}
|
|
166
254
|
```
|
|
167
255
|
|
|
168
|
-
|
|
256
|
+
Run scripts across the whole workspace with `vp run`:
|
|
169
257
|
|
|
170
258
|
```bash
|
|
171
259
|
vp run -r build
|
package/docs/guide/run.md
CHANGED
|
@@ -38,6 +38,21 @@ Select a task (↑/↓, Enter to run, Esc to clear):
|
|
|
38
38
|
test: jest
|
|
39
39
|
```
|
|
40
40
|
|
|
41
|
+
## Built-in Commands vs Scripts
|
|
42
|
+
|
|
43
|
+
`vp dev` is a built-in command. `vp run dev` is your `dev` script. Built-in commands cannot be overwritten, so adding a `dev` script does not change what `vp dev` does:
|
|
44
|
+
|
|
45
|
+
| Command | What it runs |
|
|
46
|
+
| -------------------------- | ------------------------------------------------------------------------- |
|
|
47
|
+
| `vp dev` | The built-in Vite dev server |
|
|
48
|
+
| `vp run dev` / `vpr dev` | The `dev` script in `package.json`, or a `dev` task in `vite.config.ts` |
|
|
49
|
+
| `vp test` | The built-in Vitest command |
|
|
50
|
+
| `vp run test` / `vpr test` | The `test` script in `package.json`, or a `test` task in `vite.config.ts` |
|
|
51
|
+
|
|
52
|
+
`build`, `preview`, `lint`, `fmt`, `check`, and `pack` work the same way.
|
|
53
|
+
|
|
54
|
+
If the project defines that script or task, run it with `vp run <name>`. For example, with a `"dev": "astro dev"` script, `vp run dev` starts Astro, while `vp dev` ignores the script and starts Vite.
|
|
55
|
+
|
|
41
56
|
## Caching
|
|
42
57
|
|
|
43
58
|
`package.json` scripts are not cached by default. Use `--cache` to enable caching:
|
package/docs/guide/test.md
CHANGED
|
@@ -6,6 +6,10 @@
|
|
|
6
6
|
|
|
7
7
|
`vp test` is built on [Vitest](https://vitest.dev/), so you get a Vite-native test runner that reuses your Vite config and plugins, supports Jest-style expectations, snapshots, and coverage, and handles modern ESM, TypeScript, and JSX projects cleanly.
|
|
8
8
|
|
|
9
|
+
::: info
|
|
10
|
+
`vp test` always runs the built-in Vitest command. If your project also has a `test` script in `package.json`, run `vp run test` when you want to run that script instead. See [Built-in Commands vs Scripts](/guide/run#built-in-commands-vs-scripts).
|
|
11
|
+
:::
|
|
12
|
+
|
|
9
13
|
## Usage
|
|
10
14
|
|
|
11
15
|
```bash
|
|
@@ -31,15 +31,18 @@ If VS Code has multiple folders open, the shared Oxc language server may pick a
|
|
|
31
31
|
|
|
32
32
|
- Confirm the extension is using the intended workspace.
|
|
33
33
|
|
|
34
|
-
## `vp build` does not run my
|
|
34
|
+
## `vp dev` or `vp build` does not run my script
|
|
35
35
|
|
|
36
|
-
Unlike package managers, built-in commands cannot be overwritten. If you are trying to run a `package.json` script use `vp run
|
|
36
|
+
Unlike package managers, built-in commands cannot be overwritten. If you are trying to run a `package.json` script use `vp run <script>` instead.
|
|
37
37
|
|
|
38
38
|
For example:
|
|
39
39
|
|
|
40
|
+
- `vp dev` always starts the built-in Vite dev server
|
|
40
41
|
- `vp build` always runs the built-in Vite build
|
|
41
42
|
- `vp test` always runs the built-in Vitest command
|
|
42
|
-
- `vp run
|
|
43
|
+
- `vp run dev`, `vp run build`, and `vp run test` run the matching `package.json` scripts instead
|
|
44
|
+
|
|
45
|
+
See [Built-in Commands vs Scripts](/guide/run#built-in-commands-vs-scripts) for when to prefer each path.
|
|
43
46
|
|
|
44
47
|
::: info
|
|
45
48
|
You can also run custom tasks defined in `vite.config.ts` and migrate away from `package.json` scripts entirely.
|
|
@@ -50,8 +53,9 @@ You can also run custom tasks defined in `vite.config.ts` and migrate away from
|
|
|
50
53
|
If `vp staged` fails or your pre-commit hook does not run:
|
|
51
54
|
|
|
52
55
|
- make sure `vite.config.ts` contains a `staged` block
|
|
53
|
-
-
|
|
54
|
-
-
|
|
56
|
+
- make sure the project-owned pre-commit hook runs `vp staged`
|
|
57
|
+
- run `vp config` to install the hook dispatcher
|
|
58
|
+
- check whether hook installation was skipped intentionally through `VP_GIT_HOOKS=0`
|
|
55
59
|
|
|
56
60
|
A minimal staged config looks like this:
|
|
57
61
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plus",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.8",
|
|
4
4
|
"description": "The Unified Toolchain for the Web",
|
|
5
5
|
"homepage": "https://viteplus.dev/guide",
|
|
6
6
|
"bugs": {
|
|
@@ -62,11 +62,6 @@
|
|
|
62
62
|
"./bin": {
|
|
63
63
|
"import": "./dist/bin.js"
|
|
64
64
|
},
|
|
65
|
-
"./binding": {
|
|
66
|
-
"types": "./binding/index.d.cts",
|
|
67
|
-
"import": "./binding/index.cjs",
|
|
68
|
-
"require": "./binding/index.cjs"
|
|
69
|
-
},
|
|
70
65
|
"./fmt": {
|
|
71
66
|
"types": "./dist/fmt.d.ts",
|
|
72
67
|
"import": "./dist/fmt.js"
|
|
@@ -352,7 +347,7 @@
|
|
|
352
347
|
}
|
|
353
348
|
},
|
|
354
349
|
"dependencies": {
|
|
355
|
-
"@oxc-project/types": "=0.
|
|
350
|
+
"@oxc-project/types": "=0.142.0",
|
|
356
351
|
"@oxlint/plugins": "=1.73.0",
|
|
357
352
|
"@vitest/browser": "4.1.10",
|
|
358
353
|
"@vitest/browser-preview": "4.1.10",
|
|
@@ -363,16 +358,17 @@
|
|
|
363
358
|
"@vitest/snapshot": "4.1.10",
|
|
364
359
|
"@vitest/spy": "4.1.10",
|
|
365
360
|
"@vitest/utils": "4.1.10",
|
|
366
|
-
"oxfmt": "=0.
|
|
367
|
-
"oxlint": "=1.
|
|
361
|
+
"oxfmt": "=0.61.0",
|
|
362
|
+
"oxlint": "=1.76.0",
|
|
368
363
|
"oxlint-tsgolint": "=7.0.2001",
|
|
369
364
|
"vitest": "4.1.10",
|
|
370
|
-
"@voidzero-dev/vite-plus-core": "0.2.
|
|
365
|
+
"@voidzero-dev/vite-plus-core": "0.2.8"
|
|
371
366
|
},
|
|
372
367
|
"devDependencies": {
|
|
373
|
-
"@
|
|
368
|
+
"@emnapi/core": "2.0.0-alpha.3",
|
|
369
|
+
"@emnapi/runtime": "2.0.0-alpha.3",
|
|
370
|
+
"@napi-rs/cli": "^3.8.2",
|
|
374
371
|
"@nkzw/safe-word-list": "^3.1.0",
|
|
375
|
-
"@oxc-node/core": "^0.1.0",
|
|
376
372
|
"@types/cross-spawn": "^6.0.6",
|
|
377
373
|
"@types/semver": "^7.7.1",
|
|
378
374
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
@@ -390,15 +386,13 @@
|
|
|
390
386
|
"mri": "^1.2.0",
|
|
391
387
|
"nanotar": "^0.3.0",
|
|
392
388
|
"picocolors": "^1.1.1",
|
|
393
|
-
"rolldown-plugin-dts": "^0.27.0",
|
|
394
389
|
"semver": "^7.8.0",
|
|
395
|
-
"tsdown": "^0.22.
|
|
390
|
+
"tsdown": "^0.22.14",
|
|
396
391
|
"validate-npm-package-name": "^7.0.2",
|
|
397
392
|
"yaml": "^2.8.1",
|
|
398
393
|
"zod": "^3.25.76",
|
|
399
394
|
"@voidzero-dev/vite-plus-prompts": "0.0.0",
|
|
400
|
-
"vite": "npm:@voidzero-dev/vite-plus-core@0.2.
|
|
401
|
-
"@voidzero-dev/vite-plus-tools": "0.0.0"
|
|
395
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@0.2.8"
|
|
402
396
|
},
|
|
403
397
|
"peerDependencies": {
|
|
404
398
|
"@vitest/browser-playwright": "4.1.10",
|
|
@@ -430,14 +424,14 @@
|
|
|
430
424
|
"node": "^20.19.0 || ^22.18.0 || >=24.11.0"
|
|
431
425
|
},
|
|
432
426
|
"optionalDependencies": {
|
|
433
|
-
"@voidzero-dev/vite-plus-darwin-arm64": "0.2.
|
|
434
|
-
"@voidzero-dev/vite-plus-darwin-x64": "0.2.
|
|
435
|
-
"@voidzero-dev/vite-plus-linux-arm64-gnu": "0.2.
|
|
436
|
-
"@voidzero-dev/vite-plus-linux-arm64-musl": "0.2.
|
|
437
|
-
"@voidzero-dev/vite-plus-linux-x64-gnu": "0.2.
|
|
438
|
-
"@voidzero-dev/vite-plus-linux-x64-musl": "0.2.
|
|
439
|
-
"@voidzero-dev/vite-plus-win32-x64-msvc": "0.2.
|
|
440
|
-
"@voidzero-dev/vite-plus-win32-arm64-msvc": "0.2.
|
|
427
|
+
"@voidzero-dev/vite-plus-darwin-arm64": "0.2.8",
|
|
428
|
+
"@voidzero-dev/vite-plus-darwin-x64": "0.2.8",
|
|
429
|
+
"@voidzero-dev/vite-plus-linux-arm64-gnu": "0.2.8",
|
|
430
|
+
"@voidzero-dev/vite-plus-linux-arm64-musl": "0.2.8",
|
|
431
|
+
"@voidzero-dev/vite-plus-linux-x64-gnu": "0.2.8",
|
|
432
|
+
"@voidzero-dev/vite-plus-linux-x64-musl": "0.2.8",
|
|
433
|
+
"@voidzero-dev/vite-plus-win32-x64-msvc": "0.2.8",
|
|
434
|
+
"@voidzero-dev/vite-plus-win32-arm64-msvc": "0.2.8"
|
|
441
435
|
},
|
|
442
436
|
"scripts": {
|
|
443
437
|
"build": "oxnode -C dev ./build.ts",
|