remote-components 0.4.13 → 0.4.14

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 (90) hide show
  1. package/dist/{chunk-CLB2ATH2.js → chunk-EIEIT5PG.js} +3 -3
  2. package/dist/{chunk-5BBEO4SE.js → chunk-GG32LZD3.js} +2 -2
  3. package/dist/{chunk-KP544TQH.cjs → chunk-JKDPK6L5.cjs} +23 -23
  4. package/dist/{chunk-KMG54QXV.cjs → chunk-MAVMKFFL.cjs} +3 -3
  5. package/dist/{chunk-XEO3XD67.js → chunk-PNKSHWZ3.js} +5 -5
  6. package/dist/{chunk-OI37BBBU.cjs → chunk-T2JJIQUJ.cjs} +22 -22
  7. package/dist/{chunk-OVD7BRLD.cjs → chunk-TIS6PXSQ.cjs} +18 -18
  8. package/dist/{chunk-W7RJUCZQ.cjs → chunk-WCZKEWRM.cjs} +19 -19
  9. package/dist/{chunk-3DR4Z24C.js → chunk-WWHNG5YP.js} +36 -23
  10. package/dist/chunk-WWHNG5YP.js.map +1 -0
  11. package/dist/{chunk-IE7FXNFJ.js → chunk-XLGLCKZZ.js} +2 -2
  12. package/dist/{chunk-CBEDRGC7.js → chunk-YKCU7RFM.js} +3 -3
  13. package/dist/{chunk-OZCVXVKU.cjs → chunk-ZPJ5J24T.cjs} +45 -32
  14. package/dist/chunk-ZPJ5J24T.cjs.map +1 -0
  15. package/dist/config/nextjs.cjs +5 -5
  16. package/dist/config/nextjs.js +1 -1
  17. package/dist/host/html.cjs +19 -19
  18. package/dist/host/html.js +7 -7
  19. package/dist/host/nextjs/app/client-only.cjs +20 -11
  20. package/dist/host/nextjs/app/client-only.cjs.map +1 -1
  21. package/dist/host/nextjs/app/client-only.js +17 -8
  22. package/dist/host/nextjs/app/client-only.js.map +1 -1
  23. package/dist/host/nextjs/app.cjs +2 -0
  24. package/dist/host/nextjs/app.cjs.map +1 -1
  25. package/dist/host/nextjs/app.js +2 -0
  26. package/dist/host/nextjs/app.js.map +1 -1
  27. package/dist/host/nextjs/pages.cjs +14 -7
  28. package/dist/host/nextjs/pages.cjs.map +1 -1
  29. package/dist/host/nextjs/pages.d.ts +2 -0
  30. package/dist/host/nextjs/pages.js +14 -7
  31. package/dist/host/nextjs/pages.js.map +1 -1
  32. package/dist/host/react.cjs +7 -7
  33. package/dist/host/react.js +6 -6
  34. package/dist/internal/host/nextjs/app-client.cjs +8 -3
  35. package/dist/internal/host/nextjs/app-client.cjs.map +1 -1
  36. package/dist/internal/host/nextjs/app-client.d.ts +3 -2
  37. package/dist/internal/host/nextjs/app-client.js +8 -3
  38. package/dist/internal/host/nextjs/app-client.js.map +1 -1
  39. package/dist/internal/host/nextjs/dom-flight.cjs +1 -0
  40. package/dist/internal/host/nextjs/dom-flight.cjs.map +1 -1
  41. package/dist/internal/host/nextjs/dom-flight.d.ts +1 -0
  42. package/dist/internal/host/nextjs/dom-flight.js +1 -0
  43. package/dist/internal/host/nextjs/dom-flight.js.map +1 -1
  44. package/dist/internal/host/nextjs/image-shared.cjs +11 -2
  45. package/dist/internal/host/nextjs/image-shared.cjs.map +1 -1
  46. package/dist/internal/host/nextjs/image-shared.d.ts +3 -1
  47. package/dist/internal/host/nextjs/image-shared.js +11 -2
  48. package/dist/internal/host/nextjs/image-shared.js.map +1 -1
  49. package/dist/internal/host/server/fetch-remote-component.cjs +58 -3
  50. package/dist/internal/host/server/fetch-remote-component.cjs.map +1 -1
  51. package/dist/internal/host/server/fetch-remote-component.d.ts +1 -0
  52. package/dist/internal/host/server/fetch-remote-component.js +61 -3
  53. package/dist/internal/host/server/fetch-remote-component.js.map +1 -1
  54. package/dist/internal/host/server/types.cjs.map +1 -1
  55. package/dist/internal/host/server/types.d.ts +2 -0
  56. package/dist/internal/host/shared/next-image-deployment-id.cjs +50 -0
  57. package/dist/internal/host/shared/next-image-deployment-id.cjs.map +1 -0
  58. package/dist/internal/host/shared/next-image-deployment-id.d.ts +14 -0
  59. package/dist/internal/host/shared/next-image-deployment-id.js +25 -0
  60. package/dist/internal/host/shared/next-image-deployment-id.js.map +1 -0
  61. package/dist/internal/host/shared/pipeline.d.ts +2 -1
  62. package/dist/internal/host/shared/remote-image-loader.cjs +15 -23
  63. package/dist/internal/host/shared/remote-image-loader.cjs.map +1 -1
  64. package/dist/internal/host/shared/remote-image-loader.d.ts +2 -1
  65. package/dist/internal/host/shared/remote-image-loader.js +17 -22
  66. package/dist/internal/host/shared/remote-image-loader.js.map +1 -1
  67. package/dist/internal/runtime/html/parse-remote-html.d.ts +1 -0
  68. package/dist/internal/runtime/loaders/component-loader.d.ts +2 -1
  69. package/dist/{server-handoff-9e905049.d.ts → server-handoff-006f9cb5.d.ts} +2 -0
  70. package/dist/{turbopack-Z744H3T4.js → turbopack-HK7DVYUG.js} +4 -4
  71. package/dist/{turbopack-5WAY6QIC.cjs → turbopack-YZOIO55D.cjs} +11 -11
  72. package/dist/{webpack-IQKPPBGH.js → webpack-2HP73JL7.js} +4 -4
  73. package/dist/{webpack-3GSL5AZJ.cjs → webpack-W2MODB73.cjs} +11 -11
  74. package/package.json +1 -1
  75. package/dist/chunk-3DR4Z24C.js.map +0 -1
  76. package/dist/chunk-OZCVXVKU.cjs.map +0 -1
  77. /package/dist/{chunk-CLB2ATH2.js.map → chunk-EIEIT5PG.js.map} +0 -0
  78. /package/dist/{chunk-5BBEO4SE.js.map → chunk-GG32LZD3.js.map} +0 -0
  79. /package/dist/{chunk-KP544TQH.cjs.map → chunk-JKDPK6L5.cjs.map} +0 -0
  80. /package/dist/{chunk-KMG54QXV.cjs.map → chunk-MAVMKFFL.cjs.map} +0 -0
  81. /package/dist/{chunk-XEO3XD67.js.map → chunk-PNKSHWZ3.js.map} +0 -0
  82. /package/dist/{chunk-OI37BBBU.cjs.map → chunk-T2JJIQUJ.cjs.map} +0 -0
  83. /package/dist/{chunk-OVD7BRLD.cjs.map → chunk-TIS6PXSQ.cjs.map} +0 -0
  84. /package/dist/{chunk-W7RJUCZQ.cjs.map → chunk-WCZKEWRM.cjs.map} +0 -0
  85. /package/dist/{chunk-IE7FXNFJ.js.map → chunk-XLGLCKZZ.js.map} +0 -0
  86. /package/dist/{chunk-CBEDRGC7.js.map → chunk-YKCU7RFM.js.map} +0 -0
  87. /package/dist/{turbopack-Z744H3T4.js.map → turbopack-HK7DVYUG.js.map} +0 -0
  88. /package/dist/{turbopack-5WAY6QIC.cjs.map → turbopack-YZOIO55D.cjs.map} +0 -0
  89. /package/dist/{webpack-IQKPPBGH.js.map → webpack-2HP73JL7.js.map} +0 -0
  90. /package/dist/{webpack-3GSL5AZJ.cjs.map → webpack-W2MODB73.cjs.map} +0 -0
