vite-plus 0.2.7 → 0.2.9
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 +7 -0
- package/LICENSE +5 -1
- package/README.md +9 -3
- package/bin/vpr +3 -2
- package/binding/index.cjs +193 -80
- package/binding/index.d.cts +106 -11
- package/dist/agent-DQU8uS6P.js +416 -0
- package/dist/bin.js +1388 -23
- package/dist/{cli-truncate-BVOlIIPy.js → cli-truncate-Bg3RDXpi.js} +0 -2
- package/dist/client/bundledDevClient.mjs +1 -0
- package/dist/config/bin.js +32 -133
- package/dist/{constants-BsuzPowC.js → constants-CG513DRa.js} +10 -2
- package/dist/create/bin.js +255 -268
- package/dist/{define-config-C2KfLHpC.js → define-config-CV4bQG_8.js} +3 -3
- package/dist/{define-config-eLQH9us2.d.ts → define-config-DWoAkNdp.d.ts} +16 -0
- package/dist/{define-config-DLh9fE95.cjs → define-config-DyNLA_f0.cjs} +1 -1
- package/dist/define-config.cjs +1 -1
- package/dist/define-config.d.ts +1 -1
- package/dist/define-config.js +1 -1
- package/dist/{dist-CKz3vcoG.js → dist-BDYZP12R.js} +196 -157
- package/dist/dist-Dqv1-Clg.js +3 -0
- package/dist/{agent-CPwWJ4qf.js → editor-g4PosU99.js} +819 -628
- package/dist/hooks/bin.d.ts +1 -0
- package/dist/hooks/bin.js +130 -0
- package/dist/hooks-pNCBWtFT.js +570 -0
- package/dist/index.cjs +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/{json-DiRs8ceZ.js → json-qlK6UH0r.js} +40 -38
- package/dist/migration/bin.js +65 -58
- package/dist/{oxlint-plugin-config-Bxgc4cwF.js → oxlint-plugin-config-BEZ9IUf7.js} +1 -1
- package/dist/oxlint-plugin.js +1 -1
- package/dist/pack-bin.js +1 -1
- package/dist/{package-Ds3uThLb.js → package-B4T8RGMG.js} +2 -2
- package/dist/{tsconfig-Jia2vgMG.js → prompts-CHz_98bJ.js} +169 -219
- package/dist/{resolve-vite-config-BiuLZnn8.js → resolve-vite-config-Dmeyeyj-.js} +2 -9
- package/dist/{rolldown-runtime-C7HZzL1F.js → rolldown-runtime-CMFfr-1z.js} +1 -1
- package/dist/staged/bin.js +241 -226
- package/dist/terminal-Bz-ps6rJ.js +128 -0
- package/dist/test/browser/providers/playwright/context.d.ts +1 -1
- package/dist/test/browser/providers/playwright.d.ts +6 -6
- package/dist/test/browser/providers/preview/context.d.ts +1 -1
- package/dist/test/browser/providers/preview.d.ts +4 -4
- package/dist/test/browser/providers/webdriverio/context.d.ts +1 -1
- package/dist/test/browser/providers/webdriverio.d.ts +6 -6
- package/dist/test/browser-playwright/context.d.ts +1 -1
- package/dist/test/browser-playwright.d.ts +6 -6
- package/dist/test/browser-preview/context.d.ts +1 -1
- package/dist/test/browser-preview.d.ts +4 -4
- package/dist/test/browser-webdriverio/context.d.ts +1 -1
- package/dist/test/browser-webdriverio.d.ts +6 -6
- package/dist/test/context.d.ts +3 -3
- package/dist/test/locators.d.ts +1 -1
- package/dist/toolchain.d.ts +25 -0
- package/dist/toolchain.js +194 -0
- package/dist/toolchain.json +193 -0
- package/dist/tsconfig-7v_BHagU.js +151 -0
- package/dist/{tsgolint-path-B-yOos8p.js → tsgolint-path-CbDReEOx.js} +5 -3
- package/dist/tsgolint-path.js +1 -1
- package/dist/version.js +6 -6
- package/dist/versions.d.ts +3 -3
- package/dist/versions.js +6 -6
- package/docs/config/index.md +13 -0
- package/docs/config/staged.md +2 -1
- package/docs/guide/ci.md +37 -4
- package/docs/guide/commit-hooks.md +112 -21
- package/docs/guide/create.md +7 -4
- package/docs/guide/env.md +8 -4
- package/docs/guide/fmt.md +2 -2
- package/docs/guide/github-actions-cache.md +5 -1
- package/docs/guide/ide-integration.md +61 -2
- package/docs/guide/index.md +4 -2
- package/docs/guide/install.md +27 -0
- package/docs/guide/installer-env-vars.md +14 -3
- package/docs/guide/lint.md +3 -1
- package/docs/guide/migrate.md +49 -4
- package/docs/guide/monorepo.md +98 -10
- package/docs/guide/troubleshooting.md +12 -3
- package/docs/guide/upgrade.md +27 -4
- package/docs/package.json +1 -1
- package/docs/pnpm-workspace.yaml +7 -0
- package/docs/vite.config.ts +3 -0
- package/package.json +21 -23
- package/rules/vite-tools.yml +0 -7
- package/dist/dist-CtM2JRbM.js +0 -3
- package/dist/editor-BbT1lTNc.js +0 -675
- package/dist/help-YP84FSEz.js +0 -61
- package/dist/terminal-uTv0ZaMr.js +0 -33
- package/dist/{log-update-DHZRyJ2m.js → log-update-CoW8Z4Dl.js} +1 -1
package/dist/bin.js
CHANGED
|
@@ -1,13 +1,1353 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { r as
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
1
|
+
import { c as warnMsg, i as log, l as renderCliDoc, n as errorMsg, o as printHeader, t as accent } from "./terminal-Bz-ps6rJ.js";
|
|
2
|
+
import { c as VITE_PLUS_NAME, i as DEFAULT_ENVS, m as resolveBundled, n as BASEURL_TSCONFIG_WARNING, p as resolve$1, r as CONFIG_METADATA_ENV, s as VITE_CONFIG_FILES } from "./constants-CG513DRa.js";
|
|
3
|
+
import { r as createDefaultVitePlusLintConfig } from "./oxlint-plugin-config-BEZ9IUf7.js";
|
|
4
|
+
import { M as runCommandSilently } from "./prompts-CHz_98bJ.js";
|
|
5
|
+
import { i as hasBaseUrlInTsconfig, r as fixBaseUrlInTsconfig } from "./tsconfig-7v_BHagU.js";
|
|
6
|
+
import { t as resolveTsgolintExecutable } from "./tsgolint-path-CbDReEOx.js";
|
|
7
|
+
import { i as resolveUniversalViteConfig } from "./resolve-vite-config-Dmeyeyj-.js";
|
|
7
8
|
import path, { dirname, join } from "node:path";
|
|
9
|
+
import { fileURLToPath } from "node:url";
|
|
8
10
|
import { ensureBlockingStdio, hasConfigKey, mergeJsonConfig, run } from "../binding/index.js";
|
|
9
11
|
import fs, { readFileSync } from "node:fs";
|
|
10
|
-
|
|
12
|
+
//#region src/help.ts
|
|
13
|
+
const commandHelpDocs = {
|
|
14
|
+
dev: {
|
|
15
|
+
usage: "vp dev [ROOT] [OPTIONS]",
|
|
16
|
+
summary: ["Run the development server.", "Options are forwarded to Vite."],
|
|
17
|
+
sections: [
|
|
18
|
+
{
|
|
19
|
+
title: "Arguments",
|
|
20
|
+
rows: [{
|
|
21
|
+
label: "[ROOT]",
|
|
22
|
+
description: "Project root directory (default: current directory)"
|
|
23
|
+
}]
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
title: "Options",
|
|
27
|
+
rows: [
|
|
28
|
+
{
|
|
29
|
+
label: "--host [host]",
|
|
30
|
+
description: "[string] specify hostname"
|
|
31
|
+
},
|
|
32
|
+
{
|
|
33
|
+
label: "--port <port>",
|
|
34
|
+
description: "[number] specify port"
|
|
35
|
+
},
|
|
36
|
+
{
|
|
37
|
+
label: "--open [path]",
|
|
38
|
+
description: "[boolean | string] open browser on startup"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
label: "--cors",
|
|
42
|
+
description: "[boolean] enable CORS"
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
label: "--strictPort",
|
|
46
|
+
description: "[boolean] exit if specified port is already in use"
|
|
47
|
+
},
|
|
48
|
+
{
|
|
49
|
+
label: "--force",
|
|
50
|
+
description: "[boolean] force the optimizer to ignore the cache and re-bundle"
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
label: "--experimentalBundle",
|
|
54
|
+
description: "[boolean] use experimental full bundle mode (this is highly experimental)"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
label: "--base <path>",
|
|
58
|
+
description: "[string] public base path (default: /)"
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
label: "-l, --logLevel <level>",
|
|
62
|
+
description: "[string] info | warn | error | silent"
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: "--clearScreen",
|
|
66
|
+
description: "[boolean] allow/disable clear screen when logging"
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
label: "-d, --debug [feat]",
|
|
70
|
+
description: "[string | boolean] show debug logs"
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
label: "-f, --filter <filter>",
|
|
74
|
+
description: "[string] filter debug logs"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
label: "-m, --mode <mode>",
|
|
78
|
+
description: "[string] set env mode"
|
|
79
|
+
},
|
|
80
|
+
{
|
|
81
|
+
label: "-h, --help",
|
|
82
|
+
description: "Display this message"
|
|
83
|
+
}
|
|
84
|
+
]
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
title: "Examples",
|
|
88
|
+
lines: [
|
|
89
|
+
" vp dev",
|
|
90
|
+
" vp dev --open",
|
|
91
|
+
" vp dev --host localhost --port 5173"
|
|
92
|
+
]
|
|
93
|
+
}
|
|
94
|
+
],
|
|
95
|
+
documentationUrl: "https://viteplus.dev/guide/dev"
|
|
96
|
+
},
|
|
97
|
+
build: {
|
|
98
|
+
usage: "vp build [ROOT] [OPTIONS]",
|
|
99
|
+
summary: ["Build for production.", "Options are forwarded to Vite."],
|
|
100
|
+
sections: [
|
|
101
|
+
{
|
|
102
|
+
title: "Arguments",
|
|
103
|
+
rows: [{
|
|
104
|
+
label: "[ROOT]",
|
|
105
|
+
description: "Project root directory (default: current directory)"
|
|
106
|
+
}]
|
|
107
|
+
},
|
|
108
|
+
{
|
|
109
|
+
title: "Options",
|
|
110
|
+
rows: [
|
|
111
|
+
{
|
|
112
|
+
label: "--target <target>",
|
|
113
|
+
description: "[string] transpile target (default: 'baseline-widely-available')"
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
label: "--outDir <dir>",
|
|
117
|
+
description: "[string] output directory (default: dist)"
|
|
118
|
+
},
|
|
119
|
+
{
|
|
120
|
+
label: "--assetsDir <dir>",
|
|
121
|
+
description: "[string] directory under outDir to place assets in (default: assets)"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
label: "--assetsInlineLimit <number>",
|
|
125
|
+
description: "[number] static asset base64 inline threshold in bytes (default: 4096)"
|
|
126
|
+
},
|
|
127
|
+
{
|
|
128
|
+
label: "--ssr [entry]",
|
|
129
|
+
description: "[string] build specified entry for server-side rendering"
|
|
130
|
+
},
|
|
131
|
+
{
|
|
132
|
+
label: "--sourcemap [output]",
|
|
133
|
+
description: "[boolean | \"inline\" | \"hidden\"] output source maps for build (default: false)"
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
label: "--minify [minifier]",
|
|
137
|
+
description: "[boolean | \"oxc\" | \"terser\" | \"esbuild\"] enable/disable minification, or specify minifier to use (default: oxc)"
|
|
138
|
+
},
|
|
139
|
+
{
|
|
140
|
+
label: "--manifest [name]",
|
|
141
|
+
description: "[boolean | string] emit build manifest json"
|
|
142
|
+
},
|
|
143
|
+
{
|
|
144
|
+
label: "--ssrManifest [name]",
|
|
145
|
+
description: "[boolean | string] emit ssr manifest json"
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
label: "--emptyOutDir",
|
|
149
|
+
description: "[boolean] force empty outDir when it's outside of root"
|
|
150
|
+
},
|
|
151
|
+
{
|
|
152
|
+
label: "-w, --watch",
|
|
153
|
+
description: "[boolean] rebuilds when modules have changed on disk"
|
|
154
|
+
},
|
|
155
|
+
{
|
|
156
|
+
label: "--app",
|
|
157
|
+
description: "[boolean] same as `builder: {}`"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
label: "--base <path>",
|
|
161
|
+
description: "[string] public base path (default: /)"
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
label: "-l, --logLevel <level>",
|
|
165
|
+
description: "[string] info | warn | error | silent"
|
|
166
|
+
},
|
|
167
|
+
{
|
|
168
|
+
label: "--clearScreen",
|
|
169
|
+
description: "[boolean] allow/disable clear screen when logging"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
label: "-d, --debug [feat]",
|
|
173
|
+
description: "[string | boolean] show debug logs"
|
|
174
|
+
},
|
|
175
|
+
{
|
|
176
|
+
label: "-f, --filter <filter>",
|
|
177
|
+
description: "[string] filter debug logs"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
label: "-m, --mode <mode>",
|
|
181
|
+
description: "[string] set env mode"
|
|
182
|
+
},
|
|
183
|
+
{
|
|
184
|
+
label: "-h, --help",
|
|
185
|
+
description: "Display this message"
|
|
186
|
+
}
|
|
187
|
+
]
|
|
188
|
+
},
|
|
189
|
+
{
|
|
190
|
+
title: "Examples",
|
|
191
|
+
lines: [
|
|
192
|
+
" vp build",
|
|
193
|
+
" vp build --watch",
|
|
194
|
+
" vp build --sourcemap"
|
|
195
|
+
]
|
|
196
|
+
}
|
|
197
|
+
],
|
|
198
|
+
documentationUrl: "https://viteplus.dev/guide/build"
|
|
199
|
+
},
|
|
200
|
+
preview: {
|
|
201
|
+
usage: "vp preview [ROOT] [OPTIONS]",
|
|
202
|
+
summary: ["Preview a production build.", "Options are forwarded to Vite."],
|
|
203
|
+
sections: [
|
|
204
|
+
{
|
|
205
|
+
title: "Arguments",
|
|
206
|
+
rows: [{
|
|
207
|
+
label: "[ROOT]",
|
|
208
|
+
description: "Project root directory (default: current directory)"
|
|
209
|
+
}]
|
|
210
|
+
},
|
|
211
|
+
{
|
|
212
|
+
title: "Options",
|
|
213
|
+
rows: [
|
|
214
|
+
{
|
|
215
|
+
label: "--host [host]",
|
|
216
|
+
description: "[string] specify hostname"
|
|
217
|
+
},
|
|
218
|
+
{
|
|
219
|
+
label: "--port <port>",
|
|
220
|
+
description: "[number] specify port"
|
|
221
|
+
},
|
|
222
|
+
{
|
|
223
|
+
label: "--strictPort",
|
|
224
|
+
description: "[boolean] exit if specified port is already in use"
|
|
225
|
+
},
|
|
226
|
+
{
|
|
227
|
+
label: "--open [path]",
|
|
228
|
+
description: "[boolean | string] open browser on startup"
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
label: "--outDir <dir>",
|
|
232
|
+
description: "[string] output directory (default: dist)"
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
label: "--base <path>",
|
|
236
|
+
description: "[string] public base path (default: /)"
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
label: "-l, --logLevel <level>",
|
|
240
|
+
description: "[string] info | warn | error | silent"
|
|
241
|
+
},
|
|
242
|
+
{
|
|
243
|
+
label: "--clearScreen",
|
|
244
|
+
description: "[boolean] allow/disable clear screen when logging"
|
|
245
|
+
},
|
|
246
|
+
{
|
|
247
|
+
label: "-d, --debug [feat]",
|
|
248
|
+
description: "[string | boolean] show debug logs"
|
|
249
|
+
},
|
|
250
|
+
{
|
|
251
|
+
label: "-f, --filter <filter>",
|
|
252
|
+
description: "[string] filter debug logs"
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
label: "-m, --mode <mode>",
|
|
256
|
+
description: "[string] set env mode"
|
|
257
|
+
},
|
|
258
|
+
{
|
|
259
|
+
label: "-h, --help",
|
|
260
|
+
description: "Display this message"
|
|
261
|
+
}
|
|
262
|
+
]
|
|
263
|
+
},
|
|
264
|
+
{
|
|
265
|
+
title: "Examples",
|
|
266
|
+
lines: [" vp preview", " vp preview --port 4173"]
|
|
267
|
+
}
|
|
268
|
+
],
|
|
269
|
+
documentationUrl: "https://viteplus.dev/guide/build"
|
|
270
|
+
},
|
|
271
|
+
test: {
|
|
272
|
+
usage: "vp test [COMMAND] [FILTERS]... [OPTIONS]",
|
|
273
|
+
summary: ["Run tests once by default.", "Options are forwarded to Vitest."],
|
|
274
|
+
sections: [
|
|
275
|
+
{
|
|
276
|
+
title: "Commands",
|
|
277
|
+
rows: [
|
|
278
|
+
{
|
|
279
|
+
label: "run",
|
|
280
|
+
description: "Run tests once"
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
label: "watch",
|
|
284
|
+
description: "Run tests in watch mode"
|
|
285
|
+
},
|
|
286
|
+
{
|
|
287
|
+
label: "dev",
|
|
288
|
+
description: "Run tests in development mode"
|
|
289
|
+
},
|
|
290
|
+
{
|
|
291
|
+
label: "related",
|
|
292
|
+
description: "Run tests related to changed files"
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
label: "bench",
|
|
296
|
+
description: "Run benchmarks"
|
|
297
|
+
},
|
|
298
|
+
{
|
|
299
|
+
label: "list",
|
|
300
|
+
description: "List matching tests"
|
|
301
|
+
}
|
|
302
|
+
]
|
|
303
|
+
},
|
|
304
|
+
{
|
|
305
|
+
title: "Arguments",
|
|
306
|
+
rows: [{
|
|
307
|
+
label: "[FILTERS]...",
|
|
308
|
+
description: "Test file filters"
|
|
309
|
+
}]
|
|
310
|
+
},
|
|
311
|
+
{
|
|
312
|
+
title: "Options",
|
|
313
|
+
rows: [
|
|
314
|
+
{
|
|
315
|
+
label: "-r, --root <path>",
|
|
316
|
+
description: "Root path"
|
|
317
|
+
},
|
|
318
|
+
{
|
|
319
|
+
label: "-u, --update [type]",
|
|
320
|
+
description: "Update snapshot (accepts boolean, \"new\", \"all\" or \"none\")"
|
|
321
|
+
},
|
|
322
|
+
{
|
|
323
|
+
label: "-w, --watch",
|
|
324
|
+
description: "Enable watch mode"
|
|
325
|
+
},
|
|
326
|
+
{
|
|
327
|
+
label: "-t, --testNamePattern <pattern>",
|
|
328
|
+
description: "Run tests with full names matching the specified regexp pattern"
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
label: "--dir <path>",
|
|
332
|
+
description: "Base directory to scan for the test files"
|
|
333
|
+
},
|
|
334
|
+
{
|
|
335
|
+
label: "--ui",
|
|
336
|
+
description: "Enable UI"
|
|
337
|
+
},
|
|
338
|
+
{
|
|
339
|
+
label: "--open",
|
|
340
|
+
description: "Open UI automatically (default: !process.env.CI)"
|
|
341
|
+
},
|
|
342
|
+
{
|
|
343
|
+
label: "--api [port]",
|
|
344
|
+
description: "Specify server port. Note if the port is already being used, Vite will automatically try the next available port so this may not be the actual port the server ends up listening on. If true will be set to 51204. Use '--help --api' for more info."
|
|
345
|
+
},
|
|
346
|
+
{
|
|
347
|
+
label: "--silent [value]",
|
|
348
|
+
description: "Silent console output from tests. Use 'passed-only' to see logs from failing tests only."
|
|
349
|
+
},
|
|
350
|
+
{
|
|
351
|
+
label: "--hideSkippedTests",
|
|
352
|
+
description: "Hide logs for skipped tests"
|
|
353
|
+
},
|
|
354
|
+
{
|
|
355
|
+
label: "--reporter <name>",
|
|
356
|
+
description: "Specify reporters (default, agent, minimal, blob, verbose, dot, json, tap, tap-flat, junit, tree, hanging-process, github-actions)"
|
|
357
|
+
},
|
|
358
|
+
{
|
|
359
|
+
label: "--outputFile <filename/-s>",
|
|
360
|
+
description: "Write test results to a file when supporter reporter is also specified, use cac's dot notation for individual outputs of multiple reporters (example: --outputFile.tap=./tap.txt)"
|
|
361
|
+
},
|
|
362
|
+
{
|
|
363
|
+
label: "--coverage",
|
|
364
|
+
description: "Enable coverage report. Use '--help --coverage' for more info."
|
|
365
|
+
},
|
|
366
|
+
{
|
|
367
|
+
label: "--mode <name>",
|
|
368
|
+
description: "Override Vite mode (default: test or benchmark)"
|
|
369
|
+
},
|
|
370
|
+
{
|
|
371
|
+
label: "--isolate",
|
|
372
|
+
description: "Run every test file in isolation. To disable isolation, use --no-isolate (default: true)"
|
|
373
|
+
},
|
|
374
|
+
{
|
|
375
|
+
label: "--globals",
|
|
376
|
+
description: "Inject apis globally"
|
|
377
|
+
},
|
|
378
|
+
{
|
|
379
|
+
label: "--dom",
|
|
380
|
+
description: "Mock browser API with happy-dom"
|
|
381
|
+
},
|
|
382
|
+
{
|
|
383
|
+
label: "--browser <name>",
|
|
384
|
+
description: "Run tests in the browser. Equivalent to --browser.enabled (default: false). Use '--help --browser' for more info."
|
|
385
|
+
},
|
|
386
|
+
{
|
|
387
|
+
label: "--pool <pool>",
|
|
388
|
+
description: "Specify pool, if not running in the browser (default: forks)"
|
|
389
|
+
},
|
|
390
|
+
{
|
|
391
|
+
label: "--execArgv <option>",
|
|
392
|
+
description: "Pass additional arguments to node process when spawning worker_threads or child_process."
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
label: "--vmMemoryLimit <limit>",
|
|
396
|
+
description: "Memory limit for VM pools. If you see memory leaks, try to tinker this value."
|
|
397
|
+
},
|
|
398
|
+
{
|
|
399
|
+
label: "--fileParallelism",
|
|
400
|
+
description: "Should all test files run in parallel. Use --no-file-parallelism to disable (default: true)"
|
|
401
|
+
},
|
|
402
|
+
{
|
|
403
|
+
label: "--maxWorkers <workers>",
|
|
404
|
+
description: "Maximum number or percentage of workers to run tests in"
|
|
405
|
+
},
|
|
406
|
+
{
|
|
407
|
+
label: "--environment <name>",
|
|
408
|
+
description: "Specify runner environment, if not running in the browser (default: node)"
|
|
409
|
+
},
|
|
410
|
+
{
|
|
411
|
+
label: "--passWithNoTests",
|
|
412
|
+
description: "Pass when no tests are found"
|
|
413
|
+
},
|
|
414
|
+
{
|
|
415
|
+
label: "--logHeapUsage",
|
|
416
|
+
description: "Show the size of heap for each test when running in node"
|
|
417
|
+
},
|
|
418
|
+
{
|
|
419
|
+
label: "--detectAsyncLeaks",
|
|
420
|
+
description: "Detect asynchronous resources leaking from the test file (default: false)"
|
|
421
|
+
},
|
|
422
|
+
{
|
|
423
|
+
label: "--allowOnly",
|
|
424
|
+
description: "Allow tests and suites that are marked as only (default: !process.env.CI)"
|
|
425
|
+
},
|
|
426
|
+
{
|
|
427
|
+
label: "--dangerouslyIgnoreUnhandledErrors",
|
|
428
|
+
description: "Ignore any unhandled errors that occur"
|
|
429
|
+
},
|
|
430
|
+
{
|
|
431
|
+
label: "--shard <shards>",
|
|
432
|
+
description: "Test suite shard to execute in a format of <index>/<count>"
|
|
433
|
+
},
|
|
434
|
+
{
|
|
435
|
+
label: "--changed [since]",
|
|
436
|
+
description: "Run tests that are affected by the changed files (default: false)"
|
|
437
|
+
},
|
|
438
|
+
{
|
|
439
|
+
label: "--sequence <options>",
|
|
440
|
+
description: "Options for how tests should be sorted. Use '--help --sequence' for more info."
|
|
441
|
+
},
|
|
442
|
+
{
|
|
443
|
+
label: "--inspect [[host:]port]",
|
|
444
|
+
description: "Enable Node.js inspector (default: 127.0.0.1:9229)"
|
|
445
|
+
},
|
|
446
|
+
{
|
|
447
|
+
label: "--inspectBrk [[host:]port]",
|
|
448
|
+
description: "Enable Node.js inspector and break before the test starts"
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
label: "--testTimeout <timeout>",
|
|
452
|
+
description: "Default timeout of a test in milliseconds (default: 5000). Use 0 to disable timeout completely."
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
label: "--hookTimeout <timeout>",
|
|
456
|
+
description: "Default hook timeout in milliseconds (default: 10000). Use 0 to disable timeout completely."
|
|
457
|
+
},
|
|
458
|
+
{
|
|
459
|
+
label: "--bail <number>",
|
|
460
|
+
description: "Stop test execution when given number of tests have failed (default: 0)"
|
|
461
|
+
},
|
|
462
|
+
{
|
|
463
|
+
label: "--retry <times>",
|
|
464
|
+
description: "Retry the test specific number of times if it fails (default: 0). Use '--help --retry' for more info."
|
|
465
|
+
},
|
|
466
|
+
{
|
|
467
|
+
label: "--diff <path>",
|
|
468
|
+
description: "DiffOptions object or a path to a module which exports DiffOptions object. Use '--help --diff' for more info."
|
|
469
|
+
},
|
|
470
|
+
{
|
|
471
|
+
label: "--exclude <glob>",
|
|
472
|
+
description: "Additional file globs to be excluded from test"
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
label: "--expandSnapshotDiff",
|
|
476
|
+
description: "Show full diff when snapshot fails"
|
|
477
|
+
},
|
|
478
|
+
{
|
|
479
|
+
label: "--disableConsoleIntercept",
|
|
480
|
+
description: "Disable automatic interception of console logging (default: false)"
|
|
481
|
+
},
|
|
482
|
+
{
|
|
483
|
+
label: "--typecheck",
|
|
484
|
+
description: "Enable typechecking alongside tests (default: false). Use '--help --typecheck' for more info."
|
|
485
|
+
},
|
|
486
|
+
{
|
|
487
|
+
label: "--project <name>",
|
|
488
|
+
description: "The name of the project to run if you are using Vitest workspace feature. This can be repeated for multiple projects: --project=1 --project=2. You can also filter projects using wildcards like --project=packages*, and exclude projects with --project=!pattern."
|
|
489
|
+
},
|
|
490
|
+
{
|
|
491
|
+
label: "--slowTestThreshold <threshold>",
|
|
492
|
+
description: "Threshold in milliseconds for a test or suite to be considered slow (default: 300)"
|
|
493
|
+
},
|
|
494
|
+
{
|
|
495
|
+
label: "--teardownTimeout <timeout>",
|
|
496
|
+
description: "Default timeout of a teardown function in milliseconds (default: 10000)"
|
|
497
|
+
},
|
|
498
|
+
{
|
|
499
|
+
label: "--cache",
|
|
500
|
+
description: "Enable cache. Use '--help --cache' for more info."
|
|
501
|
+
},
|
|
502
|
+
{
|
|
503
|
+
label: "--maxConcurrency <number>",
|
|
504
|
+
description: "Maximum number of concurrent tests and suites during test file execution (default: 5)"
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
label: "--expect",
|
|
508
|
+
description: "Configuration options for expect() matches. Use '--help --expect' for more info."
|
|
509
|
+
},
|
|
510
|
+
{
|
|
511
|
+
label: "--printConsoleTrace",
|
|
512
|
+
description: "Always print console stack traces"
|
|
513
|
+
},
|
|
514
|
+
{
|
|
515
|
+
label: "--includeTaskLocation",
|
|
516
|
+
description: "Collect test and suite locations in the location property"
|
|
517
|
+
},
|
|
518
|
+
{
|
|
519
|
+
label: "--attachmentsDir <dir>",
|
|
520
|
+
description: "The directory where attachments from context.annotate are stored in (default: .vitest-attachments)"
|
|
521
|
+
},
|
|
522
|
+
{
|
|
523
|
+
label: "--run",
|
|
524
|
+
description: "Disable watch mode"
|
|
525
|
+
},
|
|
526
|
+
{
|
|
527
|
+
label: "--no-color",
|
|
528
|
+
description: "Removes colors from the console output (default: true)"
|
|
529
|
+
},
|
|
530
|
+
{
|
|
531
|
+
label: "--clearScreen",
|
|
532
|
+
description: "Clear terminal screen when re-running tests during watch mode (default: true)"
|
|
533
|
+
},
|
|
534
|
+
{
|
|
535
|
+
label: "--standalone",
|
|
536
|
+
description: "Start Vitest without running tests. Tests will be running only on change. If browser mode is enabled, the UI will be opened automatically. This option is ignored when CLI file filters are passed. (default: false)"
|
|
537
|
+
},
|
|
538
|
+
{
|
|
539
|
+
label: "--mergeReports [path]",
|
|
540
|
+
description: "Path to a blob reports directory. If this options is used, Vitest won't run any tests, it will only report previously recorded tests"
|
|
541
|
+
},
|
|
542
|
+
{
|
|
543
|
+
label: "--listTags [type]",
|
|
544
|
+
description: "List all available tags instead of running tests. --list-tags=json will output tags in JSON format, unless there are no tags."
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
label: "--clearCache",
|
|
548
|
+
description: "Delete all Vitest caches, including experimental.fsModuleCache, without running any tests. This will reduce the performance in the subsequent test run."
|
|
549
|
+
},
|
|
550
|
+
{
|
|
551
|
+
label: "--tagsFilter <expression>",
|
|
552
|
+
description: "Run only tests with the specified tags. You can use logical operators && (and), || (or) and ! (not) to create complex expressions, see https://vitest.dev/guide/test-tags#syntax for more information."
|
|
553
|
+
},
|
|
554
|
+
{
|
|
555
|
+
label: "--strictTags",
|
|
556
|
+
description: "Should Vitest throw an error if test has a tag that is not defined in the config. (default: true)"
|
|
557
|
+
},
|
|
558
|
+
{
|
|
559
|
+
label: "--experimental <features>",
|
|
560
|
+
description: "Experimental features.. Use '--help --experimental' for more info."
|
|
561
|
+
},
|
|
562
|
+
{
|
|
563
|
+
label: "-h, --help",
|
|
564
|
+
description: "Display this message"
|
|
565
|
+
}
|
|
566
|
+
]
|
|
567
|
+
},
|
|
568
|
+
{
|
|
569
|
+
title: "Bench Options",
|
|
570
|
+
rows: [{
|
|
571
|
+
label: "--compare <filename>",
|
|
572
|
+
description: "Benchmark output file to compare against"
|
|
573
|
+
}, {
|
|
574
|
+
label: "--outputJson <filename>",
|
|
575
|
+
description: "Benchmark output file"
|
|
576
|
+
}]
|
|
577
|
+
},
|
|
578
|
+
{
|
|
579
|
+
title: "List Options",
|
|
580
|
+
rows: [
|
|
581
|
+
{
|
|
582
|
+
label: "--json [true/path]",
|
|
583
|
+
description: "Print collected tests as JSON or write to a file (Default: false)"
|
|
584
|
+
},
|
|
585
|
+
{
|
|
586
|
+
label: "--filesOnly",
|
|
587
|
+
description: "Print only test files with out the test cases"
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
label: "--staticParse",
|
|
591
|
+
description: "Parse files statically instead of running them to collect tests (default: false)"
|
|
592
|
+
},
|
|
593
|
+
{
|
|
594
|
+
label: "--staticParseConcurrency <limit>",
|
|
595
|
+
description: "How many tests to process at the same time (default: os.availableParallelism())"
|
|
596
|
+
}
|
|
597
|
+
]
|
|
598
|
+
},
|
|
599
|
+
{
|
|
600
|
+
title: "Examples",
|
|
601
|
+
lines: [
|
|
602
|
+
" vp test",
|
|
603
|
+
" vp test src/foo.test.ts",
|
|
604
|
+
" vp test watch --coverage"
|
|
605
|
+
]
|
|
606
|
+
}
|
|
607
|
+
],
|
|
608
|
+
documentationUrl: "https://viteplus.dev/guide/test"
|
|
609
|
+
},
|
|
610
|
+
lint: {
|
|
611
|
+
usage: "vp lint [PATH]... [OPTIONS]",
|
|
612
|
+
summary: ["Lint code.", "Options are forwarded to Oxlint."],
|
|
613
|
+
sections: [
|
|
614
|
+
{
|
|
615
|
+
title: "Available positional items",
|
|
616
|
+
rows: [{
|
|
617
|
+
label: "[PATH]...",
|
|
618
|
+
description: "Single file, single path or list of paths"
|
|
619
|
+
}]
|
|
620
|
+
},
|
|
621
|
+
{
|
|
622
|
+
title: "Basic Configuration",
|
|
623
|
+
rows: [{
|
|
624
|
+
label: "--tsconfig=<./tsconfig.json>",
|
|
625
|
+
description: "Override the TypeScript config used for import resolution. Oxlint automatically discovers the relevant `tsconfig.json` for each file. Use this only when your project uses a non-standard tsconfig name or location."
|
|
626
|
+
}]
|
|
627
|
+
},
|
|
628
|
+
{
|
|
629
|
+
title: "Allowing / Denying Multiple Lints",
|
|
630
|
+
lines: [
|
|
631
|
+
" Accumulate rules and categories from left to right on the command-line.",
|
|
632
|
+
" For example `-D correctness -A no-debugger` or `-A all -D no-debugger`.",
|
|
633
|
+
" The categories are:",
|
|
634
|
+
" * `correctness` - Code that is outright wrong or useless (default)",
|
|
635
|
+
" * `suspicious` - Code that is most likely wrong or useless",
|
|
636
|
+
" * `pedantic` - Lints which are rather strict or have occasional false positives",
|
|
637
|
+
" * `perf` - Code that could be written in a more performant way",
|
|
638
|
+
" * `style` - Code that should be written in a more idiomatic way",
|
|
639
|
+
" * `restriction` - Lints which prevent the use of language and library features",
|
|
640
|
+
" * `nursery` - New lints that are still under development",
|
|
641
|
+
" * `all` - All categories listed above except `nursery`. Does not enable plugins automatically."
|
|
642
|
+
],
|
|
643
|
+
rows: [
|
|
644
|
+
{
|
|
645
|
+
label: "-A, --allow=NAME",
|
|
646
|
+
description: "Allow the rule or category (suppress the lint)"
|
|
647
|
+
},
|
|
648
|
+
{
|
|
649
|
+
label: "-W, --warn=NAME",
|
|
650
|
+
description: "Warn on the rule or category (emit a warning)"
|
|
651
|
+
},
|
|
652
|
+
{
|
|
653
|
+
label: "-D, --deny=NAME",
|
|
654
|
+
description: "Deny the rule or category (emit an error)"
|
|
655
|
+
}
|
|
656
|
+
]
|
|
657
|
+
},
|
|
658
|
+
{
|
|
659
|
+
title: "Enable/Disable Plugins",
|
|
660
|
+
rows: [
|
|
661
|
+
{
|
|
662
|
+
label: "--disable-unicorn-plugin",
|
|
663
|
+
description: "Disable unicorn plugin, which is turned on by default"
|
|
664
|
+
},
|
|
665
|
+
{
|
|
666
|
+
label: "--disable-oxc-plugin",
|
|
667
|
+
description: "Disable oxc unique rules, which is turned on by default"
|
|
668
|
+
},
|
|
669
|
+
{
|
|
670
|
+
label: "--disable-typescript-plugin",
|
|
671
|
+
description: "Disable TypeScript plugin, which is turned on by default"
|
|
672
|
+
},
|
|
673
|
+
{
|
|
674
|
+
label: "--import-plugin",
|
|
675
|
+
description: "Enable import plugin and detect ESM problems."
|
|
676
|
+
},
|
|
677
|
+
{
|
|
678
|
+
label: "--react-plugin",
|
|
679
|
+
description: "Enable react plugin, which is turned off by default"
|
|
680
|
+
},
|
|
681
|
+
{
|
|
682
|
+
label: "--jsdoc-plugin",
|
|
683
|
+
description: "Enable jsdoc plugin and detect JSDoc problems"
|
|
684
|
+
},
|
|
685
|
+
{
|
|
686
|
+
label: "--jest-plugin",
|
|
687
|
+
description: "Enable the Jest plugin and detect test problems"
|
|
688
|
+
},
|
|
689
|
+
{
|
|
690
|
+
label: "--vitest-plugin",
|
|
691
|
+
description: "Enable the Vitest plugin and detect test problems"
|
|
692
|
+
},
|
|
693
|
+
{
|
|
694
|
+
label: "--jsx-a11y-plugin",
|
|
695
|
+
description: "Enable the JSX-a11y plugin and detect accessibility problems"
|
|
696
|
+
},
|
|
697
|
+
{
|
|
698
|
+
label: "--nextjs-plugin",
|
|
699
|
+
description: "Enable the Next.js plugin and detect Next.js problems"
|
|
700
|
+
},
|
|
701
|
+
{
|
|
702
|
+
label: "--react-perf-plugin",
|
|
703
|
+
description: "Enable the React performance plugin and detect rendering performance problems"
|
|
704
|
+
},
|
|
705
|
+
{
|
|
706
|
+
label: "--promise-plugin",
|
|
707
|
+
description: "Enable the promise plugin and detect promise usage problems"
|
|
708
|
+
},
|
|
709
|
+
{
|
|
710
|
+
label: "--node-plugin",
|
|
711
|
+
description: "Enable the node plugin and detect node usage problems"
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
label: "--vue-plugin",
|
|
715
|
+
description: "Enable the vue plugin and detect vue usage problems"
|
|
716
|
+
}
|
|
717
|
+
]
|
|
718
|
+
},
|
|
719
|
+
{
|
|
720
|
+
title: "Fix Problems",
|
|
721
|
+
rows: [
|
|
722
|
+
{
|
|
723
|
+
label: "--fix",
|
|
724
|
+
description: "Fix as many issues as possible. Only unfixed issues are reported in the output."
|
|
725
|
+
},
|
|
726
|
+
{
|
|
727
|
+
label: "--fix-suggestions",
|
|
728
|
+
description: "Apply auto-fixable suggestions. May change program behavior."
|
|
729
|
+
},
|
|
730
|
+
{
|
|
731
|
+
label: "--fix-dangerously",
|
|
732
|
+
description: "Apply dangerous fixes and suggestions"
|
|
733
|
+
}
|
|
734
|
+
]
|
|
735
|
+
},
|
|
736
|
+
{
|
|
737
|
+
title: "Ignore Files",
|
|
738
|
+
rows: [
|
|
739
|
+
{
|
|
740
|
+
label: "--ignore-path=PATH",
|
|
741
|
+
description: "Specify the file to use as your `.eslintignore`"
|
|
742
|
+
},
|
|
743
|
+
{
|
|
744
|
+
label: "--ignore-pattern=PAT",
|
|
745
|
+
description: "Specify patterns of files to ignore (in addition to those in `.eslintignore`)"
|
|
746
|
+
},
|
|
747
|
+
{
|
|
748
|
+
label: "--no-ignore",
|
|
749
|
+
description: "Disable excluding files from `.eslintignore` files, --ignore-path flags and --ignore-pattern flags"
|
|
750
|
+
}
|
|
751
|
+
]
|
|
752
|
+
},
|
|
753
|
+
{
|
|
754
|
+
title: "Handle Warnings",
|
|
755
|
+
rows: [
|
|
756
|
+
{
|
|
757
|
+
label: "--quiet",
|
|
758
|
+
description: "Disable reporting on warnings, only errors are reported"
|
|
759
|
+
},
|
|
760
|
+
{
|
|
761
|
+
label: "--deny-warnings",
|
|
762
|
+
description: "Ensure warnings produce a non-zero exit code"
|
|
763
|
+
},
|
|
764
|
+
{
|
|
765
|
+
label: "--max-warnings=INT",
|
|
766
|
+
description: "Specify a warning threshold, which can be used to force exit with an error status if there are too many warning-level rule violations in your project"
|
|
767
|
+
}
|
|
768
|
+
]
|
|
769
|
+
},
|
|
770
|
+
{
|
|
771
|
+
title: "Output",
|
|
772
|
+
rows: [{
|
|
773
|
+
label: "-f, --format=ARG",
|
|
774
|
+
description: "Use a specific output format. Possible values: `checkstyle`, `default`, `agent`, `github`, `gitlab`, `json`, `junit`, `sarif`, `stylish`, `unix`"
|
|
775
|
+
}, {
|
|
776
|
+
label: "--debug=OPTIONS",
|
|
777
|
+
description: [
|
|
778
|
+
"Enable debug output options. Options are comma-separated. Possible values:",
|
|
779
|
+
" * `files` - Print the list of files that will be linted, then exit.",
|
|
780
|
+
" * `timings` - Enable per-rule timing information."
|
|
781
|
+
]
|
|
782
|
+
}]
|
|
783
|
+
},
|
|
784
|
+
{
|
|
785
|
+
title: "Miscellaneous",
|
|
786
|
+
rows: [
|
|
787
|
+
{
|
|
788
|
+
label: "--silent",
|
|
789
|
+
description: "Do not display any diagnostics"
|
|
790
|
+
},
|
|
791
|
+
{
|
|
792
|
+
label: "--no-error-on-unmatched-pattern",
|
|
793
|
+
description: "Do not exit with an error when no files are selected for linting (for example, after applying ignore patterns)"
|
|
794
|
+
},
|
|
795
|
+
{
|
|
796
|
+
label: "--threads=INT",
|
|
797
|
+
description: "Number of threads to use. Set to 1 for using only 1 CPU core."
|
|
798
|
+
},
|
|
799
|
+
{
|
|
800
|
+
label: "--print-config",
|
|
801
|
+
description: "This option outputs the configuration to be used. When present, no linting is performed and only config-related options are valid."
|
|
802
|
+
}
|
|
803
|
+
]
|
|
804
|
+
},
|
|
805
|
+
{
|
|
806
|
+
title: "Inline Configuration Comments",
|
|
807
|
+
rows: [{
|
|
808
|
+
label: "--report-unused-disable-directives",
|
|
809
|
+
description: "Report directive comments like `// oxlint-disable-line`, when no errors would have been reported on that line anyway"
|
|
810
|
+
}, {
|
|
811
|
+
label: "--report-unused-disable-directives-severity=SEVERITY",
|
|
812
|
+
description: "Same as `--report-unused-disable-directives`, but allows you to specify the severity level of the reported errors. Only one of these two options can be used at a time."
|
|
813
|
+
}]
|
|
814
|
+
},
|
|
815
|
+
{
|
|
816
|
+
title: "Available options",
|
|
817
|
+
rows: [
|
|
818
|
+
{
|
|
819
|
+
label: "--rules",
|
|
820
|
+
description: "List all the rules that are currently registered"
|
|
821
|
+
},
|
|
822
|
+
{
|
|
823
|
+
label: "--type-aware",
|
|
824
|
+
description: "Enable rules that require type information"
|
|
825
|
+
},
|
|
826
|
+
{
|
|
827
|
+
label: "--type-check",
|
|
828
|
+
description: "Enable experimental type checking (includes TypeScript compiler diagnostics)"
|
|
829
|
+
},
|
|
830
|
+
{
|
|
831
|
+
label: "-h, --help",
|
|
832
|
+
description: "Prints help information"
|
|
833
|
+
}
|
|
834
|
+
]
|
|
835
|
+
},
|
|
836
|
+
{
|
|
837
|
+
title: "Examples",
|
|
838
|
+
lines: [
|
|
839
|
+
" vp lint",
|
|
840
|
+
" vp lint src --fix",
|
|
841
|
+
" vp lint --type-aware --tsconfig ./tsconfig.json"
|
|
842
|
+
]
|
|
843
|
+
}
|
|
844
|
+
],
|
|
845
|
+
documentationUrl: "https://viteplus.dev/guide/lint"
|
|
846
|
+
},
|
|
847
|
+
fmt: {
|
|
848
|
+
usage: "vp fmt [PATH]... [OPTIONS]",
|
|
849
|
+
summary: ["Format code.", "Options are forwarded to Oxfmt."],
|
|
850
|
+
sections: [
|
|
851
|
+
{
|
|
852
|
+
title: "Available positional items",
|
|
853
|
+
rows: [{
|
|
854
|
+
label: "[PATH]...",
|
|
855
|
+
description: "Single file, path or list of paths. Glob patterns are also supported. (Be sure to quote them, otherwise your shell may expand them before passing.) Exclude patterns with `!` prefix like `'!**/fixtures/*.js'` are also supported. If not provided, current working directory is used."
|
|
856
|
+
}]
|
|
857
|
+
},
|
|
858
|
+
{
|
|
859
|
+
title: "Mode Options",
|
|
860
|
+
rows: [{
|
|
861
|
+
label: "--stdin-filepath=PATH",
|
|
862
|
+
description: "Specify the file name to use to infer which parser to use"
|
|
863
|
+
}]
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
title: "Output Options",
|
|
867
|
+
rows: [
|
|
868
|
+
{
|
|
869
|
+
label: "--write",
|
|
870
|
+
description: "Format and write files in place (default)"
|
|
871
|
+
},
|
|
872
|
+
{
|
|
873
|
+
label: "--check",
|
|
874
|
+
description: "Check if files are formatted, also show statistics"
|
|
875
|
+
},
|
|
876
|
+
{
|
|
877
|
+
label: "--list-different",
|
|
878
|
+
description: "List files that would be changed"
|
|
879
|
+
}
|
|
880
|
+
]
|
|
881
|
+
},
|
|
882
|
+
{
|
|
883
|
+
title: "Ignore Options",
|
|
884
|
+
rows: [{
|
|
885
|
+
label: "--ignore-path=PATH",
|
|
886
|
+
description: "Path to ignore file(s). Can be specified multiple times. If not specified, .gitignore and .prettierignore in the current directory are used."
|
|
887
|
+
}, {
|
|
888
|
+
label: "--with-node-modules",
|
|
889
|
+
description: "Format code in node_modules directory (skipped by default)"
|
|
890
|
+
}]
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
title: "Runtime Options",
|
|
894
|
+
rows: [{
|
|
895
|
+
label: "--no-error-on-unmatched-pattern",
|
|
896
|
+
description: "Do not exit with error when pattern is unmatched"
|
|
897
|
+
}, {
|
|
898
|
+
label: "--threads=INT",
|
|
899
|
+
description: "Number of threads to use. Set to 1 for using only 1 CPU core."
|
|
900
|
+
}]
|
|
901
|
+
},
|
|
902
|
+
{
|
|
903
|
+
title: "Available options",
|
|
904
|
+
rows: [{
|
|
905
|
+
label: "-h, --help",
|
|
906
|
+
description: "Prints help information"
|
|
907
|
+
}]
|
|
908
|
+
},
|
|
909
|
+
{
|
|
910
|
+
title: "Examples",
|
|
911
|
+
lines: [
|
|
912
|
+
" vp fmt",
|
|
913
|
+
" vp fmt src --check",
|
|
914
|
+
" vp fmt . --write"
|
|
915
|
+
]
|
|
916
|
+
}
|
|
917
|
+
],
|
|
918
|
+
documentationUrl: "https://viteplus.dev/guide/fmt"
|
|
919
|
+
},
|
|
920
|
+
check: {
|
|
921
|
+
usage: "vp check [OPTIONS] [PATHS]...",
|
|
922
|
+
summary: "Run format, lint, and type checks.",
|
|
923
|
+
sections: [
|
|
924
|
+
{
|
|
925
|
+
title: "Arguments",
|
|
926
|
+
rows: [{
|
|
927
|
+
label: "[PATHS]...",
|
|
928
|
+
description: "File paths to pass to fmt and lint"
|
|
929
|
+
}]
|
|
930
|
+
},
|
|
931
|
+
{
|
|
932
|
+
title: "Options",
|
|
933
|
+
rows: [
|
|
934
|
+
{
|
|
935
|
+
label: "--fix",
|
|
936
|
+
description: "Auto-fix format and lint issues"
|
|
937
|
+
},
|
|
938
|
+
{
|
|
939
|
+
label: "--no-fmt",
|
|
940
|
+
description: "Skip format check"
|
|
941
|
+
},
|
|
942
|
+
{
|
|
943
|
+
label: "--no-lint",
|
|
944
|
+
description: "Skip lint rules; type-check still runs when `lint.options.typeCheck` is true"
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
label: "--no-error-on-unmatched-pattern",
|
|
948
|
+
description: "Do not exit with error when pattern is unmatched"
|
|
949
|
+
},
|
|
950
|
+
{
|
|
951
|
+
label: "-h, --help",
|
|
952
|
+
description: "Print help"
|
|
953
|
+
}
|
|
954
|
+
]
|
|
955
|
+
},
|
|
956
|
+
{
|
|
957
|
+
title: "Examples",
|
|
958
|
+
lines: [
|
|
959
|
+
" vp check",
|
|
960
|
+
" vp check --fix",
|
|
961
|
+
" vp check --no-lint src/index.ts"
|
|
962
|
+
]
|
|
963
|
+
}
|
|
964
|
+
],
|
|
965
|
+
documentationUrl: "https://viteplus.dev/guide/check"
|
|
966
|
+
},
|
|
967
|
+
pack: {
|
|
968
|
+
usage: "vp pack [...files] [OPTIONS]",
|
|
969
|
+
summary: ["Build a library.", "Options are forwarded to Vite+ Pack."],
|
|
970
|
+
sections: [
|
|
971
|
+
{
|
|
972
|
+
title: "Arguments",
|
|
973
|
+
rows: [{
|
|
974
|
+
label: "[...files]",
|
|
975
|
+
description: "Bundle files"
|
|
976
|
+
}]
|
|
977
|
+
},
|
|
978
|
+
{
|
|
979
|
+
title: "Options",
|
|
980
|
+
rows: [
|
|
981
|
+
{
|
|
982
|
+
label: "-f, --format <format>",
|
|
983
|
+
description: "Bundle format: esm, cjs, iife, umd (default: esm)"
|
|
984
|
+
},
|
|
985
|
+
{
|
|
986
|
+
label: "--clean",
|
|
987
|
+
description: "Clean output directory, --no-clean to disable"
|
|
988
|
+
},
|
|
989
|
+
{
|
|
990
|
+
label: "--deps.never-bundle <module>",
|
|
991
|
+
description: "Mark dependencies as external"
|
|
992
|
+
},
|
|
993
|
+
{
|
|
994
|
+
label: "--minify",
|
|
995
|
+
description: "Minify output"
|
|
996
|
+
},
|
|
997
|
+
{
|
|
998
|
+
label: "--devtools",
|
|
999
|
+
description: "Enable devtools integration"
|
|
1000
|
+
},
|
|
1001
|
+
{
|
|
1002
|
+
label: "--debug [feat]",
|
|
1003
|
+
description: "Show debug logs"
|
|
1004
|
+
},
|
|
1005
|
+
{
|
|
1006
|
+
label: "--target <target>",
|
|
1007
|
+
description: "Bundle target, e.g \"es2015\", \"esnext\""
|
|
1008
|
+
},
|
|
1009
|
+
{
|
|
1010
|
+
label: "-l, --logLevel <level>",
|
|
1011
|
+
description: "Set log level: info, warn, error, silent"
|
|
1012
|
+
},
|
|
1013
|
+
{
|
|
1014
|
+
label: "--fail-on-warn",
|
|
1015
|
+
description: "Fail on warnings (default: true)"
|
|
1016
|
+
},
|
|
1017
|
+
{
|
|
1018
|
+
label: "--no-write",
|
|
1019
|
+
description: "Disable writing files to disk, incompatible with watch mode (default: true)"
|
|
1020
|
+
},
|
|
1021
|
+
{
|
|
1022
|
+
label: "-d, --out-dir <dir>",
|
|
1023
|
+
description: "Output directory (default: dist)"
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
label: "--treeshake",
|
|
1027
|
+
description: "Tree-shake bundle (default: true)"
|
|
1028
|
+
},
|
|
1029
|
+
{
|
|
1030
|
+
label: "--sourcemap",
|
|
1031
|
+
description: "Generate source map (default: false)"
|
|
1032
|
+
},
|
|
1033
|
+
{
|
|
1034
|
+
label: "--shims",
|
|
1035
|
+
description: "Enable cjs and esm shims (default: false)"
|
|
1036
|
+
},
|
|
1037
|
+
{
|
|
1038
|
+
label: "--platform <platform>",
|
|
1039
|
+
description: "Target platform (default: node)"
|
|
1040
|
+
},
|
|
1041
|
+
{
|
|
1042
|
+
label: "--dts",
|
|
1043
|
+
description: "Generate dts files"
|
|
1044
|
+
},
|
|
1045
|
+
{
|
|
1046
|
+
label: "--publint",
|
|
1047
|
+
description: "Enable publint (default: false)"
|
|
1048
|
+
},
|
|
1049
|
+
{
|
|
1050
|
+
label: "--attw",
|
|
1051
|
+
description: "Enable Are the types wrong integration (default: false)"
|
|
1052
|
+
},
|
|
1053
|
+
{
|
|
1054
|
+
label: "--unused",
|
|
1055
|
+
description: "Enable unused dependencies check (default: false)"
|
|
1056
|
+
},
|
|
1057
|
+
{
|
|
1058
|
+
label: "-w, --watch [path]",
|
|
1059
|
+
description: "Watch mode"
|
|
1060
|
+
},
|
|
1061
|
+
{
|
|
1062
|
+
label: "--ignore-watch <path>",
|
|
1063
|
+
description: "Ignore custom paths in watch mode"
|
|
1064
|
+
},
|
|
1065
|
+
{
|
|
1066
|
+
label: "--from-vite [vitest]",
|
|
1067
|
+
description: "Reuse config from Vite or Vitest"
|
|
1068
|
+
},
|
|
1069
|
+
{
|
|
1070
|
+
label: "--report",
|
|
1071
|
+
description: "Size report (default: true)"
|
|
1072
|
+
},
|
|
1073
|
+
{
|
|
1074
|
+
label: "--env.* <value>",
|
|
1075
|
+
description: "Define compile-time env variables"
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
label: "--env-file <file>",
|
|
1079
|
+
description: "Load environment variables from a file, when used together with --env, variables in --env take precedence"
|
|
1080
|
+
},
|
|
1081
|
+
{
|
|
1082
|
+
label: "--env-prefix <prefix>",
|
|
1083
|
+
description: "Prefix for env variables to inject into the bundle (default: TSDOWN_)"
|
|
1084
|
+
},
|
|
1085
|
+
{
|
|
1086
|
+
label: "--on-success <command>",
|
|
1087
|
+
description: "Command to run on success"
|
|
1088
|
+
},
|
|
1089
|
+
{
|
|
1090
|
+
label: "--copy <dir>",
|
|
1091
|
+
description: "Copy files to output dir"
|
|
1092
|
+
},
|
|
1093
|
+
{
|
|
1094
|
+
label: "--public-dir <dir>",
|
|
1095
|
+
description: "Alias for --copy, deprecated"
|
|
1096
|
+
},
|
|
1097
|
+
{
|
|
1098
|
+
label: "--tsconfig <tsconfig>",
|
|
1099
|
+
description: "Set tsconfig path"
|
|
1100
|
+
},
|
|
1101
|
+
{
|
|
1102
|
+
label: "--unbundle",
|
|
1103
|
+
description: "Unbundle mode"
|
|
1104
|
+
},
|
|
1105
|
+
{
|
|
1106
|
+
label: "--root <dir>",
|
|
1107
|
+
description: "Root directory of input files"
|
|
1108
|
+
},
|
|
1109
|
+
{
|
|
1110
|
+
label: "--exe",
|
|
1111
|
+
description: "Bundle as executable"
|
|
1112
|
+
},
|
|
1113
|
+
{
|
|
1114
|
+
label: "-W, --workspace [dir]",
|
|
1115
|
+
description: "Enable workspace mode"
|
|
1116
|
+
},
|
|
1117
|
+
{
|
|
1118
|
+
label: "--concurrency <count>",
|
|
1119
|
+
description: "Maximum number of Rolldown builds to run in parallel"
|
|
1120
|
+
},
|
|
1121
|
+
{
|
|
1122
|
+
label: "-F, --filter <pattern>",
|
|
1123
|
+
description: "Filter configs (cwd or name), e.g. /pkg-name$/ or pkg-name"
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
label: "--exports",
|
|
1127
|
+
description: "Generate export-related metadata for package.json (experimental)"
|
|
1128
|
+
},
|
|
1129
|
+
{
|
|
1130
|
+
label: "-h, --help",
|
|
1131
|
+
description: "Display this message"
|
|
1132
|
+
}
|
|
1133
|
+
]
|
|
1134
|
+
},
|
|
1135
|
+
{
|
|
1136
|
+
title: "Examples",
|
|
1137
|
+
lines: [
|
|
1138
|
+
" vp pack",
|
|
1139
|
+
" vp pack src/index.ts --dts",
|
|
1140
|
+
" vp pack --watch"
|
|
1141
|
+
]
|
|
1142
|
+
}
|
|
1143
|
+
],
|
|
1144
|
+
documentationUrl: "https://viteplus.dev/guide/pack"
|
|
1145
|
+
},
|
|
1146
|
+
run: {
|
|
1147
|
+
usage: "vp run [OPTIONS] [TASK_SPECIFIER] [ADDITIONAL_ARGS]...",
|
|
1148
|
+
summary: "Run tasks.",
|
|
1149
|
+
sections: [
|
|
1150
|
+
{
|
|
1151
|
+
title: "Arguments",
|
|
1152
|
+
rows: [{
|
|
1153
|
+
label: "[TASK_SPECIFIER]",
|
|
1154
|
+
description: "`packageName#taskName` or `taskName`. If omitted, shows the task selector"
|
|
1155
|
+
}, {
|
|
1156
|
+
label: "[ADDITIONAL_ARGS]...",
|
|
1157
|
+
description: "Additional arguments to pass to the task"
|
|
1158
|
+
}]
|
|
1159
|
+
},
|
|
1160
|
+
{
|
|
1161
|
+
title: "Options",
|
|
1162
|
+
rows: [
|
|
1163
|
+
{
|
|
1164
|
+
label: "-r, --recursive",
|
|
1165
|
+
description: "Select all packages in the workspace"
|
|
1166
|
+
},
|
|
1167
|
+
{
|
|
1168
|
+
label: "-t, --transitive",
|
|
1169
|
+
description: "Select the current package and its transitive dependencies"
|
|
1170
|
+
},
|
|
1171
|
+
{
|
|
1172
|
+
label: "-w, --workspace-root",
|
|
1173
|
+
description: "Select the workspace root package"
|
|
1174
|
+
},
|
|
1175
|
+
{
|
|
1176
|
+
label: "-F, --filter <FILTERS>",
|
|
1177
|
+
description: "Match packages by name, directory, or glob pattern"
|
|
1178
|
+
},
|
|
1179
|
+
{
|
|
1180
|
+
label: "--fail-if-no-match",
|
|
1181
|
+
description: "Exit with a non-zero status if a filter matches no packages"
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
label: "--ignore-depends-on",
|
|
1185
|
+
description: "Do not run dependencies specified in `dependsOn` fields"
|
|
1186
|
+
},
|
|
1187
|
+
{
|
|
1188
|
+
label: "-v, --verbose",
|
|
1189
|
+
description: "Show the full detailed summary after execution"
|
|
1190
|
+
},
|
|
1191
|
+
{
|
|
1192
|
+
label: "--cache",
|
|
1193
|
+
description: "Force caching on for all tasks and scripts"
|
|
1194
|
+
},
|
|
1195
|
+
{
|
|
1196
|
+
label: "--no-cache",
|
|
1197
|
+
description: "Force caching off for all tasks and scripts"
|
|
1198
|
+
},
|
|
1199
|
+
{
|
|
1200
|
+
label: "--log <MODE>",
|
|
1201
|
+
description: "Set output mode: interleaved (default), labeled, or grouped"
|
|
1202
|
+
},
|
|
1203
|
+
{
|
|
1204
|
+
label: "--concurrency-limit <N>",
|
|
1205
|
+
description: "Maximum number of tasks to run concurrently (default: 4)"
|
|
1206
|
+
},
|
|
1207
|
+
{
|
|
1208
|
+
label: "--parallel",
|
|
1209
|
+
description: "Run tasks without dependency ordering; concurrency is unlimited unless `--concurrency-limit` is specified"
|
|
1210
|
+
},
|
|
1211
|
+
{
|
|
1212
|
+
label: "--last-details",
|
|
1213
|
+
description: "Display the detailed summary of the last run"
|
|
1214
|
+
},
|
|
1215
|
+
{
|
|
1216
|
+
label: "-h, --help",
|
|
1217
|
+
description: "Print help"
|
|
1218
|
+
}
|
|
1219
|
+
]
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
title: "Filter Patterns",
|
|
1223
|
+
lines: [
|
|
1224
|
+
" --filter <pattern> Select by package name (e.g. foo, @scope/*)",
|
|
1225
|
+
" --filter ./<dir> Select packages under a directory",
|
|
1226
|
+
" --filter {<dir>} Same as ./<dir>, but allows traversal suffixes",
|
|
1227
|
+
" --filter <pattern>... Select package and its dependencies",
|
|
1228
|
+
" --filter ...<pattern> Select package and its dependents",
|
|
1229
|
+
" --filter <pattern>^... Select only the dependencies (exclude the package itself)",
|
|
1230
|
+
" --filter !<pattern> Exclude packages matching the pattern"
|
|
1231
|
+
]
|
|
1232
|
+
}
|
|
1233
|
+
],
|
|
1234
|
+
documentationUrl: "https://viteplus.dev/guide/run"
|
|
1235
|
+
},
|
|
1236
|
+
exec: {
|
|
1237
|
+
usage: "vp exec [OPTIONS] [COMMAND]...",
|
|
1238
|
+
summary: "Execute a command from local node_modules/.bin.",
|
|
1239
|
+
sections: [
|
|
1240
|
+
{
|
|
1241
|
+
title: "Arguments",
|
|
1242
|
+
rows: [{
|
|
1243
|
+
label: "[COMMAND]...",
|
|
1244
|
+
description: "Command and arguments to execute"
|
|
1245
|
+
}]
|
|
1246
|
+
},
|
|
1247
|
+
{
|
|
1248
|
+
title: "Options",
|
|
1249
|
+
rows: [
|
|
1250
|
+
{
|
|
1251
|
+
label: "-r, --recursive",
|
|
1252
|
+
description: "Select all packages in the workspace"
|
|
1253
|
+
},
|
|
1254
|
+
{
|
|
1255
|
+
label: "-t, --transitive",
|
|
1256
|
+
description: "Select the current package and its transitive dependencies"
|
|
1257
|
+
},
|
|
1258
|
+
{
|
|
1259
|
+
label: "-w, --workspace-root",
|
|
1260
|
+
description: "Select the workspace root package"
|
|
1261
|
+
},
|
|
1262
|
+
{
|
|
1263
|
+
label: "-F, --filter <FILTERS>",
|
|
1264
|
+
description: "Match packages by name, directory, or glob pattern"
|
|
1265
|
+
},
|
|
1266
|
+
{
|
|
1267
|
+
label: "--fail-if-no-match",
|
|
1268
|
+
description: ["Exit with a non-zero status if a `--filter` expression matches no packages", "Without this flag, unmatched filters only warn and exit successfully"]
|
|
1269
|
+
},
|
|
1270
|
+
{
|
|
1271
|
+
label: "-c, --shell-mode",
|
|
1272
|
+
description: "Execute the command within a shell environment"
|
|
1273
|
+
},
|
|
1274
|
+
{
|
|
1275
|
+
label: "--parallel",
|
|
1276
|
+
description: "Run concurrently without topological ordering"
|
|
1277
|
+
},
|
|
1278
|
+
{
|
|
1279
|
+
label: "--reverse",
|
|
1280
|
+
description: "Reverse execution order"
|
|
1281
|
+
},
|
|
1282
|
+
{
|
|
1283
|
+
label: "--resume-from <PACKAGE>",
|
|
1284
|
+
description: "Resume from a specific package"
|
|
1285
|
+
},
|
|
1286
|
+
{
|
|
1287
|
+
label: "--report-summary",
|
|
1288
|
+
description: "Save results to vp-exec-summary.json"
|
|
1289
|
+
},
|
|
1290
|
+
{
|
|
1291
|
+
label: "-h, --help",
|
|
1292
|
+
description: "Print help"
|
|
1293
|
+
}
|
|
1294
|
+
]
|
|
1295
|
+
},
|
|
1296
|
+
{
|
|
1297
|
+
title: "Filter Patterns",
|
|
1298
|
+
lines: [
|
|
1299
|
+
" --filter <pattern> Select by package name (e.g. foo, @scope/*)",
|
|
1300
|
+
" --filter ./<dir> Select packages under a directory",
|
|
1301
|
+
" --filter {<dir>} Same as ./<dir>, but allows traversal suffixes",
|
|
1302
|
+
" --filter <pattern>... Select package and its dependencies",
|
|
1303
|
+
" --filter ...<pattern> Select package and its dependents",
|
|
1304
|
+
" --filter <pattern>^... Select only the dependencies (exclude the package itself)",
|
|
1305
|
+
" --filter !<pattern> Exclude packages matching the pattern"
|
|
1306
|
+
]
|
|
1307
|
+
},
|
|
1308
|
+
{
|
|
1309
|
+
title: "Examples",
|
|
1310
|
+
lines: [
|
|
1311
|
+
" vp exec node --version # Run local node",
|
|
1312
|
+
" vp exec tsc --noEmit # Run local TypeScript compiler",
|
|
1313
|
+
" vp exec -c 'tsc --noEmit && prettier --check .' # Shell mode",
|
|
1314
|
+
" vp exec -r -- tsc --noEmit # Run in all workspace packages",
|
|
1315
|
+
" vp exec --filter 'app...' -- tsc # Run in filtered packages"
|
|
1316
|
+
]
|
|
1317
|
+
}
|
|
1318
|
+
],
|
|
1319
|
+
documentationUrl: "https://viteplus.dev/guide/vpx"
|
|
1320
|
+
},
|
|
1321
|
+
cache: {
|
|
1322
|
+
usage: "vp cache <COMMAND>",
|
|
1323
|
+
summary: "Manage the task cache.",
|
|
1324
|
+
sections: [{
|
|
1325
|
+
title: "Commands",
|
|
1326
|
+
rows: [{
|
|
1327
|
+
label: "clean",
|
|
1328
|
+
description: "Clean up all the cache"
|
|
1329
|
+
}]
|
|
1330
|
+
}, {
|
|
1331
|
+
title: "Options",
|
|
1332
|
+
rows: [{
|
|
1333
|
+
label: "-h, --help",
|
|
1334
|
+
description: "Print help"
|
|
1335
|
+
}]
|
|
1336
|
+
}],
|
|
1337
|
+
documentationUrl: "https://viteplus.dev/guide/cache"
|
|
1338
|
+
}
|
|
1339
|
+
};
|
|
1340
|
+
function maybePrintCommandHelp(args) {
|
|
1341
|
+
const command = args[0] === "format" ? "fmt" : args[0];
|
|
1342
|
+
const doc = commandHelpDocs[command];
|
|
1343
|
+
if (!doc) return false;
|
|
1344
|
+
const commandArgs = args.slice(1);
|
|
1345
|
+
if (!(commandArgs.length === 1 && (commandArgs[0] === "-h" || commandArgs[0] === "--help"))) return false;
|
|
1346
|
+
printHeader();
|
|
1347
|
+
log(renderCliDoc(doc));
|
|
1348
|
+
return true;
|
|
1349
|
+
}
|
|
1350
|
+
//#endregion
|
|
11
1351
|
//#region src/resolve-fmt.ts
|
|
12
1352
|
/**
|
|
13
1353
|
* Oxfmt tool resolver for the vite-plus CLI.
|
|
@@ -32,8 +1372,9 @@ import { fileURLToPath } from "node:url";
|
|
|
32
1372
|
* including Node.js version information and package manager details.
|
|
33
1373
|
*/
|
|
34
1374
|
async function fmt() {
|
|
1375
|
+
const oxfmtMainPath = resolve$1("oxfmt");
|
|
35
1376
|
return {
|
|
36
|
-
binPath: join(dirname(dirname(
|
|
1377
|
+
binPath: join(dirname(dirname(oxfmtMainPath)), "bin", "oxfmt"),
|
|
37
1378
|
envs: {
|
|
38
1379
|
...DEFAULT_ENVS,
|
|
39
1380
|
[CONFIG_METADATA_ENV]: "1"
|
|
@@ -57,14 +1398,6 @@ const INIT_COMMAND_SPECS = {
|
|
|
57
1398
|
function normalizeInitCommand(command) {
|
|
58
1399
|
return command === "format" ? "fmt" : command;
|
|
59
1400
|
}
|
|
60
|
-
const VITE_CONFIG_FILES = [
|
|
61
|
-
"vite.config.ts",
|
|
62
|
-
"vite.config.mts",
|
|
63
|
-
"vite.config.cts",
|
|
64
|
-
"vite.config.js",
|
|
65
|
-
"vite.config.mjs",
|
|
66
|
-
"vite.config.cjs"
|
|
67
|
-
];
|
|
68
1401
|
function optionTerminatorIndex(args) {
|
|
69
1402
|
const index = args.indexOf("--");
|
|
70
1403
|
return index === -1 ? args.length : index;
|
|
@@ -266,7 +1599,9 @@ async function doc() {
|
|
|
266
1599
|
* including Node.js version information and package manager details.
|
|
267
1600
|
*/
|
|
268
1601
|
async function lint() {
|
|
269
|
-
const
|
|
1602
|
+
const oxlintMainPath = resolve$1("oxlint");
|
|
1603
|
+
const oxlintPackageRoot = dirname(dirname(oxlintMainPath));
|
|
1604
|
+
const binPath = join(oxlintPackageRoot, "bin", "oxlint");
|
|
270
1605
|
const oxlintTsgolintPath = resolveTsgolintExecutable(resolve$1("oxlint-tsgolint/bin/tsgolint"), import.meta.url);
|
|
271
1606
|
return {
|
|
272
1607
|
binPath,
|
|
@@ -369,8 +1704,9 @@ async function test() {
|
|
|
369
1704
|
* It constructs the path to the CLI binary within the resolved package.
|
|
370
1705
|
*/
|
|
371
1706
|
async function vite() {
|
|
1707
|
+
const vitePackagePath = dirname(resolve$1("@voidzero-dev/vite-plus-core"));
|
|
372
1708
|
return {
|
|
373
|
-
binPath: join(
|
|
1709
|
+
binPath: join(vitePackagePath, "cli.js"),
|
|
374
1710
|
envs: process.env.DEBUG_DISABLE_SOURCE_MAP ? {
|
|
375
1711
|
...DEFAULT_ENVS,
|
|
376
1712
|
DEBUG_DISABLE_SOURCE_MAP: process.env.DEBUG_DISABLE_SOURCE_MAP
|
|
@@ -382,7 +1718,7 @@ async function vite() {
|
|
|
382
1718
|
/**
|
|
383
1719
|
* Unified entry point for both the local CLI (via bin/vp) and the global CLI (via Rust vp binary).
|
|
384
1720
|
*
|
|
385
|
-
* Global commands (create, migrate, config, staged, --version) are handled by tsdown-bundled modules.
|
|
1721
|
+
* Global commands (create, migrate, config, hooks, staged, --version) are handled by tsdown-bundled modules.
|
|
386
1722
|
* All other commands are delegated to the Rust core through NAPI bindings, which
|
|
387
1723
|
* uses JavaScript tool resolver functions to locate tool binaries.
|
|
388
1724
|
*
|
|
@@ -398,8 +1734,32 @@ function getErrorMessage(err) {
|
|
|
398
1734
|
if (typeof err === "object" && err && "message" in err && typeof err.message === "string") return err.message;
|
|
399
1735
|
return String(err);
|
|
400
1736
|
}
|
|
401
|
-
|
|
402
|
-
|
|
1737
|
+
let args = process.argv.slice(2);
|
|
1738
|
+
if (args[0]?.startsWith("-C")) {
|
|
1739
|
+
const inline = args[0].length > 2;
|
|
1740
|
+
const dir = inline ? args[0].slice(args[0][2] === "=" ? 3 : 2) : args[1];
|
|
1741
|
+
if (!dir) {
|
|
1742
|
+
errorMsg("-C requires a directory argument");
|
|
1743
|
+
process.exit(1);
|
|
1744
|
+
}
|
|
1745
|
+
const target = path.resolve(dir);
|
|
1746
|
+
try {
|
|
1747
|
+
process.chdir(target);
|
|
1748
|
+
} catch (err) {
|
|
1749
|
+
const code = typeof err === "object" && err !== null && "code" in err ? err.code : void 0;
|
|
1750
|
+
if (code === "ENOENT" || code === "ENOTDIR") errorMsg(`directory not found: ${dir}`);
|
|
1751
|
+
else errorMsg(`cannot change directory to ${dir}: ${getErrorMessage(err)}`);
|
|
1752
|
+
process.exit(1);
|
|
1753
|
+
}
|
|
1754
|
+
if (process.platform !== "win32") process.env.PWD = target;
|
|
1755
|
+
args = args.slice(inline ? 1 : 2);
|
|
1756
|
+
process.argv = process.argv.slice(0, 2).concat(args);
|
|
1757
|
+
}
|
|
1758
|
+
if (path.basename(process.argv[1] ?? "") === "vpr") {
|
|
1759
|
+
args = ["run", ...args];
|
|
1760
|
+
process.argv = process.argv.slice(0, 2).concat(args);
|
|
1761
|
+
}
|
|
1762
|
+
const rustCliArgs = args;
|
|
403
1763
|
if (args[0] === "help" && args[1]) {
|
|
404
1764
|
args = [
|
|
405
1765
|
args[1],
|
|
@@ -409,9 +1769,12 @@ if (args[0] === "help" && args[1]) {
|
|
|
409
1769
|
process.argv = process.argv.slice(0, 2).concat(args);
|
|
410
1770
|
}
|
|
411
1771
|
const command = args[0];
|
|
412
|
-
|
|
1772
|
+
const cliDistDir = path.dirname(fileURLToPath(import.meta.url));
|
|
1773
|
+
const vitePlusPackagePath = path.dirname(cliDistDir);
|
|
1774
|
+
if (maybePrintCommandHelp(args)) {} else if (command === "create") await import("./create/bin.js");
|
|
413
1775
|
else if (command === "migrate") await import("./migration/bin.js");
|
|
414
1776
|
else if (command === "config") await import("./config/bin.js");
|
|
1777
|
+
else if (command === "hooks") await import("./hooks/bin.js");
|
|
415
1778
|
else if (command === "--version" || command === "-V") await import("./version.js");
|
|
416
1779
|
else if (command === "staged") await import("./staged/bin.js");
|
|
417
1780
|
else try {
|
|
@@ -427,8 +1790,10 @@ else try {
|
|
|
427
1790
|
vite,
|
|
428
1791
|
test,
|
|
429
1792
|
doc,
|
|
1793
|
+
toolchainManifestPath: path.join(cliDistDir, "toolchain.json"),
|
|
1794
|
+
vitePlusPackagePath,
|
|
430
1795
|
resolveUniversalViteConfig,
|
|
431
|
-
args:
|
|
1796
|
+
args: rustCliArgs
|
|
432
1797
|
});
|
|
433
1798
|
let finalExitCode = exitCode;
|
|
434
1799
|
if (exitCode === 0) try {
|