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
|
@@ -1,12 +1,54 @@
|
|
|
1
|
+
import { workerData } from "node:worker_threads";
|
|
2
|
+
import { createCssProps } from "../../helpers/createCssProps.js";
|
|
3
|
+
import type { CssContent, ResolvedUserOptions, HmrState } from "../../types.js";
|
|
4
|
+
import type { PassThrough } from "node:stream";
|
|
5
|
+
import { relative } from "node:path";
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
// Track active RSC streams
|
|
9
|
+
export const activeStreams = new Map<string, PassThrough>();
|
|
10
|
+
|
|
11
|
+
// Track CSS files
|
|
12
|
+
export const cssFiles = new Map<string, CssContent>();
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
export const hmrState = new Map<string, HmrState>();
|
|
16
|
+
|
|
17
|
+
if(workerData) {
|
|
18
|
+
if(workerData.hmrPort) {
|
|
19
|
+
workerData.hmrPort.on('message', (msg: { type: string; path: string; routes?: string[] }) => {
|
|
20
|
+
if(msg.type === 'HMR_UPDATE') {
|
|
21
|
+
// Normalize the path relative to project root
|
|
22
|
+
const normalizedPath = relative(workerData.userOptions.projectRoot, msg.path);
|
|
23
|
+
hmrState.set(normalizedPath, {
|
|
24
|
+
timestamp: Date.now(),
|
|
25
|
+
invalidated: true,
|
|
26
|
+
routes: msg.routes || []
|
|
27
|
+
});
|
|
28
|
+
} else if(msg.type === 'HMR_ACCEPT') {
|
|
29
|
+
// Normalize the path relative to project root
|
|
30
|
+
const normalizedPath = relative(workerData.userOptions.projectRoot, msg.path);
|
|
31
|
+
hmrState.delete(normalizedPath);
|
|
32
|
+
}
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
} else {
|
|
36
|
+
throw new Error("This module must be run with workerData");
|
|
37
|
+
}
|
|
38
|
+
|
|
1
39
|
// Create shared CSS registry
|
|
2
|
-
export const cssFiles = new Map<string, string>();
|
|
3
40
|
export const clientFiles = new Set<string>();
|
|
4
41
|
export const serverActionFiles = new Set<string>();
|
|
42
|
+
|
|
5
43
|
// Helper functions
|
|
6
44
|
export function clearCssFiles() {
|
|
7
45
|
cssFiles.clear();
|
|
8
46
|
}
|
|
9
47
|
|
|
48
|
+
export function getCssFiles() {
|
|
49
|
+
return cssFiles.entries();
|
|
50
|
+
}
|
|
51
|
+
|
|
10
52
|
export function clearClientFiles() {
|
|
11
53
|
clientFiles.clear();
|
|
12
54
|
}
|
|
@@ -15,8 +57,25 @@ export function clearServerActionFiles() {
|
|
|
15
57
|
serverActionFiles.clear();
|
|
16
58
|
}
|
|
17
59
|
|
|
18
|
-
export function addCssFile(id: string, cssFile:
|
|
60
|
+
export function addCssFile(id: string, cssFile: CssContent) {
|
|
19
61
|
cssFiles.set(id, cssFile);
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
|
|
65
|
+
export function addCssFileContent(id: string, code: string, userOptions: Pick<ResolvedUserOptions, "projectRoot" | "moduleBaseURL" | "moduleBasePath" | "moduleRootPath" | "css">) {
|
|
66
|
+
if(typeof code !== "string"){
|
|
67
|
+
throw new Error(`Expected css to be loaded as a string, but got ${typeof code}`);
|
|
68
|
+
}
|
|
69
|
+
const normalizeId = id.startsWith(userOptions.moduleRootPath) ? id.slice(userOptions.moduleRootPath.length) : id;
|
|
70
|
+
cssFiles.set(normalizeId, createCssProps({
|
|
71
|
+
id,
|
|
72
|
+
code,
|
|
73
|
+
projectRoot: userOptions.projectRoot,
|
|
74
|
+
moduleBaseURL: userOptions.moduleBaseURL,
|
|
75
|
+
moduleBasePath: userOptions.moduleBasePath,
|
|
76
|
+
moduleRootPath: userOptions.moduleRootPath,
|
|
77
|
+
css: userOptions.css,
|
|
78
|
+
}));
|
|
20
79
|
}
|
|
21
80
|
|
|
22
81
|
export function addClientFile(url: string) {
|
|
@@ -31,4 +90,22 @@ export function clearAllFiles() {
|
|
|
31
90
|
clearCssFiles();
|
|
32
91
|
clearClientFiles();
|
|
33
92
|
clearServerActionFiles();
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
// Helper to check if a module is invalidated
|
|
96
|
+
export function isModuleInvalidated(path: string): boolean {
|
|
97
|
+
const state = hmrState.get(path);
|
|
98
|
+
return state?.invalidated || false;
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
// Helper to clear HMR state for a module
|
|
102
|
+
export function clearHmrState(path: string): void {
|
|
103
|
+
hmrState.delete(path);
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
// Helper to get all invalidated modules
|
|
107
|
+
export function getInvalidatedModules(): string[] {
|
|
108
|
+
return Array.from(hmrState.entries())
|
|
109
|
+
.filter(([_, state]) => state.invalidated)
|
|
110
|
+
.map(([path]) => path);
|
|
34
111
|
}
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { cleanObject } from "../helpers/cleanObject.js";
|
|
2
|
+
import type { HtmlWorkerOutputMessage, RscWorkerOutputMessage } from "./types.js";
|
|
3
|
+
import { parentPort } from "node:worker_threads";
|
|
4
|
+
|
|
5
|
+
export function sendMessage(msg: HtmlWorkerOutputMessage | RscWorkerOutputMessage, port = parentPort) {
|
|
6
|
+
if (!port) {
|
|
7
|
+
console.error("[Worker] No port available to send message");
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
try {
|
|
12
|
+
// Handle error messages
|
|
13
|
+
if ('error' in msg) {
|
|
14
|
+
const error = msg.error;
|
|
15
|
+
const serializedError = error instanceof Error ? {
|
|
16
|
+
message: error.message,
|
|
17
|
+
stack: error.stack,
|
|
18
|
+
name: error.name,
|
|
19
|
+
cause: error.cause,
|
|
20
|
+
} : {
|
|
21
|
+
message: String(error),
|
|
22
|
+
name: 'Error',
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
port.postMessage({
|
|
26
|
+
...cleanObject(msg),
|
|
27
|
+
error: serializedError,
|
|
28
|
+
});
|
|
29
|
+
} else {
|
|
30
|
+
// Handle non-error messages
|
|
31
|
+
port.postMessage(cleanObject(msg));
|
|
32
|
+
}
|
|
33
|
+
} catch (err) {
|
|
34
|
+
console.error("[Worker] Failed to send message:", err);
|
|
35
|
+
// Try to send a basic error message
|
|
36
|
+
try {
|
|
37
|
+
port.postMessage({
|
|
38
|
+
type: "ERROR",
|
|
39
|
+
error: {
|
|
40
|
+
message: err instanceof Error ? err.message : String(err),
|
|
41
|
+
name: err instanceof Error ? err.name : 'Error',
|
|
42
|
+
},
|
|
43
|
+
});
|
|
44
|
+
} catch {
|
|
45
|
+
// If we can't even send an error message, just log it
|
|
46
|
+
console.error("[Worker] Critical error - could not send error message");
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
}
|
package/plugin/worker/types.ts
CHANGED
|
@@ -1,4 +1,9 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { RenderToPipeableStreamOptions } from "react-dom/server";
|
|
2
|
+
import type {
|
|
3
|
+
CreateHandlerOptions,
|
|
4
|
+
CssContent,
|
|
5
|
+
StreamMetrics,
|
|
6
|
+
} from "../types.js";
|
|
2
7
|
|
|
3
8
|
// Base message types
|
|
4
9
|
export interface WorkerMessage {
|
|
@@ -6,37 +11,26 @@ export interface WorkerMessage {
|
|
|
6
11
|
id: string;
|
|
7
12
|
}
|
|
8
13
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
bootstrapScripts?: string[];
|
|
12
|
-
bootstrapScriptContent?: string;
|
|
13
|
-
signal?: AbortSignal;
|
|
14
|
+
// React Server DOM ESM specific options
|
|
15
|
+
export interface ReactServerDomEsmOptions {
|
|
14
16
|
identifierPrefix?: string;
|
|
15
17
|
namespaceURI?: string;
|
|
16
18
|
nonce?: string;
|
|
19
|
+
bootstrapScriptContent?: string;
|
|
20
|
+
bootstrapScripts?: string[];
|
|
21
|
+
bootstrapModules?: string[];
|
|
17
22
|
progressiveChunkSize?: number;
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
onError?: (error: unknown) => void;
|
|
21
|
-
onPostpone?: (reason: string) => void;
|
|
22
|
-
environmentName?: string;
|
|
23
|
+
temporaryReferences?: WeakMap<any, any>;
|
|
24
|
+
moduleBaseURL?: string;
|
|
23
25
|
importMap?: {
|
|
24
26
|
imports?: Record<string, string>;
|
|
25
27
|
};
|
|
28
|
+
onError?: (error: Error, errorInfo?: any) => void;
|
|
29
|
+
onPostpone?: (reason: string) => void;
|
|
26
30
|
}
|
|
27
31
|
|
|
28
|
-
//
|
|
29
|
-
export
|
|
30
|
-
chunks: string[];
|
|
31
|
-
complete: boolean;
|
|
32
|
-
rendered: boolean;
|
|
33
|
-
outDir: string;
|
|
34
|
-
moduleRootPath: string;
|
|
35
|
-
moduleBaseURL: string;
|
|
36
|
-
htmlOutputPath: string;
|
|
37
|
-
id: string;
|
|
38
|
-
pipableStreamOptions: PipeableStreamOptions;
|
|
39
|
-
}
|
|
32
|
+
// Combined options type that includes both React DOM and React Server DOM ESM options
|
|
33
|
+
export type SerializeableRenderToPipeableStreamOptions = Omit<RenderToPipeableStreamOptions, "onShellReady" | "onShellError" | "onAllReady" | "onError" | "onPostpone">;
|
|
40
34
|
|
|
41
35
|
export interface RscRenderState {
|
|
42
36
|
id: string;
|
|
@@ -46,7 +40,7 @@ export interface RscRenderState {
|
|
|
46
40
|
rscOutputPath: string;
|
|
47
41
|
componentImport: string;
|
|
48
42
|
propsImport: string;
|
|
49
|
-
|
|
43
|
+
pipeableStreamOptions: ReactServerDomEsmOptions;
|
|
50
44
|
}
|
|
51
45
|
|
|
52
46
|
// Common Messages
|
|
@@ -54,53 +48,262 @@ export interface ShutdownMessage extends WorkerMessage {
|
|
|
54
48
|
type: "SHUTDOWN";
|
|
55
49
|
}
|
|
56
50
|
|
|
51
|
+
export interface ErrorMessage extends WorkerMessage {
|
|
52
|
+
type: "ERROR";
|
|
53
|
+
errorInfo?: any;
|
|
54
|
+
error: string | {
|
|
55
|
+
message: string;
|
|
56
|
+
stack?: string | undefined;
|
|
57
|
+
name: string;
|
|
58
|
+
cause?: any;
|
|
59
|
+
};
|
|
60
|
+
id: string;
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
export interface ChunkProcessedMessage extends WorkerMessage {
|
|
64
|
+
type: "CHUNK_PROCESSED";
|
|
65
|
+
success: boolean;
|
|
66
|
+
sequence?: number;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
export interface ChunkErrorMessage extends WorkerMessage {
|
|
70
|
+
type: "CHUNK_ERROR";
|
|
71
|
+
error: string;
|
|
72
|
+
sequence?: number;
|
|
73
|
+
}
|
|
74
|
+
|
|
57
75
|
// RSC Messages
|
|
58
|
-
export
|
|
76
|
+
export type RscRenderMessage = WorkerMessage & {
|
|
59
77
|
type: "RSC_RENDER";
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
78
|
+
} & Omit<
|
|
79
|
+
CreateHandlerOptions,
|
|
80
|
+
| "onEvent"
|
|
81
|
+
| "onMetrics"
|
|
82
|
+
| "loader"
|
|
83
|
+
| "Html"
|
|
84
|
+
| "CssCollector"
|
|
85
|
+
| "logger"
|
|
86
|
+
| "build"
|
|
87
|
+
| "autoDiscover"
|
|
88
|
+
> & {
|
|
89
|
+
build: Omit<
|
|
90
|
+
CreateHandlerOptions["build"],
|
|
91
|
+
"entryFileNames" | "chunkFileNames" | "assetFileNames" | "pages"
|
|
92
|
+
> & {pages: string[]};
|
|
93
|
+
};
|
|
74
94
|
|
|
75
|
-
export
|
|
95
|
+
export type RscChunkInputMessage = WorkerMessage &{
|
|
96
|
+
type: "RSC_CHUNK";
|
|
97
|
+
chunk: Buffer;
|
|
98
|
+
sequence: number;
|
|
99
|
+
};
|
|
100
|
+
|
|
101
|
+
export type RscChunkOutputMessage = WorkerMessage & {
|
|
76
102
|
type: "RSC_CHUNK";
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
103
|
+
id: string;
|
|
104
|
+
chunk: Buffer;
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export interface RscEndMessage extends WorkerMessage {
|
|
108
|
+
type: "RSC_END";
|
|
109
|
+
id: string;
|
|
83
110
|
}
|
|
84
111
|
|
|
85
|
-
export interface
|
|
112
|
+
export interface RscMetricsMessage extends WorkerMessage {
|
|
113
|
+
type: "RSC_METRICS";
|
|
114
|
+
id: string;
|
|
115
|
+
metrics: StreamMetrics;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
export interface ShellReadyMessage extends WorkerMessage {
|
|
86
119
|
type: "SHELL_READY";
|
|
87
120
|
}
|
|
88
121
|
|
|
89
|
-
export interface
|
|
122
|
+
export interface AllReadyMessage extends WorkerMessage {
|
|
90
123
|
type: "ALL_READY";
|
|
91
|
-
|
|
92
|
-
contents: string;
|
|
124
|
+
id: string;
|
|
93
125
|
}
|
|
94
126
|
|
|
95
|
-
export interface
|
|
96
|
-
type: "
|
|
127
|
+
export interface ShellErrorMessage extends WorkerMessage {
|
|
128
|
+
type: "SHELL_ERROR";
|
|
129
|
+
id: string;
|
|
130
|
+
error: {
|
|
131
|
+
message: string;
|
|
132
|
+
stack?: string | undefined;
|
|
133
|
+
name: string;
|
|
134
|
+
cause?: any;
|
|
135
|
+
};
|
|
97
136
|
}
|
|
98
137
|
|
|
99
|
-
export interface
|
|
100
|
-
type: "
|
|
101
|
-
|
|
138
|
+
export interface CssFileMessage {
|
|
139
|
+
type: "CSS_FILE";
|
|
140
|
+
id: string;
|
|
141
|
+
content: string;
|
|
142
|
+
moduleClasses?: Record<string, string>;
|
|
143
|
+
originalClasses?: Record<string, string>;
|
|
144
|
+
usedClasses?: string[];
|
|
102
145
|
}
|
|
103
146
|
|
|
147
|
+
// Extend the imported CssContent type
|
|
148
|
+
export type ExtendedCssContent = CssContent & {
|
|
149
|
+
usedClasses?: string[];
|
|
150
|
+
};
|
|
151
|
+
|
|
152
|
+
// HTML Worker Messages
|
|
153
|
+
export type HtmlWorkerInputMessage =
|
|
154
|
+
| RscChunkInputMessage
|
|
155
|
+
| RscEndMessage
|
|
156
|
+
| ShutdownMessage
|
|
157
|
+
| {
|
|
158
|
+
type: "CLEANUP";
|
|
159
|
+
id: string;
|
|
160
|
+
}
|
|
161
|
+
| {
|
|
162
|
+
type: "FORCE_CLEANUP";
|
|
163
|
+
id: string;
|
|
164
|
+
}
|
|
165
|
+
| {
|
|
166
|
+
type: "INITIALIZED_REACT_LOADER";
|
|
167
|
+
id: string;
|
|
168
|
+
}
|
|
169
|
+
| {
|
|
170
|
+
type: "INITIALIZED_CSS_LOADER";
|
|
171
|
+
id: string;
|
|
172
|
+
}
|
|
173
|
+
| {
|
|
174
|
+
type: "ACKNOWLEDGE";
|
|
175
|
+
id: string;
|
|
176
|
+
error?: string;
|
|
177
|
+
}
|
|
178
|
+
| {
|
|
179
|
+
type: "HTML_COMPLETE";
|
|
180
|
+
id: string;
|
|
181
|
+
success: boolean;
|
|
182
|
+
html?: string;
|
|
183
|
+
metrics?: StreamMetrics;
|
|
184
|
+
}
|
|
185
|
+
| {
|
|
186
|
+
type: "ROUTE_READY";
|
|
187
|
+
id: string;
|
|
188
|
+
moduleRootPath: string;
|
|
189
|
+
moduleBaseURL: string;
|
|
190
|
+
projectRoot: string;
|
|
191
|
+
cssFiles: Map<string, CssContent>;
|
|
192
|
+
pipeableStreamOptions: Omit<ReactServerDomEsmOptions, "onError" | "onPostpone">;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export type HtmlWorkerOutputMessage =
|
|
196
|
+
| {
|
|
197
|
+
type: "HTML_COMPLETE";
|
|
198
|
+
id: string;
|
|
199
|
+
success: boolean;
|
|
200
|
+
html?: string;
|
|
201
|
+
chunks?: string[];
|
|
202
|
+
metrics?: StreamMetrics;
|
|
203
|
+
}
|
|
204
|
+
| ErrorMessage
|
|
205
|
+
| ShellReadyMessage
|
|
206
|
+
| ChunkProcessedMessage
|
|
207
|
+
| ChunkErrorMessage
|
|
208
|
+
| AllReadyMessage
|
|
209
|
+
| ShellErrorMessage
|
|
210
|
+
| { type: "HTML_CHUNK"; id: string; chunk: string; encoding: string }
|
|
211
|
+
| { type: "CLEANUP_COMPLETE"; id: string }
|
|
212
|
+
| { type: "SHUTDOWN_COMPLETE"; id: string }
|
|
213
|
+
| HmrAcceptMessage;
|
|
214
|
+
|
|
215
|
+
export type InitializedReactLoaderMessage = {
|
|
216
|
+
type: "INITIALIZED_REACT_LOADER";
|
|
217
|
+
id: string;
|
|
218
|
+
port: MessagePort;
|
|
219
|
+
}
|
|
220
|
+
export type InitializedCssLoaderMessage = {
|
|
221
|
+
type: "INITIALIZED_CSS_LOADER";
|
|
222
|
+
id: string;
|
|
223
|
+
port: MessagePort;
|
|
224
|
+
}
|
|
225
|
+
|
|
226
|
+
export type InitializedRscWorkerLoaderMessage = {
|
|
227
|
+
type: "INITIALIZED_RSC_WORKER_LOADER";
|
|
228
|
+
id: string;
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// HMR Messages
|
|
232
|
+
export type HmrMessage = {
|
|
233
|
+
path: string;
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
export type HmrUpdateMessage = HmrMessage & {
|
|
237
|
+
type: "HMR_UPDATE";
|
|
238
|
+
routes?: string[];
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
export type HmrCleanupMessage = HmrMessage & {
|
|
242
|
+
type: "HMR_CLEANUP";
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
export type HmrAcceptMessage = HmrMessage & {
|
|
246
|
+
type: "HMR_ACCEPT";
|
|
247
|
+
routes?: string[];
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// RSC Worker Messages
|
|
251
|
+
export type RscWorkerInputMessage =
|
|
252
|
+
| RscRenderMessage
|
|
253
|
+
| CssFileMessage
|
|
254
|
+
| ShutdownMessage
|
|
255
|
+
| ChunkProcessedMessage
|
|
256
|
+
| ClientComponentMessage
|
|
257
|
+
| InitializedReactLoaderMessage
|
|
258
|
+
| InitializedCssLoaderMessage
|
|
259
|
+
| ModuleRequestMessage
|
|
260
|
+
| InitializedRscWorkerLoaderMessage
|
|
261
|
+
| HmrUpdateMessage
|
|
262
|
+
| HmrAcceptMessage;
|
|
263
|
+
|
|
264
|
+
export interface CssFileRequestMessage extends WorkerMessage {
|
|
265
|
+
type: "CSS_FILE_REQUEST";
|
|
266
|
+
id: string;
|
|
267
|
+
path: string;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
export interface ClientComponentMessage extends WorkerMessage {
|
|
271
|
+
type: "CLIENT_COMPONENT";
|
|
272
|
+
url: string;
|
|
273
|
+
source: string;
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
export interface ModuleRequestMessage extends WorkerMessage {
|
|
277
|
+
type: "MODULE_REQUEST";
|
|
278
|
+
id: string;
|
|
279
|
+
path: string;
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
export interface ModuleResponseMessage extends WorkerMessage {
|
|
283
|
+
type: "MODULE_RESPONSE";
|
|
284
|
+
id: string;
|
|
285
|
+
module: any;
|
|
286
|
+
}
|
|
287
|
+
|
|
288
|
+
export interface CssProcessedMessage extends WorkerMessage {
|
|
289
|
+
type: "CSS_PROCESSED";
|
|
290
|
+
id: string;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
export type RscWorkerOutputMessage =
|
|
294
|
+
| RscChunkOutputMessage
|
|
295
|
+
| RscEndMessage
|
|
296
|
+
| ShellReadyMessage
|
|
297
|
+
| AllReadyMessage
|
|
298
|
+
| ErrorMessage
|
|
299
|
+
| CssFileMessage
|
|
300
|
+
| CssFileRequestMessage
|
|
301
|
+
| ClientComponentMessage
|
|
302
|
+
| ModuleRequestMessage
|
|
303
|
+
| ModuleResponseMessage
|
|
304
|
+
| CssProcessedMessage
|
|
305
|
+
| RscMetricsMessage;
|
|
306
|
+
|
|
104
307
|
export interface ClientReferenceMessage extends WorkerMessage {
|
|
105
308
|
type: "CLIENT_REFERENCE";
|
|
106
309
|
location: string;
|
|
@@ -118,55 +321,51 @@ export interface ServerReferenceMessage extends WorkerMessage {
|
|
|
118
321
|
// HTML Messages
|
|
119
322
|
export interface WorkerRscChunkMessage extends WorkerMessage {
|
|
120
323
|
type: "RSC_CHUNK";
|
|
121
|
-
chunk:
|
|
324
|
+
chunk: ArrayBufferLike;
|
|
122
325
|
moduleRootPath: string;
|
|
123
326
|
moduleBaseURL: string;
|
|
124
|
-
|
|
125
|
-
htmlOutputPath: string;
|
|
126
|
-
pipableStreamOptions: PipeableStreamOptions;
|
|
127
|
-
clientManifest: Manifest;
|
|
128
|
-
serverManifest: Manifest;
|
|
129
|
-
}
|
|
130
|
-
|
|
131
|
-
export interface ShellReadyMessage extends WorkerMessage {
|
|
132
|
-
type: "SHELL_READY";
|
|
327
|
+
pipeableStreamOptions: Omit<ReactServerDomEsmOptions, "onError" | "onPostpone">;
|
|
133
328
|
}
|
|
134
329
|
|
|
135
|
-
export
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
330
|
+
export type BuildWorkerMessage =
|
|
331
|
+
| {
|
|
332
|
+
type: "RUN_BUILD";
|
|
333
|
+
id: string;
|
|
334
|
+
options: {
|
|
335
|
+
root: string;
|
|
336
|
+
outDir: string;
|
|
337
|
+
condition: "react-client" | "react-server";
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
| {
|
|
341
|
+
type: "BUILD_RESULT";
|
|
342
|
+
id: string;
|
|
343
|
+
result:
|
|
344
|
+
| {
|
|
345
|
+
type: "success";
|
|
346
|
+
manifest: string | undefined;
|
|
347
|
+
}
|
|
348
|
+
| {
|
|
349
|
+
type: "error";
|
|
350
|
+
error: Error;
|
|
351
|
+
};
|
|
352
|
+
};
|
|
140
353
|
|
|
141
|
-
export interface
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
354
|
+
export interface TransformResult {
|
|
355
|
+
code: string;
|
|
356
|
+
map?: any;
|
|
357
|
+
modules?: {
|
|
358
|
+
[key: string]: {
|
|
359
|
+
locals: Record<string, string>;
|
|
360
|
+
exports: Record<string, string>;
|
|
361
|
+
};
|
|
362
|
+
};
|
|
146
363
|
}
|
|
147
364
|
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
| ShellReadyMessage
|
|
156
|
-
| AllReadyMessage
|
|
157
|
-
| RscErrorMessage;
|
|
158
|
-
|
|
159
|
-
export type RscWorkerMessage =
|
|
160
|
-
| RscRenderMessage
|
|
161
|
-
| RscChunkMessage
|
|
162
|
-
| RscEndMessage
|
|
163
|
-
| ShutdownMessage
|
|
164
|
-
| ClientReferenceMessage
|
|
165
|
-
| ServerReferenceMessage
|
|
166
|
-
| CssFileMessage;
|
|
167
|
-
|
|
168
|
-
export type RscWorkerResponse =
|
|
169
|
-
| RscShellReadyMessage
|
|
170
|
-
| RscAllReadyMessage
|
|
171
|
-
| RscErrorMessage
|
|
172
|
-
| CssFileMessage;
|
|
365
|
+
export type LoaderMessage = {
|
|
366
|
+
type: "LOADER_PORTS" | "REGISTER_LOADER";
|
|
367
|
+
ports?: Record<string, MessagePort>;
|
|
368
|
+
key?: string;
|
|
369
|
+
port?: MessagePort;
|
|
370
|
+
importMap?: string;
|
|
371
|
+
};
|