vite-plugin-react-server 1.0.2 → 1.1.0
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 +49 -76
- package/bin/patch.mjs +27 -20
- package/dist/_virtual/dynamic-import-helper.js +24 -0
- package/dist/_virtual/dynamic-import-helper.js.map +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -26
- package/dist/index.js.map +1 -1
- package/dist/package.json +24 -14
- package/dist/plugin/components.d.ts +1 -1
- package/dist/plugin/components.d.ts.map +1 -1
- package/dist/plugin/components.js +1 -1
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.d.ts +6 -0
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.d.ts.map +1 -0
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js +30 -0
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js.map +1 -0
- package/dist/plugin/config/autoDiscover/customWorkerFiles.d.ts +13 -0
- package/dist/plugin/config/autoDiscover/customWorkerFiles.d.ts.map +1 -0
- package/dist/plugin/config/autoDiscover/customWorkerFiles.js +24 -0
- package/dist/plugin/config/autoDiscover/customWorkerFiles.js.map +1 -0
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.d.ts +11 -0
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.d.ts.map +1 -0
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js +29 -0
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js.map +1 -0
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts +6 -0
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts.map +1 -0
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js +83 -0
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js.map +1 -0
- package/dist/plugin/config/defaults.d.ts +18 -14
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +42 -21
- package/dist/plugin/config/defaults.js.map +1 -1
- package/dist/plugin/config/getCondition.d.ts +1 -1
- package/dist/plugin/config/getCondition.d.ts.map +1 -1
- package/dist/plugin/config/getCondition.js +2 -2
- package/dist/plugin/config/getCondition.js.map +1 -1
- package/dist/plugin/config/getPaths.d.ts +0 -1
- package/dist/plugin/config/getPaths.d.ts.map +1 -1
- package/dist/plugin/config/getPaths.js.map +1 -1
- package/dist/plugin/config/index.d.ts +0 -1
- package/dist/plugin/config/index.d.ts.map +1 -1
- package/dist/plugin/config/index.js +0 -1
- package/dist/plugin/config/resolveAutoDiscover.d.ts +20 -0
- package/dist/plugin/config/resolveAutoDiscover.d.ts.map +1 -0
- package/dist/plugin/config/resolveAutoDiscover.js +128 -0
- package/dist/plugin/config/resolveAutoDiscover.js.map +1 -0
- package/dist/plugin/config/resolveOptions.d.ts +1 -1
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +109 -77
- package/dist/plugin/config/resolveOptions.js.map +1 -1
- package/dist/plugin/config/resolvePages.d.ts +0 -1
- package/dist/plugin/config/resolvePages.d.ts.map +1 -1
- package/dist/plugin/config/resolvePages.js +6 -8
- package/dist/plugin/config/resolvePages.js.map +1 -1
- package/dist/plugin/config/resolveUrlOption.d.ts +16 -0
- package/dist/plugin/config/resolveUrlOption.d.ts.map +1 -0
- package/dist/plugin/config/resolveUrlOption.js +37 -0
- package/dist/plugin/config/resolveUrlOption.js.map +1 -0
- package/dist/plugin/config/resolveUserConfig.d.ts +4 -5
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +80 -132
- package/dist/plugin/config/resolveUserConfig.js.map +1 -1
- package/dist/plugin/copy.d.ts +7 -0
- package/dist/plugin/copy.d.ts.map +1 -0
- package/dist/plugin/copy.js +30 -0
- package/dist/plugin/css-collector-elements.d.ts +4 -0
- package/dist/plugin/css-collector-elements.d.ts.map +1 -0
- package/dist/plugin/css-collector-elements.js +19 -0
- package/dist/plugin/css-collector-elements.js.map +1 -0
- package/dist/plugin/css-collector.d.ts +2 -8
- package/dist/plugin/css-collector.d.ts.map +1 -1
- package/dist/plugin/css-collector.js +9 -36
- package/dist/plugin/css-collector.js.map +1 -1
- package/dist/plugin/helpers/cleanObject.d.ts +3 -0
- package/dist/plugin/helpers/cleanObject.d.ts.map +1 -0
- package/dist/plugin/helpers/cleanObject.js +47 -0
- package/dist/plugin/helpers/cleanObject.js.map +1 -0
- package/dist/plugin/helpers/collectBundleManifestCss.d.ts +8 -0
- package/dist/plugin/helpers/collectBundleManifestCss.d.ts.map +1 -0
- package/dist/plugin/helpers/collectBundleManifestCss.js +110 -0
- package/dist/plugin/helpers/collectManifestCss.d.ts +7 -0
- package/dist/plugin/helpers/collectManifestCss.d.ts.map +1 -0
- package/dist/plugin/helpers/collectManifestCss.js +44 -0
- package/dist/plugin/helpers/collectManifestCss.js.map +1 -0
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts +31 -0
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts.map +1 -0
- package/dist/plugin/helpers/collectViteModuleGraphCss.js +104 -0
- package/dist/plugin/helpers/collectViteModuleGraphCss.js.map +1 -0
- package/dist/plugin/helpers/createCssProps.d.ts +25 -0
- package/dist/plugin/helpers/createCssProps.d.ts.map +1 -0
- package/dist/plugin/helpers/createCssProps.js +57 -0
- package/dist/plugin/helpers/createCssProps.js.map +1 -0
- package/dist/plugin/helpers/createEventHandler.d.ts +22 -0
- package/dist/plugin/helpers/createEventHandler.d.ts.map +1 -0
- package/dist/plugin/helpers/createEventHandler.js +36 -0
- package/dist/plugin/helpers/createEventHandler.js.map +1 -0
- package/dist/plugin/helpers/createHandler.d.ts +7 -13
- package/dist/plugin/helpers/createHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createHandler.js +54 -96
- package/dist/plugin/helpers/createHandler.js.map +1 -1
- package/dist/plugin/helpers/createRscStream.d.ts +12 -26
- package/dist/plugin/helpers/createRscStream.d.ts.map +1 -1
- package/dist/plugin/helpers/createRscStream.js +105 -51
- package/dist/plugin/helpers/createRscStream.js.map +1 -1
- package/dist/plugin/helpers/defaultFileWriter.d.ts +2 -0
- package/dist/plugin/helpers/defaultFileWriter.d.ts.map +1 -0
- package/dist/plugin/helpers/defaultFileWriter.js +1 -0
- package/dist/plugin/helpers/getBundleManifest.d.ts +10 -16
- package/dist/plugin/helpers/getBundleManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/getBundleManifest.js +30 -22
- package/dist/plugin/helpers/getBundleManifest.js.map +1 -1
- package/dist/plugin/helpers/getRouteFiles.d.ts +14 -0
- package/dist/plugin/helpers/getRouteFiles.d.ts.map +1 -0
- package/dist/plugin/helpers/getRouteFiles.js +36 -0
- package/dist/plugin/helpers/getRouteFiles.js.map +1 -0
- package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -1
- package/dist/plugin/helpers/inputNormalizer.js +38 -32
- package/dist/plugin/helpers/inputNormalizer.js.map +1 -1
- package/dist/plugin/helpers/metrics.d.ts +11 -0
- package/dist/plugin/helpers/metrics.d.ts.map +1 -0
- package/dist/plugin/helpers/metrics.js +35 -0
- package/dist/plugin/helpers/metrics.js.map +1 -0
- package/dist/plugin/helpers/resolvePageAndProps.d.ts +27 -0
- package/dist/plugin/helpers/resolvePageAndProps.d.ts.map +1 -0
- package/dist/plugin/helpers/resolvePageAndProps.js +51 -0
- package/dist/plugin/helpers/resolvePageAndProps.js.map +1 -0
- package/dist/plugin/helpers/serializeUserOptions.d.ts +8 -0
- package/dist/plugin/helpers/serializeUserOptions.d.ts.map +1 -0
- package/dist/plugin/helpers/serializeUserOptions.js +182 -0
- package/dist/plugin/helpers/serializeUserOptions.js.map +1 -0
- package/dist/plugin/helpers/stashReturnValue.d.ts +2 -0
- package/dist/plugin/helpers/stashReturnValue.d.ts.map +1 -0
- package/dist/plugin/helpers/stashReturnValue.js +14 -0
- package/dist/plugin/helpers/tryManifest.d.ts +5 -3
- package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/tryManifest.js +16 -7
- package/dist/plugin/helpers/tryManifest.js.map +1 -1
- package/dist/plugin/html.d.ts +2 -3
- package/dist/plugin/html.d.ts.map +1 -1
- package/dist/plugin/html.js +7 -1
- package/dist/plugin/html.js.map +1 -1
- package/dist/plugin/index.d.ts +1 -2
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +3 -1
- package/dist/plugin/loader/createBuildLoader.d.ts +26 -4
- package/dist/plugin/loader/createBuildLoader.d.ts.map +1 -1
- package/dist/plugin/loader/createBuildLoader.js +98 -33
- package/dist/plugin/loader/createBuildLoader.js.map +1 -1
- package/dist/plugin/loader/css-loader.development.d.ts +57 -0
- package/dist/plugin/loader/css-loader.development.d.ts.map +1 -0
- package/dist/plugin/loader/css-loader.development.js +81 -0
- package/dist/plugin/loader/css-loader.development.js.map +1 -0
- package/dist/plugin/loader/css-loader.production.d.ts +31 -0
- package/dist/plugin/loader/css-loader.production.d.ts.map +1 -0
- package/dist/plugin/loader/css-loader.production.js +45 -0
- package/dist/plugin/loader/css-loader.production.js.map +1 -0
- package/dist/plugin/loader/index.d.ts +2 -0
- package/dist/plugin/loader/index.d.ts.map +1 -0
- package/dist/plugin/loader/index.js +1 -0
- package/dist/plugin/loader/plugin.d.ts +22 -0
- package/dist/plugin/loader/plugin.d.ts.map +1 -0
- package/dist/plugin/loader/plugin.js +27 -0
- package/dist/plugin/loader/react-loader.d.ts +3 -7
- package/dist/plugin/loader/react-loader.d.ts.map +1 -1
- package/dist/plugin/loader/react-loader.js +85 -30
- package/dist/plugin/loader/react-loader.js.map +1 -1
- package/dist/plugin/loader/temporaryReferences.d.ts +2 -0
- package/dist/plugin/loader/temporaryReferences.d.ts.map +1 -0
- package/dist/plugin/loader/temporaryReferences.js +11 -0
- package/dist/plugin/loader/temporaryReferences.js.map +1 -0
- package/dist/plugin/moduleRefs.d.ts +7 -0
- package/dist/plugin/moduleRefs.d.ts.map +1 -0
- package/dist/plugin/moduleRefs.js +17 -0
- package/dist/plugin/moduleRefs.js.map +1 -0
- package/dist/plugin/plugin.client.d.ts +3 -0
- package/dist/plugin/plugin.client.d.ts.map +1 -0
- package/dist/plugin/plugin.client.js +19 -0
- package/dist/plugin/plugin.client.js.map +1 -0
- package/dist/plugin/plugin.d.ts +1 -5
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +3 -9
- package/dist/plugin/plugin.server.d.ts +3 -0
- package/dist/plugin/plugin.server.d.ts.map +1 -0
- package/dist/plugin/plugin.server.js +28 -0
- package/dist/plugin/plugin.server.js.map +1 -0
- package/dist/plugin/preserver/plugin.js +1 -1
- package/dist/plugin/preserver/plugin.js.map +1 -1
- package/dist/plugin/react-client/index.d.ts +1 -2
- package/dist/plugin/react-client/index.d.ts.map +1 -1
- package/dist/plugin/react-client/index.js +1 -19
- package/dist/plugin/react-client/plugin.d.ts.map +1 -1
- package/dist/plugin/react-client/plugin.js +60 -219
- package/dist/plugin/react-client/plugin.js.map +1 -1
- package/dist/plugin/react-client/server.d.ts +27 -0
- package/dist/plugin/react-client/server.d.ts.map +1 -0
- package/dist/plugin/react-client/server.js +197 -0
- package/dist/plugin/react-client/server.js.map +1 -0
- package/dist/plugin/react-server/index.d.ts +1 -2
- package/dist/plugin/react-server/index.d.ts.map +1 -1
- package/dist/plugin/react-server/index.js +1 -21
- package/dist/plugin/react-server/plugin.d.ts +0 -1
- package/dist/plugin/react-server/plugin.d.ts.map +1 -1
- package/dist/plugin/react-server/plugin.js +60 -186
- package/dist/plugin/react-server/plugin.js.map +1 -1
- package/dist/plugin/react-server/server.d.ts +9 -0
- package/dist/plugin/react-server/server.d.ts.map +1 -0
- package/dist/plugin/react-server/server.js +120 -0
- package/dist/plugin/react-server/server.js.map +1 -0
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts +23 -0
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts.map +1 -0
- package/dist/plugin/react-static/collectHtmlWorkerContent.js +85 -0
- package/dist/plugin/react-static/collectHtmlWorkerContent.js.map +1 -0
- package/dist/plugin/react-static/collectRscContent.d.ts +24 -0
- package/dist/plugin/react-static/collectRscContent.d.ts.map +1 -0
- package/dist/plugin/react-static/collectRscContent.js +49 -0
- package/dist/plugin/react-static/collectRscContent.js.map +1 -0
- package/dist/plugin/react-static/configurePreviewServer.d.ts +7 -0
- package/dist/plugin/react-static/configurePreviewServer.d.ts.map +1 -0
- package/dist/plugin/react-static/configurePreviewServer.js +67 -0
- package/dist/plugin/react-static/configurePreviewServer.js.map +1 -0
- package/dist/plugin/react-static/fileWriter.d.ts +23 -0
- package/dist/plugin/react-static/fileWriter.d.ts.map +1 -0
- package/dist/plugin/react-static/fileWriter.js +65 -0
- package/dist/plugin/react-static/fileWriter.js.map +1 -0
- package/dist/plugin/react-static/plugin.d.ts +15 -0
- package/dist/plugin/react-static/plugin.d.ts.map +1 -1
- package/dist/plugin/react-static/plugin.js +248 -149
- package/dist/plugin/react-static/plugin.js.map +1 -1
- package/dist/plugin/react-static/renderPage.d.ts +3 -0
- package/dist/plugin/react-static/renderPage.d.ts.map +1 -0
- package/dist/plugin/react-static/renderPage.js +116 -0
- package/dist/plugin/react-static/renderPage.js.map +1 -0
- package/dist/plugin/react-static/renderPages.d.ts +3 -0
- package/dist/plugin/react-static/renderPages.d.ts.map +1 -0
- package/dist/plugin/react-static/renderPages.js +125 -0
- package/dist/plugin/react-static/renderPages.js.map +1 -0
- package/dist/plugin/react-static/renderStreams.d.ts +26 -0
- package/dist/plugin/react-static/renderStreams.d.ts.map +1 -0
- package/dist/plugin/react-static/renderStreams.js +27 -0
- package/dist/plugin/react-static/renderStreams.js.map +1 -0
- package/dist/plugin/react-static/rscToHtmlStream.d.ts +22 -0
- package/dist/plugin/react-static/rscToHtmlStream.d.ts.map +1 -0
- package/dist/plugin/react-static/rscToHtmlStream.js +54 -0
- package/dist/plugin/react-static/rscToHtmlStream.js.map +1 -0
- package/dist/plugin/react-static/streamHandler.d.ts +2 -0
- package/dist/plugin/react-static/streamHandler.d.ts.map +1 -0
- package/dist/plugin/react-static/streamHandler.js +1 -0
- package/dist/plugin/react-static/types.d.ts +11 -0
- package/dist/plugin/react-static/types.d.ts.map +1 -1
- package/dist/plugin/resolvePage.d.ts +26 -9
- package/dist/plugin/resolvePage.d.ts.map +1 -1
- package/dist/plugin/resolvePage.js +41 -39
- package/dist/plugin/resolvePage.js.map +1 -1
- package/dist/plugin/resolveProps.d.ts +40 -7
- package/dist/plugin/resolveProps.d.ts.map +1 -1
- package/dist/plugin/resolveProps.js +100 -75
- package/dist/plugin/resolveProps.js.map +1 -1
- package/dist/plugin/root.d.ts +1 -0
- package/dist/plugin/root.d.ts.map +1 -1
- package/dist/plugin/root.js +1 -0
- package/dist/plugin/root.js.map +1 -1
- package/dist/plugin/transformer/index.d.ts +2 -1
- package/dist/plugin/transformer/index.d.ts.map +1 -1
- package/dist/plugin/transformer/index.js +2 -1
- package/dist/plugin/transformer/plugin.client.d.ts +4 -0
- package/dist/plugin/transformer/plugin.client.d.ts.map +1 -0
- package/dist/plugin/transformer/plugin.client.js +83 -0
- package/dist/plugin/transformer/plugin.client.js.map +1 -0
- package/dist/plugin/transformer/plugin.d.ts +1 -27
- package/dist/plugin/transformer/plugin.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.js +3 -87
- package/dist/plugin/transformer/plugin.js.map +1 -1
- package/dist/plugin/transformer/plugin.server.d.ts +4 -0
- package/dist/plugin/transformer/plugin.server.d.ts.map +1 -0
- package/dist/plugin/transformer/plugin.server.js +76 -0
- package/dist/plugin/transformer/plugin.server.js.map +1 -0
- package/dist/plugin/transformer/upgradeCssModuleCode.d.ts +11 -0
- package/dist/plugin/transformer/upgradeCssModuleCode.d.ts.map +1 -0
- package/dist/plugin/transformer/upgradeCssModuleCode.js +38 -0
- package/dist/plugin/types/css-tracking.d.ts +6 -0
- package/dist/plugin/types/css-tracking.d.ts.map +1 -0
- package/dist/plugin/types/css-tracking.js +1 -0
- package/dist/plugin/types.d.ts +372 -86
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/types.js +1 -1
- package/dist/plugin/vendor.client.d.ts +4 -0
- package/dist/plugin/vendor.client.d.ts.map +1 -0
- package/dist/plugin/vendor.client.js +16 -0
- package/dist/plugin/vendor.client.js.map +1 -0
- package/dist/plugin/vendor.server.d.ts +4 -0
- package/dist/plugin/vendor.server.d.ts.map +1 -0
- package/dist/plugin/vendor.server.js +16 -0
- package/dist/plugin/vendor.server.js.map +1 -0
- package/dist/plugin/worker/createWorker.d.ts +25 -7
- package/dist/plugin/worker/createWorker.d.ts.map +1 -1
- package/dist/plugin/worker/createWorker.js +108 -33
- package/dist/plugin/worker/createWorker.js.map +1 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts +12 -0
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts.map +1 -0
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js +103 -0
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js.map +1 -0
- package/dist/plugin/worker/html/html-worker.development.d.ts +0 -30
- package/dist/plugin/worker/html/html-worker.development.d.ts.map +1 -1
- package/dist/plugin/worker/html/html-worker.development.js +3 -17
- package/dist/plugin/worker/html/html-worker.development.js.map +1 -1
- package/dist/plugin/worker/html/html-worker.production.js +12 -5
- package/dist/plugin/worker/html/html-worker.production.js.map +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts +2 -2
- package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.js +87 -84
- package/dist/plugin/worker/html/messageHandler.js.map +1 -1
- package/dist/plugin/worker/html/types.d.ts +18 -0
- package/dist/plugin/worker/html/types.d.ts.map +1 -0
- package/dist/plugin/worker/html/types.js +1 -0
- package/dist/plugin/worker/registerLoaders.d.ts +9 -0
- package/dist/plugin/worker/registerLoaders.d.ts.map +1 -0
- package/dist/plugin/worker/registerLoaders.js +45 -0
- package/dist/plugin/worker/rsc/handleRender.d.ts +4 -0
- package/dist/plugin/worker/rsc/handleRender.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/handleRender.js +147 -0
- package/dist/plugin/worker/rsc/handleRender.js.map +1 -0
- package/dist/plugin/worker/rsc/messageHandler.d.ts +2 -2
- package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.js +47 -112
- package/dist/plugin/worker/rsc/messageHandler.js.map +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.development.d.ts +0 -30
- package/dist/plugin/worker/rsc/rsc-worker.development.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.development.js +29 -4
- package/dist/plugin/worker/rsc/rsc-worker.development.js.map +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.production.js +3 -3
- package/dist/plugin/worker/rsc/rsc-worker.production.js.map +1 -1
- package/dist/plugin/worker/rsc/state.d.ts +73 -2
- package/dist/plugin/worker/rsc/state.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/state.js +40 -3
- package/dist/plugin/worker/rsc/state.js.map +1 -1
- package/dist/plugin/worker/sendMessage.d.ts +3 -0
- package/dist/plugin/worker/sendMessage.d.ts.map +1 -0
- package/dist/plugin/worker/sendMessage.js +48 -0
- package/dist/plugin/worker/types.d.ts +218 -76
- package/dist/plugin/worker/types.d.ts.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +6 -1
- package/dist/server.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -14
- package/plugin/components.ts +1 -1
- package/plugin/config/autoDiscover/createGlobAutoDiscover.ts +29 -0
- package/plugin/config/autoDiscover/customWorkerFiles.ts +27 -0
- package/plugin/config/autoDiscover/pageAndPropFiles.ts +36 -0
- package/plugin/config/autoDiscover/resolveBuildPages.ts +98 -0
- package/plugin/config/defaults.tsx +38 -29
- package/plugin/config/getCondition.ts +7 -3
- package/plugin/config/getPaths.ts +1 -7
- package/plugin/config/index.ts +0 -1
- package/plugin/config/resolveAutoDiscover.ts +177 -0
- package/plugin/config/resolveOptions.ts +220 -118
- package/plugin/config/resolvePages.ts +5 -7
- package/plugin/config/resolveUrlOption.ts +43 -0
- package/plugin/config/resolveUserConfig.ts +116 -166
- package/plugin/copy.ts +39 -0
- package/plugin/css-collector-elements.tsx +21 -0
- package/plugin/css-collector.tsx +20 -53
- package/plugin/helpers/cleanObject.ts +50 -0
- package/plugin/helpers/collectBundleManifestCss.ts +160 -0
- package/plugin/helpers/collectManifestCss.ts +61 -0
- package/plugin/helpers/collectViteModuleGraphCss.ts +158 -0
- package/plugin/helpers/createCssProps.tsx +85 -0
- package/plugin/helpers/createEventHandler.ts +44 -0
- package/plugin/helpers/createHandler.ts +57 -126
- package/plugin/helpers/createRscStream.tsx +156 -0
- package/plugin/helpers/defaultFileWriter.ts +0 -0
- package/plugin/helpers/getBundleManifest.ts +42 -37
- package/plugin/helpers/getRouteFiles.ts +47 -0
- package/plugin/helpers/inputNormalizer.ts +16 -10
- package/plugin/helpers/metrics.ts +64 -0
- package/plugin/helpers/resolvePageAndProps.ts +81 -0
- package/plugin/helpers/serializeUserOptions.ts +209 -0
- package/plugin/helpers/stashReturnValue.ts +16 -0
- package/plugin/helpers/tryManifest.ts +35 -18
- package/plugin/html.tsx +14 -3
- package/plugin/index.ts +5 -2
- package/plugin/loader/createBuildLoader.ts +152 -47
- package/plugin/loader/css-loader.development.ts +157 -0
- package/plugin/loader/css-loader.production.ts +86 -0
- package/plugin/loader/index.ts +1 -0
- package/plugin/loader/plugin.ts +33 -0
- package/plugin/loader/react-loader.ts +109 -41
- package/plugin/loader/temporaryReferences.ts +3 -0
- package/plugin/moduleRefs.ts +11 -0
- package/plugin/plugin.client.ts +12 -0
- package/plugin/plugin.server.ts +25 -0
- package/plugin/plugin.ts +5 -9
- package/plugin/preserver/plugin.ts +1 -1
- package/plugin/react-client/index.ts +1 -12
- package/plugin/react-client/plugin.ts +70 -259
- package/plugin/react-client/server.ts +276 -0
- package/plugin/react-server/index.ts +1 -14
- package/plugin/react-server/plugin.ts +69 -220
- package/plugin/react-server/server.ts +128 -0
- package/plugin/react-static/collectHtmlWorkerContent.ts +120 -0
- package/plugin/react-static/collectRscContent.ts +77 -0
- package/plugin/react-static/configurePreviewServer.ts +68 -0
- package/plugin/react-static/fileWriter.ts +103 -0
- package/plugin/react-static/plugin.ts +308 -181
- package/plugin/react-static/renderPage.ts +151 -0
- package/plugin/react-static/renderPages.ts +154 -0
- package/plugin/react-static/renderStreams.ts +48 -0
- package/plugin/react-static/rscToHtmlStream.ts +85 -0
- package/plugin/react-static/streamHandler.ts +0 -0
- package/plugin/react-static/types.ts +10 -0
- package/plugin/resolvePage.ts +67 -57
- package/plugin/resolveProps.ts +148 -104
- package/plugin/root.ts +1 -1
- package/plugin/transformer/index.ts +2 -1
- package/plugin/transformer/plugin.client.ts +109 -0
- package/plugin/transformer/plugin.server.ts +98 -0
- package/plugin/transformer/plugin.ts +2 -115
- package/plugin/transformer/upgradeCssModuleCode.ts +42 -0
- package/plugin/types/css-tracking.ts +5 -0
- package/plugin/types/react-server-dom-esm.d.ts +54 -0
- package/plugin/types.ts +508 -97
- package/plugin/vendor.client.ts +12 -0
- package/plugin/vendor.server.ts +12 -0
- package/plugin/worker/createWorker.ts +158 -53
- package/plugin/worker/html/createHtmlWorkerRenderState.tsx +112 -0
- package/plugin/worker/html/html-worker.development.tsx +5 -75
- package/plugin/worker/html/html-worker.production.tsx +18 -7
- package/plugin/worker/html/messageHandler.tsx +126 -0
- package/plugin/worker/html/types.ts +19 -0
- package/plugin/worker/registerLoaders.ts +54 -0
- package/plugin/worker/rsc/handleRender.ts +180 -0
- package/plugin/worker/rsc/messageHandler.tsx +58 -132
- package/plugin/worker/rsc/rsc-worker.development.ts +49 -63
- package/plugin/worker/rsc/rsc-worker.production.ts +5 -5
- package/plugin/worker/rsc/state.ts +79 -2
- package/plugin/worker/sendMessage.ts +49 -0
- package/plugin/worker/types.ts +299 -100
- package/scripts/check-react-version.mjs +60 -48
- package/scripts/react+0.0.0-experimental-0ca8420f-20250504.patch +57 -0
- package/scripts/react-dom+0.0.0-experimental-0ca8420f-20250504.patch +819 -0
- package/scripts/{react-server-dom-esm+0.0.0-experimental-eda36a1c-20250228.patch → react-server-dom-esm+0.0.0-experimental-0ca8420f-20250504.patch} +1702 -2820
- package/tsconfig.json +7 -2
- package/dist/plugin/assertServerCondition.d.ts +0 -6
- package/dist/plugin/assertServerCondition.d.ts.map +0 -1
- package/dist/plugin/assertServerCondition.js +0 -13
- package/dist/plugin/checkFilesExist.d.ts +0 -3
- package/dist/plugin/checkFilesExist.d.ts.map +0 -1
- package/dist/plugin/checkFilesExist.js +0 -67
- package/dist/plugin/checkFilesExist.js.map +0 -1
- package/dist/plugin/collect-manifest-client-files.d.ts +0 -23
- package/dist/plugin/collect-manifest-client-files.d.ts.map +0 -1
- package/dist/plugin/collect-manifest-client-files.js +0 -131
- package/dist/plugin/collect-manifest-client-files.js.map +0 -1
- package/dist/plugin/config/getWorkerPath.d.ts +0 -2
- package/dist/plugin/config/getWorkerPath.d.ts.map +0 -1
- package/dist/plugin/config/getWorkerPath.js +0 -4
- package/dist/plugin/copy-dir.d.ts +0 -4
- package/dist/plugin/copy-dir.d.ts.map +0 -1
- package/dist/plugin/copy-dir.js +0 -25
- package/dist/plugin/copy-dir.js.map +0 -1
- package/dist/plugin/css-collector-inline.d.ts +0 -10
- package/dist/plugin/css-collector-inline.d.ts.map +0 -1
- package/dist/plugin/css-collector-inline.js +0 -55
- package/dist/plugin/css-collector-inline.js.map +0 -1
- package/dist/plugin/loader/css-loader.d.ts +0 -16
- package/dist/plugin/loader/css-loader.d.ts.map +0 -1
- package/dist/plugin/loader/css-loader.js +0 -70
- package/dist/plugin/loader/css-loader.js.map +0 -1
- package/dist/plugin/react-client/index.js.map +0 -1
- package/dist/plugin/react-server/index.js.map +0 -1
- package/dist/plugin/worker/html/renderPages.d.ts +0 -26
- package/dist/plugin/worker/html/renderPages.d.ts.map +0 -1
- package/dist/plugin/worker/html/renderPages.js +0 -241
- package/dist/plugin/worker/html/renderPages.js.map +0 -1
- package/plugin/assertServerCondition.ts +0 -12
- package/plugin/checkFilesExist.ts +0 -66
- package/plugin/collect-manifest-client-files.ts +0 -167
- package/plugin/config/getWorkerPath.ts +0 -5
- package/plugin/copy-dir.ts +0 -27
- package/plugin/css-collector-inline.tsx +0 -60
- package/plugin/helpers/createRscStream.ts +0 -109
- package/plugin/loader/css-loader.ts +0 -94
- package/plugin/worker/html/messageHandler.ts +0 -130
- package/plugin/worker/html/renderPages.ts +0 -293
- package/scripts/react+0.0.0-experimental-eda36a1c-20250228.patch +0 -159
- package/scripts/react-dom+0.0.0-experimental-eda36a1c-20250228.patch +0 -12508
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import { access } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import type { ResolvedBuildPages, ResolvedUserOptions } from "../../types.js";
|
|
4
|
+
import { resolveUrlOption } from "../resolveUrlOption.js";
|
|
5
|
+
|
|
6
|
+
let stashedBuildPages: ResolvedBuildPages | null = null;
|
|
7
|
+
let stashedPages: string[] | null = null;
|
|
8
|
+
|
|
9
|
+
export async function resolveBuildPages({
|
|
10
|
+
pages,
|
|
11
|
+
userOptions,
|
|
12
|
+
}: {
|
|
13
|
+
pages: string[];
|
|
14
|
+
userOptions: Pick<ResolvedUserOptions, "Page" | "props" | "build" | "moduleBase" | "projectRoot" | "normalizer">;
|
|
15
|
+
}): Promise<ResolvedBuildPages> {
|
|
16
|
+
// Check if pages array has changed
|
|
17
|
+
const pagesChanged =
|
|
18
|
+
!stashedPages ||
|
|
19
|
+
stashedPages.length !== pages.length ||
|
|
20
|
+
!stashedPages.every((page, i) => page === pages[i]);
|
|
21
|
+
|
|
22
|
+
if (stashedBuildPages && !pagesChanged) {
|
|
23
|
+
return stashedBuildPages; // Return directly without Promise.resolve
|
|
24
|
+
}
|
|
25
|
+
const errors: Error[] = [];
|
|
26
|
+
const pageMap = new Map<string, string>();
|
|
27
|
+
const propsMap = new Map<string, string>();
|
|
28
|
+
const urlMap = new Map<string, { props: string | undefined; page: string }>();
|
|
29
|
+
const routeMap = new Map<string, string[]>();
|
|
30
|
+
|
|
31
|
+
for (const page of pages) {
|
|
32
|
+
const pageResult = await resolveUrlOption(userOptions, "Page", page);
|
|
33
|
+
if(pageResult.type === "error") {
|
|
34
|
+
errors.push(pageResult.error);
|
|
35
|
+
continue;
|
|
36
|
+
}
|
|
37
|
+
if(!userOptions.props) {
|
|
38
|
+
urlMap.set(page, { props: undefined, page: pageResult.Page });
|
|
39
|
+
pageMap.set(page, pageResult.Page);
|
|
40
|
+
// Add to routeMap
|
|
41
|
+
const routes = routeMap.get(pageResult.Page) || [];
|
|
42
|
+
routes.push(page);
|
|
43
|
+
routeMap.set(pageResult.Page, routes);
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
const propsResult = await resolveUrlOption(userOptions, "props", page);
|
|
47
|
+
if(propsResult.type === "error") {
|
|
48
|
+
errors.push(propsResult.error);
|
|
49
|
+
continue;
|
|
50
|
+
}
|
|
51
|
+
const [pageKey, pageValue] = userOptions.normalizer(pageResult.Page);
|
|
52
|
+
|
|
53
|
+
try {
|
|
54
|
+
await access(join(userOptions.projectRoot, pageValue));
|
|
55
|
+
} catch {
|
|
56
|
+
errors.push(new Error(`Page file not found: ${pageValue}`));
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// If propsPath is defined, check if it exists
|
|
60
|
+
if (propsResult.props) {
|
|
61
|
+
const [propsKey, propsValue] = userOptions.normalizer(propsResult.props);
|
|
62
|
+
if (propsValue !== pageValue) {
|
|
63
|
+
try {
|
|
64
|
+
await access(join(userOptions.projectRoot, propsValue));
|
|
65
|
+
} catch {
|
|
66
|
+
errors.push(
|
|
67
|
+
new Error(`Props file not found: ${propsValue}`)
|
|
68
|
+
);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
urlMap.set(page, { props: propsValue, page: pageValue });
|
|
72
|
+
propsMap.set(propsKey, propsValue);
|
|
73
|
+
|
|
74
|
+
// Add to routeMap for both page and props files
|
|
75
|
+
const pageRoutes = routeMap.get(pageValue) || [];
|
|
76
|
+
pageRoutes.push(page);
|
|
77
|
+
routeMap.set(pageValue, pageRoutes);
|
|
78
|
+
|
|
79
|
+
const propsRoutes = routeMap.get(propsValue) || [];
|
|
80
|
+
propsRoutes.push(page);
|
|
81
|
+
routeMap.set(propsValue, propsRoutes);
|
|
82
|
+
} else {
|
|
83
|
+
// If no props path, use the page path for both
|
|
84
|
+
urlMap.set(page, { props: undefined, page: pageValue });
|
|
85
|
+
|
|
86
|
+
// Add to routeMap for page file only
|
|
87
|
+
const routes = routeMap.get(pageValue) || [];
|
|
88
|
+
routes.push(page);
|
|
89
|
+
routeMap.set(pageValue, routes);
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
pageMap.set(pageKey, pageValue);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
stashedBuildPages = { pageMap, propsMap, urlMap, routeMap, errors };
|
|
96
|
+
stashedPages = [...pages];
|
|
97
|
+
return stashedBuildPages;
|
|
98
|
+
}
|
|
@@ -1,38 +1,36 @@
|
|
|
1
1
|
import { CssCollector } from "../css-collector.js";
|
|
2
2
|
import { Html } from "../html.js";
|
|
3
3
|
export const DEFAULT_CONFIG = {
|
|
4
|
-
|
|
4
|
+
MODULE_EXTENSION: /\.(m|c)?(j|t)sx?$/,
|
|
5
5
|
CLIENT_ASSETS_DIR: "assets",
|
|
6
6
|
RSC_DIR: "rsc",
|
|
7
7
|
MODULE_BASE: "src",
|
|
8
8
|
MODULE_BASE_PATH: "",
|
|
9
9
|
MODULE_BASE_URL: "",
|
|
10
|
-
PAGE: "
|
|
11
|
-
PROPS: "
|
|
12
|
-
CLIENT_ENTRY:
|
|
13
|
-
SERVER_ENTRY:
|
|
10
|
+
PAGE: "page.tsx",
|
|
11
|
+
PROPS: "props.ts",
|
|
12
|
+
CLIENT_ENTRY: undefined,
|
|
13
|
+
SERVER_ENTRY: undefined,
|
|
14
14
|
PAGE_EXPORT_NAME: "Page",
|
|
15
15
|
PROPS_EXPORT_NAME: "props",
|
|
16
16
|
HTML_WORKER_PATH: `worker/html/html-worker.${
|
|
17
|
-
process.env["NODE_ENV"] === "
|
|
17
|
+
process.env["NODE_ENV"] === "production" ? "production" : "development"
|
|
18
18
|
}.js`,
|
|
19
19
|
RSC_WORKER_PATH: `worker/rsc/rsc-worker.${
|
|
20
|
-
process.env["NODE_ENV"] === "
|
|
20
|
+
process.env["NODE_ENV"] === "production" ? "production" : "development"
|
|
21
21
|
}.js`,
|
|
22
22
|
LOADER_PATH: "worker/loader.js",
|
|
23
23
|
RSC_EXTENSION: ".rsc",
|
|
24
24
|
CSS_COLLECTOR: CssCollector,
|
|
25
25
|
HTML: Html,
|
|
26
|
-
|
|
27
|
-
COLLECT_ASSETS: true,
|
|
28
|
-
INLINE_CSS: true,
|
|
26
|
+
ON_METRICS: ()=>{},
|
|
29
27
|
DEV_PORT: 5173,
|
|
30
28
|
PREVIEW_PORT: 4173,
|
|
31
29
|
DEV_HOST: "localhost",
|
|
32
30
|
PREVIEW_HOST: "localhost",
|
|
33
31
|
ENV_PREFIX: "VITE_",
|
|
34
32
|
BUILD: {
|
|
35
|
-
pages:
|
|
33
|
+
pages: ["/"],
|
|
36
34
|
client: "client",
|
|
37
35
|
server: "server",
|
|
38
36
|
static: "static",
|
|
@@ -40,31 +38,42 @@ export const DEFAULT_CONFIG = {
|
|
|
40
38
|
outDir: "dist",
|
|
41
39
|
assetsDir: "assets",
|
|
42
40
|
hash: "hash",
|
|
41
|
+
rscOutputPath: "index.rsc",
|
|
42
|
+
htmlOutputPath: "index.html",
|
|
43
43
|
preserveModulesRoot: true,
|
|
44
44
|
},
|
|
45
45
|
CSS: {
|
|
46
|
+
inlineCss: false,
|
|
47
|
+
purgeCss: false,
|
|
46
48
|
inlineThreshold: 4096, // 4KB
|
|
47
|
-
inlinePatterns: [
|
|
48
|
-
linkPatterns: [
|
|
49
|
+
inlinePatterns: [] as RegExp[], // Always inline CSS modules
|
|
50
|
+
linkPatterns: [] as RegExp[], // Always link node_modules CSS
|
|
49
51
|
},
|
|
50
52
|
MODULE_BASE_EXCEPTIONS: [] as string[],
|
|
51
53
|
AUTO_DISCOVER: {
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
54
|
+
// All REGEX tricks used here are based on the following:
|
|
55
|
+
// $ = endsWith
|
|
56
|
+
// ^ = startsWith
|
|
57
|
+
// . = includes
|
|
58
|
+
// \ = escape
|
|
59
|
+
// ? = optional
|
|
60
|
+
// () = group
|
|
61
|
+
// | = or
|
|
62
|
+
modulePattern: (n: string) => /\.(m|c)?(j|t)sx?$/.test(n),
|
|
63
|
+
pagePattern: (n: string) => /\.?page(\.js)?$/.test(n),
|
|
64
|
+
propsPattern: (n: string) => /\.?props(\.js)?$/.test(n),
|
|
65
|
+
clientComponents: (n: string) => /(\.|\/)?client(\.js)?$/.test(n),
|
|
66
|
+
serverFunctions: (n: string) => /(\.|\/)?server(\.js)?$/.test(n),
|
|
67
|
+
cssPattern: (n: string) => /\.css$/.test(n),
|
|
68
|
+
cssModulePattern: (n: string) => /\.css\.js$/.test(n),
|
|
69
|
+
virtualPattern: (n: string) => /^\/_virtual\//.test(n),
|
|
63
70
|
vendorPattern: (n: string) =>
|
|
64
|
-
n
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
71
|
+
/^\/node_modules\//.test(n),
|
|
72
|
+
htmlPattern: (n: string) => /\.html$/.test(n),
|
|
73
|
+
jsonPattern: (n: string) => /\.json$/.test(n),
|
|
74
|
+
nodeOnly: (n: string) => /\.node(\.js)?$/.test(n),
|
|
75
|
+
dotFiles: (n: string) => n.split('/').some(p => p.startsWith('.')),
|
|
76
|
+
rscPattern: (n: string) => /\.rsc$/.test(n),
|
|
68
77
|
},
|
|
69
78
|
MODULE_ID: (id: string) => id,
|
|
70
|
-
} as const;
|
|
79
|
+
} as const;
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
-
export const getCondition =
|
|
2
|
-
|
|
3
|
-
}
|
|
1
|
+
export const getCondition = <Prefix extends string = "react-">(
|
|
2
|
+
prefix: Prefix = "react-" as Prefix
|
|
3
|
+
): `${Prefix}client` | `${Prefix}server` => {
|
|
4
|
+
return process.env["NODE_OPTIONS"]?.match(/--conditions[= ]react-server/)
|
|
5
|
+
? (`${prefix}server` as `${Prefix}server`)
|
|
6
|
+
: (`${prefix}client` as `${Prefix}client`);
|
|
7
|
+
};
|
|
@@ -10,10 +10,4 @@ export const getMode = (): "production" | "development" | "test" => {
|
|
|
10
10
|
: process.env['NODE_ENV'] === "test"
|
|
11
11
|
? "test"
|
|
12
12
|
: "production";
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export const getDistDir = (mode: "production" | "development" | "test"): string => {
|
|
16
|
-
return mode === 'production'
|
|
17
|
-
? join(process.cwd(), 'dist')
|
|
18
|
-
: join(process.cwd(), 'test/fixtures/dist');
|
|
19
|
-
}
|
|
13
|
+
}
|
package/plugin/config/index.ts
CHANGED
|
@@ -0,0 +1,177 @@
|
|
|
1
|
+
import type { ConfigEnv, UserConfig } from "vite";
|
|
2
|
+
import type {
|
|
3
|
+
ResolvedUserOptions,
|
|
4
|
+
AutoDiscoveredFiles,
|
|
5
|
+
} from "../types.js";
|
|
6
|
+
import { join } from "path";
|
|
7
|
+
import { resolveBuildPages } from "./autoDiscover/resolveBuildPages.js";
|
|
8
|
+
import { resolvePages } from "./resolvePages.js";
|
|
9
|
+
import { tryManifest } from "../helpers/tryManifest.js";
|
|
10
|
+
import type { Manifest } from "vite";
|
|
11
|
+
import { createGlobAutoDiscover } from "./autoDiscover/createGlobAutoDiscover.js";
|
|
12
|
+
import { customWorkerFiles } from "./autoDiscover/customWorkerFiles.js";
|
|
13
|
+
import { pageAndPropFiles } from "./autoDiscover/pageAndPropFiles.js";
|
|
14
|
+
|
|
15
|
+
let stashedAutoDiscover: Record<string, AutoDiscoveredFiles | null> = {};
|
|
16
|
+
|
|
17
|
+
const clientFiles = createGlobAutoDiscover("**/*.client.*");
|
|
18
|
+
const serverFiles = createGlobAutoDiscover("**/*.server.*");
|
|
19
|
+
const cssFiles = createGlobAutoDiscover("**/*.css");
|
|
20
|
+
const jsonFiles = createGlobAutoDiscover("**/*.json");
|
|
21
|
+
|
|
22
|
+
type ResolveAutoDiscoverProps = {
|
|
23
|
+
config: UserConfig;
|
|
24
|
+
configEnv: ConfigEnv;
|
|
25
|
+
userOptions: ResolvedUserOptions;
|
|
26
|
+
condition: "react-server" | "react-client";
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
type ResolveAutoDiscoverReturn =
|
|
30
|
+
| {
|
|
31
|
+
type: "success";
|
|
32
|
+
autoDiscoveredFiles: AutoDiscoveredFiles;
|
|
33
|
+
error?: never;
|
|
34
|
+
}
|
|
35
|
+
| {
|
|
36
|
+
type: "error";
|
|
37
|
+
error: Error;
|
|
38
|
+
autoDiscoveredFiles?: never;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
export async function resolveAutoDiscover({
|
|
42
|
+
config,
|
|
43
|
+
configEnv,
|
|
44
|
+
userOptions,
|
|
45
|
+
condition,
|
|
46
|
+
}: ResolveAutoDiscoverProps): Promise<ResolveAutoDiscoverReturn> {
|
|
47
|
+
const ssr = configEnv.isSsrBuild;
|
|
48
|
+
const envDir =
|
|
49
|
+
condition === "react-server"
|
|
50
|
+
? userOptions.build.server
|
|
51
|
+
: ssr
|
|
52
|
+
? userOptions.build.client
|
|
53
|
+
: userOptions.build.static;
|
|
54
|
+
const envId = `${envDir}${ssr ? "-ssr" : ""}`;
|
|
55
|
+
const configInputRecord = {} as Record<string, string>;
|
|
56
|
+
if (typeof config.build?.rollupOptions?.input === "string") {
|
|
57
|
+
configInputRecord[
|
|
58
|
+
userOptions.normalizer(config.build?.rollupOptions?.input)[0]
|
|
59
|
+
] = config.build?.rollupOptions?.input;
|
|
60
|
+
} else if (typeof config.build?.rollupOptions?.input === "object") {
|
|
61
|
+
for (const [, value] of Object.entries(
|
|
62
|
+
config.build?.rollupOptions?.input
|
|
63
|
+
)) {
|
|
64
|
+
configInputRecord[userOptions.normalizer(value)[0]] = value;
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
if (stashedAutoDiscover[envId]) {
|
|
68
|
+
return {
|
|
69
|
+
type: "success",
|
|
70
|
+
autoDiscoveredFiles: stashedAutoDiscover[envId],
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const serverEntry =
|
|
75
|
+
typeof userOptions.serverEntry === "string"
|
|
76
|
+
? Object.fromEntries([userOptions.normalizer(userOptions.serverEntry)])
|
|
77
|
+
: null;
|
|
78
|
+
|
|
79
|
+
const indexHtmlInputs = { index: "index.html" };
|
|
80
|
+
|
|
81
|
+
const clientEntry =
|
|
82
|
+
typeof userOptions.clientEntry === "string"
|
|
83
|
+
? Object.fromEntries([userOptions.normalizer(userOptions.clientEntry)])
|
|
84
|
+
: {};
|
|
85
|
+
|
|
86
|
+
const { type, error, pages } = await resolvePages(userOptions.build.pages);
|
|
87
|
+
|
|
88
|
+
if (type === "error") {
|
|
89
|
+
return {
|
|
90
|
+
type: "error",
|
|
91
|
+
error,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
const files = await resolveBuildPages({
|
|
96
|
+
pages,
|
|
97
|
+
userOptions,
|
|
98
|
+
});
|
|
99
|
+
|
|
100
|
+
// Load static manifest for client build
|
|
101
|
+
let staticManifest: Manifest = {};
|
|
102
|
+
if (ssr) {
|
|
103
|
+
const staticManifestResult = await tryManifest({
|
|
104
|
+
root: userOptions.projectRoot,
|
|
105
|
+
ssrManifest: false,
|
|
106
|
+
outDir: join(userOptions.build.outDir, userOptions.build.static),
|
|
107
|
+
});
|
|
108
|
+
if (staticManifestResult.type === "success") {
|
|
109
|
+
staticManifest = staticManifestResult.manifest;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
const customWorkerInputs = customWorkerFiles({
|
|
114
|
+
inputs: {},
|
|
115
|
+
userOptions,
|
|
116
|
+
});
|
|
117
|
+
const clientInputs = await clientFiles({
|
|
118
|
+
inputs: {},
|
|
119
|
+
userOptions,
|
|
120
|
+
});
|
|
121
|
+
const serverInputs = await serverFiles({
|
|
122
|
+
inputs: {},
|
|
123
|
+
userOptions,
|
|
124
|
+
});
|
|
125
|
+
|
|
126
|
+
const pageAndPropInputs = pageAndPropFiles({
|
|
127
|
+
files,
|
|
128
|
+
inputs: {},
|
|
129
|
+
});
|
|
130
|
+
|
|
131
|
+
const cssInputs = await cssFiles({
|
|
132
|
+
inputs: {},
|
|
133
|
+
userOptions,
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
const jsonInputs = await jsonFiles({
|
|
137
|
+
inputs: {},
|
|
138
|
+
userOptions,
|
|
139
|
+
});
|
|
140
|
+
const agnosticInputs = {
|
|
141
|
+
...configInputRecord,
|
|
142
|
+
...clientInputs,
|
|
143
|
+
...clientEntry,
|
|
144
|
+
...serverInputs,
|
|
145
|
+
...serverEntry,
|
|
146
|
+
};
|
|
147
|
+
// Add inputs based on condition
|
|
148
|
+
const inputs =
|
|
149
|
+
condition === "react-client"
|
|
150
|
+
? {
|
|
151
|
+
...indexHtmlInputs,
|
|
152
|
+
...agnosticInputs,
|
|
153
|
+
...cssInputs,
|
|
154
|
+
...jsonInputs,
|
|
155
|
+
}
|
|
156
|
+
: {
|
|
157
|
+
...configInputRecord,
|
|
158
|
+
...customWorkerInputs,
|
|
159
|
+
...pageAndPropInputs,
|
|
160
|
+
...agnosticInputs,
|
|
161
|
+
...cssInputs,
|
|
162
|
+
...jsonInputs,
|
|
163
|
+
};
|
|
164
|
+
|
|
165
|
+
stashedAutoDiscover[envId] = {
|
|
166
|
+
...files,
|
|
167
|
+
workerPaths: customWorkerInputs,
|
|
168
|
+
serverEntry,
|
|
169
|
+
clientEntry,
|
|
170
|
+
staticManifest,
|
|
171
|
+
inputs,
|
|
172
|
+
};
|
|
173
|
+
return {
|
|
174
|
+
type: "success",
|
|
175
|
+
autoDiscoveredFiles: stashedAutoDiscover[envId],
|
|
176
|
+
};
|
|
177
|
+
}
|