vite-plus 1.3.0 → 1.5.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 (106) hide show
  1. package/AGENTS.md +4 -0
  2. package/LICENSE +1 -878
  3. package/README.md +1 -1
  4. package/bin/vpx +9 -0
  5. package/binding/index.cjs +59 -54
  6. package/binding/index.d.cts +159 -2
  7. package/dist/{agent-97KmGCyL.js → agent-DkQD3xqe.js} +5 -7
  8. package/dist/bin.js +35 -34
  9. package/dist/{cli-parse-DHE8NrBU.js → cli-parse-aeUeFDlC.js} +2 -3
  10. package/dist/command-TjS_6y9O.js +1 -0
  11. package/dist/{command-CdMBoZFD.js → command-rY79K5NI.js} +28 -30
  12. package/dist/{comparison-CmVirWIW-DUGaiYqF.js → comparison-CmVirWIW-UlEf2maz.js} +1 -2
  13. package/dist/config/bin.js +8 -10
  14. package/dist/{constants-DR55DpRm.js → constants-D2P2aVKb.js} +8 -6
  15. package/dist/create/bin.d.ts +4 -8
  16. package/dist/create/bin.js +151 -120
  17. package/dist/{define-config-Bexdd6RZ.d.ts → define-config-BrvHRi-G.d.ts} +31 -13
  18. package/dist/{define-config-BxDc_9BK.cjs → define-config-CwtQqYC1.cjs} +41 -14
  19. package/dist/{define-config-CvE5pHqB.js → define-config-wR57OZG_.js} +34 -12
  20. package/dist/define-config.cjs +2 -1
  21. package/dist/define-config.d.ts +2 -2
  22. package/dist/define-config.js +1 -1
  23. package/dist/{dist-DIpm7mot.js → dist-Bs0SObNC.js} +73 -145
  24. package/dist/{dist-Cqz8OtiO.js → dist-CdkMvIiQ.js} +11 -5
  25. package/dist/dist-zDZV5eEc.js +3 -0
  26. package/dist/{documentation-DqcZSthV.js → documentation-cv_y0Auv.js} +1 -2
  27. package/dist/{editor-CtJGQP7C.js → editor-aOy1T15H.js} +2735 -5072
  28. package/dist/{help-BmKpeOP9.js → help-B03t_iQ4.js} +1 -2
  29. package/dist/hooks/bin.js +4 -5
  30. package/dist/{hooks-DhwsWb46.js → hooks-w_e2whkQ.js} +45 -25
  31. package/dist/index.cjs +5 -5
  32. package/dist/index.d.ts +2 -2
  33. package/dist/index.js +2 -2
  34. package/dist/{json-JP24qHUF.js → json-kl84kDyH.js} +9 -18
  35. package/dist/lint-plugins.cjs +1 -1
  36. package/dist/migration/bin.js +1782 -256
  37. package/dist/migration/compat/worker.js +4 -6
  38. package/dist/{oxlint-plugin-config-BIzrO2y2.js → oxlint-plugin-config-CHsI_zKo.js} +3 -4
  39. package/dist/oxlint-plugin.d.ts +0 -2
  40. package/dist/oxlint-plugin.js +33 -9
  41. package/dist/{pack-BK38MLVZ.d.ts → pack-ARPFMefW.d.ts} +0 -2
  42. package/dist/pack-bin.d.ts +1 -3
  43. package/dist/pack-bin.js +4 -5
  44. package/dist/pack.d.ts +1 -1
  45. package/dist/{package-CQDXTm6j.js → package-DfFo6-E-.js} +10 -95
  46. package/dist/{package-overrides-D1RcXSFl.js → package-overrides-Ci8GXouY.js} +5 -8
  47. package/dist/picomatch-DEUoj81q.js +1916 -0
  48. package/dist/{prompts-1xNz_ne0.js → prompts-C7DI63WP.js} +30 -50
  49. package/dist/{protocol-D99W10Qi.js → protocol-CkNmY-Mr.js} +1 -2
  50. package/dist/register.d.ts +1 -0
  51. package/dist/register.js +12 -0
  52. package/dist/{report-NhQk8VHb.js → report-BEdpIQvC.js} +4 -2
  53. package/dist/resolve-vite-config-33bzSaeT.js +1 -0
  54. package/dist/{resolve-vite-config-BVr1SUNg.js → resolve-vite-config-Cx3cnVVI.js} +9 -25
  55. package/dist/{rolldown-runtime-kJ_i4yPo.js → rolldown-runtime-DegdyBIC.js} +1 -2
  56. package/dist/script-esm-hooks.d.ts +11 -0
  57. package/dist/script-esm-hooks.js +27 -0
  58. package/dist/script-hooks-9Fof5UMY.js +176 -0
  59. package/dist/script-preload.cjs +491 -0
  60. package/dist/script-register.d.ts +1 -0
  61. package/dist/script-register.js +27 -0
  62. package/dist/script-watch.d.ts +1 -0
  63. package/dist/script-watch.js +2002 -0
  64. package/dist/staged/bin.js +53 -2011
  65. package/dist/sync-versions/bin.js +26 -48
  66. package/dist/sync-versions/bin.mjs +109 -217
  67. package/dist/{terminal-MKGAuy-p.js → terminal-BcuPUy-j.js} +1 -2
  68. package/dist/toolchain.js +38 -12
  69. package/dist/toolchain.json +38 -12
  70. package/dist/{tsconfig-zWgHiQ3X.js → tsconfig-BE3Wj9OX.js} +1 -1
  71. package/dist/{tsconfig-BZu7kl-x.js → tsconfig-shNmmCE_.js} +8 -10
  72. package/dist/version.d.ts +1 -3
  73. package/dist/version.js +5 -6
  74. package/dist/versions.js +7 -7
  75. package/dist/{vitest-ecosystem-BU0AqZq-.js → vitest-ecosystem-BeEYz-qF.js} +1 -2
  76. package/dist/{vitest-v5-entry-points-DthU1e_O.js → vitest-v5-entry-points-NyJsFeux.js} +1 -2
  77. package/dist/vpx-bin.d.ts +1 -0
  78. package/dist/vpx-bin.js +232 -0
  79. package/dist/vpx-script-EXgV5QOf.js +434 -0
  80. package/docs/config/check.md +2 -0
  81. package/docs/config/fmt.md +1 -1
  82. package/docs/config/lint.md +1 -1
  83. package/docs/config/run.md +10 -2
  84. package/docs/config/staged.md +1 -1
  85. package/docs/guide/check.md +6 -1
  86. package/docs/guide/ci.md +13 -3
  87. package/docs/guide/create.md +1 -1
  88. package/docs/guide/env.md +11 -4
  89. package/docs/guide/global-cli.md +59 -3
  90. package/docs/guide/homebrew.md +127 -0
  91. package/docs/guide/ide-integration.md +1 -3
  92. package/docs/guide/implode.md +5 -3
  93. package/docs/guide/local-cli.md +21 -0
  94. package/docs/guide/migrate-rules.md +120 -18
  95. package/docs/guide/migrate.md +9 -9
  96. package/docs/guide/package-management.md +1 -1
  97. package/docs/guide/run.md +23 -1
  98. package/docs/guide/test.md +1 -1
  99. package/docs/guide/troubleshooting.md +1 -1
  100. package/docs/guide/upgrade.md +12 -6
  101. package/docs/guide/vitest-v5.md +2 -2
  102. package/docs/guide/vpx.md +210 -9
  103. package/package.json +43 -34
  104. package/dist/command-DVTILtS-.js +0 -1
  105. package/dist/dist-Dhu07wmN.js +0 -3
  106. package/dist/resolve-vite-config-7WDtXO4G.js +0 -1
