vite-plugin-react-server 1.1.12 → 1.1.13
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/dist/package.json +10 -8
- package/dist/plugin/components/css-collector-elements.d.ts +4 -2
- package/dist/plugin/components/css-collector-elements.d.ts.map +1 -1
- package/dist/plugin/components/css-collector-elements.js +21 -7
- package/dist/plugin/components/css-collector-elements.js.map +1 -1
- package/dist/plugin/components/css-collector.d.ts +4 -5
- package/dist/plugin/components/css-collector.d.ts.map +1 -1
- package/dist/plugin/components/css-collector.js +5 -9
- package/dist/plugin/components/css-collector.js.map +1 -1
- package/dist/plugin/components/html.d.ts +1 -1
- package/dist/plugin/components/html.d.ts.map +1 -1
- package/dist/plugin/components/html.js +14 -3
- package/dist/plugin/components/html.js.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts +4 -4
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.d.ts.map +1 -1
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js +14 -9
- package/dist/plugin/config/autoDiscover/resolveAutoDiscover.js.map +1 -1
- package/dist/plugin/config/defaults.d.ts +66 -12
- package/dist/plugin/config/defaults.d.ts.map +1 -1
- package/dist/plugin/config/defaults.js +69 -15
- package/dist/plugin/config/defaults.js.map +1 -1
- package/dist/plugin/config/resolveAutoDiscoverMatcher.d.ts +5 -0
- package/dist/plugin/config/resolveAutoDiscoverMatcher.d.ts.map +1 -0
- package/dist/plugin/config/resolveAutoDiscoverMatcher.js +25 -0
- package/dist/plugin/config/resolveAutoDiscoverMatcher.js.map +1 -0
- package/dist/plugin/config/resolveEnv.d.ts.map +1 -1
- package/dist/plugin/config/resolveEnv.js +16 -5
- package/dist/plugin/config/resolveEnv.js.map +1 -1
- package/dist/plugin/config/resolveOptions.d.ts +3 -3
- package/dist/plugin/config/resolveOptions.d.ts.map +1 -1
- package/dist/plugin/config/resolveOptions.js +59 -87
- package/dist/plugin/config/resolveOptions.js.map +1 -1
- package/dist/plugin/config/resolveUserConfig.d.ts +4 -4
- package/dist/plugin/config/resolveUserConfig.d.ts.map +1 -1
- package/dist/plugin/config/resolveUserConfig.js +8 -1
- package/dist/plugin/config/resolveUserConfig.js.map +1 -1
- package/dist/plugin/error/toError.d.ts +3 -0
- package/dist/plugin/error/toError.d.ts.map +1 -1
- package/dist/plugin/error/toError.js +33 -4
- package/dist/plugin/error/toError.js.map +1 -1
- package/dist/plugin/helpers/cleanObject.d.ts.map +1 -1
- package/dist/plugin/helpers/cleanObject.js +19 -5
- package/dist/plugin/helpers/cleanObject.js.map +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts +3 -3
- package/dist/plugin/helpers/collectViteModuleGraphCss.d.ts.map +1 -1
- package/dist/plugin/helpers/collectViteModuleGraphCss.js.map +1 -1
- package/dist/plugin/helpers/createCssProps.d.ts +4 -3
- package/dist/plugin/helpers/createCssProps.d.ts.map +1 -1
- package/dist/plugin/helpers/createCssProps.js +7 -2
- package/dist/plugin/helpers/createCssProps.js.map +1 -1
- package/dist/plugin/helpers/createHandler.d.ts +4 -3
- package/dist/plugin/helpers/createHandler.d.ts.map +1 -1
- package/dist/plugin/helpers/createHandler.js +1 -1
- package/dist/plugin/helpers/createHandler.js.map +1 -1
- package/dist/plugin/helpers/createRscStream.d.ts +2 -2
- package/dist/plugin/helpers/createRscStream.d.ts.map +1 -1
- package/dist/plugin/helpers/createRscStream.js +15 -5
- package/dist/plugin/helpers/createRscStream.js.map +1 -1
- package/dist/plugin/helpers/index.d.ts +2 -2
- package/dist/plugin/helpers/index.d.ts.map +1 -1
- package/dist/plugin/helpers/index.js +2 -2
- package/dist/plugin/helpers/inputNormalizer.d.ts.map +1 -1
- package/dist/plugin/helpers/inputNormalizer.js +4 -1
- package/dist/plugin/helpers/inputNormalizer.js.map +1 -1
- package/dist/plugin/helpers/moduleResolver.d.ts +3 -0
- package/dist/plugin/helpers/moduleResolver.d.ts.map +1 -0
- package/dist/plugin/helpers/moduleResolver.js +25 -0
- package/dist/plugin/helpers/requestInfo.d.ts +18 -3
- package/dist/plugin/helpers/requestInfo.d.ts.map +1 -1
- package/dist/plugin/helpers/requestInfo.js +75 -11
- package/dist/plugin/helpers/requestInfo.js.map +1 -1
- package/dist/plugin/helpers/resolvePage.d.ts.map +1 -1
- package/dist/plugin/helpers/resolvePage.js +2 -3
- package/dist/plugin/helpers/resolvePage.js.map +1 -1
- package/dist/plugin/helpers/resolvePageAndProps.d.ts +4 -3
- package/dist/plugin/helpers/resolvePageAndProps.d.ts.map +1 -1
- package/dist/plugin/helpers/resolvePageAndProps.js.map +1 -1
- package/dist/plugin/helpers/serializeUserOptions.d.ts +3 -2
- package/dist/plugin/helpers/serializeUserOptions.d.ts.map +1 -1
- package/dist/plugin/helpers/serializeUserOptions.js +13 -1
- package/dist/plugin/helpers/serializeUserOptions.js.map +1 -1
- package/dist/plugin/helpers/sourceMap.d.ts +8 -0
- package/dist/plugin/helpers/sourceMap.d.ts.map +1 -0
- package/dist/plugin/helpers/sourceMap.js +136 -0
- package/dist/plugin/helpers.js +1 -1
- package/dist/plugin/loader/createBuildLoader.d.ts +7 -22
- package/dist/plugin/loader/createBuildLoader.d.ts.map +1 -1
- package/dist/plugin/loader/createBuildLoader.js +79 -65
- package/dist/plugin/loader/createBuildLoader.js.map +1 -1
- package/dist/plugin/loader/createDefaultLoader.d.ts +13 -0
- package/dist/plugin/loader/createDefaultLoader.d.ts.map +1 -0
- package/dist/plugin/loader/createDefaultLoader.js +47 -0
- package/dist/plugin/loader/css-loader.development.d.ts +1 -0
- package/dist/plugin/loader/css-loader.development.d.ts.map +1 -1
- package/dist/plugin/loader/css-loader.development.js +1 -1
- package/dist/plugin/loader/css-loader.development.js.map +1 -1
- package/dist/plugin/loader/handleExports.d.ts +33 -0
- package/dist/plugin/loader/handleExports.d.ts.map +1 -0
- package/dist/plugin/loader/handleExports.js +174 -0
- package/dist/plugin/loader/handleExports.js.map +1 -0
- package/dist/plugin/loader/index.d.ts +1 -1
- package/dist/plugin/loader/index.d.ts.map +1 -1
- package/dist/plugin/loader/index.js +4 -1
- package/dist/plugin/loader/parse.d.ts +6 -0
- package/dist/plugin/loader/parse.d.ts.map +1 -0
- package/dist/plugin/loader/parse.js +23 -0
- package/dist/plugin/loader/parse.js.map +1 -0
- package/dist/plugin/loader/react-loader.client.d.ts +2 -0
- package/dist/plugin/loader/react-loader.client.d.ts.map +1 -0
- package/dist/plugin/loader/react-loader.client.js +2 -0
- package/dist/plugin/loader/react-loader.d.ts +1 -12
- package/dist/plugin/loader/react-loader.d.ts.map +1 -1
- package/dist/plugin/loader/react-loader.js +5 -687
- package/dist/plugin/loader/react-loader.js.map +1 -1
- package/dist/plugin/loader/react-loader.server.d.ts +21 -0
- package/dist/plugin/loader/react-loader.server.d.ts.map +1 -0
- package/dist/plugin/loader/react-loader.server.js +69 -0
- package/dist/plugin/loader/sourceMap.d.ts +35 -0
- package/dist/plugin/loader/sourceMap.d.ts.map +1 -0
- package/dist/plugin/loader/sourceMap.js +105 -0
- package/dist/plugin/loader/temporaryReferences.d.ts +1 -1
- package/dist/plugin/loader/temporaryReferences.d.ts.map +1 -1
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts +2 -0
- package/dist/plugin/loader/transformModuleIfNeeded.d.ts.map +1 -0
- package/dist/plugin/loader/transformModuleIfNeeded.js +27 -0
- package/dist/plugin/loader/transformModuleIfNeeded.js.map +1 -0
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.d.ts +27 -0
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.d.ts.map +1 -0
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.js +52 -0
- package/dist/plugin/loader/transformModuleWithPreservedFunctions.js.map +1 -0
- package/dist/plugin/loader/types.d.ts +8 -0
- package/dist/plugin/loader/types.d.ts.map +1 -0
- package/dist/plugin/loader/types.js +1 -0
- package/dist/plugin/plugin.client.d.ts +2 -2
- package/dist/plugin/plugin.client.d.ts.map +1 -1
- package/dist/plugin/plugin.client.js +2 -3
- package/dist/plugin/plugin.client.js.map +1 -1
- package/dist/plugin/plugin.server.d.ts +2 -2
- package/dist/plugin/plugin.server.d.ts.map +1 -1
- package/dist/plugin/plugin.server.js +2 -2
- package/dist/plugin/plugin.server.js.map +1 -1
- package/dist/plugin/preserver/plugin.d.ts +2 -2
- package/dist/plugin/preserver/plugin.d.ts.map +1 -1
- package/dist/plugin/preserver/plugin.js +6 -2
- package/dist/plugin/preserver/plugin.js.map +1 -1
- package/dist/plugin/react-client/{server.d.ts → configureWorkerRequestHandler.d.ts} +4 -4
- package/dist/plugin/react-client/configureWorkerRequestHandler.d.ts.map +1 -0
- package/dist/plugin/react-client/{server.js → configureWorkerRequestHandler.js} +11 -8
- package/dist/plugin/react-client/configureWorkerRequestHandler.js.map +1 -0
- package/dist/plugin/react-client/createMessageHandlers.d.ts +1 -1
- package/dist/plugin/react-client/createMessageHandlers.d.ts.map +1 -1
- package/dist/plugin/react-client/createMessageHandlers.js +18 -11
- package/dist/plugin/react-client/createMessageHandlers.js.map +1 -1
- package/dist/plugin/react-client/createWorkerStream.d.ts +5 -3
- package/dist/plugin/react-client/createWorkerStream.d.ts.map +1 -1
- package/dist/plugin/react-client/createWorkerStream.js +61 -27
- package/dist/plugin/react-client/createWorkerStream.js.map +1 -1
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts +1 -1
- package/dist/plugin/react-client/handleWorkerRscStream.d.ts.map +1 -1
- package/dist/plugin/react-client/handleWorkerRscStream.js +14 -4
- package/dist/plugin/react-client/handleWorkerRscStream.js.map +1 -1
- package/dist/plugin/react-client/plugin.d.ts +2 -2
- package/dist/plugin/react-client/plugin.d.ts.map +1 -1
- package/dist/plugin/react-client/plugin.js +7 -8
- package/dist/plugin/react-client/plugin.js.map +1 -1
- package/dist/plugin/react-client/restartWorker.d.ts +1 -1
- package/dist/plugin/react-client/restartWorker.d.ts.map +1 -1
- package/dist/plugin/react-client/restartWorker.js +9 -3
- package/dist/plugin/react-client/restartWorker.js.map +1 -1
- package/dist/plugin/react-server/configureReactServer.d.ts +9 -0
- package/dist/plugin/react-server/configureReactServer.d.ts.map +1 -0
- package/dist/plugin/react-server/{server.js → configureReactServer.js} +26 -8
- package/dist/plugin/react-server/configureReactServer.js.map +1 -0
- package/dist/plugin/react-server/handleServerAction.d.ts +5 -0
- package/dist/plugin/react-server/handleServerAction.d.ts.map +1 -0
- package/dist/plugin/react-server/handleServerAction.js +145 -0
- package/dist/plugin/react-server/handleServerAction.js.map +1 -0
- package/dist/plugin/react-server/plugin.d.ts +2 -2
- package/dist/plugin/react-server/plugin.d.ts.map +1 -1
- package/dist/plugin/react-server/plugin.js +1 -1
- package/dist/plugin/react-server/plugin.js.map +1 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts +2 -2
- package/dist/plugin/react-static/collectHtmlWorkerContent.d.ts.map +1 -1
- package/dist/plugin/react-static/collectHtmlWorkerContent.js.map +1 -1
- package/dist/plugin/react-static/collectRscContent.d.ts +2 -2
- package/dist/plugin/react-static/collectRscContent.d.ts.map +1 -1
- package/dist/plugin/react-static/collectRscContent.js.map +1 -1
- package/dist/plugin/react-static/configurePreviewServer.d.ts +3 -3
- package/dist/plugin/react-static/configurePreviewServer.d.ts.map +1 -1
- package/dist/plugin/react-static/configurePreviewServer.js +18 -7
- package/dist/plugin/react-static/configurePreviewServer.js.map +1 -1
- package/dist/plugin/react-static/plugin.d.ts +2 -2
- package/dist/plugin/react-static/plugin.d.ts.map +1 -1
- package/dist/plugin/react-static/plugin.js +28 -12
- package/dist/plugin/react-static/plugin.js.map +1 -1
- package/dist/plugin/react-static/renderPage.d.ts +2 -2
- package/dist/plugin/react-static/renderPage.d.ts.map +1 -1
- package/dist/plugin/react-static/renderPage.js.map +1 -1
- package/dist/plugin/react-static/renderPages.d.ts +2 -2
- package/dist/plugin/react-static/renderPages.d.ts.map +1 -1
- package/dist/plugin/react-static/renderPages.js.map +1 -1
- package/dist/plugin/react-static/renderStreams.d.ts +2 -2
- package/dist/plugin/react-static/renderStreams.d.ts.map +1 -1
- package/dist/plugin/react-static/renderStreams.js +4 -4
- package/dist/plugin/react-static/renderStreams.js.map +1 -1
- package/dist/plugin/source-map/createMappingsSerializer.d.ts +2 -0
- package/dist/plugin/source-map/createMappingsSerializer.d.ts.map +1 -0
- package/dist/plugin/source-map/createMappingsSerializer.js +159 -0
- package/dist/plugin/source-map/readMappings.d.ts +2 -0
- package/dist/plugin/source-map/readMappings.d.ts.map +1 -0
- package/dist/plugin/source-map/readMappings.js +201 -0
- package/dist/plugin/transformer/index.d.ts +0 -1
- package/dist/plugin/transformer/index.d.ts.map +1 -1
- package/dist/plugin/transformer/index.js +0 -1
- package/dist/plugin/transformer/plugin.client.d.ts +1 -3
- package/dist/plugin/transformer/plugin.client.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.client.js +1 -84
- package/dist/plugin/transformer/plugin.server.d.ts +2 -2
- package/dist/plugin/transformer/plugin.server.d.ts.map +1 -1
- package/dist/plugin/transformer/plugin.server.js +52 -20
- package/dist/plugin/transformer/plugin.server.js.map +1 -1
- package/dist/plugin/types.d.ts +89 -119
- package/dist/plugin/types.d.ts.map +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/createCallServer.d.ts +1 -1
- package/dist/plugin/utils/createCallServer.d.ts.map +1 -1
- package/dist/plugin/utils/createCallServer.js +13 -4
- package/dist/plugin/utils/createCallServer.js.map +1 -1
- package/dist/plugin/utils/index.d.ts +1 -0
- package/dist/plugin/utils/index.d.ts.map +1 -1
- package/dist/plugin/utils/index.js +1 -0
- package/dist/plugin/utils.js +1 -0
- package/dist/plugin/utils.js.map +1 -1
- package/dist/plugin/vendor/vendor.client.d.ts +2 -1
- package/dist/plugin/vendor/vendor.client.d.ts.map +1 -1
- package/dist/plugin/vendor/vendor.client.js +2 -1
- package/dist/plugin/vendor/vendor.client.js.map +1 -1
- package/dist/plugin/vendor/vendor.server.d.ts.map +1 -1
- package/dist/plugin/vendor/vendor.server.js +1 -1
- package/dist/plugin/vendor/vendor.server.js.map +1 -1
- package/dist/plugin/worker/createWorker.d.ts.map +1 -1
- package/dist/plugin/worker/createWorker.js +17 -22
- package/dist/plugin/worker/createWorker.js.map +1 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.d.ts.map +1 -1
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js +25 -4
- package/dist/plugin/worker/html/createHtmlWorkerRenderState.js.map +1 -1
- package/dist/plugin/worker/html/html-worker.development.js +15 -13
- package/dist/plugin/worker/html/html-worker.development.js.map +1 -1
- package/dist/plugin/worker/html/html-worker.production.js +2 -12
- package/dist/plugin/worker/html/html-worker.production.js.map +1 -1
- package/dist/plugin/worker/html/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/html/messageHandler.js +2 -2
- package/dist/plugin/worker/html/messageHandler.js.map +1 -1
- package/dist/plugin/worker/rsc/handleRender.d.ts +2 -1
- package/dist/plugin/worker/rsc/handleRender.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/handleRender.js +8 -8
- package/dist/plugin/worker/rsc/handleRender.js.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/messageHandler.js +166 -107
- package/dist/plugin/worker/rsc/messageHandler.js.map +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.development.js +112 -52
- package/dist/plugin/worker/rsc/rsc-worker.development.js.map +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.production.js +1 -1
- package/dist/plugin/worker/rsc/rsc-worker.production.js.map +1 -1
- package/dist/plugin/worker/rsc/state.d.ts +5 -64
- package/dist/plugin/worker/rsc/state.d.ts.map +1 -1
- package/dist/plugin/worker/rsc/state.js +5 -1
- package/dist/plugin/worker/rsc/state.js.map +1 -1
- package/dist/plugin/worker/sendMessage.d.ts +2 -0
- package/dist/plugin/worker/sendMessage.d.ts.map +1 -1
- package/dist/plugin/worker/sendMessage.js +2 -1
- package/dist/plugin/worker/sendMessage.js.map +1 -1
- package/dist/plugin/worker/types.d.ts +52 -53
- package/dist/plugin/worker/types.d.ts.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +10 -8
- package/plugin/components/css-collector-elements.tsx +30 -9
- package/plugin/components/css-collector.tsx +13 -22
- package/plugin/components/html.tsx +12 -5
- package/plugin/config/autoDiscover/resolveAutoDiscover.ts +31 -13
- package/plugin/config/defaults.tsx +72 -16
- package/plugin/config/resolveAutoDiscoverMatcher.ts +23 -0
- package/plugin/config/resolveEnv.ts +20 -12
- package/plugin/config/resolveOptions.ts +152 -155
- package/plugin/config/resolveUserConfig.ts +20 -5
- package/plugin/error/toError.ts +35 -1
- package/plugin/helpers/cleanObject.ts +79 -15
- package/plugin/helpers/collectViteModuleGraphCss.ts +4 -3
- package/plugin/helpers/createCssProps.tsx +26 -9
- package/plugin/helpers/createHandler.ts +7 -4
- package/plugin/helpers/createRscStream.tsx +20 -14
- package/plugin/helpers/index.ts +2 -2
- package/plugin/helpers/inputNormalizer.ts +4 -2
- package/plugin/helpers/moduleResolver.ts +36 -0
- package/plugin/helpers/requestInfo.ts +117 -23
- package/plugin/helpers/resolvePage.ts +2 -3
- package/plugin/helpers/resolvePageAndProps.ts +7 -6
- package/plugin/helpers/serializeUserOptions.ts +20 -2
- package/plugin/helpers/sourceMap.ts +182 -0
- package/plugin/loader/createBuildLoader.ts +124 -104
- package/plugin/loader/createDefaultLoader.ts +62 -0
- package/plugin/loader/css-loader.development.ts +3 -2
- package/plugin/loader/handleExports.ts +276 -0
- package/plugin/loader/index.ts +6 -1
- package/plugin/loader/parse.ts +22 -0
- package/plugin/loader/react-loader.client.ts +1 -0
- package/plugin/loader/react-loader.server.ts +107 -0
- package/plugin/loader/react-loader.ts +4 -1002
- package/plugin/loader/sourceMap.ts +118 -0
- package/plugin/loader/transformModuleIfNeeded.ts +33 -0
- package/plugin/loader/transformModuleWithPreservedFunctions.ts +119 -0
- package/plugin/loader/types.ts +10 -0
- package/plugin/plugin.client.ts +18 -11
- package/plugin/plugin.server.ts +6 -3
- package/plugin/preserver/plugin.ts +37 -17
- package/plugin/react-client/{server.ts → configureWorkerRequestHandler.ts} +22 -12
- package/plugin/react-client/createMessageHandlers.ts +21 -13
- package/plugin/react-client/createWorkerStream.ts +71 -33
- package/plugin/react-client/handleWorkerRscStream.ts +15 -5
- package/plugin/react-client/plugin.ts +18 -13
- package/plugin/react-client/restartWorker.ts +17 -5
- package/plugin/react-server/{server.ts → configureReactServer.ts} +40 -9
- package/plugin/react-server/handleServerAction.ts +177 -0
- package/plugin/react-server/plugin.ts +8 -3
- package/plugin/react-static/collectHtmlWorkerContent.ts +11 -3
- package/plugin/react-static/collectRscContent.ts +17 -9
- package/plugin/react-static/configurePreviewServer.ts +37 -17
- package/plugin/react-static/plugin.ts +45 -22
- package/plugin/react-static/renderPage.ts +12 -6
- package/plugin/react-static/renderPages.ts +15 -4
- package/plugin/react-static/renderStreams.ts +13 -12
- package/plugin/source-map/createMappingsSerializer.ts +182 -0
- package/plugin/source-map/readMappings.ts +195 -0
- package/plugin/transformer/README.md +295 -29
- package/plugin/transformer/index.ts +0 -1
- package/plugin/transformer/plugin.client.ts +0 -111
- package/plugin/transformer/plugin.server.ts +94 -25
- package/plugin/types/react-server-dom-esm.d.ts +183 -24
- package/plugin/types/sourceMap.d.ts +2 -0
- package/plugin/types/webpack-sources.d.ts +24 -0
- package/plugin/types.ts +169 -132
- package/plugin/utils/createCallServer.ts +21 -6
- package/plugin/utils/index.ts +2 -1
- package/plugin/vendor/vendor.client.ts +2 -1
- package/plugin/vendor/vendor.server.ts +1 -1
- package/plugin/worker/createWorker.ts +21 -24
- package/plugin/worker/html/createHtmlWorkerRenderState.tsx +31 -7
- package/plugin/worker/html/html-worker.development.tsx +16 -16
- package/plugin/worker/html/html-worker.production.tsx +3 -19
- package/plugin/worker/html/messageHandler.tsx +2 -4
- package/plugin/worker/rsc/handleRender.ts +15 -12
- package/plugin/worker/rsc/messageHandler.tsx +191 -120
- package/plugin/worker/rsc/rsc-worker.development.ts +148 -77
- package/plugin/worker/rsc/rsc-worker.production.ts +1 -1
- package/plugin/worker/rsc/state.ts +10 -0
- package/plugin/worker/sendMessage.ts +32 -14
- package/plugin/worker/types.ts +99 -64
- package/dist/plugin/react-client/server.d.ts.map +0 -1
- package/dist/plugin/react-client/server.js.map +0 -1
- package/dist/plugin/react-server/server.d.ts +0 -9
- package/dist/plugin/react-server/server.d.ts.map +0 -1
- package/dist/plugin/react-server/server.js.map +0 -1
- package/dist/plugin/transformer/plugin.client.js.map +0 -1
- package/dist/plugin/transformer/upgradeCssModuleCode.d.ts +0 -2
- package/dist/plugin/transformer/upgradeCssModuleCode.d.ts.map +0 -1
- package/dist/plugin/transformer/upgradeCssModuleCode.js +0 -40
- package/dist/plugin/worker/loader.d.ts +0 -5
- package/dist/plugin/worker/loader.d.ts.map +0 -1
- package/dist/plugin/worker/loader.js +0 -11
- package/dist/plugin/worker/loader.js.map +0 -1
- package/plugin/transformer/upgradeCssModuleCode.ts +0 -42
- package/plugin/worker/loader.ts +0 -7
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
function handleExports(source, program, isServerFunction, isClientComponent) {
|
|
7
|
+
const imports = [];
|
|
8
|
+
const declarations = [];
|
|
9
|
+
const exportNames = [];
|
|
10
|
+
const exports = /* @__PURE__ */ new Map();
|
|
11
|
+
let lastEnd = 0;
|
|
12
|
+
let currentBefore = [];
|
|
13
|
+
for (const node of program.body) {
|
|
14
|
+
if (node.start > lastEnd) {
|
|
15
|
+
const beforeCode = source.slice(lastEnd, node.start);
|
|
16
|
+
if (beforeCode.trim()) {
|
|
17
|
+
currentBefore.push(beforeCode);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
if (node.type === "ImportDeclaration") {
|
|
21
|
+
imports.push(source.slice(node.start, node.end));
|
|
22
|
+
} else if (node.type === "ExportAllDeclaration") {
|
|
23
|
+
exports.set("*", {
|
|
24
|
+
type: "all",
|
|
25
|
+
before: [...currentBefore]
|
|
26
|
+
});
|
|
27
|
+
currentBefore = [];
|
|
28
|
+
exportNames.push("*");
|
|
29
|
+
} else if (node.type === "ExportNamedDeclaration") {
|
|
30
|
+
if (node.declaration) {
|
|
31
|
+
if (node.declaration.type === "FunctionDeclaration" && node.declaration.id) {
|
|
32
|
+
const name = node.declaration.id.name;
|
|
33
|
+
exports.set(name, {
|
|
34
|
+
type: "function",
|
|
35
|
+
declaration: source.slice(node.declaration.start, node.declaration.end),
|
|
36
|
+
before: [...currentBefore],
|
|
37
|
+
// Copy the current before array
|
|
38
|
+
isAsync: node.declaration.async
|
|
39
|
+
});
|
|
40
|
+
exportNames.push(name);
|
|
41
|
+
currentBefore = [];
|
|
42
|
+
} else if (node.declaration.type === "ClassDeclaration" && node.declaration.id) {
|
|
43
|
+
const name = node.declaration.id.name;
|
|
44
|
+
exports.set(name, {
|
|
45
|
+
type: "class",
|
|
46
|
+
declaration: source.slice(node.declaration.start, node.declaration.end),
|
|
47
|
+
before: [...currentBefore]
|
|
48
|
+
// Copy the current before array
|
|
49
|
+
});
|
|
50
|
+
exportNames.push(name);
|
|
51
|
+
currentBefore = [];
|
|
52
|
+
} else if (node.declaration.type === "VariableDeclaration") {
|
|
53
|
+
for (const decl of node.declaration.declarations) {
|
|
54
|
+
if (decl.id && decl.id.type === "Identifier") {
|
|
55
|
+
const name = decl.id.name;
|
|
56
|
+
const init = decl.init;
|
|
57
|
+
const isFunction = init && (init.type === "FunctionExpression" || init.type === "ArrowFunctionExpression");
|
|
58
|
+
const isAsync = isFunction && (init.type === "FunctionExpression" && init.async === true || init.type === "ArrowFunctionExpression" && init.async === true);
|
|
59
|
+
exports.set(name, {
|
|
60
|
+
type: isFunction ? "function" : "variable",
|
|
61
|
+
declaration: source.slice(decl.start, decl.end),
|
|
62
|
+
before: [...currentBefore],
|
|
63
|
+
// Copy the current before array
|
|
64
|
+
isAsync: isAsync || false
|
|
65
|
+
});
|
|
66
|
+
exportNames.push(name);
|
|
67
|
+
currentBefore = [];
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
} else if (node.specifiers) {
|
|
72
|
+
for (const spec of node.specifiers) {
|
|
73
|
+
if (spec.type === "ExportSpecifier") {
|
|
74
|
+
const localName = spec.local.type === "Identifier" ? spec.local.name : "";
|
|
75
|
+
const exportedName = spec.exported.type === "Identifier" ? spec.exported.name : "";
|
|
76
|
+
if (localName && exportedName) {
|
|
77
|
+
const functionDecl = program.body.find(
|
|
78
|
+
(node2) => node2.type === "FunctionDeclaration" && node2.id?.name === localName
|
|
79
|
+
);
|
|
80
|
+
if (functionDecl) {
|
|
81
|
+
exports.set(exportedName, {
|
|
82
|
+
type: "function",
|
|
83
|
+
localName,
|
|
84
|
+
declaration: source.slice(functionDecl.start, functionDecl.end),
|
|
85
|
+
before: [...currentBefore],
|
|
86
|
+
isAsync: functionDecl.async
|
|
87
|
+
});
|
|
88
|
+
exportNames.push(exportedName);
|
|
89
|
+
} else {
|
|
90
|
+
const varDecl = program.body.find(
|
|
91
|
+
(node2) => node2.type === "VariableDeclaration" && node2.declarations.some(
|
|
92
|
+
(decl) => decl.id.type === "Identifier" && decl.id.name === localName && decl.init && (decl.init.type === "FunctionExpression" || decl.init.type === "ArrowFunctionExpression")
|
|
93
|
+
)
|
|
94
|
+
);
|
|
95
|
+
if (varDecl) {
|
|
96
|
+
const decl = varDecl.declarations.find(
|
|
97
|
+
(d) => d.id.type === "Identifier" && d.id.name === localName
|
|
98
|
+
);
|
|
99
|
+
if (decl && decl.init) {
|
|
100
|
+
const isAsync = decl.init.type === "FunctionExpression" ? decl.init.async : decl.init.type === "ArrowFunctionExpression" ? decl.init.async : false;
|
|
101
|
+
exports.set(exportedName, {
|
|
102
|
+
type: "function",
|
|
103
|
+
localName,
|
|
104
|
+
declaration: source.slice(decl.start, decl.end),
|
|
105
|
+
before: [...currentBefore],
|
|
106
|
+
isAsync
|
|
107
|
+
});
|
|
108
|
+
exportNames.push(exportedName);
|
|
109
|
+
}
|
|
110
|
+
} else {
|
|
111
|
+
exports.set(exportedName, {
|
|
112
|
+
type: "variable",
|
|
113
|
+
localName,
|
|
114
|
+
before: [...currentBefore]
|
|
115
|
+
});
|
|
116
|
+
exportNames.push(exportedName);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
currentBefore = [];
|
|
123
|
+
}
|
|
124
|
+
} else if (node.type === "ExportDefaultDeclaration") {
|
|
125
|
+
if (node.declaration && node.declaration.type === "FunctionDeclaration" && node.declaration.id) {
|
|
126
|
+
exports.set("default", {
|
|
127
|
+
type: "default",
|
|
128
|
+
before: [...currentBefore],
|
|
129
|
+
localName: node.declaration.id.name,
|
|
130
|
+
// Capture the function name
|
|
131
|
+
isAsync: node.declaration.async
|
|
132
|
+
});
|
|
133
|
+
} else {
|
|
134
|
+
exports.set("default", {
|
|
135
|
+
type: "default",
|
|
136
|
+
before: [...currentBefore]
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
currentBefore = [];
|
|
140
|
+
} else if (node.type === "FunctionDeclaration" || node.type === "VariableDeclaration" || node.type === "ClassDeclaration") {
|
|
141
|
+
if (isServerFunction || !isClientComponent || node.type !== "FunctionDeclaration") {
|
|
142
|
+
declarations.push(source.slice(node.start, node.end));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
lastEnd = node.end;
|
|
146
|
+
}
|
|
147
|
+
if (lastEnd < source.length) {
|
|
148
|
+
const afterCode = source.slice(lastEnd);
|
|
149
|
+
if (afterCode.trim()) {
|
|
150
|
+
const lastExport = Array.from(exports.values()).pop();
|
|
151
|
+
if (lastExport) {
|
|
152
|
+
lastExport.after = [afterCode];
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
for (const [name, info] of exports) {
|
|
157
|
+
if (info.before) {
|
|
158
|
+
declarations.push(...info.before);
|
|
159
|
+
}
|
|
160
|
+
if (info.declaration) {
|
|
161
|
+
declarations.push(info.declaration);
|
|
162
|
+
}
|
|
163
|
+
if (info.after) {
|
|
164
|
+
declarations.push(...info.after);
|
|
165
|
+
}
|
|
166
|
+
if (!exportNames.includes(name)) {
|
|
167
|
+
exportNames.push(name);
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
return { imports, declarations, exportNames, exports };
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
export { handleExports };
|
|
174
|
+
//# sourceMappingURL=handleExports.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"handleExports.js","sources":["../../../plugin/loader/handleExports.ts"],"sourcesContent":["import type { Program } from \"./types.js\";\nimport type { FunctionDeclaration, VariableDeclaration, VariableDeclarator } from \"acorn\";\n\n/**\n * Collects and organizes export information from a module.\n *\n * For all modules:\n * - Collects import statements\n * - Collects export names\n * - Collects declarations\n *\n * The actual transformation of exports (like wrapping with registerServerReference)\n * happens in transformModuleWithPreservedFunctions.\n *\n * @param source - The source code of the module\n * @param url - The URL of the module\n * @param program - The parsed AST program\n * @param isServerFunction - Whether this is a server module\n * @param isClientComponent - Whether this is a client module\n * @returns Object containing imports, declarations, and export names\n */\nexport function handleExports(\n source: string,\n program: Program,\n isServerFunction: boolean | RegExpMatchArray | null,\n isClientComponent: boolean | RegExpMatchArray | null\n): {\n imports: string[];\n declarations: string[];\n exportNames: string[];\n exports: Map<\n string,\n {\n type: \"function\" | \"class\" | \"variable\" | \"default\" | \"all\";\n declaration?: string;\n localName?: string;\n before?: string[];\n after?: string[];\n isAsync?: boolean;\n }\n >;\n} {\n const imports: string[] = [];\n const declarations: string[] = [];\n const exportNames: string[] = [];\n // Track exports and their types\n const exports = new Map<\n string,\n {\n type: \"function\" | \"class\" | \"variable\" | \"default\" | \"all\";\n declaration?: string;\n localName?: string;\n before?: string[];\n after?: string[];\n isAsync?: boolean;\n }\n >();\n\n let lastEnd = 0;\n let currentBefore: string[] = [];\n let foundFirstExport = false;\n\n // First pass: collect all exports and code between them\n for (const node of program.body) {\n // Add any code before this node\n if (node.start > lastEnd) {\n const beforeCode = source.slice(lastEnd, node.start);\n if (beforeCode.trim()) {\n currentBefore.push(beforeCode);\n }\n }\n\n if (node.type === \"ImportDeclaration\") {\n imports.push(source.slice(node.start, node.end));\n } else if (node.type === \"ExportAllDeclaration\") {\n // For export * from './other', just add the * export\n exports.set(\"*\", {\n type: \"all\",\n before: [...currentBefore],\n });\n currentBefore = [];\n exportNames.push(\"*\");\n } else if (node.type === \"ExportNamedDeclaration\") {\n if (!foundFirstExport) {\n // This is the first export, so all code before it goes into its before array\n foundFirstExport = true;\n }\n\n if (node.declaration) {\n if (\n node.declaration.type === \"FunctionDeclaration\" &&\n node.declaration.id\n ) {\n const name = node.declaration.id.name;\n exports.set(name, {\n type: \"function\",\n declaration: source.slice(node.declaration.start, node.declaration.end),\n before: [...currentBefore], // Copy the current before array\n isAsync: node.declaration.async,\n });\n exportNames.push(name);\n currentBefore = []; // Reset for next export\n } else if (\n node.declaration.type === \"ClassDeclaration\" &&\n node.declaration.id\n ) {\n const name = node.declaration.id.name;\n exports.set(name, {\n type: \"class\",\n declaration: source.slice(node.declaration.start, node.declaration.end),\n before: [...currentBefore], // Copy the current before array\n });\n exportNames.push(name);\n currentBefore = []; // Reset for next export\n } else if (node.declaration.type === \"VariableDeclaration\") {\n for (const decl of node.declaration.declarations) {\n if (decl.id && decl.id.type === \"Identifier\") {\n const name = decl.id.name;\n // Check if the declaration is a function expression or arrow function\n const init = decl.init;\n const isFunction = init && (\n init.type === \"FunctionExpression\" ||\n init.type === \"ArrowFunctionExpression\"\n );\n // For function expressions and arrow functions, we want to mark them as async\n // if they are explicitly marked as async\n const isAsync = isFunction && (\n (init.type === \"FunctionExpression\" && init.async === true) ||\n (init.type === \"ArrowFunctionExpression\" && init.async === true)\n );\n exports.set(name, {\n type: isFunction ? \"function\" : \"variable\",\n declaration: source.slice(decl.start, decl.end),\n before: [...currentBefore], // Copy the current before array\n isAsync: isAsync || false\n });\n exportNames.push(name);\n currentBefore = []; // Reset for next export\n }\n }\n }\n } else if (node.specifiers) {\n // For named exports (export { a, b, c })\n for (const spec of node.specifiers) {\n if (spec.type === \"ExportSpecifier\") {\n const localName = spec.local.type === \"Identifier\" ? spec.local.name : \"\";\n const exportedName = spec.exported.type === \"Identifier\" ? spec.exported.name : \"\";\n if (localName && exportedName) {\n // Find the function declaration in the AST\n const functionDecl = program.body.find(\n (node): node is FunctionDeclaration =>\n node.type === \"FunctionDeclaration\" &&\n node.id?.name === localName\n );\n\n if (functionDecl) {\n exports.set(exportedName, {\n type: \"function\",\n localName,\n declaration: source.slice(functionDecl.start, functionDecl.end),\n before: [...currentBefore],\n isAsync: functionDecl.async\n });\n exportNames.push(exportedName);\n } else {\n // If we can't find a function declaration, check if it's a variable declaration\n const varDecl = program.body.find(\n (node): node is VariableDeclaration =>\n node.type === \"VariableDeclaration\" &&\n node.declarations.some(\n (decl) =>\n decl.id.type === \"Identifier\" &&\n decl.id.name === localName &&\n decl.init &&\n (decl.init.type === \"FunctionExpression\" ||\n decl.init.type === \"ArrowFunctionExpression\")\n )\n );\n\n if (varDecl) {\n const decl = varDecl.declarations.find(\n (d: VariableDeclarator) => d.id.type === \"Identifier\" && d.id.name === localName\n );\n if (decl && decl.init) {\n const isAsync = decl.init.type === \"FunctionExpression\" ? decl.init.async :\n decl.init.type === \"ArrowFunctionExpression\" ? decl.init.async : false;\n exports.set(exportedName, {\n type: \"function\",\n localName,\n declaration: source.slice(decl.start, decl.end),\n before: [...currentBefore],\n isAsync\n });\n exportNames.push(exportedName);\n }\n } else {\n exports.set(exportedName, {\n type: \"variable\",\n localName,\n before: [...currentBefore],\n });\n exportNames.push(exportedName);\n }\n }\n }\n }\n }\n currentBefore = []; // Reset for next export\n }\n } else if (node.type === \"ExportDefaultDeclaration\") {\n if (node.declaration && node.declaration.type === \"FunctionDeclaration\" && node.declaration.id) {\n exports.set(\"default\", {\n type: \"default\",\n before: [...currentBefore],\n localName: node.declaration.id.name, // Capture the function name\n isAsync: node.declaration.async\n });\n } else {\n exports.set(\"default\", {\n type: \"default\",\n before: [...currentBefore]\n });\n }\n currentBefore = []; // Reset for next export\n } else if (\n node.type === \"FunctionDeclaration\" ||\n node.type === \"VariableDeclaration\" ||\n node.type === \"ClassDeclaration\"\n ) {\n // For non-exported declarations:\n // - Keep all declarations for server functions\n // - Remove function declarations for client components\n if (\n isServerFunction ||\n !isClientComponent ||\n node.type !== \"FunctionDeclaration\"\n ) {\n declarations.push(source.slice(node.start, node.end));\n }\n }\n\n lastEnd = node.end;\n }\n\n // Add any remaining code after the last node\n if (lastEnd < source.length) {\n const afterCode = source.slice(lastEnd);\n if (afterCode.trim()) {\n // Add to the last export's after array\n const lastExport = Array.from(exports.values()).pop();\n if (lastExport) {\n lastExport.after = [afterCode];\n }\n }\n }\n\n // Second pass: generate transformed exports\n // Process all exports regardless of environment - the actual transformation\n // happens in transformModuleWithPreservedFunctions\n for (const [name, info] of exports) {\n if (info.before) {\n declarations.push(...info.before);\n }\n if (info.declaration) {\n declarations.push(info.declaration);\n }\n if (info.after) {\n declarations.push(...info.after);\n }\n if (!exportNames.includes(name)) {\n exportNames.push(name);\n }\n }\n\n return { imports, declarations, exportNames, exports };\n}\n"],"names":["node"],"mappings":";;;;;AAqBO,SAAS,aACd,CAAA,MAAA,EACA,OACA,EAAA,gBAAA,EACA,iBAgBA,EAAA;AACA,EAAA,MAAM,UAAoB,EAAC;AAC3B,EAAA,MAAM,eAAyB,EAAC;AAChC,EAAA,MAAM,cAAwB,EAAC;AAE/B,EAAM,MAAA,OAAA,uBAAc,GAUlB,EAAA;AAEF,EAAA,IAAI,OAAU,GAAA,CAAA;AACd,EAAA,IAAI,gBAA0B,EAAC;A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AAA,GAAU,OAAO,MAAQ,EAAA;AAC3B,IAAM,MAAA,SAAA,GAAY,MAAO,CAAA,KAAA,CAAM,OAAO,CAAA;AACtC,IAAI,IAAA,SAAA,CAAU,MAAQ,EAAA;AAEpB,MAAA,MAAM,aAAa,KAAM,CAAA,IAAA,CAAK,QAAQ,MAAO,EAAC,EAAE,GAAI,EAAA;AACpD,MAAA,IAAI,UAAY,EAAA;AACd,QAAW,UAAA,CAAA,KAAA,GAAQ,CAAC,SAAS,CAAA;AAAA;AAC/B;AACF;AAMF,EAAA,KAAA,MAAW,CAAC,IAAA,EAAM,IAAI,CAAA,IAAK,OAAS,EAAA;AAClC,IAAA,IAAI,KAAK,MAAQ,EAAA;AACf,MAAa,YAAA,CAAA,IAAA,CAAK,GAAG,IAAA,CAAK,MAAM,CAAA;AAAA;AAElC,IAAA,IAAI,KAAK,WAAa,EAAA;AACpB,MAAa,YAAA,CAAA,IAAA,CAAK,KAAK,WAAW,CAAA;AAAA;AAEpC,IAAA,IAAI,KAAK,KAAO,EAAA;AACd,MAAa,YAAA,CAAA,IAAA,CAAK,GAAG,IAAA,CAAK,KAAK,CAAA;AAAA;AAEjC,IAAA,IAAI,CAAC,WAAA,CAAY,QAAS,CAAA,IAAI,CAAG,EAAA;AAC/B,MAAA,WAAA,CAAY,KAAK,IAAI,CAAA;AAAA;AACvB;AAGF,EAAA,OAAO,EAAE,OAAA,EAAS,YAAc,EAAA,WAAA,EAAa,OAAQ,EAAA;AACvD;;;;"}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare const load: any, resolve: any;
|
|
2
2
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../plugin/loader/index.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../plugin/loader/index.ts"],"names":[],"mappings":"AAKA,eAAO,MAAQ,IAAI,OAAE,OAAO,KAAW,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.d.ts","sourceRoot":"","sources":["../../../plugin/loader/parse.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C;;GAEG;AACH,wBAAgB,KAAK,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAe7C"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* vite-plugin-react-server
|
|
3
|
+
* Copyright (c) Nico Brinkkemper
|
|
4
|
+
* MIT License
|
|
5
|
+
*/
|
|
6
|
+
import * as acorn from 'acorn-loose';
|
|
7
|
+
|
|
8
|
+
function parse(source) {
|
|
9
|
+
let program;
|
|
10
|
+
program = acorn.parse(source, {
|
|
11
|
+
ecmaVersion: "latest",
|
|
12
|
+
sourceType: "module",
|
|
13
|
+
locations: true,
|
|
14
|
+
allowAwaitOutsideFunction: true,
|
|
15
|
+
allowImportExportEverywhere: true,
|
|
16
|
+
allowReturnOutsideFunction: true,
|
|
17
|
+
allowReserved: true
|
|
18
|
+
});
|
|
19
|
+
return program;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { parse };
|
|
23
|
+
//# sourceMappingURL=parse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parse.js","sources":["../../../plugin/loader/parse.ts"],"sourcesContent":["import * as acorn from \"acorn-loose\";\nimport type { Program } from \"./types.js\";\n\n/**\n * Parses source code and handles source maps\n */\nexport function parse(source: string): Program {\n let program: Program;\n\n // Parse the transformed code with acorn\n program = acorn.parse(source, {\n ecmaVersion: \"latest\" as const,\n sourceType: \"module\",\n locations: true,\n allowAwaitOutsideFunction: true,\n allowImportExportEverywhere: true,\n allowReturnOutsideFunction: true,\n allowReserved: true,\n }) as Program;\n\n return program\n}\n"],"names":[],"mappings":";;;;;;;AAMO,SAAS,MAAM,MAAyB,EAAA;AAC7C,EAAI,IAAA,OAAA;AAGJ,EAAU,OAAA,GAAA,KAAA,CAAM,MAAM,MAAQ,EAAA;AAAA,IAC5B,WAAa,EAAA,QAAA;AAAA,IACb,UAAY,EAAA,QAAA;AAAA,IACZ,SAAW,EAAA,IAAA;AAAA,IACX,yBAA2B,EAAA,IAAA;AAAA,IAC3B,2BAA6B,EAAA,IAAA;AAAA,IAC7B,0BAA4B,EAAA,IAAA;AAAA,IAC5B,aAAe,EAAA;AAAA,GAChB,CAAA;AAED,EAAO,OAAA,OAAA;AACT;;;;"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"react-loader.client.d.ts","sourceRoot":"","sources":["../../../plugin/loader/react-loader.client.ts"],"names":[],"mappings":""}
|
|
@@ -1,13 +1,2 @@
|
|
|
1
|
-
|
|
2
|
-
import type { MessagePort } from "node:worker_threads";
|
|
3
|
-
import type { LoaderContext } from "../types.js";
|
|
4
|
-
export declare let loaderPort: MessagePort | undefined;
|
|
5
|
-
export declare function getSource(url: string, context: any, defaultGetSource: any): Promise<any>;
|
|
6
|
-
export declare function transformModuleIfNeeded(source: string, url: string, loader: any, port?: MessagePort): Promise<string | null>;
|
|
7
|
-
export declare function initialize(data: {
|
|
8
|
-
port: MessagePort;
|
|
9
|
-
}): Promise<void>;
|
|
10
|
-
export declare function resolve(specifier: string, context: ResolveHookContext, nextResolve: any): Promise<any>;
|
|
11
|
-
export declare function load(url: string, context: LoadHookContext & LoaderContext, nextLoad: any): Promise<any>;
|
|
12
|
-
export declare function transformSource(source: string, context: any, defaultTransformSource: any): Promise<any>;
|
|
1
|
+
export declare const load: any, resolve: any, transformModuleIfNeeded: any;
|
|
13
2
|
//# sourceMappingURL=react-loader.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"react-loader.d.ts","sourceRoot":"","sources":["../../../plugin/loader/react-loader.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"react-loader.d.ts","sourceRoot":"","sources":["../../../plugin/loader/react-loader.ts"],"names":[],"mappings":"AAKA,eAAO,MAAQ,IAAI,OAAE,OAAO,OAAE,uBAAuB,KAAW,CAAC"}
|