vite-plus 0.1.13 → 0.1.14-alpha.1

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 (64) hide show
  1. package/AGENTS.md +12 -0
  2. package/README.md +4 -0
  3. package/dist/global/{agent-BuEmv_K7.js → agent-DTz-Dh1r.js} +12 -30
  4. package/dist/global/{cli-truncate-BmIULUG7.js → cli-truncate-Da6Y8aM8.js} +2 -2
  5. package/dist/global/compat-Ch3iWOnQ.js +14 -0
  6. package/dist/global/config.js +1 -3
  7. package/dist/global/create.js +37 -8
  8. package/dist/global/{log-update-Beldo2tV.js → log-update-C8WCYCbc.js} +3 -3
  9. package/dist/global/migrate.js +22 -6
  10. package/dist/global/{package-D0VpX-8d.js → package-Y1UTfJnZ.js} +26 -1
  11. package/dist/global/report-C7xbSNED.js +28 -0
  12. package/dist/global/{slice-ansi-1i6Zdm-R.js → slice-ansi-Fap0ehe9.js} +1 -1
  13. package/dist/global/staged.js +62 -6
  14. package/dist/global/version.js +1 -1
  15. package/dist/global/{workspace-CVWspacc.js → workspace-BlrOxcHM.js} +3 -3
  16. package/dist/global/{wrap-ansi-CnYUWev2.js → wrap-ansi-eywLlPVQ.js} +1 -1
  17. package/dist/global/wrap-ansi-yd4eUCl_.js +2 -0
  18. package/dist/index.d.ts +2 -2
  19. package/dist/migration/migrator.js +26 -11
  20. package/dist/pack-bin.js +3 -1
  21. package/dist/resolve-vite-config.d.ts +9 -1
  22. package/dist/resolve-vite-config.js +78 -1
  23. package/dist/test/optional-runtime-types.js.d.ts +2 -0
  24. package/dist/utils/constants.d.ts +6 -0
  25. package/dist/utils/constants.js +8 -0
  26. package/dist/utils/editor.js +1 -1
  27. package/dist/utils/package.d.ts +6 -0
  28. package/dist/utils/package.js +19 -0
  29. package/package.json +21 -14
  30. package/skills/vite-plus/docs/config/build.md +21 -0
  31. package/skills/vite-plus/docs/config/fmt.md +18 -0
  32. package/skills/vite-plus/docs/config/index.md +31 -0
  33. package/skills/vite-plus/docs/config/lint.md +24 -0
  34. package/skills/vite-plus/docs/config/pack.md +17 -0
  35. package/skills/vite-plus/docs/config/run.md +231 -0
  36. package/skills/vite-plus/docs/config/staged.md +15 -0
  37. package/skills/vite-plus/docs/config/test.md +18 -0
  38. package/skills/vite-plus/docs/guide/build.md +40 -0
  39. package/skills/vite-plus/docs/guide/cache.md +119 -0
  40. package/skills/vite-plus/docs/guide/check.md +41 -0
  41. package/skills/vite-plus/docs/guide/ci.md +64 -0
  42. package/skills/vite-plus/docs/guide/commit-hooks.md +51 -0
  43. package/skills/vite-plus/docs/guide/create.md +88 -0
  44. package/skills/vite-plus/docs/guide/dev.md +24 -0
  45. package/skills/vite-plus/docs/guide/env.md +84 -0
  46. package/skills/vite-plus/docs/guide/fmt.md +41 -0
  47. package/skills/vite-plus/docs/guide/ide-integration.md +36 -0
  48. package/skills/vite-plus/docs/guide/implode.md +23 -0
  49. package/skills/vite-plus/docs/guide/index.md +114 -0
  50. package/skills/vite-plus/docs/guide/install.md +130 -0
  51. package/skills/vite-plus/docs/guide/lint.md +50 -0
  52. package/skills/vite-plus/docs/guide/migrate.md +174 -0
  53. package/skills/vite-plus/docs/guide/pack.md +61 -0
  54. package/skills/vite-plus/docs/guide/run.md +292 -0
  55. package/skills/vite-plus/docs/guide/test.md +35 -0
  56. package/skills/vite-plus/docs/guide/troubleshooting.md +71 -0
  57. package/skills/vite-plus/docs/guide/upgrade.md +28 -0
  58. package/skills/vite-plus/docs/guide/vpx.md +66 -0
  59. package/skills/vite-plus/docs/guide/why.md +39 -0
  60. package/dist/global/wrap-ansi-DAqB-SZm.js +0 -3
  61. package/dist/oxfmt-config.d.ts +0 -1
  62. package/dist/oxfmt-config.js +0 -0
  63. /package/dist/global/{src-FkMgH-SM.js → src-B-pcmd0F.js} +0 -0
  64. /package/dist/global/{strip-ansi-DbamwI77.js → strip-ansi-CE-VDMdw.js} +0 -0