@@ -7,7 +7,7 @@
7
7
 
8
8
 
9
9
 
10
- var _chunkOI37BBBUcjs = require('./chunk-OI37BBBU.cjs');
10
+ var _chunkT2JJIQUJcjs = require('./chunk-T2JJIQUJ.cjs');
11
11
 
12
12
 
13
13
  var _chunk3AX5WLZDcjs = require('./chunk-3AX5WLZD.cjs');
@@ -21,7 +21,7 @@ var _chunkN3SQTOSEcjs = require('./chunk-N3SQTOSE.cjs');
21
21
 
22
22
 
23
23
 
24
- var _chunkOZCVXVKUcjs = require('./chunk-OZCVXVKU.cjs');
24
+ var _chunkZPJ5J24Tcjs = require('./chunk-ZPJ5J24T.cjs');
25
25
 
26
26
 
27
27
  var _chunkZ2SLBFQLcjs = require('./chunk-Z2SLBFQL.cjs');
@@ -92,7 +92,7 @@ function setAttributesFromProps(el, props) {
92
92
  function useResolveClientUrl(prop, urlHref) {
93
93
  const { resolveClientUrl: contextValue } = _context.useRemoteComponentsContext.call(void 0, );
94
94
  const raw = _nullishCoalesce(prop, () => ( contextValue));
95
- return _react.useMemo.call(void 0, () => _chunkOI37BBBUcjs.bindResolveClientUrl.call(void 0, raw, urlHref), [raw, urlHref]);
95
+ return _react.useMemo.call(void 0, () => _chunkT2JJIQUJcjs.bindResolveClientUrl.call(void 0, raw, urlHref), [raw, urlHref]);
96
96
  }
97
97
 
98
98
  // src/host/react/hooks/use-shadow-root.ts
@@ -154,7 +154,7 @@ function getRemoteComponentHtml(html) {
154
154
  return ssrRemoteComponentContainer.innerHTML;
155
155
  }
156
156
  const remoteComponentContainer = temp.querySelectorAll(
157
- `div[data-bundle][data-route][data-runtime][id^="${_chunkOZCVXVKUcjs.DEFAULT_COMPONENT_NAME}"],div[data-bundle][data-route],div#__next,remote-component:not([src])`
157
+ `div[data-bundle][data-route][data-runtime][id^="${_chunkZPJ5J24Tcjs.DEFAULT_COMPONENT_NAME}"],div[data-bundle][data-route],div#__next,remote-component:not([src])`
158
158
  );
159
159
  if (remoteComponentContainer.length > 0) {
160
160
  return `${Array.from(temp.querySelectorAll("link,script")).map((link) => link.outerHTML).join("")}${Array.from(remoteComponentContainer).map((container) => container.outerHTML).join("")}`;
@@ -179,7 +179,7 @@ function ConsumeRemoteComponent({
179
179
  mode = "open",
180
180
  reset,
181
181
  credentials: credentialsProp,
182
- name: nameProp = _chunkOZCVXVKUcjs.DEFAULT_COMPONENT_NAME,
182
+ name: nameProp = _chunkZPJ5J24Tcjs.DEFAULT_COMPONENT_NAME,
183
183
  shared: sharedProp,
184
184
  children,
185
185
  onBeforeLoad,
@@ -195,22 +195,22 @@ function ConsumeRemoteComponent({
195
195
  const credentials = _nullishCoalesce(_nullishCoalesce(credentialsProp, () => ( contextCredentials)), () => ( "same-origin"));
196
196
  const shared = _nullishCoalesce(_nullishCoalesce(sharedProp, () => ( contextShared)), () => ( {}));
197
197
  const emitter = _react.useMemo.call(void 0,
198
- () => _chunkOI37BBBUcjs.makeReactEmitter.call(void 0, { onBeforeLoad, onLoad, onError, onChange }),
198
+ () => _chunkT2JJIQUJcjs.makeReactEmitter.call(void 0, { onBeforeLoad, onLoad, onError, onChange }),
199
199
  [onBeforeLoad, onLoad, onError, onChange]
200
200
  );
201
201
  const name = _react.useMemo.call(void 0,
202
- () => _chunkOI37BBBUcjs.resolveNameFromSrc.call(void 0, src, nameProp),
202
+ () => _chunkT2JJIQUJcjs.resolveNameFromSrc.call(void 0, src, nameProp),
203
203
  [src, nameProp]
204
204
  );
205
205
  const [data, setData] = _react.useState.call(void 0,
206
206
  null
207
207
  );
208
- const url = _react.useMemo.call(void 0, () => _chunkOI37BBBUcjs.getClientOrServerUrl.call(void 0, src, DUMMY_FALLBACK), [src]);
208
+ const url = _react.useMemo.call(void 0, () => _chunkT2JJIQUJcjs.getClientOrServerUrl.call(void 0, src, DUMMY_FALLBACK), [src]);
209
209
  const resolveClientUrl = useResolveClientUrl(resolveClientUrlProp, url.href);
210
210
  const id = url.origin === (typeof location !== "undefined" ? location.origin : DUMMY_FALLBACK) ? url.pathname : url.href;
211
- const keySuffix = `${_chunkOZCVXVKUcjs.escapeString.call(void 0, id)}_${_chunkOZCVXVKUcjs.escapeString.call(void 0,
211
+ const keySuffix = `${_chunkZPJ5J24Tcjs.escapeString.call(void 0, id)}_${_chunkZPJ5J24Tcjs.escapeString.call(void 0,
212
212
  _nullishCoalesce(_optionalChain([data, 'optionalAccess', _5 => _5.name]), () => ( name))
213
- )}_${_chunkOZCVXVKUcjs.escapeString.call(void 0, instanceId)}`;
213
+ )}_${_chunkZPJ5J24Tcjs.escapeString.call(void 0, instanceId)}`;
214
214
  const [remoteComponent, setRemoteComponent] = _react.useState.call(void 0, null);
215
215
  const { shadowRoot, shadowRootContainerRef } = useShadowRoot({
216
216
  isolate,
@@ -240,7 +240,7 @@ function ConsumeRemoteComponent({
240
240
  return elements;
241
241
  })() : []
242
242
  );
243
- const hostStateRef = _react.useRef.call(void 0, _chunkOI37BBBUcjs.createHostState.call(void 0, ));
243
+ const hostStateRef = _react.useRef.call(void 0, _chunkT2JJIQUJcjs.createHostState.call(void 0, ));
244
244
  const componentHydrationHtml = _react.useRef.call(void 0, null);
245
245
  const prevRemoteComponentContainerRef = _react.useRef.call(void 0, null);
246
246
  const unmountRef = _react.useRef.call(void 0, null);
@@ -362,7 +362,7 @@ function ConsumeRemoteComponent({
362
362
  _nullishCoalesce(_optionalChain([resolveClientUrl, 'optionalCall', _29 => _29(url.href)]), () => ( url.href)),
363
363
  location.href
364
364
  );
365
- const res = await _chunkOI37BBBUcjs.fetchWithHooks.call(void 0, resolvedUrl, fetchInit, {
365
+ const res = await _chunkT2JJIQUJcjs.fetchWithHooks.call(void 0, resolvedUrl, fetchInit, {
366
366
  onRequest,
367
367
  onResponse,
368
368
  abortController: hostStateRef.current.abortController
@@ -381,7 +381,7 @@ function ConsumeRemoteComponent({
381
381
  const userShared = await shared;
382
382
  if (signal.aborted)
383
383
  return;
384
- const prepared = _chunkOI37BBBUcjs.preparePipeline.call(void 0, {
384
+ const prepared = _chunkT2JJIQUJcjs.preparePipeline.call(void 0, {
385
385
  html,
386
386
  name,
387
387
  url,
@@ -422,7 +422,7 @@ function ConsumeRemoteComponent({
422
422
  href: new URL(_nullishCoalesce(link.getAttribute("href"), () => ( link.href)), url).href,
423
423
  ...link.getAttributeNames().reduce((acc, key) => {
424
424
  if (key !== "href") {
425
- acc[_nullishCoalesce(_chunkOZCVXVKUcjs.attrToProp[key], () => ( key))] = _nullishCoalesce(link.getAttribute(key), () => ( ""));
425
+ acc[_nullishCoalesce(_chunkZPJ5J24Tcjs.attrToProp[key], () => ( key))] = _nullishCoalesce(link.getAttribute(key), () => ( ""));
426
426
  }
427
427
  return acc;
428
428
  }, {})
@@ -498,7 +498,7 @@ function ConsumeRemoteComponent({
498
498
  });
499
499
  self.__next_s = prevNextScripts;
500
500
  }
501
- const rscName = rsc ? `__remote_component_rsc_${_chunkOZCVXVKUcjs.escapeString.call(void 0, id)}_${_chunkOZCVXVKUcjs.escapeString.call(void 0,
501
+ const rscName = rsc ? `__remote_component_rsc_${_chunkZPJ5J24Tcjs.escapeString.call(void 0, id)}_${_chunkZPJ5J24Tcjs.escapeString.call(void 0,
502
502
  remoteName
503
503
  )}` : void 0;
504
504
  if (rsc) {
@@ -572,7 +572,7 @@ function ConsumeRemoteComponent({
572
572
  setStylesReady(true);
573
573
  hostStateRef.current.stage = "loaded";
574
574
  } else {
575
- const result = await _chunkOI37BBBUcjs.loadPrepared.call(void 0, {
575
+ const result = await _chunkT2JJIQUJcjs.loadPrepared.call(void 0, {
576
576
  prepared,
577
577
  url,
578
578
  signal,
@@ -641,8 +641,8 @@ function ConsumeRemoteComponent({
641
641
  const metadataJson = /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "script", { "data-remote-component": true, type: "application/json", children: JSON.stringify({
642
642
  name: _optionalChain([data, 'optionalAccess', _33 => _33.name]) || name,
643
643
  bundle: _optionalChain([data, 'optionalAccess', _34 => _34.bundle]) || "default",
644
- route: _optionalChain([data, 'optionalAccess', _35 => _35.route]) || _chunkOZCVXVKUcjs.DEFAULT_ROUTE,
645
- runtime: hostStateRef.current.prevIsRemoteComponent ? _chunkOZCVXVKUcjs.RUNTIME_SCRIPT : _optionalChain([data, 'optionalAccess', _36 => _36.runtime]) || _chunkOZCVXVKUcjs.RUNTIME_WEBPACK
644
+ route: _optionalChain([data, 'optionalAccess', _35 => _35.route]) || _chunkZPJ5J24Tcjs.DEFAULT_ROUTE,
645
+ runtime: hostStateRef.current.prevIsRemoteComponent ? _chunkZPJ5J24Tcjs.RUNTIME_SCRIPT : _optionalChain([data, 'optionalAccess', _36 => _36.runtime]) || _chunkZPJ5J24Tcjs.RUNTIME_WEBPACK
646
646
  }) });
647
647
  const resetStyle = reset ? /* @__PURE__ */ _jsxruntime.jsx.call(void 0, "style", { "data-remote-components-reset": "react", children: `:host { all: initial; }` }) : null;
648
648
  const linksToRender = _optionalChain([data, 'optionalAccess', _37 => _37.links, 'optionalAccess', _38 => _38.map, 'call', _39 => _39((link) => /* @__PURE__ */ _react.createElement.call(void 0,
@@ -757,4 +757,4 @@ function ConsumeRemoteComponent({
757
757
 
758
758
 
759
759
  exports.useRemoteNavigate = useRemoteNavigate; exports.ConsumeRemoteComponent = ConsumeRemoteComponent;
760
- //# sourceMappingURL=chunk-W7RJUCZQ.cjs.map
760
+ //# sourceMappingURL=chunk-WCZKEWRM.cjs.map
@@ -126,6 +126,28 @@ function collapseDoubleSlashes(path) {
126
126
  return path.replace(DOUBLE_SLASH_RE, "/");
127
127
  }
128
128
 
129
+ // src/host/shared/next-image-deployment-id.ts
130
+ function isNextDeploymentAssetSrc(src) {
131
+ return typeof src === "string" && src.startsWith("/") && !src.startsWith("//");
132
+ }
133
+ function extractDeploymentIdFromSrc(src) {
134
+ const queryIndex = src.indexOf("?");
135
+ if (queryIndex === -1) {
136
+ return { deploymentId: void 0, src };
137
+ }
138
+ const params = new URLSearchParams(src.slice(queryIndex + 1));
139
+ const deploymentId = params.get("dpl") || void 0;
140
+ if (!deploymentId) {
141
+ return { deploymentId: void 0, src };
142
+ }
143
+ params.delete("dpl");
144
+ const remaining = params.toString();
145
+ return {
146
+ deploymentId,
147
+ src: `${src.slice(0, queryIndex)}${remaining ? `?${remaining}` : ""}`
148
+ };
149
+ }
150
+
129
151
  // src/runtime/turbopack/remote-scope.ts
130
152
  function getRegistry() {
131
153
  return getNamespace().scopes;
@@ -183,27 +205,13 @@ function parseRemoteId(id) {
183
205
  }
184
206
 
185
207
  // src/host/shared/remote-image-loader.ts
186
- function extractDeploymentIdFromSrc(src) {
187
- if (!src.startsWith("/") || src.startsWith("//")) {
188
- return { deploymentId: void 0, src };
189
- }
190
- const queryIndex = src.indexOf("?");
191
- if (queryIndex === -1) {
192
- return { deploymentId: void 0, src };
193
- }
194
- const params = new URLSearchParams(src.slice(queryIndex + 1));
195
- const deploymentId = params.get("dpl") || void 0;
196
- if (!deploymentId) {
197
- return { deploymentId: void 0, src };
198
- }
199
- params.delete("dpl");
200
- const remaining = params.toString();
201
- return {
202
- deploymentId,
203
- src: `${src.slice(0, queryIndex)}${remaining ? `?${remaining}` : ""}`
204
- };
205
- }
206
- function createRemoteImageLoader(bundle, resolveClientUrl) {
208
+ function createRemoteImageLoader(bundle, resolveClientUrl, ssrImageDeploymentIds) {
209
+ const ssrImageDeploymentIdMap = ssrImageDeploymentIds ? new Map(
210
+ ssrImageDeploymentIds.map(({ src, deploymentId }) => [
211
+ src,
212
+ deploymentId
213
+ ])
214
+ ) : void 0;
207
215
  const loader = Object.assign(
208
216
  ({
209
217
  config,
@@ -215,8 +223,13 @@ function createRemoteImageLoader(bundle, resolveClientUrl) {
215
223
  const remoteOrigin = getScope(bundle)?.url.origin ?? "";
216
224
  const isCrossOrigin = remoteOrigin && remoteOrigin !== location.origin;
217
225
  const basePath = isCrossOrigin ? `${remoteOrigin}${config.path ?? "/_next/image"}` : config.path ?? `${remoteOrigin}/_next/image`;
226
+ if (!isNextDeploymentAssetSrc(src)) {
227
+ const url2 = `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${q}`;
228
+ return resolveClientUrl?.(url2) ?? url2;
229
+ }
218
230
  const extracted = extractDeploymentIdFromSrc(src);
219
- const deploymentParam = extracted.deploymentId ? `&dpl=${encodeURIComponent(extracted.deploymentId)}` : "";
231
+ const deploymentId = extracted.deploymentId ?? ssrImageDeploymentIdMap?.get(extracted.src);
232
+ const deploymentParam = deploymentId ? `&dpl=${encodeURIComponent(deploymentId)}` : "";
220
233
  const url = `${basePath}?url=${encodeURIComponent(extracted.src)}&w=${width}&q=${q}${deploymentParam}`;
221
234
  return resolveClientUrl?.(url) ?? url;
222
235
  },
@@ -453,4 +466,4 @@ export {
453
466
  buildCoreShared,
454
467
  buildHostShared
455
468
  };
456
- //# sourceMappingURL=chunk-3DR4Z24C.js.map
469
+ //# sourceMappingURL=chunk-WWHNG5YP.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/host/shared/shared-broker.ts","../src/utils/index.ts","../src/runtime/constants.ts","../src/runtime/patterns.ts","../src/host/shared/next-image-deployment-id.ts","../src/runtime/turbopack/remote-scope.ts","../src/host/shared/remote-image-loader.ts","../src/host/shared/polyfill.tsx","../src/host/shared/shared-module-resolver.ts"],"sourcesContent":["import type { LogLocation } from '#internal/utils/logger';\nimport { logDebug, logError } from '#internal/utils/logger';\n\nexport type SharedModuleFactory = (bundle?: string) => Promise<unknown>;\n\nexport const SHARED_MODULE_MANIFEST_PROTOCOL =\n 'remote-components.shared.v1' as const;\n\n// @legacy(remote-components<=0.4.x): remove this map shape once all supported\n// remotes emit sharedManifest. The provider path should then consume only\n// SharedModuleManifest requirements.\nexport type LegacySharedModuleMap = Record<string, string | number>;\n\nexport interface SharedModuleManifestRequirement {\n id: string | number;\n specifier: string;\n required?: boolean;\n singleton?: boolean;\n scope?: string;\n}\n\nexport interface SharedModuleManifest {\n protocol: typeof SHARED_MODULE_MANIFEST_PROTOCOL;\n requirements: SharedModuleManifestRequirement[];\n}\n\nexport type RemoteSharedModules = LegacySharedModuleMap | SharedModuleManifest;\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: 'legacy' | typeof SHARED_MODULE_MANIFEST_PROTOCOL;\n bundle: string;\n entries: SharedModuleResolution[];\n}\n\nexport function isSharedModuleManifest(\n value: unknown,\n): value is SharedModuleManifest {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'protocol' in value &&\n value.protocol === SHARED_MODULE_MANIFEST_PROTOCOL &&\n 'requirements' in value &&\n Array.isArray(value.requirements)\n );\n}\n\nexport function getMissingSharedModulesMessage(\n remoteShared: RemoteSharedModules,\n): string | undefined {\n if (isSharedModuleManifest(remoteShared)) return undefined;\n const message = remoteShared.__remote_components_missing_shared__;\n return typeof message === 'string' ? message : undefined;\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: RemoteSharedModules;\n scope?: string;\n callerTag?: LogLocation;\n}): SharedModulePlan {\n const protocol = isSharedModuleManifest(remoteShared)\n ? remoteShared.protocol\n : 'legacy';\n const requirements: SharedModuleManifestRequirement[] =\n isSharedModuleManifest(remoteShared)\n ? remoteShared.requirements\n : // @legacy(remote-components<=0.4.x): normalize the historical shared\n // map until hosts and remotes on 0.4.x are no longer supported.\n Object.entries(remoteShared).map(([id, specifier]) => ({\n id,\n specifier: String(specifier),\n required: true,\n singleton: true,\n }));\n\n const entries = requirements.map((requirement) => {\n const specifier = String(requirement.specifier);\n const provider = hostShared[specifier];\n const entry: SharedModuleResolution = {\n id: String(requirement.id),\n specifier,\n required: requirement.required ?? true,\n singleton: requirement.singleton ?? true,\n scope: requirement.scope ?? 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 \"${entry.id}\" but the host does not provide it`,\n );\n }\n\n return entry;\n });\n\n logDebug(\n callerTag,\n `Share plan (${protocol}) for \"${bundle}\": ${entries\n .map((entry) => `${entry.id}=>${entry.specifier}:${entry.status}`)\n .join(', ')}`,\n );\n\n return {\n protocol,\n bundle,\n entries,\n };\n}\n\nfunction missingRequiredSharedModuleMessage(\n plan: SharedModulePlan,\n entry: SharedModuleResolution,\n): string {\n return (\n `Remote Component \"${plan.bundle}\" requires shared module \"${entry.specifier}\", but the host does not provide it. ` +\n 'Add it to the host shared modules through `withRemoteComponentsConfig({ shared: [...] })` or the `shared` prop. ' +\n 'This diagnostic runs when both host and remote support the shared-module manifest in remote-components >=0.5.0. ' +\n 'The remote may load its bundled copy during the compatibility window; this will become a load error after remote-components <=0.4.x support is removed.'\n );\n}\n\nfunction logMissingRequiredSharedModule(\n callerTag: LogLocation,\n plan: SharedModulePlan,\n entry: SharedModuleResolution,\n): void {\n logError(callerTag, missingRequiredSharedModuleMessage(plan, entry));\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') {\n if (\n plan.protocol === SHARED_MODULE_MANIFEST_PROTOCOL &&\n entry.required\n ) {\n logMissingRequiredSharedModule('SharedBroker', plan, entry);\n }\n return;\n }\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","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","export interface NextImageDeploymentId {\n src: string;\n deploymentId: string;\n}\n\nexport function isNextDeploymentAssetSrc(src: string | null): src is string {\n return (\n typeof src === 'string' && src.startsWith('/') && !src.startsWith('//')\n );\n}\n\nexport function extractDeploymentIdFromSrc(src: string) {\n const queryIndex = src.indexOf('?');\n if (queryIndex === -1) {\n return { deploymentId: undefined, src };\n }\n\n const params = new URLSearchParams(src.slice(queryIndex + 1));\n const deploymentId = params.get('dpl') || undefined;\n if (!deploymentId) {\n return { deploymentId: undefined, src };\n }\n\n params.delete('dpl');\n const remaining = params.toString();\n return {\n deploymentId,\n src: `${src.slice(0, queryIndex)}${remaining ? `?${remaining}` : ''}`,\n };\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 {\n extractDeploymentIdFromSrc,\n isNextDeploymentAssetSrc,\n type NextImageDeploymentId,\n} from '#internal/host/shared/next-image-deployment-id';\nimport { 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 ssrImageDeploymentIds?: readonly NextImageDeploymentId[],\n) {\n const ssrImageDeploymentIdMap = ssrImageDeploymentIds\n ? new Map(\n ssrImageDeploymentIds.map(({ src, deploymentId }) => [\n src,\n deploymentId,\n ]),\n )\n : undefined;\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\n if (!isNextDeploymentAssetSrc(src)) {\n const url = `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${q}`;\n return resolveClientUrl?.(url) ?? url;\n }\n\n const extracted = extractDeploymentIdFromSrc(src);\n const deploymentId =\n extracted.deploymentId ?? ssrImageDeploymentIdMap?.get(extracted.src);\n const deploymentParam = deploymentId\n ? `&dpl=${encodeURIComponent(deploymentId)}`\n : '';\n const url = `${basePath}?url=${encodeURIComponent(extracted.src)}&w=${width}&q=${q}${deploymentParam}`;\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 { InternalResolveClientUrl } from '#internal/host/server/types';\nimport { sharedPolyfills } from '#internal/host/shared/polyfill';\nimport type { SharedModuleFactory } from '#internal/host/shared/shared-broker';\n\n/**\n * The core React packages that are always shared between host and remote.\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 shared-module manifest ID.\n * These IDs are emitted into sharedManifest for the default React entries.\n * For example, `react` maps to `/react/index.js`.\n */\nexport const CORE_REACT_SHARED_MODULE_IDS: 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 shared-module ID string literals. Derived from\n * CORE_REACT_SHARED_MODULE_IDS but excludes `react-dom/client` to match the\n * existing config behavior.\n */\nexport const VENDOR_SHARED: Record<string, string> = Object.fromEntries(\n Object.entries(CORE_REACT_SHARED_MODULE_IDS)\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\n * client-only shared global. Pass `includePagesClientSharedGlobal: true` to\n * include it at the end.\n */\nexport function buildHostShared(\n userShared?: Record<string, SharedModuleFactory>,\n resolveClientUrl?: InternalResolveClientUrl,\n options?: { includePagesClientSharedGlobal?: 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?.includePagesClientSharedGlobal) {\n Object.assign(result, self.__remote_component_shared__);\n }\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;AAKO,IAAM,kCACX;AAyCK,SAAS,uBACd,OAC+B;AAC/B,SACE,OAAO,UAAU,YACjB,UAAU,QACV,cAAc,SACd,MAAM,aAAa,mCACnB,kBAAkB,SAClB,MAAM,QAAQ,MAAM,YAAY;AAEpC;AAEO,SAAS,+BACd,cACoB;AACpB,MAAI,uBAAuB,YAAY;AAAG,WAAO;AACjD,QAAM,UAAU,aAAa;AAC7B,SAAO,OAAO,YAAY,WAAW,UAAU;AACjD;AAEO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ,UAAU;AAAA,EAClB,YAA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C;AAQO,SAAS,gBACd,YACqC;AACrC,SAAO;AAAA,IACL,OAAO,aAAa,MAAM,OAAO,OAAO,GAAG;AAAA,IAC3C,aAAa,aAAa,MAAM,OAAO,WAAW,GAAG;AAAA,IACrD,yBAAyB,aACtB,MAAM,OAAO,uBAAuB,GAAG;AAAA,IAC1C,qBAAqB,aAClB,MAAM,OAAO,mBAAmB,GAAG;AAAA,IACtC,oBAAoB,aAAa,MAAM,OAAO,kBAAkB,GAAG;AAAA,IACnE,GAAG;AAAA,EACL;AACF;AAoBO,SAAS,gBACd,YACA,kBACA,SACqC;AACrC,QAAM,OAAO;AACb,QAAM,SAA8C;AAAA,IAClD,GAAG,gBAAgB,YAAY,gBAAgB;AAAA,IAC/C,GAAG,KAAK;AAAA,IACR,GAAG;AAAA,EACL;AACA,MAAI,SAAS,gCAAgC;AAC3C,WAAO,OAAO,QAAQ,KAAK,2BAA2B;AAAA,EACxD;AACA,SAAO;AACT;","names":["url"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  NEXT_BUNDLE_PATH_RE
3
- } from "./chunk-3DR4Z24C.js";
3
+ } from "./chunk-WWHNG5YP.js";
4
4
  import {
5
5
  RemoteComponentsError,
6
6
  failedProxiedAssetError,
@@ -55,4 +55,4 @@ async function loadScripts(scripts, resolveClientUrl) {
55
55
  export {
56
56
  loadScripts
57
57
  };
58
- //# sourceMappingURL=chunk-IE7FXNFJ.js.map
58
+ //# sourceMappingURL=chunk-XLGLCKZZ.js.map
@@ -2,7 +2,7 @@ import {
2
2
  createChunkDispatcher,
3
3
  loadChunkWithScope,
4
4
  requireModule
5
- } from "./chunk-5BBEO4SE.js";
5
+ } from "./chunk-GG32LZD3.js";
6
6
  import {
7
7
  REMOTE_COMPONENT_REGEX,
8
8
  RUNTIME_TURBOPACK,
@@ -10,7 +10,7 @@ import {
10
10
  createScope,
11
11
  getScope,
12
12
  registerScope
13
- } from "./chunk-3DR4Z24C.js";
13
+ } from "./chunk-WWHNG5YP.js";
14
14
  import {
15
15
  getNamespace
16
16
  } from "./chunk-D5GNZB6O.js";
@@ -149,4 +149,4 @@ function createModuleDispatcher(runtime) {
149
149
  export {
150
150
  setupRemoteScope
151
151
  };
152
- //# sourceMappingURL=chunk-CBEDRGC7.js.map
152
+ //# sourceMappingURL=chunk-YKCU7RFM.js.map
@@ -126,6 +126,28 @@ function collapseDoubleSlashes(path) {
126
126
  return path.replace(DOUBLE_SLASH_RE, "/");
127
127
  }
128
128
 
129
+ // src/host/shared/next-image-deployment-id.ts
130
+ function isNextDeploymentAssetSrc(src) {
131
+ return typeof src === "string" && src.startsWith("/") && !src.startsWith("//");
132
+ }
133
+ function extractDeploymentIdFromSrc(src) {
134
+ const queryIndex = src.indexOf("?");
135
+ if (queryIndex === -1) {
136
+ return { deploymentId: void 0, src };
137
+ }
138
+ const params = new URLSearchParams(src.slice(queryIndex + 1));
139
+ const deploymentId = params.get("dpl") || void 0;
140
+ if (!deploymentId) {
141
+ return { deploymentId: void 0, src };
142
+ }
143
+ params.delete("dpl");
144
+ const remaining = params.toString();
145
+ return {
146
+ deploymentId,
147
+ src: `${src.slice(0, queryIndex)}${remaining ? `?${remaining}` : ""}`
148
+ };
149
+ }
150
+
129
151
  // src/runtime/turbopack/remote-scope.ts
130
152
  function getRegistry() {
131
153
  return _chunkZ2SLBFQLcjs.getNamespace.call(void 0, ).scopes;
@@ -183,27 +205,13 @@ function parseRemoteId(id) {
183
205
  }
184
206
 
185
207
  // src/host/shared/remote-image-loader.ts
186
- function extractDeploymentIdFromSrc(src) {
187
- if (!src.startsWith("/") || src.startsWith("//")) {
188
- return { deploymentId: void 0, src };
189
- }
190
- const queryIndex = src.indexOf("?");
191
- if (queryIndex === -1) {
192
- return { deploymentId: void 0, src };
193
- }
194
- const params = new URLSearchParams(src.slice(queryIndex + 1));
195
- const deploymentId = params.get("dpl") || void 0;
196
- if (!deploymentId) {
197
- return { deploymentId: void 0, src };
198
- }
199
- params.delete("dpl");
200
- const remaining = params.toString();
201
- return {
202
- deploymentId,
203
- src: `${src.slice(0, queryIndex)}${remaining ? `?${remaining}` : ""}`
204
- };
205
- }
206
- function createRemoteImageLoader(bundle, resolveClientUrl) {
208
+ function createRemoteImageLoader(bundle, resolveClientUrl, ssrImageDeploymentIds) {
209
+ const ssrImageDeploymentIdMap = ssrImageDeploymentIds ? new Map(
210
+ ssrImageDeploymentIds.map(({ src, deploymentId }) => [
211
+ src,
212
+ deploymentId
213
+ ])
214
+ ) : void 0;
207
215
  const loader = Object.assign(
208
216
  ({
209
217
  config,
@@ -215,10 +223,15 @@ function createRemoteImageLoader(bundle, resolveClientUrl) {
215
223
  const remoteOrigin = _nullishCoalesce(_optionalChain([getScope, 'call', _6 => _6(bundle), 'optionalAccess', _7 => _7.url, 'access', _8 => _8.origin]), () => ( ""));
216
224
  const isCrossOrigin = remoteOrigin && remoteOrigin !== location.origin;
217
225
  const basePath = isCrossOrigin ? `${remoteOrigin}${_nullishCoalesce(config.path, () => ( "/_next/image"))}` : _nullishCoalesce(config.path, () => ( `${remoteOrigin}/_next/image`));
226
+ if (!isNextDeploymentAssetSrc(src)) {
227
+ const url2 = `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${q}`;
228
+ return _nullishCoalesce(_optionalChain([resolveClientUrl, 'optionalCall', _9 => _9(url2)]), () => ( url2));
229
+ }
218
230
  const extracted = extractDeploymentIdFromSrc(src);
219
- const deploymentParam = extracted.deploymentId ? `&dpl=${encodeURIComponent(extracted.deploymentId)}` : "";
231
+ const deploymentId = _nullishCoalesce(extracted.deploymentId, () => ( _optionalChain([ssrImageDeploymentIdMap, 'optionalAccess', _10 => _10.get, 'call', _11 => _11(extracted.src)])));
232
+ const deploymentParam = deploymentId ? `&dpl=${encodeURIComponent(deploymentId)}` : "";
220
233
  const url = `${basePath}?url=${encodeURIComponent(extracted.src)}&w=${width}&q=${q}${deploymentParam}`;
221
- return _nullishCoalesce(_optionalChain([resolveClientUrl, 'optionalCall', _9 => _9(url)]), () => ( url));
234
+ return _nullishCoalesce(_optionalChain([resolveClientUrl, 'optionalCall', _12 => _12(url)]), () => ( url));
222
235
  },
223
236
  // Signals to getImgProps that this is a default loader (not a user-defined
224
237
  // one), enabling srcSet generation with device/image sizes from the config.
@@ -237,7 +250,7 @@ function dispatchRemoteNavigate(detail) {
237
250
  function sharedPolyfills(shared, resolveClientUrl) {
238
251
  const hostShared = _chunkZ2SLBFQLcjs.getNamespace.call(void 0, ).hostSharedModules;
239
252
  const polyfill = {
240
- "next/dist/client/components/navigation": _nullishCoalesce(_nullishCoalesce(hostShared["next/navigation"], () => ( _optionalChain([shared, 'optionalAccess', _10 => _10["next/navigation"]]))), () => ( (() => Promise.resolve({
253
+ "next/dist/client/components/navigation": _nullishCoalesce(_nullishCoalesce(hostShared["next/navigation"], () => ( _optionalChain([shared, 'optionalAccess', _13 => _13["next/navigation"]]))), () => ( (() => Promise.resolve({
241
254
  useRouter() {
242
255
  return {
243
256
  push: (routerUrl) => {
@@ -270,7 +283,7 @@ function sharedPolyfills(shared, resolveClientUrl) {
270
283
  },
271
284
  __esModule: true
272
285
  })))),
273
- "next/dist/client/app-dir/link": _nullishCoalesce(_nullishCoalesce(hostShared["next/link"], () => ( _optionalChain([shared, 'optionalAccess', _11 => _11["next/link"]]))), () => ( (() => Promise.resolve({
286
+ "next/dist/client/app-dir/link": _nullishCoalesce(_nullishCoalesce(hostShared["next/link"], () => ( _optionalChain([shared, 'optionalAccess', _14 => _14["next/link"]]))), () => ( (() => Promise.resolve({
274
287
  default: ({
275
288
  scroll: _,
276
289
  replace,
@@ -300,7 +313,7 @@ function sharedPolyfills(shared, resolveClientUrl) {
300
313
  if (typeof props.onClick === "function") {
301
314
  props.onClick(e);
302
315
  }
303
- _optionalChain([onNavigate, 'optionalCall', _12 => _12(e)]);
316
+ _optionalChain([onNavigate, 'optionalCall', _15 => _15(e)]);
304
317
  if (preventDefaulted) {
305
318
  return;
306
319
  }
@@ -324,7 +337,7 @@ function sharedPolyfills(shared, resolveClientUrl) {
324
337
  },
325
338
  __esModule: true
326
339
  })))),
327
- "next/dist/client/app-dir/form": _nullishCoalesce(_nullishCoalesce(hostShared["next/form"], () => ( _optionalChain([shared, 'optionalAccess', _13 => _13["next/form"]]))), () => ( (() => Promise.resolve({
340
+ "next/dist/client/app-dir/form": _nullishCoalesce(_nullishCoalesce(hostShared["next/form"], () => ( _optionalChain([shared, 'optionalAccess', _16 => _16["next/form"]]))), () => ( (() => Promise.resolve({
328
341
  default: () => {
329
342
  throw new Error("Next.js <Form> component not implemented");
330
343
  },
@@ -335,17 +348,17 @@ function sharedPolyfills(shared, resolveClientUrl) {
335
348
  // This gives us full next/image fidelity (fill, priority, srcSet, blur
336
349
  // placeholders, error handling) while routing image optimization through the
337
350
  // remote app's /_next/image endpoint.
338
- "next/dist/shared/lib/image-loader": _nullishCoalesce(_nullishCoalesce(hostShared["next/dist/shared/lib/image-loader"], () => ( _optionalChain([shared, 'optionalAccess', _14 => _14["next/dist/shared/lib/image-loader"]]))), () => ( ((bundle) => Promise.resolve({
351
+ "next/dist/shared/lib/image-loader": _nullishCoalesce(_nullishCoalesce(hostShared["next/dist/shared/lib/image-loader"], () => ( _optionalChain([shared, 'optionalAccess', _17 => _17["next/dist/shared/lib/image-loader"]]))), () => ( ((bundle) => Promise.resolve({
339
352
  default: createRemoteImageLoader(bundle, resolveClientUrl),
340
353
  __esModule: true
341
354
  })))),
342
- "next/dist/client/script": _nullishCoalesce(_nullishCoalesce(hostShared["next/script"], () => ( _optionalChain([shared, 'optionalAccess', _15 => _15["next/script"]]))), () => ( (() => Promise.resolve({
355
+ "next/dist/client/script": _nullishCoalesce(_nullishCoalesce(hostShared["next/script"], () => ( _optionalChain([shared, 'optionalAccess', _18 => _18["next/script"]]))), () => ( (() => Promise.resolve({
343
356
  // TODO: implement <Script> component for non-Next.js host applications
344
357
  // do not throw an error for now
345
358
  default: () => null,
346
359
  __esModule: true
347
360
  })))),
348
- "next/router": _nullishCoalesce(_nullishCoalesce(hostShared["next/router"], () => ( _optionalChain([shared, 'optionalAccess', _16 => _16["next/router"]]))), () => ( (() => (
361
+ "next/router": _nullishCoalesce(_nullishCoalesce(hostShared["next/router"], () => ( _optionalChain([shared, 'optionalAccess', _19 => _19["next/router"]]))), () => ( (() => (
349
362
  // TODO: incomplete implementation
350
363
  Promise.resolve({
351
364
  useRouter() {
@@ -418,7 +431,7 @@ function buildHostShared(userShared, resolveClientUrl, options) {
418
431
  ...self.__remote_component_host_shared_modules__,
419
432
  ...userShared
420
433
  };
421
- if (_optionalChain([options, 'optionalAccess', _17 => _17.includePagesClientSharedGlobal])) {
434
+ if (_optionalChain([options, 'optionalAccess', _20 => _20.includePagesClientSharedGlobal])) {
422
435
  Object.assign(result, self.__remote_component_shared__);
423
436
  }
424
437
  return result;
@@ -453,4 +466,4 @@ function buildHostShared(userShared, resolveClientUrl, options) {
453
466
 
454
467
 
455
468
  exports.SHARED_MODULE_MANIFEST_PROTOCOL = SHARED_MODULE_MANIFEST_PROTOCOL; exports.isSharedModuleManifest = isSharedModuleManifest; exports.getMissingSharedModulesMessage = getMissingSharedModulesMessage; exports.createSharedModulePlan = createSharedModulePlan; exports.resolveSharedModulePlan = resolveSharedModulePlan; 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.CORE_REACT_SHARED_MODULE_IDS = CORE_REACT_SHARED_MODULE_IDS; exports.VENDOR_SHARED = VENDOR_SHARED; exports.buildCoreShared = buildCoreShared; exports.buildHostShared = buildHostShared;
456
- //# sourceMappingURL=chunk-OZCVXVKU.cjs.map
469
+ //# sourceMappingURL=chunk-ZPJ5J24T.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/host/shared/shared-broker.ts","../src/utils/index.ts","../src/runtime/constants.ts","../src/runtime/patterns.ts","../src/host/shared/next-image-deployment-id.ts","../src/runtime/turbopack/remote-scope.ts","../src/host/shared/remote-image-loader.ts","../src/host/shared/polyfill.tsx","../src/host/shared/shared-module-resolver.ts"],"names":["url"],"mappings":";;;;;;;;;;;;;AAKO,IAAM,kCACX;AAyCK,SAAS,uBACd,OAC+B;AAC/B,SACE,OAAO,UAAU,YACjB,UAAU,QACV,cAAc,SACd,MAAM,aAAa,mCACnB,kBAAkB,SAClB,MAAM,QAAQ,MAAM,YAAY;AAEpC;AAEO,SAAS,+BACd,cACoB;AACpB,MAAI,uBAAuB,YAAY;AAAG,WAAO;AACjD,QAAM,UAAU,aAAa;AAC7B,SAAO,OAAO,YAAY,WAAW,UAAU;AACjD;AAEO,SAAS,uBAAuB;AAAA,EACrC;AAAA,EACA;AAAA,EACA;AAAA,EACA,QAAQ,UAAU;AAAA,EAClB,YAAY;AACd,GAMqB;AACnB,QAAM,WAAW,uBAAuB,YAAY,IAChD,aAAa,WACb;AACJ,QAAM,eACJ,uBAAuB,YAAY,IAC/B,aAAa;AAAA;AAAA;AAAA,IAGb,OAAO,QAAQ,YAAY,EAAE,IAAI,CAAC,CAAC,IAAI,SAAS,OAAO;AAAA,MACrD;AAAA,MACA,WAAW,OAAO,SAAS;AAAA,MAC3B,UAAU;AAAA,MACV,WAAW;AAAA,IACb,EAAE;AAAA;AAER,QAAM,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,GAAG;AAAA,EACL;AACF;AAoBO,SAAS,gBACd,YACA,kBACA,SACqC;AACrC,QAAM,OAAO;AACb,QAAM,SAA8C;AAAA,IAClD,GAAG,gBAAgB,YAAY,gBAAgB;AAAA,IAC/C,GAAG,KAAK;AAAA,IACR,GAAG;AAAA,EACL;AACA,MAAI,SAAS,gCAAgC;AAC3C,WAAO,OAAO,QAAQ,KAAK,2BAA2B;AAAA,EACxD;AACA,SAAO;AACT","sourcesContent":["import type { LogLocation } from '#internal/utils/logger';\nimport { logDebug, logError } from '#internal/utils/logger';\n\nexport type SharedModuleFactory = (bundle?: string) => Promise<unknown>;\n\nexport const SHARED_MODULE_MANIFEST_PROTOCOL =\n 'remote-components.shared.v1' as const;\n\n// @legacy(remote-components<=0.4.x): remove this map shape once all supported\n// remotes emit sharedManifest. The provider path should then consume only\n// SharedModuleManifest requirements.\nexport type LegacySharedModuleMap = Record<string, string | number>;\n\nexport interface SharedModuleManifestRequirement {\n id: string | number;\n specifier: string;\n required?: boolean;\n singleton?: boolean;\n scope?: string;\n}\n\nexport interface SharedModuleManifest {\n protocol: typeof SHARED_MODULE_MANIFEST_PROTOCOL;\n requirements: SharedModuleManifestRequirement[];\n}\n\nexport type RemoteSharedModules = LegacySharedModuleMap | SharedModuleManifest;\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: 'legacy' | typeof SHARED_MODULE_MANIFEST_PROTOCOL;\n bundle: string;\n entries: SharedModuleResolution[];\n}\n\nexport function isSharedModuleManifest(\n value: unknown,\n): value is SharedModuleManifest {\n return (\n typeof value === 'object' &&\n value !== null &&\n 'protocol' in value &&\n value.protocol === SHARED_MODULE_MANIFEST_PROTOCOL &&\n 'requirements' in value &&\n Array.isArray(value.requirements)\n );\n}\n\nexport function getMissingSharedModulesMessage(\n remoteShared: RemoteSharedModules,\n): string | undefined {\n if (isSharedModuleManifest(remoteShared)) return undefined;\n const message = remoteShared.__remote_components_missing_shared__;\n return typeof message === 'string' ? message : undefined;\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: RemoteSharedModules;\n scope?: string;\n callerTag?: LogLocation;\n}): SharedModulePlan {\n const protocol = isSharedModuleManifest(remoteShared)\n ? remoteShared.protocol\n : 'legacy';\n const requirements: SharedModuleManifestRequirement[] =\n isSharedModuleManifest(remoteShared)\n ? remoteShared.requirements\n : // @legacy(remote-components<=0.4.x): normalize the historical shared\n // map until hosts and remotes on 0.4.x are no longer supported.\n Object.entries(remoteShared).map(([id, specifier]) => ({\n id,\n specifier: String(specifier),\n required: true,\n singleton: true,\n }));\n\n const entries = requirements.map((requirement) => {\n const specifier = String(requirement.specifier);\n const provider = hostShared[specifier];\n const entry: SharedModuleResolution = {\n id: String(requirement.id),\n specifier,\n required: requirement.required ?? true,\n singleton: requirement.singleton ?? true,\n scope: requirement.scope ?? 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 \"${entry.id}\" but the host does not provide it`,\n );\n }\n\n return entry;\n });\n\n logDebug(\n callerTag,\n `Share plan (${protocol}) for \"${bundle}\": ${entries\n .map((entry) => `${entry.id}=>${entry.specifier}:${entry.status}`)\n .join(', ')}`,\n );\n\n return {\n protocol,\n bundle,\n entries,\n };\n}\n\nfunction missingRequiredSharedModuleMessage(\n plan: SharedModulePlan,\n entry: SharedModuleResolution,\n): string {\n return (\n `Remote Component \"${plan.bundle}\" requires shared module \"${entry.specifier}\", but the host does not provide it. ` +\n 'Add it to the host shared modules through `withRemoteComponentsConfig({ shared: [...] })` or the `shared` prop. ' +\n 'This diagnostic runs when both host and remote support the shared-module manifest in remote-components >=0.5.0. ' +\n 'The remote may load its bundled copy during the compatibility window; this will become a load error after remote-components <=0.4.x support is removed.'\n );\n}\n\nfunction logMissingRequiredSharedModule(\n callerTag: LogLocation,\n plan: SharedModulePlan,\n entry: SharedModuleResolution,\n): void {\n logError(callerTag, missingRequiredSharedModuleMessage(plan, entry));\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') {\n if (\n plan.protocol === SHARED_MODULE_MANIFEST_PROTOCOL &&\n entry.required\n ) {\n logMissingRequiredSharedModule('SharedBroker', plan, entry);\n }\n return;\n }\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","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","export interface NextImageDeploymentId {\n src: string;\n deploymentId: string;\n}\n\nexport function isNextDeploymentAssetSrc(src: string | null): src is string {\n return (\n typeof src === 'string' && src.startsWith('/') && !src.startsWith('//')\n );\n}\n\nexport function extractDeploymentIdFromSrc(src: string) {\n const queryIndex = src.indexOf('?');\n if (queryIndex === -1) {\n return { deploymentId: undefined, src };\n }\n\n const params = new URLSearchParams(src.slice(queryIndex + 1));\n const deploymentId = params.get('dpl') || undefined;\n if (!deploymentId) {\n return { deploymentId: undefined, src };\n }\n\n params.delete('dpl');\n const remaining = params.toString();\n return {\n deploymentId,\n src: `${src.slice(0, queryIndex)}${remaining ? `?${remaining}` : ''}`,\n };\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 {\n extractDeploymentIdFromSrc,\n isNextDeploymentAssetSrc,\n type NextImageDeploymentId,\n} from '#internal/host/shared/next-image-deployment-id';\nimport { 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 ssrImageDeploymentIds?: readonly NextImageDeploymentId[],\n) {\n const ssrImageDeploymentIdMap = ssrImageDeploymentIds\n ? new Map(\n ssrImageDeploymentIds.map(({ src, deploymentId }) => [\n src,\n deploymentId,\n ]),\n )\n : undefined;\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\n if (!isNextDeploymentAssetSrc(src)) {\n const url = `${basePath}?url=${encodeURIComponent(src)}&w=${width}&q=${q}`;\n return resolveClientUrl?.(url) ?? url;\n }\n\n const extracted = extractDeploymentIdFromSrc(src);\n const deploymentId =\n extracted.deploymentId ?? ssrImageDeploymentIdMap?.get(extracted.src);\n const deploymentParam = deploymentId\n ? `&dpl=${encodeURIComponent(deploymentId)}`\n : '';\n const url = `${basePath}?url=${encodeURIComponent(extracted.src)}&w=${width}&q=${q}${deploymentParam}`;\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 { InternalResolveClientUrl } from '#internal/host/server/types';\nimport { sharedPolyfills } from '#internal/host/shared/polyfill';\nimport type { SharedModuleFactory } from '#internal/host/shared/shared-broker';\n\n/**\n * The core React packages that are always shared between host and remote.\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 shared-module manifest ID.\n * These IDs are emitted into sharedManifest for the default React entries.\n * For example, `react` maps to `/react/index.js`.\n */\nexport const CORE_REACT_SHARED_MODULE_IDS: 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 shared-module ID string literals. Derived from\n * CORE_REACT_SHARED_MODULE_IDS but excludes `react-dom/client` to match the\n * existing config behavior.\n */\nexport const VENDOR_SHARED: Record<string, string> = Object.fromEntries(\n Object.entries(CORE_REACT_SHARED_MODULE_IDS)\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\n * client-only shared global. Pass `includePagesClientSharedGlobal: true` to\n * include it at the end.\n */\nexport function buildHostShared(\n userShared?: Record<string, SharedModuleFactory>,\n resolveClientUrl?: InternalResolveClientUrl,\n options?: { includePagesClientSharedGlobal?: 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?.includePagesClientSharedGlobal) {\n Object.assign(result, self.__remote_component_shared__);\n }\n return result;\n}\n"]}