From 132e3a6be9d0a594f6700921731798e41bc252f9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 15 Apr 2025 02:38:56 +0000 Subject: [PATCH 1/7] fix(deps): update react monorepo to v19 --- playground/class-components/package.json | 8 +- playground/compiler/package.json | 4 +- playground/mdx/package.json | 8 +- playground/react-classic/package.json | 4 +- playground/react-emotion/package.json | 4 +- playground/react-env/package.json | 4 +- playground/react-sourcemap/package.json | 4 +- playground/react/package.json | 4 +- playground/ssr-react/package.json | 4 +- pnpm-lock.yaml | 142 ++++++++++------------- 10 files changed, 83 insertions(+), 103 deletions(-) diff --git a/playground/class-components/package.json b/playground/class-components/package.json index 5b3fe896..2a7e9057 100644 --- a/playground/class-components/package.json +++ b/playground/class-components/package.json @@ -8,12 +8,12 @@ "preview": "vite preview" }, "dependencies": { - "react": "^18.3.1", - "react-dom": "^18.3.1" + "react": "^19.1.0", + "react-dom": "^19.1.0" }, "devDependencies": { - "@types/react": "^18.3.20", - "@types/react-dom": "^18.3.6", + "@types/react": "^19.1.2", + "@types/react-dom": "^19.1.2", "@vitejs/plugin-react": "workspace:*" } } diff --git a/playground/compiler/package.json b/playground/compiler/package.json index 4241fc46..c55f2651 100644 --- a/playground/compiler/package.json +++ b/playground/compiler/package.json @@ -13,8 +13,8 @@ }, "devDependencies": { "@babel/plugin-transform-react-jsx-development": "^7.25.9", - "@types/react": "^18.3.20", - "@types/react-dom": "^18.3.6", + "@types/react": "^19.1.2", + "@types/react-dom": "^19.1.2", "@vitejs/plugin-react": "workspace:*", "babel-plugin-react-compiler": "0.0.0-experimental-dc8bd44-20241121", "typescript": "^5.8.3" diff --git a/playground/mdx/package.json b/playground/mdx/package.json index fa940750..04d70bd4 100644 --- a/playground/mdx/package.json +++ b/playground/mdx/package.json @@ -8,13 +8,13 @@ "preview": "vite preview" }, "dependencies": { - "react": "^18.3.1", - "react-dom": "^18.3.1" + "react": "^19.1.0", + "react-dom": "^19.1.0" }, "devDependencies": { "@mdx-js/rollup": "^3.1.0", - "@types/react": "^18.3.20", - "@types/react-dom": "^18.3.6", + "@types/react": "^19.1.2", + "@types/react-dom": "^19.1.2", "@vitejs/plugin-react": "workspace:*" } } diff --git a/playground/react-classic/package.json b/playground/react-classic/package.json index 1fe88e13..93bb56f6 100644 --- a/playground/react-classic/package.json +++ b/playground/react-classic/package.json @@ -9,8 +9,8 @@ "preview": "vite preview" }, "dependencies": { - "react": "^18.3.1", - "react-dom": "^18.3.1" + "react": "^19.1.0", + "react-dom": "^19.1.0" }, "devDependencies": { "@vitejs/plugin-react": "workspace:*" diff --git a/playground/react-emotion/package.json b/playground/react-emotion/package.json index 73babe1b..35e127e0 100644 --- a/playground/react-emotion/package.json +++ b/playground/react-emotion/package.json @@ -11,8 +11,8 @@ "dependencies": { "@emotion/react": "^11.14.0", "@emotion/styled": "^11.14.0", - "react": "^18.3.1", - "react-dom": "^18.3.1", + "react": "^19.1.0", + "react-dom": "^19.1.0", "react-switch": "^7.1.0" }, "devDependencies": { diff --git a/playground/react-env/package.json b/playground/react-env/package.json index 9eeddfd0..c0f990c7 100644 --- a/playground/react-env/package.json +++ b/playground/react-env/package.json @@ -9,8 +9,8 @@ "preview": "vite preview" }, "dependencies": { - "react": "^18.3.1", - "react-dom": "^18.3.1" + "react": "^19.1.0", + "react-dom": "^19.1.0" }, "devDependencies": { "@vitejs/plugin-react": "workspace:*" diff --git a/playground/react-sourcemap/package.json b/playground/react-sourcemap/package.json index d5ada3cb..4bcd6e22 100644 --- a/playground/react-sourcemap/package.json +++ b/playground/react-sourcemap/package.json @@ -11,8 +11,8 @@ "preview": "vite preview" }, "dependencies": { - "react": "^18.3.1", - "react-dom": "^18.3.1" + "react": "^19.1.0", + "react-dom": "^19.1.0" }, "devDependencies": { "@vitejs/plugin-react": "workspace:*" diff --git a/playground/react/package.json b/playground/react/package.json index ad1fa743..abb756b7 100644 --- a/playground/react/package.json +++ b/playground/react/package.json @@ -10,8 +10,8 @@ }, "dependencies": { "jsx-entry": "file:./jsx-entry", - "react": "^18.3.1", - "react-dom": "^18.3.1" + "react": "^19.1.0", + "react-dom": "^19.1.0" }, "devDependencies": { "@vitejs/plugin-react": "workspace:*" diff --git a/playground/ssr-react/package.json b/playground/ssr-react/package.json index 152907fa..23fcd26a 100644 --- a/playground/ssr-react/package.json +++ b/playground/ssr-react/package.json @@ -8,8 +8,8 @@ "preview": "vite preview" }, "dependencies": { - "react": "^18.3.1", - "react-dom": "^18.3.1" + "react": "^19.1.0", + "react-dom": "^19.1.0" }, "devDependencies": { "@vitejs/plugin-react": "workspace:*" diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index f0ac5b41..5ce2ab13 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -436,18 +436,18 @@ importers: playground/class-components: dependencies: react: - specifier: ^18.3.1 - version: 18.3.1 + specifier: ^19.1.0 + version: 19.1.0 react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) + specifier: ^19.1.0 + version: 19.1.0(react@19.1.0) devDependencies: '@types/react': - specifier: ^18.3.20 - version: 18.3.20 + specifier: ^19.1.2 + version: 19.1.2 '@types/react-dom': - specifier: ^18.3.6 - version: 18.3.6(@types/react@18.3.20) + specifier: ^19.1.2 + version: 19.1.2(@types/react@19.1.2) '@vitejs/plugin-react': specifier: workspace:* version: link:../../packages/plugin-react @@ -465,11 +465,11 @@ importers: specifier: ^7.25.9 version: 7.25.9(@babel/core@7.26.10) '@types/react': - specifier: ^18.3.20 - version: 18.3.20 + specifier: ^19.1.2 + version: 19.1.2 '@types/react-dom': - specifier: ^18.3.6 - version: 18.3.6(@types/react@18.3.20) + specifier: ^19.1.2 + version: 19.1.2(@types/react@19.1.2) '@vitejs/plugin-react': specifier: workspace:* version: link:../../packages/plugin-react @@ -514,21 +514,21 @@ importers: playground/mdx: dependencies: react: - specifier: ^18.3.1 - version: 18.3.1 + specifier: ^19.1.0 + version: 19.1.0 react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) + specifier: ^19.1.0 + version: 19.1.0(react@19.1.0) devDependencies: '@mdx-js/rollup': specifier: ^3.1.0 version: 3.1.0(rollup@4.37.0) '@types/react': - specifier: ^18.3.20 - version: 18.3.20 + specifier: ^19.1.2 + version: 19.1.2 '@types/react-dom': - specifier: ^18.3.6 - version: 18.3.6(@types/react@18.3.20) + specifier: ^19.1.2 + version: 19.1.2(@types/react@19.1.2) '@vitejs/plugin-react': specifier: workspace:* version: link:../../packages/plugin-react @@ -539,11 +539,11 @@ importers: specifier: file:./jsx-entry version: link:jsx-entry react: - specifier: ^18.3.1 - version: 18.3.1 + specifier: ^19.1.0 + version: 19.1.0 react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) + specifier: ^19.1.0 + version: 19.1.0(react@19.1.0) devDependencies: '@vitejs/plugin-react': specifier: workspace:* @@ -552,11 +552,11 @@ importers: playground/react-classic: dependencies: react: - specifier: ^18.3.1 - version: 18.3.1 + specifier: ^19.1.0 + version: 19.1.0 react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) + specifier: ^19.1.0 + version: 19.1.0(react@19.1.0) devDependencies: '@vitejs/plugin-react': specifier: workspace:* @@ -566,19 +566,19 @@ importers: dependencies: '@emotion/react': specifier: ^11.14.0 - version: 11.14.0(react@18.3.1) + version: 11.14.0(@types/react@19.1.0)(react@19.1.0) '@emotion/styled': specifier: ^11.14.0 - version: 11.14.0(@emotion/react@11.14.0(react@18.3.1))(react@18.3.1) + version: 11.14.0(@emotion/react@11.14.0(@types/react@19.1.0)(react@19.1.0))(@types/react@19.1.0)(react@19.1.0) react: - specifier: ^18.3.1 - version: 18.3.1 + specifier: ^19.1.0 + version: 19.1.0 react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) + specifier: ^19.1.0 + version: 19.1.0(react@19.1.0) react-switch: specifier: ^7.1.0 - version: 7.1.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1) + version: 7.1.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0) devDependencies: '@babel/plugin-proposal-pipeline-operator': specifier: ^7.26.7 @@ -593,11 +593,11 @@ importers: playground/react-env: dependencies: react: - specifier: ^18.3.1 - version: 18.3.1 + specifier: ^19.1.0 + version: 19.1.0 react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) + specifier: ^19.1.0 + version: 19.1.0(react@19.1.0) devDependencies: '@vitejs/plugin-react': specifier: workspace:* @@ -606,11 +606,11 @@ importers: playground/react-sourcemap: dependencies: react: - specifier: ^18.3.1 - version: 18.3.1 + specifier: ^19.1.0 + version: 19.1.0 react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) + specifier: ^19.1.0 + version: 19.1.0(react@19.1.0) devDependencies: '@vitejs/plugin-react': specifier: workspace:* @@ -621,11 +621,11 @@ importers: playground/ssr-react: dependencies: react: - specifier: ^18.3.1 - version: 18.3.1 + specifier: ^19.1.0 + version: 19.1.0 react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) + specifier: ^19.1.0 + version: 19.1.0(react@19.1.0) devDependencies: '@vitejs/plugin-react': specifier: workspace:* @@ -1682,6 +1682,9 @@ packages: '@types/react@19.1.0': resolution: {integrity: sha512-UaicktuQI+9UKyA4njtDOGBD/67t8YEBt2xdfqu8+gP9hqPUPsiXlNPcpS2gVdjmis5GKPG3fCxbQLVgxsQZ8w==} + '@types/react@19.1.2': + resolution: {integrity: sha512-oxLPMytKchWGbnQM9O7D67uPa9paTNxO7jVoNMXgkkErULBPhPARCfkKL9ytcIJJRGjbsVwW4ugJzyFFvm/Tiw==} + '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -4141,20 +4144,6 @@ snapshots: transitivePeerDependencies: - supports-color - '@emotion/react@11.14.0(react@18.3.1)': - dependencies: - '@babel/runtime': 7.23.5 - '@emotion/babel-plugin': 11.13.5 - '@emotion/cache': 11.14.0 - '@emotion/serialize': 1.3.3 - '@emotion/use-insertion-effect-with-fallbacks': 1.2.0(react@18.3.1) - '@emotion/utils': 1.4.2 - '@emotion/weak-memoize': 0.4.0 - hoist-non-react-statics: 3.3.2 - react: 18.3.1 - transitivePeerDependencies: - - supports-color - '@emotion/serialize@1.3.3': dependencies: '@emotion/hash': 0.9.2 @@ -4180,27 +4169,10 @@ snapshots: transitivePeerDependencies: - supports-color - '@emotion/styled@11.14.0(@emotion/react@11.14.0(react@18.3.1))(react@18.3.1)': - dependencies: - '@babel/runtime': 7.23.5 - '@emotion/babel-plugin': 11.13.5 - '@emotion/is-prop-valid': 1.3.1 - '@emotion/react': 11.14.0(react@18.3.1) - '@emotion/serialize': 1.3.3 - '@emotion/use-insertion-effect-with-fallbacks': 1.2.0(react@18.3.1) - '@emotion/utils': 1.4.2 - react: 18.3.1 - transitivePeerDependencies: - - supports-color - '@emotion/unitless@0.10.0': {} '@emotion/unitless@0.8.1': {} - '@emotion/use-insertion-effect-with-fallbacks@1.2.0(react@18.3.1)': - dependencies: - react: 18.3.1 - '@emotion/use-insertion-effect-with-fallbacks@1.2.0(react@19.1.0)': dependencies: react: 19.1.0 @@ -4828,6 +4800,10 @@ snapshots: dependencies: '@types/react': 19.1.0 + '@types/react-dom@19.1.2(@types/react@19.1.2)': + dependencies: + '@types/react': 19.1.2 + '@types/react@18.3.20': dependencies: '@types/prop-types': 15.7.11 @@ -4837,6 +4813,10 @@ snapshots: dependencies: csstype: 3.1.3 + '@types/react@19.1.2': + dependencies: + csstype: 3.1.3 + '@types/resolve@1.20.2': {} '@types/styled-components@5.1.34': @@ -6746,11 +6726,11 @@ snapshots: optionalDependencies: react-dom: 19.1.0(react@19.1.0) - react-switch@7.1.0(react-dom@18.3.1(react@18.3.1))(react@18.3.1): + react-switch@7.1.0(react-dom@19.1.0(react@19.1.0))(react@19.1.0): dependencies: prop-types: 15.8.1 - react: 18.3.1 - react-dom: 18.3.1(react@18.3.1) + react: 19.1.0 + react-dom: 19.1.0(react@19.1.0) react@18.3.1: dependencies: From b2298109f3c8327ffac97124f70946ab57006c22 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 15 Apr 2025 12:29:37 +0900 Subject: [PATCH 2/7] test: add react-classic-18 playground --- .github/renovate.json5 | 6 ++- playground/react-classic-18/App.jsx | 30 ++++++++++++++ .../__tests__/react-classic-18.spec.ts | 39 +++++++++++++++++++ playground/react-classic-18/index.html | 10 +++++ playground/react-classic-18/package.json | 23 +++++++++++ playground/react-classic-18/vite.config.ts | 17 ++++++++ pnpm-lock.yaml | 13 +++++++ 7 files changed, 137 insertions(+), 1 deletion(-) create mode 100644 playground/react-classic-18/App.jsx create mode 100644 playground/react-classic-18/__tests__/react-classic-18.spec.ts create mode 100644 playground/react-classic-18/index.html create mode 100644 playground/react-classic-18/package.json create mode 100644 playground/react-classic-18/vite.config.ts diff --git a/.github/renovate.json5 b/.github/renovate.json5 index 409c9acb..aa2b2b74 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -10,7 +10,11 @@ "enabled": false, }, { - "matchFileNames": ["**/react-18/**", "**/compiler-react-18/**"], + "matchFileNames": [ + "**/react-18/**", + "**/react-classic-18/**", + "**/compiler-react-18/**", + ], "ignoreDeps": ["react", "react-dom", "@types/react", "@types/react-dom"], }, { diff --git a/playground/react-classic-18/App.jsx b/playground/react-classic-18/App.jsx new file mode 100644 index 00000000..94326dc5 --- /dev/null +++ b/playground/react-classic-18/App.jsx @@ -0,0 +1,30 @@ +import React, { useState } from 'react' + +function App() { + const [count, setCount] = useState(0) + return ( +
+
+

