Skip to content

Commit 9929775

Browse files
authored
Merge branch 'main' into 07-08-test_test_no_refresh_transform_for_non-jsx_files
2 parents aab6aef + d1fe8c2 commit 9929775

63 files changed

Lines changed: 2065 additions & 941 deletions

Some content is hidden

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

.github/workflows/ci-rsc.yml

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ name: ci-rsc
33
permissions: {}
44

55
on:
6+
workflow_dispatch:
67
push:
78
branches:
89
- main
@@ -31,13 +32,14 @@ jobs:
3132
- run: pnpm -C packages/plugin-rsc test
3233

3334
test-e2e:
34-
name: test-rsc (${{ matrix.os }} / ${{ matrix.browser }}) ${{ matrix.rolldown == true && '(rolldown)' || '' }}
35+
name: test-rsc (${{ matrix.os }} / ${{ matrix.browser }}) ${{ matrix.rolldown == true && '(rolldown)' || '' }} ${{ matrix.react_version && format('(react-{0})', matrix.react_version) || '' }}
3536
runs-on: ${{ matrix.os }}
3637
strategy:
3738
matrix:
3839
os: [ubuntu-latest, macos-latest, windows-latest]
3940
browser: [chromium]
4041
rolldown: [false]
42+
react_version: [""]
4143
include:
4244
- os: ubuntu-latest
4345
browser: firefox
@@ -46,6 +48,12 @@ jobs:
4648
- os: ubuntu-latest
4749
browser: chromium
4850
rolldown: true
51+
- os: ubuntu-latest
52+
browser: chromium
53+
react_version: canary
54+
- os: ubuntu-latest
55+
browser: chromium
56+
react_version: experimental
4957
fail-fast: false
5058
steps:
5159
- uses: actions/checkout@v4
@@ -54,6 +62,13 @@ jobs:
5462
node-version: 22
5563
- uses: pnpm/action-setup@a7487c7e89a18df4991f7f222e4898a00d66ddda # v4.1.0
5664
- run: pnpm i
65+
- name: install react
66+
if: ${{ matrix.react_version }}
67+
run: |
68+
sed -i "/^overrides:/a\ react: \"${{ matrix.react_version }}\"" pnpm-workspace.yaml
69+
sed -i "/^overrides:/a\ react-dom: \"${{ matrix.react_version }}\"" pnpm-workspace.yaml
70+
sed -i "/^overrides:/a\ react-server-dom-webpack: \"${{ matrix.react_version }}\"" pnpm-workspace.yaml
71+
pnpm i --no-frozen-lockfile
5772
- run: pnpm build
5873
- name: install rolldown
5974
if: ${{ matrix.rolldown }}
@@ -62,11 +77,9 @@ jobs:
6277
pnpm i --no-frozen-lockfile
6378
- run: pnpm -C packages/plugin-rsc exec playwright install ${{ matrix.browser }}
6479
- run: pnpm -C packages/plugin-rsc test-e2e-ci --project=${{ matrix.browser }}
65-
env:
66-
TEST_ISOLATED: true
6780
- uses: actions/upload-artifact@v4
6881
if: always()
6982
with:
70-
name: test-results-${{ matrix.os }}-${{ matrix.browser }}${{ matrix.rolldown == true && '-rolldown' || '' }}
83+
name: test-results-${{ matrix.os }}-${{ matrix.browser }}${{ matrix.rolldown == true && '-rolldown' || '' }}${{ matrix.react_version && format('-react-{0}', matrix.react_version) || '' }}
7184
path: |
7285
packages/plugin-rsc/test-results

CONTRIBUTING.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -132,3 +132,7 @@ Some errors are masked and hidden away because of the layers of abstraction and
132132
In many test cases, we need to mock dependencies using `link:` and `file:` protocols. `pnpm` treats `link:` as symlinks and `file:` as hardlinks. To test dependencies as if they were copied into `node_modules`, use the `file:` protocol. Otherwise, use the `link:` protocol.
133133

134134
For a mock dependency, make sure you add a `@vitejs/test-` prefix to the package name. This will avoid possible issues like false-positive alerts.
135+
136+
## Contributing to `@vitejs/plugin-rsc`
137+
138+
See [CONTRIBUTING.md](packages/plugin-rsc/CONTRIBUTING.md) in the `@vitejs/plugin-rsc` package for specific guidelines on contributing to the React Server Components plugin.

