@module-federation/bridge-vue3 2.6.0 → 2.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/create.d.ts +28 -0
- package/dist/index.cjs +6 -6
- package/dist/index.d.ts +4 -68
- package/dist/index.js +1061 -969
- package/dist/provider.d.ts +27 -0
- package/dist/remoteApp.d.ts +18 -0
- package/dist/routeUtils.d.ts +21 -0
- package/dist/utils.d.ts +1 -0
- package/package.json +9 -8
package/dist/index.js
CHANGED
|
@@ -1,47 +1,47 @@
|
|
|
1
|
-
import * as
|
|
2
|
-
import { defineComponent as
|
|
3
|
-
import * as
|
|
4
|
-
import { useRoute as
|
|
5
|
-
const
|
|
6
|
-
let
|
|
1
|
+
import * as Zt from "vue";
|
|
2
|
+
import { defineComponent as Xt, ref as V, useAttrs as Yt, watch as Qt, onMounted as er, onActivated as tr, nextTick as rr, onDeactivated as or, onBeforeUnmount as nr, createVNode as sr, mergeProps as ir, defineAsyncComponent as ar, h as cr } from "vue";
|
|
3
|
+
import * as fe from "vue-router";
|
|
4
|
+
import { useRoute as rt } from "vue-router";
|
|
5
|
+
const lr = ".json", ur = "FEDERATION_DEBUG", hr = ":";
|
|
6
|
+
let Ne = /* @__PURE__ */ function(e) {
|
|
7
7
|
return e[e.UNKNOWN = 1] = "UNKNOWN", e[e.CALCULATED = 2] = "CALCULATED", e[e.NO_USE = 0] = "NO_USE", e;
|
|
8
8
|
}({});
|
|
9
|
-
const
|
|
10
|
-
function
|
|
11
|
-
return
|
|
9
|
+
const G = typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : typeof window < "u" && typeof window.document < "u";
|
|
10
|
+
function ot() {
|
|
11
|
+
return G;
|
|
12
12
|
}
|
|
13
|
-
function
|
|
13
|
+
function nt() {
|
|
14
14
|
return typeof navigator < "u" && (navigator == null ? void 0 : navigator.product) === "ReactNative";
|
|
15
15
|
}
|
|
16
|
-
function
|
|
16
|
+
function fr() {
|
|
17
17
|
try {
|
|
18
|
-
if (
|
|
18
|
+
if (ot() && window.localStorage) return !!localStorage.getItem(ur);
|
|
19
19
|
} catch {
|
|
20
20
|
return !1;
|
|
21
21
|
}
|
|
22
22
|
return !1;
|
|
23
23
|
}
|
|
24
|
-
function
|
|
25
|
-
return typeof process < "u" && process.env && process.env.FEDERATION_DEBUG ? !!process.env.FEDERATION_DEBUG : typeof FEDERATION_DEBUG < "u" && FEDERATION_DEBUG ? !0 :
|
|
24
|
+
function Ae() {
|
|
25
|
+
return typeof process < "u" && process.env && process.env.FEDERATION_DEBUG ? !!process.env.FEDERATION_DEBUG : typeof FEDERATION_DEBUG < "u" && FEDERATION_DEBUG ? !0 : fr();
|
|
26
26
|
}
|
|
27
|
-
const
|
|
28
|
-
return e.length ? e.reduce((t, r) => r ? t ? `${t}${
|
|
29
|
-
},
|
|
27
|
+
const dr = "[ Federation Runtime ]", st = function(...e) {
|
|
28
|
+
return e.length ? e.reduce((t, r) => r ? t ? `${t}${hr}${r}` : r : t, "") : "";
|
|
29
|
+
}, Me = (e, t) => {
|
|
30
30
|
if ("getPublicPath" in e) {
|
|
31
31
|
let r;
|
|
32
32
|
return e.getPublicPath.startsWith("function") ? r = new Function("return " + e.getPublicPath)()() : r = new Function(e.getPublicPath)(), `${r}${t}`;
|
|
33
|
-
} else return "publicPath" in e ? !
|
|
34
|
-
},
|
|
35
|
-
console.warn(`${
|
|
33
|
+
} else return "publicPath" in e ? !ot() && !nt() && "ssrPublicPath" in e && typeof e.ssrPublicPath == "string" ? `${e.ssrPublicPath}${t}` : `${e.publicPath}${t}` : (console.warn("Cannot get resource URL. If in debug mode, please ignore.", e, t), "");
|
|
34
|
+
}, it = (e) => {
|
|
35
|
+
console.warn(`${dr}: ${e}`);
|
|
36
36
|
};
|
|
37
|
-
function
|
|
37
|
+
function at(e) {
|
|
38
38
|
try {
|
|
39
39
|
return JSON.stringify(e, null, 2);
|
|
40
40
|
} catch {
|
|
41
41
|
return "";
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
const
|
|
44
|
+
const be = (e, t) => {
|
|
45
45
|
if (!e) return t;
|
|
46
46
|
const o = ((n) => {
|
|
47
47
|
if (n === ".") return "";
|
|
@@ -54,36 +54,36 @@ const Re = (e, t) => {
|
|
|
54
54
|
})(e);
|
|
55
55
|
return o ? o.endsWith("/") ? `${o}${t}` : `${o}/${t}` : t;
|
|
56
56
|
};
|
|
57
|
-
function
|
|
57
|
+
function mr(e) {
|
|
58
58
|
return e.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
var
|
|
60
|
+
function pr(e, t = {}) {
|
|
61
|
+
var R;
|
|
62
62
|
const { remotes: r = {}, overrides: o = {}, version: n } = t;
|
|
63
63
|
let s;
|
|
64
|
-
const
|
|
65
|
-
let
|
|
66
|
-
Object.keys(r).length || (
|
|
67
|
-
let
|
|
68
|
-
const
|
|
69
|
-
return c.includes(
|
|
70
|
-
}, {})) || {}), Object.keys(r).forEach((g) =>
|
|
71
|
-
const { remoteEntry: { path: l, name: u, type:
|
|
64
|
+
const i = () => "publicPath" in e.metaData ? (e.metaData.publicPath === "auto" || e.metaData.publicPath === "") && n ? mr(n) : e.metaData.publicPath : e.metaData.getPublicPath, c = Object.keys(o);
|
|
65
|
+
let a = {};
|
|
66
|
+
Object.keys(r).length || (a = ((R = e.remotes) == null ? void 0 : R.reduce((g, _) => {
|
|
67
|
+
let S;
|
|
68
|
+
const I = _.federationContainerName;
|
|
69
|
+
return c.includes(I) ? S = o[I] : "version" in _ ? S = _.version : S = _.entry, g[I] = { matchedVersion: S }, g;
|
|
70
|
+
}, {})) || {}), Object.keys(r).forEach((g) => a[g] = { matchedVersion: c.includes(g) ? o[g] : r[g] });
|
|
71
|
+
const { remoteEntry: { path: l, name: u, type: h }, types: m = {
|
|
72
72
|
path: "",
|
|
73
73
|
name: "",
|
|
74
74
|
zip: "",
|
|
75
75
|
api: ""
|
|
76
|
-
}, buildInfo: { buildVersion:
|
|
76
|
+
}, buildInfo: { buildVersion: f }, globalName: d, ssrRemoteEntry: p } = e.metaData, { exposes: E } = e;
|
|
77
77
|
let y = {
|
|
78
78
|
version: n || "",
|
|
79
|
-
buildVersion:
|
|
79
|
+
buildVersion: f,
|
|
80
80
|
globalName: d,
|
|
81
|
-
remoteEntry:
|
|
82
|
-
remoteEntryType:
|
|
83
|
-
remoteTypes:
|
|
81
|
+
remoteEntry: be(l, u),
|
|
82
|
+
remoteEntryType: h,
|
|
83
|
+
remoteTypes: be(m.path, m.name),
|
|
84
84
|
remoteTypesZip: m.zip || "",
|
|
85
85
|
remoteTypesAPI: m.api || "",
|
|
86
|
-
remotesInfo:
|
|
86
|
+
remotesInfo: a,
|
|
87
87
|
shared: e == null ? void 0 : e.shared.map((g) => ({
|
|
88
88
|
assets: g.assets,
|
|
89
89
|
sharedName: g.name,
|
|
@@ -98,20 +98,20 @@ function ur(e, t = {}) {
|
|
|
98
98
|
};
|
|
99
99
|
if ("publicPath" in e.metaData ? (s = {
|
|
100
100
|
...y,
|
|
101
|
-
publicPath:
|
|
101
|
+
publicPath: i()
|
|
102
102
|
}, typeof e.metaData.ssrPublicPath == "string" && (s.ssrPublicPath = e.metaData.ssrPublicPath)) : s = {
|
|
103
103
|
...y,
|
|
104
|
-
getPublicPath:
|
|
104
|
+
getPublicPath: i()
|
|
105
105
|
}, p) {
|
|
106
|
-
const g =
|
|
106
|
+
const g = be(p.path, p.name);
|
|
107
107
|
s.ssrRemoteEntry = g, s.ssrRemoteEntryType = p.type || "commonjs-module";
|
|
108
108
|
}
|
|
109
109
|
return s;
|
|
110
110
|
}
|
|
111
|
-
function
|
|
112
|
-
return !!("remoteEntry" in e && e.remoteEntry.includes(
|
|
111
|
+
function ct(e) {
|
|
112
|
+
return !!("remoteEntry" in e && e.remoteEntry.includes(lr));
|
|
113
113
|
}
|
|
114
|
-
const
|
|
114
|
+
const yr = "[ Module Federation ]", Q = console, Er = [
|
|
115
115
|
"logger.ts",
|
|
116
116
|
"logger.js",
|
|
117
117
|
"captureStackTrace",
|
|
@@ -122,12 +122,12 @@ const fr = "[ Module Federation ]", Z = console, hr = [
|
|
|
122
122
|
"Logger.error",
|
|
123
123
|
"Logger.debug"
|
|
124
124
|
];
|
|
125
|
-
function
|
|
125
|
+
function gr() {
|
|
126
126
|
try {
|
|
127
127
|
const e = (/* @__PURE__ */ new Error()).stack;
|
|
128
128
|
if (!e) return;
|
|
129
129
|
const [, ...t] = e.split(`
|
|
130
|
-
`), r = t.filter((o) => !
|
|
130
|
+
`), r = t.filter((o) => !Er.some((n) => o.includes(n)));
|
|
131
131
|
return r.length ? `Stack trace:
|
|
132
132
|
${r.slice(0, 5).join(`
|
|
133
133
|
`)}` : void 0;
|
|
@@ -135,18 +135,18 @@ ${r.slice(0, 5).join(`
|
|
|
135
135
|
return;
|
|
136
136
|
}
|
|
137
137
|
}
|
|
138
|
-
var
|
|
139
|
-
constructor(e, t =
|
|
140
|
-
this.prefix = e, this.delegate = t ??
|
|
138
|
+
var lt = class {
|
|
139
|
+
constructor(e, t = Q) {
|
|
140
|
+
this.prefix = e, this.delegate = t ?? Q;
|
|
141
141
|
}
|
|
142
142
|
setPrefix(e) {
|
|
143
143
|
this.prefix = e;
|
|
144
144
|
}
|
|
145
145
|
setDelegate(e) {
|
|
146
|
-
this.delegate = e ??
|
|
146
|
+
this.delegate = e ?? Q;
|
|
147
147
|
}
|
|
148
148
|
emit(e, t) {
|
|
149
|
-
const r = this.delegate, o =
|
|
149
|
+
const r = this.delegate, o = Ae() ? gr() : void 0, n = o ? [...t, o] : t, s = (() => {
|
|
150
150
|
switch (e) {
|
|
151
151
|
case "log":
|
|
152
152
|
return ["log", "info"];
|
|
@@ -168,17 +168,17 @@ var st = class {
|
|
|
168
168
|
return ["debug", "log"];
|
|
169
169
|
}
|
|
170
170
|
})();
|
|
171
|
-
for (const
|
|
172
|
-
const c = r[
|
|
171
|
+
for (const i of s) {
|
|
172
|
+
const c = r[i];
|
|
173
173
|
if (typeof c == "function") {
|
|
174
174
|
c.call(r, this.prefix, ...n);
|
|
175
175
|
return;
|
|
176
176
|
}
|
|
177
177
|
}
|
|
178
|
-
for (const
|
|
179
|
-
const c =
|
|
178
|
+
for (const i of s) {
|
|
179
|
+
const c = Q[i];
|
|
180
180
|
if (typeof c == "function") {
|
|
181
|
-
c.call(
|
|
181
|
+
c.call(Q, this.prefix, ...n);
|
|
182
182
|
return;
|
|
183
183
|
}
|
|
184
184
|
}
|
|
@@ -202,39 +202,39 @@ var st = class {
|
|
|
202
202
|
this.emit("info", e);
|
|
203
203
|
}
|
|
204
204
|
debug(...e) {
|
|
205
|
-
|
|
205
|
+
Ae() && this.emit("debug", e);
|
|
206
206
|
}
|
|
207
207
|
};
|
|
208
|
-
function
|
|
209
|
-
return new
|
|
208
|
+
function ut(e) {
|
|
209
|
+
return new lt(e);
|
|
210
210
|
}
|
|
211
|
-
function
|
|
212
|
-
const t = new
|
|
211
|
+
function Rr(e) {
|
|
212
|
+
const t = new lt(e);
|
|
213
213
|
return Object.defineProperty(t, "__mf_infrastructure_logger__", {
|
|
214
214
|
value: !0,
|
|
215
215
|
enumerable: !1,
|
|
216
216
|
configurable: !1
|
|
217
217
|
}), t;
|
|
218
218
|
}
|
|
219
|
-
|
|
220
|
-
async function
|
|
219
|
+
Rr(yr);
|
|
220
|
+
async function ht(e, t) {
|
|
221
221
|
try {
|
|
222
222
|
return await e();
|
|
223
223
|
} catch (r) {
|
|
224
|
-
|
|
224
|
+
it(r);
|
|
225
225
|
return;
|
|
226
226
|
}
|
|
227
227
|
}
|
|
228
|
-
function
|
|
228
|
+
function Pe(e, t) {
|
|
229
229
|
const r = /^(https?:)?\/\//i;
|
|
230
230
|
return e.replace(r, "").replace(/\/$/, "") === t.replace(r, "").replace(/\/$/, "");
|
|
231
231
|
}
|
|
232
|
-
function
|
|
232
|
+
function ft(e) {
|
|
233
233
|
let t = null, r = !0, o = 2e4, n;
|
|
234
234
|
const s = document.getElementsByTagName("script");
|
|
235
235
|
for (let l = 0; l < s.length; l++) {
|
|
236
|
-
const u = s[l],
|
|
237
|
-
if (
|
|
236
|
+
const u = s[l], h = u.getAttribute("src");
|
|
237
|
+
if (h && Pe(h, e.url)) {
|
|
238
238
|
t = u, r = !1;
|
|
239
239
|
break;
|
|
240
240
|
}
|
|
@@ -243,41 +243,41 @@ function ct(e) {
|
|
|
243
243
|
const l = e.attrs;
|
|
244
244
|
t = document.createElement("script"), t.type = (l == null ? void 0 : l.type) === "module" ? "module" : "text/javascript";
|
|
245
245
|
let u;
|
|
246
|
-
e.createScriptHook && (u = e.createScriptHook(e.url, e.attrs), u instanceof HTMLScriptElement ? t = u : typeof u == "object" && ("script" in u && u.script && (t = u.script), "timeout" in u && u.timeout && (o = u.timeout))), t.src || (t.src = e.url), l && !u && Object.keys(l).forEach((
|
|
247
|
-
t && (
|
|
246
|
+
e.createScriptHook && (u = e.createScriptHook(e.url, e.attrs), u instanceof HTMLScriptElement ? t = u : typeof u == "object" && ("script" in u && u.script && (t = u.script), "timeout" in u && u.timeout && (o = u.timeout))), t.src || (t.src = e.url), l && !u && Object.keys(l).forEach((h) => {
|
|
247
|
+
t && (h === "async" || h === "defer" ? t[h] = l[h] : t.getAttribute(h) || t.setAttribute(h, l[h]));
|
|
248
248
|
});
|
|
249
249
|
}
|
|
250
|
-
let
|
|
250
|
+
let i = null;
|
|
251
251
|
const c = typeof window < "u" ? (l) => {
|
|
252
|
-
if (l.filename &&
|
|
252
|
+
if (l.filename && Pe(l.filename, e.url)) {
|
|
253
253
|
const u = /* @__PURE__ */ new Error(`ScriptExecutionError: Script "${e.url}" loaded but threw a runtime error during execution: ${l.message} (${l.filename}:${l.lineno}:${l.colno})`);
|
|
254
|
-
u.name = "ScriptExecutionError",
|
|
254
|
+
u.name = "ScriptExecutionError", i = u;
|
|
255
255
|
}
|
|
256
256
|
} : null;
|
|
257
257
|
c && window.addEventListener("error", c);
|
|
258
|
-
const
|
|
258
|
+
const a = async (l, u) => {
|
|
259
259
|
clearTimeout(n), c && window.removeEventListener("error", c);
|
|
260
|
-
const
|
|
260
|
+
const h = () => {
|
|
261
261
|
if ((u == null ? void 0 : u.type) === "error") {
|
|
262
262
|
const m = /* @__PURE__ */ new Error(u != null && u.isTimeout ? `ScriptNetworkError: Script "${e.url}" timed out.` : `ScriptNetworkError: Failed to load script "${e.url}" - the script URL is unreachable or the server returned an error (network failure, 404, CORS, etc.)`);
|
|
263
263
|
m.name = "ScriptNetworkError", e != null && e.onErrorCallback && (e == null || e.onErrorCallback(m));
|
|
264
|
-
} else
|
|
264
|
+
} else i ? e != null && e.onErrorCallback && (e == null || e.onErrorCallback(i)) : e != null && e.cb && (e == null || e.cb());
|
|
265
265
|
};
|
|
266
|
-
if (t && (t.onerror = null, t.onload = null,
|
|
266
|
+
if (t && (t.onerror = null, t.onload = null, ht(() => {
|
|
267
267
|
const { needDeleteScript: m = !0 } = e;
|
|
268
268
|
m && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
269
269
|
}), l && typeof l == "function")) {
|
|
270
270
|
const m = l(u);
|
|
271
271
|
if (m instanceof Promise) {
|
|
272
|
-
const
|
|
273
|
-
return
|
|
272
|
+
const f = await m;
|
|
273
|
+
return h(), f;
|
|
274
274
|
}
|
|
275
|
-
return
|
|
275
|
+
return h(), m;
|
|
276
276
|
}
|
|
277
|
-
|
|
277
|
+
h();
|
|
278
278
|
};
|
|
279
|
-
return t.onerror =
|
|
280
|
-
|
|
279
|
+
return t.onerror = a.bind(null, t.onerror), t.onload = a.bind(null, t.onload), n = setTimeout(() => {
|
|
280
|
+
a(null, {
|
|
281
281
|
type: "error",
|
|
282
282
|
isTimeout: !0
|
|
283
283
|
});
|
|
@@ -286,21 +286,21 @@ function ct(e) {
|
|
|
286
286
|
needAttach: r
|
|
287
287
|
};
|
|
288
288
|
}
|
|
289
|
-
function
|
|
289
|
+
function _r(e) {
|
|
290
290
|
let t = null, r = !0, o = 2e4, n;
|
|
291
291
|
const s = document.getElementsByTagName("link");
|
|
292
292
|
for (let c = 0; c < s.length; c++) {
|
|
293
|
-
const
|
|
294
|
-
if (l &&
|
|
295
|
-
t =
|
|
293
|
+
const a = s[c], l = a.getAttribute("href"), u = a.getAttribute("rel");
|
|
294
|
+
if (l && Pe(l, e.url) && u === e.attrs.rel) {
|
|
295
|
+
t = a, r = !1;
|
|
296
296
|
break;
|
|
297
297
|
}
|
|
298
298
|
}
|
|
299
299
|
if (!t) {
|
|
300
300
|
t = document.createElement("link"), t.setAttribute("href", e.url);
|
|
301
|
-
let c,
|
|
301
|
+
let c, a = !0;
|
|
302
302
|
const l = e.attrs;
|
|
303
|
-
e.createLinkHook && (c = e.createLinkHook(e.url, l), c instanceof HTMLLinkElement ? (t = c,
|
|
303
|
+
e.createLinkHook && (c = e.createLinkHook(e.url, l), c instanceof HTMLLinkElement ? (t = c, a = !1) : typeof c == "object" && ("link" in c && c.link && (t = c.link, a = !1), "timeout" in c && c.timeout && (o = c.timeout))), l && a && Object.keys(l).forEach((u) => {
|
|
304
304
|
t && !t.getAttribute(u) && t.setAttribute(u, l[u]);
|
|
305
305
|
});
|
|
306
306
|
}
|
|
@@ -311,25 +311,25 @@ function pr(e) {
|
|
|
311
311
|
link: t,
|
|
312
312
|
needAttach: r
|
|
313
313
|
};
|
|
314
|
-
const
|
|
314
|
+
const i = (c, a) => {
|
|
315
315
|
n && clearTimeout(n);
|
|
316
316
|
const l = () => {
|
|
317
|
-
if ((
|
|
318
|
-
const u = /* @__PURE__ */ new Error(
|
|
317
|
+
if ((a == null ? void 0 : a.type) === "error") {
|
|
318
|
+
const u = /* @__PURE__ */ new Error(a != null && a.isTimeout ? `LinkNetworkError: Link "${e.url}" timed out.` : `LinkNetworkError: Failed to load link "${e.url}" - the URL is unreachable or the server returned an error.`);
|
|
319
319
|
u.name = "LinkNetworkError", e != null && e.onErrorCallback && (e == null || e.onErrorCallback(u));
|
|
320
320
|
} else e != null && e.cb && (e == null || e.cb());
|
|
321
321
|
};
|
|
322
|
-
if (t && (t.onerror = null, t.onload = null,
|
|
322
|
+
if (t && (t.onerror = null, t.onload = null, ht(() => {
|
|
323
323
|
const { needDeleteLink: u = !0 } = e;
|
|
324
324
|
u && t != null && t.parentNode && t.parentNode.removeChild(t);
|
|
325
325
|
}), c)) {
|
|
326
|
-
const u = c(
|
|
326
|
+
const u = c(a);
|
|
327
327
|
return l(), u;
|
|
328
328
|
}
|
|
329
329
|
l();
|
|
330
330
|
};
|
|
331
|
-
return t.onerror =
|
|
332
|
-
|
|
331
|
+
return t.onerror = i.bind(null, t.onerror), t.onload = i.bind(null, t.onload), n = setTimeout(() => {
|
|
332
|
+
i(null, {
|
|
333
333
|
type: "error",
|
|
334
334
|
isTimeout: !0
|
|
335
335
|
});
|
|
@@ -338,10 +338,10 @@ function pr(e) {
|
|
|
338
338
|
needAttach: r
|
|
339
339
|
};
|
|
340
340
|
}
|
|
341
|
-
function
|
|
341
|
+
function Sr(e, t) {
|
|
342
342
|
const { attrs: r = {}, createScriptHook: o } = t;
|
|
343
343
|
return new Promise((n, s) => {
|
|
344
|
-
const { script:
|
|
344
|
+
const { script: i, needAttach: c } = ft({
|
|
345
345
|
url: e,
|
|
346
346
|
cb: n,
|
|
347
347
|
onErrorCallback: s,
|
|
@@ -352,25 +352,22 @@ function yr(e, t) {
|
|
|
352
352
|
createScriptHook: o,
|
|
353
353
|
needDeleteScript: !0
|
|
354
354
|
});
|
|
355
|
-
c && document.head.appendChild(
|
|
355
|
+
c && document.head.appendChild(i);
|
|
356
356
|
});
|
|
357
357
|
}
|
|
358
|
-
const
|
|
359
|
-
function
|
|
358
|
+
const le = /* @__PURE__ */ new Map();
|
|
359
|
+
function x(e) {
|
|
360
360
|
if (!e) throw new Error("import specifier is required");
|
|
361
|
-
if (
|
|
361
|
+
if (le.has(e)) return le.get(e);
|
|
362
362
|
const t = new Function("name", "return import(name)")(e).then((r) => r).catch((r) => {
|
|
363
|
-
throw console.error(`Error importing module ${e}:`, r),
|
|
363
|
+
throw console.error(`Error importing module ${e}:`, r), le.delete(e), r;
|
|
364
364
|
});
|
|
365
|
-
return
|
|
366
|
-
}
|
|
367
|
-
const
|
|
368
|
-
const
|
|
369
|
-
return e
|
|
370
|
-
},
|
|
371
|
-
const n = await ((s, a) => r.lifecycle.fetch.emit(s, a))(e, t || {});
|
|
372
|
-
return !n || !(n instanceof Response) ? (typeof fetch > "u" ? await lt() : fetch)(e, t || {}) : n;
|
|
373
|
-
}, gr = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (e, t, r, o) => {
|
|
365
|
+
return le.set(e, t), t;
|
|
366
|
+
}
|
|
367
|
+
const br = async (e, t, r) => {
|
|
368
|
+
const n = await ((s, i) => r.lifecycle.fetch.emit(s, i))(e, t || {});
|
|
369
|
+
return !n || !(n instanceof Response) ? fetch(e, t || {}) : n;
|
|
370
|
+
}, wr = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (e, t, r, o) => {
|
|
374
371
|
if (o != null && o.createScriptHook) {
|
|
375
372
|
const c = o.createScriptHook(e);
|
|
376
373
|
c && typeof c == "object" && "url" in c && (e = c.url);
|
|
@@ -382,19 +379,19 @@ const lt = async () => {
|
|
|
382
379
|
console.error("Error constructing URL:", c), t(/* @__PURE__ */ new Error(`Invalid URL: ${c}`));
|
|
383
380
|
return;
|
|
384
381
|
}
|
|
385
|
-
const s = async () => o != null && o.fetch ? (c,
|
|
382
|
+
const s = async () => o != null && o.fetch ? (c, a) => br(c, a, o) : fetch, i = async (c, a) => {
|
|
386
383
|
var l;
|
|
387
384
|
try {
|
|
388
|
-
const
|
|
385
|
+
const h = await (await c(a.href)).text(), [m, f] = await Promise.all([x("path"), x("vm")]), d = {
|
|
389
386
|
exports: {},
|
|
390
387
|
module: { exports: {} }
|
|
391
|
-
}, p =
|
|
388
|
+
}, p = a.pathname.split("/").slice(0, -1).join("/"), E = m.basename(a.pathname), y = new f.Script(`(function(exports, module, require, __dirname, __filename) {${h}
|
|
392
389
|
})`, {
|
|
393
390
|
filename: E,
|
|
394
|
-
importModuleDynamically: ((l =
|
|
391
|
+
importModuleDynamically: ((l = f.constants) == null ? void 0 : l.USE_MAIN_CONTEXT_DEFAULT_LOADER) ?? x
|
|
395
392
|
});
|
|
396
|
-
let
|
|
397
|
-
|
|
393
|
+
let R;
|
|
394
|
+
R = (await x("node:module")).createRequire(a.protocol === "file:" || a.protocol === "node:" ? a.href : m.join(process.cwd(), "__mf_require_base__.js")), y.runInThisContext()(d.exports, d.module, R, p, E);
|
|
398
395
|
const g = d.module.exports || d.exports;
|
|
399
396
|
if (r && g && r.globalName) {
|
|
400
397
|
t(void 0, g[r.globalName] || g);
|
|
@@ -406,95 +403,136 @@ const lt = async () => {
|
|
|
406
403
|
}
|
|
407
404
|
};
|
|
408
405
|
s().then(async (c) => {
|
|
409
|
-
if ((r == null ? void 0 : r.type) === "esm" || (r == null ? void 0 : r.type) === "module") return
|
|
406
|
+
if ((r == null ? void 0 : r.type) === "esm" || (r == null ? void 0 : r.type) === "module") return pt(n.href, {
|
|
410
407
|
fetch: c,
|
|
411
|
-
vm: await
|
|
412
|
-
}).then(async (
|
|
413
|
-
await
|
|
414
|
-
}).catch((
|
|
415
|
-
t(
|
|
408
|
+
vm: await x("vm")
|
|
409
|
+
}).then(async (a) => {
|
|
410
|
+
await a.evaluate(), t(void 0, a.namespace);
|
|
411
|
+
}).catch((a) => {
|
|
412
|
+
t(a instanceof Error ? a : /* @__PURE__ */ new Error(`Script execution error: ${a}`));
|
|
416
413
|
});
|
|
417
|
-
|
|
414
|
+
i(c, n);
|
|
418
415
|
}).catch((c) => {
|
|
419
416
|
t(c);
|
|
420
417
|
});
|
|
421
418
|
} : (e, t, r, o) => {
|
|
422
419
|
t(/* @__PURE__ */ new Error("createScriptNode is disabled in non-Node.js environment"));
|
|
423
|
-
},
|
|
424
|
-
|
|
425
|
-
var
|
|
420
|
+
}, Ir = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (e, t) => new Promise((r, o) => {
|
|
421
|
+
wr(e, (n, s) => {
|
|
422
|
+
var i, c;
|
|
426
423
|
if (n) o(n);
|
|
427
424
|
else {
|
|
428
|
-
const
|
|
429
|
-
r(globalThis[
|
|
425
|
+
const a = ((i = t == null ? void 0 : t.attrs) == null ? void 0 : i.globalName) || `__FEDERATION_${(c = t == null ? void 0 : t.attrs) == null ? void 0 : c.name}:custom__`;
|
|
426
|
+
r(globalThis[a] = s);
|
|
430
427
|
}
|
|
431
428
|
}, t.attrs, t.loaderHook);
|
|
432
429
|
}) : (e, t) => {
|
|
433
430
|
throw new Error("loadScriptNode is disabled in non-Node.js environment");
|
|
434
|
-
},
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
439
|
-
|
|
440
|
-
|
|
441
|
-
return
|
|
442
|
-
|
|
443
|
-
|
|
444
|
-
|
|
445
|
-
}
|
|
446
|
-
|
|
431
|
+
}, Z = /* @__PURE__ */ new Map(), dt = (e) => e.startsWith("http:") || e.startsWith("https:"), mt = (e) => !e.startsWith("./") && !e.startsWith("../") && !e.startsWith("/") && !e.includes(":");
|
|
432
|
+
function $r(e) {
|
|
433
|
+
const t = new URL(e), r = encodeURIComponent(t.protocol.slice(0, -1)), o = encodeURIComponent(t.host), n = t.pathname.split("/").map((i) => encodeURIComponent(i)).join("/"), s = encodeURIComponent(`${t.search}${t.hash}`);
|
|
434
|
+
return `/${r}/${o}${n}${s ? `/${s}` : ""}`;
|
|
435
|
+
}
|
|
436
|
+
function Tr(e, t) {
|
|
437
|
+
const r = t.endsWith("/") ? t : `${t}/`;
|
|
438
|
+
return new URL(`__module_federation_remote__${$r(e)}`, r).href;
|
|
439
|
+
}
|
|
440
|
+
async function vr(e) {
|
|
441
|
+
return e.startsWith("node:") ? !0 : mt(e) ? (await x("node:module")).builtinModules.includes(e) : !1;
|
|
442
|
+
}
|
|
443
|
+
function Nr(e) {
|
|
444
|
+
const t = e && (typeof e == "object" || typeof e == "function") ? e : { default: e }, r = { ...t };
|
|
445
|
+
return Object.prototype.hasOwnProperty.call(r, "default") || (r.default = t), r;
|
|
446
|
+
}
|
|
447
|
+
async function Ar(e, t, r) {
|
|
448
|
+
if (typeof r.SyntheticModule != "function") throw new Error("vm.SyntheticModule is required to load Node.js built-in modules in ESM remote entries.");
|
|
449
|
+
const o = Nr(t), n = Object.keys(o), s = new r.SyntheticModule(n, function() {
|
|
450
|
+
for (const c of n) this.setExport(c, o[c]);
|
|
451
|
+
}, { identifier: e });
|
|
452
|
+
return Z.set(e, s), await s.link(async () => {
|
|
453
|
+
throw new Error(`Node.js built-in module "${e}" should not request child modules.`);
|
|
454
|
+
}), await s.evaluate(), s;
|
|
455
|
+
}
|
|
456
|
+
async function Mr(e, t) {
|
|
457
|
+
const r = `node-builtin:${e}`;
|
|
458
|
+
return Z.has(r) ? Z.get(r) : Ar(r, await x(e), t);
|
|
459
|
+
}
|
|
460
|
+
async function We(e, t, r) {
|
|
461
|
+
if (await vr(e)) return Mr(e, r.vm);
|
|
462
|
+
if (mt(e)) throw new Error(`Unsupported ESM module specifier "${e}". Only relative or absolute http(s) remote modules and Node.js built-in modules are supported.`);
|
|
463
|
+
const o = new URL(e, t).href;
|
|
464
|
+
if (!dt(o)) throw new Error(`Unsupported ESM module specifier "${e}" resolved to "${o}". Only http(s) remote modules and Node.js built-in modules are supported.`);
|
|
465
|
+
return pt(o, r);
|
|
466
|
+
}
|
|
467
|
+
async function Pr(e) {
|
|
468
|
+
if (e.status === "linked" && await e.evaluate(), e.status === "errored") throw e.error;
|
|
469
|
+
return e;
|
|
470
|
+
}
|
|
471
|
+
async function pt(e, t) {
|
|
472
|
+
if (Z.has(e)) return Z.get(e);
|
|
473
|
+
const { fetch: r, vm: o } = t;
|
|
474
|
+
if (!dt(e)) throw new Error(`Unsupported ESM module URL "${e}". Only http(s) remote modules and Node.js built-in modules are supported.`);
|
|
475
|
+
const n = await (await r(e)).text(), s = (await x("node:url")).pathToFileURL(process.cwd()).href, i = new o.SourceTextModule(n, {
|
|
476
|
+
identifier: e,
|
|
477
|
+
initializeImportMeta: (c) => {
|
|
478
|
+
c.url = Tr(e, s);
|
|
479
|
+
},
|
|
480
|
+
importModuleDynamically: async (c) => Pr(await We(c, e, t))
|
|
481
|
+
});
|
|
482
|
+
return Z.set(e, i), await i.link(async (c) => We(c, e, t)), i;
|
|
483
|
+
}
|
|
484
|
+
const C = ut("[ Module Federation Bridge Vue3 ]"), kr = (e) => `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${e.split("-")[0].toLowerCase()}#${e.toLowerCase()}`, yt = (e, t, r, o) => {
|
|
447
485
|
const n = [`${[t[e]]} #${e}`];
|
|
448
|
-
return r && n.push(`args: ${JSON.stringify(r)}`), n.push(
|
|
486
|
+
return r && n.push(`args: ${JSON.stringify(r)}`), n.push(kr(e)), o && n.push(`Original Error Message:
|
|
449
487
|
${o}`), n.join(`
|
|
450
488
|
`);
|
|
451
489
|
};
|
|
452
|
-
function
|
|
453
|
-
return o(
|
|
490
|
+
function Or(e, t, r, o, n, s) {
|
|
491
|
+
return o(yt(e, t, r, n));
|
|
454
492
|
}
|
|
455
|
-
const
|
|
456
|
-
function
|
|
493
|
+
const U = "[ Federation Runtime ]", ke = ut(U);
|
|
494
|
+
function L(e, t, r, o, n) {
|
|
457
495
|
e || w(t);
|
|
458
496
|
}
|
|
459
497
|
function w(e, t, r, o, n) {
|
|
460
|
-
if (t !== void 0) return
|
|
461
|
-
throw new Error(`${
|
|
498
|
+
if (t !== void 0) return Or(e, t, r ?? {}, (i) => {
|
|
499
|
+
throw new Error(`${U}: ${i}`);
|
|
462
500
|
}, o);
|
|
463
501
|
const s = e;
|
|
464
|
-
throw s instanceof Error ? (s.message.startsWith(
|
|
502
|
+
throw s instanceof Error ? (s.message.startsWith(U) || (s.message = `${U}: ${s.message}`), s) : new Error(`${U}: ${s}`);
|
|
465
503
|
}
|
|
466
|
-
function
|
|
467
|
-
e instanceof Error && (e.message.startsWith(
|
|
504
|
+
function ne(e) {
|
|
505
|
+
e instanceof Error && (e.message.startsWith(U) || (e.message = `${U}: ${e.message}`)), ke.warn(e);
|
|
468
506
|
}
|
|
469
|
-
function
|
|
507
|
+
function Lr(e, t) {
|
|
470
508
|
return e.findIndex((r) => r === t) === -1 && e.push(t), e;
|
|
471
509
|
}
|
|
472
|
-
function
|
|
510
|
+
function se(e) {
|
|
473
511
|
return "version" in e && e.version ? `${e.name}:${e.version}` : "entry" in e && e.entry ? `${e.name}:${e.entry}` : `${e.name}`;
|
|
474
512
|
}
|
|
475
|
-
function
|
|
513
|
+
function Ce(e) {
|
|
476
514
|
return typeof e.entry < "u";
|
|
477
515
|
}
|
|
478
|
-
function
|
|
516
|
+
function Et(e) {
|
|
479
517
|
return !e.entry.includes(".json");
|
|
480
518
|
}
|
|
481
|
-
function
|
|
519
|
+
function Fe(e) {
|
|
482
520
|
return e && typeof e == "object";
|
|
483
521
|
}
|
|
484
|
-
const
|
|
485
|
-
function
|
|
486
|
-
return
|
|
522
|
+
const Cr = Object.prototype.toString;
|
|
523
|
+
function Fr(e) {
|
|
524
|
+
return Cr.call(e) === "[object Object]";
|
|
487
525
|
}
|
|
488
|
-
function
|
|
526
|
+
function gt(e) {
|
|
489
527
|
return Array.isArray(e) ? e : [e];
|
|
490
528
|
}
|
|
491
|
-
function
|
|
529
|
+
function Rt(e) {
|
|
492
530
|
const t = {
|
|
493
531
|
url: "",
|
|
494
532
|
type: "global",
|
|
495
533
|
globalName: ""
|
|
496
534
|
};
|
|
497
|
-
return
|
|
535
|
+
return G || nt() || !("ssrRemoteEntry" in e) ? "remoteEntry" in e ? {
|
|
498
536
|
url: e.remoteEntry,
|
|
499
537
|
type: e.remoteEntryType,
|
|
500
538
|
globalName: e.globalName
|
|
@@ -504,45 +542,45 @@ function dt(e) {
|
|
|
504
542
|
globalName: e.globalName
|
|
505
543
|
} : t;
|
|
506
544
|
}
|
|
507
|
-
const
|
|
545
|
+
const Hr = (e, t) => {
|
|
508
546
|
let r;
|
|
509
547
|
return e.endsWith("/") ? r = e.slice(0, -1) : r = e, t.startsWith(".") && (t = t.slice(1)), r = r + t, r;
|
|
510
|
-
},
|
|
548
|
+
}, v = typeof globalThis == "object" ? globalThis : window, k = (() => {
|
|
511
549
|
try {
|
|
512
550
|
return document.defaultView;
|
|
513
551
|
} catch {
|
|
514
|
-
return
|
|
552
|
+
return v;
|
|
515
553
|
}
|
|
516
|
-
})(),
|
|
517
|
-
function
|
|
554
|
+
})(), _e = k;
|
|
555
|
+
function de(e, t, r) {
|
|
518
556
|
Object.defineProperty(e, t, {
|
|
519
557
|
value: r,
|
|
520
558
|
configurable: !1,
|
|
521
559
|
writable: !0
|
|
522
560
|
});
|
|
523
561
|
}
|
|
524
|
-
function
|
|
562
|
+
function me(e, t) {
|
|
525
563
|
return Object.hasOwnProperty.call(e, t);
|
|
526
564
|
}
|
|
527
|
-
|
|
528
|
-
const
|
|
529
|
-
function
|
|
530
|
-
var t, r, o, n, s,
|
|
531
|
-
|
|
565
|
+
me(v, "__GLOBAL_LOADING_REMOTE_ENTRY__") || de(v, "__GLOBAL_LOADING_REMOTE_ENTRY__", {});
|
|
566
|
+
const J = v.__GLOBAL_LOADING_REMOTE_ENTRY__;
|
|
567
|
+
function _t(e) {
|
|
568
|
+
var t, r, o, n, s, i;
|
|
569
|
+
me(e, "__VMOK__") && !me(e, "__FEDERATION__") && de(e, "__FEDERATION__", e.__VMOK__), me(e, "__FEDERATION__") || (de(e, "__FEDERATION__", {
|
|
532
570
|
__GLOBAL_PLUGIN__: [],
|
|
533
571
|
__INSTANCES__: [],
|
|
534
572
|
moduleInfo: {},
|
|
535
573
|
__SHARE__: {},
|
|
536
574
|
__MANIFEST_LOADING__: {},
|
|
537
575
|
__PRELOADED_MAP__: /* @__PURE__ */ new Map()
|
|
538
|
-
}),
|
|
576
|
+
}), de(e, "__VMOK__", e.__FEDERATION__)), (t = e.__FEDERATION__).__GLOBAL_PLUGIN__ ?? (t.__GLOBAL_PLUGIN__ = []), (r = e.__FEDERATION__).__INSTANCES__ ?? (r.__INSTANCES__ = []), (o = e.__FEDERATION__).moduleInfo ?? (o.moduleInfo = {}), (n = e.__FEDERATION__).__SHARE__ ?? (n.__SHARE__ = {}), (s = e.__FEDERATION__).__MANIFEST_LOADING__ ?? (s.__MANIFEST_LOADING__ = {}), (i = e.__FEDERATION__).__PRELOADED_MAP__ ?? (i.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
|
|
539
577
|
}
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
function
|
|
543
|
-
t && (
|
|
578
|
+
_t(v);
|
|
579
|
+
_t(k);
|
|
580
|
+
function Dr(e, t = Ae()) {
|
|
581
|
+
t && (v.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = e, v.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.8.0");
|
|
544
582
|
}
|
|
545
|
-
function
|
|
583
|
+
function W(e, t) {
|
|
546
584
|
if (typeof t == "string") {
|
|
547
585
|
if (e[t]) return {
|
|
548
586
|
value: e[t],
|
|
@@ -551,10 +589,10 @@ function B(e, t) {
|
|
|
551
589
|
{
|
|
552
590
|
const r = Object.keys(e);
|
|
553
591
|
for (const o of r) {
|
|
554
|
-
const [n, s] = o.split(":"),
|
|
592
|
+
const [n, s] = o.split(":"), i = `${n}:${t}`, c = e[i];
|
|
555
593
|
if (c) return {
|
|
556
594
|
value: c,
|
|
557
|
-
key:
|
|
595
|
+
key: i
|
|
558
596
|
};
|
|
559
597
|
}
|
|
560
598
|
return {
|
|
@@ -564,178 +602,178 @@ function B(e, t) {
|
|
|
564
602
|
}
|
|
565
603
|
} else w(`getInfoWithoutType: "key" must be a string, got ${typeof t} (${JSON.stringify(t)}).`);
|
|
566
604
|
}
|
|
567
|
-
const Ve = () =>
|
|
568
|
-
const r =
|
|
605
|
+
const Ve = () => k.__FEDERATION__.moduleInfo, xr = (e, t) => {
|
|
606
|
+
const r = W(t, se(e)).value;
|
|
569
607
|
if (r && !r.version && "version" in e && e.version && (r.version = e.version), r) return r;
|
|
570
608
|
if ("version" in e && e.version) {
|
|
571
|
-
const { version: o, ...n } = e, s =
|
|
572
|
-
if ((
|
|
573
|
-
}
|
|
574
|
-
},
|
|
575
|
-
const r =
|
|
576
|
-
return
|
|
577
|
-
},
|
|
578
|
-
...
|
|
609
|
+
const { version: o, ...n } = e, s = se(n), i = W(k.__FEDERATION__.moduleInfo, s).value;
|
|
610
|
+
if ((i == null ? void 0 : i.version) === o) return i;
|
|
611
|
+
}
|
|
612
|
+
}, pe = (e) => xr(e, k.__FEDERATION__.moduleInfo), qe = (e, t) => {
|
|
613
|
+
const r = se(e);
|
|
614
|
+
return k.__FEDERATION__.moduleInfo[r] = t, k.__FEDERATION__.moduleInfo;
|
|
615
|
+
}, Gr = (e) => (k.__FEDERATION__.moduleInfo = {
|
|
616
|
+
...k.__FEDERATION__.moduleInfo,
|
|
579
617
|
...e
|
|
580
618
|
}, () => {
|
|
581
619
|
const t = Object.keys(e);
|
|
582
|
-
for (const r of t) delete
|
|
583
|
-
}),
|
|
620
|
+
for (const r of t) delete k.__FEDERATION__.moduleInfo[r];
|
|
621
|
+
}), He = (e, t) => {
|
|
584
622
|
const r = t || `__FEDERATION_${e}:custom__`;
|
|
585
623
|
return {
|
|
586
624
|
remoteEntryKey: r,
|
|
587
|
-
entryExports:
|
|
625
|
+
entryExports: v[r]
|
|
588
626
|
};
|
|
589
|
-
},
|
|
590
|
-
function
|
|
627
|
+
}, Ur = () => k.__FEDERATION__.__GLOBAL_PLUGIN__, Br = (e) => v.__FEDERATION__.__PRELOADED_MAP__.get(e), jr = (e) => v.__FEDERATION__.__PRELOADED_MAP__.set(e, !0), ze = "[0-9A-Za-z-]+", De = `(?:\\+(${ze}(?:\\.${ze})*))`, oe = "0|[1-9]\\d*", ye = "[0-9]+", St = "\\d*[a-zA-Z-][a-zA-Z0-9-]*", Ke = `(?:${ye}|${St})`, Wr = `(?:-?(${Ke}(?:\\.${Ke})*))`, Je = `(?:${oe}|${St})`, bt = `(?:-(${Je}(?:\\.${Je})*))`, we = `${oe}|x|X|\\*`, Y = `[v=\\s]*(${we})(?:\\.(${we})(?:\\.(${we})(?:${bt})?${De}?)?)?`, Vr = `^\\s*(${Y})\\s+-\\s+(${Y})\\s*$`, qr = `[v=\\s]*${`(${ye})\\.(${ye})\\.(${ye})`}${Wr}?${De}?`, xe = "((?:<|>)?=?)", zr = `(\\s*)${xe}\\s*(${qr}|${Y})`, wt = "(?:~>?)", Kr = `(\\s*)${wt}\\s+`, It = "(?:\\^)", Jr = `(\\s*)${It}\\s+`, Zr = "(<|>)?=?\\s*\\*", Xr = `^${It}${Y}$`, Yr = `v?${`(${oe})\\.(${oe})\\.(${oe})`}${bt}?${De}?`, Qr = `^${wt}${Y}$`, eo = `^${xe}\\s*${Y}$`, to = `^${xe}\\s*(${Yr})$|^$`, ro = "^\\s*>=\\s*0.0.0\\s*$";
|
|
628
|
+
function O(e) {
|
|
591
629
|
return new RegExp(e);
|
|
592
630
|
}
|
|
593
631
|
function N(e) {
|
|
594
632
|
return !e || e.toLowerCase() === "x" || e === "*";
|
|
595
633
|
}
|
|
596
|
-
function
|
|
634
|
+
function $t(...e) {
|
|
597
635
|
return (t) => e.reduce((r, o) => o(r), t);
|
|
598
636
|
}
|
|
599
|
-
function
|
|
600
|
-
return e.match(
|
|
637
|
+
function Ze(e) {
|
|
638
|
+
return e.match(O(to));
|
|
601
639
|
}
|
|
602
|
-
function
|
|
640
|
+
function Xe(e, t, r, o) {
|
|
603
641
|
const n = `${e}.${t}.${r}`;
|
|
604
642
|
return o ? `${n}-${o}` : n;
|
|
605
643
|
}
|
|
606
|
-
function
|
|
607
|
-
return e.replace(
|
|
644
|
+
function oo(e) {
|
|
645
|
+
return e.replace(O(Vr), (t, r, o, n, s, i, c, a, l, u, h, m) => (N(o) ? r = "" : N(n) ? r = `>=${o}.0.0` : N(s) ? r = `>=${o}.${n}.0` : r = `>=${r}`, N(l) ? a = "" : N(u) ? a = `<${Number(l) + 1}.0.0-0` : N(h) ? a = `<${l}.${Number(u) + 1}.0-0` : m ? a = `<=${l}.${u}.${h}-${m}` : a = `<=${a}`, `${r} ${a}`.trim()));
|
|
608
646
|
}
|
|
609
|
-
function
|
|
610
|
-
return e.replace(
|
|
647
|
+
function no(e) {
|
|
648
|
+
return e.replace(O(zr), "$1$2$3");
|
|
611
649
|
}
|
|
612
|
-
function
|
|
613
|
-
return e.replace(
|
|
650
|
+
function so(e) {
|
|
651
|
+
return e.replace(O(Kr), "$1~");
|
|
614
652
|
}
|
|
615
|
-
function
|
|
616
|
-
return e.replace(
|
|
653
|
+
function io(e) {
|
|
654
|
+
return e.replace(O(Jr), "$1^");
|
|
617
655
|
}
|
|
618
|
-
function
|
|
619
|
-
return e.trim().split(/\s+/).map((t) => t.replace(
|
|
656
|
+
function ao(e) {
|
|
657
|
+
return e.trim().split(/\s+/).map((t) => t.replace(O(Xr), (r, o, n, s, i) => N(o) ? "" : N(n) ? `>=${o}.0.0 <${Number(o) + 1}.0.0-0` : N(s) ? o === "0" ? `>=${o}.${n}.0 <${o}.${Number(n) + 1}.0-0` : `>=${o}.${n}.0 <${Number(o) + 1}.0.0-0` : i ? o === "0" ? n === "0" ? `>=${o}.${n}.${s}-${i} <${o}.${n}.${Number(s) + 1}-0` : `>=${o}.${n}.${s}-${i} <${o}.${Number(n) + 1}.0-0` : `>=${o}.${n}.${s}-${i} <${Number(o) + 1}.0.0-0` : o === "0" ? n === "0" ? `>=${o}.${n}.${s} <${o}.${n}.${Number(s) + 1}-0` : `>=${o}.${n}.${s} <${o}.${Number(n) + 1}.0-0` : `>=${o}.${n}.${s} <${Number(o) + 1}.0.0-0`)).join(" ");
|
|
620
658
|
}
|
|
621
|
-
function
|
|
622
|
-
return e.trim().split(/\s+/).map((t) => t.replace(
|
|
659
|
+
function co(e) {
|
|
660
|
+
return e.trim().split(/\s+/).map((t) => t.replace(O(Qr), (r, o, n, s, i) => N(o) ? "" : N(n) ? `>=${o}.0.0 <${Number(o) + 1}.0.0-0` : N(s) ? `>=${o}.${n}.0 <${o}.${Number(n) + 1}.0-0` : i ? `>=${o}.${n}.${s}-${i} <${o}.${Number(n) + 1}.0-0` : `>=${o}.${n}.${s} <${o}.${Number(n) + 1}.0-0`)).join(" ");
|
|
623
661
|
}
|
|
624
|
-
function
|
|
625
|
-
return e.split(/\s+/).map((t) => t.trim().replace(
|
|
626
|
-
const
|
|
627
|
-
return o === "=" && u && (o = ""), c = "",
|
|
662
|
+
function lo(e) {
|
|
663
|
+
return e.split(/\s+/).map((t) => t.trim().replace(O(eo), (r, o, n, s, i, c) => {
|
|
664
|
+
const a = N(n), l = a || N(s), u = l || N(i);
|
|
665
|
+
return o === "=" && u && (o = ""), c = "", a ? o === ">" || o === "<" ? "<0.0.0-0" : "*" : o && u ? (l && (s = 0), i = 0, o === ">" ? (o = ">=", l ? (n = Number(n) + 1, s = 0, i = 0) : (s = Number(s) + 1, i = 0)) : o === "<=" && (o = "<", l ? n = Number(n) + 1 : s = Number(s) + 1), o === "<" && (c = "-0"), `${o + n}.${s}.${i}${c}`) : l ? `>=${n}.0.0${c} <${Number(n) + 1}.0.0-0` : u ? `>=${n}.${s}.0${c} <${n}.${Number(s) + 1}.0-0` : r;
|
|
628
666
|
})).join(" ");
|
|
629
667
|
}
|
|
630
|
-
function
|
|
631
|
-
return e.trim().replace(
|
|
668
|
+
function uo(e) {
|
|
669
|
+
return e.trim().replace(O(Zr), "");
|
|
632
670
|
}
|
|
633
|
-
function
|
|
634
|
-
return e.trim().replace(
|
|
671
|
+
function ho(e) {
|
|
672
|
+
return e.trim().replace(O(ro), "");
|
|
635
673
|
}
|
|
636
|
-
function
|
|
674
|
+
function Ee(e, t) {
|
|
637
675
|
return e = Number(e) || e, t = Number(t) || t, e > t ? 1 : e === t ? 0 : -1;
|
|
638
676
|
}
|
|
639
|
-
function
|
|
677
|
+
function fo(e, t) {
|
|
640
678
|
const { preRelease: r } = e, { preRelease: o } = t;
|
|
641
679
|
if (r === void 0 && o) return 1;
|
|
642
680
|
if (r && o === void 0) return -1;
|
|
643
681
|
if (r === void 0 && o === void 0) return 0;
|
|
644
682
|
for (let n = 0, s = r.length; n <= s; n++) {
|
|
645
|
-
const
|
|
646
|
-
if (
|
|
647
|
-
return
|
|
683
|
+
const i = r[n], c = o[n];
|
|
684
|
+
if (i !== c)
|
|
685
|
+
return i === void 0 && c === void 0 ? 0 : i ? c ? Ee(i, c) : -1 : 1;
|
|
648
686
|
}
|
|
649
687
|
return 0;
|
|
650
688
|
}
|
|
651
|
-
function
|
|
652
|
-
return
|
|
689
|
+
function ue(e, t) {
|
|
690
|
+
return Ee(e.major, t.major) || Ee(e.minor, t.minor) || Ee(e.patch, t.patch) || fo(e, t);
|
|
653
691
|
}
|
|
654
|
-
function
|
|
692
|
+
function Ie(e, t) {
|
|
655
693
|
return e.version === t.version;
|
|
656
694
|
}
|
|
657
|
-
function
|
|
695
|
+
function mo(e, t) {
|
|
658
696
|
switch (e.operator) {
|
|
659
697
|
case "":
|
|
660
698
|
case "=":
|
|
661
|
-
return
|
|
699
|
+
return Ie(e, t);
|
|
662
700
|
case ">":
|
|
663
|
-
return
|
|
701
|
+
return ue(e, t) < 0;
|
|
664
702
|
case ">=":
|
|
665
|
-
return
|
|
703
|
+
return Ie(e, t) || ue(e, t) < 0;
|
|
666
704
|
case "<":
|
|
667
|
-
return
|
|
705
|
+
return ue(e, t) > 0;
|
|
668
706
|
case "<=":
|
|
669
|
-
return
|
|
707
|
+
return Ie(e, t) || ue(e, t) > 0;
|
|
670
708
|
case void 0:
|
|
671
709
|
return !0;
|
|
672
710
|
default:
|
|
673
711
|
return !1;
|
|
674
712
|
}
|
|
675
713
|
}
|
|
676
|
-
function
|
|
677
|
-
return
|
|
714
|
+
function po(e) {
|
|
715
|
+
return $t(ao, co, lo, uo)(e);
|
|
678
716
|
}
|
|
679
|
-
function
|
|
680
|
-
return
|
|
717
|
+
function yo(e) {
|
|
718
|
+
return $t(oo, no, so, io)(e.trim()).split(/\s+/).join(" ");
|
|
681
719
|
}
|
|
682
|
-
function
|
|
720
|
+
function re(e, t) {
|
|
683
721
|
if (!e) return !1;
|
|
684
|
-
const r =
|
|
722
|
+
const r = Ze(e);
|
|
685
723
|
if (!r) return !1;
|
|
686
|
-
const [, o, , n, s,
|
|
724
|
+
const [, o, , n, s, i, c] = r, a = {
|
|
687
725
|
operator: o,
|
|
688
|
-
version:
|
|
726
|
+
version: Xe(n, s, i, c),
|
|
689
727
|
major: n,
|
|
690
728
|
minor: s,
|
|
691
|
-
patch:
|
|
729
|
+
patch: i,
|
|
692
730
|
preRelease: c == null ? void 0 : c.split(".")
|
|
693
731
|
}, l = t.split("||");
|
|
694
732
|
for (const u of l) {
|
|
695
|
-
const
|
|
696
|
-
if (!
|
|
733
|
+
const h = u.trim();
|
|
734
|
+
if (!h || h === "*" || h === "x") return !0;
|
|
697
735
|
try {
|
|
698
|
-
const m =
|
|
736
|
+
const m = yo(h);
|
|
699
737
|
if (!m.trim()) return !0;
|
|
700
|
-
const
|
|
701
|
-
if (!
|
|
702
|
-
const d =
|
|
738
|
+
const f = m.split(" ").map((E) => po(E)).join(" ");
|
|
739
|
+
if (!f.trim()) return !0;
|
|
740
|
+
const d = f.split(/\s+/).map((E) => ho(E)).filter(Boolean);
|
|
703
741
|
if (d.length === 0) continue;
|
|
704
742
|
let p = !0;
|
|
705
743
|
for (const E of d) {
|
|
706
|
-
const y =
|
|
744
|
+
const y = Ze(E);
|
|
707
745
|
if (!y) {
|
|
708
746
|
p = !1;
|
|
709
747
|
break;
|
|
710
748
|
}
|
|
711
|
-
const [,
|
|
712
|
-
if (!
|
|
713
|
-
operator:
|
|
714
|
-
version:
|
|
749
|
+
const [, R, , g, _, S, I] = y;
|
|
750
|
+
if (!mo({
|
|
751
|
+
operator: R,
|
|
752
|
+
version: Xe(g, _, S, I),
|
|
715
753
|
major: g,
|
|
716
|
-
minor:
|
|
717
|
-
patch:
|
|
718
|
-
preRelease:
|
|
719
|
-
},
|
|
754
|
+
minor: _,
|
|
755
|
+
patch: S,
|
|
756
|
+
preRelease: I == null ? void 0 : I.split(".")
|
|
757
|
+
}, a)) {
|
|
720
758
|
p = !1;
|
|
721
759
|
break;
|
|
722
760
|
}
|
|
723
761
|
}
|
|
724
762
|
if (p) return !0;
|
|
725
763
|
} catch (m) {
|
|
726
|
-
console.error(`[semver] Error processing range part "${
|
|
764
|
+
console.error(`[semver] Error processing range part "${h}":`, m);
|
|
727
765
|
continue;
|
|
728
766
|
}
|
|
729
767
|
}
|
|
730
768
|
return !1;
|
|
731
769
|
}
|
|
732
|
-
const
|
|
733
|
-
function
|
|
734
|
-
var s,
|
|
770
|
+
const ce = "default", Tt = "global";
|
|
771
|
+
function Eo(e, t, r, o) {
|
|
772
|
+
var s, i;
|
|
735
773
|
let n;
|
|
736
774
|
return "get" in e ? n = e.get : "lib" in e ? n = () => Promise.resolve(e.lib) : n = () => Promise.resolve(() => {
|
|
737
775
|
w(`Cannot get shared "${r}" from "${t}": neither "get" nor "lib" is provided in the share config.`);
|
|
738
|
-
}), (s = e.shareConfig) != null && s.eager && ((
|
|
776
|
+
}), (s = e.shareConfig) != null && s.eager && ((i = e.treeShaking) != null && i.mode) && w(`Invalid shared config for "${r}" from "${t}": cannot use both "eager: true" and "treeShaking.mode" simultaneously. Choose one strategy.`), {
|
|
739
777
|
deps: [],
|
|
740
778
|
useIn: [],
|
|
741
779
|
from: t,
|
|
@@ -756,110 +794,110 @@ function no(e, t, r, o) {
|
|
|
756
794
|
treeShaking: e.treeShaking ? {
|
|
757
795
|
...e.treeShaking,
|
|
758
796
|
mode: e.treeShaking.mode ?? "server-calc",
|
|
759
|
-
status: e.treeShaking.status ??
|
|
797
|
+
status: e.treeShaking.status ?? Ne.UNKNOWN,
|
|
760
798
|
useIn: []
|
|
761
799
|
} : void 0
|
|
762
800
|
};
|
|
763
801
|
}
|
|
764
|
-
function
|
|
765
|
-
const r = t.shared || {}, o = t.name, n = Object.keys(r).reduce((
|
|
766
|
-
const
|
|
767
|
-
return
|
|
768
|
-
|
|
769
|
-
}),
|
|
802
|
+
function vt(e, t) {
|
|
803
|
+
const r = t.shared || {}, o = t.name, n = Object.keys(r).reduce((i, c) => {
|
|
804
|
+
const a = gt(r[c]);
|
|
805
|
+
return i[c] = i[c] || [], a.forEach((l) => {
|
|
806
|
+
i[c].push(Eo(l, o, c, t.shareStrategy));
|
|
807
|
+
}), i;
|
|
770
808
|
}, {}), s = { ...e.shared };
|
|
771
|
-
return Object.keys(n).forEach((
|
|
772
|
-
s[
|
|
773
|
-
s[
|
|
774
|
-
}) : s[
|
|
809
|
+
return Object.keys(n).forEach((i) => {
|
|
810
|
+
s[i] ? n[i].forEach((c) => {
|
|
811
|
+
s[i].find((a) => a.version === c.version) || s[i].push(c);
|
|
812
|
+
}) : s[i] = n[i];
|
|
775
813
|
}), {
|
|
776
814
|
allShareInfos: s,
|
|
777
815
|
newShareInfos: n
|
|
778
816
|
};
|
|
779
817
|
}
|
|
780
|
-
function
|
|
818
|
+
function ie(e, t) {
|
|
781
819
|
if (!e) return !1;
|
|
782
820
|
const { status: r, mode: o } = e;
|
|
783
|
-
return r ===
|
|
821
|
+
return r === Ne.NO_USE ? !1 : r === Ne.CALCULATED ? !0 : o === "runtime-infer" ? t ? Ro(e, t) : !0 : !1;
|
|
784
822
|
}
|
|
785
|
-
function
|
|
823
|
+
function B(e, t) {
|
|
786
824
|
const r = (o) => {
|
|
787
825
|
if (!Number.isNaN(Number(o))) {
|
|
788
826
|
const n = o.split(".");
|
|
789
827
|
let s = o;
|
|
790
|
-
for (let
|
|
828
|
+
for (let i = 0; i < 3 - n.length; i++) s += ".0";
|
|
791
829
|
return s;
|
|
792
830
|
}
|
|
793
831
|
return o;
|
|
794
832
|
};
|
|
795
|
-
return !!
|
|
833
|
+
return !!re(r(e), `<=${r(t)}`);
|
|
796
834
|
}
|
|
797
|
-
const
|
|
835
|
+
const ae = (e, t) => {
|
|
798
836
|
const r = t || function(o, n) {
|
|
799
|
-
return
|
|
837
|
+
return B(o, n);
|
|
800
838
|
};
|
|
801
839
|
return Object.keys(e).reduce((o, n) => !o || r(o, n) || o === "0" ? n : o, 0);
|
|
802
|
-
},
|
|
840
|
+
}, Re = (e) => !!e.loaded || typeof e.lib == "function", go = (e) => !!e.loading, Ro = (e, t) => {
|
|
803
841
|
if (!e || !t) return !1;
|
|
804
842
|
const { usedExports: r } = e;
|
|
805
843
|
return r ? !!t.every((o) => r.includes(o)) : !1;
|
|
806
844
|
};
|
|
807
|
-
function
|
|
845
|
+
function _o(e, t, r, o) {
|
|
808
846
|
const n = e[t][r];
|
|
809
|
-
let s = "",
|
|
810
|
-
const c = function(
|
|
811
|
-
return
|
|
847
|
+
let s = "", i = ie(o);
|
|
848
|
+
const c = function(a, l) {
|
|
849
|
+
return i ? n[a].treeShaking ? n[l].treeShaking ? !Re(n[a].treeShaking) && B(a, l) : !1 : !0 : !Re(n[a]) && B(a, l);
|
|
812
850
|
};
|
|
813
|
-
if (
|
|
814
|
-
if (s =
|
|
851
|
+
if (i) {
|
|
852
|
+
if (s = ae(e[t][r], c), s) return {
|
|
815
853
|
version: s,
|
|
816
|
-
useTreesShaking:
|
|
854
|
+
useTreesShaking: i
|
|
817
855
|
};
|
|
818
|
-
|
|
856
|
+
i = !1;
|
|
819
857
|
}
|
|
820
858
|
return {
|
|
821
|
-
version:
|
|
822
|
-
useTreesShaking:
|
|
859
|
+
version: ae(e[t][r], c),
|
|
860
|
+
useTreesShaking: i
|
|
823
861
|
};
|
|
824
862
|
}
|
|
825
|
-
const
|
|
826
|
-
function
|
|
863
|
+
const q = (e) => Re(e) || go(e);
|
|
864
|
+
function So(e, t, r, o) {
|
|
827
865
|
const n = e[t][r];
|
|
828
|
-
let s = "",
|
|
829
|
-
const c = function(
|
|
830
|
-
if (
|
|
831
|
-
if (!n[
|
|
866
|
+
let s = "", i = ie(o);
|
|
867
|
+
const c = function(a, l) {
|
|
868
|
+
if (i) {
|
|
869
|
+
if (!n[a].treeShaking) return !0;
|
|
832
870
|
if (!n[l].treeShaking) return !1;
|
|
833
|
-
if (
|
|
834
|
-
if (
|
|
871
|
+
if (q(n[l].treeShaking)) return q(n[a].treeShaking) ? !!B(a, l) : !0;
|
|
872
|
+
if (q(n[a].treeShaking)) return !1;
|
|
835
873
|
}
|
|
836
|
-
return
|
|
874
|
+
return q(n[l]) ? q(n[a]) ? !!B(a, l) : !0 : q(n[a]) ? !1 : B(a, l);
|
|
837
875
|
};
|
|
838
|
-
if (
|
|
839
|
-
if (s =
|
|
876
|
+
if (i) {
|
|
877
|
+
if (s = ae(e[t][r], c), s) return {
|
|
840
878
|
version: s,
|
|
841
|
-
useTreesShaking:
|
|
879
|
+
useTreesShaking: i
|
|
842
880
|
};
|
|
843
|
-
|
|
881
|
+
i = !1;
|
|
844
882
|
}
|
|
845
883
|
return {
|
|
846
|
-
version:
|
|
847
|
-
useTreesShaking:
|
|
884
|
+
version: ae(e[t][r], c),
|
|
885
|
+
useTreesShaking: i
|
|
848
886
|
};
|
|
849
887
|
}
|
|
850
|
-
function
|
|
851
|
-
return e === "loaded-first" ?
|
|
888
|
+
function bo(e) {
|
|
889
|
+
return e === "loaded-first" ? So : _o;
|
|
852
890
|
}
|
|
853
|
-
function
|
|
891
|
+
function ge(e, t, r, o) {
|
|
854
892
|
if (!e) return;
|
|
855
|
-
const { shareConfig: n, scope: s =
|
|
856
|
-
for (const l of
|
|
857
|
-
const { requiredVersion: u } = n, { version:
|
|
858
|
-
const p = e[l][t][
|
|
893
|
+
const { shareConfig: n, scope: s = ce, strategy: i, treeShaking: c } = r, a = Array.isArray(s) ? s : [s];
|
|
894
|
+
for (const l of a) if (n && e[l] && e[l][t]) {
|
|
895
|
+
const { requiredVersion: u } = n, { version: h, useTreesShaking: m } = bo(i)(e, l, t, c), f = () => {
|
|
896
|
+
const p = e[l][t][h];
|
|
859
897
|
if (n.singleton) {
|
|
860
|
-
if (typeof u == "string" && !
|
|
861
|
-
const E = `Version ${
|
|
862
|
-
n.strictVersion ? w(E) :
|
|
898
|
+
if (typeof u == "string" && !re(h, u)) {
|
|
899
|
+
const E = `Version ${h} from ${h && p.from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;
|
|
900
|
+
n.strictVersion ? w(E) : ne(E);
|
|
863
901
|
}
|
|
864
902
|
return {
|
|
865
903
|
shared: p,
|
|
@@ -870,21 +908,21 @@ function ye(e, t, r, o) {
|
|
|
870
908
|
shared: p,
|
|
871
909
|
useTreesShaking: m
|
|
872
910
|
};
|
|
873
|
-
if (
|
|
911
|
+
if (re(h, u)) return {
|
|
874
912
|
shared: p,
|
|
875
913
|
useTreesShaking: m
|
|
876
914
|
};
|
|
877
|
-
const E =
|
|
915
|
+
const E = ie(c);
|
|
878
916
|
if (E) {
|
|
879
|
-
for (const [y,
|
|
880
|
-
if (
|
|
917
|
+
for (const [y, R] of Object.entries(e[l][t]))
|
|
918
|
+
if (ie(R.treeShaking, c == null ? void 0 : c.usedExports) && re(y, u))
|
|
881
919
|
return {
|
|
882
|
-
shared:
|
|
920
|
+
shared: R,
|
|
883
921
|
useTreesShaking: E
|
|
884
922
|
};
|
|
885
923
|
}
|
|
886
|
-
for (const [y,
|
|
887
|
-
shared:
|
|
924
|
+
for (const [y, R] of Object.entries(e[l][t])) if (re(y, u)) return {
|
|
925
|
+
shared: R,
|
|
888
926
|
useTreesShaking: !1
|
|
889
927
|
};
|
|
890
928
|
}
|
|
@@ -892,48 +930,48 @@ function ye(e, t, r, o) {
|
|
|
892
930
|
shareScopeMap: e,
|
|
893
931
|
scope: l,
|
|
894
932
|
pkgName: t,
|
|
895
|
-
version:
|
|
896
|
-
GlobalFederation:
|
|
933
|
+
version: h,
|
|
934
|
+
GlobalFederation: _e.__FEDERATION__,
|
|
897
935
|
shareInfo: r,
|
|
898
|
-
resolver:
|
|
936
|
+
resolver: f
|
|
899
937
|
};
|
|
900
938
|
return (o.emit(d) || d).resolver();
|
|
901
939
|
}
|
|
902
940
|
}
|
|
903
|
-
function
|
|
904
|
-
return
|
|
941
|
+
function Nt() {
|
|
942
|
+
return _e.__FEDERATION__.__SHARE__;
|
|
905
943
|
}
|
|
906
|
-
function
|
|
907
|
-
const { pkgName: t, extraOptions: r, shareInfos: o } = e, n = (
|
|
908
|
-
if (!
|
|
944
|
+
function Ye(e) {
|
|
945
|
+
const { pkgName: t, extraOptions: r, shareInfos: o } = e, n = (a) => {
|
|
946
|
+
if (!a) return;
|
|
909
947
|
const l = {};
|
|
910
|
-
return
|
|
911
|
-
l[
|
|
912
|
-
}), l[
|
|
913
|
-
return !
|
|
948
|
+
return a.forEach((h) => {
|
|
949
|
+
l[h.version] = h;
|
|
950
|
+
}), l[ae(l, function(h, m) {
|
|
951
|
+
return !Re(l[h]) && B(h, m);
|
|
914
952
|
})];
|
|
915
|
-
}, s = (r == null ? void 0 : r.resolver) ?? n,
|
|
953
|
+
}, s = (r == null ? void 0 : r.resolver) ?? n, i = (a) => a !== null && typeof a == "object" && !Array.isArray(a), c = (...a) => {
|
|
916
954
|
const l = {};
|
|
917
|
-
for (const u of
|
|
955
|
+
for (const u of a)
|
|
918
956
|
if (u)
|
|
919
|
-
for (const [
|
|
920
|
-
const
|
|
921
|
-
|
|
957
|
+
for (const [h, m] of Object.entries(u)) {
|
|
958
|
+
const f = l[h];
|
|
959
|
+
i(f) && i(m) ? l[h] = c(f, m) : m !== void 0 && (l[h] = m);
|
|
922
960
|
}
|
|
923
961
|
return l;
|
|
924
962
|
};
|
|
925
963
|
return c(s(o[t]), r == null ? void 0 : r.customShareInfo);
|
|
926
964
|
}
|
|
927
|
-
const
|
|
928
|
-
e.useIn || (e.useIn = []),
|
|
965
|
+
const z = (e, t) => {
|
|
966
|
+
e.useIn || (e.useIn = []), Lr(e.useIn, t);
|
|
929
967
|
};
|
|
930
|
-
function
|
|
968
|
+
function he(e, t) {
|
|
931
969
|
return t && e.treeShaking ? e.treeShaking : e;
|
|
932
970
|
}
|
|
933
|
-
function
|
|
971
|
+
function Ge(e, t) {
|
|
934
972
|
return !t || t === "." ? e : `${e}/${t.replace(/^\.\//, "")}`;
|
|
935
973
|
}
|
|
936
|
-
function
|
|
974
|
+
function Qe(e, t) {
|
|
937
975
|
for (const r of e) {
|
|
938
976
|
const o = t.startsWith(r.name);
|
|
939
977
|
let n = t.replace(r.name, "");
|
|
@@ -952,16 +990,16 @@ function Ye(e, t) {
|
|
|
952
990
|
};
|
|
953
991
|
}
|
|
954
992
|
const s = r.alias && t.startsWith(r.alias);
|
|
955
|
-
let
|
|
993
|
+
let i = r.alias && t.replace(r.alias, "");
|
|
956
994
|
if (r.alias && s) {
|
|
957
|
-
if (
|
|
995
|
+
if (i && i.startsWith("/")) {
|
|
958
996
|
const c = r.alias;
|
|
959
|
-
return
|
|
997
|
+
return i = `.${i}`, {
|
|
960
998
|
pkgNameOrAlias: c,
|
|
961
|
-
expose:
|
|
999
|
+
expose: i,
|
|
962
1000
|
remote: r
|
|
963
1001
|
};
|
|
964
|
-
} else if (
|
|
1002
|
+
} else if (i === "") return {
|
|
965
1003
|
pkgNameOrAlias: r.alias,
|
|
966
1004
|
expose: ".",
|
|
967
1005
|
remote: r
|
|
@@ -969,35 +1007,35 @@ function Ye(e, t) {
|
|
|
969
1007
|
}
|
|
970
1008
|
}
|
|
971
1009
|
}
|
|
972
|
-
function
|
|
1010
|
+
function wo(e, t) {
|
|
973
1011
|
for (const r of e)
|
|
974
1012
|
if (t === r.name || r.alias && t === r.alias) return r;
|
|
975
1013
|
}
|
|
976
|
-
const
|
|
977
|
-
[
|
|
978
|
-
[
|
|
979
|
-
[
|
|
980
|
-
[
|
|
981
|
-
[
|
|
982
|
-
[
|
|
983
|
-
[
|
|
984
|
-
[
|
|
985
|
-
[
|
|
986
|
-
[
|
|
987
|
-
[
|
|
988
|
-
[
|
|
989
|
-
[
|
|
990
|
-
[
|
|
991
|
-
[
|
|
1014
|
+
const At = "RUNTIME-001", Mt = "RUNTIME-002", Pt = "RUNTIME-003", kt = "RUNTIME-004", Ot = "RUNTIME-005", Oe = "RUNTIME-006", Lt = "RUNTIME-007", Ue = "RUNTIME-008", Io = "RUNTIME-009", Ct = "RUNTIME-010", Ft = "RUNTIME-011", $o = "RUNTIME-012", Ht = "RUNTIME-013", Dt = "RUNTIME-014", xt = "RUNTIME-015", M = {
|
|
1015
|
+
[At]: "Failed to get remoteEntry exports.",
|
|
1016
|
+
[Mt]: 'The remote entry interface does not contain "init"',
|
|
1017
|
+
[Pt]: "Failed to get manifest.",
|
|
1018
|
+
[kt]: "Failed to locate remote.",
|
|
1019
|
+
[Ot]: "Invalid loadShareSync function call from bundler runtime",
|
|
1020
|
+
[Oe]: "Invalid loadShareSync function call from runtime",
|
|
1021
|
+
[Lt]: "Failed to get remote snapshot.",
|
|
1022
|
+
[Ue]: "Failed to load script resources.",
|
|
1023
|
+
[Io]: "Please call createInstance first.",
|
|
1024
|
+
[Ct]: 'The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use "createInstance" api.',
|
|
1025
|
+
[Ft]: "The remoteEntry URL is missing from the remote snapshot.",
|
|
1026
|
+
[$o]: 'The getter for the shared module is not a function. This may be caused by setting "shared.import: false" without the host providing the corresponding lib.',
|
|
1027
|
+
[Ht]: "The manifest is not a valid Module Federation manifest.",
|
|
1028
|
+
[Dt]: "The remote does not expose the requested module.",
|
|
1029
|
+
[xt]: "Remote container initialization failed."
|
|
992
1030
|
};
|
|
993
1031
|
({
|
|
994
|
-
...
|
|
1032
|
+
...M
|
|
995
1033
|
});
|
|
996
|
-
const
|
|
997
|
-
async function
|
|
1034
|
+
const Gt = ".then(callbacks[0]).catch(callbacks[1])";
|
|
1035
|
+
async function To({ entry: e, remoteEntryExports: t }) {
|
|
998
1036
|
return new Promise((r, o) => {
|
|
999
1037
|
try {
|
|
1000
|
-
t ? r(t) : typeof FEDERATION_ALLOW_NEW_FUNCTION < "u" ? new Function("callbacks", `import("${e}")${
|
|
1038
|
+
t ? r(t) : typeof FEDERATION_ALLOW_NEW_FUNCTION < "u" ? new Function("callbacks", `import("${e}")${Gt}`)([r, o]) : import(
|
|
1001
1039
|
/* webpackIgnore: true */
|
|
1002
1040
|
/* @vite-ignore */
|
|
1003
1041
|
e
|
|
@@ -1007,68 +1045,68 @@ async function mo({ entry: e, remoteEntryExports: t }) {
|
|
|
1007
1045
|
}
|
|
1008
1046
|
});
|
|
1009
1047
|
}
|
|
1010
|
-
async function
|
|
1048
|
+
async function vo({ entry: e, remoteEntryExports: t }) {
|
|
1011
1049
|
return new Promise((r, o) => {
|
|
1012
1050
|
try {
|
|
1013
|
-
t ? r(t) : typeof __system_context__ > "u" ? System.import(e).then(r).catch(o) : new Function("callbacks", `System.import("${e}")${
|
|
1051
|
+
t ? r(t) : typeof __system_context__ > "u" ? System.import(e).then(r).catch(o) : new Function("callbacks", `System.import("${e}")${Gt}`)([r, o]);
|
|
1014
1052
|
} catch (n) {
|
|
1015
1053
|
w(`Failed to load SystemJS entry from "${e}". ${n instanceof Error ? n.message : String(n)}`);
|
|
1016
1054
|
}
|
|
1017
1055
|
});
|
|
1018
1056
|
}
|
|
1019
|
-
function
|
|
1020
|
-
const { remoteEntryKey: o, entryExports: n } =
|
|
1021
|
-
return n || w(
|
|
1057
|
+
function Ut(e, t, r) {
|
|
1058
|
+
const { remoteEntryKey: o, entryExports: n } = He(e, t);
|
|
1059
|
+
return n || w(At, M, {
|
|
1022
1060
|
remoteName: e,
|
|
1023
1061
|
remoteEntryUrl: r,
|
|
1024
1062
|
remoteEntryKey: o
|
|
1025
1063
|
}), n;
|
|
1026
1064
|
}
|
|
1027
|
-
async function
|
|
1028
|
-
const { entryExports: c } =
|
|
1065
|
+
async function No({ name: e, globalName: t, entry: r, remoteInfo: o, loaderHook: n, getEntryUrl: s, resourceContext: i }) {
|
|
1066
|
+
const { entryExports: c } = He(e, t);
|
|
1029
1067
|
if (c) return c;
|
|
1030
|
-
const
|
|
1031
|
-
return
|
|
1068
|
+
const a = s ? s(r) : r;
|
|
1069
|
+
return Sr(a, {
|
|
1032
1070
|
attrs: {},
|
|
1033
1071
|
createScriptHook: (l, u) => {
|
|
1034
|
-
const
|
|
1072
|
+
const h = n.lifecycle.createScript.emit({
|
|
1035
1073
|
url: l,
|
|
1036
1074
|
attrs: u,
|
|
1037
1075
|
remoteInfo: o,
|
|
1038
|
-
resourceContext:
|
|
1039
|
-
...
|
|
1076
|
+
resourceContext: i ? {
|
|
1077
|
+
...i,
|
|
1040
1078
|
url: l
|
|
1041
1079
|
} : void 0
|
|
1042
1080
|
});
|
|
1043
|
-
if (
|
|
1044
|
-
return
|
|
1081
|
+
if (h && (h instanceof HTMLScriptElement || "script" in h || "timeout" in h))
|
|
1082
|
+
return h;
|
|
1045
1083
|
}
|
|
1046
|
-
}).then(() =>
|
|
1084
|
+
}).then(() => Ut(e, t, r), (l) => {
|
|
1047
1085
|
const u = l instanceof Error ? l.message : String(l);
|
|
1048
|
-
w(
|
|
1086
|
+
w(Ue, M, {
|
|
1049
1087
|
remoteName: e,
|
|
1050
|
-
resourceUrl:
|
|
1088
|
+
resourceUrl: a
|
|
1051
1089
|
}, u);
|
|
1052
1090
|
});
|
|
1053
1091
|
}
|
|
1054
|
-
async function
|
|
1055
|
-
const { entry: s, entryGlobalName:
|
|
1056
|
-
switch (
|
|
1092
|
+
async function Ao({ remoteInfo: e, remoteEntryExports: t, loaderHook: r, getEntryUrl: o, resourceContext: n }) {
|
|
1093
|
+
const { entry: s, entryGlobalName: i, name: c, type: a } = e;
|
|
1094
|
+
switch (a) {
|
|
1057
1095
|
case "esm":
|
|
1058
1096
|
case "module":
|
|
1059
|
-
return
|
|
1097
|
+
return To({
|
|
1060
1098
|
entry: s,
|
|
1061
1099
|
remoteEntryExports: t
|
|
1062
1100
|
});
|
|
1063
1101
|
case "system":
|
|
1064
|
-
return
|
|
1102
|
+
return vo({
|
|
1065
1103
|
entry: s,
|
|
1066
1104
|
remoteEntryExports: t
|
|
1067
1105
|
});
|
|
1068
1106
|
default:
|
|
1069
|
-
return
|
|
1107
|
+
return No({
|
|
1070
1108
|
entry: s,
|
|
1071
|
-
globalName:
|
|
1109
|
+
globalName: i,
|
|
1072
1110
|
name: c,
|
|
1073
1111
|
remoteInfo: e,
|
|
1074
1112
|
loaderHook: r,
|
|
@@ -1077,52 +1115,52 @@ async function Eo({ remoteInfo: e, remoteEntryExports: t, loaderHook: r, getEntr
|
|
|
1077
1115
|
});
|
|
1078
1116
|
}
|
|
1079
1117
|
}
|
|
1080
|
-
async function
|
|
1081
|
-
const { entry: o, entryGlobalName: n, name: s, type:
|
|
1082
|
-
return c ||
|
|
1118
|
+
async function Mo({ remoteInfo: e, loaderHook: t, resourceContext: r }) {
|
|
1119
|
+
const { entry: o, entryGlobalName: n, name: s, type: i } = e, { entryExports: c } = He(s, n);
|
|
1120
|
+
return c || Ir(o, {
|
|
1083
1121
|
attrs: {
|
|
1084
1122
|
name: s,
|
|
1085
1123
|
globalName: n,
|
|
1086
|
-
type:
|
|
1124
|
+
type: i
|
|
1087
1125
|
},
|
|
1088
|
-
loaderHook: { createScriptHook: (
|
|
1126
|
+
loaderHook: { createScriptHook: (a, l = {}) => {
|
|
1089
1127
|
const u = t.lifecycle.createScript.emit({
|
|
1090
|
-
url:
|
|
1128
|
+
url: a,
|
|
1091
1129
|
attrs: l,
|
|
1092
1130
|
remoteInfo: e,
|
|
1093
1131
|
resourceContext: r ? {
|
|
1094
1132
|
...r,
|
|
1095
|
-
url:
|
|
1133
|
+
url: a
|
|
1096
1134
|
} : void 0
|
|
1097
1135
|
});
|
|
1098
1136
|
if (u && "url" in u)
|
|
1099
1137
|
return u;
|
|
1100
1138
|
} }
|
|
1101
|
-
}).then(() =>
|
|
1102
|
-
w(`Failed to load Node.js entry for remote "${s}" from "${o}". ${
|
|
1139
|
+
}).then(() => Ut(s, n, o)).catch((a) => {
|
|
1140
|
+
w(`Failed to load Node.js entry for remote "${s}" from "${o}". ${a instanceof Error ? a.message : String(a)}`);
|
|
1103
1141
|
});
|
|
1104
1142
|
}
|
|
1105
|
-
function
|
|
1143
|
+
function Le(e) {
|
|
1106
1144
|
const { entry: t, name: r } = e;
|
|
1107
|
-
return
|
|
1145
|
+
return st(r, t);
|
|
1108
1146
|
}
|
|
1109
|
-
async function
|
|
1110
|
-
const { origin: t, remoteEntryExports: r, remoteInfo: o, getEntryUrl: n, resourceContext: s, _inErrorHandling:
|
|
1147
|
+
async function Be(e) {
|
|
1148
|
+
const { origin: t, remoteEntryExports: r, remoteInfo: o, getEntryUrl: n, resourceContext: s, _inErrorHandling: i = !1 } = e, c = Le(o);
|
|
1111
1149
|
if (r) return r;
|
|
1112
|
-
if (!
|
|
1113
|
-
const
|
|
1114
|
-
|
|
1150
|
+
if (!J[c]) {
|
|
1151
|
+
const a = t.remoteHandler.hooks.lifecycle.loadEntry, l = t.loaderHook;
|
|
1152
|
+
J[c] = a.emit({
|
|
1115
1153
|
origin: t,
|
|
1116
1154
|
loaderHook: l,
|
|
1117
1155
|
remoteInfo: o,
|
|
1118
1156
|
remoteEntryExports: r
|
|
1119
|
-
}).then((u) => u || ((typeof ENV_TARGET < "u" ? ENV_TARGET === "web" :
|
|
1157
|
+
}).then((u) => u || ((typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : G) ? Ao({
|
|
1120
1158
|
remoteInfo: o,
|
|
1121
1159
|
remoteEntryExports: r,
|
|
1122
1160
|
loaderHook: l,
|
|
1123
1161
|
getEntryUrl: n,
|
|
1124
1162
|
resourceContext: s
|
|
1125
|
-
}) :
|
|
1163
|
+
}) : Mo({
|
|
1126
1164
|
remoteInfo: o,
|
|
1127
1165
|
loaderHook: l,
|
|
1128
1166
|
resourceContext: s
|
|
@@ -1131,18 +1169,18 @@ async function Ue(e) {
|
|
|
1131
1169
|
remoteInfo: o,
|
|
1132
1170
|
remoteEntryExports: u
|
|
1133
1171
|
}), u)).catch(async (u) => {
|
|
1134
|
-
const
|
|
1135
|
-
if (u instanceof Error && u.message.includes(
|
|
1136
|
-
const
|
|
1172
|
+
const h = Le(o), m = u instanceof Error && u.message.includes("ScriptExecutionError");
|
|
1173
|
+
if (u instanceof Error && u.message.includes(Ue) && !m && !i) {
|
|
1174
|
+
const f = (p) => Be({
|
|
1137
1175
|
...p,
|
|
1138
1176
|
_inErrorHandling: !0
|
|
1139
1177
|
}), d = await t.loaderHook.lifecycle.loadEntryError.emit({
|
|
1140
|
-
getRemoteEntry:
|
|
1178
|
+
getRemoteEntry: f,
|
|
1141
1179
|
origin: t,
|
|
1142
1180
|
remoteInfo: o,
|
|
1143
1181
|
remoteEntryExports: r,
|
|
1144
|
-
globalLoading:
|
|
1145
|
-
uniqueKey:
|
|
1182
|
+
globalLoading: J,
|
|
1183
|
+
uniqueKey: h
|
|
1146
1184
|
});
|
|
1147
1185
|
if (d)
|
|
1148
1186
|
return await t.loaderHook.lifecycle.afterLoadEntry.emit({
|
|
@@ -1159,22 +1197,22 @@ async function Ue(e) {
|
|
|
1159
1197
|
}), u;
|
|
1160
1198
|
});
|
|
1161
1199
|
}
|
|
1162
|
-
return
|
|
1200
|
+
return J[c];
|
|
1163
1201
|
}
|
|
1164
|
-
function
|
|
1202
|
+
function K(e) {
|
|
1165
1203
|
return {
|
|
1166
1204
|
...e,
|
|
1167
1205
|
entry: "entry" in e ? e.entry : "",
|
|
1168
|
-
type: e.type ||
|
|
1206
|
+
type: e.type || Tt,
|
|
1169
1207
|
entryGlobalName: e.entryGlobalName || e.name,
|
|
1170
|
-
shareScope: e.shareScope ||
|
|
1208
|
+
shareScope: e.shareScope || ce
|
|
1171
1209
|
};
|
|
1172
1210
|
}
|
|
1173
|
-
function
|
|
1211
|
+
function Po() {
|
|
1174
1212
|
return typeof FEDERATION_BUILD_IDENTIFIER < "u" ? FEDERATION_BUILD_IDENTIFIER : "";
|
|
1175
1213
|
}
|
|
1176
|
-
function
|
|
1177
|
-
const r =
|
|
1214
|
+
function ko(e, t) {
|
|
1215
|
+
const r = Ur(), o = [
|
|
1178
1216
|
t.hooks,
|
|
1179
1217
|
t.remoteHandler.hooks,
|
|
1180
1218
|
t.sharedHandler.hooks,
|
|
@@ -1190,7 +1228,7 @@ function Ro(e, t) {
|
|
|
1190
1228
|
});
|
|
1191
1229
|
}), e;
|
|
1192
1230
|
}
|
|
1193
|
-
function
|
|
1231
|
+
function Oo(e) {
|
|
1194
1232
|
return {
|
|
1195
1233
|
name: e.name,
|
|
1196
1234
|
alias: e.alias,
|
|
@@ -1202,11 +1240,11 @@ function bo(e) {
|
|
|
1202
1240
|
};
|
|
1203
1241
|
}
|
|
1204
1242
|
function F(e) {
|
|
1205
|
-
var r, o, n, s,
|
|
1243
|
+
var r, o, n, s, i, c;
|
|
1206
1244
|
const t = {};
|
|
1207
|
-
for (const [
|
|
1245
|
+
for (const [a, l] of Object.entries(e.shared)) {
|
|
1208
1246
|
const u = l[0];
|
|
1209
|
-
u && (t[
|
|
1247
|
+
u && (t[a] = {
|
|
1210
1248
|
version: u.version,
|
|
1211
1249
|
singleton: (r = u.shareConfig) == null ? void 0 : r.singleton,
|
|
1212
1250
|
requiredVersion: ((o = u.shareConfig) == null ? void 0 : o.requiredVersion) === !1 ? !1 : (n = u.shareConfig) == null ? void 0 : n.requiredVersion,
|
|
@@ -1217,16 +1255,16 @@ function F(e) {
|
|
|
1217
1255
|
return {
|
|
1218
1256
|
project: {
|
|
1219
1257
|
name: e.name,
|
|
1220
|
-
mfRole: ((
|
|
1258
|
+
mfRole: ((i = e.remotes) == null ? void 0 : i.length) > 0 ? "host" : "unknown"
|
|
1221
1259
|
},
|
|
1222
1260
|
mfConfig: {
|
|
1223
1261
|
name: e.name,
|
|
1224
|
-
remotes: ((c = e.remotes) == null ? void 0 : c.map(
|
|
1262
|
+
remotes: ((c = e.remotes) == null ? void 0 : c.map(Oo)) ?? [],
|
|
1225
1263
|
shared: t
|
|
1226
1264
|
}
|
|
1227
1265
|
};
|
|
1228
1266
|
}
|
|
1229
|
-
function
|
|
1267
|
+
function Bt(e) {
|
|
1230
1268
|
return {
|
|
1231
1269
|
resourceCategory: "sync",
|
|
1232
1270
|
share: !0,
|
|
@@ -1234,25 +1272,25 @@ function Ft(e) {
|
|
|
1234
1272
|
...e
|
|
1235
1273
|
};
|
|
1236
1274
|
}
|
|
1237
|
-
function
|
|
1275
|
+
function Lo(e, t) {
|
|
1238
1276
|
return t.map((r) => {
|
|
1239
|
-
const o =
|
|
1240
|
-
return
|
|
1277
|
+
const o = wo(e, r.nameOrAlias);
|
|
1278
|
+
return L(o, `Unable to preload ${r.nameOrAlias} as it is not included in ${!o && at({
|
|
1241
1279
|
remoteInfo: o,
|
|
1242
1280
|
remotes: e
|
|
1243
1281
|
})}`), {
|
|
1244
1282
|
remote: o,
|
|
1245
|
-
preloadConfig:
|
|
1283
|
+
preloadConfig: Bt(r)
|
|
1246
1284
|
};
|
|
1247
1285
|
});
|
|
1248
1286
|
}
|
|
1249
|
-
function
|
|
1287
|
+
function Co(e) {
|
|
1250
1288
|
return e ? e.map((t) => t === "." ? t : t.startsWith("./") ? t.replace("./", "") : t) : [];
|
|
1251
1289
|
}
|
|
1252
|
-
function
|
|
1290
|
+
function je(e) {
|
|
1253
1291
|
return e instanceof Error ? e.message.includes("timed out") || e.name.includes("Timeout") : !1;
|
|
1254
1292
|
}
|
|
1255
|
-
function
|
|
1293
|
+
function j(e, t, r, o) {
|
|
1256
1294
|
return {
|
|
1257
1295
|
url: t,
|
|
1258
1296
|
status: r,
|
|
@@ -1262,11 +1300,11 @@ function U(e, t, r, o) {
|
|
|
1262
1300
|
error: o
|
|
1263
1301
|
};
|
|
1264
1302
|
}
|
|
1265
|
-
async function
|
|
1303
|
+
async function Fo(e, t, r, o) {
|
|
1266
1304
|
const n = e.moduleCache.get(r.name), s = r.entry;
|
|
1267
|
-
if (n != null && n.remoteEntryExports) return
|
|
1305
|
+
if (n != null && n.remoteEntryExports) return j(o, s, "cached");
|
|
1268
1306
|
try {
|
|
1269
|
-
if (!await
|
|
1307
|
+
if (!await Be({
|
|
1270
1308
|
origin: e,
|
|
1271
1309
|
remoteInfo: r,
|
|
1272
1310
|
remoteEntryExports: n == null ? void 0 : n.remoteEntryExports,
|
|
@@ -1275,24 +1313,24 @@ async function $o(e, t, r, o) {
|
|
|
1275
1313
|
url: s
|
|
1276
1314
|
}
|
|
1277
1315
|
})) throw new Error(`Failed to load remoteEntry "${s}".`);
|
|
1278
|
-
return
|
|
1279
|
-
} catch (
|
|
1280
|
-
return
|
|
1316
|
+
return j(o, s, "success");
|
|
1317
|
+
} catch (i) {
|
|
1318
|
+
return j(o, s, je(i) ? "timeout" : "error", i);
|
|
1281
1319
|
}
|
|
1282
1320
|
}
|
|
1283
1321
|
function $e({ host: e, remoteInfo: t, url: r, attrs: o, context: n, needDeleteLink: s }) {
|
|
1284
|
-
return new Promise((
|
|
1285
|
-
const { link: c, needAttach:
|
|
1322
|
+
return new Promise((i) => {
|
|
1323
|
+
const { link: c, needAttach: a } = _r({
|
|
1286
1324
|
url: r,
|
|
1287
1325
|
cb: () => {
|
|
1288
|
-
|
|
1326
|
+
i(j(n, r, a ? "success" : "cached"));
|
|
1289
1327
|
},
|
|
1290
1328
|
onErrorCallback: (l) => {
|
|
1291
|
-
|
|
1329
|
+
i(j(n, r, je(l) ? "timeout" : "error", l));
|
|
1292
1330
|
},
|
|
1293
1331
|
attrs: o,
|
|
1294
1332
|
createLinkHook: (l, u) => {
|
|
1295
|
-
const
|
|
1333
|
+
const h = e.loaderHook.lifecycle.createLink.emit({
|
|
1296
1334
|
url: l,
|
|
1297
1335
|
attrs: u,
|
|
1298
1336
|
remoteInfo: t,
|
|
@@ -1301,68 +1339,68 @@ function $e({ host: e, remoteInfo: t, url: r, attrs: o, context: n, needDeleteLi
|
|
|
1301
1339
|
url: l
|
|
1302
1340
|
}
|
|
1303
1341
|
});
|
|
1304
|
-
return
|
|
1342
|
+
return h instanceof HTMLLinkElement, h;
|
|
1305
1343
|
},
|
|
1306
1344
|
needDeleteLink: s
|
|
1307
1345
|
});
|
|
1308
|
-
|
|
1346
|
+
a && document.head.appendChild(c);
|
|
1309
1347
|
});
|
|
1310
1348
|
}
|
|
1311
|
-
function
|
|
1349
|
+
function Ho({ host: e, remoteInfo: t, url: r, attrs: o, context: n }) {
|
|
1312
1350
|
return new Promise((s) => {
|
|
1313
|
-
const { script:
|
|
1351
|
+
const { script: i, needAttach: c } = ft({
|
|
1314
1352
|
url: r,
|
|
1315
1353
|
cb: () => {
|
|
1316
|
-
s(
|
|
1354
|
+
s(j(n, r, c ? "success" : "cached"));
|
|
1317
1355
|
},
|
|
1318
|
-
onErrorCallback: (
|
|
1319
|
-
s(
|
|
1356
|
+
onErrorCallback: (a) => {
|
|
1357
|
+
s(j(n, r, je(a) ? "timeout" : "error", a));
|
|
1320
1358
|
},
|
|
1321
1359
|
attrs: o,
|
|
1322
|
-
createScriptHook: (
|
|
1360
|
+
createScriptHook: (a, l) => {
|
|
1323
1361
|
const u = e.loaderHook.lifecycle.createScript.emit({
|
|
1324
|
-
url:
|
|
1362
|
+
url: a,
|
|
1325
1363
|
attrs: l,
|
|
1326
1364
|
remoteInfo: t,
|
|
1327
1365
|
resourceContext: {
|
|
1328
1366
|
...n,
|
|
1329
|
-
url:
|
|
1367
|
+
url: a
|
|
1330
1368
|
}
|
|
1331
1369
|
});
|
|
1332
1370
|
return u instanceof HTMLScriptElement, u;
|
|
1333
1371
|
},
|
|
1334
1372
|
needDeleteScript: !0
|
|
1335
1373
|
});
|
|
1336
|
-
c && document.head.appendChild(
|
|
1374
|
+
c && document.head.appendChild(i);
|
|
1337
1375
|
});
|
|
1338
1376
|
}
|
|
1339
|
-
function
|
|
1377
|
+
function ee(e, t) {
|
|
1340
1378
|
return {
|
|
1341
1379
|
...e,
|
|
1342
1380
|
resourceType: t
|
|
1343
1381
|
};
|
|
1344
1382
|
}
|
|
1345
|
-
function
|
|
1383
|
+
function jt(e, t, r, o = !0, n = {
|
|
1346
1384
|
initiator: "preloadRemote",
|
|
1347
1385
|
id: e.name
|
|
1348
1386
|
}) {
|
|
1349
|
-
const { cssAssets: s, jsAssetsWithoutEntry:
|
|
1387
|
+
const { cssAssets: s, jsAssetsWithoutEntry: i, entryAssets: c } = r, a = [];
|
|
1350
1388
|
if (t.options.inBrowser) {
|
|
1351
1389
|
if (c.forEach((l) => {
|
|
1352
1390
|
const { moduleInfo: u } = l;
|
|
1353
|
-
|
|
1391
|
+
a.push(Fo(t, e, u, ee(n, "remoteEntry")));
|
|
1354
1392
|
}), o) {
|
|
1355
1393
|
const l = {
|
|
1356
1394
|
rel: "preload",
|
|
1357
1395
|
as: "style"
|
|
1358
1396
|
};
|
|
1359
1397
|
s.forEach((u) => {
|
|
1360
|
-
|
|
1398
|
+
a.push($e({
|
|
1361
1399
|
host: t,
|
|
1362
1400
|
remoteInfo: e,
|
|
1363
1401
|
url: u,
|
|
1364
1402
|
attrs: l,
|
|
1365
|
-
context:
|
|
1403
|
+
context: ee(n, "css")
|
|
1366
1404
|
}));
|
|
1367
1405
|
});
|
|
1368
1406
|
} else {
|
|
@@ -1371,13 +1409,13 @@ function Ht(e, t, r, o = !0, n = {
|
|
|
1371
1409
|
type: "text/css"
|
|
1372
1410
|
};
|
|
1373
1411
|
s.forEach((u) => {
|
|
1374
|
-
|
|
1412
|
+
a.push($e({
|
|
1375
1413
|
host: t,
|
|
1376
1414
|
remoteInfo: e,
|
|
1377
1415
|
url: u,
|
|
1378
1416
|
attrs: l,
|
|
1379
1417
|
needDeleteLink: !1,
|
|
1380
|
-
context:
|
|
1418
|
+
context: ee(n, "css")
|
|
1381
1419
|
}));
|
|
1382
1420
|
});
|
|
1383
1421
|
}
|
|
@@ -1386,13 +1424,13 @@ function Ht(e, t, r, o = !0, n = {
|
|
|
1386
1424
|
rel: "preload",
|
|
1387
1425
|
as: "script"
|
|
1388
1426
|
};
|
|
1389
|
-
|
|
1390
|
-
|
|
1427
|
+
i.forEach((u) => {
|
|
1428
|
+
a.push($e({
|
|
1391
1429
|
host: t,
|
|
1392
1430
|
remoteInfo: e,
|
|
1393
1431
|
url: u,
|
|
1394
1432
|
attrs: l,
|
|
1395
|
-
context:
|
|
1433
|
+
context: ee(n, "js")
|
|
1396
1434
|
}));
|
|
1397
1435
|
});
|
|
1398
1436
|
} else {
|
|
@@ -1400,28 +1438,28 @@ function Ht(e, t, r, o = !0, n = {
|
|
|
1400
1438
|
fetchpriority: "high",
|
|
1401
1439
|
type: (e == null ? void 0 : e.type) === "module" ? "module" : "text/javascript"
|
|
1402
1440
|
};
|
|
1403
|
-
|
|
1404
|
-
|
|
1441
|
+
i.forEach((u) => {
|
|
1442
|
+
a.push(Ho({
|
|
1405
1443
|
host: t,
|
|
1406
1444
|
remoteInfo: e,
|
|
1407
1445
|
url: u,
|
|
1408
1446
|
attrs: l,
|
|
1409
|
-
context:
|
|
1447
|
+
context: ee(n, "js")
|
|
1410
1448
|
}));
|
|
1411
1449
|
});
|
|
1412
1450
|
}
|
|
1413
1451
|
}
|
|
1414
|
-
return Promise.all(
|
|
1452
|
+
return Promise.all(a);
|
|
1415
1453
|
}
|
|
1416
|
-
function
|
|
1454
|
+
function Do(e) {
|
|
1417
1455
|
if (!e || !("modules" in e) || !Array.isArray(e.modules)) return;
|
|
1418
1456
|
const t = e.modules.map((r) => r.moduleName).filter(Boolean);
|
|
1419
1457
|
return t.length ? t.join(",") : void 0;
|
|
1420
1458
|
}
|
|
1421
|
-
function
|
|
1459
|
+
function xo(e, t, r) {
|
|
1422
1460
|
const o = t, n = Array.isArray(e.shareScope) ? e.shareScope : [e.shareScope];
|
|
1423
|
-
n.length || n.push("default"), n.forEach((
|
|
1424
|
-
o[
|
|
1461
|
+
n.length || n.push("default"), n.forEach((i) => {
|
|
1462
|
+
o[i] || (o[i] = {});
|
|
1425
1463
|
});
|
|
1426
1464
|
const s = {
|
|
1427
1465
|
version: e.version || "",
|
|
@@ -1436,24 +1474,24 @@ function To(e, t, r) {
|
|
|
1436
1474
|
initScope: r ?? []
|
|
1437
1475
|
};
|
|
1438
1476
|
}
|
|
1439
|
-
var
|
|
1477
|
+
var et = class {
|
|
1440
1478
|
constructor({ remoteInfo: e, host: t }) {
|
|
1441
1479
|
this.inited = !1, this.initing = !1, this.lib = void 0, this.remoteInfo = e, this.host = t;
|
|
1442
1480
|
}
|
|
1443
1481
|
async getEntry(e) {
|
|
1444
1482
|
if (this.remoteEntryExports) return this.remoteEntryExports;
|
|
1445
|
-
const t = await
|
|
1483
|
+
const t = await Be({
|
|
1446
1484
|
origin: this.host,
|
|
1447
1485
|
remoteInfo: this.remoteInfo,
|
|
1448
1486
|
remoteEntryExports: this.remoteEntryExports,
|
|
1449
1487
|
resourceContext: {
|
|
1450
1488
|
initiator: "loadRemote",
|
|
1451
|
-
id:
|
|
1489
|
+
id: Ge(this.remoteInfo.name, e),
|
|
1452
1490
|
resourceType: "remoteEntry"
|
|
1453
1491
|
}
|
|
1454
1492
|
});
|
|
1455
|
-
return
|
|
1456
|
-
${
|
|
1493
|
+
return L(t, `remoteEntryExports is undefined
|
|
1494
|
+
${at(this.remoteInfo)}`), this.remoteEntryExports = t, this.remoteEntryExports;
|
|
1457
1495
|
}
|
|
1458
1496
|
async init(e, t, r, o) {
|
|
1459
1497
|
const n = await this.getEntry(o);
|
|
@@ -1496,23 +1534,23 @@ var Dt = class {
|
|
|
1496
1534
|
remoteSnapshot: t,
|
|
1497
1535
|
origin: this.host
|
|
1498
1536
|
});
|
|
1499
|
-
const { remoteEntryInitOptions: s, shareScope:
|
|
1500
|
-
shareScope:
|
|
1537
|
+
const { remoteEntryInitOptions: s, shareScope: i, initScope: c } = xo(this.remoteInfo, this.host.shareScopeMap, r), a = await this.host.hooks.lifecycle.beforeInitContainer.emit({
|
|
1538
|
+
shareScope: i,
|
|
1501
1539
|
remoteEntryInitOptions: s,
|
|
1502
1540
|
initScope: c,
|
|
1503
1541
|
remoteInfo: this.remoteInfo,
|
|
1504
1542
|
origin: this.host
|
|
1505
1543
|
});
|
|
1506
|
-
typeof (n == null ? void 0 : n.init) > "u" && w(
|
|
1544
|
+
typeof (n == null ? void 0 : n.init) > "u" && w(Mt, M, {
|
|
1507
1545
|
hostName: this.host.name,
|
|
1508
1546
|
remoteName: this.remoteInfo.name,
|
|
1509
1547
|
remoteEntryUrl: this.remoteInfo.entry,
|
|
1510
1548
|
remoteEntryKey: this.remoteInfo.entryGlobalName
|
|
1511
1549
|
}, void 0, F(this.host.options));
|
|
1512
1550
|
try {
|
|
1513
|
-
await n.init(
|
|
1551
|
+
await n.init(a.shareScope, a.initScope, a.remoteEntryInitOptions);
|
|
1514
1552
|
} catch (l) {
|
|
1515
|
-
w(
|
|
1553
|
+
w(xt, M, {
|
|
1516
1554
|
hostName: this.host.name,
|
|
1517
1555
|
remoteName: this.remoteInfo.name,
|
|
1518
1556
|
remoteEntryUrl: this.remoteInfo.entry,
|
|
@@ -1521,7 +1559,7 @@ var Dt = class {
|
|
|
1521
1559
|
}, `${l}`, F(this.host.options));
|
|
1522
1560
|
}
|
|
1523
1561
|
await this.host.hooks.lifecycle.initContainer.emit({
|
|
1524
|
-
...
|
|
1562
|
+
...a,
|
|
1525
1563
|
id: e,
|
|
1526
1564
|
remoteSnapshot: t,
|
|
1527
1565
|
remoteEntryExports: n
|
|
@@ -1558,26 +1596,26 @@ var Dt = class {
|
|
|
1558
1596
|
remoteEntryExports: s,
|
|
1559
1597
|
origin: this.host
|
|
1560
1598
|
});
|
|
1561
|
-
let
|
|
1599
|
+
let i;
|
|
1562
1600
|
try {
|
|
1563
1601
|
const l = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
1564
1602
|
remoteEntryExports: s,
|
|
1565
1603
|
expose: t,
|
|
1566
1604
|
moduleInfo: this.remoteInfo
|
|
1567
1605
|
});
|
|
1568
|
-
|
|
1606
|
+
i = typeof l == "function" ? l : void 0, i || (i = await s.get(t)), i || w(Dt, M, {
|
|
1569
1607
|
hostName: this.host.name,
|
|
1570
1608
|
remoteName: this.remoteInfo.name,
|
|
1571
1609
|
remoteEntryUrl: this.remoteInfo.entry,
|
|
1572
1610
|
expose: t,
|
|
1573
1611
|
requestId: e,
|
|
1574
|
-
availableExposes:
|
|
1612
|
+
availableExposes: Do(o)
|
|
1575
1613
|
}, void 0, F(this.host.options)), await this.host.loaderHook.lifecycle.afterGetExpose.emit({
|
|
1576
1614
|
id: e,
|
|
1577
1615
|
expose: t,
|
|
1578
1616
|
moduleInfo: this.remoteInfo,
|
|
1579
1617
|
remoteEntryExports: s,
|
|
1580
|
-
moduleFactory:
|
|
1618
|
+
moduleFactory: i,
|
|
1581
1619
|
origin: this.host
|
|
1582
1620
|
});
|
|
1583
1621
|
} catch (l) {
|
|
@@ -1590,8 +1628,8 @@ var Dt = class {
|
|
|
1590
1628
|
origin: this.host
|
|
1591
1629
|
}), l;
|
|
1592
1630
|
}
|
|
1593
|
-
const c =
|
|
1594
|
-
if (!n) return
|
|
1631
|
+
const c = Hr(this.remoteInfo.name, t), a = this.wraperFactory(i, c);
|
|
1632
|
+
if (!n) return a;
|
|
1595
1633
|
await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({
|
|
1596
1634
|
id: e,
|
|
1597
1635
|
expose: t,
|
|
@@ -1600,7 +1638,7 @@ var Dt = class {
|
|
|
1600
1638
|
origin: this.host
|
|
1601
1639
|
});
|
|
1602
1640
|
try {
|
|
1603
|
-
const l = await
|
|
1641
|
+
const l = await a();
|
|
1604
1642
|
return await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({
|
|
1605
1643
|
id: e,
|
|
1606
1644
|
expose: t,
|
|
@@ -1632,6 +1670,26 @@ var Dt = class {
|
|
|
1632
1670
|
return o instanceof Promise ? o.then((n) => (r(n, t), n)) : (r(o, t), o);
|
|
1633
1671
|
};
|
|
1634
1672
|
}
|
|
1673
|
+
}, H = class {
|
|
1674
|
+
constructor(e) {
|
|
1675
|
+
this.registerPlugins = {}, this.lifecycle = e, this.lifecycleKeys = Object.keys(e);
|
|
1676
|
+
}
|
|
1677
|
+
applyPlugin(e, t) {
|
|
1678
|
+
var o;
|
|
1679
|
+
L(Fr(e), "Plugin configuration is invalid.");
|
|
1680
|
+
const r = e.name;
|
|
1681
|
+
L(r, "A name must be provided by the plugin."), this.registerPlugins[r] || (this.registerPlugins[r] = e, (o = e.apply) == null || o.call(e, t), Object.keys(this.lifecycle).forEach((n) => {
|
|
1682
|
+
const s = e[n];
|
|
1683
|
+
s && this.lifecycle[n].on(s);
|
|
1684
|
+
}));
|
|
1685
|
+
}
|
|
1686
|
+
removePlugin(e) {
|
|
1687
|
+
L(e, "A name is required.");
|
|
1688
|
+
const t = this.registerPlugins[e];
|
|
1689
|
+
L(t, `The plugin "${e}" is not registered.`), Object.keys(t).forEach((r) => {
|
|
1690
|
+
r !== "name" && this.lifecycle[r].remove(t[r]);
|
|
1691
|
+
});
|
|
1692
|
+
}
|
|
1635
1693
|
}, A = class {
|
|
1636
1694
|
constructor(e) {
|
|
1637
1695
|
this.type = "", this.listeners = /* @__PURE__ */ new Set(), e && (this.type = e);
|
|
@@ -1658,61 +1716,61 @@ var Dt = class {
|
|
|
1658
1716
|
removeAll() {
|
|
1659
1717
|
this.listeners.clear();
|
|
1660
1718
|
}
|
|
1661
|
-
},
|
|
1719
|
+
}, T = class extends A {
|
|
1662
1720
|
emit(...e) {
|
|
1663
1721
|
let t;
|
|
1664
1722
|
const r = Array.from(this.listeners);
|
|
1665
1723
|
if (r.length > 0) {
|
|
1666
1724
|
let o = 0;
|
|
1667
|
-
const n = (s) => s === !1 ? !1 : o < r.length ? Promise.resolve(r[o++].apply(null, e)).then((
|
|
1725
|
+
const n = (s) => s === !1 ? !1 : o < r.length ? Promise.resolve(r[o++].apply(null, e)).then((i) => i === void 0 || e.length === 1 && i === e[0] ? n(s) : n(i)) : s;
|
|
1668
1726
|
t = n();
|
|
1669
1727
|
}
|
|
1670
1728
|
return Promise.resolve(t);
|
|
1671
1729
|
}
|
|
1672
1730
|
};
|
|
1673
|
-
function
|
|
1674
|
-
if (!
|
|
1731
|
+
function Wt(e, t) {
|
|
1732
|
+
if (!Fe(t)) return !1;
|
|
1675
1733
|
if (e !== t) {
|
|
1676
1734
|
for (const r in e) if (!(r in t)) return !1;
|
|
1677
1735
|
}
|
|
1678
1736
|
return !0;
|
|
1679
1737
|
}
|
|
1680
|
-
var
|
|
1738
|
+
var X = class extends A {
|
|
1681
1739
|
constructor(e) {
|
|
1682
1740
|
super(), this.onerror = w, this.type = e;
|
|
1683
1741
|
}
|
|
1684
1742
|
emit(e) {
|
|
1685
|
-
|
|
1743
|
+
Fe(e) || w(`The data for the "${this.type}" hook should be an object.`);
|
|
1686
1744
|
for (const t of this.listeners) try {
|
|
1687
1745
|
const r = t(e);
|
|
1688
1746
|
if (r === void 0) continue;
|
|
1689
|
-
if (
|
|
1747
|
+
if (Wt(e, r)) e = r;
|
|
1690
1748
|
else {
|
|
1691
1749
|
this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
|
|
1692
1750
|
break;
|
|
1693
1751
|
}
|
|
1694
1752
|
} catch (r) {
|
|
1695
|
-
|
|
1753
|
+
ne(r), this.onerror(r);
|
|
1696
1754
|
}
|
|
1697
1755
|
return e;
|
|
1698
1756
|
}
|
|
1699
|
-
},
|
|
1757
|
+
}, D = class extends A {
|
|
1700
1758
|
constructor(e) {
|
|
1701
1759
|
super(), this.onerror = w, this.type = e;
|
|
1702
1760
|
}
|
|
1703
1761
|
emit(e) {
|
|
1704
|
-
|
|
1762
|
+
Fe(e) || w(`The response data for the "${this.type}" hook must be an object.`);
|
|
1705
1763
|
const t = Array.from(this.listeners);
|
|
1706
1764
|
if (t.length > 0) {
|
|
1707
1765
|
let r = 0;
|
|
1708
|
-
const o = (s) => (
|
|
1709
|
-
if (s !== void 0 &&
|
|
1766
|
+
const o = (s) => (ne(s), this.onerror(s), e), n = (s) => {
|
|
1767
|
+
if (s !== void 0 && Wt(e, s)) e = s;
|
|
1710
1768
|
else if (s !== void 0)
|
|
1711
1769
|
return this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`), e;
|
|
1712
1770
|
if (r < t.length) try {
|
|
1713
1771
|
return Promise.resolve(t[r++](e)).then(n, o);
|
|
1714
|
-
} catch (
|
|
1715
|
-
return o(
|
|
1772
|
+
} catch (i) {
|
|
1773
|
+
return o(i);
|
|
1716
1774
|
}
|
|
1717
1775
|
return e;
|
|
1718
1776
|
};
|
|
@@ -1720,44 +1778,48 @@ var J = class extends A {
|
|
|
1720
1778
|
}
|
|
1721
1779
|
return Promise.resolve(e);
|
|
1722
1780
|
}
|
|
1723
|
-
}
|
|
1724
|
-
|
|
1725
|
-
|
|
1781
|
+
};
|
|
1782
|
+
const te = "Remote loading is disabled by experiments.optimization.disableRemote.";
|
|
1783
|
+
var Go = class {
|
|
1784
|
+
constructor() {
|
|
1785
|
+
this.hooks = new H({});
|
|
1726
1786
|
}
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
O($r(e), "Plugin configuration is invalid.");
|
|
1730
|
-
const r = e.name;
|
|
1731
|
-
O(r, "A name must be provided by the plugin."), this.registerPlugins[r] || (this.registerPlugins[r] = e, (o = e.apply) == null || o.call(e, t), Object.keys(this.lifecycle).forEach((n) => {
|
|
1732
|
-
const s = e[n];
|
|
1733
|
-
s && this.lifecycle[n].on(s);
|
|
1734
|
-
}));
|
|
1787
|
+
formatAndRegisterRemote() {
|
|
1788
|
+
return [];
|
|
1735
1789
|
}
|
|
1736
|
-
|
|
1737
|
-
|
|
1738
|
-
|
|
1739
|
-
|
|
1740
|
-
|
|
1741
|
-
|
|
1790
|
+
loadRemote() {
|
|
1791
|
+
throw new Error(te);
|
|
1792
|
+
}
|
|
1793
|
+
preloadRemote() {
|
|
1794
|
+
throw new Error(te);
|
|
1795
|
+
}
|
|
1796
|
+
registerRemotes() {
|
|
1797
|
+
throw new Error(te);
|
|
1798
|
+
}
|
|
1799
|
+
getRemoteModuleAndOptions() {
|
|
1800
|
+
throw new Error(te);
|
|
1801
|
+
}
|
|
1802
|
+
initRawContainer() {
|
|
1803
|
+
throw new Error(te);
|
|
1742
1804
|
}
|
|
1743
1805
|
};
|
|
1744
|
-
function
|
|
1745
|
-
const r =
|
|
1746
|
-
r.url || w(
|
|
1747
|
-
let o =
|
|
1748
|
-
!
|
|
1806
|
+
function Vt(e, t) {
|
|
1807
|
+
const r = Rt(t);
|
|
1808
|
+
r.url || w(Ft, M, { remoteName: e.name });
|
|
1809
|
+
let o = Me(t, r.url);
|
|
1810
|
+
!G && !o.startsWith("http") && (o = `https:${o}`), e.type = r.type, e.entryGlobalName = r.globalName, e.entry = o, e.version = t.version, e.buildVersion = t.buildVersion;
|
|
1749
1811
|
}
|
|
1750
|
-
function
|
|
1812
|
+
function Uo() {
|
|
1751
1813
|
return {
|
|
1752
1814
|
name: "snapshot-plugin",
|
|
1753
1815
|
async afterResolve(e) {
|
|
1754
|
-
const { remote: t, pkgNameOrAlias: r, expose: o, origin: n, remoteInfo: s, id:
|
|
1755
|
-
if (!
|
|
1756
|
-
const { remoteSnapshot: c, globalSnapshot:
|
|
1816
|
+
const { remote: t, pkgNameOrAlias: r, expose: o, origin: n, remoteInfo: s, id: i } = e;
|
|
1817
|
+
if (!Ce(t) || !Et(t)) {
|
|
1818
|
+
const { remoteSnapshot: c, globalSnapshot: a } = await n.snapshotHandler.loadRemoteSnapshotInfo({
|
|
1757
1819
|
moduleInfo: t,
|
|
1758
|
-
id:
|
|
1820
|
+
id: Ge(t.name, o)
|
|
1759
1821
|
});
|
|
1760
|
-
|
|
1822
|
+
Vt(s, c);
|
|
1761
1823
|
const l = {
|
|
1762
1824
|
remote: t,
|
|
1763
1825
|
preloadConfig: {
|
|
@@ -1773,11 +1835,11 @@ function No() {
|
|
|
1773
1835
|
remoteInfo: s,
|
|
1774
1836
|
remote: t,
|
|
1775
1837
|
remoteSnapshot: c,
|
|
1776
|
-
globalSnapshot:
|
|
1838
|
+
globalSnapshot: a
|
|
1777
1839
|
});
|
|
1778
|
-
return u &&
|
|
1840
|
+
return u && jt(s, n, u, !1, {
|
|
1779
1841
|
initiator: "loadRemote",
|
|
1780
|
-
id:
|
|
1842
|
+
id: i
|
|
1781
1843
|
}).catch(() => {
|
|
1782
1844
|
}), {
|
|
1783
1845
|
...e,
|
|
@@ -1788,7 +1850,7 @@ function No() {
|
|
|
1788
1850
|
}
|
|
1789
1851
|
};
|
|
1790
1852
|
}
|
|
1791
|
-
function
|
|
1853
|
+
function Bo(e) {
|
|
1792
1854
|
const t = e.split(":");
|
|
1793
1855
|
return t.length === 1 ? {
|
|
1794
1856
|
name: t[0],
|
|
@@ -1801,100 +1863,100 @@ function Ao(e) {
|
|
|
1801
1863
|
version: t[2]
|
|
1802
1864
|
};
|
|
1803
1865
|
}
|
|
1804
|
-
function
|
|
1805
|
-
const { value:
|
|
1806
|
-
if (c && !
|
|
1807
|
-
const
|
|
1808
|
-
for (const l of
|
|
1866
|
+
function qt(e, t, r, o, n = {}, s) {
|
|
1867
|
+
const { value: i } = W(e, se(t)), c = s || i;
|
|
1868
|
+
if (c && !ct(c) && (r(c, t, o), c.remotesInfo)) {
|
|
1869
|
+
const a = Object.keys(c.remotesInfo);
|
|
1870
|
+
for (const l of a) {
|
|
1809
1871
|
if (n[l]) continue;
|
|
1810
1872
|
n[l] = !0;
|
|
1811
|
-
const u =
|
|
1812
|
-
|
|
1873
|
+
const u = Bo(l), h = c.remotesInfo[l];
|
|
1874
|
+
qt(e, {
|
|
1813
1875
|
name: u.name,
|
|
1814
|
-
version:
|
|
1876
|
+
version: h.matchedVersion
|
|
1815
1877
|
}, r, !1, n, void 0);
|
|
1816
1878
|
}
|
|
1817
1879
|
}
|
|
1818
1880
|
}
|
|
1819
|
-
const
|
|
1820
|
-
function
|
|
1821
|
-
const s = [],
|
|
1822
|
-
if (
|
|
1823
|
-
var
|
|
1881
|
+
const Te = (e, t) => document.querySelector(`${e}[${e === "link" ? "href" : "src"}="${t}"]`);
|
|
1882
|
+
function jo(e, t, r, o, n) {
|
|
1883
|
+
const s = [], i = [], c = [], a = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), { options: u } = e, { preloadConfig: h } = t, { depsRemote: m } = h;
|
|
1884
|
+
if (qt(o, r, (d, p, E) => {
|
|
1885
|
+
var I;
|
|
1824
1886
|
let y;
|
|
1825
|
-
if (E) y =
|
|
1887
|
+
if (E) y = h;
|
|
1826
1888
|
else if (Array.isArray(m)) {
|
|
1827
|
-
const
|
|
1828
|
-
if (!
|
|
1829
|
-
y =
|
|
1830
|
-
} else if (m === !0) y =
|
|
1889
|
+
const b = m.find(($) => $.nameOrAlias === p.name || $.nameOrAlias === p.alias);
|
|
1890
|
+
if (!b) return;
|
|
1891
|
+
y = Bt(b);
|
|
1892
|
+
} else if (m === !0) y = h;
|
|
1831
1893
|
else return;
|
|
1832
|
-
const
|
|
1833
|
-
|
|
1894
|
+
const R = Me(d, Rt(d).url);
|
|
1895
|
+
R && c.push({
|
|
1834
1896
|
name: p.name,
|
|
1835
1897
|
moduleInfo: {
|
|
1836
1898
|
name: p.name,
|
|
1837
|
-
entry:
|
|
1899
|
+
entry: R,
|
|
1838
1900
|
type: "remoteEntryType" in d ? d.remoteEntryType : "global",
|
|
1839
1901
|
entryGlobalName: "globalName" in d ? d.globalName : p.name,
|
|
1840
1902
|
shareScope: "",
|
|
1841
1903
|
version: "version" in d ? d.version : void 0
|
|
1842
1904
|
},
|
|
1843
|
-
url:
|
|
1905
|
+
url: R
|
|
1844
1906
|
});
|
|
1845
1907
|
let g = "modules" in d ? d.modules : [];
|
|
1846
|
-
const
|
|
1847
|
-
|
|
1848
|
-
function b
|
|
1849
|
-
const
|
|
1850
|
-
return y.filter ?
|
|
1908
|
+
const _ = Co(y.exposes);
|
|
1909
|
+
_.length && "modules" in d && (g = (I = d == null ? void 0 : d.modules) == null ? void 0 : I.reduce((b, $) => ((_ == null ? void 0 : _.indexOf($.moduleName)) !== -1 && b.push($), b), []));
|
|
1910
|
+
function S(b) {
|
|
1911
|
+
const $ = b.map((P) => Me(d, P));
|
|
1912
|
+
return y.filter ? $.filter(y.filter) : $;
|
|
1851
1913
|
}
|
|
1852
1914
|
if (g) {
|
|
1853
|
-
const
|
|
1854
|
-
for (let
|
|
1855
|
-
const P = g[
|
|
1915
|
+
const b = g.length;
|
|
1916
|
+
for (let $ = 0; $ < b; $++) {
|
|
1917
|
+
const P = g[$], Se = `${p.name}/${P.moduleName}`;
|
|
1856
1918
|
e.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
|
|
1857
|
-
id: P.moduleName === "." ? p.name :
|
|
1919
|
+
id: P.moduleName === "." ? p.name : Se,
|
|
1858
1920
|
name: p.name,
|
|
1859
1921
|
remoteSnapshot: d,
|
|
1860
1922
|
preloadConfig: y,
|
|
1861
1923
|
remote: p,
|
|
1862
1924
|
origin: e
|
|
1863
|
-
}), !
|
|
1925
|
+
}), !Br(Se) && (y.resourceCategory === "all" ? (s.push(...S(P.assets.css.async)), s.push(...S(P.assets.css.sync)), i.push(...S(P.assets.js.async)), i.push(...S(P.assets.js.sync))) : y.resourceCategory === "sync" && (s.push(...S(P.assets.css.sync)), i.push(...S(P.assets.js.sync))), jr(Se));
|
|
1864
1926
|
}
|
|
1865
1927
|
}
|
|
1866
1928
|
}, !0, {}, n), n.shared && n.shared.length > 0) {
|
|
1867
1929
|
const d = (p, E) => {
|
|
1868
|
-
const { shared: y } =
|
|
1869
|
-
y && typeof y.lib == "function" && (E.assets.js.sync.forEach((
|
|
1870
|
-
|
|
1871
|
-
}), E.assets.css.sync.forEach((
|
|
1872
|
-
l.add(
|
|
1930
|
+
const { shared: y } = ge(e.shareScopeMap, E.sharedName, p, e.sharedHandler.hooks.lifecycle.resolveShare) || {};
|
|
1931
|
+
y && typeof y.lib == "function" && (E.assets.js.sync.forEach((R) => {
|
|
1932
|
+
a.add(R);
|
|
1933
|
+
}), E.assets.css.sync.forEach((R) => {
|
|
1934
|
+
l.add(R);
|
|
1873
1935
|
}));
|
|
1874
1936
|
};
|
|
1875
1937
|
n.shared.forEach((p) => {
|
|
1876
|
-
var
|
|
1877
|
-
const E = (
|
|
1938
|
+
var R;
|
|
1939
|
+
const E = (R = u.shared) == null ? void 0 : R[p.sharedName];
|
|
1878
1940
|
if (!E) return;
|
|
1879
1941
|
const y = p.version ? E.find((g) => g.version === p.version) : E;
|
|
1880
|
-
y &&
|
|
1942
|
+
y && gt(y).forEach((g) => {
|
|
1881
1943
|
d(g, p);
|
|
1882
1944
|
});
|
|
1883
1945
|
});
|
|
1884
1946
|
}
|
|
1885
|
-
const
|
|
1947
|
+
const f = i.filter((d) => !a.has(d) && !Te("script", d));
|
|
1886
1948
|
return {
|
|
1887
|
-
cssAssets: s.filter((d) => !l.has(d) && !
|
|
1888
|
-
jsAssetsWithoutEntry:
|
|
1889
|
-
entryAssets: c.filter((d) => !
|
|
1949
|
+
cssAssets: s.filter((d) => !l.has(d) && !Te("link", d)),
|
|
1950
|
+
jsAssetsWithoutEntry: f,
|
|
1951
|
+
entryAssets: c.filter((d) => !Te("script", d.url))
|
|
1890
1952
|
};
|
|
1891
1953
|
}
|
|
1892
|
-
const
|
|
1954
|
+
const Wo = function() {
|
|
1893
1955
|
return {
|
|
1894
1956
|
name: "generate-preload-assets-plugin",
|
|
1895
1957
|
async generatePreloadAssets(e) {
|
|
1896
|
-
const { origin: t, preloadOptions: r, remoteInfo: o, remote: n, globalSnapshot: s, remoteSnapshot:
|
|
1897
|
-
return
|
|
1958
|
+
const { origin: t, preloadOptions: r, remoteInfo: o, remote: n, globalSnapshot: s, remoteSnapshot: i } = e;
|
|
1959
|
+
return G ? Ce(n) && Et(n) ? {
|
|
1898
1960
|
cssAssets: [],
|
|
1899
1961
|
jsAssetsWithoutEntry: [],
|
|
1900
1962
|
entryAssets: [{
|
|
@@ -1908,7 +1970,7 @@ const Po = function() {
|
|
|
1908
1970
|
shareScope: ""
|
|
1909
1971
|
}
|
|
1910
1972
|
}]
|
|
1911
|
-
} : (
|
|
1973
|
+
} : (Vt(o, i), jo(t, r, o, s, i)) : {
|
|
1912
1974
|
cssAssets: [],
|
|
1913
1975
|
jsAssetsWithoutEntry: [],
|
|
1914
1976
|
entryAssets: []
|
|
@@ -1916,35 +1978,35 @@ const Po = function() {
|
|
|
1916
1978
|
}
|
|
1917
1979
|
};
|
|
1918
1980
|
};
|
|
1919
|
-
function
|
|
1920
|
-
const r =
|
|
1981
|
+
function zt(e, t) {
|
|
1982
|
+
const r = pe({
|
|
1921
1983
|
name: t.name,
|
|
1922
1984
|
version: t.options.version
|
|
1923
|
-
}), o = r && "remotesInfo" in r && r.remotesInfo &&
|
|
1985
|
+
}), o = r && "remotesInfo" in r && r.remotesInfo && W(r.remotesInfo, e.name).value;
|
|
1924
1986
|
return o && o.matchedVersion ? {
|
|
1925
1987
|
hostGlobalSnapshot: r,
|
|
1926
1988
|
globalSnapshot: Ve(),
|
|
1927
|
-
remoteSnapshot:
|
|
1989
|
+
remoteSnapshot: pe({
|
|
1928
1990
|
name: e.name,
|
|
1929
1991
|
version: o.matchedVersion
|
|
1930
1992
|
})
|
|
1931
1993
|
} : {
|
|
1932
1994
|
hostGlobalSnapshot: void 0,
|
|
1933
1995
|
globalSnapshot: Ve(),
|
|
1934
|
-
remoteSnapshot:
|
|
1996
|
+
remoteSnapshot: pe({
|
|
1935
1997
|
name: e.name,
|
|
1936
1998
|
version: "version" in e ? e.version : void 0
|
|
1937
1999
|
})
|
|
1938
2000
|
};
|
|
1939
2001
|
}
|
|
1940
|
-
var
|
|
2002
|
+
var Vo = class {
|
|
1941
2003
|
constructor(e) {
|
|
1942
|
-
this.loadingHostSnapshot = null, this.manifestCache = /* @__PURE__ */ new Map(), this.hooks = new
|
|
1943
|
-
beforeLoadRemoteSnapshot: new
|
|
1944
|
-
loadSnapshot: new
|
|
1945
|
-
loadRemoteSnapshot: new
|
|
1946
|
-
afterLoadSnapshot: new
|
|
1947
|
-
}), this.manifestLoading =
|
|
2004
|
+
this.loadingHostSnapshot = null, this.manifestCache = /* @__PURE__ */ new Map(), this.hooks = new H({
|
|
2005
|
+
beforeLoadRemoteSnapshot: new T("beforeLoadRemoteSnapshot"),
|
|
2006
|
+
loadSnapshot: new D("loadGlobalSnapshot"),
|
|
2007
|
+
loadRemoteSnapshot: new D("loadRemoteSnapshot"),
|
|
2008
|
+
afterLoadSnapshot: new D("afterLoadSnapshot")
|
|
2009
|
+
}), this.manifestLoading = _e.__FEDERATION__.__MANIFEST_LOADING__, this.HostInstance = e, this.loaderHook = e.loaderHook;
|
|
1948
2010
|
}
|
|
1949
2011
|
async loadRemoteSnapshotInfo({ moduleInfo: e, id: t, initiator: r = "loadRemote" }) {
|
|
1950
2012
|
const { options: o } = this.HostInstance;
|
|
@@ -1953,7 +2015,7 @@ var Lo = class {
|
|
|
1953
2015
|
moduleInfo: e,
|
|
1954
2016
|
origin: this.HostInstance
|
|
1955
2017
|
});
|
|
1956
|
-
let n =
|
|
2018
|
+
let n = pe({
|
|
1957
2019
|
name: this.HostInstance.options.name,
|
|
1958
2020
|
version: this.HostInstance.options.version
|
|
1959
2021
|
});
|
|
@@ -1961,43 +2023,43 @@ var Lo = class {
|
|
|
1961
2023
|
version: this.HostInstance.options.version || "",
|
|
1962
2024
|
remoteEntry: "",
|
|
1963
2025
|
remotesInfo: {}
|
|
1964
|
-
},
|
|
2026
|
+
}, Gr({ [this.HostInstance.options.name]: n })), n && "remotesInfo" in n && !W(n.remotesInfo, e.name).value && ("version" in e || "entry" in e) && (n.remotesInfo = {
|
|
1965
2027
|
...n == null ? void 0 : n.remotesInfo,
|
|
1966
2028
|
[e.name]: { matchedVersion: "version" in e ? e.version : e.entry }
|
|
1967
2029
|
});
|
|
1968
|
-
const { hostGlobalSnapshot: s, remoteSnapshot:
|
|
2030
|
+
const { hostGlobalSnapshot: s, remoteSnapshot: i, globalSnapshot: c } = this.getGlobalRemoteInfo(e), { remoteSnapshot: a, globalSnapshot: l } = await this.hooks.lifecycle.loadSnapshot.emit({
|
|
1969
2031
|
options: o,
|
|
1970
2032
|
moduleInfo: e,
|
|
1971
2033
|
hostGlobalSnapshot: s,
|
|
1972
|
-
remoteSnapshot:
|
|
2034
|
+
remoteSnapshot: i,
|
|
1973
2035
|
globalSnapshot: c
|
|
1974
2036
|
});
|
|
1975
|
-
let u,
|
|
1976
|
-
if (
|
|
1977
|
-
const m =
|
|
2037
|
+
let u, h;
|
|
2038
|
+
if (a) if (ct(a)) {
|
|
2039
|
+
const m = G ? a.remoteEntry : a.ssrRemoteEntry || a.remoteEntry || "", f = await this.loadManifestSnapshot(m, e, {}, {
|
|
1978
2040
|
initiator: r,
|
|
1979
2041
|
id: t || e.name
|
|
1980
|
-
}), d =
|
|
2042
|
+
}), d = qe({
|
|
1981
2043
|
...e,
|
|
1982
2044
|
entry: m
|
|
1983
|
-
},
|
|
1984
|
-
u =
|
|
2045
|
+
}, f);
|
|
2046
|
+
u = f, h = d;
|
|
1985
2047
|
} else {
|
|
1986
2048
|
const { remoteSnapshot: m } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
1987
2049
|
options: this.HostInstance.options,
|
|
1988
2050
|
moduleInfo: e,
|
|
1989
|
-
remoteSnapshot:
|
|
2051
|
+
remoteSnapshot: a,
|
|
1990
2052
|
from: "global"
|
|
1991
2053
|
});
|
|
1992
|
-
u = m,
|
|
2054
|
+
u = m, h = l;
|
|
1993
2055
|
}
|
|
1994
|
-
else if (
|
|
2056
|
+
else if (Ce(e)) {
|
|
1995
2057
|
const m = await this.loadManifestSnapshot(e.entry, e, {}, {
|
|
1996
2058
|
initiator: r,
|
|
1997
2059
|
id: t || e.name
|
|
1998
|
-
}),
|
|
1999
|
-
u = m,
|
|
2000
|
-
} else w(
|
|
2060
|
+
}), f = qe(e, m);
|
|
2061
|
+
u = m, h = f;
|
|
2062
|
+
} else w(Lt, M, {
|
|
2001
2063
|
remoteName: e.name,
|
|
2002
2064
|
remoteVersion: e.version,
|
|
2003
2065
|
hostName: this.HostInstance.options.name,
|
|
@@ -2011,42 +2073,42 @@ var Lo = class {
|
|
|
2011
2073
|
remoteSnapshot: u
|
|
2012
2074
|
}), {
|
|
2013
2075
|
remoteSnapshot: u,
|
|
2014
|
-
globalSnapshot:
|
|
2076
|
+
globalSnapshot: h
|
|
2015
2077
|
};
|
|
2016
2078
|
}
|
|
2017
2079
|
getGlobalRemoteInfo(e) {
|
|
2018
|
-
return
|
|
2080
|
+
return zt(e, this.HostInstance);
|
|
2019
2081
|
}
|
|
2020
2082
|
async getManifestJson(e, t, r, o) {
|
|
2021
2083
|
return (async () => {
|
|
2022
|
-
const s =
|
|
2023
|
-
let
|
|
2024
|
-
if (
|
|
2084
|
+
const s = K(t);
|
|
2085
|
+
let i = this.manifestCache.get(e);
|
|
2086
|
+
if (i) return i;
|
|
2025
2087
|
try {
|
|
2026
|
-
let
|
|
2088
|
+
let a = await this.loaderHook.lifecycle.fetch.emit(e, {}, s, o ? {
|
|
2027
2089
|
...o,
|
|
2028
2090
|
url: e,
|
|
2029
2091
|
resourceType: "manifest"
|
|
2030
2092
|
} : void 0);
|
|
2031
|
-
(!
|
|
2032
|
-
} catch (
|
|
2033
|
-
|
|
2093
|
+
(!a || !(a instanceof Response)) && (a = await fetch(e, {})), i = await a.json();
|
|
2094
|
+
} catch (a) {
|
|
2095
|
+
i = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
2034
2096
|
id: e,
|
|
2035
|
-
error:
|
|
2097
|
+
error: a,
|
|
2036
2098
|
from: "runtime",
|
|
2037
2099
|
lifecycle: "afterResolve",
|
|
2038
2100
|
remote: s,
|
|
2039
2101
|
origin: this.HostInstance
|
|
2040
|
-
}),
|
|
2102
|
+
}), i || (delete this.manifestLoading[e], w(Pt, M, {
|
|
2041
2103
|
manifestUrl: e,
|
|
2042
2104
|
moduleName: t.name,
|
|
2043
2105
|
hostName: this.HostInstance.options.name
|
|
2044
|
-
}, `${
|
|
2106
|
+
}, `${a}`, F(this.HostInstance.options)));
|
|
2045
2107
|
}
|
|
2046
2108
|
const c = [
|
|
2047
|
-
!
|
|
2048
|
-
!
|
|
2049
|
-
!
|
|
2109
|
+
!i.metaData && "metaData",
|
|
2110
|
+
!i.exposes && "exposes",
|
|
2111
|
+
!i.shared && "shared"
|
|
2050
2112
|
].filter(Boolean);
|
|
2051
2113
|
return c.length > 0 && await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
2052
2114
|
id: e,
|
|
@@ -2055,21 +2117,21 @@ var Lo = class {
|
|
|
2055
2117
|
lifecycle: "afterResolve",
|
|
2056
2118
|
remote: s,
|
|
2057
2119
|
origin: this.HostInstance
|
|
2058
|
-
}), c.length > 0 && w(
|
|
2120
|
+
}), c.length > 0 && w(Ht, M, {
|
|
2059
2121
|
manifestUrl: e,
|
|
2060
2122
|
moduleName: t.name,
|
|
2061
2123
|
hostName: this.HostInstance.options.name,
|
|
2062
2124
|
missingFields: c.join(",")
|
|
2063
|
-
}, void 0, F(this.HostInstance.options)), this.manifestCache.set(e,
|
|
2125
|
+
}, void 0, F(this.HostInstance.options)), this.manifestCache.set(e, i), i;
|
|
2064
2126
|
})();
|
|
2065
2127
|
}
|
|
2066
2128
|
async loadManifestSnapshot(e, t, r, o) {
|
|
2067
2129
|
const n = async () => {
|
|
2068
|
-
const s = await this.getManifestJson(e, t, r, o),
|
|
2130
|
+
const s = await this.getManifestJson(e, t, r, o), i = pr(s, { version: e }), { remoteSnapshot: c } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
2069
2131
|
options: this.HostInstance.options,
|
|
2070
2132
|
moduleInfo: t,
|
|
2071
2133
|
manifestJson: s,
|
|
2072
|
-
remoteSnapshot:
|
|
2134
|
+
remoteSnapshot: i,
|
|
2073
2135
|
manifestUrl: e,
|
|
2074
2136
|
from: "manifest"
|
|
2075
2137
|
});
|
|
@@ -2077,17 +2139,21 @@ var Lo = class {
|
|
|
2077
2139
|
};
|
|
2078
2140
|
return this.manifestLoading[e] || (this.manifestLoading[e] = n().then((s) => s)), this.manifestLoading[e];
|
|
2079
2141
|
}
|
|
2080
|
-
},
|
|
2142
|
+
}, qo = class {
|
|
2143
|
+
constructor() {
|
|
2144
|
+
this.hooks = new H({});
|
|
2145
|
+
}
|
|
2146
|
+
}, zo = class {
|
|
2081
2147
|
constructor(e) {
|
|
2082
|
-
this.hooks = new
|
|
2083
|
-
beforeRegisterShare: new
|
|
2084
|
-
afterResolve: new
|
|
2085
|
-
beforeLoadShare: new
|
|
2086
|
-
loadShare: new
|
|
2148
|
+
this.hooks = new H({
|
|
2149
|
+
beforeRegisterShare: new X("beforeRegisterShare"),
|
|
2150
|
+
afterResolve: new D("afterResolve"),
|
|
2151
|
+
beforeLoadShare: new D("beforeLoadShare"),
|
|
2152
|
+
loadShare: new T(),
|
|
2087
2153
|
afterLoadShare: new A("afterLoadShare"),
|
|
2088
2154
|
errorLoadShare: new A("errorLoadShare"),
|
|
2089
|
-
resolveShare: new
|
|
2090
|
-
initContainerShareScopeMap: new
|
|
2155
|
+
resolveShare: new X("resolveShare"),
|
|
2156
|
+
initContainerShareScopeMap: new X("initContainerShareScopeMap")
|
|
2091
2157
|
}), this.host = e, this.shareScopeMap = {}, this.initTokens = {}, this._setGlobalShareScopeMap(e.options);
|
|
2092
2158
|
}
|
|
2093
2159
|
emitAfterLoadShare({ lifecycle: e, pkgName: t, shareInfo: r, selectedShared: o }) {
|
|
@@ -2102,7 +2168,7 @@ var Lo = class {
|
|
|
2102
2168
|
origin: this.host
|
|
2103
2169
|
});
|
|
2104
2170
|
} catch (n) {
|
|
2105
|
-
|
|
2171
|
+
ne(n);
|
|
2106
2172
|
}
|
|
2107
2173
|
}
|
|
2108
2174
|
emitErrorLoadShare({ lifecycle: e, pkgName: t, shareInfo: r, error: o, recovered: n }) {
|
|
@@ -2118,20 +2184,20 @@ var Lo = class {
|
|
|
2118
2184
|
recovered: n
|
|
2119
2185
|
});
|
|
2120
2186
|
} catch (s) {
|
|
2121
|
-
|
|
2187
|
+
ne(s);
|
|
2122
2188
|
}
|
|
2123
2189
|
}
|
|
2124
2190
|
registerShared(e, t) {
|
|
2125
|
-
const { newShareInfos: r, allShareInfos: o } =
|
|
2191
|
+
const { newShareInfos: r, allShareInfos: o } = vt(e, t);
|
|
2126
2192
|
return Object.keys(r).forEach((n) => {
|
|
2127
2193
|
r[n].forEach((s) => {
|
|
2128
|
-
s.scope.forEach((
|
|
2194
|
+
s.scope.forEach((i) => {
|
|
2129
2195
|
var c;
|
|
2130
2196
|
this.hooks.lifecycle.beforeRegisterShare.emit({
|
|
2131
2197
|
origin: this.host,
|
|
2132
2198
|
pkgName: n,
|
|
2133
2199
|
shared: s
|
|
2134
|
-
}), (c = this.shareScopeMap[
|
|
2200
|
+
}), (c = this.shareScopeMap[i]) != null && c[n] || this.setShared({
|
|
2135
2201
|
pkgName: n,
|
|
2136
2202
|
lib: s.lib,
|
|
2137
2203
|
get: s.get,
|
|
@@ -2147,60 +2213,60 @@ var Lo = class {
|
|
|
2147
2213
|
};
|
|
2148
2214
|
}
|
|
2149
2215
|
async loadShare(e, t) {
|
|
2150
|
-
const { host: r } = this, o =
|
|
2216
|
+
const { host: r } = this, o = Ye({
|
|
2151
2217
|
pkgName: e,
|
|
2152
2218
|
extraOptions: t,
|
|
2153
2219
|
shareInfos: r.options.shared
|
|
2154
2220
|
});
|
|
2155
2221
|
let n = o;
|
|
2156
2222
|
try {
|
|
2157
|
-
o != null && o.scope && await Promise.all(o.scope.map(async (
|
|
2158
|
-
await Promise.all(this.initializeSharing(
|
|
2223
|
+
o != null && o.scope && await Promise.all(o.scope.map(async (a) => {
|
|
2224
|
+
await Promise.all(this.initializeSharing(a, { strategy: o.strategy }));
|
|
2159
2225
|
})), n = (await this.hooks.lifecycle.beforeLoadShare.emit({
|
|
2160
2226
|
pkgName: e,
|
|
2161
2227
|
shareInfo: o,
|
|
2162
2228
|
shared: r.options.shared,
|
|
2163
2229
|
origin: r
|
|
2164
|
-
})).shareInfo,
|
|
2165
|
-
const s = n, { shared:
|
|
2166
|
-
if (
|
|
2167
|
-
const
|
|
2168
|
-
if (
|
|
2169
|
-
return
|
|
2230
|
+
})).shareInfo, L(n, `Cannot find shared "${e}" in host "${r.options.name}". Ensure the shared config for "${e}" is declared in the federation plugin options and the host has been initialized before loading shares.`);
|
|
2231
|
+
const s = n, { shared: i, useTreesShaking: c } = ge(this.shareScopeMap, e, n, this.hooks.lifecycle.resolveShare) || {};
|
|
2232
|
+
if (i) {
|
|
2233
|
+
const a = he(i, c);
|
|
2234
|
+
if (a.lib)
|
|
2235
|
+
return z(a, r.options.name), this.emitAfterLoadShare({
|
|
2170
2236
|
lifecycle: "loadShare",
|
|
2171
2237
|
pkgName: e,
|
|
2172
2238
|
shareInfo: s,
|
|
2173
|
-
selectedShared:
|
|
2174
|
-
}),
|
|
2175
|
-
if (
|
|
2176
|
-
const l = await
|
|
2177
|
-
return
|
|
2239
|
+
selectedShared: i
|
|
2240
|
+
}), a.lib;
|
|
2241
|
+
if (a.loading && !a.loaded) {
|
|
2242
|
+
const l = await a.loading;
|
|
2243
|
+
return a.loaded = !0, a.lib || (a.lib = l), z(a, r.options.name), this.emitAfterLoadShare({
|
|
2178
2244
|
lifecycle: "loadShare",
|
|
2179
2245
|
pkgName: e,
|
|
2180
2246
|
shareInfo: s,
|
|
2181
|
-
selectedShared:
|
|
2247
|
+
selectedShared: i
|
|
2182
2248
|
}), l;
|
|
2183
2249
|
} else {
|
|
2184
2250
|
const u = (async () => {
|
|
2185
|
-
const m = await
|
|
2186
|
-
return
|
|
2251
|
+
const m = await a.get();
|
|
2252
|
+
return z(a, r.options.name), a.loaded = !0, a.lib = m, m;
|
|
2187
2253
|
})();
|
|
2188
2254
|
this.setShared({
|
|
2189
2255
|
pkgName: e,
|
|
2190
2256
|
loaded: !1,
|
|
2191
|
-
shared:
|
|
2257
|
+
shared: i,
|
|
2192
2258
|
from: r.options.name,
|
|
2193
2259
|
lib: null,
|
|
2194
2260
|
loading: u,
|
|
2195
|
-
treeShaking: c ?
|
|
2261
|
+
treeShaking: c ? a : void 0
|
|
2196
2262
|
});
|
|
2197
|
-
const
|
|
2263
|
+
const h = await u;
|
|
2198
2264
|
return this.emitAfterLoadShare({
|
|
2199
2265
|
lifecycle: "loadShare",
|
|
2200
2266
|
pkgName: e,
|
|
2201
2267
|
shareInfo: s,
|
|
2202
|
-
selectedShared:
|
|
2203
|
-
}),
|
|
2268
|
+
selectedShared: i
|
|
2269
|
+
}), h;
|
|
2204
2270
|
}
|
|
2205
2271
|
} else {
|
|
2206
2272
|
if (t != null && t.customShareInfo)
|
|
@@ -2210,15 +2276,15 @@ var Lo = class {
|
|
|
2210
2276
|
shareInfo: s,
|
|
2211
2277
|
recovered: !0
|
|
2212
2278
|
}), !1;
|
|
2213
|
-
const
|
|
2214
|
-
const
|
|
2215
|
-
l.lib =
|
|
2216
|
-
const { shared: d, useTreesShaking: p } =
|
|
2279
|
+
const a = ie(s.treeShaking), l = he(s, a), h = (async () => {
|
|
2280
|
+
const f = await l.get();
|
|
2281
|
+
l.lib = f, l.loaded = !0, z(l, r.options.name);
|
|
2282
|
+
const { shared: d, useTreesShaking: p } = ge(this.shareScopeMap, e, s, this.hooks.lifecycle.resolveShare) || {};
|
|
2217
2283
|
if (d) {
|
|
2218
|
-
const E =
|
|
2219
|
-
E.lib =
|
|
2284
|
+
const E = he(d, p);
|
|
2285
|
+
E.lib = f, E.loaded = !0, d.from = s.from;
|
|
2220
2286
|
}
|
|
2221
|
-
return
|
|
2287
|
+
return f;
|
|
2222
2288
|
})();
|
|
2223
2289
|
this.setShared({
|
|
2224
2290
|
pkgName: e,
|
|
@@ -2226,10 +2292,10 @@ var Lo = class {
|
|
|
2226
2292
|
shared: s,
|
|
2227
2293
|
from: r.options.name,
|
|
2228
2294
|
lib: null,
|
|
2229
|
-
loading:
|
|
2230
|
-
treeShaking:
|
|
2295
|
+
loading: h,
|
|
2296
|
+
treeShaking: a ? l : void 0
|
|
2231
2297
|
});
|
|
2232
|
-
const m = await
|
|
2298
|
+
const m = await h;
|
|
2233
2299
|
return this.emitAfterLoadShare({
|
|
2234
2300
|
lifecycle: "loadShare",
|
|
2235
2301
|
pkgName: e,
|
|
@@ -2251,53 +2317,53 @@ var Lo = class {
|
|
|
2251
2317
|
* It accepts one argument, the name of the share scope.
|
|
2252
2318
|
* If the share scope does not exist, it creates one.
|
|
2253
2319
|
*/
|
|
2254
|
-
initializeSharing(e =
|
|
2320
|
+
initializeSharing(e = ce, t) {
|
|
2255
2321
|
const { host: r } = this, o = t == null ? void 0 : t.from, n = t == null ? void 0 : t.strategy;
|
|
2256
2322
|
let s = t == null ? void 0 : t.initScope;
|
|
2257
|
-
const
|
|
2323
|
+
const i = [];
|
|
2258
2324
|
if (o !== "build") {
|
|
2259
2325
|
const { initTokens: m } = this;
|
|
2260
2326
|
s || (s = []);
|
|
2261
|
-
let
|
|
2262
|
-
if (
|
|
2263
|
-
s.push(
|
|
2327
|
+
let f = m[e];
|
|
2328
|
+
if (f || (f = m[e] = { from: this.host.name }), s.indexOf(f) >= 0) return i;
|
|
2329
|
+
s.push(f);
|
|
2264
2330
|
}
|
|
2265
|
-
const c = this.shareScopeMap,
|
|
2331
|
+
const c = this.shareScopeMap, a = r.options.name;
|
|
2266
2332
|
c[e] || (c[e] = {});
|
|
2267
|
-
const l = c[e], u = (m,
|
|
2333
|
+
const l = c[e], u = (m, f) => {
|
|
2268
2334
|
var g;
|
|
2269
|
-
const { version: d, eager: p } =
|
|
2335
|
+
const { version: d, eager: p } = f;
|
|
2270
2336
|
l[m] = l[m] || {};
|
|
2271
|
-
const E = l[m], y = E[d] &&
|
|
2272
|
-
(!y || y.strategy !== "loaded-first" && !y.loaded && (!p != !
|
|
2273
|
-
},
|
|
2274
|
-
const { module:
|
|
2337
|
+
const E = l[m], y = E[d] && he(E[d]), R = !!(y && ("eager" in y && y.eager || "shareConfig" in y && ((g = y.shareConfig) != null && g.eager)));
|
|
2338
|
+
(!y || y.strategy !== "loaded-first" && !y.loaded && (!p != !R ? p : a > E[d].from)) && (E[d] = f);
|
|
2339
|
+
}, h = async (m) => {
|
|
2340
|
+
const { module: f } = await r.remoteHandler.getRemoteModuleAndOptions({ id: m });
|
|
2275
2341
|
let d;
|
|
2276
2342
|
try {
|
|
2277
|
-
d = await
|
|
2343
|
+
d = await f.getEntry();
|
|
2278
2344
|
} catch (p) {
|
|
2279
2345
|
if (d = await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
2280
2346
|
id: m,
|
|
2281
2347
|
error: p,
|
|
2282
2348
|
from: "runtime",
|
|
2283
2349
|
lifecycle: "beforeLoadShare",
|
|
2284
|
-
remote:
|
|
2350
|
+
remote: f.remoteInfo,
|
|
2285
2351
|
origin: r
|
|
2286
2352
|
}), !d) return;
|
|
2287
2353
|
} finally {
|
|
2288
|
-
d != null && d.init && !
|
|
2354
|
+
d != null && d.init && !f.initing && (f.remoteEntryExports = d, await f.init(void 0, void 0, s));
|
|
2289
2355
|
}
|
|
2290
2356
|
};
|
|
2291
2357
|
return Object.keys(r.options.shared).forEach((m) => {
|
|
2292
|
-
r.options.shared[m].forEach((
|
|
2293
|
-
|
|
2358
|
+
r.options.shared[m].forEach((f) => {
|
|
2359
|
+
f.scope.includes(e) && u(m, f);
|
|
2294
2360
|
});
|
|
2295
2361
|
}), (r.options.shareStrategy === "version-first" || n === "version-first") && r.options.remotes.forEach((m) => {
|
|
2296
|
-
m.shareScope === e &&
|
|
2297
|
-
}),
|
|
2362
|
+
m.shareScope === e && i.push(h(m.name));
|
|
2363
|
+
}), i;
|
|
2298
2364
|
}
|
|
2299
2365
|
loadShareSync(e, t) {
|
|
2300
|
-
const { host: r } = this, o =
|
|
2366
|
+
const { host: r } = this, o = Ye({
|
|
2301
2367
|
pkgName: e,
|
|
2302
2368
|
extraOptions: t,
|
|
2303
2369
|
shareInfos: r.options.shared
|
|
@@ -2306,10 +2372,10 @@ var Lo = class {
|
|
|
2306
2372
|
o != null && o.scope && o.scope.forEach((s) => {
|
|
2307
2373
|
this.initializeSharing(s, { strategy: o.strategy });
|
|
2308
2374
|
});
|
|
2309
|
-
const { shared: n } =
|
|
2375
|
+
const { shared: n } = ge(this.shareScopeMap, e, o, this.hooks.lifecycle.resolveShare) || {};
|
|
2310
2376
|
if (n) {
|
|
2311
2377
|
if (typeof n.lib == "function")
|
|
2312
|
-
return
|
|
2378
|
+
return z(n, r.options.name), n.loaded || (n.loaded = !0, n.from === r.options.name && (o.loaded = !0)), this.emitAfterLoadShare({
|
|
2313
2379
|
lifecycle: "loadShareSync",
|
|
2314
2380
|
pkgName: e,
|
|
2315
2381
|
shareInfo: o,
|
|
@@ -2318,7 +2384,7 @@ var Lo = class {
|
|
|
2318
2384
|
if (typeof n.get == "function") {
|
|
2319
2385
|
const s = n.get();
|
|
2320
2386
|
if (!(s instanceof Promise))
|
|
2321
|
-
return
|
|
2387
|
+
return z(n, r.options.name), this.setShared({
|
|
2322
2388
|
pkgName: e,
|
|
2323
2389
|
loaded: !0,
|
|
2324
2390
|
from: r.options.name,
|
|
@@ -2341,7 +2407,7 @@ var Lo = class {
|
|
|
2341
2407
|
}), o.lib;
|
|
2342
2408
|
if (o.get) {
|
|
2343
2409
|
const s = o.get();
|
|
2344
|
-
return s instanceof Promise && w((t == null ? void 0 : t.from) === "build" ?
|
|
2410
|
+
return s instanceof Promise && w((t == null ? void 0 : t.from) === "build" ? Ot : Oe, M, {
|
|
2345
2411
|
hostName: r.options.name,
|
|
2346
2412
|
sharedPkgName: e
|
|
2347
2413
|
}, void 0, F(r.options)), o.lib = s, this.setShared({
|
|
@@ -2357,7 +2423,7 @@ var Lo = class {
|
|
|
2357
2423
|
selectedShared: o
|
|
2358
2424
|
}), o.lib;
|
|
2359
2425
|
}
|
|
2360
|
-
w(
|
|
2426
|
+
w(Oe, M, {
|
|
2361
2427
|
hostName: r.options.name,
|
|
2362
2428
|
sharedPkgName: e
|
|
2363
2429
|
}, void 0, F(r.options));
|
|
@@ -2380,43 +2446,65 @@ var Lo = class {
|
|
|
2380
2446
|
hostShareScopeMap: r.hostShareScopeMap
|
|
2381
2447
|
});
|
|
2382
2448
|
}
|
|
2383
|
-
setShared({ pkgName: e, shared: t, from: r, lib: o, loading: n, loaded: s, get:
|
|
2384
|
-
const { version:
|
|
2385
|
-
const d = (E, y,
|
|
2386
|
-
|
|
2387
|
-
}, p = c ?
|
|
2388
|
-
d(p, "loaded", s), d(p, "loading", n), d(p, "get",
|
|
2449
|
+
setShared({ pkgName: e, shared: t, from: r, lib: o, loading: n, loaded: s, get: i, treeShaking: c }) {
|
|
2450
|
+
const { version: a, scope: l = "default", ...u } = t, h = Array.isArray(l) ? l : [l], m = (f) => {
|
|
2451
|
+
const d = (E, y, R) => {
|
|
2452
|
+
R && !E[y] && (E[y] = R);
|
|
2453
|
+
}, p = c ? f.treeShaking : f;
|
|
2454
|
+
d(p, "loaded", s), d(p, "loading", n), d(p, "get", i);
|
|
2389
2455
|
};
|
|
2390
|
-
|
|
2391
|
-
this.shareScopeMap[
|
|
2392
|
-
version:
|
|
2393
|
-
scope: [
|
|
2456
|
+
h.forEach((f) => {
|
|
2457
|
+
this.shareScopeMap[f] || (this.shareScopeMap[f] = {}), this.shareScopeMap[f][e] || (this.shareScopeMap[f][e] = {}), this.shareScopeMap[f][e][a] || (this.shareScopeMap[f][e][a] = {
|
|
2458
|
+
version: a,
|
|
2459
|
+
scope: [f],
|
|
2394
2460
|
...u,
|
|
2395
2461
|
lib: o
|
|
2396
2462
|
});
|
|
2397
|
-
const d = this.shareScopeMap[
|
|
2463
|
+
const d = this.shareScopeMap[f][e][a];
|
|
2398
2464
|
m(d), r && d.from !== r && (d.from = r);
|
|
2399
2465
|
});
|
|
2400
2466
|
}
|
|
2401
2467
|
_setGlobalShareScopeMap(e) {
|
|
2402
|
-
const t =
|
|
2468
|
+
const t = Nt(), r = e.id || e.name;
|
|
2403
2469
|
r && !t[r] && (t[r] = this.shareScopeMap);
|
|
2404
2470
|
}
|
|
2405
|
-
},
|
|
2471
|
+
}, Ko = class {
|
|
2472
|
+
constructor() {
|
|
2473
|
+
this.shareScopeMap = {}, this.hooks = new H({ afterResolve: new D("afterResolve") });
|
|
2474
|
+
}
|
|
2475
|
+
registerShared() {
|
|
2476
|
+
return {
|
|
2477
|
+
newShareInfos: {},
|
|
2478
|
+
allShareInfos: {}
|
|
2479
|
+
};
|
|
2480
|
+
}
|
|
2481
|
+
loadShare() {
|
|
2482
|
+
throw new Error("Shared dependency loading is disabled by experiments.optimization.disableShared.");
|
|
2483
|
+
}
|
|
2484
|
+
loadShareSync() {
|
|
2485
|
+
throw new Error("Shared dependency loading is disabled by experiments.optimization.disableShared.");
|
|
2486
|
+
}
|
|
2487
|
+
initializeSharing() {
|
|
2488
|
+
return [];
|
|
2489
|
+
}
|
|
2490
|
+
initShareScopeMap(e, t) {
|
|
2491
|
+
this.shareScopeMap[e] = t;
|
|
2492
|
+
}
|
|
2493
|
+
}, Jo = class {
|
|
2406
2494
|
constructor(e) {
|
|
2407
|
-
this.hooks = new
|
|
2408
|
-
beforeRegisterRemote: new
|
|
2409
|
-
registerRemote: new
|
|
2410
|
-
beforeRequest: new
|
|
2411
|
-
afterMatchRemote: new
|
|
2412
|
-
onLoad: new
|
|
2413
|
-
afterLoadRemote: new
|
|
2495
|
+
this.hooks = new H({
|
|
2496
|
+
beforeRegisterRemote: new X("beforeRegisterRemote"),
|
|
2497
|
+
registerRemote: new X("registerRemote"),
|
|
2498
|
+
beforeRequest: new D("beforeRequest"),
|
|
2499
|
+
afterMatchRemote: new T("afterMatchRemote"),
|
|
2500
|
+
onLoad: new T("onLoad"),
|
|
2501
|
+
afterLoadRemote: new T("afterLoadRemote"),
|
|
2414
2502
|
handlePreloadModule: new A("handlePreloadModule"),
|
|
2415
|
-
errorLoadRemote: new
|
|
2416
|
-
beforePreloadRemote: new
|
|
2417
|
-
generatePreloadAssets: new
|
|
2418
|
-
afterPreloadRemote: new
|
|
2419
|
-
loadEntry: new
|
|
2503
|
+
errorLoadRemote: new T("errorLoadRemote"),
|
|
2504
|
+
beforePreloadRemote: new T("beforePreloadRemote"),
|
|
2505
|
+
generatePreloadAssets: new T("generatePreloadAssets"),
|
|
2506
|
+
afterPreloadRemote: new T("afterPreloadRemote"),
|
|
2507
|
+
loadEntry: new T()
|
|
2420
2508
|
}), this.host = e, this.idToRemoteMap = {};
|
|
2421
2509
|
}
|
|
2422
2510
|
formatAndRegisterRemote(e, t) {
|
|
@@ -2428,83 +2516,83 @@ var Lo = class {
|
|
|
2428
2516
|
name: r.name,
|
|
2429
2517
|
expose: o
|
|
2430
2518
|
}, s && e.startsWith(n)) {
|
|
2431
|
-
const
|
|
2432
|
-
this.idToRemoteMap[
|
|
2519
|
+
const i = e.replace(n, s);
|
|
2520
|
+
this.idToRemoteMap[i] = {
|
|
2433
2521
|
name: r.name,
|
|
2434
2522
|
expose: o
|
|
2435
2523
|
};
|
|
2436
2524
|
return;
|
|
2437
2525
|
}
|
|
2438
2526
|
if (s && e.startsWith(s)) {
|
|
2439
|
-
const
|
|
2440
|
-
this.idToRemoteMap[
|
|
2527
|
+
const i = e.replace(s, n);
|
|
2528
|
+
this.idToRemoteMap[i] = {
|
|
2441
2529
|
name: r.name,
|
|
2442
2530
|
expose: o
|
|
2443
2531
|
};
|
|
2444
2532
|
}
|
|
2445
2533
|
}
|
|
2446
2534
|
async loadRemote(e, t) {
|
|
2447
|
-
const { host: r } = this, o =
|
|
2448
|
-
let n = e, s = o == null ? void 0 : o.expose,
|
|
2535
|
+
const { host: r } = this, o = Qe(r.options.remotes, e);
|
|
2536
|
+
let n = e, s = o == null ? void 0 : o.expose, i = o ? K(o.remote) : void 0, c;
|
|
2449
2537
|
try {
|
|
2450
|
-
const { loadFactory:
|
|
2451
|
-
n = p, s = d,
|
|
2452
|
-
const y = await l.get(p, d, t, E),
|
|
2538
|
+
const { loadFactory: a = !0 } = t || { loadFactory: !0 }, { module: l, moduleOptions: u, remoteMatchInfo: h } = await this.getRemoteModuleAndOptions({ id: e }), { pkgNameOrAlias: m, remote: f, expose: d, id: p, remoteSnapshot: E } = h;
|
|
2539
|
+
n = p, s = d, i = K(f);
|
|
2540
|
+
const y = await l.get(p, d, t, E), R = await this.hooks.lifecycle.onLoad.emit({
|
|
2453
2541
|
id: p,
|
|
2454
2542
|
pkgNameOrAlias: m,
|
|
2455
2543
|
expose: d,
|
|
2456
|
-
exposeModule:
|
|
2457
|
-
exposeModuleFactory:
|
|
2458
|
-
remote:
|
|
2544
|
+
exposeModule: a ? y : void 0,
|
|
2545
|
+
exposeModuleFactory: a ? void 0 : y,
|
|
2546
|
+
remote: f,
|
|
2459
2547
|
options: u,
|
|
2460
2548
|
moduleInstance: l,
|
|
2461
2549
|
origin: r
|
|
2462
2550
|
});
|
|
2463
|
-
return this.setIdToRemoteMap(e,
|
|
2551
|
+
return this.setIdToRemoteMap(e, h), c = {
|
|
2464
2552
|
id: n,
|
|
2465
2553
|
expose: s,
|
|
2466
|
-
remote:
|
|
2554
|
+
remote: i,
|
|
2467
2555
|
options: t,
|
|
2468
2556
|
origin: r
|
|
2469
|
-
}, typeof
|
|
2470
|
-
} catch (
|
|
2557
|
+
}, typeof R == "function" ? R : y;
|
|
2558
|
+
} catch (a) {
|
|
2471
2559
|
const { from: l = "runtime" } = t || { from: "runtime" };
|
|
2472
2560
|
let u;
|
|
2473
2561
|
try {
|
|
2474
2562
|
u = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
2475
2563
|
id: e,
|
|
2476
|
-
error:
|
|
2564
|
+
error: a,
|
|
2477
2565
|
from: l,
|
|
2478
2566
|
lifecycle: "onLoad",
|
|
2479
2567
|
expose: s,
|
|
2480
|
-
remote:
|
|
2568
|
+
remote: i,
|
|
2481
2569
|
origin: r
|
|
2482
2570
|
});
|
|
2483
|
-
} catch (
|
|
2571
|
+
} catch (h) {
|
|
2484
2572
|
throw c = {
|
|
2485
2573
|
id: n,
|
|
2486
2574
|
expose: s,
|
|
2487
|
-
remote:
|
|
2575
|
+
remote: i,
|
|
2488
2576
|
options: t,
|
|
2489
|
-
error:
|
|
2577
|
+
error: h,
|
|
2490
2578
|
origin: r
|
|
2491
|
-
},
|
|
2579
|
+
}, h;
|
|
2492
2580
|
}
|
|
2493
2581
|
if (!u)
|
|
2494
2582
|
throw c = {
|
|
2495
2583
|
id: n,
|
|
2496
2584
|
expose: s,
|
|
2497
|
-
remote:
|
|
2585
|
+
remote: i,
|
|
2498
2586
|
options: t,
|
|
2499
|
-
error:
|
|
2587
|
+
error: a,
|
|
2500
2588
|
origin: r
|
|
2501
|
-
},
|
|
2589
|
+
}, a;
|
|
2502
2590
|
return c = {
|
|
2503
2591
|
id: n,
|
|
2504
2592
|
expose: s,
|
|
2505
|
-
remote:
|
|
2593
|
+
remote: i,
|
|
2506
2594
|
options: t,
|
|
2507
|
-
error:
|
|
2595
|
+
error: a,
|
|
2508
2596
|
origin: r,
|
|
2509
2597
|
recovered: !0
|
|
2510
2598
|
}, u;
|
|
@@ -2519,17 +2607,17 @@ var Lo = class {
|
|
|
2519
2607
|
options: t.options,
|
|
2520
2608
|
origin: t
|
|
2521
2609
|
});
|
|
2522
|
-
const o =
|
|
2523
|
-
const { preloadConfig:
|
|
2524
|
-
return u.length ? u.map((
|
|
2610
|
+
const o = Lo(t.options.remotes, e), n = (c) => {
|
|
2611
|
+
const { preloadConfig: a, remote: l } = c, u = a.exposes || [];
|
|
2612
|
+
return u.length ? u.map((h) => ({
|
|
2525
2613
|
ops: {
|
|
2526
2614
|
...c,
|
|
2527
2615
|
preloadConfig: {
|
|
2528
|
-
...
|
|
2529
|
-
exposes: [
|
|
2616
|
+
...a,
|
|
2617
|
+
exposes: [h]
|
|
2530
2618
|
}
|
|
2531
2619
|
},
|
|
2532
|
-
id:
|
|
2620
|
+
id: Ge(l.name, h)
|
|
2533
2621
|
})) : [{
|
|
2534
2622
|
ops: c,
|
|
2535
2623
|
id: `${l.name}/*`
|
|
@@ -2537,37 +2625,37 @@ var Lo = class {
|
|
|
2537
2625
|
};
|
|
2538
2626
|
let s;
|
|
2539
2627
|
await Promise.all(o.flatMap(n).map(async (c) => {
|
|
2540
|
-
const { ops:
|
|
2628
|
+
const { ops: a, id: l } = c, { remote: u, preloadConfig: h } = a, m = K(u);
|
|
2541
2629
|
try {
|
|
2542
|
-
const { globalSnapshot:
|
|
2630
|
+
const { globalSnapshot: f, remoteSnapshot: d } = await t.snapshotHandler.loadRemoteSnapshotInfo({
|
|
2543
2631
|
moduleInfo: u,
|
|
2544
2632
|
id: l,
|
|
2545
2633
|
initiator: "preloadRemote"
|
|
2546
2634
|
}), p = await this.hooks.lifecycle.generatePreloadAssets.emit({
|
|
2547
2635
|
origin: t,
|
|
2548
|
-
preloadOptions:
|
|
2636
|
+
preloadOptions: a,
|
|
2549
2637
|
remote: u,
|
|
2550
2638
|
remoteInfo: m,
|
|
2551
|
-
globalSnapshot:
|
|
2639
|
+
globalSnapshot: f,
|
|
2552
2640
|
remoteSnapshot: d
|
|
2553
2641
|
});
|
|
2554
2642
|
if (!p) return;
|
|
2555
|
-
const E = await
|
|
2643
|
+
const E = await jt(m, t, p, !0, {
|
|
2556
2644
|
initiator: "preloadRemote",
|
|
2557
2645
|
id: l
|
|
2558
2646
|
});
|
|
2559
2647
|
r.push({
|
|
2560
2648
|
remote: u,
|
|
2561
2649
|
remoteInfo: m,
|
|
2562
|
-
preloadConfig:
|
|
2650
|
+
preloadConfig: h,
|
|
2563
2651
|
id: l,
|
|
2564
2652
|
results: E
|
|
2565
2653
|
});
|
|
2566
|
-
} catch (
|
|
2654
|
+
} catch (f) {
|
|
2567
2655
|
r.push({
|
|
2568
2656
|
remote: u,
|
|
2569
2657
|
remoteInfo: m,
|
|
2570
|
-
preloadConfig:
|
|
2658
|
+
preloadConfig: h,
|
|
2571
2659
|
id: l,
|
|
2572
2660
|
results: [{
|
|
2573
2661
|
url: m.entry,
|
|
@@ -2575,15 +2663,15 @@ var Lo = class {
|
|
|
2575
2663
|
resourceType: /\.json(?:$|[?#])/i.test(m.entry) ? "manifest" : "remoteEntry",
|
|
2576
2664
|
initiator: "preloadRemote",
|
|
2577
2665
|
id: l,
|
|
2578
|
-
error:
|
|
2666
|
+
error: f
|
|
2579
2667
|
}]
|
|
2580
2668
|
});
|
|
2581
2669
|
}
|
|
2582
2670
|
}));
|
|
2583
|
-
const
|
|
2584
|
-
if (
|
|
2671
|
+
const i = r.flatMap((c) => c.results.filter((a) => a.status === "error" || a.status === "timeout"));
|
|
2672
|
+
if (i.length > 0 && (s = /* @__PURE__ */ new Error(`preloadRemote failed to load ${i.length} resource(s).`), Object.assign(s, {
|
|
2585
2673
|
results: r,
|
|
2586
|
-
failedResults:
|
|
2674
|
+
failedResults: i
|
|
2587
2675
|
})), await this.hooks.lifecycle.afterPreloadRemote.emit({
|
|
2588
2676
|
preloadOps: e,
|
|
2589
2677
|
options: t.options,
|
|
@@ -2598,6 +2686,16 @@ var Lo = class {
|
|
|
2598
2686
|
this.registerRemote(o, r.options.remotes, { force: t == null ? void 0 : t.force });
|
|
2599
2687
|
});
|
|
2600
2688
|
}
|
|
2689
|
+
initRawContainer(e, t, r) {
|
|
2690
|
+
const { host: o } = this, n = new et({
|
|
2691
|
+
host: o,
|
|
2692
|
+
remoteInfo: K({
|
|
2693
|
+
name: e,
|
|
2694
|
+
entry: t
|
|
2695
|
+
})
|
|
2696
|
+
});
|
|
2697
|
+
return n.remoteEntryExports = r, o.moduleCache.set(e, n), n;
|
|
2698
|
+
}
|
|
2601
2699
|
async getRemoteModuleAndOptions(e) {
|
|
2602
2700
|
const { host: t } = this, { id: r } = e;
|
|
2603
2701
|
let o;
|
|
@@ -2607,31 +2705,31 @@ var Lo = class {
|
|
|
2607
2705
|
options: t.options,
|
|
2608
2706
|
origin: t
|
|
2609
2707
|
});
|
|
2610
|
-
} catch (
|
|
2708
|
+
} catch (f) {
|
|
2611
2709
|
if (o = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
2612
2710
|
id: r,
|
|
2613
2711
|
options: t.options,
|
|
2614
2712
|
origin: t,
|
|
2615
2713
|
from: "runtime",
|
|
2616
|
-
error:
|
|
2714
|
+
error: f,
|
|
2617
2715
|
lifecycle: "beforeRequest"
|
|
2618
|
-
}), !o) throw
|
|
2716
|
+
}), !o) throw f;
|
|
2619
2717
|
}
|
|
2620
|
-
const { id: n } = o, s =
|
|
2718
|
+
const { id: n } = o, s = Qe(t.options.remotes, n);
|
|
2621
2719
|
if (!s) try {
|
|
2622
|
-
w(
|
|
2720
|
+
w(kt, M, {
|
|
2623
2721
|
hostName: t.options.name,
|
|
2624
2722
|
requestId: n
|
|
2625
2723
|
}, void 0, F(t.options));
|
|
2626
|
-
} catch (
|
|
2724
|
+
} catch (f) {
|
|
2627
2725
|
throw await this.hooks.lifecycle.afterMatchRemote.emit({
|
|
2628
2726
|
id: n,
|
|
2629
2727
|
options: t.options,
|
|
2630
|
-
error:
|
|
2728
|
+
error: f,
|
|
2631
2729
|
origin: t
|
|
2632
|
-
}),
|
|
2730
|
+
}), f;
|
|
2633
2731
|
}
|
|
2634
|
-
const { remote:
|
|
2732
|
+
const { remote: i } = s, c = K(i);
|
|
2635
2733
|
await this.hooks.lifecycle.afterMatchRemote.emit({
|
|
2636
2734
|
id: n,
|
|
2637
2735
|
...s,
|
|
@@ -2639,154 +2737,154 @@ var Lo = class {
|
|
|
2639
2737
|
remoteInfo: c,
|
|
2640
2738
|
origin: t
|
|
2641
2739
|
});
|
|
2642
|
-
const
|
|
2740
|
+
const a = await t.sharedHandler.hooks.lifecycle.afterResolve.emit({
|
|
2643
2741
|
id: n,
|
|
2644
2742
|
...s,
|
|
2645
2743
|
options: t.options,
|
|
2646
2744
|
origin: t,
|
|
2647
2745
|
remoteInfo: c
|
|
2648
|
-
}), { remote: l, expose: u } =
|
|
2649
|
-
|
|
2650
|
-
let
|
|
2746
|
+
}), { remote: l, expose: u } = a;
|
|
2747
|
+
L(l && u, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${n}.`);
|
|
2748
|
+
let h = t.moduleCache.get(l.name);
|
|
2651
2749
|
const m = {
|
|
2652
2750
|
host: t,
|
|
2653
2751
|
remoteInfo: c
|
|
2654
2752
|
};
|
|
2655
|
-
return
|
|
2656
|
-
module:
|
|
2753
|
+
return h || (h = new et(m), t.moduleCache.set(l.name, h)), {
|
|
2754
|
+
module: h,
|
|
2657
2755
|
moduleOptions: m,
|
|
2658
|
-
remoteMatchInfo:
|
|
2756
|
+
remoteMatchInfo: a
|
|
2659
2757
|
};
|
|
2660
2758
|
}
|
|
2661
2759
|
registerRemote(e, t, r) {
|
|
2662
2760
|
const { host: o } = this, n = () => {
|
|
2663
2761
|
if (e.alias) {
|
|
2664
|
-
const
|
|
2665
|
-
var
|
|
2666
|
-
return e.alias && (c.name.startsWith(e.alias) || ((
|
|
2762
|
+
const i = t.find((c) => {
|
|
2763
|
+
var a;
|
|
2764
|
+
return e.alias && (c.name.startsWith(e.alias) || ((a = c.alias) == null ? void 0 : a.startsWith(e.alias)));
|
|
2667
2765
|
});
|
|
2668
|
-
|
|
2766
|
+
L(!i, `The alias ${e.alias} of remote ${e.name} is not allowed to be the prefix of ${i && i.name} name or alias`);
|
|
2669
2767
|
}
|
|
2670
|
-
"entry" in e &&
|
|
2768
|
+
"entry" in e && G && typeof window < "u" && !e.entry.startsWith("http") && (e.entry = new URL(e.entry, window.location.origin).href), e.shareScope || (e.shareScope = ce), e.type || (e.type = Tt);
|
|
2671
2769
|
};
|
|
2672
2770
|
this.hooks.lifecycle.beforeRegisterRemote.emit({
|
|
2673
2771
|
remote: e,
|
|
2674
2772
|
origin: o
|
|
2675
2773
|
});
|
|
2676
|
-
const s = t.find((
|
|
2774
|
+
const s = t.find((i) => i.name === e.name);
|
|
2677
2775
|
if (!s)
|
|
2678
2776
|
n(), t.push(e), this.hooks.lifecycle.registerRemote.emit({
|
|
2679
2777
|
remote: e,
|
|
2680
2778
|
origin: o
|
|
2681
2779
|
});
|
|
2682
2780
|
else {
|
|
2683
|
-
const
|
|
2781
|
+
const i = [`The remote "${e.name}" is already registered.`, "Please note that overriding it may cause unexpected errors."];
|
|
2684
2782
|
r != null && r.force && (this.removeRemote(s), n(), t.push(e), this.hooks.lifecycle.registerRemote.emit({
|
|
2685
2783
|
remote: e,
|
|
2686
2784
|
origin: o
|
|
2687
|
-
}),
|
|
2785
|
+
}), it(i.join(" ")));
|
|
2688
2786
|
}
|
|
2689
2787
|
}
|
|
2690
2788
|
removeRemote(e) {
|
|
2691
2789
|
var t;
|
|
2692
2790
|
try {
|
|
2693
|
-
const { host: r } = this, { name: o } = e, n = r.options.remotes.findIndex((
|
|
2791
|
+
const { host: r } = this, { name: o } = e, n = r.options.remotes.findIndex((a) => a.name === o);
|
|
2694
2792
|
n !== -1 && r.options.remotes.splice(n, 1);
|
|
2695
|
-
const s =
|
|
2696
|
-
delete
|
|
2697
|
-
const { hostGlobalSnapshot:
|
|
2698
|
-
if (
|
|
2699
|
-
const
|
|
2700
|
-
|
|
2793
|
+
const s = W(v.__FEDERATION__.moduleInfo, se(e)).key;
|
|
2794
|
+
delete v.__FEDERATION__.moduleInfo[s], "entry" in e && (r.snapshotHandler.manifestCache.delete(e.entry), delete _e.__FEDERATION__.__MANIFEST_LOADING__[e.entry]);
|
|
2795
|
+
const { hostGlobalSnapshot: i } = zt(e, r);
|
|
2796
|
+
if (i) {
|
|
2797
|
+
const a = i && "remotesInfo" in i && i.remotesInfo && W(i.remotesInfo, e.name).key;
|
|
2798
|
+
a && delete i.remotesInfo[a];
|
|
2701
2799
|
}
|
|
2702
2800
|
const c = r.moduleCache.get(e.name);
|
|
2703
2801
|
if (c) {
|
|
2704
|
-
const
|
|
2705
|
-
|
|
2706
|
-
const u =
|
|
2707
|
-
|
|
2708
|
-
let
|
|
2709
|
-
const m =
|
|
2802
|
+
const a = c.remoteInfo, l = a.entryGlobalName;
|
|
2803
|
+
v[l] && ((t = Object.getOwnPropertyDescriptor(v, l)) != null && t.configurable ? delete v[l] : v[l] = void 0);
|
|
2804
|
+
const u = Le(c.remoteInfo);
|
|
2805
|
+
J[u] && delete J[u];
|
|
2806
|
+
let h = a.buildVersion ? st(a.name, a.buildVersion) : a.name;
|
|
2807
|
+
const m = v.__FEDERATION__.__INSTANCES__.findIndex((f) => a.buildVersion ? f.options.id === h : f.name === h);
|
|
2710
2808
|
if (m !== -1) {
|
|
2711
|
-
const
|
|
2712
|
-
|
|
2713
|
-
const d =
|
|
2809
|
+
const f = v.__FEDERATION__.__INSTANCES__[m];
|
|
2810
|
+
h = f.options.id || h;
|
|
2811
|
+
const d = Nt();
|
|
2714
2812
|
let p = !0;
|
|
2715
2813
|
const E = [];
|
|
2716
2814
|
Object.keys(d).forEach((y) => {
|
|
2717
|
-
const
|
|
2718
|
-
|
|
2719
|
-
const
|
|
2720
|
-
|
|
2721
|
-
const
|
|
2722
|
-
|
|
2723
|
-
const
|
|
2724
|
-
|
|
2815
|
+
const R = d[y];
|
|
2816
|
+
R && Object.keys(R).forEach((g) => {
|
|
2817
|
+
const _ = R[g];
|
|
2818
|
+
_ && Object.keys(_).forEach((S) => {
|
|
2819
|
+
const I = _[S];
|
|
2820
|
+
I && Object.keys(I).forEach((b) => {
|
|
2821
|
+
const $ = I[b];
|
|
2822
|
+
$ && typeof $ == "object" && $.from === a.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((P) => P !== a.name), $.useIn.length ? p = !1 : E.push([
|
|
2725
2823
|
y,
|
|
2726
2824
|
g,
|
|
2727
|
-
|
|
2728
|
-
|
|
2825
|
+
S,
|
|
2826
|
+
b
|
|
2729
2827
|
])) : E.push([
|
|
2730
2828
|
y,
|
|
2731
2829
|
g,
|
|
2732
|
-
|
|
2733
|
-
|
|
2830
|
+
S,
|
|
2831
|
+
b
|
|
2734
2832
|
]));
|
|
2735
2833
|
});
|
|
2736
2834
|
});
|
|
2737
2835
|
});
|
|
2738
|
-
}), p && (
|
|
2739
|
-
var
|
|
2740
|
-
(
|
|
2741
|
-
}),
|
|
2836
|
+
}), p && (f.shareScopeMap = {}, delete d[h]), E.forEach(([y, R, g, _]) => {
|
|
2837
|
+
var S, I, b;
|
|
2838
|
+
(b = (I = (S = d[y]) == null ? void 0 : S[R]) == null ? void 0 : I[g]) == null || delete b[_];
|
|
2839
|
+
}), v.__FEDERATION__.__INSTANCES__.splice(m, 1);
|
|
2742
2840
|
}
|
|
2743
2841
|
r.moduleCache.delete(e.name);
|
|
2744
2842
|
}
|
|
2745
2843
|
} catch (r) {
|
|
2746
|
-
|
|
2844
|
+
ke.error(`removeRemote failed: ${r instanceof Error ? r.message : String(r)}`);
|
|
2747
2845
|
}
|
|
2748
2846
|
}
|
|
2749
2847
|
};
|
|
2750
|
-
const
|
|
2751
|
-
var
|
|
2848
|
+
const Zo = typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN == "boolean" ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN : !0, ve = typeof FEDERATION_OPTIMIZE_NO_REMOTE == "boolean" ? !FEDERATION_OPTIMIZE_NO_REMOTE : !0, tt = typeof FEDERATION_OPTIMIZE_NO_SHARED == "boolean" ? !FEDERATION_OPTIMIZE_NO_SHARED : !0;
|
|
2849
|
+
var Xo = class {
|
|
2752
2850
|
constructor(e) {
|
|
2753
|
-
this.hooks = new
|
|
2754
|
-
beforeInit: new
|
|
2851
|
+
this.hooks = new H({
|
|
2852
|
+
beforeInit: new X("beforeInit"),
|
|
2755
2853
|
init: new A(),
|
|
2756
|
-
beforeInitContainer: new
|
|
2757
|
-
initContainer: new
|
|
2758
|
-
}), this.version = "2.
|
|
2854
|
+
beforeInitContainer: new D("beforeInitContainer"),
|
|
2855
|
+
initContainer: new D("initContainer")
|
|
2856
|
+
}), this.version = "2.8.0", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new H({
|
|
2759
2857
|
getModuleInfo: new A(),
|
|
2760
2858
|
createScript: new A(),
|
|
2761
2859
|
createLink: new A(),
|
|
2762
|
-
fetch: new
|
|
2763
|
-
loadEntryError: new
|
|
2764
|
-
afterLoadEntry: new
|
|
2765
|
-
beforeInitRemote: new
|
|
2766
|
-
afterInitRemote: new
|
|
2767
|
-
beforeGetExpose: new
|
|
2768
|
-
afterGetExpose: new
|
|
2769
|
-
beforeExecuteFactory: new
|
|
2770
|
-
afterExecuteFactory: new
|
|
2771
|
-
getModuleFactory: new
|
|
2772
|
-
}), this.bridgeHook = new
|
|
2860
|
+
fetch: new T(),
|
|
2861
|
+
loadEntryError: new T(),
|
|
2862
|
+
afterLoadEntry: new T("afterLoadEntry"),
|
|
2863
|
+
beforeInitRemote: new T("beforeInitRemote"),
|
|
2864
|
+
afterInitRemote: new T("afterInitRemote"),
|
|
2865
|
+
beforeGetExpose: new T("beforeGetExpose"),
|
|
2866
|
+
afterGetExpose: new T("afterGetExpose"),
|
|
2867
|
+
beforeExecuteFactory: new T("beforeExecuteFactory"),
|
|
2868
|
+
afterExecuteFactory: new T("afterExecuteFactory"),
|
|
2869
|
+
getModuleFactory: new T()
|
|
2870
|
+
}), this.bridgeHook = new H({
|
|
2773
2871
|
beforeBridgeRender: new A(),
|
|
2774
2872
|
afterBridgeRender: new A(),
|
|
2775
2873
|
beforeBridgeDestroy: new A(),
|
|
2776
2874
|
afterBridgeDestroy: new A()
|
|
2777
2875
|
});
|
|
2778
|
-
const t =
|
|
2779
|
-
id:
|
|
2876
|
+
const t = ve && Zo ? [Uo(), Wo()] : [], r = {
|
|
2877
|
+
id: Po(),
|
|
2780
2878
|
name: e.name,
|
|
2781
2879
|
plugins: t,
|
|
2782
2880
|
remotes: [],
|
|
2783
2881
|
shared: {},
|
|
2784
|
-
inBrowser:
|
|
2882
|
+
inBrowser: G
|
|
2785
2883
|
};
|
|
2786
|
-
this.name = e.name, this.options = r, this.snapshotHandler = new
|
|
2884
|
+
this.name = e.name, this.options = r, this.snapshotHandler = ve ? new Vo(this) : new qo(), this.sharedHandler = tt ? new zo(this) : new Ko(), this.remoteHandler = ve ? new Jo(this) : new Go(), this.shareScopeMap = this.sharedHandler.shareScopeMap, this.registerPlugins([...r.plugins, ...e.plugins || []]), this.options = this.formatOptions(r, e);
|
|
2787
2885
|
}
|
|
2788
2886
|
initOptions(e) {
|
|
2789
|
-
e.name && e.name !== this.options.name && w(
|
|
2887
|
+
e.name && e.name !== this.options.name && w(yt(Ct, M)), this.registerPlugins(e.plugins);
|
|
2790
2888
|
const t = this.formatOptions(this.options, e);
|
|
2791
2889
|
return this.options = t, t;
|
|
2792
2890
|
}
|
|
@@ -2796,18 +2894,11 @@ var Fo = class {
|
|
|
2796
2894
|
loadShareSync(e, t) {
|
|
2797
2895
|
return this.sharedHandler.loadShareSync(e, t);
|
|
2798
2896
|
}
|
|
2799
|
-
initializeSharing(e =
|
|
2897
|
+
initializeSharing(e = ce, t) {
|
|
2800
2898
|
return this.sharedHandler.initializeSharing(e, t);
|
|
2801
2899
|
}
|
|
2802
2900
|
initRawContainer(e, t, r) {
|
|
2803
|
-
|
|
2804
|
-
name: e,
|
|
2805
|
-
entry: t
|
|
2806
|
-
}), n = new Dt({
|
|
2807
|
-
host: this,
|
|
2808
|
-
remoteInfo: o
|
|
2809
|
-
});
|
|
2810
|
-
return n.remoteEntryExports = r, this.moduleCache.set(e, n), n;
|
|
2901
|
+
return this.remoteHandler.initRawContainer(e, t, r);
|
|
2811
2902
|
}
|
|
2812
2903
|
async loadRemote(e, t) {
|
|
2813
2904
|
return this.remoteHandler.loadRemote(e, t);
|
|
@@ -2819,30 +2910,30 @@ var Fo = class {
|
|
|
2819
2910
|
this.sharedHandler.initShareScopeMap(e, t, r);
|
|
2820
2911
|
}
|
|
2821
2912
|
formatOptions(e, t) {
|
|
2822
|
-
const
|
|
2913
|
+
const r = tt ? vt(e, t).allShareInfos : {}, { userOptions: o, options: n } = this.hooks.lifecycle.beforeInit.emit({
|
|
2823
2914
|
origin: this,
|
|
2824
2915
|
userOptions: t,
|
|
2825
2916
|
options: e,
|
|
2826
2917
|
shareInfo: r
|
|
2827
|
-
}), s = this.remoteHandler.formatAndRegisterRemote(n, o), { allShareInfos:
|
|
2918
|
+
}), s = this.remoteHandler.formatAndRegisterRemote(n, o), { allShareInfos: i } = this.sharedHandler.registerShared(n, o), c = [...n.plugins];
|
|
2828
2919
|
o.plugins && o.plugins.forEach((l) => {
|
|
2829
2920
|
c.includes(l) || c.push(l);
|
|
2830
2921
|
});
|
|
2831
|
-
const
|
|
2922
|
+
const a = {
|
|
2832
2923
|
...e,
|
|
2833
2924
|
...t,
|
|
2834
2925
|
plugins: c,
|
|
2835
2926
|
remotes: s,
|
|
2836
|
-
shared:
|
|
2927
|
+
shared: i,
|
|
2837
2928
|
id: o.id || e.id
|
|
2838
2929
|
};
|
|
2839
2930
|
return this.hooks.lifecycle.init.emit({
|
|
2840
2931
|
origin: this,
|
|
2841
|
-
options:
|
|
2842
|
-
}),
|
|
2932
|
+
options: a
|
|
2933
|
+
}), a;
|
|
2843
2934
|
}
|
|
2844
2935
|
registerPlugins(e) {
|
|
2845
|
-
const t =
|
|
2936
|
+
const t = ko(e, this);
|
|
2846
2937
|
this.options.plugins = this.options.plugins.reduce((r, o) => (o && r && !r.find((n) => n.name === o.name) && r.push(o), r), t || []);
|
|
2847
2938
|
}
|
|
2848
2939
|
registerRemotes(e, t) {
|
|
@@ -2855,12 +2946,12 @@ var Fo = class {
|
|
|
2855
2946
|
});
|
|
2856
2947
|
}
|
|
2857
2948
|
};
|
|
2858
|
-
let
|
|
2859
|
-
function
|
|
2860
|
-
return
|
|
2949
|
+
let Yo = null;
|
|
2950
|
+
function Kt(e) {
|
|
2951
|
+
return Yo;
|
|
2861
2952
|
}
|
|
2862
|
-
|
|
2863
|
-
function
|
|
2953
|
+
Dr(Xo);
|
|
2954
|
+
function Jt(e, t) {
|
|
2864
2955
|
const r = (o) => {
|
|
2865
2956
|
if (!o.startsWith("/")) return o;
|
|
2866
2957
|
const n = o.length > 1 && o.endsWith("/"), s = `${t}/${o}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/";
|
|
@@ -2874,109 +2965,109 @@ function Wt(e, t) {
|
|
|
2874
2965
|
return typeof o.redirect == "string" ? n.redirect = r(o.redirect) : o.redirect && typeof o.redirect == "object" && "path" in o.redirect && typeof o.redirect.path == "string" && (n.redirect = {
|
|
2875
2966
|
...o.redirect,
|
|
2876
2967
|
path: r(o.redirect.path)
|
|
2877
|
-
}), o.children && o.children.length > 0 && (n.children =
|
|
2968
|
+
}), o.children && o.children.length > 0 && (n.children = Jt(
|
|
2878
2969
|
o.children,
|
|
2879
2970
|
t
|
|
2880
2971
|
)), n;
|
|
2881
2972
|
});
|
|
2882
2973
|
}
|
|
2883
|
-
function
|
|
2974
|
+
function Qo(e) {
|
|
2884
2975
|
const t = e.replace(/\/+$/, ""), r = (s) => s.startsWith("/") && s !== t && !s.startsWith(t + "/"), o = (s) => `${t}${s}`.replace(/\/+/g, "/"), n = (s) => typeof s == "string" ? r(s) ? o(s) : s : "path" in s && typeof s.path == "string" && r(s.path) ? { ...s, path: o(s.path) } : s;
|
|
2885
2976
|
return (s) => {
|
|
2886
|
-
const
|
|
2887
|
-
s.push = (l) =>
|
|
2977
|
+
const i = s.push.bind(s), c = s.replace.bind(s), a = s.resolve.bind(s);
|
|
2978
|
+
s.push = (l) => i(n(l)), s.replace = (l) => c(n(l)), s.resolve = (l, ...u) => a(n(l), ...u);
|
|
2888
2979
|
};
|
|
2889
2980
|
}
|
|
2890
|
-
function
|
|
2981
|
+
function en(e) {
|
|
2891
2982
|
const { router: t, basename: r, memoryRoute: o, hashRoute: n } = e, s = t.getRoutes().sort(
|
|
2892
|
-
(
|
|
2893
|
-
),
|
|
2894
|
-
s.forEach((
|
|
2895
|
-
const d =
|
|
2896
|
-
d.push(
|
|
2983
|
+
(f, d) => f.path.split("/").filter((p) => p).length - d.path.split("/").filter((p) => p).length
|
|
2984
|
+
), i = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
|
|
2985
|
+
s.forEach((f) => {
|
|
2986
|
+
const d = i.get(f.path) || [];
|
|
2987
|
+
d.push(f), i.set(f.path, d);
|
|
2897
2988
|
});
|
|
2898
|
-
const
|
|
2899
|
-
if (!
|
|
2900
|
-
return
|
|
2901
|
-
for (let p = 0; p <
|
|
2902
|
-
const E =
|
|
2903
|
-
(
|
|
2989
|
+
const a = (f, d) => `${f}/${d}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/", l = (f, d = "") => {
|
|
2990
|
+
if (!f.children || f.children.length === 0)
|
|
2991
|
+
return f;
|
|
2992
|
+
for (let p = 0; p < f.children.length; p++) {
|
|
2993
|
+
const E = f.children[p], y = a(d, E.path), g = (i.get(y) || []).find(
|
|
2994
|
+
(_) => !c.has(_) && _ !== f && (E.name == null || _.name === E.name)
|
|
2904
2995
|
);
|
|
2905
2996
|
if (g) {
|
|
2906
|
-
const
|
|
2997
|
+
const _ = {
|
|
2907
2998
|
...g,
|
|
2908
2999
|
path: E.path
|
|
2909
3000
|
// Keep the original relative path from static route
|
|
2910
3001
|
};
|
|
2911
|
-
|
|
3002
|
+
f.children[p] = _, c.add(g), l(_, y);
|
|
2912
3003
|
}
|
|
2913
3004
|
}
|
|
2914
|
-
return
|
|
3005
|
+
return f;
|
|
2915
3006
|
};
|
|
2916
3007
|
let u = [];
|
|
2917
|
-
for (const
|
|
2918
|
-
if (!c.has(
|
|
2919
|
-
const d = l(
|
|
2920
|
-
c.add(
|
|
3008
|
+
for (const f of s)
|
|
3009
|
+
if (!c.has(f)) {
|
|
3010
|
+
const d = l(f, f.path);
|
|
3011
|
+
c.add(f), u.push(d);
|
|
2921
3012
|
}
|
|
2922
|
-
let
|
|
2923
|
-
return o ?
|
|
3013
|
+
let h, m;
|
|
3014
|
+
return o ? h = fe.createMemoryHistory(r) : n ? (h = fe.createWebHashHistory(), r && (u = Jt(u, r), m = Qo(r))) : h = fe.createWebHistory(r), { history: h, routes: u, patchRouter: m };
|
|
2924
3015
|
}
|
|
2925
|
-
function
|
|
2926
|
-
const t = /* @__PURE__ */ new Map(), r =
|
|
3016
|
+
function an(e) {
|
|
3017
|
+
const t = /* @__PURE__ */ new Map(), r = Kt();
|
|
2927
3018
|
return () => ({
|
|
2928
|
-
__APP_VERSION__: "2.
|
|
3019
|
+
__APP_VERSION__: "2.8.0",
|
|
2929
3020
|
async render(o) {
|
|
2930
|
-
var d, p, E, y,
|
|
3021
|
+
var d, p, E, y, R, g;
|
|
2931
3022
|
C.debug("createBridgeComponent render Info", o);
|
|
2932
3023
|
const {
|
|
2933
3024
|
moduleName: n,
|
|
2934
3025
|
dom: s,
|
|
2935
|
-
basename:
|
|
3026
|
+
basename: i,
|
|
2936
3027
|
memoryRoute: c,
|
|
2937
|
-
hashRoute:
|
|
3028
|
+
hashRoute: a,
|
|
2938
3029
|
...l
|
|
2939
|
-
} = o, u =
|
|
3030
|
+
} = o, u = Zt.createApp(e.rootComponent, l);
|
|
2940
3031
|
t.set(s, u);
|
|
2941
|
-
const
|
|
3032
|
+
const h = await ((E = (p = (d = r == null ? void 0 : r.bridgeHook) == null ? void 0 : d.lifecycle) == null ? void 0 : p.beforeBridgeRender) == null ? void 0 : E.emit(o)), m = h && typeof h == "object" && (h != null && h.extraProps) ? h == null ? void 0 : h.extraProps : {}, f = e.appOptions({
|
|
2942
3033
|
app: u,
|
|
2943
|
-
basename:
|
|
3034
|
+
basename: i,
|
|
2944
3035
|
memoryRoute: c,
|
|
2945
|
-
hashRoute:
|
|
3036
|
+
hashRoute: a,
|
|
2946
3037
|
...l,
|
|
2947
3038
|
...m
|
|
2948
3039
|
});
|
|
2949
|
-
if (
|
|
2950
|
-
const { history:
|
|
2951
|
-
router:
|
|
3040
|
+
if (f != null && f.router) {
|
|
3041
|
+
const { history: _, routes: S, patchRouter: I } = en({
|
|
3042
|
+
router: f.router,
|
|
2952
3043
|
basename: o.basename,
|
|
2953
3044
|
memoryRoute: o.memoryRoute,
|
|
2954
3045
|
hashRoute: o.hashRoute
|
|
2955
|
-
}),
|
|
2956
|
-
...
|
|
2957
|
-
history:
|
|
2958
|
-
routes:
|
|
3046
|
+
}), b = fe.createRouter({
|
|
3047
|
+
...f.router.options,
|
|
3048
|
+
history: _,
|
|
3049
|
+
routes: S
|
|
2959
3050
|
});
|
|
2960
|
-
|
|
3051
|
+
I && I(b), f.afterRouterCreate && f.afterRouterCreate(b), C.debug("createBridgeComponent render router info>>>", {
|
|
2961
3052
|
moduleName: n,
|
|
2962
|
-
router:
|
|
2963
|
-
}), c && await
|
|
3053
|
+
router: b
|
|
3054
|
+
}), c && await b.push(c.entryPath), u.use(b);
|
|
2964
3055
|
}
|
|
2965
|
-
u.mount(s), (g = (
|
|
3056
|
+
u.mount(s), (g = (R = (y = r == null ? void 0 : r.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : R.afterBridgeRender) == null || g.emit(o);
|
|
2966
3057
|
},
|
|
2967
3058
|
destroy(o) {
|
|
2968
|
-
var s,
|
|
3059
|
+
var s, i, c, a, l, u;
|
|
2969
3060
|
C.debug("createBridgeComponent destroy Info", o);
|
|
2970
3061
|
const n = t.get(o == null ? void 0 : o.dom);
|
|
2971
|
-
(c = (
|
|
3062
|
+
(c = (i = (s = r == null ? void 0 : r.bridgeHook) == null ? void 0 : s.lifecycle) == null ? void 0 : i.beforeBridgeDestroy) == null || c.emit(o), n == null || n.unmount(), (u = (l = (a = r == null ? void 0 : r.bridgeHook) == null ? void 0 : a.lifecycle) == null ? void 0 : l.afterBridgeDestroy) == null || u.emit(o);
|
|
2972
3063
|
}
|
|
2973
3064
|
});
|
|
2974
3065
|
}
|
|
2975
|
-
function
|
|
3066
|
+
function tn() {
|
|
2976
3067
|
const e = new PopStateEvent("popstate", { state: window.history.state });
|
|
2977
3068
|
window.dispatchEvent(e);
|
|
2978
3069
|
}
|
|
2979
|
-
const
|
|
3070
|
+
const rn = /* @__PURE__ */ Xt({
|
|
2980
3071
|
name: "RemoteApp",
|
|
2981
3072
|
props: {
|
|
2982
3073
|
moduleName: String,
|
|
@@ -2988,14 +3079,14 @@ const Uo = /* @__PURE__ */ qt({
|
|
|
2988
3079
|
},
|
|
2989
3080
|
inheritAttrs: !1,
|
|
2990
3081
|
setup(e) {
|
|
2991
|
-
const t = V(null), r = V(null), o = V(""), n = V(!1), s = V(!1),
|
|
3082
|
+
const t = V(null), r = V(null), o = V(""), n = V(!1), s = V(!1), i = V(!1), c = rt(), a = Kt(), l = Yt(), u = () => ({
|
|
2992
3083
|
name: e.moduleName,
|
|
2993
3084
|
dom: t.value,
|
|
2994
3085
|
basename: e.basename,
|
|
2995
3086
|
memoryRoute: e.memoryRoute,
|
|
2996
3087
|
hashRoute: e.hashRoute
|
|
2997
|
-
}),
|
|
2998
|
-
var y,
|
|
3088
|
+
}), h = async () => {
|
|
3089
|
+
var y, R, g, _, S, I, b;
|
|
2999
3090
|
if (!t.value || n.value)
|
|
3000
3091
|
return;
|
|
3001
3092
|
const d = (y = e.providerInfo) == null ? void 0 : y.call(e);
|
|
@@ -3009,13 +3100,13 @@ const Uo = /* @__PURE__ */ qt({
|
|
|
3009
3100
|
hashRoute: e.hashRoute
|
|
3010
3101
|
};
|
|
3011
3102
|
C.debug("createRemoteAppComponent LazyComponent render >>>", p);
|
|
3012
|
-
const E = await ((
|
|
3103
|
+
const E = await ((_ = (g = (R = a == null ? void 0 : a.bridgeHook) == null ? void 0 : R.lifecycle) == null ? void 0 : g.beforeBridgeRender) == null ? void 0 : _.emit(p)) || {};
|
|
3013
3104
|
p = {
|
|
3014
3105
|
...p,
|
|
3015
3106
|
...E.extraProps
|
|
3016
|
-
}, d.render(p), n.value = !0, (
|
|
3107
|
+
}, d.render(p), n.value = !0, (b = (I = (S = a == null ? void 0 : a.bridgeHook) == null ? void 0 : S.lifecycle) == null ? void 0 : I.afterBridgeRender) == null || b.emit(p);
|
|
3017
3108
|
}, m = () => {
|
|
3018
|
-
var E, y,
|
|
3109
|
+
var E, y, R, g, _, S;
|
|
3019
3110
|
const d = r.value;
|
|
3020
3111
|
if (!d || !n.value)
|
|
3021
3112
|
return;
|
|
@@ -3023,38 +3114,39 @@ const Uo = /* @__PURE__ */ qt({
|
|
|
3023
3114
|
...e
|
|
3024
3115
|
});
|
|
3025
3116
|
const p = u();
|
|
3026
|
-
(
|
|
3117
|
+
(R = (y = (E = a == null ? void 0 : a.bridgeHook) == null ? void 0 : E.lifecycle) == null ? void 0 : y.beforeBridgeDestroy) == null || R.emit(p), d.destroy({
|
|
3027
3118
|
dom: t.value
|
|
3028
|
-
}), r.value = null, n.value = !1, (
|
|
3029
|
-
},
|
|
3119
|
+
}), r.value = null, n.value = !1, (S = (_ = (g = a == null ? void 0 : a.bridgeHook) == null ? void 0 : g.lifecycle) == null ? void 0 : _.afterBridgeDestroy) == null || S.emit(p);
|
|
3120
|
+
}, f = Qt(() => c == null ? void 0 : c.path, (d) => {
|
|
3030
3121
|
s.value && o.value !== "" && o.value !== d && (C.debug("createRemoteAppComponent dispatchPopstateEnv >>>", {
|
|
3031
3122
|
...e,
|
|
3032
3123
|
pathname: c.path
|
|
3033
|
-
}),
|
|
3124
|
+
}), tn()), o.value = d;
|
|
3034
3125
|
});
|
|
3035
|
-
return
|
|
3036
|
-
s.value = !0,
|
|
3037
|
-
}),
|
|
3038
|
-
s.value = !0,
|
|
3039
|
-
}),
|
|
3040
|
-
s.value = !1,
|
|
3041
|
-
}),
|
|
3042
|
-
|
|
3043
|
-
}), () =>
|
|
3126
|
+
return er(() => {
|
|
3127
|
+
s.value = !0, h();
|
|
3128
|
+
}), tr(async () => {
|
|
3129
|
+
s.value = !0, i.value && (i.value = !1, await rr(), h());
|
|
3130
|
+
}), or(() => {
|
|
3131
|
+
s.value = !1, i.value = !0, m();
|
|
3132
|
+
}), nr(() => {
|
|
3133
|
+
f(), m();
|
|
3134
|
+
}), () => sr("div", ir(e.rootAttrs || {}, {
|
|
3044
3135
|
ref: t
|
|
3045
3136
|
}), null);
|
|
3046
3137
|
}
|
|
3047
3138
|
});
|
|
3048
|
-
function
|
|
3049
|
-
return
|
|
3050
|
-
|
|
3139
|
+
function on(e) {
|
|
3140
|
+
return ar({
|
|
3141
|
+
// @ts-ignore
|
|
3142
|
+
__APP_VERSION__: "2.8.0",
|
|
3051
3143
|
...e.asyncComponentOptions,
|
|
3052
3144
|
//@ts-ignore
|
|
3053
3145
|
loader: async () => {
|
|
3054
|
-
var
|
|
3055
|
-
const t =
|
|
3146
|
+
var a, l;
|
|
3147
|
+
const t = rt();
|
|
3056
3148
|
let r = "/";
|
|
3057
|
-
const o = (l = (
|
|
3149
|
+
const o = (l = (a = t == null ? void 0 : t.matched) == null ? void 0 : a[0]) == null ? void 0 : l.path;
|
|
3058
3150
|
o && (o.endsWith("/:pathMatch(.*)*") ? r = o.replace("/:pathMatch(.*)*", "") : r = t.matched[0].path);
|
|
3059
3151
|
const n = (e == null ? void 0 : e.export) || "default";
|
|
3060
3152
|
C.debug(
|
|
@@ -3064,15 +3156,15 @@ function Bo(e) {
|
|
|
3064
3156
|
info: e
|
|
3065
3157
|
}
|
|
3066
3158
|
);
|
|
3067
|
-
const s = await e.loader(),
|
|
3159
|
+
const s = await e.loader(), i = s && s[Symbol.for("mf_module_id")], c = s[n];
|
|
3068
3160
|
if (C.debug(
|
|
3069
3161
|
"createRemoteAppComponent LazyComponent loadRemote info >>>",
|
|
3070
|
-
{ moduleName:
|
|
3162
|
+
{ moduleName: i, module: s, exportName: n, basename: r, route: t }
|
|
3071
3163
|
), n in s && typeof c == "function")
|
|
3072
3164
|
return {
|
|
3073
3165
|
render() {
|
|
3074
|
-
return
|
|
3075
|
-
moduleName:
|
|
3166
|
+
return cr(rn, {
|
|
3167
|
+
moduleName: i,
|
|
3076
3168
|
providerInfo: c,
|
|
3077
3169
|
basename: r,
|
|
3078
3170
|
rootAttrs: e.rootAttrs,
|
|
@@ -3085,13 +3177,13 @@ function Bo(e) {
|
|
|
3085
3177
|
}
|
|
3086
3178
|
});
|
|
3087
3179
|
}
|
|
3088
|
-
function
|
|
3180
|
+
function cn(e) {
|
|
3089
3181
|
return C.warn(
|
|
3090
3182
|
"createRemoteComponent is deprecated, please use createRemoteAppComponent instead!"
|
|
3091
|
-
),
|
|
3183
|
+
), on(e);
|
|
3092
3184
|
}
|
|
3093
3185
|
export {
|
|
3094
|
-
|
|
3095
|
-
|
|
3096
|
-
|
|
3186
|
+
an as createBridgeComponent,
|
|
3187
|
+
on as createRemoteAppComponent,
|
|
3188
|
+
cn as createRemoteComponent
|
|
3097
3189
|
};
|