vite-plugin-react-server 1.1.19 → 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 -431
- 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 -596
- 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
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handleRender.js","sources":["../../../../plugin/worker/rsc/handleRender.ts"],"sourcesContent":["import { resolvePageAndProps } from \"../../helpers/resolvePageAndProps.js\";\nimport type { RscRenderMessage, StreamHandlers } from \"../types.js\";\nimport { activeStreams, cssFiles } from \"./state.js\";\nimport { createRscStream } from \"../../helpers/createRscStream.js\";\nimport { CssCollector } from \"../../components/css-collector.js\";\nimport { PassThrough } from \"node:stream\";\nimport { join } from \"node:path\";\nimport { workerData } from \"node:worker_threads\";\nimport { React } from \"../../vendor/vendor.server.js\";\nimport { hmrState } from \"./state.js\";\nimport { performance } from \"node:perf_hooks\";\nimport type { PagePropOpt } from \"../../types.js\";\n\nexport async function handleRender<\n T extends PagePropOpt = PagePropOpt\n>(\n msg: RscRenderMessage<T>,\n handlers: StreamHandlers\n) {\n let {\n id = workerData.id,\n route = workerData.route,\n pagePath = workerData.pagePath,\n propsPath = workerData.propsPath,\n pageExportName = workerData.userOptions.pageExportName,\n propsExportName = workerData.userOptions.propsExportName,\n projectRoot = workerData.userOptions.projectRoot,\n moduleRootPath = workerData.userOptions.moduleRootPath,\n moduleBaseURL = workerData.userOptions.moduleBaseURL ?? \"/\",\n moduleBasePath = workerData.userOptions.moduleBasePath ?? \"/\",\n moduleBase = workerData.userOptions.moduleBase,\n pipeableStreamOptions = workerData.userOptions.pipeableStreamOptions,\n cssFiles: messageCssFiles,\n globalCss = workerData.globalCss,\n } = msg;\n try {\n // Load modules\n const pageAndPropsResult = await resolvePageAndProps({\n pagePath,\n propsPath,\n pageExportName,\n propsExportName,\n route,\n loader: (id: string) => {\n try {\n if (hmrState.get(id)?.invalidated) {\n // Clear the HMR state for this module\n hmrState.delete(id);\n return import(join(projectRoot, id) + `?t=${Date.now()}`);\n }\n return import(join(projectRoot, id));\n } catch (error) {\n return Promise.reject(error);\n }\n },\n });\n if (pageAndPropsResult.type !== \"success\") {\n const { error, ...rest } = pageAndPropsResult;\n return handlers.onError(id, error, rest);\n }\n\n const { PageComponent, pageProps } = pageAndPropsResult;\n\n const adaptedOnEvent = (event: \"error\" | \"postpone\", data: any) => {\n if (event === \"error\") {\n handlers.onError(id, data.error, data.errorInfo);\n }\n };\n\n if (messageCssFiles && messageCssFiles.size > 0) {\n // if any css is added to the message, add it to the cssFiles map\n for (const [id, cssContent] of messageCssFiles.entries()) {\n cssFiles.set(id, cssContent);\n }\n }\n\n // Create stream\n const streamResult = createRscStream({\n projectRoot: projectRoot,\n Html: React.Fragment,\n PageComponent,\n CssCollector,\n pageProps,\n moduleBase,\n moduleRootPath,\n moduleBasePath,\n moduleBaseURL,\n manifest: {},\n route,\n // this is a stateful object, which at this point we assume contains all the css files\n cssFiles,\n globalCss,\n onEvent: adaptedOnEvent,\n pipeableStreamOptions: pipeableStreamOptions,\n });\n\n if (streamResult.type !== \"success\") {\n handlers.onError(id, streamResult.error);\n return;\n }\n\n const { stream, metrics } = streamResult;\n\n // Create pass-through stream\n const passThrough = new PassThrough();\n activeStreams.set(id, passThrough);\n\n // Pipe stream to pass-through\n stream.pipe(passThrough);\n\n // Handle data chunks\n passThrough.on(\"data\", (chunk) => {\n metrics.chunks++;\n metrics.bytes += chunk.length;\n metrics.duration = performance.now() - metrics.startTime;\n handlers.onData(id, chunk);\n });\n\n // Handle stream end\n passThrough.on(\"end\", () => {\n metrics.duration = performance.now() - metrics.startTime;\n handlers.onEnd(id);\n if (activeStreams.has(id)) {\n handlers.onMetrics(id, metrics);\n activeStreams.delete(id);\n }\n });\n\n // Handle errors\n passThrough.on(\"error\", (error) => {\n handlers.onError(id, error as Error, { reason: `${id} stream error` });\n activeStreams.delete(id);\n });\n } catch (error) {\n handlers.onError(id, error as Error, { reason: `${id} render error` });\n return Promise.reject(error);\n }\n}\n"],"names":["id"],"mappings":";;;;;;;;;;;;;;;AAaA,eAAsB,YAAA,CAGpB,KACA,QACA,EAAA;AACA,EAAI,IAAA;AAAA,IACF,KAAK,UAAW,CAAA,EAAA;AAAA,IAChB,QAAQ,UAAW,CAAA,KAAA;AAAA,IACnB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-1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"handlers.js","sources":["../../../../plugin/worker/rsc/handlers.ts"],"sourcesContent":["import { sendRscWorkerMessage } from \"../sendMessage.js\";\nimport type { StreamHandlers } from \"../types.js\";\nimport { toError } from \"../../error/toError.js\";\nimport { userOptions } from \"./userOptions.js\";\nimport { addCssFileContent, addModuleId } from \"./state.js\";\nimport { join } from \"path\";\nimport { ReactDOMServer } from \"../../vendor/vendor.server.js\";\nimport { PassThrough } from \"node:stream\";\n\nexport const handlers: Required<StreamHandlers> = {\n onError: (id, error, errorInfo) => {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id: id,\n errorInfo,\n error: toError(error),\n });\n sendRscWorkerMessage({\n type: \"RSC_END\",\n id: id,\n });\n },\n onData: (id, data: any) => {\n sendRscWorkerMessage({\n type: \"RSC_CHUNK\",\n id: id,\n chunk: data,\n });\n },\n onEnd: (id: string) => {\n sendRscWorkerMessage({\n type: \"RSC_END\",\n id: id,\n });\n },\n onMetrics: (id: string, metrics: any) => {\n sendRscWorkerMessage({\n type: \"RSC_METRICS\",\n id: id,\n metrics,\n });\n },\n onHmrAccept: (id, routes) => {\n sendRscWorkerMessage({\n type: \"HMR_ACCEPT\",\n id: id,\n routes: routes,\n });\n },\n onHmrUpdate: (id, routes) => {\n sendRscWorkerMessage({\n type: \"HMR_UPDATE\",\n id: id,\n routes: routes,\n });\n },\n onServerModule: (id, url, source) => {\n addModuleId(id, url);\n sendRscWorkerMessage({\n type: \"SERVER_MODULE\",\n id,\n url,\n source,\n });\n },\n onServerActionResponse: (id, result) => {\n const stream = ReactDOMServer.renderToPipeableStream(\n {\n type: \"server-action-response\",\n returnValue: result\n },\n userOptions.moduleBasePath,\n {\n onError(error: Error) {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n },\n }\n );\n\n const passThrough = new PassThrough();\n stream.pipe(passThrough);\n\n passThrough.on(\"data\", (chunk) => {\n sendRscWorkerMessage({\n type: \"RSC_CHUNK\",\n id,\n chunk,\n });\n });\n\n passThrough.on(\"end\", () => {\n sendRscWorkerMessage({\n type: \"RSC_END\",\n id,\n });\n });\n\n passThrough.on(\"error\", (error) => {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n });\n },\n onServerAction: async (id, args) => {\n try {\n // Parse the server action ID to get the file path and export name\n const [filePath, exportName] = id.split(\"#\");\n if (!filePath || !exportName) {\n throw new Error(\n `Invalid server action ID format: ${id}. Expected format: \"path/to/file.ts#exportName\"`\n );\n }\n // Convert the server action ID to a file path\n const actionPath = filePath.startsWith(userOptions.moduleBasePath)\n ? filePath.slice(userOptions.moduleBasePath.length)\n : filePath;\n const fullPath = join(userOptions.projectRoot, actionPath);\n\n // Load the server action module\n const module = await import(fullPath);\n const action = module[exportName];\n\n if (typeof action !== \"function\") {\n throw new Error(`Server action not found: ${id}`);\n }\n\n // Execute the server action\n const result = await action(...args);\n\n // Send success response using RSC stream\n const stream = ReactDOMServer.renderToPipeableStream(\n {\n type: \"server-action-response\",\n returnValue: result\n },\n userOptions.moduleBasePath,\n {\n onError(error: Error) {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n },\n }\n );\n\n const passThrough = new PassThrough();\n stream.pipe(passThrough);\n\n passThrough.on(\"data\", (chunk) => {\n sendRscWorkerMessage({\n type: \"RSC_CHUNK\",\n id,\n chunk,\n });\n });\n\n passThrough.on(\"end\", () => {\n sendRscWorkerMessage({\n type: \"RSC_END\",\n id,\n });\n });\n\n passThrough.on(\"error\", (error) => {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n });\n } catch (error: unknown) {\n const errorMessage = toError(error).message;\n // Send error response using RSC stream\n const stream = ReactDOMServer.renderToPipeableStream(\n {\n type: \"server-action-response\",\n returnValue: { success: false, error: errorMessage }\n },\n userOptions.moduleBasePath,\n {\n onError(error: Error) {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n },\n }\n );\n\n const passThrough = new PassThrough();\n stream.pipe(passThrough);\n\n passThrough.on(\"data\", (chunk) => {\n sendRscWorkerMessage({\n type: \"RSC_CHUNK\",\n id,\n chunk,\n });\n });\n\n passThrough.on(\"end\", () => {\n sendRscWorkerMessage({\n type: \"RSC_END\",\n id,\n });\n });\n\n passThrough.on(\"error\", (error) => {\n sendRscWorkerMessage({\n type: \"ERROR\",\n id,\n error: toError(error),\n });\n });\n }\n },\n onShutdown: (id: string) => {\n // Send SHUTDOWN_COMPLETE message to signal that shutdown is complete\n sendRscWorkerMessage({\n type: \"SHUTDOWN_COMPLETE\",\n id: id,\n });\n },\n onCssFile: (id, code) => {\n if (id) {\n // Add to CSS registry\n addCssFileContent(id, code, userOptions);\n\n // Send CSS file message\n sendRscWorkerMessage({\n type: \"CSS_FILE\",\n id,\n content: code,\n });\n }\n },\n};\n"],"names":["error"],"mappings":";;;;;;;;;;;;;AASO,MAAM,QAAqC,GAAA;AAAA,EAChD,OAAS,EAAA,CAAC,EAAI,EAAA,KAAA,EAAO,SAAc,KAAA;AACjC,IAAqB,oBAAA,CAAA;AAAA,MACnB,IAAM,EAAA,OAAA;AAAA,MACN,EAAA;AAAA,MACA,SAAA;AAAA,MACA,KAAA,EAAO,QAAQ,KAAK;AAAA,KACrB,CAAA;AACD,IAAqB,oBAAA,CAAA;AAAA,MACnB,IAAM,EAAA,SAAA;AAAA,MACN;AAAA,KACD,CAAA;AAAA,GACH;AAAA,EACA,MAAA,EAAQ,CAAC,EAAA,EAAI,IAAc,KAAA;AACzB,IAAqB,oBAAA,CAAA;AAAA,MACnB,IAAM,EAAA,WAAA;AAAA,MACN,EAAA;AAAA,MACA,KAAO,EAAA;AAAA,KACR,CAAA;AAAA,GACH;AAAA,EACA,KAAA,EAAO,CAAC,EAAe,KAAA;AACrB,IAAqB,oBAAA,CAAA;AAAA,MACnB,IAAM,EAAA,SAAA;AAAA,MACN;AAAA,KACD,CAAA;AAAA,GACH;AAAA,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A;AAEN,MAAkB,iBAAA,CAAA,EAAA,EAAI,MAAM,WAAW,CAAA;AAGvC,MAAqB,oBAAA,CAAA;AAAA,QACnB,IAAM,EAAA,UAAA;AAAA,QACN,EAAA;AAAA,QACA,OAAS,EAAA;AAAA,OACV,CAAA;AAAA;AACH;AAEJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../../plugin/worker/rsc/index.ts"],"sourcesContent":["await(\n process.env[\"NODE_ENV\"] === \"production\"\n ? import(\"./rsc-worker.production.js\")\n : import(\"./rsc-worker.development.js\")\n);\n"],"names":[],"mappings":";;;;;AAAA,OACE,OAAA,CAAQ,IAAI,UAAU,CAAA,KAAM,eACxB,OAAO,4BAA4B,CACnC,GAAA,OAAO,6BAA6B,CAAA,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"messageHandler.js","sources":["../../../../plugin/worker/rsc/messageHandler.tsx"],"sourcesContent":["import { parentPort } from \"node:worker_threads\";\nimport {\n activeStreams,\n hmrState,\n} from \"./state.js\";\nimport { handleRender } from \"./handleRender.js\";\nimport type {\n RscWorkerInputMessage,\n} from \"../types.js\";\nimport { toError } from \"../../error/toError.js\";\nimport { handlers } from \"./handlers.js\";\n\n// In test mode, we want errors to propagate up immediately\nconst isTestEnv = process.env[\"VITEST\"] || process.env[\"NODE_ENV\"] === \"test\";\nconst isDevEnv = process.env[\"NODE_ENV\"] !== \"production\";\n\n\nexport async function messageHandler(\n msg: RscWorkerInputMessage,\n port = parentPort\n) {\n try {\n if (!port) {\n throw new Error(\"No port found\");\n }\n switch (msg.type) {\n case \"RSC_RENDER\":\n return await handleRender(msg, handlers);\n case \"SERVER_ACTION\":\n return handlers.onServerAction(msg.id, msg.args);\n case \"INITIALIZED_REACT_LOADER\":\n case \"INITIALIZED_CSS_LOADER\":\n case \"INITIALIZED_ENV_LOADER\":\n return;\n case \"HMR_UPDATE\":\n // Mark the module as invalidated\n hmrState.set(msg.id, {\n timestamp: msg.timestamp || Date.now(),\n invalidated: true,\n routes: msg.routes || [],\n });\n // Notify the main thread that we've processed the update\n handlers.onHmrUpdate(msg.id, msg.routes || []);\n return;\n case \"HMR_CLEANUP\":\n // Clear the invalidation state\n hmrState.delete(msg.id);\n // Notify the main thread that we've processed the cleanup\n handlers.onHmrAccept(msg.id, msg.routes || []);\n return;\n case \"CSS_FILE\":\n handlers.onCssFile(msg.id, msg.content);\n return;\n case \"SERVER_MODULE\":\n handlers.onServerModule(msg.id, msg.url, msg.source);\n return;\n case \"SHUTDOWN\": {\n // If id is \"*\", clean up all render states\n if (msg.id === \"*\") {\n activeStreams.forEach((stream, renderId) => {\n stream.end();\n activeStreams.delete(renderId);\n });\n parentPort?.removeAllListeners();\n } else {\n activeStreams.delete(msg.id);\n }\n handlers.onShutdown(msg.id);\n return;\n }\n default: {\n console.log(\"Unknown message\", msg);\n return;\n }\n }\n } catch (error) {\n const err = toError(error);\n if (isDevEnv) {\n console.error(err);\n }\n // In dev mode, try to send error message before exiting\n if (parentPort) {\n port?.postMessage({\n type: \"ERROR\",\n id: \"rsc-worker\",\n error: err,\n });\n }\n if (!isDevEnv || isTestEnv) {\n // In test mode or production mode, just throw the error to fail fast\n throw err;\n }\n }\n}\n"],"names":[],"mappings":";;;;;;;;;;;AAaA,MAAM,SAAA,GAAY,QAAQ,GAAI,CAAA,QAAQ,KAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAM,KAAA,MAAA;AACvE,MAAM,QAAW,GAAA,OAAA,CAAQ,GAAI,CAAA,UAAU,CAAM,KAAA,YAAA;AAG7C,eAAsB,cAAA,CACpB,GACA,EAAA,IAAA,GAAO,UACP,EAAA;AACA,EAAI,IAAA;AACF,IAAA,IAAI,CAAC,IAAM,EAAA;AACT,MAAM,MAAA,IAAI,MAAM,eAAe,CAAA;AAAA;AAEjC,IAAA,QAAQ,IAAI,IAAM;AAAA,MAChB,KAAK,YAAA;AACH,QAAO,OAAA,MAAM,Y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AA,WAC9B,CAAA;AACD,UAAA,UAAA,EAAY,kBAAmB,EAAA;AAAA,SAC1B,MAAA;AACL,UAAc,aAAA,CAAA,MAAA,CAAO,IAAI,EAAE,CAAA;AAAA;AAE7B,QAAS,QAAA,CAAA,UAAA,CAAW,IAAI,EAAE,CAAA;AAC1B,QAAA;AAAA;AACF,MACA,SAAS;AACP,QAAQ,OAAA,CAAA,GAAA,CAAI,mBAAmB,GAAG,CAAA;AAClC,QAAA;AAAA;AACF;AACF,WACO,KAAO,EAAA;AACd,IAAM,MAAA,GAAA,GAAM,QAAQ,KAAK,CAAA;AACzB,IAAA,IAAI,QAAU,EAAA;AACZ,MAAA,OAAA,CAAQ,MAAM,GAAG,CAAA;AAAA;AAGnB,IAAA,IAAI,UAAY,EAAA;AACd,MAAA,IAAA,EAAM,WAAY,CAAA;AAAA,QAChB,IAAM,EAAA,OAAA;AAAA,QACN,EAAI,EAAA,YAAA;AAAA,QACJ,KAAO,EAAA;AAAA,OACR,CAAA;AAAA;AAEH,IAAI,IAAA,CAAC,YAAY,SAAW,EAAA;AAE1B,MAAM,MAAA,GAAA;AAAA;AACR;AAEJ;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rsc-worker.development.js","sources":["../../../../plugin/worker/rsc/rsc-worker.development.ts"],"sourcesContent":["import { parentPort, MessageChannel, workerData } from \"node:worker_threads\";\nimport { messageHandler } from \"./messageHandler.js\";\nimport { register } from \"node:module\";\nimport { register as registerTsx } from \"tsx/esm/api\";\nimport { join } from \"node:path\";\nimport { pluginRoot } from \"../../root.js\";\nimport type {\n HmrAcceptMessage,\n HmrUpdateMessage,\n ReadyMessage,\n} from \"../types.js\";\nimport { toError } from \"../../error/toError.js\";\n\n// Initialize worker\nif (!parentPort) {\n throw new Error(\"This module must be run as a worker\");\n}\n\n// In test mode, we want errors to propagate up immediately\nconst isTestEnv = process.env[\"VITEST\"] || process.env[\"NODE_ENV\"] === \"test\";\nconst isDevEnv = process.env[\"NODE_ENV\"] !== \"production\";\nconst verbose = workerData.verbose;\n\nconst developmentMessageHandler = (msg: any) => {\n if (verbose) {\n if (\"chunk\" in msg) {\n let preview = Buffer.from(msg.chunk).toString(\"utf-8\");\n console.log(`[rsc-worker:${msg.type}] ${preview}`);\n } else {\n console.log(`[rsc-worker:${msg.type}] ${JSON.stringify(msg)}`);\n }\n }\n messageHandler(msg);\n};\n\nconst developmentCssLoaderMessageHandler = (msg: any) => {\n if (verbose) {\n console.log(`[css-loader:${msg.type}] ${JSON.stringify(msg)}`);\n }\n messageHandler(msg);\n};\n\nconst developmentEnvLoaderMessageHandler = (msg: any) => {\n if (verbose) {\n console.log(`[env-loader:${msg.type}] ${JSON.stringify(msg)}`);\n }\n messageHandler(msg);\n};\n\nconst developmentReactLoaderMessageHandler = (msg: any) => {\n if (verbose) {\n console.log(`[react-loader:${msg.type}] ${JSON.stringify(msg)}`);\n }\n messageHandler(msg);\n};\n\ntry {\n // Create channels for each loader\n const reactLoaderChannel = new MessageChannel();\n const cssLoaderChannel = new MessageChannel();\n const envLoaderChannel = new MessageChannel();\n\n // Set up message handlers before transferring ports\n reactLoaderChannel.port2.on(\"message\", developmentReactLoaderMessageHandler);\n cssLoaderChannel.port2.on(\"message\", developmentCssLoaderMessageHandler);\n envLoaderChannel.port2.on(\"message\", developmentEnvLoaderMessageHandler);\n\n const reactLoaderPath =\n \"file://\" + join(pluginRoot, \"loader/react-loader.server.js\");\n const cssLoaderPath =\n \"file://\" + join(pluginRoot, \"loader/css-loader.development.js\");\n const envLoaderPath =\n \"file://\" + join(pluginRoot, \"loader/env-loader.development.js\");\n\n register(cssLoaderPath, {\n parentURL: pluginRoot,\n data: {\n id: \"css-loader\",\n port: cssLoaderChannel.port1,\n userOptions: workerData.userOptions,\n resolvedConfig: workerData.resolvedConfig,\n },\n transferList: [cssLoaderChannel.port1],\n });\n\n // Register tsx\n registerTsx();\n\n // Register loaders with their ports\n register(reactLoaderPath, {\n parentURL: pluginRoot,\n data: {\n id: \"react-loader\",\n port: reactLoaderChannel.port1,\n userOptions: workerData.userOptions,\n },\n transferList: [reactLoaderChannel.port1],\n });\n\n // Register env-loader (ensure this the last)\n register(envLoaderPath, {\n parentURL: pluginRoot,\n data: {\n id: \"env-loader\",\n port: envLoaderChannel.port1,\n resolvedConfig: workerData.resolvedConfig,\n },\n transferList: [envLoaderChannel.port1],\n });\n\n // Set up message handling\n parentPort!.on(\"message\", developmentMessageHandler);\n\n const { hmrPort } = workerData;\n if (hmrPort) {\n // Start the message port\n hmrPort.start();\n\n // Listen for HMR messages\n hmrPort.on(\"message\", (message: any) => {\n if (message.type === \"HMR_UPDATE\") {\n // Invalidate the module in the worker\n parentPort!.postMessage({\n type: \"HMR_UPDATE\",\n id: message.id,\n routes: message.routes,\n } satisfies HmrUpdateMessage);\n } else if (message.type === \"HMR_ACCEPT\") {\n // Handle the update\n parentPort!.postMessage({\n type: \"HMR_ACCEPT\",\n id: message.id,\n routes: message.routes,\n } satisfies HmrAcceptMessage);\n }\n });\n }\n\n // Notify parent that we're ready\n parentPort!.postMessage({\n type: \"READY\",\n env: process.env[\"NODE_ENV\"],\n pid: process.pid,\n id: \"rsc-worker\",\n } satisfies ReadyMessage);\n\n if (process.env[\"NODE_ENV\"] === \"production\") {\n throw new Error(\"This module should not run in production mode.\");\n }\n} catch (error) {\n if (isDevEnv) {\n console.error(error);\n }\n // In dev mode, try to send error message before exiting\n if (parentPort) {\n parentPort?.postMessage({\n type: \"ERROR\",\n id: \"rsc-worker\",\n error: toError(error),\n });\n }\n if (!isDevEnv || isTestEnv) {\n // In test mode or production mode, just throw the error to fail fast\n throw error;\n }\n}\n"],"names":["registerTsx"],"mappings":";;;;;;;;;;;;;AAcA,IAAI,CAAC,UAAY,EAAA;AACf,EAAM,MAAA,IAAI,MAAM,qCAAqC,CAAA;AACvD;AAGA,MAAM,SAAA,GAAY,QAAQ,GAAI,CAAA,QAAQ,KAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAM,K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CAAI,UAAU,CAAA;AAAA,IAC3B,KAAK,OAAQ,CAAA,GAAA;AAAA,IACb,EAAI,EAAA;AAAA,GACkB,CAAA;AAExB,EAAA,IAAI,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAA,KAAM,YAAc,EAAA;AAC5C,IAAM,MAAA,IAAI,MAAM,gDAAgD,CAAA;AAAA;AAEpE,CAAA,CAAA,OAAS,KAAO,EAAA;AACd,EAAA,IAAI,QAAU,EAAA;AACZ,IAAA,OAAA,CAAQ,MAAM,KAAK,CAAA;AAAA;AAGrB,EAAA,IAAI,UAAY,EAAA;AACd,IAAA,UAAA,EAAY,WAAY,CAAA;AAAA,MACtB,IAAM,EAAA,OAAA;AAAA,MACN,EAAI,EAAA,YAAA;AAAA,MACJ,KAAA,EAAO,QAAQ,KAAK;AAAA,KACrB,CAAA;AAAA;AAEH,EAAI,IAAA,CAAC,YAAY,SAAW,EAAA;AAE1B,IAAM,MAAA,KAAA;AAAA;AAEV"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"rsc-worker.production.js","sources":["../../../../plugin/worker/rsc/rsc-worker.production.ts"],"sourcesContent":["import { parentPort, MessageChannel } from \"node:worker_threads\";\nimport { messageHandler } from \"./messageHandler.js\";\nimport { register } from \"node:module\";\nimport { join } from \"node:path\";\nimport { pluginRoot } from \"../../root.js\";\nimport type { ReadyMessage } from \"../types.js\";\n\nif (!parentPort) {\n throw new Error(\"This module must be run as a worker\");\n}\n\n// Create channels for each loader\nconst reactLoaderChannel = new MessageChannel();\nconst cssLoaderChannel = new MessageChannel();\nconst envLoaderChannel = new MessageChannel();\n\n// Register loaders\nregister(join(pluginRoot, \"worker/env-loader.js\"), {\n parentURL: import.meta.url,\n data: { port: envLoaderChannel.port2 },\n transferList: [envLoaderChannel.port2],\n});\n\n// Listen for messages from loaders\nreactLoaderChannel.port2.on(\"message\", messageHandler);\ncssLoaderChannel.port2.on(\"message\", messageHandler);\nenvLoaderChannel.port2.on(\"message\", messageHandler);\n\n// Handle incoming messages\nparentPort.on(\"message\", messageHandler);\n\n// Signal ready\nparentPort.postMessage({ type: \"READY\", id: \"rsc-worker\", env: process.env[\"NODE_ENV\"], pid: process.pid } satisfies ReadyMessage);\n"],"names":[],"mappings":";;;;;;;;;;;AAOA,IAAI,CAAC,UAAY,EAAA;AACf,EAAM,MAAA,IAAI,MAAM,qCAAqC,CAAA;AACvD;AAGA,MAAM,kBAAA,GAAqB,IAAI,cAAe,EAAA;AAC9C,MAAM,gBAAA,GAAmB,IAAI,cAAe,EAAA;AAC5C,MAAM,gBAAA,GAAmB,IAAI,cAAe,EAAA;AAG5C,QAAS,CAAA,IAAA,CAAK,UAAY,EAAA,sBAAsB,CAAG,EAAA;AAAA,EACjD,WAAW,MAAY,CAAA,IAAA,CAAA,GAAA;AAAA,EACvB,IAAM,EAAA,EAAE,IAAM,EAAA,gBAAA,CAAiB,KAAM,EAAA;AAAA,EACrC,YAAA,EAAc,CAAC,gBAAA,CAAiB,KAAK;AACvC,CAAC,CAAA;AAGD,kBAAmB,CAAA,KAAA,CAAM,EAAG,CAAA,SAAA,EAAW,cAAc,CAAA;AACrD,gBAAiB,CAAA,KAAA,CAAM,EAAG,CAAA,SAAA,EAAW,cAAc,CAAA;AACnD,gBAAiB,CAAA,KAAA,CAAM,EAAG,CAAA,SAAA,EAAW,cAAc,CAAA;AAGnD,UAAW,CAAA,EAAA,CAAG,WAAW,cAAc,CAAA;AAGvC,UAAA,CAAW,WAAY,CAAA,EAAE,IAAM,EAAA,OAAA,EAAS,IAAI,YAAc,EAAA,GAAA,EAAK,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAA,EAAG,GAAK,EAAA,OAAA,CAAQ,KAA4B,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"state.js","sources":["../../../../plugin/worker/rsc/state.ts"],"sourcesContent":["import { workerData } from \"node:worker_threads\";\nimport { createCssProps } from \"../../helpers/createCssProps.js\";\nimport type { CssContent, ResolvedUserOptions, HmrState } from \"../../types.js\";\nimport type { PassThrough } from \"node:stream\";\nimport { relative } from \"node:path\";\n\n// Track active RSC streams\nexport const activeStreams = new Map<string, PassThrough>();\n\n// Track CSS files\nexport const cssFiles = new Map<string, CssContent>();\n\n// Track module IDs\nexport const moduleIds = new Map<string, string>();\n\nexport const hmrState = new Map<string, HmrState>();\n\nif (workerData) {\n if (workerData.hmrPort) {\n workerData.hmrPort.on(\n \"message\",\n (msg: { type: string; path: string; routes?: string[] }) => {\n if (msg.type === \"HMR_UPDATE\") {\n // Normalize the path relative to project root\n const normalizedPath = relative(\n workerData.userOptions.projectRoot,\n msg.path\n );\n hmrState.set(normalizedPath, {\n timestamp: Date.now(),\n invalidated: true,\n routes: msg.routes || [],\n });\n } else if (msg.type === \"HMR_ACCEPT\") {\n // Normalize the path relative to project root\n const normalizedPath = relative(\n workerData.userOptions.projectRoot,\n msg.path\n );\n hmrState.delete(normalizedPath);\n }\n }\n );\n }\n} else {\n throw new Error(\"This module must be run with workerData\");\n}\n\nexport function addCssFileContent(\n id: string,\n code: string,\n userOptions: Pick<\n ResolvedUserOptions,\n | \"projectRoot\"\n | \"moduleBaseURL\"\n | \"moduleBasePath\"\n | \"moduleRootPath\"\n | \"css\"\n | \"normalizer\"\n | \"moduleID\"\n | \"publicOrigin\"\n >\n) {\n if (typeof code !== \"string\") {\n throw new Error(\n `Expected css to be loaded as a string, but got ${typeof code}`\n );\n }\n cssFiles.set(\n id,\n createCssProps({\n id,\n code,\n userOptions,\n })\n );\n}\n\n// Helper to check if a module is invalidated\nexport function isModuleInvalidated(path: string): boolean {\n const state = hmrState.get(path);\n return state?.invalidated || false;\n}\n\n// Helper to clear HMR state for a module\nexport function clearHmrState(path: string): void {\n hmrState.delete(path);\n}\n\n// Helper to get all invalidated modules\nexport function getInvalidatedModules(): string[] {\n return Array.from(hmrState.entries())\n .filter(([_, state]) => state.invalidated)\n .map(([path]) => path);\n}\n\nexport function addModuleId(id: string, url: string) {\n moduleIds.set(id, url);\n}\n\nexport function getModuleId(id: string): string | undefined {\n return moduleIds.get(id);\n}\n"],"names":[],"mappings":";;;;;;;;;AAOa,MAAA,aAAA,uBAAoB,GAAyB;AAG7C,MAAA,QAAA,uBAAe,GAAwB;AAGvC,MAAA,SAAA,uBAAgB,GAAoB;AAEpC,MAAA,QAAA,uBAAe,GAAsB;AAElD,IAAI,UAAY,EAAA;AACd,EAAA,IAAI,WAAW,OAAS,EAAA;AACtB,IAAA,UAAA,CAAW,OAAQ,CAAA,EAAA;AAAA,MACjB,SAAA;AAAA,MACA,CAAC,GAA2D,KAAA;AAC1D,QAAI,IAAA,GAAA,CAAI,SAAS,YAAc,EAAA;AAE7B,UAAA,MAAM,cAAiB,GAAA,QAAA;AAAA,YACrB,WAAW,WAAY,CAAA,WAAA;AAAA,YACvB,GAAI,CAAA;AAAA,WACN;AACA,UAAA,QAAA,CAAS,IAAI,cAAgB,EAAA;AAAA,YAC3B,SAAA,EAAW,KAAK,GAAI,EAAA;AAAA,YACpB,WAAa,EAAA,IAAA;AAAA,YACb,MAAA,EAAQ,GAAI,CAAA,MAAA,IAAU;AAAC,WACxB,CAAA;AAAA,SACH,MAAA,IAAW,GAAI,CAAA,IAAA,KAAS,YAAc,EAAA;AAEpC,UAAA,MAAM,cAAiB,GAAA,QAAA;AAAA,YACrB,WAAW,WAAY,CAAA,WAAA;AAAA,YACvB,GAAI,CAAA;AAAA,WACN;AACA,UAAA,QAAA,CAAS,OAAO,cAAc,CAAA;AAAA;AAChC;AACF,KACF;AAAA;AAEJ,CAAO,MAAA;AACL,EAAM,MAAA,IAAI,MAAM,yCAAyC,CAAA;AAC3D;AAEO,SAAS,iBAAA,CACd,EACA,EAAA,IAAA,EACA,WAWA,EAAA;AACA,EAAI,IAAA,OAAO,SAAS,QAAU,EAAA;AAC5B,IAAA,MAAM,IAAI,KAAA;AAAA,MACR,CAAA,+CAAA,EAAkD,OAAO,IAAI,CAAA;AAAA,KAC/D;AAAA;AAEF,EAAS,QAAA,CAAA,GAAA;AAAA,IACP,EAAA;AAAA,IACA,cAAe,CAAA;AAAA,MACb,EAAA;AAAA,MACA,IAAA;AAAA,MACA;AAAA,KACD;AAAA,GACH;AACF;AAoBO,SAAS,WAAA,CAAY,IAAY,GAAa,EAAA;AACnD,EAAU,SAAA,CAAA,GAAA,CAAI,IAAI,GAAG,CAAA;AACvB;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"userOptions.js","sources":["../../../../plugin/worker/rsc/userOptions.ts"],"sourcesContent":["import { resolveOptions } from \"../../config/index.js\";\nimport { hydrateUserOptions } from \"../../helpers/index.js\";\nimport { workerData } from \"node:worker_threads\";\nconst userOptionsResult = resolveOptions(hydrateUserOptions(workerData.userOptions));\nif(userOptionsResult.type === \"error\") {\n throw userOptionsResult.error;\n}\nexport const userOptions = userOptionsResult.userOptions;"],"names":[],"mappings":";;;;;;;;;AAGA,MAAM,iBAAoB,GAAA,cAAA,CAAe,kBAAmB,CAAA,UAAA,CAAW,WAAW,CAAC,CAAA;AACnF,IAAG,iBAAA,CAAkB,SAAS,OAAS,EAAA;AACrC,EAAA,MAAM,iBAAkB,CAAA,KAAA;AAC1B;AACO,MAAM,cAAc,iBAAkB,CAAA;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sendMessage.js","sources":["../../../plugin/worker/sendMessage.ts"],"sourcesContent":["import { cleanObject } from \"../helpers/cleanObject.js\";\nimport type {\n HtmlWorkerOutputMessage,\n RscWorkerOutputMessage,\n} from \"./types.js\";\nimport { parentPort } from \"node:worker_threads\";\n\nexport function sendMessage(\n msg: HtmlWorkerOutputMessage | RscWorkerOutputMessage,\n port = parentPort\n) {\n if (!port) {\n console.error(\"[Worker] No port available to send message\");\n return;\n }\n\n try {\n // Handle error messages\n if (\"error\" in msg) {\n const error = msg.error;\n const serializedError =\n error instanceof Error\n ? {\n message: error.message,\n stack: error.stack,\n name: error.name,\n cause: error.cause,\n }\n : {\n message: String(error),\n name: \"Error\",\n };\n\n port.postMessage({\n ...cleanObject(msg),\n error: serializedError,\n });\n } else {\n // Handle non-error messages\n port.postMessage(cleanObject(msg));\n }\n } catch (err) {\n console.error(\"[Worker] Failed to send message:\", err);\n // Try to send a basic error message\n try {\n port.postMessage({\n type: \"ERROR\",\n error: {\n message: err instanceof Error ? err.message : String(err),\n name: err instanceof Error ? err.name : \"Error\",\n },\n });\n } catch {\n // If we can't even send an error message, just log it\n console.error(\"[Worker] Critical error - could not send error message\");\n }\n }\n}\n\nexport const sendRscWorkerMessage = sendMessage as (\n msg: RscWorkerOutputMessage,\n port?: MessagePort\n) => void;\nexport const sendHtmlWorkerMessage = sendMessage as (\n msg: HtmlWorkerOutputMessage,\n port?: MessagePort\n) => void;\n"],"names":[],"mappings":";;;;;;;;AAOO,SAAS,WAAA,CACd,GACA,EAAA,IAAA,GAAO,UACP,EAAA;AACA,EAAA,IAAI,CAAC,IAAM,EAAA;AACT,IAAA,OAAA,CAAQ,MAAM,4CAA4C,CAAA;AAC1D,IAAA;AAAA;AAGF,EAAI,IAAA;AAEF,IAAA,IAAI,WAAW,GAAK,EAAA;AAClB,MAAA,MAAM,QAAQ,GAAI,CAAA,KAAA;AAClB,MAAM,MAAA,eAAA,GACJ,iBAAiB,KACb,GAAA;AAAA,QACE,SAAS,KAAM,CAAA,OAAA;AAAA,QACf,OAAO,KAAM,CAAA,KAAA;AAAA,QACb,MAAM,KAAM,CAAA,IAAA;AAAA,QACZ,OAAO,KAAM,CAAA;AAAA,OAEf,GAAA;AAAA,QACE,OAAA,EAAS,OAAO,KAAK,CAAA;AAAA,QACrB,IAAM,EAAA;AAAA,OACR;AAEN,MAAA,IAAA,CAAK,WAAY,CAAA;AAAA,QACf,GAAG,YAAY,GAAG,CAAA;AAAA,QAClB,KAAO,EAAA;AAAA,OACR,CAAA;AAAA,KACI,MAAA;AAEL,MAAK,IAAA,CAAA,WAAA,CAAY,WAAY,CAAA,GAAG,CAAC,CAAA;AAAA;AACnC,WACO,GAAK,EAAA;AACZ,IAAQ,OAAA,CAAA,KAAA,CAAM,oCAAoC,GAAG,CAAA;AAErD,IAAI,IAAA;AACF,MAAA,IAAA,CAAK,WAAY,CAAA;AAAA,QACf,IAAM,EAAA,OAAA;AAAA,QACN,KAAO,EAAA;AAAA,UACL,SAAS,GAAe,YAAA,KAAA,GAAQ,GAAI,CAAA,OAAA,GAAU,OAAO,GAAG,CAAA;AAAA,UACxD,IAAM,EAAA,GAAA,YAAe,KAAQ,GAAA,GAAA,CAAI,IAAO,GAAA;AAAA;AAC1C,OACD,CAAA;AAAA,KACK,CAAA,MAAA;AAEN,MAAA,OAAA,CAAQ,MAAM,wDAAwD,CAAA;AAAA;AACxE;AAEJ;AAEO,MAAM,oBAAuB,GAAA;;;;"}
|
package/dist/server.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../server.ts"],"sourcesContent":["\"use strict\";\n\nconst condition = process.env['NODE_OPTIONS']?.match(/--conditions[= ]react-server/) ? 'server' : 'client'\n\nif(condition !== 'server'){\n throw new Error('Condition mismatch, should be react-server but got ' + condition);\n}\n\nexport { vitePluginReactServer } from './plugin/plugin.server.js'\n\n// types\nexport type * from './plugin/types.js'"],"names":[],"mappings":";;;;;;;AAEA,MAAM,SAAA,GAAY,QAAQ,GAAI,CAAA,cAAc,GAAG,KAAM,CAAA,8BAA8B,IAAI,QAAW,GAAA,QAAA;AAElG,IAAG,cAAc,QAAS,EAAA;AACxB,EAAM,MAAA,IAAI,KAAM,CAAA,qDAAA,GAAwD,SAAS,CAAA;AACnF"}
|
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { CssCollectorBoxedType } from "../types.js";
|
|
3
|
-
import { CssCollectorElements } from "./css-collector-elements.js";
|
|
4
|
-
|
|
5
|
-
/**
|
|
6
|
-
* A upgraded Root component that adds the cssFiles to the bottom of the page,,
|
|
7
|
-
* expecting links to bubble up to the document head.
|
|
8
|
-
*/
|
|
9
|
-
export const CssCollector: CssCollectorBoxedType = ({
|
|
10
|
-
as: As = React.Fragment,
|
|
11
|
-
cssFiles,
|
|
12
|
-
pageProps,
|
|
13
|
-
Page,
|
|
14
|
-
...props
|
|
15
|
-
}) => (
|
|
16
|
-
<As {...(As != React.Fragment ? (props as any) : null)}>
|
|
17
|
-
<Page {...pageProps!} />
|
|
18
|
-
<CssCollectorElements cssFiles={cssFiles!} />
|
|
19
|
-
</As>
|
|
20
|
-
);
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Resolves a matcher pattern to a function that tests paths
|
|
3
|
-
*/
|
|
4
|
-
export const resolveAutoDiscoverMatcher = (
|
|
5
|
-
options: undefined | string | RegExp | ((path: string) => boolean),
|
|
6
|
-
fallback: RegExp | ((path: string) => boolean)
|
|
7
|
-
) => {
|
|
8
|
-
if (!options) {
|
|
9
|
-
if (typeof fallback === "function") {
|
|
10
|
-
return fallback;
|
|
11
|
-
} else {
|
|
12
|
-
return (path: string) => fallback.test(path);
|
|
13
|
-
}
|
|
14
|
-
}
|
|
15
|
-
if (typeof options === "string") {
|
|
16
|
-
const matcher = new RegExp(options);
|
|
17
|
-
return (path: string) => matcher.test(path);
|
|
18
|
-
} else if (typeof options === "function") {
|
|
19
|
-
return options;
|
|
20
|
-
} else {
|
|
21
|
-
return (path: string) => options.test(path);
|
|
22
|
-
}
|
|
23
|
-
};
|
|
@@ -1,182 +0,0 @@
|
|
|
1
|
-
import { basename } from "path";
|
|
2
|
-
import type { SourceMap } from "../types/sourceMap.js";
|
|
3
|
-
|
|
4
|
-
// VLQ encoding helpers
|
|
5
|
-
const VLQ_SHIFT = 5;
|
|
6
|
-
const VLQ_CONTINUATION_BIT = 1 << VLQ_SHIFT;
|
|
7
|
-
const VLQ_VALUE_MASK = VLQ_CONTINUATION_BIT - 1;
|
|
8
|
-
const BASE64_CHARS =
|
|
9
|
-
"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";
|
|
10
|
-
|
|
11
|
-
export function encodeVLQ(numbers: number[]): string {
|
|
12
|
-
return numbers
|
|
13
|
-
.map((num) => {
|
|
14
|
-
// Convert to VLQ
|
|
15
|
-
const vlq = num < 0 ? (-num << 1) | 1 : num << 1;
|
|
16
|
-
|
|
17
|
-
let result = "";
|
|
18
|
-
let value = vlq;
|
|
19
|
-
|
|
20
|
-
do {
|
|
21
|
-
let digit = value & VLQ_VALUE_MASK;
|
|
22
|
-
value >>>= VLQ_SHIFT;
|
|
23
|
-
if (value > 0) {
|
|
24
|
-
digit |= VLQ_CONTINUATION_BIT;
|
|
25
|
-
}
|
|
26
|
-
result += BASE64_CHARS[digit];
|
|
27
|
-
} while (value > 0);
|
|
28
|
-
|
|
29
|
-
return result;
|
|
30
|
-
})
|
|
31
|
-
.join("");
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
export function decodeVLQ(str: string): number[] {
|
|
35
|
-
const numbers: number[] = [];
|
|
36
|
-
let value = 0;
|
|
37
|
-
let shift = 0;
|
|
38
|
-
let index = 0;
|
|
39
|
-
|
|
40
|
-
while (index < str.length && !/[,;]/.test(str[index])) {
|
|
41
|
-
const digit = BASE64_CHARS.indexOf(str[index]);
|
|
42
|
-
if (digit === -1) break;
|
|
43
|
-
|
|
44
|
-
value += (digit & VLQ_VALUE_MASK) << shift;
|
|
45
|
-
|
|
46
|
-
if ((digit & VLQ_CONTINUATION_BIT) === 0) {
|
|
47
|
-
const negate = value & 1;
|
|
48
|
-
value >>>= 1;
|
|
49
|
-
numbers.push(negate ? -value : value);
|
|
50
|
-
value = shift = 0;
|
|
51
|
-
} else {
|
|
52
|
-
shift += VLQ_SHIFT;
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
index++;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
return numbers;
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
export function readMappings(
|
|
62
|
-
mappings: string,
|
|
63
|
-
callback: (
|
|
64
|
-
generatedLine: number,
|
|
65
|
-
generatedColumn: number,
|
|
66
|
-
sourceIndex: number,
|
|
67
|
-
originalLine: number,
|
|
68
|
-
originalColumn: number,
|
|
69
|
-
nameIndex: number
|
|
70
|
-
) => void
|
|
71
|
-
) {
|
|
72
|
-
let line = 1;
|
|
73
|
-
let column = 0;
|
|
74
|
-
let sourceIndex = 0;
|
|
75
|
-
let originalLine = 1;
|
|
76
|
-
let originalColumn = 0;
|
|
77
|
-
let nameIndex = 0;
|
|
78
|
-
|
|
79
|
-
const segments = mappings.split(";");
|
|
80
|
-
for (let i = 0; i < segments.length; i++) {
|
|
81
|
-
const segment = segments[i];
|
|
82
|
-
if (segment === "") {
|
|
83
|
-
line++;
|
|
84
|
-
column = 0;
|
|
85
|
-
continue;
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
const parts = segment.split(",");
|
|
89
|
-
for (let j = 0; j < parts.length; j++) {
|
|
90
|
-
const part = parts[j];
|
|
91
|
-
if (part === "") continue;
|
|
92
|
-
|
|
93
|
-
const numbers = decodeVLQ(part);
|
|
94
|
-
column += numbers[0];
|
|
95
|
-
if (numbers.length > 1) {
|
|
96
|
-
sourceIndex += numbers[1];
|
|
97
|
-
originalLine += numbers[2];
|
|
98
|
-
originalColumn += numbers[3];
|
|
99
|
-
if (numbers.length > 4) {
|
|
100
|
-
nameIndex += numbers[4];
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
callback(
|
|
105
|
-
line,
|
|
106
|
-
column,
|
|
107
|
-
sourceIndex,
|
|
108
|
-
originalLine,
|
|
109
|
-
originalColumn,
|
|
110
|
-
nameIndex
|
|
111
|
-
);
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
export function createMappingsSerializer() {
|
|
117
|
-
let previousGeneratedLine = 1;
|
|
118
|
-
let previousGeneratedColumn = 0;
|
|
119
|
-
let previousOriginalFile = 0;
|
|
120
|
-
let previousOriginalLine = 0;
|
|
121
|
-
let previousOriginalColumn = 0;
|
|
122
|
-
let previousNameIndex = 0;
|
|
123
|
-
|
|
124
|
-
return function (
|
|
125
|
-
generatedLine: number,
|
|
126
|
-
generatedColumn: number,
|
|
127
|
-
originalFile: number,
|
|
128
|
-
originalLine: number,
|
|
129
|
-
originalColumn: number,
|
|
130
|
-
nameIndex: number
|
|
131
|
-
): string {
|
|
132
|
-
// Reset column when moving to a new line
|
|
133
|
-
if (generatedLine > previousGeneratedLine) {
|
|
134
|
-
previousGeneratedColumn = 0;
|
|
135
|
-
let lines = "";
|
|
136
|
-
for (let i = previousGeneratedLine; i < generatedLine; i++) {
|
|
137
|
-
lines += ";";
|
|
138
|
-
}
|
|
139
|
-
previousGeneratedLine = generatedLine;
|
|
140
|
-
if (lines) return lines;
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
// Calculate deltas
|
|
144
|
-
const segment = [
|
|
145
|
-
generatedColumn - previousGeneratedColumn,
|
|
146
|
-
originalFile - previousOriginalFile,
|
|
147
|
-
originalLine - previousOriginalLine,
|
|
148
|
-
originalColumn - previousOriginalColumn,
|
|
149
|
-
];
|
|
150
|
-
|
|
151
|
-
if (nameIndex >= 0) {
|
|
152
|
-
segment.push(nameIndex - previousNameIndex);
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
// Update previous values
|
|
156
|
-
previousGeneratedColumn = generatedColumn;
|
|
157
|
-
previousOriginalFile = originalFile;
|
|
158
|
-
previousOriginalLine = originalLine;
|
|
159
|
-
previousOriginalColumn = originalColumn;
|
|
160
|
-
previousNameIndex = nameIndex;
|
|
161
|
-
|
|
162
|
-
return encodeVLQ(segment) + ",";
|
|
163
|
-
};
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
export function createSourceMap(originalSource: string): SourceMap {
|
|
167
|
-
return {
|
|
168
|
-
version: 3,
|
|
169
|
-
file: basename(originalSource),
|
|
170
|
-
sources: [originalSource],
|
|
171
|
-
sourcesContent: [originalSource],
|
|
172
|
-
names: [],
|
|
173
|
-
mappings: "AAAA;", // Simple line mapping
|
|
174
|
-
sourceRoot: "",
|
|
175
|
-
};
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
export function updateSourceMap(sourceMap: SourceMap, originalSource: string) {
|
|
179
|
-
// Update the source map with the transformed source
|
|
180
|
-
sourceMap.sourcesContent = [originalSource];
|
|
181
|
-
sourceMap.mappings = "AAAA;"; // Simple line mapping
|
|
182
|
-
}
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
import { type MessagePort } from "node:worker_threads";
|
|
2
|
-
import type { LoadHookContext } from "node:module";
|
|
3
|
-
import type { LoaderContext, ResolvedUserOptions, SerializedUserConfig, SerializedUserOptions } from "../types.js";
|
|
4
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { preprocessCSS } from "vite";
|
|
6
|
-
import type { ResolvedConfig } from "vite";
|
|
7
|
-
import { readFile } from "node:fs/promises";
|
|
8
|
-
import { env } from "../utils/env.js";
|
|
9
|
-
import type { InitializedCssLoaderMessage } from "../worker/types.js";
|
|
10
|
-
import { resolveOptions } from "../config/resolveOptions.js";
|
|
11
|
-
import { hydrateUserOptions } from "../helpers/index.js";
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Global port for communication between the main thread and the CSS loader.
|
|
15
|
-
* This port is used to send CSS file requests and receive responses.
|
|
16
|
-
*/
|
|
17
|
-
export let loaderPort: MessagePort | undefined;
|
|
18
|
-
|
|
19
|
-
let resolvedConfig: ResolvedConfig | undefined;
|
|
20
|
-
let userOptions: ResolvedUserOptions | undefined;
|
|
21
|
-
|
|
22
|
-
/**
|
|
23
|
-
* Initializes the CSS loader with the necessary communication channels.
|
|
24
|
-
* Sets up message handlers for CSS file requests and responses.
|
|
25
|
-
*
|
|
26
|
-
* @param data - Configuration data for the CSS loader
|
|
27
|
-
* @param data.port - The message port for communication
|
|
28
|
-
*/
|
|
29
|
-
export async function initialize(data: { id: string, port: MessagePort, resolvedConfig: SerializedUserConfig, userOptions: SerializedUserOptions }) {
|
|
30
|
-
loaderPort = data.port;
|
|
31
|
-
resolvedConfig = data.resolvedConfig;
|
|
32
|
-
const resolvedUserOptions = resolveOptions(hydrateUserOptions(data.userOptions));
|
|
33
|
-
if(resolvedUserOptions.type === "error") {
|
|
34
|
-
throw new Error(resolvedUserOptions.error.message);
|
|
35
|
-
}
|
|
36
|
-
userOptions = resolvedUserOptions.userOptions;
|
|
37
|
-
data.port.postMessage({ type: "INITIALIZED_CSS_LOADER", id: data.id } satisfies InitializedCssLoaderMessage);
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Processes a CSS file request.
|
|
44
|
-
* Sends a request to the main thread and waits for the processed CSS.
|
|
45
|
-
*
|
|
46
|
-
* @param filePath - The file system path of the CSS file
|
|
47
|
-
* @param config - The Vite config
|
|
48
|
-
* @returns A promise that resolves to the processed CSS content
|
|
49
|
-
*/
|
|
50
|
-
async function processCssFile(
|
|
51
|
-
filePath: string,
|
|
52
|
-
config: ResolvedConfig,
|
|
53
|
-
inline: boolean
|
|
54
|
-
): Promise<{ format: string; source: string; shortCircuit: boolean }> {
|
|
55
|
-
try {
|
|
56
|
-
// Convert file URL to path if needed
|
|
57
|
-
const path = filePath.startsWith("file://")
|
|
58
|
-
? fileURLToPath(filePath)
|
|
59
|
-
: filePath;
|
|
60
|
-
|
|
61
|
-
// Process CSS using Vite's preprocessCSS
|
|
62
|
-
const source = await readFile(path, "utf-8");
|
|
63
|
-
let moduleID = path;
|
|
64
|
-
if(userOptions?.normalizer) {
|
|
65
|
-
let [,value] = userOptions.normalizer(path);
|
|
66
|
-
moduleID = userOptions.moduleID(value || path);
|
|
67
|
-
}
|
|
68
|
-
const processed = await preprocessCSS(source, path, {
|
|
69
|
-
...config,
|
|
70
|
-
env: env
|
|
71
|
-
});
|
|
72
|
-
|
|
73
|
-
// If we're processing CSS for a specific page, notify the message handler
|
|
74
|
-
if (loaderPort) {
|
|
75
|
-
loaderPort.postMessage({
|
|
76
|
-
type: "CSS_FILE",
|
|
77
|
-
id: moduleID,
|
|
78
|
-
content: processed.code
|
|
79
|
-
});
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
// Return a module that can be used by React components
|
|
83
|
-
if (inline) {
|
|
84
|
-
return {
|
|
85
|
-
format: "module",
|
|
86
|
-
source: processed.code,
|
|
87
|
-
shortCircuit: true,
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
return {
|
|
91
|
-
format: "module",
|
|
92
|
-
source: `export default ${JSON.stringify(processed.modules || {})};`,
|
|
93
|
-
shortCircuit: true,
|
|
94
|
-
};
|
|
95
|
-
} catch (error) {
|
|
96
|
-
console.error(`[css-loader] Error processing CSS file: ${error}`);
|
|
97
|
-
throw error;
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
|
|
101
|
-
/**
|
|
102
|
-
* Vite's load hook implementation for CSS files.
|
|
103
|
-
* Handles CSS file loading requests and returns a placeholder module.
|
|
104
|
-
* The actual CSS content is processed in the main thread.
|
|
105
|
-
*
|
|
106
|
-
* @param url - The URL of the module to load
|
|
107
|
-
* @param context - The load hook context
|
|
108
|
-
* @param defaultLoad - The default load function
|
|
109
|
-
* @returns A promise that resolves to the module content
|
|
110
|
-
*/
|
|
111
|
-
export async function load(
|
|
112
|
-
url: string,
|
|
113
|
-
context: LoadHookContext & LoaderContext & { resolvedConfig: SerializedUserConfig },
|
|
114
|
-
defaultLoad: any
|
|
115
|
-
) {
|
|
116
|
-
const [name, query] = url.split("?");
|
|
117
|
-
if (name.endsWith(".css")) {
|
|
118
|
-
return processCssFile(url, resolvedConfig as ResolvedConfig, query === "inline");
|
|
119
|
-
}
|
|
120
|
-
|
|
121
|
-
return defaultLoad(url, context, defaultLoad);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
/**
|
|
125
|
-
* Vite's resolve hook implementation.
|
|
126
|
-
* Handles module resolution during development.
|
|
127
|
-
*
|
|
128
|
-
* @param specifier - The module specifier to resolve
|
|
129
|
-
* @param context - The resolve hook context
|
|
130
|
-
* @param defaultResolve - The default resolve function
|
|
131
|
-
* @returns A promise that resolves to the resolved module
|
|
132
|
-
*/
|
|
133
|
-
export function resolve(specifier: string, context: any, defaultResolve: any) {
|
|
134
|
-
return defaultResolve(specifier, context, defaultResolve);
|
|
135
|
-
}
|
|
@@ -1,84 +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
|
-
import { fileURLToPath } from "node:url";
|
|
5
|
-
import { readFile } from "node:fs/promises";
|
|
6
|
-
|
|
7
|
-
/**
|
|
8
|
-
* Global port for communication between the main thread and the CSS loader.
|
|
9
|
-
* This port is used to send CSS file requests and receive responses.
|
|
10
|
-
*/
|
|
11
|
-
export let loaderPort: MessagePort | undefined;
|
|
12
|
-
|
|
13
|
-
let stashedCssFiles = new Map();
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Initializes the CSS loader with the necessary communication channels.
|
|
17
|
-
* Sets up message handlers for CSS file requests and responses.
|
|
18
|
-
*
|
|
19
|
-
* @param data - Configuration data for the CSS loader
|
|
20
|
-
* @param data.port - The message port for communication
|
|
21
|
-
*/
|
|
22
|
-
export async function initialize(data: { id: string, port: MessagePort }) {
|
|
23
|
-
loaderPort = data.port;
|
|
24
|
-
data.port.postMessage({ type: "INITIALIZED_CSS_LOADER", id: data.id });
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
/**
|
|
28
|
-
* Processes a CSS file request.
|
|
29
|
-
* Sends a request to the main thread and waits for the processed CSS.
|
|
30
|
-
*
|
|
31
|
-
* @param filePath - The file system path of the CSS file
|
|
32
|
-
* @returns A promise that resolves to the processed CSS content
|
|
33
|
-
*/
|
|
34
|
-
async function processCssFile(
|
|
35
|
-
filePath: string
|
|
36
|
-
): Promise<{ format: string; source: string; shortCircuit: boolean }> {
|
|
37
|
-
try {
|
|
38
|
-
// Convert file URL to path if needed
|
|
39
|
-
const path = filePath.startsWith("file://")
|
|
40
|
-
? fileURLToPath(filePath)
|
|
41
|
-
: filePath;
|
|
42
|
-
if (stashedCssFiles.has(filePath)) {
|
|
43
|
-
return {
|
|
44
|
-
format: "module",
|
|
45
|
-
source: stashedCssFiles.get(filePath),
|
|
46
|
-
shortCircuit: true,
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
// Process CSS using Vite's preprocessCSS
|
|
50
|
-
const source = await readFile(path, "utf-8");
|
|
51
|
-
stashedCssFiles.set(path, source);
|
|
52
|
-
return {
|
|
53
|
-
format: "module",
|
|
54
|
-
source: source,
|
|
55
|
-
shortCircuit: true,
|
|
56
|
-
};
|
|
57
|
-
} catch (error) {
|
|
58
|
-
throw error;
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
/**
|
|
63
|
-
* Vite's load hook implementation for CSS files.
|
|
64
|
-
* Handles CSS file loading requests and returns a placeholder module.
|
|
65
|
-
* The actual CSS content is processed in the main thread.
|
|
66
|
-
*
|
|
67
|
-
* @param url - The URL of the module to load
|
|
68
|
-
* @param context - The load hook context
|
|
69
|
-
* @param defaultLoad - The default load function
|
|
70
|
-
* @returns A promise that resolves to the module content
|
|
71
|
-
*/
|
|
72
|
-
export async function load(
|
|
73
|
-
url: string,
|
|
74
|
-
context: LoadHookContext & LoaderContext,
|
|
75
|
-
defaultLoad: any
|
|
76
|
-
) {
|
|
77
|
-
// Handle CSS files
|
|
78
|
-
const [name] = url.split("?");
|
|
79
|
-
if (name.endsWith(".css")) {
|
|
80
|
-
return processCssFile(url);
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
return defaultLoad(url, context, defaultLoad);
|
|
84
|
-
}
|