@module-federation/bridge-vue3 0.24.1 → 2.0.1

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
@@ -61,17 +61,17 @@ function generateSnapshotFromManifest(r, t = {}) {
61
61
  var S, _, T;
62
62
  const { remotes: n = {}, overrides: o = {}, version: s } = t;
63
63
  let i;
64
- const c = () => "publicPath" in r.metaData ? r.metaData.publicPath === "auto" && s ? inferAutoPublicPath(s) : r.metaData.publicPath : r.metaData.getPublicPath, a = Object.keys(o);
64
+ const a = () => "publicPath" in r.metaData ? r.metaData.publicPath === "auto" && s ? inferAutoPublicPath(s) : r.metaData.publicPath : r.metaData.getPublicPath, c = Object.keys(o);
65
65
  let u = {};
66
- Object.keys(n).length || (u = ((S = r.remotes) == null ? void 0 : S.reduce((I, A) => {
67
- let w;
68
- const k = A.federationContainerName;
69
- return a.includes(k) ? w = o[k] : "version" in A ? w = A.version : w = A.entry, I[k] = {
70
- matchedVersion: w
66
+ Object.keys(n).length || (u = ((S = r.remotes) == null ? void 0 : S.reduce((I, w) => {
67
+ let A;
68
+ const k = w.federationContainerName;
69
+ return c.includes(k) ? A = o[k] : "version" in w ? A = w.version : A = w.entry, I[k] = {
70
+ matchedVersion: A
71
71
  }, I;
72
72
  }, {})) || {}), Object.keys(n).forEach((I) => u[I] = {
73
73
  // overrides will override dependencies
74
- matchedVersion: a.includes(I) ? o[I] : n[I]
74
+ matchedVersion: c.includes(I) ? o[I] : n[I]
75
75
  });
76
76
  const { remoteEntry: { path: l, name: d, type: y }, types: p = { path: "", name: "", zip: "", api: "" }, buildInfo: { buildVersion: m }, globalName: g, ssrRemoteEntry: b } = r.metaData, { exposes: E } = r;
77
77
  let R = {
@@ -105,20 +105,20 @@ function generateSnapshotFromManifest(r, t = {}) {
105
105
  };
106
106
  }
107
107
  if ((T = r.metaData) != null && T.prefetchEntry) {
108
- const { path: I, name: A, type: w } = r.metaData.prefetchEntry;
108
+ const { path: I, name: w, type: A } = r.metaData.prefetchEntry;
109
109
  R = {
110
110
  ...R,
111
- prefetchEntry: simpleJoinRemoteEntry(I, A),
112
- prefetchEntryType: w
111
+ prefetchEntry: simpleJoinRemoteEntry(I, w),
112
+ prefetchEntryType: A
113
113
  };
114
114
  }
115
115
  if ("publicPath" in r.metaData ? i = {
116
116
  ...R,
117
- publicPath: c(),
117
+ publicPath: a(),
118
118
  ssrPublicPath: r.metaData.ssrPublicPath
119
119
  } : i = {
120
120
  ...R,
121
- getPublicPath: c()
121
+ getPublicPath: a()
122
122
  }, b) {
123
123
  const I = simpleJoinRemoteEntry(b.path, b.name);
124
124
  i.ssrRemoteEntry = I, i.ssrRemoteEntryType = b.type || "commonjs-module";
@@ -164,7 +164,7 @@ class Logger {
164
164
  this.delegate = t ?? DEFAULT_DELEGATE;
165
165
  }
166
166
  emit(t, n) {
167
- const o = this.delegate, i = isDebugMode() ? captureStackTrace() : void 0, c = i ? [...n, i] : n, a = (() => {
167
+ const o = this.delegate, i = isDebugMode() ? captureStackTrace() : void 0, a = i ? [...n, i] : n, c = (() => {
168
168
  switch (t) {
169
169
  case "log":
170
170
  return ["log", "info"];
@@ -179,17 +179,17 @@ class Logger {
179
179
  return ["debug", "log"];
180
180
  }
181
181
  })();
182
- for (const u of a) {
182
+ for (const u of c) {
183
183
  const l = o[u];
184
184
  if (typeof l == "function") {
185
- l.call(o, this.prefix, ...c);
185
+ l.call(o, this.prefix, ...a);
186
186
  return;
187
187
  }
188
188
  }
189
- for (const u of a) {
189
+ for (const u of c) {
190
190
  const l = DEFAULT_DELEGATE[u];
191
191
  if (typeof l == "function") {
192
- l.call(DEFAULT_DELEGATE, this.prefix, ...c);
192
+ l.call(DEFAULT_DELEGATE, this.prefix, ...a);
193
193
  return;
194
194
  }
195
195
  }
@@ -243,22 +243,22 @@ function isStaticResourcesEqual(r, t) {
243
243
  function createScript(r) {
244
244
  let t = null, n = !0, o = 2e4, s;
245
245
  const i = document.getElementsByTagName("script");
246
- for (let a = 0; a < i.length; a++) {
247
- const u = i[a], l = u.getAttribute("src");
246
+ for (let c = 0; c < i.length; c++) {
247
+ const u = i[c], l = u.getAttribute("src");
248
248
  if (l && isStaticResourcesEqual(l, r.url)) {
249
249
  t = u, n = !1;
250
250
  break;
251
251
  }
252
252
  }
253
253
  if (!t) {
254
- const a = r.attrs;
255
- t = document.createElement("script"), t.type = (a == null ? void 0 : a.type) === "module" ? "module" : "text/javascript";
254
+ const c = r.attrs;
255
+ t = document.createElement("script"), t.type = (c == null ? void 0 : c.type) === "module" ? "module" : "text/javascript";
256
256
  let u;
257
- r.createScriptHook && (u = r.createScriptHook(r.url, r.attrs), u instanceof HTMLScriptElement ? t = u : typeof u == "object" && ("script" in u && u.script && (t = u.script), "timeout" in u && u.timeout && (o = u.timeout))), t.src || (t.src = r.url), a && !u && Object.keys(a).forEach((l) => {
258
- t && (l === "async" || l === "defer" ? t[l] = a[l] : t.getAttribute(l) || t.setAttribute(l, a[l]));
257
+ r.createScriptHook && (u = r.createScriptHook(r.url, r.attrs), u instanceof HTMLScriptElement ? t = u : typeof u == "object" && ("script" in u && u.script && (t = u.script), "timeout" in u && u.timeout && (o = u.timeout))), t.src || (t.src = r.url), c && !u && Object.keys(c).forEach((l) => {
258
+ t && (l === "async" || l === "defer" ? t[l] = c[l] : t.getAttribute(l) || t.setAttribute(l, c[l]));
259
259
  });
260
260
  }
261
- const c = async (a, u) => {
261
+ const a = async (c, u) => {
262
262
  clearTimeout(s);
263
263
  const l = () => {
264
264
  (u == null ? void 0 : u.type) === "error" ? r != null && r.onErrorCallback && (r == null || r.onErrorCallback(u)) : r != null && r.cb && (r == null || r.cb());
@@ -266,8 +266,8 @@ function createScript(r) {
266
266
  if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
267
267
  const { needDeleteScript: d = !0 } = r;
268
268
  d && t != null && t.parentNode && t.parentNode.removeChild(t);
269
- }), a && typeof a == "function")) {
270
- const d = a(u);
269
+ }), c && typeof c == "function")) {
270
+ const d = c(u);
271
271
  if (d instanceof Promise) {
272
272
  const y = await d;
273
273
  return l(), y;
@@ -276,47 +276,47 @@ function createScript(r) {
276
276
  }
277
277
  l();
278
278
  };
279
- return t.onerror = c.bind(null, t.onerror), t.onload = c.bind(null, t.onload), s = setTimeout(() => {
280
- c(null, new Error(`Remote script "${r.url}" time-outed.`));
279
+ return t.onerror = a.bind(null, t.onerror), t.onload = a.bind(null, t.onload), s = setTimeout(() => {
280
+ a(null, new Error(`Remote script "${r.url}" time-outed.`));
281
281
  }, o), { script: t, needAttach: n };
282
282
  }
283
283
  function createLink(r) {
284
284
  let t = null, n = !0;
285
285
  const o = document.getElementsByTagName("link");
286
286
  for (let i = 0; i < o.length; i++) {
287
- const c = o[i], a = c.getAttribute("href"), u = c.getAttribute("rel");
288
- if (a && isStaticResourcesEqual(a, r.url) && u === r.attrs.rel) {
289
- t = c, n = !1;
287
+ const a = o[i], c = a.getAttribute("href"), u = a.getAttribute("rel");
288
+ if (c && isStaticResourcesEqual(c, r.url) && u === r.attrs.rel) {
289
+ t = a, n = !1;
290
290
  break;
291
291
  }
292
292
  }
293
293
  if (!t) {
294
294
  t = document.createElement("link"), t.setAttribute("href", r.url);
295
295
  let i;
296
- const c = r.attrs;
297
- r.createLinkHook && (i = r.createLinkHook(r.url, c), i instanceof HTMLLinkElement && (t = i)), c && !i && Object.keys(c).forEach((a) => {
298
- t && !t.getAttribute(a) && t.setAttribute(a, c[a]);
296
+ const a = r.attrs;
297
+ r.createLinkHook && (i = r.createLinkHook(r.url, a), i instanceof HTMLLinkElement && (t = i)), a && !i && Object.keys(a).forEach((c) => {
298
+ t && !t.getAttribute(c) && t.setAttribute(c, a[c]);
299
299
  });
300
300
  }
301
- const s = (i, c) => {
302
- const a = () => {
303
- (c == null ? void 0 : c.type) === "error" ? r != null && r.onErrorCallback && (r == null || r.onErrorCallback(c)) : r != null && r.cb && (r == null || r.cb());
301
+ const s = (i, a) => {
302
+ const c = () => {
303
+ (a == null ? void 0 : a.type) === "error" ? r != null && r.onErrorCallback && (r == null || r.onErrorCallback(a)) : r != null && r.cb && (r == null || r.cb());
304
304
  };
305
305
  if (t && (t.onerror = null, t.onload = null, safeWrapper(() => {
306
306
  const { needDeleteLink: u = !0 } = r;
307
307
  u && t != null && t.parentNode && t.parentNode.removeChild(t);
308
308
  }), i)) {
309
- const u = i(c);
310
- return a(), u;
309
+ const u = i(a);
310
+ return c(), u;
311
311
  }
312
- a();
312
+ c();
313
313
  };
314
314
  return t.onerror = s.bind(null, t.onerror), t.onload = s.bind(null, t.onload), { link: t, needAttach: n };
315
315
  }
316
316
  function loadScript(r, t) {
317
317
  const { attrs: n = {}, createScriptHook: o } = t;
318
318
  return new Promise((s, i) => {
319
- const { script: c, needAttach: a } = createScript({
319
+ const { script: a, needAttach: c } = createScript({
320
320
  url: r,
321
321
  cb: s,
322
322
  onErrorCallback: i,
@@ -327,7 +327,7 @@ function loadScript(r, t) {
327
327
  createScriptHook: o,
328
328
  needDeleteScript: !0
329
329
  });
330
- a && document.head.appendChild(c);
330
+ c && document.head.appendChild(a);
331
331
  });
332
332
  }
333
333
  const sdkImportCache = /* @__PURE__ */ new Map();
@@ -345,7 +345,7 @@ const loadNodeFetch = async () => {
345
345
  const r = await importNodeModule("node-fetch");
346
346
  return r.default || r;
347
347
  }, lazyLoaderHookFetch = async (r, t, n) => {
348
- const s = await ((i, c) => n.lifecycle.fetch.emit(i, c))(r, t || {});
348
+ const s = await ((i, a) => n.lifecycle.fetch.emit(i, a))(r, t || {});
349
349
  return !s || !(s instanceof Response) ? (typeof fetch > "u" ? await loadNodeFetch() : fetch)(r, t || {}) : s;
350
350
  }, createScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (url, cb, attrs, loaderHook) => {
351
351
  if (loaderHook != null && loaderHook.createScriptHook) {
@@ -403,11 +403,11 @@ const loadNodeFetch = async () => {
403
403
  t(new Error("createScriptNode is disabled in non-Node.js environment"));
404
404
  }, loadScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (r, t) => new Promise((n, o) => {
405
405
  createScriptNode(r, (s, i) => {
406
- var c, a;
406
+ var a, c;
407
407
  if (s)
408
408
  o(s);
409
409
  else {
410
- const u = ((c = t == null ? void 0 : t.attrs) == null ? void 0 : c.globalName) || `__FEDERATION_${(a = t == null ? void 0 : t.attrs) == null ? void 0 : a.name}:custom__`, l = globalThis[u] = i;
410
+ const u = ((a = t == null ? void 0 : t.attrs) == null ? void 0 : a.globalName) || `__FEDERATION_${(c = t == null ? void 0 : t.attrs) == null ? void 0 : c.name}:custom__`, l = globalThis[u] = i;
411
411
  n(l);
412
412
  }
413
413
  }, t.attrs, t.loaderHook);
@@ -417,17 +417,17 @@ const loadNodeFetch = async () => {
417
417
  async function loadModule(r, t) {
418
418
  if (esmModuleCache.has(r))
419
419
  return esmModuleCache.get(r);
420
- const { fetch: n, vm: o } = t, i = await (await n(r)).text(), c = new o.SourceTextModule(i, {
420
+ const { fetch: n, vm: o } = t, i = await (await n(r)).text(), a = new o.SourceTextModule(i, {
421
421
  // @ts-ignore
422
- importModuleDynamically: async (a, u) => {
423
- const l = new URL(a, r).href;
422
+ importModuleDynamically: async (c, u) => {
423
+ const l = new URL(c, r).href;
424
424
  return loadModule(l, t);
425
425
  }
426
426
  });
427
- return esmModuleCache.set(r, c), await c.link(async (a) => {
428
- const u = new URL(a, r).href;
427
+ return esmModuleCache.set(r, a), await a.link(async (c) => {
428
+ const u = new URL(c, r).href;
429
429
  return await loadModule(u, t);
430
- }), c;
430
+ }), a;
431
431
  }
432
432
  const LoggerInstance = createLogger("[ Module Federation Bridge Vue3 ]"), 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", RUNTIME_009 = "RUNTIME-009", getDocsUrl = (r) => `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${r.split("-")[0].toLowerCase()}#${r.toLowerCase()}`, getShortErrorMsg = (r, t, n, o) => {
433
433
  const s = [`${[t[r]]} #${r}`];
@@ -515,7 +515,7 @@ function includeOwnProperty(r, t) {
515
515
  includeOwnProperty(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__") || definePropertyGlobalVal(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__", {});
516
516
  const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;
517
517
  function setGlobalDefaultVal(r) {
518
- var t, n, o, s, i, c;
518
+ var t, n, o, s, i, a;
519
519
  includeOwnProperty(r, "__VMOK__") && !includeOwnProperty(r, "__FEDERATION__") && definePropertyGlobalVal(r, "__FEDERATION__", r.__VMOK__), includeOwnProperty(r, "__FEDERATION__") || (definePropertyGlobalVal(r, "__FEDERATION__", {
520
520
  __GLOBAL_PLUGIN__: [],
521
521
  __INSTANCES__: [],
@@ -523,12 +523,12 @@ function setGlobalDefaultVal(r) {
523
523
  __SHARE__: {},
524
524
  __MANIFEST_LOADING__: {},
525
525
  __PRELOADED_MAP__: /* @__PURE__ */ new Map()
526
- }), definePropertyGlobalVal(r, "__VMOK__", r.__FEDERATION__)), (t = r.__FEDERATION__).__GLOBAL_PLUGIN__ ?? (t.__GLOBAL_PLUGIN__ = []), (n = r.__FEDERATION__).__INSTANCES__ ?? (n.__INSTANCES__ = []), (o = r.__FEDERATION__).moduleInfo ?? (o.moduleInfo = {}), (s = r.__FEDERATION__).__SHARE__ ?? (s.__SHARE__ = {}), (i = r.__FEDERATION__).__MANIFEST_LOADING__ ?? (i.__MANIFEST_LOADING__ = {}), (c = r.__FEDERATION__).__PRELOADED_MAP__ ?? (c.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
526
+ }), definePropertyGlobalVal(r, "__VMOK__", r.__FEDERATION__)), (t = r.__FEDERATION__).__GLOBAL_PLUGIN__ ?? (t.__GLOBAL_PLUGIN__ = []), (n = r.__FEDERATION__).__INSTANCES__ ?? (n.__INSTANCES__ = []), (o = r.__FEDERATION__).moduleInfo ?? (o.moduleInfo = {}), (s = r.__FEDERATION__).__SHARE__ ?? (s.__SHARE__ = {}), (i = r.__FEDERATION__).__MANIFEST_LOADING__ ?? (i.__MANIFEST_LOADING__ = {}), (a = r.__FEDERATION__).__PRELOADED_MAP__ ?? (a.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
527
527
  }
528
528
  setGlobalDefaultVal(CurrentGlobal);
529
529
  setGlobalDefaultVal(nativeGlobal);
530
530
  function setGlobalFederationConstructor(r, t = isDebugMode()) {
531
- t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.24.1");
531
+ t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = r, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.0.1");
532
532
  }
533
533
  function getInfoWithoutType(r, t) {
534
534
  if (typeof t == "string") {
@@ -540,11 +540,11 @@ function getInfoWithoutType(r, t) {
540
540
  {
541
541
  const o = Object.keys(r);
542
542
  for (const s of o) {
543
- const [i, c] = s.split(":"), a = `${i}:${t}`, u = r[a];
543
+ const [i, a] = s.split(":"), c = `${i}:${t}`, u = r[c];
544
544
  if (u)
545
545
  return {
546
546
  value: u,
547
- key: a
547
+ key: c
548
548
  };
549
549
  }
550
550
  return {
@@ -560,9 +560,9 @@ const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo, getTarge
560
560
  if (o && !o.version && "version" in r && r.version && (o.version = r.version), o)
561
561
  return o;
562
562
  if ("version" in r && r.version) {
563
- const { version: s, ...i } = r, c = getFMId(i), a = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, c).value;
564
- if ((a == null ? void 0 : a.version) === s)
565
- return a;
563
+ const { version: s, ...i } = r, a = getFMId(i), c = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, a).value;
564
+ if ((c == null ? void 0 : c.version) === s)
565
+ return c;
566
566
  }
567
567
  }, getGlobalSnapshotInfoByModuleInfo = (r) => getTargetSnapshotInfoByModuleInfo(r, nativeGlobal.__FEDERATION__.moduleInfo), setGlobalSnapshotInfoByModuleInfo = (r, t) => {
568
568
  const n = getFMId(r);
@@ -598,7 +598,7 @@ function combineVersion(r, t, n, o) {
598
598
  return o ? `${s}-${o}` : s;
599
599
  }
600
600
  function parseHyphen(r) {
601
- return r.replace(parseRegex(hyphenRange), (t, n, o, s, i, c, a, u, l, d, y, p) => (isXVersion(o) ? n = "" : isXVersion(s) ? n = `>=${o}.0.0` : isXVersion(i) ? n = `>=${o}.${s}.0` : n = `>=${n}`, isXVersion(l) ? u = "" : isXVersion(d) ? u = `<${Number(l) + 1}.0.0-0` : isXVersion(y) ? u = `<${l}.${Number(d) + 1}.0-0` : p ? u = `<=${l}.${d}.${y}-${p}` : u = `<=${u}`, `${n} ${u}`.trim()));
601
+ return r.replace(parseRegex(hyphenRange), (t, n, o, s, i, a, c, u, l, d, y, p) => (isXVersion(o) ? n = "" : isXVersion(s) ? n = `>=${o}.0.0` : isXVersion(i) ? n = `>=${o}.${s}.0` : n = `>=${n}`, isXVersion(l) ? u = "" : isXVersion(d) ? u = `<${Number(l) + 1}.0.0-0` : isXVersion(y) ? u = `<${l}.${Number(d) + 1}.0-0` : p ? u = `<=${l}.${d}.${y}-${p}` : u = `<=${u}`, `${n} ${u}`.trim()));
602
602
  }
603
603
  function parseComparatorTrim(r) {
604
604
  return r.replace(parseRegex(comparatorTrim), "$1$2$3");
@@ -610,15 +610,15 @@ function parseCaretTrim(r) {
610
610
  return r.replace(parseRegex(caretTrim), "$1^");
611
611
  }
612
612
  function parseCarets(r) {
613
- return r.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (n, o, s, i, c) => isXVersion(o) ? "" : isXVersion(s) ? `>=${o}.0.0 <${Number(o) + 1}.0.0-0` : isXVersion(i) ? o === "0" ? `>=${o}.${s}.0 <${o}.${Number(s) + 1}.0-0` : `>=${o}.${s}.0 <${Number(o) + 1}.0.0-0` : c ? o === "0" ? s === "0" ? `>=${o}.${s}.${i}-${c} <${o}.${s}.${Number(i) + 1}-0` : `>=${o}.${s}.${i}-${c} <${o}.${Number(s) + 1}.0-0` : `>=${o}.${s}.${i}-${c} <${Number(o) + 1}.0.0-0` : o === "0" ? s === "0" ? `>=${o}.${s}.${i} <${o}.${s}.${Number(i) + 1}-0` : `>=${o}.${s}.${i} <${o}.${Number(s) + 1}.0-0` : `>=${o}.${s}.${i} <${Number(o) + 1}.0.0-0`)).join(" ");
613
+ return r.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (n, o, s, i, a) => isXVersion(o) ? "" : isXVersion(s) ? `>=${o}.0.0 <${Number(o) + 1}.0.0-0` : isXVersion(i) ? 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}.${i}-${a} <${o}.${s}.${Number(i) + 1}-0` : `>=${o}.${s}.${i}-${a} <${o}.${Number(s) + 1}.0-0` : `>=${o}.${s}.${i}-${a} <${Number(o) + 1}.0.0-0` : o === "0" ? s === "0" ? `>=${o}.${s}.${i} <${o}.${s}.${Number(i) + 1}-0` : `>=${o}.${s}.${i} <${o}.${Number(s) + 1}.0-0` : `>=${o}.${s}.${i} <${Number(o) + 1}.0.0-0`)).join(" ");
614
614
  }
615
615
  function parseTildes(r) {
616
- return r.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (n, o, s, i, c) => isXVersion(o) ? "" : isXVersion(s) ? `>=${o}.0.0 <${Number(o) + 1}.0.0-0` : isXVersion(i) ? `>=${o}.${s}.0 <${o}.${Number(s) + 1}.0-0` : c ? `>=${o}.${s}.${i}-${c} <${o}.${Number(s) + 1}.0-0` : `>=${o}.${s}.${i} <${o}.${Number(s) + 1}.0-0`)).join(" ");
616
+ return r.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (n, o, s, i, a) => isXVersion(o) ? "" : isXVersion(s) ? `>=${o}.0.0 <${Number(o) + 1}.0.0-0` : isXVersion(i) ? `>=${o}.${s}.0 <${o}.${Number(s) + 1}.0-0` : a ? `>=${o}.${s}.${i}-${a} <${o}.${Number(s) + 1}.0-0` : `>=${o}.${s}.${i} <${o}.${Number(s) + 1}.0-0`)).join(" ");
617
617
  }
618
618
  function parseXRanges(r) {
619
- return r.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (n, o, s, i, c, a) => {
620
- const u = isXVersion(s), l = u || isXVersion(i), d = l || isXVersion(c);
621
- return o === "=" && d && (o = ""), a = "", u ? o === ">" || o === "<" ? "<0.0.0-0" : "*" : o && d ? (l && (i = 0), c = 0, o === ">" ? (o = ">=", l ? (s = Number(s) + 1, i = 0, c = 0) : (i = Number(i) + 1, c = 0)) : o === "<=" && (o = "<", l ? s = Number(s) + 1 : i = Number(i) + 1), o === "<" && (a = "-0"), `${o + s}.${i}.${c}${a}`) : l ? `>=${s}.0.0${a} <${Number(s) + 1}.0.0-0` : d ? `>=${s}.${i}.0${a} <${s}.${Number(i) + 1}.0-0` : n;
619
+ return r.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (n, o, s, i, a, c) => {
620
+ const u = isXVersion(s), l = u || isXVersion(i), d = l || isXVersion(a);
621
+ return o === "=" && d && (o = ""), c = "", u ? o === ">" || o === "<" ? "<0.0.0-0" : "*" : o && d ? (l && (i = 0), a = 0, o === ">" ? (o = ">=", l ? (s = Number(s) + 1, i = 0, a = 0) : (i = Number(i) + 1, a = 0)) : o === "<=" && (o = "<", l ? s = Number(s) + 1 : i = Number(i) + 1), o === "<" && (c = "-0"), `${o + s}.${i}.${a}${c}`) : l ? `>=${s}.0.0${c} <${Number(s) + 1}.0.0-0` : d ? `>=${s}.${i}.0${c} <${s}.${Number(i) + 1}.0-0` : n;
622
622
  })).join(" ");
623
623
  }
624
624
  function parseStar(r) {
@@ -639,9 +639,9 @@ function comparePreRelease(r, t) {
639
639
  if (n === void 0 && o === void 0)
640
640
  return 0;
641
641
  for (let s = 0, i = n.length; s <= i; s++) {
642
- const c = n[s], a = o[s];
643
- if (c !== a)
644
- return c === void 0 && a === void 0 ? 0 : c ? a ? compareAtom(c, a) : -1 : 1;
642
+ const a = n[s], c = o[s];
643
+ if (a !== c)
644
+ return a === void 0 && c === void 0 ? 0 : a ? c ? compareAtom(a, c) : -1 : 1;
645
645
  }
646
646
  return 0;
647
647
  }
@@ -714,14 +714,14 @@ function satisfy(r, t) {
714
714
  const n = extractComparator(r);
715
715
  if (!n)
716
716
  return !1;
717
- const [, o, , s, i, c, a] = n, u = {
717
+ const [, o, , s, i, a, c] = n, u = {
718
718
  operator: o,
719
- version: combineVersion(s, i, c, a),
719
+ version: combineVersion(s, i, a, c),
720
720
  // exclude build atom
721
721
  major: s,
722
722
  minor: i,
723
- patch: c,
724
- preRelease: a == null ? void 0 : a.split(".")
723
+ patch: a,
724
+ preRelease: c == null ? void 0 : c.split(".")
725
725
  }, l = t.split("||");
726
726
  for (const d of l) {
727
727
  const y = d.trim();
@@ -744,15 +744,15 @@ function satisfy(r, t) {
744
744
  b = !1;
745
745
  break;
746
746
  }
747
- const [, S, , _, T, I, A] = R, w = {
747
+ const [, S, , _, T, I, w] = R, A = {
748
748
  operator: S,
749
- version: combineVersion(_, T, I, A),
749
+ version: combineVersion(_, T, I, w),
750
750
  major: _,
751
751
  minor: T,
752
752
  patch: I,
753
- preRelease: A == null ? void 0 : A.split(".")
753
+ preRelease: w == null ? void 0 : w.split(".")
754
754
  };
755
- if (!compare(w, u)) {
755
+ if (!compare(A, u)) {
756
756
  b = !1;
757
757
  break;
758
758
  }
@@ -767,11 +767,11 @@ function satisfy(r, t) {
767
767
  return !1;
768
768
  }
769
769
  function formatShare(r, t, n, o) {
770
- var i;
770
+ var i, a;
771
771
  let s;
772
772
  if ("get" in r ? s = r.get : "lib" in r ? s = () => Promise.resolve(r.lib) : s = () => Promise.resolve(() => {
773
773
  throw new Error(`Can not get shared '${n}'!`);
774
- }), (i = r.shareConfig) != null && i.eager && r.treeShaking)
774
+ }), (i = r.shareConfig) != null && i.eager && ((a = r.treeShaking) != null && a.mode))
775
775
  throw new Error('Can not set "eager:true" and "treeShaking" at the same time!');
776
776
  return {
777
777
  deps: [],
@@ -800,18 +800,18 @@ function formatShare(r, t, n, o) {
800
800
  };
801
801
  }
802
802
  function formatShareConfigs(r, t) {
803
- const n = t.shared || {}, o = t.name, s = Object.keys(n).reduce((c, a) => {
804
- const u = arrayOptions(n[a]);
805
- return c[a] = c[a] || [], u.forEach((l) => {
806
- c[a].push(formatShare(l, o, a, t.shareStrategy));
807
- }), c;
803
+ const n = t.shared || {}, o = t.name, s = Object.keys(n).reduce((a, c) => {
804
+ const u = arrayOptions(n[c]);
805
+ return a[c] = a[c] || [], u.forEach((l) => {
806
+ a[c].push(formatShare(l, o, c, t.shareStrategy));
807
+ }), a;
808
808
  }, {}), i = {
809
809
  ...r.shared
810
810
  };
811
- return Object.keys(s).forEach((c) => {
812
- i[c] ? s[c].forEach((a) => {
813
- i[c].find((l) => l.version === a.version) || i[c].push(a);
814
- }) : i[c] = s[c];
811
+ return Object.keys(s).forEach((a) => {
812
+ i[a] ? s[a].forEach((c) => {
813
+ i[a].find((l) => l.version === c.version) || i[a].push(c);
814
+ }) : i[a] = s[a];
815
815
  }), { allShareInfos: i, newShareInfos: s };
816
816
  }
817
817
  function shouldUseTreeShaking(r, t) {
@@ -824,10 +824,10 @@ function versionLt(r, t) {
824
824
  const n = (o) => {
825
825
  if (!Number.isNaN(Number(o))) {
826
826
  const i = o.split(".");
827
- let c = o;
828
- for (let a = 0; a < 3 - i.length; a++)
829
- c += ".0";
830
- return c;
827
+ let a = o;
828
+ for (let c = 0; c < 3 - i.length; c++)
829
+ a += ".0";
830
+ return a;
831
831
  }
832
832
  return o;
833
833
  };
@@ -846,29 +846,29 @@ const findVersion = (r, t) => {
846
846
  };
847
847
  function findSingletonVersionOrderByVersion(r, t, n, o) {
848
848
  const s = r[t][n];
849
- let i = "", c = shouldUseTreeShaking(o);
850
- const a = function(u, l) {
851
- return c ? s[u].treeShaking ? s[l].treeShaking ? !isLoaded(s[u].treeShaking) && versionLt(u, l) : !1 : !0 : !isLoaded(s[u]) && versionLt(u, l);
849
+ let i = "", a = shouldUseTreeShaking(o);
850
+ const c = function(u, l) {
851
+ return a ? s[u].treeShaking ? s[l].treeShaking ? !isLoaded(s[u].treeShaking) && versionLt(u, l) : !1 : !0 : !isLoaded(s[u]) && versionLt(u, l);
852
852
  };
853
- if (c) {
854
- if (i = findVersion(r[t][n], a), i)
853
+ if (a) {
854
+ if (i = findVersion(r[t][n], c), i)
855
855
  return {
856
856
  version: i,
857
- useTreesShaking: c
857
+ useTreesShaking: a
858
858
  };
859
- c = !1;
859
+ a = !1;
860
860
  }
861
861
  return {
862
- version: findVersion(r[t][n], a),
863
- useTreesShaking: c
862
+ version: findVersion(r[t][n], c),
863
+ useTreesShaking: a
864
864
  };
865
865
  }
866
866
  const isLoadingOrLoaded = (r) => isLoaded(r) || isLoading(r);
867
867
  function findSingletonVersionOrderByLoaded(r, t, n, o) {
868
868
  const s = r[t][n];
869
- let i = "", c = shouldUseTreeShaking(o);
870
- const a = function(u, l) {
871
- if (c) {
869
+ let i = "", a = shouldUseTreeShaking(o);
870
+ const c = function(u, l) {
871
+ if (a) {
872
872
  if (!s[u].treeShaking)
873
873
  return !0;
874
874
  if (!s[l].treeShaking)
@@ -880,17 +880,17 @@ function findSingletonVersionOrderByLoaded(r, t, n, o) {
880
880
  }
881
881
  return isLoadingOrLoaded(s[l]) ? isLoadingOrLoaded(s[u]) ? !!versionLt(u, l) : !0 : isLoadingOrLoaded(s[u]) ? !1 : versionLt(u, l);
882
882
  };
883
- if (c) {
884
- if (i = findVersion(r[t][n], a), i)
883
+ if (a) {
884
+ if (i = findVersion(r[t][n], c), i)
885
885
  return {
886
886
  version: i,
887
- useTreesShaking: c
887
+ useTreesShaking: a
888
888
  };
889
- c = !1;
889
+ a = !1;
890
890
  }
891
891
  return {
892
- version: findVersion(r[t][n], a),
893
- useTreesShaking: c
892
+ version: findVersion(r[t][n], c),
893
+ useTreesShaking: a
894
894
  };
895
895
  }
896
896
  function getFindShareFunction(r) {
@@ -899,10 +899,10 @@ function getFindShareFunction(r) {
899
899
  function getRegisteredShare(r, t, n, o) {
900
900
  if (!r)
901
901
  return;
902
- const { shareConfig: s, scope: i = DEFAULT_SCOPE, strategy: c, treeShaking: a } = n, u = Array.isArray(i) ? i : [i];
902
+ const { shareConfig: s, scope: i = DEFAULT_SCOPE, strategy: a, treeShaking: c } = n, u = Array.isArray(i) ? i : [i];
903
903
  for (const l of u)
904
904
  if (s && r[l] && r[l][t]) {
905
- const { requiredVersion: d } = s, y = getFindShareFunction(c), { version: p, useTreesShaking: m } = y(r, l, t, a), g = () => {
905
+ const { requiredVersion: d } = s, y = getFindShareFunction(a), { version: p, useTreesShaking: m } = y(r, l, t, c), g = () => {
906
906
  const R = r[l][t][p];
907
907
  if (s.singleton) {
908
908
  if (typeof d == "string" && !satisfy(p, d)) {
@@ -924,10 +924,10 @@ function getRegisteredShare(r, t, n, o) {
924
924
  shared: R,
925
925
  useTreesShaking: m
926
926
  };
927
- const S = shouldUseTreeShaking(a);
927
+ const S = shouldUseTreeShaking(c);
928
928
  if (S) {
929
929
  for (const [_, T] of Object.entries(r[l][t]))
930
- if (shouldUseTreeShaking(T.treeShaking, a == null ? void 0 : a.usedExports) && satisfy(_, d))
930
+ if (shouldUseTreeShaking(T.treeShaking, c == null ? void 0 : c.usedExports) && satisfy(_, d))
931
931
  return {
932
932
  shared: T,
933
933
  useTreesShaking: S
@@ -970,17 +970,17 @@ function getTargetSharedOptions(r) {
970
970
  );
971
971
  });
972
972
  return l[y];
973
- }, i = (n == null ? void 0 : n.resolver) ?? s, c = (u) => u !== null && typeof u == "object" && !Array.isArray(u), a = (...u) => {
973
+ }, i = (n == null ? void 0 : n.resolver) ?? s, a = (u) => u !== null && typeof u == "object" && !Array.isArray(u), c = (...u) => {
974
974
  const l = {};
975
975
  for (const d of u)
976
976
  if (d)
977
977
  for (const [y, p] of Object.entries(d)) {
978
978
  const m = l[y];
979
- c(m) && c(p) ? l[y] = a(m, p) : p !== void 0 && (l[y] = p);
979
+ a(m) && a(p) ? l[y] = c(m, p) : p !== void 0 && (l[y] = p);
980
980
  }
981
981
  return l;
982
982
  };
983
- return a(i(o[t]), n == null ? void 0 : n.customShareInfo);
983
+ return c(i(o[t]), n == null ? void 0 : n.customShareInfo);
984
984
  }
985
985
  const addUseIn = (r, t) => {
986
986
  r.useIn || (r.useIn = []), addUniqueItem(r.useIn, t);
@@ -1000,9 +1000,9 @@ function matchRemoteWithNameAndExpose(r, t) {
1000
1000
  let s = t.replace(n.name, "");
1001
1001
  if (o) {
1002
1002
  if (s.startsWith("/")) {
1003
- const a = n.name;
1003
+ const c = n.name;
1004
1004
  return s = `.${s}`, {
1005
- pkgNameOrAlias: a,
1005
+ pkgNameOrAlias: c,
1006
1006
  expose: s,
1007
1007
  remote: n
1008
1008
  };
@@ -1014,16 +1014,16 @@ function matchRemoteWithNameAndExpose(r, t) {
1014
1014
  };
1015
1015
  }
1016
1016
  const i = n.alias && t.startsWith(n.alias);
1017
- let c = n.alias && t.replace(n.alias, "");
1017
+ let a = n.alias && t.replace(n.alias, "");
1018
1018
  if (n.alias && i) {
1019
- if (c && c.startsWith("/")) {
1020
- const a = n.alias;
1021
- return c = `.${c}`, {
1022
- pkgNameOrAlias: a,
1023
- expose: c,
1019
+ if (a && a.startsWith("/")) {
1020
+ const c = n.alias;
1021
+ return a = `.${a}`, {
1022
+ pkgNameOrAlias: c,
1023
+ expose: a,
1024
1024
  remote: n
1025
1025
  };
1026
- } else if (c === "")
1026
+ } else if (a === "")
1027
1027
  return {
1028
1028
  pkgNameOrAlias: n.alias,
1029
1029
  expose: ".",
@@ -1092,24 +1092,24 @@ async function loadEntryScript({ name: r, globalName: t, entry: n, loaderHook: o
1092
1092
  const { entryExports: i } = getRemoteEntryExports(r, t);
1093
1093
  if (i)
1094
1094
  return i;
1095
- const c = s ? s(n) : n;
1096
- return loadScript(c, {
1095
+ const a = s ? s(n) : n;
1096
+ return loadScript(a, {
1097
1097
  attrs: {},
1098
- createScriptHook: (a, u) => {
1099
- const l = o.lifecycle.createScript.emit({ url: a, attrs: u });
1098
+ createScriptHook: (c, u) => {
1099
+ const l = o.lifecycle.createScript.emit({ url: c, attrs: u });
1100
1100
  if (l && (l instanceof HTMLScriptElement || "script" in l || "timeout" in l))
1101
1101
  return l;
1102
1102
  }
1103
- }).then(() => handleRemoteEntryLoaded(r, t, n)).catch((a) => {
1103
+ }).then(() => handleRemoteEntryLoaded(r, t, n)).catch((c) => {
1104
1104
  throw assert(void 0, getShortErrorMsg(RUNTIME_008, runtimeDescMap, {
1105
1105
  remoteName: r,
1106
1106
  resourceUrl: n
1107
- })), a;
1107
+ })), c;
1108
1108
  });
1109
1109
  }
1110
1110
  async function loadEntryDom({ remoteInfo: r, remoteEntryExports: t, loaderHook: n, getEntryUrl: o }) {
1111
- const { entry: s, entryGlobalName: i, name: c, type: a } = r;
1112
- switch (a) {
1111
+ const { entry: s, entryGlobalName: i, name: a, type: c } = r;
1112
+ switch (c) {
1113
1113
  case "esm":
1114
1114
  case "module":
1115
1115
  return loadEsmEntry({ entry: s, remoteEntryExports: t });
@@ -1119,25 +1119,25 @@ async function loadEntryDom({ remoteInfo: r, remoteEntryExports: t, loaderHook:
1119
1119
  return loadEntryScript({
1120
1120
  entry: s,
1121
1121
  globalName: i,
1122
- name: c,
1122
+ name: a,
1123
1123
  loaderHook: n,
1124
1124
  getEntryUrl: o
1125
1125
  });
1126
1126
  }
1127
1127
  }
1128
1128
  async function loadEntryNode({ remoteInfo: r, loaderHook: t }) {
1129
- const { entry: n, entryGlobalName: o, name: s, type: i } = r, { entryExports: c } = getRemoteEntryExports(s, o);
1130
- return c || loadScriptNode(n, {
1129
+ const { entry: n, entryGlobalName: o, name: s, type: i } = r, { entryExports: a } = getRemoteEntryExports(s, o);
1130
+ return a || loadScriptNode(n, {
1131
1131
  attrs: { name: s, globalName: o, type: i },
1132
1132
  loaderHook: {
1133
- createScriptHook: (a, u = {}) => {
1134
- const l = t.lifecycle.createScript.emit({ url: a, attrs: u });
1133
+ createScriptHook: (c, u = {}) => {
1134
+ const l = t.lifecycle.createScript.emit({ url: c, attrs: u });
1135
1135
  if (l && "url" in l)
1136
1136
  return l;
1137
1137
  }
1138
1138
  }
1139
- }).then(() => handleRemoteEntryLoaded(s, o, n)).catch((a) => {
1140
- throw a;
1139
+ }).then(() => handleRemoteEntryLoaded(s, o, n)).catch((c) => {
1140
+ throw c;
1141
1141
  });
1142
1142
  }
1143
1143
  function getRemoteEntryUniqueKey(r) {
@@ -1145,12 +1145,12 @@ function getRemoteEntryUniqueKey(r) {
1145
1145
  return composeKeyWithSeparator(n, t);
1146
1146
  }
1147
1147
  async function getRemoteEntry(r) {
1148
- const { origin: t, remoteEntryExports: n, remoteInfo: o, getEntryUrl: s, _inErrorHandling: i = !1 } = r, c = getRemoteEntryUniqueKey(o);
1148
+ const { origin: t, remoteEntryExports: n, remoteInfo: o, getEntryUrl: s, _inErrorHandling: i = !1 } = r, a = getRemoteEntryUniqueKey(o);
1149
1149
  if (n)
1150
1150
  return n;
1151
- if (!globalLoading[c]) {
1152
- const a = t.remoteHandler.hooks.lifecycle.loadEntry, u = t.loaderHook;
1153
- globalLoading[c] = a.emit({
1151
+ if (!globalLoading[a]) {
1152
+ const c = t.remoteHandler.hooks.lifecycle.loadEntry, u = t.loaderHook;
1153
+ globalLoading[a] = c.emit({
1154
1154
  loaderHook: u,
1155
1155
  remoteInfo: o,
1156
1156
  remoteEntryExports: n
@@ -1176,7 +1176,7 @@ async function getRemoteEntry(r) {
1176
1176
  throw l;
1177
1177
  });
1178
1178
  }
1179
- return globalLoading[c];
1179
+ return globalLoading[a];
1180
1180
  }
1181
1181
  function getRemoteInfo(r) {
1182
1182
  return {
@@ -1212,10 +1212,10 @@ function normalizePreloadExposes(r) {
1212
1212
  return r ? r.map((t) => t === "." ? t : t.startsWith("./") ? t.replace("./", "") : t) : [];
1213
1213
  }
1214
1214
  function preloadAssets(r, t, n, o = !0) {
1215
- const { cssAssets: s, jsAssetsWithoutEntry: i, entryAssets: c } = n;
1215
+ const { cssAssets: s, jsAssetsWithoutEntry: i, entryAssets: a } = n;
1216
1216
  if (t.options.inBrowser) {
1217
- if (c.forEach((a) => {
1218
- const { moduleInfo: u } = a, l = t.moduleCache.get(r.name);
1217
+ if (a.forEach((c) => {
1218
+ const { moduleInfo: u } = c, l = t.moduleCache.get(r.name);
1219
1219
  getRemoteEntry(l ? {
1220
1220
  origin: t,
1221
1221
  remoteInfo: u,
@@ -1226,7 +1226,7 @@ function preloadAssets(r, t, n, o = !0) {
1226
1226
  remoteEntryExports: void 0
1227
1227
  });
1228
1228
  }), o) {
1229
- const a = {
1229
+ const c = {
1230
1230
  rel: "preload",
1231
1231
  as: "style"
1232
1232
  };
@@ -1235,7 +1235,7 @@ function preloadAssets(r, t, n, o = !0) {
1235
1235
  url: u,
1236
1236
  cb: () => {
1237
1237
  },
1238
- attrs: a,
1238
+ attrs: c,
1239
1239
  createLinkHook: (y, p) => {
1240
1240
  const m = t.loaderHook.lifecycle.createLink.emit({
1241
1241
  url: y,
@@ -1248,7 +1248,7 @@ function preloadAssets(r, t, n, o = !0) {
1248
1248
  d && document.head.appendChild(l);
1249
1249
  });
1250
1250
  } else {
1251
- const a = {
1251
+ const c = {
1252
1252
  rel: "stylesheet",
1253
1253
  type: "text/css"
1254
1254
  };
@@ -1257,7 +1257,7 @@ function preloadAssets(r, t, n, o = !0) {
1257
1257
  url: u,
1258
1258
  cb: () => {
1259
1259
  },
1260
- attrs: a,
1260
+ attrs: c,
1261
1261
  createLinkHook: (y, p) => {
1262
1262
  const m = t.loaderHook.lifecycle.createLink.emit({
1263
1263
  url: y,
@@ -1272,7 +1272,7 @@ function preloadAssets(r, t, n, o = !0) {
1272
1272
  });
1273
1273
  }
1274
1274
  if (o) {
1275
- const a = {
1275
+ const c = {
1276
1276
  rel: "preload",
1277
1277
  as: "script"
1278
1278
  };
@@ -1281,7 +1281,7 @@ function preloadAssets(r, t, n, o = !0) {
1281
1281
  url: u,
1282
1282
  cb: () => {
1283
1283
  },
1284
- attrs: a,
1284
+ attrs: c,
1285
1285
  createLinkHook: (y, p) => {
1286
1286
  const m = t.loaderHook.lifecycle.createLink.emit({
1287
1287
  url: y,
@@ -1294,7 +1294,7 @@ function preloadAssets(r, t, n, o = !0) {
1294
1294
  d && document.head.appendChild(l);
1295
1295
  });
1296
1296
  } else {
1297
- const a = {
1297
+ const c = {
1298
1298
  fetchpriority: "high",
1299
1299
  type: (r == null ? void 0 : r.type) === "module" ? "module" : "text/javascript"
1300
1300
  };
@@ -1303,7 +1303,7 @@ function preloadAssets(r, t, n, o = !0) {
1303
1303
  url: u,
1304
1304
  cb: () => {
1305
1305
  },
1306
- attrs: a,
1306
+ attrs: c,
1307
1307
  createScriptHook: (y, p) => {
1308
1308
  const m = t.loaderHook.lifecycle.createScript.emit({
1309
1309
  url: y,
@@ -1321,8 +1321,8 @@ function preloadAssets(r, t, n, o = !0) {
1321
1321
  }
1322
1322
  function createRemoteEntryInitOptions(r, t) {
1323
1323
  const n = t, o = Array.isArray(r.shareScope) ? r.shareScope : [r.shareScope];
1324
- o.length || o.push("default"), o.forEach((a) => {
1325
- n[a] || (n[a] = {});
1324
+ o.length || o.push("default"), o.forEach((c) => {
1325
+ n[c] || (n[c] = {});
1326
1326
  });
1327
1327
  const s = {
1328
1328
  version: r.version || "",
@@ -1358,13 +1358,16 @@ class Module {
1358
1358
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1359
1359
  async init(t, n) {
1360
1360
  const o = await this.getEntry();
1361
- if (!this.inited && !this.initing) {
1362
- this.initing = !0;
1363
- const { remoteEntryInitOptions: s, shareScope: i, initScope: c } = createRemoteEntryInitOptions(this.remoteInfo, this.host.shareScopeMap), a = await this.host.hooks.lifecycle.beforeInitContainer.emit({
1361
+ if (this.inited)
1362
+ return o;
1363
+ if (this.initPromise)
1364
+ return await this.initPromise, o;
1365
+ this.initing = !0, this.initPromise = (async () => {
1366
+ const { remoteEntryInitOptions: s, shareScope: i, initScope: a } = createRemoteEntryInitOptions(this.remoteInfo, this.host.shareScopeMap), c = await this.host.hooks.lifecycle.beforeInitContainer.emit({
1364
1367
  shareScope: i,
1365
1368
  // @ts-ignore shareScopeMap will be set by Object.defineProperty
1366
1369
  remoteEntryInitOptions: s,
1367
- initScope: c,
1370
+ initScope: a,
1368
1371
  remoteInfo: this.remoteInfo,
1369
1372
  origin: this.host
1370
1373
  });
@@ -1373,26 +1376,31 @@ class Module {
1373
1376
  remoteName: this.remoteInfo.name,
1374
1377
  remoteEntryUrl: this.remoteInfo.entry,
1375
1378
  remoteEntryKey: this.remoteInfo.entryGlobalName
1376
- })), await o.init(a.shareScope, a.initScope, a.remoteEntryInitOptions), await this.host.hooks.lifecycle.initContainer.emit({
1377
- ...a,
1379
+ })), await o.init(c.shareScope, c.initScope, c.remoteEntryInitOptions), await this.host.hooks.lifecycle.initContainer.emit({
1380
+ ...c,
1378
1381
  id: t,
1379
1382
  remoteSnapshot: n,
1380
1383
  remoteEntryExports: o
1381
1384
  }), this.inited = !0;
1385
+ })();
1386
+ try {
1387
+ await this.initPromise;
1388
+ } finally {
1389
+ this.initing = !1, this.initPromise = void 0;
1382
1390
  }
1383
1391
  return o;
1384
1392
  }
1385
1393
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1386
1394
  async get(t, n, o, s) {
1387
- const { loadFactory: i = !0 } = o || { loadFactory: !0 }, c = await this.init(t, s);
1388
- this.lib = c;
1389
- let a;
1390
- a = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
1391
- remoteEntryExports: c,
1395
+ const { loadFactory: i = !0 } = o || { loadFactory: !0 }, a = await this.init(t, s);
1396
+ this.lib = a;
1397
+ let c;
1398
+ c = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
1399
+ remoteEntryExports: a,
1392
1400
  expose: n,
1393
1401
  moduleInfo: this.remoteInfo
1394
- }), a || (a = await c.get(n)), assert(a, `${getFMId(this.remoteInfo)} remote don't export ${n}.`);
1395
- const u = processModuleAlias(this.remoteInfo.name, n), l = this.wraperFactory(a, u);
1402
+ }), c || (c = await a.get(n)), assert(c, `${getFMId(this.remoteInfo)} remote don't export ${n}.`);
1403
+ const u = processModuleAlias(this.remoteInfo.name, n), l = this.wraperFactory(c, u);
1396
1404
  return i ? await l() : l;
1397
1405
  }
1398
1406
  wraperFactory(t, n) {
@@ -1443,7 +1451,7 @@ class AsyncHook extends SyncHook {
1443
1451
  const o = Array.from(this.listeners);
1444
1452
  if (o.length > 0) {
1445
1453
  let s = 0;
1446
- const i = (c) => c === !1 ? !1 : s < o.length ? Promise.resolve(o[s++].apply(null, t)).then(i) : c;
1454
+ const i = (a) => a === !1 ? !1 : s < o.length ? Promise.resolve(o[s++].apply(null, t)).then(i) : a;
1447
1455
  n = i();
1448
1456
  }
1449
1457
  return Promise.resolve(n);
@@ -1489,13 +1497,13 @@ class AsyncWaterfallHook extends SyncHook {
1489
1497
  const n = Array.from(this.listeners);
1490
1498
  if (n.length > 0) {
1491
1499
  let o = 0;
1492
- const s = (c) => (warn(c), this.onerror(c), t), i = (c) => {
1493
- if (checkReturnData(t, c)) {
1494
- if (t = c, o < n.length)
1500
+ const s = (a) => (warn(a), this.onerror(a), t), i = (a) => {
1501
+ if (checkReturnData(t, a)) {
1502
+ if (t = a, o < n.length)
1495
1503
  try {
1496
1504
  return Promise.resolve(n[o++](t)).then(i, s);
1497
- } catch (a) {
1498
- return s(a);
1505
+ } catch (c) {
1506
+ return s(c);
1499
1507
  }
1500
1508
  } else
1501
1509
  this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
@@ -1515,8 +1523,8 @@ class PluginSystem {
1515
1523
  assert(isPlainObject(t), "Plugin configuration is invalid.");
1516
1524
  const o = t.name;
1517
1525
  assert(o, "A name must be provided by the plugin."), this.registerPlugins[o] || (this.registerPlugins[o] = t, (s = t.apply) == null || s.call(t, n), Object.keys(this.lifecycle).forEach((i) => {
1518
- const c = t[i];
1519
- c && this.lifecycle[i].on(c);
1526
+ const a = t[i];
1527
+ a && this.lifecycle[i].on(a);
1520
1528
  }));
1521
1529
  }
1522
1530
  removePlugin(t) {
@@ -1537,13 +1545,13 @@ function snapshotPlugin() {
1537
1545
  return {
1538
1546
  name: "snapshot-plugin",
1539
1547
  async afterResolve(r) {
1540
- const { remote: t, pkgNameOrAlias: n, expose: o, origin: s, remoteInfo: i, id: c } = r;
1548
+ const { remote: t, pkgNameOrAlias: n, expose: o, origin: s, remoteInfo: i, id: a } = r;
1541
1549
  if (!isRemoteInfoWithEntry(t) || !isPureRemoteEntry(t)) {
1542
- const { remoteSnapshot: a, globalSnapshot: u } = await s.snapshotHandler.loadRemoteSnapshotInfo({
1550
+ const { remoteSnapshot: c, globalSnapshot: u } = await s.snapshotHandler.loadRemoteSnapshotInfo({
1543
1551
  moduleInfo: t,
1544
- id: c
1552
+ id: a
1545
1553
  });
1546
- assignRemoteInfo(i, a);
1554
+ assignRemoteInfo(i, c);
1547
1555
  const l = {
1548
1556
  remote: t,
1549
1557
  preloadConfig: {
@@ -1558,12 +1566,12 @@ function snapshotPlugin() {
1558
1566
  preloadOptions: l,
1559
1567
  remoteInfo: i,
1560
1568
  remote: t,
1561
- remoteSnapshot: a,
1569
+ remoteSnapshot: c,
1562
1570
  globalSnapshot: u
1563
1571
  });
1564
1572
  return d && preloadAssets(i, s, d, !1), {
1565
1573
  ...r,
1566
- remoteSnapshot: a
1574
+ remoteSnapshot: c
1567
1575
  };
1568
1576
  }
1569
1577
  return r;
@@ -1584,7 +1592,7 @@ function splitId(r) {
1584
1592
  };
1585
1593
  }
1586
1594
  function traverseModuleInfo(r, t, n, o, s = {}, i) {
1587
- const c = getFMId(t), { value: a } = getInfoWithoutType(r, c), u = i || a;
1595
+ const a = getFMId(t), { value: c } = getInfoWithoutType(r, a), u = i || c;
1588
1596
  if (u && !isManifestProvider(u) && (n(u, t, o), u.remotesInfo)) {
1589
1597
  const l = Object.keys(u.remotesInfo);
1590
1598
  for (const d of l) {
@@ -1601,7 +1609,7 @@ function traverseModuleInfo(r, t, n, o, s = {}, i) {
1601
1609
  }
1602
1610
  const isExisted = (r, t) => document.querySelector(`${r}[${r === "link" ? "href" : "src"}="${t}"]`);
1603
1611
  function generatePreloadAssets(r, t, n, o, s) {
1604
- const i = [], c = [], a = [], u = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), { options: d } = r, { preloadConfig: y } = t, { depsRemote: p } = y;
1612
+ const i = [], a = [], c = [], u = /* @__PURE__ */ new Set(), l = /* @__PURE__ */ new Set(), { options: d } = r, { preloadConfig: y } = t, { depsRemote: p } = y;
1605
1613
  if (traverseModuleInfo(o, n, (E, R, S) => {
1606
1614
  var k;
1607
1615
  let _;
@@ -1617,7 +1625,7 @@ function generatePreloadAssets(r, t, n, o, s) {
1617
1625
  else
1618
1626
  return;
1619
1627
  const T = getResourceUrl(E, getRemoteEntryInfoFromSnapshot(E).url);
1620
- T && a.push({
1628
+ T && c.push({
1621
1629
  name: R.name,
1622
1630
  moduleInfo: {
1623
1631
  name: R.name,
@@ -1630,9 +1638,9 @@ function generatePreloadAssets(r, t, n, o, s) {
1630
1638
  url: T
1631
1639
  });
1632
1640
  let I = "modules" in E ? E.modules : [];
1633
- const A = normalizePreloadExposes(_.exposes);
1634
- A.length && "modules" in E && (I = (k = E == null ? void 0 : E.modules) == null ? void 0 : k.reduce((N, $) => ((A == null ? void 0 : A.indexOf($.moduleName)) !== -1 && N.push($), N), []));
1635
- function w(N) {
1641
+ const w = normalizePreloadExposes(_.exposes);
1642
+ w.length && "modules" in E && (I = (k = E == null ? void 0 : E.modules) == null ? void 0 : k.reduce((N, $) => ((w == null ? void 0 : w.indexOf($.moduleName)) !== -1 && N.push($), N), []));
1643
+ function A(N) {
1636
1644
  const $ = N.map((L) => getResourceUrl(E, L));
1637
1645
  return _.filter ? $.filter(_.filter) : $;
1638
1646
  }
@@ -1647,7 +1655,7 @@ function generatePreloadAssets(r, t, n, o, s) {
1647
1655
  preloadConfig: _,
1648
1656
  remote: R,
1649
1657
  origin: r
1650
- }), !getPreloaded(P) && (_.resourceCategory === "all" ? (i.push(...w(L.assets.css.async)), i.push(...w(L.assets.css.sync)), c.push(...w(L.assets.js.async)), c.push(...w(L.assets.js.sync))) : (_.resourceCategory = "sync") && (i.push(...w(L.assets.css.sync)), c.push(...w(L.assets.js.sync))), setPreloaded(P));
1658
+ }), !getPreloaded(P) && (_.resourceCategory === "all" ? (i.push(...A(L.assets.css.async)), i.push(...A(L.assets.css.sync)), a.push(...A(L.assets.js.async)), a.push(...A(L.assets.js.sync))) : (_.resourceCategory = "sync") && (i.push(...A(L.assets.css.sync)), a.push(...A(L.assets.js.sync))), setPreloaded(P));
1651
1659
  }
1652
1660
  }
1653
1661
  }, !0, {}, s), s.shared && s.shared.length > 0) {
@@ -1664,26 +1672,26 @@ function generatePreloadAssets(r, t, n, o, s) {
1664
1672
  const S = (I = d.shared) == null ? void 0 : I[R.sharedName];
1665
1673
  if (!S)
1666
1674
  return;
1667
- const _ = R.version ? S.find((A) => A.version === R.version) : S;
1675
+ const _ = R.version ? S.find((w) => w.version === R.version) : S;
1668
1676
  if (!_)
1669
1677
  return;
1670
- arrayOptions(_).forEach((A) => {
1671
- E(A, R);
1678
+ arrayOptions(_).forEach((w) => {
1679
+ E(w, R);
1672
1680
  });
1673
1681
  });
1674
1682
  }
1675
- const g = c.filter((E) => !u.has(E) && !isExisted("script", E));
1683
+ const g = a.filter((E) => !u.has(E) && !isExisted("script", E));
1676
1684
  return {
1677
1685
  cssAssets: i.filter((E) => !l.has(E) && !isExisted("link", E)),
1678
1686
  jsAssetsWithoutEntry: g,
1679
- entryAssets: a.filter((E) => !isExisted("script", E.url))
1687
+ entryAssets: c.filter((E) => !isExisted("script", E.url))
1680
1688
  };
1681
1689
  }
1682
1690
  const generatePreloadAssetsPlugin = function() {
1683
1691
  return {
1684
1692
  name: "generate-preload-assets-plugin",
1685
1693
  async generatePreloadAssets(r) {
1686
- const { origin: t, preloadOptions: n, remoteInfo: o, remote: s, globalSnapshot: i, remoteSnapshot: c } = r;
1694
+ const { origin: t, preloadOptions: n, remoteInfo: o, remote: s, globalSnapshot: i, remoteSnapshot: a } = r;
1687
1695
  return isBrowserEnv() ? isRemoteInfoWithEntry(s) && isPureRemoteEntry(s) ? {
1688
1696
  cssAssets: [],
1689
1697
  jsAssetsWithoutEntry: [],
@@ -1700,7 +1708,7 @@ const generatePreloadAssetsPlugin = function() {
1700
1708
  }
1701
1709
  }
1702
1710
  ]
1703
- } : (assignRemoteInfo(o, c), generatePreloadAssets(t, n, o, i, c)) : {
1711
+ } : (assignRemoteInfo(o, a), generatePreloadAssets(t, n, o, i, a)) : {
1704
1712
  cssAssets: [],
1705
1713
  jsAssetsWithoutEntry: [],
1706
1714
  entryAssets: []
@@ -1761,11 +1769,11 @@ class SnapshotHandler {
1761
1769
  matchedVersion: "version" in t ? t.version : t.entry
1762
1770
  }
1763
1771
  });
1764
- const { hostGlobalSnapshot: c, remoteSnapshot: a, globalSnapshot: u } = this.getGlobalRemoteInfo(t), { remoteSnapshot: l, globalSnapshot: d } = await this.hooks.lifecycle.loadSnapshot.emit({
1772
+ const { hostGlobalSnapshot: a, remoteSnapshot: c, globalSnapshot: u } = this.getGlobalRemoteInfo(t), { remoteSnapshot: l, globalSnapshot: d } = await this.hooks.lifecycle.loadSnapshot.emit({
1765
1773
  options: s,
1766
1774
  moduleInfo: t,
1767
- hostGlobalSnapshot: c,
1768
- remoteSnapshot: a,
1775
+ hostGlobalSnapshot: a,
1776
+ remoteSnapshot: c,
1769
1777
  globalSnapshot: u
1770
1778
  });
1771
1779
  let y, p;
@@ -1817,40 +1825,40 @@ class SnapshotHandler {
1817
1825
  }
1818
1826
  async getManifestJson(t, n, o) {
1819
1827
  const s = async () => {
1820
- let c = this.manifestCache.get(t);
1821
- if (c)
1822
- return c;
1828
+ let a = this.manifestCache.get(t);
1829
+ if (a)
1830
+ return a;
1823
1831
  try {
1824
- let a = await this.loaderHook.lifecycle.fetch.emit(t, {});
1825
- (!a || !(a instanceof Response)) && (a = await fetch(t, {})), c = await a.json();
1826
- } catch (a) {
1827
- c = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
1832
+ let c = await this.loaderHook.lifecycle.fetch.emit(t, {});
1833
+ (!c || !(c instanceof Response)) && (c = await fetch(t, {})), a = await c.json();
1834
+ } catch (c) {
1835
+ a = await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
1828
1836
  id: t,
1829
- error: a,
1837
+ error: c,
1830
1838
  from: "runtime",
1831
1839
  lifecycle: "afterResolve",
1832
1840
  origin: this.HostInstance
1833
- }), c || (delete this.manifestLoading[t], error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
1841
+ }), a || (delete this.manifestLoading[t], error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
1834
1842
  manifestUrl: t,
1835
1843
  moduleName: n.name,
1836
1844
  hostName: this.HostInstance.options.name
1837
- }, `${a}`)));
1845
+ }, `${c}`)));
1838
1846
  }
1839
- return assert(c.metaData && c.exposes && c.shared, `${t} is not a federation manifest`), this.manifestCache.set(t, c), c;
1847
+ return assert(a.metaData && a.exposes && a.shared, `${t} is not a federation manifest`), this.manifestCache.set(t, a), a;
1840
1848
  }, i = async () => {
1841
- const c = await s(), a = generateSnapshotFromManifest(c, {
1849
+ const a = await s(), c = generateSnapshotFromManifest(a, {
1842
1850
  version: t
1843
1851
  }), { remoteSnapshot: u } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1844
1852
  options: this.HostInstance.options,
1845
1853
  moduleInfo: n,
1846
- manifestJson: c,
1847
- remoteSnapshot: a,
1854
+ manifestJson: a,
1855
+ remoteSnapshot: c,
1848
1856
  manifestUrl: t,
1849
1857
  from: "manifest"
1850
1858
  });
1851
1859
  return u;
1852
1860
  };
1853
- return this.manifestLoading[t] || (this.manifestLoading[t] = i().then((c) => c)), this.manifestLoading[t];
1861
+ return this.manifestLoading[t] || (this.manifestLoading[t] = i().then((a) => a)), this.manifestLoading[t];
1854
1862
  }
1855
1863
  }
1856
1864
  class SharedHandler {
@@ -1869,16 +1877,16 @@ class SharedHandler {
1869
1877
  // register shared in shareScopeMap
1870
1878
  registerShared(t, n) {
1871
1879
  const { newShareInfos: o, allShareInfos: s } = formatShareConfigs(t, n);
1872
- return Object.keys(o).forEach((c) => {
1873
- o[c].forEach((u) => {
1880
+ return Object.keys(o).forEach((a) => {
1881
+ o[a].forEach((u) => {
1874
1882
  u.scope.forEach((l) => {
1875
1883
  var y;
1876
1884
  this.hooks.lifecycle.beforeRegisterShare.emit({
1877
1885
  origin: this.host,
1878
- pkgName: c,
1886
+ pkgName: a,
1879
1887
  shared: u
1880
- }), ((y = this.shareScopeMap[l]) == null ? void 0 : y[c]) || this.setShared({
1881
- pkgName: c,
1888
+ }), ((y = this.shareScopeMap[l]) == null ? void 0 : y[a]) || this.setShared({
1889
+ pkgName: a,
1882
1890
  lib: u.lib,
1883
1891
  get: u.get,
1884
1892
  loaded: u.loaded || !!u.lib,
@@ -1908,11 +1916,11 @@ class SharedHandler {
1908
1916
  shareInfo: s,
1909
1917
  shared: o.options.shared,
1910
1918
  origin: o
1911
- }), { shareInfo: c } = i;
1912
- assert(c, `Cannot find ${t} Share in the ${o.options.name}. Please ensure that the ${t} Share parameters have been injected`);
1913
- const { shared: a, useTreesShaking: u } = getRegisteredShare(this.shareScopeMap, t, c, this.hooks.lifecycle.resolveShare) || {};
1914
- if (a) {
1915
- const l = directShare(a, u);
1919
+ }), { shareInfo: a } = i;
1920
+ assert(a, `Cannot find ${t} Share in the ${o.options.name}. Please ensure that the ${t} Share parameters have been injected`);
1921
+ const { shared: c, useTreesShaking: u } = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare) || {};
1922
+ if (c) {
1923
+ const l = directShare(c, u);
1916
1924
  if (l.lib)
1917
1925
  return addUseIn(l, o.options.name), l.lib;
1918
1926
  if (l.loading && !l.loaded) {
@@ -1926,7 +1934,7 @@ class SharedHandler {
1926
1934
  return this.setShared({
1927
1935
  pkgName: t,
1928
1936
  loaded: !1,
1929
- shared: a,
1937
+ shared: c,
1930
1938
  from: o.options.name,
1931
1939
  lib: null,
1932
1940
  loading: y,
@@ -1936,20 +1944,20 @@ class SharedHandler {
1936
1944
  } else {
1937
1945
  if (n != null && n.customShareInfo)
1938
1946
  return !1;
1939
- const l = shouldUseTreeShaking(c.treeShaking), d = directShare(c, l), p = (async () => {
1947
+ const l = shouldUseTreeShaking(a.treeShaking), d = directShare(a, l), p = (async () => {
1940
1948
  const m = await d.get();
1941
1949
  d.lib = m, d.loaded = !0, addUseIn(d, o.options.name);
1942
- const { shared: g, useTreesShaking: b } = getRegisteredShare(this.shareScopeMap, t, c, this.hooks.lifecycle.resolveShare) || {};
1950
+ const { shared: g, useTreesShaking: b } = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare) || {};
1943
1951
  if (g) {
1944
1952
  const E = directShare(g, b);
1945
- E.lib = m, E.loaded = !0, g.from = c.from;
1953
+ E.lib = m, E.loaded = !0, g.from = a.from;
1946
1954
  }
1947
1955
  return m;
1948
1956
  })();
1949
1957
  return this.setShared({
1950
1958
  pkgName: t,
1951
1959
  loaded: !1,
1952
- shared: c,
1960
+ shared: a,
1953
1961
  from: o.options.name,
1954
1962
  lib: null,
1955
1963
  loading: p,
@@ -1965,15 +1973,15 @@ class SharedHandler {
1965
1973
  // eslint-disable-next-line @typescript-eslint/member-ordering
1966
1974
  initializeSharing(t = DEFAULT_SCOPE, n) {
1967
1975
  const { host: o } = this, s = n == null ? void 0 : n.from, i = n == null ? void 0 : n.strategy;
1968
- let c = n == null ? void 0 : n.initScope;
1969
- const a = [];
1976
+ let a = n == null ? void 0 : n.initScope;
1977
+ const c = [];
1970
1978
  if (s !== "build") {
1971
1979
  const { initTokens: m } = this;
1972
- c || (c = []);
1980
+ a || (a = []);
1973
1981
  let g = m[t];
1974
- if (g || (g = m[t] = { from: this.host.name }), c.indexOf(g) >= 0)
1975
- return a;
1976
- c.push(g);
1982
+ if (g || (g = m[t] = { from: this.host.name }), a.indexOf(g) >= 0)
1983
+ return c;
1984
+ a.push(g);
1977
1985
  }
1978
1986
  const u = this.shareScopeMap, l = o.options.name;
1979
1987
  u[t] || (u[t] = {});
@@ -2007,8 +2015,8 @@ class SharedHandler {
2007
2015
  b.scope.includes(t) && y(m, b);
2008
2016
  });
2009
2017
  }), (o.options.shareStrategy === "version-first" || i === "version-first") && o.options.remotes.forEach((m) => {
2010
- m.shareScope === t && a.push(p(m.name));
2011
- }), a;
2018
+ m.shareScope === t && c.push(p(m.name));
2019
+ }), c;
2012
2020
  }
2013
2021
  // The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
2014
2022
  // 1. If the loaded shared already exists globally, then it will be reused
@@ -2020,37 +2028,37 @@ class SharedHandler {
2020
2028
  extraOptions: n,
2021
2029
  shareInfos: o.options.shared
2022
2030
  });
2023
- s != null && s.scope && s.scope.forEach((a) => {
2024
- this.initializeSharing(a, { strategy: s.strategy });
2031
+ s != null && s.scope && s.scope.forEach((c) => {
2032
+ this.initializeSharing(c, { strategy: s.strategy });
2025
2033
  });
2026
- const { shared: i, useTreesShaking: c } = getRegisteredShare(this.shareScopeMap, t, s, this.hooks.lifecycle.resolveShare) || {};
2034
+ const { shared: i, useTreesShaking: a } = getRegisteredShare(this.shareScopeMap, t, s, this.hooks.lifecycle.resolveShare) || {};
2027
2035
  if (i) {
2028
2036
  if (typeof i.lib == "function")
2029
2037
  return addUseIn(i, o.options.name), i.loaded || (i.loaded = !0, i.from === o.options.name && (s.loaded = !0)), i.lib;
2030
2038
  if (typeof i.get == "function") {
2031
- const a = i.get();
2032
- if (!(a instanceof Promise))
2039
+ const c = i.get();
2040
+ if (!(c instanceof Promise))
2033
2041
  return addUseIn(i, o.options.name), this.setShared({
2034
2042
  pkgName: t,
2035
2043
  loaded: !0,
2036
2044
  from: o.options.name,
2037
- lib: a,
2045
+ lib: c,
2038
2046
  shared: i
2039
- }), a;
2047
+ }), c;
2040
2048
  }
2041
2049
  }
2042
2050
  if (s.lib)
2043
2051
  return s.loaded || (s.loaded = !0), s.lib;
2044
2052
  if (s.get) {
2045
- const a = s.get();
2046
- if (a instanceof Promise) {
2053
+ const c = s.get();
2054
+ if (c instanceof Promise) {
2047
2055
  const u = (n == null ? void 0 : n.from) === "build" ? RUNTIME_005 : RUNTIME_006;
2048
2056
  throw new Error(getShortErrorMsg(u, runtimeDescMap, {
2049
2057
  hostName: o.options.name,
2050
2058
  sharedPkgName: t
2051
2059
  }));
2052
2060
  }
2053
- return s.lib = a, this.setShared({
2061
+ return s.lib = c, this.setShared({
2054
2062
  pkgName: t,
2055
2063
  loaded: !0,
2056
2064
  from: o.options.name,
@@ -2073,12 +2081,12 @@ class SharedHandler {
2073
2081
  hostShareScopeMap: o.hostShareScopeMap
2074
2082
  });
2075
2083
  }
2076
- setShared({ pkgName: t, shared: n, from: o, lib: s, loading: i, loaded: c, get: a, treeShaking: u }) {
2084
+ setShared({ pkgName: t, shared: n, from: o, lib: s, loading: i, loaded: a, get: c, treeShaking: u }) {
2077
2085
  const { version: l, scope: d = "default", ...y } = n, p = Array.isArray(d) ? d : [d], m = (g) => {
2078
2086
  const b = (R, S, _) => {
2079
2087
  _ && !R[S] && (R[S] = _);
2080
2088
  }, E = u ? g.treeShaking : g;
2081
- b(E, "loaded", c), b(E, "loading", i), b(E, "get", a);
2089
+ b(E, "loaded", a), b(E, "loading", i), b(E, "get", c);
2082
2090
  };
2083
2091
  p.forEach((g) => {
2084
2092
  this.shareScopeMap[g] || (this.shareScopeMap[g] = {}), this.shareScopeMap[g][t] || (this.shareScopeMap[g][t] = {}), this.shareScopeMap[g][t][l] || (this.shareScopeMap[g][t][l] = {
@@ -2117,15 +2125,15 @@ class RemoteHandler {
2117
2125
  return (n.remotes || []).reduce((s, i) => (this.registerRemote(i, s, { force: !1 }), s), t.remotes);
2118
2126
  }
2119
2127
  setIdToRemoteMap(t, n) {
2120
- const { remote: o, expose: s } = n, { name: i, alias: c } = o;
2121
- if (this.idToRemoteMap[t] = { name: o.name, expose: s }, c && t.startsWith(i)) {
2122
- const a = t.replace(i, c);
2123
- this.idToRemoteMap[a] = { name: o.name, expose: s };
2128
+ const { remote: o, expose: s } = n, { name: i, alias: a } = o;
2129
+ if (this.idToRemoteMap[t] = { name: o.name, expose: s }, a && t.startsWith(i)) {
2130
+ const c = t.replace(i, a);
2131
+ this.idToRemoteMap[c] = { name: o.name, expose: s };
2124
2132
  return;
2125
2133
  }
2126
- if (c && t.startsWith(c)) {
2127
- const a = t.replace(c, i);
2128
- this.idToRemoteMap[a] = { name: o.name, expose: s };
2134
+ if (a && t.startsWith(a)) {
2135
+ const c = t.replace(a, i);
2136
+ this.idToRemoteMap[c] = { name: o.name, expose: s };
2129
2137
  }
2130
2138
  }
2131
2139
  // eslint-disable-next-line max-lines-per-function
@@ -2135,31 +2143,31 @@ class RemoteHandler {
2135
2143
  try {
2136
2144
  const { loadFactory: s = !0 } = n || {
2137
2145
  loadFactory: !0
2138
- }, { module: i, moduleOptions: c, remoteMatchInfo: a } = await this.getRemoteModuleAndOptions({
2146
+ }, { module: i, moduleOptions: a, remoteMatchInfo: c } = await this.getRemoteModuleAndOptions({
2139
2147
  id: t
2140
- }), { pkgNameOrAlias: u, remote: l, expose: d, id: y, remoteSnapshot: p } = a, m = await i.get(y, d, n, p), g = await this.hooks.lifecycle.onLoad.emit({
2148
+ }), { pkgNameOrAlias: u, remote: l, expose: d, id: y, remoteSnapshot: p } = c, m = await i.get(y, d, n, p), g = await this.hooks.lifecycle.onLoad.emit({
2141
2149
  id: y,
2142
2150
  pkgNameOrAlias: u,
2143
2151
  expose: d,
2144
2152
  exposeModule: s ? m : void 0,
2145
2153
  exposeModuleFactory: s ? void 0 : m,
2146
2154
  remote: l,
2147
- options: c,
2155
+ options: a,
2148
2156
  moduleInstance: i,
2149
2157
  origin: o
2150
2158
  });
2151
- return this.setIdToRemoteMap(t, a), typeof g == "function" ? g : m;
2159
+ return this.setIdToRemoteMap(t, c), typeof g == "function" ? g : m;
2152
2160
  } catch (s) {
2153
- const { from: i = "runtime" } = n || { from: "runtime" }, c = await this.hooks.lifecycle.errorLoadRemote.emit({
2161
+ const { from: i = "runtime" } = n || { from: "runtime" }, a = await this.hooks.lifecycle.errorLoadRemote.emit({
2154
2162
  id: t,
2155
2163
  error: s,
2156
2164
  from: i,
2157
2165
  lifecycle: "onLoad",
2158
2166
  origin: o
2159
2167
  });
2160
- if (!c)
2168
+ if (!a)
2161
2169
  throw s;
2162
- return c;
2170
+ return a;
2163
2171
  }
2164
2172
  }
2165
2173
  // eslint-disable-next-line @typescript-eslint/member-ordering
@@ -2172,17 +2180,17 @@ class RemoteHandler {
2172
2180
  });
2173
2181
  const o = formatPreloadArgs(n.options.remotes, t);
2174
2182
  await Promise.all(o.map(async (s) => {
2175
- const { remote: i } = s, c = getRemoteInfo(i), { globalSnapshot: a, remoteSnapshot: u } = await n.snapshotHandler.loadRemoteSnapshotInfo({
2183
+ const { remote: i } = s, a = getRemoteInfo(i), { globalSnapshot: c, remoteSnapshot: u } = await n.snapshotHandler.loadRemoteSnapshotInfo({
2176
2184
  moduleInfo: i
2177
2185
  }), l = await this.hooks.lifecycle.generatePreloadAssets.emit({
2178
2186
  origin: n,
2179
2187
  preloadOptions: s,
2180
2188
  remote: i,
2181
- remoteInfo: c,
2182
- globalSnapshot: a,
2189
+ remoteInfo: a,
2190
+ globalSnapshot: c,
2183
2191
  remoteSnapshot: u
2184
2192
  });
2185
- l && preloadAssets(c, n, l);
2193
+ l && preloadAssets(a, n, l);
2186
2194
  }));
2187
2195
  }
2188
2196
  registerRemotes(t, n) {
@@ -2213,14 +2221,14 @@ class RemoteHandler {
2213
2221
  }), !s)
2214
2222
  throw g;
2215
2223
  }
2216
- const { id: i } = s, c = matchRemoteWithNameAndExpose(n.options.remotes, i);
2217
- assert(c, getShortErrorMsg(RUNTIME_004, runtimeDescMap, {
2224
+ const { id: i } = s, a = matchRemoteWithNameAndExpose(n.options.remotes, i);
2225
+ assert(a, getShortErrorMsg(RUNTIME_004, runtimeDescMap, {
2218
2226
  hostName: n.options.name,
2219
2227
  requestId: i
2220
2228
  }));
2221
- const { remote: a } = c, u = getRemoteInfo(a), l = await n.sharedHandler.hooks.lifecycle.afterResolve.emit({
2229
+ const { remote: c } = a, u = getRemoteInfo(c), l = await n.sharedHandler.hooks.lifecycle.afterResolve.emit({
2222
2230
  id: i,
2223
- ...c,
2231
+ ...a,
2224
2232
  options: n.options,
2225
2233
  origin: n,
2226
2234
  remoteInfo: u
@@ -2240,39 +2248,39 @@ class RemoteHandler {
2240
2248
  registerRemote(t, n, o) {
2241
2249
  const { host: s } = this, i = () => {
2242
2250
  if (t.alias) {
2243
- const a = n.find((u) => {
2251
+ const c = n.find((u) => {
2244
2252
  var l;
2245
2253
  return t.alias && (u.name.startsWith(t.alias) || ((l = u.alias) == null ? void 0 : l.startsWith(t.alias)));
2246
2254
  });
2247
- assert(!a, `The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${a && a.name} name or alias`);
2255
+ assert(!c, `The alias ${t.alias} of remote ${t.name} is not allowed to be the prefix of ${c && c.name} name or alias`);
2248
2256
  }
2249
2257
  "entry" in t && isBrowserEnv() && !t.entry.startsWith("http") && (t.entry = new URL(t.entry, window.location.origin).href), t.shareScope || (t.shareScope = DEFAULT_SCOPE), t.type || (t.type = DEFAULT_REMOTE_TYPE);
2250
2258
  };
2251
2259
  this.hooks.lifecycle.beforeRegisterRemote.emit({ remote: t, origin: s });
2252
- const c = n.find((a) => a.name === t.name);
2253
- if (!c)
2260
+ const a = n.find((c) => c.name === t.name);
2261
+ if (!a)
2254
2262
  i(), n.push(t), this.hooks.lifecycle.registerRemote.emit({ remote: t, origin: s });
2255
2263
  else {
2256
- const a = [
2264
+ const c = [
2257
2265
  `The remote "${t.name}" is already registered.`,
2258
2266
  "Please note that overriding it may cause unexpected errors."
2259
2267
  ];
2260
- o != null && o.force && (this.removeRemote(c), i(), n.push(t), this.hooks.lifecycle.registerRemote.emit({ remote: t, origin: s }), warn$1(a.join(" ")));
2268
+ o != null && o.force && (this.removeRemote(a), i(), n.push(t), this.hooks.lifecycle.registerRemote.emit({ remote: t, origin: s }), warn$1(c.join(" ")));
2261
2269
  }
2262
2270
  }
2263
2271
  removeRemote(t) {
2264
2272
  var n;
2265
2273
  try {
2266
- const { host: o } = this, { name: s } = t, i = o.options.remotes.findIndex((a) => a.name === s);
2274
+ const { host: o } = this, { name: s } = t, i = o.options.remotes.findIndex((c) => c.name === s);
2267
2275
  i !== -1 && o.options.remotes.splice(i, 1);
2268
- const c = o.moduleCache.get(t.name);
2269
- if (c) {
2270
- const a = c.remoteInfo, u = a.entryGlobalName;
2276
+ const a = o.moduleCache.get(t.name);
2277
+ if (a) {
2278
+ const c = a.remoteInfo, u = c.entryGlobalName;
2271
2279
  CurrentGlobal[u] && ((n = Object.getOwnPropertyDescriptor(CurrentGlobal, u)) != null && n.configurable ? delete CurrentGlobal[u] : CurrentGlobal[u] = void 0);
2272
- const l = getRemoteEntryUniqueKey(c.remoteInfo);
2273
- globalLoading[l] && delete globalLoading[l], o.snapshotHandler.manifestCache.delete(a.entry);
2274
- let d = a.buildVersion ? composeKeyWithSeparator(a.name, a.buildVersion) : a.name;
2275
- const y = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((m) => a.buildVersion ? m.options.id === d : m.name === d);
2280
+ const l = getRemoteEntryUniqueKey(a.remoteInfo);
2281
+ globalLoading[l] && delete globalLoading[l], o.snapshotHandler.manifestCache.delete(c.entry);
2282
+ let d = c.buildVersion ? composeKeyWithSeparator(c.name, c.buildVersion) : c.name;
2283
+ const y = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((m) => c.buildVersion ? m.options.id === d : m.name === d);
2276
2284
  if (y !== -1) {
2277
2285
  const m = CurrentGlobal.__FEDERATION__.__INSTANCES__[y];
2278
2286
  d = m.options.id || d;
@@ -2284,26 +2292,26 @@ class RemoteHandler {
2284
2292
  S && Object.keys(S).forEach((_) => {
2285
2293
  const T = S[_];
2286
2294
  T && Object.keys(T).forEach((I) => {
2287
- const A = T[I];
2288
- A && Object.keys(A).forEach((w) => {
2289
- const k = A[w];
2290
- k && typeof k == "object" && k.from === a.name && (k.loaded || k.loading ? (k.useIn = k.useIn.filter((N) => N !== a.name), k.useIn.length ? b = !1 : E.push([
2295
+ const w = T[I];
2296
+ w && Object.keys(w).forEach((A) => {
2297
+ const k = w[A];
2298
+ k && typeof k == "object" && k.from === c.name && (k.loaded || k.loading ? (k.useIn = k.useIn.filter((N) => N !== c.name), k.useIn.length ? b = !1 : E.push([
2291
2299
  R,
2292
2300
  _,
2293
2301
  I,
2294
- w
2302
+ A
2295
2303
  ])) : E.push([
2296
2304
  R,
2297
2305
  _,
2298
2306
  I,
2299
- w
2307
+ A
2300
2308
  ]));
2301
2309
  });
2302
2310
  });
2303
2311
  });
2304
2312
  }), b && (m.shareScopeMap = {}, delete g[d]), E.forEach(([R, S, _, T]) => {
2305
- var I, A, w;
2306
- (w = (A = (I = g[R]) == null ? void 0 : I[S]) == null ? void 0 : A[_]) == null || delete w[T];
2313
+ var I, w, A;
2314
+ (A = (w = (I = g[R]) == null ? void 0 : I[S]) == null ? void 0 : w[_]) == null || delete A[T];
2307
2315
  }), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(y, 1);
2308
2316
  }
2309
2317
  const { hostGlobalSnapshot: p } = getGlobalRemoteInfo(t, o);
@@ -2328,7 +2336,7 @@ class ModuleFederation {
2328
2336
  beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
2329
2337
  // maybe will change, temporarily for internal use only
2330
2338
  initContainer: new AsyncWaterfallHook("initContainer")
2331
- }), this.version = "0.24.1", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
2339
+ }), this.version = "2.0.1", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
2332
2340
  // FIXME: may not be suitable , not open to the public yet
2333
2341
  getModuleInfo: new SyncHook(),
2334
2342
  createScript: new SyncHook(),
@@ -2395,7 +2403,7 @@ class ModuleFederation {
2395
2403
  userOptions: n,
2396
2404
  options: t,
2397
2405
  shareInfo: o
2398
- }), c = this.remoteHandler.formatAndRegisterRemote(i, s), { allShareInfos: a } = this.sharedHandler.registerShared(i, s), u = [...i.plugins];
2406
+ }), a = this.remoteHandler.formatAndRegisterRemote(i, s), { allShareInfos: c } = this.sharedHandler.registerShared(i, s), u = [...i.plugins];
2399
2407
  s.plugins && s.plugins.forEach((d) => {
2400
2408
  u.includes(d) || u.push(d);
2401
2409
  });
@@ -2403,8 +2411,8 @@ class ModuleFederation {
2403
2411
  ...t,
2404
2412
  ...n,
2405
2413
  plugins: u,
2406
- remotes: c,
2407
- shared: a
2414
+ remotes: a,
2415
+ shared: c
2408
2416
  };
2409
2417
  return this.hooks.lifecycle.init.emit({
2410
2418
  origin: this,
@@ -2445,31 +2453,31 @@ function addBasenameToNestedRoutes(r, t) {
2445
2453
  function processRoutes(r) {
2446
2454
  const { router: t, basename: n, memoryRoute: o, hashRoute: s } = r, i = t.getRoutes().sort(
2447
2455
  (p, m) => p.path.split("/").filter((g) => g).length - m.path.split("/").filter((g) => g).length
2448
- ), c = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Set();
2456
+ ), a = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Set();
2449
2457
  i.forEach((p) => {
2450
- c.set(p.path, p);
2458
+ a.set(p.path, p);
2451
2459
  });
2452
2460
  const u = (p, m) => `${p}/${m}`.replace(/\/+/g, "/").replace(/\/$/, "") || "/", l = (p, m = "") => {
2453
2461
  if (!p.children || p.children.length === 0)
2454
2462
  return p;
2455
2463
  for (let g = 0; g < p.children.length; g++) {
2456
- const b = p.children[g], E = u(m, b.path), R = c.get(E);
2457
- if (R && !a.has(R)) {
2464
+ const b = p.children[g], E = u(m, b.path), R = a.get(E);
2465
+ if (R && !c.has(R)) {
2458
2466
  const S = {
2459
2467
  ...R,
2460
2468
  path: b.path
2461
2469
  // Keep the original relative path from static route
2462
2470
  };
2463
- p.children[g] = S, a.add(R), l(S, E);
2471
+ p.children[g] = S, c.add(R), l(S, E);
2464
2472
  }
2465
2473
  }
2466
2474
  return p;
2467
2475
  };
2468
2476
  let d = [];
2469
2477
  for (const p of i)
2470
- if (!a.has(p)) {
2478
+ if (!c.has(p)) {
2471
2479
  const m = l(p, p.path);
2472
- a.add(p), d.push(m);
2480
+ c.add(p), d.push(m);
2473
2481
  }
2474
2482
  let y;
2475
2483
  return o ? y = VueRouter.createMemoryHistory(n) : s ? (y = VueRouter.createWebHashHistory(), n && (d = addBasenameToNestedRoutes(d, n))) : y = VueRouter.createWebHistory(n), {
@@ -2480,23 +2488,23 @@ function processRoutes(r) {
2480
2488
  function createBridgeComponent(r) {
2481
2489
  const t = /* @__PURE__ */ new Map(), n = getInstance();
2482
2490
  return () => ({
2483
- __APP_VERSION__: "0.24.1",
2491
+ __APP_VERSION__: "2.0.1",
2484
2492
  async render(o) {
2485
2493
  var g, b, E;
2486
2494
  LoggerInstance.debug("createBridgeComponent render Info", o);
2487
2495
  const {
2488
2496
  moduleName: s,
2489
2497
  dom: i,
2490
- basename: c,
2491
- memoryRoute: a,
2498
+ basename: a,
2499
+ memoryRoute: c,
2492
2500
  hashRoute: u,
2493
2501
  ...l
2494
2502
  } = o, d = Vue.createApp(r.rootComponent, l);
2495
2503
  t.set(i, d);
2496
2504
  const y = await ((E = (b = (g = n == null ? void 0 : n.bridgeHook) == null ? void 0 : g.lifecycle) == null ? void 0 : b.beforeBridgeRender) == null ? void 0 : E.emit(o)), p = y && typeof y == "object" && (y != null && y.extraProps) ? y == null ? void 0 : y.extraProps : {}, m = r.appOptions({
2497
2505
  app: d,
2498
- basename: c,
2499
- memoryRoute: a,
2506
+ basename: a,
2507
+ memoryRoute: c,
2500
2508
  hashRoute: u,
2501
2509
  ...l,
2502
2510
  ...p
@@ -2515,7 +2523,7 @@ function createBridgeComponent(r) {
2515
2523
  LoggerInstance.debug("createBridgeComponent render router info>>>", {
2516
2524
  moduleName: s,
2517
2525
  router: _
2518
- }), a && await _.push(a.entryPath), d.use(_);
2526
+ }), c && await _.push(c.entryPath), d.use(_);
2519
2527
  }
2520
2528
  d.mount(i);
2521
2529
  },
@@ -2542,12 +2550,12 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2542
2550
  },
2543
2551
  inheritAttrs: !1,
2544
2552
  setup(r) {
2545
- const t = ref(null), n = ref(null), o = ref(""), s = useRoute(), i = getInstance(), c = useAttrs(), a = async () => {
2553
+ const t = ref(null), n = ref(null), o = ref(""), s = useRoute(), i = getInstance(), a = useAttrs(), c = async () => {
2546
2554
  var p, m, g, b;
2547
2555
  const l = (p = r.providerInfo) == null ? void 0 : p.call(r);
2548
2556
  n.value = l;
2549
2557
  let d = {
2550
- ...c,
2558
+ ...a,
2551
2559
  moduleName: r.moduleName,
2552
2560
  dom: t.value,
2553
2561
  basename: r.basename,
@@ -2561,13 +2569,13 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2561
2569
  ...y.extraProps
2562
2570
  }, l.render(d);
2563
2571
  }, u = watch(() => s == null ? void 0 : s.path, (l) => {
2564
- l !== s.path && a(), o.value !== "" && o.value !== l && (LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>", {
2572
+ l !== s.path && c(), o.value !== "" && o.value !== l && (LoggerInstance.debug("createRemoteAppComponent dispatchPopstateEnv >>>", {
2565
2573
  ...r,
2566
2574
  pathname: s.path
2567
2575
  }), e()), o.value = l;
2568
2576
  });
2569
2577
  return onMounted(() => {
2570
- a();
2578
+ c();
2571
2579
  }), onBeforeUnmount(() => {
2572
2580
  var l;
2573
2581
  LoggerInstance.debug("createRemoteAppComponent LazyComponent destroy >>>", {
@@ -2582,7 +2590,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2582
2590
  });
2583
2591
  function createRemoteAppComponent(r) {
2584
2592
  return defineAsyncComponent({
2585
- __APP_VERSION__: "0.24.1",
2593
+ __APP_VERSION__: "2.0.1",
2586
2594
  ...r.asyncComponentOptions,
2587
2595
  //@ts-ignore
2588
2596
  loader: async () => {
@@ -2599,16 +2607,16 @@ function createRemoteAppComponent(r) {
2599
2607
  info: r
2600
2608
  }
2601
2609
  );
2602
- const i = await r.loader(), c = i && i[Symbol.for("mf_module_id")], a = i[s];
2610
+ const i = await r.loader(), a = i && i[Symbol.for("mf_module_id")], c = i[s];
2603
2611
  if (LoggerInstance.debug(
2604
2612
  "createRemoteAppComponent LazyComponent loadRemote info >>>",
2605
- { moduleName: c, module: i, exportName: s, basename: n, route: t }
2606
- ), s in i && typeof a == "function")
2613
+ { moduleName: a, module: i, exportName: s, basename: n, route: t }
2614
+ ), s in i && typeof c == "function")
2607
2615
  return {
2608
2616
  render() {
2609
2617
  return h(RemoteApp, {
2610
- moduleName: c,
2611
- providerInfo: a,
2618
+ moduleName: a,
2619
+ providerInfo: c,
2612
2620
  basename: n,
2613
2621
  rootAttrs: r.rootAttrs
2614
2622
  });