@@ -1,6 +1,6 @@
1
1
  import { shouldPrintVitePlusHeader, vitePlusHeader } from "../binding/index.js";
2
2
  import { styleText } from "node:util";
3
- //#region src/utils/terminal.ts
3
+ // src/utils/terminal.ts
4
4
  function log(message) {
5
5
  console.log(message);
6
6
  }
@@ -35,5 +35,4 @@ function warnMsg(msg) {
35
35
  function errorMsg(msg) {
36
36
  console.error(styleText(["red", "bold"], "error:"), msg);
37
37
  }
38
- //#endregion
39
38
  export { muted as a, warnMsg as c, log as i, errorMsg as n, printHeader as o, formatDuration as r, success as s, accent as t };
package/dist/toolchain.js CHANGED
@@ -4,7 +4,7 @@ export const toolchain = {
4
4
  {
5
5
  "id": "vite-plus",
6
6
  "name": "vite-plus",
7
- "version": "1.3.0",
7
+ "version": "1.5.0",
8
8
  "kind": "package",
9
9
  "delivery": [
10
10
  "dependency"
@@ -14,7 +14,7 @@ export const toolchain = {
14
14
  {
15
15
  "id": "vite-plus-core",
16
16
  "name": "@voidzero-dev/vite-plus-core",
17
- "version": "1.3.0",
17
+ "version": "1.5.0",
18
18
  "kind": "package",
19
19
  "delivery": [
20
20
  "dependency"
@@ -26,7 +26,7 @@ export const toolchain = {
26
26
  {
27
27
  "id": "vite",
28
28
  "name": "vite",
29
- "version": "8.3.4",
29
+ "version": "8.3.5",
30
30
  "kind": "tool",
31
31
  "delivery": [
32
32
  "bundled"
@@ -36,7 +36,7 @@ export const toolchain = {
36
36
  {
37
37
  "id": "rolldown",
38
38
  "name": "rolldown",
39
- "version": "1.2.14",
39
+ "version": "1.2.16",
40
40
  "kind": "tool",
41
41
  "delivery": [
42
42
  "bundled",
@@ -47,7 +47,7 @@ export const toolchain = {
47
47
  {
48
48
  "id": "vitest",
49
49
  "name": "vitest",
50
- "version": "5.0.5",
50
+ "version": "5.1.0",
51
51
  "kind": "tool",
52
52
  "delivery": [
53
53
  "dependency"
@@ -57,7 +57,7 @@ export const toolchain = {
57
57
  {
58
58
  "id": "oxlint",
59
59
  "name": "oxlint",
60
- "version": "1.88.0",
60
+ "version": "1.91.0",
61
61
  "kind": "tool",
62
62
  "delivery": [
63
63
  "dependency"
@@ -67,7 +67,7 @@ export const toolchain = {
67
67
  {
68
68
  "id": "oxfmt",
69
69
  "name": "oxfmt",
70
- "version": "0.73.0",
70
+ "version": "0.76.0",
71
71
  "kind": "tool",
72
72
  "delivery": [
73
73
  "dependency"
@@ -77,7 +77,7 @@ export const toolchain = {
77
77
  {
78
78
  "id": "oxlint-tsgolint",
79
79
  "name": "oxlint-tsgolint",
80
- "version": "7.0.2004",
80
+ "version": "7.0.2005",
81
81
  "kind": "tool",
82
82
  "delivery": [
83
83
  "dependency"
@@ -89,7 +89,7 @@ export const toolchain = {
89
89
  {
90
90
  "id": "tsdown",
91
91
  "name": "tsdown",
92
- "version": "0.23.1",
92
+ "version": "0.23.4",
93
93
  "kind": "tool",
94
94
  "delivery": [
95
95
  "bundled"
@@ -99,8 +99,8 @@ export const toolchain = {
99
99
  {
100
100
  "id": "vite-task",
101
101
  "name": "vite-task",
102
- "revision": "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc",
103
- "builtAt": "2026-10-16T05:08:44Z",
102
+ "revision": "40cb9cac46bddbf8aa5ce5373df1a6a1980acc38",
103
+ "builtAt": "2026-11-04T04:09:48Z",
104
104
  "kind": "tool",
105
105
  "delivery": [
106
106
  "compiled"
@@ -110,7 +110,7 @@ export const toolchain = {
110
110
  {
111
111
  "id": "oxc",
112
112
  "name": "oxc",
113
- "version": "0.154.0",
113
+ "version": "0.156.0",
114
114
  "kind": "engine",
115
115
  "delivery": [
116
116
  "compiled"
@@ -126,6 +126,17 @@ export const toolchain = {
126
126
  "compiled"
127
127
  ],
128
128
  "aliases": []
129
+ },
130
+ {
131
+ "id": "oxc-node",
132
+ "name": "oxc-node",
133
+ "version": "1.0.1",
134
+ "revision": "7ff14c3b1d15e2ef12310ee209d0b72b58fa880e",
135
+ "kind": "engine",
136
+ "delivery": [
137
+ "compiled"
138
+ ],
139
+ "aliases": []
129
140
  }
130
141
  ],
131
142
  "edges": [
@@ -188,6 +199,21 @@ export const toolchain = {
188
199
  "from": "vite-plus",
189
200
  "to": "vite-task",
190
201
  "relationship": "compiles"
202
+ },
203
+ {
204
+ "from": "vite-plus",
205
+ "to": "oxc-node",
206
+ "relationship": "compiles"
207
+ },
208
+ {
209
+ "from": "oxc-node",
210
+ "to": "oxc",
211
+ "relationship": "compiles"
212
+ },
213
+ {
214
+ "from": "oxc-node",
215
+ "to": "oxc-resolver",
216
+ "relationship": "compiles"
191
217
  }
192
218
  ]
193
219
  };
@@ -4,7 +4,7 @@
4
4
  {
5
5
  "id": "vite-plus",
6
6
  "name": "vite-plus",
7
- "version": "1.3.0",
7
+ "version": "1.5.0",
8
8
  "kind": "package",
9
9
  "delivery": [
10
10
  "dependency"
@@ -14,7 +14,7 @@
14
14
  {
15
15
  "id": "vite-plus-core",
16
16
  "name": "@voidzero-dev/vite-plus-core",
17
- "version": "1.3.0",
17
+ "version": "1.5.0",
18
18
  "kind": "package",
19
19
  "delivery": [
20
20
  "dependency"
@@ -26,7 +26,7 @@
26
26
  {
27
27
  "id": "vite",
28
28
  "name": "vite",
29
- "version": "8.3.4",
29
+ "version": "8.3.5",
30
30
  "kind": "tool",
31
31
  "delivery": [
32
32
  "bundled"
@@ -36,7 +36,7 @@
36
36
  {
37
37
  "id": "rolldown",
38
38
  "name": "rolldown",
39
- "version": "1.2.14",
39
+ "version": "1.2.16",
40
40
  "kind": "tool",
41
41
  "delivery": [
42
42
  "bundled",
@@ -47,7 +47,7 @@
47
47
  {
48
48
  "id": "vitest",
49
49
  "name": "vitest",
50
- "version": "5.0.5",
50
+ "version": "5.1.0",
51
51
  "kind": "tool",
52
52
  "delivery": [
53
53
  "dependency"
@@ -57,7 +57,7 @@
57
57
  {
58
58
  "id": "oxlint",
59
59
  "name": "oxlint",
60
- "version": "1.88.0",
60
+ "version": "1.91.0",
61
61
  "kind": "tool",
62
62
  "delivery": [
63
63
  "dependency"
@@ -67,7 +67,7 @@
67
67
  {
68
68
  "id": "oxfmt",
69
69
  "name": "oxfmt",
70
- "version": "0.73.0",
70
+ "version": "0.76.0",
71
71
  "kind": "tool",
72
72
  "delivery": [
73
73
  "dependency"
@@ -77,7 +77,7 @@
77
77
  {
78
78
  "id": "oxlint-tsgolint",
79
79
  "name": "oxlint-tsgolint",
80
- "version": "7.0.2004",
80
+ "version": "7.0.2005",
81
81
  "kind": "tool",
82
82
  "delivery": [
83
83
  "dependency"
@@ -89,7 +89,7 @@
89
89
  {
90
90
  "id": "tsdown",
91
91
  "name": "tsdown",
92
- "version": "0.23.1",
92
+ "version": "0.23.4",
93
93
  "kind": "tool",
94
94
  "delivery": [
95
95
  "bundled"
@@ -99,8 +99,8 @@
99
99
  {
100
100
  "id": "vite-task",
101
101
  "name": "vite-task",
102
- "revision": "9ba4cc93379cf2d7a6c7e657285bb8a00e8339dc",
103
- "builtAt": "2026-10-16T05:08:44Z",
102
+ "revision": "40cb9cac46bddbf8aa5ce5373df1a6a1980acc38",
103
+ "builtAt": "2026-11-04T04:09:48Z",
104
104
  "kind": "tool",
105
105
  "delivery": [
106
106
  "compiled"
@@ -110,7 +110,7 @@
110
110
  {
111
111
  "id": "oxc",
112
112
  "name": "oxc",
113
- "version": "0.154.0",
113
+ "version": "0.156.0",
114
114
  "kind": "engine",
115
115
  "delivery": [
116
116
  "compiled"
@@ -126,6 +126,17 @@
126
126
  "compiled"
127
127
  ],
128
128
  "aliases": []
129
+ },
130
+ {
131
+ "id": "oxc-node",
132
+ "name": "oxc-node",
133
+ "version": "1.0.1",
134
+ "revision": "7ff14c3b1d15e2ef12310ee209d0b72b58fa880e",
135
+ "kind": "engine",
136
+ "delivery": [
137
+ "compiled"
138
+ ],
139
+ "aliases": []
129
140
  }
130
141
  ],
131
142
  "edges": [
@@ -188,6 +199,21 @@
188
199
  "from": "vite-plus",
189
200
  "to": "vite-task",
190
201
  "relationship": "compiles"
202
+ },
203
+ {
204
+ "from": "vite-plus",
205
+ "to": "oxc-node",
206
+ "relationship": "compiles"
207
+ },
208
+ {
209
+ "from": "oxc-node",
210
+ "to": "oxc",
211
+ "relationship": "compiles"
212
+ },
213
+ {
214
+ "from": "oxc-node",
215
+ "to": "oxc-resolver",
216
+ "relationship": "compiles"
191
217
  }
192
218
  ]
193
219
  }
@@ -1 +1 @@
1
- export { i as fixBaseUrlInTsconfig, a as hasBaseUrlInTsconfig } from "./tsconfig-BZu7kl-x.js";
1
+ export { i as fixBaseUrlInTsconfig, a as hasBaseUrlInTsconfig } from "./tsconfig-shNmmCE_.js";
@@ -1,12 +1,12 @@
1
- import { p as createBaseUrlTsconfigFixArgs, t as BASEURL_TSCONFIG_FIX_PACKAGE } from "./constants-DR55DpRm.js";
2
- import { c as modify, l as parse, o as applyEdits } from "./json-JP24qHUF.js";
3
- import { t as vitest_v5_entry_points_default } from "./vitest-v5-entry-points-DthU1e_O.js";
4
- import { C as confirm, M as isCancel, T as log, t as cancelAndExit } from "./prompts-1xNz_ne0.js";
5
- import { n as runCommandSilently } from "./command-CdMBoZFD.js";
1
+ import { C as confirm, M as isCancel, T as log, t as cancelAndExit } from "./prompts-C7DI63WP.js";
2
+ import { c as modify, l as parse, o as applyEdits } from "./json-kl84kDyH.js";
3
+ import { t as vitest_v5_entry_points_default } from "./vitest-v5-entry-points-NyJsFeux.js";
4
+ import { i as runCommandSilently, n as getVpCommand } from "./command-rY79K5NI.js";
5
+ import { p as createBaseUrlTsconfigFixArgs, t as BASEURL_TSCONFIG_FIX_PACKAGE } from "./constants-D2P2aVKb.js";
6
6
  import path from "node:path";
7
7
  import { styleText } from "node:util";
8
8
  import fs from "node:fs";
9
- //#region src/utils/tsconfig.ts
9
+ // src/utils/tsconfig.ts
10
10
  /**
11
11
  * Check if tsconfig.json has compilerOptions.baseUrl set.
12
12
  * oxlint's TypeScript checker (tsgolint) does not support baseUrl,
@@ -56,12 +56,11 @@ async function fixBaseUrlInTsconfig(projectPath, options) {
56
56
  const fixArgs = createBaseUrlTsconfigFixArgs(target);
57
57
  if (!options?.silent) log.info(`Running vp dlx ${BASEURL_TSCONFIG_FIX_PACKAGE} ${fixArgs.join(" ")}`);
58
58
  const result = await runCommandSilently({
59
- command: process.env.VP_CLI_BIN ?? "vp",
60
- args: [
59
+ ...getVpCommand([
61
60
  "dlx",
62
61
  BASEURL_TSCONFIG_FIX_PACKAGE,
63
62
  ...fixArgs
64
- ],
63
+ ]),
65
64
  cwd: projectPath,
66
65
  envs: process.env
67
66
  });
@@ -152,5 +151,4 @@ function rewriteTypesInTsconfig(filePath) {
152
151
  fs.writeFileSync(filePath, currentText);
153
152
  return true;
154
153
  }
155
- //#endregion
156
154
  export { hasBaseUrlInTsconfig as a, hasVitestTypesInTsconfig as c, fixBaseUrlInTsconfig as i, removeDeprecatedTsconfigFalseOption as l, findTsconfigFiles as n, hasBaseUrlInTsconfigFile as o, findTsconfigFilesWithBaseUrl as r, hasTypesToRewriteInTsconfig as s, confirmBaseUrlFix as t, rewriteTypesInTsconfig as u };
package/dist/version.d.ts CHANGED
@@ -1,6 +1,4 @@
1
- //#region src/version.d.ts
2
1
  /**
3
2
  * Print version information
4
3
  */
5
- export declare function printVersion(cwd: string): Promise<void>;
6
- //#endregion
4
+ export declare function printVersion(cwd: string): Promise<void>;
package/dist/version.js CHANGED
@@ -1,11 +1,11 @@
1
- import { t as renderCliDoc } from "./help-BmKpeOP9.js";
2
- import { i as log, o as printHeader, t as accent } from "./terminal-MKGAuy-p.js";
3
- import { y as version } from "./constants-DR55DpRm.js";
4
- import { a as hasVitePlusDependency, n as detectPackageMetadata } from "./package-CQDXTm6j.js";
1
+ import { y as version } from "./constants-D2P2aVKb.js";
2
+ import { t as renderCliDoc } from "./help-B03t_iQ4.js";
3
+ import { a as hasVitePlusDependency, n as detectPackageMetadata } from "./package-DfFo6-E-.js";
4
+ import { i as log, o as printHeader, t as accent } from "./terminal-BcuPUy-j.js";
5
5
  import path from "node:path";
6
6
  import { pathToFileURL } from "node:url";
7
7
  import fs from "node:fs";
8
- //#region src/version.ts
8
+ // src/version.ts
9
9
  /** Tool display names in the order shown by `vp --version`. */
10
10
  const TOOL_DISPLAY_ORDER = [
11
11
  "vite",
@@ -83,5 +83,4 @@ async function printVersion(cwd) {
83
83
  log(renderCliDoc({ sections }));
84
84
  }
85
85
  await printVersion(process.cwd());
86
- //#endregion
87
86
  export { printVersion };
package/dist/versions.js CHANGED
@@ -1,9 +1,9 @@
1
1
  export const versions = {
2
- "vite": "8.3.4",
3
- "rolldown": "1.2.14",
4
- "vitest": "5.0.5",
5
- "oxfmt": "0.73.0",
6
- "oxlint": "1.88.0",
7
- "oxlint-tsgolint": "7.0.2004",
8
- "tsdown": "0.23.1"
2
+ "vite": "8.3.5",
3
+ "rolldown": "1.2.16",
4
+ "vitest": "5.1.0",
5
+ "oxfmt": "0.76.0",
6
+ "oxlint": "1.91.0",
7
+ "oxlint-tsgolint": "7.0.2005",
8
+ "tsdown": "0.23.4"
9
9
  };
@@ -1,4 +1,4 @@
1
- //#region src/utils/vitest-ecosystem.ts
1
+ // src/utils/vitest-ecosystem.ts
2
2
  /** Official packages that share the bundled runner's release version. */
3
3
  const VITEST_EXACT_VERSION_PACKAGES = /* @__PURE__ */ new Set([
4
4
  "@vitest/browser",
@@ -19,5 +19,4 @@ const VITEST_RESOLVER_PACKAGES = /* @__PURE__ */ new Set(["vitest", ...VITEST_EX
19
19
  function isAlignableVitestEcosystemPackage(name) {
20
20
  return VITEST_EXACT_VERSION_PACKAGES.has(name);
21
21
  }
22
- //#endregion
23
22
  export { isAlignableVitestEcosystemPackage as n, VITEST_RESOLVER_PACKAGES as t };
@@ -1,4 +1,4 @@
1
- //#region src/vitest-v5-entry-points.json
1
+ // src/vitest-v5-entry-points.json
2
2
  var vitest_v5_entry_points_default = {
3
3
  "vitest/coverage": "vite-plus/test/node",
4
4
  "vitest/reporters": "vite-plus/test/node",
@@ -21,5 +21,4 @@ var vitest_v5_entry_points_default = {
21
21
  "vite-plus/test/plugins/browser-webdriverio": "@vitest/browser-webdriverio",
22
22
  "@vitest/browser/providers/webdriverio": "@vitest/browser-webdriverio"
23
23
  };
24
- //#endregion
25
24
  export { vitest_v5_entry_points_default as t };
@@ -0,0 +1 @@
1
+ export {}
@@ -0,0 +1,232 @@
1
+ import { r as __toESM } from "./rolldown-runtime-DegdyBIC.js";
2
+ import { a as require_cross_spawn, t as exitCodeFromClose } from "./command-rY79K5NI.js";
3
+ import { a as canExecDirectly, c as nodeModulesBinPaths, l as packageInvocation, o as detectScript, r as ScriptError, s as isFile, u as parseVpxArgs } from "./vpx-script-EXgV5QOf.js";
4
+ import { createRequire } from "node:module";
5
+ import path from "node:path";
6
+ import { fileURLToPath } from "node:url";
7
+ import { styleText } from "node:util";
8
+ import { statSync } from "node:fs";
9
+ // src/vpx-bin.ts
10
+ var import_cross_spawn = /* @__PURE__ */ __toESM(require_cross_spawn(), 1);
11
+ function errorMsg(message) {
12
+ console.error(styleText(["red", "bold"], "error:"), message);
13
+ }
14
+ /** `env` with every existing `node_modules/.bin` from `cwd` up first on PATH, nearest first, like the global CLI. */
15
+ function prependLocalBins(env, cwd) {
16
+ const key = Object.keys(env).find((name) => name.toUpperCase() === "PATH") ?? "PATH";
17
+ const entries = (env[key] ?? "").split(path.delimiter).filter(Boolean);
18
+ env[key] = [...nodeModulesBinPaths(cwd).filter((bin) => !entries.includes(bin) && statSync(bin, { throwIfNoEntry: false })?.isDirectory()), ...entries].join(path.delimiter);
19
+ return env;
20
+ }
21
+ /** This process's environment for a child, with `prependLocalBins`. */
22
+ function childEnv(cwd) {
23
+ return prependLocalBins({ ...process.env }, cwd);
24
+ }
25
+ /** Signals Node.js ignores; an ignored signal stays ignored across exec. */
26
+ const IGNORED_SIGNALS = ["SIGPIPE", "SIGXFSZ"];
27
+ const ignoreSignal = () => {};
28
+ /**
29
+ * Replace this process with `command`, as the global `vpx` does on Unix, so the caller's
30
+ * PID, every signal sent to it, and the exit status belong to the script or binary.
31
+ * Returns on Windows, which has no exec, so the caller spawns instead.
32
+ *
33
+ * The new program starts as a spawned child would: libuv gives a child blocking stdio
34
+ * and default signal dispositions, while Node.js ignores SIGPIPE and makes a pipe it
35
+ * opened for stdio non-blocking (loading `node:util` opens stderr), which
36
+ * `process.execve()` passes on (nodejs/node#66824). Removing a signal listener restores
37
+ * the default disposition.
38
+ */
39
+ function execInPlace(command, args, env) {
40
+ if (process.platform === "win32" || typeof process.execve !== "function") return;
41
+ for (const signal of IGNORED_SIGNALS) process.on(signal, ignoreSignal).off(signal, ignoreSignal);
42
+ for (const stream of [
43
+ process.stdin,
44
+ process.stdout,
45
+ process.stderr
46
+ ]) stream._handle?.setBlocking?.(true);
47
+ const [file, argv] = command === process.execPath || canExecDirectly(command) ? [command, [command, ...args]] : ["/bin/sh", [
48
+ "/bin/sh",
49
+ "-c",
50
+ "exec \"$0\" \"$@\"",
51
+ command,
52
+ ...args
53
+ ]];
54
+ try {
55
+ process.execve(file, argv, env);
56
+ } catch {
57
+ for (const signal of IGNORED_SIGNALS) process.on(signal, ignoreSignal);
58
+ }
59
+ }
60
+ /**
61
+ * Run `command` with inherited stdio and exit the way it exited. On Unix, it execs
62
+ * `command` in place unless this bin has an IPC channel, which exec would close.
63
+ * cross-spawn runs a Windows `.cmd` shim from `node_modules/.bin`, which Node.js refuses
64
+ * to spawn directly.
65
+ *
66
+ * With `relayIpc`, an IPC channel this bin was started with (by `fork()`, or with an
67
+ * `ipc` stdio entry) is relayed to the child in both directions, as tsx does, so
68
+ * `process.send()` in a script reaches the process that started `vpx`. Messages use the
69
+ * default JSON serialization; a message it cannot serialize, or a handle, is not relayed.
70
+ */
71
+ function runAndExit(command, args, env, { relayIpc = false } = {}) {
72
+ if (process.send === void 0) execInPlace(command, args, env);
73
+ const ipc = relayIpc && process.send !== void 0;
74
+ const child = (0, import_cross_spawn.default)(command, args, {
75
+ stdio: ipc ? [
76
+ "inherit",
77
+ "inherit",
78
+ "inherit",
79
+ "ipc"
80
+ ] : "inherit",
81
+ env
82
+ });
83
+ let exited;
84
+ let channelClosed = !ipc;
85
+ let pendingSends = 0;
86
+ const exitWhenDone = () => {
87
+ if (!exited || !channelClosed || pendingSends > 0) return;
88
+ const { code, signal } = exited;
89
+ if (signal && process.platform !== "win32") {
90
+ process.removeAllListeners(signal);
91
+ process.on(signal, ignoreSignal).off(signal, ignoreSignal);
92
+ process.kill(process.pid, signal);
93
+ }
94
+ process.exit(exitCodeFromClose(code, signal));
95
+ };
96
+ if (ipc) {
97
+ child.on("message", (message) => {
98
+ pendingSends++;
99
+ process.send(message, void 0, void 0, () => {
100
+ pendingSends--;
101
+ exitWhenDone();
102
+ });
103
+ });
104
+ child.on("disconnect", () => {
105
+ channelClosed = true;
106
+ exitWhenDone();
107
+ });
108
+ process.on("message", (message) => {
109
+ if (!child.connected) return;
110
+ try {
111
+ child.send(message);
112
+ } catch (error) {
113
+ errorMsg(`vpx: Failed to relay an IPC message to the script: ${error.message}`);
114
+ }
115
+ });
116
+ process.on("disconnect", () => {
117
+ if (child.connected) child.disconnect();
118
+ });
119
+ }
120
+ process.on("SIGINT", () => {});
121
+ for (const signal of ["SIGTERM", "SIGHUP"]) process.on(signal, () => child.kill(signal));
122
+ child.on("error", (error) => {
123
+ errorMsg(`vpx: Failed to run ${command}: ${error.message}`);
124
+ process.exit(1);
125
+ });
126
+ child.on("exit", (code, signal) => {
127
+ exited = {
128
+ code,
129
+ signal
130
+ };
131
+ exitWhenDone();
132
+ });
133
+ }
134
+ const LOCAL_HELP = `Execute a binary from node_modules/.bin or a remote npm package, or run a script file
135
+
136
+ Usage: vpx [OPTIONS] <pkg[@version]> [args...]
137
+ vpx [OPTIONS] [NODE_OPTIONS] <script> [args...]
138
+
139
+ Arguments:
140
+ <pkg[@version]> Package binary to execute
141
+ <script> Script file to run (.ts, .mts, .cts, .tsx, .js, .mjs, .cjs, .jsx)
142
+ [args...] Arguments to pass to the command or script
143
+
144
+ Options:
145
+ -p, --package <NAME> Package(s) to download
146
+ -c, --shell-mode Execute the command within a shell environment
147
+ -s, --silent Suppress all output except the command's output
148
+ --tsconfig <PATH> tsconfig.json to use when running a script
149
+ -v, --version Print the Vite+ version
150
+ -h, --help Print help
151
+
152
+ Before a script, --watch reruns it when a file it uses changes (see \`vpx --watch --help\`).
153
+
154
+ This project-local vpx runs in package.json scripts. It runs binaries installed in
155
+ node_modules/.bin, and downloads a package only for a version, --package, or --shell-mode.
156
+
157
+ Examples:
158
+ vpx eslint . # Run eslint from node_modules/.bin
159
+ vpx create-vue@latest my-app # Download and run create-vue
160
+ vpx -p cowsay -c 'echo "hi" | cowsay' # Shell mode with package
161
+ vpx ./scripts/seed.ts --dry-run # Run a TypeScript script
162
+ vpx --inspect ./server.ts # Pass Node.js options before the script
163
+ vpx --watch ./server.ts # Rerun the script when a file it uses changes
164
+ `;
165
+ function fail(message, note) {
166
+ errorMsg(message);
167
+ if (note) console.error(styleText(["dim", "bold"], "note:"), note);
168
+ process.exit(1);
169
+ }
170
+ const args = process.argv.slice(2);
171
+ const cwd = process.cwd();
172
+ const { flags, positional } = parseVpxArgs(args);
173
+ if (flags.help) {
174
+ process.stdout.write(LOCAL_HELP);
175
+ process.exit(0);
176
+ }
177
+ if (flags.version) {
178
+ const { version } = createRequire(import.meta.url)("../package.json");
179
+ process.stdout.write(`vite-plus v${version}\n`);
180
+ process.exit(0);
181
+ }
182
+ const [first, ...rest] = positional;
183
+ if (first === void 0) {
184
+ errorMsg("vpx requires a command to run");
185
+ process.stderr.write("\nUsage: vpx <pkg[@version]> [args...]\n vpx <script> [args...]\n\nExamples:\n vpx eslint .\n vpx create-vue my-app\n vpx ./scripts/seed.ts\n");
186
+ process.exit(1);
187
+ }
188
+ const packageFlags = flags.packages.length > 0 || flags.shellMode;
189
+ let invocation;
190
+ if (!packageFlags || !first.startsWith("-")) {
191
+ try {
192
+ invocation = detectScript(positional, cwd);
193
+ } catch (error) {
194
+ if (!(error instanceof ScriptError)) throw error;
195
+ if (!flags.shellMode) fail(`vpx: ${error.message}`);
196
+ }
197
+ if (invocation && packageFlags) fail(`vpx: ${flags.shellMode ? "--shell-mode" : "--package"} cannot be used when running a script`);
198
+ }
199
+ if (invocation) {
200
+ const env = invocation.watch ? prependLocalBins(process.env, cwd) : childEnv(cwd);
201
+ const tsconfig = invocation.tsconfig ?? flags.tsconfig;
202
+ if (tsconfig === void 0) delete env.VP_SCRIPT_TSCONFIG;
203
+ else {
204
+ const file = path.resolve(cwd, tsconfig);
205
+ if (!isFile(file)) fail(`vpx: tsconfig not found: ${tsconfig}`);
206
+ env.VP_SCRIPT_TSCONFIG = file;
207
+ }
208
+ if (invocation.watch) {
209
+ process.argv = [...process.argv.slice(0, 2), ...invocation.nodeArgs];
210
+ await import(new URL("./script-watch.js", import.meta.url).href);
211
+ } else runAndExit(process.execPath, [
212
+ "--require",
213
+ fileURLToPath(new URL("./script-preload.cjs", import.meta.url)),
214
+ "--import",
215
+ new URL("./script-register.js", import.meta.url).href,
216
+ ...invocation.nodeArgs
217
+ ], env, { relayIpc: true });
218
+ } else {
219
+ if (flags.tsconfig !== void 0) fail("vpx: --tsconfig can only be used when running a script");
220
+ const result = packageInvocation(flags, [first, ...rest], cwd);
221
+ if ("error" in result) fail(`vpx: ${result.error}`, result.note);
222
+ if (result.command === "run") runAndExit(result.file, result.args, childEnv(cwd));
223
+ else {
224
+ process.argv = [
225
+ ...process.argv.slice(0, 2),
226
+ "dlx",
227
+ ...result.args
228
+ ];
229
+ await import(new URL("./bin.js", import.meta.url).href);
230
+ }
231
+ }
232
+ export {};