vite-plugin-react-server 1.1.20 → 1.2.0-alpha.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 +102 -395
- package/dist/_virtual/dynamic-import-helper.js +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -2
- package/dist/index.js +1 -1
- package/dist/package.json +58 -25
- package/dist/plugin/components/{css-collector-elements.d.ts → css.d.ts} +2 -2
- package/dist/plugin/components/css.d.ts.map +1 -0
- package/dist/plugin/components/css.js +33 -0
- package/dist/plugin/components/html.d.ts +1 -1
- package/dist/plugin/components/html.d.ts.map +1 -1
- package/dist/plugin/components/html.js +5 -5
- package/dist/plugin/components/index.d.ts +3 -3
- package/dist/plugin/components/index.d.ts.map +1 -1
- package/dist/plugin/components/index.js +9 -3
- package/dist/plugin/components/root.d.ts +7 -0
- package/dist/plugin/components/root.d.ts.map +1 -0
- package/dist/plugin/components/root.js +18 -0
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js +1 -1
- package/dist/plugin/config/autoDiscover/customWorkerFiles.js +1 -1
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts +5 -4
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js +26 -7
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts +25 -2
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js +84 -5
- package/dist/plugin/config/createModuleID.d.ts +3 -6
- package/dist/plugin/config/createModuleID.d.ts.map +1 -1
- package/dist/plugin/config/createModuleID.js +42 -32
- package/dist/plugin/config/defaults.d.ts +199 -121
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +155 -89
- package/dist/plugin/config/extMap.d.ts +6 -2
- package/dist/plugin/config/extMap.d.ts.map +1 -1
- package/dist/plugin/config/extMap.js +38 -48
- package/dist/plugin/config/flightBindings.d.ts +4 -0
- package/dist/plugin/config/flightBindings.d.ts.map +1 -0
- package/dist/plugin/config/flightBindings.js +215 -0
- package/dist/plugin/config/getCondition.d.ts +2 -0
- package/dist/plugin/config/getCondition.d.ts.map +1 -1
- package/dist/plugin/config/getCondition.js +4 -2
- package/dist/plugin/config/getPaths.js +1 -1
- package/dist/plugin/config/index.d.ts +17 -4
- package/dist/plugin/config/index.d.ts.map +1 -1
- package/dist/plugin/config/index.js +29 -7
- package/dist/plugin/config/interpolatePattern.d.ts +13 -0
- package/dist/plugin/config/interpolatePattern.d.ts.map +1 -0
- package/dist/plugin/config/interpolatePattern.js +13 -0
- package/dist/plugin/config/mimeTypes.js +1 -1
- package/dist/plugin/config/parsePattern.d.ts +25 -0
- package/dist/plugin/config/parsePattern.d.ts.map +1 -0
- package/dist/plugin/config/parsePattern.js +30 -0
- package/dist/plugin/config/resolveAllowedDirectives.d.ts +26 -0
- package/dist/plugin/config/resolveAllowedDirectives.d.ts.map +1 -0
- package/dist/plugin/config/resolveAllowedDirectives.js +35 -0
- package/dist/plugin/config/resolveDirectiveMatcher.d.ts +25 -0
- package/dist/plugin/config/resolveDirectiveMatcher.d.ts.map +1 -0
- package/dist/plugin/config/resolveDirectiveMatcher.js +33 -0
- package/dist/plugin/config/resolveEnv.d.ts.map +1 -1
- package/dist/plugin/config/resolveEnv.js +14 -4
- package/dist/plugin/config/resolveOptions.d.ts +13 -3
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +228 -206
- package/dist/plugin/config/resolvePages.js +1 -1
- package/dist/plugin/config/resolvePatternWithValues.d.ts +39 -0
- package/dist/plugin/config/resolvePatternWithValues.d.ts.map +1 -0
- package/dist/plugin/config/resolvePatternWithValues.js +36 -0
- package/dist/plugin/config/resolveRegExp.d.ts +29 -0
- package/dist/plugin/config/resolveRegExp.d.ts.map +1 -0
- package/dist/plugin/config/resolveRegExp.js +39 -0
- package/dist/plugin/config/resolveUrlOption.d.ts +37 -6
- package/dist/plugin/config/resolveUrlOption.d.ts.map +1 -1
- package/dist/plugin/config/resolveUrlOption.js +42 -12
- package/dist/plugin/config/resolveUserConfig.d.ts +5 -4
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +86 -40
- package/dist/plugin/env/plugin.d.ts +6 -0
- package/dist/plugin/env/plugin.d.ts.map +1 -1
- package/dist/plugin/env/plugin.js +111 -93
- package/dist/plugin/error/directiveError.d.ts +13 -0
- package/dist/plugin/error/directiveError.d.ts.map +1 -0
- package/dist/plugin/error/directiveError.js +21 -0
- package/dist/plugin/error/enhanceError.d.ts +14 -0
- package/dist/plugin/error/enhanceError.d.ts.map +1 -0
- package/dist/plugin/error/enhanceError.js +24 -0
- package/dist/plugin/error/index.d.ts +4 -0
- package/dist/plugin/error/index.d.ts.map +1 -0
- package/dist/plugin/error/index.js +9 -0
- package/dist/plugin/error/logError.d.ts +3 -0
- package/dist/plugin/error/logError.d.ts.map +1 -0
- package/dist/plugin/error/logError.js +47 -0
- package/dist/plugin/error/serializeError.d.ts +7 -0
- package/dist/plugin/error/serializeError.d.ts.map +1 -0
- package/dist/plugin/error/serializeError.js +37 -0
- package/dist/plugin/error/toError.d.ts +1 -8
- package/dist/plugin/error/toError.d.ts.map +1 -1
- package/dist/plugin/error/toError.js +62 -34
- package/dist/plugin/file-preserver/plugin.js +93 -105
- package/dist/plugin/getNodeEnv.d.ts +11 -0
- package/dist/plugin/getNodeEnv.d.ts.map +1 -0
- package/dist/plugin/getNodeEnv.js +17 -0
- package/dist/plugin/helpers/cleanObject.d.ts.map +1 -1
- package/dist/plugin/helpers/cleanObject.js +2 -1
- package/dist/plugin/helpers/collectManifestCss.js +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts +6 -4
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts.map +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.js +15 -9
- package/dist/plugin/helpers/createCssProps.d.ts +3 -4
- package/dist/plugin/helpers/createCssProps.d.ts.map +1 -1
- package/dist/plugin/helpers/createCssProps.js +16 -4
- package/dist/plugin/helpers/createEventHandler.d.ts +2 -2
- package/dist/plugin/helpers/createEventHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createEventHandler.js +1 -1
- package/dist/plugin/helpers/createHandler.d.ts +10 -8
- package/dist/plugin/helpers/createHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createHandler.js +11 -5
- package/dist/plugin/helpers/createRscStream.d.ts +18 -5
- package/dist/plugin/helpers/createRscStream.d.ts.map +1 -1
- package/dist/plugin/helpers/createRscStream.js +48 -14
- package/dist/plugin/helpers/formatMetrics.d.ts +1 -5
- package/dist/plugin/helpers/formatMetrics.d.ts.map +1 -1
- package/dist/plugin/helpers/formatMetrics.js +2 -39
- package/dist/plugin/helpers/getBundleManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/getBundleManifest.js +9 -2
- package/dist/plugin/helpers/getRouteFiles.d.ts +30 -2
- package/dist/plugin/helpers/getRouteFiles.d.ts.map +1 -1
- package/dist/plugin/helpers/getRouteFiles.js +70 -7
- package/dist/plugin/helpers/handleServerAction.d.ts +8 -7
- package/dist/plugin/helpers/handleServerAction.d.ts.map +1 -1
- package/dist/plugin/helpers/handleServerAction.js +5 -2
- package/dist/plugin/helpers/hydrateUserOptions.d.ts +9 -0
- package/dist/plugin/helpers/hydrateUserOptions.d.ts.map +1 -0
- package/dist/plugin/helpers/hydrateUserOptions.js +22 -0
- package/dist/plugin/helpers/index.d.ts +2 -0
- package/dist/plugin/helpers/index.d.ts.map +1 -1
- package/dist/plugin/helpers/index.js +31 -31
- package/dist/plugin/helpers/inputNormalizer.d.ts +1 -1
- package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -1
- package/dist/plugin/helpers/inputNormalizer.js +33 -20
- package/dist/plugin/helpers/metrics.d.ts +4 -10
- package/dist/plugin/helpers/metrics.d.ts.map +1 -1
- package/dist/plugin/helpers/metrics.js +3 -59
- package/dist/plugin/helpers/moduleRefs.js +1 -1
- package/dist/plugin/helpers/moduleResolver.d.ts +24 -2
- package/dist/plugin/helpers/moduleResolver.d.ts.map +1 -1
- package/dist/plugin/helpers/moduleResolver.js +61 -22
- package/dist/plugin/helpers/requestInfo.d.ts +28 -1
- package/dist/plugin/helpers/requestInfo.d.ts.map +1 -1
- package/dist/plugin/helpers/requestInfo.js +43 -30
- package/dist/plugin/helpers/requestToRoute.d.ts +1 -1
- package/dist/plugin/helpers/requestToRoute.d.ts.map +1 -1
- package/dist/plugin/helpers/requestToRoute.js +17 -9
- package/dist/plugin/helpers/resolveComponent.d.ts +57 -0
- package/dist/plugin/helpers/resolveComponent.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveComponent.js +71 -0
- package/dist/plugin/helpers/resolveComponents.d.ts +27 -0
- package/dist/plugin/helpers/resolveComponents.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveComponents.js +137 -0
- package/dist/plugin/helpers/resolvePage.d.ts +15 -11
- package/dist/plugin/helpers/resolvePage.d.ts.map +1 -1
- package/dist/plugin/helpers/resolvePage.js +11 -7
- package/dist/plugin/helpers/resolvePageAndProps.d.ts +3 -10
- package/dist/plugin/helpers/resolvePageAndProps.d.ts.map +1 -1
- package/dist/plugin/helpers/resolvePageAndProps.js +28 -18
- package/dist/plugin/helpers/resolveProps.d.ts +13 -7
- package/dist/plugin/helpers/resolveProps.d.ts.map +1 -1
- package/dist/plugin/helpers/resolveProps.js +55 -25
- package/dist/plugin/helpers/resolveUserComponents.d.ts +33 -0
- package/dist/plugin/helpers/resolveUserComponents.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveUserComponents.js +163 -0
- package/dist/plugin/helpers/serializeUserOptions.d.ts +7 -7
- package/dist/plugin/helpers/serializeUserOptions.d.ts.map +1 -1
- package/dist/plugin/helpers/serializeUserOptions.js +127 -42
- package/dist/plugin/helpers/stashReturnValue.d.ts +2 -1
- package/dist/plugin/helpers/stashReturnValue.d.ts.map +1 -1
- package/dist/plugin/helpers/stashReturnValue.js +6 -3
- package/dist/plugin/helpers/tryManifest.d.ts +1 -2
- package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/tryManifest.js +1 -1
- package/dist/plugin/loader/createDefaultLoader.d.ts +19 -8
- package/dist/plugin/loader/createDefaultLoader.d.ts.map +1 -1
- package/dist/plugin/loader/createDefaultLoader.js +69 -107
- package/dist/plugin/loader/createTransformer.d.ts +6 -0
- package/dist/plugin/loader/createTransformer.d.ts.map +1 -0
- package/dist/plugin/loader/createTransformer.js +97 -0
- package/dist/plugin/loader/{css-loader.development.d.ts → css-loader.d.ts} +6 -8
- package/dist/plugin/loader/css-loader.d.ts.map +1 -0
- package/dist/plugin/loader/css-loader.js +134 -0
- package/dist/plugin/loader/directives/addLocalExportedNames.d.ts +4 -0
- package/dist/plugin/loader/directives/addLocalExportedNames.d.ts.map +1 -0
- package/dist/plugin/loader/directives/addLocalExportedNames.js +57 -0
- package/dist/plugin/loader/directives/analyzeDirectives.d.ts +9 -0
- package/dist/plugin/loader/directives/analyzeDirectives.d.ts.map +1 -0
- package/dist/plugin/loader/directives/analyzeDirectives.js +221 -0
- package/dist/plugin/loader/directives/analyzeModule.d.ts +11 -0
- package/dist/plugin/loader/directives/analyzeModule.d.ts.map +1 -0
- package/dist/plugin/loader/directives/analyzeModule.js +34 -0
- package/dist/plugin/loader/directives/collectExports.d.ts +13 -0
- package/dist/plugin/loader/directives/collectExports.d.ts.map +1 -0
- package/dist/plugin/loader/directives/collectExports.js +116 -0
- package/dist/plugin/loader/directives/collectExportsFromModule.d.ts +6 -0
- package/dist/plugin/loader/directives/collectExportsFromModule.d.ts.map +1 -0
- package/dist/plugin/loader/directives/collectExportsFromModule.js +24 -0
- package/dist/plugin/loader/directives/findDirectiveMatches.d.ts +3 -0
- package/dist/plugin/loader/directives/findDirectiveMatches.d.ts.map +1 -0
- package/dist/plugin/loader/directives/findDirectiveMatches.js +46 -0
- package/dist/plugin/loader/directives/getExportedName.d.ts +3 -0
- package/dist/plugin/loader/directives/getExportedName.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getExportedName.js +59 -0
- package/dist/plugin/loader/directives/getExports.d.ts +7 -0
- package/dist/plugin/loader/directives/getExports.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getExports.js +28 -0
- package/dist/plugin/loader/directives/getFunctionBody.d.ts +3 -0
- package/dist/plugin/loader/directives/getFunctionBody.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getFunctionBody.js +31 -0
- package/dist/plugin/loader/directives/getFunctionName.d.ts +10 -0
- package/dist/plugin/loader/directives/getFunctionName.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getFunctionName.js +42 -0
- package/dist/plugin/loader/directives/getQualifiedName.d.ts +3 -0
- package/dist/plugin/loader/directives/getQualifiedName.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getQualifiedName.js +65 -0
- package/dist/plugin/loader/directives/index.d.ts +14 -0
- package/dist/plugin/loader/directives/index.d.ts.map +1 -0
- package/dist/plugin/loader/directives/index.js +18 -0
- package/dist/plugin/loader/directives/processFunctionNode.d.ts +4 -0
- package/dist/plugin/loader/directives/processFunctionNode.d.ts.map +1 -0
- package/dist/plugin/loader/directives/processFunctionNode.js +86 -0
- package/dist/plugin/loader/directives/typeGuards.d.ts +37 -0
- package/dist/plugin/loader/directives/typeGuards.d.ts.map +1 -0
- package/dist/plugin/loader/directives/typeGuards.js +100 -0
- package/dist/plugin/loader/directives/types.d.ts +154 -0
- package/dist/plugin/loader/directives/types.d.ts.map +1 -0
- package/dist/plugin/loader/directives/utils.d.ts +14 -0
- package/dist/plugin/loader/directives/utils.d.ts.map +1 -0
- package/dist/plugin/loader/directives/utils.js +21 -0
- package/dist/plugin/loader/env-loader.d.ts +11 -0
- package/dist/plugin/loader/env-loader.d.ts.map +1 -0
- package/dist/plugin/loader/env-loader.js +65 -0
- package/dist/plugin/loader/index.d.ts +8 -1
- package/dist/plugin/loader/index.d.ts.map +1 -1
- package/dist/plugin/loader/index.js +13 -4
- package/dist/plugin/loader/parse.d.ts +11 -2
- package/dist/plugin/loader/parse.d.ts.map +1 -1
- package/dist/plugin/loader/parse.js +29 -6
- package/dist/plugin/loader/react-loader.d.ts +22 -1
- package/dist/plugin/loader/react-loader.d.ts.map +1 -1
- package/dist/plugin/loader/react-loader.js +169 -6
- package/dist/plugin/loader/removeDirectives.d.ts +5 -0
- package/dist/plugin/loader/removeDirectives.d.ts.map +1 -0
- package/dist/plugin/loader/removeDirectives.js +17 -0
- package/dist/plugin/loader/removeRanges.d.ts +5 -0
- package/dist/plugin/loader/removeRanges.d.ts.map +1 -0
- package/dist/plugin/loader/removeRanges.js +20 -0
- package/dist/plugin/loader/sourceMap.d.ts +16 -24
- package/dist/plugin/loader/sourceMap.d.ts.map +1 -1
- package/dist/plugin/loader/sourceMap.js +125 -97
- package/dist/plugin/loader/transformClientModule.d.ts +10 -0
- package/dist/plugin/loader/transformClientModule.d.ts.map +1 -0
- package/dist/plugin/loader/transformClientModule.js +46 -0
- package/dist/plugin/loader/transformModule.d.ts +6 -0
- package/dist/plugin/loader/transformModule.d.ts.map +1 -0
- package/dist/plugin/loader/transformModule.js +33 -0
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts +12 -1
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts.map +1 -1
- package/dist/plugin/loader/transformModuleIfNeeded.js +9 -20
- package/dist/plugin/loader/transformServerModule.d.ts +11 -0
- package/dist/plugin/loader/transformServerModule.d.ts.map +1 -0
- package/dist/plugin/loader/transformServerModule.js +84 -0
- package/dist/plugin/loader/transformWithAcornLoose.d.ts +12 -0
- package/dist/plugin/loader/transformWithAcornLoose.d.ts.map +1 -0
- package/dist/plugin/loader/transformWithAcornLoose.js +18 -0
- package/dist/plugin/loader/types.d.ts +59 -12
- package/dist/plugin/loader/types.d.ts.map +1 -1
- package/dist/plugin/metrics/collectStreamMetrics.d.ts +9 -0
- package/dist/plugin/metrics/collectStreamMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/collectStreamMetrics.js +35 -0
- package/dist/plugin/metrics/createRenderMetrics.d.ts +3 -0
- package/dist/plugin/metrics/createRenderMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/createRenderMetrics.js +24 -0
- package/dist/plugin/metrics/createStreamMetrics.d.ts +3 -0
- package/dist/plugin/metrics/createStreamMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/createStreamMetrics.js +19 -0
- package/dist/plugin/metrics/formatMetrics.d.ts +6 -3
- package/dist/plugin/metrics/formatMetrics.d.ts.map +1 -1
- package/dist/plugin/metrics/formatMetrics.js +5 -2
- package/dist/plugin/metrics/index.d.ts +3 -1
- package/dist/plugin/metrics/index.d.ts.map +1 -1
- package/dist/plugin/metrics/index.js +9 -1
- package/dist/plugin/metrics/types.d.ts +23 -0
- package/dist/plugin/metrics/types.d.ts.map +1 -0
- package/dist/plugin/metrics/types.js +1 -0
- package/dist/plugin/plugin.client.d.ts +23 -2
- package/dist/plugin/plugin.client.d.ts.map +1 -1
- package/dist/plugin/plugin.client.js +30 -17
- package/dist/plugin/plugin.server.d.ts +13 -2
- package/dist/plugin/plugin.server.d.ts.map +1 -1
- package/dist/plugin/plugin.server.js +7 -4
- package/dist/plugin/preserver/plugin.d.ts +2 -2
- package/dist/plugin/preserver/plugin.d.ts.map +1 -1
- package/dist/plugin/preserver/plugin.js +33 -29
- package/dist/plugin/react-client/cleanupWorkerServerAction.d.ts +11 -0
- package/dist/plugin/react-client/cleanupWorkerServerAction.d.ts.map +1 -0
- package/dist/plugin/react-client/cleanupWorkerServerAction.js +18 -0
- package/dist/plugin/react-client/configureWorkerRequestHandler.d.ts +9 -9
- package/dist/plugin/react-client/configureWorkerRequestHandler.d.ts.map +1 -1
- package/dist/plugin/react-client/configureWorkerRequestHandler.js +25 -14
- package/dist/plugin/react-client/createMessageHandlers.d.ts +1 -1
- package/dist/plugin/react-client/createMessageHandlers.d.ts.map +1 -1
- package/dist/plugin/react-client/createMessageHandlers.js +15 -3
- package/dist/plugin/react-client/createWorkerStream.d.ts +12 -10
- package/dist/plugin/react-client/createWorkerStream.d.ts.map +1 -1
- package/dist/plugin/react-client/createWorkerStream.js +27 -29
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts +13 -8
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts.map +1 -1
- package/dist/plugin/react-client/handleWorkerRscStream.js +59 -24
- package/dist/plugin/react-client/handleWorkerServerAction.d.ts +2 -1
- package/dist/plugin/react-client/handleWorkerServerAction.d.ts.map +1 -1
- package/dist/plugin/react-client/handleWorkerServerAction.js +43 -28
- package/dist/plugin/react-client/index.d.ts +4 -1
- package/dist/plugin/react-client/index.d.ts.map +1 -1
- package/dist/plugin/react-client/index.js +10 -1
- package/dist/plugin/react-client/plugin.d.ts +5 -3
- package/dist/plugin/react-client/plugin.d.ts.map +1 -1
- package/dist/plugin/react-client/plugin.js +9 -11
- package/dist/plugin/react-client/restartWorker.d.ts +5 -4
- package/dist/plugin/react-client/restartWorker.d.ts.map +1 -1
- package/dist/plugin/react-client/restartWorker.js +12 -10
- package/dist/plugin/react-server/configureReactServer.d.ts +5 -4
- package/dist/plugin/react-server/configureReactServer.d.ts.map +1 -1
- package/dist/plugin/react-server/configureReactServer.js +98 -43
- package/dist/plugin/react-server/handleServerAction.d.ts +3 -2
- package/dist/plugin/react-server/handleServerAction.d.ts.map +1 -1
- package/dist/plugin/react-server/handleServerAction.js +14 -20
- package/dist/plugin/react-server/plugin.d.ts +3 -4
- package/dist/plugin/react-server/plugin.d.ts.map +1 -1
- package/dist/plugin/react-server/plugin.js +14 -17
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts +8 -6
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts.map +1 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.js +4 -4
- package/dist/plugin/react-static/collectRscContent.d.ts +8 -6
- package/dist/plugin/react-static/collectRscContent.d.ts.map +1 -1
- package/dist/plugin/react-static/collectRscContent.js +4 -4
- package/dist/plugin/react-static/configurePreviewServer.d.ts +6 -4
- package/dist/plugin/react-static/configurePreviewServer.d.ts.map +1 -1
- package/dist/plugin/react-static/configurePreviewServer.js +38 -31
- package/dist/plugin/react-static/createBuildLoader.d.ts +5 -5
- package/dist/plugin/react-static/createBuildLoader.d.ts.map +1 -1
- package/dist/plugin/react-static/createBuildLoader.js +122 -30
- package/dist/plugin/react-static/fileWriter.js +1 -1
- package/dist/plugin/react-static/plugin.d.ts +3 -4
- package/dist/plugin/react-static/plugin.d.ts.map +1 -1
- package/dist/plugin/react-static/plugin.js +62 -47
- package/dist/plugin/react-static/renderPage.d.ts +4 -2
- package/dist/plugin/react-static/renderPage.d.ts.map +1 -1
- package/dist/plugin/react-static/renderPage.js +33 -17
- package/dist/plugin/react-static/renderPages.d.ts +4 -2
- package/dist/plugin/react-static/renderPages.d.ts.map +1 -1
- package/dist/plugin/react-static/renderPages.js +7 -6
- package/dist/plugin/react-static/renderStreams.d.ts +5 -22
- package/dist/plugin/react-static/renderStreams.d.ts.map +1 -1
- package/dist/plugin/react-static/renderStreams.js +6 -6
- package/dist/plugin/react-static/rscToHtmlStream.d.ts.map +1 -1
- package/dist/plugin/react-static/rscToHtmlStream.js +1 -1
- package/dist/plugin/react-static/temporaryReferences.js +1 -1
- package/dist/plugin/react-static/types.d.ts +0 -1
- package/dist/plugin/react-static/types.d.ts.map +1 -1
- package/dist/plugin/root.js +1 -1
- package/dist/plugin/transformer/plugin.js +1 -1
- package/dist/plugin/transformer/plugin.server.d.ts +5 -3
- package/dist/plugin/transformer/plugin.server.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.server.js +43 -44
- package/dist/plugin/types/css-tracking.d.ts +2 -2
- package/dist/plugin/types/css-tracking.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +452 -192
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/types.js +2 -1
- package/dist/plugin/utils/callServer.js +1 -1
- package/dist/plugin/utils/createCallServer.d.ts +1 -1
- package/dist/plugin/utils/createCallServer.d.ts.map +1 -1
- package/dist/plugin/utils/createCallServer.js +1 -1
- package/dist/plugin/utils/createReactFetcher.d.ts +2 -3
- package/dist/plugin/utils/createReactFetcher.d.ts.map +1 -1
- package/dist/plugin/utils/createReactFetcher.js +1 -1
- package/dist/plugin/utils/env.js +1 -1
- package/dist/plugin/utils/envUrls.node.js +1 -1
- package/dist/plugin/utils/index.d.ts +1 -0
- package/dist/plugin/utils/index.d.ts.map +1 -1
- package/dist/plugin/utils/index.js +12 -5
- package/dist/plugin/utils/routeToURL.d.ts +12 -0
- package/dist/plugin/utils/routeToURL.d.ts.map +1 -0
- package/dist/plugin/utils/routeToURL.js +26 -0
- package/dist/plugin/utils/urls.d.ts.map +1 -1
- package/dist/plugin/utils/urls.js +5 -3
- package/dist/plugin/vendor/index.js +7 -1
- package/dist/plugin/vendor/vendor.client.js +1 -1
- package/dist/plugin/vendor/vendor.js +1 -1
- package/dist/plugin/vendor/vendor.server.js +1 -1
- package/dist/plugin/worker/createWorker.d.ts +31 -17
- package/dist/plugin/worker/createWorker.d.ts.map +1 -1
- package/dist/plugin/worker/createWorker.js +18 -12
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts +2 -2
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts.map +1 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js +5 -2
- package/dist/plugin/worker/html/html-worker.development.js +3 -3
- package/dist/plugin/worker/html/html-worker.production.js +1 -1
- package/dist/plugin/worker/html/index.d.ts +1 -1
- package/dist/plugin/worker/html/index.d.ts.map +1 -1
- package/dist/plugin/worker/html/index.js +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.js +9 -11
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.d.ts +3 -0
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.d.ts.map +1 -0
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.js +2 -0
- package/dist/plugin/worker/html/types.d.ts +20 -2
- package/dist/plugin/worker/html/types.d.ts.map +1 -1
- package/dist/plugin/worker/index.d.ts +3 -0
- package/dist/plugin/worker/index.d.ts.map +1 -0
- package/dist/plugin/worker/index.js +7 -0
- package/dist/plugin/worker/registerLoaders.js +2 -2
- package/dist/plugin/worker/rsc/handleRender.d.ts +4 -3
- package/dist/plugin/worker/rsc/handleRender.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handleRender.js +54 -32
- package/dist/plugin/worker/rsc/handlers.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handlers.js +19 -15
- package/dist/plugin/worker/rsc/index.d.ts +1 -1
- package/dist/plugin/worker/rsc/index.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/index.js +1 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts +1 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.js +16 -4
- package/dist/plugin/worker/rsc/rsc-worker.development.js +77 -11
- package/dist/plugin/worker/rsc/rsc-worker.production.js +1 -1
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.d.ts +3 -0
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.js +11 -0
- package/dist/plugin/worker/rsc/state.js +1 -1
- package/dist/plugin/worker/rsc/types.d.ts +95 -0
- package/dist/plugin/worker/rsc/types.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/types.js +1 -0
- package/dist/plugin/worker/rsc/userOptions.d.ts +1 -1
- package/dist/plugin/worker/rsc/userOptions.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/userOptions.js +3 -4
- package/dist/plugin/worker/sendMessage.d.ts +3 -4
- package/dist/plugin/worker/sendMessage.d.ts.map +1 -1
- package/dist/plugin/worker/sendMessage.js +15 -5
- package/dist/plugin/worker/types.d.ts +109 -260
- package/dist/plugin/worker/types.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +58 -25
- package/plugin/components/{css-collector-elements.tsx → css.tsx} +3 -3
- package/plugin/components/html.tsx +4 -4
- package/plugin/components/index.ts +3 -3
- package/plugin/components/root.tsx +20 -0
- package/plugin/config/autoDiscover/resolveAutoDiscover.ts +173 -134
- package/plugin/config/autoDiscover/resolveBuildPages.ts +120 -7
- package/plugin/config/createModuleID.ts +60 -39
- package/plugin/config/defaults.tsx +184 -95
- package/plugin/config/extMap.ts +51 -56
- package/plugin/config/flightBindings.ts +221 -0
- package/plugin/config/getCondition.ts +6 -0
- package/plugin/config/index.ts +17 -4
- package/plugin/config/interpolatePattern.ts +19 -0
- package/plugin/config/parsePattern.ts +81 -0
- package/plugin/config/resolveAllowedDirectives.ts +59 -0
- package/plugin/config/resolveDirectiveMatcher.ts +57 -0
- package/plugin/config/resolveEnv.ts +5 -10
- package/plugin/config/resolveOptions.ts +415 -299
- package/plugin/config/resolvePatternWithValues.ts +70 -0
- package/plugin/config/resolveRegExp.ts +89 -0
- package/plugin/config/resolveUrlOption.ts +92 -20
- package/plugin/config/resolveUserConfig.ts +417 -351
- package/plugin/env/plugin.ts +71 -7
- package/plugin/error/directiveError.ts +29 -0
- package/plugin/error/enhanceError.ts +41 -0
- package/plugin/error/index.ts +3 -0
- package/plugin/error/logError.ts +45 -0
- package/plugin/error/serializeError.ts +34 -0
- package/plugin/error/toError.ts +75 -45
- package/plugin/file-preserver/plugin.ts +3 -3
- package/plugin/getNodeEnv.ts +24 -0
- package/plugin/helpers/cleanObject.ts +2 -1
- package/plugin/helpers/collectViteModuleGraphCss.ts +138 -118
- package/plugin/helpers/createCssProps.tsx +41 -20
- package/plugin/helpers/createEventHandler.ts +1 -1
- package/plugin/helpers/createHandler.ts +40 -12
- package/plugin/helpers/createRscStream.tsx +97 -35
- package/plugin/helpers/formatMetrics.ts +2 -37
- package/plugin/helpers/getBundleManifest.ts +10 -1
- package/plugin/helpers/getRouteFiles.ts +112 -8
- package/plugin/helpers/handleServerAction.ts +10 -6
- package/plugin/helpers/hydrateUserOptions.ts +23 -0
- package/plugin/helpers/index.ts +4 -0
- package/plugin/helpers/inputNormalizer.ts +44 -24
- package/plugin/helpers/metrics.ts +4 -64
- package/plugin/helpers/moduleResolver.ts +74 -19
- package/plugin/helpers/requestInfo.ts +72 -52
- package/plugin/helpers/requestToRoute.ts +38 -12
- package/plugin/helpers/resolveComponent.ts +173 -0
- package/plugin/helpers/resolveComponents.ts +185 -0
- package/plugin/helpers/resolvePage.ts +35 -29
- package/plugin/helpers/resolvePageAndProps.ts +82 -61
- package/plugin/helpers/resolveProps.ts +100 -37
- package/plugin/helpers/resolveUserComponents.ts +190 -0
- package/plugin/helpers/serializeUserOptions.ts +190 -69
- package/plugin/helpers/stashReturnValue.ts +7 -4
- package/plugin/helpers/tryManifest.ts +1 -1
- package/plugin/loader/createDefaultLoader.ts +119 -119
- package/plugin/loader/createTransformer.ts +118 -0
- package/plugin/loader/css-loader.ts +206 -0
- package/plugin/loader/directives/addLocalExportedNames.ts +78 -0
- package/plugin/loader/directives/analyzeDirectives.ts +298 -0
- package/plugin/loader/directives/analyzeModule.ts +39 -0
- package/plugin/loader/directives/collectExports.ts +181 -0
- package/plugin/loader/directives/collectExportsFromModule.ts +25 -0
- package/plugin/loader/directives/findDirectiveMatches.ts +58 -0
- package/plugin/loader/directives/getExportedName.ts +73 -0
- package/plugin/loader/directives/getExports.ts +27 -0
- package/plugin/loader/directives/getFunctionBody.ts +32 -0
- package/plugin/loader/directives/getFunctionName.ts +70 -0
- package/plugin/loader/directives/getQualifiedName.ts +76 -0
- package/plugin/loader/directives/index.ts +13 -0
- package/plugin/loader/directives/processFunctionNode.ts +97 -0
- package/plugin/loader/directives/typeGuards.ts +160 -0
- package/plugin/loader/directives/types.ts +174 -0
- package/plugin/loader/directives/utils.ts +35 -0
- package/plugin/loader/{env-loader.development.ts → env-loader.ts} +8 -22
- package/plugin/loader/index.ts +8 -6
- package/plugin/loader/parse.ts +42 -12
- package/plugin/loader/react-loader.ts +255 -4
- package/plugin/loader/removeDirectives.ts +14 -0
- package/plugin/loader/removeRanges.ts +21 -0
- package/plugin/loader/sourceMap.ts +174 -84
- package/plugin/loader/transformClientModule.ts +64 -0
- package/plugin/loader/transformModule.ts +54 -0
- package/plugin/loader/transformModuleIfNeeded.ts +40 -40
- package/plugin/loader/transformServerModule.ts +136 -0
- package/plugin/loader/transformWithAcornLoose.ts +27 -0
- package/plugin/loader/types.ts +65 -13
- package/plugin/metrics/collectStreamMetrics.ts +38 -0
- package/plugin/metrics/createRenderMetrics.ts +17 -0
- package/plugin/metrics/createStreamMetrics.ts +14 -0
- package/plugin/metrics/formatMetrics.ts +7 -3
- package/plugin/metrics/index.ts +3 -1
- package/plugin/metrics/types.ts +24 -0
- package/plugin/plugin.client.ts +39 -15
- package/plugin/plugin.server.ts +39 -18
- package/plugin/preserver/plugin.ts +42 -42
- package/plugin/react-client/cleanupWorkerServerAction.ts +33 -0
- package/plugin/react-client/configureWorkerRequestHandler.ts +212 -201
- package/plugin/react-client/createMessageHandlers.ts +17 -3
- package/plugin/react-client/createWorkerStream.ts +55 -51
- package/plugin/react-client/handleWorkerRscStream.ts +141 -61
- package/plugin/react-client/handleWorkerServerAction.ts +59 -37
- package/plugin/react-client/index.ts +4 -1
- package/plugin/react-client/plugin.ts +17 -18
- package/plugin/react-client/restartWorker.ts +75 -70
- package/plugin/react-server/configureReactServer.ts +200 -142
- package/plugin/react-server/handleServerAction.ts +156 -160
- package/plugin/react-server/plugin.ts +18 -25
- package/plugin/react-static/collectHtmlWorkerContent.ts +109 -102
- package/plugin/react-static/collectRscContent.ts +55 -51
- package/plugin/react-static/configurePreviewServer.ts +110 -100
- package/plugin/react-static/createBuildLoader.ts +157 -48
- package/plugin/react-static/plugin.ts +368 -357
- package/plugin/react-static/renderPage.ts +43 -24
- package/plugin/react-static/renderPages.ts +21 -14
- package/plugin/react-static/renderStreams.ts +13 -15
- package/plugin/react-static/rscToHtmlStream.ts +4 -6
- package/plugin/react-static/types.ts +0 -3
- package/plugin/transformer/README.md +82 -8
- package/plugin/transformer/plugin.server.ts +55 -82
- package/plugin/types/css-tracking.ts +1 -1
- package/plugin/types/global.d.ts +2 -2
- package/plugin/types/react-server-dom-esm.d.ts +12 -13
- package/plugin/types.ts +685 -309
- package/plugin/utils/createCallServer.ts +5 -5
- package/plugin/utils/createReactFetcher.ts +4 -6
- package/plugin/utils/index.ts +2 -1
- package/plugin/utils/routeToURL.ts +34 -0
- package/plugin/utils/urls.ts +9 -6
- package/plugin/worker/createWorker.ts +67 -34
- package/plugin/worker/html/README.md +10 -0
- package/plugin/worker/html/createHtmlWorkerRenderState.tsx +7 -4
- package/plugin/worker/html/html-worker.development.tsx +4 -3
- package/plugin/worker/html/index.ts +3 -1
- package/plugin/worker/html/messageHandler.tsx +10 -16
- package/plugin/worker/html/sendHtmlWorkerMessage.ts +8 -0
- package/plugin/worker/html/types.ts +67 -1
- package/plugin/worker/index.ts +2 -0
- package/plugin/worker/registerLoaders.ts +3 -3
- package/plugin/worker/rsc/README.md +203 -1
- package/plugin/worker/rsc/handleRender.ts +76 -39
- package/plugin/worker/rsc/handlers.ts +30 -22
- package/plugin/worker/rsc/index.ts +2 -0
- package/plugin/worker/rsc/messageHandler.tsx +17 -10
- package/plugin/worker/rsc/rsc-worker.development.ts +104 -17
- package/plugin/worker/rsc/sendRscWorkerMessage.ts +7 -0
- package/plugin/worker/rsc/state.ts +1 -1
- package/plugin/worker/rsc/types.ts +185 -0
- package/plugin/worker/rsc/userOptions.ts +2 -3
- package/plugin/worker/sendMessage.ts +23 -14
- package/plugin/worker/types.ts +131 -386
- package/scripts/check-react-version.mjs +3 -3
- package/scripts/fix-unused-imports.mjs +77 -0
- package/tsconfig.json +1 -1
- package/dist/_virtual/dynamic-import-helper.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/plugin/components/css-collector-elements.d.ts.map +0 -1
- package/dist/plugin/components/css-collector-elements.js +0 -33
- package/dist/plugin/components/css-collector-elements.js.map +0 -1
- package/dist/plugin/components/css-collector.d.ts +0 -7
- package/dist/plugin/components/css-collector.d.ts.map +0 -1
- package/dist/plugin/components/css-collector.js +0 -18
- package/dist/plugin/components/css-collector.js.map +0 -1
- package/dist/plugin/components/html.js.map +0 -1
- package/dist/plugin/components.js +0 -9
- package/dist/plugin/components.js.map +0 -1
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js.map +0 -1
- package/dist/plugin/config/autoDiscover/customWorkerFiles.js.map +0 -1
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js.map +0 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js.map +0 -1
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js.map +0 -1
- package/dist/plugin/config/defaults.js.map +0 -1
- package/dist/plugin/config/extMap.js.map +0 -1
- package/dist/plugin/config/getCondition.js.map +0 -1
- package/dist/plugin/config/getPaths.js.map +0 -1
- package/dist/plugin/config/mimeTypes.js.map +0 -1
- package/dist/plugin/config/resolveAutoDiscoverMatcher.d.ts +0 -5
- package/dist/plugin/config/resolveAutoDiscoverMatcher.d.ts.map +0 -1
- package/dist/plugin/config/resolveAutoDiscoverMatcher.js +0 -25
- package/dist/plugin/config/resolveAutoDiscoverMatcher.js.map +0 -1
- package/dist/plugin/config/resolveEnv.js.map +0 -1
- package/dist/plugin/config/resolveOptions.js.map +0 -1
- package/dist/plugin/config/resolvePages.js.map +0 -1
- package/dist/plugin/config/resolveUrlOption.js.map +0 -1
- package/dist/plugin/config/resolveUserConfig.js.map +0 -1
- package/dist/plugin/config.js +0 -17
- package/dist/plugin/config.js.map +0 -1
- package/dist/plugin/env.js +0 -79
- package/dist/plugin/env.js.map +0 -1
- package/dist/plugin/error/toError.js.map +0 -1
- package/dist/plugin/file-preserver.js +0 -96
- package/dist/plugin/file-preserver.js.map +0 -1
- package/dist/plugin/helpers/cleanObject.js.map +0 -1
- package/dist/plugin/helpers/collectManifestCss.js.map +0 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.js.map +0 -1
- package/dist/plugin/helpers/createCssProps.js.map +0 -1
- package/dist/plugin/helpers/createEventHandler.js.map +0 -1
- package/dist/plugin/helpers/createHandler.js.map +0 -1
- package/dist/plugin/helpers/createRscStream.js.map +0 -1
- package/dist/plugin/helpers/formatMetrics.js.map +0 -1
- package/dist/plugin/helpers/getBundleManifest.js.map +0 -1
- package/dist/plugin/helpers/getRouteFiles.js.map +0 -1
- package/dist/plugin/helpers/handleServerAction.js.map +0 -1
- package/dist/plugin/helpers/inputNormalizer.js.map +0 -1
- package/dist/plugin/helpers/metrics.js.map +0 -1
- package/dist/plugin/helpers/moduleRefs.js.map +0 -1
- package/dist/plugin/helpers/requestInfo.js.map +0 -1
- package/dist/plugin/helpers/requestToRoute.js.map +0 -1
- package/dist/plugin/helpers/resolvePage.js.map +0 -1
- package/dist/plugin/helpers/resolvePageAndProps.js.map +0 -1
- package/dist/plugin/helpers/resolveProps.js.map +0 -1
- package/dist/plugin/helpers/serializeUserOptions.js.map +0 -1
- package/dist/plugin/helpers/sourceMap.d.ts +0 -8
- package/dist/plugin/helpers/sourceMap.d.ts.map +0 -1
- package/dist/plugin/helpers/sourceMap.js +0 -136
- package/dist/plugin/helpers/stashReturnValue.js.map +0 -1
- package/dist/plugin/helpers/tryManifest.js.map +0 -1
- package/dist/plugin/helpers.js +0 -27
- package/dist/plugin/helpers.js.map +0 -1
- package/dist/plugin/loader/css-loader.development.d.ts.map +0 -1
- package/dist/plugin/loader/css-loader.development.js +0 -76
- package/dist/plugin/loader/css-loader.development.js.map +0 -1
- package/dist/plugin/loader/css-loader.production.d.ts +0 -31
- package/dist/plugin/loader/css-loader.production.d.ts.map +0 -1
- package/dist/plugin/loader/css-loader.production.js +0 -45
- package/dist/plugin/loader/css-loader.production.js.map +0 -1
- package/dist/plugin/loader/env-loader.development.d.ts +0 -13
- package/dist/plugin/loader/env-loader.development.d.ts.map +0 -1
- package/dist/plugin/loader/env-loader.development.js +0 -68
- package/dist/plugin/loader/handleExports.d.ts +0 -40
- package/dist/plugin/loader/handleExports.d.ts.map +0 -1
- package/dist/plugin/loader/handleExports.js +0 -209
- package/dist/plugin/loader/handleExports.js.map +0 -1
- package/dist/plugin/loader/parse.js.map +0 -1
- package/dist/plugin/loader/react-loader.client.d.ts +0 -2
- package/dist/plugin/loader/react-loader.client.d.ts.map +0 -1
- package/dist/plugin/loader/react-loader.client.js +0 -2
- package/dist/plugin/loader/react-loader.js.map +0 -1
- package/dist/plugin/loader/react-loader.server.d.ts +0 -21
- package/dist/plugin/loader/react-loader.server.d.ts.map +0 -1
- package/dist/plugin/loader/react-loader.server.js +0 -131
- package/dist/plugin/loader/transformModuleIfNeeded.js.map +0 -1
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.d.ts +0 -48
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.d.ts.map +0 -1
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.js +0 -428
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.js.map +0 -1
- package/dist/plugin/metrics/formatMetrics.js.map +0 -1
- package/dist/plugin/metrics.js +0 -7
- package/dist/plugin/metrics.js.map +0 -1
- package/dist/plugin/plugin.client.js.map +0 -1
- package/dist/plugin/plugin.server.js.map +0 -1
- package/dist/plugin/preserver/plugin.js.map +0 -1
- package/dist/plugin/react-client/configureWorkerRequestHandler.js.map +0 -1
- package/dist/plugin/react-client/createMessageHandlers.js.map +0 -1
- package/dist/plugin/react-client/createWorkerStream.js.map +0 -1
- package/dist/plugin/react-client/handleWorkerRscStream.js.map +0 -1
- package/dist/plugin/react-client/handleWorkerServerAction.js.map +0 -1
- package/dist/plugin/react-client/plugin.js.map +0 -1
- package/dist/plugin/react-client/restartWorker.js.map +0 -1
- package/dist/plugin/react-server/configureReactServer.js.map +0 -1
- package/dist/plugin/react-server/handleServerAction.js.map +0 -1
- package/dist/plugin/react-server/plugin.js.map +0 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.js.map +0 -1
- package/dist/plugin/react-static/collectRscContent.js.map +0 -1
- package/dist/plugin/react-static/configurePreviewServer.js.map +0 -1
- package/dist/plugin/react-static/createBuildLoader.js.map +0 -1
- package/dist/plugin/react-static/fileWriter.js.map +0 -1
- package/dist/plugin/react-static/plugin.js.map +0 -1
- package/dist/plugin/react-static/renderPage.js.map +0 -1
- package/dist/plugin/react-static/renderPages.js.map +0 -1
- package/dist/plugin/react-static/renderStreams.js.map +0 -1
- package/dist/plugin/react-static/rscToHtmlStream.js.map +0 -1
- package/dist/plugin/react-static/temporaryReferences.js.map +0 -1
- package/dist/plugin/root.js.map +0 -1
- package/dist/plugin/source-map/createMappingsSerializer.d.ts +0 -2
- package/dist/plugin/source-map/createMappingsSerializer.d.ts.map +0 -1
- package/dist/plugin/source-map/createMappingsSerializer.js +0 -129
- package/dist/plugin/source-map/createMappingsSerializer.js.map +0 -1
- package/dist/plugin/source-map/readMappings.d.ts +0 -2
- package/dist/plugin/source-map/readMappings.d.ts.map +0 -1
- package/dist/plugin/source-map/readMappings.js +0 -200
- package/dist/plugin/transformer/plugin.client.d.ts +0 -2
- package/dist/plugin/transformer/plugin.client.d.ts.map +0 -1
- package/dist/plugin/transformer/plugin.js.map +0 -1
- package/dist/plugin/transformer/plugin.server.js.map +0 -1
- package/dist/plugin/utils/callServer.js.map +0 -1
- package/dist/plugin/utils/createCallServer.js.map +0 -1
- package/dist/plugin/utils/createReactFetcher.js.map +0 -1
- package/dist/plugin/utils/env.js.map +0 -1
- package/dist/plugin/utils/envUrls.node.js.map +0 -1
- package/dist/plugin/utils/urls.js.map +0 -1
- package/dist/plugin/utils.js +0 -11
- package/dist/plugin/utils.js.map +0 -1
- package/dist/plugin/vendor/vendor.client.js.map +0 -1
- package/dist/plugin/vendor/vendor.js.map +0 -1
- package/dist/plugin/vendor/vendor.server.js.map +0 -1
- package/dist/plugin/vendor.js +0 -7
- package/dist/plugin/vendor.js.map +0 -1
- package/dist/plugin/worker/createWorker.js.map +0 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js.map +0 -1
- package/dist/plugin/worker/html/html-worker.development.js.map +0 -1
- package/dist/plugin/worker/html/html-worker.production.js.map +0 -1
- package/dist/plugin/worker/html/index.js.map +0 -1
- package/dist/plugin/worker/html/messageHandler.js.map +0 -1
- package/dist/plugin/worker/rsc/handleRender.js.map +0 -1
- package/dist/plugin/worker/rsc/handlers.js.map +0 -1
- package/dist/plugin/worker/rsc/index.js.map +0 -1
- package/dist/plugin/worker/rsc/messageHandler.js.map +0 -1
- package/dist/plugin/worker/rsc/rsc-worker.development.js.map +0 -1
- package/dist/plugin/worker/rsc/rsc-worker.production.js.map +0 -1
- package/dist/plugin/worker/rsc/state.js.map +0 -1
- package/dist/plugin/worker/rsc/userOptions.js.map +0 -1
- package/dist/plugin/worker/sendMessage.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/plugin/components/css-collector.tsx +0 -20
- package/plugin/config/resolveAutoDiscoverMatcher.ts +0 -23
- package/plugin/helpers/sourceMap.ts +0 -182
- package/plugin/loader/css-loader.development.ts +0 -135
- package/plugin/loader/css-loader.production.ts +0 -84
- package/plugin/loader/handleExports.ts +0 -309
- package/plugin/loader/react-loader.client.ts +0 -1
- package/plugin/loader/react-loader.server.ts +0 -185
- package/plugin/loader/transformModuleWithPreservedFunctions.ts +0 -593
- package/plugin/source-map/createMappingsSerializer.ts +0 -181
- package/plugin/source-map/readMappings.ts +0 -194
- package/plugin/transformer/plugin.client.ts +0 -0
- /package/dist/plugin/{transformer/plugin.client.js → loader/directives/types.js} +0 -0
|
@@ -15,13 +15,8 @@
|
|
|
15
15
|
*/
|
|
16
16
|
|
|
17
17
|
import { join } from "node:path";
|
|
18
|
-
import { Worker } from "node:worker_threads";
|
|
19
|
-
import {
|
|
20
|
-
type Manifest,
|
|
21
|
-
type ResolvedConfig,
|
|
22
|
-
type Plugin as VitePlugin,
|
|
23
|
-
createLogger,
|
|
24
|
-
} from "vite";
|
|
18
|
+
import type { Worker } from "node:worker_threads";
|
|
19
|
+
import { type Manifest, type ResolvedConfig, createLogger } from "vite";
|
|
25
20
|
import { resolveOptions } from "../config/resolveOptions.js";
|
|
26
21
|
import { resolveUserConfig } from "../config/resolveUserConfig.js";
|
|
27
22
|
import { createBuildLoader } from "./createBuildLoader.js";
|
|
@@ -29,20 +24,16 @@ import type {
|
|
|
29
24
|
BuildTiming,
|
|
30
25
|
ReactStreamPluginMeta,
|
|
31
26
|
ResolvedUserConfig,
|
|
32
|
-
ResolvedUserOptions,
|
|
33
27
|
PluginEvent,
|
|
34
28
|
RenderPagesResult,
|
|
35
29
|
AutoDiscoveredFiles,
|
|
36
30
|
CssContent,
|
|
37
|
-
|
|
38
|
-
InlineCssOpt,
|
|
31
|
+
ReactStreamPluginFn,
|
|
39
32
|
} from "../types.js";
|
|
40
|
-
import { type StreamPluginOptions } from "../types.js";
|
|
41
33
|
import { renderPages } from "./renderPages.js";
|
|
42
34
|
import { getBundleManifest } from "../helpers/getBundleManifest.js";
|
|
43
35
|
import { createWorker } from "../worker/createWorker.js";
|
|
44
36
|
import { resolveAutoDiscover } from "../config/autoDiscover/resolveAutoDiscover.js";
|
|
45
|
-
import { getCondition } from "../config/getCondition.js";
|
|
46
37
|
import {
|
|
47
38
|
serializedOptions,
|
|
48
39
|
serializeResolvedConfig,
|
|
@@ -53,386 +44,406 @@ import { performance } from "node:perf_hooks";
|
|
|
53
44
|
import { DEFAULT_CONFIG } from "../config/defaults.js";
|
|
54
45
|
import { baseURL } from "../utils/envUrls.node.js";
|
|
55
46
|
import { readFile } from "node:fs/promises";
|
|
47
|
+
import { logError } from "../error/logError.js";
|
|
48
|
+
import { toError } from "../error/toError.js";
|
|
49
|
+
import { createDefaultModuleID } from "../config/createModuleID.js";
|
|
56
50
|
|
|
57
|
-
if (getCondition() !== "react-server") {
|
|
58
|
-
throw new Error(
|
|
59
|
-
"Condition mismatch, should be react-server but got " +
|
|
60
|
-
process.env["NODE_OPTIONS"]
|
|
61
|
-
);
|
|
62
|
-
}
|
|
63
51
|
|
|
64
|
-
export
|
|
65
|
-
T extends PagePropOpt = PagePropOpt,
|
|
66
|
-
InlineCSS extends InlineCssOpt = InlineCssOpt
|
|
67
|
-
>(
|
|
68
|
-
options: StreamPluginOptions<T, InlineCSS>
|
|
69
|
-
): VitePlugin<{
|
|
52
|
+
export type ReactStaticPluginFn = ReactStreamPluginFn<{
|
|
70
53
|
meta: ReactStreamPluginMeta;
|
|
71
|
-
}
|
|
72
|
-
let worker: Worker;
|
|
73
|
-
let userConfig: ResolvedUserConfig;
|
|
74
|
-
let resolvedConfig: ResolvedConfig;
|
|
75
|
-
let userOptions: ResolvedUserOptions<T, InlineCSS>;
|
|
76
|
-
let autoDiscoveredFiles: AutoDiscoveredFiles | null = null;
|
|
77
|
-
let serverManifest: Manifest | undefined = undefined;
|
|
78
|
-
let buildLoader: Awaited<ReturnType<typeof createBuildLoader>> | undefined;
|
|
79
|
-
const timing: BuildTiming = {
|
|
80
|
-
start: Date.now(),
|
|
81
|
-
configResolved: 0,
|
|
82
|
-
buildStart: 0,
|
|
83
|
-
renderStart: 0,
|
|
84
|
-
};
|
|
85
|
-
|
|
86
|
-
const resolvedOptions = resolveOptions(options);
|
|
87
|
-
if (resolvedOptions.type === "error") {
|
|
88
|
-
throw resolvedOptions.error;
|
|
89
|
-
}
|
|
90
|
-
userOptions = resolvedOptions.userOptions;
|
|
54
|
+
}>;
|
|
91
55
|
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
56
|
+
export const reactStaticPlugin: ReactStaticPluginFn =
|
|
57
|
+
function _reactStaticPlugin(options) {
|
|
58
|
+
let worker: Worker;
|
|
59
|
+
let userConfig: ResolvedUserConfig;
|
|
60
|
+
let resolvedConfig: ResolvedConfig;
|
|
61
|
+
let autoDiscoveredFiles: AutoDiscoveredFiles | null = null;
|
|
62
|
+
let serverManifest: Manifest | undefined = undefined;
|
|
63
|
+
const timing: BuildTiming = {
|
|
64
|
+
start: Date.now(),
|
|
65
|
+
configResolved: 0,
|
|
66
|
+
buildStart: 0,
|
|
67
|
+
renderStart: 0,
|
|
68
|
+
};
|
|
98
69
|
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
return;
|
|
105
|
-
}
|
|
106
|
-
// Initialize autoDiscoveredFiles for both server and client builds
|
|
107
|
-
const autoDiscoverResult = await resolveAutoDiscover({
|
|
108
|
-
config,
|
|
109
|
-
configEnv,
|
|
110
|
-
userOptions,
|
|
111
|
-
condition: "react-server",
|
|
112
|
-
});
|
|
113
|
-
if (autoDiscoverResult.type === "error") {
|
|
114
|
-
throw autoDiscoverResult.error;
|
|
115
|
-
}
|
|
116
|
-
autoDiscoveredFiles = autoDiscoverResult.autoDiscoveredFiles;
|
|
117
|
-
const resolvedConfig = resolveUserConfig({
|
|
118
|
-
condition: "react-server",
|
|
119
|
-
config,
|
|
120
|
-
configEnv,
|
|
121
|
-
userOptions,
|
|
122
|
-
autoDiscoveredFiles,
|
|
123
|
-
});
|
|
124
|
-
if (resolvedConfig.type === "error") {
|
|
125
|
-
throw resolvedConfig.error;
|
|
126
|
-
}
|
|
70
|
+
const resolvedOptions = resolveOptions(options);
|
|
71
|
+
if (resolvedOptions.type === "error") {
|
|
72
|
+
throw resolvedOptions.error;
|
|
73
|
+
}
|
|
74
|
+
const userOptions = resolvedOptions.userOptions;
|
|
127
75
|
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
async buildStart() {
|
|
135
|
-
timing.buildStart = Date.now();
|
|
136
|
-
if (userOptions.onEvent && autoDiscoveredFiles) {
|
|
137
|
-
userOptions.onEvent({
|
|
138
|
-
type: "build.start",
|
|
139
|
-
data: {
|
|
140
|
-
pages: Array.from(autoDiscoveredFiles.urlMap.keys()),
|
|
141
|
-
files: autoDiscoveredFiles,
|
|
142
|
-
},
|
|
143
|
-
});
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
|
|
147
|
-
async renderStart() {
|
|
148
|
-
timing.renderStart = Date.now();
|
|
149
|
-
},
|
|
76
|
+
return {
|
|
77
|
+
name: "vite:plugin-react-server/static",
|
|
78
|
+
enforce: "post",
|
|
79
|
+
api: {
|
|
80
|
+
meta: { timing },
|
|
81
|
+
},
|
|
150
82
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
83
|
+
async config(config, configEnv) {
|
|
84
|
+
if (config.root && config.root !== userOptions.projectRoot) {
|
|
85
|
+
userOptions.projectRoot = config.root;
|
|
86
|
+
}
|
|
87
|
+
if (configEnv.command !== "build") {
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
if(typeof userOptions.moduleID !== "function") {
|
|
91
|
+
userOptions.moduleID = createDefaultModuleID(userOptions, configEnv, userOptions.loader.mode);
|
|
92
|
+
}
|
|
93
|
+
// Initialize autoDiscoveredFiles for both server and client builds
|
|
94
|
+
const autoDiscoverResult = await resolveAutoDiscover({
|
|
95
|
+
config,
|
|
96
|
+
configEnv,
|
|
97
|
+
userOptions,
|
|
98
|
+
condition: "react-server",
|
|
160
99
|
});
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
100
|
+
if (autoDiscoverResult.type === "error") {
|
|
101
|
+
throw autoDiscoverResult.error;
|
|
102
|
+
}
|
|
103
|
+
autoDiscoveredFiles = autoDiscoverResult.autoDiscoveredFiles;
|
|
104
|
+
const resolvedConfig = resolveUserConfig({
|
|
105
|
+
condition: "react-server",
|
|
106
|
+
config,
|
|
107
|
+
configEnv,
|
|
108
|
+
userOptions,
|
|
109
|
+
autoDiscoveredFiles,
|
|
166
110
|
});
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
? resolvedConfig.build.manifest
|
|
170
|
-
: ".vite/manifest.json";
|
|
171
|
-
if (!("source" in bundleManifest[manifestPath])) {
|
|
172
|
-
throw new Error("Server manifest not found");
|
|
111
|
+
if (resolvedConfig.type === "error") {
|
|
112
|
+
throw resolvedConfig.error;
|
|
173
113
|
}
|
|
174
114
|
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
115
|
+
userConfig = resolvedConfig.userConfig;
|
|
116
|
+
timing.configResolved = Date.now();
|
|
117
|
+
},
|
|
118
|
+
configResolved(config) {
|
|
119
|
+
resolvedConfig = config;
|
|
120
|
+
},
|
|
121
|
+
async buildStart() {
|
|
122
|
+
timing.buildStart = Date.now();
|
|
123
|
+
if (userOptions.onEvent && autoDiscoveredFiles) {
|
|
124
|
+
userOptions.onEvent({
|
|
125
|
+
type: "build.start",
|
|
126
|
+
data: {
|
|
127
|
+
pages: Array.from(autoDiscoveredFiles.urlMap.keys()),
|
|
128
|
+
files: autoDiscoveredFiles,
|
|
129
|
+
},
|
|
130
|
+
});
|
|
181
131
|
}
|
|
132
|
+
},
|
|
133
|
+
|
|
134
|
+
async renderStart() {
|
|
135
|
+
timing.renderStart = Date.now();
|
|
136
|
+
},
|
|
182
137
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
138
|
+
async writeBundle(options, bundle) {
|
|
139
|
+
if (userOptions.onEvent) {
|
|
140
|
+
userOptions.onEvent({
|
|
141
|
+
type: "build.writeBundle.static-server",
|
|
142
|
+
data: {
|
|
143
|
+
pages: Array.from(autoDiscoveredFiles?.urlMap.keys() ?? []),
|
|
144
|
+
options,
|
|
145
|
+
bundle,
|
|
146
|
+
},
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
try {
|
|
150
|
+
const bundleManifest = getBundleManifest<false>({
|
|
151
|
+
bundle,
|
|
152
|
+
normalizer: userOptions.normalizer,
|
|
153
|
+
});
|
|
154
|
+
const manifestPath =
|
|
155
|
+
typeof resolvedConfig.build.manifest === "string"
|
|
156
|
+
? resolvedConfig.build.manifest
|
|
157
|
+
: ".vite/manifest.json";
|
|
158
|
+
if (!bundleManifest[manifestPath] || !("source" in bundleManifest[manifestPath])) {
|
|
159
|
+
throw new Error("Server manifest not found");
|
|
160
|
+
}
|
|
193
161
|
|
|
194
|
-
|
|
195
|
-
|
|
162
|
+
serverManifest = JSON.parse(
|
|
163
|
+
bundleManifest[manifestPath].source as string
|
|
164
|
+
);
|
|
196
165
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
userOptions.clientEntry ?? "index.html"
|
|
201
|
-
);
|
|
202
|
-
const clientEntryCssInputs = collectManifestCss(
|
|
203
|
-
autoDiscoveredFiles?.staticManifest ?? {},
|
|
204
|
-
userOptions.clientEntry
|
|
205
|
-
);
|
|
206
|
-
const globalCssInputs = {
|
|
207
|
-
...indexHtmlCssInputs,
|
|
208
|
-
...clientEntryCssInputs,
|
|
209
|
-
};
|
|
166
|
+
if (!serverManifest) {
|
|
167
|
+
throw new Error("Failed to parse server manifest");
|
|
168
|
+
}
|
|
210
169
|
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
return [
|
|
221
|
-
key,
|
|
222
|
-
{
|
|
223
|
-
...value,
|
|
224
|
-
css:
|
|
225
|
-
autoDiscoveredFiles?.staticManifest[key]?.css ?? value.css,
|
|
226
|
-
},
|
|
227
|
-
];
|
|
228
|
-
})
|
|
170
|
+
const buildLoader = createBuildLoader(
|
|
171
|
+
{
|
|
172
|
+
userConfig,
|
|
173
|
+
userOptions: userOptions,
|
|
174
|
+
serverManifest: serverManifest ?? {},
|
|
175
|
+
staticManifest: autoDiscoveredFiles?.staticManifest ?? {},
|
|
176
|
+
clientManifest: {},
|
|
177
|
+
},
|
|
178
|
+
bundle
|
|
229
179
|
);
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
180
|
+
|
|
181
|
+
// Create CSS props for each CSS file
|
|
182
|
+
const cssFilesByPage = new Map();
|
|
183
|
+
|
|
184
|
+
// First collect global styles from index.html
|
|
185
|
+
const indexHtmlCssInputs = collectManifestCss(
|
|
186
|
+
autoDiscoveredFiles?.staticManifest ?? {},
|
|
187
|
+
"index.html"
|
|
233
188
|
);
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
globalCss.set(
|
|
189
|
+
const clientEntryCssInputs = userOptions.clientEntry
|
|
190
|
+
? collectManifestCss(
|
|
191
|
+
autoDiscoveredFiles?.staticManifest ?? {},
|
|
192
|
+
userOptions.clientEntry
|
|
193
|
+
)
|
|
194
|
+
: null;
|
|
195
|
+
const globalCssInputs = {
|
|
196
|
+
...indexHtmlCssInputs,
|
|
197
|
+
...clientEntryCssInputs,
|
|
198
|
+
};
|
|
199
|
+
|
|
200
|
+
const globalCss = new Map();
|
|
201
|
+
// Collect CSS files for each page and its props
|
|
202
|
+
for (const [url, { page, props }] of autoDiscoveredFiles?.urlMap ??
|
|
203
|
+
[]) {
|
|
204
|
+
const transformedServerManifest = Object.fromEntries(
|
|
205
|
+
Object.entries(serverManifest).map(([key, value]) => {
|
|
206
|
+
if (!value.css?.length) {
|
|
207
|
+
return [key, value];
|
|
208
|
+
}
|
|
209
|
+
return [
|
|
256
210
|
key,
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
211
|
+
{
|
|
212
|
+
...value,
|
|
213
|
+
css:
|
|
214
|
+
autoDiscoveredFiles?.staticManifest[key]?.css ??
|
|
215
|
+
value.css,
|
|
216
|
+
},
|
|
217
|
+
];
|
|
218
|
+
})
|
|
219
|
+
);
|
|
220
|
+
const cssInputs = collectManifestCss(
|
|
221
|
+
transformedServerManifest,
|
|
222
|
+
props ? [page, props] : page
|
|
223
|
+
);
|
|
224
|
+
// Create a map for this page's CSS files
|
|
225
|
+
const pageCssMap: Map<string, CssContent> = new Map();
|
|
226
|
+
// Add global styles if they exist
|
|
227
|
+
if (Object.keys(globalCssInputs).length > 0) {
|
|
228
|
+
for (const [key, value] of Object.entries(globalCssInputs)) {
|
|
229
|
+
let cssContent = await buildLoader(`${value}?inline`).then(
|
|
230
|
+
(r) => r.default
|
|
262
231
|
);
|
|
232
|
+
if (cssContent === "undefined" || !cssContent) {
|
|
233
|
+
cssContent =
|
|
234
|
+
(await readFile(
|
|
235
|
+
join(
|
|
236
|
+
userOptions.projectRoot,
|
|
237
|
+
userOptions.build.outDir,
|
|
238
|
+
userOptions.build.static,
|
|
239
|
+
key
|
|
240
|
+
),
|
|
241
|
+
"utf-8"
|
|
242
|
+
)) ?? "";
|
|
243
|
+
}
|
|
244
|
+
if (cssContent) {
|
|
245
|
+
globalCss.set(
|
|
246
|
+
key,
|
|
247
|
+
createCssProps({
|
|
248
|
+
id: key,
|
|
249
|
+
code: cssContent,
|
|
250
|
+
userOptions: userOptions,
|
|
251
|
+
})
|
|
252
|
+
);
|
|
253
|
+
}
|
|
263
254
|
}
|
|
264
255
|
}
|
|
265
|
-
}
|
|
266
256
|
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
);
|
|
273
|
-
if (typeof cssContent !== "string") {
|
|
274
|
-
continue;
|
|
275
|
-
}
|
|
276
|
-
if (cssContent) {
|
|
277
|
-
// Ensure the CSS file path is properly resolved
|
|
278
|
-
pageCssMap.set(
|
|
279
|
-
key,
|
|
280
|
-
createCssProps({
|
|
281
|
-
id: key,
|
|
282
|
-
code: cssContent,
|
|
283
|
-
userOptions: userOptions,
|
|
284
|
-
})
|
|
257
|
+
// Add page-specific styles
|
|
258
|
+
for (const [key, value] of Object.entries(cssInputs)) {
|
|
259
|
+
try {
|
|
260
|
+
const cssContent = await buildLoader(`${value}?inline`).then(
|
|
261
|
+
(r) => String(r.default)
|
|
285
262
|
);
|
|
263
|
+
if (
|
|
264
|
+
typeof cssContent !== "string" ||
|
|
265
|
+
cssContent === "undefined"
|
|
266
|
+
) {
|
|
267
|
+
continue;
|
|
268
|
+
}
|
|
269
|
+
if (cssContent) {
|
|
270
|
+
// Ensure the CSS file path is properly resolved
|
|
271
|
+
pageCssMap.set(
|
|
272
|
+
key,
|
|
273
|
+
createCssProps({
|
|
274
|
+
id: key,
|
|
275
|
+
code: cssContent,
|
|
276
|
+
userOptions: userOptions,
|
|
277
|
+
})
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
} catch (error) {
|
|
281
|
+
console.warn(`Failed to process CSS file ${value}:`, error);
|
|
282
|
+
continue;
|
|
286
283
|
}
|
|
287
|
-
} catch (error) {
|
|
288
|
-
console.warn(`Failed to process CSS file ${value}:`, error);
|
|
289
|
-
continue;
|
|
290
284
|
}
|
|
285
|
+
cssFilesByPage.set(url, pageCssMap);
|
|
291
286
|
}
|
|
292
|
-
cssFilesByPage.set(url, pageCssMap);
|
|
293
|
-
}
|
|
294
287
|
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
...serializedUserOptions,
|
|
288
|
+
const staticManifest = autoDiscoveredFiles?.staticManifest ?? {};
|
|
289
|
+
const indexHtml = staticManifest?.["index.html"]?.file;
|
|
290
|
+
const pipeableStreamOptions = {
|
|
291
|
+
...userOptions.pipeableStreamOptions,
|
|
292
|
+
bootstrapModules: [
|
|
293
|
+
...(indexHtml ? [baseURL(indexHtml)] : []),
|
|
294
|
+
...(userOptions.pipeableStreamOptions?.bootstrapModules ?? []),
|
|
295
|
+
],
|
|
296
|
+
};
|
|
297
|
+
userOptions.pipeableStreamOptions = pipeableStreamOptions;
|
|
298
|
+
const serializedUserOptions = serializedOptions(
|
|
299
|
+
userOptions,
|
|
300
|
+
autoDiscoveredFiles!
|
|
301
|
+
);
|
|
302
|
+
// Create worker
|
|
303
|
+
if (!worker) {
|
|
304
|
+
const viteEnvPrefix =
|
|
305
|
+
typeof resolvedConfig.envPrefix === "string"
|
|
306
|
+
? resolvedConfig.envPrefix
|
|
307
|
+
: Array.isArray(resolvedConfig.envPrefix)
|
|
308
|
+
? resolvedConfig.envPrefix[0]
|
|
309
|
+
: DEFAULT_CONFIG.ENV_PREFIX;
|
|
310
|
+
const routeCount = autoDiscoveredFiles?.urlMap.size ?? 0;
|
|
311
|
+
const maxListeners = routeCount + 1;
|
|
312
|
+
const workerResult = await createWorker({
|
|
313
|
+
projectRoot: userOptions.projectRoot,
|
|
314
|
+
workerPath: userOptions.htmlWorkerPath,
|
|
315
|
+
currentCondition: "react-server",
|
|
316
|
+
reverseCondition: "react-client",
|
|
317
|
+
maxListeners: maxListeners,
|
|
318
|
+
envPrefix: viteEnvPrefix,
|
|
319
|
+
logger: this.environment.logger,
|
|
320
|
+
workerData: {
|
|
321
|
+
resolvedConfig: serializeResolvedConfig(resolvedConfig),
|
|
322
|
+
userOptions: serializedUserOptions,
|
|
331
323
|
},
|
|
332
|
-
}
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
324
|
+
});
|
|
325
|
+
if (workerResult.type === "error") {
|
|
326
|
+
throw workerResult.error;
|
|
327
|
+
} else if (workerResult.type === "skip") {
|
|
328
|
+
this.environment.logger.info(
|
|
329
|
+
"Worker not created, skipping static build"
|
|
330
|
+
);
|
|
331
|
+
return;
|
|
332
|
+
} else {
|
|
333
|
+
worker = workerResult.worker;
|
|
334
|
+
}
|
|
343
335
|
}
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
}
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
336
|
+
// Render pages - component resolution now happens per-route in renderPage
|
|
337
|
+
const { onEvent, ...handlerOptions } = userOptions;
|
|
338
|
+
const renderPagesGenerator = renderPages(
|
|
339
|
+
autoDiscoveredFiles!,
|
|
340
|
+
{
|
|
341
|
+
...handlerOptions,
|
|
342
|
+
loader: buildLoader,
|
|
343
|
+
worker: worker,
|
|
344
|
+
logger: createLogger(),
|
|
345
|
+
onEvent: async (event: PluginEvent) => {
|
|
346
|
+
if (onEvent) {
|
|
347
|
+
onEvent(event);
|
|
348
|
+
}
|
|
349
|
+
// Add file write completion event
|
|
350
|
+
if (event.type === "file.write") {
|
|
351
|
+
await event.data.onComplete();
|
|
352
|
+
}
|
|
353
|
+
},
|
|
354
|
+
pipeableStreamOptions: pipeableStreamOptions,
|
|
355
|
+
manifest: serverManifest ?? {},
|
|
356
|
+
build: {
|
|
357
|
+
htmlOutputPath: userOptions.build.htmlOutputPath,
|
|
358
|
+
rscOutputPath: userOptions.build.rscOutputPath,
|
|
359
|
+
outDir: userOptions.build.outDir,
|
|
360
|
+
pages: userOptions.build.pages,
|
|
361
|
+
server: userOptions.build.server,
|
|
362
|
+
static: userOptions.build.static,
|
|
363
|
+
client: userOptions.build.client,
|
|
364
|
+
},
|
|
365
|
+
globalCss: globalCss,
|
|
366
|
+
css: {
|
|
367
|
+
...handlerOptions.css,
|
|
368
|
+
inlineCss: handlerOptions.css.inlineCss,
|
|
369
|
+
},
|
|
370
|
+
|
|
378
371
|
},
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
);
|
|
372
|
+
cssFilesByPage
|
|
373
|
+
);
|
|
382
374
|
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
375
|
+
// Process render results
|
|
376
|
+
let finalResult: RenderPagesResult | undefined;
|
|
377
|
+
const errors: Error[] = [];
|
|
378
|
+
for await (const result of renderPagesGenerator) {
|
|
379
|
+
if (result.type === "error") {
|
|
380
|
+
errors.push(result.error);
|
|
381
|
+
|
|
382
|
+
// Provide developer-friendly error messages for common issues
|
|
383
|
+
if (result.error.message.includes("Attempted to load a Client Module outside the hosted root")) {
|
|
384
|
+
const failedRoutes = Array.from(result.failedRoutes || []);
|
|
385
|
+
const failingPage = failedRoutes[failedRoutes.length - 1] || 'unknown';
|
|
386
|
+
const hostedRoot = userOptions.moduleBaseURL || '/';
|
|
387
|
+
this.environment.logger.error(
|
|
388
|
+
`❌ Page: ${failingPage} | Hosted root: ${hostedRoot} | Client modules registered outside hosted root`
|
|
389
|
+
);
|
|
390
|
+
} else {
|
|
391
|
+
this.environment.logger.warn(
|
|
392
|
+
`Failed to render page, skipping: ${result.error.message}`
|
|
393
|
+
);
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Continue processing other pages instead of throwing
|
|
397
|
+
finalResult = {
|
|
398
|
+
type: "success",
|
|
399
|
+
completedRoutes: result.completedRoutes,
|
|
400
|
+
failedRoutes: undefined,
|
|
401
|
+
htmlSizes: result.htmlSizes,
|
|
402
|
+
rscSizes: result.rscSizes,
|
|
403
|
+
streamMetrics: result.streamMetrics,
|
|
404
|
+
results: result.results,
|
|
405
|
+
};
|
|
406
|
+
continue;
|
|
407
|
+
}
|
|
408
|
+
finalResult = result;
|
|
388
409
|
}
|
|
389
|
-
finalResult = result;
|
|
390
|
-
}
|
|
391
410
|
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
);
|
|
398
|
-
|
|
399
|
-
this.environment.logger.info(
|
|
400
|
-
`Rendered ${finalResult.completedRoutes.size} unique routes in ${finalResult.streamMetrics.duration}ms`
|
|
401
|
-
);
|
|
402
|
-
if (process.env["NODE_ENV"] !== "production") {
|
|
403
|
-
this.environment.logger.warn(
|
|
404
|
-
`THIS IS BUILD IS NOT INTENDED FOR PRODUCTION (${process.env["NODE_ENV"]})`
|
|
411
|
+
if (!finalResult) {
|
|
412
|
+
throw new Error("No render result produced");
|
|
413
|
+
}
|
|
414
|
+
finalResult.streamMetrics.duration = Math.round(
|
|
415
|
+
performance.now() - finalResult.streamMetrics.startTime
|
|
405
416
|
);
|
|
406
|
-
}
|
|
407
417
|
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
418
|
+
this.environment.logger.info(
|
|
419
|
+
`Rendered ${finalResult.completedRoutes.size} unique routes in ${finalResult.streamMetrics.duration}ms`
|
|
420
|
+
);
|
|
421
|
+
if (errors.length > 0) {
|
|
422
|
+
this.environment.logger.warn(
|
|
423
|
+
`${errors.length} pages failed to render and were skipped`
|
|
424
|
+
);
|
|
425
|
+
}
|
|
426
|
+
if (process.env["NODE_ENV"] !== "production") {
|
|
427
|
+
this.environment.logger.warn(
|
|
428
|
+
`THIS IS BUILD IS NOT INTENDED FOR PRODUCTION (${process.env["NODE_ENV"]})`
|
|
429
|
+
);
|
|
430
|
+
}
|
|
413
431
|
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
: reject(new Error(`Worker terminated with code ${code}`))
|
|
427
|
-
)
|
|
428
|
-
.catch(reject);
|
|
432
|
+
// Update timing
|
|
433
|
+
timing.render = Date.now() - (timing.renderStart ?? timing.start);
|
|
434
|
+
} catch (error) {
|
|
435
|
+
logError(toError(error), this.environment.logger);
|
|
436
|
+
} finally {
|
|
437
|
+
// Cleanup
|
|
438
|
+
if (worker) {
|
|
439
|
+
try {
|
|
440
|
+
// Force terminate the worker without waiting for graceful shutdown
|
|
441
|
+
await worker.terminate();
|
|
442
|
+
} catch (error) {
|
|
443
|
+
logError(toError(error), this.environment.logger);
|
|
429
444
|
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
}
|
|
436
|
-
},
|
|
437
|
-
} as const;
|
|
438
|
-
}
|
|
445
|
+
}
|
|
446
|
+
}
|
|
447
|
+
},
|
|
448
|
+
} as const;
|
|
449
|
+
};
|