@module-federation/bridge-vue3 0.0.0-refactor-manifest-20251015114345 → 0.0.0-research-issue-4085-20251016232757
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/CHANGELOG.md +4 -5
- package/dist/index.cjs +4 -4
- package/dist/index.js +593 -546
- package/package.json +6 -5
- package/src/provider.ts +7 -16
- package/src/routeUtils.ts +139 -0
package/dist/index.js
CHANGED
|
@@ -47,8 +47,8 @@ const simpleJoinRemoteEntry = (r, t) => {
|
|
|
47
47
|
if (s.startsWith("./"))
|
|
48
48
|
return s.replace("./", "");
|
|
49
49
|
if (s.startsWith("/")) {
|
|
50
|
-
const
|
|
51
|
-
return
|
|
50
|
+
const a = s.slice(1);
|
|
51
|
+
return a.endsWith("/") ? a.slice(0, -1) : a;
|
|
52
52
|
}
|
|
53
53
|
return s;
|
|
54
54
|
})(r);
|
|
@@ -60,36 +60,36 @@ function inferAutoPublicPath(r) {
|
|
|
60
60
|
function generateSnapshotFromManifest(r, t = {}) {
|
|
61
61
|
var I, S, T;
|
|
62
62
|
const { remotes: o = {}, overrides: n = {}, version: s } = t;
|
|
63
|
-
let
|
|
64
|
-
const
|
|
63
|
+
let a;
|
|
64
|
+
const c = () => "publicPath" in r.metaData ? r.metaData.publicPath === "auto" && s ? inferAutoPublicPath(s) : r.metaData.publicPath : r.metaData.getPublicPath, i = Object.keys(n);
|
|
65
65
|
let l = {};
|
|
66
66
|
Object.keys(o).length || (l = ((I = r.remotes) == null ? void 0 : I.reduce((_, A) => {
|
|
67
67
|
let w;
|
|
68
68
|
const $ = A.federationContainerName;
|
|
69
|
-
return
|
|
69
|
+
return i.includes($) ? w = n[$] : "version" in A ? w = A.version : w = A.entry, _[$] = {
|
|
70
70
|
matchedVersion: w
|
|
71
71
|
}, _;
|
|
72
72
|
}, {})) || {}), Object.keys(o).forEach((_) => l[_] = {
|
|
73
73
|
// overrides will override dependencies
|
|
74
|
-
matchedVersion:
|
|
74
|
+
matchedVersion: i.includes(_) ? n[_] : o[_]
|
|
75
75
|
});
|
|
76
|
-
const { remoteEntry: { path: u, name:
|
|
76
|
+
const { remoteEntry: { path: u, name: p, type: m }, types: d, buildInfo: { buildVersion: y }, globalName: E, ssrRemoteEntry: R } = r.metaData, { exposes: g } = r;
|
|
77
77
|
let b = {
|
|
78
78
|
version: s || "",
|
|
79
79
|
buildVersion: y,
|
|
80
|
-
globalName:
|
|
81
|
-
remoteEntry: simpleJoinRemoteEntry(u,
|
|
82
|
-
remoteEntryType:
|
|
83
|
-
remoteTypes: simpleJoinRemoteEntry(
|
|
84
|
-
remoteTypesZip:
|
|
85
|
-
remoteTypesAPI:
|
|
80
|
+
globalName: E,
|
|
81
|
+
remoteEntry: simpleJoinRemoteEntry(u, p),
|
|
82
|
+
remoteEntryType: m,
|
|
83
|
+
remoteTypes: simpleJoinRemoteEntry(d.path, d.name),
|
|
84
|
+
remoteTypesZip: d.zip || "",
|
|
85
|
+
remoteTypesAPI: d.api || "",
|
|
86
86
|
remotesInfo: l,
|
|
87
87
|
shared: r == null ? void 0 : r.shared.map((_) => ({
|
|
88
88
|
assets: _.assets,
|
|
89
89
|
sharedName: _.name,
|
|
90
90
|
version: _.version
|
|
91
91
|
})),
|
|
92
|
-
modules:
|
|
92
|
+
modules: g == null ? void 0 : g.map((_) => ({
|
|
93
93
|
moduleName: _.name,
|
|
94
94
|
modulePath: _.path,
|
|
95
95
|
assets: _.assets
|
|
@@ -110,18 +110,18 @@ function generateSnapshotFromManifest(r, t = {}) {
|
|
|
110
110
|
prefetchEntryType: w
|
|
111
111
|
};
|
|
112
112
|
}
|
|
113
|
-
if ("publicPath" in r.metaData ?
|
|
113
|
+
if ("publicPath" in r.metaData ? a = {
|
|
114
114
|
...b,
|
|
115
|
-
publicPath:
|
|
115
|
+
publicPath: c(),
|
|
116
116
|
ssrPublicPath: r.metaData.ssrPublicPath
|
|
117
|
-
} :
|
|
117
|
+
} : a = {
|
|
118
118
|
...b,
|
|
119
|
-
getPublicPath:
|
|
119
|
+
getPublicPath: c()
|
|
120
120
|
}, R) {
|
|
121
121
|
const _ = simpleJoinRemoteEntry(R.path, R.name);
|
|
122
|
-
|
|
122
|
+
a.ssrRemoteEntry = _, a.ssrRemoteEntryType = R.type || "commonjs-module";
|
|
123
123
|
}
|
|
124
|
-
return
|
|
124
|
+
return a;
|
|
125
125
|
}
|
|
126
126
|
function isManifestProvider(r) {
|
|
127
127
|
return !!("remoteEntry" in r && r.remoteEntry.includes(MANIFEST_EXT));
|
|
@@ -153,17 +153,17 @@ class Logger {
|
|
|
153
153
|
return ["debug", "log"];
|
|
154
154
|
}
|
|
155
155
|
})();
|
|
156
|
-
for (const
|
|
157
|
-
const
|
|
158
|
-
if (typeof
|
|
159
|
-
|
|
156
|
+
for (const a of s) {
|
|
157
|
+
const c = n[a];
|
|
158
|
+
if (typeof c == "function") {
|
|
159
|
+
c.call(n, this.prefix, ...o);
|
|
160
160
|
return;
|
|
161
161
|
}
|
|
162
162
|
}
|
|
163
|
-
for (const
|
|
164
|
-
const
|
|
165
|
-
if (typeof
|
|
166
|
-
|
|
163
|
+
for (const a of s) {
|
|
164
|
+
const c = DEFAULT_DELEGATE[a];
|
|
165
|
+
if (typeof c == "function") {
|
|
166
|
+
c.call(DEFAULT_DELEGATE, this.prefix, ...o);
|
|
167
167
|
return;
|
|
168
168
|
}
|
|
169
169
|
}
|
|
@@ -216,84 +216,84 @@ function isStaticResourcesEqual(r, t) {
|
|
|
216
216
|
}
|
|
217
217
|
function createScript(r) {
|
|
218
218
|
let t = null, o = !0, n = 2e4, s;
|
|
219
|
-
const
|
|
220
|
-
for (let
|
|
221
|
-
const l = i
|
|
219
|
+
const a = document.getElementsByTagName("script");
|
|
220
|
+
for (let i = 0; i < a.length; i++) {
|
|
221
|
+
const l = a[i], u = l.getAttribute("src");
|
|
222
222
|
if (u && isStaticResourcesEqual(u, r.url)) {
|
|
223
223
|
t = l, o = !1;
|
|
224
224
|
break;
|
|
225
225
|
}
|
|
226
226
|
}
|
|
227
227
|
if (!t) {
|
|
228
|
-
const
|
|
229
|
-
t = document.createElement("script"), t.type = (
|
|
228
|
+
const i = r.attrs;
|
|
229
|
+
t = document.createElement("script"), t.type = (i == null ? void 0 : i.type) === "module" ? "module" : "text/javascript";
|
|
230
230
|
let l;
|
|
231
|
-
r.createScriptHook && (l = r.createScriptHook(r.url, r.attrs), l instanceof HTMLScriptElement ? t = l : typeof l == "object" && ("script" in l && l.script && (t = l.script), "timeout" in l && l.timeout && (n = l.timeout))), t.src || (t.src = r.url),
|
|
232
|
-
t && (u === "async" || u === "defer" ? t[u] =
|
|
231
|
+
r.createScriptHook && (l = r.createScriptHook(r.url, r.attrs), l instanceof HTMLScriptElement ? t = l : typeof l == "object" && ("script" in l && l.script && (t = l.script), "timeout" in l && l.timeout && (n = l.timeout))), t.src || (t.src = r.url), i && !l && Object.keys(i).forEach((u) => {
|
|
232
|
+
t && (u === "async" || u === "defer" ? t[u] = i[u] : t.getAttribute(u) || t.setAttribute(u, i[u]));
|
|
233
233
|
});
|
|
234
234
|
}
|
|
235
|
-
const
|
|
235
|
+
const c = async (i, l) => {
|
|
236
236
|
clearTimeout(s);
|
|
237
237
|
const u = () => {
|
|
238
238
|
(l == null ? void 0 : l.type) === "error" ? r != null && r.onErrorCallback && (r == null || r.onErrorCallback(l)) : r != null && r.cb && (r == null || r.cb());
|
|
239
239
|
};
|
|
240
240
|
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
241
|
-
const { needDeleteScript:
|
|
242
|
-
|
|
243
|
-
}),
|
|
244
|
-
const
|
|
245
|
-
if (
|
|
246
|
-
const
|
|
247
|
-
return u(),
|
|
241
|
+
const { needDeleteScript: p = !0 } = r;
|
|
242
|
+
p && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
243
|
+
}), i && typeof i == "function")) {
|
|
244
|
+
const p = i(l);
|
|
245
|
+
if (p instanceof Promise) {
|
|
246
|
+
const m = await p;
|
|
247
|
+
return u(), m;
|
|
248
248
|
}
|
|
249
|
-
return u(),
|
|
249
|
+
return u(), p;
|
|
250
250
|
}
|
|
251
251
|
u();
|
|
252
252
|
};
|
|
253
|
-
return t.onerror =
|
|
254
|
-
|
|
253
|
+
return t.onerror = c.bind(null, t.onerror), t.onload = c.bind(null, t.onload), s = setTimeout(() => {
|
|
254
|
+
c(null, new Error(`Remote script "${r.url}" time-outed.`));
|
|
255
255
|
}, n), { script: t, needAttach: o };
|
|
256
256
|
}
|
|
257
257
|
function createLink(r) {
|
|
258
258
|
let t = null, o = !0;
|
|
259
259
|
const n = document.getElementsByTagName("link");
|
|
260
|
-
for (let
|
|
261
|
-
const
|
|
262
|
-
if (
|
|
263
|
-
t =
|
|
260
|
+
for (let a = 0; a < n.length; a++) {
|
|
261
|
+
const c = n[a], i = c.getAttribute("href"), l = c.getAttribute("rel");
|
|
262
|
+
if (i && isStaticResourcesEqual(i, r.url) && l === r.attrs.rel) {
|
|
263
|
+
t = c, o = !1;
|
|
264
264
|
break;
|
|
265
265
|
}
|
|
266
266
|
}
|
|
267
267
|
if (!t) {
|
|
268
268
|
t = document.createElement("link"), t.setAttribute("href", r.url);
|
|
269
|
-
let
|
|
270
|
-
const
|
|
271
|
-
r.createLinkHook && (
|
|
272
|
-
t && !t.getAttribute(
|
|
269
|
+
let a;
|
|
270
|
+
const c = r.attrs;
|
|
271
|
+
r.createLinkHook && (a = r.createLinkHook(r.url, c), a instanceof HTMLLinkElement && (t = a)), c && !a && Object.keys(c).forEach((i) => {
|
|
272
|
+
t && !t.getAttribute(i) && t.setAttribute(i, c[i]);
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
|
-
const s = (
|
|
276
|
-
const
|
|
277
|
-
(
|
|
275
|
+
const s = (a, c) => {
|
|
276
|
+
const i = () => {
|
|
277
|
+
(c == null ? void 0 : c.type) === "error" ? r != null && r.onErrorCallback && (r == null || r.onErrorCallback(c)) : r != null && r.cb && (r == null || r.cb());
|
|
278
278
|
};
|
|
279
279
|
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
280
280
|
const { needDeleteLink: l = !0 } = r;
|
|
281
281
|
l && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
282
|
-
}),
|
|
283
|
-
const l =
|
|
284
|
-
return
|
|
282
|
+
}), a)) {
|
|
283
|
+
const l = a(c);
|
|
284
|
+
return i(), l;
|
|
285
285
|
}
|
|
286
|
-
|
|
286
|
+
i();
|
|
287
287
|
};
|
|
288
288
|
return t.onerror = s.bind(null, t.onerror), t.onload = s.bind(null, t.onload), { link: t, needAttach: o };
|
|
289
289
|
}
|
|
290
290
|
function loadScript(r, t) {
|
|
291
291
|
const { attrs: o = {}, createScriptHook: n } = t;
|
|
292
|
-
return new Promise((s,
|
|
293
|
-
const { script:
|
|
292
|
+
return new Promise((s, a) => {
|
|
293
|
+
const { script: c, needAttach: i } = createScript({
|
|
294
294
|
url: r,
|
|
295
295
|
cb: s,
|
|
296
|
-
onErrorCallback:
|
|
296
|
+
onErrorCallback: a,
|
|
297
297
|
attrs: {
|
|
298
298
|
fetchpriority: "high",
|
|
299
299
|
...o
|
|
@@ -301,7 +301,7 @@ function loadScript(r, t) {
|
|
|
301
301
|
createScriptHook: n,
|
|
302
302
|
needDeleteScript: !0
|
|
303
303
|
});
|
|
304
|
-
|
|
304
|
+
i && document.head.appendChild(c);
|
|
305
305
|
});
|
|
306
306
|
}
|
|
307
307
|
const sdkImportCache = /* @__PURE__ */ new Map();
|
|
@@ -319,7 +319,7 @@ const loadNodeFetch = async () => {
|
|
|
319
319
|
const r = await importNodeModule("node-fetch");
|
|
320
320
|
return r.default || r;
|
|
321
321
|
}, lazyLoaderHookFetch = async (r, t, o) => {
|
|
322
|
-
const s = await ((
|
|
322
|
+
const s = await ((a, c) => o.lifecycle.fetch.emit(a, c))(r, t || {});
|
|
323
323
|
return !s || !(s instanceof Response) ? (typeof fetch > "u" ? await loadNodeFetch() : fetch)(r, t || {}) : s;
|
|
324
324
|
}, createScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (url, cb, attrs, loaderHook) => {
|
|
325
325
|
if (loaderHook != null && loaderHook.createScriptHook) {
|
|
@@ -376,12 +376,12 @@ const loadNodeFetch = async () => {
|
|
|
376
376
|
} : (r, t, o, n) => {
|
|
377
377
|
t(new Error("createScriptNode is disabled in non-Node.js environment"));
|
|
378
378
|
}, loadScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (r, t) => new Promise((o, n) => {
|
|
379
|
-
createScriptNode(r, (s,
|
|
380
|
-
var
|
|
379
|
+
createScriptNode(r, (s, a) => {
|
|
380
|
+
var c, i;
|
|
381
381
|
if (s)
|
|
382
382
|
n(s);
|
|
383
383
|
else {
|
|
384
|
-
const l = ((
|
|
384
|
+
const l = ((c = t == null ? void 0 : t.attrs) == null ? void 0 : c.globalName) || `__FEDERATION_${(i = t == null ? void 0 : t.attrs) == null ? void 0 : i.name}:custom__`, u = globalThis[l] = a;
|
|
385
385
|
o(u);
|
|
386
386
|
}
|
|
387
387
|
}, t.attrs, t.loaderHook);
|
|
@@ -391,17 +391,17 @@ const loadNodeFetch = async () => {
|
|
|
391
391
|
async function loadModule(r, t) {
|
|
392
392
|
if (esmModuleCache.has(r))
|
|
393
393
|
return esmModuleCache.get(r);
|
|
394
|
-
const { fetch: o, vm: n } = t,
|
|
394
|
+
const { fetch: o, vm: n } = t, a = await (await o(r)).text(), c = new n.SourceTextModule(a, {
|
|
395
395
|
// @ts-ignore
|
|
396
|
-
importModuleDynamically: async (
|
|
397
|
-
const u = new URL(
|
|
396
|
+
importModuleDynamically: async (i, l) => {
|
|
397
|
+
const u = new URL(i, r).href;
|
|
398
398
|
return loadModule(u, t);
|
|
399
399
|
}
|
|
400
400
|
});
|
|
401
|
-
return esmModuleCache.set(r,
|
|
402
|
-
const l = new URL(
|
|
401
|
+
return esmModuleCache.set(r, c), await c.link(async (i) => {
|
|
402
|
+
const l = new URL(i, r).href;
|
|
403
403
|
return await loadModule(l, t);
|
|
404
|
-
}),
|
|
404
|
+
}), c;
|
|
405
405
|
}
|
|
406
406
|
const LoggerInstance = createLogger("[ Module Federation Bridge Vue3 ]"), RUNTIME_001 = "RUNTIME-001", RUNTIME_002 = "RUNTIME-002", RUNTIME_003 = "RUNTIME-003", RUNTIME_004 = "RUNTIME-004", RUNTIME_005 = "RUNTIME-005", RUNTIME_006 = "RUNTIME-006", RUNTIME_007 = "RUNTIME-007", RUNTIME_008 = "RUNTIME-008", RUNTIME_009 = "RUNTIME-009", getDocsUrl = (r) => `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${r.split("-")[0].toLowerCase()}/${r}`, getShortErrorMsg = (r, t, o, n) => {
|
|
407
407
|
const s = [`${[t[r]]} #${r}`];
|
|
@@ -489,7 +489,7 @@ function includeOwnProperty(r, t) {
|
|
|
489
489
|
includeOwnProperty(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__") || definePropertyGlobalVal(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__", {});
|
|
490
490
|
const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;
|
|
491
491
|
function setGlobalDefaultVal(r) {
|
|
492
|
-
var t, o, n, s,
|
|
492
|
+
var t, o, n, s, a, c;
|
|
493
493
|
includeOwnProperty(r, "__VMOK__") && !includeOwnProperty(r, "__FEDERATION__") && definePropertyGlobalVal(r, "__FEDERATION__", r.__VMOK__), includeOwnProperty(r, "__FEDERATION__") || (definePropertyGlobalVal(r, "__FEDERATION__", {
|
|
494
494
|
__GLOBAL_PLUGIN__: [],
|
|
495
495
|
__INSTANCES__: [],
|
|
@@ -497,12 +497,12 @@ function setGlobalDefaultVal(r) {
|
|
|
497
497
|
__SHARE__: {},
|
|
498
498
|
__MANIFEST_LOADING__: {},
|
|
499
499
|
__PRELOADED_MAP__: /* @__PURE__ */ new Map()
|
|
500
|
-
}), definePropertyGlobalVal(r, "__VMOK__", r.__FEDERATION__)), (t = r.__FEDERATION__).__GLOBAL_PLUGIN__ ?? (t.__GLOBAL_PLUGIN__ = []), (o = r.__FEDERATION__).__INSTANCES__ ?? (o.__INSTANCES__ = []), (n = r.__FEDERATION__).moduleInfo ?? (n.moduleInfo = {}), (s = r.__FEDERATION__).__SHARE__ ?? (s.__SHARE__ = {}), (
|
|
500
|
+
}), definePropertyGlobalVal(r, "__VMOK__", r.__FEDERATION__)), (t = r.__FEDERATION__).__GLOBAL_PLUGIN__ ?? (t.__GLOBAL_PLUGIN__ = []), (o = r.__FEDERATION__).__INSTANCES__ ?? (o.__INSTANCES__ = []), (n = r.__FEDERATION__).moduleInfo ?? (n.moduleInfo = {}), (s = r.__FEDERATION__).__SHARE__ ?? (s.__SHARE__ = {}), (a = r.__FEDERATION__).__MANIFEST_LOADING__ ?? (a.__MANIFEST_LOADING__ = {}), (c = r.__FEDERATION__).__PRELOADED_MAP__ ?? (c.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
|
|
501
501
|
}
|
|
502
502
|
setGlobalDefaultVal(CurrentGlobal);
|
|
503
503
|
setGlobalDefaultVal(nativeGlobal);
|
|
504
504
|
function setGlobalFederationConstructor(r, t = isDebugMode()) {
|
|
505
|
-
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-
|
|
505
|
+
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.0-research-issue-4085-20251016232757");
|
|
506
506
|
}
|
|
507
507
|
function getInfoWithoutType(r, t) {
|
|
508
508
|
if (typeof t == "string") {
|
|
@@ -514,11 +514,11 @@ function getInfoWithoutType(r, t) {
|
|
|
514
514
|
{
|
|
515
515
|
const n = Object.keys(r);
|
|
516
516
|
for (const s of n) {
|
|
517
|
-
const [
|
|
517
|
+
const [a, c] = s.split(":"), i = `${a}:${t}`, l = r[i];
|
|
518
518
|
if (l)
|
|
519
519
|
return {
|
|
520
520
|
value: l,
|
|
521
|
-
key:
|
|
521
|
+
key: i
|
|
522
522
|
};
|
|
523
523
|
}
|
|
524
524
|
return {
|
|
@@ -534,9 +534,9 @@ const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo, getTarge
|
|
|
534
534
|
if (n && !n.version && "version" in r && r.version && (n.version = r.version), n)
|
|
535
535
|
return n;
|
|
536
536
|
if ("version" in r && r.version) {
|
|
537
|
-
const { version: s, ...
|
|
538
|
-
if ((
|
|
539
|
-
return
|
|
537
|
+
const { version: s, ...a } = r, c = getFMId(a), i = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, c).value;
|
|
538
|
+
if ((i == null ? void 0 : i.version) === s)
|
|
539
|
+
return i;
|
|
540
540
|
}
|
|
541
541
|
}, getGlobalSnapshotInfoByModuleInfo = (r) => getTargetSnapshotInfoByModuleInfo(r, nativeGlobal.__FEDERATION__.moduleInfo), setGlobalSnapshotInfoByModuleInfo = (r, t) => {
|
|
542
542
|
const o = getFMId(r);
|
|
@@ -572,7 +572,7 @@ function combineVersion(r, t, o, n) {
|
|
|
572
572
|
return n ? `${s}-${n}` : s;
|
|
573
573
|
}
|
|
574
574
|
function parseHyphen(r) {
|
|
575
|
-
return r.replace(parseRegex(hyphenRange), (t, o, n, s,
|
|
575
|
+
return r.replace(parseRegex(hyphenRange), (t, o, n, s, a, c, i, l, u, p, m, d) => (isXVersion(n) ? o = "" : isXVersion(s) ? o = `>=${n}.0.0` : isXVersion(a) ? o = `>=${n}.${s}.0` : o = `>=${o}`, isXVersion(u) ? l = "" : isXVersion(p) ? l = `<${Number(u) + 1}.0.0-0` : isXVersion(m) ? l = `<${u}.${Number(p) + 1}.0-0` : d ? l = `<=${u}.${p}.${m}-${d}` : l = `<=${l}`, `${o} ${l}`.trim()));
|
|
576
576
|
}
|
|
577
577
|
function parseComparatorTrim(r) {
|
|
578
578
|
return r.replace(parseRegex(comparatorTrim), "$1$2$3");
|
|
@@ -584,15 +584,15 @@ function parseCaretTrim(r) {
|
|
|
584
584
|
return r.replace(parseRegex(caretTrim), "$1^");
|
|
585
585
|
}
|
|
586
586
|
function parseCarets(r) {
|
|
587
|
-
return r.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (o, n, s,
|
|
587
|
+
return r.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (o, n, s, a, c) => isXVersion(n) ? "" : isXVersion(s) ? `>=${n}.0.0 <${Number(n) + 1}.0.0-0` : isXVersion(a) ? n === "0" ? `>=${n}.${s}.0 <${n}.${Number(s) + 1}.0-0` : `>=${n}.${s}.0 <${Number(n) + 1}.0.0-0` : c ? n === "0" ? s === "0" ? `>=${n}.${s}.${a}-${c} <${n}.${s}.${Number(a) + 1}-0` : `>=${n}.${s}.${a}-${c} <${n}.${Number(s) + 1}.0-0` : `>=${n}.${s}.${a}-${c} <${Number(n) + 1}.0.0-0` : n === "0" ? s === "0" ? `>=${n}.${s}.${a} <${n}.${s}.${Number(a) + 1}-0` : `>=${n}.${s}.${a} <${n}.${Number(s) + 1}.0-0` : `>=${n}.${s}.${a} <${Number(n) + 1}.0.0-0`)).join(" ");
|
|
588
588
|
}
|
|
589
589
|
function parseTildes(r) {
|
|
590
|
-
return r.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (o, n, s,
|
|
590
|
+
return r.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (o, n, s, a, c) => isXVersion(n) ? "" : isXVersion(s) ? `>=${n}.0.0 <${Number(n) + 1}.0.0-0` : isXVersion(a) ? `>=${n}.${s}.0 <${n}.${Number(s) + 1}.0-0` : c ? `>=${n}.${s}.${a}-${c} <${n}.${Number(s) + 1}.0-0` : `>=${n}.${s}.${a} <${n}.${Number(s) + 1}.0-0`)).join(" ");
|
|
591
591
|
}
|
|
592
592
|
function parseXRanges(r) {
|
|
593
|
-
return r.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (o, n, s,
|
|
594
|
-
const l = isXVersion(s), u = l || isXVersion(
|
|
595
|
-
return n === "=" &&
|
|
593
|
+
return r.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (o, n, s, a, c, i) => {
|
|
594
|
+
const l = isXVersion(s), u = l || isXVersion(a), p = u || isXVersion(c);
|
|
595
|
+
return n === "=" && p && (n = ""), i = "", l ? n === ">" || n === "<" ? "<0.0.0-0" : "*" : n && p ? (u && (a = 0), c = 0, n === ">" ? (n = ">=", u ? (s = Number(s) + 1, a = 0, c = 0) : (a = Number(a) + 1, c = 0)) : n === "<=" && (n = "<", u ? s = Number(s) + 1 : a = Number(a) + 1), n === "<" && (i = "-0"), `${n + s}.${a}.${c}${i}`) : u ? `>=${s}.0.0${i} <${Number(s) + 1}.0.0-0` : p ? `>=${s}.${a}.0${i} <${s}.${Number(a) + 1}.0-0` : o;
|
|
596
596
|
})).join(" ");
|
|
597
597
|
}
|
|
598
598
|
function parseStar(r) {
|
|
@@ -612,10 +612,10 @@ function comparePreRelease(r, t) {
|
|
|
612
612
|
return -1;
|
|
613
613
|
if (o === void 0 && n === void 0)
|
|
614
614
|
return 0;
|
|
615
|
-
for (let s = 0,
|
|
616
|
-
const
|
|
617
|
-
if (
|
|
618
|
-
return
|
|
615
|
+
for (let s = 0, a = o.length; s <= a; s++) {
|
|
616
|
+
const c = o[s], i = n[s];
|
|
617
|
+
if (c !== i)
|
|
618
|
+
return c === void 0 && i === void 0 ? 0 : c ? i ? compareAtom(c, i) : -1 : 1;
|
|
619
619
|
}
|
|
620
620
|
return 0;
|
|
621
621
|
}
|
|
@@ -688,32 +688,32 @@ function satisfy(r, t) {
|
|
|
688
688
|
const o = extractComparator(r);
|
|
689
689
|
if (!o)
|
|
690
690
|
return !1;
|
|
691
|
-
const [, n, , s,
|
|
691
|
+
const [, n, , s, a, c, i] = o, l = {
|
|
692
692
|
operator: n,
|
|
693
|
-
version: combineVersion(s,
|
|
693
|
+
version: combineVersion(s, a, c, i),
|
|
694
694
|
// exclude build atom
|
|
695
695
|
major: s,
|
|
696
|
-
minor:
|
|
697
|
-
patch:
|
|
698
|
-
preRelease:
|
|
696
|
+
minor: a,
|
|
697
|
+
patch: c,
|
|
698
|
+
preRelease: i == null ? void 0 : i.split(".")
|
|
699
699
|
}, u = t.split("||");
|
|
700
|
-
for (const
|
|
701
|
-
const
|
|
702
|
-
if (!
|
|
700
|
+
for (const p of u) {
|
|
701
|
+
const m = p.trim();
|
|
702
|
+
if (!m || m === "*" || m === "x")
|
|
703
703
|
return !0;
|
|
704
704
|
try {
|
|
705
|
-
const
|
|
706
|
-
if (!
|
|
705
|
+
const d = parseRange(m);
|
|
706
|
+
if (!d.trim())
|
|
707
707
|
return !0;
|
|
708
|
-
const y =
|
|
708
|
+
const y = d.split(" ").map((g) => parseComparatorString(g)).join(" ");
|
|
709
709
|
if (!y.trim())
|
|
710
710
|
return !0;
|
|
711
|
-
const
|
|
712
|
-
if (
|
|
711
|
+
const E = y.split(/\s+/).map((g) => parseGTE0(g)).filter(Boolean);
|
|
712
|
+
if (E.length === 0)
|
|
713
713
|
continue;
|
|
714
714
|
let R = !0;
|
|
715
|
-
for (const
|
|
716
|
-
const b = extractComparator(
|
|
715
|
+
for (const g of E) {
|
|
716
|
+
const b = extractComparator(g);
|
|
717
717
|
if (!b) {
|
|
718
718
|
R = !1;
|
|
719
719
|
break;
|
|
@@ -733,8 +733,8 @@ function satisfy(r, t) {
|
|
|
733
733
|
}
|
|
734
734
|
if (R)
|
|
735
735
|
return !0;
|
|
736
|
-
} catch (
|
|
737
|
-
console.error(`[semver] Error processing range part "${
|
|
736
|
+
} catch (d) {
|
|
737
|
+
console.error(`[semver] Error processing range part "${m}":`, d);
|
|
738
738
|
continue;
|
|
739
739
|
}
|
|
740
740
|
}
|
|
@@ -765,28 +765,28 @@ function formatShare(r, t, o, n) {
|
|
|
765
765
|
};
|
|
766
766
|
}
|
|
767
767
|
function formatShareConfigs(r, t) {
|
|
768
|
-
const o = t.shared || {}, n = t.name, s = Object.keys(o).reduce((
|
|
769
|
-
const l = arrayOptions(o[
|
|
770
|
-
return
|
|
771
|
-
|
|
772
|
-
}),
|
|
773
|
-
}, {}),
|
|
768
|
+
const o = t.shared || {}, n = t.name, s = Object.keys(o).reduce((c, i) => {
|
|
769
|
+
const l = arrayOptions(o[i]);
|
|
770
|
+
return c[i] = c[i] || [], l.forEach((u) => {
|
|
771
|
+
c[i].push(formatShare(u, n, i, t.shareStrategy));
|
|
772
|
+
}), c;
|
|
773
|
+
}, {}), a = {
|
|
774
774
|
...r.shared
|
|
775
775
|
};
|
|
776
|
-
return Object.keys(s).forEach((
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
}) :
|
|
780
|
-
}), { shared:
|
|
776
|
+
return Object.keys(s).forEach((c) => {
|
|
777
|
+
a[c] ? s[c].forEach((i) => {
|
|
778
|
+
a[c].find((u) => u.version === i.version) || a[c].push(i);
|
|
779
|
+
}) : a[c] = s[c];
|
|
780
|
+
}), { shared: a, shareInfos: s };
|
|
781
781
|
}
|
|
782
782
|
function versionLt(r, t) {
|
|
783
783
|
const o = (n) => {
|
|
784
784
|
if (!Number.isNaN(Number(n))) {
|
|
785
|
-
const
|
|
786
|
-
let
|
|
787
|
-
for (let
|
|
788
|
-
|
|
789
|
-
return
|
|
785
|
+
const a = n.split(".");
|
|
786
|
+
let c = n;
|
|
787
|
+
for (let i = 0; i < 3 - a.length; i++)
|
|
788
|
+
c += ".0";
|
|
789
|
+
return c;
|
|
790
790
|
}
|
|
791
791
|
return n;
|
|
792
792
|
};
|
|
@@ -799,15 +799,15 @@ const findVersion = (r, t) => {
|
|
|
799
799
|
return Object.keys(r).reduce((n, s) => !n || o(n, s) || n === "0" ? s : n, 0);
|
|
800
800
|
}, isLoaded = (r) => !!r.loaded || typeof r.lib == "function", isLoading = (r) => !!r.loading;
|
|
801
801
|
function findSingletonVersionOrderByVersion(r, t, o) {
|
|
802
|
-
const n = r[t][o], s = function(
|
|
803
|
-
return !isLoaded(n[
|
|
802
|
+
const n = r[t][o], s = function(a, c) {
|
|
803
|
+
return !isLoaded(n[a]) && versionLt(a, c);
|
|
804
804
|
};
|
|
805
805
|
return findVersion(r[t][o], s);
|
|
806
806
|
}
|
|
807
807
|
function findSingletonVersionOrderByLoaded(r, t, o) {
|
|
808
|
-
const n = r[t][o], s = function(
|
|
809
|
-
const
|
|
810
|
-
return
|
|
808
|
+
const n = r[t][o], s = function(a, c) {
|
|
809
|
+
const i = (l) => isLoaded(l) || isLoading(l);
|
|
810
|
+
return i(n[c]) ? i(n[a]) ? !!versionLt(a, c) : !0 : i(n[a]) ? !1 : versionLt(a, c);
|
|
811
811
|
};
|
|
812
812
|
return findVersion(r[t][o], s);
|
|
813
813
|
}
|
|
@@ -817,30 +817,30 @@ function getFindShareFunction(r) {
|
|
|
817
817
|
function getRegisteredShare(r, t, o, n) {
|
|
818
818
|
if (!r)
|
|
819
819
|
return;
|
|
820
|
-
const { shareConfig: s, scope:
|
|
821
|
-
for (const l of
|
|
820
|
+
const { shareConfig: s, scope: a = DEFAULT_SCOPE, strategy: c } = o, i = Array.isArray(a) ? a : [a];
|
|
821
|
+
for (const l of i)
|
|
822
822
|
if (s && r[l] && r[l][t]) {
|
|
823
|
-
const { requiredVersion: u } = s,
|
|
823
|
+
const { requiredVersion: u } = s, m = getFindShareFunction(c)(r, l, t), d = () => {
|
|
824
824
|
if (s.singleton) {
|
|
825
|
-
if (typeof u == "string" && !satisfy(
|
|
826
|
-
const R = `Version ${
|
|
825
|
+
if (typeof u == "string" && !satisfy(m, u)) {
|
|
826
|
+
const R = `Version ${m} from ${m && r[l][t][m].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;
|
|
827
827
|
s.strictVersion ? error(R) : warn(R);
|
|
828
828
|
}
|
|
829
|
-
return r[l][t][
|
|
829
|
+
return r[l][t][m];
|
|
830
830
|
} else {
|
|
831
|
-
if (u === !1 || u === "*" || satisfy(
|
|
832
|
-
return r[l][t][
|
|
833
|
-
for (const [R,
|
|
831
|
+
if (u === !1 || u === "*" || satisfy(m, u))
|
|
832
|
+
return r[l][t][m];
|
|
833
|
+
for (const [R, g] of Object.entries(r[l][t]))
|
|
834
834
|
if (satisfy(R, u))
|
|
835
|
-
return
|
|
835
|
+
return g;
|
|
836
836
|
}
|
|
837
837
|
}, y = {
|
|
838
838
|
shareScopeMap: r,
|
|
839
839
|
scope: l,
|
|
840
840
|
pkgName: t,
|
|
841
|
-
version:
|
|
841
|
+
version: m,
|
|
842
842
|
GlobalFederation: Global.__FEDERATION__,
|
|
843
|
-
resolver:
|
|
843
|
+
resolver: d
|
|
844
844
|
};
|
|
845
845
|
return (n.emit(y) || y).resolver();
|
|
846
846
|
}
|
|
@@ -849,19 +849,19 @@ function getGlobalShareScope() {
|
|
|
849
849
|
return Global.__FEDERATION__.__SHARE__;
|
|
850
850
|
}
|
|
851
851
|
function getTargetSharedOptions(r) {
|
|
852
|
-
const { pkgName: t, extraOptions: o, shareInfos: n } = r, s = (
|
|
853
|
-
if (!
|
|
852
|
+
const { pkgName: t, extraOptions: o, shareInfos: n } = r, s = (c) => {
|
|
853
|
+
if (!c)
|
|
854
854
|
return;
|
|
855
|
-
const
|
|
856
|
-
|
|
857
|
-
|
|
855
|
+
const i = {};
|
|
856
|
+
c.forEach((p) => {
|
|
857
|
+
i[p.version] = p;
|
|
858
858
|
});
|
|
859
|
-
const u = findVersion(
|
|
860
|
-
return !isLoaded(
|
|
859
|
+
const u = findVersion(i, function(p, m) {
|
|
860
|
+
return !isLoaded(i[p]) && versionLt(p, m);
|
|
861
861
|
});
|
|
862
|
-
return
|
|
863
|
-
},
|
|
864
|
-
return Object.assign({},
|
|
862
|
+
return i[u];
|
|
863
|
+
}, a = (o == null ? void 0 : o.resolver) ?? s;
|
|
864
|
+
return Object.assign({}, a(n[t]), o == null ? void 0 : o.customShareInfo);
|
|
865
865
|
}
|
|
866
866
|
function getBuilderId() {
|
|
867
867
|
return typeof FEDERATION_BUILD_IDENTIFIER < "u" ? (
|
|
@@ -875,9 +875,9 @@ function matchRemoteWithNameAndExpose(r, t) {
|
|
|
875
875
|
let s = t.replace(o.name, "");
|
|
876
876
|
if (n) {
|
|
877
877
|
if (s.startsWith("/")) {
|
|
878
|
-
const
|
|
878
|
+
const i = o.name;
|
|
879
879
|
return s = `.${s}`, {
|
|
880
|
-
pkgNameOrAlias:
|
|
880
|
+
pkgNameOrAlias: i,
|
|
881
881
|
expose: s,
|
|
882
882
|
remote: o
|
|
883
883
|
};
|
|
@@ -888,17 +888,17 @@ function matchRemoteWithNameAndExpose(r, t) {
|
|
|
888
888
|
remote: o
|
|
889
889
|
};
|
|
890
890
|
}
|
|
891
|
-
const
|
|
892
|
-
let
|
|
893
|
-
if (o.alias &&
|
|
894
|
-
if (
|
|
895
|
-
const
|
|
896
|
-
return
|
|
897
|
-
pkgNameOrAlias:
|
|
898
|
-
expose:
|
|
891
|
+
const a = o.alias && t.startsWith(o.alias);
|
|
892
|
+
let c = o.alias && t.replace(o.alias, "");
|
|
893
|
+
if (o.alias && a) {
|
|
894
|
+
if (c && c.startsWith("/")) {
|
|
895
|
+
const i = o.alias;
|
|
896
|
+
return c = `.${c}`, {
|
|
897
|
+
pkgNameOrAlias: i,
|
|
898
|
+
expose: c,
|
|
899
899
|
remote: o
|
|
900
900
|
};
|
|
901
|
-
} else if (
|
|
901
|
+
} else if (c === "")
|
|
902
902
|
return {
|
|
903
903
|
pkgNameOrAlias: o.alias,
|
|
904
904
|
expose: ".",
|
|
@@ -922,10 +922,10 @@ function registerPlugins(r, t) {
|
|
|
922
922
|
t.bridgeHook
|
|
923
923
|
];
|
|
924
924
|
return o.length > 0 && o.forEach((s) => {
|
|
925
|
-
r != null && r.find((
|
|
925
|
+
r != null && r.find((a) => a.name !== s.name) && r.push(s);
|
|
926
926
|
}), r && r.length > 0 && r.forEach((s) => {
|
|
927
|
-
n.forEach((
|
|
928
|
-
|
|
927
|
+
n.forEach((a) => {
|
|
928
|
+
a.applyPlugin(s, t);
|
|
929
929
|
});
|
|
930
930
|
}), r;
|
|
931
931
|
}
|
|
@@ -964,27 +964,27 @@ function handleRemoteEntryLoaded(r, t, o) {
|
|
|
964
964
|
})), s;
|
|
965
965
|
}
|
|
966
966
|
async function loadEntryScript({ name: r, globalName: t, entry: o, loaderHook: n, getEntryUrl: s }) {
|
|
967
|
-
const { entryExports:
|
|
968
|
-
if (
|
|
969
|
-
return
|
|
970
|
-
const
|
|
971
|
-
return loadScript(
|
|
967
|
+
const { entryExports: a } = getRemoteEntryExports(r, t);
|
|
968
|
+
if (a)
|
|
969
|
+
return a;
|
|
970
|
+
const c = s ? s(o) : o;
|
|
971
|
+
return loadScript(c, {
|
|
972
972
|
attrs: {},
|
|
973
|
-
createScriptHook: (
|
|
974
|
-
const u = n.lifecycle.createScript.emit({ url:
|
|
973
|
+
createScriptHook: (i, l) => {
|
|
974
|
+
const u = n.lifecycle.createScript.emit({ url: i, attrs: l });
|
|
975
975
|
if (u && (u instanceof HTMLScriptElement || "script" in u || "timeout" in u))
|
|
976
976
|
return u;
|
|
977
977
|
}
|
|
978
|
-
}).then(() => handleRemoteEntryLoaded(r, t, o)).catch((
|
|
978
|
+
}).then(() => handleRemoteEntryLoaded(r, t, o)).catch((i) => {
|
|
979
979
|
throw assert(void 0, getShortErrorMsg(RUNTIME_008, runtimeDescMap, {
|
|
980
980
|
remoteName: r,
|
|
981
981
|
resourceUrl: o
|
|
982
|
-
})),
|
|
982
|
+
})), i;
|
|
983
983
|
});
|
|
984
984
|
}
|
|
985
985
|
async function loadEntryDom({ remoteInfo: r, remoteEntryExports: t, loaderHook: o, getEntryUrl: n }) {
|
|
986
|
-
const { entry: s, entryGlobalName:
|
|
987
|
-
switch (
|
|
986
|
+
const { entry: s, entryGlobalName: a, name: c, type: i } = r;
|
|
987
|
+
switch (i) {
|
|
988
988
|
case "esm":
|
|
989
989
|
case "module":
|
|
990
990
|
return loadEsmEntry({ entry: s, remoteEntryExports: t });
|
|
@@ -993,26 +993,26 @@ async function loadEntryDom({ remoteInfo: r, remoteEntryExports: t, loaderHook:
|
|
|
993
993
|
default:
|
|
994
994
|
return loadEntryScript({
|
|
995
995
|
entry: s,
|
|
996
|
-
globalName:
|
|
997
|
-
name:
|
|
996
|
+
globalName: a,
|
|
997
|
+
name: c,
|
|
998
998
|
loaderHook: o,
|
|
999
999
|
getEntryUrl: n
|
|
1000
1000
|
});
|
|
1001
1001
|
}
|
|
1002
1002
|
}
|
|
1003
1003
|
async function loadEntryNode({ remoteInfo: r, loaderHook: t }) {
|
|
1004
|
-
const { entry: o, entryGlobalName: n, name: s, type:
|
|
1005
|
-
return
|
|
1006
|
-
attrs: { name: s, globalName: n, type:
|
|
1004
|
+
const { entry: o, entryGlobalName: n, name: s, type: a } = r, { entryExports: c } = getRemoteEntryExports(s, n);
|
|
1005
|
+
return c || loadScriptNode(o, {
|
|
1006
|
+
attrs: { name: s, globalName: n, type: a },
|
|
1007
1007
|
loaderHook: {
|
|
1008
|
-
createScriptHook: (
|
|
1009
|
-
const u = t.lifecycle.createScript.emit({ url:
|
|
1008
|
+
createScriptHook: (i, l = {}) => {
|
|
1009
|
+
const u = t.lifecycle.createScript.emit({ url: i, attrs: l });
|
|
1010
1010
|
if (u && "url" in u)
|
|
1011
1011
|
return u;
|
|
1012
1012
|
}
|
|
1013
1013
|
}
|
|
1014
|
-
}).then(() => handleRemoteEntryLoaded(s, n, o)).catch((
|
|
1015
|
-
throw
|
|
1014
|
+
}).then(() => handleRemoteEntryLoaded(s, n, o)).catch((i) => {
|
|
1015
|
+
throw i;
|
|
1016
1016
|
});
|
|
1017
1017
|
}
|
|
1018
1018
|
function getRemoteEntryUniqueKey(r) {
|
|
@@ -1020,12 +1020,12 @@ function getRemoteEntryUniqueKey(r) {
|
|
|
1020
1020
|
return composeKeyWithSeparator(o, t);
|
|
1021
1021
|
}
|
|
1022
1022
|
async function getRemoteEntry(r) {
|
|
1023
|
-
const { origin: t, remoteEntryExports: o, remoteInfo: n, getEntryUrl: s, _inErrorHandling:
|
|
1023
|
+
const { origin: t, remoteEntryExports: o, remoteInfo: n, getEntryUrl: s, _inErrorHandling: a = !1 } = r, c = getRemoteEntryUniqueKey(n);
|
|
1024
1024
|
if (o)
|
|
1025
1025
|
return o;
|
|
1026
|
-
if (!globalLoading[
|
|
1027
|
-
const
|
|
1028
|
-
globalLoading[
|
|
1026
|
+
if (!globalLoading[c]) {
|
|
1027
|
+
const i = t.remoteHandler.hooks.lifecycle.loadEntry, l = t.loaderHook;
|
|
1028
|
+
globalLoading[c] = i.emit({
|
|
1029
1029
|
loaderHook: l,
|
|
1030
1030
|
remoteInfo: n,
|
|
1031
1031
|
remoteEntryExports: o
|
|
@@ -1035,15 +1035,15 @@ async function getRemoteEntry(r) {
|
|
|
1035
1035
|
loaderHook: l,
|
|
1036
1036
|
getEntryUrl: s
|
|
1037
1037
|
}) : loadEntryNode({ remoteInfo: n, loaderHook: l }))).catch(async (u) => {
|
|
1038
|
-
const
|
|
1039
|
-
if (u instanceof Error && u.message.includes(RUNTIME_008) && !
|
|
1040
|
-
const
|
|
1041
|
-
getRemoteEntry:
|
|
1038
|
+
const p = getRemoteEntryUniqueKey(n);
|
|
1039
|
+
if (u instanceof Error && u.message.includes(RUNTIME_008) && !a) {
|
|
1040
|
+
const d = (E) => getRemoteEntry({ ...E, _inErrorHandling: !0 }), y = await t.loaderHook.lifecycle.loadEntryError.emit({
|
|
1041
|
+
getRemoteEntry: d,
|
|
1042
1042
|
origin: t,
|
|
1043
1043
|
remoteInfo: n,
|
|
1044
1044
|
remoteEntryExports: o,
|
|
1045
1045
|
globalLoading,
|
|
1046
|
-
uniqueKey:
|
|
1046
|
+
uniqueKey: p
|
|
1047
1047
|
});
|
|
1048
1048
|
if (y)
|
|
1049
1049
|
return y;
|
|
@@ -1051,7 +1051,7 @@ async function getRemoteEntry(r) {
|
|
|
1051
1051
|
throw u;
|
|
1052
1052
|
});
|
|
1053
1053
|
}
|
|
1054
|
-
return globalLoading[
|
|
1054
|
+
return globalLoading[c];
|
|
1055
1055
|
}
|
|
1056
1056
|
function getRemoteInfo(r) {
|
|
1057
1057
|
return {
|
|
@@ -1087,10 +1087,10 @@ function normalizePreloadExposes(r) {
|
|
|
1087
1087
|
return r ? r.map((t) => t === "." ? t : t.startsWith("./") ? t.replace("./", "") : t) : [];
|
|
1088
1088
|
}
|
|
1089
1089
|
function preloadAssets(r, t, o, n = !0) {
|
|
1090
|
-
const { cssAssets: s, jsAssetsWithoutEntry:
|
|
1090
|
+
const { cssAssets: s, jsAssetsWithoutEntry: a, entryAssets: c } = o;
|
|
1091
1091
|
if (t.options.inBrowser) {
|
|
1092
|
-
if (
|
|
1093
|
-
const { moduleInfo: l } =
|
|
1092
|
+
if (c.forEach((i) => {
|
|
1093
|
+
const { moduleInfo: l } = i, u = t.moduleCache.get(r.name);
|
|
1094
1094
|
getRemoteEntry(u ? {
|
|
1095
1095
|
origin: t,
|
|
1096
1096
|
remoteInfo: l,
|
|
@@ -1101,95 +1101,95 @@ function preloadAssets(r, t, o, n = !0) {
|
|
|
1101
1101
|
remoteEntryExports: void 0
|
|
1102
1102
|
});
|
|
1103
1103
|
}), n) {
|
|
1104
|
-
const
|
|
1104
|
+
const i = {
|
|
1105
1105
|
rel: "preload",
|
|
1106
1106
|
as: "style"
|
|
1107
1107
|
};
|
|
1108
1108
|
s.forEach((l) => {
|
|
1109
|
-
const { link: u, needAttach:
|
|
1109
|
+
const { link: u, needAttach: p } = createLink({
|
|
1110
1110
|
url: l,
|
|
1111
1111
|
cb: () => {
|
|
1112
1112
|
},
|
|
1113
|
-
attrs:
|
|
1114
|
-
createLinkHook: (
|
|
1113
|
+
attrs: i,
|
|
1114
|
+
createLinkHook: (m, d) => {
|
|
1115
1115
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1116
|
-
url:
|
|
1117
|
-
attrs:
|
|
1116
|
+
url: m,
|
|
1117
|
+
attrs: d
|
|
1118
1118
|
});
|
|
1119
1119
|
if (y instanceof HTMLLinkElement)
|
|
1120
1120
|
return y;
|
|
1121
1121
|
}
|
|
1122
1122
|
});
|
|
1123
|
-
|
|
1123
|
+
p && document.head.appendChild(u);
|
|
1124
1124
|
});
|
|
1125
1125
|
} else {
|
|
1126
|
-
const
|
|
1126
|
+
const i = {
|
|
1127
1127
|
rel: "stylesheet",
|
|
1128
1128
|
type: "text/css"
|
|
1129
1129
|
};
|
|
1130
1130
|
s.forEach((l) => {
|
|
1131
|
-
const { link: u, needAttach:
|
|
1131
|
+
const { link: u, needAttach: p } = createLink({
|
|
1132
1132
|
url: l,
|
|
1133
1133
|
cb: () => {
|
|
1134
1134
|
},
|
|
1135
|
-
attrs:
|
|
1136
|
-
createLinkHook: (
|
|
1135
|
+
attrs: i,
|
|
1136
|
+
createLinkHook: (m, d) => {
|
|
1137
1137
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1138
|
-
url:
|
|
1139
|
-
attrs:
|
|
1138
|
+
url: m,
|
|
1139
|
+
attrs: d
|
|
1140
1140
|
});
|
|
1141
1141
|
if (y instanceof HTMLLinkElement)
|
|
1142
1142
|
return y;
|
|
1143
1143
|
},
|
|
1144
1144
|
needDeleteLink: !1
|
|
1145
1145
|
});
|
|
1146
|
-
|
|
1146
|
+
p && document.head.appendChild(u);
|
|
1147
1147
|
});
|
|
1148
1148
|
}
|
|
1149
1149
|
if (n) {
|
|
1150
|
-
const
|
|
1150
|
+
const i = {
|
|
1151
1151
|
rel: "preload",
|
|
1152
1152
|
as: "script"
|
|
1153
1153
|
};
|
|
1154
|
-
|
|
1155
|
-
const { link: u, needAttach:
|
|
1154
|
+
a.forEach((l) => {
|
|
1155
|
+
const { link: u, needAttach: p } = createLink({
|
|
1156
1156
|
url: l,
|
|
1157
1157
|
cb: () => {
|
|
1158
1158
|
},
|
|
1159
|
-
attrs:
|
|
1160
|
-
createLinkHook: (
|
|
1159
|
+
attrs: i,
|
|
1160
|
+
createLinkHook: (m, d) => {
|
|
1161
1161
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1162
|
-
url:
|
|
1163
|
-
attrs:
|
|
1162
|
+
url: m,
|
|
1163
|
+
attrs: d
|
|
1164
1164
|
});
|
|
1165
1165
|
if (y instanceof HTMLLinkElement)
|
|
1166
1166
|
return y;
|
|
1167
1167
|
}
|
|
1168
1168
|
});
|
|
1169
|
-
|
|
1169
|
+
p && document.head.appendChild(u);
|
|
1170
1170
|
});
|
|
1171
1171
|
} else {
|
|
1172
|
-
const
|
|
1172
|
+
const i = {
|
|
1173
1173
|
fetchpriority: "high",
|
|
1174
1174
|
type: (r == null ? void 0 : r.type) === "module" ? "module" : "text/javascript"
|
|
1175
1175
|
};
|
|
1176
|
-
|
|
1177
|
-
const { script: u, needAttach:
|
|
1176
|
+
a.forEach((l) => {
|
|
1177
|
+
const { script: u, needAttach: p } = createScript({
|
|
1178
1178
|
url: l,
|
|
1179
1179
|
cb: () => {
|
|
1180
1180
|
},
|
|
1181
|
-
attrs:
|
|
1182
|
-
createScriptHook: (
|
|
1181
|
+
attrs: i,
|
|
1182
|
+
createScriptHook: (m, d) => {
|
|
1183
1183
|
const y = t.loaderHook.lifecycle.createScript.emit({
|
|
1184
|
-
url:
|
|
1185
|
-
attrs:
|
|
1184
|
+
url: m,
|
|
1185
|
+
attrs: d
|
|
1186
1186
|
});
|
|
1187
1187
|
if (y instanceof HTMLScriptElement)
|
|
1188
1188
|
return y;
|
|
1189
1189
|
},
|
|
1190
1190
|
needDeleteScript: !0
|
|
1191
1191
|
});
|
|
1192
|
-
|
|
1192
|
+
p && document.head.appendChild(u);
|
|
1193
1193
|
});
|
|
1194
1194
|
}
|
|
1195
1195
|
}
|
|
@@ -1211,55 +1211,55 @@ class Module {
|
|
|
1211
1211
|
}
|
|
1212
1212
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1213
1213
|
async get(t, o, n, s) {
|
|
1214
|
-
const { loadFactory:
|
|
1214
|
+
const { loadFactory: a = !0 } = n || { loadFactory: !0 }, c = await this.getEntry();
|
|
1215
1215
|
if (!this.inited) {
|
|
1216
|
-
const
|
|
1217
|
-
|
|
1218
|
-
|
|
1216
|
+
const m = this.host.shareScopeMap, d = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [this.remoteInfo.shareScope];
|
|
1217
|
+
d.length || d.push("default"), d.forEach((b) => {
|
|
1218
|
+
m[b] || (m[b] = {});
|
|
1219
1219
|
});
|
|
1220
|
-
const y =
|
|
1220
|
+
const y = m[d[0]], E = [], R = {
|
|
1221
1221
|
version: this.remoteInfo.version || "",
|
|
1222
|
-
shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ?
|
|
1222
|
+
shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? d : this.remoteInfo.shareScope || "default"
|
|
1223
1223
|
};
|
|
1224
1224
|
Object.defineProperty(R, "shareScopeMap", {
|
|
1225
|
-
value:
|
|
1225
|
+
value: m,
|
|
1226
1226
|
// remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
|
|
1227
1227
|
enumerable: !1
|
|
1228
1228
|
});
|
|
1229
|
-
const
|
|
1229
|
+
const g = await this.host.hooks.lifecycle.beforeInitContainer.emit({
|
|
1230
1230
|
shareScope: y,
|
|
1231
1231
|
// @ts-ignore shareScopeMap will be set by Object.defineProperty
|
|
1232
1232
|
remoteEntryInitOptions: R,
|
|
1233
|
-
initScope:
|
|
1233
|
+
initScope: E,
|
|
1234
1234
|
remoteInfo: this.remoteInfo,
|
|
1235
1235
|
origin: this.host
|
|
1236
1236
|
});
|
|
1237
|
-
typeof (
|
|
1237
|
+
typeof (c == null ? void 0 : c.init) > "u" && error(getShortErrorMsg(RUNTIME_002, runtimeDescMap, {
|
|
1238
1238
|
hostName: this.host.name,
|
|
1239
1239
|
remoteName: this.remoteInfo.name,
|
|
1240
1240
|
remoteEntryUrl: this.remoteInfo.entry,
|
|
1241
1241
|
remoteEntryKey: this.remoteInfo.entryGlobalName
|
|
1242
|
-
})), await
|
|
1243
|
-
...
|
|
1242
|
+
})), await c.init(g.shareScope, g.initScope, g.remoteEntryInitOptions), await this.host.hooks.lifecycle.initContainer.emit({
|
|
1243
|
+
...g,
|
|
1244
1244
|
id: t,
|
|
1245
1245
|
remoteSnapshot: s,
|
|
1246
|
-
remoteEntryExports:
|
|
1246
|
+
remoteEntryExports: c
|
|
1247
1247
|
});
|
|
1248
1248
|
}
|
|
1249
|
-
this.lib =
|
|
1250
|
-
let
|
|
1251
|
-
|
|
1252
|
-
remoteEntryExports:
|
|
1249
|
+
this.lib = c, this.inited = !0;
|
|
1250
|
+
let i;
|
|
1251
|
+
i = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
1252
|
+
remoteEntryExports: c,
|
|
1253
1253
|
expose: o,
|
|
1254
1254
|
moduleInfo: this.remoteInfo
|
|
1255
|
-
}),
|
|
1256
|
-
const l = processModuleAlias(this.remoteInfo.name, o), u = this.wraperFactory(
|
|
1257
|
-
return
|
|
1255
|
+
}), i || (i = await c.get(o)), assert(i, `${getFMId(this.remoteInfo)} remote don't export ${o}.`);
|
|
1256
|
+
const l = processModuleAlias(this.remoteInfo.name, o), u = this.wraperFactory(i, l);
|
|
1257
|
+
return a ? await u() : u;
|
|
1258
1258
|
}
|
|
1259
1259
|
wraperFactory(t, o) {
|
|
1260
|
-
function n(s,
|
|
1260
|
+
function n(s, a) {
|
|
1261
1261
|
s && typeof s == "object" && Object.isExtensible(s) && !Object.getOwnPropertyDescriptor(s, Symbol.for("mf_module_id")) && Object.defineProperty(s, Symbol.for("mf_module_id"), {
|
|
1262
|
-
value:
|
|
1262
|
+
value: a,
|
|
1263
1263
|
enumerable: !1
|
|
1264
1264
|
});
|
|
1265
1265
|
}
|
|
@@ -1304,8 +1304,8 @@ class AsyncHook extends SyncHook {
|
|
|
1304
1304
|
const n = Array.from(this.listeners);
|
|
1305
1305
|
if (n.length > 0) {
|
|
1306
1306
|
let s = 0;
|
|
1307
|
-
const
|
|
1308
|
-
o =
|
|
1307
|
+
const a = (c) => c === !1 ? !1 : s < n.length ? Promise.resolve(n[s++].apply(null, t)).then(a) : c;
|
|
1308
|
+
o = a();
|
|
1309
1309
|
}
|
|
1310
1310
|
return Promise.resolve(o);
|
|
1311
1311
|
}
|
|
@@ -1350,19 +1350,19 @@ class AsyncWaterfallHook extends SyncHook {
|
|
|
1350
1350
|
const o = Array.from(this.listeners);
|
|
1351
1351
|
if (o.length > 0) {
|
|
1352
1352
|
let n = 0;
|
|
1353
|
-
const s = (
|
|
1354
|
-
if (checkReturnData(t,
|
|
1355
|
-
if (t =
|
|
1353
|
+
const s = (c) => (warn(c), this.onerror(c), t), a = (c) => {
|
|
1354
|
+
if (checkReturnData(t, c)) {
|
|
1355
|
+
if (t = c, n < o.length)
|
|
1356
1356
|
try {
|
|
1357
|
-
return Promise.resolve(o[n++](t)).then(
|
|
1358
|
-
} catch (
|
|
1359
|
-
return s(
|
|
1357
|
+
return Promise.resolve(o[n++](t)).then(a, s);
|
|
1358
|
+
} catch (i) {
|
|
1359
|
+
return s(i);
|
|
1360
1360
|
}
|
|
1361
1361
|
} else
|
|
1362
1362
|
this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
|
|
1363
1363
|
return t;
|
|
1364
1364
|
};
|
|
1365
|
-
return Promise.resolve(
|
|
1365
|
+
return Promise.resolve(a(t));
|
|
1366
1366
|
}
|
|
1367
1367
|
return Promise.resolve(t);
|
|
1368
1368
|
}
|
|
@@ -1375,9 +1375,9 @@ class PluginSystem {
|
|
|
1375
1375
|
var s;
|
|
1376
1376
|
assert(isPlainObject(t), "Plugin configuration is invalid.");
|
|
1377
1377
|
const n = t.name;
|
|
1378
|
-
assert(n, "A name must be provided by the plugin."), this.registerPlugins[n] || (this.registerPlugins[n] = t, (s = t.apply) == null || s.call(t, o), Object.keys(this.lifecycle).forEach((
|
|
1379
|
-
const
|
|
1380
|
-
|
|
1378
|
+
assert(n, "A name must be provided by the plugin."), this.registerPlugins[n] || (this.registerPlugins[n] = t, (s = t.apply) == null || s.call(t, o), Object.keys(this.lifecycle).forEach((a) => {
|
|
1379
|
+
const c = t[a];
|
|
1380
|
+
c && this.lifecycle[a].on(c);
|
|
1381
1381
|
}));
|
|
1382
1382
|
}
|
|
1383
1383
|
removePlugin(t) {
|
|
@@ -1398,13 +1398,13 @@ function snapshotPlugin() {
|
|
|
1398
1398
|
return {
|
|
1399
1399
|
name: "snapshot-plugin",
|
|
1400
1400
|
async afterResolve(r) {
|
|
1401
|
-
const { remote: t, pkgNameOrAlias: o, expose: n, origin: s, remoteInfo:
|
|
1401
|
+
const { remote: t, pkgNameOrAlias: o, expose: n, origin: s, remoteInfo: a, id: c } = r;
|
|
1402
1402
|
if (!isRemoteInfoWithEntry(t) || !isPureRemoteEntry(t)) {
|
|
1403
|
-
const { remoteSnapshot:
|
|
1403
|
+
const { remoteSnapshot: i, globalSnapshot: l } = await s.snapshotHandler.loadRemoteSnapshotInfo({
|
|
1404
1404
|
moduleInfo: t,
|
|
1405
|
-
id:
|
|
1405
|
+
id: c
|
|
1406
1406
|
});
|
|
1407
|
-
assignRemoteInfo(
|
|
1407
|
+
assignRemoteInfo(a, i);
|
|
1408
1408
|
const u = {
|
|
1409
1409
|
remote: t,
|
|
1410
1410
|
preloadConfig: {
|
|
@@ -1414,17 +1414,17 @@ function snapshotPlugin() {
|
|
|
1414
1414
|
share: !1,
|
|
1415
1415
|
depsRemote: !1
|
|
1416
1416
|
}
|
|
1417
|
-
},
|
|
1417
|
+
}, p = await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
|
|
1418
1418
|
origin: s,
|
|
1419
1419
|
preloadOptions: u,
|
|
1420
|
-
remoteInfo:
|
|
1420
|
+
remoteInfo: a,
|
|
1421
1421
|
remote: t,
|
|
1422
|
-
remoteSnapshot:
|
|
1422
|
+
remoteSnapshot: i,
|
|
1423
1423
|
globalSnapshot: l
|
|
1424
1424
|
});
|
|
1425
|
-
return
|
|
1425
|
+
return p && preloadAssets(a, s, p, !1), {
|
|
1426
1426
|
...r,
|
|
1427
|
-
remoteSnapshot:
|
|
1427
|
+
remoteSnapshot: i
|
|
1428
1428
|
};
|
|
1429
1429
|
}
|
|
1430
1430
|
return r;
|
|
@@ -1444,57 +1444,57 @@ function splitId(r) {
|
|
|
1444
1444
|
version: t[2]
|
|
1445
1445
|
};
|
|
1446
1446
|
}
|
|
1447
|
-
function traverseModuleInfo(r, t, o, n, s = {},
|
|
1448
|
-
const
|
|
1447
|
+
function traverseModuleInfo(r, t, o, n, s = {}, a) {
|
|
1448
|
+
const c = getFMId(t), { value: i } = getInfoWithoutType(r, c), l = a || i;
|
|
1449
1449
|
if (l && !isManifestProvider(l) && (o(l, t, n), l.remotesInfo)) {
|
|
1450
1450
|
const u = Object.keys(l.remotesInfo);
|
|
1451
|
-
for (const
|
|
1452
|
-
if (s[
|
|
1451
|
+
for (const p of u) {
|
|
1452
|
+
if (s[p])
|
|
1453
1453
|
continue;
|
|
1454
|
-
s[
|
|
1455
|
-
const
|
|
1454
|
+
s[p] = !0;
|
|
1455
|
+
const m = splitId(p), d = l.remotesInfo[p];
|
|
1456
1456
|
traverseModuleInfo(r, {
|
|
1457
|
-
name:
|
|
1458
|
-
version:
|
|
1457
|
+
name: m.name,
|
|
1458
|
+
version: d.matchedVersion
|
|
1459
1459
|
}, o, !1, s, void 0);
|
|
1460
1460
|
}
|
|
1461
1461
|
}
|
|
1462
1462
|
}
|
|
1463
1463
|
const isExisted = (r, t) => document.querySelector(`${r}[${r === "link" ? "href" : "src"}="${t}"]`);
|
|
1464
1464
|
function generatePreloadAssets(r, t, o, n, s) {
|
|
1465
|
-
const
|
|
1466
|
-
if (traverseModuleInfo(n, o, (
|
|
1465
|
+
const a = [], c = [], i = [], l = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: p } = r, { preloadConfig: m } = t, { depsRemote: d } = m;
|
|
1466
|
+
if (traverseModuleInfo(n, o, (g, b, I) => {
|
|
1467
1467
|
var $;
|
|
1468
1468
|
let S;
|
|
1469
1469
|
if (I)
|
|
1470
|
-
S =
|
|
1471
|
-
else if (Array.isArray(
|
|
1472
|
-
const M =
|
|
1470
|
+
S = m;
|
|
1471
|
+
else if (Array.isArray(d)) {
|
|
1472
|
+
const M = d.find((N) => N.nameOrAlias === b.name || N.nameOrAlias === b.alias);
|
|
1473
1473
|
if (!M)
|
|
1474
1474
|
return;
|
|
1475
1475
|
S = defaultPreloadArgs(M);
|
|
1476
|
-
} else if (
|
|
1477
|
-
S =
|
|
1476
|
+
} else if (d === !0)
|
|
1477
|
+
S = m;
|
|
1478
1478
|
else
|
|
1479
1479
|
return;
|
|
1480
|
-
const T = getResourceUrl(
|
|
1481
|
-
T &&
|
|
1480
|
+
const T = getResourceUrl(g, getRemoteEntryInfoFromSnapshot(g).url);
|
|
1481
|
+
T && i.push({
|
|
1482
1482
|
name: b.name,
|
|
1483
1483
|
moduleInfo: {
|
|
1484
1484
|
name: b.name,
|
|
1485
1485
|
entry: T,
|
|
1486
|
-
type: "remoteEntryType" in
|
|
1487
|
-
entryGlobalName: "globalName" in
|
|
1486
|
+
type: "remoteEntryType" in g ? g.remoteEntryType : "global",
|
|
1487
|
+
entryGlobalName: "globalName" in g ? g.globalName : b.name,
|
|
1488
1488
|
shareScope: "",
|
|
1489
|
-
version: "version" in
|
|
1489
|
+
version: "version" in g ? g.version : void 0
|
|
1490
1490
|
},
|
|
1491
1491
|
url: T
|
|
1492
1492
|
});
|
|
1493
|
-
let _ = "modules" in
|
|
1493
|
+
let _ = "modules" in g ? g.modules : [];
|
|
1494
1494
|
const A = normalizePreloadExposes(S.exposes);
|
|
1495
|
-
A.length && "modules" in
|
|
1495
|
+
A.length && "modules" in g && (_ = ($ = g == null ? void 0 : g.modules) == null ? void 0 : $.reduce((M, N) => ((A == null ? void 0 : A.indexOf(N.moduleName)) !== -1 && M.push(N), M), []));
|
|
1496
1496
|
function w(M) {
|
|
1497
|
-
const N = M.map((P) => getResourceUrl(
|
|
1497
|
+
const N = M.map((P) => getResourceUrl(g, P));
|
|
1498
1498
|
return S.filter ? N.filter(S.filter) : N;
|
|
1499
1499
|
}
|
|
1500
1500
|
if (_) {
|
|
@@ -1504,15 +1504,15 @@ function generatePreloadAssets(r, t, o, n, s) {
|
|
|
1504
1504
|
r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
|
|
1505
1505
|
id: P.moduleName === "." ? b.name : L,
|
|
1506
1506
|
name: b.name,
|
|
1507
|
-
remoteSnapshot:
|
|
1507
|
+
remoteSnapshot: g,
|
|
1508
1508
|
preloadConfig: S,
|
|
1509
1509
|
remote: b,
|
|
1510
1510
|
origin: r
|
|
1511
|
-
}), !getPreloaded(L) && (S.resourceCategory === "all" ? (
|
|
1511
|
+
}), !getPreloaded(L) && (S.resourceCategory === "all" ? (a.push(...w(P.assets.css.async)), a.push(...w(P.assets.css.sync)), c.push(...w(P.assets.js.async)), c.push(...w(P.assets.js.sync))) : (S.resourceCategory = "sync") && (a.push(...w(P.assets.css.sync)), c.push(...w(P.assets.js.sync))), setPreloaded(L));
|
|
1512
1512
|
}
|
|
1513
1513
|
}
|
|
1514
1514
|
}, !0, {}, s), s.shared && s.shared.length > 0) {
|
|
1515
|
-
const
|
|
1515
|
+
const g = (b, I) => {
|
|
1516
1516
|
const S = getRegisteredShare(r.shareScopeMap, I.sharedName, b, r.sharedHandler.hooks.lifecycle.resolveShare);
|
|
1517
1517
|
S && typeof S.lib == "function" && (I.assets.js.sync.forEach((T) => {
|
|
1518
1518
|
l.add(T);
|
|
@@ -1522,29 +1522,29 @@ function generatePreloadAssets(r, t, o, n, s) {
|
|
|
1522
1522
|
};
|
|
1523
1523
|
s.shared.forEach((b) => {
|
|
1524
1524
|
var _;
|
|
1525
|
-
const I = (_ =
|
|
1525
|
+
const I = (_ = p.shared) == null ? void 0 : _[b.sharedName];
|
|
1526
1526
|
if (!I)
|
|
1527
1527
|
return;
|
|
1528
1528
|
const S = b.version ? I.find((A) => A.version === b.version) : I;
|
|
1529
1529
|
if (!S)
|
|
1530
1530
|
return;
|
|
1531
1531
|
arrayOptions(S).forEach((A) => {
|
|
1532
|
-
|
|
1532
|
+
g(A, b);
|
|
1533
1533
|
});
|
|
1534
1534
|
});
|
|
1535
1535
|
}
|
|
1536
|
-
const
|
|
1536
|
+
const E = c.filter((g) => !l.has(g) && !isExisted("script", g));
|
|
1537
1537
|
return {
|
|
1538
|
-
cssAssets:
|
|
1539
|
-
jsAssetsWithoutEntry:
|
|
1540
|
-
entryAssets:
|
|
1538
|
+
cssAssets: a.filter((g) => !u.has(g) && !isExisted("link", g)),
|
|
1539
|
+
jsAssetsWithoutEntry: E,
|
|
1540
|
+
entryAssets: i.filter((g) => !isExisted("script", g.url))
|
|
1541
1541
|
};
|
|
1542
1542
|
}
|
|
1543
1543
|
const generatePreloadAssetsPlugin = function() {
|
|
1544
1544
|
return {
|
|
1545
1545
|
name: "generate-preload-assets-plugin",
|
|
1546
1546
|
async generatePreloadAssets(r) {
|
|
1547
|
-
const { origin: t, preloadOptions: o, remoteInfo: n, remote: s, globalSnapshot:
|
|
1547
|
+
const { origin: t, preloadOptions: o, remoteInfo: n, remote: s, globalSnapshot: a, remoteSnapshot: c } = r;
|
|
1548
1548
|
return isBrowserEnv() ? isRemoteInfoWithEntry(s) && isPureRemoteEntry(s) ? {
|
|
1549
1549
|
cssAssets: [],
|
|
1550
1550
|
jsAssetsWithoutEntry: [],
|
|
@@ -1561,7 +1561,7 @@ const generatePreloadAssetsPlugin = function() {
|
|
|
1561
1561
|
}
|
|
1562
1562
|
}
|
|
1563
1563
|
]
|
|
1564
|
-
} : (assignRemoteInfo(n,
|
|
1564
|
+
} : (assignRemoteInfo(n, c), generatePreloadAssets(t, o, n, a, c)) : {
|
|
1565
1565
|
cssAssets: [],
|
|
1566
1566
|
jsAssetsWithoutEntry: [],
|
|
1567
1567
|
entryAssets: []
|
|
@@ -1606,39 +1606,39 @@ class SnapshotHandler {
|
|
|
1606
1606
|
options: s,
|
|
1607
1607
|
moduleInfo: t
|
|
1608
1608
|
});
|
|
1609
|
-
let
|
|
1609
|
+
let a = getGlobalSnapshotInfoByModuleInfo({
|
|
1610
1610
|
name: this.HostInstance.options.name,
|
|
1611
1611
|
version: this.HostInstance.options.version
|
|
1612
1612
|
});
|
|
1613
|
-
|
|
1613
|
+
a || (a = {
|
|
1614
1614
|
version: this.HostInstance.options.version || "",
|
|
1615
1615
|
remoteEntry: "",
|
|
1616
1616
|
remotesInfo: {}
|
|
1617
1617
|
}, addGlobalSnapshot({
|
|
1618
|
-
[this.HostInstance.options.name]:
|
|
1619
|
-
})),
|
|
1620
|
-
...
|
|
1618
|
+
[this.HostInstance.options.name]: a
|
|
1619
|
+
})), a && "remotesInfo" in a && !getInfoWithoutType(a.remotesInfo, t.name).value && ("version" in t || "entry" in t) && (a.remotesInfo = {
|
|
1620
|
+
...a == null ? void 0 : a.remotesInfo,
|
|
1621
1621
|
[t.name]: {
|
|
1622
1622
|
matchedVersion: "version" in t ? t.version : t.entry
|
|
1623
1623
|
}
|
|
1624
1624
|
});
|
|
1625
|
-
const { hostGlobalSnapshot:
|
|
1625
|
+
const { hostGlobalSnapshot: c, remoteSnapshot: i, globalSnapshot: l } = this.getGlobalRemoteInfo(t), { remoteSnapshot: u, globalSnapshot: p } = await this.hooks.lifecycle.loadSnapshot.emit({
|
|
1626
1626
|
options: s,
|
|
1627
1627
|
moduleInfo: t,
|
|
1628
|
-
hostGlobalSnapshot:
|
|
1629
|
-
remoteSnapshot:
|
|
1628
|
+
hostGlobalSnapshot: c,
|
|
1629
|
+
remoteSnapshot: i,
|
|
1630
1630
|
globalSnapshot: l
|
|
1631
1631
|
});
|
|
1632
|
-
let
|
|
1632
|
+
let m, d;
|
|
1633
1633
|
if (u)
|
|
1634
1634
|
if (isManifestProvider(u)) {
|
|
1635
|
-
const y = isBrowserEnv() ? u.remoteEntry : u.ssrRemoteEntry || u.remoteEntry || "",
|
|
1635
|
+
const y = isBrowserEnv() ? u.remoteEntry : u.ssrRemoteEntry || u.remoteEntry || "", E = await this.getManifestJson(y, t, {}), R = setGlobalSnapshotInfoByModuleInfo({
|
|
1636
1636
|
...t,
|
|
1637
1637
|
// The global remote may be overridden
|
|
1638
1638
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
1639
1639
|
entry: y
|
|
1640
|
-
},
|
|
1641
|
-
|
|
1640
|
+
}, E);
|
|
1641
|
+
m = E, d = R;
|
|
1642
1642
|
} else {
|
|
1643
1643
|
const { remoteSnapshot: y } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1644
1644
|
options: this.HostInstance.options,
|
|
@@ -1646,31 +1646,31 @@ class SnapshotHandler {
|
|
|
1646
1646
|
remoteSnapshot: u,
|
|
1647
1647
|
from: "global"
|
|
1648
1648
|
});
|
|
1649
|
-
|
|
1649
|
+
m = y, d = p;
|
|
1650
1650
|
}
|
|
1651
1651
|
else if (isRemoteInfoWithEntry(t)) {
|
|
1652
|
-
const y = await this.getManifestJson(t.entry, t, {}),
|
|
1652
|
+
const y = await this.getManifestJson(t.entry, t, {}), E = setGlobalSnapshotInfoByModuleInfo(t, y), { remoteSnapshot: R } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1653
1653
|
options: this.HostInstance.options,
|
|
1654
1654
|
moduleInfo: t,
|
|
1655
1655
|
remoteSnapshot: y,
|
|
1656
1656
|
from: "global"
|
|
1657
1657
|
});
|
|
1658
|
-
|
|
1658
|
+
m = R, d = E;
|
|
1659
1659
|
} else
|
|
1660
1660
|
error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
|
|
1661
1661
|
hostName: t.name,
|
|
1662
1662
|
hostVersion: t.version,
|
|
1663
|
-
globalSnapshot: JSON.stringify(
|
|
1663
|
+
globalSnapshot: JSON.stringify(p)
|
|
1664
1664
|
}));
|
|
1665
1665
|
return await this.hooks.lifecycle.afterLoadSnapshot.emit({
|
|
1666
1666
|
id: o,
|
|
1667
1667
|
host: this.HostInstance,
|
|
1668
1668
|
options: s,
|
|
1669
1669
|
moduleInfo: t,
|
|
1670
|
-
remoteSnapshot:
|
|
1670
|
+
remoteSnapshot: m
|
|
1671
1671
|
}), {
|
|
1672
|
-
remoteSnapshot:
|
|
1673
|
-
globalSnapshot:
|
|
1672
|
+
remoteSnapshot: m,
|
|
1673
|
+
globalSnapshot: d
|
|
1674
1674
|
};
|
|
1675
1675
|
}
|
|
1676
1676
|
getGlobalRemoteInfo(t) {
|
|
@@ -1678,40 +1678,40 @@ class SnapshotHandler {
|
|
|
1678
1678
|
}
|
|
1679
1679
|
async getManifestJson(t, o, n) {
|
|
1680
1680
|
const s = async () => {
|
|
1681
|
-
let
|
|
1682
|
-
if (
|
|
1683
|
-
return
|
|
1681
|
+
let c = this.manifestCache.get(t);
|
|
1682
|
+
if (c)
|
|
1683
|
+
return c;
|
|
1684
1684
|
try {
|
|
1685
|
-
let
|
|
1686
|
-
(!
|
|
1687
|
-
} catch (
|
|
1688
|
-
|
|
1685
|
+
let i = await this.loaderHook.lifecycle.fetch.emit(t, {});
|
|
1686
|
+
(!i || !(i instanceof Response)) && (i = await fetch(t, {})), c = await i.json();
|
|
1687
|
+
} catch (i) {
|
|
1688
|
+
c = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
1689
1689
|
id: t,
|
|
1690
|
-
error:
|
|
1690
|
+
error: i,
|
|
1691
1691
|
from: "runtime",
|
|
1692
1692
|
lifecycle: "afterResolve",
|
|
1693
1693
|
origin: this.HostInstance
|
|
1694
|
-
}),
|
|
1694
|
+
}), c || (delete this.manifestLoading[t], error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
|
|
1695
1695
|
manifestUrl: t,
|
|
1696
1696
|
moduleName: o.name,
|
|
1697
1697
|
hostName: this.HostInstance.options.name
|
|
1698
|
-
}, `${
|
|
1698
|
+
}, `${i}`)));
|
|
1699
1699
|
}
|
|
1700
|
-
return assert(
|
|
1701
|
-
},
|
|
1702
|
-
const
|
|
1700
|
+
return assert(c.metaData && c.exposes && c.shared, `${t} is not a federation manifest`), this.manifestCache.set(t, c), c;
|
|
1701
|
+
}, a = async () => {
|
|
1702
|
+
const c = await s(), i = generateSnapshotFromManifest(c, {
|
|
1703
1703
|
version: t
|
|
1704
1704
|
}), { remoteSnapshot: l } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1705
1705
|
options: this.HostInstance.options,
|
|
1706
1706
|
moduleInfo: o,
|
|
1707
|
-
manifestJson:
|
|
1708
|
-
remoteSnapshot:
|
|
1707
|
+
manifestJson: c,
|
|
1708
|
+
remoteSnapshot: i,
|
|
1709
1709
|
manifestUrl: t,
|
|
1710
1710
|
from: "manifest"
|
|
1711
1711
|
});
|
|
1712
1712
|
return l;
|
|
1713
1713
|
};
|
|
1714
|
-
return this.manifestLoading[t] || (this.manifestLoading[t] =
|
|
1714
|
+
return this.manifestLoading[t] || (this.manifestLoading[t] = a().then((c) => c)), this.manifestLoading[t];
|
|
1715
1715
|
}
|
|
1716
1716
|
}
|
|
1717
1717
|
class SharedHandler {
|
|
@@ -1729,10 +1729,10 @@ class SharedHandler {
|
|
|
1729
1729
|
// register shared in shareScopeMap
|
|
1730
1730
|
registerShared(t, o) {
|
|
1731
1731
|
const { shareInfos: n, shared: s } = formatShareConfigs(t, o);
|
|
1732
|
-
return Object.keys(n).forEach((
|
|
1733
|
-
n[
|
|
1734
|
-
!getRegisteredShare(this.shareScopeMap,
|
|
1735
|
-
pkgName:
|
|
1732
|
+
return Object.keys(n).forEach((c) => {
|
|
1733
|
+
n[c].forEach((l) => {
|
|
1734
|
+
!getRegisteredShare(this.shareScopeMap, c, l, this.hooks.lifecycle.resolveShare) && l && l.lib && this.setShared({
|
|
1735
|
+
pkgName: c,
|
|
1736
1736
|
lib: l.lib,
|
|
1737
1737
|
get: l.get,
|
|
1738
1738
|
loaded: !0,
|
|
@@ -1756,51 +1756,51 @@ class SharedHandler {
|
|
|
1756
1756
|
strategy: s.strategy
|
|
1757
1757
|
}));
|
|
1758
1758
|
}));
|
|
1759
|
-
const
|
|
1759
|
+
const a = await this.hooks.lifecycle.beforeLoadShare.emit({
|
|
1760
1760
|
pkgName: t,
|
|
1761
1761
|
shareInfo: s,
|
|
1762
1762
|
shared: n.options.shared,
|
|
1763
1763
|
origin: n
|
|
1764
|
-
}), { shareInfo:
|
|
1765
|
-
assert(
|
|
1766
|
-
const
|
|
1764
|
+
}), { shareInfo: c } = a;
|
|
1765
|
+
assert(c, `Cannot find ${t} Share in the ${n.options.name}. Please ensure that the ${t} Share parameters have been injected`);
|
|
1766
|
+
const i = getRegisteredShare(this.shareScopeMap, t, c, this.hooks.lifecycle.resolveShare), l = (u) => {
|
|
1767
1767
|
u.useIn || (u.useIn = []), addUniqueItem(u.useIn, n.options.name);
|
|
1768
1768
|
};
|
|
1769
|
-
if (
|
|
1770
|
-
return l(
|
|
1771
|
-
if (
|
|
1772
|
-
const u = await
|
|
1773
|
-
return
|
|
1774
|
-
} else if (
|
|
1775
|
-
const
|
|
1776
|
-
const
|
|
1777
|
-
return l(
|
|
1769
|
+
if (i && i.lib)
|
|
1770
|
+
return l(i), i.lib;
|
|
1771
|
+
if (i && i.loading && !i.loaded) {
|
|
1772
|
+
const u = await i.loading;
|
|
1773
|
+
return i.loaded = !0, i.lib || (i.lib = u), l(i), u;
|
|
1774
|
+
} else if (i) {
|
|
1775
|
+
const p = (async () => {
|
|
1776
|
+
const m = await i.get();
|
|
1777
|
+
return l(i), i.loaded = !0, i.lib = m, m;
|
|
1778
1778
|
})();
|
|
1779
1779
|
return this.setShared({
|
|
1780
1780
|
pkgName: t,
|
|
1781
1781
|
loaded: !1,
|
|
1782
|
-
shared:
|
|
1782
|
+
shared: i,
|
|
1783
1783
|
from: n.options.name,
|
|
1784
1784
|
lib: null,
|
|
1785
|
-
loading:
|
|
1786
|
-
}),
|
|
1785
|
+
loading: p
|
|
1786
|
+
}), p;
|
|
1787
1787
|
} else {
|
|
1788
1788
|
if (o != null && o.customShareInfo)
|
|
1789
1789
|
return !1;
|
|
1790
|
-
const
|
|
1791
|
-
const
|
|
1792
|
-
|
|
1793
|
-
const
|
|
1794
|
-
return
|
|
1790
|
+
const p = (async () => {
|
|
1791
|
+
const m = await c.get();
|
|
1792
|
+
c.lib = m, c.loaded = !0, l(c);
|
|
1793
|
+
const d = getRegisteredShare(this.shareScopeMap, t, c, this.hooks.lifecycle.resolveShare);
|
|
1794
|
+
return d && (d.lib = m, d.loaded = !0, d.from = c.from), m;
|
|
1795
1795
|
})();
|
|
1796
1796
|
return this.setShared({
|
|
1797
1797
|
pkgName: t,
|
|
1798
1798
|
loaded: !1,
|
|
1799
|
-
shared:
|
|
1799
|
+
shared: c,
|
|
1800
1800
|
from: n.options.name,
|
|
1801
1801
|
lib: null,
|
|
1802
|
-
loading:
|
|
1803
|
-
}),
|
|
1802
|
+
loading: p
|
|
1803
|
+
}), p;
|
|
1804
1804
|
}
|
|
1805
1805
|
}
|
|
1806
1806
|
/**
|
|
@@ -1810,52 +1810,52 @@ class SharedHandler {
|
|
|
1810
1810
|
*/
|
|
1811
1811
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1812
1812
|
initializeSharing(t = DEFAULT_SCOPE, o) {
|
|
1813
|
-
const { host: n } = this, s = o == null ? void 0 : o.from,
|
|
1814
|
-
let
|
|
1815
|
-
const
|
|
1813
|
+
const { host: n } = this, s = o == null ? void 0 : o.from, a = o == null ? void 0 : o.strategy;
|
|
1814
|
+
let c = o == null ? void 0 : o.initScope;
|
|
1815
|
+
const i = [];
|
|
1816
1816
|
if (s !== "build") {
|
|
1817
|
-
const { initTokens:
|
|
1818
|
-
|
|
1819
|
-
let R =
|
|
1820
|
-
if (R || (R =
|
|
1821
|
-
return
|
|
1822
|
-
|
|
1817
|
+
const { initTokens: E } = this;
|
|
1818
|
+
c || (c = []);
|
|
1819
|
+
let R = E[t];
|
|
1820
|
+
if (R || (R = E[t] = { from: this.host.name }), c.indexOf(R) >= 0)
|
|
1821
|
+
return i;
|
|
1822
|
+
c.push(R);
|
|
1823
1823
|
}
|
|
1824
1824
|
const l = this.shareScopeMap, u = n.options.name;
|
|
1825
1825
|
l[t] || (l[t] = {});
|
|
1826
|
-
const
|
|
1826
|
+
const p = l[t], m = (E, R) => {
|
|
1827
1827
|
var _;
|
|
1828
|
-
const { version:
|
|
1829
|
-
|
|
1830
|
-
const I =
|
|
1831
|
-
(!S || S.strategy !== "loaded-first" && !S.loaded && (!b != !T ? b : u > S.from)) && (I[
|
|
1832
|
-
},
|
|
1828
|
+
const { version: g, eager: b } = R;
|
|
1829
|
+
p[E] = p[E] || {};
|
|
1830
|
+
const I = p[E], S = I[g], T = !!(S && (S.eager || (_ = S.shareConfig) != null && _.eager));
|
|
1831
|
+
(!S || S.strategy !== "loaded-first" && !S.loaded && (!b != !T ? b : u > S.from)) && (I[g] = R);
|
|
1832
|
+
}, d = (E) => E && E.init && E.init(l[t], c), y = async (E) => {
|
|
1833
1833
|
const { module: R } = await n.remoteHandler.getRemoteModuleAndOptions({
|
|
1834
|
-
id:
|
|
1834
|
+
id: E
|
|
1835
1835
|
});
|
|
1836
1836
|
if (R.getEntry) {
|
|
1837
|
-
let
|
|
1837
|
+
let g;
|
|
1838
1838
|
try {
|
|
1839
|
-
|
|
1839
|
+
g = await R.getEntry();
|
|
1840
1840
|
} catch (b) {
|
|
1841
|
-
|
|
1842
|
-
id:
|
|
1841
|
+
g = await n.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
1842
|
+
id: E,
|
|
1843
1843
|
error: b,
|
|
1844
1844
|
from: "runtime",
|
|
1845
1845
|
lifecycle: "beforeLoadShare",
|
|
1846
1846
|
origin: n
|
|
1847
1847
|
});
|
|
1848
1848
|
}
|
|
1849
|
-
R.inited || (await
|
|
1849
|
+
R.inited || (await d(g), R.inited = !0);
|
|
1850
1850
|
}
|
|
1851
1851
|
};
|
|
1852
|
-
return Object.keys(n.options.shared).forEach((
|
|
1853
|
-
n.options.shared[
|
|
1854
|
-
|
|
1852
|
+
return Object.keys(n.options.shared).forEach((E) => {
|
|
1853
|
+
n.options.shared[E].forEach((g) => {
|
|
1854
|
+
g.scope.includes(t) && m(E, g);
|
|
1855
1855
|
});
|
|
1856
|
-
}), (n.options.shareStrategy === "version-first" ||
|
|
1857
|
-
|
|
1858
|
-
}),
|
|
1856
|
+
}), (n.options.shareStrategy === "version-first" || a === "version-first") && n.options.remotes.forEach((E) => {
|
|
1857
|
+
E.shareScope === t && i.push(y(E.name));
|
|
1858
|
+
}), i;
|
|
1859
1859
|
}
|
|
1860
1860
|
// The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
|
|
1861
1861
|
// 1. If the loaded shared already exists globally, then it will be reused
|
|
@@ -1867,39 +1867,39 @@ class SharedHandler {
|
|
|
1867
1867
|
extraOptions: o,
|
|
1868
1868
|
shareInfos: n.options.shared
|
|
1869
1869
|
});
|
|
1870
|
-
s != null && s.scope && s.scope.forEach((
|
|
1871
|
-
this.initializeSharing(
|
|
1870
|
+
s != null && s.scope && s.scope.forEach((i) => {
|
|
1871
|
+
this.initializeSharing(i, { strategy: s.strategy });
|
|
1872
1872
|
});
|
|
1873
|
-
const
|
|
1874
|
-
|
|
1873
|
+
const a = getRegisteredShare(this.shareScopeMap, t, s, this.hooks.lifecycle.resolveShare), c = (i) => {
|
|
1874
|
+
i.useIn || (i.useIn = []), addUniqueItem(i.useIn, n.options.name);
|
|
1875
1875
|
};
|
|
1876
|
-
if (
|
|
1877
|
-
if (typeof
|
|
1878
|
-
return a
|
|
1879
|
-
if (typeof
|
|
1880
|
-
const
|
|
1881
|
-
if (!(
|
|
1882
|
-
return a
|
|
1876
|
+
if (a) {
|
|
1877
|
+
if (typeof a.lib == "function")
|
|
1878
|
+
return c(a), a.loaded || (a.loaded = !0, a.from === n.options.name && (s.loaded = !0)), a.lib;
|
|
1879
|
+
if (typeof a.get == "function") {
|
|
1880
|
+
const i = a.get();
|
|
1881
|
+
if (!(i instanceof Promise))
|
|
1882
|
+
return c(a), this.setShared({
|
|
1883
1883
|
pkgName: t,
|
|
1884
1884
|
loaded: !0,
|
|
1885
1885
|
from: n.options.name,
|
|
1886
|
-
lib:
|
|
1887
|
-
shared:
|
|
1888
|
-
}),
|
|
1886
|
+
lib: i,
|
|
1887
|
+
shared: a
|
|
1888
|
+
}), i;
|
|
1889
1889
|
}
|
|
1890
1890
|
}
|
|
1891
1891
|
if (s.lib)
|
|
1892
1892
|
return s.loaded || (s.loaded = !0), s.lib;
|
|
1893
1893
|
if (s.get) {
|
|
1894
|
-
const
|
|
1895
|
-
if (
|
|
1894
|
+
const i = s.get();
|
|
1895
|
+
if (i instanceof Promise) {
|
|
1896
1896
|
const l = (o == null ? void 0 : o.from) === "build" ? RUNTIME_005 : RUNTIME_006;
|
|
1897
1897
|
throw new Error(getShortErrorMsg(l, runtimeDescMap, {
|
|
1898
1898
|
hostName: n.options.name,
|
|
1899
1899
|
sharedPkgName: t
|
|
1900
1900
|
}));
|
|
1901
1901
|
}
|
|
1902
|
-
return s.lib =
|
|
1902
|
+
return s.lib = i, this.setShared({
|
|
1903
1903
|
pkgName: t,
|
|
1904
1904
|
loaded: !0,
|
|
1905
1905
|
from: n.options.name,
|
|
@@ -1922,22 +1922,22 @@ class SharedHandler {
|
|
|
1922
1922
|
hostShareScopeMap: n.hostShareScopeMap
|
|
1923
1923
|
});
|
|
1924
1924
|
}
|
|
1925
|
-
setShared({ pkgName: t, shared: o, from: n, lib: s, loading:
|
|
1926
|
-
const { version: l, scope: u = "default", ...
|
|
1927
|
-
(Array.isArray(u) ? u : [u]).forEach((
|
|
1928
|
-
if (this.shareScopeMap[
|
|
1929
|
-
this.shareScopeMap[
|
|
1925
|
+
setShared({ pkgName: t, shared: o, from: n, lib: s, loading: a, loaded: c, get: i }) {
|
|
1926
|
+
const { version: l, scope: u = "default", ...p } = o;
|
|
1927
|
+
(Array.isArray(u) ? u : [u]).forEach((d) => {
|
|
1928
|
+
if (this.shareScopeMap[d] || (this.shareScopeMap[d] = {}), this.shareScopeMap[d][t] || (this.shareScopeMap[d][t] = {}), !this.shareScopeMap[d][t][l]) {
|
|
1929
|
+
this.shareScopeMap[d][t][l] = {
|
|
1930
1930
|
version: l,
|
|
1931
1931
|
scope: ["default"],
|
|
1932
|
-
...
|
|
1932
|
+
...p,
|
|
1933
1933
|
lib: s,
|
|
1934
|
-
loaded:
|
|
1935
|
-
loading:
|
|
1936
|
-
},
|
|
1934
|
+
loaded: c,
|
|
1935
|
+
loading: a
|
|
1936
|
+
}, i && (this.shareScopeMap[d][t][l].get = i);
|
|
1937
1937
|
return;
|
|
1938
1938
|
}
|
|
1939
|
-
const y = this.shareScopeMap[
|
|
1940
|
-
|
|
1939
|
+
const y = this.shareScopeMap[d][t][l];
|
|
1940
|
+
a && !y.loading && (y.loading = a), c && !y.loaded && (y.loaded = c), n && y.from !== n && (y.from = n);
|
|
1941
1941
|
});
|
|
1942
1942
|
}
|
|
1943
1943
|
_setGlobalShareScopeMap(t) {
|
|
@@ -1962,18 +1962,18 @@ class RemoteHandler {
|
|
|
1962
1962
|
}), this.host = t, this.idToRemoteMap = {};
|
|
1963
1963
|
}
|
|
1964
1964
|
formatAndRegisterRemote(t, o) {
|
|
1965
|
-
return (o.remotes || []).reduce((s,
|
|
1965
|
+
return (o.remotes || []).reduce((s, a) => (this.registerRemote(a, s, { force: !1 }), s), t.remotes);
|
|
1966
1966
|
}
|
|
1967
1967
|
setIdToRemoteMap(t, o) {
|
|
1968
|
-
const { remote: n, expose: s } = o, { name:
|
|
1969
|
-
if (this.idToRemoteMap[t] = { name: n.name, expose: s },
|
|
1970
|
-
const
|
|
1971
|
-
this.idToRemoteMap[
|
|
1968
|
+
const { remote: n, expose: s } = o, { name: a, alias: c } = n;
|
|
1969
|
+
if (this.idToRemoteMap[t] = { name: n.name, expose: s }, c && t.startsWith(a)) {
|
|
1970
|
+
const i = t.replace(a, c);
|
|
1971
|
+
this.idToRemoteMap[i] = { name: n.name, expose: s };
|
|
1972
1972
|
return;
|
|
1973
1973
|
}
|
|
1974
|
-
if (
|
|
1975
|
-
const
|
|
1976
|
-
this.idToRemoteMap[
|
|
1974
|
+
if (c && t.startsWith(c)) {
|
|
1975
|
+
const i = t.replace(c, a);
|
|
1976
|
+
this.idToRemoteMap[i] = { name: n.name, expose: s };
|
|
1977
1977
|
}
|
|
1978
1978
|
}
|
|
1979
1979
|
// eslint-disable-next-line max-lines-per-function
|
|
@@ -1983,31 +1983,31 @@ class RemoteHandler {
|
|
|
1983
1983
|
try {
|
|
1984
1984
|
const { loadFactory: s = !0 } = o || {
|
|
1985
1985
|
loadFactory: !0
|
|
1986
|
-
}, { module:
|
|
1986
|
+
}, { module: a, moduleOptions: c, remoteMatchInfo: i } = await this.getRemoteModuleAndOptions({
|
|
1987
1987
|
id: t
|
|
1988
|
-
}), { pkgNameOrAlias: l, remote: u, expose:
|
|
1989
|
-
id:
|
|
1988
|
+
}), { pkgNameOrAlias: l, remote: u, expose: p, id: m, remoteSnapshot: d } = i, y = await a.get(m, p, o, d), E = await this.hooks.lifecycle.onLoad.emit({
|
|
1989
|
+
id: m,
|
|
1990
1990
|
pkgNameOrAlias: l,
|
|
1991
|
-
expose:
|
|
1991
|
+
expose: p,
|
|
1992
1992
|
exposeModule: s ? y : void 0,
|
|
1993
1993
|
exposeModuleFactory: s ? void 0 : y,
|
|
1994
1994
|
remote: u,
|
|
1995
|
-
options:
|
|
1996
|
-
moduleInstance:
|
|
1995
|
+
options: c,
|
|
1996
|
+
moduleInstance: a,
|
|
1997
1997
|
origin: n
|
|
1998
1998
|
});
|
|
1999
|
-
return this.setIdToRemoteMap(t,
|
|
1999
|
+
return this.setIdToRemoteMap(t, i), typeof E == "function" ? E : y;
|
|
2000
2000
|
} catch (s) {
|
|
2001
|
-
const { from:
|
|
2001
|
+
const { from: a = "runtime" } = o || { from: "runtime" }, c = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
2002
2002
|
id: t,
|
|
2003
2003
|
error: s,
|
|
2004
|
-
from:
|
|
2004
|
+
from: a,
|
|
2005
2005
|
lifecycle: "onLoad",
|
|
2006
2006
|
origin: n
|
|
2007
2007
|
});
|
|
2008
|
-
if (!
|
|
2008
|
+
if (!c)
|
|
2009
2009
|
throw s;
|
|
2010
|
-
return
|
|
2010
|
+
return c;
|
|
2011
2011
|
}
|
|
2012
2012
|
}
|
|
2013
2013
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
@@ -2020,17 +2020,17 @@ class RemoteHandler {
|
|
|
2020
2020
|
});
|
|
2021
2021
|
const n = formatPreloadArgs(o.options.remotes, t);
|
|
2022
2022
|
await Promise.all(n.map(async (s) => {
|
|
2023
|
-
const { remote:
|
|
2024
|
-
moduleInfo:
|
|
2023
|
+
const { remote: a } = s, c = getRemoteInfo(a), { globalSnapshot: i, remoteSnapshot: l } = await o.snapshotHandler.loadRemoteSnapshotInfo({
|
|
2024
|
+
moduleInfo: a
|
|
2025
2025
|
}), u = await this.hooks.lifecycle.generatePreloadAssets.emit({
|
|
2026
2026
|
origin: o,
|
|
2027
2027
|
preloadOptions: s,
|
|
2028
|
-
remote:
|
|
2029
|
-
remoteInfo:
|
|
2030
|
-
globalSnapshot:
|
|
2028
|
+
remote: a,
|
|
2029
|
+
remoteInfo: c,
|
|
2030
|
+
globalSnapshot: i,
|
|
2031
2031
|
remoteSnapshot: l
|
|
2032
2032
|
});
|
|
2033
|
-
u && preloadAssets(
|
|
2033
|
+
u && preloadAssets(c, o, u);
|
|
2034
2034
|
}));
|
|
2035
2035
|
}
|
|
2036
2036
|
registerRemotes(t, o) {
|
|
@@ -2050,97 +2050,97 @@ class RemoteHandler {
|
|
|
2050
2050
|
options: o.options,
|
|
2051
2051
|
origin: o
|
|
2052
2052
|
});
|
|
2053
|
-
} catch (
|
|
2053
|
+
} catch (E) {
|
|
2054
2054
|
if (s = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
2055
2055
|
id: n,
|
|
2056
2056
|
options: o.options,
|
|
2057
2057
|
origin: o,
|
|
2058
2058
|
from: "runtime",
|
|
2059
|
-
error:
|
|
2059
|
+
error: E,
|
|
2060
2060
|
lifecycle: "beforeRequest"
|
|
2061
2061
|
}), !s)
|
|
2062
|
-
throw
|
|
2062
|
+
throw E;
|
|
2063
2063
|
}
|
|
2064
|
-
const { id:
|
|
2065
|
-
assert(
|
|
2064
|
+
const { id: a } = s, c = matchRemoteWithNameAndExpose(o.options.remotes, a);
|
|
2065
|
+
assert(c, getShortErrorMsg(RUNTIME_004, runtimeDescMap, {
|
|
2066
2066
|
hostName: o.options.name,
|
|
2067
|
-
requestId:
|
|
2067
|
+
requestId: a
|
|
2068
2068
|
}));
|
|
2069
|
-
const { remote:
|
|
2070
|
-
id:
|
|
2071
|
-
...
|
|
2069
|
+
const { remote: i } = c, l = getRemoteInfo(i), u = await o.sharedHandler.hooks.lifecycle.afterResolve.emit({
|
|
2070
|
+
id: a,
|
|
2071
|
+
...c,
|
|
2072
2072
|
options: o.options,
|
|
2073
2073
|
origin: o,
|
|
2074
2074
|
remoteInfo: l
|
|
2075
|
-
}), { remote:
|
|
2076
|
-
assert(
|
|
2077
|
-
let
|
|
2075
|
+
}), { remote: p, expose: m } = u;
|
|
2076
|
+
assert(p && m, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${a}.`);
|
|
2077
|
+
let d = o.moduleCache.get(p.name);
|
|
2078
2078
|
const y = {
|
|
2079
2079
|
host: o,
|
|
2080
2080
|
remoteInfo: l
|
|
2081
2081
|
};
|
|
2082
|
-
return
|
|
2083
|
-
module:
|
|
2082
|
+
return d || (d = new Module(y), o.moduleCache.set(p.name, d)), {
|
|
2083
|
+
module: d,
|
|
2084
2084
|
moduleOptions: y,
|
|
2085
2085
|
remoteMatchInfo: u
|
|
2086
2086
|
};
|
|
2087
2087
|
}
|
|
2088
2088
|
registerRemote(t, o, n) {
|
|
2089
|
-
const { host: s } = this,
|
|
2089
|
+
const { host: s } = this, a = () => {
|
|
2090
2090
|
if (t.alias) {
|
|
2091
|
-
const
|
|
2091
|
+
const i = o.find((l) => {
|
|
2092
2092
|
var u;
|
|
2093
2093
|
return t.alias && (l.name.startsWith(t.alias) || ((u = l.alias) == null ? void 0 : u.startsWith(t.alias)));
|
|
2094
2094
|
});
|
|
2095
|
-
assert(!
|
|
2095
|
+
assert(!i, `The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${i && i.name} name or alias`);
|
|
2096
2096
|
}
|
|
2097
2097
|
"entry" in t && isBrowserEnv() && !t.entry.startsWith("http") && (t.entry = new URL(t.entry, window.location.origin).href), t.shareScope || (t.shareScope = DEFAULT_SCOPE), t.type || (t.type = DEFAULT_REMOTE_TYPE);
|
|
2098
2098
|
};
|
|
2099
2099
|
this.hooks.lifecycle.beforeRegisterRemote.emit({ remote: t, origin: s });
|
|
2100
|
-
const
|
|
2101
|
-
if (!
|
|
2102
|
-
|
|
2100
|
+
const c = o.find((i) => i.name === t.name);
|
|
2101
|
+
if (!c)
|
|
2102
|
+
a(), o.push(t), this.hooks.lifecycle.registerRemote.emit({ remote: t, origin: s });
|
|
2103
2103
|
else {
|
|
2104
|
-
const
|
|
2104
|
+
const i = [
|
|
2105
2105
|
`The remote "${t.name}" is already registered.`,
|
|
2106
2106
|
"Please note that overriding it may cause unexpected errors."
|
|
2107
2107
|
];
|
|
2108
|
-
n != null && n.force && (this.removeRemote(
|
|
2108
|
+
n != null && n.force && (this.removeRemote(c), a(), o.push(t), this.hooks.lifecycle.registerRemote.emit({ remote: t, origin: s }), warn$1(i.join(" ")));
|
|
2109
2109
|
}
|
|
2110
2110
|
}
|
|
2111
2111
|
removeRemote(t) {
|
|
2112
2112
|
var o;
|
|
2113
2113
|
try {
|
|
2114
|
-
const { host: n } = this, { name: s } = t,
|
|
2115
|
-
|
|
2116
|
-
const
|
|
2117
|
-
if (
|
|
2118
|
-
const
|
|
2114
|
+
const { host: n } = this, { name: s } = t, a = n.options.remotes.findIndex((i) => i.name === s);
|
|
2115
|
+
a !== -1 && n.options.remotes.splice(a, 1);
|
|
2116
|
+
const c = n.moduleCache.get(t.name);
|
|
2117
|
+
if (c) {
|
|
2118
|
+
const i = c.remoteInfo, l = i.entryGlobalName;
|
|
2119
2119
|
CurrentGlobal[l] && ((o = Object.getOwnPropertyDescriptor(CurrentGlobal, l)) != null && o.configurable ? delete CurrentGlobal[l] : CurrentGlobal[l] = void 0);
|
|
2120
|
-
const u = getRemoteEntryUniqueKey(
|
|
2121
|
-
globalLoading[u] && delete globalLoading[u], n.snapshotHandler.manifestCache.delete(
|
|
2122
|
-
let
|
|
2123
|
-
const
|
|
2124
|
-
if (
|
|
2125
|
-
const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[
|
|
2126
|
-
|
|
2127
|
-
const
|
|
2120
|
+
const u = getRemoteEntryUniqueKey(c.remoteInfo);
|
|
2121
|
+
globalLoading[u] && delete globalLoading[u], n.snapshotHandler.manifestCache.delete(i.entry);
|
|
2122
|
+
let p = i.buildVersion ? composeKeyWithSeparator(i.name, i.buildVersion) : i.name;
|
|
2123
|
+
const m = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => i.buildVersion ? y.options.id === p : y.name === p);
|
|
2124
|
+
if (m !== -1) {
|
|
2125
|
+
const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[m];
|
|
2126
|
+
p = y.options.id || p;
|
|
2127
|
+
const E = getGlobalShareScope();
|
|
2128
2128
|
let R = !0;
|
|
2129
|
-
const
|
|
2130
|
-
Object.keys(
|
|
2131
|
-
const I =
|
|
2129
|
+
const g = [];
|
|
2130
|
+
Object.keys(E).forEach((b) => {
|
|
2131
|
+
const I = E[b];
|
|
2132
2132
|
I && Object.keys(I).forEach((S) => {
|
|
2133
2133
|
const T = I[S];
|
|
2134
2134
|
T && Object.keys(T).forEach((_) => {
|
|
2135
2135
|
const A = T[_];
|
|
2136
2136
|
A && Object.keys(A).forEach((w) => {
|
|
2137
2137
|
const $ = A[w];
|
|
2138
|
-
$ && typeof $ == "object" && $.from ===
|
|
2138
|
+
$ && typeof $ == "object" && $.from === i.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((M) => M !== i.name), $.useIn.length ? R = !1 : g.push([
|
|
2139
2139
|
b,
|
|
2140
2140
|
S,
|
|
2141
2141
|
_,
|
|
2142
2142
|
w
|
|
2143
|
-
])) :
|
|
2143
|
+
])) : g.push([
|
|
2144
2144
|
b,
|
|
2145
2145
|
S,
|
|
2146
2146
|
_,
|
|
@@ -2149,15 +2149,15 @@ class RemoteHandler {
|
|
|
2149
2149
|
});
|
|
2150
2150
|
});
|
|
2151
2151
|
});
|
|
2152
|
-
}), R && (y.shareScopeMap = {}, delete
|
|
2152
|
+
}), R && (y.shareScopeMap = {}, delete E[p]), g.forEach(([b, I, S, T]) => {
|
|
2153
2153
|
var _, A, w;
|
|
2154
|
-
(w = (A = (_ =
|
|
2155
|
-
}), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(
|
|
2154
|
+
(w = (A = (_ = E[b]) == null ? void 0 : _[I]) == null ? void 0 : A[S]) == null || delete w[T];
|
|
2155
|
+
}), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(m, 1);
|
|
2156
2156
|
}
|
|
2157
|
-
const { hostGlobalSnapshot:
|
|
2158
|
-
if (
|
|
2159
|
-
const y =
|
|
2160
|
-
y && (delete
|
|
2157
|
+
const { hostGlobalSnapshot: d } = getGlobalRemoteInfo(t, n);
|
|
2158
|
+
if (d) {
|
|
2159
|
+
const y = d && "remotesInfo" in d && d.remotesInfo && getInfoWithoutType(d.remotesInfo, t.name).key;
|
|
2160
|
+
y && (delete d.remotesInfo[y], Global.__FEDERATION__.__MANIFEST_LOADING__[y] && delete Global.__FEDERATION__.__MANIFEST_LOADING__[y]);
|
|
2161
2161
|
}
|
|
2162
2162
|
n.moduleCache.delete(t.name);
|
|
2163
2163
|
}
|
|
@@ -2176,7 +2176,7 @@ class ModuleFederation {
|
|
|
2176
2176
|
beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
|
|
2177
2177
|
// maybe will change, temporarily for internal use only
|
|
2178
2178
|
initContainer: new AsyncWaterfallHook("initContainer")
|
|
2179
|
-
}), this.version = "0.0.0-
|
|
2179
|
+
}), this.version = "0.0.0-research-issue-4085-20251016232757", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
|
|
2180
2180
|
// FIXME: may not be suitable , not open to the public yet
|
|
2181
2181
|
getModuleInfo: new SyncHook(),
|
|
2182
2182
|
createScript: new SyncHook(),
|
|
@@ -2222,8 +2222,8 @@ class ModuleFederation {
|
|
|
2222
2222
|
return this.sharedHandler.initializeSharing(t, o);
|
|
2223
2223
|
}
|
|
2224
2224
|
initRawContainer(t, o, n) {
|
|
2225
|
-
const s = getRemoteInfo({ name: t, entry: o }),
|
|
2226
|
-
return
|
|
2225
|
+
const s = getRemoteInfo({ name: t, entry: o }), a = new Module({ host: this, remoteInfo: s });
|
|
2226
|
+
return a.remoteEntryExports = n, this.moduleCache.set(t, a), a;
|
|
2227
2227
|
}
|
|
2228
2228
|
// eslint-disable-next-line max-lines-per-function
|
|
2229
2229
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
@@ -2238,21 +2238,21 @@ class ModuleFederation {
|
|
|
2238
2238
|
this.sharedHandler.initShareScopeMap(t, o, n);
|
|
2239
2239
|
}
|
|
2240
2240
|
formatOptions(t, o) {
|
|
2241
|
-
const { shared: n } = formatShareConfigs(t, o), { userOptions: s, options:
|
|
2241
|
+
const { shared: n } = formatShareConfigs(t, o), { userOptions: s, options: a } = this.hooks.lifecycle.beforeInit.emit({
|
|
2242
2242
|
origin: this,
|
|
2243
2243
|
userOptions: o,
|
|
2244
2244
|
options: t,
|
|
2245
2245
|
shareInfo: n
|
|
2246
|
-
}),
|
|
2247
|
-
s.plugins && s.plugins.forEach((
|
|
2248
|
-
l.includes(
|
|
2246
|
+
}), c = this.remoteHandler.formatAndRegisterRemote(a, s), { shared: i } = this.sharedHandler.registerShared(a, s), l = [...a.plugins];
|
|
2247
|
+
s.plugins && s.plugins.forEach((p) => {
|
|
2248
|
+
l.includes(p) || l.push(p);
|
|
2249
2249
|
});
|
|
2250
2250
|
const u = {
|
|
2251
2251
|
...t,
|
|
2252
2252
|
...o,
|
|
2253
2253
|
plugins: l,
|
|
2254
|
-
remotes:
|
|
2255
|
-
shared:
|
|
2254
|
+
remotes: c,
|
|
2255
|
+
shared: i
|
|
2256
2256
|
};
|
|
2257
2257
|
return this.hooks.lifecycle.init.emit({
|
|
2258
2258
|
origin: this,
|
|
@@ -2261,7 +2261,7 @@ class ModuleFederation {
|
|
|
2261
2261
|
}
|
|
2262
2262
|
registerPlugins(t) {
|
|
2263
2263
|
const o = registerPlugins(t, this);
|
|
2264
|
-
this.options.plugins = this.options.plugins.reduce((n, s) => (s && n && !n.find((
|
|
2264
|
+
this.options.plugins = this.options.plugins.reduce((n, s) => (s && n && !n.find((a) => a.name === s.name) && n.push(s), n), o || []);
|
|
2265
2265
|
}
|
|
2266
2266
|
registerRemotes(t, o) {
|
|
2267
2267
|
return this.remoteHandler.registerRemotes(t, o);
|
|
@@ -2278,37 +2278,84 @@ function getInstance() {
|
|
|
2278
2278
|
return FederationInstance;
|
|
2279
2279
|
}
|
|
2280
2280
|
setGlobalFederationConstructor(ModuleFederation);
|
|
2281
|
+
function addBasenameToNestedRoutes(r, t) {
|
|
2282
|
+
return r.map((o) => {
|
|
2283
|
+
const n = {
|
|
2284
|
+
...o,
|
|
2285
|
+
path: t + o.path
|
|
2286
|
+
};
|
|
2287
|
+
return o.children && o.children.length > 0 && (n.children = addBasenameToNestedRoutes(
|
|
2288
|
+
o.children,
|
|
2289
|
+
t
|
|
2290
|
+
)), n;
|
|
2291
|
+
});
|
|
2292
|
+
}
|
|
2293
|
+
function processRoutes(r) {
|
|
2294
|
+
const { router: t, basename: o, memoryRoute: n, hashRoute: s } = r, a = t.getRoutes().sort(
|
|
2295
|
+
(d, y) => d.path.split("/").filter((E) => E).length - y.path.split("/").filter((E) => E).length
|
|
2296
|
+
), c = /* @__PURE__ */ new Map(), i = /* @__PURE__ */ new Set();
|
|
2297
|
+
a.forEach((d) => {
|
|
2298
|
+
c.set(d.path, d);
|
|
2299
|
+
});
|
|
2300
|
+
const l = (d, y) => `${d}/${y}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/", u = (d, y = "") => {
|
|
2301
|
+
if (!d.children || d.children.length === 0)
|
|
2302
|
+
return d;
|
|
2303
|
+
for (let E = 0; E < d.children.length; E++) {
|
|
2304
|
+
const R = d.children[E], g = l(y, R.path), b = c.get(g);
|
|
2305
|
+
if (b && !i.has(b)) {
|
|
2306
|
+
const I = {
|
|
2307
|
+
...b,
|
|
2308
|
+
path: R.path
|
|
2309
|
+
// Keep the original relative path from static route
|
|
2310
|
+
};
|
|
2311
|
+
d.children[E] = I, i.add(b), u(I, g);
|
|
2312
|
+
}
|
|
2313
|
+
}
|
|
2314
|
+
return d;
|
|
2315
|
+
};
|
|
2316
|
+
let p = [];
|
|
2317
|
+
for (const d of a)
|
|
2318
|
+
if (!i.has(d)) {
|
|
2319
|
+
const y = u(d, d.path);
|
|
2320
|
+
i.add(d), p.push(y);
|
|
2321
|
+
}
|
|
2322
|
+
let m;
|
|
2323
|
+
return n ? m = VueRouter.createMemoryHistory(o) : s ? (m = VueRouter.createWebHashHistory(), o && (p = addBasenameToNestedRoutes(p, o))) : m = VueRouter.createWebHistory(o), {
|
|
2324
|
+
history: m,
|
|
2325
|
+
routes: p
|
|
2326
|
+
};
|
|
2327
|
+
}
|
|
2281
2328
|
function createBridgeComponent(r) {
|
|
2282
2329
|
const t = /* @__PURE__ */ new Map(), o = getInstance();
|
|
2283
2330
|
return () => ({
|
|
2284
|
-
__APP_VERSION__: "0.0.0-
|
|
2331
|
+
__APP_VERSION__: "0.0.0-research-issue-4085-20251016232757",
|
|
2285
2332
|
async render(n) {
|
|
2286
|
-
var
|
|
2333
|
+
var E, R, g;
|
|
2287
2334
|
LoggerInstance.debug("createBridgeComponent render Info", n);
|
|
2288
2335
|
const {
|
|
2289
2336
|
moduleName: s,
|
|
2290
|
-
dom:
|
|
2291
|
-
basename:
|
|
2292
|
-
memoryRoute:
|
|
2337
|
+
dom: a,
|
|
2338
|
+
basename: c,
|
|
2339
|
+
memoryRoute: i,
|
|
2293
2340
|
hashRoute: l,
|
|
2294
2341
|
...u
|
|
2295
|
-
} = n,
|
|
2296
|
-
t.set(
|
|
2297
|
-
const
|
|
2298
|
-
app:
|
|
2299
|
-
basename:
|
|
2300
|
-
memoryRoute:
|
|
2342
|
+
} = n, p = Vue.createApp(r.rootComponent, u);
|
|
2343
|
+
t.set(a, p);
|
|
2344
|
+
const m = await ((g = (R = (E = o == null ? void 0 : o.bridgeHook) == null ? void 0 : E.lifecycle) == null ? void 0 : R.beforeBridgeRender) == null ? void 0 : g.emit(n)), d = m && typeof m == "object" && (m != null && m.extraProps) ? m == null ? void 0 : m.extraProps : {}, y = r.appOptions({
|
|
2345
|
+
app: p,
|
|
2346
|
+
basename: c,
|
|
2347
|
+
memoryRoute: i,
|
|
2301
2348
|
hashRoute: l,
|
|
2302
2349
|
...u,
|
|
2303
|
-
...
|
|
2350
|
+
...d
|
|
2304
2351
|
});
|
|
2305
2352
|
if (y != null && y.router) {
|
|
2306
|
-
|
|
2307
|
-
|
|
2308
|
-
|
|
2309
|
-
|
|
2310
|
-
|
|
2311
|
-
|
|
2353
|
+
const { history: b, routes: I } = processRoutes({
|
|
2354
|
+
router: y.router,
|
|
2355
|
+
basename: n.basename,
|
|
2356
|
+
memoryRoute: n.memoryRoute,
|
|
2357
|
+
hashRoute: n.hashRoute
|
|
2358
|
+
}), S = VueRouter.createRouter({
|
|
2312
2359
|
...y.router.options,
|
|
2313
2360
|
history: b,
|
|
2314
2361
|
routes: I
|
|
@@ -2316,9 +2363,9 @@ function createBridgeComponent(r) {
|
|
|
2316
2363
|
LoggerInstance.debug("createBridgeComponent render router info>>>", {
|
|
2317
2364
|
moduleName: s,
|
|
2318
2365
|
router: S
|
|
2319
|
-
}),
|
|
2366
|
+
}), i && await S.push(i.entryPath), p.use(S);
|
|
2320
2367
|
}
|
|
2321
|
-
|
|
2368
|
+
p.mount(a);
|
|
2322
2369
|
},
|
|
2323
2370
|
destroy(n) {
|
|
2324
2371
|
LoggerInstance.debug("createBridgeComponent destroy Info", n);
|
|
@@ -2343,32 +2390,32 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2343
2390
|
},
|
|
2344
2391
|
inheritAttrs: !1,
|
|
2345
2392
|
setup(r) {
|
|
2346
|
-
const t = ref(null), o = ref(null), n = ref(""), s = useRoute(),
|
|
2347
|
-
var
|
|
2348
|
-
const u = (
|
|
2393
|
+
const t = ref(null), o = ref(null), n = ref(""), s = useRoute(), a = getInstance(), c = useAttrs(), i = async () => {
|
|
2394
|
+
var d, y, E, R;
|
|
2395
|
+
const u = (d = r.providerInfo) == null ? void 0 : d.call(r);
|
|
2349
2396
|
o.value = u;
|
|
2350
|
-
let
|
|
2351
|
-
...
|
|
2397
|
+
let p = {
|
|
2398
|
+
...c,
|
|
2352
2399
|
moduleName: r.moduleName,
|
|
2353
2400
|
dom: t.value,
|
|
2354
2401
|
basename: r.basename,
|
|
2355
2402
|
memoryRoute: r.memoryRoute,
|
|
2356
2403
|
hashRoute: r.hashRoute
|
|
2357
2404
|
};
|
|
2358
|
-
LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>",
|
|
2359
|
-
const
|
|
2360
|
-
|
|
2361
|
-
...
|
|
2362
|
-
...
|
|
2363
|
-
}, u.render(
|
|
2405
|
+
LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>", p);
|
|
2406
|
+
const m = await ((R = (E = (y = a == null ? void 0 : a.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : E.beforeBridgeRender) == null ? void 0 : R.emit(p)) || {};
|
|
2407
|
+
p = {
|
|
2408
|
+
...p,
|
|
2409
|
+
...m.extraProps
|
|
2410
|
+
}, u.render(p);
|
|
2364
2411
|
}, l = watch(() => s == null ? void 0 : s.path, (u) => {
|
|
2365
|
-
u !== s.path &&
|
|
2412
|
+
u !== s.path && i(), n.value !== "" && n.value !== u && (LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>", {
|
|
2366
2413
|
...r,
|
|
2367
2414
|
pathname: s.path
|
|
2368
2415
|
}), e()), n.value = u;
|
|
2369
2416
|
});
|
|
2370
2417
|
return onMounted(() => {
|
|
2371
|
-
|
|
2418
|
+
i();
|
|
2372
2419
|
}), onBeforeUnmount(() => {
|
|
2373
2420
|
var u;
|
|
2374
2421
|
LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>", {
|
|
@@ -2383,7 +2430,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2383
2430
|
});
|
|
2384
2431
|
function createRemoteAppComponent(r) {
|
|
2385
2432
|
return defineAsyncComponent({
|
|
2386
|
-
__APP_VERSION__: "0.0.0-
|
|
2433
|
+
__APP_VERSION__: "0.0.0-research-issue-4085-20251016232757",
|
|
2387
2434
|
...r.asyncComponentOptions,
|
|
2388
2435
|
//@ts-ignore
|
|
2389
2436
|
loader: async () => {
|
|
@@ -2400,16 +2447,16 @@ function createRemoteAppComponent(r) {
|
|
|
2400
2447
|
info: r
|
|
2401
2448
|
}
|
|
2402
2449
|
);
|
|
2403
|
-
const
|
|
2450
|
+
const a = await r.loader(), c = a && a[Symbol.for("mf_module_id")], i = a[s];
|
|
2404
2451
|
if (LoggerInstance.debug(
|
|
2405
2452
|
"createRemoteAppComponent LazyComponent loadRemote info >>>",
|
|
2406
|
-
{ moduleName:
|
|
2407
|
-
), s in
|
|
2453
|
+
{ moduleName: c, module: a, exportName: s, basename: o, route: t }
|
|
2454
|
+
), s in a && typeof i == "function")
|
|
2408
2455
|
return {
|
|
2409
2456
|
render() {
|
|
2410
2457
|
return h(RemoteApp, {
|
|
2411
|
-
moduleName:
|
|
2412
|
-
providerInfo:
|
|
2458
|
+
moduleName: c,
|
|
2459
|
+
providerInfo: i,
|
|
2413
2460
|
basename: o,
|
|
2414
2461
|
rootAttrs: r.rootAttrs
|
|
2415
2462
|
});
|