vite-plugin-react-server 0.3.3 → 0.3.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +113 -222
- package/bin/patch.mjs +84 -0
- package/dist/_virtual/sourcemap-codec.umd.js +11 -0
- package/dist/_virtual/sourcemap-codec.umd.js.map +1 -0
- package/dist/_virtual/sourcemap-codec.umd2.js +9 -0
- package/dist/_virtual/sourcemap-codec.umd2.js.map +1 -0
- package/dist/client.d.ts +3 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +7 -0
- package/dist/client.js.map +1 -0
- package/dist/index.d.ts +6 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +32 -3
- package/dist/index.js.map +1 -1
- package/dist/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +457 -0
- package/dist/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +1 -0
- package/dist/node_modules/magic-string/dist/magic-string.es.js +1283 -0
- package/dist/node_modules/magic-string/dist/magic-string.es.js.map +1 -0
- package/dist/package.json +131 -0
- package/dist/plugin/assertServerCondition.d.ts.map +1 -0
- package/dist/plugin/assertServerCondition.js +15 -0
- package/dist/plugin/build/createClientBuildConfig.d.ts +3 -0
- package/dist/plugin/build/createClientBuildConfig.d.ts.map +1 -0
- package/dist/plugin/build/createClientBuildConfig.js +14 -0
- package/dist/plugin/build/createServerBuildConfig.d.ts +12 -0
- package/dist/plugin/build/createServerBuildConfig.d.ts.map +1 -0
- package/dist/plugin/build/createServerBuildConfig.js +40 -0
- package/dist/plugin/build/createSharedBuildConfig.d.ts +5 -0
- package/dist/plugin/build/createSharedBuildConfig.d.ts.map +1 -0
- package/dist/plugin/build/createSharedBuildConfig.js +28 -0
- package/dist/plugin/build/mergeInputs.d.ts +9 -0
- package/dist/plugin/build/mergeInputs.d.ts.map +1 -0
- package/dist/plugin/build/mergeInputs.js +56 -0
- package/dist/plugin/checkFilesExist.d.ts +3 -0
- package/dist/plugin/checkFilesExist.d.ts.map +1 -0
- package/dist/plugin/checkFilesExist.js +78 -0
- package/dist/plugin/checkFilesExist.js.map +1 -0
- package/dist/{collect-css-manifest.d.ts → plugin/collect-css-manifest.d.ts} +2 -2
- package/dist/plugin/collect-css-manifest.d.ts.map +1 -0
- package/dist/{src → plugin}/collect-css-manifest.js +8 -5
- package/dist/plugin/collect-css-manifest.js.map +1 -0
- package/dist/plugin/components.d.ts.map +1 -0
- package/dist/{src → plugin}/components.js +9 -4
- package/dist/plugin/components.js.map +1 -0
- package/dist/plugin/config/defaults.d.ts +51 -0
- package/dist/plugin/config/defaults.d.ts.map +1 -0
- package/dist/plugin/config/defaults.js +52 -0
- package/dist/plugin/config/defaults.js.map +1 -0
- package/dist/plugin/config/getCondition.d.ts +2 -0
- package/dist/plugin/config/getCondition.d.ts.map +1 -0
- package/dist/plugin/config/getCondition.js +11 -0
- package/dist/plugin/config/getCondition.js.map +1 -0
- package/dist/plugin/config/getPaths.d.ts +5 -0
- package/dist/plugin/config/getPaths.d.ts.map +1 -0
- package/dist/plugin/config/getPaths.js +21 -0
- package/dist/plugin/config/getPaths.js.map +1 -0
- package/dist/plugin/config/getWorkerPath.d.ts +2 -0
- package/dist/plugin/config/getWorkerPath.d.ts.map +1 -0
- package/dist/plugin/config/getWorkerPath.js +4 -0
- package/dist/plugin/config/index.d.ts +8 -0
- package/dist/plugin/config/index.d.ts.map +1 -0
- package/dist/plugin/config/index.js +7 -0
- package/dist/plugin/config/moduleIdDefault.d.ts +8 -0
- package/dist/plugin/config/moduleIdDefault.d.ts.map +1 -0
- package/dist/plugin/config/moduleIdDefault.js +23 -0
- package/dist/plugin/config/moduleIdDefault.js.map +1 -0
- package/dist/plugin/config/resolveOptions.d.ts +9 -0
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -0
- package/dist/plugin/config/resolveOptions.js +56 -0
- package/dist/plugin/config/resolveOptions.js.map +1 -0
- package/dist/plugin/config/resolvePages.d.ts +9 -0
- package/dist/plugin/config/resolvePages.d.ts.map +1 -0
- package/dist/plugin/config/resolvePages.js +38 -0
- package/dist/plugin/config/resolvePages.js.map +1 -0
- package/dist/plugin/config/resolveUserConfig.d.ts +18 -0
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -0
- package/dist/plugin/config/resolveUserConfig.js +84 -0
- package/dist/plugin/config/resolveUserConfig.js.map +1 -0
- package/dist/plugin/copy-dir.d.ts.map +1 -0
- package/dist/plugin/copy-dir.js +20 -0
- package/dist/plugin/getCondition.d.ts +2 -0
- package/dist/plugin/getCondition.d.ts.map +1 -0
- package/dist/plugin/getCondition.js +1 -0
- package/dist/plugin/getEnv.d.ts.map +1 -0
- package/dist/plugin/getEnv.js +107 -0
- package/dist/plugin/helpers/createClientInputNormalizer.d.ts +8 -0
- package/dist/plugin/helpers/createClientInputNormalizer.d.ts.map +1 -0
- package/dist/plugin/helpers/createClientInputNormalizer.js +35 -0
- package/dist/plugin/helpers/createServerInputNormalizer.d.ts +9 -0
- package/dist/plugin/helpers/createServerInputNormalizer.d.ts.map +1 -0
- package/dist/plugin/helpers/createServerInputNormalizer.js +37 -0
- package/dist/plugin/helpers/createStaticInputNormalizer.d.ts +7 -0
- package/dist/plugin/helpers/createStaticInputNormalizer.d.ts.map +1 -0
- package/dist/plugin/helpers/createStaticInputNormalizer.js +18 -0
- package/dist/plugin/helpers/getModuleManifest.d.ts +12 -0
- package/dist/plugin/helpers/getModuleManifest.d.ts.map +1 -0
- package/dist/plugin/helpers/getModuleManifest.js +24 -0
- package/dist/plugin/helpers/getModuleManifest.js.map +1 -0
- package/dist/plugin/helpers/inputNormalizer.d.ts +3 -0
- package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -0
- package/dist/plugin/helpers/inputNormalizer.js +35 -0
- package/dist/plugin/helpers/inputNormalizer.js.map +1 -0
- package/dist/plugin/helpers/inputNormalizerWorker.d.ts +11 -0
- package/dist/plugin/helpers/inputNormalizerWorker.d.ts.map +1 -0
- package/dist/plugin/helpers/inputNormalizerWorker.js +30 -0
- package/dist/plugin/helpers/normalizedRelativePath.d.ts.map +1 -0
- package/dist/plugin/helpers/normalizedRelativePath.js +36 -0
- package/dist/plugin/helpers/resolveFilePath.d.ts +13 -0
- package/dist/plugin/helpers/resolveFilePath.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveFilePath.js +74 -0
- package/dist/plugin/helpers/resolveWorkerModule.d.ts +6 -0
- package/dist/plugin/helpers/resolveWorkerModule.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveWorkerModule.js +24 -0
- package/dist/plugin/helpers/tryManifest.d.ts.map +1 -0
- package/dist/{src → plugin}/helpers/tryManifest.js +11 -6
- package/dist/plugin/helpers/tryManifest.js.map +1 -0
- package/dist/plugin/helpers/validateModuleBase.d.ts +3 -0
- package/dist/plugin/helpers/validateModuleBase.d.ts.map +1 -0
- package/dist/plugin/helpers/validateModuleBase.js +16 -0
- package/dist/plugin/helpers/validateResolvedConfig.d.ts +3 -0
- package/dist/plugin/helpers/validateResolvedConfig.d.ts.map +1 -0
- package/dist/plugin/helpers/validateResolvedConfig.js +17 -0
- package/dist/plugin/index.d.ts +3 -0
- package/dist/plugin/index.d.ts.map +1 -0
- package/dist/plugin/index.js +1 -0
- package/dist/plugin/loader/createBuildLoader.d.ts +9 -0
- package/dist/plugin/loader/createBuildLoader.d.ts.map +1 -0
- package/dist/plugin/loader/createBuildLoader.js +52 -0
- package/dist/plugin/loader/createBuildLoader.js.map +1 -0
- package/dist/plugin/loader/createCssLoader.d.ts +30 -0
- package/dist/plugin/loader/createCssLoader.d.ts.map +1 -0
- package/dist/plugin/loader/createCssLoader.js +35 -0
- package/dist/{html → plugin/loader}/createPageLoader.d.ts +2 -4
- package/dist/plugin/loader/createPageLoader.d.ts.map +1 -0
- package/dist/plugin/loader/createPageLoader.js +57 -0
- package/dist/plugin/manifest.d.ts.map +1 -0
- package/dist/plugin/manifest.js +13 -0
- package/dist/plugin/module-graph.d.ts.map +1 -0
- package/dist/plugin/module-graph.js +35 -0
- package/dist/plugin/plugin.d.ts +7 -0
- package/dist/plugin/plugin.d.ts.map +1 -0
- package/dist/plugin/plugin.js +8 -0
- package/dist/plugin/preserver/index.d.ts +2 -0
- package/dist/plugin/preserver/index.d.ts.map +1 -0
- package/dist/plugin/preserver/index.js +1 -0
- package/dist/plugin/preserver/plugin.d.ts +4 -0
- package/dist/plugin/preserver/plugin.d.ts.map +1 -0
- package/dist/plugin/preserver/plugin.js +90 -0
- package/dist/plugin/preserver/plugin.js.map +1 -0
- package/dist/plugin/react-client/index.d.ts +2 -0
- package/dist/plugin/react-client/index.d.ts.map +1 -0
- package/dist/plugin/react-client/index.js +1 -0
- package/dist/plugin/react-client/plugin.d.ts +4 -0
- package/dist/plugin/react-client/plugin.d.ts.map +1 -0
- package/dist/plugin/react-client/plugin.js +34 -0
- package/dist/plugin/react-client/plugin.js.map +1 -0
- package/dist/plugin/react-server/createDevMiddleware.d.ts.map +1 -0
- package/dist/plugin/react-server/createDevMiddleware.js +68 -0
- package/dist/plugin/react-server/createDevServer.d.ts.map +1 -0
- package/dist/plugin/react-server/createDevServer.js +4 -0
- package/dist/plugin/react-server/createHandler.d.ts +17 -0
- package/dist/plugin/react-server/createHandler.d.ts.map +1 -0
- package/dist/{src → plugin}/react-server/createHandler.js +28 -17
- package/dist/plugin/react-server/createHandler.js.map +1 -0
- package/dist/plugin/react-server/createReactNodeStreamer.d.ts.map +1 -0
- package/dist/plugin/react-server/createReactNodeStreamer.js +7 -0
- package/dist/{react-server → plugin/react-server}/createRscStream.d.ts +1 -1
- package/dist/plugin/react-server/createRscStream.d.ts.map +1 -0
- package/dist/{src → plugin}/react-server/createRscStream.js +14 -13
- package/dist/plugin/react-server/createRscStream.js.map +1 -0
- package/dist/{react-server → plugin/react-server}/createSsrHandler.d.ts +1 -1
- package/dist/plugin/react-server/createSsrHandler.d.ts.map +1 -0
- package/dist/plugin/react-server/createSsrHandler.js +102 -0
- package/dist/plugin/react-server/index.d.ts +4 -0
- package/dist/plugin/react-server/index.d.ts.map +1 -0
- package/dist/plugin/react-server/index.js +10 -0
- package/dist/{react-server → plugin/react-server}/plugin.d.ts +2 -2
- package/dist/plugin/react-server/plugin.d.ts.map +1 -0
- package/dist/plugin/react-server/plugin.js +375 -0
- package/dist/plugin/react-server/plugin.js.map +1 -0
- package/dist/plugin/resolvePage.d.ts.map +1 -0
- package/dist/{src → plugin}/resolvePage.js +8 -4
- package/dist/plugin/resolvePage.js.map +1 -0
- package/dist/plugin/resolveProps.d.ts.map +1 -0
- package/dist/{src → plugin}/resolveProps.js +21 -8
- package/dist/plugin/resolveProps.js.map +1 -0
- package/dist/plugin/server.d.ts +2 -0
- package/dist/plugin/server.d.ts.map +1 -0
- package/dist/plugin/server.js +1 -0
- package/dist/plugin/transformer/index.d.ts +2 -0
- package/dist/plugin/transformer/index.d.ts.map +1 -0
- package/dist/plugin/transformer/index.js +1 -0
- package/dist/{transformer/index.d.ts → plugin/transformer/plugin.d.ts} +3 -3
- package/dist/plugin/transformer/plugin.d.ts.map +1 -0
- package/dist/plugin/transformer/plugin.js +86 -0
- package/dist/plugin/transformer/plugin.js.map +1 -0
- package/dist/plugin/transformer/transformer-client-components.d.ts +21 -0
- package/dist/plugin/transformer/transformer-client-components.d.ts.map +1 -0
- package/dist/plugin/transformer/transformer-client-components.js +61 -0
- package/dist/plugin/transformer/transformer-client-components.js.map +1 -0
- package/dist/{transformer/transformer.d.ts → plugin/transformer/transformer-server-actions.d.ts} +3 -4
- package/dist/plugin/transformer/transformer-server-actions.d.ts.map +1 -0
- package/dist/plugin/transformer/transformer-server-actions.js +76 -0
- package/dist/plugin/transformer/transformer-server-actions.js.map +1 -0
- package/dist/plugin/transformer/types.d.ts.map +1 -0
- package/dist/plugin/transformer/types.js +1 -0
- package/dist/plugin/types.d.ts +225 -0
- package/dist/plugin/types.d.ts.map +1 -0
- package/dist/plugin/types.js +1 -0
- package/dist/plugin/worker/createWorker.d.ts +15 -0
- package/dist/plugin/worker/createWorker.d.ts.map +1 -0
- package/dist/plugin/worker/createWorker.js +71 -0
- package/dist/plugin/worker/createWorker.js.map +1 -0
- package/dist/plugin/worker/html/html-worker.d.ts +2 -0
- package/dist/plugin/worker/html/html-worker.d.ts.map +1 -0
- package/dist/plugin/worker/html/html-worker.development.d.ts +2 -0
- package/dist/plugin/worker/html/html-worker.development.d.ts.map +1 -0
- package/dist/plugin/worker/html/html-worker.development.js +12 -0
- package/dist/plugin/worker/html/html-worker.development.js.map +1 -0
- package/dist/plugin/worker/html/html-worker.js +4 -0
- package/dist/plugin/worker/html/html-worker.production.d.ts +2 -0
- package/dist/plugin/worker/html/html-worker.production.d.ts.map +1 -0
- package/dist/plugin/worker/html/html-worker.production.js +12 -0
- package/dist/plugin/worker/html/html-worker.production.js.map +1 -0
- package/dist/plugin/worker/html/index.d.ts +2 -0
- package/dist/plugin/worker/html/index.d.ts.map +1 -0
- package/dist/plugin/worker/html/index.js +7 -0
- package/dist/plugin/worker/html/index.js.map +1 -0
- package/dist/plugin/worker/html/messageHandler.d.ts +3 -0
- package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -0
- package/dist/plugin/worker/html/messageHandler.js +98 -0
- package/dist/plugin/worker/html/messageHandler.js.map +1 -0
- package/dist/plugin/worker/html/plugin.d.ts +4 -0
- package/dist/plugin/worker/html/plugin.d.ts.map +1 -0
- package/dist/plugin/worker/html/plugin.js +89 -0
- package/dist/plugin/worker/html/renderPages.d.ts +38 -0
- package/dist/plugin/worker/html/renderPages.d.ts.map +1 -0
- package/dist/plugin/worker/html/renderPages.js +121 -0
- package/dist/plugin/worker/html/renderPages.js.map +1 -0
- package/dist/plugin/worker/loader.d.ts.map +1 -0
- package/dist/plugin/worker/loader.js +11 -0
- package/dist/plugin/worker/loader.js.map +1 -0
- package/dist/plugin/worker/plugin.d.ts +10 -0
- package/dist/plugin/worker/plugin.d.ts.map +1 -0
- package/dist/plugin/worker/plugin.js +14 -0
- package/dist/plugin/worker/rsc/createRscStream.d.ts +5 -0
- package/dist/plugin/worker/rsc/createRscStream.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/createRscStream.js +39 -0
- package/dist/plugin/worker/rsc/createRscStream.js.map +1 -0
- package/dist/plugin/worker/rsc/development.d.ts +5 -0
- package/dist/plugin/worker/rsc/development.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/development.js +13 -0
- package/dist/plugin/worker/rsc/development.js.map +1 -0
- package/dist/plugin/worker/rsc/index.d.ts +4 -0
- package/dist/plugin/worker/rsc/index.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/index.js +15 -0
- package/dist/plugin/worker/rsc/index.js.map +1 -0
- package/dist/plugin/worker/rsc/plugin.d.ts +4 -0
- package/dist/plugin/worker/rsc/plugin.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/plugin.js +82 -0
- package/dist/plugin/worker/rsc/plugin.js.map +1 -0
- package/dist/plugin/worker/rsc/production.d.ts +5 -0
- package/dist/plugin/worker/rsc/production.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/production.js +13 -0
- package/dist/plugin/worker/rsc/production.js.map +1 -0
- package/dist/plugin/worker/rsc/rsc-worker.d.ts +2 -0
- package/dist/plugin/worker/rsc/rsc-worker.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/rsc-worker.js +106 -0
- package/dist/plugin/worker/types.d.ts +99 -0
- package/dist/plugin/worker/types.d.ts.map +1 -0
- package/dist/plugin/worker/types.js +1 -0
- package/dist/server.d.ts +4 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +9 -0
- package/dist/server.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/types.d.ts +1 -201
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js +1 -0
- package/package.json +44 -25
- package/plugin/build/createClientBuildConfig.ts +21 -0
- package/plugin/build/createServerBuildConfig.ts +66 -0
- package/plugin/build/createSharedBuildConfig.ts +35 -0
- package/plugin/build/mergeInputs.ts +58 -0
- package/plugin/checkFilesExist.ts +82 -0
- package/{src → plugin}/collect-css-manifest.ts +4 -2
- package/plugin/config/defaults.ts +44 -0
- package/plugin/config/getCondition.ts +3 -0
- package/plugin/config/getPaths.ts +25 -0
- package/plugin/config/getWorkerPath.ts +5 -0
- package/plugin/config/index.ts +8 -0
- package/plugin/config/moduleIdDefault.ts +23 -0
- package/plugin/config/resolveOptions.ts +53 -0
- package/plugin/config/resolvePages.ts +43 -0
- package/plugin/config/resolveUserConfig.ts +97 -0
- package/{src → plugin}/getEnv.ts +1 -1
- package/plugin/helpers/createClientInputNormalizer.ts +48 -0
- package/plugin/helpers/createServerInputNormalizer.ts +52 -0
- package/plugin/helpers/createStaticInputNormalizer.ts +26 -0
- package/plugin/helpers/getModuleManifest.ts +31 -0
- package/plugin/helpers/inputNormalizer.ts +39 -0
- package/plugin/helpers/inputNormalizerWorker.ts +47 -0
- package/plugin/helpers/resolveFilePath.ts +108 -0
- package/plugin/helpers/resolveWorkerModule.ts +41 -0
- package/plugin/helpers/validateModuleBase.ts +30 -0
- package/plugin/helpers/validateResolvedConfig.ts +21 -0
- package/plugin/index.ts +2 -0
- package/plugin/loader/createBuildLoader.ts +60 -0
- package/plugin/loader/createCssLoader.ts +73 -0
- package/{src/html → plugin/loader}/createPageLoader.ts +35 -27
- package/plugin/plugin.ts +8 -0
- package/plugin/preserver/index.ts +1 -0
- package/plugin/preserver/plugin.ts +110 -0
- package/plugin/react-client/index.ts +1 -0
- package/plugin/react-client/plugin.ts +33 -0
- package/{src → plugin}/react-server/createDevMiddleware.ts +17 -1
- package/{src → plugin}/react-server/createDevServer.ts +0 -1
- package/{src → plugin}/react-server/createHandler.ts +31 -10
- package/{src → plugin}/react-server/createReactNodeStreamer.ts +1 -0
- package/{src → plugin}/react-server/createRscStream.ts +8 -12
- package/{src → plugin}/react-server/createSsrHandler.ts +16 -19
- package/plugin/react-server/index.ts +13 -0
- package/plugin/react-server/plugin.ts +465 -0
- package/{src → plugin}/resolvePage.ts +1 -1
- package/{src → plugin}/resolveProps.ts +15 -6
- package/plugin/server.tsx +0 -0
- package/plugin/transformer/index.ts +1 -0
- package/plugin/transformer/plugin.ts +131 -0
- package/plugin/transformer/transformer-client-components.ts +94 -0
- package/{src/transformer/transformer.ts → plugin/transformer/transformer-server-actions.ts} +14 -27
- package/{src → plugin}/types.ts +97 -55
- package/plugin/worker/createWorker.ts +84 -0
- package/plugin/worker/html/html-worker.development.tsx +8 -0
- package/plugin/worker/html/html-worker.production.tsx +8 -0
- package/plugin/worker/html/html-worker.ts +5 -0
- package/plugin/worker/html/index.ts +5 -0
- package/plugin/worker/html/messageHandler.ts +116 -0
- package/plugin/worker/html/plugin.ts +97 -0
- package/plugin/worker/html/renderPages.ts +187 -0
- package/plugin/worker/plugin.ts +17 -0
- package/plugin/worker/rsc/createRscStream.ts +42 -0
- package/plugin/worker/rsc/development.ts +6 -0
- package/plugin/worker/rsc/index.ts +14 -0
- package/plugin/worker/rsc/plugin.ts +83 -0
- package/plugin/worker/rsc/production.ts +6 -0
- package/plugin/worker/rsc/rsc-worker.tsx +128 -0
- package/plugin/worker/types.ts +124 -0
- package/scripts/bump-version.mjs +68 -0
- package/scripts/check-react-version.mjs +66 -0
- package/scripts/react+0.0.0-experimental-b3a95caf-20250113.patch +4291 -0
- package/scripts/react-dom+0.0.0-experimental-b3a95caf-20250113.patch +108798 -0
- package/scripts/react-server-dom-esm+0.0.0-experimental-b3a95caf-20250113.patch +24775 -0
- package/{patches → scripts}/react-server-dom-esm+0.0.1.patch +10259 -3
- package/tsconfig.json +15 -13
- package/dist/assertServerCondition.d.ts.map +0 -1
- package/dist/bin/patch.js +0 -51
- package/dist/bin/patch.js.map +0 -1
- package/dist/build/createBuildConfig.d.ts +0 -13
- package/dist/build/createBuildConfig.d.ts.map +0 -1
- package/dist/build/mergeInputs.d.ts +0 -5
- package/dist/build/mergeInputs.d.ts.map +0 -1
- package/dist/checkFilesExist.d.ts +0 -8
- package/dist/checkFilesExist.d.ts.map +0 -1
- package/dist/collect-css-manifest.d.ts.map +0 -1
- package/dist/components.d.ts.map +0 -1
- package/dist/copy-dir.d.ts.map +0 -1
- package/dist/getEnv.d.ts.map +0 -1
- package/dist/helpers/inputNormalizer.d.ts +0 -6
- package/dist/helpers/inputNormalizer.d.ts.map +0 -1
- package/dist/helpers/normalizedRelativePath.d.ts.map +0 -1
- package/dist/helpers/tryManifest.d.ts.map +0 -1
- package/dist/html/createPageLoader.d.ts.map +0 -1
- package/dist/manifest.d.ts.map +0 -1
- package/dist/module-graph.d.ts.map +0 -1
- package/dist/options.d.ts +0 -91
- package/dist/options.d.ts.map +0 -1
- package/dist/plugin.d.ts +0 -3
- package/dist/plugin.d.ts.map +0 -1
- package/dist/react-client/plugin.d.ts +0 -4
- package/dist/react-client/plugin.d.ts.map +0 -1
- package/dist/react-client/plugin.js +0 -28
- package/dist/react-client/plugin.js.map +0 -1
- package/dist/react-server/createDevMiddleware.d.ts.map +0 -1
- package/dist/react-server/createDevServer.d.ts.map +0 -1
- package/dist/react-server/createHandler.d.ts +0 -23
- package/dist/react-server/createHandler.d.ts.map +0 -1
- package/dist/react-server/createReactNodeStreamer.d.ts.map +0 -1
- package/dist/react-server/createRscStream.d.ts.map +0 -1
- package/dist/react-server/createSsrHandler.d.ts.map +0 -1
- package/dist/react-server/plugin.d.ts.map +0 -1
- package/dist/react-server/plugin.js +0 -345
- package/dist/react-server/plugin.js.map +0 -1
- package/dist/resolvePage.d.ts.map +0 -1
- package/dist/resolveProps.d.ts.map +0 -1
- package/dist/src/build/createBuildConfig.js +0 -44
- package/dist/src/build/createBuildConfig.js.map +0 -1
- package/dist/src/build/mergeInputs.js +0 -16
- package/dist/src/build/mergeInputs.js.map +0 -1
- package/dist/src/checkFilesExist.js +0 -61
- package/dist/src/checkFilesExist.js.map +0 -1
- package/dist/src/collect-css-manifest.js.map +0 -1
- package/dist/src/components.js.map +0 -1
- package/dist/src/getEnv.js +0 -76
- package/dist/src/getEnv.js.map +0 -1
- package/dist/src/helpers/inputNormalizer.js +0 -11
- package/dist/src/helpers/inputNormalizer.js.map +0 -1
- package/dist/src/helpers/normalizedRelativePath.js +0 -34
- package/dist/src/helpers/normalizedRelativePath.js.map +0 -1
- package/dist/src/helpers/tryManifest.js.map +0 -1
- package/dist/src/html/createPageLoader.js +0 -72
- package/dist/src/html/createPageLoader.js.map +0 -1
- package/dist/src/options.js +0 -307
- package/dist/src/options.js.map +0 -1
- package/dist/src/react-server/createHandler.js.map +0 -1
- package/dist/src/react-server/createRscStream.js.map +0 -1
- package/dist/src/resolvePage.js.map +0 -1
- package/dist/src/resolveProps.js.map +0 -1
- package/dist/src/worker/createHtmlStream.js +0 -62
- package/dist/src/worker/createHtmlStream.js.map +0 -1
- package/dist/src/worker/createWorker.js +0 -34
- package/dist/src/worker/createWorker.js.map +0 -1
- package/dist/src/worker/renderPages.js +0 -99
- package/dist/src/worker/renderPages.js.map +0 -1
- package/dist/transformer/index.d.ts.map +0 -1
- package/dist/transformer/preserveDirectives.d.ts +0 -4
- package/dist/transformer/preserveDirectives.d.ts.map +0 -1
- package/dist/transformer/preserver.d.ts +0 -2
- package/dist/transformer/preserver.d.ts.map +0 -1
- package/dist/transformer/transformer.d.ts.map +0 -1
- package/dist/transformer/types.d.ts.map +0 -1
- package/dist/worker/createHtmlStream.d.ts +0 -7
- package/dist/worker/createHtmlStream.d.ts.map +0 -1
- package/dist/worker/createWorker.d.ts +0 -10
- package/dist/worker/createWorker.d.ts.map +0 -1
- package/dist/worker/loader.d.ts.map +0 -1
- package/dist/worker/loader.js +0 -7
- package/dist/worker/loader.js.map +0 -1
- package/dist/worker/renderPages.d.ts +0 -18
- package/dist/worker/renderPages.d.ts.map +0 -1
- package/dist/worker/types.d.ts +0 -31
- package/dist/worker/types.d.ts.map +0 -1
- package/dist/worker/worker.d.ts +0 -7
- package/dist/worker/worker.d.ts.map +0 -1
- package/dist/worker/worker.js +0 -112
- package/dist/worker/worker.js.map +0 -1
- package/src/build/createBuildConfig.ts +0 -57
- package/src/build/mergeInputs.ts +0 -42
- package/src/checkFilesExist.ts +0 -67
- package/src/helpers/inputNormalizer.ts +0 -22
- package/src/index.ts +0 -4
- package/src/options.ts +0 -423
- package/src/plugin.ts +0 -5
- package/src/react-client/plugin.ts +0 -34
- package/src/react-server/plugin.ts +0 -409
- package/src/transformer/index.ts +0 -112
- package/src/transformer/preserveDirectives.ts +0 -100
- package/src/transformer/preserver.ts +0 -47
- package/src/worker/createHtmlStream.ts +0 -76
- package/src/worker/createWorker.ts +0 -44
- package/src/worker/renderPages.ts +0 -144
- package/src/worker/types.ts +0 -38
- package/src/worker/worker.tsx +0 -136
- /package/dist/{assertServerCondition.d.ts → plugin/assertServerCondition.d.ts} +0 -0
- /package/dist/{components.d.ts → plugin/components.d.ts} +0 -0
- /package/dist/{copy-dir.d.ts → plugin/copy-dir.d.ts} +0 -0
- /package/dist/{getEnv.d.ts → plugin/getEnv.d.ts} +0 -0
- /package/dist/{helpers → plugin/helpers}/normalizedRelativePath.d.ts +0 -0
- /package/dist/{helpers → plugin/helpers}/tryManifest.d.ts +0 -0
- /package/dist/{manifest.d.ts → plugin/manifest.d.ts} +0 -0
- /package/dist/{module-graph.d.ts → plugin/module-graph.d.ts} +0 -0
- /package/dist/{react-server → plugin/react-server}/createDevMiddleware.d.ts +0 -0
- /package/dist/{react-server → plugin/react-server}/createDevServer.d.ts +0 -0
- /package/dist/{react-server → plugin/react-server}/createReactNodeStreamer.d.ts +0 -0
- /package/dist/{resolvePage.d.ts → plugin/resolvePage.d.ts} +0 -0
- /package/dist/{resolveProps.d.ts → plugin/resolveProps.d.ts} +0 -0
- /package/dist/{transformer → plugin/transformer}/types.d.ts +0 -0
- /package/dist/{worker → plugin/worker}/loader.d.ts +0 -0
- /package/{src → plugin}/assertServerCondition.ts +0 -0
- /package/{src → plugin}/components.tsx +0 -0
- /package/{src → plugin}/copy-dir.ts +0 -0
- /package/{src/server.tsx → plugin/getCondition.ts} +0 -0
- /package/{src → plugin}/helpers/normalizedRelativePath.ts +0 -0
- /package/{src → plugin}/helpers/tryManifest.ts +0 -0
- /package/{src → plugin}/manifest.ts +0 -0
- /package/{src → plugin}/module-graph.ts +0 -0
- /package/{src → plugin}/transformer/README.md +0 -0
- /package/{src → plugin}/transformer/types.ts +0 -0
- /package/{src → plugin}/worker/loader.ts +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createWorker.js","sources":["../../../plugin/worker/createWorker.ts"],"sourcesContent":["import { Worker, type ResourceLimits } from \"node:worker_threads\";\nimport { getMode, getNodePath } from \"../config/getPaths.js\";\nimport { getCondition } from \"../config/getCondition.js\";\n\ntype CreateWorkerOptions = {\n projectRoot?: string;\n condition?: \"react-server\" | \"react-client\";\n nodePath?: string;\n nodeOptions?: string;\n mode?: \"production\" | \"development\";\n reverseCondition?: boolean;\n maxListeners?: number;\n workerPath: string;\n resourceLimits?: ResourceLimits;\n};\n\nexport async function createWorker(options: CreateWorkerOptions) {\n const {\n projectRoot = process.cwd(),\n nodePath = getNodePath(projectRoot),\n condition = getCondition(),\n reverseCondition = true,\n maxListeners = 100,\n mode = getMode(),\n workerPath,\n resourceLimits = {\n maxOldGenerationSizeMb: 512,\n maxYoungGenerationSizeMb: 128,\n }\n } = options;\n\n // Ensure consistent NODE_ENV between main thread and worker\n const isTestEnv = process.env['VITEST'] || process.env['NODE_ENV'] === 'test';\n const nodeEnv = isTestEnv ? 'development' : mode;\n\n const env = {\n ...process.env,\n NODE_ENV: nodeEnv,\n NODE_PATH: nodePath,\n // Clear any inherited conditions for worker\n NODE_OPTIONS: reverseCondition ? \n (condition === 'react-server' ? '--conditions=react-client' : '--conditions=react-server') \n : process.env['NODE_OPTIONS']\n };\n const maxRetries = 3;\n for (let tries = 0; tries < maxRetries; tries++) {\n try {\n const worker = new Worker(workerPath, {\n env,\n // Increase resource limits for stream handling\n resourceLimits: resourceLimits\n });\n\n worker.setMaxListeners(maxListeners);\n\n // Wait for worker to be ready and verify environment\n const ready = await Promise.race([\n new Promise((_, reject) => {\n setTimeout(() => reject(new Error(`Worker startup timeout: ${workerPath}`)), 5000);\n }),\n new Promise((resolve, reject) => {\n worker.once('message', (msg) => {\n if (msg.type === 'READY') {\n if(msg.env === nodeEnv) {\n resolve(true);\n } else {\n reject(new Error(`Worker environment mismatch: expected ${nodeEnv}, got ${msg.env}`));\n }\n } else if (msg.type === 'ERROR') {\n reject(new Error(msg.error));\n }\n });\n worker.once('error', reject);\n })\n ]);\n \n if (ready) return worker;\n } catch (error) {\n console.warn(`Worker startup attempt ${tries + 1} failed:`, error);\n if (tries === maxRetries - 1) throw error;\n }\n }\n throw new Error('Failed to start worker after retries');\n}\n"],"names":[],"mappings":";;;;;;;;;AAgBA,eAAsB,aAAa,OAA8B,EAAA;AAC/D,EAAM,MAAA;AAAA,IACJ,WAAA,GAAc,QAAQ,GAAI,EAAA;AAAA,IAC1B,QAAA,GAAW,YAAY,WAAW,CAAA;AAAA,IAClC,YAAY,YAAa,EAAA;AAAA,IACzB,gBAAmB,GAAA,IAAA;AAAA,IACnB,YAAe,GAAA,GAAA;AAAA,IACf,OAAO,OAAQ,EAAA;AAAA,IACf,UAAA;AAAA,IACA,cAAiB,GAAA;AAAA,MACf,sBAAwB,EAAA,GAAA;AAAA,MACxB,wBAA0B,EAAA;AAAA;AAC5B,GACE,GAAA,OAAA;AAGJ,EAAM,MAAA,SAAA,GAAY,QAAQ,GAAI,CAAA,QAAQ,KAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAM,KAAA,MAAA;AACvE,EAAM,MAAA,OAAA,GAAU,YAAY,aAAgB,GAAA,IAAA;AAE5C,EAAA,MAAM,GAAM,GAAA;AAAA,IACV,GAAG,OAAQ,CAAA,GAAA;AAAA,IACX,QAAU,EAAA,OAAA;AAAA,IACV,SAAW,EAAA,QAAA;AAAA;AAAA,IAEX,YAAA,EAAc,mBACX,SAAc,KAAA,cAAA,GAAiB,8BAA8B,2BAC5D,GAAA,OAAA,CAAQ,IAAI,cAAc;AAAA,G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AA,aACX,KAAO,EAAA;AACd,MAAA,OAAA,CAAQ,IAAK,CAAA,CAAA,uBAAA,EAA0B,KAAQ,GAAA,CAAC,YAAY,KAAK,CAAA;AACjE,MAAI,IAAA,KAAA,KAAU,UAAa,GAAA,CAAA,EAAS,MAAA,KAAA;AAAA;AACtC;AAEF,EAAM,MAAA,IAAI,MAAM,sCAAsC,CAAA;AACxD;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-worker.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/html/html-worker.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-worker.development.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/html/html-worker.development.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
import { messageHandler } from './messageHandler.js';
|
|
7
|
+
import { parentPort } from 'node:worker_threads';
|
|
8
|
+
|
|
9
|
+
if (!parentPort) throw new Error("This module must be run as a worker");
|
|
10
|
+
parentPort?.on("message", messageHandler);
|
|
11
|
+
parentPort?.postMessage({ type: "READY", env: process.env["NODE_ENV"] });
|
|
12
|
+
//# sourceMappingURL=html-worker.development.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-worker.development.js","sources":["../../../../plugin/worker/html/html-worker.development.tsx"],"sourcesContent":["import { messageHandler } from \"./messageHandler.js\";\nimport { parentPort } from \"node:worker_threads\";\n\nif (!parentPort) throw new Error(\"This module must be run as a worker\");\nparentPort?.on(\"message\", messageHandler);\n\n// Signal ready with environment\nparentPort?.postMessage({ type: \"READY\", env: process.env[\"NODE_ENV\"] });"],"names":[],"mappings":";;;;;;;;AAGA,IAAI,CAAC,UAAA,EAAkB,MAAA,IAAI,MAAM,qCAAqC,CAAA;AACtE,UAAY,EAAA,EAAA,CAAG,WAAW,cAAc,CAAA;AAGxC,UAAY,EAAA,WAAA,CAAY,EAAE,IAAM,EAAA,OAAA,EAAS,KAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAA,EAAG,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-worker.production.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/html/html-worker.production.tsx"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
import { messageHandler } from './messageHandler.js';
|
|
7
|
+
import { parentPort } from 'node:worker_threads';
|
|
8
|
+
|
|
9
|
+
if (!parentPort) throw new Error("This module must be run as a worker");
|
|
10
|
+
parentPort?.on("message", messageHandler);
|
|
11
|
+
parentPort?.postMessage({ type: "READY", env: process.env["NODE_ENV"] });
|
|
12
|
+
//# sourceMappingURL=html-worker.production.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"html-worker.production.js","sources":["../../../../plugin/worker/html/html-worker.production.tsx"],"sourcesContent":["import { messageHandler } from \"./messageHandler.js\";\nimport { parentPort } from \"node:worker_threads\";\n\nif (!parentPort) throw new Error(\"This module must be run as a worker\");\nparentPort?.on(\"message\", messageHandler);\n\n// Signal ready with environment\nparentPort?.postMessage({ type: \"READY\", env: process.env[\"NODE_ENV\"] });"],"names":[],"mappings":";;;;;;;;AAGA,IAAI,CAAC,UAAA,EAAkB,MAAA,IAAI,MAAM,qCAAqC,CAAA;AACtE,UAAY,EAAA,EAAA,CAAG,WAAW,cAAc,CAAA;AAGxC,UAAY,EAAA,WAAA,CAAY,EAAE,IAAM,EAAA,OAAA,EAAS,KAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAA,EAAG,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/html/index.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sources":["../../../../plugin/worker/html/index.ts"],"sourcesContent":["await (\n process.env['NODE_ENV'] === 'production' \n ? import('./html-worker.production.js') \n : import('./html-worker.development.js')\n);"],"names":[],"mappings":";;;;;AAAA,OACE,OAAA,CAAQ,IAAI,UAAU,CAAA,KAAM,eACxB,OAAO,6BAA6B,CACpC,GAAA,OAAO,8BAA8B,CAAA,CAAA"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageHandler.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/html/messageHandler.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAmB,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAWtE,eAAO,MAAM,cAAc,YAAmB,iBAAiB,kBAsG9D,CAAC"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
import { PassThrough } from 'node:stream';
|
|
7
|
+
import { parentPort } from 'node:worker_threads';
|
|
8
|
+
import ReactDOMServer from 'react-dom/server';
|
|
9
|
+
import 'react';
|
|
10
|
+
import { createFromNodeStream } from 'react-server-dom-esm/client.node';
|
|
11
|
+
|
|
12
|
+
const activeRenders = /* @__PURE__ */ new Map();
|
|
13
|
+
const messageHandler = async (message) => {
|
|
14
|
+
try {
|
|
15
|
+
switch (message.type) {
|
|
16
|
+
case "RSC_CHUNK": {
|
|
17
|
+
const { id, chunk, ...rest } = message;
|
|
18
|
+
const render = activeRenders.get(id);
|
|
19
|
+
if (!render) {
|
|
20
|
+
activeRenders.set(id, {
|
|
21
|
+
chunks: [chunk],
|
|
22
|
+
id,
|
|
23
|
+
complete: false,
|
|
24
|
+
rendered: false,
|
|
25
|
+
...rest
|
|
26
|
+
});
|
|
27
|
+
} else {
|
|
28
|
+
render.chunks = [...render.chunks, chunk];
|
|
29
|
+
}
|
|
30
|
+
break;
|
|
31
|
+
}
|
|
32
|
+
case "RSC_END": {
|
|
33
|
+
const { id } = message;
|
|
34
|
+
const render = activeRenders.get(id);
|
|
35
|
+
if (!render) {
|
|
36
|
+
throw new Error(`No render state found for ${id}`);
|
|
37
|
+
}
|
|
38
|
+
const rscStream = new PassThrough();
|
|
39
|
+
for (const chunk of render.chunks) {
|
|
40
|
+
rscStream.write(chunk);
|
|
41
|
+
}
|
|
42
|
+
rscStream.end();
|
|
43
|
+
const reactElements = createFromNodeStream(
|
|
44
|
+
rscStream,
|
|
45
|
+
render.moduleRootPath,
|
|
46
|
+
render.moduleBaseURL
|
|
47
|
+
);
|
|
48
|
+
const htmlPromise = new Promise((resolve) => {
|
|
49
|
+
let html = "";
|
|
50
|
+
const collectStream = new PassThrough();
|
|
51
|
+
collectStream.on("data", (chunk) => {
|
|
52
|
+
html += chunk.toString();
|
|
53
|
+
});
|
|
54
|
+
collectStream.on("end", () => {
|
|
55
|
+
resolve(html);
|
|
56
|
+
});
|
|
57
|
+
const stream = ReactDOMServer.renderToPipeableStream(
|
|
58
|
+
reactElements,
|
|
59
|
+
{
|
|
60
|
+
...render.pipableStreamOptions,
|
|
61
|
+
onShellReady() {
|
|
62
|
+
parentPort?.postMessage({ type: "SHELL_READY", id });
|
|
63
|
+
},
|
|
64
|
+
async onAllReady() {
|
|
65
|
+
const finalHtml = await htmlPromise;
|
|
66
|
+
parentPort?.postMessage({
|
|
67
|
+
type: "HTML_READY",
|
|
68
|
+
id,
|
|
69
|
+
html: finalHtml,
|
|
70
|
+
outputPath: render.htmlOutputPath
|
|
71
|
+
});
|
|
72
|
+
parentPort?.postMessage({ type: "ALL_READY", id });
|
|
73
|
+
},
|
|
74
|
+
onError(error) {
|
|
75
|
+
parentPort?.postMessage({
|
|
76
|
+
type: "ERROR",
|
|
77
|
+
id,
|
|
78
|
+
error: error instanceof Error ? error.message : String(error)
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
stream.pipe(collectStream);
|
|
84
|
+
});
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
} catch (error) {
|
|
89
|
+
parentPort?.postMessage({
|
|
90
|
+
type: "ERROR",
|
|
91
|
+
id: message.type === "RSC_CHUNK" || message.type === "RSC_END" ? message.id : "",
|
|
92
|
+
error: error instanceof Error ? error.message : String(error)
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
|
|
97
|
+
export { messageHandler };
|
|
98
|
+
//# sourceMappingURL=messageHandler.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"messageHandler.js","sources":["../../../../plugin/worker/html/messageHandler.ts"],"sourcesContent":["import { PassThrough } from \"node:stream\";\nimport { parentPort } from \"node:worker_threads\";\nimport type { HtmlRenderState, HtmlWorkerMessage } from \"../types.js\";\nimport ReactDOMServer from \"react-dom/server\";\nimport React from \"react\";\nimport {\n createFromNodeStream,\n // @ts-ignore\n} from \"react-server-dom-esm/client.node\";\n\n// Track active renders and streams\nconst activeRenders = new Map<string, HtmlRenderState>();\n\nexport const messageHandler = async (message: HtmlWorkerMessage) => {\n try {\n switch (message.type) {\n case \"RSC_CHUNK\": {\n const { id, chunk, ...rest } = message;\n const render = activeRenders.get(id);\n\n if (!render) {\n activeRenders.set(id, {\n chunks: [chunk],\n id,\n complete: false,\n rendered: false,\n ...rest,\n });\n } else {\n render.chunks = [...render.chunks, chunk];\n }\n break;\n }\n\n case \"RSC_END\": {\n const { id } = message;\n const render = activeRenders.get(id);\n if (!render) {\n throw new Error(`No render state found for ${id}`);\n }\n\n // Create a PassThrough stream to handle the chunks\n const rscStream = new PassThrough();\n\n // Write all chunks to the stream\n for (const chunk of render.chunks) {\n rscStream.write(chunk);\n }\n rscStream.end();\n\n // Create React elements from stream\n const reactElements = createFromNodeStream(\n rscStream,\n render.moduleRootPath,\n render.moduleBaseURL\n );\n\n // Create a promise that resolves when HTML is complete\n const htmlPromise = new Promise<string>((resolve) => {\n let html = \"\";\n const collectStream = new PassThrough();\n\n collectStream.on(\"data\", (chunk) => {\n html += chunk.toString();\n });\n\n collectStream.on(\"end\", () => {\n resolve(html);\n });\n\n // Render to pipeable stream\n const stream = ReactDOMServer.renderToPipeableStream(\n reactElements as React.ReactNode,\n {\n ...render.pipableStreamOptions,\n onShellReady() {\n parentPort?.postMessage({ type: \"SHELL_READY\", id });\n },\n async onAllReady() {\n const finalHtml = await htmlPromise;\n parentPort?.postMessage({\n type: \"HTML_READY\",\n id,\n html: finalHtml,\n outputPath: render.htmlOutputPath,\n });\n parentPort?.postMessage({ type: \"ALL_READY\", id });\n },\n onError(error) {\n parentPort?.postMessage({\n type: \"ERROR\",\n id,\n error: error instanceof Error ? error.message : String(error),\n });\n },\n }\n );\n\n // Pipe to collection stream\n stream.pipe(collectStream);\n });\n\n break;\n }\n }\n } catch (error) {\n parentPort?.postMessage({\n type: \"ERROR\",\n id:\n message.type === \"RSC_CHUNK\" || message.type === \"RSC_END\"\n ? message.id\n : \"\",\n error: error instanceof Error ? error.message : String(error),\n });\n }\n};\n"],"names":[],"mappings":";;;;;;;;;;;AAWA,MAAM,aAAA,uBAAoB,GAA6B,EAAA;AAE1C,MAAA,cAAA,GAAiB,OAAO,OAA+B,KAAA;AAClE,EAAI,IAAA;AACF,IAAA,QAAQ,QAAQ,IAAM;AAAA,MACpB,KAAK,WAAa,EAAA;AAChB,QAAA,MAAM,EAAE,EAAA,EAAI,KAAO,EAAA,GAAG,MAAS,GAAA,OAAA;AAC/B,QAAM,MAAA,MAAA,GAAS,aAAc,CAAA,GAAA,CAAI,EAAE,CAAA;AAEnC,QAAA,IAAI,CAAC,MAAQ,EAAA;AACX,UAAA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
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/html/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAC;AAGnC,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,gBAAgB,CAAC;AAK1D,wBAAgB,qBAAqB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,CAwF1E"}
|
|
@@ -0,0 +1,89 @@
|
|
|
1
|
+
import { resolve } from "path";
|
|
2
|
+
import { DEFAULT_CONFIG } from "../../config/defaults.js";
|
|
3
|
+
import { getPluginRoot } from "../../config/getPaths.js";
|
|
4
|
+
export function reactHtmlWorkerPlugin(options) {
|
|
5
|
+
return {
|
|
6
|
+
name: "vite:react-html-worker",
|
|
7
|
+
config(config) {
|
|
8
|
+
const root = config.root ?? process.cwd();
|
|
9
|
+
const pluginRoot = getPluginRoot();
|
|
10
|
+
const htmlWorkerPath = typeof options.htmlWorkerPath === 'string'
|
|
11
|
+
? resolve(root, options.htmlWorkerPath)
|
|
12
|
+
: resolve(pluginRoot, DEFAULT_CONFIG.HTML_WORKER_PATH);
|
|
13
|
+
const format = 'esm';
|
|
14
|
+
// Single worker output for server build
|
|
15
|
+
const workerConfig = {
|
|
16
|
+
input: {
|
|
17
|
+
'html-worker': htmlWorkerPath,
|
|
18
|
+
},
|
|
19
|
+
output: {
|
|
20
|
+
format,
|
|
21
|
+
dir: options.build?.server ?? 'dist/server', // Output to server directory
|
|
22
|
+
entryFileNames: '[name].js',
|
|
23
|
+
preserveModules: true,
|
|
24
|
+
// Add manifest entry
|
|
25
|
+
manualChunks: {
|
|
26
|
+
'html-worker': [htmlWorkerPath]
|
|
27
|
+
},
|
|
28
|
+
resolve: {
|
|
29
|
+
conditions: ['react-server'],
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
return {
|
|
34
|
+
build: {
|
|
35
|
+
rollupOptions: {
|
|
36
|
+
preserveEntrySignatures: 'strict',
|
|
37
|
+
input: {
|
|
38
|
+
...workerConfig.input,
|
|
39
|
+
...(typeof config.build?.rollupOptions?.input === 'object'
|
|
40
|
+
? config.build?.rollupOptions?.input
|
|
41
|
+
: {}),
|
|
42
|
+
},
|
|
43
|
+
external: [
|
|
44
|
+
'vite',
|
|
45
|
+
'rollup',
|
|
46
|
+
'react',
|
|
47
|
+
'react-dom',
|
|
48
|
+
'react-dom/server',
|
|
49
|
+
'react-server-dom-esm',
|
|
50
|
+
'react-server-dom-esm/client.node',
|
|
51
|
+
'react-server-dom-esm/server.node',
|
|
52
|
+
'react-server-dom-esm/node-loader',
|
|
53
|
+
'source-map',
|
|
54
|
+
'acorn-loose',
|
|
55
|
+
'webpack-sources',
|
|
56
|
+
'stream',
|
|
57
|
+
'util',
|
|
58
|
+
'crypto',
|
|
59
|
+
'async_hooks',
|
|
60
|
+
'fs',
|
|
61
|
+
'path',
|
|
62
|
+
'worker_threads',
|
|
63
|
+
// if we use node: paths in our code, it should always be catched by below rule.
|
|
64
|
+
/^node:.*/,
|
|
65
|
+
],
|
|
66
|
+
output: {
|
|
67
|
+
...workerConfig.output,
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
manifest: true, // Ensure manifest is generated
|
|
71
|
+
minify: false,
|
|
72
|
+
sourcemap: true,
|
|
73
|
+
}
|
|
74
|
+
};
|
|
75
|
+
},
|
|
76
|
+
// Add this to ensure entry is in manifest
|
|
77
|
+
generateBundle(_, bundle) {
|
|
78
|
+
const workerEntry = bundle['html-worker.js'];
|
|
79
|
+
if (workerEntry) {
|
|
80
|
+
Object.defineProperty(workerEntry, 'isEntry', {
|
|
81
|
+
value: true,
|
|
82
|
+
writable: false,
|
|
83
|
+
enumerable: true,
|
|
84
|
+
configurable: false
|
|
85
|
+
});
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { Worker } from "node:worker_threads";
|
|
2
|
+
import type { ResolvedUserConfig, StreamPluginOptions } from "../../types.js";
|
|
3
|
+
interface PipeableStreamOptions {
|
|
4
|
+
bootstrapModules?: string[];
|
|
5
|
+
bootstrapScripts?: string[];
|
|
6
|
+
bootstrapScriptContent?: string;
|
|
7
|
+
signal?: AbortSignal;
|
|
8
|
+
identifierPrefix?: string;
|
|
9
|
+
namespaceURI?: string;
|
|
10
|
+
nonce?: string;
|
|
11
|
+
progressiveChunkSize?: number;
|
|
12
|
+
onShellReady?: () => void;
|
|
13
|
+
onAllReady?: () => void;
|
|
14
|
+
onError?: (error: unknown) => void;
|
|
15
|
+
importMap?: {
|
|
16
|
+
imports?: Record<string, string>;
|
|
17
|
+
};
|
|
18
|
+
}
|
|
19
|
+
type RenderPagesOptions = {
|
|
20
|
+
pluginOptions: Required<Pick<StreamPluginOptions, "moduleBase" | "moduleBasePath" | "moduleBaseURL" | "projectRoot">> & Pick<StreamPluginOptions, "Page" | "props" | "build" | "Html" | "pageExportName" | "propsExportName">;
|
|
21
|
+
userConfig: ResolvedUserConfig;
|
|
22
|
+
manifest: Record<string, {
|
|
23
|
+
file: string;
|
|
24
|
+
}>;
|
|
25
|
+
worker: Worker;
|
|
26
|
+
pipableStreamOptions?: PipeableStreamOptions;
|
|
27
|
+
loader: (id: string) => Promise<Record<string, any>>;
|
|
28
|
+
onCssFile?: (path: string) => void;
|
|
29
|
+
clientCss?: string[];
|
|
30
|
+
moduleBasePath: string;
|
|
31
|
+
moduleBaseURL: string;
|
|
32
|
+
};
|
|
33
|
+
export declare function renderPages(routes: string[], options: RenderPagesOptions): Promise<{
|
|
34
|
+
failedRoutes: Map<string, Error>;
|
|
35
|
+
completedRoutes: Set<string>;
|
|
36
|
+
}>;
|
|
37
|
+
export {};
|
|
38
|
+
//# sourceMappingURL=renderPages.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderPages.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/html/renderPages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AAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACnC,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,aAAa,EAAE,MAAM,CAAC;CACvB,CAAC;AAEF,wBAAsB,WAAW,CAC/B,MAAM,EAAE,MAAM,EAAE,EAChB,OAAO,EAAE,kBAAkB;;;GA0I5B"}
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
import { resolve, join } from 'node:path';
|
|
7
|
+
import { Transform } from 'node:stream';
|
|
8
|
+
import { createHandler } from '../../react-server/createHandler.js';
|
|
9
|
+
import { writeFile, mkdir } from 'node:fs/promises';
|
|
10
|
+
|
|
11
|
+
async function renderPages(routes, options) {
|
|
12
|
+
console.log("[renderPages] Starting render for routes:", routes);
|
|
13
|
+
const destinationRoot = resolve(options.userConfig.root, options.userConfig.build.outDir);
|
|
14
|
+
const failedRoutes = /* @__PURE__ */ new Map();
|
|
15
|
+
const moduleRootPath = join(destinationRoot, options.moduleBasePath);
|
|
16
|
+
const moduleBaseURL = options.moduleBaseURL;
|
|
17
|
+
const htmlRoot = join(
|
|
18
|
+
options.userConfig.root,
|
|
19
|
+
options.pluginOptions.build?.client ?? options.userConfig.build.outDir.replace("server", "client")
|
|
20
|
+
);
|
|
21
|
+
console.log("[renderPages] HTML root:", htmlRoot);
|
|
22
|
+
const streamStarted = /* @__PURE__ */ new Set();
|
|
23
|
+
const completedRoutes = /* @__PURE__ */ new Set();
|
|
24
|
+
const htmlContent = /* @__PURE__ */ new Map();
|
|
25
|
+
const writePromises = /* @__PURE__ */ new Map();
|
|
26
|
+
const allRoutesComplete = new Promise((resolve, reject) => {
|
|
27
|
+
const timeout = setTimeout(() => {
|
|
28
|
+
reject(new Error(`Render timeout - Started: ${streamStarted.size}, Completed: ${completedRoutes.size}`));
|
|
29
|
+
}, 5e3);
|
|
30
|
+
options.worker.on("message", function messageHandler(msg) {
|
|
31
|
+
switch (msg.type) {
|
|
32
|
+
case "SHELL_READY": {
|
|
33
|
+
streamStarted.add(msg.id);
|
|
34
|
+
break;
|
|
35
|
+
}
|
|
36
|
+
case "HTML_READY": {
|
|
37
|
+
htmlContent.set(msg.id, msg.html);
|
|
38
|
+
break;
|
|
39
|
+
}
|
|
40
|
+
case "ALL_READY": {
|
|
41
|
+
completedRoutes.add(msg.id);
|
|
42
|
+
if (completedRoutes.size === routes.length) {
|
|
43
|
+
options.worker.removeListener("message", messageHandler);
|
|
44
|
+
clearTimeout(timeout);
|
|
45
|
+
for (const [route, html] of htmlContent) {
|
|
46
|
+
const outputPath = route === "/" ? join(htmlRoot, "index.html") : join(htmlRoot, route, "index.html");
|
|
47
|
+
const writePromise = writeFile(outputPath, html).catch((error) => {
|
|
48
|
+
failedRoutes.set(route, error);
|
|
49
|
+
});
|
|
50
|
+
writePromises.set(route, writePromise);
|
|
51
|
+
}
|
|
52
|
+
Promise.all(writePromises.values()).then(() => resolve()).catch(reject);
|
|
53
|
+
}
|
|
54
|
+
break;
|
|
55
|
+
}
|
|
56
|
+
case "ERROR": {
|
|
57
|
+
console.error("[renderPages] Worker error:", msg.error);
|
|
58
|
+
if (msg.id) {
|
|
59
|
+
failedRoutes.set(msg.id, new Error(msg.error));
|
|
60
|
+
}
|
|
61
|
+
break;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
try {
|
|
67
|
+
await mkdir(htmlRoot, { recursive: true });
|
|
68
|
+
const renderPromises = routes.map(async (route) => {
|
|
69
|
+
console.log("[renderPages] Processing route:", route);
|
|
70
|
+
try {
|
|
71
|
+
const result = await createHandler(route, options.pluginOptions, {
|
|
72
|
+
loader: options.loader,
|
|
73
|
+
manifest: options.manifest
|
|
74
|
+
});
|
|
75
|
+
if (result.type !== "success") {
|
|
76
|
+
console.log("[renderPages] Handler failed:", result);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const htmlOutputPath = route === "/" ? resolve(htmlRoot, "index.html") : resolve(htmlRoot, route, "index.html");
|
|
80
|
+
const transform = new Transform({
|
|
81
|
+
transform(chunk, _encoding, callback) {
|
|
82
|
+
options.worker.postMessage({
|
|
83
|
+
type: "RSC_CHUNK",
|
|
84
|
+
id: route,
|
|
85
|
+
chunk,
|
|
86
|
+
moduleRootPath,
|
|
87
|
+
moduleBaseURL,
|
|
88
|
+
htmlOutputPath,
|
|
89
|
+
outDir: options.userConfig.build.outDir,
|
|
90
|
+
pipableStreamOptions: options.pipableStreamOptions ?? {}
|
|
91
|
+
});
|
|
92
|
+
callback(null, chunk);
|
|
93
|
+
},
|
|
94
|
+
flush(callback) {
|
|
95
|
+
options.worker.postMessage({
|
|
96
|
+
type: "RSC_END",
|
|
97
|
+
id: route
|
|
98
|
+
});
|
|
99
|
+
callback();
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
result.stream.pipe(transform);
|
|
103
|
+
} catch (error) {
|
|
104
|
+
failedRoutes.set(route, error);
|
|
105
|
+
}
|
|
106
|
+
});
|
|
107
|
+
await Promise.all([
|
|
108
|
+
Promise.all(renderPromises),
|
|
109
|
+
allRoutesComplete
|
|
110
|
+
]);
|
|
111
|
+
} finally {
|
|
112
|
+
await options.worker.terminate();
|
|
113
|
+
}
|
|
114
|
+
return {
|
|
115
|
+
failedRoutes,
|
|
116
|
+
completedRoutes
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
export { renderPages };
|
|
121
|
+
//# sourceMappingURL=renderPages.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"renderPages.js","sources":["../../../../plugin/worker/html/renderPages.ts"],"sourcesContent":["import { join, resolve as resolvePath } from \"node:path\";\nimport { Transform } from \"node:stream\";\nimport type { Worker } from \"node:worker_threads\";\nimport { createHandler } from \"../../react-server/createHandler.js\";\nimport type { ResolvedUserConfig, StreamPluginOptions } from \"../../types.js\";\nimport { mkdir, writeFile } from \"node:fs/promises\";\n\ninterface PipeableStreamOptions {\n bootstrapModules?: string[];\n bootstrapScripts?: string[];\n bootstrapScriptContent?: string;\n signal?: AbortSignal;\n identifierPrefix?: string;\n namespaceURI?: string;\n nonce?: string;\n progressiveChunkSize?: number;\n onShellReady?: () => void;\n onAllReady?: () => void;\n onError?: (error: unknown) => void;\n importMap?: {\n imports?: Record<string, string>;\n };\n}\n\ntype RenderPagesOptions = {\n pluginOptions: Required<\n Pick<\n StreamPluginOptions,\n \"moduleBase\" | \"moduleBasePath\" | \"moduleBaseURL\" | \"projectRoot\"\n >\n > &\n Pick<\n StreamPluginOptions,\n \"Page\" | \"props\" | \"build\" | \"Html\" | \"pageExportName\" | \"propsExportName\"\n >;\n userConfig: ResolvedUserConfig;\n manifest: Record<string, { file: string }>;\n worker: Worker;\n pipableStreamOptions?: PipeableStreamOptions;\n loader: (id: string) => Promise<Record<string, any>>;\n onCssFile?: (path: string) => void;\n clientCss?: string[];\n moduleBasePath: string;\n moduleBaseURL: string;\n};\n\nexport async function renderPages(\n routes: string[],\n options: RenderPagesOptions\n) {\n console.log(\"[renderPages] Starting render for routes:\", routes);\n\n const destinationRoot = resolvePath(options.userConfig.root, options.userConfig.build.outDir);\n const failedRoutes = new Map<string, Error>();\n const moduleRootPath = join(destinationRoot, options.moduleBasePath);\n const moduleBaseURL = options.moduleBaseURL;\n const htmlRoot = join(\n options.userConfig.root,\n options.pluginOptions.build?.client ?? options.userConfig.build.outDir.replace('server', 'client')\n );\n console.log(\"[renderPages] HTML root:\", htmlRoot);\n\n const streamStarted = new Set<string>();\n const completedRoutes = new Set<string>();\n const htmlContent = new Map<string, string>();\n const writePromises = new Map<string, Promise<void>>();\n\n // Create a promise that resolves when all routes are complete\n const allRoutesComplete = new Promise<void>((resolve, reject) => {\n const timeout = setTimeout(() => {\n reject(new Error(`Render timeout - Started: ${streamStarted.size}, Completed: ${completedRoutes.size}`));\n }, 5000);\n\n options.worker.on(\"message\", function messageHandler(msg: any) {\n switch (msg.type) {\n case \"SHELL_READY\": {\n streamStarted.add(msg.id);\n break;\n }\n case \"HTML_READY\": {\n htmlContent.set(msg.id, msg.html);\n break;\n }\n case \"ALL_READY\": {\n completedRoutes.add(msg.id);\n \n if (completedRoutes.size === routes.length) {\n options.worker.removeListener(\"message\", messageHandler);\n clearTimeout(timeout);\n \n // Write all HTML files\n for (const [route, html] of htmlContent) {\n const outputPath = route === '/' \n ? join(htmlRoot, 'index.html')\n : join(htmlRoot, route, 'index.html');\n \n const writePromise = writeFile(outputPath, html)\n .catch(error => {\n failedRoutes.set(route, error as Error);\n });\n writePromises.set(route, writePromise);\n }\n\n // Wait for all files to be written\n Promise.all(writePromises.values())\n .then(() => resolve())\n .catch(reject);\n }\n break;\n }\n case \"ERROR\": {\n console.error(\"[renderPages] Worker error:\", msg.error);\n if (msg.id) {\n failedRoutes.set(msg.id, new Error(msg.error));\n }\n break;\n }\n }\n });\n });\n\n try {\n await mkdir(htmlRoot, { recursive: true });\n\n const renderPromises = routes.map(async (route) => {\n console.log(\"[renderPages] Processing route:\", route);\n \n try {\n const result = await createHandler(route, options.pluginOptions, {\n loader: options.loader,\n manifest: options.manifest,\n });\n\n if (result.type !== \"success\") {\n console.log(\"[renderPages] Handler failed:\", result);\n return;\n }\n\n const htmlOutputPath = route === '/' \n ? resolvePath(htmlRoot, 'index.html')\n : resolvePath(htmlRoot, route, 'index.html');\n\n const transform = new Transform({\n transform(chunk, _encoding, callback) {\n options.worker.postMessage({\n type: \"RSC_CHUNK\",\n id: route,\n chunk: chunk,\n moduleRootPath: moduleRootPath,\n moduleBaseURL: moduleBaseURL,\n htmlOutputPath,\n outDir: options.userConfig.build.outDir,\n pipableStreamOptions: options.pipableStreamOptions ?? {},\n });\n callback(null, chunk);\n },\n flush(callback) {\n options.worker.postMessage({\n type: \"RSC_END\",\n id: route,\n });\n callback();\n }\n });\n \n result.stream.pipe(transform);\n\n } catch (error) {\n failedRoutes.set(route, error as Error);\n }\n });\n\n // Wait for both the render promises and all routes to complete\n await Promise.all([\n Promise.all(renderPromises),\n allRoutesComplete\n ]);\n\n } finally {\n await options.worker.terminate();\n }\n\n return {\n failedRoutes,\n completedRoutes\n };\n}\n"],"names":["resolvePath"],"mappings":";;;;;;;;;;AA8CsB,eAAA,WAAA,CACpB,QACA,OACA,EAAA;AACA,EAAQ,OAAA,CAAA,GAAA,CAAI,6CAA6C,MAAM,CAAA;AAE/D,EAAM,MAAA,eAAA,GAAkBA,QAAY,OAAQ,CAAA,UAAA,CAAW,MAAM,OAAQ,CAAA,UAAA,CAAW,MAAM,MAAM,CAAA;AAC5F,EAAM,MAAA,YAAA,uBAAmB,GAAmB,EAAA;AAC5C,EAAA,MAAM,cAAiB,GAAA,IAAA,CAAK,eAAiB,EAAA,OAAA,CAAQ,cAAc,CAAA;AACnE,EAAA,MAAM,gBAAgB,OAAQ,CAAA,aAAA;AAC9B,EAAA,MAAM,QAAW,GAAA,IAAA;AAAA,IACf,QAAQ,UAAW,CAAA,IAAA;AAAA,IACnB,OAAA,CAAQ,aAAc,CAAA,KAAA,EAAO,MAAU,IAAA,OAAA,CAAQ,WAAW,KAAM,CAAA,MAAA,CAAO,OAAQ,CAAA,QAAA,EAAU,QAAQ;AAAA,GACnG;AACA,EAAQ,OAAA,CAAA,GAAA,CAAI,4BAA4B,QAAQ,CAAA;AAEhD,EAAM,MAAA,aAAA,uBAAoB,GAAY,EAAA;AACtC,EAAM,MAAA,eAAA,uBAAsB,GAAY,EAAA;AACxC,EAAM,MAAA,WAAA,uBAAkB,GAAoB,EAAA;AAC5C,EAAM,MAAA,aAAA,uBAAoB,GAA2B,EAAA;AAGrD,EAAA,MAAM,iBAAoB,GAAA,IAAI,OAAc,CAA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@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loader.js","sources":["../../../plugin/worker/loader.ts"],"sourcesContent":["/**\n * Extension point for custom module loading in the worker thread.\n * This file can be overridden via the plugin options:\n *\n * ```ts\n * reactStreamPlugin({\n * loaderPath: './my-custom-loader.ts'\n * })\n * ```\n *\n * The default loader provides basic module loading functionality.\n * Override this if you need custom module resolution or transformation.\n */\nexport function load(id: string) {\n return import(id);\n}\n"],"names":[],"mappings":";;;;;AAaO,SAAS,KAAK,EAAY,EAAA;AAC/B,EAAA,OAAO,OAAO,EAAA,CAAA;AAChB;;;;"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { StreamPluginOptions } from "../types.js";
|
|
2
|
+
import type { Plugin } from "vite";
|
|
3
|
+
/**
|
|
4
|
+
* This plugin can be used to create your own worker paths. By default, prebuild workers are used.
|
|
5
|
+
*
|
|
6
|
+
* @param options
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export declare function reactWorkerPlugin(options: StreamPluginOptions): Plugin[];
|
|
10
|
+
//# sourceMappingURL=plugin.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.d.ts","sourceRoot":"","sources":["../../../plugin/worker/plugin.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AACtD,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,MAAM,CAAA;AAIlC;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,mBAAmB,GAAG,MAAM,EAAE,CAKxE"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { reactHtmlWorkerPlugin } from "./html/plugin.js";
|
|
2
|
+
import { reactRscWorkerPlugin } from "./rsc/plugin.js";
|
|
3
|
+
/**
|
|
4
|
+
* This plugin can be used to create your own worker paths. By default, prebuild workers are used.
|
|
5
|
+
*
|
|
6
|
+
* @param options
|
|
7
|
+
* @returns
|
|
8
|
+
*/
|
|
9
|
+
export function reactWorkerPlugin(options) {
|
|
10
|
+
return [
|
|
11
|
+
reactHtmlWorkerPlugin(options),
|
|
12
|
+
reactRscWorkerPlugin(options)
|
|
13
|
+
];
|
|
14
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import type { Writable } from "node:stream";
|
|
2
|
+
import type { MessagePort } from "node:worker_threads";
|
|
3
|
+
import type { RscRenderState } from "../types.js";
|
|
4
|
+
export declare function createRscStream(renderState: RscRenderState, writeStream: Writable, parentPort: MessagePort | null): any;
|
|
5
|
+
//# sourceMappingURL=createRscStream.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRscStream.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/rsc/createRscStream.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AAC5C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD,wBAAgB,eAAe,CAC7B,WAAW,EAAE,cAAc,EAC3B,WAAW,EAAE,QAAQ,EACrB,UAAU,EAAE,WAAW,GAAG,IAAI,OA+B/B"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
import { renderToPipeableStream } from 'react-server-dom-esm/server.node';
|
|
7
|
+
|
|
8
|
+
function createRscStream(renderState, writeStream, parentPort) {
|
|
9
|
+
console.log("[createRscStream] Creating stream for:", renderState.id);
|
|
10
|
+
const stream = renderToPipeableStream(renderState.componentImport, {
|
|
11
|
+
onShellReady() {
|
|
12
|
+
console.log("[createRscStream] onShellReady called for:", renderState.id);
|
|
13
|
+
stream.pipe(writeStream);
|
|
14
|
+
},
|
|
15
|
+
onAllReady() {
|
|
16
|
+
console.log("[createRscStream] onAllReady called for:", renderState.id);
|
|
17
|
+
writeStream.on("finish", () => {
|
|
18
|
+
parentPort?.postMessage({
|
|
19
|
+
type: "WROTE_FILE",
|
|
20
|
+
id: renderState.id,
|
|
21
|
+
outputPath: renderState.rscOutputPath
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
},
|
|
25
|
+
onError(error) {
|
|
26
|
+
console.error("[createRscStream] Render error:", error);
|
|
27
|
+
parentPort?.postMessage({
|
|
28
|
+
type: "ERROR",
|
|
29
|
+
error: error instanceof Error ? error.message : String(error),
|
|
30
|
+
id: renderState.id
|
|
31
|
+
});
|
|
32
|
+
stream.abort();
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
return stream;
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
export { createRscStream };
|
|
39
|
+
//# sourceMappingURL=createRscStream.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"createRscStream.js","sources":["../../../../plugin/worker/rsc/createRscStream.ts"],"sourcesContent":["import { renderToPipeableStream \n // @ts-ignore\n} from \"react-server-dom-esm/server.node\";\nimport type { Writable } from \"node:stream\";\nimport type { MessagePort } from \"node:worker_threads\";\nimport type { RscRenderState } from \"../types.js\";\n\nexport function createRscStream(\n renderState: RscRenderState,\n writeStream: Writable,\n parentPort: MessagePort | null\n) {\n console.log(\"[createRscStream] Creating stream for:\", renderState.id);\n\n const stream = renderToPipeableStream(renderState.componentImport, {\n onShellReady() {\n console.log(\"[createRscStream] onShellReady called for:\", renderState.id);\n stream.pipe(writeStream);\n },\n onAllReady() {\n console.log(\"[createRscStream] onAllReady called for:\", renderState.id);\n writeStream.on(\"finish\", () => {\n parentPort?.postMessage({\n type: \"WROTE_FILE\",\n id: renderState.id,\n outputPath: renderState.rscOutputPath\n });\n });\n },\n onError(error: unknown) {\n console.error(\"[createRscStream] Render error:\", error);\n parentPort?.postMessage({\n type: \"ERROR\",\n error: error instanceof Error ? error.message : String(error),\n id: renderState.id\n });\n stream.abort();\n }\n });\n\n return stream;\n}\n"],"names":[],"mappings":";;;;;;;AAOgB,SAAA,eAAA,CACd,WACA,EAAA,WAAA,EACA,UACA,EAAA;AACA,EAAQ,OAAA,CAAA,GAAA,CAAI,wCAA0C,EAAA,WAAA,CAAY,EAAE,CAAA;AAEpE,EAAM,MAAA,MAAA,GAAS,sBAAuB,CAAA,WAAA,CAAY,eAAiB,EAAA;AAAA,IACjE,YAAe,GAAA;AACb,MAAQ,OAAA,CAAA,GAAA,CAAI,4CAA8C,EAAA,WAAA,CAAY,EAAE,CAAA;AACxE,MAAA,MAAA,CAAO,KAAK,WAAW,CAAA;AAAA,KACzB;AAAA,IACA,UAAa,GAAA;AACX,MAAQ,OAAA,CAAA,GAAA,CAAI,0CAA4C,EAAA,WAAA,CAAY,EAAE,CAAA;AACtE,MAAY,WAAA,CAAA,EAAA,CAAG,UAAU,MAAM;AAC7B,QAAA,UAAA,EAAY,WAAY,CAAA;AAAA,UACtB,IAAM,EAAA,YAAA;AAAA,UACN,IAAI,WAAY,CAAA,EAAA;AAAA,UAChB,YAAY,WAAY,CAAA;AAAA,SACzB,CAAA;AAAA,OACF,CAAA;AAAA,KACH;AAAA,IACA,QAAQ,KAAgB,EAAA;AACtB,MAAQ,OAAA,CAAA,KAAA,CAAM,mCAAmC,KAAK,CAAA;AACtD,MAAA,UAAA,EAAY,WAAY,CAAA;AAAA,QACtB,IAAM,EAAA,OAAA;AAAA,QACN,OAAO,KAAiB,YAAA,KAAA,GAAQ,KAAM,CAAA,OAAA,GAAU,OAAO,KAAK,CAAA;AAAA,QAC5D,IAAI,WAAY,CAAA;AAAA,OACjB,CAAA;AACD,MAAA,MAAA,CAAO,KAAM,EAAA;AAAA;AACf,GACD,CAAA;AAED,EAAO,OAAA,MAAA;AACT;;;;"}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { createRscStream as devCreateRscStream } from './createRscStream.js';
|
|
2
|
+
import { createWorker as devCreateWorker } from '../createWorker.js';
|
|
3
|
+
export declare const createRscStream: typeof devCreateRscStream;
|
|
4
|
+
export declare const createWorker: typeof devCreateWorker;
|
|
5
|
+
//# sourceMappingURL=development.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"development.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/rsc/development.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,IAAI,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,YAAY,IAAI,eAAe,EAAE,MAAM,oBAAoB,CAAC;AAGrE,eAAO,MAAM,eAAe,2BAAqB,CAAC;AAClD,eAAO,MAAM,YAAY,wBAAkB,CAAC"}
|