vite-plugin-react-server 1.0.2 → 1.1.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 +49 -76
- package/bin/patch.mjs +27 -20
- package/dist/_virtual/dynamic-import-helper.js +24 -0
- package/dist/_virtual/dynamic-import-helper.js.map +1 -0
- package/dist/client.d.ts +1 -1
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +1 -1
- package/dist/index.d.ts +2 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +9 -26
- package/dist/index.js.map +1 -1
- package/dist/package.json +24 -14
- package/dist/plugin/components.d.ts +1 -1
- package/dist/plugin/components.d.ts.map +1 -1
- package/dist/plugin/components.js +1 -1
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.d.ts +6 -0
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.d.ts.map +1 -0
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js +30 -0
- package/dist/plugin/config/autoDiscover/createGlobAutoDiscover.js.map +1 -0
- package/dist/plugin/config/autoDiscover/customWorkerFiles.d.ts +13 -0
- package/dist/plugin/config/autoDiscover/customWorkerFiles.d.ts.map +1 -0
- package/dist/plugin/config/autoDiscover/customWorkerFiles.js +24 -0
- package/dist/plugin/config/autoDiscover/customWorkerFiles.js.map +1 -0
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.d.ts +11 -0
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.d.ts.map +1 -0
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js +29 -0
- package/dist/plugin/config/autoDiscover/pageAndPropFiles.js.map +1 -0
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts +6 -0
- package/dist/plugin/config/autoDiscover/resolveBuildPages.d.ts.map +1 -0
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js +83 -0
- package/dist/plugin/config/autoDiscover/resolveBuildPages.js.map +1 -0
- package/dist/plugin/config/defaults.d.ts +18 -14
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +42 -21
- package/dist/plugin/config/defaults.js.map +1 -1
- package/dist/plugin/config/getCondition.d.ts +1 -1
- package/dist/plugin/config/getCondition.d.ts.map +1 -1
- package/dist/plugin/config/getCondition.js +2 -2
- package/dist/plugin/config/getCondition.js.map +1 -1
- package/dist/plugin/config/getPaths.d.ts +0 -1
- package/dist/plugin/config/getPaths.d.ts.map +1 -1
- package/dist/plugin/config/getPaths.js.map +1 -1
- package/dist/plugin/config/index.d.ts +0 -1
- package/dist/plugin/config/index.d.ts.map +1 -1
- package/dist/plugin/config/index.js +0 -1
- package/dist/plugin/config/resolveAutoDiscover.d.ts +20 -0
- package/dist/plugin/config/resolveAutoDiscover.d.ts.map +1 -0
- package/dist/plugin/config/resolveAutoDiscover.js +128 -0
- package/dist/plugin/config/resolveAutoDiscover.js.map +1 -0
- package/dist/plugin/config/resolveOptions.d.ts +1 -1
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +109 -77
- package/dist/plugin/config/resolveOptions.js.map +1 -1
- package/dist/plugin/config/resolvePages.d.ts +0 -1
- package/dist/plugin/config/resolvePages.d.ts.map +1 -1
- package/dist/plugin/config/resolvePages.js +6 -8
- package/dist/plugin/config/resolvePages.js.map +1 -1
- package/dist/plugin/config/resolveUrlOption.d.ts +16 -0
- package/dist/plugin/config/resolveUrlOption.d.ts.map +1 -0
- package/dist/plugin/config/resolveUrlOption.js +37 -0
- package/dist/plugin/config/resolveUrlOption.js.map +1 -0
- package/dist/plugin/config/resolveUserConfig.d.ts +4 -5
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +80 -132
- package/dist/plugin/config/resolveUserConfig.js.map +1 -1
- package/dist/plugin/copy.d.ts +7 -0
- package/dist/plugin/copy.d.ts.map +1 -0
- package/dist/plugin/copy.js +30 -0
- package/dist/plugin/css-collector-elements.d.ts +4 -0
- package/dist/plugin/css-collector-elements.d.ts.map +1 -0
- package/dist/plugin/css-collector-elements.js +19 -0
- package/dist/plugin/css-collector-elements.js.map +1 -0
- package/dist/plugin/css-collector.d.ts +2 -8
- package/dist/plugin/css-collector.d.ts.map +1 -1
- package/dist/plugin/css-collector.js +9 -36
- package/dist/plugin/css-collector.js.map +1 -1
- package/dist/plugin/helpers/cleanObject.d.ts +3 -0
- package/dist/plugin/helpers/cleanObject.d.ts.map +1 -0
- package/dist/plugin/helpers/cleanObject.js +47 -0
- package/dist/plugin/helpers/cleanObject.js.map +1 -0
- package/dist/plugin/helpers/collectBundleManifestCss.d.ts +8 -0
- package/dist/plugin/helpers/collectBundleManifestCss.d.ts.map +1 -0
- package/dist/plugin/helpers/collectBundleManifestCss.js +110 -0
- package/dist/plugin/helpers/collectManifestCss.d.ts +7 -0
- package/dist/plugin/helpers/collectManifestCss.d.ts.map +1 -0
- package/dist/plugin/helpers/collectManifestCss.js +44 -0
- package/dist/plugin/helpers/collectManifestCss.js.map +1 -0
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts +31 -0
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts.map +1 -0
- package/dist/plugin/helpers/collectViteModuleGraphCss.js +104 -0
- package/dist/plugin/helpers/collectViteModuleGraphCss.js.map +1 -0
- package/dist/plugin/helpers/createCssProps.d.ts +25 -0
- package/dist/plugin/helpers/createCssProps.d.ts.map +1 -0
- package/dist/plugin/helpers/createCssProps.js +57 -0
- package/dist/plugin/helpers/createCssProps.js.map +1 -0
- package/dist/plugin/helpers/createEventHandler.d.ts +22 -0
- package/dist/plugin/helpers/createEventHandler.d.ts.map +1 -0
- package/dist/plugin/helpers/createEventHandler.js +36 -0
- package/dist/plugin/helpers/createEventHandler.js.map +1 -0
- package/dist/plugin/helpers/createHandler.d.ts +7 -13
- package/dist/plugin/helpers/createHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createHandler.js +54 -96
- package/dist/plugin/helpers/createHandler.js.map +1 -1
- package/dist/plugin/helpers/createRscStream.d.ts +12 -26
- package/dist/plugin/helpers/createRscStream.d.ts.map +1 -1
- package/dist/plugin/helpers/createRscStream.js +105 -51
- package/dist/plugin/helpers/createRscStream.js.map +1 -1
- package/dist/plugin/helpers/defaultFileWriter.d.ts +2 -0
- package/dist/plugin/helpers/defaultFileWriter.d.ts.map +1 -0
- package/dist/plugin/helpers/defaultFileWriter.js +1 -0
- package/dist/plugin/helpers/getBundleManifest.d.ts +10 -16
- package/dist/plugin/helpers/getBundleManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/getBundleManifest.js +30 -22
- package/dist/plugin/helpers/getBundleManifest.js.map +1 -1
- package/dist/plugin/helpers/getRouteFiles.d.ts +14 -0
- package/dist/plugin/helpers/getRouteFiles.d.ts.map +1 -0
- package/dist/plugin/helpers/getRouteFiles.js +36 -0
- package/dist/plugin/helpers/getRouteFiles.js.map +1 -0
- package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -1
- package/dist/plugin/helpers/inputNormalizer.js +38 -32
- package/dist/plugin/helpers/inputNormalizer.js.map +1 -1
- package/dist/plugin/helpers/metrics.d.ts +11 -0
- package/dist/plugin/helpers/metrics.d.ts.map +1 -0
- package/dist/plugin/helpers/metrics.js +35 -0
- package/dist/plugin/helpers/metrics.js.map +1 -0
- package/dist/plugin/helpers/resolvePageAndProps.d.ts +27 -0
- package/dist/plugin/helpers/resolvePageAndProps.d.ts.map +1 -0
- package/dist/plugin/helpers/resolvePageAndProps.js +51 -0
- package/dist/plugin/helpers/resolvePageAndProps.js.map +1 -0
- package/dist/plugin/helpers/serializeUserOptions.d.ts +8 -0
- package/dist/plugin/helpers/serializeUserOptions.d.ts.map +1 -0
- package/dist/plugin/helpers/serializeUserOptions.js +182 -0
- package/dist/plugin/helpers/serializeUserOptions.js.map +1 -0
- package/dist/plugin/helpers/stashReturnValue.d.ts +2 -0
- package/dist/plugin/helpers/stashReturnValue.d.ts.map +1 -0
- package/dist/plugin/helpers/stashReturnValue.js +14 -0
- package/dist/plugin/helpers/tryManifest.d.ts +5 -3
- package/dist/plugin/helpers/tryManifest.d.ts.map +1 -1
- package/dist/plugin/helpers/tryManifest.js +16 -7
- package/dist/plugin/helpers/tryManifest.js.map +1 -1
- package/dist/plugin/html.d.ts +2 -3
- package/dist/plugin/html.d.ts.map +1 -1
- package/dist/plugin/html.js +7 -1
- package/dist/plugin/html.js.map +1 -1
- package/dist/plugin/index.d.ts +1 -2
- package/dist/plugin/index.d.ts.map +1 -1
- package/dist/plugin/index.js +3 -1
- package/dist/plugin/loader/createBuildLoader.d.ts +26 -4
- package/dist/plugin/loader/createBuildLoader.d.ts.map +1 -1
- package/dist/plugin/loader/createBuildLoader.js +98 -33
- package/dist/plugin/loader/createBuildLoader.js.map +1 -1
- package/dist/plugin/loader/css-loader.development.d.ts +57 -0
- package/dist/plugin/loader/css-loader.development.d.ts.map +1 -0
- package/dist/plugin/loader/css-loader.development.js +81 -0
- package/dist/plugin/loader/css-loader.development.js.map +1 -0
- package/dist/plugin/loader/css-loader.production.d.ts +31 -0
- package/dist/plugin/loader/css-loader.production.d.ts.map +1 -0
- package/dist/plugin/loader/css-loader.production.js +45 -0
- package/dist/plugin/loader/css-loader.production.js.map +1 -0
- package/dist/plugin/loader/index.d.ts +2 -0
- package/dist/plugin/loader/index.d.ts.map +1 -0
- package/dist/plugin/loader/index.js +1 -0
- package/dist/plugin/loader/plugin.d.ts +22 -0
- package/dist/plugin/loader/plugin.d.ts.map +1 -0
- package/dist/plugin/loader/plugin.js +27 -0
- package/dist/plugin/loader/react-loader.d.ts +3 -7
- package/dist/plugin/loader/react-loader.d.ts.map +1 -1
- package/dist/plugin/loader/react-loader.js +85 -30
- package/dist/plugin/loader/react-loader.js.map +1 -1
- package/dist/plugin/loader/temporaryReferences.d.ts +2 -0
- package/dist/plugin/loader/temporaryReferences.d.ts.map +1 -0
- package/dist/plugin/loader/temporaryReferences.js +11 -0
- package/dist/plugin/loader/temporaryReferences.js.map +1 -0
- package/dist/plugin/moduleRefs.d.ts +7 -0
- package/dist/plugin/moduleRefs.d.ts.map +1 -0
- package/dist/plugin/moduleRefs.js +17 -0
- package/dist/plugin/moduleRefs.js.map +1 -0
- package/dist/plugin/plugin.client.d.ts +3 -0
- package/dist/plugin/plugin.client.d.ts.map +1 -0
- package/dist/plugin/plugin.client.js +19 -0
- package/dist/plugin/plugin.client.js.map +1 -0
- package/dist/plugin/plugin.d.ts +1 -5
- package/dist/plugin/plugin.d.ts.map +1 -1
- package/dist/plugin/plugin.js +3 -9
- package/dist/plugin/plugin.server.d.ts +3 -0
- package/dist/plugin/plugin.server.d.ts.map +1 -0
- package/dist/plugin/plugin.server.js +28 -0
- package/dist/plugin/plugin.server.js.map +1 -0
- package/dist/plugin/preserver/plugin.js +1 -1
- package/dist/plugin/preserver/plugin.js.map +1 -1
- package/dist/plugin/react-client/index.d.ts +1 -2
- package/dist/plugin/react-client/index.d.ts.map +1 -1
- package/dist/plugin/react-client/index.js +1 -19
- package/dist/plugin/react-client/plugin.d.ts.map +1 -1
- package/dist/plugin/react-client/plugin.js +60 -219
- package/dist/plugin/react-client/plugin.js.map +1 -1
- package/dist/plugin/react-client/server.d.ts +27 -0
- package/dist/plugin/react-client/server.d.ts.map +1 -0
- package/dist/plugin/react-client/server.js +197 -0
- package/dist/plugin/react-client/server.js.map +1 -0
- package/dist/plugin/react-server/index.d.ts +1 -2
- package/dist/plugin/react-server/index.d.ts.map +1 -1
- package/dist/plugin/react-server/index.js +1 -21
- package/dist/plugin/react-server/plugin.d.ts +0 -1
- package/dist/plugin/react-server/plugin.d.ts.map +1 -1
- package/dist/plugin/react-server/plugin.js +60 -186
- package/dist/plugin/react-server/plugin.js.map +1 -1
- package/dist/plugin/react-server/server.d.ts +9 -0
- package/dist/plugin/react-server/server.d.ts.map +1 -0
- package/dist/plugin/react-server/server.js +120 -0
- package/dist/plugin/react-server/server.js.map +1 -0
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts +23 -0
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts.map +1 -0
- package/dist/plugin/react-static/collectHtmlWorkerContent.js +85 -0
- package/dist/plugin/react-static/collectHtmlWorkerContent.js.map +1 -0
- package/dist/plugin/react-static/collectRscContent.d.ts +24 -0
- package/dist/plugin/react-static/collectRscContent.d.ts.map +1 -0
- package/dist/plugin/react-static/collectRscContent.js +49 -0
- package/dist/plugin/react-static/collectRscContent.js.map +1 -0
- package/dist/plugin/react-static/configurePreviewServer.d.ts +7 -0
- package/dist/plugin/react-static/configurePreviewServer.d.ts.map +1 -0
- package/dist/plugin/react-static/configurePreviewServer.js +67 -0
- package/dist/plugin/react-static/configurePreviewServer.js.map +1 -0
- package/dist/plugin/react-static/fileWriter.d.ts +23 -0
- package/dist/plugin/react-static/fileWriter.d.ts.map +1 -0
- package/dist/plugin/react-static/fileWriter.js +65 -0
- package/dist/plugin/react-static/fileWriter.js.map +1 -0
- package/dist/plugin/react-static/plugin.d.ts +15 -0
- package/dist/plugin/react-static/plugin.d.ts.map +1 -1
- package/dist/plugin/react-static/plugin.js +248 -149
- package/dist/plugin/react-static/plugin.js.map +1 -1
- package/dist/plugin/react-static/renderPage.d.ts +3 -0
- package/dist/plugin/react-static/renderPage.d.ts.map +1 -0
- package/dist/plugin/react-static/renderPage.js +116 -0
- package/dist/plugin/react-static/renderPage.js.map +1 -0
- package/dist/plugin/react-static/renderPages.d.ts +3 -0
- package/dist/plugin/react-static/renderPages.d.ts.map +1 -0
- package/dist/plugin/react-static/renderPages.js +125 -0
- package/dist/plugin/react-static/renderPages.js.map +1 -0
- package/dist/plugin/react-static/renderStreams.d.ts +26 -0
- package/dist/plugin/react-static/renderStreams.d.ts.map +1 -0
- package/dist/plugin/react-static/renderStreams.js +27 -0
- package/dist/plugin/react-static/renderStreams.js.map +1 -0
- package/dist/plugin/react-static/rscToHtmlStream.d.ts +22 -0
- package/dist/plugin/react-static/rscToHtmlStream.d.ts.map +1 -0
- package/dist/plugin/react-static/rscToHtmlStream.js +54 -0
- package/dist/plugin/react-static/rscToHtmlStream.js.map +1 -0
- package/dist/plugin/react-static/streamHandler.d.ts +2 -0
- package/dist/plugin/react-static/streamHandler.d.ts.map +1 -0
- package/dist/plugin/react-static/streamHandler.js +1 -0
- package/dist/plugin/react-static/types.d.ts +11 -0
- package/dist/plugin/react-static/types.d.ts.map +1 -1
- package/dist/plugin/resolvePage.d.ts +26 -9
- package/dist/plugin/resolvePage.d.ts.map +1 -1
- package/dist/plugin/resolvePage.js +41 -39
- package/dist/plugin/resolvePage.js.map +1 -1
- package/dist/plugin/resolveProps.d.ts +40 -7
- package/dist/plugin/resolveProps.d.ts.map +1 -1
- package/dist/plugin/resolveProps.js +100 -75
- package/dist/plugin/resolveProps.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 +1 -0
- package/dist/plugin/root.js.map +1 -1
- package/dist/plugin/transformer/index.d.ts +2 -1
- package/dist/plugin/transformer/index.d.ts.map +1 -1
- package/dist/plugin/transformer/index.js +2 -1
- package/dist/plugin/transformer/plugin.client.d.ts +4 -0
- package/dist/plugin/transformer/plugin.client.d.ts.map +1 -0
- package/dist/plugin/transformer/plugin.client.js +83 -0
- package/dist/plugin/transformer/plugin.client.js.map +1 -0
- package/dist/plugin/transformer/plugin.d.ts +1 -27
- package/dist/plugin/transformer/plugin.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.js +3 -87
- package/dist/plugin/transformer/plugin.js.map +1 -1
- package/dist/plugin/transformer/plugin.server.d.ts +4 -0
- package/dist/plugin/transformer/plugin.server.d.ts.map +1 -0
- package/dist/plugin/transformer/plugin.server.js +76 -0
- package/dist/plugin/transformer/plugin.server.js.map +1 -0
- package/dist/plugin/transformer/upgradeCssModuleCode.d.ts +11 -0
- package/dist/plugin/transformer/upgradeCssModuleCode.d.ts.map +1 -0
- package/dist/plugin/transformer/upgradeCssModuleCode.js +38 -0
- package/dist/plugin/types/css-tracking.d.ts +6 -0
- package/dist/plugin/types/css-tracking.d.ts.map +1 -0
- package/dist/plugin/types/css-tracking.js +1 -0
- package/dist/plugin/types.d.ts +372 -86
- package/dist/plugin/types.d.ts.map +1 -1
- package/dist/plugin/types.js +1 -1
- package/dist/plugin/vendor.client.d.ts +4 -0
- package/dist/plugin/vendor.client.d.ts.map +1 -0
- package/dist/plugin/vendor.client.js +16 -0
- package/dist/plugin/vendor.client.js.map +1 -0
- package/dist/plugin/vendor.server.d.ts +4 -0
- package/dist/plugin/vendor.server.d.ts.map +1 -0
- package/dist/plugin/vendor.server.js +16 -0
- package/dist/plugin/vendor.server.js.map +1 -0
- package/dist/plugin/worker/createWorker.d.ts +25 -7
- package/dist/plugin/worker/createWorker.d.ts.map +1 -1
- package/dist/plugin/worker/createWorker.js +108 -33
- package/dist/plugin/worker/createWorker.js.map +1 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts +12 -0
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts.map +1 -0
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js +103 -0
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js.map +1 -0
- package/dist/plugin/worker/html/html-worker.development.d.ts +0 -30
- package/dist/plugin/worker/html/html-worker.development.d.ts.map +1 -1
- package/dist/plugin/worker/html/html-worker.development.js +3 -17
- package/dist/plugin/worker/html/html-worker.development.js.map +1 -1
- package/dist/plugin/worker/html/html-worker.production.js +12 -5
- package/dist/plugin/worker/html/html-worker.production.js.map +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts +2 -2
- package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.js +87 -84
- package/dist/plugin/worker/html/messageHandler.js.map +1 -1
- package/dist/plugin/worker/html/types.d.ts +18 -0
- package/dist/plugin/worker/html/types.d.ts.map +1 -0
- package/dist/plugin/worker/html/types.js +1 -0
- package/dist/plugin/worker/registerLoaders.d.ts +9 -0
- package/dist/plugin/worker/registerLoaders.d.ts.map +1 -0
- package/dist/plugin/worker/registerLoaders.js +45 -0
- package/dist/plugin/worker/rsc/handleRender.d.ts +4 -0
- package/dist/plugin/worker/rsc/handleRender.d.ts.map +1 -0
- package/dist/plugin/worker/rsc/handleRender.js +147 -0
- package/dist/plugin/worker/rsc/handleRender.js.map +1 -0
- package/dist/plugin/worker/rsc/messageHandler.d.ts +2 -2
- package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.js +47 -112
- package/dist/plugin/worker/rsc/messageHandler.js.map +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.development.d.ts +0 -30
- package/dist/plugin/worker/rsc/rsc-worker.development.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.development.js +29 -4
- package/dist/plugin/worker/rsc/rsc-worker.development.js.map +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.production.js +3 -3
- package/dist/plugin/worker/rsc/rsc-worker.production.js.map +1 -1
- package/dist/plugin/worker/rsc/state.d.ts +73 -2
- package/dist/plugin/worker/rsc/state.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/state.js +40 -3
- package/dist/plugin/worker/rsc/state.js.map +1 -1
- package/dist/plugin/worker/sendMessage.d.ts +3 -0
- package/dist/plugin/worker/sendMessage.d.ts.map +1 -0
- package/dist/plugin/worker/sendMessage.js +48 -0
- package/dist/plugin/worker/types.d.ts +218 -76
- package/dist/plugin/worker/types.d.ts.map +1 -1
- package/dist/server.d.ts +1 -1
- package/dist/server.d.ts.map +1 -1
- package/dist/server.js +6 -1
- package/dist/server.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +24 -14
- package/plugin/components.ts +1 -1
- package/plugin/config/autoDiscover/createGlobAutoDiscover.ts +29 -0
- package/plugin/config/autoDiscover/customWorkerFiles.ts +27 -0
- package/plugin/config/autoDiscover/pageAndPropFiles.ts +36 -0
- package/plugin/config/autoDiscover/resolveBuildPages.ts +98 -0
- package/plugin/config/defaults.tsx +38 -29
- package/plugin/config/getCondition.ts +7 -3
- package/plugin/config/getPaths.ts +1 -7
- package/plugin/config/index.ts +0 -1
- package/plugin/config/resolveAutoDiscover.ts +177 -0
- package/plugin/config/resolveOptions.ts +220 -118
- package/plugin/config/resolvePages.ts +5 -7
- package/plugin/config/resolveUrlOption.ts +43 -0
- package/plugin/config/resolveUserConfig.ts +116 -166
- package/plugin/copy.ts +39 -0
- package/plugin/css-collector-elements.tsx +21 -0
- package/plugin/css-collector.tsx +20 -53
- package/plugin/helpers/cleanObject.ts +50 -0
- package/plugin/helpers/collectBundleManifestCss.ts +160 -0
- package/plugin/helpers/collectManifestCss.ts +61 -0
- package/plugin/helpers/collectViteModuleGraphCss.ts +158 -0
- package/plugin/helpers/createCssProps.tsx +85 -0
- package/plugin/helpers/createEventHandler.ts +44 -0
- package/plugin/helpers/createHandler.ts +57 -126
- package/plugin/helpers/createRscStream.tsx +156 -0
- package/plugin/helpers/defaultFileWriter.ts +0 -0
- package/plugin/helpers/getBundleManifest.ts +42 -37
- package/plugin/helpers/getRouteFiles.ts +47 -0
- package/plugin/helpers/inputNormalizer.ts +16 -10
- package/plugin/helpers/metrics.ts +64 -0
- package/plugin/helpers/resolvePageAndProps.ts +81 -0
- package/plugin/helpers/serializeUserOptions.ts +209 -0
- package/plugin/helpers/stashReturnValue.ts +16 -0
- package/plugin/helpers/tryManifest.ts +35 -18
- package/plugin/html.tsx +14 -3
- package/plugin/index.ts +5 -2
- package/plugin/loader/createBuildLoader.ts +152 -47
- package/plugin/loader/css-loader.development.ts +157 -0
- package/plugin/loader/css-loader.production.ts +86 -0
- package/plugin/loader/index.ts +1 -0
- package/plugin/loader/plugin.ts +33 -0
- package/plugin/loader/react-loader.ts +109 -41
- package/plugin/loader/temporaryReferences.ts +3 -0
- package/plugin/moduleRefs.ts +11 -0
- package/plugin/plugin.client.ts +12 -0
- package/plugin/plugin.server.ts +25 -0
- package/plugin/plugin.ts +5 -9
- package/plugin/preserver/plugin.ts +1 -1
- package/plugin/react-client/index.ts +1 -12
- package/plugin/react-client/plugin.ts +70 -259
- package/plugin/react-client/server.ts +276 -0
- package/plugin/react-server/index.ts +1 -14
- package/plugin/react-server/plugin.ts +69 -220
- package/plugin/react-server/server.ts +128 -0
- package/plugin/react-static/collectHtmlWorkerContent.ts +120 -0
- package/plugin/react-static/collectRscContent.ts +77 -0
- package/plugin/react-static/configurePreviewServer.ts +68 -0
- package/plugin/react-static/fileWriter.ts +103 -0
- package/plugin/react-static/plugin.ts +308 -181
- package/plugin/react-static/renderPage.ts +151 -0
- package/plugin/react-static/renderPages.ts +154 -0
- package/plugin/react-static/renderStreams.ts +48 -0
- package/plugin/react-static/rscToHtmlStream.ts +85 -0
- package/plugin/react-static/streamHandler.ts +0 -0
- package/plugin/react-static/types.ts +10 -0
- package/plugin/resolvePage.ts +67 -57
- package/plugin/resolveProps.ts +148 -104
- package/plugin/root.ts +1 -1
- package/plugin/transformer/index.ts +2 -1
- package/plugin/transformer/plugin.client.ts +109 -0
- package/plugin/transformer/plugin.server.ts +98 -0
- package/plugin/transformer/plugin.ts +2 -115
- package/plugin/transformer/upgradeCssModuleCode.ts +42 -0
- package/plugin/types/css-tracking.ts +5 -0
- package/plugin/types/react-server-dom-esm.d.ts +54 -0
- package/plugin/types.ts +508 -97
- package/plugin/vendor.client.ts +12 -0
- package/plugin/vendor.server.ts +12 -0
- package/plugin/worker/createWorker.ts +158 -53
- package/plugin/worker/html/createHtmlWorkerRenderState.tsx +112 -0
- package/plugin/worker/html/html-worker.development.tsx +5 -75
- package/plugin/worker/html/html-worker.production.tsx +18 -7
- package/plugin/worker/html/messageHandler.tsx +126 -0
- package/plugin/worker/html/types.ts +19 -0
- package/plugin/worker/registerLoaders.ts +54 -0
- package/plugin/worker/rsc/handleRender.ts +180 -0
- package/plugin/worker/rsc/messageHandler.tsx +58 -132
- package/plugin/worker/rsc/rsc-worker.development.ts +49 -63
- package/plugin/worker/rsc/rsc-worker.production.ts +5 -5
- package/plugin/worker/rsc/state.ts +79 -2
- package/plugin/worker/sendMessage.ts +49 -0
- package/plugin/worker/types.ts +299 -100
- package/scripts/check-react-version.mjs +60 -48
- package/scripts/react+0.0.0-experimental-0ca8420f-20250504.patch +57 -0
- package/scripts/react-dom+0.0.0-experimental-0ca8420f-20250504.patch +819 -0
- package/scripts/{react-server-dom-esm+0.0.0-experimental-eda36a1c-20250228.patch → react-server-dom-esm+0.0.0-experimental-0ca8420f-20250504.patch} +1702 -2820
- package/tsconfig.json +7 -2
- package/dist/plugin/assertServerCondition.d.ts +0 -6
- package/dist/plugin/assertServerCondition.d.ts.map +0 -1
- package/dist/plugin/assertServerCondition.js +0 -13
- package/dist/plugin/checkFilesExist.d.ts +0 -3
- package/dist/plugin/checkFilesExist.d.ts.map +0 -1
- package/dist/plugin/checkFilesExist.js +0 -67
- package/dist/plugin/checkFilesExist.js.map +0 -1
- package/dist/plugin/collect-manifest-client-files.d.ts +0 -23
- package/dist/plugin/collect-manifest-client-files.d.ts.map +0 -1
- package/dist/plugin/collect-manifest-client-files.js +0 -131
- package/dist/plugin/collect-manifest-client-files.js.map +0 -1
- package/dist/plugin/config/getWorkerPath.d.ts +0 -2
- package/dist/plugin/config/getWorkerPath.d.ts.map +0 -1
- package/dist/plugin/config/getWorkerPath.js +0 -4
- package/dist/plugin/copy-dir.d.ts +0 -4
- package/dist/plugin/copy-dir.d.ts.map +0 -1
- package/dist/plugin/copy-dir.js +0 -25
- package/dist/plugin/copy-dir.js.map +0 -1
- package/dist/plugin/css-collector-inline.d.ts +0 -10
- package/dist/plugin/css-collector-inline.d.ts.map +0 -1
- package/dist/plugin/css-collector-inline.js +0 -55
- package/dist/plugin/css-collector-inline.js.map +0 -1
- package/dist/plugin/loader/css-loader.d.ts +0 -16
- package/dist/plugin/loader/css-loader.d.ts.map +0 -1
- package/dist/plugin/loader/css-loader.js +0 -70
- package/dist/plugin/loader/css-loader.js.map +0 -1
- package/dist/plugin/react-client/index.js.map +0 -1
- package/dist/plugin/react-server/index.js.map +0 -1
- package/dist/plugin/worker/html/renderPages.d.ts +0 -26
- package/dist/plugin/worker/html/renderPages.d.ts.map +0 -1
- package/dist/plugin/worker/html/renderPages.js +0 -241
- package/dist/plugin/worker/html/renderPages.js.map +0 -1
- package/plugin/assertServerCondition.ts +0 -12
- package/plugin/checkFilesExist.ts +0 -66
- package/plugin/collect-manifest-client-files.ts +0 -167
- package/plugin/config/getWorkerPath.ts +0 -5
- package/plugin/copy-dir.ts +0 -27
- package/plugin/css-collector-inline.tsx +0 -60
- package/plugin/helpers/createRscStream.ts +0 -109
- package/plugin/loader/css-loader.ts +0 -94
- package/plugin/worker/html/messageHandler.ts +0 -130
- package/plugin/worker/html/renderPages.ts +0 -293
- package/scripts/react+0.0.0-experimental-eda36a1c-20250228.patch +0 -159
- package/scripts/react-dom+0.0.0-experimental-eda36a1c-20250228.patch +0 -12508
package/tsconfig.json
CHANGED
|
@@ -1,10 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
// when we extend a tsconfig.json file, it will merge and override the compilerOptions but not the arrays like lib, rootDirs, etc.
|
|
3
3
|
"compilerOptions": {
|
|
4
|
+
// this file can work as a composite project
|
|
4
5
|
"composite": true,
|
|
6
|
+
// this file can emit declarations
|
|
5
7
|
"declaration": true,
|
|
8
|
+
// this file can emit declaration maps
|
|
6
9
|
"declarationMap": true,
|
|
7
|
-
//
|
|
10
|
+
// strict mode family checks https://www.typescriptlang.org/tsconfig/#strict
|
|
8
11
|
"strict": true,
|
|
9
12
|
// Should you want to just import a js file anyway. You can use type comments in a .js file like: /* @type {string} */
|
|
10
13
|
"allowJs": true,
|
|
@@ -18,7 +21,6 @@
|
|
|
18
21
|
"jsxFragmentFactory": "React.Fragment",
|
|
19
22
|
// We force module detection to be sure that the module system is detected correctly.
|
|
20
23
|
"moduleDetection": "force",
|
|
21
|
-
// To indicate that we are NOT going to be emitting files
|
|
22
24
|
// This just means that when you write a switch statement, you will get an error once you forget to add a break statement.
|
|
23
25
|
"noFallthroughCasesInSwitch": true,
|
|
24
26
|
// We don't allow property access from index signatures. In this case we prefer to write record['images'] instead of record.images
|
|
@@ -42,11 +44,14 @@
|
|
|
42
44
|
"react/canary",
|
|
43
45
|
"react-dom/canary"
|
|
44
46
|
],
|
|
47
|
+
// we can use our own package imports internally e.g. import { vitePluginReactServer } from `vite-plugin-react-server`
|
|
45
48
|
"resolvePackageJsonImports": true,
|
|
46
49
|
"resolvePackageJsonExports": true,
|
|
50
|
+
// we want to use the verbatim module syntax
|
|
47
51
|
"verbatimModuleSyntax": true,
|
|
48
52
|
// The very latest ES features
|
|
49
53
|
"target": "es2022",
|
|
54
|
+
// we want to use the latest node module resolution
|
|
50
55
|
"module": "nodenext",
|
|
51
56
|
"moduleResolution": "nodenext",
|
|
52
57
|
"lib": [
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"assertServerCondition.d.ts","sourceRoot":"","sources":["../../plugin/assertServerCondition.ts"],"names":[],"mappings":"AAAA,wBAAgB,qBAAqB,CAAC,CAAC,SAAS,OAAO,OAAO,EAAE,CAAC,EAAE,CAAC,GAAG,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG;IAAE,GAAG,EAAE;QAAE,YAAY,EAAE,MAAM,CAAA;KAAE,CAAA;CAAE,CAWtH"}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
export function assertServerCondition(p) {
|
|
2
|
-
const nodeOptions = p.env['NODE_OPTIONS'];
|
|
3
|
-
if (!nodeOptions?.match(/--conditions[= ]react-server/)) {
|
|
4
|
-
if (!nodeOptions?.match(/--conditions/)) {
|
|
5
|
-
console.warn(`process.env['NODE_OPTIONS'] is missing \`--conditions\` flag, it should be like \`--conditions=react-server\` or \`--conditions react-server\`, but was ${JSON.stringify(process.env['NODE_OPTIONS'])}`);
|
|
6
|
-
}
|
|
7
|
-
if (!nodeOptions?.match(/react-server/)) {
|
|
8
|
-
throw new Error(`process.env['NODE_OPTIONS'] is missing \`react-server\` flag, it should be like \`--conditions=react-server\` or \`--conditions react-server\`, but was ${JSON.stringify(process.env['NODE_OPTIONS'])}`);
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
return undefined;
|
|
12
|
-
}
|
|
13
|
-
;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkFilesExist.d.ts","sourceRoot":"","sources":["../../plugin/checkFilesExist.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,qBAAqB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAY7E,wBAAsB,eAAe,CACnC,KAAK,EAAE,MAAM,EAAE,EACf,OAAO,EAAE,mBAAmB,EAC5B,IAAI,EAAE,MAAM,GACX,OAAO,CAAC,qBAAqB,CAAC,CA+ChC"}
|
|
@@ -1,67 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite-plugin-react-server
|
|
3
|
-
* Copyright (c) Nico Brinkkemper
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
import { existsSync } from 'node:fs';
|
|
7
|
-
import { join } from 'node:path';
|
|
8
|
-
import { createInputNormalizer } from './helpers/inputNormalizer.js';
|
|
9
|
-
|
|
10
|
-
let stashedFiles = null;
|
|
11
|
-
const resolveFileOption = (pageOrProps) => {
|
|
12
|
-
if (typeof pageOrProps === "string") {
|
|
13
|
-
return () => pageOrProps;
|
|
14
|
-
}
|
|
15
|
-
return pageOrProps;
|
|
16
|
-
};
|
|
17
|
-
async function checkFilesExist(pages, options, root) {
|
|
18
|
-
if (stashedFiles) {
|
|
19
|
-
return stashedFiles;
|
|
20
|
-
}
|
|
21
|
-
if (!root || root === "") {
|
|
22
|
-
throw new Error("Root not found");
|
|
23
|
-
}
|
|
24
|
-
const errors = [];
|
|
25
|
-
const pageSet = /* @__PURE__ */ new Set();
|
|
26
|
-
const propsSet = /* @__PURE__ */ new Set();
|
|
27
|
-
const pageMap = /* @__PURE__ */ new Map();
|
|
28
|
-
const propsMap = /* @__PURE__ */ new Map();
|
|
29
|
-
const urlMap = /* @__PURE__ */ new Map();
|
|
30
|
-
const normalizer = createInputNormalizer({
|
|
31
|
-
root,
|
|
32
|
-
preserveModulesRoot: options.build.preserveModulesRoot === true ? options.moduleBase : undefined,
|
|
33
|
-
removeExtension: true
|
|
34
|
-
});
|
|
35
|
-
const pageFn = resolveFileOption(options.Page);
|
|
36
|
-
const propsFn = resolveFileOption(options.props);
|
|
37
|
-
for (const page of pages) {
|
|
38
|
-
const pagePath = pageFn(page);
|
|
39
|
-
const propsPath = propsFn(page);
|
|
40
|
-
const [pageKey, pageValue] = normalizer(pagePath);
|
|
41
|
-
const [propsKey, propsValue] = normalizer(propsPath);
|
|
42
|
-
try {
|
|
43
|
-
if (!existsSync(join(root, pageValue))) {
|
|
44
|
-
errors.push(
|
|
45
|
-
`Page file not found: ${pagePath}, ${join(root, pagePath)}`
|
|
46
|
-
);
|
|
47
|
-
}
|
|
48
|
-
if (!existsSync(join(root, propsValue))) {
|
|
49
|
-
errors.push(
|
|
50
|
-
`Props file not found: ${propsPath}, ${join(root, propsPath)}`
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
} catch (error) {
|
|
54
|
-
errors.push(`Error checking files: ${error}`);
|
|
55
|
-
}
|
|
56
|
-
urlMap.set(page, { props: propsPath, page: pagePath });
|
|
57
|
-
pageSet.add(pagePath);
|
|
58
|
-
propsSet.add(propsPath);
|
|
59
|
-
pageMap.set(pageKey, pageValue);
|
|
60
|
-
propsMap.set(propsKey, propsValue);
|
|
61
|
-
}
|
|
62
|
-
stashedFiles = { pageMap, pageSet, propsMap, propsSet, urlMap, errors };
|
|
63
|
-
return stashedFiles;
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
export { checkFilesExist };
|
|
67
|
-
//# sourceMappingURL=checkFilesExist.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"checkFilesExist.js","sources":["../../plugin/checkFilesExist.ts"],"sourcesContent":["import { existsSync } from \"node:fs\";\nimport { join } from \"node:path\";\nimport type { CheckFilesExistReturn, ResolvedUserOptions } from \"./types.js\";\nimport { createInputNormalizer } from \"./helpers/inputNormalizer.js\";\n\nlet stashedFiles: CheckFilesExistReturn | null = null;\n\nconst resolveFileOption = (pageOrProps: string | ((url: string) => string)) => {\n if (typeof pageOrProps === \"string\") {\n return () => pageOrProps;\n }\n return pageOrProps;\n};\n\nexport async function checkFilesExist(\n pages: string[],\n options: ResolvedUserOptions,\n root: string\n): Promise<CheckFilesExistReturn> {\n if(stashedFiles){\n return stashedFiles;\n }\n if (!root || root === \"\") {\n throw new Error(\"Root not found\");\n }\n const errors: string[] = [];\n const pageSet = new Set<string>();\n const propsSet = new Set<string>();\n const pageMap = new Map<string, string>();\n const propsMap = new Map<string, string>();\n const urlMap = new Map<string, { props: string; page: string }>();\n const normalizer = createInputNormalizer({\n root,\n preserveModulesRoot: options.build.preserveModulesRoot === true ? options.moduleBase : undefined,\n removeExtension: true,\n });\n const pageFn = resolveFileOption(options.Page);\n const propsFn = resolveFileOption(options.props);\n for (const page of pages) {\n const pagePath = pageFn(page);\n const propsPath = propsFn(page);\n const [pageKey, pageValue] = normalizer(pagePath);\n const [propsKey, propsValue] = normalizer(propsPath);\n try {\n if (!existsSync(join(root, pageValue))) {\n errors.push(\n `Page file not found: ${pagePath}, ${join(root, pagePath)}`\n );\n }\n if (!existsSync(join(root, propsValue))) {\n errors.push(\n `Props file not found: ${propsPath}, ${join(root, propsPath)}`\n );\n }\n } catch (error) {\n errors.push(`Error checking files: ${error}`);\n }\n urlMap.set(page, { props: propsPath, page: pagePath });\n pageSet.add(pagePath);\n propsSet.add(propsPath);\n pageMap.set(pageKey, pageValue);\n propsMap.set(propsKey, propsValue);\n }\n stashedFiles = { pageMap, pageSet, propsMap, propsSet, urlMap, errors };\n return stashedFiles;\n}\n"],"names":[],"mappings":";;;;;;;;;AAKA,IAAI,YAA6C,GAAA,IAAA;AAEjD,MAAM,i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GAAI,WAAW,SAAS,CAAA;AACnD,IAAI,IAAA;AACF,MAAA,IAAI,CAAC,UAAW,CAAA,IAAA,CAAK,IAAM,EAAA,SAAS,CAAC,CAAG,EAAA;AACtC,QAAO,MAAA,CAAA,IAAA;AAAA,UACL,wBAAwB,QAAQ,CAAA,EAAA,EAAK,IAAK,CAAA,IAAA,EAAM,QAAQ,CAAC,CAAA;AAAA,SAC3D;AAAA;AAEF,MAAA,IAAI,CAAC,UAAW,CAAA,IAAA,CAAK,IAAM,EAAA,UAAU,CAAC,CAAG,EAAA;AACvC,QAAO,MAAA,CAAA,IAAA;AAAA,UACL,yBAAyB,SAAS,CAAA,EAAA,EAAK,IAAK,CAAA,IAAA,EAAM,SAAS,CAAC,CAAA;AAAA,SAC9D;AAAA;AACF,aACO,KAAO,EAAA;AACd,MAAO,MAAA,CAAA,IAAA,CAAK,CAAyB,sBAAA,EAAA,KAAK,CAAE,CAAA,CAAA;AAAA;AAE9C,IAAA,MAAA,CAAO,IAAI,IAAM,EAAA,EAAE,OAAO,SAAW,EAAA,IAAA,EAAM,UAAU,CAAA;AACrD,IAAA,OAAA,CAAQ,IAAI,QAAQ,CAAA;AACpB,IAAA,QAAA,CAAS,IAAI,SAAS,CAAA;AACtB,IAAQ,OAAA,CAAA,GAAA,CAAI,SAAS,SAAS,CAAA;AAC9B,IAAS,QAAA,CAAA,GAAA,CAAI,UAAU,UAAU,CAAA;AAAA;AAEnC,EAAA,YAAA,GAAe,EAAE,OAAS,EAAA,OAAA,EAAS,QAAU,EAAA,QAAA,EAAU,QAAQ,MAAO,EAAA;AACtE,EAAO,OAAA,YAAA;AACT;;;;"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import type { Manifest, ModuleGraph } from "vite";
|
|
2
|
-
export declare function collectModuleGraphCss({ moduleGraph, pagePath, onCss, parentUrl, }: {
|
|
3
|
-
moduleGraph: ModuleGraph;
|
|
4
|
-
pagePath: string;
|
|
5
|
-
onCss?: (path: string, parentUrl: string) => void;
|
|
6
|
-
parentUrl?: string;
|
|
7
|
-
}): Promise<Map<string, string>>;
|
|
8
|
-
export declare function collectManifestClientFiles({ manifest, root, pagePath, preserveModulesRoot, moduleBase, onCss, onClientModule, testClient, testJson, }: {
|
|
9
|
-
manifest: Manifest;
|
|
10
|
-
root: string;
|
|
11
|
-
pagePath: string;
|
|
12
|
-
preserveModulesRoot?: boolean;
|
|
13
|
-
moduleBase?: string;
|
|
14
|
-
onCss?: (path: string, parentUrl: string) => void;
|
|
15
|
-
onClientModule?: (path: string, parentUrl: string) => void;
|
|
16
|
-
parentUrl?: string;
|
|
17
|
-
testClient?: (id: string) => boolean;
|
|
18
|
-
testJson?: (id: string) => boolean;
|
|
19
|
-
}): {
|
|
20
|
-
cssFiles: Map<string, string>;
|
|
21
|
-
clientFiles: Map<string, string>;
|
|
22
|
-
};
|
|
23
|
-
//# sourceMappingURL=collect-manifest-client-files.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collect-manifest-client-files.d.ts","sourceRoot":"","sources":["../../plugin/collect-manifest-client-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,WAAW,EAAE,MAAM,MAAM,CAAC;AAIlD,wBAAsB,qBAAqB,CAAC,EAC1C,WAAW,EACX,QAAQ,EACR,KAAK,EACL,SAAS,GACV,EAAE;IACD,WAAW,EAAE,WAAW,CAAC;IACzB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,gCAoBA;AAED,wBAAgB,0BAA0B,CAAC,EACzC,QAAQ,EACR,IAAI,EACJ,QAAQ,EACR,mBAAmB,EACnB,UAAU,EACV,KAAK,EACL,cAAc,EACd,UAA0D,EAC1D,QAAmD,GACpD,EAAE;IACD,QAAQ,EAAE,QAAQ,CAAC;IACnB,IAAI,EAAE,MAAM,CAAC;IACb,QAAQ,EAAE,MAAM,CAAC;IACjB,mBAAmB,CAAC,EAAE,OAAO,CAAC;IAC9B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,KAAK,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAClD,cAAc,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,UAAU,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC;CACpC;;;EA6GA"}
|
|
@@ -1,131 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite-plugin-react-server
|
|
3
|
-
* Copyright (c) Nico Brinkkemper
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
import { createInputNormalizer } from './helpers/inputNormalizer.js';
|
|
7
|
-
import { DEFAULT_CONFIG } from './config/defaults.js';
|
|
8
|
-
|
|
9
|
-
async function collectModuleGraphCss({
|
|
10
|
-
moduleGraph,
|
|
11
|
-
pagePath,
|
|
12
|
-
onCss,
|
|
13
|
-
parentUrl
|
|
14
|
-
}) {
|
|
15
|
-
if (!pagePath) return /* @__PURE__ */ new Map();
|
|
16
|
-
const cssFiles = /* @__PURE__ */ new Map();
|
|
17
|
-
const pageModule = await moduleGraph.getModuleByUrl(pagePath, true);
|
|
18
|
-
if (!pageModule) {
|
|
19
|
-
return /* @__PURE__ */ new Map();
|
|
20
|
-
}
|
|
21
|
-
const seen = /* @__PURE__ */ new Set();
|
|
22
|
-
const walkModule = (mod) => {
|
|
23
|
-
if (!mod?.id || seen.has(mod.id)) return;
|
|
24
|
-
seen.add(mod.id);
|
|
25
|
-
if (mod?.id?.endsWith(".css")) {
|
|
26
|
-
cssFiles.set(mod?.url, mod?.id);
|
|
27
|
-
}
|
|
28
|
-
mod?.importedModules?.forEach((imp) => walkModule(imp));
|
|
29
|
-
};
|
|
30
|
-
walkModule(pageModule);
|
|
31
|
-
return cssFiles;
|
|
32
|
-
}
|
|
33
|
-
function collectManifestClientFiles({
|
|
34
|
-
manifest,
|
|
35
|
-
root,
|
|
36
|
-
pagePath,
|
|
37
|
-
preserveModulesRoot,
|
|
38
|
-
moduleBase,
|
|
39
|
-
onCss,
|
|
40
|
-
onClientModule,
|
|
41
|
-
testClient = DEFAULT_CONFIG.AUTO_DISCOVER.clientComponents,
|
|
42
|
-
testJson = DEFAULT_CONFIG.AUTO_DISCOVER.jsonPattern
|
|
43
|
-
}) {
|
|
44
|
-
const normalizer = createInputNormalizer({
|
|
45
|
-
root,
|
|
46
|
-
removeExtension: true,
|
|
47
|
-
preserveModulesRoot: preserveModulesRoot ? moduleBase : undefined
|
|
48
|
-
});
|
|
49
|
-
const [_, value] = normalizer(pagePath);
|
|
50
|
-
const cssFiles = /* @__PURE__ */ new Map();
|
|
51
|
-
const clientFiles = /* @__PURE__ */ new Map();
|
|
52
|
-
const seen = /* @__PURE__ */ new Set();
|
|
53
|
-
const manifestValues = Object.values(manifest);
|
|
54
|
-
const possibleKeys = [
|
|
55
|
-
value
|
|
56
|
-
// Relative path
|
|
57
|
-
];
|
|
58
|
-
const walkManifestEntry = (id, parentUrl) => {
|
|
59
|
-
if (seen.has(id)) return;
|
|
60
|
-
seen.add(id);
|
|
61
|
-
const entry = manifest[id] ?? manifestValues.find((e) => id === e.file);
|
|
62
|
-
if (!entry) {
|
|
63
|
-
const hasKey = Object.keys(manifest).find((key) => id === key);
|
|
64
|
-
if (hasKey) {
|
|
65
|
-
console.log(
|
|
66
|
-
`Manifest entry found for ${id}, but it is ${typeof entry}`
|
|
67
|
-
);
|
|
68
|
-
return;
|
|
69
|
-
} else {
|
|
70
|
-
console.log(
|
|
71
|
-
`No manifest entry found for ${id}, possible keys: ${Object.keys(
|
|
72
|
-
manifest
|
|
73
|
-
).join(", ")}`
|
|
74
|
-
);
|
|
75
|
-
}
|
|
76
|
-
return;
|
|
77
|
-
}
|
|
78
|
-
if (typeof testClient === "function" && typeof onClientModule === "function" && testClient(entry.file) || typeof testJson === "function" && testJson(entry.file)) {
|
|
79
|
-
onClientModule?.(entry.file ?? "", parentUrl);
|
|
80
|
-
clientFiles.set(id, entry.name ?? "");
|
|
81
|
-
}
|
|
82
|
-
if (entry.css) {
|
|
83
|
-
entry.css.forEach((css) => {
|
|
84
|
-
cssFiles.set(css, css);
|
|
85
|
-
onCss?.(css, id);
|
|
86
|
-
onClientModule?.(css, id);
|
|
87
|
-
});
|
|
88
|
-
}
|
|
89
|
-
if (entry.imports) {
|
|
90
|
-
entry.imports.forEach(
|
|
91
|
-
(imp) => walkManifestEntry(imp, entry.file)
|
|
92
|
-
);
|
|
93
|
-
}
|
|
94
|
-
if (entry.dynamicImports) {
|
|
95
|
-
entry.dynamicImports.forEach(
|
|
96
|
-
(imp) => walkManifestEntry(imp, entry.file)
|
|
97
|
-
);
|
|
98
|
-
}
|
|
99
|
-
};
|
|
100
|
-
for (const possibleKey of possibleKeys) {
|
|
101
|
-
if (manifest[possibleKey]) {
|
|
102
|
-
walkManifestEntry(possibleKey, pagePath);
|
|
103
|
-
break;
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
if (cssFiles.size === 0) {
|
|
107
|
-
const entry = manifestValues.find(
|
|
108
|
-
(e) => possibleKeys.includes(e.file) || e.src && possibleKeys.includes(e.src) || e.name && possibleKeys.includes(e.name)
|
|
109
|
-
);
|
|
110
|
-
if (entry) {
|
|
111
|
-
walkManifestEntry(value, pagePath);
|
|
112
|
-
} else {
|
|
113
|
-
const hasKey = Object.keys(manifest).find((key) => value === key);
|
|
114
|
-
if (hasKey) {
|
|
115
|
-
console.warn(
|
|
116
|
-
`Manifest entry found for ${value}, but it is ${typeof manifest[hasKey]}`
|
|
117
|
-
);
|
|
118
|
-
} else {
|
|
119
|
-
console.warn(
|
|
120
|
-
`No manifest entry found for ${value} (tried all possible keys: ${possibleKeys.join(
|
|
121
|
-
", "
|
|
122
|
-
)} for manifest keys: ${Object.keys(manifest).join(", ")})`
|
|
123
|
-
);
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
return { cssFiles, clientFiles };
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
export { collectManifestClientFiles, collectModuleGraphCss };
|
|
131
|
-
//# sourceMappingURL=collect-manifest-client-files.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"collect-manifest-client-files.js","sources":["../../plugin/collect-manifest-client-files.ts"],"sourcesContent":["import type { Manifest, ModuleGraph } from \"vite\";\nimport { createInputNormalizer } from \"./helpers/inputNormalizer.js\";\nimport { DEFAULT_CONFIG } from \"./config/defaults.js\";\n\nexport async function collectModuleGraphCss({\n moduleGraph,\n pagePath,\n onCss,\n parentUrl,\n}: {\n moduleGraph: ModuleGraph;\n pagePath: string;\n onCss?: (path: string, parentUrl: string) => void;\n parentUrl?: string;\n}) {\n if (!pagePath) return new Map<string, string>();\n\n const cssFiles = new Map<string, string>();\n const pageModule = await moduleGraph.getModuleByUrl(pagePath, true);\n if (!pageModule) {\n return new Map<string, string>();\n }\n const seen = new Set<string>();\n const walkModule = (mod: any) => {\n if (!mod?.id || seen.has(mod.id)) return;\n seen.add(mod.id);\n if (mod?.id?.endsWith(\".css\")) {\n cssFiles.set(mod?.url, mod?.id);\n onCss?.(mod?.url, parentUrl ?? pagePath);\n }\n mod?.importedModules?.forEach((imp: any) => walkModule(imp));\n };\n walkModule(pageModule);\n return cssFiles;\n}\n\nexport function collectManifestClientFiles({\n manifest,\n root,\n pagePath,\n preserveModulesRoot,\n moduleBase,\n onCss,\n onClientModule,\n testClient = DEFAULT_CONFIG.AUTO_DISCOVER.clientComponents,\n testJson = DEFAULT_CONFIG.AUTO_DISCOVER.jsonPattern,\n}: {\n manifest: Manifest;\n root: string;\n pagePath: string;\n preserveModulesRoot?: boolean;\n moduleBase?: string;\n onCss?: (path: string, parentUrl: string) => void;\n onClientModule?: (path: string, parentUrl: string) => void;\n parentUrl?: string;\n testClient?: (id: string) => boolean;\n testJson?: (id: string) => boolean;\n}) {\n const normalizer = createInputNormalizer({\n root,\n removeExtension: true,\n preserveModulesRoot: preserveModulesRoot ? moduleBase : undefined,\n });\n const [_, value] = normalizer(pagePath);\n\n const cssFiles = new Map<string, string>();\n const clientFiles = new Map<string, string>();\n const seen = new Set<string>();\n const manifestValues = Object.values(manifest);\n\n // Try different variations of the path\n const possibleKeys = [\n value, // Relative path\n ];\n\n const walkManifestEntry = (id: string, parentUrl: string) => {\n if (seen.has(id)) return;\n seen.add(id);\n\n // Get the manifest entry\n const entry = manifest[id] ?? manifestValues.find((e) => id === e.file);\n if (!entry) {\n const hasKey = Object.keys(manifest).find((key) => id === key);\n if (hasKey) {\n console.log(\n `Manifest entry found for ${id}, but it is ${typeof entry}`\n );\n return;\n } else {\n console.log(\n `No manifest entry found for ${id}, possible keys: ${Object.keys(\n manifest\n ).join(\", \")}`\n );\n }\n return;\n }\n if (\n (typeof testClient === \"function\" &&\n typeof onClientModule === \"function\" &&\n testClient(entry.file)) ||\n (typeof testJson === \"function\" && testJson(entry.file))\n ) {\n onClientModule?.(entry.file ?? \"\", parentUrl);\n clientFiles.set(id, entry.name ?? \"\");\n }\n\n // Add direct CSS from the css array\n if (entry.css) {\n entry.css.forEach((css: string) => {\n cssFiles.set(css, css);\n onCss?.(css, id);\n onClientModule?.(css, id);\n });\n }\n\n // Walk imports recursively\n if (entry.imports) {\n entry.imports.forEach((imp: string) =>\n walkManifestEntry(imp, entry.file)\n );\n }\n\n // Also check dynamicImports\n if (entry.dynamicImports) {\n entry.dynamicImports.forEach((imp: string) =>\n walkManifestEntry(imp, entry.file)\n );\n }\n };\n\n // Try all possible keys\n for (const possibleKey of possibleKeys) {\n if (manifest[possibleKey]) {\n walkManifestEntry(possibleKey, pagePath);\n break;\n }\n }\n\n // If no entry found by key, try matching by file\n if (cssFiles.size === 0) {\n const entry = manifestValues.find(\n (e) =>\n possibleKeys.includes(e.file) ||\n (e.src && possibleKeys.includes(e.src)) ||\n (e.name && possibleKeys.includes(e.name))\n );\n if (entry) {\n walkManifestEntry(value, pagePath);\n } else {\n const hasKey = Object.keys(manifest).find((key) => value === key);\n if (hasKey) {\n console.warn(\n `Manifest entry found for ${value}, but it is ${typeof manifest[hasKey]}`\n );\n } else {\n console.warn(\n `No manifest entry found for ${value} (tried all possible keys: ${possibleKeys.join(\n \", \"\n )} for manifest keys: ${Object.keys(manifest).join(\", \")})`\n );\n }\n }\n }\n\n return { cssFiles, clientFiles };\n}\n"],"names":[],"mappings":";;;;;;;;AAIA,eAAsB,qBAAsB,CAAA;AAAA,EAC1C,WAAA;AAAA,EACA,QAAA;AAAA,EACA,KAAA;AAAA,EACA;AACF,CAKG,EAAA;AACD,EAAA,IAAI,CAAC,QAAA,EAAiB,uBAAA,IAAI,GAAoB,EAAA;AAE9C,EAAM,MAAA,QAAA,uBAAe,GAAoB,EAAA;AACzC,EAAA,MAAM,UAAa,GAAA,MAAM,WAAY,CAAA,cAAA,CAAe,UAAU,IAAI,CAAA;AAClE,EAAA,IAAI,CAAC,UAAY,EAAA;AACf,IAAA,2BAAW,GAAoB,EAAA;AAAA;AAEjC,EAAM,MAAA,IAAA,uBAAW,GAAY,EAAA;AAC7B,EAAM,MAAA,UAAA,GAAa,CAAC,GAAa,KAAA;AAC/B,IAAA,IAAI,CAAC,GAAK,EAAA,EAAA,IAAM,KAAK,GAAI,CAAA,GAAA,CAAI,EAAE,CAAG,EAAA;AAClC,IAAK,IAAA,CAAA,GAAA,CAAI,IAAI,EAAE,CAAA;AACf,IAAA,IAAI,GAAK,EAAA,EAAA,EAAI,QAAS,CAAA,MAAM,CAAG,EAAA;AAC7B,MAAA,QAAA,CAAS,GAAI,CAAA,GAAA,EAAK,GAAK,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;AAAA,YAC7E;AAAA,WACD,uBAAuB,MAAO,CAAA,IAAA,CAAK,QAAQ,CAAE,CAAA,IAAA,CAAK,IAAI,CAAC,CAAA,CAAA;AAAA,SAC1D;AAAA;AACF;AACF;AAGF,EAAO,OAAA,EAAE,UAAU,WAAY,EAAA;AACjC;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"getWorkerPath.d.ts","sourceRoot":"","sources":["../../../plugin/config/getWorkerPath.ts"],"names":[],"mappings":"AAEA,eAAO,MAAM,aAAa,cAAe,cAAc,GAAG,cAAc,KAAG,MAE1E,CAAA"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-dir.d.ts","sourceRoot":"","sources":["../../plugin/copy-dir.ts"],"names":[],"mappings":"AAGA,wBAAsB,OAAO,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE;IACjE,MAAM,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAA;CACnC,iBAqBA"}
|
package/dist/plugin/copy-dir.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite-plugin-react-server
|
|
3
|
-
* Copyright (c) Nico Brinkkemper
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
import { readdirSync, mkdirSync, statSync, copyFileSync } from 'node:fs';
|
|
7
|
-
import { join } from 'node:path';
|
|
8
|
-
|
|
9
|
-
async function copyDir(src, dest, options) {
|
|
10
|
-
const entries = readdirSync(src);
|
|
11
|
-
mkdirSync(dest, { recursive: true });
|
|
12
|
-
for (const entry of entries) {
|
|
13
|
-
const srcPath = join(src, entry);
|
|
14
|
-
const destPath = join(dest, entry);
|
|
15
|
-
const stat = statSync(srcPath);
|
|
16
|
-
if (stat.isDirectory()) {
|
|
17
|
-
await copyDir(srcPath, destPath);
|
|
18
|
-
} else {
|
|
19
|
-
copyFileSync(srcPath, destPath);
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
export { copyDir };
|
|
25
|
-
//# sourceMappingURL=copy-dir.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"copy-dir.js","sources":["../../plugin/copy-dir.ts"],"sourcesContent":["import { copyFileSync, mkdirSync, readdirSync, statSync } from \"node:fs\";\nimport { join } from \"node:path\";\n\nexport async function copyDir(src: string, dest: string, options?: { \n filter?: (file: string) => boolean \n}) {\n const entries = readdirSync(src);\n\n mkdirSync(dest, { recursive: true });\n\n for (const entry of entries) {\n const srcPath = join(src, entry);\n const destPath = join(dest, entry);\n\n const stat = statSync(srcPath);\n \n if (options?.filter && !options.filter(srcPath)) {\n continue;\n }\n\n if (stat.isDirectory()) {\n await copyDir(srcPath, destPath, options);\n } else {\n copyFileSync(srcPath, destPath);\n }\n }\n} "],"names":[],"mappings":";;;;;;;;AAGsB,eAAA,OAAA,CAAQ,GAAa,EAAA,IAAA,EAAc,OAEtD,EAAA;AACD,EAAM,MAAA,OAAA,GAAU,YAAY,GAAG,CAAA;AAE/B,EAAA,SAAA,CAAU,IAAM,EAAA,EAAE,SAAW,EAAA,IAAA,EAAM,CAAA;AAEnC,EAAA,KAAA,MAAW,SAAS,OAAS,EAAA;AAC3B,IAAM,MAAA,OAAA,GAAU,IAAK,CAAA,GAAA,EAAK,KAAK,CAAA;AAC/B,IAAM,MAAA,QAAA,GAAW,IAAK,CAAA,IAAA,EAAM,KAAK,CAAA;AAEjC,IAAM,MAAA,IAAA,GAAO,SAAS,OAAO,CAAA;AAM7B,IAAI,IAAA,IAAA,CAAK,aAAe,EAAA;AACtB,MAAM,MAAA,OAAA,CAAQ,OAAS,EAAA,QAAiB,CAAA;AAAA,KACnC,MAAA;AACL,MAAA,YAAA,CAAa,SAAS,QAAQ,CAAA;AAAA;AAChC;AAEJ;;;;"}
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import type { InlineCssCollectorProps } from "./types.js";
|
|
3
|
-
/**
|
|
4
|
-
* A component that inlines pre-transformed CSS content.
|
|
5
|
-
* Expects cssFiles to be an array of CssContent objects with the content already loaded.
|
|
6
|
-
*/
|
|
7
|
-
export declare function InlineCssCollector({ children, cssFiles, moduleRootPath, }: InlineCssCollectorProps): React.FunctionComponentElement<{
|
|
8
|
-
children?: React.ReactNode | undefined;
|
|
9
|
-
}>;
|
|
10
|
-
//# sourceMappingURL=css-collector-inline.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"css-collector-inline.d.ts","sourceRoot":"","sources":["../../plugin/css-collector-inline.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAE1B,OAAO,KAAK,EAAG,uBAAuB,EAAE,MAAM,YAAY,CAAC;AAU3D;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,EACjC,QAAQ,EACR,QAAQ,EACR,cAAc,GACf,EAAE,uBAAuB;;GAuCzB"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite-plugin-react-server
|
|
3
|
-
* Copyright (c) Nico Brinkkemper
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
import React__default from 'react';
|
|
7
|
-
import { join } from 'node:path';
|
|
8
|
-
import { readFileSync } from 'node:fs';
|
|
9
|
-
|
|
10
|
-
function InlineCssCollector({
|
|
11
|
-
children,
|
|
12
|
-
cssFiles,
|
|
13
|
-
moduleRootPath
|
|
14
|
-
}) {
|
|
15
|
-
return React__default.createElement(
|
|
16
|
-
React__default.Fragment,
|
|
17
|
-
null,
|
|
18
|
-
cssFiles.map((file, index) => {
|
|
19
|
-
if (typeof file === "string") {
|
|
20
|
-
let filePath = file;
|
|
21
|
-
if (process.env["NODE_ENV"] === "development") {
|
|
22
|
-
return React__default.createElement("link", {
|
|
23
|
-
key: file,
|
|
24
|
-
rel: "stylesheet",
|
|
25
|
-
href: filePath
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
return React__default.createElement(
|
|
29
|
-
"style",
|
|
30
|
-
{
|
|
31
|
-
key: file,
|
|
32
|
-
type: "text/css"
|
|
33
|
-
},
|
|
34
|
-
readFileSync(join(moduleRootPath, filePath), "utf-8")
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
const { type, content, key, path } = file;
|
|
38
|
-
return React__default.createElement(
|
|
39
|
-
"style",
|
|
40
|
-
{
|
|
41
|
-
key: key ?? path ?? index,
|
|
42
|
-
type: type ?? "text/css",
|
|
43
|
-
...process.env["NODE_ENV"] === "development" && {
|
|
44
|
-
"data-vite-dev-id": join(moduleRootPath, path)
|
|
45
|
-
}
|
|
46
|
-
},
|
|
47
|
-
content
|
|
48
|
-
);
|
|
49
|
-
}),
|
|
50
|
-
children
|
|
51
|
-
);
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
export { InlineCssCollector };
|
|
55
|
-
//# sourceMappingURL=css-collector-inline.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"css-collector-inline.js","sources":["../../plugin/css-collector-inline.tsx"],"sourcesContent":["import React from \"react\";\nimport { join } from \"node:path\";\nimport type { InlineCssCollectorProps } from \"./types.js\";\nimport { readFileSync } from \"node:fs\";\n\ninterface CssContent {\n type?: string;\n content: string;\n key?: string;\n path: string;\n}\n\n/**\n * A component that inlines pre-transformed CSS content.\n * Expects cssFiles to be an array of CssContent objects with the content already loaded.\n */\nexport function InlineCssCollector({\n children,\n cssFiles,\n moduleRootPath,\n}: InlineCssCollectorProps) {\n return React.createElement(\n React.Fragment,\n null,\n cssFiles.map((file, index) => {\n if (typeof file === \"string\") {\n let filePath = file as string;\n if(process.env[\"NODE_ENV\"] === \"development\") {\n return React.createElement(\"link\", {\n key: file,\n rel: \"stylesheet\",\n href: filePath,\n });\n }\n return React.createElement(\n \"style\",\n {\n key: file,\n type: \"text/css\",\n },\n readFileSync(join(moduleRootPath, filePath), \"utf-8\")\n );\n }\n\n const { type, content, key, path } = file as CssContent;\n return React.createElement(\n \"style\",\n {\n key: key ?? path ?? index,\n type: type ?? \"text/css\",\n ...(process.env[\"NODE_ENV\"] === \"development\" && {\n \"data-vite-dev-id\": join(moduleRootPath, path),\n }),\n },\n content\n );\n }),\n children\n );\n}\n"],"names":["React"],"mappings":";;;;;;;;;AAgBO,SAAS,kBAAmB,CAAA;AAAA,EACjC,QAAA;AAAA,EACA,QAAA;AAAA,EACA;AACF,CAA4B,EAAA;AAC1B,EAAA,OAAOA,cAAM,CAAA,aAAA;AAAA,IACXA,cAAM,CAAA,QAAA;AAAA,IACN,IAAA;AAAA,IACA,QAAS,CAAA,GAAA,CAAI,CAAC,IAAA,EAAM,KAAU,KAAA;AAC5B,MAAI,IAAA,OAAO,SAAS,QAAU,EAAA;AAC5B,QAAA,IAAI,QAAW,GAAA,IAAA;AACf,QAAA,IAAG,OAAQ,CAAA,GAAA,CAAI,UAAU,CAAA,KAAM,aAAe,EAAA;AAC5C,UAAO,OAAAA,cAAA,CAAM,cAAc,MAAQ,EAAA;AAAA,YACjC,GAAK,EAAA,IAAA;AAAA,YACL,GAAK,EAAA,YAAA;AAAA,YACL,IAAM,EAAA;AAAA,WACP,CAAA;AAAA;AAEH,QAAA,OAAOA,cAAM,CAAA,aAAA;AAAA,UACX,OAAA;AAAA,UACA;AAAA,YACE,GAAK,EAAA,IAAA;AAAA,YACL,IAAM,EAAA;AAAA,WACR;AAAA,UACA,YAAa,CAAA,IAAA,CAAK,cAAgB,EAAA,QAAQ,GAAG,OAAO;AAAA,SACtD;AAAA;AAGF,MAAA,MAAM,EAAE,IAAA,EAAM,OAAS,EAAA,GAAA,EAAK,MAAS,GAAA,IAAA;AACrC,MAAA,OAAOA,cAAM,CAAA,aAAA;AAAA,QACX,OAAA;AAAA,QACA;AAAA,UACE,GAAA,EAAK,OAAO,IAAQ,IAAA,KAAA;AAAA,UACpB,MAAM,IAAQ,IAAA,UAAA;AAAA,UACd,GAAI,OAAA,CAAQ,GAAI,CAAA,UAAU,MAAM,aAAiB,IAAA;AAAA,YAC/C,kBAAA,EAAoB,IAAK,CAAA,cAAA,EAAgB,IAAI;AAAA;AAC/C,SACF;AAAA,QACA;AAAA,OACF;AAAA,KACD,CAAA;AAAA,IACD;AAAA,GACF;AACF;;;;"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { MessagePort } from 'node:worker_threads';
|
|
2
|
-
import type { LoadHookContext } from 'node:module';
|
|
3
|
-
type LoaderContext = {
|
|
4
|
-
data?: {
|
|
5
|
-
port: MessagePort;
|
|
6
|
-
};
|
|
7
|
-
};
|
|
8
|
-
export declare function initialize(data: {
|
|
9
|
-
port: MessagePort;
|
|
10
|
-
}): Promise<void>;
|
|
11
|
-
export declare function setCurrentPage(page: string | null): void;
|
|
12
|
-
export declare function getCssFilesForPage(page: string): string[];
|
|
13
|
-
export declare function load(url: string, context: LoadHookContext & LoaderContext, defaultLoad: any): Promise<any>;
|
|
14
|
-
export declare function resolve(specifier: string, context: any, defaultResolve: any): any;
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=css-loader.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"css-loader.d.ts","sourceRoot":"","sources":["../../../plugin/loader/css-loader.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,aAAa,CAAC;AAEnD,KAAK,aAAa,GAAG;IACnB,IAAI,CAAC,EAAE;QAAE,IAAI,EAAE,WAAW,CAAA;KAAE,CAAC;CAC9B,CAAC;AAKF,wBAAsB,UAAU,CAAC,IAAI,EAAE;IAAE,IAAI,EAAE,WAAW,CAAA;CAAE,iBAI3D;AAKD,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,QAIjD;AAED,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,EAAE,CAEzD;AAGD,wBAAsB,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,eAAe,GAAG,aAAa,EAAE,WAAW,EAAE,GAAG,gBAqDjG;AAED,wBAAgB,OAAO,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,GAAG,EAAE,cAAc,EAAE,GAAG,OAE3E"}
|
|
@@ -1,70 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* vite-plugin-react-server
|
|
3
|
-
* Copyright (c) Nico Brinkkemper
|
|
4
|
-
* MIT License
|
|
5
|
-
*/
|
|
6
|
-
import { readFile } from 'fs/promises';
|
|
7
|
-
import { basename } from 'path';
|
|
8
|
-
import postcss from 'postcss';
|
|
9
|
-
|
|
10
|
-
let cssLoaderPort;
|
|
11
|
-
async function initialize(data) {
|
|
12
|
-
cssLoaderPort = data.port;
|
|
13
|
-
data.port.postMessage({ type: "INITIALIZED" });
|
|
14
|
-
data.port.unref();
|
|
15
|
-
}
|
|
16
|
-
const cssFilesByPage = /* @__PURE__ */ new Map();
|
|
17
|
-
function setCurrentPage(page) {
|
|
18
|
-
if (page && !cssFilesByPage.has(page)) {
|
|
19
|
-
cssFilesByPage.set(page, /* @__PURE__ */ new Set());
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function getCssFilesForPage(page) {
|
|
23
|
-
return Array.from(cssFilesByPage.get(page) || []);
|
|
24
|
-
}
|
|
25
|
-
async function load(url, context, defaultLoad) {
|
|
26
|
-
if (url.endsWith(".css")) {
|
|
27
|
-
const source = await readFile(new URL(url), "utf-8");
|
|
28
|
-
const result = await postcss().process(source, {
|
|
29
|
-
from: url,
|
|
30
|
-
to: url,
|
|
31
|
-
map: {
|
|
32
|
-
inline: false,
|
|
33
|
-
annotation: false
|
|
34
|
-
}
|
|
35
|
-
});
|
|
36
|
-
const moduleName = basename(url, ".css").replace(".", "_");
|
|
37
|
-
const classes = {};
|
|
38
|
-
result.root.walkRules((rule) => {
|
|
39
|
-
const selector = rule.selector.replace(".", "");
|
|
40
|
-
const className = `${moduleName}_${selector}`;
|
|
41
|
-
classes[selector] = className;
|
|
42
|
-
rule.selector = `.${className}`;
|
|
43
|
-
});
|
|
44
|
-
const transformedCss = result.root.toString();
|
|
45
|
-
if (cssLoaderPort) {
|
|
46
|
-
cssLoaderPort.postMessage({
|
|
47
|
-
type: "CSS_FILE",
|
|
48
|
-
id: url,
|
|
49
|
-
cssFile: transformedCss
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
const moduleSource = `
|
|
53
|
-
const styles = ${JSON.stringify(classes)};
|
|
54
|
-
export default styles;
|
|
55
|
-
export const css = ${JSON.stringify(transformedCss)};
|
|
56
|
-
`;
|
|
57
|
-
return {
|
|
58
|
-
format: "module",
|
|
59
|
-
source: moduleSource,
|
|
60
|
-
shortCircuit: true
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
return defaultLoad(url, context, defaultLoad);
|
|
64
|
-
}
|
|
65
|
-
function resolve(specifier, context, defaultResolve) {
|
|
66
|
-
return defaultResolve(specifier, context, defaultResolve);
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
export { getCssFilesForPage, initialize, load, resolve, setCurrentPage };
|
|
70
|
-
//# sourceMappingURL=css-loader.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"css-loader.js","sources":["../../../plugin/loader/css-loader.ts"],"sourcesContent":["import { readFile } from 'fs/promises';\nimport { basename } from 'path';\nimport postcss from 'postcss';\nimport type { MessagePort } from 'node:worker_threads';\nimport type { CssFileMessage } from '../worker/types.js';\nimport type { LoadHookContext } from 'node:module';\n\ntype LoaderContext = {\n data?: { port: MessagePort };\n};\n// Store port globally for CSS loader\nlet cssLoaderPort: MessagePort | undefined;\n\n// Initialize hook\nexport async function initialize(data: { port: MessagePort }) {\n cssLoaderPort = data.port; // Store port\n data.port.postMessage({ type: 'INITIALIZED' });\n data.port.unref();\n}\n\n// CSS file tracking per page\nconst cssFilesByPage = new Map<string, Set<string>>();\n\nexport function setCurrentPage(page: string | null) {\n if (page && !cssFilesByPage.has(page)) {\n cssFilesByPage.set(page, new Set());\n }\n}\n\nexport function getCssFilesForPage(page: string): string[] {\n return Array.from(cssFilesByPage.get(page) || []);\n}\n\n// Modify the CSS handling in the load function\nexport async function load(url: string, context: LoadHookContext & LoaderContext, defaultLoad: any) {\n // Handle CSS files\n if(url.endsWith(\".css\")) {\n const source = await readFile(new URL(url), 'utf-8');\n \n // Process CSS with PostCSS\n const result = await postcss().process(source, {\n from: url,\n to: url,\n map: {\n inline: false,\n annotation: false\n }\n });\n\n // Generate both transformed CSS and class mappings\n const moduleName = basename(url, '.css').replace('.', '_');\n const classes: Record<string, string> = {};\n\n // Transform selectors\n result.root.walkRules(rule => {\n const selector = rule.selector.replace('.', '');\n const className = `${moduleName}_${selector}`;\n classes[selector] = className;\n rule.selector = `.${className}`;\n });\n\n // Get transformed CSS using root.toString()\n const transformedCss = result.root.toString();\n\n // Send processed CSS to worker\n if (cssLoaderPort) {\n cssLoaderPort.postMessage({\n type: 'CSS_FILE',\n id: url,\n cssFile: transformedCss\n } satisfies CssFileMessage);\n }\n \n // Return CSS module\n const moduleSource = `\n const styles = ${JSON.stringify(classes)};\n export default styles;\n export const css = ${JSON.stringify(transformedCss)};\n `;\n\n return {\n format: 'module',\n source: moduleSource,\n shortCircuit: true\n };\n }\n return defaultLoad(url, context, defaultLoad);\n}\n\nexport function resolve(specifier: string, context: any, defaultResolve: any) {\n return defaultResolve(specifier, context, defaultResolve);\n}\n\n\n"],"names":[],"mappings":";;;;;;;;;AAWA,IAAI,aAAA;AAGJ,eAAsB,WAAW,IAA6B,EAAA;AAC5D,EAAA,aAAA,GAAgB,IAAK,CAAA,IAAA;AACrB,EAAA,IAAA,CAAK,IAAK,CAAA,WAAA,CAAY,EAAE,IAAA,EAAM,eAAe,CAAA;AAC7C,EAAA,IAAA,CAA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AAI,GAAA,SAAA;AACpB,MAAK,IAAA,CAAA,QAAA,GAAW,IAAI,SAAS,CAAA,CAAA;AAAA,KAC9B,CAAA;AAGD,IAAM,MAAA,cAAA,GAAiB,MAAO,CAAA,IAAA,CAAK,QAAS,EAAA;AAG5C,IAAA,IAAI,aAAe,EAAA;AACjB,MAAA,aAAA,CAAc,WAAY,CAAA;AAAA,QACxB,IAAM,EAAA,UAAA;AAAA,QACN,EAAI,EAAA,GAAA;AAAA,QACJ,OAAS,EAAA;AAAA,OACe,CAAA;AAAA;AAI5B,IAAA,MAAM,YAAe,GAAA;AAAA,qBACF,EAAA,IAAA,CAAK,SAAU,CAAA,OAAO,CAAC,CAAA;AAAA;AAAA,yBAEnB,EAAA,IAAA,CAAK,SAAU,CAAA,cAAc,CAAC,CAAA;AAAA,IAAA,CAAA;AAGrD,IAAO,OAAA;AAAA,MACL,MAAQ,EAAA,QAAA;AAAA,MACR,MAAQ,EAAA,YAAA;AAAA,MACR,YAAc,EAAA;AAAA,KAChB;AAAA;AAEF,EAAO,OAAA,WAAA,CAAY,GAAK,EAAA,OAAA,EAAS,WAAW,CAAA;AAC9C;AAEgB,SAAA,OAAA,CAAQ,SAAmB,EAAA,OAAA,EAAc,cAAqB,EAAA;AAC5E,EAAO,OAAA,cAAA,CAAe,SAAW,EAAA,OAAA,EAAS,cAAc,CAAA;AAC1D;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../plugin/react-client/index.ts"],"sourcesContent":["import { reactPreservePlugin } from \"../plugin.js\";\nimport { reactTransformPlugin } from \"../transformer/plugin.js\";\nimport type { StreamPluginOptions } from \"../types.js\";\nimport { reactClientPlugin } from \"./plugin.js\";\n\nexport function vitePluginReactClient(options = {} as StreamPluginOptions): import(\"vite\").Plugin[] {\n return [\n reactClientPlugin(options),\n reactTransformPlugin(options),\n reactPreservePlugin(options),\n ];\n } "],"names":[],"mappings":";;;;;;;;;AAKgB,SAAA,qBAAA,CAAsB,OAAU,GAAA,EAAoD,EAAA;AAChG,EAAO,OAAA;AAAA,IACL,kBAAkB,OAAO,CAAA;AAAA,IACzB,qBAAqB,OAAO,CAAA;AAAA,IAC5B,oBAA2B;AAAA,GAC7B;AACF;;;;"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":["../../../plugin/react-server/index.ts"],"sourcesContent":["import { reactPreservePlugin } from \"../preserver/plugin.js\";\nimport { reactStaticPlugin } from \"../react-static/plugin.js\";\nimport { reactTransformPlugin } from \"../transformer/plugin.js\";\nimport type { StreamPluginOptions } from \"../types.js\";\nimport { reactServerPlugin } from \"./plugin.js\";\n\nexport function vitePluginReactServer(options = {} as StreamPluginOptions): import(\"vite\").Plugin[] {\n return [\n reactTransformPlugin(options),\n reactServerPlugin(options),\n reactStaticPlugin(options),\n reactPreservePlugin(options),\n ];\n } "],"names":[],"mappings":";;;;;;;;;;AAMgB,SAAA,qBAAA,CAAsB,OAAU,GAAA,EAAoD,EAAA;AAChG,EAAO,OAAA;AAAA,IACL,qBAAqB,OAAO,CAAA;AAAA,IAC5B,kBAAkB,OAAO,CAAA;AAAA,IACzB,kBAAkB,OAAO,CAAA;AAAA,IACzB,oBAA2B;AAAA,GAC7B;AACF;;;;"}
|
|
@@ -1,26 +0,0 @@
|
|
|
1
|
-
import type { Worker } from "node:worker_threads";
|
|
2
|
-
import type { CheckFilesExistReturn, CreateHandlerOptions, PageData } from "../../types.js";
|
|
3
|
-
import { type Manifest, type IndexHtmlTransformHook } from "vite";
|
|
4
|
-
type RenderPagesOptions<T = any> = Omit<CreateHandlerOptions<T>, "url" | "route" | "getCss" | "propsPath" | "pagePath"> & {
|
|
5
|
-
clientManifest: Manifest;
|
|
6
|
-
serverManifest: Manifest;
|
|
7
|
-
worker: Worker;
|
|
8
|
-
loader: (id: string) => Promise<Record<string, any>>;
|
|
9
|
-
onCssFile?: (url: string, parentUrl: string) => void;
|
|
10
|
-
onClientJSFile?: (url: string, parentUrl: string) => void;
|
|
11
|
-
onPage?: (pageData: PageData) => Promise<void>;
|
|
12
|
-
clientCss?: string[];
|
|
13
|
-
transformIndexHtml: IndexHtmlTransformHook;
|
|
14
|
-
outDir: string;
|
|
15
|
-
htmlOutputPath: string;
|
|
16
|
-
server?: any;
|
|
17
|
-
bundle?: any;
|
|
18
|
-
chunk?: any;
|
|
19
|
-
originalUrl?: string;
|
|
20
|
-
};
|
|
21
|
-
export declare function renderPages<T = any>(routes: string[], files: CheckFilesExistReturn, options: RenderPagesOptions<T>): Promise<{
|
|
22
|
-
failedRoutes: Map<string, Error>;
|
|
23
|
-
completedRoutes: Set<string>;
|
|
24
|
-
}>;
|
|
25
|
-
export {};
|
|
26
|
-
//# sourceMappingURL=renderPages.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"renderPages.d.ts","sourceRoot":"","sources":["../../../../plugin/worker/html/renderPages.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,qBAAqB,CAAC;AAElD,OAAO,KAAK,EACV,qBAAqB,EACrB,oBAAoB,EACpB,QAAQ,EACT,MAAM,gBAAgB,CAAC;AAExB,OAAO,EAAE,KAAK,QAAQ,EAAE,KAAK,sBAAsB,EAAgB,MAAM,MAAM,CAAC;AAIhF,KAAK,kBAAkB,CAAC,CAAC,GAAG,GAAG,IAAI,IAAI,CAAC,oBAAoB,CAAC,CAAC,CAAC,EAAE,KAAK,GAAG,OAAO,GAAG,QAAQ,GAAG,WAAW,GAAG,UAAU,CAAC,GAAG;IACxH,cAAc,EAAE,QAAQ,CAAC;IACzB,cAAc,EAAE,QAAQ,CAAC;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,CAAC;IACrD,SAAS,CAAC,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SA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