Skip to content

Commit 886bc6e

Browse files
committed
chore: merge main
2 parents 44c3af7 + cadd7d2 commit 886bc6e

File tree

118 files changed

+2437
-1151
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

118 files changed

+2437
-1151
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ body:
1919
[plugin-react-swc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc)
2020
- label: |
2121
[plugin-react-oxc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-oxc)
22+
- label: |
23+
[plugin-rsc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc)
2224
- type: textarea
2325
id: bug-description
2426
attributes:

.github/ISSUE_TEMPLATE/feature_request.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ body:
1919
[plugin-react-swc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc)
2020
- label: |
2121
[plugin-react-oxc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-oxc)
22+
- label: |
23+
[plugin-rsc](https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-rsc)
2224
- type: textarea
2325
id: feature-description
2426
attributes:

.github/renovate.json5

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,6 @@
3636
// manually bumping
3737
"node",
3838

39-
"generouted", // testing lib shipping JSX (new version ship transpiled JS)
40-
4139
// breaking changes
4240
"source-map", // `source-map:v0.7.0+` needs more investigation
4341
"kill-port", // `kill-port:^2.0.0 has perf issues (#8392)

.github/workflows/ci-rsc.yml

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,18 +31,21 @@ jobs:
3131
- run: pnpm -C packages/plugin-rsc test
3232

3333
test-e2e:
34-
name: test-rsc (${{ matrix.os }} / ${{ matrix.browser }})
34+
name: test-rsc (${{ matrix.os }} / ${{ matrix.browser }}) ${{ matrix.rolldown == true && '(rolldown)' || '' }}
3535
runs-on: ${{ matrix.os }}
3636
strategy:
37-
# TODO: shard?
3837
matrix:
3938
os: [ubuntu-latest, macos-latest, windows-latest]
4039
browser: [chromium]
40+
rolldown: [false]
4141
include:
4242
- os: ubuntu-latest
4343
browser: firefox
4444
- os: macos-latest
4545
browser: webkit
46+
- os: ubuntu-latest
47+
browser: chromium
48+
rolldown: true
4649
fail-fast: false
4750
steps:
4851
- uses: actions/checkout@v4
@@ -52,13 +55,18 @@ jobs:
5255
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
5356
- run: pnpm i
5457
- run: pnpm build
58+
- name: install rolldown
59+
if: ${{ matrix.rolldown }}
60+
run: |
61+
sed -i '/^overrides:/a\ vite: "npm:rolldown-vite@latest"' pnpm-workspace.yaml
62+
pnpm i --no-frozen-lockfile
5563
- run: pnpm -C packages/plugin-rsc exec playwright install ${{ matrix.browser }}
5664
- run: pnpm -C packages/plugin-rsc test-e2e-ci --project=${{ matrix.browser }}
5765
env:
5866
TEST_ISOLATED: true
5967
- uses: actions/upload-artifact@v4
6068
if: always()
6169
with:
62-
name: test-results-${{ matrix.os }}-${{ matrix.browser }}
70+
name: test-results-${{ matrix.os }}-${{ matrix.browser }}${{ matrix.rolldown == true && '-rolldown' || '' }}
6371
path: |
6472
packages/plugin-rsc/test-results

.github/workflows/ci.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ jobs:
2929
strategy:
3030
matrix:
3131
os: [ubuntu-latest]
32-
node_version: [18, 20, 22, 24]
32+
node_version: [20, 22, 24]
3333
include:
3434
# Active LTS + other OS
3535
- os: macos-latest
@@ -81,9 +81,6 @@ jobs:
8181
# does not need to explicitly set chromium after https://github.com/microsoft/playwright/issues/14862 is solved
8282
run: pnpm playwright install chromium
8383

84-
- if: matrix.node_version == '18'
85-
run: pnpm i -D [email protected] -w
86-
8784
- name: Build
8885
run: pnpm run build
8986

CONTRIBUTING.md

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,10 @@ This repo is a monorepo using pnpm workspaces. The package manager used to insta
1313
- Checkout a topic branch from a base branch (e.g. `main`), and merge back against that branch.
1414

1515
- If adding a new feature:
16-
1716
- Add accompanying test case.
1817
- Provide a convincing reason to add this feature. Ideally, you should open a suggestion issue first, and have it approved before working on it.
1918

