remote-components 0.4.2 → 0.4.3

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.
Files changed (114) hide show
  1. package/dist/{chunk-KVQI55BZ.cjs → chunk-2W7JBTID.cjs} +37 -36
  2. package/dist/chunk-2W7JBTID.cjs.map +1 -0
  3. package/dist/{chunk-TZT7DLO5.cjs → chunk-3AX5WLZD.cjs} +4 -4
  4. package/dist/{chunk-4O3EOST4.cjs → chunk-4AH3KXDW.cjs} +27 -27
  5. package/dist/{chunk-MTMDXJLM.js → chunk-4NW46ZVD.js} +410 -146
  6. package/dist/chunk-4NW46ZVD.js.map +1 -0
  7. package/dist/{chunk-SAGYPGIQ.js → chunk-55TEMSB5.js} +92 -23
  8. package/dist/chunk-55TEMSB5.js.map +1 -0
  9. package/dist/{chunk-RLI4YTBJ.cjs → chunk-7XXO2DLF.cjs} +96 -27
  10. package/dist/chunk-7XXO2DLF.cjs.map +1 -0
  11. package/dist/{chunk-RUWR74XQ.cjs → chunk-BBXVML3D.cjs} +1 -1
  12. package/dist/{chunk-RUWR74XQ.cjs.map → chunk-BBXVML3D.cjs.map} +1 -1
  13. package/dist/{chunk-42TVDI3G.cjs → chunk-C5EYU7EQ.cjs} +7 -7
  14. package/dist/{chunk-CC3WOSDO.js → chunk-DGZVFKSQ.js} +10 -9
  15. package/dist/chunk-DGZVFKSQ.js.map +1 -0
  16. package/dist/{chunk-AKOMV2UF.js → chunk-HL6BL5HY.js} +3 -3
  17. package/dist/chunk-HMB3SIVJ.cjs +973 -0
  18. package/dist/chunk-HMB3SIVJ.cjs.map +1 -0
  19. package/dist/{chunk-LOYJP2V2.js → chunk-HYVNEUIK.js} +5 -5
  20. package/dist/chunk-KV5J7PNM.js +152 -0
  21. package/dist/chunk-KV5J7PNM.js.map +1 -0
  22. package/dist/{chunk-LQ7VQ74E.js → chunk-LEKG4YWI.js} +2 -2
  23. package/dist/chunk-SECN7UAL.cjs +152 -0
  24. package/dist/chunk-SECN7UAL.cjs.map +1 -0
  25. package/dist/{chunk-S2A4TFLS.js → chunk-ULXU6XWH.js} +1 -1
  26. package/dist/{chunk-S2A4TFLS.js.map → chunk-ULXU6XWH.js.map} +1 -1
  27. package/dist/config/nextjs.cjs +7 -7
  28. package/dist/config/nextjs.js +2 -2
  29. package/dist/host/html.cjs +36 -36
  30. package/dist/host/html.js +10 -10
  31. package/dist/host/nextjs/app/client-only.cjs +17 -17
  32. package/dist/host/nextjs/app/client-only.js +8 -8
  33. package/dist/host/react.cjs +9 -9
  34. package/dist/host/react.js +8 -8
  35. package/dist/internal/config/webpack/next-client-pages-loader.cjs +151 -53
  36. package/dist/internal/config/webpack/next-client-pages-loader.cjs.map +1 -1
  37. package/dist/internal/config/webpack/next-client-pages-loader.d.ts +8 -4
  38. package/dist/internal/config/webpack/next-client-pages-loader.js +153 -53
  39. package/dist/internal/config/webpack/next-client-pages-loader.js.map +1 -1
  40. package/dist/internal/host/shared/pipeline.d.ts +1 -1
  41. package/dist/internal/host/shared/shared-broker.cjs +106 -0
  42. package/dist/internal/host/shared/shared-broker.cjs.map +1 -0
  43. package/dist/internal/host/shared/shared-broker.d.ts +35 -0
  44. package/dist/internal/host/shared/shared-broker.js +80 -0
  45. package/dist/internal/host/shared/shared-broker.js.map +1 -0
  46. package/dist/internal/host/shared/shared-module-resolver.cjs +13 -22
  47. package/dist/internal/host/shared/shared-module-resolver.cjs.map +1 -1
  48. package/dist/internal/host/shared/shared-module-resolver.d.ts +1 -1
  49. package/dist/internal/host/shared/shared-module-resolver.js +16 -22
  50. package/dist/internal/host/shared/shared-module-resolver.js.map +1 -1
  51. package/dist/internal/runtime/loaders/component-loader.cjs +2 -1
  52. package/dist/internal/runtime/loaders/component-loader.cjs.map +1 -1
  53. package/dist/internal/runtime/loaders/component-loader.d.ts +1 -1
  54. package/dist/internal/runtime/loaders/component-loader.js +2 -1
  55. package/dist/internal/runtime/loaders/component-loader.js.map +1 -1
  56. package/dist/internal/runtime/loaders/static-loader.d.ts +1 -1
  57. package/dist/internal/runtime/namespace.d.ts +1 -1
  58. package/dist/internal/runtime/turbopack/module.cjs +26 -4
  59. package/dist/internal/runtime/turbopack/module.cjs.map +1 -1
  60. package/dist/internal/runtime/turbopack/module.d.ts +14 -7
  61. package/dist/internal/runtime/turbopack/module.js +27 -5
  62. package/dist/internal/runtime/turbopack/module.js.map +1 -1
  63. package/dist/internal/runtime/turbopack/remote-scope-setup.cjs +5 -4
  64. package/dist/internal/runtime/turbopack/remote-scope-setup.cjs.map +1 -1
  65. package/dist/internal/runtime/turbopack/remote-scope-setup.js +5 -4
  66. package/dist/internal/runtime/turbopack/remote-scope-setup.js.map +1 -1
  67. package/dist/internal/runtime/turbopack/shared-modules.cjs +113 -26
  68. package/dist/internal/runtime/turbopack/shared-modules.cjs.map +1 -1
  69. package/dist/internal/runtime/turbopack/shared-modules.d.ts +3 -1
  70. package/dist/internal/runtime/turbopack/shared-modules.js +116 -26
  71. package/dist/internal/runtime/turbopack/shared-modules.js.map +1 -1
  72. package/dist/internal/runtime/types.cjs.map +1 -1
  73. package/dist/internal/runtime/types.d.ts +1 -1
  74. package/dist/internal/utils/logger.cjs.map +1 -1
  75. package/dist/internal/utils/logger.d.ts +1 -1
  76. package/dist/internal/utils/logger.js.map +1 -1
  77. package/dist/remote/html.cjs +6 -6
  78. package/dist/remote/html.js +2 -2
  79. package/dist/{script-VPOI7ARP.js → script-ISAHSV3X.js} +3 -3
  80. package/dist/{script-D5AD7HLV.cjs → script-YQCDUYDP.cjs} +4 -4
  81. package/dist/static-loader-EOJQHFZ6.cjs +11 -0
  82. package/dist/{static-loader-OHSAUD62.js → static-loader-Z24427MK.js} +3 -3
  83. package/dist/{turbopack-5N44NVPT.js → turbopack-7F757Z7V.js} +6 -6
  84. package/dist/{turbopack-EPXGK4EV.cjs → turbopack-DULMVTWV.cjs} +12 -12
  85. package/dist/{types-8b0edd78.d.ts → types-bd7be268.d.ts} +1 -5
  86. package/dist/{webpack-SIFRCBIN.cjs → webpack-6LXCB7WA.cjs} +14 -14
  87. package/dist/{webpack-KSDNIXMS.js → webpack-WGVTKJ3W.js} +5 -5
  88. package/package.json +1 -1
  89. package/dist/chunk-CC3WOSDO.js.map +0 -1
  90. package/dist/chunk-JJTCFQHE.cjs +0 -202
  91. package/dist/chunk-JJTCFQHE.cjs.map +0 -1
  92. package/dist/chunk-KVQI55BZ.cjs.map +0 -1
  93. package/dist/chunk-MKO52FRO.js +0 -202
  94. package/dist/chunk-MKO52FRO.js.map +0 -1
  95. package/dist/chunk-MQ2BBSL4.cjs +0 -709
  96. package/dist/chunk-MQ2BBSL4.cjs.map +0 -1
  97. package/dist/chunk-MTMDXJLM.js.map +0 -1
  98. package/dist/chunk-RLI4YTBJ.cjs.map +0 -1
  99. package/dist/chunk-SAGYPGIQ.js.map +0 -1
  100. package/dist/static-loader-UDIXK5MV.cjs +0 -11
  101. /package/dist/{chunk-TZT7DLO5.cjs.map → chunk-3AX5WLZD.cjs.map} +0 -0
  102. /package/dist/{chunk-4O3EOST4.cjs.map → chunk-4AH3KXDW.cjs.map} +0 -0
  103. /package/dist/{chunk-42TVDI3G.cjs.map → chunk-C5EYU7EQ.cjs.map} +0 -0
  104. /package/dist/{chunk-AKOMV2UF.js.map → chunk-HL6BL5HY.js.map} +0 -0
  105. /package/dist/{chunk-LOYJP2V2.js.map → chunk-HYVNEUIK.js.map} +0 -0
  106. /package/dist/{chunk-LQ7VQ74E.js.map → chunk-LEKG4YWI.js.map} +0 -0
  107. /package/dist/{script-VPOI7ARP.js.map → script-ISAHSV3X.js.map} +0 -0
  108. /package/dist/{script-D5AD7HLV.cjs.map → script-YQCDUYDP.cjs.map} +0 -0
  109. /package/dist/{static-loader-UDIXK5MV.cjs.map → static-loader-EOJQHFZ6.cjs.map} +0 -0
  110. /package/dist/{static-loader-OHSAUD62.js.map → static-loader-Z24427MK.js.map} +0 -0
  111. /package/dist/{turbopack-5N44NVPT.js.map → turbopack-7F757Z7V.js.map} +0 -0
  112. /package/dist/{turbopack-EPXGK4EV.cjs.map → turbopack-DULMVTWV.cjs.map} +0 -0
  113. /package/dist/{webpack-SIFRCBIN.cjs.map → webpack-6LXCB7WA.cjs.map} +0 -0
  114. /package/dist/{webpack-KSDNIXMS.js.map → webpack-WGVTKJ3W.js.map} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/config/webpack/apply-shared-modules.ts","../src/runtime/turbopack/patterns.ts","../src/runtime/turbopack/chunk-loader.ts","../src/runtime/turbopack/module.ts","../src/runtime/turbopack/shared-modules.ts","../src/config/webpack/next-client-pages-loader.ts"],"sourcesContent":["// Webpack shared module patching\n// used in multiple remote component host types\n// multiple host types includes: HTML custom element for remote components and Next.js host application\n// we are using this shared function to patch a Webpack module map\n// to use shared modules between the host application and the remote component\n\nimport { getScope } from '#internal/runtime/turbopack/remote-scope';\nimport { logDebug, logWarn } from '#internal/utils/logger';\n\nconst DEDUPLICATION_SKIPPED =\n 'shared module deduplication skipped. The remote may load its own copy of shared dependencies.';\n\nexport function applySharedModules(\n bundle: string,\n resolve: Record<string, unknown>,\n) {\n logDebug(\n 'SharedModules',\n `applySharedModules called for bundle: \"${bundle}\"`,\n );\n logDebug(\n 'SharedModules',\n `Shared modules to resolve: ${Object.keys(resolve)}`,\n );\n\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\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 } & Record<string, string[]>;\n\n // Prefer scope-based access when available.\n const scope = getScope(bundle);\n // @legacy(v0.3.4) — fall back to global __remote_webpack_require__ for hosts that\n // haven't run setupWebpackRuntime yet (e.g. HTML host's inline path).\n // Remove once all host types go through the shared pipeline (Phase 5).\n const webpackBundle =\n scope?.webpackRequire ?? self.__remote_webpack_require__?.[bundle];\n\n if (webpackBundle) {\n const modulePaths = Object.keys(\n self.__remote_webpack_module_map__?.[bundle] ?? webpackBundle.m ?? {},\n );\n logDebug(\n 'SharedModules',\n `Available module paths for bundle \"${bundle}\": ${modulePaths}`,\n );\n\n // patch all modules in the bundle to use the shared modules\n for (const [key, value] of Object.entries(resolve)) {\n const exactIds = modulePaths.filter((p) => p === key);\n const ids =\n exactIds.length > 0\n ? exactIds\n : modulePaths.filter((p) => p.includes(key));\n\n if (ids.length === 0) {\n logDebug(\n 'SharedModules',\n `No matching module path found for shared module \"${key}\"`,\n );\n }\n\n for (const id of ids) {\n if (webpackBundle.m) {\n // if we have a module map, we need to use the mapped id\n // this is required for production builds where the module ids are module id numbers\n const resolvedId = self.__remote_webpack_module_map__?.[bundle]?.[id]\n ? `${self.__remote_webpack_module_map__[bundle][id]}`\n : id;\n if (resolvedId !== id) {\n logDebug(\n 'SharedModules',\n `Mapped module id: \"${id}\" -> \"${resolvedId}\"`,\n );\n }\n // create a mock module which exports the shared module\n webpackBundle.m[resolvedId] = (module) => {\n module.exports = value;\n };\n } else {\n logWarn(\n 'SharedModules',\n `webpackBundle.m is not available for bundle \"${bundle}\" — ${DEDUPLICATION_SKIPPED}`,\n );\n }\n }\n }\n } else {\n logWarn(\n 'SharedModules',\n `No webpack require found for bundle \"${bundle}\" — ${DEDUPLICATION_SKIPPED}`,\n );\n logDebug(\n 'SharedModules',\n `Available bundles: ${Object.keys(self.__remote_webpack_require__ ?? {})}`,\n );\n }\n}\n","/**\n * Regex patterns for parsing Turbopack's minified and development code.\n *\n * Turbopack outputs different variable names in dev vs production builds:\n * - Development: __turbopack_context__, parentImport, chunk, self\n * - Minified: e, t, etc.\n *\n * Module IDs are numeric in Next.js 16+ (e.g. `984803`) but full string paths in\n * Next.js 15.x dev mode (e.g. `\"[project]/.../react/index.js [app-client] (ecmascript)\"`).\n * ID-capturing patterns match `\"quoted string\"|digits` via the shared\n * `MODULE_ID_PATTERN` fragment. Use `extractGroup()` to both match and strip quotes\n * in one step.\n */\n\n/** Reusable fragment that matches a turbopack module ID: quoted string or numeric. */\nconst MODULE_ID_PATTERN = '\"[^\"]+\"|[0-9]+';\n\n/** Strips surrounding double-quotes from a captured regex value. */\nfunction stripQuotes(value: string): string {\n if (value.startsWith('\"') && value.endsWith('\"')) {\n return value.slice(1, -1);\n }\n return value;\n}\n\n/**\n * Runs a regex against `input` and returns the named capture group with\n * quotes stripped, or `undefined` if there's no match.\n */\nexport function extractGroup(\n re: RegExp,\n input: string,\n group: string,\n): string | undefined {\n const raw = re.exec(input)?.groups?.[group];\n return raw ? stripQuotes(raw) : undefined;\n}\n\n/**\n * Matches: self.TURBOPACK_REMOTE_SHARED or e.TURBOPACK_REMOTE_SHARED\n *\n * @example\n * // Development:\n * \"self.TURBOPACK_REMOTE_SHARED=await __turbopack_context__.A(984803)\"\n *\n * // Minified:\n * \"e.TURBOPACK_REMOTE_SHARED=await e.A(984803)\"\n */\nexport const REMOTE_SHARED_MARKER_RE =\n /(?:self|[a-z])\\.TURBOPACK_REMOTE_SHARED/;\n\n/**\n * Extracts the module ID from a TURBOPACK_REMOTE_SHARED assignment.\n *\n * Captures:\n * - `sharedModuleId`: The module ID (may be quoted for string paths).\n *\n * @example\n * // Next.js 16:\n * \"self.TURBOPACK_REMOTE_SHARED=await __turbopack_context__.A(984803)\"\n * // -> sharedModuleId = \"984803\"\n *\n * // Next.js 15.x (string IDs, spaces around `=`):\n * 'self.TURBOPACK_REMOTE_SHARED = await __turbopack_context__.A(\"[project]/...app-remote.tsx [app-client] (ecmascript, async loader)\")'\n * // -> sharedModuleId = \"[project]/...app-remote.tsx [app-client] (ecmascript, async loader)\"\n *\n * // Minified:\n * \"t.TURBOPACK_REMOTE_SHARED=await e.A(123456)\"\n * // -> sharedModuleId = \"123456\"\n */\nexport const REMOTE_SHARED_ASSIGNMENT_RE = new RegExp(\n `\\\\.TURBOPACK_REMOTE_SHARED\\\\s*=\\\\s*await (?:__turbopack_context__|[a-z])\\\\.A\\\\((?<sharedModuleId>${MODULE_ID_PATTERN})\\\\)`,\n);\n\n/**\n * Matches async module loader calls: ctx.A(moduleId)\n *\n * Captures:\n * - `asyncSharedModuleId`: The module ID (may be quoted).\n *\n * @example\n * // Next.js 16:\n * \"() => __turbopack_context__.A(460400)\"\n * // -> asyncSharedModuleId = \"460400\"\n *\n * // Next.js 15.x:\n * '() => __turbopack_context__.A(\"[project]/.../react/index.js [app-client] (ecmascript, async loader)\")'\n * // -> asyncSharedModuleId = \"[project]/.../react/index.js [app-client] (ecmascript, async loader)\"\n *\n * // Minified:\n * \"() => e.A(460400)\"\n * // -> asyncSharedModuleId = \"460400\"\n */\nexport const ASYNC_MODULE_LOADER_RE = new RegExp(\n `(?:__turbopack_context__|[a-z])\\\\.A\\\\((?<asyncSharedModuleId>${MODULE_ID_PATTERN})\\\\)`,\n);\n\n/**\n * Extracts the final module ID from an async module `.v()` callback.\n * The callback always ends by calling its argument (parentImport / single-letter\n * variable) with the real module ID. This matches that final call regardless of\n * surrounding structure (whitespace, `return` statements, block vs expression bodies).\n *\n * Handles both Promise.resolve (no extra chunks) and Promise.all (with chunks).\n *\n * Captures:\n * - `sharedModuleId`: The module ID (may be quoted).\n *\n * @example\n * // Next.js 16 minified (Promise.resolve):\n * \"e=>{e.v(e=>Promise.resolve().then(()=>e(633334)))}\"\n * // -> sharedModuleId = \"633334\"\n *\n * // Next.js 16 minified (Promise.all):\n * \"e=>{e.v(t=>Promise.all([\\\"chunk.js\\\"].map(t=>e.l(t))).then(()=>t(633334)))}\"\n * // -> sharedModuleId = \"633334\"\n *\n * // Next.js 15.x development (multi-line):\n * '(__turbopack_context__) => {\\n__turbopack_context__.v((parentImport) => {\\n return Promise.resolve().then(() => {\\n return parentImport(\"[project]/.../react/index.js [app-client] (ecmascript)\");\\n });\\n});\\n}'\n * // -> sharedModuleId = \"[project]/.../react/index.js [app-client] (ecmascript)\"\n */\nexport const ASYNC_MODULE_CALLBACK_RE = new RegExp(\n `(?:parentImport|[a-z])\\\\((?<sharedModuleId>${MODULE_ID_PATTERN})\\\\)`,\n);\n\n/**\n * Detects Turbopack runtime global usage in a chunk.\n *\n * Matches either dot-notation or bracket-notation access off `globalThis` or `self`:\n * - globalThis.TURBOPACK / self.TURBOPACK\n * - globalThis[\"TURBOPACK\"] / self['TURBOPACK'] (whitespace tolerated)\n */\nexport const TURBOPACK_GLOBAL_RE =\n /(?:globalThis|self)\\s*(?:\\.TURBOPACK|\\[\\s*[\"']TURBOPACK[\"']\\s*\\])/;\n","import { RUNTIME_WEBPACK } from '#internal/runtime/constants';\nimport { getNamespace } from '#internal/runtime/namespace';\nimport { collapseDoubleSlashes } from '#internal/runtime/patterns';\nimport type { GlobalScope } from '#internal/runtime/types';\nimport { isProxiedUrl } from '#internal/runtime/url/protected-rc-fallback';\nimport {\n failedProxiedAssetError,\n RemoteComponentsError,\n} from '#internal/utils/error';\nimport {\n logDebug,\n logWarn,\n warnCrossOriginFetchError,\n} from '#internal/utils/logger';\nimport { TURBOPACK_GLOBAL_RE } from './patterns';\nimport {\n formatRemoteId,\n getScope,\n parseRemoteId,\n type RemoteScope,\n} from './remote-scope';\n\n/**\n * Loads a chunk using a specific scope. All state (base URL, proxy callback,\n * TURBOPACK global key) comes from the scope — no global lookups needed.\n *\n * This is the primary chunk loader called directly from:\n * - setupRemoteScope (initial chunks)\n * - TurbopackContext.l (module-level chunk loading)\n * - handleTurbopackChunk (CHUNK_LIST additional chunks)\n *\n * The global chunk dedup cache is keyed by absolute URL, so different origins\n * naturally get separate cache entries even when sharing a bundle name.\n */\nexport function loadChunkWithScope(\n scope: RemoteScope,\n chunkId: string,\n): Promise<unknown> | undefined {\n logDebug(\n 'ChunkLoader',\n `loadChunkWithScope: \"${chunkId}\" (scope: \"${scope.scopedName}\")`,\n );\n const self = globalThis as GlobalScope;\n const ns = getNamespace();\n\n const { bundle, path, prefix } = parseRemoteId(chunkId);\n\n // Skip webpack runtime chunks\n const remoteRuntime = self.__remote_webpack_require__?.[bundle ?? 'default']\n ? self.__remote_webpack_require__[bundle ?? 'default']?.type || 'webpack'\n : scope.runtime;\n if (remoteRuntime === RUNTIME_WEBPACK) {\n return Promise.resolve(undefined);\n }\n\n const rawPath = path ? collapseDoubleSlashes(`${prefix}${path}`) : '/';\n const url = new URL(rawPath, scope.url).href;\n\n if (url.endsWith('.css')) {\n return;\n }\n\n if (ns.chunkCache[url]) {\n logDebug('ChunkLoader', `Cache hit for \"${chunkId}\" (url=\"${url}\")`);\n return ns.chunkCache[url];\n }\n\n const resolvedUrl = scope.resolveClientUrl?.(url) ?? url;\n if (resolvedUrl !== url) {\n logDebug('ChunkLoader', `Proxied chunk URL: \"${url}\" → \"${resolvedUrl}\"`);\n }\n\n ns.chunkCache[url] = new Promise((resolve, reject) => {\n fetch(resolvedUrl)\n .then((res) => res.text())\n .then((code) => {\n const hasTurbopack = TURBOPACK_GLOBAL_RE.test(code);\n if (hasTurbopack) {\n return handleTurbopackChunk(code, scope, url);\n }\n // Chunk doesn't contain Turbopack globals — nothing to process\n })\n .then(resolve)\n .catch((error) => {\n const isProxied = isProxiedUrl(resolvedUrl);\n if (isProxied) {\n reject(failedProxiedAssetError('chunk', url, resolvedUrl));\n } else {\n warnCrossOriginFetchError('ChunkLoader', url);\n reject(error);\n }\n });\n });\n\n return ns.chunkCache[url];\n}\n\n/**\n * Creates the global `__webpack_chunk_load__` dispatcher.\n * This is a thin wrapper called only by external code (React's RSC runtime).\n * It parses the chunkId, resolves the correct scope, and delegates to\n * `loadChunkWithScope`.\n */\nexport function createChunkDispatcher(): (\n chunkId: string,\n scriptBundle?: string,\n) => Promise<unknown> | undefined {\n return function __chunk_dispatcher__(chunkId: string, scriptBundle?: string) {\n logDebug('ChunkDispatcher', `Dispatching chunk: \"${chunkId}\"`);\n\n const { bundle } = parseRemoteId(chunkId);\n const bundleName = bundle || scriptBundle || 'default';\n\n // Works with both the scoped name (Next.js hosts with server-side\n // rewriting) and the plain bundle name (static/HTML hosts).\n const scope = getScope(bundleName);\n\n logDebug(\n 'ChunkDispatcher',\n `Scope resolution: bundle=\"${bundleName}\", scope=${scope?.scopedName ?? 'null'}`,\n );\n\n if (!scope) {\n logWarn('ChunkDispatcher', `No scope found for bundle \"${bundleName}\"`);\n return Promise.resolve(undefined);\n }\n\n return loadChunkWithScope(scope, chunkId);\n };\n}\n\n/**\n * Handles Turbopack chunk loading by transforming the chunk code to isolate\n * global variables per bundle and dynamically loading the transformed script.\n * Receives scope directly — no global state lookups needed.\n */\nasync function handleTurbopackChunk(\n code: string,\n scope: RemoteScope,\n url: string,\n): Promise<void> {\n // skip this chunk as it is not needed for remote components\n if (/importScripts\\(\\.\\.\\.self.TURBOPACK_NEXT_CHUNK_URLS/.test(code)) {\n const preloadLinks = document.querySelectorAll(\n `link[rel=\"preload\"][href=\"${new URL(url).pathname}\"]`,\n );\n preloadLinks.forEach((preloadLink) => preloadLink.remove());\n return;\n }\n\n const self = globalThis as GlobalScope;\n const { globalKey } = scope;\n\n // replace global variables with scope-specific ones to prevent collisions\n // between multiple remote component bundles\n const transformedCode = code\n .replace(\n /globalThis\\[\\s*[\"']TURBOPACK[\"']\\s*\\]/g,\n `globalThis[\"TURBOPACK_${globalKey}\"]`,\n )\n .replace(\n /self\\[\\s*[\"']TURBOPACK[\"']\\s*\\]/g,\n `self[\"TURBOPACK_${globalKey}\"]`,\n )\n .replace(/globalThis\\.TURBOPACK/g, `globalThis.TURBOPACK_${globalKey}`)\n .replace(/self\\.TURBOPACK(?!_)/g, `self.TURBOPACK_${globalKey}`)\n .replace(\n /TURBOPACK_WORKER_LOCATION/g,\n `TURBOPACK_WORKER_LOCATION_${globalKey}`,\n )\n .replace(\n /TURBOPACK_NEXT_CHUNK_URLS/g,\n `TURBOPACK_NEXT_CHUNK_URLS_${globalKey}`,\n )\n .replace(/TURBOPACK_CHUNK_LISTS/g, `TURBOPACK_CHUNK_LISTS_${globalKey}`)\n .replace(\n /TURBOPACK_CHUNK_UPDATE_LISTENERS/g,\n `TURBOPACK_CHUNK_UPDATE_LISTENERS_${globalKey}`,\n )\n .replace(/__next_require__/g, `__${globalKey}_next_require__`)\n .replace(\n /\\/\\/# sourceMappingURL=(?<name>.+)(?<optional>\\._)?\\.js\\.map/g,\n `//# sourceMappingURL=${new URL('.', new URL(url, scope.url)).href}$1$2.js.map`,\n );\n\n // Initialize TURBOPACK bundle as a real Array with a push interceptor.\n // Must be a true Array instance so Next.js 15.x turbopack runtimes whose\n // module-system IIFE guards with `Array.isArray(globalThis.TURBOPACK)`\n // don't bail out after we rewrite the global name.\n //\n // The interceptor captures module entries into scope.turbopackModules —\n // a flat array we control. We use Object.defineProperty to intercept\n // when the turbopack runtime replaces the global with a deferred-loading\n // dispatcher (canary builds), wrapping the replacement's push too.\n //\n // The scope is reused across loads of different components from the same\n // remote (see setupRemoteScope), so subsequent loads accumulate into\n // the same turbopackModules array. Chunk cache deduplication means\n // handleTurbopackChunk only runs once per unique chunk URL — all captured\n // modules remain available for any component that needs them.\n if (!self[`TURBOPACK_${globalKey}`]) {\n const wrapPush = <T extends { push?: (...args: unknown[]) => unknown }>(\n target: T,\n ): T => {\n const originalPush = target.push;\n if (typeof originalPush !== 'function') return target;\n target.push = (...items: unknown[]) => {\n for (const item of items) {\n if (Array.isArray(item)) {\n for (const entry of item) {\n scope.turbopackModules.push(entry);\n }\n } else {\n scope.turbopackModules.push(item);\n }\n }\n return originalPush.apply(target, items);\n };\n return target;\n };\n\n const globalProp = `TURBOPACK_${globalKey}`;\n let currentValue: unknown = wrapPush([] as unknown[]);\n Object.defineProperty(self, globalProp, {\n get() {\n return currentValue;\n },\n set(newValue: unknown) {\n // When the turbopack runtime replaces the array with a dispatcher,\n // wrap the new object's push so we keep capturing module entries.\n if (newValue && typeof newValue === 'object') {\n wrapPush(newValue as { push?: (...args: unknown[]) => unknown });\n }\n currentValue = newValue;\n },\n configurable: true,\n enumerable: true,\n });\n }\n\n // load the script dynamically using a Blob URL\n await new Promise<void>((scriptResolve, scriptReject) => {\n const blob = new Blob([transformedCode], {\n type: 'application/javascript; charset=UTF-8',\n });\n const scriptUrl = URL.createObjectURL(blob);\n const script = document.createElement('script');\n script.setAttribute('data-turbopack-src', url);\n script.src = scriptUrl;\n script.async = true;\n script.onload = () => {\n URL.revokeObjectURL(scriptUrl);\n scriptResolve(undefined);\n script.remove();\n };\n script.onerror = () => {\n URL.revokeObjectURL(scriptUrl);\n scriptReject(\n new RemoteComponentsError(\n `Failed to load <script src=\"${script.src}\"> for Remote Component. Check the URL is correct.`,\n ),\n );\n script.remove();\n };\n document.head.appendChild(script);\n });\n\n // process any additional chunks that were registered during script execution\n // These CHUNK_LIST chunks load directly via scope — no global dispatch needed.\n const chunkLists = self[`TURBOPACK_${globalKey}_CHUNK_LISTS`] as\n | { chunks: string[] }[]\n | undefined;\n const loadChunkPromises: (Promise<unknown> | undefined)[] = [];\n while (chunkLists?.length) {\n const { chunks } = chunkLists.shift() ?? { chunks: [] };\n if (chunks.length > 0) {\n for (const id of chunks) {\n const baseUrl = url.slice(0, url.indexOf('/_next'));\n const chunkLoadResult = loadChunkWithScope(\n scope,\n formatRemoteId(scope, `${baseUrl}/_next/${id}`),\n );\n if (chunkLoadResult) {\n loadChunkPromises.push(chunkLoadResult);\n }\n }\n }\n }\n if (loadChunkPromises.length > 0) {\n await Promise.all(loadChunkPromises);\n }\n}\n","import { logDebug, logError } from '#internal/utils/logger';\nimport { loadChunkWithScope } from './chunk-loader';\nimport { formatRemoteId, type RemoteScope } from './remote-scope';\nimport { getSharedModule, getTurbopackModules } from './shared-modules';\n\n/**\n * Function signature for Turbopack module initializers.\n * These functions are generated by Turbopack and initialize module exports.\n */\nexport type TurbopackModuleInit = (\n turbopackContext: TurbopackContext,\n module: TurbopackModule,\n exports: Record<string, unknown>,\n) => void;\n\ninterface TurbopackHotModule {\n active: boolean;\n data: Record<string, unknown>;\n accept(): void;\n dispose(callback?: (data: Record<string, unknown>) => void): void;\n invalidate(): void;\n}\n\ninterface TurbopackModule {\n exports: Record<string, unknown>;\n hot: TurbopackHotModule;\n}\n\n/**\n * The context object passed to Turbopack module initializers.\n * This provides the runtime API that modules use for imports, exports, and HMR.\n */\ninterface TurbopackContext {\n /** HMR (Hot Module Replacement) - not implemented for remote components */\n k: {\n register(): void;\n registerExports(): void;\n signature(): (fn: unknown) => unknown;\n };\n /** ESM exports setup */\n s: (\n bindings:\n | Record<string, () => unknown>\n | [...([string, () => unknown] | [string, number, () => unknown])],\n esmId?: string | number,\n ) => void;\n /** Import module */\n i: (importId: string | number) => Record<string, unknown> | undefined;\n /** Require module */\n r: (requireId: string | number) => unknown;\n /** Value exports */\n v: (value: unknown) => void;\n /** Async module initializer */\n a: (\n mod: (\n handleDeps: unknown,\n setResult: (value: unknown) => void,\n ) => Promise<void>,\n ) => Promise<void>;\n /** Async module loader */\n A: (Aid: string | number) => Promise<unknown>;\n /**\n * Dynamic import tracking. Called in production chunks after ctx.s() to\n * register async/dynamic module relationships. e.g. t.j(importedMod, 58790)\n */\n j: (module: unknown, esmId?: string | number) => void;\n /** Chunk loader */\n l: (url: string) => Promise<unknown> | undefined;\n /** Global object for this bundle */\n g: unknown;\n /** Module object */\n m: TurbopackModule;\n /** Exports object */\n e: Record<string, unknown>;\n}\n\n/**\n * Turbopack pushes chunks as flat arrays in one of two shapes:\n *\n * Module chunk (common case):\n * [scriptElement, id1, factory1, id2, factory2, ...]\n * - index 0: the script Element (document.currentScript) or undefined\n * - alternating pairs: numeric ID (prod) or path string (dev), then factory function\n *\n * Runtime manifest (bootstrapper only, no module factories):\n * [scriptElement, { otherChunks: [...], runtimeModuleIds: [...] }]\n *\n * Newer Next.js canary versions may also store modules as a plain object\n * { [moduleId]: factory } rather than as an array.\n */\ntype BundleModules =\n | (\n | Element\n | string\n | number\n | TurbopackModuleInit\n | Record<string, TurbopackModuleInit>\n | null\n | undefined\n )[]\n | Record<string, TurbopackModuleInit>\n | undefined;\n\n/**\n * Resolves a module within a scope: checks shared modules first, then\n * falls back to Turbopack module resolution. This is the scope-local\n * equivalent of the global __webpack_require__ dispatcher.\n */\nexport function requireModule(\n scope: RemoteScope,\n moduleId: string | number,\n fullId?: string,\n): unknown {\n const idStr = String(moduleId);\n\n // Shared modules are NOT cached in moduleCache because ctx.s() also\n // uses moduleCache for esmId lookups. Caching the host's frozen module\n // object here would cause ctx.s() to attempt Object.defineProperty on\n // it, failing with \"Cannot redefine property\" for non-configurable\n // exports. Keeping shared modules in their own map avoids the collision.\n //\n // Exact shared IDs must win over stale remote moduleCache entries. This is\n // a compatibility guard for the old shared-modules architecture, where a\n // remote chunk can instantiate a shared module before the broker has claimed\n // that ID. Delete this special ordering once all shared modules are resolved\n // through scope adapters before any remote factory can execute.\n const sharedModule = getSharedModule(scope, moduleId);\n if (sharedModule !== null) {\n if (scope.moduleCache[idStr]) {\n logDebug(\n 'TurbopackModule',\n `Shared module \"${idStr}\" resolved from host and overrides a cached remote copy in \"${scope.scopedName}\"`,\n );\n }\n return sharedModule;\n }\n\n // moduleCache is checked first inside handleTurbopackModule too, but\n // checking here keeps non-shared re-entry cheap.\n if (scope.moduleCache[idStr]) return scope.moduleCache[idStr];\n\n return handleTurbopackModule(\n scope,\n idStr,\n fullId ?? formatRemoteId(scope, idStr),\n );\n}\n\n/**\n * Handles Turbopack module resolution and execution.\n * Finds a module in the Turbopack bundle, executes its initializer with a\n * custom runtime context, and returns the module exports.\n */\nexport function handleTurbopackModule(\n scope: RemoteScope,\n moduleId: string,\n id: string,\n): unknown {\n // Cache check must come before module init lookup. Module initializers\n // re-enter handleTurbopackModule for their own imports, so without this\n // guard circular dependencies would infinite-loop.\n if (scope.moduleCache[moduleId]) {\n return scope.moduleCache[moduleId];\n }\n\n const modules = getTurbopackModules(scope) as BundleModules;\n\n // Log only if bundle is completely missing (critical error)\n if (!modules) {\n logError(\n 'TurbopackModule',\n `TURBOPACK_${scope.globalKey} is undefined (scope: \"${scope.scopedName}\")`,\n );\n }\n\n const moduleInit = findModuleInit(modules, moduleId);\n const exports = {} as Record<string, unknown>;\n const moduleExports = {\n exports,\n hot: createNoopHotModule(),\n };\n\n if (typeof moduleInit !== 'function') {\n throw new Error(\n `Module ${id} not found in bundle ${scope.name} with id ${moduleId}`,\n );\n }\n\n // store a reference to the module exports in the cache before execution\n // to handle circular dependencies\n scope.moduleCache[moduleId] = moduleExports.exports;\n\n // execute the module initializer with our custom Turbopack context\n moduleInit(\n createTurbopackContext(\n scope,\n exports,\n moduleExports,\n modules,\n moduleInit,\n id,\n ),\n moduleExports,\n exports,\n );\n\n // update the cache with the final exports (may have changed during execution)\n if (scope.moduleCache[moduleId] !== moduleExports.exports) {\n scope.moduleCache[moduleId] = moduleExports.exports;\n }\n\n return moduleExports.exports;\n}\n\n/**\n * Finds the module initializer function for a given ID in the Turbopack bundle.\n * Handles all bundle shapes: flat array, object map, nested arrays, and\n * embedded object entries within arrays. Performs exact match first, then\n * falls back to startsWith for dev-mode IDs with appended qualifiers.\n */\nexport function findModuleInit(\n modules: BundleModules | unknown[] | undefined,\n moduleId: string,\n): TurbopackModuleInit | undefined {\n if (!modules || typeof modules !== 'object') return;\n\n // Object format: { [id]: factory } (newer Next.js canary builds)\n if (!Array.isArray(modules)) {\n const key =\n moduleId in modules\n ? moduleId\n : Object.keys(modules).find((k) => k.startsWith(moduleId));\n return key !== undefined ? modules[key] : undefined;\n }\n\n const flat = modules.flat();\n\n // Two-pass ID search: exact match first to avoid prefix false positives.\n // The startsWith fallback handles dev-mode IDs with appended qualifiers\n // such as \"[project]/path.tsx [app-client] (ecmascript, async loader)\".\n let idx = flat.findIndex((e) => String(e) === String(moduleId));\n if (idx < 0) {\n idx = flat.findIndex(\n (e) => typeof e === 'string' && e.startsWith(moduleId),\n );\n }\n if (idx >= 0) {\n // Factory is the first function entry that follows the module ID\n return flat\n .slice(idx + 1)\n .find((e): e is TurbopackModuleInit => typeof e === 'function');\n }\n\n // Embedded object map: entries of the form { [moduleId]: factory }\n for (const entry of flat) {\n if (!entry || typeof entry !== 'object') continue;\n const obj = entry as Record<string, TurbopackModuleInit>;\n if (moduleId in obj) return obj[moduleId];\n const prefixKey = Object.keys(obj).find((k) => k.startsWith(moduleId));\n if (prefixKey) return obj[prefixKey];\n }\n return undefined;\n}\n\n/**\n * Creates the Turbopack context object that provides the runtime API for modules.\n * All context methods close over the scope directly — no global dispatch needed\n * for internal module-to-module calls.\n */\nfunction createTurbopackContext(\n scope: RemoteScope,\n exports: Record<string, unknown>,\n moduleExports: TurbopackModule,\n modules: BundleModules,\n moduleInit: TurbopackModuleInit,\n id: string,\n): TurbopackContext {\n /** Scope-local require: shared modules → turbopack module resolution. */\n const scopedRequire = (moduleId: string | number): unknown =>\n requireModule(scope, moduleId, formatRemoteId(scope, String(moduleId)));\n\n return {\n // HMR not implemented for Remote Components\n k: {\n register() {\n // omit\n },\n registerExports() {\n // omit\n },\n signature() {\n return (fn: unknown) => fn;\n },\n },\n\n // ESM exports setup\n s(\n bindings:\n | Record<string, () => unknown>\n | [...([string, () => unknown] | [string, number, () => unknown])],\n esmId?: string | number,\n ) {\n let mod = exports;\n if (typeof esmId === 'string' || typeof esmId === 'number') {\n if (!scope.moduleCache[esmId]) {\n scope.moduleCache[esmId] = {} as Record<string, unknown>;\n }\n mod = scope.moduleCache[esmId] as Record<string, unknown>;\n }\n\n Object.defineProperty(mod, '__esModule', { value: true });\n if (Array.isArray(bindings)) {\n let i = 0;\n while (i < bindings.length) {\n const propName = bindings[i++] as string;\n const tagOrFunc = bindings[i++];\n if (typeof tagOrFunc === 'number') {\n Object.defineProperty(mod, propName, {\n value: bindings[i++],\n enumerable: true,\n writable: false,\n });\n } else {\n const getterFn = tagOrFunc as () => unknown;\n if (typeof bindings[i] === 'function') {\n const setterFn = bindings[i++] as (v: unknown) => unknown;\n Object.defineProperty(mod, propName, {\n get: getterFn,\n set: setterFn,\n enumerable: true,\n });\n } else {\n Object.defineProperty(mod, propName, {\n get: getterFn,\n enumerable: true,\n });\n }\n }\n }\n }\n },\n\n // import — resolves directly via scope, no global dispatch\n i(importId: string | number) {\n let mod: Record<string, unknown> | undefined;\n if (typeof importId === 'string') {\n // parse export syntax if present (e.g., \"module <export foo as bar>\")\n const { exportSource, exportName } =\n /\\s+<export (?<exportSource>.*?) as (?<exportName>.*?)>$/.exec(\n importId,\n )?.groups ?? {};\n const normalizedId = importId.replace(\n /\\s+<export(?<specifier>.*)>$/,\n '',\n );\n mod = scopedRequire(normalizedId) as\n | Record<string, unknown>\n | undefined;\n // map the requested export to the module exports\n if (\n mod &&\n exportSource &&\n exportName &&\n (exportSource === '*' || typeof mod[exportSource] !== 'undefined') &&\n typeof mod[exportName] === 'undefined'\n ) {\n if (exportSource === '*') {\n mod[exportName] = mod;\n } else {\n mod[exportName] = mod[exportSource];\n }\n }\n } else {\n mod = scopedRequire(importId) as Record<string, unknown> | undefined;\n }\n\n if (typeof mod !== 'object' || mod === null) {\n mod = { default: mod };\n } else if (\n !('default' in mod) &&\n // ES module namespace objects have a null prototype, so calling\n // mod.toString() directly throws. Use Object.prototype.toString\n // to safely detect them.\n Object.prototype.toString.call(mod) !== '[object Module]'\n ) {\n try {\n mod.default = mod;\n } catch {\n // ignore if mod is not extensible\n }\n }\n return mod;\n },\n\n // require — resolves directly via scope\n r(requireId: string | number) {\n return scopedRequire(requireId);\n },\n\n // value exports\n v(value: unknown) {\n if (typeof value === 'function') {\n exports.default = value((vid: string | number) => scopedRequire(vid));\n } else {\n moduleExports.exports = value as Record<string, unknown>;\n }\n },\n\n // async module initializer\n async a(\n mod: (\n handleDeps: unknown,\n setResult: (value: unknown) => void,\n ) => Promise<void>,\n ) {\n let result;\n await mod(\n () => {\n // not implemented\n },\n (value) => (result = value),\n );\n exports.default = result;\n },\n\n // async module loader — resolves directly via scope\n async A(Aid: string | number) {\n const mod = scopedRequire(Aid) as {\n default: (\n parentImport: (parentId: string) => unknown,\n ) => Promise<unknown>;\n };\n return mod.default((parentId: string) => scopedRequire(parentId));\n },\n\n // dynamic import tracking — no-op for remote components\n j() {\n // omit\n },\n\n // chunk loader — loads directly via scope, no global dispatch\n l(url: string) {\n // find the script tag that loaded the current module to determine base URL\n const flatModules = Array.isArray(modules) ? modules : [];\n const moduleInitIndex = flatModules.indexOf(moduleInit);\n if (moduleInitIndex !== -1) {\n const scriptIndex = flatModules\n .slice(0, moduleInitIndex)\n .findLastIndex((bundleEntry) => bundleEntry instanceof Element);\n if (scriptIndex !== -1) {\n const script = flatModules[scriptIndex] as HTMLScriptElement;\n const scriptSrc = script.getAttribute('data-turbopack-src') || '';\n const nextIndex = scriptSrc.indexOf('/_next');\n const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : '';\n const chunkUrl = `${baseUrl}/_next/${url}`;\n return loadChunkWithScope(scope, formatRemoteId(scope, chunkUrl));\n }\n }\n throw new Error(\n `Failed to load Turbopack chunk \"${url}\" for module \"${id}\". Check the URL is correct.`,\n );\n },\n\n // globalThis substitute shared across all modules in this scope\n g: scope.moduleGlobal,\n m: moduleExports,\n e: exports,\n };\n}\n\nfunction createNoopHotModule(): TurbopackHotModule {\n // Remote Components does not implement HMR, but Next.js dev page-loader\n // modules still call module.hot.* when Turbopack emits Pages Router code.\n return {\n active: true,\n data: {},\n accept() {},\n dispose() {},\n invalidate() {},\n };\n}\n","import {\n createSharedModulePlan,\n installSharedModulePlan,\n type SharedModuleFactory,\n} from '#internal/host/shared/shared-broker';\nimport type { GlobalScope } from '#internal/runtime/types';\nimport { logDebug, logError, logWarn } from '#internal/utils/logger';\nimport { findModuleInit, handleTurbopackModule } from './module';\nimport {\n ASYNC_MODULE_CALLBACK_RE,\n ASYNC_MODULE_LOADER_RE,\n extractGroup,\n REMOTE_SHARED_ASSIGNMENT_RE,\n REMOTE_SHARED_MARKER_RE,\n} from './patterns';\nimport { formatRemoteId, type RemoteScope } from './remote-scope';\n\nconst DEDUPLICATION_WARNING =\n 'This module will not be deduplicated — the remote may load its own copy, ' +\n 'which can cause duplicate instance errors (e.g. invalid hook calls if React is loaded twice).';\nconst INLINE_REMOTE_SHARED_RE =\n /[\"']?__remote_shared_module_(?<specifier>[^\"':]+)[\"']?\\s*:\\s*\\(\\)\\s*=>\\s*(?:__turbopack_context__|[a-z])\\.A\\((?<asyncSharedModuleId>\"[^\"]+\"|[0-9]+)\\)/g;\n\n/**\n * Returns the flat module list for a scope.\n *\n * The primary source is `scope.turbopackModules` — a flat array populated by\n * the push interceptor in handleTurbopackChunk. This is immune to the\n * turbopack runtime replacing the TURBOPACK global (canary builds swap the\n * array for a deferred-loading dispatcher object).\n *\n * Falls back to reading the global for pre-populated bundles where the push\n * interceptor was never installed.\n */\nexport function getTurbopackModules(scope: RemoteScope): unknown[] | undefined {\n if (scope.turbopackModules.length > 0) {\n return scope.turbopackModules;\n }\n\n // Fallback: read the global for pre-populated bundles or legacy setups.\n const self = globalThis as GlobalScope;\n const raw = self[`TURBOPACK_${scope.globalKey}`];\n if (!raw) return undefined;\n\n if (Array.isArray(raw)) {\n return (raw as unknown[]).flat();\n }\n return Object.entries(raw as Record<string, unknown>).flat();\n}\n\n/**\n * Initializes shared modules between the host application and remote components.\n * This enables sharing of common dependencies like React to avoid duplicate instances.\n *\n * The function works by:\n * 1. Looking for a shared module initializer in the Turbopack bundle\n * 2. Extracting module IDs from the initializer\n * 3. Loading the corresponding host modules and mapping them to the remote's expected IDs\n */\nexport async function initializeSharedModules(\n scope: RemoteScope,\n hostShared: Record<string, SharedModuleFactory> = {},\n remoteShared: Record<string, string> = {},\n // biome-ignore lint/suspicious/noConfusingVoidType: Runtime is undefined but in TS land service it is void\n): Promise<void[]> {\n const allModules = getTurbopackModules(scope);\n\n logDebug(\n 'SharedModules',\n `initializeSharedModules: scope=\"${scope.scopedName}\", ` +\n `allModules=${allModules ? allModules.length : 'null'}, ` +\n `hostShared=[${Object.keys(hostShared).join(', ')}], ` +\n `remoteShared=${JSON.stringify(remoteShared)}`,\n );\n\n let sharedModuleInitializer: Promise<{\n shared: Record<string, string | (() => Promise<unknown>)>;\n }> | null = null;\n\n // find the shared module initializer in the Turbopack bundle\n if (allModules) {\n // find the shared module initializer module id by looking for\n // a function that contains the TURBOPACK_REMOTE_SHARED pattern\n const sharedModuleInitializerIndex = allModules.findIndex((idOrFunc) => {\n if (typeof idOrFunc !== 'function') {\n return false;\n }\n const funcCode = idOrFunc.toString();\n return REMOTE_SHARED_MARKER_RE.test(funcCode);\n });\n\n // if found, extract the shared module initializer\n // first element in the array is always the source script element\n if (sharedModuleInitializerIndex > 0) {\n const sharedModuleInitializerCode = (\n allModules[sharedModuleInitializerIndex] as () => unknown\n ).toString();\n const sharedModuleInitializerId = allModules[\n sharedModuleInitializerIndex - 1\n ] as string | number;\n // extract the shared module id from the function code\n const sharedModuleId = extractGroup(\n REMOTE_SHARED_ASSIGNMENT_RE,\n sharedModuleInitializerCode,\n 'sharedModuleId',\n );\n // load the shared module initializer using the extracted module id\n if (sharedModuleId) {\n const { default: sharedModuleInitializerInstance } =\n handleTurbopackModule(\n scope,\n sharedModuleId,\n formatRemoteId(scope, String(sharedModuleInitializerId)),\n ) as {\n default: Promise<{\n shared: Record<string, string | (() => Promise<unknown>)>;\n }>;\n };\n sharedModuleInitializer = sharedModuleInitializerInstance;\n }\n }\n\n // if we have a shared module initializer, load the shared modules from the host application\n if (sharedModuleInitializer) {\n const { shared } = await sharedModuleInitializer;\n // map shared module ids to their initializer functions\n const sharedModuleIds = extractSharedModuleIds(shared, scope);\n logDebug(\n 'SharedModules',\n `Resolved shared modules for scope=\"${scope.scopedName}\": ${JSON.stringify(sharedModuleIds)}`,\n );\n\n return installSharedModules(\n scope,\n hostShared,\n sharedModuleIds,\n (id, module) =>\n `Host shared module \"${module}\" not found for ID ${id}. ${DEDUPLICATION_WARNING}`,\n );\n }\n\n const inlineSharedModuleIds = extractInlineSharedModuleIds(\n allModules,\n scope,\n );\n if (Object.keys(inlineSharedModuleIds).length > 0) {\n logDebug(\n 'SharedModules',\n `Resolved inline shared modules for scope=\"${scope.scopedName}\": ${JSON.stringify(inlineSharedModuleIds)}`,\n );\n\n return installSharedModules(\n scope,\n hostShared,\n inlineSharedModuleIds,\n (id, module) =>\n `Host shared module \"${module}\" not found for inline ID ${id}. ${DEDUPLICATION_WARNING}`,\n );\n }\n\n logWarn(\n 'SharedModules',\n `No shared module initializer found in bundle for scope=\"${scope.scopedName}\" — falling back to remoteShared mapping`,\n );\n } else {\n logWarn(\n 'SharedModules',\n `No TURBOPACK modules found for scope=\"${scope.scopedName}\" (TURBOPACK_${scope.globalKey} is empty)`,\n );\n }\n\n // fallback: ensure that the shared modules are initialized using remoteShared mapping\n const normalizedRemoteShared = Object.fromEntries(\n Object.entries(remoteShared).map(([id, module]) => [\n id.replace('[app-ssr]', '[app-client]'),\n module,\n ]),\n );\n return installSharedModules(\n scope,\n hostShared,\n normalizedRemoteShared,\n (_id, module) =>\n `Shared module \"${module}\" not found for \"${scope.name}\". ${DEDUPLICATION_WARNING}`,\n );\n}\n\n/**\n * Extracts shared module IDs from the shared module initializer functions.\n * This parses the minified Turbopack code to find the module ID mappings.\n */\nfunction extractSharedModuleIds(\n shared: Record<string, string | (() => Promise<unknown>)>,\n scope: RemoteScope,\n): Record<string, string> {\n return Object.entries(shared)\n .filter(([, value]) => typeof value === 'function')\n .reduce<Record<string, string>>((acc, [key, value]) => {\n const asyncSharedModuleId = extractGroup(\n ASYNC_MODULE_LOADER_RE,\n value.toString(),\n 'asyncSharedModuleId',\n );\n\n if (asyncSharedModuleId) {\n const asyncSharedModule = findModuleInit(\n getTurbopackModules(scope),\n asyncSharedModuleId,\n );\n if (asyncSharedModule) {\n const sharedModuleId = extractGroup(\n ASYNC_MODULE_CALLBACK_RE,\n asyncSharedModule.toString(),\n 'sharedModuleId',\n );\n // map the shared module id to the actual module name\n acc[sharedModuleId ?? asyncSharedModuleId] = key.replace(\n '__remote_shared_module_',\n '',\n );\n }\n }\n return acc;\n }, {});\n}\n\nfunction extractInlineSharedModuleIds(\n allModules: unknown[],\n scope: RemoteScope,\n): Record<string, string> {\n const sharedModuleIds: Record<string, string> = {};\n\n for (const idOrFunc of allModules) {\n if (typeof idOrFunc !== 'function') continue;\n\n const funcCode = idOrFunc.toString();\n if (!funcCode.includes('__remote_shared_module_')) continue;\n\n INLINE_REMOTE_SHARED_RE.lastIndex = 0;\n for (const match of funcCode.matchAll(INLINE_REMOTE_SHARED_RE)) {\n const specifier = match.groups?.specifier;\n const asyncSharedModuleId = stripQuotes(\n match.groups?.asyncSharedModuleId,\n );\n if (!specifier || !asyncSharedModuleId) continue;\n\n const asyncSharedModule = findModuleInit(\n getTurbopackModules(scope),\n asyncSharedModuleId,\n );\n if (!asyncSharedModule) continue;\n\n const sharedModuleId = extractGroup(\n ASYNC_MODULE_CALLBACK_RE,\n asyncSharedModule.toString(),\n 'sharedModuleId',\n );\n sharedModuleIds[sharedModuleId ?? asyncSharedModuleId] = specifier;\n }\n }\n\n return sharedModuleIds;\n}\n\nfunction stripQuotes(value: string | undefined): string | undefined {\n if (value?.startsWith('\"') && value.endsWith('\"')) {\n return value.slice(1, -1);\n }\n return value;\n}\n\nfunction installSharedModules(\n scope: RemoteScope,\n hostShared: Record<string, SharedModuleFactory>,\n sharedModuleIds: Record<string, string>,\n missingMessage: (id: string, module: string) => string,\n): Promise<undefined[]> {\n const plan = createSharedModulePlan({\n bundle: scope.name,\n hostShared,\n remoteShared: sharedModuleIds,\n scope: `remote:${scope.scopedName}`,\n callerTag: 'SharedModules',\n });\n\n for (const entry of plan.entries) {\n if (entry.status === 'resolved') {\n // Compatibility with the old shared-modules architecture: a remote\n // factory may have already cached its own implementation for this ID.\n // The broker-owned scope.sharedModules entry must replace it. Remove\n // this cache cleanup once Turbopack remotes cannot execute shared\n // factories before the scoped share plan is installed.\n delete scope.moduleCache[entry.id];\n }\n }\n\n return installSharedModulePlan({\n plan,\n target: scope.sharedModules,\n callerTag: 'SharedModules',\n onMissing: (entry) => {\n logError('SharedModules', missingMessage(entry.id, entry.specifier));\n },\n }).then((results) => {\n for (const entry of plan.entries) {\n if (entry.status === 'resolved') {\n delete scope.moduleCache[entry.id];\n }\n }\n return results;\n });\n}\n\n/**\n * Returns a shared module for the given scope and module ID.\n * Shared modules are common dependencies like React that are provided by the host.\n */\nexport function getSharedModule(\n scope: RemoteScope,\n id: string | number,\n): unknown {\n const idStr = String(id);\n\n // Exact match first (covers both string and numeric IDs)\n if (scope.sharedModules[idStr] !== undefined) {\n return scope.sharedModules[idStr];\n }\n\n // Fallback: the id may be a bundle-prefixed string like \"[bundle] /react/index.js\"\n // or a Turbopack dev id like \"[project]/node_modules/react/index.js [client]\".\n // Only path-like keys use the dev-id qualifier match to avoid \"react\"\n // matching \"react-dom\".\n for (const [key, value] of Object.entries(scope.sharedModules)) {\n if (\n typeof value !== 'undefined' &&\n idStr !== key &&\n matchesSharedModuleKey(idStr, key)\n ) {\n return value;\n }\n }\n\n return null;\n}\n\nfunction matchesSharedModuleKey(id: string, key: string): boolean {\n if (id.endsWith(key)) return true;\n if (!key.includes('/') && !key.endsWith('.js')) return false;\n\n const index = id.lastIndexOf(key);\n if (index < 0) return false;\n\n const afterKey = id.slice(index + key.length);\n return /^\\s+(?:\\[[^\\]]+\\]\\s*)?(?:\\([^)]*\\))?$/.test(afterKey);\n}\n","import type React from 'react';\nimport { getNamespace } from '#internal/runtime/namespace';\nimport { requireModule } from '#internal/runtime/turbopack/module';\nimport {\n getScope,\n type RemoteScope,\n} from '#internal/runtime/turbopack/remote-scope';\nimport { getTurbopackModules } from '#internal/runtime/turbopack/shared-modules';\nimport { RemoteComponentsError } from '#internal/utils/error';\nimport { logDebug } from '#internal/utils/logger';\n\ntype PageComponent = React.ComponentType<Record<string, unknown>>;\ntype AppComponent = React.ComponentType<\n { Component: PageComponent } & Record<string, unknown>\n>;\ntype NextPageEntry = [string, () => { default?: PageComponent }];\ntype NextAppEntry = [string, () => { default?: AppComponent }];\n\n// module loader for Next.js Pages Router\nexport function nextClientPagesLoader(\n bundle: string,\n route: string,\n styleContainer: HTMLHeadElement | ShadowRoot | null = document.head,\n): { Component: PageComponent | null; App: AppComponent | null } {\n // make a typed reference to the global scope\n const self = globalThis as typeof globalThis & {\n // webpack remote module loading function scoped for each bundle\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string | number) => unknown) & {\n c?: Record<\n string | number,\n { id: string; parents: string[]; children: string[] }\n >;\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n type?: 'turbopack' | 'webpack';\n }\n >;\n // webpack module map for each bundle used in production builds\n __remote_webpack_module_map__?: Record<string, Record<string, number>>;\n // Next.js client pages loader reference storage\n __NEXT_P?: [\n (\n | [\n string,\n () => { default?: React.ComponentType<Record<string, unknown>> },\n ]\n | undefined\n ),\n (\n | [\n string,\n () => {\n default?: React.ComponentType<\n {\n Component: React.ComponentType<Record<string, unknown>>;\n } & Record<string, unknown>\n >;\n },\n ]\n | undefined\n ),\n (\n | [\n string,\n () => {\n default?: React.ComponentType<\n {\n Component: React.ComponentType<Record<string, unknown>>;\n } & Record<string, unknown>\n >;\n },\n ]\n | undefined\n ),\n ];\n };\n\n const ns = getNamespace();\n ns.pageComponentCache ??= {};\n const cacheKey = `${bundle}:${route}`;\n const remoteRequire = self.__remote_webpack_require__?.[bundle];\n const turbopackScope =\n remoteRequire?.type === 'turbopack' ? getScope(bundle) : undefined;\n\n // Applies the cached CSS for `bundle` into the caller's styleContainer.\n // Mirrors the final CSS-attach step of the fresh-load path so that cache\n // hits and additional host instances (each with their own shadow root)\n // still receive the styles.\n const applyBundleCss = () => {\n const elements = ns.cssCache[bundle] ?? [];\n if (styleContainer) {\n for (const el of elements) {\n styleContainer.appendChild(el.cloneNode(true));\n }\n } else {\n for (const el of elements) {\n document.head.appendChild(el);\n }\n }\n };\n\n // On repeat loads (e.g. after history.back()) the next-client-pages-loader\n // chunk is already cached by webpack and its factory won't re-run, so\n // __NEXT_P wouldn't be populated. Reuse the Component/App extracted on the\n // first load, but still run the CSS attach below because the caller may be\n // a different host instance with its own styleContainer.\n const cachedEntry = ns.pageComponentCache[cacheKey];\n if (cachedEntry) {\n applyBundleCss();\n return cachedEntry;\n }\n\n // temporarily remove the original Next.js CSS loader\n const nextCssOriginal = document.querySelector(\n `[id=\"__next_css__DO_NOT_USE__\"]:not([data-bundle=\"${bundle}\"][data-route=\"${route}\"])`,\n );\n const nextCssOriginalParent = nextCssOriginal?.parentNode ?? null;\n const nextCssOriginalNextSibling = nextCssOriginal?.nextSibling ?? null;\n if (nextCssOriginal) {\n nextCssOriginalParent?.removeChild(nextCssOriginal);\n }\n\n // create a new Next.js CSS loader element\n const nextCss = document.createElement('noscript');\n nextCss.id = '__next_css__DO_NOT_USE__';\n nextCss.setAttribute('data-bundle', bundle);\n nextCss.setAttribute('data-route', route);\n const nextCssEnd = document.createElement('noscript');\n nextCssEnd.id = '__next_css__DO_NOT_USE_END__';\n nextCssEnd.setAttribute('data-bundle', bundle);\n nextCssEnd.setAttribute('data-route', route);\n document.head.appendChild(nextCssEnd);\n document.head.appendChild(nextCss);\n\n // find the page component loader chunk\n const componentLoaderChunk =\n (turbopackScope\n ? findTurbopackPagesLoaderId(turbopackScope, route)\n : undefined) ??\n Object.keys(remoteRequire?.m ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=${encodeURIComponent(route)}!`),\n ) ??\n Object.keys(remoteRequire?.m ?? {}).find((key) =>\n key.includes('/next/dist/client/page-loader.js'),\n ) ??\n self.__remote_webpack_module_map__?.[bundle]?.[\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=${encodeURIComponent(route)}!`),\n ) ??\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) => key.includes('/next/dist/client/page-loader.js'),\n ) ??\n ''\n ] ??\n -1;\n\n // find the app loader chunk\n const appLoaderChunk =\n (turbopackScope\n ? findTurbopackPagesLoaderId(turbopackScope, '/_app')\n : undefined) ??\n Object.keys(remoteRequire?.m ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=%2F_app`),\n ) ??\n Object.keys(remoteRequire?.m ?? {}).find((key) =>\n key.includes('/next/dist/client/page-loader.js'),\n ) ??\n self.__remote_webpack_module_map__?.[bundle]?.[\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) =>\n key.includes('/webpack/loaders/next-client-pages-loader.js') &&\n key.includes(`page=%2F_app`),\n ) ??\n Object.keys(self.__remote_webpack_module_map__[bundle] ?? {}).find(\n (key) => key.includes('/next/dist/client/page-loader.js'),\n ) ??\n ''\n ] ??\n -1;\n\n // if we didn't find the component loader or app loader, throw an error\n if (!isLoaderId(componentLoaderChunk) || !isLoaderId(appLoaderChunk)) {\n throw new RemoteComponentsError(\n `Next.js client pages loader not found in bundle \"${bundle}\".`,\n );\n }\n\n // temporarily store the original __NEXT_P reference\n // this is required to avoid conflicts with the Next.js client pages loader\n // which uses the same global variable to store the page components\n const __NEXT_P_ORIGINAL = self.__NEXT_P;\n const selfOriginal = self;\n delete selfOriginal.__NEXT_P;\n\n try {\n // load the component and app loader chunks\n loadPagesLoaderModule(bundle, componentLoaderChunk, turbopackScope);\n if (isLoaderId(appLoaderChunk)) {\n loadPagesLoaderModule(bundle, appLoaderChunk, turbopackScope);\n }\n\n // if we have the __NEXT_P global variable, we can extract the component and app\n if (self.__NEXT_P) {\n logDebug(\n 'ComponentLoader',\n `Next.js Pages loader registry for \"${route}\" in \"${bundle}\": ${self.__NEXT_P.map((entry) => entry?.[0] ?? '<empty>').join(', ')}`,\n );\n const componentEntry = (self.__NEXT_P.find(\n (entry) => entry?.[0] === route,\n ) ?? self.__NEXT_P[0]) as NextPageEntry | undefined;\n const appEntry = (self.__NEXT_P.find((entry) => entry?.[0] === '/_app') ??\n self.__NEXT_P[2]) as NextAppEntry | undefined;\n const [, componentLoader] = componentEntry ?? [\n undefined,\n () => ({ default: null }),\n ];\n const [, appLoader] = appEntry ?? [\n undefined,\n () => ({\n default: null,\n }),\n ];\n const { default: Component = null } = componentLoader();\n const { default: App = null } = appLoader();\n\n const cssCache = ns.cssCache;\n\n if (!cssCache[bundle]) {\n // load the CSS files from the remote bundle\n const cssRE = /\\.s?css$/;\n Object.keys(self.__remote_webpack_require__?.[bundle]?.m ?? {})\n .filter((id) => cssRE.test(id))\n .forEach((id) => {\n self.__remote_webpack_require__?.[bundle]?.(id);\n });\n\n Object.keys(self.__remote_webpack_module_map__?.[bundle] ?? {})\n .filter((path) => cssRE.test(path))\n .forEach((path) => {\n const id = self.__remote_webpack_module_map__?.[bundle]?.[path];\n if (id) {\n self.__remote_webpack_require__?.[bundle]?.(id);\n }\n });\n\n const elements = [];\n let node = nextCss.previousSibling;\n while (node && node !== nextCssEnd) {\n elements.push(node);\n node.remove();\n node = nextCss.previousSibling;\n }\n cssCache[bundle] = elements;\n }\n\n applyBundleCss();\n\n const result = { Component, App };\n ns.pageComponentCache[cacheKey] = result;\n return result;\n }\n\n logDebug(\n 'ComponentLoader',\n `Next.js Pages loaders for route \"${route}\" in \"${bundle}\" did not populate __NEXT_P`,\n );\n return { Component: null, App: null };\n } finally {\n // restore the original __NEXT_P reference\n if (typeof __NEXT_P_ORIGINAL === 'undefined') {\n delete self.__NEXT_P;\n } else {\n self.__NEXT_P = __NEXT_P_ORIGINAL;\n }\n // restore the original Next.js CSS loader\n if (nextCssOriginal && nextCssOriginalParent) {\n const restoreBefore =\n nextCssOriginalNextSibling?.parentNode === nextCssOriginalParent\n ? nextCssOriginalNextSibling\n : null;\n nextCssOriginalParent.insertBefore(nextCssOriginal, restoreBefore);\n }\n\n nextCss.remove();\n nextCssEnd.remove();\n }\n}\n\ntype LoaderId = string | number;\n\nfunction isLoaderId(id: unknown): id is LoaderId {\n return (\n (typeof id === 'string' && id.length > 0) ||\n (typeof id === 'number' && id !== -1)\n );\n}\n\nfunction loadPagesLoaderModule(\n bundle: string,\n id: LoaderId,\n turbopackScope: RemoteScope | undefined,\n) {\n const self = globalThis as typeof globalThis & {\n __remote_webpack_require__?: Record<\n string,\n ((remoteId: string | number) => unknown) & {\n c?: Record<string | number, unknown>;\n type?: 'turbopack' | 'webpack';\n }\n >;\n };\n\n if (turbopackScope) {\n delete turbopackScope.moduleCache[String(id)];\n requireModule(turbopackScope, id);\n return;\n }\n\n const remoteRequire = self.__remote_webpack_require__?.[bundle];\n if (remoteRequire?.c) {\n delete remoteRequire.c[id];\n }\n remoteRequire?.(id);\n}\n\nfunction findTurbopackPagesLoaderId(\n scope: RemoteScope,\n route: string,\n): LoaderId | undefined {\n const modules = getTurbopackModules(scope);\n if (!modules) return undefined;\n\n const routeLiteral = JSON.stringify(route);\n const singleQuotedRouteLiteral = `'${route.replaceAll(\"'\", \"\\\\'\")}'`;\n const flat = modules.flat();\n\n for (let index = 0; index < flat.length; index++) {\n const entry = flat[index];\n\n if (typeof entry === 'function') {\n const code = entry.toString();\n if (\n code.includes('__NEXT_P') &&\n (code.includes(routeLiteral) || code.includes(singleQuotedRouteLiteral))\n ) {\n const id = findPreviousModuleId(flat, index);\n if (isLoaderId(id) && isTurbopackPagesLoaderId(id)) {\n logDebug(\n 'SharedModules',\n `Resolved Turbopack Pages loader for route \"${route}\" in \"${scope.scopedName}\" as \"${id}\"`,\n );\n return id;\n }\n }\n continue;\n }\n\n if (!entry || typeof entry !== 'object' || Array.isArray(entry)) continue;\n if (typeof Element !== 'undefined' && entry instanceof Element) continue;\n\n for (const [id, moduleInit] of Object.entries(\n entry as Record<string, unknown>,\n )) {\n if (typeof moduleInit !== 'function') continue;\n const code = moduleInit.toString();\n if (\n code.includes('__NEXT_P') &&\n (code.includes(routeLiteral) ||\n code.includes(singleQuotedRouteLiteral)) &&\n isTurbopackPagesLoaderId(id)\n ) {\n logDebug(\n 'SharedModules',\n `Resolved Turbopack Pages loader for route \"${route}\" in \"${scope.scopedName}\" as \"${id}\"`,\n );\n return id;\n }\n }\n }\n\n return undefined;\n}\n\nfunction isTurbopackPagesLoaderId(id: LoaderId): boolean {\n if (typeof id === 'number') return true;\n return (\n id.includes('[next]/entry/page-loader.ts') ||\n id.includes('/next/dist/client/page-loader.js')\n );\n}\n\nfunction findPreviousModuleId(\n entries: unknown[],\n factoryIndex: number,\n): LoaderId | undefined {\n for (let index = factoryIndex - 1; index >= 0; index--) {\n const entry = entries[index];\n if (isLoaderId(entry)) return entry;\n if (typeof entry === 'function') return undefined;\n }\n return undefined;\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AASA,IAAM,wBACJ;AAEK,SAAS,mBACd,QACA,SACA;AACA;AAAA,IACE;AAAA,IACA,0CAA0C;AAAA,EAC5C;AACA;AAAA,IACE;AAAA,IACA,8BAA8B,OAAO,KAAK,OAAO;AAAA,EACnD;AAGA,QAAM,OAAO;AAab,QAAM,QAAQ,SAAS,MAAM;AAI7B,QAAM,gBACJ,OAAO,kBAAkB,KAAK,6BAA6B,MAAM;AAEnE,MAAI,eAAe;AACjB,UAAM,cAAc,OAAO;AAAA,MACzB,KAAK,gCAAgC,MAAM,KAAK,cAAc,KAAK,CAAC;AAAA,IACtE;AACA;AAAA,MACE;AAAA,MACA,sCAAsC,YAAY;AAAA,IACpD;AAGA,eAAW,CAAC,KAAK,KAAK,KAAK,OAAO,QAAQ,OAAO,GAAG;AAClD,YAAM,WAAW,YAAY,OAAO,CAAC,MAAM,MAAM,GAAG;AACpD,YAAM,MACJ,SAAS,SAAS,IACd,WACA,YAAY,OAAO,CAAC,MAAM,EAAE,SAAS,GAAG,CAAC;AAE/C,UAAI,IAAI,WAAW,GAAG;AACpB;AAAA,UACE;AAAA,UACA,oDAAoD;AAAA,QACtD;AAAA,MACF;AAEA,iBAAW,MAAM,KAAK;AACpB,YAAI,cAAc,GAAG;AAGnB,gBAAM,aAAa,KAAK,gCAAgC,MAAM,IAAI,EAAE,IAChE,GAAG,KAAK,8BAA8B,MAAM,EAAE,EAAE,MAChD;AACJ,cAAI,eAAe,IAAI;AACrB;AAAA,cACE;AAAA,cACA,sBAAsB,WAAW;AAAA,YACnC;AAAA,UACF;AAEA,w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,UAAU;AAAY,aAAO;AAAA,EAC1C;AACA,SAAO;AACT;","names":["stripQuotes"]}
