vite-plugin-react-server 1.1.19 → 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 -431
- 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 -596
- 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
|
@@ -2,14 +2,18 @@ import { parentPort, MessageChannel, workerData } from "node:worker_threads";
|
|
|
2
2
|
import { messageHandler } from "./messageHandler.js";
|
|
3
3
|
import { register } from "node:module";
|
|
4
4
|
import { register as registerTsx } from "tsx/esm/api";
|
|
5
|
-
import {
|
|
5
|
+
import { resolve } from "node:path";
|
|
6
6
|
import { pluginRoot } from "../../root.js";
|
|
7
|
+
import type { HmrAcceptMessage, ReadyMessage } from "../types.js";
|
|
7
8
|
import type {
|
|
8
|
-
|
|
9
|
+
CssFileMessage,
|
|
9
10
|
HmrUpdateMessage,
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
InitializedEnvLoaderMessage,
|
|
12
|
+
InitializedReactLoaderMessage,
|
|
13
|
+
RscWorkerInputMessage,
|
|
14
|
+
} from "./types.js";
|
|
12
15
|
import { toError } from "../../error/toError.js";
|
|
16
|
+
import { DEFAULT_CONFIG } from "../../config/defaults.js";
|
|
13
17
|
|
|
14
18
|
// Initialize worker
|
|
15
19
|
if (!parentPort) {
|
|
@@ -21,11 +25,10 @@ const isTestEnv = process.env["VITEST"] || process.env["NODE_ENV"] === "test";
|
|
|
21
25
|
const isDevEnv = process.env["NODE_ENV"] !== "production";
|
|
22
26
|
const verbose = workerData.verbose;
|
|
23
27
|
|
|
24
|
-
const developmentMessageHandler = (msg:
|
|
28
|
+
const developmentMessageHandler = (msg: RscWorkerInputMessage) => {
|
|
25
29
|
if (verbose) {
|
|
26
|
-
if ("
|
|
27
|
-
|
|
28
|
-
console.log(`[rsc-worker:${msg.type}] ${preview}`);
|
|
30
|
+
if (msg.type === "RSC_RENDER") {
|
|
31
|
+
console.log(`[rsc-worker:${msg.type}] Render ${msg.pagePath}}`);
|
|
29
32
|
} else {
|
|
30
33
|
console.log(`[rsc-worker:${msg.type}] ${JSON.stringify(msg)}`);
|
|
31
34
|
}
|
|
@@ -33,21 +36,25 @@ const developmentMessageHandler = (msg: any) => {
|
|
|
33
36
|
messageHandler(msg);
|
|
34
37
|
};
|
|
35
38
|
|
|
36
|
-
const developmentCssLoaderMessageHandler = (msg:
|
|
39
|
+
const developmentCssLoaderMessageHandler = (msg: CssFileMessage) => {
|
|
37
40
|
if (verbose) {
|
|
38
41
|
console.log(`[css-loader:${msg.type}] ${JSON.stringify(msg)}`);
|
|
39
42
|
}
|
|
40
43
|
messageHandler(msg);
|
|
41
44
|
};
|
|
42
45
|
|
|
43
|
-
const developmentEnvLoaderMessageHandler = (
|
|
46
|
+
const developmentEnvLoaderMessageHandler = (
|
|
47
|
+
msg: InitializedEnvLoaderMessage
|
|
48
|
+
) => {
|
|
44
49
|
if (verbose) {
|
|
45
50
|
console.log(`[env-loader:${msg.type}] ${JSON.stringify(msg)}`);
|
|
46
51
|
}
|
|
47
52
|
messageHandler(msg);
|
|
48
53
|
};
|
|
49
54
|
|
|
50
|
-
const developmentReactLoaderMessageHandler = (
|
|
55
|
+
const developmentReactLoaderMessageHandler = (
|
|
56
|
+
msg: InitializedReactLoaderMessage
|
|
57
|
+
) => {
|
|
51
58
|
if (verbose) {
|
|
52
59
|
console.log(`[react-loader:${msg.type}] ${JSON.stringify(msg)}`);
|
|
53
60
|
}
|
|
@@ -62,15 +69,68 @@ try {
|
|
|
62
69
|
|
|
63
70
|
// Set up message handlers before transferring ports
|
|
64
71
|
reactLoaderChannel.port2.on("message", developmentReactLoaderMessageHandler);
|
|
72
|
+
reactLoaderChannel.port2.on("messageerror", (error: Error) => {
|
|
73
|
+
console.error("[rsc-worker] React loader message serialization failed:", error);
|
|
74
|
+
if (parentPort) {
|
|
75
|
+
parentPort.postMessage({
|
|
76
|
+
type: "ERROR",
|
|
77
|
+
id: "react-loader",
|
|
78
|
+
error: {
|
|
79
|
+
message: "Message serialization failed in react loader",
|
|
80
|
+
name: "MessageError",
|
|
81
|
+
stack: undefined,
|
|
82
|
+
},
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
});
|
|
86
|
+
|
|
65
87
|
cssLoaderChannel.port2.on("message", developmentCssLoaderMessageHandler);
|
|
88
|
+
cssLoaderChannel.port2.on("messageerror", (error: Error) => {
|
|
89
|
+
console.error("[rsc-worker] CSS loader message serialization failed:", error);
|
|
90
|
+
if (parentPort) {
|
|
91
|
+
parentPort.postMessage({
|
|
92
|
+
type: "ERROR",
|
|
93
|
+
id: "css-loader",
|
|
94
|
+
error: {
|
|
95
|
+
message: "Message serialization failed in CSS loader",
|
|
96
|
+
name: "MessageError",
|
|
97
|
+
stack: undefined,
|
|
98
|
+
},
|
|
99
|
+
});
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
|
|
66
103
|
envLoaderChannel.port2.on("message", developmentEnvLoaderMessageHandler);
|
|
104
|
+
envLoaderChannel.port2.on("messageerror", (error: Error) => {
|
|
105
|
+
console.error("[rsc-worker] Env loader message serialization failed:", error);
|
|
106
|
+
if (parentPort) {
|
|
107
|
+
parentPort.postMessage({
|
|
108
|
+
type: "ERROR",
|
|
109
|
+
id: "env-loader",
|
|
110
|
+
error: {
|
|
111
|
+
message: "Message serialization failed in env loader",
|
|
112
|
+
name: "MessageError",
|
|
113
|
+
stack: undefined,
|
|
114
|
+
},
|
|
115
|
+
});
|
|
116
|
+
}
|
|
117
|
+
});
|
|
67
118
|
|
|
68
119
|
const reactLoaderPath =
|
|
69
|
-
"file://" +
|
|
120
|
+
"file://" +
|
|
121
|
+
(workerData.userOptions.reactLoaderPath
|
|
122
|
+
? resolve(workerData.resolvedConfig.root, workerData.userOptions.reactLoaderPath)
|
|
123
|
+
: resolve(workerData.resolvedConfig.root, DEFAULT_CONFIG.REACT_LOADER_PATH));
|
|
70
124
|
const cssLoaderPath =
|
|
71
|
-
"file://" +
|
|
125
|
+
"file://" +
|
|
126
|
+
(workerData.userOptions.cssLoaderPath
|
|
127
|
+
? resolve(workerData.resolvedConfig.root, workerData.userOptions.cssLoaderPath)
|
|
128
|
+
: resolve(workerData.resolvedConfig.root, DEFAULT_CONFIG.CSS_LOADER_PATH));
|
|
72
129
|
const envLoaderPath =
|
|
73
|
-
"file://" +
|
|
130
|
+
"file://" +
|
|
131
|
+
(workerData.userOptions.envLoaderPath
|
|
132
|
+
? resolve(workerData.resolvedConfig.root, workerData.userOptions.envLoaderPath)
|
|
133
|
+
: resolve(workerData.resolvedConfig.root, DEFAULT_CONFIG.ENV_LOADER_PATH));
|
|
74
134
|
|
|
75
135
|
register(cssLoaderPath, {
|
|
76
136
|
parentURL: pluginRoot,
|
|
@@ -93,6 +153,7 @@ try {
|
|
|
93
153
|
id: "react-loader",
|
|
94
154
|
port: reactLoaderChannel.port1,
|
|
95
155
|
userOptions: workerData.userOptions,
|
|
156
|
+
resolvedConfig: workerData.resolvedConfig,
|
|
96
157
|
},
|
|
97
158
|
transferList: [reactLoaderChannel.port1],
|
|
98
159
|
});
|
|
@@ -104,12 +165,17 @@ try {
|
|
|
104
165
|
id: "env-loader",
|
|
105
166
|
port: envLoaderChannel.port1,
|
|
106
167
|
resolvedConfig: workerData.resolvedConfig,
|
|
168
|
+
userOptions: workerData.userOptions,
|
|
107
169
|
},
|
|
108
170
|
transferList: [envLoaderChannel.port1],
|
|
109
171
|
});
|
|
110
172
|
|
|
111
173
|
// Set up message handling
|
|
112
174
|
parentPort!.on("message", developmentMessageHandler);
|
|
175
|
+
parentPort!.on("messageerror", (error: Error) => {
|
|
176
|
+
console.error("[rsc-worker] Parent port message serialization failed:", error);
|
|
177
|
+
// Can't send via parentPort since that's what failed, so just log
|
|
178
|
+
});
|
|
113
179
|
|
|
114
180
|
const { hmrPort } = workerData;
|
|
115
181
|
if (hmrPort) {
|
|
@@ -117,7 +183,7 @@ try {
|
|
|
117
183
|
hmrPort.start();
|
|
118
184
|
|
|
119
185
|
// Listen for HMR messages
|
|
120
|
-
hmrPort.on("message", (message:
|
|
186
|
+
hmrPort.on("message", (message: RscWorkerInputMessage) => {
|
|
121
187
|
if (message.type === "HMR_UPDATE") {
|
|
122
188
|
// Invalidate the module in the worker
|
|
123
189
|
parentPort!.postMessage({
|
|
@@ -134,6 +200,22 @@ try {
|
|
|
134
200
|
} satisfies HmrAcceptMessage);
|
|
135
201
|
}
|
|
136
202
|
});
|
|
203
|
+
|
|
204
|
+
// Handle HMR port message errors
|
|
205
|
+
hmrPort.on("messageerror", (error: Error) => {
|
|
206
|
+
console.error("[rsc-worker] HMR port message serialization failed:", error);
|
|
207
|
+
if (parentPort) {
|
|
208
|
+
parentPort.postMessage({
|
|
209
|
+
type: "ERROR",
|
|
210
|
+
id: "hmr-port",
|
|
211
|
+
error: {
|
|
212
|
+
message: "Message serialization failed in HMR port",
|
|
213
|
+
name: "MessageError",
|
|
214
|
+
stack: undefined,
|
|
215
|
+
},
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
});
|
|
137
219
|
}
|
|
138
220
|
|
|
139
221
|
// Notify parent that we're ready
|
|
@@ -147,16 +229,21 @@ try {
|
|
|
147
229
|
if (process.env["NODE_ENV"] === "production") {
|
|
148
230
|
throw new Error("This module should not run in production mode.");
|
|
149
231
|
}
|
|
150
|
-
} catch (error) {
|
|
232
|
+
} catch (error: unknown) {
|
|
151
233
|
if (isDevEnv) {
|
|
152
234
|
console.error(error);
|
|
153
235
|
}
|
|
154
236
|
// In dev mode, try to send error message before exiting
|
|
155
237
|
if (parentPort) {
|
|
238
|
+
const err = toError(error);
|
|
156
239
|
parentPort?.postMessage({
|
|
157
240
|
type: "ERROR",
|
|
158
241
|
id: "rsc-worker",
|
|
159
|
-
error:
|
|
242
|
+
error: {
|
|
243
|
+
message: err.message,
|
|
244
|
+
stack: err.stack,
|
|
245
|
+
name: err.name,
|
|
246
|
+
},
|
|
160
247
|
});
|
|
161
248
|
}
|
|
162
249
|
if (!isDevEnv || isTestEnv) {
|
|
@@ -90,7 +90,7 @@ export function clearHmrState(path: string): void {
|
|
|
90
90
|
// Helper to get all invalidated modules
|
|
91
91
|
export function getInvalidatedModules(): string[] {
|
|
92
92
|
return Array.from(hmrState.entries())
|
|
93
|
-
.filter(([
|
|
93
|
+
.filter(([, state]) => state.invalidated)
|
|
94
94
|
.map(([path]) => path);
|
|
95
95
|
}
|
|
96
96
|
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
import type { RenderToPipeableStreamOptions } from "react-dom/server";
|
|
2
|
+
import type {
|
|
3
|
+
CreateHandlerOptions,
|
|
4
|
+
ResolvedUserOptions,
|
|
5
|
+
StreamMetrics,
|
|
6
|
+
} from "../../types.js";
|
|
7
|
+
import type {
|
|
8
|
+
WorkerMessage,
|
|
9
|
+
ReactServerDomEsmOptions,
|
|
10
|
+
ErrorMessage,
|
|
11
|
+
ShellReadyMessage,
|
|
12
|
+
AllReadyMessage,
|
|
13
|
+
ShutdownCompleteMessage,
|
|
14
|
+
HmrAcceptMessage,
|
|
15
|
+
ReadyMessage,
|
|
16
|
+
ServerActionMessage,
|
|
17
|
+
ServerActionResponseMessage,
|
|
18
|
+
CleanupCompleteMessage,
|
|
19
|
+
ShutdownMessage,
|
|
20
|
+
} from "../types.js";
|
|
21
|
+
|
|
22
|
+
// Combined options type that includes both React DOM and React Server DOM ESM options
|
|
23
|
+
export type SerializeableRenderToPipeableStreamOptions = Omit<
|
|
24
|
+
RenderToPipeableStreamOptions,
|
|
25
|
+
"onShellReady" | "onShellError" | "onAllReady" | "onError" | "onPostpone"
|
|
26
|
+
>;
|
|
27
|
+
|
|
28
|
+
export type RscRenderState = {
|
|
29
|
+
id: string;
|
|
30
|
+
outDir: string;
|
|
31
|
+
moduleRootPath: string;
|
|
32
|
+
moduleBaseURL: string;
|
|
33
|
+
rscOutputPath: string;
|
|
34
|
+
componentImport: string;
|
|
35
|
+
propsImport: string;
|
|
36
|
+
pipeableStreamOptions: ReactServerDomEsmOptions;
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// RSC-specific messages
|
|
40
|
+
export type RscChunkOutputMessage = WorkerMessage & {
|
|
41
|
+
type: "RSC_CHUNK";
|
|
42
|
+
id: string;
|
|
43
|
+
chunk: Uint8Array;
|
|
44
|
+
sequence?: number;
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
export type RscEndMessage = {
|
|
48
|
+
type: "RSC_END";
|
|
49
|
+
id: string;
|
|
50
|
+
} & WorkerMessage;
|
|
51
|
+
|
|
52
|
+
export type RscMetricsMessage = {
|
|
53
|
+
type: "RSC_METRICS";
|
|
54
|
+
id: string;
|
|
55
|
+
metrics: StreamMetrics;
|
|
56
|
+
} & WorkerMessage;
|
|
57
|
+
|
|
58
|
+
export type CssFileMessage = {
|
|
59
|
+
type: "CSS_FILE";
|
|
60
|
+
id: string;
|
|
61
|
+
content: string;
|
|
62
|
+
moduleClasses?: Record<string, string>;
|
|
63
|
+
originalClasses?: Record<string, string>;
|
|
64
|
+
usedClasses?: string[];
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
export type RscWorkerOutputMessage =
|
|
68
|
+
| RscChunkOutputMessage
|
|
69
|
+
| RscEndMessage
|
|
70
|
+
| ShellReadyMessage
|
|
71
|
+
| AllReadyMessage
|
|
72
|
+
| ErrorMessage
|
|
73
|
+
| CssFileMessage
|
|
74
|
+
| RscMetricsMessage
|
|
75
|
+
| HmrAcceptMessage
|
|
76
|
+
| ReadyMessage
|
|
77
|
+
| ServerActionMessage
|
|
78
|
+
| ServerActionResponseMessage
|
|
79
|
+
| ShutdownCompleteMessage
|
|
80
|
+
| CleanupCompleteMessage
|
|
81
|
+
| ServerModuleMessage
|
|
82
|
+
| HmrUpdateMessage
|
|
83
|
+
| HmrCleanupMessage;
|
|
84
|
+
|
|
85
|
+
export type RscRenderOpt = WorkerMessage & {
|
|
86
|
+
type: "RSC_RENDER";
|
|
87
|
+
} & Omit<
|
|
88
|
+
CreateHandlerOptions<ResolvedUserOptions>,
|
|
89
|
+
| "onEvent"
|
|
90
|
+
| "onMetrics"
|
|
91
|
+
| "loader"
|
|
92
|
+
| "logger"
|
|
93
|
+
| "build"
|
|
94
|
+
| "autoDiscover"
|
|
95
|
+
| "normalizer"
|
|
96
|
+
| "moduleID"
|
|
97
|
+
| "HtmlComponent"
|
|
98
|
+
| "RootComponent"
|
|
99
|
+
| "PageComponent"
|
|
100
|
+
> & {
|
|
101
|
+
build: Omit<
|
|
102
|
+
CreateHandlerOptions<ResolvedUserOptions>["build"],
|
|
103
|
+
"entryFileNames" | "chunkFileNames" | "assetFileNames" | "pages"
|
|
104
|
+
> & { pages: string[] };
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
export type RscRenderMessage<
|
|
108
|
+
Opt extends RscRenderOpt = RscRenderOpt
|
|
109
|
+
> = Opt;
|
|
110
|
+
|
|
111
|
+
export type ChunkProcessedMessage = {
|
|
112
|
+
type: "CHUNK_PROCESSED";
|
|
113
|
+
success: boolean;
|
|
114
|
+
sequence?: number;
|
|
115
|
+
} & WorkerMessage;
|
|
116
|
+
|
|
117
|
+
export type ClientComponentMessage = {
|
|
118
|
+
type: "CLIENT_COMPONENT";
|
|
119
|
+
url: string;
|
|
120
|
+
source: string;
|
|
121
|
+
} & WorkerMessage;
|
|
122
|
+
|
|
123
|
+
export type InitializedReactLoaderMessage = {
|
|
124
|
+
type: "INITIALIZED_REACT_LOADER";
|
|
125
|
+
id: string;
|
|
126
|
+
} & WorkerMessage;
|
|
127
|
+
|
|
128
|
+
export type InitializedCssLoaderMessage = {
|
|
129
|
+
type: "INITIALIZED_CSS_LOADER";
|
|
130
|
+
id: string;
|
|
131
|
+
} & WorkerMessage;
|
|
132
|
+
|
|
133
|
+
export type ModuleRequestMessage = {
|
|
134
|
+
type: "MODULE_REQUEST";
|
|
135
|
+
id: string;
|
|
136
|
+
path: string;
|
|
137
|
+
} & WorkerMessage;
|
|
138
|
+
|
|
139
|
+
export type InitializedRscWorkerLoaderMessage = {
|
|
140
|
+
type: "INITIALIZED_RSC_WORKER_LOADER";
|
|
141
|
+
id: string;
|
|
142
|
+
} & WorkerMessage;
|
|
143
|
+
|
|
144
|
+
export type InitializedEnvLoaderMessage = {
|
|
145
|
+
type: "INITIALIZED_ENV_LOADER";
|
|
146
|
+
id: string;
|
|
147
|
+
env: Record<string, string>;
|
|
148
|
+
} & WorkerMessage;
|
|
149
|
+
|
|
150
|
+
export type HmrUpdateMessage = {
|
|
151
|
+
type: "HMR_UPDATE";
|
|
152
|
+
routes?: string[];
|
|
153
|
+
timestamp?: number;
|
|
154
|
+
} & WorkerMessage;
|
|
155
|
+
|
|
156
|
+
export type HmrCleanupMessage = {
|
|
157
|
+
type: "HMR_CLEANUP";
|
|
158
|
+
routes?: string[];
|
|
159
|
+
timestamp?: number;
|
|
160
|
+
} & WorkerMessage;
|
|
161
|
+
|
|
162
|
+
export type ServerModuleMessage = {
|
|
163
|
+
type: "SERVER_MODULE";
|
|
164
|
+
url: string;
|
|
165
|
+
source: string;
|
|
166
|
+
} & WorkerMessage;
|
|
167
|
+
|
|
168
|
+
export type RscWorkerInputMessage =
|
|
169
|
+
| RscRenderMessage
|
|
170
|
+
| CssFileMessage
|
|
171
|
+
| ShutdownMessage
|
|
172
|
+
| ChunkProcessedMessage
|
|
173
|
+
| ClientComponentMessage
|
|
174
|
+
| InitializedReactLoaderMessage
|
|
175
|
+
| InitializedCssLoaderMessage
|
|
176
|
+
| ModuleRequestMessage
|
|
177
|
+
| InitializedRscWorkerLoaderMessage
|
|
178
|
+
| InitializedEnvLoaderMessage
|
|
179
|
+
| HmrUpdateMessage
|
|
180
|
+
| HmrAcceptMessage
|
|
181
|
+
| HmrCleanupMessage
|
|
182
|
+
| CleanupCompleteMessage
|
|
183
|
+
| ServerActionMessage
|
|
184
|
+
| ServerActionResponseMessage
|
|
185
|
+
| ServerModuleMessage;
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { hydrateUserOptions } from "../../helpers/index.js";
|
|
1
|
+
import { hydrateUserOptions } from "../../helpers/hydrateUserOptions.js";
|
|
3
2
|
import { workerData } from "node:worker_threads";
|
|
4
|
-
const userOptionsResult =
|
|
3
|
+
const userOptionsResult = hydrateUserOptions(workerData?.userOptions)
|
|
5
4
|
if(userOptionsResult.type === "error") {
|
|
6
5
|
throw userOptionsResult.error;
|
|
7
6
|
}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { cleanObject } from "../helpers/cleanObject.js";
|
|
2
2
|
import type {
|
|
3
|
-
|
|
3
|
+
RscWorkerInputMessage,
|
|
4
4
|
RscWorkerOutputMessage,
|
|
5
|
-
} from "./types.js";
|
|
5
|
+
} from "./rsc/types.js";
|
|
6
|
+
import type { HtmlWorkerInputMessage, HtmlWorkerOutputMessage } from "./html/types.js";
|
|
6
7
|
import { parentPort } from "node:worker_threads";
|
|
7
8
|
|
|
8
9
|
export function sendMessage(
|
|
9
|
-
msg: HtmlWorkerOutputMessage | RscWorkerOutputMessage,
|
|
10
|
+
msg: HtmlWorkerOutputMessage | RscWorkerOutputMessage | HtmlWorkerInputMessage | RscWorkerInputMessage,
|
|
10
11
|
port = parentPort
|
|
11
12
|
) {
|
|
12
13
|
if (!port) {
|
|
@@ -26,6 +27,13 @@ export function sendMessage(
|
|
|
26
27
|
name: error.name,
|
|
27
28
|
cause: error.cause,
|
|
28
29
|
}
|
|
30
|
+
: (typeof error === "object" && error !== null && "message" in error && "name" in error)
|
|
31
|
+
? {
|
|
32
|
+
message: typeof error.message === "string" ? error.message : String(error.message),
|
|
33
|
+
stack: typeof error.stack === "string" ? error.stack : undefined,
|
|
34
|
+
name: typeof error.name === "string" ? error.name : "Error",
|
|
35
|
+
cause: "cause" in error ? error.cause : undefined,
|
|
36
|
+
}
|
|
29
37
|
: {
|
|
30
38
|
message: String(error),
|
|
31
39
|
name: "Error",
|
|
@@ -43,11 +51,21 @@ export function sendMessage(
|
|
|
43
51
|
console.error("[Worker] Failed to send message:", err);
|
|
44
52
|
// Try to send a basic error message
|
|
45
53
|
try {
|
|
54
|
+
// Create a proper error with captured stack trace for better debugging
|
|
55
|
+
const sendError = new Error(
|
|
56
|
+
err instanceof Error ? err.message : String(err)
|
|
57
|
+
);
|
|
58
|
+
sendError.name = err instanceof Error ? err.name : "MessageSendError";
|
|
59
|
+
|
|
60
|
+
// Capture stack trace excluding this function
|
|
61
|
+
Error.captureStackTrace(sendError, sendMessage);
|
|
62
|
+
|
|
46
63
|
port.postMessage({
|
|
47
64
|
type: "ERROR",
|
|
48
65
|
error: {
|
|
49
|
-
message:
|
|
50
|
-
name:
|
|
66
|
+
message: sendError.message,
|
|
67
|
+
name: sendError.name,
|
|
68
|
+
stack: sendError.stack,
|
|
51
69
|
},
|
|
52
70
|
});
|
|
53
71
|
} catch {
|
|
@@ -56,12 +74,3 @@ export function sendMessage(
|
|
|
56
74
|
}
|
|
57
75
|
}
|
|
58
76
|
}
|
|
59
|
-
|
|
60
|
-
export const sendRscWorkerMessage = sendMessage as (
|
|
61
|
-
msg: RscWorkerOutputMessage,
|
|
62
|
-
port?: MessagePort
|
|
63
|
-
) => void;
|
|
64
|
-
export const sendHtmlWorkerMessage = sendMessage as (
|
|
65
|
-
msg: HtmlWorkerOutputMessage,
|
|
66
|
-
port?: MessagePort
|
|
67
|
-
) => void;
|