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