@module-federation/bridge-vue3 0.0.0-next-20250827124348 → 0.0.0-next-20250828024119
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 -4
- package/dist/index.cjs +4 -4
- package/dist/index.js +363 -368
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -57,8 +57,8 @@ const simpleJoinRemoteEntry = (o, t) => {
|
|
|
57
57
|
if (s.startsWith("./"))
|
|
58
58
|
return s.replace("./", "");
|
|
59
59
|
if (s.startsWith("/")) {
|
|
60
|
-
const
|
|
61
|
-
return
|
|
60
|
+
const i = s.slice(1);
|
|
61
|
+
return i.endsWith("/") ? i.slice(0, -1) : i;
|
|
62
62
|
}
|
|
63
63
|
return s;
|
|
64
64
|
})(o);
|
|
@@ -69,34 +69,34 @@ function inferAutoPublicPath(o) {
|
|
|
69
69
|
}
|
|
70
70
|
function generateSnapshotFromManifest(o, t = {}) {
|
|
71
71
|
var n, r;
|
|
72
|
-
const { remotes: s = {}, overrides:
|
|
73
|
-
let
|
|
74
|
-
const c = () => "publicPath" in o.metaData ? o.metaData.publicPath === "auto" && l ? inferAutoPublicPath(l) : o.metaData.publicPath : o.metaData.getPublicPath, u = Object.keys(
|
|
72
|
+
const { remotes: s = {}, overrides: i = {}, version: l } = t;
|
|
73
|
+
let a;
|
|
74
|
+
const c = () => "publicPath" in o.metaData ? o.metaData.publicPath === "auto" && l ? inferAutoPublicPath(l) : o.metaData.publicPath : o.metaData.getPublicPath, u = Object.keys(i);
|
|
75
75
|
let p = {};
|
|
76
76
|
if (!Object.keys(s).length) {
|
|
77
77
|
var d;
|
|
78
78
|
p = ((d = o.remotes) == null ? void 0 : d.reduce((R, A) => {
|
|
79
79
|
let T;
|
|
80
80
|
const $ = A.federationContainerName;
|
|
81
|
-
return u.includes($) ? T =
|
|
81
|
+
return u.includes($) ? T = i[$] : "version" in A ? T = A.version : T = A.entry, R[$] = {
|
|
82
82
|
matchedVersion: T
|
|
83
83
|
}, R;
|
|
84
84
|
}, {})) || {};
|
|
85
85
|
}
|
|
86
86
|
Object.keys(s).forEach((R) => p[R] = {
|
|
87
87
|
// overrides will override dependencies
|
|
88
|
-
matchedVersion: u.includes(R) ?
|
|
88
|
+
matchedVersion: u.includes(R) ? i[R] : s[R]
|
|
89
89
|
});
|
|
90
|
-
const { remoteEntry: { path: m, name: y, type:
|
|
90
|
+
const { remoteEntry: { path: m, name: y, type: g }, types: E, buildInfo: { buildVersion: _ }, globalName: b, ssrRemoteEntry: v } = o.metaData, { exposes: I } = o;
|
|
91
91
|
let S = {
|
|
92
92
|
version: l || "",
|
|
93
93
|
buildVersion: _,
|
|
94
94
|
globalName: b,
|
|
95
95
|
remoteEntry: simpleJoinRemoteEntry(m, y),
|
|
96
|
-
remoteEntryType:
|
|
97
|
-
remoteTypes: simpleJoinRemoteEntry(
|
|
98
|
-
remoteTypesZip:
|
|
99
|
-
remoteTypesAPI:
|
|
96
|
+
remoteEntryType: g,
|
|
97
|
+
remoteTypes: simpleJoinRemoteEntry(E.path, E.name),
|
|
98
|
+
remoteTypesZip: E.zip || "",
|
|
99
|
+
remoteTypesAPI: E.api || "",
|
|
100
100
|
remotesInfo: p,
|
|
101
101
|
shared: o == null ? void 0 : o.shared.map((R) => ({
|
|
102
102
|
assets: R.assets,
|
|
@@ -122,16 +122,16 @@ function generateSnapshotFromManifest(o, t = {}) {
|
|
|
122
122
|
prefetchEntryType: T
|
|
123
123
|
});
|
|
124
124
|
}
|
|
125
|
-
if ("publicPath" in o.metaData ?
|
|
125
|
+
if ("publicPath" in o.metaData ? a = _extends$2({}, S, {
|
|
126
126
|
publicPath: c(),
|
|
127
127
|
ssrPublicPath: o.metaData.ssrPublicPath
|
|
128
|
-
}) :
|
|
128
|
+
}) : a = _extends$2({}, S, {
|
|
129
129
|
getPublicPath: c()
|
|
130
130
|
}), v) {
|
|
131
131
|
const R = simpleJoinRemoteEntry(v.path, v.name);
|
|
132
|
-
|
|
132
|
+
a.ssrRemoteEntry = R, a.ssrRemoteEntryType = v.type || "commonjs-module";
|
|
133
133
|
}
|
|
134
|
-
return
|
|
134
|
+
return a;
|
|
135
135
|
}
|
|
136
136
|
function isManifestProvider(o) {
|
|
137
137
|
return !!("remoteEntry" in o && o.remoteEntry.includes(MANIFEST_EXT));
|
|
@@ -182,23 +182,23 @@ function isStaticResourcesEqual(o, t) {
|
|
|
182
182
|
}
|
|
183
183
|
function createScript(o) {
|
|
184
184
|
let t = null, n = !0, r = 2e4, s;
|
|
185
|
-
const
|
|
186
|
-
for (let
|
|
187
|
-
const c = a
|
|
185
|
+
const i = document.getElementsByTagName("script");
|
|
186
|
+
for (let a = 0; a < i.length; a++) {
|
|
187
|
+
const c = i[a], u = c.getAttribute("src");
|
|
188
188
|
if (u && isStaticResourcesEqual(u, o.url)) {
|
|
189
189
|
t = c, n = !1;
|
|
190
190
|
break;
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
193
|
if (!t) {
|
|
194
|
-
const
|
|
195
|
-
t = document.createElement("script"), t.type = (
|
|
194
|
+
const a = o.attrs;
|
|
195
|
+
t = document.createElement("script"), t.type = (a == null ? void 0 : a.type) === "module" ? "module" : "text/javascript";
|
|
196
196
|
let c;
|
|
197
|
-
o.createScriptHook && (c = o.createScriptHook(o.url, o.attrs), c instanceof HTMLScriptElement ? t = c : typeof c == "object" && ("script" in c && c.script && (t = c.script), "timeout" in c && c.timeout && (r = c.timeout))), t.src || (t.src = o.url),
|
|
198
|
-
t && (u === "async" || u === "defer" ? t[u] =
|
|
197
|
+
o.createScriptHook && (c = o.createScriptHook(o.url, o.attrs), c instanceof HTMLScriptElement ? t = c : typeof c == "object" && ("script" in c && c.script && (t = c.script), "timeout" in c && c.timeout && (r = c.timeout))), t.src || (t.src = o.url), a && !c && Object.keys(a).forEach((u) => {
|
|
198
|
+
t && (u === "async" || u === "defer" ? t[u] = a[u] : t.getAttribute(u) || t.setAttribute(u, a[u]));
|
|
199
199
|
});
|
|
200
200
|
}
|
|
201
|
-
const l = async (
|
|
201
|
+
const l = async (a, c) => {
|
|
202
202
|
clearTimeout(s);
|
|
203
203
|
const u = () => {
|
|
204
204
|
(c == null ? void 0 : c.type) === "error" ? o != null && o.onErrorCallback && (o == null || o.onErrorCallback(c)) : o != null && o.cb && (o == null || o.cb());
|
|
@@ -206,8 +206,8 @@ function createScript(o) {
|
|
|
206
206
|
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
207
207
|
const { needDeleteScript: p = !0 } = o;
|
|
208
208
|
p && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
209
|
-
}),
|
|
210
|
-
const p =
|
|
209
|
+
}), a && typeof a == "function")) {
|
|
210
|
+
const p = a(c);
|
|
211
211
|
if (p instanceof Promise) {
|
|
212
212
|
const d = await p;
|
|
213
213
|
return u(), d;
|
|
@@ -226,33 +226,33 @@ function createScript(o) {
|
|
|
226
226
|
function createLink(o) {
|
|
227
227
|
let t = null, n = !0;
|
|
228
228
|
const r = document.getElementsByTagName("link");
|
|
229
|
-
for (let
|
|
230
|
-
const l = r[
|
|
231
|
-
if (
|
|
229
|
+
for (let i = 0; i < r.length; i++) {
|
|
230
|
+
const l = r[i], a = l.getAttribute("href"), c = l.getAttribute("rel");
|
|
231
|
+
if (a && isStaticResourcesEqual(a, o.url) && c === o.attrs.rel) {
|
|
232
232
|
t = l, n = !1;
|
|
233
233
|
break;
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
236
|
if (!t) {
|
|
237
237
|
t = document.createElement("link"), t.setAttribute("href", o.url);
|
|
238
|
-
let
|
|
238
|
+
let i;
|
|
239
239
|
const l = o.attrs;
|
|
240
|
-
o.createLinkHook && (
|
|
241
|
-
t && !t.getAttribute(
|
|
240
|
+
o.createLinkHook && (i = o.createLinkHook(o.url, l), i instanceof HTMLLinkElement && (t = i)), l && !i && Object.keys(l).forEach((a) => {
|
|
241
|
+
t && !t.getAttribute(a) && t.setAttribute(a, l[a]);
|
|
242
242
|
});
|
|
243
243
|
}
|
|
244
|
-
const s = (
|
|
245
|
-
const
|
|
244
|
+
const s = (i, l) => {
|
|
245
|
+
const a = () => {
|
|
246
246
|
(l == null ? void 0 : l.type) === "error" ? o != null && o.onErrorCallback && (o == null || o.onErrorCallback(l)) : o != null && o.cb && (o == null || o.cb());
|
|
247
247
|
};
|
|
248
248
|
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
249
249
|
const { needDeleteLink: c = !0 } = o;
|
|
250
250
|
c && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
251
|
-
}),
|
|
252
|
-
const c =
|
|
253
|
-
return
|
|
251
|
+
}), i)) {
|
|
252
|
+
const c = i(l);
|
|
253
|
+
return a(), c;
|
|
254
254
|
}
|
|
255
|
-
|
|
255
|
+
a();
|
|
256
256
|
};
|
|
257
257
|
return t.onerror = s.bind(null, t.onerror), t.onload = s.bind(null, t.onload), {
|
|
258
258
|
link: t,
|
|
@@ -261,18 +261,18 @@ function createLink(o) {
|
|
|
261
261
|
}
|
|
262
262
|
function loadScript(o, t) {
|
|
263
263
|
const { attrs: n = {}, createScriptHook: r } = t;
|
|
264
|
-
return new Promise((s,
|
|
265
|
-
const { script: l, needAttach:
|
|
264
|
+
return new Promise((s, i) => {
|
|
265
|
+
const { script: l, needAttach: a } = createScript({
|
|
266
266
|
url: o,
|
|
267
267
|
cb: s,
|
|
268
|
-
onErrorCallback:
|
|
268
|
+
onErrorCallback: i,
|
|
269
269
|
attrs: _extends$2({
|
|
270
270
|
fetchpriority: "high"
|
|
271
271
|
}, n),
|
|
272
272
|
createScriptHook: r,
|
|
273
273
|
needDeleteScript: !0
|
|
274
274
|
});
|
|
275
|
-
|
|
275
|
+
a && document.head.appendChild(l);
|
|
276
276
|
});
|
|
277
277
|
}
|
|
278
278
|
const sdkImportCache = /* @__PURE__ */ new Map();
|
|
@@ -290,7 +290,7 @@ const loadNodeFetch = async () => {
|
|
|
290
290
|
const o = await importNodeModule("node-fetch");
|
|
291
291
|
return o.default || o;
|
|
292
292
|
}, lazyLoaderHookFetch = async (o, t, n) => {
|
|
293
|
-
const s = await ((
|
|
293
|
+
const s = await ((i, l) => n.lifecycle.fetch.emit(i, l))(o, t || {});
|
|
294
294
|
return !s || !(s instanceof Response) ? (typeof fetch > "u" ? await loadNodeFetch() : fetch)(o, t || {}) : s;
|
|
295
295
|
}, createScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (url, cb, attrs, loaderHook) => {
|
|
296
296
|
if (loaderHook != null && loaderHook.createScriptHook) {
|
|
@@ -351,12 +351,12 @@ const loadNodeFetch = async () => {
|
|
|
351
351
|
} : (o, t, n, r) => {
|
|
352
352
|
t(new Error("createScriptNode is disabled in non-Node.js environment"));
|
|
353
353
|
}, loadScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (o, t) => new Promise((n, r) => {
|
|
354
|
-
createScriptNode(o, (s,
|
|
354
|
+
createScriptNode(o, (s, i) => {
|
|
355
355
|
if (s)
|
|
356
356
|
r(s);
|
|
357
357
|
else {
|
|
358
|
-
var l,
|
|
359
|
-
const c = (t == null || (l = t.attrs) == null ? void 0 : l.globalName) || `__FEDERATION_${t == null || (
|
|
358
|
+
var l, a;
|
|
359
|
+
const c = (t == null || (l = t.attrs) == null ? void 0 : l.globalName) || `__FEDERATION_${t == null || (a = t.attrs) == null ? void 0 : a.name}:custom__`, u = globalThis[c] = i;
|
|
360
360
|
n(u);
|
|
361
361
|
}
|
|
362
362
|
}, t.attrs, t.loaderHook);
|
|
@@ -366,15 +366,15 @@ const loadNodeFetch = async () => {
|
|
|
366
366
|
async function loadModule(o, t) {
|
|
367
367
|
if (esmModuleCache.has(o))
|
|
368
368
|
return esmModuleCache.get(o);
|
|
369
|
-
const { fetch: n, vm: r } = t,
|
|
369
|
+
const { fetch: n, vm: r } = t, i = await (await n(o)).text(), l = new r.SourceTextModule(i, {
|
|
370
370
|
// @ts-ignore
|
|
371
|
-
importModuleDynamically: async (
|
|
372
|
-
const u = new URL(
|
|
371
|
+
importModuleDynamically: async (a, c) => {
|
|
372
|
+
const u = new URL(a, o).href;
|
|
373
373
|
return loadModule(u, t);
|
|
374
374
|
}
|
|
375
375
|
});
|
|
376
|
-
return esmModuleCache.set(o, l), await l.link(async (
|
|
377
|
-
const c = new URL(
|
|
376
|
+
return esmModuleCache.set(o, l), await l.link(async (a) => {
|
|
377
|
+
const c = new URL(a, o).href;
|
|
378
378
|
return await loadModule(c, t);
|
|
379
379
|
}), l;
|
|
380
380
|
}
|
|
@@ -390,9 +390,9 @@ function _extends$1() {
|
|
|
390
390
|
}
|
|
391
391
|
function _object_without_properties_loose(o, t) {
|
|
392
392
|
if (o == null) return {};
|
|
393
|
-
var n = {}, r = Object.keys(o), s,
|
|
394
|
-
for (
|
|
395
|
-
s = r[
|
|
393
|
+
var n = {}, r = Object.keys(o), s, i;
|
|
394
|
+
for (i = 0; i < r.length; i++)
|
|
395
|
+
s = r[i], !(t.indexOf(s) >= 0) && (n[s] = o[s]);
|
|
396
396
|
return n;
|
|
397
397
|
}
|
|
398
398
|
const 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", TYPE_001 = "TYPE-001", BUILD_001 = "BUILD-001", BUILD_002 = "BUILD-002", getDocsUrl = (o) => `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${o.split("-")[0].toLowerCase()}/${o}`, getShortErrorMsg = (o, t, n, r) => {
|
|
@@ -504,7 +504,7 @@ function includeOwnProperty(o, t) {
|
|
|
504
504
|
includeOwnProperty(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__") || definePropertyGlobalVal(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__", {});
|
|
505
505
|
const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;
|
|
506
506
|
function setGlobalDefaultVal(o) {
|
|
507
|
-
var t, n, r, s,
|
|
507
|
+
var t, n, r, s, i, l;
|
|
508
508
|
includeOwnProperty(o, "__VMOK__") && !includeOwnProperty(o, "__FEDERATION__") && definePropertyGlobalVal(o, "__FEDERATION__", o.__VMOK__), includeOwnProperty(o, "__FEDERATION__") || (definePropertyGlobalVal(o, "__FEDERATION__", {
|
|
509
509
|
__GLOBAL_PLUGIN__: [],
|
|
510
510
|
__INSTANCES__: [],
|
|
@@ -513,8 +513,8 @@ function setGlobalDefaultVal(o) {
|
|
|
513
513
|
__MANIFEST_LOADING__: {},
|
|
514
514
|
__PRELOADED_MAP__: /* @__PURE__ */ new Map()
|
|
515
515
|
}), definePropertyGlobalVal(o, "__VMOK__", o.__FEDERATION__));
|
|
516
|
-
var
|
|
517
|
-
(
|
|
516
|
+
var a;
|
|
517
|
+
(a = (t = o.__FEDERATION__).__GLOBAL_PLUGIN__) != null || (t.__GLOBAL_PLUGIN__ = []);
|
|
518
518
|
var c;
|
|
519
519
|
(c = (n = o.__FEDERATION__).__INSTANCES__) != null || (n.__INSTANCES__ = []);
|
|
520
520
|
var u;
|
|
@@ -522,7 +522,7 @@ function setGlobalDefaultVal(o) {
|
|
|
522
522
|
var p;
|
|
523
523
|
(p = (s = o.__FEDERATION__).__SHARE__) != null || (s.__SHARE__ = {});
|
|
524
524
|
var d;
|
|
525
|
-
(d = (
|
|
525
|
+
(d = (i = o.__FEDERATION__).__MANIFEST_LOADING__) != null || (i.__MANIFEST_LOADING__ = {});
|
|
526
526
|
var m;
|
|
527
527
|
(m = (l = o.__FEDERATION__).__PRELOADED_MAP__) != null || (l.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
|
|
528
528
|
}
|
|
@@ -541,11 +541,11 @@ function getInfoWithoutType(o, t) {
|
|
|
541
541
|
{
|
|
542
542
|
const r = Object.keys(o);
|
|
543
543
|
for (const s of r) {
|
|
544
|
-
const [
|
|
544
|
+
const [i, l] = s.split(":"), a = `${i}:${t}`, c = o[a];
|
|
545
545
|
if (c)
|
|
546
546
|
return {
|
|
547
547
|
value: c,
|
|
548
|
-
key:
|
|
548
|
+
key: a
|
|
549
549
|
};
|
|
550
550
|
}
|
|
551
551
|
return {
|
|
@@ -561,11 +561,11 @@ const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo, getTarge
|
|
|
561
561
|
if (r && !r.version && "version" in o && o.version && (r.version = o.version), r)
|
|
562
562
|
return r;
|
|
563
563
|
if ("version" in o && o.version) {
|
|
564
|
-
const { version: s } = o,
|
|
564
|
+
const { version: s } = o, i = _object_without_properties_loose(o, [
|
|
565
565
|
"version"
|
|
566
|
-
]), l = getFMId(
|
|
567
|
-
if ((
|
|
568
|
-
return
|
|
566
|
+
]), l = getFMId(i), a = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, l).value;
|
|
567
|
+
if ((a == null ? void 0 : a.version) === s)
|
|
568
|
+
return a;
|
|
569
569
|
}
|
|
570
570
|
}, getGlobalSnapshotInfoByModuleInfo = (o) => getTargetSnapshotInfoByModuleInfo(o, nativeGlobal.__FEDERATION__.moduleInfo), setGlobalSnapshotInfoByModuleInfo = (o, t) => {
|
|
571
571
|
const n = getFMId(o);
|
|
@@ -598,7 +598,7 @@ function combineVersion(o, t, n, r) {
|
|
|
598
598
|
return r ? `${s}-${r}` : s;
|
|
599
599
|
}
|
|
600
600
|
function parseHyphen(o) {
|
|
601
|
-
return o.replace(parseRegex(hyphenRange), (t, n, r, s,
|
|
601
|
+
return o.replace(parseRegex(hyphenRange), (t, n, r, s, i, l, a, c, u, p, d, m) => (isXVersion(r) ? n = "" : isXVersion(s) ? n = `>=${r}.0.0` : isXVersion(i) ? n = `>=${r}.${s}.0` : n = `>=${n}`, isXVersion(u) ? c = "" : isXVersion(p) ? c = `<${Number(u) + 1}.0.0-0` : isXVersion(d) ? c = `<${u}.${Number(p) + 1}.0-0` : m ? c = `<=${u}.${p}.${d}-${m}` : c = `<=${c}`, `${n} ${c}`.trim()));
|
|
602
602
|
}
|
|
603
603
|
function parseComparatorTrim(o) {
|
|
604
604
|
return o.replace(parseRegex(comparatorTrim), "$1$2$3");
|
|
@@ -610,15 +610,15 @@ function parseCaretTrim(o) {
|
|
|
610
610
|
return o.replace(parseRegex(caretTrim), "$1^");
|
|
611
611
|
}
|
|
612
612
|
function parseCarets(o) {
|
|
613
|
-
return o.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (n, r, s,
|
|
613
|
+
return o.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (n, r, s, i, l) => isXVersion(r) ? "" : isXVersion(s) ? `>=${r}.0.0 <${Number(r) + 1}.0.0-0` : isXVersion(i) ? r === "0" ? `>=${r}.${s}.0 <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.0 <${Number(r) + 1}.0.0-0` : l ? r === "0" ? s === "0" ? `>=${r}.${s}.${i}-${l} <${r}.${s}.${Number(i) + 1}-0` : `>=${r}.${s}.${i}-${l} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${i}-${l} <${Number(r) + 1}.0.0-0` : r === "0" ? s === "0" ? `>=${r}.${s}.${i} <${r}.${s}.${Number(i) + 1}-0` : `>=${r}.${s}.${i} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${i} <${Number(r) + 1}.0.0-0`)).join(" ");
|
|
614
614
|
}
|
|
615
615
|
function parseTildes(o) {
|
|
616
|
-
return o.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (n, r, s,
|
|
616
|
+
return o.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (n, r, s, i, l) => isXVersion(r) ? "" : isXVersion(s) ? `>=${r}.0.0 <${Number(r) + 1}.0.0-0` : isXVersion(i) ? `>=${r}.${s}.0 <${r}.${Number(s) + 1}.0-0` : l ? `>=${r}.${s}.${i}-${l} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${i} <${r}.${Number(s) + 1}.0-0`)).join(" ");
|
|
617
617
|
}
|
|
618
618
|
function parseXRanges(o) {
|
|
619
|
-
return o.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (n, r, s,
|
|
620
|
-
const c = isXVersion(s), u = c || isXVersion(
|
|
621
|
-
return r === "=" && p && (r = ""),
|
|
619
|
+
return o.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (n, r, s, i, l, a) => {
|
|
620
|
+
const c = isXVersion(s), u = c || isXVersion(i), p = u || isXVersion(l);
|
|
621
|
+
return r === "=" && p && (r = ""), a = "", c ? r === ">" || r === "<" ? "<0.0.0-0" : "*" : r && p ? (u && (i = 0), l = 0, r === ">" ? (r = ">=", u ? (s = Number(s) + 1, i = 0, l = 0) : (i = Number(i) + 1, l = 0)) : r === "<=" && (r = "<", u ? s = Number(s) + 1 : i = Number(i) + 1), r === "<" && (a = "-0"), `${r + s}.${i}.${l}${a}`) : u ? `>=${s}.0.0${a} <${Number(s) + 1}.0.0-0` : p ? `>=${s}.${i}.0${a} <${s}.${Number(i) + 1}.0-0` : n;
|
|
622
622
|
})).join(" ");
|
|
623
623
|
}
|
|
624
624
|
function parseStar(o) {
|
|
@@ -638,10 +638,10 @@ function comparePreRelease(o, t) {
|
|
|
638
638
|
return -1;
|
|
639
639
|
if (n === void 0 && r === void 0)
|
|
640
640
|
return 0;
|
|
641
|
-
for (let s = 0,
|
|
642
|
-
const l = n[s],
|
|
643
|
-
if (l !==
|
|
644
|
-
return l === void 0 &&
|
|
641
|
+
for (let s = 0, i = n.length; s <= i; s++) {
|
|
642
|
+
const l = n[s], a = r[s];
|
|
643
|
+
if (l !== a)
|
|
644
|
+
return l === void 0 && a === void 0 ? 0 : l ? a ? compareAtom(l, a) : -1 : 1;
|
|
645
645
|
}
|
|
646
646
|
return 0;
|
|
647
647
|
}
|
|
@@ -714,13 +714,13 @@ function satisfy(o, t) {
|
|
|
714
714
|
const n = extractComparator(o);
|
|
715
715
|
if (!n)
|
|
716
716
|
return !1;
|
|
717
|
-
const [, r, , s,
|
|
717
|
+
const [, r, , s, i, l, a] = n, c = {
|
|
718
718
|
operator: r,
|
|
719
|
-
version: combineVersion(s,
|
|
719
|
+
version: combineVersion(s, i, l, a),
|
|
720
720
|
major: s,
|
|
721
|
-
minor:
|
|
721
|
+
minor: i,
|
|
722
722
|
patch: l,
|
|
723
|
-
preRelease:
|
|
723
|
+
preRelease: a == null ? void 0 : a.split(".")
|
|
724
724
|
}, u = t.split("||");
|
|
725
725
|
for (const p of u) {
|
|
726
726
|
const d = p.trim();
|
|
@@ -733,14 +733,14 @@ function satisfy(o, t) {
|
|
|
733
733
|
const y = m.split(" ").map((_) => parseComparatorString(_)).join(" ");
|
|
734
734
|
if (!y.trim())
|
|
735
735
|
return !0;
|
|
736
|
-
const
|
|
737
|
-
if (
|
|
736
|
+
const g = y.split(/\s+/).map((_) => parseGTE0(_)).filter(Boolean);
|
|
737
|
+
if (g.length === 0)
|
|
738
738
|
continue;
|
|
739
|
-
let
|
|
740
|
-
for (const _ of
|
|
739
|
+
let E = !0;
|
|
740
|
+
for (const _ of g) {
|
|
741
741
|
const b = extractComparator(_);
|
|
742
742
|
if (!b) {
|
|
743
|
-
|
|
743
|
+
E = !1;
|
|
744
744
|
break;
|
|
745
745
|
}
|
|
746
746
|
const [, v, , I, S, R, A] = b, T = {
|
|
@@ -752,11 +752,11 @@ function satisfy(o, t) {
|
|
|
752
752
|
preRelease: A == null ? void 0 : A.split(".")
|
|
753
753
|
};
|
|
754
754
|
if (!compare(T, c)) {
|
|
755
|
-
|
|
755
|
+
E = !1;
|
|
756
756
|
break;
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
|
-
if (
|
|
759
|
+
if (E)
|
|
760
760
|
return !0;
|
|
761
761
|
} catch (m) {
|
|
762
762
|
console.error(`[semver] Error processing range part "${d}":`, m);
|
|
@@ -770,7 +770,7 @@ function formatShare(o, t, n, r) {
|
|
|
770
770
|
"get" in o ? s = o.get : "lib" in o ? s = () => Promise.resolve(o.lib) : s = () => Promise.resolve(() => {
|
|
771
771
|
throw new Error(`Can not get shared '${n}'!`);
|
|
772
772
|
});
|
|
773
|
-
var
|
|
773
|
+
var i, l, a;
|
|
774
774
|
return _extends$1({
|
|
775
775
|
deps: [],
|
|
776
776
|
useIn: [],
|
|
@@ -785,35 +785,35 @@ function formatShare(o, t, n, r) {
|
|
|
785
785
|
}, o.shareConfig),
|
|
786
786
|
get: s,
|
|
787
787
|
loaded: o != null && o.loaded || "lib" in o ? !0 : void 0,
|
|
788
|
-
version: (
|
|
788
|
+
version: (i = o.version) != null ? i : "0",
|
|
789
789
|
scope: Array.isArray(o.scope) ? o.scope : [
|
|
790
790
|
(l = o.scope) != null ? l : "default"
|
|
791
791
|
],
|
|
792
|
-
strategy: ((
|
|
792
|
+
strategy: ((a = o.strategy) != null ? a : r) || "version-first"
|
|
793
793
|
});
|
|
794
794
|
}
|
|
795
795
|
function formatShareConfigs(o, t) {
|
|
796
|
-
const n = t.shared || {}, r = t.name, s = Object.keys(n).reduce((l,
|
|
797
|
-
const c = arrayOptions(n[
|
|
798
|
-
return l[
|
|
799
|
-
l[
|
|
796
|
+
const n = t.shared || {}, r = t.name, s = Object.keys(n).reduce((l, a) => {
|
|
797
|
+
const c = arrayOptions(n[a]);
|
|
798
|
+
return l[a] = l[a] || [], c.forEach((u) => {
|
|
799
|
+
l[a].push(formatShare(u, r, a, t.shareStrategy));
|
|
800
800
|
}), l;
|
|
801
|
-
}, {}),
|
|
801
|
+
}, {}), i = _extends$1({}, o.shared);
|
|
802
802
|
return Object.keys(s).forEach((l) => {
|
|
803
|
-
|
|
804
|
-
|
|
805
|
-
}) :
|
|
803
|
+
i[l] ? s[l].forEach((a) => {
|
|
804
|
+
i[l].find((u) => u.version === a.version) || i[l].push(a);
|
|
805
|
+
}) : i[l] = s[l];
|
|
806
806
|
}), {
|
|
807
|
-
shared:
|
|
807
|
+
shared: i,
|
|
808
808
|
shareInfos: s
|
|
809
809
|
};
|
|
810
810
|
}
|
|
811
811
|
function versionLt(o, t) {
|
|
812
812
|
const n = (r) => {
|
|
813
813
|
if (!Number.isNaN(Number(r))) {
|
|
814
|
-
const
|
|
814
|
+
const i = r.split(".");
|
|
815
815
|
let l = r;
|
|
816
|
-
for (let
|
|
816
|
+
for (let a = 0; a < 3 - i.length; a++)
|
|
817
817
|
l += ".0";
|
|
818
818
|
return l;
|
|
819
819
|
}
|
|
@@ -828,15 +828,15 @@ const findVersion = (o, t) => {
|
|
|
828
828
|
return Object.keys(o).reduce((r, s) => !r || n(r, s) || r === "0" ? s : r, 0);
|
|
829
829
|
}, isLoaded = (o) => !!o.loaded || typeof o.lib == "function", isLoading = (o) => !!o.loading;
|
|
830
830
|
function findSingletonVersionOrderByVersion(o, t, n) {
|
|
831
|
-
const r = o[t][n], s = function(
|
|
832
|
-
return !isLoaded(r[
|
|
831
|
+
const r = o[t][n], s = function(i, l) {
|
|
832
|
+
return !isLoaded(r[i]) && versionLt(i, l);
|
|
833
833
|
};
|
|
834
834
|
return findVersion(o[t][n], s);
|
|
835
835
|
}
|
|
836
836
|
function findSingletonVersionOrderByLoaded(o, t, n) {
|
|
837
|
-
const r = o[t][n], s = function(
|
|
838
|
-
const
|
|
839
|
-
return
|
|
837
|
+
const r = o[t][n], s = function(i, l) {
|
|
838
|
+
const a = (c) => isLoaded(c) || isLoading(c);
|
|
839
|
+
return a(r[l]) ? a(r[i]) ? !!versionLt(i, l) : !0 : a(r[i]) ? !1 : versionLt(i, l);
|
|
840
840
|
};
|
|
841
841
|
return findVersion(o[t][n], s);
|
|
842
842
|
}
|
|
@@ -846,23 +846,23 @@ function getFindShareFunction(o) {
|
|
|
846
846
|
function getRegisteredShare(o, t, n, r) {
|
|
847
847
|
if (!o)
|
|
848
848
|
return;
|
|
849
|
-
const { shareConfig: s, scope:
|
|
850
|
-
|
|
849
|
+
const { shareConfig: s, scope: i = DEFAULT_SCOPE, strategy: l } = n, a = Array.isArray(i) ? i : [
|
|
850
|
+
i
|
|
851
851
|
];
|
|
852
|
-
for (const c of
|
|
852
|
+
for (const c of a)
|
|
853
853
|
if (s && o[c] && o[c][t]) {
|
|
854
854
|
const { requiredVersion: u } = s, d = getFindShareFunction(l)(o, c, t), m = () => {
|
|
855
855
|
if (s.singleton) {
|
|
856
856
|
if (typeof u == "string" && !satisfy(d, u)) {
|
|
857
|
-
const
|
|
858
|
-
s.strictVersion ? error(
|
|
857
|
+
const E = `Version ${d} from ${d && o[c][t][d].from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${u})`;
|
|
858
|
+
s.strictVersion ? error(E) : warn(E);
|
|
859
859
|
}
|
|
860
860
|
return o[c][t][d];
|
|
861
861
|
} else {
|
|
862
862
|
if (u === !1 || u === "*" || satisfy(d, u))
|
|
863
863
|
return o[c][t][d];
|
|
864
|
-
for (const [
|
|
865
|
-
if (satisfy(
|
|
864
|
+
for (const [E, _] of Object.entries(o[c][t]))
|
|
865
|
+
if (satisfy(E, u))
|
|
866
866
|
return _;
|
|
867
867
|
}
|
|
868
868
|
}, y = {
|
|
@@ -880,11 +880,11 @@ function getGlobalShareScope() {
|
|
|
880
880
|
return Global.__FEDERATION__.__SHARE__;
|
|
881
881
|
}
|
|
882
882
|
function getTargetSharedOptions(o) {
|
|
883
|
-
const { pkgName: t, extraOptions: n, shareInfos: r } = o, s = (
|
|
884
|
-
if (!
|
|
883
|
+
const { pkgName: t, extraOptions: n, shareInfos: r } = o, s = (a) => {
|
|
884
|
+
if (!a)
|
|
885
885
|
return;
|
|
886
886
|
const c = {};
|
|
887
|
-
|
|
887
|
+
a.forEach((d) => {
|
|
888
888
|
c[d.version] = d;
|
|
889
889
|
});
|
|
890
890
|
const p = findVersion(c, function(d, m) {
|
|
@@ -892,8 +892,8 @@ function getTargetSharedOptions(o) {
|
|
|
892
892
|
});
|
|
893
893
|
return c[p];
|
|
894
894
|
};
|
|
895
|
-
var
|
|
896
|
-
const l = (
|
|
895
|
+
var i;
|
|
896
|
+
const l = (i = n == null ? void 0 : n.resolver) != null ? i : s;
|
|
897
897
|
return Object.assign({}, l(r[t]), n == null ? void 0 : n.customShareInfo);
|
|
898
898
|
}
|
|
899
899
|
function getBuilderId() {
|
|
@@ -905,9 +905,9 @@ function matchRemoteWithNameAndExpose(o, t) {
|
|
|
905
905
|
let s = t.replace(n.name, "");
|
|
906
906
|
if (r) {
|
|
907
907
|
if (s.startsWith("/")) {
|
|
908
|
-
const
|
|
908
|
+
const a = n.name;
|
|
909
909
|
return s = `.${s}`, {
|
|
910
|
-
pkgNameOrAlias:
|
|
910
|
+
pkgNameOrAlias: a,
|
|
911
911
|
expose: s,
|
|
912
912
|
remote: n
|
|
913
913
|
};
|
|
@@ -918,13 +918,13 @@ function matchRemoteWithNameAndExpose(o, t) {
|
|
|
918
918
|
remote: n
|
|
919
919
|
};
|
|
920
920
|
}
|
|
921
|
-
const
|
|
921
|
+
const i = n.alias && t.startsWith(n.alias);
|
|
922
922
|
let l = n.alias && t.replace(n.alias, "");
|
|
923
|
-
if (n.alias &&
|
|
923
|
+
if (n.alias && i) {
|
|
924
924
|
if (l && l.startsWith("/")) {
|
|
925
|
-
const
|
|
925
|
+
const a = n.alias;
|
|
926
926
|
return l = `.${l}`, {
|
|
927
|
-
pkgNameOrAlias:
|
|
927
|
+
pkgNameOrAlias: a,
|
|
928
928
|
expose: l,
|
|
929
929
|
remote: n
|
|
930
930
|
};
|
|
@@ -952,10 +952,10 @@ function registerPlugins(o, t) {
|
|
|
952
952
|
t.bridgeHook
|
|
953
953
|
];
|
|
954
954
|
return n.length > 0 && n.forEach((s) => {
|
|
955
|
-
o != null && o.find((
|
|
955
|
+
o != null && o.find((i) => i.name !== s.name) && o.push(s);
|
|
956
956
|
}), o && o.length > 0 && o.forEach((s) => {
|
|
957
|
-
r.forEach((
|
|
958
|
-
|
|
957
|
+
r.forEach((i) => {
|
|
958
|
+
i.applyPlugin(s, t);
|
|
959
959
|
});
|
|
960
960
|
}), o;
|
|
961
961
|
}
|
|
@@ -996,20 +996,17 @@ function handleRemoteEntryLoaded(o, t, n) {
|
|
|
996
996
|
remoteEntryKey: r
|
|
997
997
|
})), s;
|
|
998
998
|
}
|
|
999
|
-
async function loadEntryScript({ name: o, globalName: t, entry: n, loaderHook: r
|
|
1000
|
-
const { entryExports:
|
|
1001
|
-
|
|
1002
|
-
return a;
|
|
1003
|
-
const l = s ? s(n) : n;
|
|
1004
|
-
return loadScript(l, {
|
|
999
|
+
async function loadEntryScript({ name: o, globalName: t, entry: n, loaderHook: r }) {
|
|
1000
|
+
const { entryExports: s } = getRemoteEntryExports(o, t);
|
|
1001
|
+
return s || loadScript(n, {
|
|
1005
1002
|
attrs: {},
|
|
1006
|
-
createScriptHook: (i,
|
|
1007
|
-
const
|
|
1003
|
+
createScriptHook: (i, l) => {
|
|
1004
|
+
const a = r.lifecycle.createScript.emit({
|
|
1008
1005
|
url: i,
|
|
1009
|
-
attrs:
|
|
1006
|
+
attrs: l
|
|
1010
1007
|
});
|
|
1011
|
-
if (
|
|
1012
|
-
return
|
|
1008
|
+
if (a && (a instanceof HTMLScriptElement || "script" in a || "timeout" in a))
|
|
1009
|
+
return a;
|
|
1013
1010
|
}
|
|
1014
1011
|
}).then(() => handleRemoteEntryLoaded(o, t, n)).catch((i) => {
|
|
1015
1012
|
throw assert(void 0, getShortErrorMsg(RUNTIME_008, runtimeDescMap, {
|
|
@@ -1018,77 +1015,75 @@ async function loadEntryScript({ name: o, globalName: t, entry: n, loaderHook: r
|
|
|
1018
1015
|
})), i;
|
|
1019
1016
|
});
|
|
1020
1017
|
}
|
|
1021
|
-
async function loadEntryDom({ remoteInfo: o, remoteEntryExports: t, loaderHook: n
|
|
1022
|
-
const { entry:
|
|
1023
|
-
switch (
|
|
1018
|
+
async function loadEntryDom({ remoteInfo: o, remoteEntryExports: t, loaderHook: n }) {
|
|
1019
|
+
const { entry: r, entryGlobalName: s, name: i, type: l } = o;
|
|
1020
|
+
switch (l) {
|
|
1024
1021
|
case "esm":
|
|
1025
1022
|
case "module":
|
|
1026
1023
|
return loadEsmEntry({
|
|
1027
|
-
entry:
|
|
1024
|
+
entry: r,
|
|
1028
1025
|
remoteEntryExports: t
|
|
1029
1026
|
});
|
|
1030
1027
|
case "system":
|
|
1031
1028
|
return loadSystemJsEntry({
|
|
1032
|
-
entry:
|
|
1029
|
+
entry: r,
|
|
1033
1030
|
remoteEntryExports: t
|
|
1034
1031
|
});
|
|
1035
1032
|
default:
|
|
1036
1033
|
return loadEntryScript({
|
|
1037
|
-
entry:
|
|
1038
|
-
globalName:
|
|
1039
|
-
name:
|
|
1040
|
-
loaderHook: n
|
|
1041
|
-
getRetryPath: r
|
|
1034
|
+
entry: r,
|
|
1035
|
+
globalName: s,
|
|
1036
|
+
name: i,
|
|
1037
|
+
loaderHook: n
|
|
1042
1038
|
});
|
|
1043
1039
|
}
|
|
1044
1040
|
}
|
|
1045
1041
|
async function loadEntryNode({ remoteInfo: o, loaderHook: t }) {
|
|
1046
|
-
const { entry: n, entryGlobalName: r, name: s, type:
|
|
1042
|
+
const { entry: n, entryGlobalName: r, name: s, type: i } = o, { entryExports: l } = getRemoteEntryExports(s, r);
|
|
1047
1043
|
return l || loadScriptNode(n, {
|
|
1048
1044
|
attrs: {
|
|
1049
1045
|
name: s,
|
|
1050
1046
|
globalName: r,
|
|
1051
|
-
type:
|
|
1047
|
+
type: i
|
|
1052
1048
|
},
|
|
1053
1049
|
loaderHook: {
|
|
1054
|
-
createScriptHook: (
|
|
1050
|
+
createScriptHook: (a, c = {}) => {
|
|
1055
1051
|
const u = t.lifecycle.createScript.emit({
|
|
1056
|
-
url:
|
|
1052
|
+
url: a,
|
|
1057
1053
|
attrs: c
|
|
1058
1054
|
});
|
|
1059
1055
|
if (u && "url" in u)
|
|
1060
1056
|
return u;
|
|
1061
1057
|
}
|
|
1062
1058
|
}
|
|
1063
|
-
}).then(() => handleRemoteEntryLoaded(s, r, n)).catch((
|
|
1064
|
-
throw
|
|
1059
|
+
}).then(() => handleRemoteEntryLoaded(s, r, n)).catch((a) => {
|
|
1060
|
+
throw a;
|
|
1065
1061
|
});
|
|
1066
1062
|
}
|
|
1067
1063
|
function getRemoteEntryUniqueKey(o) {
|
|
1068
1064
|
const { entry: t, name: n } = o;
|
|
1069
1065
|
return composeKeyWithSeparator(n, t);
|
|
1070
1066
|
}
|
|
1071
|
-
async function getRemoteEntry(o) {
|
|
1072
|
-
const
|
|
1073
|
-
if (
|
|
1074
|
-
return
|
|
1075
|
-
if (!globalLoading[
|
|
1076
|
-
const
|
|
1077
|
-
globalLoading[
|
|
1078
|
-
loaderHook: i,
|
|
1079
|
-
remoteInfo: r,
|
|
1080
|
-
remoteEntryExports: n
|
|
1081
|
-
}).then((c) => c || ((typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : isBrowserEnv()) ? loadEntryDom({
|
|
1082
|
-
remoteInfo: r,
|
|
1083
|
-
remoteEntryExports: n,
|
|
1067
|
+
async function getRemoteEntry({ origin: o, remoteEntryExports: t, remoteInfo: n }) {
|
|
1068
|
+
const r = getRemoteEntryUniqueKey(n);
|
|
1069
|
+
if (t)
|
|
1070
|
+
return t;
|
|
1071
|
+
if (!globalLoading[r]) {
|
|
1072
|
+
const s = o.remoteHandler.hooks.lifecycle.loadEntry, i = o.loaderHook;
|
|
1073
|
+
globalLoading[r] = s.emit({
|
|
1084
1074
|
loaderHook: i,
|
|
1085
|
-
|
|
1075
|
+
remoteInfo: n,
|
|
1076
|
+
remoteEntryExports: t
|
|
1077
|
+
}).then((l) => l || ((typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : isBrowserEnv()) ? loadEntryDom({
|
|
1078
|
+
remoteInfo: n,
|
|
1079
|
+
remoteEntryExports: t,
|
|
1080
|
+
loaderHook: i
|
|
1086
1081
|
}) : loadEntryNode({
|
|
1087
|
-
remoteInfo:
|
|
1082
|
+
remoteInfo: n,
|
|
1088
1083
|
loaderHook: i
|
|
1089
1084
|
})));
|
|
1090
1085
|
}
|
|
1091
|
-
return globalLoading[
|
|
1086
|
+
return globalLoading[r];
|
|
1092
1087
|
}
|
|
1093
1088
|
function getRemoteInfo(o) {
|
|
1094
1089
|
return _extends$1({}, o, {
|
|
@@ -1122,10 +1117,10 @@ function normalizePreloadExposes(o) {
|
|
|
1122
1117
|
return o ? o.map((t) => t === "." ? t : t.startsWith("./") ? t.replace("./", "") : t) : [];
|
|
1123
1118
|
}
|
|
1124
1119
|
function preloadAssets(o, t, n, r = !0) {
|
|
1125
|
-
const { cssAssets: s, jsAssetsWithoutEntry:
|
|
1120
|
+
const { cssAssets: s, jsAssetsWithoutEntry: i, entryAssets: l } = n;
|
|
1126
1121
|
if (t.options.inBrowser) {
|
|
1127
|
-
if (l.forEach((
|
|
1128
|
-
const { moduleInfo: c } =
|
|
1122
|
+
if (l.forEach((a) => {
|
|
1123
|
+
const { moduleInfo: c } = a, u = t.moduleCache.get(o.name);
|
|
1129
1124
|
getRemoteEntry(u ? {
|
|
1130
1125
|
origin: t,
|
|
1131
1126
|
remoteInfo: c,
|
|
@@ -1136,7 +1131,7 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1136
1131
|
remoteEntryExports: void 0
|
|
1137
1132
|
});
|
|
1138
1133
|
}), r) {
|
|
1139
|
-
const
|
|
1134
|
+
const a = {
|
|
1140
1135
|
rel: "preload",
|
|
1141
1136
|
as: "style"
|
|
1142
1137
|
};
|
|
@@ -1145,7 +1140,7 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1145
1140
|
url: c,
|
|
1146
1141
|
cb: () => {
|
|
1147
1142
|
},
|
|
1148
|
-
attrs:
|
|
1143
|
+
attrs: a,
|
|
1149
1144
|
createLinkHook: (d, m) => {
|
|
1150
1145
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1151
1146
|
url: d,
|
|
@@ -1158,7 +1153,7 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1158
1153
|
p && document.head.appendChild(u);
|
|
1159
1154
|
});
|
|
1160
1155
|
} else {
|
|
1161
|
-
const
|
|
1156
|
+
const a = {
|
|
1162
1157
|
rel: "stylesheet",
|
|
1163
1158
|
type: "text/css"
|
|
1164
1159
|
};
|
|
@@ -1167,7 +1162,7 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1167
1162
|
url: c,
|
|
1168
1163
|
cb: () => {
|
|
1169
1164
|
},
|
|
1170
|
-
attrs:
|
|
1165
|
+
attrs: a,
|
|
1171
1166
|
createLinkHook: (d, m) => {
|
|
1172
1167
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1173
1168
|
url: d,
|
|
@@ -1182,16 +1177,16 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1182
1177
|
});
|
|
1183
1178
|
}
|
|
1184
1179
|
if (r) {
|
|
1185
|
-
const
|
|
1180
|
+
const a = {
|
|
1186
1181
|
rel: "preload",
|
|
1187
1182
|
as: "script"
|
|
1188
1183
|
};
|
|
1189
|
-
|
|
1184
|
+
i.forEach((c) => {
|
|
1190
1185
|
const { link: u, needAttach: p } = createLink({
|
|
1191
1186
|
url: c,
|
|
1192
1187
|
cb: () => {
|
|
1193
1188
|
},
|
|
1194
|
-
attrs:
|
|
1189
|
+
attrs: a,
|
|
1195
1190
|
createLinkHook: (d, m) => {
|
|
1196
1191
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1197
1192
|
url: d,
|
|
@@ -1204,16 +1199,16 @@ function preloadAssets(o, t, n, r = !0) {
|
|
|
1204
1199
|
p && document.head.appendChild(u);
|
|
1205
1200
|
});
|
|
1206
1201
|
} else {
|
|
1207
|
-
const
|
|
1202
|
+
const a = {
|
|
1208
1203
|
fetchpriority: "high",
|
|
1209
1204
|
type: (o == null ? void 0 : o.type) === "module" ? "module" : "text/javascript"
|
|
1210
1205
|
};
|
|
1211
|
-
|
|
1206
|
+
i.forEach((c) => {
|
|
1212
1207
|
const { script: u, needAttach: p } = createScript({
|
|
1213
1208
|
url: c,
|
|
1214
1209
|
cb: () => {
|
|
1215
1210
|
},
|
|
1216
|
-
attrs:
|
|
1211
|
+
attrs: a,
|
|
1217
1212
|
createScriptHook: (d, m) => {
|
|
1218
1213
|
const y = t.loaderHook.lifecycle.createScript.emit({
|
|
1219
1214
|
url: d,
|
|
@@ -1256,7 +1251,7 @@ let Module = class {
|
|
|
1256
1251
|
}
|
|
1257
1252
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1258
1253
|
async get(t, n, r, s) {
|
|
1259
|
-
const { loadFactory:
|
|
1254
|
+
const { loadFactory: i = !0 } = r || {
|
|
1260
1255
|
loadFactory: !0
|
|
1261
1256
|
}, l = await this.getEntry();
|
|
1262
1257
|
if (!this.inited) {
|
|
@@ -1266,11 +1261,11 @@ let Module = class {
|
|
|
1266
1261
|
m.length || m.push("default"), m.forEach((b) => {
|
|
1267
1262
|
d[b] || (d[b] = {});
|
|
1268
1263
|
});
|
|
1269
|
-
const y = d[m[0]],
|
|
1264
|
+
const y = d[m[0]], g = [], E = {
|
|
1270
1265
|
version: this.remoteInfo.version || "",
|
|
1271
1266
|
shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? m : this.remoteInfo.shareScope || "default"
|
|
1272
1267
|
};
|
|
1273
|
-
Object.defineProperty(
|
|
1268
|
+
Object.defineProperty(E, "shareScopeMap", {
|
|
1274
1269
|
value: d,
|
|
1275
1270
|
// remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
|
|
1276
1271
|
enumerable: !1
|
|
@@ -1278,8 +1273,8 @@ let Module = class {
|
|
|
1278
1273
|
const _ = await this.host.hooks.lifecycle.beforeInitContainer.emit({
|
|
1279
1274
|
shareScope: y,
|
|
1280
1275
|
// @ts-ignore shareScopeMap will be set by Object.defineProperty
|
|
1281
|
-
remoteEntryInitOptions:
|
|
1282
|
-
initScope:
|
|
1276
|
+
remoteEntryInitOptions: E,
|
|
1277
|
+
initScope: g,
|
|
1283
1278
|
remoteInfo: this.remoteInfo,
|
|
1284
1279
|
origin: this.host
|
|
1285
1280
|
});
|
|
@@ -1295,19 +1290,19 @@ let Module = class {
|
|
|
1295
1290
|
}));
|
|
1296
1291
|
}
|
|
1297
1292
|
this.lib = l, this.inited = !0;
|
|
1298
|
-
let
|
|
1299
|
-
|
|
1293
|
+
let a;
|
|
1294
|
+
a = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
1300
1295
|
remoteEntryExports: l,
|
|
1301
1296
|
expose: n,
|
|
1302
1297
|
moduleInfo: this.remoteInfo
|
|
1303
|
-
}),
|
|
1304
|
-
const c = processModuleAlias(this.remoteInfo.name, n), u = this.wraperFactory(
|
|
1305
|
-
return
|
|
1298
|
+
}), a || (a = await l.get(n)), assert(a, `${getFMId(this.remoteInfo)} remote don't export ${n}.`);
|
|
1299
|
+
const c = processModuleAlias(this.remoteInfo.name, n), u = this.wraperFactory(a, c);
|
|
1300
|
+
return i ? await u() : u;
|
|
1306
1301
|
}
|
|
1307
1302
|
wraperFactory(t, n) {
|
|
1308
|
-
function r(s,
|
|
1303
|
+
function r(s, i) {
|
|
1309
1304
|
s && typeof s == "object" && Object.isExtensible(s) && !Object.getOwnPropertyDescriptor(s, Symbol.for("mf_module_id")) && Object.defineProperty(s, Symbol.for("mf_module_id"), {
|
|
1310
|
-
value:
|
|
1305
|
+
value: i,
|
|
1311
1306
|
enumerable: !1
|
|
1312
1307
|
});
|
|
1313
1308
|
}
|
|
@@ -1355,8 +1350,8 @@ class AsyncHook extends SyncHook {
|
|
|
1355
1350
|
const r = Array.from(this.listeners);
|
|
1356
1351
|
if (r.length > 0) {
|
|
1357
1352
|
let s = 0;
|
|
1358
|
-
const
|
|
1359
|
-
n =
|
|
1353
|
+
const i = (l) => l === !1 ? !1 : s < r.length ? Promise.resolve(r[s++].apply(null, t)).then(i) : l;
|
|
1354
|
+
n = i();
|
|
1360
1355
|
}
|
|
1361
1356
|
return Promise.resolve(n);
|
|
1362
1357
|
}
|
|
@@ -1398,19 +1393,19 @@ class AsyncWaterfallHook extends SyncHook {
|
|
|
1398
1393
|
const n = Array.from(this.listeners);
|
|
1399
1394
|
if (n.length > 0) {
|
|
1400
1395
|
let r = 0;
|
|
1401
|
-
const s = (l) => (warn(l), this.onerror(l), t),
|
|
1396
|
+
const s = (l) => (warn(l), this.onerror(l), t), i = (l) => {
|
|
1402
1397
|
if (checkReturnData(t, l)) {
|
|
1403
1398
|
if (t = l, r < n.length)
|
|
1404
1399
|
try {
|
|
1405
|
-
return Promise.resolve(n[r++](t)).then(
|
|
1406
|
-
} catch (
|
|
1407
|
-
return s(
|
|
1400
|
+
return Promise.resolve(n[r++](t)).then(i, s);
|
|
1401
|
+
} catch (a) {
|
|
1402
|
+
return s(a);
|
|
1408
1403
|
}
|
|
1409
1404
|
} else
|
|
1410
1405
|
this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
|
|
1411
1406
|
return t;
|
|
1412
1407
|
};
|
|
1413
|
-
return Promise.resolve(
|
|
1408
|
+
return Promise.resolve(i(t));
|
|
1414
1409
|
}
|
|
1415
1410
|
return Promise.resolve(t);
|
|
1416
1411
|
}
|
|
@@ -1423,8 +1418,8 @@ class PluginSystem {
|
|
|
1423
1418
|
assert(isPlainObject(t), "Plugin configuration is invalid.");
|
|
1424
1419
|
const r = t.name;
|
|
1425
1420
|
assert(r, "A name must be provided by the plugin."), this.registerPlugins[r] || (this.registerPlugins[r] = t, t.apply == null || t.apply.call(t, n), Object.keys(this.lifecycle).forEach((s) => {
|
|
1426
|
-
const
|
|
1427
|
-
|
|
1421
|
+
const i = t[s];
|
|
1422
|
+
i && this.lifecycle[s].on(i);
|
|
1428
1423
|
}));
|
|
1429
1424
|
}
|
|
1430
1425
|
removePlugin(t) {
|
|
@@ -1448,13 +1443,13 @@ function snapshotPlugin() {
|
|
|
1448
1443
|
return {
|
|
1449
1444
|
name: "snapshot-plugin",
|
|
1450
1445
|
async afterResolve(o) {
|
|
1451
|
-
const { remote: t, pkgNameOrAlias: n, expose: r, origin: s, remoteInfo:
|
|
1446
|
+
const { remote: t, pkgNameOrAlias: n, expose: r, origin: s, remoteInfo: i, id: l } = o;
|
|
1452
1447
|
if (!isRemoteInfoWithEntry(t) || !isPureRemoteEntry(t)) {
|
|
1453
|
-
const { remoteSnapshot:
|
|
1448
|
+
const { remoteSnapshot: a, globalSnapshot: c } = await s.snapshotHandler.loadRemoteSnapshotInfo({
|
|
1454
1449
|
moduleInfo: t,
|
|
1455
1450
|
id: l
|
|
1456
1451
|
});
|
|
1457
|
-
assignRemoteInfo(
|
|
1452
|
+
assignRemoteInfo(i, a);
|
|
1458
1453
|
const u = {
|
|
1459
1454
|
remote: t,
|
|
1460
1455
|
preloadConfig: {
|
|
@@ -1469,13 +1464,13 @@ function snapshotPlugin() {
|
|
|
1469
1464
|
}, p = await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
|
|
1470
1465
|
origin: s,
|
|
1471
1466
|
preloadOptions: u,
|
|
1472
|
-
remoteInfo:
|
|
1467
|
+
remoteInfo: i,
|
|
1473
1468
|
remote: t,
|
|
1474
|
-
remoteSnapshot:
|
|
1469
|
+
remoteSnapshot: a,
|
|
1475
1470
|
globalSnapshot: c
|
|
1476
1471
|
});
|
|
1477
|
-
return p && preloadAssets(
|
|
1478
|
-
remoteSnapshot:
|
|
1472
|
+
return p && preloadAssets(i, s, p, !1), _extends$1({}, o, {
|
|
1473
|
+
remoteSnapshot: a
|
|
1479
1474
|
});
|
|
1480
1475
|
}
|
|
1481
1476
|
return o;
|
|
@@ -1495,8 +1490,8 @@ function splitId(o) {
|
|
|
1495
1490
|
version: t[2]
|
|
1496
1491
|
};
|
|
1497
1492
|
}
|
|
1498
|
-
function traverseModuleInfo(o, t, n, r, s = {},
|
|
1499
|
-
const l = getFMId(t), { value:
|
|
1493
|
+
function traverseModuleInfo(o, t, n, r, s = {}, i) {
|
|
1494
|
+
const l = getFMId(t), { value: a } = getInfoWithoutType(o, l), c = i || a;
|
|
1500
1495
|
if (c && !isManifestProvider(c) && (n(c, t, r), c.remotesInfo)) {
|
|
1501
1496
|
const u = Object.keys(c.remotesInfo);
|
|
1502
1497
|
for (const p of u) {
|
|
@@ -1513,7 +1508,7 @@ function traverseModuleInfo(o, t, n, r, s = {}, a) {
|
|
|
1513
1508
|
}
|
|
1514
1509
|
const isExisted = (o, t) => document.querySelector(`${o}[${o === "link" ? "href" : "src"}="${t}"]`);
|
|
1515
1510
|
function generatePreloadAssets(o, t, n, r, s) {
|
|
1516
|
-
const
|
|
1511
|
+
const i = [], l = [], a = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: p } = o, { preloadConfig: d } = t, { depsRemote: m } = d;
|
|
1517
1512
|
if (traverseModuleInfo(r, n, (_, b, v) => {
|
|
1518
1513
|
let I;
|
|
1519
1514
|
if (v)
|
|
@@ -1528,7 +1523,7 @@ function generatePreloadAssets(o, t, n, r, s) {
|
|
|
1528
1523
|
else
|
|
1529
1524
|
return;
|
|
1530
1525
|
const S = getResourceUrl(_, getRemoteEntryInfoFromSnapshot(_).url);
|
|
1531
|
-
S &&
|
|
1526
|
+
S && a.push({
|
|
1532
1527
|
name: b.name,
|
|
1533
1528
|
moduleInfo: {
|
|
1534
1529
|
name: b.name,
|
|
@@ -1561,7 +1556,7 @@ function generatePreloadAssets(o, t, n, r, s) {
|
|
|
1561
1556
|
preloadConfig: I,
|
|
1562
1557
|
remote: b,
|
|
1563
1558
|
origin: o
|
|
1564
|
-
}), !getPreloaded(M) && (I.resourceCategory === "all" ? (
|
|
1559
|
+
}), !getPreloaded(M) && (I.resourceCategory === "all" ? (i.push(...$(w.assets.css.async)), i.push(...$(w.assets.css.sync)), l.push(...$(w.assets.js.async)), l.push(...$(w.assets.js.sync))) : (I.resourceCategory = "sync") && (i.push(...$(w.assets.css.sync)), l.push(...$(w.assets.js.sync))), setPreloaded(M));
|
|
1565
1560
|
}
|
|
1566
1561
|
}
|
|
1567
1562
|
}, !0, {}, s), s.shared && s.shared.length > 0) {
|
|
@@ -1586,18 +1581,18 @@ function generatePreloadAssets(o, t, n, r, s) {
|
|
|
1586
1581
|
});
|
|
1587
1582
|
});
|
|
1588
1583
|
}
|
|
1589
|
-
const
|
|
1584
|
+
const g = l.filter((_) => !c.has(_) && !isExisted("script", _));
|
|
1590
1585
|
return {
|
|
1591
|
-
cssAssets:
|
|
1592
|
-
jsAssetsWithoutEntry:
|
|
1593
|
-
entryAssets:
|
|
1586
|
+
cssAssets: i.filter((_) => !u.has(_) && !isExisted("link", _)),
|
|
1587
|
+
jsAssetsWithoutEntry: g,
|
|
1588
|
+
entryAssets: a.filter((_) => !isExisted("script", _.url))
|
|
1594
1589
|
};
|
|
1595
1590
|
}
|
|
1596
1591
|
const generatePreloadAssetsPlugin = function() {
|
|
1597
1592
|
return {
|
|
1598
1593
|
name: "generate-preload-assets-plugin",
|
|
1599
1594
|
async generatePreloadAssets(o) {
|
|
1600
|
-
const { origin: t, preloadOptions: n, remoteInfo: r, remote: s, globalSnapshot:
|
|
1595
|
+
const { origin: t, preloadOptions: n, remoteInfo: r, remote: s, globalSnapshot: i, remoteSnapshot: l } = o;
|
|
1601
1596
|
return isBrowserEnv() ? isRemoteInfoWithEntry(s) && isPureRemoteEntry(s) ? {
|
|
1602
1597
|
cssAssets: [],
|
|
1603
1598
|
jsAssetsWithoutEntry: [],
|
|
@@ -1614,7 +1609,7 @@ const generatePreloadAssetsPlugin = function() {
|
|
|
1614
1609
|
}
|
|
1615
1610
|
}
|
|
1616
1611
|
]
|
|
1617
|
-
} : (assignRemoteInfo(r, l), generatePreloadAssets(t, n, r,
|
|
1612
|
+
} : (assignRemoteInfo(r, l), generatePreloadAssets(t, n, r, i, l)) : {
|
|
1618
1613
|
cssAssets: [],
|
|
1619
1614
|
jsAssetsWithoutEntry: [],
|
|
1620
1615
|
entryAssets: []
|
|
@@ -1651,37 +1646,37 @@ class SnapshotHandler {
|
|
|
1651
1646
|
options: s,
|
|
1652
1647
|
moduleInfo: t
|
|
1653
1648
|
});
|
|
1654
|
-
let
|
|
1649
|
+
let i = getGlobalSnapshotInfoByModuleInfo({
|
|
1655
1650
|
name: this.HostInstance.options.name,
|
|
1656
1651
|
version: this.HostInstance.options.version
|
|
1657
1652
|
});
|
|
1658
|
-
|
|
1653
|
+
i || (i = {
|
|
1659
1654
|
version: this.HostInstance.options.version || "",
|
|
1660
1655
|
remoteEntry: "",
|
|
1661
1656
|
remotesInfo: {}
|
|
1662
1657
|
}, addGlobalSnapshot({
|
|
1663
|
-
[this.HostInstance.options.name]:
|
|
1664
|
-
})),
|
|
1658
|
+
[this.HostInstance.options.name]: i
|
|
1659
|
+
})), i && "remotesInfo" in i && !getInfoWithoutType(i.remotesInfo, t.name).value && ("version" in t || "entry" in t) && (i.remotesInfo = _extends$1({}, i == null ? void 0 : i.remotesInfo, {
|
|
1665
1660
|
[t.name]: {
|
|
1666
1661
|
matchedVersion: "version" in t ? t.version : t.entry
|
|
1667
1662
|
}
|
|
1668
1663
|
}));
|
|
1669
|
-
const { hostGlobalSnapshot: l, remoteSnapshot:
|
|
1664
|
+
const { hostGlobalSnapshot: l, remoteSnapshot: a, globalSnapshot: c } = this.getGlobalRemoteInfo(t), { remoteSnapshot: u, globalSnapshot: p } = await this.hooks.lifecycle.loadSnapshot.emit({
|
|
1670
1665
|
options: s,
|
|
1671
1666
|
moduleInfo: t,
|
|
1672
1667
|
hostGlobalSnapshot: l,
|
|
1673
|
-
remoteSnapshot:
|
|
1668
|
+
remoteSnapshot: a,
|
|
1674
1669
|
globalSnapshot: c
|
|
1675
1670
|
});
|
|
1676
1671
|
let d, m;
|
|
1677
1672
|
if (u)
|
|
1678
1673
|
if (isManifestProvider(u)) {
|
|
1679
|
-
const y = isBrowserEnv() ? u.remoteEntry : u.ssrRemoteEntry || u.remoteEntry || "",
|
|
1674
|
+
const y = isBrowserEnv() ? u.remoteEntry : u.ssrRemoteEntry || u.remoteEntry || "", g = await this.getManifestJson(y, t, {}), E = setGlobalSnapshotInfoByModuleInfo(_extends$1({}, t, {
|
|
1680
1675
|
// The global remote may be overridden
|
|
1681
1676
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
1682
1677
|
entry: y
|
|
1683
|
-
}),
|
|
1684
|
-
d =
|
|
1678
|
+
}), g);
|
|
1679
|
+
d = g, m = E;
|
|
1685
1680
|
} else {
|
|
1686
1681
|
const { remoteSnapshot: y } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1687
1682
|
options: this.HostInstance.options,
|
|
@@ -1692,13 +1687,13 @@ class SnapshotHandler {
|
|
|
1692
1687
|
d = y, m = p;
|
|
1693
1688
|
}
|
|
1694
1689
|
else if (isRemoteInfoWithEntry(t)) {
|
|
1695
|
-
const y = await this.getManifestJson(t.entry, t, {}),
|
|
1690
|
+
const y = await this.getManifestJson(t.entry, t, {}), g = setGlobalSnapshotInfoByModuleInfo(t, y), { remoteSnapshot: E } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1696
1691
|
options: this.HostInstance.options,
|
|
1697
1692
|
moduleInfo: t,
|
|
1698
1693
|
remoteSnapshot: y,
|
|
1699
1694
|
from: "global"
|
|
1700
1695
|
});
|
|
1701
|
-
d =
|
|
1696
|
+
d = E, m = g;
|
|
1702
1697
|
} else
|
|
1703
1698
|
error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
|
|
1704
1699
|
hostName: t.name,
|
|
@@ -1725,12 +1720,12 @@ class SnapshotHandler {
|
|
|
1725
1720
|
if (l)
|
|
1726
1721
|
return l;
|
|
1727
1722
|
try {
|
|
1728
|
-
let
|
|
1729
|
-
(!
|
|
1730
|
-
} catch (
|
|
1723
|
+
let a = await this.loaderHook.lifecycle.fetch.emit(t, {});
|
|
1724
|
+
(!a || !(a instanceof Response)) && (a = await fetch(t, {})), l = await a.json();
|
|
1725
|
+
} catch (a) {
|
|
1731
1726
|
l = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
1732
1727
|
id: t,
|
|
1733
|
-
error:
|
|
1728
|
+
error: a,
|
|
1734
1729
|
from: "runtime",
|
|
1735
1730
|
lifecycle: "afterResolve",
|
|
1736
1731
|
origin: this.HostInstance
|
|
@@ -1738,23 +1733,23 @@ class SnapshotHandler {
|
|
|
1738
1733
|
manifestUrl: t,
|
|
1739
1734
|
moduleName: n.name,
|
|
1740
1735
|
hostName: this.HostInstance.options.name
|
|
1741
|
-
}, `${
|
|
1736
|
+
}, `${a}`)));
|
|
1742
1737
|
}
|
|
1743
1738
|
return assert(l.metaData && l.exposes && l.shared, `${t} is not a federation manifest`), this.manifestCache.set(t, l), l;
|
|
1744
|
-
},
|
|
1745
|
-
const l = await s(),
|
|
1739
|
+
}, i = async () => {
|
|
1740
|
+
const l = await s(), a = generateSnapshotFromManifest(l, {
|
|
1746
1741
|
version: t
|
|
1747
1742
|
}), { remoteSnapshot: c } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1748
1743
|
options: this.HostInstance.options,
|
|
1749
1744
|
moduleInfo: n,
|
|
1750
1745
|
manifestJson: l,
|
|
1751
|
-
remoteSnapshot:
|
|
1746
|
+
remoteSnapshot: a,
|
|
1752
1747
|
manifestUrl: t,
|
|
1753
1748
|
from: "manifest"
|
|
1754
1749
|
});
|
|
1755
1750
|
return c;
|
|
1756
1751
|
};
|
|
1757
|
-
return this.manifestLoading[t] || (this.manifestLoading[t] =
|
|
1752
|
+
return this.manifestLoading[t] || (this.manifestLoading[t] = i().then((l) => l)), this.manifestLoading[t];
|
|
1758
1753
|
}
|
|
1759
1754
|
constructor(t) {
|
|
1760
1755
|
this.loadingHostSnapshot = null, this.manifestCache = /* @__PURE__ */ new Map(), this.hooks = new PluginSystem({
|
|
@@ -1796,30 +1791,30 @@ class SharedHandler {
|
|
|
1796
1791
|
strategy: s.strategy
|
|
1797
1792
|
}));
|
|
1798
1793
|
}));
|
|
1799
|
-
const
|
|
1794
|
+
const i = await this.hooks.lifecycle.beforeLoadShare.emit({
|
|
1800
1795
|
pkgName: t,
|
|
1801
1796
|
shareInfo: s,
|
|
1802
1797
|
shared: r.options.shared,
|
|
1803
1798
|
origin: r
|
|
1804
|
-
}), { shareInfo: l } =
|
|
1799
|
+
}), { shareInfo: l } = i;
|
|
1805
1800
|
assert(l, `Cannot find ${t} Share in the ${r.options.name}. Please ensure that the ${t} Share parameters have been injected`);
|
|
1806
|
-
const
|
|
1801
|
+
const a = getRegisteredShare(this.shareScopeMap, t, l, this.hooks.lifecycle.resolveShare), c = (u) => {
|
|
1807
1802
|
u.useIn || (u.useIn = []), addUniqueItem(u.useIn, r.options.name);
|
|
1808
1803
|
};
|
|
1809
|
-
if (
|
|
1810
|
-
return c(
|
|
1811
|
-
if (
|
|
1812
|
-
const u = await
|
|
1813
|
-
return
|
|
1814
|
-
} else if (
|
|
1804
|
+
if (a && a.lib)
|
|
1805
|
+
return c(a), a.lib;
|
|
1806
|
+
if (a && a.loading && !a.loaded) {
|
|
1807
|
+
const u = await a.loading;
|
|
1808
|
+
return a.loaded = !0, a.lib || (a.lib = u), c(a), u;
|
|
1809
|
+
} else if (a) {
|
|
1815
1810
|
const p = (async () => {
|
|
1816
|
-
const d = await
|
|
1817
|
-
return c(
|
|
1811
|
+
const d = await a.get();
|
|
1812
|
+
return c(a), a.loaded = !0, a.lib = d, d;
|
|
1818
1813
|
})();
|
|
1819
1814
|
return this.setShared({
|
|
1820
1815
|
pkgName: t,
|
|
1821
1816
|
loaded: !1,
|
|
1822
|
-
shared:
|
|
1817
|
+
shared: a,
|
|
1823
1818
|
from: r.options.name,
|
|
1824
1819
|
lib: null,
|
|
1825
1820
|
loading: p
|
|
@@ -1850,53 +1845,53 @@ class SharedHandler {
|
|
|
1850
1845
|
*/
|
|
1851
1846
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1852
1847
|
initializeSharing(t = DEFAULT_SCOPE, n) {
|
|
1853
|
-
const { host: r } = this, s = n == null ? void 0 : n.from,
|
|
1848
|
+
const { host: r } = this, s = n == null ? void 0 : n.from, i = n == null ? void 0 : n.strategy;
|
|
1854
1849
|
let l = n == null ? void 0 : n.initScope;
|
|
1855
|
-
const
|
|
1850
|
+
const a = [];
|
|
1856
1851
|
if (s !== "build") {
|
|
1857
|
-
const { initTokens:
|
|
1852
|
+
const { initTokens: g } = this;
|
|
1858
1853
|
l || (l = []);
|
|
1859
|
-
let
|
|
1860
|
-
if (
|
|
1854
|
+
let E = g[t];
|
|
1855
|
+
if (E || (E = g[t] = {
|
|
1861
1856
|
from: this.host.name
|
|
1862
|
-
}), l.indexOf(
|
|
1863
|
-
l.push(
|
|
1857
|
+
}), l.indexOf(E) >= 0) return a;
|
|
1858
|
+
l.push(E);
|
|
1864
1859
|
}
|
|
1865
1860
|
const c = this.shareScopeMap, u = r.options.name;
|
|
1866
1861
|
c[t] || (c[t] = {});
|
|
1867
|
-
const p = c[t], d = (
|
|
1862
|
+
const p = c[t], d = (g, E) => {
|
|
1868
1863
|
var _;
|
|
1869
|
-
const { version: b, eager: v } =
|
|
1870
|
-
p[
|
|
1871
|
-
const I = p[
|
|
1872
|
-
(!S || S.strategy !== "loaded-first" && !S.loaded && (!v != !R ? v : u > S.from)) && (I[b] =
|
|
1873
|
-
}, m = (
|
|
1874
|
-
const { module:
|
|
1875
|
-
id:
|
|
1864
|
+
const { version: b, eager: v } = E;
|
|
1865
|
+
p[g] = p[g] || {};
|
|
1866
|
+
const I = p[g], S = I[b], R = !!(S && (S.eager || (_ = S.shareConfig) != null && _.eager));
|
|
1867
|
+
(!S || S.strategy !== "loaded-first" && !S.loaded && (!v != !R ? v : u > S.from)) && (I[b] = E);
|
|
1868
|
+
}, m = (g) => g && g.init && g.init(c[t], l), y = async (g) => {
|
|
1869
|
+
const { module: E } = await r.remoteHandler.getRemoteModuleAndOptions({
|
|
1870
|
+
id: g
|
|
1876
1871
|
});
|
|
1877
|
-
if (
|
|
1872
|
+
if (E.getEntry) {
|
|
1878
1873
|
let _;
|
|
1879
1874
|
try {
|
|
1880
|
-
_ = await
|
|
1875
|
+
_ = await E.getEntry();
|
|
1881
1876
|
} catch (b) {
|
|
1882
1877
|
_ = await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
1883
|
-
id:
|
|
1878
|
+
id: g,
|
|
1884
1879
|
error: b,
|
|
1885
1880
|
from: "runtime",
|
|
1886
1881
|
lifecycle: "beforeLoadShare",
|
|
1887
1882
|
origin: r
|
|
1888
1883
|
});
|
|
1889
1884
|
}
|
|
1890
|
-
|
|
1885
|
+
E.inited || (await m(_), E.inited = !0);
|
|
1891
1886
|
}
|
|
1892
1887
|
};
|
|
1893
|
-
return Object.keys(r.options.shared).forEach((
|
|
1894
|
-
r.options.shared[
|
|
1895
|
-
_.scope.includes(t) && d(
|
|
1888
|
+
return Object.keys(r.options.shared).forEach((g) => {
|
|
1889
|
+
r.options.shared[g].forEach((_) => {
|
|
1890
|
+
_.scope.includes(t) && d(g, _);
|
|
1896
1891
|
});
|
|
1897
|
-
}), (r.options.shareStrategy === "version-first" ||
|
|
1898
|
-
|
|
1899
|
-
}),
|
|
1892
|
+
}), (r.options.shareStrategy === "version-first" || i === "version-first") && r.options.remotes.forEach((g) => {
|
|
1893
|
+
g.shareScope === t && a.push(y(g.name));
|
|
1894
|
+
}), a;
|
|
1900
1895
|
}
|
|
1901
1896
|
// The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
|
|
1902
1897
|
// 1. If the loaded shared already exists globally, then it will be reused
|
|
@@ -1908,41 +1903,41 @@ class SharedHandler {
|
|
|
1908
1903
|
extraOptions: n,
|
|
1909
1904
|
shareInfos: r.options.shared
|
|
1910
1905
|
});
|
|
1911
|
-
s != null && s.scope && s.scope.forEach((
|
|
1912
|
-
this.initializeSharing(
|
|
1906
|
+
s != null && s.scope && s.scope.forEach((a) => {
|
|
1907
|
+
this.initializeSharing(a, {
|
|
1913
1908
|
strategy: s.strategy
|
|
1914
1909
|
});
|
|
1915
1910
|
});
|
|
1916
|
-
const
|
|
1917
|
-
|
|
1911
|
+
const i = getRegisteredShare(this.shareScopeMap, t, s, this.hooks.lifecycle.resolveShare), l = (a) => {
|
|
1912
|
+
a.useIn || (a.useIn = []), addUniqueItem(a.useIn, r.options.name);
|
|
1918
1913
|
};
|
|
1919
|
-
if (
|
|
1920
|
-
if (typeof
|
|
1921
|
-
return l(
|
|
1922
|
-
if (typeof
|
|
1923
|
-
const
|
|
1924
|
-
if (!(
|
|
1925
|
-
return l(
|
|
1914
|
+
if (i) {
|
|
1915
|
+
if (typeof i.lib == "function")
|
|
1916
|
+
return l(i), i.loaded || (i.loaded = !0, i.from === r.options.name && (s.loaded = !0)), i.lib;
|
|
1917
|
+
if (typeof i.get == "function") {
|
|
1918
|
+
const a = i.get();
|
|
1919
|
+
if (!(a instanceof Promise))
|
|
1920
|
+
return l(i), this.setShared({
|
|
1926
1921
|
pkgName: t,
|
|
1927
1922
|
loaded: !0,
|
|
1928
1923
|
from: r.options.name,
|
|
1929
|
-
lib:
|
|
1930
|
-
shared:
|
|
1931
|
-
}),
|
|
1924
|
+
lib: a,
|
|
1925
|
+
shared: i
|
|
1926
|
+
}), a;
|
|
1932
1927
|
}
|
|
1933
1928
|
}
|
|
1934
1929
|
if (s.lib)
|
|
1935
1930
|
return s.loaded || (s.loaded = !0), s.lib;
|
|
1936
1931
|
if (s.get) {
|
|
1937
|
-
const
|
|
1938
|
-
if (
|
|
1932
|
+
const a = s.get();
|
|
1933
|
+
if (a instanceof Promise) {
|
|
1939
1934
|
const c = (n == null ? void 0 : n.from) === "build" ? RUNTIME_005 : RUNTIME_006;
|
|
1940
1935
|
throw new Error(getShortErrorMsg(c, runtimeDescMap, {
|
|
1941
1936
|
hostName: r.options.name,
|
|
1942
1937
|
sharedPkgName: t
|
|
1943
1938
|
}));
|
|
1944
1939
|
}
|
|
1945
|
-
return s.lib =
|
|
1940
|
+
return s.lib = a, this.setShared({
|
|
1946
1941
|
pkgName: t,
|
|
1947
1942
|
loaded: !0,
|
|
1948
1943
|
from: r.options.name,
|
|
@@ -1965,7 +1960,7 @@ class SharedHandler {
|
|
|
1965
1960
|
hostShareScopeMap: r.hostShareScopeMap
|
|
1966
1961
|
});
|
|
1967
1962
|
}
|
|
1968
|
-
setShared({ pkgName: t, shared: n, from: r, lib: s, loading:
|
|
1963
|
+
setShared({ pkgName: t, shared: n, from: r, lib: s, loading: i, loaded: l, get: a }) {
|
|
1969
1964
|
const { version: c, scope: u = "default" } = n, p = _object_without_properties_loose(n, [
|
|
1970
1965
|
"version",
|
|
1971
1966
|
"scope"
|
|
@@ -1982,12 +1977,12 @@ class SharedHandler {
|
|
|
1982
1977
|
}, p, {
|
|
1983
1978
|
lib: s,
|
|
1984
1979
|
loaded: l,
|
|
1985
|
-
loading:
|
|
1986
|
-
}),
|
|
1980
|
+
loading: i
|
|
1981
|
+
}), a && (this.shareScopeMap[m][t][c].get = a);
|
|
1987
1982
|
return;
|
|
1988
1983
|
}
|
|
1989
1984
|
const y = this.shareScopeMap[m][t][c];
|
|
1990
|
-
|
|
1985
|
+
i && !y.loading && (y.loading = i), l && !y.loaded && (y.loaded = l), r && y.from !== r && (y.from = r);
|
|
1991
1986
|
});
|
|
1992
1987
|
}
|
|
1993
1988
|
_setGlobalShareScopeMap(t) {
|
|
@@ -2008,26 +2003,26 @@ class SharedHandler {
|
|
|
2008
2003
|
}
|
|
2009
2004
|
class RemoteHandler {
|
|
2010
2005
|
formatAndRegisterRemote(t, n) {
|
|
2011
|
-
return (n.remotes || []).reduce((s,
|
|
2006
|
+
return (n.remotes || []).reduce((s, i) => (this.registerRemote(i, s, {
|
|
2012
2007
|
force: !1
|
|
2013
2008
|
}), s), t.remotes);
|
|
2014
2009
|
}
|
|
2015
2010
|
setIdToRemoteMap(t, n) {
|
|
2016
|
-
const { remote: r, expose: s } = n, { name:
|
|
2011
|
+
const { remote: r, expose: s } = n, { name: i, alias: l } = r;
|
|
2017
2012
|
if (this.idToRemoteMap[t] = {
|
|
2018
2013
|
name: r.name,
|
|
2019
2014
|
expose: s
|
|
2020
|
-
}, l && t.startsWith(
|
|
2021
|
-
const
|
|
2022
|
-
this.idToRemoteMap[
|
|
2015
|
+
}, l && t.startsWith(i)) {
|
|
2016
|
+
const a = t.replace(i, l);
|
|
2017
|
+
this.idToRemoteMap[a] = {
|
|
2023
2018
|
name: r.name,
|
|
2024
2019
|
expose: s
|
|
2025
2020
|
};
|
|
2026
2021
|
return;
|
|
2027
2022
|
}
|
|
2028
2023
|
if (l && t.startsWith(l)) {
|
|
2029
|
-
const
|
|
2030
|
-
this.idToRemoteMap[
|
|
2024
|
+
const a = t.replace(l, i);
|
|
2025
|
+
this.idToRemoteMap[a] = {
|
|
2031
2026
|
name: r.name,
|
|
2032
2027
|
expose: s
|
|
2033
2028
|
};
|
|
@@ -2040,9 +2035,9 @@ class RemoteHandler {
|
|
|
2040
2035
|
try {
|
|
2041
2036
|
const { loadFactory: s = !0 } = n || {
|
|
2042
2037
|
loadFactory: !0
|
|
2043
|
-
}, { module:
|
|
2038
|
+
}, { module: i, moduleOptions: l, remoteMatchInfo: a } = await this.getRemoteModuleAndOptions({
|
|
2044
2039
|
id: t
|
|
2045
|
-
}), { pkgNameOrAlias: c, remote: u, expose: p, id: d, remoteSnapshot: m } =
|
|
2040
|
+
}), { pkgNameOrAlias: c, remote: u, expose: p, id: d, remoteSnapshot: m } = a, y = await i.get(d, p, n, m), g = await this.hooks.lifecycle.onLoad.emit({
|
|
2046
2041
|
id: d,
|
|
2047
2042
|
pkgNameOrAlias: c,
|
|
2048
2043
|
expose: p,
|
|
@@ -2050,17 +2045,17 @@ class RemoteHandler {
|
|
|
2050
2045
|
exposeModuleFactory: s ? void 0 : y,
|
|
2051
2046
|
remote: u,
|
|
2052
2047
|
options: l,
|
|
2053
|
-
moduleInstance:
|
|
2048
|
+
moduleInstance: i,
|
|
2054
2049
|
origin: r
|
|
2055
2050
|
});
|
|
2056
|
-
return this.setIdToRemoteMap(t,
|
|
2051
|
+
return this.setIdToRemoteMap(t, a), typeof g == "function" ? g : y;
|
|
2057
2052
|
} catch (s) {
|
|
2058
|
-
const { from:
|
|
2053
|
+
const { from: i = "runtime" } = n || {
|
|
2059
2054
|
from: "runtime"
|
|
2060
2055
|
}, l = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
2061
2056
|
id: t,
|
|
2062
2057
|
error: s,
|
|
2063
|
-
from:
|
|
2058
|
+
from: i,
|
|
2064
2059
|
lifecycle: "onLoad",
|
|
2065
2060
|
origin: r
|
|
2066
2061
|
});
|
|
@@ -2079,14 +2074,14 @@ class RemoteHandler {
|
|
|
2079
2074
|
});
|
|
2080
2075
|
const r = formatPreloadArgs(n.options.remotes, t);
|
|
2081
2076
|
await Promise.all(r.map(async (s) => {
|
|
2082
|
-
const { remote:
|
|
2083
|
-
moduleInfo:
|
|
2077
|
+
const { remote: i } = s, l = getRemoteInfo(i), { globalSnapshot: a, remoteSnapshot: c } = await n.snapshotHandler.loadRemoteSnapshotInfo({
|
|
2078
|
+
moduleInfo: i
|
|
2084
2079
|
}), u = await this.hooks.lifecycle.generatePreloadAssets.emit({
|
|
2085
2080
|
origin: n,
|
|
2086
2081
|
preloadOptions: s,
|
|
2087
|
-
remote:
|
|
2082
|
+
remote: i,
|
|
2088
2083
|
remoteInfo: l,
|
|
2089
|
-
globalSnapshot:
|
|
2084
|
+
globalSnapshot: a,
|
|
2090
2085
|
remoteSnapshot: c
|
|
2091
2086
|
});
|
|
2092
2087
|
u && preloadAssets(l, n, u);
|
|
@@ -2109,30 +2104,30 @@ class RemoteHandler {
|
|
|
2109
2104
|
options: n.options,
|
|
2110
2105
|
origin: n
|
|
2111
2106
|
});
|
|
2112
|
-
} catch (
|
|
2107
|
+
} catch (g) {
|
|
2113
2108
|
if (s = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
2114
2109
|
id: r,
|
|
2115
2110
|
options: n.options,
|
|
2116
2111
|
origin: n,
|
|
2117
2112
|
from: "runtime",
|
|
2118
|
-
error:
|
|
2113
|
+
error: g,
|
|
2119
2114
|
lifecycle: "beforeRequest"
|
|
2120
2115
|
}), !s)
|
|
2121
|
-
throw
|
|
2116
|
+
throw g;
|
|
2122
2117
|
}
|
|
2123
|
-
const { id:
|
|
2118
|
+
const { id: i } = s, l = matchRemoteWithNameAndExpose(n.options.remotes, i);
|
|
2124
2119
|
assert(l, getShortErrorMsg(RUNTIME_004, runtimeDescMap, {
|
|
2125
2120
|
hostName: n.options.name,
|
|
2126
|
-
requestId:
|
|
2121
|
+
requestId: i
|
|
2127
2122
|
}));
|
|
2128
|
-
const { remote:
|
|
2129
|
-
id:
|
|
2123
|
+
const { remote: a } = l, c = getRemoteInfo(a), u = await n.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({
|
|
2124
|
+
id: i
|
|
2130
2125
|
}, l, {
|
|
2131
2126
|
options: n.options,
|
|
2132
2127
|
origin: n,
|
|
2133
2128
|
remoteInfo: c
|
|
2134
2129
|
})), { remote: p, expose: d } = u;
|
|
2135
|
-
assert(p && d, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${
|
|
2130
|
+
assert(p && d, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${i}.`);
|
|
2136
2131
|
let m = n.moduleCache.get(p.name);
|
|
2137
2132
|
const y = {
|
|
2138
2133
|
host: n,
|
|
@@ -2145,13 +2140,13 @@ class RemoteHandler {
|
|
|
2145
2140
|
};
|
|
2146
2141
|
}
|
|
2147
2142
|
registerRemote(t, n, r) {
|
|
2148
|
-
const { host: s } = this,
|
|
2143
|
+
const { host: s } = this, i = () => {
|
|
2149
2144
|
if (t.alias) {
|
|
2150
|
-
const
|
|
2145
|
+
const a = n.find((c) => {
|
|
2151
2146
|
var u;
|
|
2152
2147
|
return t.alias && (c.name.startsWith(t.alias) || ((u = c.alias) == null ? void 0 : u.startsWith(t.alias)));
|
|
2153
2148
|
});
|
|
2154
|
-
assert(!
|
|
2149
|
+
assert(!a, `The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${a && a.name} name or alias`);
|
|
2155
2150
|
}
|
|
2156
2151
|
"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);
|
|
2157
2152
|
};
|
|
@@ -2159,53 +2154,53 @@ class RemoteHandler {
|
|
|
2159
2154
|
remote: t,
|
|
2160
2155
|
origin: s
|
|
2161
2156
|
});
|
|
2162
|
-
const l = n.find((
|
|
2157
|
+
const l = n.find((a) => a.name === t.name);
|
|
2163
2158
|
if (!l)
|
|
2164
|
-
|
|
2159
|
+
i(), n.push(t), this.hooks.lifecycle.registerRemote.emit({
|
|
2165
2160
|
remote: t,
|
|
2166
2161
|
origin: s
|
|
2167
2162
|
});
|
|
2168
2163
|
else {
|
|
2169
|
-
const
|
|
2164
|
+
const a = [
|
|
2170
2165
|
`The remote "${t.name}" is already registered.`,
|
|
2171
2166
|
"Please note that overriding it may cause unexpected errors."
|
|
2172
2167
|
];
|
|
2173
|
-
r != null && r.force && (this.removeRemote(l),
|
|
2168
|
+
r != null && r.force && (this.removeRemote(l), i(), n.push(t), this.hooks.lifecycle.registerRemote.emit({
|
|
2174
2169
|
remote: t,
|
|
2175
2170
|
origin: s
|
|
2176
|
-
}), warn$1(
|
|
2171
|
+
}), warn$1(a.join(" ")));
|
|
2177
2172
|
}
|
|
2178
2173
|
}
|
|
2179
2174
|
removeRemote(t) {
|
|
2180
2175
|
try {
|
|
2181
|
-
const { host: r } = this, { name: s } = t,
|
|
2182
|
-
|
|
2176
|
+
const { host: r } = this, { name: s } = t, i = r.options.remotes.findIndex((a) => a.name === s);
|
|
2177
|
+
i !== -1 && r.options.remotes.splice(i, 1);
|
|
2183
2178
|
const l = r.moduleCache.get(t.name);
|
|
2184
2179
|
if (l) {
|
|
2185
|
-
const
|
|
2180
|
+
const a = l.remoteInfo, c = a.entryGlobalName;
|
|
2186
2181
|
if (CurrentGlobal[c]) {
|
|
2187
2182
|
var n;
|
|
2188
2183
|
(n = Object.getOwnPropertyDescriptor(CurrentGlobal, c)) != null && n.configurable ? delete CurrentGlobal[c] : CurrentGlobal[c] = void 0;
|
|
2189
2184
|
}
|
|
2190
2185
|
const u = getRemoteEntryUniqueKey(l.remoteInfo);
|
|
2191
|
-
globalLoading[u] && delete globalLoading[u], r.snapshotHandler.manifestCache.delete(
|
|
2192
|
-
let p =
|
|
2193
|
-
const d = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) =>
|
|
2186
|
+
globalLoading[u] && delete globalLoading[u], r.snapshotHandler.manifestCache.delete(a.entry);
|
|
2187
|
+
let p = a.buildVersion ? composeKeyWithSeparator(a.name, a.buildVersion) : a.name;
|
|
2188
|
+
const d = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => a.buildVersion ? y.options.id === p : y.name === p);
|
|
2194
2189
|
if (d !== -1) {
|
|
2195
2190
|
const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[d];
|
|
2196
2191
|
p = y.options.id || p;
|
|
2197
|
-
const
|
|
2198
|
-
let
|
|
2192
|
+
const g = getGlobalShareScope();
|
|
2193
|
+
let E = !0;
|
|
2199
2194
|
const _ = [];
|
|
2200
|
-
Object.keys(
|
|
2201
|
-
const v =
|
|
2195
|
+
Object.keys(g).forEach((b) => {
|
|
2196
|
+
const v = g[b];
|
|
2202
2197
|
v && Object.keys(v).forEach((I) => {
|
|
2203
2198
|
const S = v[I];
|
|
2204
2199
|
S && Object.keys(S).forEach((R) => {
|
|
2205
2200
|
const A = S[R];
|
|
2206
2201
|
A && Object.keys(A).forEach((T) => {
|
|
2207
2202
|
const $ = A[T];
|
|
2208
|
-
$ && typeof $ == "object" && $.from ===
|
|
2203
|
+
$ && typeof $ == "object" && $.from === a.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((O) => O !== a.name), $.useIn.length ? E = !1 : _.push([
|
|
2209
2204
|
b,
|
|
2210
2205
|
I,
|
|
2211
2206
|
R,
|
|
@@ -2219,9 +2214,9 @@ class RemoteHandler {
|
|
|
2219
2214
|
});
|
|
2220
2215
|
});
|
|
2221
2216
|
});
|
|
2222
|
-
}),
|
|
2217
|
+
}), E && (y.shareScopeMap = {}, delete g[p]), _.forEach(([b, v, I, S]) => {
|
|
2223
2218
|
var R, A, T;
|
|
2224
|
-
(T =
|
|
2219
|
+
(T = g[b]) == null || (A = T[v]) == null || (R = A[I]) == null || delete R[S];
|
|
2225
2220
|
}), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(d, 1);
|
|
2226
2221
|
}
|
|
2227
2222
|
const { hostGlobalSnapshot: m } = getGlobalRemoteInfo(t, r);
|
|
@@ -2275,11 +2270,11 @@ class ModuleFederation {
|
|
|
2275
2270
|
const s = getRemoteInfo({
|
|
2276
2271
|
name: t,
|
|
2277
2272
|
entry: n
|
|
2278
|
-
}),
|
|
2273
|
+
}), i = new Module({
|
|
2279
2274
|
host: this,
|
|
2280
2275
|
remoteInfo: s
|
|
2281
2276
|
});
|
|
2282
|
-
return
|
|
2277
|
+
return i.remoteEntryExports = r, this.moduleCache.set(t, i), i;
|
|
2283
2278
|
}
|
|
2284
2279
|
// eslint-disable-next-line max-lines-per-function
|
|
2285
2280
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
@@ -2294,13 +2289,13 @@ class ModuleFederation {
|
|
|
2294
2289
|
this.sharedHandler.initShareScopeMap(t, n, r);
|
|
2295
2290
|
}
|
|
2296
2291
|
formatOptions(t, n) {
|
|
2297
|
-
const { shared: r } = formatShareConfigs(t, n), { userOptions: s, options:
|
|
2292
|
+
const { shared: r } = formatShareConfigs(t, n), { userOptions: s, options: i } = this.hooks.lifecycle.beforeInit.emit({
|
|
2298
2293
|
origin: this,
|
|
2299
2294
|
userOptions: n,
|
|
2300
2295
|
options: t,
|
|
2301
2296
|
shareInfo: r
|
|
2302
|
-
}), l = this.remoteHandler.formatAndRegisterRemote(
|
|
2303
|
-
...
|
|
2297
|
+
}), l = this.remoteHandler.formatAndRegisterRemote(i, s), { shared: a } = this.sharedHandler.registerShared(i, s), c = [
|
|
2298
|
+
...i.plugins
|
|
2304
2299
|
];
|
|
2305
2300
|
s.plugins && s.plugins.forEach((p) => {
|
|
2306
2301
|
c.includes(p) || c.push(p);
|
|
@@ -2308,7 +2303,7 @@ class ModuleFederation {
|
|
|
2308
2303
|
const u = _extends$1({}, t, n, {
|
|
2309
2304
|
plugins: c,
|
|
2310
2305
|
remotes: l,
|
|
2311
|
-
shared:
|
|
2306
|
+
shared: a
|
|
2312
2307
|
});
|
|
2313
2308
|
return this.hooks.lifecycle.init.emit({
|
|
2314
2309
|
origin: this,
|
|
@@ -2317,7 +2312,7 @@ class ModuleFederation {
|
|
|
2317
2312
|
}
|
|
2318
2313
|
registerPlugins(t) {
|
|
2319
2314
|
const n = registerPlugins(t, this);
|
|
2320
|
-
this.options.plugins = this.options.plugins.reduce((r, s) => (s && r && !r.find((
|
|
2315
|
+
this.options.plugins = this.options.plugins.reduce((r, s) => (s && r && !r.find((i) => i.name === s.name) && r.push(s), r), n || []);
|
|
2321
2316
|
}
|
|
2322
2317
|
registerRemotes(t, n) {
|
|
2323
2318
|
return this.remoteHandler.registerRemotes(t, n);
|
|
@@ -2376,21 +2371,21 @@ function createBridgeComponent(o) {
|
|
|
2376
2371
|
return () => ({
|
|
2377
2372
|
__APP_VERSION__: "0.18.3",
|
|
2378
2373
|
async render(r) {
|
|
2379
|
-
var
|
|
2374
|
+
var g, E, _;
|
|
2380
2375
|
LoggerInstance.debug("createBridgeComponent render Info", r);
|
|
2381
2376
|
const {
|
|
2382
2377
|
moduleName: s,
|
|
2383
|
-
dom:
|
|
2378
|
+
dom: i,
|
|
2384
2379
|
basename: l,
|
|
2385
|
-
memoryRoute:
|
|
2380
|
+
memoryRoute: a,
|
|
2386
2381
|
hashRoute: c,
|
|
2387
2382
|
...u
|
|
2388
2383
|
} = r, p = Vue.createApp(o.rootComponent, u);
|
|
2389
|
-
t.set(
|
|
2390
|
-
const d = await ((_ = (
|
|
2384
|
+
t.set(i, p);
|
|
2385
|
+
const d = await ((_ = (E = (g = n == null ? void 0 : n.bridgeHook) == null ? void 0 : g.lifecycle) == null ? void 0 : E.beforeBridgeRender) == null ? void 0 : _.emit(r)), m = d && typeof d == "object" && (d != null && d.extraProps) ? d == null ? void 0 : d.extraProps : {}, y = o.appOptions({
|
|
2391
2386
|
app: p,
|
|
2392
2387
|
basename: l,
|
|
2393
|
-
memoryRoute:
|
|
2388
|
+
memoryRoute: a,
|
|
2394
2389
|
hashRoute: c,
|
|
2395
2390
|
...u,
|
|
2396
2391
|
...m
|
|
@@ -2409,9 +2404,9 @@ function createBridgeComponent(o) {
|
|
|
2409
2404
|
LoggerInstance.debug("createBridgeComponent render router info>>>", {
|
|
2410
2405
|
moduleName: s,
|
|
2411
2406
|
router: I
|
|
2412
|
-
}),
|
|
2407
|
+
}), a && await I.push(a.entryPath), p.use(I);
|
|
2413
2408
|
}
|
|
2414
|
-
p.mount(
|
|
2409
|
+
p.mount(i);
|
|
2415
2410
|
},
|
|
2416
2411
|
destroy(r) {
|
|
2417
2412
|
LoggerInstance.debug("createBridgeComponent destroy Info", r);
|
|
@@ -2436,8 +2431,8 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2436
2431
|
},
|
|
2437
2432
|
inheritAttrs: !1,
|
|
2438
2433
|
setup(o) {
|
|
2439
|
-
const t = ref(null), n = ref(null), r = ref(""), s = useRoute(),
|
|
2440
|
-
var m, y,
|
|
2434
|
+
const t = ref(null), n = ref(null), r = ref(""), s = useRoute(), i = getInstance(), l = useAttrs(), a = async () => {
|
|
2435
|
+
var m, y, g, E;
|
|
2441
2436
|
const u = (m = o.providerInfo) == null ? void 0 : m.call(o);
|
|
2442
2437
|
n.value = u;
|
|
2443
2438
|
let p = {
|
|
@@ -2449,19 +2444,19 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2449
2444
|
hashRoute: o.hashRoute
|
|
2450
2445
|
};
|
|
2451
2446
|
LoggerInstance.debug("createRemoteAppComponent LazyComponent render >>>", p);
|
|
2452
|
-
const d = await ((
|
|
2447
|
+
const d = await ((E = (g = (y = i == null ? void 0 : i.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : g.beforeBridgeRender) == null ? void 0 : E.emit(p)) || {};
|
|
2453
2448
|
p = {
|
|
2454
2449
|
...p,
|
|
2455
2450
|
...d.extraProps
|
|
2456
2451
|
}, u.render(p);
|
|
2457
2452
|
}, c = watch(() => s == null ? void 0 : s.path, (u) => {
|
|
2458
|
-
u !== s.path &&
|
|
2453
|
+
u !== s.path && a(), r.value !== "" && r.value !== u && (LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>", {
|
|
2459
2454
|
...o,
|
|
2460
2455
|
pathname: s.path
|
|
2461
2456
|
}), e()), r.value = u;
|
|
2462
2457
|
});
|
|
2463
2458
|
return onMounted(() => {
|
|
2464
|
-
|
|
2459
|
+
a();
|
|
2465
2460
|
}), onBeforeUnmount(() => {
|
|
2466
2461
|
var u;
|
|
2467
2462
|
LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>", {
|
|
@@ -2493,16 +2488,16 @@ function createRemoteAppComponent(o) {
|
|
|
2493
2488
|
info: o
|
|
2494
2489
|
}
|
|
2495
2490
|
);
|
|
2496
|
-
const
|
|
2491
|
+
const i = await o.loader(), l = i && i[Symbol.for("mf_module_id")], a = i[s];
|
|
2497
2492
|
if (LoggerInstance.debug(
|
|
2498
2493
|
"createRemoteAppComponent LazyComponent loadRemote info >>>",
|
|
2499
|
-
{ moduleName: l, module:
|
|
2500
|
-
), s in
|
|
2494
|
+
{ moduleName: l, module: i, exportName: s, basename: n, route: t }
|
|
2495
|
+
), s in i && typeof a == "function")
|
|
2501
2496
|
return {
|
|
2502
2497
|
render() {
|
|
2503
2498
|
return h(RemoteApp, {
|
|
2504
2499
|
moduleName: l,
|
|
2505
|
-
providerInfo:
|
|
2500
|
+
providerInfo: a,
|
|
2506
2501
|
basename: n,
|
|
2507
2502
|
rootAttrs: o.rootAttrs
|
|
2508
2503
|
});
|