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.
- package/AGENTS.md +4 -0
- package/LICENSE +1 -878
- package/README.md +1 -1
- package/bin/vpx +9 -0
- package/binding/index.cjs +59 -54
- package/binding/index.d.cts +159 -2
- package/dist/{agent-97KmGCyL.js → agent-DkQD3xqe.js} +5 -7
- package/dist/bin.js +35 -34
- package/dist/{cli-parse-DHE8NrBU.js → cli-parse-aeUeFDlC.js} +2 -3
- package/dist/command-TjS_6y9O.js +1 -0
- package/dist/{command-CdMBoZFD.js → command-rY79K5NI.js} +28 -30
- package/dist/{comparison-CmVirWIW-DUGaiYqF.js → comparison-CmVirWIW-UlEf2maz.js} +1 -2
- package/dist/config/bin.js +8 -10
- package/dist/{constants-DR55DpRm.js → constants-D2P2aVKb.js} +8 -6
- package/dist/create/bin.d.ts +4 -8
- package/dist/create/bin.js +151 -120
- package/dist/{define-config-Bexdd6RZ.d.ts → define-config-BrvHRi-G.d.ts} +31 -13
- package/dist/{define-config-BxDc_9BK.cjs → define-config-CwtQqYC1.cjs} +41 -14
- package/dist/{define-config-CvE5pHqB.js → define-config-wR57OZG_.js} +34 -12
- package/dist/define-config.cjs +2 -1
- package/dist/define-config.d.ts +2 -2
- package/dist/define-config.js +1 -1
- package/dist/{dist-DIpm7mot.js → dist-Bs0SObNC.js} +73 -145
- 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-CtJGQP7C.js → editor-aOy1T15H.js} +2735 -5072
- package/dist/{help-BmKpeOP9.js → help-B03t_iQ4.js} +1 -2
- package/dist/hooks/bin.js +4 -5
- package/dist/{hooks-DhwsWb46.js → hooks-w_e2whkQ.js} +45 -25
- package/dist/index.cjs +5 -5
- package/dist/index.d.ts +2 -2
- package/dist/index.js +2 -2
- package/dist/{json-JP24qHUF.js → json-kl84kDyH.js} +9 -18
- package/dist/lint-plugins.cjs +1 -1
- package/dist/migration/bin.js +1782 -256
- package/dist/migration/compat/worker.js +4 -6
- package/dist/{oxlint-plugin-config-BIzrO2y2.js → oxlint-plugin-config-CHsI_zKo.js} +3 -4
- package/dist/oxlint-plugin.d.ts +0 -2
- package/dist/oxlint-plugin.js +33 -9
- 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 +4 -5
- package/dist/pack.d.ts +1 -1
- package/dist/{package-CQDXTm6j.js → package-DfFo6-E-.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-1xNz_ne0.js → prompts-C7DI63WP.js} +30 -50
- package/dist/{protocol-D99W10Qi.js → protocol-CkNmY-Mr.js} +1 -2
- package/dist/register.d.ts +1 -0
- package/dist/register.js +12 -0
- package/dist/{report-NhQk8VHb.js → report-BEdpIQvC.js} +4 -2
- package/dist/resolve-vite-config-33bzSaeT.js +1 -0
- package/dist/{resolve-vite-config-BVr1SUNg.js → resolve-vite-config-Cx3cnVVI.js} +9 -25
- package/dist/{rolldown-runtime-kJ_i4yPo.js → rolldown-runtime-DegdyBIC.js} +1 -2
- package/dist/script-esm-hooks.d.ts +11 -0
- package/dist/script-esm-hooks.js +27 -0
- package/dist/script-hooks-9Fof5UMY.js +176 -0
- package/dist/script-preload.cjs +491 -0
- package/dist/script-register.d.ts +1 -0
- package/dist/script-register.js +27 -0
- package/dist/script-watch.d.ts +1 -0
- package/dist/script-watch.js +2002 -0
- package/dist/staged/bin.js +53 -2011
- package/dist/sync-versions/bin.js +26 -48
- package/dist/sync-versions/bin.mjs +109 -217
- package/dist/{terminal-MKGAuy-p.js → terminal-BcuPUy-j.js} +1 -2
- package/dist/toolchain.js +38 -12
- package/dist/toolchain.json +38 -12
- package/dist/{tsconfig-zWgHiQ3X.js → tsconfig-BE3Wj9OX.js} +1 -1
- package/dist/{tsconfig-BZu7kl-x.js → tsconfig-shNmmCE_.js} +8 -10
- package/dist/version.d.ts +1 -3
- package/dist/version.js +5 -6
- package/dist/versions.js +7 -7
- 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/check.md +2 -0
- package/docs/config/fmt.md +1 -1
- package/docs/config/lint.md +1 -1
- package/docs/config/run.md +10 -2
- package/docs/config/staged.md +1 -1
- package/docs/guide/check.md +6 -1
- package/docs/guide/ci.md +13 -3
- package/docs/guide/create.md +1 -1
- package/docs/guide/env.md +11 -4
- package/docs/guide/global-cli.md +59 -3
- package/docs/guide/homebrew.md +127 -0
- package/docs/guide/ide-integration.md +1 -3
- package/docs/guide/implode.md +5 -3
- package/docs/guide/local-cli.md +21 -0
- package/docs/guide/migrate-rules.md +120 -18
- package/docs/guide/migrate.md +9 -9
- package/docs/guide/package-management.md +1 -1
- package/docs/guide/run.md +23 -1
- package/docs/guide/test.md +1 -1
- package/docs/guide/troubleshooting.md +1 -1
- package/docs/guide/upgrade.md +12 -6
- package/docs/guide/vitest-v5.md +2 -2
- package/docs/guide/vpx.md +210 -9
- package/package.json +43 -34
- package/dist/command-DVTILtS-.js +0 -1
- package/dist/dist-Dhu07wmN.js +0 -3
- package/dist/resolve-vite-config-7WDtXO4G.js +0 -1
package/docs/guide/test.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
`vp test` runs tests with [Vitest](https://vitest.dev).
|
|
4
4
|
|
|
5
|
-
Vite+ depends on Vitest `5.0
|
|
5
|
+
Vite+ depends on Vitest `5.1.0`, which requires Node `^22.18.0 || ^24.11.0 || >=26.0.0`. For existing projects, follow [Upgrade to Vitest 5](./vitest-v5.md) before updating dependencies.
|
|
6
6
|
|
|
7
7
|
`vp test` resolves Vitest from `vite-plus`'s dependencies first, then from your project.
|
|
8
8
|
|
|
@@ -72,7 +72,7 @@ If `vp staged` fails or your pre-commit hook does not run:
|
|
|
72
72
|
- if status shows `Preference: disabled (local)`, re-enable with `vp hooks enable`
|
|
73
73
|
- check whether hooks were skipped intentionally through `VP_GIT_HOOKS=0`
|
|
74
74
|
|
|
75
|
-
To stop hooks in this clone without deleting project policy files, run `vp hooks disable`. See the [Commit
|
|
75
|
+
To stop hooks in this clone without deleting project policy files, run `vp hooks disable`. See the [Commit Hooks](/guide/commit-hooks) for the full workflow.
|
|
76
76
|
|
|
77
77
|
A minimal staged config looks like this:
|
|
78
78
|
|
package/docs/guide/upgrade.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Upgrading Vite+
|
|
2
2
|
|
|
3
|
-
Use `vp upgrade` to update the global `vp` binary. To update the local `vite-plus` package in a project, see [Update Vite+](/guide/upgrade-project).
|
|
3
|
+
Use `vp upgrade` to update the global `vp` binary, or [Homebrew](#homebrew) if it owns your installation. To update the local `vite-plus` package in a project, see [Update Vite+](/guide/upgrade-project).
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
@@ -22,7 +22,7 @@ vp toolchain vite rolldown oxc
|
|
|
22
22
|
vp toolchain --json
|
|
23
23
|
```
|
|
24
24
|
|
|
25
|
-
The command uses the local `vite-plus` package when the project has one. Use `--global` to show the release for the global `vp` command:
|
|
25
|
+
The command uses the local `vite-plus` package when the project has one. Use `--global` or `-g` to show the release for the global `vp` command:
|
|
26
26
|
|
|
27
27
|
```bash
|
|
28
28
|
vp toolchain --global
|
|
@@ -87,15 +87,19 @@ Older versions are pruned automatically after each upgrade. The active version a
|
|
|
87
87
|
|
|
88
88
|
### Homebrew
|
|
89
89
|
|
|
90
|
-
Homebrew owns its installed binary
|
|
90
|
+
The [official Homebrew tap](/guide/homebrew) owns its installed binary. Update it with:
|
|
91
91
|
|
|
92
92
|
```bash
|
|
93
|
-
brew upgrade vite-plus
|
|
93
|
+
brew upgrade voidzero-dev/vite-plus/vp
|
|
94
94
|
```
|
|
95
95
|
|
|
96
|
-
`vp upgrade` detects
|
|
96
|
+
`vp upgrade` detects the installed formula and shows its Homebrew upgrade command without downloading or installing another version. This also applies to `--force`, a specific version, and `--rollback`. The script installer's rollback and automatic pruning do not apply to Homebrew installations.
|
|
97
97
|
|
|
98
|
-
|
|
98
|
+
For the tap, run `vp` after upgrading to install the new version's dependencies in your user data directory. Setup preserves your management preferences.
|
|
99
|
+
|
|
100
|
+
For the tap, `vp upgrade --check` directs you to `brew outdated voidzero-dev/vite-plus/vp`. Automatic npm update checks and notices are disabled for Homebrew installations.
|
|
101
|
+
|
|
102
|
+
To switch to the tap, follow the [migration steps](/guide/homebrew#switch-an-existing-installation).
|
|
99
103
|
|
|
100
104
|
## Preview Builds
|
|
101
105
|
|
|
@@ -111,6 +115,8 @@ Preview builds are addressed by pull request number or commit SHA. They are not
|
|
|
111
115
|
|
|
112
116
|
### Global `vp` Preview
|
|
113
117
|
|
|
118
|
+
For a Homebrew installation, follow the [tap preview instructions](/guide/homebrew#test-a-preview-build).
|
|
119
|
+
|
|
114
120
|
Install a preview build of the global CLI by passing `VP_PR_VERSION` to the installer. Pass a pull request number or a commit SHA:
|
|
115
121
|
|
|
116
122
|
```bash
|
package/docs/guide/vitest-v5.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Upgrade to Vitest 5
|
|
2
2
|
|
|
3
|
-
Vite+ bundles Vitest `5.0
|
|
3
|
+
Vite+ bundles Vitest `5.1.0`. Use Node `^22.18.0 || ^24.11.0 || >=26.0.0` for the CLI and tests.
|
|
4
4
|
|
|
5
5
|
## Before you migrate
|
|
6
6
|
|
|
@@ -126,7 +126,7 @@ Review calls with benchmark options, imported or reassigned callbacks, callback
|
|
|
126
126
|
|
|
127
127
|
## Entry points and packages
|
|
128
128
|
|
|
129
|
-
Use `vite-plus/test` for assertions and supported runner APIs. Keep coverage providers and `@vitest/ui` at the bundled runner's exact version, `5.0
|
|
129
|
+
Use `vite-plus/test` for assertions and supported runner APIs. Keep coverage providers and `@vitest/ui` at the bundled runner's exact version, `5.1.0`. Keep `@vitest/web-worker` aligned when your project uses it.
|
|
130
130
|
|
|
131
131
|
| v4 import | v5 import or action |
|
|
132
132
|
| ---------------------------------------- | --------------------------------------------------------------------------- |
|
package/docs/guide/vpx.md
CHANGED
|
@@ -1,25 +1,29 @@
|
|
|
1
1
|
# Running Binaries
|
|
2
2
|
|
|
3
|
-
Use `vpx`, `vp exec`, and `vp dlx` to run binaries without switching between local installs, downloaded packages, and project-specific tools.
|
|
3
|
+
Use `vpx`, `vp exec`, and `vp dlx` to run package binaries and scripts without switching between local installs, downloaded packages, and project-specific tools.
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
`vpx`
|
|
7
|
+
`vpx` does one of two things, depending on its first argument:
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
- [`vpx <package>`](#running-package-binaries) runs a binary from a local or remote npm package, like `npx`.
|
|
10
|
+
- [`vpx <file>`](#running-scripts) runs a TypeScript or JavaScript file, like `tsx`, and [`vpx --watch <file>`](#watch-mode) runs it again when a file it uses changes, like `tsx watch`.
|
|
10
11
|
|
|
11
|
-
|
|
12
|
-
- `vp exec` runs a command from local `node_modules/.bin` directories, falling back to `PATH` if not found
|
|
13
|
-
- `vp dlx` runs a package binary without adding it as a dependency
|
|
12
|
+
The other commands give stricter control over where a binary comes from:
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
- [`vp exec`](#vp-exec) runs a command from local `node_modules/.bin` directories, falling back to `PATH`.
|
|
15
|
+
- [`vp dlx`](#vp-dlx) runs a package binary without adding it as a dependency.
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
`vpx -v` or `vpx --version` prints the Vite+ version, like `vp --version`. In `package.json` scripts, `vpx` prints the version of the project's `vite-plus` package.
|
|
18
|
+
|
|
19
|
+
## Running Package Binaries
|
|
18
20
|
|
|
19
21
|
```bash
|
|
20
|
-
vpx <pkg[@version]> [args...]
|
|
22
|
+
vpx [options] <pkg[@version]> [args...]
|
|
21
23
|
```
|
|
22
24
|
|
|
25
|
+
`vpx` looks for the binary in local `node_modules/.bin` directories, Vite+-managed global packages, and the system `PATH`, in that order. If none has it, `vpx` downloads the package and runs it via `vp dlx`. With `pkg@version`, `--package/-p`, or `--shell-mode`, it runs via `vp dlx` directly.
|
|
26
|
+
|
|
23
27
|
### Options
|
|
24
28
|
|
|
25
29
|
- `-p, --package <name>` installs one or more additional packages before running the command
|
|
@@ -35,6 +39,203 @@ vpx oxlint@1.85.0 --version
|
|
|
35
39
|
vpx -p cowsay -c 'echo "hi" | cowsay'
|
|
36
40
|
```
|
|
37
41
|
|
|
42
|
+
Package managers and `vp run` put `node_modules/.bin` first on `PATH`, so `package.json` scripts run the `vpx` bin of the project's `vite-plus` package. That bin does not need the global CLI, and it looks only in local `node_modules/.bin` directories. It runs an installed binary directly, as the global `vpx` does, and `pkg@version`, `--package/-p`, or `--shell-mode` via `vp dlx`. A binary that is not installed is an error, so a script never downloads a package by accident:
|
|
43
|
+
|
|
44
|
+
```
|
|
45
|
+
error: vpx: 'eslint' is not installed in node_modules
|
|
46
|
+
note: Add it to devDependencies, or run `vp dlx eslint` to download and run it.
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## Running Scripts
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
vpx [--tsconfig <path>] [node options] <file> [args...]
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
`vpx` runs TypeScript and JavaScript files directly, without a `tsx` or `ts-node` dependency. Scripts run on the project's Node.js version, the same one [`vp node`](/guide/env) selects, with the [oxc-node](https://github.com/oxc-project/oxc-node) loader that ships with Vite+.
|
|
56
|
+
|
|
57
|
+
```bash
|
|
58
|
+
vpx ./scripts/seed.ts --dry-run
|
|
59
|
+
vpx scripts/build.mts
|
|
60
|
+
vpx --watch ./server.ts
|
|
61
|
+
vpx --env-file=.env ./scripts/migrate.ts
|
|
62
|
+
vpx --tsconfig tsconfig.scripts.json ./tools/gen.ts
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
### Files and Package Names
|
|
66
|
+
|
|
67
|
+
`vpx` runs its argument as a file when it is:
|
|
68
|
+
|
|
69
|
+
- a path (starting with `./`, `../`, or `/`; on Windows also `.\`, `..\`, a drive such as `C:\`, or `\\`) ending in `.ts`, `.mts`, `.cts`, `.tsx`, `.js`, `.mjs`, `.cjs`, or `.jsx`
|
|
70
|
+
- a name with one of those extensions that exists as a file, such as `scripts/seed.ts`
|
|
71
|
+
- a path to a file whose shebang runs `vpx` (see [Shebang Scripts](#shebang-scripts))
|
|
72
|
+
|
|
73
|
+
A missing path, or a missing name with a TypeScript extension, is an error: `vpx` never downloads a package for it. After Node.js options, such as `vpx --inspect seed.ts`, only a missing path is reported by `vpx`; Node.js reports a missing name itself. A name with a JavaScript extension that is not a file, such as `highlight.js`, runs the package of that name.
|
|
74
|
+
|
|
75
|
+
### Supported Syntax
|
|
76
|
+
|
|
77
|
+
- TypeScript syntax that Node.js type stripping rejects: enums, namespaces, parameter properties, and JSX
|
|
78
|
+
- Decorators with `"experimentalDecorators": true`, including `emitDecoratorMetadata`; standard decorators and `accessor` fields are not supported yet
|
|
79
|
+
- tsconfig `paths` for `import`, `.js` imports that point at `.ts` files, and extensionless imports
|
|
80
|
+
- ESM and CommonJS, including `require()` of `.ts` files; a `.cts` file is CommonJS, so it uses `import x = require('...')` and `export =`, and `import`/`export` declarations there fail with an error that suggests renaming the file to `.mts`
|
|
81
|
+
- TypeScript published in `node_modules`
|
|
82
|
+
- tsconfig `jsx`, `jsxImportSource`, `jsxFactory`, `jsxFragmentFactory`, `useDefineForClassFields`, and `verbatimModuleSyntax`; see [JSX](#jsx) and [tsconfig](#tsconfig) for the defaults
|
|
83
|
+
|
|
84
|
+
`vpx` does not type-check. Run [`vp check`](/guide/check) for that.
|
|
85
|
+
|
|
86
|
+
### Options
|
|
87
|
+
|
|
88
|
+
- `--tsconfig <path>` applies one tsconfig to every file (see [tsconfig](#tsconfig))
|
|
89
|
+
- `--watch` runs the file again when a file it uses changes (see [Watch Mode](#watch-mode))
|
|
90
|
+
- Node.js options before the file, such as `--inspect`, `--test`, `--env-file`, `--require`, and `--import`, are passed to Node.js; modules loaded with `--require` and `--import` can be TypeScript too
|
|
91
|
+
- Everything after the file, including `--`, is passed to the script
|
|
92
|
+
|
|
93
|
+
### Shebang Scripts
|
|
94
|
+
|
|
95
|
+
Scripts can use `vpx` as their interpreter. Make the file executable and keep its extension:
|
|
96
|
+
|
|
97
|
+
```ts
|
|
98
|
+
#!/usr/bin/env vpx
|
|
99
|
+
// scripts/release.ts
|
|
100
|
+
```
|
|
101
|
+
|
|
102
|
+
### In `package.json` Scripts
|
|
103
|
+
|
|
104
|
+
The `vpx` bin of the `vite-plus` package runs scripts on its own, so `"seed": "vpx ./scripts/seed.ts"` works in `package.json` scripts without the global CLI. It runs them on the Node.js that started it, which inside `vp run` and package manager scripts is the project's version.
|
|
105
|
+
|
|
106
|
+
### Using Node.js Directly
|
|
107
|
+
|
|
108
|
+
To run TypeScript with `node`, use `--import vite-plus/register`. This registers the Vite+ TypeScript loader before your script runs:
|
|
109
|
+
|
|
110
|
+
```bash
|
|
111
|
+
node --import=vite-plus/register ./scripts/seed.ts
|
|
112
|
+
node --import vite-plus/register --test ./test/example.test.ts
|
|
113
|
+
NODE_OPTIONS='--import=vite-plus/register' node ./scripts/seed.ts
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
Install `vite-plus` in the project first. Node.js resolves `vite-plus/register` from the project. The loader provides the same TypeScript transforms, tsconfig resolution, and source maps as `vpx`, and requires the same Node.js versions as Vite+.
|
|
117
|
+
|
|
118
|
+
If a tool starts Node.js itself, add `--import vite-plus/register` to its Node.js arguments or `NODE_OPTIONS`. Replace an existing `--import tsx` argument with `--import vite-plus/register`. For example, an AVA configuration can use:
|
|
119
|
+
|
|
120
|
+
```json
|
|
121
|
+
{
|
|
122
|
+
"ava": {
|
|
123
|
+
"nodeArguments": ["--import=vite-plus/register"]
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
```
|
|
127
|
+
|
|
128
|
+
Keep the tool's existing TypeScript file patterns and other settings. A JavaScript launcher can also run `await import('vite-plus/register')` before dynamically importing a TypeScript file. A static TypeScript import in that launcher is resolved before registration, so use `--import` for static imports.
|
|
129
|
+
|
|
130
|
+
`fork()` and workers inherit the `--import` option through Node.js arguments. `NODE_OPTIONS` also passes the option to spawned Node.js processes. Replacing a child's arguments or environment follows Node.js's normal inheritance rules.
|
|
131
|
+
|
|
132
|
+
To select a tsconfig, set `VP_SCRIPT_TSCONFIG=tsconfig.scripts.json`. The existing `TSX_TSCONFIG_PATH` variable also works, with `VP_SCRIPT_TSCONFIG` taking precedence. Otherwise the [usual tsconfig discovery](#tsconfig) applies. Each worker selects its config from its own environment, so workers can use different configs without changing their parent.
|
|
133
|
+
|
|
134
|
+
Node.js owns its flags, test discovery, and native watch mode. Eval and stdin can import TypeScript files, but their input text is not transformed. Modules loaded with `--require` run before modules loaded with `--import`. To load a TypeScript setup file, put `--import ./setup.ts` after `--import vite-plus/register`. Repeated imports of `vite-plus/register` are harmless, including when a tool already runs under `vpx`.
|
|
135
|
+
|
|
136
|
+
The [compiler differences from tsx](#coming-from-tsx) also apply when you use `vite-plus/register`.
|
|
137
|
+
|
|
138
|
+
### Watch Mode
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
vpx --watch [watch options] [node options] <file> [args...]
|
|
142
|
+
```
|
|
143
|
+
|
|
144
|
+
`vpx --watch` runs a file and runs it again when a file it uses changes, like `tsx watch`. It is not Node.js's own watch mode: `vpx` runs oxc-node's watcher (`oxnode watch`) instead, which runs the file with the `vpx` loader.
|
|
145
|
+
|
|
146
|
+
```bash
|
|
147
|
+
vpx --watch ./src/server.ts --port 3000
|
|
148
|
+
vpx --watch --include "./config/*.json" --exclude "src/**/*.test.ts" ./src/server.ts
|
|
149
|
+
vpx --watch --inspect --clear-screen=false ./src/index.ts
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
It watches every file the script imports or requires (in worker threads too, on Node.js 24 and later), the tsconfig files `vpx` read and the ones they `extends`, the files a failed import looked for, so creating one reruns the script, and `--env-file` files. `node_modules` is not watched unless `--include` names it. Press Return to rerun at once. Ctrl+C stops the script and the watcher; press it again to force kill. `vpx --watch --help` lists the options:
|
|
153
|
+
|
|
154
|
+
- `--include <glob>` also watches matching files, and `--exclude <glob>` never watches them
|
|
155
|
+
- `--clear-screen=false` (or `--no-clear-screen`) keeps the output of earlier runs; the screen is cleared only on a terminal
|
|
156
|
+
- `--kill-signal <signal>` stops the script before a rerun (default `SIGTERM`), and `--kill-timeout <ms>` force kills it after that long (default 5000)
|
|
157
|
+
- `--rerun-on-enter=false` (or `--no-rerun-on-enter`) leaves stdin to the script
|
|
158
|
+
- `--poll[=<ms>]` polls files instead of using file system events, for Docker, WSL, and network drives
|
|
159
|
+
- `--tsconfig <path>` applies one tsconfig to every file, as for `vpx <file>`
|
|
160
|
+
|
|
161
|
+
`tsx watch`'s `--ignore` and `--no-cache` and its `CHOKIDAR_USEPOLLING` variable work too (`--no-cache` does nothing: `vpx` has no transform cache), and so do the Node.js watch mode options `--watch-preserve-output` and `--watch-kill-signal`, so scripts written for `tsx watch` or `node --watch` move over. `--watch-path`, which would start Node.js's watch mode, is an error that points to `--include`, and so are `--test`, `--eval`, and other options that run no file. Other Node.js options go before the file.
|
|
162
|
+
|
|
163
|
+
### tsconfig
|
|
164
|
+
|
|
165
|
+
`vpx` reads compiler options from a tsconfig but does not type-check with it. Each file uses the nearest `tsconfig.json` above it that includes it through `files`, `include`, `exclude`, or project `references`, as `tsc` does, and `extends` is followed. Files in `node_modules` use no tsconfig, and neither does a file that no tsconfig includes, so it gets the defaults below. Such a file still resolves `paths` aliases through the nearest `tsconfig.json` above it, as tsx does: with a root tsconfig whose `include` is `["src"]`, a script in `scripts/` can import the same aliases as `src/`. Because the config depends on the file's location, not on the working directory, `vpx` compiles a file the same way wherever it runs from.
|
|
166
|
+
|
|
167
|
+
`--tsconfig <path>` applies one config to every file instead, including files that config does not include. Without `--tsconfig`, `TSX_TSCONFIG_PATH`, `TS_NODE_PROJECT`, or `OXC_TSCONFIG_PATH` can select a config, in that order. If it names a file that does not exist, or a tsconfig fails to parse, `vpx` prints a warning and runs without that config.
|
|
168
|
+
|
|
169
|
+
A file that no tsconfig applies to runs as if its `compilerOptions` were empty:
|
|
170
|
+
|
|
171
|
+
| Option | Without a tsconfig |
|
|
172
|
+
| --------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|
|
173
|
+
| `module` | The module format comes from `package.json` `"type"`: ESM with `"module"`, CommonJS otherwise. `.mts` is always ESM and `.cts` always CommonJS. With a tsconfig `module` of `node16`, `node18`, `nodenext`, `es2015`, or later, `.ts` and `.tsx` files run as ESM regardless of `"type"`; for the `node*` values, `tsc` and tsx follow `"type"` instead. |
|
|
174
|
+
| `paths`, `baseUrl` | None. Imports resolve as in Node.js, plus `.js` to `.ts` or `.tsx`, `.mjs` to `.mts`, `.cjs` to `.cts`, and extensionless imports. |
|
|
175
|
+
| `useDefineForClassFields` | `true`: class fields have `[[Define]]` semantics and run natively, as with a `target` of `ES2022` or later. A lower `target` switches to `[[Set]]` semantics, as in `tsc`. |
|
|
176
|
+
| `experimentalDecorators` | `false`: a decorator fails with an error that asks for this option. |
|
|
177
|
+
| `emitDecoratorMetadata` | `false`. |
|
|
178
|
+
| `jsx`, `jsxImportSource` | The automatic runtime, importing `react/jsx-runtime` (see [JSX](#jsx)). |
|
|
179
|
+
| `verbatimModuleSyntax` | `false`: imports whose bindings are unused at runtime are removed, with their side effects. |
|
|
180
|
+
| `rewriteRelativeImportExtensions` | `false`. `./file.ts` imports work either way. |
|
|
181
|
+
|
|
182
|
+
Types are removed, and enums, namespaces, and parameter properties are compiled, whatever the tsconfig says. `strict`, `lib`, and other type-checking options have no effect, and `target` only changes the class field default.
|
|
183
|
+
|
|
184
|
+
### JSX
|
|
185
|
+
|
|
186
|
+
`.jsx` and `.tsx` files compile to calls into a JSX runtime, React's by default. Install the runtime they use, `react` or the package named by `jsxImportSource`; Vite+ does not ship one. tsconfig options select the runtime:
|
|
187
|
+
|
|
188
|
+
| tsconfig `jsx` | Output |
|
|
189
|
+
| ------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------- |
|
|
190
|
+
| not set, or `"react-jsx"` | The automatic runtime: `jsx()` and `jsxs()` from `<jsxImportSource>/jsx-runtime`, with `jsxImportSource` defaulting to `react` |
|
|
191
|
+
| `"react-jsxdev"` | The development runtime: `jsxDEV()` from `<jsxImportSource>/jsx-dev-runtime`, with the file name, line, and column of each element |
|
|
192
|
+
| `"react"` | The classic runtime: `React.createElement()`, or `jsxFactory`, with fragments as `React.Fragment`, or `jsxFragmentFactory` |
|
|
193
|
+
| `"preserve"`, `"react-native"` | The automatic runtime, because Node.js cannot run JSX |
|
|
194
|
+
|
|
195
|
+
A classic factory that the file imports, such as `import { h, Fragment } from 'my-jsx'`, is kept even though only JSX uses it.
|
|
196
|
+
|
|
197
|
+
Pragma comments override the tsconfig for that file:
|
|
198
|
+
|
|
199
|
+
```tsx
|
|
200
|
+
/** @jsxImportSource my-jsx */
|
|
201
|
+
```
|
|
202
|
+
|
|
203
|
+
```tsx
|
|
204
|
+
/** @jsxRuntime classic */
|
|
205
|
+
/** @jsx h */
|
|
206
|
+
/** @jsxFrag Fragment */
|
|
207
|
+
import { h, Fragment } from 'my-jsx';
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
When a file has both `@jsx` and `@jsxImportSource`, `@jsxImportSource` selects the automatic runtime and `@jsx` is ignored. Pragmas are read from every comment in the file, so prose such as `// @jsxImportSource is set above` in an ordinary comment changes the runtime too.
|
|
211
|
+
|
|
212
|
+
A `.jsx` file gets a tsconfig's JSX options only when that tsconfig sets `"allowJs": true`, as in `tsc` and tsx. Otherwise it uses the defaults above.
|
|
213
|
+
|
|
214
|
+
JSX that depends on a compiler plugin is not supported. `vpx` compiles JSX only into calls to a runtime's `jsx()`, `jsxs()`, and `jsxDEV()` exports or to a classic factory. A setup that relies on a Babel or bundler plugin to transform JSX, usually with `"jsx": "preserve"`, fails at runtime or loses what that plugin adds.
|
|
215
|
+
|
|
216
|
+
### Coming from tsx
|
|
217
|
+
|
|
218
|
+
`vp migrate` rewrites tsx commands in `package.json` scripts to `vpx` and removes the `tsx` devDependency once nothing uses it; see [tsx to `vpx`](/guide/migrate-rules#tsx-to-vpx). Most scripts that run with tsx run with `vpx` unchanged. These differences can need a change:
|
|
219
|
+
|
|
220
|
+
- **JSX default**: without a tsconfig `jsx` option, tsx compiles JSX to `React.createElement()`, which needs `React` in scope, while `vpx` uses the automatic runtime. Set `"jsx": "react"` to keep the classic output. Because of its default, tsx also ignores a lone `/** @jsxImportSource … */` comment unless the file has `/** @jsxRuntime automatic */` or the tsconfig sets `"jsx": "react-jsx"`; `vpx` applies the comment on its own.
|
|
221
|
+
- **`.cts` files with `import` or `export`**: tsx compiles them to CommonJS, and `vpx` reports an error. Rename the file to `.mts`, or write it with `import x = require()` and `export =`.
|
|
222
|
+
- **`import` in a CommonJS package**: in a package without `"type": "module"`, tsx compiles a `.ts` or `.js` file that uses `import`, `export`, or `import.meta` to CommonJS, so `__filename`, `__dirname`, and `require` still work. `vpx` runs such a file as an ES module, as Node.js does, so they are not defined, and a default import of it from an ES module gets its default export rather than the whole module. Use `import.meta.filename`, `import.meta.dirname`, and `createRequire(import.meta.url)` instead.
|
|
223
|
+
- **`require()` resolution**: tsx maps `require('./a.js')` to `a.ts` and applies tsconfig `paths` to `require()`. `vpx` resolves `require()` as Node.js does, so write the `.ts` extension, and use `paths` aliases only with `import`.
|
|
224
|
+
- **Signals**: tsx turns `SIGINT` and `SIGTERM` into exit codes 130 and 143 and runs `process.on('exit')` handlers first. Under `vpx` the signal ends the script, as it does under Node.js, so clean up in a `process.on('SIGINT')` or `process.on('SIGTERM')` handler.
|
|
225
|
+
- **Node.js version**: `vpx` needs Node.js `^22.18.0 || ^24.11.0 || >=26.0.0`, while tsx also runs on older releases.
|
|
226
|
+
- **Watch mode**: `tsx watch` becomes `vpx --watch`, which takes tsx watch's options (see [Watch Mode](#watch-mode)). It also reruns the script on tsconfig edits and when a file a failed import looked for is created, which tsx watch misses.
|
|
227
|
+
- **Eval, REPL, and `--check`**: `vpx --eval`, the REPL, and `vpx --check` do not transform TypeScript.
|
|
228
|
+
- **`node --import tsx`**: replace it with [`node --import vite-plus/register`](#using-nodejs-directly), including in tool settings and `NODE_OPTIONS`.
|
|
229
|
+
- **Other loaders**: replace `--import tsx` with `--import vite-plus/register`. Registering both TypeScript loaders makes them compete for the same files.
|
|
230
|
+
|
|
231
|
+
### Coming from oxnode
|
|
232
|
+
|
|
233
|
+
`vp migrate` can replace `oxnode <file>` with `vpx <file>` and `oxnode watch <file>` with `vpx --watch <file>`. Both use oxc-node's transformer and watcher. Node.js commands and literal `NODE_OPTIONS` assignments that load `@oxc-node/core/register` use `vite-plus/register` instead. Migration removes the standalone development dependencies only when no remaining commands or imports need them. See [oxnode to `vpx`](/guide/migrate-rules#oxnode-to-vpx).
|
|
234
|
+
|
|
235
|
+
### Coming from ts-node
|
|
236
|
+
|
|
237
|
+
`vp migrate` can replace supported transpile-only ts-node commands with `vpx`. Supported Node.js preloads and literal `NODE_OPTIONS` assignments use `vite-plus/register`. Migration keeps commands that type-check because neither replacement performs that check. Custom compiler settings and remaining loader or API usage can also keep `ts-node` installed. See [ts-node to `vpx`](/guide/migrate-rules#ts-node-to-vpx).
|
|
238
|
+
|
|
38
239
|
## `vp exec`
|
|
39
240
|
|
|
40
241
|
Use `vp exec` to run tools already installed in your project or available in your environment.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plus",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.5.0",
|
|
4
4
|
"description": "The Unified Toolchain for the Web",
|
|
5
5
|
"homepage": "https://viteplus.dev/guide",
|
|
6
6
|
"bugs": {
|
|
@@ -15,7 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"bin": {
|
|
17
17
|
"vp": "./bin/vp",
|
|
18
|
-
"vpr": "./bin/vpr"
|
|
18
|
+
"vpr": "./bin/vpr",
|
|
19
|
+
"vpx": "./bin/vpx"
|
|
19
20
|
},
|
|
20
21
|
"files": [
|
|
21
22
|
"AGENTS.md",
|
|
@@ -31,7 +32,9 @@
|
|
|
31
32
|
"templates"
|
|
32
33
|
],
|
|
33
34
|
"type": "module",
|
|
34
|
-
"sideEffects":
|
|
35
|
+
"sideEffects": [
|
|
36
|
+
"./dist/register.js"
|
|
37
|
+
],
|
|
35
38
|
"main": "./dist/index.js",
|
|
36
39
|
"types": "./dist/index.d.ts",
|
|
37
40
|
"exports": {
|
|
@@ -84,6 +87,10 @@
|
|
|
84
87
|
"types": "./dist/oxlint-plugin.d.ts"
|
|
85
88
|
},
|
|
86
89
|
"./package.json": "./package.json",
|
|
90
|
+
"./register": {
|
|
91
|
+
"types": "./dist/register.d.ts",
|
|
92
|
+
"default": "./dist/register.js"
|
|
93
|
+
},
|
|
87
94
|
"./pack": {
|
|
88
95
|
"types": "./dist/pack.d.ts",
|
|
89
96
|
"import": "./dist/pack.js"
|
|
@@ -338,51 +345,53 @@
|
|
|
338
345
|
}
|
|
339
346
|
},
|
|
340
347
|
"dependencies": {
|
|
341
|
-
"@oxc-project/
|
|
342
|
-
"@
|
|
343
|
-
"@
|
|
344
|
-
"@vitest/browser
|
|
345
|
-
"@vitest/
|
|
346
|
-
"@vitest/
|
|
347
|
-
"@vitest/
|
|
348
|
-
"@vitest/
|
|
349
|
-
"@vitest/
|
|
350
|
-
"
|
|
351
|
-
"
|
|
352
|
-
"oxlint
|
|
353
|
-
"
|
|
354
|
-
"
|
|
348
|
+
"@oxc-project/runtime": "=0.157.0",
|
|
349
|
+
"@oxc-project/types": "=0.157.0",
|
|
350
|
+
"@oxlint/plugins": "=1.91.0",
|
|
351
|
+
"@vitest/browser": "5.1.0",
|
|
352
|
+
"@vitest/browser-preview": "5.1.0",
|
|
353
|
+
"@vitest/mocker": "5.1.0",
|
|
354
|
+
"@vitest/pretty-format": "5.1.0",
|
|
355
|
+
"@vitest/snapshot": "5.1.0",
|
|
356
|
+
"@vitest/spy": "5.1.0",
|
|
357
|
+
"@vitest/utils": "5.1.0",
|
|
358
|
+
"oxfmt": "=0.76.0",
|
|
359
|
+
"oxlint": "=1.91.0",
|
|
360
|
+
"oxlint-tsgolint": "=7.0.2005",
|
|
361
|
+
"vite": "npm:@voidzero-dev/vite-plus-core@1.5.0",
|
|
362
|
+
"vitest": "5.1.0"
|
|
355
363
|
},
|
|
356
364
|
"devDependencies": {
|
|
357
|
-
"@emnapi/core": "2.0.0-
|
|
358
|
-
"@emnapi/runtime": "2.0.0-
|
|
365
|
+
"@emnapi/core": "2.0.0-beta.2",
|
|
366
|
+
"@emnapi/runtime": "2.0.0-beta.2",
|
|
359
367
|
"@napi-rs/cli": "^3.10.0",
|
|
360
368
|
"@nkzw/safe-word-list": "^3.1.0",
|
|
361
369
|
"@types/cross-spawn": "^6.0.6",
|
|
362
370
|
"@types/validate-npm-package-name": "^4.0.2",
|
|
363
|
-
"@vitest/browser-playwright": "5.0
|
|
371
|
+
"@vitest/browser-playwright": "5.1.0",
|
|
364
372
|
"@vitest/browser-webdriverio": "5.0.0",
|
|
365
|
-
"@voidzero-dev/vite-plus-prompts": "1.
|
|
373
|
+
"@voidzero-dev/vite-plus-prompts": "1.5.0",
|
|
366
374
|
"@voidzero-dev/vite-task-client": "0.2.0",
|
|
367
375
|
"bingo": "^0.13.2",
|
|
368
|
-
"cac": "^7.
|
|
376
|
+
"cac": "^7.1.0",
|
|
369
377
|
"cross-spawn": "^7.0.5",
|
|
370
378
|
"detect-indent": "^7.0.2",
|
|
371
379
|
"detect-newline": "^4.0.1",
|
|
372
|
-
"glob": "^13.0.0",
|
|
373
380
|
"jsonc-parser": "^3.3.1",
|
|
374
381
|
"lint-staged": "^17.6.0",
|
|
375
|
-
"minimatch": "^
|
|
382
|
+
"minimatch": "^11.0.0",
|
|
376
383
|
"nanotar": "^0.3.0",
|
|
377
384
|
"picocolors": "^1.1.1",
|
|
378
|
-
"
|
|
385
|
+
"pirates": "^4.0.7",
|
|
386
|
+
"tinyglobby": "^0.2.15",
|
|
387
|
+
"tsdown": "^0.23.4",
|
|
379
388
|
"validate-npm-package-name": "^8.0.0",
|
|
380
389
|
"verkit": "^0.5.0",
|
|
381
390
|
"yaml": "^2.9.1",
|
|
382
391
|
"zod": "^4.4.3"
|
|
383
392
|
},
|
|
384
393
|
"peerDependencies": {
|
|
385
|
-
"@vitest/browser-playwright": "5.0
|
|
394
|
+
"@vitest/browser-playwright": "5.1.0",
|
|
386
395
|
"@vitest/browser-webdriverio": "^5.0.0-beta.5 || >=5.0.0",
|
|
387
396
|
"playwright": "*"
|
|
388
397
|
},
|
|
@@ -415,14 +424,14 @@
|
|
|
415
424
|
"node": "^22.18.0 || ^24.11.0 || >=26.0.0"
|
|
416
425
|
},
|
|
417
426
|
"optionalDependencies": {
|
|
418
|
-
"@voidzero-dev/vite-plus-darwin-arm64": "1.
|
|
419
|
-
"@voidzero-dev/vite-plus-darwin-x64": "1.
|
|
420
|
-
"@voidzero-dev/vite-plus-linux-arm64-gnu": "1.
|
|
421
|
-
"@voidzero-dev/vite-plus-linux-arm64-musl": "1.
|
|
422
|
-
"@voidzero-dev/vite-plus-linux-x64-gnu": "1.
|
|
423
|
-
"@voidzero-dev/vite-plus-linux-x64-musl": "1.
|
|
424
|
-
"@voidzero-dev/vite-plus-win32-x64-msvc": "1.
|
|
425
|
-
"@voidzero-dev/vite-plus-win32-arm64-msvc": "1.
|
|
427
|
+
"@voidzero-dev/vite-plus-darwin-arm64": "1.5.0",
|
|
428
|
+
"@voidzero-dev/vite-plus-darwin-x64": "1.5.0",
|
|
429
|
+
"@voidzero-dev/vite-plus-linux-arm64-gnu": "1.5.0",
|
|
430
|
+
"@voidzero-dev/vite-plus-linux-arm64-musl": "1.5.0",
|
|
431
|
+
"@voidzero-dev/vite-plus-linux-x64-gnu": "1.5.0",
|
|
432
|
+
"@voidzero-dev/vite-plus-linux-x64-musl": "1.5.0",
|
|
433
|
+
"@voidzero-dev/vite-plus-win32-x64-msvc": "1.5.0",
|
|
434
|
+
"@voidzero-dev/vite-plus-win32-arm64-msvc": "1.5.0"
|
|
426
435
|
},
|
|
427
436
|
"scripts": {
|
|
428
437
|
"build": "oxnode -C dev ./build.ts",
|
package/dist/command-DVTILtS-.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { n as runCommandSilently } from "./command-CdMBoZFD.js";
|
package/dist/dist-Dhu07wmN.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export { a as resolveUniversalViteConfig } from "./resolve-vite-config-BVr1SUNg.js";
|