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