@module-federation/bridge-vue3 0.8.5 → 0.8.6
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 +9 -0
- package/dist/index.cjs.js +8 -8
- package/dist/index.es.js +276 -257
- package/package.json +4 -4
- package/src/create.ts +2 -2
- package/src/provider.ts +2 -2
- package/src/remoteApp.tsx +9 -6
package/dist/index.es.js
CHANGED
|
@@ -18,13 +18,16 @@ __export(browser_exports, {
|
|
|
18
18
|
var browser = __toCommonJS(browser_exports), supportsSubstitutions = void 0, supportColor = () => {
|
|
19
19
|
if (typeof supportsSubstitutions < "u")
|
|
20
20
|
return supportsSubstitutions;
|
|
21
|
+
const r = console.log;
|
|
21
22
|
try {
|
|
22
|
-
const
|
|
23
|
-
console.log = (...o) => {
|
|
24
|
-
o[0] === `%c${
|
|
25
|
-
}, console.log(`%c${
|
|
23
|
+
const t = "color test", n = "color: red;";
|
|
24
|
+
supportsSubstitutions = !1, console.log = (...o) => {
|
|
25
|
+
o[0] === `%c${t}` && o[1] === n && (supportsSubstitutions = !0);
|
|
26
|
+
}, console.log(`%c${t}`, n);
|
|
26
27
|
} catch {
|
|
27
28
|
supportsSubstitutions = !1;
|
|
29
|
+
} finally {
|
|
30
|
+
console.log = r;
|
|
28
31
|
}
|
|
29
32
|
return supportsSubstitutions;
|
|
30
33
|
}, ansiToCss = {
|
|
@@ -45,10 +48,16 @@ var browser = __toCommonJS(browser_exports), supportsSubstitutions = void 0, sup
|
|
|
45
48
|
formatter("gray");
|
|
46
49
|
function getLabel(r, t, n) {
|
|
47
50
|
let o = [""];
|
|
48
|
-
|
|
51
|
+
if ("label" in t)
|
|
52
|
+
if (o = [(r !== "log" ? n[r] : void 0) || t.label || ""], t.color) {
|
|
53
|
+
const a = t.color(o[0]);
|
|
54
|
+
Array.isArray(a) && a.length === 2 ? o = bold([a[0], a[1]]) : o = bold(a[0] || "");
|
|
55
|
+
} else
|
|
56
|
+
o = bold(o[0]);
|
|
57
|
+
return o = o.filter(Boolean), o;
|
|
49
58
|
}
|
|
50
59
|
function finalLog(r, t, n, o) {
|
|
51
|
-
r.length ? Array.isArray(o) ? console.log(...r, ...o) : console.log(...r, t) : Array.isArray(o) ? console.log(...o) : console.log(t, ...n);
|
|
60
|
+
r.length ? Array.isArray(o) ? console.log(...r, ...o, ...n) : console.log(...r, t, ...n) : Array.isArray(o) ? console.log(...o) : console.log(t, ...n);
|
|
52
61
|
}
|
|
53
62
|
var LOG_LEVEL = {
|
|
54
63
|
error: 0,
|
|
@@ -56,47 +65,57 @@ var LOG_LEVEL = {
|
|
|
56
65
|
info: 2,
|
|
57
66
|
log: 3,
|
|
58
67
|
verbose: 4
|
|
59
|
-
}, errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/, anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/, isErrorStackMessage = (r) => errorStackRegExp.test(r) || anonymousErrorStackRegExp.test(r)
|
|
60
|
-
|
|
61
|
-
|
|
68
|
+
}, errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/, anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/, isErrorStackMessage = (r) => errorStackRegExp.test(r) || anonymousErrorStackRegExp.test(r);
|
|
69
|
+
function validateOptions(r) {
|
|
70
|
+
const t = { ...r };
|
|
71
|
+
if (r.labels && typeof r.labels != "object")
|
|
72
|
+
throw new Error("Labels must be an object");
|
|
73
|
+
if (r.level && typeof r.level != "string")
|
|
74
|
+
throw new Error("Level must be a string");
|
|
75
|
+
return t;
|
|
76
|
+
}
|
|
77
|
+
var createLogger$1 = (r = {}, { getLabel: t, handleError: n, finalLog: o, greet: s, LOG_TYPES: a }) => {
|
|
78
|
+
const l = validateOptions(r);
|
|
79
|
+
let i = l.level || "log", c = l.labels || {}, u = (p, d, ...y) => {
|
|
80
|
+
if (LOG_LEVEL[a[p].level] > LOG_LEVEL[i])
|
|
62
81
|
return;
|
|
63
|
-
if (
|
|
82
|
+
if (d == null)
|
|
64
83
|
return console.log();
|
|
65
|
-
let
|
|
66
|
-
const
|
|
67
|
-
if (
|
|
68
|
-
if (
|
|
69
|
-
let [
|
|
84
|
+
let _ = a[p], E = "";
|
|
85
|
+
const g = t(p, _, c);
|
|
86
|
+
if (d instanceof Error)
|
|
87
|
+
if (d.stack) {
|
|
88
|
+
let [b, ...S] = d.stack.split(`
|
|
70
89
|
`);
|
|
71
|
-
|
|
72
|
-
${n(
|
|
90
|
+
b.startsWith("Error: ") && (b = b.slice(7)), E = `${b}
|
|
91
|
+
${n(S.join(`
|
|
73
92
|
`))}`;
|
|
74
93
|
} else
|
|
75
|
-
|
|
94
|
+
E = d.message;
|
|
76
95
|
else
|
|
77
|
-
|
|
78
|
-
`).map((
|
|
79
|
-
`) :
|
|
80
|
-
o(
|
|
81
|
-
},
|
|
96
|
+
_.level === "error" && typeof d == "string" ? E = d.split(`
|
|
97
|
+
`).map((S) => isErrorStackMessage(S) ? n(S) : S).join(`
|
|
98
|
+
`) : E = `${d}`;
|
|
99
|
+
o(g, E, y, d);
|
|
100
|
+
}, m = {
|
|
82
101
|
// greet
|
|
83
|
-
greet: (
|
|
102
|
+
greet: (p) => u("log", s(p))
|
|
84
103
|
};
|
|
85
|
-
return Object.keys(a).forEach((
|
|
86
|
-
|
|
87
|
-
}), Object.defineProperty(
|
|
88
|
-
get: () => l,
|
|
89
|
-
set(d) {
|
|
90
|
-
l = d;
|
|
91
|
-
}
|
|
92
|
-
}), Object.defineProperty(u, "labels", {
|
|
104
|
+
return Object.keys(a).forEach((p) => {
|
|
105
|
+
m[p] = (...d) => u(p, ...d);
|
|
106
|
+
}), Object.defineProperty(m, "level", {
|
|
93
107
|
get: () => i,
|
|
94
|
-
set(
|
|
95
|
-
i =
|
|
108
|
+
set(p) {
|
|
109
|
+
i = p;
|
|
110
|
+
}
|
|
111
|
+
}), Object.defineProperty(m, "labels", {
|
|
112
|
+
get: () => c,
|
|
113
|
+
set(p) {
|
|
114
|
+
c = p;
|
|
96
115
|
}
|
|
97
|
-
}),
|
|
98
|
-
Object.assign(
|
|
99
|
-
},
|
|
116
|
+
}), m.override = (p) => {
|
|
117
|
+
Object.assign(m, p);
|
|
118
|
+
}, m;
|
|
100
119
|
}, startColor = [189, 255, 243], endColor = [74, 194, 154], isWord = (r) => !/[\s\n]/.test(r);
|
|
101
120
|
function gradient(r) {
|
|
102
121
|
if (!supportColor())
|
|
@@ -107,8 +126,8 @@ function gradient(r) {
|
|
|
107
126
|
let s = "", a = [];
|
|
108
127
|
return t.forEach((l) => {
|
|
109
128
|
if (isWord(l)) {
|
|
110
|
-
const i = n.indexOf(l) / o, c = Math.round(startColor[0] + (endColor[0] - startColor[0]) * i), u = Math.round(startColor[1] + (endColor[1] - startColor[1]) * i),
|
|
111
|
-
s += `%c${l}`, a.push(`color: rgb(${c},${u},${
|
|
129
|
+
const i = n.indexOf(l) / o, c = Math.round(startColor[0] + (endColor[0] - startColor[0]) * i), u = Math.round(startColor[1] + (endColor[1] - startColor[1]) * i), m = Math.round(startColor[2] + (endColor[2] - startColor[2]) * i);
|
|
130
|
+
s += `%c${l}`, a.push(`color: rgb(${c},${u},${m}); font-weight: bold;`);
|
|
112
131
|
} else
|
|
113
132
|
s += l;
|
|
114
133
|
}), [s, ...a];
|
|
@@ -265,63 +284,63 @@ function generateSnapshotFromManifest(r, t = {}) {
|
|
|
265
284
|
const { remotes: s = {}, overrides: a = {}, version: l } = t;
|
|
266
285
|
let i;
|
|
267
286
|
const c = () => "publicPath" in r.metaData ? r.metaData.publicPath === "auto" && l ? inferAutoPublicPath(l) : r.metaData.publicPath : r.metaData.getPublicPath, u = Object.keys(a);
|
|
268
|
-
let
|
|
287
|
+
let m = {};
|
|
269
288
|
if (!Object.keys(s).length) {
|
|
270
289
|
var p;
|
|
271
|
-
|
|
290
|
+
m = ((p = r.remotes) == null ? void 0 : p.reduce((R, $) => {
|
|
272
291
|
let w;
|
|
273
292
|
const O = $.federationContainerName;
|
|
274
|
-
return u.includes(O) ? w = a[O] : "version" in $ ? w = $.version : w = $.entry,
|
|
293
|
+
return u.includes(O) ? w = a[O] : "version" in $ ? w = $.version : w = $.entry, R[O] = {
|
|
275
294
|
matchedVersion: w
|
|
276
|
-
},
|
|
295
|
+
}, R;
|
|
277
296
|
}, {})) || {};
|
|
278
297
|
}
|
|
279
|
-
Object.keys(s).forEach((
|
|
298
|
+
Object.keys(s).forEach((R) => m[R] = {
|
|
280
299
|
// overrides will override dependencies
|
|
281
|
-
matchedVersion: u.includes(
|
|
300
|
+
matchedVersion: u.includes(R) ? a[R] : s[R]
|
|
282
301
|
});
|
|
283
|
-
const { remoteEntry: { path:
|
|
284
|
-
let
|
|
302
|
+
const { remoteEntry: { path: d, name: y, type: _ }, types: E, buildInfo: { buildVersion: g }, globalName: b, ssrRemoteEntry: S } = r.metaData, { exposes: I } = r;
|
|
303
|
+
let v = {
|
|
285
304
|
version: l || "",
|
|
286
305
|
buildVersion: g,
|
|
287
|
-
globalName:
|
|
288
|
-
remoteEntry: simpleJoinRemoteEntry(
|
|
306
|
+
globalName: b,
|
|
307
|
+
remoteEntry: simpleJoinRemoteEntry(d, y),
|
|
289
308
|
remoteEntryType: _,
|
|
290
|
-
remoteTypes: simpleJoinRemoteEntry(
|
|
291
|
-
remoteTypesZip:
|
|
292
|
-
remoteTypesAPI:
|
|
293
|
-
remotesInfo:
|
|
294
|
-
shared: r == null ? void 0 : r.shared.map((
|
|
295
|
-
assets:
|
|
296
|
-
sharedName:
|
|
297
|
-
version:
|
|
309
|
+
remoteTypes: simpleJoinRemoteEntry(E.path, E.name),
|
|
310
|
+
remoteTypesZip: E.zip || "",
|
|
311
|
+
remoteTypesAPI: E.api || "",
|
|
312
|
+
remotesInfo: m,
|
|
313
|
+
shared: r == null ? void 0 : r.shared.map((R) => ({
|
|
314
|
+
assets: R.assets,
|
|
315
|
+
sharedName: R.name,
|
|
316
|
+
version: R.version
|
|
298
317
|
})),
|
|
299
|
-
modules: I == null ? void 0 : I.map((
|
|
300
|
-
moduleName:
|
|
301
|
-
modulePath:
|
|
302
|
-
assets:
|
|
318
|
+
modules: I == null ? void 0 : I.map((R) => ({
|
|
319
|
+
moduleName: R.name,
|
|
320
|
+
modulePath: R.path,
|
|
321
|
+
assets: R.assets
|
|
303
322
|
}))
|
|
304
323
|
};
|
|
305
324
|
if ((n = r.metaData) != null && n.prefetchInterface) {
|
|
306
|
-
const
|
|
307
|
-
|
|
308
|
-
prefetchInterface:
|
|
325
|
+
const R = r.metaData.prefetchInterface;
|
|
326
|
+
v = _extends$2({}, v, {
|
|
327
|
+
prefetchInterface: R
|
|
309
328
|
});
|
|
310
329
|
}
|
|
311
330
|
if ((o = r.metaData) != null && o.prefetchEntry) {
|
|
312
|
-
const { path:
|
|
313
|
-
|
|
314
|
-
prefetchEntry: simpleJoinRemoteEntry(
|
|
331
|
+
const { path: R, name: $, type: w } = r.metaData.prefetchEntry;
|
|
332
|
+
v = _extends$2({}, v, {
|
|
333
|
+
prefetchEntry: simpleJoinRemoteEntry(R, $),
|
|
315
334
|
prefetchEntryType: w
|
|
316
335
|
});
|
|
317
336
|
}
|
|
318
|
-
if ("publicPath" in r.metaData ? i = _extends$2({},
|
|
337
|
+
if ("publicPath" in r.metaData ? i = _extends$2({}, v, {
|
|
319
338
|
publicPath: c()
|
|
320
|
-
}) : i = _extends$2({},
|
|
339
|
+
}) : i = _extends$2({}, v, {
|
|
321
340
|
getPublicPath: c()
|
|
322
|
-
}),
|
|
323
|
-
const
|
|
324
|
-
i.ssrRemoteEntry =
|
|
341
|
+
}), S) {
|
|
342
|
+
const R = simpleJoinRemoteEntry(S.path, S.name);
|
|
343
|
+
i.ssrRemoteEntry = R, i.ssrRemoteEntryType = S.type || "commonjs-module";
|
|
325
344
|
}
|
|
326
345
|
return i;
|
|
327
346
|
}
|
|
@@ -361,17 +380,17 @@ function createScript(r) {
|
|
|
361
380
|
const l = async (i, c) => {
|
|
362
381
|
var u;
|
|
363
382
|
if (clearTimeout(s), t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
364
|
-
const { needDeleteScript:
|
|
365
|
-
|
|
383
|
+
const { needDeleteScript: d = !0 } = r;
|
|
384
|
+
d && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
366
385
|
}), i && typeof i == "function")) {
|
|
367
|
-
var
|
|
368
|
-
const
|
|
369
|
-
if (
|
|
386
|
+
var m;
|
|
387
|
+
const d = i(c);
|
|
388
|
+
if (d instanceof Promise) {
|
|
370
389
|
var p;
|
|
371
|
-
const y = await
|
|
390
|
+
const y = await d;
|
|
372
391
|
return r == null || (p = r.cb) == null || p.call(r), y;
|
|
373
392
|
}
|
|
374
|
-
return r == null || (
|
|
393
|
+
return r == null || (m = r.cb) == null || m.call(r), d;
|
|
375
394
|
}
|
|
376
395
|
r == null || (u = r.cb) == null || u.call(r);
|
|
377
396
|
};
|
|
@@ -637,17 +656,17 @@ function setGlobalDefaultVal(r) {
|
|
|
637
656
|
(c = (n = r.__FEDERATION__).__INSTANCES__) != null || (n.__INSTANCES__ = []);
|
|
638
657
|
var u;
|
|
639
658
|
(u = (o = r.__FEDERATION__).moduleInfo) != null || (o.moduleInfo = {});
|
|
640
|
-
var
|
|
641
|
-
(
|
|
659
|
+
var m;
|
|
660
|
+
(m = (s = r.__FEDERATION__).__SHARE__) != null || (s.__SHARE__ = {});
|
|
642
661
|
var p;
|
|
643
662
|
(p = (a = r.__FEDERATION__).__MANIFEST_LOADING__) != null || (a.__MANIFEST_LOADING__ = {});
|
|
644
|
-
var
|
|
645
|
-
(
|
|
663
|
+
var d;
|
|
664
|
+
(d = (l = r.__FEDERATION__).__PRELOADED_MAP__) != null || (l.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
|
|
646
665
|
}
|
|
647
666
|
setGlobalDefaultVal(CurrentGlobal);
|
|
648
667
|
setGlobalDefaultVal(nativeGlobal);
|
|
649
668
|
function setGlobalFederationConstructor(r, t = isDebugMode()) {
|
|
650
|
-
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.8.
|
|
669
|
+
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.8.6");
|
|
651
670
|
}
|
|
652
671
|
function getInfoWithoutType(r, t) {
|
|
653
672
|
if (typeof t == "string") {
|
|
@@ -716,7 +735,7 @@ function combineVersion(r, t, n, o) {
|
|
|
716
735
|
return o ? `${s}-${o}` : s;
|
|
717
736
|
}
|
|
718
737
|
function parseHyphen(r) {
|
|
719
|
-
return r.replace(parseRegex(hyphenRange), (t, n, o, s, a, l, i, c, u,
|
|
738
|
+
return r.replace(parseRegex(hyphenRange), (t, n, o, s, a, l, i, c, u, m, p, d) => (isXVersion(o) ? n = "" : isXVersion(s) ? n = `>=${o}.0.0` : isXVersion(a) ? n = `>=${o}.${s}.0` : n = `>=${n}`, isXVersion(u) ? c = "" : isXVersion(m) ? c = `<${Number(u) + 1}.0.0-0` : isXVersion(p) ? c = `<${u}.${Number(m) + 1}.0-0` : d ? c = `<=${u}.${m}.${p}-${d}` : c = `<=${c}`, `${n} ${c}`.trim()));
|
|
720
739
|
}
|
|
721
740
|
function parseComparatorTrim(r) {
|
|
722
741
|
return r.replace(parseRegex(comparatorTrim), "$1$2$3");
|
|
@@ -735,8 +754,8 @@ function parseTildes(r) {
|
|
|
735
754
|
}
|
|
736
755
|
function parseXRanges(r) {
|
|
737
756
|
return r.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (n, o, s, a, l, i) => {
|
|
738
|
-
const c = isXVersion(s), u = c || isXVersion(a),
|
|
739
|
-
return o === "=" &&
|
|
757
|
+
const c = isXVersion(s), u = c || isXVersion(a), m = u || isXVersion(l);
|
|
758
|
+
return o === "=" && m && (o = ""), i = "", c ? o === ">" || o === "<" ? "<0.0.0-0" : "*" : o && m ? (u && (a = 0), l = 0, o === ">" ? (o = ">=", u ? (s = Number(s) + 1, a = 0, l = 0) : (a = Number(a) + 1, l = 0)) : o === "<=" && (o = "<", u ? s = Number(s) + 1 : a = Number(a) + 1), o === "<" && (i = "-0"), `${o + s}.${a}.${l}${i}`) : u ? `>=${s}.0.0${i} <${Number(s) + 1}.0.0-0` : m ? `>=${s}.${a}.0${i} <${s}.${Number(a) + 1}.0-0` : n;
|
|
740
759
|
})).join(" ");
|
|
741
760
|
}
|
|
742
761
|
function parseStar(r) {
|
|
@@ -829,28 +848,28 @@ function parseRange(r) {
|
|
|
829
848
|
function satisfy(r, t) {
|
|
830
849
|
if (!r)
|
|
831
850
|
return !1;
|
|
832
|
-
const s = parseRange(t).split(" ").map((
|
|
851
|
+
const s = parseRange(t).split(" ").map((d) => parseComparatorString(d)).join(" ").split(/\s+/).map((d) => parseGTE0(d)), a = extractComparator(r);
|
|
833
852
|
if (!a)
|
|
834
853
|
return !1;
|
|
835
|
-
const [, l, , i, c, u,
|
|
854
|
+
const [, l, , i, c, u, m] = a, p = {
|
|
836
855
|
operator: l,
|
|
837
|
-
version: combineVersion(i, c, u,
|
|
856
|
+
version: combineVersion(i, c, u, m),
|
|
838
857
|
major: i,
|
|
839
858
|
minor: c,
|
|
840
859
|
patch: u,
|
|
841
|
-
preRelease:
|
|
860
|
+
preRelease: m == null ? void 0 : m.split(".")
|
|
842
861
|
};
|
|
843
|
-
for (const
|
|
844
|
-
const y = extractComparator(
|
|
862
|
+
for (const d of s) {
|
|
863
|
+
const y = extractComparator(d);
|
|
845
864
|
if (!y)
|
|
846
865
|
return !1;
|
|
847
|
-
const [, _, ,
|
|
866
|
+
const [, _, , E, g, b, S] = y, I = {
|
|
848
867
|
operator: _,
|
|
849
|
-
version: combineVersion(
|
|
850
|
-
major:
|
|
868
|
+
version: combineVersion(E, g, b, S),
|
|
869
|
+
major: E,
|
|
851
870
|
minor: g,
|
|
852
|
-
patch:
|
|
853
|
-
preRelease:
|
|
871
|
+
patch: b,
|
|
872
|
+
preRelease: S == null ? void 0 : S.split(".")
|
|
854
873
|
};
|
|
855
874
|
if (!compare(I, p))
|
|
856
875
|
return !1;
|
|
@@ -943,18 +962,18 @@ function getRegisteredShare(r, t, n, o) {
|
|
|
943
962
|
];
|
|
944
963
|
for (const c of i)
|
|
945
964
|
if (s && r[c] && r[c][t]) {
|
|
946
|
-
const { requiredVersion: u } = s, p = getFindShareFunction(l)(r, c, t),
|
|
965
|
+
const { requiredVersion: u } = s, p = getFindShareFunction(l)(r, c, t), d = () => {
|
|
947
966
|
if (s.singleton) {
|
|
948
967
|
if (typeof u == "string" && !satisfy(p, u)) {
|
|
949
|
-
const
|
|
950
|
-
s.strictVersion ? error(
|
|
968
|
+
const E = `Version ${p} from ${p && r[c][t][p].from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${u})`;
|
|
969
|
+
s.strictVersion ? error(E) : warn(E);
|
|
951
970
|
}
|
|
952
971
|
return r[c][t][p];
|
|
953
972
|
} else {
|
|
954
973
|
if (u === !1 || u === "*" || satisfy(p, u))
|
|
955
974
|
return r[c][t][p];
|
|
956
|
-
for (const [
|
|
957
|
-
if (satisfy(
|
|
975
|
+
for (const [E, g] of Object.entries(r[c][t]))
|
|
976
|
+
if (satisfy(E, u))
|
|
958
977
|
return g;
|
|
959
978
|
}
|
|
960
979
|
}, y = {
|
|
@@ -963,7 +982,7 @@ function getRegisteredShare(r, t, n, o) {
|
|
|
963
982
|
pkgName: t,
|
|
964
983
|
version: p,
|
|
965
984
|
GlobalFederation: Global.__FEDERATION__,
|
|
966
|
-
resolver:
|
|
985
|
+
resolver: d
|
|
967
986
|
};
|
|
968
987
|
return (o.emit(y) || y).resolver();
|
|
969
988
|
}
|
|
@@ -979,10 +998,10 @@ function getTargetSharedOptions(r) {
|
|
|
979
998
|
i.forEach((p) => {
|
|
980
999
|
c[p.version] = p;
|
|
981
1000
|
});
|
|
982
|
-
const
|
|
983
|
-
return !isLoaded(c[p]) && versionLt(p,
|
|
1001
|
+
const m = findVersion(c, function(p, d) {
|
|
1002
|
+
return !isLoaded(c[p]) && versionLt(p, d);
|
|
984
1003
|
});
|
|
985
|
-
return c[
|
|
1004
|
+
return c[m];
|
|
986
1005
|
};
|
|
987
1006
|
var a;
|
|
988
1007
|
const l = (a = n == null ? void 0 : n.resolver) != null ? a : s;
|
|
@@ -1240,12 +1259,12 @@ let Module = class {
|
|
|
1240
1259
|
loadFactory: !0
|
|
1241
1260
|
}, l = await this.getEntry();
|
|
1242
1261
|
if (!this.inited) {
|
|
1243
|
-
const p = this.host.shareScopeMap,
|
|
1244
|
-
p[
|
|
1245
|
-
const y = p[
|
|
1262
|
+
const p = this.host.shareScopeMap, d = this.remoteInfo.shareScope || "default";
|
|
1263
|
+
p[d] || (p[d] = {});
|
|
1264
|
+
const y = p[d], _ = [], E = {
|
|
1246
1265
|
version: this.remoteInfo.version || ""
|
|
1247
1266
|
};
|
|
1248
|
-
Object.defineProperty(
|
|
1267
|
+
Object.defineProperty(E, "shareScopeMap", {
|
|
1249
1268
|
value: p,
|
|
1250
1269
|
// remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
|
|
1251
1270
|
enumerable: !1
|
|
@@ -1253,7 +1272,7 @@ let Module = class {
|
|
|
1253
1272
|
const g = await this.host.hooks.lifecycle.beforeInitContainer.emit({
|
|
1254
1273
|
shareScope: y,
|
|
1255
1274
|
// @ts-ignore shareScopeMap will be set by Object.defineProperty
|
|
1256
|
-
remoteEntryInitOptions:
|
|
1275
|
+
remoteEntryInitOptions: E,
|
|
1257
1276
|
initScope: _,
|
|
1258
1277
|
remoteInfo: this.remoteInfo,
|
|
1259
1278
|
origin: this.host
|
|
@@ -1463,21 +1482,21 @@ function preloadAssets(r, t, n, o = !0) {
|
|
|
1463
1482
|
as: "style"
|
|
1464
1483
|
};
|
|
1465
1484
|
s.forEach((c) => {
|
|
1466
|
-
const { link: u, needAttach:
|
|
1485
|
+
const { link: u, needAttach: m } = createLink({
|
|
1467
1486
|
url: c,
|
|
1468
1487
|
cb: () => {
|
|
1469
1488
|
},
|
|
1470
1489
|
attrs: i,
|
|
1471
|
-
createLinkHook: (p,
|
|
1490
|
+
createLinkHook: (p, d) => {
|
|
1472
1491
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1473
1492
|
url: p,
|
|
1474
|
-
attrs:
|
|
1493
|
+
attrs: d
|
|
1475
1494
|
});
|
|
1476
1495
|
if (y instanceof HTMLLinkElement)
|
|
1477
1496
|
return y;
|
|
1478
1497
|
}
|
|
1479
1498
|
});
|
|
1480
|
-
|
|
1499
|
+
m && document.head.appendChild(u);
|
|
1481
1500
|
});
|
|
1482
1501
|
} else {
|
|
1483
1502
|
const i = {
|
|
@@ -1485,22 +1504,22 @@ function preloadAssets(r, t, n, o = !0) {
|
|
|
1485
1504
|
type: "text/css"
|
|
1486
1505
|
};
|
|
1487
1506
|
s.forEach((c) => {
|
|
1488
|
-
const { link: u, needAttach:
|
|
1507
|
+
const { link: u, needAttach: m } = createLink({
|
|
1489
1508
|
url: c,
|
|
1490
1509
|
cb: () => {
|
|
1491
1510
|
},
|
|
1492
1511
|
attrs: i,
|
|
1493
|
-
createLinkHook: (p,
|
|
1512
|
+
createLinkHook: (p, d) => {
|
|
1494
1513
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1495
1514
|
url: p,
|
|
1496
|
-
attrs:
|
|
1515
|
+
attrs: d
|
|
1497
1516
|
});
|
|
1498
1517
|
if (y instanceof HTMLLinkElement)
|
|
1499
1518
|
return y;
|
|
1500
1519
|
},
|
|
1501
1520
|
needDeleteLink: !1
|
|
1502
1521
|
});
|
|
1503
|
-
|
|
1522
|
+
m && document.head.appendChild(u);
|
|
1504
1523
|
});
|
|
1505
1524
|
}
|
|
1506
1525
|
if (o) {
|
|
@@ -1509,21 +1528,21 @@ function preloadAssets(r, t, n, o = !0) {
|
|
|
1509
1528
|
as: "script"
|
|
1510
1529
|
};
|
|
1511
1530
|
a.forEach((c) => {
|
|
1512
|
-
const { link: u, needAttach:
|
|
1531
|
+
const { link: u, needAttach: m } = createLink({
|
|
1513
1532
|
url: c,
|
|
1514
1533
|
cb: () => {
|
|
1515
1534
|
},
|
|
1516
1535
|
attrs: i,
|
|
1517
|
-
createLinkHook: (p,
|
|
1536
|
+
createLinkHook: (p, d) => {
|
|
1518
1537
|
const y = t.loaderHook.lifecycle.createLink.emit({
|
|
1519
1538
|
url: p,
|
|
1520
|
-
attrs:
|
|
1539
|
+
attrs: d
|
|
1521
1540
|
});
|
|
1522
1541
|
if (y instanceof HTMLLinkElement)
|
|
1523
1542
|
return y;
|
|
1524
1543
|
}
|
|
1525
1544
|
});
|
|
1526
|
-
|
|
1545
|
+
m && document.head.appendChild(u);
|
|
1527
1546
|
});
|
|
1528
1547
|
} else {
|
|
1529
1548
|
const i = {
|
|
@@ -1531,22 +1550,22 @@ function preloadAssets(r, t, n, o = !0) {
|
|
|
1531
1550
|
type: (r == null ? void 0 : r.type) === "module" ? "module" : "text/javascript"
|
|
1532
1551
|
};
|
|
1533
1552
|
a.forEach((c) => {
|
|
1534
|
-
const { script: u, needAttach:
|
|
1553
|
+
const { script: u, needAttach: m } = createScript({
|
|
1535
1554
|
url: c,
|
|
1536
1555
|
cb: () => {
|
|
1537
1556
|
},
|
|
1538
1557
|
attrs: i,
|
|
1539
|
-
createScriptHook: (p,
|
|
1558
|
+
createScriptHook: (p, d) => {
|
|
1540
1559
|
const y = t.loaderHook.lifecycle.createScript.emit({
|
|
1541
1560
|
url: p,
|
|
1542
|
-
attrs:
|
|
1561
|
+
attrs: d
|
|
1543
1562
|
});
|
|
1544
1563
|
if (y instanceof HTMLScriptElement)
|
|
1545
1564
|
return y;
|
|
1546
1565
|
},
|
|
1547
1566
|
needDeleteScript: !0
|
|
1548
1567
|
});
|
|
1549
|
-
|
|
1568
|
+
m && document.head.appendChild(u);
|
|
1550
1569
|
});
|
|
1551
1570
|
}
|
|
1552
1571
|
}
|
|
@@ -1609,89 +1628,89 @@ function traverseModuleInfo(r, t, n, o, s = {}, a) {
|
|
|
1609
1628
|
const l = getFMId(t), { value: i } = getInfoWithoutType(r, l), c = a || i;
|
|
1610
1629
|
if (c && !isManifestProvider(c) && (n(c, t, o), c.remotesInfo)) {
|
|
1611
1630
|
const u = Object.keys(c.remotesInfo);
|
|
1612
|
-
for (const
|
|
1613
|
-
if (s[
|
|
1631
|
+
for (const m of u) {
|
|
1632
|
+
if (s[m])
|
|
1614
1633
|
continue;
|
|
1615
|
-
s[
|
|
1616
|
-
const p = splitId(
|
|
1634
|
+
s[m] = !0;
|
|
1635
|
+
const p = splitId(m), d = c.remotesInfo[m];
|
|
1617
1636
|
traverseModuleInfo(r, {
|
|
1618
1637
|
name: p.name,
|
|
1619
|
-
version:
|
|
1638
|
+
version: d.matchedVersion
|
|
1620
1639
|
}, n, !1, s, void 0);
|
|
1621
1640
|
}
|
|
1622
1641
|
}
|
|
1623
1642
|
}
|
|
1624
1643
|
function generatePreloadAssets(r, t, n, o, s) {
|
|
1625
|
-
const a = [], l = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options:
|
|
1626
|
-
if (traverseModuleInfo(o, n, (g,
|
|
1644
|
+
const a = [], l = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: m } = r, { preloadConfig: p } = t, { depsRemote: d } = p;
|
|
1645
|
+
if (traverseModuleInfo(o, n, (g, b, S) => {
|
|
1627
1646
|
let I;
|
|
1628
|
-
if (
|
|
1647
|
+
if (S)
|
|
1629
1648
|
I = p;
|
|
1630
|
-
else if (Array.isArray(
|
|
1631
|
-
const T =
|
|
1649
|
+
else if (Array.isArray(d)) {
|
|
1650
|
+
const T = d.find((A) => A.nameOrAlias === b.name || A.nameOrAlias === b.alias);
|
|
1632
1651
|
if (!T)
|
|
1633
1652
|
return;
|
|
1634
1653
|
I = defaultPreloadArgs(T);
|
|
1635
|
-
} else if (
|
|
1654
|
+
} else if (d === !0)
|
|
1636
1655
|
I = p;
|
|
1637
1656
|
else
|
|
1638
1657
|
return;
|
|
1639
|
-
const
|
|
1640
|
-
|
|
1641
|
-
name:
|
|
1658
|
+
const v = getResourceUrl(g, getRemoteEntryInfoFromSnapshot(g).url);
|
|
1659
|
+
v && i.push({
|
|
1660
|
+
name: b.name,
|
|
1642
1661
|
moduleInfo: {
|
|
1643
|
-
name:
|
|
1644
|
-
entry:
|
|
1662
|
+
name: b.name,
|
|
1663
|
+
entry: v,
|
|
1645
1664
|
type: "remoteEntryType" in g ? g.remoteEntryType : "global",
|
|
1646
|
-
entryGlobalName: "globalName" in g ? g.globalName :
|
|
1665
|
+
entryGlobalName: "globalName" in g ? g.globalName : b.name,
|
|
1647
1666
|
shareScope: "",
|
|
1648
1667
|
version: "version" in g ? g.version : void 0
|
|
1649
1668
|
},
|
|
1650
|
-
url:
|
|
1669
|
+
url: v
|
|
1651
1670
|
});
|
|
1652
|
-
let
|
|
1671
|
+
let R = "modules" in g ? g.modules : [];
|
|
1653
1672
|
const $ = normalizePreloadExposes(I.exposes);
|
|
1654
1673
|
if ($.length && "modules" in g) {
|
|
1655
1674
|
var w;
|
|
1656
|
-
|
|
1675
|
+
R = g == null || (w = g.modules) == null ? void 0 : w.reduce((T, A) => (($ == null ? void 0 : $.indexOf(A.moduleName)) !== -1 && T.push(A), T), []);
|
|
1657
1676
|
}
|
|
1658
1677
|
function O(T) {
|
|
1659
1678
|
const A = T.map((P) => getResourceUrl(g, P));
|
|
1660
1679
|
return I.filter ? A.filter(I.filter) : A;
|
|
1661
1680
|
}
|
|
1662
|
-
if (
|
|
1663
|
-
const T =
|
|
1681
|
+
if (R) {
|
|
1682
|
+
const T = R.length;
|
|
1664
1683
|
for (let A = 0; A < T; A++) {
|
|
1665
|
-
const P =
|
|
1684
|
+
const P = R[A], L = `${b.name}/${P.moduleName}`;
|
|
1666
1685
|
r.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
|
|
1667
|
-
id: P.moduleName === "." ?
|
|
1668
|
-
name:
|
|
1686
|
+
id: P.moduleName === "." ? b.name : L,
|
|
1687
|
+
name: b.name,
|
|
1669
1688
|
remoteSnapshot: g,
|
|
1670
1689
|
preloadConfig: I,
|
|
1671
|
-
remote:
|
|
1690
|
+
remote: b,
|
|
1672
1691
|
origin: r
|
|
1673
|
-
}), !getPreloaded(
|
|
1692
|
+
}), !getPreloaded(L) && (I.resourceCategory === "all" ? (a.push(...O(P.assets.css.async)), a.push(...O(P.assets.css.sync)), l.push(...O(P.assets.js.async)), l.push(...O(P.assets.js.sync))) : (I.resourceCategory = "sync") && (a.push(...O(P.assets.css.sync)), l.push(...O(P.assets.js.sync))), setPreloaded(L));
|
|
1674
1693
|
}
|
|
1675
1694
|
}
|
|
1676
1695
|
}, !0, {}, s), s.shared) {
|
|
1677
|
-
const g = (
|
|
1678
|
-
const I = getRegisteredShare(r.shareScopeMap,
|
|
1679
|
-
I && typeof I.lib == "function" && (
|
|
1680
|
-
c.add(
|
|
1681
|
-
}),
|
|
1682
|
-
u.add(
|
|
1696
|
+
const g = (b, S) => {
|
|
1697
|
+
const I = getRegisteredShare(r.shareScopeMap, S.sharedName, b, r.sharedHandler.hooks.lifecycle.resolveShare);
|
|
1698
|
+
I && typeof I.lib == "function" && (S.assets.js.sync.forEach((v) => {
|
|
1699
|
+
c.add(v);
|
|
1700
|
+
}), S.assets.css.sync.forEach((v) => {
|
|
1701
|
+
u.add(v);
|
|
1683
1702
|
}));
|
|
1684
1703
|
};
|
|
1685
|
-
s.shared.forEach((
|
|
1686
|
-
var
|
|
1687
|
-
const I = (
|
|
1704
|
+
s.shared.forEach((b) => {
|
|
1705
|
+
var S;
|
|
1706
|
+
const I = (S = m.shared) == null ? void 0 : S[b.sharedName];
|
|
1688
1707
|
if (!I)
|
|
1689
1708
|
return;
|
|
1690
|
-
const
|
|
1691
|
-
if (!
|
|
1709
|
+
const v = b.version ? I.find(($) => $.version === b.version) : I;
|
|
1710
|
+
if (!v)
|
|
1692
1711
|
return;
|
|
1693
|
-
arrayOptions(
|
|
1694
|
-
g($,
|
|
1712
|
+
arrayOptions(v).forEach(($) => {
|
|
1713
|
+
g($, b);
|
|
1695
1714
|
});
|
|
1696
1715
|
});
|
|
1697
1716
|
}
|
|
@@ -1791,15 +1810,15 @@ class SnapshotHandler {
|
|
|
1791
1810
|
remoteSnapshot: a,
|
|
1792
1811
|
globalSnapshot: l
|
|
1793
1812
|
});
|
|
1794
|
-
let u,
|
|
1813
|
+
let u, m;
|
|
1795
1814
|
if (i)
|
|
1796
1815
|
if (isManifestProvider(i)) {
|
|
1797
|
-
const p = isBrowserEnv() ? i.remoteEntry : i.ssrRemoteEntry || i.remoteEntry || "",
|
|
1816
|
+
const p = isBrowserEnv() ? i.remoteEntry : i.ssrRemoteEntry || i.remoteEntry || "", d = await this.getManifestJson(p, t, {}), y = setGlobalSnapshotInfoByModuleInfo(_extends$1({}, t, {
|
|
1798
1817
|
// The global remote may be overridden
|
|
1799
1818
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
1800
1819
|
entry: p
|
|
1801
|
-
}),
|
|
1802
|
-
u =
|
|
1820
|
+
}), d);
|
|
1821
|
+
u = d, m = y;
|
|
1803
1822
|
} else {
|
|
1804
1823
|
const { remoteSnapshot: p } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1805
1824
|
options: this.HostInstance.options,
|
|
@@ -1807,16 +1826,16 @@ class SnapshotHandler {
|
|
|
1807
1826
|
remoteSnapshot: i,
|
|
1808
1827
|
from: "global"
|
|
1809
1828
|
});
|
|
1810
|
-
u = p,
|
|
1829
|
+
u = p, m = c;
|
|
1811
1830
|
}
|
|
1812
1831
|
else if (isRemoteInfoWithEntry(t)) {
|
|
1813
|
-
const p = await this.getManifestJson(t.entry, t, {}),
|
|
1832
|
+
const p = await this.getManifestJson(t.entry, t, {}), d = setGlobalSnapshotInfoByModuleInfo(t, p), { remoteSnapshot: y } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1814
1833
|
options: this.HostInstance.options,
|
|
1815
1834
|
moduleInfo: t,
|
|
1816
1835
|
remoteSnapshot: p,
|
|
1817
1836
|
from: "global"
|
|
1818
1837
|
});
|
|
1819
|
-
u = y,
|
|
1838
|
+
u = y, m = d;
|
|
1820
1839
|
} else
|
|
1821
1840
|
error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
|
|
1822
1841
|
hostName: t.name,
|
|
@@ -1829,7 +1848,7 @@ class SnapshotHandler {
|
|
|
1829
1848
|
remoteSnapshot: u
|
|
1830
1849
|
}), {
|
|
1831
1850
|
remoteSnapshot: u,
|
|
1832
|
-
globalSnapshot:
|
|
1851
|
+
globalSnapshot: m
|
|
1833
1852
|
};
|
|
1834
1853
|
}
|
|
1835
1854
|
getGlobalRemoteInfo(t) {
|
|
@@ -1920,11 +1939,11 @@ class SharedHandler {
|
|
|
1920
1939
|
const u = await i.loading;
|
|
1921
1940
|
return i.loaded = !0, i.lib || (i.lib = u), c(i), u;
|
|
1922
1941
|
} else if (i) {
|
|
1923
|
-
const
|
|
1942
|
+
const m = (async () => {
|
|
1924
1943
|
const p = await i.get();
|
|
1925
1944
|
l.lib = p, l.loaded = !0, c(l);
|
|
1926
|
-
const
|
|
1927
|
-
return
|
|
1945
|
+
const d = getRegisteredShare(this.shareScopeMap, t, l, this.hooks.lifecycle.resolveShare);
|
|
1946
|
+
return d && (d.lib = p, d.loaded = !0), p;
|
|
1928
1947
|
})();
|
|
1929
1948
|
return this.setShared({
|
|
1930
1949
|
pkgName: t,
|
|
@@ -1932,16 +1951,16 @@ class SharedHandler {
|
|
|
1932
1951
|
shared: i,
|
|
1933
1952
|
from: o.options.name,
|
|
1934
1953
|
lib: null,
|
|
1935
|
-
loading:
|
|
1936
|
-
}),
|
|
1954
|
+
loading: m
|
|
1955
|
+
}), m;
|
|
1937
1956
|
} else {
|
|
1938
1957
|
if (n != null && n.customShareInfo)
|
|
1939
1958
|
return !1;
|
|
1940
|
-
const
|
|
1959
|
+
const m = (async () => {
|
|
1941
1960
|
const p = await l.get();
|
|
1942
1961
|
l.lib = p, l.loaded = !0, c(l);
|
|
1943
|
-
const
|
|
1944
|
-
return
|
|
1962
|
+
const d = getRegisteredShare(this.shareScopeMap, t, l, this.hooks.lifecycle.resolveShare);
|
|
1963
|
+
return d && (d.lib = p, d.loaded = !0), p;
|
|
1945
1964
|
})();
|
|
1946
1965
|
return this.setShared({
|
|
1947
1966
|
pkgName: t,
|
|
@@ -1949,8 +1968,8 @@ class SharedHandler {
|
|
|
1949
1968
|
shared: l,
|
|
1950
1969
|
from: o.options.name,
|
|
1951
1970
|
lib: null,
|
|
1952
|
-
loading:
|
|
1953
|
-
}),
|
|
1971
|
+
loading: m
|
|
1972
|
+
}), m;
|
|
1954
1973
|
}
|
|
1955
1974
|
}
|
|
1956
1975
|
/**
|
|
@@ -1966,39 +1985,39 @@ class SharedHandler {
|
|
|
1966
1985
|
if (s !== "build") {
|
|
1967
1986
|
const { initTokens: _ } = this;
|
|
1968
1987
|
l || (l = []);
|
|
1969
|
-
let
|
|
1970
|
-
if (
|
|
1988
|
+
let E = _[t];
|
|
1989
|
+
if (E || (E = _[t] = {
|
|
1971
1990
|
from: this.host.name
|
|
1972
|
-
}), l.indexOf(
|
|
1991
|
+
}), l.indexOf(E) >= 0)
|
|
1973
1992
|
return i;
|
|
1974
|
-
l.push(
|
|
1993
|
+
l.push(E);
|
|
1975
1994
|
}
|
|
1976
1995
|
const c = this.shareScopeMap, u = o.options.name;
|
|
1977
1996
|
c[t] || (c[t] = {});
|
|
1978
|
-
const
|
|
1997
|
+
const m = c[t], p = (_, E) => {
|
|
1979
1998
|
var g;
|
|
1980
|
-
const { version:
|
|
1981
|
-
|
|
1982
|
-
const I =
|
|
1983
|
-
(!
|
|
1984
|
-
},
|
|
1985
|
-
const { module:
|
|
1999
|
+
const { version: b, eager: S } = E;
|
|
2000
|
+
m[_] = m[_] || {};
|
|
2001
|
+
const I = m[_], v = I[b], R = !!(v && (v.eager || (g = v.shareConfig) != null && g.eager));
|
|
2002
|
+
(!v || v.strategy !== "loaded-first" && !v.loaded && (!S != !R ? S : u > v.from)) && (I[b] = E);
|
|
2003
|
+
}, d = (_) => _ && _.init && _.init(c[t], l), y = async (_) => {
|
|
2004
|
+
const { module: E } = await o.remoteHandler.getRemoteModuleAndOptions({
|
|
1986
2005
|
id: _
|
|
1987
2006
|
});
|
|
1988
|
-
if (
|
|
2007
|
+
if (E.getEntry) {
|
|
1989
2008
|
let g;
|
|
1990
2009
|
try {
|
|
1991
|
-
g = await
|
|
1992
|
-
} catch (
|
|
2010
|
+
g = await E.getEntry();
|
|
2011
|
+
} catch (b) {
|
|
1993
2012
|
g = await o.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
1994
2013
|
id: _,
|
|
1995
|
-
error:
|
|
2014
|
+
error: b,
|
|
1996
2015
|
from: "runtime",
|
|
1997
2016
|
lifecycle: "beforeLoadShare",
|
|
1998
2017
|
origin: o
|
|
1999
2018
|
});
|
|
2000
2019
|
}
|
|
2001
|
-
|
|
2020
|
+
E.inited || (await d(g), E.inited = !0);
|
|
2002
2021
|
}
|
|
2003
2022
|
};
|
|
2004
2023
|
return Object.keys(o.options.shared).forEach((_) => {
|
|
@@ -2077,27 +2096,27 @@ class SharedHandler {
|
|
|
2077
2096
|
});
|
|
2078
2097
|
}
|
|
2079
2098
|
setShared({ pkgName: t, shared: n, from: o, lib: s, loading: a, loaded: l, get: i }) {
|
|
2080
|
-
const { version: c, scope: u = "default" } = n,
|
|
2099
|
+
const { version: c, scope: u = "default" } = n, m = _object_without_properties_loose(n, [
|
|
2081
2100
|
"version",
|
|
2082
2101
|
"scope"
|
|
2083
2102
|
]);
|
|
2084
2103
|
(Array.isArray(u) ? u : [
|
|
2085
2104
|
u
|
|
2086
|
-
]).forEach((
|
|
2087
|
-
if (this.shareScopeMap[
|
|
2088
|
-
this.shareScopeMap[
|
|
2105
|
+
]).forEach((d) => {
|
|
2106
|
+
if (this.shareScopeMap[d] || (this.shareScopeMap[d] = {}), this.shareScopeMap[d][t] || (this.shareScopeMap[d][t] = {}), !this.shareScopeMap[d][t][c]) {
|
|
2107
|
+
this.shareScopeMap[d][t][c] = _extends$1({
|
|
2089
2108
|
version: c,
|
|
2090
2109
|
scope: [
|
|
2091
2110
|
"default"
|
|
2092
2111
|
]
|
|
2093
|
-
},
|
|
2112
|
+
}, m, {
|
|
2094
2113
|
lib: s,
|
|
2095
2114
|
loaded: l,
|
|
2096
2115
|
loading: a
|
|
2097
|
-
}), i && (this.shareScopeMap[
|
|
2116
|
+
}), i && (this.shareScopeMap[d][t][c].get = i);
|
|
2098
2117
|
return;
|
|
2099
2118
|
}
|
|
2100
|
-
const y = this.shareScopeMap[
|
|
2119
|
+
const y = this.shareScopeMap[d][t][c];
|
|
2101
2120
|
a && !y.loading && (y.loading = a);
|
|
2102
2121
|
});
|
|
2103
2122
|
}
|
|
@@ -2153,10 +2172,10 @@ class RemoteHandler {
|
|
|
2153
2172
|
loadFactory: !0
|
|
2154
2173
|
}, { module: a, moduleOptions: l, remoteMatchInfo: i } = await this.getRemoteModuleAndOptions({
|
|
2155
2174
|
id: t
|
|
2156
|
-
}), { pkgNameOrAlias: c, remote: u, expose:
|
|
2175
|
+
}), { pkgNameOrAlias: c, remote: u, expose: m, id: p, remoteSnapshot: d } = i, y = await a.get(p, m, n, d), _ = await this.hooks.lifecycle.onLoad.emit({
|
|
2157
2176
|
id: p,
|
|
2158
2177
|
pkgNameOrAlias: c,
|
|
2159
|
-
expose:
|
|
2178
|
+
expose: m,
|
|
2160
2179
|
exposeModule: s ? y : void 0,
|
|
2161
2180
|
exposeModuleFactory: s ? void 0 : y,
|
|
2162
2181
|
remote: u,
|
|
@@ -2240,15 +2259,15 @@ class RemoteHandler {
|
|
|
2240
2259
|
options: n.options,
|
|
2241
2260
|
origin: n,
|
|
2242
2261
|
remoteInfo: c
|
|
2243
|
-
})), { remote:
|
|
2244
|
-
assert(
|
|
2245
|
-
let
|
|
2262
|
+
})), { remote: m, expose: p } = u;
|
|
2263
|
+
assert(m && p, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${a}.`);
|
|
2264
|
+
let d = n.moduleCache.get(m.name);
|
|
2246
2265
|
const y = {
|
|
2247
2266
|
host: n,
|
|
2248
2267
|
remoteInfo: c
|
|
2249
2268
|
};
|
|
2250
|
-
return
|
|
2251
|
-
module:
|
|
2269
|
+
return d || (d = new Module(y), n.moduleCache.set(m.name, d)), {
|
|
2270
|
+
module: d,
|
|
2252
2271
|
moduleOptions: y,
|
|
2253
2272
|
remoteMatchInfo: u
|
|
2254
2273
|
};
|
|
@@ -2298,45 +2317,45 @@ class RemoteHandler {
|
|
|
2298
2317
|
}
|
|
2299
2318
|
const u = getRemoteEntryUniqueKey(l.remoteInfo);
|
|
2300
2319
|
globalLoading[u] && delete globalLoading[u], o.snapshotHandler.manifestCache.delete(i.entry);
|
|
2301
|
-
let
|
|
2302
|
-
const p = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => i.buildVersion ? y.options.id ===
|
|
2320
|
+
let m = i.buildVersion ? composeKeyWithSeparator(i.name, i.buildVersion) : i.name;
|
|
2321
|
+
const p = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => i.buildVersion ? y.options.id === m : y.name === m);
|
|
2303
2322
|
if (p !== -1) {
|
|
2304
2323
|
const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[p];
|
|
2305
|
-
|
|
2324
|
+
m = y.options.id || m;
|
|
2306
2325
|
const _ = getGlobalShareScope();
|
|
2307
|
-
let
|
|
2326
|
+
let E = !0;
|
|
2308
2327
|
const g = [];
|
|
2309
|
-
Object.keys(_).forEach((
|
|
2310
|
-
const
|
|
2311
|
-
|
|
2312
|
-
const
|
|
2313
|
-
|
|
2314
|
-
const $ =
|
|
2328
|
+
Object.keys(_).forEach((b) => {
|
|
2329
|
+
const S = _[b];
|
|
2330
|
+
S && Object.keys(S).forEach((I) => {
|
|
2331
|
+
const v = S[I];
|
|
2332
|
+
v && Object.keys(v).forEach((R) => {
|
|
2333
|
+
const $ = v[R];
|
|
2315
2334
|
$ && Object.keys($).forEach((w) => {
|
|
2316
2335
|
const O = $[w];
|
|
2317
|
-
O && typeof O == "object" && O.from === i.name && (O.loaded || O.loading ? (O.useIn = O.useIn.filter((T) => T !== i.name), O.useIn.length ?
|
|
2318
|
-
E,
|
|
2319
|
-
I,
|
|
2336
|
+
O && typeof O == "object" && O.from === i.name && (O.loaded || O.loading ? (O.useIn = O.useIn.filter((T) => T !== i.name), O.useIn.length ? E = !1 : g.push([
|
|
2320
2337
|
b,
|
|
2338
|
+
I,
|
|
2339
|
+
R,
|
|
2321
2340
|
w
|
|
2322
2341
|
])) : g.push([
|
|
2323
|
-
E,
|
|
2324
|
-
I,
|
|
2325
2342
|
b,
|
|
2343
|
+
I,
|
|
2344
|
+
R,
|
|
2326
2345
|
w
|
|
2327
2346
|
]));
|
|
2328
2347
|
});
|
|
2329
2348
|
});
|
|
2330
2349
|
});
|
|
2331
|
-
}),
|
|
2332
|
-
var
|
|
2333
|
-
(w = _[
|
|
2350
|
+
}), E && (y.shareScopeMap = {}, delete _[m]), g.forEach(([b, S, I, v]) => {
|
|
2351
|
+
var R, $, w;
|
|
2352
|
+
(w = _[b]) == null || ($ = w[S]) == null || (R = $[I]) == null || delete R[v];
|
|
2334
2353
|
}), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(p, 1);
|
|
2335
2354
|
}
|
|
2336
|
-
const { hostGlobalSnapshot:
|
|
2337
|
-
if (
|
|
2338
|
-
const y =
|
|
2339
|
-
y && (delete
|
|
2355
|
+
const { hostGlobalSnapshot: d } = getGlobalRemoteInfo(t, o);
|
|
2356
|
+
if (d) {
|
|
2357
|
+
const y = d && "remotesInfo" in d && d.remotesInfo && getInfoWithoutType(d.remotesInfo, t.name).key;
|
|
2358
|
+
y && (delete d.remotesInfo[y], Global.__FEDERATION__.__MANIFEST_LOADING__[y] && delete Global.__FEDERATION__.__MANIFEST_LOADING__[y]);
|
|
2340
2359
|
}
|
|
2341
2360
|
o.moduleCache.delete(t.name);
|
|
2342
2361
|
}
|
|
@@ -2410,8 +2429,8 @@ class FederationHost {
|
|
|
2410
2429
|
}), l = this.remoteHandler.formatAndRegisterRemote(a, s), { shared: i } = this.sharedHandler.registerShared(a, s), c = [
|
|
2411
2430
|
...a.plugins
|
|
2412
2431
|
];
|
|
2413
|
-
s.plugins && s.plugins.forEach((
|
|
2414
|
-
c.includes(
|
|
2432
|
+
s.plugins && s.plugins.forEach((m) => {
|
|
2433
|
+
c.includes(m) || c.push(m);
|
|
2415
2434
|
});
|
|
2416
2435
|
const u = _extends$1({}, t, n, {
|
|
2417
2436
|
plugins: c,
|
|
@@ -2445,7 +2464,7 @@ class FederationHost {
|
|
|
2445
2464
|
beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
|
|
2446
2465
|
// maybe will change, temporarily for internal use only
|
|
2447
2466
|
initContainer: new AsyncWaterfallHook("initContainer")
|
|
2448
|
-
}), this.version = "0.8.
|
|
2467
|
+
}), this.version = "0.8.6", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
|
|
2449
2468
|
// FIXME: may not be suitable , not open to the public yet
|
|
2450
2469
|
getModuleInfo: new SyncHook(),
|
|
2451
2470
|
createScript: new SyncHook(),
|
|
@@ -2484,33 +2503,33 @@ setGlobalFederationConstructor(FederationHost);
|
|
|
2484
2503
|
function createBridgeComponent(r) {
|
|
2485
2504
|
const t = /* @__PURE__ */ new Map(), n = getInstance();
|
|
2486
2505
|
return () => ({
|
|
2487
|
-
__APP_VERSION__: "0.8.
|
|
2506
|
+
__APP_VERSION__: "0.8.6",
|
|
2488
2507
|
async render(o) {
|
|
2489
|
-
var c, u,
|
|
2490
|
-
LoggerInstance.
|
|
2508
|
+
var c, u, m;
|
|
2509
|
+
LoggerInstance.debug("createBridgeComponent render Info", o);
|
|
2491
2510
|
const s = Vue.createApp(r.rootComponent);
|
|
2492
2511
|
t.set(o.dom, s);
|
|
2493
|
-
const a = await ((
|
|
2512
|
+
const a = await ((m = (u = (c = n == null ? void 0 : n.bridgeHook) == null ? void 0 : c.lifecycle) == null ? void 0 : u.beforeBridgeRender) == null ? void 0 : m.emit(o)), l = a && typeof a == "object" && (a != null && a.extraProps) ? a == null ? void 0 : a.extraProps : {}, i = r.appOptions({
|
|
2494
2513
|
app: s,
|
|
2495
2514
|
basename: o.basename,
|
|
2496
2515
|
memoryRoute: o.memoryRoute,
|
|
2497
2516
|
...l
|
|
2498
2517
|
});
|
|
2499
2518
|
if (i != null && i.router) {
|
|
2500
|
-
const p = o.memoryRoute ? VueRouter.createMemoryHistory(o.basename) : VueRouter.createWebHistory(o.basename),
|
|
2519
|
+
const p = o.memoryRoute ? VueRouter.createMemoryHistory(o.basename) : VueRouter.createWebHistory(o.basename), d = VueRouter.createRouter({
|
|
2501
2520
|
...i.router.options,
|
|
2502
2521
|
history: p,
|
|
2503
2522
|
routes: i.router.getRoutes()
|
|
2504
2523
|
});
|
|
2505
2524
|
LoggerInstance.log("createBridgeComponent render router info>>>", {
|
|
2506
2525
|
name: o.moduleName,
|
|
2507
|
-
router:
|
|
2508
|
-
}), o.memoryRoute && await
|
|
2526
|
+
router: d
|
|
2527
|
+
}), o.memoryRoute && await d.push(o.memoryRoute.entryPath), s.use(d);
|
|
2509
2528
|
}
|
|
2510
2529
|
s.mount(o.dom);
|
|
2511
2530
|
},
|
|
2512
2531
|
destroy(o) {
|
|
2513
|
-
LoggerInstance.
|
|
2532
|
+
LoggerInstance.debug("createBridgeComponent destroy Info", o);
|
|
2514
2533
|
const s = t.get(o == null ? void 0 : o.dom);
|
|
2515
2534
|
s == null || s.unmount();
|
|
2516
2535
|
}
|
|
@@ -2530,8 +2549,8 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2530
2549
|
},
|
|
2531
2550
|
setup(r) {
|
|
2532
2551
|
const t = ref(null), n = ref(null), o = ref(""), s = useRoute(), a = () => {
|
|
2533
|
-
var
|
|
2534
|
-
const i = (
|
|
2552
|
+
var m;
|
|
2553
|
+
const i = (m = r.providerInfo) == null ? void 0 : m.call(r);
|
|
2535
2554
|
n.value = i;
|
|
2536
2555
|
let c = {
|
|
2537
2556
|
name: r.moduleName,
|
|
@@ -2539,12 +2558,12 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2539
2558
|
basename: r.basename,
|
|
2540
2559
|
memoryRoute: r.memoryRoute
|
|
2541
2560
|
};
|
|
2542
|
-
LoggerInstance.
|
|
2561
|
+
LoggerInstance.debug("createRemoteComponent LazyComponent render >>>", c), c = {
|
|
2543
2562
|
...c,
|
|
2544
2563
|
...{}.extraProps
|
|
2545
2564
|
}, i.render(c);
|
|
2546
2565
|
}, l = watch(() => s.path, (i) => {
|
|
2547
|
-
i !== s.path && a(), o.value !== "" && o.value !== i && (LoggerInstance.
|
|
2566
|
+
i !== s.path && a(), o.value !== "" && o.value !== i && (LoggerInstance.debug("createRemoteComponent dispatchPopstateEnv >>>", {
|
|
2548
2567
|
...r,
|
|
2549
2568
|
pathname: s.path
|
|
2550
2569
|
}), e()), o.value = i;
|
|
@@ -2553,7 +2572,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2553
2572
|
a();
|
|
2554
2573
|
}), onBeforeUnmount(() => {
|
|
2555
2574
|
var i;
|
|
2556
|
-
LoggerInstance.
|
|
2575
|
+
LoggerInstance.debug("createRemoteComponent LazyComponent destroy >>>", {
|
|
2557
2576
|
...r
|
|
2558
2577
|
}), l(), (i = n.value) == null || i.destroy({
|
|
2559
2578
|
dom: t.value
|
|
@@ -2565,7 +2584,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2565
2584
|
});
|
|
2566
2585
|
function createRemoteComponent(r) {
|
|
2567
2586
|
return defineAsyncComponent({
|
|
2568
|
-
__APP_VERSION__: "0.8.
|
|
2587
|
+
__APP_VERSION__: "0.8.6",
|
|
2569
2588
|
...r.asyncComponentOptions,
|
|
2570
2589
|
//@ts-ignore
|
|
2571
2590
|
loader: async () => {
|
|
@@ -2575,12 +2594,12 @@ function createRemoteComponent(r) {
|
|
|
2575
2594
|
const o = (c = t.matched[0]) == null ? void 0 : c.path;
|
|
2576
2595
|
o && (o.endsWith("/:pathMatch(.*)*") ? n = o.replace("/:pathMatch(.*)*", "") : n = t.matched[0].path);
|
|
2577
2596
|
const s = (r == null ? void 0 : r.export) || "default";
|
|
2578
|
-
LoggerInstance.
|
|
2597
|
+
LoggerInstance.debug("createRemoteComponent LazyComponent create >>>", {
|
|
2579
2598
|
basename: n,
|
|
2580
2599
|
info: r
|
|
2581
2600
|
});
|
|
2582
2601
|
const a = await r.loader(), l = a && a[Symbol.for("mf_module_id")], i = a[s];
|
|
2583
|
-
if (LoggerInstance.
|
|
2602
|
+
if (LoggerInstance.debug(
|
|
2584
2603
|
"createRemoteComponent LazyComponent loadRemote info >>>",
|
|
2585
2604
|
{ name: l, module: a, exportName: s, basename: n, route: t }
|
|
2586
2605
|
), s in a && typeof i == "function")
|