remote-components 0.3.6 → 0.4.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/{chunk-6IUP26UK.cjs → chunk-42TVDI3G.cjs} +5 -4
- package/dist/chunk-42TVDI3G.cjs.map +1 -0
- package/dist/chunk-5KTAEO52.cjs +28 -0
- package/dist/chunk-5KTAEO52.cjs.map +1 -0
- package/dist/{chunk-42N2ZLE2.js → chunk-5WL3FP4V.js} +6 -6
- package/dist/{chunk-ZPMTZ3KJ.js → chunk-AKOMV2UF.js} +4 -3
- package/dist/chunk-AKOMV2UF.js.map +1 -0
- package/dist/{chunk-ER73O65F.cjs → chunk-AYC2AWUG.cjs} +23 -23
- package/dist/{chunk-KEPHL25S.js → chunk-D5GNZB6O.js} +2 -1
- package/dist/chunk-D5GNZB6O.js.map +1 -0
- package/dist/{chunk-F44NODUS.cjs → chunk-EYALF655.cjs} +26 -26
- package/dist/{chunk-XCFYWSLD.cjs → chunk-JJTCFQHE.cjs} +31 -19
- package/dist/chunk-JJTCFQHE.cjs.map +1 -0
- package/dist/{chunk-OO4AMJWO.js → chunk-LQ7VQ74E.js} +2 -2
- package/dist/{chunk-2VQGCACH.js → chunk-MKO52FRO.js} +30 -18
- package/dist/chunk-MKO52FRO.js.map +1 -0
- package/dist/{chunk-KYJWRZ2B.js → chunk-N3KPUFOB.js} +3 -3
- package/dist/chunk-N3SQTOSE.cjs +25 -0
- package/dist/chunk-N3SQTOSE.cjs.map +1 -0
- package/dist/{chunk-W5ESPGHH.js → chunk-NN5V3FVD.js} +27 -15
- package/dist/chunk-NN5V3FVD.js.map +1 -0
- package/dist/chunk-RHGEBXPL.js +25 -0
- package/dist/chunk-RHGEBXPL.js.map +1 -0
- package/dist/{chunk-R4QFK5TN.cjs → chunk-RLI4YTBJ.cjs} +20 -4
- package/dist/chunk-RLI4YTBJ.cjs.map +1 -0
- package/dist/{chunk-HNZVEIKN.js → chunk-SAGYPGIQ.js} +18 -2
- package/dist/chunk-SAGYPGIQ.js.map +1 -0
- package/dist/chunk-STIJO4AG.js +28 -0
- package/dist/chunk-STIJO4AG.js.map +1 -0
- package/dist/{chunk-CREXMFMF.cjs → chunk-TZT7DLO5.cjs} +4 -4
- package/dist/{chunk-KKBEMQU7.cjs → chunk-Y4GMYUJT.cjs} +41 -29
- package/dist/chunk-Y4GMYUJT.cjs.map +1 -0
- package/dist/{chunk-7MVFHOIP.cjs → chunk-Z2SLBFQL.cjs} +2 -1
- package/dist/chunk-Z2SLBFQL.cjs.map +1 -0
- package/dist/config/nextjs.cjs +7 -12
- package/dist/config/nextjs.cjs.map +1 -1
- package/dist/config/nextjs.js +4 -9
- package/dist/config/nextjs.js.map +1 -1
- package/dist/host/html.cjs +29 -28
- package/dist/host/html.cjs.map +1 -1
- package/dist/host/html.js +12 -11
- package/dist/host/html.js.map +1 -1
- package/dist/host/navigation.cjs +8 -0
- package/dist/host/navigation.d.ts +30 -0
- package/dist/host/navigation.js +8 -0
- package/dist/host/nextjs/app/client-only.cjs +16 -14
- package/dist/host/nextjs/app/client-only.cjs.map +1 -1
- package/dist/host/nextjs/app/client-only.d.ts +2 -1
- package/dist/host/nextjs/app/client-only.js +11 -9
- package/dist/host/nextjs/app/client-only.js.map +1 -1
- package/dist/host/react.cjs +14 -10
- package/dist/host/react.d.ts +2 -1
- package/dist/host/react.js +15 -11
- package/dist/{index-4c65355c.d.ts → index-d2ce8a3f.d.ts} +22 -2
- package/dist/internal/config/webpack/next-client-pages-loader.cjs +27 -15
- package/dist/internal/config/webpack/next-client-pages-loader.cjs.map +1 -1
- package/dist/internal/config/webpack/next-client-pages-loader.d.ts +3 -5
- package/dist/internal/config/webpack/next-client-pages-loader.js +27 -15
- package/dist/internal/config/webpack/next-client-pages-loader.js.map +1 -1
- package/dist/internal/host/nextjs/app-client.d.ts +1 -1
- package/dist/internal/host/react/context.d.ts +2 -2
- package/dist/internal/host/shared/navigate-event.cjs +51 -0
- package/dist/internal/host/shared/navigate-event.cjs.map +1 -0
- package/dist/internal/host/shared/navigate-event.d.ts +21 -0
- package/dist/internal/host/shared/navigate-event.js +26 -0
- package/dist/internal/host/shared/navigate-event.js.map +1 -0
- package/dist/internal/host/shared/pipeline.d.ts +2 -2
- package/dist/internal/host/shared/polyfill.cjs +14 -0
- package/dist/internal/host/shared/polyfill.cjs.map +1 -1
- package/dist/internal/host/shared/polyfill.js +16 -0
- package/dist/internal/host/shared/polyfill.js.map +1 -1
- package/dist/internal/runtime/loaders/component-loader.d.ts +2 -2
- package/dist/internal/runtime/loaders/script-loader.cjs +2 -1
- package/dist/internal/runtime/loaders/script-loader.cjs.map +1 -1
- package/dist/internal/runtime/loaders/script-loader.js +2 -1
- package/dist/internal/runtime/loaders/script-loader.js.map +1 -1
- package/dist/internal/runtime/loaders/static-loader.d.ts +2 -1
- package/dist/internal/runtime/namespace.cjs +1 -0
- package/dist/internal/runtime/namespace.cjs.map +1 -1
- package/dist/internal/runtime/namespace.d.ts +2 -1
- package/dist/internal/runtime/namespace.js +1 -0
- package/dist/internal/runtime/namespace.js.map +1 -1
- package/dist/internal/runtime/types.d.ts +2 -1
- package/dist/navigate-event-baee0b63.d.ts +14 -0
- package/dist/remote/html.cjs +1 -1
- package/dist/remote/html.js +1 -1
- package/dist/{script-6W5JRBZK.cjs → script-D5AD7HLV.cjs} +4 -4
- package/dist/{script-IFEBOLIA.js → script-VPOI7ARP.js} +3 -3
- package/dist/{server-handoff-ce13bebc.d.ts → server-handoff-8c89b856.d.ts} +2 -2
- package/dist/{static-loader-X4TSF5KW.js → static-loader-OHSAUD62.js} +3 -3
- package/dist/static-loader-OHSAUD62.js.map +1 -0
- package/dist/static-loader-UDIXK5MV.cjs +11 -0
- package/dist/static-loader-UDIXK5MV.cjs.map +1 -0
- package/dist/{turbopack-NPGO3MWS.js → turbopack-DK6L7P3J.js} +6 -5
- package/dist/{turbopack-NPGO3MWS.js.map → turbopack-DK6L7P3J.js.map} +1 -1
- package/dist/{turbopack-WRMKPNN4.cjs → turbopack-PSD4THQE.cjs} +13 -12
- package/dist/turbopack-PSD4THQE.cjs.map +1 -0
- package/dist/{types-59251814.d.ts → types-8b0edd78.d.ts} +7 -0
- package/dist/{webpack-DUBHPYD6.js → webpack-KSDNIXMS.js} +6 -5
- package/dist/{webpack-DUBHPYD6.js.map → webpack-KSDNIXMS.js.map} +1 -1
- package/dist/{webpack-KSCMCL7M.cjs → webpack-SIFRCBIN.cjs} +13 -12
- package/dist/webpack-SIFRCBIN.cjs.map +1 -0
- package/package.json +9 -1
- package/dist/chunk-2VQGCACH.js.map +0 -1
- package/dist/chunk-6IUP26UK.cjs.map +0 -1
- package/dist/chunk-7MVFHOIP.cjs.map +0 -1
- package/dist/chunk-HNZVEIKN.js.map +0 -1
- package/dist/chunk-KEPHL25S.js.map +0 -1
- package/dist/chunk-KKBEMQU7.cjs.map +0 -1
- package/dist/chunk-R4QFK5TN.cjs.map +0 -1
- package/dist/chunk-W5ESPGHH.js.map +0 -1
- package/dist/chunk-XCFYWSLD.cjs.map +0 -1
- package/dist/chunk-ZPMTZ3KJ.js.map +0 -1
- package/dist/static-loader-ZYD5BO4D.cjs +0 -11
- package/dist/turbopack-WRMKPNN4.cjs.map +0 -1
- package/dist/webpack-KSCMCL7M.cjs.map +0 -1
- /package/dist/{chunk-42N2ZLE2.js.map → chunk-5WL3FP4V.js.map} +0 -0
- /package/dist/{chunk-ER73O65F.cjs.map → chunk-AYC2AWUG.cjs.map} +0 -0
- /package/dist/{chunk-F44NODUS.cjs.map → chunk-EYALF655.cjs.map} +0 -0
- /package/dist/{chunk-OO4AMJWO.js.map → chunk-LQ7VQ74E.js.map} +0 -0
- /package/dist/{chunk-KYJWRZ2B.js.map → chunk-N3KPUFOB.js.map} +0 -0
- /package/dist/{chunk-CREXMFMF.cjs.map → chunk-TZT7DLO5.cjs.map} +0 -0
- /package/dist/{static-loader-ZYD5BO4D.cjs.map → host/navigation.cjs.map} +0 -0
- /package/dist/{static-loader-X4TSF5KW.js.map → host/navigation.js.map} +0 -0
- /package/dist/{script-6W5JRBZK.cjs.map → script-D5AD7HLV.cjs.map} +0 -0
- /package/dist/{script-IFEBOLIA.js.map → script-VPOI7ARP.js.map} +0 -0
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import {
|
|
3
|
+
REMOTE_NAVIGATE_EVENT
|
|
4
|
+
} from "#internal/host/shared/navigate-event";
|
|
2
5
|
import { createRemoteImageLoader } from "#internal/host/shared/remote-image-loader";
|
|
3
6
|
import { getNamespace } from "#internal/runtime/namespace";
|
|
4
7
|
import { logWarn } from "#internal/utils/logger";
|
|
8
|
+
function dispatchRemoteNavigate(detail) {
|
|
9
|
+
window.dispatchEvent(
|
|
10
|
+
new CustomEvent(REMOTE_NAVIGATE_EVENT, { detail })
|
|
11
|
+
);
|
|
12
|
+
}
|
|
5
13
|
function sharedPolyfills(shared, resolveClientUrl) {
|
|
6
14
|
const hostShared = getNamespace().hostSharedModules;
|
|
7
15
|
const polyfill = {
|
|
@@ -10,9 +18,11 @@ function sharedPolyfills(shared, resolveClientUrl) {
|
|
|
10
18
|
return {
|
|
11
19
|
push: (routerUrl) => {
|
|
12
20
|
history.pushState({}, "", routerUrl);
|
|
21
|
+
dispatchRemoteNavigate({ url: routerUrl, type: "push" });
|
|
13
22
|
},
|
|
14
23
|
replace: (routerUrl) => {
|
|
15
24
|
history.replaceState({}, "", routerUrl);
|
|
25
|
+
dispatchRemoteNavigate({ url: routerUrl, type: "replace" });
|
|
16
26
|
},
|
|
17
27
|
back: () => {
|
|
18
28
|
history.back();
|
|
@@ -75,6 +85,10 @@ function sharedPolyfills(shared, resolveClientUrl) {
|
|
|
75
85
|
} else {
|
|
76
86
|
history.pushState({}, "", props.href);
|
|
77
87
|
}
|
|
88
|
+
dispatchRemoteNavigate({
|
|
89
|
+
url: props.href,
|
|
90
|
+
type: replace ? "replace" : "push"
|
|
91
|
+
});
|
|
78
92
|
},
|
|
79
93
|
suppressHydrationWarning: true,
|
|
80
94
|
children: children ?? null
|
|
@@ -114,9 +128,11 @@ function sharedPolyfills(shared, resolveClientUrl) {
|
|
|
114
128
|
return {
|
|
115
129
|
push: (routerUrl) => {
|
|
116
130
|
history.pushState({}, "", routerUrl);
|
|
131
|
+
dispatchRemoteNavigate({ url: routerUrl, type: "push" });
|
|
117
132
|
},
|
|
118
133
|
replace: (routerUrl) => {
|
|
119
134
|
history.replaceState({}, "", routerUrl);
|
|
135
|
+
dispatchRemoteNavigate({ url: routerUrl, type: "replace" });
|
|
120
136
|
},
|
|
121
137
|
back: () => {
|
|
122
138
|
history.back();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/host/shared/polyfill.tsx"],"sourcesContent":["import type { LinkProps } from 'next/link';\nimport { createRemoteImageLoader } from '#internal/host/shared/remote-image-loader';\nimport { getNamespace } from '#internal/runtime/namespace';\nimport type { InternalResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\nimport { logWarn } from '#internal/utils/logger';\n\n// polyfill Next.js App Router client API (minimal)\n// implementations are minimal and do not cover all use cases\n// developer can override these shared modules from configuration\nexport function sharedPolyfills(\n shared?: Record<string, () => Promise<unknown>>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n const hostShared = getNamespace().hostSharedModules;\n const polyfill = {\n 'next/dist/client/components/navigation':\n hostShared['next/navigation'] ??\n shared?.['next/navigation'] ??\n (() =>\n Promise.resolve({\n useRouter() {\n return {\n push: (routerUrl: string) => {\n history.pushState({}, '', routerUrl);\n },\n replace: (routerUrl: string) => {\n history.replaceState({}, '', routerUrl);\n },\n back: () => {\n history.back();\n },\n };\n },\n usePathname() {\n return location.pathname;\n },\n useParams() {\n return {};\n },\n useSearchParams() {\n return new URLSearchParams(location.search);\n },\n useSelectedLayoutSegment() {\n return null;\n },\n useSelectedLayoutSegments() {\n return [];\n },\n __esModule: true,\n })),\n 'next/dist/client/app-dir/link':\n hostShared['next/link'] ??\n shared?.['next/link'] ??\n (() =>\n Promise.resolve({\n default: ({\n scroll: _,\n replace,\n prefetch,\n onNavigate,\n children,\n ...props\n }: React.PropsWithChildren<LinkProps>) => {\n if (prefetch) {\n logWarn(\n 'Polyfill',\n 'Next.js Link prefetch is not supported in remote components',\n );\n }\n return (\n <a\n {...props}\n href={props.href as string}\n onClick={(e) => {\n e.preventDefault();\n let preventDefaulted = false;\n e.preventDefault = () => {\n preventDefaulted = true;\n e.defaultPrevented = true;\n };\n if (typeof props.onClick === 'function') {\n props.onClick(e);\n }\n onNavigate?.(e);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (preventDefaulted) {\n return;\n }\n if (replace) {\n history.replaceState({}, '', props.href as string);\n } else {\n history.pushState({}, '', props.href as string);\n }\n }}\n suppressHydrationWarning\n >\n {children ?? null}\n </a>\n );\n },\n useLinkStatus() {\n return { pending: false };\n },\n __esModule: true,\n })),\n 'next/dist/client/app-dir/form':\n hostShared['next/form'] ??\n shared?.['next/form'] ??\n (() =>\n Promise.resolve({\n default: () => {\n // TODO: implement <Form> component for non-Next.js host applications\n throw new Error('Next.js <Form> component not implemented');\n },\n __esModule: true,\n })),\n // Instead of replacing next/image entirely, we let the real Next.js Image\n // component load from the remote bundle and only replace its default loader.\n // This gives us full next/image fidelity (fill, priority, srcSet, blur\n // placeholders, error handling) while routing image optimization through the\n // remote app's /_next/image endpoint.\n 'next/dist/shared/lib/image-loader':\n hostShared['next/dist/shared/lib/image-loader'] ??\n shared?.['next/dist/shared/lib/image-loader'] ??\n ((bundle: string) =>\n Promise.resolve({\n default: createRemoteImageLoader(bundle, resolveClientUrl),\n __esModule: true,\n })),\n 'next/dist/client/script':\n hostShared['next/script'] ??\n shared?.['next/script'] ??\n (() =>\n Promise.resolve({\n // TODO: implement <Script> component for non-Next.js host applications\n // do not throw an error for now\n default: () => null,\n __esModule: true,\n })),\n 'next/router':\n hostShared['next/router'] ??\n shared?.['next/router'] ??\n (() =>\n // TODO: incomplete implementation\n Promise.resolve({\n useRouter() {\n return {\n push: (routerUrl: string) => {\n history.pushState({}, '', routerUrl);\n },\n replace: (routerUrl: string) => {\n history.replaceState({}, '', routerUrl);\n },\n back: () => {\n history.back();\n },\n };\n },\n __esModule: true,\n })),\n 'next/dist/build/polyfills/process': () =>\n Promise.resolve({\n default: {\n env: {\n NODE_ENV: 'production',\n },\n },\n __esModule: true,\n }),\n } as Record<string, () => Promise<unknown>>;\n\n polyfill['next/navigation'] = polyfill[\n 'next/dist/client/components/navigation'\n ] as () => Promise<unknown>;\n polyfill['next/link'] = polyfill[\n 'next/dist/client/app-dir/link'\n ] as () => Promise<unknown>;\n polyfill['next/form'] = polyfill[\n 'next/dist/client/app-dir/form'\n ] as () => Promise<unknown>;\n polyfill['next/dist/esm/shared/lib/image-loader'] = polyfill[\n 'next/dist/shared/lib/image-loader'\n ] as () => Promise<unknown>;\n polyfill['next/script'] = polyfill[\n 'next/dist/client/script'\n ] as () => Promise<unknown>;\n\n return polyfill;\n}\n"],"mappings":"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","names":[]}
|
|
1
|
+
{"version":3,"sources":["../../../../src/host/shared/polyfill.tsx"],"sourcesContent":["import type { LinkProps } from 'next/link';\nimport {\n REMOTE_NAVIGATE_EVENT,\n type RemoteNavigateDetail,\n} from '#internal/host/shared/navigate-event';\nimport { createRemoteImageLoader } from '#internal/host/shared/remote-image-loader';\nimport { getNamespace } from '#internal/runtime/namespace';\nimport type { InternalResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\nimport { logWarn } from '#internal/utils/logger';\n\nfunction dispatchRemoteNavigate(detail: RemoteNavigateDetail) {\n window.dispatchEvent(\n new CustomEvent<RemoteNavigateDetail>(REMOTE_NAVIGATE_EVENT, { detail }),\n );\n}\n\n// polyfill Next.js App Router client API (minimal)\n// implementations are minimal and do not cover all use cases\n// developer can override these shared modules from configuration\nexport function sharedPolyfills(\n shared?: Record<string, () => Promise<unknown>>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n const hostShared = getNamespace().hostSharedModules;\n const polyfill = {\n 'next/dist/client/components/navigation':\n hostShared['next/navigation'] ??\n shared?.['next/navigation'] ??\n (() =>\n Promise.resolve({\n useRouter() {\n return {\n push: (routerUrl: string) => {\n history.pushState({}, '', routerUrl);\n dispatchRemoteNavigate({ url: routerUrl, type: 'push' });\n },\n replace: (routerUrl: string) => {\n history.replaceState({}, '', routerUrl);\n dispatchRemoteNavigate({ url: routerUrl, type: 'replace' });\n },\n back: () => {\n history.back();\n },\n };\n },\n usePathname() {\n return location.pathname;\n },\n useParams() {\n return {};\n },\n useSearchParams() {\n return new URLSearchParams(location.search);\n },\n useSelectedLayoutSegment() {\n return null;\n },\n useSelectedLayoutSegments() {\n return [];\n },\n __esModule: true,\n })),\n 'next/dist/client/app-dir/link':\n hostShared['next/link'] ??\n shared?.['next/link'] ??\n (() =>\n Promise.resolve({\n default: ({\n scroll: _,\n replace,\n prefetch,\n onNavigate,\n children,\n ...props\n }: React.PropsWithChildren<LinkProps>) => {\n if (prefetch) {\n logWarn(\n 'Polyfill',\n 'Next.js Link prefetch is not supported in remote components',\n );\n }\n return (\n <a\n {...props}\n href={props.href as string}\n onClick={(e) => {\n e.preventDefault();\n let preventDefaulted = false;\n e.preventDefault = () => {\n preventDefaulted = true;\n e.defaultPrevented = true;\n };\n if (typeof props.onClick === 'function') {\n props.onClick(e);\n }\n onNavigate?.(e);\n // eslint-disable-next-line @typescript-eslint/no-unnecessary-condition\n if (preventDefaulted) {\n return;\n }\n if (replace) {\n history.replaceState({}, '', props.href as string);\n } else {\n history.pushState({}, '', props.href as string);\n }\n dispatchRemoteNavigate({\n url: props.href as string,\n type: replace ? 'replace' : 'push',\n });\n }}\n suppressHydrationWarning\n >\n {children ?? null}\n </a>\n );\n },\n useLinkStatus() {\n return { pending: false };\n },\n __esModule: true,\n })),\n 'next/dist/client/app-dir/form':\n hostShared['next/form'] ??\n shared?.['next/form'] ??\n (() =>\n Promise.resolve({\n default: () => {\n // TODO: implement <Form> component for non-Next.js host applications\n throw new Error('Next.js <Form> component not implemented');\n },\n __esModule: true,\n })),\n // Instead of replacing next/image entirely, we let the real Next.js Image\n // component load from the remote bundle and only replace its default loader.\n // This gives us full next/image fidelity (fill, priority, srcSet, blur\n // placeholders, error handling) while routing image optimization through the\n // remote app's /_next/image endpoint.\n 'next/dist/shared/lib/image-loader':\n hostShared['next/dist/shared/lib/image-loader'] ??\n shared?.['next/dist/shared/lib/image-loader'] ??\n ((bundle: string) =>\n Promise.resolve({\n default: createRemoteImageLoader(bundle, resolveClientUrl),\n __esModule: true,\n })),\n 'next/dist/client/script':\n hostShared['next/script'] ??\n shared?.['next/script'] ??\n (() =>\n Promise.resolve({\n // TODO: implement <Script> component for non-Next.js host applications\n // do not throw an error for now\n default: () => null,\n __esModule: true,\n })),\n 'next/router':\n hostShared['next/router'] ??\n shared?.['next/router'] ??\n (() =>\n // TODO: incomplete implementation\n Promise.resolve({\n useRouter() {\n return {\n push: (routerUrl: string) => {\n history.pushState({}, '', routerUrl);\n dispatchRemoteNavigate({ url: routerUrl, type: 'push' });\n },\n replace: (routerUrl: string) => {\n history.replaceState({}, '', routerUrl);\n dispatchRemoteNavigate({ url: routerUrl, type: 'replace' });\n },\n back: () => {\n history.back();\n },\n };\n },\n __esModule: true,\n })),\n 'next/dist/build/polyfills/process': () =>\n Promise.resolve({\n default: {\n env: {\n NODE_ENV: 'production',\n },\n },\n __esModule: true,\n }),\n } as Record<string, () => Promise<unknown>>;\n\n polyfill['next/navigation'] = polyfill[\n 'next/dist/client/components/navigation'\n ] as () => Promise<unknown>;\n polyfill['next/link'] = polyfill[\n 'next/dist/client/app-dir/link'\n ] as () => Promise<unknown>;\n polyfill['next/form'] = polyfill[\n 'next/dist/client/app-dir/form'\n ] as () => Promise<unknown>;\n polyfill['next/dist/esm/shared/lib/image-loader'] = polyfill[\n 'next/dist/shared/lib/image-loader'\n ] as () => Promise<unknown>;\n polyfill['next/script'] = polyfill[\n 'next/dist/client/script'\n ] as () => Promise<unknown>;\n\n return polyfill;\n}\n"],"mappings":"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","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { InternalResolveClientUrl } from '../url/resolve-client-url.js';
|
|
2
|
-
import { a as ConsumeLoaderPayload } from '../../../server-handoff-
|
|
3
|
-
import { L as LoaderResult } from '../../../types-
|
|
2
|
+
import { a as ConsumeLoaderPayload } from '../../../server-handoff-8c89b856.js';
|
|
3
|
+
import { L as LoaderResult } from '../../../types-8b0edd78.js';
|
|
4
4
|
import 'react';
|
|
5
5
|
import '../../host/shared/asset-descriptors.js';
|
|
6
6
|
import '../../host/shared/config.js';
|
|
@@ -34,7 +34,8 @@ async function loadScripts(scripts, resolveClientUrl) {
|
|
|
34
34
|
script.src.replace(import_patterns.NEXT_BUNDLE_PATH_RE, "/_next/"),
|
|
35
35
|
location.origin
|
|
36
36
|
).href;
|
|
37
|
-
const
|
|
37
|
+
const rawResolved = resolveClientUrl?.(newSrc) ?? newSrc;
|
|
38
|
+
const resolvedSrc = new URL(rawResolved, location.href).href;
|
|
38
39
|
const alreadyLoaded = Array.from(
|
|
39
40
|
document.querySelectorAll("script[src]")
|
|
40
41
|
).some((s) => s.src === resolvedSrc);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtime/loaders/script-loader.ts"],"sourcesContent":["import type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport { NEXT_BUNDLE_PATH_RE } from '#internal/runtime/patterns';\nimport { isProxiedUrl } from '#internal/runtime/url/protected-rc-fallback';\nimport {\n failedProxiedAssetError,\n RemoteComponentsError,\n} from '#internal/utils/error';\nimport { warnCrossOriginFetchError } from '#internal/utils/logger';\n\n/**\n * Loads external scripts for remote components\n */\nexport async function loadScripts(\n scripts: { src: string }[],\n resolveClientUrl?: InternalResolveClientUrl,\n): Promise<void> {\n await Promise.all(\n scripts.map((script) => {\n return new Promise<void>((resolve, reject) => {\n const newSrc = new URL(\n // remove the remote component bundle name identifier from the script src\n script.src.replace(NEXT_BUNDLE_PATH_RE, '/_next/'),\n location.origin,\n ).href;\n\n const
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtime/loaders/script-loader.ts"],"sourcesContent":["import type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport { NEXT_BUNDLE_PATH_RE } from '#internal/runtime/patterns';\nimport { isProxiedUrl } from '#internal/runtime/url/protected-rc-fallback';\nimport {\n failedProxiedAssetError,\n RemoteComponentsError,\n} from '#internal/utils/error';\nimport { warnCrossOriginFetchError } from '#internal/utils/logger';\n\n/**\n * Loads external scripts for remote components\n */\nexport async function loadScripts(\n scripts: { src: string }[],\n resolveClientUrl?: InternalResolveClientUrl,\n): Promise<void> {\n await Promise.all(\n scripts.map((script) => {\n return new Promise<void>((resolve, reject) => {\n const newSrc = new URL(\n // remove the remote component bundle name identifier from the script src\n script.src.replace(NEXT_BUNDLE_PATH_RE, '/_next/'),\n location.origin,\n ).href;\n\n // resolveClientUrl may return a relative URL (e.g. the host-proxy\n // path \"/rc-fetch-protected-remote?url=...\"). Normalize to absolute\n // before comparing with s.src, which browsers always expose as\n // absolute, so the deduplication check works in deployed contexts.\n const rawResolved = resolveClientUrl?.(newSrc) ?? newSrc;\n const resolvedSrc = new URL(rawResolved, location.href).href;\n\n const alreadyLoaded = Array.from(\n document.querySelectorAll<HTMLScriptElement>('script[src]'),\n ).some((s) => s.src === resolvedSrc);\n if (alreadyLoaded) {\n resolve();\n return;\n }\n\n const newScript = document.createElement('script');\n newScript.onload = () => resolve();\n newScript.onerror = () => {\n const isProxied = isProxiedUrl(resolvedSrc);\n if (isProxied) {\n reject(failedProxiedAssetError('script', newSrc, resolvedSrc));\n } else {\n warnCrossOriginFetchError('ScriptLoader', newSrc);\n reject(\n new RemoteComponentsError(\n `Failed to load <script src=\"${newSrc}\"> for Remote Component. Check the URL is correct.`,\n ),\n );\n }\n };\n newScript.src = resolvedSrc;\n newScript.async = true;\n document.head.appendChild(newScript);\n });\n }),\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,sBAAoC;AACpC,mCAA6B;AAC7B,mBAGO;AACP,oBAA0C;AAK1C,eAAsB,YACpB,SACA,kBACe;AACf,QAAM,QAAQ;AAAA,IACZ,QAAQ,IAAI,CAAC,WAAW;AACtB,aAAO,IAAI,QAAc,CAAC,SAAS,WAAW;AAC5C,cAAM,SAAS,IAAI;AAAA;AAAA,UAEjB,OAAO,IAAI,QAAQ,qCAAqB,SAAS;AAAA,UACjD,SAAS;AAAA,QACX,EAAE;AAMF,cAAM,cAAc,mBAAmB,MAAM,KAAK;AAClD,cAAM,cAAc,IAAI,IAAI,aAAa,SAAS,IAAI,EAAE;AAExD,cAAM,gBAAgB,MAAM;AAAA,UAC1B,SAAS,iBAAoC,aAAa;AAAA,QAC5D,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,WAAW;AACnC,YAAI,eAAe;AACjB,kBAAQ;AACR;AAAA,QACF;AAEA,cAAM,YAAY,SAAS,cAAc,QAAQ;AACjD,kBAAU,SAAS,MAAM,QAAQ;AACjC,kBAAU,UAAU,MAAM;AACxB,gBAAM,gBAAY,2CAAa,WAAW;AAC1C,cAAI,WAAW;AACb,uBAAO,sCAAwB,UAAU,QAAQ,WAAW,CAAC;AAAA,UAC/D,OAAO;AACL,yDAA0B,gBAAgB,MAAM;AAChD;AAAA,cACE,IAAI;AAAA,gBACF,+BAA+B;AAAA,cACjC;AAAA,YACF;AAAA,UACF;AAAA,QACF;AACA,kBAAU,MAAM;AAChB,kBAAU,QAAQ;AAClB,iBAAS,KAAK,YAAY,SAAS;AAAA,MACrC,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -14,7 +14,8 @@ async function loadScripts(scripts, resolveClientUrl) {
|
|
|
14
14
|
script.src.replace(NEXT_BUNDLE_PATH_RE, "/_next/"),
|
|
15
15
|
location.origin
|
|
16
16
|
).href;
|
|
17
|
-
const
|
|
17
|
+
const rawResolved = resolveClientUrl?.(newSrc) ?? newSrc;
|
|
18
|
+
const resolvedSrc = new URL(rawResolved, location.href).href;
|
|
18
19
|
const alreadyLoaded = Array.from(
|
|
19
20
|
document.querySelectorAll("script[src]")
|
|
20
21
|
).some((s) => s.src === resolvedSrc);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/runtime/loaders/script-loader.ts"],"sourcesContent":["import type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport { NEXT_BUNDLE_PATH_RE } from '#internal/runtime/patterns';\nimport { isProxiedUrl } from '#internal/runtime/url/protected-rc-fallback';\nimport {\n failedProxiedAssetError,\n RemoteComponentsError,\n} from '#internal/utils/error';\nimport { warnCrossOriginFetchError } from '#internal/utils/logger';\n\n/**\n * Loads external scripts for remote components\n */\nexport async function loadScripts(\n scripts: { src: string }[],\n resolveClientUrl?: InternalResolveClientUrl,\n): Promise<void> {\n await Promise.all(\n scripts.map((script) => {\n return new Promise<void>((resolve, reject) => {\n const newSrc = new URL(\n // remove the remote component bundle name identifier from the script src\n script.src.replace(NEXT_BUNDLE_PATH_RE, '/_next/'),\n location.origin,\n ).href;\n\n const
|
|
1
|
+
{"version":3,"sources":["../../../../src/runtime/loaders/script-loader.ts"],"sourcesContent":["import type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport { NEXT_BUNDLE_PATH_RE } from '#internal/runtime/patterns';\nimport { isProxiedUrl } from '#internal/runtime/url/protected-rc-fallback';\nimport {\n failedProxiedAssetError,\n RemoteComponentsError,\n} from '#internal/utils/error';\nimport { warnCrossOriginFetchError } from '#internal/utils/logger';\n\n/**\n * Loads external scripts for remote components\n */\nexport async function loadScripts(\n scripts: { src: string }[],\n resolveClientUrl?: InternalResolveClientUrl,\n): Promise<void> {\n await Promise.all(\n scripts.map((script) => {\n return new Promise<void>((resolve, reject) => {\n const newSrc = new URL(\n // remove the remote component bundle name identifier from the script src\n script.src.replace(NEXT_BUNDLE_PATH_RE, '/_next/'),\n location.origin,\n ).href;\n\n // resolveClientUrl may return a relative URL (e.g. the host-proxy\n // path \"/rc-fetch-protected-remote?url=...\"). Normalize to absolute\n // before comparing with s.src, which browsers always expose as\n // absolute, so the deduplication check works in deployed contexts.\n const rawResolved = resolveClientUrl?.(newSrc) ?? newSrc;\n const resolvedSrc = new URL(rawResolved, location.href).href;\n\n const alreadyLoaded = Array.from(\n document.querySelectorAll<HTMLScriptElement>('script[src]'),\n ).some((s) => s.src === resolvedSrc);\n if (alreadyLoaded) {\n resolve();\n return;\n }\n\n const newScript = document.createElement('script');\n newScript.onload = () => resolve();\n newScript.onerror = () => {\n const isProxied = isProxiedUrl(resolvedSrc);\n if (isProxied) {\n reject(failedProxiedAssetError('script', newSrc, resolvedSrc));\n } else {\n warnCrossOriginFetchError('ScriptLoader', newSrc);\n reject(\n new RemoteComponentsError(\n `Failed to load <script src=\"${newSrc}\"> for Remote Component. Check the URL is correct.`,\n ),\n );\n }\n };\n newScript.src = resolvedSrc;\n newScript.async = true;\n document.head.appendChild(newScript);\n });\n }),\n );\n}\n"],"mappings":"AACA,SAAS,2BAA2B;AACpC,SAAS,oBAAoB;AAC7B;AAAA,EACE;AAAA,EACA;AAAA,OACK;AACP,SAAS,iCAAiC;AAK1C,eAAsB,YACpB,SACA,kBACe;AACf,QAAM,QAAQ;AAAA,IACZ,QAAQ,IAAI,CAAC,WAAW;AACtB,aAAO,IAAI,QAAc,CAAC,SAAS,WAAW;AAC5C,cAAM,SAAS,IAAI;AAAA;AAAA,UAEjB,OAAO,IAAI,QAAQ,qBAAqB,SAAS;AAAA,UACjD,SAAS;AAAA,QACX,EAAE;AAMF,cAAM,cAAc,mBAAmB,MAAM,KAAK;AAClD,cAAM,cAAc,IAAI,IAAI,aAAa,SAAS,IAAI,EAAE;AAExD,cAAM,gBAAgB,MAAM;AAAA,UAC1B,SAAS,iBAAoC,aAAa;AAAA,QAC5D,EAAE,KAAK,CAAC,MAAM,EAAE,QAAQ,WAAW;AACnC,YAAI,eAAe;AACjB,kBAAQ;AACR;AAAA,QACF;AAEA,cAAM,YAAY,SAAS,cAAc,QAAQ;AACjD,kBAAU,SAAS,MAAM,QAAQ;AACjC,kBAAU,UAAU,MAAM;AACxB,gBAAM,YAAY,aAAa,WAAW;AAC1C,cAAI,WAAW;AACb,mBAAO,wBAAwB,UAAU,QAAQ,WAAW,CAAC;AAAA,UAC/D,OAAO;AACL,sCAA0B,gBAAgB,MAAM;AAChD;AAAA,cACE,IAAI;AAAA,gBACF,+BAA+B;AAAA,cACjC;AAAA,YACF;AAAA,UACF;AAAA,QACF;AACA,kBAAU,MAAM;AAChB,kBAAU,QAAQ;AAClB,iBAAS,KAAK,YAAY,SAAS;AAAA,MACrC,CAAC;AAAA,IACH,CAAC;AAAA,EACH;AACF;","names":[]}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { InternalResolveClientUrl } from '../url/resolve-client-url.js';
|
|
2
|
-
import { M as MountOrUnmountFunction } from '../../../types-
|
|
2
|
+
import { M as MountOrUnmountFunction } from '../../../types-8b0edd78.js';
|
|
3
3
|
import '../metadata.js';
|
|
4
|
+
import 'react';
|
|
4
5
|
import '../turbopack/remote-scope.js';
|
|
5
6
|
import '../constants.js';
|
|
6
7
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtime/namespace.ts"],"sourcesContent":["import type { RemoteScope } from '#internal/runtime/turbopack/remote-scope';\nimport type {\n GlobalScope,\n MountOrUnmountFunction,\n MountUnmountFunctions,\n} from '#internal/runtime/types';\n\n/**\n * Typed namespace for all remote-components runtime state.\n *\n * Consolidates scattered `globalThis` globals into a single object at\n * `globalThis.__remote_components__`. Each property corresponds to a\n * previously independent global — see inline `@see` tags for the original\n * global name. Code that previously read from those globals still works\n * because each migration writes through to both the namespace and the\n * legacy global (pointing at the same underlying object).\n */\nexport interface RemoteComponentsNamespace {\n /** @see `__remote_component_scopes__` */\n scopes: Map<string, RemoteScope>;\n /** @see `__remote_components_turbopack_chunk_loader_promise__` */\n chunkCache: Record<string, Promise<unknown>>;\n /** @see `__remote_script_entrypoint_mount__` */\n mountFns: Record<string, Set<MountOrUnmountFunction>>;\n /** @see `__remote_script_entrypoint_unmount__` */\n unmountFns: Record<string, Set<MountOrUnmountFunction>>;\n /** @see `__remote_bundle_url__` */\n bundleUrls: Record<string, string | URL>;\n /** @see `__rc_module_registry__` */\n moduleRegistry: Record<string, unknown>;\n /** @see `__webpack_require_type__` */\n dispatcherRuntime: string | undefined;\n /** @see `__remote_component_host_shared_modules__` */\n hostSharedModules: Record<string, () => Promise<unknown>>;\n /** @see `__remote_next_css__` */\n cssCache: Record<string, ChildNode[]>;\n /** @see `__remote_components_shadowroot_*` */\n shadowRoots: Record<string, ShadowRoot | null>;\n}\n\n/** Prefix for legacy per-key shadow root globals (`__remote_components_shadowroot_*`). */\nconst SHADOW_ROOT_PREFIX = '__remote_components_shadowroot_';\n\n/**\n * Backward-compat aliases for globals used in <=0.3.3.\n *\n * Only includes object/Map values that can be aliased by reference.\n * Primitives (`dispatcherRuntime`) must use write-through at their call sites.\n * Dynamic-key shadow root globals are adopted separately in `getNamespace()`.\n */\nconst LEGACY_ALIASES: ReadonlyArray<{\n global: string;\n prop: keyof RemoteComponentsNamespace;\n}> = [\n { global: '__remote_component_scopes__', prop: 'scopes' },\n {\n global: '__remote_components_turbopack_chunk_loader_promise__',\n prop: 'chunkCache',\n },\n { global: '__remote_script_entrypoint_mount__', prop: 'mountFns' },\n { global: '__remote_script_entrypoint_unmount__', prop: 'unmountFns' },\n { global: '__remote_bundle_url__', prop: 'bundleUrls' },\n { global: '__rc_module_registry__', prop: 'moduleRegistry' },\n {\n global: '__remote_component_host_shared_modules__',\n prop: 'hostSharedModules',\n },\n { global: '__remote_next_css__', prop: 'cssCache' },\n];\n\n/**\n * Returns the single shared `RemoteComponentsNamespace` instance, creating\n * it on first access. The namespace lives at `globalThis.__remote_components__`\n * so every module in the page shares the same state regardless of how many\n * copies of the library are loaded.\n *\n * On first initialization this function also handles backward compatibility\n * with legacy globals:\n * 1. **Adopt**: if a legacy global already exists (written by older code before\n * the namespace was created), its value becomes the initial namespace value.\n * 2. **Alias**: legacy globals are assigned to point at the namespace's objects,\n * so older code that reads the legacy global sees the same reference.\n */\nexport function getNamespace(): RemoteComponentsNamespace {\n const g = globalThis as GlobalScope & MountUnmountFunctions;\n const existing = g.__remote_components__;\n if (existing) {\n return existing;\n }\n\n const ns: RemoteComponentsNamespace = {\n scopes: new Map(),\n chunkCache: {},\n mountFns: {},\n unmountFns: {},\n bundleUrls: {},\n moduleRegistry: {},\n dispatcherRuntime: undefined,\n hostSharedModules: {},\n cssCache: {},\n shadowRoots: {},\n };\n\n // Adopt any pre-existing legacy globals, then alias them to the namespace.\n const nsRecord = ns as unknown as Record<string, unknown>;\n for (const { global, prop } of LEGACY_ALIASES) {\n const legacyValue = (g as Record<string, unknown>)[global];\n if (legacyValue != null) {\n nsRecord[prop] = legacyValue;\n }\n (g as Record<string, unknown>)[global] = ns[prop];\n }\n\n // Adopt per-key shadow root globals used in <=0.3.3\n // (e.g. `globalThis.__remote_components_shadowroot_<key> = root`).\n const gRecord = g as Record<string, unknown>;\n for (const key of Object.keys(gRecord)) {\n if (key.startsWith(SHADOW_ROOT_PREFIX)) {\n const suffix = key.slice(SHADOW_ROOT_PREFIX.length);\n ns.shadowRoots[suffix] = gRecord[key] as ShadowRoot | null;\n delete gRecord[key];\n }\n }\n\n g.__remote_components__ = ns;\n return ns;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;
|
|
1
|
+
{"version":3,"sources":["../../../src/runtime/namespace.ts"],"sourcesContent":["import type React from 'react';\nimport type { RemoteScope } from '#internal/runtime/turbopack/remote-scope';\nimport type {\n GlobalScope,\n MountOrUnmountFunction,\n MountUnmountFunctions,\n} from '#internal/runtime/types';\n\n/**\n * Typed namespace for all remote-components runtime state.\n *\n * Consolidates scattered `globalThis` globals into a single object at\n * `globalThis.__remote_components__`. Each property corresponds to a\n * previously independent global — see inline `@see` tags for the original\n * global name. Code that previously read from those globals still works\n * because each migration writes through to both the namespace and the\n * legacy global (pointing at the same underlying object).\n */\nexport interface RemoteComponentsNamespace {\n /** @see `__remote_component_scopes__` */\n scopes: Map<string, RemoteScope>;\n /** @see `__remote_components_turbopack_chunk_loader_promise__` */\n chunkCache: Record<string, Promise<unknown>>;\n /** @see `__remote_script_entrypoint_mount__` */\n mountFns: Record<string, Set<MountOrUnmountFunction>>;\n /** @see `__remote_script_entrypoint_unmount__` */\n unmountFns: Record<string, Set<MountOrUnmountFunction>>;\n /** @see `__remote_bundle_url__` */\n bundleUrls: Record<string, string | URL>;\n /** @see `__rc_module_registry__` */\n moduleRegistry: Record<string, unknown>;\n /** @see `__webpack_require_type__` */\n dispatcherRuntime: string | undefined;\n /** @see `__remote_component_host_shared_modules__` */\n hostSharedModules: Record<string, () => Promise<unknown>>;\n /** @see `__remote_next_css__` */\n cssCache: Record<string, ChildNode[]>;\n pageComponentCache?: Record<\n string,\n {\n Component: React.ComponentType<Record<string, unknown>> | null;\n App: React.ComponentType<\n { Component: React.ComponentType<Record<string, unknown>> } & Record<\n string,\n unknown\n >\n > | null;\n }\n >;\n /** @see `__remote_components_shadowroot_*` */\n shadowRoots: Record<string, ShadowRoot | null>;\n}\n\n/** Prefix for legacy per-key shadow root globals (`__remote_components_shadowroot_*`). */\nconst SHADOW_ROOT_PREFIX = '__remote_components_shadowroot_';\n\n/**\n * Backward-compat aliases for globals used in <=0.3.3.\n *\n * Only includes object/Map values that can be aliased by reference.\n * Primitives (`dispatcherRuntime`) must use write-through at their call sites.\n * Dynamic-key shadow root globals are adopted separately in `getNamespace()`.\n */\nconst LEGACY_ALIASES: ReadonlyArray<{\n global: string;\n prop: keyof RemoteComponentsNamespace;\n}> = [\n { global: '__remote_component_scopes__', prop: 'scopes' },\n {\n global: '__remote_components_turbopack_chunk_loader_promise__',\n prop: 'chunkCache',\n },\n { global: '__remote_script_entrypoint_mount__', prop: 'mountFns' },\n { global: '__remote_script_entrypoint_unmount__', prop: 'unmountFns' },\n { global: '__remote_bundle_url__', prop: 'bundleUrls' },\n { global: '__rc_module_registry__', prop: 'moduleRegistry' },\n {\n global: '__remote_component_host_shared_modules__',\n prop: 'hostSharedModules',\n },\n { global: '__remote_next_css__', prop: 'cssCache' },\n];\n\n/**\n * Returns the single shared `RemoteComponentsNamespace` instance, creating\n * it on first access. The namespace lives at `globalThis.__remote_components__`\n * so every module in the page shares the same state regardless of how many\n * copies of the library are loaded.\n *\n * On first initialization this function also handles backward compatibility\n * with legacy globals:\n * 1. **Adopt**: if a legacy global already exists (written by older code before\n * the namespace was created), its value becomes the initial namespace value.\n * 2. **Alias**: legacy globals are assigned to point at the namespace's objects,\n * so older code that reads the legacy global sees the same reference.\n */\nexport function getNamespace(): RemoteComponentsNamespace {\n const g = globalThis as GlobalScope & MountUnmountFunctions;\n const existing = g.__remote_components__;\n if (existing) {\n return existing;\n }\n\n const ns: RemoteComponentsNamespace = {\n scopes: new Map(),\n chunkCache: {},\n mountFns: {},\n unmountFns: {},\n bundleUrls: {},\n moduleRegistry: {},\n dispatcherRuntime: undefined,\n hostSharedModules: {},\n cssCache: {},\n pageComponentCache: {},\n shadowRoots: {},\n };\n\n // Adopt any pre-existing legacy globals, then alias them to the namespace.\n const nsRecord = ns as unknown as Record<string, unknown>;\n for (const { global, prop } of LEGACY_ALIASES) {\n const legacyValue = (g as Record<string, unknown>)[global];\n if (legacyValue != null) {\n nsRecord[prop] = legacyValue;\n }\n (g as Record<string, unknown>)[global] = ns[prop];\n }\n\n // Adopt per-key shadow root globals used in <=0.3.3\n // (e.g. `globalThis.__remote_components_shadowroot_<key> = root`).\n const gRecord = g as Record<string, unknown>;\n for (const key of Object.keys(gRecord)) {\n if (key.startsWith(SHADOW_ROOT_PREFIX)) {\n const suffix = key.slice(SHADOW_ROOT_PREFIX.length);\n ns.shadowRoots[suffix] = gRecord[key] as ShadowRoot | null;\n delete gRecord[key];\n }\n }\n\n g.__remote_components__ = ns;\n return ns;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAsDA,MAAM,qBAAqB;AAS3B,MAAM,iBAGD;AAAA,EACH,EAAE,QAAQ,+BAA+B,MAAM,SAAS;AAAA,EACxD;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EACA,EAAE,QAAQ,sCAAsC,MAAM,WAAW;AAAA,EACjE,EAAE,QAAQ,wCAAwC,MAAM,aAAa;AAAA,EACrE,EAAE,QAAQ,yBAAyB,MAAM,aAAa;AAAA,EACtD,EAAE,QAAQ,0BAA0B,MAAM,iBAAiB;AAAA,EAC3D;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EACA,EAAE,QAAQ,uBAAuB,MAAM,WAAW;AACpD;AAeO,SAAS,eAA0C;AACxD,QAAM,IAAI;AACV,QAAM,WAAW,EAAE;AACnB,MAAI,UAAU;AACZ,WAAO;AAAA,EACT;AAEA,QAAM,KAAgC;AAAA,IACpC,QAAQ,oBAAI,IAAI;AAAA,IAChB,YAAY,CAAC;AAAA,IACb,UAAU,CAAC;AAAA,IACX,YAAY,CAAC;AAAA,IACb,YAAY,CAAC;AAAA,IACb,gBAAgB,CAAC;AAAA,IACjB,mBAAmB;AAAA,IACnB,mBAAmB,CAAC;AAAA,IACpB,UAAU,CAAC;AAAA,IACX,oBAAoB,CAAC;AAAA,IACrB,aAAa,CAAC;AAAA,EAChB;AAGA,QAAM,WAAW;AACjB,aAAW,EAAE,QAAQ,KAAK,KAAK,gBAAgB;AAC7C,UAAM,cAAe,EAA8B,MAAM;AACzD,QAAI,eAAe,MAAM;AACvB,eAAS,IAAI,IAAI;AAAA,IACnB;AACA,IAAC,EAA8B,MAAM,IAAI,GAAG,IAAI;AAAA,EAClD;AAIA,QAAM,UAAU;AAChB,aAAW,OAAO,OAAO,KAAK,OAAO,GAAG;AACtC,QAAI,IAAI,WAAW,kBAAkB,GAAG;AACtC,YAAM,SAAS,IAAI,MAAM,mBAAmB,MAAM;AAClD,SAAG,YAAY,MAAM,IAAI,QAAQ,GAAG;AACpC,aAAO,QAAQ,GAAG;AAAA,IACpB;AAAA,EACF;AAEA,IAAE,wBAAwB;AAC1B,SAAO;AACT;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import 'react';
|
|
1
2
|
import './turbopack/remote-scope.js';
|
|
2
|
-
export { R as RemoteComponentsNamespace, g as getNamespace } from '../../types-
|
|
3
|
+
export { R as RemoteComponentsNamespace, g as getNamespace } from '../../types-8b0edd78.js';
|
|
3
4
|
import './url/resolve-client-url.js';
|
|
4
5
|
import './constants.js';
|
|
5
6
|
import './metadata.js';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/runtime/namespace.ts"],"sourcesContent":["import type { RemoteScope } from '#internal/runtime/turbopack/remote-scope';\nimport type {\n GlobalScope,\n MountOrUnmountFunction,\n MountUnmountFunctions,\n} from '#internal/runtime/types';\n\n/**\n * Typed namespace for all remote-components runtime state.\n *\n * Consolidates scattered `globalThis` globals into a single object at\n * `globalThis.__remote_components__`. Each property corresponds to a\n * previously independent global — see inline `@see` tags for the original\n * global name. Code that previously read from those globals still works\n * because each migration writes through to both the namespace and the\n * legacy global (pointing at the same underlying object).\n */\nexport interface RemoteComponentsNamespace {\n /** @see `__remote_component_scopes__` */\n scopes: Map<string, RemoteScope>;\n /** @see `__remote_components_turbopack_chunk_loader_promise__` */\n chunkCache: Record<string, Promise<unknown>>;\n /** @see `__remote_script_entrypoint_mount__` */\n mountFns: Record<string, Set<MountOrUnmountFunction>>;\n /** @see `__remote_script_entrypoint_unmount__` */\n unmountFns: Record<string, Set<MountOrUnmountFunction>>;\n /** @see `__remote_bundle_url__` */\n bundleUrls: Record<string, string | URL>;\n /** @see `__rc_module_registry__` */\n moduleRegistry: Record<string, unknown>;\n /** @see `__webpack_require_type__` */\n dispatcherRuntime: string | undefined;\n /** @see `__remote_component_host_shared_modules__` */\n hostSharedModules: Record<string, () => Promise<unknown>>;\n /** @see `__remote_next_css__` */\n cssCache: Record<string, ChildNode[]>;\n /** @see `__remote_components_shadowroot_*` */\n shadowRoots: Record<string, ShadowRoot | null>;\n}\n\n/** Prefix for legacy per-key shadow root globals (`__remote_components_shadowroot_*`). */\nconst SHADOW_ROOT_PREFIX = '__remote_components_shadowroot_';\n\n/**\n * Backward-compat aliases for globals used in <=0.3.3.\n *\n * Only includes object/Map values that can be aliased by reference.\n * Primitives (`dispatcherRuntime`) must use write-through at their call sites.\n * Dynamic-key shadow root globals are adopted separately in `getNamespace()`.\n */\nconst LEGACY_ALIASES: ReadonlyArray<{\n global: string;\n prop: keyof RemoteComponentsNamespace;\n}> = [\n { global: '__remote_component_scopes__', prop: 'scopes' },\n {\n global: '__remote_components_turbopack_chunk_loader_promise__',\n prop: 'chunkCache',\n },\n { global: '__remote_script_entrypoint_mount__', prop: 'mountFns' },\n { global: '__remote_script_entrypoint_unmount__', prop: 'unmountFns' },\n { global: '__remote_bundle_url__', prop: 'bundleUrls' },\n { global: '__rc_module_registry__', prop: 'moduleRegistry' },\n {\n global: '__remote_component_host_shared_modules__',\n prop: 'hostSharedModules',\n },\n { global: '__remote_next_css__', prop: 'cssCache' },\n];\n\n/**\n * Returns the single shared `RemoteComponentsNamespace` instance, creating\n * it on first access. The namespace lives at `globalThis.__remote_components__`\n * so every module in the page shares the same state regardless of how many\n * copies of the library are loaded.\n *\n * On first initialization this function also handles backward compatibility\n * with legacy globals:\n * 1. **Adopt**: if a legacy global already exists (written by older code before\n * the namespace was created), its value becomes the initial namespace value.\n * 2. **Alias**: legacy globals are assigned to point at the namespace's objects,\n * so older code that reads the legacy global sees the same reference.\n */\nexport function getNamespace(): RemoteComponentsNamespace {\n const g = globalThis as GlobalScope & MountUnmountFunctions;\n const existing = g.__remote_components__;\n if (existing) {\n return existing;\n }\n\n const ns: RemoteComponentsNamespace = {\n scopes: new Map(),\n chunkCache: {},\n mountFns: {},\n unmountFns: {},\n bundleUrls: {},\n moduleRegistry: {},\n dispatcherRuntime: undefined,\n hostSharedModules: {},\n cssCache: {},\n shadowRoots: {},\n };\n\n // Adopt any pre-existing legacy globals, then alias them to the namespace.\n const nsRecord = ns as unknown as Record<string, unknown>;\n for (const { global, prop } of LEGACY_ALIASES) {\n const legacyValue = (g as Record<string, unknown>)[global];\n if (legacyValue != null) {\n nsRecord[prop] = legacyValue;\n }\n (g as Record<string, unknown>)[global] = ns[prop];\n }\n\n // Adopt per-key shadow root globals used in <=0.3.3\n // (e.g. `globalThis.__remote_components_shadowroot_<key> = root`).\n const gRecord = g as Record<string, unknown>;\n for (const key of Object.keys(gRecord)) {\n if (key.startsWith(SHADOW_ROOT_PREFIX)) {\n const suffix = key.slice(SHADOW_ROOT_PREFIX.length);\n ns.shadowRoots[suffix] = gRecord[key] as ShadowRoot | null;\n delete gRecord[key];\n }\n }\n\n g.__remote_components__ = ns;\n return ns;\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../../../src/runtime/namespace.ts"],"sourcesContent":["import type React from 'react';\nimport type { RemoteScope } from '#internal/runtime/turbopack/remote-scope';\nimport type {\n GlobalScope,\n MountOrUnmountFunction,\n MountUnmountFunctions,\n} from '#internal/runtime/types';\n\n/**\n * Typed namespace for all remote-components runtime state.\n *\n * Consolidates scattered `globalThis` globals into a single object at\n * `globalThis.__remote_components__`. Each property corresponds to a\n * previously independent global — see inline `@see` tags for the original\n * global name. Code that previously read from those globals still works\n * because each migration writes through to both the namespace and the\n * legacy global (pointing at the same underlying object).\n */\nexport interface RemoteComponentsNamespace {\n /** @see `__remote_component_scopes__` */\n scopes: Map<string, RemoteScope>;\n /** @see `__remote_components_turbopack_chunk_loader_promise__` */\n chunkCache: Record<string, Promise<unknown>>;\n /** @see `__remote_script_entrypoint_mount__` */\n mountFns: Record<string, Set<MountOrUnmountFunction>>;\n /** @see `__remote_script_entrypoint_unmount__` */\n unmountFns: Record<string, Set<MountOrUnmountFunction>>;\n /** @see `__remote_bundle_url__` */\n bundleUrls: Record<string, string | URL>;\n /** @see `__rc_module_registry__` */\n moduleRegistry: Record<string, unknown>;\n /** @see `__webpack_require_type__` */\n dispatcherRuntime: string | undefined;\n /** @see `__remote_component_host_shared_modules__` */\n hostSharedModules: Record<string, () => Promise<unknown>>;\n /** @see `__remote_next_css__` */\n cssCache: Record<string, ChildNode[]>;\n pageComponentCache?: Record<\n string,\n {\n Component: React.ComponentType<Record<string, unknown>> | null;\n App: React.ComponentType<\n { Component: React.ComponentType<Record<string, unknown>> } & Record<\n string,\n unknown\n >\n > | null;\n }\n >;\n /** @see `__remote_components_shadowroot_*` */\n shadowRoots: Record<string, ShadowRoot | null>;\n}\n\n/** Prefix for legacy per-key shadow root globals (`__remote_components_shadowroot_*`). */\nconst SHADOW_ROOT_PREFIX = '__remote_components_shadowroot_';\n\n/**\n * Backward-compat aliases for globals used in <=0.3.3.\n *\n * Only includes object/Map values that can be aliased by reference.\n * Primitives (`dispatcherRuntime`) must use write-through at their call sites.\n * Dynamic-key shadow root globals are adopted separately in `getNamespace()`.\n */\nconst LEGACY_ALIASES: ReadonlyArray<{\n global: string;\n prop: keyof RemoteComponentsNamespace;\n}> = [\n { global: '__remote_component_scopes__', prop: 'scopes' },\n {\n global: '__remote_components_turbopack_chunk_loader_promise__',\n prop: 'chunkCache',\n },\n { global: '__remote_script_entrypoint_mount__', prop: 'mountFns' },\n { global: '__remote_script_entrypoint_unmount__', prop: 'unmountFns' },\n { global: '__remote_bundle_url__', prop: 'bundleUrls' },\n { global: '__rc_module_registry__', prop: 'moduleRegistry' },\n {\n global: '__remote_component_host_shared_modules__',\n prop: 'hostSharedModules',\n },\n { global: '__remote_next_css__', prop: 'cssCache' },\n];\n\n/**\n * Returns the single shared `RemoteComponentsNamespace` instance, creating\n * it on first access. The namespace lives at `globalThis.__remote_components__`\n * so every module in the page shares the same state regardless of how many\n * copies of the library are loaded.\n *\n * On first initialization this function also handles backward compatibility\n * with legacy globals:\n * 1. **Adopt**: if a legacy global already exists (written by older code before\n * the namespace was created), its value becomes the initial namespace value.\n * 2. **Alias**: legacy globals are assigned to point at the namespace's objects,\n * so older code that reads the legacy global sees the same reference.\n */\nexport function getNamespace(): RemoteComponentsNamespace {\n const g = globalThis as GlobalScope & MountUnmountFunctions;\n const existing = g.__remote_components__;\n if (existing) {\n return existing;\n }\n\n const ns: RemoteComponentsNamespace = {\n scopes: new Map(),\n chunkCache: {},\n mountFns: {},\n unmountFns: {},\n bundleUrls: {},\n moduleRegistry: {},\n dispatcherRuntime: undefined,\n hostSharedModules: {},\n cssCache: {},\n pageComponentCache: {},\n shadowRoots: {},\n };\n\n // Adopt any pre-existing legacy globals, then alias them to the namespace.\n const nsRecord = ns as unknown as Record<string, unknown>;\n for (const { global, prop } of LEGACY_ALIASES) {\n const legacyValue = (g as Record<string, unknown>)[global];\n if (legacyValue != null) {\n nsRecord[prop] = legacyValue;\n }\n (g as Record<string, unknown>)[global] = ns[prop];\n }\n\n // Adopt per-key shadow root globals used in <=0.3.3\n // (e.g. `globalThis.__remote_components_shadowroot_<key> = root`).\n const gRecord = g as Record<string, unknown>;\n for (const key of Object.keys(gRecord)) {\n if (key.startsWith(SHADOW_ROOT_PREFIX)) {\n const suffix = key.slice(SHADOW_ROOT_PREFIX.length);\n ns.shadowRoots[suffix] = gRecord[key] as ShadowRoot | null;\n delete gRecord[key];\n }\n }\n\n g.__remote_components__ = ns;\n return ns;\n}\n"],"mappings":"AAsDA,MAAM,qBAAqB;AAS3B,MAAM,iBAGD;AAAA,EACH,EAAE,QAAQ,+BAA+B,MAAM,SAAS;AAAA,EACxD;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EACA,EAAE,QAAQ,sCAAsC,MAAM,WAAW;AAAA,EACjE,EAAE,QAAQ,wCAAwC,MAAM,aAAa;AAAA,EACrE,EAAE,QAAQ,yBAAyB,MAAM,aAAa;AAAA,EACtD,EAAE,QAAQ,0BAA0B,MAAM,iBAAiB;AAAA,EAC3D;AAAA,IACE,QAAQ;AAAA,IACR,MAAM;AAAA,EACR;AAAA,EACA,EAAE,QAAQ,uBAAuB,MAAM,WAAW;AACpD;AAeO,SAAS,eAA0C;AACxD,QAAM,IAAI;AACV,QAAM,WAAW,EAAE;AACnB,MAAI,UAAU;AACZ,WAAO;AAAA,EACT;AAEA,QAAM,KAAgC;AAAA,IACpC,QAAQ,oBAAI,IAAI;AAAA,IAChB,YAAY,CAAC;AAAA,IACb,UAAU,CAAC;AAAA,IACX,YAAY,CAAC;AAAA,IACb,YAAY,CAAC;AAAA,IACb,gBAAgB,CAAC;AAAA,IACjB,mBAAmB;AAAA,IACnB,mBAAmB,CAAC;AAAA,IACpB,UAAU,CAAC;AAAA,IACX,oBAAoB,CAAC;AAAA,IACrB,aAAa,CAAC;AAAA,EAChB;AAGA,QAAM,WAAW;AACjB,aAAW,EAAE,QAAQ,KAAK,KAAK,gBAAgB;AAC7C,UAAM,cAAe,EAA8B,MAAM;AACzD,QAAI,eAAe,MAAM;AACvB,eAAS,IAAI,IAAI;AAAA,IACnB;AACA,IAAC,EAA8B,MAAM,IAAI,GAAG,IAAI;AAAA,EAClD;AAIA,QAAM,UAAU;AAChB,aAAW,OAAO,OAAO,KAAK,OAAO,GAAG;AACtC,QAAI,IAAI,WAAW,kBAAkB,GAAG;AACtC,YAAM,SAAS,IAAI,MAAM,mBAAmB,MAAM;AAClD,SAAG,YAAY,MAAM,IAAI,QAAQ,GAAG;AACpC,aAAO,QAAQ,GAAG;AAAA,IACpB;AAAA,EACF;AAEA,IAAE,wBAAwB;AAC1B,SAAO;AACT;","names":[]}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import './metadata.js';
|
|
2
|
-
export { G as GlobalScope, L as LoaderResult, M as MountOrUnmountFunction, b as MountUnmountFunctions, a as RSCKey } from '../../types-
|
|
2
|
+
export { G as GlobalScope, L as LoaderResult, M as MountOrUnmountFunction, b as MountUnmountFunctions, a as RSCKey } from '../../types-8b0edd78.js';
|
|
3
|
+
import 'react';
|
|
3
4
|
import './turbopack/remote-scope.js';
|
|
4
5
|
import './url/resolve-client-url.js';
|
|
5
6
|
import './constants.js';
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/** Parsed navigation request surfaced to `onRemoteNavigate` / `useRemoteNavigate` callbacks. */
|
|
2
|
+
interface RemoteNavigateEvent {
|
|
3
|
+
/** Raw value from the remote; may be absolute or relative. */
|
|
4
|
+
url: string;
|
|
5
|
+
pathname: string;
|
|
6
|
+
/** Includes leading `?`, or `''` if none. */
|
|
7
|
+
search: string;
|
|
8
|
+
/** Includes leading `#`, or `''` if none. */
|
|
9
|
+
hash: string;
|
|
10
|
+
/** `'push'` / `'replace'` mirror the remote's history call. */
|
|
11
|
+
type: 'push' | 'replace';
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export { RemoteNavigateEvent as R };
|
package/dist/remote/html.cjs
CHANGED
|
@@ -19,7 +19,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
19
19
|
this.root.innerHTML = html;
|
|
20
20
|
this.replaceChildren();
|
|
21
21
|
(async () => {
|
|
22
|
-
const { loadStaticRemoteComponent } = await Promise.resolve().then(() => _interopRequireWildcard(require("../static-loader-
|
|
22
|
+
const { loadStaticRemoteComponent } = await Promise.resolve().then(() => _interopRequireWildcard(require("../static-loader-UDIXK5MV.cjs")));
|
|
23
23
|
loadStaticRemoteComponent(
|
|
24
24
|
Array.from(_nullishCoalesce(_optionalChain([this, 'access', _ => _.root, 'optionalAccess', _2 => _2.querySelectorAll, 'call', _3 => _3("script")]), () => ( []))),
|
|
25
25
|
new URL(location.href)
|
package/dist/remote/html.js
CHANGED
|
@@ -19,7 +19,7 @@ if (typeof HTMLElement !== "undefined") {
|
|
|
19
19
|
this.root.innerHTML = html;
|
|
20
20
|
this.replaceChildren();
|
|
21
21
|
(async () => {
|
|
22
|
-
const { loadStaticRemoteComponent } = await import("../static-loader-
|
|
22
|
+
const { loadStaticRemoteComponent } = await import("../static-loader-OHSAUD62.js");
|
|
23
23
|
loadStaticRemoteComponent(
|
|
24
24
|
Array.from(this.root?.querySelectorAll("script") ?? []),
|
|
25
25
|
new URL(location.href)
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('./chunk-
|
|
3
|
+
var _chunkTZT7DLO5cjs = require('./chunk-TZT7DLO5.cjs');
|
|
4
|
+
require('./chunk-Z2SLBFQL.cjs');
|
|
5
5
|
require('./chunk-RUWR74XQ.cjs');
|
|
6
6
|
require('./chunk-KE7QPAQ4.cjs');
|
|
7
7
|
require('./chunk-SHFJ5OQA.cjs');
|
|
@@ -17,10 +17,10 @@ function scriptRuntime(resolveClientUrl) {
|
|
|
17
17
|
Component: null,
|
|
18
18
|
App: null
|
|
19
19
|
}),
|
|
20
|
-
preloadScripts: (scripts, url) =>
|
|
20
|
+
preloadScripts: (scripts, url) => _chunkTZT7DLO5cjs.loadStaticRemoteComponent.call(void 0, scripts, url, resolveClientUrl)
|
|
21
21
|
};
|
|
22
22
|
}
|
|
23
23
|
|
|
24
24
|
|
|
25
25
|
exports.scriptRuntime = scriptRuntime;
|
|
26
|
-
//# sourceMappingURL=script-
|
|
26
|
+
//# sourceMappingURL=script-D5AD7HLV.cjs.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadStaticRemoteComponent
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-LQ7VQ74E.js";
|
|
4
|
+
import "./chunk-D5GNZB6O.js";
|
|
5
5
|
import "./chunk-S2A4TFLS.js";
|
|
6
6
|
import "./chunk-X6YKUJKH.js";
|
|
7
7
|
import "./chunk-ENYGL5CO.js";
|
|
@@ -23,4 +23,4 @@ function scriptRuntime(resolveClientUrl) {
|
|
|
23
23
|
export {
|
|
24
24
|
scriptRuntime
|
|
25
25
|
};
|
|
26
|
-
//# sourceMappingURL=script-
|
|
26
|
+
//# sourceMappingURL=script-VPOI7ARP.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as React from 'react';
|
|
2
2
|
import { ScriptDescriptor, LinkDescriptor } from './internal/host/shared/asset-descriptors.js';
|
|
3
3
|
import { ShadowDomConfig } from './internal/host/shared/config.js';
|
|
4
4
|
import { RemoteComponentMetadata } from './internal/runtime/metadata.js';
|
|
@@ -40,7 +40,7 @@ interface ConsumeServerData extends ConsumeLoaderPayload, ShadowDomConfig {
|
|
|
40
40
|
serverUrl: string;
|
|
41
41
|
links?: LinkDescriptor[];
|
|
42
42
|
type?: RemoteComponentMetadata['type'];
|
|
43
|
-
children:
|
|
43
|
+
children: React.ReactNode;
|
|
44
44
|
}
|
|
45
45
|
|
|
46
46
|
export { ConsumeServerData as C, ConsumeLoaderPayload as a };
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadStaticRemoteComponent
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-LQ7VQ74E.js";
|
|
4
|
+
import "./chunk-D5GNZB6O.js";
|
|
5
5
|
import "./chunk-S2A4TFLS.js";
|
|
6
6
|
import "./chunk-X6YKUJKH.js";
|
|
7
7
|
import "./chunk-ENYGL5CO.js";
|
|
8
8
|
export {
|
|
9
9
|
loadStaticRemoteComponent
|
|
10
10
|
};
|
|
11
|
-
//# sourceMappingURL=static-loader-
|
|
11
|
+
//# sourceMappingURL=static-loader-OHSAUD62.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkTZT7DLO5cjs = require('./chunk-TZT7DLO5.cjs');
|
|
4
|
+
require('./chunk-Z2SLBFQL.cjs');
|
|
5
|
+
require('./chunk-RUWR74XQ.cjs');
|
|
6
|
+
require('./chunk-KE7QPAQ4.cjs');
|
|
7
|
+
require('./chunk-SHFJ5OQA.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
exports.loadStaticRemoteComponent = _chunkTZT7DLO5cjs.loadStaticRemoteComponent;
|
|
11
|
+
//# sourceMappingURL=static-loader-UDIXK5MV.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":""}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
initializeSharedModules,
|
|
3
3
|
setupRemoteScope
|
|
4
|
-
} from "./chunk-
|
|
4
|
+
} from "./chunk-N3KPUFOB.js";
|
|
5
5
|
import {
|
|
6
6
|
applySharedModules,
|
|
7
7
|
nextClientPagesLoader
|
|
8
|
-
} from "./chunk-
|
|
8
|
+
} from "./chunk-MKO52FRO.js";
|
|
9
9
|
import {
|
|
10
10
|
buildCoreShared,
|
|
11
11
|
buildHostShared
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-SAGYPGIQ.js";
|
|
13
|
+
import "./chunk-D5GNZB6O.js";
|
|
14
|
+
import "./chunk-STIJO4AG.js";
|
|
14
15
|
import "./chunk-S2A4TFLS.js";
|
|
15
16
|
import "./chunk-X6YKUJKH.js";
|
|
16
17
|
import "./chunk-ENYGL5CO.js";
|
|
@@ -52,4 +53,4 @@ async function turbopackRuntime(url, bundle, shared, remoteShared, resolveClient
|
|
|
52
53
|
export {
|
|
53
54
|
turbopackRuntime
|
|
54
55
|
};
|
|
55
|
-
//# sourceMappingURL=turbopack-
|
|
56
|
+
//# sourceMappingURL=turbopack-DK6L7P3J.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/host/html/runtime/turbopack.ts"],"sourcesContent":["import { applySharedModules } from '#internal/config/webpack/apply-shared-modules';\nimport { nextClientPagesLoader } from '#internal/config/webpack/next-client-pages-loader';\nimport type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport {\n buildCoreShared,\n buildHostShared,\n} from '#internal/host/shared/shared-module-resolver';\nimport { setupRemoteScope } from '#internal/runtime/turbopack/remote-scope-setup';\nimport { initializeSharedModules } from '#internal/runtime/turbopack/shared-modules';\nimport type { MountUnmountFunctions, RSCKey } from '#internal/runtime/types';\n\n// initializer for the turbopack runtime to be able to access modules\n// required to run exposed client components of the remote component\nexport async function turbopackRuntime(\n url: URL,\n bundle?: string,\n shared?: Record<string, () => Promise<unknown>>,\n remoteShared?: Record<string, string>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\n // webpack runtime globals\n __webpack_require__: (remoteId: string) => unknown;\n // webpack remote module loading function scoped for each bundle\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string) => unknown) & {\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n }\n >;\n // webpack module map for each bundle used in production builds\n __remote_webpack_module_map__?: Record<string, Record<string, number>>;\n // conditional flag to disable webpack exec\n __DISABLE_WEBPACK_EXEC__: boolean;\n // webpack chunk loading function\n __webpack_chunk_load__: () => Promise<[]>;\n } & MountUnmountFunctions &\n Record<RSCKey, string[]>;\n\n const hostShared = buildHostShared(shared, resolveClientUrl, {\n includeRemoteComponentShared: true,\n });\n\n // Phase 1: Set up globals (__webpack_require__, __webpack_chunk_load__).\n // Called with empty scripts because we need the globals to exist before\n // importing react-server-dom-webpack. Shared module initialization is\n // deferred to preloadScripts where turbopack chunks are actually loaded.\n await setupRemoteScope('turbopack', [], url, bundle, resolveClientUrl);\n\n // we can only import react-server-dom-webpack after initializing the __webpack_require__ and __webpack_chunk_load__ functions\n const {\n default: { createFromReadableStream },\n } = await import('react-server-dom-webpack/client.browser');\n\n async function preloadScripts(scripts: HTMLScriptElement[], __: URL) {\n // Phase 2: Load turbopack chunks (scope is reused from phase 1).\n const scope = await setupRemoteScope(\n 'turbopack',\n scripts.map((script) => ({\n src:\n script.getAttribute('src') ||\n script.getAttribute('data-src') ||\n script.src,\n })),\n url,\n bundle,\n resolveClientUrl,\n );\n\n // Phase 3: Initialize shared modules now that turbopackModules is\n // populated. This uses the primary bundle-introspection path which\n // maps shared modules by numeric turbopack ID — unlike the fallback\n // path that uses file-path keys which can't match at runtime.\n await initializeSharedModules(\n scope,\n buildCoreShared(hostShared),\n remoteShared ?? {},\n );\n }\n\n return {\n self,\n createFromReadableStream,\n applySharedModules,\n nextClientPagesLoader,\n preloadScripts,\n };\n}\n"],"mappings":"
|
|
1
|
+
{"version":3,"sources":["../src/host/html/runtime/turbopack.ts"],"sourcesContent":["import { applySharedModules } from '#internal/config/webpack/apply-shared-modules';\nimport { nextClientPagesLoader } from '#internal/config/webpack/next-client-pages-loader';\nimport type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport {\n buildCoreShared,\n buildHostShared,\n} from '#internal/host/shared/shared-module-resolver';\nimport { setupRemoteScope } from '#internal/runtime/turbopack/remote-scope-setup';\nimport { initializeSharedModules } from '#internal/runtime/turbopack/shared-modules';\nimport type { MountUnmountFunctions, RSCKey } from '#internal/runtime/types';\n\n// initializer for the turbopack runtime to be able to access modules\n// required to run exposed client components of the remote component\nexport async function turbopackRuntime(\n url: URL,\n bundle?: string,\n shared?: Record<string, () => Promise<unknown>>,\n remoteShared?: Record<string, string>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\n // webpack runtime globals\n __webpack_require__: (remoteId: string) => unknown;\n // webpack remote module loading function scoped for each bundle\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string) => unknown) & {\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n }\n >;\n // webpack module map for each bundle used in production builds\n __remote_webpack_module_map__?: Record<string, Record<string, number>>;\n // conditional flag to disable webpack exec\n __DISABLE_WEBPACK_EXEC__: boolean;\n // webpack chunk loading function\n __webpack_chunk_load__: () => Promise<[]>;\n } & MountUnmountFunctions &\n Record<RSCKey, string[]>;\n\n const hostShared = buildHostShared(shared, resolveClientUrl, {\n includeRemoteComponentShared: true,\n });\n\n // Phase 1: Set up globals (__webpack_require__, __webpack_chunk_load__).\n // Called with empty scripts because we need the globals to exist before\n // importing react-server-dom-webpack. Shared module initialization is\n // deferred to preloadScripts where turbopack chunks are actually loaded.\n await setupRemoteScope('turbopack', [], url, bundle, resolveClientUrl);\n\n // we can only import react-server-dom-webpack after initializing the __webpack_require__ and __webpack_chunk_load__ functions\n const {\n default: { createFromReadableStream },\n } = await import('react-server-dom-webpack/client.browser');\n\n async function preloadScripts(scripts: HTMLScriptElement[], __: URL) {\n // Phase 2: Load turbopack chunks (scope is reused from phase 1).\n const scope = await setupRemoteScope(\n 'turbopack',\n scripts.map((script) => ({\n src:\n script.getAttribute('src') ||\n script.getAttribute('data-src') ||\n script.src,\n })),\n url,\n bundle,\n resolveClientUrl,\n );\n\n // Phase 3: Initialize shared modules now that turbopackModules is\n // populated. This uses the primary bundle-introspection path which\n // maps shared modules by numeric turbopack ID — unlike the fallback\n // path that uses file-path keys which can't match at runtime.\n await initializeSharedModules(\n scope,\n buildCoreShared(hostShared),\n remoteShared ?? {},\n );\n }\n\n return {\n self,\n createFromReadableStream,\n applySharedModules,\n nextClientPagesLoader,\n preloadScripts,\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,eAAsB,iBACpB,KACA,QACA,QACA,cACA,kBACA;AAEA,QAAM,OAAO;AAmBb,QAAM,aAAa,gBAAgB,QAAQ,kBAAkB;AAAA,IAC3D,8BAA8B;AAAA,EAChC,CAAC;AAMD,QAAM,iBAAiB,aAAa,CAAC,GAAG,KAAK,QAAQ,gBAAgB;AAGrE,QAAM;AAAA,IACJ,SAAS,EAAE,yBAAyB;AAAA,EACtC,IAAI,MAAM,OAAO,yCAAyC;AAE1D,iBAAe,eAAe,SAA8B,IAAS;AAEnE,UAAM,QAAQ,MAAM;AAAA,MAClB;AAAA,MACA,QAAQ,IAAI,CAAC,YAAY;AAAA,QACvB,KACE,OAAO,aAAa,KAAK,KACzB,OAAO,aAAa,UAAU,KAC9B,OAAO;AAAA,MACX,EAAE;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAMA,UAAM;AAAA,MACJ;AAAA,MACA,gBAAgB,UAAU;AAAA,MAC1B,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkEYALF655cjs = require('./chunk-EYALF655.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
|
-
var
|
|
8
|
+
var _chunkJJTCFQHEcjs = require('./chunk-JJTCFQHE.cjs');
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
13
|
-
require('./chunk-
|
|
12
|
+
var _chunkRLI4YTBJcjs = require('./chunk-RLI4YTBJ.cjs');
|
|
13
|
+
require('./chunk-Z2SLBFQL.cjs');
|
|
14
|
+
require('./chunk-5KTAEO52.cjs');
|
|
14
15
|
require('./chunk-RUWR74XQ.cjs');
|
|
15
16
|
require('./chunk-KE7QPAQ4.cjs');
|
|
16
17
|
require('./chunk-SHFJ5OQA.cjs');
|
|
@@ -18,15 +19,15 @@ require('./chunk-SHFJ5OQA.cjs');
|
|
|
18
19
|
// src/host/html/runtime/turbopack.ts
|
|
19
20
|
async function turbopackRuntime(url, bundle, shared, remoteShared, resolveClientUrl) {
|
|
20
21
|
const self = globalThis;
|
|
21
|
-
const hostShared =
|
|
22
|
+
const hostShared = _chunkRLI4YTBJcjs.buildHostShared.call(void 0, shared, resolveClientUrl, {
|
|
22
23
|
includeRemoteComponentShared: true
|
|
23
24
|
});
|
|
24
|
-
await
|
|
25
|
+
await _chunkEYALF655cjs.setupRemoteScope.call(void 0, "turbopack", [], url, bundle, resolveClientUrl);
|
|
25
26
|
const {
|
|
26
27
|
default: { createFromReadableStream }
|
|
27
28
|
} = await Promise.resolve().then(() => _interopRequireWildcard(require("react-server-dom-webpack/client.browser")));
|
|
28
29
|
async function preloadScripts(scripts, __) {
|
|
29
|
-
const scope = await
|
|
30
|
+
const scope = await _chunkEYALF655cjs.setupRemoteScope.call(void 0,
|
|
30
31
|
"turbopack",
|
|
31
32
|
scripts.map((script) => ({
|
|
32
33
|
src: script.getAttribute("src") || script.getAttribute("data-src") || script.src
|
|
@@ -35,21 +36,21 @@ async function turbopackRuntime(url, bundle, shared, remoteShared, resolveClient
|
|
|
35
36
|
bundle,
|
|
36
37
|
resolveClientUrl
|
|
37
38
|
);
|
|
38
|
-
await
|
|
39
|
+
await _chunkEYALF655cjs.initializeSharedModules.call(void 0,
|
|
39
40
|
scope,
|
|
40
|
-
|
|
41
|
+
_chunkRLI4YTBJcjs.buildCoreShared.call(void 0, hostShared),
|
|
41
42
|
_nullishCoalesce(remoteShared, () => ( {}))
|
|
42
43
|
);
|
|
43
44
|
}
|
|
44
45
|
return {
|
|
45
46
|
self,
|
|
46
47
|
createFromReadableStream,
|
|
47
|
-
applySharedModules:
|
|
48
|
-
nextClientPagesLoader:
|
|
48
|
+
applySharedModules: _chunkJJTCFQHEcjs.applySharedModules,
|
|
49
|
+
nextClientPagesLoader: _chunkJJTCFQHEcjs.nextClientPagesLoader,
|
|
49
50
|
preloadScripts
|
|
50
51
|
};
|
|
51
52
|
}
|
|
52
53
|
|
|
53
54
|
|
|
54
55
|
exports.turbopackRuntime = turbopackRuntime;
|
|
55
|
-
//# sourceMappingURL=turbopack-
|
|
56
|
+
//# sourceMappingURL=turbopack-PSD4THQE.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/host/html/runtime/turbopack.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAaA,eAAsB,iBACpB,KACA,QACA,QACA,cACA,kBACA;AAEA,QAAM,OAAO;AAmBb,QAAM,aAAa,gBAAgB,QAAQ,kBAAkB;AAAA,IAC3D,8BAA8B;AAAA,EAChC,CAAC;AAMD,QAAM,iBAAiB,aAAa,CAAC,GAAG,KAAK,QAAQ,gBAAgB;AAGrE,QAAM;AAAA,IACJ,SAAS,EAAE,yBAAyB;AAAA,EACtC,IAAI,MAAM,OAAO,yCAAyC;AAE1D,iBAAe,eAAe,SAA8B,IAAS;AAEnE,UAAM,QAAQ,MAAM;AAAA,MAClB;AAAA,MACA,QAAQ,IAAI,CAAC,YAAY;AAAA,QACvB,KACE,OAAO,aAAa,KAAK,KACzB,OAAO,aAAa,UAAU,KAC9B,OAAO;AAAA,MACX,EAAE;AAAA,MACF;AAAA,MACA;AAAA,MACA;AAAA,IACF;AAMA,UAAM;AAAA,MACJ;AAAA,MACA,gBAAgB,UAAU;AAAA,MAC1B,gBAAgB,CAAC;AAAA,IACnB;AAAA,EACF;AAEA,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,EACF;AACF","sourcesContent":["import { applySharedModules } from '#internal/config/webpack/apply-shared-modules';\nimport { nextClientPagesLoader } from '#internal/config/webpack/next-client-pages-loader';\nimport type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport {\n buildCoreShared,\n buildHostShared,\n} from '#internal/host/shared/shared-module-resolver';\nimport { setupRemoteScope } from '#internal/runtime/turbopack/remote-scope-setup';\nimport { initializeSharedModules } from '#internal/runtime/turbopack/shared-modules';\nimport type { MountUnmountFunctions, RSCKey } from '#internal/runtime/types';\n\n// initializer for the turbopack runtime to be able to access modules\n// required to run exposed client components of the remote component\nexport async function turbopackRuntime(\n url: URL,\n bundle?: string,\n shared?: Record<string, () => Promise<unknown>>,\n remoteShared?: Record<string, string>,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\n // webpack runtime globals\n __webpack_require__: (remoteId: string) => unknown;\n // webpack remote module loading function scoped for each bundle\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string) => unknown) & {\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n }\n >;\n // webpack module map for each bundle used in production builds\n __remote_webpack_module_map__?: Record<string, Record<string, number>>;\n // conditional flag to disable webpack exec\n __DISABLE_WEBPACK_EXEC__: boolean;\n // webpack chunk loading function\n __webpack_chunk_load__: () => Promise<[]>;\n } & MountUnmountFunctions &\n Record<RSCKey, string[]>;\n\n const hostShared = buildHostShared(shared, resolveClientUrl, {\n includeRemoteComponentShared: true,\n });\n\n // Phase 1: Set up globals (__webpack_require__, __webpack_chunk_load__).\n // Called with empty scripts because we need the globals to exist before\n // importing react-server-dom-webpack. Shared module initialization is\n // deferred to preloadScripts where turbopack chunks are actually loaded.\n await setupRemoteScope('turbopack', [], url, bundle, resolveClientUrl);\n\n // we can only import react-server-dom-webpack after initializing the __webpack_require__ and __webpack_chunk_load__ functions\n const {\n default: { createFromReadableStream },\n } = await import('react-server-dom-webpack/client.browser');\n\n async function preloadScripts(scripts: HTMLScriptElement[], __: URL) {\n // Phase 2: Load turbopack chunks (scope is reused from phase 1).\n const scope = await setupRemoteScope(\n 'turbopack',\n scripts.map((script) => ({\n src:\n script.getAttribute('src') ||\n script.getAttribute('data-src') ||\n script.src,\n })),\n url,\n bundle,\n resolveClientUrl,\n );\n\n // Phase 3: Initialize shared modules now that turbopackModules is\n // populated. This uses the primary bundle-introspection path which\n // maps shared modules by numeric turbopack ID — unlike the fallback\n // path that uses file-path keys which can't match at runtime.\n await initializeSharedModules(\n scope,\n buildCoreShared(hostShared),\n remoteShared ?? {},\n );\n }\n\n return {\n self,\n createFromReadableStream,\n applySharedModules,\n nextClientPagesLoader,\n preloadScripts,\n };\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { RemoteComponentMetadata } from './internal/runtime/metadata.js';
|
|
2
|
+
import React__default from 'react';
|
|
2
3
|
import { RemoteScope } from './internal/runtime/turbopack/remote-scope.js';
|
|
3
4
|
|
|
4
5
|
/**
|
|
@@ -30,6 +31,12 @@ interface RemoteComponentsNamespace {
|
|
|
30
31
|
hostSharedModules: Record<string, () => Promise<unknown>>;
|
|
31
32
|
/** @see `__remote_next_css__` */
|
|
32
33
|
cssCache: Record<string, ChildNode[]>;
|
|
34
|
+
pageComponentCache?: Record<string, {
|
|
35
|
+
Component: React__default.ComponentType<Record<string, unknown>> | null;
|
|
36
|
+
App: React__default.ComponentType<{
|
|
37
|
+
Component: React__default.ComponentType<Record<string, unknown>>;
|
|
38
|
+
} & Record<string, unknown>> | null;
|
|
39
|
+
}>;
|
|
33
40
|
/** @see `__remote_components_shadowroot_*` */
|
|
34
41
|
shadowRoots: Record<string, ShadowRoot | null>;
|
|
35
42
|
}
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import {
|
|
2
2
|
loadScripts
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-AKOMV2UF.js";
|
|
4
4
|
import {
|
|
5
5
|
applySharedModules,
|
|
6
6
|
nextClientPagesLoader
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-MKO52FRO.js";
|
|
8
8
|
import {
|
|
9
9
|
NEXT_BUNDLE_PATH_RE,
|
|
10
10
|
buildHostShared,
|
|
11
11
|
buildWebpackResolve
|
|
12
|
-
} from "./chunk-
|
|
13
|
-
import "./chunk-
|
|
12
|
+
} from "./chunk-SAGYPGIQ.js";
|
|
13
|
+
import "./chunk-D5GNZB6O.js";
|
|
14
|
+
import "./chunk-STIJO4AG.js";
|
|
14
15
|
import {
|
|
15
16
|
RemoteComponentsError
|
|
16
17
|
} from "./chunk-S2A4TFLS.js";
|
|
@@ -89,4 +90,4 @@ async function webpackRuntime(bundle, shared, remoteShared, resolveClientUrl) {
|
|
|
89
90
|
export {
|
|
90
91
|
webpackRuntime
|
|
91
92
|
};
|
|
92
|
-
//# sourceMappingURL=webpack-
|
|
93
|
+
//# sourceMappingURL=webpack-KSDNIXMS.js.map
|