remote-components 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{next/config.cjs → config/nextjs.cjs} +76 -101
- 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} +72 -97
- 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} +1270 -1201
- 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} +1266 -1196
- package/dist/host/html.js.map +1 -0
- package/dist/{next/host/client/index.cjs → host/nextjs/app/client-only.cjs} +690 -518
- 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} +693 -514
- 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/host/nextjs/pages.d.ts +77 -0
- 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/{internal/shared/client/proxy-through-host.cjs → host/proxy/client.cjs} +19 -13
- 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} +552 -477
- package/dist/host/react.cjs.map +1 -0
- package/dist/host/react.d.ts +366 -0
- package/dist/{react/index.js → host/react.js} +551 -474
- package/dist/host/react.js.map +1 -0
- package/dist/internal/{webpack/shared-modules.cjs → config/webpack/apply-shared-modules.cjs} +12 -15
- 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} +9 -12
- 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} +36 -29
- 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} +27 -25
- 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/internal/host/server/types.cjs +17 -0
- 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/internal/host/shared/config.d.ts +100 -0
- 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-cbe44b51.d.ts → internal/host/shared/fetch-interceptors.d.ts} +7 -73
- 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/{next/remote/server.cjs → internal/host/shared/state.cjs} +16 -7
- package/dist/internal/host/shared/state.cjs.map +1 -0
- package/dist/internal/host/shared/state.d.ts +53 -0
- package/dist/internal/host/shared/state.js +14 -0
- package/dist/internal/host/shared/state.js.map +1 -0
- package/dist/internal/host/utils/resolve-name-from-src.cjs +40 -0
- package/dist/internal/host/utils/resolve-name-from-src.cjs.map +1 -0
- package/dist/internal/host/utils/resolve-name-from-src.d.ts +13 -0
- package/dist/internal/host/utils/resolve-name-from-src.js +16 -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 +69 -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 +48 -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 +244 -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 +227 -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 +152 -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 +133 -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/runtime/url/resolve-client-url.cjs +45 -0
- 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} +6 -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 +4 -4
- package/dist/internal/utils/error.cjs.map +1 -0
- package/dist/internal/{shared → utils}/error.js +4 -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/remote/nextjs/app.d.ts +45 -0
- 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/component-loader-76eb1b8b.d.ts +0 -200
- 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 -66
- 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.d.ts +0 -47
- 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 -26
- 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/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 -60
- 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 -56
- 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.d.ts +0 -104
- 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 -56
- 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 -1
- 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 -123
- 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/{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}/error.d.ts +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
|
@@ -30,20 +30,17 @@ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__ge
|
|
|
30
30
|
));
|
|
31
31
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
32
32
|
|
|
33
|
-
// src/
|
|
33
|
+
// src/utils/constants.ts
|
|
34
34
|
var RC_PROTECTED_REMOTE_FETCH_PATHNAME, CORS_DOCS_URL;
|
|
35
35
|
var init_constants = __esm({
|
|
36
|
-
"src/
|
|
36
|
+
"src/utils/constants.ts"() {
|
|
37
37
|
"use strict";
|
|
38
38
|
RC_PROTECTED_REMOTE_FETCH_PATHNAME = "/rc-fetch-protected-remote";
|
|
39
39
|
CORS_DOCS_URL = "https://vercel.com/docs/remote-components/concepts/cors-external-urls#accessing-cross-site-protected-remote-components";
|
|
40
40
|
}
|
|
41
41
|
});
|
|
42
42
|
|
|
43
|
-
// src/
|
|
44
|
-
function generateProtectedRcFallbackSrc(url) {
|
|
45
|
-
return `${RC_PROTECTED_REMOTE_FETCH_PATHNAME}?url=${encodeURIComponent(url)}`;
|
|
46
|
-
}
|
|
43
|
+
// src/runtime/url/protected-rc-fallback.ts
|
|
47
44
|
function isProxiedUrl(url) {
|
|
48
45
|
try {
|
|
49
46
|
return new URL(url, location.href).pathname === RC_PROTECTED_REMOTE_FETCH_PATHNAME;
|
|
@@ -52,13 +49,13 @@ function isProxiedUrl(url) {
|
|
|
52
49
|
}
|
|
53
50
|
}
|
|
54
51
|
var init_protected_rc_fallback = __esm({
|
|
55
|
-
"src/
|
|
52
|
+
"src/runtime/url/protected-rc-fallback.ts"() {
|
|
56
53
|
"use strict";
|
|
57
54
|
init_constants();
|
|
58
55
|
}
|
|
59
56
|
});
|
|
60
57
|
|
|
61
|
-
// src/
|
|
58
|
+
// src/utils/abort.ts
|
|
62
59
|
function isAbortError(error) {
|
|
63
60
|
if (error instanceof DOMException && error.name === "AbortError") {
|
|
64
61
|
return true;
|
|
@@ -70,12 +67,12 @@ function isAbortError(error) {
|
|
|
70
67
|
return false;
|
|
71
68
|
}
|
|
72
69
|
var init_abort = __esm({
|
|
73
|
-
"src/
|
|
70
|
+
"src/utils/abort.ts"() {
|
|
74
71
|
"use strict";
|
|
75
72
|
}
|
|
76
73
|
});
|
|
77
74
|
|
|
78
|
-
// src/
|
|
75
|
+
// src/utils/error.ts
|
|
79
76
|
function multipleRemoteComponentsError(url) {
|
|
80
77
|
return new RemoteComponentsError(
|
|
81
78
|
`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.`
|
|
@@ -134,7 +131,7 @@ function failedProxyFetchError(originalUrl, proxyUrl, status, responseBody) {
|
|
|
134
131
|
The host server needs middleware or a route that handles "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}".
|
|
135
132
|
|
|
136
133
|
Proxying requires two pieces:
|
|
137
|
-
1. resolveClientUrl={
|
|
134
|
+
1. resolveClientUrl={routeThroughHostProxy} on <RemoteComponent>
|
|
138
135
|
2. Middleware or a route for "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" on the host server
|
|
139
136
|
|
|
140
137
|
Docs: ${CORS_DOCS_URL}`
|
|
@@ -152,11 +149,11 @@ Docs: ${CORS_DOCS_URL}`
|
|
|
152
149
|
}
|
|
153
150
|
var RemoteComponentsError;
|
|
154
151
|
var init_error = __esm({
|
|
155
|
-
"src/
|
|
152
|
+
"src/utils/error.ts"() {
|
|
156
153
|
"use strict";
|
|
157
154
|
init_protected_rc_fallback();
|
|
158
|
-
init_constants();
|
|
159
155
|
init_abort();
|
|
156
|
+
init_constants();
|
|
160
157
|
RemoteComponentsError = class extends Error {
|
|
161
158
|
code = "REMOTE_COMPONENTS_ERROR";
|
|
162
159
|
constructor(message, options) {
|
|
@@ -167,7 +164,7 @@ var init_error = __esm({
|
|
|
167
164
|
}
|
|
168
165
|
});
|
|
169
166
|
|
|
170
|
-
// src/
|
|
167
|
+
// src/utils/logger.ts
|
|
171
168
|
function logDebug(location2, message) {
|
|
172
169
|
if (DEBUG) {
|
|
173
170
|
console.debug(`[${PREFIX}:${location2}]: ${message}`);
|
|
@@ -191,14 +188,14 @@ function warnCrossOriginFetchError(logLocation, url) {
|
|
|
191
188
|
}
|
|
192
189
|
logWarn(
|
|
193
190
|
logLocation,
|
|
194
|
-
`Failed to fetch cross-origin resource "${parsed.href}". If this is a protected deployment, ensure
|
|
191
|
+
`Failed to fetch cross-origin resource "${parsed.href}". If this is a protected deployment, ensure withRemoteComponentsHostProxy middleware is configured in your host and that the remote URL is included in allowedProxyUrls. See: ${CORS_DOCS_URL}`
|
|
195
192
|
);
|
|
196
193
|
} catch {
|
|
197
194
|
}
|
|
198
195
|
}
|
|
199
196
|
var PREFIX, DEBUG;
|
|
200
197
|
var init_logger = __esm({
|
|
201
|
-
"src/
|
|
198
|
+
"src/utils/logger.ts"() {
|
|
202
199
|
"use strict";
|
|
203
200
|
init_constants();
|
|
204
201
|
init_error();
|
|
@@ -207,7 +204,99 @@ var init_logger = __esm({
|
|
|
207
204
|
}
|
|
208
205
|
});
|
|
209
206
|
|
|
210
|
-
// src/
|
|
207
|
+
// src/utils/index.ts
|
|
208
|
+
function escapeString(str) {
|
|
209
|
+
return str.replace(/[^a-z0-9]/g, "_");
|
|
210
|
+
}
|
|
211
|
+
var init_utils = __esm({
|
|
212
|
+
"src/utils/index.ts"() {
|
|
213
|
+
"use strict";
|
|
214
|
+
}
|
|
215
|
+
});
|
|
216
|
+
|
|
217
|
+
// src/runtime/constants.ts
|
|
218
|
+
function getBundleKey(bundle) {
|
|
219
|
+
return escapeString(bundle);
|
|
220
|
+
}
|
|
221
|
+
var DEFAULT_ROUTE, RUNTIME_WEBPACK, RUNTIME_TURBOPACK, RUNTIME_SCRIPT, REMOTE_COMPONENT_REGEX, NEXT_BUNDLE_PATH_RE;
|
|
222
|
+
var init_constants2 = __esm({
|
|
223
|
+
"src/runtime/constants.ts"() {
|
|
224
|
+
"use strict";
|
|
225
|
+
init_utils();
|
|
226
|
+
DEFAULT_ROUTE = "/";
|
|
227
|
+
RUNTIME_WEBPACK = "webpack";
|
|
228
|
+
RUNTIME_TURBOPACK = "turbopack";
|
|
229
|
+
RUNTIME_SCRIPT = "script";
|
|
230
|
+
REMOTE_COMPONENT_REGEX = /(?<prefix>.*?)\[(?<bundle>[^\]]+)\](?:%20| )(?<id>.+)/;
|
|
231
|
+
NEXT_BUNDLE_PATH_RE = /\/_next\/\[.+\](?:%20| )/;
|
|
232
|
+
}
|
|
233
|
+
});
|
|
234
|
+
|
|
235
|
+
// src/config/webpack/apply-shared-modules.ts
|
|
236
|
+
function applySharedModules(bundle, resolve) {
|
|
237
|
+
logDebug(
|
|
238
|
+
"SharedModules",
|
|
239
|
+
`applySharedModules called for bundle: "${bundle}"`
|
|
240
|
+
);
|
|
241
|
+
logDebug(
|
|
242
|
+
"SharedModules",
|
|
243
|
+
`Shared modules to resolve: ${Object.keys(resolve)}`
|
|
244
|
+
);
|
|
245
|
+
const self = globalThis;
|
|
246
|
+
if (self.__remote_webpack_require__?.[bundle]) {
|
|
247
|
+
const modulePaths = Object.keys(
|
|
248
|
+
self.__remote_webpack_module_map__?.[bundle] ?? self.__remote_webpack_require__[bundle].m ?? {}
|
|
249
|
+
);
|
|
250
|
+
logDebug(
|
|
251
|
+
"SharedModules",
|
|
252
|
+
`Available module paths in __remote_webpack_require__[${bundle}]: ${modulePaths}`
|
|
253
|
+
);
|
|
254
|
+
for (const [key, value] of Object.entries(resolve)) {
|
|
255
|
+
const exactIds = modulePaths.filter((p) => p === key);
|
|
256
|
+
const ids = exactIds.length > 0 ? exactIds : modulePaths.filter((p) => p.includes(key));
|
|
257
|
+
if (ids.length === 0) {
|
|
258
|
+
logDebug(
|
|
259
|
+
"SharedModules",
|
|
260
|
+
`No matching module path found for shared module "${key}"`
|
|
261
|
+
);
|
|
262
|
+
}
|
|
263
|
+
for (const id of ids) {
|
|
264
|
+
const webpackBundle = self.__remote_webpack_require__[bundle];
|
|
265
|
+
if (webpackBundle.m) {
|
|
266
|
+
const resolvedId = self.__remote_webpack_module_map__?.[bundle]?.[id] ? `${self.__remote_webpack_module_map__[bundle][id]}` : id;
|
|
267
|
+
if (resolvedId !== id) {
|
|
268
|
+
logDebug(
|
|
269
|
+
"SharedModules",
|
|
270
|
+
`Mapped module id: "${id}" -> "${resolvedId}"`
|
|
271
|
+
);
|
|
272
|
+
}
|
|
273
|
+
webpackBundle.m[resolvedId] = (module2) => {
|
|
274
|
+
module2.exports = value;
|
|
275
|
+
};
|
|
276
|
+
} else {
|
|
277
|
+
logWarn(
|
|
278
|
+
"SharedModules",
|
|
279
|
+
`webpackBundle.m is not available for bundle "${bundle}"`
|
|
280
|
+
);
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
} else {
|
|
285
|
+
logWarn("SharedModules", `No webpack require found for bundle "${bundle}"`);
|
|
286
|
+
logDebug(
|
|
287
|
+
"SharedModules",
|
|
288
|
+
`Available bundles: ${Object.keys(self.__remote_webpack_require__ ?? {})}`
|
|
289
|
+
);
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
var init_apply_shared_modules = __esm({
|
|
293
|
+
"src/config/webpack/apply-shared-modules.ts"() {
|
|
294
|
+
"use strict";
|
|
295
|
+
init_logger();
|
|
296
|
+
}
|
|
297
|
+
});
|
|
298
|
+
|
|
299
|
+
// src/config/webpack/next-client-pages-loader.ts
|
|
211
300
|
function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
212
301
|
const self = globalThis;
|
|
213
302
|
const nextCssOriginal = document.querySelector(
|
|
@@ -319,214 +408,415 @@ function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
|
319
408
|
return { Component: null, App: null };
|
|
320
409
|
}
|
|
321
410
|
var init_next_client_pages_loader = __esm({
|
|
322
|
-
"src/
|
|
411
|
+
"src/config/webpack/next-client-pages-loader.ts"() {
|
|
323
412
|
"use strict";
|
|
324
413
|
init_error();
|
|
325
414
|
}
|
|
326
415
|
});
|
|
327
416
|
|
|
328
|
-
// src/shared/
|
|
329
|
-
function
|
|
330
|
-
logDebug(
|
|
331
|
-
"SharedModules",
|
|
332
|
-
`applySharedModules called for bundle: "${bundle}"`
|
|
333
|
-
);
|
|
334
|
-
logDebug(
|
|
335
|
-
"SharedModules",
|
|
336
|
-
`Shared modules to resolve: ${Object.keys(resolve)}`
|
|
337
|
-
);
|
|
417
|
+
// src/host/shared/polyfill.tsx
|
|
418
|
+
function applyBundleUrlToSrc(bundle, src) {
|
|
338
419
|
const self = globalThis;
|
|
339
|
-
if (self.
|
|
340
|
-
|
|
341
|
-
self.__remote_webpack_module_map__?.[bundle] ?? self.__remote_webpack_require__[bundle].m ?? {}
|
|
342
|
-
);
|
|
343
|
-
logDebug(
|
|
344
|
-
"SharedModules",
|
|
345
|
-
`Available module paths in __remote_webpack_require__[${bundle}]: ${modulePaths}`
|
|
346
|
-
);
|
|
347
|
-
for (const [key, value] of Object.entries(resolve)) {
|
|
348
|
-
let ids = modulePaths.filter((p) => p === key);
|
|
349
|
-
if (ids.length === 0) {
|
|
350
|
-
ids = modulePaths.filter((p) => p.includes(key));
|
|
351
|
-
}
|
|
352
|
-
if (ids.length === 0) {
|
|
353
|
-
logDebug(
|
|
354
|
-
"SharedModules",
|
|
355
|
-
`No matching module path found for shared module "${key}"`
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
for (let id of ids) {
|
|
359
|
-
const webpackBundle = self.__remote_webpack_require__[bundle];
|
|
360
|
-
if (webpackBundle.m) {
|
|
361
|
-
if (self.__remote_webpack_module_map__?.[bundle]?.[id]) {
|
|
362
|
-
const mappedId = `${self.__remote_webpack_module_map__[bundle][id]}`;
|
|
363
|
-
logDebug(
|
|
364
|
-
"SharedModules",
|
|
365
|
-
`Mapped module id: "${id}" -> "${mappedId}"`
|
|
366
|
-
);
|
|
367
|
-
id = mappedId;
|
|
368
|
-
}
|
|
369
|
-
webpackBundle.m[id] = (module2) => {
|
|
370
|
-
module2.exports = value;
|
|
371
|
-
};
|
|
372
|
-
} else {
|
|
373
|
-
logWarn(
|
|
374
|
-
"SharedModules",
|
|
375
|
-
`webpackBundle.m is not available for bundle "${bundle}"`
|
|
376
|
-
);
|
|
377
|
-
}
|
|
378
|
-
}
|
|
379
|
-
}
|
|
380
|
-
} else {
|
|
381
|
-
logWarn("SharedModules", `No webpack require found for bundle "${bundle}"`);
|
|
382
|
-
logDebug(
|
|
383
|
-
"SharedModules",
|
|
384
|
-
`Available bundles: ${Object.keys(self.__remote_webpack_require__ ?? {})}`
|
|
385
|
-
);
|
|
386
|
-
}
|
|
387
|
-
}
|
|
388
|
-
var init_shared_modules = __esm({
|
|
389
|
-
"src/shared/webpack/shared-modules.ts"() {
|
|
390
|
-
"use strict";
|
|
391
|
-
init_logger();
|
|
392
|
-
}
|
|
393
|
-
});
|
|
394
|
-
|
|
395
|
-
// src/shared/client/webpack-patterns.ts
|
|
396
|
-
var NEXT_BUNDLE_PATH_RE;
|
|
397
|
-
var init_webpack_patterns = __esm({
|
|
398
|
-
"src/shared/client/webpack-patterns.ts"() {
|
|
399
|
-
"use strict";
|
|
400
|
-
NEXT_BUNDLE_PATH_RE = /\/_next\/\[.+\](?:%20| )/;
|
|
420
|
+
if (self.__remote_bundle_url__?.[bundle]?.origin === location.origin) {
|
|
421
|
+
return src;
|
|
401
422
|
}
|
|
402
|
-
});
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
async function loadScripts(scripts, resolveClientUrl) {
|
|
406
|
-
await Promise.all(
|
|
407
|
-
scripts.map((script) => {
|
|
408
|
-
return new Promise((resolve, reject) => {
|
|
409
|
-
const newSrc = new URL(
|
|
410
|
-
// remove the remote component bundle name identifier from the script src
|
|
411
|
-
script.src.replace(NEXT_BUNDLE_PATH_RE, "/_next/"),
|
|
412
|
-
location.origin
|
|
413
|
-
).href;
|
|
414
|
-
const resolvedSrc = resolveClientUrl?.(newSrc) ?? newSrc;
|
|
415
|
-
const newScript = document.createElement("script");
|
|
416
|
-
newScript.onload = () => resolve();
|
|
417
|
-
newScript.onerror = () => {
|
|
418
|
-
const isProxied = isProxiedUrl(resolvedSrc);
|
|
419
|
-
if (isProxied) {
|
|
420
|
-
reject(
|
|
421
|
-
new RemoteComponentsError(
|
|
422
|
-
`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}`
|
|
423
|
-
)
|
|
424
|
-
);
|
|
425
|
-
} else {
|
|
426
|
-
warnCrossOriginFetchError("ScriptLoader", newSrc);
|
|
427
|
-
reject(
|
|
428
|
-
new RemoteComponentsError(
|
|
429
|
-
`Failed to load <script src="${newSrc}"> for Remote Component. Check the URL is correct.`
|
|
430
|
-
)
|
|
431
|
-
);
|
|
432
|
-
}
|
|
433
|
-
};
|
|
434
|
-
newScript.src = resolvedSrc;
|
|
435
|
-
newScript.async = true;
|
|
436
|
-
document.head.appendChild(newScript);
|
|
437
|
-
});
|
|
438
|
-
})
|
|
439
|
-
);
|
|
440
|
-
}
|
|
441
|
-
var init_script_loader = __esm({
|
|
442
|
-
"src/shared/client/script-loader.ts"() {
|
|
443
|
-
"use strict";
|
|
444
|
-
init_constants();
|
|
445
|
-
init_error();
|
|
446
|
-
init_logger();
|
|
447
|
-
init_protected_rc_fallback();
|
|
448
|
-
init_webpack_patterns();
|
|
423
|
+
const { assetPrefix, path } = /^(?<assetPrefix>.*?)\/_next\/(?<path>.*)/.exec(src)?.groups ?? {};
|
|
424
|
+
if (!path) {
|
|
425
|
+
return new URL(src, self.__remote_bundle_url__?.[bundle]?.origin).href;
|
|
449
426
|
}
|
|
450
|
-
}
|
|
451
|
-
|
|
452
|
-
// src/shared/utils/index.ts
|
|
453
|
-
function escapeString(str) {
|
|
454
|
-
return str.replace(/[^a-z0-9]/g, "_");
|
|
427
|
+
return `${self.__remote_bundle_url__?.[bundle]?.origin ?? ""}${assetPrefix}/_next/${path}`;
|
|
455
428
|
}
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
429
|
+
function applyBundleUrlToImagePropsSrc(bundle, src) {
|
|
430
|
+
if (typeof src === "string") {
|
|
431
|
+
return applyBundleUrlToSrc(bundle, src);
|
|
459
432
|
}
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
// src/shared/client/const.ts
|
|
463
|
-
function getBundleKey(bundle) {
|
|
464
|
-
return escapeString(bundle);
|
|
433
|
+
const propSrc = src;
|
|
434
|
+
return applyBundleUrlToSrc(bundle, propSrc.src);
|
|
465
435
|
}
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
"
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
436
|
+
function sharedPolyfills(shared, resolveClientUrl) {
|
|
437
|
+
const self = globalThis;
|
|
438
|
+
const polyfill = {
|
|
439
|
+
"next/dist/client/components/navigation": self.__remote_component_host_shared_modules__?.["next/navigation"] ?? shared?.["next/navigation"] ?? (() => Promise.resolve({
|
|
440
|
+
useRouter() {
|
|
441
|
+
return {
|
|
442
|
+
push: (routerUrl) => {
|
|
443
|
+
history.pushState({}, "", routerUrl);
|
|
444
|
+
},
|
|
445
|
+
replace: (routerUrl) => {
|
|
446
|
+
history.replaceState({}, "", routerUrl);
|
|
447
|
+
},
|
|
448
|
+
back: () => {
|
|
449
|
+
history.back();
|
|
450
|
+
}
|
|
451
|
+
};
|
|
452
|
+
},
|
|
453
|
+
usePathname() {
|
|
454
|
+
return location.pathname;
|
|
455
|
+
},
|
|
456
|
+
useParams() {
|
|
457
|
+
return {};
|
|
458
|
+
},
|
|
459
|
+
useSearchParams() {
|
|
460
|
+
return new URLSearchParams(location.search);
|
|
461
|
+
},
|
|
462
|
+
useSelectedLayoutSegment() {
|
|
463
|
+
return null;
|
|
464
|
+
},
|
|
465
|
+
useSelectedLayoutSegments() {
|
|
466
|
+
return [];
|
|
467
|
+
},
|
|
468
|
+
__esModule: true
|
|
469
|
+
})),
|
|
470
|
+
"next/dist/client/app-dir/link": self.__remote_component_host_shared_modules__?.["next/link"] ?? shared?.["next/link"] ?? (() => Promise.resolve({
|
|
471
|
+
default: ({
|
|
472
|
+
scroll: _,
|
|
473
|
+
replace,
|
|
474
|
+
prefetch,
|
|
475
|
+
onNavigate,
|
|
476
|
+
children,
|
|
477
|
+
...props
|
|
478
|
+
}) => {
|
|
479
|
+
if (prefetch) {
|
|
480
|
+
logWarn(
|
|
481
|
+
"Polyfill",
|
|
482
|
+
"Next.js Link prefetch is not supported in remote components"
|
|
483
|
+
);
|
|
484
|
+
}
|
|
485
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
486
|
+
"a",
|
|
487
|
+
{
|
|
488
|
+
...props,
|
|
489
|
+
href: props.href,
|
|
490
|
+
onClick: (e) => {
|
|
491
|
+
e.preventDefault();
|
|
492
|
+
let preventDefaulted = false;
|
|
493
|
+
e.preventDefault = () => {
|
|
494
|
+
preventDefaulted = true;
|
|
495
|
+
e.defaultPrevented = true;
|
|
496
|
+
};
|
|
497
|
+
if (typeof props.onClick === "function") {
|
|
498
|
+
props.onClick(e);
|
|
499
|
+
}
|
|
500
|
+
onNavigate?.(e);
|
|
501
|
+
if (preventDefaulted) {
|
|
502
|
+
return;
|
|
503
|
+
}
|
|
504
|
+
if (replace) {
|
|
505
|
+
history.replaceState({}, "", props.href);
|
|
506
|
+
} else {
|
|
507
|
+
history.pushState({}, "", props.href);
|
|
508
|
+
}
|
|
509
|
+
},
|
|
510
|
+
suppressHydrationWarning: true,
|
|
511
|
+
children: children ?? null
|
|
512
|
+
}
|
|
513
|
+
);
|
|
514
|
+
},
|
|
515
|
+
useLinkStatus() {
|
|
516
|
+
return { pending: false };
|
|
517
|
+
},
|
|
518
|
+
__esModule: true
|
|
519
|
+
})),
|
|
520
|
+
"next/dist/client/app-dir/form": self.__remote_component_host_shared_modules__?.["next/form"] ?? shared?.["next/form"] ?? (() => Promise.resolve({
|
|
521
|
+
default: () => {
|
|
522
|
+
throw new Error("Next.js <Form> component not implemented");
|
|
523
|
+
},
|
|
524
|
+
__esModule: true
|
|
525
|
+
})),
|
|
526
|
+
"next/dist/client/image-component": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
|
|
527
|
+
Image: imageImpl(bundle, resolveClientUrl),
|
|
528
|
+
__esModule: true
|
|
529
|
+
})),
|
|
530
|
+
"next/image": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
|
|
531
|
+
default: imageImpl(bundle, resolveClientUrl),
|
|
532
|
+
getImageProps: (_imgProps) => {
|
|
533
|
+
throw new Error(
|
|
534
|
+
"Next.js getImageProps() is not implemented in remote components"
|
|
535
|
+
);
|
|
536
|
+
},
|
|
537
|
+
__esModule: true
|
|
538
|
+
})),
|
|
539
|
+
"next/dist/client/script": self.__remote_component_host_shared_modules__?.["next/script"] ?? shared?.["next/script"] ?? (() => Promise.resolve({
|
|
540
|
+
// TODO: implement <Script> component for non-Next.js host applications
|
|
541
|
+
// do not throw an error for now
|
|
542
|
+
default: () => null,
|
|
543
|
+
__esModule: true
|
|
544
|
+
})),
|
|
545
|
+
"next/router": self.__remote_component_host_shared_modules__?.["next/router"] ?? shared?.["next/router"] ?? (() => (
|
|
546
|
+
// TODO: incomplete implementation
|
|
547
|
+
Promise.resolve({
|
|
548
|
+
useRouter() {
|
|
549
|
+
return {
|
|
550
|
+
push: (routerUrl) => {
|
|
551
|
+
history.pushState({}, "", routerUrl);
|
|
552
|
+
},
|
|
553
|
+
replace: (routerUrl) => {
|
|
554
|
+
history.replaceState({}, "", routerUrl);
|
|
555
|
+
},
|
|
556
|
+
back: () => {
|
|
557
|
+
history.back();
|
|
558
|
+
}
|
|
559
|
+
};
|
|
560
|
+
},
|
|
561
|
+
__esModule: true
|
|
562
|
+
})
|
|
563
|
+
)),
|
|
564
|
+
"next/dist/build/polyfills/process": () => Promise.resolve({
|
|
565
|
+
default: {
|
|
566
|
+
env: {
|
|
567
|
+
NODE_ENV: "production"
|
|
568
|
+
}
|
|
569
|
+
},
|
|
570
|
+
__esModule: true
|
|
571
|
+
})
|
|
572
|
+
};
|
|
573
|
+
polyfill["next/navigation"] = polyfill["next/dist/client/components/navigation"];
|
|
574
|
+
polyfill["next/link"] = polyfill["next/dist/client/app-dir/link"];
|
|
575
|
+
polyfill["next/form"] = polyfill["next/dist/client/app-dir/form"];
|
|
576
|
+
polyfill["next/dist/api/image"] = polyfill["next/dist/client/image-component"];
|
|
577
|
+
polyfill["next/script"] = polyfill["next/dist/client/script"];
|
|
578
|
+
return polyfill;
|
|
579
|
+
}
|
|
580
|
+
var import_jsx_runtime, imageImpl;
|
|
581
|
+
var init_polyfill = __esm({
|
|
582
|
+
"src/host/shared/polyfill.tsx"() {
|
|
583
|
+
"use strict";
|
|
584
|
+
init_logger();
|
|
585
|
+
// eslint-disable-next-line @next/next/no-img-element, jsx-a11y/alt-text
|
|
586
|
+
import_jsx_runtime = require("react/jsx-runtime");
|
|
587
|
+
imageImpl = (bundle, resolveClientUrl) => function RemoteImage({
|
|
588
|
+
fill: _fill,
|
|
589
|
+
loader: _loader,
|
|
590
|
+
quality: _quality,
|
|
591
|
+
priority: _priority,
|
|
592
|
+
loading: _loading,
|
|
593
|
+
placeholder: _placeholder,
|
|
594
|
+
blurDataURL: _blurDataURL,
|
|
595
|
+
unoptimized: _unoptimized,
|
|
596
|
+
overrideSrc: _overrideSrc,
|
|
597
|
+
src,
|
|
598
|
+
...props
|
|
599
|
+
}) {
|
|
600
|
+
const newSrc = applyBundleUrlToImagePropsSrc(
|
|
601
|
+
bundle,
|
|
602
|
+
typeof src === "string" ? src : src.src
|
|
603
|
+
);
|
|
604
|
+
const proxiedSrc = resolveClientUrl?.(newSrc) ?? newSrc;
|
|
605
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
606
|
+
"img",
|
|
607
|
+
{
|
|
608
|
+
decoding: "async",
|
|
609
|
+
style: { color: "transparent" },
|
|
610
|
+
...props,
|
|
611
|
+
src: proxiedSrc,
|
|
612
|
+
suppressHydrationWarning: true
|
|
613
|
+
}
|
|
614
|
+
);
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
});
|
|
618
|
+
|
|
619
|
+
// src/runtime/loaders/script-loader.ts
|
|
620
|
+
async function loadScripts(scripts, resolveClientUrl) {
|
|
621
|
+
await Promise.all(
|
|
622
|
+
scripts.map((script) => {
|
|
623
|
+
return new Promise((resolve, reject) => {
|
|
624
|
+
const newSrc = new URL(
|
|
625
|
+
// remove the remote component bundle name identifier from the script src
|
|
626
|
+
script.src.replace(NEXT_BUNDLE_PATH_RE, "/_next/"),
|
|
627
|
+
location.origin
|
|
628
|
+
).href;
|
|
629
|
+
const resolvedSrc = resolveClientUrl?.(newSrc) ?? newSrc;
|
|
630
|
+
const newScript = document.createElement("script");
|
|
631
|
+
newScript.onload = () => resolve();
|
|
632
|
+
newScript.onerror = () => {
|
|
633
|
+
const isProxied = isProxiedUrl(resolvedSrc);
|
|
634
|
+
if (isProxied) {
|
|
635
|
+
reject(
|
|
636
|
+
new RemoteComponentsError(
|
|
637
|
+
`Failed to load script "${newSrc}" via proxy "${resolvedSrc}". Ensure withRemoteComponentsHostProxy middleware is configured and "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" is in the matcher. See: ${CORS_DOCS_URL}`
|
|
638
|
+
)
|
|
639
|
+
);
|
|
640
|
+
} else {
|
|
641
|
+
warnCrossOriginFetchError("ScriptLoader", newSrc);
|
|
642
|
+
reject(
|
|
643
|
+
new RemoteComponentsError(
|
|
644
|
+
`Failed to load <script src="${newSrc}"> for Remote Component. Check the URL is correct.`
|
|
645
|
+
)
|
|
646
|
+
);
|
|
647
|
+
}
|
|
648
|
+
};
|
|
649
|
+
newScript.src = resolvedSrc;
|
|
650
|
+
newScript.async = true;
|
|
651
|
+
document.head.appendChild(newScript);
|
|
652
|
+
});
|
|
653
|
+
})
|
|
654
|
+
);
|
|
655
|
+
}
|
|
656
|
+
var init_script_loader = __esm({
|
|
657
|
+
"src/runtime/loaders/script-loader.ts"() {
|
|
658
|
+
"use strict";
|
|
659
|
+
init_constants2();
|
|
660
|
+
init_protected_rc_fallback();
|
|
661
|
+
init_constants();
|
|
662
|
+
init_error();
|
|
663
|
+
init_logger();
|
|
664
|
+
}
|
|
665
|
+
});
|
|
666
|
+
|
|
667
|
+
// src/host/html/runtime/webpack.ts
|
|
668
|
+
var webpack_exports = {};
|
|
669
|
+
__export(webpack_exports, {
|
|
670
|
+
webpackRuntime: () => webpackRuntime
|
|
671
|
+
});
|
|
672
|
+
async function webpackRuntime(bundle, shared, remoteShared, resolveClientUrl) {
|
|
673
|
+
const self = globalThis;
|
|
674
|
+
if (!self.__DISABLE_WEBPACK_EXEC__) {
|
|
675
|
+
self.__DISABLE_WEBPACK_EXEC__ = {};
|
|
676
|
+
}
|
|
677
|
+
self.__DISABLE_WEBPACK_EXEC__[bundle] = true;
|
|
678
|
+
if (typeof self.__webpack_require__ !== "function" && self.__webpack_require_type__ !== "turbopack") {
|
|
679
|
+
self.__webpack_require__ = (remoteId) => {
|
|
680
|
+
const re = /\[(?<bundle>[^\]]+)\] (?<id>.*)/;
|
|
681
|
+
const match = re.exec(remoteId);
|
|
682
|
+
const remoteBundle = match?.groups?.bundle;
|
|
683
|
+
const id = match?.groups?.id;
|
|
684
|
+
if (!(id && remoteBundle)) {
|
|
685
|
+
throw new RemoteComponentsError(
|
|
686
|
+
`Remote Component module "${remoteId}" not found. Did you forget to wrap the Next.js config with \`withRemoteComponentsConfig\` on both host and remote?`
|
|
687
|
+
);
|
|
688
|
+
}
|
|
689
|
+
if (typeof self.__remote_webpack_require__?.[remoteBundle] !== "function") {
|
|
690
|
+
throw new RemoteComponentsError(
|
|
691
|
+
`Remote Components are not available in "${remoteBundle}". Did you forget to wrap the Next.js config with \`withRemoteComponentsConfig\` on both host and remote?`
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
return self.__remote_webpack_require__[remoteBundle](id);
|
|
695
|
+
};
|
|
696
|
+
self.__webpack_chunk_load__ = () => {
|
|
697
|
+
return Promise.resolve([]);
|
|
698
|
+
};
|
|
699
|
+
}
|
|
700
|
+
const {
|
|
701
|
+
default: { createFromReadableStream }
|
|
702
|
+
} = await import("react-server-dom-webpack/client.browser");
|
|
703
|
+
async function preloadScripts(scripts, url, remoteBundle, _) {
|
|
704
|
+
const scriptSrcs = scripts.flatMap((script) => {
|
|
705
|
+
const scriptSrc = script.getAttribute("src") || script.getAttribute("data-src");
|
|
706
|
+
script.parentElement?.removeChild(script);
|
|
707
|
+
if (!scriptSrc)
|
|
708
|
+
return [];
|
|
709
|
+
return [
|
|
710
|
+
{
|
|
711
|
+
src: new URL(scriptSrc.replace(NEXT_BUNDLE_PATH_RE, "/_next/"), url).href
|
|
712
|
+
}
|
|
713
|
+
];
|
|
714
|
+
});
|
|
715
|
+
await loadScripts(scriptSrcs, resolveClientUrl);
|
|
716
|
+
const hostShared = {
|
|
717
|
+
...sharedPolyfills(shared, resolveClientUrl),
|
|
718
|
+
...self.__remote_component_host_shared_modules__,
|
|
719
|
+
...shared
|
|
720
|
+
};
|
|
721
|
+
const resolve = {
|
|
722
|
+
"/react/index.js": (await import("react")).default,
|
|
723
|
+
"/react/jsx-dev-runtime.js": (await import("react/jsx-dev-runtime")).default,
|
|
724
|
+
"/react/jsx-runtime.js": (await import("react/jsx-runtime")).default,
|
|
725
|
+
"/react-dom/index.js": (await import("react-dom")).default,
|
|
726
|
+
"/react-dom/client.js": (await import("react-dom/client")).default,
|
|
727
|
+
...Object.entries(remoteShared ?? {}).reduce(
|
|
728
|
+
(acc, [key, value]) => {
|
|
729
|
+
if (typeof hostShared[value] !== "undefined") {
|
|
730
|
+
acc[key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, "")] = hostShared[value];
|
|
731
|
+
}
|
|
732
|
+
return acc;
|
|
733
|
+
},
|
|
734
|
+
{}
|
|
735
|
+
)
|
|
736
|
+
};
|
|
737
|
+
await Promise.all(
|
|
738
|
+
Object.entries(resolve).map(async ([key, value]) => {
|
|
739
|
+
if (typeof value === "function") {
|
|
740
|
+
resolve[key] = await value(remoteBundle);
|
|
741
|
+
}
|
|
742
|
+
return Promise.resolve(value);
|
|
743
|
+
})
|
|
744
|
+
);
|
|
745
|
+
applySharedModules(remoteBundle, resolve);
|
|
746
|
+
}
|
|
747
|
+
return {
|
|
748
|
+
self,
|
|
749
|
+
createFromReadableStream,
|
|
750
|
+
applySharedModules,
|
|
751
|
+
nextClientPagesLoader,
|
|
752
|
+
preloadScripts
|
|
753
|
+
};
|
|
754
|
+
}
|
|
755
|
+
var init_webpack = __esm({
|
|
756
|
+
"src/host/html/runtime/webpack.ts"() {
|
|
757
|
+
"use strict";
|
|
758
|
+
init_apply_shared_modules();
|
|
759
|
+
init_next_client_pages_loader();
|
|
760
|
+
init_polyfill();
|
|
761
|
+
init_constants2();
|
|
762
|
+
init_script_loader();
|
|
763
|
+
init_error();
|
|
764
|
+
}
|
|
765
|
+
});
|
|
766
|
+
|
|
767
|
+
// src/runtime/turbopack/patterns.ts
|
|
768
|
+
var REMOTE_SHARED_MARKER_RE, REMOTE_SHARED_ASSIGNMENT_RE, ASYNC_MODULE_LOADER_RE, ASYNC_MODULE_RESOLVE_RE, ASYNC_MODULE_ALL_RE, TURBOPACK_GLOBAL_RE;
|
|
769
|
+
var init_patterns = __esm({
|
|
770
|
+
"src/runtime/turbopack/patterns.ts"() {
|
|
771
|
+
"use strict";
|
|
772
|
+
REMOTE_SHARED_MARKER_RE = /(?:self|[a-z])\.TURBOPACK_REMOTE_SHARED/;
|
|
773
|
+
REMOTE_SHARED_ASSIGNMENT_RE = /\.TURBOPACK_REMOTE_SHARED=await (?:__turbopack_context__|[a-z])\.A\((?<sharedModuleId>[0-9]+)\)/;
|
|
774
|
+
ASYNC_MODULE_LOADER_RE = /(?:__turbopack_context__|e)\.A\((?<asyncSharedModuleId>[0-9]+)\)/;
|
|
775
|
+
ASYNC_MODULE_RESOLVE_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<inner>parentImport|e)=>Promise\.resolve\(\)\.then\(\(\)=>\k<inner>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
|
|
776
|
+
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]+)\)\)\)\}/;
|
|
777
|
+
TURBOPACK_GLOBAL_RE = /(?:globalThis|self)\s*(?:\.TURBOPACK|\[\s*["']TURBOPACK["']\s*\])/;
|
|
778
|
+
}
|
|
779
|
+
});
|
|
780
|
+
|
|
781
|
+
// src/runtime/turbopack/chunk-loader.ts
|
|
782
|
+
function createChunkLoader(runtime, resolveClientUrl) {
|
|
783
|
+
return function __turbopack_chunk_load__(chunkId, scriptBundle) {
|
|
784
|
+
logDebug("ChunkLoader", `Loading chunk: "${chunkId}"`);
|
|
785
|
+
const self = globalThis;
|
|
786
|
+
const {
|
|
787
|
+
bundle,
|
|
788
|
+
id: path,
|
|
789
|
+
prefix
|
|
790
|
+
} = REMOTE_COMPONENT_REGEX.exec(chunkId)?.groups ?? {
|
|
791
|
+
bundle: scriptBundle ?? "",
|
|
792
|
+
id: chunkId
|
|
793
|
+
};
|
|
794
|
+
logDebug(
|
|
795
|
+
"ChunkLoader",
|
|
796
|
+
`Parsed chunk - bundle: "${bundle}", path: "${path}", prefix: "${prefix}"`
|
|
797
|
+
);
|
|
798
|
+
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
799
|
+
logDebug("ChunkLoader", `Remote runtime: "${remoteRuntime}"`);
|
|
800
|
+
if (remoteRuntime === RUNTIME_WEBPACK) {
|
|
801
|
+
logDebug("ChunkLoader", "Skipping chunk load - webpack runtime detected");
|
|
802
|
+
return Promise.resolve(void 0);
|
|
803
|
+
}
|
|
804
|
+
const url = new URL(
|
|
805
|
+
path ? `${prefix ?? ""}${path}`.replace(
|
|
806
|
+
/(?<char>[^:])(?<double>\/\/)/g,
|
|
807
|
+
"$1/"
|
|
808
|
+
) : "/",
|
|
809
|
+
self.__remote_bundle_url__?.[bundle ?? "default"] ?? new URL(location.origin)
|
|
810
|
+
).href;
|
|
811
|
+
if (url.endsWith(".css")) {
|
|
812
|
+
logDebug("ChunkLoader", `Skipping CSS file: "${url}"`);
|
|
813
|
+
return;
|
|
814
|
+
}
|
|
815
|
+
if (!self.__remote_components_turbopack_chunk_loader_promise__) {
|
|
816
|
+
self.__remote_components_turbopack_chunk_loader_promise__ = {};
|
|
817
|
+
}
|
|
818
|
+
if (self.__remote_components_turbopack_chunk_loader_promise__[url]) {
|
|
819
|
+
logDebug("ChunkLoader", `Returning cached promise for: "${url}"`);
|
|
530
820
|
return self.__remote_components_turbopack_chunk_loader_promise__[url];
|
|
531
821
|
}
|
|
532
822
|
const resolvedUrl = resolveClientUrl?.(url) ?? url;
|
|
@@ -550,7 +840,7 @@ function createChunkLoader(runtime, resolveClientUrl) {
|
|
|
550
840
|
if (isProxied) {
|
|
551
841
|
reject(
|
|
552
842
|
new RemoteComponentsError(
|
|
553
|
-
`Failed to load chunk "${url}" via proxy "${resolvedUrl}". Ensure
|
|
843
|
+
`Failed to load chunk "${url}" via proxy "${resolvedUrl}". Ensure withRemoteComponentsHostProxy middleware is configured and "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" is in the matcher. See: ${CORS_DOCS_URL}`
|
|
554
844
|
)
|
|
555
845
|
);
|
|
556
846
|
} else {
|
|
@@ -700,18 +990,18 @@ async function handleTurbopackChunk(code, bundle, url) {
|
|
|
700
990
|
}
|
|
701
991
|
}
|
|
702
992
|
var init_chunk_loader = __esm({
|
|
703
|
-
"src/
|
|
993
|
+
"src/runtime/turbopack/chunk-loader.ts"() {
|
|
704
994
|
"use strict";
|
|
995
|
+
init_constants2();
|
|
996
|
+
init_protected_rc_fallback();
|
|
705
997
|
init_constants();
|
|
706
998
|
init_error();
|
|
707
999
|
init_logger();
|
|
708
|
-
|
|
709
|
-
init_protected_rc_fallback();
|
|
710
|
-
init_turbopack_patterns();
|
|
1000
|
+
init_patterns();
|
|
711
1001
|
}
|
|
712
1002
|
});
|
|
713
1003
|
|
|
714
|
-
// src/
|
|
1004
|
+
// src/runtime/turbopack/module.ts
|
|
715
1005
|
function handleTurbopackModule(bundle, moduleId, id) {
|
|
716
1006
|
const self = globalThis;
|
|
717
1007
|
const bundleKey = getBundleKey(bundle);
|
|
@@ -878,768 +1168,311 @@ function createTurbopackContext(bundle, exports, moduleExports, modules, moduleI
|
|
|
878
1168
|
} catch {
|
|
879
1169
|
}
|
|
880
1170
|
}
|
|
881
|
-
return mod;
|
|
882
|
-
},
|
|
883
|
-
// require
|
|
884
|
-
r(requireId) {
|
|
885
|
-
return self.__webpack_require__?.(`[${bundle}] ${requireId}`);
|
|
886
|
-
},
|
|
887
|
-
// value exports
|
|
888
|
-
v(value) {
|
|
889
|
-
if (typeof value === "function") {
|
|
890
|
-
exports.default = value((vid) => {
|
|
891
|
-
return self.__webpack_require__?.(`[${bundle}] ${vid}`);
|
|
892
|
-
});
|
|
893
|
-
} else {
|
|
894
|
-
moduleExports.exports = value;
|
|
895
|
-
}
|
|
896
|
-
},
|
|
897
|
-
// async module initializer
|
|
898
|
-
async a(mod) {
|
|
899
|
-
let result;
|
|
900
|
-
await mod(
|
|
901
|
-
() => {
|
|
902
|
-
},
|
|
903
|
-
(value) => result = value
|
|
904
|
-
);
|
|
905
|
-
exports.default = result;
|
|
906
|
-
},
|
|
907
|
-
// async module loader
|
|
908
|
-
async A(Aid) {
|
|
909
|
-
const mod = self.__webpack_require__?.(`[${bundle}] ${Aid}`);
|
|
910
|
-
return mod.default(
|
|
911
|
-
(parentId) => self.__webpack_require__?.(`[${bundle}] ${parentId}`)
|
|
912
|
-
);
|
|
913
|
-
},
|
|
914
|
-
// dynamic import tracking — no-op for remote components
|
|
915
|
-
j() {
|
|
916
|
-
},
|
|
917
|
-
// chunk loader
|
|
918
|
-
l(url) {
|
|
919
|
-
const flatModules = Array.isArray(modules) ? modules : [];
|
|
920
|
-
const moduleInitIndex = flatModules.indexOf(moduleInit);
|
|
921
|
-
if (moduleInitIndex !== -1) {
|
|
922
|
-
const scriptIndex = flatModules.slice(0, moduleInitIndex).findLastIndex((bundleEntry) => bundleEntry instanceof Element);
|
|
923
|
-
if (scriptIndex !== -1) {
|
|
924
|
-
const script = flatModules[scriptIndex];
|
|
925
|
-
const scriptSrc = script.getAttribute("data-turbopack-src") || "";
|
|
926
|
-
const nextIndex = scriptSrc.indexOf("/_next");
|
|
927
|
-
const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : "";
|
|
928
|
-
const bundleUrl = `[${bundle}] ${baseUrl}/_next/${url}`;
|
|
929
|
-
return self.__webpack_chunk_load__?.(bundleUrl, bundle);
|
|
930
|
-
}
|
|
931
|
-
}
|
|
932
|
-
throw new Error(
|
|
933
|
-
`Failed to load Turbopack chunk "${url}" for module "${id}". Check the URL is correct.`
|
|
934
|
-
);
|
|
935
|
-
},
|
|
936
|
-
// global object for this bundle
|
|
937
|
-
g: self.__remote_components_turbopack_global__?.[bundle],
|
|
938
|
-
m: moduleExports,
|
|
939
|
-
e: exports
|
|
940
|
-
};
|
|
941
|
-
}
|
|
942
|
-
var init_turbopack_module = __esm({
|
|
943
|
-
"src/shared/client/turbopack-module.ts"() {
|
|
944
|
-
"use strict";
|
|
945
|
-
init_logger();
|
|
946
|
-
init_const();
|
|
947
|
-
}
|
|
948
|
-
});
|
|
949
|
-
|
|
950
|
-
// src/shared/client/shared-modules.ts
|
|
951
|
-
async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {}) {
|
|
952
|
-
const self = globalThis;
|
|
953
|
-
self.__remote_shared_modules__ = self.__remote_shared_modules__ ?? {};
|
|
954
|
-
if (!self.__remote_shared_modules__[bundle]) {
|
|
955
|
-
self.__remote_shared_modules__[bundle] = {};
|
|
956
|
-
}
|
|
957
|
-
const bundleKey = getBundleKey(bundle);
|
|
958
|
-
let modules = self[`TURBOPACK_${bundleKey}`];
|
|
959
|
-
if (modules && typeof modules === "object" && "__chunks__" in modules) {
|
|
960
|
-
const chunks = modules.__chunks__;
|
|
961
|
-
modules = chunks.flat();
|
|
962
|
-
}
|
|
963
|
-
let sharedModuleInitializer = null;
|
|
964
|
-
if (modules) {
|
|
965
|
-
const allModules = Array.isArray(modules) ? modules.flat() : Object.entries(modules).flat();
|
|
966
|
-
const sharedModuleInitializerIndex = allModules.findIndex((idOrFunc) => {
|
|
967
|
-
if (typeof idOrFunc !== "function") {
|
|
968
|
-
return false;
|
|
969
|
-
}
|
|
970
|
-
const funcCode = idOrFunc.toString();
|
|
971
|
-
return REMOTE_SHARED_MARKER_RE.test(funcCode);
|
|
972
|
-
});
|
|
973
|
-
if (sharedModuleInitializerIndex > 0) {
|
|
974
|
-
const sharedModuleInitializerCode = allModules[sharedModuleInitializerIndex].toString();
|
|
975
|
-
const sharedModuleInitializerId = allModules[sharedModuleInitializerIndex - 1];
|
|
976
|
-
const { sharedModuleId } = REMOTE_SHARED_ASSIGNMENT_RE.exec(sharedModuleInitializerCode)?.groups ?? {};
|
|
977
|
-
if (sharedModuleId) {
|
|
978
|
-
const { default: sharedModuleInitializerInstance } = handleTurbopackModule(
|
|
979
|
-
bundle,
|
|
980
|
-
sharedModuleId,
|
|
981
|
-
`[${bundle}] ${sharedModuleInitializerId}`
|
|
982
|
-
);
|
|
983
|
-
sharedModuleInitializer = sharedModuleInitializerInstance;
|
|
984
|
-
}
|
|
985
|
-
}
|
|
986
|
-
if (sharedModuleInitializer) {
|
|
987
|
-
const { shared } = await sharedModuleInitializer;
|
|
988
|
-
const sharedModuleIds = extractSharedModuleIds(
|
|
989
|
-
shared,
|
|
990
|
-
bundleKey,
|
|
991
|
-
self
|
|
992
|
-
);
|
|
993
|
-
return Promise.all(
|
|
994
|
-
Object.entries(sharedModuleIds).map(async ([id, module2]) => {
|
|
995
|
-
if (self.__remote_shared_modules__?.[bundle]) {
|
|
996
|
-
if (hostShared[module2]) {
|
|
997
|
-
self.__remote_shared_modules__[bundle][id] = await hostShared[module2](bundle);
|
|
998
|
-
} else {
|
|
999
|
-
logError(
|
|
1000
|
-
"SharedModules",
|
|
1001
|
-
`Host shared module "${module2}" not found for ID ${id}`
|
|
1002
|
-
);
|
|
1003
|
-
}
|
|
1004
|
-
}
|
|
1005
|
-
})
|
|
1006
|
-
);
|
|
1007
|
-
}
|
|
1008
|
-
}
|
|
1009
|
-
return Promise.all(
|
|
1010
|
-
Object.entries(remoteShared).map(async ([id, module2]) => {
|
|
1011
|
-
if (self.__remote_shared_modules__?.[bundle]) {
|
|
1012
|
-
if (hostShared[module2]) {
|
|
1013
|
-
const normalizedId = id.replace("[app-ssr]", "[app-client]");
|
|
1014
|
-
self.__remote_shared_modules__[bundle][normalizedId] = await hostShared[module2](bundle);
|
|
1015
|
-
} else {
|
|
1016
|
-
logError(
|
|
1017
|
-
"SharedModules",
|
|
1018
|
-
`Shared module "${module2}" not found for "${bundle}"`
|
|
1019
|
-
);
|
|
1020
|
-
}
|
|
1021
|
-
}
|
|
1022
|
-
})
|
|
1023
|
-
);
|
|
1024
|
-
}
|
|
1025
|
-
function extractSharedModuleIds(shared, bundleKey, self) {
|
|
1026
|
-
return Object.entries(shared).filter(([, value]) => typeof value === "function").reduce((acc, [key, value]) => {
|
|
1027
|
-
const { asyncSharedModuleId } = ASYNC_MODULE_LOADER_RE.exec(value.toString())?.groups ?? {};
|
|
1028
|
-
if (asyncSharedModuleId) {
|
|
1029
|
-
const asyncSharedModuleIdNumber = Number(asyncSharedModuleId);
|
|
1030
|
-
let asyncSharedModule;
|
|
1031
|
-
let turbopackModules = self[`TURBOPACK_${bundleKey}`];
|
|
1032
|
-
if (turbopackModules && typeof turbopackModules === "object" && "__chunks__" in turbopackModules) {
|
|
1033
|
-
const chunks = turbopackModules.__chunks__;
|
|
1034
|
-
turbopackModules = chunks.flat();
|
|
1035
|
-
}
|
|
1036
|
-
const newAllModules = Array.isArray(turbopackModules) ? turbopackModules.flat() : turbopackModules ? Object.entries(turbopackModules).flatMap(([key2, value2]) => [
|
|
1037
|
-
key2,
|
|
1038
|
-
value2
|
|
1039
|
-
]) : [];
|
|
1040
|
-
const asyncSharedModuleIdIndex = newAllModules.indexOf(
|
|
1041
|
-
asyncSharedModuleIdNumber
|
|
1042
|
-
);
|
|
1043
|
-
if (asyncSharedModuleIdIndex !== -1 && typeof newAllModules[asyncSharedModuleIdIndex + 1] === "function") {
|
|
1044
|
-
asyncSharedModule = newAllModules[asyncSharedModuleIdIndex + 1];
|
|
1045
|
-
}
|
|
1046
|
-
if (asyncSharedModule) {
|
|
1047
|
-
const asyncSharedModuleCode = asyncSharedModule.toString();
|
|
1048
|
-
const { sharedModuleId } = ASYNC_MODULE_RESOLVE_RE.exec(asyncSharedModuleCode)?.groups ?? ASYNC_MODULE_ALL_RE.exec(asyncSharedModuleCode)?.groups ?? {};
|
|
1049
|
-
acc[sharedModuleId ?? asyncSharedModuleId] = key.replace(
|
|
1050
|
-
"__remote_shared_module_",
|
|
1051
|
-
""
|
|
1052
|
-
);
|
|
1053
|
-
}
|
|
1054
|
-
}
|
|
1055
|
-
return acc;
|
|
1056
|
-
}, {});
|
|
1057
|
-
}
|
|
1058
|
-
function getSharedModule(bundle, id) {
|
|
1059
|
-
const self = globalThis;
|
|
1060
|
-
for (const [key, value] of Object.entries(
|
|
1061
|
-
self.__remote_shared_modules__?.[bundle] ?? {}
|
|
1062
|
-
)) {
|
|
1063
|
-
if (typeof value !== "undefined" && (typeof id === "string" && id.includes(key) || id === key)) {
|
|
1064
|
-
return value;
|
|
1065
|
-
}
|
|
1066
|
-
}
|
|
1067
|
-
return null;
|
|
1068
|
-
}
|
|
1069
|
-
var init_shared_modules2 = __esm({
|
|
1070
|
-
"src/shared/client/shared-modules.ts"() {
|
|
1071
|
-
"use strict";
|
|
1072
|
-
init_logger();
|
|
1073
|
-
init_const();
|
|
1074
|
-
init_turbopack_module();
|
|
1075
|
-
init_turbopack_patterns();
|
|
1076
|
-
}
|
|
1077
|
-
});
|
|
1078
|
-
|
|
1079
|
-
// src/shared/client/webpack-adapter.ts
|
|
1080
|
-
async function setupWebpackRuntime(runtime, scripts = [], url = new URL(location.href), bundle, shared = {}, remoteShared = {}, resolveClientUrl) {
|
|
1081
|
-
const self = globalThis;
|
|
1082
|
-
if (!self.__remote_bundle_url__) {
|
|
1083
|
-
self.__remote_bundle_url__ = {};
|
|
1084
|
-
}
|
|
1085
|
-
self.__remote_bundle_url__[bundle ?? "default"] = url;
|
|
1086
|
-
self.__webpack_get_script_filename__ = () => null;
|
|
1087
|
-
if (typeof self.__webpack_require__ !== "function" || self.__webpack_require_type__ !== "turbopack") {
|
|
1088
|
-
if (!self.__original_webpack_require__ && !self.__original_webpack_chunk_load__) {
|
|
1089
|
-
self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
|
|
1090
|
-
self.__original_webpack_require__ = self.__webpack_require__;
|
|
1091
|
-
}
|
|
1092
|
-
self.__webpack_chunk_load__ = createChunkLoader(runtime, resolveClientUrl);
|
|
1093
|
-
self.__webpack_require__ = createModuleRequire(runtime);
|
|
1094
|
-
self.__webpack_require_type__ = runtime;
|
|
1095
|
-
if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {
|
|
1096
|
-
const remoteBundle = bundle ?? "default";
|
|
1097
|
-
self.__remote_webpack_require__[remoteBundle] = self.__webpack_require__;
|
|
1098
|
-
self.__remote_webpack_require__[remoteBundle].type = "turbopack";
|
|
1099
|
-
}
|
|
1100
|
-
}
|
|
1101
|
-
if (runtime === RUNTIME_TURBOPACK) {
|
|
1102
|
-
await Promise.all(
|
|
1103
|
-
scripts.map((script) => {
|
|
1104
|
-
if (script.src) {
|
|
1105
|
-
return self.__webpack_chunk_load__?.(script.src, bundle);
|
|
1106
|
-
}
|
|
1107
|
-
return Promise.resolve(void 0);
|
|
1108
|
-
})
|
|
1109
|
-
);
|
|
1110
|
-
}
|
|
1111
|
-
const coreShared = {
|
|
1112
|
-
react: async () => (await import("react")).default,
|
|
1113
|
-
"react-dom": async () => (await import("react-dom")).default,
|
|
1114
|
-
"react/jsx-dev-runtime": async () => (await import("react/jsx-dev-runtime")).default,
|
|
1115
|
-
"react/jsx-runtime": async () => (await import("react/jsx-runtime")).default,
|
|
1116
|
-
"react-dom/client": async () => (await import("react-dom/client")).default,
|
|
1117
|
-
...shared
|
|
1118
|
-
};
|
|
1119
|
-
await initializeSharedModules(
|
|
1120
|
-
bundle ?? "default",
|
|
1121
|
-
// include all core modules as shared
|
|
1122
|
-
coreShared,
|
|
1123
|
-
remoteShared
|
|
1124
|
-
);
|
|
1125
|
-
}
|
|
1126
|
-
function createModuleRequire(runtime) {
|
|
1127
|
-
return (id) => {
|
|
1128
|
-
const self = globalThis;
|
|
1129
|
-
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
1130
|
-
bundle: "default",
|
|
1131
|
-
id
|
|
1132
|
-
};
|
|
1133
|
-
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
1134
|
-
logDebug("WebpackAdapter", `remoteRuntime: "${remoteRuntime}"`);
|
|
1135
|
-
try {
|
|
1136
|
-
if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {
|
|
1137
|
-
return self.__remote_webpack_require__?.[bundle]?.(moduleId);
|
|
1138
|
-
}
|
|
1139
|
-
const sharedModuleId = moduleId ?? id;
|
|
1140
|
-
const sharedModule = getSharedModule(bundle ?? "default", sharedModuleId);
|
|
1141
|
-
if (sharedModule) {
|
|
1142
|
-
return sharedModule;
|
|
1143
|
-
}
|
|
1144
|
-
if (bundle && moduleId) {
|
|
1145
|
-
return handleTurbopackModule(bundle, moduleId, id);
|
|
1171
|
+
return mod;
|
|
1172
|
+
},
|
|
1173
|
+
// require
|
|
1174
|
+
r(requireId) {
|
|
1175
|
+
return self.__webpack_require__?.(`[${bundle}] ${requireId}`);
|
|
1176
|
+
},
|
|
1177
|
+
// value exports
|
|
1178
|
+
v(value) {
|
|
1179
|
+
if (typeof value === "function") {
|
|
1180
|
+
exports.default = value((vid) => {
|
|
1181
|
+
return self.__webpack_require__?.(`[${bundle}] ${vid}`);
|
|
1182
|
+
});
|
|
1183
|
+
} else {
|
|
1184
|
+
moduleExports.exports = value;
|
|
1146
1185
|
}
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
|
|
1150
|
-
|
|
1151
|
-
|
|
1186
|
+
},
|
|
1187
|
+
// async module initializer
|
|
1188
|
+
async a(mod) {
|
|
1189
|
+
let result;
|
|
1190
|
+
await mod(
|
|
1191
|
+
() => {
|
|
1192
|
+
},
|
|
1193
|
+
(value) => result = value
|
|
1152
1194
|
);
|
|
1153
|
-
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
)
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1195
|
+
exports.default = result;
|
|
1196
|
+
},
|
|
1197
|
+
// async module loader
|
|
1198
|
+
async A(Aid) {
|
|
1199
|
+
const mod = self.__webpack_require__?.(`[${bundle}] ${Aid}`);
|
|
1200
|
+
return mod.default(
|
|
1201
|
+
(parentId) => self.__webpack_require__?.(`[${bundle}] ${parentId}`)
|
|
1202
|
+
);
|
|
1203
|
+
},
|
|
1204
|
+
// dynamic import tracking — no-op for remote components
|
|
1205
|
+
j() {
|
|
1206
|
+
},
|
|
1207
|
+
// chunk loader
|
|
1208
|
+
l(url) {
|
|
1209
|
+
const flatModules = Array.isArray(modules) ? modules : [];
|
|
1210
|
+
const moduleInitIndex = flatModules.indexOf(moduleInit);
|
|
1211
|
+
if (moduleInitIndex !== -1) {
|
|
1212
|
+
const scriptIndex = flatModules.slice(0, moduleInitIndex).findLastIndex((bundleEntry) => bundleEntry instanceof Element);
|
|
1213
|
+
if (scriptIndex !== -1) {
|
|
1214
|
+
const script = flatModules[scriptIndex];
|
|
1215
|
+
const scriptSrc = script.getAttribute("data-turbopack-src") || "";
|
|
1216
|
+
const nextIndex = scriptSrc.indexOf("/_next");
|
|
1217
|
+
const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : "";
|
|
1218
|
+
const bundleUrl = `[${bundle}] ${baseUrl}/_next/${url}`;
|
|
1219
|
+
return self.__webpack_chunk_load__?.(bundleUrl, bundle);
|
|
1220
|
+
}
|
|
1169
1221
|
}
|
|
1170
|
-
|
|
1222
|
+
throw new Error(
|
|
1223
|
+
`Failed to load Turbopack chunk "${url}" for module "${id}". Check the URL is correct.`
|
|
1224
|
+
);
|
|
1225
|
+
},
|
|
1226
|
+
// global object for this bundle
|
|
1227
|
+
g: self.__remote_components_turbopack_global__?.[bundle],
|
|
1228
|
+
m: moduleExports,
|
|
1229
|
+
e: exports
|
|
1171
1230
|
};
|
|
1172
1231
|
}
|
|
1173
|
-
var
|
|
1174
|
-
"src/
|
|
1232
|
+
var init_module = __esm({
|
|
1233
|
+
"src/runtime/turbopack/module.ts"() {
|
|
1175
1234
|
"use strict";
|
|
1176
|
-
|
|
1235
|
+
init_constants2();
|
|
1177
1236
|
init_logger();
|
|
1178
|
-
init_chunk_loader();
|
|
1179
|
-
init_const();
|
|
1180
|
-
init_shared_modules2();
|
|
1181
|
-
init_turbopack_module();
|
|
1182
1237
|
}
|
|
1183
1238
|
});
|
|
1184
1239
|
|
|
1185
|
-
// src/
|
|
1186
|
-
async function
|
|
1187
|
-
const resolvedUrl = resolveClientUrl(absoluteSrc) ?? absoluteSrc;
|
|
1188
|
-
const fetchUrl = new URL(resolvedUrl, location.href).href;
|
|
1189
|
-
const response = await fetch(fetchUrl);
|
|
1190
|
-
if (!response.ok)
|
|
1191
|
-
throw new Error(`Proxied fetch failed: ${response.status}`);
|
|
1192
|
-
const content = (await response.text()).replace(/import\.meta\.url/g, JSON.stringify(absoluteSrc)).replace(
|
|
1193
|
-
/\b(from|import)\s*(["'])(\.\.?\/[^"']+)\2/g,
|
|
1194
|
-
(_, keyword, quote, relativePath) => {
|
|
1195
|
-
const absoluteImportUrl = new URL(relativePath, absoluteSrc).href;
|
|
1196
|
-
const resolvedImportUrl = new URL(
|
|
1197
|
-
resolveClientUrl(absoluteImportUrl) ?? absoluteImportUrl,
|
|
1198
|
-
location.href
|
|
1199
|
-
).href;
|
|
1200
|
-
return `${keyword} ${quote}${resolvedImportUrl}${quote}`;
|
|
1201
|
-
}
|
|
1202
|
-
);
|
|
1203
|
-
const moduleBlobUrl = URL.createObjectURL(
|
|
1204
|
-
new Blob([content], { type: "text/javascript" })
|
|
1205
|
-
);
|
|
1206
|
-
const wrapperContent = [
|
|
1207
|
-
`import*as m from${JSON.stringify(moduleBlobUrl)};`,
|
|
1208
|
-
`globalThis.__rc_module_registry__=globalThis.__rc_module_registry__||{};`,
|
|
1209
|
-
`globalThis.__rc_module_registry__[${JSON.stringify(absoluteSrc)}]=m;`
|
|
1210
|
-
].join("");
|
|
1211
|
-
const wrapperBlobUrl = URL.createObjectURL(
|
|
1212
|
-
new Blob([wrapperContent], { type: "text/javascript" })
|
|
1213
|
-
);
|
|
1214
|
-
const scriptEl = document.createElement("script");
|
|
1215
|
-
scriptEl.type = "module";
|
|
1216
|
-
scriptEl.src = wrapperBlobUrl;
|
|
1217
|
-
try {
|
|
1218
|
-
await new Promise((resolve, reject) => {
|
|
1219
|
-
scriptEl.onload = () => resolve();
|
|
1220
|
-
scriptEl.onerror = () => reject(new Error(`Failed to load module for ${absoluteSrc}`));
|
|
1221
|
-
document.head.appendChild(scriptEl);
|
|
1222
|
-
});
|
|
1223
|
-
} finally {
|
|
1224
|
-
scriptEl.remove();
|
|
1225
|
-
URL.revokeObjectURL(moduleBlobUrl);
|
|
1226
|
-
URL.revokeObjectURL(wrapperBlobUrl);
|
|
1227
|
-
}
|
|
1228
|
-
const registry = globalThis.__rc_module_registry__;
|
|
1229
|
-
const mod = registry?.[absoluteSrc] ?? {};
|
|
1230
|
-
if (registry)
|
|
1231
|
-
delete registry[absoluteSrc];
|
|
1232
|
-
return mod;
|
|
1233
|
-
}
|
|
1234
|
-
async function importDirectly(absoluteSrc) {
|
|
1235
|
-
try {
|
|
1236
|
-
return await import(
|
|
1237
|
-
/* @vite-ignore */
|
|
1238
|
-
/* webpackIgnore: true */
|
|
1239
|
-
absoluteSrc
|
|
1240
|
-
);
|
|
1241
|
-
} catch (importError) {
|
|
1242
|
-
if (!absoluteSrc.startsWith("blob:")) {
|
|
1243
|
-
warnCrossOriginFetchError("StaticLoader", absoluteSrc);
|
|
1244
|
-
}
|
|
1245
|
-
throw importError;
|
|
1246
|
-
}
|
|
1247
|
-
}
|
|
1248
|
-
function resolveScriptSrc(script, url) {
|
|
1249
|
-
const rawSrc = typeof script.getAttribute === "function" ? script.getAttribute("src") ?? script.src : script.src;
|
|
1250
|
-
if (!rawSrc && script.textContent) {
|
|
1251
|
-
return URL.createObjectURL(
|
|
1252
|
-
new Blob(
|
|
1253
|
-
[script.textContent.replace(/import\.meta\.url/g, JSON.stringify(url))],
|
|
1254
|
-
{ type: "text/javascript" }
|
|
1255
|
-
)
|
|
1256
|
-
);
|
|
1257
|
-
}
|
|
1258
|
-
return rawSrc;
|
|
1259
|
-
}
|
|
1260
|
-
async function loadStaticRemoteComponent(scripts, url, resolveClientUrl) {
|
|
1240
|
+
// src/runtime/turbopack/shared-modules.ts
|
|
1241
|
+
async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {}) {
|
|
1261
1242
|
const self = globalThis;
|
|
1262
|
-
|
|
1263
|
-
|
|
1243
|
+
self.__remote_shared_modules__ = self.__remote_shared_modules__ ?? {};
|
|
1244
|
+
if (!self.__remote_shared_modules__[bundle]) {
|
|
1245
|
+
self.__remote_shared_modules__[bundle] = {};
|
|
1264
1246
|
}
|
|
1265
|
-
|
|
1266
|
-
|
|
1247
|
+
const bundleKey = getBundleKey(bundle);
|
|
1248
|
+
let modules = self[`TURBOPACK_${bundleKey}`];
|
|
1249
|
+
if (modules && typeof modules === "object" && "__chunks__" in modules) {
|
|
1250
|
+
const chunks = modules.__chunks__;
|
|
1251
|
+
modules = chunks.flat();
|
|
1267
1252
|
}
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1273
|
-
|
|
1274
|
-
|
|
1275
|
-
|
|
1276
|
-
|
|
1277
|
-
|
|
1278
|
-
|
|
1279
|
-
|
|
1280
|
-
|
|
1281
|
-
|
|
1282
|
-
|
|
1283
|
-
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1287
|
-
);
|
|
1288
|
-
}
|
|
1289
|
-
if (typeof mod.unmount === "function" || typeof mod.default?.unmount === "function") {
|
|
1290
|
-
if (!self.__remote_script_entrypoint_unmount__) {
|
|
1291
|
-
self.__remote_script_entrypoint_unmount__ = {};
|
|
1292
|
-
}
|
|
1293
|
-
if (!self.__remote_script_entrypoint_unmount__[url.href]) {
|
|
1294
|
-
self.__remote_script_entrypoint_unmount__[url.href] = /* @__PURE__ */ new Set();
|
|
1295
|
-
}
|
|
1296
|
-
self.__remote_script_entrypoint_unmount__[url.href]?.add(
|
|
1297
|
-
mod.unmount || mod.default?.unmount || (() => {
|
|
1298
|
-
})
|
|
1299
|
-
);
|
|
1300
|
-
}
|
|
1301
|
-
return {
|
|
1302
|
-
mount: mod.mount || mod.default?.mount,
|
|
1303
|
-
unmount: mod.unmount || mod.default?.unmount
|
|
1304
|
-
};
|
|
1305
|
-
} catch (e) {
|
|
1306
|
-
logError(
|
|
1307
|
-
"StaticLoader",
|
|
1308
|
-
`Error loading remote component script from "${script.src || url.href}".`,
|
|
1309
|
-
e
|
|
1253
|
+
let sharedModuleInitializer = null;
|
|
1254
|
+
if (modules) {
|
|
1255
|
+
const allModules = Array.isArray(modules) ? modules.flat() : Object.entries(modules).flat();
|
|
1256
|
+
const sharedModuleInitializerIndex = allModules.findIndex((idOrFunc) => {
|
|
1257
|
+
if (typeof idOrFunc !== "function") {
|
|
1258
|
+
return false;
|
|
1259
|
+
}
|
|
1260
|
+
const funcCode = idOrFunc.toString();
|
|
1261
|
+
return REMOTE_SHARED_MARKER_RE.test(funcCode);
|
|
1262
|
+
});
|
|
1263
|
+
if (sharedModuleInitializerIndex > 0) {
|
|
1264
|
+
const sharedModuleInitializerCode = allModules[sharedModuleInitializerIndex].toString();
|
|
1265
|
+
const sharedModuleInitializerId = allModules[sharedModuleInitializerIndex - 1];
|
|
1266
|
+
const { sharedModuleId } = REMOTE_SHARED_ASSIGNMENT_RE.exec(sharedModuleInitializerCode)?.groups ?? {};
|
|
1267
|
+
if (sharedModuleId) {
|
|
1268
|
+
const { default: sharedModuleInitializerInstance } = handleTurbopackModule(
|
|
1269
|
+
bundle,
|
|
1270
|
+
sharedModuleId,
|
|
1271
|
+
`[${bundle}] ${sharedModuleInitializerId}`
|
|
1310
1272
|
);
|
|
1311
|
-
|
|
1312
|
-
|
|
1313
|
-
|
|
1314
|
-
|
|
1273
|
+
sharedModuleInitializer = sharedModuleInitializerInstance;
|
|
1274
|
+
}
|
|
1275
|
+
}
|
|
1276
|
+
if (sharedModuleInitializer) {
|
|
1277
|
+
const { shared } = await sharedModuleInitializer;
|
|
1278
|
+
const sharedModuleIds = extractSharedModuleIds(
|
|
1279
|
+
shared,
|
|
1280
|
+
bundleKey,
|
|
1281
|
+
self
|
|
1282
|
+
);
|
|
1283
|
+
return Promise.all(
|
|
1284
|
+
Object.entries(sharedModuleIds).map(async ([id, module2]) => {
|
|
1285
|
+
if (self.__remote_shared_modules__?.[bundle]) {
|
|
1286
|
+
if (hostShared[module2]) {
|
|
1287
|
+
self.__remote_shared_modules__[bundle][id] = await hostShared[module2](bundle);
|
|
1288
|
+
} else {
|
|
1289
|
+
logError(
|
|
1290
|
+
"SharedModules",
|
|
1291
|
+
`Host shared module "${module2}" not found for ID ${id}`
|
|
1292
|
+
);
|
|
1293
|
+
}
|
|
1294
|
+
}
|
|
1295
|
+
})
|
|
1296
|
+
);
|
|
1297
|
+
}
|
|
1298
|
+
}
|
|
1299
|
+
return Promise.all(
|
|
1300
|
+
Object.entries(remoteShared).map(async ([id, module2]) => {
|
|
1301
|
+
if (self.__remote_shared_modules__?.[bundle]) {
|
|
1302
|
+
if (hostShared[module2]) {
|
|
1303
|
+
const normalizedId = id.replace("[app-ssr]", "[app-client]");
|
|
1304
|
+
self.__remote_shared_modules__[bundle][normalizedId] = await hostShared[module2](bundle);
|
|
1305
|
+
} else {
|
|
1306
|
+
logError(
|
|
1307
|
+
"SharedModules",
|
|
1308
|
+
`Shared module "${module2}" not found for "${bundle}"`
|
|
1309
|
+
);
|
|
1310
|
+
}
|
|
1315
1311
|
}
|
|
1316
1312
|
})
|
|
1317
1313
|
);
|
|
1318
|
-
|
|
1319
|
-
|
|
1320
|
-
|
|
1321
|
-
|
|
1314
|
+
}
|
|
1315
|
+
function extractSharedModuleIds(shared, bundleKey, self) {
|
|
1316
|
+
return Object.entries(shared).filter(([, value]) => typeof value === "function").reduce((acc, [key, value]) => {
|
|
1317
|
+
const { asyncSharedModuleId } = ASYNC_MODULE_LOADER_RE.exec(value.toString())?.groups ?? {};
|
|
1318
|
+
if (asyncSharedModuleId) {
|
|
1319
|
+
const asyncSharedModuleIdNumber = Number(asyncSharedModuleId);
|
|
1320
|
+
let asyncSharedModule;
|
|
1321
|
+
let turbopackModules = self[`TURBOPACK_${bundleKey}`];
|
|
1322
|
+
if (turbopackModules && typeof turbopackModules === "object" && "__chunks__" in turbopackModules) {
|
|
1323
|
+
const chunks = turbopackModules.__chunks__;
|
|
1324
|
+
turbopackModules = chunks.flat();
|
|
1322
1325
|
}
|
|
1323
|
-
|
|
1324
|
-
|
|
1326
|
+
const newAllModules = Array.isArray(turbopackModules) ? turbopackModules.flat() : turbopackModules ? Object.entries(turbopackModules).flatMap(([key2, value2]) => [
|
|
1327
|
+
key2,
|
|
1328
|
+
value2
|
|
1329
|
+
]) : [];
|
|
1330
|
+
const asyncSharedModuleIdIndex = newAllModules.indexOf(
|
|
1331
|
+
asyncSharedModuleIdNumber
|
|
1332
|
+
);
|
|
1333
|
+
if (asyncSharedModuleIdIndex !== -1 && typeof newAllModules[asyncSharedModuleIdIndex + 1] === "function") {
|
|
1334
|
+
asyncSharedModule = newAllModules[asyncSharedModuleIdIndex + 1];
|
|
1335
|
+
}
|
|
1336
|
+
if (asyncSharedModule) {
|
|
1337
|
+
const asyncSharedModuleCode = asyncSharedModule.toString();
|
|
1338
|
+
const { sharedModuleId } = ASYNC_MODULE_RESOLVE_RE.exec(asyncSharedModuleCode)?.groups ?? ASYNC_MODULE_ALL_RE.exec(asyncSharedModuleCode)?.groups ?? {};
|
|
1339
|
+
acc[sharedModuleId ?? asyncSharedModuleId] = key.replace(
|
|
1340
|
+
"__remote_shared_module_",
|
|
1341
|
+
""
|
|
1342
|
+
);
|
|
1325
1343
|
}
|
|
1326
|
-
return acc;
|
|
1327
|
-
},
|
|
1328
|
-
{
|
|
1329
|
-
mount: /* @__PURE__ */ new Set(),
|
|
1330
|
-
unmount: /* @__PURE__ */ new Set()
|
|
1331
1344
|
}
|
|
1332
|
-
|
|
1345
|
+
return acc;
|
|
1346
|
+
}, {});
|
|
1333
1347
|
}
|
|
1334
|
-
|
|
1335
|
-
"src/shared/client/static-loader.ts"() {
|
|
1336
|
-
"use strict";
|
|
1337
|
-
init_logger();
|
|
1338
|
-
}
|
|
1339
|
-
});
|
|
1340
|
-
|
|
1341
|
-
// src/shared/client/polyfill.tsx
|
|
1342
|
-
function applyBundleUrlToSrc(bundle, src) {
|
|
1348
|
+
function getSharedModule(bundle, id) {
|
|
1343
1349
|
const self = globalThis;
|
|
1344
|
-
|
|
1345
|
-
|
|
1346
|
-
|
|
1347
|
-
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
}
|
|
1351
|
-
return `${self.__remote_bundle_url__?.[bundle]?.origin ?? ""}${assetPrefix}/_next/${path}`;
|
|
1352
|
-
}
|
|
1353
|
-
function applyBundleUrlToImagePropsSrc(bundle, src) {
|
|
1354
|
-
if (typeof src === "string") {
|
|
1355
|
-
return applyBundleUrlToSrc(bundle, src);
|
|
1350
|
+
for (const [key, value] of Object.entries(
|
|
1351
|
+
self.__remote_shared_modules__?.[bundle] ?? {}
|
|
1352
|
+
)) {
|
|
1353
|
+
if (typeof value !== "undefined" && (typeof id === "string" && id.includes(key) || id === key)) {
|
|
1354
|
+
return value;
|
|
1355
|
+
}
|
|
1356
1356
|
}
|
|
1357
|
-
|
|
1358
|
-
return applyBundleUrlToSrc(bundle, propSrc.src);
|
|
1359
|
-
}
|
|
1360
|
-
function sharedPolyfills(shared) {
|
|
1361
|
-
const self = globalThis;
|
|
1362
|
-
const polyfill = {
|
|
1363
|
-
"next/dist/client/components/navigation": self.__remote_component_host_shared_modules__?.["next/navigation"] ?? shared?.["next/navigation"] ?? (() => Promise.resolve({
|
|
1364
|
-
useRouter() {
|
|
1365
|
-
return {
|
|
1366
|
-
push: (routerUrl) => {
|
|
1367
|
-
history.pushState({}, "", routerUrl);
|
|
1368
|
-
},
|
|
1369
|
-
replace: (routerUrl) => {
|
|
1370
|
-
history.replaceState({}, "", routerUrl);
|
|
1371
|
-
},
|
|
1372
|
-
back: () => {
|
|
1373
|
-
history.back();
|
|
1374
|
-
}
|
|
1375
|
-
};
|
|
1376
|
-
},
|
|
1377
|
-
usePathname() {
|
|
1378
|
-
return location.pathname;
|
|
1379
|
-
},
|
|
1380
|
-
useParams() {
|
|
1381
|
-
return {};
|
|
1382
|
-
},
|
|
1383
|
-
useSearchParams() {
|
|
1384
|
-
return new URLSearchParams(location.search);
|
|
1385
|
-
},
|
|
1386
|
-
useSelectedLayoutSegment() {
|
|
1387
|
-
return null;
|
|
1388
|
-
},
|
|
1389
|
-
useSelectedLayoutSegments() {
|
|
1390
|
-
return [];
|
|
1391
|
-
},
|
|
1392
|
-
__esModule: true
|
|
1393
|
-
})),
|
|
1394
|
-
"next/dist/client/app-dir/link": self.__remote_component_host_shared_modules__?.["next/link"] ?? shared?.["next/link"] ?? (() => Promise.resolve({
|
|
1395
|
-
default: ({
|
|
1396
|
-
scroll: _,
|
|
1397
|
-
replace,
|
|
1398
|
-
prefetch,
|
|
1399
|
-
onNavigate,
|
|
1400
|
-
children,
|
|
1401
|
-
...props
|
|
1402
|
-
}) => {
|
|
1403
|
-
if (prefetch) {
|
|
1404
|
-
logWarn(
|
|
1405
|
-
"Polyfill",
|
|
1406
|
-
"Next.js Link prefetch is not supported in remote components"
|
|
1407
|
-
);
|
|
1408
|
-
}
|
|
1409
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1410
|
-
"a",
|
|
1411
|
-
{
|
|
1412
|
-
...props,
|
|
1413
|
-
href: props.href,
|
|
1414
|
-
onClick: (e) => {
|
|
1415
|
-
e.preventDefault();
|
|
1416
|
-
let preventDefaulted = false;
|
|
1417
|
-
e.preventDefault = () => {
|
|
1418
|
-
preventDefaulted = true;
|
|
1419
|
-
e.defaultPrevented = true;
|
|
1420
|
-
};
|
|
1421
|
-
if (typeof props.onClick === "function") {
|
|
1422
|
-
props.onClick(e);
|
|
1423
|
-
}
|
|
1424
|
-
onNavigate?.(e);
|
|
1425
|
-
if (preventDefaulted) {
|
|
1426
|
-
return;
|
|
1427
|
-
}
|
|
1428
|
-
if (replace) {
|
|
1429
|
-
history.replaceState({}, "", props.href);
|
|
1430
|
-
} else {
|
|
1431
|
-
history.pushState({}, "", props.href);
|
|
1432
|
-
}
|
|
1433
|
-
},
|
|
1434
|
-
suppressHydrationWarning: true,
|
|
1435
|
-
children: children ?? null
|
|
1436
|
-
}
|
|
1437
|
-
);
|
|
1438
|
-
},
|
|
1439
|
-
useLinkStatus() {
|
|
1440
|
-
return { pending: false };
|
|
1441
|
-
},
|
|
1442
|
-
__esModule: true
|
|
1443
|
-
})),
|
|
1444
|
-
"next/dist/client/app-dir/form": self.__remote_component_host_shared_modules__?.["next/form"] ?? shared?.["next/form"] ?? (() => Promise.resolve({
|
|
1445
|
-
default: () => {
|
|
1446
|
-
throw new Error("Next.js <Form> component not implemented");
|
|
1447
|
-
},
|
|
1448
|
-
__esModule: true
|
|
1449
|
-
})),
|
|
1450
|
-
"next/dist/client/image-component": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
|
|
1451
|
-
Image: imageImpl(bundle),
|
|
1452
|
-
__esModule: true
|
|
1453
|
-
})),
|
|
1454
|
-
"next/image": self.__remote_component_host_shared_modules__?.["next/image"] ?? shared?.["next/image"] ?? ((bundle) => Promise.resolve({
|
|
1455
|
-
default: imageImpl(bundle),
|
|
1456
|
-
getImageProps: (_imgProps) => {
|
|
1457
|
-
throw new Error(
|
|
1458
|
-
"Next.js getImageProps() is not implemented in remote components"
|
|
1459
|
-
);
|
|
1460
|
-
},
|
|
1461
|
-
__esModule: true
|
|
1462
|
-
})),
|
|
1463
|
-
"next/dist/client/script": self.__remote_component_host_shared_modules__?.["next/script"] ?? shared?.["next/script"] ?? (() => Promise.resolve({
|
|
1464
|
-
// TODO: implement <Script> component for non-Next.js host applications
|
|
1465
|
-
// do not throw an error for now
|
|
1466
|
-
default: () => null,
|
|
1467
|
-
__esModule: true
|
|
1468
|
-
})),
|
|
1469
|
-
"next/router": self.__remote_component_host_shared_modules__?.["next/router"] ?? shared?.["next/router"] ?? (() => (
|
|
1470
|
-
// TODO: incomplete implementation
|
|
1471
|
-
Promise.resolve({
|
|
1472
|
-
useRouter() {
|
|
1473
|
-
return {
|
|
1474
|
-
push: (routerUrl) => {
|
|
1475
|
-
history.pushState({}, "", routerUrl);
|
|
1476
|
-
},
|
|
1477
|
-
replace: (routerUrl) => {
|
|
1478
|
-
history.replaceState({}, "", routerUrl);
|
|
1479
|
-
},
|
|
1480
|
-
back: () => {
|
|
1481
|
-
history.back();
|
|
1482
|
-
}
|
|
1483
|
-
};
|
|
1484
|
-
},
|
|
1485
|
-
__esModule: true
|
|
1486
|
-
})
|
|
1487
|
-
)),
|
|
1488
|
-
"next/dist/build/polyfills/process": () => Promise.resolve({
|
|
1489
|
-
default: {
|
|
1490
|
-
env: {
|
|
1491
|
-
NODE_ENV: "production"
|
|
1492
|
-
}
|
|
1493
|
-
},
|
|
1494
|
-
__esModule: true
|
|
1495
|
-
})
|
|
1496
|
-
};
|
|
1497
|
-
polyfill["next/navigation"] = polyfill["next/dist/client/components/navigation"];
|
|
1498
|
-
polyfill["next/link"] = polyfill["next/dist/client/app-dir/link"];
|
|
1499
|
-
polyfill["next/form"] = polyfill["next/dist/client/app-dir/form"];
|
|
1500
|
-
polyfill["next/dist/api/image"] = polyfill["next/dist/client/image-component"];
|
|
1501
|
-
polyfill["next/script"] = polyfill["next/dist/client/script"];
|
|
1502
|
-
return polyfill;
|
|
1357
|
+
return null;
|
|
1503
1358
|
}
|
|
1504
|
-
var
|
|
1505
|
-
|
|
1506
|
-
"src/shared/client/polyfill.tsx"() {
|
|
1359
|
+
var init_shared_modules = __esm({
|
|
1360
|
+
"src/runtime/turbopack/shared-modules.ts"() {
|
|
1507
1361
|
"use strict";
|
|
1362
|
+
init_constants2();
|
|
1508
1363
|
init_logger();
|
|
1509
|
-
|
|
1510
|
-
|
|
1511
|
-
imageImpl = (bundle) => function RemoteImage({
|
|
1512
|
-
fill: _fill,
|
|
1513
|
-
loader: _loader,
|
|
1514
|
-
quality: _quality,
|
|
1515
|
-
priority: _priority,
|
|
1516
|
-
loading: _loading,
|
|
1517
|
-
placeholder: _placeholder,
|
|
1518
|
-
blurDataURL: _blurDataURL,
|
|
1519
|
-
unoptimized: _unoptimized,
|
|
1520
|
-
overrideSrc: _overrideSrc,
|
|
1521
|
-
src,
|
|
1522
|
-
...props
|
|
1523
|
-
}) {
|
|
1524
|
-
const newSrc = applyBundleUrlToImagePropsSrc(
|
|
1525
|
-
bundle,
|
|
1526
|
-
typeof src === "string" ? src : src.src
|
|
1527
|
-
);
|
|
1528
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
1529
|
-
"img",
|
|
1530
|
-
{
|
|
1531
|
-
decoding: "async",
|
|
1532
|
-
style: { color: "transparent" },
|
|
1533
|
-
...props,
|
|
1534
|
-
src: newSrc,
|
|
1535
|
-
suppressHydrationWarning: true
|
|
1536
|
-
}
|
|
1537
|
-
);
|
|
1538
|
-
};
|
|
1364
|
+
init_module();
|
|
1365
|
+
init_patterns();
|
|
1539
1366
|
}
|
|
1540
1367
|
});
|
|
1541
1368
|
|
|
1542
|
-
// src/
|
|
1543
|
-
|
|
1544
|
-
__export(webpack_exports, {
|
|
1545
|
-
webpackRuntime: () => webpackRuntime
|
|
1546
|
-
});
|
|
1547
|
-
async function webpackRuntime(bundle, shared, remoteShared, resolveClientUrl) {
|
|
1369
|
+
// src/runtime/turbopack/webpack-runtime.ts
|
|
1370
|
+
async function setupWebpackRuntime(runtime, scripts = [], url = new URL(location.href), bundle, shared = {}, remoteShared = {}, resolveClientUrl) {
|
|
1548
1371
|
const self = globalThis;
|
|
1549
|
-
if (!self.
|
|
1550
|
-
self.
|
|
1372
|
+
if (!self.__remote_bundle_url__) {
|
|
1373
|
+
self.__remote_bundle_url__ = {};
|
|
1551
1374
|
}
|
|
1552
|
-
self.
|
|
1553
|
-
|
|
1554
|
-
|
|
1555
|
-
|
|
1556
|
-
|
|
1557
|
-
|
|
1558
|
-
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
|
|
1563
|
-
|
|
1564
|
-
|
|
1565
|
-
|
|
1566
|
-
|
|
1567
|
-
);
|
|
1568
|
-
}
|
|
1569
|
-
return self.__remote_webpack_require__[remoteBundle](id);
|
|
1570
|
-
};
|
|
1571
|
-
self.__webpack_chunk_load__ = () => {
|
|
1572
|
-
return Promise.resolve([]);
|
|
1573
|
-
};
|
|
1375
|
+
self.__remote_bundle_url__[bundle ?? "default"] = url;
|
|
1376
|
+
self.__webpack_get_script_filename__ = () => null;
|
|
1377
|
+
if (typeof self.__webpack_require__ !== "function" || self.__webpack_require_type__ !== "turbopack") {
|
|
1378
|
+
if (!self.__original_webpack_require__ && !self.__original_webpack_chunk_load__) {
|
|
1379
|
+
self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
|
|
1380
|
+
self.__original_webpack_require__ = self.__webpack_require__;
|
|
1381
|
+
}
|
|
1382
|
+
self.__webpack_chunk_load__ = createChunkLoader(runtime, resolveClientUrl);
|
|
1383
|
+
self.__webpack_require__ = createModuleRequire(runtime);
|
|
1384
|
+
self.__webpack_require_type__ = runtime;
|
|
1385
|
+
if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {
|
|
1386
|
+
const remoteBundle = bundle ?? "default";
|
|
1387
|
+
self.__remote_webpack_require__[remoteBundle] = self.__webpack_require__;
|
|
1388
|
+
self.__remote_webpack_require__[remoteBundle].type = "turbopack";
|
|
1389
|
+
}
|
|
1574
1390
|
}
|
|
1575
|
-
|
|
1576
|
-
default: { createFromReadableStream }
|
|
1577
|
-
} = await import("react-server-dom-webpack/client.browser");
|
|
1578
|
-
async function preloadScripts(scripts, url, remoteBundle, _) {
|
|
1579
|
-
const scriptSrcs = scripts.flatMap((script) => {
|
|
1580
|
-
const scriptSrc = script.getAttribute("src") || script.getAttribute("data-src");
|
|
1581
|
-
script.parentElement?.removeChild(script);
|
|
1582
|
-
if (!scriptSrc)
|
|
1583
|
-
return [];
|
|
1584
|
-
return [
|
|
1585
|
-
{
|
|
1586
|
-
src: new URL(scriptSrc.replace(NEXT_BUNDLE_PATH_RE, "/_next/"), url).href
|
|
1587
|
-
}
|
|
1588
|
-
];
|
|
1589
|
-
});
|
|
1590
|
-
await loadScripts(scriptSrcs, resolveClientUrl);
|
|
1591
|
-
const hostShared = {
|
|
1592
|
-
...sharedPolyfills(shared),
|
|
1593
|
-
...self.__remote_component_host_shared_modules__,
|
|
1594
|
-
...shared
|
|
1595
|
-
};
|
|
1596
|
-
const resolve = {
|
|
1597
|
-
"/react/index.js": (await import("react")).default,
|
|
1598
|
-
"/react/jsx-dev-runtime.js": (await import("react/jsx-dev-runtime")).default,
|
|
1599
|
-
"/react/jsx-runtime.js": (await import("react/jsx-runtime")).default,
|
|
1600
|
-
"/react-dom/index.js": (await import("react-dom")).default,
|
|
1601
|
-
"/react-dom/client.js": (await import("react-dom/client")).default,
|
|
1602
|
-
...Object.entries(remoteShared ?? {}).reduce(
|
|
1603
|
-
(acc, [key, value]) => {
|
|
1604
|
-
if (typeof hostShared[value] !== "undefined") {
|
|
1605
|
-
acc[key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, "")] = hostShared[value];
|
|
1606
|
-
}
|
|
1607
|
-
return acc;
|
|
1608
|
-
},
|
|
1609
|
-
{}
|
|
1610
|
-
)
|
|
1611
|
-
};
|
|
1391
|
+
if (runtime === RUNTIME_TURBOPACK) {
|
|
1612
1392
|
await Promise.all(
|
|
1613
|
-
|
|
1614
|
-
if (
|
|
1615
|
-
|
|
1393
|
+
scripts.map((script) => {
|
|
1394
|
+
if (script.src) {
|
|
1395
|
+
return self.__webpack_chunk_load__?.(script.src, bundle);
|
|
1616
1396
|
}
|
|
1617
|
-
return Promise.resolve(
|
|
1397
|
+
return Promise.resolve(void 0);
|
|
1618
1398
|
})
|
|
1619
1399
|
);
|
|
1620
|
-
applySharedModules(remoteBundle, resolve);
|
|
1621
1400
|
}
|
|
1622
|
-
|
|
1623
|
-
|
|
1624
|
-
|
|
1625
|
-
|
|
1626
|
-
|
|
1627
|
-
|
|
1401
|
+
const coreShared = {
|
|
1402
|
+
react: async () => (await import("react")).default,
|
|
1403
|
+
"react-dom": async () => (await import("react-dom")).default,
|
|
1404
|
+
"react/jsx-dev-runtime": async () => (await import("react/jsx-dev-runtime")).default,
|
|
1405
|
+
"react/jsx-runtime": async () => (await import("react/jsx-runtime")).default,
|
|
1406
|
+
"react-dom/client": async () => (await import("react-dom/client")).default,
|
|
1407
|
+
...shared
|
|
1628
1408
|
};
|
|
1409
|
+
await initializeSharedModules(
|
|
1410
|
+
bundle ?? "default",
|
|
1411
|
+
// include all core modules as shared
|
|
1412
|
+
coreShared,
|
|
1413
|
+
remoteShared
|
|
1414
|
+
);
|
|
1629
1415
|
}
|
|
1630
|
-
|
|
1631
|
-
|
|
1416
|
+
function createModuleRequire(runtime) {
|
|
1417
|
+
return (id) => {
|
|
1418
|
+
const self = globalThis;
|
|
1419
|
+
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
1420
|
+
bundle: "default",
|
|
1421
|
+
id
|
|
1422
|
+
};
|
|
1423
|
+
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
1424
|
+
logDebug("WebpackRuntime", `remoteRuntime: "${remoteRuntime}"`);
|
|
1425
|
+
try {
|
|
1426
|
+
if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {
|
|
1427
|
+
return self.__remote_webpack_require__?.[bundle]?.(moduleId);
|
|
1428
|
+
}
|
|
1429
|
+
const sharedModuleId = moduleId ?? id;
|
|
1430
|
+
const sharedModule = getSharedModule(bundle ?? "default", sharedModuleId);
|
|
1431
|
+
if (sharedModule) {
|
|
1432
|
+
return sharedModule;
|
|
1433
|
+
}
|
|
1434
|
+
if (bundle && moduleId) {
|
|
1435
|
+
return handleTurbopackModule(bundle, moduleId, id);
|
|
1436
|
+
}
|
|
1437
|
+
throw new Error(`Module "${id}" not found.`);
|
|
1438
|
+
} catch (requireError) {
|
|
1439
|
+
logWarn(
|
|
1440
|
+
"WebpackRuntime",
|
|
1441
|
+
`Module require failed: ${String(requireError)}`
|
|
1442
|
+
);
|
|
1443
|
+
if (typeof self.__original_webpack_require__ !== "function") {
|
|
1444
|
+
throw new RemoteComponentsError(
|
|
1445
|
+
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
1446
|
+
{
|
|
1447
|
+
cause: requireError instanceof Error ? requireError : void 0
|
|
1448
|
+
}
|
|
1449
|
+
);
|
|
1450
|
+
}
|
|
1451
|
+
try {
|
|
1452
|
+
logDebug("WebpackRuntime", "Falling back to original webpack require");
|
|
1453
|
+
return self.__original_webpack_require__(id);
|
|
1454
|
+
} catch (originalError) {
|
|
1455
|
+
throw new RemoteComponentsError(
|
|
1456
|
+
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
1457
|
+
{ cause: originalError instanceof Error ? originalError : void 0 }
|
|
1458
|
+
);
|
|
1459
|
+
}
|
|
1460
|
+
}
|
|
1461
|
+
};
|
|
1462
|
+
}
|
|
1463
|
+
var init_webpack_runtime = __esm({
|
|
1464
|
+
"src/runtime/turbopack/webpack-runtime.ts"() {
|
|
1632
1465
|
"use strict";
|
|
1633
|
-
|
|
1634
|
-
init_script_loader();
|
|
1635
|
-
init_webpack_patterns();
|
|
1466
|
+
init_constants2();
|
|
1636
1467
|
init_error();
|
|
1637
|
-
|
|
1468
|
+
init_logger();
|
|
1469
|
+
init_chunk_loader();
|
|
1470
|
+
init_module();
|
|
1638
1471
|
init_shared_modules();
|
|
1639
1472
|
}
|
|
1640
1473
|
});
|
|
1641
1474
|
|
|
1642
|
-
// src/html/
|
|
1475
|
+
// src/host/html/runtime/turbopack.ts
|
|
1643
1476
|
var turbopack_exports = {};
|
|
1644
1477
|
__export(turbopack_exports, {
|
|
1645
1478
|
turbopackRuntime: () => turbopackRuntime
|
|
@@ -1647,7 +1480,7 @@ __export(turbopack_exports, {
|
|
|
1647
1480
|
async function turbopackRuntime(url, bundle, shared, remoteShared, resolveClientUrl) {
|
|
1648
1481
|
const self = globalThis;
|
|
1649
1482
|
const hostShared = {
|
|
1650
|
-
...sharedPolyfills(shared),
|
|
1483
|
+
...sharedPolyfills(shared, resolveClientUrl),
|
|
1651
1484
|
...self.__remote_component_host_shared_modules__,
|
|
1652
1485
|
...shared,
|
|
1653
1486
|
...self.__remote_component_shared__
|
|
@@ -1677,25 +1510,181 @@ async function turbopackRuntime(url, bundle, shared, remoteShared, resolveClient
|
|
|
1677
1510
|
resolveClientUrl
|
|
1678
1511
|
);
|
|
1679
1512
|
}
|
|
1680
|
-
return {
|
|
1681
|
-
self,
|
|
1682
|
-
createFromReadableStream,
|
|
1683
|
-
applySharedModules,
|
|
1684
|
-
nextClientPagesLoader,
|
|
1685
|
-
preloadScripts
|
|
1686
|
-
};
|
|
1513
|
+
return {
|
|
1514
|
+
self,
|
|
1515
|
+
createFromReadableStream,
|
|
1516
|
+
applySharedModules,
|
|
1517
|
+
nextClientPagesLoader,
|
|
1518
|
+
preloadScripts
|
|
1519
|
+
};
|
|
1520
|
+
}
|
|
1521
|
+
var init_turbopack = __esm({
|
|
1522
|
+
"src/host/html/runtime/turbopack.ts"() {
|
|
1523
|
+
"use strict";
|
|
1524
|
+
init_apply_shared_modules();
|
|
1525
|
+
init_next_client_pages_loader();
|
|
1526
|
+
init_polyfill();
|
|
1527
|
+
init_webpack_runtime();
|
|
1528
|
+
}
|
|
1529
|
+
});
|
|
1530
|
+
|
|
1531
|
+
// src/runtime/loaders/static-loader.ts
|
|
1532
|
+
async function importViaCallback(absoluteSrc, resolveClientUrl) {
|
|
1533
|
+
const resolvedUrl = resolveClientUrl(absoluteSrc) ?? absoluteSrc;
|
|
1534
|
+
const fetchUrl = new URL(resolvedUrl, location.href).href;
|
|
1535
|
+
const response = await fetch(fetchUrl);
|
|
1536
|
+
if (!response.ok)
|
|
1537
|
+
throw new Error(`Proxied fetch failed: ${response.status}`);
|
|
1538
|
+
const content = (await response.text()).replace(/import\.meta\.url/g, JSON.stringify(absoluteSrc)).replace(
|
|
1539
|
+
/\b(from|import)\s*(["'])(\.\.?\/[^"']+)\2/g,
|
|
1540
|
+
(_, keyword, quote, relativePath) => {
|
|
1541
|
+
const absoluteImportUrl = new URL(relativePath, absoluteSrc).href;
|
|
1542
|
+
const resolvedImportUrl = new URL(
|
|
1543
|
+
resolveClientUrl(absoluteImportUrl) ?? absoluteImportUrl,
|
|
1544
|
+
location.href
|
|
1545
|
+
).href;
|
|
1546
|
+
return `${keyword} ${quote}${resolvedImportUrl}${quote}`;
|
|
1547
|
+
}
|
|
1548
|
+
);
|
|
1549
|
+
const moduleBlobUrl = URL.createObjectURL(
|
|
1550
|
+
new Blob([content], { type: "text/javascript" })
|
|
1551
|
+
);
|
|
1552
|
+
const wrapperContent = [
|
|
1553
|
+
`import*as m from${JSON.stringify(moduleBlobUrl)};`,
|
|
1554
|
+
`globalThis.__rc_module_registry__=globalThis.__rc_module_registry__||{};`,
|
|
1555
|
+
`globalThis.__rc_module_registry__[${JSON.stringify(absoluteSrc)}]=m;`
|
|
1556
|
+
].join("");
|
|
1557
|
+
const wrapperBlobUrl = URL.createObjectURL(
|
|
1558
|
+
new Blob([wrapperContent], { type: "text/javascript" })
|
|
1559
|
+
);
|
|
1560
|
+
const scriptEl = document.createElement("script");
|
|
1561
|
+
scriptEl.type = "module";
|
|
1562
|
+
scriptEl.src = wrapperBlobUrl;
|
|
1563
|
+
try {
|
|
1564
|
+
await new Promise((resolve, reject) => {
|
|
1565
|
+
scriptEl.onload = () => resolve();
|
|
1566
|
+
scriptEl.onerror = () => reject(new Error(`Failed to load module for ${absoluteSrc}`));
|
|
1567
|
+
document.head.appendChild(scriptEl);
|
|
1568
|
+
});
|
|
1569
|
+
} finally {
|
|
1570
|
+
scriptEl.remove();
|
|
1571
|
+
URL.revokeObjectURL(moduleBlobUrl);
|
|
1572
|
+
URL.revokeObjectURL(wrapperBlobUrl);
|
|
1573
|
+
}
|
|
1574
|
+
const registry = globalThis.__rc_module_registry__;
|
|
1575
|
+
const mod = registry?.[absoluteSrc] ?? {};
|
|
1576
|
+
if (registry)
|
|
1577
|
+
delete registry[absoluteSrc];
|
|
1578
|
+
return mod;
|
|
1579
|
+
}
|
|
1580
|
+
async function importDirectly(absoluteSrc) {
|
|
1581
|
+
try {
|
|
1582
|
+
return await import(
|
|
1583
|
+
/* @vite-ignore */
|
|
1584
|
+
/* webpackIgnore: true */
|
|
1585
|
+
absoluteSrc
|
|
1586
|
+
);
|
|
1587
|
+
} catch (importError) {
|
|
1588
|
+
if (!absoluteSrc.startsWith("blob:")) {
|
|
1589
|
+
warnCrossOriginFetchError("StaticLoader", absoluteSrc);
|
|
1590
|
+
}
|
|
1591
|
+
throw importError;
|
|
1592
|
+
}
|
|
1593
|
+
}
|
|
1594
|
+
function resolveScriptSrc(script, url) {
|
|
1595
|
+
const rawSrc = typeof script.getAttribute === "function" ? script.getAttribute("src") ?? script.src : script.src;
|
|
1596
|
+
if (!rawSrc && script.textContent) {
|
|
1597
|
+
return URL.createObjectURL(
|
|
1598
|
+
new Blob(
|
|
1599
|
+
[script.textContent.replace(/import\.meta\.url/g, JSON.stringify(url))],
|
|
1600
|
+
{ type: "text/javascript" }
|
|
1601
|
+
)
|
|
1602
|
+
);
|
|
1603
|
+
}
|
|
1604
|
+
return rawSrc;
|
|
1605
|
+
}
|
|
1606
|
+
async function loadStaticRemoteComponent(scripts, url, resolveClientUrl) {
|
|
1607
|
+
const self = globalThis;
|
|
1608
|
+
if (self.__remote_script_entrypoint_mount__?.[url.href]) {
|
|
1609
|
+
self.__remote_script_entrypoint_mount__[url.href] = /* @__PURE__ */ new Set();
|
|
1610
|
+
}
|
|
1611
|
+
if (self.__remote_script_entrypoint_unmount__?.[url.href]) {
|
|
1612
|
+
self.__remote_script_entrypoint_unmount__[url.href] = /* @__PURE__ */ new Set();
|
|
1613
|
+
}
|
|
1614
|
+
const mountUnmountSets = await Promise.all(
|
|
1615
|
+
scripts.map(async (script) => {
|
|
1616
|
+
try {
|
|
1617
|
+
const src = resolveScriptSrc(script, url);
|
|
1618
|
+
const absoluteSrc = new URL(src, url).href;
|
|
1619
|
+
const mod = resolveClientUrl ? await importViaCallback(absoluteSrc, resolveClientUrl) : await importDirectly(absoluteSrc);
|
|
1620
|
+
if (src.startsWith("blob:")) {
|
|
1621
|
+
URL.revokeObjectURL(src);
|
|
1622
|
+
}
|
|
1623
|
+
if (typeof mod.mount === "function" || typeof mod.default?.mount === "function") {
|
|
1624
|
+
if (!self.__remote_script_entrypoint_mount__) {
|
|
1625
|
+
self.__remote_script_entrypoint_mount__ = {};
|
|
1626
|
+
}
|
|
1627
|
+
if (!self.__remote_script_entrypoint_mount__[url.href]) {
|
|
1628
|
+
self.__remote_script_entrypoint_mount__[url.href] = /* @__PURE__ */ new Set();
|
|
1629
|
+
}
|
|
1630
|
+
self.__remote_script_entrypoint_mount__[url.href]?.add(
|
|
1631
|
+
mod.mount || mod.default?.mount || (() => {
|
|
1632
|
+
})
|
|
1633
|
+
);
|
|
1634
|
+
}
|
|
1635
|
+
if (typeof mod.unmount === "function" || typeof mod.default?.unmount === "function") {
|
|
1636
|
+
if (!self.__remote_script_entrypoint_unmount__) {
|
|
1637
|
+
self.__remote_script_entrypoint_unmount__ = {};
|
|
1638
|
+
}
|
|
1639
|
+
if (!self.__remote_script_entrypoint_unmount__[url.href]) {
|
|
1640
|
+
self.__remote_script_entrypoint_unmount__[url.href] = /* @__PURE__ */ new Set();
|
|
1641
|
+
}
|
|
1642
|
+
self.__remote_script_entrypoint_unmount__[url.href]?.add(
|
|
1643
|
+
mod.unmount || mod.default?.unmount || (() => {
|
|
1644
|
+
})
|
|
1645
|
+
);
|
|
1646
|
+
}
|
|
1647
|
+
return {
|
|
1648
|
+
mount: mod.mount || mod.default?.mount,
|
|
1649
|
+
unmount: mod.unmount || mod.default?.unmount
|
|
1650
|
+
};
|
|
1651
|
+
} catch (e) {
|
|
1652
|
+
logError(
|
|
1653
|
+
"StaticLoader",
|
|
1654
|
+
`Error loading remote component script from "${script.src || url.href}".`,
|
|
1655
|
+
e
|
|
1656
|
+
);
|
|
1657
|
+
return {
|
|
1658
|
+
mount: void 0,
|
|
1659
|
+
unmount: void 0
|
|
1660
|
+
};
|
|
1661
|
+
}
|
|
1662
|
+
})
|
|
1663
|
+
);
|
|
1664
|
+
return mountUnmountSets.reduce(
|
|
1665
|
+
(acc, { mount, unmount }) => {
|
|
1666
|
+
if (typeof mount === "function") {
|
|
1667
|
+
acc.mount.add(mount);
|
|
1668
|
+
}
|
|
1669
|
+
if (typeof unmount === "function") {
|
|
1670
|
+
acc.unmount.add(unmount);
|
|
1671
|
+
}
|
|
1672
|
+
return acc;
|
|
1673
|
+
},
|
|
1674
|
+
{
|
|
1675
|
+
mount: /* @__PURE__ */ new Set(),
|
|
1676
|
+
unmount: /* @__PURE__ */ new Set()
|
|
1677
|
+
}
|
|
1678
|
+
);
|
|
1687
1679
|
}
|
|
1688
|
-
var
|
|
1689
|
-
"src/
|
|
1680
|
+
var init_static_loader = __esm({
|
|
1681
|
+
"src/runtime/loaders/static-loader.ts"() {
|
|
1690
1682
|
"use strict";
|
|
1691
|
-
|
|
1692
|
-
init_webpack_adapter();
|
|
1693
|
-
init_next_client_pages_loader();
|
|
1694
|
-
init_shared_modules();
|
|
1683
|
+
init_logger();
|
|
1695
1684
|
}
|
|
1696
1685
|
});
|
|
1697
1686
|
|
|
1698
|
-
// src/html/
|
|
1687
|
+
// src/host/html/runtime/script.ts
|
|
1699
1688
|
var script_exports = {};
|
|
1700
1689
|
__export(script_exports, {
|
|
1701
1690
|
scriptRuntime: () => scriptRuntime
|
|
@@ -1714,23 +1703,106 @@ function scriptRuntime(resolveClientUrl) {
|
|
|
1714
1703
|
};
|
|
1715
1704
|
}
|
|
1716
1705
|
var init_script = __esm({
|
|
1717
|
-
"src/html/
|
|
1706
|
+
"src/host/html/runtime/script.ts"() {
|
|
1718
1707
|
"use strict";
|
|
1719
1708
|
init_static_loader();
|
|
1720
1709
|
}
|
|
1721
1710
|
});
|
|
1722
1711
|
|
|
1723
|
-
// src/html/
|
|
1724
|
-
var
|
|
1725
|
-
__export(
|
|
1726
|
-
proxyClientRequestsThroughHost: () => proxyClientRequestsThroughHost,
|
|
1712
|
+
// src/host/html/index.tsx
|
|
1713
|
+
var html_exports = {};
|
|
1714
|
+
__export(html_exports, {
|
|
1727
1715
|
registerSharedModules: () => registerSharedModules
|
|
1728
1716
|
});
|
|
1729
|
-
module.exports = __toCommonJS(
|
|
1717
|
+
module.exports = __toCommonJS(html_exports);
|
|
1730
1718
|
var import_react = require("react");
|
|
1731
1719
|
var import_client = require("react-dom/client");
|
|
1732
1720
|
|
|
1733
|
-
// src/
|
|
1721
|
+
// src/host/server/fetch-with-hooks.ts
|
|
1722
|
+
init_logger();
|
|
1723
|
+
|
|
1724
|
+
// src/host/server/fetch-headers.ts
|
|
1725
|
+
function remoteFetchHeaders() {
|
|
1726
|
+
return {
|
|
1727
|
+
/**
|
|
1728
|
+
* Authenticates deployment protection for the remote. Needed for SSR and SSG clients.
|
|
1729
|
+
* If the remote component uses vercel deployment protection, ensure the host and remote vercel
|
|
1730
|
+
* projects share a common automation bypass secret, and the shared secret is used as the
|
|
1731
|
+
* VERCEL_AUTOMATION_BYPASS_SECRET env var in the host project.
|
|
1732
|
+
*/
|
|
1733
|
+
...typeof process === "object" && typeof process.env === "object" && typeof process.env.VERCEL_AUTOMATION_BYPASS_SECRET === "string" ? {
|
|
1734
|
+
"x-vercel-protection-bypass": process.env.VERCEL_AUTOMATION_BYPASS_SECRET
|
|
1735
|
+
} : {},
|
|
1736
|
+
Accept: "text/html"
|
|
1737
|
+
};
|
|
1738
|
+
}
|
|
1739
|
+
|
|
1740
|
+
// src/host/server/fetch-with-hooks.ts
|
|
1741
|
+
async function fetchWithWarning(url, init) {
|
|
1742
|
+
try {
|
|
1743
|
+
return await fetch(url, init);
|
|
1744
|
+
} catch (error) {
|
|
1745
|
+
warnCrossOriginFetchError("FetchRemoteComponent", url);
|
|
1746
|
+
throw error;
|
|
1747
|
+
}
|
|
1748
|
+
}
|
|
1749
|
+
async function fetchWithHooks(url, additionalInit, options = {}) {
|
|
1750
|
+
const {
|
|
1751
|
+
onRequest,
|
|
1752
|
+
onResponse,
|
|
1753
|
+
abortController = new AbortController()
|
|
1754
|
+
} = options;
|
|
1755
|
+
const signal = abortController.signal;
|
|
1756
|
+
const hookOptions = {
|
|
1757
|
+
signal,
|
|
1758
|
+
abort: (reason) => abortController.abort(reason)
|
|
1759
|
+
};
|
|
1760
|
+
const init = {
|
|
1761
|
+
method: "GET",
|
|
1762
|
+
headers: remoteFetchHeaders(),
|
|
1763
|
+
signal,
|
|
1764
|
+
...additionalInit
|
|
1765
|
+
};
|
|
1766
|
+
const res = await onRequest?.(url, init, hookOptions) ?? await fetchWithWarning(url, init);
|
|
1767
|
+
return await onResponse?.(url, res, hookOptions) ?? res;
|
|
1768
|
+
}
|
|
1769
|
+
|
|
1770
|
+
// src/host/server/get-client-or-server-url.ts
|
|
1771
|
+
function getClientOrServerUrl(src, serverFallback) {
|
|
1772
|
+
const fallback = typeof location !== "undefined" ? location.href : serverFallback;
|
|
1773
|
+
if (!src) {
|
|
1774
|
+
return new URL(fallback);
|
|
1775
|
+
}
|
|
1776
|
+
return typeof src === "string" ? new URL(src, fallback) : src;
|
|
1777
|
+
}
|
|
1778
|
+
|
|
1779
|
+
// src/host/shared/state.ts
|
|
1780
|
+
function createHostState() {
|
|
1781
|
+
return {
|
|
1782
|
+
stage: "idle",
|
|
1783
|
+
prevSrc: void 0,
|
|
1784
|
+
prevUrl: void 0,
|
|
1785
|
+
prevName: void 0,
|
|
1786
|
+
prevIsRemoteComponent: false,
|
|
1787
|
+
abortController: void 0
|
|
1788
|
+
};
|
|
1789
|
+
}
|
|
1790
|
+
|
|
1791
|
+
// src/host/utils/resolve-name-from-src.ts
|
|
1792
|
+
function resolveNameFromSrc(src, defaultName) {
|
|
1793
|
+
if (!src) {
|
|
1794
|
+
return defaultName;
|
|
1795
|
+
}
|
|
1796
|
+
const hash = typeof src === "string" ? src : src.hash;
|
|
1797
|
+
const hashIndex = hash.indexOf("#");
|
|
1798
|
+
if (hashIndex < 0) {
|
|
1799
|
+
return defaultName;
|
|
1800
|
+
}
|
|
1801
|
+
const name = hash.slice(hashIndex + 1);
|
|
1802
|
+
return name || defaultName;
|
|
1803
|
+
}
|
|
1804
|
+
|
|
1805
|
+
// src/runtime/html/apply-origin.ts
|
|
1734
1806
|
var tagNames = [
|
|
1735
1807
|
"img",
|
|
1736
1808
|
"source",
|
|
@@ -1792,49 +1864,103 @@ function applyOriginToNodes(doc, url, resolveClientUrl) {
|
|
|
1792
1864
|
}
|
|
1793
1865
|
}
|
|
1794
1866
|
|
|
1795
|
-
// src/
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
}
|
|
1800
|
-
|
|
1801
|
-
if (typeof location === "undefined") {
|
|
1802
|
-
return void 0;
|
|
1803
|
-
}
|
|
1804
|
-
const remoteOrigin = new URL(remoteSrc, location.href).origin;
|
|
1805
|
-
if (remoteOrigin === location.origin) {
|
|
1806
|
-
return void 0;
|
|
1867
|
+
// src/runtime/html/parse-remote-html.ts
|
|
1868
|
+
init_constants2();
|
|
1869
|
+
init_error();
|
|
1870
|
+
function validateSingleComponent(doc, name, url) {
|
|
1871
|
+
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}"]`)) {
|
|
1872
|
+
throw multipleRemoteComponentsError(url);
|
|
1807
1873
|
}
|
|
1808
|
-
|
|
1809
|
-
|
|
1810
|
-
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1874
|
+
}
|
|
1875
|
+
function findComponentElement(doc, name) {
|
|
1876
|
+
return doc.querySelector(`div[data-bundle][data-route][id^="${name}"]`) ?? doc.querySelector("div[data-bundle][data-route]") ?? doc.querySelector("div#__next") ?? doc.querySelector(`remote-component[name="${name}"]:not([src])`) ?? doc.querySelector("remote-component:not([src])");
|
|
1877
|
+
}
|
|
1878
|
+
function parseNextData(doc) {
|
|
1879
|
+
return JSON.parse(
|
|
1880
|
+
(doc.querySelector("#__NEXT_DATA__") ?? doc.querySelector("#__REMOTE_NEXT_DATA__"))?.textContent ?? "null"
|
|
1881
|
+
);
|
|
1882
|
+
}
|
|
1883
|
+
function resolveComponentName(component, nextData, fallbackName) {
|
|
1884
|
+
const isRemoteComponent = component?.tagName.toLowerCase() === "remote-component";
|
|
1885
|
+
const name = component?.getAttribute("id")?.replace(/_ssr$/, "") || isRemoteComponent && component?.getAttribute("name") || (nextData ? "__next" : fallbackName);
|
|
1886
|
+
return { name, isRemoteComponent };
|
|
1887
|
+
}
|
|
1888
|
+
function extractComponentMetadata(component, nextData, name, url) {
|
|
1889
|
+
return {
|
|
1890
|
+
name,
|
|
1891
|
+
bundle: component?.getAttribute("data-bundle") || nextData?.props.__REMOTE_COMPONENT__?.bundle || "default",
|
|
1892
|
+
route: component?.getAttribute("data-route") ?? nextData?.page ?? (url.pathname || DEFAULT_ROUTE),
|
|
1893
|
+
runtime: component?.getAttribute("data-runtime") ?? (nextData?.props.__REMOTE_COMPONENT__?.runtime || RUNTIME_SCRIPT)
|
|
1894
|
+
};
|
|
1895
|
+
}
|
|
1896
|
+
function extractRemoteShared(doc, name, nextData) {
|
|
1897
|
+
const remoteSharedEl = doc.querySelector(
|
|
1898
|
+
`#${name}_shared[data-remote-components-shared]`
|
|
1899
|
+
);
|
|
1900
|
+
const remoteShared = nextData?.props.__REMOTE_COMPONENT__?.shared ?? (JSON.parse(remoteSharedEl?.textContent ?? "{}") ?? {});
|
|
1901
|
+
remoteSharedEl?.remove();
|
|
1902
|
+
return remoteShared;
|
|
1903
|
+
}
|
|
1904
|
+
function validateComponentFound(component, rsc, nextData, isRemoteComponent, url, name) {
|
|
1905
|
+
if (!component || !(rsc || nextData || isRemoteComponent)) {
|
|
1906
|
+
throw new RemoteComponentsError(
|
|
1907
|
+
`Remote Component not found on ${url}.${name !== "__vercel_remote_component" ? ` The name for the <RemoteComponent> is "${name}". Check <RemoteComponent> usage.` : ""} Did you forget to wrap the content in <RemoteComponent>?`
|
|
1908
|
+
);
|
|
1814
1909
|
}
|
|
1815
|
-
|
|
1816
|
-
|
|
1817
|
-
|
|
1818
|
-
|
|
1819
|
-
|
|
1820
|
-
|
|
1910
|
+
}
|
|
1911
|
+
function extractLinks(doc, component) {
|
|
1912
|
+
return Array.from(doc.querySelectorAll("link[href]")).filter(
|
|
1913
|
+
(link) => !component.contains(link)
|
|
1914
|
+
);
|
|
1915
|
+
}
|
|
1916
|
+
function extractScripts(doc, component, isRemoteComponent) {
|
|
1917
|
+
return Array.from(
|
|
1918
|
+
(isRemoteComponent ? component : doc).querySelectorAll(
|
|
1919
|
+
"script[src],script[data-src]"
|
|
1920
|
+
)
|
|
1921
|
+
);
|
|
1922
|
+
}
|
|
1923
|
+
function parseRemoteComponentDocument(doc, name, url) {
|
|
1924
|
+
validateSingleComponent(doc, name, url.href);
|
|
1925
|
+
const component = findComponentElement(doc, name);
|
|
1926
|
+
const nextData = parseNextData(doc);
|
|
1927
|
+
const { name: resolvedName, isRemoteComponent } = resolveComponentName(
|
|
1928
|
+
component,
|
|
1929
|
+
nextData,
|
|
1930
|
+
name
|
|
1931
|
+
);
|
|
1932
|
+
const rsc = doc.querySelector(`#${resolvedName}_rsc`);
|
|
1933
|
+
const metadata = extractComponentMetadata(
|
|
1934
|
+
component,
|
|
1935
|
+
nextData,
|
|
1936
|
+
resolvedName,
|
|
1937
|
+
url
|
|
1938
|
+
);
|
|
1939
|
+
const remoteShared = extractRemoteShared(doc, resolvedName, nextData);
|
|
1940
|
+
validateComponentFound(
|
|
1941
|
+
component,
|
|
1942
|
+
rsc,
|
|
1943
|
+
nextData,
|
|
1944
|
+
isRemoteComponent,
|
|
1945
|
+
url.href,
|
|
1946
|
+
resolvedName
|
|
1947
|
+
);
|
|
1948
|
+
const links = extractLinks(doc, component);
|
|
1949
|
+
const scripts = extractScripts(doc, component, isRemoteComponent);
|
|
1950
|
+
return {
|
|
1951
|
+
component,
|
|
1952
|
+
name: resolvedName,
|
|
1953
|
+
isRemoteComponent,
|
|
1954
|
+
metadata,
|
|
1955
|
+
nextData,
|
|
1956
|
+
rsc,
|
|
1957
|
+
remoteShared,
|
|
1958
|
+
links,
|
|
1959
|
+
scripts
|
|
1960
|
+
};
|
|
1821
1961
|
}
|
|
1822
1962
|
|
|
1823
|
-
// src/
|
|
1824
|
-
init_error();
|
|
1825
|
-
|
|
1826
|
-
// src/shared/client/component-loader.ts
|
|
1827
|
-
var React = __toESM(require("react"), 1);
|
|
1828
|
-
var JSXDevRuntime = __toESM(require("react/jsx-dev-runtime"), 1);
|
|
1829
|
-
var JSXRuntime = __toESM(require("react/jsx-runtime"), 1);
|
|
1830
|
-
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
1831
|
-
var ReactDOMClient = __toESM(require("react-dom/client"), 1);
|
|
1832
|
-
init_error();
|
|
1833
|
-
init_logger();
|
|
1834
|
-
init_next_client_pages_loader();
|
|
1835
|
-
init_shared_modules();
|
|
1836
|
-
|
|
1837
|
-
// src/shared/client/rsc.ts
|
|
1963
|
+
// src/runtime/rsc.ts
|
|
1838
1964
|
var import_web_streams_polyfill = require("web-streams-polyfill");
|
|
1839
1965
|
function fixPayload(payload) {
|
|
1840
1966
|
if (Array.isArray(payload)) {
|
|
@@ -1900,78 +2026,37 @@ function createRSCStream(rscName, data) {
|
|
|
1900
2026
|
});
|
|
1901
2027
|
}
|
|
1902
2028
|
|
|
1903
|
-
// src/
|
|
1904
|
-
|
|
1905
|
-
|
|
1906
|
-
|
|
1907
|
-
|
|
1908
|
-
|
|
1909
|
-
|
|
1910
|
-
|
|
1911
|
-
|
|
1912
|
-
|
|
1913
|
-
// src/html/host/index.tsx
|
|
1914
|
-
init_error();
|
|
1915
|
-
|
|
1916
|
-
// src/shared/ssr/fetch-with-hooks.ts
|
|
1917
|
-
init_logger();
|
|
1918
|
-
|
|
1919
|
-
// src/shared/ssr/fetch-headers.ts
|
|
1920
|
-
function remoteFetchHeaders() {
|
|
1921
|
-
return {
|
|
1922
|
-
/**
|
|
1923
|
-
* Authenticates deployment protection for the remote. Needed for SSR and SSG clients.
|
|
1924
|
-
* If the remote component uses vercel deployment protection, ensure the host and remote vercel
|
|
1925
|
-
* projects share a common automation bypass secret, and the shared secret is used as the
|
|
1926
|
-
* VERCEL_AUTOMATION_BYPASS_SECRET env var in the host project.
|
|
1927
|
-
*/
|
|
1928
|
-
...typeof process === "object" && typeof process.env === "object" && typeof process.env.VERCEL_AUTOMATION_BYPASS_SECRET === "string" ? {
|
|
1929
|
-
"x-vercel-protection-bypass": process.env.VERCEL_AUTOMATION_BYPASS_SECRET
|
|
1930
|
-
} : {},
|
|
1931
|
-
Accept: "text/html"
|
|
2029
|
+
// src/runtime/url/resolve-client-url.ts
|
|
2030
|
+
function withRemoteSrc(resolveClientUrl, remoteSrc) {
|
|
2031
|
+
const remoteOrigin = parseOrigin(remoteSrc);
|
|
2032
|
+
return (url) => {
|
|
2033
|
+
const urlOrigin = parseOrigin(url);
|
|
2034
|
+
if (remoteOrigin && urlOrigin && urlOrigin !== remoteOrigin) {
|
|
2035
|
+
return void 0;
|
|
2036
|
+
}
|
|
2037
|
+
return resolveClientUrl(remoteSrc, url);
|
|
1932
2038
|
};
|
|
1933
2039
|
}
|
|
1934
|
-
|
|
1935
|
-
|
|
1936
|
-
|
|
1937
|
-
|
|
1938
|
-
|
|
1939
|
-
onResponse,
|
|
1940
|
-
abortController = new AbortController()
|
|
1941
|
-
} = options;
|
|
1942
|
-
const signal = abortController.signal;
|
|
1943
|
-
const hookOptions = {
|
|
1944
|
-
signal,
|
|
1945
|
-
abort: (reason) => abortController.abort(reason)
|
|
1946
|
-
};
|
|
1947
|
-
const init = {
|
|
1948
|
-
method: "GET",
|
|
1949
|
-
headers: remoteFetchHeaders(),
|
|
1950
|
-
signal,
|
|
1951
|
-
...additionalInit
|
|
1952
|
-
};
|
|
1953
|
-
let res = await onRequest?.(url, init, hookOptions);
|
|
1954
|
-
if (!res) {
|
|
1955
|
-
try {
|
|
1956
|
-
res = await fetch(url, init);
|
|
1957
|
-
} catch (error) {
|
|
1958
|
-
warnCrossOriginFetchError("FetchRemoteComponent", url);
|
|
1959
|
-
throw error;
|
|
1960
|
-
}
|
|
1961
|
-
}
|
|
1962
|
-
const transformedRes = await onResponse?.(url, res, hookOptions);
|
|
1963
|
-
if (transformedRes) {
|
|
1964
|
-
res = transformedRes;
|
|
2040
|
+
function parseOrigin(url) {
|
|
2041
|
+
try {
|
|
2042
|
+
return new URL(url).origin;
|
|
2043
|
+
} catch {
|
|
2044
|
+
return void 0;
|
|
1965
2045
|
}
|
|
1966
|
-
return res;
|
|
1967
2046
|
}
|
|
1968
2047
|
|
|
1969
|
-
// src/
|
|
2048
|
+
// src/runtime/url/default-resolve-client-url.ts
|
|
2049
|
+
function bindResolveClientUrl(prop, remoteSrc) {
|
|
2050
|
+
return prop ? withRemoteSrc(prop, remoteSrc) : void 0;
|
|
2051
|
+
}
|
|
2052
|
+
|
|
2053
|
+
// src/host/html/index.tsx
|
|
1970
2054
|
init_utils();
|
|
1971
2055
|
init_abort();
|
|
2056
|
+
init_error();
|
|
1972
2057
|
init_logger();
|
|
1973
2058
|
|
|
1974
|
-
// src/html/
|
|
2059
|
+
// src/host/html/attach-styles.ts
|
|
1975
2060
|
init_error();
|
|
1976
2061
|
async function attachStyles({
|
|
1977
2062
|
doc,
|
|
@@ -2054,7 +2139,7 @@ async function attachStyles({
|
|
|
2054
2139
|
}
|
|
2055
2140
|
}
|
|
2056
2141
|
|
|
2057
|
-
// src/html/
|
|
2142
|
+
// src/host/html/runtime/index.ts
|
|
2058
2143
|
init_error();
|
|
2059
2144
|
async function getRuntime(type, url, bundle, shared, remoteShared, resolveClientUrl) {
|
|
2060
2145
|
if (typeof globalThis.process === "undefined") {
|
|
@@ -2088,7 +2173,7 @@ async function getRuntime(type, url, bundle, shared, remoteShared, resolveClient
|
|
|
2088
2173
|
);
|
|
2089
2174
|
}
|
|
2090
2175
|
|
|
2091
|
-
// src/html/
|
|
2176
|
+
// src/host/html/index.tsx
|
|
2092
2177
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
2093
2178
|
if (typeof HTMLElement !== "undefined") {
|
|
2094
2179
|
class RemoteComponent extends HTMLElement {
|
|
@@ -2097,42 +2182,76 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2097
2182
|
fallbackSlot;
|
|
2098
2183
|
__next = null;
|
|
2099
2184
|
fouc = null;
|
|
2100
|
-
|
|
2101
|
-
prevIsRemoteComponent = false;
|
|
2102
|
-
prevUrl;
|
|
2103
|
-
prevSrc = null;
|
|
2104
|
-
prevName;
|
|
2185
|
+
hostState = createHostState();
|
|
2105
2186
|
root = null;
|
|
2106
2187
|
reactRoot;
|
|
2107
2188
|
onRequest;
|
|
2108
2189
|
onResponse;
|
|
2109
2190
|
resolveClientUrl;
|
|
2110
|
-
|
|
2111
|
-
|
|
2191
|
+
// -- ConsumeServerConfig property accessors (attribute-reflected) --
|
|
2192
|
+
get src() {
|
|
2193
|
+
return this.getAttribute("src") ?? void 0;
|
|
2194
|
+
}
|
|
2195
|
+
set src(value) {
|
|
2196
|
+
if (value == null) {
|
|
2197
|
+
this.removeAttribute("src");
|
|
2198
|
+
} else {
|
|
2199
|
+
this.setAttribute("src", String(value));
|
|
2200
|
+
}
|
|
2201
|
+
}
|
|
2202
|
+
/** Always `true` — the HTML host always isolates via Shadow DOM. */
|
|
2203
|
+
get isolate() {
|
|
2204
|
+
return true;
|
|
2205
|
+
}
|
|
2206
|
+
get mode() {
|
|
2207
|
+
const attr = this.getAttribute("mode");
|
|
2208
|
+
return attr === "closed" ? "closed" : "open";
|
|
2209
|
+
}
|
|
2210
|
+
set mode(value) {
|
|
2211
|
+
if (value) {
|
|
2212
|
+
this.setAttribute("mode", value);
|
|
2213
|
+
}
|
|
2214
|
+
}
|
|
2215
|
+
get reset() {
|
|
2216
|
+
return this.getAttribute("reset") !== null;
|
|
2217
|
+
}
|
|
2218
|
+
set reset(value) {
|
|
2219
|
+
if (value) {
|
|
2220
|
+
this.setAttribute("reset", "");
|
|
2221
|
+
} else {
|
|
2222
|
+
this.removeAttribute("reset");
|
|
2223
|
+
}
|
|
2224
|
+
}
|
|
2225
|
+
get credentials() {
|
|
2226
|
+
return this.getAttribute("credentials") || "same-origin";
|
|
2227
|
+
}
|
|
2228
|
+
set credentials(value) {
|
|
2229
|
+
if (value) {
|
|
2230
|
+
this.setAttribute("credentials", value);
|
|
2231
|
+
} else {
|
|
2232
|
+
this.removeAttribute("credentials");
|
|
2233
|
+
}
|
|
2234
|
+
}
|
|
2112
2235
|
static get observedAttributes() {
|
|
2113
2236
|
return ["src", "name", "mode"];
|
|
2114
2237
|
}
|
|
2115
|
-
|
|
2116
|
-
|
|
2117
|
-
|
|
2238
|
+
dispatchLifecycleEvent(type, detail) {
|
|
2239
|
+
const event = new Event(type, { bubbles: true, composed: true });
|
|
2240
|
+
if (detail) {
|
|
2241
|
+
Object.assign(event, detail);
|
|
2242
|
+
}
|
|
2243
|
+
this.dispatchEvent(event);
|
|
2244
|
+
}
|
|
2118
2245
|
attributeChangedCallback(name, oldValue, newValue) {
|
|
2119
2246
|
if ((name === "src" || name === "name") && oldValue !== newValue) {
|
|
2120
|
-
if (this.
|
|
2247
|
+
if (this.src) {
|
|
2121
2248
|
this.load().catch((e) => {
|
|
2122
2249
|
if (isAbortError(e)) {
|
|
2123
2250
|
return;
|
|
2124
2251
|
}
|
|
2125
2252
|
logError("HtmlHost", "Error loading remote component.", e);
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
composed: true
|
|
2129
|
-
});
|
|
2130
|
-
Object.assign(errorEvent, {
|
|
2131
|
-
error: e,
|
|
2132
|
-
src: this.getAttribute("src")
|
|
2133
|
-
});
|
|
2134
|
-
this.dispatchEvent(errorEvent);
|
|
2135
|
-
this.isLoading = false;
|
|
2253
|
+
this.dispatchLifecycleEvent("error", { error: e, src: this.src });
|
|
2254
|
+
this.hostState.stage = "error";
|
|
2136
2255
|
});
|
|
2137
2256
|
}
|
|
2138
2257
|
} else if (name === "mode" && oldValue !== newValue && this.root) {
|
|
@@ -2148,15 +2267,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2148
2267
|
return;
|
|
2149
2268
|
}
|
|
2150
2269
|
logError("HtmlHost", "Error reloading remote component.", e);
|
|
2151
|
-
|
|
2152
|
-
bubbles: true,
|
|
2153
|
-
composed: true
|
|
2154
|
-
});
|
|
2155
|
-
Object.assign(errorEvent, {
|
|
2156
|
-
error: e,
|
|
2157
|
-
src: this.getAttribute("src")
|
|
2158
|
-
});
|
|
2159
|
-
this.dispatchEvent(errorEvent);
|
|
2270
|
+
this.dispatchLifecycleEvent("error", { error: e, src: this.src });
|
|
2160
2271
|
});
|
|
2161
2272
|
}
|
|
2162
2273
|
}
|
|
@@ -2166,9 +2277,9 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2166
2277
|
resolve(void 0);
|
|
2167
2278
|
});
|
|
2168
2279
|
});
|
|
2169
|
-
if (this.
|
|
2170
|
-
this.abortController?.abort();
|
|
2171
|
-
this.
|
|
2280
|
+
if (this.hostState.stage === "loading") {
|
|
2281
|
+
this.hostState.abortController?.abort();
|
|
2282
|
+
this.hostState.stage = "idle";
|
|
2172
2283
|
if (this.root && !this.reactRoot) {
|
|
2173
2284
|
this.root.innerHTML = "";
|
|
2174
2285
|
this.fouc = null;
|
|
@@ -2178,29 +2289,24 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2178
2289
|
}
|
|
2179
2290
|
if (!this.root) {
|
|
2180
2291
|
this.root = this.attachShadow({
|
|
2181
|
-
mode: this.
|
|
2292
|
+
mode: this.mode === "closed" ? "closed" : "open"
|
|
2182
2293
|
});
|
|
2183
2294
|
this.fallbackSlot = document.createElement("slot");
|
|
2184
2295
|
this.root.appendChild(this.fallbackSlot);
|
|
2185
2296
|
}
|
|
2186
2297
|
this.name = this.getAttribute("name") || "__vercel_remote_component";
|
|
2187
2298
|
this.bundle = "default";
|
|
2188
|
-
this.
|
|
2189
|
-
const src = this.
|
|
2190
|
-
this.abortController = new AbortController();
|
|
2191
|
-
const signal = this.abortController.signal;
|
|
2192
|
-
const isCurrentLoad = () => !signal.aborted && this.
|
|
2299
|
+
this.hostState.stage = "loading";
|
|
2300
|
+
const src = this.src;
|
|
2301
|
+
this.hostState.abortController = new AbortController();
|
|
2302
|
+
const signal = this.hostState.abortController.signal;
|
|
2303
|
+
const isCurrentLoad = () => !signal.aborted && this.src === src;
|
|
2193
2304
|
const abandonLoad = () => {
|
|
2194
|
-
if (this.abortController?.signal === signal && this.
|
|
2195
|
-
this.
|
|
2305
|
+
if (this.hostState.abortController?.signal === signal && this.hostState.stage === "loading") {
|
|
2306
|
+
this.hostState.stage = "idle";
|
|
2196
2307
|
}
|
|
2197
2308
|
};
|
|
2198
|
-
|
|
2199
|
-
bubbles: true,
|
|
2200
|
-
composed: true
|
|
2201
|
-
});
|
|
2202
|
-
Object.assign(beforeLoadEvent, { src });
|
|
2203
|
-
this.dispatchEvent(beforeLoadEvent);
|
|
2309
|
+
this.dispatchLifecycleEvent("beforeload", { src });
|
|
2204
2310
|
const remoteComponentChild = this.querySelector("div#__REMOTE_COMPONENT__") || this.querySelector("div[data-bundle][data-route]");
|
|
2205
2311
|
if (!src && !remoteComponentChild) {
|
|
2206
2312
|
throw new RemoteComponentsError('"src" attribute is required');
|
|
@@ -2208,15 +2314,16 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2208
2314
|
let url = null;
|
|
2209
2315
|
let html = this.innerHTML;
|
|
2210
2316
|
if (src) {
|
|
2211
|
-
url =
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2317
|
+
url = getClientOrServerUrl(src, window.location.href);
|
|
2318
|
+
this.name = resolveNameFromSrc(
|
|
2319
|
+
src,
|
|
2320
|
+
this.name ?? "__vercel_remote_component"
|
|
2321
|
+
);
|
|
2215
2322
|
}
|
|
2216
2323
|
const resolveClientUrl = url ? bindResolveClientUrl(this.resolveClientUrl, url.href) : void 0;
|
|
2217
2324
|
if (!remoteComponentChild && url) {
|
|
2218
2325
|
const fetchInit = {
|
|
2219
|
-
credentials: this.
|
|
2326
|
+
credentials: this.credentials || "same-origin"
|
|
2220
2327
|
};
|
|
2221
2328
|
const resolvedUrl = new URL(
|
|
2222
2329
|
resolveClientUrl?.(url.href) ?? url.href,
|
|
@@ -2227,7 +2334,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2227
2334
|
res = await fetchWithHooks(resolvedUrl, fetchInit, {
|
|
2228
2335
|
onRequest: this.onRequest,
|
|
2229
2336
|
onResponse: this.onResponse,
|
|
2230
|
-
abortController: this.abortController
|
|
2337
|
+
abortController: this.hostState.abortController
|
|
2231
2338
|
});
|
|
2232
2339
|
} catch (e) {
|
|
2233
2340
|
if (isAbortError(e)) {
|
|
@@ -2252,29 +2359,27 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2252
2359
|
}
|
|
2253
2360
|
const parser = new DOMParser();
|
|
2254
2361
|
const doc = parser.parseFromString(html, "text/html");
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
url?.href ?? (this.getAttribute("src") || "unknown")
|
|
2260
|
-
);
|
|
2261
|
-
}
|
|
2262
|
-
const component = doc.querySelector(`div[data-bundle][data-route][id^="${this.name}"]`) ?? // fallback to the first element with the data-bundle and data-route attributes when not using a named remote component
|
|
2263
|
-
doc.querySelector("div[data-bundle][data-route]") ?? // fallback to Next.js Pages Router
|
|
2264
|
-
doc.querySelector("div#__next") ?? // fallback to a <remote-component> element
|
|
2265
|
-
doc.querySelector(`remote-component[name="${this.name}"]:not([src])`) ?? doc.querySelector("remote-component:not([src])");
|
|
2266
|
-
const nextData = JSON.parse(
|
|
2267
|
-
(doc.querySelector("#__NEXT_DATA__") ?? doc.querySelector("#__REMOTE_NEXT_DATA__"))?.textContent ?? "null"
|
|
2362
|
+
const parsed = parseRemoteComponentDocument(
|
|
2363
|
+
doc,
|
|
2364
|
+
this.name ?? "__vercel_remote_component",
|
|
2365
|
+
url ?? new URL(window.location.href)
|
|
2268
2366
|
);
|
|
2269
|
-
const
|
|
2367
|
+
const {
|
|
2368
|
+
component,
|
|
2369
|
+
name: resolvedName,
|
|
2370
|
+
isRemoteComponent,
|
|
2371
|
+
metadata: parsedMetadata,
|
|
2372
|
+
nextData,
|
|
2373
|
+
rsc,
|
|
2374
|
+
remoteShared
|
|
2375
|
+
} = parsed;
|
|
2270
2376
|
if (nextData && nextData.buildId === "development" && !this.reactRoot) {
|
|
2271
2377
|
this.fouc = document.createElement("style");
|
|
2272
2378
|
this.fouc.textContent = `:host { display: none; }`;
|
|
2273
2379
|
this.root.appendChild(this.fouc);
|
|
2274
2380
|
}
|
|
2275
|
-
this.name =
|
|
2276
|
-
|
|
2277
|
-
this.bundle = component?.getAttribute("data-bundle") || nextData?.props.__REMOTE_COMPONENT__?.bundle || this.bundle;
|
|
2381
|
+
this.name = resolvedName;
|
|
2382
|
+
this.bundle = parsedMetadata.bundle;
|
|
2278
2383
|
if (url) {
|
|
2279
2384
|
const self2 = globalThis;
|
|
2280
2385
|
if (!self2.__remote_bundle_url__) {
|
|
@@ -2282,38 +2387,28 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2282
2387
|
}
|
|
2283
2388
|
self2.__remote_bundle_url__[this.bundle ?? "default"] = url;
|
|
2284
2389
|
}
|
|
2285
|
-
const
|
|
2286
|
-
|
|
2287
|
-
|
|
2390
|
+
const metadataEl = document.createElement("script");
|
|
2391
|
+
metadataEl.type = "application/json";
|
|
2392
|
+
metadataEl.setAttribute("data-remote-component", "");
|
|
2288
2393
|
const metadataObj = {
|
|
2289
2394
|
name: this.name,
|
|
2290
2395
|
bundle: this.bundle,
|
|
2291
|
-
route:
|
|
2292
|
-
runtime:
|
|
2396
|
+
route: parsedMetadata.route,
|
|
2397
|
+
runtime: parsedMetadata.runtime
|
|
2293
2398
|
};
|
|
2294
|
-
|
|
2399
|
+
metadataEl.textContent = JSON.stringify(metadataObj);
|
|
2295
2400
|
if (this.previousElementSibling?.getAttribute("data-remote-component") !== null) {
|
|
2296
2401
|
this.previousElementSibling?.remove();
|
|
2297
2402
|
}
|
|
2298
|
-
this.parentElement?.insertBefore(
|
|
2299
|
-
const remoteSharedEl = doc.querySelector(
|
|
2300
|
-
`#${this.name}_shared[data-remote-components-shared]`
|
|
2301
|
-
);
|
|
2302
|
-
const remoteShared = nextData?.props.__REMOTE_COMPONENT__?.shared ?? (JSON.parse(remoteSharedEl?.textContent ?? "{}") ?? {});
|
|
2303
|
-
remoteSharedEl?.parentElement?.removeChild(remoteSharedEl);
|
|
2403
|
+
this.parentElement?.insertBefore(metadataEl, this);
|
|
2304
2404
|
if ("__remote_components_missing_shared__" in remoteShared) {
|
|
2305
2405
|
throw new RemoteComponentsError(
|
|
2306
2406
|
remoteShared.__remote_components_missing_shared__
|
|
2307
2407
|
);
|
|
2308
2408
|
}
|
|
2309
|
-
if (
|
|
2310
|
-
|
|
2311
|
-
|
|
2312
|
-
);
|
|
2313
|
-
}
|
|
2314
|
-
if (this.prevIsRemoteComponent) {
|
|
2315
|
-
if (this.prevUrl) {
|
|
2316
|
-
const prevUrl = this.prevUrl;
|
|
2409
|
+
if (this.hostState.prevIsRemoteComponent) {
|
|
2410
|
+
if (this.hostState.prevUrl) {
|
|
2411
|
+
const prevUrl = this.hostState.prevUrl;
|
|
2317
2412
|
const self2 = globalThis;
|
|
2318
2413
|
if (self2.__remote_script_entrypoint_unmount__?.[prevUrl.href]) {
|
|
2319
2414
|
await Promise.all(
|
|
@@ -2338,26 +2433,21 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2338
2433
|
}
|
|
2339
2434
|
this.root.innerHTML = "";
|
|
2340
2435
|
}
|
|
2341
|
-
if (this.prevSrc !==
|
|
2342
|
-
|
|
2343
|
-
|
|
2344
|
-
composed: true
|
|
2345
|
-
});
|
|
2346
|
-
Object.assign(changeEvent, {
|
|
2347
|
-
previousSrc: this.prevSrc,
|
|
2436
|
+
if (this.hostState.prevSrc !== void 0) {
|
|
2437
|
+
this.dispatchLifecycleEvent("change", {
|
|
2438
|
+
previousSrc: this.hostState.prevSrc,
|
|
2348
2439
|
nextSrc: src,
|
|
2349
|
-
previousName: this.prevName,
|
|
2440
|
+
previousName: this.hostState.prevName,
|
|
2350
2441
|
nextName: this.name
|
|
2351
2442
|
});
|
|
2352
|
-
this.dispatchEvent(changeEvent);
|
|
2353
2443
|
}
|
|
2354
|
-
this.prevUrl = url ?? new URL(window.location.href);
|
|
2355
|
-
this.prevIsRemoteComponent = isRemoteComponent;
|
|
2356
|
-
this.prevSrc = src;
|
|
2357
|
-
this.prevName = this.name;
|
|
2444
|
+
this.hostState.prevUrl = url ?? new URL(window.location.href);
|
|
2445
|
+
this.hostState.prevIsRemoteComponent = isRemoteComponent;
|
|
2446
|
+
this.hostState.prevSrc = src;
|
|
2447
|
+
this.hostState.prevName = this.name;
|
|
2358
2448
|
const removable = Array.from(this.childNodes);
|
|
2359
2449
|
const links = doc.querySelectorAll("link[href]");
|
|
2360
|
-
const remoteComponentSrc = this.
|
|
2450
|
+
const remoteComponentSrc = this.src ? String(this.src) : null;
|
|
2361
2451
|
const doAttachStyles = () => attachStyles({
|
|
2362
2452
|
doc,
|
|
2363
2453
|
component,
|
|
@@ -2431,7 +2521,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2431
2521
|
}
|
|
2432
2522
|
this.fallbackSlot?.remove();
|
|
2433
2523
|
const applyReset = () => {
|
|
2434
|
-
if (this.
|
|
2524
|
+
if (this.reset && !this.root?.querySelector("link[data-remote-components-reset]")) {
|
|
2435
2525
|
const allInitial = document.createElement("link");
|
|
2436
2526
|
allInitial.setAttribute("data-remote-components-reset", "");
|
|
2437
2527
|
const css = `:host { all: initial; }`;
|
|
@@ -2449,7 +2539,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2449
2539
|
allInitial.removeAttribute("onload");
|
|
2450
2540
|
};
|
|
2451
2541
|
this.root?.prepend(allInitial);
|
|
2452
|
-
} else if (this.
|
|
2542
|
+
} else if (!this.reset && this.root?.querySelector("link[data-remote-components-reset]")) {
|
|
2453
2543
|
this.root.querySelector("link[data-remote-components-reset]")?.remove();
|
|
2454
2544
|
}
|
|
2455
2545
|
};
|
|
@@ -2557,14 +2647,9 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2557
2647
|
});
|
|
2558
2648
|
}
|
|
2559
2649
|
if (isCurrentLoad()) {
|
|
2560
|
-
this.
|
|
2650
|
+
this.hostState.stage = "loaded";
|
|
2561
2651
|
}
|
|
2562
|
-
|
|
2563
|
-
bubbles: true,
|
|
2564
|
-
composed: true
|
|
2565
|
-
});
|
|
2566
|
-
Object.assign(loadEvent, { src: this.getAttribute("src") });
|
|
2567
|
-
this.dispatchEvent(loadEvent);
|
|
2652
|
+
this.dispatchLifecycleEvent("load", { src: this.src });
|
|
2568
2653
|
}, [initial, name]);
|
|
2569
2654
|
return Component;
|
|
2570
2655
|
};
|
|
@@ -2598,7 +2683,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2598
2683
|
} else if (nextData) {
|
|
2599
2684
|
const { Component, App } = nextClientPagesLoader2(
|
|
2600
2685
|
this.bundle ?? "default",
|
|
2601
|
-
nextData.page,
|
|
2686
|
+
nextData.page ?? "/",
|
|
2602
2687
|
this.root
|
|
2603
2688
|
);
|
|
2604
2689
|
if (Component) {
|
|
@@ -2612,16 +2697,11 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2612
2697
|
});
|
|
2613
2698
|
}
|
|
2614
2699
|
if (isCurrentLoad()) {
|
|
2615
|
-
remoteComponent.
|
|
2700
|
+
remoteComponent.hostState.stage = "loaded";
|
|
2616
2701
|
}
|
|
2617
|
-
|
|
2618
|
-
|
|
2619
|
-
composed: true
|
|
2620
|
-
});
|
|
2621
|
-
Object.assign(loadEvent, {
|
|
2622
|
-
src: remoteComponent.getAttribute("src")
|
|
2702
|
+
remoteComponent.dispatchLifecycleEvent("load", {
|
|
2703
|
+
src: remoteComponent.src
|
|
2623
2704
|
});
|
|
2624
|
-
remoteComponent.dispatchEvent(loadEvent);
|
|
2625
2705
|
}, [initial, remoteComponent]);
|
|
2626
2706
|
return NextApp ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NextApp, { Component: NextComponent, ...nextData.props }) : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(NextComponent, { ...nextData.props });
|
|
2627
2707
|
})(App, Component, this);
|
|
@@ -2631,7 +2711,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2631
2711
|
root.render(/* @__PURE__ */ (0, import_jsx_runtime2.jsx)(RemoteComponentFromNext, { initial: false }));
|
|
2632
2712
|
doCleanup();
|
|
2633
2713
|
if (isCurrentLoad()) {
|
|
2634
|
-
this.
|
|
2714
|
+
this.hostState.stage = "loaded";
|
|
2635
2715
|
}
|
|
2636
2716
|
});
|
|
2637
2717
|
return;
|
|
@@ -2662,22 +2742,12 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
2662
2742
|
}
|
|
2663
2743
|
})
|
|
2664
2744
|
);
|
|
2665
|
-
|
|
2666
|
-
bubbles: true,
|
|
2667
|
-
composed: true
|
|
2668
|
-
});
|
|
2669
|
-
Object.assign(loadEvent, { src: this.getAttribute("src") });
|
|
2670
|
-
this.dispatchEvent(loadEvent);
|
|
2745
|
+
this.dispatchLifecycleEvent("load", { src: this.src });
|
|
2671
2746
|
} else {
|
|
2672
|
-
|
|
2673
|
-
bubbles: true,
|
|
2674
|
-
composed: true
|
|
2675
|
-
});
|
|
2676
|
-
Object.assign(loadEvent, { src: this.getAttribute("src") });
|
|
2677
|
-
this.dispatchEvent(loadEvent);
|
|
2747
|
+
this.dispatchLifecycleEvent("load", { src: this.src });
|
|
2678
2748
|
}
|
|
2679
2749
|
if (isCurrentLoad()) {
|
|
2680
|
-
this.
|
|
2750
|
+
this.hostState.stage = "loaded";
|
|
2681
2751
|
}
|
|
2682
2752
|
}
|
|
2683
2753
|
}
|
|
@@ -2696,7 +2766,6 @@ function registerSharedModules(modules = {}) {
|
|
|
2696
2766
|
}
|
|
2697
2767
|
// Annotate the CommonJS export names for ESM import in node:
|
|
2698
2768
|
0 && (module.exports = {
|
|
2699
|
-
proxyClientRequestsThroughHost,
|
|
2700
2769
|
registerSharedModules
|
|
2701
2770
|
});
|
|
2702
|
-
//# sourceMappingURL=
|
|
2771
|
+
//# sourceMappingURL=html.cjs.map
|