@module-federation/bridge-vue3 0.0.0-next-20250219103339 → 0.0.0-next-20250220101307
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 +13 -4
- package/dist/index.cjs.js +6 -6
- package/dist/index.es.js +591 -604
- package/package.json +4 -4
package/dist/index.es.js
CHANGED
|
@@ -2,32 +2,19 @@ import * as Vue from "vue";
|
|
|
2
2
|
import { defineComponent, ref, watch, onMounted, onBeforeUnmount, createVNode, defineAsyncComponent, h } from "vue";
|
|
3
3
|
import * as VueRouter from "vue-router";
|
|
4
4
|
import { useRoute } from "vue-router";
|
|
5
|
-
var
|
|
6
|
-
for (var n in t)
|
|
7
|
-
__defProp(r, n, { get: t[n], enumerable: !0 });
|
|
8
|
-
}, __copyProps = (r, t, n, o) => {
|
|
9
|
-
if (t && typeof t == "object" || typeof t == "function")
|
|
10
|
-
for (let s of __getOwnPropNames(t))
|
|
11
|
-
!__hasOwnProp.call(r, s) && s !== n && __defProp(r, s, { get: () => t[s], enumerable: !(o = __getOwnPropDesc(t, s)) || o.enumerable });
|
|
12
|
-
return r;
|
|
13
|
-
}, __toCommonJS = (r) => __copyProps(__defProp({}, "__esModule", { value: !0 }), r), browser_exports = {};
|
|
14
|
-
__export(browser_exports, {
|
|
15
|
-
createLogger: () => createLogger2,
|
|
16
|
-
logger: () => logger$1
|
|
17
|
-
});
|
|
18
|
-
var browser = __toCommonJS(browser_exports), supportsSubstitutions = void 0, supportColor = () => {
|
|
5
|
+
var supportsSubstitutions = void 0, supportColor = () => {
|
|
19
6
|
if (typeof supportsSubstitutions < "u")
|
|
20
7
|
return supportsSubstitutions;
|
|
21
|
-
const
|
|
8
|
+
const o = console.log;
|
|
22
9
|
try {
|
|
23
10
|
const t = "color test", n = "color: red;";
|
|
24
|
-
supportsSubstitutions = !1, console.log = (...
|
|
25
|
-
|
|
11
|
+
supportsSubstitutions = !1, console.log = (...r) => {
|
|
12
|
+
r[0] === `%c${t}` && r[1] === n && (supportsSubstitutions = !0);
|
|
26
13
|
}, console.log(`%c${t}`, n);
|
|
27
14
|
} catch {
|
|
28
15
|
supportsSubstitutions = !1;
|
|
29
16
|
} finally {
|
|
30
|
-
console.log =
|
|
17
|
+
console.log = o;
|
|
31
18
|
}
|
|
32
19
|
return supportsSubstitutions;
|
|
33
20
|
}, ansiToCss = {
|
|
@@ -38,26 +25,26 @@ var browser = __toCommonJS(browser_exports), supportsSubstitutions = void 0, sup
|
|
|
38
25
|
dodgerblue: "color: dodgerblue;",
|
|
39
26
|
magenta: "color: magenta;",
|
|
40
27
|
gray: "color: gray;"
|
|
41
|
-
}, formatter = (
|
|
28
|
+
}, formatter = (o) => supportColor() ? (t) => {
|
|
42
29
|
if (Array.isArray(t)) {
|
|
43
|
-
const [n,
|
|
44
|
-
return [`%c${n.replace("%c", "")}`,
|
|
30
|
+
const [n, r] = t;
|
|
31
|
+
return [`%c${n.replace("%c", "")}`, r ? `${ansiToCss[o]}${r}` : `${ansiToCss[o] || ""}`];
|
|
45
32
|
}
|
|
46
|
-
return [`%c${String(t).replace("%c", "")}`, ansiToCss[
|
|
33
|
+
return [`%c${String(t).replace("%c", "")}`, ansiToCss[o] || ""];
|
|
47
34
|
} : (t) => [String(t)], bold = formatter("bold"), red = formatter("red"), green = formatter("green"), orange = formatter("orange"), dodgerblue = formatter("dodgerblue"), magenta = formatter("magenta");
|
|
48
35
|
formatter("gray");
|
|
49
|
-
function getLabel(
|
|
50
|
-
let
|
|
36
|
+
function getLabel(o, t, n) {
|
|
37
|
+
let r = [""];
|
|
51
38
|
if ("label" in t)
|
|
52
|
-
if (
|
|
53
|
-
const l = t.color(
|
|
54
|
-
Array.isArray(l) && l.length === 2 ?
|
|
39
|
+
if (r = [(o !== "log" ? n[o] : void 0) || t.label || ""], t.color) {
|
|
40
|
+
const l = t.color(r[0]);
|
|
41
|
+
Array.isArray(l) && l.length === 2 ? r = bold([l[0], l[1]]) : r = bold(l[0] || "");
|
|
55
42
|
} else
|
|
56
|
-
|
|
57
|
-
return
|
|
43
|
+
r = bold(r[0]);
|
|
44
|
+
return r = r.filter(Boolean), r;
|
|
58
45
|
}
|
|
59
|
-
function finalLog(
|
|
60
|
-
|
|
46
|
+
function finalLog(o, t, n, r) {
|
|
47
|
+
o.length ? Array.isArray(r) ? console.log(...o, ...r, ...n) : console.log(...o, t, ...n) : Array.isArray(r) ? console.log(...r) : console.log(t, ...n);
|
|
61
48
|
}
|
|
62
49
|
var LOG_LEVEL = {
|
|
63
50
|
error: 0,
|
|
@@ -65,17 +52,17 @@ var LOG_LEVEL = {
|
|
|
65
52
|
info: 2,
|
|
66
53
|
log: 3,
|
|
67
54
|
verbose: 4
|
|
68
|
-
}, errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/, anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/, isErrorStackMessage = (
|
|
69
|
-
function validateOptions(
|
|
70
|
-
const t = { ...
|
|
71
|
-
if (
|
|
55
|
+
}, errorStackRegExp = /at\s.*:\d+:\d+[\s\)]*$/, anonymousErrorStackRegExp = /at\s.*\(<anonymous>\)$/, isErrorStackMessage = (o) => errorStackRegExp.test(o) || anonymousErrorStackRegExp.test(o);
|
|
56
|
+
function validateOptions(o) {
|
|
57
|
+
const t = { ...o };
|
|
58
|
+
if (o.labels && typeof o.labels != "object")
|
|
72
59
|
throw new Error("Labels must be an object");
|
|
73
|
-
if (
|
|
60
|
+
if (o.level && typeof o.level != "string")
|
|
74
61
|
throw new Error("Level must be a string");
|
|
75
62
|
return t;
|
|
76
63
|
}
|
|
77
|
-
var createLogger$1 = (
|
|
78
|
-
const a = validateOptions(
|
|
64
|
+
var createLogger$1 = (o = {}, { getLabel: t, handleError: n, finalLog: r, greet: s, LOG_TYPES: l }) => {
|
|
65
|
+
const a = validateOptions(o);
|
|
79
66
|
let i = a.level || "log", c = a.labels || {}, u = (p, m, ...y) => {
|
|
80
67
|
if (LOG_LEVEL[l[p].level] > LOG_LEVEL[i])
|
|
81
68
|
return;
|
|
@@ -96,7 +83,7 @@ ${n(S.join(`
|
|
|
96
83
|
_.level === "error" && typeof m == "string" ? E = m.split(`
|
|
97
84
|
`).map((S) => isErrorStackMessage(S) ? n(S) : S).join(`
|
|
98
85
|
`) : E = `${m}`;
|
|
99
|
-
|
|
86
|
+
r(g, E, y, m);
|
|
100
87
|
}, d = {
|
|
101
88
|
// greet
|
|
102
89
|
greet: (p) => u("log", s(p))
|
|
@@ -116,17 +103,17 @@ ${n(S.join(`
|
|
|
116
103
|
}), d.override = (p) => {
|
|
117
104
|
Object.assign(d, p);
|
|
118
105
|
}, d;
|
|
119
|
-
}, startColor = [189, 255, 243], endColor = [74, 194, 154], isWord = (
|
|
120
|
-
function gradient(
|
|
106
|
+
}, startColor = [189, 255, 243], endColor = [74, 194, 154], isWord = (o) => !/[\s\n]/.test(o);
|
|
107
|
+
function gradient(o) {
|
|
121
108
|
if (!supportColor())
|
|
122
|
-
return [
|
|
123
|
-
const t = [...
|
|
124
|
-
if (
|
|
125
|
-
return console.log(`%c${
|
|
109
|
+
return [o];
|
|
110
|
+
const t = [...o], n = t.filter(isWord), r = n.length - 1;
|
|
111
|
+
if (r === 0)
|
|
112
|
+
return console.log(`%c${o}`, `color: rgb(${startColor.join(",")}); font-weight: bold;`), [o];
|
|
126
113
|
let s = "", l = [];
|
|
127
114
|
return t.forEach((a) => {
|
|
128
115
|
if (isWord(a)) {
|
|
129
|
-
const i = n.indexOf(a) /
|
|
116
|
+
const i = n.indexOf(a) / r, c = Math.round(startColor[0] + (endColor[0] - startColor[0]) * i), u = Math.round(startColor[1] + (endColor[1] - startColor[1]) * i), d = Math.round(startColor[2] + (endColor[2] - startColor[2]) * i);
|
|
130
117
|
s += `%c${a}`, l.push(`color: rgb(${c},${u},${d}); font-weight: bold;`);
|
|
131
118
|
} else
|
|
132
119
|
s += a;
|
|
@@ -177,8 +164,8 @@ var LOG_TYPES = {
|
|
|
177
164
|
color: magenta
|
|
178
165
|
}
|
|
179
166
|
};
|
|
180
|
-
function createLogger2(
|
|
181
|
-
return createLogger$1(
|
|
167
|
+
function createLogger2(o = {}) {
|
|
168
|
+
return createLogger$1(o, {
|
|
182
169
|
handleError: (t) => t,
|
|
183
170
|
getLabel,
|
|
184
171
|
gradient,
|
|
@@ -187,13 +174,13 @@ function createLogger2(r = {}) {
|
|
|
187
174
|
greet: (t) => gradient(t)
|
|
188
175
|
});
|
|
189
176
|
}
|
|
190
|
-
|
|
177
|
+
createLogger2();
|
|
191
178
|
function _extends$2() {
|
|
192
179
|
return _extends$2 = Object.assign || function(t) {
|
|
193
180
|
for (var n = 1; n < arguments.length; n++) {
|
|
194
|
-
var
|
|
195
|
-
for (var s in
|
|
196
|
-
Object.prototype.hasOwnProperty.call(
|
|
181
|
+
var r = arguments[n];
|
|
182
|
+
for (var s in r)
|
|
183
|
+
Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
|
|
197
184
|
}
|
|
198
185
|
return t;
|
|
199
186
|
}, _extends$2.apply(this, arguments);
|
|
@@ -215,11 +202,11 @@ function isDebugMode() {
|
|
|
215
202
|
return typeof process < "u" && process.env && process.env.FEDERATION_DEBUG ? !!process.env.FEDERATION_DEBUG : typeof FEDERATION_DEBUG < "u" && FEDERATION_DEBUG ? !0 : isBrowserDebug();
|
|
216
203
|
}
|
|
217
204
|
const PREFIX = "[ Module Federation ]";
|
|
218
|
-
function setDebug(
|
|
219
|
-
isDebugMode() && (
|
|
205
|
+
function setDebug(o) {
|
|
206
|
+
isDebugMode() && (o.level = "verbose");
|
|
220
207
|
}
|
|
221
|
-
function setPrefix(
|
|
222
|
-
|
|
208
|
+
function setPrefix(o, t) {
|
|
209
|
+
o.labels = {
|
|
223
210
|
warn: `${t} Warn`,
|
|
224
211
|
error: `${t} Error`,
|
|
225
212
|
success: `${t} Success`,
|
|
@@ -228,8 +215,8 @@ function setPrefix(r, t) {
|
|
|
228
215
|
debug: `${t} Debug`
|
|
229
216
|
};
|
|
230
217
|
}
|
|
231
|
-
function createLogger(
|
|
232
|
-
const t =
|
|
218
|
+
function createLogger(o) {
|
|
219
|
+
const t = createLogger2({
|
|
233
220
|
labels: {
|
|
234
221
|
warn: `${PREFIX} Warn`,
|
|
235
222
|
error: `${PREFIX} Error`,
|
|
@@ -239,31 +226,31 @@ function createLogger(r) {
|
|
|
239
226
|
debug: `${PREFIX} Debug`
|
|
240
227
|
}
|
|
241
228
|
});
|
|
242
|
-
return setDebug(t), setPrefix(t,
|
|
229
|
+
return setDebug(t), setPrefix(t, o), t;
|
|
243
230
|
}
|
|
244
231
|
createLogger(PREFIX);
|
|
245
|
-
const LOG_CATEGORY$1 = "[ Federation Runtime ]", composeKeyWithSeparator = function(...
|
|
246
|
-
return
|
|
247
|
-
}, getResourceUrl = (
|
|
248
|
-
if ("getPublicPath" in
|
|
232
|
+
const LOG_CATEGORY$1 = "[ Federation Runtime ]", composeKeyWithSeparator = function(...o) {
|
|
233
|
+
return o.length ? o.reduce((t, n) => n ? t ? `${t}${SEPARATOR}${n}` : n : t, "") : "";
|
|
234
|
+
}, getResourceUrl = (o, t) => {
|
|
235
|
+
if ("getPublicPath" in o) {
|
|
249
236
|
let n;
|
|
250
|
-
return
|
|
237
|
+
return o.getPublicPath.startsWith("function") ? n = new Function("return " + o.getPublicPath)()() : n = new Function(o.getPublicPath)(), `${n}${t}`;
|
|
251
238
|
} else
|
|
252
|
-
return "publicPath" in
|
|
253
|
-
}, warn$1 = (
|
|
254
|
-
console.warn(`${LOG_CATEGORY$1}: ${
|
|
239
|
+
return "publicPath" in o ? `${o.publicPath}${t}` : (console.warn("Cannot get resource URL. If in debug mode, please ignore.", o, t), "");
|
|
240
|
+
}, warn$1 = (o) => {
|
|
241
|
+
console.warn(`${LOG_CATEGORY$1}: ${o}`);
|
|
255
242
|
};
|
|
256
|
-
function safeToString(
|
|
243
|
+
function safeToString(o) {
|
|
257
244
|
try {
|
|
258
|
-
return JSON.stringify(
|
|
245
|
+
return JSON.stringify(o, null, 2);
|
|
259
246
|
} catch {
|
|
260
247
|
return "";
|
|
261
248
|
}
|
|
262
249
|
}
|
|
263
|
-
const simpleJoinRemoteEntry = (
|
|
264
|
-
if (!
|
|
250
|
+
const simpleJoinRemoteEntry = (o, t) => {
|
|
251
|
+
if (!o)
|
|
265
252
|
return t;
|
|
266
|
-
const
|
|
253
|
+
const r = ((s) => {
|
|
267
254
|
if (s === ".")
|
|
268
255
|
return "";
|
|
269
256
|
if (s.startsWith("./"))
|
|
@@ -273,25 +260,25 @@ const simpleJoinRemoteEntry = (r, t) => {
|
|
|
273
260
|
return l.endsWith("/") ? l.slice(0, -1) : l;
|
|
274
261
|
}
|
|
275
262
|
return s;
|
|
276
|
-
})(
|
|
277
|
-
return
|
|
263
|
+
})(o);
|
|
264
|
+
return r ? r.endsWith("/") ? `${r}${t}` : `${r}/${t}` : t;
|
|
278
265
|
};
|
|
279
|
-
function inferAutoPublicPath(
|
|
280
|
-
return
|
|
266
|
+
function inferAutoPublicPath(o) {
|
|
267
|
+
return o.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
281
268
|
}
|
|
282
|
-
function generateSnapshotFromManifest(
|
|
283
|
-
var n,
|
|
269
|
+
function generateSnapshotFromManifest(o, t = {}) {
|
|
270
|
+
var n, r;
|
|
284
271
|
const { remotes: s = {}, overrides: l = {}, version: a } = t;
|
|
285
272
|
let i;
|
|
286
|
-
const c = () => "publicPath" in
|
|
273
|
+
const c = () => "publicPath" in o.metaData ? o.metaData.publicPath === "auto" && a ? inferAutoPublicPath(a) : o.metaData.publicPath : o.metaData.getPublicPath, u = Object.keys(l);
|
|
287
274
|
let d = {};
|
|
288
275
|
if (!Object.keys(s).length) {
|
|
289
276
|
var p;
|
|
290
|
-
d = ((p =
|
|
291
|
-
let
|
|
292
|
-
const
|
|
293
|
-
return u.includes(
|
|
294
|
-
matchedVersion:
|
|
277
|
+
d = ((p = o.remotes) == null ? void 0 : p.reduce((R, $) => {
|
|
278
|
+
let O;
|
|
279
|
+
const A = $.federationContainerName;
|
|
280
|
+
return u.includes(A) ? O = l[A] : "version" in $ ? O = $.version : O = $.entry, R[A] = {
|
|
281
|
+
matchedVersion: O
|
|
295
282
|
}, R;
|
|
296
283
|
}, {})) || {};
|
|
297
284
|
}
|
|
@@ -299,7 +286,7 @@ function generateSnapshotFromManifest(r, t = {}) {
|
|
|
299
286
|
// overrides will override dependencies
|
|
300
287
|
matchedVersion: u.includes(R) ? l[R] : s[R]
|
|
301
288
|
});
|
|
302
|
-
const { remoteEntry: { path: m, name: y, type: _ }, types: E, buildInfo: { buildVersion: g }, globalName: b, ssrRemoteEntry: S } =
|
|
289
|
+
const { remoteEntry: { path: m, name: y, type: _ }, types: E, buildInfo: { buildVersion: g }, globalName: b, ssrRemoteEntry: S } = o.metaData, { exposes: v } = o;
|
|
303
290
|
let I = {
|
|
304
291
|
version: a || "",
|
|
305
292
|
buildVersion: g,
|
|
@@ -310,7 +297,7 @@ function generateSnapshotFromManifest(r, t = {}) {
|
|
|
310
297
|
remoteTypesZip: E.zip || "",
|
|
311
298
|
remoteTypesAPI: E.api || "",
|
|
312
299
|
remotesInfo: d,
|
|
313
|
-
shared:
|
|
300
|
+
shared: o == null ? void 0 : o.shared.map((R) => ({
|
|
314
301
|
assets: R.assets,
|
|
315
302
|
sharedName: R.name,
|
|
316
303
|
version: R.version
|
|
@@ -321,20 +308,20 @@ function generateSnapshotFromManifest(r, t = {}) {
|
|
|
321
308
|
assets: R.assets
|
|
322
309
|
}))
|
|
323
310
|
};
|
|
324
|
-
if ((n =
|
|
325
|
-
const R =
|
|
311
|
+
if ((n = o.metaData) != null && n.prefetchInterface) {
|
|
312
|
+
const R = o.metaData.prefetchInterface;
|
|
326
313
|
I = _extends$2({}, I, {
|
|
327
314
|
prefetchInterface: R
|
|
328
315
|
});
|
|
329
316
|
}
|
|
330
|
-
if ((
|
|
331
|
-
const { path: R, name: $, type:
|
|
317
|
+
if ((r = o.metaData) != null && r.prefetchEntry) {
|
|
318
|
+
const { path: R, name: $, type: O } = o.metaData.prefetchEntry;
|
|
332
319
|
I = _extends$2({}, I, {
|
|
333
320
|
prefetchEntry: simpleJoinRemoteEntry(R, $),
|
|
334
|
-
prefetchEntryType:
|
|
321
|
+
prefetchEntryType: O
|
|
335
322
|
});
|
|
336
323
|
}
|
|
337
|
-
if ("publicPath" in
|
|
324
|
+
if ("publicPath" in o.metaData ? i = _extends$2({}, I, {
|
|
338
325
|
publicPath: c()
|
|
339
326
|
}) : i = _extends$2({}, I, {
|
|
340
327
|
getPublicPath: c()
|
|
@@ -344,46 +331,46 @@ function generateSnapshotFromManifest(r, t = {}) {
|
|
|
344
331
|
}
|
|
345
332
|
return i;
|
|
346
333
|
}
|
|
347
|
-
function isManifestProvider(
|
|
348
|
-
return !!("remoteEntry" in
|
|
334
|
+
function isManifestProvider(o) {
|
|
335
|
+
return !!("remoteEntry" in o && o.remoteEntry.includes(MANIFEST_EXT));
|
|
349
336
|
}
|
|
350
|
-
async function safeWrapper(
|
|
337
|
+
async function safeWrapper(o, t) {
|
|
351
338
|
try {
|
|
352
|
-
return await
|
|
339
|
+
return await o();
|
|
353
340
|
} catch (n) {
|
|
354
341
|
warn$1(n);
|
|
355
342
|
return;
|
|
356
343
|
}
|
|
357
344
|
}
|
|
358
|
-
function isStaticResourcesEqual(
|
|
359
|
-
const n = /^(https?:)?\/\//i,
|
|
360
|
-
return
|
|
345
|
+
function isStaticResourcesEqual(o, t) {
|
|
346
|
+
const n = /^(https?:)?\/\//i, r = o.replace(n, "").replace(/\/$/, ""), s = t.replace(n, "").replace(/\/$/, "");
|
|
347
|
+
return r === s;
|
|
361
348
|
}
|
|
362
|
-
function createScript(
|
|
363
|
-
let t = null, n = !0,
|
|
349
|
+
function createScript(o) {
|
|
350
|
+
let t = null, n = !0, r = 2e4, s;
|
|
364
351
|
const l = document.getElementsByTagName("script");
|
|
365
352
|
for (let i = 0; i < l.length; i++) {
|
|
366
353
|
const c = l[i], u = c.getAttribute("src");
|
|
367
|
-
if (u && isStaticResourcesEqual(u,
|
|
354
|
+
if (u && isStaticResourcesEqual(u, o.url)) {
|
|
368
355
|
t = c, n = !1;
|
|
369
356
|
break;
|
|
370
357
|
}
|
|
371
358
|
}
|
|
372
359
|
if (!t) {
|
|
373
|
-
const i =
|
|
360
|
+
const i = o.attrs;
|
|
374
361
|
t = document.createElement("script"), t.type = (i == null ? void 0 : i.type) === "module" ? "module" : "text/javascript";
|
|
375
362
|
let c;
|
|
376
|
-
|
|
363
|
+
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), i && !c && Object.keys(i).forEach((u) => {
|
|
377
364
|
t && (u === "async" || u === "defer" ? t[u] = i[u] : t.getAttribute(u) || t.setAttribute(u, i[u]));
|
|
378
365
|
});
|
|
379
366
|
}
|
|
380
367
|
const a = async (i, c) => {
|
|
381
368
|
clearTimeout(s);
|
|
382
369
|
const u = () => {
|
|
383
|
-
(c == null ? void 0 : c.type) === "error" ?
|
|
370
|
+
(c == null ? void 0 : c.type) === "error" ? o != null && o.onErrorCallback && (o == null || o.onErrorCallback(c)) : o != null && o.cb && (o == null || o.cb());
|
|
384
371
|
};
|
|
385
372
|
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
386
|
-
const { needDeleteScript: d = !0 } =
|
|
373
|
+
const { needDeleteScript: d = !0 } = o;
|
|
387
374
|
d && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
388
375
|
}), i && typeof i == "function")) {
|
|
389
376
|
const d = i(c);
|
|
@@ -396,36 +383,36 @@ function createScript(r) {
|
|
|
396
383
|
u();
|
|
397
384
|
};
|
|
398
385
|
return t.onerror = a.bind(null, t.onerror), t.onload = a.bind(null, t.onload), s = setTimeout(() => {
|
|
399
|
-
a(null, new Error(`Remote script "${
|
|
400
|
-
},
|
|
386
|
+
a(null, new Error(`Remote script "${o.url}" time-outed.`));
|
|
387
|
+
}, r), {
|
|
401
388
|
script: t,
|
|
402
389
|
needAttach: n
|
|
403
390
|
};
|
|
404
391
|
}
|
|
405
|
-
function createLink(
|
|
392
|
+
function createLink(o) {
|
|
406
393
|
let t = null, n = !0;
|
|
407
|
-
const
|
|
408
|
-
for (let l = 0; l <
|
|
409
|
-
const a =
|
|
410
|
-
if (i && isStaticResourcesEqual(i,
|
|
394
|
+
const r = document.getElementsByTagName("link");
|
|
395
|
+
for (let l = 0; l < r.length; l++) {
|
|
396
|
+
const a = r[l], i = a.getAttribute("href"), c = a.getAttribute("ref");
|
|
397
|
+
if (i && isStaticResourcesEqual(i, o.url) && c === o.attrs.ref) {
|
|
411
398
|
t = a, n = !1;
|
|
412
399
|
break;
|
|
413
400
|
}
|
|
414
401
|
}
|
|
415
402
|
if (!t) {
|
|
416
|
-
t = document.createElement("link"), t.setAttribute("href",
|
|
403
|
+
t = document.createElement("link"), t.setAttribute("href", o.url);
|
|
417
404
|
let l;
|
|
418
|
-
const a =
|
|
419
|
-
|
|
405
|
+
const a = o.attrs;
|
|
406
|
+
o.createLinkHook && (l = o.createLinkHook(o.url, a), l instanceof HTMLLinkElement && (t = l)), a && !l && Object.keys(a).forEach((i) => {
|
|
420
407
|
t && !t.getAttribute(i) && t.setAttribute(i, a[i]);
|
|
421
408
|
});
|
|
422
409
|
}
|
|
423
410
|
const s = (l, a) => {
|
|
424
411
|
const i = () => {
|
|
425
|
-
(a == null ? void 0 : a.type) === "error" ?
|
|
412
|
+
(a == null ? void 0 : a.type) === "error" ? o != null && o.onErrorCallback && (o == null || o.onErrorCallback(a)) : o != null && o.cb && (o == null || o.cb());
|
|
426
413
|
};
|
|
427
414
|
if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
|
|
428
|
-
const { needDeleteLink: c = !0 } =
|
|
415
|
+
const { needDeleteLink: c = !0 } = o;
|
|
429
416
|
c && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
430
417
|
}), l)) {
|
|
431
418
|
const c = l(a);
|
|
@@ -438,49 +425,49 @@ function createLink(r) {
|
|
|
438
425
|
needAttach: n
|
|
439
426
|
};
|
|
440
427
|
}
|
|
441
|
-
function loadScript(
|
|
442
|
-
const { attrs: n = {}, createScriptHook:
|
|
428
|
+
function loadScript(o, t) {
|
|
429
|
+
const { attrs: n = {}, createScriptHook: r } = t;
|
|
443
430
|
return new Promise((s, l) => {
|
|
444
431
|
const { script: a, needAttach: i } = createScript({
|
|
445
|
-
url:
|
|
432
|
+
url: o,
|
|
446
433
|
cb: s,
|
|
447
434
|
onErrorCallback: l,
|
|
448
435
|
attrs: _extends$2({
|
|
449
436
|
fetchpriority: "high"
|
|
450
437
|
}, n),
|
|
451
|
-
createScriptHook:
|
|
438
|
+
createScriptHook: r,
|
|
452
439
|
needDeleteScript: !0
|
|
453
440
|
});
|
|
454
441
|
i && document.head.appendChild(a);
|
|
455
442
|
});
|
|
456
443
|
}
|
|
457
|
-
function importNodeModule(
|
|
458
|
-
if (!
|
|
444
|
+
function importNodeModule(o) {
|
|
445
|
+
if (!o)
|
|
459
446
|
throw new Error("import specifier is required");
|
|
460
|
-
return new Function("name", "return import(name)")(
|
|
461
|
-
throw console.error(`Error importing module ${
|
|
447
|
+
return new Function("name", "return import(name)")(o).then((n) => n).catch((n) => {
|
|
448
|
+
throw console.error(`Error importing module ${o}:`, n), n;
|
|
462
449
|
});
|
|
463
450
|
}
|
|
464
451
|
const loadNodeFetch = async () => {
|
|
465
|
-
const
|
|
466
|
-
return
|
|
467
|
-
}, lazyLoaderHookFetch = async (
|
|
468
|
-
const s = await ((l, a) => n.lifecycle.fetch.emit(l, a))(
|
|
469
|
-
return !s || !(s instanceof Response) ? (typeof fetch > "u" ? await loadNodeFetch() : fetch)(
|
|
452
|
+
const o = await importNodeModule("node-fetch");
|
|
453
|
+
return o.default || o;
|
|
454
|
+
}, lazyLoaderHookFetch = async (o, t, n) => {
|
|
455
|
+
const s = await ((l, a) => n.lifecycle.fetch.emit(l, a))(o, t || {});
|
|
456
|
+
return !s || !(s instanceof Response) ? (typeof fetch > "u" ? await loadNodeFetch() : fetch)(o, t || {}) : s;
|
|
470
457
|
};
|
|
471
458
|
function createScriptNode(url, cb, attrs, loaderHook) {
|
|
472
459
|
if (loaderHook != null && loaderHook.createScriptHook) {
|
|
473
|
-
const
|
|
474
|
-
|
|
460
|
+
const o = loaderHook.createScriptHook(url);
|
|
461
|
+
o && typeof o == "object" && "url" in o && (url = o.url);
|
|
475
462
|
}
|
|
476
463
|
let urlObj;
|
|
477
464
|
try {
|
|
478
465
|
urlObj = new URL(url);
|
|
479
|
-
} catch (
|
|
480
|
-
console.error("Error constructing URL:",
|
|
466
|
+
} catch (o) {
|
|
467
|
+
console.error("Error constructing URL:", o), cb(new Error(`Invalid URL: ${o}`));
|
|
481
468
|
return;
|
|
482
469
|
}
|
|
483
|
-
const getFetch = async () => loaderHook != null && loaderHook.fetch ? (
|
|
470
|
+
const getFetch = async () => loaderHook != null && loaderHook.fetch ? (o, t) => lazyLoaderHookFetch(o, t, loaderHook) : typeof fetch > "u" ? loadNodeFetch() : fetch, handleScriptFetch = async (f, urlObj) => {
|
|
484
471
|
try {
|
|
485
472
|
var _vm_constants;
|
|
486
473
|
const res = await f(urlObj.href), data = await res.text(), [path, vm] = await Promise.all([
|
|
@@ -501,35 +488,35 @@ function createScriptNode(url, cb, attrs, loaderHook) {
|
|
|
501
488
|
script.runInThisContext()(scriptContext.exports, scriptContext.module, eval("require"), urlDirname, filename);
|
|
502
489
|
const exportedInterface = scriptContext.module.exports || scriptContext.exports;
|
|
503
490
|
if (attrs && exportedInterface && attrs.globalName) {
|
|
504
|
-
const
|
|
505
|
-
cb(void 0,
|
|
491
|
+
const o = exportedInterface[attrs.globalName] || exportedInterface;
|
|
492
|
+
cb(void 0, o);
|
|
506
493
|
return;
|
|
507
494
|
}
|
|
508
495
|
cb(void 0, exportedInterface);
|
|
509
|
-
} catch (
|
|
510
|
-
cb(
|
|
496
|
+
} catch (o) {
|
|
497
|
+
cb(o instanceof Error ? o : new Error(`Script execution error: ${o}`));
|
|
511
498
|
}
|
|
512
499
|
};
|
|
513
|
-
getFetch().then(async (
|
|
500
|
+
getFetch().then(async (o) => {
|
|
514
501
|
if ((attrs == null ? void 0 : attrs.type) === "esm" || (attrs == null ? void 0 : attrs.type) === "module")
|
|
515
502
|
return loadModule(urlObj.href, {
|
|
516
|
-
fetch:
|
|
503
|
+
fetch: o,
|
|
517
504
|
vm: await importNodeModule("vm")
|
|
518
505
|
}).then(async (t) => {
|
|
519
506
|
await t.evaluate(), cb(void 0, t.namespace);
|
|
520
507
|
}).catch((t) => {
|
|
521
508
|
cb(t instanceof Error ? t : new Error(`Script execution error: ${t}`));
|
|
522
509
|
});
|
|
523
|
-
handleScriptFetch(
|
|
524
|
-
}).catch((
|
|
525
|
-
cb(
|
|
510
|
+
handleScriptFetch(o, urlObj);
|
|
511
|
+
}).catch((o) => {
|
|
512
|
+
cb(o);
|
|
526
513
|
});
|
|
527
514
|
}
|
|
528
|
-
function loadScriptNode(
|
|
529
|
-
return new Promise((n,
|
|
530
|
-
createScriptNode(
|
|
515
|
+
function loadScriptNode(o, t) {
|
|
516
|
+
return new Promise((n, r) => {
|
|
517
|
+
createScriptNode(o, (s, l) => {
|
|
531
518
|
if (s)
|
|
532
|
-
|
|
519
|
+
r(s);
|
|
533
520
|
else {
|
|
534
521
|
var a, i;
|
|
535
522
|
const c = (t == null || (a = t.attrs) == null ? void 0 : a.globalName) || `__FEDERATION_${t == null || (i = t.attrs) == null ? void 0 : i.name}:custom__`, u = globalThis[c] = l;
|
|
@@ -538,16 +525,16 @@ function loadScriptNode(r, t) {
|
|
|
538
525
|
}, t.attrs, t.loaderHook);
|
|
539
526
|
});
|
|
540
527
|
}
|
|
541
|
-
async function loadModule(
|
|
542
|
-
const { fetch: n, vm:
|
|
528
|
+
async function loadModule(o, t) {
|
|
529
|
+
const { fetch: n, vm: r } = t, l = await (await n(o)).text(), a = new r.SourceTextModule(l, {
|
|
543
530
|
// @ts-ignore
|
|
544
531
|
importModuleDynamically: async (i, c) => {
|
|
545
|
-
const u = new URL(i,
|
|
532
|
+
const u = new URL(i, o).href;
|
|
546
533
|
return loadModule(u, t);
|
|
547
534
|
}
|
|
548
535
|
});
|
|
549
536
|
return await a.link(async (i) => {
|
|
550
|
-
const c = new URL(i,
|
|
537
|
+
const c = new URL(i, o).href;
|
|
551
538
|
return await loadModule(c, t);
|
|
552
539
|
}), a;
|
|
553
540
|
}
|
|
@@ -555,37 +542,37 @@ const LoggerInstance = createLogger("[ Module Federation Bridge Vue3 ]");
|
|
|
555
542
|
function _extends$1() {
|
|
556
543
|
return _extends$1 = Object.assign || function(t) {
|
|
557
544
|
for (var n = 1; n < arguments.length; n++) {
|
|
558
|
-
var
|
|
559
|
-
for (var s in
|
|
560
|
-
Object.prototype.hasOwnProperty.call(
|
|
545
|
+
var r = arguments[n];
|
|
546
|
+
for (var s in r)
|
|
547
|
+
Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
|
|
561
548
|
}
|
|
562
549
|
return t;
|
|
563
550
|
}, _extends$1.apply(this, arguments);
|
|
564
551
|
}
|
|
565
|
-
function _object_without_properties_loose(
|
|
566
|
-
if (
|
|
552
|
+
function _object_without_properties_loose(o, t) {
|
|
553
|
+
if (o == null)
|
|
567
554
|
return {};
|
|
568
|
-
var n = {},
|
|
569
|
-
for (l = 0; l <
|
|
570
|
-
s =
|
|
555
|
+
var n = {}, r = Object.keys(o), s, l;
|
|
556
|
+
for (l = 0; l < r.length; l++)
|
|
557
|
+
s = r[l], !(t.indexOf(s) >= 0) && (n[s] = o[s]);
|
|
571
558
|
return n;
|
|
572
559
|
}
|
|
573
|
-
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", TYPE_001 = "TYPE-001", BUILD_001 = "BUILD-001", getDocsUrl = (
|
|
560
|
+
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", TYPE_001 = "TYPE-001", BUILD_001 = "BUILD-001", getDocsUrl = (o) => `https://module-federation.io/guide/troubleshooting/${o.split("-")[0].toLowerCase()}/${o}`, getShortErrorMsg = (o, t, n, r) => {
|
|
574
561
|
const s = [
|
|
575
562
|
`${[
|
|
576
|
-
t[
|
|
577
|
-
]} #${
|
|
563
|
+
t[o]
|
|
564
|
+
]} #${o}`
|
|
578
565
|
];
|
|
579
|
-
return n && s.push(`args: ${JSON.stringify(n)}`), s.push(getDocsUrl(
|
|
580
|
-
${
|
|
566
|
+
return n && s.push(`args: ${JSON.stringify(n)}`), s.push(getDocsUrl(o)), r && s.push(`Original Error Message:
|
|
567
|
+
${r}`), s.join(`
|
|
581
568
|
`);
|
|
582
569
|
};
|
|
583
570
|
function _extends() {
|
|
584
571
|
return _extends = Object.assign || function(t) {
|
|
585
572
|
for (var n = 1; n < arguments.length; n++) {
|
|
586
|
-
var
|
|
587
|
-
for (var s in
|
|
588
|
-
Object.prototype.hasOwnProperty.call(
|
|
573
|
+
var r = arguments[n];
|
|
574
|
+
for (var s in r)
|
|
575
|
+
Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
|
|
589
576
|
}
|
|
590
577
|
return t;
|
|
591
578
|
}, _extends.apply(this, arguments);
|
|
@@ -606,58 +593,58 @@ const runtimeDescMap = {
|
|
|
606
593
|
};
|
|
607
594
|
_extends({}, runtimeDescMap, typeDescMap, buildDescMap);
|
|
608
595
|
const LOG_CATEGORY = "[ Federation Runtime ]", logger = createLogger(LOG_CATEGORY);
|
|
609
|
-
function assert(
|
|
610
|
-
|
|
596
|
+
function assert(o, t) {
|
|
597
|
+
o || error(t);
|
|
611
598
|
}
|
|
612
|
-
function error(
|
|
613
|
-
throw
|
|
599
|
+
function error(o) {
|
|
600
|
+
throw o instanceof Error ? (o.message = `${LOG_CATEGORY}: ${o.message}`, o) : new Error(`${LOG_CATEGORY}: ${o}`);
|
|
614
601
|
}
|
|
615
|
-
function warn(
|
|
616
|
-
|
|
602
|
+
function warn(o) {
|
|
603
|
+
o instanceof Error && (o.message = `${LOG_CATEGORY}: ${o.message}`), logger.warn(o);
|
|
617
604
|
}
|
|
618
|
-
function addUniqueItem(
|
|
619
|
-
return
|
|
605
|
+
function addUniqueItem(o, t) {
|
|
606
|
+
return o.findIndex((n) => n === t) === -1 && o.push(t), o;
|
|
620
607
|
}
|
|
621
|
-
function getFMId(
|
|
622
|
-
return "version" in
|
|
608
|
+
function getFMId(o) {
|
|
609
|
+
return "version" in o && o.version ? `${o.name}:${o.version}` : "entry" in o && o.entry ? `${o.name}:${o.entry}` : `${o.name}`;
|
|
623
610
|
}
|
|
624
|
-
function isRemoteInfoWithEntry(
|
|
625
|
-
return typeof
|
|
611
|
+
function isRemoteInfoWithEntry(o) {
|
|
612
|
+
return typeof o.entry < "u";
|
|
626
613
|
}
|
|
627
|
-
function isPureRemoteEntry(
|
|
628
|
-
return !
|
|
614
|
+
function isPureRemoteEntry(o) {
|
|
615
|
+
return !o.entry.includes(".json") && o.entry.includes(".js");
|
|
629
616
|
}
|
|
630
|
-
function isObject(
|
|
631
|
-
return
|
|
617
|
+
function isObject(o) {
|
|
618
|
+
return o && typeof o == "object";
|
|
632
619
|
}
|
|
633
620
|
const objectToString = Object.prototype.toString;
|
|
634
|
-
function isPlainObject(
|
|
635
|
-
return objectToString.call(
|
|
621
|
+
function isPlainObject(o) {
|
|
622
|
+
return objectToString.call(o) === "[object Object]";
|
|
636
623
|
}
|
|
637
|
-
function arrayOptions(
|
|
638
|
-
return Array.isArray(
|
|
639
|
-
|
|
624
|
+
function arrayOptions(o) {
|
|
625
|
+
return Array.isArray(o) ? o : [
|
|
626
|
+
o
|
|
640
627
|
];
|
|
641
628
|
}
|
|
642
|
-
function getRemoteEntryInfoFromSnapshot(
|
|
629
|
+
function getRemoteEntryInfoFromSnapshot(o) {
|
|
643
630
|
const t = {
|
|
644
631
|
url: "",
|
|
645
632
|
type: "global",
|
|
646
633
|
globalName: ""
|
|
647
634
|
};
|
|
648
|
-
return isBrowserEnv() ? "remoteEntry" in
|
|
649
|
-
url:
|
|
650
|
-
type:
|
|
651
|
-
globalName:
|
|
652
|
-
} : t : "ssrRemoteEntry" in
|
|
653
|
-
url:
|
|
654
|
-
type:
|
|
655
|
-
globalName:
|
|
635
|
+
return isBrowserEnv() ? "remoteEntry" in o ? {
|
|
636
|
+
url: o.remoteEntry,
|
|
637
|
+
type: o.remoteEntryType,
|
|
638
|
+
globalName: o.globalName
|
|
639
|
+
} : t : "ssrRemoteEntry" in o ? {
|
|
640
|
+
url: o.ssrRemoteEntry || t.url,
|
|
641
|
+
type: o.ssrRemoteEntryType || t.type,
|
|
642
|
+
globalName: o.globalName
|
|
656
643
|
} : t;
|
|
657
644
|
}
|
|
658
|
-
const processModuleAlias = (
|
|
645
|
+
const processModuleAlias = (o, t) => {
|
|
659
646
|
let n;
|
|
660
|
-
return
|
|
647
|
+
return o.endsWith("/") ? n = o.slice(0, -1) : n = o, t.startsWith(".") && (t = t.slice(1)), n = n + t, n;
|
|
661
648
|
}, CurrentGlobal = typeof globalThis == "object" ? globalThis : window, nativeGlobal = (() => {
|
|
662
649
|
try {
|
|
663
650
|
return document.defaultView;
|
|
@@ -665,57 +652,57 @@ const processModuleAlias = (r, t) => {
|
|
|
665
652
|
return CurrentGlobal;
|
|
666
653
|
}
|
|
667
654
|
})(), Global = nativeGlobal;
|
|
668
|
-
function definePropertyGlobalVal(
|
|
669
|
-
Object.defineProperty(
|
|
655
|
+
function definePropertyGlobalVal(o, t, n) {
|
|
656
|
+
Object.defineProperty(o, t, {
|
|
670
657
|
value: n,
|
|
671
658
|
configurable: !1,
|
|
672
659
|
writable: !0
|
|
673
660
|
});
|
|
674
661
|
}
|
|
675
|
-
function includeOwnProperty(
|
|
676
|
-
return Object.hasOwnProperty.call(
|
|
662
|
+
function includeOwnProperty(o, t) {
|
|
663
|
+
return Object.hasOwnProperty.call(o, t);
|
|
677
664
|
}
|
|
678
665
|
includeOwnProperty(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__") || definePropertyGlobalVal(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__", {});
|
|
679
666
|
const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;
|
|
680
|
-
function setGlobalDefaultVal(
|
|
681
|
-
var t, n,
|
|
682
|
-
includeOwnProperty(
|
|
667
|
+
function setGlobalDefaultVal(o) {
|
|
668
|
+
var t, n, r, s, l, a;
|
|
669
|
+
includeOwnProperty(o, "__VMOK__") && !includeOwnProperty(o, "__FEDERATION__") && definePropertyGlobalVal(o, "__FEDERATION__", o.__VMOK__), includeOwnProperty(o, "__FEDERATION__") || (definePropertyGlobalVal(o, "__FEDERATION__", {
|
|
683
670
|
__GLOBAL_PLUGIN__: [],
|
|
684
671
|
__INSTANCES__: [],
|
|
685
672
|
moduleInfo: {},
|
|
686
673
|
__SHARE__: {},
|
|
687
674
|
__MANIFEST_LOADING__: {},
|
|
688
675
|
__PRELOADED_MAP__: /* @__PURE__ */ new Map()
|
|
689
|
-
}), definePropertyGlobalVal(
|
|
676
|
+
}), definePropertyGlobalVal(o, "__VMOK__", o.__FEDERATION__));
|
|
690
677
|
var i;
|
|
691
|
-
(i = (t =
|
|
678
|
+
(i = (t = o.__FEDERATION__).__GLOBAL_PLUGIN__) != null || (t.__GLOBAL_PLUGIN__ = []);
|
|
692
679
|
var c;
|
|
693
|
-
(c = (n =
|
|
680
|
+
(c = (n = o.__FEDERATION__).__INSTANCES__) != null || (n.__INSTANCES__ = []);
|
|
694
681
|
var u;
|
|
695
|
-
(u = (
|
|
682
|
+
(u = (r = o.__FEDERATION__).moduleInfo) != null || (r.moduleInfo = {});
|
|
696
683
|
var d;
|
|
697
|
-
(d = (s =
|
|
684
|
+
(d = (s = o.__FEDERATION__).__SHARE__) != null || (s.__SHARE__ = {});
|
|
698
685
|
var p;
|
|
699
|
-
(p = (l =
|
|
686
|
+
(p = (l = o.__FEDERATION__).__MANIFEST_LOADING__) != null || (l.__MANIFEST_LOADING__ = {});
|
|
700
687
|
var m;
|
|
701
|
-
(m = (a =
|
|
688
|
+
(m = (a = o.__FEDERATION__).__PRELOADED_MAP__) != null || (a.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
|
|
702
689
|
}
|
|
703
690
|
setGlobalDefaultVal(CurrentGlobal);
|
|
704
691
|
setGlobalDefaultVal(nativeGlobal);
|
|
705
|
-
function setGlobalFederationConstructor(
|
|
706
|
-
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ =
|
|
692
|
+
function setGlobalFederationConstructor(o, t = isDebugMode()) {
|
|
693
|
+
t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = o, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.20");
|
|
707
694
|
}
|
|
708
|
-
function getInfoWithoutType(
|
|
695
|
+
function getInfoWithoutType(o, t) {
|
|
709
696
|
if (typeof t == "string") {
|
|
710
|
-
if (
|
|
697
|
+
if (o[t])
|
|
711
698
|
return {
|
|
712
|
-
value:
|
|
699
|
+
value: o[t],
|
|
713
700
|
key: t
|
|
714
701
|
};
|
|
715
702
|
{
|
|
716
|
-
const
|
|
717
|
-
for (const s of
|
|
718
|
-
const [l, a] = s.split(":"), i = `${l}:${t}`, c =
|
|
703
|
+
const r = Object.keys(o);
|
|
704
|
+
for (const s of r) {
|
|
705
|
+
const [l, a] = s.split(":"), i = `${l}:${t}`, c = o[i];
|
|
719
706
|
if (c)
|
|
720
707
|
return {
|
|
721
708
|
value: c,
|
|
@@ -730,121 +717,121 @@ function getInfoWithoutType(r, t) {
|
|
|
730
717
|
} else
|
|
731
718
|
throw new Error("key must be string");
|
|
732
719
|
}
|
|
733
|
-
const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo, getTargetSnapshotInfoByModuleInfo = (
|
|
734
|
-
const n = getFMId(
|
|
735
|
-
if (
|
|
736
|
-
return
|
|
737
|
-
if ("version" in
|
|
738
|
-
const { version: s } =
|
|
720
|
+
const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo, getTargetSnapshotInfoByModuleInfo = (o, t) => {
|
|
721
|
+
const n = getFMId(o), r = getInfoWithoutType(t, n).value;
|
|
722
|
+
if (r && !r.version && "version" in o && o.version && (r.version = o.version), r)
|
|
723
|
+
return r;
|
|
724
|
+
if ("version" in o && o.version) {
|
|
725
|
+
const { version: s } = o, l = _object_without_properties_loose(o, [
|
|
739
726
|
"version"
|
|
740
727
|
]), a = getFMId(l), i = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, a).value;
|
|
741
728
|
if ((i == null ? void 0 : i.version) === s)
|
|
742
729
|
return i;
|
|
743
730
|
}
|
|
744
|
-
}, getGlobalSnapshotInfoByModuleInfo = (
|
|
745
|
-
const n = getFMId(
|
|
731
|
+
}, getGlobalSnapshotInfoByModuleInfo = (o) => getTargetSnapshotInfoByModuleInfo(o, nativeGlobal.__FEDERATION__.moduleInfo), setGlobalSnapshotInfoByModuleInfo = (o, t) => {
|
|
732
|
+
const n = getFMId(o);
|
|
746
733
|
return nativeGlobal.__FEDERATION__.moduleInfo[n] = t, nativeGlobal.__FEDERATION__.moduleInfo;
|
|
747
|
-
}, addGlobalSnapshot = (
|
|
748
|
-
const t = Object.keys(
|
|
734
|
+
}, addGlobalSnapshot = (o) => (nativeGlobal.__FEDERATION__.moduleInfo = _extends$1({}, nativeGlobal.__FEDERATION__.moduleInfo, o), () => {
|
|
735
|
+
const t = Object.keys(o);
|
|
749
736
|
for (const n of t)
|
|
750
737
|
delete nativeGlobal.__FEDERATION__.moduleInfo[n];
|
|
751
|
-
}), getRemoteEntryExports = (
|
|
752
|
-
const n = t || `__FEDERATION_${
|
|
738
|
+
}), getRemoteEntryExports = (o, t) => {
|
|
739
|
+
const n = t || `__FEDERATION_${o}:custom__`, r = CurrentGlobal[n];
|
|
753
740
|
return {
|
|
754
741
|
remoteEntryKey: n,
|
|
755
|
-
entryExports:
|
|
742
|
+
entryExports: r
|
|
756
743
|
};
|
|
757
|
-
}, getGlobalHostPlugins = () => nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__, getPreloaded = (
|
|
758
|
-
function parseRegex(
|
|
759
|
-
return new RegExp(
|
|
744
|
+
}, getGlobalHostPlugins = () => nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__, getPreloaded = (o) => CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(o), setPreloaded = (o) => CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(o, !0), DEFAULT_SCOPE = "default", DEFAULT_REMOTE_TYPE = "global", buildIdentifier = "[0-9A-Za-z-]+", build = `(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`, numericIdentifier = "0|[1-9]\\d*", numericIdentifierLoose = "[0-9]+", nonNumericIdentifier = "\\d*[a-zA-Z-][a-zA-Z0-9-]*", preReleaseIdentifierLoose = `(?:${numericIdentifierLoose}|${nonNumericIdentifier})`, preReleaseLoose = `(?:-?(${preReleaseIdentifierLoose}(?:\\.${preReleaseIdentifierLoose})*))`, preReleaseIdentifier = `(?:${numericIdentifier}|${nonNumericIdentifier})`, preRelease = `(?:-(${preReleaseIdentifier}(?:\\.${preReleaseIdentifier})*))`, xRangeIdentifier = `${numericIdentifier}|x|X|\\*`, xRangePlain = `[v=\\s]*(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:\\.(${xRangeIdentifier})(?:${preRelease})?${build}?)?)?`, hyphenRange = `^\\s*(${xRangePlain})\\s+-\\s+(${xRangePlain})\\s*$`, mainVersionLoose = `(${numericIdentifierLoose})\\.(${numericIdentifierLoose})\\.(${numericIdentifierLoose})`, loosePlain = `[v=\\s]*${mainVersionLoose}${preReleaseLoose}?${build}?`, gtlt = "((?:<|>)?=?)", comparatorTrim = `(\\s*)${gtlt}\\s*(${loosePlain}|${xRangePlain})`, loneTilde = "(?:~>?)", tildeTrim = `(\\s*)${loneTilde}\\s+`, loneCaret = "(?:\\^)", caretTrim = `(\\s*)${loneCaret}\\s+`, star = "(<|>)?=?\\s*\\*", caret = `^${loneCaret}${xRangePlain}$`, mainVersion = `(${numericIdentifier})\\.(${numericIdentifier})\\.(${numericIdentifier})`, fullPlain = `v?${mainVersion}${preRelease}?${build}?`, tilde = `^${loneTilde}${xRangePlain}$`, xRange = `^${gtlt}\\s*${xRangePlain}$`, comparator = `^${gtlt}\\s*(${fullPlain})$|^$`, gte0 = "^\\s*>=\\s*0.0.0\\s*$";
|
|
745
|
+
function parseRegex(o) {
|
|
746
|
+
return new RegExp(o);
|
|
760
747
|
}
|
|
761
|
-
function isXVersion(
|
|
762
|
-
return !
|
|
748
|
+
function isXVersion(o) {
|
|
749
|
+
return !o || o.toLowerCase() === "x" || o === "*";
|
|
763
750
|
}
|
|
764
|
-
function pipe(...
|
|
765
|
-
return (t) =>
|
|
751
|
+
function pipe(...o) {
|
|
752
|
+
return (t) => o.reduce((n, r) => r(n), t);
|
|
766
753
|
}
|
|
767
|
-
function extractComparator(
|
|
768
|
-
return
|
|
754
|
+
function extractComparator(o) {
|
|
755
|
+
return o.match(parseRegex(comparator));
|
|
769
756
|
}
|
|
770
|
-
function combineVersion(
|
|
771
|
-
const s = `${
|
|
772
|
-
return
|
|
757
|
+
function combineVersion(o, t, n, r) {
|
|
758
|
+
const s = `${o}.${t}.${n}`;
|
|
759
|
+
return r ? `${s}-${r}` : s;
|
|
773
760
|
}
|
|
774
|
-
function parseHyphen(
|
|
775
|
-
return
|
|
761
|
+
function parseHyphen(o) {
|
|
762
|
+
return o.replace(parseRegex(hyphenRange), (t, n, r, s, l, a, i, c, u, d, p, m) => (isXVersion(r) ? n = "" : isXVersion(s) ? n = `>=${r}.0.0` : isXVersion(l) ? n = `>=${r}.${s}.0` : n = `>=${n}`, isXVersion(u) ? c = "" : isXVersion(d) ? c = `<${Number(u) + 1}.0.0-0` : isXVersion(p) ? c = `<${u}.${Number(d) + 1}.0-0` : m ? c = `<=${u}.${d}.${p}-${m}` : c = `<=${c}`, `${n} ${c}`.trim()));
|
|
776
763
|
}
|
|
777
|
-
function parseComparatorTrim(
|
|
778
|
-
return
|
|
764
|
+
function parseComparatorTrim(o) {
|
|
765
|
+
return o.replace(parseRegex(comparatorTrim), "$1$2$3");
|
|
779
766
|
}
|
|
780
|
-
function parseTildeTrim(
|
|
781
|
-
return
|
|
767
|
+
function parseTildeTrim(o) {
|
|
768
|
+
return o.replace(parseRegex(tildeTrim), "$1~");
|
|
782
769
|
}
|
|
783
|
-
function parseCaretTrim(
|
|
784
|
-
return
|
|
770
|
+
function parseCaretTrim(o) {
|
|
771
|
+
return o.replace(parseRegex(caretTrim), "$1^");
|
|
785
772
|
}
|
|
786
|
-
function parseCarets(
|
|
787
|
-
return
|
|
773
|
+
function parseCarets(o) {
|
|
774
|
+
return o.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (n, r, s, l, a) => isXVersion(r) ? "" : isXVersion(s) ? `>=${r}.0.0 <${Number(r) + 1}.0.0-0` : isXVersion(l) ? r === "0" ? `>=${r}.${s}.0 <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.0 <${Number(r) + 1}.0.0-0` : a ? r === "0" ? s === "0" ? `>=${r}.${s}.${l}-${a} <${r}.${s}.${Number(l) + 1}-0` : `>=${r}.${s}.${l}-${a} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${l}-${a} <${Number(r) + 1}.0.0-0` : r === "0" ? s === "0" ? `>=${r}.${s}.${l} <${r}.${s}.${Number(l) + 1}-0` : `>=${r}.${s}.${l} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${l} <${Number(r) + 1}.0.0-0`)).join(" ");
|
|
788
775
|
}
|
|
789
|
-
function parseTildes(
|
|
790
|
-
return
|
|
776
|
+
function parseTildes(o) {
|
|
777
|
+
return o.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (n, r, s, l, a) => isXVersion(r) ? "" : isXVersion(s) ? `>=${r}.0.0 <${Number(r) + 1}.0.0-0` : isXVersion(l) ? `>=${r}.${s}.0 <${r}.${Number(s) + 1}.0-0` : a ? `>=${r}.${s}.${l}-${a} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${l} <${r}.${Number(s) + 1}.0-0`)).join(" ");
|
|
791
778
|
}
|
|
792
|
-
function parseXRanges(
|
|
793
|
-
return
|
|
779
|
+
function parseXRanges(o) {
|
|
780
|
+
return o.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (n, r, s, l, a, i) => {
|
|
794
781
|
const c = isXVersion(s), u = c || isXVersion(l), d = u || isXVersion(a);
|
|
795
|
-
return
|
|
782
|
+
return r === "=" && d && (r = ""), i = "", c ? r === ">" || r === "<" ? "<0.0.0-0" : "*" : r && d ? (u && (l = 0), a = 0, r === ">" ? (r = ">=", u ? (s = Number(s) + 1, l = 0, a = 0) : (l = Number(l) + 1, a = 0)) : r === "<=" && (r = "<", u ? s = Number(s) + 1 : l = Number(l) + 1), r === "<" && (i = "-0"), `${r + s}.${l}.${a}${i}`) : u ? `>=${s}.0.0${i} <${Number(s) + 1}.0.0-0` : d ? `>=${s}.${l}.0${i} <${s}.${Number(l) + 1}.0-0` : n;
|
|
796
783
|
})).join(" ");
|
|
797
784
|
}
|
|
798
|
-
function parseStar(
|
|
799
|
-
return
|
|
785
|
+
function parseStar(o) {
|
|
786
|
+
return o.trim().replace(parseRegex(star), "");
|
|
800
787
|
}
|
|
801
|
-
function parseGTE0(
|
|
802
|
-
return
|
|
788
|
+
function parseGTE0(o) {
|
|
789
|
+
return o.trim().replace(parseRegex(gte0), "");
|
|
803
790
|
}
|
|
804
|
-
function compareAtom(
|
|
805
|
-
return
|
|
791
|
+
function compareAtom(o, t) {
|
|
792
|
+
return o = Number(o) || o, t = Number(t) || t, o > t ? 1 : o === t ? 0 : -1;
|
|
806
793
|
}
|
|
807
|
-
function comparePreRelease(
|
|
808
|
-
const { preRelease: n } =
|
|
809
|
-
if (n === void 0 &&
|
|
794
|
+
function comparePreRelease(o, t) {
|
|
795
|
+
const { preRelease: n } = o, { preRelease: r } = t;
|
|
796
|
+
if (n === void 0 && r)
|
|
810
797
|
return 1;
|
|
811
|
-
if (n &&
|
|
798
|
+
if (n && r === void 0)
|
|
812
799
|
return -1;
|
|
813
|
-
if (n === void 0 &&
|
|
800
|
+
if (n === void 0 && r === void 0)
|
|
814
801
|
return 0;
|
|
815
802
|
for (let s = 0, l = n.length; s <= l; s++) {
|
|
816
|
-
const a = n[s], i =
|
|
803
|
+
const a = n[s], i = r[s];
|
|
817
804
|
if (a !== i)
|
|
818
805
|
return a === void 0 && i === void 0 ? 0 : a ? i ? compareAtom(a, i) : -1 : 1;
|
|
819
806
|
}
|
|
820
807
|
return 0;
|
|
821
808
|
}
|
|
822
|
-
function compareVersion(
|
|
823
|
-
return compareAtom(
|
|
809
|
+
function compareVersion(o, t) {
|
|
810
|
+
return compareAtom(o.major, t.major) || compareAtom(o.minor, t.minor) || compareAtom(o.patch, t.patch) || comparePreRelease(o, t);
|
|
824
811
|
}
|
|
825
|
-
function eq(
|
|
826
|
-
return
|
|
812
|
+
function eq(o, t) {
|
|
813
|
+
return o.version === t.version;
|
|
827
814
|
}
|
|
828
|
-
function compare(
|
|
829
|
-
switch (
|
|
815
|
+
function compare(o, t) {
|
|
816
|
+
switch (o.operator) {
|
|
830
817
|
case "":
|
|
831
818
|
case "=":
|
|
832
|
-
return eq(
|
|
819
|
+
return eq(o, t);
|
|
833
820
|
case ">":
|
|
834
|
-
return compareVersion(
|
|
821
|
+
return compareVersion(o, t) < 0;
|
|
835
822
|
case ">=":
|
|
836
|
-
return eq(
|
|
823
|
+
return eq(o, t) || compareVersion(o, t) < 0;
|
|
837
824
|
case "<":
|
|
838
|
-
return compareVersion(
|
|
825
|
+
return compareVersion(o, t) > 0;
|
|
839
826
|
case "<=":
|
|
840
|
-
return eq(
|
|
827
|
+
return eq(o, t) || compareVersion(o, t) > 0;
|
|
841
828
|
case void 0:
|
|
842
829
|
return !0;
|
|
843
830
|
default:
|
|
844
831
|
return !1;
|
|
845
832
|
}
|
|
846
833
|
}
|
|
847
|
-
function parseComparatorString(
|
|
834
|
+
function parseComparatorString(o) {
|
|
848
835
|
return pipe(
|
|
849
836
|
// handle caret
|
|
850
837
|
// ^ --> * (any, kinda silly)
|
|
@@ -864,9 +851,9 @@ function parseComparatorString(r) {
|
|
|
864
851
|
parseTildes,
|
|
865
852
|
parseXRanges,
|
|
866
853
|
parseStar
|
|
867
|
-
)(
|
|
854
|
+
)(o);
|
|
868
855
|
}
|
|
869
|
-
function parseRange(
|
|
856
|
+
function parseRange(o) {
|
|
870
857
|
return pipe(
|
|
871
858
|
// handle hyphenRange
|
|
872
859
|
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
|
@@ -880,12 +867,12 @@ function parseRange(r) {
|
|
|
880
867
|
// handle trim caret
|
|
881
868
|
// `^ 1.2.3` => `^1.2.3`
|
|
882
869
|
parseCaretTrim
|
|
883
|
-
)(
|
|
870
|
+
)(o.trim()).split(/\s+/).join(" ");
|
|
884
871
|
}
|
|
885
|
-
function satisfy(
|
|
886
|
-
if (!
|
|
872
|
+
function satisfy(o, t) {
|
|
873
|
+
if (!o)
|
|
887
874
|
return !1;
|
|
888
|
-
const s = parseRange(t).split(" ").map((m) => parseComparatorString(m)).join(" ").split(/\s+/).map((m) => parseGTE0(m)), l = extractComparator(
|
|
875
|
+
const s = parseRange(t).split(" ").map((m) => parseComparatorString(m)).join(" ").split(/\s+/).map((m) => parseGTE0(m)), l = extractComparator(o);
|
|
889
876
|
if (!l)
|
|
890
877
|
return !1;
|
|
891
878
|
const [, a, , i, c, u, d] = l, p = {
|
|
@@ -913,40 +900,40 @@ function satisfy(r, t) {
|
|
|
913
900
|
}
|
|
914
901
|
return !0;
|
|
915
902
|
}
|
|
916
|
-
function formatShare(
|
|
903
|
+
function formatShare(o, t, n, r) {
|
|
917
904
|
let s;
|
|
918
|
-
"get" in
|
|
905
|
+
"get" in o ? s = o.get : "lib" in o ? s = () => Promise.resolve(o.lib) : s = () => Promise.resolve(() => {
|
|
919
906
|
throw new Error(`Can not get shared '${n}'!`);
|
|
920
|
-
}),
|
|
907
|
+
}), o.strategy && warn('"shared.strategy is deprecated, please set in initOptions.shareStrategy instead!"');
|
|
921
908
|
var l, a, i;
|
|
922
909
|
return _extends$1({
|
|
923
910
|
deps: [],
|
|
924
911
|
useIn: [],
|
|
925
912
|
from: t,
|
|
926
913
|
loading: null
|
|
927
|
-
},
|
|
914
|
+
}, o, {
|
|
928
915
|
shareConfig: _extends$1({
|
|
929
|
-
requiredVersion: `^${
|
|
916
|
+
requiredVersion: `^${o.version}`,
|
|
930
917
|
singleton: !1,
|
|
931
918
|
eager: !1,
|
|
932
919
|
strictVersion: !1
|
|
933
|
-
},
|
|
920
|
+
}, o.shareConfig),
|
|
934
921
|
get: s,
|
|
935
|
-
loaded:
|
|
936
|
-
version: (l =
|
|
937
|
-
scope: Array.isArray(
|
|
938
|
-
(a =
|
|
922
|
+
loaded: o != null && o.loaded || "lib" in o ? !0 : void 0,
|
|
923
|
+
version: (l = o.version) != null ? l : "0",
|
|
924
|
+
scope: Array.isArray(o.scope) ? o.scope : [
|
|
925
|
+
(a = o.scope) != null ? a : "default"
|
|
939
926
|
],
|
|
940
|
-
strategy: ((i =
|
|
927
|
+
strategy: ((i = o.strategy) != null ? i : r) || "version-first"
|
|
941
928
|
});
|
|
942
929
|
}
|
|
943
|
-
function formatShareConfigs(
|
|
944
|
-
const n = t.shared || {},
|
|
930
|
+
function formatShareConfigs(o, t) {
|
|
931
|
+
const n = t.shared || {}, r = t.name, s = Object.keys(n).reduce((a, i) => {
|
|
945
932
|
const c = arrayOptions(n[i]);
|
|
946
933
|
return a[i] = a[i] || [], c.forEach((u) => {
|
|
947
|
-
a[i].push(formatShare(u,
|
|
934
|
+
a[i].push(formatShare(u, r, i, t.shareStrategy));
|
|
948
935
|
}), a;
|
|
949
|
-
}, {}), l = _extends$1({},
|
|
936
|
+
}, {}), l = _extends$1({}, o.shared);
|
|
950
937
|
return Object.keys(s).forEach((a) => {
|
|
951
938
|
l[a] ? s[a].forEach((i) => {
|
|
952
939
|
l[a].find((u) => u.version === i.version) || l[a].push(i);
|
|
@@ -956,79 +943,79 @@ function formatShareConfigs(r, t) {
|
|
|
956
943
|
shareInfos: s
|
|
957
944
|
};
|
|
958
945
|
}
|
|
959
|
-
function versionLt(
|
|
960
|
-
const n = (
|
|
961
|
-
if (!Number.isNaN(Number(
|
|
962
|
-
const l =
|
|
963
|
-
let a =
|
|
946
|
+
function versionLt(o, t) {
|
|
947
|
+
const n = (r) => {
|
|
948
|
+
if (!Number.isNaN(Number(r))) {
|
|
949
|
+
const l = r.split(".");
|
|
950
|
+
let a = r;
|
|
964
951
|
for (let i = 0; i < 3 - l.length; i++)
|
|
965
952
|
a += ".0";
|
|
966
953
|
return a;
|
|
967
954
|
}
|
|
968
|
-
return
|
|
955
|
+
return r;
|
|
969
956
|
};
|
|
970
|
-
return !!satisfy(n(
|
|
957
|
+
return !!satisfy(n(o), `<=${n(t)}`);
|
|
971
958
|
}
|
|
972
|
-
const findVersion = (
|
|
973
|
-
const n = t || function(
|
|
974
|
-
return versionLt(
|
|
959
|
+
const findVersion = (o, t) => {
|
|
960
|
+
const n = t || function(r, s) {
|
|
961
|
+
return versionLt(r, s);
|
|
975
962
|
};
|
|
976
|
-
return Object.keys(
|
|
977
|
-
}, isLoaded = (
|
|
978
|
-
function findSingletonVersionOrderByVersion(
|
|
979
|
-
const
|
|
980
|
-
return !isLoaded(
|
|
963
|
+
return Object.keys(o).reduce((r, s) => !r || n(r, s) || r === "0" ? s : r, 0);
|
|
964
|
+
}, isLoaded = (o) => !!o.loaded || typeof o.lib == "function", isLoading = (o) => !!o.loading;
|
|
965
|
+
function findSingletonVersionOrderByVersion(o, t, n) {
|
|
966
|
+
const r = o[t][n], s = function(l, a) {
|
|
967
|
+
return !isLoaded(r[l]) && versionLt(l, a);
|
|
981
968
|
};
|
|
982
|
-
return findVersion(
|
|
969
|
+
return findVersion(o[t][n], s);
|
|
983
970
|
}
|
|
984
|
-
function findSingletonVersionOrderByLoaded(
|
|
985
|
-
const
|
|
971
|
+
function findSingletonVersionOrderByLoaded(o, t, n) {
|
|
972
|
+
const r = o[t][n], s = function(l, a) {
|
|
986
973
|
const i = (c) => isLoaded(c) || isLoading(c);
|
|
987
|
-
return i(
|
|
974
|
+
return i(r[a]) ? i(r[l]) ? !!versionLt(l, a) : !0 : i(r[l]) ? !1 : versionLt(l, a);
|
|
988
975
|
};
|
|
989
|
-
return findVersion(
|
|
976
|
+
return findVersion(o[t][n], s);
|
|
990
977
|
}
|
|
991
|
-
function getFindShareFunction(
|
|
992
|
-
return
|
|
978
|
+
function getFindShareFunction(o) {
|
|
979
|
+
return o === "loaded-first" ? findSingletonVersionOrderByLoaded : findSingletonVersionOrderByVersion;
|
|
993
980
|
}
|
|
994
|
-
function getRegisteredShare(
|
|
995
|
-
if (!
|
|
981
|
+
function getRegisteredShare(o, t, n, r) {
|
|
982
|
+
if (!o)
|
|
996
983
|
return;
|
|
997
984
|
const { shareConfig: s, scope: l = DEFAULT_SCOPE, strategy: a } = n, i = Array.isArray(l) ? l : [
|
|
998
985
|
l
|
|
999
986
|
];
|
|
1000
987
|
for (const c of i)
|
|
1001
|
-
if (s &&
|
|
1002
|
-
const { requiredVersion: u } = s, p = getFindShareFunction(a)(
|
|
988
|
+
if (s && o[c] && o[c][t]) {
|
|
989
|
+
const { requiredVersion: u } = s, p = getFindShareFunction(a)(o, c, t), m = () => {
|
|
1003
990
|
if (s.singleton) {
|
|
1004
991
|
if (typeof u == "string" && !satisfy(p, u)) {
|
|
1005
|
-
const E = `Version ${p} from ${p &&
|
|
992
|
+
const E = `Version ${p} from ${p && o[c][t][p].from} of shared singleton module ${t} does not satisfy the requirement of ${n.from} which needs ${u})`;
|
|
1006
993
|
s.strictVersion ? error(E) : warn(E);
|
|
1007
994
|
}
|
|
1008
|
-
return
|
|
995
|
+
return o[c][t][p];
|
|
1009
996
|
} else {
|
|
1010
997
|
if (u === !1 || u === "*" || satisfy(p, u))
|
|
1011
|
-
return
|
|
1012
|
-
for (const [E, g] of Object.entries(
|
|
998
|
+
return o[c][t][p];
|
|
999
|
+
for (const [E, g] of Object.entries(o[c][t]))
|
|
1013
1000
|
if (satisfy(E, u))
|
|
1014
1001
|
return g;
|
|
1015
1002
|
}
|
|
1016
1003
|
}, y = {
|
|
1017
|
-
shareScopeMap:
|
|
1004
|
+
shareScopeMap: o,
|
|
1018
1005
|
scope: c,
|
|
1019
1006
|
pkgName: t,
|
|
1020
1007
|
version: p,
|
|
1021
1008
|
GlobalFederation: Global.__FEDERATION__,
|
|
1022
1009
|
resolver: m
|
|
1023
1010
|
};
|
|
1024
|
-
return (
|
|
1011
|
+
return (r.emit(y) || y).resolver();
|
|
1025
1012
|
}
|
|
1026
1013
|
}
|
|
1027
1014
|
function getGlobalShareScope() {
|
|
1028
1015
|
return Global.__FEDERATION__.__SHARE__;
|
|
1029
1016
|
}
|
|
1030
|
-
function getTargetSharedOptions(
|
|
1031
|
-
const { pkgName: t, extraOptions: n, shareInfos:
|
|
1017
|
+
function getTargetSharedOptions(o) {
|
|
1018
|
+
const { pkgName: t, extraOptions: n, shareInfos: r } = o, s = (i) => {
|
|
1032
1019
|
if (!i)
|
|
1033
1020
|
return;
|
|
1034
1021
|
const c = {};
|
|
@@ -1042,16 +1029,16 @@ function getTargetSharedOptions(r) {
|
|
|
1042
1029
|
};
|
|
1043
1030
|
var l;
|
|
1044
1031
|
const a = (l = n == null ? void 0 : n.resolver) != null ? l : s;
|
|
1045
|
-
return Object.assign({}, a(
|
|
1032
|
+
return Object.assign({}, a(r[t]), n == null ? void 0 : n.customShareInfo);
|
|
1046
1033
|
}
|
|
1047
1034
|
function getBuilderId() {
|
|
1048
1035
|
return typeof FEDERATION_BUILD_IDENTIFIER < "u" ? FEDERATION_BUILD_IDENTIFIER : "";
|
|
1049
1036
|
}
|
|
1050
|
-
function matchRemoteWithNameAndExpose(
|
|
1051
|
-
for (const n of
|
|
1052
|
-
const
|
|
1037
|
+
function matchRemoteWithNameAndExpose(o, t) {
|
|
1038
|
+
for (const n of o) {
|
|
1039
|
+
const r = t.startsWith(n.name);
|
|
1053
1040
|
let s = t.replace(n.name, "");
|
|
1054
|
-
if (
|
|
1041
|
+
if (r) {
|
|
1055
1042
|
if (s.startsWith("/")) {
|
|
1056
1043
|
const i = n.name;
|
|
1057
1044
|
return s = `.${s}`, {
|
|
@@ -1085,55 +1072,55 @@ function matchRemoteWithNameAndExpose(r, t) {
|
|
|
1085
1072
|
}
|
|
1086
1073
|
}
|
|
1087
1074
|
}
|
|
1088
|
-
function matchRemote(
|
|
1089
|
-
for (const n of
|
|
1075
|
+
function matchRemote(o, t) {
|
|
1076
|
+
for (const n of o)
|
|
1090
1077
|
if (t === n.name || n.alias && t === n.alias)
|
|
1091
1078
|
return n;
|
|
1092
1079
|
}
|
|
1093
|
-
function registerPlugins(
|
|
1080
|
+
function registerPlugins(o, t) {
|
|
1094
1081
|
const n = getGlobalHostPlugins();
|
|
1095
|
-
return n.length > 0 && n.forEach((
|
|
1096
|
-
|
|
1097
|
-
}),
|
|
1082
|
+
return n.length > 0 && n.forEach((r) => {
|
|
1083
|
+
o != null && o.find((s) => s.name !== r.name) && o.push(r);
|
|
1084
|
+
}), o && o.length > 0 && o.forEach((r) => {
|
|
1098
1085
|
t.forEach((s) => {
|
|
1099
|
-
s.applyPlugin(
|
|
1086
|
+
s.applyPlugin(r);
|
|
1100
1087
|
});
|
|
1101
|
-
}),
|
|
1088
|
+
}), o;
|
|
1102
1089
|
}
|
|
1103
|
-
async function loadEsmEntry({ entry:
|
|
1104
|
-
return new Promise((n,
|
|
1090
|
+
async function loadEsmEntry({ entry: o, remoteEntryExports: t }) {
|
|
1091
|
+
return new Promise((n, r) => {
|
|
1105
1092
|
try {
|
|
1106
|
-
t ? n(t) : typeof FEDERATION_ALLOW_NEW_FUNCTION < "u" ? new Function("callbacks", `import("${
|
|
1093
|
+
t ? n(t) : typeof FEDERATION_ALLOW_NEW_FUNCTION < "u" ? new Function("callbacks", `import("${o}").then(callbacks[0]).catch(callbacks[1])`)([
|
|
1107
1094
|
n,
|
|
1108
|
-
|
|
1095
|
+
r
|
|
1109
1096
|
]) : import(
|
|
1110
1097
|
/* webpackIgnore: true */
|
|
1111
1098
|
/* @vite-ignore */
|
|
1112
|
-
|
|
1113
|
-
).then(n).catch(
|
|
1099
|
+
o
|
|
1100
|
+
).then(n).catch(r);
|
|
1114
1101
|
} catch (s) {
|
|
1115
|
-
|
|
1102
|
+
r(s);
|
|
1116
1103
|
}
|
|
1117
1104
|
});
|
|
1118
1105
|
}
|
|
1119
|
-
async function loadSystemJsEntry({ entry:
|
|
1120
|
-
return new Promise((n,
|
|
1106
|
+
async function loadSystemJsEntry({ entry: o, remoteEntryExports: t }) {
|
|
1107
|
+
return new Promise((n, r) => {
|
|
1121
1108
|
try {
|
|
1122
|
-
t ? n(t) : typeof __system_context__ > "u" ? System.import(
|
|
1109
|
+
t ? n(t) : typeof __system_context__ > "u" ? System.import(o).then(n).catch(r) : new Function("callbacks", `System.import("${o}").then(callbacks[0]).catch(callbacks[1])`)([
|
|
1123
1110
|
n,
|
|
1124
|
-
|
|
1111
|
+
r
|
|
1125
1112
|
]);
|
|
1126
1113
|
} catch (s) {
|
|
1127
|
-
|
|
1114
|
+
r(s);
|
|
1128
1115
|
}
|
|
1129
1116
|
});
|
|
1130
1117
|
}
|
|
1131
|
-
async function loadEntryScript({ name:
|
|
1132
|
-
const { entryExports: s } = getRemoteEntryExports(
|
|
1118
|
+
async function loadEntryScript({ name: o, globalName: t, entry: n, loaderHook: r }) {
|
|
1119
|
+
const { entryExports: s } = getRemoteEntryExports(o, t);
|
|
1133
1120
|
return s || loadScript(n, {
|
|
1134
1121
|
attrs: {},
|
|
1135
1122
|
createScriptHook: (l, a) => {
|
|
1136
|
-
const i =
|
|
1123
|
+
const i = r.lifecycle.createScript.emit({
|
|
1137
1124
|
url: l,
|
|
1138
1125
|
attrs: a
|
|
1139
1126
|
});
|
|
@@ -1141,48 +1128,48 @@ async function loadEntryScript({ name: r, globalName: t, entry: n, loaderHook: o
|
|
|
1141
1128
|
return i;
|
|
1142
1129
|
}
|
|
1143
1130
|
}).then(() => {
|
|
1144
|
-
const { remoteEntryKey: l, entryExports: a } = getRemoteEntryExports(
|
|
1131
|
+
const { remoteEntryKey: l, entryExports: a } = getRemoteEntryExports(o, t);
|
|
1145
1132
|
return assert(a, getShortErrorMsg(RUNTIME_001, runtimeDescMap, {
|
|
1146
|
-
remoteName:
|
|
1133
|
+
remoteName: o,
|
|
1147
1134
|
remoteEntryUrl: n,
|
|
1148
1135
|
remoteEntryKey: l
|
|
1149
1136
|
})), a;
|
|
1150
1137
|
}).catch((l) => {
|
|
1151
1138
|
throw assert(void 0, getShortErrorMsg(RUNTIME_008, runtimeDescMap, {
|
|
1152
|
-
remoteName:
|
|
1139
|
+
remoteName: o,
|
|
1153
1140
|
resourceUrl: n
|
|
1154
1141
|
})), l;
|
|
1155
1142
|
});
|
|
1156
1143
|
}
|
|
1157
|
-
async function loadEntryDom({ remoteInfo:
|
|
1158
|
-
const { entry:
|
|
1144
|
+
async function loadEntryDom({ remoteInfo: o, remoteEntryExports: t, loaderHook: n }) {
|
|
1145
|
+
const { entry: r, entryGlobalName: s, name: l, type: a } = o;
|
|
1159
1146
|
switch (a) {
|
|
1160
1147
|
case "esm":
|
|
1161
1148
|
case "module":
|
|
1162
1149
|
return loadEsmEntry({
|
|
1163
|
-
entry:
|
|
1150
|
+
entry: r,
|
|
1164
1151
|
remoteEntryExports: t
|
|
1165
1152
|
});
|
|
1166
1153
|
case "system":
|
|
1167
1154
|
return loadSystemJsEntry({
|
|
1168
|
-
entry:
|
|
1155
|
+
entry: r,
|
|
1169
1156
|
remoteEntryExports: t
|
|
1170
1157
|
});
|
|
1171
1158
|
default:
|
|
1172
1159
|
return loadEntryScript({
|
|
1173
|
-
entry:
|
|
1160
|
+
entry: r,
|
|
1174
1161
|
globalName: s,
|
|
1175
1162
|
name: l,
|
|
1176
1163
|
loaderHook: n
|
|
1177
1164
|
});
|
|
1178
1165
|
}
|
|
1179
1166
|
}
|
|
1180
|
-
async function loadEntryNode({ remoteInfo:
|
|
1181
|
-
const { entry: n, entryGlobalName:
|
|
1167
|
+
async function loadEntryNode({ remoteInfo: o, loaderHook: t }) {
|
|
1168
|
+
const { entry: n, entryGlobalName: r, name: s, type: l } = o, { entryExports: a } = getRemoteEntryExports(s, r);
|
|
1182
1169
|
return a || loadScriptNode(n, {
|
|
1183
1170
|
attrs: {
|
|
1184
1171
|
name: s,
|
|
1185
|
-
globalName:
|
|
1172
|
+
globalName: r,
|
|
1186
1173
|
type: l
|
|
1187
1174
|
},
|
|
1188
1175
|
loaderHook: {
|
|
@@ -1196,7 +1183,7 @@ async function loadEntryNode({ remoteInfo: r, loaderHook: t }) {
|
|
|
1196
1183
|
}
|
|
1197
1184
|
}
|
|
1198
1185
|
}).then(() => {
|
|
1199
|
-
const { remoteEntryKey: i, entryExports: c } = getRemoteEntryExports(s,
|
|
1186
|
+
const { remoteEntryKey: i, entryExports: c } = getRemoteEntryExports(s, r);
|
|
1200
1187
|
return assert(c, getShortErrorMsg(RUNTIME_001, runtimeDescMap, {
|
|
1201
1188
|
remoteName: s,
|
|
1202
1189
|
remoteEntryUrl: n,
|
|
@@ -1206,17 +1193,17 @@ async function loadEntryNode({ remoteInfo: r, loaderHook: t }) {
|
|
|
1206
1193
|
throw i;
|
|
1207
1194
|
});
|
|
1208
1195
|
}
|
|
1209
|
-
function getRemoteEntryUniqueKey(
|
|
1210
|
-
const { entry: t, name: n } =
|
|
1196
|
+
function getRemoteEntryUniqueKey(o) {
|
|
1197
|
+
const { entry: t, name: n } = o;
|
|
1211
1198
|
return composeKeyWithSeparator(n, t);
|
|
1212
1199
|
}
|
|
1213
|
-
async function getRemoteEntry({ origin:
|
|
1214
|
-
const
|
|
1200
|
+
async function getRemoteEntry({ origin: o, remoteEntryExports: t, remoteInfo: n }) {
|
|
1201
|
+
const r = getRemoteEntryUniqueKey(n);
|
|
1215
1202
|
if (t)
|
|
1216
1203
|
return t;
|
|
1217
|
-
if (!globalLoading[
|
|
1218
|
-
const s =
|
|
1219
|
-
globalLoading[
|
|
1204
|
+
if (!globalLoading[r]) {
|
|
1205
|
+
const s = o.remoteHandler.hooks.lifecycle.loadEntry, l = o.loaderHook;
|
|
1206
|
+
globalLoading[r] = s.emit({
|
|
1220
1207
|
loaderHook: l,
|
|
1221
1208
|
remoteInfo: n,
|
|
1222
1209
|
remoteEntryExports: t
|
|
@@ -1229,14 +1216,14 @@ async function getRemoteEntry({ origin: r, remoteEntryExports: t, remoteInfo: n
|
|
|
1229
1216
|
loaderHook: l
|
|
1230
1217
|
})));
|
|
1231
1218
|
}
|
|
1232
|
-
return globalLoading[
|
|
1219
|
+
return globalLoading[r];
|
|
1233
1220
|
}
|
|
1234
|
-
function getRemoteInfo(
|
|
1235
|
-
return _extends$1({},
|
|
1236
|
-
entry: "entry" in
|
|
1237
|
-
type:
|
|
1238
|
-
entryGlobalName:
|
|
1239
|
-
shareScope:
|
|
1221
|
+
function getRemoteInfo(o) {
|
|
1222
|
+
return _extends$1({}, o, {
|
|
1223
|
+
entry: "entry" in o ? o.entry : "",
|
|
1224
|
+
type: o.type || DEFAULT_REMOTE_TYPE,
|
|
1225
|
+
entryGlobalName: o.entryGlobalName || o.name,
|
|
1226
|
+
shareScope: o.shareScope || DEFAULT_SCOPE
|
|
1240
1227
|
});
|
|
1241
1228
|
}
|
|
1242
1229
|
let Module = class {
|
|
@@ -1251,22 +1238,22 @@ let Module = class {
|
|
|
1251
1238
|
remoteEntryExports: this.remoteEntryExports
|
|
1252
1239
|
});
|
|
1253
1240
|
} catch {
|
|
1254
|
-
const
|
|
1241
|
+
const r = getRemoteEntryUniqueKey(this.remoteInfo);
|
|
1255
1242
|
t = await this.host.loaderHook.lifecycle.loadEntryError.emit({
|
|
1256
1243
|
getRemoteEntry,
|
|
1257
1244
|
origin: this.host,
|
|
1258
1245
|
remoteInfo: this.remoteInfo,
|
|
1259
1246
|
remoteEntryExports: this.remoteEntryExports,
|
|
1260
1247
|
globalLoading,
|
|
1261
|
-
uniqueKey:
|
|
1248
|
+
uniqueKey: r
|
|
1262
1249
|
});
|
|
1263
1250
|
}
|
|
1264
1251
|
return assert(t, `remoteEntryExports is undefined
|
|
1265
1252
|
${safeToString(this.remoteInfo)}`), this.remoteEntryExports = t, this.remoteEntryExports;
|
|
1266
1253
|
}
|
|
1267
1254
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
1268
|
-
async get(t, n,
|
|
1269
|
-
const { loadFactory: l = !0 } =
|
|
1255
|
+
async get(t, n, r, s) {
|
|
1256
|
+
const { loadFactory: l = !0 } = r || {
|
|
1270
1257
|
loadFactory: !0
|
|
1271
1258
|
}, a = await this.getEntry();
|
|
1272
1259
|
if (!this.inited) {
|
|
@@ -1309,7 +1296,7 @@ let Module = class {
|
|
|
1309
1296
|
return l ? await u() : u;
|
|
1310
1297
|
}
|
|
1311
1298
|
wraperFactory(t, n) {
|
|
1312
|
-
function
|
|
1299
|
+
function r(s, l) {
|
|
1313
1300
|
s && typeof s == "object" && Object.isExtensible(s) && !Object.getOwnPropertyDescriptor(s, Symbol.for("mf_module_id")) && Object.defineProperty(s, Symbol.for("mf_module_id"), {
|
|
1314
1301
|
value: l,
|
|
1315
1302
|
enumerable: !1
|
|
@@ -1317,10 +1304,10 @@ let Module = class {
|
|
|
1317
1304
|
}
|
|
1318
1305
|
return t instanceof Promise ? async () => {
|
|
1319
1306
|
const s = await t();
|
|
1320
|
-
return
|
|
1307
|
+
return r(s, n), s;
|
|
1321
1308
|
} : () => {
|
|
1322
1309
|
const s = t();
|
|
1323
|
-
return
|
|
1310
|
+
return r(s, n), s;
|
|
1324
1311
|
};
|
|
1325
1312
|
}
|
|
1326
1313
|
constructor({ remoteInfo: t, host: n }) {
|
|
@@ -1333,14 +1320,14 @@ class SyncHook {
|
|
|
1333
1320
|
}
|
|
1334
1321
|
once(t) {
|
|
1335
1322
|
const n = this;
|
|
1336
|
-
this.on(function
|
|
1337
|
-
return n.remove(
|
|
1323
|
+
this.on(function r(...s) {
|
|
1324
|
+
return n.remove(r), t.apply(null, s);
|
|
1338
1325
|
});
|
|
1339
1326
|
}
|
|
1340
1327
|
emit(...t) {
|
|
1341
1328
|
let n;
|
|
1342
|
-
return this.listeners.size > 0 && this.listeners.forEach((
|
|
1343
|
-
n =
|
|
1329
|
+
return this.listeners.size > 0 && this.listeners.forEach((r) => {
|
|
1330
|
+
n = r(...t);
|
|
1344
1331
|
}), n;
|
|
1345
1332
|
}
|
|
1346
1333
|
remove(t) {
|
|
@@ -1356,20 +1343,20 @@ class SyncHook {
|
|
|
1356
1343
|
class AsyncHook extends SyncHook {
|
|
1357
1344
|
emit(...t) {
|
|
1358
1345
|
let n;
|
|
1359
|
-
const
|
|
1360
|
-
if (
|
|
1346
|
+
const r = Array.from(this.listeners);
|
|
1347
|
+
if (r.length > 0) {
|
|
1361
1348
|
let s = 0;
|
|
1362
|
-
const l = (a) => a === !1 ? !1 : s <
|
|
1349
|
+
const l = (a) => a === !1 ? !1 : s < r.length ? Promise.resolve(r[s++].apply(null, t)).then(l) : a;
|
|
1363
1350
|
n = l();
|
|
1364
1351
|
}
|
|
1365
1352
|
return Promise.resolve(n);
|
|
1366
1353
|
}
|
|
1367
1354
|
}
|
|
1368
|
-
function checkReturnData(
|
|
1355
|
+
function checkReturnData(o, t) {
|
|
1369
1356
|
if (!isObject(t))
|
|
1370
1357
|
return !1;
|
|
1371
|
-
if (
|
|
1372
|
-
for (const n in
|
|
1358
|
+
if (o !== t) {
|
|
1359
|
+
for (const n in o)
|
|
1373
1360
|
if (!(n in t))
|
|
1374
1361
|
return !1;
|
|
1375
1362
|
}
|
|
@@ -1380,15 +1367,15 @@ class SyncWaterfallHook extends SyncHook {
|
|
|
1380
1367
|
isObject(t) || error(`The data for the "${this.type}" hook should be an object.`);
|
|
1381
1368
|
for (const n of this.listeners)
|
|
1382
1369
|
try {
|
|
1383
|
-
const
|
|
1384
|
-
if (checkReturnData(t,
|
|
1385
|
-
t =
|
|
1370
|
+
const r = n(t);
|
|
1371
|
+
if (checkReturnData(t, r))
|
|
1372
|
+
t = r;
|
|
1386
1373
|
else {
|
|
1387
1374
|
this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
|
|
1388
1375
|
break;
|
|
1389
1376
|
}
|
|
1390
|
-
} catch (
|
|
1391
|
-
warn(
|
|
1377
|
+
} catch (r) {
|
|
1378
|
+
warn(r), this.onerror(r);
|
|
1392
1379
|
}
|
|
1393
1380
|
return t;
|
|
1394
1381
|
}
|
|
@@ -1401,12 +1388,12 @@ class AsyncWaterfallHook extends SyncHook {
|
|
|
1401
1388
|
isObject(t) || error(`The response data for the "${this.type}" hook must be an object.`);
|
|
1402
1389
|
const n = Array.from(this.listeners);
|
|
1403
1390
|
if (n.length > 0) {
|
|
1404
|
-
let
|
|
1391
|
+
let r = 0;
|
|
1405
1392
|
const s = (a) => (warn(a), this.onerror(a), t), l = (a) => {
|
|
1406
1393
|
if (checkReturnData(t, a)) {
|
|
1407
|
-
if (t = a,
|
|
1394
|
+
if (t = a, r < n.length)
|
|
1408
1395
|
try {
|
|
1409
|
-
return Promise.resolve(n[
|
|
1396
|
+
return Promise.resolve(n[r++](t)).then(l, s);
|
|
1410
1397
|
} catch (i) {
|
|
1411
1398
|
return s(i);
|
|
1412
1399
|
}
|
|
@@ -1426,58 +1413,58 @@ class PluginSystem {
|
|
|
1426
1413
|
applyPlugin(t) {
|
|
1427
1414
|
assert(isPlainObject(t), "Plugin configuration is invalid.");
|
|
1428
1415
|
const n = t.name;
|
|
1429
|
-
assert(n, "A name must be provided by the plugin."), this.registerPlugins[n] || (this.registerPlugins[n] = t, Object.keys(this.lifecycle).forEach((
|
|
1430
|
-
const s = t[
|
|
1431
|
-
s && this.lifecycle[
|
|
1416
|
+
assert(n, "A name must be provided by the plugin."), this.registerPlugins[n] || (this.registerPlugins[n] = t, Object.keys(this.lifecycle).forEach((r) => {
|
|
1417
|
+
const s = t[r];
|
|
1418
|
+
s && this.lifecycle[r].on(s);
|
|
1432
1419
|
}));
|
|
1433
1420
|
}
|
|
1434
1421
|
removePlugin(t) {
|
|
1435
1422
|
assert(t, "A name is required.");
|
|
1436
1423
|
const n = this.registerPlugins[t];
|
|
1437
|
-
assert(n, `The plugin "${t}" is not registered.`), Object.keys(n).forEach((
|
|
1438
|
-
|
|
1424
|
+
assert(n, `The plugin "${t}" is not registered.`), Object.keys(n).forEach((r) => {
|
|
1425
|
+
r !== "name" && this.lifecycle[r].remove(n[r]);
|
|
1439
1426
|
});
|
|
1440
1427
|
}
|
|
1441
1428
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
1442
1429
|
inherit({ lifecycle: t, registerPlugins: n }) {
|
|
1443
|
-
Object.keys(t).forEach((
|
|
1444
|
-
assert(!this.lifecycle[
|
|
1445
|
-
}), Object.keys(n).forEach((
|
|
1446
|
-
assert(!this.registerPlugins[
|
|
1430
|
+
Object.keys(t).forEach((r) => {
|
|
1431
|
+
assert(!this.lifecycle[r], `The hook "${r}" has a conflict and cannot be inherited.`), this.lifecycle[r] = t[r];
|
|
1432
|
+
}), Object.keys(n).forEach((r) => {
|
|
1433
|
+
assert(!this.registerPlugins[r], `The plugin "${r}" has a conflict and cannot be inherited.`), this.applyPlugin(n[r]);
|
|
1447
1434
|
});
|
|
1448
1435
|
}
|
|
1449
1436
|
constructor(t) {
|
|
1450
1437
|
this.registerPlugins = {}, this.lifecycle = t, this.lifecycleKeys = Object.keys(t);
|
|
1451
1438
|
}
|
|
1452
1439
|
}
|
|
1453
|
-
function defaultPreloadArgs(
|
|
1440
|
+
function defaultPreloadArgs(o) {
|
|
1454
1441
|
return _extends$1({
|
|
1455
1442
|
resourceCategory: "sync",
|
|
1456
1443
|
share: !0,
|
|
1457
1444
|
depsRemote: !0,
|
|
1458
1445
|
prefetchInterface: !1
|
|
1459
|
-
},
|
|
1446
|
+
}, o);
|
|
1460
1447
|
}
|
|
1461
|
-
function formatPreloadArgs(
|
|
1448
|
+
function formatPreloadArgs(o, t) {
|
|
1462
1449
|
return t.map((n) => {
|
|
1463
|
-
const
|
|
1464
|
-
return assert(
|
|
1465
|
-
remoteInfo:
|
|
1466
|
-
remotes:
|
|
1450
|
+
const r = matchRemote(o, n.nameOrAlias);
|
|
1451
|
+
return assert(r, `Unable to preload ${n.nameOrAlias} as it is not included in ${!r && safeToString({
|
|
1452
|
+
remoteInfo: r,
|
|
1453
|
+
remotes: o
|
|
1467
1454
|
})}`), {
|
|
1468
|
-
remote:
|
|
1455
|
+
remote: r,
|
|
1469
1456
|
preloadConfig: defaultPreloadArgs(n)
|
|
1470
1457
|
};
|
|
1471
1458
|
});
|
|
1472
1459
|
}
|
|
1473
|
-
function normalizePreloadExposes(
|
|
1474
|
-
return
|
|
1460
|
+
function normalizePreloadExposes(o) {
|
|
1461
|
+
return o ? o.map((t) => t === "." ? t : t.startsWith("./") ? t.replace("./", "") : t) : [];
|
|
1475
1462
|
}
|
|
1476
|
-
function preloadAssets(
|
|
1463
|
+
function preloadAssets(o, t, n, r = !0) {
|
|
1477
1464
|
const { cssAssets: s, jsAssetsWithoutEntry: l, entryAssets: a } = n;
|
|
1478
1465
|
if (t.options.inBrowser) {
|
|
1479
1466
|
if (a.forEach((i) => {
|
|
1480
|
-
const { moduleInfo: c } = i, u = t.moduleCache.get(
|
|
1467
|
+
const { moduleInfo: c } = i, u = t.moduleCache.get(o.name);
|
|
1481
1468
|
getRemoteEntry(u ? {
|
|
1482
1469
|
origin: t,
|
|
1483
1470
|
remoteInfo: c,
|
|
@@ -1487,7 +1474,7 @@ function preloadAssets(r, t, n, o = !0) {
|
|
|
1487
1474
|
remoteInfo: c,
|
|
1488
1475
|
remoteEntryExports: void 0
|
|
1489
1476
|
});
|
|
1490
|
-
}),
|
|
1477
|
+
}), r) {
|
|
1491
1478
|
const i = {
|
|
1492
1479
|
rel: "preload",
|
|
1493
1480
|
as: "style"
|
|
@@ -1533,7 +1520,7 @@ function preloadAssets(r, t, n, o = !0) {
|
|
|
1533
1520
|
d && document.head.appendChild(u);
|
|
1534
1521
|
});
|
|
1535
1522
|
}
|
|
1536
|
-
if (
|
|
1523
|
+
if (r) {
|
|
1537
1524
|
const i = {
|
|
1538
1525
|
rel: "preload",
|
|
1539
1526
|
as: "script"
|
|
@@ -1558,7 +1545,7 @@ function preloadAssets(r, t, n, o = !0) {
|
|
|
1558
1545
|
} else {
|
|
1559
1546
|
const i = {
|
|
1560
1547
|
fetchpriority: "high",
|
|
1561
|
-
type: (
|
|
1548
|
+
type: (o == null ? void 0 : o.type) === "module" ? "module" : "text/javascript"
|
|
1562
1549
|
};
|
|
1563
1550
|
l.forEach((c) => {
|
|
1564
1551
|
const { script: u, needAttach: d } = createScript({
|
|
@@ -1581,17 +1568,17 @@ function preloadAssets(r, t, n, o = !0) {
|
|
|
1581
1568
|
}
|
|
1582
1569
|
}
|
|
1583
1570
|
}
|
|
1584
|
-
function assignRemoteInfo(
|
|
1571
|
+
function assignRemoteInfo(o, t) {
|
|
1585
1572
|
const n = getRemoteEntryInfoFromSnapshot(t);
|
|
1586
|
-
n.url || error(`The attribute remoteEntry of ${
|
|
1587
|
-
let
|
|
1588
|
-
!isBrowserEnv() && !
|
|
1573
|
+
n.url || error(`The attribute remoteEntry of ${o.name} must not be undefined.`);
|
|
1574
|
+
let r = getResourceUrl(t, n.url);
|
|
1575
|
+
!isBrowserEnv() && !r.startsWith("http") && (r = `https:${r}`), o.type = n.type, o.entryGlobalName = n.globalName, o.entry = r, o.version = t.version, o.buildVersion = t.buildVersion;
|
|
1589
1576
|
}
|
|
1590
1577
|
function snapshotPlugin() {
|
|
1591
1578
|
return {
|
|
1592
1579
|
name: "snapshot-plugin",
|
|
1593
|
-
async afterResolve(
|
|
1594
|
-
const { remote: t, pkgNameOrAlias: n, expose:
|
|
1580
|
+
async afterResolve(o) {
|
|
1581
|
+
const { remote: t, pkgNameOrAlias: n, expose: r, origin: s, remoteInfo: l } = o;
|
|
1595
1582
|
if (!isRemoteInfoWithEntry(t) || !isPureRemoteEntry(t)) {
|
|
1596
1583
|
const { remoteSnapshot: a, globalSnapshot: i } = await s.snapshotHandler.loadRemoteSnapshotInfo(t);
|
|
1597
1584
|
assignRemoteInfo(l, a);
|
|
@@ -1600,7 +1587,7 @@ function snapshotPlugin() {
|
|
|
1600
1587
|
preloadConfig: {
|
|
1601
1588
|
nameOrAlias: n,
|
|
1602
1589
|
exposes: [
|
|
1603
|
-
|
|
1590
|
+
r
|
|
1604
1591
|
],
|
|
1605
1592
|
resourceCategory: "sync",
|
|
1606
1593
|
share: !1,
|
|
@@ -1614,16 +1601,16 @@ function snapshotPlugin() {
|
|
|
1614
1601
|
remoteSnapshot: a,
|
|
1615
1602
|
globalSnapshot: i
|
|
1616
1603
|
});
|
|
1617
|
-
return u && preloadAssets(l, s, u, !1), _extends$1({},
|
|
1604
|
+
return u && preloadAssets(l, s, u, !1), _extends$1({}, o, {
|
|
1618
1605
|
remoteSnapshot: a
|
|
1619
1606
|
});
|
|
1620
1607
|
}
|
|
1621
|
-
return
|
|
1608
|
+
return o;
|
|
1622
1609
|
}
|
|
1623
1610
|
};
|
|
1624
1611
|
}
|
|
1625
|
-
function splitId(
|
|
1626
|
-
const t =
|
|
1612
|
+
function splitId(o) {
|
|
1613
|
+
const t = o.split(":");
|
|
1627
1614
|
return t.length === 1 ? {
|
|
1628
1615
|
name: t[0],
|
|
1629
1616
|
version: void 0
|
|
@@ -1635,33 +1622,33 @@ function splitId(r) {
|
|
|
1635
1622
|
version: t[2]
|
|
1636
1623
|
};
|
|
1637
1624
|
}
|
|
1638
|
-
function traverseModuleInfo(
|
|
1639
|
-
const a = getFMId(t), { value: i } = getInfoWithoutType(
|
|
1640
|
-
if (c && !isManifestProvider(c) && (n(c, t,
|
|
1625
|
+
function traverseModuleInfo(o, t, n, r, s = {}, l) {
|
|
1626
|
+
const a = getFMId(t), { value: i } = getInfoWithoutType(o, a), c = l || i;
|
|
1627
|
+
if (c && !isManifestProvider(c) && (n(c, t, r), c.remotesInfo)) {
|
|
1641
1628
|
const u = Object.keys(c.remotesInfo);
|
|
1642
1629
|
for (const d of u) {
|
|
1643
1630
|
if (s[d])
|
|
1644
1631
|
continue;
|
|
1645
1632
|
s[d] = !0;
|
|
1646
1633
|
const p = splitId(d), m = c.remotesInfo[d];
|
|
1647
|
-
traverseModuleInfo(
|
|
1634
|
+
traverseModuleInfo(o, {
|
|
1648
1635
|
name: p.name,
|
|
1649
1636
|
version: m.matchedVersion
|
|
1650
1637
|
}, n, !1, s, void 0);
|
|
1651
1638
|
}
|
|
1652
1639
|
}
|
|
1653
1640
|
}
|
|
1654
|
-
function generatePreloadAssets(
|
|
1655
|
-
const l = [], a = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: d } =
|
|
1656
|
-
if (traverseModuleInfo(
|
|
1641
|
+
function generatePreloadAssets(o, t, n, r, s) {
|
|
1642
|
+
const l = [], a = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: d } = o, { preloadConfig: p } = t, { depsRemote: m } = p;
|
|
1643
|
+
if (traverseModuleInfo(r, n, (g, b, S) => {
|
|
1657
1644
|
let v;
|
|
1658
1645
|
if (S)
|
|
1659
1646
|
v = p;
|
|
1660
1647
|
else if (Array.isArray(m)) {
|
|
1661
|
-
const
|
|
1662
|
-
if (!
|
|
1648
|
+
const w = m.find((T) => T.nameOrAlias === b.name || T.nameOrAlias === b.alias);
|
|
1649
|
+
if (!w)
|
|
1663
1650
|
return;
|
|
1664
|
-
v = defaultPreloadArgs(
|
|
1651
|
+
v = defaultPreloadArgs(w);
|
|
1665
1652
|
} else if (m === !0)
|
|
1666
1653
|
v = p;
|
|
1667
1654
|
else
|
|
@@ -1682,30 +1669,30 @@ function generatePreloadAssets(r, t, n, o, s) {
|
|
|
1682
1669
|
let R = "modules" in g ? g.modules : [];
|
|
1683
1670
|
const $ = normalizePreloadExposes(v.exposes);
|
|
1684
1671
|
if ($.length && "modules" in g) {
|
|
1685
|
-
var
|
|
1686
|
-
R = g == null || (
|
|
1672
|
+
var O;
|
|
1673
|
+
R = g == null || (O = g.modules) == null ? void 0 : O.reduce((w, T) => (($ == null ? void 0 : $.indexOf(T.moduleName)) !== -1 && w.push(T), w), []);
|
|
1687
1674
|
}
|
|
1688
|
-
function
|
|
1689
|
-
const
|
|
1690
|
-
return v.filter ?
|
|
1675
|
+
function A(w) {
|
|
1676
|
+
const T = w.map((M) => getResourceUrl(g, M));
|
|
1677
|
+
return v.filter ? T.filter(v.filter) : T;
|
|
1691
1678
|
}
|
|
1692
1679
|
if (R) {
|
|
1693
|
-
const
|
|
1694
|
-
for (let
|
|
1695
|
-
const
|
|
1696
|
-
|
|
1697
|
-
id:
|
|
1680
|
+
const w = R.length;
|
|
1681
|
+
for (let T = 0; T < w; T++) {
|
|
1682
|
+
const M = R[T], L = `${b.name}/${M.moduleName}`;
|
|
1683
|
+
o.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
|
|
1684
|
+
id: M.moduleName === "." ? b.name : L,
|
|
1698
1685
|
name: b.name,
|
|
1699
1686
|
remoteSnapshot: g,
|
|
1700
1687
|
preloadConfig: v,
|
|
1701
1688
|
remote: b,
|
|
1702
|
-
origin:
|
|
1703
|
-
}), !getPreloaded(
|
|
1689
|
+
origin: o
|
|
1690
|
+
}), !getPreloaded(L) && (v.resourceCategory === "all" ? (l.push(...A(M.assets.css.async)), l.push(...A(M.assets.css.sync)), a.push(...A(M.assets.js.async)), a.push(...A(M.assets.js.sync))) : (v.resourceCategory = "sync") && (l.push(...A(M.assets.css.sync)), a.push(...A(M.assets.js.sync))), setPreloaded(L));
|
|
1704
1691
|
}
|
|
1705
1692
|
}
|
|
1706
1693
|
}, !0, {}, s), s.shared) {
|
|
1707
1694
|
const g = (b, S) => {
|
|
1708
|
-
const v = getRegisteredShare(
|
|
1695
|
+
const v = getRegisteredShare(o.shareScopeMap, S.sharedName, b, o.sharedHandler.hooks.lifecycle.resolveShare);
|
|
1709
1696
|
v && typeof v.lib == "function" && (S.assets.js.sync.forEach((I) => {
|
|
1710
1697
|
c.add(I);
|
|
1711
1698
|
}), S.assets.css.sync.forEach((I) => {
|
|
@@ -1735,8 +1722,8 @@ function generatePreloadAssets(r, t, n, o, s) {
|
|
|
1735
1722
|
const generatePreloadAssetsPlugin = function() {
|
|
1736
1723
|
return {
|
|
1737
1724
|
name: "generate-preload-assets-plugin",
|
|
1738
|
-
async generatePreloadAssets(
|
|
1739
|
-
const { origin: t, preloadOptions: n, remoteInfo:
|
|
1725
|
+
async generatePreloadAssets(o) {
|
|
1726
|
+
const { origin: t, preloadOptions: n, remoteInfo: r, remote: s, globalSnapshot: l, remoteSnapshot: a } = o;
|
|
1740
1727
|
return isRemoteInfoWithEntry(s) && isPureRemoteEntry(s) ? {
|
|
1741
1728
|
cssAssets: [],
|
|
1742
1729
|
jsAssetsWithoutEntry: [],
|
|
@@ -1745,45 +1732,45 @@ const generatePreloadAssetsPlugin = function() {
|
|
|
1745
1732
|
name: s.name,
|
|
1746
1733
|
url: s.entry,
|
|
1747
1734
|
moduleInfo: {
|
|
1748
|
-
name:
|
|
1735
|
+
name: r.name,
|
|
1749
1736
|
entry: s.entry,
|
|
1750
|
-
type:
|
|
1737
|
+
type: r.type || "global",
|
|
1751
1738
|
entryGlobalName: "",
|
|
1752
1739
|
shareScope: ""
|
|
1753
1740
|
}
|
|
1754
1741
|
}
|
|
1755
1742
|
]
|
|
1756
|
-
} : (assignRemoteInfo(
|
|
1743
|
+
} : (assignRemoteInfo(r, a), generatePreloadAssets(t, n, r, l, a));
|
|
1757
1744
|
}
|
|
1758
1745
|
};
|
|
1759
1746
|
};
|
|
1760
|
-
function getGlobalRemoteInfo(
|
|
1747
|
+
function getGlobalRemoteInfo(o, t) {
|
|
1761
1748
|
const n = getGlobalSnapshotInfoByModuleInfo({
|
|
1762
1749
|
name: t.options.name,
|
|
1763
1750
|
version: t.options.version
|
|
1764
|
-
}),
|
|
1765
|
-
return
|
|
1751
|
+
}), r = n && "remotesInfo" in n && n.remotesInfo && getInfoWithoutType(n.remotesInfo, o.name).value;
|
|
1752
|
+
return r && r.matchedVersion ? {
|
|
1766
1753
|
hostGlobalSnapshot: n,
|
|
1767
1754
|
globalSnapshot: getGlobalSnapshot(),
|
|
1768
1755
|
remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({
|
|
1769
|
-
name:
|
|
1770
|
-
version:
|
|
1756
|
+
name: o.name,
|
|
1757
|
+
version: r.matchedVersion
|
|
1771
1758
|
})
|
|
1772
1759
|
} : {
|
|
1773
1760
|
hostGlobalSnapshot: void 0,
|
|
1774
1761
|
globalSnapshot: getGlobalSnapshot(),
|
|
1775
1762
|
remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({
|
|
1776
|
-
name:
|
|
1777
|
-
version: "version" in
|
|
1763
|
+
name: o.name,
|
|
1764
|
+
version: "version" in o ? o.version : void 0
|
|
1778
1765
|
})
|
|
1779
1766
|
};
|
|
1780
1767
|
}
|
|
1781
1768
|
class SnapshotHandler {
|
|
1782
1769
|
async loadSnapshot(t) {
|
|
1783
|
-
const { options: n } = this.HostInstance, { hostGlobalSnapshot:
|
|
1770
|
+
const { options: n } = this.HostInstance, { hostGlobalSnapshot: r, remoteSnapshot: s, globalSnapshot: l } = this.getGlobalRemoteInfo(t), { remoteSnapshot: a, globalSnapshot: i } = await this.hooks.lifecycle.loadSnapshot.emit({
|
|
1784
1771
|
options: n,
|
|
1785
1772
|
moduleInfo: t,
|
|
1786
|
-
hostGlobalSnapshot:
|
|
1773
|
+
hostGlobalSnapshot: r,
|
|
1787
1774
|
remoteSnapshot: s,
|
|
1788
1775
|
globalSnapshot: l
|
|
1789
1776
|
});
|
|
@@ -1799,17 +1786,17 @@ class SnapshotHandler {
|
|
|
1799
1786
|
options: n,
|
|
1800
1787
|
moduleInfo: t
|
|
1801
1788
|
});
|
|
1802
|
-
let
|
|
1789
|
+
let r = getGlobalSnapshotInfoByModuleInfo({
|
|
1803
1790
|
name: this.HostInstance.options.name,
|
|
1804
1791
|
version: this.HostInstance.options.version
|
|
1805
1792
|
});
|
|
1806
|
-
|
|
1793
|
+
r || (r = {
|
|
1807
1794
|
version: this.HostInstance.options.version || "",
|
|
1808
1795
|
remoteEntry: "",
|
|
1809
1796
|
remotesInfo: {}
|
|
1810
1797
|
}, addGlobalSnapshot({
|
|
1811
|
-
[this.HostInstance.options.name]:
|
|
1812
|
-
})),
|
|
1798
|
+
[this.HostInstance.options.name]: r
|
|
1799
|
+
})), r && "remotesInfo" in r && !getInfoWithoutType(r.remotesInfo, t.name).value && ("version" in t || "entry" in t) && (r.remotesInfo = _extends$1({}, r == null ? void 0 : r.remotesInfo, {
|
|
1813
1800
|
[t.name]: {
|
|
1814
1801
|
matchedVersion: "version" in t ? t.version : t.entry
|
|
1815
1802
|
}
|
|
@@ -1865,7 +1852,7 @@ class SnapshotHandler {
|
|
|
1865
1852
|
getGlobalRemoteInfo(t) {
|
|
1866
1853
|
return getGlobalRemoteInfo(t, this.HostInstance);
|
|
1867
1854
|
}
|
|
1868
|
-
async getManifestJson(t, n,
|
|
1855
|
+
async getManifestJson(t, n, r) {
|
|
1869
1856
|
const s = async () => {
|
|
1870
1857
|
let a = this.manifestCache.get(t);
|
|
1871
1858
|
if (a)
|
|
@@ -1913,9 +1900,9 @@ class SnapshotHandler {
|
|
|
1913
1900
|
class SharedHandler {
|
|
1914
1901
|
// register shared in shareScopeMap
|
|
1915
1902
|
registerShared(t, n) {
|
|
1916
|
-
const { shareInfos:
|
|
1917
|
-
return Object.keys(
|
|
1918
|
-
|
|
1903
|
+
const { shareInfos: r, shared: s } = formatShareConfigs(t, n);
|
|
1904
|
+
return Object.keys(r).forEach((a) => {
|
|
1905
|
+
r[a].forEach((c) => {
|
|
1919
1906
|
!getRegisteredShare(this.shareScopeMap, a, c, this.hooks.lifecycle.resolveShare) && c && c.lib && this.setShared({
|
|
1920
1907
|
pkgName: a,
|
|
1921
1908
|
lib: c.lib,
|
|
@@ -1926,15 +1913,15 @@ class SharedHandler {
|
|
|
1926
1913
|
});
|
|
1927
1914
|
});
|
|
1928
1915
|
}), {
|
|
1929
|
-
shareInfos:
|
|
1916
|
+
shareInfos: r,
|
|
1930
1917
|
shared: s
|
|
1931
1918
|
};
|
|
1932
1919
|
}
|
|
1933
1920
|
async loadShare(t, n) {
|
|
1934
|
-
const { host:
|
|
1921
|
+
const { host: r } = this, s = getTargetSharedOptions({
|
|
1935
1922
|
pkgName: t,
|
|
1936
1923
|
extraOptions: n,
|
|
1937
|
-
shareInfos:
|
|
1924
|
+
shareInfos: r.options.shared
|
|
1938
1925
|
});
|
|
1939
1926
|
s != null && s.scope && await Promise.all(s.scope.map(async (u) => {
|
|
1940
1927
|
await Promise.all(this.initializeSharing(u, {
|
|
@@ -1944,12 +1931,12 @@ class SharedHandler {
|
|
|
1944
1931
|
const l = await this.hooks.lifecycle.beforeLoadShare.emit({
|
|
1945
1932
|
pkgName: t,
|
|
1946
1933
|
shareInfo: s,
|
|
1947
|
-
shared:
|
|
1948
|
-
origin:
|
|
1934
|
+
shared: r.options.shared,
|
|
1935
|
+
origin: r
|
|
1949
1936
|
}), { shareInfo: a } = l;
|
|
1950
|
-
assert(a, `Cannot find ${t} Share in the ${
|
|
1937
|
+
assert(a, `Cannot find ${t} Share in the ${r.options.name}. Please ensure that the ${t} Share parameters have been injected`);
|
|
1951
1938
|
const i = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare), c = (u) => {
|
|
1952
|
-
u.useIn || (u.useIn = []), addUniqueItem(u.useIn,
|
|
1939
|
+
u.useIn || (u.useIn = []), addUniqueItem(u.useIn, r.options.name);
|
|
1953
1940
|
};
|
|
1954
1941
|
if (i && i.lib)
|
|
1955
1942
|
return c(i), i.lib;
|
|
@@ -1967,7 +1954,7 @@ class SharedHandler {
|
|
|
1967
1954
|
pkgName: t,
|
|
1968
1955
|
loaded: !1,
|
|
1969
1956
|
shared: i,
|
|
1970
|
-
from:
|
|
1957
|
+
from: r.options.name,
|
|
1971
1958
|
lib: null,
|
|
1972
1959
|
loading: d
|
|
1973
1960
|
}), d;
|
|
@@ -1984,7 +1971,7 @@ class SharedHandler {
|
|
|
1984
1971
|
pkgName: t,
|
|
1985
1972
|
loaded: !1,
|
|
1986
1973
|
shared: a,
|
|
1987
|
-
from:
|
|
1974
|
+
from: r.options.name,
|
|
1988
1975
|
lib: null,
|
|
1989
1976
|
loading: d
|
|
1990
1977
|
}), d;
|
|
@@ -1997,7 +1984,7 @@ class SharedHandler {
|
|
|
1997
1984
|
*/
|
|
1998
1985
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1999
1986
|
initializeSharing(t = DEFAULT_SCOPE, n) {
|
|
2000
|
-
const { host:
|
|
1987
|
+
const { host: r } = this, s = n == null ? void 0 : n.from, l = n == null ? void 0 : n.strategy;
|
|
2001
1988
|
let a = n == null ? void 0 : n.initScope;
|
|
2002
1989
|
const i = [];
|
|
2003
1990
|
if (s !== "build") {
|
|
@@ -2010,7 +1997,7 @@ class SharedHandler {
|
|
|
2010
1997
|
return i;
|
|
2011
1998
|
a.push(E);
|
|
2012
1999
|
}
|
|
2013
|
-
const c = this.shareScopeMap, u =
|
|
2000
|
+
const c = this.shareScopeMap, u = r.options.name;
|
|
2014
2001
|
c[t] || (c[t] = {});
|
|
2015
2002
|
const d = c[t], p = (_, E) => {
|
|
2016
2003
|
var g;
|
|
@@ -2019,7 +2006,7 @@ class SharedHandler {
|
|
|
2019
2006
|
const v = d[_], I = v[b], R = !!(I && (I.eager || (g = I.shareConfig) != null && g.eager));
|
|
2020
2007
|
(!I || I.strategy !== "loaded-first" && !I.loaded && (!S != !R ? S : u > I.from)) && (v[b] = E);
|
|
2021
2008
|
}, m = (_) => _ && _.init && _.init(c[t], a), y = async (_) => {
|
|
2022
|
-
const { module: E } = await
|
|
2009
|
+
const { module: E } = await r.remoteHandler.getRemoteModuleAndOptions({
|
|
2023
2010
|
id: _
|
|
2024
2011
|
});
|
|
2025
2012
|
if (E.getEntry) {
|
|
@@ -2027,22 +2014,22 @@ class SharedHandler {
|
|
|
2027
2014
|
try {
|
|
2028
2015
|
g = await E.getEntry();
|
|
2029
2016
|
} catch (b) {
|
|
2030
|
-
g = await
|
|
2017
|
+
g = await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
2031
2018
|
id: _,
|
|
2032
2019
|
error: b,
|
|
2033
2020
|
from: "runtime",
|
|
2034
2021
|
lifecycle: "beforeLoadShare",
|
|
2035
|
-
origin:
|
|
2022
|
+
origin: r
|
|
2036
2023
|
});
|
|
2037
2024
|
}
|
|
2038
2025
|
E.inited || (await m(g), E.inited = !0);
|
|
2039
2026
|
}
|
|
2040
2027
|
};
|
|
2041
|
-
return Object.keys(
|
|
2042
|
-
|
|
2028
|
+
return Object.keys(r.options.shared).forEach((_) => {
|
|
2029
|
+
r.options.shared[_].forEach((g) => {
|
|
2043
2030
|
g.scope.includes(t) && p(_, g);
|
|
2044
2031
|
});
|
|
2045
|
-
}), (
|
|
2032
|
+
}), (r.options.shareStrategy === "version-first" || l === "version-first") && r.options.remotes.forEach((_) => {
|
|
2046
2033
|
_.shareScope === t && i.push(y(_.name));
|
|
2047
2034
|
}), i;
|
|
2048
2035
|
}
|
|
@@ -2051,10 +2038,10 @@ class SharedHandler {
|
|
|
2051
2038
|
// 2. If lib exists in local shared, it will be used directly
|
|
2052
2039
|
// 3. If the local get returns something other than Promise, then it will be used directly
|
|
2053
2040
|
loadShareSync(t, n) {
|
|
2054
|
-
const { host:
|
|
2041
|
+
const { host: r } = this, s = getTargetSharedOptions({
|
|
2055
2042
|
pkgName: t,
|
|
2056
2043
|
extraOptions: n,
|
|
2057
|
-
shareInfos:
|
|
2044
|
+
shareInfos: r.options.shared
|
|
2058
2045
|
});
|
|
2059
2046
|
s != null && s.scope && s.scope.forEach((i) => {
|
|
2060
2047
|
this.initializeSharing(i, {
|
|
@@ -2062,18 +2049,18 @@ class SharedHandler {
|
|
|
2062
2049
|
});
|
|
2063
2050
|
});
|
|
2064
2051
|
const l = getRegisteredShare(this.shareScopeMap, t, s, this.hooks.lifecycle.resolveShare), a = (i) => {
|
|
2065
|
-
i.useIn || (i.useIn = []), addUniqueItem(i.useIn,
|
|
2052
|
+
i.useIn || (i.useIn = []), addUniqueItem(i.useIn, r.options.name);
|
|
2066
2053
|
};
|
|
2067
2054
|
if (l) {
|
|
2068
2055
|
if (typeof l.lib == "function")
|
|
2069
|
-
return a(l), l.loaded || (l.loaded = !0, l.from ===
|
|
2056
|
+
return a(l), l.loaded || (l.loaded = !0, l.from === r.options.name && (s.loaded = !0)), l.lib;
|
|
2070
2057
|
if (typeof l.get == "function") {
|
|
2071
2058
|
const i = l.get();
|
|
2072
2059
|
if (!(i instanceof Promise))
|
|
2073
2060
|
return a(l), this.setShared({
|
|
2074
2061
|
pkgName: t,
|
|
2075
2062
|
loaded: !0,
|
|
2076
|
-
from:
|
|
2063
|
+
from: r.options.name,
|
|
2077
2064
|
lib: i,
|
|
2078
2065
|
shared: l
|
|
2079
2066
|
}), i;
|
|
@@ -2086,34 +2073,34 @@ class SharedHandler {
|
|
|
2086
2073
|
if (i instanceof Promise) {
|
|
2087
2074
|
const c = (n == null ? void 0 : n.from) === "build" ? RUNTIME_005 : RUNTIME_006;
|
|
2088
2075
|
throw new Error(getShortErrorMsg(c, runtimeDescMap, {
|
|
2089
|
-
hostName:
|
|
2076
|
+
hostName: r.options.name,
|
|
2090
2077
|
sharedPkgName: t
|
|
2091
2078
|
}));
|
|
2092
2079
|
}
|
|
2093
2080
|
return s.lib = i, this.setShared({
|
|
2094
2081
|
pkgName: t,
|
|
2095
2082
|
loaded: !0,
|
|
2096
|
-
from:
|
|
2083
|
+
from: r.options.name,
|
|
2097
2084
|
lib: s.lib,
|
|
2098
2085
|
shared: s
|
|
2099
2086
|
}), s.lib;
|
|
2100
2087
|
}
|
|
2101
2088
|
throw new Error(getShortErrorMsg(RUNTIME_006, runtimeDescMap, {
|
|
2102
|
-
hostName:
|
|
2089
|
+
hostName: r.options.name,
|
|
2103
2090
|
sharedPkgName: t
|
|
2104
2091
|
}));
|
|
2105
2092
|
}
|
|
2106
|
-
initShareScopeMap(t, n,
|
|
2093
|
+
initShareScopeMap(t, n, r = {}) {
|
|
2107
2094
|
const { host: s } = this;
|
|
2108
2095
|
this.shareScopeMap[t] = n, this.hooks.lifecycle.initContainerShareScopeMap.emit({
|
|
2109
2096
|
shareScope: n,
|
|
2110
2097
|
options: s.options,
|
|
2111
2098
|
origin: s,
|
|
2112
2099
|
scopeName: t,
|
|
2113
|
-
hostShareScopeMap:
|
|
2100
|
+
hostShareScopeMap: r.hostShareScopeMap
|
|
2114
2101
|
});
|
|
2115
2102
|
}
|
|
2116
|
-
setShared({ pkgName: t, shared: n, from:
|
|
2103
|
+
setShared({ pkgName: t, shared: n, from: r, lib: s, loading: l, loaded: a, get: i }) {
|
|
2117
2104
|
const { version: c, scope: u = "default" } = n, d = _object_without_properties_loose(n, [
|
|
2118
2105
|
"version",
|
|
2119
2106
|
"scope"
|
|
@@ -2139,8 +2126,8 @@ class SharedHandler {
|
|
|
2139
2126
|
});
|
|
2140
2127
|
}
|
|
2141
2128
|
_setGlobalShareScopeMap(t) {
|
|
2142
|
-
const n = getGlobalShareScope(),
|
|
2143
|
-
|
|
2129
|
+
const n = getGlobalShareScope(), r = t.id || t.name;
|
|
2130
|
+
r && !n[r] && (n[r] = this.shareScopeMap);
|
|
2144
2131
|
}
|
|
2145
2132
|
constructor(t) {
|
|
2146
2133
|
this.hooks = new PluginSystem({
|
|
@@ -2161,14 +2148,14 @@ class RemoteHandler {
|
|
|
2161
2148
|
}), s), t.remotes);
|
|
2162
2149
|
}
|
|
2163
2150
|
setIdToRemoteMap(t, n) {
|
|
2164
|
-
const { remote:
|
|
2151
|
+
const { remote: r, expose: s } = n, { name: l, alias: a } = r;
|
|
2165
2152
|
if (this.idToRemoteMap[t] = {
|
|
2166
|
-
name:
|
|
2153
|
+
name: r.name,
|
|
2167
2154
|
expose: s
|
|
2168
2155
|
}, a && t.startsWith(l)) {
|
|
2169
2156
|
const i = t.replace(l, a);
|
|
2170
2157
|
this.idToRemoteMap[i] = {
|
|
2171
|
-
name:
|
|
2158
|
+
name: r.name,
|
|
2172
2159
|
expose: s
|
|
2173
2160
|
};
|
|
2174
2161
|
return;
|
|
@@ -2176,7 +2163,7 @@ class RemoteHandler {
|
|
|
2176
2163
|
if (a && t.startsWith(a)) {
|
|
2177
2164
|
const i = t.replace(a, l);
|
|
2178
2165
|
this.idToRemoteMap[i] = {
|
|
2179
|
-
name:
|
|
2166
|
+
name: r.name,
|
|
2180
2167
|
expose: s
|
|
2181
2168
|
};
|
|
2182
2169
|
}
|
|
@@ -2184,7 +2171,7 @@ class RemoteHandler {
|
|
|
2184
2171
|
// eslint-disable-next-line max-lines-per-function
|
|
2185
2172
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
2186
2173
|
async loadRemote(t, n) {
|
|
2187
|
-
const { host:
|
|
2174
|
+
const { host: r } = this;
|
|
2188
2175
|
try {
|
|
2189
2176
|
const { loadFactory: s = !0 } = n || {
|
|
2190
2177
|
loadFactory: !0
|
|
@@ -2199,7 +2186,7 @@ class RemoteHandler {
|
|
|
2199
2186
|
remote: u,
|
|
2200
2187
|
options: a,
|
|
2201
2188
|
moduleInstance: l,
|
|
2202
|
-
origin:
|
|
2189
|
+
origin: r
|
|
2203
2190
|
});
|
|
2204
2191
|
return this.setIdToRemoteMap(t, i), typeof _ == "function" ? _ : y;
|
|
2205
2192
|
} catch (s) {
|
|
@@ -2210,7 +2197,7 @@ class RemoteHandler {
|
|
|
2210
2197
|
error: s,
|
|
2211
2198
|
from: l,
|
|
2212
2199
|
lifecycle: "onLoad",
|
|
2213
|
-
origin:
|
|
2200
|
+
origin: r
|
|
2214
2201
|
});
|
|
2215
2202
|
if (!a)
|
|
2216
2203
|
throw s;
|
|
@@ -2225,8 +2212,8 @@ class RemoteHandler {
|
|
|
2225
2212
|
options: n.options,
|
|
2226
2213
|
origin: n
|
|
2227
2214
|
});
|
|
2228
|
-
const
|
|
2229
|
-
await Promise.all(
|
|
2215
|
+
const r = formatPreloadArgs(n.options.remotes, t);
|
|
2216
|
+
await Promise.all(r.map(async (s) => {
|
|
2230
2217
|
const { remote: l } = s, a = getRemoteInfo(l), { globalSnapshot: i, remoteSnapshot: c } = await n.snapshotHandler.loadRemoteSnapshotInfo(l), u = await this.hooks.lifecycle.generatePreloadAssets.emit({
|
|
2231
2218
|
origin: n,
|
|
2232
2219
|
preloadOptions: s,
|
|
@@ -2239,25 +2226,25 @@ class RemoteHandler {
|
|
|
2239
2226
|
}));
|
|
2240
2227
|
}
|
|
2241
2228
|
registerRemotes(t, n) {
|
|
2242
|
-
const { host:
|
|
2229
|
+
const { host: r } = this;
|
|
2243
2230
|
t.forEach((s) => {
|
|
2244
|
-
this.registerRemote(s,
|
|
2231
|
+
this.registerRemote(s, r.options.remotes, {
|
|
2245
2232
|
force: n == null ? void 0 : n.force
|
|
2246
2233
|
});
|
|
2247
2234
|
});
|
|
2248
2235
|
}
|
|
2249
2236
|
async getRemoteModuleAndOptions(t) {
|
|
2250
|
-
const { host: n } = this, { id:
|
|
2237
|
+
const { host: n } = this, { id: r } = t;
|
|
2251
2238
|
let s;
|
|
2252
2239
|
try {
|
|
2253
2240
|
s = await this.hooks.lifecycle.beforeRequest.emit({
|
|
2254
|
-
id:
|
|
2241
|
+
id: r,
|
|
2255
2242
|
options: n.options,
|
|
2256
2243
|
origin: n
|
|
2257
2244
|
});
|
|
2258
2245
|
} catch (_) {
|
|
2259
2246
|
if (s = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
2260
|
-
id:
|
|
2247
|
+
id: r,
|
|
2261
2248
|
options: n.options,
|
|
2262
2249
|
origin: n,
|
|
2263
2250
|
from: "runtime",
|
|
@@ -2290,7 +2277,7 @@ class RemoteHandler {
|
|
|
2290
2277
|
remoteMatchInfo: u
|
|
2291
2278
|
};
|
|
2292
2279
|
}
|
|
2293
|
-
registerRemote(t, n,
|
|
2280
|
+
registerRemote(t, n, r) {
|
|
2294
2281
|
const { host: s } = this, l = () => {
|
|
2295
2282
|
if (t.alias) {
|
|
2296
2283
|
const i = n.find((c) => {
|
|
@@ -2316,7 +2303,7 @@ class RemoteHandler {
|
|
|
2316
2303
|
`The remote "${t.name}" is already registered.`,
|
|
2317
2304
|
"Please note that overriding it may cause unexpected errors."
|
|
2318
2305
|
];
|
|
2319
|
-
|
|
2306
|
+
r != null && r.force && (this.removeRemote(a), l(), n.push(t), this.hooks.lifecycle.registerRemote.emit({
|
|
2320
2307
|
remote: t,
|
|
2321
2308
|
origin: s
|
|
2322
2309
|
}), warn$1(i.join(" ")));
|
|
@@ -2324,9 +2311,9 @@ class RemoteHandler {
|
|
|
2324
2311
|
}
|
|
2325
2312
|
removeRemote(t) {
|
|
2326
2313
|
try {
|
|
2327
|
-
const { host:
|
|
2328
|
-
l !== -1 &&
|
|
2329
|
-
const a =
|
|
2314
|
+
const { host: r } = this, { name: s } = t, l = r.options.remotes.findIndex((i) => i.name === s);
|
|
2315
|
+
l !== -1 && r.options.remotes.splice(l, 1);
|
|
2316
|
+
const a = r.moduleCache.get(t.name);
|
|
2330
2317
|
if (a) {
|
|
2331
2318
|
const i = a.remoteInfo, c = i.entryGlobalName;
|
|
2332
2319
|
if (CurrentGlobal[c]) {
|
|
@@ -2334,7 +2321,7 @@ class RemoteHandler {
|
|
|
2334
2321
|
(n = Object.getOwnPropertyDescriptor(CurrentGlobal, c)) != null && n.configurable ? delete CurrentGlobal[c] : CurrentGlobal[c] = void 0;
|
|
2335
2322
|
}
|
|
2336
2323
|
const u = getRemoteEntryUniqueKey(a.remoteInfo);
|
|
2337
|
-
globalLoading[u] && delete globalLoading[u],
|
|
2324
|
+
globalLoading[u] && delete globalLoading[u], r.snapshotHandler.manifestCache.delete(i.entry);
|
|
2338
2325
|
let d = i.buildVersion ? composeKeyWithSeparator(i.name, i.buildVersion) : i.name;
|
|
2339
2326
|
const p = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => i.buildVersion ? y.options.id === d : y.name === d);
|
|
2340
2327
|
if (p !== -1) {
|
|
@@ -2349,36 +2336,36 @@ class RemoteHandler {
|
|
|
2349
2336
|
const I = S[v];
|
|
2350
2337
|
I && Object.keys(I).forEach((R) => {
|
|
2351
2338
|
const $ = I[R];
|
|
2352
|
-
$ && Object.keys($).forEach((
|
|
2353
|
-
const
|
|
2354
|
-
|
|
2339
|
+
$ && Object.keys($).forEach((O) => {
|
|
2340
|
+
const A = $[O];
|
|
2341
|
+
A && typeof A == "object" && A.from === i.name && (A.loaded || A.loading ? (A.useIn = A.useIn.filter((w) => w !== i.name), A.useIn.length ? E = !1 : g.push([
|
|
2355
2342
|
b,
|
|
2356
2343
|
v,
|
|
2357
2344
|
R,
|
|
2358
|
-
|
|
2345
|
+
O
|
|
2359
2346
|
])) : g.push([
|
|
2360
2347
|
b,
|
|
2361
2348
|
v,
|
|
2362
2349
|
R,
|
|
2363
|
-
|
|
2350
|
+
O
|
|
2364
2351
|
]));
|
|
2365
2352
|
});
|
|
2366
2353
|
});
|
|
2367
2354
|
});
|
|
2368
2355
|
}), E && (y.shareScopeMap = {}, delete _[d]), g.forEach(([b, S, v, I]) => {
|
|
2369
|
-
var R, $,
|
|
2370
|
-
(
|
|
2356
|
+
var R, $, O;
|
|
2357
|
+
(O = _[b]) == null || ($ = O[S]) == null || (R = $[v]) == null || delete R[I];
|
|
2371
2358
|
}), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(p, 1);
|
|
2372
2359
|
}
|
|
2373
|
-
const { hostGlobalSnapshot: m } = getGlobalRemoteInfo(t,
|
|
2360
|
+
const { hostGlobalSnapshot: m } = getGlobalRemoteInfo(t, r);
|
|
2374
2361
|
if (m) {
|
|
2375
2362
|
const y = m && "remotesInfo" in m && m.remotesInfo && getInfoWithoutType(m.remotesInfo, t.name).key;
|
|
2376
2363
|
y && (delete m.remotesInfo[y], Global.__FEDERATION__.__MANIFEST_LOADING__[y] && delete Global.__FEDERATION__.__MANIFEST_LOADING__[y]);
|
|
2377
2364
|
}
|
|
2378
|
-
|
|
2365
|
+
r.moduleCache.delete(t.name);
|
|
2379
2366
|
}
|
|
2380
|
-
} catch (
|
|
2381
|
-
logger.log("removeRemote fail: ",
|
|
2367
|
+
} catch (r) {
|
|
2368
|
+
logger.log("removeRemote fail: ", r);
|
|
2382
2369
|
}
|
|
2383
2370
|
}
|
|
2384
2371
|
constructor(t) {
|
|
@@ -2416,7 +2403,7 @@ class FederationHost {
|
|
|
2416
2403
|
initializeSharing(t = DEFAULT_SCOPE, n) {
|
|
2417
2404
|
return this.sharedHandler.initializeSharing(t, n);
|
|
2418
2405
|
}
|
|
2419
|
-
initRawContainer(t, n,
|
|
2406
|
+
initRawContainer(t, n, r) {
|
|
2420
2407
|
const s = getRemoteInfo({
|
|
2421
2408
|
name: t,
|
|
2422
2409
|
entry: n
|
|
@@ -2424,7 +2411,7 @@ class FederationHost {
|
|
|
2424
2411
|
host: this,
|
|
2425
2412
|
remoteInfo: s
|
|
2426
2413
|
});
|
|
2427
|
-
return l.remoteEntryExports =
|
|
2414
|
+
return l.remoteEntryExports = r, this.moduleCache.set(t, l), l;
|
|
2428
2415
|
}
|
|
2429
2416
|
// eslint-disable-next-line max-lines-per-function
|
|
2430
2417
|
// eslint-disable-next-line @typescript-eslint/member-ordering
|
|
@@ -2435,15 +2422,15 @@ class FederationHost {
|
|
|
2435
2422
|
async preloadRemote(t) {
|
|
2436
2423
|
return this.remoteHandler.preloadRemote(t);
|
|
2437
2424
|
}
|
|
2438
|
-
initShareScopeMap(t, n,
|
|
2439
|
-
this.sharedHandler.initShareScopeMap(t, n,
|
|
2425
|
+
initShareScopeMap(t, n, r = {}) {
|
|
2426
|
+
this.sharedHandler.initShareScopeMap(t, n, r);
|
|
2440
2427
|
}
|
|
2441
2428
|
formatOptions(t, n) {
|
|
2442
|
-
const { shared:
|
|
2429
|
+
const { shared: r } = formatShareConfigs(t, n), { userOptions: s, options: l } = this.hooks.lifecycle.beforeInit.emit({
|
|
2443
2430
|
origin: this,
|
|
2444
2431
|
userOptions: n,
|
|
2445
2432
|
options: t,
|
|
2446
|
-
shareInfo:
|
|
2433
|
+
shareInfo: r
|
|
2447
2434
|
}), a = this.remoteHandler.formatAndRegisterRemote(l, s), { shared: i } = this.sharedHandler.registerShared(l, s), c = [
|
|
2448
2435
|
...l.plugins
|
|
2449
2436
|
];
|
|
@@ -2469,7 +2456,7 @@ class FederationHost {
|
|
|
2469
2456
|
this.loaderHook,
|
|
2470
2457
|
this.bridgeHook
|
|
2471
2458
|
]);
|
|
2472
|
-
this.options.plugins = this.options.plugins.reduce((
|
|
2459
|
+
this.options.plugins = this.options.plugins.reduce((r, s) => (s && r && !r.find((l) => l.name === s.name) && r.push(s), r), n || []);
|
|
2473
2460
|
}
|
|
2474
2461
|
registerRemotes(t, n) {
|
|
2475
2462
|
return this.remoteHandler.registerRemotes(t, n);
|
|
@@ -2482,7 +2469,7 @@ class FederationHost {
|
|
|
2482
2469
|
beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
|
|
2483
2470
|
// maybe will change, temporarily for internal use only
|
|
2484
2471
|
initContainer: new AsyncWaterfallHook("initContainer")
|
|
2485
|
-
}), this.version = "0.6.
|
|
2472
|
+
}), this.version = "0.6.20", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
|
|
2486
2473
|
// FIXME: may not be suitable , not open to the public yet
|
|
2487
2474
|
getModuleInfo: new SyncHook(),
|
|
2488
2475
|
createScript: new SyncHook(),
|
|
@@ -2518,16 +2505,16 @@ function getInstance() {
|
|
|
2518
2505
|
return FederationInstance;
|
|
2519
2506
|
}
|
|
2520
2507
|
setGlobalFederationConstructor(FederationHost);
|
|
2521
|
-
function createBridgeComponent(
|
|
2508
|
+
function createBridgeComponent(o) {
|
|
2522
2509
|
const t = /* @__PURE__ */ new Map(), n = getInstance();
|
|
2523
2510
|
return () => ({
|
|
2524
|
-
__APP_VERSION__: "0.8.
|
|
2525
|
-
async render(
|
|
2511
|
+
__APP_VERSION__: "0.8.12",
|
|
2512
|
+
async render(r) {
|
|
2526
2513
|
var y, _, E;
|
|
2527
|
-
LoggerInstance.debug("createBridgeComponent render Info",
|
|
2528
|
-
const { moduleName: s, dom: l, basename: a, memoryRoute: i, ...c } =
|
|
2529
|
-
t.set(
|
|
2530
|
-
const d = await ((E = (_ = (y = n == null ? void 0 : n.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : _.beforeBridgeRender) == null ? void 0 : E.emit(
|
|
2514
|
+
LoggerInstance.debug("createBridgeComponent render Info", r);
|
|
2515
|
+
const { moduleName: s, dom: l, basename: a, memoryRoute: i, ...c } = r, u = Vue.createApp(o.rootComponent, c);
|
|
2516
|
+
t.set(r.dom, u);
|
|
2517
|
+
const d = await ((E = (_ = (y = n == null ? void 0 : n.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : _.beforeBridgeRender) == null ? void 0 : E.emit(r)), p = d && typeof d == "object" && (d != null && d.extraProps) ? d == null ? void 0 : d.extraProps : {}, m = o.appOptions({
|
|
2531
2518
|
app: u,
|
|
2532
2519
|
basename: a,
|
|
2533
2520
|
memoryRoute: i,
|
|
@@ -2535,28 +2522,28 @@ function createBridgeComponent(r) {
|
|
|
2535
2522
|
...p
|
|
2536
2523
|
});
|
|
2537
2524
|
if (m != null && m.router) {
|
|
2538
|
-
const g =
|
|
2525
|
+
const g = r.memoryRoute ? VueRouter.createMemoryHistory(r.basename) : VueRouter.createWebHistory(r.basename), b = VueRouter.createRouter({
|
|
2539
2526
|
...m.router.options,
|
|
2540
2527
|
history: g,
|
|
2541
2528
|
routes: m.router.getRoutes()
|
|
2542
2529
|
});
|
|
2543
2530
|
LoggerInstance.log("createBridgeComponent render router info>>>", {
|
|
2544
|
-
name:
|
|
2531
|
+
name: r.moduleName,
|
|
2545
2532
|
router: b
|
|
2546
|
-
}),
|
|
2533
|
+
}), r.memoryRoute && await b.push(r.memoryRoute.entryPath), u.use(b);
|
|
2547
2534
|
}
|
|
2548
|
-
u.mount(
|
|
2535
|
+
u.mount(r.dom);
|
|
2549
2536
|
},
|
|
2550
|
-
destroy(
|
|
2551
|
-
LoggerInstance.debug("createBridgeComponent destroy Info",
|
|
2552
|
-
const s = t.get(
|
|
2537
|
+
destroy(r) {
|
|
2538
|
+
LoggerInstance.debug("createBridgeComponent destroy Info", r);
|
|
2539
|
+
const s = t.get(r == null ? void 0 : r.dom);
|
|
2553
2540
|
s == null || s.unmount();
|
|
2554
2541
|
}
|
|
2555
2542
|
});
|
|
2556
2543
|
}
|
|
2557
2544
|
function e() {
|
|
2558
|
-
const
|
|
2559
|
-
window.dispatchEvent(
|
|
2545
|
+
const o = new PopStateEvent("popstate", { state: window.history.state });
|
|
2546
|
+
window.dispatchEvent(o);
|
|
2560
2547
|
}
|
|
2561
2548
|
const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
2562
2549
|
name: "RemoteApp",
|
|
@@ -2566,33 +2553,33 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2566
2553
|
memoryRoute: Object,
|
|
2567
2554
|
providerInfo: Function
|
|
2568
2555
|
},
|
|
2569
|
-
setup(
|
|
2570
|
-
const t = ref(null), n = ref(null),
|
|
2556
|
+
setup(o) {
|
|
2557
|
+
const t = ref(null), n = ref(null), r = ref(""), s = useRoute(), l = () => {
|
|
2571
2558
|
var d;
|
|
2572
|
-
const i = (d =
|
|
2559
|
+
const i = (d = o.providerInfo) == null ? void 0 : d.call(o);
|
|
2573
2560
|
n.value = i;
|
|
2574
2561
|
let c = {
|
|
2575
|
-
name:
|
|
2562
|
+
name: o.moduleName,
|
|
2576
2563
|
dom: t.value,
|
|
2577
|
-
basename:
|
|
2578
|
-
memoryRoute:
|
|
2564
|
+
basename: o.basename,
|
|
2565
|
+
memoryRoute: o.memoryRoute
|
|
2579
2566
|
};
|
|
2580
2567
|
LoggerInstance.debug("createRemoteComponent LazyComponent render >>>", c), c = {
|
|
2581
2568
|
...c,
|
|
2582
2569
|
...{}.extraProps
|
|
2583
2570
|
}, i.render(c);
|
|
2584
2571
|
}, a = watch(() => s.path, (i) => {
|
|
2585
|
-
i !== s.path && l(),
|
|
2586
|
-
...
|
|
2572
|
+
i !== s.path && l(), r.value !== "" && r.value !== i && (LoggerInstance.debug("createRemoteComponent dispatchPopstateEnv >>>", {
|
|
2573
|
+
...o,
|
|
2587
2574
|
pathname: s.path
|
|
2588
|
-
}), e()),
|
|
2575
|
+
}), e()), r.value = i;
|
|
2589
2576
|
});
|
|
2590
2577
|
return onMounted(() => {
|
|
2591
2578
|
l();
|
|
2592
2579
|
}), onBeforeUnmount(() => {
|
|
2593
2580
|
var i;
|
|
2594
2581
|
LoggerInstance.debug("createRemoteComponent LazyComponent destroy >>>", {
|
|
2595
|
-
...
|
|
2582
|
+
...o
|
|
2596
2583
|
}), a(), (i = n.value) == null || i.destroy({
|
|
2597
2584
|
dom: t.value
|
|
2598
2585
|
});
|
|
@@ -2601,23 +2588,23 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
|
|
|
2601
2588
|
}, null);
|
|
2602
2589
|
}
|
|
2603
2590
|
});
|
|
2604
|
-
function createRemoteComponent(
|
|
2591
|
+
function createRemoteComponent(o) {
|
|
2605
2592
|
return defineAsyncComponent({
|
|
2606
|
-
__APP_VERSION__: "0.8.
|
|
2607
|
-
...
|
|
2593
|
+
__APP_VERSION__: "0.8.12",
|
|
2594
|
+
...o.asyncComponentOptions,
|
|
2608
2595
|
//@ts-ignore
|
|
2609
2596
|
loader: async () => {
|
|
2610
2597
|
var c;
|
|
2611
2598
|
const t = useRoute();
|
|
2612
2599
|
let n = "/";
|
|
2613
|
-
const
|
|
2614
|
-
|
|
2615
|
-
const s = (
|
|
2600
|
+
const r = (c = t.matched[0]) == null ? void 0 : c.path;
|
|
2601
|
+
r && (r.endsWith("/:pathMatch(.*)*") ? n = r.replace("/:pathMatch(.*)*", "") : n = t.matched[0].path);
|
|
2602
|
+
const s = (o == null ? void 0 : o.export) || "default";
|
|
2616
2603
|
LoggerInstance.debug("createRemoteComponent LazyComponent create >>>", {
|
|
2617
2604
|
basename: n,
|
|
2618
|
-
info:
|
|
2605
|
+
info: o
|
|
2619
2606
|
});
|
|
2620
|
-
const l = await
|
|
2607
|
+
const l = await o.loader(), a = l && l[Symbol.for("mf_module_id")], i = l[s];
|
|
2621
2608
|
if (LoggerInstance.debug(
|
|
2622
2609
|
"createRemoteComponent LazyComponent loadRemote info >>>",
|
|
2623
2610
|
{ name: a, module: l, exportName: s, basename: n, route: t }
|