remote-components 0.4.12 → 0.4.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-3PR3SWYZ.js → chunk-3DR4Z24C.js} +24 -2
- package/dist/chunk-3DR4Z24C.js.map +1 -0
- package/dist/{chunk-BEGVH64U.js → chunk-5BBEO4SE.js} +2 -2
- package/dist/{chunk-24LEEDHP.js → chunk-CBEDRGC7.js} +3 -3
- package/dist/{chunk-CLO56ON2.js → chunk-CLB2ATH2.js} +82 -4
- package/dist/chunk-CLB2ATH2.js.map +1 -0
- package/dist/{chunk-M6ACTSVB.js → chunk-IE7FXNFJ.js} +2 -2
- package/dist/{chunk-XWRB6CEA.cjs → chunk-KMG54QXV.cjs} +3 -3
- package/dist/{chunk-SULMNRMJ.cjs → chunk-KP544TQH.cjs} +23 -23
- package/dist/{chunk-HXCW3WDT.cjs → chunk-OI37BBBU.cjs} +25 -25
- package/dist/{chunk-TGE3K3TR.cjs → chunk-OVD7BRLD.cjs} +18 -18
- package/dist/{chunk-6PZEDIAK.cjs → chunk-OZCVXVKU.cjs} +24 -2
- package/dist/chunk-OZCVXVKU.cjs.map +1 -0
- package/dist/{chunk-YSJ4FKGI.cjs → chunk-W7RJUCZQ.cjs} +97 -19
- package/dist/chunk-W7RJUCZQ.cjs.map +1 -0
- package/dist/{chunk-RZGFQTX6.js → chunk-XEO3XD67.js} +8 -8
- package/dist/config/nextjs.cjs +10 -10
- package/dist/config/nextjs.js +7 -7
- package/dist/config/tailwind.cjs +53 -0
- package/dist/config/tailwind.cjs.map +1 -0
- package/dist/config/tailwind.d.ts +21 -0
- package/dist/config/tailwind.js +53 -0
- package/dist/config/tailwind.js.map +1 -0
- package/dist/host/html.cjs +20 -20
- package/dist/host/html.js +8 -8
- package/dist/host/nextjs/app/client-only.cjs +12 -12
- package/dist/host/nextjs/app/client-only.js +7 -7
- package/dist/host/react.cjs +8 -8
- package/dist/host/react.js +7 -7
- package/dist/internal/host/nextjs/app-client.cjs +7 -3
- package/dist/internal/host/nextjs/app-client.cjs.map +1 -1
- package/dist/internal/host/nextjs/app-client.js +7 -3
- package/dist/internal/host/nextjs/app-client.js.map +1 -1
- package/dist/internal/host/shared/remote-image-loader.cjs +23 -1
- package/dist/internal/host/shared/remote-image-loader.cjs.map +1 -1
- package/dist/internal/host/shared/remote-image-loader.js +23 -1
- package/dist/internal/host/shared/remote-image-loader.js.map +1 -1
- package/dist/remote/react/utils/portal.cjs +58 -0
- package/dist/remote/react/utils/portal.cjs.map +1 -0
- package/dist/remote/react/utils/portal.d.ts +12 -0
- package/dist/remote/react/utils/portal.js +58 -0
- package/dist/remote/react/utils/portal.js.map +1 -0
- package/dist/{turbopack-5VGMYUL4.cjs → turbopack-5WAY6QIC.cjs} +11 -11
- package/dist/{turbopack-43N2UJNN.js → turbopack-Z744H3T4.js} +4 -4
- package/dist/{webpack-FSN5UBA2.cjs → webpack-3GSL5AZJ.cjs} +11 -11
- package/dist/{webpack-LXE2UWTA.js → webpack-IQKPPBGH.js} +4 -4
- package/package.json +18 -1
- package/dist/chunk-3PR3SWYZ.js.map +0 -1
- package/dist/chunk-6PZEDIAK.cjs.map +0 -1
- package/dist/chunk-CLO56ON2.js.map +0 -1
- package/dist/chunk-YSJ4FKGI.cjs.map +0 -1
- /package/dist/{chunk-BEGVH64U.js.map → chunk-5BBEO4SE.js.map} +0 -0
- /package/dist/{chunk-24LEEDHP.js.map → chunk-CBEDRGC7.js.map} +0 -0
- /package/dist/{chunk-M6ACTSVB.js.map → chunk-IE7FXNFJ.js.map} +0 -0
- /package/dist/{chunk-XWRB6CEA.cjs.map → chunk-KMG54QXV.cjs.map} +0 -0
- /package/dist/{chunk-SULMNRMJ.cjs.map → chunk-KP544TQH.cjs.map} +0 -0
- /package/dist/{chunk-HXCW3WDT.cjs.map → chunk-OI37BBBU.cjs.map} +0 -0
- /package/dist/{chunk-TGE3K3TR.cjs.map → chunk-OVD7BRLD.cjs.map} +0 -0
- /package/dist/{chunk-RZGFQTX6.js.map → chunk-XEO3XD67.js.map} +0 -0
- /package/dist/{turbopack-5VGMYUL4.cjs.map → turbopack-5WAY6QIC.cjs.map} +0 -0
- /package/dist/{turbopack-43N2UJNN.js.map → turbopack-Z744H3T4.js.map} +0 -0
- /package/dist/{webpack-FSN5UBA2.cjs.map → webpack-3GSL5AZJ.cjs.map} +0 -0
- /package/dist/{webpack-LXE2UWTA.js.map → webpack-IQKPPBGH.js.map} +0 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkOZCVXVKUcjs = require('./chunk-OZCVXVKU.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
var _chunkZ2SLBFQLcjs = require('./chunk-Z2SLBFQL.cjs');
|
|
@@ -81,14 +81,14 @@ async function buildSharedProviderPlan({
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
}
|
|
84
|
-
const sharedModulePlan =
|
|
84
|
+
const sharedModulePlan = _chunkOZCVXVKUcjs.createSharedModulePlan.call(void 0, {
|
|
85
85
|
bundle,
|
|
86
86
|
hostShared: hostSharedForPlan,
|
|
87
87
|
remoteShared,
|
|
88
88
|
scope,
|
|
89
89
|
callerTag
|
|
90
90
|
});
|
|
91
|
-
const resolved = await
|
|
91
|
+
const resolved = await _chunkOZCVXVKUcjs.resolveSharedModulePlan.call(void 0, sharedModulePlan);
|
|
92
92
|
const entriesByIdAndSpecifier = /* @__PURE__ */ new Map();
|
|
93
93
|
const addEntry = (entry) => {
|
|
94
94
|
entriesByIdAndSpecifier.set(`${entry.id}\0${entry.specifier}`, entry);
|
|
@@ -103,7 +103,7 @@ async function buildSharedProviderPlan({
|
|
|
103
103
|
}
|
|
104
104
|
for (const entry of sharedModulePlan.entries) {
|
|
105
105
|
if (entry.status !== "resolved") {
|
|
106
|
-
if (onMissing && !(sharedModulePlan.protocol ===
|
|
106
|
+
if (onMissing && !(sharedModulePlan.protocol === _chunkOZCVXVKUcjs.SHARED_MODULE_MANIFEST_PROTOCOL && entry.required)) {
|
|
107
107
|
onMissing(entry);
|
|
108
108
|
}
|
|
109
109
|
continue;
|
|
@@ -191,7 +191,7 @@ async function buildWebpackResolve(hostShared, remoteShared, bundle, reactModule
|
|
|
191
191
|
remoteShared,
|
|
192
192
|
callerTag,
|
|
193
193
|
normalizeId: normalizeWebpackSharedId,
|
|
194
|
-
additionalEntries: Object.entries(
|
|
194
|
+
additionalEntries: Object.entries(_chunkOZCVXVKUcjs.CORE_REACT_SHARED_MODULE_IDS).map(
|
|
195
195
|
([specifier, id]) => ({
|
|
196
196
|
id,
|
|
197
197
|
specifier,
|
|
@@ -227,7 +227,7 @@ function applyWebpackSharedProviderModules(bundle, entries) {
|
|
|
227
227
|
`applyWebpackSharedProviderModules called for bundle: "${bundle}"`
|
|
228
228
|
);
|
|
229
229
|
const self = globalThis;
|
|
230
|
-
const scope =
|
|
230
|
+
const scope = _chunkOZCVXVKUcjs.getScope.call(void 0, bundle);
|
|
231
231
|
const webpackBundle = _nullishCoalesce(_optionalChain([scope, 'optionalAccess', _4 => _4.webpackRequire]), () => ( _optionalChain([self, 'access', _5 => _5.__remote_webpack_require__, 'optionalAccess', _6 => _6[bundle]])));
|
|
232
232
|
if (!webpackBundle) {
|
|
233
233
|
throw new (0, _chunkBBXVML3Dcjs.RemoteComponentsError)(
|
|
@@ -287,12 +287,12 @@ function applySharedModules(bundle, resolve) {
|
|
|
287
287
|
`Shared modules to resolve: ${Object.keys(resolve)}`
|
|
288
288
|
);
|
|
289
289
|
const metadata = resolve[WEBPACK_SHARED_RESOLVE_METADATA];
|
|
290
|
-
if (_optionalChain([metadata, 'optionalAccess', _12 => _12.protocol]) ===
|
|
290
|
+
if (_optionalChain([metadata, 'optionalAccess', _12 => _12.protocol]) === _chunkOZCVXVKUcjs.SHARED_MODULE_MANIFEST_PROTOCOL) {
|
|
291
291
|
applyWebpackSharedProviderModules(bundle, metadata.entries);
|
|
292
292
|
return;
|
|
293
293
|
}
|
|
294
294
|
const self = globalThis;
|
|
295
|
-
const scope =
|
|
295
|
+
const scope = _chunkOZCVXVKUcjs.getScope.call(void 0, bundle);
|
|
296
296
|
const webpackBundle = _nullishCoalesce(_optionalChain([scope, 'optionalAccess', _13 => _13.webpackRequire]), () => ( _optionalChain([self, 'access', _14 => _14.__remote_webpack_require__, 'optionalAccess', _15 => _15[bundle]])));
|
|
297
297
|
if (webpackBundle) {
|
|
298
298
|
const modulePaths = Object.keys(
|
|
@@ -383,12 +383,12 @@ function loadChunkWithScope(scope, chunkId) {
|
|
|
383
383
|
);
|
|
384
384
|
const self = globalThis;
|
|
385
385
|
const ns = _chunkZ2SLBFQLcjs.getNamespace.call(void 0, );
|
|
386
|
-
const { bundle, path, prefix } =
|
|
386
|
+
const { bundle, path, prefix } = _chunkOZCVXVKUcjs.parseRemoteId.call(void 0, chunkId);
|
|
387
387
|
const remoteRuntime = _optionalChain([self, 'access', _25 => _25.__remote_webpack_require__, 'optionalAccess', _26 => _26[_nullishCoalesce(bundle, () => ( "default"))]]) ? _optionalChain([self, 'access', _27 => _27.__remote_webpack_require__, 'access', _28 => _28[_nullishCoalesce(bundle, () => ( "default"))], 'optionalAccess', _29 => _29.type]) || "webpack" : scope.runtime;
|
|
388
|
-
if (remoteRuntime ===
|
|
388
|
+
if (remoteRuntime === _chunkOZCVXVKUcjs.RUNTIME_WEBPACK) {
|
|
389
389
|
return Promise.resolve(void 0);
|
|
390
390
|
}
|
|
391
|
-
const rawPath = path ?
|
|
391
|
+
const rawPath = path ? _chunkOZCVXVKUcjs.collapseDoubleSlashes.call(void 0, `${prefix}${path}`) : "/";
|
|
392
392
|
const url = new URL(rawPath, scope.url).href;
|
|
393
393
|
if (url.endsWith(".css")) {
|
|
394
394
|
return;
|
|
@@ -441,9 +441,9 @@ function loadChunkWithScope(scope, chunkId) {
|
|
|
441
441
|
function createChunkDispatcher() {
|
|
442
442
|
return function __chunk_dispatcher__(chunkId, scriptBundle) {
|
|
443
443
|
_chunkBBXVML3Dcjs.logDebug.call(void 0, "ChunkDispatcher", `Dispatching chunk: "${chunkId}"`);
|
|
444
|
-
const { bundle } =
|
|
444
|
+
const { bundle } = _chunkOZCVXVKUcjs.parseRemoteId.call(void 0, chunkId);
|
|
445
445
|
const bundleName = bundle || scriptBundle || "default";
|
|
446
|
-
const scope =
|
|
446
|
+
const scope = _chunkOZCVXVKUcjs.getScope.call(void 0, bundleName);
|
|
447
447
|
_chunkBBXVML3Dcjs.logDebug.call(void 0,
|
|
448
448
|
"ChunkDispatcher",
|
|
449
449
|
`Scope resolution: bundle="${bundleName}", scope=${_nullishCoalesce(_optionalChain([scope, 'optionalAccess', _32 => _32.scopedName]), () => ( "null"))}`
|
|
@@ -550,7 +550,7 @@ async function handleTurbopackChunk(code, scope, url, renameTurbopackGlobal) {
|
|
|
550
550
|
const baseUrl = url.slice(0, url.indexOf("/_next"));
|
|
551
551
|
const chunkLoadResult = loadChunkWithScope(
|
|
552
552
|
scope,
|
|
553
|
-
|
|
553
|
+
_chunkOZCVXVKUcjs.formatRemoteId.call(void 0, scope, `${baseUrl}/_next/${id}`)
|
|
554
554
|
);
|
|
555
555
|
if (chunkLoadResult) {
|
|
556
556
|
loadChunkPromises.push(chunkLoadResult);
|
|
@@ -602,7 +602,7 @@ function requireModule(scope, moduleId, fullId) {
|
|
|
602
602
|
return handleTurbopackModule(
|
|
603
603
|
scope,
|
|
604
604
|
idStr,
|
|
605
|
-
_nullishCoalesce(fullId, () => (
|
|
605
|
+
_nullishCoalesce(fullId, () => ( _chunkOZCVXVKUcjs.formatRemoteId.call(void 0, scope, idStr)))
|
|
606
606
|
);
|
|
607
607
|
}
|
|
608
608
|
function handleTurbopackModule(scope, moduleId, id) {
|
|
@@ -675,7 +675,7 @@ function findModuleInit(modules, moduleId) {
|
|
|
675
675
|
return void 0;
|
|
676
676
|
}
|
|
677
677
|
function createTurbopackContext(scope, exports, moduleExports, modules, moduleInit, id) {
|
|
678
|
-
const scopedRequire = (moduleId) => requireModule(scope, moduleId,
|
|
678
|
+
const scopedRequire = (moduleId) => requireModule(scope, moduleId, _chunkOZCVXVKUcjs.formatRemoteId.call(void 0, scope, String(moduleId)));
|
|
679
679
|
return {
|
|
680
680
|
// HMR not implemented for Remote Components
|
|
681
681
|
k: {
|
|
@@ -847,7 +847,7 @@ function createTurbopackContext(scope, exports, moduleExports, modules, moduleIn
|
|
|
847
847
|
const nextIndex = scriptSrc.indexOf("/_next");
|
|
848
848
|
const baseUrl = nextIndex !== -1 ? scriptSrc.slice(0, nextIndex) : "";
|
|
849
849
|
const chunkUrl = `${baseUrl}/_next/${url}`;
|
|
850
|
-
return loadChunkWithScope(scope,
|
|
850
|
+
return loadChunkWithScope(scope, _chunkOZCVXVKUcjs.formatRemoteId.call(void 0, scope, chunkUrl));
|
|
851
851
|
}
|
|
852
852
|
}
|
|
853
853
|
throw new Error(
|
|
@@ -926,7 +926,7 @@ async function initializeSharedModules(scope, hostShared = {}, remoteShared = {}
|
|
|
926
926
|
const moduleExports = handleTurbopackModule(
|
|
927
927
|
scope,
|
|
928
928
|
sharedModuleId,
|
|
929
|
-
|
|
929
|
+
_chunkOZCVXVKUcjs.formatRemoteId.call(void 0, scope, String(sharedModuleInitializerId))
|
|
930
930
|
);
|
|
931
931
|
const loaderCandidate = typeof moduleExports === "function" ? moduleExports : _optionalChain([moduleExports, 'optionalAccess', _38 => _38.default]);
|
|
932
932
|
if (typeof loaderCandidate === "function") {
|
|
@@ -1075,13 +1075,13 @@ function installSharedModules(scope, hostShared, sharedModuleIds, missingMessage
|
|
|
1075
1075
|
);
|
|
1076
1076
|
}
|
|
1077
1077
|
function preferSharedManifest(sharedModuleIds, remoteShared) {
|
|
1078
|
-
if (!
|
|
1078
|
+
if (!_chunkOZCVXVKUcjs.isSharedModuleManifest.call(void 0, remoteShared))
|
|
1079
1079
|
return sharedModuleIds;
|
|
1080
1080
|
const extractedIdBySpecifier = new Map(
|
|
1081
1081
|
Object.entries(sharedModuleIds).map(([id, specifier]) => [specifier, id])
|
|
1082
1082
|
);
|
|
1083
1083
|
return {
|
|
1084
|
-
protocol:
|
|
1084
|
+
protocol: _chunkOZCVXVKUcjs.SHARED_MODULE_MANIFEST_PROTOCOL,
|
|
1085
1085
|
requirements: remoteShared.requirements.map((requirement) => {
|
|
1086
1086
|
return {
|
|
1087
1087
|
...requirement,
|
|
@@ -1091,7 +1091,7 @@ function preferSharedManifest(sharedModuleIds, remoteShared) {
|
|
|
1091
1091
|
};
|
|
1092
1092
|
}
|
|
1093
1093
|
function normalizeRemoteSharedForTurbopackFallback(remoteShared) {
|
|
1094
|
-
if (
|
|
1094
|
+
if (_chunkOZCVXVKUcjs.isSharedModuleManifest.call(void 0, remoteShared)) {
|
|
1095
1095
|
return {
|
|
1096
1096
|
...remoteShared,
|
|
1097
1097
|
requirements: remoteShared.requirements.map((requirement) => ({
|
|
@@ -1138,7 +1138,7 @@ function nextClientPagesLoader(bundle, route, styleContainer = document.head) {
|
|
|
1138
1138
|
ns.pageComponentCache ??= {};
|
|
1139
1139
|
const cacheKey = `${bundle}:${route}`;
|
|
1140
1140
|
const remoteRequire = _optionalChain([self, 'access', _45 => _45.__remote_webpack_require__, 'optionalAccess', _46 => _46[bundle]]);
|
|
1141
|
-
const turbopackScope = _optionalChain([remoteRequire, 'optionalAccess', _47 => _47.type]) === "turbopack" ?
|
|
1141
|
+
const turbopackScope = _optionalChain([remoteRequire, 'optionalAccess', _47 => _47.type]) === "turbopack" ? _chunkOZCVXVKUcjs.getScope.call(void 0, bundle) : void 0;
|
|
1142
1142
|
const applyBundleCss = () => {
|
|
1143
1143
|
const elements = _nullishCoalesce(ns.cssCache[bundle], () => ( []));
|
|
1144
1144
|
if (styleContainer) {
|
|
@@ -1356,4 +1356,4 @@ function findPreviousModuleId(entries, factoryIndex) {
|
|
|
1356
1356
|
|
|
1357
1357
|
|
|
1358
1358
|
exports.buildWebpackResolve = buildWebpackResolve; exports.applySharedModules = applySharedModules; exports.loadChunkWithScope = loadChunkWithScope; exports.createChunkDispatcher = createChunkDispatcher; exports.initializeSharedModules = initializeSharedModules; exports.requireModule = requireModule; exports.nextClientPagesLoader = nextClientPagesLoader;
|
|
1359
|
-
//# sourceMappingURL=chunk-
|
|
1359
|
+
//# sourceMappingURL=chunk-KP544TQH.cjs.map
|
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } async function _asyncNullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return await rhsFn(); } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkTCFLEBQMcjs = require('./chunk-TCFLEBQM.cjs');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkKMG54QXVcjs = require('./chunk-KMG54QXV.cjs');
|
|
7
7
|
|
|
8
8
|
|
|
9
|
+
var _chunkOVD7BRLDcjs = require('./chunk-OVD7BRLD.cjs');
|
|
9
10
|
|
|
10
11
|
|
|
11
12
|
|
|
12
|
-
var _chunkSULMNRMJcjs = require('./chunk-SULMNRMJ.cjs');
|
|
13
13
|
|
|
14
14
|
|
|
15
|
-
var
|
|
15
|
+
var _chunkKP544TQHcjs = require('./chunk-KP544TQH.cjs');
|
|
16
16
|
|
|
17
17
|
|
|
18
|
+
var _chunk3AX5WLZDcjs = require('./chunk-3AX5WLZD.cjs');
|
|
18
19
|
|
|
19
20
|
|
|
20
21
|
|
|
@@ -24,17 +25,16 @@ var _chunk3AX5WLZDcjs = require('./chunk-3AX5WLZD.cjs');
|
|
|
24
25
|
|
|
25
26
|
|
|
26
27
|
|
|
27
|
-
var _chunk6PZEDIAKcjs = require('./chunk-6PZEDIAK.cjs');
|
|
28
28
|
|
|
29
29
|
|
|
30
|
+
var _chunkOZCVXVKUcjs = require('./chunk-OZCVXVKU.cjs');
|
|
30
31
|
|
|
31
32
|
|
|
32
33
|
|
|
33
34
|
|
|
34
|
-
var _chunkBBXVML3Dcjs = require('./chunk-BBXVML3D.cjs');
|
|
35
35
|
|
|
36
36
|
|
|
37
|
-
var
|
|
37
|
+
var _chunkBBXVML3Dcjs = require('./chunk-BBXVML3D.cjs');
|
|
38
38
|
|
|
39
39
|
// src/host/server/fetch-with-hooks.ts
|
|
40
40
|
async function fetchWithWarning(url, init) {
|
|
@@ -288,12 +288,12 @@ function toComponentType(value) {
|
|
|
288
288
|
return value && isComponentType(value) ? value : "unknown";
|
|
289
289
|
}
|
|
290
290
|
function buildMetadata(attrs, url) {
|
|
291
|
-
const id = attrs.id ||
|
|
292
|
-
const bundle = attrs.bundle || process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION ||
|
|
291
|
+
const id = attrs.id || _chunkOZCVXVKUcjs.DEFAULT_COMPONENT_NAME;
|
|
292
|
+
const bundle = attrs.bundle || process.env.NEXT_PUBLIC_MFE_CURRENT_APPLICATION || _chunkOZCVXVKUcjs.DEFAULT_BUNDLE_NAME;
|
|
293
293
|
return {
|
|
294
294
|
name: attrs.name || id.replace(/_ssr$/, ""),
|
|
295
295
|
bundle,
|
|
296
|
-
route: attrs.route || url.pathname ||
|
|
296
|
+
route: attrs.route || url.pathname || _chunkOZCVXVKUcjs.DEFAULT_ROUTE,
|
|
297
297
|
runtime: toRuntime(attrs.runtime),
|
|
298
298
|
id,
|
|
299
299
|
type: toComponentType(attrs.type)
|
|
@@ -338,7 +338,7 @@ function extractRemoteShared(doc, name, nextData) {
|
|
|
338
338
|
function validateComponentFound(component, rsc, nextData, isRemoteComponent, url, name) {
|
|
339
339
|
if (!component || !(rsc || nextData || isRemoteComponent)) {
|
|
340
340
|
throw new (0, _chunkBBXVML3Dcjs.RemoteComponentsError)(
|
|
341
|
-
`Remote Component not found on ${url}.${name !==
|
|
341
|
+
`Remote Component not found on ${url}.${name !== _chunkOZCVXVKUcjs.DEFAULT_COMPONENT_NAME ? ` The name for the <RemoteComponent> is "${name}". Check <RemoteComponent> usage.` : ""} Did you forget to wrap the content in <RemoteComponent>?`
|
|
342
342
|
);
|
|
343
343
|
}
|
|
344
344
|
}
|
|
@@ -369,7 +369,7 @@ function parseRemoteComponentDocument(doc, name, url) {
|
|
|
369
369
|
name: resolvedName,
|
|
370
370
|
bundle: _optionalChain([component, 'optionalAccess', _40 => _40.getAttribute, 'call', _41 => _41(DATA_BUNDLE)]) || _optionalChain([nextData, 'optionalAccess', _42 => _42.props, 'access', _43 => _43.__REMOTE_COMPONENT__, 'optionalAccess', _44 => _44.bundle]),
|
|
371
371
|
route: _nullishCoalesce(_optionalChain([component, 'optionalAccess', _45 => _45.getAttribute, 'call', _46 => _46(DATA_ROUTE)]), () => ( _optionalChain([nextData, 'optionalAccess', _47 => _47.page]))),
|
|
372
|
-
runtime: _nullishCoalesce(_nullishCoalesce(_optionalChain([component, 'optionalAccess', _48 => _48.getAttribute, 'call', _49 => _49(DATA_RUNTIME)]), () => ( _optionalChain([nextData, 'optionalAccess', _50 => _50.props, 'access', _51 => _51.__REMOTE_COMPONENT__, 'optionalAccess', _52 => _52.runtime]))), () => (
|
|
372
|
+
runtime: _nullishCoalesce(_nullishCoalesce(_optionalChain([component, 'optionalAccess', _48 => _48.getAttribute, 'call', _49 => _49(DATA_RUNTIME)]), () => ( _optionalChain([nextData, 'optionalAccess', _50 => _50.props, 'access', _51 => _51.__REMOTE_COMPONENT__, 'optionalAccess', _52 => _52.runtime]))), () => ( _chunkOZCVXVKUcjs.RUNTIME_SCRIPT)),
|
|
373
373
|
id: _optionalChain([component, 'optionalAccess', _53 => _53.getAttribute, 'call', _54 => _54("id")]),
|
|
374
374
|
type: _optionalChain([component, 'optionalAccess', _55 => _55.getAttribute, 'call', _56 => _56(DATA_TYPE)])
|
|
375
375
|
},
|
|
@@ -439,7 +439,7 @@ async function loadRemoteComponent({
|
|
|
439
439
|
self.__DISABLE_WEBPACK_EXEC__ = {};
|
|
440
440
|
}
|
|
441
441
|
self.__DISABLE_WEBPACK_EXEC__[bundle] = true;
|
|
442
|
-
await
|
|
442
|
+
await _chunkKMG54QXVcjs.loadScripts.call(void 0, scripts, resolveClientUrl);
|
|
443
443
|
}
|
|
444
444
|
const hostShared = await shared;
|
|
445
445
|
_chunkBBXVML3Dcjs.logDebug.call(void 0,
|
|
@@ -454,7 +454,7 @@ async function loadRemoteComponent({
|
|
|
454
454
|
"ComponentLoader",
|
|
455
455
|
`Remote shared modules requested: ${JSON.stringify(remoteShared)}`
|
|
456
456
|
);
|
|
457
|
-
const scope = await
|
|
457
|
+
const scope = await _chunkOVD7BRLDcjs.setupRemoteScope.call(void 0,
|
|
458
458
|
runtime,
|
|
459
459
|
scripts,
|
|
460
460
|
url,
|
|
@@ -462,14 +462,14 @@ async function loadRemoteComponent({
|
|
|
462
462
|
resolveClientUrl
|
|
463
463
|
);
|
|
464
464
|
if (runtime === "turbopack") {
|
|
465
|
-
await
|
|
465
|
+
await _chunkKP544TQHcjs.initializeSharedModules.call(void 0,
|
|
466
466
|
scope,
|
|
467
|
-
|
|
467
|
+
_chunkOZCVXVKUcjs.buildCoreShared.call(void 0, hostShared),
|
|
468
468
|
remoteShared
|
|
469
469
|
);
|
|
470
470
|
}
|
|
471
471
|
if (bundle && runtime === "webpack") {
|
|
472
|
-
const resolve = await
|
|
472
|
+
const resolve = await _chunkKP544TQHcjs.buildWebpackResolve.call(void 0,
|
|
473
473
|
hostShared,
|
|
474
474
|
remoteShared,
|
|
475
475
|
bundle,
|
|
@@ -482,7 +482,7 @@ async function loadRemoteComponent({
|
|
|
482
482
|
},
|
|
483
483
|
"ComponentLoader"
|
|
484
484
|
);
|
|
485
|
-
|
|
485
|
+
_chunkKP544TQHcjs.applySharedModules.call(void 0, bundle, resolve);
|
|
486
486
|
} else if (bundle && runtime === "turbopack") {
|
|
487
487
|
} else {
|
|
488
488
|
_chunkBBXVML3Dcjs.logWarn.call(void 0,
|
|
@@ -524,7 +524,7 @@ async function loadRSCComponent(rscName, data) {
|
|
|
524
524
|
return { component };
|
|
525
525
|
}
|
|
526
526
|
function loadNextPagesComponent(bundle, route, nextData, name, container) {
|
|
527
|
-
const { Component, App } =
|
|
527
|
+
const { Component, App } = _chunkKP544TQHcjs.nextClientPagesLoader.call(void 0, bundle, route, container);
|
|
528
528
|
if (!Component) {
|
|
529
529
|
throw new (0, _chunkBBXVML3Dcjs.RemoteComponentsError)(
|
|
530
530
|
`Remote Component "${name}" is trying to load the component for route "${route}" but it is not available.`
|
|
@@ -540,7 +540,7 @@ function preparePipeline(input) {
|
|
|
540
540
|
const doc = parser.parseFromString(input.html, "text/html");
|
|
541
541
|
const parsed = parseRemoteComponentDocument(doc, input.name, input.url);
|
|
542
542
|
const remoteShared = _nullishCoalesce(input.remoteShared, () => ( parsed.remoteShared));
|
|
543
|
-
const missingSharedModulesMessage =
|
|
543
|
+
const missingSharedModulesMessage = _chunkOZCVXVKUcjs.getMissingSharedModulesMessage.call(void 0, remoteShared);
|
|
544
544
|
if (missingSharedModulesMessage) {
|
|
545
545
|
throw new (0, _chunkBBXVML3Dcjs.RemoteComponentsError)(missingSharedModulesMessage);
|
|
546
546
|
}
|
|
@@ -580,12 +580,12 @@ async function loadPrepared(input) {
|
|
|
580
580
|
function buildScriptDescriptors(scripts, url) {
|
|
581
581
|
return scripts.map((script) => {
|
|
582
582
|
const scriptSrc = script.getAttribute("data-src") || script.getAttribute("src") || script.src;
|
|
583
|
-
const { prefix, id: path } = _nullishCoalesce(_optionalChain([
|
|
583
|
+
const { prefix, id: path } = _nullishCoalesce(_optionalChain([_chunkOZCVXVKUcjs.REMOTE_COMPONENT_REGEX, 'access', _57 => _57.exec, 'call', _58 => _58(scriptSrc), 'optionalAccess', _59 => _59.groups]), () => ( {
|
|
584
584
|
prefix: void 0,
|
|
585
585
|
id: scriptSrc
|
|
586
586
|
}));
|
|
587
587
|
return {
|
|
588
|
-
src: new URL(
|
|
588
|
+
src: new URL(_chunkOZCVXVKUcjs.collapseDoubleSlashes.call(void 0, `${_nullishCoalesce(prefix, () => ( ""))}${path}`), url).href
|
|
589
589
|
};
|
|
590
590
|
});
|
|
591
591
|
}
|
|
@@ -618,7 +618,7 @@ async function loadDynamicPath(input) {
|
|
|
618
618
|
resolveClientUrl,
|
|
619
619
|
container
|
|
620
620
|
} = input;
|
|
621
|
-
const rscName = _nullishCoalesce(input.rscName, () => ( (parsed.rsc ? `__remote_component_rsc_${
|
|
621
|
+
const rscName = _nullishCoalesce(input.rscName, () => ( (parsed.rsc ? `__remote_component_rsc_${_chunkOZCVXVKUcjs.escapeString.call(void 0, url.href)}_${_chunkOZCVXVKUcjs.escapeString.call(void 0, parsed.name)}` : void 0)));
|
|
622
622
|
const rscData = parsed.rsc ? (parsed.rsc.textContent || "").split("\n").filter(Boolean) : [];
|
|
623
623
|
const result = await loadRemoteComponent({
|
|
624
624
|
url,
|
|
@@ -630,7 +630,7 @@ async function loadDynamicPath(input) {
|
|
|
630
630
|
data: rscData,
|
|
631
631
|
nextData: parsed.nextData,
|
|
632
632
|
scripts: scriptDescriptors,
|
|
633
|
-
shared:
|
|
633
|
+
shared: _chunkOZCVXVKUcjs.buildHostShared.call(void 0, shared, resolveClientUrl),
|
|
634
634
|
remoteShared: parsed.remoteShared,
|
|
635
635
|
container,
|
|
636
636
|
resolveClientUrl
|
|
@@ -709,4 +709,4 @@ function bindResolveClientUrl(prop, remoteSrc) {
|
|
|
709
709
|
|
|
710
710
|
|
|
711
711
|
exports.fetchWithHooks = fetchWithHooks; exports.getClientOrServerUrl = getClientOrServerUrl; exports.makeReactEmitter = makeReactEmitter; exports.makeEventEmitter = makeEventEmitter; exports.createRSCStream = createRSCStream; exports.preparePipeline = preparePipeline; exports.loadPrepared = loadPrepared; exports.createHostState = createHostState; exports.resolveNameFromSrc = resolveNameFromSrc; exports.bindResolveClientUrl = bindResolveClientUrl;
|
|
712
|
-
//# sourceMappingURL=chunk-
|
|
712
|
+
//# sourceMappingURL=chunk-OI37BBBU.cjs.map
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunkKP544TQHcjs = require('./chunk-KP544TQH.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ var _chunkSULMNRMJcjs = require('./chunk-SULMNRMJ.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkOZCVXVKUcjs = require('./chunk-OZCVXVKU.cjs');
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
var _chunkZ2SLBFQLcjs = require('./chunk-Z2SLBFQL.cjs');
|
|
@@ -25,25 +25,25 @@ async function setupRemoteScope(runtime, scripts = [], url = new URL(location.hr
|
|
|
25
25
|
const self = globalThis;
|
|
26
26
|
const ns = _chunkZ2SLBFQLcjs.getNamespace.call(void 0, );
|
|
27
27
|
const bundleName = _nullishCoalesce(bundle, () => ( "default"));
|
|
28
|
-
const existingScope =
|
|
28
|
+
const existingScope = _chunkOZCVXVKUcjs.getScope.call(void 0, bundleName);
|
|
29
29
|
if (existingScope && existingScope.url.origin === url.origin) {
|
|
30
30
|
_chunkBBXVML3Dcjs.logDebug.call(void 0,
|
|
31
31
|
"WebpackRuntime",
|
|
32
32
|
`Reusing scope "${existingScope.scopedName}" (turbopackModules=${existingScope.turbopackModules.length})`
|
|
33
33
|
);
|
|
34
34
|
existingScope.resolveClientUrl = resolveClientUrl;
|
|
35
|
-
if (runtime ===
|
|
35
|
+
if (runtime === _chunkOZCVXVKUcjs.RUNTIME_TURBOPACK) {
|
|
36
36
|
await Promise.allSettled(
|
|
37
37
|
scripts.map(
|
|
38
|
-
(script) => script.src ?
|
|
38
|
+
(script) => script.src ? _chunkKP544TQHcjs.loadChunkWithScope.call(void 0, existingScope, script.src) : Promise.resolve(void 0)
|
|
39
39
|
)
|
|
40
40
|
);
|
|
41
41
|
}
|
|
42
42
|
return existingScope;
|
|
43
43
|
}
|
|
44
|
-
const scope =
|
|
45
|
-
|
|
46
|
-
if (runtime ===
|
|
44
|
+
const scope = _chunkOZCVXVKUcjs.createScope.call(void 0, bundleName, url, runtime, resolveClientUrl);
|
|
45
|
+
_chunkOZCVXVKUcjs.registerScope.call(void 0, scope);
|
|
46
|
+
if (runtime === _chunkOZCVXVKUcjs.RUNTIME_WEBPACK && _optionalChain([self, 'access', _ => _.__remote_webpack_require__, 'optionalAccess', _2 => _2[bundleName]])) {
|
|
47
47
|
scope.webpackRequire = self.__remote_webpack_require__[bundleName];
|
|
48
48
|
}
|
|
49
49
|
ns.bundleUrls[bundleName] = url;
|
|
@@ -57,12 +57,12 @@ async function setupRemoteScope(runtime, scripts = [], url = new URL(location.hr
|
|
|
57
57
|
self.__original_webpack_chunk_load__ = self.__webpack_chunk_load__;
|
|
58
58
|
self.__original_webpack_require__ = self.__webpack_require__;
|
|
59
59
|
}
|
|
60
|
-
self.__webpack_chunk_load__ =
|
|
60
|
+
self.__webpack_chunk_load__ = _chunkKP544TQHcjs.createChunkDispatcher.call(void 0, );
|
|
61
61
|
self.__webpack_require__ = createModuleDispatcher(runtime);
|
|
62
62
|
ns.dispatcherRuntime = runtime;
|
|
63
63
|
self.__webpack_require_type__ = runtime;
|
|
64
64
|
}
|
|
65
|
-
if (runtime ===
|
|
65
|
+
if (runtime === _chunkOZCVXVKUcjs.RUNTIME_TURBOPACK && typeof self.__webpack_require__ === "function") {
|
|
66
66
|
self.__remote_webpack_require__ ??= {};
|
|
67
67
|
self.__remote_webpack_require__[bundleName] = self.__webpack_require__;
|
|
68
68
|
self.__remote_webpack_require__[bundleName].type = "turbopack";
|
|
@@ -70,11 +70,11 @@ async function setupRemoteScope(runtime, scripts = [], url = new URL(location.hr
|
|
|
70
70
|
if (_optionalChain([self, 'access', _3 => _3.__remote_webpack_require__, 'optionalAccess', _4 => _4[bundleName]]) && scope.scopedName !== bundleName) {
|
|
71
71
|
self.__remote_webpack_require__[scope.scopedName] = self.__remote_webpack_require__[bundleName];
|
|
72
72
|
}
|
|
73
|
-
if (runtime ===
|
|
73
|
+
if (runtime === _chunkOZCVXVKUcjs.RUNTIME_TURBOPACK) {
|
|
74
74
|
const results = await Promise.allSettled(
|
|
75
75
|
scripts.map((script) => {
|
|
76
76
|
if (script.src) {
|
|
77
|
-
return
|
|
77
|
+
return _chunkKP544TQHcjs.loadChunkWithScope.call(void 0, scope, script.src);
|
|
78
78
|
}
|
|
79
79
|
return Promise.resolve(void 0);
|
|
80
80
|
})
|
|
@@ -93,7 +93,7 @@ async function setupRemoteScope(runtime, scripts = [], url = new URL(location.hr
|
|
|
93
93
|
function createModuleDispatcher(runtime) {
|
|
94
94
|
return (id) => {
|
|
95
95
|
const self = globalThis;
|
|
96
|
-
const { bundle, id: moduleId } = _nullishCoalesce(_optionalChain([id, 'access', _5 => _5.match, 'call', _6 => _6(
|
|
96
|
+
const { bundle, id: moduleId } = _nullishCoalesce(_optionalChain([id, 'access', _5 => _5.match, 'call', _6 => _6(_chunkOZCVXVKUcjs.REMOTE_COMPONENT_REGEX), 'optionalAccess', _7 => _7.groups]), () => ( {
|
|
97
97
|
bundle: "default",
|
|
98
98
|
id
|
|
99
99
|
}));
|
|
@@ -104,15 +104,15 @@ function createModuleDispatcher(runtime) {
|
|
|
104
104
|
`Resolving "${id}" (bundle: "${bundleName}", runtime: "${remoteRuntime}")`
|
|
105
105
|
);
|
|
106
106
|
try {
|
|
107
|
-
if (remoteRuntime ===
|
|
108
|
-
const scope2 =
|
|
107
|
+
if (remoteRuntime === _chunkOZCVXVKUcjs.RUNTIME_WEBPACK && bundle && moduleId) {
|
|
108
|
+
const scope2 = _chunkOZCVXVKUcjs.getScope.call(void 0, bundle);
|
|
109
109
|
if (_optionalChain([scope2, 'optionalAccess', _13 => _13.webpackRequire]))
|
|
110
110
|
return scope2.webpackRequire(moduleId);
|
|
111
111
|
return _optionalChain([self, 'access', _14 => _14.__remote_webpack_require__, 'optionalAccess', _15 => _15[bundle], 'optionalCall', _16 => _16(moduleId)]);
|
|
112
112
|
}
|
|
113
|
-
const scope =
|
|
113
|
+
const scope = _chunkOZCVXVKUcjs.getScope.call(void 0, bundleName);
|
|
114
114
|
if (scope) {
|
|
115
|
-
return
|
|
115
|
+
return _chunkKP544TQHcjs.requireModule.call(void 0, scope, _nullishCoalesce(moduleId, () => ( id)), id);
|
|
116
116
|
}
|
|
117
117
|
throw new Error(
|
|
118
118
|
`Module "${id}" not found \u2014 no scope for bundle "${bundleName}".`
|
|
@@ -149,4 +149,4 @@ function createModuleDispatcher(runtime) {
|
|
|
149
149
|
|
|
150
150
|
|
|
151
151
|
exports.setupRemoteScope = setupRemoteScope;
|
|
152
|
-
//# sourceMappingURL=chunk-
|
|
152
|
+
//# sourceMappingURL=chunk-OVD7BRLD.cjs.map
|
|
@@ -183,6 +183,26 @@ function parseRemoteId(id) {
|
|
|
183
183
|
}
|
|
184
184
|
|
|
185
185
|
// 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
|
+
}
|
|
186
206
|
function createRemoteImageLoader(bundle, resolveClientUrl) {
|
|
187
207
|
const loader = Object.assign(
|
|
188
208
|
({
|
|
@@ -195,7 +215,9 @@ function createRemoteImageLoader(bundle, resolveClientUrl) {
|
|
|
195
215
|
const remoteOrigin = _nullishCoalesce(_optionalChain([getScope, 'call', _6 => _6(bundle), 'optionalAccess', _7 => _7.url, 'access', _8 => _8.origin]), () => ( ""));
|
|
196
216
|
const isCrossOrigin = remoteOrigin && remoteOrigin !== location.origin;
|
|
197
217
|
const basePath = isCrossOrigin ? `${remoteOrigin}${_nullishCoalesce(config.path, () => ( "/_next/image"))}` : _nullishCoalesce(config.path, () => ( `${remoteOrigin}/_next/image`));
|
|
198
|
-
const
|
|
218
|
+
const extracted = extractDeploymentIdFromSrc(src);
|
|
219
|
+
const deploymentParam = extracted.deploymentId ? `&dpl=${encodeURIComponent(extracted.deploymentId)}` : "";
|
|
220
|
+
const url = `${basePath}?url=${encodeURIComponent(extracted.src)}&w=${width}&q=${q}${deploymentParam}`;
|
|
199
221
|
return _nullishCoalesce(_optionalChain([resolveClientUrl, 'optionalCall', _9 => _9(url)]), () => ( url));
|
|
200
222
|
},
|
|
201
223
|
// Signals to getImgProps that this is a default loader (not a user-defined
|
|
@@ -431,4 +453,4 @@ function buildHostShared(userShared, resolveClientUrl, options) {
|
|
|
431
453
|
|
|
432
454
|
|
|
433
455
|
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;
|
|
434
|
-
//# sourceMappingURL=chunk-
|
|
456
|
+
//# sourceMappingURL=chunk-OZCVXVKU.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/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":[],"mappings":";;;;;;;;;;;;;AAKO,IAAM,kCACX;AAyCK,SAAS,uBACd,OAC+B;AAC/B,SACE,OAAO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d,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","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","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\nfunction extractDeploymentIdFromSrc(src: string) {\n if (!src.startsWith('/') || src.startsWith('//')) {\n return { deploymentId: undefined, src };\n }\n\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\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 extracted = extractDeploymentIdFromSrc(src);\n const deploymentParam = extracted.deploymentId\n ? `&dpl=${encodeURIComponent(extracted.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"]}
|