vite-plus 1.2.0 → 1.4.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.
- package/AGENTS.md +4 -0
- package/LICENSE +1 -849
- package/README.md +1 -1
- package/bin/vpx +9 -0
- package/binding/index.cjs +59 -54
- package/binding/index.d.cts +132 -2
- package/dist/{agent-KeDc6vmg.js → agent-D8oxxhVR.js} +7 -9
- package/dist/bin.js +27 -34
- package/dist/{cli-parse-DHE8NrBU.js → cli-parse-aeUeFDlC.js} +2 -3
- package/dist/command-TjS_6y9O.js +1 -0
- package/dist/{command-CguLh2KL.js → command-rY79K5NI.js} +40 -42
- package/dist/{comparison-CmVirWIW-DUGaiYqF.js → comparison-CmVirWIW-UlEf2maz.js} +1 -2
- package/dist/config/bin.js +8 -10
- package/dist/{constants-BW3g7VnD.js → constants-DRUnJ_Dz.js} +4 -6
- package/dist/create/bin.d.ts +4 -8
- package/dist/create/bin.js +64 -68
- package/dist/{define-config-CIlk9scU.js → define-config-ChwJcu5e.js} +6 -9
- package/dist/{define-config-Dq_23Eyr.cjs → define-config-Cv2P6NT2.cjs} +8 -13
- package/dist/{define-config-Bexdd6RZ.d.ts → define-config-rPhYIFSn.d.ts} +1 -11
- 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-Bi7ZEK3c.js → dist-Bs0SObNC.js} +77 -149
- package/dist/{dist-Cqz8OtiO.js → dist-CdkMvIiQ.js} +11 -5
- package/dist/dist-zDZV5eEc.js +3 -0
- package/dist/{documentation-DqcZSthV.js → documentation-cv_y0Auv.js} +1 -2
- package/dist/{editor-b1XUwt9v.js → editor-ClL78D8u.js} +1492 -4211
- package/dist/{help-BmKpeOP9.js → help-B03t_iQ4.js} +1 -2
- package/dist/hooks/bin.js +4 -5
- package/dist/{hooks-DhwsWb46.js → hooks-xRcJPc-O.js} +5 -4
- package/dist/index.cjs +2 -3
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-JP24qHUF.js → json-kl84kDyH.js} +9 -18
- package/dist/lint-plugins.cjs +1 -1
- package/dist/migration/bin.js +719 -184
- package/dist/migration/compat/worker.js +4 -6
- package/dist/{oxlint-plugin-config-Dx-ZY2MN.js → oxlint-plugin-config-BVpqYdcC.js} +3 -4
- package/dist/oxlint-plugin.d.ts +0 -2
- package/dist/oxlint-plugin.js +6 -7
- package/dist/{pack-BK38MLVZ.d.ts → pack-ARPFMefW.d.ts} +0 -2
- package/dist/pack-bin.d.ts +1 -3
- package/dist/pack-bin.js +3 -4
- package/dist/pack.d.ts +1 -1
- package/dist/{package-BP16iQby.js → package-DzsomcUD.js} +10 -95
- package/dist/{package-overrides-D1RcXSFl.js → package-overrides-Ci8GXouY.js} +5 -8
- package/dist/picomatch-DEUoj81q.js +1916 -0
- package/dist/{prompts-BGpQtC5z.js → prompts-GL1vj0wk.js} +113 -239
- package/dist/{protocol-D99W10Qi.js → protocol-CkNmY-Mr.js} +1 -2
- package/dist/{report-NhQk8VHb.js → report-DLHO30yZ.js} +2 -2
- package/dist/{resolve-vite-config-x47JetlI.js → resolve-vite-config-Dn5896A4.js} +9 -25
- package/dist/resolve-vite-config-QO6cC0SP.js +1 -0
- package/dist/{rolldown-runtime-CMFfr-1z.js → rolldown-runtime-DegdyBIC.js} +2 -3
- package/dist/script-esm-hooks.d.ts +8 -0
- package/dist/script-esm-hooks.js +24 -0
- package/dist/script-hooks-9Fof5UMY.js +176 -0
- package/dist/script-preload.cjs +468 -0
- package/dist/script-register.d.ts +1 -0
- package/dist/script-register.js +22 -0
- package/dist/script-watch.d.ts +1 -0
- package/dist/script-watch.js +1908 -0
- package/dist/staged/bin.js +81 -2011
- package/dist/sync-versions/bin.js +29 -50
- package/dist/sync-versions/bin.mjs +117 -224
- package/dist/{terminal-MKGAuy-p.js → terminal-BcuPUy-j.js} +1 -2
- package/dist/toolchain.js +36 -10
- package/dist/toolchain.json +36 -10
- package/dist/{tsconfig-C5PnJfW4.js → tsconfig-Do6MAG_f.js} +1 -1
- package/dist/{tsconfig-D2DzAQ_D.js → tsconfig-LE_mAwe_.js} +8 -10
- package/dist/version.d.ts +1 -3
- package/dist/version.js +5 -6
- package/dist/versions.js +5 -5
- package/dist/{vitest-ecosystem-BU0AqZq-.js → vitest-ecosystem-BeEYz-qF.js} +1 -2
- package/dist/{vitest-v5-entry-points-DthU1e_O.js → vitest-v5-entry-points-NyJsFeux.js} +1 -2
- package/dist/vpx-bin.d.ts +1 -0
- package/dist/vpx-bin.js +232 -0
- package/dist/vpx-script-EXgV5QOf.js +434 -0
- package/docs/config/run.md +4 -0
- package/docs/guide/check.md +1 -0
- package/docs/guide/ci.md +13 -3
- package/docs/guide/create.md +34 -0
- package/docs/guide/env.md +27 -13
- package/docs/guide/global-cli.md +52 -0
- package/docs/guide/local-cli.md +4 -4
- package/docs/guide/migrate-rules.md +48 -5
- package/docs/guide/migrate.md +6 -6
- package/docs/guide/package-management.md +19 -2
- package/docs/guide/test.md +1 -1
- package/docs/guide/vitest-v5.md +2 -2
- package/docs/guide/vpx.md +170 -9
- package/package.json +32 -29
- package/dist/command-DaRqSNpP.js +0 -1
- package/dist/dist-CBWGibx8.js +0 -3
- package/dist/resolve-vite-config-CGzlyhGr.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { shouldPrintVitePlusHeader, vitePlusHeader } from "../binding/index.js";
|
|
2
2
|
import { styleText } from "node:util";
|
|
3
|
-
|
|
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.
|
|
7
|
+
"version": "1.4.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.
|
|
17
|
+
"version": "1.4.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.
|
|
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.
|
|
39
|
+
"version": "1.2.15",
|
|
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.
|
|
50
|
+
"version": "5.0.5",
|
|
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.
|
|
60
|
+
"version": "1.89.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.
|
|
70
|
+
"version": "0.74.0",
|
|
71
71
|
"kind": "tool",
|
|
72
72
|
"delivery": [
|
|
73
73
|
"dependency"
|
|
@@ -99,8 +99,8 @@ export const toolchain = {
|
|
|
99
99
|
{
|
|
100
100
|
"id": "vite-task",
|
|
101
101
|
"name": "vite-task",
|
|
102
|
-
"revision": "
|
|
103
|
-
"builtAt": "2026-10-
|
|
102
|
+
"revision": "a3c087a771a116f7c60220fc72738703eb45ac2e",
|
|
103
|
+
"builtAt": "2026-10-23T02:30:38Z",
|
|
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.
|
|
113
|
+
"version": "0.155.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.0",
|
|
134
|
+
"revision": "4759cedbda87f67ca646d3277166884cfcd62f81",
|
|
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
|
};
|
package/dist/toolchain.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
{
|
|
5
5
|
"id": "vite-plus",
|
|
6
6
|
"name": "vite-plus",
|
|
7
|
-
"version": "1.
|
|
7
|
+
"version": "1.4.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.
|
|
17
|
+
"version": "1.4.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.
|
|
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.
|
|
39
|
+
"version": "1.2.15",
|
|
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.
|
|
50
|
+
"version": "5.0.5",
|
|
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.
|
|
60
|
+
"version": "1.89.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.
|
|
70
|
+
"version": "0.74.0",
|
|
71
71
|
"kind": "tool",
|
|
72
72
|
"delivery": [
|
|
73
73
|
"dependency"
|
|
@@ -99,8 +99,8 @@
|
|
|
99
99
|
{
|
|
100
100
|
"id": "vite-task",
|
|
101
101
|
"name": "vite-task",
|
|
102
|
-
"revision": "
|
|
103
|
-
"builtAt": "2026-10-
|
|
102
|
+
"revision": "a3c087a771a116f7c60220fc72738703eb45ac2e",
|
|
103
|
+
"builtAt": "2026-10-23T02:30:38Z",
|
|
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.
|
|
113
|
+
"version": "0.155.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.0",
|
|
134
|
+
"revision": "4759cedbda87f67ca646d3277166884cfcd62f81",
|
|
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-
|
|
1
|
+
export { i as fixBaseUrlInTsconfig, a as hasBaseUrlInTsconfig } from "./tsconfig-LE_mAwe_.js";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { p as createBaseUrlTsconfigFixArgs, t as BASEURL_TSCONFIG_FIX_PACKAGE } from "./constants-
|
|
2
|
-
import { c as modify, l as parse, o as applyEdits } from "./json-
|
|
3
|
-
import { t as vitest_v5_entry_points_default } from "./vitest-v5-entry-points-
|
|
4
|
-
import { C as confirm, M as isCancel, T as log, t as cancelAndExit } from "./prompts-
|
|
5
|
-
import {
|
|
1
|
+
import { p as createBaseUrlTsconfigFixArgs, t as BASEURL_TSCONFIG_FIX_PACKAGE } from "./constants-DRUnJ_Dz.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 { C as confirm, M as isCancel, T as log, t as cancelAndExit } from "./prompts-GL1vj0wk.js";
|
|
5
|
+
import { i as runCommandSilently, n as getVpCommand } from "./command-rY79K5NI.js";
|
|
6
6
|
import path from "node:path";
|
|
7
7
|
import { styleText } from "node:util";
|
|
8
8
|
import fs from "node:fs";
|
|
9
|
-
|
|
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
|
-
|
|
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
package/dist/version.js
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
|
-
import { t as renderCliDoc } from "./help-
|
|
2
|
-
import { i as log, o as printHeader, t as accent } from "./terminal-
|
|
3
|
-
import { y as version } from "./constants-
|
|
4
|
-
import { a as hasVitePlusDependency, n as detectPackageMetadata } from "./package-
|
|
1
|
+
import { t as renderCliDoc } from "./help-B03t_iQ4.js";
|
|
2
|
+
import { i as log, o as printHeader, t as accent } from "./terminal-BcuPUy-j.js";
|
|
3
|
+
import { y as version } from "./constants-DRUnJ_Dz.js";
|
|
4
|
+
import { a as hasVitePlusDependency, n as detectPackageMetadata } from "./package-DzsomcUD.js";
|
|
5
5
|
import path from "node:path";
|
|
6
6
|
import { pathToFileURL } from "node:url";
|
|
7
7
|
import fs from "node:fs";
|
|
8
|
-
|
|
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.
|
|
3
|
-
"rolldown": "1.2.
|
|
4
|
-
"vitest": "5.0.
|
|
5
|
-
"oxfmt": "0.
|
|
6
|
-
"oxlint": "1.
|
|
2
|
+
"vite": "8.3.5",
|
|
3
|
+
"rolldown": "1.2.15",
|
|
4
|
+
"vitest": "5.0.5",
|
|
5
|
+
"oxfmt": "0.74.0",
|
|
6
|
+
"oxlint": "1.89.0",
|
|
7
7
|
"oxlint-tsgolint": "7.0.2004",
|
|
8
8
|
"tsdown": "0.23.1"
|
|
9
9
|
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
|
|
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
|
-
|
|
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 {}
|
package/dist/vpx-bin.js
ADDED
|
@@ -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 {};
|