2019
- If fixing a bug:
21-
2220
- If you are resolving a special issue, add `(fix #xxxx[,#xxxx])` (#xxxx is the issue id) in your PR title for a better release log (e.g. `fix: update entities encoding/decoding (fix #3899)`).
2321
- Provide a detailed description of the bug in the PR. Live demo preferred.
2422
- Add appropriate test coverage if applicable.

package.json

Lines changed: 9 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
"private": true,
44
"type": "module",
55
"engines": {
6-
"node": "^14.18.0 || >=16.0.0"
6+
"node": "^20.19.0 || >=22.12.0"
77
},
8-
"packageManager": "pnpm@10.12.4",
8+
"packageManager": "pnpm@10.13.1",
99
"homepage": "https://github.com/vitejs/vite-plugin-react/",
1010
"keywords": [
1111
"frontend",
@@ -33,25 +33,25 @@
3333
"ci-publish": "tsx scripts/publishCI.ts"
3434
},
3535
"devDependencies": {
36-
"@eslint/js": "^9.30.1",
36+
"@eslint/js": "^9.31.0",
3737
"@types/fs-extra": "^11.0.4",
38-
"@types/node": "^22.16.0",
38+
"@types/node": "^22.16.3",
3939
"@vitejs/release-scripts": "^1.6.0",
40-
"eslint": "^9.30.1",
40+
"eslint": "^9.31.0",
4141
"eslint-plugin-import-x": "^4.16.1",
4242
"eslint-plugin-n": "^17.21.0",
4343
"eslint-plugin-regexp": "^2.9.0",
4444
"fs-extra": "^11.3.0",
4545
"globals": "^16.3.0",
4646
"lint-staged": "^15.5.2",
4747
"picocolors": "^1.1.1",
48-
"playwright-chromium": "^1.53.2",
49-
"prettier": "^3.0.3",
48+
"playwright-chromium": "^1.54.1",
49+
"prettier": "^3.6.2",
5050
"simple-git-hooks": "^2.13.0",
5151
"tsx": "^4.20.3",
5252
"typescript": "^5.8.3",
53-
"typescript-eslint": "^8.35.1",
54-
"vite": "^7.0.2",
53+
"typescript-eslint": "^8.37.0",
54+
"vite": "^7.0.4",
5555
"vitest": "^3.2.4"
5656
},
5757
"simple-git-hooks": {
@@ -70,15 +70,5 @@
7070
"playground/**/__tests__/**/*.ts": [
7171
"eslint --cache --fix"
7272
]
73-
},
74-
"pnpm": {
75-
"packageExtensions": {
76-
"generouted": {
77-
"peerDependencies": {
78-
"react": "*",
79-
"react-router-dom": "*"
80-
}
81-
}
82-
}
8373
}
8474
}

packages/common/refresh-runtime.js

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -545,6 +545,21 @@ function isLikelyComponentType(type) {
545545
}
546546
}
547547

548+
function isCompoundComponent(type) {
549+
if (!isPlainObject(type)) return false
550+
for (const key in type) {
551+
if (!isLikelyComponentType(type[key])) return false
552+
}
553+
return true
554+
}
555+
556+
function isPlainObject(obj) {
557+
return (
558+
Object.prototype.toString.call(obj) === '[object Object]' &&
559+
(obj.constructor === Object || obj.constructor === undefined)
560+
)
561+
}
562+
548563
/**
549564
* Plugin utils
550565
*/
@@ -565,6 +580,13 @@ export function registerExportsForReactRefresh(filename, moduleExports) {
565580
// The register function has an identity check to not register twice the same component,
566581
// so this is safe to not used the same key here.
567582
register(exportValue, filename + ' export ' + key)
583+
} else if (isCompoundComponent(exportValue)) {
584+
for (const subKey in exportValue) {
585+
register(
586+
exportValue[subKey],
587+
filename + ' export ' + key + '-' + subKey,
588+
)
589+
}
568590
}
569591
}
570592
}
@@ -618,6 +640,7 @@ export function validateRefreshBoundaryAndEnqueueUpdate(
618640
(key, value) => {
619641
hasExports = true
620642
if (isLikelyComponentType(value)) return true
643+
if (isCompoundComponent(value)) return true
621644
return prevExports[key] === nextExports[key]
622645
},
623646
)

packages/plugin-react-oxc/CHANGELOG.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,32 @@
22

33
## Unreleased
44

5-
### Return `Plugin[]` instead of `PluginOption[]`
5+
### Require Node 20.19+, 22.12+
6+
7+
This plugin now requires Node 20.19+ or 22.12+.
8+
9+
## 0.3.0 (2025-07-18)
10+
11+
### Add HMR support for compound components ([#518](https://github.com/vitejs/vite-plugin-react/pull/518))
12+
13+
HMR now works for compound components like this:
14+
15+
```tsx
16+
const Root = () => <div>Accordion Root</div>
17+
const Item = () => <div>Accordion Item</div>
18+
19+
export const Accordion = { Root, Item }
20+
```
21+
22+
### Return `Plugin[]` instead of `PluginOption[]` ([#537](https://github.com/vitejs/vite-plugin-react/pull/537))
23+
24+
The return type has changed from `react(): PluginOption[]` to more specialized type `react(): Plugin[]`. This allows for type-safe manipulation of plugins, for example:
25+
26+
```tsx
27+
// previously this causes type errors
28+
react()
29+
.map(p => ({ ...p, applyToEnvironment: e => e.name === 'client' }))
30+
```
631

732
## 0.2.3 (2025-06-16)
833

packages/plugin-react-oxc/build.config.ts

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)