@@ -6,8 +6,9 @@ import {
6
6
  } from "./chunk-STIJO4AG.js";
7
7
  import {
8
8
  logDebug,
9
+ logError,
9
10
  logWarn
10
- } from "./chunk-S2A4TFLS.js";
11
+ } from "./chunk-ULXU6XWH.js";
11
12
 
12
13
  // src/utils/index.ts
13
14
  function escapeString(str) {
@@ -278,6 +279,81 @@ function sharedPolyfills(shared, resolveClientUrl) {
278
279
  return polyfill;
279
280
  }
280
281
 
282
+ // src/host/shared/shared-broker.ts
283
+ function createSharedModulePlan({
284
+ bundle,
285
+ hostShared,
286
+ remoteShared,
287
+ scope = `remote:${bundle}`,
288
+ callerTag = "SharedBroker"
289
+ }) {
290
+ const entries = Object.entries(remoteShared).map(([id, rawSpecifier]) => {
291
+ const specifier = String(rawSpecifier);
292
+ const provider = hostShared[specifier];
293
+ const entry = {
294
+ id,
295
+ specifier,
296
+ required: true,
297
+ singleton: true,
298
+ scope,
299
+ provider,
300
+ status: typeof provider === "undefined" ? "missing" : "resolved"
301
+ };
302
+ if (entry.status === "missing") {
303
+ logDebug(
304
+ callerTag,
305
+ `Remote "${bundle}" requests "${specifier}" for "${id}" but the host does not provide it`
306
+ );
307
+ }
308
+ return entry;
309
+ });
310
+ logDebug(
311
+ callerTag,
312
+ `Share plan for "${bundle}": ${entries.map((entry) => `${entry.id}=>${entry.specifier}:${entry.status}`).join(", ")}`
313
+ );
314
+ return {
315
+ protocol: "v0",
316
+ bundle,
317
+ entries
318
+ };
319
+ }
320
+ async function resolveSharedModulePlan(plan) {
321
+ const resolved = {};
322
+ await Promise.all(
323
+ plan.entries.map(async (entry) => {
324
+ if (entry.status !== "resolved")
325
+ return;
326
+ const value = typeof entry.provider === "function" ? await entry.provider(plan.bundle) : entry.provider;
327
+ resolved[entry.id] = value;
328
+ })
329
+ );
330
+ return resolved;
331
+ }
332
+ async function installSharedModulePlan({
333
+ plan,
334
+ target,
335
+ callerTag = "SharedBroker",
336
+ onMissing
337
+ }) {
338
+ return Promise.all(
339
+ plan.entries.map(async (entry) => {
340
+ if (entry.status !== "resolved") {
341
+ if (onMissing) {
342
+ onMissing(entry);
343
+ } else {
344
+ logError(
345
+ callerTag,
346
+ `Shared module "${entry.specifier}" not found for "${plan.bundle}".`
347
+ );
348
+ }
349
+ return void 0;
350
+ }
351
+ target[entry.id] = typeof entry.provider === "function" ? await entry.provider(plan.bundle) : entry.provider;
352
+ return void 0;
353
+ })
354
+ );
355
+ }
356
+
281
357
  // src/host/shared/shared-module-resolver.ts
282
358
  var CORE_REACT_SHARED_KEYS = [
283
359
  "react",
@@ -319,31 +395,22 @@ function buildHostShared(userShared, resolveClientUrl, options) {
319
395
  return result;
320
396
  }
321
397
  async function buildWebpackResolve(hostShared, remoteShared, bundle, reactModules, callerTag = "SharedModuleResolver") {
398
+ const sharePlan = createSharedModulePlan({
399
+ bundle,
400
+ hostShared,
401
+ remoteShared,
402
+ callerTag
403
+ });
404
+ const plannedResolve = await resolveSharedModulePlan(sharePlan);
322
405
  const resolve = {
323
406
  ...reactModules,
324
- ...Object.entries(remoteShared).reduce(
325
- (acc, [key, value]) => {
326
- if (typeof hostShared[value] !== "undefined") {
327
- acc[key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, "")] = hostShared[value];
328
- } else {
329
- logDebug(
330
- callerTag,
331
- `Remote requests "${value}" but host doesn't provide it`
332
- );
333
- }
334
- return acc;
335
- },
336
- {}
407
+ ...Object.fromEntries(
408
+ Object.entries(plannedResolve).map(([key, value]) => [
409
+ key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, ""),
410
+ value
411
+ ])
337
412
  )
338
413
  };
339
- await Promise.all(
340
- Object.entries(resolve).map(async ([key, value]) => {
341
- if (typeof value === "function") {
342
- resolve[key] = await value(bundle);
343
- }
344
- return Promise.resolve(value);
345
- })
346
- );
347
414
  return resolve;
348
415
  }
349
416
 
@@ -365,10 +432,12 @@ export {
365
432
  formatRemoteId,
366
433
  parseRemoteId,
367
434
  createRemoteImageLoader,
435
+ createSharedModulePlan,
436
+ installSharedModulePlan,
368
437
  CORE_REACT_SHARED_KEYS,
369
438
  VENDOR_SHARED,
370
439
  buildCoreShared,
371
440
  buildHostShared,
372
441
  buildWebpackResolve
373
442
  };
374
- //# sourceMappingURL=chunk-SAGYPGIQ.js.map
443
+ //# sourceMappingURL=chunk-55TEMSB5.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/utils/index.ts","../src/runtime/constants.ts","../src/runtime/patterns.ts","../src/runtime/turbopack/remote-scope.ts","../src/host/shared/remote-image-loader.ts","../src/host/shared/polyfill.tsx","../src/host/shared/shared-broker.ts","../src/host/shared/shared-module-resolver.ts"],"sourcesContent":["export function escapeString(str: string) {\n return str.replace(/[^a-z0-9]/g, '_');\n}\n\n/**\n * Computes the origin-qualified scoped name for a bundle by appending\n * the escaped host (hostname + port). This ensures the server and client\n * always agree on the scoped name — the server's cross-origin detection\n * (based on deployment URL) can differ from the client's (based on\n * `location.origin`), so the name must not depend on that distinction.\n *\n * Used on both the server (to rewrite RSC flight data) and the client\n * (to create and look up RemoteScopes). Both sides must produce the\n * same value for a given remote.\n */\nexport function computeScopedName(\n name: string,\n options: { remoteHost: string },\n): string {\n return `${name}_${escapeString(options.remoteHost.toLowerCase())}`;\n}\n\nexport const attrToProp = {\n fetchpriority: 'fetchPriority',\n crossorigin: 'crossOrigin',\n imagesrcset: 'imageSrcSet',\n imagesizes: 'imageSizes',\n srcset: 'srcSet',\n} as Record<string, string>;\n","import { escapeString } from '#internal/utils';\n\nexport const DEFAULT_BUNDLE_NAME = '__vercel_remote_bundle';\nexport const DEFAULT_COMPONENT_NAME = '__vercel_remote_component';\nexport const DEFAULT_ROUTE = '/';\n\nexport const RUNTIME_WEBPACK = 'webpack';\nexport const RUNTIME_TURBOPACK = 'turbopack';\nexport const RUNTIME_SCRIPT = 'script';\n\nexport function getBundleKey(bundle: string): string {\n return escapeString(bundle);\n}\n\nexport type Runtime =\n | typeof RUNTIME_WEBPACK\n | typeof RUNTIME_TURBOPACK\n | typeof RUNTIME_SCRIPT;\n","export const REMOTE_COMPONENT_REGEX =\n /(?<prefix>.*?)\\[(?<bundle>[^\\]]+)\\](?:%20| )(?<id>.+)/;\n\n// Matches Next.js bundle-prefixed paths like /_next/[bundle-name] /static/...\n// Used to strip the bundle identifier before loading scripts via the standard /_next/ path.\nexport const NEXT_BUNDLE_PATH_RE = /\\/_next\\/\\[.+\\](?:%20| )/;\n\n/** Collapse duplicate path separators (`//`) while preserving protocol (`://`). */\nconst DOUBLE_SLASH_RE = /(?<!:)\\/\\//g;\nexport function collapseDoubleSlashes(path: string): string {\n return path.replace(DOUBLE_SLASH_RE, '/');\n}\n","import type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport { getBundleKey, type Runtime } from '#internal/runtime/constants';\nimport { getNamespace } from '#internal/runtime/namespace';\nimport { REMOTE_COMPONENT_REGEX } from '#internal/runtime/patterns';\nimport { computeScopedName } from '#internal/utils';\nimport { logDebug, logWarn } from '#internal/utils/logger';\n\n/**\n * Encapsulates all per-remote state so that two remotes sharing the same\n * bundle name but served from different origins never collide.\n *\n * A scope is created once per `setupRemoteScope` call and threaded\n * directly through internal code paths (chunk loading, module resolution,\n * shared modules). Global dispatchers (`__webpack_require__`,\n * `__webpack_chunk_load__`) only exist for external callers (RSC runtime)\n * and resolve the correct scope via the registry.\n */\nexport interface RemoteScope {\n /** Plain bundle name (e.g. \"remote-component-registry\") */\n name: string;\n /** Origin-qualified key — unique even when two remotes share a name */\n scopedName: string;\n /** Escaped key used as suffix for TURBOPACK_ globals */\n globalKey: string;\n /** Base URL for resolving relative chunk paths */\n url: URL;\n /** Bundler runtime type */\n runtime: Runtime;\n /** Proxy callback for routing chunks through the host */\n resolveClientUrl?: InternalResolveClientUrl;\n /** Per-scope cache of executed Turbopack module exports */\n moduleCache: Record<string, unknown>;\n /** Per-scope shared modules provided by the host (React, etc.) */\n sharedModules: Record<string, unknown>;\n /** Per-scope globalThis substitute passed to module initializers as `g` */\n moduleGlobal: Record<string, unknown>;\n /**\n * Webpack's bundle-scoped require function, populated from\n * `__remote_webpack_require__[bundleName]` for webpack remotes.\n * Undefined for turbopack remotes.\n */\n webpackRequire?: ((id: string | number) => unknown) & {\n m?: Record<string | number, (module: { exports: unknown }) => void>;\n type?: string;\n };\n /**\n * Flat array of captured turbopack module entries: [scriptEl, id, factory, ...].\n * Populated by the push interceptor in handleTurbopackChunk. This is the\n * primary source of truth for getTurbopackModules — immune to the turbopack\n * runtime replacing the TURBOPACK global (canary builds use a deferred-loading\n * pattern that swaps the array for an immediate-processing dispatcher).\n */\n turbopackModules: unknown[];\n}\n\nfunction getRegistry(): Map<string, RemoteScope> {\n return getNamespace().scopes;\n}\n\nexport function createScope(\n name: string,\n url: URL,\n runtime: Runtime,\n resolveClientUrl?: InternalResolveClientUrl,\n): RemoteScope {\n const scopedName = computeScopedName(name, { remoteHost: url.host });\n const globalKey = getBundleKey(scopedName);\n return {\n name,\n scopedName,\n globalKey,\n url,\n runtime,\n resolveClientUrl,\n moduleCache: {},\n sharedModules: {},\n moduleGlobal: {},\n turbopackModules: [],\n };\n}\n\nexport function registerScope(scope: RemoteScope): void {\n const registry = getRegistry();\n registry.set(scope.scopedName, scope);\n\n // Also register under the plain name so static/HTML hosts (which don't\n // rewrite RSC chunk IDs) can look up scopes by the unrewritten bundle name.\n if (scope.scopedName !== scope.name) {\n const existing = registry.get(scope.name);\n if (existing && existing.scopedName !== scope.scopedName) {\n logWarn(\n 'RemoteScope',\n `Plain name \"${scope.name}\" already registered by scope \"${existing.scopedName}\" — ` +\n `overwriting with \"${scope.scopedName}\". Static hosts will only resolve the latest one.`,\n );\n }\n registry.set(scope.name, scope);\n }\n\n logDebug(\n 'RemoteScope',\n `Registered scope \"${scope.scopedName}\" (${registry.size} total)`,\n );\n}\n\n/**\n * Resolves a scope by name. Accepts either the scoped name (used by Next.js\n * hosts that rewrite RSC data server-side) or the plain bundle name (used by\n * static/HTML hosts where chunks arrive unrewritten).\n */\nexport function getScope(name: string): RemoteScope | undefined {\n return getRegistry().get(name);\n}\n\n/** Formats a `[scopedName] path` string for use in chunk/module IDs. */\nexport function formatRemoteId(scope: RemoteScope, path: string): string {\n return `[${scope.scopedName}] ${path}`;\n}\n\n/**\n * Parses the `[bundle] path` format used in chunk/module IDs.\n * Uses REMOTE_COMPONENT_REGEX (the same pattern used by the module dispatcher\n * and script loader) so the two parsing paths can never diverge.\n */\nexport function parseRemoteId(id: string): {\n bundle: string;\n path: string;\n prefix: string;\n} {\n const groups = REMOTE_COMPONENT_REGEX.exec(id)?.groups;\n if (groups?.bundle && groups.id) {\n return {\n bundle: groups.bundle,\n path: groups.id,\n prefix: groups.prefix ?? '',\n };\n }\n return { bundle: 'default', path: id, prefix: '' };\n}\n","import { getScope } from '#internal/runtime/turbopack/remote-scope';\nimport type { InternalResolveClientUrl } from '#internal/runtime/url/resolve-client-url';\n\n/**\n * Replacement for `next/dist/shared/lib/image-loader`.\n *\n * Uses `config.path` (which includes the remote's asset prefix, e.g.\n * `/vc-ap-xxx/_next/image`) to generate URLs that match the server-rendered\n * HTML and avoid hydration mismatches. Under the microfrontends proxy these\n * relative paths are routed to the correct app.\n *\n * For cross-origin deployments (standalone host on a different domain),\n * `config.path` is a relative path that would incorrectly resolve to the host\n * origin, so we prefix it with the remote origin to produce an absolute URL\n * pointing at the remote's optimizer.\n *\n * When `resolveClientUrl` is provided (deployment protection), the final URL\n * is routed through the host's proxy.\n */\nexport function createRemoteImageLoader(\n bundle: string,\n resolveClientUrl?: InternalResolveClientUrl,\n) {\n const loader = Object.assign(\n ({\n config,\n src,\n width,\n quality,\n }: {\n config: { path?: string };\n src: string;\n width: number;\n quality?: number;\n }) => {\n const q = quality ?? 75;\n const remoteOrigin = getScope(bundle)?.url.origin ?? '';\n const isCrossOrigin = remoteOrigin && remoteOrigin !== location.origin;\n const basePath = isCrossOrigin\n ? `${remoteOrigin}${config.path ?? '/_next/image'}`\n : (config.path ?? `${remoteOrigin}/_next/image`);\n const url = `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${q}`;\n return resolveClientUrl?.(url) ?? url;\n },\n // Signals to getImgProps that this is a default loader (not a user-defined\n // one), enabling srcSet generation with device/image sizes from the config.\n { __next_img_default: true as const },\n );\n return loader;\n}\n","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","import type { LogLocation } from '#internal/utils/logger';\nimport { logDebug, logError } from '#internal/utils/logger';\n\nexport type SharedModuleFactory = (bundle?: string) => Promise<unknown>;\n\nexport interface SharedModuleRequirement {\n id: string;\n specifier: string;\n required: boolean;\n singleton: boolean;\n scope: string;\n}\n\nexport interface SharedModuleResolution extends SharedModuleRequirement {\n provider?: SharedModuleFactory | unknown;\n status: 'resolved' | 'missing';\n}\n\nexport interface SharedModulePlan {\n protocol: 'v0';\n bundle: string;\n entries: SharedModuleResolution[];\n}\n\nexport function createSharedModulePlan({\n bundle,\n hostShared,\n remoteShared,\n scope = `remote:${bundle}`,\n callerTag = 'SharedBroker',\n}: {\n bundle: string;\n hostShared: Record<string, SharedModuleFactory | unknown>;\n remoteShared: Record<string, string | number>;\n scope?: string;\n callerTag?: LogLocation;\n}): SharedModulePlan {\n const entries = Object.entries(remoteShared).map(([id, rawSpecifier]) => {\n const specifier = String(rawSpecifier);\n const provider = hostShared[specifier];\n const entry: SharedModuleResolution = {\n id,\n specifier,\n required: true,\n singleton: true,\n scope,\n provider,\n status: typeof provider === 'undefined' ? 'missing' : 'resolved',\n };\n\n if (entry.status === 'missing') {\n logDebug(\n callerTag,\n `Remote \"${bundle}\" requests \"${specifier}\" for \"${id}\" but the host does not provide it`,\n );\n }\n\n return entry;\n });\n\n logDebug(\n callerTag,\n `Share plan for \"${bundle}\": ${entries\n .map((entry) => `${entry.id}=>${entry.specifier}:${entry.status}`)\n .join(', ')}`,\n );\n\n return {\n protocol: 'v0',\n bundle,\n entries,\n };\n}\n\nexport async function resolveSharedModulePlan(\n plan: SharedModulePlan,\n): Promise<Record<string, unknown>> {\n const resolved: Record<string, unknown> = {};\n\n await Promise.all(\n plan.entries.map(async (entry) => {\n if (entry.status !== 'resolved') return;\n const value =\n typeof entry.provider === 'function'\n ? await (entry.provider as SharedModuleFactory)(plan.bundle)\n : entry.provider;\n resolved[entry.id] = value;\n }),\n );\n\n return resolved;\n}\n\nexport async function installSharedModulePlan({\n plan,\n target,\n callerTag = 'SharedBroker',\n onMissing,\n}: {\n plan: SharedModulePlan;\n target: Record<string, unknown>;\n callerTag?: LogLocation;\n onMissing?: (entry: SharedModuleResolution) => void;\n}): Promise<undefined[]> {\n return Promise.all(\n plan.entries.map(async (entry) => {\n if (entry.status !== 'resolved') {\n if (onMissing) {\n onMissing(entry);\n } else {\n logError(\n callerTag,\n `Shared module \"${entry.specifier}\" not found for \"${plan.bundle}\".`,\n );\n }\n return undefined;\n }\n\n target[entry.id] =\n typeof entry.provider === 'function'\n ? await (entry.provider as SharedModuleFactory)(plan.bundle)\n : entry.provider;\n return undefined;\n }),\n );\n}\n","import type { InternalResolveClientUrl } from '#internal/host/server/types';\nimport { sharedPolyfills } from '#internal/host/shared/polyfill';\nimport {\n createSharedModulePlan,\n resolveSharedModulePlan,\n type SharedModuleFactory,\n} from '#internal/host/shared/shared-broker';\nimport type { LogLocation } from '#internal/utils/logger';\n\n/**\n * The core React packages that are always shared between host and remote.\n * These correspond to the `/react/*.js` and `/react-dom/*.js` path keys\n * used in the webpack module resolution map.\n */\nexport const CORE_REACT_SHARED_KEYS = [\n 'react',\n 'react/jsx-dev-runtime',\n 'react/jsx-runtime',\n 'react-dom',\n 'react-dom/client',\n] as const;\n\n/**\n * Maps each core React package to its webpack-style path key.\n * For example, `react` maps to `/react/index.js`.\n */\nexport const CORE_REACT_PATH_MAP: Record<string, string> = {\n react: '/react/index.js',\n 'react/jsx-dev-runtime': '/react/jsx-dev-runtime.js',\n 'react/jsx-runtime': '/react/jsx-runtime.js',\n 'react-dom': '/react-dom/index.js',\n 'react-dom/client': '/react-dom/client.js',\n};\n\n/**\n * The vendorShared record used by the Next.js config to map React packages\n * to their webpack path-key string literals. Derived from CORE_REACT_PATH_MAP\n * but excludes `react-dom/client` to match the existing config behavior.\n */\nexport const VENDOR_SHARED: Record<string, string> = Object.fromEntries(\n Object.entries(CORE_REACT_PATH_MAP)\n .filter(([key]) => key !== 'react-dom/client')\n .map(([key, path]) => [key, `'${path}'`]),\n);\n\n/**\n * Builds the `coreShared` map for the Turbopack runtime's\n * `initializeSharedModules`. Each entry is an async factory that dynamically\n * imports the corresponding React package. User-provided shared modules\n * override core entries (e.g. to supply a pinned React version).\n */\nexport function buildCoreShared(\n userShared?: Record<string, SharedModuleFactory>,\n): Record<string, SharedModuleFactory> {\n return {\n react: async () => (await import('react')).default,\n 'react-dom': async () => (await import('react-dom')).default,\n 'react/jsx-dev-runtime': async () =>\n (await import('react/jsx-dev-runtime')).default,\n 'react/jsx-runtime': async () =>\n (await import('react/jsx-runtime')).default,\n 'react-dom/client': async () => (await import('react-dom/client')).default,\n ...userShared,\n };\n}\n\ninterface HostSharedGlobals {\n __remote_component_host_shared_modules__?: Record<\n string,\n SharedModuleFactory\n >;\n __remote_component_shared__?: Record<string, SharedModuleFactory>;\n}\n\n/**\n * Builds the merged host shared modules map with a consistent merge priority:\n * 1. Polyfills (lowest priority — fallback implementations)\n * 2. Global host shared modules (`__remote_component_host_shared_modules__`)\n * 3. User-provided shared modules (highest priority — explicit overrides)\n *\n * Some callers also include `__remote_component_shared__` (the pages router\n * global). Pass `includeRemoteComponentShared: true` to include it at the end.\n */\nexport function buildHostShared(\n userShared?: Record<string, SharedModuleFactory>,\n resolveClientUrl?: InternalResolveClientUrl,\n options?: { includeRemoteComponentShared?: boolean },\n): Record<string, SharedModuleFactory> {\n const self = globalThis as typeof globalThis & HostSharedGlobals;\n const result: Record<string, SharedModuleFactory> = {\n ...sharedPolyfills(userShared, resolveClientUrl),\n ...self.__remote_component_host_shared_modules__,\n ...userShared,\n };\n if (options?.includeRemoteComponentShared) {\n Object.assign(result, self.__remote_component_shared__);\n }\n return result;\n}\n\n/**\n * React module instances keyed by their webpack path, e.g.\n * `{ '/react/index.js': React }`. Passed into `buildWebpackResolve` so it\n * can populate the resolve map without importing React itself.\n */\nexport interface ReactModules {\n '/react/index.js': unknown;\n '/react/jsx-dev-runtime.js': unknown;\n '/react/jsx-runtime.js': unknown;\n '/react-dom/index.js': unknown;\n '/react-dom/client.js': unknown;\n}\n\n/**\n * Builds the `resolve` map passed to `applySharedModules` for the webpack\n * runtime. Combines:\n * - Static React module path keys (`/react/index.js`, etc.)\n * - Remote shared modules matched against host shared, with `(ssr)/` prefix stripped\n *\n * After building the map, resolves any factory functions by awaiting them\n * with the given bundle name.\n */\nexport async function buildWebpackResolve(\n hostShared: Record<string, SharedModuleFactory | unknown>,\n remoteShared: Record<string, string | number>,\n bundle: string,\n reactModules: ReactModules,\n callerTag: LogLocation = 'SharedModuleResolver',\n): Promise<Record<string, unknown>> {\n const sharePlan = createSharedModulePlan({\n bundle,\n hostShared,\n remoteShared,\n callerTag,\n });\n const plannedResolve = await resolveSharedModulePlan(sharePlan);\n const resolve: Record<string, unknown> = {\n ...reactModules,\n ...Object.fromEntries(\n Object.entries(plannedResolve).map(([key, value]) => [\n key.replace(/^\\(ssr\\)\\/(?<relative>\\.\\/)?/, ''),\n value,\n ]),\n ),\n };\n return resolve;\n}\n"],"mappings":";;;;;;;;;;;;;AAAO,SAAS,aAAa,KAAa;AACxC,SAAO,IAAI,QAAQ,cAAc,GAAG;AACtC;AAaO,SAAS,kBACd,MACA,SACQ;AACR,SAAO,GAAG,QAAQ,aAAa,QAAQ,WAAW,YAAY,CAAC;AACjE;AAEO,IAAM,aAAa;AAAA,EACxB,eAAe;AAAA,EACf,aAAa;AAAA,EACb,aAAa;AAAA,EACb,YAAY;AAAA,EACZ,QAAQ;AACV;;;AC1BO,IAAM,sBAAsB;AAC5B,IAAM,yBAAyB;AAC/B,IAAM,gBAAgB;AAEtB,IAAM,kBAAkB;AACxB,IAAM,oBAAoB;AAC1B,IAAM,iBAAiB;AAEvB,SAAS,aAAa,QAAwB;AACnD,SAAO,aAAa,MAAM;AAC5B;;;ACZO,IAAM,yBACX;AAIK,IAAM,sBAAsB;AAGnC,IAAM,kBAAkB;AACjB,SAAS,sBAAsB,MAAsB;AAC1D,SAAO,KAAK,QAAQ,iBAAiB,GAAG;AAC1C;;;AC4CA,SAAS,cAAwC;AAC/C,SAAO,aAAa,EAAE;AACxB;AAEO,SAAS,YACd,MACA,KACA,SACA,kBACa;AACb,QAAM,aAAa,kBAAkB,MAAM,EAAE,YAAY,IAAI,KAAK,CAAC;AACnE,QAAM,YAAY,aAAa,UAAU;AACzC,SAAO;AAAA,IACL;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA;AAAA,IACA,aAAa,CAAC;AAAA,IACd,eAAe,CAAC;AAAA,IAChB,cAAc,CAAC;AAAA,IACf,kBAAkB,CAAC;AAAA,EACrB;AACF;AAEO,SAAS,cAAc,OAA0B;AACtD,QAAM,WAAW,YAAY;AAC7B,WAAS,IAAI,MAAM,YAAY,KAAK;AAIpC,MAAI,MAAM,eA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,IAAI,QAAQ,gCAAgC,EAAE;AAAA,QAC9C;AAAA,MACF,CAAC;AAAA,IACH;AAAA,EACF;AACA,SAAO;AACT;","names":[]}
@@ -7,7 +7,8 @@ var _chunk5KTAEO52cjs = require('./chunk-5KTAEO52.cjs');
7
7
 
8
8
 
9
9
 
10
- var _chunkRUWR74XQcjs = require('./chunk-RUWR74XQ.cjs');
10
+
11
+ var _chunkBBXVML3Dcjs = require('./chunk-BBXVML3D.cjs');
11
12
 
12
13
  // src/utils/index.ts
13
14
  function escapeString(str) {
@@ -69,14 +70,14 @@ function registerScope(scope) {
69
70
  if (scope.scopedName !== scope.name) {
70
71
  const existing = registry.get(scope.name);
71
72
  if (existing && existing.scopedName !== scope.scopedName) {
72
- _chunkRUWR74XQcjs.logWarn.call(void 0,
73
+ _chunkBBXVML3Dcjs.logWarn.call(void 0,
73
74
  "RemoteScope",
74
75
  `Plain name "${scope.name}" already registered by scope "${existing.scopedName}" \u2014 overwriting with "${scope.scopedName}". Static hosts will only resolve the latest one.`
75
76
  );
76
77
  }
77
78
  registry.set(scope.name, scope);
78
79
  }
79
- _chunkRUWR74XQcjs.logDebug.call(void 0,
80
+ _chunkBBXVML3Dcjs.logDebug.call(void 0,
80
81
  "RemoteScope",
81
82
  `Registered scope "${scope.scopedName}" (${registry.size} total)`
82
83
  );
@@ -175,7 +176,7 @@ function sharedPolyfills(shared, resolveClientUrl) {
175
176
  ...props
176
177
  }) => {
177
178
  if (prefetch) {
178
- _chunkRUWR74XQcjs.logWarn.call(void 0,
179
+ _chunkBBXVML3Dcjs.logWarn.call(void 0,
179
180
  "Polyfill",
180
181
  "Next.js Link prefetch is not supported in remote components"
181
182
  );
@@ -278,6 +279,81 @@ function sharedPolyfills(shared, resolveClientUrl) {
278
279
  return polyfill;
279
280
  }
280
281
 
282
+ // src/host/shared/shared-broker.ts
283
+ function createSharedModulePlan({
284
+ bundle,
285
+ hostShared,
286
+ remoteShared,
287
+ scope = `remote:${bundle}`,
288
+ callerTag = "SharedBroker"
289
+ }) {
290
+ const entries = Object.entries(remoteShared).map(([id, rawSpecifier]) => {
291
+ const specifier = String(rawSpecifier);
292
+ const provider = hostShared[specifier];
293
+ const entry = {
294
+ id,
295
+ specifier,
296
+ required: true,
297
+ singleton: true,
298
+ scope,
299
+ provider,
300
+ status: typeof provider === "undefined" ? "missing" : "resolved"
301
+ };
302
+ if (entry.status === "missing") {
303
+ _chunkBBXVML3Dcjs.logDebug.call(void 0,
304
+ callerTag,
305
+ `Remote "${bundle}" requests "${specifier}" for "${id}" but the host does not provide it`
306
+ );
307
+ }
308
+ return entry;
309
+ });
310
+ _chunkBBXVML3Dcjs.logDebug.call(void 0,
311
+ callerTag,
312
+ `Share plan for "${bundle}": ${entries.map((entry) => `${entry.id}=>${entry.specifier}:${entry.status}`).join(", ")}`
313
+ );
314
+ return {
315
+ protocol: "v0",
316
+ bundle,
317
+ entries
318
+ };
319
+ }
320
+ async function resolveSharedModulePlan(plan) {
321
+ const resolved = {};
322
+ await Promise.all(
323
+ plan.entries.map(async (entry) => {
324
+ if (entry.status !== "resolved")
325
+ return;
326
+ const value = typeof entry.provider === "function" ? await entry.provider(plan.bundle) : entry.provider;
327
+ resolved[entry.id] = value;
328
+ })
329
+ );
330
+ return resolved;
331
+ }
332
+ async function installSharedModulePlan({
333
+ plan,
334
+ target,
335
+ callerTag = "SharedBroker",
336
+ onMissing
337
+ }) {
338
+ return Promise.all(
339
+ plan.entries.map(async (entry) => {
340
+ if (entry.status !== "resolved") {
341
+ if (onMissing) {
342
+ onMissing(entry);
343
+ } else {
344
+ _chunkBBXVML3Dcjs.logError.call(void 0,
345
+ callerTag,
346
+ `Shared module "${entry.specifier}" not found for "${plan.bundle}".`
347
+ );
348
+ }
349
+ return void 0;
350
+ }
351
+ target[entry.id] = typeof entry.provider === "function" ? await entry.provider(plan.bundle) : entry.provider;
352
+ return void 0;
353
+ })
354
+ );
355
+ }
356
+
281
357
  // src/host/shared/shared-module-resolver.ts
282
358
  var CORE_REACT_SHARED_KEYS = [
283
359
  "react",
@@ -319,31 +395,22 @@ function buildHostShared(userShared, resolveClientUrl, options) {
319
395
  return result;
320
396
  }
321
397
  async function buildWebpackResolve(hostShared, remoteShared, bundle, reactModules, callerTag = "SharedModuleResolver") {
398
+ const sharePlan = createSharedModulePlan({
399
+ bundle,
400
+ hostShared,
401
+ remoteShared,
402
+ callerTag
403
+ });
404
+ const plannedResolve = await resolveSharedModulePlan(sharePlan);
322
405
  const resolve = {
323
406
  ...reactModules,
324
- ...Object.entries(remoteShared).reduce(
325
- (acc, [key, value]) => {
326
- if (typeof hostShared[value] !== "undefined") {
327
- acc[key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, "")] = hostShared[value];
328
- } else {
329
- _chunkRUWR74XQcjs.logDebug.call(void 0,
330
- callerTag,
331
- `Remote requests "${value}" but host doesn't provide it`
332
- );
333
- }
334
- return acc;
335
- },
336
- {}
407
+ ...Object.fromEntries(
408
+ Object.entries(plannedResolve).map(([key, value]) => [
409
+ key.replace(/^\(ssr\)\/(?<relative>\.\/)?/, ""),
410
+ value
411
+ ])
337
412
  )
338
413
  };
339
- await Promise.all(
340
- Object.entries(resolve).map(async ([key, value]) => {
341
- if (typeof value === "function") {
342
- resolve[key] = await value(bundle);
343
- }
344
- return Promise.resolve(value);
345
- })
346
- );
347
414
  return resolve;
348
415
  }
349
416
 
@@ -370,5 +437,7 @@ async function buildWebpackResolve(hostShared, remoteShared, bundle, reactModule
370
437
 
371
438
 
372
439
 
373
- exports.escapeString = escapeString; exports.attrToProp = attrToProp; exports.DEFAULT_BUNDLE_NAME = DEFAULT_BUNDLE_NAME; exports.DEFAULT_COMPONENT_NAME = DEFAULT_COMPONENT_NAME; exports.DEFAULT_ROUTE = DEFAULT_ROUTE; exports.RUNTIME_WEBPACK = RUNTIME_WEBPACK; exports.RUNTIME_TURBOPACK = RUNTIME_TURBOPACK; exports.RUNTIME_SCRIPT = RUNTIME_SCRIPT; exports.REMOTE_COMPONENT_REGEX = REMOTE_COMPONENT_REGEX; exports.NEXT_BUNDLE_PATH_RE = NEXT_BUNDLE_PATH_RE; exports.collapseDoubleSlashes = collapseDoubleSlashes; exports.createScope = createScope; exports.registerScope = registerScope; exports.getScope = getScope; exports.formatRemoteId = formatRemoteId; exports.parseRemoteId = parseRemoteId; exports.createRemoteImageLoader = createRemoteImageLoader; exports.CORE_REACT_SHARED_KEYS = CORE_REACT_SHARED_KEYS; exports.VENDOR_SHARED = VENDOR_SHARED; exports.buildCoreShared = buildCoreShared; exports.buildHostShared = buildHostShared; exports.buildWebpackResolve = buildWebpackResolve;
374
- //# sourceMappingURL=chunk-RLI4YTBJ.cjs.map
440
+
441
+
442
+ exports.escapeString = escapeString; exports.attrToProp = attrToProp; exports.DEFAULT_BUNDLE_NAME = DEFAULT_BUNDLE_NAME; exports.DEFAULT_COMPONENT_NAME = DEFAULT_COMPONENT_NAME; exports.DEFAULT_ROUTE = DEFAULT_ROUTE; exports.RUNTIME_WEBPACK = RUNTIME_WEBPACK; exports.RUNTIME_TURBOPACK = RUNTIME_TURBOPACK; exports.RUNTIME_SCRIPT = RUNTIME_SCRIPT; exports.REMOTE_COMPONENT_REGEX = REMOTE_COMPONENT_REGEX; exports.NEXT_BUNDLE_PATH_RE = NEXT_BUNDLE_PATH_RE; exports.collapseDoubleSlashes = collapseDoubleSlashes; exports.createScope = createScope; exports.registerScope = registerScope; exports.getScope = getScope; exports.formatRemoteId = formatRemoteId; exports.parseRemoteId = parseRemoteId; exports.createRemoteImageLoader = createRemoteImageLoader; exports.createSharedModulePlan = createSharedModulePlan; exports.installSharedModulePlan = installSharedModulePlan; exports.CORE_REACT_SHARED_KEYS = CORE_REACT_SHARED_KEYS; exports.VENDOR_SHARED = VENDOR_SHARED; exports.buildCoreShared = buildCoreShared; exports.buildHostShared = buildHostShared; exports.buildWebpackResolve = buildWebpackResolve;
443
+ //# sourceMappingURL=chunk-7XXO2DLF.cjs.map