vite-plugin-react-server 1.1.20 → 1.2.0-alpha.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +102 -395
- package/dist/_virtual/dynamic-import-helper.js +1 -1
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +5 -2
- package/dist/index.js +1 -1
- package/dist/package.json +58 -25
- package/dist/plugin/components/{css-collector-elements.d.ts → css.d.ts} +2 -2
- package/dist/plugin/components/css.d.ts.map +1 -0
- package/dist/plugin/components/css.js +33 -0
- package/dist/plugin/components/html.d.ts +1 -1
- package/dist/plugin/components/html.d.ts.map +1 -1
- package/dist/plugin/components/html.js +5 -5
- package/dist/plugin/components/index.d.ts +3 -3
- package/dist/plugin/components/index.d.ts.map +1 -1
- package/dist/plugin/components/index.js +9 -3
- package/dist/plugin/components/root.d.ts +7 -0
- package/dist/plugin/components/root.d.ts.map +1 -0
- package/dist/plugin/components/root.js +18 -0
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js +1 -1
- package/dist/plugin/config/autoDiscover/customWorkerFiles.js +1 -1
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts +5 -4
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js +26 -7
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts +25 -2
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js +84 -5
- package/dist/plugin/config/createModuleID.d.ts +3 -6
- package/dist/plugin/config/createModuleID.d.ts.map +1 -1
- package/dist/plugin/config/createModuleID.js +42 -32
- package/dist/plugin/config/defaults.d.ts +199 -121
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +155 -89
- package/dist/plugin/config/extMap.d.ts +6 -2
- package/dist/plugin/config/extMap.d.ts.map +1 -1
- package/dist/plugin/config/extMap.js +38 -48
- package/dist/plugin/config/flightBindings.d.ts +4 -0
- package/dist/plugin/config/flightBindings.d.ts.map +1 -0
- package/dist/plugin/config/flightBindings.js +215 -0
- package/dist/plugin/config/getCondition.d.ts +2 -0
- package/dist/plugin/config/getCondition.d.ts.map +1 -1
- package/dist/plugin/config/getCondition.js +4 -2
- package/dist/plugin/config/getPaths.js +1 -1
- package/dist/plugin/config/index.d.ts +17 -4
- package/dist/plugin/config/index.d.ts.map +1 -1
- package/dist/plugin/config/index.js +29 -7
- package/dist/plugin/config/interpolatePattern.d.ts +13 -0
- package/dist/plugin/config/interpolatePattern.d.ts.map +1 -0
- package/dist/plugin/config/interpolatePattern.js +13 -0
- package/dist/plugin/config/mimeTypes.js +1 -1
- package/dist/plugin/config/parsePattern.d.ts +25 -0
- package/dist/plugin/config/parsePattern.d.ts.map +1 -0
- package/dist/plugin/config/parsePattern.js +30 -0
- package/dist/plugin/config/resolveAllowedDirectives.d.ts +26 -0
- package/dist/plugin/config/resolveAllowedDirectives.d.ts.map +1 -0
- package/dist/plugin/config/resolveAllowedDirectives.js +35 -0
- package/dist/plugin/config/resolveDirectiveMatcher.d.ts +25 -0
- package/dist/plugin/config/resolveDirectiveMatcher.d.ts.map +1 -0
- package/dist/plugin/config/resolveDirectiveMatcher.js +33 -0
- package/dist/plugin/config/resolveEnv.d.ts.map +1 -1
- package/dist/plugin/config/resolveEnv.js +14 -4
- package/dist/plugin/config/resolveOptions.d.ts +13 -3
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +228 -206
- package/dist/plugin/config/resolvePages.js +1 -1
- package/dist/plugin/config/resolvePatternWithValues.d.ts +39 -0
- package/dist/plugin/config/resolvePatternWithValues.d.ts.map +1 -0
- package/dist/plugin/config/resolvePatternWithValues.js +36 -0
- package/dist/plugin/config/resolveRegExp.d.ts +29 -0
- package/dist/plugin/config/resolveRegExp.d.ts.map +1 -0
- package/dist/plugin/config/resolveRegExp.js +39 -0
- package/dist/plugin/config/resolveUrlOption.d.ts +37 -6
- package/dist/plugin/config/resolveUrlOption.d.ts.map +1 -1
- package/dist/plugin/config/resolveUrlOption.js +42 -12
- package/dist/plugin/config/resolveUserConfig.d.ts +5 -4
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +86 -40
- package/dist/plugin/env/plugin.d.ts +6 -0
- package/dist/plugin/env/plugin.d.ts.map +1 -1
- package/dist/plugin/env/plugin.js +111 -93
- package/dist/plugin/error/directiveError.d.ts +13 -0
- package/dist/plugin/error/directiveError.d.ts.map +1 -0
- package/dist/plugin/error/directiveError.js +21 -0
- package/dist/plugin/error/enhanceError.d.ts +14 -0
- package/dist/plugin/error/enhanceError.d.ts.map +1 -0
- package/dist/plugin/error/enhanceError.js +24 -0
- package/dist/plugin/error/index.d.ts +4 -0
- package/dist/plugin/error/index.d.ts.map +1 -0
- package/dist/plugin/error/index.js +9 -0
- package/dist/plugin/error/logError.d.ts +3 -0
- package/dist/plugin/error/logError.d.ts.map +1 -0
- package/dist/plugin/error/logError.js +47 -0
- package/dist/plugin/error/serializeError.d.ts +7 -0
- package/dist/plugin/error/serializeError.d.ts.map +1 -0
- package/dist/plugin/error/serializeError.js +37 -0
- package/dist/plugin/error/toError.d.ts +1 -8
- package/dist/plugin/error/toError.d.ts.map +1 -1
- package/dist/plugin/error/toError.js +62 -34
- package/dist/plugin/file-preserver/plugin.js +93 -105
- package/dist/plugin/getNodeEnv.d.ts +11 -0
- package/dist/plugin/getNodeEnv.d.ts.map +1 -0
- package/dist/plugin/getNodeEnv.js +17 -0
- package/dist/plugin/helpers/cleanObject.d.ts.map +1 -1
- package/dist/plugin/helpers/cleanObject.js +2 -1
- package/dist/plugin/helpers/collectManifestCss.js +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts +6 -4
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts.map +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.js +15 -9
- package/dist/plugin/helpers/createCssProps.d.ts +3 -4
- package/dist/plugin/helpers/createCssProps.d.ts.map +1 -1
- package/dist/plugin/helpers/createCssProps.js +16 -4
- package/dist/plugin/helpers/createEventHandler.d.ts +2 -2
- package/dist/plugin/helpers/createEventHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createEventHandler.js +1 -1
- package/dist/plugin/helpers/createHandler.d.ts +10 -8
- package/dist/plugin/helpers/createHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createHandler.js +11 -5
- package/dist/plugin/helpers/createRscStream.d.ts +18 -5
- package/dist/plugin/helpers/createRscStream.d.ts.map +1 -1
- package/dist/plugin/helpers/createRscStream.js +48 -14
- package/dist/plugin/helpers/formatMetrics.d.ts +1 -5
- package/dist/plugin/helpers/formatMetrics.d.ts.map +1 -1
- package/dist/plugin/helpers/formatMetrics.js +2 -39
- package/dist/plugin/helpers/getBundleManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/getBundleManifest.js +9 -2
- package/dist/plugin/helpers/getRouteFiles.d.ts +30 -2
- package/dist/plugin/helpers/getRouteFiles.d.ts.map +1 -1
- package/dist/plugin/helpers/getRouteFiles.js +70 -7
- package/dist/plugin/helpers/handleServerAction.d.ts +8 -7
- package/dist/plugin/helpers/handleServerAction.d.ts.map +1 -1
- package/dist/plugin/helpers/handleServerAction.js +5 -2
- package/dist/plugin/helpers/hydrateUserOptions.d.ts +9 -0
- package/dist/plugin/helpers/hydrateUserOptions.d.ts.map +1 -0
- package/dist/plugin/helpers/hydrateUserOptions.js +22 -0
- package/dist/plugin/helpers/index.d.ts +2 -0
- package/dist/plugin/helpers/index.d.ts.map +1 -1
- package/dist/plugin/helpers/index.js +31 -31
- package/dist/plugin/helpers/inputNormalizer.d.ts +1 -1
- package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -1
- package/dist/plugin/helpers/inputNormalizer.js +33 -20
- package/dist/plugin/helpers/metrics.d.ts +4 -10
- package/dist/plugin/helpers/metrics.d.ts.map +1 -1
- package/dist/plugin/helpers/metrics.js +3 -59
- package/dist/plugin/helpers/moduleRefs.js +1 -1
- package/dist/plugin/helpers/moduleResolver.d.ts +24 -2
- package/dist/plugin/helpers/moduleResolver.d.ts.map +1 -1
- package/dist/plugin/helpers/moduleResolver.js +61 -22
- package/dist/plugin/helpers/requestInfo.d.ts +28 -1
- package/dist/plugin/helpers/requestInfo.d.ts.map +1 -1
- package/dist/plugin/helpers/requestInfo.js +43 -30
- package/dist/plugin/helpers/requestToRoute.d.ts +1 -1
- package/dist/plugin/helpers/requestToRoute.d.ts.map +1 -1
- package/dist/plugin/helpers/requestToRoute.js +17 -9
- package/dist/plugin/helpers/resolveComponent.d.ts +57 -0
- package/dist/plugin/helpers/resolveComponent.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveComponent.js +71 -0
- package/dist/plugin/helpers/resolveComponents.d.ts +27 -0
- package/dist/plugin/helpers/resolveComponents.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveComponents.js +137 -0
- package/dist/plugin/helpers/resolvePage.d.ts +15 -11
- package/dist/plugin/helpers/resolvePage.d.ts.map +1 -1
- package/dist/plugin/helpers/resolvePage.js +11 -7
- package/dist/plugin/helpers/resolvePageAndProps.d.ts +3 -10
- package/dist/plugin/helpers/resolvePageAndProps.d.ts.map +1 -1
- package/dist/plugin/helpers/resolvePageAndProps.js +28 -18
- package/dist/plugin/helpers/resolveProps.d.ts +13 -7
- package/dist/plugin/helpers/resolveProps.d.ts.map +1 -1
- package/dist/plugin/helpers/resolveProps.js +55 -25
- package/dist/plugin/helpers/resolveUserComponents.d.ts +33 -0
- package/dist/plugin/helpers/resolveUserComponents.d.ts.map +1 -0
- package/dist/plugin/helpers/resolveUserComponents.js +163 -0
- package/dist/plugin/helpers/serializeUserOptions.d.ts +7 -7
- package/dist/plugin/helpers/serializeUserOptions.d.ts.map +1 -1
- package/dist/plugin/helpers/serializeUserOptions.js +127 -42
- package/dist/plugin/helpers/stashReturnValue.d.ts +2 -1
- package/dist/plugin/helpers/stashReturnValue.d.ts.map +1 -1
- package/dist/plugin/helpers/stashReturnValue.js +6 -3
- package/dist/plugin/helpers/tryManifest.d.ts +1 -2
- package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/tryManifest.js +1 -1
- package/dist/plugin/loader/createDefaultLoader.d.ts +19 -8
- package/dist/plugin/loader/createDefaultLoader.d.ts.map +1 -1
- package/dist/plugin/loader/createDefaultLoader.js +69 -107
- package/dist/plugin/loader/createTransformer.d.ts +6 -0
- package/dist/plugin/loader/createTransformer.d.ts.map +1 -0
- package/dist/plugin/loader/createTransformer.js +97 -0
- package/dist/plugin/loader/{css-loader.development.d.ts → css-loader.d.ts} +6 -8
- package/dist/plugin/loader/css-loader.d.ts.map +1 -0
- package/dist/plugin/loader/css-loader.js +134 -0
- package/dist/plugin/loader/directives/addLocalExportedNames.d.ts +4 -0
- package/dist/plugin/loader/directives/addLocalExportedNames.d.ts.map +1 -0
- package/dist/plugin/loader/directives/addLocalExportedNames.js +57 -0
- package/dist/plugin/loader/directives/analyzeDirectives.d.ts +9 -0
- package/dist/plugin/loader/directives/analyzeDirectives.d.ts.map +1 -0
- package/dist/plugin/loader/directives/analyzeDirectives.js +221 -0
- package/dist/plugin/loader/directives/analyzeModule.d.ts +11 -0
- package/dist/plugin/loader/directives/analyzeModule.d.ts.map +1 -0
- package/dist/plugin/loader/directives/analyzeModule.js +34 -0
- package/dist/plugin/loader/directives/collectExports.d.ts +13 -0
- package/dist/plugin/loader/directives/collectExports.d.ts.map +1 -0
- package/dist/plugin/loader/directives/collectExports.js +116 -0
- package/dist/plugin/loader/directives/collectExportsFromModule.d.ts +6 -0
- package/dist/plugin/loader/directives/collectExportsFromModule.d.ts.map +1 -0
- package/dist/plugin/loader/directives/collectExportsFromModule.js +24 -0
- package/dist/plugin/loader/directives/findDirectiveMatches.d.ts +3 -0
- package/dist/plugin/loader/directives/findDirectiveMatches.d.ts.map +1 -0
- package/dist/plugin/loader/directives/findDirectiveMatches.js +46 -0
- package/dist/plugin/loader/directives/getExportedName.d.ts +3 -0
- package/dist/plugin/loader/directives/getExportedName.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getExportedName.js +59 -0
- package/dist/plugin/loader/directives/getExports.d.ts +7 -0
- package/dist/plugin/loader/directives/getExports.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getExports.js +28 -0
- package/dist/plugin/loader/directives/getFunctionBody.d.ts +3 -0
- package/dist/plugin/loader/directives/getFunctionBody.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getFunctionBody.js +31 -0
- package/dist/plugin/loader/directives/getFunctionName.d.ts +10 -0
- package/dist/plugin/loader/directives/getFunctionName.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getFunctionName.js +42 -0
- package/dist/plugin/loader/directives/getQualifiedName.d.ts +3 -0
- package/dist/plugin/loader/directives/getQualifiedName.d.ts.map +1 -0
- package/dist/plugin/loader/directives/getQualifiedName.js +65 -0
- package/dist/plugin/loader/directives/index.d.ts +14 -0
- package/dist/plugin/loader/directives/index.d.ts.map +1 -0
- package/dist/plugin/loader/directives/index.js +18 -0
- package/dist/plugin/loader/directives/processFunctionNode.d.ts +4 -0
- package/dist/plugin/loader/directives/processFunctionNode.d.ts.map +1 -0
- package/dist/plugin/loader/directives/processFunctionNode.js +86 -0
- package/dist/plugin/loader/directives/typeGuards.d.ts +37 -0
- package/dist/plugin/loader/directives/typeGuards.d.ts.map +1 -0
- package/dist/plugin/loader/directives/typeGuards.js +100 -0
- package/dist/plugin/loader/directives/types.d.ts +154 -0
- package/dist/plugin/loader/directives/types.d.ts.map +1 -0
- package/dist/plugin/loader/directives/utils.d.ts +14 -0
- package/dist/plugin/loader/directives/utils.d.ts.map +1 -0
- package/dist/plugin/loader/directives/utils.js +21 -0
- package/dist/plugin/loader/env-loader.d.ts +11 -0
- package/dist/plugin/loader/env-loader.d.ts.map +1 -0
- package/dist/plugin/loader/env-loader.js +65 -0
- package/dist/plugin/loader/index.d.ts +8 -1
- package/dist/plugin/loader/index.d.ts.map +1 -1
- package/dist/plugin/loader/index.js +13 -4
- package/dist/plugin/loader/parse.d.ts +11 -2
- package/dist/plugin/loader/parse.d.ts.map +1 -1
- package/dist/plugin/loader/parse.js +29 -6
- package/dist/plugin/loader/react-loader.d.ts +22 -1
- package/dist/plugin/loader/react-loader.d.ts.map +1 -1
- package/dist/plugin/loader/react-loader.js +169 -6
- package/dist/plugin/loader/removeDirectives.d.ts +5 -0
- package/dist/plugin/loader/removeDirectives.d.ts.map +1 -0
- package/dist/plugin/loader/removeDirectives.js +17 -0
- package/dist/plugin/loader/removeRanges.d.ts +5 -0
- package/dist/plugin/loader/removeRanges.d.ts.map +1 -0
- package/dist/plugin/loader/removeRanges.js +20 -0
- package/dist/plugin/loader/sourceMap.d.ts +16 -24
- package/dist/plugin/loader/sourceMap.d.ts.map +1 -1
- package/dist/plugin/loader/sourceMap.js +125 -97
- package/dist/plugin/loader/transformClientModule.d.ts +10 -0
- package/dist/plugin/loader/transformClientModule.d.ts.map +1 -0
- package/dist/plugin/loader/transformClientModule.js +46 -0
- package/dist/plugin/loader/transformModule.d.ts +6 -0
- package/dist/plugin/loader/transformModule.d.ts.map +1 -0
- package/dist/plugin/loader/transformModule.js +33 -0
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts +12 -1
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts.map +1 -1
- package/dist/plugin/loader/transformModuleIfNeeded.js +9 -20
- package/dist/plugin/loader/transformServerModule.d.ts +11 -0
- package/dist/plugin/loader/transformServerModule.d.ts.map +1 -0
- package/dist/plugin/loader/transformServerModule.js +84 -0
- package/dist/plugin/loader/transformWithAcornLoose.d.ts +12 -0
- package/dist/plugin/loader/transformWithAcornLoose.d.ts.map +1 -0
- package/dist/plugin/loader/transformWithAcornLoose.js +18 -0
- package/dist/plugin/loader/types.d.ts +59 -12
- package/dist/plugin/loader/types.d.ts.map +1 -1
- package/dist/plugin/metrics/collectStreamMetrics.d.ts +9 -0
- package/dist/plugin/metrics/collectStreamMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/collectStreamMetrics.js +35 -0
- package/dist/plugin/metrics/createRenderMetrics.d.ts +3 -0
- package/dist/plugin/metrics/createRenderMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/createRenderMetrics.js +24 -0
- package/dist/plugin/metrics/createStreamMetrics.d.ts +3 -0
- package/dist/plugin/metrics/createStreamMetrics.d.ts.map +1 -0
- package/dist/plugin/metrics/createStreamMetrics.js +19 -0
- package/dist/plugin/metrics/formatMetrics.d.ts +6 -3
- package/dist/plugin/metrics/formatMetrics.d.ts.map +1 -1
- package/dist/plugin/metrics/formatMetrics.js +5 -2
- package/dist/plugin/metrics/index.d.ts +3 -1
- package/dist/plugin/metrics/index.d.ts.map +1 -1
- package/dist/plugin/metrics/index.js +9 -1
- package/dist/plugin/metrics/types.d.ts +23 -0
- package/dist/plugin/metrics/types.d.ts.map +1 -0
- package/dist/plugin/metrics/types.js +1 -0
- package/dist/plugin/plugin.client.d.ts +23 -2
- package/dist/plugin/plugin.client.d.ts.map +1 -1
- package/dist/plugin/plugin.client.js +30 -17
- package/dist/plugin/plugin.server.d.ts +13 -2
- package/dist/plugin/plugin.server.d.ts.map +1 -1
- package/dist/plugin/plugin.server.js +7 -4
- package/dist/plugin/preserver/plugin.d.ts +2 -2
- package/dist/plugin/preserver/plugin.d.ts.map +1 -1
- package/dist/plugin/preserver/plugin.js +33 -29
- package/dist/plugin/react-client/cleanupWorkerServerAction.d.ts +11 -0
- package/dist/plugin/react-client/cleanupWorkerServerAction.d.ts.map +1 -0
- package/dist/plugin/react-client/cleanupWorkerServerAction.js +18 -0
- package/dist/plugin/react-client/configureWorkerRequestHandler.d.ts +9 -9
- package/dist/plugin/react-client/configureWorkerRequestHandler.d.ts.map +1 -1
- package/dist/plugin/react-client/configureWorkerRequestHandler.js +25 -14
- package/dist/plugin/react-client/createMessageHandlers.d.ts +1 -1
- package/dist/plugin/react-client/createMessageHandlers.d.ts.map +1 -1
- package/dist/plugin/react-client/createMessageHandlers.js +15 -3
- package/dist/plugin/react-client/createWorkerStream.d.ts +12 -10
- package/dist/plugin/react-client/createWorkerStream.d.ts.map +1 -1
- package/dist/plugin/react-client/createWorkerStream.js +27 -29
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts +13 -8
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts.map +1 -1
- package/dist/plugin/react-client/handleWorkerRscStream.js +59 -24
- package/dist/plugin/react-client/handleWorkerServerAction.d.ts +2 -1
- package/dist/plugin/react-client/handleWorkerServerAction.d.ts.map +1 -1
- package/dist/plugin/react-client/handleWorkerServerAction.js +43 -28
- package/dist/plugin/react-client/index.d.ts +4 -1
- package/dist/plugin/react-client/index.d.ts.map +1 -1
- package/dist/plugin/react-client/index.js +10 -1
- package/dist/plugin/react-client/plugin.d.ts +5 -3
- package/dist/plugin/react-client/plugin.d.ts.map +1 -1
- package/dist/plugin/react-client/plugin.js +9 -11
- package/dist/plugin/react-client/restartWorker.d.ts +5 -4
- package/dist/plugin/react-client/restartWorker.d.ts.map +1 -1
- package/dist/plugin/react-client/restartWorker.js +12 -10
- package/dist/plugin/react-server/configureReactServer.d.ts +5 -4
- package/dist/plugin/react-server/configureReactServer.d.ts.map +1 -1
- package/dist/plugin/react-server/configureReactServer.js +98 -43
- package/dist/plugin/react-server/handleServerAction.d.ts +3 -2
- package/dist/plugin/react-server/handleServerAction.d.ts.map +1 -1
- package/dist/plugin/react-server/handleServerAction.js +14 -20
- package/dist/plugin/react-server/plugin.d.ts +3 -4
- package/dist/plugin/react-server/plugin.d.ts.map +1 -1
- package/dist/plugin/react-server/plugin.js +14 -17
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts +8 -6
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts.map +1 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.js +4 -4
- package/dist/plugin/react-static/collectRscContent.d.ts +8 -6
- package/dist/plugin/react-static/collectRscContent.d.ts.map +1 -1
- package/dist/plugin/react-static/collectRscContent.js +4 -4
- package/dist/plugin/react-static/configurePreviewServer.d.ts +6 -4
- package/dist/plugin/react-static/configurePreviewServer.d.ts.map +1 -1
- package/dist/plugin/react-static/configurePreviewServer.js +38 -31
- package/dist/plugin/react-static/createBuildLoader.d.ts +5 -5
- package/dist/plugin/react-static/createBuildLoader.d.ts.map +1 -1
- package/dist/plugin/react-static/createBuildLoader.js +122 -30
- package/dist/plugin/react-static/fileWriter.js +1 -1
- package/dist/plugin/react-static/plugin.d.ts +3 -4
- package/dist/plugin/react-static/plugin.d.ts.map +1 -1
- package/dist/plugin/react-static/plugin.js +62 -47
- package/dist/plugin/react-static/renderPage.d.ts +4 -2
- package/dist/plugin/react-static/renderPage.d.ts.map +1 -1
- package/dist/plugin/react-static/renderPage.js +33 -17
- package/dist/plugin/react-static/renderPages.d.ts +4 -2
- package/dist/plugin/react-static/renderPages.d.ts.map +1 -1
- package/dist/plugin/react-static/renderPages.js +7 -6
- package/dist/plugin/react-static/renderStreams.d.ts +5 -22
- package/dist/plugin/react-static/renderStreams.d.ts.map +1 -1
- package/dist/plugin/react-static/renderStreams.js +6 -6
- package/dist/plugin/react-static/rscToHtmlStream.d.ts.map +1 -1
- package/dist/plugin/react-static/rscToHtmlStream.js +1 -1
- package/dist/plugin/react-static/temporaryReferences.js +1 -1
- package/dist/plugin/react-static/types.d.ts +0 -1
- package/dist/plugin/react-static/types.d.ts.map +1 -1
- package/dist/plugin/root.js +1 -1
- package/dist/plugin/transformer/plugin.js +1 -1
- package/dist/plugin/transformer/plugin.server.d.ts +5 -3
- package/dist/plugin/transformer/plugin.server.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.server.js +43 -44
- package/dist/plugin/types/css-tracking.d.ts +2 -2
- package/dist/plugin/types/css-tracking.d.ts.map +1 -1
- package/dist/plugin/types.d.ts +452 -192
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/types.js +2 -1
- package/dist/plugin/utils/callServer.js +1 -1
- package/dist/plugin/utils/createCallServer.d.ts +1 -1
- package/dist/plugin/utils/createCallServer.d.ts.map +1 -1
- package/dist/plugin/utils/createCallServer.js +1 -1
- package/dist/plugin/utils/createReactFetcher.d.ts +2 -3
- package/dist/plugin/utils/createReactFetcher.d.ts.map +1 -1
- package/dist/plugin/utils/createReactFetcher.js +1 -1
- package/dist/plugin/utils/env.js +1 -1
- package/dist/plugin/utils/envUrls.node.js +1 -1
- package/dist/plugin/utils/index.d.ts +1 -0
- package/dist/plugin/utils/index.d.ts.map +1 -1
- package/dist/plugin/utils/index.js +12 -5
- package/dist/plugin/utils/routeToURL.d.ts +12 -0
- package/dist/plugin/utils/routeToURL.d.ts.map +1 -0
- package/dist/plugin/utils/routeToURL.js +26 -0
- package/dist/plugin/utils/urls.d.ts.map +1 -1
- package/dist/plugin/utils/urls.js +5 -3
- package/dist/plugin/vendor/index.js +7 -1
- package/dist/plugin/vendor/vendor.client.js +1 -1
- package/dist/plugin/vendor/vendor.js +1 -1
- package/dist/plugin/vendor/vendor.server.js +1 -1
- package/dist/plugin/worker/createWorker.d.ts +31 -17
- package/dist/plugin/worker/createWorker.d.ts.map +1 -1
- package/dist/plugin/worker/createWorker.js +18 -12
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts +2 -2
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts.map +1 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js +5 -2
- package/dist/plugin/worker/html/html-worker.development.js +3 -3
- package/dist/plugin/worker/html/html-worker.production.js +1 -1
- package/dist/plugin/worker/html/index.d.ts +1 -1
- package/dist/plugin/worker/html/index.d.ts.map +1 -1
- package/dist/plugin/worker/html/index.js +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.js +9 -11
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.d.ts +3 -0
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.d.ts.map +1 -0
- package/dist/plugin/worker/html/sendHtmlWorkerMessage.js +2 -0
- package/dist/plugin/worker/html/types.d.ts +20 -2
- package/dist/plugin/worker/html/types.d.ts.map +1 -1
- package/dist/plugin/worker/index.d.ts +3 -0
- package/dist/plugin/worker/index.d.ts.map +1 -0
- package/dist/plugin/worker/index.js +7 -0
- package/dist/plugin/worker/registerLoaders.js +2 -2
- package/dist/plugin/worker/rsc/handleRender.d.ts +4 -3
- package/dist/plugin/worker/rsc/handleRender.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handleRender.js +54 -32
- package/dist/plugin/worker/rsc/handlers.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handlers.js +19 -15
- package/dist/plugin/worker/rsc/index.d.ts +1 -1
- package/dist/plugin/worker/rsc/index.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/index.js +1 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts +1 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.js +16 -4
- package/dist/plugin/worker/rsc/rsc-worker.development.js +77 -11
- package/dist/plugin/worker/rsc/rsc-worker.production.js +1 -1
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.d.ts +3 -0
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/sendRscWorkerMessage.js +11 -0
- package/dist/plugin/worker/rsc/state.js +1 -1
- package/dist/plugin/worker/rsc/types.d.ts +95 -0
- package/dist/plugin/worker/rsc/types.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/types.js +1 -0
- package/dist/plugin/worker/rsc/userOptions.d.ts +1 -1
- package/dist/plugin/worker/rsc/userOptions.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/userOptions.js +3 -4
- package/dist/plugin/worker/sendMessage.d.ts +3 -4
- package/dist/plugin/worker/sendMessage.d.ts.map +1 -1
- package/dist/plugin/worker/sendMessage.js +15 -5
- package/dist/plugin/worker/types.d.ts +109 -260
- package/dist/plugin/worker/types.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +58 -25
- package/plugin/components/{css-collector-elements.tsx → css.tsx} +3 -3
- package/plugin/components/html.tsx +4 -4
- package/plugin/components/index.ts +3 -3
- package/plugin/components/root.tsx +20 -0
- package/plugin/config/autoDiscover/resolveAutoDiscover.ts +173 -134
- package/plugin/config/autoDiscover/resolveBuildPages.ts +120 -7
- package/plugin/config/createModuleID.ts +60 -39
- package/plugin/config/defaults.tsx +184 -95
- package/plugin/config/extMap.ts +51 -56
- package/plugin/config/flightBindings.ts +221 -0
- package/plugin/config/getCondition.ts +6 -0
- package/plugin/config/index.ts +17 -4
- package/plugin/config/interpolatePattern.ts +19 -0
- package/plugin/config/parsePattern.ts +81 -0
- package/plugin/config/resolveAllowedDirectives.ts +59 -0
- package/plugin/config/resolveDirectiveMatcher.ts +57 -0
- package/plugin/config/resolveEnv.ts +5 -10
- package/plugin/config/resolveOptions.ts +415 -299
- package/plugin/config/resolvePatternWithValues.ts +70 -0
- package/plugin/config/resolveRegExp.ts +89 -0
- package/plugin/config/resolveUrlOption.ts +92 -20
- package/plugin/config/resolveUserConfig.ts +417 -351
- package/plugin/env/plugin.ts +71 -7
- package/plugin/error/directiveError.ts +29 -0
- package/plugin/error/enhanceError.ts +41 -0
- package/plugin/error/index.ts +3 -0
- package/plugin/error/logError.ts +45 -0
- package/plugin/error/serializeError.ts +34 -0
- package/plugin/error/toError.ts +75 -45
- package/plugin/file-preserver/plugin.ts +3 -3
- package/plugin/getNodeEnv.ts +24 -0
- package/plugin/helpers/cleanObject.ts +2 -1
- package/plugin/helpers/collectViteModuleGraphCss.ts +138 -118
- package/plugin/helpers/createCssProps.tsx +41 -20
- package/plugin/helpers/createEventHandler.ts +1 -1
- package/plugin/helpers/createHandler.ts +40 -12
- package/plugin/helpers/createRscStream.tsx +97 -35
- package/plugin/helpers/formatMetrics.ts +2 -37
- package/plugin/helpers/getBundleManifest.ts +10 -1
- package/plugin/helpers/getRouteFiles.ts +112 -8
- package/plugin/helpers/handleServerAction.ts +10 -6
- package/plugin/helpers/hydrateUserOptions.ts +23 -0
- package/plugin/helpers/index.ts +4 -0
- package/plugin/helpers/inputNormalizer.ts +44 -24
- package/plugin/helpers/metrics.ts +4 -64
- package/plugin/helpers/moduleResolver.ts +74 -19
- package/plugin/helpers/requestInfo.ts +72 -52
- package/plugin/helpers/requestToRoute.ts +38 -12
- package/plugin/helpers/resolveComponent.ts +173 -0
- package/plugin/helpers/resolveComponents.ts +185 -0
- package/plugin/helpers/resolvePage.ts +35 -29
- package/plugin/helpers/resolvePageAndProps.ts +82 -61
- package/plugin/helpers/resolveProps.ts +100 -37
- package/plugin/helpers/resolveUserComponents.ts +190 -0
- package/plugin/helpers/serializeUserOptions.ts +190 -69
- package/plugin/helpers/stashReturnValue.ts +7 -4
- package/plugin/helpers/tryManifest.ts +1 -1
- package/plugin/loader/createDefaultLoader.ts +119 -119
- package/plugin/loader/createTransformer.ts +118 -0
- package/plugin/loader/css-loader.ts +206 -0
- package/plugin/loader/directives/addLocalExportedNames.ts +78 -0
- package/plugin/loader/directives/analyzeDirectives.ts +298 -0
- package/plugin/loader/directives/analyzeModule.ts +39 -0
- package/plugin/loader/directives/collectExports.ts +181 -0
- package/plugin/loader/directives/collectExportsFromModule.ts +25 -0
- package/plugin/loader/directives/findDirectiveMatches.ts +58 -0
- package/plugin/loader/directives/getExportedName.ts +73 -0
- package/plugin/loader/directives/getExports.ts +27 -0
- package/plugin/loader/directives/getFunctionBody.ts +32 -0
- package/plugin/loader/directives/getFunctionName.ts +70 -0
- package/plugin/loader/directives/getQualifiedName.ts +76 -0
- package/plugin/loader/directives/index.ts +13 -0
- package/plugin/loader/directives/processFunctionNode.ts +97 -0
- package/plugin/loader/directives/typeGuards.ts +160 -0
- package/plugin/loader/directives/types.ts +174 -0
- package/plugin/loader/directives/utils.ts +35 -0
- package/plugin/loader/{env-loader.development.ts → env-loader.ts} +8 -22
- package/plugin/loader/index.ts +8 -6
- package/plugin/loader/parse.ts +42 -12
- package/plugin/loader/react-loader.ts +255 -4
- package/plugin/loader/removeDirectives.ts +14 -0
- package/plugin/loader/removeRanges.ts +21 -0
- package/plugin/loader/sourceMap.ts +174 -84
- package/plugin/loader/transformClientModule.ts +64 -0
- package/plugin/loader/transformModule.ts +54 -0
- package/plugin/loader/transformModuleIfNeeded.ts +40 -40
- package/plugin/loader/transformServerModule.ts +136 -0
- package/plugin/loader/transformWithAcornLoose.ts +27 -0
- package/plugin/loader/types.ts +65 -13
- package/plugin/metrics/collectStreamMetrics.ts +38 -0
- package/plugin/metrics/createRenderMetrics.ts +17 -0
- package/plugin/metrics/createStreamMetrics.ts +14 -0
- package/plugin/metrics/formatMetrics.ts +7 -3
- package/plugin/metrics/index.ts +3 -1
- package/plugin/metrics/types.ts +24 -0
- package/plugin/plugin.client.ts +39 -15
- package/plugin/plugin.server.ts +39 -18
- package/plugin/preserver/plugin.ts +42 -42
- package/plugin/react-client/cleanupWorkerServerAction.ts +33 -0
- package/plugin/react-client/configureWorkerRequestHandler.ts +212 -201
- package/plugin/react-client/createMessageHandlers.ts +17 -3
- package/plugin/react-client/createWorkerStream.ts +55 -51
- package/plugin/react-client/handleWorkerRscStream.ts +141 -61
- package/plugin/react-client/handleWorkerServerAction.ts +59 -37
- package/plugin/react-client/index.ts +4 -1
- package/plugin/react-client/plugin.ts +17 -18
- package/plugin/react-client/restartWorker.ts +75 -70
- package/plugin/react-server/configureReactServer.ts +200 -142
- package/plugin/react-server/handleServerAction.ts +156 -160
- package/plugin/react-server/plugin.ts +18 -25
- package/plugin/react-static/collectHtmlWorkerContent.ts +109 -102
- package/plugin/react-static/collectRscContent.ts +55 -51
- package/plugin/react-static/configurePreviewServer.ts +110 -100
- package/plugin/react-static/createBuildLoader.ts +157 -48
- package/plugin/react-static/plugin.ts +368 -357
- package/plugin/react-static/renderPage.ts +43 -24
- package/plugin/react-static/renderPages.ts +21 -14
- package/plugin/react-static/renderStreams.ts +13 -15
- package/plugin/react-static/rscToHtmlStream.ts +4 -6
- package/plugin/react-static/types.ts +0 -3
- package/plugin/transformer/README.md +82 -8
- package/plugin/transformer/plugin.server.ts +55 -82
- package/plugin/types/css-tracking.ts +1 -1
- package/plugin/types/global.d.ts +2 -2
- package/plugin/types/react-server-dom-esm.d.ts +12 -13
- package/plugin/types.ts +685 -309
- package/plugin/utils/createCallServer.ts +5 -5
- package/plugin/utils/createReactFetcher.ts +4 -6
- package/plugin/utils/index.ts +2 -1
- package/plugin/utils/routeToURL.ts +34 -0
- package/plugin/utils/urls.ts +9 -6
- package/plugin/worker/createWorker.ts +67 -34
- package/plugin/worker/html/README.md +10 -0
- package/plugin/worker/html/createHtmlWorkerRenderState.tsx +7 -4
- package/plugin/worker/html/html-worker.development.tsx +4 -3
- package/plugin/worker/html/index.ts +3 -1
- package/plugin/worker/html/messageHandler.tsx +10 -16
- package/plugin/worker/html/sendHtmlWorkerMessage.ts +8 -0
- package/plugin/worker/html/types.ts +67 -1
- package/plugin/worker/index.ts +2 -0
- package/plugin/worker/registerLoaders.ts +3 -3
- package/plugin/worker/rsc/README.md +203 -1
- package/plugin/worker/rsc/handleRender.ts +76 -39
- package/plugin/worker/rsc/handlers.ts +30 -22
- package/plugin/worker/rsc/index.ts +2 -0
- package/plugin/worker/rsc/messageHandler.tsx +17 -10
- package/plugin/worker/rsc/rsc-worker.development.ts +104 -17
- package/plugin/worker/rsc/sendRscWorkerMessage.ts +7 -0
- package/plugin/worker/rsc/state.ts +1 -1
- package/plugin/worker/rsc/types.ts +185 -0
- package/plugin/worker/rsc/userOptions.ts +2 -3
- package/plugin/worker/sendMessage.ts +23 -14
- package/plugin/worker/types.ts +131 -386
- package/scripts/check-react-version.mjs +3 -3
- package/scripts/fix-unused-imports.mjs +77 -0
- package/tsconfig.json +1 -1
- package/dist/_virtual/dynamic-import-helper.js.map +0 -1
- package/dist/client.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/plugin/components/css-collector-elements.d.ts.map +0 -1
- package/dist/plugin/components/css-collector-elements.js +0 -33
- package/dist/plugin/components/css-collector-elements.js.map +0 -1
- package/dist/plugin/components/css-collector.d.ts +0 -7
- package/dist/plugin/components/css-collector.d.ts.map +0 -1
- package/dist/plugin/components/css-collector.js +0 -18
- package/dist/plugin/components/css-collector.js.map +0 -1
- package/dist/plugin/components/html.js.map +0 -1
- package/dist/plugin/components.js +0 -9
- package/dist/plugin/components.js.map +0 -1
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js.map +0 -1
- package/dist/plugin/config/autoDiscover/customWorkerFiles.js.map +0 -1
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js.map +0 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js.map +0 -1
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js.map +0 -1
- package/dist/plugin/config/defaults.js.map +0 -1
- package/dist/plugin/config/extMap.js.map +0 -1
- package/dist/plugin/config/getCondition.js.map +0 -1
- package/dist/plugin/config/getPaths.js.map +0 -1
- package/dist/plugin/config/mimeTypes.js.map +0 -1
- package/dist/plugin/config/resolveAutoDiscoverMatcher.d.ts +0 -5
- package/dist/plugin/config/resolveAutoDiscoverMatcher.d.ts.map +0 -1
- package/dist/plugin/config/resolveAutoDiscoverMatcher.js +0 -25
- package/dist/plugin/config/resolveAutoDiscoverMatcher.js.map +0 -1
- package/dist/plugin/config/resolveEnv.js.map +0 -1
- package/dist/plugin/config/resolveOptions.js.map +0 -1
- package/dist/plugin/config/resolvePages.js.map +0 -1
- package/dist/plugin/config/resolveUrlOption.js.map +0 -1
- package/dist/plugin/config/resolveUserConfig.js.map +0 -1
- package/dist/plugin/config.js +0 -17
- package/dist/plugin/config.js.map +0 -1
- package/dist/plugin/env.js +0 -79
- package/dist/plugin/env.js.map +0 -1
- package/dist/plugin/error/toError.js.map +0 -1
- package/dist/plugin/file-preserver.js +0 -96
- package/dist/plugin/file-preserver.js.map +0 -1
- package/dist/plugin/helpers/cleanObject.js.map +0 -1
- package/dist/plugin/helpers/collectManifestCss.js.map +0 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.js.map +0 -1
- package/dist/plugin/helpers/createCssProps.js.map +0 -1
- package/dist/plugin/helpers/createEventHandler.js.map +0 -1
- package/dist/plugin/helpers/createHandler.js.map +0 -1
- package/dist/plugin/helpers/createRscStream.js.map +0 -1
- package/dist/plugin/helpers/formatMetrics.js.map +0 -1
- package/dist/plugin/helpers/getBundleManifest.js.map +0 -1
- package/dist/plugin/helpers/getRouteFiles.js.map +0 -1
- package/dist/plugin/helpers/handleServerAction.js.map +0 -1
- package/dist/plugin/helpers/inputNormalizer.js.map +0 -1
- package/dist/plugin/helpers/metrics.js.map +0 -1
- package/dist/plugin/helpers/moduleRefs.js.map +0 -1
- package/dist/plugin/helpers/requestInfo.js.map +0 -1
- package/dist/plugin/helpers/requestToRoute.js.map +0 -1
- package/dist/plugin/helpers/resolvePage.js.map +0 -1
- package/dist/plugin/helpers/resolvePageAndProps.js.map +0 -1
- package/dist/plugin/helpers/resolveProps.js.map +0 -1
- package/dist/plugin/helpers/serializeUserOptions.js.map +0 -1
- package/dist/plugin/helpers/sourceMap.d.ts +0 -8
- package/dist/plugin/helpers/sourceMap.d.ts.map +0 -1
- package/dist/plugin/helpers/sourceMap.js +0 -136
- package/dist/plugin/helpers/stashReturnValue.js.map +0 -1
- package/dist/plugin/helpers/tryManifest.js.map +0 -1
- package/dist/plugin/helpers.js +0 -27
- package/dist/plugin/helpers.js.map +0 -1
- package/dist/plugin/loader/css-loader.development.d.ts.map +0 -1
- package/dist/plugin/loader/css-loader.development.js +0 -76
- package/dist/plugin/loader/css-loader.development.js.map +0 -1
- package/dist/plugin/loader/css-loader.production.d.ts +0 -31
- package/dist/plugin/loader/css-loader.production.d.ts.map +0 -1
- package/dist/plugin/loader/css-loader.production.js +0 -45
- package/dist/plugin/loader/css-loader.production.js.map +0 -1
- package/dist/plugin/loader/env-loader.development.d.ts +0 -13
- package/dist/plugin/loader/env-loader.development.d.ts.map +0 -1
- package/dist/plugin/loader/env-loader.development.js +0 -68
- package/dist/plugin/loader/handleExports.d.ts +0 -40
- package/dist/plugin/loader/handleExports.d.ts.map +0 -1
- package/dist/plugin/loader/handleExports.js +0 -209
- package/dist/plugin/loader/handleExports.js.map +0 -1
- package/dist/plugin/loader/parse.js.map +0 -1
- package/dist/plugin/loader/react-loader.client.d.ts +0 -2
- package/dist/plugin/loader/react-loader.client.d.ts.map +0 -1
- package/dist/plugin/loader/react-loader.client.js +0 -2
- package/dist/plugin/loader/react-loader.js.map +0 -1
- package/dist/plugin/loader/react-loader.server.d.ts +0 -21
- package/dist/plugin/loader/react-loader.server.d.ts.map +0 -1
- package/dist/plugin/loader/react-loader.server.js +0 -131
- package/dist/plugin/loader/transformModuleIfNeeded.js.map +0 -1
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.d.ts +0 -48
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.d.ts.map +0 -1
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.js +0 -428
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.js.map +0 -1
- package/dist/plugin/metrics/formatMetrics.js.map +0 -1
- package/dist/plugin/metrics.js +0 -7
- package/dist/plugin/metrics.js.map +0 -1
- package/dist/plugin/plugin.client.js.map +0 -1
- package/dist/plugin/plugin.server.js.map +0 -1
- package/dist/plugin/preserver/plugin.js.map +0 -1
- package/dist/plugin/react-client/configureWorkerRequestHandler.js.map +0 -1
- package/dist/plugin/react-client/createMessageHandlers.js.map +0 -1
- package/dist/plugin/react-client/createWorkerStream.js.map +0 -1
- package/dist/plugin/react-client/handleWorkerRscStream.js.map +0 -1
- package/dist/plugin/react-client/handleWorkerServerAction.js.map +0 -1
- package/dist/plugin/react-client/plugin.js.map +0 -1
- package/dist/plugin/react-client/restartWorker.js.map +0 -1
- package/dist/plugin/react-server/configureReactServer.js.map +0 -1
- package/dist/plugin/react-server/handleServerAction.js.map +0 -1
- package/dist/plugin/react-server/plugin.js.map +0 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.js.map +0 -1
- package/dist/plugin/react-static/collectRscContent.js.map +0 -1
- package/dist/plugin/react-static/configurePreviewServer.js.map +0 -1
- package/dist/plugin/react-static/createBuildLoader.js.map +0 -1
- package/dist/plugin/react-static/fileWriter.js.map +0 -1
- package/dist/plugin/react-static/plugin.js.map +0 -1
- package/dist/plugin/react-static/renderPage.js.map +0 -1
- package/dist/plugin/react-static/renderPages.js.map +0 -1
- package/dist/plugin/react-static/renderStreams.js.map +0 -1
- package/dist/plugin/react-static/rscToHtmlStream.js.map +0 -1
- package/dist/plugin/react-static/temporaryReferences.js.map +0 -1
- package/dist/plugin/root.js.map +0 -1
- package/dist/plugin/source-map/createMappingsSerializer.d.ts +0 -2
- package/dist/plugin/source-map/createMappingsSerializer.d.ts.map +0 -1
- package/dist/plugin/source-map/createMappingsSerializer.js +0 -129
- package/dist/plugin/source-map/createMappingsSerializer.js.map +0 -1
- package/dist/plugin/source-map/readMappings.d.ts +0 -2
- package/dist/plugin/source-map/readMappings.d.ts.map +0 -1
- package/dist/plugin/source-map/readMappings.js +0 -200
- package/dist/plugin/transformer/plugin.client.d.ts +0 -2
- package/dist/plugin/transformer/plugin.client.d.ts.map +0 -1
- package/dist/plugin/transformer/plugin.js.map +0 -1
- package/dist/plugin/transformer/plugin.server.js.map +0 -1
- package/dist/plugin/utils/callServer.js.map +0 -1
- package/dist/plugin/utils/createCallServer.js.map +0 -1
- package/dist/plugin/utils/createReactFetcher.js.map +0 -1
- package/dist/plugin/utils/env.js.map +0 -1
- package/dist/plugin/utils/envUrls.node.js.map +0 -1
- package/dist/plugin/utils/urls.js.map +0 -1
- package/dist/plugin/utils.js +0 -11
- package/dist/plugin/utils.js.map +0 -1
- package/dist/plugin/vendor/vendor.client.js.map +0 -1
- package/dist/plugin/vendor/vendor.js.map +0 -1
- package/dist/plugin/vendor/vendor.server.js.map +0 -1
- package/dist/plugin/vendor.js +0 -7
- package/dist/plugin/vendor.js.map +0 -1
- package/dist/plugin/worker/createWorker.js.map +0 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js.map +0 -1
- package/dist/plugin/worker/html/html-worker.development.js.map +0 -1
- package/dist/plugin/worker/html/html-worker.production.js.map +0 -1
- package/dist/plugin/worker/html/index.js.map +0 -1
- package/dist/plugin/worker/html/messageHandler.js.map +0 -1
- package/dist/plugin/worker/rsc/handleRender.js.map +0 -1
- package/dist/plugin/worker/rsc/handlers.js.map +0 -1
- package/dist/plugin/worker/rsc/index.js.map +0 -1
- package/dist/plugin/worker/rsc/messageHandler.js.map +0 -1
- package/dist/plugin/worker/rsc/rsc-worker.development.js.map +0 -1
- package/dist/plugin/worker/rsc/rsc-worker.production.js.map +0 -1
- package/dist/plugin/worker/rsc/state.js.map +0 -1
- package/dist/plugin/worker/rsc/userOptions.js.map +0 -1
- package/dist/plugin/worker/sendMessage.js.map +0 -1
- package/dist/server.js.map +0 -1
- package/plugin/components/css-collector.tsx +0 -20
- package/plugin/config/resolveAutoDiscoverMatcher.ts +0 -23
- package/plugin/helpers/sourceMap.ts +0 -182
- package/plugin/loader/css-loader.development.ts +0 -135
- package/plugin/loader/css-loader.production.ts +0 -84
- package/plugin/loader/handleExports.ts +0 -309
- package/plugin/loader/react-loader.client.ts +0 -1
- package/plugin/loader/react-loader.server.ts +0 -185
- package/plugin/loader/transformModuleWithPreservedFunctions.ts +0 -593
- package/plugin/source-map/createMappingsSerializer.ts +0 -181
- package/plugin/source-map/readMappings.ts +0 -194
- package/plugin/transformer/plugin.client.ts +0 -0
- /package/dist/plugin/{transformer/plugin.client.js → loader/directives/types.js} +0 -0
package/dist/plugin/helpers.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite-plugin-react-server
|
|
3
|
-
* Copyright (c) Nico Brinkkemper
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
export { getRouteFiles } from './helpers/getRouteFiles.js';
|
|
7
|
-
export { resolvePage } from './helpers/resolvePage.js';
|
|
8
|
-
export { resolveProps } from './helpers/resolveProps.js';
|
|
9
|
-
export { resolvePageAndProps } from './helpers/resolvePageAndProps.js';
|
|
10
|
-
export { requestInfo } from './helpers/requestInfo.js';
|
|
11
|
-
export { requestToRoute } from './helpers/requestToRoute.js';
|
|
12
|
-
export { deserializeRegExp, hydrateUserOptions, processForSerialization, serializeResolvedConfig, serializedDevServerConfig, serializedOptions } from './helpers/serializeUserOptions.js';
|
|
13
|
-
export { cleanObject } from './helpers/cleanObject.js';
|
|
14
|
-
export { createInputNormalizer } from './helpers/inputNormalizer.js';
|
|
15
|
-
export { collectManifestCss } from './helpers/collectManifestCss.js';
|
|
16
|
-
export { collectViteModuleGraphCss } from './helpers/collectViteModuleGraphCss.js';
|
|
17
|
-
export { createCssProps } from './helpers/createCssProps.js';
|
|
18
|
-
export { createRscStream } from './helpers/createRscStream.js';
|
|
19
|
-
export { createHandler } from './helpers/createHandler.js';
|
|
20
|
-
export { createEventHandler } from './helpers/createEventHandler.js';
|
|
21
|
-
export { formatMetrics, logMetrics } from './helpers/formatMetrics.js';
|
|
22
|
-
export { collectStreamMetrics, createRenderMetrics, createStreamMetrics } from './helpers/metrics.js';
|
|
23
|
-
export { tryManifest } from './helpers/tryManifest.js';
|
|
24
|
-
export { getBundleManifest } from './helpers/getBundleManifest.js';
|
|
25
|
-
export { getModuleRef, moduleRefs } from './helpers/moduleRefs.js';
|
|
26
|
-
export { stashReturnValue } from './helpers/stashReturnValue.js';
|
|
27
|
-
//# sourceMappingURL=helpers.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"css-loader.development.d.ts","sourceRoot":"","sources":["../../../plugin/loader/css-loader.development.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAuB,oBAAoB,EAAE,qBAAqB,EAAE,MAAM,aAAa,CAAC;AAUnH;;;GAGG;AACH,eAAO,IAAI,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;AAK/C;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAC;IAAC,cAAc,EAAE,oBAAoB,CAAC;IAAC,WAAW,EAAE,qBAAqB,CAAA;CAAE,iBASjJ;AA+DD;;;;;;;;;GASG;AACH,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,eAAe,GAAG,aAAa,GAAG;IAAE,cAAc,EAAE,oBAAoB,CAAA;CAAE,EACnF,WAAW,EAAE,GAAG,gBAQjB;AAED;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,OAE3E"}
|
|
@@ -1,76 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite-plugin-react-server
|
|
3
|
-
* Copyright (c) Nico Brinkkemper
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
import 'node:worker_threads';
|
|
7
|
-
import { fileURLToPath } from 'node:url';
|
|
8
|
-
import { preprocessCSS } from 'vite';
|
|
9
|
-
import { readFile } from 'node:fs/promises';
|
|
10
|
-
import { env } from '../utils/env.js';
|
|
11
|
-
import { resolveOptions } from '../config/resolveOptions.js';
|
|
12
|
-
import { hydrateUserOptions } from '../helpers/serializeUserOptions.js';
|
|
13
|
-
|
|
14
|
-
let loaderPort;
|
|
15
|
-
let resolvedConfig;
|
|
16
|
-
let userOptions;
|
|
17
|
-
async function initialize(data) {
|
|
18
|
-
loaderPort = data.port;
|
|
19
|
-
resolvedConfig = data.resolvedConfig;
|
|
20
|
-
const resolvedUserOptions = resolveOptions(hydrateUserOptions(data.userOptions));
|
|
21
|
-
if (resolvedUserOptions.type === "error") {
|
|
22
|
-
throw new Error(resolvedUserOptions.error.message);
|
|
23
|
-
}
|
|
24
|
-
userOptions = resolvedUserOptions.userOptions;
|
|
25
|
-
data.port.postMessage({ type: "INITIALIZED_CSS_LOADER", id: data.id });
|
|
26
|
-
}
|
|
27
|
-
async function processCssFile(filePath, config, inline) {
|
|
28
|
-
try {
|
|
29
|
-
const path = filePath.startsWith("file://") ? fileURLToPath(filePath) : filePath;
|
|
30
|
-
const source = await readFile(path, "utf-8");
|
|
31
|
-
let moduleID = path;
|
|
32
|
-
if (userOptions?.normalizer) {
|
|
33
|
-
let [, value] = userOptions.normalizer(path);
|
|
34
|
-
moduleID = userOptions.moduleID(value || path);
|
|
35
|
-
}
|
|
36
|
-
const processed = await preprocessCSS(source, path, {
|
|
37
|
-
...config,
|
|
38
|
-
env
|
|
39
|
-
});
|
|
40
|
-
if (loaderPort) {
|
|
41
|
-
loaderPort.postMessage({
|
|
42
|
-
type: "CSS_FILE",
|
|
43
|
-
id: moduleID,
|
|
44
|
-
content: processed.code
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
if (inline) {
|
|
48
|
-
return {
|
|
49
|
-
format: "module",
|
|
50
|
-
source: processed.code,
|
|
51
|
-
shortCircuit: true
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
return {
|
|
55
|
-
format: "module",
|
|
56
|
-
source: `export default ${JSON.stringify(processed.modules || {})};`,
|
|
57
|
-
shortCircuit: true
|
|
58
|
-
};
|
|
59
|
-
} catch (error) {
|
|
60
|
-
console.error(`[css-loader] Error processing CSS file: ${error}`);
|
|
61
|
-
throw error;
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
async function load(url, context, defaultLoad) {
|
|
65
|
-
const [name, query] = url.split("?");
|
|
66
|
-
if (name.endsWith(".css")) {
|
|
67
|
-
return processCssFile(url, resolvedConfig, query === "inline");
|
|
68
|
-
}
|
|
69
|
-
return defaultLoad(url, context, defaultLoad);
|
|
70
|
-
}
|
|
71
|
-
function resolve(specifier, context, defaultResolve) {
|
|
72
|
-
return defaultResolve(specifier, context, defaultResolve);
|
|
73
|
-
}
|
|
74
|
-
|
|
75
|
-
export { initialize, load, loaderPort, resolve };
|
|
76
|
-
//# sourceMappingURL=css-loader.development.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"css-loader.development.js","sources":["../../../plugin/loader/css-loader.development.ts"],"sourcesContent":["import { type MessagePort } from \"node:worker_threads\";\nimport type { LoadHookContext } from \"node:module\";\nimport type { LoaderContext, ResolvedUserOptions, SerializedUserConfig, SerializedUserOptions } from \"../types.js\";\nimport { fileURLToPath } from \"node:url\";\nimport { preprocessCSS } from \"vite\";\nimport type { ResolvedConfig } from \"vite\";\nimport { readFile } from \"node:fs/promises\";\nimport { env } from \"../utils/env.js\";\nimport type { InitializedCssLoaderMessage } from \"../worker/types.js\";\nimport { resolveOptions } from \"../config/resolveOptions.js\";\nimport { hydrateUserOptions } from \"../helpers/index.js\";\n\n/**\n * Global port for communication between the main thread and the CSS loader.\n * This port is used to send CSS file requests and receive responses.\n */\nexport let loaderPort: MessagePort | undefined;\n\nlet resolvedConfig: ResolvedConfig | undefined;\nlet userOptions: ResolvedUserOptions | undefined; \n\n/**\n * Initializes the CSS loader with the necessary communication channels.\n * Sets up message handlers for CSS file requests and responses.\n *\n * @param data - Configuration data for the CSS loader\n * @param data.port - The message port for communication\n */\nexport async function initialize(data: { id: string, port: MessagePort, resolvedConfig: SerializedUserConfig, userOptions: SerializedUserOptions }) {\n loaderPort = data.port;\n resolvedConfig = data.resolvedConfig;\n const resolvedUserOptions = resolveOptions(hydrateUserOptions(data.userOptions));\n if(resolvedUserOptions.type === \"error\") {\n throw new Error(resolvedUserOptions.error.message);\n }\n userOptions = resolvedUserOptions.userOptions;\n data.port.postMessage({ type: \"INITIALIZED_CSS_LOADER\", id: data.id } satisfies InitializedCssLoaderMessage);\n}\n\n\n\n/**\n * Processes a CSS file request.\n * Sends a request to the main thread and waits for the processed CSS.\n *\n * @param filePath - The file system path of the CSS file\n * @param config - The Vite config\n * @returns A promise that resolves to the processed CSS content\n */\nasync function processCssFile(\n filePath: string,\n config: ResolvedConfig,\n inline: boolean\n): Promise<{ format: string; source: string; shortCircuit: boolean }> {\n try {\n // Convert file URL to path if needed\n const path = filePath.startsWith(\"file://\")\n ? fileURLToPath(filePath)\n : filePath;\n\n // Process CSS using Vite's preprocessCSS\n const source = await readFile(path, \"utf-8\");\n let moduleID = path;\n if(userOptions?.normalizer) {\n let [,value] = userOptions.normalizer(path);\n moduleID = userOptions.moduleID(value || path);\n }\n const processed = await preprocessCSS(source, path, {\n ...config,\n env: env\n });\n\n // If we're processing CSS for a specific page, notify the message handler\n if (loaderPort) {\n loaderPort.postMessage({\n type: \"CSS_FILE\",\n id: moduleID,\n content: processed.code\n });\n }\n\n // Return a module that can be used by React components\n if (inline) {\n return {\n format: \"module\",\n source: processed.code,\n shortCircuit: true,\n };\n }\n return {\n format: \"module\",\n source: `export default ${JSON.stringify(processed.modules || {})};`,\n shortCircuit: true,\n };\n } catch (error) {\n console.error(`[css-loader] Error processing CSS file: ${error}`);\n throw error;\n }\n}\n\n/**\n * Vite's load hook implementation for CSS files.\n * Handles CSS file loading requests and returns a placeholder module.\n * The actual CSS content is processed in the main thread.\n *\n * @param url - The URL of the module to load\n * @param context - The load hook context\n * @param defaultLoad - The default load function\n * @returns A promise that resolves to the module content\n */\nexport async function load(\n url: string,\n context: LoadHookContext & LoaderContext & { resolvedConfig: SerializedUserConfig },\n defaultLoad: any\n) {\n const [name, query] = url.split(\"?\");\n if (name.endsWith(\".css\")) {\n return processCssFile(url, resolvedConfig as ResolvedConfig, query === \"inline\");\n }\n\n return defaultLoad(url, context, defaultLoad);\n}\n\n/**\n * Vite's resolve hook implementation.\n * Handles module resolution during development.\n *\n * @param specifier - The module specifier to resolve\n * @param context - The resolve hook context\n * @param defaultResolve - The default resolve function\n * @returns A promise that resolves to the resolved module\n */\nexport function resolve(specifier: string, context: any, defaultResolve: any) {\n return defaultResolve(specifier, context, defaultResolve);\n}\n"],"names":[],"mappings":";;;;;;;;;;;;;AAgBW,IAAA;AAEX,IAAI,cAAA;AACJ,IAAI,WAAA;AASJ,eAAsB,WAAW,IAAmH,EAAA;AAClJ,EAAA,UAAA,GAAa,IAAK,CAAA,IAAA;AAClB,EAAA,cAAA,GAAiB,IAAK,CAAA,cAAA;AACtB,EAAA,MAAM,mBAAsB,GAAA,cAAA,CAAe,kBAAmB,CAAA,IAAA,CAAK,WAAW,CAAC,CAAA;AAC/E,EAAG,IAAA,mBAAA,CAAoB,SAAS,OAAS,EAAA;AACvC,IAAA,MAAM,IAAI,KAAA,CAAM,mBAAoB,CAAA,KAAA,CAAM,OAAO,CAAA;AAAA;AAEnD,EAAA,WAAA,GAAc,mBAAoB,CAAA,WAAA;AAClC,EAAK,IAAA,CAAA,IAAA,CAAK,YAAY,EAAE,IAAA,EAAM,0BAA0B,EAAI,EAAA,IAAA,CAAK,IAA0C,CAAA;AAC7G;AAYA,eAAe,cAAA,CACb,QACA,EAAA,MAAA,EACA,MACoE,EAAA;AACpE,EAAI,IAAA;AAEF,IAAA,MAAM,OAAO,QAAS,CAAA,UAAA,CAAW,SAAS,CACtC,GAAA,aAAA,CAAc,QAAQ,CACtB,GAAA,QAAA;AAGJ,IAAA,MAAM,MAAS,GAAA,MAAM,QAAS,CAAA,IAAA,EAAM,OAAO,CAAA;AAC3C,IAAA,IAAI,QAAW,GAAA,IAAA;AACf,IAA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AAU,QAAQ,CAAA;AAAA;AAGjF,EAAO,OAAA,WAAA,CAAY,GAAK,EAAA,OAAA,EAAS,WAAW,CAAA;AAC9C;AAWO,SAAS,OAAA,CAAQ,SAAmB,EAAA,OAAA,EAAc,cAAqB,EAAA;AAC5E,EAAO,OAAA,cAAA,CAAe,SAAW,EAAA,OAAA,EAAS,cAAc,CAAA;AAC1D;;;;"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import type { MessagePort } from "node:worker_threads";
|
|
2
|
-
import type { LoadHookContext } from "node:module";
|
|
3
|
-
import type { LoaderContext } from "../types.js";
|
|
4
|
-
/**
|
|
5
|
-
* Global port for communication between the main thread and the CSS loader.
|
|
6
|
-
* This port is used to send CSS file requests and receive responses.
|
|
7
|
-
*/
|
|
8
|
-
export declare let loaderPort: MessagePort | undefined;
|
|
9
|
-
/**
|
|
10
|
-
* Initializes the CSS loader with the necessary communication channels.
|
|
11
|
-
* Sets up message handlers for CSS file requests and responses.
|
|
12
|
-
*
|
|
13
|
-
* @param data - Configuration data for the CSS loader
|
|
14
|
-
* @param data.port - The message port for communication
|
|
15
|
-
*/
|
|
16
|
-
export declare function initialize(data: {
|
|
17
|
-
id: string;
|
|
18
|
-
port: MessagePort;
|
|
19
|
-
}): Promise<void>;
|
|
20
|
-
/**
|
|
21
|
-
* Vite's load hook implementation for CSS files.
|
|
22
|
-
* Handles CSS file loading requests and returns a placeholder module.
|
|
23
|
-
* The actual CSS content is processed in the main thread.
|
|
24
|
-
*
|
|
25
|
-
* @param url - The URL of the module to load
|
|
26
|
-
* @param context - The load hook context
|
|
27
|
-
* @param defaultLoad - The default load function
|
|
28
|
-
* @returns A promise that resolves to the module content
|
|
29
|
-
*/
|
|
30
|
-
export declare function load(url: string, context: LoadHookContext & LoaderContext, defaultLoad: any): Promise<any>;
|
|
31
|
-
//# sourceMappingURL=css-loader.production.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"css-loader.production.d.ts","sourceRoot":"","sources":["../../../plugin/loader/css-loader.production.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAIjD;;;GAGG;AACH,eAAO,IAAI,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;AAI/C;;;;;;GAMG;AACH,wBAAsB,UAAU,CAAC,IAAI,EAAE;IAAE,EAAE,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,WAAW,CAAA;CAAE,iBAGvE;AAqCD;;;;;;;;;GASG;AACH,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,eAAe,GAAG,aAAa,EACxC,WAAW,EAAE,GAAG,gBASjB"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite-plugin-react-server
|
|
3
|
-
* Copyright (c) Nico Brinkkemper
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
import { fileURLToPath } from 'node:url';
|
|
7
|
-
import { readFile } from 'node:fs/promises';
|
|
8
|
-
|
|
9
|
-
let loaderPort;
|
|
10
|
-
let stashedCssFiles = /* @__PURE__ */ new Map();
|
|
11
|
-
async function initialize(data) {
|
|
12
|
-
loaderPort = data.port;
|
|
13
|
-
data.port.postMessage({ type: "INITIALIZED_CSS_LOADER", id: data.id });
|
|
14
|
-
}
|
|
15
|
-
async function processCssFile(filePath) {
|
|
16
|
-
try {
|
|
17
|
-
const path = filePath.startsWith("file://") ? fileURLToPath(filePath) : filePath;
|
|
18
|
-
if (stashedCssFiles.has(filePath)) {
|
|
19
|
-
return {
|
|
20
|
-
format: "module",
|
|
21
|
-
source: stashedCssFiles.get(filePath),
|
|
22
|
-
shortCircuit: true
|
|
23
|
-
};
|
|
24
|
-
}
|
|
25
|
-
const source = await readFile(path, "utf-8");
|
|
26
|
-
stashedCssFiles.set(path, source);
|
|
27
|
-
return {
|
|
28
|
-
format: "module",
|
|
29
|
-
source,
|
|
30
|
-
shortCircuit: true
|
|
31
|
-
};
|
|
32
|
-
} catch (error) {
|
|
33
|
-
throw error;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
async function load(url, context, defaultLoad) {
|
|
37
|
-
const [name] = url.split("?");
|
|
38
|
-
if (name.endsWith(".css")) {
|
|
39
|
-
return processCssFile(url);
|
|
40
|
-
}
|
|
41
|
-
return defaultLoad(url, context, defaultLoad);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
export { initialize, load, loaderPort };
|
|
45
|
-
//# sourceMappingURL=css-loader.production.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"css-loader.production.js","sources":["../../../plugin/loader/css-loader.production.ts"],"sourcesContent":["import type { MessagePort } from \"node:worker_threads\";\nimport type { LoadHookContext } from \"node:module\";\nimport type { LoaderContext } from \"../types.js\";\nimport { fileURLToPath } from \"node:url\";\nimport { readFile } from \"node:fs/promises\";\n\n/**\n * Global port for communication between the main thread and the CSS loader.\n * This port is used to send CSS file requests and receive responses.\n */\nexport let loaderPort: MessagePort | undefined;\n\nlet stashedCssFiles = new Map();\n\n/**\n * Initializes the CSS loader with the necessary communication channels.\n * Sets up message handlers for CSS file requests and responses.\n *\n * @param data - Configuration data for the CSS loader\n * @param data.port - The message port for communication\n */\nexport async function initialize(data: { id: string, port: MessagePort }) {\n loaderPort = data.port;\n data.port.postMessage({ type: \"INITIALIZED_CSS_LOADER\", id: data.id });\n}\n\n/**\n * Processes a CSS file request.\n * Sends a request to the main thread and waits for the processed CSS.\n *\n * @param filePath - The file system path of the CSS file\n * @returns A promise that resolves to the processed CSS content\n */\nasync function processCssFile(\n filePath: string\n): Promise<{ format: string; source: string; shortCircuit: boolean }> {\n try {\n // Convert file URL to path if needed\n const path = filePath.startsWith(\"file://\")\n ? fileURLToPath(filePath)\n : filePath;\n if (stashedCssFiles.has(filePath)) {\n return {\n format: \"module\",\n source: stashedCssFiles.get(filePath),\n shortCircuit: true,\n };\n }\n // Process CSS using Vite's preprocessCSS\n const source = await readFile(path, \"utf-8\");\n stashedCssFiles.set(path, source);\n return {\n format: \"module\",\n source: source,\n shortCircuit: true,\n };\n } catch (error) {\n throw error;\n }\n}\n\n/**\n * Vite's load hook implementation for CSS files.\n * Handles CSS file loading requests and returns a placeholder module.\n * The actual CSS content is processed in the main thread.\n *\n * @param url - The URL of the module to load\n * @param context - The load hook context\n * @param defaultLoad - The default load function\n * @returns A promise that resolves to the module content\n */\nexport async function load(\n url: string,\n context: LoadHookContext & LoaderContext,\n defaultLoad: any\n) {\n // Handle CSS files\n const [name] = url.split(\"?\");\n if (name.endsWith(\".css\")) {\n return processCssFile(url);\n }\n\n return defaultLoad(url, context, defaultLoad);\n}\n"],"names":[],"mappings":";;;;;;;;AAUW,IAAA;AAEX,IAAI,eAAA,uBAAsB,GAAI,EAAA;AAS9B,eAAsB,WAAW,IAAyC,EAAA;AACxE,EAAA,UAAA,GAAa,IAAK,CAAA,IAAA;AAClB,EAAK,IAAA,CAAA,IAAA,CAAK,YAAY,EAAE,IAAA,EAAM,0BAA0B,EAAI,EAAA,IAAA,CAAK,IAAI,CAAA;AACvE;AASA,eAAe,eACb,QACoE,EAAA;AACpE,EAAI,IAAA;AAEF,IAAA,MAAM,OAAO,QAAS,CAAA,UAAA,CAAW,SAAS,CACtC,GAAA,aAAA,CAAc,QAAQ,CACtB,GAAA,QAAA;AACJ,IAAI,IAAA,eAAA,CAAgB,GAAI,CAAA,QAAQ,CAAG,EAAA;AACjC,MAAO,OAAA;AAAA,QACL,MAAQ,EAAA,QAAA;AAAA,QACR,MAAA,EAAQ,eAAgB,CAAA,GAAA,CAAI,QAAQ,CAAA;AAAA,QACpC,YAAc,EAAA;AAAA,OAChB;AAAA;AAGF,IAAA,MAAM,MAAS,GAAA,MAAM,QAAS,CAAA,IAAA,EAAM,OAAO,CAAA;AAC3C,IAAgB,eAAA,CAAA,GAAA,CAAI,MAAM,MAAM,CAAA;AAChC,IAAO,OAAA;AAAA,MACL,MAAQ,EAAA,QAAA;AAAA,MACR,MAAA;AAAA,MACA,YAAc,EAAA;AAAA,KAChB;AAAA,WACO,KAAO,EAAA;AACd,IAAM,MAAA,KAAA;AAAA;AAEV;AAYA,eAAsB,IAAA,CACpB,GACA,EAAA,OAAA,EACA,WACA,EAAA;AAEA,EAAA,MAAM,CAAC,IAAI,CAAI,GAAA,GAAA,CAAI,MAAM,GAAG,CAAA;AAC5B,EAAI,IAAA,IAAA,CAAK,QAAS,CAAA,MAAM,CAAG,EAAA;AACzB,IAAA,OAAO,eAAe,GAAG,CAAA;AAAA;AAG3B,EAAO,OAAA,WAAA,CAAY,GAAK,EAAA,OAAA,EAAS,WAAW,CAAA;AAC9C;;;;"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import type { LoadHookContext } from "node:module";
|
|
2
|
-
import type { LoaderContext } from "../types.js";
|
|
3
|
-
import type { MessagePort } from "node:worker_threads";
|
|
4
|
-
import type { ResolvedConfig } from "vite";
|
|
5
|
-
export declare let loaderPort: MessagePort | undefined;
|
|
6
|
-
export declare function initialize(data: {
|
|
7
|
-
id: string;
|
|
8
|
-
port: MessagePort;
|
|
9
|
-
resolvedConfig: ResolvedConfig;
|
|
10
|
-
}): Promise<void>;
|
|
11
|
-
export declare function load(url: string, context: LoadHookContext & LoaderContext, nextLoad: any): Promise<any>;
|
|
12
|
-
export declare function transformSource(source: string, context: any, defaultTransformSource: any): Promise<any>;
|
|
13
|
-
//# sourceMappingURL=env-loader.development.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"env-loader.development.d.ts","sourceRoot":"","sources":["../../../plugin/loader/env-loader.development.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AACjD,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AACvD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,MAAM,CAAC;AAG3C,eAAO,IAAI,UAAU,EAAE,WAAW,GAAG,SAAS,CAAC;AAI/C,wBAAsB,UAAU,CAAC,IAAI,EAAE;IACrC,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,WAAW,CAAC;IAClB,cAAc,EAAE,cAAc,CAAC;CAChC,iBAQA;AAGD,wBAAsB,IAAI,CACxB,GAAG,EAAE,MAAM,EACX,OAAO,EAAE,eAAe,GAAG,aAAa,EACxC,QAAQ,EAAE,GAAG,gBAgEd;AAGD,wBAAsB,eAAe,CACnC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,GAAG,EACZ,sBAAsB,EAAE,GAAG,gBAQ5B"}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
export let loaderPort;
|
|
2
|
-
let resolvedConfig;
|
|
3
|
-
// Initialize hook
|
|
4
|
-
export async function initialize(data) {
|
|
5
|
-
loaderPort = data.port;
|
|
6
|
-
resolvedConfig = data.resolvedConfig;
|
|
7
|
-
data.port.postMessage({
|
|
8
|
-
type: "INITIALIZED_ENV_LOADER",
|
|
9
|
-
id: data.id,
|
|
10
|
-
env: {},
|
|
11
|
-
});
|
|
12
|
-
}
|
|
13
|
-
// Load hook
|
|
14
|
-
export async function load(url, context, nextLoad) {
|
|
15
|
-
const result = await nextLoad(url, context);
|
|
16
|
-
// Skip if not a module
|
|
17
|
-
if (result.format !== "module") {
|
|
18
|
-
return result;
|
|
19
|
-
}
|
|
20
|
-
// Skip node internals and hidden files
|
|
21
|
-
if (url.startsWith("node:") || url.includes("/.")) {
|
|
22
|
-
return result;
|
|
23
|
-
}
|
|
24
|
-
// Convert source to string if it's a Buffer or Uint8Array
|
|
25
|
-
let sourceStr;
|
|
26
|
-
if (typeof result.source === "string") {
|
|
27
|
-
sourceStr = result.source;
|
|
28
|
-
}
|
|
29
|
-
else if (result.source instanceof Uint8Array ||
|
|
30
|
-
Buffer.isBuffer(result.source)) {
|
|
31
|
-
sourceStr = result.source.toString("utf-8");
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
console.warn(`[env-loader] Unexpected source type: ${typeof result.source}`);
|
|
35
|
-
return result;
|
|
36
|
-
}
|
|
37
|
-
// Get define object from resolved config
|
|
38
|
-
const define = resolvedConfig?.define || {};
|
|
39
|
-
// Create the env object with Vite's default environment variables
|
|
40
|
-
const envObject = {
|
|
41
|
-
MODE: resolvedConfig?.mode || "development",
|
|
42
|
-
BASE_URL: resolvedConfig?.base || "/",
|
|
43
|
-
PROD: resolvedConfig?.isProduction ? true : false,
|
|
44
|
-
DEV: resolvedConfig?.isProduction ? false : true,
|
|
45
|
-
SSR: true,
|
|
46
|
-
...Object.fromEntries(Object.entries(define)
|
|
47
|
-
.filter(([key]) => key.startsWith("import.meta.env."))
|
|
48
|
-
.map(([key, value]) => [
|
|
49
|
-
key.replace("import.meta.env.", ""),
|
|
50
|
-
JSON.parse(value),
|
|
51
|
-
])),
|
|
52
|
-
};
|
|
53
|
-
// Replace environment variable references in the source
|
|
54
|
-
let newSource = sourceStr;
|
|
55
|
-
// Check if we need to handle import.meta.env
|
|
56
|
-
if (newSource.includes("import.meta.env")) {
|
|
57
|
-
newSource = `Object.defineProperty(import.meta, "env", { value: ${JSON.stringify(envObject)}, writable: false, configurable: false });\n${newSource}`;
|
|
58
|
-
}
|
|
59
|
-
return {
|
|
60
|
-
...result,
|
|
61
|
-
source: newSource,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
// Transform hook
|
|
65
|
-
export async function transformSource(source, context, defaultTransformSource) {
|
|
66
|
-
const transformed = await defaultTransformSource(source, context, defaultTransformSource);
|
|
67
|
-
return transformed;
|
|
68
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
import type { Program, Node } from "./types.js";
|
|
2
|
-
export interface ExportInfo {
|
|
3
|
-
name: string;
|
|
4
|
-
localName?: string;
|
|
5
|
-
type: "function" | "variable" | "class" | "unknown" | "all";
|
|
6
|
-
node?: Node;
|
|
7
|
-
declaration?: string;
|
|
8
|
-
before?: string[];
|
|
9
|
-
after?: string[];
|
|
10
|
-
isAsync?: boolean;
|
|
11
|
-
loc?: {
|
|
12
|
-
line: number;
|
|
13
|
-
column: number;
|
|
14
|
-
};
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Collects and organizes export information from a module.
|
|
18
|
-
*
|
|
19
|
-
* For all modules:
|
|
20
|
-
* - Collects import statements
|
|
21
|
-
* - Collects export names
|
|
22
|
-
* - Collects declarations
|
|
23
|
-
*
|
|
24
|
-
* The actual transformation of exports (like wrapping with registerServerReference)
|
|
25
|
-
* happens in transformModuleWithPreservedFunctions.
|
|
26
|
-
*
|
|
27
|
-
* @param source - The source code of the module
|
|
28
|
-
* @param url - The URL of the module
|
|
29
|
-
* @param program - The parsed AST program
|
|
30
|
-
* @param isServerFunction - Whether this is a server module
|
|
31
|
-
* @param isClientComponent - Whether this is a client module
|
|
32
|
-
* @returns Object containing imports, declarations, and export names
|
|
33
|
-
*/
|
|
34
|
-
export declare function handleExports(source: string, program: Program, isServerFunction: boolean | RegExpMatchArray | null, isClientComponent: boolean | RegExpMatchArray | null): {
|
|
35
|
-
imports: string[];
|
|
36
|
-
declarations: string[];
|
|
37
|
-
exportNames: string[];
|
|
38
|
-
exports: Map<string, ExportInfo>;
|
|
39
|
-
};
|
|
40
|
-
//# sourceMappingURL=handleExports.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleExports.d.ts","sourceRoot":"","sources":["../../../plugin/loader/handleExports.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAMhD,MAAM,WAAW,UAAU;IACzB,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,IAAI,EAAE,UAAU,GAAG,UAAU,GAAG,OAAO,GAAG,SAAS,GAAG,KAAK,CAAC;IAC5D,IAAI,CAAC,EAAE,IAAI,CAAC;IACZ,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;IAClB,KAAK,CAAC,EAAE,MAAM,EAAE,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,GAAG,CAAC,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,MAAM,EAAE,MAAM,CAAA;KAAE,CAAC;CACxC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,aAAa,CAC3B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,OAAO,EAChB,gBAAgB,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,EACnD,iBAAiB,EAAE,OAAO,GAAG,gBAAgB,GAAG,IAAI,GACnD;IACD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,WAAW,EAAE,MAAM,EAAE,CAAC;IACtB,OAAO,EAAE,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;CAClC,CAsQA"}
|
|
@@ -1,209 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite-plugin-react-server
|
|
3
|
-
* Copyright (c) Nico Brinkkemper
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
function handleExports(source, program, isServerFunction, isClientComponent) {
|
|
7
|
-
const imports = [];
|
|
8
|
-
const declarations = [];
|
|
9
|
-
const exportNames = [];
|
|
10
|
-
const exports = /* @__PURE__ */ new Map();
|
|
11
|
-
let lastEnd = 0;
|
|
12
|
-
let currentBefore = [];
|
|
13
|
-
function getFunctionType(node) {
|
|
14
|
-
if (node.type === "FunctionDeclaration" || node.type === "FunctionExpression" || node.type === "ArrowFunctionExpression") {
|
|
15
|
-
return "function";
|
|
16
|
-
}
|
|
17
|
-
if (node.type === "ClassDeclaration") {
|
|
18
|
-
return "class";
|
|
19
|
-
}
|
|
20
|
-
if (node.type === "VariableDeclaration") {
|
|
21
|
-
return "variable";
|
|
22
|
-
}
|
|
23
|
-
return "unknown";
|
|
24
|
-
}
|
|
25
|
-
for (const node of program.body) {
|
|
26
|
-
if (node.start > lastEnd) {
|
|
27
|
-
const beforeCode = source.slice(lastEnd, node.start);
|
|
28
|
-
if (beforeCode.trim()) {
|
|
29
|
-
currentBefore.push(beforeCode);
|
|
30
|
-
}
|
|
31
|
-
}
|
|
32
|
-
if (node.type === "ImportDeclaration") {
|
|
33
|
-
const importSource = node.source.value;
|
|
34
|
-
const isServerImport = importSource.includes(".server.");
|
|
35
|
-
imports.push(source.slice(node.start, node.end));
|
|
36
|
-
if (isServerImport) {
|
|
37
|
-
for (const spec of node.specifiers) {
|
|
38
|
-
if (spec.type === "ImportSpecifier") {
|
|
39
|
-
const localName = spec.local.type === "Identifier" ? spec.local.name : "";
|
|
40
|
-
const importedName = spec.imported.type === "Identifier" ? spec.imported.name : "";
|
|
41
|
-
if (localName && importedName) {
|
|
42
|
-
exports.set(localName, {
|
|
43
|
-
name: localName,
|
|
44
|
-
type: "function",
|
|
45
|
-
localName,
|
|
46
|
-
before: [...currentBefore]
|
|
47
|
-
});
|
|
48
|
-
exportNames.push(localName);
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
} else if (node.type === "ExportAllDeclaration") {
|
|
54
|
-
exports.set("*", {
|
|
55
|
-
name: "*",
|
|
56
|
-
type: "all",
|
|
57
|
-
before: [...currentBefore]
|
|
58
|
-
});
|
|
59
|
-
currentBefore = [];
|
|
60
|
-
exportNames.push("*");
|
|
61
|
-
} else if (node.type === "ExportNamedDeclaration") {
|
|
62
|
-
if (node.declaration) {
|
|
63
|
-
if (node.declaration.type === "FunctionDeclaration" && node.declaration.id) {
|
|
64
|
-
const name = node.declaration.id.name;
|
|
65
|
-
exports.set(name, {
|
|
66
|
-
name,
|
|
67
|
-
type: getFunctionType(node.declaration),
|
|
68
|
-
declaration: source.slice(node.declaration.start, node.declaration.end),
|
|
69
|
-
before: [...currentBefore],
|
|
70
|
-
isAsync: node.declaration.async
|
|
71
|
-
});
|
|
72
|
-
exportNames.push(name);
|
|
73
|
-
currentBefore = [];
|
|
74
|
-
} else if (node.declaration.type === "ClassDeclaration" && node.declaration.id) {
|
|
75
|
-
const name = node.declaration.id.name;
|
|
76
|
-
exports.set(name, {
|
|
77
|
-
name,
|
|
78
|
-
type: getFunctionType(node.declaration),
|
|
79
|
-
declaration: source.slice(node.declaration.start, node.declaration.end),
|
|
80
|
-
before: [...currentBefore]
|
|
81
|
-
});
|
|
82
|
-
exportNames.push(name);
|
|
83
|
-
currentBefore = [];
|
|
84
|
-
} else if (node.declaration.type === "VariableDeclaration") {
|
|
85
|
-
for (const decl of node.declaration.declarations) {
|
|
86
|
-
if (decl.id && decl.id.type === "Identifier") {
|
|
87
|
-
const name = decl.id.name;
|
|
88
|
-
const init = decl.init;
|
|
89
|
-
const isFunction = init != null && (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression");
|
|
90
|
-
const isAsync = isFunction && (init.type === "FunctionExpression" && init.async === true || init.type === "ArrowFunctionExpression" && init.async === true);
|
|
91
|
-
exports.set(name, {
|
|
92
|
-
name,
|
|
93
|
-
type: isFunction ? "function" : "variable",
|
|
94
|
-
declaration: source.slice(decl.start, decl.end),
|
|
95
|
-
before: [...currentBefore],
|
|
96
|
-
isAsync: isAsync || false
|
|
97
|
-
});
|
|
98
|
-
exportNames.push(name);
|
|
99
|
-
currentBefore = [];
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
} else if (node.specifiers) {
|
|
104
|
-
for (const spec of node.specifiers) {
|
|
105
|
-
if (spec.type === "ExportSpecifier") {
|
|
106
|
-
const localName = spec.local.type === "Identifier" ? spec.local.name : "";
|
|
107
|
-
const exportedName = spec.exported.type === "Identifier" ? spec.exported.name : "";
|
|
108
|
-
if (localName && exportedName) {
|
|
109
|
-
const functionDecl = program.body.find(
|
|
110
|
-
(node2) => node2.type === "FunctionDeclaration" && node2.id?.name === localName
|
|
111
|
-
);
|
|
112
|
-
if (functionDecl) {
|
|
113
|
-
exports.set(exportedName, {
|
|
114
|
-
name: exportedName,
|
|
115
|
-
type: getFunctionType(functionDecl),
|
|
116
|
-
localName,
|
|
117
|
-
declaration: source.slice(functionDecl.start, functionDecl.end),
|
|
118
|
-
before: [...currentBefore],
|
|
119
|
-
isAsync: functionDecl.async
|
|
120
|
-
});
|
|
121
|
-
exportNames.push(exportedName);
|
|
122
|
-
} else {
|
|
123
|
-
const varDecl = program.body.find(
|
|
124
|
-
(node2) => node2.type === "VariableDeclaration" && node2.declarations.some(
|
|
125
|
-
(decl) => decl.id.type === "Identifier" && decl.id.name === localName && decl.init && (decl.init.type === "FunctionExpression" || decl.init.type === "ArrowFunctionExpression")
|
|
126
|
-
)
|
|
127
|
-
);
|
|
128
|
-
if (varDecl) {
|
|
129
|
-
const decl = varDecl.declarations.find(
|
|
130
|
-
(d) => d.id.type === "Identifier" && d.id.name === localName
|
|
131
|
-
);
|
|
132
|
-
if (decl && decl.init) {
|
|
133
|
-
const isAsync = decl.init.type === "FunctionExpression" ? decl.init.async : decl.init.type === "ArrowFunctionExpression" ? decl.init.async : false;
|
|
134
|
-
exports.set(exportedName, {
|
|
135
|
-
name: exportedName,
|
|
136
|
-
type: "function",
|
|
137
|
-
localName,
|
|
138
|
-
declaration: source.slice(decl.start, decl.end),
|
|
139
|
-
before: [...currentBefore],
|
|
140
|
-
isAsync
|
|
141
|
-
});
|
|
142
|
-
exportNames.push(exportedName);
|
|
143
|
-
}
|
|
144
|
-
} else {
|
|
145
|
-
exports.set(exportedName, {
|
|
146
|
-
name: exportedName,
|
|
147
|
-
type: "variable",
|
|
148
|
-
localName,
|
|
149
|
-
before: [...currentBefore]
|
|
150
|
-
});
|
|
151
|
-
exportNames.push(exportedName);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
} else if (node.type === "ExportDefaultDeclaration") {
|
|
159
|
-
if (node.declaration && node.declaration.type === "FunctionDeclaration" && node.declaration.id) {
|
|
160
|
-
exports.set("default", {
|
|
161
|
-
name: "default",
|
|
162
|
-
type: getFunctionType(node.declaration),
|
|
163
|
-
localName: node.declaration.id.name,
|
|
164
|
-
// Capture the function name
|
|
165
|
-
isAsync: node.declaration.async
|
|
166
|
-
});
|
|
167
|
-
} else {
|
|
168
|
-
exports.set("default", {
|
|
169
|
-
name: "default",
|
|
170
|
-
type: "unknown",
|
|
171
|
-
before: [...currentBefore]
|
|
172
|
-
});
|
|
173
|
-
}
|
|
174
|
-
currentBefore = [];
|
|
175
|
-
} else if (node.type === "FunctionDeclaration" || node.type === "VariableDeclaration" || node.type === "ClassDeclaration") {
|
|
176
|
-
if (isServerFunction || !isClientComponent || node.type !== "FunctionDeclaration") {
|
|
177
|
-
declarations.push(source.slice(node.start, node.end));
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
lastEnd = node.end;
|
|
181
|
-
}
|
|
182
|
-
if (lastEnd < source.length) {
|
|
183
|
-
const afterCode = source.slice(lastEnd);
|
|
184
|
-
if (afterCode.trim()) {
|
|
185
|
-
const lastExport = Array.from(exports.values()).pop();
|
|
186
|
-
if (lastExport) {
|
|
187
|
-
lastExport.after = [afterCode];
|
|
188
|
-
}
|
|
189
|
-
}
|
|
190
|
-
}
|
|
191
|
-
for (const [name, info] of exports) {
|
|
192
|
-
if (info.before) {
|
|
193
|
-
declarations.push(...info.before);
|
|
194
|
-
}
|
|
195
|
-
if (info.declaration) {
|
|
196
|
-
declarations.push(info.declaration);
|
|
197
|
-
}
|
|
198
|
-
if (info.after) {
|
|
199
|
-
declarations.push(...info.after);
|
|
200
|
-
}
|
|
201
|
-
if (!exportNames.includes(name)) {
|
|
202
|
-
exportNames.push(name);
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
return { imports, declarations, exportNames, exports };
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
export { handleExports };
|
|
209
|
-
//# sourceMappingURL=handleExports.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleExports.js","sources":["../../../plugin/loader/handleExports.ts"],"sourcesContent":["import type { Program, Node } from \"./types.js\";\nimport type { \n FunctionDeclaration, VariableDeclaration,\n VariableDeclarator\n} from \"acorn\";\n\nexport interface ExportInfo {\n name: string;\n localName?: string;\n type: \"function\" | \"variable\" | \"class\" | \"unknown\" | \"all\";\n node?: Node;\n declaration?: string;\n before?: string[];\n after?: string[];\n isAsync?: boolean;\n loc?: { line: number; column: number };\n}\n\n/**\n * Collects and organizes export information from a module.\n *\n * For all modules:\n * - Collects import statements\n * - Collects export names\n * - Collects declarations\n *\n * The actual transformation of exports (like wrapping with registerServerReference)\n * happens in transformModuleWithPreservedFunctions.\n *\n * @param source - The source code of the module\n * @param url - The URL of the module\n * @param program - The parsed AST program\n * @param isServerFunction - Whether this is a server module\n * @param isClientComponent - Whether this is a client module\n * @returns Object containing imports, declarations, and export names\n */\nexport function handleExports(\n source: string,\n program: Program,\n isServerFunction: boolean | RegExpMatchArray | null,\n isClientComponent: boolean | RegExpMatchArray | null\n): {\n imports: string[];\n declarations: string[];\n exportNames: string[];\n exports: Map<string, ExportInfo>;\n} {\n const imports: string[] = [];\n const declarations: string[] = [];\n const exportNames: string[] = [];\n const exports = new Map<string, ExportInfo>();\n\n let lastEnd = 0;\n let currentBefore: string[] = [];\n let foundFirstExport = false;\n\n // Helper function to get function type\n function getFunctionType(node: Node): \"function\" | \"variable\" | \"class\" | \"unknown\" {\n if (node.type === \"FunctionDeclaration\" || node.type === \"FunctionExpression\" || node.type === \"ArrowFunctionExpression\") {\n return \"function\";\n }\n if (node.type === \"ClassDeclaration\") {\n return \"class\";\n }\n if (node.type === \"VariableDeclaration\") {\n return \"variable\";\n }\n return \"unknown\";\n }\n\n // First pass: collect all exports and code between them\n for (const node of program.body) {\n // Add any code before this node\n if (node.start > lastEnd) {\n const beforeCode = source.slice(lastEnd, node.start);\n if (beforeCode.trim()) {\n currentBefore.push(beforeCode);\n }\n }\n\n if (node.type === \"ImportDeclaration\") {\n const importSource = node.source.value as string;\n const isServerImport = importSource.includes(\".server.\");\n imports.push(source.slice(node.start, node.end));\n\n // If this is a server import, mark all imported functions as server actions\n if (isServerImport) {\n for (const spec of node.specifiers) {\n if (spec.type === \"ImportSpecifier\") {\n const localName = spec.local.type === \"Identifier\" ? spec.local.name : \"\";\n const importedName = spec.imported.type === \"Identifier\" ? spec.imported.name : \"\";\n if (localName && importedName) {\n exports.set(localName, {\n name: localName,\n type: \"function\",\n localName,\n before: [...currentBefore],\n });\n exportNames.push(localName);\n }\n }\n }\n }\n } else if (node.type === \"ExportAllDeclaration\") {\n // For export * from './other', just add the * export\n exports.set(\"*\", {\n name: \"*\",\n type: \"all\",\n before: [...currentBefore],\n });\n currentBefore = [];\n exportNames.push(\"*\");\n } else if (node.type === \"ExportNamedDeclaration\") {\n if (!foundFirstExport) {\n // This is the first export, so all code before it goes into its before array\n foundFirstExport = true;\n }\n\n if (node.declaration) {\n if (\n node.declaration.type === \"FunctionDeclaration\" &&\n node.declaration.id\n ) {\n const name = node.declaration.id.name;\n exports.set(name, {\n name,\n type: getFunctionType(node.declaration),\n declaration: source.slice(node.declaration.start, node.declaration.end),\n before: [...currentBefore],\n isAsync: node.declaration.async,\n });\n exportNames.push(name);\n currentBefore = [];\n } else if (\n node.declaration.type === \"ClassDeclaration\" &&\n node.declaration.id\n ) {\n const name = node.declaration.id.name;\n exports.set(name, {\n name,\n type: getFunctionType(node.declaration),\n declaration: source.slice(node.declaration.start, node.declaration.end),\n before: [...currentBefore],\n });\n exportNames.push(name);\n currentBefore = [];\n } else if (node.declaration.type === \"VariableDeclaration\") {\n for (const decl of node.declaration.declarations) {\n if (decl.id && decl.id.type === \"Identifier\") {\n const name = decl.id.name;\n const init = decl.init;\n const isFunction = init != null && (\n init.type === \"FunctionExpression\" ||\n init.type === \"ArrowFunctionExpression\"\n );\n const isAsync = isFunction && (\n (init.type === \"FunctionExpression\" && init.async === true) ||\n (init.type === \"ArrowFunctionExpression\" && init.async === true)\n );\n exports.set(name, {\n name,\n type: isFunction ? \"function\" : \"variable\",\n declaration: source.slice(decl.start, decl.end),\n before: [...currentBefore],\n isAsync: isAsync || false,\n });\n exportNames.push(name);\n currentBefore = [];\n }\n }\n }\n } else if (node.specifiers) {\n // For named exports (export { a, b, c })\n for (const spec of node.specifiers) {\n if (spec.type === \"ExportSpecifier\") {\n const localName = spec.local.type === \"Identifier\" ? spec.local.name : \"\";\n const exportedName = spec.exported.type === \"Identifier\" ? spec.exported.name : \"\";\n if (localName && exportedName) {\n // Find the function declaration in the AST\n const functionDecl = program.body.find(\n (node): node is FunctionDeclaration =>\n node.type === \"FunctionDeclaration\" &&\n node.id?.name === localName\n );\n\n if (functionDecl) {\n exports.set(exportedName, {\n name: exportedName,\n type: getFunctionType(functionDecl),\n localName,\n declaration: source.slice(functionDecl.start, functionDecl.end),\n before: [...currentBefore],\n isAsync: functionDecl.async,\n });\n exportNames.push(exportedName);\n } else {\n // If we can't find a function declaration, check if it's a variable declaration\n const varDecl = program.body.find(\n (node): node is VariableDeclaration =>\n node.type === \"VariableDeclaration\" &&\n node.declarations.some(\n (decl) =>\n decl.id.type === \"Identifier\" &&\n decl.id.name === localName &&\n decl.init &&\n (decl.init.type === \"FunctionExpression\" ||\n decl.init.type === \"ArrowFunctionExpression\")\n )\n );\n\n if (varDecl) {\n const decl = varDecl.declarations.find(\n (d: VariableDeclarator) => d.id.type === \"Identifier\" && d.id.name === localName\n );\n if (decl && decl.init) {\n const isAsync = decl.init.type === \"FunctionExpression\" ? decl.init.async :\n decl.init.type === \"ArrowFunctionExpression\" ? decl.init.async : false;\n exports.set(exportedName, {\n name: exportedName,\n type: \"function\",\n localName,\n declaration: source.slice(decl.start, decl.end),\n before: [...currentBefore],\n isAsync,\n });\n exportNames.push(exportedName);\n }\n } else {\n exports.set(exportedName, {\n name: exportedName,\n type: \"variable\",\n localName,\n before: [...currentBefore],\n });\n exportNames.push(exportedName);\n }\n }\n }\n }\n }\n }\n } else if (node.type === \"ExportDefaultDeclaration\") {\n if (node.declaration && node.declaration.type === \"FunctionDeclaration\" && node.declaration.id) {\n exports.set(\"default\", {\n name: \"default\",\n type: getFunctionType(node.declaration),\n localName: node.declaration.id.name, // Capture the function name\n isAsync: node.declaration.async,\n });\n } else {\n exports.set(\"default\", {\n name: \"default\",\n type: \"unknown\",\n before: [...currentBefore]\n });\n }\n currentBefore = []; // Reset for next export\n } else if (\n node.type === \"FunctionDeclaration\" ||\n node.type === \"VariableDeclaration\" ||\n node.type === \"ClassDeclaration\"\n ) {\n // For non-exported declarations:\n // - Keep all declarations for server functions\n // - Remove function declarations for client components\n if (\n isServerFunction ||\n !isClientComponent ||\n node.type !== \"FunctionDeclaration\"\n ) {\n declarations.push(source.slice(node.start, node.end));\n }\n }\n\n lastEnd = node.end;\n }\n\n // Add any remaining code after the last node\n if (lastEnd < source.length) {\n const afterCode = source.slice(lastEnd);\n if (afterCode.trim()) {\n // Add to the last export's after array\n const lastExport = Array.from(exports.values()).pop();\n if (lastExport) {\n lastExport.after = [afterCode];\n }\n }\n }\n\n // Second pass: generate transformed exports\n // Process all exports regardless of environment - the actual transformation\n // happens in transformModuleWithPreservedFunctions\n for (const [name, info] of exports) {\n if (info.before) {\n declarations.push(...info.before);\n }\n if (info.declaration) {\n declarations.push(info.declaration);\n }\n if (info.after) {\n declarations.push(...info.after);\n }\n if (!exportNames.includes(name)) {\n exportNames.push(name);\n }\n }\n\n return { imports, declarations, exportNames, exports };\n}\n"],"names":["node"],"mappings":";;;;;AAoCO,SAAS,aACd,CAAA,MAAA,EACA,OACA,EAAA,gBAAA,EACA,iBAMA,EAAA;AACA,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,EAAa,OAAQ,EAAA;AACvD;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"parse.js","sources":["../../../plugin/loader/parse.ts"],"sourcesContent":["import * as acorn from \"acorn-loose\";\nimport type { Program } from \"./types.js\";\n\n/**\n * Parses source code and handles source maps\n */\nexport function parse(source: string): Program {\n let program: Program;\n\n // Parse the transformed code with acorn\n program = acorn.parse(source, {\n ecmaVersion: \"latest\" as const,\n sourceType: \"module\",\n locations: true,\n allowAwaitOutsideFunction: true,\n allowImportExportEverywhere: true,\n allowReturnOutsideFunction: true,\n allowReserved: true,\n }) as Program;\n\n return program\n}\n"],"names":[],"mappings":";;;;;;;AAMO,SAAS,MAAM,MAAyB,EAAA;AAC7C,EAAI,IAAA,OAAA;AAGJ,EAAU,OAAA,GAAA,KAAA,CAAM,MAAM,MAAQ,EAAA;AAAA,IAC5B,WAAa,EAAA,QAAA;AAAA,IACb,UAAY,EAAA,QAAA;AAAA,IACZ,SAAW,EAAA,IAAA;AAAA,IACX,yBAA2B,EAAA,IAAA;AAAA,IAC3B,2BAA6B,EAAA,IAAA;AAAA,IAC7B,0BAA4B,EAAA,IAAA;AAAA,IAC5B,aAAe,EAAA;AAAA,GAChB,CAAA;AAED,EAAO,OAAA,OAAA;AACT;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-loader.client.d.ts","sourceRoot":"","sources":["../../../plugin/loader/react-loader.client.ts"],"names":[],"mappings":""}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"react-loader.js","sources":["../../../plugin/loader/react-loader.ts"],"sourcesContent":["import { getCondition } from \"../config/getCondition.js\"\n\nconst condition = getCondition('')\nconst loader = await import(`react-loader.${condition}.ts`);\n\nexport const { load, resolve, transformModuleIfNeeded } = loader;\n"],"names":[],"mappings":";;;;;;;AAEA,MAAM,SAAA,GAAa,aAAa,EAAE,CAAA;AAClC,MAAM,MAAS,GAAA,MAAM,OAAO,CAAA,aAAA,EAAgB,SAAS,CAAA,GAAA,CAAA,CAAA;AAE9C,MAAM,EAAE,IAAA,EAAM,OAAS,EAAA,uBAAA,EAA4B,GAAA;;;;"}
|