remote-components 0.1.2 → 0.2.1
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/{next/config.cjs → config/nextjs.cjs} +77 -102
- package/dist/config/nextjs.cjs.map +1 -0
- package/dist/{next/config.d.ts → config/nextjs.d.ts} +4 -4
- package/dist/{next/config.js → config/nextjs.js} +73 -98
- package/dist/config/nextjs.js.map +1 -0
- package/dist/{webpack.cjs → config/webpack.cjs} +13 -29
- package/dist/config/webpack.cjs.map +1 -0
- package/dist/{webpack.js → config/webpack.js} +12 -28
- package/dist/config/webpack.js.map +1 -0
- package/dist/{shared/remote → host/defaults}/app.cjs +2 -2
- package/dist/host/defaults/app.cjs.map +1 -0
- package/dist/host/defaults/app.js +8 -0
- package/dist/host/defaults/app.js.map +1 -0
- package/dist/{shared/remote → host/defaults}/pages.cjs +2 -2
- package/dist/host/defaults/pages.cjs.map +1 -0
- package/dist/host/defaults/pages.js +8 -0
- package/dist/host/defaults/pages.js.map +1 -0
- package/dist/{html/host.cjs → host/html.cjs} +1019 -1080
- package/dist/host/html.cjs.map +1 -0
- package/dist/{html/host.d.ts → host/html.d.ts} +0 -2
- package/dist/{html/host.js → host/html.js} +1016 -1076
- package/dist/host/html.js.map +1 -0
- package/dist/{next/host/client/index.cjs → host/nextjs/app/client-only.cjs} +685 -623
- package/dist/host/nextjs/app/client-only.cjs.map +1 -0
- package/dist/host/nextjs/app/client-only.d.ts +16 -0
- package/dist/{next/host/client/index.js → host/nextjs/app/client-only.js} +687 -618
- package/dist/host/nextjs/app/client-only.js.map +1 -0
- package/dist/{next/host/app-router-server.cjs → host/nextjs/app.cjs} +11 -10
- package/dist/host/nextjs/app.cjs.map +1 -0
- package/dist/host/nextjs/app.d.ts +29 -0
- package/dist/{next/host/app-router-server.js → host/nextjs/app.js} +7 -6
- package/dist/host/nextjs/app.js.map +1 -0
- package/dist/{next/host/pages-router-client.cjs → host/nextjs/pages/client-only.cjs} +8 -8
- package/dist/host/nextjs/pages/client-only.cjs.map +1 -0
- package/dist/host/nextjs/pages/client-only.d.ts +31 -0
- package/dist/{next/host/pages-router-client.js → host/nextjs/pages/client-only.js} +4 -4
- package/dist/host/nextjs/pages/client-only.js.map +1 -0
- package/dist/{next/host/pages-router-server.cjs → host/nextjs/pages.cjs} +44 -55
- package/dist/host/nextjs/pages.cjs.map +1 -0
- package/dist/{next/host/pages-router-server.d.ts → host/nextjs/pages.d.ts} +11 -13
- package/dist/{next/host/pages-router-server.js → host/nextjs/pages.js} +38 -49
- package/dist/host/nextjs/pages.js.map +1 -0
- package/dist/host/proxy/client.cjs +57 -0
- package/dist/host/proxy/client.cjs.map +1 -0
- package/dist/host/proxy/client.d.ts +31 -0
- package/dist/host/proxy/client.js +30 -0
- package/dist/host/proxy/client.js.map +1 -0
- package/dist/{shared/host/proxy.cjs → host/proxy/protected-fetch.cjs} +6 -6
- package/dist/host/proxy/protected-fetch.cjs.map +1 -0
- package/dist/{shared/host/proxy.js → host/proxy/protected-fetch.js} +3 -3
- package/dist/host/proxy/protected-fetch.js.map +1 -0
- package/dist/{next → host}/proxy.cjs +12 -92
- package/dist/host/proxy.cjs.map +1 -0
- package/dist/host/proxy.d.ts +30 -0
- package/dist/{next → host}/proxy.js +11 -88
- package/dist/host/proxy.js.map +1 -0
- package/dist/{react/index.cjs → host/react.cjs} +524 -555
- package/dist/host/react.cjs.map +1 -0
- package/dist/{component-loader-21865da3.d.ts → host/react.d.ts} +141 -99
- package/dist/{react/index.js → host/react.js} +523 -552
- package/dist/host/react.js.map +1 -0
- package/dist/internal/{webpack/shared-modules.cjs → config/webpack/apply-shared-modules.cjs} +18 -17
- package/dist/internal/config/webpack/apply-shared-modules.cjs.map +1 -0
- package/dist/internal/{webpack/shared-modules.js → config/webpack/apply-shared-modules.js} +15 -14
- package/dist/internal/config/webpack/apply-shared-modules.js.map +1 -0
- package/dist/internal/{webpack → config/webpack}/next-client-pages-loader.cjs +1 -1
- package/dist/internal/config/webpack/next-client-pages-loader.cjs.map +1 -0
- package/dist/internal/{webpack → config/webpack}/next-client-pages-loader.js +1 -1
- package/dist/internal/config/webpack/next-client-pages-loader.js.map +1 -0
- package/dist/internal/{next/host/app-router-client.cjs → host/nextjs/app-client.cjs} +29 -24
- package/dist/internal/host/nextjs/app-client.cjs.map +1 -0
- package/dist/internal/host/nextjs/app-client.d.ts +25 -0
- package/dist/internal/{next/host/app-router-client.js → host/nextjs/app-client.js} +19 -19
- package/dist/internal/host/nextjs/app-client.js.map +1 -0
- package/dist/internal/{next/host/app-router-compat.cjs → host/nextjs/app-compat.cjs} +5 -22
- package/dist/internal/host/nextjs/app-compat.cjs.map +1 -0
- package/dist/internal/{next/host/app-router-compat.d.ts → host/nextjs/app-compat.d.ts} +1 -7
- package/dist/internal/{next/host/app-router-compat.js → host/nextjs/app-compat.js} +2 -18
- package/dist/internal/host/nextjs/app-compat.js.map +1 -0
- package/dist/internal/host/nextjs/dom-flight.cjs.map +1 -0
- package/dist/internal/host/nextjs/dom-flight.d.ts +39 -0
- package/dist/internal/host/nextjs/dom-flight.js.map +1 -0
- package/dist/internal/host/nextjs/image-impl.cjs +60 -0
- package/dist/internal/host/nextjs/image-impl.cjs.map +1 -0
- package/dist/internal/host/nextjs/image-impl.d.ts +10 -0
- package/dist/internal/host/nextjs/image-impl.js +36 -0
- package/dist/internal/host/nextjs/image-impl.js.map +1 -0
- package/dist/internal/host/nextjs/image-shared.cjs +43 -0
- package/dist/internal/host/nextjs/image-shared.cjs.map +1 -0
- package/dist/internal/host/nextjs/image-shared.d.ts +9 -0
- package/dist/internal/host/nextjs/image-shared.js +19 -0
- package/dist/internal/host/nextjs/image-shared.js.map +1 -0
- package/dist/internal/{next/host → host/nextjs}/remote-component-links.cjs +2 -2
- package/dist/internal/host/nextjs/remote-component-links.cjs.map +1 -0
- package/dist/internal/{next/host → host/nextjs}/remote-component-links.d.ts +1 -1
- package/dist/internal/{next/host → host/nextjs}/remote-component-links.js +2 -2
- package/dist/internal/host/nextjs/remote-component-links.js.map +1 -0
- package/dist/internal/host/nextjs/skeleton.cjs.map +1 -0
- package/dist/internal/host/nextjs/skeleton.js.map +1 -0
- package/dist/internal/{react → host/react}/context.cjs +3 -3
- package/dist/internal/host/react/context.cjs.map +1 -0
- package/dist/internal/{react → host/react}/context.d.ts +4 -4
- package/dist/internal/{react → host/react}/context.js +2 -2
- package/dist/internal/host/react/context.js.map +1 -0
- package/dist/internal/{react → host/react}/hooks/use-resolve-client-url.cjs +2 -2
- package/dist/internal/host/react/hooks/use-resolve-client-url.cjs.map +1 -0
- package/dist/internal/{react → host/react}/hooks/use-resolve-client-url.d.ts +1 -1
- package/dist/internal/{react → host/react}/hooks/use-resolve-client-url.js +2 -2
- package/dist/internal/host/react/hooks/use-resolve-client-url.js.map +1 -0
- package/dist/internal/host/server/fetch-headers.cjs.map +1 -0
- package/dist/internal/host/server/fetch-headers.js.map +1 -0
- package/dist/internal/{shared/ssr → host/server}/fetch-remote-component.cjs +6 -6
- package/dist/internal/host/server/fetch-remote-component.cjs.map +1 -0
- package/dist/internal/{shared/ssr → host/server}/fetch-remote-component.d.ts +6 -1
- package/dist/internal/{shared/ssr → host/server}/fetch-remote-component.js +9 -9
- package/dist/internal/host/server/fetch-remote-component.js.map +1 -0
- package/dist/internal/{shared/ssr → host/server}/fetch-with-hooks.cjs +11 -15
- package/dist/internal/host/server/fetch-with-hooks.cjs.map +1 -0
- package/dist/internal/host/server/fetch-with-hooks.d.ts +21 -0
- package/dist/internal/{shared/ssr → host/server}/fetch-with-hooks.js +11 -15
- package/dist/internal/host/server/fetch-with-hooks.js.map +1 -0
- package/dist/internal/host/server/get-client-or-server-url.cjs.map +1 -0
- package/dist/internal/host/server/get-client-or-server-url.js.map +1 -0
- package/dist/internal/{shared/client → host/server}/get-client-src.cjs +1 -1
- package/dist/internal/host/server/get-client-src.cjs.map +1 -0
- package/dist/internal/{shared/client → host/server}/get-client-src.js +1 -1
- package/dist/internal/host/server/get-client-src.js.map +1 -0
- package/dist/internal/host/server/get-ssr-relative-path-base-url.cjs.map +1 -0
- package/dist/internal/host/server/get-ssr-relative-path-base-url.js.map +1 -0
- package/dist/{next/remote/server.cjs → internal/host/server/types.cjs} +3 -15
- package/dist/internal/host/server/types.cjs.map +1 -0
- package/dist/internal/host/server/types.d.ts +33 -0
- package/dist/internal/host/server/types.js +1 -0
- package/dist/internal/host/server/types.js.map +1 -0
- package/dist/internal/host/shared/asset-descriptors.cjs +17 -0
- package/dist/internal/host/shared/asset-descriptors.cjs.map +1 -0
- package/dist/internal/host/shared/asset-descriptors.d.ts +21 -0
- package/dist/internal/host/shared/asset-descriptors.js +1 -0
- package/dist/internal/host/shared/asset-descriptors.js.map +1 -0
- package/dist/internal/host/shared/config.cjs +17 -0
- package/dist/internal/host/shared/config.cjs.map +1 -0
- package/dist/{host-config-58cdccea.d.ts → internal/host/shared/config.d.ts} +32 -19
- package/dist/internal/host/shared/config.js +1 -0
- package/dist/internal/host/shared/config.js.map +1 -0
- package/dist/internal/host/shared/fetch-interceptors.cjs +17 -0
- package/dist/internal/host/shared/fetch-interceptors.cjs.map +1 -0
- package/dist/{types-2b26a246.d.ts → internal/host/shared/fetch-interceptors.d.ts} +4 -87
- package/dist/internal/host/shared/fetch-interceptors.js +1 -0
- package/dist/internal/host/shared/fetch-interceptors.js.map +1 -0
- package/dist/internal/{shared/client → host/shared}/polyfill.cjs +7 -6
- package/dist/internal/host/shared/polyfill.cjs.map +1 -0
- package/dist/internal/{shared/client → host/shared}/polyfill.d.ts +2 -1
- package/dist/internal/{shared/client → host/shared}/polyfill.js +7 -6
- package/dist/internal/host/shared/polyfill.js.map +1 -0
- package/dist/internal/host/shared/resolved-data.cjs +17 -0
- package/dist/internal/host/shared/resolved-data.cjs.map +1 -0
- package/dist/internal/host/shared/resolved-data.d.ts +48 -0
- package/dist/internal/host/shared/resolved-data.js +1 -0
- package/dist/internal/host/shared/resolved-data.js.map +1 -0
- package/dist/internal/{shared/contract/host-state.cjs → host/shared/state.cjs} +4 -4
- package/dist/internal/host/shared/state.cjs.map +1 -0
- package/dist/internal/{shared/contract/host-state.js → host/shared/state.js} +1 -1
- package/dist/internal/host/shared/state.js.map +1 -0
- package/dist/internal/host/utils/resolve-name-from-src.cjs.map +1 -0
- package/dist/internal/host/utils/resolve-name-from-src.js.map +1 -0
- package/dist/internal/{next/remote/render-client.cjs → remote/nextjs/app-client.cjs} +8 -8
- package/dist/internal/remote/nextjs/app-client.cjs.map +1 -0
- package/dist/internal/{next/remote/render-client.js → remote/nextjs/app-client.js} +4 -4
- package/dist/internal/remote/nextjs/app-client.js.map +1 -0
- package/dist/internal/runtime/constants.cjs +50 -0
- package/dist/internal/runtime/constants.cjs.map +1 -0
- package/dist/internal/runtime/constants.d.ts +10 -0
- package/dist/internal/runtime/constants.js +20 -0
- package/dist/internal/runtime/constants.js.map +1 -0
- package/dist/internal/{shared/client → runtime/html}/apply-origin.cjs.map +1 -1
- package/dist/internal/{shared/client → runtime/html}/apply-origin.d.ts +1 -1
- package/dist/internal/{shared/client → runtime/html}/apply-origin.js.map +1 -1
- package/dist/internal/runtime/html/parse-remote-html.cjs +140 -0
- package/dist/internal/runtime/html/parse-remote-html.cjs.map +1 -0
- package/dist/internal/runtime/html/parse-remote-html.d.ts +88 -0
- package/dist/internal/runtime/html/parse-remote-html.js +110 -0
- package/dist/internal/runtime/html/parse-remote-html.js.map +1 -0
- package/dist/internal/runtime/html/set-attributes-from-props.cjs +68 -0
- package/dist/internal/runtime/html/set-attributes-from-props.cjs.map +1 -0
- package/dist/internal/runtime/html/set-attributes-from-props.d.ts +3 -0
- package/dist/internal/runtime/html/set-attributes-from-props.js +44 -0
- package/dist/internal/runtime/html/set-attributes-from-props.js.map +1 -0
- package/dist/internal/runtime/loaders/component-loader.cjs +184 -0
- package/dist/internal/runtime/loaders/component-loader.cjs.map +1 -0
- package/dist/internal/runtime/loaders/component-loader.d.ts +31 -0
- package/dist/internal/runtime/loaders/component-loader.js +150 -0
- package/dist/internal/runtime/loaders/component-loader.js.map +1 -0
- package/dist/internal/runtime/loaders/script-loader.cjs +64 -0
- package/dist/internal/runtime/loaders/script-loader.cjs.map +1 -0
- package/dist/internal/runtime/loaders/script-loader.d.ts +10 -0
- package/dist/internal/runtime/loaders/script-loader.js +43 -0
- package/dist/internal/runtime/loaders/script-loader.js.map +1 -0
- package/dist/internal/runtime/loaders/static-loader.cjs +177 -0
- package/dist/internal/runtime/loaders/static-loader.cjs.map +1 -0
- package/dist/internal/runtime/loaders/static-loader.d.ts +10 -0
- package/dist/internal/runtime/loaders/static-loader.js +153 -0
- package/dist/internal/runtime/loaders/static-loader.js.map +1 -0
- package/dist/internal/runtime/metadata.cjs +17 -0
- package/dist/internal/runtime/metadata.cjs.map +1 -0
- package/dist/internal/runtime/metadata.d.ts +16 -0
- package/dist/internal/runtime/metadata.js +1 -0
- package/dist/internal/runtime/metadata.js.map +1 -0
- package/dist/internal/runtime/rsc.cjs +92 -0
- package/dist/internal/runtime/rsc.cjs.map +1 -0
- package/dist/internal/runtime/rsc.d.ts +8 -0
- package/dist/internal/runtime/rsc.js +68 -0
- package/dist/internal/runtime/rsc.js.map +1 -0
- package/dist/internal/runtime/turbopack/chunk-loader.cjs +239 -0
- package/dist/internal/runtime/turbopack/chunk-loader.cjs.map +1 -0
- package/dist/internal/runtime/turbopack/chunk-loader.d.ts +11 -0
- package/dist/internal/runtime/turbopack/chunk-loader.js +222 -0
- package/dist/internal/runtime/turbopack/chunk-loader.js.map +1 -0
- package/dist/internal/runtime/turbopack/module.cjs +257 -0
- package/dist/internal/runtime/turbopack/module.cjs.map +1 -0
- package/dist/internal/runtime/turbopack/module.d.ts +61 -0
- package/dist/internal/runtime/turbopack/module.js +233 -0
- package/dist/internal/runtime/turbopack/module.js.map +1 -0
- package/dist/internal/runtime/turbopack/patterns.cjs +44 -0
- package/dist/internal/runtime/turbopack/patterns.cjs.map +1 -0
- package/dist/internal/runtime/turbopack/patterns.d.ts +109 -0
- package/dist/internal/runtime/turbopack/patterns.js +15 -0
- package/dist/internal/runtime/turbopack/patterns.js.map +1 -0
- package/dist/internal/runtime/turbopack/shared-modules.cjs +153 -0
- package/dist/internal/runtime/turbopack/shared-modules.cjs.map +1 -0
- package/dist/internal/runtime/turbopack/shared-modules.d.ts +17 -0
- package/dist/internal/runtime/turbopack/shared-modules.js +134 -0
- package/dist/internal/runtime/turbopack/shared-modules.js.map +1 -0
- package/dist/internal/runtime/turbopack/webpack-runtime.cjs +137 -0
- package/dist/internal/runtime/turbopack/webpack-runtime.cjs.map +1 -0
- package/dist/internal/runtime/turbopack/webpack-runtime.d.ts +20 -0
- package/dist/internal/runtime/turbopack/webpack-runtime.js +107 -0
- package/dist/internal/runtime/turbopack/webpack-runtime.js.map +1 -0
- package/dist/internal/runtime/types.cjs +17 -0
- package/dist/internal/runtime/types.cjs.map +1 -0
- package/dist/internal/runtime/types.d.ts +40 -0
- package/dist/internal/runtime/types.js +1 -0
- package/dist/internal/runtime/types.js.map +1 -0
- package/dist/internal/{shared/client → runtime/url}/default-resolve-client-url.cjs +2 -2
- package/dist/internal/runtime/url/default-resolve-client-url.cjs.map +1 -0
- package/dist/internal/{shared/client → runtime/url}/default-resolve-client-url.d.ts +1 -1
- package/dist/internal/{shared/client → runtime/url}/default-resolve-client-url.js +1 -1
- package/dist/internal/runtime/url/default-resolve-client-url.js.map +1 -0
- package/dist/internal/{shared/client → runtime/url}/protected-rc-fallback.cjs +1 -1
- package/dist/internal/runtime/url/protected-rc-fallback.cjs.map +1 -0
- package/dist/internal/{shared/client → runtime/url}/protected-rc-fallback.js +1 -1
- package/dist/internal/runtime/url/protected-rc-fallback.js.map +1 -0
- package/dist/internal/{shared/client/proxy-through-host.cjs → runtime/url/resolve-client-url.cjs} +4 -24
- package/dist/internal/runtime/url/resolve-client-url.cjs.map +1 -0
- package/dist/internal/{shared/client/proxy-through-host.d.ts → runtime/url/resolve-client-url.d.ts} +1 -25
- package/dist/internal/runtime/url/resolve-client-url.js +21 -0
- package/dist/internal/runtime/url/resolve-client-url.js.map +1 -0
- package/dist/internal/utils/abort.cjs.map +1 -0
- package/dist/internal/utils/abort.js.map +1 -0
- package/dist/internal/{shared → utils}/constants.cjs +3 -0
- package/dist/internal/utils/constants.cjs.map +1 -0
- package/dist/internal/utils/constants.d.ts +5 -0
- package/dist/internal/{shared → utils}/constants.js +2 -0
- package/dist/internal/utils/constants.js.map +1 -0
- package/dist/internal/{shared → utils}/error.cjs +11 -4
- package/dist/internal/utils/error.cjs.map +1 -0
- package/dist/internal/{shared → utils}/error.d.ts +2 -1
- package/dist/internal/{shared → utils}/error.js +10 -4
- package/dist/internal/utils/error.js.map +1 -0
- package/dist/internal/{shared/utils → utils}/logger.cjs +3 -3
- package/dist/internal/utils/logger.cjs.map +1 -0
- package/dist/internal/{shared/utils → utils}/logger.d.ts +2 -2
- package/dist/internal/{shared/utils → utils}/logger.js +3 -3
- package/dist/internal/utils/logger.js.map +1 -0
- package/dist/internal/utils.cjs.map +1 -0
- package/dist/internal/utils.js.map +1 -0
- package/dist/{shared/host → remote/defaults}/app.cjs +2 -6
- package/dist/remote/defaults/app.cjs.map +1 -0
- package/dist/remote/defaults/app.js +8 -0
- package/dist/remote/defaults/app.js.map +1 -0
- package/dist/{shared/host → remote/defaults}/pages.cjs +2 -6
- package/dist/remote/defaults/pages.cjs.map +1 -0
- package/dist/remote/defaults/pages.js +8 -0
- package/dist/remote/defaults/pages.js.map +1 -0
- package/dist/{shared/remote → remote/defaults}/wrapper.cjs +12 -10
- package/dist/remote/defaults/wrapper.cjs.map +1 -0
- package/dist/remote/defaults/wrapper.js +27 -0
- package/dist/remote/defaults/wrapper.js.map +1 -0
- package/dist/{html/remote.cjs → remote/html.cjs} +16 -16
- package/dist/remote/html.cjs.map +1 -0
- package/dist/{html/remote.js → remote/html.js} +16 -16
- package/dist/remote/html.js.map +1 -0
- package/dist/{shared/remote/proxy.cjs → remote/middleware.cjs} +37 -12
- package/dist/remote/middleware.cjs.map +1 -0
- package/dist/remote/middleware.d.ts +27 -0
- package/dist/{shared/remote/proxy.js → remote/middleware.js} +32 -5
- package/dist/remote/middleware.js.map +1 -0
- package/dist/{internal/next/remote/render-server.cjs → remote/nextjs/app.cjs} +14 -16
- package/dist/remote/nextjs/app.cjs.map +1 -0
- package/dist/{internal/next/remote/render-server.d.ts → remote/nextjs/app.d.ts} +12 -13
- package/dist/{internal/next/remote/render-server.js → remote/nextjs/app.js} +9 -11
- package/dist/remote/nextjs/app.js.map +1 -0
- package/dist/{next/remote/pages-router.cjs → remote/nextjs/pages.cjs} +8 -8
- package/dist/remote/nextjs/pages.cjs.map +1 -0
- package/dist/{next/remote/pages-router.d.ts → remote/nextjs/pages.d.ts} +8 -8
- package/dist/{next/remote/pages-router.js → remote/nextjs/pages.js} +4 -4
- package/dist/remote/nextjs/pages.js.map +1 -0
- package/dist/server-handoff-8c89b856.d.ts +46 -0
- package/package.json +126 -157
- package/dist/html/host.cjs.map +0 -1
- package/dist/html/host.js.map +0 -1
- package/dist/html/remote.cjs.map +0 -1
- package/dist/html/remote.js.map +0 -1
- package/dist/internal/next/host/app-router-client.cjs.map +0 -1
- package/dist/internal/next/host/app-router-client.d.ts +0 -79
- package/dist/internal/next/host/app-router-client.js.map +0 -1
- package/dist/internal/next/host/app-router-compat.cjs.map +0 -1
- package/dist/internal/next/host/app-router-compat.js.map +0 -1
- package/dist/internal/next/host/remote-component-links.cjs.map +0 -1
- package/dist/internal/next/host/remote-component-links.js.map +0 -1
- package/dist/internal/next/remote/render-client.cjs.map +0 -1
- package/dist/internal/next/remote/render-client.js.map +0 -1
- package/dist/internal/next/remote/render-server.cjs.map +0 -1
- package/dist/internal/next/remote/render-server.js.map +0 -1
- package/dist/internal/react/context.cjs.map +0 -1
- package/dist/internal/react/context.js.map +0 -1
- package/dist/internal/react/hooks/use-resolve-client-url.cjs.map +0 -1
- package/dist/internal/react/hooks/use-resolve-client-url.js.map +0 -1
- package/dist/internal/shared/client/default-resolve-client-url.cjs.map +0 -1
- package/dist/internal/shared/client/default-resolve-client-url.js.map +0 -1
- package/dist/internal/shared/client/get-client-src.cjs.map +0 -1
- package/dist/internal/shared/client/get-client-src.js.map +0 -1
- package/dist/internal/shared/client/polyfill.cjs.map +0 -1
- package/dist/internal/shared/client/polyfill.js.map +0 -1
- package/dist/internal/shared/client/protected-rc-fallback.cjs.map +0 -1
- package/dist/internal/shared/client/protected-rc-fallback.js.map +0 -1
- package/dist/internal/shared/client/proxy-through-host.cjs.map +0 -1
- package/dist/internal/shared/client/proxy-through-host.js +0 -40
- package/dist/internal/shared/client/proxy-through-host.js.map +0 -1
- package/dist/internal/shared/client/remote-component.cjs +0 -1436
- package/dist/internal/shared/client/remote-component.cjs.map +0 -1
- package/dist/internal/shared/client/remote-component.d.ts +0 -62
- package/dist/internal/shared/client/remote-component.js +0 -1385
- package/dist/internal/shared/client/remote-component.js.map +0 -1
- package/dist/internal/shared/constants.cjs.map +0 -1
- package/dist/internal/shared/constants.d.ts +0 -4
- package/dist/internal/shared/constants.js.map +0 -1
- package/dist/internal/shared/contract/host-state.cjs.map +0 -1
- package/dist/internal/shared/contract/host-state.js.map +0 -1
- package/dist/internal/shared/contract/resolve-name-from-src.cjs.map +0 -1
- package/dist/internal/shared/contract/resolve-name-from-src.js.map +0 -1
- package/dist/internal/shared/error.cjs.map +0 -1
- package/dist/internal/shared/error.js.map +0 -1
- package/dist/internal/shared/ssr/dom-flight.cjs.map +0 -1
- package/dist/internal/shared/ssr/dom-flight.d.ts +0 -2
- package/dist/internal/shared/ssr/dom-flight.js.map +0 -1
- package/dist/internal/shared/ssr/fetch-headers.cjs.map +0 -1
- package/dist/internal/shared/ssr/fetch-headers.js.map +0 -1
- package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +0 -1
- package/dist/internal/shared/ssr/fetch-remote-component.js.map +0 -1
- package/dist/internal/shared/ssr/fetch-with-hooks.cjs.map +0 -1
- package/dist/internal/shared/ssr/fetch-with-hooks.d.ts +0 -56
- package/dist/internal/shared/ssr/fetch-with-hooks.js.map +0 -1
- package/dist/internal/shared/ssr/get-client-or-server-url.cjs.map +0 -1
- package/dist/internal/shared/ssr/get-client-or-server-url.js.map +0 -1
- package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.cjs.map +0 -1
- package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.js.map +0 -1
- package/dist/internal/shared/ssr/skeleton.cjs.map +0 -1
- package/dist/internal/shared/ssr/skeleton.js.map +0 -1
- package/dist/internal/shared/utils/abort.cjs.map +0 -1
- package/dist/internal/shared/utils/abort.js.map +0 -1
- package/dist/internal/shared/utils/logger.cjs.map +0 -1
- package/dist/internal/shared/utils/logger.js.map +0 -1
- package/dist/internal/shared/utils.cjs.map +0 -1
- package/dist/internal/shared/utils.js.map +0 -1
- package/dist/internal/webpack/next-client-pages-loader.cjs.map +0 -1
- package/dist/internal/webpack/next-client-pages-loader.js.map +0 -1
- package/dist/internal/webpack/shared-modules.cjs.map +0 -1
- package/dist/internal/webpack/shared-modules.js.map +0 -1
- package/dist/next/config.cjs.map +0 -1
- package/dist/next/config.js.map +0 -1
- package/dist/next/host/app-router-server.cjs.map +0 -1
- package/dist/next/host/app-router-server.d.ts +0 -30
- package/dist/next/host/app-router-server.js.map +0 -1
- package/dist/next/host/client/index.cjs.map +0 -1
- package/dist/next/host/client/index.d.ts +0 -19
- package/dist/next/host/client/index.js.map +0 -1
- package/dist/next/host/pages-router-client.cjs.map +0 -1
- package/dist/next/host/pages-router-client.d.ts +0 -33
- package/dist/next/host/pages-router-client.js.map +0 -1
- package/dist/next/host/pages-router-server.cjs.map +0 -1
- package/dist/next/host/pages-router-server.js.map +0 -1
- package/dist/next/index.cjs +0 -53
- package/dist/next/index.cjs.map +0 -1
- package/dist/next/index.d.ts +0 -30
- package/dist/next/index.js +0 -19
- package/dist/next/index.js.map +0 -1
- package/dist/next/proxy.cjs.map +0 -1
- package/dist/next/proxy.d.ts +0 -56
- package/dist/next/proxy.js.map +0 -1
- package/dist/next/remote/pages-router.cjs.map +0 -1
- package/dist/next/remote/pages-router.js.map +0 -1
- package/dist/next/remote/server.cjs.map +0 -1
- package/dist/next/remote/server.d.ts +0 -5
- package/dist/next/remote/server.js +0 -5
- package/dist/next/remote/server.js.map +0 -1
- package/dist/proxy-through-host-a676a522.d.ts +0 -52
- package/dist/react/index.cjs.map +0 -1
- package/dist/react/index.d.ts +0 -86
- package/dist/react/index.js.map +0 -1
- package/dist/shared/host/app.cjs.map +0 -1
- package/dist/shared/host/app.js +0 -12
- package/dist/shared/host/app.js.map +0 -1
- package/dist/shared/host/pages.cjs.map +0 -1
- package/dist/shared/host/pages.js +0 -12
- package/dist/shared/host/pages.js.map +0 -1
- package/dist/shared/host/proxy.cjs.map +0 -1
- package/dist/shared/host/proxy.js.map +0 -1
- package/dist/shared/remote/app.cjs.map +0 -1
- package/dist/shared/remote/app.js +0 -8
- package/dist/shared/remote/app.js.map +0 -1
- package/dist/shared/remote/pages.cjs.map +0 -1
- package/dist/shared/remote/pages.js +0 -8
- package/dist/shared/remote/pages.js.map +0 -1
- package/dist/shared/remote/proxy.cjs.map +0 -1
- package/dist/shared/remote/proxy.d.ts +0 -44
- package/dist/shared/remote/proxy.js.map +0 -1
- package/dist/shared/remote/wrapper.cjs.map +0 -1
- package/dist/shared/remote/wrapper.js +0 -25
- package/dist/shared/remote/wrapper.js.map +0 -1
- package/dist/webpack.cjs.map +0 -1
- package/dist/webpack.js.map +0 -1
- /package/dist/{webpack.d.ts → config/webpack.d.ts} +0 -0
- /package/dist/{shared/host → host/defaults}/app.d.ts +0 -0
- /package/dist/{shared/host → host/defaults}/pages.d.ts +0 -0
- /package/dist/{shared/host/proxy.d.ts → host/proxy/protected-fetch.d.ts} +0 -0
- /package/dist/internal/{webpack/shared-modules.d.ts → config/webpack/apply-shared-modules.d.ts} +0 -0
- /package/dist/internal/{webpack → config/webpack}/next-client-pages-loader.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/nextjs}/dom-flight.cjs +0 -0
- /package/dist/internal/{shared/ssr → host/nextjs}/dom-flight.js +0 -0
- /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.cjs +0 -0
- /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.js +0 -0
- /package/dist/internal/{shared/ssr → host/server}/fetch-headers.cjs +0 -0
- /package/dist/internal/{shared/ssr → host/server}/fetch-headers.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/server}/fetch-headers.js +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.cjs +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.js +0 -0
- /package/dist/internal/{shared/client → host/server}/get-client-src.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.cjs +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.js +0 -0
- /package/dist/internal/{shared/contract/host-state.d.ts → host/shared/state.d.ts} +0 -0
- /package/dist/internal/{shared/contract → host/utils}/resolve-name-from-src.cjs +0 -0
- /package/dist/internal/{shared/contract → host/utils}/resolve-name-from-src.d.ts +0 -0
- /package/dist/internal/{shared/contract → host/utils}/resolve-name-from-src.js +0 -0
- /package/dist/internal/{next/remote/render-client.d.ts → remote/nextjs/app-client.d.ts} +0 -0
- /package/dist/internal/{shared/client → runtime/html}/apply-origin.cjs +0 -0
- /package/dist/internal/{shared/client → runtime/html}/apply-origin.js +0 -0
- /package/dist/internal/{shared/client → runtime/url}/protected-rc-fallback.d.ts +0 -0
- /package/dist/internal/{shared/utils → utils}/abort.cjs +0 -0
- /package/dist/internal/{shared/utils → utils}/abort.d.ts +0 -0
- /package/dist/internal/{shared/utils → utils}/abort.js +0 -0
- /package/dist/internal/{shared/utils.cjs → utils.cjs} +0 -0
- /package/dist/internal/{shared/utils.d.ts → utils.d.ts} +0 -0
- /package/dist/internal/{shared/utils.js → utils.js} +0 -0
- /package/dist/{shared/remote → remote/defaults}/app.d.ts +0 -0
- /package/dist/{shared/remote → remote/defaults}/pages.d.ts +0 -0
- /package/dist/{shared/remote → remote/defaults}/wrapper.d.ts +0 -0
- /package/dist/{html/remote.d.ts → remote/html.d.ts} +0 -0
|
@@ -8,20 +8,17 @@ var __export = (target, all) => {
|
|
|
8
8
|
__defProp(target, name, { get: all[name], enumerable: true });
|
|
9
9
|
};
|
|
10
10
|
|
|
11
|
-
// src/
|
|
11
|
+
// src/utils/constants.ts
|
|
12
12
|
var RC_PROTECTED_REMOTE_FETCH_PATHNAME, CORS_DOCS_URL;
|
|
13
13
|
var init_constants = __esm({
|
|
14
|
-
"src/
|
|
14
|
+
"src/utils/constants.ts"() {
|
|
15
15
|
"use strict";
|
|
16
16
|
RC_PROTECTED_REMOTE_FETCH_PATHNAME = "/rc-fetch-protected-remote";
|
|
17
17
|
CORS_DOCS_URL = "https://vercel.com/docs/remote-components/concepts/cors-external-urls#accessing-cross-site-protected-remote-components";
|
|
18
18
|
}
|
|
19
19
|
});
|
|
20
20
|
|
|
21
|
-
// src/
|
|
22
|
-
function generateProtectedRcFallbackSrc(url) {
|
|
23
|
-
return `${RC_PROTECTED_REMOTE_FETCH_PATHNAME}?url=${encodeURIComponent(url)}`;
|
|
24
|
-
}
|
|
21
|
+
// src/runtime/url/protected-rc-fallback.ts
|
|
25
22
|
function isProxiedUrl(url) {
|
|
26
23
|
try {
|
|
27
24
|
return new URL(url, location.href).pathname === RC_PROTECTED_REMOTE_FETCH_PATHNAME;
|
|
@@ -30,13 +27,13 @@ function isProxiedUrl(url) {
|
|
|
30
27
|
}
|
|
31
28
|
}
|
|
32
29
|
var init_protected_rc_fallback = __esm({
|
|
33
|
-
"src/
|
|
30
|
+
"src/runtime/url/protected-rc-fallback.ts"() {
|
|
34
31
|
"use strict";
|
|
35
32
|
init_constants();
|
|
36
33
|
}
|
|
37
34
|
});
|
|
38
35
|
|
|
39
|
-
// src/
|
|
36
|
+
// src/utils/abort.ts
|
|
40
37
|
function isAbortError(error) {
|
|
41
38
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
42
39
|
return true;
|
|
@@ -48,12 +45,12 @@ function isAbortError(error) {
|
|
|
48
45
|
return false;
|
|
49
46
|
}
|
|
50
47
|
var init_abort = __esm({
|
|
51
|
-
"src/
|
|
48
|
+
"src/utils/abort.ts"() {
|
|
52
49
|
"use strict";
|
|
53
50
|
}
|
|
54
51
|
});
|
|
55
52
|
|
|
56
|
-
// src/
|
|
53
|
+
// src/utils/error.ts
|
|
57
54
|
function multipleRemoteComponentsError(url) {
|
|
58
55
|
return new RemoteComponentsError(
|
|
59
56
|
`Multiple Remote Components found at "${url}". When a page exposes multiple Remote Components you must specify the "name" prop to select which one to load.`
|
|
@@ -104,6 +101,11 @@ async function errorFromFailedFetch(originalUrl, resolvedUrl, res) {
|
|
|
104
101
|
}
|
|
105
102
|
return fallback;
|
|
106
103
|
}
|
|
104
|
+
function failedProxiedAssetError(kind, url, resolvedUrl) {
|
|
105
|
+
return new RemoteComponentsError(
|
|
106
|
+
`Failed to load ${kind} "${url}" via proxy "${resolvedUrl}". Ensure withRemoteComponentsHostProxy middleware is configured, "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" is in the matcher, and the remote URL is included in allowedProxyUrls. See: ${CORS_DOCS_URL}`
|
|
107
|
+
);
|
|
108
|
+
}
|
|
107
109
|
function failedProxyFetchError(originalUrl, proxyUrl, status, responseBody) {
|
|
108
110
|
if (status === 404) {
|
|
109
111
|
return new RemoteComponentsError(
|
|
@@ -112,7 +114,7 @@ function failedProxyFetchError(originalUrl, proxyUrl, status, responseBody) {
|
|
|
112
114
|
The host server needs middleware or a route that handles "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}".
|
|
113
115
|
|
|
114
116
|
Proxying requires two pieces:
|
|
115
|
-
1. resolveClientUrl={
|
|
117
|
+
1. resolveClientUrl={routeThroughHostProxy} on <RemoteComponent>
|
|
116
118
|
2. Middleware or a route for "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" on the host server
|
|
117
119
|
|
|
118
120
|
Docs: ${CORS_DOCS_URL}`
|
|
@@ -130,11 +132,11 @@ Docs: ${CORS_DOCS_URL}`
|
|
|
130
132
|
}
|
|
131
133
|
var RemoteComponentsError;
|
|
132
134
|
var init_error = __esm({
|
|
133
|
-
"src/
|
|
135
|
+
"src/utils/error.ts"() {
|
|
134
136
|
"use strict";
|
|
135
137
|
init_protected_rc_fallback();
|
|
136
|
-
init_constants();
|
|
137
138
|
init_abort();
|
|
139
|
+
init_constants();
|
|
138
140
|
RemoteComponentsError = class extends Error {
|
|
139
141
|
code = "REMOTE_COMPONENTS_ERROR";
|
|
140
142
|
constructor(message, options) {
|
|
@@ -145,34 +147,7 @@ var init_error = __esm({
|
|
|
145
147
|
}
|
|
146
148
|
});
|
|
147
149
|
|
|
148
|
-
// src/
|
|
149
|
-
function escapeString(str) {
|
|
150
|
-
return str.replace(/[^a-z0-9]/g, "_");
|
|
151
|
-
}
|
|
152
|
-
var init_utils = __esm({
|
|
153
|
-
"src/shared/utils/index.ts"() {
|
|
154
|
-
"use strict";
|
|
155
|
-
}
|
|
156
|
-
});
|
|
157
|
-
|
|
158
|
-
// src/shared/client/const.ts
|
|
159
|
-
function getBundleKey(bundle) {
|
|
160
|
-
return escapeString(bundle);
|
|
161
|
-
}
|
|
162
|
-
var DEFAULT_ROUTE, RUNTIME_WEBPACK, RUNTIME_TURBOPACK, RUNTIME_SCRIPT, REMOTE_COMPONENT_REGEX;
|
|
163
|
-
var init_const = __esm({
|
|
164
|
-
"src/shared/client/const.ts"() {
|
|
165
|
-
"use strict";
|
|
166
|
-
init_utils();
|
|
167
|
-
DEFAULT_ROUTE = "/";
|
|
168
|
-
RUNTIME_WEBPACK = "webpack";
|
|
169
|
-
RUNTIME_TURBOPACK = "turbopack";
|
|
170
|
-
RUNTIME_SCRIPT = "script";
|
|
171
|
-
REMOTE_COMPONENT_REGEX = /(?<prefix>.*?)\[(?<bundle>[^\]]+)\](?:%20| )(?<id>.+)/;
|
|
172
|
-
}
|
|
173
|
-
});
|
|
174
|
-
|
|
175
|
-
// src/shared/utils/logger.ts
|
|
150
|
+
// src/utils/logger.ts
|
|
176
151
|
function logDebug(location2, message) {
|
|
177
152
|
if (DEBUG) {
|
|
178
153
|
console.debug(`[${PREFIX}:${location2}]: ${message}`);
|
|
@@ -196,14 +171,14 @@ function warnCrossOriginFetchError(logLocation, url) {
|
|
|
196
171
|
}
|
|
197
172
|
logWarn(
|
|
198
173
|
logLocation,
|
|
199
|
-
`Failed to fetch cross-origin resource "${parsed.href}".
|
|
174
|
+
`Failed to fetch cross-origin resource "${parsed.href}". To load assets from a protected deployment, two steps are required: (1) configure withRemoteComponentsHostProxy middleware in your host with the remote URL in allowedProxyUrls, and (2) provide a resolveClientUrl prop that rewrites cross-origin asset URLs to go through the proxy. See: ${CORS_DOCS_URL}`
|
|
200
175
|
);
|
|
201
176
|
} catch {
|
|
202
177
|
}
|
|
203
178
|
}
|
|
204
179
|
var PREFIX, DEBUG;
|
|
205
180
|
var init_logger = __esm({
|
|
206
|
-
"src/
|
|
181
|
+
"src/utils/logger.ts"() {
|
|
207
182
|
"use strict";
|
|
208
183
|
init_constants();
|
|
209
184
|
init_error();
|
|
@@ -212,7 +187,104 @@ var init_logger = __esm({
|
|
|
212
187
|
}
|
|
213
188
|
});
|
|
214
189
|
|
|
215
|
-
// src/
|
|
190
|
+
// src/utils/index.ts
|
|
191
|
+
function escapeString(str) {
|
|
192
|
+
return str.replace(/[^a-z0-9]/g, "_");
|
|
193
|
+
}
|
|
194
|
+
var init_utils = __esm({
|
|
195
|
+
"src/utils/index.ts"() {
|
|
196
|
+
"use strict";
|
|
197
|
+
}
|
|
198
|
+
});
|
|
199
|
+
|
|
200
|
+
// src/runtime/constants.ts
|
|
201
|
+
function getBundleKey(bundle) {
|
|
202
|
+
return escapeString(bundle);
|
|
203
|
+
}
|
|
204
|
+
var DEFAULT_ROUTE, RUNTIME_WEBPACK, RUNTIME_TURBOPACK, RUNTIME_SCRIPT, REMOTE_COMPONENT_REGEX, NEXT_BUNDLE_PATH_RE;
|
|
205
|
+
var init_constants2 = __esm({
|
|
206
|
+
"src/runtime/constants.ts"() {
|
|
207
|
+
"use strict";
|
|
208
|
+
init_utils();
|
|
209
|
+
DEFAULT_ROUTE = "/";
|
|
210
|
+
RUNTIME_WEBPACK = "webpack";
|
|
211
|
+
RUNTIME_TURBOPACK = "turbopack";
|
|
212
|
+
RUNTIME_SCRIPT = "script";
|
|
213
|
+
REMOTE_COMPONENT_REGEX = /(?<prefix>.*?)\[(?<bundle>[^\]]+)\](?:%20| )(?<id>.+)/;
|
|
214
|
+
NEXT_BUNDLE_PATH_RE = /\/_next\/\[.+\](?:%20| )/;
|
|
215
|
+
}
|
|
216
|
+
});
|
|
217
|
+
|
|
218
|
+
// src/config/webpack/apply-shared-modules.ts
|
|
219
|
+
function applySharedModules(bundle, resolve) {
|
|
220
|
+
logDebug(
|
|
221
|
+
"SharedModules",
|
|
222
|
+
`applySharedModules called for bundle: "${bundle}"`
|
|
223
|
+
);
|
|
224
|
+
logDebug(
|
|
225
|
+
"SharedModules",
|
|
226
|
+
`Shared modules to resolve: ${Object.keys(resolve)}`
|
|
227
|
+
);
|
|
228
|
+
const self = globalThis;
|
|
229
|
+
if (self.__remote_webpack_require__?.[bundle]) {
|
|
230
|
+
const modulePaths = Object.keys(
|
|
231
|
+
self.__remote_webpack_module_map__?.[bundle] ?? self.__remote_webpack_require__[bundle].m ?? {}
|
|
232
|
+
);
|
|
233
|
+
logDebug(
|
|
234
|
+
"SharedModules",
|
|
235
|
+
`Available module paths in __remote_webpack_require__[${bundle}]: ${modulePaths}`
|
|
236
|
+
);
|
|
237
|
+
for (const [key, value] of Object.entries(resolve)) {
|
|
238
|
+
const exactIds = modulePaths.filter((p) => p === key);
|
|
239
|
+
const ids = exactIds.length > 0 ? exactIds : modulePaths.filter((p) => p.includes(key));
|
|
240
|
+
if (ids.length === 0) {
|
|
241
|
+
logDebug(
|
|
242
|
+
"SharedModules",
|
|
243
|
+
`No matching module path found for shared module "${key}"`
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
for (const id of ids) {
|
|
247
|
+
const webpackBundle = self.__remote_webpack_require__[bundle];
|
|
248
|
+
if (webpackBundle.m) {
|
|
249
|
+
const resolvedId = self.__remote_webpack_module_map__?.[bundle]?.[id] ? `${self.__remote_webpack_module_map__[bundle][id]}` : id;
|
|
250
|
+
if (resolvedId !== id) {
|
|
251
|
+
logDebug(
|
|
252
|
+
"SharedModules",
|
|
253
|
+
`Mapped module id: "${id}" -> "${resolvedId}"`
|
|
254
|
+
);
|
|
255
|
+
}
|
|
256
|
+
webpackBundle.m[resolvedId] = (module) => {
|
|
257
|
+
module.exports = value;
|
|
258
|
+
};
|
|
259
|
+
} else {
|
|
260
|
+
logWarn(
|
|
261
|
+
"SharedModules",
|
|
262
|
+
`webpackBundle.m is not available for bundle "${bundle}" \u2014 ${DEDUPLICATION_SKIPPED}`
|
|
263
|
+
);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
} else {
|
|
268
|
+
logWarn(
|
|
269
|
+
"SharedModules",
|
|
270
|
+
`No webpack require found for bundle "${bundle}" \u2014 ${DEDUPLICATION_SKIPPED}`
|
|
271
|
+
);
|
|
272
|
+
logDebug(
|
|
273
|
+
"SharedModules",
|
|
274
|
+
`Available bundles: ${Object.keys(self.__remote_webpack_require__ ?? {})}`
|
|
275
|
+
);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
var DEDUPLICATION_SKIPPED;
|
|
279
|
+
var init_apply_shared_modules = __esm({
|
|
280
|
+
"src/config/webpack/apply-shared-modules.ts"() {
|
|
281
|
+
"use strict";
|
|
282
|
+
init_logger();
|
|
283
|
+
DEDUPLICATION_SKIPPED = "shared module deduplication skipped. The remote may load its own copy of shared dependencies.";
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
|
|
287
|
+
// src/config/webpack/next-client-pages-loader.ts
|
|
216
288
|
function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
217
289
|
const self = globalThis;
|
|
218
290
|
const nextCssOriginal = document.querySelector(
|
|
@@ -324,167 +396,390 @@ function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
|
324
396
|
return { Component: null, App: null };
|
|
325
397
|
}
|
|
326
398
|
var init_next_client_pages_loader = __esm({
|
|
327
|
-
"src/
|
|
399
|
+
"src/config/webpack/next-client-pages-loader.ts"() {
|
|
328
400
|
"use strict";
|
|
329
401
|
init_error();
|
|
330
402
|
}
|
|
331
403
|
});
|
|
332
404
|
|
|
333
|
-
// src/shared/
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
"SharedModules",
|
|
337
|
-
`applySharedModules called for bundle: "${bundle}"`
|
|
338
|
-
);
|
|
339
|
-
logDebug(
|
|
340
|
-
"SharedModules",
|
|
341
|
-
`Shared modules to resolve: ${Object.keys(resolve)}`
|
|
342
|
-
);
|
|
405
|
+
// src/host/shared/polyfill.tsx
|
|
406
|
+
import { jsx } from "react/jsx-runtime";
|
|
407
|
+
function applyBundleUrlToSrc(bundle, src) {
|
|
343
408
|
const self = globalThis;
|
|
344
|
-
if (self.
|
|
345
|
-
|
|
346
|
-
self.__remote_webpack_module_map__?.[bundle] ?? self.__remote_webpack_require__[bundle].m ?? {}
|
|
347
|
-
);
|
|
348
|
-
logDebug(
|
|
349
|
-
"SharedModules",
|
|
350
|
-
`Available module paths in __remote_webpack_require__[${bundle}]: ${modulePaths}`
|
|
351
|
-
);
|
|
352
|
-
for (const [key, value] of Object.entries(resolve)) {
|
|
353
|
-
let ids = modulePaths.filter((p) => p === key);
|
|
354
|
-
if (ids.length === 0) {
|
|
355
|
-
ids = modulePaths.filter((p) => p.includes(key));
|
|
356
|
-
}
|
|
357
|
-
if (ids.length === 0) {
|
|
358
|
-
logDebug(
|
|
359
|
-
"SharedModules",
|
|
360
|
-
`No matching module path found for shared module "${key}"`
|
|
361
|
-
);
|
|
362
|
-
}
|
|
363
|
-
for (let id of ids) {
|
|
364
|
-
const webpackBundle = self.__remote_webpack_require__[bundle];
|
|
365
|
-
if (webpackBundle.m) {
|
|
366
|
-
if (self.__remote_webpack_module_map__?.[bundle]?.[id]) {
|
|
367
|
-
const mappedId = `${self.__remote_webpack_module_map__[bundle][id]}`;
|
|
368
|
-
logDebug(
|
|
369
|
-
"SharedModules",
|
|
370
|
-
`Mapped module id: "${id}" -> "${mappedId}"`
|
|
371
|
-
);
|
|
372
|
-
id = mappedId;
|
|
373
|
-
}
|
|
374
|
-
webpackBundle.m[id] = (module) => {
|
|
375
|
-
module.exports = value;
|
|
376
|
-
};
|
|
377
|
-
} else {
|
|
378
|
-
logWarn(
|
|
379
|
-
"SharedModules",
|
|
380
|
-
`webpackBundle.m is not available for bundle "${bundle}"`
|
|
381
|
-
);
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
}
|
|
385
|
-
} else {
|
|
386
|
-
logWarn("SharedModules", `No webpack require found for bundle "${bundle}"`);
|
|
387
|
-
logDebug(
|
|
388
|
-
"SharedModules",
|
|
389
|
-
`Available bundles: ${Object.keys(self.__remote_webpack_require__ ?? {})}`
|
|
390
|
-
);
|
|
409
|
+
if (self.__remote_bundle_url__?.[bundle]?.origin === location.origin) {
|
|
410
|
+
return src;
|
|
391
411
|
}
|
|
392
|
-
}
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
"use strict";
|
|
396
|
-
init_logger();
|
|
412
|
+
const { assetPrefix, path } = /^(?<assetPrefix>.*?)\/_next\/(?<path>.*)/.exec(src)?.groups ?? {};
|
|
413
|
+
if (!path) {
|
|
414
|
+
return new URL(src, self.__remote_bundle_url__?.[bundle]?.origin).href;
|
|
397
415
|
}
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
"src/shared/client/webpack-patterns.ts"() {
|
|
404
|
-
"use strict";
|
|
405
|
-
NEXT_BUNDLE_PATH_RE = /\/_next\/\[.+\](?:%20| )/;
|
|
416
|
+
return `${self.__remote_bundle_url__?.[bundle]?.origin ?? ""}${assetPrefix}/_next/${path}`;
|
|
417
|
+
}
|
|
418
|
+
function applyBundleUrlToImagePropsSrc(bundle, src) {
|
|
419
|
+
if (typeof src === "string") {
|
|
420
|
+
return applyBundleUrlToSrc(bundle, src);
|
|
406
421
|
}
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
if (isProxied) {
|
|
425
|
-
reject(
|
|
426
|
-
new RemoteComponentsError(
|
|
427
|
-
`Failed to load script "${newSrc}" via proxy "${resolvedSrc}". Ensure withRemoteComponentsHost middleware is configured and "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" is in the matcher. See: ${CORS_DOCS_URL}`
|
|
428
|
-
)
|
|
429
|
-
);
|
|
430
|
-
} else {
|
|
431
|
-
warnCrossOriginFetchError("ScriptLoader", newSrc);
|
|
432
|
-
reject(
|
|
433
|
-
new RemoteComponentsError(
|
|
434
|
-
`Failed to load <script src="${newSrc}"> for Remote Component. Check the URL is correct.`
|
|
435
|
-
)
|
|
436
|
-
);
|
|
422
|
+
const propSrc = src;
|
|
423
|
+
return applyBundleUrlToSrc(bundle, propSrc.src);
|
|
424
|
+
}
|
|
425
|
+
function sharedPolyfills(shared, resolveClientUrl) {
|
|
426
|
+
const self = globalThis;
|
|
427
|
+
const polyfill = {
|
|
428
|
+
"next/dist/client/components/navigation": self.__remote_component_host_shared_modules__?.["next/navigation"] ?? shared?.["next/navigation"] ?? (() => Promise.resolve({
|
|
429
|
+
useRouter() {
|
|
430
|
+
return {
|
|
431
|
+
push: (routerUrl) => {
|
|
432
|
+
history.pushState({}, "", routerUrl);
|
|
433
|
+
},
|
|
434
|
+
replace: (routerUrl) => {
|
|
435
|
+
history.replaceState({}, "", routerUrl);
|
|
436
|
+
},
|
|
437
|
+
back: () => {
|
|
438
|
+
history.back();
|
|
437
439
|
}
|
|
438
440
|
};
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
|
|
442
|
-
}
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
441
|
+
},
|
|
442
|
+
usePathname() {
|
|
443
|
+
return location.pathname;
|
|
444
|
+
},
|
|
445
|
+
useParams() {
|
|
446
|
+
return {};
|
|
447
|
+
},
|
|
448
|
+
useSearchParams() {
|
|
449
|
+
return new URLSearchParams(location.search);
|
|
450
|
+
},
|
|
451
|
+
useSelectedLayoutSegment() {
|
|
452
|
+
return null;
|
|
453
|
+
},
|
|
454
|
+
useSelectedLayoutSegments() {
|
|
455
|
+
return [];
|
|
456
|
+
},
|
|
457
|
+
__esModule: true
|
|
458
|
+
})),
|
|
459
|
+
"next/dist/client/app-dir/link": self.__remote_component_host_shared_modules__?.["next/link"] ?? shared?.["next/link"] ?? (() => Promise.resolve({
|
|
460
|
+
default: ({
|
|
461
|
+
scroll: _,
|
|
462
|
+
replace,
|
|
463
|
+
prefetch,
|
|
464
|
+
onNavigate,
|
|
465
|
+
children,
|
|
466
|
+
...props
|
|
467
|
+
}) => {
|
|
468
|
+
if (prefetch) {
|
|
469
|
+
logWarn(
|
|
470
|
+
"Polyfill",
|
|
471
|
+
"Next.js Link prefetch is not supported in remote components"
|
|
472
|
+
);
|
|
473
|
+
}
|
|
474
|
+
return /* @__PURE__ */ jsx(
|
|
475
|
+
"a",
|
|
476
|
+
{
|
|
477
|
+
...props,
|
|
478
|
+
href: props.href,
|
|
479
|
+
onClick: (e) => {
|
|
480
|
+
e.preventDefault();
|
|
481
|
+
let preventDefaulted = false;
|
|
482
|
+
e.preventDefault = () => {
|
|
483
|
+
preventDefaulted = true;
|
|
484
|
+
e.defaultPrevented = true;
|
|
485
|
+
};
|
|
486
|
+
if (typeof props.onClick === "function") {
|
|
487
|
+
props.onClick(e);
|
|
488
|
+
}
|
|
489
|
+
onNavigate?.(e);
|
|
490
|
+
if (preventDefaulted) {
|
|
491
|
+
return;
|
|
492
|
+
}
|
|
493
|
+
if (replace) {
|
|
494
|
+
history.replaceState({}, "", props.href);
|
|
495
|
+
} else {
|
|
496
|
+
history.pushState({}, "", props.href);
|
|
497
|
+
}
|
|
498
|
+
},
|
|
499
|
+
suppressHydrationWarning: true,
|
|
500
|
+
children: children ?? null
|
|
501
|
+
}
|
|
502
|
+
);
|
|
503
|
+
},
|
|
504
|
+
useLinkStatus() {
|
|
505
|
+
return { pending: false };
|
|
506
|
+
},
|
|
507
|
+
__esModule: true
|
|
508
|
+
})),
|
|
509
|
+
"next/dist/client/app-dir/form": self.__remote_component_host_shared_modules__?.["next/form"] ?? shared?.["next/form"] ?? (() => Promise.resolve({
|
|
510
|
+
default: () => {
|
|
511
|
+
throw new Error("Next.js <Form> component not implemented");
|
|
512
|
+
},
|
|
513
|
+
__esModule: true
|
|
514
|
+
})),
|
|
515
|
+
"next/dist/client/image-component": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
|
|
516
|
+
Image: imageImpl(bundle, resolveClientUrl),
|
|
517
|
+
__esModule: true
|
|
518
|
+
})),
|
|
519
|
+
"next/image": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
|
|
520
|
+
default: imageImpl(bundle, resolveClientUrl),
|
|
521
|
+
getImageProps: (_imgProps) => {
|
|
522
|
+
throw new Error(
|
|
523
|
+
"Next.js getImageProps() is not implemented in remote components"
|
|
524
|
+
);
|
|
525
|
+
},
|
|
526
|
+
__esModule: true
|
|
527
|
+
})),
|
|
528
|
+
"next/dist/client/script": self.__remote_component_host_shared_modules__?.["next/script"] ?? shared?.["next/script"] ?? (() => Promise.resolve({
|
|
529
|
+
// TODO: implement <Script> component for non-Next.js host applications
|
|
530
|
+
// do not throw an error for now
|
|
531
|
+
default: () => null,
|
|
532
|
+
__esModule: true
|
|
533
|
+
})),
|
|
534
|
+
"next/router": self.__remote_component_host_shared_modules__?.["next/router"] ?? shared?.["next/router"] ?? (() => (
|
|
535
|
+
// TODO: incomplete implementation
|
|
536
|
+
Promise.resolve({
|
|
537
|
+
useRouter() {
|
|
538
|
+
return {
|
|
539
|
+
push: (routerUrl) => {
|
|
540
|
+
history.pushState({}, "", routerUrl);
|
|
541
|
+
},
|
|
542
|
+
replace: (routerUrl) => {
|
|
543
|
+
history.replaceState({}, "", routerUrl);
|
|
544
|
+
},
|
|
545
|
+
back: () => {
|
|
546
|
+
history.back();
|
|
547
|
+
}
|
|
548
|
+
};
|
|
549
|
+
},
|
|
550
|
+
__esModule: true
|
|
551
|
+
})
|
|
552
|
+
)),
|
|
553
|
+
"next/dist/build/polyfills/process": () => Promise.resolve({
|
|
554
|
+
default: {
|
|
555
|
+
env: {
|
|
556
|
+
NODE_ENV: "production"
|
|
557
|
+
}
|
|
558
|
+
},
|
|
559
|
+
__esModule: true
|
|
560
|
+
})
|
|
561
|
+
};
|
|
562
|
+
polyfill["next/navigation"] = polyfill["next/dist/client/components/navigation"];
|
|
563
|
+
polyfill["next/link"] = polyfill["next/dist/client/app-dir/link"];
|
|
564
|
+
polyfill["next/form"] = polyfill["next/dist/client/app-dir/form"];
|
|
565
|
+
polyfill["next/dist/api/image"] = polyfill["next/dist/client/image-component"];
|
|
566
|
+
polyfill["next/script"] = polyfill["next/dist/client/script"];
|
|
567
|
+
return polyfill;
|
|
568
|
+
}
|
|
569
|
+
var imageImpl;
|
|
570
|
+
var init_polyfill = __esm({
|
|
571
|
+
"src/host/shared/polyfill.tsx"() {
|
|
572
|
+
"use strict";
|
|
573
|
+
init_logger();
|
|
574
|
+
imageImpl = (bundle, resolveClientUrl) => function RemoteImage({
|
|
575
|
+
fill: _fill,
|
|
576
|
+
loader: _loader,
|
|
577
|
+
quality: _quality,
|
|
578
|
+
priority: _priority,
|
|
579
|
+
loading: _loading,
|
|
580
|
+
placeholder: _placeholder,
|
|
581
|
+
blurDataURL: _blurDataURL,
|
|
582
|
+
unoptimized: _unoptimized,
|
|
583
|
+
overrideSrc: _overrideSrc,
|
|
584
|
+
src,
|
|
585
|
+
...props
|
|
586
|
+
}) {
|
|
587
|
+
const newSrc = applyBundleUrlToImagePropsSrc(
|
|
588
|
+
bundle,
|
|
589
|
+
typeof src === "string" ? src : src.src
|
|
590
|
+
);
|
|
591
|
+
const proxiedSrc = resolveClientUrl?.(newSrc) ?? newSrc;
|
|
592
|
+
return (
|
|
593
|
+
// eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
|
|
594
|
+
/* @__PURE__ */ jsx(
|
|
595
|
+
"img",
|
|
596
|
+
{
|
|
597
|
+
decoding: "async",
|
|
598
|
+
style: { color: "transparent" },
|
|
599
|
+
...props,
|
|
600
|
+
src: proxiedSrc,
|
|
601
|
+
suppressHydrationWarning: true
|
|
602
|
+
}
|
|
603
|
+
)
|
|
604
|
+
);
|
|
605
|
+
};
|
|
606
|
+
}
|
|
607
|
+
});
|
|
608
|
+
|
|
609
|
+
// src/runtime/loaders/script-loader.ts
|
|
610
|
+
async function loadScripts(scripts, resolveClientUrl) {
|
|
611
|
+
await Promise.all(
|
|
612
|
+
scripts.map((script) => {
|
|
613
|
+
return new Promise((resolve, reject) => {
|
|
614
|
+
const newSrc = new URL(
|
|
615
|
+
// remove the remote component bundle name identifier from the script src
|
|
616
|
+
script.src.replace(NEXT_BUNDLE_PATH_RE, "/_next/"),
|
|
617
|
+
location.origin
|
|
618
|
+
).href;
|
|
619
|
+
const resolvedSrc = resolveClientUrl?.(newSrc) ?? newSrc;
|
|
620
|
+
const newScript = document.createElement("script");
|
|
621
|
+
newScript.onload = () => resolve();
|
|
622
|
+
newScript.onerror = () => {
|
|
623
|
+
const isProxied = isProxiedUrl(resolvedSrc);
|
|
624
|
+
if (isProxied) {
|
|
625
|
+
reject(failedProxiedAssetError("script", newSrc, resolvedSrc));
|
|
626
|
+
} else {
|
|
627
|
+
warnCrossOriginFetchError("ScriptLoader", newSrc);
|
|
628
|
+
reject(
|
|
629
|
+
new RemoteComponentsError(
|
|
630
|
+
`Failed to load <script src="${newSrc}"> for Remote Component. Check the URL is correct.`
|
|
631
|
+
)
|
|
632
|
+
);
|
|
633
|
+
}
|
|
634
|
+
};
|
|
635
|
+
newScript.src = resolvedSrc;
|
|
636
|
+
newScript.async = true;
|
|
637
|
+
document.head.appendChild(newScript);
|
|
638
|
+
});
|
|
639
|
+
})
|
|
640
|
+
);
|
|
641
|
+
}
|
|
642
|
+
var init_script_loader = __esm({
|
|
643
|
+
"src/runtime/loaders/script-loader.ts"() {
|
|
644
|
+
"use strict";
|
|
645
|
+
init_constants2();
|
|
646
|
+
init_protected_rc_fallback();
|
|
647
|
+
init_error();
|
|
648
|
+
init_logger();
|
|
649
|
+
}
|
|
650
|
+
});
|
|
651
|
+
|
|
652
|
+
// src/host/html/runtime/webpack.ts
|
|
653
|
+
var webpack_exports = {};
|
|
654
|
+
__export(webpack_exports, {
|
|
655
|
+
webpackRuntime: () => webpackRuntime
|
|
656
|
+
});
|
|
657
|
+
async function webpackRuntime(bundle, shared, remoteShared, resolveClientUrl) {
|
|
658
|
+
const self = globalThis;
|
|
659
|
+
if (!self.__DISABLE_WEBPACK_EXEC__) {
|
|
660
|
+
self.__DISABLE_WEBPACK_EXEC__ = {};
|
|
661
|
+
}
|
|
662
|
+
self.__DISABLE_WEBPACK_EXEC__[bundle] = true;
|
|
663
|
+
if (typeof self.__webpack_require__ !== "function" && self.__webpack_require_type__ !== "turbopack") {
|
|
664
|
+
self.__webpack_require__ = (remoteId) => {
|
|
665
|
+
const re = /\[(?<bundle>[^\]]+)\] (?<id>.*)/;
|
|
666
|
+
const match = re.exec(remoteId);
|
|
667
|
+
const remoteBundle = match?.groups?.bundle;
|
|
668
|
+
const id = match?.groups?.id;
|
|
669
|
+
if (!(id && remoteBundle)) {
|
|
670
|
+
throw new RemoteComponentsError(
|
|
671
|
+
`Remote Component module "${remoteId}" not found. Did you forget to wrap the Next.js config with \`withRemoteComponentsConfig\` on both host and remote?`
|
|
672
|
+
);
|
|
673
|
+
}
|
|
674
|
+
if (typeof self.__remote_webpack_require__?.[remoteBundle] !== "function") {
|
|
675
|
+
throw new RemoteComponentsError(
|
|
676
|
+
`Remote Components are not available in "${remoteBundle}". Did you forget to wrap the Next.js config with \`withRemoteComponentsConfig\` on both host and remote?`
|
|
677
|
+
);
|
|
678
|
+
}
|
|
679
|
+
return self.__remote_webpack_require__[remoteBundle](id);
|
|
680
|
+
};
|
|
681
|
+
self.__webpack_chunk_load__ = () => {
|
|
682
|
+
return Promise.resolve([]);
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
const {
|
|
686
|
+
default: { createFromReadableStream }
|
|
687
|
+
} = await import("react-server-dom-webpack/client.browser");
|
|
688
|
+
async function preloadScripts(scripts, url, remoteBundle, _) {
|
|
689
|
+
const scriptSrcs = scripts.flatMap((script) => {
|
|
690
|
+
const scriptSrc = script.getAttribute("src") || script.getAttribute("data-src");
|
|
691
|
+
script.parentElement?.removeChild(script);
|
|
692
|
+
if (!scriptSrc)
|
|
693
|
+
return [];
|
|
694
|
+
return [
|
|
695
|
+
{
|
|
696
|
+
src: new URL(scriptSrc.replace(NEXT_BUNDLE_PATH_RE, "/_next/"), url).href
|
|
697
|
+
}
|
|
698
|
+
];
|
|
699
|
+
});
|
|
700
|
+
await loadScripts(scriptSrcs, resolveClientUrl);
|
|
701
|
+
const hostShared = {
|
|
702
|
+
...sharedPolyfills(shared, resolveClientUrl),
|
|
703
|
+
...self.__remote_component_host_shared_modules__,
|
|
704
|
+
...shared
|
|
705
|
+
};
|
|
706
|
+
const resolve = {
|
|
707
|
+
"/react/index.js": (await import("react")).default,
|
|
708
|
+
"/react/jsx-dev-runtime.js": (await import("react/jsx-dev-runtime")).default,
|
|
709
|
+
"/react/jsx-runtime.js": (await import("react/jsx-runtime")).default,
|
|
710
|
+
"/react-dom/index.js": (await import("react-dom")).default,
|
|
711
|
+
"/react-dom/client.js": (await import("react-dom/client")).default,
|
|
712
|
+
...Object.entries(remoteShared ?? {}).reduce(
|
|
713
|
+
(acc, [key, value]) => {
|
|
714
|
+
if (typeof hostShared[value] !== "undefined") {
|
|
715
|
+
acc[key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, "")] = hostShared[value];
|
|
716
|
+
}
|
|
717
|
+
return acc;
|
|
718
|
+
},
|
|
719
|
+
{}
|
|
720
|
+
)
|
|
721
|
+
};
|
|
722
|
+
await Promise.all(
|
|
723
|
+
Object.entries(resolve).map(async ([key, value]) => {
|
|
724
|
+
if (typeof value === "function") {
|
|
725
|
+
resolve[key] = await value(remoteBundle);
|
|
726
|
+
}
|
|
727
|
+
return Promise.resolve(value);
|
|
728
|
+
})
|
|
729
|
+
);
|
|
730
|
+
applySharedModules(remoteBundle, resolve);
|
|
731
|
+
}
|
|
732
|
+
return {
|
|
733
|
+
self,
|
|
734
|
+
createFromReadableStream,
|
|
735
|
+
applySharedModules,
|
|
736
|
+
nextClientPagesLoader,
|
|
737
|
+
preloadScripts
|
|
738
|
+
};
|
|
739
|
+
}
|
|
740
|
+
var init_webpack = __esm({
|
|
741
|
+
"src/host/html/runtime/webpack.ts"() {
|
|
742
|
+
"use strict";
|
|
743
|
+
init_apply_shared_modules();
|
|
744
|
+
init_next_client_pages_loader();
|
|
745
|
+
init_polyfill();
|
|
746
|
+
init_constants2();
|
|
747
|
+
init_script_loader();
|
|
748
|
+
init_error();
|
|
749
|
+
}
|
|
750
|
+
});
|
|
751
|
+
|
|
752
|
+
// src/runtime/turbopack/patterns.ts
|
|
753
|
+
var REMOTE_SHARED_MARKER_RE, REMOTE_SHARED_ASSIGNMENT_RE, ASYNC_MODULE_LOADER_RE, ASYNC_MODULE_RESOLVE_RE, ASYNC_MODULE_ALL_RE, TURBOPACK_GLOBAL_RE;
|
|
754
|
+
var init_patterns = __esm({
|
|
755
|
+
"src/runtime/turbopack/patterns.ts"() {
|
|
756
|
+
"use strict";
|
|
757
|
+
REMOTE_SHARED_MARKER_RE = /(?:self|[a-z])\.TURBOPACK_REMOTE_SHARED/;
|
|
758
|
+
REMOTE_SHARED_ASSIGNMENT_RE = /\.TURBOPACK_REMOTE_SHARED=await (?:__turbopack_context__|[a-z])\.A\((?<sharedModuleId>[0-9]+)\)/;
|
|
759
|
+
ASYNC_MODULE_LOADER_RE = /(?:__turbopack_context__|e)\.A\((?<asyncSharedModuleId>[0-9]+)\)/;
|
|
760
|
+
ASYNC_MODULE_RESOLVE_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<inner>parentImport|e)=>Promise\.resolve\(\)\.then\(\(\)=>\k<inner>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
|
|
761
|
+
ASYNC_MODULE_ALL_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<vCb>parentImport|t)=>Promise\.all\(\["[^"]+"\]\.map\((?<mapCb>chunk|t)=>\k<ctx>\.l\(\k<mapCb>\)\)\)\.then\(\(\)=>\k<vCb>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
|
|
762
|
+
TURBOPACK_GLOBAL_RE = /(?:globalThis|self)\s*(?:\.TURBOPACK|\[\s*["']TURBOPACK["']\s*\])/;
|
|
763
|
+
}
|
|
764
|
+
});
|
|
765
|
+
|
|
766
|
+
// src/runtime/turbopack/chunk-loader.ts
|
|
767
|
+
function createChunkLoader(runtime, resolveClientUrl) {
|
|
768
|
+
return function __turbopack_chunk_load__(chunkId, scriptBundle) {
|
|
769
|
+
logDebug("ChunkLoader", `Loading chunk: "${chunkId}"`);
|
|
770
|
+
const self = globalThis;
|
|
771
|
+
const {
|
|
772
|
+
bundle,
|
|
773
|
+
id: path,
|
|
774
|
+
prefix
|
|
775
|
+
} = REMOTE_COMPONENT_REGEX.exec(chunkId)?.groups ?? {
|
|
776
|
+
bundle: scriptBundle ?? "",
|
|
777
|
+
id: chunkId
|
|
778
|
+
};
|
|
779
|
+
logDebug(
|
|
780
|
+
"ChunkLoader",
|
|
781
|
+
`Parsed chunk - bundle: "${bundle}", path: "${path}", prefix: "${prefix}"`
|
|
782
|
+
);
|
|
488
783
|
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
489
784
|
logDebug("ChunkLoader", `Remote runtime: "${remoteRuntime}"`);
|
|
490
785
|
if (remoteRuntime === RUNTIME_WEBPACK) {
|
|
@@ -528,11 +823,7 @@ function createChunkLoader(runtime, resolveClientUrl) {
|
|
|
528
823
|
}).then(resolve).catch((error) => {
|
|
529
824
|
const isProxied = isProxiedUrl(resolvedUrl);
|
|
530
825
|
if (isProxied) {
|
|
531
|
-
reject(
|
|
532
|
-
new RemoteComponentsError(
|
|
533
|
-
`Failed to load chunk "${url}" via proxy "${resolvedUrl}". Ensure withRemoteComponentsHost middleware is configured and "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" is in the matcher. See: ${CORS_DOCS_URL}`
|
|
534
|
-
)
|
|
535
|
-
);
|
|
826
|
+
reject(failedProxiedAssetError("chunk", url, resolvedUrl));
|
|
536
827
|
} else {
|
|
537
828
|
warnCrossOriginFetchError("ChunkLoader", url);
|
|
538
829
|
reject(error);
|
|
@@ -680,18 +971,17 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
680
971
|
}
|
|
681
972
|
}
|
|
682
973
|
var init_chunk_loader = __esm({
|
|
683
|
-
"src/
|
|
974
|
+
"src/runtime/turbopack/chunk-loader.ts"() {
|
|
684
975
|
"use strict";
|
|
685
|
-
|
|
976
|
+
init_constants2();
|
|
977
|
+
init_protected_rc_fallback();
|
|
686
978
|
init_error();
|
|
687
979
|
init_logger();
|
|
688
|
-
|
|
689
|
-
init_protected_rc_fallback();
|
|
690
|
-
init_turbopack_patterns();
|
|
980
|
+
init_patterns();
|
|
691
981
|
}
|
|
692
982
|
});
|
|
693
983
|
|
|
694
|
-
// src/
|
|
984
|
+
// src/runtime/turbopack/module.ts
|
|
695
985
|
function handleTurbopackModule(bundle, moduleId, id) {
|
|
696
986
|
const self = globalThis;
|
|
697
987
|
const bundleKey = getBundleKey(bundle);
|
|
@@ -895,733 +1185,276 @@ function createTurbopackContext(bundle, exports, moduleExports, modules, moduleI
|
|
|
895
1185
|
j() {
|
|
896
1186
|
},
|
|
897
1187
|
// chunk loader
|
|
898
|
-
l(url) {
|
|
899
|
-
const flatModules = Array.isArray(modules) ? modules : [];
|
|
900
|
-
const moduleInitIndex = flatModules.indexOf(moduleInit);
|
|
901
|
-
if (moduleInitIndex !== -1) {
|
|
902
|
-
const scriptIndex = flatModules.slice(0, moduleInitIndex).findLastIndex((bundleEntry) => bundleEntry instanceof Element);
|
|
903
|
-
if (scriptIndex !== -1) {
|
|
904
|
-
const script = flatModules[scriptIndex];
|
|
905
|
-
const scriptSrc = script.getAttribute("data-turbopack-src") || "";
|
|
906
|
-
const nextIndex = scriptSrc.indexOf("/_next");
|
|
907
|
-
const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : "";
|
|
908
|
-
const bundleUrl = `[${bundle}] ${baseUrl}/_next/${url}`;
|
|
909
|
-
return self.__webpack_chunk_load__?.(bundleUrl, bundle);
|
|
910
|
-
}
|
|
911
|
-
}
|
|
912
|
-
throw new Error(
|
|
913
|
-
`Failed to load Turbopack chunk "${url}" for module "${id}". Check the URL is correct.`
|
|
914
|
-
);
|
|
915
|
-
},
|
|
916
|
-
// global object for this bundle
|
|
917
|
-
g: self.__remote_components_turbopack_global__?.[bundle],
|
|
918
|
-
m: moduleExports,
|
|
919
|
-
e: exports
|
|
920
|
-
};
|
|
921
|
-
}
|
|
922
|
-
var init_turbopack_module = __esm({
|
|
923
|
-
"src/shared/client/turbopack-module.ts"() {
|
|
924
|
-
"use strict";
|
|
925
|
-
init_logger();
|
|
926
|
-
init_const();
|
|
927
|
-
}
|
|
928
|
-
});
|
|
929
|
-
|
|
930
|
-
// src/shared/client/shared-modules.ts
|
|
931
|
-
async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {}) {
|
|
932
|
-
const self = globalThis;
|
|
933
|
-
self.__remote_shared_modules__ = self.__remote_shared_modules__ ?? {};
|
|
934
|
-
if (!self.__remote_shared_modules__[bundle]) {
|
|
935
|
-
self.__remote_shared_modules__[bundle] = {};
|
|
936
|
-
}
|
|
937
|
-
const bundleKey = getBundleKey(bundle);
|
|
938
|
-
let modules = self[`TURBOPACK_${bundleKey}`];
|
|
939
|
-
if (modules && typeof modules === "object" && "__chunks__" in modules) {
|
|
940
|
-
const chunks = modules.__chunks__;
|
|
941
|
-
modules = chunks.flat();
|
|
942
|
-
}
|
|
943
|
-
let sharedModuleInitializer = null;
|
|
944
|
-
if (modules) {
|
|
945
|
-
const allModules = Array.isArray(modules) ? modules.flat() : Object.entries(modules).flat();
|
|
946
|
-
const sharedModuleInitializerIndex = allModules.findIndex((idOrFunc) => {
|
|
947
|
-
if (typeof idOrFunc !== "function") {
|
|
948
|
-
return false;
|
|
949
|
-
}
|
|
950
|
-
const funcCode = idOrFunc.toString();
|
|
951
|
-
return REMOTE_SHARED_MARKER_RE.test(funcCode);
|
|
952
|
-
});
|
|
953
|
-
if (sharedModuleInitializerIndex > 0) {
|
|
954
|
-
const sharedModuleInitializerCode = allModules[sharedModuleInitializerIndex].toString();
|
|
955
|
-
const sharedModuleInitializerId = allModules[sharedModuleInitializerIndex - 1];
|
|
956
|
-
const { sharedModuleId } = REMOTE_SHARED_ASSIGNMENT_RE.exec(sharedModuleInitializerCode)?.groups ?? {};
|
|
957
|
-
if (sharedModuleId) {
|
|
958
|
-
const { default: sharedModuleInitializerInstance } = handleTurbopackModule(
|
|
959
|
-
bundle,
|
|
960
|
-
sharedModuleId,
|
|
961
|
-
`[${bundle}] ${sharedModuleInitializerId}`
|
|
962
|
-
);
|
|
963
|
-
sharedModuleInitializer = sharedModuleInitializerInstance;
|
|
964
|
-
}
|
|
965
|
-
}
|
|
966
|
-
if (sharedModuleInitializer) {
|
|
967
|
-
const { shared } = await sharedModuleInitializer;
|
|
968
|
-
const sharedModuleIds = extractSharedModuleIds(
|
|
969
|
-
shared,
|
|
970
|
-
bundleKey,
|
|
971
|
-
self
|
|
972
|
-
);
|
|
973
|
-
return Promise.all(
|
|
974
|
-
Object.entries(sharedModuleIds).map(async ([id, module]) => {
|
|
975
|
-
if (self.__remote_shared_modules__?.[bundle]) {
|
|
976
|
-
if (hostShared[module]) {
|
|
977
|
-
self.__remote_shared_modules__[bundle][id] = await hostShared[module](bundle);
|
|
978
|
-
} else {
|
|
979
|
-
logError(
|
|
980
|
-
"SharedModules",
|
|
981
|
-
`Host shared module "${module}" not found for ID ${id}`
|
|
982
|
-
);
|
|
983
|
-
}
|
|
984
|
-
}
|
|
985
|
-
})
|
|
986
|
-
);
|
|
987
|
-
}
|
|
988
|
-
}
|
|
989
|
-
return Promise.all(
|
|
990
|
-
Object.entries(remoteShared).map(async ([id, module]) => {
|
|
991
|
-
if (self.__remote_shared_modules__?.[bundle]) {
|
|
992
|
-
if (hostShared[module]) {
|
|
993
|
-
const normalizedId = id.replace("[app-ssr]", "[app-client]");
|
|
994
|
-
self.__remote_shared_modules__[bundle][normalizedId] = await hostShared[module](bundle);
|
|
995
|
-
} else {
|
|
996
|
-
logError(
|
|
997
|
-
"SharedModules",
|
|
998
|
-
`Shared module "${module}" not found for "${bundle}"`
|
|
999
|
-
);
|
|
1000
|
-
}
|
|
1001
|
-
}
|
|
1002
|
-
})
|
|
1003
|
-
);
|
|
1004
|
-
}
|
|
1005
|
-
function extractSharedModuleIds(shared, bundleKey, self) {
|
|
1006
|
-
return Object.entries(shared).filter(([, value]) => typeof value === "function").reduce((acc, [key, value]) => {
|
|
1007
|
-
const { asyncSharedModuleId } = ASYNC_MODULE_LOADER_RE.exec(value.toString())?.groups ?? {};
|
|
1008
|
-
if (asyncSharedModuleId) {
|
|
1009
|
-
const asyncSharedModuleIdNumber = Number(asyncSharedModuleId);
|
|
1010
|
-
let asyncSharedModule;
|
|
1011
|
-
let turbopackModules = self[`TURBOPACK_${bundleKey}`];
|
|
1012
|
-
if (turbopackModules && typeof turbopackModules === "object" && "__chunks__" in turbopackModules) {
|
|
1013
|
-
const chunks = turbopackModules.__chunks__;
|
|
1014
|
-
turbopackModules = chunks.flat();
|
|
1015
|
-
}
|
|
1016
|
-
const newAllModules = Array.isArray(turbopackModules) ? turbopackModules.flat() : turbopackModules ? Object.entries(turbopackModules).flatMap(([key2, value2]) => [
|
|
1017
|
-
key2,
|
|
1018
|
-
value2
|
|
1019
|
-
]) : [];
|
|
1020
|
-
const asyncSharedModuleIdIndex = newAllModules.indexOf(
|
|
1021
|
-
asyncSharedModuleIdNumber
|
|
1022
|
-
);
|
|
1023
|
-
if (asyncSharedModuleIdIndex !== -1 && typeof newAllModules[asyncSharedModuleIdIndex + 1] === "function") {
|
|
1024
|
-
asyncSharedModule = newAllModules[asyncSharedModuleIdIndex + 1];
|
|
1025
|
-
}
|
|
1026
|
-
if (asyncSharedModule) {
|
|
1027
|
-
const asyncSharedModuleCode = asyncSharedModule.toString();
|
|
1028
|
-
const { sharedModuleId } = ASYNC_MODULE_RESOLVE_RE.exec(asyncSharedModuleCode)?.groups ?? ASYNC_MODULE_ALL_RE.exec(asyncSharedModuleCode)?.groups ?? {};
|
|
1029
|
-
acc[sharedModuleId ?? asyncSharedModuleId] = key.replace(
|
|
1030
|
-
"__remote_shared_module_",
|
|
1031
|
-
""
|
|
1032
|
-
);
|
|
1033
|
-
}
|
|
1034
|
-
}
|
|
1035
|
-
return acc;
|
|
1036
|
-
}, {});
|
|
1037
|
-
}
|
|
1038
|
-
function getSharedModule(bundle, id) {
|
|
1039
|
-
const self = globalThis;
|
|
1040
|
-
for (const [key, value] of Object.entries(
|
|
1041
|
-
self.__remote_shared_modules__?.[bundle] ?? {}
|
|
1042
|
-
)) {
|
|
1043
|
-
if (typeof value !== "undefined" && (typeof id === "string" && id.includes(key) || id === key)) {
|
|
1044
|
-
return value;
|
|
1045
|
-
}
|
|
1046
|
-
}
|
|
1047
|
-
return null;
|
|
1048
|
-
}
|
|
1049
|
-
var init_shared_modules2 = __esm({
|
|
1050
|
-
"src/shared/client/shared-modules.ts"() {
|
|
1051
|
-
"use strict";
|
|
1052
|
-
init_logger();
|
|
1053
|
-
init_const();
|
|
1054
|
-
init_turbopack_module();
|
|
1055
|
-
init_turbopack_patterns();
|
|
1056
|
-
}
|
|
1057
|
-
});
|
|
1058
|
-
|
|
1059
|
-
// src/shared/client/webpack-adapter.ts
|
|
1060
|
-
async function setupWebpackRuntime(runtime, scripts = [], url = new URL(location.href), bundle, shared = {}, remoteShared = {}, resolveClientUrl) {
|
|
1061
|
-
const self = globalThis;
|
|
1062
|
-
if (!self.__remote_bundle_url__) {
|
|
1063
|
-
self.__remote_bundle_url__ = {};
|
|
1064
|
-
}
|
|
1065
|
-
self.__remote_bundle_url__[bundle ?? "default"] = url;
|
|
1066
|
-
self.__webpack_get_script_filename__ = () => null;
|
|
1067
|
-
if (typeof self.__webpack_require__ !== "function" || self.__webpack_require_type__ !== "turbopack") {
|
|
1068
|
-
if (!self.__original_webpack_require__ && !self.__original_webpack_chunk_load__) {
|
|
1069
|
-
self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
|
|
1070
|
-
self.__original_webpack_require__ = self.__webpack_require__;
|
|
1071
|
-
}
|
|
1072
|
-
self.__webpack_chunk_load__ = createChunkLoader(runtime, resolveClientUrl);
|
|
1073
|
-
self.__webpack_require__ = createModuleRequire(runtime);
|
|
1074
|
-
self.__webpack_require_type__ = runtime;
|
|
1075
|
-
if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {
|
|
1076
|
-
const remoteBundle = bundle ?? "default";
|
|
1077
|
-
self.__remote_webpack_require__[remoteBundle] = self.__webpack_require__;
|
|
1078
|
-
self.__remote_webpack_require__[remoteBundle].type = "turbopack";
|
|
1079
|
-
}
|
|
1080
|
-
}
|
|
1081
|
-
if (runtime === RUNTIME_TURBOPACK) {
|
|
1082
|
-
await Promise.all(
|
|
1083
|
-
scripts.map((script) => {
|
|
1084
|
-
if (script.src) {
|
|
1085
|
-
return self.__webpack_chunk_load__?.(script.src, bundle);
|
|
1086
|
-
}
|
|
1087
|
-
return Promise.resolve(void 0);
|
|
1088
|
-
})
|
|
1089
|
-
);
|
|
1090
|
-
}
|
|
1091
|
-
const coreShared = {
|
|
1092
|
-
react: async () => (await import("react")).default,
|
|
1093
|
-
"react-dom": async () => (await import("react-dom")).default,
|
|
1094
|
-
"react/jsx-dev-runtime": async () => (await import("react/jsx-dev-runtime")).default,
|
|
1095
|
-
"react/jsx-runtime": async () => (await import("react/jsx-runtime")).default,
|
|
1096
|
-
"react-dom/client": async () => (await import("react-dom/client")).default,
|
|
1097
|
-
...shared
|
|
1098
|
-
};
|
|
1099
|
-
await initializeSharedModules(
|
|
1100
|
-
bundle ?? "default",
|
|
1101
|
-
// include all core modules as shared
|
|
1102
|
-
coreShared,
|
|
1103
|
-
remoteShared
|
|
1104
|
-
);
|
|
1105
|
-
}
|
|
1106
|
-
function createModuleRequire(runtime) {
|
|
1107
|
-
return (id) => {
|
|
1108
|
-
const self = globalThis;
|
|
1109
|
-
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
1110
|
-
bundle: "default",
|
|
1111
|
-
id
|
|
1112
|
-
};
|
|
1113
|
-
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
1114
|
-
logDebug("WebpackAdapter", `remoteRuntime: "${remoteRuntime}"`);
|
|
1115
|
-
try {
|
|
1116
|
-
if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {
|
|
1117
|
-
return self.__remote_webpack_require__?.[bundle]?.(moduleId);
|
|
1118
|
-
}
|
|
1119
|
-
const sharedModuleId = moduleId ?? id;
|
|
1120
|
-
const sharedModule = getSharedModule(bundle ?? "default", sharedModuleId);
|
|
1121
|
-
if (sharedModule) {
|
|
1122
|
-
return sharedModule;
|
|
1123
|
-
}
|
|
1124
|
-
if (bundle && moduleId) {
|
|
1125
|
-
return handleTurbopackModule(bundle, moduleId, id);
|
|
1188
|
+
l(url) {
|
|
1189
|
+
const flatModules = Array.isArray(modules) ? modules : [];
|
|
1190
|
+
const moduleInitIndex = flatModules.indexOf(moduleInit);
|
|
1191
|
+
if (moduleInitIndex !== -1) {
|
|
1192
|
+
const scriptIndex = flatModules.slice(0, moduleInitIndex).findLastIndex((bundleEntry) => bundleEntry instanceof Element);
|
|
1193
|
+
if (scriptIndex !== -1) {
|
|
1194
|
+
const script = flatModules[scriptIndex];
|
|
1195
|
+
const scriptSrc = script.getAttribute("data-turbopack-src") || "";
|
|
1196
|
+
const nextIndex = scriptSrc.indexOf("/_next");
|
|
1197
|
+
const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : "";
|
|
1198
|
+
const bundleUrl = `[${bundle}] ${baseUrl}/_next/${url}`;
|
|
1199
|
+
return self.__webpack_chunk_load__?.(bundleUrl, bundle);
|
|
1200
|
+
}
|
|
1126
1201
|
}
|
|
1127
|
-
throw new Error(
|
|
1128
|
-
|
|
1129
|
-
logWarn(
|
|
1130
|
-
"WebpackAdapter",
|
|
1131
|
-
`Module require failed: ${String(requireError)}`
|
|
1202
|
+
throw new Error(
|
|
1203
|
+
`Failed to load Turbopack chunk "${url}" for module "${id}". Check the URL is correct.`
|
|
1132
1204
|
);
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
}
|
|
1139
|
-
);
|
|
1140
|
-
}
|
|
1141
|
-
try {
|
|
1142
|
-
logDebug("WebpackAdapter", "Falling back to original webpack require");
|
|
1143
|
-
return self.__original_webpack_require__(id);
|
|
1144
|
-
} catch (originalError) {
|
|
1145
|
-
throw new RemoteComponentsError(
|
|
1146
|
-
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
1147
|
-
{ cause: originalError instanceof Error ? originalError : void 0 }
|
|
1148
|
-
);
|
|
1149
|
-
}
|
|
1150
|
-
}
|
|
1205
|
+
},
|
|
1206
|
+
// global object for this bundle
|
|
1207
|
+
g: self.__remote_components_turbopack_global__?.[bundle],
|
|
1208
|
+
m: moduleExports,
|
|
1209
|
+
e: exports
|
|
1151
1210
|
};
|
|
1152
1211
|
}
|
|
1153
|
-
var
|
|
1154
|
-
"src/
|
|
1212
|
+
var init_module = __esm({
|
|
1213
|
+
"src/runtime/turbopack/module.ts"() {
|
|
1155
1214
|
"use strict";
|
|
1156
|
-
|
|
1215
|
+
init_constants2();
|
|
1157
1216
|
init_logger();
|
|
1158
|
-
init_chunk_loader();
|
|
1159
|
-
init_const();
|
|
1160
|
-
init_shared_modules2();
|
|
1161
|
-
init_turbopack_module();
|
|
1162
1217
|
}
|
|
1163
1218
|
});
|
|
1164
1219
|
|
|
1165
|
-
// src/
|
|
1166
|
-
async function
|
|
1167
|
-
const resolvedUrl = resolveClientUrl(absoluteSrc) ?? absoluteSrc;
|
|
1168
|
-
const fetchUrl = new URL(resolvedUrl, location.href).href;
|
|
1169
|
-
const response = await fetch(fetchUrl);
|
|
1170
|
-
if (!response.ok)
|
|
1171
|
-
throw new Error(`Proxied fetch failed: ${response.status}`);
|
|
1172
|
-
const content = (await response.text()).replace(/import\.meta\.url/g, JSON.stringify(absoluteSrc)).replace(
|
|
1173
|
-
/\b(from|import)\s*(["'])(\.\.?\/[^"']+)\2/g,
|
|
1174
|
-
(_, keyword, quote, relativePath) => {
|
|
1175
|
-
const absoluteImportUrl = new URL(relativePath, absoluteSrc).href;
|
|
1176
|
-
const resolvedImportUrl = new URL(
|
|
1177
|
-
resolveClientUrl(absoluteImportUrl) ?? absoluteImportUrl,
|
|
1178
|
-
location.href
|
|
1179
|
-
).href;
|
|
1180
|
-
return `${keyword} ${quote}${resolvedImportUrl}${quote}`;
|
|
1181
|
-
}
|
|
1182
|
-
);
|
|
1183
|
-
const moduleBlobUrl = URL.createObjectURL(
|
|
1184
|
-
new Blob([content], { type: "text/javascript" })
|
|
1185
|
-
);
|
|
1186
|
-
const wrapperContent = [
|
|
1187
|
-
`import*as m from${JSON.stringify(moduleBlobUrl)};`,
|
|
1188
|
-
`globalThis.__rc_module_registry__=globalThis.__rc_module_registry__||{};`,
|
|
1189
|
-
`globalThis.__rc_module_registry__[${JSON.stringify(absoluteSrc)}]=m;`
|
|
1190
|
-
].join("");
|
|
1191
|
-
const wrapperBlobUrl = URL.createObjectURL(
|
|
1192
|
-
new Blob([wrapperContent], { type: "text/javascript" })
|
|
1193
|
-
);
|
|
1194
|
-
const scriptEl = document.createElement("script");
|
|
1195
|
-
scriptEl.type = "module";
|
|
1196
|
-
scriptEl.src = wrapperBlobUrl;
|
|
1197
|
-
try {
|
|
1198
|
-
await new Promise((resolve, reject) => {
|
|
1199
|
-
scriptEl.onload = () => resolve();
|
|
1200
|
-
scriptEl.onerror = () => reject(new Error(`Failed to load module for ${absoluteSrc}`));
|
|
1201
|
-
document.head.appendChild(scriptEl);
|
|
1202
|
-
});
|
|
1203
|
-
} finally {
|
|
1204
|
-
scriptEl.remove();
|
|
1205
|
-
URL.revokeObjectURL(moduleBlobUrl);
|
|
1206
|
-
URL.revokeObjectURL(wrapperBlobUrl);
|
|
1207
|
-
}
|
|
1208
|
-
const registry = globalThis.__rc_module_registry__;
|
|
1209
|
-
const mod = registry?.[absoluteSrc] ?? {};
|
|
1210
|
-
if (registry)
|
|
1211
|
-
delete registry[absoluteSrc];
|
|
1212
|
-
return mod;
|
|
1213
|
-
}
|
|
1214
|
-
async function importDirectly(absoluteSrc) {
|
|
1215
|
-
try {
|
|
1216
|
-
return await import(
|
|
1217
|
-
/* @vite-ignore */
|
|
1218
|
-
/* webpackIgnore: true */
|
|
1219
|
-
absoluteSrc
|
|
1220
|
-
);
|
|
1221
|
-
} catch (importError) {
|
|
1222
|
-
if (!absoluteSrc.startsWith("blob:")) {
|
|
1223
|
-
warnCrossOriginFetchError("StaticLoader", absoluteSrc);
|
|
1224
|
-
}
|
|
1225
|
-
throw importError;
|
|
1226
|
-
}
|
|
1227
|
-
}
|
|
1228
|
-
function resolveScriptSrc(script, url) {
|
|
1229
|
-
const rawSrc = typeof script.getAttribute === "function" ? script.getAttribute("src") ?? script.src : script.src;
|
|
1230
|
-
if (!rawSrc && script.textContent) {
|
|
1231
|
-
return URL.createObjectURL(
|
|
1232
|
-
new Blob(
|
|
1233
|
-
[script.textContent.replace(/import\.meta\.url/g, JSON.stringify(url))],
|
|
1234
|
-
{ type: "text/javascript" }
|
|
1235
|
-
)
|
|
1236
|
-
);
|
|
1237
|
-
}
|
|
1238
|
-
return rawSrc;
|
|
1239
|
-
}
|
|
1240
|
-
async function loadStaticRemoteComponent(scripts, url, resolveClientUrl) {
|
|
1220
|
+
// src/runtime/turbopack/shared-modules.ts
|
|
1221
|
+
async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {}) {
|
|
1241
1222
|
const self = globalThis;
|
|
1242
|
-
|
|
1243
|
-
|
|
1223
|
+
self.__remote_shared_modules__ = self.__remote_shared_modules__ ?? {};
|
|
1224
|
+
if (!self.__remote_shared_modules__[bundle]) {
|
|
1225
|
+
self.__remote_shared_modules__[bundle] = {};
|
|
1244
1226
|
}
|
|
1245
|
-
|
|
1246
|
-
|
|
1227
|
+
const bundleKey = getBundleKey(bundle);
|
|
1228
|
+
let modules = self[`TURBOPACK_${bundleKey}`];
|
|
1229
|
+
if (modules && typeof modules === "object" && "__chunks__" in modules) {
|
|
1230
|
+
const chunks = modules.__chunks__;
|
|
1231
|
+
modules = chunks.flat();
|
|
1247
1232
|
}
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1233
|
+
let sharedModuleInitializer = null;
|
|
1234
|
+
if (modules) {
|
|
1235
|
+
const allModules = Array.isArray(modules) ? modules.flat() : Object.entries(modules).flat();
|
|
1236
|
+
const sharedModuleInitializerIndex = allModules.findIndex((idOrFunc) => {
|
|
1237
|
+
if (typeof idOrFunc !== "function") {
|
|
1238
|
+
return false;
|
|
1239
|
+
}
|
|
1240
|
+
const funcCode = idOrFunc.toString();
|
|
1241
|
+
return REMOTE_SHARED_MARKER_RE.test(funcCode);
|
|
1242
|
+
});
|
|
1243
|
+
if (sharedModuleInitializerIndex > 0) {
|
|
1244
|
+
const sharedModuleInitializerCode = allModules[sharedModuleInitializerIndex].toString();
|
|
1245
|
+
const sharedModuleInitializerId = allModules[sharedModuleInitializerIndex - 1];
|
|
1246
|
+
const { sharedModuleId } = REMOTE_SHARED_ASSIGNMENT_RE.exec(sharedModuleInitializerCode)?.groups ?? {};
|
|
1247
|
+
if (sharedModuleId) {
|
|
1248
|
+
const { default: sharedModuleInitializerInstance } = handleTurbopackModule(
|
|
1249
|
+
bundle,
|
|
1250
|
+
sharedModuleId,
|
|
1251
|
+
`[${bundle}] ${sharedModuleInitializerId}`
|
|
1252
|
+
);
|
|
1253
|
+
sharedModuleInitializer = sharedModuleInitializerInstance;
|
|
1254
|
+
}
|
|
1255
|
+
}
|
|
1256
|
+
if (sharedModuleInitializer) {
|
|
1257
|
+
const { shared } = await sharedModuleInitializer;
|
|
1258
|
+
const sharedModuleIds = extractSharedModuleIds(
|
|
1259
|
+
shared,
|
|
1260
|
+
bundleKey,
|
|
1261
|
+
self
|
|
1262
|
+
);
|
|
1263
|
+
return Promise.all(
|
|
1264
|
+
Object.entries(sharedModuleIds).map(async ([id, module]) => {
|
|
1265
|
+
if (self.__remote_shared_modules__?.[bundle]) {
|
|
1266
|
+
if (hostShared[module]) {
|
|
1267
|
+
self.__remote_shared_modules__[bundle][id] = await hostShared[module](bundle);
|
|
1268
|
+
} else {
|
|
1269
|
+
logError(
|
|
1270
|
+
"SharedModules",
|
|
1271
|
+
`Host shared module "${module}" not found for ID ${id}. ${DEDUPLICATION_WARNING}`
|
|
1272
|
+
);
|
|
1273
|
+
}
|
|
1275
1274
|
}
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1275
|
+
})
|
|
1276
|
+
);
|
|
1277
|
+
}
|
|
1278
|
+
}
|
|
1279
|
+
return Promise.all(
|
|
1280
|
+
Object.entries(remoteShared).map(async ([id, module]) => {
|
|
1281
|
+
if (self.__remote_shared_modules__?.[bundle]) {
|
|
1282
|
+
if (hostShared[module]) {
|
|
1283
|
+
const normalizedId = id.replace("[app-ssr]", "[app-client]");
|
|
1284
|
+
self.__remote_shared_modules__[bundle][normalizedId] = await hostShared[module](bundle);
|
|
1285
|
+
} else {
|
|
1286
|
+
logError(
|
|
1287
|
+
"SharedModules",
|
|
1288
|
+
`Shared module "${module}" not found for "${bundle}". ${DEDUPLICATION_WARNING}`
|
|
1279
1289
|
);
|
|
1280
1290
|
}
|
|
1281
|
-
return {
|
|
1282
|
-
mount: mod.mount || mod.default?.mount,
|
|
1283
|
-
unmount: mod.unmount || mod.default?.unmount
|
|
1284
|
-
};
|
|
1285
|
-
} catch (e) {
|
|
1286
|
-
logError(
|
|
1287
|
-
"StaticLoader",
|
|
1288
|
-
`Error loading remote component script from "${script.src || url.href}".`,
|
|
1289
|
-
e
|
|
1290
|
-
);
|
|
1291
|
-
return {
|
|
1292
|
-
mount: void 0,
|
|
1293
|
-
unmount: void 0
|
|
1294
|
-
};
|
|
1295
1291
|
}
|
|
1296
1292
|
})
|
|
1297
1293
|
);
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1294
|
+
}
|
|
1295
|
+
function extractSharedModuleIds(shared, bundleKey, self) {
|
|
1296
|
+
return Object.entries(shared).filter(([, value]) => typeof value === "function").reduce((acc, [key, value]) => {
|
|
1297
|
+
const { asyncSharedModuleId } = ASYNC_MODULE_LOADER_RE.exec(value.toString())?.groups ?? {};
|
|
1298
|
+
if (asyncSharedModuleId) {
|
|
1299
|
+
const asyncSharedModuleIdNumber = Number(asyncSharedModuleId);
|
|
1300
|
+
let asyncSharedModule;
|
|
1301
|
+
let turbopackModules = self[`TURBOPACK_${bundleKey}`];
|
|
1302
|
+
if (turbopackModules && typeof turbopackModules === "object" && "__chunks__" in turbopackModules) {
|
|
1303
|
+
const chunks = turbopackModules.__chunks__;
|
|
1304
|
+
turbopackModules = chunks.flat();
|
|
1302
1305
|
}
|
|
1303
|
-
|
|
1304
|
-
|
|
1306
|
+
const newAllModules = Array.isArray(turbopackModules) ? turbopackModules.flat() : turbopackModules ? Object.entries(turbopackModules).flatMap(([key2, value2]) => [
|
|
1307
|
+
key2,
|
|
1308
|
+
value2
|
|
1309
|
+
]) : [];
|
|
1310
|
+
const asyncSharedModuleIdIndex = newAllModules.indexOf(
|
|
1311
|
+
asyncSharedModuleIdNumber
|
|
1312
|
+
);
|
|
1313
|
+
if (asyncSharedModuleIdIndex !== -1 && typeof newAllModules[asyncSharedModuleIdIndex + 1] === "function") {
|
|
1314
|
+
asyncSharedModule = newAllModules[asyncSharedModuleIdIndex + 1];
|
|
1315
|
+
}
|
|
1316
|
+
if (asyncSharedModule) {
|
|
1317
|
+
const asyncSharedModuleCode = asyncSharedModule.toString();
|
|
1318
|
+
const { sharedModuleId } = ASYNC_MODULE_RESOLVE_RE.exec(asyncSharedModuleCode)?.groups ?? ASYNC_MODULE_ALL_RE.exec(asyncSharedModuleCode)?.groups ?? {};
|
|
1319
|
+
acc[sharedModuleId ?? asyncSharedModuleId] = key.replace(
|
|
1320
|
+
"__remote_shared_module_",
|
|
1321
|
+
""
|
|
1322
|
+
);
|
|
1305
1323
|
}
|
|
1306
|
-
return acc;
|
|
1307
|
-
},
|
|
1308
|
-
{
|
|
1309
|
-
mount: /* @__PURE__ */ new Set(),
|
|
1310
|
-
unmount: /* @__PURE__ */ new Set()
|
|
1311
1324
|
}
|
|
1312
|
-
|
|
1325
|
+
return acc;
|
|
1326
|
+
}, {});
|
|
1313
1327
|
}
|
|
1314
|
-
|
|
1315
|
-
|
|
1328
|
+
function getSharedModule(bundle, id) {
|
|
1329
|
+
const self = globalThis;
|
|
1330
|
+
for (const [key, value] of Object.entries(
|
|
1331
|
+
self.__remote_shared_modules__?.[bundle] ?? {}
|
|
1332
|
+
)) {
|
|
1333
|
+
if (typeof value !== "undefined" && (typeof id === "string" && id.includes(key) || id === key)) {
|
|
1334
|
+
return value;
|
|
1335
|
+
}
|
|
1336
|
+
}
|
|
1337
|
+
return null;
|
|
1338
|
+
}
|
|
1339
|
+
var DEDUPLICATION_WARNING;
|
|
1340
|
+
var init_shared_modules = __esm({
|
|
1341
|
+
"src/runtime/turbopack/shared-modules.ts"() {
|
|
1316
1342
|
"use strict";
|
|
1343
|
+
init_constants2();
|
|
1317
1344
|
init_logger();
|
|
1345
|
+
init_module();
|
|
1346
|
+
init_patterns();
|
|
1347
|
+
DEDUPLICATION_WARNING = "This module will not be deduplicated \u2014 the remote may load its own copy, which can cause duplicate instance errors (e.g. invalid hook calls if React is loaded twice).";
|
|
1318
1348
|
}
|
|
1319
1349
|
});
|
|
1320
1350
|
|
|
1321
|
-
// src/
|
|
1322
|
-
|
|
1323
|
-
function applyBundleUrlToSrc(bundle, src) {
|
|
1351
|
+
// src/runtime/turbopack/webpack-runtime.ts
|
|
1352
|
+
async function setupWebpackRuntime(runtime, scripts = [], url = new URL(location.href), bundle, shared = {}, remoteShared = {}, resolveClientUrl) {
|
|
1324
1353
|
const self = globalThis;
|
|
1325
|
-
if (self.__remote_bundle_url__
|
|
1326
|
-
|
|
1327
|
-
}
|
|
1328
|
-
const { assetPrefix, path } = /^(?<assetPrefix>.*?)\/_next\/(?<path>.*)/.exec(src)?.groups ?? {};
|
|
1329
|
-
if (!path) {
|
|
1330
|
-
return new URL(src, self.__remote_bundle_url__?.[bundle]?.origin).href;
|
|
1354
|
+
if (!self.__remote_bundle_url__) {
|
|
1355
|
+
self.__remote_bundle_url__ = {};
|
|
1331
1356
|
}
|
|
1332
|
-
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1357
|
+
self.__remote_bundle_url__[bundle ?? "default"] = url;
|
|
1358
|
+
self.__webpack_get_script_filename__ = () => null;
|
|
1359
|
+
if (typeof self.__webpack_require__ !== "function" || self.__webpack_require_type__ !== "turbopack") {
|
|
1360
|
+
if (!self.__original_webpack_require__ && !self.__original_webpack_chunk_load__) {
|
|
1361
|
+
self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
|
|
1362
|
+
self.__original_webpack_require__ = self.__webpack_require__;
|
|
1363
|
+
}
|
|
1364
|
+
self.__webpack_chunk_load__ = createChunkLoader(runtime, resolveClientUrl);
|
|
1365
|
+
self.__webpack_require__ = createModuleRequire(runtime);
|
|
1366
|
+
self.__webpack_require_type__ = runtime;
|
|
1367
|
+
if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {
|
|
1368
|
+
const remoteBundle = bundle ?? "default";
|
|
1369
|
+
self.__remote_webpack_require__[remoteBundle] = self.__webpack_require__;
|
|
1370
|
+
self.__remote_webpack_require__[remoteBundle].type = "turbopack";
|
|
1371
|
+
}
|
|
1337
1372
|
}
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1343
|
-
const polyfill = {
|
|
1344
|
-
"next/dist/client/components/navigation": self.__remote_component_host_shared_modules__?.["next/navigation"] ?? shared?.["next/navigation"] ?? (() => Promise.resolve({
|
|
1345
|
-
useRouter() {
|
|
1346
|
-
return {
|
|
1347
|
-
push: (routerUrl) => {
|
|
1348
|
-
history.pushState({}, "", routerUrl);
|
|
1349
|
-
},
|
|
1350
|
-
replace: (routerUrl) => {
|
|
1351
|
-
history.replaceState({}, "", routerUrl);
|
|
1352
|
-
},
|
|
1353
|
-
back: () => {
|
|
1354
|
-
history.back();
|
|
1355
|
-
}
|
|
1356
|
-
};
|
|
1357
|
-
},
|
|
1358
|
-
usePathname() {
|
|
1359
|
-
return location.pathname;
|
|
1360
|
-
},
|
|
1361
|
-
useParams() {
|
|
1362
|
-
return {};
|
|
1363
|
-
},
|
|
1364
|
-
useSearchParams() {
|
|
1365
|
-
return new URLSearchParams(location.search);
|
|
1366
|
-
},
|
|
1367
|
-
useSelectedLayoutSegment() {
|
|
1368
|
-
return null;
|
|
1369
|
-
},
|
|
1370
|
-
useSelectedLayoutSegments() {
|
|
1371
|
-
return [];
|
|
1372
|
-
},
|
|
1373
|
-
__esModule: true
|
|
1374
|
-
})),
|
|
1375
|
-
"next/dist/client/app-dir/link": self.__remote_component_host_shared_modules__?.["next/link"] ?? shared?.["next/link"] ?? (() => Promise.resolve({
|
|
1376
|
-
default: ({
|
|
1377
|
-
scroll: _,
|
|
1378
|
-
replace,
|
|
1379
|
-
prefetch,
|
|
1380
|
-
onNavigate,
|
|
1381
|
-
children,
|
|
1382
|
-
...props
|
|
1383
|
-
}) => {
|
|
1384
|
-
if (prefetch) {
|
|
1385
|
-
logWarn(
|
|
1386
|
-
"Polyfill",
|
|
1387
|
-
"Next.js Link prefetch is not supported in remote components"
|
|
1388
|
-
);
|
|
1373
|
+
if (runtime === RUNTIME_TURBOPACK) {
|
|
1374
|
+
await Promise.all(
|
|
1375
|
+
scripts.map((script) => {
|
|
1376
|
+
if (script.src) {
|
|
1377
|
+
return self.__webpack_chunk_load__?.(script.src, bundle);
|
|
1389
1378
|
}
|
|
1390
|
-
return
|
|
1391
|
-
"a",
|
|
1392
|
-
{
|
|
1393
|
-
...props,
|
|
1394
|
-
href: props.href,
|
|
1395
|
-
onClick: (e) => {
|
|
1396
|
-
e.preventDefault();
|
|
1397
|
-
let preventDefaulted = false;
|
|
1398
|
-
e.preventDefault = () => {
|
|
1399
|
-
preventDefaulted = true;
|
|
1400
|
-
e.defaultPrevented = true;
|
|
1401
|
-
};
|
|
1402
|
-
if (typeof props.onClick === "function") {
|
|
1403
|
-
props.onClick(e);
|
|
1404
|
-
}
|
|
1405
|
-
onNavigate?.(e);
|
|
1406
|
-
if (preventDefaulted) {
|
|
1407
|
-
return;
|
|
1408
|
-
}
|
|
1409
|
-
if (replace) {
|
|
1410
|
-
history.replaceState({}, "", props.href);
|
|
1411
|
-
} else {
|
|
1412
|
-
history.pushState({}, "", props.href);
|
|
1413
|
-
}
|
|
1414
|
-
},
|
|
1415
|
-
suppressHydrationWarning: true,
|
|
1416
|
-
children: children ?? null
|
|
1417
|
-
}
|
|
1418
|
-
);
|
|
1419
|
-
},
|
|
1420
|
-
useLinkStatus() {
|
|
1421
|
-
return { pending: false };
|
|
1422
|
-
},
|
|
1423
|
-
__esModule: true
|
|
1424
|
-
})),
|
|
1425
|
-
"next/dist/client/app-dir/form": self.__remote_component_host_shared_modules__?.["next/form"] ?? shared?.["next/form"] ?? (() => Promise.resolve({
|
|
1426
|
-
default: () => {
|
|
1427
|
-
throw new Error("Next.js <Form> component not implemented");
|
|
1428
|
-
},
|
|
1429
|
-
__esModule: true
|
|
1430
|
-
})),
|
|
1431
|
-
"next/dist/client/image-component": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
|
|
1432
|
-
Image: imageImpl(bundle),
|
|
1433
|
-
__esModule: true
|
|
1434
|
-
})),
|
|
1435
|
-
"next/image": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
|
|
1436
|
-
default: imageImpl(bundle),
|
|
1437
|
-
getImageProps: (_imgProps) => {
|
|
1438
|
-
throw new Error(
|
|
1439
|
-
"Next.js getImageProps() is not implemented in remote components"
|
|
1440
|
-
);
|
|
1441
|
-
},
|
|
1442
|
-
__esModule: true
|
|
1443
|
-
})),
|
|
1444
|
-
"next/dist/client/script": self.__remote_component_host_shared_modules__?.["next/script"] ?? shared?.["next/script"] ?? (() => Promise.resolve({
|
|
1445
|
-
// TODO: implement <Script> component for non-Next.js host applications
|
|
1446
|
-
// do not throw an error for now
|
|
1447
|
-
default: () => null,
|
|
1448
|
-
__esModule: true
|
|
1449
|
-
})),
|
|
1450
|
-
"next/router": self.__remote_component_host_shared_modules__?.["next/router"] ?? shared?.["next/router"] ?? (() => (
|
|
1451
|
-
// TODO: incomplete implementation
|
|
1452
|
-
Promise.resolve({
|
|
1453
|
-
useRouter() {
|
|
1454
|
-
return {
|
|
1455
|
-
push: (routerUrl) => {
|
|
1456
|
-
history.pushState({}, "", routerUrl);
|
|
1457
|
-
},
|
|
1458
|
-
replace: (routerUrl) => {
|
|
1459
|
-
history.replaceState({}, "", routerUrl);
|
|
1460
|
-
},
|
|
1461
|
-
back: () => {
|
|
1462
|
-
history.back();
|
|
1463
|
-
}
|
|
1464
|
-
};
|
|
1465
|
-
},
|
|
1466
|
-
__esModule: true
|
|
1379
|
+
return Promise.resolve(void 0);
|
|
1467
1380
|
})
|
|
1468
|
-
)
|
|
1469
|
-
|
|
1470
|
-
|
|
1471
|
-
|
|
1472
|
-
|
|
1473
|
-
|
|
1474
|
-
|
|
1475
|
-
|
|
1476
|
-
|
|
1381
|
+
);
|
|
1382
|
+
}
|
|
1383
|
+
const coreShared = {
|
|
1384
|
+
react: async () => (await import("react")).default,
|
|
1385
|
+
"react-dom": async () => (await import("react-dom")).default,
|
|
1386
|
+
"react/jsx-dev-runtime": async () => (await import("react/jsx-dev-runtime")).default,
|
|
1387
|
+
"react/jsx-runtime": async () => (await import("react/jsx-runtime")).default,
|
|
1388
|
+
"react-dom/client": async () => (await import("react-dom/client")).default,
|
|
1389
|
+
...shared
|
|
1477
1390
|
};
|
|
1478
|
-
|
|
1479
|
-
|
|
1480
|
-
|
|
1481
|
-
|
|
1482
|
-
|
|
1483
|
-
|
|
1391
|
+
await initializeSharedModules(
|
|
1392
|
+
bundle ?? "default",
|
|
1393
|
+
// include all core modules as shared
|
|
1394
|
+
coreShared,
|
|
1395
|
+
remoteShared
|
|
1396
|
+
);
|
|
1484
1397
|
}
|
|
1485
|
-
|
|
1486
|
-
|
|
1487
|
-
|
|
1488
|
-
|
|
1489
|
-
|
|
1490
|
-
|
|
1491
|
-
|
|
1492
|
-
|
|
1493
|
-
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1498
|
-
|
|
1499
|
-
|
|
1500
|
-
|
|
1501
|
-
|
|
1502
|
-
|
|
1503
|
-
|
|
1504
|
-
bundle,
|
|
1505
|
-
|
|
1398
|
+
function createModuleRequire(runtime) {
|
|
1399
|
+
return (id) => {
|
|
1400
|
+
const self = globalThis;
|
|
1401
|
+
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
1402
|
+
bundle: "default",
|
|
1403
|
+
id
|
|
1404
|
+
};
|
|
1405
|
+
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
1406
|
+
logDebug("WebpackRuntime", `remoteRuntime: "${remoteRuntime}"`);
|
|
1407
|
+
try {
|
|
1408
|
+
if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {
|
|
1409
|
+
return self.__remote_webpack_require__?.[bundle]?.(moduleId);
|
|
1410
|
+
}
|
|
1411
|
+
const sharedModuleId = moduleId ?? id;
|
|
1412
|
+
const sharedModule = getSharedModule(bundle ?? "default", sharedModuleId);
|
|
1413
|
+
if (sharedModule) {
|
|
1414
|
+
return sharedModule;
|
|
1415
|
+
}
|
|
1416
|
+
if (bundle && moduleId) {
|
|
1417
|
+
return handleTurbopackModule(bundle, moduleId, id);
|
|
1418
|
+
}
|
|
1419
|
+
throw new Error(`Module "${id}" not found.`);
|
|
1420
|
+
} catch (requireError) {
|
|
1421
|
+
logWarn(
|
|
1422
|
+
"WebpackRuntime",
|
|
1423
|
+
`Module require failed: ${String(requireError)}`
|
|
1506
1424
|
);
|
|
1507
|
-
|
|
1508
|
-
|
|
1509
|
-
|
|
1510
|
-
"img",
|
|
1425
|
+
if (typeof self.__original_webpack_require__ !== "function") {
|
|
1426
|
+
throw new RemoteComponentsError(
|
|
1427
|
+
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
1511
1428
|
{
|
|
1512
|
-
|
|
1513
|
-
style: { color: "transparent" },
|
|
1514
|
-
...props,
|
|
1515
|
-
src: newSrc,
|
|
1516
|
-
suppressHydrationWarning: true
|
|
1429
|
+
cause: requireError instanceof Error ? requireError : void 0
|
|
1517
1430
|
}
|
|
1518
|
-
)
|
|
1519
|
-
);
|
|
1520
|
-
};
|
|
1521
|
-
}
|
|
1522
|
-
});
|
|
1523
|
-
|
|
1524
|
-
// src/html/host/runtime/webpack.ts
|
|
1525
|
-
var webpack_exports = {};
|
|
1526
|
-
__export(webpack_exports, {
|
|
1527
|
-
webpackRuntime: () => webpackRuntime
|
|
1528
|
-
});
|
|
1529
|
-
async function webpackRuntime(bundle, shared, remoteShared, resolveClientUrl) {
|
|
1530
|
-
const self = globalThis;
|
|
1531
|
-
if (!self.__DISABLE_WEBPACK_EXEC__) {
|
|
1532
|
-
self.__DISABLE_WEBPACK_EXEC__ = {};
|
|
1533
|
-
}
|
|
1534
|
-
self.__DISABLE_WEBPACK_EXEC__[bundle] = true;
|
|
1535
|
-
if (typeof self.__webpack_require__ !== "function" && self.__webpack_require_type__ !== "turbopack") {
|
|
1536
|
-
self.__webpack_require__ = (remoteId) => {
|
|
1537
|
-
const re = /\[(?<bundle>[^\]]+)\] (?<id>.*)/;
|
|
1538
|
-
const match = re.exec(remoteId);
|
|
1539
|
-
const remoteBundle = match?.groups?.bundle;
|
|
1540
|
-
const id = match?.groups?.id;
|
|
1541
|
-
if (!(id && remoteBundle)) {
|
|
1542
|
-
throw new RemoteComponentsError(
|
|
1543
|
-
`Remote Component module "${remoteId}" not found. Did you forget to wrap the Next.js config with \`withRemoteComponents\` on both host and remote?`
|
|
1544
1431
|
);
|
|
1545
1432
|
}
|
|
1546
|
-
|
|
1433
|
+
try {
|
|
1434
|
+
logDebug("WebpackRuntime", "Falling back to original webpack require");
|
|
1435
|
+
return self.__original_webpack_require__(id);
|
|
1436
|
+
} catch (originalError) {
|
|
1547
1437
|
throw new RemoteComponentsError(
|
|
1548
|
-
`
|
|
1438
|
+
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
1439
|
+
{ cause: originalError instanceof Error ? originalError : void 0 }
|
|
1549
1440
|
);
|
|
1550
1441
|
}
|
|
1551
|
-
|
|
1552
|
-
};
|
|
1553
|
-
self.__webpack_chunk_load__ = () => {
|
|
1554
|
-
return Promise.resolve([]);
|
|
1555
|
-
};
|
|
1556
|
-
}
|
|
1557
|
-
const {
|
|
1558
|
-
default: { createFromReadableStream }
|
|
1559
|
-
} = await import("react-server-dom-webpack/client.browser");
|
|
1560
|
-
async function preloadScripts(scripts, url, remoteBundle, _) {
|
|
1561
|
-
const scriptSrcs = scripts.flatMap((script) => {
|
|
1562
|
-
const scriptSrc = script.getAttribute("src") || script.getAttribute("data-src");
|
|
1563
|
-
script.parentElement?.removeChild(script);
|
|
1564
|
-
if (!scriptSrc)
|
|
1565
|
-
return [];
|
|
1566
|
-
return [
|
|
1567
|
-
{
|
|
1568
|
-
src: new URL(scriptSrc.replace(NEXT_BUNDLE_PATH_RE, "/_next/"), url).href
|
|
1569
|
-
}
|
|
1570
|
-
];
|
|
1571
|
-
});
|
|
1572
|
-
await loadScripts(scriptSrcs, resolveClientUrl);
|
|
1573
|
-
const hostShared = {
|
|
1574
|
-
...sharedPolyfills(shared),
|
|
1575
|
-
...self.__remote_component_host_shared_modules__,
|
|
1576
|
-
...shared
|
|
1577
|
-
};
|
|
1578
|
-
const resolve = {
|
|
1579
|
-
"/react/index.js": (await import("react")).default,
|
|
1580
|
-
"/react/jsx-dev-runtime.js": (await import("react/jsx-dev-runtime")).default,
|
|
1581
|
-
"/react/jsx-runtime.js": (await import("react/jsx-runtime")).default,
|
|
1582
|
-
"/react-dom/index.js": (await import("react-dom")).default,
|
|
1583
|
-
"/react-dom/client.js": (await import("react-dom/client")).default,
|
|
1584
|
-
...Object.entries(remoteShared ?? {}).reduce(
|
|
1585
|
-
(acc, [key, value]) => {
|
|
1586
|
-
if (typeof hostShared[value] !== "undefined") {
|
|
1587
|
-
acc[key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, "")] = hostShared[value];
|
|
1588
|
-
}
|
|
1589
|
-
return acc;
|
|
1590
|
-
},
|
|
1591
|
-
{}
|
|
1592
|
-
)
|
|
1593
|
-
};
|
|
1594
|
-
await Promise.all(
|
|
1595
|
-
Object.entries(resolve).map(async ([key, value]) => {
|
|
1596
|
-
if (typeof value === "function") {
|
|
1597
|
-
resolve[key] = await value(remoteBundle);
|
|
1598
|
-
}
|
|
1599
|
-
return Promise.resolve(value);
|
|
1600
|
-
})
|
|
1601
|
-
);
|
|
1602
|
-
applySharedModules(remoteBundle, resolve);
|
|
1603
|
-
}
|
|
1604
|
-
return {
|
|
1605
|
-
self,
|
|
1606
|
-
createFromReadableStream,
|
|
1607
|
-
applySharedModules,
|
|
1608
|
-
nextClientPagesLoader,
|
|
1609
|
-
preloadScripts
|
|
1442
|
+
}
|
|
1610
1443
|
};
|
|
1611
1444
|
}
|
|
1612
|
-
var
|
|
1613
|
-
"src/
|
|
1445
|
+
var init_webpack_runtime = __esm({
|
|
1446
|
+
"src/runtime/turbopack/webpack-runtime.ts"() {
|
|
1614
1447
|
"use strict";
|
|
1615
|
-
|
|
1616
|
-
init_script_loader();
|
|
1617
|
-
init_webpack_patterns();
|
|
1448
|
+
init_constants2();
|
|
1618
1449
|
init_error();
|
|
1619
|
-
|
|
1450
|
+
init_logger();
|
|
1451
|
+
init_chunk_loader();
|
|
1452
|
+
init_module();
|
|
1620
1453
|
init_shared_modules();
|
|
1621
1454
|
}
|
|
1622
1455
|
});
|
|
1623
1456
|
|
|
1624
|
-
// src/html/
|
|
1457
|
+
// src/host/html/runtime/turbopack.ts
|
|
1625
1458
|
var turbopack_exports = {};
|
|
1626
1459
|
__export(turbopack_exports, {
|
|
1627
1460
|
turbopackRuntime: () => turbopackRuntime
|
|
@@ -1629,7 +1462,7 @@ __export(turbopack_exports, {
|
|
|
1629
1462
|
async function turbopackRuntime(url, bundle, shared, remoteShared, resolveClientUrl) {
|
|
1630
1463
|
const self = globalThis;
|
|
1631
1464
|
const hostShared = {
|
|
1632
|
-
...sharedPolyfills(shared),
|
|
1465
|
+
...sharedPolyfills(shared, resolveClientUrl),
|
|
1633
1466
|
...self.__remote_component_host_shared_modules__,
|
|
1634
1467
|
...shared,
|
|
1635
1468
|
...self.__remote_component_shared__
|
|
@@ -1643,41 +1476,197 @@ async function turbopackRuntime(url, bundle, shared, remoteShared, resolveClient
|
|
|
1643
1476
|
remoteShared,
|
|
1644
1477
|
resolveClientUrl
|
|
1645
1478
|
);
|
|
1646
|
-
const {
|
|
1647
|
-
default: { createFromReadableStream }
|
|
1648
|
-
} = await import("react-server-dom-webpack/client.browser");
|
|
1649
|
-
function preloadScripts(scripts, __) {
|
|
1650
|
-
return setupWebpackRuntime(
|
|
1651
|
-
"turbopack",
|
|
1652
|
-
scripts.map((script) => ({
|
|
1653
|
-
src: script.getAttribute("src") || script.getAttribute("data-src") || script.src
|
|
1654
|
-
})),
|
|
1655
|
-
url,
|
|
1656
|
-
bundle,
|
|
1657
|
-
hostShared,
|
|
1658
|
-
remoteShared,
|
|
1659
|
-
resolveClientUrl
|
|
1660
|
-
);
|
|
1661
|
-
}
|
|
1662
|
-
return {
|
|
1663
|
-
self,
|
|
1664
|
-
createFromReadableStream,
|
|
1665
|
-
applySharedModules,
|
|
1666
|
-
nextClientPagesLoader,
|
|
1667
|
-
preloadScripts
|
|
1668
|
-
};
|
|
1479
|
+
const {
|
|
1480
|
+
default: { createFromReadableStream }
|
|
1481
|
+
} = await import("react-server-dom-webpack/client.browser");
|
|
1482
|
+
function preloadScripts(scripts, __) {
|
|
1483
|
+
return setupWebpackRuntime(
|
|
1484
|
+
"turbopack",
|
|
1485
|
+
scripts.map((script) => ({
|
|
1486
|
+
src: script.getAttribute("src") || script.getAttribute("data-src") || script.src
|
|
1487
|
+
})),
|
|
1488
|
+
url,
|
|
1489
|
+
bundle,
|
|
1490
|
+
hostShared,
|
|
1491
|
+
remoteShared,
|
|
1492
|
+
resolveClientUrl
|
|
1493
|
+
);
|
|
1494
|
+
}
|
|
1495
|
+
return {
|
|
1496
|
+
self,
|
|
1497
|
+
createFromReadableStream,
|
|
1498
|
+
applySharedModules,
|
|
1499
|
+
nextClientPagesLoader,
|
|
1500
|
+
preloadScripts
|
|
1501
|
+
};
|
|
1502
|
+
}
|
|
1503
|
+
var init_turbopack = __esm({
|
|
1504
|
+
"src/host/html/runtime/turbopack.ts"() {
|
|
1505
|
+
"use strict";
|
|
1506
|
+
init_apply_shared_modules();
|
|
1507
|
+
init_next_client_pages_loader();
|
|
1508
|
+
init_polyfill();
|
|
1509
|
+
init_webpack_runtime();
|
|
1510
|
+
}
|
|
1511
|
+
});
|
|
1512
|
+
|
|
1513
|
+
// src/runtime/loaders/static-loader.ts
|
|
1514
|
+
async function importViaCallback(absoluteSrc, resolveClientUrl) {
|
|
1515
|
+
const resolvedUrl = resolveClientUrl(absoluteSrc) ?? absoluteSrc;
|
|
1516
|
+
const fetchUrl = new URL(resolvedUrl, location.href).href;
|
|
1517
|
+
const response = await fetch(fetchUrl);
|
|
1518
|
+
if (!response.ok)
|
|
1519
|
+
throw new Error(`Proxied fetch failed: ${response.status}`);
|
|
1520
|
+
const content = (await response.text()).replace(/import\.meta\.url/g, JSON.stringify(absoluteSrc)).replace(
|
|
1521
|
+
/\b(from|import)\s*(["'])(\.\.?\/[^"']+)\2/g,
|
|
1522
|
+
(_, keyword, quote, relativePath) => {
|
|
1523
|
+
const absoluteImportUrl = new URL(relativePath, absoluteSrc).href;
|
|
1524
|
+
const resolvedImportUrl = new URL(
|
|
1525
|
+
resolveClientUrl(absoluteImportUrl) ?? absoluteImportUrl,
|
|
1526
|
+
location.href
|
|
1527
|
+
).href;
|
|
1528
|
+
return `${keyword} ${quote}${resolvedImportUrl}${quote}`;
|
|
1529
|
+
}
|
|
1530
|
+
);
|
|
1531
|
+
const moduleBlobUrl = URL.createObjectURL(
|
|
1532
|
+
new Blob([content], { type: "text/javascript" })
|
|
1533
|
+
);
|
|
1534
|
+
const wrapperContent = [
|
|
1535
|
+
`import*as m from${JSON.stringify(moduleBlobUrl)};`,
|
|
1536
|
+
`globalThis.__rc_module_registry__=globalThis.__rc_module_registry__||{};`,
|
|
1537
|
+
`globalThis.__rc_module_registry__[${JSON.stringify(absoluteSrc)}]=m;`
|
|
1538
|
+
].join("");
|
|
1539
|
+
const wrapperBlobUrl = URL.createObjectURL(
|
|
1540
|
+
new Blob([wrapperContent], { type: "text/javascript" })
|
|
1541
|
+
);
|
|
1542
|
+
const scriptEl = document.createElement("script");
|
|
1543
|
+
scriptEl.type = "module";
|
|
1544
|
+
scriptEl.src = wrapperBlobUrl;
|
|
1545
|
+
try {
|
|
1546
|
+
await new Promise((resolve, reject) => {
|
|
1547
|
+
scriptEl.onload = () => resolve();
|
|
1548
|
+
scriptEl.onerror = () => reject(new Error(`Failed to load module for ${absoluteSrc}`));
|
|
1549
|
+
document.head.appendChild(scriptEl);
|
|
1550
|
+
});
|
|
1551
|
+
} finally {
|
|
1552
|
+
scriptEl.remove();
|
|
1553
|
+
URL.revokeObjectURL(moduleBlobUrl);
|
|
1554
|
+
URL.revokeObjectURL(wrapperBlobUrl);
|
|
1555
|
+
}
|
|
1556
|
+
const registry = globalThis.__rc_module_registry__;
|
|
1557
|
+
const mod = registry?.[absoluteSrc] ?? {};
|
|
1558
|
+
if (registry)
|
|
1559
|
+
delete registry[absoluteSrc];
|
|
1560
|
+
return mod;
|
|
1561
|
+
}
|
|
1562
|
+
async function importDirectly(absoluteSrc) {
|
|
1563
|
+
try {
|
|
1564
|
+
return await import(
|
|
1565
|
+
/* @vite-ignore */
|
|
1566
|
+
/* webpackIgnore: true */
|
|
1567
|
+
absoluteSrc
|
|
1568
|
+
);
|
|
1569
|
+
} catch (importError) {
|
|
1570
|
+
if (!absoluteSrc.startsWith("blob:")) {
|
|
1571
|
+
warnCrossOriginFetchError("StaticLoader", absoluteSrc);
|
|
1572
|
+
}
|
|
1573
|
+
throw importError;
|
|
1574
|
+
}
|
|
1575
|
+
}
|
|
1576
|
+
function resolveScriptSrc(script, url) {
|
|
1577
|
+
const rawSrc = typeof script.getAttribute === "function" ? script.getAttribute("src") ?? script.src : script.src;
|
|
1578
|
+
if (!rawSrc && script.textContent) {
|
|
1579
|
+
return URL.createObjectURL(
|
|
1580
|
+
new Blob(
|
|
1581
|
+
[script.textContent.replace(/import\.meta\.url/g, JSON.stringify(url))],
|
|
1582
|
+
{ type: "text/javascript" }
|
|
1583
|
+
)
|
|
1584
|
+
);
|
|
1585
|
+
}
|
|
1586
|
+
return rawSrc;
|
|
1587
|
+
}
|
|
1588
|
+
async function loadStaticRemoteComponent(scripts, url, resolveClientUrl) {
|
|
1589
|
+
const self = globalThis;
|
|
1590
|
+
if (self.__remote_script_entrypoint_mount__?.[url.href]) {
|
|
1591
|
+
self.__remote_script_entrypoint_mount__[url.href] = /* @__PURE__ */ new Set();
|
|
1592
|
+
}
|
|
1593
|
+
if (self.__remote_script_entrypoint_unmount__?.[url.href]) {
|
|
1594
|
+
self.__remote_script_entrypoint_unmount__[url.href] = /* @__PURE__ */ new Set();
|
|
1595
|
+
}
|
|
1596
|
+
const mountUnmountSets = await Promise.all(
|
|
1597
|
+
scripts.map(async (script) => {
|
|
1598
|
+
try {
|
|
1599
|
+
const src = resolveScriptSrc(script, url);
|
|
1600
|
+
const absoluteSrc = new URL(src, url).href;
|
|
1601
|
+
const mod = resolveClientUrl ? await importViaCallback(absoluteSrc, resolveClientUrl) : await importDirectly(absoluteSrc);
|
|
1602
|
+
if (src.startsWith("blob:")) {
|
|
1603
|
+
URL.revokeObjectURL(src);
|
|
1604
|
+
}
|
|
1605
|
+
if (typeof mod.mount === "function" || typeof mod.default?.mount === "function") {
|
|
1606
|
+
if (!self.__remote_script_entrypoint_mount__) {
|
|
1607
|
+
self.__remote_script_entrypoint_mount__ = {};
|
|
1608
|
+
}
|
|
1609
|
+
if (!self.__remote_script_entrypoint_mount__[url.href]) {
|
|
1610
|
+
self.__remote_script_entrypoint_mount__[url.href] = /* @__PURE__ */ new Set();
|
|
1611
|
+
}
|
|
1612
|
+
self.__remote_script_entrypoint_mount__[url.href]?.add(
|
|
1613
|
+
mod.mount || mod.default?.mount || (() => {
|
|
1614
|
+
})
|
|
1615
|
+
);
|
|
1616
|
+
}
|
|
1617
|
+
if (typeof mod.unmount === "function" || typeof mod.default?.unmount === "function") {
|
|
1618
|
+
if (!self.__remote_script_entrypoint_unmount__) {
|
|
1619
|
+
self.__remote_script_entrypoint_unmount__ = {};
|
|
1620
|
+
}
|
|
1621
|
+
if (!self.__remote_script_entrypoint_unmount__[url.href]) {
|
|
1622
|
+
self.__remote_script_entrypoint_unmount__[url.href] = /* @__PURE__ */ new Set();
|
|
1623
|
+
}
|
|
1624
|
+
self.__remote_script_entrypoint_unmount__[url.href]?.add(
|
|
1625
|
+
mod.unmount || mod.default?.unmount || (() => {
|
|
1626
|
+
})
|
|
1627
|
+
);
|
|
1628
|
+
}
|
|
1629
|
+
return {
|
|
1630
|
+
mount: mod.mount || mod.default?.mount,
|
|
1631
|
+
unmount: mod.unmount || mod.default?.unmount
|
|
1632
|
+
};
|
|
1633
|
+
} catch (e) {
|
|
1634
|
+
logError(
|
|
1635
|
+
"StaticLoader",
|
|
1636
|
+
`Error loading remote component script from "${script.src || url.href}".`,
|
|
1637
|
+
e
|
|
1638
|
+
);
|
|
1639
|
+
return {
|
|
1640
|
+
mount: void 0,
|
|
1641
|
+
unmount: void 0
|
|
1642
|
+
};
|
|
1643
|
+
}
|
|
1644
|
+
})
|
|
1645
|
+
);
|
|
1646
|
+
return mountUnmountSets.reduce(
|
|
1647
|
+
(acc, { mount, unmount }) => {
|
|
1648
|
+
if (typeof mount === "function") {
|
|
1649
|
+
acc.mount.add(mount);
|
|
1650
|
+
}
|
|
1651
|
+
if (typeof unmount === "function") {
|
|
1652
|
+
acc.unmount.add(unmount);
|
|
1653
|
+
}
|
|
1654
|
+
return acc;
|
|
1655
|
+
},
|
|
1656
|
+
{
|
|
1657
|
+
mount: /* @__PURE__ */ new Set(),
|
|
1658
|
+
unmount: /* @__PURE__ */ new Set()
|
|
1659
|
+
}
|
|
1660
|
+
);
|
|
1669
1661
|
}
|
|
1670
|
-
var
|
|
1671
|
-
"src/
|
|
1662
|
+
var init_static_loader = __esm({
|
|
1663
|
+
"src/runtime/loaders/static-loader.ts"() {
|
|
1672
1664
|
"use strict";
|
|
1673
|
-
|
|
1674
|
-
init_webpack_adapter();
|
|
1675
|
-
init_next_client_pages_loader();
|
|
1676
|
-
init_shared_modules();
|
|
1665
|
+
init_logger();
|
|
1677
1666
|
}
|
|
1678
1667
|
});
|
|
1679
1668
|
|
|
1680
|
-
// src/html/
|
|
1669
|
+
// src/host/html/runtime/script.ts
|
|
1681
1670
|
var script_exports = {};
|
|
1682
1671
|
__export(script_exports, {
|
|
1683
1672
|
scriptRuntime: () => scriptRuntime
|
|
@@ -1696,17 +1685,101 @@ function scriptRuntime(resolveClientUrl) {
|
|
|
1696
1685
|
};
|
|
1697
1686
|
}
|
|
1698
1687
|
var init_script = __esm({
|
|
1699
|
-
"src/html/
|
|
1688
|
+
"src/host/html/runtime/script.ts"() {
|
|
1700
1689
|
"use strict";
|
|
1701
1690
|
init_static_loader();
|
|
1702
1691
|
}
|
|
1703
1692
|
});
|
|
1704
1693
|
|
|
1705
|
-
// src/html/
|
|
1694
|
+
// src/host/html/index.tsx
|
|
1706
1695
|
import { startTransition, useLayoutEffect } from "react";
|
|
1707
1696
|
import { hydrateRoot } from "react-dom/client";
|
|
1708
1697
|
|
|
1709
|
-
// src/
|
|
1698
|
+
// src/host/server/fetch-with-hooks.ts
|
|
1699
|
+
init_logger();
|
|
1700
|
+
|
|
1701
|
+
// src/host/server/fetch-headers.ts
|
|
1702
|
+
function remoteFetchHeaders() {
|
|
1703
|
+
return {
|
|
1704
|
+
/**
|
|
1705
|
+
* Authenticates deployment protection for the remote. Needed for SSR and SSG clients.
|
|
1706
|
+
* If the remote component uses vercel deployment protection, ensure the host and remote vercel
|
|
1707
|
+
* projects share a common automation bypass secret, and the shared secret is used as the
|
|
1708
|
+
* VERCEL_AUTOMATION_BYPASS_SECRET env var in the host project.
|
|
1709
|
+
*/
|
|
1710
|
+
...typeof process === "object" && typeof process.env === "object" && typeof process.env.VERCEL_AUTOMATION_BYPASS_SECRET === "string" ? {
|
|
1711
|
+
"x-vercel-protection-bypass": process.env.VERCEL_AUTOMATION_BYPASS_SECRET
|
|
1712
|
+
} : {},
|
|
1713
|
+
Accept: "text/html"
|
|
1714
|
+
};
|
|
1715
|
+
}
|
|
1716
|
+
|
|
1717
|
+
// src/host/server/fetch-with-hooks.ts
|
|
1718
|
+
async function fetchWithWarning(url, init) {
|
|
1719
|
+
try {
|
|
1720
|
+
return await fetch(url, init);
|
|
1721
|
+
} catch (error) {
|
|
1722
|
+
warnCrossOriginFetchError("FetchRemoteComponent", url);
|
|
1723
|
+
throw error;
|
|
1724
|
+
}
|
|
1725
|
+
}
|
|
1726
|
+
async function fetchWithHooks(url, additionalInit, options = {}) {
|
|
1727
|
+
const {
|
|
1728
|
+
onRequest,
|
|
1729
|
+
onResponse,
|
|
1730
|
+
abortController = new AbortController()
|
|
1731
|
+
} = options;
|
|
1732
|
+
const signal = abortController.signal;
|
|
1733
|
+
const hookOptions = {
|
|
1734
|
+
signal,
|
|
1735
|
+
abort: (reason) => abortController.abort(reason)
|
|
1736
|
+
};
|
|
1737
|
+
const init = {
|
|
1738
|
+
method: "GET",
|
|
1739
|
+
headers: remoteFetchHeaders(),
|
|
1740
|
+
signal,
|
|
1741
|
+
...additionalInit
|
|
1742
|
+
};
|
|
1743
|
+
const res = await onRequest?.(url, init, hookOptions) ?? await fetchWithWarning(url, init);
|
|
1744
|
+
return await onResponse?.(url, res, hookOptions) ?? res;
|
|
1745
|
+
}
|
|
1746
|
+
|
|
1747
|
+
// src/host/server/get-client-or-server-url.ts
|
|
1748
|
+
function getClientOrServerUrl(src, serverFallback) {
|
|
1749
|
+
const fallback = typeof location !== "undefined" ? location.href : serverFallback;
|
|
1750
|
+
if (!src) {
|
|
1751
|
+
return new URL(fallback);
|
|
1752
|
+
}
|
|
1753
|
+
return typeof src === "string" ? new URL(src, fallback) : src;
|
|
1754
|
+
}
|
|
1755
|
+
|
|
1756
|
+
// src/host/shared/state.ts
|
|
1757
|
+
function createHostState() {
|
|
1758
|
+
return {
|
|
1759
|
+
stage: "idle",
|
|
1760
|
+
prevSrc: void 0,
|
|
1761
|
+
prevUrl: void 0,
|
|
1762
|
+
prevName: void 0,
|
|
1763
|
+
prevIsRemoteComponent: false,
|
|
1764
|
+
abortController: void 0
|
|
1765
|
+
};
|
|
1766
|
+
}
|
|
1767
|
+
|
|
1768
|
+
// src/host/utils/resolve-name-from-src.ts
|
|
1769
|
+
function resolveNameFromSrc(src, defaultName) {
|
|
1770
|
+
if (!src) {
|
|
1771
|
+
return defaultName;
|
|
1772
|
+
}
|
|
1773
|
+
const hash = typeof src === "string" ? src : src.hash;
|
|
1774
|
+
const hashIndex = hash.indexOf("#");
|
|
1775
|
+
if (hashIndex < 0) {
|
|
1776
|
+
return defaultName;
|
|
1777
|
+
}
|
|
1778
|
+
const name = hash.slice(hashIndex + 1);
|
|
1779
|
+
return name || defaultName;
|
|
1780
|
+
}
|
|
1781
|
+
|
|
1782
|
+
// src/runtime/html/apply-origin.ts
|
|
1710
1783
|
var tagNames = [
|
|
1711
1784
|
"img",
|
|
1712
1785
|
"source",
|
|
@@ -1768,51 +1841,9 @@ function applyOriginToNodes(doc, url, resolveClientUrl) {
|
|
|
1768
1841
|
}
|
|
1769
1842
|
}
|
|
1770
1843
|
|
|
1771
|
-
// src/
|
|
1772
|
-
|
|
1773
|
-
function withRemoteSrc(resolveClientUrl, remoteSrc) {
|
|
1774
|
-
const remoteOrigin = parseOrigin(remoteSrc);
|
|
1775
|
-
return (url) => {
|
|
1776
|
-
const urlOrigin = parseOrigin(url);
|
|
1777
|
-
if (remoteOrigin && urlOrigin && urlOrigin !== remoteOrigin) {
|
|
1778
|
-
return void 0;
|
|
1779
|
-
}
|
|
1780
|
-
return resolveClientUrl(remoteSrc, url);
|
|
1781
|
-
};
|
|
1782
|
-
}
|
|
1783
|
-
function parseOrigin(url) {
|
|
1784
|
-
try {
|
|
1785
|
-
return new URL(url).origin;
|
|
1786
|
-
} catch {
|
|
1787
|
-
return void 0;
|
|
1788
|
-
}
|
|
1789
|
-
}
|
|
1790
|
-
var proxyClientRequestsThroughHost = (remoteSrc, url) => {
|
|
1791
|
-
if (typeof location === "undefined") {
|
|
1792
|
-
return void 0;
|
|
1793
|
-
}
|
|
1794
|
-
const remoteOrigin = new URL(remoteSrc, location.href).origin;
|
|
1795
|
-
if (remoteOrigin === location.origin) {
|
|
1796
|
-
return void 0;
|
|
1797
|
-
}
|
|
1798
|
-
try {
|
|
1799
|
-
const parsed = new URL(url, location.href);
|
|
1800
|
-
if (parsed.origin === remoteOrigin) {
|
|
1801
|
-
return generateProtectedRcFallbackSrc(url);
|
|
1802
|
-
}
|
|
1803
|
-
} catch {
|
|
1804
|
-
}
|
|
1805
|
-
return void 0;
|
|
1806
|
-
};
|
|
1807
|
-
|
|
1808
|
-
// src/shared/client/default-resolve-client-url.ts
|
|
1809
|
-
function bindResolveClientUrl(prop, remoteSrc) {
|
|
1810
|
-
return prop ? withRemoteSrc(prop, remoteSrc) : void 0;
|
|
1811
|
-
}
|
|
1812
|
-
|
|
1813
|
-
// src/shared/client/parse-remote-html.ts
|
|
1844
|
+
// src/runtime/html/parse-remote-html.ts
|
|
1845
|
+
init_constants2();
|
|
1814
1846
|
init_error();
|
|
1815
|
-
init_const();
|
|
1816
1847
|
function validateSingleComponent(doc, name, url) {
|
|
1817
1848
|
if (doc.querySelectorAll("div[data-bundle][data-route]").length > 1 && !doc.querySelector(`div[data-bundle][data-route][id^="${name}"]`) || doc.querySelectorAll("remote-component:not([src])").length > 1 && !doc.querySelector(`remote-component[name="${name}"]`)) {
|
|
1818
1849
|
throw multipleRemoteComponentsError(url);
|
|
@@ -1906,21 +1937,7 @@ function parseRemoteComponentDocument(doc, name, url) {
|
|
|
1906
1937
|
};
|
|
1907
1938
|
}
|
|
1908
1939
|
|
|
1909
|
-
// src/
|
|
1910
|
-
init_error();
|
|
1911
|
-
|
|
1912
|
-
// src/shared/client/component-loader.ts
|
|
1913
|
-
init_error();
|
|
1914
|
-
init_logger();
|
|
1915
|
-
init_next_client_pages_loader();
|
|
1916
|
-
init_shared_modules();
|
|
1917
|
-
import * as React from "react";
|
|
1918
|
-
import * as JSXDevRuntime from "react/jsx-dev-runtime";
|
|
1919
|
-
import * as JSXRuntime from "react/jsx-runtime";
|
|
1920
|
-
import * as ReactDOM from "react-dom";
|
|
1921
|
-
import * as ReactDOMClient from "react-dom/client";
|
|
1922
|
-
|
|
1923
|
-
// src/shared/client/rsc.ts
|
|
1940
|
+
// src/runtime/rsc.ts
|
|
1924
1941
|
import { ReadableStream } from "web-streams-polyfill";
|
|
1925
1942
|
function fixPayload(payload) {
|
|
1926
1943
|
if (Array.isArray(payload)) {
|
|
@@ -1986,113 +2003,37 @@ function createRSCStream(rscName, data) {
|
|
|
1986
2003
|
});
|
|
1987
2004
|
}
|
|
1988
2005
|
|
|
1989
|
-
// src/
|
|
1990
|
-
|
|
1991
|
-
|
|
1992
|
-
|
|
1993
|
-
|
|
1994
|
-
|
|
1995
|
-
|
|
1996
|
-
|
|
1997
|
-
|
|
1998
|
-
|
|
1999
|
-
// src/shared/contract/host-state.ts
|
|
2000
|
-
function createHostState() {
|
|
2001
|
-
return {
|
|
2002
|
-
stage: "idle",
|
|
2003
|
-
prevSrc: void 0,
|
|
2004
|
-
prevUrl: void 0,
|
|
2005
|
-
prevName: void 0,
|
|
2006
|
-
prevIsRemoteComponent: false,
|
|
2007
|
-
abortController: void 0
|
|
2008
|
-
};
|
|
2009
|
-
}
|
|
2010
|
-
|
|
2011
|
-
// src/shared/contract/resolve-name-from-src.ts
|
|
2012
|
-
function resolveNameFromSrc(src, defaultName) {
|
|
2013
|
-
if (!src) {
|
|
2014
|
-
return defaultName;
|
|
2015
|
-
}
|
|
2016
|
-
const hash = typeof src === "string" ? src : src.hash;
|
|
2017
|
-
const hashIndex = hash.indexOf("#");
|
|
2018
|
-
if (hashIndex < 0) {
|
|
2019
|
-
return defaultName;
|
|
2020
|
-
}
|
|
2021
|
-
const name = hash.slice(hashIndex + 1);
|
|
2022
|
-
return name || defaultName;
|
|
2023
|
-
}
|
|
2024
|
-
|
|
2025
|
-
// src/html/host/index.tsx
|
|
2026
|
-
init_error();
|
|
2027
|
-
|
|
2028
|
-
// src/shared/ssr/fetch-with-hooks.ts
|
|
2029
|
-
init_logger();
|
|
2030
|
-
|
|
2031
|
-
// src/shared/ssr/fetch-headers.ts
|
|
2032
|
-
function remoteFetchHeaders() {
|
|
2033
|
-
return {
|
|
2034
|
-
/**
|
|
2035
|
-
* Authenticates deployment protection for the remote. Needed for SSR and SSG clients.
|
|
2036
|
-
* If the remote component uses vercel deployment protection, ensure the host and remote vercel
|
|
2037
|
-
* projects share a common automation bypass secret, and the shared secret is used as the
|
|
2038
|
-
* VERCEL_AUTOMATION_BYPASS_SECRET env var in the host project.
|
|
2039
|
-
*/
|
|
2040
|
-
...typeof process === "object" && typeof process.env === "object" && typeof process.env.VERCEL_AUTOMATION_BYPASS_SECRET === "string" ? {
|
|
2041
|
-
"x-vercel-protection-bypass": process.env.VERCEL_AUTOMATION_BYPASS_SECRET
|
|
2042
|
-
} : {},
|
|
2043
|
-
Accept: "text/html"
|
|
2006
|
+
// src/runtime/url/resolve-client-url.ts
|
|
2007
|
+
function withRemoteSrc(resolveClientUrl, remoteSrc) {
|
|
2008
|
+
const remoteOrigin = parseOrigin(remoteSrc);
|
|
2009
|
+
return (url) => {
|
|
2010
|
+
const urlOrigin = parseOrigin(url);
|
|
2011
|
+
if (remoteOrigin && urlOrigin && urlOrigin !== remoteOrigin) {
|
|
2012
|
+
return void 0;
|
|
2013
|
+
}
|
|
2014
|
+
return resolveClientUrl(remoteSrc, url);
|
|
2044
2015
|
};
|
|
2045
2016
|
}
|
|
2046
|
-
|
|
2047
|
-
|
|
2048
|
-
|
|
2049
|
-
|
|
2050
|
-
|
|
2051
|
-
onResponse,
|
|
2052
|
-
abortController = new AbortController()
|
|
2053
|
-
} = options;
|
|
2054
|
-
const signal = abortController.signal;
|
|
2055
|
-
const hookOptions = {
|
|
2056
|
-
signal,
|
|
2057
|
-
abort: (reason) => abortController.abort(reason)
|
|
2058
|
-
};
|
|
2059
|
-
const init = {
|
|
2060
|
-
method: "GET",
|
|
2061
|
-
headers: remoteFetchHeaders(),
|
|
2062
|
-
signal,
|
|
2063
|
-
...additionalInit
|
|
2064
|
-
};
|
|
2065
|
-
let res = await onRequest?.(url, init, hookOptions);
|
|
2066
|
-
if (!res) {
|
|
2067
|
-
try {
|
|
2068
|
-
res = await fetch(url, init);
|
|
2069
|
-
} catch (error) {
|
|
2070
|
-
warnCrossOriginFetchError("FetchRemoteComponent", url);
|
|
2071
|
-
throw error;
|
|
2072
|
-
}
|
|
2073
|
-
}
|
|
2074
|
-
const transformedRes = await onResponse?.(url, res, hookOptions);
|
|
2075
|
-
if (transformedRes) {
|
|
2076
|
-
res = transformedRes;
|
|
2017
|
+
function parseOrigin(url) {
|
|
2018
|
+
try {
|
|
2019
|
+
return new URL(url).origin;
|
|
2020
|
+
} catch {
|
|
2021
|
+
return void 0;
|
|
2077
2022
|
}
|
|
2078
|
-
return res;
|
|
2079
2023
|
}
|
|
2080
2024
|
|
|
2081
|
-
// src/
|
|
2082
|
-
function
|
|
2083
|
-
|
|
2084
|
-
if (!src) {
|
|
2085
|
-
return new URL(fallback);
|
|
2086
|
-
}
|
|
2087
|
-
return typeof src === "string" ? new URL(src, fallback) : src;
|
|
2025
|
+
// src/runtime/url/default-resolve-client-url.ts
|
|
2026
|
+
function bindResolveClientUrl(prop, remoteSrc) {
|
|
2027
|
+
return prop ? withRemoteSrc(prop, remoteSrc) : void 0;
|
|
2088
2028
|
}
|
|
2089
2029
|
|
|
2090
|
-
// src/html/
|
|
2030
|
+
// src/host/html/index.tsx
|
|
2091
2031
|
init_utils();
|
|
2092
2032
|
init_abort();
|
|
2033
|
+
init_error();
|
|
2093
2034
|
init_logger();
|
|
2094
2035
|
|
|
2095
|
-
// src/html/
|
|
2036
|
+
// src/host/html/attach-styles.ts
|
|
2096
2037
|
init_error();
|
|
2097
2038
|
async function attachStyles({
|
|
2098
2039
|
doc,
|
|
@@ -2175,7 +2116,7 @@ async function attachStyles({
|
|
|
2175
2116
|
}
|
|
2176
2117
|
}
|
|
2177
2118
|
|
|
2178
|
-
// src/html/
|
|
2119
|
+
// src/host/html/runtime/index.ts
|
|
2179
2120
|
init_error();
|
|
2180
2121
|
async function getRuntime(type, url, bundle, shared, remoteShared, resolveClientUrl) {
|
|
2181
2122
|
if (typeof globalThis.process === "undefined") {
|
|
@@ -2209,7 +2150,7 @@ async function getRuntime(type, url, bundle, shared, remoteShared, resolveClient
|
|
|
2209
2150
|
);
|
|
2210
2151
|
}
|
|
2211
2152
|
|
|
2212
|
-
// src/html/
|
|
2153
|
+
// src/host/html/index.tsx
|
|
2213
2154
|
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
2214
2155
|
if (typeof HTMLElement !== "undefined") {
|
|
2215
2156
|
class RemoteComponent extends HTMLElement {
|
|
@@ -2224,7 +2165,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2224
2165
|
onRequest;
|
|
2225
2166
|
onResponse;
|
|
2226
2167
|
resolveClientUrl;
|
|
2227
|
-
// --
|
|
2168
|
+
// -- ConsumeServerConfig property accessors (attribute-reflected) --
|
|
2228
2169
|
get src() {
|
|
2229
2170
|
return this.getAttribute("src") ?? void 0;
|
|
2230
2171
|
}
|
|
@@ -2801,7 +2742,6 @@ function registerSharedModules(modules = {}) {
|
|
|
2801
2742
|
});
|
|
2802
2743
|
}
|
|
2803
2744
|
export {
|
|
2804
|
-
proxyClientRequestsThroughHost,
|
|
2805
2745
|
registerSharedModules
|
|
2806
2746
|
};
|
|
2807
|
-
//# sourceMappingURL=
|
|
2747
|
+
//# sourceMappingURL=html.js.map
|