diff --git a/docs/start/rsc/vite.md b/docs/start/rsc/vite.md index 5789260387..80f7624f92 100644 --- a/docs/start/rsc/vite.md +++ b/docs/start/rsc/vite.md @@ -28,7 +28,7 @@ npm i react-router react react-dom react-server-dom-parcel @mjackson/node-fetch- Along with development dependencies ```shellscript nonumber -npm i -D vite vite-plugin-devtools-json @hiogawa/vite-rsc typescript @types/react @types/react-dom @types/express @types/compression @types/node +npm i -D vite vite-plugin-devtools-json @vitejs/plugin-rsc typescript @types/react @types/react-dom @types/express @types/compression @types/node ``` ## Configure Parcel @@ -58,7 +58,7 @@ import { decodeReply, loadServerAction, renderToReadableStream, -} from "@hiogawa/vite-rsc/rsc"; +} from "@vitejs/plugin-rsc/rsc"; import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; import { routes } from "./routes/routes"; @@ -102,18 +102,21 @@ export default async function handler(request: Request) { Create a `src/prerender.tsx` file that will be responsible for rendering our application to HTML. ```tsx nonnumber -import { createFromReadableStream } from "@hiogawa/vite-rsc/ssr"; +import { createFromReadableStream } from "@vitejs/plugin-rsc/ssr"; import { renderToReadableStream as renderHTMLToReadableStream } from "react-dom/server.edge"; import { unstable_routeRSCServerRequest as routeRSCServerRequest, unstable_RSCStaticRouter as RSCStaticRouter, } from "react-router"; -import bootstrapScriptContent from "virtual:vite-rsc/bootstrap-script-content"; export async function prerender( request: Request, fetchServer: (request: Request) => Promise ): Promise { + const bootstrapScriptContent = + await import.meta.viteRsc.loadBootstrapScriptContent( + "index" + ); return await routeRSCServerRequest({ // The incoming request. request, @@ -151,7 +154,7 @@ import { createFromReadableStream, encodeReply, setServerCallback, -} from "@hiogawa/vite-rsc/browser"; +} from "@vitejs/plugin-rsc/browser"; import { startTransition, StrictMode } from "react"; import { hydrateRoot } from "react-dom/client"; import { diff --git a/integration/helpers/rsc-vite/package.json b/integration/helpers/rsc-vite/package.json index 17d1605f3f..94960afa2b 100644 --- a/integration/helpers/rsc-vite/package.json +++ b/integration/helpers/rsc-vite/package.json @@ -9,7 +9,7 @@ "typecheck": "tsc" }, "devDependencies": { - "@hiogawa/vite-rsc": "0.4.4", + "@vitejs/plugin-rsc": "0.4.11", "@types/express": "^5.0.0", "@types/node": "^22.13.1", "@types/react": "^19.1.8", diff --git a/integration/helpers/rsc-vite/src/entry.browser.tsx b/integration/helpers/rsc-vite/src/entry.browser.tsx index 71c8ebf326..476166a0c1 100644 --- a/integration/helpers/rsc-vite/src/entry.browser.tsx +++ b/integration/helpers/rsc-vite/src/entry.browser.tsx @@ -5,7 +5,7 @@ import { createTemporaryReferenceSet, encodeReply, setServerCallback, -} from "@hiogawa/vite-rsc/browser"; +} from "@vitejs/plugin-rsc/browser"; import { unstable_createCallServer as createCallServer, unstable_getRSCStream as getRSCStream, diff --git a/integration/helpers/rsc-vite/src/entry.rsc.tsx b/integration/helpers/rsc-vite/src/entry.rsc.tsx index 834c9dc47e..0a8ba73f04 100644 --- a/integration/helpers/rsc-vite/src/entry.rsc.tsx +++ b/integration/helpers/rsc-vite/src/entry.rsc.tsx @@ -4,7 +4,7 @@ import { decodeReply, loadServerAction, renderToReadableStream, -} from "@hiogawa/vite-rsc/rsc"; +} from "@vitejs/plugin-rsc/rsc"; import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; import { routes } from "./routes"; diff --git a/integration/helpers/rsc-vite/src/entry.ssr.tsx b/integration/helpers/rsc-vite/src/entry.ssr.tsx index ef629141ab..827bddf8c1 100644 --- a/integration/helpers/rsc-vite/src/entry.ssr.tsx +++ b/integration/helpers/rsc-vite/src/entry.ssr.tsx @@ -1,5 +1,4 @@ -import bootstrapScriptContent from "virtual:vite-rsc/bootstrap-script-content"; -import { createFromReadableStream } from "@hiogawa/vite-rsc/ssr"; +import { createFromReadableStream } from "@vitejs/plugin-rsc/ssr"; // @ts-expect-error import * as ReactDomServer from "react-dom/server.edge"; import { @@ -11,6 +10,8 @@ export default async function handler( request: Request, fetchServer: (request: Request) => Promise ) { + const bootstrapScriptContent = + await import.meta.viteRsc.loadBootstrapScriptContent("index"); return routeRSCServerRequest({ request, fetchServer, diff --git a/integration/helpers/rsc-vite/tsconfig.json b/integration/helpers/rsc-vite/tsconfig.json index b795eea593..77438d9dbe 100644 --- a/integration/helpers/rsc-vite/tsconfig.json +++ b/integration/helpers/rsc-vite/tsconfig.json @@ -11,7 +11,7 @@ "module": "ESNext", "target": "ESNext", "lib": ["ESNext", "DOM", "DOM.Iterable"], - "types": ["vite/client", "@hiogawa/vite-rsc/types"], + "types": ["vite/client", "@vitejs/plugin-rsc/types"], "jsx": "react-jsx" } } diff --git a/integration/helpers/rsc-vite/vite.config.ts b/integration/helpers/rsc-vite/vite.config.ts index 274649c19c..ecffb9c6c1 100644 --- a/integration/helpers/rsc-vite/vite.config.ts +++ b/integration/helpers/rsc-vite/vite.config.ts @@ -1,4 +1,4 @@ -import rsc from "@hiogawa/vite-rsc/plugin"; +import rsc from "@vitejs/plugin-rsc"; import react from "@vitejs/plugin-react"; import { defineConfig } from "vite"; diff --git a/playground/rsc-vite/package.json b/playground/rsc-vite/package.json index 2ab6f7f2f5..304b4602c5 100644 --- a/playground/rsc-vite/package.json +++ b/playground/rsc-vite/package.json @@ -9,7 +9,7 @@ "typecheck": "tsc" }, "devDependencies": { - "@hiogawa/vite-rsc": "0.4.4", + "@vitejs/plugin-rsc": "0.4.11", "@types/express": "^5.0.0", "@types/node": "^22.13.1", "@types/react": "^19.1.8", diff --git a/playground/rsc-vite/src/entry.browser.tsx b/playground/rsc-vite/src/entry.browser.tsx index 71c8ebf326..476166a0c1 100644 --- a/playground/rsc-vite/src/entry.browser.tsx +++ b/playground/rsc-vite/src/entry.browser.tsx @@ -5,7 +5,7 @@ import { createTemporaryReferenceSet, encodeReply, setServerCallback, -} from "@hiogawa/vite-rsc/browser"; +} from "@vitejs/plugin-rsc/browser"; import { unstable_createCallServer as createCallServer, unstable_getRSCStream as getRSCStream, diff --git a/playground/rsc-vite/src/entry.rsc.tsx b/playground/rsc-vite/src/entry.rsc.tsx index d39342f65a..93cdedfda7 100644 --- a/playground/rsc-vite/src/entry.rsc.tsx +++ b/playground/rsc-vite/src/entry.rsc.tsx @@ -4,7 +4,7 @@ import { decodeReply, loadServerAction, renderToReadableStream, -} from "@hiogawa/vite-rsc/rsc"; +} from "@vitejs/plugin-rsc/rsc"; import { unstable_matchRSCServerRequest as matchRSCServerRequest } from "react-router"; import { routes } from "./routes"; diff --git a/playground/rsc-vite/src/entry.ssr.tsx b/playground/rsc-vite/src/entry.ssr.tsx index ef629141ab..385310db7d 100644 --- a/playground/rsc-vite/src/entry.ssr.tsx +++ b/playground/rsc-vite/src/entry.ssr.tsx @@ -1,5 +1,4 @@ -import bootstrapScriptContent from "virtual:vite-rsc/bootstrap-script-content"; -import { createFromReadableStream } from "@hiogawa/vite-rsc/ssr"; +import { createFromReadableStream } from "@vitejs/plugin-rsc/ssr"; // @ts-expect-error import * as ReactDomServer from "react-dom/server.edge"; import { @@ -11,6 +10,7 @@ export default async function handler( request: Request, fetchServer: (request: Request) => Promise ) { + const bootstrapScriptContent = await import.meta.viteRsc.loadBootstrapScriptContent("index"); return routeRSCServerRequest({ request, fetchServer, diff --git a/playground/rsc-vite/tsconfig.json b/playground/rsc-vite/tsconfig.json index b795eea593..77438d9dbe 100644 --- a/playground/rsc-vite/tsconfig.json +++ b/playground/rsc-vite/tsconfig.json @@ -11,7 +11,7 @@ "module": "ESNext", "target": "ESNext", "lib": ["ESNext", "DOM", "DOM.Iterable"], - "types": ["vite/client", "@hiogawa/vite-rsc/types"], + "types": ["vite/client", "@vitejs/plugin-rsc/types"], "jsx": "react-jsx" } } diff --git a/playground/rsc-vite/vite.config.ts b/playground/rsc-vite/vite.config.ts index 274649c19c..ecffb9c6c1 100644 --- a/playground/rsc-vite/vite.config.ts +++ b/playground/rsc-vite/vite.config.ts @@ -1,4 +1,4 @@ -import rsc from "@hiogawa/vite-rsc/plugin"; +import rsc from "@vitejs/plugin-rsc"; import react from "@vitejs/plugin-react"; import { defineConfig } from "vite"; diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index ee42d03a39..026af14f56 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -487,9 +487,6 @@ importers: specifier: workspace:* version: link:../../../packages/react-router devDependencies: - '@hiogawa/vite-rsc': - specifier: 0.4.4 - version: 0.4.4(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) '@types/express': specifier: ^5.0.0 version: 5.0.1 @@ -505,6 +502,9 @@ importers: '@vitejs/plugin-react': specifier: ^4.5.2 version: 4.5.2(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) + '@vitejs/plugin-rsc': + specifier: 0.4.11 + version: 0.4.11(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) typescript: specifier: ^5.1.6 version: 5.4.5 @@ -1816,9 +1816,6 @@ importers: specifier: workspace:* version: link:../../packages/react-router devDependencies: - '@hiogawa/vite-rsc': - specifier: 0.4.4 - version: 0.4.4(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) '@types/express': specifier: ^5.0.0 version: 5.0.1 @@ -1834,6 +1831,9 @@ importers: '@vitejs/plugin-react': specifier: ^4.5.2 version: 4.5.2(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) + '@vitejs/plugin-rsc': + specifier: 0.4.11 + version: 0.4.11(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) cross-env: specifier: ^7.0.3 version: 7.0.3 @@ -3382,17 +3382,6 @@ packages: resolution: {integrity: sha512-AgJgKLooZyQnzMfoFg5Mo/aHM+HGBC9ExpXIjNqGimYTRgNbL/K7X5EM1kR2JY90BNKk9lo6Usq1T/nWFdT7TQ==} hasBin: true - '@hiogawa/transforms@0.1.3': - resolution: {integrity: sha512-vzDCWgXIk4D6Ea2aBSuNqTssN6sTAqm8xzeqXea68o9TvBm5IZhQ3u/8vmWEiJpAtrlTohcTc1Hfgi025iFpGA==} - - '@hiogawa/vite-rsc@0.4.4': - resolution: {integrity: sha512-Yucbgb6g1bC3S6wofT+ZdtEhnwBZIt4YMZWxXzH9yHugcen0bUtasSATb1qGGraCxu03y8xtHOstXgS8sjdUOQ==} - deprecated: Use @vitejs/plugin-rsc instead - peerDependencies: - react: '*' - react-dom: '*' - vite: '*' - '@humanwhocodes/config-array@0.11.14': resolution: {integrity: sha512-3T8LkOmg45BV5FICb15QQMsyUSWrQ8AygVfC7ZG32zOalnqrilm018ZVCw0eapXux8FtA33q8PSRSstjee3jSg==} engines: {node: '>=10.10.0'} @@ -3707,6 +3696,9 @@ packages: '@mjackson/node-fetch-server@0.6.1': resolution: {integrity: sha512-9ZJnk/DJjt805uv5PPv11haJIW+HHf3YEEyVXv+8iLQxLD/iXA68FH220XoiTPBC4gCg5q+IMadDw8qPqlA5wg==} + '@mjackson/node-fetch-server@0.7.0': + resolution: {integrity: sha512-un8diyEBKU3BTVj3GzlTPA1kIjCkGdD+AMYQy31Gf9JCkfoZzwgJ79GUtHrF2BN3XPNMLpubbzPcxys+a3uZEw==} + '@msgpackr-extract/msgpackr-extract-darwin-arm64@3.0.3': resolution: {integrity: sha512-QZHtlVgbAdy2zAqNA9Gu1UpIuI8Xvsd1v8ic6B2pZmeFnFcMWiPLfWXh7TVw4eGEZ/C9TH281KwhVoeQUKbyjw==} cpu: [arm64] @@ -5106,6 +5098,13 @@ packages: peerDependencies: vite: ^4.2.0 || ^5.0.0 || ^6.0.0 || ^7.0.0-beta.0 + '@vitejs/plugin-rsc@0.4.11': + resolution: {integrity: sha512-+4H4wLi+Y9yF58znBfKgGfX8zcqUGt8ngnmNgzrdGdF1SVz7EO0sg7WnhK5fFVHt6fUxsVEjmEabsCWHKPL1Tw==} + peerDependencies: + react: '*' + react-dom: '*' + vite: '*' + '@web3-storage/multipart-parser@1.0.0': resolution: {integrity: sha512-BEO6al7BYqcnfX15W2cnGR+Q566ACXAT9UQykORCWW80lmkpWsnEob6zJS1ZVBKsSJC8+7vJkHwlp+lXG1UCdw==} @@ -9748,10 +9747,10 @@ packages: yaml: optional: true - vitefu@1.0.6: - resolution: {integrity: sha512-+Rex1GlappUyNN6UfwbVZne/9cYC4+R2XDk9xkNXBKMw6HQagdX9PgZ8V2v1WUSK1wfBLp7qbI1+XSNIlB1xmA==} + vitefu@1.1.1: + resolution: {integrity: sha512-B/Fegf3i8zh0yFbpzZ21amWzHmuNlLlmJT6n7bu5e+pCHUKQIfXSYokrqOBGEMMe9UG2sostKQF9mml/vYaWJQ==} peerDependencies: - vite: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 + vite: ^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 || ^7.0.0-beta.0 peerDependenciesMeta: vite: optional: true @@ -11457,24 +11456,6 @@ snapshots: cac: 6.7.14 mime-types: 2.1.35 - '@hiogawa/transforms@0.1.3': - dependencies: - estree-walker: 3.0.3 - magic-string: 0.30.17 - periscopic: 4.0.2 - - '@hiogawa/vite-rsc@0.4.4(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0))': - dependencies: - '@hiogawa/transforms': 0.1.3 - '@mjackson/node-fetch-server': 0.6.1 - es-module-lexer: 1.7.0 - magic-string: 0.30.17 - react: 19.1.0 - react-dom: 19.1.0(react@19.1.0) - turbo-stream: 3.1.0 - vite: 6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0) - vitefu: 1.0.6(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) - '@humanwhocodes/config-array@0.11.14': dependencies: '@humanwhocodes/object-schema': 2.0.3 @@ -11887,6 +11868,8 @@ snapshots: '@mjackson/node-fetch-server@0.6.1': {} + '@mjackson/node-fetch-server@0.7.0': {} + '@msgpackr-extract/msgpackr-extract-darwin-arm64@3.0.3': optional: true @@ -13681,6 +13664,19 @@ snapshots: transitivePeerDependencies: - supports-color + '@vitejs/plugin-rsc@0.4.11(react-dom@19.1.0(react@19.1.0))(react@19.1.0)(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0))': + dependencies: + '@mjackson/node-fetch-server': 0.7.0 + es-module-lexer: 1.7.0 + estree-walker: 3.0.3 + magic-string: 0.30.17 + periscopic: 4.0.2 + react: 19.1.0 + react-dom: 19.1.0(react@19.1.0) + turbo-stream: 3.1.0 + vite: 6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0) + vitefu: 1.1.1(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)) + '@web3-storage/multipart-parser@1.0.0': {} '@whatwg-node/fetch@0.9.23': @@ -19688,7 +19684,7 @@ snapshots: tsx: 4.19.3 yaml: 2.6.0 - vitefu@1.0.6(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)): + vitefu@1.1.1(vite@6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)): optionalDependencies: vite: 6.2.5(@types/node@22.14.0)(jiti@2.4.2)(lightningcss@1.30.1)(tsx@4.19.3)(yaml@2.6.0)