package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
"devDependencies": {
3636
"@eslint/js": "^9.31.0",
3737
"@types/fs-extra": "^11.0.4",
38-
"@types/node": "^22.16.3",
38+
"@types/node": "^22.16.5",
3939
"@vitejs/release-scripts": "^1.6.0",
4040
"eslint": "^9.31.0",
4141
"eslint-plugin-import-x": "^4.16.1",
@@ -50,8 +50,8 @@
5050
"simple-git-hooks": "^2.13.0",
5151
"tsx": "^4.20.3",
5252
"typescript": "^5.8.3",
53-
"typescript-eslint": "^8.37.0",
54-
"vite": "^7.0.4",
53+
"typescript-eslint": "^8.38.0",
54+
"vite": "^7.0.5",
5555
"vitest": "^3.2.4"
5656
},
5757
"simple-git-hooks": {

packages/plugin-react-oxc/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Allow processing files in `node_modules`
6+
7+
The default value of `exclude` options is now `[/\/node_modules\//]` to allow processing files in `node_modules` directory. It was previously `[]` and files in `node_modules` was always excluded regardless of the value of `exclude` option.
8+
59
### Require Node 20.19+, 22.12+
610

711
This plugin now requires Node 20.19+ or 22.12+.

packages/plugin-react-oxc/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export default defineConfig({
2525

2626
### include/exclude
2727

28-
Includes `.js`, `.jsx`, `.ts` & `.tsx` by default. This option can be used to add fast refresh to `.mdx` files:
28+
Includes `.js`, `.jsx`, `.ts` & `.tsx` and excludes `/node_modules/` by default. This option can be used to add fast refresh to `.mdx` files:
2929

3030
```js
3131
import { defineConfig } from 'vite'
@@ -40,8 +40,6 @@ export default defineConfig({
4040
})
4141
```
4242

43-
> `node_modules` are never processed by this plugin (but Oxc will)
44-
4543
### jsxImportSource
4644

4745
Control where the JSX factory is imported from. Default to `'react'`

packages/plugin-react-oxc/package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
},
4444
"devDependencies": {
4545
"@vitejs/react-common": "workspace:*",
46-
"tsdown": "^0.12.9",
46+
"tsdown": "^0.13.0",
4747
"unbuild": "^3.5.0",
4848
"vite": "catalog:rolldown-vite"
4949
},
5050
"dependencies": {
51-
"@rolldown/pluginutils": "1.0.0-beta.27"
51+
"@rolldown/pluginutils": "1.0.0-beta.29"
5252
}
5353
}

packages/plugin-react-oxc/src/index.ts

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,11 @@ export interface Options {
2525
}
2626

2727
const defaultIncludeRE = /\.[tj]sx?(?:$|\?)/
28+
const defaultExcludeRE = /\/node_modules\//
2829

2930
export default function viteReact(opts: Options = {}): Plugin[] {
3031
const include = opts.include ?? defaultIncludeRE
31-
const exclude = [
32-
...(Array.isArray(opts.exclude)
33-
? opts.exclude
34-
: opts.exclude
35-
? [opts.exclude]
36-
: []),
37-
/\/node_modules\//,
38-
]
32+
const exclude = opts.exclude ?? defaultExcludeRE
3933

4034
const jsxImportSource = opts.jsxImportSource ?? 'react'
4135
const jsxImportRuntime = `${jsxImportSource}/jsx-runtime`

packages/plugin-react-swc/package.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
},
3333
"homepage": "https://github.com/vitejs/vite-plugin-react/tree/main/packages/plugin-react-swc#readme",
3434
"dependencies": {
35-
"@rolldown/pluginutils": "1.0.0-beta.27",
35+
"@rolldown/pluginutils": "1.0.0-beta.29",
3636
"@swc/core": "^1.12.11"
3737
},
3838
"peerDependencies": {
@@ -41,11 +41,11 @@
4141
"devDependencies": {
4242
"@playwright/test": "^1.54.1",
4343
"@types/fs-extra": "^11.0.4",
44-
"@types/node": "^22.16.3",
44+
"@types/node": "^22.16.5",
4545
"@vitejs/react-common": "workspace:*",
4646
"fs-extra": "^11.3.0",
4747
"prettier": "^3.0.3",
48-
"tsdown": "^0.12.9",
48+
"tsdown": "^0.13.0",
4949
"typescript": "^5.8.3"
5050
}
5151
}

packages/plugin-react/CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
## Unreleased
44

5+
### Allow processing files in `node_modules`
6+
7+
The default value of `exclude` options is now `[/\/node_modules\//]` to allow processing files in `node_modules` directory. It was previously `[]` and files in `node_modules` was always excluded regardless of the value of `exclude` option.
8+
59
### `react` and `react-dom` is no longer added to [`resolve.dedupe`](https://vite.dev/config/#resolve-dedupe) automatically
610

711
Adding values to `resolve.dedupe` forces Vite to resolve them differently from how Node.js does, which can be confusing and may not be expected. This plugin no longer adds `react` and `react-dom` to `resolve.dedupe` automatically.

packages/plugin-react/README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export default defineConfig({
2121

2222
### include/exclude
2323

24-
Includes `.js`, `.jsx`, `.ts` & `.tsx` by default. This option can be used to add fast refresh to `.mdx` files:
24+
Includes `.js`, `.jsx`, `.ts` & `.tsx` and excludes `/node_modules/` by default. This option can be used to add fast refresh to `.mdx` files:
2525

2626
```js
2727
import { defineConfig } from 'vite'
@@ -36,8 +36,6 @@ export default defineConfig({
3636
})
3737
```
3838

39-
> `node_modules` are never processed by this plugin (but esbuild will)
40-
4139
### jsxImportSource
4240

4341
Control where the JSX factory is imported from. Default to `'react'`

0 commit comments

Comments
 (0)