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
package/plugin/types.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import type { Readable } from "node:stream";
|
|
2
|
-
import type {
|
|
2
|
+
import type {
|
|
3
|
+
Worker,
|
|
4
|
+
Serializable as WorkerSerializable,
|
|
5
|
+
} from "node:worker_threads";
|
|
3
6
|
import type React from "react";
|
|
4
|
-
import type { ExoticComponent, FragmentProps } from "react";
|
|
5
7
|
import type {
|
|
6
8
|
NormalizedOutputOptions,
|
|
7
9
|
OutputBundle,
|
|
@@ -15,30 +17,52 @@ import type {
|
|
|
15
17
|
Connect,
|
|
16
18
|
Logger,
|
|
17
19
|
Manifest,
|
|
20
|
+
Plugin,
|
|
18
21
|
ResolveOptions,
|
|
19
22
|
UserConfig,
|
|
20
23
|
ViteDevServer,
|
|
21
24
|
} from "vite";
|
|
25
|
+
import type {
|
|
26
|
+
serializeResolvedConfig,
|
|
27
|
+
serializeResolvedUserConfig,
|
|
28
|
+
} from "./helpers/serializeUserOptions.js";
|
|
29
|
+
import type { AllowedDirectives, Program } from "./loader/directives/types.js";
|
|
30
|
+
import type { RenderMetrics, StreamMetrics } from "./metrics/types.js";
|
|
31
|
+
import type { HtmlWorkerOutputMessage } from "./worker/html/types.js";
|
|
32
|
+
import type { RscChunkOutputMessage } from "./worker/rsc/types.js";
|
|
22
33
|
import type { ReactServerDomEsmOptions } from "./worker/types.js";
|
|
34
|
+
import type { LoaderConfig, TransformOptions } from "./loader/types.js";
|
|
35
|
+
|
|
36
|
+
export type ReactStreamPluginFn<
|
|
37
|
+
R extends Record<string, unknown> = {
|
|
38
|
+
meta: ReactStreamPluginMeta;
|
|
39
|
+
}
|
|
40
|
+
> = <Opt extends StreamPluginOptions = StreamPluginOptions>(
|
|
41
|
+
options: Opt
|
|
42
|
+
) => Plugin<R>;
|
|
23
43
|
|
|
24
44
|
export type OnEvent = (event: PluginEvent) => void;
|
|
25
45
|
|
|
46
|
+
export type MessageHandler<
|
|
47
|
+
T extends HtmlWorkerOutputMessage | RscChunkOutputMessage =
|
|
48
|
+
| HtmlWorkerOutputMessage
|
|
49
|
+
| RscChunkOutputMessage
|
|
50
|
+
> = (message: T) => void | Promise<unknown>;
|
|
51
|
+
|
|
26
52
|
export type CreateInputNormalizerProps = {
|
|
27
53
|
root: string;
|
|
28
54
|
preserveModulesRoot?: string | undefined;
|
|
29
55
|
removeExtension?: boolean | RegExp | string | ((path: string) => boolean);
|
|
30
56
|
moduleBasePath: string | undefined;
|
|
57
|
+
moduleBaseURL: string | undefined;
|
|
31
58
|
};
|
|
32
59
|
export type Serializable =
|
|
33
|
-
|
|
|
34
|
-
| number
|
|
35
|
-
| boolean
|
|
36
|
-
| null
|
|
37
|
-
| undefined
|
|
60
|
+
| WorkerSerializable
|
|
38
61
|
| Serializable[]
|
|
39
62
|
| SerializableRecord;
|
|
63
|
+
|
|
40
64
|
export type SerializableRecord = {
|
|
41
|
-
[key: string]: Serializable
|
|
65
|
+
[key: string]: Serializable;
|
|
42
66
|
};
|
|
43
67
|
|
|
44
68
|
// Track HMR state
|
|
@@ -84,13 +108,13 @@ export type NormalizerInput = unknown;
|
|
|
84
108
|
|
|
85
109
|
export type InputNormalizer = (input: NormalizerInput) => [string, string];
|
|
86
110
|
|
|
87
|
-
export
|
|
111
|
+
export type HtmlContent = {
|
|
88
112
|
raw: string;
|
|
89
113
|
transformed?: string;
|
|
90
114
|
assets?: string[];
|
|
91
|
-
}
|
|
115
|
+
};
|
|
92
116
|
|
|
93
|
-
export
|
|
117
|
+
export type PartialPageData = {
|
|
94
118
|
route: string;
|
|
95
119
|
html?: {
|
|
96
120
|
raw: string;
|
|
@@ -98,10 +122,10 @@ export interface PartialPageData {
|
|
|
98
122
|
assets?: string[];
|
|
99
123
|
};
|
|
100
124
|
rsc?: {
|
|
101
|
-
modules:
|
|
125
|
+
modules: unknown[];
|
|
102
126
|
content: string;
|
|
103
127
|
};
|
|
104
|
-
}
|
|
128
|
+
};
|
|
105
129
|
|
|
106
130
|
export type InputNormalizerWorker = (
|
|
107
131
|
input: NormalizerInput
|
|
@@ -141,18 +165,27 @@ export type ResolvedUserConfig = Required<
|
|
|
141
165
|
>;
|
|
142
166
|
};
|
|
143
167
|
|
|
144
|
-
export type SerializedUserConfig
|
|
145
|
-
ResolvedUserConfig
|
|
146
|
-
|
|
147
|
-
|
|
168
|
+
export type SerializedUserConfig<
|
|
169
|
+
T extends ResolvedUserConfig = ResolvedUserConfig
|
|
170
|
+
> = ReturnType<typeof serializeResolvedUserConfig<T>>;
|
|
171
|
+
|
|
172
|
+
export type SerializedUserOptions = {
|
|
173
|
+
[k in keyof ResolvedUserOptions]: Extract<
|
|
174
|
+
ResolvedUserOptions[k],
|
|
175
|
+
Serializable | Record<string, Serializable>
|
|
176
|
+
> extends infer X
|
|
177
|
+
? X extends never
|
|
178
|
+
? undefined
|
|
179
|
+
: X
|
|
180
|
+
: undefined;
|
|
181
|
+
};
|
|
148
182
|
|
|
149
|
-
export type
|
|
150
|
-
|
|
151
|
-
SerializableRecord
|
|
183
|
+
export type SerializedResolvedConfig = ReturnType<
|
|
184
|
+
typeof serializeResolvedConfig
|
|
152
185
|
>;
|
|
153
186
|
|
|
154
187
|
// Client plugin options
|
|
155
|
-
export
|
|
188
|
+
export type StreamPluginOptionsClient = {
|
|
156
189
|
outDir?: string;
|
|
157
190
|
build?: BuildConfig;
|
|
158
191
|
assetsDir?: string;
|
|
@@ -162,109 +195,186 @@ export interface StreamPluginOptionsClient {
|
|
|
162
195
|
moduleBaseURL?: string;
|
|
163
196
|
clientComponents?: AliasOptions;
|
|
164
197
|
cssFiles?: AliasOptions;
|
|
165
|
-
}
|
|
198
|
+
};
|
|
166
199
|
|
|
167
|
-
export type
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
virtualPattern: (path: string) => boolean;
|
|
232
|
-
isServerFunctionCode: (code: string) => boolean;
|
|
233
|
-
isClientComponentCode: (code: string) => boolean;
|
|
234
|
-
};
|
|
200
|
+
export type StringKeys =
|
|
201
|
+
| "moduleBase"
|
|
202
|
+
| "moduleBasePath"
|
|
203
|
+
| "moduleBaseURL"
|
|
204
|
+
| "moduleRootPath"
|
|
205
|
+
| "projectRoot"
|
|
206
|
+
| "pageExportName"
|
|
207
|
+
| "propsExportName"
|
|
208
|
+
| "htmlWorkerPath"
|
|
209
|
+
| "rscWorkerPath"
|
|
210
|
+
| "loaderPath"
|
|
211
|
+
| "reactLoaderPath"
|
|
212
|
+
| "cssLoaderPath"
|
|
213
|
+
| "envLoaderPath"
|
|
214
|
+
| "clientEntry"
|
|
215
|
+
| "serverEntry"
|
|
216
|
+
| "publicOrigin";
|
|
217
|
+
|
|
218
|
+
export type NumberKeys =
|
|
219
|
+
| "rscTimeout"
|
|
220
|
+
| "htmlWorkerStartupTimeout"
|
|
221
|
+
| "rscWorkerStartupTimeout";
|
|
222
|
+
|
|
223
|
+
export type BooleanKeys = "verbose";
|
|
224
|
+
|
|
225
|
+
export type NestedConfigKeys =
|
|
226
|
+
| "build"
|
|
227
|
+
| "autoDiscover"
|
|
228
|
+
| "loader"
|
|
229
|
+
| "css"
|
|
230
|
+
| "pipeableStreamOptions";
|
|
231
|
+
|
|
232
|
+
export type EventKeys = "onMetrics" | "onEvent";
|
|
233
|
+
|
|
234
|
+
export type NormalizerKeys = "normalizer" | "moduleID";
|
|
235
|
+
|
|
236
|
+
export type ComponentKeys = "Html" | "Root";
|
|
237
|
+
|
|
238
|
+
export type SourceURLKeys = "Page" | "props";
|
|
239
|
+
|
|
240
|
+
export type OptKey =
|
|
241
|
+
| StringKeys
|
|
242
|
+
| NumberKeys
|
|
243
|
+
| BooleanKeys
|
|
244
|
+
| EventKeys
|
|
245
|
+
| NormalizerKeys
|
|
246
|
+
| ComponentKeys
|
|
247
|
+
| SourceURLKeys;
|
|
248
|
+
|
|
249
|
+
export type AutoDiscoverConfig = {
|
|
250
|
+
modulePattern: RegExp;
|
|
251
|
+
serverPattern: RegExp;
|
|
252
|
+
clientPattern: RegExp;
|
|
253
|
+
pagePattern: RegExp;
|
|
254
|
+
propsPattern: RegExp;
|
|
255
|
+
cssPattern: RegExp;
|
|
256
|
+
jsonPattern: RegExp;
|
|
257
|
+
htmlPattern: RegExp;
|
|
258
|
+
cssModulePattern: RegExp;
|
|
259
|
+
vendorPattern: RegExp;
|
|
260
|
+
nodePattern: RegExp;
|
|
261
|
+
dotPattern: RegExp;
|
|
262
|
+
virtualPattern: RegExp;
|
|
263
|
+
rscPattern: RegExp;
|
|
235
264
|
};
|
|
236
265
|
|
|
237
|
-
export
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
backpressureCount: number;
|
|
241
|
-
drainCount: number;
|
|
242
|
-
errorCount: number;
|
|
243
|
-
duration: number;
|
|
244
|
-
startTime: number;
|
|
245
|
-
}
|
|
266
|
+
export type GenericModuleLoader = (
|
|
267
|
+
id: string
|
|
268
|
+
) => Promise<Record<string, unknown>>;
|
|
246
269
|
|
|
247
|
-
export
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
}
|
|
270
|
+
export type BuildModuleLoader<
|
|
271
|
+
Opt extends Pick<
|
|
272
|
+
ResolvedUserOptions,
|
|
273
|
+
"pageExportName" | "propsExportName"
|
|
274
|
+
> = Pick<ResolvedUserOptions, "pageExportName" | "propsExportName">,
|
|
275
|
+
T extends PagePropOpt = PagePropOpt
|
|
276
|
+
> = <
|
|
277
|
+
STR extends string,
|
|
278
|
+
ID extends string = STR extends `${infer I extends string}${string}${string}`
|
|
279
|
+
? I
|
|
280
|
+
: never,
|
|
281
|
+
Special extends "?" | "#" | "" = STR extends `${string}${infer X extends
|
|
282
|
+
| "?"
|
|
283
|
+
| "#"}${string}`
|
|
284
|
+
? X
|
|
285
|
+
: "",
|
|
286
|
+
Extra extends string = STR extends `${string}${string}${infer Y extends string}`
|
|
287
|
+
? Y
|
|
288
|
+
: ""
|
|
289
|
+
>(
|
|
290
|
+
moduleId: STR
|
|
291
|
+
) => Promise<
|
|
292
|
+
STR extends `${ID}${Special}${Extra}`
|
|
293
|
+
? `${Special}${Extra}` extends "?inline"
|
|
294
|
+
? { default: string }
|
|
295
|
+
: Extra extends Opt["pageExportName"]
|
|
296
|
+
? {
|
|
297
|
+
[k in Extra]: (props: T) => unknown;
|
|
298
|
+
}
|
|
299
|
+
: Extra extends Opt["propsExportName"]
|
|
300
|
+
? {
|
|
301
|
+
[k in Extra]: T;
|
|
302
|
+
}
|
|
303
|
+
: Extra extends string
|
|
304
|
+
? Special extends "#"
|
|
305
|
+
? { [k in Extra]: unknown }
|
|
306
|
+
: Record<string, unknown>
|
|
307
|
+
: Record<string, unknown>
|
|
308
|
+
: Record<string, unknown>
|
|
309
|
+
>;
|
|
310
|
+
|
|
311
|
+
export type StreamError = {
|
|
312
|
+
code?: string;
|
|
313
|
+
} & Error;
|
|
314
|
+
|
|
315
|
+
export type ResolvedUserOptions = {
|
|
316
|
+
// Core required properties
|
|
317
|
+
projectRoot: string;
|
|
318
|
+
moduleBase: string;
|
|
319
|
+
moduleBasePath: string;
|
|
320
|
+
moduleBaseURL: string;
|
|
321
|
+
moduleRootPath: string;
|
|
322
|
+
publicOrigin: string;
|
|
323
|
+
pageExportName: string;
|
|
324
|
+
propsExportName: string;
|
|
325
|
+
htmlExportName: string;
|
|
326
|
+
rootExportName: string;
|
|
327
|
+
htmlWorkerPath: string;
|
|
328
|
+
rscWorkerPath: string;
|
|
329
|
+
loaderPath: string;
|
|
330
|
+
reactLoaderPath?: string;
|
|
331
|
+
cssLoaderPath?: string;
|
|
332
|
+
envLoaderPath?: string;
|
|
333
|
+
verbose: boolean;
|
|
334
|
+
rscTimeout: number;
|
|
335
|
+
htmlWorkerStartupTimeout: number;
|
|
336
|
+
rscWorkerStartupTimeout: number;
|
|
337
|
+
panicThreshold: "none" | "critical_errors" | "all_errors";
|
|
338
|
+
|
|
339
|
+
// Optional properties
|
|
340
|
+
onEvent?: (event: PluginEvent) => void;
|
|
341
|
+
props?: StreamPluginOptions["props"];
|
|
342
|
+
clientEntry?: string;
|
|
343
|
+
serverEntry?: string;
|
|
344
|
+
|
|
345
|
+
// Required complex properties
|
|
346
|
+
Page: StreamPluginOptions["Page"];
|
|
347
|
+
Html: StreamPluginOptions["Html"]; // Unresolved: can be string, function
|
|
348
|
+
Root: StreamPluginOptions["Root"]; // Unresolved: can be string, function
|
|
349
|
+
normalizer: InputNormalizer;
|
|
350
|
+
moduleID: ((id: string) => string) | undefined;
|
|
351
|
+
onMetrics: (metrics: RenderMetrics) => void;
|
|
352
|
+
pipeableStreamOptions: ReactServerDomEsmOptions;
|
|
353
|
+
autoDiscover: Required<AutoDiscoverConfig>;
|
|
354
|
+
loader: Required<LoaderConfig>;
|
|
355
|
+
build: Required<BuildConfig>;
|
|
356
|
+
css: RootOptions<boolean>;
|
|
357
|
+
components?: StreamPluginOptions["components"]; // Direct component overrides (optional)
|
|
358
|
+
};
|
|
259
359
|
|
|
260
|
-
export
|
|
261
|
-
|
|
262
|
-
|
|
360
|
+
export type DirectiveOptions = Pick<
|
|
361
|
+
TransformOptions,
|
|
362
|
+
"verbose" | "panicThreshold" | "loader"
|
|
363
|
+
> & {
|
|
364
|
+
loader: Pick<
|
|
365
|
+
Required<NonNullable<TransformOptions["loader"]>>,
|
|
366
|
+
"isServerFunctionCode" | "isClientComponentCode" | "getDirectiveType"
|
|
367
|
+
> & {
|
|
368
|
+
allowedDirectives: AllowedDirectives;
|
|
369
|
+
};
|
|
370
|
+
};
|
|
371
|
+
|
|
372
|
+
export type RootOptions<InlineCSS extends InlineCssOpt = InlineCssOpt> = {
|
|
263
373
|
inlineCss?: InlineCSS;
|
|
264
374
|
inlineThreshold?: number;
|
|
265
375
|
inlinePatterns?: RegExp[];
|
|
266
376
|
linkPatterns?: RegExp[];
|
|
267
|
-
}
|
|
377
|
+
};
|
|
268
378
|
|
|
269
379
|
export type CssContent<InlineCSS extends InlineCssOpt = InlineCssOpt> =
|
|
270
380
|
InlineCSS extends true
|
|
@@ -276,50 +386,38 @@ export type CssContent<InlineCSS extends InlineCssOpt = InlineCssOpt> =
|
|
|
276
386
|
: never;
|
|
277
387
|
|
|
278
388
|
/**
|
|
279
|
-
* Boxed component type for the
|
|
389
|
+
* Boxed component type for the Root
|
|
280
390
|
*/
|
|
281
|
-
export type
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
InlineCSS extends _InlineCSS = _InlineCSS,
|
|
288
|
-
As extends _As = _As
|
|
289
|
-
>(
|
|
290
|
-
props: CssCollectorProps<T, InlineCSS, As>
|
|
291
|
-
) => React.ReactElement;
|
|
391
|
+
export type RootComponentType<
|
|
392
|
+
As extends AsOpt = AsOpt,
|
|
393
|
+
InlineCSS extends InlineCssOpt = InlineCssOpt,
|
|
394
|
+
PageProps extends PagePropOpt = PagePropOpt,
|
|
395
|
+
ReactType = any
|
|
396
|
+
> = (props: RootProps<PageProps, InlineCSS, As>) => ReactType;
|
|
292
397
|
|
|
293
|
-
export type
|
|
294
|
-
|
|
398
|
+
export type RootProps<
|
|
399
|
+
PageProps extends PagePropOpt = PagePropOpt,
|
|
295
400
|
InlineCSS extends InlineCssOpt = InlineCssOpt,
|
|
296
401
|
As extends AsOpt = AsOpt
|
|
297
402
|
> = {
|
|
298
403
|
as: As;
|
|
299
404
|
cssFiles?: Map<string, CssContent<InlineCSS>>;
|
|
300
|
-
pageProps?:
|
|
301
|
-
Page: PageComponentType<
|
|
405
|
+
pageProps?: PageProps;
|
|
406
|
+
Page: PageComponentType<PageProps>;
|
|
302
407
|
id?: string;
|
|
303
|
-
}
|
|
408
|
+
};
|
|
304
409
|
|
|
305
|
-
export type
|
|
306
|
-
props: CssCollectorProps
|
|
307
|
-
) => React.ReactElement;
|
|
410
|
+
export type RootComponent = (props: RootProps) => React.ReactNode;
|
|
308
411
|
|
|
309
412
|
/**
|
|
310
413
|
* Boxed component type for the Html component
|
|
311
414
|
*/
|
|
312
|
-
export type
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
InlineCSS extends _InlineCSS = _InlineCSS,
|
|
319
|
-
As extends _As = _As
|
|
320
|
-
>(
|
|
321
|
-
props: HtmlProps<T, InlineCSS, As> & { key?: string }
|
|
322
|
-
) => React.ReactNode;
|
|
415
|
+
export type HtmlComponentType<
|
|
416
|
+
T extends PagePropOpt = PagePropOpt,
|
|
417
|
+
InlineCSS extends InlineCssOpt = InlineCssOpt,
|
|
418
|
+
As extends AsOpt = AsOpt,
|
|
419
|
+
ReactType = any
|
|
420
|
+
> = ((props: HtmlProps<T, InlineCSS, As>) => ReactType) | any;
|
|
323
421
|
|
|
324
422
|
export type FileWriteEvent = {
|
|
325
423
|
type: "file.write";
|
|
@@ -354,7 +452,7 @@ export type RouteErrorEvent = {
|
|
|
354
452
|
type: "route.error";
|
|
355
453
|
data: {
|
|
356
454
|
route: string;
|
|
357
|
-
error
|
|
455
|
+
error?: Error | null;
|
|
358
456
|
};
|
|
359
457
|
};
|
|
360
458
|
|
|
@@ -362,7 +460,7 @@ export type RoutePostponeEvent = {
|
|
|
362
460
|
type: "route.postpone";
|
|
363
461
|
data: {
|
|
364
462
|
route: string;
|
|
365
|
-
reason
|
|
463
|
+
reason?: string | null;
|
|
366
464
|
};
|
|
367
465
|
};
|
|
368
466
|
|
|
@@ -371,7 +469,7 @@ export type PropsLoadEvent = {
|
|
|
371
469
|
data: {
|
|
372
470
|
route: string;
|
|
373
471
|
propsPath: string;
|
|
374
|
-
props:
|
|
472
|
+
props: unknown;
|
|
375
473
|
};
|
|
376
474
|
};
|
|
377
475
|
|
|
@@ -443,11 +541,15 @@ export type PluginEvent =
|
|
|
443
541
|
|
|
444
542
|
export type PluginEventType = PluginEvent["type"];
|
|
445
543
|
|
|
446
|
-
export
|
|
544
|
+
export type StreamPluginOptions<
|
|
447
545
|
T extends PagePropOpt = PagePropOpt,
|
|
448
546
|
InlineCSS extends InlineCssOpt = InlineCssOpt,
|
|
449
|
-
As extends AsOpt = AsOpt
|
|
450
|
-
|
|
547
|
+
As extends AsOpt = AsOpt,
|
|
548
|
+
N1 extends string = PageName,
|
|
549
|
+
N2 extends string = PropsName,
|
|
550
|
+
N3 extends string = HtmlName,
|
|
551
|
+
N4 extends string = RootName
|
|
552
|
+
> = {
|
|
451
553
|
projectRoot?: string; // defaults to process.cwd()
|
|
452
554
|
moduleBase: string; // defaults to 'src'
|
|
453
555
|
moduleBasePath?: string; // defaults to '/'
|
|
@@ -455,77 +557,225 @@ export interface StreamPluginOptions<
|
|
|
455
557
|
moduleRootPath?: string; // defaults to client's dist folder
|
|
456
558
|
publicOrigin?: string; // defaults to window.location.origin in client & http://localhost:port in development
|
|
457
559
|
clientEntry?: string;
|
|
458
|
-
serverEntry?: string;
|
|
560
|
+
serverEntry?: string; // Loader configuration
|
|
561
|
+
loader?: {
|
|
562
|
+
importServerPath?: string;
|
|
563
|
+
importClientPath?: string;
|
|
564
|
+
registerClientReferenceName?: string;
|
|
565
|
+
registerServerReferenceName?: string;
|
|
566
|
+
serverDirective?: RegExpOpt;
|
|
567
|
+
clientDirective?: RegExpOpt;
|
|
568
|
+
directivePattern?: RegExpOpt;
|
|
569
|
+
isServerFunctionCode?: (code: string, moduleId?: string) => boolean;
|
|
570
|
+
isClientComponentCode?: (code: string, moduleId?: string) => boolean;
|
|
571
|
+
allowedDirectives?: string[] | AllowedDirectives;
|
|
572
|
+
mode?: "development" | "production" | "test";
|
|
573
|
+
getDirectiveType?: (
|
|
574
|
+
directive: string,
|
|
575
|
+
moduleId?: string
|
|
576
|
+
) => "client" | "server" | undefined;
|
|
577
|
+
parse?: (source: string) => Promise<{
|
|
578
|
+
ast: Program;
|
|
579
|
+
code: string;
|
|
580
|
+
map?: { url: string; start: number; end: number; lines: number } | null;
|
|
581
|
+
}>;
|
|
582
|
+
};
|
|
459
583
|
// Auto-discovery (zero-config)
|
|
460
584
|
autoDiscover?:
|
|
461
585
|
| {
|
|
462
|
-
//
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
586
|
+
// CSS related
|
|
587
|
+
/**
|
|
588
|
+
* Pattern to match CSS files. If not provided, uses default pattern.
|
|
589
|
+
* Provide either a string pattern or RegExp.
|
|
590
|
+
* @example ```ts
|
|
591
|
+
* autoDiscover: {
|
|
592
|
+
* // String pattern
|
|
593
|
+
* cssPattern: ".css$",
|
|
594
|
+
* // Or RegExp pattern
|
|
595
|
+
* cssPattern: /\.css$/
|
|
596
|
+
* }
|
|
597
|
+
*/
|
|
598
|
+
cssPattern?: RegExpOpt;
|
|
599
|
+
/**
|
|
600
|
+
* Pattern to match CSS module files. If not provided, uses default pattern.
|
|
601
|
+
* Provide either a string pattern or RegExp.
|
|
602
|
+
* @example ```ts
|
|
603
|
+
* autoDiscover: {
|
|
604
|
+
* // String pattern
|
|
605
|
+
* cssModulePattern: ".css\\.js$",
|
|
606
|
+
* // Or RegExp pattern
|
|
607
|
+
* cssModulePattern: /\.css\.js$/
|
|
608
|
+
* }
|
|
609
|
+
*/
|
|
610
|
+
cssModulePattern?: RegExpOpt;
|
|
611
|
+
|
|
612
|
+
// Client/Server related
|
|
613
|
+
/**
|
|
614
|
+
* Pattern to match client component files. If not provided, uses default pattern.
|
|
615
|
+
* Provide either a string pattern or RegExp.
|
|
616
|
+
* @example ```ts
|
|
617
|
+
* autoDiscover: {
|
|
618
|
+
* // String pattern
|
|
619
|
+
* clientPattern: ".client\\.(js|ts|jsx|tsx)$",
|
|
620
|
+
* // Or RegExp pattern
|
|
621
|
+
* clientPattern: /\.client\.(js|ts|jsx|tsx)$/
|
|
622
|
+
* }
|
|
623
|
+
*/
|
|
624
|
+
clientPattern?: RegExpOpt;
|
|
625
|
+
/**
|
|
626
|
+
* Pattern to match server function files. If not provided, uses default pattern.
|
|
627
|
+
* Provide either a string pattern or RegExp.
|
|
628
|
+
* @example ```ts
|
|
629
|
+
* autoDiscover: {
|
|
630
|
+
* // String pattern
|
|
631
|
+
* serverPattern: ".server\\.(js|ts|jsx|tsx)$",
|
|
632
|
+
* // Or RegExp pattern
|
|
633
|
+
* serverPattern: /\.server\.(js|ts|jsx|tsx)$/
|
|
634
|
+
* }
|
|
635
|
+
*/
|
|
636
|
+
serverPattern?: RegExpOpt;
|
|
637
|
+
|
|
638
|
+
// HTML related
|
|
639
|
+
/**
|
|
640
|
+
* Pattern to match HTML files. If not provided, uses default pattern.
|
|
641
|
+
* Provide either a string pattern or RegExp.
|
|
642
|
+
* @example ```ts
|
|
643
|
+
* autoDiscover: {
|
|
644
|
+
* // String pattern
|
|
645
|
+
* htmlPattern: ".html$",
|
|
646
|
+
* // Or RegExp pattern
|
|
647
|
+
* htmlPattern: /\.html$/
|
|
648
|
+
* }
|
|
649
|
+
*/
|
|
650
|
+
htmlPattern?: RegExpOpt;
|
|
651
|
+
|
|
652
|
+
// JSON related
|
|
653
|
+
/**
|
|
654
|
+
* Pattern to match JSON files. If not provided, uses default pattern.
|
|
655
|
+
* Provide either a string pattern or RegExp.
|
|
656
|
+
* @example ```ts
|
|
657
|
+
* autoDiscover: {
|
|
658
|
+
* // String pattern
|
|
659
|
+
* jsonPattern: ".json$",
|
|
660
|
+
* // Or RegExp pattern
|
|
661
|
+
* jsonPattern: /\.json$/
|
|
662
|
+
* }
|
|
663
|
+
*/
|
|
664
|
+
jsonPattern?: RegExpOpt;
|
|
665
|
+
|
|
666
|
+
// JS/Module related
|
|
667
|
+
|
|
668
|
+
/**
|
|
669
|
+
* Pattern to match module files. If not provided, uses default pattern.
|
|
670
|
+
* Provide either a string pattern or RegExp.
|
|
671
|
+
* @example ```ts
|
|
672
|
+
* autoDiscover: {
|
|
673
|
+
* // String pattern
|
|
674
|
+
* modulePattern: "\\.(js|ts|jsx|tsx)$",
|
|
675
|
+
* // Or RegExp pattern
|
|
676
|
+
* modulePattern: /\.(js|ts|jsx|tsx)$/
|
|
677
|
+
* }
|
|
678
|
+
*/
|
|
479
679
|
modulePattern?: RegExpOpt;
|
|
480
|
-
|
|
680
|
+
|
|
681
|
+
// RSC related
|
|
682
|
+
/**
|
|
683
|
+
* Pattern to match RSC files. If not provided, uses default pattern.
|
|
684
|
+
* Provide either a string pattern or RegExp.
|
|
685
|
+
* @example ```ts
|
|
686
|
+
* autoDiscover: {
|
|
687
|
+
* // String pattern
|
|
688
|
+
* rscPattern: ".rsc$",
|
|
689
|
+
* // Or RegExp pattern
|
|
690
|
+
* rscPattern: /\.rsc$/
|
|
691
|
+
* }
|
|
692
|
+
*/
|
|
693
|
+
rscPattern?: RegExpOpt;
|
|
694
|
+
|
|
695
|
+
// Page/Props related
|
|
696
|
+
/**
|
|
697
|
+
* Pattern to match page files. If not provided, uses default pattern.
|
|
698
|
+
* Provide either a string pattern or RegExp.
|
|
699
|
+
* @example ```ts
|
|
700
|
+
* autoDiscover: {
|
|
701
|
+
* // String pattern
|
|
702
|
+
* pagePattern: "[Pp]age\\.(js|ts|jsx|tsx)$",
|
|
703
|
+
* // Or RegExp pattern
|
|
704
|
+
* pagePattern: /[Pp]age\.(js|ts|jsx|tsx)$/
|
|
705
|
+
* }
|
|
706
|
+
*/
|
|
481
707
|
pagePattern?: RegExpOpt;
|
|
482
|
-
|
|
708
|
+
/**
|
|
709
|
+
* Pattern to match props files. If not provided, uses default pattern.
|
|
710
|
+
* Provide either a string pattern or RegExp.
|
|
711
|
+
* @example ```ts
|
|
712
|
+
* autoDiscover: {
|
|
713
|
+
* // String pattern
|
|
714
|
+
* propsPattern: "[Pp]rops\\.(js|ts|jsx|tsx)$",
|
|
715
|
+
* // Or RegExp pattern
|
|
716
|
+
* propsPattern: /[Pp]rops\.(js|ts|jsx|tsx)$/
|
|
717
|
+
* }
|
|
718
|
+
*/
|
|
483
719
|
propsPattern?: RegExpOpt;
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
720
|
+
|
|
721
|
+
// Special patterns
|
|
722
|
+
/**
|
|
723
|
+
* Pattern to match dot files. No interpolation support.
|
|
724
|
+
* @example ```ts
|
|
725
|
+
* autoDiscover: {
|
|
726
|
+
* dotFiles: /^\.[^/]+$/
|
|
727
|
+
* }
|
|
728
|
+
*/
|
|
729
|
+
dotPattern?: RegExpOpt;
|
|
730
|
+
/**
|
|
731
|
+
* Pattern to match Node.js native modules. No interpolation support.
|
|
732
|
+
* @example ```ts
|
|
733
|
+
* autoDiscover: {
|
|
734
|
+
* nodePattern: /.node/
|
|
735
|
+
* }
|
|
736
|
+
*/
|
|
737
|
+
nodePattern?: RegExpOpt;
|
|
738
|
+
/**
|
|
739
|
+
* Pattern to match vendor files. No interpolation support.
|
|
740
|
+
* @example ```ts
|
|
741
|
+
* autoDiscover: {
|
|
742
|
+
* vendorPattern: /node_modules|_virtual/
|
|
743
|
+
* }
|
|
744
|
+
*/
|
|
497
745
|
vendorPattern?: RegExpOpt;
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
746
|
+
/**
|
|
747
|
+
* Pattern to match virtual files. No interpolation support.
|
|
748
|
+
* @example ```ts
|
|
749
|
+
* autoDiscover: {
|
|
750
|
+
* virtualPattern: /^virtual:/
|
|
751
|
+
* }
|
|
752
|
+
*/
|
|
503
753
|
virtualPattern?: RegExpOpt;
|
|
504
|
-
// default: /\.rsc$/
|
|
505
|
-
rscPattern?: RegExpOpt;
|
|
506
|
-
// default serverDirective regex
|
|
507
|
-
isServerFunctionCode?: (code: string, moduleId?: string) => boolean;
|
|
508
|
-
// default clientDirective regex
|
|
509
|
-
isClientComponentCode?: (code: string, moduleId?: string) => boolean;
|
|
510
754
|
}
|
|
511
755
|
| undefined;
|
|
512
756
|
// Manual configuration
|
|
513
|
-
Page
|
|
514
|
-
props?:
|
|
515
|
-
| undefined
|
|
516
|
-
| string
|
|
517
|
-
| ((url: string) => string)
|
|
518
|
-
| ((url: string) => Promise<string>);
|
|
757
|
+
Page?: UrlOpt;
|
|
758
|
+
props?: UrlOpt;
|
|
519
759
|
// Escape hatches
|
|
520
760
|
htmlWorkerPath?: string;
|
|
521
761
|
rscWorkerPath?: string;
|
|
522
762
|
loaderPath?: string;
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
763
|
+
reactLoaderPath?: string;
|
|
764
|
+
cssLoaderPath?: string;
|
|
765
|
+
envLoaderPath?: string;
|
|
766
|
+
pageExportName?: N1;
|
|
767
|
+
propsExportName?: N2;
|
|
768
|
+
htmlExportName?: N3;
|
|
769
|
+
rootExportName?: N4;
|
|
770
|
+
Html?: UrlOpt;
|
|
771
|
+
Root?: UrlOpt;
|
|
772
|
+
// Direct component overrides (bypasses string resolution)
|
|
773
|
+
components?: {
|
|
774
|
+
Html?: React.FC<HtmlProps<T, InlineCSS, As>> | typeof React.Fragment;
|
|
775
|
+
Root?: RootComponentType;
|
|
776
|
+
};
|
|
527
777
|
build?: BuildConfig;
|
|
528
|
-
css?:
|
|
778
|
+
css?: RootOptions<InlineCSS>;
|
|
529
779
|
// moduleBaseExceptions?: string[];
|
|
530
780
|
pipeableStreamOptions?: ReactServerDomEsmOptions;
|
|
531
781
|
onMetrics?: (metrics: RenderMetrics) => void;
|
|
@@ -533,59 +783,72 @@ export interface StreamPluginOptions<
|
|
|
533
783
|
normalizer?: InputNormalizer;
|
|
534
784
|
moduleID?: (id: string) => string;
|
|
535
785
|
verbose?: boolean;
|
|
536
|
-
|
|
786
|
+
rscTimeout?: number; // Timeout in milliseconds for RSC operations
|
|
787
|
+
htmlWorkerStartupTimeout?: number; // Timeout in milliseconds for HTML worker startup
|
|
788
|
+
rscWorkerStartupTimeout?: number; // Timeout in milliseconds for RSC worker startup
|
|
789
|
+
panicThreshold?: "none" | "critical_errors" | "all_errors";
|
|
790
|
+
};
|
|
537
791
|
|
|
538
792
|
export type MultiPageHandlerOptions<
|
|
539
|
-
|
|
540
|
-
InlineCSS extends InlineCssOpt = InlineCssOpt
|
|
793
|
+
Opt extends ResolvedUserOptions = ResolvedUserOptions
|
|
541
794
|
> = Omit<
|
|
542
|
-
CreateHandlerOptions<
|
|
795
|
+
CreateHandlerOptions<Opt>,
|
|
543
796
|
| "pagePath"
|
|
544
797
|
| "route"
|
|
545
798
|
| "cssFiles"
|
|
546
799
|
| "propsPath"
|
|
800
|
+
| "rootPath"
|
|
801
|
+
| "htmlPath"
|
|
547
802
|
| "pageProps"
|
|
548
803
|
| "PageComponent"
|
|
804
|
+
| "RootComponent"
|
|
805
|
+
| "HtmlComponent"
|
|
549
806
|
>;
|
|
550
807
|
|
|
551
808
|
export type CreateHandlerOptions<
|
|
552
|
-
|
|
553
|
-
InlineCSS extends InlineCssOpt = InlineCssOpt
|
|
809
|
+
Opt extends ResolvedUserOptions = ResolvedUserOptions
|
|
554
810
|
> = Pick<
|
|
555
|
-
|
|
811
|
+
Opt,
|
|
556
812
|
| "autoDiscover"
|
|
557
813
|
| "css"
|
|
558
814
|
| "pageExportName"
|
|
559
815
|
| "propsExportName"
|
|
560
|
-
| "
|
|
561
|
-
| "
|
|
816
|
+
| "rootExportName"
|
|
817
|
+
| "htmlExportName"
|
|
562
818
|
| "moduleBase"
|
|
563
819
|
| "moduleRootPath"
|
|
564
820
|
| "moduleBasePath"
|
|
565
821
|
| "moduleBaseURL"
|
|
566
822
|
| "publicOrigin"
|
|
567
|
-
| "pipeableStreamOptions"
|
|
568
823
|
| "onEvent"
|
|
569
824
|
| "onMetrics"
|
|
570
825
|
| "projectRoot"
|
|
571
826
|
| "normalizer"
|
|
572
827
|
| "moduleID"
|
|
828
|
+
| "verbose"
|
|
829
|
+
| "components"
|
|
573
830
|
> & {
|
|
574
831
|
logger: Logger;
|
|
575
|
-
loader:
|
|
832
|
+
loader: BuildModuleLoader | GenericModuleLoader;
|
|
576
833
|
pagePath: string;
|
|
577
834
|
propsPath?: string;
|
|
578
|
-
|
|
579
|
-
|
|
835
|
+
rootPath?: string;
|
|
836
|
+
htmlPath?: string;
|
|
837
|
+
pageProps?: PagePropOpt;
|
|
838
|
+
PageComponent?: PageComponentType<PagePropOpt>;
|
|
839
|
+
RootComponent?: RootComponentType;
|
|
840
|
+
HtmlComponent?: HtmlComponentType<PagePropOpt>;
|
|
580
841
|
route: string;
|
|
842
|
+
as?: AsOpt;
|
|
581
843
|
manifest: Manifest;
|
|
582
844
|
worker?: Worker;
|
|
583
845
|
server?: ViteDevServer;
|
|
584
846
|
importedCss?: Set<string>;
|
|
585
|
-
cssFiles: Map<string, CssContent<
|
|
586
|
-
globalCss: Map<string, CssContent<
|
|
847
|
+
cssFiles: Map<string, CssContent<InlineCssOpt>>;
|
|
848
|
+
globalCss: Map<string, CssContent<InlineCssOpt>>;
|
|
849
|
+
pipeableStreamOptions: ReactServerDomEsmOptions;
|
|
587
850
|
build: Pick<
|
|
588
|
-
ResolvedUserOptions
|
|
851
|
+
ResolvedUserOptions["build"],
|
|
589
852
|
| "outDir"
|
|
590
853
|
| "pages"
|
|
591
854
|
| "server"
|
|
@@ -596,36 +859,30 @@ export type CreateHandlerOptions<
|
|
|
596
859
|
>;
|
|
597
860
|
};
|
|
598
861
|
|
|
599
|
-
export
|
|
862
|
+
export type ResolvePageOptions = {
|
|
600
863
|
pagePath: string;
|
|
601
864
|
pageExportName: string;
|
|
602
865
|
url: string;
|
|
603
|
-
}
|
|
866
|
+
};
|
|
604
867
|
|
|
605
|
-
export
|
|
868
|
+
export type ResolvePropsOptions = {
|
|
606
869
|
propsPath: string;
|
|
607
870
|
propsExportName: string;
|
|
608
871
|
url: string;
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
export type ModuleLoader = (
|
|
612
|
-
url: string,
|
|
613
|
-
context?: any,
|
|
614
|
-
defaultLoad?: any
|
|
615
|
-
) => Promise<Record<string, any>>;
|
|
872
|
+
};
|
|
616
873
|
|
|
617
|
-
export
|
|
618
|
-
manifest:
|
|
874
|
+
export type BaseProps = {
|
|
875
|
+
manifest: Manifest;
|
|
619
876
|
children?: React.ReactNode;
|
|
620
877
|
assets?: {
|
|
621
878
|
css?: string[];
|
|
622
879
|
};
|
|
623
|
-
}
|
|
880
|
+
};
|
|
624
881
|
|
|
625
882
|
export type StreamResult =
|
|
626
883
|
| {
|
|
627
884
|
type: "success";
|
|
628
|
-
stream:
|
|
885
|
+
stream: PassThrough;
|
|
629
886
|
assets?: {
|
|
630
887
|
css?: string[];
|
|
631
888
|
};
|
|
@@ -633,7 +890,7 @@ export type StreamResult =
|
|
|
633
890
|
| { type: "error"; error: unknown }
|
|
634
891
|
| { type: "skip" };
|
|
635
892
|
|
|
636
|
-
export
|
|
893
|
+
export type RouteConfig = {
|
|
637
894
|
path: string;
|
|
638
895
|
// Define page/props paths using patterns
|
|
639
896
|
pattern?: {
|
|
@@ -645,15 +902,15 @@ export interface RouteConfig {
|
|
|
645
902
|
page: string; // e.g. "page/home/page"
|
|
646
903
|
props: string; // e.g. "page/home/props"
|
|
647
904
|
};
|
|
648
|
-
}
|
|
905
|
+
};
|
|
649
906
|
|
|
650
|
-
export
|
|
907
|
+
export type BuildOutput = {
|
|
651
908
|
dir?: string;
|
|
652
909
|
rsc?: string;
|
|
653
910
|
ext?: string;
|
|
654
|
-
}
|
|
911
|
+
};
|
|
655
912
|
|
|
656
|
-
export
|
|
913
|
+
export type BuildConfig = {
|
|
657
914
|
pages: string[] | (() => Promise<string[]> | string[]) | Promise<string[]>;
|
|
658
915
|
assetsDir?: string;
|
|
659
916
|
client?: string; // Output directory for client files
|
|
@@ -662,52 +919,27 @@ export interface BuildConfig {
|
|
|
662
919
|
api?: string; // Output directory for API files
|
|
663
920
|
outDir?: string;
|
|
664
921
|
hash?: string;
|
|
922
|
+
preserveDirectives?: boolean;
|
|
665
923
|
preserveModulesRoot?: boolean;
|
|
666
924
|
rscOutputPath?: string; // defaults: `index.rsc`
|
|
667
925
|
htmlOutputPath?: string; // defaults: `index.html`
|
|
668
926
|
entryFile?: (n: PreRenderedChunk, ssr: boolean) => string;
|
|
669
927
|
chunkFile?: (n: PreRenderedChunk, ssr: boolean) => string;
|
|
670
928
|
assetFile?: (n: PreRenderedAsset, ssr: boolean) => string;
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
}>;
|
|
682
|
-
}
|
|
929
|
+
extensionMap?: Record<string, string>;
|
|
930
|
+
moduleExtension?: string;
|
|
931
|
+
jsExtension?: string;
|
|
932
|
+
cssExtension?: string;
|
|
933
|
+
htmlExtension?: string;
|
|
934
|
+
jsonExtension?: string;
|
|
935
|
+
rscExtension?: string;
|
|
936
|
+
cssModuleExtension?: string;
|
|
937
|
+
nodeExtension?: string;
|
|
938
|
+
};
|
|
683
939
|
|
|
684
940
|
export type RequestHandler = Connect.NextHandleFunction;
|
|
685
941
|
|
|
686
|
-
export
|
|
687
|
-
url: string;
|
|
688
|
-
controller: AbortController;
|
|
689
|
-
loader: (id: string) => Promise<any>;
|
|
690
|
-
Html: any;
|
|
691
|
-
options: StreamPluginOptions;
|
|
692
|
-
pageExportName: string;
|
|
693
|
-
propsExportName: string;
|
|
694
|
-
moduleGraph: any;
|
|
695
|
-
bootstrapModules?: string[];
|
|
696
|
-
importMap?: Record<string, string[]>;
|
|
697
|
-
clientComponents?: boolean;
|
|
698
|
-
onlyClientComponents?: boolean;
|
|
699
|
-
}
|
|
700
|
-
|
|
701
|
-
export type RscServerConfig = {
|
|
702
|
-
/** How to get RSC data (e.g. HTTP, direct import, etc) */
|
|
703
|
-
getRscComponent: (url: string) => React.Usable<React.ReactNode>;
|
|
704
|
-
/** Base URL for client assets */
|
|
705
|
-
clientBase?: string;
|
|
706
|
-
/** SSR stream rendering options */
|
|
707
|
-
ssrOptions?: SsrStreamOptions;
|
|
708
|
-
};
|
|
709
|
-
|
|
710
|
-
export interface RscServerModule {
|
|
942
|
+
export type RscServerModule = {
|
|
711
943
|
/**
|
|
712
944
|
* Get RSC data for a route
|
|
713
945
|
* @param path - Route path (e.g. "/", "/about")
|
|
@@ -717,23 +949,23 @@ export interface RscServerModule {
|
|
|
717
949
|
/** Page component to render */
|
|
718
950
|
Page: React.ComponentType;
|
|
719
951
|
/** Props to pass to the page */
|
|
720
|
-
props:
|
|
952
|
+
props: unknown;
|
|
721
953
|
}>;
|
|
722
|
-
}
|
|
954
|
+
};
|
|
723
955
|
|
|
724
|
-
export
|
|
956
|
+
export type RegisterComponentMessage = {
|
|
725
957
|
type: "REGISTER_COMPONENT";
|
|
726
958
|
id: string;
|
|
727
959
|
code: string;
|
|
728
|
-
}
|
|
960
|
+
};
|
|
729
961
|
|
|
730
962
|
export type RscBuildResult = string[];
|
|
731
963
|
|
|
732
|
-
export
|
|
964
|
+
export type ReactStreamPluginMeta = {
|
|
733
965
|
timing: BuildTiming;
|
|
734
|
-
}
|
|
966
|
+
};
|
|
735
967
|
|
|
736
|
-
export
|
|
968
|
+
export type BuildTiming = {
|
|
737
969
|
start: number;
|
|
738
970
|
configResolved?: number;
|
|
739
971
|
buildStart?: number;
|
|
@@ -743,11 +975,13 @@ export interface BuildTiming {
|
|
|
743
975
|
closeBundle?: number;
|
|
744
976
|
render?: number;
|
|
745
977
|
total?: number;
|
|
746
|
-
}
|
|
978
|
+
};
|
|
747
979
|
|
|
748
980
|
export type ResolvedBuildPages = {
|
|
749
981
|
propsMap: Map<string, string>;
|
|
750
982
|
pageMap: Map<string, string>;
|
|
983
|
+
rootMap: Map<string, string>;
|
|
984
|
+
htmlMap: Map<string, string>;
|
|
751
985
|
/**
|
|
752
986
|
* ## routeMap
|
|
753
987
|
*
|
|
@@ -769,7 +1003,10 @@ export type ResolvedBuildPages = {
|
|
|
769
1003
|
* urlMap.set("/", { props: "/props", page: "/page" });
|
|
770
1004
|
* ```
|
|
771
1005
|
*/
|
|
772
|
-
urlMap: Map<
|
|
1006
|
+
urlMap: Map<
|
|
1007
|
+
string,
|
|
1008
|
+
{ props?: string; page: string; root?: string; html?: string }
|
|
1009
|
+
>;
|
|
773
1010
|
errors: Error[];
|
|
774
1011
|
};
|
|
775
1012
|
|
|
@@ -778,22 +1015,38 @@ export type ModuleId = string & { readonly __brand: unique symbol };
|
|
|
778
1015
|
export type PagePath = string & { readonly __brand: unique symbol };
|
|
779
1016
|
|
|
780
1017
|
export type InlineCssOpt = undefined | boolean;
|
|
781
|
-
export type PagePropOpt = Record<string, unknown
|
|
782
|
-
export
|
|
1018
|
+
export type PagePropOpt = Record<string, unknown>;
|
|
1019
|
+
export interface DeserializedRegExp {
|
|
1020
|
+
source: string;
|
|
1021
|
+
flags: string;
|
|
1022
|
+
__isRegExp: boolean;
|
|
1023
|
+
}
|
|
1024
|
+
|
|
1025
|
+
export type RegExpOpt = RegExp | string | DeserializedRegExp;
|
|
1026
|
+
export type UrlOpt =
|
|
1027
|
+
| string
|
|
1028
|
+
| ((url: string) => string)
|
|
1029
|
+
| ((url: string) => Promise<string>);
|
|
1030
|
+
export type PageName = "Page";
|
|
1031
|
+
export type PropsName = "props";
|
|
1032
|
+
export type HtmlName = "Html";
|
|
1033
|
+
export type RootName = "Root";
|
|
783
1034
|
|
|
784
1035
|
export type AsOpt =
|
|
785
|
-
| ExoticComponent<FragmentProps>
|
|
1036
|
+
| React.ExoticComponent<React.FragmentProps>
|
|
786
1037
|
| Exclude<keyof React.JSX.IntrinsicElements, "symbol" | "object">;
|
|
787
|
-
export type PageComponentType<
|
|
788
|
-
|
|
1038
|
+
export type PageComponentType<
|
|
1039
|
+
PageProps extends PagePropOpt = PagePropOpt,
|
|
1040
|
+
ReactType = any
|
|
1041
|
+
> = (props: PageProps) => ReactType;
|
|
789
1042
|
|
|
790
1043
|
export type HtmlProps<
|
|
791
|
-
|
|
1044
|
+
PageProps extends PagePropOpt = PagePropOpt,
|
|
792
1045
|
InlineCSS extends InlineCssOpt = InlineCssOpt,
|
|
793
1046
|
As extends AsOpt = AsOpt
|
|
794
1047
|
> = {
|
|
795
|
-
pageProps?:
|
|
796
|
-
Page: PageComponentType<
|
|
1048
|
+
pageProps?: PageProps;
|
|
1049
|
+
Page: PageComponentType<PageProps>;
|
|
797
1050
|
route: string;
|
|
798
1051
|
url: string;
|
|
799
1052
|
projectRoot: string;
|
|
@@ -803,16 +1056,16 @@ export type HtmlProps<
|
|
|
803
1056
|
moduleRootPath: string;
|
|
804
1057
|
cssFiles: Map<string, CssContent<InlineCSS>>;
|
|
805
1058
|
manifest: Manifest;
|
|
806
|
-
|
|
1059
|
+
Root: RootComponentType<As, InlineCSS, PageProps>;
|
|
807
1060
|
globalCss: Map<string, CssContent<InlineCSS>>;
|
|
808
|
-
as
|
|
1061
|
+
as?: As;
|
|
809
1062
|
};
|
|
810
1063
|
|
|
811
|
-
export
|
|
1064
|
+
export type PageAsset = {
|
|
812
1065
|
type: "css" | "js";
|
|
813
1066
|
path: string;
|
|
814
1067
|
parentUrl: string;
|
|
815
|
-
}
|
|
1068
|
+
};
|
|
816
1069
|
|
|
817
1070
|
type BaseCssProps = {
|
|
818
1071
|
as: string;
|
|
@@ -838,13 +1091,11 @@ export type StyleCssProps = BaseCssProps & {
|
|
|
838
1091
|
href?: never;
|
|
839
1092
|
};
|
|
840
1093
|
|
|
841
|
-
export type
|
|
842
|
-
InlineCSS extends InlineCssOpt = InlineCssOpt
|
|
843
|
-
> = {
|
|
1094
|
+
export type CssProps<InlineCSS extends InlineCssOpt = InlineCssOpt> = {
|
|
844
1095
|
cssFiles: Map<string, CssContent<InlineCSS>>;
|
|
845
1096
|
};
|
|
846
1097
|
|
|
847
|
-
export
|
|
1098
|
+
export type HtmlRenderState = {
|
|
848
1099
|
id: string;
|
|
849
1100
|
rscStream: PassThrough;
|
|
850
1101
|
htmlStream: PassThrough;
|
|
@@ -856,7 +1107,7 @@ export interface HtmlRenderState {
|
|
|
856
1107
|
"onError" | "onPostpone"
|
|
857
1108
|
>;
|
|
858
1109
|
streamState: StreamMetrics;
|
|
859
|
-
}
|
|
1110
|
+
};
|
|
860
1111
|
|
|
861
1112
|
export type RenderPagesResult =
|
|
862
1113
|
| {
|
|
@@ -910,7 +1161,7 @@ export type CreateHandlerResult<InlineCSS extends InlineCssOpt = InlineCssOpt> =
|
|
|
910
1161
|
| {
|
|
911
1162
|
type: "success";
|
|
912
1163
|
controller: AbortController;
|
|
913
|
-
stream:
|
|
1164
|
+
stream: PassThrough;
|
|
914
1165
|
assets: {
|
|
915
1166
|
css: CssContent<InlineCSS>[];
|
|
916
1167
|
js: string[];
|
|
@@ -933,7 +1184,7 @@ export type ReactStaticEvent =
|
|
|
933
1184
|
};
|
|
934
1185
|
|
|
935
1186
|
// Define LoaderContext interface locally
|
|
936
|
-
export
|
|
1187
|
+
export type LoaderContext = {
|
|
937
1188
|
format?: string;
|
|
938
1189
|
importAttributes?: Record<string, string>;
|
|
939
1190
|
conditions?: string[];
|
|
@@ -941,11 +1192,136 @@ export interface LoaderContext {
|
|
|
941
1192
|
targetEnvironment?: "client" | "server" | "browser";
|
|
942
1193
|
};
|
|
943
1194
|
url: string;
|
|
944
|
-
userOptions?:
|
|
945
|
-
}
|
|
1195
|
+
userOptions?: SerializedUserOptions; // Add userOptions to the context
|
|
1196
|
+
};
|
|
946
1197
|
// Add type declaration for import.meta.cssModules
|
|
947
1198
|
declare global {
|
|
948
1199
|
interface ImportMeta {
|
|
949
1200
|
cssModules?: Record<string, Record<string, string>>;
|
|
950
1201
|
}
|
|
951
1202
|
}
|
|
1203
|
+
|
|
1204
|
+
export type VendorInteropConfig = {
|
|
1205
|
+
react: string; // e.g. "react"
|
|
1206
|
+
reactDOMServer: string; // e.g. "react-dom/server"
|
|
1207
|
+
};
|
|
1208
|
+
|
|
1209
|
+
// Client Browser exports:
|
|
1210
|
+
// - createFromFetch
|
|
1211
|
+
// - createFromReadableStream
|
|
1212
|
+
// - createServerReference
|
|
1213
|
+
// - createTemporaryReferenceSet
|
|
1214
|
+
// - encodeReply
|
|
1215
|
+
// - registerServerReference
|
|
1216
|
+
export type RSCClientBrowserInteropConfig = {
|
|
1217
|
+
createFromFetch: string;
|
|
1218
|
+
createFromReadableStream: string;
|
|
1219
|
+
createServerReference: string;
|
|
1220
|
+
createTemporaryReferenceSet: string;
|
|
1221
|
+
encodeReply: string;
|
|
1222
|
+
registerServerReference: string;
|
|
1223
|
+
};
|
|
1224
|
+
|
|
1225
|
+
// Client Node exports:
|
|
1226
|
+
// - createFromNodeStream
|
|
1227
|
+
// - createServerReference
|
|
1228
|
+
// - registerServerReference
|
|
1229
|
+
export type RSCClientNodeInteropConfig = {
|
|
1230
|
+
createFromNodeStream: string;
|
|
1231
|
+
createServerReference: string;
|
|
1232
|
+
registerServerReference: string;
|
|
1233
|
+
};
|
|
1234
|
+
|
|
1235
|
+
// Server Node exports:
|
|
1236
|
+
// - createTemporaryReferenceSet
|
|
1237
|
+
// - decodeAction
|
|
1238
|
+
// - decodeFormState
|
|
1239
|
+
// - decodeReply
|
|
1240
|
+
// - decodeReplyFromBusboy
|
|
1241
|
+
// - registerClientReference
|
|
1242
|
+
// - registerServerReference
|
|
1243
|
+
// - renderToPipeableStream
|
|
1244
|
+
// - unstable_prerenderToNodeStream
|
|
1245
|
+
export type RSCServerInteropConfig = {
|
|
1246
|
+
createTemporaryReferenceSet: string;
|
|
1247
|
+
decodeAction: string;
|
|
1248
|
+
decodeFormState: string;
|
|
1249
|
+
decodeReply: string;
|
|
1250
|
+
decodeReplyFromBusboy: string;
|
|
1251
|
+
registerClientReference: string;
|
|
1252
|
+
registerServerReference: string;
|
|
1253
|
+
renderToPipeableStream: string;
|
|
1254
|
+
unstable_prerenderToNodeStream: string;
|
|
1255
|
+
};
|
|
1256
|
+
|
|
1257
|
+
export type RSCInteropConfig = {
|
|
1258
|
+
client: {
|
|
1259
|
+
browser: {
|
|
1260
|
+
production: string; // e.g. "react-server-dom-esm/client.browser"
|
|
1261
|
+
development: string; // e.g. "react-server-dom-esm/client.browser"
|
|
1262
|
+
test: string; // e.g. "react-server-dom-esm/client.browser"
|
|
1263
|
+
exports: RSCClientBrowserInteropConfig;
|
|
1264
|
+
};
|
|
1265
|
+
node: {
|
|
1266
|
+
production: string; // e.g. "react-server-dom-esm/client"
|
|
1267
|
+
development: string; // e.g. "react-server-dom-esm/client.node"
|
|
1268
|
+
test: string; // e.g. "react-server-dom-esm/client.node"
|
|
1269
|
+
exports: RSCClientNodeInteropConfig;
|
|
1270
|
+
};
|
|
1271
|
+
};
|
|
1272
|
+
server: {
|
|
1273
|
+
production: string; // e.g. "react-server-dom-esm/server"
|
|
1274
|
+
development: string; // e.g. "react-server-dom-esm/server.node"
|
|
1275
|
+
test: string; // e.g. "react-server-dom-esm/server.node"
|
|
1276
|
+
exports: RSCServerInteropConfig;
|
|
1277
|
+
};
|
|
1278
|
+
};
|
|
1279
|
+
|
|
1280
|
+
export type FlightTarget =
|
|
1281
|
+
| "default"
|
|
1282
|
+
| "webpack"
|
|
1283
|
+
| "nextjs"
|
|
1284
|
+
| "react-server-dom-esm"
|
|
1285
|
+
| "react-server-dom-webpack"
|
|
1286
|
+
| "react-server-dom-parcel";
|
|
1287
|
+
|
|
1288
|
+
export type FlightConfig = {
|
|
1289
|
+
rsc: RSCInteropConfig;
|
|
1290
|
+
vendor: VendorInteropConfig;
|
|
1291
|
+
};
|
|
1292
|
+
|
|
1293
|
+
// Import configuration from separate file
|
|
1294
|
+
export {
|
|
1295
|
+
createFlightBindings,
|
|
1296
|
+
defaultFlightBindings,
|
|
1297
|
+
} from "./config/flightBindings.js";
|
|
1298
|
+
|
|
1299
|
+
export type ReactStreamOptionsFn<ReturnType = void> = <
|
|
1300
|
+
PageProp extends PagePropOpt = PagePropOpt,
|
|
1301
|
+
As extends AsOpt = AsOpt,
|
|
1302
|
+
N1 extends string = PageName,
|
|
1303
|
+
N2 extends string = PropsName,
|
|
1304
|
+
Input extends StreamPluginOptions<
|
|
1305
|
+
PageProp,
|
|
1306
|
+
InlineCssOpt,
|
|
1307
|
+
As,
|
|
1308
|
+
N1,
|
|
1309
|
+
N2
|
|
1310
|
+
> = StreamPluginOptions<PageProp, InlineCssOpt, As, N1, N2>,
|
|
1311
|
+
Output extends ReturnType = ReturnType
|
|
1312
|
+
>(
|
|
1313
|
+
options: Input
|
|
1314
|
+
) => Output;
|
|
1315
|
+
|
|
1316
|
+
export type ReactStreamHandlerFn<ReturnType> = <
|
|
1317
|
+
Opt extends CreateHandlerOptions = CreateHandlerOptions
|
|
1318
|
+
>(
|
|
1319
|
+
options: Opt
|
|
1320
|
+
) => ReturnType;
|
|
1321
|
+
|
|
1322
|
+
export type ReactStreamResolvedOptionsFn<ReturnType = void> = (
|
|
1323
|
+
options: ResolvedUserOptions
|
|
1324
|
+
) => ReturnType;
|
|
1325
|
+
|
|
1326
|
+
// re-exorts
|
|
1327
|
+
export type { RenderMetrics, StreamMetrics };
|