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
package/dist/types.d.ts
CHANGED
|
@@ -1,202 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
export interface StreamPluginOptionsClient {
|
|
3
|
-
outDir?: string;
|
|
4
|
-
build?: BuildConfig;
|
|
5
|
-
assetsDir?: string;
|
|
6
|
-
projectRoot?: string;
|
|
7
|
-
moduleBase?: string;
|
|
8
|
-
moduleBasePath?: string;
|
|
9
|
-
moduleBaseURL?: string;
|
|
10
|
-
clientComponents?: AliasOptions;
|
|
11
|
-
cssFiles?: AliasOptions;
|
|
12
|
-
}
|
|
13
|
-
export type ResolvedUserOptions = Required<Pick<StreamPluginOptions, "moduleBase" | "moduleBasePath" | "moduleBaseURL" | "projectRoot" | "build" | "Page" | "props" | "Html" | "pageExportName" | "propsExportName" | "collectCss" | "collectAssets" | "assetsDir" | "workerPath" | "loaderPath" | "clientEntry" | "serverOutDir" | "clientOutDir" | "moduleBaseExceptions">> & {
|
|
14
|
-
build: NonNullable<Required<StreamPluginOptions["build"]>>;
|
|
15
|
-
autoDiscover: NonNullable<Required<StreamPluginOptions["autoDiscover"]>>;
|
|
16
|
-
};
|
|
17
|
-
export type ResolvedUserConfig = Required<Pick<UserConfig, "root" | "mode">> & Omit<UserConfig, "root" | "mode" | "build"> & {
|
|
18
|
-
build: Required<Pick<BuildOptions, "target" | "outDir" | "assetsDir" | "ssr" | "ssrEmitAssets" | "ssrManifest" | "manifest">> & Partial<Omit<BuildOptions, "target" | "outDir" | "assetsDir" | "ssr" | "ssrEmitAssets" | "ssrManifest" | "manifest">>;
|
|
19
|
-
};
|
|
20
|
-
export interface StreamPluginOptions {
|
|
21
|
-
projectRoot?: string;
|
|
22
|
-
assetsDir?: string;
|
|
23
|
-
moduleBase?: string;
|
|
24
|
-
moduleBasePath?: string;
|
|
25
|
-
moduleBaseURL?: string;
|
|
26
|
-
clientEntry?: string;
|
|
27
|
-
serverOutDir?: string;
|
|
28
|
-
clientOutDir?: string;
|
|
29
|
-
autoDiscover?: {
|
|
30
|
-
pagePattern?: string;
|
|
31
|
-
propsPattern?: string;
|
|
32
|
-
};
|
|
33
|
-
Page: string | ((url: string) => string);
|
|
34
|
-
props?: undefined | string | ((url: string) => string);
|
|
35
|
-
workerPath?: string;
|
|
36
|
-
loaderPath?: string;
|
|
37
|
-
pageExportName?: string;
|
|
38
|
-
propsExportName?: string;
|
|
39
|
-
Html?: React.FC<{
|
|
40
|
-
manifest: Manifest;
|
|
41
|
-
pageProps: any;
|
|
42
|
-
route: string;
|
|
43
|
-
url: string;
|
|
44
|
-
children: React.ReactNode;
|
|
45
|
-
}>;
|
|
46
|
-
collectCss?: boolean;
|
|
47
|
-
collectAssets?: boolean;
|
|
48
|
-
build?: BuildConfig;
|
|
49
|
-
moduleBaseExceptions?: string[];
|
|
50
|
-
}
|
|
51
|
-
export interface CreateHandlerOptions<T = any> {
|
|
52
|
-
loader: (id: string) => Promise<T>;
|
|
53
|
-
manifest?: Manifest;
|
|
54
|
-
moduleGraph?: ModuleGraph;
|
|
55
|
-
cssFiles?: string[];
|
|
56
|
-
onCssFile?: (path: string) => void;
|
|
57
|
-
logger?: Logger;
|
|
58
|
-
pipableStreamOptions?: any;
|
|
59
|
-
}
|
|
60
|
-
export type ModuleLoader = (url: string, context?: any, defaultLoad?: any) => Promise<Record<string, any>>;
|
|
61
|
-
export interface BaseProps {
|
|
62
|
-
manifest: Manifest;
|
|
63
|
-
children?: React.ReactNode;
|
|
64
|
-
assets?: {
|
|
65
|
-
css?: string[];
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
export type StreamResult = {
|
|
69
|
-
type: "success";
|
|
70
|
-
stream: any;
|
|
71
|
-
assets?: {
|
|
72
|
-
css?: string[];
|
|
73
|
-
};
|
|
74
|
-
} | {
|
|
75
|
-
type: "error";
|
|
76
|
-
error: unknown;
|
|
77
|
-
} | {
|
|
78
|
-
type: "skip";
|
|
79
|
-
};
|
|
80
|
-
export interface RscStreamOptions {
|
|
81
|
-
Page: React.ComponentType;
|
|
82
|
-
props: any;
|
|
83
|
-
Html: any;
|
|
84
|
-
logger?: Console | Logger;
|
|
85
|
-
cssFiles?: string[];
|
|
86
|
-
route: string;
|
|
87
|
-
url: string;
|
|
88
|
-
pipableStreamOptions?: any;
|
|
89
|
-
moduleBasePath: string;
|
|
90
|
-
}
|
|
91
|
-
export interface RouteConfig {
|
|
92
|
-
path: string;
|
|
93
|
-
pattern?: {
|
|
94
|
-
page?: string;
|
|
95
|
-
props?: string;
|
|
96
|
-
};
|
|
97
|
-
paths?: {
|
|
98
|
-
page: string;
|
|
99
|
-
props: string;
|
|
100
|
-
};
|
|
101
|
-
}
|
|
102
|
-
export interface BuildOutput {
|
|
103
|
-
dir?: string;
|
|
104
|
-
rsc?: string;
|
|
105
|
-
ext?: string;
|
|
106
|
-
}
|
|
107
|
-
export interface BuildConfig {
|
|
108
|
-
pages: string[] | (() => Promise<string[]> | string[]);
|
|
109
|
-
client?: string;
|
|
110
|
-
server?: string;
|
|
111
|
-
}
|
|
112
|
-
export interface RscResolver {
|
|
113
|
-
/**
|
|
114
|
-
* Get RSC data for static generation
|
|
115
|
-
* @param path - Route path (e.g. "/", "/about")
|
|
116
|
-
*/
|
|
117
|
-
getRscData: (path: string) => Promise<{
|
|
118
|
-
Page: React.ComponentType;
|
|
119
|
-
props: any;
|
|
120
|
-
}>;
|
|
121
|
-
}
|
|
122
|
-
export interface Options {
|
|
123
|
-
include?: RegExp;
|
|
124
|
-
projectRoot?: string;
|
|
125
|
-
moduleBase: string;
|
|
126
|
-
moduleBasePath?: string;
|
|
127
|
-
Html?: React.ComponentType<React.PropsWithChildren<{
|
|
128
|
-
manifest: Manifest;
|
|
129
|
-
}>>;
|
|
130
|
-
Page: string | ((url: string) => string);
|
|
131
|
-
props?: string | ((url: string) => string);
|
|
132
|
-
pageExportName?: string;
|
|
133
|
-
propsExportName?: string;
|
|
134
|
-
collectCss?: boolean;
|
|
135
|
-
collectAssets?: boolean;
|
|
136
|
-
emitCss?: boolean;
|
|
137
|
-
moduleLoader?: (server: ViteDevServer) => ModuleLoader;
|
|
138
|
-
build?: BuildConfig;
|
|
139
|
-
outDir?: string;
|
|
140
|
-
/**
|
|
141
|
-
* Configure static asset copying
|
|
142
|
-
* - true: Copy all assets
|
|
143
|
-
* - false: Don't copy assets
|
|
144
|
-
* - Function: Custom filter for which files to copy
|
|
145
|
-
*/
|
|
146
|
-
copyAssets?: boolean | ((file: string) => boolean);
|
|
147
|
-
}
|
|
148
|
-
export type RequestHandler = Connect.NextHandleFunction;
|
|
149
|
-
export interface SsrStreamOptions {
|
|
150
|
-
url: string;
|
|
151
|
-
controller: AbortController;
|
|
152
|
-
loader: (id: string) => Promise<any>;
|
|
153
|
-
Html: any;
|
|
154
|
-
options: StreamPluginOptions;
|
|
155
|
-
pageExportName: string;
|
|
156
|
-
propsExportName: string;
|
|
157
|
-
moduleGraph: any;
|
|
158
|
-
bootstrapModules?: string[];
|
|
159
|
-
importMap?: Record<string, string[]>;
|
|
160
|
-
clientComponents?: boolean;
|
|
161
|
-
onlyClientComponents?: boolean;
|
|
162
|
-
}
|
|
163
|
-
export type RscServerConfig = {
|
|
164
|
-
/** How to get RSC data (e.g. HTTP, direct import, etc) */
|
|
165
|
-
getRscComponent: (url: string) => React.Usable<React.ReactNode>;
|
|
166
|
-
/** Base URL for client assets */
|
|
167
|
-
clientBase?: string;
|
|
168
|
-
/** SSR stream rendering options */
|
|
169
|
-
ssrOptions?: SsrStreamOptions;
|
|
170
|
-
};
|
|
171
|
-
export interface RscServerModule {
|
|
172
|
-
/**
|
|
173
|
-
* Get RSC data for a route
|
|
174
|
-
* @param path - Route path (e.g. "/", "/about")
|
|
175
|
-
* @returns Page component and props
|
|
176
|
-
*/
|
|
177
|
-
getRscData: (path: string) => Promise<{
|
|
178
|
-
/** Page component to render */
|
|
179
|
-
Page: React.ComponentType;
|
|
180
|
-
/** Props to pass to the page */
|
|
181
|
-
props: any;
|
|
182
|
-
}>;
|
|
183
|
-
}
|
|
184
|
-
export interface RegisterComponentMessage {
|
|
185
|
-
type: "REGISTER_COMPONENT";
|
|
186
|
-
id: string;
|
|
187
|
-
code: string;
|
|
188
|
-
}
|
|
189
|
-
export type RscBuildResult = string[];
|
|
190
|
-
export interface ReactStreamPluginMeta {
|
|
191
|
-
timing: BuildTiming;
|
|
192
|
-
}
|
|
193
|
-
export interface BuildTiming {
|
|
194
|
-
start: number;
|
|
195
|
-
configResolved?: number;
|
|
196
|
-
buildStart?: number;
|
|
197
|
-
buildEnd?: number;
|
|
198
|
-
renderStart?: number;
|
|
199
|
-
renderEnd?: number;
|
|
200
|
-
total?: number;
|
|
201
|
-
}
|
|
1
|
+
export type * from './plugin/types.js';
|
|
202
2
|
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../
|
|
1
|
+
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../types.ts"],"names":[],"mappings":"AACA,mBAAmB,mBAAmB,CAAC"}
|
package/dist/types.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,37 +1,47 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vite-plugin-react-server",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.5",
|
|
4
4
|
"description": "Vite plugin for React Server Components (RSC)",
|
|
5
5
|
"type": "module",
|
|
6
|
-
"main": "./dist/index.js",
|
|
7
|
-
"module": "./dist/index.js",
|
|
8
|
-
"types": "./dist/index.d.ts",
|
|
6
|
+
"main": "./dist/plugin/index.js",
|
|
7
|
+
"module": "./dist/plugin/index.js",
|
|
8
|
+
"types": "./dist/plugin/index.d.ts",
|
|
9
9
|
"files": [
|
|
10
10
|
"dist",
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"plugin",
|
|
12
|
+
"bin",
|
|
13
|
+
"scripts",
|
|
13
14
|
"README.md",
|
|
14
15
|
"LICENSE",
|
|
15
16
|
"tsconfig.json"
|
|
16
17
|
],
|
|
17
18
|
"exports": {
|
|
18
|
-
".": "./dist/index.js",
|
|
19
|
+
".": "./dist/plugin/index.js",
|
|
19
20
|
"./client": "./dist/client.js",
|
|
20
21
|
"./server": "./dist/server.js",
|
|
21
|
-
"./worker": "./dist/worker/worker.js",
|
|
22
|
-
"./
|
|
23
|
-
"./
|
|
22
|
+
"./html-worker": "./dist/plugin/worker/html-worker.js",
|
|
23
|
+
"./rsc-worker": "./dist/plugin/worker/rsc-worker.js",
|
|
24
|
+
"./loader": "./dist/plugin/worker/loader.js",
|
|
25
|
+
"./package.json": "./package.json",
|
|
26
|
+
"./patch": "./scripts/patch.mjs",
|
|
27
|
+
"./check-react-version": "./scripts/check-react-version.mjs"
|
|
24
28
|
},
|
|
25
29
|
"typesVersions": {
|
|
26
30
|
"*": {
|
|
27
31
|
".": [
|
|
28
|
-
"./dist/index.d.ts"
|
|
32
|
+
"./dist/plugin/index.d.ts"
|
|
29
33
|
],
|
|
30
34
|
"client": [
|
|
31
|
-
"./dist/react-client/plugin.d.ts"
|
|
35
|
+
"./dist/plugin/react-client/plugin.d.ts"
|
|
32
36
|
],
|
|
33
37
|
"server": [
|
|
34
|
-
"./dist/react-server/plugin.d.ts"
|
|
38
|
+
"./dist/plugin/react-server/plugin.d.ts"
|
|
39
|
+
],
|
|
40
|
+
"worker": [
|
|
41
|
+
"./dist/plugin/worker/worker.d.ts"
|
|
42
|
+
],
|
|
43
|
+
"loader": [
|
|
44
|
+
"./dist/plugin/worker/loader.d.ts"
|
|
35
45
|
]
|
|
36
46
|
}
|
|
37
47
|
},
|
|
@@ -42,20 +52,23 @@
|
|
|
42
52
|
"version:patch": "node scripts/bump-version.mjs patch",
|
|
43
53
|
"build": "npm run clean && npm run build:types && npm run build:vite",
|
|
44
54
|
"build:types": "tsc --build --force",
|
|
45
|
-
"build:vite": "vite build && chmod +x
|
|
55
|
+
"build:vite": "vite build && chmod +x bin/patch.mjs",
|
|
46
56
|
"clean": "rm -rf dist",
|
|
47
57
|
"prepublishOnly": "npm run build",
|
|
48
58
|
"lint": "eslint ./src --fix",
|
|
49
59
|
"test:server": "NODE_OPTIONS='--conditions react-server' vitest run",
|
|
50
60
|
"test:client": "vitest run",
|
|
51
|
-
"test": "npm run test:client && npm run test:server",
|
|
61
|
+
"test": "npm run build && npm run test:client && NODE_ENV=development npm run test:server",
|
|
52
62
|
"test:coverage": "vitest run --coverage",
|
|
53
63
|
"test:ui": "vitest --ui",
|
|
54
|
-
"experimental:copy": "cp -r ./oss-experimental
|
|
55
|
-
"experimental:patch": "npx patch-package react-server-dom-esm --exclude 'nothing'",
|
|
56
|
-
"experimental:
|
|
64
|
+
"experimental:copy": "cp -r ./oss-experimental/* ./node_modules/",
|
|
65
|
+
"experimental:patch": "npx patch-package react-server-dom-esm --exclude 'nothing' && npx patch-package react react-dom",
|
|
66
|
+
"experimental:move-patches": "mv patches/* ./scripts/",
|
|
67
|
+
"experimental:setup": "rm -rf patches/* && npm install react-server-dom-esm react@canary react-dom@canary && npm run experimental:copy && npm run experimental:patch && npm run experimental:move-patches && node scripts/check-react-version.mjs",
|
|
57
68
|
"experimental:check": "node scripts/check-react-version.mjs",
|
|
58
|
-
"postinstall": "npm
|
|
69
|
+
"postinstall": "npm install react-server-dom-esm && node scripts/check-react-version.mjs && patch-package",
|
|
70
|
+
"start": "cd template; NODE_OPTIONS='--conditions react-server' npx vite",
|
|
71
|
+
"template:build": "cd template && NODE_OPTIONS='--conditions react-server' npx vite build"
|
|
59
72
|
},
|
|
60
73
|
"keywords": [
|
|
61
74
|
"vite",
|
|
@@ -84,10 +97,13 @@
|
|
|
84
97
|
},
|
|
85
98
|
"peerDependenciesMeta": {
|
|
86
99
|
"react": {
|
|
87
|
-
"optional":
|
|
100
|
+
"optional": false
|
|
88
101
|
},
|
|
89
102
|
"react-dom": {
|
|
90
|
-
"optional":
|
|
103
|
+
"optional": false
|
|
104
|
+
},
|
|
105
|
+
"vite": {
|
|
106
|
+
"optional": false
|
|
91
107
|
}
|
|
92
108
|
},
|
|
93
109
|
"devDependencies": {
|
|
@@ -96,17 +112,20 @@
|
|
|
96
112
|
"@types/react-dom": "^19.0.3",
|
|
97
113
|
"acorn-loose": "^8.3.0",
|
|
98
114
|
"patch-package": "^8.0.0",
|
|
99
|
-
"react": "^19.1.0-canary-
|
|
100
|
-
"react-dom": "^19.1.0-canary-
|
|
115
|
+
"react": "^19.1.0-canary-8759c5c8-20250207",
|
|
116
|
+
"react-dom": "^19.1.0-canary-8759c5c8-20250207",
|
|
101
117
|
"react-server-dom-esm": "^0.0.1",
|
|
118
|
+
"rollup": "^4.34.0",
|
|
119
|
+
"rollup-plugin-dts": "^6.1.1",
|
|
102
120
|
"source-map": "^0.7.4",
|
|
103
121
|
"ts-node": "^10.9.2",
|
|
122
|
+
"tslib": "^2.8.1",
|
|
104
123
|
"typescript": "^5.7.3",
|
|
105
|
-
"vite": "^
|
|
124
|
+
"vite": "^6.0.11",
|
|
106
125
|
"vitest": "^3.0.4",
|
|
107
126
|
"webpack-sources": "^3.2.0"
|
|
108
127
|
},
|
|
109
128
|
"bin": {
|
|
110
|
-
"vite-react-
|
|
129
|
+
"vite-plugin-react-server-patch": "./dist/scripts/check-react-version.mjs"
|
|
111
130
|
}
|
|
112
131
|
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { mergeInputsAsync } from "./mergeInputs.js";
|
|
2
|
+
import type { createBuildConfigFn } from "../types.js";
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
export const createClientBuildConfig: createBuildConfigFn<'react-client'> = async ({
|
|
6
|
+
userConfig,
|
|
7
|
+
inputNormalizer
|
|
8
|
+
}) => {
|
|
9
|
+
const { input: inputConfig, ...restRollupOptions } = userConfig.build.rollupOptions ?? {};
|
|
10
|
+
|
|
11
|
+
return {
|
|
12
|
+
...userConfig,
|
|
13
|
+
build: {
|
|
14
|
+
...userConfig.build,
|
|
15
|
+
rollupOptions: {
|
|
16
|
+
...restRollupOptions,
|
|
17
|
+
input: await mergeInputsAsync({}, inputConfig, inputNormalizer),
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
};
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import type { ResolvedUserConfig, ResolvedUserOptions } from "../types.js";
|
|
3
|
+
import type { UserConfig } from "vite";
|
|
4
|
+
|
|
5
|
+
interface CreateServerBuildConfigProps {
|
|
6
|
+
condition: string;
|
|
7
|
+
userConfig: ResolvedUserConfig;
|
|
8
|
+
userOptions: ResolvedUserOptions;
|
|
9
|
+
mode: string;
|
|
10
|
+
inputNormalizer: any;
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
export async function createServerBuildConfig({
|
|
14
|
+
userConfig,
|
|
15
|
+
userOptions,
|
|
16
|
+
mode,
|
|
17
|
+
}: CreateServerBuildConfigProps): Promise<UserConfig> {
|
|
18
|
+
const { build, appType, mode: configMode, ...restUserConfig } = userConfig;
|
|
19
|
+
const { outDir, ssr, target, assetsDir, manifest, ssrManifest, ssrEmitAssets, rollupOptions, ...restBuildOptions } = build ?? {};
|
|
20
|
+
const { input, output, ...restRollupOptions } = rollupOptions ?? {};
|
|
21
|
+
const {
|
|
22
|
+
format,
|
|
23
|
+
preserveModules,
|
|
24
|
+
hoistTransitiveImports,
|
|
25
|
+
esModule,
|
|
26
|
+
entryFileNames,
|
|
27
|
+
chunkFileNames,
|
|
28
|
+
assetFileNames,
|
|
29
|
+
...restOutputOptions
|
|
30
|
+
} = output && !Array.isArray(output) ? output : {};
|
|
31
|
+
|
|
32
|
+
const resolvedBuildConfig = {
|
|
33
|
+
build: {
|
|
34
|
+
ssr: ssr ?? true,
|
|
35
|
+
target: target ?? 'es2020',
|
|
36
|
+
outDir: outDir ?? userOptions.build.server,
|
|
37
|
+
assetsDir: assetsDir ?? '',
|
|
38
|
+
manifest: manifest ?? true,
|
|
39
|
+
ssrManifest: ssrManifest ?? true,
|
|
40
|
+
ssrEmitAssets: ssrEmitAssets ?? true,
|
|
41
|
+
rollupOptions: {
|
|
42
|
+
input: {
|
|
43
|
+
'client': join(userOptions.projectRoot, userOptions.clientEntry)
|
|
44
|
+
},
|
|
45
|
+
output: {
|
|
46
|
+
format: format ?? 'esm',
|
|
47
|
+
preserveModules: preserveModules ?? true,
|
|
48
|
+
hoistTransitiveImports: hoistTransitiveImports ?? false,
|
|
49
|
+
esModule: esModule ?? true,
|
|
50
|
+
entryFileNames: entryFileNames ?? '[name].js',
|
|
51
|
+
chunkFileNames: chunkFileNames ?? '[name].js',
|
|
52
|
+
assetFileNames: assetFileNames ?? '[name][extname]',
|
|
53
|
+
...restOutputOptions
|
|
54
|
+
},
|
|
55
|
+
...restRollupOptions
|
|
56
|
+
},
|
|
57
|
+
...restBuildOptions
|
|
58
|
+
},
|
|
59
|
+
appType: appType ?? 'mpa',
|
|
60
|
+
mode: mode ?? 'production',
|
|
61
|
+
...restUserConfig
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
console.log('resolvedBuildConfig', resolvedBuildConfig);
|
|
65
|
+
return resolvedBuildConfig;
|
|
66
|
+
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { InputOption } from "rollup";
|
|
2
|
+
import type { UserConfig } from "vite";
|
|
3
|
+
|
|
4
|
+
export function validateModuleBase(
|
|
5
|
+
input: InputOption,
|
|
6
|
+
moduleBase: string,
|
|
7
|
+
moduleBaseExceptions: string[]
|
|
8
|
+
) {
|
|
9
|
+
for (const [key, value] of Object.entries(input)) {
|
|
10
|
+
const isException = moduleBaseExceptions.includes(key) || ["/index", "index"].includes(key);
|
|
11
|
+
if (!key.includes("/")) return;
|
|
12
|
+
if (value.startsWith("//")) {
|
|
13
|
+
throw new Error(`Path shouldn't start with //`);
|
|
14
|
+
}
|
|
15
|
+
if (!key.startsWith(moduleBase) && !isException) {
|
|
16
|
+
throw new Error(`Invalid input: ${key} does not start with ${moduleBase}`);
|
|
17
|
+
}
|
|
18
|
+
if (!value.startsWith("/" + moduleBase) && !isException) {
|
|
19
|
+
throw new Error(`Invalid value: ${value} does not start with ${moduleBase}`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export function createSharedBuildConfig(config: UserConfig, rollupOptions: any): UserConfig {
|
|
25
|
+
return {
|
|
26
|
+
...config,
|
|
27
|
+
build: {
|
|
28
|
+
...config.build,
|
|
29
|
+
rollupOptions: {
|
|
30
|
+
...config.build?.rollupOptions,
|
|
31
|
+
...rollupOptions
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
};
|
|
35
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import type { InputOption } from "rollup";
|
|
2
|
+
import type { InputNormalizer, InputNormalizerWorker } from "../types.js";
|
|
3
|
+
|
|
4
|
+
export const mergeInputsAsync = async (
|
|
5
|
+
input: { [key: string]: string },
|
|
6
|
+
input2: InputOption | undefined,
|
|
7
|
+
inputNormalizer: InputNormalizerWorker
|
|
8
|
+
): Promise<Record<string, string>> => {
|
|
9
|
+
if(typeof input === "undefined"){
|
|
10
|
+
throw new Error("The first input can not be undefined");
|
|
11
|
+
} else if(typeof input2 === "undefined") {
|
|
12
|
+
return input;
|
|
13
|
+
} else if(Array.isArray(input2)) {
|
|
14
|
+
const inputsFromArray = Object.fromEntries(await Promise.all(input2.map(async (input)=>inputNormalizer(input))))
|
|
15
|
+
return {
|
|
16
|
+
...input,
|
|
17
|
+
...inputsFromArray,
|
|
18
|
+
}
|
|
19
|
+
} else if(typeof input2 === "object" && input2 != null) {
|
|
20
|
+
return { ...input, ...input2 };
|
|
21
|
+
} else if (typeof input2 === "string") {
|
|
22
|
+
const [key, value] = await inputNormalizer(input2)
|
|
23
|
+
return {
|
|
24
|
+
...input,
|
|
25
|
+
[key]: value,
|
|
26
|
+
}
|
|
27
|
+
} else {
|
|
28
|
+
throw new Error(`Invalid input: ${input2}`);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export const mergeInputs = (
|
|
33
|
+
input: { [key: string]: string },
|
|
34
|
+
input2: InputOption | undefined,
|
|
35
|
+
inputNormalizer: InputNormalizer
|
|
36
|
+
): Record<string, string> => {
|
|
37
|
+
if(typeof input === "undefined"){
|
|
38
|
+
throw new Error("The first input can not be undefined");
|
|
39
|
+
} else if(typeof input2 === "undefined") {
|
|
40
|
+
return input;
|
|
41
|
+
} else if(Array.isArray(input2)) {
|
|
42
|
+
const inputsFromArray = Object.fromEntries(input2.map(inputNormalizer))
|
|
43
|
+
return {
|
|
44
|
+
...input,
|
|
45
|
+
...inputsFromArray,
|
|
46
|
+
}
|
|
47
|
+
} else if(typeof input2 === "object" && input2 != null) {
|
|
48
|
+
return { ...input, ...input2 };
|
|
49
|
+
} else if (typeof input2 === "string") {
|
|
50
|
+
const [key, value] = inputNormalizer(input2)
|
|
51
|
+
return {
|
|
52
|
+
...input,
|
|
53
|
+
[key]: value,
|
|
54
|
+
}
|
|
55
|
+
} else {
|
|
56
|
+
throw new Error(`Invalid input: ${input2}`);
|
|
57
|
+
}
|
|
58
|
+
};
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { existsSync } from "node:fs";
|
|
2
|
+
import { resolve, relative } from "node:path";
|
|
3
|
+
import type { CheckFilesExistReturn, StreamPluginOptions } from "./types.js";
|
|
4
|
+
import { DEFAULT_CONFIG } from "./config/defaults.js";
|
|
5
|
+
|
|
6
|
+
export async function checkFilesExist(
|
|
7
|
+
pages: string[],
|
|
8
|
+
options: Pick<StreamPluginOptions, "Page" | "props">,
|
|
9
|
+
root: string
|
|
10
|
+
): Promise<CheckFilesExistReturn> {
|
|
11
|
+
const errors: string[] = [];
|
|
12
|
+
const pageSet = new Set<string>();
|
|
13
|
+
const pageMap = new Map<string, string>();
|
|
14
|
+
|
|
15
|
+
const toKey = (path: string) => {
|
|
16
|
+
return relative(root, resolve(root, path))
|
|
17
|
+
.replace(/\\/g, '/')
|
|
18
|
+
.replace(DEFAULT_CONFIG.FILE_REGEX, '')
|
|
19
|
+
.replace(/^\.\//, '');
|
|
20
|
+
}
|
|
21
|
+
// Check if files exist when string paths are provided
|
|
22
|
+
if (typeof options.Page === "string") {
|
|
23
|
+
const pagePath = options.Page;
|
|
24
|
+
const fullPagePath = resolve(root, pagePath);
|
|
25
|
+
const key = toKey(pagePath);
|
|
26
|
+
pageMap.set(key, pagePath);
|
|
27
|
+
if (!pageSet.has(key)) {
|
|
28
|
+
if (!existsSync(fullPagePath)) {
|
|
29
|
+
errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);
|
|
30
|
+
}
|
|
31
|
+
pageSet.add(pagePath.replace(/^\//, ''));
|
|
32
|
+
}
|
|
33
|
+
} else if (typeof options.Page === "function" && pages) {
|
|
34
|
+
for (const page of pages) {
|
|
35
|
+
const pagePath = options.Page(page);
|
|
36
|
+
const fullPagePath = resolve(root, pagePath);
|
|
37
|
+
const key = toKey(pagePath);
|
|
38
|
+
pageMap.set(key, pagePath);
|
|
39
|
+
if (pageSet.has(key)) {
|
|
40
|
+
continue;
|
|
41
|
+
}
|
|
42
|
+
if (!existsSync(fullPagePath)) {
|
|
43
|
+
errors.push(`Page file not found: ${pagePath}, ${fullPagePath}`);
|
|
44
|
+
}
|
|
45
|
+
pageSet.add(pagePath);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
const propsSet = new Set<string>();
|
|
50
|
+
const propsMap = new Map<string, string>();
|
|
51
|
+
if (typeof options.props === "string") {
|
|
52
|
+
const propsPath = options.props;
|
|
53
|
+
const fullPropsPath = resolve(root, propsPath);
|
|
54
|
+
const key = toKey(propsPath);
|
|
55
|
+
propsMap.set(key, propsPath);
|
|
56
|
+
if (!propsSet.has(key)) {
|
|
57
|
+
if (!existsSync(fullPropsPath)) {
|
|
58
|
+
errors.push(`Props file not found: ${propsPath}, ${fullPropsPath}`);
|
|
59
|
+
}
|
|
60
|
+
propsSet.add(propsPath);
|
|
61
|
+
}
|
|
62
|
+
} else if (typeof options.props === "function" && pages) {
|
|
63
|
+
for (const page of pages) {
|
|
64
|
+
const propsPath = options.props(page);
|
|
65
|
+
const fullPropsPath = resolve(root, propsPath);
|
|
66
|
+
const key = toKey(propsPath);
|
|
67
|
+
propsMap.set(key, propsPath);
|
|
68
|
+
if (propsSet.has(key)) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (!existsSync(fullPropsPath)) {
|
|
72
|
+
errors.push(`Props file not found: ${propsPath}, ${fullPropsPath}`);
|
|
73
|
+
}
|
|
74
|
+
propsSet.add(propsPath);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
if (errors.length) {
|
|
79
|
+
console.warn("React Stream Plugin Validation:\n" + errors.join("\n"));
|
|
80
|
+
}
|
|
81
|
+
return { pageMap, pageSet, propsMap, propsSet };
|
|
82
|
+
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import type { Manifest, ModuleGraph } from
|
|
1
|
+
import type { Manifest, ModuleGraph } from 'vite';
|
|
2
2
|
|
|
3
3
|
export async function collectModuleGraphCss(
|
|
4
4
|
moduleGraph: ModuleGraph,
|
|
5
|
-
pagePath: string
|
|
5
|
+
pagePath: string,
|
|
6
|
+
onCss?: (path: string) => void
|
|
6
7
|
) {
|
|
7
8
|
if (!pagePath) return new Map<string, string>();
|
|
8
9
|
|
|
@@ -17,6 +18,7 @@ export async function collectModuleGraphCss(
|
|
|
17
18
|
seen.add(mod.id);
|
|
18
19
|
if (mod?.id?.endsWith(".css")) {
|
|
19
20
|
cssFiles.set(mod?.url, mod?.id);
|
|
21
|
+
onCss?.(mod?.url);
|
|
20
22
|
}
|
|
21
23
|
mod?.importedModules?.forEach((imp: any) => walkModule(imp));
|
|
22
24
|
};
|