vite-plugin-react-server 1.1.20 → 1.2.0-alpha.1
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 +95 -396
- package/dist/_virtual/dynamic-import-helper.js +1 -1
- package/dist/client.d.ts +2 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -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 +294 -121
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +156 -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 +1 -1
- package/dist/plugin/config/resolveEnv.d.ts.map +1 -1
- package/dist/plugin/config/resolveEnv.js +45 -28
- 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 +230 -219
- 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 +98 -47
- package/dist/plugin/env/createConfigEnv.d.ts +7 -0
- package/dist/plugin/env/createConfigEnv.d.ts.map +1 -0
- package/dist/plugin/env/createConfigEnv.js +30 -0
- package/dist/plugin/env/getArgValue.d.ts +8 -0
- package/dist/plugin/env/getArgValue.d.ts.map +1 -0
- package/dist/plugin/env/getArgValue.js +32 -0
- package/dist/plugin/env/getEnvKey.d.ts +40 -0
- package/dist/plugin/env/getEnvKey.d.ts.map +1 -0
- package/dist/plugin/env/getEnvKey.js +24 -0
- package/dist/plugin/env/index.d.ts +3 -0
- package/dist/plugin/env/index.d.ts.map +1 -1
- package/dist/plugin/env/index.js +3 -0
- 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 +69 -93
- package/dist/plugin/env/userConfigEnv.d.ts +2 -0
- package/dist/plugin/env/userConfigEnv.d.ts.map +1 -0
- package/dist/plugin/env/userConfigEnv.js +21 -0
- 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 +50 -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 -15
- 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 +53 -15
- 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 +100 -8
- 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 +7 -3
- 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 +31 -4
- package/dist/plugin/helpers/requestInfo.d.ts.map +1 -1
- package/dist/plugin/helpers/requestInfo.js +62 -35
- 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 +146 -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 +92 -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 +7 -0
- package/dist/plugin/loader/directives/analyzeModule.d.ts.map +1 -0
- package/dist/plugin/loader/directives/analyzeModule.js +48 -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 +12 -0
- package/dist/plugin/loader/env-loader.d.ts.map +1 -0
- package/dist/plugin/loader/env-loader.js +88 -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 +12 -2
- package/dist/plugin/loader/parse.d.ts.map +1 -1
- package/dist/plugin/loader/parse.js +28 -5
- 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 +9 -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 +37 -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/transformNonServerEnvironment.d.ts +10 -0
- package/dist/plugin/loader/transformNonServerEnvironment.d.ts.map +1 -0
- package/dist/plugin/loader/transformNonServerEnvironment.js +72 -0
- package/dist/plugin/loader/transformServerModule.d.ts +10 -0
- package/dist/plugin/loader/transformServerModule.d.ts.map +1 -0
- package/dist/plugin/loader/transformServerModule.js +103 -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 +16 -0
- package/dist/plugin/loader/types.d.ts +48 -13
- 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 +14 -9
- 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 +15 -16
- package/dist/plugin/process-env.d.ts +18 -6
- package/dist/plugin/process-env.d.ts.map +1 -1
- package/dist/plugin/process-env.js +17 -0
- 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 +31 -26
- 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 +51 -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 +14 -13
- 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 +106 -47
- 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 +30 -31
- 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 +32 -36
- 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 +21 -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.client.d.ts +29 -1
- package/dist/plugin/transformer/plugin.client.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.client.js +96 -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 +60 -69
- 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 +451 -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.d.ts.map +1 -1
- package/dist/plugin/utils/envUrls.node.js +3 -2
- 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 +5 -3
- package/dist/plugin/worker/rsc/handleRender.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handleRender.js +57 -38
- 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 +22 -8
- package/dist/plugin/worker/rsc/rsc-worker.development.js +77 -11
- package/dist/plugin/worker/rsc/rsc-worker.production.js +37 -8
- 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 +59 -26
- 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 +189 -96
- 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 +41 -37
- package/plugin/config/resolveOptions.ts +437 -318
- 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 +427 -351
- package/plugin/env/createConfigEnv.ts +40 -0
- package/plugin/env/getArgValue.ts +56 -0
- package/plugin/env/getEnvKey.ts +61 -0
- package/plugin/env/index.ts +4 -1
- package/plugin/env/plugin.ts +13 -18
- package/plugin/env/userConfigEnv.ts +22 -0
- 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 +48 -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 +29 -30
- package/plugin/helpers/createEventHandler.ts +1 -1
- package/plugin/helpers/createHandler.ts +40 -12
- package/plugin/helpers/createRscStream.tsx +103 -36
- package/plugin/helpers/formatMetrics.ts +2 -37
- package/plugin/helpers/getBundleManifest.ts +10 -1
- package/plugin/helpers/getRouteFiles.ts +154 -9
- package/plugin/helpers/handleServerAction.ts +12 -7
- 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 +95 -61
- package/plugin/helpers/requestToRoute.ts +38 -12
- package/plugin/helpers/resolveComponent.ts +173 -0
- package/plugin/helpers/resolveComponents.ts +202 -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 +110 -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 +57 -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.ts +135 -0
- package/plugin/loader/index.ts +8 -6
- package/plugin/loader/parse.ts +42 -12
- package/plugin/loader/react-loader.ts +256 -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 +60 -0
- package/plugin/loader/transformModule.ts +59 -0
- package/plugin/loader/transformModuleIfNeeded.ts +40 -40
- package/plugin/loader/transformNonServerEnvironment.ts +95 -0
- package/plugin/loader/transformServerModule.ts +167 -0
- package/plugin/loader/transformWithAcornLoose.ts +27 -0
- package/plugin/loader/types.ts +58 -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 +43 -16
- package/plugin/plugin.server.ts +41 -21
- package/plugin/process-env.ts +27 -6
- package/plugin/react-client/cleanupWorkerServerAction.ts +33 -0
- package/plugin/react-client/configureWorkerRequestHandler.ts +206 -201
- package/plugin/react-client/createMessageHandlers.ts +17 -3
- package/plugin/react-client/createWorkerStream.ts +55 -51
- package/plugin/react-client/handleWorkerRscStream.ts +130 -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 +74 -70
- package/plugin/react-server/configureReactServer.ts +204 -142
- package/plugin/react-server/handleServerAction.ts +156 -160
- package/plugin/react-server/plugin.ts +150 -157
- package/plugin/react-static/collectHtmlWorkerContent.ts +109 -102
- package/plugin/react-static/collectRscContent.ts +55 -51
- package/plugin/react-static/configurePreviewServer.ts +99 -100
- package/plugin/react-static/createBuildLoader.ts +157 -48
- package/plugin/react-static/plugin.ts +368 -357
- package/plugin/react-static/renderPage.ts +31 -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.client.ts +142 -0
- package/plugin/transformer/plugin.server.ts +87 -112
- 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 +684 -309
- package/plugin/utils/createCallServer.ts +5 -5
- package/plugin/utils/createReactFetcher.ts +4 -6
- package/plugin/utils/envUrls.node.ts +15 -10
- package/plugin/utils/index.ts +2 -1
- package/plugin/utils/routeToURL.ts +34 -0
- package/plugin/utils/urls.ts +10 -7
- 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 +75 -45
- package/plugin/worker/rsc/handlers.ts +30 -22
- package/plugin/worker/rsc/index.ts +2 -0
- package/plugin/worker/rsc/messageHandler.tsx +23 -13
- package/plugin/worker/rsc/rsc-worker.development.ts +104 -17
- package/plugin/worker/rsc/rsc-worker.production.ts +57 -10
- 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/index.d.ts +0 -2
- package/dist/plugin/preserver/index.d.ts.map +0 -1
- package/dist/plugin/preserver/index.js +0 -1
- package/dist/plugin/preserver/plugin.d.ts +0 -3
- package/dist/plugin/preserver/plugin.d.ts.map +0 -1
- package/dist/plugin/preserver/plugin.js +0 -130
- 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/streamHandler.d.ts +0 -2
- package/dist/plugin/react-static/streamHandler.d.ts.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.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/env-loader.development.ts +0 -107
- 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/preserver/index.ts +0 -1
- package/plugin/preserver/plugin.ts +0 -178
- package/plugin/react-static/streamHandler.ts +0 -0
- package/plugin/source-map/createMappingsSerializer.ts +0 -181
- package/plugin/source-map/readMappings.ts +0 -194
- /package/dist/plugin/{react-static/streamHandler.js → loader/directives/types.js} +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"urls.js","sources":["../../../plugin/utils/urls.ts"],"sourcesContent":["\n/**\n * # createAbsoluteUrl\n *\n * This function takes a baseURL and a public origin and returns a function that takes a path and returns the path with the baseURL attached to it.\n *\n * @example\n * ```ts\n * const absoluteURL = createAbsoluteURL(\"/mmc\", \"https://bidoof.com\")\n * console.log(absoluteURL(\"/test\")) // \"https://bidoof.com/mmc/test\"\n * ```\n *\n * @example\n * ```ts\n * const absoluteURL = createAbsoluteURL(\"/mmc\", \"https://bidoof.com\")\n * console.log(absoluteURL(\"/test\")) // \"https://bidoof.com/mmc/test\"\n * ```\n *\n * This can replace code like `${process.env.VITE_PUBLIC_ORIGIN}/test` with `absoluteUrl('/test')`, and you can be sure that it will work after\n * changing the plugin settings.\n */\nexport const createAbsoluteURL = (\n withBaseURL: string,\n withPublicOrigin: string\n) => {\n const baseURL = createBaseURL(withBaseURL);\n if (withPublicOrigin === \"\" || typeof withPublicOrigin !== \"string\")\n return baseURL;\n return (path: string) => {\n const pathWithBaseURL = baseURL(path);\n try {\n return new URL(pathWithBaseURL, withPublicOrigin).toString();\n } catch (error) {\n return withPublicOrigin + pathWithBaseURL;\n }\n };\n};\n\n/**\n * # createBaseURL\n *\n * This function takes a baseURL and returns a function that takes a path and returns the path with the baseURL attached to it.\n *\n * @example\n * ```ts\n * const baseURL = createBaseURL(\"/mmc\")\n * console.log(baseURL(\"/test\")) // \"/mmc/test\"\n * ```\n *\n * @example\n * ```ts\n * const baseURL = createBaseURL(\"/mmc/\")\n * console.log(baseURL(\"/test\")) // \"/mmc/test\"\n * ```\n *\n * This can replace code like `${import.meta.env.test` with `baseURL(path)`, and you can be sure that it will work after\n * changing the plugin settings.\n *\n * Path handling logic:\n * 1. For baseURL ending with \"/\":\n * - If path starts with \"/\", slice off the leading slash to avoid double slashes\n * - If path doesn't start with \"/\", keep it as is\n *\n * 2. For baseURL not ending with \"/\":\n * - If path starts with \"/\", directly concatenate with baseURL\n * - If path doesn't start with \"/\", add a slash between baseURL and path\n *\n * baseURL \"src\" + path \"src/test\" -> should not concatenate to src/src/test\n * baseURL \"/\" + path \"https://bidoof.com\" -> should not concatenate to /https://bidoof.com\"\n */\nexport const createBaseURL = (withBaseURL: string) => {\n if (withBaseURL.endsWith(\"/\")) {\n return (path: string) => {\n if (path === \"\") return withBaseURL;\n if (path.startsWith(withBaseURL) || isAbsoluteURL(path)) return path;\n return `${withBaseURL}${removeLeadingSlash(path)}`;\n };\n } else {\n return (path: string) => {\n if (path === \"\") return withBaseURL;\n if (isAbsoluteURL(path)) return path;\n if (path.startsWith(\"/\")) return withBaseURL + path;\n if (path.startsWith(withBaseURL)) return path;\n return `${withBaseURL}/${path}`;\n };\n }\n};\n\n/** Remove a single trailing slash from the URL if it ends with one */\nexport const removeTrailingSlash = (url: string) =>\n url.endsWith(\"/\") ? url.slice(0, -1) : url;\n\n/** Add a single trailing slash to the URL if it doesn't end with one */\nexport const addTrailingSlash = (url: string) =>\n url.endsWith(\"/\") ? url : `${url}/`;\n\nexport const removeLeadingSlash = (url: string) =>\n url.startsWith(\"/\") ? url.slice(1) : url;\n\nexport const addLeadingSlash = (url: string) =>\n url.startsWith(\"/\") ? url : `/${url}`;\n\nexport const isBlankRegex = /^(?:[a-zA-Z][a-zA-Z0-9+.-]*:)?\\/\\//;\nexport const isAbsoluteURL = (url: string) =>\n isBlankRegex.test(url) || url.startsWith(\"//\");\n\n\nexport const folderName = (path: string, withBaseURL: string) => {\n const baseURL = createBaseURL(withBaseURL);\n return baseURL(path.replace(/\\[index.(html?|rsc|HTML?)]$/, \"\"));\n}\n\n/**\n * # createPageURL\n *\n * This function takes a baseURL, public origin and a optional normalizer function that mirrors the baseURL's format.\n * If baseURL ends with a slash, we continue it using the URL itself (must end with a slash)\n *\n * - `indexRSC`: The path to the index.rsc file\n * - `moduleBaseURL`: The baseURL to use for the module\n *\n * These can be passed in directly to the createReactFetcher and also determine the defaults when no input are provided.\n *\n * @example\n * ```ts\n * import { createFromFetch } from \"react-server-dom-esm/client.browser\";\n * const parsedURL = pageURL(window.location.pathname ?? \"/\");\n * const data = createFromFetch(\n * fetch(parsedURL.indexRSC, {\n * headers: {\n * Accept: \"text/x-component\",\n * }\n * }),\n * {\n * callServer: callServer,\n * moduleBaseURL: parsedURL.moduleBaseURL,\n * }\n * );\n * ```\n *\n * The moduleBasePath being set at the config level as \"/\",\n * then we pass it to create a stream `renderToPipeableStream(elements, moduleBasePath)`, and we see\n * ```text\n * 2:I[\"src/components/Clickable.client-Dx9diOqr.js\",\"ClientClickable\"]\n * ```\n *\n */\nexport const createPageURL = (\n withBaseURL: string,\n withPublicOrigin: string,\n isDev = false,\n normalizer = !withBaseURL.endsWith(\"/\")\n ? removeTrailingSlash\n : addTrailingSlash,\n) => {\n return (to: string, fileName: string = \"index.rsc\") => {\n try {\n // Create the base URL first\n const folderName = addTrailingSlash(\n to.replace(/\\[index.(html?|rsc|HTML?)]$/, \"\")\n );\n const baseURL = createBaseURL(withBaseURL);\n const rscPath = baseURL(folderName) + fileName;\n // Create moduleBaseURL and normalize it to match input format\n const moduleBaseURL = parseURL(withBaseURL, withPublicOrigin);\n if (moduleBaseURL.type === \"error\") {\n throw moduleBaseURL.error;\n }\n const indexRSC = parseURL(rscPath, withPublicOrigin);\n if (indexRSC.type === \"error\") {\n throw indexRSC.error;\n }\n return {\n indexRSC: indexRSC.url.toString(),\n moduleBaseURL: normalizer(moduleBaseURL.url.toString()),\n };\n } catch (error) {\n if (isDev) console.error(\"Error parsing pageURL\", error);\n return {\n indexRSC: withBaseURL + \"index.rsc\",\n moduleBaseURL: withBaseURL,\n };\n }\n };\n};\n\n/**\n * # moduleBaseURL\n *\n * This function takes a baseURL, public origin and a optional normalizer function that mirrors the baseURL's format.\n *\n * @example\n * ```ts\n * const moduleBaseURL = parseURL(\"/mmc\", \"https://bidoof.com\")\n * if(moduleBaseURL.type === \"error\") {\n * console.error(moduleBaseURL.error)\n * } else {\n * console.log(moduleBaseURL.url)\n * }\n * ```\n *\n **/\nexport const parseURL = (\n url: string,\n base: string\n):\n | { type: \"success\"; url: URL; error?: never; base?: never }\n | { type: \"error\"; url: string; base: string; error: Error } => {\n try {\n return {\n type: \"success\",\n url: new URL(url, base),\n };\n } catch (error) {\n return { type: \"error\", url: url, base: base, error: error as Error };\n }\n};\n"],"names":["folderName"],"mappings":";;;;;AAqBa,MAAA,iBAAA,GAAoB,CAC/B,WAAA,EACA,gBACG,KAAA;AACH,EAAM,MAAA,OAAA,GAAU,cAAc,WAAW,CAAA;AACzC,EAAI,IAAA,gBAAA,KAAqB,EAAM,IAAA,OAAO,gBAAqB,KAAA,QAAA;AACzD,IAAO,OAAA,OAAA;AACT,EAAA,OAAO,CAAC,IAAiB,KAAA;AACvB,IAAM,MAAA,eAAA,GAAkB,QAAQ,IAAI,CAAA;AACpC,IAAI,IAAA;AACF,MAAA,OAAO,IAAI,GAAA,CAAI,eAAiB,EAAA,gBAAgB,EAAE,QAAS,EAAA;AAAA,aACpD,KAAO,EAAA;AACd,MAAA,OAAO,gBAAmB,GAAA,eAAA;AAAA;AAC5B,GACF;AACF;AAkCa,MAAA,aAAA,GAAgB,CAAC,WAAwB,KAAA;AACpD,EAAI,IAAA,WAAA,CAAY,QAAS,CAAA,GAAG,CAAG,EAAA;AAC7B,IAAA,OAAO,CAAC,IAAiB,KAAA;AACvB,MAAI,IAAA,IAAA,KAAS,IAAW,OAAA,WAAA;AACxB,MAAA,IAAI,KAAK,UAAW,CAAA,WAAW,KAAK,aAAc,CAAA,IAAI,GAAU,OAAA,IAAA;AAChE,MAAA,OAAO,CAAG,EAAA,WAAW,CAAG,EAAA,kBAAA,CAAmB,IAAI,CAAC,CAAA,CAAA;AAAA,KAClD;AAAA,GACK,MAAA;AACL,IAAA,OAAO,CAAC,IAAiB,KAAA;AACvB,MAAI,IAAA,IAAA,KAAS,IAAW,OAAA,WAAA;AACxB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GAAI,CAAA,GAAA,EAAK,IAAI;AAAA,KACxB;AAAA,WACO,KAAO,EAAA;AACd,IAAA,OAAO,EAAE,IAAA,EAAM,OAAS,EAAA,GAAA,EAAU,MAAY,KAAsB,EAAA;AAAA;AAExE;;;;"}
|
package/dist/plugin/utils.js
DELETED
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite-plugin-react-server
|
|
3
|
-
* Copyright (c) Nico Brinkkemper
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
export { createReactFetcher } from './utils/createReactFetcher.js';
|
|
7
|
-
export { callServer } from './utils/callServer.js';
|
|
8
|
-
export { addLeadingSlash, addTrailingSlash, createAbsoluteURL, createBaseURL, createPageURL, folderName, isAbsoluteURL, isBlankRegex, parseURL, removeLeadingSlash, removeTrailingSlash } from './utils/urls.js';
|
|
9
|
-
export { env } from './utils/env.js';
|
|
10
|
-
export { createCallServer } from './utils/createCallServer.js';
|
|
11
|
-
//# sourceMappingURL=utils.js.map
|
package/dist/plugin/utils.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"utils.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vendor.client.js","sources":["../../../plugin/vendor/vendor.client.ts"],"sourcesContent":["import { workerData } from \"node:worker_threads\";\nimport { createRequire } from \"node:module\";\nimport { join } from \"node:path\";\n\nconst projectRoot = workerData?.projectRoot || process.cwd();\nconst nodeRequire = createRequire(join(projectRoot, \"package.json\"));\n\n// Import ReactDOM from the project's node_modules\nconst ReactDOMServer = nodeRequire(\"react-dom/server\");\nconst ReactDOMClient = nodeRequire(\"react-server-dom-esm/client\");\nconst React = nodeRequire(\"react\");\n\nexport { ReactDOMServer, React, ReactDOMClient };\n"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,WAAc,GAAA,UAAA,EAAY,WAAe,IAAA,OAAA,CAAQ,GAAI,EAAA;AAC3D,MAAM,WAAc,GAAA,aAAA,CAAc,IAAK,CAAA,WAAA,EAAa,cAAc,CAAC,CAAA;AAG7D,MAAA,cAAA,GAAiB,YAAY,kBAAkB;AAC/C,MAAA,cAAA,GAAiB,YAAY,6BAA6B;AAClD,YAAY,OAAO;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vendor.js","sources":["../../../plugin/vendor/vendor.ts"],"sourcesContent":["import { getCondition } from '../config/getCondition.js';\n\nexport const {\n React,\n ReactDOMServer,\n} = await import(`./vendor.${getCondition('')}.js`);"],"names":[],"mappings":";;;;;;;;AAEa,MAAA;AAAA,EACT,KAAA;AAAA,EACA;AACJ,CAAA,GAAI,MAAM,oCAAmC,kBAAA,MAAA,CAAA,MAAA,CAAA,EAAA,CAAA,GAAA,CAAA,SAAA,EAAA,YAAA,CAAA,EAAA,CAAA,CAAA,GAAA,CAAA,EAAA,CAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vendor.server.js","sources":["../../../plugin/vendor/vendor.server.ts"],"sourcesContent":["import { workerData } from \"node:worker_threads\";\nimport { createRequire } from \"node:module\";\nimport { join } from \"node:path\";\n\nconst projectRoot = workerData?.projectRoot || process.env[\"npm_config_local_prefix\"] || process.cwd();\nconst nodeRequire = createRequire(join(projectRoot, \"package.json\"));\n\n// Import ReactDOM from the project's node_modules\nconst ReactDOMServer = nodeRequire(\"react-server-dom-esm/server.node\");\nconst React = nodeRequire(\"react\");\n\nexport { ReactDOMServer, React };\n"],"names":[],"mappings":";;;;;;;;;AAIA,MAAM,WAAA,GAAc,YAAY,WAAe,IAAA,OAAA,CAAQ,IAAI,yBAAyB,CAAA,IAAK,QAAQ,GAAI,EAAA;AACrG,MAAM,WAAc,GAAA,aAAA,CAAc,IAAK,CAAA,WAAA,EAAa,cAAc,CAAC,CAAA;AAG7D,MAAA,cAAA,GAAiB,YAAY,kCAAkC;AAC/D,MAAA,KAAA,GAAQ,YAAY,OAAO;;;;"}
|
package/dist/plugin/vendor.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"vendor.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createWorker.js","sources":["../../../plugin/worker/createWorker.ts"],"sourcesContent":["import {\n Worker,\n type ResourceLimits,\n type TransferListItem,\n} from \"node:worker_threads\";\nimport { getMode, getNodePath } from \"../config/getPaths.js\";\nimport { getCondition } from \"../config/getCondition.js\";\nimport { join } from \"node:path\";\nimport { pluginRoot } from \"../root.js\";\nimport * as React from \"react\";\nimport { DEFAULT_CONFIG } from \"../config/defaults.js\";\nimport { createLogger, type Logger } from \"vite\";\nimport type { HtmlWorkerOutputMessage } from \"./types.js\";\nimport type { RscWorkerOutputMessage } from \"./types.js\";\nimport { toError } from \"../error/toError.js\";\n\nexport type CreateWorkerOptions = {\n projectRoot?: string;\n currentCondition?: \"react-server\" | \"react-client\";\n nodePath?: string;\n nodeOptions?: string[];\n envPrefix?: string;\n mode?: \"production\" | \"development\";\n reverseCondition?: string;\n maxListeners?: number;\n workerPath?: string;\n resourceLimits?: ResourceLimits;\n typescript?: boolean;\n htmlChunkSize?: number; // Size of HTML chunks in bytes\n workerData?: any;\n transferList?: TransferListItem[];\n logger?: Logger;\n verbose?: boolean;\n};\n\ntype CreateWorkerSuccess = {\n type: \"success\";\n workerPath: string;\n worker: Worker;\n};\n\ntype CreateWorkerError = {\n type: \"error\";\n workerPath: string;\n error: Error;\n};\n\ntype CreateWorkerSkip = {\n type: \"skip\";\n reason: string;\n workerPath: string;\n};\n\nexport async function createWorker(\n options: CreateWorkerOptions\n): Promise<CreateWorkerSuccess | CreateWorkerError | CreateWorkerSkip> {\n const {\n projectRoot = process.cwd(),\n nodePath = getNodePath(projectRoot),\n currentCondition = getCondition(),\n envPrefix = DEFAULT_CONFIG.ENV_PREFIX,\n reverseCondition = currentCondition === \"react-server\"\n ? \"react-client\"\n : \"react-server\",\n maxListeners = 100,\n mode = getMode(),\n workerPath,\n resourceLimits = {\n maxOldGenerationSizeMb: 128,\n maxYoungGenerationSizeMb: 64,\n },\n htmlChunkSize = 8 * 1024,\n transferList = [],\n logger = createLogger(),\n verbose = false,\n } = options;\n const id = reverseCondition === \"react-server\" ? \"worker/rsc\" : \"worker/html\";\n let workerPathWithDefault =\n typeof workerPath === \"string\" ? workerPath : undefined;\n if (!workerPathWithDefault) {\n workerPathWithDefault = join(pluginRoot, id);\n }\n if (!workerPathWithDefault.startsWith(\"/\")) {\n workerPathWithDefault = join(\"./\", workerPathWithDefault);\n }\n // Ensure worker uses the same React version\n const workerData = {\n ...options.workerData,\n reactVersion: React.version,\n id: id,\n };\n\n try {\n // Ensure consistent NODE_ENV between main thread and worker\n const isTestEnv =\n process.env[\"VITEST\"] || process.env[\"NODE_ENV\"] === \"test\";\n const nodeEnv = isTestEnv ? \"test\" : mode;\n\n const env = {\n [envPrefix + \"DEV\"]: mode === \"development\" ? \"1\" : \"0\",\n [envPrefix + \"MODE\"]: mode,\n [envPrefix + \"PROD\"]: mode === \"production\" ? \"1\" : \"0\",\n [envPrefix + \"SSR\"]: \"true\",\n [envPrefix + \"BASE_URL\"]: options.workerData.userOptions.moduleBaseURL,\n [envPrefix + \"PUBLIC_ORIGIN\"]:\n options.workerData.userOptions.publicOrigin,\n NODE_ENV: nodeEnv,\n NODE_PATH: nodePath,\n NODE_OPTIONS: process.env[\"NODE_OPTIONS\"]?.includes(reverseCondition)\n ? process.env[\"NODE_OPTIONS\"]\n : process.env[\"NODE_OPTIONS\"]?.includes(currentCondition)\n ? process.env[\"NODE_OPTIONS\"]?.replace(\n currentCondition,\n reverseCondition\n )\n : `${\n process.env[\"NODE_OPTIONS\"] ?? \"\"\n } --conditions ${reverseCondition}`,\n HTML_CHUNK_SIZE: htmlChunkSize.toString(),\n };\n\n // Create worker with proper environment and loaders\n const worker = new Worker(workerPathWithDefault, {\n env,\n resourceLimits,\n workerData,\n transferList,\n });\n\n worker.setMaxListeners(maxListeners);\n\n // Wait for worker to be ready\n return await new Promise<CreateWorkerSuccess | CreateWorkerSkip>(\n (resolve, reject) => {\n const timeout = setTimeout(() => {\n reject({ type: \"error\", error: new Error(\"Worker ready timeout\") });\n }, 5000);\n const exitHandler = (code: number) => {\n clearTimeout(timeout);\n worker.removeListener(\"message\", messageHandler);\n worker.removeListener(\"exit\", exitHandler);\n if (code === 0) {\n resolve({\n type: \"skip\",\n reason: \"Worker exited with code 0\",\n workerPath: workerPathWithDefault,\n } satisfies CreateWorkerSkip);\n } else {\n const error = `[create:${id}] exited with code ${code}`;\n resolve({\n type: \"skip\",\n reason: error,\n workerPath: workerPathWithDefault,\n } satisfies CreateWorkerSkip);\n }\n };\n const messageHandler = (\n msg: HtmlWorkerOutputMessage | RscWorkerOutputMessage\n ) => {\n if (verbose) logger.info(`[create:${id}] Initial worker message ${msg.type}`);\n if (msg.type === \"READY\") {\n if (verbose) logger.info(`[create:${id}] Worker running for ${msg.env}`);\n clearTimeout(timeout);\n worker.removeListener(\"message\", messageHandler);\n worker.removeListener(\"exit\", exitHandler);\n if (msg.env !== nodeEnv) {\n if (verbose) logger.info(`[create:${id}] Worker environment mismatch.`);\n reject({\n type: \"error\",\n error: new Error(\n `Worker environment mismatch: ${msg.env} !== ${nodeEnv}`\n ),\n workerPath: workerPathWithDefault,\n } satisfies CreateWorkerError);\n }\n resolve({\n type: \"success\",\n worker,\n workerPath: workerPathWithDefault,\n } satisfies CreateWorkerSuccess);\n }\n };\n worker.once(\"message\", messageHandler);\n worker.once(\"exit\", exitHandler);\n }\n );\n } catch (error) {\n return {\n type: \"error\",\n error: toError(error),\n workerPath: workerPathWithDefault,\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;;;AAqDA,eAAsB,aACpB,OACqE,EAAA;AACrE,EAAM,MAAA;AAAA,IACJ,WAAA,GAAc,QAAQ,GAAI,EAAA;AAAA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AACvB,cAAA,IAAI,OAAS,EAAA,MAAA,CAAO,IAAK,CAAA,CAAA,QAAA,EAAW,EAAE,CAAgC,8BAAA,CAAA,CAAA;AACtE,cAAO,MAAA,CAAA;AAAA,gBACL,IAAM,EAAA,OAAA;AAAA,gBACN,OAAO,IAAI,KAAA;AAAA,kBACT,CAAgC,6BAAA,EAAA,GAAA,CAAI,GAAG,CAAA,KAAA,EAAQ,OAAO,CAAA;AAAA,iBACxD;AAAA,gBACA,UAAY,EAAA;AAAA,eACe,CAAA;AAAA;AAE/B,YAAQ,OAAA,CAAA;AAAA,cACN,IAAM,EAAA,SAAA;AAAA,cACN,MAAA;AAAA,cACA,UAAY,EAAA;AAAA,aACiB,CAAA;AAAA;AACjC,SACF;AACA,QAAO,MAAA,CAAA,IAAA,CAAK,WAAW,cAAc,CAAA;AACrC,QAAO,MAAA,CAAA,IAAA,CAAK,QAAQ,WAAW,CAAA;AAAA;AACjC,KACF;AAAA,WACO,KAAO,EAAA;AACd,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,OAAA;AAAA,MACN,KAAA,EAAO,QAAQ,KAAK,CAAA;AAAA,MACpB,UAAY,EAAA;AAAA,KACd;AAAA;AAEJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"createHtmlWorkerRenderState.js","sources":["../../../../plugin/worker/html/createHtmlWorkerRenderState.tsx"],"sourcesContent":["import type { HtmlWorkerRenderState } from \"./types.js\";\nimport { PassThrough } from \"stream\";\nimport { workerData, parentPort } from \"node:worker_threads\";\nimport type { SerializeableRenderToPipeableStreamOptions } from \"../types.js\";\nimport { type ErrorInfo } from \"react\";\nimport { Transform } from \"node:stream\";\nimport type { HtmlWorkerOutputMessage } from \"../types.js\";\nimport { join } from \"node:path\";\nimport type { StreamMetrics } from \"../../types.js\";\nimport { ReactDOMServer, ReactDOMClient } from \"../../vendor/vendor.client.js\";\n\ntype CallServerCallback = (id: string, args: unknown[]) => Promise<unknown>;\n\nconst createMetrics = (): StreamMetrics => {\n return {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount: 0,\n duration: 0,\n startTime: 0,\n };\n};\nexport function createHtmlWorkerRenderState(\n {\n projectRoot = workerData.userOptions.projectRoot,\n moduleRootPath = workerData.userOptions.moduleRootPath,\n moduleBaseURL = workerData.userOptions.moduleBaseURL,\n pipeableStreamOptions = workerData.userOptions.pipeableStreamOptions,\n id = workerData.id,\n }: {\n projectRoot?: string;\n moduleRootPath?: string;\n moduleBaseURL?: string;\n pipeableStreamOptions?: SerializeableRenderToPipeableStreamOptions;\n id?: string;\n },\n sendMessage: (msg: HtmlWorkerOutputMessage) => void,\n rscStream = new PassThrough()\n): HtmlWorkerRenderState {\n if (typeof moduleRootPath !== \"string\") {\n throw new Error(\"moduleRootPath is required\");\n } else if (!moduleRootPath.startsWith(projectRoot)) {\n moduleRootPath = join(projectRoot, moduleRootPath);\n }\n if(!moduleRootPath.endsWith('/')) {\n moduleRootPath = moduleRootPath + '/';\n }\n const elements = ReactDOMClient.createFromNodeStream(rscStream, moduleRootPath, moduleBaseURL, {\n callServer: (async (id: string, args: unknown[]) => {\n // Forward server action calls back to the main thread\n sendMessage({\n type: \"SERVER_ACTION\",\n id,\n args\n } as HtmlWorkerOutputMessage);\n console.log('[html-worker] callServer', id, args);\n // Wait for response\n return new Promise((resolve, reject) => {\n const handler = (msg: any) => {\n if (msg.type === \"SERVER_ACTION_RESPONSE\" && msg.id === id) {\n parentPort?.removeListener(\"message\", handler);\n if (msg.error) {\n reject(new Error(msg.error));\n } else {\n resolve(msg.result);\n }\n }\n };\n parentPort?.on(\"message\", handler);\n });\n }) as CallServerCallback\n });\n const metrics = createMetrics();\n const htmlTransform = new Transform({\n transform(chunk, encoding, callback) {\n metrics.chunks++;\n metrics.bytes += chunk.length;\n\n // Send HTML chunks\n sendMessage({\n type: \"HTML_CHUNK\",\n id: id,\n chunk: chunk,\n encoding,\n } satisfies HtmlWorkerOutputMessage);\n callback();\n },\n flush(callback) {\n sendMessage({\n type: \"HTML_COMPLETE\",\n id,\n success: true,\n metrics: metrics,\n } satisfies HtmlWorkerOutputMessage);\n callback();\n },\n })\n const stream = ReactDOMServer.renderToPipeableStream(elements, {\n ...pipeableStreamOptions,\n onAllReady: () => {\n rscStream.end();\n sendMessage({\n type: \"ALL_READY\",\n id,\n } satisfies HtmlWorkerOutputMessage);\n },\n onError: (error: unknown, errorInfo: ErrorInfo) => {\n sendMessage({\n type: \"ERROR\",\n id,\n error: error instanceof Error ? error : new Error(String(error)),\n errorInfo: errorInfo,\n });\n },\n onShellReady: () => {\n sendMessage({\n type: \"SHELL_READY\",\n id,\n });\n },\n onShellError: (error: unknown) => {\n sendMessage({\n type: \"SHELL_ERROR\",\n id,\n error: error instanceof Error ? error : new Error(String(error)),\n });\n },\n });\n stream.pipe(htmlTransform);\n return {\n rscStream: rscStream,\n metrics,\n isReady: false,\n htmlTransform: htmlTransform,\n stream: stream,\n };\n}\n"],"names":["id"],"mappings":";;;;;;;;;;;;AAaA,MAAM,gBAAgB,MAAqB;AACzC,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA,CAAA;AAAA,IACR,KAAO,EAAA,CAAA;AAAA,IACP,iBAAmB,EAAA,CAAA;AAAA,IACnB,UAAY,EAAA,CAAA;AAAA,IACZ,UAAY,EAAA,CAAA;AAAA,IACZ,QAAU,EAAA,CAAA;AAAA,IACV,SAAW,EAAA;AAAA,GACb;AACF,CAAA;AACO,SAAS,2BACd,CAAA;AAAA,EACE,WAAA,GAAc,WAAW,WAAY,CAAA,WAAA;AAAA,EACrC,cAAA,GAAiB,WAAW,WAAY,CAAA,cAAA;AAAA,EACxC,aAAA,GAAgB,WAAW,WAAY,CAAA,aAAA;AAAA,EACvC,qBAAA,GAAwB,WAAW,WAAY,CAAA,qBAAA;AAAA,EAC/C,KAAK,UAAW,CAAA;AAClB,CAAA,EAOA,WACA,EAAA,SAAA,GAAY,IAAI,WAAA,EACO,EAAA;AACvB,E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C,KAAmB,KAAA;AAChC,MAAY,WAAA,CAAA;AAAA,QACV,IAAM,EAAA,aAAA;AAAA,QACN,EAAA;AAAA,QACA,KAAA,EAAO,iBAAiB,KAAQ,GAAA,KAAA,GAAQ,IAAI,KAAM,CAAA,MAAA,CAAO,KAAK,CAAC;AAAA,OAChE,CAAA;AAAA;AACH,GACD,CAAA;AACD,EAAA,MAAA,CAAO,KAAK,aAAa,CAAA;AACzB,EAAO,OAAA;AAAA,IACL,SAAA;AAAA,IACA,OAAA;AAAA,IACA,OAAS,EAAA,KAAA;AAAA,IACT,aAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"html-worker.development.js","sources":["../../../../plugin/worker/html/html-worker.development.tsx"],"sourcesContent":["import { messageHandler } from \"./messageHandler.js\";\nimport { parentPort, workerData } from \"node:worker_threads\";\nimport type { ReadyMessage } from \"../types.js\";\n\nconst verbose = workerData.verbose;\n\nfunction developmentMessageHandler(msg: any) {\n if (verbose) {\n if (\"chunk\" in msg) {\n let preview = Buffer.from(msg.chunk).toString(\"utf-8\");\n console.log(`[html-worker:${msg.type}] ${preview}`);\n } else {\n console.log(`[html-worker:${msg.type}] ${JSON.stringify(msg)}`);\n }\n }\n messageHandler(msg);\n}\n\n// Signal ready with environment\nparentPort?.on(\"message\", developmentMessageHandler);\nparentPort?.postMessage({\n type: \"READY\",\n id: \"html-worker\",\n env: process.env[\"NODE_ENV\"],\n pid: process.pid,\n} satisfies ReadyMessage);\n"],"names":[],"mappings":";;;;;;;;AAIA,MAAM,UAAU,UAAW,CAAA,OAAA;AAE3B,SAAS,0BAA0B,GAAU,EAAA;AAC3C,EAAA,IAAI,OAAS,EAAA;AACX,IAAA,IAAI,WAAW,GAAK,EAAA;AAClB,MAAA,IAAI,UAAU,MAAO,CAAA,IAAA,CAAK,IAAI,KAAK,CAAA,CAAE,SAAS,OAAO,CAAA;AACrD,MAAA,OAAA,CAAQ,IAAI,CAAgB,aAAA,EAAA,GAAA,CAAI,IAAI,CAAA,EAAA,EAAK,OAAO,CAAE,CAAA,CAAA;AAAA,KAC7C,MAAA;AACL,MAAQ,OAAA,CAAA,GAAA,CAAI,gBAAgB,GAAI,CAAA,IAAI,KAAK,IAAK,CAAA,SAAA,CAAU,GAAG,CAAC,CAAE,CAAA,CAAA;AAAA;AAChE;AAEF,EAAA,cAAA,CAAe,GAAG,CAAA;AACpB;AAGA,UAAY,EAAA,EAAA,CAAG,WAAW,yBAAyB,CAAA;AACnD,UAAA,EAAY,WAAY,CAAA;AAAA,EACtB,IAAM,EAAA,OAAA;AAAA,EACN,EAAI,EAAA,aAAA;AAAA,EACJ,GAAA,EAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAA;AAAA,EAC3B,KAAK,OAAQ,CAAA;AACf,CAAwB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"html-worker.production.js","sources":["../../../../plugin/worker/html/html-worker.production.tsx"],"sourcesContent":["import { messageHandler } from \"./messageHandler.js\";\nimport { parentPort } from \"node:worker_threads\";\nimport type { ReadyMessage } from \"../types.js\";\n\n// Signal ready with environment\nparentPort?.on(\"message\", messageHandler);\nparentPort?.postMessage({\n type: \"READY\",\n id: \"html-worker\",\n env: process.env[\"NODE_ENV\"],\n pid: process.pid,\n} satisfies ReadyMessage);\n"],"names":[],"mappings":";;;;;;;;AAKA,UAAY,EAAA,EAAA,CAAG,WAAW,cAAc,CAAA;AACxC,UAAA,EAAY,WAAY,CAAA;AAAA,EACtB,IAAM,EAAA,OAAA;AAAA,EACN,EAAI,EAAA,aAAA;AAAA,EACJ,GAAA,EAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAA;AAAA,EAC3B,KAAK,OAAQ,CAAA;AACf,CAAwB,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../plugin/worker/html/index.ts"],"sourcesContent":["await (\n process.env['NODE_ENV'] === 'production' \n ? import('./html-worker.production.js') \n : import('./html-worker.development.js')\n);"],"names":[],"mappings":";;;;;AAAA,OACE,OAAA,CAAQ,IAAI,UAAU,CAAA,KAAM,eACxB,OAAO,6BAA6B,CACpC,GAAA,OAAO,8BAA8B,CAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messageHandler.js","sources":["../../../../plugin/worker/html/messageHandler.tsx"],"sourcesContent":["import { parentPort } from \"node:worker_threads\";\nimport type {\n HtmlWorkerInputMessage,\n HtmlWorkerOutputMessage,\n} from \"../types.js\";\nimport type { HtmlWorkerRenderState } from \"./types.js\";\nimport { createHtmlWorkerRenderState } from \"./createHtmlWorkerRenderState.js\";\nimport { toError } from \"../../error/toError.js\";\n\n// Track active renders\nconst activeRenders = new Map<string, HtmlWorkerRenderState>();\n\nfunction sendMessage(msg: HtmlWorkerOutputMessage) {\n // Send the original message\n if (\"error\" in msg && msg.error instanceof Error) {\n parentPort?.postMessage({\n ...msg,\n error: {\n message: msg.error.message,\n stack: msg.error.stack,\n name: msg.error.name,\n cause: msg.error.cause,\n },\n });\n } else {\n parentPort?.postMessage(msg);\n }\n}\n\nfunction cleanup(id: string) {\n const renderState = activeRenders.get(id);\n if (renderState) {\n renderState.rscStream.destroy();\n renderState.htmlTransform?.destroy();\n activeRenders.delete(id);\n\n sendMessage({\n type: \"CLEANUP_COMPLETE\",\n id,\n });\n }\n}\nexport async function messageHandler(msg: HtmlWorkerInputMessage) {\n const { type, id } = msg;\n try {\n switch (type) {\n case \"ROUTE_READY\": {\n let renderState = activeRenders.get(id);\n if (!renderState) {\n renderState = createHtmlWorkerRenderState(msg, sendMessage);\n \n activeRenders.set(id, renderState);\n } else {\n throw new Error(\"Render state already exists\");\n }\n break;\n }\n case \"RSC_CHUNK\": {\n let renderState = activeRenders.get(id);\n if (!renderState) {\n throw new Error(`No render state found for id: ${id}`);\n }\n\n try {\n // Write RSC chunk to the RSC stream\n renderState.rscStream.write(msg.chunk);\n sendMessage({\n type: \"CHUNK_PROCESSED\",\n id,\n success: true,\n });\n } catch (error: any) {\n sendMessage({\n type: \"ERROR\",\n id,\n error: `Error writing chunk: ${error.message}`,\n });\n cleanup(id);\n }\n break;\n }\n case \"RSC_END\": {\n const renderState = activeRenders.get(id);\n if (!renderState) {\n sendMessage({\n type: \"ERROR\",\n id,\n error: \"No render state found\",\n });\n return;\n }\n\n // Pipe the rendered content to the HTML stream\n break;\n }\n case \"CLEANUP\": {\n cleanup(id);\n break;\n }\n case \"SHUTDOWN\": {\n // If id is \"*\", clean up all render states\n if (id === \"*\") {\n for (const [renderId] of activeRenders) {\n cleanup(renderId);\n }\n } else {\n cleanup(id);\n }\n // Send SHUTDOWN_COMPLETE message to signal that shutdown is complete\n sendMessage({\n type: \"SHUTDOWN_COMPLETE\",\n id,\n });\n break;\n }\n }\n } catch (error) {\n sendMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n }\n}\n"],"names":[],"mappings":";;;;;;;;;AAUA,MAAM,aAAA,uBAAoB,GAAmC,EAAA;AAE7D,SAAS,YAAY,GAA8B,EAAA;AAEjD,EAAA,IAAI,OAAW,IAAA,GAAA,IAAO,GAAI,CAAA,KAAA,YAAiB,KAAO,EAAA;AAChD,IAAA,UAAA,EAAY,WAAY,CAAA;AAAA,MACtB,GAAG,GAAA;AAAA,MACH,KAAO,EAAA;AAAA,QACL,OAAA,EAAS,IAAI,KAAM,CAAA,OAAA;AAAA,QACnB,KAAA,EAAO,IAAI,KAAM,CAAA,KAAA;AAAA,QACjB,IAAA,EAAM,IAAI,KAAM,CAAA,IAAA;AAAA,QAChB,KAAA,EAAO,IAAI,KAAM,CAAA;AAAA;AACnB,KACD,CAAA;AAAA,GACI,MAAA;AACL,IAAA,UAAA,EAAY,YAAY,GAAG,CAAA;AAAA;AAE/B;AAEA,SAAS,QAAQ,EAAY,EAAA;AAC3B,EAAM,MAAA,WAAA,GAAc,aAAc,CAAA,GAAA,CAAI,EAA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N,EAAA;AAAA,YACA,KAAA,EAAO,CAAwB,qBAAA,EAAA,KAAA,CAAM,OAAO,CAAA;AAAA,WAC7C,CAAA;AACD,UAAA,OAAA,CAAQ,EAAE,CAAA;AAAA;AAEZ,QAAA;AAAA;AACF,MACA,KAAK,SAAW,EAAA;AACd,QAAM,MAAA,WAAA,GAAc,aAAc,CAAA,GAAA,CAAI,EAAE,CAAA;AACxC,QAAA,IAAI,CAAC,WAAa,EAAA;AAChB,UAAY,WAAA,CAAA;AAAA,YACV,IAAM,EAAA,OAAA;AAAA,YACN,EAAA;AAAA,YACA,KAAO,EAAA;AAAA,WACR,CAAA;AACD,UAAA;AAAA;AAIF,QAAA;AAAA;AACF,MACA,KAAK,SAAW,EAAA;AACd,QAAA,OAAA,CAAQ,EAAE,CAAA;AACV,QAAA;AAAA;AACF,MACA,KAAK,UAAY,EAAA;AAEf,QAAA,IAAI,OAAO,GAAK,EAAA;AACd,UAAW,KAAA,MAAA,CAAC,QAAQ,CAAA,IAAK,aAAe,EAAA;AACtC,YAAA,OAAA,CAAQ,QAAQ,CAAA;AAAA;AAClB,SACK,MAAA;AACL,UAAA,OAAA,CAAQ,EAAE,CAAA;AAAA;AAGZ,QAAY,WAAA,CAAA;AAAA,UACV,IAAM,EAAA,mBAAA;AAAA,UACN;AAAA,SACD,CAAA;AACD,QAAA;AAAA;AACF;AACF,WACO,KAAO,EAAA;AACd,IAAY,WAAA,CAAA;AAAA,MACV,IAAM,EAAA,OAAA;AAAA,MACN,EAAA;AAAA,MACA,KAAA,EAAO,QAAQ,KAAK;AAAA,KACrB,CAAA;AAAA;AAEL;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleRender.js","sources":["../../../../plugin/worker/rsc/handleRender.ts"],"sourcesContent":["import { resolvePageAndProps } from \"../../helpers/resolvePageAndProps.js\";\nimport type { RscRenderMessage, StreamHandlers } from \"../types.js\";\nimport { activeStreams, cssFiles } from \"./state.js\";\nimport { createRscStream } from \"../../helpers/createRscStream.js\";\nimport { CssCollector } from \"../../components/css-collector.js\";\nimport { PassThrough } from \"node:stream\";\nimport { join } from \"node:path\";\nimport { workerData } from \"node:worker_threads\";\nimport { React } from \"../../vendor/vendor.server.js\";\nimport { hmrState } from \"./state.js\";\nimport { performance } from \"node:perf_hooks\";\nimport type { PagePropOpt } from \"../../types.js\";\n\nexport async function handleRender<\n T extends PagePropOpt = PagePropOpt\n>(\n msg: RscRenderMessage<T>,\n handlers: StreamHandlers\n) {\n let {\n id = workerData.id,\n route = workerData.route,\n pagePath = workerData.pagePath,\n propsPath = workerData.propsPath,\n pageExportName = workerData.userOptions.pageExportName,\n propsExportName = workerData.userOptions.propsExportName,\n projectRoot = workerData.userOptions.projectRoot,\n moduleRootPath = workerData.userOptions.moduleRootPath,\n moduleBaseURL = workerData.userOptions.moduleBaseURL ?? \"/\",\n moduleBasePath = workerData.userOptions.moduleBasePath ?? \"/\",\n moduleBase = workerData.userOptions.moduleBase,\n pipeableStreamOptions = workerData.userOptions.pipeableStreamOptions,\n cssFiles: messageCssFiles,\n globalCss = workerData.globalCss,\n } = msg;\n try {\n // Load modules\n const pageAndPropsResult = await resolvePageAndProps({\n pagePath,\n propsPath,\n pageExportName,\n propsExportName,\n route,\n loader: (id: string) => {\n try {\n if (hmrState.get(id)?.invalidated) {\n // Clear the HMR state for this module\n hmrState.delete(id);\n return import(join(projectRoot, id) + `?t=${Date.now()}`);\n }\n return import(join(projectRoot, id));\n } catch (error) {\n return Promise.reject(error);\n }\n },\n });\n if (pageAndPropsResult.type !== \"success\") {\n const { error, ...rest } = pageAndPropsResult;\n return handlers.onError(id, error, rest);\n }\n\n const { PageComponent, pageProps } = pageAndPropsResult;\n\n const adaptedOnEvent = (event: \"error\" | \"postpone\", data: any) => {\n if (event === \"error\") {\n handlers.onError(id, data.error, data.errorInfo);\n }\n };\n\n if (messageCssFiles && messageCssFiles.size > 0) {\n // if any css is added to the message, add it to the cssFiles map\n for (const [id, cssContent] of messageCssFiles.entries()) {\n cssFiles.set(id, cssContent);\n }\n }\n\n // Create stream\n const streamResult = createRscStream({\n projectRoot: projectRoot,\n Html: React.Fragment,\n PageComponent,\n CssCollector,\n pageProps,\n moduleBase,\n moduleRootPath,\n moduleBasePath,\n moduleBaseURL,\n manifest: {},\n route,\n // this is a stateful object, which at this point we assume contains all the css files\n cssFiles,\n globalCss,\n onEvent: adaptedOnEvent,\n pipeableStreamOptions: pipeableStreamOptions,\n });\n\n if (streamResult.type !== \"success\") {\n handlers.onError(id, streamResult.error);\n return;\n }\n\n const { stream, metrics } = streamResult;\n\n // Create pass-through stream\n const passThrough = new PassThrough();\n activeStreams.set(id, passThrough);\n\n // Pipe stream to pass-through\n stream.pipe(passThrough);\n\n // Handle data chunks\n passThrough.on(\"data\", (chunk) => {\n metrics.chunks++;\n metrics.bytes += chunk.length;\n metrics.duration = performance.now() - metrics.startTime;\n handlers.onData(id, chunk);\n });\n\n // Handle stream end\n passThrough.on(\"end\", () => {\n metrics.duration = performance.now() - metrics.startTime;\n handlers.onEnd(id);\n if (activeStreams.has(id)) {\n handlers.onMetrics(id, metrics);\n activeStreams.delete(id);\n }\n });\n\n // Handle errors\n passThrough.on(\"error\", (error) => {\n handlers.onError(id, error as Error, { reason: `${id} stream error` });\n activeStreams.delete(id);\n });\n } catch (error) {\n handlers.onError(id, error as Error, { reason: `${id} render error` });\n return Promise.reject(error);\n }\n}\n"],"names":["id"],"mappings":";;;;;;;;;;;;;;;AAaA,eAAsB,YAAA,CAGpB,KACA,QACA,EAAA;AACA,EAAI,IAAA;AAAA,IACF,KAAK,UAAW,CAAA,EAAA;AAAA,IAChB,QAAQ,UAAW,CAAA,KAAA;AAAA,IACnB,WAAW,UAAW,CAAA,QAAA;AAAA,IACtB,YAAY,UAAW,CAAA,SAAA;AAAA,IACvB,cAAA,GAAiB,WAAW,WAAY,CAAA,cAAA;AAAA,IACxC,eAAA,GAAkB,WAAW,WAAY,CAAA,eAAA;AAAA,IACzC,WAAA,GAA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,KAAU,KAAA;AAChC,MAAQ,OAAA,CAAA,MAAA,EAAA;AACR,MAAA,OAAA,CAAQ,SAAS,KAAM,CAAA,MAAA;AACvB,MAAA,OAAA,CAAQ,QAAW,GAAA,WAAA,CAAY,GAAI,EAAA,GAAI,OAAQ,CAAA,SAAA;AAC/C,MAAS,QAAA,CAAA,MAAA,CAAO,IAAI,KAAK,CAAA;AAAA,KAC1B,CAAA;AAGD,IAAY,WAAA,CAAA,EAAA,CAAG,OAAO,MAAM;AAC1B,MAAA,OAAA,CAAQ,QAAW,GAAA,WAAA,CAAY,GAAI,EAAA,GAAI,OAAQ,CAAA,SAAA;AAC/C,MAAA,QAAA,CAAS,MAAM,EAAE,CAAA;AACjB,MAAI,IAAA,aAAA,CAAc,GAAI,CAAA,EAAE,CAAG,EAAA;AACzB,QAAS,QAAA,CAAA,SAAA,CAAU,IAAI,OAAO,CAAA;AAC9B,QAAA,aAAA,CAAc,OAAO,EAAE,CAAA;AAAA;AACzB,KACD,CAAA;AAGD,IAAY,WAAA,CAAA,EAAA,CAAG,OAAS,EAAA,CAAC,KAAU,KAAA;AACjC,MAAS,QAAA,CAAA,OAAA,CAAQ,IAAI,KAAgB,EAAA,EAAE,QAAQ,CAAG,EAAA,EAAE,iBAAiB,CAAA;AACrE,MAAA,aAAA,CAAc,OAAO,EAAE,CAAA;AAAA,KACxB,CAAA;AAAA,WACM,KAAO,EAAA;AACd,IAAS,QAAA,CAAA,OAAA,CAAQ,IAAI,KAAgB,EAAA,EAAE,QAAQ,CAAG,EAAA,EAAE,iBAAiB,CAAA;AACrE,IAAO,OAAA,OAAA,CAAQ,OAAO,KAAK,CAAA;AAAA;AAE/B;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sources":["../../../../plugin/worker/rsc/handlers.ts"],"sourcesContent":["import { sendRscWorkerMessage } from \"../sendMessage.js\";\nimport type { StreamHandlers } from \"../types.js\";\nimport { toError } from \"../../error/toError.js\";\nimport { userOptions } from \"./userOptions.js\";\nimport { addCssFileContent, addModuleId } from \"./state.js\";\nimport { join } from \"path\";\nimport { ReactDOMServer } from \"../../vendor/vendor.server.js\";\nimport { PassThrough } from \"node:stream\";\n\nexport const handlers: Required<StreamHandlers> = {\n onError: (id, error, errorInfo) => {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id: id,\n errorInfo,\n error: toError(error),\n });\n sendRscWorkerMessage({\n type: \"RSC_END\",\n id: id,\n });\n },\n onData: (id, data: any) => {\n sendRscWorkerMessage({\n type: \"RSC_CHUNK\",\n id: id,\n chunk: data,\n });\n },\n onEnd: (id: string) => {\n sendRscWorkerMessage({\n type: \"RSC_END\",\n id: id,\n });\n },\n onMetrics: (id: string, metrics: any) => {\n sendRscWorkerMessage({\n type: \"RSC_METRICS\",\n id: id,\n metrics,\n });\n },\n onHmrAccept: (id, routes) => {\n sendRscWorkerMessage({\n type: \"HMR_ACCEPT\",\n id: id,\n routes: routes,\n });\n },\n onHmrUpdate: (id, routes) => {\n sendRscWorkerMessage({\n type: \"HMR_UPDATE\",\n id: id,\n routes: routes,\n });\n },\n onServerModule: (id, url, source) => {\n addModuleId(id, url);\n sendRscWorkerMessage({\n type: \"SERVER_MODULE\",\n id,\n url,\n source,\n });\n },\n onServerActionResponse: (id, result) => {\n const stream = ReactDOMServer.renderToPipeableStream(\n {\n type: \"server-action-response\",\n returnValue: result\n },\n userOptions.moduleBasePath,\n {\n onError(error: Error) {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n },\n }\n );\n\n const passThrough = new PassThrough();\n stream.pipe(passThrough);\n\n passThrough.on(\"data\", (chunk) => {\n sendRscWorkerMessage({\n type: \"RSC_CHUNK\",\n id,\n chunk,\n });\n });\n\n passThrough.on(\"end\", () => {\n sendRscWorkerMessage({\n type: \"RSC_END\",\n id,\n });\n });\n\n passThrough.on(\"error\", (error) => {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n });\n },\n onServerAction: async (id, args) => {\n try {\n // Parse the server action ID to get the file path and export name\n const [filePath, exportName] = id.split(\"#\");\n if (!filePath || !exportName) {\n throw new Error(\n `Invalid server action ID format: ${id}. Expected format: \"path/to/file.ts#exportName\"`\n );\n }\n // Convert the server action ID to a file path\n const actionPath = filePath.startsWith(userOptions.moduleBasePath)\n ? filePath.slice(userOptions.moduleBasePath.length)\n : filePath;\n const fullPath = join(userOptions.projectRoot, actionPath);\n\n // Load the server action module\n const module = await import(fullPath);\n const action = module[exportName];\n\n if (typeof action !== \"function\") {\n throw new Error(`Server action not found: ${id}`);\n }\n\n // Execute the server action\n const result = await action(...args);\n\n // Send success response using RSC stream\n const stream = ReactDOMServer.renderToPipeableStream(\n {\n type: \"server-action-response\",\n returnValue: result\n },\n userOptions.moduleBasePath,\n {\n onError(error: Error) {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n },\n }\n );\n\n const passThrough = new PassThrough();\n stream.pipe(passThrough);\n\n passThrough.on(\"data\", (chunk) => {\n sendRscWorkerMessage({\n type: \"RSC_CHUNK\",\n id,\n chunk,\n });\n });\n\n passThrough.on(\"end\", () => {\n sendRscWorkerMessage({\n type: \"RSC_END\",\n id,\n });\n });\n\n passThrough.on(\"error\", (error) => {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n });\n } catch (error: unknown) {\n const errorMessage = toError(error).message;\n // Send error response using RSC stream\n const stream = ReactDOMServer.renderToPipeableStream(\n {\n type: \"server-action-response\",\n returnValue: { success: false, error: errorMessage }\n },\n userOptions.moduleBasePath,\n {\n onError(error: Error) {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n },\n }\n );\n\n const passThrough = new PassThrough();\n stream.pipe(passThrough);\n\n passThrough.on(\"data\", (chunk) => {\n sendRscWorkerMessage({\n type: \"RSC_CHUNK\",\n id,\n chunk,\n });\n });\n\n passThrough.on(\"end\", () => {\n sendRscWorkerMessage({\n type: \"RSC_END\",\n id,\n });\n });\n\n passThrough.on(\"error\", (error) => {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n });\n }\n },\n onShutdown: (id: string) => {\n // Send SHUTDOWN_COMPLETE message to signal that shutdown is complete\n sendRscWorkerMessage({\n type: \"SHUTDOWN_COMPLETE\",\n id: id,\n });\n },\n onCssFile: (id, code) => {\n if (id) {\n // Add to CSS registry\n addCssFileContent(id, code, userOptions);\n\n // Send CSS file message\n sendRscWorkerMessage({\n type: \"CSS_FILE\",\n id,\n content: code,\n });\n }\n },\n};\n"],"names":["error"],"mappings":";;;;;;;;;;;;;AASO,MAAM,QAAqC,GAAA;AAAA,EAChD,OAAS,EAAA,CAAC,EAAI,EAAA,KAAA,EAAO,SAAc,KAAA;AACjC,IAAqB,oBAAA,CAAA;AAAA,MACnB,IAAM,EAAA,OAAA;AAAA,MACN,EAAA;AAAA,MACA,SAAA;AAAA,MACA,KAAA,EAAO,QAAQ,KAAK;AAAA,KACrB,CAAA;AACD,IAAqB,oBAAA,CAAA;AAAA,MACnB,IAAM,EAAA,SAAA;AAAA,MACN;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA,MAAA,EAAQ,CAAC,EAAA,EAAI,IAAc,KAAA;AACzB,IAAqB,oBAAA,CAAA;AAAA,MACnB,IAAM,EAAA,WAAA;AAAA,MACN,EAAA;AAAA,MACA,KAAO,EAAA;AAAA,KACR,CAAA;AAAA,GACH;AAAA,EACA,KAAA,EAAO,CAAC,EAAe,KAAA;AACrB,IAAqB,oBAAA,CAAA;AAAA,MACnB,IAAM,EAAA,SAAA;AAAA,MACN;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA,SAAA,EAAW,CAAC,EAAA,EAAY,OAAiB,KAAA;AACvC,IAAqB,oBAAA,CAAA;AAAA,MACnB,IAAM,EAAA,aAAA;AAAA,MACN,EAAA;AAAA,MACA;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA,WAAA,EAAa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H;AAEJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../plugin/worker/rsc/index.ts"],"sourcesContent":["await(\n process.env[\"NODE_ENV\"] === \"production\"\n ? import(\"./rsc-worker.production.js\")\n : import(\"./rsc-worker.development.js\")\n);\n"],"names":[],"mappings":";;;;;AAAA,OACE,OAAA,CAAQ,IAAI,UAAU,CAAA,KAAM,eACxB,OAAO,4BAA4B,CACnC,GAAA,OAAO,6BAA6B,CAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messageHandler.js","sources":["../../../../plugin/worker/rsc/messageHandler.tsx"],"sourcesContent":["import { parentPort } from \"node:worker_threads\";\nimport {\n activeStreams,\n hmrState,\n} from \"./state.js\";\nimport { handleRender } from \"./handleRender.js\";\nimport type {\n RscWorkerInputMessage,\n} from \"../types.js\";\nimport { toError } from \"../../error/toError.js\";\nimport { handlers } from \"./handlers.js\";\n\n// In test mode, we want errors to propagate up immediately\nconst isTestEnv = process.env[\"VITEST\"] || process.env[\"NODE_ENV\"] === \"test\";\nconst isDevEnv = process.env[\"NODE_ENV\"] !== \"production\";\n\n\nexport async function messageHandler(\n msg: RscWorkerInputMessage,\n port = parentPort\n) {\n try {\n if (!port) {\n throw new Error(\"No port found\");\n }\n switch (msg.type) {\n case \"RSC_RENDER\":\n return await handleRender(msg, handlers);\n case \"SERVER_ACTION\":\n return handlers.onServerAction(msg.id, msg.args);\n case \"INITIALIZED_REACT_LOADER\":\n case \"INITIALIZED_CSS_LOADER\":\n case \"INITIALIZED_ENV_LOADER\":\n return;\n case \"HMR_UPDATE\":\n // Mark the module as invalidated\n hmrState.set(msg.id, {\n timestamp: msg.timestamp || Date.now(),\n invalidated: true,\n routes: msg.routes || [],\n });\n // Notify the main thread that we've processed the update\n handlers.onHmrUpdate(msg.id, msg.routes || []);\n return;\n case \"HMR_CLEANUP\":\n // Clear the invalidation state\n hmrState.delete(msg.id);\n // Notify the main thread that we've processed the cleanup\n handlers.onHmrAccept(msg.id, msg.routes || []);\n return;\n case \"CSS_FILE\":\n handlers.onCssFile(msg.id, msg.content);\n return;\n case \"SERVER_MODULE\":\n handlers.onServerModule(msg.id, msg.url, msg.source);\n return;\n case \"SHUTDOWN\": {\n // If id is \"*\", clean up all render states\n if (msg.id === \"*\") {\n activeStreams.forEach((stream, renderId) => {\n stream.end();\n activeStreams.delete(renderId);\n });\n parentPort?.removeAllListeners();\n } else {\n activeStreams.delete(msg.id);\n }\n handlers.onShutdown(msg.id);\n return;\n }\n default: {\n console.log(\"Unknown message\", msg);\n return;\n }\n }\n } catch (error) {\n const err = toError(error);\n if (isDevEnv) {\n console.error(err);\n }\n // In dev mode, try to send error message before exiting\n if (parentPort) {\n port?.postMessage({\n type: \"ERROR\",\n id: \"rsc-worker\",\n error: err,\n });\n }\n if (!isDevEnv || isTestEnv) {\n // In test mode or production mode, just throw the error to fail fast\n throw err;\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAaA,MAAM,SAAA,GAAY,QAAQ,GAAI,CAAA,QAAQ,KAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAM,KAAA,MAAA;AACvE,MAAM,QAAW,GAAA,OAAA,CAAQ,GAAI,CAAA,UAAU,CAAM,KAAA,YAAA;AAG7C,eAAsB,cAAA,CACpB,GACA,EAAA,IAAA,GAAO,UACP,EAAA;AACA,EAAI,IAAA;AACF,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAM,MAAA,IAAI,MAAM,eAAe,CAAA;AAAA;AAEjC,IAAA,QAAQ,IAAI,IAAM;AAAA,MAChB,KAAK,YAAA;AACH,QAAO,OAAA,MAAM,YAAa,CAAA,GAAA,EAAK,QAAQ,CAAA;AAAA,MACzC,KAAK,eAAA;AACH,QAAA,OAAO,QAAS,CAAA,cAAA,CAAe,GAAI,CAAA,EAAA,EAAI,IAAI,IAAI,CAAA;AAAA,MACjD,KAAK,0BAAA;AAAA,MACL,KA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CAAA;AAC1B,QAAA;AAAA;AACF,MACA,SAAS;AACP,QAAQ,OAAA,CAAA,GAAA,CAAI,mBAAmB,GAAG,CAAA;AAClC,QAAA;AAAA;AACF;AACF,WACO,KAAO,EAAA;AACd,IAAM,MAAA,GAAA,GAAM,QAAQ,KAAK,CAAA;AACzB,IAAA,IAAI,QAAU,EAAA;AACZ,MAAA,OAAA,CAAQ,MAAM,GAAG,CAAA;AAAA;AAGnB,IAAA,IAAI,UAAY,EAAA;AACd,MAAA,IAAA,EAAM,WAAY,CAAA;AAAA,QAChB,IAAM,EAAA,OAAA;AAAA,QACN,EAAI,EAAA,YAAA;AAAA,QACJ,KAAO,EAAA;AAAA,OACR,CAAA;AAAA;AAEH,IAAI,IAAA,CAAC,YAAY,SAAW,EAAA;AAE1B,MAAM,MAAA,GAAA;AAAA;AACR;AAEJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rsc-worker.development.js","sources":["../../../../plugin/worker/rsc/rsc-worker.development.ts"],"sourcesContent":["import { parentPort, MessageChannel, workerData } from \"node:worker_threads\";\nimport { messageHandler } from \"./messageHandler.js\";\nimport { register } from \"node:module\";\nimport { register as registerTsx } from \"tsx/esm/api\";\nimport { join } from \"node:path\";\nimport { pluginRoot } from \"../../root.js\";\nimport type {\n HmrAcceptMessage,\n HmrUpdateMessage,\n ReadyMessage,\n} from \"../types.js\";\nimport { toError } from \"../../error/toError.js\";\n\n// Initialize worker\nif (!parentPort) {\n throw new Error(\"This module must be run as a worker\");\n}\n\n// In test mode, we want errors to propagate up immediately\nconst isTestEnv = process.env[\"VITEST\"] || process.env[\"NODE_ENV\"] === \"test\";\nconst isDevEnv = process.env[\"NODE_ENV\"] !== \"production\";\nconst verbose = workerData.verbose;\n\nconst developmentMessageHandler = (msg: any) => {\n if (verbose) {\n if (\"chunk\" in msg) {\n let preview = Buffer.from(msg.chunk).toString(\"utf-8\");\n console.log(`[rsc-worker:${msg.type}] ${preview}`);\n } else {\n console.log(`[rsc-worker:${msg.type}] ${JSON.stringify(msg)}`);\n }\n }\n messageHandler(msg);\n};\n\nconst developmentCssLoaderMessageHandler = (msg: any) => {\n if (verbose) {\n console.log(`[css-loader:${msg.type}] ${JSON.stringify(msg)}`);\n }\n messageHandler(msg);\n};\n\nconst developmentEnvLoaderMessageHandler = (msg: any) => {\n if (verbose) {\n console.log(`[env-loader:${msg.type}] ${JSON.stringify(msg)}`);\n }\n messageHandler(msg);\n};\n\nconst developmentReactLoaderMessageHandler = (msg: any) => {\n if (verbose) {\n console.log(`[react-loader:${msg.type}] ${JSON.stringify(msg)}`);\n }\n messageHandler(msg);\n};\n\ntry {\n // Create channels for each loader\n const reactLoaderChannel = new MessageChannel();\n const cssLoaderChannel = new MessageChannel();\n const envLoaderChannel = new MessageChannel();\n\n // Set up message handlers before transferring ports\n reactLoaderChannel.port2.on(\"message\", developmentReactLoaderMessageHandler);\n cssLoaderChannel.port2.on(\"message\", developmentCssLoaderMessageHandler);\n envLoaderChannel.port2.on(\"message\", developmentEnvLoaderMessageHandler);\n\n const reactLoaderPath =\n \"file://\" + join(pluginRoot, \"loader/react-loader.server.js\");\n const cssLoaderPath =\n \"file://\" + join(pluginRoot, \"loader/css-loader.development.js\");\n const envLoaderPath =\n \"file://\" + join(pluginRoot, \"loader/env-loader.development.js\");\n\n register(cssLoaderPath, {\n parentURL: pluginRoot,\n data: {\n id: \"css-loader\",\n port: cssLoaderChannel.port1,\n userOptions: workerData.userOptions,\n resolvedConfig: workerData.resolvedConfig,\n },\n transferList: [cssLoaderChannel.port1],\n });\n\n // Register tsx\n registerTsx();\n\n // Register loaders with their ports\n register(reactLoaderPath, {\n parentURL: pluginRoot,\n data: {\n id: \"react-loader\",\n port: reactLoaderChannel.port1,\n userOptions: workerData.userOptions,\n },\n transferList: [reactLoaderChannel.port1],\n });\n\n // Register env-loader (ensure this the last)\n register(envLoaderPath, {\n parentURL: pluginRoot,\n data: {\n id: \"env-loader\",\n port: envLoaderChannel.port1,\n resolvedConfig: workerData.resolvedConfig,\n },\n transferList: [envLoaderChannel.port1],\n });\n\n // Set up message handling\n parentPort!.on(\"message\", developmentMessageHandler);\n\n const { hmrPort } = workerData;\n if (hmrPort) {\n // Start the message port\n hmrPort.start();\n\n // Listen for HMR messages\n hmrPort.on(\"message\", (message: any) => {\n if (message.type === \"HMR_UPDATE\") {\n // Invalidate the module in the worker\n parentPort!.postMessage({\n type: \"HMR_UPDATE\",\n id: message.id,\n routes: message.routes,\n } satisfies HmrUpdateMessage);\n } else if (message.type === \"HMR_ACCEPT\") {\n // Handle the update\n parentPort!.postMessage({\n type: \"HMR_ACCEPT\",\n id: message.id,\n routes: message.routes,\n } satisfies HmrAcceptMessage);\n }\n });\n }\n\n // Notify parent that we're ready\n parentPort!.postMessage({\n type: \"READY\",\n env: process.env[\"NODE_ENV\"],\n pid: process.pid,\n id: \"rsc-worker\",\n } satisfies ReadyMessage);\n\n if (process.env[\"NODE_ENV\"] === \"production\") {\n throw new Error(\"This module should not run in production mode.\");\n }\n} catch (error) {\n if (isDevEnv) {\n console.error(error);\n }\n // In dev mode, try to send error message before exiting\n if (parentPort) {\n parentPort?.postMessage({\n type: \"ERROR\",\n id: \"rsc-worker\",\n error: toError(error),\n });\n }\n if (!isDevEnv || isTestEnv) {\n // In test mode or production mode, just throw the error to fail fast\n throw error;\n }\n}\n"],"names":["registerTsx"],"mappings":";;;;;;;;;;;;;AAcA,IAAI,CAAC,UAAY,EAAA;AACf,EAAM,MAAA,IAAI,MAAM,qCAAqC,CAAA;AACvD;AAGA,MAAM,SAAA,GAAY,QAAQ,GAAI,CAAA,QAAQ,KAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAM,KAAA,MAAA;AACvE,MAAM,QAAW,GAAA,OAAA,CAAQ,GAAI,CAAA,UAAU,CAAM,KAAA,YAAA;AAC7C,MAAM,UAAU,UAAW,CAAA,OAAA;AAE3B,MAAM,yBAAA,GAA4B,CAAC,GAAa,KAAA;AAC9C,EAAA,I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M,MAAA,IAAI,MAAM,gDAAgD,CAAA;AAAA;AAEpE,CAAA,CAAA,OAAS,KAAO,EAAA;AACd,EAAA,IAAI,QAAU,EAAA;AACZ,IAAA,OAAA,CAAQ,MAAM,KAAK,CAAA;AAAA;AAGrB,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,UAAA,EAAY,WAAY,CAAA;AAAA,MACtB,IAAM,EAAA,OAAA;AAAA,MACN,EAAI,EAAA,YAAA;AAAA,MACJ,KAAA,EAAO,QAAQ,KAAK;AAAA,KACrB,CAAA;AAAA;AAEH,EAAI,IAAA,CAAC,YAAY,SAAW,EAAA;AAE1B,IAAM,MAAA,KAAA;AAAA;AAEV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rsc-worker.production.js","sources":["../../../../plugin/worker/rsc/rsc-worker.production.ts"],"sourcesContent":["import { parentPort, MessageChannel } from \"node:worker_threads\";\nimport { messageHandler } from \"./messageHandler.js\";\nimport { register } from \"node:module\";\nimport { join } from \"node:path\";\nimport { pluginRoot } from \"../../root.js\";\nimport type { ReadyMessage } from \"../types.js\";\n\nif (!parentPort) {\n throw new Error(\"This module must be run as a worker\");\n}\n\n// Create channels for each loader\nconst reactLoaderChannel = new MessageChannel();\nconst cssLoaderChannel = new MessageChannel();\nconst envLoaderChannel = new MessageChannel();\n\n// Register loaders\nregister(join(pluginRoot, \"worker/env-loader.js\"), {\n parentURL: import.meta.url,\n data: { port: envLoaderChannel.port2 },\n transferList: [envLoaderChannel.port2],\n});\n\n// Listen for messages from loaders\nreactLoaderChannel.port2.on(\"message\", messageHandler);\ncssLoaderChannel.port2.on(\"message\", messageHandler);\nenvLoaderChannel.port2.on(\"message\", messageHandler);\n\n// Handle incoming messages\nparentPort.on(\"message\", messageHandler);\n\n// Signal ready\nparentPort.postMessage({ type: \"READY\", id: \"rsc-worker\", env: process.env[\"NODE_ENV\"], pid: process.pid } satisfies ReadyMessage);\n"],"names":[],"mappings":";;;;;;;;;;;AAOA,IAAI,CAAC,UAAY,EAAA;AACf,EAAM,MAAA,IAAI,MAAM,qCAAqC,CAAA;AACvD;AAGA,MAAM,kBAAA,GAAqB,IAAI,cAAe,EAAA;AAC9C,MAAM,gBAAA,GAAmB,IAAI,cAAe,EAAA;AAC5C,MAAM,gBAAA,GAAmB,IAAI,cAAe,EAAA;AAG5C,QAAS,CAAA,IAAA,CAAK,UAAY,EAAA,sBAAsB,CAAG,EAAA;AAAA,EACjD,WAAW,MAAY,CAAA,IAAA,CAAA,GAAA;AAAA,EACvB,IAAM,EAAA,EAAE,IAAM,EAAA,gBAAA,CAAiB,KAAM,EAAA;AAAA,EACrC,YAAA,EAAc,CAAC,gBAAA,CAAiB,KAAK;AACvC,CAAC,CAAA;AAGD,kBAAmB,CAAA,KAAA,CAAM,EAAG,CAAA,SAAA,EAAW,cAAc,CAAA;AACrD,gBAAiB,CAAA,KAAA,CAAM,EAAG,CAAA,SAAA,EAAW,cAAc,CAAA;AACnD,gBAAiB,CAAA,KAAA,CAAM,EAAG,CAAA,SAAA,EAAW,cAAc,CAAA;AAGnD,UAAW,CAAA,EAAA,CAAG,WAAW,cAAc,CAAA;AAGvC,UAAA,CAAW,WAAY,CAAA,EAAE,IAAM,EAAA,OAAA,EAAS,IAAI,YAAc,EAAA,GAAA,EAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAA,EAAG,GAAK,EAAA,OAAA,CAAQ,KAA4B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sources":["../../../../plugin/worker/rsc/state.ts"],"sourcesContent":["import { workerData } from \"node:worker_threads\";\nimport { createCssProps } from \"../../helpers/createCssProps.js\";\nimport type { CssContent, ResolvedUserOptions, HmrState } from \"../../types.js\";\nimport type { PassThrough } from \"node:stream\";\nimport { relative } from \"node:path\";\n\n// Track active RSC streams\nexport const activeStreams = new Map<string, PassThrough>();\n\n// Track CSS files\nexport const cssFiles = new Map<string, CssContent>();\n\n// Track module IDs\nexport const moduleIds = new Map<string, string>();\n\nexport const hmrState = new Map<string, HmrState>();\n\nif (workerData) {\n if (workerData.hmrPort) {\n workerData.hmrPort.on(\n \"message\",\n (msg: { type: string; path: string; routes?: string[] }) => {\n if (msg.type === \"HMR_UPDATE\") {\n // Normalize the path relative to project root\n const normalizedPath = relative(\n workerData.userOptions.projectRoot,\n msg.path\n );\n hmrState.set(normalizedPath, {\n timestamp: Date.now(),\n invalidated: true,\n routes: msg.routes || [],\n });\n } else if (msg.type === \"HMR_ACCEPT\") {\n // Normalize the path relative to project root\n const normalizedPath = relative(\n workerData.userOptions.projectRoot,\n msg.path\n );\n hmrState.delete(normalizedPath);\n }\n }\n );\n }\n} else {\n throw new Error(\"This module must be run with workerData\");\n}\n\nexport function addCssFileContent(\n id: string,\n code: string,\n userOptions: Pick<\n ResolvedUserOptions,\n | \"projectRoot\"\n | \"moduleBaseURL\"\n | \"moduleBasePath\"\n | \"moduleRootPath\"\n | \"css\"\n | \"normalizer\"\n | \"moduleID\"\n | \"publicOrigin\"\n >\n) {\n if (typeof code !== \"string\") {\n throw new Error(\n `Expected css to be loaded as a string, but got ${typeof code}`\n );\n }\n cssFiles.set(\n id,\n createCssProps({\n id,\n code,\n userOptions,\n })\n );\n}\n\n// Helper to check if a module is invalidated\nexport function isModuleInvalidated(path: string): boolean {\n const state = hmrState.get(path);\n return state?.invalidated || false;\n}\n\n// Helper to clear HMR state for a module\nexport function clearHmrState(path: string): void {\n hmrState.delete(path);\n}\n\n// Helper to get all invalidated modules\nexport function getInvalidatedModules(): string[] {\n return Array.from(hmrState.entries())\n .filter(([_, state]) => state.invalidated)\n .map(([path]) => path);\n}\n\nexport function addModuleId(id: string, url: string) {\n moduleIds.set(id, url);\n}\n\nexport function getModuleId(id: string): string | undefined {\n return moduleIds.get(id);\n}\n"],"names":[],"mappings":";;;;;;;;;AAOa,MAAA,aAAA,uBAAoB,GAAyB;AAG7C,MAAA,QAAA,uBAAe,GAAwB;AAGvC,MAAA,SAAA,uBA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EAAU,SAAA,CAAA,GAAA,CAAI,IAAI,GAAG,CAAA;AACvB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"userOptions.js","sources":["../../../../plugin/worker/rsc/userOptions.ts"],"sourcesContent":["import { resolveOptions } from \"../../config/index.js\";\nimport { hydrateUserOptions } from \"../../helpers/index.js\";\nimport { workerData } from \"node:worker_threads\";\nconst userOptionsResult = resolveOptions(hydrateUserOptions(workerData.userOptions));\nif(userOptionsResult.type === \"error\") {\n throw userOptionsResult.error;\n}\nexport const userOptions = userOptionsResult.userOptions;"],"names":[],"mappings":";;;;;;;;;AAGA,MAAM,iBAAoB,GAAA,cAAA,CAAe,kBAAmB,CAAA,UAAA,CAAW,WAAW,CAAC,CAAA;AACnF,IAAG,iBAAA,CAAkB,SAAS,OAAS,EAAA;AACrC,EAAA,MAAM,iBAAkB,CAAA,KAAA;AAC1B;AACO,MAAM,cAAc,iBAAkB,CAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sendMessage.js","sources":["../../../plugin/worker/sendMessage.ts"],"sourcesContent":["import { cleanObject } from \"../helpers/cleanObject.js\";\nimport type {\n HtmlWorkerOutputMessage,\n RscWorkerOutputMessage,\n} from \"./types.js\";\nimport { parentPort } from \"node:worker_threads\";\n\nexport function sendMessage(\n msg: HtmlWorkerOutputMessage | RscWorkerOutputMessage,\n port = parentPort\n) {\n if (!port) {\n console.error(\"[Worker] No port available to send message\");\n return;\n }\n\n try {\n // Handle error messages\n if (\"error\" in msg) {\n const error = msg.error;\n const serializedError =\n error instanceof Error\n ? {\n message: error.message,\n stack: error.stack,\n name: error.name,\n cause: error.cause,\n }\n : {\n message: String(error),\n name: \"Error\",\n };\n\n port.postMessage({\n ...cleanObject(msg),\n error: serializedError,\n });\n } else {\n // Handle non-error messages\n port.postMessage(cleanObject(msg));\n }\n } catch (err) {\n console.error(\"[Worker] Failed to send message:\", err);\n // Try to send a basic error message\n try {\n port.postMessage({\n type: \"ERROR\",\n error: {\n message: err instanceof Error ? err.message : String(err),\n name: err instanceof Error ? err.name : \"Error\",\n },\n });\n } catch {\n // If we can't even send an error message, just log it\n console.error(\"[Worker] Critical error - could not send error message\");\n }\n }\n}\n\nexport const sendRscWorkerMessage = sendMessage as (\n msg: RscWorkerOutputMessage,\n port?: MessagePort\n) => void;\nexport const sendHtmlWorkerMessage = sendMessage as (\n msg: HtmlWorkerOutputMessage,\n port?: MessagePort\n) => void;\n"],"names":[],"mappings":";;;;;;;;AAOO,SAAS,WAAA,CACd,GACA,EAAA,IAAA,GAAO,UACP,EAAA;AACA,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAA,OAAA,CAAQ,MAAM,4CAA4C,CAAA;AAC1D,IAAA;AAAA;AAGF,EAAI,IAAA;AAEF,IAAA,IAAI,WAAW,GAAK,EAAA;AAClB,MAAA,MAAM,QAAQ,GAAI,CAAA,KAAA;AAClB,MAAM,MAAA,eAAA,GACJ,iBAAiB,KACb,GAAA;AAAA,QACE,SAAS,KAAM,CAAA,OAAA;AAAA,QACf,OAAO,KAAM,CAAA,KAAA;AAAA,QACb,MAAM,KAAM,CAAA,IAAA;AAAA,QACZ,OAAO,KAAM,CAAA;AAAA,OAEf,GAAA;AAAA,QACE,OAAA,EAAS,OAAO,KAAK,CAAA;AAAA,QACrB,IAAM,EAAA;AAAA,OACR;AAEN,MAAA,IAAA,CAAK,WAAY,CAAA;AAAA,QACf,GAAG,YAAY,GAAG,CAAA;AAAA,QAClB,KAAO,EAAA;AAAA,OACR,CAAA;AAAA,KACI,MAAA;AAEL,MAAK,IAAA,CAAA,WAAA,CAAY,WAAY,CAAA,GAAG,CAAC,CAAA;AAAA;AACnC,WACO,GAAK,EAAA;AACZ,IAAQ,OAAA,CAAA,KAAA,CAAM,oCAAoC,GAAG,CAAA;AAErD,IAAI,IAAA;AACF,MAAA,IAAA,CAAK,WAAY,CAAA;AAAA,QACf,IAAM,EAAA,OAAA;AAAA,QACN,KAAO,EAAA;AAAA,UACL,SAAS,GAAe,YAAA,KAAA,GAAQ,GAAI,CAAA,OAAA,GAAU,OAAO,GAAG,CAAA;AAAA,UACxD,IAAM,EAAA,GAAA,YAAe,KAAQ,GAAA,GAAA,CAAI,IAAO,GAAA;AAAA;AAC1C,OACD,CAAA;AAAA,KACK,CAAA,MAAA;AAEN,MAAA,OAAA,CAAQ,MAAM,wDAAwD,CAAA;AAAA;AACxE;AAEJ;AAEO,MAAM,oBAAuB,GAAA;;;;"}
|
package/dist/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../server.ts"],"sourcesContent":["\"use strict\";\n\nconst condition = process.env['NODE_OPTIONS']?.match(/--conditions[= ]react-server/) ? 'server' : 'client'\n\nif(condition !== 'server'){\n throw new Error('Condition mismatch, should be react-server but got ' + condition);\n}\n\nexport { vitePluginReactServer } from './plugin/plugin.server.js'\n\n// types\nexport type * from './plugin/types.js'"],"names":[],"mappings":";;;;;;;AAEA,MAAM,SAAA,GAAY,QAAQ,GAAI,CAAA,cAAc,GAAG,KAAM,CAAA,8BAA8B,IAAI,QAAW,GAAA,QAAA;AAElG,IAAG,cAAc,QAAS,EAAA;AACxB,EAAM,MAAA,IAAI,KAAM,CAAA,qDAAA,GAAwD,SAAS,CAAA;AACnF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { CssCollectorBoxedType } from "../types.js";
|
|
3
|
-
import { CssCollectorElements } from "./css-collector-elements.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A upgraded Root component that adds the cssFiles to the bottom of the page,,
|
|
7
|
-
* expecting links to bubble up to the document head.
|
|
8
|
-
*/
|
|
9
|
-
export const CssCollector: CssCollectorBoxedType = ({
|
|
10
|
-
as: As = React.Fragment,
|
|
11
|
-
cssFiles,
|
|
12
|
-
pageProps,
|
|
13
|
-
Page,
|
|
14
|
-
...props
|
|
15
|
-
}) => (
|
|
16
|
-
<As {...(As != React.Fragment ? (props as any) : null)}>
|
|
17
|
-
<Page {...pageProps!} />
|
|
18
|
-
<CssCollectorElements cssFiles={cssFiles!} />
|
|
19
|
-
</As>
|
|
20
|
-
);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves a matcher pattern to a function that tests paths
|
|
3
|
-
*/
|
|
4
|
-
export const resolveAutoDiscoverMatcher = (
|
|
5
|
-
options: undefined | string | RegExp | ((path: string) => boolean),
|
|
6
|
-
fallback: RegExp | ((path: string) => boolean)
|
|
7
|
-
) => {
|
|
8
|
-
if (!options) {
|
|
9
|
-
if (typeof fallback === "function") {
|
|
10
|
-
return fallback;
|
|
11
|
-
} else {
|
|
12
|
-
return (path: string) => fallback.test(path);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
if (typeof options === "string") {
|
|
16
|
-
const matcher = new RegExp(options);
|
|
17
|
-
return (path: string) => matcher.test(path);
|
|
18
|
-
} else if (typeof options === "function") {
|
|
19
|
-
return options;
|
|
20
|
-
} else {
|
|
21
|
-
return (path: string) => options.test(path);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { basename } from "path";
|
|
2
|
-
import type { SourceMap } from "../types/sourceMap.js";
|
|
3
|
-
|
|
4
|
-
// VLQ encoding helpers
|
|
5
|
-
const VLQ_SHIFT = 5;
|
|
6
|
-
const VLQ_CONTINUATION_BIT = 1 << VLQ_SHIFT;
|
|
7
|
-
const VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1;
|
|
8
|
-
const BASE64_CHARS =
|
|
9
|
-
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
10
|
-
|
|
11
|
-
export function encodeVLQ(numbers: number[]): string {
|
|
12
|
-
return numbers
|
|
13
|
-
.map((num) => {
|
|
14
|
-
// Convert to VLQ
|
|
15
|
-
const vlq = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
16
|
-
|
|
17
|
-
let result = "";
|
|
18
|
-
let value = vlq;
|
|
19
|
-
|
|
20
|
-
do {
|
|
21
|
-
let digit = value & VLQ_VALUE_MASK;
|
|
22
|
-
value >>>= VLQ_SHIFT;
|
|
23
|
-
if (value > 0) {
|
|
24
|
-
digit |= VLQ_CONTINUATION_BIT;
|
|
25
|
-
}
|
|
26
|
-
result += BASE64_CHARS[digit];
|
|
27
|
-
} while (value > 0);
|
|
28
|
-
|
|
29
|
-
return result;
|
|
30
|
-
})
|
|
31
|
-
.join("");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function decodeVLQ(str: string): number[] {
|
|
35
|
-
const numbers: number[] = [];
|
|
36
|
-
let value = 0;
|
|
37
|
-
let shift = 0;
|
|
38
|
-
let index = 0;
|
|
39
|
-
|
|
40
|
-
while (index < str.length && !/[,;]/.test(str[index])) {
|
|
41
|
-
const digit = BASE64_CHARS.indexOf(str[index]);
|
|
42
|
-
if (digit === -1) break;
|
|
43
|
-
|
|
44
|
-
value += (digit & VLQ_VALUE_MASK) << shift;
|
|
45
|
-
|
|
46
|
-
if ((digit & VLQ_CONTINUATION_BIT) === 0) {
|
|
47
|
-
const negate = value & 1;
|
|
48
|
-
value >>>= 1;
|
|
49
|
-
numbers.push(negate ? -value : value);
|
|
50
|
-
value = shift = 0;
|
|
51
|
-
} else {
|
|
52
|
-
shift += VLQ_SHIFT;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
index++;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return numbers;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function readMappings(
|
|
62
|
-
mappings: string,
|
|
63
|
-
callback: (
|
|
64
|
-
generatedLine: number,
|
|
65
|
-
generatedColumn: number,
|
|
66
|
-
sourceIndex: number,
|
|
67
|
-
originalLine: number,
|
|
68
|
-
originalColumn: number,
|
|
69
|
-
nameIndex: number
|
|
70
|
-
) => void
|
|
71
|
-
) {
|
|
72
|
-
let line = 1;
|
|
73
|
-
let column = 0;
|
|
74
|
-
let sourceIndex = 0;
|
|
75
|
-
let originalLine = 1;
|
|
76
|
-
let originalColumn = 0;
|
|
77
|
-
let nameIndex = 0;
|
|
78
|
-
|
|
79
|
-
const segments = mappings.split(";");
|
|
80
|
-
for (let i = 0; i < segments.length; i++) {
|
|
81
|
-
const segment = segments[i];
|
|
82
|
-
if (segment === "") {
|
|
83
|
-
line++;
|
|
84
|
-
column = 0;
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const parts = segment.split(",");
|
|
89
|
-
for (let j = 0; j < parts.length; j++) {
|
|
90
|
-
const part = parts[j];
|
|
91
|
-
if (part === "") continue;
|
|
92
|
-
|
|
93
|
-
const numbers = decodeVLQ(part);
|
|
94
|
-
column += numbers[0];
|
|
95
|
-
if (numbers.length > 1) {
|
|
96
|
-
sourceIndex += numbers[1];
|
|
97
|
-
originalLine += numbers[2];
|
|
98
|
-
originalColumn += numbers[3];
|
|
99
|
-
if (numbers.length > 4) {
|
|
100
|
-
nameIndex += numbers[4];
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
callback(
|
|
105
|
-
line,
|
|
106
|
-
column,
|
|
107
|
-
sourceIndex,
|
|
108
|
-
originalLine,
|
|
109
|
-
originalColumn,
|
|
110
|
-
nameIndex
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export function createMappingsSerializer() {
|
|
117
|
-
let previousGeneratedLine = 1;
|
|
118
|
-
let previousGeneratedColumn = 0;
|
|
119
|
-
let previousOriginalFile = 0;
|
|
120
|
-
let previousOriginalLine = 0;
|
|
121
|
-
let previousOriginalColumn = 0;
|
|
122
|
-
let previousNameIndex = 0;
|
|
123
|
-
|
|
124
|
-
return function (
|
|
125
|
-
generatedLine: number,
|
|
126
|
-
generatedColumn: number,
|
|
127
|
-
originalFile: number,
|
|
128
|
-
originalLine: number,
|
|
129
|
-
originalColumn: number,
|
|
130
|
-
nameIndex: number
|
|
131
|
-
): string {
|
|
132
|
-
// Reset column when moving to a new line
|
|
133
|
-
if (generatedLine > previousGeneratedLine) {
|
|
134
|
-
previousGeneratedColumn = 0;
|
|
135
|
-
let lines = "";
|
|
136
|
-
for (let i = previousGeneratedLine; i < generatedLine; i++) {
|
|
137
|
-
lines += ";";
|
|
138
|
-
}
|
|
139
|
-
previousGeneratedLine = generatedLine;
|
|
140
|
-
if (lines) return lines;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Calculate deltas
|
|
144
|
-
const segment = [
|
|
145
|
-
generatedColumn - previousGeneratedColumn,
|
|
146
|
-
originalFile - previousOriginalFile,
|
|
147
|
-
originalLine - previousOriginalLine,
|
|
148
|
-
originalColumn - previousOriginalColumn,
|
|
149
|
-
];
|
|
150
|
-
|
|
151
|
-
if (nameIndex >= 0) {
|
|
152
|
-
segment.push(nameIndex - previousNameIndex);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Update previous values
|
|
156
|
-
previousGeneratedColumn = generatedColumn;
|
|
157
|
-
previousOriginalFile = originalFile;
|
|
158
|
-
previousOriginalLine = originalLine;
|
|
159
|
-
previousOriginalColumn = originalColumn;
|
|
160
|
-
previousNameIndex = nameIndex;
|
|
161
|
-
|
|
162
|
-
return encodeVLQ(segment) + ",";
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export function createSourceMap(originalSource: string): SourceMap {
|
|
167
|
-
return {
|
|
168
|
-
version: 3,
|
|
169
|
-
file: basename(originalSource),
|
|
170
|
-
sources: [originalSource],
|
|
171
|
-
sourcesContent: [originalSource],
|
|
172
|
-
names: [],
|
|
173
|
-
mappings: "AAAA;", // Simple line mapping
|
|
174
|
-
sourceRoot: "",
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export function updateSourceMap(sourceMap: SourceMap, originalSource: string) {
|
|
179
|
-
// Update the source map with the transformed source
|
|
180
|
-
sourceMap.sourcesContent = [originalSource];
|
|
181
|
-
sourceMap.mappings = "AAAA;"; // Simple line mapping
|
|
182
|
-
}
|