vite-plugin-react-server 1.2.0-alpha.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +211 -59
- package/dist/client.d.ts +4 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +4 -4
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +7 -10
- package/dist/package.json +102 -27
- package/dist/plugin/bundle/bundles.d.ts +11 -0
- package/dist/plugin/bundle/bundles.d.ts.map +1 -0
- package/dist/plugin/bundle/bundles.js +11 -0
- package/dist/plugin/bundle/deferredStaticGeneration.d.ts +31 -0
- package/dist/plugin/bundle/deferredStaticGeneration.d.ts.map +1 -0
- package/dist/plugin/bundle/deferredStaticGeneration.js +44 -0
- package/dist/plugin/bundle/manifests.d.ts +20 -0
- package/dist/plugin/bundle/manifests.d.ts.map +1 -0
- package/dist/plugin/bundle/manifests.js +54 -0
- package/dist/plugin/components/css.d.ts +2 -5
- package/dist/plugin/components/css.d.ts.map +1 -1
- package/dist/plugin/components/css.js +7 -9
- package/dist/plugin/components/html.d.ts +2 -3
- package/dist/plugin/components/html.d.ts.map +1 -1
- package/dist/plugin/components/html.js +3 -3
- package/dist/plugin/components/index.d.ts +1 -1
- package/dist/plugin/components/index.d.ts.map +1 -1
- package/dist/plugin/components/root.d.ts.map +1 -1
- package/dist/plugin/components/root.js +4 -4
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js +6 -6
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts +6 -5
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js +34 -51
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts +5 -1
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js +124 -52
- package/dist/plugin/config/createHandlerOptions.client.d.ts +4 -0
- package/dist/plugin/config/createHandlerOptions.client.d.ts.map +1 -0
- package/dist/plugin/config/createHandlerOptions.client.js +293 -0
- package/dist/plugin/config/createHandlerOptions.d.ts +4 -0
- package/dist/plugin/config/createHandlerOptions.d.ts.map +1 -0
- package/dist/plugin/config/createHandlerOptions.js +13 -0
- package/dist/plugin/config/createHandlerOptions.server.d.ts +4 -0
- package/dist/plugin/config/createHandlerOptions.server.d.ts.map +1 -0
- package/dist/plugin/config/createHandlerOptions.server.js +344 -0
- package/dist/plugin/config/createHandlerOptions.types.d.ts +114 -0
- package/dist/plugin/config/createHandlerOptions.types.d.ts.map +1 -0
- package/dist/plugin/config/createModuleID.d.ts +1 -1
- package/dist/plugin/config/createModuleID.d.ts.map +1 -1
- package/dist/plugin/config/createModuleID.js +121 -8
- package/dist/plugin/config/defaults.d.ts +152 -17
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +69 -25
- package/dist/plugin/config/envPrefixFromConfig.d.ts +3 -0
- package/dist/plugin/config/envPrefixFromConfig.d.ts.map +1 -0
- package/dist/plugin/config/envPrefixFromConfig.js +8 -0
- package/dist/plugin/config/getCondition.d.ts +54 -3
- package/dist/plugin/config/getCondition.d.ts.map +1 -1
- package/dist/plugin/config/getCondition.js +158 -6
- package/dist/plugin/{getNodeEnv.d.ts → config/getNodeEnv.d.ts} +1 -1
- package/dist/plugin/config/getNodeEnv.d.ts.map +1 -0
- package/dist/plugin/config/getNodeEnv.js +17 -0
- package/dist/plugin/config/index.d.ts +43 -1
- package/dist/plugin/config/index.d.ts.map +1 -1
- package/dist/plugin/config/index.js +9 -4
- package/dist/plugin/config/resolveDirectiveMatcher.d.ts +6 -6
- package/dist/plugin/config/resolveDirectiveMatcher.d.ts.map +1 -1
- package/dist/plugin/config/resolveDirectiveMatcher.js +7 -23
- 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 +32 -28
- package/dist/plugin/config/resolveOptions.d.ts +3 -2
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +195 -61
- package/dist/plugin/config/resolvePages.d.ts +1 -1
- package/dist/plugin/config/resolvePages.d.ts.map +1 -1
- package/dist/plugin/config/resolvePages.js +1 -1
- package/dist/plugin/config/resolvePatternWithValues.d.ts.map +1 -1
- package/dist/plugin/config/resolvePatternWithValues.js +7 -26
- package/dist/plugin/config/resolveUrlOption.d.ts +1 -1
- package/dist/plugin/config/resolveUrlOption.d.ts.map +1 -1
- package/dist/plugin/config/resolveUrlOption.js +2 -2
- package/dist/plugin/config/resolveUserConfig.d.ts +5 -3
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +221 -70
- package/dist/plugin/config/stashedOptionsState.d.ts +66 -0
- package/dist/plugin/config/stashedOptionsState.d.ts.map +1 -0
- package/dist/plugin/config/stashedOptionsState.js +25 -0
- package/dist/plugin/dev-server/cleanupServerAction.client.d.ts +6 -0
- package/dist/plugin/dev-server/cleanupServerAction.client.d.ts.map +1 -0
- package/dist/plugin/dev-server/cleanupServerAction.client.js +28 -0
- package/dist/plugin/dev-server/cleanupServerAction.d.ts +2 -0
- package/dist/plugin/dev-server/cleanupServerAction.d.ts.map +1 -0
- package/dist/plugin/dev-server/cleanupServerAction.js +4 -0
- package/dist/plugin/dev-server/cleanupServerAction.server.d.ts +8 -0
- package/dist/plugin/dev-server/cleanupServerAction.server.d.ts.map +1 -0
- package/dist/plugin/dev-server/cleanupServerAction.server.js +15 -0
- package/dist/plugin/dev-server/configureReactServer.client.d.ts +7 -0
- package/dist/plugin/dev-server/configureReactServer.client.d.ts.map +1 -0
- package/dist/plugin/dev-server/configureReactServer.client.js +85 -0
- package/dist/plugin/dev-server/configureReactServer.d.ts +2 -0
- package/dist/plugin/dev-server/configureReactServer.d.ts.map +1 -0
- package/dist/plugin/dev-server/configureReactServer.js +13 -0
- package/dist/plugin/dev-server/configureReactServer.server.d.ts +3 -0
- package/dist/plugin/dev-server/configureReactServer.server.d.ts.map +1 -0
- package/dist/plugin/dev-server/configureReactServer.server.js +444 -0
- package/dist/plugin/dev-server/configureRequestHandler.client.d.ts +13 -0
- package/dist/plugin/dev-server/configureRequestHandler.client.d.ts.map +1 -0
- package/dist/plugin/dev-server/configureRequestHandler.client.js +307 -0
- package/dist/plugin/dev-server/configureRequestHandler.d.ts +2 -0
- package/dist/plugin/dev-server/configureRequestHandler.d.ts.map +1 -0
- package/dist/plugin/dev-server/configureRequestHandler.js +4 -0
- package/dist/plugin/dev-server/configureRequestHandler.server.d.ts +6 -0
- package/dist/plugin/dev-server/configureRequestHandler.server.d.ts.map +1 -0
- package/dist/plugin/dev-server/configureRequestHandler.server.js +44 -0
- package/dist/plugin/dev-server/handleServerAction.client.d.ts +11 -0
- package/dist/plugin/dev-server/handleServerAction.client.d.ts.map +1 -0
- package/dist/plugin/dev-server/handleServerAction.client.js +97 -0
- package/dist/plugin/dev-server/handleServerAction.d.ts +2 -0
- package/dist/plugin/dev-server/handleServerAction.d.ts.map +1 -0
- package/dist/plugin/dev-server/handleServerAction.js +13 -0
- package/dist/plugin/dev-server/handleServerAction.server.d.ts +3 -0
- package/dist/plugin/dev-server/handleServerAction.server.d.ts.map +1 -0
- package/dist/plugin/dev-server/handleServerAction.server.js +15 -0
- package/dist/plugin/dev-server/index.client.d.ts +7 -0
- package/dist/plugin/dev-server/index.client.d.ts.map +1 -0
- package/dist/plugin/dev-server/index.client.js +11 -0
- package/dist/plugin/dev-server/index.d.ts +4 -0
- package/dist/plugin/dev-server/index.d.ts.map +1 -0
- package/dist/plugin/dev-server/index.js +19 -0
- package/dist/plugin/dev-server/index.server.d.ts +7 -0
- package/dist/plugin/dev-server/index.server.d.ts.map +1 -0
- package/dist/plugin/dev-server/index.server.js +11 -0
- package/dist/plugin/dev-server/plugin.client.d.ts +7 -0
- package/dist/plugin/dev-server/plugin.client.d.ts.map +1 -0
- package/dist/plugin/dev-server/plugin.client.js +122 -0
- package/dist/plugin/dev-server/plugin.server.d.ts +8 -0
- package/dist/plugin/dev-server/plugin.server.d.ts.map +1 -0
- package/dist/plugin/dev-server/plugin.server.js +108 -0
- package/dist/plugin/dev-server/restartWorker.client.d.ts +3 -0
- package/dist/plugin/dev-server/restartWorker.client.d.ts.map +1 -0
- package/dist/plugin/dev-server/restartWorker.client.js +131 -0
- package/dist/plugin/dev-server/restartWorker.d.ts +2 -0
- package/dist/plugin/dev-server/restartWorker.d.ts.map +1 -0
- package/dist/plugin/dev-server/restartWorker.js +4 -0
- package/dist/plugin/dev-server/restartWorker.server.d.ts +3 -0
- package/dist/plugin/dev-server/restartWorker.server.d.ts.map +1 -0
- package/dist/plugin/dev-server/restartWorker.server.js +88 -0
- package/dist/plugin/dev-server/types.d.ts +38 -0
- package/dist/plugin/dev-server/types.d.ts.map +1 -0
- package/dist/plugin/dev-server/virtualRscHmrPlugin.d.ts +7 -0
- package/dist/plugin/dev-server/virtualRscHmrPlugin.d.ts.map +1 -0
- package/dist/plugin/dev-server/virtualRscHmrPlugin.js +80 -0
- package/dist/plugin/env/createConfigEnv.d.ts +13 -0
- package/dist/plugin/env/createConfigEnv.d.ts.map +1 -0
- package/dist/plugin/env/createConfigEnv.js +43 -0
- package/dist/plugin/env/createEnvPlugin.d.ts +3 -0
- package/dist/plugin/env/createEnvPlugin.d.ts.map +1 -0
- package/dist/plugin/env/createEnvPlugin.js +59 -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 +52 -0
- package/dist/plugin/env/getEnvKey.d.ts +46 -0
- package/dist/plugin/env/getEnvKey.d.ts.map +1 -0
- package/dist/plugin/env/getEnvKey.js +32 -0
- package/dist/plugin/env/index.d.ts +5 -0
- package/dist/plugin/env/index.d.ts.map +1 -1
- package/dist/plugin/env/index.js +7 -0
- package/dist/plugin/env/plugin.client.d.ts +2 -0
- package/dist/plugin/env/plugin.client.d.ts.map +1 -0
- package/dist/plugin/env/plugin.client.js +2 -0
- package/dist/plugin/env/plugin.d.ts +4 -34
- package/dist/plugin/env/plugin.d.ts.map +1 -1
- package/dist/plugin/env/plugin.js +27 -102
- package/dist/plugin/env/plugin.server.d.ts +2 -0
- package/dist/plugin/env/plugin.server.d.ts.map +1 -0
- package/dist/plugin/env/plugin.server.js +2 -0
- 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 +12 -0
- package/dist/plugin/environments/createBuildEventPlugin.d.ts +4 -0
- package/dist/plugin/environments/createBuildEventPlugin.d.ts.map +1 -0
- package/dist/plugin/environments/createBuildEventPlugin.js +100 -0
- package/dist/plugin/environments/createEnvironmentPlugin.d.ts +19 -0
- package/dist/plugin/environments/createEnvironmentPlugin.d.ts.map +1 -0
- package/dist/plugin/environments/createEnvironmentPlugin.js +257 -0
- package/dist/plugin/environments/hashCoordination.d.ts +14 -0
- package/dist/plugin/environments/hashCoordination.d.ts.map +1 -0
- package/dist/plugin/environments/hashCoordination.js +35 -0
- package/dist/plugin/environments/resolveEnvironmentConfig.d.ts +41 -0
- package/dist/plugin/environments/resolveEnvironmentConfig.d.ts.map +1 -0
- package/dist/plugin/environments/resolveEnvironmentConfig.js +232 -0
- package/dist/plugin/error/assertPanic.d.ts +2 -0
- package/dist/plugin/error/assertPanic.d.ts.map +1 -0
- package/dist/plugin/error/assertPanic.js +15 -0
- package/dist/plugin/error/handleError.d.ts +9 -0
- package/dist/plugin/error/handleError.d.ts.map +1 -0
- package/dist/plugin/error/handleError.js +51 -0
- package/dist/plugin/error/index.d.ts +3 -0
- package/dist/plugin/error/index.d.ts.map +1 -1
- package/dist/plugin/error/index.js +4 -1
- package/dist/plugin/error/logError.d.ts +6 -2
- package/dist/plugin/error/logError.d.ts.map +1 -1
- package/dist/plugin/error/logError.js +35 -34
- package/dist/plugin/error/panicThresholdHandler.d.ts +27 -0
- package/dist/plugin/error/panicThresholdHandler.d.ts.map +1 -0
- package/dist/plugin/error/panicThresholdHandler.js +13 -0
- package/dist/plugin/error/serializeError.d.ts +6 -2
- package/dist/plugin/error/serializeError.d.ts.map +1 -1
- package/dist/plugin/error/serializeError.js +30 -10
- package/dist/plugin/error/serializeErrorInfo.d.ts +5 -0
- package/dist/plugin/error/serializeErrorInfo.d.ts.map +1 -0
- package/dist/plugin/error/serializeErrorInfo.js +19 -0
- package/dist/plugin/error/setupGlobalErrorHandler.d.ts +4 -0
- package/dist/plugin/error/setupGlobalErrorHandler.d.ts.map +1 -0
- package/dist/plugin/error/setupGlobalErrorHandler.js +52 -0
- package/dist/plugin/error/shouldPanic.d.ts +6 -0
- package/dist/plugin/error/shouldPanic.d.ts.map +1 -0
- package/dist/plugin/error/shouldPanic.js +15 -0
- package/dist/plugin/error/toError.d.ts +5 -1
- package/dist/plugin/error/toError.d.ts.map +1 -1
- package/dist/plugin/error/toError.js +43 -19
- package/dist/plugin/error/types.d.ts +28 -0
- package/dist/plugin/error/types.d.ts.map +1 -0
- package/dist/plugin/helpers/collectManifestCss.d.ts.map +1 -1
- package/dist/plugin/helpers/collectManifestCss.js +19 -5
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts +3 -3
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts.map +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.js +64 -3
- package/dist/plugin/helpers/createBufferedRscStream.d.ts +52 -0
- package/dist/plugin/helpers/createBufferedRscStream.d.ts.map +1 -0
- package/dist/plugin/helpers/createBufferedRscStream.js +147 -0
- package/dist/plugin/helpers/createCssProps.d.ts.map +1 -1
- package/dist/plugin/helpers/createCssProps.js +15 -25
- package/dist/plugin/helpers/createElementWithReact.d.ts +9 -0
- package/dist/plugin/helpers/createElementWithReact.d.ts.map +1 -0
- package/dist/plugin/helpers/createElementWithReact.js +87 -0
- package/dist/plugin/helpers/createPatternMatcher.d.ts +24 -0
- package/dist/plugin/helpers/createPatternMatcher.d.ts.map +1 -0
- package/dist/plugin/helpers/createPatternMatcher.js +50 -0
- package/dist/plugin/helpers/createRscRenderHelpers.d.ts +16 -0
- package/dist/plugin/helpers/createRscRenderHelpers.d.ts.map +1 -0
- package/dist/plugin/helpers/createRscRenderHelpers.js +60 -0
- package/dist/plugin/helpers/createSafePageComponent.d.ts +36 -0
- package/dist/plugin/helpers/createSafePageComponent.d.ts.map +1 -0
- package/dist/plugin/helpers/createSafePageComponent.js +50 -0
- package/dist/plugin/helpers/createSerializableHandlerOptions.d.ts +60 -0
- package/dist/plugin/helpers/createSerializableHandlerOptions.d.ts.map +1 -0
- package/dist/plugin/helpers/createSerializableHandlerOptions.js +94 -0
- package/dist/plugin/helpers/createSharedLoader.d.ts +44 -0
- package/dist/plugin/helpers/createSharedLoader.d.ts.map +1 -0
- package/dist/plugin/helpers/createSharedLoader.js +137 -0
- package/dist/plugin/helpers/createUnifiedCssProcessor.d.ts +70 -0
- package/dist/plugin/helpers/createUnifiedCssProcessor.d.ts.map +1 -0
- package/dist/plugin/helpers/createUnifiedCssProcessor.js +89 -0
- package/dist/plugin/helpers/getBundleManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/getBundleManifest.js +2 -3
- package/dist/plugin/helpers/getRouteFiles.d.ts +2 -2
- package/dist/plugin/helpers/getRouteFiles.d.ts.map +1 -1
- package/dist/plugin/helpers/getRouteFiles.js +67 -36
- package/dist/plugin/helpers/handleServerAction.client.d.ts +29 -0
- package/dist/plugin/helpers/handleServerAction.client.d.ts.map +1 -0
- package/dist/plugin/helpers/handleServerAction.client.js +93 -0
- package/dist/plugin/helpers/handleServerAction.d.ts +2 -34
- package/dist/plugin/helpers/handleServerAction.d.ts.map +1 -1
- package/dist/plugin/helpers/handleServerAction.js +15 -44
- package/dist/plugin/helpers/handleServerAction.server.d.ts +25 -0
- package/dist/plugin/helpers/handleServerAction.server.d.ts.map +1 -0
- package/dist/plugin/helpers/handleServerAction.server.js +80 -0
- package/dist/plugin/helpers/handleServerActionHelper.d.ts +61 -0
- package/dist/plugin/helpers/handleServerActionHelper.d.ts.map +1 -0
- package/dist/plugin/helpers/handleServerActionHelper.js +183 -0
- package/dist/plugin/helpers/headlessStreamReuseHandler.d.ts +12 -0
- package/dist/plugin/helpers/headlessStreamReuseHandler.d.ts.map +1 -0
- package/dist/plugin/helpers/headlessStreamReuseHandler.js +29 -0
- package/dist/plugin/helpers/headlessStreamState.d.ts +71 -0
- package/dist/plugin/helpers/headlessStreamState.d.ts.map +1 -0
- package/dist/plugin/helpers/headlessStreamState.js +81 -0
- package/dist/plugin/helpers/hydrateUserOptions.d.ts +1 -1
- package/dist/plugin/helpers/hydrateUserOptions.d.ts.map +1 -1
- package/dist/plugin/helpers/hydrateUserOptions.js +2 -2
- package/dist/plugin/helpers/index.d.ts +12 -5
- package/dist/plugin/helpers/index.d.ts.map +1 -1
- package/dist/plugin/helpers/index.js +18 -4
- package/dist/plugin/helpers/logRenderStart.d.ts +17 -0
- package/dist/plugin/helpers/logRenderStart.d.ts.map +1 -0
- package/dist/plugin/helpers/logRenderStart.js +13 -0
- package/dist/plugin/helpers/mergeMessageWithDefaults.d.ts +90 -0
- package/dist/plugin/helpers/mergeMessageWithDefaults.d.ts.map +1 -0
- package/dist/plugin/helpers/mergeMessageWithDefaults.js +67 -0
- package/dist/plugin/helpers/pipeToResponse.d.ts +19 -0
- package/dist/plugin/helpers/pipeToResponse.d.ts.map +1 -0
- package/dist/plugin/helpers/pipeToResponse.js +55 -0
- package/dist/plugin/helpers/requestInfo.d.ts +6 -4
- package/dist/plugin/helpers/requestInfo.d.ts.map +1 -1
- package/dist/plugin/helpers/requestInfo.js +48 -30
- package/dist/plugin/helpers/resolveComponents.client.d.ts +34 -0
- package/dist/plugin/helpers/resolveComponents.client.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveComponents.client.js +126 -0
- package/dist/plugin/helpers/resolveModuleFromManifest.d.ts +36 -0
- package/dist/plugin/helpers/resolveModuleFromManifest.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveModuleFromManifest.js +60 -0
- package/dist/plugin/helpers/resolvePageAndProps.d.ts +23 -2
- package/dist/plugin/helpers/resolvePageAndProps.d.ts.map +1 -1
- package/dist/plugin/helpers/resolvePageAndProps.js +150 -9
- package/dist/plugin/helpers/resolveRenderUrl.d.ts +11 -0
- package/dist/plugin/helpers/resolveRenderUrl.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveRenderUrl.js +19 -0
- package/dist/plugin/helpers/resolveStreamElements.client.d.ts +14 -0
- package/dist/plugin/helpers/resolveStreamElements.client.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveStreamElements.client.js +36 -0
- package/dist/plugin/helpers/resolveStreamElements.d.ts +3 -0
- package/dist/plugin/helpers/resolveStreamElements.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveStreamElements.js +13 -0
- package/dist/plugin/helpers/resolveStreamElements.server.d.ts +15 -0
- package/dist/plugin/helpers/resolveStreamElements.server.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveStreamElements.server.js +35 -0
- package/dist/plugin/helpers/resolveStreamElements.types.d.ts +22 -0
- package/dist/plugin/helpers/resolveStreamElements.types.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveStreamElements.types.js +1 -0
- package/dist/plugin/helpers/resolveVirtualAndNodeModules.d.ts +15 -0
- package/dist/plugin/helpers/resolveVirtualAndNodeModules.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveVirtualAndNodeModules.js +45 -0
- package/dist/plugin/helpers/resolveWithDefaultRootAndHtml.d.ts +18 -0
- package/dist/plugin/helpers/resolveWithDefaultRootAndHtml.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveWithDefaultRootAndHtml.js +17 -0
- package/dist/plugin/helpers/serializeUserOptions.d.ts +2 -2
- package/dist/plugin/helpers/serializeUserOptions.d.ts.map +1 -1
- package/dist/plugin/helpers/serializeUserOptions.js +28 -13
- package/dist/plugin/helpers/tryManifest.d.ts +2 -2
- package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/tryManifest.js +12 -6
- package/dist/plugin/helpers/validateRscRenderMessage.d.ts +9 -0
- package/dist/plugin/helpers/validateRscRenderMessage.d.ts.map +1 -0
- package/dist/plugin/helpers/validateRscRenderMessage.js +13 -0
- package/dist/plugin/helpers/workerCleanup.d.ts +29 -0
- package/dist/plugin/helpers/workerCleanup.d.ts.map +1 -0
- package/dist/plugin/helpers/workerCleanup.js +28 -0
- package/dist/plugin/helpers/workerManager.d.ts +5 -0
- package/dist/plugin/helpers/workerManager.d.ts.map +1 -0
- package/dist/plugin/helpers/workerManager.js +18 -0
- package/dist/plugin/index.d.ts +4 -1
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +5 -2
- package/dist/plugin/loader/createDefaultLoader.d.ts +1 -1
- package/dist/plugin/loader/createDefaultLoader.d.ts.map +1 -1
- package/dist/plugin/loader/createDefaultLoader.js +2 -22
- package/dist/plugin/loader/createTransformer.d.ts.map +1 -1
- package/dist/plugin/loader/createTransformer.js +157 -32
- package/dist/plugin/loader/directives/analyzeDirectives.d.ts +3 -2
- package/dist/plugin/loader/directives/analyzeDirectives.d.ts.map +1 -1
- package/dist/plugin/loader/directives/analyzeDirectives.js +53 -26
- package/dist/plugin/loader/directives/analyzeModule.d.ts +2 -6
- package/dist/plugin/loader/directives/analyzeModule.d.ts.map +1 -1
- package/dist/plugin/loader/directives/analyzeModule.js +32 -11
- package/dist/plugin/loader/env-loader.d.ts +3 -2
- package/dist/plugin/loader/env-loader.d.ts.map +1 -1
- package/dist/plugin/loader/env-loader.js +32 -9
- package/dist/plugin/loader/parse.d.ts +3 -2
- package/dist/plugin/loader/parse.d.ts.map +1 -1
- package/dist/plugin/loader/parse.js +2 -2
- package/dist/plugin/loader/react-loader.d.ts +4 -4
- package/dist/plugin/loader/react-loader.d.ts.map +1 -1
- package/dist/plugin/loader/react-loader.js +101 -73
- package/dist/plugin/loader/transformClientModule.d.ts +4 -5
- package/dist/plugin/loader/transformClientModule.d.ts.map +1 -1
- package/dist/plugin/loader/transformClientModule.js +63 -18
- package/dist/plugin/loader/transformModule.d.ts.map +1 -1
- package/dist/plugin/loader/transformModule.js +82 -14
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts +6 -1
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts.map +1 -1
- package/dist/plugin/loader/transformModuleIfNeeded.js +10 -18
- 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 +74 -0
- package/dist/plugin/loader/transformServerModule.d.ts +2 -3
- package/dist/plugin/loader/transformServerModule.d.ts.map +1 -1
- package/dist/plugin/loader/transformServerModule.js +80 -22
- package/dist/plugin/loader/transformWithAcornLoose.js +1 -3
- package/dist/plugin/loader/types.d.ts +37 -32
- package/dist/plugin/loader/types.d.ts.map +1 -1
- package/dist/plugin/metrics/collectStreamMetrics.d.ts +1 -2
- package/dist/plugin/metrics/collectStreamMetrics.d.ts.map +1 -1
- package/dist/plugin/metrics/collectStreamMetrics.js +1 -1
- package/dist/plugin/metrics/convertStreamMetrics.d.ts +3 -0
- package/dist/plugin/metrics/convertStreamMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/convertStreamMetrics.js +26 -0
- package/dist/plugin/metrics/createModuleResolutionMetrics.d.ts +12 -0
- package/dist/plugin/metrics/createModuleResolutionMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/createModuleResolutionMetrics.js +32 -0
- package/dist/plugin/metrics/createRenderMetrics.d.ts +2 -2
- package/dist/plugin/metrics/createRenderMetrics.d.ts.map +1 -1
- package/dist/plugin/metrics/createRenderMetrics.js +45 -13
- package/dist/plugin/metrics/createStreamMetrics.d.ts +2 -2
- package/dist/plugin/metrics/createStreamMetrics.d.ts.map +1 -1
- package/dist/plugin/metrics/createStreamMetrics.js +15 -4
- package/dist/plugin/metrics/createWorkerStartupMetrics.d.ts +12 -0
- package/dist/plugin/metrics/createWorkerStartupMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/createWorkerStartupMetrics.js +14 -0
- package/dist/plugin/metrics/formatMetrics.d.ts +0 -6
- package/dist/plugin/metrics/formatMetrics.d.ts.map +1 -1
- package/dist/plugin/metrics/formatMetrics.js +7 -29
- package/dist/plugin/metrics/index.d.ts +6 -3
- package/dist/plugin/metrics/index.d.ts.map +1 -1
- package/dist/plugin/metrics/index.js +6 -3
- package/dist/plugin/metrics/metricWatcher.d.ts +9 -0
- package/dist/plugin/metrics/metricWatcher.d.ts.map +1 -0
- package/dist/plugin/metrics/metricWatcher.js +141 -0
- package/dist/plugin/metrics/types.d.ts +72 -6
- package/dist/plugin/metrics/types.d.ts.map +1 -1
- package/dist/plugin/orchestrator/createPluginOrchestrator.client.d.ts +3 -0
- package/dist/plugin/orchestrator/createPluginOrchestrator.client.d.ts.map +1 -0
- package/dist/plugin/orchestrator/createPluginOrchestrator.client.js +36 -0
- package/dist/plugin/orchestrator/createPluginOrchestrator.d.ts +19 -0
- package/dist/plugin/orchestrator/createPluginOrchestrator.d.ts.map +1 -0
- package/dist/plugin/orchestrator/createPluginOrchestrator.js +13 -0
- package/dist/plugin/orchestrator/createPluginOrchestrator.server.d.ts +3 -0
- package/dist/plugin/orchestrator/createPluginOrchestrator.server.d.ts.map +1 -0
- package/dist/plugin/orchestrator/createPluginOrchestrator.server.js +44 -0
- package/dist/plugin/orchestrator/index.d.ts +2 -0
- package/dist/plugin/orchestrator/index.d.ts.map +1 -0
- package/dist/plugin/orchestrator/index.js +1 -0
- package/dist/plugin/orchestrator/plugin.js +7 -0
- package/dist/plugin/orchestrator/resolveStrategy.d.ts +19 -0
- package/dist/plugin/orchestrator/resolveStrategy.d.ts.map +1 -0
- package/dist/plugin/orchestrator/resolveStrategy.js +35 -0
- package/dist/plugin/orchestrator/types.d.ts +21 -0
- package/dist/plugin/orchestrator/types.d.ts.map +1 -0
- package/dist/plugin/orchestrator/types.js +1 -0
- package/dist/plugin/plugin.client.d.ts +11 -19
- package/dist/plugin/plugin.client.d.ts.map +1 -1
- package/dist/plugin/plugin.client.js +28 -29
- package/dist/plugin/plugin.d.ts +2 -1
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +4 -2
- package/dist/plugin/plugin.server.d.ts +13 -11
- package/dist/plugin/plugin.server.d.ts.map +1 -1
- package/dist/plugin/plugin.server.js +19 -22
- package/dist/plugin/process-env.d.ts +19 -6
- package/dist/plugin/process-env.d.ts.map +1 -1
- package/dist/plugin/process-env.js +17 -0
- package/dist/plugin/react-client/createMessageHandlers.d.ts +2 -10
- package/dist/plugin/react-client/createMessageHandlers.d.ts.map +1 -1
- package/dist/plugin/react-client/createMessageHandlers.js +42 -69
- package/dist/plugin/react-client/index.client.d.ts +2 -0
- package/dist/plugin/react-client/index.client.d.ts.map +1 -0
- package/dist/plugin/react-client/index.client.js +1 -0
- package/dist/plugin/react-client/index.d.ts +3 -4
- package/dist/plugin/react-client/index.d.ts.map +1 -1
- package/dist/plugin/react-client/index.js +10 -5
- package/dist/plugin/react-client/index.server.d.ts +2 -0
- package/dist/plugin/react-client/index.server.d.ts.map +1 -0
- package/dist/plugin/react-client/index.server.js +1 -0
- package/dist/plugin/react-client/plugin.client.d.ts +15 -0
- package/dist/plugin/react-client/plugin.client.d.ts.map +1 -0
- package/dist/plugin/react-client/plugin.client.js +98 -0
- package/dist/plugin/react-client/plugin.d.ts +2 -5
- package/dist/plugin/react-client/plugin.d.ts.map +1 -1
- package/dist/plugin/react-client/plugin.js +6 -121
- package/dist/plugin/react-client/plugin.server.d.ts +15 -0
- package/dist/plugin/react-client/plugin.server.d.ts.map +1 -0
- package/dist/plugin/react-client/plugin.server.js +93 -0
- package/dist/plugin/react-client/types.d.ts +60 -0
- package/dist/plugin/react-client/types.d.ts.map +1 -0
- package/dist/plugin/react-client/types.js +1 -0
- package/dist/plugin/react-server/index.client.d.ts +2 -0
- package/dist/plugin/react-server/index.client.d.ts.map +1 -0
- package/dist/plugin/react-server/index.client.js +1 -0
- package/dist/plugin/react-server/index.d.ts +3 -1
- package/dist/plugin/react-server/index.d.ts.map +1 -1
- package/dist/plugin/react-server/index.js +13 -1
- package/dist/plugin/react-server/index.server.d.ts +2 -0
- package/dist/plugin/react-server/index.server.d.ts.map +1 -0
- package/dist/plugin/react-server/index.server.js +1 -0
- package/dist/plugin/react-server/plugin.client.d.ts +3 -0
- package/dist/plugin/react-server/plugin.client.d.ts.map +1 -0
- package/dist/plugin/react-server/plugin.client.js +40 -0
- package/dist/plugin/react-server/plugin.d.ts +2 -5
- package/dist/plugin/react-server/plugin.d.ts.map +1 -1
- package/dist/plugin/react-server/plugin.js +5 -141
- package/dist/plugin/react-server/plugin.server.d.ts +3 -0
- package/dist/plugin/react-server/plugin.server.d.ts.map +1 -0
- package/dist/plugin/react-server/plugin.server.js +18 -0
- package/dist/plugin/react-server/types.d.ts +11 -0
- package/dist/plugin/react-server/types.d.ts.map +1 -0
- package/dist/plugin/react-server/types.js +1 -0
- package/dist/plugin/react-static/collectHtmlContent.d.ts +15 -0
- package/dist/plugin/react-static/collectHtmlContent.d.ts.map +1 -0
- package/dist/plugin/react-static/collectHtmlContent.js +104 -0
- package/dist/plugin/react-static/collectRscContent.d.ts +10 -15
- package/dist/plugin/react-static/collectRscContent.d.ts.map +1 -1
- package/dist/plugin/react-static/collectRscContent.js +71 -20
- package/dist/plugin/react-static/configurePreviewServer.d.ts +1 -7
- package/dist/plugin/react-static/configurePreviewServer.d.ts.map +1 -1
- package/dist/plugin/react-static/configurePreviewServer.js +15 -29
- package/dist/plugin/react-static/createBuildLoader.client.d.ts +2 -0
- package/dist/plugin/react-static/createBuildLoader.client.d.ts.map +1 -0
- package/dist/plugin/react-static/createBuildLoader.client.js +7 -0
- package/dist/plugin/react-static/createBuildLoader.d.ts +3 -19
- package/dist/plugin/react-static/createBuildLoader.d.ts.map +1 -1
- package/dist/plugin/react-static/createBuildLoader.js +4 -226
- package/dist/plugin/react-static/createBuildLoader.server.d.ts +9 -0
- package/dist/plugin/react-static/createBuildLoader.server.d.ts.map +1 -0
- package/dist/plugin/react-static/createBuildLoader.server.js +253 -0
- package/dist/plugin/react-static/fileWriter.d.ts +3 -14
- package/dist/plugin/react-static/fileWriter.d.ts.map +1 -1
- package/dist/plugin/react-static/fileWriter.js +233 -42
- package/dist/plugin/react-static/index.client.d.ts +7 -0
- package/dist/plugin/react-static/index.client.d.ts.map +1 -0
- package/dist/plugin/react-static/index.client.js +6 -0
- package/dist/plugin/react-static/index.d.ts +7 -1
- package/dist/plugin/react-static/index.d.ts.map +1 -1
- package/dist/plugin/react-static/index.js +19 -1
- package/dist/plugin/react-static/index.server.d.ts +7 -0
- package/dist/plugin/react-static/index.server.d.ts.map +1 -0
- package/dist/plugin/react-static/index.server.js +6 -0
- package/dist/plugin/react-static/plugin.client.d.ts +32 -0
- package/dist/plugin/react-static/plugin.client.d.ts.map +1 -0
- package/dist/plugin/react-static/plugin.client.js +801 -0
- package/dist/plugin/react-static/plugin.d.ts +3 -20
- package/dist/plugin/react-static/plugin.d.ts.map +1 -1
- package/dist/plugin/react-static/plugin.js +4 -365
- package/dist/plugin/react-static/plugin.server.d.ts +18 -0
- package/dist/plugin/react-static/plugin.server.d.ts.map +1 -0
- package/dist/plugin/react-static/plugin.server.js +615 -0
- package/dist/plugin/react-static/processCssFilesForPages.d.ts +16 -0
- package/dist/plugin/react-static/processCssFilesForPages.d.ts.map +1 -0
- package/dist/plugin/react-static/processCssFilesForPages.js +94 -0
- package/dist/plugin/react-static/renderPage.client.d.ts +49 -0
- package/dist/plugin/react-static/renderPage.client.d.ts.map +1 -0
- package/dist/plugin/react-static/renderPage.client.js +555 -0
- package/dist/plugin/react-static/renderPage.d.ts +3 -4
- package/dist/plugin/react-static/renderPage.d.ts.map +1 -1
- package/dist/plugin/react-static/renderPage.js +6 -131
- package/dist/plugin/react-static/renderPage.server.d.ts +24 -0
- package/dist/plugin/react-static/renderPage.server.d.ts.map +1 -0
- package/dist/plugin/react-static/renderPage.server.js +533 -0
- package/dist/plugin/react-static/renderPages.d.ts +11 -3
- package/dist/plugin/react-static/renderPages.d.ts.map +1 -1
- package/dist/plugin/react-static/renderPages.js +533 -92
- package/dist/plugin/react-static/renderPagesBatched.d.ts +6 -0
- package/dist/plugin/react-static/renderPagesBatched.d.ts.map +1 -0
- package/dist/plugin/react-static/renderPagesBatched.js +195 -0
- package/dist/plugin/react-static/renderStreams.d.ts +2 -5
- package/dist/plugin/react-static/renderStreams.d.ts.map +1 -1
- package/dist/plugin/react-static/renderStreams.js +36 -24
- package/dist/plugin/react-static/rscToHtmlStream.client.d.ts +12 -0
- package/dist/plugin/react-static/rscToHtmlStream.client.d.ts.map +1 -0
- package/dist/plugin/react-static/rscToHtmlStream.client.js +32 -0
- package/dist/plugin/react-static/rscToHtmlStream.d.ts +3 -21
- package/dist/plugin/react-static/rscToHtmlStream.d.ts.map +1 -1
- package/dist/plugin/react-static/rscToHtmlStream.js +4 -53
- package/dist/plugin/react-static/rscToHtmlStream.server.d.ts +3 -0
- package/dist/plugin/react-static/rscToHtmlStream.server.d.ts.map +1 -0
- package/dist/plugin/react-static/rscToHtmlStream.server.js +39 -0
- package/dist/plugin/react-static/temporaryReferences.client.d.ts +2 -0
- package/dist/plugin/react-static/temporaryReferences.client.d.ts.map +1 -0
- package/dist/plugin/react-static/temporaryReferences.client.js +1 -0
- package/dist/plugin/react-static/temporaryReferences.d.ts +2 -1
- package/dist/plugin/react-static/temporaryReferences.d.ts.map +1 -1
- package/dist/plugin/react-static/temporaryReferences.js +6 -10
- package/dist/plugin/react-static/temporaryReferences.server.d.ts +2 -0
- package/dist/plugin/react-static/temporaryReferences.server.d.ts.map +1 -0
- package/dist/plugin/react-static/temporaryReferences.server.js +3 -0
- package/dist/plugin/react-static/types.d.ts +83 -9
- package/dist/plugin/react-static/types.d.ts.map +1 -1
- package/dist/plugin/root.d.ts.map +1 -1
- package/dist/plugin/root.js +2 -5
- package/dist/plugin/stream/MessagePortReadable.d.ts +22 -0
- package/dist/plugin/stream/MessagePortReadable.d.ts.map +1 -0
- package/dist/plugin/stream/MessagePortReadable.js +101 -0
- package/dist/plugin/stream/MessagePortWritable.d.ts +22 -0
- package/dist/plugin/stream/MessagePortWritable.d.ts.map +1 -0
- package/dist/plugin/stream/MessagePortWritable.js +85 -0
- package/dist/plugin/stream/client.js +12 -0
- package/dist/plugin/stream/createFromNodeStream.client.d.ts +9 -0
- package/dist/plugin/stream/createFromNodeStream.client.d.ts.map +1 -0
- package/dist/plugin/stream/createFromNodeStream.client.js +76 -0
- package/dist/plugin/stream/createFromNodeStream.d.ts +3 -0
- package/dist/plugin/stream/createFromNodeStream.d.ts.map +1 -0
- package/dist/plugin/stream/createFromNodeStream.js +6 -0
- package/dist/plugin/stream/createFromNodeStream.server.d.ts +9 -0
- package/dist/plugin/stream/createFromNodeStream.server.d.ts.map +1 -0
- package/dist/plugin/stream/createFromNodeStream.server.js +27 -0
- package/dist/plugin/stream/createFromNodeStream.types.d.ts +37 -0
- package/dist/plugin/stream/createFromNodeStream.types.d.ts.map +1 -0
- package/dist/plugin/stream/createFromNodeStream.types.js +1 -0
- package/dist/plugin/stream/createHtmlStream.client.d.ts +3 -0
- package/dist/plugin/stream/createHtmlStream.client.d.ts.map +1 -0
- package/dist/plugin/stream/createHtmlStream.client.js +42 -0
- package/dist/plugin/stream/createHtmlStream.d.ts +3 -0
- package/dist/plugin/stream/createHtmlStream.d.ts.map +1 -0
- package/dist/plugin/stream/createHtmlStream.js +6 -0
- package/dist/plugin/stream/createHtmlStream.server.d.ts +6 -0
- package/dist/plugin/stream/createHtmlStream.server.d.ts.map +1 -0
- package/dist/plugin/stream/createHtmlStream.server.js +224 -0
- package/dist/plugin/stream/createHtmlStream.types.d.ts +43 -0
- package/dist/plugin/stream/createHtmlStream.types.d.ts.map +1 -0
- package/dist/plugin/stream/createHtmlStream.types.js +1 -0
- package/dist/plugin/stream/createMainThreadHandlers.d.ts +11 -0
- package/dist/plugin/stream/createMainThreadHandlers.d.ts.map +1 -0
- package/dist/plugin/stream/createMainThreadHandlers.js +32 -0
- package/dist/plugin/stream/createMessageChannels.d.ts +29 -0
- package/dist/plugin/stream/createMessageChannels.d.ts.map +1 -0
- package/dist/plugin/stream/createMessageChannels.js +35 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.client.d.ts +10 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.client.d.ts.map +1 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.client.js +188 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.d.ts +3 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.d.ts.map +1 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.js +6 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.server.d.ts +45 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.server.d.ts.map +1 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.server.js +249 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.types.d.ts +17 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.types.d.ts.map +1 -0
- package/dist/plugin/stream/createRenderToPipeableStreamHandler.types.js +1 -0
- package/dist/plugin/stream/createRscStream.client.d.ts +18 -0
- package/dist/plugin/stream/createRscStream.client.d.ts.map +1 -0
- package/dist/plugin/stream/createRscStream.client.js +79 -0
- package/dist/plugin/stream/createRscStream.d.ts +2 -0
- package/dist/plugin/stream/createRscStream.d.ts.map +1 -0
- package/dist/plugin/stream/createRscStream.js +13 -0
- package/dist/plugin/stream/createRscStream.server.d.ts +46 -0
- package/dist/plugin/stream/createRscStream.server.d.ts.map +1 -0
- package/dist/plugin/stream/createRscStream.server.js +113 -0
- package/dist/plugin/stream/createRscStream.types.d.ts +134 -0
- package/dist/plugin/stream/createRscStream.types.d.ts.map +1 -0
- package/dist/plugin/stream/createRscStream.types.js +1 -0
- package/dist/plugin/stream/createRscStream.utils.d.ts +54 -0
- package/dist/plugin/stream/createRscStream.utils.d.ts.map +1 -0
- package/dist/plugin/stream/createRscStream.utils.js +91 -0
- package/dist/plugin/stream/createRscWorkerStream.d.ts +41 -0
- package/dist/plugin/stream/createRscWorkerStream.d.ts.map +1 -0
- package/dist/plugin/stream/createRscWorkerStream.js +120 -0
- package/dist/plugin/stream/handleRscStream.client.d.ts +17 -0
- package/dist/plugin/stream/handleRscStream.client.d.ts.map +1 -0
- package/dist/plugin/stream/handleRscStream.client.js +163 -0
- package/dist/plugin/stream/handleRscStream.d.ts +3 -0
- package/dist/plugin/stream/handleRscStream.d.ts.map +1 -0
- package/dist/plugin/stream/handleRscStream.js +13 -0
- package/dist/plugin/stream/handleRscStream.server.d.ts +6 -0
- package/dist/plugin/stream/handleRscStream.server.d.ts.map +1 -0
- package/dist/plugin/stream/handleRscStream.server.js +70 -0
- package/dist/plugin/stream/handleRscStream.types.d.ts +28 -0
- package/dist/plugin/stream/handleRscStream.types.d.ts.map +1 -0
- package/dist/plugin/stream/handleRscStream.types.js +1 -0
- package/dist/plugin/stream/index.client.d.ts +7 -0
- package/dist/plugin/stream/index.client.d.ts.map +1 -0
- package/dist/plugin/stream/index.client.js +11 -0
- package/dist/plugin/stream/index.d.ts +95 -0
- package/dist/plugin/stream/index.d.ts.map +1 -0
- package/dist/plugin/stream/index.js +21 -0
- package/dist/plugin/stream/index.server.d.ts +7 -0
- package/dist/plugin/stream/index.server.d.ts.map +1 -0
- package/dist/plugin/stream/index.server.js +11 -0
- package/dist/plugin/stream/renderRscStream.server.d.ts +21 -0
- package/dist/plugin/stream/renderRscStream.server.d.ts.map +1 -0
- package/dist/plugin/stream/renderRscStream.server.js +153 -0
- package/dist/plugin/stream/renderRscStream.types.d.ts +36 -0
- package/dist/plugin/stream/renderRscStream.types.d.ts.map +1 -0
- package/dist/plugin/stream/renderRscStream.types.js +1 -0
- package/dist/plugin/stream/renderRscStreamHelpers.server.d.ts +9 -0
- package/dist/plugin/stream/renderRscStreamHelpers.server.d.ts.map +1 -0
- package/dist/plugin/stream/renderRscStreamHelpers.server.js +63 -0
- package/dist/plugin/stream/server.js +12 -0
- package/dist/plugin/stream/setMaxListeners.d.ts +16 -0
- package/dist/plugin/stream/setMaxListeners.d.ts.map +1 -0
- package/dist/plugin/stream/setMaxListeners.js +16 -0
- package/dist/plugin/transformer/createTransformerPlugin.d.ts +18 -0
- package/dist/plugin/transformer/createTransformerPlugin.d.ts.map +1 -0
- package/dist/plugin/transformer/createTransformerPlugin.js +269 -0
- package/dist/plugin/transformer/plugin.client.d.ts +3 -0
- package/dist/plugin/transformer/plugin.client.d.ts.map +1 -0
- package/dist/plugin/transformer/plugin.client.js +5 -0
- package/dist/plugin/transformer/plugin.server.d.ts +2 -29
- package/dist/plugin/transformer/plugin.server.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.server.js +5 -104
- package/dist/plugin/transformer/transformerEnv.d.ts +15 -0
- package/dist/plugin/transformer/transformerEnv.d.ts.map +1 -0
- package/dist/plugin/transformer/transformerEnv.js +26 -0
- package/dist/plugin/types.d.ts +368 -143
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/types.js +1 -2
- package/dist/plugin/utils/callServer.d.ts +1 -1
- package/dist/plugin/utils/callServer.d.ts.map +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 +4 -9
- package/dist/plugin/utils/createReactFetcher.d.ts +43 -2
- package/dist/plugin/utils/createReactFetcher.d.ts.map +1 -1
- package/dist/plugin/utils/createReactFetcher.js +14 -3
- package/dist/plugin/utils/envUrls.node.d.ts.map +1 -1
- package/dist/plugin/utils/envUrls.node.js +11 -11
- package/dist/plugin/utils/index.client.d.ts +8 -0
- package/dist/plugin/utils/index.client.d.ts.map +1 -0
- package/dist/plugin/utils/index.client.js +8 -0
- 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 +3 -2
- package/dist/plugin/utils/index.server.d.ts +6 -0
- package/dist/plugin/utils/index.server.d.ts.map +1 -0
- package/dist/plugin/utils/index.server.js +8 -0
- package/dist/plugin/utils/routeToURL.d.ts.map +1 -1
- package/dist/plugin/utils/routeToURL.js +4 -4
- package/dist/plugin/utils/urls.d.ts +1 -1
- package/dist/plugin/utils/urls.d.ts.map +1 -1
- package/dist/plugin/utils/urls.js +29 -8
- package/dist/plugin/utils/useRscHmr.d.ts +39 -0
- package/dist/plugin/utils/useRscHmr.d.ts.map +1 -0
- package/dist/plugin/utils/useRscHmr.js +27 -0
- package/dist/plugin/vendor/vendor.client.d.ts +3 -3
- package/dist/plugin/vendor/vendor.client.d.ts.map +1 -1
- package/dist/plugin/vendor/vendor.client.js +7 -6
- package/dist/plugin/vendor/vendor.d.ts +1 -1
- package/dist/plugin/vendor/vendor.d.ts.map +1 -1
- package/dist/plugin/vendor/vendor.js +4 -6
- package/dist/plugin/vendor/vendor.server.d.ts +4 -2
- package/dist/plugin/vendor/vendor.server.d.ts.map +1 -1
- package/dist/plugin/vendor/vendor.server.js +2 -3
- package/dist/plugin/vendor/vendor.static.d.ts +4 -0
- package/dist/plugin/vendor/vendor.static.d.ts.map +1 -0
- package/dist/plugin/vendor/vendor.static.js +15 -0
- package/dist/plugin/worker/createWorker.d.ts +16 -5
- package/dist/plugin/worker/createWorker.d.ts.map +1 -1
- package/dist/plugin/worker/createWorker.js +207 -30
- package/dist/plugin/worker/html/handleHtmlRender.d.ts +14 -0
- package/dist/plugin/worker/html/handleHtmlRender.d.ts.map +1 -0
- package/dist/plugin/worker/html/handleHtmlRender.js +190 -0
- package/dist/plugin/worker/html/html-worker.development.js +9 -26
- package/dist/plugin/worker/html/html-worker.js +4 -4
- package/dist/plugin/worker/html/html-worker.production.js +7 -13
- package/dist/plugin/worker/html/index.d.ts +1 -1
- package/dist/plugin/worker/html/index.js +6 -2
- 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 +291 -104
- package/dist/plugin/worker/html/state.d.ts +10 -0
- package/dist/plugin/worker/html/state.d.ts.map +1 -0
- package/dist/plugin/worker/html/state.js +28 -0
- package/dist/plugin/worker/html/types.d.ts +52 -23
- package/dist/plugin/worker/html/types.d.ts.map +1 -1
- package/dist/plugin/worker/index.js +1 -1
- package/dist/plugin/worker/rsc/createBundleLoader.d.ts +22 -0
- package/dist/plugin/worker/rsc/createBundleLoader.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/createBundleLoader.js +55 -0
- package/dist/plugin/worker/rsc/createRscWorkerLoader.d.ts +23 -0
- package/dist/plugin/worker/rsc/createRscWorkerLoader.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/createRscWorkerLoader.js +79 -0
- package/dist/plugin/worker/rsc/handleRscRender.d.ts +32 -0
- package/dist/plugin/worker/rsc/handleRscRender.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/handleRscRender.js +349 -0
- package/dist/plugin/worker/rsc/handlers.d.ts +8 -2
- package/dist/plugin/worker/rsc/handlers.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handlers.js +137 -200
- package/dist/plugin/worker/rsc/hydrateRscRenderMessage.d.ts +118 -0
- package/dist/plugin/worker/rsc/hydrateRscRenderMessage.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/hydrateRscRenderMessage.js +61 -0
- 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 +927 -47
- package/dist/plugin/worker/rsc/rsc-worker.development.js +153 -148
- package/dist/plugin/worker/rsc/rsc-worker.js +2 -3
- package/dist/plugin/worker/rsc/rsc-worker.production.js +240 -15
- package/dist/plugin/worker/rsc/state.d.ts +6 -0
- package/dist/plugin/worker/rsc/state.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/state.js +37 -5
- package/dist/plugin/worker/rsc/types.d.ts +73 -12
- package/dist/plugin/worker/rsc/types.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/workerUserOptions.d.ts +10 -0
- package/dist/plugin/worker/rsc/workerUserOptions.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/workerUserOptions.js +39 -0
- package/dist/plugin/worker/sendMessage.d.ts +2 -3
- package/dist/plugin/worker/sendMessage.d.ts.map +1 -1
- package/dist/plugin/worker/sendMessage.js +24 -38
- package/dist/plugin/worker/types.d.ts +42 -56
- package/dist/plugin/worker/types.d.ts.map +1 -1
- package/dist/plugin/worker/worker-handlers.server.d.ts +2 -0
- package/dist/plugin/worker/worker-handlers.server.d.ts.map +1 -0
- package/dist/plugin/worker/worker-handlers.server.js +1 -0
- package/dist/server.d.ts +5 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +4 -6
- package/dist/static.js +11 -0
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +102 -27
- package/plugin/bundle/bundles.ts +22 -0
- package/plugin/bundle/deferredStaticGeneration.ts +48 -0
- package/plugin/bundle/manifests.ts +73 -0
- package/plugin/components/css.tsx +3 -7
- package/plugin/components/html.tsx +4 -3
- package/plugin/components/index.ts +1 -1
- package/plugin/components/root.tsx +3 -3
- package/plugin/config/autoDiscover/createGlobAutoDiscover.ts +10 -5
- package/plugin/config/autoDiscover/pageAndPropFiles.ts +4 -2
- package/plugin/config/autoDiscover/resolveAutoDiscover.ts +64 -79
- package/plugin/config/autoDiscover/resolveBuildPages.ts +181 -69
- package/plugin/config/createHandlerOptions.client.ts +403 -0
- package/plugin/config/createHandlerOptions.server.ts +477 -0
- package/plugin/config/createHandlerOptions.ts +46 -0
- package/plugin/config/createHandlerOptions.types.ts +119 -0
- package/plugin/config/createModuleID.ts +201 -10
- package/plugin/config/defaults.tsx +108 -55
- package/plugin/config/envPrefixFromConfig.ts +10 -0
- package/plugin/config/getCondition.ts +267 -10
- package/plugin/{getNodeEnv.ts → config/getNodeEnv.ts} +4 -2
- package/plugin/config/index.ts +60 -1
- package/plugin/config/resolveDirectiveMatcher.ts +13 -34
- package/plugin/config/resolveEnv.ts +37 -33
- package/plugin/config/resolveOptions.ts +375 -154
- package/plugin/config/resolvePages.ts +1 -1
- package/plugin/config/resolvePatternWithValues.ts +6 -26
- package/plugin/config/resolveUrlOption.ts +2 -2
- package/plugin/config/resolveUserConfig.ts +359 -124
- package/plugin/config/stashedOptionsState.ts +144 -0
- package/plugin/dev-server/cleanupServerAction.client.ts +47 -0
- package/plugin/dev-server/cleanupServerAction.server.ts +24 -0
- package/plugin/dev-server/cleanupServerAction.ts +8 -0
- package/plugin/dev-server/configureReactServer.client.ts +107 -0
- package/plugin/dev-server/configureReactServer.server.ts +558 -0
- package/plugin/dev-server/configureReactServer.ts +8 -0
- package/plugin/dev-server/configureRequestHandler.client.ts +382 -0
- package/plugin/dev-server/configureRequestHandler.server.ts +46 -0
- package/plugin/dev-server/configureRequestHandler.ts +8 -0
- package/plugin/dev-server/handleServerAction.client.ts +126 -0
- package/plugin/dev-server/handleServerAction.server.ts +10 -0
- package/plugin/dev-server/handleServerAction.ts +8 -0
- package/plugin/dev-server/index.client.ts +6 -0
- package/plugin/dev-server/index.server.ts +6 -0
- package/plugin/dev-server/index.ts +20 -0
- package/plugin/dev-server/plugin.client.ts +160 -0
- package/plugin/dev-server/plugin.server.ts +133 -0
- package/plugin/dev-server/restartWorker.client.ts +155 -0
- package/plugin/dev-server/restartWorker.server.ts +108 -0
- package/plugin/dev-server/restartWorker.ts +8 -0
- package/plugin/dev-server/types.ts +78 -0
- package/plugin/dev-server/virtualRscHmrPlugin.ts +82 -0
- package/plugin/env/createConfigEnv.ts +59 -0
- package/plugin/env/createEnvPlugin.ts +76 -0
- package/plugin/env/getArgValue.ts +56 -0
- package/plugin/env/getEnvKey.ts +80 -0
- package/plugin/env/index.ts +14 -1
- package/plugin/env/plugin.client.ts +3 -0
- package/plugin/env/plugin.server.ts +4 -0
- package/plugin/env/plugin.ts +40 -164
- package/plugin/env/userConfigEnv.ts +22 -0
- package/plugin/environments/createBuildEventPlugin.ts +117 -0
- package/plugin/environments/createEnvironmentPlugin.ts +332 -0
- package/plugin/environments/hashCoordination.ts +39 -0
- package/plugin/environments/resolveEnvironmentConfig.ts +320 -0
- package/plugin/error/assertPanic.ts +9 -0
- package/plugin/error/handleError.ts +63 -0
- package/plugin/error/index.ts +4 -1
- package/plugin/error/logError.ts +64 -40
- package/plugin/error/panicThresholdHandler.ts +52 -0
- package/plugin/error/serializeError.ts +36 -11
- package/plugin/error/serializeErrorInfo.ts +17 -0
- package/plugin/error/setupGlobalErrorHandler.ts +71 -0
- package/plugin/error/shouldPanic.ts +14 -0
- package/plugin/error/toError.ts +59 -19
- package/plugin/error/types.ts +32 -0
- package/plugin/helpers/README.md +112 -0
- package/plugin/helpers/collectManifestCss.ts +24 -5
- package/plugin/helpers/collectViteModuleGraphCss.ts +83 -9
- package/plugin/helpers/createBufferedRscStream.ts +194 -0
- package/plugin/helpers/createCssProps.tsx +22 -41
- package/plugin/helpers/createElementWithReact.tsx +121 -0
- package/plugin/helpers/createPatternMatcher.ts +100 -0
- package/plugin/helpers/createRscRenderHelpers.ts +77 -0
- package/plugin/helpers/createSafePageComponent.ts +64 -0
- package/plugin/helpers/createSerializableHandlerOptions.ts +183 -0
- package/plugin/helpers/createSharedLoader.ts +207 -0
- package/plugin/helpers/createUnifiedCssProcessor.ts +175 -0
- package/plugin/helpers/getBundleManifest.ts +2 -3
- package/plugin/helpers/getRouteFiles.ts +94 -48
- package/plugin/helpers/handleServerAction.client.ts +145 -0
- package/plugin/helpers/handleServerAction.server.ts +151 -0
- package/plugin/helpers/handleServerAction.ts +19 -78
- package/plugin/helpers/handleServerActionHelper.ts +270 -0
- package/plugin/helpers/headlessStreamReuseHandler.ts +48 -0
- package/plugin/helpers/headlessStreamState.ts +122 -0
- package/plugin/helpers/hydrateUserOptions.ts +2 -2
- package/plugin/helpers/index.ts +32 -5
- package/plugin/helpers/logRenderStart.ts +26 -0
- package/plugin/helpers/mergeMessageWithDefaults.ts +80 -0
- package/plugin/helpers/pipeToResponse.ts +77 -0
- package/plugin/helpers/requestInfo.ts +59 -39
- package/plugin/helpers/resolveComponents.client.ts +183 -0
- package/plugin/helpers/resolveModuleFromManifest.ts +99 -0
- package/plugin/helpers/resolvePageAndProps.ts +237 -50
- package/plugin/helpers/resolveRenderUrl.ts +26 -0
- package/plugin/helpers/resolveStreamElements.client.ts +50 -0
- package/plugin/helpers/resolveStreamElements.server.ts +43 -0
- package/plugin/helpers/resolveStreamElements.ts +13 -0
- package/plugin/helpers/resolveStreamElements.types.ts +29 -0
- package/plugin/helpers/resolveVirtualAndNodeModules.ts +75 -0
- package/plugin/helpers/resolveWithDefaultRootAndHtml.ts +25 -0
- package/plugin/helpers/serializeUserOptions.ts +37 -15
- package/plugin/helpers/tryManifest.ts +15 -6
- package/plugin/helpers/validateRscRenderMessage.ts +13 -0
- package/plugin/helpers/workerCleanup.ts +85 -0
- package/plugin/helpers/workerManager.ts +16 -0
- package/plugin/index.ts +6 -2
- package/plugin/loader/createDefaultLoader.ts +0 -21
- package/plugin/loader/createTransformer.ts +232 -46
- package/plugin/loader/directives/analyzeDirectives.ts +163 -73
- package/plugin/loader/directives/analyzeModule.ts +46 -19
- package/plugin/loader/env-loader.ts +56 -14
- package/plugin/loader/parse.ts +2 -2
- package/plugin/loader/react-loader.ts +133 -85
- package/plugin/loader/transformClientModule.ts +84 -26
- package/plugin/loader/transformModule.ts +103 -18
- package/plugin/loader/transformModuleIfNeeded.ts +20 -23
- package/plugin/loader/transformNonServerEnvironment.ts +103 -0
- package/plugin/loader/transformServerModule.ts +132 -37
- package/plugin/loader/types.ts +31 -23
- package/plugin/metrics/collectStreamMetrics.ts +1 -2
- package/plugin/metrics/convertStreamMetrics.ts +28 -0
- package/plugin/metrics/createModuleResolutionMetrics.ts +38 -0
- package/plugin/metrics/createRenderMetrics.ts +46 -13
- package/plugin/metrics/createStreamMetrics.ts +16 -6
- package/plugin/metrics/createWorkerStartupMetrics.ts +38 -0
- package/plugin/metrics/formatMetrics.ts +5 -33
- package/plugin/metrics/index.ts +6 -3
- package/plugin/metrics/metricWatcher.ts +216 -0
- package/plugin/metrics/types.ts +87 -8
- package/plugin/orchestrator/createPluginOrchestrator.client.ts +47 -0
- package/plugin/orchestrator/createPluginOrchestrator.server.ts +55 -0
- package/plugin/orchestrator/createPluginOrchestrator.ts +29 -0
- package/plugin/orchestrator/index.ts +1 -0
- package/plugin/orchestrator/resolveStrategy.ts +53 -0
- package/plugin/orchestrator/types.ts +24 -0
- package/plugin/plugin.client.ts +30 -32
- package/plugin/plugin.server.ts +38 -45
- package/plugin/plugin.ts +8 -2
- package/plugin/process-env.ts +30 -6
- package/plugin/react-client/createMessageHandlers.ts +9 -34
- package/plugin/react-client/index.client.ts +1 -0
- package/plugin/react-client/index.server.ts +1 -0
- package/plugin/react-client/index.ts +13 -4
- package/plugin/react-client/plugin.client.ts +124 -0
- package/plugin/react-client/plugin.server.ts +108 -0
- package/plugin/react-client/plugin.ts +13 -152
- package/plugin/react-client/types.ts +95 -0
- package/plugin/react-server/index.client.ts +1 -0
- package/plugin/react-server/index.server.ts +1 -0
- package/plugin/react-server/index.ts +13 -1
- package/plugin/react-server/plugin.client.ts +54 -0
- package/plugin/react-server/plugin.server.ts +27 -0
- package/plugin/react-server/plugin.ts +8 -183
- package/plugin/react-server/types.ts +24 -0
- package/plugin/react-static/collectHtmlContent.ts +131 -0
- package/plugin/react-static/collectRscContent.ts +92 -49
- package/plugin/react-static/configurePreviewServer.ts +20 -41
- package/plugin/react-static/createBuildLoader.client.ts +7 -0
- package/plugin/react-static/createBuildLoader.server.ts +333 -0
- package/plugin/react-static/createBuildLoader.ts +8 -300
- package/plugin/react-static/fileWriter.ts +303 -64
- package/plugin/react-static/index.client.ts +6 -0
- package/plugin/react-static/index.server.ts +6 -0
- package/plugin/react-static/index.ts +25 -1
- package/plugin/react-static/plugin.client.ts +932 -0
- package/plugin/react-static/plugin.server.ts +713 -0
- package/plugin/react-static/plugin.ts +8 -446
- package/plugin/react-static/processCssFilesForPages.ts +148 -0
- package/plugin/react-static/renderPage.client.ts +640 -0
- package/plugin/react-static/renderPage.server.ts +655 -0
- package/plugin/react-static/renderPage.ts +10 -172
- package/plugin/react-static/renderPages.ts +736 -139
- package/plugin/react-static/renderPagesBatched.ts +264 -0
- package/plugin/react-static/renderStreams.ts +12 -16
- package/plugin/react-static/rscToHtmlStream.client.ts +61 -0
- package/plugin/react-static/rscToHtmlStream.server.ts +66 -0
- package/plugin/react-static/rscToHtmlStream.ts +8 -80
- package/plugin/react-static/temporaryReferences.client.ts +1 -0
- package/plugin/react-static/temporaryReferences.server.ts +5 -0
- package/plugin/react-static/temporaryReferences.ts +11 -2
- package/plugin/react-static/types.ts +202 -8
- package/plugin/root.ts +1 -3
- package/plugin/stream/MessagePortReadable.ts +131 -0
- package/plugin/stream/MessagePortWritable.ts +104 -0
- package/plugin/stream/createFromNodeStream.client.ts +90 -0
- package/plugin/stream/createFromNodeStream.server.ts +30 -0
- package/plugin/stream/createFromNodeStream.ts +13 -0
- package/plugin/stream/createFromNodeStream.types.ts +53 -0
- package/plugin/stream/createHtmlStream.client.ts +47 -0
- package/plugin/stream/createHtmlStream.server.ts +312 -0
- package/plugin/stream/createHtmlStream.ts +13 -0
- package/plugin/stream/createHtmlStream.types.ts +63 -0
- package/plugin/stream/createMainThreadHandlers.ts +44 -0
- package/plugin/stream/createMessageChannels.ts +52 -0
- package/plugin/stream/createRenderToPipeableStreamHandler.client.ts +224 -0
- package/plugin/stream/createRenderToPipeableStreamHandler.server.ts +358 -0
- package/plugin/stream/createRenderToPipeableStreamHandler.ts +13 -0
- package/plugin/stream/createRenderToPipeableStreamHandler.types.ts +69 -0
- package/plugin/stream/createRscStream.client.ts +122 -0
- package/plugin/stream/createRscStream.server.ts +188 -0
- package/plugin/stream/createRscStream.ts +8 -0
- package/plugin/stream/createRscStream.types.ts +168 -0
- package/plugin/stream/createRscStream.utils.ts +171 -0
- package/plugin/stream/createRscWorkerStream.ts +178 -0
- package/plugin/stream/handleRscStream.client.ts +214 -0
- package/plugin/stream/handleRscStream.server.ts +82 -0
- package/plugin/stream/handleRscStream.ts +11 -0
- package/plugin/stream/handleRscStream.types.ts +70 -0
- package/plugin/stream/index.client.ts +15 -0
- package/plugin/stream/index.server.ts +15 -0
- package/plugin/stream/index.ts +137 -0
- package/plugin/stream/renderRscStream.server.ts +182 -0
- package/plugin/stream/renderRscStream.types.ts +43 -0
- package/plugin/stream/renderRscStreamHelpers.server.ts +88 -0
- package/plugin/stream/setMaxListeners.ts +30 -0
- package/plugin/transformer/README.md +2 -381
- package/plugin/transformer/createTransformerPlugin.ts +388 -0
- package/plugin/transformer/plugin.client.ts +7 -0
- package/plugin/transformer/plugin.server.ts +6 -140
- package/plugin/transformer/transformerEnv.ts +49 -0
- package/plugin/types/react-server-dom-esm.d.ts +269 -110
- package/plugin/types/virtual-rsc-hmr.d.ts +21 -0
- package/plugin/types.ts +637 -225
- package/plugin/utils/createCallServer.ts +8 -18
- package/plugin/utils/createReactFetcher.ts +87 -5
- package/plugin/utils/env.ts +1 -1
- package/plugin/utils/envUrls.node.ts +15 -10
- package/plugin/utils/index.client.ts +8 -0
- package/plugin/utils/index.server.ts +8 -0
- package/plugin/utils/index.ts +5 -1
- package/plugin/utils/routeToURL.ts +3 -4
- package/plugin/utils/urls.ts +41 -9
- package/plugin/utils/useRscHmr.ts +72 -0
- package/plugin/vendor/vendor.client.ts +9 -7
- package/plugin/vendor/vendor.server.ts +5 -4
- package/plugin/vendor/vendor.static.ts +12 -0
- package/plugin/vendor/vendor.ts +10 -5
- package/plugin/worker/createWorker.ts +283 -41
- package/plugin/worker/html/README.md +2 -65
- package/plugin/worker/html/handleHtmlRender.ts +245 -0
- package/plugin/worker/html/html-worker.development.tsx +5 -17
- package/plugin/worker/html/html-worker.production.tsx +1 -1
- package/plugin/worker/html/html-worker.ts +5 -5
- package/plugin/worker/html/index.ts +6 -6
- package/plugin/worker/html/messageHandler.tsx +317 -98
- package/plugin/worker/html/state.ts +38 -0
- package/plugin/worker/html/types.ts +108 -35
- package/plugin/worker/rsc/README.md +2 -257
- package/plugin/worker/rsc/createBundleLoader.ts +92 -0
- package/plugin/worker/rsc/createRscWorkerLoader.ts +104 -0
- package/plugin/worker/rsc/handleRscRender.ts +510 -0
- package/plugin/worker/rsc/handlers.ts +159 -238
- package/plugin/worker/rsc/hydrateRscRenderMessage.ts +118 -0
- package/plugin/worker/rsc/messageHandler.tsx +1289 -56
- package/plugin/worker/rsc/rsc-worker.development.ts +198 -185
- package/plugin/worker/rsc/rsc-worker.production.ts +306 -21
- package/plugin/worker/rsc/rsc-worker.tsx +3 -5
- package/plugin/worker/rsc/state.ts +54 -2
- package/plugin/worker/rsc/types.ts +110 -32
- package/plugin/worker/rsc/workerUserOptions.ts +63 -0
- package/plugin/worker/sendMessage.ts +33 -53
- package/plugin/worker/types.ts +94 -91
- package/scripts/generate-toc.mjs +311 -0
- package/scripts/remove-toc.mjs +51 -0
- package/scripts/test-both.sh +82 -0
- package/dist/plugin/config/resolveDevServerConfig.d.ts +0 -2
- package/dist/plugin/config/resolveDevServerConfig.d.ts.map +0 -1
- package/dist/plugin/getNodeEnv.d.ts.map +0 -1
- package/dist/plugin/getNodeEnv.js +0 -17
- package/dist/plugin/helpers/collectBundleManifestCss.d.ts +0 -2
- package/dist/plugin/helpers/collectBundleManifestCss.d.ts.map +0 -1
- package/dist/plugin/helpers/collectBundleManifestCss.js +0 -2
- package/dist/plugin/helpers/createEventHandler.d.ts +0 -22
- package/dist/plugin/helpers/createEventHandler.d.ts.map +0 -1
- package/dist/plugin/helpers/createEventHandler.js +0 -36
- package/dist/plugin/helpers/createHandler.d.ts +0 -14
- package/dist/plugin/helpers/createHandler.d.ts.map +0 -1
- package/dist/plugin/helpers/createHandler.js +0 -75
- package/dist/plugin/helpers/createRscStream.d.ts +0 -26
- package/dist/plugin/helpers/createRscStream.d.ts.map +0 -1
- package/dist/plugin/helpers/createRscStream.js +0 -174
- package/dist/plugin/helpers/defaultFileWriter.d.ts +0 -2
- package/dist/plugin/helpers/defaultFileWriter.d.ts.map +0 -1
- package/dist/plugin/helpers/resolveComponents.d.ts +0 -27
- package/dist/plugin/helpers/resolveComponents.d.ts.map +0 -1
- package/dist/plugin/helpers/resolveComponents.js +0 -137
- package/dist/plugin/helpers/resolveUserComponents.d.ts +0 -33
- package/dist/plugin/helpers/resolveUserComponents.d.ts.map +0 -1
- package/dist/plugin/helpers/resolveUserComponents.js +0 -163
- 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 -134
- package/dist/plugin/react-client/cleanupWorkerServerAction.d.ts +0 -11
- package/dist/plugin/react-client/cleanupWorkerServerAction.d.ts.map +0 -1
- package/dist/plugin/react-client/cleanupWorkerServerAction.js +0 -18
- package/dist/plugin/react-client/configureWorkerRequestHandler.d.ts +0 -17
- package/dist/plugin/react-client/configureWorkerRequestHandler.d.ts.map +0 -1
- package/dist/plugin/react-client/configureWorkerRequestHandler.js +0 -209
- package/dist/plugin/react-client/createWorkerStream.d.ts +0 -26
- package/dist/plugin/react-client/createWorkerStream.d.ts.map +0 -1
- package/dist/plugin/react-client/createWorkerStream.js +0 -163
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts +0 -24
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts.map +0 -1
- package/dist/plugin/react-client/handleWorkerRscStream.js +0 -99
- package/dist/plugin/react-client/handleWorkerServerAction.d.ts +0 -13
- package/dist/plugin/react-client/handleWorkerServerAction.d.ts.map +0 -1
- package/dist/plugin/react-client/handleWorkerServerAction.js +0 -62
- package/dist/plugin/react-client/restartWorker.d.ts +0 -12
- package/dist/plugin/react-client/restartWorker.d.ts.map +0 -1
- package/dist/plugin/react-client/restartWorker.js +0 -70
- package/dist/plugin/react-server/configureReactServer.d.ts +0 -10
- package/dist/plugin/react-server/configureReactServer.d.ts.map +0 -1
- package/dist/plugin/react-server/configureReactServer.js +0 -205
- package/dist/plugin/react-server/handleServerAction.d.ts +0 -6
- package/dist/plugin/react-server/handleServerAction.d.ts.map +0 -1
- package/dist/plugin/react-server/handleServerAction.js +0 -159
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts +0 -25
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts.map +0 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.js +0 -94
- package/dist/plugin/react-static/streamHandler.d.ts +0 -2
- package/dist/plugin/react-static/streamHandler.d.ts.map +0 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts +0 -12
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts.map +0 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js +0 -130
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.d.ts +0 -3
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.d.ts.map +0 -1
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.js +0 -2
- package/dist/plugin/worker/rsc/handleRender.d.ts +0 -5
- package/dist/plugin/worker/rsc/handleRender.d.ts.map +0 -1
- package/dist/plugin/worker/rsc/handleRender.js +0 -140
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.d.ts +0 -3
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.d.ts.map +0 -1
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.js +0 -11
- package/dist/plugin/worker/rsc/userOptions.d.ts +0 -2
- package/dist/plugin/worker/rsc/userOptions.d.ts.map +0 -1
- package/dist/plugin/worker/rsc/userOptions.js +0 -16
- package/plugin/helpers/collectBundleManifestCss.ts +0 -1
- package/plugin/helpers/createEventHandler.ts +0 -44
- package/plugin/helpers/createHandler.ts +0 -97
- package/plugin/helpers/createRscStream.tsx +0 -221
- package/plugin/helpers/defaultFileWriter.ts +0 -0
- package/plugin/helpers/resolveComponents.ts +0 -185
- package/plugin/helpers/resolveUserComponents.ts +0 -190
- package/plugin/preserver/index.ts +0 -1
- package/plugin/preserver/plugin.ts +0 -178
- package/plugin/react-client/cleanupWorkerServerAction.ts +0 -33
- package/plugin/react-client/configureWorkerRequestHandler.ts +0 -255
- package/plugin/react-client/createWorkerStream.ts +0 -210
- package/plugin/react-client/handleWorkerRscStream.ts +0 -156
- package/plugin/react-client/handleWorkerServerAction.ts +0 -96
- package/plugin/react-client/restartWorker.ts +0 -91
- package/plugin/react-server/configureReactServer.ts +0 -231
- package/plugin/react-server/handleServerAction.ts +0 -192
- package/plugin/react-static/collectHtmlWorkerContent.ts +0 -147
- package/plugin/react-static/streamHandler.ts +0 -0
- package/plugin/worker/html/createHtmlWorkerRenderState.tsx +0 -142
- package/plugin/worker/html/sendHtmlWorkerMessage.ts +0 -8
- package/plugin/worker/rsc/handleRender.ts +0 -175
- package/plugin/worker/rsc/sendRscWorkerMessage.ts +0 -7
- package/plugin/worker/rsc/userOptions.ts +0 -7
- /package/dist/plugin/config/{resolveDevServerConfig.js → createHandlerOptions.types.js} +0 -0
- /package/dist/plugin/{helpers/defaultFileWriter.js → dev-server/types.js} +0 -0
- /package/dist/plugin/{react-static/streamHandler.js → error/types.js} +0 -0
- /package/plugin/{config/resolveDevServerConfig.tsx → worker/worker-handlers.server.ts} +0 -0
|
@@ -7,12 +7,60 @@ import { Worker } from 'node:worker_threads';
|
|
|
7
7
|
import { getNodePath, getMode } from '../config/getPaths.js';
|
|
8
8
|
import { getCondition } from '../config/getCondition.js';
|
|
9
9
|
import { join } from 'node:path';
|
|
10
|
+
import { existsSync } from 'node:fs';
|
|
10
11
|
import { pluginRoot } from '../root.js';
|
|
11
|
-
import * as React from 'react';
|
|
12
12
|
import { DEFAULT_CONFIG } from '../config/defaults.js';
|
|
13
13
|
import { createLogger } from 'vite';
|
|
14
|
+
import { handleError } from '../error/handleError.js';
|
|
14
15
|
import { toError } from '../error/toError.js';
|
|
15
16
|
|
|
17
|
+
const activeWorkers = /* @__PURE__ */ new Set();
|
|
18
|
+
async function shutdownAllWorkers(timeout = 1e3) {
|
|
19
|
+
if (activeWorkers.size === 0) return;
|
|
20
|
+
const shutdownPromises = Array.from(activeWorkers).map((worker) => {
|
|
21
|
+
return new Promise((resolve) => {
|
|
22
|
+
let messageHandler;
|
|
23
|
+
const timeoutId = setTimeout(() => {
|
|
24
|
+
worker.removeListener("message", messageHandler);
|
|
25
|
+
worker.removeAllListeners();
|
|
26
|
+
try {
|
|
27
|
+
worker.terminate();
|
|
28
|
+
} catch (error) {
|
|
29
|
+
}
|
|
30
|
+
activeWorkers.delete(worker);
|
|
31
|
+
resolve();
|
|
32
|
+
}, timeout);
|
|
33
|
+
messageHandler = (message) => {
|
|
34
|
+
if (message.type === "SHUTDOWN_COMPLETE") {
|
|
35
|
+
clearTimeout(timeoutId);
|
|
36
|
+
worker.removeListener("message", messageHandler);
|
|
37
|
+
worker.removeAllListeners();
|
|
38
|
+
activeWorkers.delete(worker);
|
|
39
|
+
resolve();
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
worker.on("message", messageHandler);
|
|
43
|
+
try {
|
|
44
|
+
worker.postMessage({
|
|
45
|
+
type: "SHUTDOWN",
|
|
46
|
+
id: "*"
|
|
47
|
+
});
|
|
48
|
+
} catch (error) {
|
|
49
|
+
clearTimeout(timeoutId);
|
|
50
|
+
worker.removeListener("message", messageHandler);
|
|
51
|
+
worker.removeAllListeners();
|
|
52
|
+
try {
|
|
53
|
+
worker.terminate();
|
|
54
|
+
} catch (terminateError) {
|
|
55
|
+
}
|
|
56
|
+
activeWorkers.delete(worker);
|
|
57
|
+
resolve();
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
});
|
|
61
|
+
await Promise.all(shutdownPromises);
|
|
62
|
+
activeWorkers.clear();
|
|
63
|
+
}
|
|
16
64
|
const createWorker = async function _createWorker(options) {
|
|
17
65
|
const {
|
|
18
66
|
projectRoot = process.cwd(),
|
|
@@ -35,64 +83,134 @@ const createWorker = async function _createWorker(options) {
|
|
|
35
83
|
const id = reverseCondition === "react-server" ? "worker/rsc" : "worker/html";
|
|
36
84
|
let workerPathWithDefault = typeof workerPath === "string" ? workerPath : void 0;
|
|
37
85
|
if (!workerPathWithDefault) {
|
|
38
|
-
|
|
86
|
+
const isProduction = mode === "production";
|
|
87
|
+
const workerFileName = reverseCondition === "react-server" ? `rsc-worker.${isProduction ? "production" : "development"}.js` : `html-worker.${isProduction ? "production" : "development"}.js`;
|
|
88
|
+
const sourcePath = join(pluginRoot, id, workerFileName);
|
|
89
|
+
if (verbose) {
|
|
90
|
+
logger.info(
|
|
91
|
+
`[create:${id}] Checking paths - Source: ${sourcePath}, PluginRoot: ${pluginRoot}`
|
|
92
|
+
);
|
|
93
|
+
}
|
|
94
|
+
if (!existsSync(sourcePath)) {
|
|
95
|
+
throw new Error(
|
|
96
|
+
`[create:${id}] Worker file doesn't exist: ${sourcePath}`
|
|
97
|
+
);
|
|
98
|
+
} else {
|
|
99
|
+
workerPathWithDefault = sourcePath;
|
|
100
|
+
if (verbose) {
|
|
101
|
+
logger.info(`[create:${id}] Using source worker path: ${sourcePath}`);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
39
104
|
}
|
|
40
105
|
if (!workerPathWithDefault.startsWith("/")) {
|
|
41
106
|
workerPathWithDefault = join("./", workerPathWithDefault);
|
|
42
107
|
}
|
|
43
108
|
const workerData = {
|
|
44
|
-
|
|
45
|
-
resolvedConfig: options.workerData.resolvedConfig,
|
|
46
|
-
reactVersion: options.workerData.reactVersion ?? React.version,
|
|
109
|
+
...options.workerData,
|
|
47
110
|
id: options.workerData.id ?? id
|
|
48
111
|
};
|
|
49
112
|
try {
|
|
50
|
-
|
|
51
|
-
|
|
113
|
+
if (verbose) {
|
|
114
|
+
logger.info(
|
|
115
|
+
`[create:${id}] workerData.userOptions.build:
|
|
116
|
+
${JSON.stringify(workerData.userOptions?.build)}
|
|
117
|
+
|
|
118
|
+
Call stack: ${new Error().stack?.split("\n").slice(1, 4).join("\n")}
|
|
119
|
+
Creating worker with path: ${workerPathWithDefault}
|
|
120
|
+
Node environment: ${mode}
|
|
121
|
+
Current condition: ${currentCondition}, Reverse condition: ${reverseCondition}`
|
|
122
|
+
);
|
|
123
|
+
}
|
|
124
|
+
const stripConditionsFromArgv = (argv) => {
|
|
125
|
+
const out = [];
|
|
126
|
+
for (let i = 0; i < argv.length; i++) {
|
|
127
|
+
const arg = argv[i];
|
|
128
|
+
if (arg === "--conditions" || arg === "-C") {
|
|
129
|
+
i++;
|
|
130
|
+
continue;
|
|
131
|
+
}
|
|
132
|
+
if (arg.startsWith("--conditions=")) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
out.push(arg);
|
|
136
|
+
}
|
|
137
|
+
return out;
|
|
138
|
+
};
|
|
139
|
+
const computedExecArgv = [
|
|
140
|
+
...stripConditionsFromArgv(process.execArgv || []),
|
|
141
|
+
"--conditions",
|
|
142
|
+
reverseCondition
|
|
143
|
+
];
|
|
144
|
+
if (verbose) {
|
|
145
|
+
logger.info(
|
|
146
|
+
`[create:${id}] Setting up worker with reverse condition: ${reverseCondition}`
|
|
147
|
+
);
|
|
148
|
+
logger.info(
|
|
149
|
+
`[create:${id}] Computed execArgv: ${JSON.stringify(computedExecArgv)}`
|
|
150
|
+
);
|
|
151
|
+
logger.info(
|
|
152
|
+
`[create:${id}] Current NODE_OPTIONS: ${process.env["NODE_OPTIONS"]}`
|
|
153
|
+
);
|
|
154
|
+
}
|
|
52
155
|
const env = {
|
|
156
|
+
// Inherit all existing environment variables
|
|
157
|
+
...process.env,
|
|
158
|
+
// Override with our specific variables
|
|
53
159
|
[envPrefix + "DEV"]: mode === "development" ? "1" : "0",
|
|
54
160
|
[envPrefix + "MODE"]: mode,
|
|
55
161
|
[envPrefix + "PROD"]: mode === "production" ? "1" : "0",
|
|
56
162
|
[envPrefix + "SSR"]: "true",
|
|
57
|
-
[envPrefix + "BASE_URL"]: workerData.userOptions
|
|
58
|
-
[envPrefix + "PUBLIC_ORIGIN"]: workerData.userOptions
|
|
59
|
-
NODE_ENV:
|
|
163
|
+
[envPrefix + "BASE_URL"]: workerData.userOptions?.moduleBaseURL ?? "",
|
|
164
|
+
[envPrefix + "PUBLIC_ORIGIN"]: workerData.userOptions?.publicOrigin ?? "",
|
|
165
|
+
NODE_ENV: process.env["NODE_ENV"] ?? "production",
|
|
60
166
|
NODE_PATH: nodePath,
|
|
61
|
-
|
|
167
|
+
// Ensure NODE_OPTIONS has the correct condition
|
|
168
|
+
NODE_OPTIONS: process.env["NODE_OPTIONS"]?.includes(reverseCondition) ? process.env["NODE_OPTIONS"] : currentCondition != null && process.env["NODE_OPTIONS"]?.includes(currentCondition) ? process.env["NODE_OPTIONS"]?.replaceAll(
|
|
62
169
|
currentCondition,
|
|
63
170
|
reverseCondition
|
|
64
171
|
) : `${process.env["NODE_OPTIONS"] ?? ""} --conditions ${reverseCondition}`,
|
|
65
172
|
HTML_CHUNK_SIZE: htmlChunkSize.toString()
|
|
66
173
|
};
|
|
174
|
+
if (verbose) {
|
|
175
|
+
logger.info(
|
|
176
|
+
`[create:${id}] Worker NODE_OPTIONS will be: ${env.NODE_OPTIONS}`
|
|
177
|
+
);
|
|
178
|
+
logger.info(
|
|
179
|
+
`[create:${id}] Environment variables: ${Object.keys(env).join(", ")}`
|
|
180
|
+
);
|
|
181
|
+
logger.info(`[create:${id}] execArgv: ${computedExecArgv.join(" ")}`);
|
|
182
|
+
}
|
|
67
183
|
const worker = new Worker(workerPathWithDefault, {
|
|
68
184
|
env,
|
|
185
|
+
execArgv: computedExecArgv,
|
|
69
186
|
resourceLimits,
|
|
70
187
|
workerData,
|
|
71
188
|
transferList
|
|
72
189
|
});
|
|
190
|
+
activeWorkers.add(worker);
|
|
73
191
|
worker.setMaxListeners(maxListeners);
|
|
192
|
+
if (verbose) {
|
|
193
|
+
logger.info(
|
|
194
|
+
`[create:${id}] Worker created, waiting for READY message...`
|
|
195
|
+
);
|
|
196
|
+
}
|
|
74
197
|
return await new Promise(
|
|
75
198
|
(resolve, reject) => {
|
|
76
199
|
const workerType = reverseCondition === "react-server" ? "rsc" : "html";
|
|
77
|
-
const startupTimeout = workerType === "rsc" ? options.workerData.userOptions
|
|
200
|
+
const startupTimeout = workerType === "rsc" ? options.workerData.userOptions?.rscWorkerStartupTimeout : options.workerData.userOptions?.htmlWorkerStartupTimeout;
|
|
78
201
|
const timeout = setTimeout(() => {
|
|
79
202
|
reject({ type: "error", error: new Error("Worker ready timeout") });
|
|
80
203
|
}, startupTimeout);
|
|
81
204
|
const exitHandler = (code) => {
|
|
82
205
|
clearTimeout(timeout);
|
|
83
206
|
worker.removeListener("message", messageHandler);
|
|
84
|
-
|
|
85
|
-
if (code
|
|
86
|
-
|
|
87
|
-
type: "
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
} else {
|
|
92
|
-
const error = `[create:${id}] exited with code ${code}`;
|
|
93
|
-
resolve({
|
|
94
|
-
type: "skip",
|
|
95
|
-
reason: error,
|
|
207
|
+
activeWorkers.delete(worker);
|
|
208
|
+
if (code !== 0) {
|
|
209
|
+
reject({
|
|
210
|
+
type: "error",
|
|
211
|
+
error: new Error(
|
|
212
|
+
`[create:${id}] Worker exited with code ${code}`
|
|
213
|
+
),
|
|
96
214
|
workerPath: workerPathWithDefault
|
|
97
215
|
});
|
|
98
216
|
}
|
|
@@ -100,19 +218,19 @@ const createWorker = async function _createWorker(options) {
|
|
|
100
218
|
const messageHandler = (msg) => {
|
|
101
219
|
if (verbose)
|
|
102
220
|
logger.info(`[create:${id}] Initial worker message ${msg.type}`);
|
|
103
|
-
if (msg.type === "READY") {
|
|
221
|
+
if (msg.type === "READY" && msg.id === id) {
|
|
104
222
|
if (verbose)
|
|
105
223
|
logger.info(`[create:${id}] Worker running for ${msg.env}`);
|
|
106
224
|
clearTimeout(timeout);
|
|
107
225
|
worker.removeListener("message", messageHandler);
|
|
108
226
|
worker.removeListener("exit", exitHandler);
|
|
109
|
-
if (msg.env !==
|
|
227
|
+
if (msg.env !== mode) {
|
|
110
228
|
if (verbose)
|
|
111
229
|
logger.info(`[create:${id}] Worker environment mismatch.`);
|
|
112
230
|
reject({
|
|
113
231
|
type: "error",
|
|
114
232
|
error: new Error(
|
|
115
|
-
`Worker environment mismatch: ${msg.env} !== ${
|
|
233
|
+
`Worker environment mismatch: ${msg.env} !== ${mode}`
|
|
116
234
|
),
|
|
117
235
|
workerPath: workerPathWithDefault
|
|
118
236
|
});
|
|
@@ -126,16 +244,75 @@ const createWorker = async function _createWorker(options) {
|
|
|
126
244
|
};
|
|
127
245
|
worker.once("message", messageHandler);
|
|
128
246
|
worker.once("exit", exitHandler);
|
|
247
|
+
worker.on("error", (err) => {
|
|
248
|
+
activeWorkers.delete(worker);
|
|
249
|
+
if (verbose && err != null) {
|
|
250
|
+
logger.error(
|
|
251
|
+
`[create:${id}] Worker error: ${err.message}.
|
|
252
|
+
${err.stack}`,
|
|
253
|
+
{ error: err }
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
const panicError = handleError({
|
|
257
|
+
error: err,
|
|
258
|
+
logger,
|
|
259
|
+
panicThreshold: workerData.userOptions?.panicThreshold,
|
|
260
|
+
critical: false,
|
|
261
|
+
context: `Worker thread error for route ${id}`
|
|
262
|
+
});
|
|
263
|
+
if (panicError != null) {
|
|
264
|
+
if (verbose) {
|
|
265
|
+
logger.error(
|
|
266
|
+
`[create:${id}] Panic error detected: ${panicError.message}`,
|
|
267
|
+
{ error: panicError }
|
|
268
|
+
);
|
|
269
|
+
}
|
|
270
|
+
reject({
|
|
271
|
+
type: "error",
|
|
272
|
+
error: err,
|
|
273
|
+
workerPath: workerPathWithDefault
|
|
274
|
+
});
|
|
275
|
+
}
|
|
276
|
+
reject({
|
|
277
|
+
type: "error",
|
|
278
|
+
error: new Error("Worker thread error", { cause: err }),
|
|
279
|
+
workerPath: workerPathWithDefault
|
|
280
|
+
});
|
|
281
|
+
});
|
|
129
282
|
}
|
|
130
283
|
);
|
|
131
284
|
} catch (error) {
|
|
285
|
+
if (verbose) {
|
|
286
|
+
logger.error(
|
|
287
|
+
`[create:${id}] Caught error during worker creation: ${toError(error).message}`,
|
|
288
|
+
{ error: error instanceof Error ? error : new Error(String(error)) }
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
const panicError = handleError({
|
|
292
|
+
error,
|
|
293
|
+
logger,
|
|
294
|
+
panicThreshold: workerData.userOptions?.panicThreshold,
|
|
295
|
+
critical: false});
|
|
296
|
+
if (panicError != null) {
|
|
297
|
+
if (verbose) {
|
|
298
|
+
logger.error(
|
|
299
|
+
`[create:${id}] Panic error in catch block: ${panicError.message}`,
|
|
300
|
+
{ error: panicError }
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
return {
|
|
304
|
+
type: "error",
|
|
305
|
+
error: panicError,
|
|
306
|
+
workerPath: workerPathWithDefault
|
|
307
|
+
};
|
|
308
|
+
}
|
|
132
309
|
return {
|
|
133
310
|
type: "error",
|
|
134
|
-
error:
|
|
311
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
135
312
|
workerPath: workerPathWithDefault
|
|
136
313
|
};
|
|
137
314
|
}
|
|
138
315
|
};
|
|
139
316
|
|
|
140
|
-
export { createWorker };
|
|
141
|
-
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY3JlYXRlV29ya2VyLmpzIiwic291cmNlcyI6W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AgICAgICAgICAgIHJlc29sdmUoe1xuICAgICAgICAgICAgICB0eXBlOiBcInNraXBcIixcbiAgICAgICAgICAgICAgcmVhc29uOiBcIldvcmtlciBleGl0ZWQgd2l0aCBjb2RlIDBcIixcbiAgICAgICAgICAgICAgd29ya2VyUGF0aDogd29ya2VyUGF0aFdpdGhEZWZhdWx0LFxuICAgICAgICAgICAgfSBzYXRpc2ZpZXMgQ3JlYXRlV29ya2VyU2tpcCk7XG4gICAgICAgICAgfSBlbHNlIHtcbiAgICAgICAgICAgIGNvbnN0IGVycm9yID0gYFtjcmVhdGU6JHtpZH1dIGV4aXRlZCB3aXRoIGNvZGUgJHtjb2RlfWA7XG4gICAgICAgICAgICByZXNvbHZlKHtcbiAgICAgICAgICAgICAgdHlwZTogXCJza2lwXCIsXG4gICAgICAgICAgICAgIHJlYXNvbjogZXJyb3IsXG4gICAgICAgICAgICAgIHdvcmtlclBhdGg6IHdvcmtlclBhdGhXaXRoRGVmYXVsdCxcbiAgICAgICAgICAgIH0gc2F0aXNmaWVzIENyZWF0ZVdvcmtlclNraXApO1xuICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgY29uc3QgbWVzc2FnZUhhbmRsZXIgPSAoXG4gICAgICAgICAgbXNnOiBIdG1sV29ya2VyT3V0cHV0TWVzc2FnZSB8IFJzY1dvcmtlck91dHB1dE1lc3NhZ2VcbiAgICAgICAgKSA9PiB7XG4gICAgICAgICAgaWYgKHZlcmJvc2UpXG4gICAgICAgICAgICBsb2dnZXIuaW5mbyhgW2NyZWF0ZToke2lkfV0gSW5pdGlhbCB3b3JrZXIgbWVzc2FnZSAke21zZy50eXBlfWApO1xuICAgICAgICAgIGlmIChtc2cudHlwZSA9PT0gXCJSRUFEWVwiKSB7XG4gICAgICAgICAgICBpZiAodmVyYm9zZSlcbiAgICAgICAgICAgICAgbG9nZ2VyLmluZm8oYFtjcmVhdGU6JHtpZH1dIFdvcmtlciBydW5uaW5nIGZvciAke21zZy5lbnZ9YCk7XG4gICAgICAgICAgICBjbGVhclRpbWVvdXQodGltZW91dCk7XG4gICAgICAgICAgICB3b3JrZXIucmVtb3ZlTGlzdGVuZXIoXCJtZXNzYWdlXCIsIG1lc3NhZ2VIYW5kbGVyKTtcbiAgICAgICAgICAgIHdvcmtlci5yZW1vdmVMaXN0ZW5lcihcImV4aXRcIiwgZXhpdEhhbmRsZXIpO1xuICAgICAgICAgICAgaWYgKG1zZy5lbnYgIT09IG5vZGVFbnYpIHtcbiAgICAgICAgICAgICAgaWYgKHZlcmJvc2UpXG4gICAgICAgICAgICAgICAgbG9nZ2VyLmluZm8oYFtjcmVhdGU6JHtpZH1dIFdvcmtlciBlbnZpcm9ubWVudCBtaXNtYXRjaC5gKTtcbiAgICAgICAgICAgICAgcmVqZWN0KHtcbiAgICAgICAgICAgICAgICB0eXBlOiBcImVycm9yXCIsXG4gICAgICAgICAgICAgICAgZXJyb3I6IG5ldyBFcnJvcihcbiAgICAgICAgICAgICAgICAgIGBXb3JrZXIgZW52aXJvbm1lbnQgbWlzbWF0Y2g6ICR7bXNnLmVudn0gIT09ICR7bm9kZUVudn1gXG4gICAgICAgICAgICAgICAgKSxcbiAgICAgICAgICAgICAgICB3b3JrZXJQYXRoOiB3b3JrZXJQYXRoV2l0aERlZmF1bHQsXG4gICAgICAgICAgICAgIH0gc2F0aXNmaWVzIENyZWF0ZVdvcmtlckVycm9yKTtcbiAgICAgICAgICAgIH1cbiAgICAgICAgICAgIHJlc29sdmUoe1xuICAgICAgICAgICAgICB0eXBlOiBcInN1Y2Nlc3NcIixcbiAgICAgICAgICAgICAgd29ya2VyLFxuICAgICAgICAgICAgICB3b3JrZXJQYXRoOiB3b3JrZXJQYXRoV2l0aERlZmF1bHQsXG4gICAgICAgICAgICB9IHNhdGlzZmllcyBDcmVhdGVXb3JrZXJTdWNjZXNzKTtcbiAgICAgICAgICB9XG4gICAgICAgIH07XG4gICAgICAgIHdvcmtlci5vbmNlKFwibWVzc2FnZVwiLCBtZXNzY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HJ1bm5pbmcgZm9yICR7bXNnLmVudn1gKTtcbiAgICAgICAgICAgIGNsZWFyVGltZW91dCh0aW1lb3V0KTtcbiAgICAgICAgICAgIHdvcmtlci5yZW1vdmVMaXN0ZW5lcihcIm1lc3NhZ2VcIiwgbWVzc2FnZUhhbmRsZXIpO1xuICAgICAgICAgICAgd29ya2VyLnJlbW92ZUxpc3RlbmVyKFwiZXhpdFwiLCBleGl0SGFuZGxlcik7XG4gICAgICAgICAgICBpZiAobXNnLmVudiAhPT0gbW9kZSkge1xuICAgICAgICAgICAgICBpZiAodmVyYm9zZSlcbiAgICAgICAgICAgICAgICBsb2dnZXIuaW5mbyhgW2NyZWF0ZToke2lkfV0gV29ya2VyIGVudmlyb25tZW50IG1pc21hdGNoLmApO1xuICAgICAgICAgICAgICByZWplY3Qoe1xuICAgICAgICAgICAgICAgIHR5cGU6IFwiZXJyb3JcIixcbiAgICAgICAgICAgICAgICBlcnJvcjogbmV3IEVycm9yKFxuICAgICAgICAgICAgICAgICAgYFdvcmtlciBlbnZpcm9ubWVudCBtaXNtYXRjaDogJHttc2cuZW52fSAhPT0gJHttb2RlfWBcbiAgICAgICAgICAgICAgICApLFxuICAgICAgICAgICAgICAgIHdvcmtlclBhdGg6IHdvcmtlclBhdGhXaXRoRGVmYXVsdCxcbiAgICAgICAgICAgICAgfSBzYXRpc2ZpZXMgQ3JlYXRlV29ya2VyRXJyb3IpO1xuICAgICAgICAgICAgfVxuICAgICAgICAgICAgcmVzb2x2ZSh7XG4gICAgICAgICAgICAgIHR5cGU6IFwic3VjY2Vzc1wiLFxuICAgICAgICAgICAgICB3b3JrZXIsXG4gICAgICAgICAgICAgIHdvcmtlclBhdGg6IHdvcmtlclBhdGhXaXRoRGVmYXVsdCxcbiAgICAgICAgICAgIH0gc2F0aXNmaWVzIENyZWF0ZVdvcmtlclN1Y2Nlc3MpO1xuICAgICAgICAgIH1cbiAgICAgICAgfTtcbiAgICAgICAgd29ya2VyLm9uY2UoXCJtZXNzYWdlXCIsIG1lc3NhZ2VIYW5kbGVyKTtcbiAgICAgICAgd29ya2VyLm9uY2UoXCJleGl0XCIsIGV4aXRIYW5kbGVyKTtcbiAgICAgICAgd29ya2VyLm9uKFwiZXJyb3JcIiwgKGVycikgPT4ge1xuICAgICAgICAgIC8vIFJlbW92ZSB3b3JrZXIgZnJvbSByZWdpc3RyeSBvbiBlcnJvclxuICAgICAgICAgIGFjdGl2ZVdvcmtlcnMuZGVsZXRlKHdvcmtlcik7XG4gICAgICAgICAgXG4gICAgICAgICAgaWYgKHZlcmJvc2UgJiYgZXJyICE9IG51bGwpIHtcbiAgICAgICAgICAgIGxvZ2dlci5lcnJvcihcbiAgICAgICAgICAgICAgYFtjcmVhdGU6JHtpZH1dIFdvcmtlciBlcnJvcjogJHtlcnIubWVzc2FnZX0uXFxuJHtlcnIuc3RhY2t9YCxcbiAgICAgICAgICAgICAgeyBlcnJvcjogZXJyIH1cbiAgICAgICAgICAgICk7XG4gICAgICAgICAgfVxuICAgICAgICAgIGNvbnN0IHBhbmljRXJyb3IgPSBoYW5kbGVFcnJvcih7XG4gICAgICAgICAgICBlcnJvcjogZXJyLFxuICAgICAgICAgICAgbG9nZ2VyOiBsb2dnZXIsXG4gICAgICAgICAgICBwYW5pY1RocmVzaG9sZDogd29ya2VyRGF0YS51c2VyT3B0aW9ucz8ucGFuaWNUaHJlc2hvbGQsXG4gICAgICAgICAgICBjcml0aWNhbDogZmFsc2UsXG4gICAgICAgICAgICBjb250ZXh0OiBgV29ya2VyIHRocmVhZCBlcnJvciBmb3Igcm91dGUgJHtpZH1gLFxuICAgICAgICAgIH0pO1xuICAgICAgICAgIGlmIChwYW5pY0Vycm9yICE9IG51bGwpIHtcbiAgICAgICAgICAgIGlmICh2ZXJib3NlKSB7XG4gICAgICAgICAgICAgIGxvZ2dlci5lcnJvcihcbiAgICAgICAgICAgICAgICBgW2NyZWF0ZToke2lkfV0gUGFuaWMgZXJyb3IgZGV0ZWN0ZWQ6ICR7cGFuaWNFcnJvci5tZXNzYWdlfWAsXG4gICAgICAgICAgICAgICAgeyBlcnJvcjogcGFuaWNFcnJvciB9XG4gICAgICAgICAgICAgICk7XG4gICAgICAgICAgICB9XG4gICAgICAgICAgICByZWplY3Qoe1xuICAgICAgICAgICAgICB0eXBlOiBcImVycm9yXCIsXG4gICAgICAgICAgICAgIGVycm9yOiBlcnIsXG4gICAgICAgICAgICAgIHdvcmtlclBhdGg6IHdvcmtlclBhdGhXaXRoRGVmYXVsdCxcbiAgICAgICAgICAgIH0pO1xuICAgICAgICAgIH1cbiAgICAgICAgICByZWplY3Qoe1xuICAgICAgICAgICAgdHlwZTogXCJlcnJvclwiLFxuICAgICAgICAgICAgZXJyb3I6IG5ldyBFcnJvcihcIldvcmtlciB0aHJlYWQgZXJyb3JcIiwgeyBjYXVzZTogZXJyIH0pLFxuICAgICAgICAgICAgd29ya2VyUGF0aDogd29ya2VyUGF0aFdpdGhEZWZhdWx0LFxuICAgICAgICAgIH0pO1xuICAgICAgICB9KTtcbiAgICAgIH1cbiAgICApO1xuICB9IGNhdGNoIChlcnJvcikge1xuICAgIGlmICh2ZXJib3NlKSB7XG4gICAgICBsb2dnZXIuZXJyb3IoXG4gICAgICAgIGBbY3JlYXRlOiR7aWR9XSBDYXVnaHQgZXJyb3IgZHVyaW5nIHdvcmtlciBjcmVhdGlvbjogJHtcbiAgICAgICAgICB0b0Vycm9yKGVycm9yKS5tZXNzYWdlXG4gICAgICAgIH1gLFxuICAgICAgICB7IGVycm9yOiBlcnJvciBpbnN0YW5jZW9mIEVycm9yID8gZXJyb3IgOiBuZXcgRXJyb3IoU3RyaW5nKGVycm9yKSkgfVxuICAgICAgKTtcbiAgICB9XG4gICAgY29uc3QgcGFuaWNFcnJvciA9IGhhbmRsZUVycm9yKHtcbiAgICAgIGVycm9yOiBlcnJvcixcbiAgICAgIGxvZ2dlcjogbG9nZ2VyLFxuICAgICAgcGFuaWNUaHJlc2hvbGQ6IHdvcmtlckRhdGEudXNlck9wd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es directly.
|
|
4
|
+
*
|
|
5
|
+
* This html render expects all components as a serialized rsc stream.
|
|
6
|
+
*
|
|
7
|
+
* It does not have to resolve components, it just renders the html.
|
|
8
|
+
*
|
|
9
|
+
* @param handlerOptions
|
|
10
|
+
* @param handlers
|
|
11
|
+
* @param logger
|
|
12
|
+
*/
|
|
13
|
+
export declare const handleHtmlRender: HandleHtmlRenderFn;
|
|
14
|
+
//# sourceMappingURL=handleHtmlRender.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleHtmlRender.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/html/handleHtmlRender.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,YAAY,CAAC;AAWrD;;;;;;;;;;GAUG;AACH,eAAO,MAAM,gBAAgB,EAAE,kBA2N9B,CAAC"}
|
|
@@ -0,0 +1,190 @@
|
|
|
1
|
+
import { workerData } from "node:worker_threads";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
import { handleError } from "../../error/handleError.js";
|
|
4
|
+
import { assertNonReactServer } from "../../config/getCondition.js";
|
|
5
|
+
// Import React DOM Client for RSC stream processing
|
|
6
|
+
import { createFromNodeStream } from "../../stream/createFromNodeStream.client.js";
|
|
7
|
+
import { createModuleResolutionMetrics } from "../../metrics/createModuleResolutionMetrics.js";
|
|
8
|
+
import { ReactDOMServer } from "../../vendor/vendor.client.js";
|
|
9
|
+
assertNonReactServer();
|
|
10
|
+
/**
|
|
11
|
+
* Handle the render of an HTML stream from RSC chunks, creates the stream once and pipes directly.
|
|
12
|
+
*
|
|
13
|
+
* This html render expects all components as a serialized rsc stream.
|
|
14
|
+
*
|
|
15
|
+
* It does not have to resolve components, it just renders the html.
|
|
16
|
+
*
|
|
17
|
+
* @param handlerOptions
|
|
18
|
+
* @param handlers
|
|
19
|
+
* @param logger
|
|
20
|
+
*/
|
|
21
|
+
export const handleHtmlRender = function _handleHtmlRender(handlerOptions, handlers) {
|
|
22
|
+
const { route, id = route, rscStream, // Use the RSC stream id passed from the main thread
|
|
23
|
+
moduleRootPath, moduleBaseURL, moduleBasePath, verbose, logger, projectRoot, } = handlerOptions;
|
|
24
|
+
try {
|
|
25
|
+
if (verbose) {
|
|
26
|
+
logger.info(`[html-worker:${route}] Creating HTML stream (${id})`);
|
|
27
|
+
}
|
|
28
|
+
if (!rscStream) {
|
|
29
|
+
throw new Error("RSC stream is required for HTML rendering");
|
|
30
|
+
}
|
|
31
|
+
// Convert RSC stream to React elements using ReactDOMClient.createFromNodeStream
|
|
32
|
+
//
|
|
33
|
+
// IMPORTANT: ReactDOMClient comes from react-server-dom-esm/client.node
|
|
34
|
+
// We have reverse-engineered our own types for this (plugin/types/react-server-dom-esm.d.ts)
|
|
35
|
+
// because there's no official @types package for react-server-dom-esm
|
|
36
|
+
//
|
|
37
|
+
// ACTUAL SIGNATURE FROM SOURCE CODE (patches/react-server-dom-esm+0.0.1.patch:9437):
|
|
38
|
+
// exports.createFromNodeStream = function (stream, moduleRootPath, moduleBaseURL, options)
|
|
39
|
+
//
|
|
40
|
+
// This takes 4 parameters:
|
|
41
|
+
// 1. stream: NodeJS.ReadableStream - the RSC stream
|
|
42
|
+
// 2. moduleRootPath: string - the module root path for resolving client modules
|
|
43
|
+
// 3. moduleBaseURL: string - the module base URL for resolving client modules
|
|
44
|
+
// 4. options: object - optional configuration (encodeFormAction, nonce, etc.)
|
|
45
|
+
// Construct the correct moduleRootPath using the projectRoot + moduleBasePath
|
|
46
|
+
let resolvedModuleRootPath = moduleRootPath || "";
|
|
47
|
+
if (typeof resolvedModuleRootPath !== "string") {
|
|
48
|
+
throw new Error("moduleRootPath is required");
|
|
49
|
+
}
|
|
50
|
+
else if (!resolvedModuleRootPath.startsWith(projectRoot)) {
|
|
51
|
+
resolvedModuleRootPath = join(projectRoot, resolvedModuleRootPath);
|
|
52
|
+
}
|
|
53
|
+
if (!resolvedModuleRootPath.endsWith(moduleBasePath)) {
|
|
54
|
+
resolvedModuleRootPath = resolvedModuleRootPath + moduleBasePath;
|
|
55
|
+
}
|
|
56
|
+
if (moduleBasePath === "" && !resolvedModuleRootPath.endsWith("/")) {
|
|
57
|
+
resolvedModuleRootPath = `${resolvedModuleRootPath}/`;
|
|
58
|
+
}
|
|
59
|
+
if (verbose) {
|
|
60
|
+
logger.info(`[html-worker:${route}] Final resolvedModuleRootPath: ${resolvedModuleRootPath}`);
|
|
61
|
+
}
|
|
62
|
+
// Start measuring module resolution time
|
|
63
|
+
const moduleResolutionStartTime = performance.now();
|
|
64
|
+
// Note: Module resolution metric will be emitted in onAllReady callback
|
|
65
|
+
if (verbose) {
|
|
66
|
+
logger.info(`[html-worker:${route}] Starting HTML render for route: ${route}`);
|
|
67
|
+
}
|
|
68
|
+
if (!rscStream.readable) {
|
|
69
|
+
throw new Error("RSC stream is not readable");
|
|
70
|
+
}
|
|
71
|
+
// Convert RSC stream to React elements using createFromNodeStream (like client-side)
|
|
72
|
+
const result = createFromNodeStream({
|
|
73
|
+
rscStream: rscStream,
|
|
74
|
+
moduleRootPath: resolvedModuleRootPath,
|
|
75
|
+
moduleBasePath: moduleBasePath,
|
|
76
|
+
moduleBaseURL: moduleBaseURL,
|
|
77
|
+
logger,
|
|
78
|
+
});
|
|
79
|
+
const mergedPipeableStreamOptions = {
|
|
80
|
+
...workerData.userOptions?.clientPipeableStreamOptions,
|
|
81
|
+
...handlerOptions.clientPipeableStreamOptions,
|
|
82
|
+
};
|
|
83
|
+
// Render React elements to HTML stream using ReactDOMServer.renderToPipeableStream
|
|
84
|
+
if (verbose) {
|
|
85
|
+
logger.info(`[html-worker:${route}] clientPipeableStreamOptions: ${JSON.stringify(mergedPipeableStreamOptions)}`);
|
|
86
|
+
}
|
|
87
|
+
// Create the stream once and pipe directly with onData
|
|
88
|
+
const { pipe } = ReactDOMServer.renderToPipeableStream(result.children, {
|
|
89
|
+
...mergedPipeableStreamOptions,
|
|
90
|
+
onShellReady() {
|
|
91
|
+
if (verbose) {
|
|
92
|
+
logger.info(`[html-worker:${route}] Shell ready, starting to pipe HTML`);
|
|
93
|
+
}
|
|
94
|
+
if (handlers.onShellReady) {
|
|
95
|
+
handlers.onShellReady(route);
|
|
96
|
+
}
|
|
97
|
+
if (mergedPipeableStreamOptions?.onShellReady) {
|
|
98
|
+
mergedPipeableStreamOptions.onShellReady();
|
|
99
|
+
}
|
|
100
|
+
},
|
|
101
|
+
onAllReady() {
|
|
102
|
+
if (verbose) {
|
|
103
|
+
logger.info(`[html-worker:${route}] All ready, HTML rendering complete`);
|
|
104
|
+
}
|
|
105
|
+
// Calculate module resolution time
|
|
106
|
+
const moduleResolutionTime = performance.now() - moduleResolutionStartTime;
|
|
107
|
+
// Send metrics
|
|
108
|
+
if (handlers.onMetrics) {
|
|
109
|
+
const moduleResolutionMetric = createModuleResolutionMetrics({
|
|
110
|
+
route,
|
|
111
|
+
workerType: "html",
|
|
112
|
+
resolutionTime: moduleResolutionTime,
|
|
113
|
+
fromMainThread: false,
|
|
114
|
+
fromRscWorker: false,
|
|
115
|
+
fromHtmlWorker: true,
|
|
116
|
+
description: `Module resolution for route ${route}`,
|
|
117
|
+
});
|
|
118
|
+
handlers.onMetrics(route, moduleResolutionMetric);
|
|
119
|
+
}
|
|
120
|
+
if (handlers.onAllReady) {
|
|
121
|
+
handlers.onAllReady(route);
|
|
122
|
+
}
|
|
123
|
+
if (mergedPipeableStreamOptions?.onAllReady) {
|
|
124
|
+
mergedPipeableStreamOptions.onAllReady();
|
|
125
|
+
}
|
|
126
|
+
},
|
|
127
|
+
onError(error, errorInfo) {
|
|
128
|
+
if (verbose) {
|
|
129
|
+
logger.error(`[html-worker:${route}] React rendering error: ${error}`);
|
|
130
|
+
}
|
|
131
|
+
handlers.onError(route, error, errorInfo);
|
|
132
|
+
if (handlers.onError) {
|
|
133
|
+
handlers.onError(route, error, errorInfo);
|
|
134
|
+
}
|
|
135
|
+
if (mergedPipeableStreamOptions?.onError) {
|
|
136
|
+
mergedPipeableStreamOptions.onError(error, errorInfo);
|
|
137
|
+
}
|
|
138
|
+
},
|
|
139
|
+
});
|
|
140
|
+
// Create a custom writable stream that pipes directly to onData
|
|
141
|
+
const customWritable = {
|
|
142
|
+
write(chunk, _encoding, callback) {
|
|
143
|
+
handlers.onData(id, chunk);
|
|
144
|
+
if (callback)
|
|
145
|
+
callback();
|
|
146
|
+
},
|
|
147
|
+
end(chunk, _encoding, callback) {
|
|
148
|
+
if (chunk) {
|
|
149
|
+
handlers.onData(id, chunk);
|
|
150
|
+
}
|
|
151
|
+
handlers.onEnd(id);
|
|
152
|
+
if (callback)
|
|
153
|
+
callback();
|
|
154
|
+
},
|
|
155
|
+
on() { }, // No-op for event listeners
|
|
156
|
+
once() { }, // No-op for event listeners
|
|
157
|
+
emit() { return false; }, // No-op for event emitters
|
|
158
|
+
};
|
|
159
|
+
// Pipe the React stream directly to our custom writable
|
|
160
|
+
pipe(customWritable);
|
|
161
|
+
// Set up RSC stream error handling
|
|
162
|
+
rscStream.on("error", (error) => {
|
|
163
|
+
if (verbose) {
|
|
164
|
+
logger.error(`[html-worker:${route}] RSC stream error: ${error}`);
|
|
165
|
+
}
|
|
166
|
+
handlers.onError(id, error, {
|
|
167
|
+
componentStack: undefined,
|
|
168
|
+
digest: undefined,
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
}
|
|
172
|
+
catch (error) {
|
|
173
|
+
if (verbose) {
|
|
174
|
+
logger.error(`[html-worker:${route}] Error in handleHtmlRender: ${error}`);
|
|
175
|
+
}
|
|
176
|
+
const panicError = handleError({
|
|
177
|
+
error: error,
|
|
178
|
+
logger: logger,
|
|
179
|
+
panicThreshold: workerData.userOptions?.panicThreshold,
|
|
180
|
+
context: `HTML worker error for route ${route}`,
|
|
181
|
+
});
|
|
182
|
+
if (panicError != null) {
|
|
183
|
+
handlers.onError(id, panicError, {
|
|
184
|
+
componentStack: undefined,
|
|
185
|
+
digest: undefined,
|
|
186
|
+
});
|
|
187
|
+
}
|
|
188
|
+
throw error;
|
|
189
|
+
}
|
|
190
|
+
};
|