remote-components 0.4.8 → 0.4.9
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-VJO4PTWG.js → chunk-4XWEMPKO.js} +6 -6
- package/dist/chunk-4XWEMPKO.js.map +1 -0
- package/dist/{chunk-YJJFRORQ.cjs → chunk-6NAV4SCF.cjs} +315 -74
- package/dist/chunk-6NAV4SCF.cjs.map +1 -0
- package/dist/{chunk-JZRA6DPE.js → chunk-6NUHDFSH.js} +6 -53
- package/dist/chunk-6NUHDFSH.js.map +1 -0
- package/dist/{chunk-EW5O3Q24.cjs → chunk-EZG36EB4.cjs} +23 -23
- package/dist/{chunk-EW5O3Q24.cjs.map → chunk-EZG36EB4.cjs.map} +1 -1
- package/dist/{chunk-KAFPXSRI.cjs → chunk-J42V6HSP.cjs} +18 -18
- package/dist/{chunk-STMO56U2.js → chunk-JYGC7T6L.js} +264 -23
- package/dist/chunk-JYGC7T6L.js.map +1 -0
- package/dist/{chunk-I7VKDF3E.cjs → chunk-SELGX4Y2.cjs} +4 -51
- package/dist/chunk-SELGX4Y2.cjs.map +1 -0
- package/dist/{chunk-KCUEMMYL.js → chunk-T6E2WPAB.js} +3 -3
- package/dist/{chunk-4MLJE6UP.cjs → chunk-VB64GQX7.cjs} +3 -3
- package/dist/{chunk-FF4SXSSG.js → chunk-X6SKTJ5N.js} +3 -3
- package/dist/{chunk-O4ED3BUP.cjs → chunk-XPMI4K3U.cjs} +19 -19
- package/dist/{chunk-WGSS7TJP.js → chunk-ZJW3GQTP.js} +2 -2
- package/dist/config/nextjs.cjs +5 -5
- package/dist/config/nextjs.cjs.map +1 -1
- package/dist/config/nextjs.js +1 -1
- package/dist/config/nextjs.js.map +1 -1
- package/dist/host/html.cjs +19 -19
- package/dist/host/html.js +7 -7
- package/dist/host/nextjs/app/client-only.cjs +11 -11
- package/dist/host/nextjs/app/client-only.js +6 -6
- package/dist/host/react.cjs +7 -7
- package/dist/host/react.js +6 -6
- package/dist/internal/config/webpack/apply-shared-modules.cjs +8 -0
- package/dist/internal/config/webpack/apply-shared-modules.cjs.map +1 -1
- package/dist/internal/config/webpack/apply-shared-modules.d.ts +6 -1
- package/dist/internal/config/webpack/apply-shared-modules.js +10 -0
- package/dist/internal/config/webpack/apply-shared-modules.js.map +1 -1
- package/dist/internal/config/webpack/provider-adapter.cjs +85 -0
- package/dist/internal/config/webpack/provider-adapter.cjs.map +1 -0
- package/dist/internal/config/webpack/provider-adapter.d.ts +7 -0
- package/dist/internal/config/webpack/provider-adapter.js +64 -0
- package/dist/internal/config/webpack/provider-adapter.js.map +1 -0
- package/dist/internal/config/webpack/shared-module-resolver.cjs +73 -0
- package/dist/internal/config/webpack/shared-module-resolver.cjs.map +1 -0
- package/dist/internal/config/webpack/shared-module-resolver.d.ts +35 -0
- package/dist/internal/config/webpack/shared-module-resolver.js +50 -0
- package/dist/internal/config/webpack/shared-module-resolver.js.map +1 -0
- package/dist/internal/host/shared/provider.cjs +188 -0
- package/dist/internal/host/shared/provider.cjs.map +1 -0
- package/dist/internal/host/shared/provider.d.ts +71 -0
- package/dist/internal/host/shared/provider.js +161 -0
- package/dist/internal/host/shared/provider.js.map +1 -0
- package/dist/internal/host/shared/shared-broker.cjs +0 -30
- package/dist/internal/host/shared/shared-broker.cjs.map +1 -1
- package/dist/internal/host/shared/shared-broker.d.ts +1 -7
- package/dist/internal/host/shared/shared-broker.js +0 -29
- package/dist/internal/host/shared/shared-broker.js.map +1 -1
- package/dist/internal/host/shared/shared-module-resolver.cjs +6 -28
- package/dist/internal/host/shared/shared-module-resolver.cjs.map +1 -1
- package/dist/internal/host/shared/shared-module-resolver.d.ts +9 -31
- package/dist/internal/host/shared/shared-module-resolver.js +4 -28
- package/dist/internal/host/shared/shared-module-resolver.js.map +1 -1
- package/dist/internal/runtime/loaders/component-loader.cjs +3 -2
- package/dist/internal/runtime/loaders/component-loader.cjs.map +1 -1
- package/dist/internal/runtime/loaders/component-loader.js +2 -4
- package/dist/internal/runtime/loaders/component-loader.js.map +1 -1
- package/dist/internal/runtime/turbopack/shared-modules.cjs +13 -19
- package/dist/internal/runtime/turbopack/shared-modules.cjs.map +1 -1
- package/dist/internal/runtime/turbopack/shared-modules.js +17 -21
- package/dist/internal/runtime/turbopack/shared-modules.js.map +1 -1
- package/dist/{turbopack-RXVSOWF7.cjs → turbopack-6BXAJGS5.cjs} +11 -11
- package/dist/{turbopack-XDIGB4GI.js → turbopack-WAERWSWW.js} +4 -4
- package/dist/{webpack-HKD7RZRE.cjs → webpack-VTSF2B2G.cjs} +11 -11
- package/dist/webpack-VTSF2B2G.cjs.map +1 -0
- package/dist/{webpack-3QXPAZN4.js → webpack-ZYOBNVFE.js} +6 -6
- package/dist/webpack-ZYOBNVFE.js.map +1 -0
- package/package.json +1 -1
- package/dist/chunk-I7VKDF3E.cjs.map +0 -1
- package/dist/chunk-JZRA6DPE.js.map +0 -1
- package/dist/chunk-STMO56U2.js.map +0 -1
- package/dist/chunk-VJO4PTWG.js.map +0 -1
- package/dist/chunk-YJJFRORQ.cjs.map +0 -1
- package/dist/webpack-3QXPAZN4.js.map +0 -1
- package/dist/webpack-HKD7RZRE.cjs.map +0 -1
- /package/dist/{chunk-KAFPXSRI.cjs.map → chunk-J42V6HSP.cjs.map} +0 -0
- /package/dist/{chunk-KCUEMMYL.js.map → chunk-T6E2WPAB.js.map} +0 -0
- /package/dist/{chunk-4MLJE6UP.cjs.map → chunk-VB64GQX7.cjs.map} +0 -0
- /package/dist/{chunk-FF4SXSSG.js.map → chunk-X6SKTJ5N.js.map} +0 -0
- /package/dist/{chunk-O4ED3BUP.cjs.map → chunk-XPMI4K3U.cjs.map} +0 -0
- /package/dist/{chunk-WGSS7TJP.js.map → chunk-ZJW3GQTP.js.map} +0 -0
- /package/dist/{turbopack-RXVSOWF7.cjs.map → turbopack-6BXAJGS5.cjs.map} +0 -0
- /package/dist/{turbopack-XDIGB4GI.js.map → turbopack-WAERWSWW.js.map} +0 -0
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
|
|
4
4
|
|
|
5
|
-
var
|
|
5
|
+
var _chunk6NAV4SCFcjs = require('./chunk-6NAV4SCF.cjs');
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
@@ -10,7 +10,7 @@ var _chunkYJJFRORQcjs = require('./chunk-YJJFRORQ.cjs');
|
|
|
10
10
|
|
|
11
11
|
|
|
12
12
|
|
|
13
|
-
var
|
|
13
|
+
var _chunkSELGX4Y2cjs = require('./chunk-SELGX4Y2.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 = _chunkSELGX4Y2cjs.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 === _chunkSELGX4Y2cjs.RUNTIME_TURBOPACK) {
|
|
36
36
|
await Promise.allSettled(
|
|
37
37
|
scripts.map(
|
|
38
|
-
(script) => script.src ?
|
|
38
|
+
(script) => script.src ? _chunk6NAV4SCFcjs.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 = _chunkSELGX4Y2cjs.createScope.call(void 0, bundleName, url, runtime, resolveClientUrl);
|
|
45
|
+
_chunkSELGX4Y2cjs.registerScope.call(void 0, scope);
|
|
46
|
+
if (runtime === _chunkSELGX4Y2cjs.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__ = _chunk6NAV4SCFcjs.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 === _chunkSELGX4Y2cjs.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 === _chunkSELGX4Y2cjs.RUNTIME_TURBOPACK) {
|
|
74
74
|
const results = await Promise.allSettled(
|
|
75
75
|
scripts.map((script) => {
|
|
76
76
|
if (script.src) {
|
|
77
|
-
return
|
|
77
|
+
return _chunk6NAV4SCFcjs.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(_chunkSELGX4Y2cjs.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 === _chunkSELGX4Y2cjs.RUNTIME_WEBPACK && bundle && moduleId) {
|
|
108
|
+
const scope2 = _chunkSELGX4Y2cjs.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 = _chunkSELGX4Y2cjs.getScope.call(void 0, bundleName);
|
|
114
114
|
if (scope) {
|
|
115
|
-
return
|
|
115
|
+
return _chunk6NAV4SCFcjs.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-J42V6HSP.cjs.map
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CORE_REACT_SHARED_MODULE_IDS,
|
|
2
3
|
RUNTIME_WEBPACK,
|
|
3
4
|
SHARED_MODULE_MANIFEST_PROTOCOL,
|
|
4
5
|
collapseDoubleSlashes,
|
|
5
6
|
createSharedModulePlan,
|
|
6
7
|
formatRemoteId,
|
|
7
8
|
getScope,
|
|
8
|
-
installSharedModulePlan,
|
|
9
9
|
isSharedModuleManifest,
|
|
10
|
-
parseRemoteId
|
|
11
|
-
|
|
10
|
+
parseRemoteId,
|
|
11
|
+
resolveSharedModulePlan
|
|
12
|
+
} from "./chunk-6NUHDFSH.js";
|
|
12
13
|
import {
|
|
13
14
|
getNamespace
|
|
14
15
|
} from "./chunk-D5GNZB6O.js";
|
|
@@ -24,6 +25,247 @@ import {
|
|
|
24
25
|
isProxiedUrl
|
|
25
26
|
} from "./chunk-X6YKUJKH.js";
|
|
26
27
|
|
|
28
|
+
// src/host/shared/provider.ts
|
|
29
|
+
var DEFAULT_VERSION = "0";
|
|
30
|
+
var GLOBAL_PROVIDER_SCOPES_KEY = "__remote_components_shared_provider_scopes__";
|
|
31
|
+
function getProviderScopes() {
|
|
32
|
+
const self = globalThis;
|
|
33
|
+
self[GLOBAL_PROVIDER_SCOPES_KEY] ??= {};
|
|
34
|
+
return self[GLOBAL_PROVIDER_SCOPES_KEY];
|
|
35
|
+
}
|
|
36
|
+
function createSharedProvider({
|
|
37
|
+
value,
|
|
38
|
+
from
|
|
39
|
+
}) {
|
|
40
|
+
return {
|
|
41
|
+
get: () => value,
|
|
42
|
+
from,
|
|
43
|
+
eager: true,
|
|
44
|
+
loaded: 1
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
function createSharedProviderEntry({
|
|
48
|
+
id,
|
|
49
|
+
specifier,
|
|
50
|
+
value,
|
|
51
|
+
required = true,
|
|
52
|
+
singleton = true,
|
|
53
|
+
scope,
|
|
54
|
+
from = "host"
|
|
55
|
+
}) {
|
|
56
|
+
return {
|
|
57
|
+
id,
|
|
58
|
+
specifier,
|
|
59
|
+
provider: createSharedProvider({ value, from }),
|
|
60
|
+
required,
|
|
61
|
+
singleton,
|
|
62
|
+
scope
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
async function buildSharedProviderPlan({
|
|
66
|
+
bundle,
|
|
67
|
+
hostShared,
|
|
68
|
+
remoteShared,
|
|
69
|
+
scope = `remote:${bundle}`,
|
|
70
|
+
callerTag = "SharedBroker",
|
|
71
|
+
normalizeId = (id) => id,
|
|
72
|
+
additionalEntries = [],
|
|
73
|
+
onMissing
|
|
74
|
+
}) {
|
|
75
|
+
const sharedModulePlan = createSharedModulePlan({
|
|
76
|
+
bundle,
|
|
77
|
+
hostShared,
|
|
78
|
+
remoteShared,
|
|
79
|
+
scope,
|
|
80
|
+
callerTag
|
|
81
|
+
});
|
|
82
|
+
const resolved = await resolveSharedModulePlan(sharedModulePlan);
|
|
83
|
+
const entriesByIdAndSpecifier = /* @__PURE__ */ new Map();
|
|
84
|
+
const addEntry = (entry) => {
|
|
85
|
+
entriesByIdAndSpecifier.set(`${entry.id}\0${entry.specifier}`, entry);
|
|
86
|
+
};
|
|
87
|
+
for (const entry of additionalEntries) {
|
|
88
|
+
addEntry(
|
|
89
|
+
createSharedProviderEntry({
|
|
90
|
+
...entry,
|
|
91
|
+
scope: entry.scope ?? scope
|
|
92
|
+
})
|
|
93
|
+
);
|
|
94
|
+
}
|
|
95
|
+
for (const entry of sharedModulePlan.entries) {
|
|
96
|
+
if (entry.status !== "resolved") {
|
|
97
|
+
if (onMissing && !(sharedModulePlan.protocol === SHARED_MODULE_MANIFEST_PROTOCOL && entry.required)) {
|
|
98
|
+
onMissing(entry);
|
|
99
|
+
}
|
|
100
|
+
continue;
|
|
101
|
+
}
|
|
102
|
+
const value = resolved[entry.id];
|
|
103
|
+
if (typeof value === "undefined")
|
|
104
|
+
continue;
|
|
105
|
+
addEntry(
|
|
106
|
+
createSharedProviderEntry({
|
|
107
|
+
id: normalizeId(entry.id),
|
|
108
|
+
specifier: entry.specifier,
|
|
109
|
+
value,
|
|
110
|
+
required: entry.required,
|
|
111
|
+
singleton: entry.singleton,
|
|
112
|
+
scope: entry.scope
|
|
113
|
+
})
|
|
114
|
+
);
|
|
115
|
+
}
|
|
116
|
+
return {
|
|
117
|
+
protocol: sharedModulePlan.protocol,
|
|
118
|
+
entries: Array.from(entriesByIdAndSpecifier.values())
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
function installSharedProvider({
|
|
122
|
+
scope,
|
|
123
|
+
specifier,
|
|
124
|
+
value,
|
|
125
|
+
from,
|
|
126
|
+
provider,
|
|
127
|
+
version = DEFAULT_VERSION
|
|
128
|
+
}) {
|
|
129
|
+
const scopes = getProviderScopes();
|
|
130
|
+
const providerScope = scopes[scope] ??= {};
|
|
131
|
+
const versions = providerScope[specifier] ??= {};
|
|
132
|
+
const sharedProvider = provider ?? createSharedProvider({
|
|
133
|
+
value,
|
|
134
|
+
from: from ?? "host"
|
|
135
|
+
});
|
|
136
|
+
versions[version] = sharedProvider;
|
|
137
|
+
return sharedProvider;
|
|
138
|
+
}
|
|
139
|
+
function installSharedProviderEntry(entry) {
|
|
140
|
+
return installSharedProvider({
|
|
141
|
+
scope: entry.scope,
|
|
142
|
+
specifier: entry.specifier,
|
|
143
|
+
provider: entry.provider
|
|
144
|
+
});
|
|
145
|
+
}
|
|
146
|
+
function getSharedProvider({
|
|
147
|
+
scope,
|
|
148
|
+
specifier,
|
|
149
|
+
version = DEFAULT_VERSION
|
|
150
|
+
}) {
|
|
151
|
+
const versions = getProviderScopes()[scope]?.[specifier];
|
|
152
|
+
if (!versions)
|
|
153
|
+
return void 0;
|
|
154
|
+
return versions[version] ?? (version === DEFAULT_VERSION ? void 0 : versions[DEFAULT_VERSION]);
|
|
155
|
+
}
|
|
156
|
+
function getSharedProviderModule({
|
|
157
|
+
scope,
|
|
158
|
+
specifier,
|
|
159
|
+
version
|
|
160
|
+
}) {
|
|
161
|
+
const provider = getSharedProvider({ scope, specifier, version });
|
|
162
|
+
if (!provider) {
|
|
163
|
+
throw new Error(
|
|
164
|
+
`Shared module "${specifier}" not found in provider scope "${scope}".`
|
|
165
|
+
);
|
|
166
|
+
}
|
|
167
|
+
provider.loaded = 1;
|
|
168
|
+
return provider.get();
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
// src/config/webpack/shared-module-resolver.ts
|
|
172
|
+
var WEBPACK_SHARED_RESOLVE_METADATA = Symbol.for(
|
|
173
|
+
"remote-components.webpackSharedResolveMetadata"
|
|
174
|
+
);
|
|
175
|
+
function normalizeWebpackSharedId(id) {
|
|
176
|
+
return id.replace(/^\(ssr\)\/(?<relative>\.\/)?/, "");
|
|
177
|
+
}
|
|
178
|
+
async function buildWebpackResolve(hostShared, remoteShared, bundle, reactModules, callerTag = "SharedModuleResolver") {
|
|
179
|
+
const sharedProviderPlan = await buildSharedProviderPlan({
|
|
180
|
+
bundle,
|
|
181
|
+
hostShared,
|
|
182
|
+
remoteShared,
|
|
183
|
+
callerTag,
|
|
184
|
+
normalizeId: normalizeWebpackSharedId,
|
|
185
|
+
additionalEntries: Object.entries(CORE_REACT_SHARED_MODULE_IDS).map(
|
|
186
|
+
([specifier, id]) => ({
|
|
187
|
+
id,
|
|
188
|
+
specifier,
|
|
189
|
+
value: reactModules[id],
|
|
190
|
+
required: true,
|
|
191
|
+
singleton: true,
|
|
192
|
+
scope: `remote:${bundle}`
|
|
193
|
+
})
|
|
194
|
+
)
|
|
195
|
+
});
|
|
196
|
+
const resolve = {
|
|
197
|
+
...Object.fromEntries(
|
|
198
|
+
sharedProviderPlan.entries.map((entry) => [
|
|
199
|
+
entry.id,
|
|
200
|
+
entry.provider.get()
|
|
201
|
+
])
|
|
202
|
+
)
|
|
203
|
+
};
|
|
204
|
+
Object.defineProperty(resolve, WEBPACK_SHARED_RESOLVE_METADATA, {
|
|
205
|
+
enumerable: false,
|
|
206
|
+
value: {
|
|
207
|
+
protocol: sharedProviderPlan.protocol,
|
|
208
|
+
entries: sharedProviderPlan.entries
|
|
209
|
+
}
|
|
210
|
+
});
|
|
211
|
+
return resolve;
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
// src/config/webpack/provider-adapter.ts
|
|
215
|
+
function applyWebpackSharedProviderModules(bundle, entries) {
|
|
216
|
+
logDebug(
|
|
217
|
+
"SharedModules",
|
|
218
|
+
`applyWebpackSharedProviderModules called for bundle: "${bundle}"`
|
|
219
|
+
);
|
|
220
|
+
const self = globalThis;
|
|
221
|
+
const scope = getScope(bundle);
|
|
222
|
+
const webpackBundle = scope?.webpackRequire ?? self.__remote_webpack_require__?.[bundle];
|
|
223
|
+
if (!webpackBundle) {
|
|
224
|
+
throw new RemoteComponentsError(
|
|
225
|
+
`No Webpack require found for manifest-aware Remote Component bundle "${bundle}".`
|
|
226
|
+
);
|
|
227
|
+
}
|
|
228
|
+
if (!webpackBundle.m) {
|
|
229
|
+
throw new RemoteComponentsError(
|
|
230
|
+
`Webpack module factories are not available for manifest-aware Remote Component bundle "${bundle}".`
|
|
231
|
+
);
|
|
232
|
+
}
|
|
233
|
+
const modulePaths = Object.keys(
|
|
234
|
+
self.__remote_webpack_module_map__?.[bundle] ?? webpackBundle.m
|
|
235
|
+
);
|
|
236
|
+
for (const entry of entries) {
|
|
237
|
+
installSharedProviderEntry(entry);
|
|
238
|
+
const ids = resolveWebpackModuleIds(bundle, modulePaths, entry.id);
|
|
239
|
+
if (ids.length === 0) {
|
|
240
|
+
continue;
|
|
241
|
+
}
|
|
242
|
+
for (const id of ids) {
|
|
243
|
+
const resolvedId = self.__remote_webpack_module_map__?.[bundle]?.[id] ? `${self.__remote_webpack_module_map__[bundle][id]}` : id;
|
|
244
|
+
webpackBundle.m[resolvedId] = (module) => {
|
|
245
|
+
module.exports = getSharedProviderModule({
|
|
246
|
+
scope: entry.scope,
|
|
247
|
+
specifier: entry.specifier
|
|
248
|
+
});
|
|
249
|
+
};
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
}
|
|
253
|
+
function resolveWebpackModuleIds(bundle, modulePaths, id) {
|
|
254
|
+
const exactIds = modulePaths.filter((path) => path === id);
|
|
255
|
+
if (exactIds.length > 0) {
|
|
256
|
+
return exactIds;
|
|
257
|
+
}
|
|
258
|
+
const containedIds = modulePaths.filter((path) => path.includes(id));
|
|
259
|
+
if (containedIds.length > 0) {
|
|
260
|
+
return containedIds;
|
|
261
|
+
}
|
|
262
|
+
logDebug(
|
|
263
|
+
"SharedModules",
|
|
264
|
+
`No matching module path found for manifest shared module "${id}" in bundle "${bundle}"`
|
|
265
|
+
);
|
|
266
|
+
return [];
|
|
267
|
+
}
|
|
268
|
+
|
|
27
269
|
// src/config/webpack/apply-shared-modules.ts
|
|
28
270
|
var DEDUPLICATION_SKIPPED = "shared module deduplication skipped. The remote may load its own copy of shared dependencies.";
|
|
29
271
|
function applySharedModules(bundle, resolve) {
|
|
@@ -35,6 +277,11 @@ function applySharedModules(bundle, resolve) {
|
|
|
35
277
|
"SharedModules",
|
|
36
278
|
`Shared modules to resolve: ${Object.keys(resolve)}`
|
|
37
279
|
);
|
|
280
|
+
const metadata = resolve[WEBPACK_SHARED_RESOLVE_METADATA];
|
|
281
|
+
if (metadata?.protocol === SHARED_MODULE_MANIFEST_PROTOCOL) {
|
|
282
|
+
applyWebpackSharedProviderModules(bundle, metadata.entries);
|
|
283
|
+
return;
|
|
284
|
+
}
|
|
38
285
|
const self = globalThis;
|
|
39
286
|
const scope = getScope(bundle);
|
|
40
287
|
const webpackBundle = scope?.webpackRequire ?? self.__remote_webpack_require__?.[bundle];
|
|
@@ -797,33 +1044,26 @@ function stripQuotes2(value) {
|
|
|
797
1044
|
return value;
|
|
798
1045
|
}
|
|
799
1046
|
function installSharedModules(scope, hostShared, sharedModuleIds, missingMessage) {
|
|
800
|
-
|
|
1047
|
+
return buildSharedProviderPlan({
|
|
801
1048
|
bundle: scope.name,
|
|
802
1049
|
hostShared,
|
|
803
1050
|
remoteShared: sharedModuleIds,
|
|
804
1051
|
scope: `remote:${scope.scopedName}`,
|
|
805
|
-
callerTag: "SharedModules"
|
|
806
|
-
});
|
|
807
|
-
for (const entry of plan.entries) {
|
|
808
|
-
if (entry.status === "resolved") {
|
|
809
|
-
delete scope.moduleCache[entry.id];
|
|
810
|
-
}
|
|
811
|
-
}
|
|
812
|
-
return installSharedModulePlan({
|
|
813
|
-
plan,
|
|
814
|
-
target: scope.sharedModules,
|
|
815
1052
|
callerTag: "SharedModules",
|
|
816
1053
|
onMissing: (entry) => {
|
|
817
1054
|
logError("SharedModules", missingMessage(entry.id, entry.specifier));
|
|
818
1055
|
}
|
|
819
|
-
}).then(
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
1056
|
+
}).then(
|
|
1057
|
+
(results) => results.entries.map((entry) => {
|
|
1058
|
+
installSharedProviderEntry(entry);
|
|
1059
|
+
scope.sharedModules[entry.id] = getSharedProviderModule({
|
|
1060
|
+
scope: entry.scope,
|
|
1061
|
+
specifier: entry.specifier
|
|
1062
|
+
});
|
|
1063
|
+
delete scope.moduleCache[entry.id];
|
|
1064
|
+
return void 0;
|
|
1065
|
+
})
|
|
1066
|
+
);
|
|
827
1067
|
}
|
|
828
1068
|
function preferSharedManifest(sharedModuleIds, remoteShared) {
|
|
829
1069
|
if (!isSharedModuleManifest(remoteShared))
|
|
@@ -1099,6 +1339,7 @@ function findPreviousModuleId(entries, factoryIndex) {
|
|
|
1099
1339
|
}
|
|
1100
1340
|
|
|
1101
1341
|
export {
|
|
1342
|
+
buildWebpackResolve,
|
|
1102
1343
|
applySharedModules,
|
|
1103
1344
|
loadChunkWithScope,
|
|
1104
1345
|
createChunkDispatcher,
|
|
@@ -1106,4 +1347,4 @@ export {
|
|
|
1106
1347
|
requireModule,
|
|
1107
1348
|
nextClientPagesLoader
|
|
1108
1349
|
};
|
|
1109
|
-
//# sourceMappingURL=chunk-
|
|
1350
|
+
//# sourceMappingURL=chunk-JYGC7T6L.js.map
|