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
package/README.md
CHANGED
|
@@ -1,473 +1,180 @@
|
|
|
1
1
|
# Vite React Server Plugin
|
|
2
2
|
|
|
3
|
-
A Vite plugin that enables React Server Components (RSC) streaming and static HTML page generation.
|
|
3
|
+
A Vite plugin that enables React Server Components (RSC) streaming and static HTML page generation. This plugin enables a unique "Native ESM" developer experience based on the React Server Components specifications.
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
**React Components as part of your build tooling** - not just as a dependency.
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
- [Github Pages](https://nicobrinkkemper.github.io/vite-plugin-react-server-demo-official/)
|
|
9
|
-
- [The mmcelebration.com project](https://github.com/nicobrinkkemper/mmc)
|
|
10
|
-
- [Github Pages](https://nicobrinkkemper.github.io/mmc/)
|
|
7
|
+
### Vite's Philosophy + React
|
|
11
8
|
|
|
12
|
-
|
|
9
|
+
[Vite's philosophy](https://vite.dev/guide/philosophy.html) is built around Native ESM and making frameworks first-class citizens. This plugin extends that philosophy to React Server Components:
|
|
13
10
|
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
11
|
+
- **Native ESM for React**: Your React components are true ESM modules that work anywhere
|
|
12
|
+
- **React as Configuration**: Serialize React Server Components for static hosting
|
|
13
|
+
- **On-Demand Loading**: Only streams the pages you're actually developing
|
|
17
14
|
|
|
18
|
-
## Open Source and Work in Progress
|
|
19
15
|
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
```sh
|
|
23
|
-
npm install -D patch-package react@experimental react-dom@experimental react-server-dom-esm
|
|
24
|
-
```
|
|
25
|
-
|
|
26
|
-
Add the following command to your `package.json` scripts:
|
|
27
|
-
|
|
28
|
-
```json
|
|
29
|
-
"patch": "patch"
|
|
30
|
-
```
|
|
31
|
-
|
|
32
|
-
Run the patch command:
|
|
16
|
+
## Quick Start
|
|
33
17
|
|
|
34
18
|
```sh
|
|
19
|
+
npm install -D vite-plugin-react-server patch-package react@experimental react-dom@experimental react-server-dom-esm
|
|
35
20
|
npm run patch
|
|
36
21
|
```
|
|
37
22
|
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
```json
|
|
41
|
-
"postinstall": "patch-package"
|
|
42
|
-
```
|
|
43
|
-
|
|
44
|
-
This ensures the patch is applied after every `npm install`. If errors arise related to `react-server-dom-esm`, verify that the postinstall step ran.
|
|
45
|
-
|
|
46
|
-
---
|
|
47
|
-
|
|
48
|
-
## Plugin Structure and Purpose
|
|
49
|
-
|
|
50
|
-
### Environment-Based Execution
|
|
51
|
-
|
|
52
|
-
This plugin uses environment detection to determine the execution context. It achieves this by checking the `NODE_OPTIONS` environment variable:
|
|
53
|
-
|
|
54
|
-
```typescript
|
|
55
|
-
import { getCondition } from "vite-plugin-react-server/config";
|
|
56
|
-
|
|
57
|
-
if (getCondition() !== "react-server") {
|
|
58
|
-
throw new Error("-10 poision damage");
|
|
59
|
-
}
|
|
60
|
-
```
|
|
61
|
-
|
|
62
|
-
Alternatively, you can pass the argument for the `react-` prefix to just get client or server back.
|
|
63
|
-
|
|
64
|
-
```typescript
|
|
65
|
-
import { getCondition } from "vite-plugin-react-server/config";
|
|
66
|
-
|
|
67
|
-
import(`plugin.${getCondition("")}.js`);
|
|
68
|
-
```
|
|
69
|
-
|
|
70
|
-
The main entry point adapts based on the environment:
|
|
71
|
-
|
|
72
|
-
- **Client Mode** (default) → Does not require the react-server condition, uses a worker thread for RSC requests
|
|
73
|
-
Benefits:
|
|
74
|
-
- log errors to console
|
|
75
|
-
- onMetric event for each page
|
|
76
|
-
- worker thread
|
|
77
|
-
- **Server Mode** (`NODE_OPTIONS="--conditions react-server"`) → Does not need worker thread for RSC requests
|
|
78
|
-
- Direct pipeline from vite to react
|
|
23
|
+
**Minimal Config:**
|
|
79
24
|
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
You can pick and choose only the plugins you like to get the desired behavior as well. For example, we can choose only to use the preserver, the transformer, static plugin, etc.
|
|
83
|
-
|
|
84
|
-
### Page & prop setup
|
|
85
|
-
|
|
86
|
-
The minimal config is
|
|
87
|
-
|
|
88
|
-
```tsx
|
|
89
|
-
// vite.config.tsx
|
|
90
|
-
import type { StreamPluginOptions } from "vite-plugin-react-server/types";
|
|
91
|
-
import { join } from "node:path";
|
|
25
|
+
```ts
|
|
26
|
+
// vite.config.ts
|
|
92
27
|
import { defineConfig } from "vite";
|
|
93
28
|
import { vitePluginReactServer } from "vite-plugin-react-server";
|
|
94
|
-
import { config } from "./vite.react.config.js";
|
|
95
29
|
|
|
96
|
-
export default defineConfig(
|
|
97
|
-
return {
|
|
30
|
+
export default defineConfig({
|
|
98
31
|
plugins: vitePluginReactServer({
|
|
99
32
|
moduleBase: "src",
|
|
100
|
-
Page:
|
|
33
|
+
Page: `src/page.tsx`,
|
|
34
|
+
build: { pages: ["/"] }
|
|
101
35
|
}),
|
|
102
|
-
};
|
|
103
36
|
});
|
|
104
37
|
```
|
|
105
38
|
|
|
106
|
-
|
|
39
|
+
**Create a Page:**
|
|
107
40
|
|
|
108
41
|
```tsx
|
|
109
42
|
// src/page.tsx
|
|
110
|
-
import React from "react";
|
|
111
43
|
export function Page({ url }) {
|
|
112
|
-
return <div>
|
|
44
|
+
return <div>Hello from {url}</div>;
|
|
113
45
|
}
|
|
114
46
|
```
|
|
115
47
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
```tsx
|
|
119
|
-
import React, { use } from "react";
|
|
120
|
-
import { createRoot } from "react-dom/client";
|
|
121
|
-
import { createReactFetcher } from "vite-plugin-react-server/utils";
|
|
122
|
-
// src/client.tsx
|
|
123
|
-
const Shell: React.FC<{
|
|
124
|
-
data: React.Usable<React.ReactNode>;
|
|
125
|
-
}> = ({ data: initialServerData }) => {
|
|
126
|
-
const content = use(initialServerData);
|
|
127
|
-
return content as React.ReactNode;
|
|
128
|
-
};
|
|
129
|
-
// Initialize the app
|
|
130
|
-
const rootElement = document.getElementById("root");
|
|
131
|
-
if (!rootElement) throw new Error("Root element not found");
|
|
132
|
-
|
|
133
|
-
const intitalData = createReactFetcher({
|
|
134
|
-
url: window.location.pathname,
|
|
135
|
-
moduleBaseURL: import.meta.env.BASE_URL,
|
|
136
|
-
publicOrigin: import.meta.env.PUBLIC_ORIGIN,
|
|
137
|
-
});
|
|
48
|
+
## Development & Build
|
|
138
49
|
|
|
139
|
-
|
|
140
|
-
```
|
|
141
|
-
|
|
142
|
-
index.html for completeness sake
|
|
143
|
-
|
|
144
|
-
```html
|
|
145
|
-
<!DOCTYPE html>
|
|
146
|
-
<html lang="en">
|
|
147
|
-
<head>
|
|
148
|
-
<meta charset="utf-8" />
|
|
149
|
-
<body>
|
|
150
|
-
<div id="root"></div>
|
|
151
|
-
<script type="module" src="/src/client.tsx"></script>
|
|
152
|
-
</body>
|
|
153
|
-
</html>
|
|
154
|
-
```
|
|
155
|
-
|
|
156
|
-
By default, without any prop configurations, the Page receives a normalized url.
|
|
157
|
-
|
|
158
|
-
With custom "get prop" function, we can enrich the props with more information.
|
|
159
|
-
|
|
160
|
-
```tsx
|
|
161
|
-
import React from "react";
|
|
162
|
-
|
|
163
|
-
export const props = (url) => ({ title: "Hello World", file: import.meta.url, url });
|
|
164
|
-
|
|
165
|
-
export type Props = ReturnType<typeof props>
|
|
166
|
-
|
|
167
|
-
export function Page({ file, title, url }: Props) {
|
|
168
|
-
return <>
|
|
169
|
-
<title>{title}<title>
|
|
170
|
-
<div>This file is here: {file}</div>;
|
|
171
|
-
<div>You are on: {url}</div>;
|
|
172
|
-
</>
|
|
173
|
-
}
|
|
174
|
-
```
|
|
175
|
-
|
|
176
|
-
You can also define a router specifically for the props file.
|
|
177
|
-
|
|
178
|
-
```tsx
|
|
50
|
+
```json
|
|
179
51
|
{
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
52
|
+
"scripts": {
|
|
53
|
+
"dev": "NODE_OPTIONS='--conditions react-server' vite",
|
|
54
|
+
"dev:client": "vite",
|
|
55
|
+
"build": "vite build && vite build --ssr && NODE_OPTIONS='--conditions react-server' vite build",
|
|
56
|
+
"debug-build": "NODE_ENV=development && vite build --mode vite build --mode development && NODE_OPTIONS='--conditions react-server' vite build",
|
|
57
|
+
}
|
|
184
58
|
}
|
|
185
59
|
```
|
|
186
60
|
|
|
187
|
-
|
|
61
|
+
- **`npm run dev`**: Server-side development with direct React pipeline
|
|
62
|
+
- **`npm run dev:client`**: Client-side development with worker threads
|
|
63
|
+
- **`npm run build`**: Creates optimized static, client, and server builds
|
|
188
64
|
|
|
189
|
-
|
|
190
|
-
export const props = (url) => ({
|
|
191
|
-
title: "Hello World",
|
|
192
|
-
file: import.meta.url,
|
|
193
|
-
url,
|
|
194
|
-
});
|
|
65
|
+
## Environment-Based Execution
|
|
195
66
|
|
|
196
|
-
|
|
197
|
-
```
|
|
67
|
+
The plugin uses environment detection to determine execution context:
|
|
198
68
|
|
|
199
|
-
|
|
69
|
+
```typescript
|
|
70
|
+
import { getCondition } from "vite-plugin-react-server/config";
|
|
200
71
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
Page: "src/page.tsx",
|
|
205
|
-
props: "src/props.ts"
|
|
206
|
-
// define the routes we want to render
|
|
207
|
-
build: {
|
|
208
|
-
pages: ['/', '/404']
|
|
209
|
-
}
|
|
210
|
-
};
|
|
72
|
+
if (getCondition() !== "react-server") {
|
|
73
|
+
throw new Error("-10 poison damage");
|
|
74
|
+
}
|
|
211
75
|
```
|
|
212
76
|
|
|
213
|
-
|
|
214
|
-
|
|
77
|
+
- **Client Mode** (default): Uses worker threads for RSC requests
|
|
78
|
+
- **Server Mode** (`NODE_OPTIONS="--conditions react-server"`): Direct React pipeline
|
|
215
79
|
|
|
216
|
-
|
|
80
|
+
## Advanced Features
|
|
217
81
|
|
|
218
|
-
|
|
82
|
+
### Props and Routing
|
|
219
83
|
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
Keep in mind that, using your custom worker means interacting with the message system of this plugin during development/static generation process.
|
|
225
|
-
|
|
226
|
-
## Plugin Usage
|
|
227
|
-
|
|
228
|
-
```ts
|
|
229
|
-
import { defineConfig, type Plugin } from "vite";
|
|
230
|
-
import { vitePluginReactClient } from "vite-plugin-react-server";
|
|
231
|
-
import { config } from "./vite.react.config";
|
|
232
|
-
import type { StreamPluginOptions } from "vite-plugin-react-server/server";
|
|
233
|
-
|
|
234
|
-
const createRouter = (file: "props.ts" | "page.tsx") => (url: string) => {
|
|
84
|
+
```tsx
|
|
85
|
+
// React components configure routing
|
|
86
|
+
const createRouter = (file) => (url) => {
|
|
235
87
|
switch (url) {
|
|
236
|
-
case "/":
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
return `src/page/bidoof/${file}`;
|
|
240
|
-
case "/404":
|
|
241
|
-
default:
|
|
242
|
-
return `src/page/404/${file}`;
|
|
88
|
+
case "/": return `src/home/${file}`;
|
|
89
|
+
case "/about": return `src/about/${file}`;
|
|
90
|
+
default: return `src/404/${file}`;
|
|
243
91
|
}
|
|
244
92
|
};
|
|
245
93
|
|
|
246
|
-
export const config = {
|
|
247
|
-
moduleBase: "src",
|
|
248
|
-
Page: createRouter("page.tsx"),
|
|
249
|
-
props: createRouter("props.ts"),
|
|
250
|
-
Html: Html,
|
|
251
|
-
build: {
|
|
252
|
-
pages: ["/", "/bidoof", "/404"],
|
|
253
|
-
},
|
|
254
|
-
} satisfies StreamPluginOptions;
|
|
255
|
-
|
|
256
94
|
export default defineConfig({
|
|
257
|
-
plugins:
|
|
95
|
+
plugins: vitePluginReactServer({
|
|
96
|
+
Page: createRouter("page.tsx"),
|
|
97
|
+
props: createRouter("props.ts"),
|
|
98
|
+
build: { pages: ["/", "/about"] }
|
|
99
|
+
}),
|
|
258
100
|
});
|
|
259
101
|
```
|
|
260
102
|
|
|
261
|
-
This will mirror your directory structure for new static routes. If you need to handle
|
|
262
|
-
dynamic requests, like pointing /:theme/ to a certain folder, you need to parse this yourself
|
|
263
|
-
using code.
|
|
264
103
|
|
|
265
|
-
### Async build pages
|
|
266
104
|
|
|
267
|
-
|
|
105
|
+
### Server Actions
|
|
268
106
|
|
|
269
107
|
```tsx
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
}
|
|
273
|
-
```
|
|
274
|
-
### Built-in React Server Components
|
|
275
|
-
|
|
276
|
-
This plugin built-in React Component that can be configured through the options to be your own component. Direct server component config inputs are not yet supported through worker threads.
|
|
277
|
-
|
|
278
|
-
- Html - used as the wrapper for production pages (use vite's `index.html` for the development wrapper and entry point for client files & global css)
|
|
279
|
-
- CssCollector - used to emit `<link>` and `<style>` tags based on `css` config
|
|
280
|
-
|
|
281
|
-
Defining your custom Html React server component will affect the final production output.
|
|
282
|
-
|
|
283
|
-
#### Build Steps
|
|
284
|
-
|
|
285
|
-
```sh
|
|
286
|
-
vite build
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
Targets browsers, outputs to `dist/static`.
|
|
290
|
-
|
|
291
|
-
```sh
|
|
292
|
-
vite build --ssr
|
|
293
|
-
```
|
|
294
|
-
|
|
295
|
-
Targets non-`react-server` node environment, used for server-side-rendering, outputs to `dist/client`.
|
|
296
|
-
|
|
297
|
-
```sh
|
|
298
|
-
NODE_OPTIONS="--conditions=react-server" vite build
|
|
299
|
-
```
|
|
300
|
-
|
|
301
|
-
Targets `react-server`-only environment, outputs to `dist/server`. In this case, `ssr` is implied and defaults to true.
|
|
302
|
-
|
|
303
|
-
---
|
|
304
|
-
|
|
305
|
-
### vite-plugin-react-server
|
|
306
|
-
|
|
307
|
-
```ts
|
|
308
|
-
import { defineConfig, Plugin } from "vite";
|
|
309
|
-
import { vitePluginReactServer } from "vite-plugin-react-server";
|
|
310
|
-
import { config } from "./vite.react.config";
|
|
311
|
-
|
|
312
|
-
export default defineConfig({
|
|
313
|
-
plugins: vitePluginReactServer(config),
|
|
314
|
-
});
|
|
315
|
-
```
|
|
316
|
-
|
|
317
|
-
#### Running in Development
|
|
318
|
-
|
|
319
|
-
```sh
|
|
320
|
-
NODE_OPTIONS="--conditions=react-server" vite
|
|
321
|
-
```
|
|
322
|
-
|
|
323
|
-
A direct server pipeline that doesn't require a `rsc-worker`.
|
|
324
|
-
|
|
325
|
-
To develop the app using the `rsc-worker`, simply run
|
|
326
|
-
|
|
327
|
-
```sh
|
|
328
|
-
vite
|
|
329
|
-
```
|
|
330
|
-
|
|
331
|
-
without the `react-server` condition. This will work a little bit differently under the hood, it can provide additional development support like error logging, metric events and custom rsc worker development.
|
|
332
|
-
|
|
333
|
-
## Static Site Generation
|
|
334
|
-
|
|
335
|
-
Single-out the static generation step by only inluding the static plugin. Expects client and server folders to be there.
|
|
336
|
-
|
|
337
|
-
```ts
|
|
338
|
-
import { defineConfig, Plugin } from "vite";
|
|
339
|
-
import { reactStaticPlugin } from "vite-plugin-react-server/static";
|
|
340
|
-
import { config } from "./vite.react.config";
|
|
341
|
-
|
|
342
|
-
export default defineConfig({
|
|
343
|
-
plugins: [reactStaticPlugin(config)],
|
|
344
|
-
});
|
|
345
|
-
```
|
|
346
|
-
|
|
347
|
-
Example output structure:
|
|
348
|
-
|
|
349
|
-
```sh
|
|
350
|
-
dist/static/index.html
|
|
351
|
-
dist/static/index.rsc
|
|
352
|
-
dist/static/about/index.html
|
|
353
|
-
dist/static/about/index.rsc
|
|
354
|
-
```
|
|
355
|
-
|
|
356
|
-
This plugin is included by default when the `react-server` condition is set.
|
|
357
|
-
|
|
358
|
-
---
|
|
108
|
+
// actions.server.ts
|
|
109
|
+
"use server";
|
|
359
110
|
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
```ts
|
|
365
|
-
const config = {
|
|
366
|
-
moduleBase: "src",
|
|
367
|
-
};
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
Defines the root directory for project modules. This can be customized.
|
|
371
|
-
|
|
372
|
-
### moduleBasePath
|
|
373
|
-
|
|
374
|
-
```ts
|
|
375
|
-
moduleBasePath: "/",
|
|
376
|
-
```
|
|
377
|
-
|
|
378
|
-
Passed as the second argument to `renderToPipeableStream` for server-side rendering.
|
|
379
|
-
|
|
380
|
-
### moduleBaseURL
|
|
381
|
-
|
|
382
|
-
```ts
|
|
383
|
-
moduleBaseURL: "/",
|
|
384
|
-
```
|
|
385
|
-
|
|
386
|
-
Defines asset URL resolution for CSS collectors and bootstrapModule.
|
|
111
|
+
export async function addTodo(title: string) {
|
|
112
|
+
return { success: true };
|
|
113
|
+
}
|
|
387
114
|
|
|
388
|
-
|
|
389
|
-
|
|
115
|
+
// Use in components
|
|
116
|
+
import { addTodo } from "./actions.server.js";
|
|
117
|
+
export function TodoForm() {
|
|
118
|
+
return <form action={addTodo}>...</form>;
|
|
119
|
+
}
|
|
390
120
|
```
|
|
391
121
|
|
|
392
|
-
###
|
|
393
|
-
|
|
394
|
-
```ts
|
|
395
|
-
Page: (id) => join('src', id, "page.tsx");
|
|
396
|
-
```
|
|
122
|
+
### Client Components
|
|
397
123
|
|
|
398
|
-
|
|
124
|
+
```tsx
|
|
125
|
+
// Counter.client.tsx
|
|
126
|
+
"use client";
|
|
127
|
+
import { useState } from "react";
|
|
399
128
|
|
|
400
|
-
|
|
401
|
-
|
|
129
|
+
export function Counter() {
|
|
130
|
+
const [count, setCount] = useState(0);
|
|
131
|
+
return <button onClick={() => setCount(count + 1)}>{count}</button>;
|
|
132
|
+
}
|
|
402
133
|
```
|
|
403
134
|
|
|
404
|
-
|
|
135
|
+
## Build Output
|
|
405
136
|
|
|
406
|
-
|
|
137
|
+
The plugin generates three build targets:
|
|
407
138
|
|
|
408
|
-
```ts
|
|
409
|
-
pageExportName: 'Page',
|
|
410
139
|
```
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
propsExportName: 'props',
|
|
140
|
+
dist/
|
|
141
|
+
├── static/ # Browser-ready static files (HTML + RSC)
|
|
142
|
+
├── client/ # Server-side rendering modules
|
|
143
|
+
└── server/ # React Server Components modules
|
|
416
144
|
```
|
|
417
145
|
|
|
418
|
-
|
|
146
|
+
## Testing
|
|
419
147
|
|
|
420
|
-
|
|
148
|
+
The plugin includes 235 test cases across 20 test files covering:
|
|
149
|
+
- Build processes (static, client, server)
|
|
150
|
+
- Server action integration
|
|
151
|
+
- Error handling and edge cases
|
|
152
|
+
- Type safety and React compatibility
|
|
153
|
+
- Performance with large outputs
|
|
421
154
|
|
|
422
|
-
##
|
|
155
|
+
## Documentation
|
|
423
156
|
|
|
424
|
-
|
|
157
|
+
| Topic | Description |
|
|
158
|
+
|-------|-------------|
|
|
159
|
+
| [Getting Started](./docs/getting-started.md) | Complete installation and setup guide |
|
|
160
|
+
| [Core Concepts](./docs/core-concepts.md) | Architecture, RSC, and plugin design |
|
|
161
|
+
| [Configuration](./docs/configuration.md) | All configuration options and examples |
|
|
162
|
+
| [CSS Handling](./docs/css-handling.md) | CSS collection, inlining, and optimization |
|
|
163
|
+
| [Server Actions](./docs/server-actions.md) | Server-side functions and database integration |
|
|
164
|
+
| [Static Site Generation](./docs/static-site-generation.md) | Building and deploying static sites |
|
|
165
|
+
| [API Reference](./docs/api-reference.md) | Complete API documentation |
|
|
166
|
+
| [Advanced Topics](./docs/advanced-topics.md) | Custom workers and extending the plugin |
|
|
425
167
|
|
|
426
|
-
|
|
427
|
-
"scripts": {
|
|
428
|
-
"build": "build:static && build:client && build:server",
|
|
429
|
-
"dev": "NODE_OPTIONS='--conditions react-server' vite",
|
|
430
|
-
"start": "vite",
|
|
431
|
-
"build:server": "NODE_OPTIONS='--conditions react-server' vite build",
|
|
432
|
-
"build:client": "vite build --ssr",
|
|
433
|
-
"build:static": "vite build"
|
|
434
|
-
}
|
|
435
|
-
```
|
|
168
|
+
## Requirements
|
|
436
169
|
|
|
437
|
-
|
|
170
|
+
- **Node.js**: 23.7.0 or higher
|
|
171
|
+
- **React**: Experimental version (handled by patch system)
|
|
172
|
+
- **Vite**: Compatible with latest Vite versions
|
|
438
173
|
|
|
439
|
-
|
|
440
|
-
// src/my-page.tsx
|
|
441
|
-
export const Page = ({ name }) => {
|
|
442
|
-
return <div>Hello {name}</div>;
|
|
443
|
-
};
|
|
444
|
-
// src/async-page.tsx
|
|
445
|
-
export const Page = async ({ name }) => {
|
|
446
|
-
return <div>Hello {name}</div>;
|
|
447
|
-
};
|
|
448
|
-
```
|
|
449
|
-
|
|
450
|
-
### Sample Props File
|
|
451
|
-
|
|
452
|
-
All of the below are valid
|
|
174
|
+
## Contributing
|
|
453
175
|
|
|
454
|
-
|
|
455
|
-
// src/my-props.ts
|
|
456
|
-
export const props = {
|
|
457
|
-
name: "John Doe",
|
|
458
|
-
};
|
|
459
|
-
export const props = (url)=>{
|
|
460
|
-
name: "John Doe",
|
|
461
|
-
};
|
|
462
|
-
export const props = async (url)=>{
|
|
463
|
-
name: "John Doe",
|
|
464
|
-
}
|
|
465
|
-
// enum bonus
|
|
466
|
-
export const props = ['key']; // -> {key: "key"}
|
|
467
|
-
// Object.fromEntries()
|
|
468
|
-
export const props = [['key',{value: 'some value'}]]
|
|
469
|
-
```
|
|
176
|
+
This project uses experimental React features and includes a patch system for compatibility. See [Patch System](./docs/patch-system.md) for maintenance details.
|
|
470
177
|
|
|
471
|
-
##
|
|
178
|
+
## License
|
|
472
179
|
|
|
473
|
-
|
|
180
|
+
MIT License - see [LICENSE](./LICENSE) file for details.
|
|
@@ -21,4 +21,4 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
|
21
21
|
};
|
|
22
22
|
|
|
23
23
|
export { __variableDynamicImportRuntimeHelper as default };
|
|
24
|
-
//# sourceMappingURL=
|
|
24
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiZHluYW1pYy1pbXBvcnQtaGVscGVyLmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7Ozs7OyJ9
|
package/dist/client.d.ts
CHANGED
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAKA,
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../client.ts"],"names":[],"mappings":"AAKA,cAAc,gCAAgC,CAAA;AAE9C,mBAAmB,mBAAmB,CAAA"}
|
package/dist/client.js
CHANGED
|
@@ -3,5 +3,8 @@
|
|
|
3
3
|
* Copyright (c) Nico Brinkkemper
|
|
4
4
|
* MIT License
|
|
5
5
|
*/
|
|
6
|
-
export {
|
|
7
|
-
|
|
6
|
+
export { createWorkerStream } from './plugin/react-client/createWorkerStream.js';
|
|
7
|
+
export { handleWorkerRscStream } from './plugin/react-client/handleWorkerRscStream.js';
|
|
8
|
+
export { handleWorkerServerAction } from './plugin/react-client/handleWorkerServerAction.js';
|
|
9
|
+
export { reactClientPlugin as vitePluginReactClient } from './plugin/react-client/plugin.js';
|
|
10
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY2xpZW50LmpzIiwic291cmNlcyI6W10sInNvdXJjZXNDb250ZW50IjpbXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7In0=
|
package/dist/index.js
CHANGED
|
@@ -14,4 +14,4 @@ const vitePluginReactServer = await __variableDynamicImportRuntimeHelper((/* #__
|
|
|
14
14
|
});
|
|
15
15
|
|
|
16
16
|
export { vitePluginReactServer };
|
|
17
|
-
//# sourceMappingURL=
|
|
17
|
+
//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VzIjpbIi4uL2luZGV4LnRzIl0sInNvdXJjZXNDb250ZW50IjpbIlwidXNlIHN0cmljdFwiO1xuXG5jb25zdCBjb25kaXRpb24gPSBwcm9jZXNzLmVudlsnTk9ERV9PUFRJT05TJ10/Lm1hdGNoKC8tLWNvbmRpdGlvbnNbPSBdcmVhY3Qtc2VydmVyLykgPyAnc2VydmVyJyA6ICdjbGllbnQnXG5cbmV4cG9ydCBjb25zdCB2aXRlUGx1Z2luUmVhY3RTZXJ2ZXIgPSBhd2FpdCBpbXBvcnQoYC4vcGx1Z2luL3JlYWN0LXNlcnZlci9wbHVnaW4uJHtjb25kaXRpb259LmpzYCkudGhlbihtID0+IHtcbiAgaWYoISgndml0ZVBsdWdpblJlYWN0U2VydmVyJyBpbiBtKSl7XG4gICAgdGhyb3cgbmV3IEVycm9yKGBDb3VsZCBub3QgZmluZCB2aXRlUGx1Z2luUmVhY3RTZXJ2ZXIgaW4gLi9wbHVnaW4vcmVhY3Qtc2VydmVyL3BsdWdpbi4ke2NvbmRpdGlvbn0uanNgKTtcbiAgfVxuICByZXR1cm4gbVsndml0ZVBsdWdpblJlYWN0U2VydmVyJ11cbn0pXG5cbi8vIHR5cGVzXG5leHBvcnQgdHlwZSAqIGZyb20gJy4vcGx1Z2luL3R5cGVzLmpzJyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7O0FBRUEsTUFBTSxTQUFBLEdBQVksUUFBUSxHQUFJLENBQUEsY0FBYyxHQUFHLEtBQU0sQ0FBQSw4QkFBOEIsSUFBSSxRQUFXLEdBQUEsUUFBQTtBQUUzRixNQUFNLHdCQUF3QixNQUFNLG9DQUFBLG1DQUFBLEdBQUEsQ0FBQSw2QkFBQSxFQUFBLFNBQUEsQ0FBQSxHQUFBLENBQUEsRUFBQSxDQUFBLENBQWdELENBQU8sS0FBSyxDQUFLLENBQUEsS0FBQTtBQUMxRyxFQUFHLElBQUEsRUFBRSwyQkFBMkIsQ0FBRyxDQUFBLEVBQUE7QUFDakMsSUFBQSxNQUFNLElBQUksS0FBQSxDQUFNLENBQXdFLHFFQUFBLEVBQUEsU0FBUyxDQUFLLEdBQUEsQ0FBQSxDQUFBO0FBQUE7QUFFeEcsRUFBQSxPQUFPLEVBQUUsdUJBQXVCLENBQUE7QUFDbEMsQ0FBQzs7OzsifQ==
|