Hello Vite + React

+

+ +

+

+ Edit App.jsx and save to test HMR updates. +

+ + Learn React + +
+
+ ) +} + +export default App diff --git a/playground/react-classic-18/__tests__/react-classic-18.spec.ts b/playground/react-classic-18/__tests__/react-classic-18.spec.ts new file mode 100644 index 00000000..33fe7dac --- /dev/null +++ b/playground/react-classic-18/__tests__/react-classic-18.spec.ts @@ -0,0 +1,39 @@ +import { expect, test } from 'vitest' +import { editFile, isServe, page, untilUpdated } from '~utils' + +test('should render', async () => { + expect(await page.textContent('h1')).toMatch('Hello Vite + React') +}) + +test('should update', async () => { + expect(await page.textContent('button')).toMatch('count is: 0') + await page.click('button') + expect(await page.textContent('button')).toMatch('count is: 1') +}) + +test.runIf(isServe)('should hmr', async () => { + editFile('App.jsx', (code) => code.replace('Vite + React', 'Updated')) + await untilUpdated(() => page.textContent('h1'), 'Hello Updated') + // preserve state + expect(await page.textContent('button')).toMatch('count is: 1') +}) + +test.runIf(isServe)( + 'should have annotated jsx with file location metadata', + async () => { + const meta = await page.evaluate(() => { + const button = document.querySelector('button') + const key = Object.keys(button).find( + (key) => key.indexOf('__reactFiber') === 0, + ) + return button[key]._debugSource + }) + // If the evaluate call doesn't crash, and the returned metadata has + // the expected fields, we're good. + expect(Object.keys(meta).sort()).toEqual([ + 'columnNumber', + 'fileName', + 'lineNumber', + ]) + }, +) diff --git a/playground/react-classic-18/index.html b/playground/react-classic-18/index.html new file mode 100644 index 00000000..7417c442 --- /dev/null +++ b/playground/react-classic-18/index.html @@ -0,0 +1,10 @@ +
+ diff --git a/playground/react-classic-18/package.json b/playground/react-classic-18/package.json new file mode 100644 index 00000000..8e7f9179 --- /dev/null +++ b/playground/react-classic-18/package.json @@ -0,0 +1,23 @@ +{ + "name": "@vitejs/test-react-classic-18", + "private": true, + "type": "module", + "scripts": { + "dev": "vite", + "build": "vite build", + "debug": "node --inspect-brk vite", + "preview": "vite preview" + }, + "dependencies": { + "react": "^18.3.1", + "react-dom": "^18.3.1" + }, + "devDependencies": { + "@vitejs/plugin-react": "workspace:*" + }, + "babel": { + "presets": [ + "@babel/preset-env" + ] + } +} diff --git a/playground/react-classic-18/vite.config.ts b/playground/react-classic-18/vite.config.ts new file mode 100644 index 00000000..530e397d --- /dev/null +++ b/playground/react-classic-18/vite.config.ts @@ -0,0 +1,17 @@ +import react from '@vitejs/plugin-react' +import type { UserConfig } from 'vite' + +const config: UserConfig = { + server: { port: 8903 /* Should be unique */ }, + plugins: [ + react({ + jsxRuntime: 'classic', + }), + ], + build: { + // to make tests faster + minify: false, + }, +} + +export default config diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 5ce2ab13..c90158be 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -562,6 +562,19 @@ importers: specifier: workspace:* version: link:../../packages/plugin-react + playground/react-classic-18: + dependencies: + react: + specifier: ^18.3.1 + version: 18.3.1 + react-dom: + specifier: ^18.3.1 + version: 18.3.1(react@18.3.1) + devDependencies: + '@vitejs/plugin-react': + specifier: workspace:* + version: link:../../packages/plugin-react + playground/react-emotion: dependencies: '@emotion/react': From 782e1afe839f9b253798b6c168631493b259235d Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 15 Apr 2025 12:30:09 +0900 Subject: [PATCH 3/7] test: remove __source related test from react-19 playgrounds --- .../react-classic/__tests__/react.spec.ts | 20 ------------------- playground/react/__tests__/react.spec.ts | 20 ------------------- 2 files changed, 40 deletions(-) diff --git a/playground/react-classic/__tests__/react.spec.ts b/playground/react-classic/__tests__/react.spec.ts index 33fe7dac..afd4ddfd 100644 --- a/playground/react-classic/__tests__/react.spec.ts +++ b/playground/react-classic/__tests__/react.spec.ts @@ -17,23 +17,3 @@ test.runIf(isServe)('should hmr', async () => { // preserve state expect(await page.textContent('button')).toMatch('count is: 1') }) - -test.runIf(isServe)( - 'should have annotated jsx with file location metadata', - async () => { - const meta = await page.evaluate(() => { - const button = document.querySelector('button') - const key = Object.keys(button).find( - (key) => key.indexOf('__reactFiber') === 0, - ) - return button[key]._debugSource - }) - // If the evaluate call doesn't crash, and the returned metadata has - // the expected fields, we're good. - expect(Object.keys(meta).sort()).toEqual([ - 'columnNumber', - 'fileName', - 'lineNumber', - ]) - }, -) diff --git a/playground/react/__tests__/react.spec.ts b/playground/react/__tests__/react.spec.ts index d5d9c7d9..8eff4144 100644 --- a/playground/react/__tests__/react.spec.ts +++ b/playground/react/__tests__/react.spec.ts @@ -50,26 +50,6 @@ test.runIf(isServe)('should not invalidate when code is invalid', async () => { ) }) -test.runIf(isServe)( - 'should have annotated jsx with file location metadata', - async () => { - const meta = await page.evaluate(() => { - const button = document.querySelector('#state-button') - const key = Object.keys(button).find( - (key) => key.indexOf('__reactFiber') === 0, - ) - return button[key]._debugSource - }) - // If the evaluate call doesn't crash, and the returned metadata has - // the expected fields, we're good. - expect(Object.keys(meta).sort()).toEqual([ - 'columnNumber', - 'fileName', - 'lineNumber', - ]) - }, -) - test('import attributes', async () => { expect(await page.textContent('.import-attributes')).toBe('ok') }) From fca8a0ba1cec56828b18344dc7db801c29bb972f Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 15 Apr 2025 12:36:19 +0900 Subject: [PATCH 4/7] chore: fix lockfile --- pnpm-lock.yaml | 23 +++++++++-------------- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index b2330e91..ec5359eb 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -579,10 +579,10 @@ importers: dependencies: '@emotion/react': specifier: ^11.14.0 - version: 11.14.0(@types/react@19.1.0)(react@19.1.0) + version: 11.14.0(@types/react@19.1.2)(react@19.1.0) '@emotion/styled': specifier: ^11.14.0 - version: 11.14.0(@emotion/react@11.14.0(@types/react@19.1.0)(react@19.1.0))(@types/react@19.1.0)(react@19.1.0) + version: 11.14.0(@emotion/react@11.14.0(@types/react@19.1.2)(react@19.1.0))(@types/react@19.1.2)(react@19.1.0) react: specifier: ^19.1.0 version: 19.1.0 @@ -1695,9 +1695,6 @@ packages: '@types/react@19.1.2': resolution: {integrity: sha512-oxLPMytKchWGbnQM9O7D67uPa9paTNxO7jVoNMXgkkErULBPhPARCfkKL9ytcIJJRGjbsVwW4ugJzyFFvm/Tiw==} - '@types/react@19.1.2': - resolution: {integrity: sha512-oxLPMytKchWGbnQM9O7D67uPa9paTNxO7jVoNMXgkkErULBPhPARCfkKL9ytcIJJRGjbsVwW4ugJzyFFvm/Tiw==} - '@types/resolve@1.20.2': resolution: {integrity: sha512-60BCwRFOZCQhDncwQdxxeOEEkbc5dIMccYLwbxsS4TUNeVECQ/pBJ0j09mrHOl/JJvpRPGwO9SvE4nR2Nb/a4Q==} @@ -2755,6 +2752,10 @@ packages: resolution: {integrity: sha512-GlOJwTIP6TMIlrTFsxTerwC0W6OpQpCGuX1ECRLBUVRh6fpJH3xTqjCjRgQHTb4ZXexH9rtHou1Lf03GKzmhhQ==} engines: {node: '>= 12.0.0'} + lilconfig@3.1.2: + resolution: {integrity: sha512-eop+wDAvpItUys0FWkHIKeC9ybYrTGbU41U5K7+bttZZeohvnY7M9dZ5kB21GNWiFT2q1OoPTvncPCgSOVO5ow==} + engines: {node: '>=14'} + lilconfig@3.1.3: resolution: {integrity: sha512-/vlFKAoH5Cgt3Ie+JLhRbwOsCQePABiU3tJ1egGvyQ+33R/vcwM2Zl2QR/LzjsBeItPt3oSVXapn+m4nQDvpzw==} engines: {node: '>=14'} @@ -4839,10 +4840,6 @@ snapshots: dependencies: '@types/react': 19.1.2 - '@types/react-dom@19.1.2(@types/react@19.1.2)': - dependencies: - '@types/react': 19.1.2 - '@types/react@18.3.20': dependencies: '@types/prop-types': 15.7.11 @@ -4852,10 +4849,6 @@ snapshots: dependencies: csstype: 3.1.3 - '@types/react@19.1.2': - dependencies: - csstype: 3.1.3 - '@types/resolve@1.20.2': {} '@types/styled-components@5.1.34': @@ -5346,7 +5339,7 @@ snapshots: cssnano@7.0.6(postcss@8.5.3): dependencies: cssnano-preset-default: 7.0.6(postcss@8.5.3) - lilconfig: 3.1.3 + lilconfig: 3.1.2 postcss: 8.5.3 csso@5.0.5: @@ -5999,6 +5992,8 @@ snapshots: lightningcss-win32-arm64-msvc: 1.29.3 lightningcss-win32-x64-msvc: 1.29.3 + lilconfig@3.1.2: {} + lilconfig@3.1.3: {} lines-and-columns@1.2.4: {} From f2486a2e31c90c5b7a338fefc0bc6cc5020ba60e Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 15 Apr 2025 12:56:26 +0900 Subject: [PATCH 5/7] Revert "test: remove __source related test from react-19 playgrounds" This reverts commit 782e1afe839f9b253798b6c168631493b259235d. --- .../react-classic/__tests__/react.spec.ts | 20 +++++++++++++++++++ playground/react/__tests__/react.spec.ts | 20 +++++++++++++++++++ 2 files changed, 40 insertions(+) diff --git a/playground/react-classic/__tests__/react.spec.ts b/playground/react-classic/__tests__/react.spec.ts index afd4ddfd..33fe7dac 100644 --- a/playground/react-classic/__tests__/react.spec.ts +++ b/playground/react-classic/__tests__/react.spec.ts @@ -17,3 +17,23 @@ test.runIf(isServe)('should hmr', async () => { // preserve state expect(await page.textContent('button')).toMatch('count is: 1') }) + +test.runIf(isServe)( + 'should have annotated jsx with file location metadata', + async () => { + const meta = await page.evaluate(() => { + const button = document.querySelector('button') + const key = Object.keys(button).find( + (key) => key.indexOf('__reactFiber') === 0, + ) + return button[key]._debugSource + }) + // If the evaluate call doesn't crash, and the returned metadata has + // the expected fields, we're good. + expect(Object.keys(meta).sort()).toEqual([ + 'columnNumber', + 'fileName', + 'lineNumber', + ]) + }, +) diff --git a/playground/react/__tests__/react.spec.ts b/playground/react/__tests__/react.spec.ts index 8eff4144..d5d9c7d9 100644 --- a/playground/react/__tests__/react.spec.ts +++ b/playground/react/__tests__/react.spec.ts @@ -50,6 +50,26 @@ test.runIf(isServe)('should not invalidate when code is invalid', async () => { ) }) +test.runIf(isServe)( + 'should have annotated jsx with file location metadata', + async () => { + const meta = await page.evaluate(() => { + const button = document.querySelector('#state-button') + const key = Object.keys(button).find( + (key) => key.indexOf('__reactFiber') === 0, + ) + return button[key]._debugSource + }) + // If the evaluate call doesn't crash, and the returned metadata has + // the expected fields, we're good. + expect(Object.keys(meta).sort()).toEqual([ + 'columnNumber', + 'fileName', + 'lineNumber', + ]) + }, +) + test('import attributes', async () => { expect(await page.textContent('.import-attributes')).toBe('ok') }) From 89b2e9eb90001a6a0c2e5731708554c70701d9c4 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 15 Apr 2025 12:56:38 +0900 Subject: [PATCH 6/7] Revert "test: add react-classic-18 playground" This reverts commit b2298109f3c8327ffac97124f70946ab57006c22. --- .github/renovate.json5 | 6 +-- playground/react-classic-18/App.jsx | 30 -------------- .../__tests__/react-classic-18.spec.ts | 39 ------------------- playground/react-classic-18/index.html | 10 ----- playground/react-classic-18/package.json | 23 ----------- playground/react-classic-18/vite.config.ts | 17 -------- pnpm-lock.yaml | 13 ------- 7 files changed, 1 insertion(+), 137 deletions(-) delete mode 100644 playground/react-classic-18/App.jsx delete mode 100644 playground/react-classic-18/__tests__/react-classic-18.spec.ts delete mode 100644 playground/react-classic-18/index.html delete mode 100644 playground/react-classic-18/package.json delete mode 100644 playground/react-classic-18/vite.config.ts diff --git a/.github/renovate.json5 b/.github/renovate.json5 index aa2b2b74..409c9acb 100644 --- a/.github/renovate.json5 +++ b/.github/renovate.json5 @@ -10,11 +10,7 @@ "enabled": false, }, { - "matchFileNames": [ - "**/react-18/**", - "**/react-classic-18/**", - "**/compiler-react-18/**", - ], + "matchFileNames": ["**/react-18/**", "**/compiler-react-18/**"], "ignoreDeps": ["react", "react-dom", "@types/react", "@types/react-dom"], }, { diff --git a/playground/react-classic-18/App.jsx b/playground/react-classic-18/App.jsx deleted file mode 100644 index 94326dc5..00000000 --- a/playground/react-classic-18/App.jsx +++ /dev/null @@ -1,30 +0,0 @@ -import React, { useState } from 'react' - -function App() { - const [count, setCount] = useState(0) - return ( -
-
-

Hello Vite + React

-

- -

-

- Edit App.jsx and save to test HMR updates. -

- - Learn React - -
-
- ) -} - -export default App diff --git a/playground/react-classic-18/__tests__/react-classic-18.spec.ts b/playground/react-classic-18/__tests__/react-classic-18.spec.ts deleted file mode 100644 index 33fe7dac..00000000 --- a/playground/react-classic-18/__tests__/react-classic-18.spec.ts +++ /dev/null @@ -1,39 +0,0 @@ -import { expect, test } from 'vitest' -import { editFile, isServe, page, untilUpdated } from '~utils' - -test('should render', async () => { - expect(await page.textContent('h1')).toMatch('Hello Vite + React') -}) - -test('should update', async () => { - expect(await page.textContent('button')).toMatch('count is: 0') - await page.click('button') - expect(await page.textContent('button')).toMatch('count is: 1') -}) - -test.runIf(isServe)('should hmr', async () => { - editFile('App.jsx', (code) => code.replace('Vite + React', 'Updated')) - await untilUpdated(() => page.textContent('h1'), 'Hello Updated') - // preserve state - expect(await page.textContent('button')).toMatch('count is: 1') -}) - -test.runIf(isServe)( - 'should have annotated jsx with file location metadata', - async () => { - const meta = await page.evaluate(() => { - const button = document.querySelector('button') - const key = Object.keys(button).find( - (key) => key.indexOf('__reactFiber') === 0, - ) - return button[key]._debugSource - }) - // If the evaluate call doesn't crash, and the returned metadata has - // the expected fields, we're good. - expect(Object.keys(meta).sort()).toEqual([ - 'columnNumber', - 'fileName', - 'lineNumber', - ]) - }, -) diff --git a/playground/react-classic-18/index.html b/playground/react-classic-18/index.html deleted file mode 100644 index 7417c442..00000000 --- a/playground/react-classic-18/index.html +++ /dev/null @@ -1,10 +0,0 @@ -
- diff --git a/playground/react-classic-18/package.json b/playground/react-classic-18/package.json deleted file mode 100644 index 8e7f9179..00000000 --- a/playground/react-classic-18/package.json +++ /dev/null @@ -1,23 +0,0 @@ -{ - "name": "@vitejs/test-react-classic-18", - "private": true, - "type": "module", - "scripts": { - "dev": "vite", - "build": "vite build", - "debug": "node --inspect-brk vite", - "preview": "vite preview" - }, - "dependencies": { - "react": "^18.3.1", - "react-dom": "^18.3.1" - }, - "devDependencies": { - "@vitejs/plugin-react": "workspace:*" - }, - "babel": { - "presets": [ - "@babel/preset-env" - ] - } -} diff --git a/playground/react-classic-18/vite.config.ts b/playground/react-classic-18/vite.config.ts deleted file mode 100644 index 530e397d..00000000 --- a/playground/react-classic-18/vite.config.ts +++ /dev/null @@ -1,17 +0,0 @@ -import react from '@vitejs/plugin-react' -import type { UserConfig } from 'vite' - -const config: UserConfig = { - server: { port: 8903 /* Should be unique */ }, - plugins: [ - react({ - jsxRuntime: 'classic', - }), - ], - build: { - // to make tests faster - minify: false, - }, -} - -export default config diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ec5359eb..43b3e368 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -562,19 +562,6 @@ importers: specifier: workspace:* version: link:../../packages/plugin-react - playground/react-classic-18: - dependencies: - react: - specifier: ^18.3.1 - version: 18.3.1 - react-dom: - specifier: ^18.3.1 - version: 18.3.1(react@18.3.1) - devDependencies: - '@vitejs/plugin-react': - specifier: workspace:* - version: link:../../packages/plugin-react - playground/react-emotion: dependencies: '@emotion/react': From 2eaad83e15a6fad65859003d655df009a643db21 Mon Sep 17 00:00:00 2001 From: sapphi-red <49056869+sapphi-red@users.noreply.github.com> Date: Tue, 15 Apr 2025 12:57:50 +0900 Subject: [PATCH 7/7] test: check the code instead --- .../react-classic/__tests__/react.spec.ts | 20 +++++-------------- playground/react/__tests__/react.spec.ts | 19 +++++------------- 2 files changed, 10 insertions(+), 29 deletions(-) diff --git a/playground/react-classic/__tests__/react.spec.ts b/playground/react-classic/__tests__/react.spec.ts index 33fe7dac..c0cd2b73 100644 --- a/playground/react-classic/__tests__/react.spec.ts +++ b/playground/react-classic/__tests__/react.spec.ts @@ -1,5 +1,5 @@ import { expect, test } from 'vitest' -import { editFile, isServe, page, untilUpdated } from '~utils' +import { editFile, isServe, page, untilUpdated, viteTestUrl } from '~utils' test('should render', async () => { expect(await page.textContent('h1')).toMatch('Hello Vite + React') @@ -21,19 +21,9 @@ test.runIf(isServe)('should hmr', async () => { test.runIf(isServe)( 'should have annotated jsx with file location metadata', async () => { - const meta = await page.evaluate(() => { - const button = document.querySelector('button') - const key = Object.keys(button).find( - (key) => key.indexOf('__reactFiber') === 0, - ) - return button[key]._debugSource - }) - // If the evaluate call doesn't crash, and the returned metadata has - // the expected fields, we're good. - expect(Object.keys(meta).sort()).toEqual([ - 'columnNumber', - 'fileName', - 'lineNumber', - ]) + const res = await page.request.get(viteTestUrl + '/App.jsx') + const code = await res.text() + expect(code).toMatch(/lineNumber:\s*\d+/) + expect(code).toMatch(/columnNumber:\s*\d+/) }, ) diff --git a/playground/react/__tests__/react.spec.ts b/playground/react/__tests__/react.spec.ts index d5d9c7d9..924c4e4b 100644 --- a/playground/react/__tests__/react.spec.ts +++ b/playground/react/__tests__/react.spec.ts @@ -7,6 +7,7 @@ import { page, untilBrowserLogAfter, untilUpdated, + viteTestUrl, } from '~utils' test('should render', async () => { @@ -53,20 +54,10 @@ test.runIf(isServe)('should not invalidate when code is invalid', async () => { test.runIf(isServe)( 'should have annotated jsx with file location metadata', async () => { - const meta = await page.evaluate(() => { - const button = document.querySelector('#state-button') - const key = Object.keys(button).find( - (key) => key.indexOf('__reactFiber') === 0, - ) - return button[key]._debugSource - }) - // If the evaluate call doesn't crash, and the returned metadata has - // the expected fields, we're good. - expect(Object.keys(meta).sort()).toEqual([ - 'columnNumber', - 'fileName', - 'lineNumber', - ]) + const res = await page.request.get(viteTestUrl + '/App.jsx') + const code = await res.text() + expect(code).toMatch(/lineNumber:\s*\d+/) + expect(code).toMatch(/columnNumber:\s*\d+/) }, )