vite-plugin-react-server 1.1.10 → 1.1.12
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 +208 -27
- package/dist/package.json +34 -14
- package/dist/plugin/{css-collector-elements.d.ts → components/css-collector-elements.d.ts} +1 -1
- package/dist/plugin/components/css-collector-elements.d.ts.map +1 -0
- package/dist/plugin/components/css-collector-elements.js.map +1 -0
- package/dist/plugin/{css-collector.d.ts → components/css-collector.d.ts} +1 -1
- package/dist/plugin/components/css-collector.d.ts.map +1 -0
- package/dist/plugin/components/css-collector.js.map +1 -0
- package/dist/plugin/components/html.d.ts +4 -0
- package/dist/plugin/components/html.d.ts.map +1 -0
- package/dist/plugin/components/html.js +17 -0
- package/dist/plugin/components/html.js.map +1 -0
- package/dist/plugin/components/index.d.ts +5 -0
- package/dist/plugin/components/index.d.ts.map +1 -0
- package/dist/plugin/components.js +9 -3
- package/dist/plugin/components.js.map +1 -0
- package/dist/plugin/config/autoDiscover/index.d.ts +6 -0
- package/dist/plugin/config/autoDiscover/index.d.ts.map +1 -0
- package/dist/plugin/config/autoDiscover/index.js +8 -0
- package/dist/plugin/config/{resolveAutoDiscover.d.ts → autoDiscover/resolveAutoDiscover.d.ts} +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts.map +1 -0
- package/dist/plugin/config/{resolveAutoDiscover.js → autoDiscover/resolveAutoDiscover.js} +10 -9
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js.map +1 -0
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js +10 -10
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js.map +1 -1
- package/dist/plugin/config/defaults.d.ts +4 -3
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +5 -3
- package/dist/plugin/config/defaults.js.map +1 -1
- package/dist/plugin/config/index.d.ts +1 -0
- package/dist/plugin/config/index.d.ts.map +1 -1
- package/dist/plugin/config/index.js +1 -0
- package/dist/plugin/config/resolveEnv.d.ts +11 -1
- package/dist/plugin/config/resolveEnv.d.ts.map +1 -1
- package/dist/plugin/config/resolveEnv.js +104 -5
- package/dist/plugin/config/resolveEnv.js.map +1 -1
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +11 -4
- package/dist/plugin/config/resolveOptions.js.map +1 -1
- package/dist/plugin/config/resolveUrlOption.d.ts +1 -1
- package/dist/plugin/config/resolveUrlOption.d.ts.map +1 -1
- package/dist/plugin/config/resolveUrlOption.js +1 -2
- package/dist/plugin/config/resolveUrlOption.js.map +1 -1
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +43 -18
- package/dist/plugin/config/resolveUserConfig.js.map +1 -1
- package/dist/plugin/config.js +17 -0
- package/dist/plugin/config.js.map +1 -0
- package/dist/plugin/env/index.d.ts +2 -0
- package/dist/plugin/env/index.d.ts.map +1 -0
- package/dist/plugin/env/index.js +1 -0
- package/dist/plugin/env/plugin.d.ts +30 -0
- package/dist/plugin/env/plugin.d.ts.map +1 -0
- package/dist/plugin/env/plugin.js +64 -0
- package/dist/plugin/env.js +45 -0
- package/dist/plugin/env.js.map +1 -0
- package/dist/plugin/error/toError.d.ts +6 -0
- package/dist/plugin/error/toError.d.ts.map +1 -0
- package/dist/plugin/error/toError.js +19 -0
- package/dist/plugin/error/toError.js.map +1 -0
- package/dist/plugin/file-preserver/plugin.d.ts +19 -0
- package/dist/plugin/file-preserver/plugin.d.ts.map +1 -0
- package/dist/plugin/file-preserver/plugin.js +108 -0
- package/dist/plugin/file-preserver.js +96 -0
- package/dist/plugin/file-preserver.js.map +1 -0
- package/dist/plugin/helpers/createEventHandler.d.ts +1 -1
- package/dist/plugin/helpers/createRscStream.js +1 -1
- package/dist/plugin/helpers/createRscStream.js.map +1 -1
- package/dist/plugin/helpers/formatMetrics.d.ts +3 -1
- package/dist/plugin/helpers/formatMetrics.d.ts.map +1 -1
- package/dist/plugin/helpers/formatMetrics.js +22 -7
- package/dist/plugin/helpers/formatMetrics.js.map +1 -0
- package/dist/plugin/helpers/getRouteFiles.d.ts +1 -1
- package/dist/plugin/helpers/getRouteFiles.d.ts.map +1 -1
- package/dist/plugin/helpers/getRouteFiles.js +37 -18
- package/dist/plugin/helpers/getRouteFiles.js.map +1 -0
- package/dist/plugin/helpers/index.d.ts +24 -0
- package/dist/plugin/helpers/index.d.ts.map +1 -0
- package/dist/plugin/helpers/index.js +31 -0
- package/dist/plugin/helpers/metrics.js +26 -2
- package/dist/plugin/helpers/metrics.js.map +1 -1
- package/dist/plugin/helpers/moduleRefs.d.ts.map +1 -0
- package/dist/plugin/helpers/moduleRefs.js.map +1 -0
- package/dist/plugin/helpers/requestInfo.d.ts +10 -0
- package/dist/plugin/helpers/requestInfo.d.ts.map +1 -1
- package/dist/plugin/helpers/requestInfo.js.map +1 -1
- package/dist/plugin/helpers/requestToRoute.js +22 -14
- package/dist/plugin/helpers/requestToRoute.js.map +1 -0
- package/dist/plugin/helpers/resolvePage.d.ts.map +1 -0
- package/dist/plugin/{resolvePage.js → helpers/resolvePage.js} +19 -3
- package/dist/plugin/helpers/resolvePage.js.map +1 -0
- package/dist/plugin/helpers/resolvePageAndProps.d.ts.map +1 -1
- package/dist/plugin/helpers/resolvePageAndProps.js +7 -4
- package/dist/plugin/helpers/resolvePageAndProps.js.map +1 -1
- package/dist/plugin/helpers/resolveProps.d.ts.map +1 -0
- package/dist/plugin/{resolveProps.js → helpers/resolveProps.js} +9 -6
- package/dist/plugin/helpers/resolveProps.js.map +1 -0
- package/dist/plugin/helpers/serializeUserOptions.js +1 -1
- package/dist/plugin/helpers/serializeUserOptions.js.map +1 -1
- package/dist/plugin/helpers/stashReturnValue.js +19 -13
- package/dist/plugin/helpers/stashReturnValue.js.map +1 -0
- package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/tryManifest.js +0 -1
- package/dist/plugin/helpers/tryManifest.js.map +1 -1
- package/dist/plugin/helpers.js +27 -0
- package/dist/plugin/helpers.js.map +1 -0
- package/dist/plugin/loader/createBuildLoader.js +1 -1
- package/dist/plugin/loader/createBuildLoader.js.map +1 -1
- package/dist/plugin/loader/env-loader.development.d.ts +12 -0
- package/dist/plugin/loader/env-loader.development.d.ts.map +1 -0
- package/dist/plugin/loader/env-loader.development.js +60 -0
- package/dist/plugin/plugin.client.d.ts.map +1 -1
- package/dist/plugin/plugin.client.js +2 -0
- package/dist/plugin/plugin.client.js.map +1 -1
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +1 -2
- package/dist/plugin/plugin.server.d.ts.map +1 -1
- package/dist/plugin/plugin.server.js +3 -0
- package/dist/plugin/plugin.server.js.map +1 -1
- package/dist/plugin/process-env.d.ts +14 -0
- package/dist/plugin/process-env.d.ts.map +1 -0
- package/dist/plugin/react-client/createMessageHandlers.d.ts +2 -1
- package/dist/plugin/react-client/createMessageHandlers.d.ts.map +1 -1
- package/dist/plugin/react-client/createMessageHandlers.js +13 -2
- package/dist/plugin/react-client/createMessageHandlers.js.map +1 -1
- package/dist/plugin/react-client/createWorkerStream.d.ts +8 -2
- package/dist/plugin/react-client/createWorkerStream.d.ts.map +1 -1
- package/dist/plugin/react-client/createWorkerStream.js +49 -8
- package/dist/plugin/react-client/createWorkerStream.js.map +1 -1
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts +19 -0
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts.map +1 -0
- package/dist/plugin/react-client/handleWorkerRscStream.js +47 -0
- package/dist/plugin/react-client/handleWorkerRscStream.js.map +1 -0
- package/dist/plugin/react-client/plugin.d.ts.map +1 -1
- package/dist/plugin/react-client/plugin.js +18 -2
- package/dist/plugin/react-client/plugin.js.map +1 -1
- package/dist/plugin/react-client/restartWorker.d.ts +6 -1
- package/dist/plugin/react-client/restartWorker.d.ts.map +1 -1
- package/dist/plugin/react-client/restartWorker.js +13 -5
- package/dist/plugin/react-client/restartWorker.js.map +1 -1
- package/dist/plugin/react-client/server.d.ts +2 -13
- package/dist/plugin/react-client/server.d.ts.map +1 -1
- package/dist/plugin/react-client/server.js +112 -99
- package/dist/plugin/react-client/server.js.map +1 -1
- package/dist/plugin/react-server/plugin.d.ts.map +1 -1
- package/dist/plugin/react-server/plugin.js +18 -8
- package/dist/plugin/react-server/plugin.js.map +1 -1
- package/dist/plugin/react-server/server.d.ts.map +1 -1
- package/dist/plugin/react-server/server.js +28 -12
- package/dist/plugin/react-server/server.js.map +1 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts.map +1 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.js +9 -0
- package/dist/plugin/react-static/collectHtmlWorkerContent.js.map +1 -1
- package/dist/plugin/react-static/fileWriter.d.ts +1 -1
- package/dist/plugin/react-static/fileWriter.d.ts.map +1 -1
- package/dist/plugin/react-static/fileWriter.js.map +1 -1
- package/dist/plugin/react-static/plugin.d.ts.map +1 -1
- package/dist/plugin/react-static/plugin.js +19 -27
- package/dist/plugin/react-static/plugin.js.map +1 -1
- package/dist/plugin/root.d.ts +1 -0
- package/dist/plugin/root.d.ts.map +1 -1
- package/dist/plugin/root.js +3 -2
- package/dist/plugin/root.js.map +1 -1
- package/dist/plugin/transformer/upgradeCssModuleCode.d.ts +1 -10
- package/dist/plugin/transformer/upgradeCssModuleCode.d.ts.map +1 -1
- package/dist/plugin/transformer/upgradeCssModuleCode.js +40 -38
- package/dist/plugin/types.d.ts +57 -15
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/types.js +1 -1
- package/dist/plugin/utils/callServer.d.ts +1 -1
- package/dist/plugin/utils/callServer.d.ts.map +1 -1
- package/dist/plugin/utils/callServer.js +2 -16
- package/dist/plugin/utils/callServer.js.map +1 -1
- package/dist/plugin/utils/createCallServer.d.ts +2 -0
- package/dist/plugin/utils/createCallServer.d.ts.map +1 -0
- package/dist/plugin/utils/createCallServer.js +28 -0
- package/dist/plugin/utils/createCallServer.js.map +1 -0
- package/dist/plugin/utils/createReactFetcher.d.ts +3 -1
- package/dist/plugin/utils/createReactFetcher.d.ts.map +1 -1
- package/dist/plugin/utils/createReactFetcher.js +7 -5
- package/dist/plugin/utils/createReactFetcher.js.map +1 -1
- package/dist/plugin/utils/env.js.map +1 -1
- package/dist/plugin/utils/envUrls.d.ts +9 -0
- package/dist/plugin/utils/envUrls.d.ts.map +1 -0
- package/dist/plugin/utils/envUrls.js +7 -0
- package/dist/plugin/utils/envUrls.node.d.ts +7 -0
- package/dist/plugin/utils/envUrls.node.d.ts.map +1 -0
- package/dist/plugin/utils/envUrls.node.js +11 -0
- package/dist/plugin/utils/envUrls.node.js.map +1 -0
- package/dist/plugin/utils/index.d.ts +1 -1
- package/dist/plugin/utils/index.d.ts.map +1 -1
- package/dist/plugin/utils/index.js +1 -1
- package/dist/plugin/utils/moduleBaseURL.d.ts +3 -0
- package/dist/plugin/utils/moduleBaseURL.d.ts.map +1 -0
- package/dist/plugin/utils/moduleBaseURL.js +4 -0
- package/dist/plugin/utils/urls.d.ts +130 -0
- package/dist/plugin/utils/urls.d.ts.map +1 -0
- package/dist/plugin/utils/urls.js +87 -0
- package/dist/plugin/utils/urls.js.map +1 -0
- package/dist/plugin/utils.js +1 -1
- package/dist/plugin/vendor/index.d.ts +2 -0
- package/dist/plugin/vendor/index.d.ts.map +1 -0
- package/dist/plugin/vendor/index.js +1 -0
- package/dist/plugin/vendor/vendor.client.d.ts.map +1 -0
- package/dist/plugin/vendor/vendor.client.js.map +1 -0
- package/dist/plugin/vendor/vendor.d.ts +2 -0
- package/dist/plugin/vendor/vendor.d.ts.map +1 -0
- package/dist/plugin/vendor/vendor.js +15 -0
- package/dist/plugin/vendor/vendor.js.map +1 -0
- package/dist/plugin/vendor/vendor.server.d.ts.map +1 -0
- package/dist/plugin/vendor/vendor.server.js.map +1 -0
- package/dist/plugin/vendor.js +7 -0
- package/dist/plugin/vendor.js.map +1 -0
- package/dist/plugin/worker/createWorker.d.ts +3 -0
- package/dist/plugin/worker/createWorker.d.ts.map +1 -1
- package/dist/plugin/worker/createWorker.js +33 -20
- package/dist/plugin/worker/createWorker.js.map +1 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js +1 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js.map +1 -1
- package/dist/plugin/worker/html/html-worker.development.js.map +1 -1
- package/dist/plugin/worker/html/html-worker.production.js.map +1 -1
- package/dist/plugin/worker/rsc/handleRender.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handleRender.js +4 -4
- package/dist/plugin/worker/rsc/handleRender.js.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts +2 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.js +41 -15
- package/dist/plugin/worker/rsc/messageHandler.js.map +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.development.js +16 -5
- package/dist/plugin/worker/rsc/rsc-worker.development.js.map +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.production.js +16 -5
- package/dist/plugin/worker/rsc/rsc-worker.production.js.map +1 -1
- package/dist/plugin/worker/rsc/state.d.ts.map +1 -1
- package/dist/plugin/worker/sendMessage.js +45 -43
- package/dist/plugin/worker/sendMessage.js.map +1 -0
- package/dist/plugin/worker/types.d.ts +26 -4
- package/dist/plugin/worker/types.d.ts.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +34 -14
- package/plugin/{css-collector-elements.tsx → components/css-collector-elements.tsx} +1 -1
- package/plugin/{css-collector.tsx → components/css-collector.tsx} +1 -1
- package/plugin/{html.tsx → components/html.tsx} +1 -3
- package/{dist/plugin/components.d.ts → plugin/components/index.ts} +1 -1
- package/plugin/config/autoDiscover/index.ts +10 -0
- package/plugin/config/{resolveAutoDiscover.ts → autoDiscover/resolveAutoDiscover.ts} +16 -12
- package/plugin/config/autoDiscover/resolveBuildPages.ts +10 -11
- package/plugin/config/defaults.tsx +4 -3
- package/plugin/config/index.ts +1 -1
- package/plugin/config/resolveEnv.ts +156 -6
- package/plugin/config/resolveOptions.ts +13 -5
- package/plugin/config/resolveUrlOption.ts +2 -7
- package/plugin/config/resolveUserConfig.ts +87 -36
- package/plugin/env/index.ts +1 -0
- package/plugin/env/plugin.ts +78 -0
- package/plugin/error/toError.ts +19 -0
- package/plugin/file-preserver/plugin.ts +117 -0
- package/plugin/helpers/createRscStream.tsx +1 -1
- package/plugin/helpers/formatMetrics.ts +2 -2
- package/plugin/helpers/getRouteFiles.ts +3 -1
- package/plugin/helpers/index.ts +38 -0
- package/plugin/helpers/requestInfo.ts +10 -0
- package/plugin/{resolvePage.ts → helpers/resolvePage.ts} +19 -4
- package/plugin/helpers/resolvePageAndProps.ts +7 -4
- package/plugin/{resolveProps.ts → helpers/resolveProps.ts} +8 -6
- package/plugin/helpers/serializeUserOptions.ts +1 -1
- package/plugin/helpers/tryManifest.ts +0 -1
- package/plugin/loader/createBuildLoader.ts +1 -1
- package/plugin/loader/env-loader.development.ts +84 -0
- package/plugin/plugin.client.ts +2 -0
- package/plugin/plugin.server.ts +3 -0
- package/plugin/plugin.ts +1 -3
- package/plugin/process-env.ts +13 -0
- package/plugin/react-client/createMessageHandlers.ts +13 -1
- package/plugin/react-client/createWorkerStream.ts +69 -15
- package/plugin/react-client/handleWorkerRscStream.ts +57 -0
- package/plugin/react-client/plugin.ts +29 -13
- package/plugin/react-client/restartWorker.ts +15 -7
- package/plugin/react-client/server.ts +115 -124
- package/plugin/react-server/plugin.ts +26 -13
- package/plugin/react-server/server.ts +33 -15
- package/plugin/react-static/collectHtmlWorkerContent.ts +13 -1
- package/plugin/react-static/fileWriter.ts +1 -1
- package/plugin/react-static/plugin.ts +21 -34
- package/plugin/root.ts +7 -1
- package/plugin/transformer/upgradeCssModuleCode.ts +39 -39
- package/plugin/types/env.d.ts +7 -0
- package/plugin/types.ts +68 -20
- package/plugin/utils/callServer.ts +2 -24
- package/plugin/utils/createCallServer.ts +26 -0
- package/plugin/utils/createReactFetcher.ts +10 -6
- package/plugin/utils/envUrls.node.ts +19 -0
- package/plugin/utils/envUrls.ts +8 -0
- package/plugin/utils/index.ts +1 -1
- package/plugin/utils/moduleBaseURL.ts +7 -0
- package/plugin/utils/urls.ts +217 -0
- package/plugin/vendor/index.ts +1 -0
- package/plugin/vendor/vendor.ts +6 -0
- package/plugin/worker/createWorker.ts +38 -22
- package/plugin/worker/html/createHtmlWorkerRenderState.tsx +1 -1
- package/plugin/worker/html/html-worker.development.tsx +2 -1
- package/plugin/worker/html/html-worker.production.tsx +2 -1
- package/plugin/worker/rsc/handleRender.ts +4 -5
- package/plugin/worker/rsc/messageHandler.tsx +53 -17
- package/plugin/worker/rsc/rsc-worker.development.ts +22 -8
- package/plugin/worker/rsc/rsc-worker.production.ts +23 -7
- package/plugin/worker/types.ts +28 -4
- package/dist/plugin/components.d.ts.map +0 -1
- package/dist/plugin/config/resolveAutoDiscover.d.ts.map +0 -1
- package/dist/plugin/config/resolveAutoDiscover.js.map +0 -1
- package/dist/plugin/copy.d.ts +0 -7
- package/dist/plugin/copy.d.ts.map +0 -1
- package/dist/plugin/copy.js +0 -30
- package/dist/plugin/css-collector-elements.d.ts.map +0 -1
- package/dist/plugin/css-collector-elements.js.map +0 -1
- package/dist/plugin/css-collector.d.ts.map +0 -1
- package/dist/plugin/css-collector.js.map +0 -1
- package/dist/plugin/getCondition.d.ts +0 -2
- package/dist/plugin/getCondition.d.ts.map +0 -1
- package/dist/plugin/html.d.ts +0 -4
- package/dist/plugin/html.d.ts.map +0 -1
- package/dist/plugin/html.js +0 -18
- package/dist/plugin/html.js.map +0 -1
- package/dist/plugin/manifest.d.ts +0 -6
- package/dist/plugin/manifest.d.ts.map +0 -1
- package/dist/plugin/manifest.js +0 -13
- package/dist/plugin/moduleRefs.d.ts.map +0 -1
- package/dist/plugin/moduleRefs.js.map +0 -1
- package/dist/plugin/resolvePage.d.ts.map +0 -1
- package/dist/plugin/resolvePage.js.map +0 -1
- package/dist/plugin/resolveProps.d.ts.map +0 -1
- package/dist/plugin/resolveProps.js.map +0 -1
- package/dist/plugin/utils/pageURL.d.ts +0 -5
- package/dist/plugin/utils/pageURL.d.ts.map +0 -1
- package/dist/plugin/utils/pageURL.js +0 -33
- package/dist/plugin/utils/pageURL.js.map +0 -1
- package/dist/plugin/vendor.client.d.ts.map +0 -1
- package/dist/plugin/vendor.client.js.map +0 -1
- package/dist/plugin/vendor.server.d.ts.map +0 -1
- package/dist/plugin/vendor.server.js.map +0 -1
- package/plugin/copy.ts +0 -39
- package/plugin/getCondition.ts +0 -0
- package/plugin/manifest.ts +0 -24
- package/plugin/utils/pageURL.ts +0 -33
- /package/dist/plugin/{css-collector-elements.js → components/css-collector-elements.js} +0 -0
- /package/dist/plugin/{css-collector.js → components/css-collector.js} +0 -0
- /package/{plugin/components.ts → dist/plugin/components/index.js} +0 -0
- /package/dist/plugin/{moduleRefs.d.ts → helpers/moduleRefs.d.ts} +0 -0
- /package/dist/plugin/{moduleRefs.js → helpers/moduleRefs.js} +0 -0
- /package/dist/plugin/{resolvePage.d.ts → helpers/resolvePage.d.ts} +0 -0
- /package/dist/plugin/{resolveProps.d.ts → helpers/resolveProps.d.ts} +0 -0
- /package/dist/plugin/{getCondition.js → process-env.js} +0 -0
- /package/dist/plugin/{vendor.client.d.ts → vendor/vendor.client.d.ts} +0 -0
- /package/dist/plugin/{vendor.client.js → vendor/vendor.client.js} +0 -0
- /package/dist/plugin/{vendor.server.d.ts → vendor/vendor.server.d.ts} +0 -0
- /package/dist/plugin/{vendor.server.js → vendor/vendor.server.js} +0 -0
- /package/plugin/{moduleRefs.ts → helpers/moduleRefs.ts} +0 -0
- /package/plugin/{vendor.client.ts → vendor/vendor.client.ts} +0 -0
- /package/plugin/{vendor.server.ts → vendor/vendor.server.ts} +0 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
import { transformWithEsbuild } from 'vite';
|
|
7
|
+
import { writeFile } from 'node:fs/promises';
|
|
8
|
+
import { join, sep } from 'node:path';
|
|
9
|
+
|
|
10
|
+
function filePreserverPlugin(fileName) {
|
|
11
|
+
let sources = [];
|
|
12
|
+
let pluginName = typeof fileName === "string" ? fileName : fileName.slice(3).join("-");
|
|
13
|
+
let outDir = "dist";
|
|
14
|
+
let root = process.cwd();
|
|
15
|
+
let esbuildOptions = {
|
|
16
|
+
jsxDev: false,
|
|
17
|
+
supported: { "import-meta": true },
|
|
18
|
+
target: "esnext",
|
|
19
|
+
format: "esm"
|
|
20
|
+
};
|
|
21
|
+
let shouldPreserve = Array.isArray(fileName) ? (id) => fileName.some((f) => id.includes(f)) : (id) => id.includes(fileName);
|
|
22
|
+
return [
|
|
23
|
+
{
|
|
24
|
+
name: `vite:preserver-${pluginName}:post`,
|
|
25
|
+
enforce: "post",
|
|
26
|
+
apply: "build",
|
|
27
|
+
async transform(_code, id) {
|
|
28
|
+
if (!shouldPreserve(id)) return;
|
|
29
|
+
const normalId = id.replace(root + sep, "");
|
|
30
|
+
const found = sources.findIndex((s) => s.id === normalId);
|
|
31
|
+
if (found === -1) {
|
|
32
|
+
throw new Error(`Source not registered by pre hook for ${id}`);
|
|
33
|
+
}
|
|
34
|
+
return {
|
|
35
|
+
code: sources[found].transformedCode,
|
|
36
|
+
map: sources[found].map,
|
|
37
|
+
id: sources[found].id
|
|
38
|
+
};
|
|
39
|
+
},
|
|
40
|
+
async writeBundle(_options, bundle) {
|
|
41
|
+
if (sources.length === 0) return;
|
|
42
|
+
const entries = Object.entries(bundle);
|
|
43
|
+
const mapEntries = entries.filter(
|
|
44
|
+
(entry) => {
|
|
45
|
+
return entry[1].fileName.endsWith(".map") && shouldPreserve(entry[1].fileName);
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
if (mapEntries.length === 0) {
|
|
49
|
+
return;
|
|
50
|
+
}
|
|
51
|
+
for (const source of sources) {
|
|
52
|
+
for (const [fileName2, outputAsset] of mapEntries) {
|
|
53
|
+
const ourMap = source.map;
|
|
54
|
+
const path = join(root, outDir, fileName2);
|
|
55
|
+
if (outputAsset.source !== ourMap) {
|
|
56
|
+
await writeFile(path, ourMap);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
},
|
|
62
|
+
{
|
|
63
|
+
name: `vite:preserver-${pluginName}:pre`,
|
|
64
|
+
apply: "build",
|
|
65
|
+
enforce: "pre",
|
|
66
|
+
configResolved(config) {
|
|
67
|
+
outDir = config.build.outDir;
|
|
68
|
+
root = config.root;
|
|
69
|
+
esbuildOptions = config.esbuild || esbuildOptions;
|
|
70
|
+
},
|
|
71
|
+
async transform(code, id) {
|
|
72
|
+
if (!shouldPreserve(id)) return;
|
|
73
|
+
const found = sources.find((s) => s.id === id);
|
|
74
|
+
if (found) {
|
|
75
|
+
throw new Error(`Source already exists for ${id}`);
|
|
76
|
+
}
|
|
77
|
+
const result = await transformWithEsbuild(code, id, esbuildOptions);
|
|
78
|
+
const source = {
|
|
79
|
+
id: id.replace(root + sep, ""),
|
|
80
|
+
originalCode: code,
|
|
81
|
+
transformedCode: result.code,
|
|
82
|
+
map: JSON.stringify(result.map)
|
|
83
|
+
};
|
|
84
|
+
sources.push(source);
|
|
85
|
+
return {
|
|
86
|
+
id: source.id,
|
|
87
|
+
code: source.transformedCode,
|
|
88
|
+
map: source.map
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
];
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
export { filePreserverPlugin };
|
|
96
|
+
//# sourceMappingURL=file-preserver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"file-preserver.js","sources":["../../plugin/file-preserver/plugin.ts"],"sourcesContent":["import type { OutputAsset } from \"rollup\";\nimport type { ESBuildOptions, Plugin as VitePlugin } from \"vite\";\nimport { transformWithEsbuild } from \"vite\";\nimport { writeFile } from \"node:fs/promises\";\nimport { join, sep } from \"node:path\";\n/**\n * Bundling with vite may have some side effects, this plugin is a workaround to prevent\n * the side effects from happening to the files we want to preserve. It's used as a plugin\n * to build this plugin, but you can also use it as a standalone plugin for your projects to have\n * the same effect.\n * @example\n * ```tsx\n * import { filePreserverPlugin } from \"vite-plugin-react-server/file-preserver\";\n *\n * export default defineConfig({\n * plugins: [filePreserverPlugin(\"utils/env\")], // don't include the extension\n * });\n * ```\n * The typescript file will not be transformed by vite, only by esbuild, so you can preserve your import.meta.env\n * and use it in your client boundary files.\n */\nexport function filePreserverPlugin(fileName: string | string[]): VitePlugin[] {\n let sources: {\n id: string;\n originalCode: string;\n transformedCode: string;\n map: string;\n }[] = [];\n let pluginName =\n typeof fileName === \"string\" ? fileName : fileName.slice(3).join(\"-\");\n let outDir: string = \"dist\";\n let root: string = process.cwd();\n let esbuildOptions: ESBuildOptions = {\n jsxDev: false,\n supported: { \"import-meta\": true },\n target: \"esnext\",\n format: \"esm\",\n };\n let shouldPreserve = Array.isArray(fileName)\n ? (id: string) => fileName.some((f) => id.includes(f))\n : (id: string) => id.includes(fileName);\n return [\n {\n name: `vite:preserver-${pluginName}:post`,\n enforce: \"post\",\n apply: \"build\",\n async transform(_code: string, id: string) {\n if (!shouldPreserve(id)) return;\n const normalId = id.replace(root + sep, \"\");\n const found = sources.findIndex((s) => s.id === normalId);\n if (found === -1) {\n throw new Error(`Source not registered by pre hook for ${id}`);\n }\n return {\n code: sources[found].transformedCode,\n map: sources[found].map,\n id: sources[found].id,\n };\n },\n async writeBundle(_options, bundle) {\n if (sources.length === 0) return;\n const entries = Object.entries(bundle);\n const mapEntries = entries.filter(\n (entry): entry is [string, OutputAsset] => {\n return (\n entry[1].fileName.endsWith(\".map\") &&\n shouldPreserve(entry[1].fileName)\n );\n }\n );\n if (mapEntries.length === 0) {\n return;\n }\n // even though we're returning the new source map, it might just write ;;;; to the file\n for (const source of sources) {\n for (const [fileName, outputAsset] of mapEntries) {\n const ourMap = source.map;\n const path = join(root, outDir, fileName);\n if (outputAsset.source !== ourMap) {\n await writeFile(path, ourMap);\n }\n }\n }\n },\n },\n {\n name: `vite:preserver-${pluginName}:pre`,\n apply: \"build\",\n enforce: \"pre\",\n configResolved(config) {\n outDir = config.build.outDir;\n root = config.root;\n esbuildOptions = config.esbuild || esbuildOptions;\n },\n async transform(code: string, id: string) {\n if (!shouldPreserve(id)) return;\n const found = sources.find((s) => s.id === id);\n if (found) {\n throw new Error(`Source already exists for ${id}`);\n }\n const result = await transformWithEsbuild(code, id, esbuildOptions);\n const source = {\n id: id.replace(root + sep, \"\"),\n originalCode: code,\n transformedCode: result.code,\n map: JSON.stringify(result.map),\n };\n sources.push(source);\n return {\n id: source.id,\n code: source.transformedCode,\n map: source.map,\n };\n },\n },\n ];\n}\n"],"names":["fileName"],"mappings":";;;;;;;;;AAqBO,SAAS,oBAAoB,QAA2C,EAAA;AAC7E,EAAA,IAAI,UAKE,EAAC;AACP,EAAI,IAAA,UAAA,GACF,OAAO,QAAA,KAAa,QAAW,GAAA,QAAA,GAAW,SAAS,KAAM,CAAA,CAAC,CAAE,CAAA,IAAA,CAAK,GAAG,CAAA;AACtE,EAAA,IAAI,MAAiB,GAAA,MAAA;AACrB,EAAI,IAAA,IAAA,GAAe,QAAQ,GAAI,EAAA;AAC/B,EAAA,IAAI,cAAiC,GAAA;AAAA,IACnC,MAAQ,EAAA,KAAA;AAAA,IACR,SAAA,EAAW,EAAE,aAAA,EAAe,IAAK,EAAA;AAAA,IACjC,MAAQ,EAAA,QAAA;AAAA,IACR,MAAQ,EAAA;AAAA,GACV;AACA,EAAI,IAAA,cAAA,GAAiB,MAAM,OAAQ,CAAA,QAAQ,IACvC,CAAC,EAAA,KAAe,SA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QAAA,MAAM,MAAS,GAAA;AAAA,UACb,EAAI,EAAA,EAAA,CAAG,OAAQ,CAAA,IAAA,GAAO,KAAK,EAAE,CAAA;AAAA,UAC7B,YAAc,EAAA,IAAA;AAAA,UACd,iBAAiB,MAAO,CAAA,IAAA;AAAA,UACxB,GAAK,EAAA,IAAA,CAAK,SAAU,CAAA,MAAA,CAAO,GAAG;AAAA,SAChC;AACA,QAAA,OAAA,CAAQ,KAAK,MAAM,CAAA;AACnB,QAAO,OAAA;AAAA,UACL,IAAI,MAAO,CAAA,EAAA;AAAA,UACX,MAAM,MAAO,CAAA,eAAA;AAAA,UACb,KAAK,MAAO,CAAA;AAAA,SACd;AAAA;AACF;AACF,GACF;AACF;;;;"}
|
|
@@ -10,7 +10,7 @@ import type { PluginEvent } from "../types.js";
|
|
|
10
10
|
export interface EventHandlerOptions {
|
|
11
11
|
onEvent?: (event: PluginEvent) => void | Promise<void>;
|
|
12
12
|
}
|
|
13
|
-
export declare function createEventHandler(onEvent: EventHandlerOptions['onEvent']): (event: PluginEvent) => Promise<import("../types.js").FileWriteEvent | import("../types.js").FileWriteDoneEvent | import("../types.js").RouteProcessEvent | import("../types.js").RouteErrorEvent | import("../types.js").RoutePostponeEvent | import("../types.js").PropsLoadEvent | import("../types.js").CssProcessEvent | import("../types.js").BuildStartEvent | import("../types.js").
|
|
13
|
+
export declare function createEventHandler(onEvent: EventHandlerOptions['onEvent']): (event: PluginEvent) => Promise<import("../types.js").FileWriteEvent | import("../types.js").FileWriteDoneEvent | import("../types.js").RouteProcessEvent | import("../types.js").RouteErrorEvent | import("../types.js").RoutePostponeEvent | import("../types.js").PropsLoadEvent | import("../types.js").CssProcessEvent | import("../types.js").BuildStartEvent | import("../types.js").BuildWriteBundleEventServer | import("../types.js").BuildWriteBundleEventClient | import("../types.js").BuildWriteBundleEventStaticClient | import("../types.js").BuildWriteBundleEventStaticServer | {
|
|
14
14
|
type: string;
|
|
15
15
|
data: void;
|
|
16
16
|
error?: undefined;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) Nico Brinkkemper
|
|
4
4
|
* MIT License
|
|
5
5
|
*/
|
|
6
|
-
import { React, ReactDOMServer } from '../vendor.server.js';
|
|
6
|
+
import { React, ReactDOMServer } from '../vendor/vendor.server.js';
|
|
7
7
|
import { performance } from 'node:perf_hooks';
|
|
8
8
|
|
|
9
9
|
function createRscStream({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"createRscStream.js","sources":["../../../plugin/helpers/createRscStream.tsx"],"sourcesContent":["import { React, ReactDOMServer } from \"../vendor.server.js\";\nimport type { CreateHandlerOptions, StreamMetrics } from \"../types.js\";\nimport { performance } from \"node:perf_hooks\";\nexport function createRscStream<\n T,\n C extends React.ComponentType<T>,\n InlineCSS extends boolean = true\n>({\n Html = React.Fragment,\n PageComponent,\n pageProps,\n moduleBase,\n moduleRootPath,\n moduleBasePath,\n moduleBaseURL,\n cssFiles = new Map(),\n globalCss = new Map(),\n route,\n pipeableStreamOptions,\n CssCollector,\n manifest,\n onEvent,\n projectRoot,\n}: Pick<\n CreateHandlerOptions<T, C, InlineCSS>,\n | \"Html\"\n | \"PageComponent\"\n | \"pageProps\"\n | \"moduleBase\"\n | \"moduleRootPath\"\n | \"moduleBasePath\"\n | \"moduleBaseURL\"\n | \"cssFiles\"\n | \"route\"\n | \"pipeableStreamOptions\"\n | \"CssCollector\"\n | \"globalCss\"\n | \"manifest\"\n | \"projectRoot\"\n> & {\n onEvent?: (event: \"error\" | \"postpone\", data: any) => void;\n}):\n | { type: \"success\"; stream: any; metrics: StreamMetrics }\n | { type: \"error\"; error: Error; metrics: StreamMetrics } {\n let errorCount = 0;\n let streamError: Error | null = null;\n const startTime = performance.now();\n try {\n const htmlIsFragment = Html == React.Fragment;\n const url = route.startsWith(moduleBaseURL) ? route : moduleBaseURL + route;\n\n if (!PageComponent) {\n return {\n type: \"error\",\n error: new Error(\"PageComponent is required\"),\n metrics: {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount: 0,\n duration: 0,\n startTime: 0,\n },\n };\n }\n const elements = htmlIsFragment ? (\n <CssCollector cssFiles={cssFiles}>\n <PageComponent {...(pageProps as any)} />\n </CssCollector>\n ) : (\n <Html\n moduleBase={moduleBase}\n moduleBaseURL={moduleBaseURL}\n moduleBasePath={moduleBasePath}\n moduleRootPath={moduleRootPath}\n projectRoot={projectRoot}\n url={url}\n route={route}\n pageProps={pageProps}\n cssFiles={cssFiles}\n globalCss={globalCss}\n CssCollector={CssCollector}\n manifest={manifest}\n >\n <PageComponent {...(pageProps as any)} />\n </Html>\n );\n const stream = ReactDOMServer.renderToPipeableStream(\n elements,\n moduleBasePath,\n {\n ...pipeableStreamOptions,\n onError(error: Error, errorInfo: any) {\n const err = error instanceof Error ? error : new Error(String(error));\n streamError = err;\n onEvent?.(\"error\", { route, error: err, errorInfo });\n errorCount++;\n },\n onPostpone(reason: string) {\n onEvent?.(\"postpone\", { route, reason });\n },\n }\n );\n // If we have a stream error, return it immediately\n if (streamError) {\n return {\n type: \"error\",\n error: streamError,\n metrics: {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount,\n duration: Date.now() - startTime,\n startTime: startTime,\n },\n };\n }\n\n return {\n type: \"success\",\n stream,\n metrics: {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount,\n duration: Date.now() - startTime,\n startTime: startTime,\n },\n };\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n onEvent?.(\"error\", { route, error: err });\n return {\n type: \"error\",\n error: err,\n metrics: {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount: errorCount + 1,\n duration: Date.now() - startTime,\n startTime: startTime,\n },\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAGO,SAAS,eAId,CAAA;AAAA,EACA,OAAO,KAAM,CAAA,QAAA;AAAA,EACb,aAAA;AAAA,E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AAA;AAAA,QACR,KAAO,EAAA,CAAA;AAAA,QACP,iBAAmB,EAAA,CAAA;AAAA,QACnB,UAAY,EAAA,CAAA;AAAA,QACZ,UAAA;AAAA,QACA,QAAA,EAAU,IAAK,CAAA,GAAA,EAAQ,GAAA,SAAA;AAAA,QACvB;AAAA;AACF,KACF;AAAA,WACO,KAAO,EAAA;AACd,IAAM,MAAA,GAAA,GAAM,iBAAiB,KAAQ,GAAA,KAAA,GAAQ,IAAI,KAAM,CAAA,MAAA,CAAO,KAAK,CAAC,CAAA;AACpE,IAAA,OAAA,GAAU,OAAS,EAAA,EAAE,KAAO,EAAA,KAAA,EAAO,KAAK,CAAA;AACxC,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,OAAA;AAAA,MACN,KAAO,EAAA,GAAA;AAAA,MACP,OAAS,EAAA;AAAA,QACP,MAAQ,EAAA,CAAA;AAAA,QACR,KAAO,EAAA,CAAA;AAAA,QACP,iBAAmB,EAAA,CAAA;AAAA,QACnB,UAAY,EAAA,CAAA;AAAA,QACZ,YAAY,UAAa,GAAA,CAAA;AAAA,QACzB,QAAA,EAAU,IAAK,CAAA,GAAA,EAAQ,GAAA,SAAA;AAAA,QACvB;AAAA;AACF,KACF;AAAA;AAEJ;;;;"}
|
|
1
|
+
{"version":3,"file":"createRscStream.js","sources":["../../../plugin/helpers/createRscStream.tsx"],"sourcesContent":["import { React, ReactDOMServer } from \"../vendor/vendor.server.js\";\nimport type { CreateHandlerOptions, StreamMetrics } from \"../types.js\";\nimport { performance } from \"node:perf_hooks\";\nexport function createRscStream<\n T,\n C extends React.ComponentType<T>,\n InlineCSS extends boolean = true\n>({\n Html = React.Fragment,\n PageComponent,\n pageProps,\n moduleBase,\n moduleRootPath,\n moduleBasePath,\n moduleBaseURL,\n cssFiles = new Map(),\n globalCss = new Map(),\n route,\n pipeableStreamOptions,\n CssCollector,\n manifest,\n onEvent,\n projectRoot,\n}: Pick<\n CreateHandlerOptions<T, C, InlineCSS>,\n | \"Html\"\n | \"PageComponent\"\n | \"pageProps\"\n | \"moduleBase\"\n | \"moduleRootPath\"\n | \"moduleBasePath\"\n | \"moduleBaseURL\"\n | \"cssFiles\"\n | \"route\"\n | \"pipeableStreamOptions\"\n | \"CssCollector\"\n | \"globalCss\"\n | \"manifest\"\n | \"projectRoot\"\n> & {\n onEvent?: (event: \"error\" | \"postpone\", data: any) => void;\n}):\n | { type: \"success\"; stream: any; metrics: StreamMetrics }\n | { type: \"error\"; error: Error; metrics: StreamMetrics } {\n let errorCount = 0;\n let streamError: Error | null = null;\n const startTime = performance.now();\n try {\n const htmlIsFragment = Html == React.Fragment;\n const url = route.startsWith(moduleBaseURL) ? route : moduleBaseURL + route;\n\n if (!PageComponent) {\n return {\n type: \"error\",\n error: new Error(\"PageComponent is required\"),\n metrics: {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount: 0,\n duration: 0,\n startTime: 0,\n },\n };\n }\n const elements = htmlIsFragment ? (\n <CssCollector cssFiles={cssFiles}>\n <PageComponent {...(pageProps as any)} />\n </CssCollector>\n ) : (\n <Html\n moduleBase={moduleBase}\n moduleBaseURL={moduleBaseURL}\n moduleBasePath={moduleBasePath}\n moduleRootPath={moduleRootPath}\n projectRoot={projectRoot}\n url={url}\n route={route}\n pageProps={pageProps}\n cssFiles={cssFiles}\n globalCss={globalCss}\n CssCollector={CssCollector}\n manifest={manifest}\n >\n <PageComponent {...(pageProps as any)} />\n </Html>\n );\n const stream = ReactDOMServer.renderToPipeableStream(\n elements,\n moduleBasePath,\n {\n ...pipeableStreamOptions,\n onError(error: Error, errorInfo: any) {\n const err = error instanceof Error ? error : new Error(String(error));\n streamError = err;\n onEvent?.(\"error\", { route, error: err, errorInfo });\n errorCount++;\n },\n onPostpone(reason: string) {\n onEvent?.(\"postpone\", { route, reason });\n },\n }\n );\n // If we have a stream error, return it immediately\n if (streamError) {\n return {\n type: \"error\",\n error: streamError,\n metrics: {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount,\n duration: Date.now() - startTime,\n startTime: startTime,\n },\n };\n }\n\n return {\n type: \"success\",\n stream,\n metrics: {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount,\n duration: Date.now() - startTime,\n startTime: startTime,\n },\n };\n } catch (error) {\n const err = error instanceof Error ? error : new Error(String(error));\n onEvent?.(\"error\", { route, error: err });\n return {\n type: \"error\",\n error: err,\n metrics: {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount: errorCount + 1,\n duration: Date.now() - startTime,\n startTime: startTime,\n },\n };\n }\n}\n"],"names":[],"mappings":";;;;;;;;AAGO,SAAS,eAId,CAAA;AAAA,EACA,OAAO,KAAM,CAAA,QAAA;AAAA,EACb,aAAA;AAAA,EACA,SAAA;AAAA,EACA,UAAA;AAAA,EACA,cAAA;AAAA,EACA,cAAA;AAAA,EACA,aAAA;AAAA,EACA,QAAA,uBAAe,GAAI,EAAA;AAAA,EACnB,SAAA,uBAAgB,GAAI,EAAA;AAAA,EACpB,KAAA;AAAA,EACA,qBAAA;AAAA,EACA,YAAA;AAAA,EACA,QAAA;AAAA,EACA,OAAA;AAAA,EACA;AACF,CAoB4D,EAAA;AAC1D,EAAA,IAAI,UAAa,GAAA,CAAA;AACjB,EAAA,IAAI,WAA4B,GAAA,IAAA;AAChC,EAAM,MAAA,SAAA,GAAY,YAAY,GAAI,EAAA;AAClC,EAAI,IAAA;AACF,IAAM,MAAA,cAAA,GAAiB,QAAQ,KAAM,CAAA,QAAA;AACrC,IAAA,MAAM,MAAM,KAAM,CAAA,UAAA,CAAW,aAAa,CAAA,GAAI,QAAQ,aAAgB,GAAA,KAAA;AAEtE,IAAA,IAAI,CAAC,aAAe,EAAA;AAClB,MAAO,OAAA;AAAA,QACL,IAAM,EAAA,OAAA;AAAA,QACN,KAAA,EAAO,IAAI,KAAA,CAAM,2BAA2B,CAAA;AAAA,QAC5C,OAAS,EAAA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AA,SAAA;AAAA,QACvB;AAAA;AACF,KACF;AAAA;AAEJ;;;;"}
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import type { RenderMetrics } from "../types.js";
|
|
2
2
|
export declare function formatMetrics(metrics: RenderMetrics): string;
|
|
3
|
-
export declare function logMetrics(metrics: RenderMetrics
|
|
3
|
+
export declare function logMetrics(metrics: RenderMetrics, logger?: {
|
|
4
|
+
info: (message: string) => void;
|
|
5
|
+
}): void;
|
|
4
6
|
//# sourceMappingURL=formatMetrics.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"formatMetrics.d.ts","sourceRoot":"","sources":["../../../plugin/helpers/formatMetrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CA8B5D;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,aAAa,
|
|
1
|
+
{"version":3,"file":"formatMetrics.d.ts","sourceRoot":"","sources":["../../../plugin/helpers/formatMetrics.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAEjD,wBAAgB,aAAa,CAAC,OAAO,EAAE,aAAa,GAAG,MAAM,CA8B5D;AAED,wBAAgB,UAAU,CAAC,OAAO,EAAE,aAAa,EAAE,MAAM,GAAE;IAAC,IAAI,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAA;CAAW,QAErG"}
|
|
@@ -1,8 +1,20 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
function formatMetrics(metrics) {
|
|
7
|
+
const {
|
|
8
|
+
route,
|
|
9
|
+
rscSize,
|
|
10
|
+
chunks,
|
|
11
|
+
chunkRate,
|
|
12
|
+
processingTime,
|
|
13
|
+
memoryUsage,
|
|
14
|
+
streamMetrics
|
|
15
|
+
} = metrics;
|
|
16
|
+
const formatMemory = (bytes) => `${(bytes / 1024 / 1024).toFixed(2)}MB`;
|
|
17
|
+
return `
|
|
6
18
|
Route: ${route}
|
|
7
19
|
Size: ${(rscSize / 1024).toFixed(2)}KB
|
|
8
20
|
Chunks: ${chunks} (${chunkRate.toFixed(2)} chunks/s)
|
|
@@ -19,6 +31,9 @@ Stream:
|
|
|
19
31
|
Errors: ${streamMetrics.errorCount}
|
|
20
32
|
`.trim();
|
|
21
33
|
}
|
|
22
|
-
|
|
23
|
-
|
|
34
|
+
function logMetrics(metrics, logger = console) {
|
|
35
|
+
logger.info(formatMetrics(metrics));
|
|
24
36
|
}
|
|
37
|
+
|
|
38
|
+
export { formatMetrics, logMetrics };
|
|
39
|
+
//# sourceMappingURL=formatMetrics.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"formatMetrics.js","sources":["../../../plugin/helpers/formatMetrics.ts"],"sourcesContent":["import type { RenderMetrics } from \"../types.js\";\n\nexport function formatMetrics(metrics: RenderMetrics): string {\n const {\n route,\n rscSize,\n chunks,\n chunkRate,\n processingTime,\n memoryUsage,\n streamMetrics,\n } = metrics;\n\n // Format memory usage in MB\n const formatMemory = (bytes: number) => `${(bytes / 1024 / 1024).toFixed(2)}MB`;\n\n return `\nRoute: ${route}\nSize: ${(rscSize / 1024).toFixed(2)}KB\nChunks: ${chunks} (${chunkRate.toFixed(2)} chunks/s)\nProcessing Time: ${processingTime.toFixed(2)}ms\nMemory:\n RSS: ${formatMemory(memoryUsage.rss)}\n Heap Total: ${formatMemory(memoryUsage.heapTotal)}\n Heap Used: ${formatMemory(memoryUsage.heapUsed)}\n External: ${formatMemory(memoryUsage.external)}\nStream:\n Duration: ${streamMetrics.duration.toFixed(2)}ms\n Backpressure: ${streamMetrics.backpressureCount}\n Drain: ${streamMetrics.drainCount}\n Errors: ${streamMetrics.errorCount}\n`.trim();\n}\n\nexport function logMetrics(metrics: RenderMetrics, logger: {info: (message: string) => void} = console) {\n logger.info(formatMetrics(metrics));\n} "],"names":[],"mappings":";;;;;AAEO,SAAS,cAAc,OAAgC,EAAA;AAC5D,EAAM,MAAA;AAAA,IACJ,KAAA;AAAA,IACA,OAAA;AAAA,IACA,MAAA;AAAA,IACA,SAAA;AAAA,IACA,cAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACE,GAAA,OAAA;AAGJ,EAAM,MAAA,YAAA,GAAe,CAAC,KAAkB,KAAA,CAAA,EAAA,CAAI,QAAQ,IAAO,GAAA,IAAA,EAAM,OAAQ,CAAA,CAAC,CAAC,CAAA,EAAA,CAAA;AAE3E,EAAO,OAAA;AAAA,OAAA,EACA,KAAK;AAAA,MAAA,EAAA,CACL,OAAU,GAAA,IAAA,EAAM,OAAQ,CAAA,CAAC,CAAC,CAAA;AAAA,QAAA,EACzB,MAAM,CAAA,EAAA,EAAK,SAAU,CAAA,OAAA,CAAQ,CAAC,CAAC,CAAA;AAAA,iBACtB,EAAA,cAAA,CAAe,OAAQ,CAAA,CAAC,CAAC,CAAA;AAAA;AAAA,OAEnC,EAAA,YAAA,CAAa,WAAY,CAAA,GAAG,CAAC;AAAA,cACtB,EAAA,YAAA,CAAa,WAAY,CAAA,SAAS,CAAC;AAAA,aACpC,EAAA,YAAA,CAAa,WAAY,CAAA,QAAQ,CAAC;AAAA,YACnC,EAAA,YAAA,CAAa,WAAY,CAAA,QAAQ,CAAC;AAAA;AAAA,YAAA,EAElC,aAAc,CAAA,QAAA,CAAS,OAAQ,CAAA,CAAC,CAAC,CAAA;AAAA,gBAAA,EAC7B,cAAc,iBAAiB;AAAA,SAAA,EACtC,cAAc,UAAU;AAAA,UAAA,EACvB,cAAc,UAAU;AAAA,CAAA,CAClC,IAAK,EAAA;AACP;AAEO,SAAS,UAAA,CAAW,OAAwB,EAAA,MAAA,GAA4C,OAAS,EAAA;AACtG,EAAO,MAAA,CAAA,IAAA,CAAK,aAAc,CAAA,OAAO,CAAC,CAAA;AACpC;;;;"}
|
|
@@ -9,6 +9,6 @@ type GetRouteFilesError = {
|
|
|
9
9
|
type: "error";
|
|
10
10
|
error: Error;
|
|
11
11
|
};
|
|
12
|
-
export declare const getRouteFiles: (route: string, autoDiscoveredFiles: AutoDiscoveredFiles, userOptions: ResolvedUserOptions) => Promise<GetRouteFilesSuccess | GetRouteFilesError>;
|
|
12
|
+
export declare const getRouteFiles: (route: string, autoDiscoveredFiles: AutoDiscoveredFiles, userOptions: Pick<ResolvedUserOptions, "Page" | "props" | "moduleBasePath">) => Promise<GetRouteFilesSuccess | GetRouteFilesError>;
|
|
13
13
|
export {};
|
|
14
14
|
//# sourceMappingURL=getRouteFiles.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"getRouteFiles.d.ts","sourceRoot":"","sources":["../../../plugin/helpers/getRouteFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,aAAa,UACjB,MAAM,uBACQ,mBAAmB,eAC3B,mBAAmB,
|
|
1
|
+
{"version":3,"file":"getRouteFiles.d.ts","sourceRoot":"","sources":["../../../plugin/helpers/getRouteFiles.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAGvD,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AAEvD,KAAK,oBAAoB,GAAG;IAC1B,IAAI,EAAE,SAAS,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,GAAG,SAAS,CAAC;CAC5B,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;CACd,CAAC;AAEF,eAAO,MAAM,aAAa,UACjB,MAAM,uBACQ,mBAAmB,eAC3B,IAAI,CAAC,mBAAmB,EAAE,MAAM,GAAG,OAAO,GAAG,gBAAgB,CAAC,KAC1E,OAAO,CAAC,oBAAoB,GAAG,kBAAkB,CA4BnD,CAAC"}
|
|
@@ -1,19 +1,38 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
import { resolveUrlOption } from '../config/resolveUrlOption.js';
|
|
7
|
+
|
|
8
|
+
const getRouteFiles = async (route, autoDiscoveredFiles, userOptions) => {
|
|
9
|
+
if (autoDiscoveredFiles.urlMap.has(route)) {
|
|
10
|
+
const { page, props: props2 } = autoDiscoveredFiles.urlMap.get(route);
|
|
11
|
+
return { type: "success", page, props: props2 };
|
|
12
|
+
}
|
|
13
|
+
const { type, error, Page } = await resolveUrlOption(
|
|
14
|
+
userOptions,
|
|
15
|
+
"Page",
|
|
16
|
+
route
|
|
17
|
+
);
|
|
18
|
+
if (type === "error") {
|
|
19
|
+
return { type: "error", error };
|
|
20
|
+
}
|
|
21
|
+
if (!userOptions.props) {
|
|
22
|
+
autoDiscoveredFiles.urlMap.set(route, { page: Page, props: undefined });
|
|
23
|
+
return { type: "success", page: Page, props: undefined };
|
|
24
|
+
}
|
|
25
|
+
const {
|
|
26
|
+
type: propsType,
|
|
27
|
+
error: propsError,
|
|
28
|
+
props
|
|
29
|
+
} = await resolveUrlOption(userOptions, "props", route);
|
|
30
|
+
if (propsType === "error") {
|
|
31
|
+
return { type: "error", error: propsError };
|
|
32
|
+
}
|
|
33
|
+
autoDiscoveredFiles.urlMap.set(route, { page: Page, props });
|
|
34
|
+
return { type: "success", page: Page, props };
|
|
19
35
|
};
|
|
36
|
+
|
|
37
|
+
export { getRouteFiles };
|
|
38
|
+
//# sourceMappingURL=getRouteFiles.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"getRouteFiles.js","sources":["../../../plugin/helpers/getRouteFiles.ts"],"sourcesContent":["import type { ResolvedUserOptions } from \"../types.js\";\n\nimport { resolveUrlOption } from \"../config/resolveUrlOption.js\";\nimport type { AutoDiscoveredFiles } from \"../types.js\";\n\ntype GetRouteFilesSuccess = {\n type: \"success\";\n page: string;\n props?: string | undefined;\n};\n\ntype GetRouteFilesError = {\n type: \"error\";\n error: Error;\n};\n\nexport const getRouteFiles = async (\n route: string,\n autoDiscoveredFiles: AutoDiscoveredFiles,\n userOptions: Pick<ResolvedUserOptions, \"Page\" | \"props\" | \"moduleBasePath\">\n): Promise<GetRouteFilesSuccess | GetRouteFilesError> => {\n if (autoDiscoveredFiles.urlMap.has(route)) {\n const { page, props } = autoDiscoveredFiles.urlMap.get(route)!;\n return { type: \"success\", page, props };\n }\n const { type, error, Page } = await resolveUrlOption(\n userOptions,\n \"Page\",\n route\n );\n if(type === \"error\") {\n return { type: \"error\", error };\n }\n if (!userOptions.props) {\n autoDiscoveredFiles.urlMap.set(route, { page: Page, props: undefined });\n return { type: \"success\", page: Page, props: undefined };\n }\n const {\n type: propsType,\n error: propsError,\n props,\n } = await resolveUrlOption(userOptions, \"props\", route);\n\n if (propsType === \"error\") {\n return { type: \"error\", error: propsError };\n }\n autoDiscoveredFiles.urlMap.set(route, { page: Page, props });\n return { type: \"success\", page: Page, props };\n};\n"],"names":["props"],"mappings":";;;;;;;AAgBO,MAAM,aAAgB,GAAA,OAC3B,KACA,EAAA,mBAAA,EACA,WACuD,KAAA;AACvD,EAAA,IAAI,mBAAoB,CAAA,MAAA,CAAO,GAAI,CAAA,KAAK,CAAG,EAAA;AACzC,IAAM,MAAA,EAAE,MAAM,KAAAA,EAAAA,MAAAA,KAAU,mBAAoB,CAAA,MAAA,CAAO,IAAI,KAAK,CAAA;AAC5D,IAAA,OAAO,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,OAAAA,MAAM,EAAA;AAAA;AAExC,EAAA,MAAM,EAAE,IAAA,EAAM,KAAO,EAAA,IAAA,KAAS,MAAM,gBAAA;AAAA,IAClC,WAAA;AAAA,IACA,MAAA;AAAA,IACA;AAAA,GACF;AACA,EAAA,IAAG,SAAS,OAAS,EAAA;AACnB,IAAO,OAAA,EAAE,IAAM,EAAA,OAAA,EAAS,KAAM,EAAA;AAAA;AAEhC,EAAI,IAAA,CAAC,YAAY,KAAO,EAAA;AACtB,IAAoB,mBAAA,CAAA,MAAA,CAAO,IAAI,KAAO,EAAA,EAAE,MAAM,IAAM,EAAA,KAAA,EAAO,WAAW,CAAA;AACtE,IAAA,OAAO,EAAE,IAAM,EAAA,SAAA,EAAW,IAAM,EAAA,IAAA,EAAM,OAAO,SAAU,EAAA;AAAA;AAEzD,EAAM,MAAA;AAAA,IACJ,IAAM,EAAA,SAAA;AAAA,IACN,KAAO,EAAA,UAAA;AAAA,IACP;AAAA,GACE,GAAA,MAAM,gBAAiB,CAAA,WAAA,EAAa,SAAS,KAAK,CAAA;AAEtD,EAAA,IAAI,cAAc,OAAS,EAAA;AACzB,IAAA,OAAO,EAAE,IAAA,EAAM,OAAS,EAAA,KAAA,EAAO,UAAW,EAAA;AAAA;AAE5C,EAAA,mBAAA,CAAoB,OAAO,GAAI,CAAA,KAAA,EAAO,EAAE,IAAM,EAAA,IAAA,EAAM,OAAO,CAAA;AAC3D,EAAA,OAAO,EAAE,IAAA,EAAM,SAAW,EAAA,IAAA,EAAM,MAAM,KAAM,EAAA;AAC9C;;;;"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
export * from "./getRouteFiles.js";
|
|
2
|
+
export * from "./resolvePage.js";
|
|
3
|
+
export * from "./resolveProps.js";
|
|
4
|
+
export * from "./resolvePageAndProps.js";
|
|
5
|
+
export * from "./requestInfo.js";
|
|
6
|
+
export * from "./requestToRoute.js";
|
|
7
|
+
export * from "./serializeUserOptions.js";
|
|
8
|
+
export * from "./cleanObject.js";
|
|
9
|
+
export * from "./inputNormalizer.js";
|
|
10
|
+
export * from "./collectBundleManifestCss.js";
|
|
11
|
+
export * from "./collectManifestCss.js";
|
|
12
|
+
export * from "./collectViteModuleGraphCss.js";
|
|
13
|
+
export * from "./createCssProps.jsx";
|
|
14
|
+
export * from "./createRscStream.jsx";
|
|
15
|
+
export * from "./createHandler.js";
|
|
16
|
+
export * from "./createEventHandler.js";
|
|
17
|
+
export * from "./formatMetrics.js";
|
|
18
|
+
export * from "./metrics.js";
|
|
19
|
+
export * from "./tryManifest.js";
|
|
20
|
+
export * from "./getBundleManifest.js";
|
|
21
|
+
export * from "./moduleRefs.js";
|
|
22
|
+
export * from "./stashReturnValue.js";
|
|
23
|
+
export * from "./defaultFileWriter.js";
|
|
24
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../plugin/helpers/index.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC;AACnC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,0BAA0B,CAAC;AACzC,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AAGpC,cAAc,2BAA2B,CAAC;AAC1C,cAAc,kBAAkB,CAAC;AACjC,cAAc,sBAAsB,CAAC;AAGrC,cAAc,+BAA+B,CAAC;AAC9C,cAAc,yBAAyB,CAAC;AACxC,cAAc,gCAAgC,CAAC;AAC/C,cAAc,sBAAsB,CAAC;AAGrC,cAAc,uBAAuB,CAAC;AACtC,cAAc,oBAAoB,CAAC;AACnC,cAAc,yBAAyB,CAAC;AAGxC,cAAc,oBAAoB,CAAC;AACnC,cAAc,cAAc,CAAC;AAG7B,cAAc,kBAAkB,CAAC;AACjC,cAAc,wBAAwB,CAAC;AAGvC,cAAc,iBAAiB,CAAC;AAGhC,cAAc,uBAAuB,CAAC;AACtC,cAAc,wBAAwB,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// Route and file handling
|
|
2
|
+
export * from "./getRouteFiles.js";
|
|
3
|
+
export * from "./resolvePage.js";
|
|
4
|
+
export * from "./resolveProps.js";
|
|
5
|
+
export * from "./resolvePageAndProps.js";
|
|
6
|
+
export * from "./requestInfo.js";
|
|
7
|
+
export * from "./requestToRoute.js";
|
|
8
|
+
// Configuration and options
|
|
9
|
+
export * from "./serializeUserOptions.js";
|
|
10
|
+
export * from "./cleanObject.js";
|
|
11
|
+
export * from "./inputNormalizer.js";
|
|
12
|
+
// CSS handling
|
|
13
|
+
export * from "./collectBundleManifestCss.js";
|
|
14
|
+
export * from "./collectManifestCss.js";
|
|
15
|
+
export * from "./collectViteModuleGraphCss.js";
|
|
16
|
+
export * from "./createCssProps.jsx";
|
|
17
|
+
// Stream and handler creation
|
|
18
|
+
export * from "./createRscStream.jsx";
|
|
19
|
+
export * from "./createHandler.js";
|
|
20
|
+
export * from "./createEventHandler.js";
|
|
21
|
+
// Metrics and monitoring
|
|
22
|
+
export * from "./formatMetrics.js";
|
|
23
|
+
export * from "./metrics.js";
|
|
24
|
+
// Manifest handling
|
|
25
|
+
export * from "./tryManifest.js";
|
|
26
|
+
export * from "./getBundleManifest.js";
|
|
27
|
+
// Module handling
|
|
28
|
+
export * from "./moduleRefs.js";
|
|
29
|
+
// Utility functions
|
|
30
|
+
export * from "./stashReturnValue.js";
|
|
31
|
+
export * from "./defaultFileWriter.js";
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright (c) Nico Brinkkemper
|
|
4
4
|
* MIT License
|
|
5
5
|
*/
|
|
6
|
-
import 'node:stream';
|
|
6
|
+
import { Transform } from 'node:stream';
|
|
7
7
|
|
|
8
8
|
function createStreamMetrics() {
|
|
9
9
|
return {
|
|
@@ -30,6 +30,30 @@ function createRenderMetrics(route) {
|
|
|
30
30
|
rscSizes: /* @__PURE__ */ new Map()
|
|
31
31
|
};
|
|
32
32
|
}
|
|
33
|
+
function collectStreamMetrics(stream) {
|
|
34
|
+
const metrics = createStreamMetrics();
|
|
35
|
+
const startTime = performance.now();
|
|
36
|
+
return new Promise((resolve, reject) => {
|
|
37
|
+
const transform = new Transform({
|
|
38
|
+
transform(chunk, _encoding, callback) {
|
|
39
|
+
metrics.chunks++;
|
|
40
|
+
metrics.bytes += chunk.length;
|
|
41
|
+
callback(null, chunk);
|
|
42
|
+
},
|
|
43
|
+
flush(callback) {
|
|
44
|
+
metrics.duration = Date.now() - startTime;
|
|
45
|
+
callback();
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
stream.pipe(transform);
|
|
49
|
+
transform.on("error", (error) => {
|
|
50
|
+
reject(error);
|
|
51
|
+
});
|
|
52
|
+
transform.on("end", () => {
|
|
53
|
+
resolve(metrics);
|
|
54
|
+
});
|
|
55
|
+
});
|
|
56
|
+
}
|
|
33
57
|
|
|
34
|
-
export { createRenderMetrics, createStreamMetrics };
|
|
58
|
+
export { collectStreamMetrics, createRenderMetrics, createStreamMetrics };
|
|
35
59
|
//# sourceMappingURL=metrics.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"metrics.js","sources":["../../../plugin/helpers/metrics.ts"],"sourcesContent":["import { Transform } from \"node:stream\";\nimport type { StreamMetrics, RenderMetrics } from \"../types.js\";\nimport type { PipeableStream } from \"react-dom/server\";\n\nexport function createStreamMetrics(): StreamMetrics {\n return {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount: 0,\n duration: 0,\n startTime: performance.now()\n };\n}\n\nexport function createRenderMetrics(route: string): RenderMetrics {\n return {\n route,\n htmlSize: 0,\n rscSize: 0,\n processingTime: 0,\n chunks: 0,\n chunkRate: 0,\n memoryUsage: process.memoryUsage(),\n streamMetrics: createStreamMetrics(),\n htmlSizes: new Map(),\n rscSizes: new Map(),\n };\n}\n\n/**\n * Creates a transform stream that collects metrics from the input stream\n * @param stream The stream to collect metrics from\n * @returns A promise that resolves with the metrics when the stream ends\n */\nexport function collectStreamMetrics(stream: PipeableStream | NodeJS.ReadableStream): Promise<StreamMetrics> {\n const metrics = createStreamMetrics();\n const startTime = performance.now()\n\n return new Promise<StreamMetrics>((resolve, reject) => {\n const transform = new Transform({\n transform(chunk, _encoding, callback) {\n metrics.chunks++;\n metrics.bytes += chunk.length;\n callback(null, chunk);\n },\n flush(callback) {\n metrics.duration = Date.now() - startTime;\n callback();\n }\n });\n\n stream.pipe(transform);\n\n transform.on(\"error\", (error) => {\n reject(error);\n });\n\n transform.on(\"end\", () => {\n resolve(metrics);\n });\n });\n} "],"names":[],"mappings":";;;;;;;AAIO,SAAS,mBAAqC,GAAA;AACnD,EAAO,OAAA;AAAA,IACL,MAAQ,EAAA,CAAA;AAAA,IACR,KAAO,EAAA,CAAA;AAAA,IACP,iBAAmB,EAAA,CAAA;AAAA,IACnB,UAAY,EAAA,CAAA;AAAA,IACZ,UAAY,EAAA,CAAA;AAAA,IACZ,QAAU,EAAA,CAAA;AAAA,IACV,SAAA,EAAW,YAAY,GAAI;AAAA,GAC7B;AACF;AAEO,SAAS,oBAAoB,KAA8B,EAAA;AAChE,EAAO,OAAA;AAAA,IACL,KAAA;AAAA,IACA,QAAU,EAAA,CAAA;AAAA,IACV,OAAS,EAAA,CAAA;AAAA,IACT,cAAgB,EAAA,CAAA;AAAA,IAChB,MAAQ,EAAA,CAAA;AAAA,IACR,SAAW,EAAA,CAAA;AAAA,IACX,WAAA,EAAa,QAAQ,WAAY,EAAA;AAAA,IACjC,eAAe,mBAAoB,EAAA;AAAA,IACnC,SAAA,sBAAe,GAAI,EAAA;AAAA,IACnB,QAAA,sBAAc,GAAI;AAAA,GACpB;AACF;;;;"}
|
|
1
|
+
{"version":3,"file":"metrics.js","sources":["../../../plugin/helpers/metrics.ts"],"sourcesContent":["import { Transform } from \"node:stream\";\nimport type { StreamMetrics, RenderMetrics } from \"../types.js\";\nimport type { PipeableStream } from \"react-dom/server\";\n\nexport function createStreamMetrics(): StreamMetrics {\n return {\n chunks: 0,\n bytes: 0,\n backpressureCount: 0,\n drainCount: 0,\n errorCount: 0,\n duration: 0,\n startTime: performance.now()\n };\n}\n\nexport function createRenderMetrics(route: string): RenderMetrics {\n return {\n route,\n htmlSize: 0,\n rscSize: 0,\n processingTime: 0,\n chunks: 0,\n chunkRate: 0,\n memoryUsage: process.memoryUsage(),\n streamMetrics: createStreamMetrics(),\n htmlSizes: new Map(),\n rscSizes: new Map(),\n };\n}\n\n/**\n * Creates a transform stream that collects metrics from the input stream\n * @param stream The stream to collect metrics from\n * @returns A promise that resolves with the metrics when the stream ends\n */\nexport function collectStreamMetrics(stream: PipeableStream | NodeJS.ReadableStream): Promise<StreamMetrics> {\n const metrics = createStreamMetrics();\n const startTime = performance.now()\n\n return new Promise<StreamMetrics>((resolve, reject) => {\n const transform = new Transform({\n transform(chunk, _encoding, callback) {\n metrics.chunks++;\n metrics.bytes += chunk.length;\n callback(null, chunk);\n },\n flush(callback) {\n metrics.duration = Date.now() - startTime;\n callback();\n }\n });\n\n stream.pipe(transform);\n\n transform.on(\"error\", (error) => {\n reject(error);\n });\n\n transform.on(\"end\", () => {\n resolve(metrics);\n });\n });\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QAAA,EAAA;AAAA;AACX,KACD,CAAA;AAED,IAAA,MAAA,CAAO,KAAK,SAAS,CAAA;AAErB,IAAU,SAAA,CAAA,EAAA,CAAG,OAAS,EAAA,CAAC,KAAU,KAAA;AAC/B,MAAA,MAAA,CAAO,KAAK,CAAA;AAAA,KACb,CAAA;AAED,IAAU,SAAA,CAAA,EAAA,CAAG,OAAO,MAAM;AACxB,MAAA,OAAA,CAAQ,OAAO,CAAA;AAAA,KAChB,CAAA;AAAA,GACF,CAAA;AACH;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleRefs.d.ts","sourceRoot":"","sources":["../../../plugin/helpers/moduleRefs.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,UAAU;QAAyB,MAAM;EAAK,CAAC;AAE5D,wBAAgB,YAAY,CAAC,EAAE,EAAE,MAAM,GAAG;IAAE,EAAE,EAAE,MAAM,CAAA;CAAE,CAOvD"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"moduleRefs.js","sources":["../../../plugin/helpers/moduleRefs.ts"],"sourcesContent":["// Create a shared map to store module references\nexport const moduleRefs = new Map<string, { id: string }>();\n\nexport function getModuleRef(id: string): { id: string } {\n let moduleRef = moduleRefs.get(id);\n if (!moduleRef) {\n moduleRef = { id };\n moduleRefs.set(id, moduleRef);\n }\n return moduleRef;\n} "],"names":[],"mappings":";;;;;AACa,MAAA,UAAA,uBAAiB,GAA4B;AAEnD,SAAS,aAAa,EAA4B,EAAA;AACvD,EAAI,IAAA,SAAA,GAAY,UAAW,CAAA,GAAA,CAAI,EAAE,CAAA;AACjC,EAAA,IAAI,CAAC,SAAW,EAAA;AACd,IAAA,SAAA,GAAY,EAAE,EAAG,EAAA;AACjB,IAAW,UAAA,CAAA,GAAA,CAAI,IAAI,SAAS,CAAA;AAAA;AAE9B,EAAO,OAAA,SAAA;AACT;;;;"}
|
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
import type { ResolvedUserOptions } from "../types.js";
|
|
2
2
|
import type { Connect } from "vite";
|
|
3
|
+
/**
|
|
4
|
+
* # Request info
|
|
5
|
+
*
|
|
6
|
+
* Does the initial work to check if the request is for html, rsc, css, or something else not handled by this plugin.
|
|
7
|
+
*
|
|
8
|
+
* @param req
|
|
9
|
+
* @param userOptions
|
|
10
|
+
* @param hostDir
|
|
11
|
+
* @returns
|
|
12
|
+
*/
|
|
3
13
|
export declare function requestInfo(req: Connect.IncomingMessage, userOptions: Pick<ResolvedUserOptions, "normalizer" | "build" | "autoDiscover">, hostDir: string): {
|
|
4
14
|
route: string;
|
|
5
15
|
ext: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestInfo.d.ts","sourceRoot":"","sources":["../../../plugin/helpers/requestInfo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC,wBAAgB,WAAW,CACzB,GAAG,EAAE,OAAO,CAAC,eAAe,EAC5B,WAAW,EAAE,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,OAAO,GAAG,cAAc,CAAC,EAC/E,OAAO,EAAE,MAAM;;;;;;;;;;;;EAwEhB"}
|
|
1
|
+
{"version":3,"file":"requestInfo.d.ts","sourceRoot":"","sources":["../../../plugin/helpers/requestInfo.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAGpC;;;;;;;;;GASG;AACH,wBAAgB,WAAW,CACzB,GAAG,EAAE,OAAO,CAAC,eAAe,EAC5B,WAAW,EAAE,IAAI,CAAC,mBAAmB,EAAE,YAAY,GAAG,OAAO,GAAG,cAAc,CAAC,EAC/E,OAAO,EAAE,MAAM;;;;;;;;;;;;EAwEhB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"requestInfo.js","sources":["../../../plugin/helpers/requestInfo.ts"],"sourcesContent":["import { join } from \"node:path\";\nimport type { ResolvedUserOptions } from \"../types.js\";\nimport type { Connect } from \"vite\";\nimport { MIME_TYPES } from \"../config/mimeTypes.js\";\n\nexport function requestInfo(\n req: Connect.IncomingMessage,\n userOptions: Pick<ResolvedUserOptions, \"normalizer\" | \"build\" | \"autoDiscover\">,\n hostDir: string\n) {\n const [, value] = userOptions.normalizer(req.url);\n const dotIndex = value.lastIndexOf(\".\");\n const ext = dotIndex === -1 ? \"\" : value.slice(dotIndex);\n // handle index.html\n const isHtml = userOptions.autoDiscover.htmlPattern(value);\n const hasHtmlHeader = req.headers.accept?.includes(\"text/html\");\n const isRsc = userOptions.autoDiscover.rscPattern(value);\n const hasRscHeader = req.headers.accept?.includes(\"text/x-component\");\n const isFolder = !ext;\n const isHtmlRequest =\n isHtml || hasHtmlHeader || (isFolder && !hasRscHeader && !isRsc);\n const isRscRequest = !isHtmlRequest && (isRsc || hasRscHeader);\n const isCss = userOptions.autoDiscover.cssPattern(value);\n const isCssRequest =\n !isHtmlRequest &&\n !isRscRequest &&\n (isCss || req.headers.accept?.includes(\"text/css\"));\n let filePath = join(hostDir, value);\n let contentType;\n if (isHtmlRequest) {\n if (!isHtml) {\n filePath = join(hostDir, value, userOptions.build.htmlOutputPath);\n }\n contentType = \"text/html; charset=utf-8\";\n } else if (isRscRequest) {\n if (!isRsc) {\n filePath = join(hostDir, value, userOptions.build.rscOutputPath);\n }\n contentType = \"text/x-component; charset=utf-8\";\n } else if (isCssRequest) {\n if (!isCss) {\n filePath = join(hostDir, value);\n }\n contentType = \"text/css; charset=utf-8\";\n } else {\n const mimeType = MIME_TYPES[ext];\n if (mimeType) {\n contentType = mimeType;\n } else {\n contentType = \"application/octet-stream\";\n }\n }\n const route = value\n .replace(userOptions.build.rscOutputPath, \"\")\n .replace(userOptions.build.htmlOutputPath, \"\");\n \n const routeWithoutTrailingSlash =\n route === \"\" || route === \"/\"\n ? \"/\"\n : route.endsWith(\"/\")\n ? route.slice(0, -1)\n : route;\n const routeWithLeadingSlash =\n routeWithoutTrailingSlash.startsWith(\"/\")\n ? routeWithoutTrailingSlash\n : `/${routeWithoutTrailingSlash}`;\n\n return {\n route: routeWithLeadingSlash,\n ext,\n isHtmlRequest,\n isRscRequest,\n isCssRequest,\n isCss,\n isHtml,\n isRsc,\n isFolder,\n contentType,\n filePath,\n };\n}\n"],"names":[],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"requestInfo.js","sources":["../../../plugin/helpers/requestInfo.ts"],"sourcesContent":["import { join } from \"node:path\";\nimport type { ResolvedUserOptions } from \"../types.js\";\nimport type { Connect } from \"vite\";\nimport { MIME_TYPES } from \"../config/mimeTypes.js\";\n\n/**\n * # Request info\n * \n * Does the initial work to check if the request is for html, rsc, css, or something else not handled by this plugin.\n * \n * @param req \n * @param userOptions \n * @param hostDir \n * @returns \n */\nexport function requestInfo(\n req: Connect.IncomingMessage,\n userOptions: Pick<ResolvedUserOptions, \"normalizer\" | \"build\" | \"autoDiscover\">,\n hostDir: string\n) {\n const [, value] = userOptions.normalizer(req.url);\n const dotIndex = value.lastIndexOf(\".\");\n const ext = dotIndex === -1 ? \"\" : value.slice(dotIndex);\n // handle index.html\n const isHtml = userOptions.autoDiscover.htmlPattern(value);\n const hasHtmlHeader = req.headers.accept?.includes(\"text/html\");\n const isRsc = userOptions.autoDiscover.rscPattern(value);\n const hasRscHeader = req.headers.accept?.includes(\"text/x-component\");\n const isFolder = !ext;\n const isHtmlRequest =\n isHtml || hasHtmlHeader || (isFolder && !hasRscHeader && !isRsc);\n const isRscRequest = !isHtmlRequest && (isRsc || hasRscHeader);\n const isCss = userOptions.autoDiscover.cssPattern(value);\n const isCssRequest =\n !isHtmlRequest &&\n !isRscRequest &&\n (isCss || req.headers.accept?.includes(\"text/css\"));\n let filePath = join(hostDir, value);\n let contentType;\n if (isHtmlRequest) {\n if (!isHtml) {\n filePath = join(hostDir, value, userOptions.build.htmlOutputPath);\n }\n contentType = \"text/html; charset=utf-8\";\n } else if (isRscRequest) {\n if (!isRsc) {\n filePath = join(hostDir, value, userOptions.build.rscOutputPath);\n }\n contentType = \"text/x-component; charset=utf-8\";\n } else if (isCssRequest) {\n if (!isCss) {\n filePath = join(hostDir, value);\n }\n contentType = \"text/css; charset=utf-8\";\n } else {\n const mimeType = MIME_TYPES[ext];\n if (mimeType) {\n contentType = mimeType;\n } else {\n contentType = \"application/octet-stream\";\n }\n }\n const route = value\n .replace(userOptions.build.rscOutputPath, \"\")\n .replace(userOptions.build.htmlOutputPath, \"\");\n \n const routeWithoutTrailingSlash =\n route === \"\" || route === \"/\"\n ? \"/\"\n : route.endsWith(\"/\")\n ? route.slice(0, -1)\n : route;\n const routeWithLeadingSlash =\n routeWithoutTrailingSlash.startsWith(\"/\")\n ? routeWithoutTrailingSlash\n : `/${routeWithoutTrailingSlash}`;\n\n return {\n route: routeWithLeadingSlash,\n ext,\n isHtmlRequest,\n isRscRequest,\n isCssRequest,\n isCss,\n isHtml,\n isRsc,\n isFolder,\n contentType,\n filePath,\n };\n}\n"],"names":[],"mappings":";;;;;;;;AAeO,SAAS,WAAA,CACd,GACA,EAAA,WAAA,EACA,OACA,EAAA;AACA,EAAA,MAAM,GAAG,KAAK,IAAI,WAAY,CAAA,UAAA,CAAW,IAAI,GAAG,CAAA;AAChD,EAAM,MAAA,QAAA,GAAW,KAAM,CAAA,WAAA,CAAY,GAAG,CAAA;AACtC,EAAA,MAAM,MAAM,QAAa,KAAA,EAAA,GAAK,EAAK,GAAA,KAAA,CAAM,MAAM,QAAQ,CAAA;AAEvD,EAAA,MAAM,MAAS,GAAA,WAAA,CAAY,YAAa,CAAA,WAAA,CAAY,KAAK,CAAA;AACzD,EAAA,MAAM,aAAgB,GAAA,GAAA,CAAI,OAAQ,CAAA,MAAA,EAAQ,SAAS,WAAW,CAAA;AAC9D,EAAA,MAAM,KAAQ,GAAA,WAAA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A;AAC/B,IAAA,IAAI,QAAU,EAAA;AACZ,MAAc,WAAA,GAAA,QAAA;AAAA,KACT,MAAA;AACL,MAAc,WAAA,GAAA,0BAAA;AAAA;AAChB;AAEF,EAAA,MAAM,KAAQ,GAAA,KAAA,CACX,OAAQ,CAAA,WAAA,CAAY,KAAM,CAAA,aAAA,EAAe,EAAE,CAAA,CAC3C,OAAQ,CAAA,WAAA,CAAY,KAAM,CAAA,cAAA,EAAgB,EAAE,CAAA;AAE/C,EAAA,MAAM,yBACJ,GAAA,KAAA,KAAU,EAAM,IAAA,KAAA,KAAU,MACtB,GACA,GAAA,KAAA,CAAM,QAAS,CAAA,GAAG,CAClB,GAAA,KAAA,CAAM,KAAM,CAAA,CAAA,EAAG,EAAE,CACjB,GAAA,KAAA;AACN,EAAA,MAAM,wBACJ,yBAA0B,CAAA,UAAA,CAAW,GAAG,CACpC,GAAA,yBAAA,GACA,IAAI,yBAAyB,CAAA,CAAA;AAEnC,EAAO,OAAA;AAAA,IACL,KAAO,EAAA,qBAAA;AAAA,IACP,GAAA;AAAA,IACA,aAAA;AAAA,IACA,YAAA;AAAA,IACA,YAAA;AAAA,IACA,KAAA;AAAA,IACA,MAAA;AAAA,IACA,KAAA;AAAA,IACA,QAAA;AAAA,IACA,WAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1,16 +1,24 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
if (!route || route === "") {
|
|
10
|
-
route = "/";
|
|
11
|
-
}
|
|
12
|
-
if (!route.startsWith("/")) {
|
|
13
|
-
route = "/" + route;
|
|
14
|
-
}
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
function requestToRoute(req, handlerOptions) {
|
|
7
|
+
let route = req.url?.replace("/" + handlerOptions.build.rscOutputPath, "");
|
|
8
|
+
if (typeof route !== "string") {
|
|
15
9
|
return route;
|
|
10
|
+
}
|
|
11
|
+
if (route.startsWith(handlerOptions.moduleBasePath)) {
|
|
12
|
+
route = route.slice(handlerOptions.moduleBasePath.length);
|
|
13
|
+
}
|
|
14
|
+
if (!route || route === "") {
|
|
15
|
+
route = "/";
|
|
16
|
+
}
|
|
17
|
+
if (!route.startsWith("/")) {
|
|
18
|
+
route = "/" + route;
|
|
19
|
+
}
|
|
20
|
+
return route;
|
|
16
21
|
}
|
|
22
|
+
|
|
23
|
+
export { requestToRoute };
|
|
24
|
+
//# sourceMappingURL=requestToRoute.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"requestToRoute.js","sources":["../../../plugin/helpers/requestToRoute.ts"],"sourcesContent":["import type { CreateHandlerOptions } from \"../types.js\";\n\nexport function requestToRoute(\n req: {url?: string},\n handlerOptions: Pick<CreateHandlerOptions, \"moduleBasePath\" | \"build\">\n) {\n let route = req.url?.replace(\"/\" + handlerOptions.build.rscOutputPath, \"\");\n if (typeof route !== \"string\") {\n return route;\n }\n if (\n route.startsWith(handlerOptions.moduleBasePath)\n ) {\n route = route.slice(handlerOptions.moduleBasePath.length);\n }\n if (!route || route === \"\") {\n route = \"/\";\n }\n if (!route.startsWith(\"/\")) {\n route = \"/\" + route;\n }\n return route;\n}\n"],"names":[],"mappings":";;;;;AAEO,SAAS,cAAA,CACd,KACA,cACA,EAAA;AACA,EAAI,IAAA,KAAA,GAAQ,IAAI,GAAK,EAAA,OAAA,CAAQ,MAAM,cAAe,CAAA,KAAA,CAAM,eAAe,EAAE,CAAA;AACzE,EAAI,IAAA,OAAO,UAAU,QAAU,EAAA;AAC7B,IAAO,OAAA,KAAA;AAAA;AAET,EAAA,IACE,KAAM,CAAA,UAAA,CAAW,cAAe,CAAA,cAAc,CAC9C,EAAA;AACA,IAAA,KAAA,GAAQ,KAAM,CAAA,K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
|
6
|
+
import { toError } from '../error/toError.js';
|
|
7
|
+
|
|
6
8
|
const resolvePage = async ({
|
|
7
9
|
id,
|
|
8
10
|
exportName,
|
|
@@ -30,17 +32,31 @@ const resolvePage = async ({
|
|
|
30
32
|
if (module instanceof Error) {
|
|
31
33
|
return {
|
|
32
34
|
type: "error",
|
|
33
|
-
error:
|
|
35
|
+
error: {
|
|
36
|
+
name: module.name,
|
|
37
|
+
message: module.message,
|
|
38
|
+
stack: module.stack
|
|
39
|
+
}
|
|
34
40
|
};
|
|
35
41
|
} else if (!(exportName in module)) {
|
|
42
|
+
if ("error" in module) {
|
|
43
|
+
return {
|
|
44
|
+
type: "error",
|
|
45
|
+
error: toError(module.error)
|
|
46
|
+
};
|
|
47
|
+
}
|
|
36
48
|
return {
|
|
37
49
|
type: "error",
|
|
38
|
-
error: new Error(
|
|
50
|
+
error: new Error(
|
|
51
|
+
`Export "${exportName}" not found in module ${id}.`
|
|
52
|
+
)
|
|
39
53
|
};
|
|
40
54
|
} else if (!Page) {
|
|
41
55
|
return {
|
|
42
56
|
type: "error",
|
|
43
|
-
error: new Error(
|
|
57
|
+
error: new Error(
|
|
58
|
+
`Export "${exportName}" is null or undefined in module ${id}.`
|
|
59
|
+
)
|
|
44
60
|
};
|
|
45
61
|
} else if (Page instanceof Error) {
|
|
46
62
|
return {
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolvePage.js","sources":["../../../plugin/helpers/resolvePage.ts"],"sourcesContent":["import { toError } from \"../error/toError.js\";\n\ntype ResolvePageOptions<N extends string> = {\n id: string;\n exportName: N;\n loader: (id: string) => Promise<any>;\n};\n\ntype ResolvePageResult<T, N extends string> =\n | { type: \"success\"; Page: T; module: { [key in N]: T } }\n | { type: \"error\"; error: Error }\n | { type: \"skip\" };\n\n/**\n * Resolves a page component from a module.\n *\n * During development (ssrLoadModule):\n * - Real modules have exports available directly on the module object\n * - Virtual modules have exports stored in temporaryReferences\n *\n * @param options.id - The module ID to resolve\n * @param options.exportName - The name of the export to resolve (e.g. 'Page')\n * @param options.loader - The loader function to use for loading the module\n *\n * @returns A result object containing:\n * - type: \"success\" | \"error\" | \"skip\"\n * - Page: The resolved page component if successful\n * - error: Error message if failed\n */\nexport const resolvePage = async <T, N extends string>({\n id,\n exportName,\n loader,\n}: ResolvePageOptions<N>): Promise<ResolvePageResult<T, N>> => {\n // Check if this is a stashed page that needs special handling\n const pageLoadResult = await (async (): Promise<\n | { type: \"success\"; key: string; module: { [key in N]: T } }\n | { type: \"error\"; error: Error; module?: never }\n > => {\n try {\n return {\n type: \"success\",\n key: id,\n module: await loader(id),\n };\n } catch (error) {\n return {\n type: \"error\",\n error: error instanceof Error ? error : new Error(String(error)),\n };\n }\n })();\n\n if (pageLoadResult.type !== \"success\") {\n return pageLoadResult;\n }\n const { module } = pageLoadResult;\n const Page = module[exportName as N];\n if (module instanceof Error) {\n return {\n type: \"error\",\n error: {\n name: module.name,\n message: module.message,\n stack: module.stack,\n },\n };\n } else if (!(exportName in module)) {\n if (\"error\" in module) {\n return {\n type: \"error\",\n error: toError(module.error),\n };\n }\n return {\n type: \"error\",\n error: new Error(\n `Export \"${exportName}\" not found in module ${id}.`\n ),\n };\n } else if (!Page) {\n return {\n type: \"error\",\n error: new Error(\n `Export \"${exportName}\" is null or undefined in module ${id}.`\n ),\n };\n } else if (Page instanceof Error) {\n return {\n type: \"error\",\n error: Page,\n };\n }\n return {\n type: \"success\",\n Page,\n module: module as { [key in N]: T },\n };\n};\n"],"names":[],"mappings":";;;;;;;AA6BO,MAAM,cAAc,OAA4B;AAAA,EACrD,EAAA;AAAA,EACA,UAAA;AAAA,EACA;AACF,CAA+D,KAAA;AAE7D,EAAM,MAAA,cAAA,GAAiB,OAAO,YAGzB;AACH,IAAI,IAAA;AACF,MAAO,OAAA;AAAA,QACL,IAAM,EAAA,SAAA;AAAA,QACN,GAAK,EAAA,EAAA;AAAA,QACL,MAAA,EAAQ,MAAM,MAAA,CAAO,EAAE;AAAA,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AA;AAChC,IAAO,OAAA;AAAA,MACL,IAAM,EAAA,OAAA;AAAA,MACN,KAAO,EAAA;AAAA,KACT;AAAA;AAEF,EAAO,OAAA;AAAA,IACL,IAAM,EAAA,SAAA;AAAA,IACN,IAAA;AAAA,IACA;AAAA,GACF;AACF;;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resolvePageAndProps.d.ts","sourceRoot":"","sources":["../../../plugin/helpers/resolvePageAndProps.ts"],"names":[],"mappings":"AAGA,KAAK,0BAA0B,CAAC,EAAE,SAAS,MAAM,EAAE,EAAE,SAAS,MAAM,IAAI;IACtE,QAAQ,EAAE,MAAM,CAAC;IACjB,cAAc,EAAE,EAAE,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,eAAe,CAAC,EAAE,EAAE,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;CACtC,CAAC;AAEF,KAAK,yBAAyB,CAAC,CAAC,IAC5B;IACE,IAAI,EAAE,SAAS,CAAC;IAChB,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,aAAa,EAAE,KAAK,CAAC,aAAa,CAAC,CAAC,CAAC,CAAC;IACtC,SAAS,EAAE,CAAC,CAAC;CACd,GACD;IACE,IAAI,EAAE,OAAO,CAAC;IACd,KAAK,EAAE,KAAK,CAAC;IACb,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,GACD;IACE,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,KAAK,CAAC;IACd,aAAa,CAAC,EAAE,KAAK,CAAC;IACtB,SAAS,CAAC,EAAE,KAAK,CAAC;CACnB,CAAC;AAEN,wBAAsB,mBAAmB,CACvC,CAAC,EACD,EAAE,SAAS,MAAM,EACjB,EAAE,SAAS,MAAM,EAEjB,cAAc,EAAE,0BA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