@@ -1,5 +1,13 @@
1
+ /**
2
+ * Find a vite config file by walking up from `startDir` to `stopDir`.
3
+ * Returns the absolute path of the first config file found, or undefined.
4
+ */
5
+ export declare function findViteConfigUp(startDir: string, stopDir: string): string | undefined;
6
+ export interface ResolveViteConfigOptions {
7
+ traverseUp?: boolean;
8
+ }
1
9
  /**
2
10
  * Resolve vite.config.ts and return the config object.
3
11
  */
4
- export declare function resolveViteConfig(cwd: string): Promise<import("@voidzero-dev/vite-plus-core").ResolvedConfig>;
12
+ export declare function resolveViteConfig(cwd: string, options?: ResolveViteConfigOptions): Promise<import("@voidzero-dev/vite-plus-core").ResolvedConfig>;
5
13
  export declare function resolveUniversalViteConfig(err: null | Error, viteConfigCwd: string): Promise<string>;
@@ -1,8 +1,85 @@
1
+ import fs from 'node:fs';
2
+ import path from 'node:path';
3
+ const VITE_CONFIG_FILES = [
4
+ 'vite.config.ts',
5
+ 'vite.config.js',
6
+ 'vite.config.mjs',
7
+ 'vite.config.mts',
8
+ 'vite.config.cjs',
9
+ 'vite.config.cts',
10
+ ];
11
+ /**
12
+ * Find a vite config file by walking up from `startDir` to `stopDir`.
13
+ * Returns the absolute path of the first config file found, or undefined.
14
+ */
15
+ export function findViteConfigUp(startDir, stopDir) {
16
+ let dir = path.resolve(startDir);
17
+ const stop = path.resolve(stopDir);
18
+ while (true) {
19
+ for (const filename of VITE_CONFIG_FILES) {
20
+ const filePath = path.join(dir, filename);
21
+ if (fs.existsSync(filePath)) {
22
+ return filePath;
23
+ }
24
+ }
25
+ const parent = path.dirname(dir);
26
+ if (parent === dir || !parent.startsWith(stop)) {
27
+ break;
28
+ }
29
+ dir = parent;
30
+ }
31
+ return undefined;
32
+ }
33
+ function hasViteConfig(dir) {
34
+ return VITE_CONFIG_FILES.some((f) => fs.existsSync(path.join(dir, f)));
35
+ }
36
+ /**
37
+ * Find the workspace root by walking up from `startDir` looking for
38
+ * monorepo indicators (pnpm-workspace.yaml, workspaces in package.json, lerna.json).
39
+ */
40
+ function findWorkspaceRoot(startDir) {
41
+ let dir = path.resolve(startDir);
42
+ while (true) {
43
+ if (fs.existsSync(path.join(dir, 'pnpm-workspace.yaml'))) {
44
+ return dir;
45
+ }
46
+ const pkgPath = path.join(dir, 'package.json');
47
+ if (fs.existsSync(pkgPath)) {
48
+ try {
49
+ const pkg = JSON.parse(fs.readFileSync(pkgPath, 'utf-8'));
50
+ if (pkg.workspaces) {
51
+ return dir;
52
+ }
53
+ }
54
+ catch {
55
+ // Skip malformed package.json and continue searching parent directories
56
+ }
57
+ }
58
+ if (fs.existsSync(path.join(dir, 'lerna.json'))) {
59
+ return dir;
60
+ }
61
+ const parent = path.dirname(dir);
62
+ if (parent === dir) {
63
+ break;
64
+ }
65
+ dir = parent;
66
+ }
67
+ return undefined;
68
+ }
1
69
  /**
2
70
  * Resolve vite.config.ts and return the config object.
3
71
  */
