vite-plugin-react-server 1.1.20 → 1.2.0-alpha.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +95 -396
- package/dist/_virtual/dynamic-import-helper.js +1 -1
- package/dist/client.d.ts +2 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +6 -2
- package/dist/index.js +1 -1
- package/dist/package.json +58 -25
- package/dist/plugin/components/{css-collector-elements.d.ts → css.d.ts} +2 -2
- package/dist/plugin/components/css.d.ts.map +1 -0
- package/dist/plugin/components/css.js +33 -0
- package/dist/plugin/components/html.d.ts +1 -1
- package/dist/plugin/components/html.d.ts.map +1 -1
- package/dist/plugin/components/html.js +5 -5
- package/dist/plugin/components/index.d.ts +3 -3
- package/dist/plugin/components/index.d.ts.map +1 -1
- package/dist/plugin/components/index.js +9 -3
- package/dist/plugin/components/root.d.ts +7 -0
- package/dist/plugin/components/root.d.ts.map +1 -0
- package/dist/plugin/components/root.js +18 -0
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js +1 -1
- package/dist/plugin/config/autoDiscover/customWorkerFiles.js +1 -1
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts +5 -4
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js +26 -7
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts +25 -2
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js +84 -5
- package/dist/plugin/config/createModuleID.d.ts +3 -6
- package/dist/plugin/config/createModuleID.d.ts.map +1 -1
- package/dist/plugin/config/createModuleID.js +42 -32
- package/dist/plugin/config/defaults.d.ts +294 -121
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +156 -89
- package/dist/plugin/config/extMap.d.ts +6 -2
- package/dist/plugin/config/extMap.d.ts.map +1 -1
- package/dist/plugin/config/extMap.js +38 -48
- package/dist/plugin/config/flightBindings.d.ts +4 -0
- package/dist/plugin/config/flightBindings.d.ts.map +1 -0
- package/dist/plugin/config/flightBindings.js +215 -0
- package/dist/plugin/config/getCondition.d.ts +2 -0
- package/dist/plugin/config/getCondition.d.ts.map +1 -1
- package/dist/plugin/config/getCondition.js +4 -2
- package/dist/plugin/config/getPaths.js +1 -1
- package/dist/plugin/config/index.d.ts +17 -4
- package/dist/plugin/config/index.d.ts.map +1 -1
- package/dist/plugin/config/index.js +29 -7
- package/dist/plugin/config/interpolatePattern.d.ts +13 -0
- package/dist/plugin/config/interpolatePattern.d.ts.map +1 -0
- package/dist/plugin/config/interpolatePattern.js +13 -0
- package/dist/plugin/config/mimeTypes.js +1 -1
- package/dist/plugin/config/parsePattern.d.ts +25 -0
- package/dist/plugin/config/parsePattern.d.ts.map +1 -0
- package/dist/plugin/config/parsePattern.js +30 -0
- package/dist/plugin/config/resolveAllowedDirectives.d.ts +26 -0
- package/dist/plugin/config/resolveAllowedDirectives.d.ts.map +1 -0
- package/dist/plugin/config/resolveAllowedDirectives.js +35 -0
- package/dist/plugin/config/resolveDirectiveMatcher.d.ts +25 -0
- package/dist/plugin/config/resolveDirectiveMatcher.d.ts.map +1 -0
- package/dist/plugin/config/resolveDirectiveMatcher.js +33 -0
- package/dist/plugin/config/resolveEnv.d.ts +1 -1
- package/dist/plugin/config/resolveEnv.d.ts.map +1 -1
- package/dist/plugin/config/resolveEnv.js +45 -28
- package/dist/plugin/config/resolveOptions.d.ts +13 -3
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +230 -219
- package/dist/plugin/config/resolvePages.js +1 -1
- package/dist/plugin/config/resolvePatternWithValues.d.ts +39 -0
- package/dist/plugin/config/resolvePatternWithValues.d.ts.map +1 -0
- package/dist/plugin/config/resolvePatternWithValues.js +36 -0
- package/dist/plugin/config/resolveRegExp.d.ts +29 -0
- package/dist/plugin/config/resolveRegExp.d.ts.map +1 -0
- package/dist/plugin/config/resolveRegExp.js +39 -0
- package/dist/plugin/config/resolveUrlOption.d.ts +37 -6
- package/dist/plugin/config/resolveUrlOption.d.ts.map +1 -1
- package/dist/plugin/config/resolveUrlOption.js +42 -12
- package/dist/plugin/config/resolveUserConfig.d.ts +5 -4
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +98 -47
- package/dist/plugin/env/createConfigEnv.d.ts +7 -0
- package/dist/plugin/env/createConfigEnv.d.ts.map +1 -0
- package/dist/plugin/env/createConfigEnv.js +30 -0
- package/dist/plugin/env/getArgValue.d.ts +8 -0
- package/dist/plugin/env/getArgValue.d.ts.map +1 -0
- package/dist/plugin/env/getArgValue.js +32 -0
- package/dist/plugin/env/getEnvKey.d.ts +40 -0
- package/dist/plugin/env/getEnvKey.d.ts.map +1 -0
- package/dist/plugin/env/getEnvKey.js +24 -0
- package/dist/plugin/env/index.d.ts +3 -0
- package/dist/plugin/env/index.d.ts.map +1 -1
- package/dist/plugin/env/index.js +3 -0
- package/dist/plugin/env/plugin.d.ts +6 -0
- package/dist/plugin/env/plugin.d.ts.map +1 -1
- package/dist/plugin/env/plugin.js +69 -93
- package/dist/plugin/env/userConfigEnv.d.ts +2 -0
- package/dist/plugin/env/userConfigEnv.d.ts.map +1 -0
- package/dist/plugin/env/userConfigEnv.js +21 -0
- package/dist/plugin/error/directiveError.d.ts +13 -0
- package/dist/plugin/error/directiveError.d.ts.map +1 -0
- package/dist/plugin/error/directiveError.js +21 -0
- package/dist/plugin/error/enhanceError.d.ts +14 -0
- package/dist/plugin/error/enhanceError.d.ts.map +1 -0
- package/dist/plugin/error/enhanceError.js +24 -0
- package/dist/plugin/error/index.d.ts +4 -0
- package/dist/plugin/error/index.d.ts.map +1 -0
- package/dist/plugin/error/index.js +9 -0
- package/dist/plugin/error/logError.d.ts +3 -0
- package/dist/plugin/error/logError.d.ts.map +1 -0
- package/dist/plugin/error/logError.js +50 -0
- package/dist/plugin/error/serializeError.d.ts +7 -0
- package/dist/plugin/error/serializeError.d.ts.map +1 -0
- package/dist/plugin/error/serializeError.js +37 -0
- package/dist/plugin/error/toError.d.ts +1 -8
- package/dist/plugin/error/toError.d.ts.map +1 -1
- package/dist/plugin/error/toError.js +62 -34
- package/dist/plugin/file-preserver/plugin.js +93 -105
- package/dist/plugin/getNodeEnv.d.ts +11 -0
- package/dist/plugin/getNodeEnv.d.ts.map +1 -0
- package/dist/plugin/getNodeEnv.js +17 -0
- package/dist/plugin/helpers/cleanObject.d.ts.map +1 -1
- package/dist/plugin/helpers/cleanObject.js +2 -1
- package/dist/plugin/helpers/collectManifestCss.js +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts +6 -4
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts.map +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.js +15 -9
- package/dist/plugin/helpers/createCssProps.d.ts +3 -4
- package/dist/plugin/helpers/createCssProps.d.ts.map +1 -1
- package/dist/plugin/helpers/createCssProps.js +16 -15
- package/dist/plugin/helpers/createEventHandler.d.ts +2 -2
- package/dist/plugin/helpers/createEventHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createEventHandler.js +1 -1
- package/dist/plugin/helpers/createHandler.d.ts +10 -8
- package/dist/plugin/helpers/createHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createHandler.js +11 -5
- package/dist/plugin/helpers/createRscStream.d.ts +18 -5
- package/dist/plugin/helpers/createRscStream.d.ts.map +1 -1
- package/dist/plugin/helpers/createRscStream.js +53 -15
- package/dist/plugin/helpers/formatMetrics.d.ts +1 -5
- package/dist/plugin/helpers/formatMetrics.d.ts.map +1 -1
- package/dist/plugin/helpers/formatMetrics.js +2 -39
- package/dist/plugin/helpers/getBundleManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/getBundleManifest.js +9 -2
- package/dist/plugin/helpers/getRouteFiles.d.ts +30 -2
- package/dist/plugin/helpers/getRouteFiles.d.ts.map +1 -1
- package/dist/plugin/helpers/getRouteFiles.js +100 -8
- package/dist/plugin/helpers/handleServerAction.d.ts +8 -7
- package/dist/plugin/helpers/handleServerAction.d.ts.map +1 -1
- package/dist/plugin/helpers/handleServerAction.js +7 -3
- package/dist/plugin/helpers/hydrateUserOptions.d.ts +9 -0
- package/dist/plugin/helpers/hydrateUserOptions.d.ts.map +1 -0
- package/dist/plugin/helpers/hydrateUserOptions.js +22 -0
- package/dist/plugin/helpers/index.d.ts +2 -0
- package/dist/plugin/helpers/index.d.ts.map +1 -1
- package/dist/plugin/helpers/index.js +31 -31
- package/dist/plugin/helpers/inputNormalizer.d.ts +1 -1
- package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -1
- package/dist/plugin/helpers/inputNormalizer.js +33 -20
- package/dist/plugin/helpers/metrics.d.ts +4 -10
- package/dist/plugin/helpers/metrics.d.ts.map +1 -1
- package/dist/plugin/helpers/metrics.js +3 -59
- package/dist/plugin/helpers/moduleRefs.js +1 -1
- package/dist/plugin/helpers/moduleResolver.d.ts +24 -2
- package/dist/plugin/helpers/moduleResolver.d.ts.map +1 -1
- package/dist/plugin/helpers/moduleResolver.js +61 -22
- package/dist/plugin/helpers/requestInfo.d.ts +31 -4
- package/dist/plugin/helpers/requestInfo.d.ts.map +1 -1
- package/dist/plugin/helpers/requestInfo.js +62 -35
- package/dist/plugin/helpers/requestToRoute.d.ts +1 -1
- package/dist/plugin/helpers/requestToRoute.d.ts.map +1 -1
- package/dist/plugin/helpers/requestToRoute.js +17 -9
- package/dist/plugin/helpers/resolveComponent.d.ts +57 -0
- package/dist/plugin/helpers/resolveComponent.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveComponent.js +71 -0
- package/dist/plugin/helpers/resolveComponents.d.ts +27 -0
- package/dist/plugin/helpers/resolveComponents.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveComponents.js +146 -0
- package/dist/plugin/helpers/resolvePage.d.ts +15 -11
- package/dist/plugin/helpers/resolvePage.d.ts.map +1 -1
- package/dist/plugin/helpers/resolvePage.js +11 -7
- package/dist/plugin/helpers/resolvePageAndProps.d.ts +3 -10
- package/dist/plugin/helpers/resolvePageAndProps.d.ts.map +1 -1
- package/dist/plugin/helpers/resolvePageAndProps.js +28 -18
- package/dist/plugin/helpers/resolveProps.d.ts +13 -7
- package/dist/plugin/helpers/resolveProps.d.ts.map +1 -1
- package/dist/plugin/helpers/resolveProps.js +55 -25
- package/dist/plugin/helpers/resolveUserComponents.d.ts +33 -0
- package/dist/plugin/helpers/resolveUserComponents.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveUserComponents.js +163 -0
- package/dist/plugin/helpers/serializeUserOptions.d.ts +7 -7
- package/dist/plugin/helpers/serializeUserOptions.d.ts.map +1 -1
- package/dist/plugin/helpers/serializeUserOptions.js +127 -42
- package/dist/plugin/helpers/stashReturnValue.d.ts +2 -1
- package/dist/plugin/helpers/stashReturnValue.d.ts.map +1 -1
- package/dist/plugin/helpers/stashReturnValue.js +6 -3
- package/dist/plugin/helpers/tryManifest.d.ts +1 -2
- package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/tryManifest.js +1 -1
- package/dist/plugin/loader/createDefaultLoader.d.ts +19 -8
- package/dist/plugin/loader/createDefaultLoader.d.ts.map +1 -1
- package/dist/plugin/loader/createDefaultLoader.js +69 -107
- package/dist/plugin/loader/createTransformer.d.ts +6 -0
- package/dist/plugin/loader/createTransformer.d.ts.map +1 -0
- package/dist/plugin/loader/createTransformer.js +92 -0
- package/dist/plugin/loader/{css-loader.development.d.ts → css-loader.d.ts} +6 -8
- package/dist/plugin/loader/css-loader.d.ts.map +1 -0
- package/dist/plugin/loader/css-loader.js +134 -0
- package/dist/plugin/loader/directives/addLocalExportedNames.d.ts +4 -0
- package/dist/plugin/loader/directives/addLocalExportedNames.d.ts.map +1 -0
- package/dist/plugin/loader/directives/addLocalExportedNames.js +57 -0
- package/dist/plugin/loader/directives/analyzeDirectives.d.ts +9 -0
- package/dist/plugin/loader/directives/analyzeDirectives.d.ts.map +1 -0
- package/dist/plugin/loader/directives/analyzeDirectives.js +221 -0
- package/dist/plugin/loader/directives/analyzeModule.d.ts +7 -0
- package/dist/plugin/loader/directives/analyzeModule.d.ts.map +1 -0
- package/dist/plugin/loader/directives/analyzeModule.js +48 -0
- package/dist/plugin/loader/directives/collectExports.d.ts +13 -0
- package/dist/plugin/loader/directives/collectExports.d.ts.map +1 -0
- package/dist/plugin/loader/directives/collectExports.js +116 -0
- package/dist/plugin/loader/directives/collectExportsFromModule.d.ts +6 -0
- package/dist/plugin/loader/directives/collectExportsFromModule.d.ts.map +1 -0
- package/dist/plugin/loader/directives/collectExportsFromModule.js +24 -0
- package/dist/plugin/loader/directives/findDirectiveMatches.d.ts +3 -0
- package/dist/plugin/loader/directives/findDirectiveMatches.d.ts.map +1 -0
- package/dist/plugin/loader/directives/findDirectiveMatches.js +46 -0
- package/dist/plugin/loader/directives/getExportedName.d.ts +3 -0
- package/dist/plugin/loader/directives/getExportedName.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getExportedName.js +59 -0
- package/dist/plugin/loader/directives/getExports.d.ts +7 -0
- package/dist/plugin/loader/directives/getExports.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getExports.js +28 -0
- package/dist/plugin/loader/directives/getFunctionBody.d.ts +3 -0
- package/dist/plugin/loader/directives/getFunctionBody.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getFunctionBody.js +31 -0
- package/dist/plugin/loader/directives/getFunctionName.d.ts +10 -0
- package/dist/plugin/loader/directives/getFunctionName.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getFunctionName.js +42 -0
- package/dist/plugin/loader/directives/getQualifiedName.d.ts +3 -0
- package/dist/plugin/loader/directives/getQualifiedName.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getQualifiedName.js +65 -0
- package/dist/plugin/loader/directives/index.d.ts +14 -0
- package/dist/plugin/loader/directives/index.d.ts.map +1 -0
- package/dist/plugin/loader/directives/index.js +18 -0
- package/dist/plugin/loader/directives/processFunctionNode.d.ts +4 -0
- package/dist/plugin/loader/directives/processFunctionNode.d.ts.map +1 -0
- package/dist/plugin/loader/directives/processFunctionNode.js +86 -0
- package/dist/plugin/loader/directives/typeGuards.d.ts +37 -0
- package/dist/plugin/loader/directives/typeGuards.d.ts.map +1 -0
- package/dist/plugin/loader/directives/typeGuards.js +100 -0
- package/dist/plugin/loader/directives/types.d.ts +154 -0
- package/dist/plugin/loader/directives/types.d.ts.map +1 -0
- package/dist/plugin/loader/directives/utils.d.ts +14 -0
- package/dist/plugin/loader/directives/utils.d.ts.map +1 -0
- package/dist/plugin/loader/directives/utils.js +21 -0
- package/dist/plugin/loader/env-loader.d.ts +12 -0
- package/dist/plugin/loader/env-loader.d.ts.map +1 -0
- package/dist/plugin/loader/env-loader.js +88 -0
- package/dist/plugin/loader/index.d.ts +8 -1
- package/dist/plugin/loader/index.d.ts.map +1 -1
- package/dist/plugin/loader/index.js +13 -4
- package/dist/plugin/loader/parse.d.ts +12 -2
- package/dist/plugin/loader/parse.d.ts.map +1 -1
- package/dist/plugin/loader/parse.js +28 -5
- package/dist/plugin/loader/react-loader.d.ts +22 -1
- package/dist/plugin/loader/react-loader.d.ts.map +1 -1
- package/dist/plugin/loader/react-loader.js +169 -6
- package/dist/plugin/loader/removeDirectives.d.ts +5 -0
- package/dist/plugin/loader/removeDirectives.d.ts.map +1 -0
- package/dist/plugin/loader/removeDirectives.js +17 -0
- package/dist/plugin/loader/removeRanges.d.ts +5 -0
- package/dist/plugin/loader/removeRanges.d.ts.map +1 -0
- package/dist/plugin/loader/removeRanges.js +20 -0
- package/dist/plugin/loader/sourceMap.d.ts +16 -24
- package/dist/plugin/loader/sourceMap.d.ts.map +1 -1
- package/dist/plugin/loader/sourceMap.js +125 -97
- package/dist/plugin/loader/transformClientModule.d.ts +9 -0
- package/dist/plugin/loader/transformClientModule.d.ts.map +1 -0
- package/dist/plugin/loader/transformClientModule.js +46 -0
- package/dist/plugin/loader/transformModule.d.ts +6 -0
- package/dist/plugin/loader/transformModule.d.ts.map +1 -0
- package/dist/plugin/loader/transformModule.js +37 -0
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts +12 -1
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts.map +1 -1
- package/dist/plugin/loader/transformModuleIfNeeded.js +9 -20
- package/dist/plugin/loader/transformNonServerEnvironment.d.ts +10 -0
- package/dist/plugin/loader/transformNonServerEnvironment.d.ts.map +1 -0
- package/dist/plugin/loader/transformNonServerEnvironment.js +72 -0
- package/dist/plugin/loader/transformServerModule.d.ts +10 -0
- package/dist/plugin/loader/transformServerModule.d.ts.map +1 -0
- package/dist/plugin/loader/transformServerModule.js +103 -0
- package/dist/plugin/loader/transformWithAcornLoose.d.ts +12 -0
- package/dist/plugin/loader/transformWithAcornLoose.d.ts.map +1 -0
- package/dist/plugin/loader/transformWithAcornLoose.js +16 -0
- package/dist/plugin/loader/types.d.ts +48 -13
- package/dist/plugin/loader/types.d.ts.map +1 -1
- package/dist/plugin/metrics/collectStreamMetrics.d.ts +9 -0
- package/dist/plugin/metrics/collectStreamMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/collectStreamMetrics.js +35 -0
- package/dist/plugin/metrics/createRenderMetrics.d.ts +3 -0
- package/dist/plugin/metrics/createRenderMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/createRenderMetrics.js +24 -0
- package/dist/plugin/metrics/createStreamMetrics.d.ts +3 -0
- package/dist/plugin/metrics/createStreamMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/createStreamMetrics.js +19 -0
- package/dist/plugin/metrics/formatMetrics.d.ts +6 -3
- package/dist/plugin/metrics/formatMetrics.d.ts.map +1 -1
- package/dist/plugin/metrics/formatMetrics.js +5 -2
- package/dist/plugin/metrics/index.d.ts +3 -1
- package/dist/plugin/metrics/index.d.ts.map +1 -1
- package/dist/plugin/metrics/index.js +9 -1
- package/dist/plugin/metrics/types.d.ts +23 -0
- package/dist/plugin/metrics/types.d.ts.map +1 -0
- package/dist/plugin/metrics/types.js +1 -0
- package/dist/plugin/plugin.client.d.ts +23 -2
- package/dist/plugin/plugin.client.d.ts.map +1 -1
- package/dist/plugin/plugin.client.js +14 -9
- package/dist/plugin/plugin.server.d.ts +13 -2
- package/dist/plugin/plugin.server.d.ts.map +1 -1
- package/dist/plugin/plugin.server.js +15 -16
- package/dist/plugin/process-env.d.ts +18 -6
- package/dist/plugin/process-env.d.ts.map +1 -1
- package/dist/plugin/process-env.js +17 -0
- package/dist/plugin/react-client/cleanupWorkerServerAction.d.ts +11 -0
- package/dist/plugin/react-client/cleanupWorkerServerAction.d.ts.map +1 -0
- package/dist/plugin/react-client/cleanupWorkerServerAction.js +18 -0
- package/dist/plugin/react-client/configureWorkerRequestHandler.d.ts +9 -9
- package/dist/plugin/react-client/configureWorkerRequestHandler.d.ts.map +1 -1
- package/dist/plugin/react-client/configureWorkerRequestHandler.js +31 -26
- package/dist/plugin/react-client/createMessageHandlers.d.ts +1 -1
- package/dist/plugin/react-client/createMessageHandlers.d.ts.map +1 -1
- package/dist/plugin/react-client/createMessageHandlers.js +15 -3
- package/dist/plugin/react-client/createWorkerStream.d.ts +12 -10
- package/dist/plugin/react-client/createWorkerStream.d.ts.map +1 -1
- package/dist/plugin/react-client/createWorkerStream.js +27 -29
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts +13 -8
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts.map +1 -1
- package/dist/plugin/react-client/handleWorkerRscStream.js +51 -24
- package/dist/plugin/react-client/handleWorkerServerAction.d.ts +2 -1
- package/dist/plugin/react-client/handleWorkerServerAction.d.ts.map +1 -1
- package/dist/plugin/react-client/handleWorkerServerAction.js +43 -28
- package/dist/plugin/react-client/index.d.ts +4 -1
- package/dist/plugin/react-client/index.d.ts.map +1 -1
- package/dist/plugin/react-client/index.js +10 -1
- package/dist/plugin/react-client/plugin.d.ts +5 -3
- package/dist/plugin/react-client/plugin.d.ts.map +1 -1
- package/dist/plugin/react-client/plugin.js +9 -11
- package/dist/plugin/react-client/restartWorker.d.ts +5 -4
- package/dist/plugin/react-client/restartWorker.d.ts.map +1 -1
- package/dist/plugin/react-client/restartWorker.js +14 -13
- package/dist/plugin/react-server/configureReactServer.d.ts +5 -4
- package/dist/plugin/react-server/configureReactServer.d.ts.map +1 -1
- package/dist/plugin/react-server/configureReactServer.js +106 -47
- package/dist/plugin/react-server/handleServerAction.d.ts +3 -2
- package/dist/plugin/react-server/handleServerAction.d.ts.map +1 -1
- package/dist/plugin/react-server/handleServerAction.js +14 -20
- package/dist/plugin/react-server/plugin.d.ts +3 -4
- package/dist/plugin/react-server/plugin.d.ts.map +1 -1
- package/dist/plugin/react-server/plugin.js +30 -31
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts +8 -6
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts.map +1 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.js +4 -4
- package/dist/plugin/react-static/collectRscContent.d.ts +8 -6
- package/dist/plugin/react-static/collectRscContent.d.ts.map +1 -1
- package/dist/plugin/react-static/collectRscContent.js +4 -4
- package/dist/plugin/react-static/configurePreviewServer.d.ts +6 -4
- package/dist/plugin/react-static/configurePreviewServer.d.ts.map +1 -1
- package/dist/plugin/react-static/configurePreviewServer.js +32 -36
- package/dist/plugin/react-static/createBuildLoader.d.ts +5 -5
- package/dist/plugin/react-static/createBuildLoader.d.ts.map +1 -1
- package/dist/plugin/react-static/createBuildLoader.js +122 -30
- package/dist/plugin/react-static/fileWriter.js +1 -1
- package/dist/plugin/react-static/plugin.d.ts +3 -4
- package/dist/plugin/react-static/plugin.d.ts.map +1 -1
- package/dist/plugin/react-static/plugin.js +62 -47
- package/dist/plugin/react-static/renderPage.d.ts +4 -2
- package/dist/plugin/react-static/renderPage.d.ts.map +1 -1
- package/dist/plugin/react-static/renderPage.js +21 -17
- package/dist/plugin/react-static/renderPages.d.ts +4 -2
- package/dist/plugin/react-static/renderPages.d.ts.map +1 -1
- package/dist/plugin/react-static/renderPages.js +7 -6
- package/dist/plugin/react-static/renderStreams.d.ts +5 -22
- package/dist/plugin/react-static/renderStreams.d.ts.map +1 -1
- package/dist/plugin/react-static/renderStreams.js +6 -6
- package/dist/plugin/react-static/rscToHtmlStream.d.ts.map +1 -1
- package/dist/plugin/react-static/rscToHtmlStream.js +1 -1
- package/dist/plugin/react-static/temporaryReferences.js +1 -1
- package/dist/plugin/react-static/types.d.ts +0 -1
- package/dist/plugin/react-static/types.d.ts.map +1 -1
- package/dist/plugin/root.js +1 -1
- package/dist/plugin/transformer/plugin.client.d.ts +29 -1
- package/dist/plugin/transformer/plugin.client.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.client.js +96 -1
- package/dist/plugin/transformer/plugin.js +1 -1
- package/dist/plugin/transformer/plugin.server.d.ts +5 -3
- package/dist/plugin/transformer/plugin.server.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.server.js +60 -69
- package/dist/plugin/types/css-tracking.d.ts +2 -2
- package/dist/plugin/types/css-tracking.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +451 -192
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/types.js +2 -1
- package/dist/plugin/utils/callServer.js +1 -1
- package/dist/plugin/utils/createCallServer.d.ts +1 -1
- package/dist/plugin/utils/createCallServer.d.ts.map +1 -1
- package/dist/plugin/utils/createCallServer.js +1 -1
- package/dist/plugin/utils/createReactFetcher.d.ts +2 -3
- package/dist/plugin/utils/createReactFetcher.d.ts.map +1 -1
- package/dist/plugin/utils/createReactFetcher.js +1 -1
- package/dist/plugin/utils/env.js +1 -1
- package/dist/plugin/utils/envUrls.node.d.ts.map +1 -1
- package/dist/plugin/utils/envUrls.node.js +3 -2
- package/dist/plugin/utils/index.d.ts +1 -0
- package/dist/plugin/utils/index.d.ts.map +1 -1
- package/dist/plugin/utils/index.js +12 -5
- package/dist/plugin/utils/routeToURL.d.ts +12 -0
- package/dist/plugin/utils/routeToURL.d.ts.map +1 -0
- package/dist/plugin/utils/routeToURL.js +26 -0
- package/dist/plugin/utils/urls.d.ts.map +1 -1
- package/dist/plugin/utils/urls.js +5 -3
- package/dist/plugin/vendor/index.js +7 -1
- package/dist/plugin/vendor/vendor.client.js +1 -1
- package/dist/plugin/vendor/vendor.js +1 -1
- package/dist/plugin/vendor/vendor.server.js +1 -1
- package/dist/plugin/worker/createWorker.d.ts +31 -17
- package/dist/plugin/worker/createWorker.d.ts.map +1 -1
- package/dist/plugin/worker/createWorker.js +18 -12
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts +2 -2
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts.map +1 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js +5 -2
- package/dist/plugin/worker/html/html-worker.development.js +3 -3
- package/dist/plugin/worker/html/html-worker.production.js +1 -1
- package/dist/plugin/worker/html/index.d.ts +1 -1
- package/dist/plugin/worker/html/index.d.ts.map +1 -1
- package/dist/plugin/worker/html/index.js +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.js +9 -11
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.d.ts +3 -0
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.d.ts.map +1 -0
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.js +2 -0
- package/dist/plugin/worker/html/types.d.ts +20 -2
- package/dist/plugin/worker/html/types.d.ts.map +1 -1
- package/dist/plugin/worker/index.d.ts +3 -0
- package/dist/plugin/worker/index.d.ts.map +1 -0
- package/dist/plugin/worker/index.js +7 -0
- package/dist/plugin/worker/registerLoaders.js +2 -2
- package/dist/plugin/worker/rsc/handleRender.d.ts +5 -3
- package/dist/plugin/worker/rsc/handleRender.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handleRender.js +57 -38
- package/dist/plugin/worker/rsc/handlers.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handlers.js +19 -15
- package/dist/plugin/worker/rsc/index.d.ts +1 -1
- package/dist/plugin/worker/rsc/index.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/index.js +1 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts +1 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.js +22 -8
- package/dist/plugin/worker/rsc/rsc-worker.development.js +77 -11
- package/dist/plugin/worker/rsc/rsc-worker.production.js +37 -8
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.d.ts +3 -0
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.js +11 -0
- package/dist/plugin/worker/rsc/state.js +1 -1
- package/dist/plugin/worker/rsc/types.d.ts +95 -0
- package/dist/plugin/worker/rsc/types.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/types.js +1 -0
- package/dist/plugin/worker/rsc/userOptions.d.ts +1 -1
- package/dist/plugin/worker/rsc/userOptions.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/userOptions.js +3 -4
- package/dist/plugin/worker/sendMessage.d.ts +3 -4
- package/dist/plugin/worker/sendMessage.d.ts.map +1 -1
- package/dist/plugin/worker/sendMessage.js +15 -5
- package/dist/plugin/worker/types.d.ts +109 -260
- package/dist/plugin/worker/types.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +59 -26
- package/plugin/components/{css-collector-elements.tsx → css.tsx} +3 -3
- package/plugin/components/html.tsx +4 -4
- package/plugin/components/index.ts +3 -3
- package/plugin/components/root.tsx +20 -0
- package/plugin/config/autoDiscover/resolveAutoDiscover.ts +173 -134
- package/plugin/config/autoDiscover/resolveBuildPages.ts +120 -7
- package/plugin/config/createModuleID.ts +60 -39
- package/plugin/config/defaults.tsx +189 -96
- package/plugin/config/extMap.ts +51 -56
- package/plugin/config/flightBindings.ts +221 -0
- package/plugin/config/getCondition.ts +6 -0
- package/plugin/config/index.ts +17 -4
- package/plugin/config/interpolatePattern.ts +19 -0
- package/plugin/config/parsePattern.ts +81 -0
- package/plugin/config/resolveAllowedDirectives.ts +59 -0
- package/plugin/config/resolveDirectiveMatcher.ts +57 -0
- package/plugin/config/resolveEnv.ts +41 -37
- package/plugin/config/resolveOptions.ts +437 -318
- package/plugin/config/resolvePatternWithValues.ts +70 -0
- package/plugin/config/resolveRegExp.ts +89 -0
- package/plugin/config/resolveUrlOption.ts +92 -20
- package/plugin/config/resolveUserConfig.ts +427 -351
- package/plugin/env/createConfigEnv.ts +40 -0
- package/plugin/env/getArgValue.ts +56 -0
- package/plugin/env/getEnvKey.ts +61 -0
- package/plugin/env/index.ts +4 -1
- package/plugin/env/plugin.ts +13 -18
- package/plugin/env/userConfigEnv.ts +22 -0
- package/plugin/error/directiveError.ts +29 -0
- package/plugin/error/enhanceError.ts +41 -0
- package/plugin/error/index.ts +3 -0
- package/plugin/error/logError.ts +48 -0
- package/plugin/error/serializeError.ts +34 -0
- package/plugin/error/toError.ts +75 -45
- package/plugin/file-preserver/plugin.ts +3 -3
- package/plugin/getNodeEnv.ts +24 -0
- package/plugin/helpers/cleanObject.ts +2 -1
- package/plugin/helpers/collectViteModuleGraphCss.ts +138 -118
- package/plugin/helpers/createCssProps.tsx +29 -30
- package/plugin/helpers/createEventHandler.ts +1 -1
- package/plugin/helpers/createHandler.ts +40 -12
- package/plugin/helpers/createRscStream.tsx +103 -36
- package/plugin/helpers/formatMetrics.ts +2 -37
- package/plugin/helpers/getBundleManifest.ts +10 -1
- package/plugin/helpers/getRouteFiles.ts +154 -9
- package/plugin/helpers/handleServerAction.ts +12 -7
- package/plugin/helpers/hydrateUserOptions.ts +23 -0
- package/plugin/helpers/index.ts +4 -0
- package/plugin/helpers/inputNormalizer.ts +44 -24
- package/plugin/helpers/metrics.ts +4 -64
- package/plugin/helpers/moduleResolver.ts +74 -19
- package/plugin/helpers/requestInfo.ts +95 -61
- package/plugin/helpers/requestToRoute.ts +38 -12
- package/plugin/helpers/resolveComponent.ts +173 -0
- package/plugin/helpers/resolveComponents.ts +202 -0
- package/plugin/helpers/resolvePage.ts +35 -29
- package/plugin/helpers/resolvePageAndProps.ts +82 -61
- package/plugin/helpers/resolveProps.ts +100 -37
- package/plugin/helpers/resolveUserComponents.ts +190 -0
- package/plugin/helpers/serializeUserOptions.ts +190 -69
- package/plugin/helpers/stashReturnValue.ts +7 -4
- package/plugin/helpers/tryManifest.ts +1 -1
- package/plugin/loader/createDefaultLoader.ts +119 -119
- package/plugin/loader/createTransformer.ts +110 -0
- package/plugin/loader/css-loader.ts +206 -0
- package/plugin/loader/directives/addLocalExportedNames.ts +78 -0
- package/plugin/loader/directives/analyzeDirectives.ts +298 -0
- package/plugin/loader/directives/analyzeModule.ts +57 -0
- package/plugin/loader/directives/collectExports.ts +181 -0
- package/plugin/loader/directives/collectExportsFromModule.ts +25 -0
- package/plugin/loader/directives/findDirectiveMatches.ts +58 -0
- package/plugin/loader/directives/getExportedName.ts +73 -0
- package/plugin/loader/directives/getExports.ts +27 -0
- package/plugin/loader/directives/getFunctionBody.ts +32 -0
- package/plugin/loader/directives/getFunctionName.ts +70 -0
- package/plugin/loader/directives/getQualifiedName.ts +76 -0
- package/plugin/loader/directives/index.ts +13 -0
- package/plugin/loader/directives/processFunctionNode.ts +97 -0
- package/plugin/loader/directives/typeGuards.ts +160 -0
- package/plugin/loader/directives/types.ts +174 -0
- package/plugin/loader/directives/utils.ts +35 -0
- package/plugin/loader/env-loader.ts +135 -0
- package/plugin/loader/index.ts +8 -6
- package/plugin/loader/parse.ts +42 -12
- package/plugin/loader/react-loader.ts +256 -4
- package/plugin/loader/removeDirectives.ts +14 -0
- package/plugin/loader/removeRanges.ts +21 -0
- package/plugin/loader/sourceMap.ts +174 -84
- package/plugin/loader/transformClientModule.ts +60 -0
- package/plugin/loader/transformModule.ts +59 -0
- package/plugin/loader/transformModuleIfNeeded.ts +40 -40
- package/plugin/loader/transformNonServerEnvironment.ts +95 -0
- package/plugin/loader/transformServerModule.ts +167 -0
- package/plugin/loader/transformWithAcornLoose.ts +27 -0
- package/plugin/loader/types.ts +58 -13
- package/plugin/metrics/collectStreamMetrics.ts +38 -0
- package/plugin/metrics/createRenderMetrics.ts +17 -0
- package/plugin/metrics/createStreamMetrics.ts +14 -0
- package/plugin/metrics/formatMetrics.ts +7 -3
- package/plugin/metrics/index.ts +3 -1
- package/plugin/metrics/types.ts +24 -0
- package/plugin/plugin.client.ts +43 -16
- package/plugin/plugin.server.ts +41 -21
- package/plugin/process-env.ts +27 -6
- package/plugin/react-client/cleanupWorkerServerAction.ts +33 -0
- package/plugin/react-client/configureWorkerRequestHandler.ts +206 -201
- package/plugin/react-client/createMessageHandlers.ts +17 -3
- package/plugin/react-client/createWorkerStream.ts +55 -51
- package/plugin/react-client/handleWorkerRscStream.ts +130 -61
- package/plugin/react-client/handleWorkerServerAction.ts +59 -37
- package/plugin/react-client/index.ts +4 -1
- package/plugin/react-client/plugin.ts +17 -18
- package/plugin/react-client/restartWorker.ts +74 -70
- package/plugin/react-server/configureReactServer.ts +204 -142
- package/plugin/react-server/handleServerAction.ts +156 -160
- package/plugin/react-server/plugin.ts +150 -157
- package/plugin/react-static/collectHtmlWorkerContent.ts +109 -102
- package/plugin/react-static/collectRscContent.ts +55 -51
- package/plugin/react-static/configurePreviewServer.ts +99 -100
- package/plugin/react-static/createBuildLoader.ts +157 -48
- package/plugin/react-static/plugin.ts +368 -357
- package/plugin/react-static/renderPage.ts +31 -24
- package/plugin/react-static/renderPages.ts +21 -14
- package/plugin/react-static/renderStreams.ts +13 -15
- package/plugin/react-static/rscToHtmlStream.ts +4 -6
- package/plugin/react-static/types.ts +0 -3
- package/plugin/transformer/README.md +82 -8
- package/plugin/transformer/plugin.client.ts +142 -0
- package/plugin/transformer/plugin.server.ts +87 -112
- package/plugin/types/css-tracking.ts +1 -1
- package/plugin/types/global.d.ts +2 -2
- package/plugin/types/react-server-dom-esm.d.ts +12 -13
- package/plugin/types.ts +684 -309
- package/plugin/utils/createCallServer.ts +5 -5
- package/plugin/utils/createReactFetcher.ts +4 -6
- package/plugin/utils/envUrls.node.ts +15 -10
- package/plugin/utils/index.ts +2 -1
- package/plugin/utils/routeToURL.ts +34 -0
- package/plugin/utils/urls.ts +10 -7
- package/plugin/worker/createWorker.ts +67 -34
- package/plugin/worker/html/README.md +10 -0
- package/plugin/worker/html/createHtmlWorkerRenderState.tsx +7 -4
- package/plugin/worker/html/html-worker.development.tsx +4 -3
- package/plugin/worker/html/index.ts +3 -1
- package/plugin/worker/html/messageHandler.tsx +10 -16
- package/plugin/worker/html/sendHtmlWorkerMessage.ts +8 -0
- package/plugin/worker/html/types.ts +67 -1
- package/plugin/worker/index.ts +2 -0
- package/plugin/worker/registerLoaders.ts +3 -3
- package/plugin/worker/rsc/README.md +203 -1
- package/plugin/worker/rsc/handleRender.ts +75 -45
- package/plugin/worker/rsc/handlers.ts +30 -22
- package/plugin/worker/rsc/index.ts +2 -0
- package/plugin/worker/rsc/messageHandler.tsx +23 -13
- package/plugin/worker/rsc/rsc-worker.development.ts +104 -17
- package/plugin/worker/rsc/rsc-worker.production.ts +57 -10
- package/plugin/worker/rsc/sendRscWorkerMessage.ts +7 -0
- package/plugin/worker/rsc/state.ts +1 -1
- package/plugin/worker/rsc/types.ts +185 -0
- package/plugin/worker/rsc/userOptions.ts +2 -3
- package/plugin/worker/sendMessage.ts +23 -14
- package/plugin/worker/types.ts +131 -386
- package/scripts/check-react-version.mjs +3 -3
- package/scripts/fix-unused-imports.mjs +77 -0
- package/tsconfig.json +1 -1
- package/dist/_virtual/dynamic-import-helper.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/plugin/components/css-collector-elements.d.ts.map +0 -1
- package/dist/plugin/components/css-collector-elements.js +0 -33
- package/dist/plugin/components/css-collector-elements.js.map +0 -1
- package/dist/plugin/components/css-collector.d.ts +0 -7
- package/dist/plugin/components/css-collector.d.ts.map +0 -1
- package/dist/plugin/components/css-collector.js +0 -18
- package/dist/plugin/components/css-collector.js.map +0 -1
- package/dist/plugin/components/html.js.map +0 -1
- package/dist/plugin/components.js +0 -9
- package/dist/plugin/components.js.map +0 -1
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js.map +0 -1
- package/dist/plugin/config/autoDiscover/customWorkerFiles.js.map +0 -1
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js.map +0 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js.map +0 -1
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js.map +0 -1
- package/dist/plugin/config/defaults.js.map +0 -1
- package/dist/plugin/config/extMap.js.map +0 -1
- package/dist/plugin/config/getCondition.js.map +0 -1
- package/dist/plugin/config/getPaths.js.map +0 -1
- package/dist/plugin/config/mimeTypes.js.map +0 -1
- package/dist/plugin/config/resolveAutoDiscoverMatcher.d.ts +0 -5
- package/dist/plugin/config/resolveAutoDiscoverMatcher.d.ts.map +0 -1
- package/dist/plugin/config/resolveAutoDiscoverMatcher.js +0 -25
- package/dist/plugin/config/resolveAutoDiscoverMatcher.js.map +0 -1
- package/dist/plugin/config/resolveEnv.js.map +0 -1
- package/dist/plugin/config/resolveOptions.js.map +0 -1
- package/dist/plugin/config/resolvePages.js.map +0 -1
- package/dist/plugin/config/resolveUrlOption.js.map +0 -1
- package/dist/plugin/config/resolveUserConfig.js.map +0 -1
- package/dist/plugin/config.js +0 -17
- package/dist/plugin/config.js.map +0 -1
- package/dist/plugin/env.js +0 -79
- package/dist/plugin/env.js.map +0 -1
- package/dist/plugin/error/toError.js.map +0 -1
- package/dist/plugin/file-preserver.js +0 -96
- package/dist/plugin/file-preserver.js.map +0 -1
- package/dist/plugin/helpers/cleanObject.js.map +0 -1
- package/dist/plugin/helpers/collectManifestCss.js.map +0 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.js.map +0 -1
- package/dist/plugin/helpers/createCssProps.js.map +0 -1
- package/dist/plugin/helpers/createEventHandler.js.map +0 -1
- package/dist/plugin/helpers/createHandler.js.map +0 -1
- package/dist/plugin/helpers/createRscStream.js.map +0 -1
- package/dist/plugin/helpers/formatMetrics.js.map +0 -1
- package/dist/plugin/helpers/getBundleManifest.js.map +0 -1
- package/dist/plugin/helpers/getRouteFiles.js.map +0 -1
- package/dist/plugin/helpers/handleServerAction.js.map +0 -1
- package/dist/plugin/helpers/inputNormalizer.js.map +0 -1
- package/dist/plugin/helpers/metrics.js.map +0 -1
- package/dist/plugin/helpers/moduleRefs.js.map +0 -1
- package/dist/plugin/helpers/requestInfo.js.map +0 -1
- package/dist/plugin/helpers/requestToRoute.js.map +0 -1
- package/dist/plugin/helpers/resolvePage.js.map +0 -1
- package/dist/plugin/helpers/resolvePageAndProps.js.map +0 -1
- package/dist/plugin/helpers/resolveProps.js.map +0 -1
- package/dist/plugin/helpers/serializeUserOptions.js.map +0 -1
- package/dist/plugin/helpers/sourceMap.d.ts +0 -8
- package/dist/plugin/helpers/sourceMap.d.ts.map +0 -1
- package/dist/plugin/helpers/sourceMap.js +0 -136
- package/dist/plugin/helpers/stashReturnValue.js.map +0 -1
- package/dist/plugin/helpers/tryManifest.js.map +0 -1
- package/dist/plugin/helpers.js +0 -27
- package/dist/plugin/helpers.js.map +0 -1
- package/dist/plugin/loader/css-loader.development.d.ts.map +0 -1
- package/dist/plugin/loader/css-loader.development.js +0 -76
- package/dist/plugin/loader/css-loader.development.js.map +0 -1
- package/dist/plugin/loader/css-loader.production.d.ts +0 -31
- package/dist/plugin/loader/css-loader.production.d.ts.map +0 -1
- package/dist/plugin/loader/css-loader.production.js +0 -45
- package/dist/plugin/loader/css-loader.production.js.map +0 -1
- package/dist/plugin/loader/env-loader.development.d.ts +0 -13
- package/dist/plugin/loader/env-loader.development.d.ts.map +0 -1
- package/dist/plugin/loader/env-loader.development.js +0 -68
- package/dist/plugin/loader/handleExports.d.ts +0 -40
- package/dist/plugin/loader/handleExports.d.ts.map +0 -1
- package/dist/plugin/loader/handleExports.js +0 -209
- package/dist/plugin/loader/handleExports.js.map +0 -1
- package/dist/plugin/loader/parse.js.map +0 -1
- package/dist/plugin/loader/react-loader.client.d.ts +0 -2
- package/dist/plugin/loader/react-loader.client.d.ts.map +0 -1
- package/dist/plugin/loader/react-loader.client.js +0 -2
- package/dist/plugin/loader/react-loader.js.map +0 -1
- package/dist/plugin/loader/react-loader.server.d.ts +0 -21
- package/dist/plugin/loader/react-loader.server.d.ts.map +0 -1
- package/dist/plugin/loader/react-loader.server.js +0 -131
- package/dist/plugin/loader/transformModuleIfNeeded.js.map +0 -1
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.d.ts +0 -48
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.d.ts.map +0 -1
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.js +0 -428
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.js.map +0 -1
- package/dist/plugin/metrics/formatMetrics.js.map +0 -1
- package/dist/plugin/metrics.js +0 -7
- package/dist/plugin/metrics.js.map +0 -1
- package/dist/plugin/plugin.client.js.map +0 -1
- package/dist/plugin/plugin.server.js.map +0 -1
- package/dist/plugin/preserver/index.d.ts +0 -2
- package/dist/plugin/preserver/index.d.ts.map +0 -1
- package/dist/plugin/preserver/index.js +0 -1
- package/dist/plugin/preserver/plugin.d.ts +0 -3
- package/dist/plugin/preserver/plugin.d.ts.map +0 -1
- package/dist/plugin/preserver/plugin.js +0 -130
- package/dist/plugin/preserver/plugin.js.map +0 -1
- package/dist/plugin/react-client/configureWorkerRequestHandler.js.map +0 -1
- package/dist/plugin/react-client/createMessageHandlers.js.map +0 -1
- package/dist/plugin/react-client/createWorkerStream.js.map +0 -1
- package/dist/plugin/react-client/handleWorkerRscStream.js.map +0 -1
- package/dist/plugin/react-client/handleWorkerServerAction.js.map +0 -1
- package/dist/plugin/react-client/plugin.js.map +0 -1
- package/dist/plugin/react-client/restartWorker.js.map +0 -1
- package/dist/plugin/react-server/configureReactServer.js.map +0 -1
- package/dist/plugin/react-server/handleServerAction.js.map +0 -1
- package/dist/plugin/react-server/plugin.js.map +0 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.js.map +0 -1
- package/dist/plugin/react-static/collectRscContent.js.map +0 -1
- package/dist/plugin/react-static/configurePreviewServer.js.map +0 -1
- package/dist/plugin/react-static/createBuildLoader.js.map +0 -1
- package/dist/plugin/react-static/fileWriter.js.map +0 -1
- package/dist/plugin/react-static/plugin.js.map +0 -1
- package/dist/plugin/react-static/renderPage.js.map +0 -1
- package/dist/plugin/react-static/renderPages.js.map +0 -1
- package/dist/plugin/react-static/renderStreams.js.map +0 -1
- package/dist/plugin/react-static/rscToHtmlStream.js.map +0 -1
- package/dist/plugin/react-static/streamHandler.d.ts +0 -2
- package/dist/plugin/react-static/streamHandler.d.ts.map +0 -1
- package/dist/plugin/react-static/temporaryReferences.js.map +0 -1
- package/dist/plugin/root.js.map +0 -1
- package/dist/plugin/source-map/createMappingsSerializer.d.ts +0 -2
- package/dist/plugin/source-map/createMappingsSerializer.d.ts.map +0 -1
- package/dist/plugin/source-map/createMappingsSerializer.js +0 -129
- package/dist/plugin/source-map/createMappingsSerializer.js.map +0 -1
- package/dist/plugin/source-map/readMappings.d.ts +0 -2
- package/dist/plugin/source-map/readMappings.d.ts.map +0 -1
- package/dist/plugin/source-map/readMappings.js +0 -200
- package/dist/plugin/transformer/plugin.js.map +0 -1
- package/dist/plugin/transformer/plugin.server.js.map +0 -1
- package/dist/plugin/utils/callServer.js.map +0 -1
- package/dist/plugin/utils/createCallServer.js.map +0 -1
- package/dist/plugin/utils/createReactFetcher.js.map +0 -1
- package/dist/plugin/utils/env.js.map +0 -1
- package/dist/plugin/utils/envUrls.node.js.map +0 -1
- package/dist/plugin/utils/urls.js.map +0 -1
- package/dist/plugin/utils.js +0 -11
- package/dist/plugin/utils.js.map +0 -1
- package/dist/plugin/vendor/vendor.client.js.map +0 -1
- package/dist/plugin/vendor/vendor.js.map +0 -1
- package/dist/plugin/vendor/vendor.server.js.map +0 -1
- package/dist/plugin/vendor.js +0 -7
- package/dist/plugin/vendor.js.map +0 -1
- package/dist/plugin/worker/createWorker.js.map +0 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js.map +0 -1
- package/dist/plugin/worker/html/html-worker.development.js.map +0 -1
- package/dist/plugin/worker/html/html-worker.production.js.map +0 -1
- package/dist/plugin/worker/html/index.js.map +0 -1
- package/dist/plugin/worker/html/messageHandler.js.map +0 -1
- package/dist/plugin/worker/rsc/handleRender.js.map +0 -1
- package/dist/plugin/worker/rsc/handlers.js.map +0 -1
- package/dist/plugin/worker/rsc/index.js.map +0 -1
- package/dist/plugin/worker/rsc/messageHandler.js.map +0 -1
- package/dist/plugin/worker/rsc/rsc-worker.development.js.map +0 -1
- package/dist/plugin/worker/rsc/rsc-worker.production.js.map +0 -1
- package/dist/plugin/worker/rsc/state.js.map +0 -1
- package/dist/plugin/worker/rsc/userOptions.js.map +0 -1
- package/dist/plugin/worker/sendMessage.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/plugin/components/css-collector.tsx +0 -20
- package/plugin/config/resolveAutoDiscoverMatcher.ts +0 -23
- package/plugin/helpers/sourceMap.ts +0 -182
- package/plugin/loader/css-loader.development.ts +0 -135
- package/plugin/loader/css-loader.production.ts +0 -84
- package/plugin/loader/env-loader.development.ts +0 -107
- package/plugin/loader/handleExports.ts +0 -309
- package/plugin/loader/react-loader.client.ts +0 -1
- package/plugin/loader/react-loader.server.ts +0 -185
- package/plugin/loader/transformModuleWithPreservedFunctions.ts +0 -593
- package/plugin/preserver/index.ts +0 -1
- package/plugin/preserver/plugin.ts +0 -178
- package/plugin/react-static/streamHandler.ts +0 -0
- package/plugin/source-map/createMappingsSerializer.ts +0 -181
- package/plugin/source-map/readMappings.ts +0 -194
- /package/dist/plugin/{react-static/streamHandler.js → loader/directives/types.js} +0 -0
|
@@ -3,23 +3,19 @@ import type {
|
|
|
3
3
|
ResolvedUserConfig,
|
|
4
4
|
ResolvedUserOptions,
|
|
5
5
|
AutoDiscoveredFiles,
|
|
6
|
-
PagePropOpt,
|
|
7
|
-
InlineCssOpt,
|
|
8
6
|
} from "../types.js";
|
|
9
7
|
import { join } from "node:path";
|
|
10
8
|
import type { OutputOptions, PreRenderedAsset, PreRenderedChunk } from "rollup";
|
|
11
9
|
import { DEFAULT_CONFIG } from "./defaults.js";
|
|
10
|
+
import { getNodeEnv } from "../getNodeEnv.js";
|
|
12
11
|
|
|
13
|
-
|
|
12
|
+
const stashedUserConfig: Record<string, ResolvedUserConfig | null> = {};
|
|
14
13
|
|
|
15
|
-
export type ResolveUserConfigProps
|
|
16
|
-
T extends PagePropOpt = PagePropOpt,
|
|
17
|
-
InlineCSS extends InlineCssOpt = InlineCssOpt
|
|
18
|
-
> = {
|
|
14
|
+
export type ResolveUserConfigProps = {
|
|
19
15
|
condition: "react-client" | "react-server";
|
|
20
16
|
config: UserConfig;
|
|
21
17
|
configEnv: ConfigEnv;
|
|
22
|
-
userOptions: ResolvedUserOptions
|
|
18
|
+
userOptions: ResolvedUserOptions;
|
|
23
19
|
autoDiscoveredFiles: Pick<AutoDiscoveredFiles, "inputs" | "staticManifest">;
|
|
24
20
|
};
|
|
25
21
|
|
|
@@ -27,378 +23,458 @@ export type ResolveUserConfigReturn =
|
|
|
27
23
|
| { type: "success"; userConfig: ResolvedUserConfig }
|
|
28
24
|
| { type: "error"; error: Error };
|
|
29
25
|
|
|
30
|
-
export
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
>({
|
|
34
|
-
condition,
|
|
35
|
-
config,
|
|
36
|
-
configEnv,
|
|
37
|
-
userOptions,
|
|
38
|
-
autoDiscoveredFiles,
|
|
39
|
-
}: ResolveUserConfigProps<T, InlineCSS>): ResolveUserConfigReturn {
|
|
40
|
-
const ssr =
|
|
41
|
-
typeof config.build?.ssr === "boolean"
|
|
42
|
-
? config.build?.ssr
|
|
43
|
-
: Boolean(configEnv.isSsrBuild) ||
|
|
44
|
-
condition === "react-server" ||
|
|
45
|
-
(typeof process.env["VITE_SSR"] === "string"
|
|
46
|
-
? process.env["VITE_SSR"] === "true" ||
|
|
47
|
-
process.env["VITE_SSR"] === "1"
|
|
48
|
-
: Boolean(process.env["VITE_SSR"]));
|
|
49
|
-
const envDir =
|
|
50
|
-
condition === "react-client" && ssr
|
|
51
|
-
? userOptions.build.client
|
|
52
|
-
: condition === "react-client"
|
|
53
|
-
? userOptions.build.static
|
|
54
|
-
: userOptions.build.server;
|
|
55
|
-
const envId = `${envDir}${ssr ? "-ssr" : ""}`;
|
|
26
|
+
export type ResolveUserConfigFn = (
|
|
27
|
+
props: ResolveUserConfigProps
|
|
28
|
+
) => ResolveUserConfigReturn;
|
|
56
29
|
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
30
|
+
export const resolveUserConfig: ResolveUserConfigFn =
|
|
31
|
+
function _resolveUserConfig({
|
|
32
|
+
condition,
|
|
33
|
+
config,
|
|
34
|
+
configEnv,
|
|
35
|
+
userOptions,
|
|
36
|
+
autoDiscoveredFiles,
|
|
37
|
+
}) {
|
|
38
|
+
const ssr =
|
|
39
|
+
typeof config.build?.ssr === "boolean"
|
|
40
|
+
? config.build?.ssr
|
|
41
|
+
: Boolean(configEnv.isSsrBuild) ||
|
|
42
|
+
condition === "react-server" ||
|
|
43
|
+
(typeof process.env["VITE_SSR"] === "string"
|
|
44
|
+
? process.env["VITE_SSR"] === "true" ||
|
|
45
|
+
process.env["VITE_SSR"] === "1"
|
|
46
|
+
: Boolean(process.env["VITE_SSR"]));
|
|
47
|
+
const envDir =
|
|
48
|
+
condition === "react-client" && ssr
|
|
49
|
+
? userOptions.build.client
|
|
50
|
+
: condition === "react-client"
|
|
51
|
+
? userOptions.build.static
|
|
52
|
+
: userOptions.build.server;
|
|
53
|
+
const envId = `${envDir}${ssr ? "-ssr" : ""}`;
|
|
66
54
|
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
) => {
|
|
73
|
-
if ("source" in info && info.source === "") {
|
|
74
|
-
return "";
|
|
75
|
-
}
|
|
76
|
-
if (!ssr || !input) {
|
|
77
|
-
return fallback(info, false);
|
|
55
|
+
if (stashedUserConfig[envId]) {
|
|
56
|
+
return {
|
|
57
|
+
type: "success",
|
|
58
|
+
userConfig: stashedUserConfig[envId],
|
|
59
|
+
};
|
|
78
60
|
}
|
|
79
|
-
let [id, value] = userOptions.normalizer(input);
|
|
80
|
-
if (value.startsWith(userOptions.moduleBasePath)) {
|
|
81
|
-
value = value.slice(userOptions.moduleBasePath.length);
|
|
82
|
-
}
|
|
83
|
-
const entry = autoDiscoveredFiles.staticManifest[value];
|
|
84
|
-
if (
|
|
85
|
-
entry?.name &&
|
|
86
|
-
info.type === "asset" &&
|
|
87
|
-
userOptions.autoDiscover.cssPattern(value)
|
|
88
|
-
) {
|
|
89
|
-
const found = entry.css?.find((css) => css.startsWith(id as string));
|
|
90
|
-
if (found) {
|
|
91
|
-
return found;
|
|
92
|
-
} else {
|
|
93
|
-
return entry.file;
|
|
94
|
-
}
|
|
95
|
-
} else if (entry) {
|
|
96
|
-
return entry.file;
|
|
97
|
-
}
|
|
98
|
-
return fallback(info, true);
|
|
99
|
-
};
|
|
100
|
-
const userDefinedOutput = config.build?.rollupOptions?.output;
|
|
101
|
-
const hasOtherOutput =
|
|
102
|
-
Array.isArray(userDefinedOutput) && userDefinedOutput.length > 1;
|
|
103
|
-
const hasValidOutput = userDefinedOutput && !hasOtherOutput;
|
|
104
|
-
const hasObjectOutput =
|
|
105
|
-
userDefinedOutput &&
|
|
106
|
-
!hasOtherOutput &&
|
|
107
|
-
typeof userDefinedOutput === "object" &&
|
|
108
|
-
userDefinedOutput !== null;
|
|
109
61
|
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
? userDefinedOutput.assetFileNames
|
|
113
|
-
: undefined
|
|
114
|
-
: // find the other asset file names
|
|
115
|
-
hasOtherOutput
|
|
116
|
-
? (userDefinedOutput.find((o) => o.assetFileNames) as OutputOptions)
|
|
117
|
-
.assetFileNames
|
|
118
|
-
: undefined;
|
|
62
|
+
// Get existing inputs
|
|
63
|
+
const root = config.root ?? userOptions.projectRoot ?? process.cwd();
|
|
119
64
|
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
:
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
65
|
+
const handleSsrEntryName = (
|
|
66
|
+
info: PreRenderedChunk,
|
|
67
|
+
input: string | null,
|
|
68
|
+
fallback: (info: PreRenderedChunk, ssr: boolean) => string,
|
|
69
|
+
ssr: boolean
|
|
70
|
+
) => {
|
|
71
|
+
if (!ssr || !input) {
|
|
72
|
+
if (typeof fallback === "function") {
|
|
73
|
+
return fallback(info, false);
|
|
74
|
+
}
|
|
75
|
+
return userOptions.normalizer(info.name)[0];
|
|
76
|
+
}
|
|
77
|
+
const normalized = userOptions.normalizer(input);
|
|
78
|
+
let value = normalized[1];
|
|
79
|
+
if (value.startsWith(userOptions.moduleBasePath)) {
|
|
80
|
+
value = value.slice(userOptions.moduleBasePath.length);
|
|
81
|
+
}
|
|
82
|
+
const entry = autoDiscoveredFiles.staticManifest[value];
|
|
83
|
+
if (entry) {
|
|
84
|
+
return entry.file;
|
|
85
|
+
}
|
|
86
|
+
return fallback(info, true);
|
|
87
|
+
};
|
|
130
88
|
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
:
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
89
|
+
const handleSsrAssetName = (
|
|
90
|
+
info: PreRenderedAsset,
|
|
91
|
+
input: string | null,
|
|
92
|
+
fallback: (info: PreRenderedAsset, ssr: boolean) => string,
|
|
93
|
+
ssr: boolean
|
|
94
|
+
) => {
|
|
95
|
+
if (info.source === "") {
|
|
96
|
+
return "";
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
// Check if this is a CSS file
|
|
100
|
+
const isCssFile = input?.endsWith('.css') ||
|
|
101
|
+
info.names?.some(name => name.endsWith('.css'));
|
|
102
|
+
|
|
103
|
+
if (!ssr || !input || isCssFile) {
|
|
104
|
+
if (typeof fallback === "function") {
|
|
105
|
+
return fallback(info, ssr);
|
|
106
|
+
}
|
|
107
|
+
return userOptions.normalizer(info.names[0])[0];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
|
|
111
|
+
// First check if we have a static manifest entry for consistent module ID resolution
|
|
112
|
+
const normalized = userOptions.normalizer(input);
|
|
113
|
+
const id = normalized[0];
|
|
114
|
+
let value = normalized[1];
|
|
115
|
+
if (value.startsWith(userOptions.moduleBasePath)) {
|
|
116
|
+
value = value.slice(userOptions.moduleBasePath.length);
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
const entry = autoDiscoveredFiles.staticManifest[value];
|
|
120
|
+
if (entry) {
|
|
121
|
+
// For CSS files, look for a specific CSS file that matches our normalized ID
|
|
122
|
+
if (entry?.name && userOptions.autoDiscover.cssPattern.test(value)) {
|
|
123
|
+
const found = entry.css?.find((css) => css.startsWith(id as string));
|
|
124
|
+
if (found) {
|
|
125
|
+
return join(userOptions.build.assetsDir, found);
|
|
126
|
+
} else {
|
|
127
|
+
return join(userOptions.build.assetsDir, entry.file);
|
|
152
128
|
}
|
|
153
|
-
|
|
129
|
+
} else {
|
|
130
|
+
// For other assets, use the entry file
|
|
131
|
+
return entry.file;
|
|
154
132
|
}
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
// Fall back to the user's assetFile function for consistent behavior
|
|
136
|
+
return fallback(info, ssr);
|
|
137
|
+
};
|
|
138
|
+
const userDefinedOutput = config.build?.rollupOptions?.output;
|
|
139
|
+
const hasOtherOutput =
|
|
140
|
+
Array.isArray(userDefinedOutput) && userDefinedOutput.length > 1;
|
|
141
|
+
const hasValidOutput = userDefinedOutput && !hasOtherOutput;
|
|
142
|
+
const hasObjectOutput =
|
|
143
|
+
userDefinedOutput &&
|
|
144
|
+
!hasOtherOutput &&
|
|
145
|
+
typeof userDefinedOutput === "object" &&
|
|
146
|
+
userDefinedOutput !== null;
|
|
165
147
|
|
|
166
|
-
|
|
167
|
-
|
|
148
|
+
const userDefinedAssetFileNames = hasObjectOutput
|
|
149
|
+
? "assetFileNames" in userDefinedOutput
|
|
150
|
+
? userDefinedOutput.assetFileNames
|
|
151
|
+
: undefined
|
|
152
|
+
: // find the other asset file names
|
|
153
|
+
hasOtherOutput
|
|
154
|
+
? (userDefinedOutput.find((o) => o.assetFileNames) as OutputOptions)
|
|
155
|
+
.assetFileNames
|
|
156
|
+
: undefined;
|
|
157
|
+
|
|
158
|
+
const userDefinedChunkFileNames = hasValidOutput
|
|
159
|
+
? "chunkFileNames" in userDefinedOutput
|
|
160
|
+
? userDefinedOutput.chunkFileNames
|
|
161
|
+
: undefined
|
|
162
|
+
: undefined;
|
|
163
|
+
const userDefinedEntryFileNames = hasValidOutput
|
|
164
|
+
? "entryFileNames" in userDefinedOutput
|
|
165
|
+
? userDefinedOutput.entryFileNames
|
|
166
|
+
: undefined
|
|
167
|
+
: undefined;
|
|
168
168
|
|
|
169
|
+
const stashedReturns: Record<string, string> = {};
|
|
170
|
+
const pluginOutput = {
|
|
171
|
+
preserveModulesRoot: userOptions.build.preserveModulesRoot
|
|
172
|
+
? userOptions.moduleBase
|
|
173
|
+
: undefined,
|
|
174
|
+
entryFileNames:
|
|
175
|
+
userDefinedEntryFileNames ??
|
|
176
|
+
((info) => {
|
|
177
|
+
const input =
|
|
178
|
+
info.facadeModuleId ??
|
|
179
|
+
info.name + userOptions.build.moduleExtension;
|
|
180
|
+
const inputId = input + (ssr ? "-ssr" : "");
|
|
181
|
+
if (!stashedReturns[inputId]) {
|
|
182
|
+
const r = handleSsrEntryName(
|
|
183
|
+
info,
|
|
184
|
+
input,
|
|
185
|
+
userOptions.build.entryFile,
|
|
186
|
+
ssr
|
|
187
|
+
);
|
|
169
188
|
if (userOptions.verbose) {
|
|
170
|
-
console.log("
|
|
189
|
+
console.log("entryFileNames", input, r);
|
|
171
190
|
}
|
|
172
|
-
stashedReturns[inputId] = r;
|
|
191
|
+
stashedReturns[inputId] = r ?? info.name;
|
|
173
192
|
}
|
|
174
193
|
// in the case of empty basePath, it will not be sliced from the path, so, we need to slice it here
|
|
175
194
|
// at the last possible moment as to not confuse the rest of the logic around the basePath
|
|
176
|
-
return stashedReturns[inputId].slice(
|
|
195
|
+
return stashedReturns[inputId].slice(
|
|
196
|
+
Number(stashedReturns[inputId].startsWith("/"))
|
|
197
|
+
);
|
|
177
198
|
}),
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
const inputId = input + (ssr ? "-ssr" : "");
|
|
199
|
+
assetFileNames: process.env["VITEST"]
|
|
200
|
+
? undefined
|
|
201
|
+
: userDefinedAssetFileNames ??
|
|
202
|
+
((info) => {
|
|
203
|
+
const input = info.originalFileNames[0];
|
|
204
|
+
const inputId = input + (ssr ? "-ssr" : "");
|
|
185
205
|
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
206
|
+
if (!stashedReturns[inputId]) {
|
|
207
|
+
const r = handleSsrAssetName(
|
|
208
|
+
info,
|
|
209
|
+
input,
|
|
210
|
+
userOptions.build.assetFile,
|
|
211
|
+
ssr
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
if (userOptions.verbose) {
|
|
215
|
+
console.log("assetFileNames", input, r);
|
|
216
|
+
}
|
|
217
|
+
stashedReturns[inputId] = r ?? join(userOptions.build.assetsDir, userOptions.normalizer(input)[0]);
|
|
218
|
+
}
|
|
219
|
+
// in the case of empty basePath, it will not be sliced from the path, so, we need to slice it here
|
|
220
|
+
// at the last possible moment as to not confuse the rest of the logic around the basePath
|
|
221
|
+
return stashedReturns[inputId].slice(
|
|
222
|
+
Number(stashedReturns[inputId].startsWith("/"))
|
|
223
|
+
);
|
|
224
|
+
}),
|
|
225
|
+
chunkFileNames:
|
|
226
|
+
userDefinedChunkFileNames ??
|
|
227
|
+
((info) => {
|
|
228
|
+
const input =
|
|
229
|
+
info.facadeModuleId ??
|
|
230
|
+
info.name + userOptions.autoDiscover.modulePattern.source;
|
|
231
|
+
const inputId = input + (ssr ? "-ssr" : "");
|
|
193
232
|
|
|
194
|
-
if (
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
return stashedReturns[inputId].slice(Number(stashedReturns[inputId].startsWith("/")));
|
|
202
|
-
}),
|
|
203
|
-
format: "esm",
|
|
204
|
-
exports: "named",
|
|
205
|
-
} satisfies OutputOptions;
|
|
233
|
+
if (!stashedReturns[inputId]) {
|
|
234
|
+
const r = handleSsrEntryName(
|
|
235
|
+
info,
|
|
236
|
+
input,
|
|
237
|
+
userOptions.build.chunkFile,
|
|
238
|
+
ssr
|
|
239
|
+
);
|
|
206
240
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
241
|
+
if (userOptions.verbose) {
|
|
242
|
+
console.log("chunkFileNames", input, stashedReturns[inputId]);
|
|
243
|
+
}
|
|
244
|
+
stashedReturns[inputId] = r ?? info.name;
|
|
245
|
+
}
|
|
246
|
+
// in the case of empty basePath, it will not be sliced from the path, so, we need to slice it here
|
|
247
|
+
// at the last possible moment as to not confuse the rest of the logic around the basePath
|
|
248
|
+
return stashedReturns[inputId].slice(
|
|
249
|
+
Number(stashedReturns[inputId].startsWith("/"))
|
|
250
|
+
);
|
|
251
|
+
}),
|
|
252
|
+
format: "esm",
|
|
253
|
+
exports: "named",
|
|
254
|
+
} satisfies OutputOptions;
|
|
220
255
|
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
...config.ssr?.resolve,
|
|
234
|
-
externalConditions: config.ssr?.resolve?.externalConditions ?? [
|
|
235
|
-
"react-server",
|
|
236
|
-
],
|
|
237
|
-
},
|
|
238
|
-
};
|
|
239
|
-
let publicOrigin =
|
|
240
|
-
userOptions.publicOrigin ?? process.env[`${vitePrefix}PUBLIC_ORIGIN`] ?? "";
|
|
241
|
-
let PROD = mode === "production";
|
|
242
|
-
let DEV = mode === "development";
|
|
243
|
-
let port =
|
|
244
|
-
typeof config.server?.port === "number" ? config.server?.port : 5173;
|
|
245
|
-
let strictPort = config.server?.strictPort ?? true;
|
|
246
|
-
let host =
|
|
247
|
-
typeof config.server?.host === "string" ? config.server?.host : "localhost";
|
|
248
|
-
if (configEnv.command === "serve" && !configEnv.isPreview) {
|
|
249
|
-
if (strictPort) {
|
|
250
|
-
publicOrigin = `http${config.server?.https ? "s" : ""}://${host}:${port}`;
|
|
251
|
-
} else {
|
|
252
|
-
publicOrigin = "";
|
|
256
|
+
const newOutput = Array.isArray(config.build?.rollupOptions?.output)
|
|
257
|
+
? [...(config.build?.rollupOptions?.output || null), pluginOutput]
|
|
258
|
+
: typeof config.build?.rollupOptions?.output === "object" &&
|
|
259
|
+
config.build?.rollupOptions?.output !== null
|
|
260
|
+
? [config.build?.rollupOptions?.output, pluginOutput]
|
|
261
|
+
: pluginOutput;
|
|
262
|
+
const vitePrefix = config.envPrefix ?? DEFAULT_CONFIG.ENV_PREFIX;
|
|
263
|
+
|
|
264
|
+
// Retroactively update userOptions with environment variables (env vars take precedence over config)
|
|
265
|
+
const envBaseUrl = process.env[`${vitePrefix}BASE_URL`];
|
|
266
|
+
if (envBaseUrl != null && envBaseUrl !== "") {
|
|
267
|
+
userOptions.moduleBaseURL = envBaseUrl;
|
|
253
268
|
}
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
269
|
+
const envPublicOrigin = process.env[`${vitePrefix}PUBLIC_ORIGIN`];
|
|
270
|
+
if (envPublicOrigin != null) {
|
|
271
|
+
userOptions.publicOrigin = envPublicOrigin;
|
|
272
|
+
}
|
|
273
|
+
|
|
274
|
+
const nodeEnv = getNodeEnv();
|
|
275
|
+
let mode =
|
|
276
|
+
config.mode ??
|
|
277
|
+
process.env[`${vitePrefix}MODE`] ??
|
|
278
|
+
process.env["NODE_ENV"] ??
|
|
279
|
+
nodeEnv;
|
|
280
|
+
|
|
281
|
+
if (mode !== nodeEnv) {
|
|
282
|
+
if (typeof config.mode === "string" && nodeEnv !== "production") {
|
|
283
|
+
throw new Error(`Mode ${mode} must be equal to NODE_ENV ${nodeEnv}.`);
|
|
263
284
|
}
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
process.env[`${vitePrefix}BASE_URL`] = userOptions.moduleBaseURL;
|
|
275
|
-
}
|
|
276
|
-
if (process.env[`${vitePrefix}PUBLIC_ORIGIN`] !== publicOrigin) {
|
|
277
|
-
process.env[`${vitePrefix}PUBLIC_ORIGIN`] = publicOrigin;
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
if (condition === "react-client") {
|
|
281
|
-
// client plugin build options (client plugin still outputs server files)
|
|
282
|
-
const clientConfig = {
|
|
283
|
-
...config,
|
|
284
|
-
root: root,
|
|
285
|
-
mode: mode,
|
|
286
|
-
base: userOptions.moduleBaseURL,
|
|
287
|
-
envPrefix: vitePrefix,
|
|
288
|
-
resolve: {
|
|
289
|
-
...config.resolve,
|
|
290
|
-
external: config.resolve?.external ?? [
|
|
285
|
+
mode = nodeEnv;
|
|
286
|
+
}
|
|
287
|
+
const minify = config.build?.minify;
|
|
288
|
+
|
|
289
|
+
const srrConfig = {
|
|
290
|
+
...config.ssr,
|
|
291
|
+
target: config.ssr?.target ?? "node",
|
|
292
|
+
optimizeDeps: {
|
|
293
|
+
...config.ssr?.optimizeDeps,
|
|
294
|
+
include: config.ssr?.optimizeDeps?.include ?? [
|
|
291
295
|
"react",
|
|
292
296
|
"react-dom",
|
|
293
297
|
"react-server-dom-esm/client",
|
|
294
298
|
],
|
|
295
299
|
},
|
|
296
|
-
define: define,
|
|
297
|
-
ssr: srrConfig,
|
|
298
|
-
server: {
|
|
299
|
-
...config.server,
|
|
300
|
-
// common default for stricter server operations
|
|
301
|
-
// and ensures tests that use a server will fail early
|
|
302
|
-
// also, we can't set the public origin without a port
|
|
303
|
-
port: port,
|
|
304
|
-
strictPort: strictPort,
|
|
305
|
-
host: host,
|
|
306
|
-
},
|
|
307
|
-
// client build options
|
|
308
|
-
build: {
|
|
309
|
-
...config.build,
|
|
310
|
-
modulePreload: config.build?.modulePreload ?? false,
|
|
311
|
-
emptyOutDir: config.build?.emptyOutDir ?? true,
|
|
312
|
-
outDir: config.build?.outDir ?? join(userOptions.build.outDir, envDir),
|
|
313
|
-
assetsDir: config.build?.assetsDir ?? userOptions.build.assetsDir,
|
|
314
|
-
copyPublicDir:
|
|
315
|
-
typeof config.build?.copyPublicDir === "boolean"
|
|
316
|
-
? config.build?.copyPublicDir
|
|
317
|
-
: !ssr,
|
|
318
|
-
// modern browsers
|
|
319
|
-
target: config.build?.target ?? ["esnext"],
|
|
320
|
-
minify: minify,
|
|
321
|
-
rollupOptions: {
|
|
322
|
-
...config.build?.rollupOptions,
|
|
323
|
-
input: Object.fromEntries(
|
|
324
|
-
Object.entries(autoDiscoveredFiles.inputs).map(([key, value]) => [
|
|
325
|
-
key,
|
|
326
|
-
value.slice(Number(value.startsWith("/"))),
|
|
327
|
-
])
|
|
328
|
-
),
|
|
329
|
-
output: newOutput,
|
|
330
|
-
preserveEntrySignatures:
|
|
331
|
-
config.build?.rollupOptions?.preserveEntrySignatures ??
|
|
332
|
-
"exports-only",
|
|
333
|
-
},
|
|
334
|
-
ssr: ssr,
|
|
335
|
-
manifest: config.build?.manifest ?? `.vite/manifest.json`,
|
|
336
|
-
ssrManifest: config.build?.ssrManifest ?? `.vite/ssr-manifest.json`,
|
|
337
|
-
ssrEmitAssets: config.build?.ssrEmitAssets ?? true,
|
|
338
|
-
cssCodeSplit:
|
|
339
|
-
typeof config.build?.cssCodeSplit === "boolean"
|
|
340
|
-
? config.build?.cssCodeSplit
|
|
341
|
-
: true,
|
|
342
|
-
},
|
|
343
|
-
} satisfies ResolvedUserConfig;
|
|
344
|
-
stashedUserConfig[envId] = clientConfig;
|
|
345
|
-
return {
|
|
346
|
-
type: "success",
|
|
347
|
-
userConfig: clientConfig,
|
|
348
|
-
};
|
|
349
|
-
} else {
|
|
350
|
-
const serverConfig = {
|
|
351
|
-
...config,
|
|
352
|
-
root: root,
|
|
353
|
-
mode: mode,
|
|
354
|
-
base: userOptions.moduleBaseURL,
|
|
355
|
-
envPrefix: vitePrefix,
|
|
356
300
|
resolve: {
|
|
357
|
-
...config.resolve,
|
|
358
|
-
externalConditions: config.resolve?.externalConditions ?? [
|
|
301
|
+
...config.ssr?.resolve,
|
|
302
|
+
externalConditions: config.ssr?.resolve?.externalConditions ?? [
|
|
359
303
|
"react-server",
|
|
360
304
|
],
|
|
361
305
|
},
|
|
362
|
-
define: define,
|
|
363
|
-
ssr: srrConfig,
|
|
364
|
-
// server build options
|
|
365
|
-
build: {
|
|
366
|
-
...config.build,
|
|
367
|
-
modulePreload: config.build?.modulePreload ?? false,
|
|
368
|
-
emptyOutDir: config.build?.emptyOutDir ?? true,
|
|
369
|
-
outDir: config.build?.outDir ?? join(userOptions.build.outDir, envDir),
|
|
370
|
-
target: config.build?.target ?? "node18",
|
|
371
|
-
minify: minify,
|
|
372
|
-
ssr: ssr,
|
|
373
|
-
manifest: config.build?.manifest ?? `.vite/manifest.json`,
|
|
374
|
-
ssrManifest: config.build?.ssrManifest ?? `.vite/ssr-manifest.json`,
|
|
375
|
-
ssrEmitAssets:
|
|
376
|
-
typeof config.build?.ssrEmitAssets === "boolean"
|
|
377
|
-
? config.build?.ssrEmitAssets
|
|
378
|
-
: true,
|
|
379
|
-
copyPublicDir:
|
|
380
|
-
typeof config.build?.copyPublicDir === "boolean"
|
|
381
|
-
? config.build?.copyPublicDir
|
|
382
|
-
: !ssr,
|
|
383
|
-
assetsDir: config.build?.assetsDir ?? userOptions.build.assetsDir,
|
|
384
|
-
// Ensure CSS files are output to static directory
|
|
385
|
-
cssCodeSplit:
|
|
386
|
-
typeof config.build?.cssCodeSplit === "boolean"
|
|
387
|
-
? config.build?.cssCodeSplit
|
|
388
|
-
: true,
|
|
389
|
-
rollupOptions: {
|
|
390
|
-
...config.build?.rollupOptions,
|
|
391
|
-
input: autoDiscoveredFiles.inputs,
|
|
392
|
-
preserveEntrySignatures:
|
|
393
|
-
config.build?.rollupOptions?.preserveEntrySignatures ?? "strict",
|
|
394
|
-
output: newOutput,
|
|
395
|
-
},
|
|
396
|
-
},
|
|
397
|
-
} satisfies ResolvedUserConfig;
|
|
398
|
-
stashedUserConfig[envId] = serverConfig;
|
|
399
|
-
return {
|
|
400
|
-
type: "success",
|
|
401
|
-
userConfig: serverConfig,
|
|
402
306
|
};
|
|
403
|
-
|
|
404
|
-
|
|
307
|
+
let publicOrigin =
|
|
308
|
+
userOptions.publicOrigin ??
|
|
309
|
+
process.env[`${vitePrefix}PUBLIC_ORIGIN`] ??
|
|
310
|
+
"";
|
|
311
|
+
const PROD = mode === "production";
|
|
312
|
+
const DEV = mode === "development";
|
|
313
|
+
const port =
|
|
314
|
+
typeof config.server?.port === "number" ? config.server?.port : 5173;
|
|
315
|
+
const strictPort = config.server?.strictPort ?? true;
|
|
316
|
+
const host =
|
|
317
|
+
typeof config.server?.host === "string"
|
|
318
|
+
? config.server?.host
|
|
319
|
+
: "localhost";
|
|
320
|
+
const base = config.base ?? userOptions.moduleBaseURL ?? DEFAULT_CONFIG.MODULE_BASE_URL;
|
|
321
|
+
if (configEnv.command === "serve" && !configEnv.isPreview) {
|
|
322
|
+
if (strictPort) {
|
|
323
|
+
publicOrigin = `http${
|
|
324
|
+
config.server?.https ? "s" : ""
|
|
325
|
+
}://${host}:${port}`;
|
|
326
|
+
} else {
|
|
327
|
+
publicOrigin = "";
|
|
328
|
+
}
|
|
329
|
+
}
|
|
330
|
+
const ssrDefine = ssr
|
|
331
|
+
? {
|
|
332
|
+
[`process.env.${vitePrefix}SSR`]: `${ssr}`,
|
|
333
|
+
[`process.env.${vitePrefix}DEV`]: `${DEV}`,
|
|
334
|
+
[`process.env.${vitePrefix}PROD`]: `${PROD}`,
|
|
335
|
+
[`process.env.${vitePrefix}MODE`]: `"${mode}"`,
|
|
336
|
+
[`process.env.${vitePrefix}BASE_URL`]: `"${base}"`,
|
|
337
|
+
[`process.env.${vitePrefix}PUBLIC_ORIGIN`]: `"${publicOrigin}"`,
|
|
338
|
+
}
|
|
339
|
+
: {};
|
|
340
|
+
const define = {
|
|
341
|
+
...config.define,
|
|
342
|
+
[`import.meta.env.BASE_URL`]: `"${base}"`,
|
|
343
|
+
[`import.meta.env.PUBLIC_ORIGIN`]: `"${publicOrigin}"`,
|
|
344
|
+
...ssrDefine,
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
// Set process.env values to ensure they're available in process.env for server-side code
|
|
348
|
+
// These will never be cleaned up, because we are resolving the user config
|
|
349
|
+
// and it's assumed the thread closes after this and we don't want
|
|
350
|
+
// it to change after the config has been resolved
|
|
351
|
+
process.env[`${vitePrefix}BASE_URL`] = base;
|
|
352
|
+
process.env[`${vitePrefix}PUBLIC_ORIGIN`] = publicOrigin;
|
|
353
|
+
|
|
354
|
+
if (condition === "react-client") {
|
|
355
|
+
// client plugin build options (client plugin still outputs server files)
|
|
356
|
+
const clientConfig = {
|
|
357
|
+
...config,
|
|
358
|
+
root: root,
|
|
359
|
+
mode: mode,
|
|
360
|
+
base: base,
|
|
361
|
+
envPrefix: vitePrefix,
|
|
362
|
+
resolve: {
|
|
363
|
+
...config.resolve,
|
|
364
|
+
external: config.resolve?.external ?? [
|
|
365
|
+
"react",
|
|
366
|
+
"react-dom",
|
|
367
|
+
"react-server-dom-esm/client",
|
|
368
|
+
],
|
|
369
|
+
},
|
|
370
|
+
define: define,
|
|
371
|
+
ssr: srrConfig,
|
|
372
|
+
server: {
|
|
373
|
+
...config.server,
|
|
374
|
+
// common default for stricter server operations
|
|
375
|
+
// and ensures tests that use a server will fail early
|
|
376
|
+
// also, we can't set the public origin without a port
|
|
377
|
+
port: port,
|
|
378
|
+
strictPort: strictPort,
|
|
379
|
+
host: host,
|
|
380
|
+
},
|
|
381
|
+
// client build options
|
|
382
|
+
build: {
|
|
383
|
+
...config.build,
|
|
384
|
+
modulePreload: config.build?.modulePreload ?? false,
|
|
385
|
+
emptyOutDir: config.build?.emptyOutDir ?? true,
|
|
386
|
+
outDir:
|
|
387
|
+
config.build?.outDir ?? join(userOptions.build.outDir, envDir),
|
|
388
|
+
assetsDir: config.build?.assetsDir ?? userOptions.build.assetsDir,
|
|
389
|
+
copyPublicDir:
|
|
390
|
+
typeof config.build?.copyPublicDir === "boolean"
|
|
391
|
+
? config.build?.copyPublicDir
|
|
392
|
+
: !ssr,
|
|
393
|
+
// modern browsers
|
|
394
|
+
target: config.build?.target ?? ["esnext"],
|
|
395
|
+
minify: minify,
|
|
396
|
+
rollupOptions: {
|
|
397
|
+
...config.build?.rollupOptions,
|
|
398
|
+
input: Object.fromEntries(
|
|
399
|
+
Object.entries(autoDiscoveredFiles.inputs).map(([key, value]) => [
|
|
400
|
+
key,
|
|
401
|
+
value.slice(Number(value.startsWith("/"))),
|
|
402
|
+
])
|
|
403
|
+
),
|
|
404
|
+
output: newOutput,
|
|
405
|
+
preserveEntrySignatures:
|
|
406
|
+
config.build?.rollupOptions?.preserveEntrySignatures ??
|
|
407
|
+
"exports-only",
|
|
408
|
+
},
|
|
409
|
+
ssr: ssr,
|
|
410
|
+
manifest: config.build?.manifest ?? `.vite/manifest.json`,
|
|
411
|
+
ssrManifest: config.build?.ssrManifest ?? `.vite/ssr-manifest.json`,
|
|
412
|
+
ssrEmitAssets: config.build?.ssrEmitAssets ?? true,
|
|
413
|
+
cssCodeSplit:
|
|
414
|
+
typeof config.build?.cssCodeSplit === "boolean"
|
|
415
|
+
? config.build?.cssCodeSplit
|
|
416
|
+
: true,
|
|
417
|
+
},
|
|
418
|
+
} satisfies ResolvedUserConfig;
|
|
419
|
+
stashedUserConfig[envId] = clientConfig;
|
|
420
|
+
return {
|
|
421
|
+
type: "success",
|
|
422
|
+
userConfig: clientConfig,
|
|
423
|
+
};
|
|
424
|
+
} else {
|
|
425
|
+
const serverConfig = {
|
|
426
|
+
...config,
|
|
427
|
+
root: root,
|
|
428
|
+
mode: mode,
|
|
429
|
+
base: userOptions.moduleBaseURL,
|
|
430
|
+
envPrefix: vitePrefix,
|
|
431
|
+
resolve: {
|
|
432
|
+
...config.resolve,
|
|
433
|
+
externalConditions: config.resolve?.externalConditions ?? [
|
|
434
|
+
"react-server",
|
|
435
|
+
],
|
|
436
|
+
},
|
|
437
|
+
define: define,
|
|
438
|
+
ssr: srrConfig,
|
|
439
|
+
// server build options
|
|
440
|
+
build: {
|
|
441
|
+
...config.build,
|
|
442
|
+
modulePreload: config.build?.modulePreload ?? false,
|
|
443
|
+
emptyOutDir: config.build?.emptyOutDir ?? true,
|
|
444
|
+
outDir:
|
|
445
|
+
config.build?.outDir ?? join(userOptions.build.outDir, envDir),
|
|
446
|
+
target: config.build?.target ?? "node18",
|
|
447
|
+
minify: minify,
|
|
448
|
+
ssr: ssr,
|
|
449
|
+
manifest: config.build?.manifest ?? `.vite/manifest.json`,
|
|
450
|
+
ssrManifest: config.build?.ssrManifest ?? `.vite/ssr-manifest.json`,
|
|
451
|
+
ssrEmitAssets:
|
|
452
|
+
typeof config.build?.ssrEmitAssets === "boolean"
|
|
453
|
+
? config.build?.ssrEmitAssets
|
|
454
|
+
: true,
|
|
455
|
+
copyPublicDir:
|
|
456
|
+
typeof config.build?.copyPublicDir === "boolean"
|
|
457
|
+
? config.build?.copyPublicDir
|
|
458
|
+
: !ssr,
|
|
459
|
+
assetsDir: config.build?.assetsDir ?? userOptions.build.assetsDir,
|
|
460
|
+
// Ensure CSS files are output to static directory
|
|
461
|
+
cssCodeSplit:
|
|
462
|
+
typeof config.build?.cssCodeSplit === "boolean"
|
|
463
|
+
? config.build?.cssCodeSplit
|
|
464
|
+
: true,
|
|
465
|
+
rollupOptions: {
|
|
466
|
+
...config.build?.rollupOptions,
|
|
467
|
+
input: autoDiscoveredFiles.inputs,
|
|
468
|
+
preserveEntrySignatures:
|
|
469
|
+
config.build?.rollupOptions?.preserveEntrySignatures ?? "strict",
|
|
470
|
+
output: newOutput,
|
|
471
|
+
},
|
|
472
|
+
},
|
|
473
|
+
} satisfies ResolvedUserConfig;
|
|
474
|
+
stashedUserConfig[envId] = serverConfig;
|
|
475
|
+
return {
|
|
476
|
+
type: "success",
|
|
477
|
+
userConfig: serverConfig,
|
|
478
|
+
};
|
|
479
|
+
}
|
|
480
|
+
};
|