Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/guide/migrate.md
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ View and copy this prompt into your coding agent to upgrade an existing Vite+ 0.

### Vitest

Vitest is automatically migrated through `vp migrate`. `vite-plus` re-exports upstream `vitest@5.1.1` under `vite-plus/test*`, so for node-mode tests a single `vite-plus` install is enough — you no longer need to install `vitest` directly.
Vitest is automatically migrated through `vp migrate`. `vite-plus` re-exports upstream `vitest@5.1.2` under `vite-plus/test*`, so for node-mode tests a single `vite-plus` install is enough — you no longer need to install `vitest` directly.

For browser mode, you can use the base browser runtime (`@vitest/browser`) and Preview provider (`@vitest/browser-preview`) included in `vite-plus`. To use Playwright or WebDriverIO, you also need the opt-in provider (`@vitest/browser-playwright` or `@vitest/browser-webdriverio`) and its framework peer (`playwright` or `webdriverio`).

Expand Down
2 changes: 1 addition & 1 deletion docs/guide/test.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

`vp test` runs tests with [Vitest](https://vitest.dev).

Vite+ depends on Vitest `5.1.1`, 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.
Vite+ depends on Vitest `5.1.2`, 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.

`vp test` resolves Vitest from `vite-plus`'s dependencies first, then from your project.

Expand Down
4 changes: 2 additions & 2 deletions docs/guide/vitest-v5.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Upgrade to Vitest 5

Vite+ bundles Vitest `5.1.1`. Use Node `^22.18.0 || ^24.11.0 || >=26.0.0` for the CLI and tests.
Vite+ bundles Vitest `5.1.2`. Use Node `^22.18.0 || ^24.11.0 || >=26.0.0` for the CLI and tests.

## Before you migrate

Expand Down Expand Up @@ -126,7 +126,7 @@ Review calls with benchmark options, imported or reassigned callbacks, callback

## Entry points and packages

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.1`. Keep `@vitest/web-worker` aligned when your project uses it.
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.2`. Keep `@vitest/web-worker` aligned when your project uses it.

| v4 import | v5 import or action |
| ---------------------------------------- | --------------------------------------------------------------------------- |
Expand Down
2 changes: 1 addition & 1 deletion packages/cli/src/utils/constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const VITE_CONFIG_FILES = [
'vite.config.cts',
] as const;

export const VITEST_VERSION = '5.1.1';
export const VITEST_VERSION = '5.1.2';

// Exact action release used by generated workflows and the @v1 migration.
// The Renovate custom manager keeps this value current.
Expand Down
2 changes: 1 addition & 1 deletion packages/tools/.upstream-versions.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@
"oxc-node": {
"repo": "https://github.com/oxc-project/oxc-node.git",
"branch": "main",
"hash": "16c0f340aebd927b72d941b693e51dd6f5264f17"
"hash": "9030d2929c957690172bb32372163eace02faa78"
}
}
40 changes: 31 additions & 9 deletions packages/tools/src/patch-oxc-node.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,9 @@
* registers no NAPI exports of its own; `packages/cli/binding/src/oxc_node.rs` forwards
* the ones the loader uses under an `oxcNode` namespace.
*
* This script points the `oxc` dependency at the workspace version, so the binding links
* one copy of oxc, and adapts an AST predicate for the workspace's Oxc version.
* This script points the `oxc` and `oxc_sourcemap` dependencies at the workspace
* versions, so the binding links one compatible copy of each, and adapts AST APIs
* for the workspace's Oxc version.
* It is idempotent. Keep it free of package imports: CI runs it right after checkout,
* before dependencies are installed.
*/
Expand Down Expand Up @@ -40,26 +41,47 @@ export function setOxcVersion(cargoToml: string, version: string): string {
}

export function patchOxcNode(rootDir: string = process.cwd()): void {
const version = oxcVersion(readFileSync(join(rootDir, 'Cargo.toml'), 'utf8'), 'Cargo.toml');
const rootCargoToml = readFileSync(join(rootDir, 'Cargo.toml'), 'utf8');
const version = oxcVersion(rootCargoToml, 'Cargo.toml');
const sourcemapVersion = parseCargoOxcVersions(rootCargoToml).get('oxc_sourcemap');
if (!sourcemapVersion) {
throw new Error('[patch-oxc-node] Could not find the `oxc_sourcemap` dependency in Cargo.toml');
}
const cargoTomlPath = join(rootDir, OXC_NODE_DIR, 'Cargo.toml');
const cargoToml = readFileSync(cargoTomlPath, 'utf8');
const patched = setOxcVersion(cargoToml, version);
const patched = replaceCargoCrateVersion(
setOxcVersion(cargoToml, version),
'oxc_sourcemap',
sourcemapVersion,
);
if (patched !== cargoToml) {
writeFileSync(cargoTomlPath, patched, 'utf8');
log(`✓ Cargo.toml: oxc ${version}`);
log(`✓ Cargo.toml: oxc ${version}, oxc_sourcemap ${sourcemapVersion}`);
}
const libPath = join(rootDir, OXC_NODE_DIR, 'src/lib.rs');
const source = readFileSync(libPath, 'utf8');
// Oxc 0.156 renamed this predicate; the workspace still uses 0.155.
// Matching the variant preserves await-using detection with either version.
const patchedSource = source.replace(
// Oxc 0.156 renamed this predicate. Matching the variant preserves
// await-using detection on either side of the rename.
let patchedSource = source.replace(
'it.kind.is_await_using()',
'matches!(it.kind, oxc::ast::ast::VariableDeclarationKind::AwaitUsing)',
);
if (patchedSource !== source) {
writeFileSync(libPath, patchedSource, 'utf8');
log('✓ lib.rs: compatible await-using detection');
}
if (version === '0.156.0') {
const assignmentTargetSource = patchedSource;
patchedSource = patchedSource.replace(
' maybe_default(property.value),\n &builder,',
' maybe_default(property.value),\n property.computed,\n &builder,',
);
if (patchedSource !== assignmentTargetSource) {
log('✓ lib.rs: compatible assignment-target properties');
}
}
if (patchedSource !== source) {
writeFileSync(libPath, patchedSource, 'utf8');
}
}

if (
Expand Down
Loading
Loading