4
- export async function resolveViteConfig(cwd) {
72
+ export async function resolveViteConfig(cwd, options) {
5
73
  const { resolveConfig } = await import('./index.js');
74
+ if (options?.traverseUp && !hasViteConfig(cwd)) {
75
+ const workspaceRoot = findWorkspaceRoot(cwd);
76
+ if (workspaceRoot) {
77
+ const configFile = findViteConfigUp(path.dirname(cwd), workspaceRoot);
78
+ if (configFile) {
79
+ return resolveConfig({ root: cwd, configFile }, 'build');
80
+ }
81
+ }
82
+ }
6
83
  return resolveConfig({ root: cwd }, 'build');
7
84
  }
8
85
  export async function resolveUniversalViteConfig(err, viteConfigCwd) {
@@ -0,0 +1,2 @@
1
+ import '@voidzero-dev/vite-plus-test/optional-runtime-types.js';
2
+ export * from '@voidzero-dev/vite-plus-test/optional-runtime-types.js';
@@ -1,6 +1,12 @@
1
1
  export declare const VITE_PLUS_NAME = "vite-plus";
2
2
  export declare const VITE_PLUS_VERSION: string;
3
3
  export declare const VITE_PLUS_OVERRIDE_PACKAGES: Record<string, string>;
4
+ /**
5
+ * When VITE_PLUS_FORCE_MIGRATE is set, force full dependency rewriting
6
+ * even for projects already using vite-plus. Used by ecosystem CI to
7
+ * override dependencies with locally built tgz packages.
8
+ */
9
+ export declare function isForceOverrideMode(): boolean;
4
10
  export declare function resolve(path: string): string;
5
11
  export declare const BASEURL_TSCONFIG_WARNING: string;
6
12
  export declare const DEFAULT_ENVS: {
@@ -8,6 +8,14 @@ export const VITE_PLUS_OVERRIDE_PACKAGES = process.env
8
8
  vite: 'npm:@voidzero-dev/vite-plus-core@latest',
9
9
  vitest: 'npm:@voidzero-dev/vite-plus-test@latest',
10
10
  };
11
+ /**
12
+ * When VITE_PLUS_FORCE_MIGRATE is set, force full dependency rewriting
13
+ * even for projects already using vite-plus. Used by ecosystem CI to
14
+ * override dependencies with locally built tgz packages.
15
+ */
16
+ export function isForceOverrideMode() {
17
+ return process.env.VITE_PLUS_FORCE_MIGRATE === '1';
18
+ }
11
19
  const require = createRequire(import.meta.url);
12
20
  export function resolve(path) {
13
21
  return require.resolve(path, {
@@ -117,7 +117,7 @@ const ZED_SETTINGS = {
117
117
  prettier: { allowed: false },
118
118
  formatter: [{ language_server: { name: 'oxfmt' } }],
119
119
  },
120
- Vue: {
120
+ 'Vue.js': {
121
121
  format_on_save: 'on',
122
122
  prettier: { allowed: false },
123
123
  formatter: [{ language_server: { name: 'oxfmt' } }],
@@ -15,4 +15,10 @@ export declare function hasVitePlusDependency(pkg?: {
15
15
  dependencies?: Record<string, string>;
16
16
  devDependencies?: Record<string, string>;
17
17
  } | null): boolean;
18
+ /**
19
+ * Check if an npm package exists in the public registry.
20
+ * Returns true if the package exists or if the check could not be performed (network error, timeout).
21
+ * Returns false only if the registry definitively responds with 404.
22
+ */
23
+ export declare function checkNpmPackageExists(packageName: string): Promise<boolean>;
18
24
  export {};
@@ -45,3 +45,22 @@ export function readNearestPackageJson(currentDir) {
45
45
  export function hasVitePlusDependency(pkg) {
46
46
  return Boolean(pkg?.dependencies?.[VITE_PLUS_NAME] || pkg?.devDependencies?.[VITE_PLUS_NAME]);
47
47
  }
48
+ /**
49
+ * Check if an npm package exists in the public registry.
50
+ * Returns true if the package exists or if the check could not be performed (network error, timeout).
51
+ * Returns false only if the registry definitively responds with 404.
52
+ */
53
+ export async function checkNpmPackageExists(packageName) {
54
+ const atIndex = packageName.indexOf('@', 2);
55
+ const name = atIndex === -1 ? packageName : packageName.slice(0, atIndex);
56
+ try {
57
+ const response = await fetch(`https://registry.npmjs.org/${name}`, {
58
+ method: 'HEAD',
59
+ signal: AbortSignal.timeout(3000),
60
+ });
61
+ return response.status !== 404;
62
+ }
63
+ catch {
64
+ return true; // Network error or timeout - let the package manager handle it
65
+ }
66
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vite-plus",
3
- "version": "0.1.13",
3
+ "version": "0.1.14-alpha.1",
4
4
  "description": "The Unified Toolchain for the Web",
5
5
  "homepage": "https://viteplus.dev/guide",
6
6
  "bugs": {
@@ -93,6 +93,9 @@
93
93
  "./test/optional-types.js": {
94
94
  "types": "./dist/test/optional-types.js.d.ts"
95
95
  },
96
+ "./test/optional-runtime-types.js": {
97
+ "types": "./dist/test/optional-runtime-types.js.d.ts"
98
+ },
96
99
  "./test/globals": {
97
100
  "types": "./dist/test/globals.d.ts"
98
101
  },
@@ -307,15 +310,15 @@
307
310
  }
308
311
  },
309
312
  "dependencies": {
310
- "@oxc-project/types": "=0.120.0",
313
+ "@oxc-project/types": "=0.122.0",
311
314
  "cac": "^7.0.0",
312
315
  "cross-spawn": "^7.0.5",
313
316
  "oxfmt": "=0.41.0",
314
317
  "oxlint": "=1.56.0",
315
- "oxlint-tsgolint": "=0.17.1",
318
+ "oxlint-tsgolint": "=0.17.2",
316
319
  "picocolors": "^1.1.1",
317
- "@voidzero-dev/vite-plus-core": "0.1.13",
318
- "@voidzero-dev/vite-plus-test": "0.1.13"
320
+ "@voidzero-dev/vite-plus-core": "0.1.14-alpha.1",
321
+ "@voidzero-dev/vite-plus-test": "0.1.14-alpha.1"
319
322
  },
320
323
  "devDependencies": {
321
324
  "@napi-rs/cli": "^3.4.1",
@@ -337,9 +340,9 @@
337
340
  "tsdown": "^0.21.4",
338
341
  "validate-npm-package-name": "^7.0.2",
339
342
  "yaml": "^2.8.1",
340
- "vite": "npm:@voidzero-dev/vite-plus-core@0.1.13",
341
- "rolldown": "1.0.0-rc.10",
342
- "@voidzero-dev/vite-plus-prompts": "0.0.0"
343
+ "@voidzero-dev/vite-plus-prompts": "0.0.0",
344
+ "rolldown": "1.0.0-rc.11",
345
+ "vite": "npm:@voidzero-dev/vite-plus-core@0.1.14-alpha.1"
343
346
  },
344
347
  "napi": {
345
348
  "binaryName": "vite-plus",
@@ -348,7 +351,9 @@
348
351
  "aarch64-apple-darwin",
349
352
  "x86_64-apple-darwin",
350
353
  "aarch64-unknown-linux-gnu",
354
+ "aarch64-unknown-linux-musl",
351
355
  "x86_64-unknown-linux-gnu",
356
+ "x86_64-unknown-linux-musl",
352
357
  "x86_64-pc-windows-msvc",
353
358
  "aarch64-pc-windows-msvc"
354
359
  ]
@@ -357,12 +362,14 @@
357
362
  "node": "^20.19.0 || >=22.12.0"
358
363
  },
359
364
  "optionalDependencies": {
360
- "@voidzero-dev/vite-plus-darwin-arm64": "0.1.13",
361
- "@voidzero-dev/vite-plus-darwin-x64": "0.1.13",
362
- "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.13",
363
- "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.13",
364
- "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.13",
365
- "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.13"
365
+ "@voidzero-dev/vite-plus-darwin-arm64": "0.1.14-alpha.1",
366
+ "@voidzero-dev/vite-plus-darwin-x64": "0.1.14-alpha.1",
367
+ "@voidzero-dev/vite-plus-linux-arm64-gnu": "0.1.14-alpha.1",
368
+ "@voidzero-dev/vite-plus-linux-arm64-musl": "0.1.14-alpha.1",
369
+ "@voidzero-dev/vite-plus-linux-x64-gnu": "0.1.14-alpha.1",
370
+ "@voidzero-dev/vite-plus-linux-x64-musl": "0.1.14-alpha.1",
371
+ "@voidzero-dev/vite-plus-win32-x64-msvc": "0.1.14-alpha.1",
372
+ "@voidzero-dev/vite-plus-win32-arm64-msvc": "0.1.14-alpha.1"
366
373
  },
367
374
  "scripts": {
368
375
  "build": "oxnode -C dev ./build.ts",
@@ -0,0 +1,21 @@
1
+ # Build Config
2
+
3
+ `vp dev`, `vp build`, and `vp preview` use the standard [Vite configuration](https://vite.dev/config/), including [plugins](https://vite.dev/guide/using-plugins), [aliases](https://vite.dev/config/shared-options#resolve-alias), [`server`](https://vite.dev/config/server-options), [`build`](https://vite.dev/config/build-options) and [`preview`](https://vite.dev/config/preview-options) fields.
4
+
5
+ ## Example
6
+
7
+ ```ts
8
+ import { defineConfig } from 'vite-plus';
9
+
10
+ export default defineConfig({
11
+ server: {
12
+ port: 3000,
13
+ },
14
+ build: {
15
+ sourcemap: true,
16
+ },
17
+ preview: {
18
+ port: 4173,
19
+ },
20
+ });
21
+ ```
@@ -0,0 +1,18 @@
1
+ # Format Config
2
+
3
+ `vp fmt` and `vp check` read Oxfmt settings from the `fmt` block in `vite.config.ts`. See [Oxfmt's configuration](https://oxc.rs/docs/guide/usage/formatter/config.html) for details.
4
+
5
+ ## Example
6
+
7
+ ```ts
8
+ import { defineConfig } from 'vite-plus';
9
+
10
+ export default defineConfig({
11
+ fmt: {
12
+ ignorePatterns: ['dist/**'],
13
+ singleQuote: true,
14
+ semi: true,
15
+ sortPackageJson: true,
16
+ },
17
+ });
18
+ ```
@@ -0,0 +1,31 @@
1
+ # Configuring Vite+
2
+
3
+ Vite+ keeps project configuration in one place: `vite.config.ts`, allowing you to consolidate many top-level configuration files in a single file. You can keep using your Vite configuration such as `server` or `build`, and add Vite+ blocks for the rest of your workflow:
4
+
5
+ ```ts
6
+ import { defineConfig } from 'vite-plus';
7
+
8
+ export default defineConfig({
9
+ server: {},
10
+ build: {},
11
+ preview: {},
12
+
13
+ test: {},
14
+ lint: {},
15
+ fmt: {},
16
+ run: {},
17
+ pack: {},
18
+ staged: {},
19
+ });
20
+ ```
21
+
22
+ ## Vite+ Specific Configuration
23
+
24
+ Vite+ extends the basic Vite configuration with these additions:
25
+
26
+ - [`lint`](/config/lint) for Oxlint
27
+ - [`fmt`](/config/fmt) for Oxfmt
28
+ - [`test`](/config/test) for Vitest
29
+ - [`run`](/config/run) for Vite Task
30
+ - [`pack`](/config/pack) for tsdown
31
+ - [`staged`](/config/staged) for staged-file checks
@@ -0,0 +1,24 @@
1
+ # Lint Config
2
+
3
+ `vp lint` and `vp check` read Oxlint settings from the `lint` block in `vite.config.ts`. See [Oxlint's configuration](https://oxc.rs/docs/guide/usage/linter/config.html) for details.
4
+
5
+ ## Example
6
+
7
+ ```ts
8
+ import { defineConfig } from 'vite-plus';
9
+
10
+ export default defineConfig({
11
+ lint: {
12
+ ignorePatterns: ['dist/**'],
13
+ options: {
14
+ typeAware: true,
15
+ typeCheck: true,
16
+ },
17
+ rules: {
18
+ 'no-console': ['error', { allow: ['error'] }],
19
+ },
20
+ },
21
+ });
22
+ ```
23
+
24
+ We recommend enabling both `options.typeAware` and `options.typeCheck` so `vp lint` and `vp check` can use the full type-aware path.
@@ -0,0 +1,17 @@
1
+ # Pack Config
2
+
3
+ `vp pack` reads tsdown settings from the `pack` block in `vite.config.ts`. See [tsdown's configuration](https://tsdown.dev/options/config-file) for details.
4
+
5
+ ## Example
6
+
7
+ ```ts
8
+ import { defineConfig } from 'vite-plus';
9
+
10
+ export default defineConfig({
11
+ pack: {
12
+ dts: true,
13
+ format: ['esm', 'cjs'],
14
+ sourcemap: true,
15
+ },
16
+ });
17
+ ```
@@ -0,0 +1,231 @@
1
+ # Run Config
2
+
3
+ You can configure Vite Task under the `run` field in `vite.config.ts`. Check out [`vp run`](/guide/run) to learn more about running scripts and tasks with Vite+.
4
+
5
+ ```ts
6
+ import { defineConfig } from 'vite-plus';
7
+
8
+ export default defineConfig({
9
+ run: {
10
+ enablePrePostScripts: true,
11
+ cache: {
12
+ /* ... */
13
+ },
14
+ tasks: {
15
+ /* ... */
16
+ },
17
+ },
18
+ });
19
+ ```
20
+
21
+ ## `run.enablePrePostScripts`
22
+
23
+ - **Type:** `boolean`
24
+ - **Default:** `true`
25
+
26
+ Whether to automatically run `preX`/`postX` package.json scripts as lifecycle hooks when script `X` is executed.
27
+
28
+ When enabled (the default), running a script like `test` will automatically run `pretest` before it and `posttest` after it, if they exist in `package.json`.
29
+
30
+ ```ts
31
+ export default defineConfig({
32
+ run: {
33
+ enablePrePostScripts: false, // Disable pre/post lifecycle hooks
34
+ },
35
+ });
36
+ ```
37
+
38
+ ::: warning
39
+ This option can only be set in the workspace root's `vite.config.ts`. Setting it in a package's config will result in an error.
40
+ :::
41
+
42
+ ## `run.cache`
43
+
44
+ - **Type:** `boolean | { scripts?: boolean, tasks?: boolean }`
45
+ - **Default:** `{ scripts: false, tasks: true }`
46
+
47
+ Controls whether task results are cached and replayed on subsequent runs.
48
+
49
+ ```ts
50
+ export default defineConfig({
51
+ run: {
52
+ cache: {
53
+ scripts: true, // Cache package.json scripts (default: false)
54
+ tasks: true, // Cache task definitions (default: true)
55
+ },
56
+ },
57
+ });
58
+ ```
59
+
60
+ `cache: true` enables both task and script caching, `cache: false` disables both.
61
+
62
+ ## `run.tasks`
63
+
64
+ - **Type:** `Record<string, TaskConfig>`
65
+
66
+ Defines tasks that can be run with `vp run <task>`.
67
+
68
+ ### `command`
69
+
70
+ - **Type:** `string`
71
+
72
+ Defines the shell command to run for the task.
73
+
74
+ ```ts
75
+ tasks: {
76
+ build: {
77
+ command: 'vp build',
78
+ },
79
+ }
80
+ ```
81
+
82
+ Each task defined in `vite.config.ts` must include its own `command`. You cannot define a task in both `vite.config.ts` and `package.json` with the same task name.
83
+
84
+ Commands joined with `&&` are automatically split into independently cached sub-tasks. See [Compound Commands](/guide/run#compound-commands).
85
+
86
+ ### `dependsOn`
87
+
88
+ - **Type:** `string[]`
89
+ - **Default:** `[]`
90
+
91
+ Tasks that must complete successfully before this one starts.
92
+
93
+ ```ts
94
+ tasks: {
95
+ deploy: {
96
+ command: 'deploy-script --prod',
97
+ dependsOn: ['build', 'test'],
98
+ },
99
+ }
100
+ ```
101
+
102
+ Dependencies can reference tasks in other packages using the `package#task` format:
103
+
104
+ ```ts
105
+ dependsOn: ['@my/core#build', '@my/utils#lint'];
106
+ ```
107
+
108
+ See [Task Dependencies](/guide/run#task-dependencies) for details on how explicit and topological dependencies interact.
109
+
110
+ ### `cache`
111
+
112
+ - **Type:** `boolean`
113
+ - **Default:** `true`
114
+
115
+ Whether to cache this task's output. Set to `false` for tasks that should never be cached, like dev servers:
116
+
117
+ ```ts
118
+ tasks: {
119
+ dev: {
120
+ command: 'vp dev',
121
+ cache: false,
122
+ },
123
+ }
124
+ ```
125
+
126
+ ### `env`
127
+
128
+ - **Type:** `string[]`
129
+ - **Default:** `[]`
130
+
131
+ Environment variables included in the cache fingerprint. When any listed variable's value changes, the cache is invalidated.
132
+
133
+ ```ts
134
+ tasks: {
135
+ build: {
136
+ command: 'vp build',
137
+ env: ['NODE_ENV'],
138
+ },
139
+ }
140
+ ```
141
+
142
+ Wildcard patterns are supported: `VITE_*` matches all variables starting with `VITE_`.
143
+
144
+ ```bash
145
+ $ NODE_ENV=development vp run build # first run
146
+ $ NODE_ENV=production vp run build # cache miss: variable changed
147
+ ```
148
+
149
+ ### `untrackedEnv`
150
+
151
+ - **Type:** `string[]`
152
+ - **Default:** see below
153
+
154
+ Environment variables passed to the task process but **not** included in the cache fingerprint. Changing these values won't invalidate the cache.
155
+
156
+ ```ts
157
+ tasks: {
158
+ build: {
159
+ command: 'vp build',
160
+ untrackedEnv: ['CI', 'GITHUB_ACTIONS'],
161
+ },
162
+ }
163
+ ```
164
+
165
+ A set of common environment variables are automatically passed through to all tasks:
166
+
167
+ - **System:** `HOME`, `USER`, `PATH`, `SHELL`, `LANG`, `TZ`
168
+ - **Node.js:** `NODE_OPTIONS`, `COREPACK_HOME`, `PNPM_HOME`
169
+ - **CI/CD:** `CI`, `VERCEL_*`, `NEXT_*`
170
+ - **Terminal:** `TERM`, `COLORTERM`, `FORCE_COLOR`, `NO_COLOR`
171
+
172
+ ### `input`
173
+
174
+ - **Type:** `Array<string | { auto: boolean }>`
175
+ - **Default:** `[{ auto: true }]` (auto-inferred)
176
+
177
+ Vite Task automatically detects which files are used by a command (see [Automatic File Tracking](/guide/cache#automatic-file-tracking)). The `input` option can be used to explicitly include or exclude certain files.
178
+
179
+ **Exclude files** from automatic tracking:
180
+
181
+ ```ts
182
+ tasks: {
183
+ build: {
184
+ command: 'vp build',
185
+ // Use `{ auto: true }` to use automatic fingerprinting (default).
186
+ input: [{ auto: true }, '!**/*.tsbuildinfo', '!dist/**'],
187
+ },
188
+ }
189
+ ```
190
+
191
+ **Specify explicit files** only without automatic tracking:
192
+
193
+ ```ts
194
+ tasks: {
195
+ build: {
196
+ command: 'vp build',
197
+ input: ['src/**/*.ts', 'vite.config.ts'],
198
+ },
199
+ }
200
+ ```
201
+
202
+ **Disable file tracking** entirely and cache only on command/env changes:
203
+
204
+ ```ts
205
+ tasks: {
206
+ greet: {
207
+ command: 'node greet.mjs',
208
+ input: [],
209
+ },
210
+ }
211
+ ```
212
+
213
+ ::: tip
214
+ Glob patterns are resolved relative to the package directory, not the task's `cwd`.
215
+ :::
216
+
217
+ ### `cwd`
218
+
219
+ - **Type:** `string`
220
+ - **Default:** package root
221
+
222
+ Working directory for the task, relative to the package root.
223
+
224
+ ```ts
225
+ tasks: {
226
+ 'test-e2e': {
227
+ command: 'vp test',
228
+ cwd: 'tests/e2e',
229
+ },
230
+ }
231
+ ```
@@ -0,0 +1,15 @@
1
+ # Staged Config
2
+
3
+ `vp staged` and `vp config` read staged-file rules from the `staged` block in `vite.config.ts`. See the [Commit hooks guide](/guide/commit-hooks).
4
+
5
+ ## Example
6
+
7
+ ```ts
8
+ import { defineConfig } from 'vite-plus';
9
+
10
+ export default defineConfig({
11
+ staged: {
12
+ '*.{js,ts,tsx,vue,svelte}': 'vp check --fix',
13
+ },
14
+ });
15
+ ```
@@ -0,0 +1,18 @@
1
+ # Test Config
2
+
3
+ `vp test` reads Vitest settings from the `test` block in `vite.config.ts`. See [Vitest's configuration](https://vitest.dev/config/) for details.
4
+
5
+ ## Example
6
+
7
+ ```ts
8
+ import { defineConfig } from 'vite-plus';
9
+
10
+ export default defineConfig({
11
+ test: {
12
+ include: ['src/**/*.test.ts'],
13
+ coverage: {
14
+ reporter: ['text', 'html'],
15
+ },
16
+ },
17
+ });
18
+ ```
@@ -0,0 +1,40 @@
1
+ # Build
2
+
3
+ `vp build` builds Vite applications for production.
4
+
5
+ ## Overview
6
+
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
+
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.
11
+ :::
12
+
13
+ ## Usage
14
+
15
+ ```bash
16
+ vp build
17
+ vp build --watch
18
+ vp build --sourcemap
19
+ ```
20
+
21
+ ## Configuration
22
+
23
+ Use standard Vite configuration in `vite.config.ts`. For the full configuration reference, see the [Vite config docs](https://vite.dev/config/).
24
+
25
+ Use it for:
26
+
27
+ - [plugins](https://vite.dev/guide/using-plugins)
28
+ - [aliases](https://vite.dev/config/shared-options#resolve-alias)
29
+ - [`build`](https://vite.dev/config/build-options)
30
+ - [`preview`](https://vite.dev/config/preview-options)
31
+ - [environment modes](https://vite.dev/guide/env-and-mode)
32
+
33
+ ## Preview
34
+
35
+ Use `vp preview` to serve the production build locally after `vp build`.
36
+
37
+ ```bash
38
+ vp build
39
+ vp preview
40
+ ```