vite-plus 0.2.7 → 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.
Files changed (54) hide show
  1. package/LICENSE +5 -1
  2. package/bin/vpr +3 -2
  3. package/binding/index.cjs +193 -80
  4. package/binding/index.d.cts +99 -8
  5. package/dist/agent-CI79DuSy.js +600 -0
  6. package/dist/bin.js +1368 -13
  7. package/dist/{cli-truncate-BVOlIIPy.js → cli-truncate-Bg3RDXpi.js} +0 -2
  8. package/dist/client/bundledDevClient.mjs +1 -0
  9. package/dist/config/bin.js +13 -126
  10. package/dist/{constants-BsuzPowC.js → constants-BppDcRc1.js} +1 -1
  11. package/dist/create/bin.js +90 -77
  12. package/dist/{define-config-DLh9fE95.cjs → define-config-CEm_MtvJ.cjs} +1 -1
  13. package/dist/{define-config-C2KfLHpC.js → define-config-DPnHe1Mx.js} +2 -2
  14. package/dist/{define-config-eLQH9us2.d.ts → define-config-DWoAkNdp.d.ts} +16 -0
  15. package/dist/define-config.cjs +1 -1
  16. package/dist/define-config.d.ts +1 -1
  17. package/dist/define-config.js +1 -1
  18. package/dist/{dist-CKz3vcoG.js → dist-CSQWHI6y.js} +3 -8
  19. package/dist/dist-DT25H9pj.js +3 -0
  20. package/dist/{agent-CPwWJ4qf.js → editor-CGWdbLgD.js} +690 -579
  21. package/dist/index.cjs +1 -1
  22. package/dist/index.d.ts +1 -1
  23. package/dist/index.js +1 -1
  24. package/dist/{json-DiRs8ceZ.js → json-BU88uu6o.js} +2 -6
  25. package/dist/migration/bin.js +58 -48
  26. package/dist/{oxlint-plugin-config-Bxgc4cwF.js → oxlint-plugin-config-BHOzlwMw.js} +1 -1
  27. package/dist/oxlint-plugin.js +1 -1
  28. package/dist/pack-bin.js +1 -1
  29. package/dist/{package-Ds3uThLb.js → package-hV-77cBb.js} +2 -2
  30. package/dist/{tsconfig-Jia2vgMG.js → prompts-DYap08te.js} +32 -174
  31. package/dist/{resolve-vite-config-BiuLZnn8.js → resolve-vite-config-EWXclqvV.js} +1 -1
  32. package/dist/{rolldown-runtime-C7HZzL1F.js → rolldown-runtime-CMFfr-1z.js} +1 -1
  33. package/dist/staged/bin.js +20 -23
  34. package/dist/{help-YP84FSEz.js → terminal-CrqqK8WT.js} +39 -2
  35. package/dist/tsconfig-CVUKLfL8.js +151 -0
  36. package/dist/{tsgolint-path-B-yOos8p.js → tsgolint-path-eMZT-oea.js} +4 -2
  37. package/dist/tsgolint-path.js +1 -1
  38. package/dist/version.js +5 -5
  39. package/dist/versions.js +4 -4
  40. package/docs/config/index.md +13 -0
  41. package/docs/config/staged.md +2 -1
  42. package/docs/guide/commit-hooks.md +38 -20
  43. package/docs/guide/env.md +8 -4
  44. package/docs/guide/index.md +1 -1
  45. package/docs/guide/install.md +2 -0
  46. package/docs/guide/installer-env-vars.md +3 -3
  47. package/docs/guide/migrate.md +10 -2
  48. package/docs/guide/monorepo.md +94 -6
  49. package/docs/guide/troubleshooting.md +3 -2
  50. package/package.json +17 -23
  51. package/dist/dist-CtM2JRbM.js +0 -3
  52. package/dist/editor-BbT1lTNc.js +0 -675
  53. package/dist/terminal-uTv0ZaMr.js +0 -33
  54. package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
@@ -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. For project-specific development, build, and test behavior, use the setup that best matches each app:
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
- - Pass a folder to built-in Vite commands when you want to target one app:
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 dev apps/web
154
- vp build apps/web
207
+ vp -C apps/web dev
208
+ vp -C apps/web build
209
+ vp -C packages/ui pack
155
210
  ```
156
211
 
157
- - Keep package-specific scripts in each package when the command differs per app:
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
- - Run scripts across the workspace with `vp run`:
256
+ Run scripts across the whole workspace with `vp run`:
169
257
 
170
258
  ```bash
171
259
  vp run -r build
@@ -53,8 +53,9 @@ You can also run custom tasks defined in `vite.config.ts` and migrate away from
53
53
  If `vp staged` fails or your pre-commit hook does not run:
54
54
 
55
55
  - make sure `vite.config.ts` contains a `staged` block
56
- - run `vp config` to install hooks
57
- - check whether hook installation was skipped intentionally through `VITE_GIT_HOOKS=0`
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`
58
59
 
59
60
  A minimal staged config looks like this:
60
61
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plus",
3
- "version": "0.2.7",
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.141.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.60.0",
367
- "oxlint": "=1.75.0",
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.7"
365
+ "@voidzero-dev/vite-plus-core": "0.2.8"
371
366
  },
372
367
  "devDependencies": {
373
- "@napi-rs/cli": "^3.7.3",
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
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
- "@voidzero-dev/vite-plus-tools": "0.0.0",
401
- "vite": "npm:@voidzero-dev/vite-plus-core@0.2.7"
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.7",
434
- "@voidzero-dev/vite-plus-darwin-x64": "0.2.7",
435
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.2.7",
436
- "@voidzero-dev/vite-plus-linux-arm64-musl": "0.2.7",
437
- "@voidzero-dev/vite-plus-linux-x64-gnu": "0.2.7",
438
- "@voidzero-dev/vite-plus-linux-x64-musl": "0.2.7",
439
- "@voidzero-dev/vite-plus-win32-x64-msvc": "0.2.7",
440
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.2.7"
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",
@@ -1,3 +0,0 @@
1
- import { t as require_dist } from "./dist-CKz3vcoG.js";
2
- export default require_dist();
3
- export {};