remote-components 0.1.2 → 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} +1012 -1075
- 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} +1009 -1071
- package/dist/host/html.js.map +1 -0
- package/dist/{next/host/client/index.cjs → host/nextjs/app/client-only.cjs} +681 -617
- 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} +682 -611
- package/dist/host/nextjs/app/client-only.js.map +1 -0
- package/dist/{next/host/app-router-server.cjs → host/nextjs/app.cjs} +11 -10
- package/dist/host/nextjs/app.cjs.map +1 -0
- package/dist/host/nextjs/app.d.ts +29 -0
- package/dist/{next/host/app-router-server.js → host/nextjs/app.js} +7 -6
- package/dist/host/nextjs/app.js.map +1 -0
- package/dist/{next/host/pages-router-client.cjs → host/nextjs/pages/client-only.cjs} +8 -8
- package/dist/host/nextjs/pages/client-only.cjs.map +1 -0
- package/dist/host/nextjs/pages/client-only.d.ts +31 -0
- package/dist/{next/host/pages-router-client.js → host/nextjs/pages/client-only.js} +4 -4
- package/dist/host/nextjs/pages/client-only.js.map +1 -0
- package/dist/{next/host/pages-router-server.cjs → host/nextjs/pages.cjs} +44 -55
- package/dist/host/nextjs/pages.cjs.map +1 -0
- package/dist/{next/host/pages-router-server.d.ts → host/nextjs/pages.d.ts} +11 -13
- package/dist/{next/host/pages-router-server.js → host/nextjs/pages.js} +38 -49
- package/dist/host/nextjs/pages.js.map +1 -0
- package/dist/host/proxy/client.cjs +57 -0
- package/dist/host/proxy/client.cjs.map +1 -0
- package/dist/host/proxy/client.d.ts +31 -0
- package/dist/host/proxy/client.js +30 -0
- package/dist/host/proxy/client.js.map +1 -0
- package/dist/{shared/host/proxy.cjs → host/proxy/protected-fetch.cjs} +6 -6
- package/dist/host/proxy/protected-fetch.cjs.map +1 -0
- package/dist/{shared/host/proxy.js → host/proxy/protected-fetch.js} +3 -3
- package/dist/host/proxy/protected-fetch.js.map +1 -0
- package/dist/{next → host}/proxy.cjs +12 -92
- package/dist/host/proxy.cjs.map +1 -0
- package/dist/host/proxy.d.ts +30 -0
- package/dist/{next → host}/proxy.js +11 -88
- package/dist/host/proxy.js.map +1 -0
- package/dist/{react/index.cjs → host/react.cjs} +515 -548
- package/dist/host/react.cjs.map +1 -0
- package/dist/{component-loader-21865da3.d.ts → host/react.d.ts} +141 -99
- package/dist/{react/index.js → host/react.js} +514 -545
- 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} +29 -24
- package/dist/internal/host/nextjs/app-client.cjs.map +1 -0
- package/dist/internal/host/nextjs/app-client.d.ts +25 -0
- package/dist/internal/{next/host/app-router-client.js → host/nextjs/app-client.js} +19 -19
- package/dist/internal/host/nextjs/app-client.js.map +1 -0
- package/dist/internal/{next/host/app-router-compat.cjs → host/nextjs/app-compat.cjs} +5 -22
- package/dist/internal/host/nextjs/app-compat.cjs.map +1 -0
- package/dist/internal/{next/host/app-router-compat.d.ts → host/nextjs/app-compat.d.ts} +1 -7
- package/dist/internal/{next/host/app-router-compat.js → host/nextjs/app-compat.js} +2 -18
- package/dist/internal/host/nextjs/app-compat.js.map +1 -0
- package/dist/internal/host/nextjs/dom-flight.cjs.map +1 -0
- package/dist/internal/host/nextjs/dom-flight.d.ts +39 -0
- package/dist/internal/host/nextjs/dom-flight.js.map +1 -0
- package/dist/internal/host/nextjs/image-impl.cjs +60 -0
- package/dist/internal/host/nextjs/image-impl.cjs.map +1 -0
- package/dist/internal/host/nextjs/image-impl.d.ts +10 -0
- package/dist/internal/host/nextjs/image-impl.js +36 -0
- package/dist/internal/host/nextjs/image-impl.js.map +1 -0
- package/dist/internal/host/nextjs/image-shared.cjs +43 -0
- package/dist/internal/host/nextjs/image-shared.cjs.map +1 -0
- package/dist/internal/host/nextjs/image-shared.d.ts +9 -0
- package/dist/internal/host/nextjs/image-shared.js +19 -0
- package/dist/internal/host/nextjs/image-shared.js.map +1 -0
- package/dist/internal/{next/host → host/nextjs}/remote-component-links.cjs +2 -2
- package/dist/internal/host/nextjs/remote-component-links.cjs.map +1 -0
- package/dist/internal/{next/host → host/nextjs}/remote-component-links.d.ts +1 -1
- package/dist/internal/{next/host → host/nextjs}/remote-component-links.js +2 -2
- package/dist/internal/host/nextjs/remote-component-links.js.map +1 -0
- package/dist/internal/host/nextjs/skeleton.cjs.map +1 -0
- package/dist/internal/host/nextjs/skeleton.js.map +1 -0
- package/dist/internal/{react → host/react}/context.cjs +3 -3
- package/dist/internal/host/react/context.cjs.map +1 -0
- package/dist/internal/{react → host/react}/context.d.ts +4 -4
- package/dist/internal/{react → host/react}/context.js +2 -2
- package/dist/internal/host/react/context.js.map +1 -0
- package/dist/internal/{react → host/react}/hooks/use-resolve-client-url.cjs +2 -2
- package/dist/internal/host/react/hooks/use-resolve-client-url.cjs.map +1 -0
- package/dist/internal/{react → host/react}/hooks/use-resolve-client-url.d.ts +1 -1
- package/dist/internal/{react → host/react}/hooks/use-resolve-client-url.js +2 -2
- package/dist/internal/host/react/hooks/use-resolve-client-url.js.map +1 -0
- package/dist/internal/host/server/fetch-headers.cjs.map +1 -0
- package/dist/internal/host/server/fetch-headers.js.map +1 -0
- package/dist/internal/{shared/ssr → host/server}/fetch-remote-component.cjs +6 -6
- package/dist/internal/host/server/fetch-remote-component.cjs.map +1 -0
- package/dist/internal/{shared/ssr → host/server}/fetch-remote-component.d.ts +6 -1
- package/dist/internal/{shared/ssr → host/server}/fetch-remote-component.js +9 -9
- package/dist/internal/host/server/fetch-remote-component.js.map +1 -0
- package/dist/internal/{shared/ssr → host/server}/fetch-with-hooks.cjs +11 -15
- package/dist/internal/host/server/fetch-with-hooks.cjs.map +1 -0
- package/dist/internal/host/server/fetch-with-hooks.d.ts +21 -0
- package/dist/internal/{shared/ssr → host/server}/fetch-with-hooks.js +11 -15
- package/dist/internal/host/server/fetch-with-hooks.js.map +1 -0
- package/dist/internal/host/server/get-client-or-server-url.cjs.map +1 -0
- package/dist/internal/host/server/get-client-or-server-url.js.map +1 -0
- package/dist/internal/{shared/client → host/server}/get-client-src.cjs +1 -1
- package/dist/internal/host/server/get-client-src.cjs.map +1 -0
- package/dist/internal/{shared/client → host/server}/get-client-src.js +1 -1
- package/dist/internal/host/server/get-client-src.js.map +1 -0
- package/dist/internal/host/server/get-ssr-relative-path-base-url.cjs.map +1 -0
- package/dist/internal/host/server/get-ssr-relative-path-base-url.js.map +1 -0
- package/dist/{next/remote/server.cjs → internal/host/server/types.cjs} +3 -15
- package/dist/internal/host/server/types.cjs.map +1 -0
- package/dist/internal/host/server/types.d.ts +33 -0
- package/dist/internal/host/server/types.js +1 -0
- package/dist/internal/host/server/types.js.map +1 -0
- package/dist/internal/host/shared/asset-descriptors.cjs +17 -0
- package/dist/internal/host/shared/asset-descriptors.cjs.map +1 -0
- package/dist/internal/host/shared/asset-descriptors.d.ts +21 -0
- package/dist/internal/host/shared/asset-descriptors.js +1 -0
- package/dist/internal/host/shared/asset-descriptors.js.map +1 -0
- package/dist/internal/host/shared/config.cjs +17 -0
- package/dist/internal/host/shared/config.cjs.map +1 -0
- package/dist/{host-config-58cdccea.d.ts → internal/host/shared/config.d.ts} +32 -19
- package/dist/internal/host/shared/config.js +1 -0
- package/dist/internal/host/shared/config.js.map +1 -0
- package/dist/internal/host/shared/fetch-interceptors.cjs +17 -0
- package/dist/internal/host/shared/fetch-interceptors.cjs.map +1 -0
- package/dist/{types-2b26a246.d.ts → internal/host/shared/fetch-interceptors.d.ts} +4 -87
- package/dist/internal/host/shared/fetch-interceptors.js +1 -0
- package/dist/internal/host/shared/fetch-interceptors.js.map +1 -0
- package/dist/internal/{shared/client → host/shared}/polyfill.cjs +7 -6
- package/dist/internal/host/shared/polyfill.cjs.map +1 -0
- package/dist/internal/{shared/client → host/shared}/polyfill.d.ts +2 -1
- package/dist/internal/{shared/client → host/shared}/polyfill.js +7 -6
- package/dist/internal/host/shared/polyfill.js.map +1 -0
- package/dist/internal/host/shared/resolved-data.cjs +17 -0
- package/dist/internal/host/shared/resolved-data.cjs.map +1 -0
- package/dist/internal/host/shared/resolved-data.d.ts +48 -0
- package/dist/internal/host/shared/resolved-data.js +1 -0
- package/dist/internal/host/shared/resolved-data.js.map +1 -0
- package/dist/internal/{shared/contract/host-state.cjs → host/shared/state.cjs} +4 -4
- package/dist/internal/host/shared/state.cjs.map +1 -0
- package/dist/internal/{shared/contract/host-state.js → host/shared/state.js} +1 -1
- package/dist/internal/host/shared/state.js.map +1 -0
- package/dist/internal/host/utils/resolve-name-from-src.cjs.map +1 -0
- package/dist/internal/host/utils/resolve-name-from-src.js.map +1 -0
- package/dist/internal/{next/remote/render-client.cjs → remote/nextjs/app-client.cjs} +8 -8
- package/dist/internal/remote/nextjs/app-client.cjs.map +1 -0
- package/dist/internal/{next/remote/render-client.js → remote/nextjs/app-client.js} +4 -4
- package/dist/internal/remote/nextjs/app-client.js.map +1 -0
- package/dist/internal/runtime/constants.cjs +50 -0
- package/dist/internal/runtime/constants.cjs.map +1 -0
- package/dist/internal/runtime/constants.d.ts +10 -0
- package/dist/internal/runtime/constants.js +20 -0
- package/dist/internal/runtime/constants.js.map +1 -0
- package/dist/internal/{shared/client → runtime/html}/apply-origin.cjs.map +1 -1
- package/dist/internal/{shared/client → runtime/html}/apply-origin.d.ts +1 -1
- package/dist/internal/{shared/client → runtime/html}/apply-origin.js.map +1 -1
- package/dist/internal/runtime/html/parse-remote-html.cjs +140 -0
- package/dist/internal/runtime/html/parse-remote-html.cjs.map +1 -0
- package/dist/internal/runtime/html/parse-remote-html.d.ts +88 -0
- package/dist/internal/runtime/html/parse-remote-html.js +110 -0
- package/dist/internal/runtime/html/parse-remote-html.js.map +1 -0
- package/dist/internal/runtime/html/set-attributes-from-props.cjs +68 -0
- package/dist/internal/runtime/html/set-attributes-from-props.cjs.map +1 -0
- package/dist/internal/runtime/html/set-attributes-from-props.d.ts +3 -0
- package/dist/internal/runtime/html/set-attributes-from-props.js +44 -0
- package/dist/internal/runtime/html/set-attributes-from-props.js.map +1 -0
- package/dist/internal/runtime/loaders/component-loader.cjs +184 -0
- package/dist/internal/runtime/loaders/component-loader.cjs.map +1 -0
- package/dist/internal/runtime/loaders/component-loader.d.ts +31 -0
- package/dist/internal/runtime/loaders/component-loader.js +150 -0
- package/dist/internal/runtime/loaders/component-loader.js.map +1 -0
- package/dist/internal/runtime/loaders/script-loader.cjs +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/{shared/client/proxy-through-host.cjs → runtime/url/resolve-client-url.cjs} +4 -24
- package/dist/internal/runtime/url/resolve-client-url.cjs.map +1 -0
- package/dist/internal/{shared/client/proxy-through-host.d.ts → runtime/url/resolve-client-url.d.ts} +1 -25
- package/dist/internal/runtime/url/resolve-client-url.js +21 -0
- package/dist/internal/runtime/url/resolve-client-url.js.map +1 -0
- package/dist/internal/utils/abort.cjs.map +1 -0
- package/dist/internal/utils/abort.js.map +1 -0
- package/dist/internal/{shared → utils}/constants.cjs +3 -0
- package/dist/internal/utils/constants.cjs.map +1 -0
- package/dist/internal/utils/constants.d.ts +5 -0
- package/dist/internal/{shared → utils}/constants.js +2 -0
- package/dist/internal/utils/constants.js.map +1 -0
- package/dist/internal/{shared → utils}/error.cjs +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/{internal/next/remote/render-server.d.ts → remote/nextjs/app.d.ts} +12 -13
- package/dist/{internal/next/remote/render-server.js → remote/nextjs/app.js} +9 -11
- package/dist/remote/nextjs/app.js.map +1 -0
- package/dist/{next/remote/pages-router.cjs → remote/nextjs/pages.cjs} +8 -8
- package/dist/remote/nextjs/pages.cjs.map +1 -0
- package/dist/{next/remote/pages-router.d.ts → remote/nextjs/pages.d.ts} +8 -8
- package/dist/{next/remote/pages-router.js → remote/nextjs/pages.js} +4 -4
- package/dist/remote/nextjs/pages.js.map +1 -0
- package/dist/server-handoff-8c89b856.d.ts +46 -0
- package/package.json +126 -157
- package/dist/html/host.cjs.map +0 -1
- package/dist/html/host.js.map +0 -1
- package/dist/html/remote.cjs.map +0 -1
- package/dist/html/remote.js.map +0 -1
- package/dist/internal/next/host/app-router-client.cjs.map +0 -1
- package/dist/internal/next/host/app-router-client.d.ts +0 -79
- package/dist/internal/next/host/app-router-client.js.map +0 -1
- package/dist/internal/next/host/app-router-compat.cjs.map +0 -1
- package/dist/internal/next/host/app-router-compat.js.map +0 -1
- package/dist/internal/next/host/remote-component-links.cjs.map +0 -1
- package/dist/internal/next/host/remote-component-links.js.map +0 -1
- package/dist/internal/next/remote/render-client.cjs.map +0 -1
- package/dist/internal/next/remote/render-client.js.map +0 -1
- package/dist/internal/next/remote/render-server.cjs.map +0 -1
- package/dist/internal/next/remote/render-server.js.map +0 -1
- package/dist/internal/react/context.cjs.map +0 -1
- package/dist/internal/react/context.js.map +0 -1
- package/dist/internal/react/hooks/use-resolve-client-url.cjs.map +0 -1
- package/dist/internal/react/hooks/use-resolve-client-url.js.map +0 -1
- package/dist/internal/shared/client/default-resolve-client-url.cjs.map +0 -1
- package/dist/internal/shared/client/default-resolve-client-url.js.map +0 -1
- package/dist/internal/shared/client/get-client-src.cjs.map +0 -1
- package/dist/internal/shared/client/get-client-src.js.map +0 -1
- package/dist/internal/shared/client/polyfill.cjs.map +0 -1
- package/dist/internal/shared/client/polyfill.js.map +0 -1
- package/dist/internal/shared/client/protected-rc-fallback.cjs.map +0 -1
- package/dist/internal/shared/client/protected-rc-fallback.js.map +0 -1
- package/dist/internal/shared/client/proxy-through-host.cjs.map +0 -1
- package/dist/internal/shared/client/proxy-through-host.js +0 -40
- package/dist/internal/shared/client/proxy-through-host.js.map +0 -1
- package/dist/internal/shared/client/remote-component.cjs +0 -1436
- package/dist/internal/shared/client/remote-component.cjs.map +0 -1
- package/dist/internal/shared/client/remote-component.d.ts +0 -62
- package/dist/internal/shared/client/remote-component.js +0 -1385
- package/dist/internal/shared/client/remote-component.js.map +0 -1
- package/dist/internal/shared/constants.cjs.map +0 -1
- package/dist/internal/shared/constants.d.ts +0 -4
- package/dist/internal/shared/constants.js.map +0 -1
- package/dist/internal/shared/contract/host-state.cjs.map +0 -1
- package/dist/internal/shared/contract/host-state.js.map +0 -1
- package/dist/internal/shared/contract/resolve-name-from-src.cjs.map +0 -1
- package/dist/internal/shared/contract/resolve-name-from-src.js.map +0 -1
- package/dist/internal/shared/error.cjs.map +0 -1
- package/dist/internal/shared/error.js.map +0 -1
- package/dist/internal/shared/ssr/dom-flight.cjs.map +0 -1
- package/dist/internal/shared/ssr/dom-flight.d.ts +0 -2
- package/dist/internal/shared/ssr/dom-flight.js.map +0 -1
- package/dist/internal/shared/ssr/fetch-headers.cjs.map +0 -1
- package/dist/internal/shared/ssr/fetch-headers.js.map +0 -1
- package/dist/internal/shared/ssr/fetch-remote-component.cjs.map +0 -1
- package/dist/internal/shared/ssr/fetch-remote-component.js.map +0 -1
- package/dist/internal/shared/ssr/fetch-with-hooks.cjs.map +0 -1
- package/dist/internal/shared/ssr/fetch-with-hooks.d.ts +0 -56
- package/dist/internal/shared/ssr/fetch-with-hooks.js.map +0 -1
- package/dist/internal/shared/ssr/get-client-or-server-url.cjs.map +0 -1
- package/dist/internal/shared/ssr/get-client-or-server-url.js.map +0 -1
- package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.cjs.map +0 -1
- package/dist/internal/shared/ssr/get-ssr-relative-path-base-url.js.map +0 -1
- package/dist/internal/shared/ssr/skeleton.cjs.map +0 -1
- package/dist/internal/shared/ssr/skeleton.js.map +0 -1
- package/dist/internal/shared/utils/abort.cjs.map +0 -1
- package/dist/internal/shared/utils/abort.js.map +0 -1
- package/dist/internal/shared/utils/logger.cjs.map +0 -1
- package/dist/internal/shared/utils/logger.js.map +0 -1
- package/dist/internal/shared/utils.cjs.map +0 -1
- package/dist/internal/shared/utils.js.map +0 -1
- package/dist/internal/webpack/next-client-pages-loader.cjs.map +0 -1
- package/dist/internal/webpack/next-client-pages-loader.js.map +0 -1
- package/dist/internal/webpack/shared-modules.cjs.map +0 -1
- package/dist/internal/webpack/shared-modules.js.map +0 -1
- package/dist/next/config.cjs.map +0 -1
- package/dist/next/config.js.map +0 -1
- package/dist/next/host/app-router-server.cjs.map +0 -1
- package/dist/next/host/app-router-server.d.ts +0 -30
- package/dist/next/host/app-router-server.js.map +0 -1
- package/dist/next/host/client/index.cjs.map +0 -1
- package/dist/next/host/client/index.d.ts +0 -19
- package/dist/next/host/client/index.js.map +0 -1
- package/dist/next/host/pages-router-client.cjs.map +0 -1
- package/dist/next/host/pages-router-client.d.ts +0 -33
- package/dist/next/host/pages-router-client.js.map +0 -1
- package/dist/next/host/pages-router-server.cjs.map +0 -1
- package/dist/next/host/pages-router-server.js.map +0 -1
- package/dist/next/index.cjs +0 -53
- package/dist/next/index.cjs.map +0 -1
- package/dist/next/index.d.ts +0 -30
- package/dist/next/index.js +0 -19
- package/dist/next/index.js.map +0 -1
- package/dist/next/proxy.cjs.map +0 -1
- package/dist/next/proxy.d.ts +0 -56
- package/dist/next/proxy.js.map +0 -1
- package/dist/next/remote/pages-router.cjs.map +0 -1
- package/dist/next/remote/pages-router.js.map +0 -1
- package/dist/next/remote/server.cjs.map +0 -1
- package/dist/next/remote/server.d.ts +0 -5
- package/dist/next/remote/server.js +0 -5
- package/dist/next/remote/server.js.map +0 -1
- package/dist/proxy-through-host-a676a522.d.ts +0 -52
- package/dist/react/index.cjs.map +0 -1
- package/dist/react/index.d.ts +0 -86
- package/dist/react/index.js.map +0 -1
- package/dist/shared/host/app.cjs.map +0 -1
- package/dist/shared/host/app.js +0 -12
- package/dist/shared/host/app.js.map +0 -1
- package/dist/shared/host/pages.cjs.map +0 -1
- package/dist/shared/host/pages.js +0 -12
- package/dist/shared/host/pages.js.map +0 -1
- package/dist/shared/host/proxy.cjs.map +0 -1
- package/dist/shared/host/proxy.js.map +0 -1
- package/dist/shared/remote/app.cjs.map +0 -1
- package/dist/shared/remote/app.js +0 -8
- package/dist/shared/remote/app.js.map +0 -1
- package/dist/shared/remote/pages.cjs.map +0 -1
- package/dist/shared/remote/pages.js +0 -8
- package/dist/shared/remote/pages.js.map +0 -1
- package/dist/shared/remote/proxy.cjs.map +0 -1
- package/dist/shared/remote/proxy.d.ts +0 -44
- package/dist/shared/remote/proxy.js.map +0 -1
- package/dist/shared/remote/wrapper.cjs.map +0 -1
- package/dist/shared/remote/wrapper.js +0 -25
- package/dist/shared/remote/wrapper.js.map +0 -1
- package/dist/webpack.cjs.map +0 -1
- package/dist/webpack.js.map +0 -1
- /package/dist/{webpack.d.ts → config/webpack.d.ts} +0 -0
- /package/dist/{shared/host → host/defaults}/app.d.ts +0 -0
- /package/dist/{shared/host → host/defaults}/pages.d.ts +0 -0
- /package/dist/{shared/host/proxy.d.ts → host/proxy/protected-fetch.d.ts} +0 -0
- /package/dist/internal/{webpack/shared-modules.d.ts → config/webpack/apply-shared-modules.d.ts} +0 -0
- /package/dist/internal/{webpack → config/webpack}/next-client-pages-loader.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/nextjs}/dom-flight.cjs +0 -0
- /package/dist/internal/{shared/ssr → host/nextjs}/dom-flight.js +0 -0
- /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.cjs +0 -0
- /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/nextjs}/skeleton.js +0 -0
- /package/dist/internal/{shared/ssr → host/server}/fetch-headers.cjs +0 -0
- /package/dist/internal/{shared/ssr → host/server}/fetch-headers.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/server}/fetch-headers.js +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.cjs +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-client-or-server-url.js +0 -0
- /package/dist/internal/{shared/client → host/server}/get-client-src.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.cjs +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.d.ts +0 -0
- /package/dist/internal/{shared/ssr → host/server}/get-ssr-relative-path-base-url.js +0 -0
- /package/dist/internal/{shared/contract/host-state.d.ts → host/shared/state.d.ts} +0 -0
- /package/dist/internal/{shared/contract → host/utils}/resolve-name-from-src.cjs +0 -0
- /package/dist/internal/{shared/contract → host/utils}/resolve-name-from-src.d.ts +0 -0
- /package/dist/internal/{shared/contract → host/utils}/resolve-name-from-src.js +0 -0
- /package/dist/internal/{next/remote/render-client.d.ts → remote/nextjs/app-client.d.ts} +0 -0
- /package/dist/internal/{shared/client → runtime/html}/apply-origin.cjs +0 -0
- /package/dist/internal/{shared/client → runtime/html}/apply-origin.js +0 -0
- /package/dist/internal/{shared/client → runtime/url}/protected-rc-fallback.d.ts +0 -0
- /package/dist/internal/{shared/utils → utils}/abort.cjs +0 -0
- /package/dist/internal/{shared/utils → utils}/abort.d.ts +0 -0
- /package/dist/internal/{shared/utils → utils}/abort.js +0 -0
- /package/dist/internal/{shared → utils}/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
|
@@ -1,1436 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __create = Object.create;
|
|
3
|
-
var __defProp = Object.defineProperty;
|
|
4
|
-
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
5
|
-
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
|
-
var __getProtoOf = Object.getPrototypeOf;
|
|
7
|
-
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
-
var __export = (target, all) => {
|
|
9
|
-
for (var name in all)
|
|
10
|
-
__defProp(target, name, { get: all[name], enumerable: true });
|
|
11
|
-
};
|
|
12
|
-
var __copyProps = (to, from, except, desc) => {
|
|
13
|
-
if (from && typeof from === "object" || typeof from === "function") {
|
|
14
|
-
for (let key of __getOwnPropNames(from))
|
|
15
|
-
if (!__hasOwnProp.call(to, key) && key !== except)
|
|
16
|
-
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
|
|
17
|
-
}
|
|
18
|
-
return to;
|
|
19
|
-
};
|
|
20
|
-
var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
|
|
21
|
-
// If the importer is in node compatibility mode or this is not an ESM
|
|
22
|
-
// file that has been converted to a CommonJS file using a Babel-
|
|
23
|
-
// compatible transform (i.e. "__esModule" has not been set), then set
|
|
24
|
-
// "default" to the CommonJS "module.exports" for node compatibility.
|
|
25
|
-
isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
|
|
26
|
-
mod
|
|
27
|
-
));
|
|
28
|
-
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
29
|
-
|
|
30
|
-
// src/shared/client/remote-component.ts
|
|
31
|
-
var remote_component_exports = {};
|
|
32
|
-
__export(remote_component_exports, {
|
|
33
|
-
DEFAULT_ROUTE: () => DEFAULT_ROUTE,
|
|
34
|
-
REMOTE_COMPONENT_REGEX: () => REMOTE_COMPONENT_REGEX,
|
|
35
|
-
RUNTIME_SCRIPT: () => RUNTIME_SCRIPT,
|
|
36
|
-
RUNTIME_TURBOPACK: () => RUNTIME_TURBOPACK,
|
|
37
|
-
RUNTIME_WEBPACK: () => RUNTIME_WEBPACK,
|
|
38
|
-
RemoteComponentsError: () => RemoteComponentsError,
|
|
39
|
-
createRSCStream: () => createRSCStream,
|
|
40
|
-
fixPayload: () => fixPayload,
|
|
41
|
-
getBundleKey: () => getBundleKey,
|
|
42
|
-
loadRemoteComponent: () => loadRemoteComponent,
|
|
43
|
-
loadScripts: () => loadScripts,
|
|
44
|
-
loadStaticRemoteComponent: () => loadStaticRemoteComponent,
|
|
45
|
-
proxyClientRequestsThroughHost: () => proxyClientRequestsThroughHost,
|
|
46
|
-
setAttributesFromProps: () => setAttributesFromProps,
|
|
47
|
-
setupWebpackRuntime: () => setupWebpackRuntime
|
|
48
|
-
});
|
|
49
|
-
module.exports = __toCommonJS(remote_component_exports);
|
|
50
|
-
|
|
51
|
-
// src/shared/constants.ts
|
|
52
|
-
var RC_PROTECTED_REMOTE_FETCH_PATHNAME = "/rc-fetch-protected-remote";
|
|
53
|
-
var CORS_DOCS_URL = "https://vercel.com/docs/remote-components/concepts/cors-external-urls#accessing-cross-site-protected-remote-components";
|
|
54
|
-
|
|
55
|
-
// src/shared/client/protected-rc-fallback.ts
|
|
56
|
-
function generateProtectedRcFallbackSrc(url) {
|
|
57
|
-
return `${RC_PROTECTED_REMOTE_FETCH_PATHNAME}?url=${encodeURIComponent(url)}`;
|
|
58
|
-
}
|
|
59
|
-
function isProxiedUrl(url) {
|
|
60
|
-
try {
|
|
61
|
-
return new URL(url, location.href).pathname === RC_PROTECTED_REMOTE_FETCH_PATHNAME;
|
|
62
|
-
} catch {
|
|
63
|
-
return false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
// src/shared/error.ts
|
|
68
|
-
var RemoteComponentsError = class extends Error {
|
|
69
|
-
code = "REMOTE_COMPONENTS_ERROR";
|
|
70
|
-
constructor(message, options) {
|
|
71
|
-
super(message, options);
|
|
72
|
-
this.name = "RemoteComponentsError";
|
|
73
|
-
}
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
// src/shared/client/component-loader.ts
|
|
77
|
-
var React = __toESM(require("react"), 1);
|
|
78
|
-
var JSXDevRuntime = __toESM(require("react/jsx-dev-runtime"), 1);
|
|
79
|
-
var JSXRuntime = __toESM(require("react/jsx-runtime"), 1);
|
|
80
|
-
var ReactDOM = __toESM(require("react-dom"), 1);
|
|
81
|
-
var ReactDOMClient = __toESM(require("react-dom/client"), 1);
|
|
82
|
-
|
|
83
|
-
// src/shared/utils/logger.ts
|
|
84
|
-
var PREFIX = "remote-components";
|
|
85
|
-
var DEBUG = typeof window !== "undefined" && localStorage.getItem("RC_DEBUG") === "true";
|
|
86
|
-
function logDebug(location2, message) {
|
|
87
|
-
if (DEBUG) {
|
|
88
|
-
console.debug(`[${PREFIX}:${location2}]: ${message}`);
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
function logWarn(location2, message) {
|
|
92
|
-
console.warn(`[${PREFIX}:${location2}]: ${message}`);
|
|
93
|
-
}
|
|
94
|
-
function logError(location2, message, cause) {
|
|
95
|
-
console.error(
|
|
96
|
-
new RemoteComponentsError(`[${PREFIX}:${location2}]: ${message}`, {
|
|
97
|
-
cause
|
|
98
|
-
})
|
|
99
|
-
);
|
|
100
|
-
}
|
|
101
|
-
function warnCrossOriginFetchError(logLocation, url) {
|
|
102
|
-
try {
|
|
103
|
-
const parsed = typeof url === "string" ? new URL(url) : url;
|
|
104
|
-
if (typeof location === "undefined" || parsed.origin === location.origin) {
|
|
105
|
-
return;
|
|
106
|
-
}
|
|
107
|
-
logWarn(
|
|
108
|
-
logLocation,
|
|
109
|
-
`Failed to fetch cross-origin resource "${parsed.href}". If this is a protected deployment, ensure withRemoteComponentsHost middleware is configured in your host and that the remote URL is included in allowedProxyUrls. See: ${CORS_DOCS_URL}`
|
|
110
|
-
);
|
|
111
|
-
} catch {
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
// src/shared/webpack/next-client-pages-loader.ts
|
|
116
|
-
function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
117
|
-
const self = globalThis;
|
|
118
|
-
const nextCssOriginal = document.querySelector(
|
|
119
|
-
`[id="__next_css__DO_NOT_USE__"]:not([data-bundle="${bundle}"][data-route="${route}"])`
|
|
120
|
-
);
|
|
121
|
-
if (nextCssOriginal) {
|
|
122
|
-
nextCssOriginal.parentNode?.removeChild(nextCssOriginal);
|
|
123
|
-
}
|
|
124
|
-
const nextCss = document.createElement("noscript");
|
|
125
|
-
nextCss.id = "__next_css__DO_NOT_USE__";
|
|
126
|
-
nextCss.setAttribute("data-bundle", bundle);
|
|
127
|
-
nextCss.setAttribute("data-route", route);
|
|
128
|
-
const nextCssEnd = document.createElement("noscript");
|
|
129
|
-
nextCssEnd.id = "__next_css__DO_NOT_USE_END__";
|
|
130
|
-
nextCssEnd.setAttribute("data-bundle", bundle);
|
|
131
|
-
nextCssEnd.setAttribute("data-route", route);
|
|
132
|
-
document.head.appendChild(nextCssEnd);
|
|
133
|
-
document.head.appendChild(nextCss);
|
|
134
|
-
const componentLoaderChunk = Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(
|
|
135
|
-
(key) => key.includes("/webpack/loaders/next-client-pages-loader.js") && key.includes(`page=${encodeURIComponent(route)}!`)
|
|
136
|
-
) ?? Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(
|
|
137
|
-
(key) => key.includes("/next/dist/client/page-loader.js")
|
|
138
|
-
) ?? self.__remote_webpack_module_map__?.[bundle]?.[Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(
|
|
139
|
-
(key) => key.includes("/webpack/loaders/next-client-pages-loader.js") && key.includes(`page=${encodeURIComponent(route)}!`)
|
|
140
|
-
) ?? Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(
|
|
141
|
-
(key) => key.includes("/next/dist/client/page-loader.js")
|
|
142
|
-
) ?? ""] ?? -1;
|
|
143
|
-
const appLoaderChunk = Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(
|
|
144
|
-
(key) => key.includes("/webpack/loaders/next-client-pages-loader.js") && key.includes(`page=%2F_app`)
|
|
145
|
-
) ?? Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).find(
|
|
146
|
-
(key) => key.includes("/next/dist/client/page-loader.js")
|
|
147
|
-
) ?? self.__remote_webpack_module_map__?.[bundle]?.[Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(
|
|
148
|
-
(key) => key.includes("/webpack/loaders/next-client-pages-loader.js") && key.includes(`page=%2F_app`)
|
|
149
|
-
) ?? Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(
|
|
150
|
-
(key) => key.includes("/next/dist/client/page-loader.js")
|
|
151
|
-
) ?? ""] ?? -1;
|
|
152
|
-
if (!(componentLoaderChunk && appLoaderChunk)) {
|
|
153
|
-
throw new RemoteComponentsError(
|
|
154
|
-
`Next.js client pages loader not found in bundle "${bundle}".`
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
const __NEXT_P_ORIGINAL = self.__NEXT_P;
|
|
158
|
-
const selfOriginal = self;
|
|
159
|
-
delete selfOriginal.__NEXT_P;
|
|
160
|
-
self.__remote_webpack_require__?.[bundle]?.(
|
|
161
|
-
self.__remote_webpack_require__[bundle].type !== "turbopack" ? componentLoaderChunk : `[${bundle}] ${componentLoaderChunk}`
|
|
162
|
-
);
|
|
163
|
-
if (typeof appLoaderChunk === "string" || typeof appLoaderChunk === "number" && appLoaderChunk !== -1) {
|
|
164
|
-
self.__remote_webpack_require__?.[bundle]?.(
|
|
165
|
-
self.__remote_webpack_require__[bundle].type !== "turbopack" ? appLoaderChunk : `[${bundle}] ${appLoaderChunk}`
|
|
166
|
-
);
|
|
167
|
-
}
|
|
168
|
-
if (self.__NEXT_P) {
|
|
169
|
-
const [, componentLoader] = self.__NEXT_P[0] ?? [
|
|
170
|
-
void 0,
|
|
171
|
-
() => ({ default: null })
|
|
172
|
-
];
|
|
173
|
-
const [, appLoader] = self.__NEXT_P[2] ?? [
|
|
174
|
-
void 0,
|
|
175
|
-
() => ({
|
|
176
|
-
default: null
|
|
177
|
-
})
|
|
178
|
-
];
|
|
179
|
-
const { default: Component } = componentLoader();
|
|
180
|
-
const { default: App } = appLoader();
|
|
181
|
-
if (!self.__remote_next_css__) {
|
|
182
|
-
self.__remote_next_css__ = {};
|
|
183
|
-
}
|
|
184
|
-
if (!self.__remote_next_css__[bundle]) {
|
|
185
|
-
const cssRE = /\.s?css$/;
|
|
186
|
-
Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {}).filter((id) => cssRE.test(id)).forEach((id) => {
|
|
187
|
-
self.__remote_webpack_require__?.[bundle]?.(id);
|
|
188
|
-
});
|
|
189
|
-
Object.keys(self.__remote_webpack_module_map__?.[bundle] ?? {}).filter((path) => cssRE.test(path)).forEach((path) => {
|
|
190
|
-
const id = self.__remote_webpack_module_map__?.[bundle]?.[path];
|
|
191
|
-
if (id) {
|
|
192
|
-
self.__remote_webpack_require__?.[bundle]?.(id);
|
|
193
|
-
}
|
|
194
|
-
});
|
|
195
|
-
const elements = [];
|
|
196
|
-
let node = nextCss.previousSibling;
|
|
197
|
-
while (node && node !== nextCssEnd) {
|
|
198
|
-
elements.push(node);
|
|
199
|
-
node.remove();
|
|
200
|
-
node = nextCss.previousSibling;
|
|
201
|
-
}
|
|
202
|
-
self.__remote_next_css__[bundle] = elements;
|
|
203
|
-
}
|
|
204
|
-
if (styleContainer) {
|
|
205
|
-
const elements = self.__remote_next_css__[bundle];
|
|
206
|
-
elements.forEach((el) => {
|
|
207
|
-
styleContainer.appendChild(el.cloneNode(true));
|
|
208
|
-
});
|
|
209
|
-
} else {
|
|
210
|
-
const elements = self.__remote_next_css__[bundle];
|
|
211
|
-
elements.forEach((el) => {
|
|
212
|
-
document.head.appendChild(el);
|
|
213
|
-
});
|
|
214
|
-
}
|
|
215
|
-
delete self.__NEXT_P;
|
|
216
|
-
self.__NEXT_P = __NEXT_P_ORIGINAL;
|
|
217
|
-
if (nextCssOriginal) {
|
|
218
|
-
nextCssOriginal.parentNode?.appendChild(nextCssOriginal);
|
|
219
|
-
}
|
|
220
|
-
nextCss.remove();
|
|
221
|
-
nextCssEnd.remove();
|
|
222
|
-
return { Component, App };
|
|
223
|
-
}
|
|
224
|
-
return { Component: null, App: null };
|
|
225
|
-
}
|
|
226
|
-
|
|
227
|
-
// src/shared/webpack/shared-modules.ts
|
|
228
|
-
function applySharedModules(bundle, resolve) {
|
|
229
|
-
logDebug(
|
|
230
|
-
"SharedModules",
|
|
231
|
-
`applySharedModules called for bundle: "${bundle}"`
|
|
232
|
-
);
|
|
233
|
-
logDebug(
|
|
234
|
-
"SharedModules",
|
|
235
|
-
`Shared modules to resolve: ${Object.keys(resolve)}`
|
|
236
|
-
);
|
|
237
|
-
const self = globalThis;
|
|
238
|
-
if (self.__remote_webpack_require__?.[bundle]) {
|
|
239
|
-
const modulePaths = Object.keys(
|
|
240
|
-
self.__remote_webpack_module_map__?.[bundle] ?? self.__remote_webpack_require__[bundle].m ?? {}
|
|
241
|
-
);
|
|
242
|
-
logDebug(
|
|
243
|
-
"SharedModules",
|
|
244
|
-
`Available module paths in __remote_webpack_require__[${bundle}]: ${modulePaths}`
|
|
245
|
-
);
|
|
246
|
-
for (const [key, value] of Object.entries(resolve)) {
|
|
247
|
-
let ids = modulePaths.filter((p) => p === key);
|
|
248
|
-
if (ids.length === 0) {
|
|
249
|
-
ids = modulePaths.filter((p) => p.includes(key));
|
|
250
|
-
}
|
|
251
|
-
if (ids.length === 0) {
|
|
252
|
-
logDebug(
|
|
253
|
-
"SharedModules",
|
|
254
|
-
`No matching module path found for shared module "${key}"`
|
|
255
|
-
);
|
|
256
|
-
}
|
|
257
|
-
for (let id of ids) {
|
|
258
|
-
const webpackBundle = self.__remote_webpack_require__[bundle];
|
|
259
|
-
if (webpackBundle.m) {
|
|
260
|
-
if (self.__remote_webpack_module_map__?.[bundle]?.[id]) {
|
|
261
|
-
const mappedId = `${self.__remote_webpack_module_map__[bundle][id]}`;
|
|
262
|
-
logDebug(
|
|
263
|
-
"SharedModules",
|
|
264
|
-
`Mapped module id: "${id}" -> "${mappedId}"`
|
|
265
|
-
);
|
|
266
|
-
id = mappedId;
|
|
267
|
-
}
|
|
268
|
-
webpackBundle.m[id] = (module2) => {
|
|
269
|
-
module2.exports = value;
|
|
270
|
-
};
|
|
271
|
-
} else {
|
|
272
|
-
logWarn(
|
|
273
|
-
"SharedModules",
|
|
274
|
-
`webpackBundle.m is not available for bundle "${bundle}"`
|
|
275
|
-
);
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
}
|
|
279
|
-
} else {
|
|
280
|
-
logWarn("SharedModules", `No webpack require found for bundle "${bundle}"`);
|
|
281
|
-
logDebug(
|
|
282
|
-
"SharedModules",
|
|
283
|
-
`Available bundles: ${Object.keys(self.__remote_webpack_require__ ?? {})}`
|
|
284
|
-
);
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
// src/shared/client/rsc.ts
|
|
289
|
-
var import_web_streams_polyfill = require("web-streams-polyfill");
|
|
290
|
-
function fixPayload(payload) {
|
|
291
|
-
if (Array.isArray(payload)) {
|
|
292
|
-
if (payload[0] === "$") {
|
|
293
|
-
fixPayload(payload[3]);
|
|
294
|
-
if (payload.length === 4) {
|
|
295
|
-
payload.push(null, null, 1);
|
|
296
|
-
}
|
|
297
|
-
} else {
|
|
298
|
-
for (const item of payload) {
|
|
299
|
-
fixPayload(item);
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
} else if (typeof payload === "object" && payload !== null) {
|
|
303
|
-
for (const key in payload) {
|
|
304
|
-
fixPayload(payload[key]);
|
|
305
|
-
}
|
|
306
|
-
}
|
|
307
|
-
}
|
|
308
|
-
function createRSCStream(rscName, data) {
|
|
309
|
-
return new import_web_streams_polyfill.ReadableStream({
|
|
310
|
-
type: "bytes",
|
|
311
|
-
start(controller) {
|
|
312
|
-
const encoder = new TextEncoder();
|
|
313
|
-
const self = globalThis;
|
|
314
|
-
if (data.length > 0) {
|
|
315
|
-
data.forEach((chunk) => {
|
|
316
|
-
const lines = chunk.split("\n");
|
|
317
|
-
for (const line of lines) {
|
|
318
|
-
const match = /\.push\("(?<rsc>.*)"\);$/.exec(line);
|
|
319
|
-
if (match?.groups?.rsc) {
|
|
320
|
-
self[rscName] = self[rscName] ?? [];
|
|
321
|
-
self[rscName].push(JSON.parse(`"${match.groups.rsc}"`));
|
|
322
|
-
}
|
|
323
|
-
}
|
|
324
|
-
});
|
|
325
|
-
}
|
|
326
|
-
const allChunks = (self[rscName] ?? [`0:[null]
|
|
327
|
-
`]).join("");
|
|
328
|
-
self[rscName] = null;
|
|
329
|
-
allChunks.split("\n").forEach((chunk) => {
|
|
330
|
-
if (chunk.length > 0) {
|
|
331
|
-
const { before, id, prefix, payload } = /^(?<before>[^:]*?)?(?<id>[0-9a-zA-Z]+):(?<prefix>[A-Z])?(?<payload>\[.*\])/.exec(
|
|
332
|
-
chunk
|
|
333
|
-
)?.groups ?? {};
|
|
334
|
-
if (payload) {
|
|
335
|
-
const jsonPayload = JSON.parse(payload);
|
|
336
|
-
fixPayload(jsonPayload);
|
|
337
|
-
const reconstruct = `${before ?? ""}${id}:${prefix ?? ""}${JSON.stringify(jsonPayload)}`;
|
|
338
|
-
controller.enqueue(encoder.encode(`${reconstruct}
|
|
339
|
-
`));
|
|
340
|
-
} else {
|
|
341
|
-
controller.enqueue(encoder.encode(`${chunk}
|
|
342
|
-
`));
|
|
343
|
-
}
|
|
344
|
-
} else {
|
|
345
|
-
controller.enqueue(encoder.encode(`${chunk}
|
|
346
|
-
`));
|
|
347
|
-
}
|
|
348
|
-
});
|
|
349
|
-
controller.close();
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
// src/shared/client/webpack-patterns.ts
|
|
355
|
-
var NEXT_BUNDLE_PATH_RE = /\/_next\/\[.+\](?:%20| )/;
|
|
356
|
-
|
|
357
|
-
// src/shared/client/script-loader.ts
|
|
358
|
-
async function loadScripts(scripts, resolveClientUrl) {
|
|
359
|
-
await Promise.all(
|
|
360
|
-
scripts.map((script) => {
|
|
361
|
-
return new Promise((resolve, reject) => {
|
|
362
|
-
const newSrc = new URL(
|
|
363
|
-
// remove the remote component bundle name identifier from the script src
|
|
364
|
-
script.src.replace(NEXT_BUNDLE_PATH_RE, "/_next/"),
|
|
365
|
-
location.origin
|
|
366
|
-
).href;
|
|
367
|
-
const resolvedSrc = resolveClientUrl?.(newSrc) ?? newSrc;
|
|
368
|
-
const newScript = document.createElement("script");
|
|
369
|
-
newScript.onload = () => resolve();
|
|
370
|
-
newScript.onerror = () => {
|
|
371
|
-
const isProxied = isProxiedUrl(resolvedSrc);
|
|
372
|
-
if (isProxied) {
|
|
373
|
-
reject(
|
|
374
|
-
new RemoteComponentsError(
|
|
375
|
-
`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}`
|
|
376
|
-
)
|
|
377
|
-
);
|
|
378
|
-
} else {
|
|
379
|
-
warnCrossOriginFetchError("ScriptLoader", newSrc);
|
|
380
|
-
reject(
|
|
381
|
-
new RemoteComponentsError(
|
|
382
|
-
`Failed to load <script src="${newSrc}"> for Remote Component. Check the URL is correct.`
|
|
383
|
-
)
|
|
384
|
-
);
|
|
385
|
-
}
|
|
386
|
-
};
|
|
387
|
-
newScript.src = resolvedSrc;
|
|
388
|
-
newScript.async = true;
|
|
389
|
-
document.head.appendChild(newScript);
|
|
390
|
-
});
|
|
391
|
-
})
|
|
392
|
-
);
|
|
393
|
-
}
|
|
394
|
-
|
|
395
|
-
// src/shared/utils/index.ts
|
|
396
|
-
function escapeString(str) {
|
|
397
|
-
return str.replace(/[^a-z0-9]/g, "_");
|
|
398
|
-
}
|
|
399
|
-
|
|
400
|
-
// src/shared/client/const.ts
|
|
401
|
-
var DEFAULT_ROUTE = "/";
|
|
402
|
-
var RUNTIME_WEBPACK = "webpack";
|
|
403
|
-
var RUNTIME_TURBOPACK = "turbopack";
|
|
404
|
-
var RUNTIME_SCRIPT = "script";
|
|
405
|
-
var REMOTE_COMPONENT_REGEX = /(?<prefix>.*?)\[(?<bundle>[^\]]+)\](?:%20| )(?<id>.+)/;
|
|
406
|
-
function getBundleKey(bundle) {
|
|
407
|
-
return escapeString(bundle);
|
|
408
|
-
}
|
|
409
|
-
|
|
410
|
-
// src/shared/client/turbopack-patterns.ts
|
|
411
|
-
var REMOTE_SHARED_MARKER_RE = /(?:self|[a-z])\.TURBOPACK_REMOTE_SHARED/;
|
|
412
|
-
var REMOTE_SHARED_ASSIGNMENT_RE = /\.TURBOPACK_REMOTE_SHARED=await (?:__turbopack_context__|e)\.A\((?<sharedModuleId>[0-9]+)\)/;
|
|
413
|
-
var ASYNC_MODULE_LOADER_RE = /(?:__turbopack_context__|e)\.A\((?<asyncSharedModuleId>[0-9]+)\)/;
|
|
414
|
-
var ASYNC_MODULE_RESOLVE_RE = /(?<ctx>__turbopack_context__|e)=>\{\k<ctx>\.v\((?<inner>parentImport|e)=>Promise\.resolve\(\)\.then\(\(\)=>\k<inner>\((?<sharedModuleId>[0-9]+)\)\)\)\}/;
|
|
415
|
-
var 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]+)\)\)\)\}/;
|
|
416
|
-
var TURBOPACK_GLOBAL_RE = /(?:globalThis|self)\s*(?:\.TURBOPACK|\[\s*["']TURBOPACK["']\s*\])/;
|
|
417
|
-
|
|
418
|
-
// src/shared/client/chunk-loader.ts
|
|
419
|
-
function createChunkLoader(runtime, resolveClientUrl) {
|
|
420
|
-
return function __turbopack_chunk_load__(chunkId, scriptBundle) {
|
|
421
|
-
logDebug("ChunkLoader", `Loading chunk: "${chunkId}"`);
|
|
422
|
-
const self = globalThis;
|
|
423
|
-
const {
|
|
424
|
-
bundle,
|
|
425
|
-
id: path,
|
|
426
|
-
prefix
|
|
427
|
-
} = REMOTE_COMPONENT_REGEX.exec(chunkId)?.groups ?? {
|
|
428
|
-
bundle: scriptBundle ?? "",
|
|
429
|
-
id: chunkId
|
|
430
|
-
};
|
|
431
|
-
logDebug(
|
|
432
|
-
"ChunkLoader",
|
|
433
|
-
`Parsed chunk - bundle: "${bundle}", path: "${path}", prefix: "${prefix}"`
|
|
434
|
-
);
|
|
435
|
-
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
436
|
-
logDebug("ChunkLoader", `Remote runtime: "${remoteRuntime}"`);
|
|
437
|
-
if (remoteRuntime === RUNTIME_WEBPACK) {
|
|
438
|
-
logDebug("ChunkLoader", "Skipping chunk load - webpack runtime detected");
|
|
439
|
-
return Promise.resolve(void 0);
|
|
440
|
-
}
|
|
441
|
-
const url = new URL(
|
|
442
|
-
path ? `${prefix ?? ""}${path}`.replace(
|
|
443
|
-
/(?<char>[^:])(?<double>\/\/)/g,
|
|
444
|
-
"$1/"
|
|
445
|
-
) : "/",
|
|
446
|
-
self.__remote_bundle_url__?.[bundle ?? "default"] ?? new URL(location.origin)
|
|
447
|
-
).href;
|
|
448
|
-
if (url.endsWith(".css")) {
|
|
449
|
-
logDebug("ChunkLoader", `Skipping CSS file: "${url}"`);
|
|
450
|
-
return;
|
|
451
|
-
}
|
|
452
|
-
if (!self.__remote_components_turbopack_chunk_loader_promise__) {
|
|
453
|
-
self.__remote_components_turbopack_chunk_loader_promise__ = {};
|
|
454
|
-
}
|
|
455
|
-
if (self.__remote_components_turbopack_chunk_loader_promise__[url]) {
|
|
456
|
-
logDebug("ChunkLoader", `Returning cached promise for: "${url}"`);
|
|
457
|
-
return self.__remote_components_turbopack_chunk_loader_promise__[url];
|
|
458
|
-
}
|
|
459
|
-
const resolvedUrl = resolveClientUrl?.(url) ?? url;
|
|
460
|
-
logDebug("ChunkLoader", `Fetching chunk from: "${resolvedUrl}"`);
|
|
461
|
-
self.__remote_components_turbopack_chunk_loader_promise__[url] = new Promise((resolve, reject) => {
|
|
462
|
-
fetch(resolvedUrl).then((res) => res.text()).then((code) => {
|
|
463
|
-
const hasTurbopack = TURBOPACK_GLOBAL_RE.test(code);
|
|
464
|
-
if (hasTurbopack) {
|
|
465
|
-
return handleTurbopackChunk(code, bundle ?? "", url);
|
|
466
|
-
}
|
|
467
|
-
logDebug(
|
|
468
|
-
"ChunkLoader",
|
|
469
|
-
`Chunk does not contain globalThis.TURBOPACK or self.TURBOPACK: "${url}"`
|
|
470
|
-
);
|
|
471
|
-
logDebug(
|
|
472
|
-
"ChunkLoader",
|
|
473
|
-
`First 500 chars of chunk: ${code.slice(0, 500)}`
|
|
474
|
-
);
|
|
475
|
-
}).then(resolve).catch((error) => {
|
|
476
|
-
const isProxied = isProxiedUrl(resolvedUrl);
|
|
477
|
-
if (isProxied) {
|
|
478
|
-
reject(
|
|
479
|
-
new RemoteComponentsError(
|
|
480
|
-
`Failed to load chunk "${url}" via proxy "${resolvedUrl}". Ensure withRemoteComponentsHost middleware is configured and "${RC_PROTECTED_REMOTE_FETCH_PATHNAME}" is in the matcher. See: ${CORS_DOCS_URL}`
|
|
481
|
-
)
|
|
482
|
-
);
|
|
483
|
-
} else {
|
|
484
|
-
warnCrossOriginFetchError("ChunkLoader", url);
|
|
485
|
-
reject(error);
|
|
486
|
-
}
|
|
487
|
-
});
|
|
488
|
-
});
|
|
489
|
-
return self.__remote_components_turbopack_chunk_loader_promise__[url];
|
|
490
|
-
};
|
|
491
|
-
}
|
|
492
|
-
async function handleTurbopackChunk(code, bundle, url) {
|
|
493
|
-
logDebug(
|
|
494
|
-
"ChunkLoader",
|
|
495
|
-
`Handling Turbopack chunk - bundle: "${bundle}", url: "${url}"`
|
|
496
|
-
);
|
|
497
|
-
if (/importScripts\(\.\.\.self.TURBOPACK_NEXT_CHUNK_URLS/.test(code)) {
|
|
498
|
-
logDebug("ChunkLoader", `Skipping worker chunk: "${url}"`);
|
|
499
|
-
const preloadLinks = document.querySelectorAll(
|
|
500
|
-
`link[rel="preload"][href="${new URL(url).pathname}"]`
|
|
501
|
-
);
|
|
502
|
-
preloadLinks.forEach((preloadLink) => preloadLink.remove());
|
|
503
|
-
return;
|
|
504
|
-
}
|
|
505
|
-
const self = globalThis;
|
|
506
|
-
const bundleKey = getBundleKey(bundle);
|
|
507
|
-
logDebug("ChunkLoader", `Bundle key: "${bundleKey}"`);
|
|
508
|
-
const transformedCode = code.replace(
|
|
509
|
-
/globalThis\[\s*["']TURBOPACK["']\s*\]/g,
|
|
510
|
-
`globalThis["TURBOPACK_${bundleKey}"]`
|
|
511
|
-
).replace(
|
|
512
|
-
/self\[\s*["']TURBOPACK["']\s*\]/g,
|
|
513
|
-
`self["TURBOPACK_${bundleKey}"]`
|
|
514
|
-
).replace(/globalThis\.TURBOPACK/g, `globalThis.TURBOPACK_${bundleKey}`).replace(/self\.TURBOPACK(?!_)/g, `self.TURBOPACK_${bundleKey}`).replace(
|
|
515
|
-
/TURBOPACK_WORKER_LOCATION/g,
|
|
516
|
-
`TURBOPACK_WORKER_LOCATION_${bundleKey}`
|
|
517
|
-
).replace(
|
|
518
|
-
/TURBOPACK_NEXT_CHUNK_URLS/g,
|
|
519
|
-
`TURBOPACK_NEXT_CHUNK_URLS_${bundleKey}`
|
|
520
|
-
).replace(
|
|
521
|
-
/TURBOPACK_CHUNK_UPDATE_LISTENERS/g,
|
|
522
|
-
`TURBOPACK_CHUNK_UPDATE_LISTENERS_${bundleKey}`
|
|
523
|
-
).replace(/__next_require__/g, `__${bundleKey}_next_require__`).replace(
|
|
524
|
-
/\/\/# sourceMappingURL=(?<name>.+)(?<optional>\._)?\.js\.map/g,
|
|
525
|
-
`//# sourceMappingURL=${new URL(
|
|
526
|
-
".",
|
|
527
|
-
new URL(
|
|
528
|
-
url,
|
|
529
|
-
self.__remote_bundle_url__?.[bundle] ?? new URL(location.origin)
|
|
530
|
-
)
|
|
531
|
-
).href}$1$2.js.map`
|
|
532
|
-
);
|
|
533
|
-
if (!self[`TURBOPACK_${bundleKey}`]) {
|
|
534
|
-
const chunkData = [];
|
|
535
|
-
const turbopackObject = {
|
|
536
|
-
push: (item) => {
|
|
537
|
-
logDebug(
|
|
538
|
-
"ChunkLoader",
|
|
539
|
-
`TURBOPACK_${bundleKey}.push() called with item type: ${Array.isArray(item) ? "array" : typeof item}`
|
|
540
|
-
);
|
|
541
|
-
if (Array.isArray(item)) {
|
|
542
|
-
chunkData.push(item);
|
|
543
|
-
logDebug(
|
|
544
|
-
"ChunkLoader",
|
|
545
|
-
`TURBOPACK_${bundleKey} now has ${chunkData.length} chunks`
|
|
546
|
-
);
|
|
547
|
-
} else {
|
|
548
|
-
chunkData.push([item]);
|
|
549
|
-
}
|
|
550
|
-
return chunkData.length;
|
|
551
|
-
},
|
|
552
|
-
// Store chunks for later access
|
|
553
|
-
__chunks__: chunkData
|
|
554
|
-
};
|
|
555
|
-
self[`TURBOPACK_${bundleKey}`] = turbopackObject;
|
|
556
|
-
}
|
|
557
|
-
logDebug("ChunkLoader", `Creating blob script for: "${url}"`);
|
|
558
|
-
await new Promise((scriptResolve, scriptReject) => {
|
|
559
|
-
const blob = new Blob([transformedCode], {
|
|
560
|
-
type: "application/javascript; charset=UTF-8"
|
|
561
|
-
});
|
|
562
|
-
const scriptUrl = URL.createObjectURL(blob);
|
|
563
|
-
const script = document.createElement("script");
|
|
564
|
-
script.setAttribute("data-turbopack-src", url);
|
|
565
|
-
script.src = scriptUrl;
|
|
566
|
-
script.async = true;
|
|
567
|
-
script.onload = () => {
|
|
568
|
-
URL.revokeObjectURL(scriptUrl);
|
|
569
|
-
logDebug(
|
|
570
|
-
"ChunkLoader",
|
|
571
|
-
`Script loaded successfully for bundle "${bundle}"`
|
|
572
|
-
);
|
|
573
|
-
const turbopackBundle = self[`TURBOPACK_${bundleKey}`];
|
|
574
|
-
logDebug(
|
|
575
|
-
"ChunkLoader",
|
|
576
|
-
`TURBOPACK_${bundleKey} type: ${typeof turbopackBundle}, isArray: ${Array.isArray(turbopackBundle)}, keys: ${turbopackBundle ? Object.keys(turbopackBundle).slice(0, 10).join(", ") : "none"}`
|
|
577
|
-
);
|
|
578
|
-
if (turbopackBundle && typeof turbopackBundle === "object") {
|
|
579
|
-
logDebug(
|
|
580
|
-
"ChunkLoader",
|
|
581
|
-
`TURBOPACK_${bundleKey} length/size: ${Array.isArray(turbopackBundle) ? turbopackBundle.length : Object.keys(turbopackBundle).length}`
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
scriptResolve(void 0);
|
|
585
|
-
script.remove();
|
|
586
|
-
};
|
|
587
|
-
script.onerror = () => {
|
|
588
|
-
URL.revokeObjectURL(scriptUrl);
|
|
589
|
-
scriptReject(
|
|
590
|
-
new RemoteComponentsError(
|
|
591
|
-
`Failed to load <script src="${script.src}"> for Remote Component. Check the URL is correct.`
|
|
592
|
-
)
|
|
593
|
-
);
|
|
594
|
-
script.remove();
|
|
595
|
-
};
|
|
596
|
-
document.head.appendChild(script);
|
|
597
|
-
});
|
|
598
|
-
const chunkLists = self[`TURBOPACK_${bundleKey}_CHUNK_LISTS`];
|
|
599
|
-
logDebug(
|
|
600
|
-
"ChunkLoader",
|
|
601
|
-
`Processing chunk lists for bundle "${bundle}": ${chunkLists?.length ?? 0} lists`
|
|
602
|
-
);
|
|
603
|
-
const loadChunkLists = [];
|
|
604
|
-
while (chunkLists?.length) {
|
|
605
|
-
const { chunks } = chunkLists.shift() ?? { chunks: [] };
|
|
606
|
-
if (chunks.length > 0) {
|
|
607
|
-
logDebug(
|
|
608
|
-
"ChunkLoader",
|
|
609
|
-
`Loading ${chunks.length} additional chunks for bundle "${bundle}": [${chunks.join(", ")}]`
|
|
610
|
-
);
|
|
611
|
-
chunks.forEach((id) => {
|
|
612
|
-
const chunkLoadResult = self.__webpack_chunk_load__?.(
|
|
613
|
-
`[${bundle}] ${url.slice(0, url.indexOf("/_next"))}/_next/${id}`
|
|
614
|
-
);
|
|
615
|
-
if (chunkLoadResult) {
|
|
616
|
-
loadChunkLists.push(chunkLoadResult);
|
|
617
|
-
}
|
|
618
|
-
});
|
|
619
|
-
}
|
|
620
|
-
}
|
|
621
|
-
if (loadChunkLists.length > 0) {
|
|
622
|
-
logDebug(
|
|
623
|
-
"ChunkLoader",
|
|
624
|
-
`Waiting for ${loadChunkLists.length} additional chunks to load`
|
|
625
|
-
);
|
|
626
|
-
await Promise.all(loadChunkLists);
|
|
627
|
-
}
|
|
628
|
-
}
|
|
629
|
-
|
|
630
|
-
// src/shared/client/turbopack-module.ts
|
|
631
|
-
function handleTurbopackModule(bundle, moduleId, id) {
|
|
632
|
-
const self = globalThis;
|
|
633
|
-
const bundleKey = getBundleKey(bundle);
|
|
634
|
-
const raw = self[`TURBOPACK_${bundleKey}`];
|
|
635
|
-
let modules;
|
|
636
|
-
if (raw && typeof raw === "object" && "__chunks__" in raw) {
|
|
637
|
-
modules = raw.__chunks__.flat();
|
|
638
|
-
} else if (Array.isArray(raw)) {
|
|
639
|
-
modules = raw.flat();
|
|
640
|
-
} else {
|
|
641
|
-
modules = raw;
|
|
642
|
-
}
|
|
643
|
-
if (!self.__remote_components_turbopack_modules__) {
|
|
644
|
-
self.__remote_components_turbopack_modules__ = {};
|
|
645
|
-
}
|
|
646
|
-
if (!self.__remote_components_turbopack_modules__[bundle]) {
|
|
647
|
-
self.__remote_components_turbopack_modules__[bundle] = {};
|
|
648
|
-
}
|
|
649
|
-
if (self.__remote_components_turbopack_modules__[bundle][moduleId]) {
|
|
650
|
-
return self.__remote_components_turbopack_modules__[bundle][moduleId];
|
|
651
|
-
}
|
|
652
|
-
if (!modules) {
|
|
653
|
-
logError("TurbopackModule", `TURBOPACK_${bundleKey} is undefined`);
|
|
654
|
-
}
|
|
655
|
-
const moduleInit = findModuleInit(modules, moduleId);
|
|
656
|
-
const exports = {};
|
|
657
|
-
const moduleExports = { exports };
|
|
658
|
-
if (typeof moduleInit !== "function") {
|
|
659
|
-
throw new Error(
|
|
660
|
-
`Module ${id} not found in bundle ${bundle} with id ${moduleId}`
|
|
661
|
-
);
|
|
662
|
-
}
|
|
663
|
-
self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
|
|
664
|
-
if (!self.__remote_components_turbopack_global__) {
|
|
665
|
-
self.__remote_components_turbopack_global__ = {};
|
|
666
|
-
}
|
|
667
|
-
if (!self.__remote_components_turbopack_global__[bundle]) {
|
|
668
|
-
self.__remote_components_turbopack_global__[bundle] = {};
|
|
669
|
-
}
|
|
670
|
-
moduleInit(
|
|
671
|
-
createTurbopackContext(
|
|
672
|
-
bundle,
|
|
673
|
-
exports,
|
|
674
|
-
moduleExports,
|
|
675
|
-
modules,
|
|
676
|
-
moduleInit,
|
|
677
|
-
id,
|
|
678
|
-
self
|
|
679
|
-
),
|
|
680
|
-
moduleExports,
|
|
681
|
-
exports
|
|
682
|
-
);
|
|
683
|
-
if (self.__remote_components_turbopack_modules__[bundle][moduleId] !== moduleExports.exports) {
|
|
684
|
-
self.__remote_components_turbopack_modules__[bundle][moduleId] = moduleExports.exports;
|
|
685
|
-
}
|
|
686
|
-
return moduleExports.exports;
|
|
687
|
-
}
|
|
688
|
-
function findModuleInit(modules, moduleId) {
|
|
689
|
-
if (!modules || typeof modules !== "object")
|
|
690
|
-
return;
|
|
691
|
-
if (!Array.isArray(modules)) {
|
|
692
|
-
const key = moduleId in modules ? moduleId : Object.keys(modules).find((k) => k.startsWith(moduleId));
|
|
693
|
-
return key !== void 0 ? modules[key] : void 0;
|
|
694
|
-
}
|
|
695
|
-
const flat = modules.flat();
|
|
696
|
-
let idx = flat.findIndex((e) => String(e) === String(moduleId));
|
|
697
|
-
if (idx < 0) {
|
|
698
|
-
idx = flat.findIndex(
|
|
699
|
-
(e) => typeof e === "string" && e.startsWith(moduleId)
|
|
700
|
-
);
|
|
701
|
-
}
|
|
702
|
-
if (idx >= 0) {
|
|
703
|
-
return flat.slice(idx + 1).find((e) => typeof e === "function");
|
|
704
|
-
}
|
|
705
|
-
return flat.find(
|
|
706
|
-
(e) => Boolean(e && typeof e === "object" && moduleId in e)
|
|
707
|
-
)?.[moduleId];
|
|
708
|
-
}
|
|
709
|
-
function createTurbopackContext(bundle, exports, moduleExports, modules, moduleInit, id, self) {
|
|
710
|
-
return {
|
|
711
|
-
// HMR not implemented for Remote Components
|
|
712
|
-
k: {
|
|
713
|
-
register() {
|
|
714
|
-
},
|
|
715
|
-
registerExports() {
|
|
716
|
-
},
|
|
717
|
-
signature() {
|
|
718
|
-
return (fn) => fn;
|
|
719
|
-
}
|
|
720
|
-
},
|
|
721
|
-
// ESM exports setup
|
|
722
|
-
s(bindings, esmId) {
|
|
723
|
-
let mod = exports;
|
|
724
|
-
if (typeof esmId === "string" || typeof esmId === "number") {
|
|
725
|
-
if (!self.__remote_components_turbopack_modules__) {
|
|
726
|
-
self.__remote_components_turbopack_modules__ = {};
|
|
727
|
-
}
|
|
728
|
-
if (!self.__remote_components_turbopack_modules__[bundle]) {
|
|
729
|
-
self.__remote_components_turbopack_modules__[bundle] = {};
|
|
730
|
-
}
|
|
731
|
-
if (!self.__remote_components_turbopack_modules__[bundle][esmId]) {
|
|
732
|
-
self.__remote_components_turbopack_modules__[bundle][esmId] = {};
|
|
733
|
-
}
|
|
734
|
-
mod = self.__remote_components_turbopack_modules__[bundle][esmId];
|
|
735
|
-
}
|
|
736
|
-
Object.defineProperty(mod, "__esModule", { value: true });
|
|
737
|
-
if (Array.isArray(bindings)) {
|
|
738
|
-
let i = 0;
|
|
739
|
-
while (i < bindings.length) {
|
|
740
|
-
const propName = bindings[i++];
|
|
741
|
-
const tagOrFunc = bindings[i++];
|
|
742
|
-
if (typeof tagOrFunc === "number") {
|
|
743
|
-
Object.defineProperty(mod, propName, {
|
|
744
|
-
value: bindings[i++],
|
|
745
|
-
enumerable: true,
|
|
746
|
-
writable: false
|
|
747
|
-
});
|
|
748
|
-
} else {
|
|
749
|
-
const getterFn = tagOrFunc;
|
|
750
|
-
if (typeof bindings[i] === "function") {
|
|
751
|
-
const setterFn = bindings[i++];
|
|
752
|
-
Object.defineProperty(mod, propName, {
|
|
753
|
-
get: getterFn,
|
|
754
|
-
set: setterFn,
|
|
755
|
-
enumerable: true
|
|
756
|
-
});
|
|
757
|
-
} else {
|
|
758
|
-
Object.defineProperty(mod, propName, {
|
|
759
|
-
get: getterFn,
|
|
760
|
-
enumerable: true
|
|
761
|
-
});
|
|
762
|
-
}
|
|
763
|
-
}
|
|
764
|
-
}
|
|
765
|
-
}
|
|
766
|
-
},
|
|
767
|
-
// import
|
|
768
|
-
i(importId) {
|
|
769
|
-
let mod;
|
|
770
|
-
if (typeof importId === "string") {
|
|
771
|
-
const { exportSource, exportName } = /\s+<export (?<exportSource>.*?) as (?<exportName>.*?)>$/.exec(
|
|
772
|
-
importId
|
|
773
|
-
)?.groups ?? {};
|
|
774
|
-
const normalizedId = importId.replace(
|
|
775
|
-
/\s+<export(?<specifier>.*)>$/,
|
|
776
|
-
""
|
|
777
|
-
);
|
|
778
|
-
mod = self.__webpack_require__?.(`[${bundle}] ${normalizedId}`);
|
|
779
|
-
if (mod && exportSource && exportName && (exportSource === "*" || typeof mod[exportSource] !== "undefined") && typeof mod[exportName] === "undefined") {
|
|
780
|
-
if (exportSource === "*") {
|
|
781
|
-
mod[exportName] = mod;
|
|
782
|
-
} else {
|
|
783
|
-
mod[exportName] = mod[exportSource];
|
|
784
|
-
}
|
|
785
|
-
}
|
|
786
|
-
} else {
|
|
787
|
-
mod = self.__webpack_require__?.(`[${bundle}] ${importId}`);
|
|
788
|
-
}
|
|
789
|
-
if (typeof mod !== "object" || mod === null) {
|
|
790
|
-
mod = { default: mod };
|
|
791
|
-
} else if (!("default" in mod) && mod.toString() !== "[object Module]") {
|
|
792
|
-
try {
|
|
793
|
-
mod.default = mod;
|
|
794
|
-
} catch {
|
|
795
|
-
}
|
|
796
|
-
}
|
|
797
|
-
return mod;
|
|
798
|
-
},
|
|
799
|
-
// require
|
|
800
|
-
r(requireId) {
|
|
801
|
-
return self.__webpack_require__?.(`[${bundle}] ${requireId}`);
|
|
802
|
-
},
|
|
803
|
-
// value exports
|
|
804
|
-
v(value) {
|
|
805
|
-
if (typeof value === "function") {
|
|
806
|
-
exports.default = value((vid) => {
|
|
807
|
-
return self.__webpack_require__?.(`[${bundle}] ${vid}`);
|
|
808
|
-
});
|
|
809
|
-
} else {
|
|
810
|
-
moduleExports.exports = value;
|
|
811
|
-
}
|
|
812
|
-
},
|
|
813
|
-
// async module initializer
|
|
814
|
-
async a(mod) {
|
|
815
|
-
let result;
|
|
816
|
-
await mod(
|
|
817
|
-
() => {
|
|
818
|
-
},
|
|
819
|
-
(value) => result = value
|
|
820
|
-
);
|
|
821
|
-
exports.default = result;
|
|
822
|
-
},
|
|
823
|
-
// async module loader
|
|
824
|
-
async A(Aid) {
|
|
825
|
-
const mod = self.__webpack_require__?.(`[${bundle}] ${Aid}`);
|
|
826
|
-
return mod.default(
|
|
827
|
-
(parentId) => self.__webpack_require__?.(`[${bundle}] ${parentId}`)
|
|
828
|
-
);
|
|
829
|
-
},
|
|
830
|
-
// dynamic import tracking — no-op for remote components
|
|
831
|
-
j() {
|
|
832
|
-
},
|
|
833
|
-
// chunk loader
|
|
834
|
-
l(url) {
|
|
835
|
-
const flatModules = Array.isArray(modules) ? modules : [];
|
|
836
|
-
const moduleInitIndex = flatModules.indexOf(moduleInit);
|
|
837
|
-
if (moduleInitIndex !== -1) {
|
|
838
|
-
const scriptIndex = flatModules.slice(0, moduleInitIndex).findLastIndex((bundleEntry) => bundleEntry instanceof Element);
|
|
839
|
-
if (scriptIndex !== -1) {
|
|
840
|
-
const script = flatModules[scriptIndex];
|
|
841
|
-
const scriptSrc = script.getAttribute("data-turbopack-src") || "";
|
|
842
|
-
const nextIndex = scriptSrc.indexOf("/_next");
|
|
843
|
-
const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : "";
|
|
844
|
-
const bundleUrl = `[${bundle}] ${baseUrl}/_next/${url}`;
|
|
845
|
-
return self.__webpack_chunk_load__?.(bundleUrl, bundle);
|
|
846
|
-
}
|
|
847
|
-
}
|
|
848
|
-
throw new Error(
|
|
849
|
-
`Failed to load Turbopack chunk "${url}" for module "${id}". Check the URL is correct.`
|
|
850
|
-
);
|
|
851
|
-
},
|
|
852
|
-
// global object for this bundle
|
|
853
|
-
g: self.__remote_components_turbopack_global__?.[bundle],
|
|
854
|
-
m: moduleExports,
|
|
855
|
-
e: exports
|
|
856
|
-
};
|
|
857
|
-
}
|
|
858
|
-
|
|
859
|
-
// src/shared/client/shared-modules.ts
|
|
860
|
-
async function initializeSharedModules(bundle, hostShared = {}, remoteShared = {}) {
|
|
861
|
-
const self = globalThis;
|
|
862
|
-
self.__remote_shared_modules__ = self.__remote_shared_modules__ ?? {};
|
|
863
|
-
if (!self.__remote_shared_modules__[bundle]) {
|
|
864
|
-
self.__remote_shared_modules__[bundle] = {};
|
|
865
|
-
}
|
|
866
|
-
const bundleKey = getBundleKey(bundle);
|
|
867
|
-
let modules = self[`TURBOPACK_${bundleKey}`];
|
|
868
|
-
if (modules && typeof modules === "object" && "__chunks__" in modules) {
|
|
869
|
-
const chunks = modules.__chunks__;
|
|
870
|
-
modules = chunks.flat();
|
|
871
|
-
}
|
|
872
|
-
let sharedModuleInitializer = null;
|
|
873
|
-
if (modules) {
|
|
874
|
-
const allModules = Array.isArray(modules) ? modules.flat() : Object.entries(modules).flat();
|
|
875
|
-
const sharedModuleInitializerIndex = allModules.findIndex((idOrFunc) => {
|
|
876
|
-
if (typeof idOrFunc !== "function") {
|
|
877
|
-
return false;
|
|
878
|
-
}
|
|
879
|
-
const funcCode = idOrFunc.toString();
|
|
880
|
-
return REMOTE_SHARED_MARKER_RE.test(funcCode);
|
|
881
|
-
});
|
|
882
|
-
if (sharedModuleInitializerIndex > 0) {
|
|
883
|
-
const sharedModuleInitializerCode = allModules[sharedModuleInitializerIndex].toString();
|
|
884
|
-
const sharedModuleInitializerId = allModules[sharedModuleInitializerIndex - 1];
|
|
885
|
-
const { sharedModuleId } = REMOTE_SHARED_ASSIGNMENT_RE.exec(sharedModuleInitializerCode)?.groups ?? {};
|
|
886
|
-
if (sharedModuleId) {
|
|
887
|
-
const { default: sharedModuleInitializerInstance } = handleTurbopackModule(
|
|
888
|
-
bundle,
|
|
889
|
-
sharedModuleId,
|
|
890
|
-
`[${bundle}] ${sharedModuleInitializerId}`
|
|
891
|
-
);
|
|
892
|
-
sharedModuleInitializer = sharedModuleInitializerInstance;
|
|
893
|
-
}
|
|
894
|
-
}
|
|
895
|
-
if (sharedModuleInitializer) {
|
|
896
|
-
const { shared } = await sharedModuleInitializer;
|
|
897
|
-
const sharedModuleIds = extractSharedModuleIds(
|
|
898
|
-
shared,
|
|
899
|
-
bundleKey,
|
|
900
|
-
self
|
|
901
|
-
);
|
|
902
|
-
return Promise.all(
|
|
903
|
-
Object.entries(sharedModuleIds).map(async ([id, module2]) => {
|
|
904
|
-
if (self.__remote_shared_modules__?.[bundle]) {
|
|
905
|
-
if (hostShared[module2]) {
|
|
906
|
-
self.__remote_shared_modules__[bundle][id] = await hostShared[module2](bundle);
|
|
907
|
-
} else {
|
|
908
|
-
logError(
|
|
909
|
-
"SharedModules",
|
|
910
|
-
`Host shared module "${module2}" not found for ID ${id}`
|
|
911
|
-
);
|
|
912
|
-
}
|
|
913
|
-
}
|
|
914
|
-
})
|
|
915
|
-
);
|
|
916
|
-
}
|
|
917
|
-
}
|
|
918
|
-
return Promise.all(
|
|
919
|
-
Object.entries(remoteShared).map(async ([id, module2]) => {
|
|
920
|
-
if (self.__remote_shared_modules__?.[bundle]) {
|
|
921
|
-
if (hostShared[module2]) {
|
|
922
|
-
const normalizedId = id.replace("[app-ssr]", "[app-client]");
|
|
923
|
-
self.__remote_shared_modules__[bundle][normalizedId] = await hostShared[module2](bundle);
|
|
924
|
-
} else {
|
|
925
|
-
logError(
|
|
926
|
-
"SharedModules",
|
|
927
|
-
`Shared module "${module2}" not found for "${bundle}"`
|
|
928
|
-
);
|
|
929
|
-
}
|
|
930
|
-
}
|
|
931
|
-
})
|
|
932
|
-
);
|
|
933
|
-
}
|
|
934
|
-
function extractSharedModuleIds(shared, bundleKey, self) {
|
|
935
|
-
return Object.entries(shared).filter(([, value]) => typeof value === "function").reduce((acc, [key, value]) => {
|
|
936
|
-
const { asyncSharedModuleId } = ASYNC_MODULE_LOADER_RE.exec(value.toString())?.groups ?? {};
|
|
937
|
-
if (asyncSharedModuleId) {
|
|
938
|
-
const asyncSharedModuleIdNumber = Number(asyncSharedModuleId);
|
|
939
|
-
let asyncSharedModule;
|
|
940
|
-
let turbopackModules = self[`TURBOPACK_${bundleKey}`];
|
|
941
|
-
if (turbopackModules && typeof turbopackModules === "object" && "__chunks__" in turbopackModules) {
|
|
942
|
-
const chunks = turbopackModules.__chunks__;
|
|
943
|
-
turbopackModules = chunks.flat();
|
|
944
|
-
}
|
|
945
|
-
const newAllModules = Array.isArray(turbopackModules) ? turbopackModules.flat() : turbopackModules ? Object.entries(turbopackModules).flatMap(([key2, value2]) => [
|
|
946
|
-
key2,
|
|
947
|
-
value2
|
|
948
|
-
]) : [];
|
|
949
|
-
const asyncSharedModuleIdIndex = newAllModules.indexOf(
|
|
950
|
-
asyncSharedModuleIdNumber
|
|
951
|
-
);
|
|
952
|
-
if (asyncSharedModuleIdIndex !== -1 && typeof newAllModules[asyncSharedModuleIdIndex + 1] === "function") {
|
|
953
|
-
asyncSharedModule = newAllModules[asyncSharedModuleIdIndex + 1];
|
|
954
|
-
}
|
|
955
|
-
if (asyncSharedModule) {
|
|
956
|
-
const asyncSharedModuleCode = asyncSharedModule.toString();
|
|
957
|
-
const { sharedModuleId } = ASYNC_MODULE_RESOLVE_RE.exec(asyncSharedModuleCode)?.groups ?? ASYNC_MODULE_ALL_RE.exec(asyncSharedModuleCode)?.groups ?? {};
|
|
958
|
-
acc[sharedModuleId ?? asyncSharedModuleId] = key.replace(
|
|
959
|
-
"__remote_shared_module_",
|
|
960
|
-
""
|
|
961
|
-
);
|
|
962
|
-
}
|
|
963
|
-
}
|
|
964
|
-
return acc;
|
|
965
|
-
}, {});
|
|
966
|
-
}
|
|
967
|
-
function getSharedModule(bundle, id) {
|
|
968
|
-
const self = globalThis;
|
|
969
|
-
for (const [key, value] of Object.entries(
|
|
970
|
-
self.__remote_shared_modules__?.[bundle] ?? {}
|
|
971
|
-
)) {
|
|
972
|
-
if (typeof value !== "undefined" && (typeof id === "string" && id.includes(key) || id === key)) {
|
|
973
|
-
return value;
|
|
974
|
-
}
|
|
975
|
-
}
|
|
976
|
-
return null;
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
// src/shared/client/webpack-adapter.ts
|
|
980
|
-
async function setupWebpackRuntime(runtime, scripts = [], url = new URL(location.href), bundle, shared = {}, remoteShared = {}, resolveClientUrl) {
|
|
981
|
-
const self = globalThis;
|
|
982
|
-
if (!self.__remote_bundle_url__) {
|
|
983
|
-
self.__remote_bundle_url__ = {};
|
|
984
|
-
}
|
|
985
|
-
self.__remote_bundle_url__[bundle ?? "default"] = url;
|
|
986
|
-
self.__webpack_get_script_filename__ = () => null;
|
|
987
|
-
if (typeof self.__webpack_require__ !== "function" || self.__webpack_require_type__ !== "turbopack") {
|
|
988
|
-
if (!self.__original_webpack_require__ && !self.__original_webpack_chunk_load__) {
|
|
989
|
-
self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
|
|
990
|
-
self.__original_webpack_require__ = self.__webpack_require__;
|
|
991
|
-
}
|
|
992
|
-
self.__webpack_chunk_load__ = createChunkLoader(runtime, resolveClientUrl);
|
|
993
|
-
self.__webpack_require__ = createModuleRequire(runtime);
|
|
994
|
-
self.__webpack_require_type__ = runtime;
|
|
995
|
-
if (self.__remote_webpack_require__ && runtime === RUNTIME_TURBOPACK) {
|
|
996
|
-
const remoteBundle = bundle ?? "default";
|
|
997
|
-
self.__remote_webpack_require__[remoteBundle] = self.__webpack_require__;
|
|
998
|
-
self.__remote_webpack_require__[remoteBundle].type = "turbopack";
|
|
999
|
-
}
|
|
1000
|
-
}
|
|
1001
|
-
if (runtime === RUNTIME_TURBOPACK) {
|
|
1002
|
-
await Promise.all(
|
|
1003
|
-
scripts.map((script) => {
|
|
1004
|
-
if (script.src) {
|
|
1005
|
-
return self.__webpack_chunk_load__?.(script.src, bundle);
|
|
1006
|
-
}
|
|
1007
|
-
return Promise.resolve(void 0);
|
|
1008
|
-
})
|
|
1009
|
-
);
|
|
1010
|
-
}
|
|
1011
|
-
const coreShared = {
|
|
1012
|
-
react: async () => (await import("react")).default,
|
|
1013
|
-
"react-dom": async () => (await import("react-dom")).default,
|
|
1014
|
-
"react/jsx-dev-runtime": async () => (await import("react/jsx-dev-runtime")).default,
|
|
1015
|
-
"react/jsx-runtime": async () => (await import("react/jsx-runtime")).default,
|
|
1016
|
-
"react-dom/client": async () => (await import("react-dom/client")).default,
|
|
1017
|
-
...shared
|
|
1018
|
-
};
|
|
1019
|
-
await initializeSharedModules(
|
|
1020
|
-
bundle ?? "default",
|
|
1021
|
-
// include all core modules as shared
|
|
1022
|
-
coreShared,
|
|
1023
|
-
remoteShared
|
|
1024
|
-
);
|
|
1025
|
-
}
|
|
1026
|
-
function createModuleRequire(runtime) {
|
|
1027
|
-
return (id) => {
|
|
1028
|
-
const self = globalThis;
|
|
1029
|
-
const { bundle, id: moduleId } = id.match(REMOTE_COMPONENT_REGEX)?.groups ?? {
|
|
1030
|
-
bundle: "default",
|
|
1031
|
-
id
|
|
1032
|
-
};
|
|
1033
|
-
const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? "default"] ? self.__remote_webpack_require__[bundle ?? "default"]?.type || "webpack" : runtime;
|
|
1034
|
-
logDebug("WebpackAdapter", `remoteRuntime: "${remoteRuntime}"`);
|
|
1035
|
-
try {
|
|
1036
|
-
if (remoteRuntime === RUNTIME_WEBPACK && bundle && moduleId) {
|
|
1037
|
-
return self.__remote_webpack_require__?.[bundle]?.(moduleId);
|
|
1038
|
-
}
|
|
1039
|
-
const sharedModuleId = moduleId ?? id;
|
|
1040
|
-
const sharedModule = getSharedModule(bundle ?? "default", sharedModuleId);
|
|
1041
|
-
if (sharedModule) {
|
|
1042
|
-
return sharedModule;
|
|
1043
|
-
}
|
|
1044
|
-
if (bundle && moduleId) {
|
|
1045
|
-
return handleTurbopackModule(bundle, moduleId, id);
|
|
1046
|
-
}
|
|
1047
|
-
throw new Error(`Module "${id}" not found.`);
|
|
1048
|
-
} catch (requireError) {
|
|
1049
|
-
logWarn(
|
|
1050
|
-
"WebpackAdapter",
|
|
1051
|
-
`Module require failed: ${String(requireError)}`
|
|
1052
|
-
);
|
|
1053
|
-
if (typeof self.__original_webpack_require__ !== "function") {
|
|
1054
|
-
throw new RemoteComponentsError(
|
|
1055
|
-
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
1056
|
-
{
|
|
1057
|
-
cause: requireError instanceof Error ? requireError : void 0
|
|
1058
|
-
}
|
|
1059
|
-
);
|
|
1060
|
-
}
|
|
1061
|
-
try {
|
|
1062
|
-
logDebug("WebpackAdapter", "Falling back to original webpack require");
|
|
1063
|
-
return self.__original_webpack_require__(id);
|
|
1064
|
-
} catch (originalError) {
|
|
1065
|
-
throw new RemoteComponentsError(
|
|
1066
|
-
`Module "${id}" not found in remote component bundle "${bundle}".`,
|
|
1067
|
-
{ cause: originalError instanceof Error ? originalError : void 0 }
|
|
1068
|
-
);
|
|
1069
|
-
}
|
|
1070
|
-
}
|
|
1071
|
-
};
|
|
1072
|
-
}
|
|
1073
|
-
|
|
1074
|
-
// src/shared/client/component-loader.ts
|
|
1075
|
-
async function loadRemoteComponent({
|
|
1076
|
-
url,
|
|
1077
|
-
name,
|
|
1078
|
-
rscName,
|
|
1079
|
-
bundle,
|
|
1080
|
-
route = "/",
|
|
1081
|
-
runtime = "webpack",
|
|
1082
|
-
data,
|
|
1083
|
-
nextData,
|
|
1084
|
-
scripts = [],
|
|
1085
|
-
shared = Promise.resolve({}),
|
|
1086
|
-
remoteShared = {},
|
|
1087
|
-
container,
|
|
1088
|
-
resolveClientUrl
|
|
1089
|
-
}) {
|
|
1090
|
-
try {
|
|
1091
|
-
if (runtime === "webpack") {
|
|
1092
|
-
const self = globalThis;
|
|
1093
|
-
if (!self.__DISABLE_WEBPACK_EXEC__) {
|
|
1094
|
-
self.__DISABLE_WEBPACK_EXEC__ = {};
|
|
1095
|
-
}
|
|
1096
|
-
self.__DISABLE_WEBPACK_EXEC__[bundle] = true;
|
|
1097
|
-
await loadScripts(scripts, resolveClientUrl);
|
|
1098
|
-
}
|
|
1099
|
-
const hostShared = await shared;
|
|
1100
|
-
logDebug(
|
|
1101
|
-
"ComponentLoader",
|
|
1102
|
-
`loadRemoteComponent: bundle="${bundle}", name="${name}"`
|
|
1103
|
-
);
|
|
1104
|
-
logDebug(
|
|
1105
|
-
"ComponentLoader",
|
|
1106
|
-
`Host shared modules available: ${Object.keys(hostShared)}`
|
|
1107
|
-
);
|
|
1108
|
-
logDebug(
|
|
1109
|
-
"ComponentLoader",
|
|
1110
|
-
`Remote shared modules requested: ${JSON.stringify(remoteShared)}`
|
|
1111
|
-
);
|
|
1112
|
-
await setupWebpackRuntime(
|
|
1113
|
-
runtime,
|
|
1114
|
-
scripts,
|
|
1115
|
-
url,
|
|
1116
|
-
bundle,
|
|
1117
|
-
hostShared,
|
|
1118
|
-
remoteShared,
|
|
1119
|
-
resolveClientUrl
|
|
1120
|
-
);
|
|
1121
|
-
if (bundle) {
|
|
1122
|
-
const resolve = {
|
|
1123
|
-
"/react/index.js": React,
|
|
1124
|
-
"/react/jsx-dev-runtime.js": JSXDevRuntime,
|
|
1125
|
-
"/react/jsx-runtime.js": JSXRuntime,
|
|
1126
|
-
"/react-dom/index.js": ReactDOM,
|
|
1127
|
-
"/react-dom/client.js": ReactDOMClient,
|
|
1128
|
-
...Object.entries(remoteShared).reduce(
|
|
1129
|
-
(acc, [key, value]) => {
|
|
1130
|
-
if (typeof hostShared[value] !== "undefined") {
|
|
1131
|
-
acc[key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, "")] = hostShared[value];
|
|
1132
|
-
} else {
|
|
1133
|
-
logDebug(
|
|
1134
|
-
"ComponentLoader",
|
|
1135
|
-
`Remote requests "${value}" but host doesn't provide it`
|
|
1136
|
-
);
|
|
1137
|
-
}
|
|
1138
|
-
return acc;
|
|
1139
|
-
},
|
|
1140
|
-
{}
|
|
1141
|
-
)
|
|
1142
|
-
};
|
|
1143
|
-
await Promise.all(
|
|
1144
|
-
Object.entries(resolve).map(async ([key, value]) => {
|
|
1145
|
-
if (typeof value === "function") {
|
|
1146
|
-
resolve[key] = await value(bundle);
|
|
1147
|
-
}
|
|
1148
|
-
return Promise.resolve(value);
|
|
1149
|
-
})
|
|
1150
|
-
);
|
|
1151
|
-
applySharedModules(bundle, resolve);
|
|
1152
|
-
} else {
|
|
1153
|
-
logWarn(
|
|
1154
|
-
"ComponentLoader",
|
|
1155
|
-
"No bundle specified, skipping shared module setup"
|
|
1156
|
-
);
|
|
1157
|
-
}
|
|
1158
|
-
if (data.length > 0) {
|
|
1159
|
-
return await loadRSCComponent(rscName ?? name, data);
|
|
1160
|
-
} else if (nextData) {
|
|
1161
|
-
return loadNextPagesComponent(bundle, route, nextData, name, container);
|
|
1162
|
-
}
|
|
1163
|
-
return loadRSCComponent(rscName ?? name, [`0:[null]
|
|
1164
|
-
`]);
|
|
1165
|
-
} catch (error) {
|
|
1166
|
-
return {
|
|
1167
|
-
component: null,
|
|
1168
|
-
error: new RemoteComponentsError(
|
|
1169
|
-
`Failed to load remote component "${name}".`,
|
|
1170
|
-
{
|
|
1171
|
-
cause: error instanceof Error ? error : new Error(String(error))
|
|
1172
|
-
}
|
|
1173
|
-
)
|
|
1174
|
-
};
|
|
1175
|
-
}
|
|
1176
|
-
}
|
|
1177
|
-
async function loadRSCComponent(rscName, data) {
|
|
1178
|
-
let createFromReadableStream;
|
|
1179
|
-
try {
|
|
1180
|
-
const { createFromReadableStream: _createFromReadableStream } = await import("next/dist/compiled/react-server-dom-webpack/client.browser");
|
|
1181
|
-
createFromReadableStream = _createFromReadableStream;
|
|
1182
|
-
} catch {
|
|
1183
|
-
const {
|
|
1184
|
-
default: { createFromReadableStream: _createFromReadableStream }
|
|
1185
|
-
} = await import("react-server-dom-webpack/client.browser");
|
|
1186
|
-
createFromReadableStream = _createFromReadableStream;
|
|
1187
|
-
}
|
|
1188
|
-
if (typeof createFromReadableStream !== "function") {
|
|
1189
|
-
throw new RemoteComponentsError(
|
|
1190
|
-
'Failed to import "react-server-dom-webpack". Is Next.js installed correctly?'
|
|
1191
|
-
);
|
|
1192
|
-
}
|
|
1193
|
-
const stream = createRSCStream(rscName, data);
|
|
1194
|
-
const component = createFromReadableStream(stream);
|
|
1195
|
-
return { component };
|
|
1196
|
-
}
|
|
1197
|
-
function loadNextPagesComponent(bundle, route, nextData, name, container) {
|
|
1198
|
-
const { Component, App } = nextClientPagesLoader(bundle, route, container);
|
|
1199
|
-
if (!Component) {
|
|
1200
|
-
throw new RemoteComponentsError(
|
|
1201
|
-
`Remote Component "${name}" is trying to load the component for route "${route}" but it is not available.`
|
|
1202
|
-
);
|
|
1203
|
-
}
|
|
1204
|
-
const component = App ? React.createElement(App, { Component, ...nextData.props }) : React.createElement(Component, nextData.props);
|
|
1205
|
-
return { component };
|
|
1206
|
-
}
|
|
1207
|
-
|
|
1208
|
-
// src/shared/client/proxy-through-host.ts
|
|
1209
|
-
var proxyClientRequestsThroughHost = (remoteSrc, url) => {
|
|
1210
|
-
if (typeof location === "undefined") {
|
|
1211
|
-
return void 0;
|
|
1212
|
-
}
|
|
1213
|
-
const remoteOrigin = new URL(remoteSrc, location.href).origin;
|
|
1214
|
-
if (remoteOrigin === location.origin) {
|
|
1215
|
-
return void 0;
|
|
1216
|
-
}
|
|
1217
|
-
try {
|
|
1218
|
-
const parsed = new URL(url, location.href);
|
|
1219
|
-
if (parsed.origin === remoteOrigin) {
|
|
1220
|
-
return generateProtectedRcFallbackSrc(url);
|
|
1221
|
-
}
|
|
1222
|
-
} catch {
|
|
1223
|
-
}
|
|
1224
|
-
return void 0;
|
|
1225
|
-
};
|
|
1226
|
-
|
|
1227
|
-
// src/shared/client/set-attributes-from-props.ts
|
|
1228
|
-
var DOMAttributeNames = {
|
|
1229
|
-
acceptCharset: "accept-charset",
|
|
1230
|
-
className: "class",
|
|
1231
|
-
htmlFor: "for",
|
|
1232
|
-
httpEquiv: "http-equiv",
|
|
1233
|
-
noModule: "noModule"
|
|
1234
|
-
};
|
|
1235
|
-
var ignoreProps = [
|
|
1236
|
-
"onLoad",
|
|
1237
|
-
"onReady",
|
|
1238
|
-
"dangerouslySetInnerHTML",
|
|
1239
|
-
"children",
|
|
1240
|
-
"onError",
|
|
1241
|
-
"strategy",
|
|
1242
|
-
"stylesheets"
|
|
1243
|
-
];
|
|
1244
|
-
function isBooleanScriptAttribute(attr) {
|
|
1245
|
-
return ["async", "defer", "noModule"].includes(attr);
|
|
1246
|
-
}
|
|
1247
|
-
function setAttributesFromProps(el, props) {
|
|
1248
|
-
for (const [p, value] of Object.entries(props)) {
|
|
1249
|
-
if (!Object.hasOwn(props, p))
|
|
1250
|
-
continue;
|
|
1251
|
-
if (ignoreProps.includes(p))
|
|
1252
|
-
continue;
|
|
1253
|
-
if (value === void 0) {
|
|
1254
|
-
continue;
|
|
1255
|
-
}
|
|
1256
|
-
const attr = DOMAttributeNames[p] || p.toLowerCase();
|
|
1257
|
-
if (el.tagName === "SCRIPT" && isBooleanScriptAttribute(attr)) {
|
|
1258
|
-
el[attr] = Boolean(value);
|
|
1259
|
-
} else {
|
|
1260
|
-
el.setAttribute(attr, String(value));
|
|
1261
|
-
}
|
|
1262
|
-
if (value === false || el.tagName === "SCRIPT" && isBooleanScriptAttribute(attr) && (!value || value === "false")) {
|
|
1263
|
-
el.setAttribute(attr, "");
|
|
1264
|
-
el.removeAttribute(attr);
|
|
1265
|
-
}
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
|
|
1269
|
-
// src/shared/client/static-loader.ts
|
|
1270
|
-
async function importViaCallback(absoluteSrc, resolveClientUrl) {
|
|
1271
|
-
const resolvedUrl = resolveClientUrl(absoluteSrc) ?? absoluteSrc;
|
|
1272
|
-
const fetchUrl = new URL(resolvedUrl, location.href).href;
|
|
1273
|
-
const response = await fetch(fetchUrl);
|
|
1274
|
-
if (!response.ok)
|
|
1275
|
-
throw new Error(`Proxied fetch failed: ${response.status}`);
|
|
1276
|
-
const content = (await response.text()).replace(/import\.meta\.url/g, JSON.stringify(absoluteSrc)).replace(
|
|
1277
|
-
/\b(from|import)\s*(["'])(\.\.?\/[^"']+)\2/g,
|
|
1278
|
-
(_, keyword, quote, relativePath) => {
|
|
1279
|
-
const absoluteImportUrl = new URL(relativePath, absoluteSrc).href;
|
|
1280
|
-
const resolvedImportUrl = new URL(
|
|
1281
|
-
resolveClientUrl(absoluteImportUrl) ?? absoluteImportUrl,
|
|
1282
|
-
location.href
|
|
1283
|
-
).href;
|
|
1284
|
-
return `${keyword} ${quote}${resolvedImportUrl}${quote}`;
|
|
1285
|
-
}
|
|
1286
|
-
);
|
|
1287
|
-
const moduleBlobUrl = URL.createObjectURL(
|
|
1288
|
-
new Blob([content], { type: "text/javascript" })
|
|
1289
|
-
);
|
|
1290
|
-
const wrapperContent = [
|
|
1291
|
-
`import*as m from${JSON.stringify(moduleBlobUrl)};`,
|
|
1292
|
-
`globalThis.__rc_module_registry__=globalThis.__rc_module_registry__||{};`,
|
|
1293
|
-
`globalThis.__rc_module_registry__[${JSON.stringify(absoluteSrc)}]=m;`
|
|
1294
|
-
].join("");
|
|
1295
|
-
const wrapperBlobUrl = URL.createObjectURL(
|
|
1296
|
-
new Blob([wrapperContent], { type: "text/javascript" })
|
|
1297
|
-
);
|
|
1298
|
-
const scriptEl = document.createElement("script");
|
|
1299
|
-
scriptEl.type = "module";
|
|
1300
|
-
scriptEl.src = wrapperBlobUrl;
|
|
1301
|
-
try {
|
|
1302
|
-
await new Promise((resolve, reject) => {
|
|
1303
|
-
scriptEl.onload = () => resolve();
|
|
1304
|
-
scriptEl.onerror = () => reject(new Error(`Failed to load module for ${absoluteSrc}`));
|
|
1305
|
-
document.head.appendChild(scriptEl);
|
|
1306
|
-
});
|
|
1307
|
-
} finally {
|
|
1308
|
-
scriptEl.remove();
|
|
1309
|
-
URL.revokeObjectURL(moduleBlobUrl);
|
|
1310
|
-
URL.revokeObjectURL(wrapperBlobUrl);
|
|
1311
|
-
}
|
|
1312
|
-
const registry = globalThis.__rc_module_registry__;
|
|
1313
|
-
const mod = registry?.[absoluteSrc] ?? {};
|
|
1314
|
-
if (registry)
|
|
1315
|
-
delete registry[absoluteSrc];
|
|
1316
|
-
return mod;
|
|
1317
|
-
}
|
|
1318
|
-
async function importDirectly(absoluteSrc) {
|
|
1319
|
-
try {
|
|
1320
|
-
return await import(
|
|
1321
|
-
/* @vite-ignore */
|
|
1322
|
-
/* webpackIgnore: true */
|
|
1323
|
-
absoluteSrc
|
|
1324
|
-
);
|
|
1325
|
-
} catch (importError) {
|
|
1326
|
-
if (!absoluteSrc.startsWith("blob:")) {
|
|
1327
|
-
warnCrossOriginFetchError("StaticLoader", absoluteSrc);
|
|
1328
|
-
}
|
|
1329
|
-
throw importError;
|
|
1330
|
-
}
|
|
1331
|
-
}
|
|
1332
|
-
function resolveScriptSrc(script, url) {
|
|
1333
|
-
const rawSrc = typeof script.getAttribute === "function" ? script.getAttribute("src") ?? script.src : script.src;
|
|
1334
|
-
if (!rawSrc && script.textContent) {
|
|
1335
|
-
return URL.createObjectURL(
|
|
1336
|
-
new Blob(
|
|
1337
|
-
[script.textContent.replace(/import\.meta\.url/g, JSON.stringify(url))],
|
|
1338
|
-
{ type: "text/javascript" }
|
|
1339
|
-
)
|
|
1340
|
-
);
|
|
1341
|
-
}
|
|
1342
|
-
return rawSrc;
|
|
1343
|
-
}
|
|
1344
|
-
async function loadStaticRemoteComponent(scripts, url, resolveClientUrl) {
|
|
1345
|
-
const self = globalThis;
|
|
1346
|
-
if (self.__remote_script_entrypoint_mount__?.[url.href]) {
|
|
1347
|
-
self.__remote_script_entrypoint_mount__[url.href] = /* @__PURE__ */ new Set();
|
|
1348
|
-
}
|
|
1349
|
-
if (self.__remote_script_entrypoint_unmount__?.[url.href]) {
|
|
1350
|
-
self.__remote_script_entrypoint_unmount__[url.href] = /* @__PURE__ */ new Set();
|
|
1351
|
-
}
|
|
1352
|
-
const mountUnmountSets = await Promise.all(
|
|
1353
|
-
scripts.map(async (script) => {
|
|
1354
|
-
try {
|
|
1355
|
-
const src = resolveScriptSrc(script, url);
|
|
1356
|
-
const absoluteSrc = new URL(src, url).href;
|
|
1357
|
-
const mod = resolveClientUrl ? await importViaCallback(absoluteSrc, resolveClientUrl) : await importDirectly(absoluteSrc);
|
|
1358
|
-
if (src.startsWith("blob:")) {
|
|
1359
|
-
URL.revokeObjectURL(src);
|
|
1360
|
-
}
|
|
1361
|
-
if (typeof mod.mount === "function" || typeof mod.default?.mount === "function") {
|
|
1362
|
-
if (!self.__remote_script_entrypoint_mount__) {
|
|
1363
|
-
self.__remote_script_entrypoint_mount__ = {};
|
|
1364
|
-
}
|
|
1365
|
-
if (!self.__remote_script_entrypoint_mount__[url.href]) {
|
|
1366
|
-
self.__remote_script_entrypoint_mount__[url.href] = /* @__PURE__ */ new Set();
|
|
1367
|
-
}
|
|
1368
|
-
self.__remote_script_entrypoint_mount__[url.href]?.add(
|
|
1369
|
-
mod.mount || mod.default?.mount || (() => {
|
|
1370
|
-
})
|
|
1371
|
-
);
|
|
1372
|
-
}
|
|
1373
|
-
if (typeof mod.unmount === "function" || typeof mod.default?.unmount === "function") {
|
|
1374
|
-
if (!self.__remote_script_entrypoint_unmount__) {
|
|
1375
|
-
self.__remote_script_entrypoint_unmount__ = {};
|
|
1376
|
-
}
|
|
1377
|
-
if (!self.__remote_script_entrypoint_unmount__[url.href]) {
|
|
1378
|
-
self.__remote_script_entrypoint_unmount__[url.href] = /* @__PURE__ */ new Set();
|
|
1379
|
-
}
|
|
1380
|
-
self.__remote_script_entrypoint_unmount__[url.href]?.add(
|
|
1381
|
-
mod.unmount || mod.default?.unmount || (() => {
|
|
1382
|
-
})
|
|
1383
|
-
);
|
|
1384
|
-
}
|
|
1385
|
-
return {
|
|
1386
|
-
mount: mod.mount || mod.default?.mount,
|
|
1387
|
-
unmount: mod.unmount || mod.default?.unmount
|
|
1388
|
-
};
|
|
1389
|
-
} catch (e) {
|
|
1390
|
-
logError(
|
|
1391
|
-
"StaticLoader",
|
|
1392
|
-
`Error loading remote component script from "${script.src || url.href}".`,
|
|
1393
|
-
e
|
|
1394
|
-
);
|
|
1395
|
-
return {
|
|
1396
|
-
mount: void 0,
|
|
1397
|
-
unmount: void 0
|
|
1398
|
-
};
|
|
1399
|
-
}
|
|
1400
|
-
})
|
|
1401
|
-
);
|
|
1402
|
-
return mountUnmountSets.reduce(
|
|
1403
|
-
(acc, { mount, unmount }) => {
|
|
1404
|
-
if (typeof mount === "function") {
|
|
1405
|
-
acc.mount.add(mount);
|
|
1406
|
-
}
|
|
1407
|
-
if (typeof unmount === "function") {
|
|
1408
|
-
acc.unmount.add(unmount);
|
|
1409
|
-
}
|
|
1410
|
-
return acc;
|
|
1411
|
-
},
|
|
1412
|
-
{
|
|
1413
|
-
mount: /* @__PURE__ */ new Set(),
|
|
1414
|
-
unmount: /* @__PURE__ */ new Set()
|
|
1415
|
-
}
|
|
1416
|
-
);
|
|
1417
|
-
}
|
|
1418
|
-
// Annotate the CommonJS export names for ESM import in node:
|
|
1419
|
-
0 && (module.exports = {
|
|
1420
|
-
DEFAULT_ROUTE,
|
|
1421
|
-
REMOTE_COMPONENT_REGEX,
|
|
1422
|
-
RUNTIME_SCRIPT,
|
|
1423
|
-
RUNTIME_TURBOPACK,
|
|
1424
|
-
RUNTIME_WEBPACK,
|
|
1425
|
-
RemoteComponentsError,
|
|
1426
|
-
createRSCStream,
|
|
1427
|
-
fixPayload,
|
|
1428
|
-
getBundleKey,
|
|
1429
|
-
loadRemoteComponent,
|
|
1430
|
-
loadScripts,
|
|
1431
|
-
loadStaticRemoteComponent,
|
|
1432
|
-
proxyClientRequestsThroughHost,
|
|
1433
|
-
setAttributesFromProps,
|
|
1434
|
-
setupWebpackRuntime
|
|
1435
|
-
});
|
|
1436
|
-
//# sourceMappingURL=remote-component.cjs.map
|