@module-federation/bridge-vue3 0.0.0-next-20250617125105 → 0.0.0-next-20250618045528

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.js CHANGED
@@ -4,14 +4,14 @@ import * as VueRouter from "vue-router";
4
4
  import { useRoute } from "vue-router";
5
5
  function _extends$2() {
6
6
  return _extends$2 = Object.assign || function(t) {
7
- for (var o = 1; o < arguments.length; o++) {
8
- var r = arguments[o];
9
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
7
+ for (var r = 1; r < arguments.length; r++) {
8
+ var o = arguments[r];
9
+ for (var s in o) Object.prototype.hasOwnProperty.call(o, s) && (t[s] = o[s]);
10
10
  }
11
11
  return t;
12
12
  }, _extends$2.apply(this, arguments);
13
13
  }
14
- const MANIFEST_EXT = ".json", BROWSER_LOG_KEY = "FEDERATION_DEBUG", SEPARATOR = ":";
14
+ const MANIFEST_EXT = ".json", BROWSER_LOG_KEY = "FEDERATION_DEBUG", BROWSER_LOG_VALUE = "1", SEPARATOR = ":";
15
15
  function isBrowserEnv() {
16
16
  return typeof window < "u" && typeof window.document < "u";
17
17
  }
@@ -22,7 +22,7 @@ function isReactNativeEnv() {
22
22
  function isBrowserDebug() {
23
23
  try {
24
24
  if (isBrowserEnv() && window.localStorage)
25
- return !!localStorage.getItem(BROWSER_LOG_KEY);
25
+ return localStorage.getItem(BROWSER_LOG_KEY) === BROWSER_LOG_VALUE;
26
26
  } catch {
27
27
  return !1;
28
28
  }
@@ -32,11 +32,11 @@ function isDebugMode() {
32
32
  return typeof process < "u" && process.env && process.env.FEDERATION_DEBUG ? !!process.env.FEDERATION_DEBUG : typeof FEDERATION_DEBUG < "u" && FEDERATION_DEBUG ? !0 : isBrowserDebug();
33
33
  }
34
34
  const LOG_CATEGORY$1 = "[ Federation Runtime ]", composeKeyWithSeparator = function(...n) {
35
- return n.length ? n.reduce((t, o) => o ? t ? `${t}${SEPARATOR}${o}` : o : t, "") : "";
35
+ return n.length ? n.reduce((t, r) => r ? t ? `${t}${SEPARATOR}${r}` : r : t, "") : "";
36
36
  }, getResourceUrl = (n, t) => {
37
37
  if ("getPublicPath" in n) {
38
- let o;
39
- return n.getPublicPath.startsWith("function") ? o = new Function("return " + n.getPublicPath)()() : o = new Function(n.getPublicPath)(), `${o}${t}`;
38
+ let r;
39
+ return n.getPublicPath.startsWith("function") ? r = new Function("return " + n.getPublicPath)()() : r = new Function(n.getPublicPath)(), `${r}${t}`;
40
40
  } else return "publicPath" in n ? !isBrowserEnv() && !isReactNativeEnv() && "ssrPublicPath" in n ? `${n.ssrPublicPath}${t}` : `${n.publicPath}${t}` : (console.warn("Cannot get resource URL. If in debug mode, please ignore.", n, t), "");
41
41
  }, warn$1 = (n) => {
42
42
  console.warn(`${LOG_CATEGORY$1}: ${n}`);
@@ -51,45 +51,45 @@ function safeToString(n) {
51
51
  const simpleJoinRemoteEntry = (n, t) => {
52
52
  if (!n)
53
53
  return t;
54
- const r = ((s) => {
54
+ const o = ((s) => {
55
55
  if (s === ".")
56
56
  return "";
57
57
  if (s.startsWith("./"))
58
58
  return s.replace("./", "");
59
59
  if (s.startsWith("/")) {
60
- const a = s.slice(1);
61
- return a.endsWith("/") ? a.slice(0, -1) : a;
60
+ const l = s.slice(1);
61
+ return l.endsWith("/") ? l.slice(0, -1) : l;
62
62
  }
63
63
  return s;
64
64
  })(n);
65
- return r ? r.endsWith("/") ? `${r}${t}` : `${r}/${t}` : t;
65
+ return o ? o.endsWith("/") ? `${o}${t}` : `${o}/${t}` : t;
66
66
  };
67
67
  function inferAutoPublicPath(n) {
68
68
  return n.replace(/#.*$/, "").replace(/\?.*$/, "").replace(/\/[^\/]+$/, "/");
69
69
  }
70
70
  function generateSnapshotFromManifest(n, t = {}) {
71
- var o, r;
72
- const { remotes: s = {}, overrides: a = {}, version: l } = t;
71
+ var r, o;
72
+ const { remotes: s = {}, overrides: l = {}, version: a } = t;
73
73
  let i;
74
- const c = () => "publicPath" in n.metaData ? n.metaData.publicPath === "auto" && l ? inferAutoPublicPath(l) : n.metaData.publicPath : n.metaData.getPublicPath, u = Object.keys(a);
74
+ const c = () => "publicPath" in n.metaData ? n.metaData.publicPath === "auto" && a ? inferAutoPublicPath(a) : n.metaData.publicPath : n.metaData.getPublicPath, u = Object.keys(l);
75
75
  let p = {};
76
76
  if (!Object.keys(s).length) {
77
77
  var d;
78
78
  p = ((d = n.remotes) == null ? void 0 : d.reduce((R, A) => {
79
79
  let T;
80
80
  const $ = A.federationContainerName;
81
- return u.includes($) ? T = a[$] : "version" in A ? T = A.version : T = A.entry, R[$] = {
81
+ return u.includes($) ? T = l[$] : "version" in A ? T = A.version : T = A.entry, R[$] = {
82
82
  matchedVersion: T
83
83
  }, R;
84
84
  }, {})) || {};
85
85
  }
86
86
  Object.keys(s).forEach((R) => p[R] = {
87
87
  // overrides will override dependencies
88
- matchedVersion: u.includes(R) ? a[R] : s[R]
88
+ matchedVersion: u.includes(R) ? l[R] : s[R]
89
89
  });
90
90
  const { remoteEntry: { path: m, name: y, type: g }, types: E, buildInfo: { buildVersion: _ }, globalName: b, ssrRemoteEntry: v } = n.metaData, { exposes: I } = n;
91
91
  let S = {
92
- version: l || "",
92
+ version: a || "",
93
93
  buildVersion: _,
94
94
  globalName: b,
95
95
  remoteEntry: simpleJoinRemoteEntry(m, y),
@@ -109,13 +109,13 @@ function generateSnapshotFromManifest(n, t = {}) {
109
109
  assets: R.assets
110
110
  }))
111
111
  };
112
- if ((o = n.metaData) != null && o.prefetchInterface) {
112
+ if ((r = n.metaData) != null && r.prefetchInterface) {
113
113
  const R = n.metaData.prefetchInterface;
114
114
  S = _extends$2({}, S, {
115
115
  prefetchInterface: R
116
116
  });
117
117
  }
118
- if ((r = n.metaData) != null && r.prefetchEntry) {
118
+ if ((o = n.metaData) != null && o.prefetchEntry) {
119
119
  const { path: R, name: A, type: T } = n.metaData.prefetchEntry;
120
120
  S = _extends$2({}, S, {
121
121
  prefetchEntry: simpleJoinRemoteEntry(R, A),
@@ -171,22 +171,22 @@ function createLogger(n) {
171
171
  async function safeWrapper(n, t) {
172
172
  try {
173
173
  return await n();
174
- } catch (o) {
175
- warn$1(o);
174
+ } catch (r) {
175
+ warn$1(r);
176
176
  return;
177
177
  }
178
178
  }
179
179
  function isStaticResourcesEqual(n, t) {
180
- const o = /^(https?:)?\/\//i, r = n.replace(o, "").replace(/\/$/, ""), s = t.replace(o, "").replace(/\/$/, "");
181
- return r === s;
180
+ const r = /^(https?:)?\/\//i, o = n.replace(r, "").replace(/\/$/, ""), s = t.replace(r, "").replace(/\/$/, "");
181
+ return o === s;
182
182
  }
183
183
  function createScript(n) {
184
- let t = null, o = !0, r = 2e4, s;
185
- const a = document.getElementsByTagName("script");
186
- for (let i = 0; i < a.length; i++) {
187
- const c = a[i], u = c.getAttribute("src");
184
+ let t = null, r = !0, o = 2e4, s;
185
+ const l = document.getElementsByTagName("script");
186
+ for (let i = 0; i < l.length; i++) {
187
+ const c = l[i], u = c.getAttribute("src");
188
188
  if (u && isStaticResourcesEqual(u, n.url)) {
189
- t = c, o = !1;
189
+ t = c, r = !1;
190
190
  break;
191
191
  }
192
192
  }
@@ -194,11 +194,11 @@ function createScript(n) {
194
194
  const i = n.attrs;
195
195
  t = document.createElement("script"), t.type = (i == null ? void 0 : i.type) === "module" ? "module" : "text/javascript";
196
196
  let c;
197
- 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) => {
197
+ 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 && (o = c.timeout))), t.src || (t.src = n.url), i && !c && Object.keys(i).forEach((u) => {
198
198
  t && (u === "async" || u === "defer" ? t[u] = i[u] : t.getAttribute(u) || t.setAttribute(u, i[u]));
199
199
  });
200
200
  }
201
- const l = async (i, c) => {
201
+ const a = async (i, c) => {
202
202
  clearTimeout(s);
203
203
  const u = () => {
204
204
  (c == null ? void 0 : c.type) === "error" ? n != null && n.onErrorCallback && (n == null || n.onErrorCallback(c)) : n != null && n.cb && (n == null || n.cb());
@@ -216,77 +216,77 @@ function createScript(n) {
216
216
  }
217
217
  u();
218
218
  };
219
- return t.onerror = l.bind(null, t.onerror), t.onload = l.bind(null, t.onload), s = setTimeout(() => {
220
- l(null, new Error(`Remote script "${n.url}" time-outed.`));
221
- }, r), {
219
+ return t.onerror = a.bind(null, t.onerror), t.onload = a.bind(null, t.onload), s = setTimeout(() => {
220
+ a(null, new Error(`Remote script "${n.url}" time-outed.`));
221
+ }, o), {
222
222
  script: t,
223
- needAttach: o
223
+ needAttach: r
224
224
  };
225
225
  }
226
226
  function createLink(n) {
227
- let t = null, o = !0;
228
- const r = document.getElementsByTagName("link");
229
- for (let a = 0; a < r.length; a++) {
230
- const l = r[a], i = l.getAttribute("href"), c = l.getAttribute("rel");
227
+ let t = null, r = !0;
228
+ const o = document.getElementsByTagName("link");
229
+ for (let l = 0; l < o.length; l++) {
230
+ const a = o[l], i = a.getAttribute("href"), c = a.getAttribute("rel");
231
231
  if (i && isStaticResourcesEqual(i, n.url) && c === n.attrs.rel) {
232
- t = l, o = !1;
232
+ t = a, r = !1;
233
233
  break;
234
234
  }
235
235
  }
236
236
  if (!t) {
237
237
  t = document.createElement("link"), t.setAttribute("href", n.url);
238
- let a;
239
- const l = n.attrs;
240
- n.createLinkHook && (a = n.createLinkHook(n.url, l), a instanceof HTMLLinkElement && (t = a)), l && !a && Object.keys(l).forEach((i) => {
241
- t && !t.getAttribute(i) && t.setAttribute(i, l[i]);
238
+ let l;
239
+ const a = n.attrs;
240
+ n.createLinkHook && (l = n.createLinkHook(n.url, a), l instanceof HTMLLinkElement && (t = l)), a && !l && Object.keys(a).forEach((i) => {
241
+ t && !t.getAttribute(i) && t.setAttribute(i, a[i]);
242
242
  });
243
243
  }
244
- const s = (a, l) => {
244
+ const s = (l, a) => {
245
245
  const i = () => {
246
- (l == null ? void 0 : l.type) === "error" ? n != null && n.onErrorCallback && (n == null || n.onErrorCallback(l)) : n != null && n.cb && (n == null || n.cb());
246
+ (a == null ? void 0 : a.type) === "error" ? n != null && n.onErrorCallback && (n == null || n.onErrorCallback(a)) : n != null && n.cb && (n == null || n.cb());
247
247
  };
248
248
  if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
249
249
  const { needDeleteLink: c = !0 } = n;
250
250
  c && t != null && t.parentNode && t.parentNode.removeChild(t);
251
- }), a)) {
252
- const c = a(l);
251
+ }), l)) {
252
+ const c = l(a);
253
253
  return i(), c;
254
254
  }
255
255
  i();
256
256
  };
257
257
  return t.onerror = s.bind(null, t.onerror), t.onload = s.bind(null, t.onload), {
258
258
  link: t,
259
- needAttach: o
259
+ needAttach: r
260
260
  };
261
261
  }
262
262
  function loadScript(n, t) {
263
- const { attrs: o = {}, createScriptHook: r } = t;
264
- return new Promise((s, a) => {
265
- const { script: l, needAttach: i } = createScript({
263
+ const { attrs: r = {}, createScriptHook: o } = t;
264
+ return new Promise((s, l) => {
265
+ const { script: a, needAttach: i } = createScript({
266
266
  url: n,
267
267
  cb: s,
268
- onErrorCallback: a,
268
+ onErrorCallback: l,
269
269
  attrs: _extends$2({
270
270
  fetchpriority: "high"
271
- }, o),
272
- createScriptHook: r,
271
+ }, r),
272
+ createScriptHook: o,
273
273
  needDeleteScript: !0
274
274
  });
275
- i && document.head.appendChild(l);
275
+ i && document.head.appendChild(a);
276
276
  });
277
277
  }
278
278
  function importNodeModule(n) {
279
279
  if (!n)
280
280
  throw new Error("import specifier is required");
281
- return new Function("name", "return import(name)")(n).then((o) => o).catch((o) => {
282
- throw console.error(`Error importing module ${n}:`, o), o;
281
+ return new Function("name", "return import(name)")(n).then((r) => r).catch((r) => {
282
+ throw console.error(`Error importing module ${n}:`, r), r;
283
283
  });
284
284
  }
285
285
  const loadNodeFetch = async () => {
286
286
  const n = await importNodeModule("node-fetch");
287
287
  return n.default || n;
288
- }, lazyLoaderHookFetch = async (n, t, o) => {
289
- const s = await ((a, l) => o.lifecycle.fetch.emit(a, l))(n, t || {});
288
+ }, lazyLoaderHookFetch = async (n, t, r) => {
289
+ const s = await ((l, a) => r.lifecycle.fetch.emit(l, a))(n, t || {});
290
290
  return !s || !(s instanceof Response) ? (typeof fetch > "u" ? await loadNodeFetch() : fetch)(n, t || {}) : s;
291
291
  }, createScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (url, cb, attrs, loaderHook) => {
292
292
  if (loaderHook != null && loaderHook.createScriptHook) {
@@ -344,66 +344,66 @@ const loadNodeFetch = async () => {
344
344
  }).catch((n) => {
345
345
  cb(n);
346
346
  });
347
- } : (n, t, o, r) => {
347
+ } : (n, t, r, o) => {
348
348
  t(new Error("createScriptNode is disabled in non-Node.js environment"));
349
- }, loadScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (n, t) => new Promise((o, r) => {
350
- createScriptNode(n, (s, a) => {
349
+ }, loadScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (n, t) => new Promise((r, o) => {
350
+ createScriptNode(n, (s, l) => {
351
351
  if (s)
352
- r(s);
352
+ o(s);
353
353
  else {
354
- var l, i;
355
- const c = (t == null || (l = t.attrs) == null ? void 0 : l.globalName) || `__FEDERATION_${t == null || (i = t.attrs) == null ? void 0 : i.name}:custom__`, u = globalThis[c] = a;
356
- o(u);
354
+ var a, i;
355
+ 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;
356
+ r(u);
357
357
  }
358
358
  }, t.attrs, t.loaderHook);
359
359
  }) : (n, t) => {
360
360
  throw new Error("loadScriptNode is disabled in non-Node.js environment");
361
361
  };
362
362
  async function loadModule(n, t) {
363
- const { fetch: o, vm: r } = t, a = await (await o(n)).text(), l = new r.SourceTextModule(a, {
363
+ const { fetch: r, vm: o } = t, l = await (await r(n)).text(), a = new o.SourceTextModule(l, {
364
364
  // @ts-ignore
365
365
  importModuleDynamically: async (i, c) => {
366
366
  const u = new URL(i, n).href;
367
367
  return loadModule(u, t);
368
368
  }
369
369
  });
370
- return await l.link(async (i) => {
370
+ return await a.link(async (i) => {
371
371
  const c = new URL(i, n).href;
372
372
  return await loadModule(c, t);
373
- }), l;
373
+ }), a;
374
374
  }
375
375
  const LoggerInstance = createLogger("[ Module Federation Bridge Vue3 ]");
376
376
  function _extends$1() {
377
377
  return _extends$1 = Object.assign || function(t) {
378
- for (var o = 1; o < arguments.length; o++) {
379
- var r = arguments[o];
380
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
378
+ for (var r = 1; r < arguments.length; r++) {
379
+ var o = arguments[r];
380
+ for (var s in o) Object.prototype.hasOwnProperty.call(o, s) && (t[s] = o[s]);
381
381
  }
382
382
  return t;
383
383
  }, _extends$1.apply(this, arguments);
384
384
  }
385
385
  function _object_without_properties_loose(n, t) {
386
386
  if (n == null) return {};
387
- var o = {}, r = Object.keys(n), s, a;
388
- for (a = 0; a < r.length; a++)
389
- s = r[a], !(t.indexOf(s) >= 0) && (o[s] = n[s]);
390
- return o;
387
+ var r = {}, o = Object.keys(n), s, l;
388
+ for (l = 0; l < o.length; l++)
389
+ s = o[l], !(t.indexOf(s) >= 0) && (r[s] = n[s]);
390
+ return r;
391
391
  }
392
- 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", BUILD_002 = "BUILD-002", getDocsUrl = (n) => `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${n.split("-")[0].toLowerCase()}/${n}`, getShortErrorMsg = (n, t, o, r) => {
392
+ 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) => `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${n.split("-")[0].toLowerCase()}/${n}`, getShortErrorMsg = (n, t, r, o) => {
393
393
  const s = [
394
394
  `${[
395
395
  t[n]
396
396
  ]} #${n}`
397
397
  ];
398
- return o && s.push(`args: ${JSON.stringify(o)}`), s.push(getDocsUrl(n)), r && s.push(`Original Error Message:
399
- ${r}`), s.join(`
398
+ return r && s.push(`args: ${JSON.stringify(r)}`), s.push(getDocsUrl(n)), o && s.push(`Original Error Message:
399
+ ${o}`), s.join(`
400
400
  `);
401
401
  };
402
402
  function _extends() {
403
403
  return _extends = Object.assign || function(t) {
404
- for (var o = 1; o < arguments.length; o++) {
405
- var r = arguments[o];
406
- for (var s in r) Object.prototype.hasOwnProperty.call(r, s) && (t[s] = r[s]);
404
+ for (var r = 1; r < arguments.length; r++) {
405
+ var o = arguments[r];
406
+ for (var s in o) Object.prototype.hasOwnProperty.call(o, s) && (t[s] = o[s]);
407
407
  }
408
408
  return t;
409
409
  }, _extends.apply(this, arguments);
@@ -420,8 +420,7 @@ const runtimeDescMap = {
420
420
  }, typeDescMap = {
421
421
  [TYPE_001]: "Failed to generate type declaration. Execute the below cmd to reproduce and fix the error."
422
422
  }, buildDescMap = {
423
- [BUILD_001]: "Failed to find expose module.",
424
- [BUILD_002]: "PublicPath is required in prod mode."
423
+ [BUILD_001]: "Failed to find expose module."
425
424
  };
426
425
  _extends({}, runtimeDescMap, typeDescMap, buildDescMap);
427
426
  const LOG_CATEGORY = "[ Federation Runtime ]", logger = createLogger(LOG_CATEGORY);
@@ -435,7 +434,7 @@ function warn(n) {
435
434
  n instanceof Error && (n.message = `${LOG_CATEGORY}: ${n.message}`), logger.warn(n);
436
435
  }
437
436
  function addUniqueItem(n, t) {
438
- return n.findIndex((o) => o === t) === -1 && n.push(t), n;
437
+ return n.findIndex((r) => r === t) === -1 && n.push(t), n;
439
438
  }
440
439
  function getFMId(n) {
441
440
  return "version" in n && n.version ? `${n.name}:${n.version}` : "entry" in n && n.entry ? `${n.name}:${n.entry}` : `${n.name}`;
@@ -475,8 +474,8 @@ function getRemoteEntryInfoFromSnapshot(n) {
475
474
  } : t;
476
475
  }
477
476
  const processModuleAlias = (n, t) => {
478
- let o;
479
- return n.endsWith("/") ? o = n.slice(0, -1) : o = n, t.startsWith(".") && (t = t.slice(1)), o = o + t, o;
477
+ let r;
478
+ return n.endsWith("/") ? r = n.slice(0, -1) : r = n, t.startsWith(".") && (t = t.slice(1)), r = r + t, r;
480
479
  }, CurrentGlobal = typeof globalThis == "object" ? globalThis : window, nativeGlobal = (() => {
481
480
  try {
482
481
  return document.defaultView;
@@ -484,9 +483,9 @@ const processModuleAlias = (n, t) => {
484
483
  return CurrentGlobal;
485
484
  }
486
485
  })(), Global = nativeGlobal;
487
- function definePropertyGlobalVal(n, t, o) {
486
+ function definePropertyGlobalVal(n, t, r) {
488
487
  Object.defineProperty(n, t, {
489
- value: o,
488
+ value: r,
490
489
  configurable: !1,
491
490
  writable: !0
492
491
  });
@@ -497,7 +496,7 @@ function includeOwnProperty(n, t) {
497
496
  includeOwnProperty(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__") || definePropertyGlobalVal(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__", {});
498
497
  const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;
499
498
  function setGlobalDefaultVal(n) {
500
- var t, o, r, s, a, l;
499
+ var t, r, o, s, l, a;
501
500
  includeOwnProperty(n, "__VMOK__") && !includeOwnProperty(n, "__FEDERATION__") && definePropertyGlobalVal(n, "__FEDERATION__", n.__VMOK__), includeOwnProperty(n, "__FEDERATION__") || (definePropertyGlobalVal(n, "__FEDERATION__", {
502
501
  __GLOBAL_PLUGIN__: [],
503
502
  __INSTANCES__: [],
@@ -509,20 +508,20 @@ function setGlobalDefaultVal(n) {
509
508
  var i;
510
509
  (i = (t = n.__FEDERATION__).__GLOBAL_PLUGIN__) != null || (t.__GLOBAL_PLUGIN__ = []);
511
510
  var c;
512
- (c = (o = n.__FEDERATION__).__INSTANCES__) != null || (o.__INSTANCES__ = []);
511
+ (c = (r = n.__FEDERATION__).__INSTANCES__) != null || (r.__INSTANCES__ = []);
513
512
  var u;
514
- (u = (r = n.__FEDERATION__).moduleInfo) != null || (r.moduleInfo = {});
513
+ (u = (o = n.__FEDERATION__).moduleInfo) != null || (o.moduleInfo = {});
515
514
  var p;
516
515
  (p = (s = n.__FEDERATION__).__SHARE__) != null || (s.__SHARE__ = {});
517
516
  var d;
518
- (d = (a = n.__FEDERATION__).__MANIFEST_LOADING__) != null || (a.__MANIFEST_LOADING__ = {});
517
+ (d = (l = n.__FEDERATION__).__MANIFEST_LOADING__) != null || (l.__MANIFEST_LOADING__ = {});
519
518
  var m;
520
- (m = (l = n.__FEDERATION__).__PRELOADED_MAP__) != null || (l.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
519
+ (m = (a = n.__FEDERATION__).__PRELOADED_MAP__) != null || (a.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
521
520
  }
522
521
  setGlobalDefaultVal(CurrentGlobal);
523
522
  setGlobalDefaultVal(nativeGlobal);
524
523
  function setGlobalFederationConstructor(n, t = isDebugMode()) {
525
- t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = n, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.15.0");
524
+ t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = n, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.14.3");
526
525
  }
527
526
  function getInfoWithoutType(n, t) {
528
527
  if (typeof t == "string") {
@@ -532,9 +531,9 @@ function getInfoWithoutType(n, t) {
532
531
  key: t
533
532
  };
534
533
  {
535
- const r = Object.keys(n);
536
- for (const s of r) {
537
- const [a, l] = s.split(":"), i = `${a}:${t}`, c = n[i];
534
+ const o = Object.keys(n);
535
+ for (const s of o) {
536
+ const [l, a] = s.split(":"), i = `${l}:${t}`, c = n[i];
538
537
  if (c)
539
538
  return {
540
539
  value: c,
@@ -550,28 +549,28 @@ function getInfoWithoutType(n, t) {
550
549
  throw new Error("key must be string");
551
550
  }
552
551
  const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo, getTargetSnapshotInfoByModuleInfo = (n, t) => {
553
- const o = getFMId(n), r = getInfoWithoutType(t, o).value;
554
- if (r && !r.version && "version" in n && n.version && (r.version = n.version), r)
555
- return r;
552
+ const r = getFMId(n), o = getInfoWithoutType(t, r).value;
553
+ if (o && !o.version && "version" in n && n.version && (o.version = n.version), o)
554
+ return o;
556
555
  if ("version" in n && n.version) {
557
- const { version: s } = n, a = _object_without_properties_loose(n, [
556
+ const { version: s } = n, l = _object_without_properties_loose(n, [
558
557
  "version"
559
- ]), l = getFMId(a), i = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, l).value;
558
+ ]), a = getFMId(l), i = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, a).value;
560
559
  if ((i == null ? void 0 : i.version) === s)
561
560
  return i;
562
561
  }
563
562
  }, getGlobalSnapshotInfoByModuleInfo = (n) => getTargetSnapshotInfoByModuleInfo(n, nativeGlobal.__FEDERATION__.moduleInfo), setGlobalSnapshotInfoByModuleInfo = (n, t) => {
564
- const o = getFMId(n);
565
- return nativeGlobal.__FEDERATION__.moduleInfo[o] = t, nativeGlobal.__FEDERATION__.moduleInfo;
563
+ const r = getFMId(n);
564
+ return nativeGlobal.__FEDERATION__.moduleInfo[r] = t, nativeGlobal.__FEDERATION__.moduleInfo;
566
565
  }, addGlobalSnapshot = (n) => (nativeGlobal.__FEDERATION__.moduleInfo = _extends$1({}, nativeGlobal.__FEDERATION__.moduleInfo, n), () => {
567
566
  const t = Object.keys(n);
568
- for (const o of t)
569
- delete nativeGlobal.__FEDERATION__.moduleInfo[o];
567
+ for (const r of t)
568
+ delete nativeGlobal.__FEDERATION__.moduleInfo[r];
570
569
  }), getRemoteEntryExports = (n, t) => {
571
- const o = t || `__FEDERATION_${n}:custom__`, r = CurrentGlobal[o];
570
+ const r = t || `__FEDERATION_${n}:custom__`, o = CurrentGlobal[r];
572
571
  return {
573
- remoteEntryKey: o,
574
- entryExports: r
572
+ remoteEntryKey: r,
573
+ entryExports: o
575
574
  };
576
575
  }, 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*$";
577
576
  function parseRegex(n) {
@@ -581,17 +580,17 @@ function isXVersion(n) {
581
580
  return !n || n.toLowerCase() === "x" || n === "*";
582
581
  }
583
582
  function pipe(...n) {
584
- return (t) => n.reduce((o, r) => r(o), t);
583
+ return (t) => n.reduce((r, o) => o(r), t);
585
584
  }
586
585
  function extractComparator(n) {
587
586
  return n.match(parseRegex(comparator));
588
587
  }
589
- function combineVersion(n, t, o, r) {
590
- const s = `${n}.${t}.${o}`;
591
- return r ? `${s}-${r}` : s;
588
+ function combineVersion(n, t, r, o) {
589
+ const s = `${n}.${t}.${r}`;
590
+ return o ? `${s}-${o}` : s;
592
591
  }
593
592
  function parseHyphen(n) {
594
- return n.replace(parseRegex(hyphenRange), (t, o, r, s, a, l, i, c, u, p, d, m) => (isXVersion(r) ? o = "" : isXVersion(s) ? o = `>=${r}.0.0` : isXVersion(a) ? o = `>=${r}.${s}.0` : o = `>=${o}`, isXVersion(u) ? c = "" : isXVersion(p) ? c = `<${Number(u) + 1}.0.0-0` : isXVersion(d) ? c = `<${u}.${Number(p) + 1}.0-0` : m ? c = `<=${u}.${p}.${d}-${m}` : c = `<=${c}`, `${o} ${c}`.trim()));
593
+ return n.replace(parseRegex(hyphenRange), (t, r, o, s, l, a, i, c, u, p, d, m) => (isXVersion(o) ? r = "" : isXVersion(s) ? r = `>=${o}.0.0` : isXVersion(l) ? r = `>=${o}.${s}.0` : r = `>=${r}`, isXVersion(u) ? c = "" : isXVersion(p) ? c = `<${Number(u) + 1}.0.0-0` : isXVersion(d) ? c = `<${u}.${Number(p) + 1}.0-0` : m ? c = `<=${u}.${p}.${d}-${m}` : c = `<=${c}`, `${r} ${c}`.trim()));
595
594
  }
596
595
  function parseComparatorTrim(n) {
597
596
  return n.replace(parseRegex(comparatorTrim), "$1$2$3");
@@ -603,15 +602,15 @@ function parseCaretTrim(n) {
603
602
  return n.replace(parseRegex(caretTrim), "$1^");
604
603
  }
605
604
  function parseCarets(n) {
606
- return n.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (o, r, s, a, l) => isXVersion(r) ? "" : isXVersion(s) ? `>=${r}.0.0 <${Number(r) + 1}.0.0-0` : isXVersion(a) ? r === "0" ? `>=${r}.${s}.0 <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.0 <${Number(r) + 1}.0.0-0` : l ? r === "0" ? s === "0" ? `>=${r}.${s}.${a}-${l} <${r}.${s}.${Number(a) + 1}-0` : `>=${r}.${s}.${a}-${l} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${a}-${l} <${Number(r) + 1}.0.0-0` : r === "0" ? s === "0" ? `>=${r}.${s}.${a} <${r}.${s}.${Number(a) + 1}-0` : `>=${r}.${s}.${a} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${a} <${Number(r) + 1}.0.0-0`)).join(" ");
605
+ return n.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (r, 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(" ");
607
606
  }
608
607
  function parseTildes(n) {
609
- return n.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (o, r, s, a, l) => isXVersion(r) ? "" : isXVersion(s) ? `>=${r}.0.0 <${Number(r) + 1}.0.0-0` : isXVersion(a) ? `>=${r}.${s}.0 <${r}.${Number(s) + 1}.0-0` : l ? `>=${r}.${s}.${a}-${l} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${a} <${r}.${Number(s) + 1}.0-0`)).join(" ");
608
+ return n.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (r, 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(" ");
610
609
  }
611
610
  function parseXRanges(n) {
612
- return n.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (o, r, s, a, l, i) => {
613
- const c = isXVersion(s), u = c || isXVersion(a), p = u || isXVersion(l);
614
- return r === "=" && p && (r = ""), i = "", c ? r === ">" || r === "<" ? "<0.0.0-0" : "*" : r && p ? (u && (a = 0), l = 0, r === ">" ? (r = ">=", u ? (s = Number(s) + 1, a = 0, l = 0) : (a = Number(a) + 1, l = 0)) : r === "<=" && (r = "<", u ? s = Number(s) + 1 : a = Number(a) + 1), r === "<" && (i = "-0"), `${r + s}.${a}.${l}${i}`) : u ? `>=${s}.0.0${i} <${Number(s) + 1}.0.0-0` : p ? `>=${s}.${a}.0${i} <${s}.${Number(a) + 1}.0-0` : o;
611
+ return n.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (r, o, s, l, a, i) => {
612
+ const c = isXVersion(s), u = c || isXVersion(l), p = u || isXVersion(a);
613
+ return o === "=" && p && (o = ""), i = "", c ? o === ">" || o === "<" ? "<0.0.0-0" : "*" : o && p ? (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` : p ? `>=${s}.${l}.0${i} <${s}.${Number(l) + 1}.0-0` : r;
615
614
  })).join(" ");
616
615
  }
617
616
  function parseStar(n) {
@@ -624,17 +623,17 @@ function compareAtom(n, t) {
624
623
  return n = Number(n) || n, t = Number(t) || t, n > t ? 1 : n === t ? 0 : -1;
625
624
  }
626
625
  function comparePreRelease(n, t) {
627
- const { preRelease: o } = n, { preRelease: r } = t;
628
- if (o === void 0 && r)
626
+ const { preRelease: r } = n, { preRelease: o } = t;
627
+ if (r === void 0 && o)
629
628
  return 1;
630
- if (o && r === void 0)
629
+ if (r && o === void 0)
631
630
  return -1;
632
- if (o === void 0 && r === void 0)
631
+ if (r === void 0 && o === void 0)
633
632
  return 0;
634
- for (let s = 0, a = o.length; s <= a; s++) {
635
- const l = o[s], i = r[s];
636
- if (l !== i)
637
- return l === void 0 && i === void 0 ? 0 : l ? i ? compareAtom(l, i) : -1 : 1;
633
+ for (let s = 0, l = r.length; s <= l; s++) {
634
+ const a = r[s], i = o[s];
635
+ if (a !== i)
636
+ return a === void 0 && i === void 0 ? 0 : a ? i ? compareAtom(a, i) : -1 : 1;
638
637
  }
639
638
  return 0;
640
639
  }
@@ -704,15 +703,15 @@ function parseRange(n) {
704
703
  function satisfy(n, t) {
705
704
  if (!n)
706
705
  return !1;
707
- const o = extractComparator(n);
708
- if (!o)
706
+ const r = extractComparator(n);
707
+ if (!r)
709
708
  return !1;
710
- const [, r, , s, a, l, i] = o, c = {
711
- operator: r,
712
- version: combineVersion(s, a, l, i),
709
+ const [, o, , s, l, a, i] = r, c = {
710
+ operator: o,
711
+ version: combineVersion(s, l, a, i),
713
712
  major: s,
714
- minor: a,
715
- patch: l,
713
+ minor: l,
714
+ patch: a,
716
715
  preRelease: i == null ? void 0 : i.split(".")
717
716
  }, u = t.split("||");
718
717
  for (const p of u) {
@@ -758,12 +757,12 @@ function satisfy(n, t) {
758
757
  }
759
758
  return !1;
760
759
  }
761
- function formatShare(n, t, o, r) {
760
+ function formatShare(n, t, r, o) {
762
761
  let s;
763
762
  "get" in n ? s = n.get : "lib" in n ? s = () => Promise.resolve(n.lib) : s = () => Promise.resolve(() => {
764
- throw new Error(`Can not get shared '${o}'!`);
763
+ throw new Error(`Can not get shared '${r}'!`);
765
764
  });
766
- var a, l, i;
765
+ var l, a, i;
767
766
  return _extends$1({
768
767
  deps: [],
769
768
  useIn: [],
@@ -778,76 +777,76 @@ function formatShare(n, t, o, r) {
778
777
  }, n.shareConfig),
779
778
  get: s,
780
779
  loaded: n != null && n.loaded || "lib" in n ? !0 : void 0,
781
- version: (a = n.version) != null ? a : "0",
780
+ version: (l = n.version) != null ? l : "0",
782
781
  scope: Array.isArray(n.scope) ? n.scope : [
783
- (l = n.scope) != null ? l : "default"
782
+ (a = n.scope) != null ? a : "default"
784
783
  ],
785
- strategy: ((i = n.strategy) != null ? i : r) || "version-first"
784
+ strategy: ((i = n.strategy) != null ? i : o) || "version-first"
786
785
  });
787
786
  }
788
787
  function formatShareConfigs(n, t) {
789
- const o = t.shared || {}, r = t.name, s = Object.keys(o).reduce((l, i) => {
790
- const c = arrayOptions(o[i]);
791
- return l[i] = l[i] || [], c.forEach((u) => {
792
- l[i].push(formatShare(u, r, i, t.shareStrategy));
793
- }), l;
794
- }, {}), a = _extends$1({}, n.shared);
795
- return Object.keys(s).forEach((l) => {
796
- a[l] ? s[l].forEach((i) => {
797
- a[l].find((u) => u.version === i.version) || a[l].push(i);
798
- }) : a[l] = s[l];
788
+ const r = t.shared || {}, o = t.name, s = Object.keys(r).reduce((a, i) => {
789
+ const c = arrayOptions(r[i]);
790
+ return a[i] = a[i] || [], c.forEach((u) => {
791
+ a[i].push(formatShare(u, o, i, t.shareStrategy));
792
+ }), a;
793
+ }, {}), l = _extends$1({}, n.shared);
794
+ return Object.keys(s).forEach((a) => {
795
+ l[a] ? s[a].forEach((i) => {
796
+ l[a].find((u) => u.version === i.version) || l[a].push(i);
797
+ }) : l[a] = s[a];
799
798
  }), {
800
- shared: a,
799
+ shared: l,
801
800
  shareInfos: s
802
801
  };
803
802
  }
804
803
  function versionLt(n, t) {
805
- const o = (r) => {
806
- if (!Number.isNaN(Number(r))) {
807
- const a = r.split(".");
808
- let l = r;
809
- for (let i = 0; i < 3 - a.length; i++)
810
- l += ".0";
811
- return l;
804
+ const r = (o) => {
805
+ if (!Number.isNaN(Number(o))) {
806
+ const l = o.split(".");
807
+ let a = o;
808
+ for (let i = 0; i < 3 - l.length; i++)
809
+ a += ".0";
810
+ return a;
812
811
  }
813
- return r;
812
+ return o;
814
813
  };
815
- return !!satisfy(o(n), `<=${o(t)}`);
814
+ return !!satisfy(r(n), `<=${r(t)}`);
816
815
  }
817
816
  const findVersion = (n, t) => {
818
- const o = t || function(r, s) {
819
- return versionLt(r, s);
817
+ const r = t || function(o, s) {
818
+ return versionLt(o, s);
820
819
  };
821
- return Object.keys(n).reduce((r, s) => !r || o(r, s) || r === "0" ? s : r, 0);
820
+ return Object.keys(n).reduce((o, s) => !o || r(o, s) || o === "0" ? s : o, 0);
822
821
  }, isLoaded = (n) => !!n.loaded || typeof n.lib == "function", isLoading = (n) => !!n.loading;
823
- function findSingletonVersionOrderByVersion(n, t, o) {
824
- const r = n[t][o], s = function(a, l) {
825
- return !isLoaded(r[a]) && versionLt(a, l);
822
+ function findSingletonVersionOrderByVersion(n, t, r) {
823
+ const o = n[t][r], s = function(l, a) {
824
+ return !isLoaded(o[l]) && versionLt(l, a);
826
825
  };
827
- return findVersion(n[t][o], s);
826
+ return findVersion(n[t][r], s);
828
827
  }
829
- function findSingletonVersionOrderByLoaded(n, t, o) {
830
- const r = n[t][o], s = function(a, l) {
828
+ function findSingletonVersionOrderByLoaded(n, t, r) {
829
+ const o = n[t][r], s = function(l, a) {
831
830
  const i = (c) => isLoaded(c) || isLoading(c);
832
- return i(r[l]) ? i(r[a]) ? !!versionLt(a, l) : !0 : i(r[a]) ? !1 : versionLt(a, l);
831
+ return i(o[a]) ? i(o[l]) ? !!versionLt(l, a) : !0 : i(o[l]) ? !1 : versionLt(l, a);
833
832
  };
834
- return findVersion(n[t][o], s);
833
+ return findVersion(n[t][r], s);
835
834
  }
836
835
  function getFindShareFunction(n) {
837
836
  return n === "loaded-first" ? findSingletonVersionOrderByLoaded : findSingletonVersionOrderByVersion;
838
837
  }
839
- function getRegisteredShare(n, t, o, r) {
838
+ function getRegisteredShare(n, t, r, o) {
840
839
  if (!n)
841
840
  return;
842
- const { shareConfig: s, scope: a = DEFAULT_SCOPE, strategy: l } = o, i = Array.isArray(a) ? a : [
843
- a
841
+ const { shareConfig: s, scope: l = DEFAULT_SCOPE, strategy: a } = r, i = Array.isArray(l) ? l : [
842
+ l
844
843
  ];
845
844
  for (const c of i)
846
845
  if (s && n[c] && n[c][t]) {
847
- const { requiredVersion: u } = s, d = getFindShareFunction(l)(n, c, t), m = () => {
846
+ const { requiredVersion: u } = s, d = getFindShareFunction(a)(n, c, t), m = () => {
848
847
  if (s.singleton) {
849
848
  if (typeof u == "string" && !satisfy(d, u)) {
850
- const E = `Version ${d} from ${d && n[c][t][d].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;
849
+ const E = `Version ${d} from ${d && n[c][t][d].from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;
851
850
  s.strictVersion ? error(E) : warn(E);
852
851
  }
853
852
  return n[c][t][d];
@@ -866,14 +865,14 @@ function getRegisteredShare(n, t, o, r) {
866
865
  GlobalFederation: Global.__FEDERATION__,
867
866
  resolver: m
868
867
  };
869
- return (r.emit(y) || y).resolver();
868
+ return (o.emit(y) || y).resolver();
870
869
  }
871
870
  }
872
871
  function getGlobalShareScope() {
873
872
  return Global.__FEDERATION__.__SHARE__;
874
873
  }
875
874
  function getTargetSharedOptions(n) {
876
- const { pkgName: t, extraOptions: o, shareInfos: r } = n, s = (i) => {
875
+ const { pkgName: t, extraOptions: r, shareInfos: o } = n, s = (i) => {
877
876
  if (!i)
878
877
  return;
879
878
  const c = {};
@@ -885,152 +884,152 @@ function getTargetSharedOptions(n) {
885
884
  });
886
885
  return c[p];
887
886
  };
888
- var a;
889
- const l = (a = o == null ? void 0 : o.resolver) != null ? a : s;
890
- return Object.assign({}, l(r[t]), o == null ? void 0 : o.customShareInfo);
887
+ var l;
888
+ const a = (l = r == null ? void 0 : r.resolver) != null ? l : s;
889
+ return Object.assign({}, a(o[t]), r == null ? void 0 : r.customShareInfo);
891
890
  }
892
891
  function getBuilderId() {
893
892
  return typeof FEDERATION_BUILD_IDENTIFIER < "u" ? FEDERATION_BUILD_IDENTIFIER : "";
894
893
  }
895
894
  function matchRemoteWithNameAndExpose(n, t) {
896
- for (const o of n) {
897
- const r = t.startsWith(o.name);
898
- let s = t.replace(o.name, "");
899
- if (r) {
895
+ for (const r of n) {
896
+ const o = t.startsWith(r.name);
897
+ let s = t.replace(r.name, "");
898
+ if (o) {
900
899
  if (s.startsWith("/")) {
901
- const i = o.name;
900
+ const i = r.name;
902
901
  return s = `.${s}`, {
903
902
  pkgNameOrAlias: i,
904
903
  expose: s,
905
- remote: o
904
+ remote: r
906
905
  };
907
906
  } else if (s === "")
908
907
  return {
909
- pkgNameOrAlias: o.name,
908
+ pkgNameOrAlias: r.name,
910
909
  expose: ".",
911
- remote: o
910
+ remote: r
912
911
  };
913
912
  }
914
- const a = o.alias && t.startsWith(o.alias);
915
- let l = o.alias && t.replace(o.alias, "");
916
- if (o.alias && a) {
917
- if (l && l.startsWith("/")) {
918
- const i = o.alias;
919
- return l = `.${l}`, {
913
+ const l = r.alias && t.startsWith(r.alias);
914
+ let a = r.alias && t.replace(r.alias, "");
915
+ if (r.alias && l) {
916
+ if (a && a.startsWith("/")) {
917
+ const i = r.alias;
918
+ return a = `.${a}`, {
920
919
  pkgNameOrAlias: i,
921
- expose: l,
922
- remote: o
920
+ expose: a,
921
+ remote: r
923
922
  };
924
- } else if (l === "")
923
+ } else if (a === "")
925
924
  return {
926
- pkgNameOrAlias: o.alias,
925
+ pkgNameOrAlias: r.alias,
927
926
  expose: ".",
928
- remote: o
927
+ remote: r
929
928
  };
930
929
  }
931
930
  }
932
931
  }
933
932
  function matchRemote(n, t) {
934
- for (const o of n)
935
- if (t === o.name || o.alias && t === o.alias)
936
- return o;
933
+ for (const r of n)
934
+ if (t === r.name || r.alias && t === r.alias)
935
+ return r;
937
936
  }
938
937
  function registerPlugins(n, t) {
939
- const o = getGlobalHostPlugins();
940
- return o.length > 0 && o.forEach((r) => {
941
- n != null && n.find((s) => s.name !== r.name) && n.push(r);
942
- }), n && n.length > 0 && n.forEach((r) => {
938
+ const r = getGlobalHostPlugins();
939
+ return r.length > 0 && r.forEach((o) => {
940
+ n != null && n.find((s) => s.name !== o.name) && n.push(o);
941
+ }), n && n.length > 0 && n.forEach((o) => {
943
942
  t.forEach((s) => {
944
- s.applyPlugin(r);
943
+ s.applyPlugin(o);
945
944
  });
946
945
  }), n;
947
946
  }
948
947
  const importCallback = ".then(callbacks[0]).catch(callbacks[1])";
949
948
  async function loadEsmEntry({ entry: n, remoteEntryExports: t }) {
950
- return new Promise((o, r) => {
949
+ return new Promise((r, o) => {
951
950
  try {
952
- t ? o(t) : typeof FEDERATION_ALLOW_NEW_FUNCTION < "u" ? new Function("callbacks", `import("${n}")${importCallback}`)([
953
- o,
954
- r
951
+ t ? r(t) : typeof FEDERATION_ALLOW_NEW_FUNCTION < "u" ? new Function("callbacks", `import("${n}")${importCallback}`)([
952
+ r,
953
+ o
955
954
  ]) : import(
956
955
  /* webpackIgnore: true */
957
956
  /* @vite-ignore */
958
957
  n
959
- ).then(o).catch(r);
958
+ ).then(r).catch(o);
960
959
  } catch (s) {
961
- r(s);
960
+ o(s);
962
961
  }
963
962
  });
964
963
  }
965
964
  async function loadSystemJsEntry({ entry: n, remoteEntryExports: t }) {
966
- return new Promise((o, r) => {
965
+ return new Promise((r, o) => {
967
966
  try {
968
- t ? o(t) : typeof __system_context__ > "u" ? System.import(n).then(o).catch(r) : new Function("callbacks", `System.import("${n}")${importCallback}`)([
969
- o,
970
- r
967
+ t ? r(t) : typeof __system_context__ > "u" ? System.import(n).then(r).catch(o) : new Function("callbacks", `System.import("${n}")${importCallback}`)([
968
+ r,
969
+ o
971
970
  ]);
972
971
  } catch (s) {
973
- r(s);
972
+ o(s);
974
973
  }
975
974
  });
976
975
  }
977
- function handleRemoteEntryLoaded(n, t, o) {
978
- const { remoteEntryKey: r, entryExports: s } = getRemoteEntryExports(n, t);
976
+ function handleRemoteEntryLoaded(n, t, r) {
977
+ const { remoteEntryKey: o, entryExports: s } = getRemoteEntryExports(n, t);
979
978
  return assert(s, getShortErrorMsg(RUNTIME_001, runtimeDescMap, {
980
979
  remoteName: n,
981
- remoteEntryUrl: o,
982
- remoteEntryKey: r
980
+ remoteEntryUrl: r,
981
+ remoteEntryKey: o
983
982
  })), s;
984
983
  }
985
- async function loadEntryScript({ name: n, globalName: t, entry: o, loaderHook: r }) {
984
+ async function loadEntryScript({ name: n, globalName: t, entry: r, loaderHook: o }) {
986
985
  const { entryExports: s } = getRemoteEntryExports(n, t);
987
- return s || loadScript(o, {
986
+ return s || loadScript(r, {
988
987
  attrs: {},
989
- createScriptHook: (a, l) => {
990
- const i = r.lifecycle.createScript.emit({
991
- url: a,
992
- attrs: l
988
+ createScriptHook: (l, a) => {
989
+ const i = o.lifecycle.createScript.emit({
990
+ url: l,
991
+ attrs: a
993
992
  });
994
993
  if (i && (i instanceof HTMLScriptElement || "script" in i || "timeout" in i))
995
994
  return i;
996
995
  }
997
- }).then(() => handleRemoteEntryLoaded(n, t, o)).catch((a) => {
996
+ }).then(() => handleRemoteEntryLoaded(n, t, r)).catch((l) => {
998
997
  throw assert(void 0, getShortErrorMsg(RUNTIME_008, runtimeDescMap, {
999
998
  remoteName: n,
1000
- resourceUrl: o
1001
- })), a;
999
+ resourceUrl: r
1000
+ })), l;
1002
1001
  });
1003
1002
  }
1004
- async function loadEntryDom({ remoteInfo: n, remoteEntryExports: t, loaderHook: o }) {
1005
- const { entry: r, entryGlobalName: s, name: a, type: l } = n;
1006
- switch (l) {
1003
+ async function loadEntryDom({ remoteInfo: n, remoteEntryExports: t, loaderHook: r }) {
1004
+ const { entry: o, entryGlobalName: s, name: l, type: a } = n;
1005
+ switch (a) {
1007
1006
  case "esm":
1008
1007
  case "module":
1009
1008
  return loadEsmEntry({
1010
- entry: r,
1009
+ entry: o,
1011
1010
  remoteEntryExports: t
1012
1011
  });
1013
1012
  case "system":
1014
1013
  return loadSystemJsEntry({
1015
- entry: r,
1014
+ entry: o,
1016
1015
  remoteEntryExports: t
1017
1016
  });
1018
1017
  default:
1019
1018
  return loadEntryScript({
1020
- entry: r,
1019
+ entry: o,
1021
1020
  globalName: s,
1022
- name: a,
1023
- loaderHook: o
1021
+ name: l,
1022
+ loaderHook: r
1024
1023
  });
1025
1024
  }
1026
1025
  }
1027
1026
  async function loadEntryNode({ remoteInfo: n, loaderHook: t }) {
1028
- const { entry: o, entryGlobalName: r, name: s, type: a } = n, { entryExports: l } = getRemoteEntryExports(s, r);
1029
- return l || loadScriptNode(o, {
1027
+ const { entry: r, entryGlobalName: o, name: s, type: l } = n, { entryExports: a } = getRemoteEntryExports(s, o);
1028
+ return a || loadScriptNode(r, {
1030
1029
  attrs: {
1031
1030
  name: s,
1032
- globalName: r,
1033
- type: a
1031
+ globalName: o,
1032
+ type: l
1034
1033
  },
1035
1034
  loaderHook: {
1036
1035
  createScriptHook: (i, c = {}) => {
@@ -1042,34 +1041,34 @@ async function loadEntryNode({ remoteInfo: n, loaderHook: t }) {
1042
1041
  return u;
1043
1042
  }
1044
1043
  }
1045
- }).then(() => handleRemoteEntryLoaded(s, r, o)).catch((i) => {
1044
+ }).then(() => handleRemoteEntryLoaded(s, o, r)).catch((i) => {
1046
1045
  throw i;
1047
1046
  });
1048
1047
  }
1049
1048
  function getRemoteEntryUniqueKey(n) {
1050
- const { entry: t, name: o } = n;
1051
- return composeKeyWithSeparator(o, t);
1049
+ const { entry: t, name: r } = n;
1050
+ return composeKeyWithSeparator(r, t);
1052
1051
  }
1053
- async function getRemoteEntry({ origin: n, remoteEntryExports: t, remoteInfo: o }) {
1054
- const r = getRemoteEntryUniqueKey(o);
1052
+ async function getRemoteEntry({ origin: n, remoteEntryExports: t, remoteInfo: r }) {
1053
+ const o = getRemoteEntryUniqueKey(r);
1055
1054
  if (t)
1056
1055
  return t;
1057
- if (!globalLoading[r]) {
1058
- const s = n.remoteHandler.hooks.lifecycle.loadEntry, a = n.loaderHook;
1059
- globalLoading[r] = s.emit({
1060
- loaderHook: a,
1061
- remoteInfo: o,
1056
+ if (!globalLoading[o]) {
1057
+ const s = n.remoteHandler.hooks.lifecycle.loadEntry, l = n.loaderHook;
1058
+ globalLoading[o] = s.emit({
1059
+ loaderHook: l,
1060
+ remoteInfo: r,
1062
1061
  remoteEntryExports: t
1063
- }).then((l) => l || ((typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : isBrowserEnv()) ? loadEntryDom({
1064
- remoteInfo: o,
1062
+ }).then((a) => a || ((typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : isBrowserEnv()) ? loadEntryDom({
1063
+ remoteInfo: r,
1065
1064
  remoteEntryExports: t,
1066
- loaderHook: a
1065
+ loaderHook: l
1067
1066
  }) : loadEntryNode({
1068
- remoteInfo: o,
1069
- loaderHook: a
1067
+ remoteInfo: r,
1068
+ loaderHook: l
1070
1069
  })));
1071
1070
  }
1072
- return globalLoading[r];
1071
+ return globalLoading[o];
1073
1072
  }
1074
1073
  function getRemoteInfo(n) {
1075
1074
  return _extends$1({}, n, {
@@ -1091,24 +1090,24 @@ let Module = class {
1091
1090
  remoteEntryExports: this.remoteEntryExports
1092
1091
  });
1093
1092
  } catch {
1094
- const r = getRemoteEntryUniqueKey(this.remoteInfo);
1093
+ const o = getRemoteEntryUniqueKey(this.remoteInfo);
1095
1094
  t = await this.host.loaderHook.lifecycle.loadEntryError.emit({
1096
1095
  getRemoteEntry,
1097
1096
  origin: this.host,
1098
1097
  remoteInfo: this.remoteInfo,
1099
1098
  remoteEntryExports: this.remoteEntryExports,
1100
1099
  globalLoading,
1101
- uniqueKey: r
1100
+ uniqueKey: o
1102
1101
  });
1103
1102
  }
1104
1103
  return assert(t, `remoteEntryExports is undefined
1105
1104
  ${safeToString(this.remoteInfo)}`), this.remoteEntryExports = t, this.remoteEntryExports;
1106
1105
  }
1107
1106
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1108
- async get(t, o, r, s) {
1109
- const { loadFactory: a = !0 } = r || {
1107
+ async get(t, r, o, s) {
1108
+ const { loadFactory: l = !0 } = o || {
1110
1109
  loadFactory: !0
1111
- }, l = await this.getEntry();
1110
+ }, a = await this.getEntry();
1112
1111
  if (!this.inited) {
1113
1112
  const d = this.host.shareScopeMap, m = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [
1114
1113
  this.remoteInfo.shareScope
@@ -1133,44 +1132,43 @@ let Module = class {
1133
1132
  remoteInfo: this.remoteInfo,
1134
1133
  origin: this.host
1135
1134
  });
1136
- typeof (l == null ? void 0 : l.init) > "u" && error(getShortErrorMsg(RUNTIME_002, runtimeDescMap, {
1137
- hostName: this.host.name,
1138
- remoteName: this.remoteInfo.name,
1135
+ typeof (a == null ? void 0 : a.init) > "u" && error(getShortErrorMsg(RUNTIME_002, runtimeDescMap, {
1136
+ remoteName: name,
1139
1137
  remoteEntryUrl: this.remoteInfo.entry,
1140
1138
  remoteEntryKey: this.remoteInfo.entryGlobalName
1141
- })), await l.init(_.shareScope, _.initScope, _.remoteEntryInitOptions), await this.host.hooks.lifecycle.initContainer.emit(_extends$1({}, _, {
1139
+ })), await a.init(_.shareScope, _.initScope, _.remoteEntryInitOptions), await this.host.hooks.lifecycle.initContainer.emit(_extends$1({}, _, {
1142
1140
  id: t,
1143
1141
  remoteSnapshot: s,
1144
- remoteEntryExports: l
1142
+ remoteEntryExports: a
1145
1143
  }));
1146
1144
  }
1147
- this.lib = l, this.inited = !0;
1145
+ this.lib = a, this.inited = !0;
1148
1146
  let i;
1149
1147
  i = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
1150
- remoteEntryExports: l,
1151
- expose: o,
1148
+ remoteEntryExports: a,
1149
+ expose: r,
1152
1150
  moduleInfo: this.remoteInfo
1153
- }), i || (i = await l.get(o)), assert(i, `${getFMId(this.remoteInfo)} remote don't export ${o}.`);
1154
- const c = processModuleAlias(this.remoteInfo.name, o), u = this.wraperFactory(i, c);
1155
- return a ? await u() : u;
1151
+ }), i || (i = await a.get(r)), assert(i, `${getFMId(this.remoteInfo)} remote don't export ${r}.`);
1152
+ const c = processModuleAlias(this.remoteInfo.name, r), u = this.wraperFactory(i, c);
1153
+ return l ? await u() : u;
1156
1154
  }
1157
- wraperFactory(t, o) {
1158
- function r(s, a) {
1155
+ wraperFactory(t, r) {
1156
+ function o(s, l) {
1159
1157
  s && typeof s == "object" && Object.isExtensible(s) && !Object.getOwnPropertyDescriptor(s, Symbol.for("mf_module_id")) && Object.defineProperty(s, Symbol.for("mf_module_id"), {
1160
- value: a,
1158
+ value: l,
1161
1159
  enumerable: !1
1162
1160
  });
1163
1161
  }
1164
1162
  return t instanceof Promise ? async () => {
1165
1163
  const s = await t();
1166
- return r(s, o), s;
1164
+ return o(s, r), s;
1167
1165
  } : () => {
1168
1166
  const s = t();
1169
- return r(s, o), s;
1167
+ return o(s, r), s;
1170
1168
  };
1171
1169
  }
1172
- constructor({ remoteInfo: t, host: o }) {
1173
- this.inited = !1, this.lib = void 0, this.remoteInfo = t, this.host = o;
1170
+ constructor({ remoteInfo: t, host: r }) {
1171
+ this.inited = !1, this.lib = void 0, this.remoteInfo = t, this.host = r;
1174
1172
  }
1175
1173
  };
1176
1174
  class SyncHook {
@@ -1178,16 +1176,16 @@ class SyncHook {
1178
1176
  typeof t == "function" && this.listeners.add(t);
1179
1177
  }
1180
1178
  once(t) {
1181
- const o = this;
1182
- this.on(function r(...s) {
1183
- return o.remove(r), t.apply(null, s);
1179
+ const r = this;
1180
+ this.on(function o(...s) {
1181
+ return r.remove(o), t.apply(null, s);
1184
1182
  });
1185
1183
  }
1186
1184
  emit(...t) {
1187
- let o;
1188
- return this.listeners.size > 0 && this.listeners.forEach((r) => {
1189
- o = r(...t);
1190
- }), o;
1185
+ let r;
1186
+ return this.listeners.size > 0 && this.listeners.forEach((o) => {
1187
+ r = o(...t);
1188
+ }), r;
1191
1189
  }
1192
1190
  remove(t) {
1193
1191
  this.listeners.delete(t);
@@ -1201,22 +1199,22 @@ class SyncHook {
1201
1199
  }
1202
1200
  class AsyncHook extends SyncHook {
1203
1201
  emit(...t) {
1204
- let o;
1205
- const r = Array.from(this.listeners);
1206
- if (r.length > 0) {
1202
+ let r;
1203
+ const o = Array.from(this.listeners);
1204
+ if (o.length > 0) {
1207
1205
  let s = 0;
1208
- const a = (l) => l === !1 ? !1 : s < r.length ? Promise.resolve(r[s++].apply(null, t)).then(a) : l;
1209
- o = a();
1206
+ const l = (a) => a === !1 ? !1 : s < o.length ? Promise.resolve(o[s++].apply(null, t)).then(l) : a;
1207
+ r = l();
1210
1208
  }
1211
- return Promise.resolve(o);
1209
+ return Promise.resolve(r);
1212
1210
  }
1213
1211
  }
1214
1212
  function checkReturnData(n, t) {
1215
1213
  if (!isObject(t))
1216
1214
  return !1;
1217
1215
  if (n !== t) {
1218
- for (const o in n)
1219
- if (!(o in t))
1216
+ for (const r in n)
1217
+ if (!(r in t))
1220
1218
  return !1;
1221
1219
  }
1222
1220
  return !0;
@@ -1224,17 +1222,17 @@ function checkReturnData(n, t) {
1224
1222
  class SyncWaterfallHook extends SyncHook {
1225
1223
  emit(t) {
1226
1224
  isObject(t) || error(`The data for the "${this.type}" hook should be an object.`);
1227
- for (const o of this.listeners)
1225
+ for (const r of this.listeners)
1228
1226
  try {
1229
- const r = o(t);
1230
- if (checkReturnData(t, r))
1231
- t = r;
1227
+ const o = r(t);
1228
+ if (checkReturnData(t, o))
1229
+ t = o;
1232
1230
  else {
1233
1231
  this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
1234
1232
  break;
1235
1233
  }
1236
- } catch (r) {
1237
- warn(r), this.onerror(r);
1234
+ } catch (o) {
1235
+ warn(o), this.onerror(o);
1238
1236
  }
1239
1237
  return t;
1240
1238
  }
@@ -1245,14 +1243,14 @@ class SyncWaterfallHook extends SyncHook {
1245
1243
  class AsyncWaterfallHook extends SyncHook {
1246
1244
  emit(t) {
1247
1245
  isObject(t) || error(`The response data for the "${this.type}" hook must be an object.`);
1248
- const o = Array.from(this.listeners);
1249
- if (o.length > 0) {
1250
- let r = 0;
1251
- const s = (l) => (warn(l), this.onerror(l), t), a = (l) => {
1252
- if (checkReturnData(t, l)) {
1253
- if (t = l, r < o.length)
1246
+ const r = Array.from(this.listeners);
1247
+ if (r.length > 0) {
1248
+ let o = 0;
1249
+ const s = (a) => (warn(a), this.onerror(a), t), l = (a) => {
1250
+ if (checkReturnData(t, a)) {
1251
+ if (t = a, o < r.length)
1254
1252
  try {
1255
- return Promise.resolve(o[r++](t)).then(a, s);
1253
+ return Promise.resolve(r[o++](t)).then(l, s);
1256
1254
  } catch (i) {
1257
1255
  return s(i);
1258
1256
  }
@@ -1260,7 +1258,7 @@ class AsyncWaterfallHook extends SyncHook {
1260
1258
  this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
1261
1259
  return t;
1262
1260
  };
1263
- return Promise.resolve(a(t));
1261
+ return Promise.resolve(l(t));
1264
1262
  }
1265
1263
  return Promise.resolve(t);
1266
1264
  }
@@ -1271,25 +1269,25 @@ class AsyncWaterfallHook extends SyncHook {
1271
1269
  class PluginSystem {
1272
1270
  applyPlugin(t) {
1273
1271
  assert(isPlainObject(t), "Plugin configuration is invalid.");
1274
- const o = t.name;
1275
- assert(o, "A name must be provided by the plugin."), this.registerPlugins[o] || (this.registerPlugins[o] = t, Object.keys(this.lifecycle).forEach((r) => {
1276
- const s = t[r];
1277
- s && this.lifecycle[r].on(s);
1272
+ const r = t.name;
1273
+ assert(r, "A name must be provided by the plugin."), this.registerPlugins[r] || (this.registerPlugins[r] = t, Object.keys(this.lifecycle).forEach((o) => {
1274
+ const s = t[o];
1275
+ s && this.lifecycle[o].on(s);
1278
1276
  }));
1279
1277
  }
1280
1278
  removePlugin(t) {
1281
1279
  assert(t, "A name is required.");
1282
- const o = this.registerPlugins[t];
1283
- assert(o, `The plugin "${t}" is not registered.`), Object.keys(o).forEach((r) => {
1284
- r !== "name" && this.lifecycle[r].remove(o[r]);
1280
+ const r = this.registerPlugins[t];
1281
+ assert(r, `The plugin "${t}" is not registered.`), Object.keys(r).forEach((o) => {
1282
+ o !== "name" && this.lifecycle[o].remove(r[o]);
1285
1283
  });
1286
1284
  }
1287
1285
  // eslint-disable-next-line @typescript-eslint/no-shadow
1288
- inherit({ lifecycle: t, registerPlugins: o }) {
1289
- Object.keys(t).forEach((r) => {
1290
- assert(!this.lifecycle[r], `The hook "${r}" has a conflict and cannot be inherited.`), this.lifecycle[r] = t[r];
1291
- }), Object.keys(o).forEach((r) => {
1292
- assert(!this.registerPlugins[r], `The plugin "${r}" has a conflict and cannot be inherited.`), this.applyPlugin(o[r]);
1286
+ inherit({ lifecycle: t, registerPlugins: r }) {
1287
+ Object.keys(t).forEach((o) => {
1288
+ assert(!this.lifecycle[o], `The hook "${o}" has a conflict and cannot be inherited.`), this.lifecycle[o] = t[o];
1289
+ }), Object.keys(r).forEach((o) => {
1290
+ assert(!this.registerPlugins[o], `The plugin "${o}" has a conflict and cannot be inherited.`), this.applyPlugin(r[o]);
1293
1291
  });
1294
1292
  }
1295
1293
  constructor(t) {
@@ -1305,24 +1303,24 @@ function defaultPreloadArgs(n) {
1305
1303
  }, n);
1306
1304
  }
1307
1305
  function formatPreloadArgs(n, t) {
1308
- return t.map((o) => {
1309
- const r = matchRemote(n, o.nameOrAlias);
1310
- return assert(r, `Unable to preload ${o.nameOrAlias} as it is not included in ${!r && safeToString({
1311
- remoteInfo: r,
1306
+ return t.map((r) => {
1307
+ const o = matchRemote(n, r.nameOrAlias);
1308
+ return assert(o, `Unable to preload ${r.nameOrAlias} as it is not included in ${!o && safeToString({
1309
+ remoteInfo: o,
1312
1310
  remotes: n
1313
1311
  })}`), {
1314
- remote: r,
1315
- preloadConfig: defaultPreloadArgs(o)
1312
+ remote: o,
1313
+ preloadConfig: defaultPreloadArgs(r)
1316
1314
  };
1317
1315
  });
1318
1316
  }
1319
1317
  function normalizePreloadExposes(n) {
1320
1318
  return n ? n.map((t) => t === "." ? t : t.startsWith("./") ? t.replace("./", "") : t) : [];
1321
1319
  }
1322
- function preloadAssets(n, t, o, r = !0) {
1323
- const { cssAssets: s, jsAssetsWithoutEntry: a, entryAssets: l } = o;
1320
+ function preloadAssets(n, t, r, o = !0) {
1321
+ const { cssAssets: s, jsAssetsWithoutEntry: l, entryAssets: a } = r;
1324
1322
  if (t.options.inBrowser) {
1325
- if (l.forEach((i) => {
1323
+ if (a.forEach((i) => {
1326
1324
  const { moduleInfo: c } = i, u = t.moduleCache.get(n.name);
1327
1325
  getRemoteEntry(u ? {
1328
1326
  origin: t,
@@ -1333,7 +1331,7 @@ function preloadAssets(n, t, o, r = !0) {
1333
1331
  remoteInfo: c,
1334
1332
  remoteEntryExports: void 0
1335
1333
  });
1336
- }), r) {
1334
+ }), o) {
1337
1335
  const i = {
1338
1336
  rel: "preload",
1339
1337
  as: "style"
@@ -1379,12 +1377,12 @@ function preloadAssets(n, t, o, r = !0) {
1379
1377
  p && document.head.appendChild(u);
1380
1378
  });
1381
1379
  }
1382
- if (r) {
1380
+ if (o) {
1383
1381
  const i = {
1384
1382
  rel: "preload",
1385
1383
  as: "script"
1386
1384
  };
1387
- a.forEach((c) => {
1385
+ l.forEach((c) => {
1388
1386
  const { link: u, needAttach: p } = createLink({
1389
1387
  url: c,
1390
1388
  cb: () => {
@@ -1406,7 +1404,7 @@ function preloadAssets(n, t, o, r = !0) {
1406
1404
  fetchpriority: "high",
1407
1405
  type: (n == null ? void 0 : n.type) === "module" ? "module" : "text/javascript"
1408
1406
  };
1409
- a.forEach((c) => {
1407
+ l.forEach((c) => {
1410
1408
  const { script: u, needAttach: p } = createScript({
1411
1409
  url: c,
1412
1410
  cb: () => {
@@ -1428,43 +1426,40 @@ function preloadAssets(n, t, o, r = !0) {
1428
1426
  }
1429
1427
  }
1430
1428
  function assignRemoteInfo(n, t) {
1431
- const o = getRemoteEntryInfoFromSnapshot(t);
1432
- o.url || error(`The attribute remoteEntry of ${n.name} must not be undefined.`);
1433
- let r = getResourceUrl(t, o.url);
1434
- !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;
1429
+ const r = getRemoteEntryInfoFromSnapshot(t);
1430
+ r.url || error(`The attribute remoteEntry of ${n.name} must not be undefined.`);
1431
+ let o = getResourceUrl(t, r.url);
1432
+ !isBrowserEnv() && !o.startsWith("http") && (o = `https:${o}`), n.type = r.type, n.entryGlobalName = r.globalName, n.entry = o, n.version = t.version, n.buildVersion = t.buildVersion;
1435
1433
  }
1436
1434
  function snapshotPlugin() {
1437
1435
  return {
1438
1436
  name: "snapshot-plugin",
1439
1437
  async afterResolve(n) {
1440
- const { remote: t, pkgNameOrAlias: o, expose: r, origin: s, remoteInfo: a, id: l } = n;
1438
+ const { remote: t, pkgNameOrAlias: r, expose: o, origin: s, remoteInfo: l } = n;
1441
1439
  if (!isRemoteInfoWithEntry(t) || !isPureRemoteEntry(t)) {
1442
- const { remoteSnapshot: i, globalSnapshot: c } = await s.snapshotHandler.loadRemoteSnapshotInfo({
1443
- moduleInfo: t,
1444
- id: l
1445
- });
1446
- assignRemoteInfo(a, i);
1447
- const u = {
1440
+ const { remoteSnapshot: a, globalSnapshot: i } = await s.snapshotHandler.loadRemoteSnapshotInfo(t);
1441
+ assignRemoteInfo(l, a);
1442
+ const c = {
1448
1443
  remote: t,
1449
1444
  preloadConfig: {
1450
- nameOrAlias: o,
1445
+ nameOrAlias: r,
1451
1446
  exposes: [
1452
- r
1447
+ o
1453
1448
  ],
1454
1449
  resourceCategory: "sync",
1455
1450
  share: !1,
1456
1451
  depsRemote: !1
1457
1452
  }
1458
- }, p = await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
1453
+ }, u = await s.remoteHandler.hooks.lifecycle.generatePreloadAssets.emit({
1459
1454
  origin: s,
1460
- preloadOptions: u,
1461
- remoteInfo: a,
1455
+ preloadOptions: c,
1456
+ remoteInfo: l,
1462
1457
  remote: t,
1463
- remoteSnapshot: i,
1464
- globalSnapshot: c
1458
+ remoteSnapshot: a,
1459
+ globalSnapshot: i
1465
1460
  });
1466
- return p && preloadAssets(a, s, p, !1), _extends$1({}, n, {
1467
- remoteSnapshot: i
1461
+ return u && preloadAssets(l, s, u, !1), _extends$1({}, n, {
1462
+ remoteSnapshot: a
1468
1463
  });
1469
1464
  }
1470
1465
  return n;
@@ -1484,9 +1479,9 @@ function splitId(n) {
1484
1479
  version: t[2]
1485
1480
  };
1486
1481
  }
1487
- function traverseModuleInfo(n, t, o, r, s = {}, a) {
1488
- const l = getFMId(t), { value: i } = getInfoWithoutType(n, l), c = a || i;
1489
- if (c && !isManifestProvider(c) && (o(c, t, r), c.remotesInfo)) {
1482
+ function traverseModuleInfo(n, t, r, o, s = {}, l) {
1483
+ const a = getFMId(t), { value: i } = getInfoWithoutType(n, a), c = l || i;
1484
+ if (c && !isManifestProvider(c) && (r(c, t, o), c.remotesInfo)) {
1490
1485
  const u = Object.keys(c.remotesInfo);
1491
1486
  for (const p of u) {
1492
1487
  if (s[p])
@@ -1496,22 +1491,22 @@ function traverseModuleInfo(n, t, o, r, s = {}, a) {
1496
1491
  traverseModuleInfo(n, {
1497
1492
  name: d.name,
1498
1493
  version: m.matchedVersion
1499
- }, o, !1, s, void 0);
1494
+ }, r, !1, s, void 0);
1500
1495
  }
1501
1496
  }
1502
1497
  }
1503
1498
  const isExisted = (n, t) => document.querySelector(`${n}[${n === "link" ? "href" : "src"}="${t}"]`);
1504
- function generatePreloadAssets(n, t, o, r, s) {
1505
- const a = [], l = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: p } = n, { preloadConfig: d } = t, { depsRemote: m } = d;
1506
- if (traverseModuleInfo(r, o, (_, b, v) => {
1499
+ function generatePreloadAssets(n, t, r, o, s) {
1500
+ const l = [], a = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: p } = n, { preloadConfig: d } = t, { depsRemote: m } = d;
1501
+ if (traverseModuleInfo(o, r, (_, b, v) => {
1507
1502
  let I;
1508
1503
  if (v)
1509
1504
  I = d;
1510
1505
  else if (Array.isArray(m)) {
1511
- const w = m.find((N) => N.nameOrAlias === b.name || N.nameOrAlias === b.alias);
1512
- if (!w)
1506
+ const N = m.find((O) => O.nameOrAlias === b.name || O.nameOrAlias === b.alias);
1507
+ if (!N)
1513
1508
  return;
1514
- I = defaultPreloadArgs(w);
1509
+ I = defaultPreloadArgs(N);
1515
1510
  } else if (m === !0)
1516
1511
  I = d;
1517
1512
  else
@@ -1533,24 +1528,24 @@ function generatePreloadAssets(n, t, o, r, s) {
1533
1528
  const A = normalizePreloadExposes(I.exposes);
1534
1529
  if (A.length && "modules" in _) {
1535
1530
  var T;
1536
- R = _ == null || (T = _.modules) == null ? void 0 : T.reduce((w, N) => ((A == null ? void 0 : A.indexOf(N.moduleName)) !== -1 && w.push(N), w), []);
1531
+ R = _ == null || (T = _.modules) == null ? void 0 : T.reduce((N, O) => ((A == null ? void 0 : A.indexOf(O.moduleName)) !== -1 && N.push(O), N), []);
1537
1532
  }
1538
- function $(w) {
1539
- const N = w.map((O) => getResourceUrl(_, O));
1540
- return I.filter ? N.filter(I.filter) : N;
1533
+ function $(N) {
1534
+ const O = N.map((w) => getResourceUrl(_, w));
1535
+ return I.filter ? O.filter(I.filter) : O;
1541
1536
  }
1542
1537
  if (R) {
1543
- const w = R.length;
1544
- for (let N = 0; N < w; N++) {
1545
- const O = R[N], P = `${b.name}/${O.moduleName}`;
1538
+ const N = R.length;
1539
+ for (let O = 0; O < N; O++) {
1540
+ const w = R[O], P = `${b.name}/${w.moduleName}`;
1546
1541
  n.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
1547
- id: O.moduleName === "." ? b.name : P,
1542
+ id: w.moduleName === "." ? b.name : P,
1548
1543
  name: b.name,
1549
1544
  remoteSnapshot: _,
1550
1545
  preloadConfig: I,
1551
1546
  remote: b,
1552
1547
  origin: n
1553
- }), !getPreloaded(P) && (I.resourceCategory === "all" ? (a.push(...$(O.assets.css.async)), a.push(...$(O.assets.css.sync)), l.push(...$(O.assets.js.async)), l.push(...$(O.assets.js.sync))) : (I.resourceCategory = "sync") && (a.push(...$(O.assets.css.sync)), l.push(...$(O.assets.js.sync))), setPreloaded(P));
1548
+ }), !getPreloaded(P) && (I.resourceCategory === "all" ? (l.push(...$(w.assets.css.async)), l.push(...$(w.assets.css.sync)), a.push(...$(w.assets.js.async)), a.push(...$(w.assets.js.sync))) : (I.resourceCategory = "sync") && (l.push(...$(w.assets.css.sync)), a.push(...$(w.assets.js.sync))), setPreloaded(P));
1554
1549
  }
1555
1550
  }
1556
1551
  }, !0, {}, s), s.shared) {
@@ -1575,9 +1570,9 @@ function generatePreloadAssets(n, t, o, r, s) {
1575
1570
  });
1576
1571
  });
1577
1572
  }
1578
- const g = l.filter((_) => !c.has(_) && !isExisted("script", _));
1573
+ const g = a.filter((_) => !c.has(_) && !isExisted("script", _));
1579
1574
  return {
1580
- cssAssets: a.filter((_) => !u.has(_) && !isExisted("link", _)),
1575
+ cssAssets: l.filter((_) => !u.has(_) && !isExisted("link", _)),
1581
1576
  jsAssetsWithoutEntry: g,
1582
1577
  entryAssets: i.filter((_) => !isExisted("script", _.url))
1583
1578
  };
@@ -1586,7 +1581,7 @@ const generatePreloadAssetsPlugin = function() {
1586
1581
  return {
1587
1582
  name: "generate-preload-assets-plugin",
1588
1583
  async generatePreloadAssets(n) {
1589
- const { origin: t, preloadOptions: o, remoteInfo: r, remote: s, globalSnapshot: a, remoteSnapshot: l } = n;
1584
+ const { origin: t, preloadOptions: r, remoteInfo: o, remote: s, globalSnapshot: l, remoteSnapshot: a } = n;
1590
1585
  return isBrowserEnv() ? isRemoteInfoWithEntry(s) && isPureRemoteEntry(s) ? {
1591
1586
  cssAssets: [],
1592
1587
  jsAssetsWithoutEntry: [],
@@ -1595,15 +1590,15 @@ const generatePreloadAssetsPlugin = function() {
1595
1590
  name: s.name,
1596
1591
  url: s.entry,
1597
1592
  moduleInfo: {
1598
- name: r.name,
1593
+ name: o.name,
1599
1594
  entry: s.entry,
1600
- type: r.type || "global",
1595
+ type: o.type || "global",
1601
1596
  entryGlobalName: "",
1602
1597
  shareScope: ""
1603
1598
  }
1604
1599
  }
1605
1600
  ]
1606
- } : (assignRemoteInfo(r, l), generatePreloadAssets(t, o, r, a, l)) : {
1601
+ } : (assignRemoteInfo(o, a), generatePreloadAssets(t, r, o, l, a)) : {
1607
1602
  cssAssets: [],
1608
1603
  jsAssetsWithoutEntry: [],
1609
1604
  entryAssets: []
@@ -1612,16 +1607,16 @@ const generatePreloadAssetsPlugin = function() {
1612
1607
  };
1613
1608
  };
1614
1609
  function getGlobalRemoteInfo(n, t) {
1615
- const o = getGlobalSnapshotInfoByModuleInfo({
1616
- name: t.name,
1610
+ const r = getGlobalSnapshotInfoByModuleInfo({
1611
+ name: t.options.name,
1617
1612
  version: t.options.version
1618
- }), r = o && "remotesInfo" in o && o.remotesInfo && getInfoWithoutType(o.remotesInfo, n.name).value;
1619
- return r && r.matchedVersion ? {
1620
- hostGlobalSnapshot: o,
1613
+ }), o = r && "remotesInfo" in r && r.remotesInfo && getInfoWithoutType(r.remotesInfo, n.name).value;
1614
+ return o && o.matchedVersion ? {
1615
+ hostGlobalSnapshot: r,
1621
1616
  globalSnapshot: getGlobalSnapshot(),
1622
1617
  remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({
1623
1618
  name: n.name,
1624
- version: r.matchedVersion
1619
+ version: o.matchedVersion
1625
1620
  })
1626
1621
  } : {
1627
1622
  hostGlobalSnapshot: void 0,
@@ -1633,117 +1628,128 @@ function getGlobalRemoteInfo(n, t) {
1633
1628
  };
1634
1629
  }
1635
1630
  class SnapshotHandler {
1631
+ async loadSnapshot(t) {
1632
+ const { options: r } = this.HostInstance, { hostGlobalSnapshot: o, remoteSnapshot: s, globalSnapshot: l } = this.getGlobalRemoteInfo(t), { remoteSnapshot: a, globalSnapshot: i } = await this.hooks.lifecycle.loadSnapshot.emit({
1633
+ options: r,
1634
+ moduleInfo: t,
1635
+ hostGlobalSnapshot: o,
1636
+ remoteSnapshot: s,
1637
+ globalSnapshot: l
1638
+ });
1639
+ return {
1640
+ remoteSnapshot: a,
1641
+ globalSnapshot: i
1642
+ };
1643
+ }
1636
1644
  // eslint-disable-next-line max-lines-per-function
1637
- async loadRemoteSnapshotInfo({ moduleInfo: t, id: o, expose: r }) {
1638
- const { options: s } = this.HostInstance;
1645
+ async loadRemoteSnapshotInfo(t) {
1646
+ const { options: r } = this.HostInstance;
1639
1647
  await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
1640
- options: s,
1648
+ options: r,
1641
1649
  moduleInfo: t
1642
1650
  });
1643
- let a = getGlobalSnapshotInfoByModuleInfo({
1651
+ let o = getGlobalSnapshotInfoByModuleInfo({
1644
1652
  name: this.HostInstance.options.name,
1645
1653
  version: this.HostInstance.options.version
1646
1654
  });
1647
- a || (a = {
1655
+ o || (o = {
1648
1656
  version: this.HostInstance.options.version || "",
1649
1657
  remoteEntry: "",
1650
1658
  remotesInfo: {}
1651
1659
  }, addGlobalSnapshot({
1652
- [this.HostInstance.options.name]: a
1653
- })), a && "remotesInfo" in a && !getInfoWithoutType(a.remotesInfo, t.name).value && ("version" in t || "entry" in t) && (a.remotesInfo = _extends$1({}, a == null ? void 0 : a.remotesInfo, {
1660
+ [this.HostInstance.options.name]: o
1661
+ })), 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, {
1654
1662
  [t.name]: {
1655
1663
  matchedVersion: "version" in t ? t.version : t.entry
1656
1664
  }
1657
1665
  }));
1658
- const { hostGlobalSnapshot: l, remoteSnapshot: i, globalSnapshot: c } = this.getGlobalRemoteInfo(t), { remoteSnapshot: u, globalSnapshot: p } = await this.hooks.lifecycle.loadSnapshot.emit({
1659
- options: s,
1666
+ const { hostGlobalSnapshot: s, remoteSnapshot: l, globalSnapshot: a } = this.getGlobalRemoteInfo(t), { remoteSnapshot: i, globalSnapshot: c } = await this.hooks.lifecycle.loadSnapshot.emit({
1667
+ options: r,
1660
1668
  moduleInfo: t,
1661
- hostGlobalSnapshot: l,
1662
- remoteSnapshot: i,
1663
- globalSnapshot: c
1669
+ hostGlobalSnapshot: s,
1670
+ remoteSnapshot: l,
1671
+ globalSnapshot: a
1664
1672
  });
1665
- let d, m;
1666
- if (u)
1667
- if (isManifestProvider(u)) {
1668
- const y = isBrowserEnv() ? u.remoteEntry : u.ssrRemoteEntry || u.remoteEntry || "", g = await this.getManifestJson(y, t, {}), E = setGlobalSnapshotInfoByModuleInfo(_extends$1({}, t, {
1673
+ let u, p;
1674
+ if (i)
1675
+ if (isManifestProvider(i)) {
1676
+ const d = isBrowserEnv() ? i.remoteEntry : i.ssrRemoteEntry || i.remoteEntry || "", m = await this.getManifestJson(d, t, {}), y = setGlobalSnapshotInfoByModuleInfo(_extends$1({}, t, {
1669
1677
  // The global remote may be overridden
1670
1678
  // Therefore, set the snapshot key to the global address of the actual request
1671
- entry: y
1672
- }), g);
1673
- d = g, m = E;
1679
+ entry: d
1680
+ }), m);
1681
+ u = m, p = y;
1674
1682
  } else {
1675
- const { remoteSnapshot: y } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1683
+ const { remoteSnapshot: d } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1676
1684
  options: this.HostInstance.options,
1677
1685
  moduleInfo: t,
1678
- remoteSnapshot: u,
1686
+ remoteSnapshot: i,
1679
1687
  from: "global"
1680
1688
  });
1681
- d = y, m = p;
1689
+ u = d, p = c;
1682
1690
  }
1683
1691
  else if (isRemoteInfoWithEntry(t)) {
1684
- const y = await this.getManifestJson(t.entry, t, {}), g = setGlobalSnapshotInfoByModuleInfo(t, y), { remoteSnapshot: E } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1692
+ const d = await this.getManifestJson(t.entry, t, {}), m = setGlobalSnapshotInfoByModuleInfo(t, d), { remoteSnapshot: y } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1685
1693
  options: this.HostInstance.options,
1686
1694
  moduleInfo: t,
1687
- remoteSnapshot: y,
1695
+ remoteSnapshot: d,
1688
1696
  from: "global"
1689
1697
  });
1690
- d = E, m = g;
1698
+ u = y, p = m;
1691
1699
  } else
1692
1700
  error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
1693
1701
  hostName: t.name,
1694
1702
  hostVersion: t.version,
1695
- globalSnapshot: JSON.stringify(p)
1703
+ globalSnapshot: JSON.stringify(c)
1696
1704
  }));
1697
1705
  return await this.hooks.lifecycle.afterLoadSnapshot.emit({
1698
- id: o,
1699
- host: this.HostInstance,
1700
- options: s,
1706
+ options: r,
1701
1707
  moduleInfo: t,
1702
- remoteSnapshot: d
1708
+ remoteSnapshot: u
1703
1709
  }), {
1704
- remoteSnapshot: d,
1705
- globalSnapshot: m
1710
+ remoteSnapshot: u,
1711
+ globalSnapshot: p
1706
1712
  };
1707
1713
  }
1708
1714
  getGlobalRemoteInfo(t) {
1709
1715
  return getGlobalRemoteInfo(t, this.HostInstance);
1710
1716
  }
1711
- async getManifestJson(t, o, r) {
1717
+ async getManifestJson(t, r, o) {
1712
1718
  const s = async () => {
1713
- let l = this.manifestCache.get(t);
1714
- if (l)
1715
- return l;
1719
+ let a = this.manifestCache.get(t);
1720
+ if (a)
1721
+ return a;
1716
1722
  try {
1717
1723
  let i = await this.loaderHook.lifecycle.fetch.emit(t, {});
1718
- (!i || !(i instanceof Response)) && (i = await fetch(t, {})), l = await i.json();
1724
+ (!i || !(i instanceof Response)) && (i = await fetch(t, {})), a = await i.json();
1719
1725
  } catch (i) {
1720
- l = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
1726
+ a = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
1721
1727
  id: t,
1722
1728
  error: i,
1723
1729
  from: "runtime",
1724
1730
  lifecycle: "afterResolve",
1725
1731
  origin: this.HostInstance
1726
- }), l || (delete this.manifestLoading[t], error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
1732
+ }), a || (delete this.manifestLoading[t], error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
1727
1733
  manifestUrl: t,
1728
- moduleName: o.name,
1734
+ moduleName: r.name,
1729
1735
  hostName: this.HostInstance.options.name
1730
1736
  }, `${i}`)));
1731
1737
  }
1732
- return assert(l.metaData && l.exposes && l.shared, `${t} is not a federation manifest`), this.manifestCache.set(t, l), l;
1733
- }, a = async () => {
1734
- const l = await s(), i = generateSnapshotFromManifest(l, {
1738
+ return assert(a.metaData && a.exposes && a.shared, `${t} is not a federation manifest`), this.manifestCache.set(t, a), a;
1739
+ }, l = async () => {
1740
+ const a = await s(), i = generateSnapshotFromManifest(a, {
1735
1741
  version: t
1736
1742
  }), { remoteSnapshot: c } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1737
1743
  options: this.HostInstance.options,
1738
- moduleInfo: o,
1739
- manifestJson: l,
1744
+ moduleInfo: r,
1745
+ manifestJson: a,
1740
1746
  remoteSnapshot: i,
1741
1747
  manifestUrl: t,
1742
1748
  from: "manifest"
1743
1749
  });
1744
1750
  return c;
1745
1751
  };
1746
- return this.manifestLoading[t] || (this.manifestLoading[t] = a().then((l) => l)), this.manifestLoading[t];
1752
+ return this.manifestLoading[t] || (this.manifestLoading[t] = l().then((a) => a)), this.manifestLoading[t];
1747
1753
  }
1748
1754
  constructor(t) {
1749
1755
  this.loadingHostSnapshot = null, this.manifestCache = /* @__PURE__ */ new Map(), this.hooks = new PluginSystem({
@@ -1756,44 +1762,44 @@ class SnapshotHandler {
1756
1762
  }
1757
1763
  class SharedHandler {
1758
1764
  // register shared in shareScopeMap
1759
- registerShared(t, o) {
1760
- const { shareInfos: r, shared: s } = formatShareConfigs(t, o);
1761
- return Object.keys(r).forEach((l) => {
1762
- r[l].forEach((c) => {
1763
- !getRegisteredShare(this.shareScopeMap, l, c, this.hooks.lifecycle.resolveShare) && c && c.lib && this.setShared({
1764
- pkgName: l,
1765
+ registerShared(t, r) {
1766
+ const { shareInfos: o, shared: s } = formatShareConfigs(t, r);
1767
+ return Object.keys(o).forEach((a) => {
1768
+ o[a].forEach((c) => {
1769
+ !getRegisteredShare(this.shareScopeMap, a, c, this.hooks.lifecycle.resolveShare) && c && c.lib && this.setShared({
1770
+ pkgName: a,
1765
1771
  lib: c.lib,
1766
1772
  get: c.get,
1767
1773
  loaded: !0,
1768
1774
  shared: c,
1769
- from: o.name
1775
+ from: r.name
1770
1776
  });
1771
1777
  });
1772
1778
  }), {
1773
- shareInfos: r,
1779
+ shareInfos: o,
1774
1780
  shared: s
1775
1781
  };
1776
1782
  }
1777
- async loadShare(t, o) {
1778
- const { host: r } = this, s = getTargetSharedOptions({
1783
+ async loadShare(t, r) {
1784
+ const { host: o } = this, s = getTargetSharedOptions({
1779
1785
  pkgName: t,
1780
- extraOptions: o,
1781
- shareInfos: r.options.shared
1786
+ extraOptions: r,
1787
+ shareInfos: o.options.shared
1782
1788
  });
1783
1789
  s != null && s.scope && await Promise.all(s.scope.map(async (u) => {
1784
1790
  await Promise.all(this.initializeSharing(u, {
1785
1791
  strategy: s.strategy
1786
1792
  }));
1787
1793
  }));
1788
- const a = await this.hooks.lifecycle.beforeLoadShare.emit({
1794
+ const l = await this.hooks.lifecycle.beforeLoadShare.emit({
1789
1795
  pkgName: t,
1790
1796
  shareInfo: s,
1791
- shared: r.options.shared,
1792
- origin: r
1793
- }), { shareInfo: l } = a;
1794
- assert(l, `Cannot find ${t} Share in the ${r.options.name}. Please ensure that the ${t} Share parameters have been injected`);
1795
- const i = getRegisteredShare(this.shareScopeMap, t, l, this.hooks.lifecycle.resolveShare), c = (u) => {
1796
- u.useIn || (u.useIn = []), addUniqueItem(u.useIn, r.options.name);
1797
+ shared: o.options.shared,
1798
+ origin: o
1799
+ }), { shareInfo: a } = l;
1800
+ assert(a, `Cannot find ${t} Share in the ${o.options.name}. Please ensure that the ${t} Share parameters have been injected`);
1801
+ const i = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare), c = (u) => {
1802
+ u.useIn || (u.useIn = []), addUniqueItem(u.useIn, o.options.name);
1797
1803
  };
1798
1804
  if (i && i.lib)
1799
1805
  return c(i), i.lib;
@@ -1803,32 +1809,32 @@ class SharedHandler {
1803
1809
  } else if (i) {
1804
1810
  const p = (async () => {
1805
1811
  const d = await i.get();
1806
- l.lib = d, l.loaded = !0, c(l);
1807
- const m = getRegisteredShare(this.shareScopeMap, t, l, this.hooks.lifecycle.resolveShare);
1812
+ a.lib = d, a.loaded = !0, c(a);
1813
+ const m = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare);
1808
1814
  return m && (m.lib = d, m.loaded = !0), d;
1809
1815
  })();
1810
1816
  return this.setShared({
1811
1817
  pkgName: t,
1812
1818
  loaded: !1,
1813
1819
  shared: i,
1814
- from: r.options.name,
1820
+ from: o.options.name,
1815
1821
  lib: null,
1816
1822
  loading: p
1817
1823
  }), p;
1818
1824
  } else {
1819
- if (o != null && o.customShareInfo)
1825
+ if (r != null && r.customShareInfo)
1820
1826
  return !1;
1821
1827
  const p = (async () => {
1822
- const d = await l.get();
1823
- l.lib = d, l.loaded = !0, c(l);
1824
- const m = getRegisteredShare(this.shareScopeMap, t, l, this.hooks.lifecycle.resolveShare);
1828
+ const d = await a.get();
1829
+ a.lib = d, a.loaded = !0, c(a);
1830
+ const m = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare);
1825
1831
  return m && (m.lib = d, m.loaded = !0), d;
1826
1832
  })();
1827
1833
  return this.setShared({
1828
1834
  pkgName: t,
1829
1835
  loaded: !1,
1830
- shared: l,
1831
- from: r.options.name,
1836
+ shared: a,
1837
+ from: o.options.name,
1832
1838
  lib: null,
1833
1839
  loading: p
1834
1840
  }), p;
@@ -1840,20 +1846,20 @@ class SharedHandler {
1840
1846
  * If the share scope does not exist, it creates one.
1841
1847
  */
1842
1848
  // eslint-disable-next-line @typescript-eslint/member-ordering
1843
- initializeSharing(t = DEFAULT_SCOPE, o) {
1844
- const { host: r } = this, s = o == null ? void 0 : o.from, a = o == null ? void 0 : o.strategy;
1845
- let l = o == null ? void 0 : o.initScope;
1849
+ initializeSharing(t = DEFAULT_SCOPE, r) {
1850
+ const { host: o } = this, s = r == null ? void 0 : r.from, l = r == null ? void 0 : r.strategy;
1851
+ let a = r == null ? void 0 : r.initScope;
1846
1852
  const i = [];
1847
1853
  if (s !== "build") {
1848
1854
  const { initTokens: g } = this;
1849
- l || (l = []);
1855
+ a || (a = []);
1850
1856
  let E = g[t];
1851
1857
  if (E || (E = g[t] = {
1852
1858
  from: this.host.name
1853
- }), l.indexOf(E) >= 0) return i;
1854
- l.push(E);
1859
+ }), a.indexOf(E) >= 0) return i;
1860
+ a.push(E);
1855
1861
  }
1856
- const c = this.shareScopeMap, u = r.options.name;
1862
+ const c = this.shareScopeMap, u = o.options.name;
1857
1863
  c[t] || (c[t] = {});
1858
1864
  const p = c[t], d = (g, E) => {
1859
1865
  var _;
@@ -1861,8 +1867,8 @@ class SharedHandler {
1861
1867
  p[g] = p[g] || {};
1862
1868
  const I = p[g], S = I[b], R = !!(S && (S.eager || (_ = S.shareConfig) != null && _.eager));
1863
1869
  (!S || S.strategy !== "loaded-first" && !S.loaded && (!v != !R ? v : u > S.from)) && (I[b] = E);
1864
- }, m = (g) => g && g.init && g.init(c[t], l), y = async (g) => {
1865
- const { module: E } = await r.remoteHandler.getRemoteModuleAndOptions({
1870
+ }, m = (g) => g && g.init && g.init(c[t], a), y = async (g) => {
1871
+ const { module: E } = await o.remoteHandler.getRemoteModuleAndOptions({
1866
1872
  id: g
1867
1873
  });
1868
1874
  if (E.getEntry) {
@@ -1870,22 +1876,22 @@ class SharedHandler {
1870
1876
  try {
1871
1877
  _ = await E.getEntry();
1872
1878
  } catch (b) {
1873
- _ = await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
1879
+ _ = await o.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
1874
1880
  id: g,
1875
1881
  error: b,
1876
1882
  from: "runtime",
1877
1883
  lifecycle: "beforeLoadShare",
1878
- origin: r
1884
+ origin: o
1879
1885
  });
1880
1886
  }
1881
1887
  E.inited || (await m(_), E.inited = !0);
1882
1888
  }
1883
1889
  };
1884
- return Object.keys(r.options.shared).forEach((g) => {
1885
- r.options.shared[g].forEach((_) => {
1890
+ return Object.keys(o.options.shared).forEach((g) => {
1891
+ o.options.shared[g].forEach((_) => {
1886
1892
  _.scope.includes(t) && d(g, _);
1887
1893
  });
1888
- }), (r.options.shareStrategy === "version-first" || a === "version-first") && r.options.remotes.forEach((g) => {
1894
+ }), (o.options.shareStrategy === "version-first" || l === "version-first") && o.options.remotes.forEach((g) => {
1889
1895
  g.shareScope === t && i.push(y(g.name));
1890
1896
  }), i;
1891
1897
  }
@@ -1893,32 +1899,32 @@ class SharedHandler {
1893
1899
  // 1. If the loaded shared already exists globally, then it will be reused
1894
1900
  // 2. If lib exists in local shared, it will be used directly
1895
1901
  // 3. If the local get returns something other than Promise, then it will be used directly
1896
- loadShareSync(t, o) {
1897
- const { host: r } = this, s = getTargetSharedOptions({
1902
+ loadShareSync(t, r) {
1903
+ const { host: o } = this, s = getTargetSharedOptions({
1898
1904
  pkgName: t,
1899
- extraOptions: o,
1900
- shareInfos: r.options.shared
1905
+ extraOptions: r,
1906
+ shareInfos: o.options.shared
1901
1907
  });
1902
1908
  s != null && s.scope && s.scope.forEach((i) => {
1903
1909
  this.initializeSharing(i, {
1904
1910
  strategy: s.strategy
1905
1911
  });
1906
1912
  });
1907
- const a = getRegisteredShare(this.shareScopeMap, t, s, this.hooks.lifecycle.resolveShare), l = (i) => {
1908
- i.useIn || (i.useIn = []), addUniqueItem(i.useIn, r.options.name);
1913
+ const l = getRegisteredShare(this.shareScopeMap, t, s, this.hooks.lifecycle.resolveShare), a = (i) => {
1914
+ i.useIn || (i.useIn = []), addUniqueItem(i.useIn, o.options.name);
1909
1915
  };
1910
- if (a) {
1911
- if (typeof a.lib == "function")
1912
- return l(a), a.loaded || (a.loaded = !0, a.from === r.options.name && (s.loaded = !0)), a.lib;
1913
- if (typeof a.get == "function") {
1914
- const i = a.get();
1916
+ if (l) {
1917
+ if (typeof l.lib == "function")
1918
+ return a(l), l.loaded || (l.loaded = !0, l.from === o.options.name && (s.loaded = !0)), l.lib;
1919
+ if (typeof l.get == "function") {
1920
+ const i = l.get();
1915
1921
  if (!(i instanceof Promise))
1916
- return l(a), this.setShared({
1922
+ return a(l), this.setShared({
1917
1923
  pkgName: t,
1918
1924
  loaded: !0,
1919
- from: r.options.name,
1925
+ from: o.options.name,
1920
1926
  lib: i,
1921
- shared: a
1927
+ shared: l
1922
1928
  }), i;
1923
1929
  }
1924
1930
  }
@@ -1927,37 +1933,37 @@ class SharedHandler {
1927
1933
  if (s.get) {
1928
1934
  const i = s.get();
1929
1935
  if (i instanceof Promise) {
1930
- const c = (o == null ? void 0 : o.from) === "build" ? RUNTIME_005 : RUNTIME_006;
1936
+ const c = (r == null ? void 0 : r.from) === "build" ? RUNTIME_005 : RUNTIME_006;
1931
1937
  throw new Error(getShortErrorMsg(c, runtimeDescMap, {
1932
- hostName: r.options.name,
1938
+ hostName: o.options.name,
1933
1939
  sharedPkgName: t
1934
1940
  }));
1935
1941
  }
1936
1942
  return s.lib = i, this.setShared({
1937
1943
  pkgName: t,
1938
1944
  loaded: !0,
1939
- from: r.options.name,
1945
+ from: o.options.name,
1940
1946
  lib: s.lib,
1941
1947
  shared: s
1942
1948
  }), s.lib;
1943
1949
  }
1944
1950
  throw new Error(getShortErrorMsg(RUNTIME_006, runtimeDescMap, {
1945
- hostName: r.options.name,
1951
+ hostName: o.options.name,
1946
1952
  sharedPkgName: t
1947
1953
  }));
1948
1954
  }
1949
- initShareScopeMap(t, o, r = {}) {
1955
+ initShareScopeMap(t, r, o = {}) {
1950
1956
  const { host: s } = this;
1951
- this.shareScopeMap[t] = o, this.hooks.lifecycle.initContainerShareScopeMap.emit({
1952
- shareScope: o,
1957
+ this.shareScopeMap[t] = r, this.hooks.lifecycle.initContainerShareScopeMap.emit({
1958
+ shareScope: r,
1953
1959
  options: s.options,
1954
1960
  origin: s,
1955
1961
  scopeName: t,
1956
- hostShareScopeMap: r.hostShareScopeMap
1962
+ hostShareScopeMap: o.hostShareScopeMap
1957
1963
  });
1958
1964
  }
1959
- setShared({ pkgName: t, shared: o, from: r, lib: s, loading: a, loaded: l, get: i }) {
1960
- const { version: c, scope: u = "default" } = o, p = _object_without_properties_loose(o, [
1965
+ setShared({ pkgName: t, shared: r, from: o, lib: s, loading: l, loaded: a, get: i }) {
1966
+ const { version: c, scope: u = "default" } = r, p = _object_without_properties_loose(r, [
1961
1967
  "version",
1962
1968
  "scope"
1963
1969
  ]);
@@ -1972,18 +1978,18 @@ class SharedHandler {
1972
1978
  ]
1973
1979
  }, p, {
1974
1980
  lib: s,
1975
- loaded: l,
1976
- loading: a
1981
+ loaded: a,
1982
+ loading: l
1977
1983
  }), i && (this.shareScopeMap[m][t][c].get = i);
1978
1984
  return;
1979
1985
  }
1980
1986
  const y = this.shareScopeMap[m][t][c];
1981
- a && !y.loading && (y.loading = a);
1987
+ l && !y.loading && (y.loading = l);
1982
1988
  });
1983
1989
  }
1984
1990
  _setGlobalShareScopeMap(t) {
1985
- const o = getGlobalShareScope(), r = t.id || t.name;
1986
- r && !o[r] && (o[r] = this.shareScopeMap);
1991
+ const r = getGlobalShareScope(), o = t.id || t.name;
1992
+ o && !r[o] && (r[o] = this.shareScopeMap);
1987
1993
  }
1988
1994
  constructor(t) {
1989
1995
  this.hooks = new PluginSystem({
@@ -1998,147 +2004,145 @@ class SharedHandler {
1998
2004
  }
1999
2005
  }
2000
2006
  class RemoteHandler {
2001
- formatAndRegisterRemote(t, o) {
2002
- return (o.remotes || []).reduce((s, a) => (this.registerRemote(a, s, {
2007
+ formatAndRegisterRemote(t, r) {
2008
+ return (r.remotes || []).reduce((s, l) => (this.registerRemote(l, s, {
2003
2009
  force: !1
2004
2010
  }), s), t.remotes);
2005
2011
  }
2006
- setIdToRemoteMap(t, o) {
2007
- const { remote: r, expose: s } = o, { name: a, alias: l } = r;
2012
+ setIdToRemoteMap(t, r) {
2013
+ const { remote: o, expose: s } = r, { name: l, alias: a } = o;
2008
2014
  if (this.idToRemoteMap[t] = {
2009
- name: r.name,
2015
+ name: o.name,
2010
2016
  expose: s
2011
- }, l && t.startsWith(a)) {
2012
- const i = t.replace(a, l);
2017
+ }, a && t.startsWith(l)) {
2018
+ const i = t.replace(l, a);
2013
2019
  this.idToRemoteMap[i] = {
2014
- name: r.name,
2020
+ name: o.name,
2015
2021
  expose: s
2016
2022
  };
2017
2023
  return;
2018
2024
  }
2019
- if (l && t.startsWith(l)) {
2020
- const i = t.replace(l, a);
2025
+ if (a && t.startsWith(a)) {
2026
+ const i = t.replace(a, l);
2021
2027
  this.idToRemoteMap[i] = {
2022
- name: r.name,
2028
+ name: o.name,
2023
2029
  expose: s
2024
2030
  };
2025
2031
  }
2026
2032
  }
2027
2033
  // eslint-disable-next-line max-lines-per-function
2028
2034
  // eslint-disable-next-line @typescript-eslint/member-ordering
2029
- async loadRemote(t, o) {
2030
- const { host: r } = this;
2035
+ async loadRemote(t, r) {
2036
+ const { host: o } = this;
2031
2037
  try {
2032
- const { loadFactory: s = !0 } = o || {
2038
+ const { loadFactory: s = !0 } = r || {
2033
2039
  loadFactory: !0
2034
- }, { module: a, moduleOptions: l, remoteMatchInfo: i } = await this.getRemoteModuleAndOptions({
2040
+ }, { module: l, moduleOptions: a, remoteMatchInfo: i } = await this.getRemoteModuleAndOptions({
2035
2041
  id: t
2036
- }), { pkgNameOrAlias: c, remote: u, expose: p, id: d, remoteSnapshot: m } = i, y = await a.get(d, p, o, m), g = await this.hooks.lifecycle.onLoad.emit({
2042
+ }), { pkgNameOrAlias: c, remote: u, expose: p, id: d, remoteSnapshot: m } = i, y = await l.get(d, p, r, m), g = await this.hooks.lifecycle.onLoad.emit({
2037
2043
  id: d,
2038
2044
  pkgNameOrAlias: c,
2039
2045
  expose: p,
2040
2046
  exposeModule: s ? y : void 0,
2041
2047
  exposeModuleFactory: s ? void 0 : y,
2042
2048
  remote: u,
2043
- options: l,
2044
- moduleInstance: a,
2045
- origin: r
2049
+ options: a,
2050
+ moduleInstance: l,
2051
+ origin: o
2046
2052
  });
2047
2053
  return this.setIdToRemoteMap(t, i), typeof g == "function" ? g : y;
2048
2054
  } catch (s) {
2049
- const { from: a = "runtime" } = o || {
2055
+ const { from: l = "runtime" } = r || {
2050
2056
  from: "runtime"
2051
- }, l = await this.hooks.lifecycle.errorLoadRemote.emit({
2057
+ }, a = await this.hooks.lifecycle.errorLoadRemote.emit({
2052
2058
  id: t,
2053
2059
  error: s,
2054
- from: a,
2060
+ from: l,
2055
2061
  lifecycle: "onLoad",
2056
- origin: r
2062
+ origin: o
2057
2063
  });
2058
- if (!l)
2064
+ if (!a)
2059
2065
  throw s;
2060
- return l;
2066
+ return a;
2061
2067
  }
2062
2068
  }
2063
2069
  // eslint-disable-next-line @typescript-eslint/member-ordering
2064
2070
  async preloadRemote(t) {
2065
- const { host: o } = this;
2071
+ const { host: r } = this;
2066
2072
  await this.hooks.lifecycle.beforePreloadRemote.emit({
2067
2073
  preloadOps: t,
2068
- options: o.options,
2069
- origin: o
2074
+ options: r.options,
2075
+ origin: r
2070
2076
  });
2071
- const r = formatPreloadArgs(o.options.remotes, t);
2072
- await Promise.all(r.map(async (s) => {
2073
- const { remote: a } = s, l = getRemoteInfo(a), { globalSnapshot: i, remoteSnapshot: c } = await o.snapshotHandler.loadRemoteSnapshotInfo({
2074
- moduleInfo: a
2075
- }), u = await this.hooks.lifecycle.generatePreloadAssets.emit({
2076
- origin: o,
2077
+ const o = formatPreloadArgs(r.options.remotes, t);
2078
+ await Promise.all(o.map(async (s) => {
2079
+ const { remote: l } = s, a = getRemoteInfo(l), { globalSnapshot: i, remoteSnapshot: c } = await r.snapshotHandler.loadRemoteSnapshotInfo(l), u = await this.hooks.lifecycle.generatePreloadAssets.emit({
2080
+ origin: r,
2077
2081
  preloadOptions: s,
2078
- remote: a,
2079
- remoteInfo: l,
2082
+ remote: l,
2083
+ remoteInfo: a,
2080
2084
  globalSnapshot: i,
2081
2085
  remoteSnapshot: c
2082
2086
  });
2083
- u && preloadAssets(l, o, u);
2087
+ u && preloadAssets(a, r, u);
2084
2088
  }));
2085
2089
  }
2086
- registerRemotes(t, o) {
2087
- const { host: r } = this;
2090
+ registerRemotes(t, r) {
2091
+ const { host: o } = this;
2088
2092
  t.forEach((s) => {
2089
- this.registerRemote(s, r.options.remotes, {
2090
- force: o == null ? void 0 : o.force
2093
+ this.registerRemote(s, o.options.remotes, {
2094
+ force: r == null ? void 0 : r.force
2091
2095
  });
2092
2096
  });
2093
2097
  }
2094
2098
  async getRemoteModuleAndOptions(t) {
2095
- const { host: o } = this, { id: r } = t;
2099
+ const { host: r } = this, { id: o } = t;
2096
2100
  let s;
2097
2101
  try {
2098
2102
  s = await this.hooks.lifecycle.beforeRequest.emit({
2099
- id: r,
2100
- options: o.options,
2101
- origin: o
2103
+ id: o,
2104
+ options: r.options,
2105
+ origin: r
2102
2106
  });
2103
2107
  } catch (g) {
2104
2108
  if (s = await this.hooks.lifecycle.errorLoadRemote.emit({
2105
- id: r,
2106
- options: o.options,
2107
- origin: o,
2109
+ id: o,
2110
+ options: r.options,
2111
+ origin: r,
2108
2112
  from: "runtime",
2109
2113
  error: g,
2110
2114
  lifecycle: "beforeRequest"
2111
2115
  }), !s)
2112
2116
  throw g;
2113
2117
  }
2114
- const { id: a } = s, l = matchRemoteWithNameAndExpose(o.options.remotes, a);
2115
- assert(l, getShortErrorMsg(RUNTIME_004, runtimeDescMap, {
2116
- hostName: o.options.name,
2117
- requestId: a
2118
+ const { id: l } = s, a = matchRemoteWithNameAndExpose(r.options.remotes, l);
2119
+ assert(a, getShortErrorMsg(RUNTIME_004, runtimeDescMap, {
2120
+ hostName: r.options.name,
2121
+ requestId: l
2118
2122
  }));
2119
- const { remote: i } = l, c = getRemoteInfo(i), u = await o.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({
2120
- id: a
2121
- }, l, {
2122
- options: o.options,
2123
- origin: o,
2123
+ const { remote: i } = a, c = getRemoteInfo(i), u = await r.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({
2124
+ id: l
2125
+ }, a, {
2126
+ options: r.options,
2127
+ origin: r,
2124
2128
  remoteInfo: c
2125
2129
  })), { remote: p, expose: d } = u;
2126
- assert(p && d, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${a}.`);
2127
- let m = o.moduleCache.get(p.name);
2130
+ assert(p && d, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${l}.`);
2131
+ let m = r.moduleCache.get(p.name);
2128
2132
  const y = {
2129
- host: o,
2133
+ host: r,
2130
2134
  remoteInfo: c
2131
2135
  };
2132
- return m || (m = new Module(y), o.moduleCache.set(p.name, m)), {
2136
+ return m || (m = new Module(y), r.moduleCache.set(p.name, m)), {
2133
2137
  module: m,
2134
2138
  moduleOptions: y,
2135
2139
  remoteMatchInfo: u
2136
2140
  };
2137
2141
  }
2138
- registerRemote(t, o, r) {
2139
- const { host: s } = this, a = () => {
2142
+ registerRemote(t, r, o) {
2143
+ const { host: s } = this, l = () => {
2140
2144
  if (t.alias) {
2141
- const i = o.find((c) => {
2145
+ const i = r.find((c) => {
2142
2146
  var u;
2143
2147
  return t.alias && (c.name.startsWith(t.alias) || ((u = c.alias) == null ? void 0 : u.startsWith(t.alias)));
2144
2148
  });
@@ -2150,9 +2154,9 @@ class RemoteHandler {
2150
2154
  remote: t,
2151
2155
  origin: s
2152
2156
  });
2153
- const l = o.find((i) => i.name === t.name);
2154
- if (!l)
2155
- a(), o.push(t), this.hooks.lifecycle.registerRemote.emit({
2157
+ const a = r.find((i) => i.name === t.name);
2158
+ if (!a)
2159
+ l(), r.push(t), this.hooks.lifecycle.registerRemote.emit({
2156
2160
  remote: t,
2157
2161
  origin: s
2158
2162
  });
@@ -2161,7 +2165,7 @@ class RemoteHandler {
2161
2165
  `The remote "${t.name}" is already registered.`,
2162
2166
  "Please note that overriding it may cause unexpected errors."
2163
2167
  ];
2164
- r != null && r.force && (this.removeRemote(l), a(), o.push(t), this.hooks.lifecycle.registerRemote.emit({
2168
+ o != null && o.force && (this.removeRemote(a), l(), r.push(t), this.hooks.lifecycle.registerRemote.emit({
2165
2169
  remote: t,
2166
2170
  origin: s
2167
2171
  }), warn$1(i.join(" ")));
@@ -2169,17 +2173,17 @@ class RemoteHandler {
2169
2173
  }
2170
2174
  removeRemote(t) {
2171
2175
  try {
2172
- const { host: r } = this, { name: s } = t, a = r.options.remotes.findIndex((i) => i.name === s);
2173
- a !== -1 && r.options.remotes.splice(a, 1);
2174
- const l = r.moduleCache.get(t.name);
2175
- if (l) {
2176
- const i = l.remoteInfo, c = i.entryGlobalName;
2176
+ const { host: o } = this, { name: s } = t, l = o.options.remotes.findIndex((i) => i.name === s);
2177
+ l !== -1 && o.options.remotes.splice(l, 1);
2178
+ const a = o.moduleCache.get(t.name);
2179
+ if (a) {
2180
+ const i = a.remoteInfo, c = i.entryGlobalName;
2177
2181
  if (CurrentGlobal[c]) {
2178
- var o;
2179
- (o = Object.getOwnPropertyDescriptor(CurrentGlobal, c)) != null && o.configurable ? delete CurrentGlobal[c] : CurrentGlobal[c] = void 0;
2182
+ var r;
2183
+ (r = Object.getOwnPropertyDescriptor(CurrentGlobal, c)) != null && r.configurable ? delete CurrentGlobal[c] : CurrentGlobal[c] = void 0;
2180
2184
  }
2181
- const u = getRemoteEntryUniqueKey(l.remoteInfo);
2182
- globalLoading[u] && delete globalLoading[u], r.snapshotHandler.manifestCache.delete(i.entry);
2185
+ const u = getRemoteEntryUniqueKey(a.remoteInfo);
2186
+ globalLoading[u] && delete globalLoading[u], o.snapshotHandler.manifestCache.delete(i.entry);
2183
2187
  let p = i.buildVersion ? composeKeyWithSeparator(i.name, i.buildVersion) : i.name;
2184
2188
  const d = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => i.buildVersion ? y.options.id === p : y.name === p);
2185
2189
  if (d !== -1) {
@@ -2196,7 +2200,7 @@ class RemoteHandler {
2196
2200
  const A = S[R];
2197
2201
  A && Object.keys(A).forEach((T) => {
2198
2202
  const $ = A[T];
2199
- $ && typeof $ == "object" && $.from === i.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((w) => w !== i.name), $.useIn.length ? E = !1 : _.push([
2203
+ $ && typeof $ == "object" && $.from === i.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((N) => N !== i.name), $.useIn.length ? E = !1 : _.push([
2200
2204
  b,
2201
2205
  I,
2202
2206
  R,
@@ -2215,15 +2219,15 @@ class RemoteHandler {
2215
2219
  (T = g[b]) == null || (A = T[v]) == null || (R = A[I]) == null || delete R[S];
2216
2220
  }), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(d, 1);
2217
2221
  }
2218
- const { hostGlobalSnapshot: m } = getGlobalRemoteInfo(t, r);
2222
+ const { hostGlobalSnapshot: m } = getGlobalRemoteInfo(t, o);
2219
2223
  if (m) {
2220
2224
  const y = m && "remotesInfo" in m && m.remotesInfo && getInfoWithoutType(m.remotesInfo, t.name).key;
2221
2225
  y && (delete m.remotesInfo[y], Global.__FEDERATION__.__MANIFEST_LOADING__[y] && delete Global.__FEDERATION__.__MANIFEST_LOADING__[y]);
2222
2226
  }
2223
- r.moduleCache.delete(t.name);
2227
+ o.moduleCache.delete(t.name);
2224
2228
  }
2225
- } catch (r) {
2226
- logger.log("removeRemote fail: ", r);
2229
+ } catch (o) {
2230
+ logger.log("removeRemote fail: ", o);
2227
2231
  }
2228
2232
  }
2229
2233
  constructor(t) {
@@ -2246,59 +2250,59 @@ const USE_SNAPSHOT = typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN == "boolean"
2246
2250
  class FederationHost {
2247
2251
  initOptions(t) {
2248
2252
  this.registerPlugins(t.plugins);
2249
- const o = this.formatOptions(this.options, t);
2250
- return this.options = o, o;
2253
+ const r = this.formatOptions(this.options, t);
2254
+ return this.options = r, r;
2251
2255
  }
2252
- async loadShare(t, o) {
2253
- return this.sharedHandler.loadShare(t, o);
2256
+ async loadShare(t, r) {
2257
+ return this.sharedHandler.loadShare(t, r);
2254
2258
  }
2255
2259
  // The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
2256
2260
  // 1. If the loaded shared already exists globally, then it will be reused
2257
2261
  // 2. If lib exists in local shared, it will be used directly
2258
2262
  // 3. If the local get returns something other than Promise, then it will be used directly
2259
- loadShareSync(t, o) {
2260
- return this.sharedHandler.loadShareSync(t, o);
2263
+ loadShareSync(t, r) {
2264
+ return this.sharedHandler.loadShareSync(t, r);
2261
2265
  }
2262
- initializeSharing(t = DEFAULT_SCOPE, o) {
2263
- return this.sharedHandler.initializeSharing(t, o);
2266
+ initializeSharing(t = DEFAULT_SCOPE, r) {
2267
+ return this.sharedHandler.initializeSharing(t, r);
2264
2268
  }
2265
- initRawContainer(t, o, r) {
2269
+ initRawContainer(t, r, o) {
2266
2270
  const s = getRemoteInfo({
2267
2271
  name: t,
2268
- entry: o
2269
- }), a = new Module({
2272
+ entry: r
2273
+ }), l = new Module({
2270
2274
  host: this,
2271
2275
  remoteInfo: s
2272
2276
  });
2273
- return a.remoteEntryExports = r, this.moduleCache.set(t, a), a;
2277
+ return l.remoteEntryExports = o, this.moduleCache.set(t, l), l;
2274
2278
  }
2275
2279
  // eslint-disable-next-line max-lines-per-function
2276
2280
  // eslint-disable-next-line @typescript-eslint/member-ordering
2277
- async loadRemote(t, o) {
2278
- return this.remoteHandler.loadRemote(t, o);
2281
+ async loadRemote(t, r) {
2282
+ return this.remoteHandler.loadRemote(t, r);
2279
2283
  }
2280
2284
  // eslint-disable-next-line @typescript-eslint/member-ordering
2281
2285
  async preloadRemote(t) {
2282
2286
  return this.remoteHandler.preloadRemote(t);
2283
2287
  }
2284
- initShareScopeMap(t, o, r = {}) {
2285
- this.sharedHandler.initShareScopeMap(t, o, r);
2288
+ initShareScopeMap(t, r, o = {}) {
2289
+ this.sharedHandler.initShareScopeMap(t, r, o);
2286
2290
  }
2287
- formatOptions(t, o) {
2288
- const { shared: r } = formatShareConfigs(t, o), { userOptions: s, options: a } = this.hooks.lifecycle.beforeInit.emit({
2291
+ formatOptions(t, r) {
2292
+ const { shared: o } = formatShareConfigs(t, r), { userOptions: s, options: l } = this.hooks.lifecycle.beforeInit.emit({
2289
2293
  origin: this,
2290
- userOptions: o,
2294
+ userOptions: r,
2291
2295
  options: t,
2292
- shareInfo: r
2293
- }), l = this.remoteHandler.formatAndRegisterRemote(a, s), { shared: i } = this.sharedHandler.registerShared(a, s), c = [
2294
- ...a.plugins
2296
+ shareInfo: o
2297
+ }), a = this.remoteHandler.formatAndRegisterRemote(l, s), { shared: i } = this.sharedHandler.registerShared(l, s), c = [
2298
+ ...l.plugins
2295
2299
  ];
2296
2300
  s.plugins && s.plugins.forEach((p) => {
2297
2301
  c.includes(p) || c.push(p);
2298
2302
  });
2299
- const u = _extends$1({}, t, o, {
2303
+ const u = _extends$1({}, t, r, {
2300
2304
  plugins: c,
2301
- remotes: l,
2305
+ remotes: a,
2302
2306
  shared: i
2303
2307
  });
2304
2308
  return this.hooks.lifecycle.init.emit({
@@ -2307,7 +2311,7 @@ class FederationHost {
2307
2311
  }), u;
2308
2312
  }
2309
2313
  registerPlugins(t) {
2310
- const o = registerPlugins(t, [
2314
+ const r = registerPlugins(t, [
2311
2315
  this.hooks,
2312
2316
  this.remoteHandler.hooks,
2313
2317
  this.sharedHandler.hooks,
@@ -2315,10 +2319,10 @@ class FederationHost {
2315
2319
  this.loaderHook,
2316
2320
  this.bridgeHook
2317
2321
  ]);
2318
- this.options.plugins = this.options.plugins.reduce((r, s) => (s && r && !r.find((a) => a.name === s.name) && r.push(s), r), o || []);
2322
+ this.options.plugins = this.options.plugins.reduce((o, s) => (s && o && !o.find((l) => l.name === s.name) && o.push(s), o), r || []);
2319
2323
  }
2320
- registerRemotes(t, o) {
2321
- return this.remoteHandler.registerRemotes(t, o);
2324
+ registerRemotes(t, r) {
2325
+ return this.remoteHandler.registerRemotes(t, r);
2322
2326
  }
2323
2327
  constructor(t) {
2324
2328
  this.hooks = new PluginSystem({
@@ -2328,7 +2332,7 @@ class FederationHost {
2328
2332
  beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
2329
2333
  // maybe will change, temporarily for internal use only
2330
2334
  initContainer: new AsyncWaterfallHook("initContainer")
2331
- }), this.version = "0.15.0", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
2335
+ }), this.version = "0.14.3", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
2332
2336
  // FIXME: may not be suitable , not open to the public yet
2333
2337
  getModuleInfo: new SyncHook(),
2334
2338
  createScript: new SyncHook(),
@@ -2342,21 +2346,21 @@ class FederationHost {
2342
2346
  beforeBridgeDestroy: new SyncHook(),
2343
2347
  afterBridgeDestroy: new SyncHook()
2344
2348
  });
2345
- const o = USE_SNAPSHOT ? [
2349
+ const r = USE_SNAPSHOT ? [
2346
2350
  snapshotPlugin(),
2347
2351
  generatePreloadAssetsPlugin()
2348
- ] : [], r = {
2352
+ ] : [], o = {
2349
2353
  id: getBuilderId(),
2350
2354
  name: t.name,
2351
- plugins: o,
2355
+ plugins: r,
2352
2356
  remotes: [],
2353
2357
  shared: {},
2354
2358
  inBrowser: isBrowserEnv()
2355
2359
  };
2356
- this.name = t.name, this.options = r, this.snapshotHandler = new SnapshotHandler(this), this.sharedHandler = new SharedHandler(this), this.remoteHandler = new RemoteHandler(this), this.shareScopeMap = this.sharedHandler.shareScopeMap, this.registerPlugins([
2357
- ...r.plugins,
2360
+ 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([
2361
+ ...o.plugins,
2358
2362
  ...t.plugins || []
2359
- ]), this.options = this.formatOptions(r, t);
2363
+ ]), this.options = this.formatOptions(o, t);
2360
2364
  }
2361
2365
  }
2362
2366
  let FederationInstance = null;
@@ -2365,24 +2369,24 @@ function getInstance() {
2365
2369
  }
2366
2370
  setGlobalFederationConstructor(FederationHost);
2367
2371
  function createBridgeComponent(n) {
2368
- const t = /* @__PURE__ */ new Map(), o = getInstance();
2372
+ const t = /* @__PURE__ */ new Map(), r = getInstance();
2369
2373
  return () => ({
2370
- __APP_VERSION__: "0.15.0",
2371
- async render(r) {
2374
+ __APP_VERSION__: "0.14.3",
2375
+ async render(o) {
2372
2376
  var g, E, _;
2373
- LoggerInstance.debug("createBridgeComponent render Info", r);
2377
+ LoggerInstance.debug("createBridgeComponent render Info", o);
2374
2378
  const {
2375
2379
  moduleName: s,
2376
- dom: a,
2377
- basename: l,
2380
+ dom: l,
2381
+ basename: a,
2378
2382
  memoryRoute: i,
2379
2383
  hashRoute: c,
2380
2384
  ...u
2381
- } = r, p = Vue.createApp(n.rootComponent, u);
2382
- t.set(a, p);
2383
- const d = await ((_ = (E = (g = o == null ? void 0 : o.bridgeHook) == null ? void 0 : g.lifecycle) == null ? void 0 : E.beforeBridgeRender) == null ? void 0 : _.emit(r)), m = d && typeof d == "object" && (d != null && d.extraProps) ? d == null ? void 0 : d.extraProps : {}, y = n.appOptions({
2385
+ } = o, p = Vue.createApp(n.rootComponent, u);
2386
+ t.set(l, p);
2387
+ const d = await ((_ = (E = (g = r == null ? void 0 : r.bridgeHook) == null ? void 0 : g.lifecycle) == null ? void 0 : E.beforeBridgeRender) == null ? void 0 : _.emit(o)), m = d && typeof d == "object" && (d != null && d.extraProps) ? d == null ? void 0 : d.extraProps : {}, y = n.appOptions({
2384
2388
  app: p,
2385
- basename: l,
2389
+ basename: a,
2386
2390
  memoryRoute: i,
2387
2391
  hashRoute: c,
2388
2392
  ...u,
@@ -2390,10 +2394,10 @@ function createBridgeComponent(n) {
2390
2394
  });
2391
2395
  if (y != null && y.router) {
2392
2396
  let b, v = y.router.getRoutes();
2393
- r.memoryRoute ? b = VueRouter.createMemoryHistory(r.basename) : r.hashRoute ? (b = VueRouter.createWebHashHistory(), v = v.map((S) => ({
2397
+ o.memoryRoute ? b = VueRouter.createMemoryHistory(o.basename) : o.hashRoute ? (b = VueRouter.createWebHashHistory(), v = v.map((S) => ({
2394
2398
  ...S,
2395
- path: r.basename + S.path
2396
- }))) : b = VueRouter.createWebHistory(r.basename);
2399
+ path: o.basename + S.path
2400
+ }))) : b = VueRouter.createWebHistory(o.basename);
2397
2401
  const I = VueRouter.createRouter({
2398
2402
  ...y.router.options,
2399
2403
  history: b,
@@ -2404,11 +2408,11 @@ function createBridgeComponent(n) {
2404
2408
  router: I
2405
2409
  }), i && await I.push(i.entryPath), p.use(I);
2406
2410
  }
2407
- p.mount(a);
2411
+ p.mount(l);
2408
2412
  },
2409
- destroy(r) {
2410
- LoggerInstance.debug("createBridgeComponent destroy Info", r);
2411
- const s = t.get(r == null ? void 0 : r.dom);
2413
+ destroy(o) {
2414
+ LoggerInstance.debug("createBridgeComponent destroy Info", o);
2415
+ const s = t.get(o == null ? void 0 : o.dom);
2412
2416
  s == null || s.unmount();
2413
2417
  }
2414
2418
  });
@@ -2429,12 +2433,12 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2429
2433
  },
2430
2434
  inheritAttrs: !1,
2431
2435
  setup(n) {
2432
- const t = ref(null), o = ref(null), r = ref(""), s = useRoute(), a = getInstance(), l = useAttrs(), i = async () => {
2436
+ const t = ref(null), r = ref(null), o = ref(""), s = useRoute(), l = getInstance(), a = useAttrs(), i = async () => {
2433
2437
  var m, y, g, E;
2434
2438
  const u = (m = n.providerInfo) == null ? void 0 : m.call(n);
2435
- o.value = u;
2439
+ r.value = u;
2436
2440
  let p = {
2437
- ...l,
2441
+ ...a,
2438
2442
  moduleName: n.moduleName,
2439
2443
  dom: t.value,
2440
2444
  basename: n.basename,
@@ -2442,16 +2446,16 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2442
2446
  hashRoute: n.hashRoute
2443
2447
  };
2444
2448
  LoggerInstance.debug("createRemoteComponent LazyComponent render >>>", p);
2445
- const d = await ((E = (g = (y = a == null ? void 0 : a.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : g.beforeBridgeRender) == null ? void 0 : E.emit(p)) || {};
2449
+ const d = 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(p)) || {};
2446
2450
  p = {
2447
2451
  ...p,
2448
2452
  ...d.extraProps
2449
2453
  }, u.render(p);
2450
2454
  }, c = watch(() => s == null ? void 0 : s.path, (u) => {
2451
- u !== s.path && i(), r.value !== "" && r.value !== u && (LoggerInstance.debug("createRemoteComponent dispatchPopstateEnv >>>", {
2455
+ u !== s.path && i(), o.value !== "" && o.value !== u && (LoggerInstance.debug("createRemoteComponent dispatchPopstateEnv >>>", {
2452
2456
  ...n,
2453
2457
  pathname: s.path
2454
- }), e()), r.value = u;
2458
+ }), e()), o.value = u;
2455
2459
  });
2456
2460
  return onMounted(() => {
2457
2461
  i();
@@ -2459,7 +2463,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2459
2463
  var u;
2460
2464
  LoggerInstance.debug("createRemoteComponent LazyComponent destroy >>>", {
2461
2465
  ...n
2462
- }), c(), (u = o.value) == null || u.destroy({
2466
+ }), c(), (u = r.value) == null || u.destroy({
2463
2467
  dom: t.value
2464
2468
  });
2465
2469
  }), () => createVNode("div", mergeProps(n.rootAttrs || {}, {
@@ -2469,31 +2473,31 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2469
2473
  });
2470
2474
  function createRemoteComponent(n) {
2471
2475
  return defineAsyncComponent({
2472
- __APP_VERSION__: "0.15.0",
2476
+ __APP_VERSION__: "0.14.3",
2473
2477
  ...n.asyncComponentOptions,
2474
2478
  //@ts-ignore
2475
2479
  loader: async () => {
2476
2480
  var c, u;
2477
2481
  const t = useRoute();
2478
- let o = "/";
2479
- const r = (u = (c = t == null ? void 0 : t.matched) == null ? void 0 : c[0]) == null ? void 0 : u.path;
2480
- r && (r.endsWith("/:pathMatch(.*)*") ? o = r.replace("/:pathMatch(.*)*", "") : o = t.matched[0].path);
2482
+ let r = "/";
2483
+ const o = (u = (c = t == null ? void 0 : t.matched) == null ? void 0 : c[0]) == null ? void 0 : u.path;
2484
+ o && (o.endsWith("/:pathMatch(.*)*") ? r = o.replace("/:pathMatch(.*)*", "") : r = t.matched[0].path);
2481
2485
  const s = (n == null ? void 0 : n.export) || "default";
2482
2486
  LoggerInstance.debug("createRemoteComponent LazyComponent create >>>", {
2483
- basename: o,
2487
+ basename: r,
2484
2488
  info: n
2485
2489
  });
2486
- const a = await n.loader(), l = a && a[Symbol.for("mf_module_id")], i = a[s];
2490
+ const l = await n.loader(), a = l && l[Symbol.for("mf_module_id")], i = l[s];
2487
2491
  if (LoggerInstance.debug(
2488
2492
  "createRemoteComponent LazyComponent loadRemote info >>>",
2489
- { moduleName: l, module: a, exportName: s, basename: o, route: t }
2490
- ), s in a && typeof i == "function")
2493
+ { moduleName: a, module: l, exportName: s, basename: r, route: t }
2494
+ ), s in l && typeof i == "function")
2491
2495
  return {
2492
2496
  render() {
2493
2497
  return h(RemoteApp, {
2494
- moduleName: l,
2498
+ moduleName: a,
2495
2499
  providerInfo: i,
2496
- basename: o,
2500
+ basename: r,
2497
2501
  rootAttrs: n.rootAttrs
2498
2502
  });
2499
2503
  }