Skip to content

Commit f37e50f

Browse files
authored
Merge branch 'main' into navigation-vite
2 parents c8bfd82 + 22e5398 commit f37e50f

Some content is hidden

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

61 files changed

+1342
-637
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:

package.json

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"engines": {
66
"node": "^14.18.0 || >=16.0.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",
48+
"playwright-chromium": "^1.54.1",
4949
"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": {

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: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,28 @@
22

33
## Unreleased
44

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

728
## 0.2.3 (2025-06-16)
829

packages/plugin-react-oxc/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vitejs/plugin-react-oxc",
3-
"version": "0.2.3",
3+
"version": "0.3.0",
44
"license": "MIT",
55
"author": "Evan You",
66
"contributors": [
@@ -49,6 +49,6 @@
4949
"vite": "catalog:rolldown-vite"
5050
},
5151
"dependencies": {
52-
"@rolldown/pluginutils": "1.0.0-beta.24"
52+
"@rolldown/pluginutils": "1.0.0-beta.27"
5353
}
5454
}

packages/plugin-react-swc/CHANGELOG.md

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

33
## Unreleased
44

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

728
## 3.10.2 (2025-06-10)
829

packages/plugin-react-swc/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@vitejs/plugin-react-swc",
3-
"version": "3.10.2",
3+
"version": "3.11.0",
44
"license": "MIT",
55
"author": "Arnaud Barré (https://github.com/ArnaudBarre)",
66
"description": "Speed up your Vite dev server with SWC",
@@ -29,16 +29,16 @@
2929
},
3030
"homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc#readme",
3131
"dependencies": {
32-
"@rolldown/pluginutils": "1.0.0-beta.24",
33-
"@swc/core": "^1.12.9"
32+
"@rolldown/pluginutils": "1.0.0-beta.27",
33+
"@swc/core": "^1.12.11"
3434
},
3535
"peerDependencies": {
3636
"vite": "^4 || ^5 || ^6 || ^7"
3737
},
3838
"devDependencies": {
39-
"@playwright/test": "^1.53.2",
39+
"@playwright/test": "^1.54.1",
4040
"@types/fs-extra": "^11.0.4",
41-
"@types/node": "^22.16.0",
41+
"@types/node": "^22.16.3",
4242
"@vitejs/react-common": "workspace:*",
4343
"fs-extra": "^11.3.0",
4444
"prettier": "^3.0.3",

packages/plugin-react-swc/playground/emotion-plugin/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,6 @@
1717
"@types/react": "^19.1.8",
1818
"@types/react-dom": "^19.1.6",
1919
"@vitejs/plugin-react-swc": "../../dist",
20-
"@swc/plugin-emotion": "^10.0.2"
20+
"@swc/plugin-emotion": "^10.0.3"
2121
}
2222
}

packages/plugin-react-swc/playground/styled-components/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
"styled-components": "^6.1.19"
1515
},
1616
"devDependencies": {
17-
"@swc/plugin-styled-components": "^8.0.2",
17+
"@swc/plugin-styled-components": "^8.0.3",
1818
"@types/react": "^19.1.8",
1919
"@types/react-dom": "^19.1.6",
2020
"@types/styled-components": "^5.1.34",

0 commit comments

Comments
 (0)