@module-federation/bridge-vue3 0.13.1 → 0.14.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
@@ -4,9 +4,9 @@ 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);
@@ -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,7 +51,7 @@ 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("./"))
@@ -62,23 +62,23 @@ const simpleJoinRemoteEntry = (n, t) => {
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;
71
+ var r, o;
72
72
  const { remotes: s = {}, overrides: l = {}, version: a } = t;
73
73
  let i;
74
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 d = {};
76
76
  if (!Object.keys(s).length) {
77
- var m;
78
- d = ((m = n.remotes) == null ? void 0 : m.reduce((R, $) => {
77
+ var p;
78
+ d = ((p = n.remotes) == null ? void 0 : p.reduce((R, A) => {
79
79
  let T;
80
- const A = $.federationContainerName;
81
- return u.includes(A) ? T = l[A] : "version" in $ ? T = $.version : T = $.entry, R[A] = {
80
+ const $ = A.federationContainerName;
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
  }, {})) || {};
@@ -87,45 +87,45 @@ function generateSnapshotFromManifest(n, t = {}) {
87
87
  // overrides will override dependencies
88
88
  matchedVersion: u.includes(R) ? l[R] : s[R]
89
89
  });
90
- const { remoteEntry: { path: p, name: y, type: g }, types: E, buildInfo: { buildVersion: _ }, globalName: b, ssrRemoteEntry: v } = n.metaData, { exposes: I } = n;
91
- let S = {
90
+ const { remoteEntry: { path: m, name: y, type: E }, types: b, buildInfo: { buildVersion: _ }, globalName: g, ssrRemoteEntry: v } = n.metaData, { exposes: S } = n;
91
+ let I = {
92
92
  version: a || "",
93
93
  buildVersion: _,
94
- globalName: b,
95
- remoteEntry: simpleJoinRemoteEntry(p, y),
96
- remoteEntryType: g,
97
- remoteTypes: simpleJoinRemoteEntry(E.path, E.name),
98
- remoteTypesZip: E.zip || "",
99
- remoteTypesAPI: E.api || "",
94
+ globalName: g,
95
+ remoteEntry: simpleJoinRemoteEntry(m, y),
96
+ remoteEntryType: E,
97
+ remoteTypes: simpleJoinRemoteEntry(b.path, b.name),
98
+ remoteTypesZip: b.zip || "",
99
+ remoteTypesAPI: b.api || "",
100
100
  remotesInfo: d,
101
101
  shared: n == null ? void 0 : n.shared.map((R) => ({
102
102
  assets: R.assets,
103
103
  sharedName: R.name,
104
104
  version: R.version
105
105
  })),
106
- modules: I == null ? void 0 : I.map((R) => ({
106
+ modules: S == null ? void 0 : S.map((R) => ({
107
107
  moduleName: R.name,
108
108
  modulePath: R.path,
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
- S = _extends$2({}, S, {
114
+ I = _extends$2({}, I, {
115
115
  prefetchInterface: R
116
116
  });
117
117
  }
118
- if ((r = n.metaData) != null && r.prefetchEntry) {
119
- const { path: R, name: $, type: T } = n.metaData.prefetchEntry;
120
- S = _extends$2({}, S, {
121
- prefetchEntry: simpleJoinRemoteEntry(R, $),
118
+ if ((o = n.metaData) != null && o.prefetchEntry) {
119
+ const { path: R, name: A, type: T } = n.metaData.prefetchEntry;
120
+ I = _extends$2({}, I, {
121
+ prefetchEntry: simpleJoinRemoteEntry(R, A),
122
122
  prefetchEntryType: T
123
123
  });
124
124
  }
125
- if ("publicPath" in n.metaData ? i = _extends$2({}, S, {
125
+ if ("publicPath" in n.metaData ? i = _extends$2({}, I, {
126
126
  publicPath: c(),
127
127
  ssrPublicPath: n.metaData.ssrPublicPath
128
- }) : i = _extends$2({}, S, {
128
+ }) : i = _extends$2({}, I, {
129
129
  getPublicPath: c()
130
130
  }), v) {
131
131
  const R = simpleJoinRemoteEntry(v.path, v.name);
@@ -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;
184
+ let t = null, r = !0, o = 2e4, s;
185
185
  const l = document.getElementsByTagName("script");
186
186
  for (let i = 0; i < l.length; i++) {
187
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,7 +194,7 @@ 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
  }
@@ -209,8 +209,8 @@ function createScript(n) {
209
209
  }), i && typeof i == "function")) {
210
210
  const d = i(c);
211
211
  if (d instanceof Promise) {
212
- const m = await d;
213
- return u(), m;
212
+ const p = await d;
213
+ return u(), p;
214
214
  }
215
215
  return u(), d;
216
216
  }
@@ -218,18 +218,18 @@ function createScript(n) {
218
218
  };
219
219
  return t.onerror = a.bind(null, t.onerror), t.onload = a.bind(null, t.onload), s = setTimeout(() => {
220
220
  a(null, new Error(`Remote script "${n.url}" time-outed.`));
221
- }, r), {
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 l = 0; l < r.length; l++) {
230
- const a = r[l], i = a.getAttribute("href"), c = a.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 = a, o = !1;
232
+ t = a, r = !1;
233
233
  break;
234
234
  }
235
235
  }
@@ -256,11 +256,11 @@ function createLink(n) {
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;
263
+ const { attrs: r = {}, createScriptHook: o } = t;
264
264
  return new Promise((s, l) => {
265
265
  const { script: a, needAttach: i } = createScript({
266
266
  url: n,
@@ -268,8 +268,8 @@ function loadScript(n, t) {
268
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
275
  i && document.head.appendChild(a);
@@ -278,18 +278,17 @@ function loadScript(n, t) {
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 ((l, a) => o.lifecycle.fetch.emit(l, a))(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
- };
292
- function createScriptNode(url, cb, attrs, loaderHook) {
291
+ }, createScriptNode = typeof ENV_TARGET > "u" || ENV_TARGET !== "web" ? (url, cb, attrs, loaderHook) => {
293
292
  if (loaderHook != null && loaderHook.createScriptHook) {
294
293
  const n = loaderHook.createScriptHook(url);
295
294
  n && typeof n == "object" && "url" in n && (url = n.url);
@@ -345,22 +344,23 @@ function createScriptNode(url, cb, attrs, loaderHook) {
345
344
  }).catch((n) => {
346
345
  cb(n);
347
346
  });
348
- }
349
- function loadScriptNode(n, t) {
350
- return new Promise((o, r) => {
351
- createScriptNode(n, (s, l) => {
352
- if (s)
353
- r(s);
354
- else {
355
- var a, i;
356
- 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;
357
- o(u);
358
- }
359
- }, t.attrs, t.loaderHook);
360
- });
361
- }
347
+ } : (n, t, r, o) => {
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((r, o) => {
350
+ createScriptNode(n, (s, l) => {
351
+ if (s)
352
+ o(s);
353
+ else {
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
+ }
358
+ }, t.attrs, t.loaderHook);
359
+ }) : (n, t) => {
360
+ throw new Error("loadScriptNode is disabled in non-Node.js environment");
361
+ };
362
362
  async function loadModule(n, t) {
363
- const { fetch: o, vm: r } = t, l = await (await o(n)).text(), a = new r.SourceTextModule(l, {
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;
@@ -375,35 +375,35 @@ async function loadModule(n, t) {
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, l;
388
- for (l = 0; l < r.length; l++)
389
- s = r[l], !(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", 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);
@@ -434,7 +434,7 @@ function warn(n) {
434
434
  n instanceof Error && (n.message = `${LOG_CATEGORY}: ${n.message}`), logger.warn(n);
435
435
  }
436
436
  function addUniqueItem(n, t) {
437
- return n.findIndex((o) => o === t) === -1 && n.push(t), n;
437
+ return n.findIndex((r) => r === t) === -1 && n.push(t), n;
438
438
  }
439
439
  function getFMId(n) {
440
440
  return "version" in n && n.version ? `${n.name}:${n.version}` : "entry" in n && n.entry ? `${n.name}:${n.entry}` : `${n.name}`;
@@ -443,7 +443,7 @@ function isRemoteInfoWithEntry(n) {
443
443
  return typeof n.entry < "u";
444
444
  }
445
445
  function isPureRemoteEntry(n) {
446
- return !n.entry.includes(".json") && n.entry.includes(".js");
446
+ return !n.entry.includes(".json");
447
447
  }
448
448
  function isObject(n) {
449
449
  return n && typeof n == "object";
@@ -474,8 +474,8 @@ function getRemoteEntryInfoFromSnapshot(n) {
474
474
  } : t;
475
475
  }
476
476
  const processModuleAlias = (n, t) => {
477
- let o;
478
- 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;
479
479
  }, CurrentGlobal = typeof globalThis == "object" ? globalThis : window, nativeGlobal = (() => {
480
480
  try {
481
481
  return document.defaultView;
@@ -483,9 +483,9 @@ const processModuleAlias = (n, t) => {
483
483
  return CurrentGlobal;
484
484
  }
485
485
  })(), Global = nativeGlobal;
486
- function definePropertyGlobalVal(n, t, o) {
486
+ function definePropertyGlobalVal(n, t, r) {
487
487
  Object.defineProperty(n, t, {
488
- value: o,
488
+ value: r,
489
489
  configurable: !1,
490
490
  writable: !0
491
491
  });
@@ -496,7 +496,7 @@ function includeOwnProperty(n, t) {
496
496
  includeOwnProperty(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__") || definePropertyGlobalVal(CurrentGlobal, "__GLOBAL_LOADING_REMOTE_ENTRY__", {});
497
497
  const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;
498
498
  function setGlobalDefaultVal(n) {
499
- var t, o, r, s, l, a;
499
+ var t, r, o, s, l, a;
500
500
  includeOwnProperty(n, "__VMOK__") && !includeOwnProperty(n, "__FEDERATION__") && definePropertyGlobalVal(n, "__FEDERATION__", n.__VMOK__), includeOwnProperty(n, "__FEDERATION__") || (definePropertyGlobalVal(n, "__FEDERATION__", {
501
501
  __GLOBAL_PLUGIN__: [],
502
502
  __INSTANCES__: [],
@@ -508,20 +508,20 @@ function setGlobalDefaultVal(n) {
508
508
  var i;
509
509
  (i = (t = n.__FEDERATION__).__GLOBAL_PLUGIN__) != null || (t.__GLOBAL_PLUGIN__ = []);
510
510
  var c;
511
- (c = (o = n.__FEDERATION__).__INSTANCES__) != null || (o.__INSTANCES__ = []);
511
+ (c = (r = n.__FEDERATION__).__INSTANCES__) != null || (r.__INSTANCES__ = []);
512
512
  var u;
513
- (u = (r = n.__FEDERATION__).moduleInfo) != null || (r.moduleInfo = {});
513
+ (u = (o = n.__FEDERATION__).moduleInfo) != null || (o.moduleInfo = {});
514
514
  var d;
515
515
  (d = (s = n.__FEDERATION__).__SHARE__) != null || (s.__SHARE__ = {});
516
- var m;
517
- (m = (l = n.__FEDERATION__).__MANIFEST_LOADING__) != null || (l.__MANIFEST_LOADING__ = {});
518
516
  var p;
519
- (p = (a = n.__FEDERATION__).__PRELOADED_MAP__) != null || (a.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
517
+ (p = (l = n.__FEDERATION__).__MANIFEST_LOADING__) != null || (l.__MANIFEST_LOADING__ = {});
518
+ var m;
519
+ (m = (a = n.__FEDERATION__).__PRELOADED_MAP__) != null || (a.__PRELOADED_MAP__ = /* @__PURE__ */ new Map());
520
520
  }
521
521
  setGlobalDefaultVal(CurrentGlobal);
522
522
  setGlobalDefaultVal(nativeGlobal);
523
523
  function setGlobalFederationConstructor(n, t = isDebugMode()) {
524
- t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = n, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.13.1");
524
+ t && (CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = n, CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.14.1");
525
525
  }
526
526
  function getInfoWithoutType(n, t) {
527
527
  if (typeof t == "string") {
@@ -531,8 +531,8 @@ function getInfoWithoutType(n, t) {
531
531
  key: t
532
532
  };
533
533
  {
534
- const r = Object.keys(n);
535
- for (const s of r) {
534
+ const o = Object.keys(n);
535
+ for (const s of o) {
536
536
  const [l, a] = s.split(":"), i = `${l}:${t}`, c = n[i];
537
537
  if (c)
538
538
  return {
@@ -549,9 +549,9 @@ function getInfoWithoutType(n, t) {
549
549
  throw new Error("key must be string");
550
550
  }
551
551
  const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo, getTargetSnapshotInfoByModuleInfo = (n, t) => {
552
- const o = getFMId(n), r = getInfoWithoutType(t, o).value;
553
- if (r && !r.version && "version" in n && n.version && (r.version = n.version), r)
554
- 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;
555
555
  if ("version" in n && n.version) {
556
556
  const { version: s } = n, l = _object_without_properties_loose(n, [
557
557
  "version"
@@ -560,17 +560,17 @@ const getGlobalSnapshot = () => nativeGlobal.__FEDERATION__.moduleInfo, getTarge
560
560
  return i;
561
561
  }
562
562
  }, getGlobalSnapshotInfoByModuleInfo = (n) => getTargetSnapshotInfoByModuleInfo(n, nativeGlobal.__FEDERATION__.moduleInfo), setGlobalSnapshotInfoByModuleInfo = (n, t) => {
563
- const o = getFMId(n);
564
- return nativeGlobal.__FEDERATION__.moduleInfo[o] = t, nativeGlobal.__FEDERATION__.moduleInfo;
563
+ const r = getFMId(n);
564
+ return nativeGlobal.__FEDERATION__.moduleInfo[r] = t, nativeGlobal.__FEDERATION__.moduleInfo;
565
565
  }, addGlobalSnapshot = (n) => (nativeGlobal.__FEDERATION__.moduleInfo = _extends$1({}, nativeGlobal.__FEDERATION__.moduleInfo, n), () => {
566
566
  const t = Object.keys(n);
567
- for (const o of t)
568
- delete nativeGlobal.__FEDERATION__.moduleInfo[o];
567
+ for (const r of t)
568
+ delete nativeGlobal.__FEDERATION__.moduleInfo[r];
569
569
  }), getRemoteEntryExports = (n, t) => {
570
- const o = t || `__FEDERATION_${n}:custom__`, r = CurrentGlobal[o];
570
+ const r = t || `__FEDERATION_${n}:custom__`, o = CurrentGlobal[r];
571
571
  return {
572
- remoteEntryKey: o,
573
- entryExports: r
572
+ remoteEntryKey: r,
573
+ entryExports: o
574
574
  };
575
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*$";
576
576
  function parseRegex(n) {
@@ -580,17 +580,17 @@ function isXVersion(n) {
580
580
  return !n || n.toLowerCase() === "x" || n === "*";
581
581
  }
582
582
  function pipe(...n) {
583
- return (t) => n.reduce((o, r) => r(o), t);
583
+ return (t) => n.reduce((r, o) => o(r), t);
584
584
  }
585
585
  function extractComparator(n) {
586
586
  return n.match(parseRegex(comparator));
587
587
  }
588
- function combineVersion(n, t, o, r) {
589
- const s = `${n}.${t}.${o}`;
590
- return r ? `${s}-${r}` : s;
588
+ function combineVersion(n, t, r, o) {
589
+ const s = `${n}.${t}.${r}`;
590
+ return o ? `${s}-${o}` : s;
591
591
  }
592
592
  function parseHyphen(n) {
593
- return n.replace(parseRegex(hyphenRange), (t, o, r, s, l, a, i, c, u, d, m, p) => (isXVersion(r) ? o = "" : isXVersion(s) ? o = `>=${r}.0.0` : isXVersion(l) ? o = `>=${r}.${s}.0` : o = `>=${o}`, isXVersion(u) ? c = "" : isXVersion(d) ? c = `<${Number(u) + 1}.0.0-0` : isXVersion(m) ? c = `<${u}.${Number(d) + 1}.0-0` : p ? c = `<=${u}.${d}.${m}-${p}` : c = `<=${c}`, `${o} ${c}`.trim()));
593
+ return n.replace(parseRegex(hyphenRange), (t, r, o, s, l, a, i, c, u, d, p, m) => (isXVersion(o) ? r = "" : isXVersion(s) ? r = `>=${o}.0.0` : isXVersion(l) ? r = `>=${o}.${s}.0` : r = `>=${r}`, isXVersion(u) ? c = "" : isXVersion(d) ? c = `<${Number(u) + 1}.0.0-0` : isXVersion(p) ? c = `<${u}.${Number(d) + 1}.0-0` : m ? c = `<=${u}.${d}.${p}-${m}` : c = `<=${c}`, `${r} ${c}`.trim()));
594
594
  }
595
595
  function parseComparatorTrim(n) {
596
596
  return n.replace(parseRegex(comparatorTrim), "$1$2$3");
@@ -602,15 +602,15 @@ function parseCaretTrim(n) {
602
602
  return n.replace(parseRegex(caretTrim), "$1^");
603
603
  }
604
604
  function parseCarets(n) {
605
- return n.trim().split(/\s+/).map((t) => t.replace(parseRegex(caret), (o, r, s, l, a) => isXVersion(r) ? "" : isXVersion(s) ? `>=${r}.0.0 <${Number(r) + 1}.0.0-0` : isXVersion(l) ? r === "0" ? `>=${r}.${s}.0 <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.0 <${Number(r) + 1}.0.0-0` : a ? r === "0" ? s === "0" ? `>=${r}.${s}.${l}-${a} <${r}.${s}.${Number(l) + 1}-0` : `>=${r}.${s}.${l}-${a} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${l}-${a} <${Number(r) + 1}.0.0-0` : r === "0" ? s === "0" ? `>=${r}.${s}.${l} <${r}.${s}.${Number(l) + 1}-0` : `>=${r}.${s}.${l} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${l} <${Number(r) + 1}.0.0-0`)).join(" ");
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(" ");
606
606
  }
607
607
  function parseTildes(n) {
608
- return n.trim().split(/\s+/).map((t) => t.replace(parseRegex(tilde), (o, r, s, l, a) => isXVersion(r) ? "" : isXVersion(s) ? `>=${r}.0.0 <${Number(r) + 1}.0.0-0` : isXVersion(l) ? `>=${r}.${s}.0 <${r}.${Number(s) + 1}.0-0` : a ? `>=${r}.${s}.${l}-${a} <${r}.${Number(s) + 1}.0-0` : `>=${r}.${s}.${l} <${r}.${Number(s) + 1}.0-0`)).join(" ");
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(" ");
609
609
  }
610
610
  function parseXRanges(n) {
611
- return n.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (o, r, s, l, a, i) => {
611
+ return n.split(/\s+/).map((t) => t.trim().replace(parseRegex(xRange), (r, o, s, l, a, i) => {
612
612
  const c = isXVersion(s), u = c || isXVersion(l), d = u || isXVersion(a);
613
- return r === "=" && d && (r = ""), i = "", c ? r === ">" || r === "<" ? "<0.0.0-0" : "*" : r && d ? (u && (l = 0), a = 0, r === ">" ? (r = ">=", u ? (s = Number(s) + 1, l = 0, a = 0) : (l = Number(l) + 1, a = 0)) : r === "<=" && (r = "<", u ? s = Number(s) + 1 : l = Number(l) + 1), r === "<" && (i = "-0"), `${r + s}.${l}.${a}${i}`) : u ? `>=${s}.0.0${i} <${Number(s) + 1}.0.0-0` : d ? `>=${s}.${l}.0${i} <${s}.${Number(l) + 1}.0-0` : o;
613
+ return o === "=" && d && (o = ""), i = "", c ? o === ">" || o === "<" ? "<0.0.0-0" : "*" : o && d ? (u && (l = 0), a = 0, o === ">" ? (o = ">=", u ? (s = Number(s) + 1, l = 0, a = 0) : (l = Number(l) + 1, a = 0)) : o === "<=" && (o = "<", u ? s = Number(s) + 1 : l = Number(l) + 1), o === "<" && (i = "-0"), `${o + s}.${l}.${a}${i}`) : u ? `>=${s}.0.0${i} <${Number(s) + 1}.0.0-0` : d ? `>=${s}.${l}.0${i} <${s}.${Number(l) + 1}.0-0` : r;
614
614
  })).join(" ");
615
615
  }
616
616
  function parseStar(n) {
@@ -623,15 +623,15 @@ function compareAtom(n, t) {
623
623
  return n = Number(n) || n, t = Number(t) || t, n > t ? 1 : n === t ? 0 : -1;
624
624
  }
625
625
  function comparePreRelease(n, t) {
626
- const { preRelease: o } = n, { preRelease: r } = t;
627
- if (o === void 0 && r)
626
+ const { preRelease: r } = n, { preRelease: o } = t;
627
+ if (r === void 0 && o)
628
628
  return 1;
629
- if (o && r === void 0)
629
+ if (r && o === void 0)
630
630
  return -1;
631
- if (o === void 0 && r === void 0)
631
+ if (r === void 0 && o === void 0)
632
632
  return 0;
633
- for (let s = 0, l = o.length; s <= l; s++) {
634
- const a = o[s], i = r[s];
633
+ for (let s = 0, l = r.length; s <= l; s++) {
634
+ const a = r[s], i = o[s];
635
635
  if (a !== i)
636
636
  return a === void 0 && i === void 0 ? 0 : a ? i ? compareAtom(a, i) : -1 : 1;
637
637
  }
@@ -703,37 +703,37 @@ function parseRange(n) {
703
703
  function satisfy(n, t) {
704
704
  if (!n)
705
705
  return !1;
706
- const s = parseRange(t).split(" ").map((p) => parseComparatorString(p)).join(" ").split(/\s+/).map((p) => parseGTE0(p)), l = extractComparator(n);
706
+ const s = parseRange(t).split(" ").map((m) => parseComparatorString(m)).join(" ").split(/\s+/).map((m) => parseGTE0(m)), l = extractComparator(n);
707
707
  if (!l)
708
708
  return !1;
709
- const [, a, , i, c, u, d] = l, m = {
709
+ const [, a, , i, c, u, d] = l, p = {
710
710
  version: combineVersion(i, c, u, d),
711
711
  major: i,
712
712
  minor: c,
713
713
  patch: u,
714
714
  preRelease: d == null ? void 0 : d.split(".")
715
715
  };
716
- for (const p of s) {
717
- const y = extractComparator(p);
716
+ for (const m of s) {
717
+ const y = extractComparator(m);
718
718
  if (!y)
719
719
  return !1;
720
- const [, g, , E, _, b, v] = y, I = {
721
- operator: g,
722
- version: combineVersion(E, _, b, v),
723
- major: E,
720
+ const [, E, , b, _, g, v] = y, S = {
721
+ operator: E,
722
+ version: combineVersion(b, _, g, v),
723
+ major: b,
724
724
  minor: _,
725
- patch: b,
725
+ patch: g,
726
726
  preRelease: v == null ? void 0 : v.split(".")
727
727
  };
728
- if (!compare(I, m))
728
+ if (!compare(S, p))
729
729
  return !1;
730
730
  }
731
731
  return !0;
732
732
  }
733
- function formatShare(n, t, o, r) {
733
+ function formatShare(n, t, r, o) {
734
734
  let s;
735
735
  "get" in n ? s = n.get : "lib" in n ? s = () => Promise.resolve(n.lib) : s = () => Promise.resolve(() => {
736
- throw new Error(`Can not get shared '${o}'!`);
736
+ throw new Error(`Can not get shared '${r}'!`);
737
737
  });
738
738
  var l, a, i;
739
739
  return _extends$1({
@@ -754,14 +754,14 @@ function formatShare(n, t, o, r) {
754
754
  scope: Array.isArray(n.scope) ? n.scope : [
755
755
  (a = n.scope) != null ? a : "default"
756
756
  ],
757
- strategy: ((i = n.strategy) != null ? i : r) || "version-first"
757
+ strategy: ((i = n.strategy) != null ? i : o) || "version-first"
758
758
  });
759
759
  }
760
760
  function formatShareConfigs(n, t) {
761
- const o = t.shared || {}, r = t.name, s = Object.keys(o).reduce((a, i) => {
762
- const c = arrayOptions(o[i]);
761
+ const r = t.shared || {}, o = t.name, s = Object.keys(r).reduce((a, i) => {
762
+ const c = arrayOptions(r[i]);
763
763
  return a[i] = a[i] || [], c.forEach((u) => {
764
- a[i].push(formatShare(u, r, i, t.shareStrategy));
764
+ a[i].push(formatShare(u, o, i, t.shareStrategy));
765
765
  }), a;
766
766
  }, {}), l = _extends$1({}, n.shared);
767
767
  return Object.keys(s).forEach((a) => {
@@ -774,232 +774,234 @@ function formatShareConfigs(n, t) {
774
774
  };
775
775
  }
776
776
  function versionLt(n, t) {
777
- const o = (r) => {
778
- if (!Number.isNaN(Number(r))) {
779
- const l = r.split(".");
780
- let a = r;
777
+ const r = (o) => {
778
+ if (!Number.isNaN(Number(o))) {
779
+ const l = o.split(".");
780
+ let a = o;
781
781
  for (let i = 0; i < 3 - l.length; i++)
782
782
  a += ".0";
783
783
  return a;
784
784
  }
785
- return r;
785
+ return o;
786
786
  };
787
- return !!satisfy(o(n), `<=${o(t)}`);
787
+ return !!satisfy(r(n), `<=${r(t)}`);
788
788
  }
789
789
  const findVersion = (n, t) => {
790
- const o = t || function(r, s) {
791
- return versionLt(r, s);
790
+ const r = t || function(o, s) {
791
+ return versionLt(o, s);
792
792
  };
793
- return Object.keys(n).reduce((r, s) => !r || o(r, s) || r === "0" ? s : r, 0);
793
+ return Object.keys(n).reduce((o, s) => !o || r(o, s) || o === "0" ? s : o, 0);
794
794
  }, isLoaded = (n) => !!n.loaded || typeof n.lib == "function", isLoading = (n) => !!n.loading;
795
- function findSingletonVersionOrderByVersion(n, t, o) {
796
- const r = n[t][o], s = function(l, a) {
797
- return !isLoaded(r[l]) && versionLt(l, a);
795
+ function findSingletonVersionOrderByVersion(n, t, r) {
796
+ const o = n[t][r], s = function(l, a) {
797
+ return !isLoaded(o[l]) && versionLt(l, a);
798
798
  };
799
- return findVersion(n[t][o], s);
799
+ return findVersion(n[t][r], s);
800
800
  }
801
- function findSingletonVersionOrderByLoaded(n, t, o) {
802
- const r = n[t][o], s = function(l, a) {
801
+ function findSingletonVersionOrderByLoaded(n, t, r) {
802
+ const o = n[t][r], s = function(l, a) {
803
803
  const i = (c) => isLoaded(c) || isLoading(c);
804
- return i(r[a]) ? i(r[l]) ? !!versionLt(l, a) : !0 : i(r[l]) ? !1 : versionLt(l, a);
804
+ return i(o[a]) ? i(o[l]) ? !!versionLt(l, a) : !0 : i(o[l]) ? !1 : versionLt(l, a);
805
805
  };
806
- return findVersion(n[t][o], s);
806
+ return findVersion(n[t][r], s);
807
807
  }
808
808
  function getFindShareFunction(n) {
809
809
  return n === "loaded-first" ? findSingletonVersionOrderByLoaded : findSingletonVersionOrderByVersion;
810
810
  }
811
- function getRegisteredShare(n, t, o, r) {
811
+ function getRegisteredShare(n, t, r, o) {
812
812
  if (!n)
813
813
  return;
814
- const { shareConfig: s, scope: l = DEFAULT_SCOPE, strategy: a } = o, i = Array.isArray(l) ? l : [
814
+ const { shareConfig: s, scope: l = DEFAULT_SCOPE, strategy: a } = r, i = Array.isArray(l) ? l : [
815
815
  l
816
816
  ];
817
817
  for (const c of i)
818
818
  if (s && n[c] && n[c][t]) {
819
- const { requiredVersion: u } = s, m = getFindShareFunction(a)(n, c, t), p = () => {
819
+ const { requiredVersion: u } = s, p = getFindShareFunction(a)(n, c, t), m = () => {
820
820
  if (s.singleton) {
821
- if (typeof u == "string" && !satisfy(m, u)) {
822
- const E = `Version ${m} from ${m && n[c][t][m].from} of shared singleton module ${t} does not satisfy the requirement of ${o.from} which needs ${u})`;
823
- s.strictVersion ? error(E) : warn(E);
821
+ if (typeof u == "string" && !satisfy(p, u)) {
822
+ const b = `Version ${p} from ${p && n[c][t][p].from} of shared singleton module ${t} does not satisfy the requirement of ${r.from} which needs ${u})`;
823
+ s.strictVersion ? error(b) : warn(b);
824
824
  }
825
- return n[c][t][m];
825
+ return n[c][t][p];
826
826
  } else {
827
- if (u === !1 || u === "*" || satisfy(m, u))
828
- return n[c][t][m];
829
- for (const [E, _] of Object.entries(n[c][t]))
830
- if (satisfy(E, u))
827
+ if (u === !1 || u === "*" || satisfy(p, u))
828
+ return n[c][t][p];
829
+ for (const [b, _] of Object.entries(n[c][t]))
830
+ if (satisfy(b, u))
831
831
  return _;
832
832
  }
833
833
  }, y = {
834
834
  shareScopeMap: n,
835
835
  scope: c,
836
836
  pkgName: t,
837
- version: m,
837
+ version: p,
838
838
  GlobalFederation: Global.__FEDERATION__,
839
- resolver: p
839
+ resolver: m
840
840
  };
841
- return (r.emit(y) || y).resolver();
841
+ return (o.emit(y) || y).resolver();
842
842
  }
843
843
  }
844
844
  function getGlobalShareScope() {
845
845
  return Global.__FEDERATION__.__SHARE__;
846
846
  }
847
847
  function getTargetSharedOptions(n) {
848
- const { pkgName: t, extraOptions: o, shareInfos: r } = n, s = (i) => {
848
+ const { pkgName: t, extraOptions: r, shareInfos: o } = n, s = (i) => {
849
849
  if (!i)
850
850
  return;
851
851
  const c = {};
852
- i.forEach((m) => {
853
- c[m.version] = m;
852
+ i.forEach((p) => {
853
+ c[p.version] = p;
854
854
  });
855
- const d = findVersion(c, function(m, p) {
856
- return !isLoaded(c[m]) && versionLt(m, p);
855
+ const d = findVersion(c, function(p, m) {
856
+ return !isLoaded(c[p]) && versionLt(p, m);
857
857
  });
858
858
  return c[d];
859
859
  };
860
860
  var l;
861
- const a = (l = o == null ? void 0 : o.resolver) != null ? l : s;
862
- return Object.assign({}, a(r[t]), o == null ? void 0 : o.customShareInfo);
861
+ const a = (l = r == null ? void 0 : r.resolver) != null ? l : s;
862
+ return Object.assign({}, a(o[t]), r == null ? void 0 : r.customShareInfo);
863
863
  }
864
864
  function getBuilderId() {
865
865
  return typeof FEDERATION_BUILD_IDENTIFIER < "u" ? FEDERATION_BUILD_IDENTIFIER : "";
866
866
  }
867
867
  function matchRemoteWithNameAndExpose(n, t) {
868
- for (const o of n) {
869
- const r = t.startsWith(o.name);
870
- let s = t.replace(o.name, "");
871
- if (r) {
868
+ for (const r of n) {
869
+ const o = t.startsWith(r.name);
870
+ let s = t.replace(r.name, "");
871
+ if (o) {
872
872
  if (s.startsWith("/")) {
873
- const i = o.name;
873
+ const i = r.name;
874
874
  return s = `.${s}`, {
875
875
  pkgNameOrAlias: i,
876
876
  expose: s,
877
- remote: o
877
+ remote: r
878
878
  };
879
879
  } else if (s === "")
880
880
  return {
881
- pkgNameOrAlias: o.name,
881
+ pkgNameOrAlias: r.name,
882
882
  expose: ".",
883
- remote: o
883
+ remote: r
884
884
  };
885
885
  }
886
- const l = o.alias && t.startsWith(o.alias);
887
- let a = o.alias && t.replace(o.alias, "");
888
- if (o.alias && l) {
886
+ const l = r.alias && t.startsWith(r.alias);
887
+ let a = r.alias && t.replace(r.alias, "");
888
+ if (r.alias && l) {
889
889
  if (a && a.startsWith("/")) {
890
- const i = o.alias;
890
+ const i = r.alias;
891
891
  return a = `.${a}`, {
892
892
  pkgNameOrAlias: i,
893
893
  expose: a,
894
- remote: o
894
+ remote: r
895
895
  };
896
896
  } else if (a === "")
897
897
  return {
898
- pkgNameOrAlias: o.alias,
898
+ pkgNameOrAlias: r.alias,
899
899
  expose: ".",
900
- remote: o
900
+ remote: r
901
901
  };
902
902
  }
903
903
  }
904
904
  }
905
905
  function matchRemote(n, t) {
906
- for (const o of n)
907
- if (t === o.name || o.alias && t === o.alias)
908
- return o;
906
+ for (const r of n)
907
+ if (t === r.name || r.alias && t === r.alias)
908
+ return r;
909
909
  }
910
910
  function registerPlugins(n, t) {
911
- const o = getGlobalHostPlugins();
912
- return o.length > 0 && o.forEach((r) => {
913
- n != null && n.find((s) => s.name !== r.name) && n.push(r);
914
- }), n && n.length > 0 && n.forEach((r) => {
911
+ const r = getGlobalHostPlugins();
912
+ return r.length > 0 && r.forEach((o) => {
913
+ n != null && n.find((s) => s.name !== o.name) && n.push(o);
914
+ }), n && n.length > 0 && n.forEach((o) => {
915
915
  t.forEach((s) => {
916
- s.applyPlugin(r);
916
+ s.applyPlugin(o);
917
917
  });
918
918
  }), n;
919
919
  }
920
+ const importCallback = ".then(callbacks[0]).catch(callbacks[1])";
920
921
  async function loadEsmEntry({ entry: n, remoteEntryExports: t }) {
921
- return new Promise((o, r) => {
922
+ return new Promise((r, o) => {
922
923
  try {
923
- t ? o(t) : typeof FEDERATION_ALLOW_NEW_FUNCTION < "u" ? new Function("callbacks", `import("${n}").then(callbacks[0]).catch(callbacks[1])`)([
924
- o,
925
- r
924
+ t ? r(t) : typeof FEDERATION_ALLOW_NEW_FUNCTION < "u" ? new Function("callbacks", `import("${n}")${importCallback}`)([
925
+ r,
926
+ o
926
927
  ]) : import(
927
928
  /* webpackIgnore: true */
928
929
  /* @vite-ignore */
929
930
  n
930
- ).then(o).catch(r);
931
+ ).then(r).catch(o);
931
932
  } catch (s) {
932
- r(s);
933
+ o(s);
933
934
  }
934
935
  });
935
936
  }
936
937
  async function loadSystemJsEntry({ entry: n, remoteEntryExports: t }) {
937
- return new Promise((o, r) => {
938
+ return new Promise((r, o) => {
938
939
  try {
939
- t ? o(t) : typeof __system_context__ > "u" ? System.import(n).then(o).catch(r) : new Function("callbacks", `System.import("${n}").then(callbacks[0]).catch(callbacks[1])`)([
940
- o,
941
- r
940
+ t ? r(t) : typeof __system_context__ > "u" ? System.import(n).then(r).catch(o) : new Function("callbacks", `System.import("${n}")${importCallback}`)([
941
+ r,
942
+ o
942
943
  ]);
943
944
  } catch (s) {
944
- r(s);
945
+ o(s);
945
946
  }
946
947
  });
947
948
  }
948
- async function loadEntryScript({ name: n, globalName: t, entry: o, loaderHook: r }) {
949
+ function handleRemoteEntryLoaded(n, t, r) {
950
+ const { remoteEntryKey: o, entryExports: s } = getRemoteEntryExports(n, t);
951
+ return assert(s, getShortErrorMsg(RUNTIME_001, runtimeDescMap, {
952
+ remoteName: n,
953
+ remoteEntryUrl: r,
954
+ remoteEntryKey: o
955
+ })), s;
956
+ }
957
+ async function loadEntryScript({ name: n, globalName: t, entry: r, loaderHook: o }) {
949
958
  const { entryExports: s } = getRemoteEntryExports(n, t);
950
- return s || loadScript(o, {
959
+ return s || loadScript(r, {
951
960
  attrs: {},
952
961
  createScriptHook: (l, a) => {
953
- const i = r.lifecycle.createScript.emit({
962
+ const i = o.lifecycle.createScript.emit({
954
963
  url: l,
955
964
  attrs: a
956
965
  });
957
966
  if (i && (i instanceof HTMLScriptElement || "script" in i || "timeout" in i))
958
967
  return i;
959
968
  }
960
- }).then(() => {
961
- const { remoteEntryKey: l, entryExports: a } = getRemoteEntryExports(n, t);
962
- return assert(a, getShortErrorMsg(RUNTIME_001, runtimeDescMap, {
963
- remoteName: n,
964
- remoteEntryUrl: o,
965
- remoteEntryKey: l
966
- })), a;
967
- }).catch((l) => {
969
+ }).then(() => handleRemoteEntryLoaded(n, t, r)).catch((l) => {
968
970
  throw assert(void 0, getShortErrorMsg(RUNTIME_008, runtimeDescMap, {
969
971
  remoteName: n,
970
- resourceUrl: o
972
+ resourceUrl: r
971
973
  })), l;
972
974
  });
973
975
  }
974
- async function loadEntryDom({ remoteInfo: n, remoteEntryExports: t, loaderHook: o }) {
975
- const { entry: r, entryGlobalName: s, name: l, type: a } = n;
976
+ async function loadEntryDom({ remoteInfo: n, remoteEntryExports: t, loaderHook: r }) {
977
+ const { entry: o, entryGlobalName: s, name: l, type: a } = n;
976
978
  switch (a) {
977
979
  case "esm":
978
980
  case "module":
979
981
  return loadEsmEntry({
980
- entry: r,
982
+ entry: o,
981
983
  remoteEntryExports: t
982
984
  });
983
985
  case "system":
984
986
  return loadSystemJsEntry({
985
- entry: r,
987
+ entry: o,
986
988
  remoteEntryExports: t
987
989
  });
988
990
  default:
989
991
  return loadEntryScript({
990
- entry: r,
992
+ entry: o,
991
993
  globalName: s,
992
994
  name: l,
993
- loaderHook: o
995
+ loaderHook: r
994
996
  });
995
997
  }
996
998
  }
997
999
  async function loadEntryNode({ remoteInfo: n, loaderHook: t }) {
998
- const { entry: o, entryGlobalName: r, name: s, type: l } = n, { entryExports: a } = getRemoteEntryExports(s, r);
999
- return a || loadScriptNode(o, {
1000
+ const { entry: r, entryGlobalName: o, name: s, type: l } = n, { entryExports: a } = getRemoteEntryExports(s, o);
1001
+ return a || loadScriptNode(r, {
1000
1002
  attrs: {
1001
1003
  name: s,
1002
- globalName: r,
1004
+ globalName: o,
1003
1005
  type: l
1004
1006
  },
1005
1007
  loaderHook: {
@@ -1012,41 +1014,34 @@ async function loadEntryNode({ remoteInfo: n, loaderHook: t }) {
1012
1014
  return u;
1013
1015
  }
1014
1016
  }
1015
- }).then(() => {
1016
- const { remoteEntryKey: i, entryExports: c } = getRemoteEntryExports(s, r);
1017
- return assert(c, getShortErrorMsg(RUNTIME_001, runtimeDescMap, {
1018
- remoteName: s,
1019
- remoteEntryUrl: o,
1020
- remoteEntryKey: i
1021
- })), c;
1022
- }).catch((i) => {
1017
+ }).then(() => handleRemoteEntryLoaded(s, o, r)).catch((i) => {
1023
1018
  throw i;
1024
1019
  });
1025
1020
  }
1026
1021
  function getRemoteEntryUniqueKey(n) {
1027
- const { entry: t, name: o } = n;
1028
- return composeKeyWithSeparator(o, t);
1022
+ const { entry: t, name: r } = n;
1023
+ return composeKeyWithSeparator(r, t);
1029
1024
  }
1030
- async function getRemoteEntry({ origin: n, remoteEntryExports: t, remoteInfo: o }) {
1031
- const r = getRemoteEntryUniqueKey(o);
1025
+ async function getRemoteEntry({ origin: n, remoteEntryExports: t, remoteInfo: r }) {
1026
+ const o = getRemoteEntryUniqueKey(r);
1032
1027
  if (t)
1033
1028
  return t;
1034
- if (!globalLoading[r]) {
1029
+ if (!globalLoading[o]) {
1035
1030
  const s = n.remoteHandler.hooks.lifecycle.loadEntry, l = n.loaderHook;
1036
- globalLoading[r] = s.emit({
1031
+ globalLoading[o] = s.emit({
1037
1032
  loaderHook: l,
1038
- remoteInfo: o,
1033
+ remoteInfo: r,
1039
1034
  remoteEntryExports: t
1040
- }).then((a) => a || (isBrowserEnv() ? loadEntryDom({
1041
- remoteInfo: o,
1035
+ }).then((a) => a || ((typeof ENV_TARGET < "u" ? ENV_TARGET === "web" : isBrowserEnv()) ? loadEntryDom({
1036
+ remoteInfo: r,
1042
1037
  remoteEntryExports: t,
1043
1038
  loaderHook: l
1044
1039
  }) : loadEntryNode({
1045
- remoteInfo: o,
1040
+ remoteInfo: r,
1046
1041
  loaderHook: l
1047
1042
  })));
1048
1043
  }
1049
- return globalLoading[r];
1044
+ return globalLoading[o];
1050
1045
  }
1051
1046
  function getRemoteInfo(n) {
1052
1047
  return _extends$1({}, n, {
@@ -1068,45 +1063,45 @@ let Module = class {
1068
1063
  remoteEntryExports: this.remoteEntryExports
1069
1064
  });
1070
1065
  } catch {
1071
- const r = getRemoteEntryUniqueKey(this.remoteInfo);
1066
+ const o = getRemoteEntryUniqueKey(this.remoteInfo);
1072
1067
  t = await this.host.loaderHook.lifecycle.loadEntryError.emit({
1073
1068
  getRemoteEntry,
1074
1069
  origin: this.host,
1075
1070
  remoteInfo: this.remoteInfo,
1076
1071
  remoteEntryExports: this.remoteEntryExports,
1077
1072
  globalLoading,
1078
- uniqueKey: r
1073
+ uniqueKey: o
1079
1074
  });
1080
1075
  }
1081
1076
  return assert(t, `remoteEntryExports is undefined
1082
1077
  ${safeToString(this.remoteInfo)}`), this.remoteEntryExports = t, this.remoteEntryExports;
1083
1078
  }
1084
1079
  // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
1085
- async get(t, o, r, s) {
1086
- const { loadFactory: l = !0 } = r || {
1080
+ async get(t, r, o, s) {
1081
+ const { loadFactory: l = !0 } = o || {
1087
1082
  loadFactory: !0
1088
1083
  }, a = await this.getEntry();
1089
1084
  if (!this.inited) {
1090
- const m = this.host.shareScopeMap, p = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [
1085
+ const p = this.host.shareScopeMap, m = Array.isArray(this.remoteInfo.shareScope) ? this.remoteInfo.shareScope : [
1091
1086
  this.remoteInfo.shareScope
1092
1087
  ];
1093
- p.length || p.push("default"), p.forEach((b) => {
1094
- m[b] || (m[b] = {});
1088
+ m.length || m.push("default"), m.forEach((g) => {
1089
+ p[g] || (p[g] = {});
1095
1090
  });
1096
- const y = m[p[0]], g = [], E = {
1091
+ const y = p[m[0]], E = [], b = {
1097
1092
  version: this.remoteInfo.version || "",
1098
- shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? p : this.remoteInfo.shareScope || "default"
1093
+ shareScopeKeys: Array.isArray(this.remoteInfo.shareScope) ? m : this.remoteInfo.shareScope || "default"
1099
1094
  };
1100
- Object.defineProperty(E, "shareScopeMap", {
1101
- value: m,
1095
+ Object.defineProperty(b, "shareScopeMap", {
1096
+ value: p,
1102
1097
  // remoteEntryInitOptions will be traversed and assigned during container init, ,so this attribute is not allowed to be traversed
1103
1098
  enumerable: !1
1104
1099
  });
1105
1100
  const _ = await this.host.hooks.lifecycle.beforeInitContainer.emit({
1106
1101
  shareScope: y,
1107
1102
  // @ts-ignore shareScopeMap will be set by Object.defineProperty
1108
- remoteEntryInitOptions: E,
1109
- initScope: g,
1103
+ remoteEntryInitOptions: b,
1104
+ initScope: E,
1110
1105
  remoteInfo: this.remoteInfo,
1111
1106
  origin: this.host
1112
1107
  });
@@ -1124,14 +1119,14 @@ let Module = class {
1124
1119
  let i;
1125
1120
  i = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
1126
1121
  remoteEntryExports: a,
1127
- expose: o,
1122
+ expose: r,
1128
1123
  moduleInfo: this.remoteInfo
1129
- }), i || (i = await a.get(o)), assert(i, `${getFMId(this.remoteInfo)} remote don't export ${o}.`);
1130
- const c = processModuleAlias(this.remoteInfo.name, o), u = this.wraperFactory(i, c);
1124
+ }), i || (i = await a.get(r)), assert(i, `${getFMId(this.remoteInfo)} remote don't export ${r}.`);
1125
+ const c = processModuleAlias(this.remoteInfo.name, r), u = this.wraperFactory(i, c);
1131
1126
  return l ? await u() : u;
1132
1127
  }
1133
- wraperFactory(t, o) {
1134
- function r(s, l) {
1128
+ wraperFactory(t, r) {
1129
+ function o(s, l) {
1135
1130
  s && typeof s == "object" && Object.isExtensible(s) && !Object.getOwnPropertyDescriptor(s, Symbol.for("mf_module_id")) && Object.defineProperty(s, Symbol.for("mf_module_id"), {
1136
1131
  value: l,
1137
1132
  enumerable: !1
@@ -1139,14 +1134,14 @@ let Module = class {
1139
1134
  }
1140
1135
  return t instanceof Promise ? async () => {
1141
1136
  const s = await t();
1142
- return r(s, o), s;
1137
+ return o(s, r), s;
1143
1138
  } : () => {
1144
1139
  const s = t();
1145
- return r(s, o), s;
1140
+ return o(s, r), s;
1146
1141
  };
1147
1142
  }
1148
- constructor({ remoteInfo: t, host: o }) {
1149
- this.inited = !1, this.lib = void 0, this.remoteInfo = t, this.host = o;
1143
+ constructor({ remoteInfo: t, host: r }) {
1144
+ this.inited = !1, this.lib = void 0, this.remoteInfo = t, this.host = r;
1150
1145
  }
1151
1146
  };
1152
1147
  class SyncHook {
@@ -1154,16 +1149,16 @@ class SyncHook {
1154
1149
  typeof t == "function" && this.listeners.add(t);
1155
1150
  }
1156
1151
  once(t) {
1157
- const o = this;
1158
- this.on(function r(...s) {
1159
- return o.remove(r), t.apply(null, s);
1152
+ const r = this;
1153
+ this.on(function o(...s) {
1154
+ return r.remove(o), t.apply(null, s);
1160
1155
  });
1161
1156
  }
1162
1157
  emit(...t) {
1163
- let o;
1164
- return this.listeners.size > 0 && this.listeners.forEach((r) => {
1165
- o = r(...t);
1166
- }), o;
1158
+ let r;
1159
+ return this.listeners.size > 0 && this.listeners.forEach((o) => {
1160
+ r = o(...t);
1161
+ }), r;
1167
1162
  }
1168
1163
  remove(t) {
1169
1164
  this.listeners.delete(t);
@@ -1177,22 +1172,22 @@ class SyncHook {
1177
1172
  }
1178
1173
  class AsyncHook extends SyncHook {
1179
1174
  emit(...t) {
1180
- let o;
1181
- const r = Array.from(this.listeners);
1182
- if (r.length > 0) {
1175
+ let r;
1176
+ const o = Array.from(this.listeners);
1177
+ if (o.length > 0) {
1183
1178
  let s = 0;
1184
- const l = (a) => a === !1 ? !1 : s < r.length ? Promise.resolve(r[s++].apply(null, t)).then(l) : a;
1185
- o = l();
1179
+ const l = (a) => a === !1 ? !1 : s < o.length ? Promise.resolve(o[s++].apply(null, t)).then(l) : a;
1180
+ r = l();
1186
1181
  }
1187
- return Promise.resolve(o);
1182
+ return Promise.resolve(r);
1188
1183
  }
1189
1184
  }
1190
1185
  function checkReturnData(n, t) {
1191
1186
  if (!isObject(t))
1192
1187
  return !1;
1193
1188
  if (n !== t) {
1194
- for (const o in n)
1195
- if (!(o in t))
1189
+ for (const r in n)
1190
+ if (!(r in t))
1196
1191
  return !1;
1197
1192
  }
1198
1193
  return !0;
@@ -1200,17 +1195,17 @@ function checkReturnData(n, t) {
1200
1195
  class SyncWaterfallHook extends SyncHook {
1201
1196
  emit(t) {
1202
1197
  isObject(t) || error(`The data for the "${this.type}" hook should be an object.`);
1203
- for (const o of this.listeners)
1198
+ for (const r of this.listeners)
1204
1199
  try {
1205
- const r = o(t);
1206
- if (checkReturnData(t, r))
1207
- t = r;
1200
+ const o = r(t);
1201
+ if (checkReturnData(t, o))
1202
+ t = o;
1208
1203
  else {
1209
1204
  this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
1210
1205
  break;
1211
1206
  }
1212
- } catch (r) {
1213
- warn(r), this.onerror(r);
1207
+ } catch (o) {
1208
+ warn(o), this.onerror(o);
1214
1209
  }
1215
1210
  return t;
1216
1211
  }
@@ -1221,14 +1216,14 @@ class SyncWaterfallHook extends SyncHook {
1221
1216
  class AsyncWaterfallHook extends SyncHook {
1222
1217
  emit(t) {
1223
1218
  isObject(t) || error(`The response data for the "${this.type}" hook must be an object.`);
1224
- const o = Array.from(this.listeners);
1225
- if (o.length > 0) {
1226
- let r = 0;
1219
+ const r = Array.from(this.listeners);
1220
+ if (r.length > 0) {
1221
+ let o = 0;
1227
1222
  const s = (a) => (warn(a), this.onerror(a), t), l = (a) => {
1228
1223
  if (checkReturnData(t, a)) {
1229
- if (t = a, r < o.length)
1224
+ if (t = a, o < r.length)
1230
1225
  try {
1231
- return Promise.resolve(o[r++](t)).then(l, s);
1226
+ return Promise.resolve(r[o++](t)).then(l, s);
1232
1227
  } catch (i) {
1233
1228
  return s(i);
1234
1229
  }
@@ -1247,25 +1242,25 @@ class AsyncWaterfallHook extends SyncHook {
1247
1242
  class PluginSystem {
1248
1243
  applyPlugin(t) {
1249
1244
  assert(isPlainObject(t), "Plugin configuration is invalid.");
1250
- const o = t.name;
1251
- assert(o, "A name must be provided by the plugin."), this.registerPlugins[o] || (this.registerPlugins[o] = t, Object.keys(this.lifecycle).forEach((r) => {
1252
- const s = t[r];
1253
- s && this.lifecycle[r].on(s);
1245
+ const r = t.name;
1246
+ assert(r, "A name must be provided by the plugin."), this.registerPlugins[r] || (this.registerPlugins[r] = t, Object.keys(this.lifecycle).forEach((o) => {
1247
+ const s = t[o];
1248
+ s && this.lifecycle[o].on(s);
1254
1249
  }));
1255
1250
  }
1256
1251
  removePlugin(t) {
1257
1252
  assert(t, "A name is required.");
1258
- const o = this.registerPlugins[t];
1259
- assert(o, `The plugin "${t}" is not registered.`), Object.keys(o).forEach((r) => {
1260
- r !== "name" && this.lifecycle[r].remove(o[r]);
1253
+ const r = this.registerPlugins[t];
1254
+ assert(r, `The plugin "${t}" is not registered.`), Object.keys(r).forEach((o) => {
1255
+ o !== "name" && this.lifecycle[o].remove(r[o]);
1261
1256
  });
1262
1257
  }
1263
1258
  // eslint-disable-next-line @typescript-eslint/no-shadow
1264
- inherit({ lifecycle: t, registerPlugins: o }) {
1265
- Object.keys(t).forEach((r) => {
1266
- assert(!this.lifecycle[r], `The hook "${r}" has a conflict and cannot be inherited.`), this.lifecycle[r] = t[r];
1267
- }), Object.keys(o).forEach((r) => {
1268
- assert(!this.registerPlugins[r], `The plugin "${r}" has a conflict and cannot be inherited.`), this.applyPlugin(o[r]);
1259
+ inherit({ lifecycle: t, registerPlugins: r }) {
1260
+ Object.keys(t).forEach((o) => {
1261
+ assert(!this.lifecycle[o], `The hook "${o}" has a conflict and cannot be inherited.`), this.lifecycle[o] = t[o];
1262
+ }), Object.keys(r).forEach((o) => {
1263
+ assert(!this.registerPlugins[o], `The plugin "${o}" has a conflict and cannot be inherited.`), this.applyPlugin(r[o]);
1269
1264
  });
1270
1265
  }
1271
1266
  constructor(t) {
@@ -1281,22 +1276,22 @@ function defaultPreloadArgs(n) {
1281
1276
  }, n);
1282
1277
  }
1283
1278
  function formatPreloadArgs(n, t) {
1284
- return t.map((o) => {
1285
- const r = matchRemote(n, o.nameOrAlias);
1286
- return assert(r, `Unable to preload ${o.nameOrAlias} as it is not included in ${!r && safeToString({
1287
- remoteInfo: r,
1279
+ return t.map((r) => {
1280
+ const o = matchRemote(n, r.nameOrAlias);
1281
+ return assert(o, `Unable to preload ${r.nameOrAlias} as it is not included in ${!o && safeToString({
1282
+ remoteInfo: o,
1288
1283
  remotes: n
1289
1284
  })}`), {
1290
- remote: r,
1291
- preloadConfig: defaultPreloadArgs(o)
1285
+ remote: o,
1286
+ preloadConfig: defaultPreloadArgs(r)
1292
1287
  };
1293
1288
  });
1294
1289
  }
1295
1290
  function normalizePreloadExposes(n) {
1296
1291
  return n ? n.map((t) => t === "." ? t : t.startsWith("./") ? t.replace("./", "") : t) : [];
1297
1292
  }
1298
- function preloadAssets(n, t, o, r = !0) {
1299
- const { cssAssets: s, jsAssetsWithoutEntry: l, entryAssets: a } = o;
1293
+ function preloadAssets(n, t, r, o = !0) {
1294
+ const { cssAssets: s, jsAssetsWithoutEntry: l, entryAssets: a } = r;
1300
1295
  if (t.options.inBrowser) {
1301
1296
  if (a.forEach((i) => {
1302
1297
  const { moduleInfo: c } = i, u = t.moduleCache.get(n.name);
@@ -1309,7 +1304,7 @@ function preloadAssets(n, t, o, r = !0) {
1309
1304
  remoteInfo: c,
1310
1305
  remoteEntryExports: void 0
1311
1306
  });
1312
- }), r) {
1307
+ }), o) {
1313
1308
  const i = {
1314
1309
  rel: "preload",
1315
1310
  as: "style"
@@ -1320,10 +1315,10 @@ function preloadAssets(n, t, o, r = !0) {
1320
1315
  cb: () => {
1321
1316
  },
1322
1317
  attrs: i,
1323
- createLinkHook: (m, p) => {
1318
+ createLinkHook: (p, m) => {
1324
1319
  const y = t.loaderHook.lifecycle.createLink.emit({
1325
- url: m,
1326
- attrs: p
1320
+ url: p,
1321
+ attrs: m
1327
1322
  });
1328
1323
  if (y instanceof HTMLLinkElement)
1329
1324
  return y;
@@ -1342,10 +1337,10 @@ function preloadAssets(n, t, o, r = !0) {
1342
1337
  cb: () => {
1343
1338
  },
1344
1339
  attrs: i,
1345
- createLinkHook: (m, p) => {
1340
+ createLinkHook: (p, m) => {
1346
1341
  const y = t.loaderHook.lifecycle.createLink.emit({
1347
- url: m,
1348
- attrs: p
1342
+ url: p,
1343
+ attrs: m
1349
1344
  });
1350
1345
  if (y instanceof HTMLLinkElement)
1351
1346
  return y;
@@ -1355,7 +1350,7 @@ function preloadAssets(n, t, o, r = !0) {
1355
1350
  d && document.head.appendChild(u);
1356
1351
  });
1357
1352
  }
1358
- if (r) {
1353
+ if (o) {
1359
1354
  const i = {
1360
1355
  rel: "preload",
1361
1356
  as: "script"
@@ -1366,10 +1361,10 @@ function preloadAssets(n, t, o, r = !0) {
1366
1361
  cb: () => {
1367
1362
  },
1368
1363
  attrs: i,
1369
- createLinkHook: (m, p) => {
1364
+ createLinkHook: (p, m) => {
1370
1365
  const y = t.loaderHook.lifecycle.createLink.emit({
1371
- url: m,
1372
- attrs: p
1366
+ url: p,
1367
+ attrs: m
1373
1368
  });
1374
1369
  if (y instanceof HTMLLinkElement)
1375
1370
  return y;
@@ -1388,10 +1383,10 @@ function preloadAssets(n, t, o, r = !0) {
1388
1383
  cb: () => {
1389
1384
  },
1390
1385
  attrs: i,
1391
- createScriptHook: (m, p) => {
1386
+ createScriptHook: (p, m) => {
1392
1387
  const y = t.loaderHook.lifecycle.createScript.emit({
1393
- url: m,
1394
- attrs: p
1388
+ url: p,
1389
+ attrs: m
1395
1390
  });
1396
1391
  if (y instanceof HTMLScriptElement)
1397
1392
  return y;
@@ -1404,25 +1399,25 @@ function preloadAssets(n, t, o, r = !0) {
1404
1399
  }
1405
1400
  }
1406
1401
  function assignRemoteInfo(n, t) {
1407
- const o = getRemoteEntryInfoFromSnapshot(t);
1408
- o.url || error(`The attribute remoteEntry of ${n.name} must not be undefined.`);
1409
- let r = getResourceUrl(t, o.url);
1410
- !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;
1402
+ const r = getRemoteEntryInfoFromSnapshot(t);
1403
+ r.url || error(`The attribute remoteEntry of ${n.name} must not be undefined.`);
1404
+ let o = getResourceUrl(t, r.url);
1405
+ !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;
1411
1406
  }
1412
1407
  function snapshotPlugin() {
1413
1408
  return {
1414
1409
  name: "snapshot-plugin",
1415
1410
  async afterResolve(n) {
1416
- const { remote: t, pkgNameOrAlias: o, expose: r, origin: s, remoteInfo: l } = n;
1411
+ const { remote: t, pkgNameOrAlias: r, expose: o, origin: s, remoteInfo: l } = n;
1417
1412
  if (!isRemoteInfoWithEntry(t) || !isPureRemoteEntry(t)) {
1418
1413
  const { remoteSnapshot: a, globalSnapshot: i } = await s.snapshotHandler.loadRemoteSnapshotInfo(t);
1419
1414
  assignRemoteInfo(l, a);
1420
1415
  const c = {
1421
1416
  remote: t,
1422
1417
  preloadConfig: {
1423
- nameOrAlias: o,
1418
+ nameOrAlias: r,
1424
1419
  exposes: [
1425
- r
1420
+ o
1426
1421
  ],
1427
1422
  resourceCategory: "sync",
1428
1423
  share: !1,
@@ -1457,101 +1452,101 @@ function splitId(n) {
1457
1452
  version: t[2]
1458
1453
  };
1459
1454
  }
1460
- function traverseModuleInfo(n, t, o, r, s = {}, l) {
1455
+ function traverseModuleInfo(n, t, r, o, s = {}, l) {
1461
1456
  const a = getFMId(t), { value: i } = getInfoWithoutType(n, a), c = l || i;
1462
- if (c && !isManifestProvider(c) && (o(c, t, r), c.remotesInfo)) {
1457
+ if (c && !isManifestProvider(c) && (r(c, t, o), c.remotesInfo)) {
1463
1458
  const u = Object.keys(c.remotesInfo);
1464
1459
  for (const d of u) {
1465
1460
  if (s[d])
1466
1461
  continue;
1467
1462
  s[d] = !0;
1468
- const m = splitId(d), p = c.remotesInfo[d];
1463
+ const p = splitId(d), m = c.remotesInfo[d];
1469
1464
  traverseModuleInfo(n, {
1470
- name: m.name,
1471
- version: p.matchedVersion
1472
- }, o, !1, s, void 0);
1465
+ name: p.name,
1466
+ version: m.matchedVersion
1467
+ }, r, !1, s, void 0);
1473
1468
  }
1474
1469
  }
1475
1470
  }
1476
1471
  const isExisted = (n, t) => document.querySelector(`${n}[${n === "link" ? "href" : "src"}="${t}"]`);
1477
- function generatePreloadAssets(n, t, o, r, s) {
1478
- const l = [], a = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: d } = n, { preloadConfig: m } = t, { depsRemote: p } = m;
1479
- if (traverseModuleInfo(r, o, (_, b, v) => {
1480
- let I;
1472
+ function generatePreloadAssets(n, t, r, o, s) {
1473
+ const l = [], a = [], i = [], c = /* @__PURE__ */ new Set(), u = /* @__PURE__ */ new Set(), { options: d } = n, { preloadConfig: p } = t, { depsRemote: m } = p;
1474
+ if (traverseModuleInfo(o, r, (_, g, v) => {
1475
+ let S;
1481
1476
  if (v)
1482
- I = m;
1483
- else if (Array.isArray(p)) {
1484
- const O = p.find((w) => w.nameOrAlias === b.name || w.nameOrAlias === b.alias);
1485
- if (!O)
1477
+ S = p;
1478
+ else if (Array.isArray(m)) {
1479
+ const N = m.find((O) => O.nameOrAlias === g.name || O.nameOrAlias === g.alias);
1480
+ if (!N)
1486
1481
  return;
1487
- I = defaultPreloadArgs(O);
1488
- } else if (p === !0)
1489
- I = m;
1482
+ S = defaultPreloadArgs(N);
1483
+ } else if (m === !0)
1484
+ S = p;
1490
1485
  else
1491
1486
  return;
1492
- const S = getResourceUrl(_, getRemoteEntryInfoFromSnapshot(_).url);
1493
- S && i.push({
1494
- name: b.name,
1487
+ const I = getResourceUrl(_, getRemoteEntryInfoFromSnapshot(_).url);
1488
+ I && i.push({
1489
+ name: g.name,
1495
1490
  moduleInfo: {
1496
- name: b.name,
1497
- entry: S,
1491
+ name: g.name,
1492
+ entry: I,
1498
1493
  type: "remoteEntryType" in _ ? _.remoteEntryType : "global",
1499
- entryGlobalName: "globalName" in _ ? _.globalName : b.name,
1494
+ entryGlobalName: "globalName" in _ ? _.globalName : g.name,
1500
1495
  shareScope: "",
1501
1496
  version: "version" in _ ? _.version : void 0
1502
1497
  },
1503
- url: S
1498
+ url: I
1504
1499
  });
1505
1500
  let R = "modules" in _ ? _.modules : [];
1506
- const $ = normalizePreloadExposes(I.exposes);
1507
- if ($.length && "modules" in _) {
1501
+ const A = normalizePreloadExposes(S.exposes);
1502
+ if (A.length && "modules" in _) {
1508
1503
  var T;
1509
- R = _ == null || (T = _.modules) == null ? void 0 : T.reduce((O, w) => (($ == null ? void 0 : $.indexOf(w.moduleName)) !== -1 && O.push(w), O), []);
1504
+ R = _ == null || (T = _.modules) == null ? void 0 : T.reduce((N, O) => ((A == null ? void 0 : A.indexOf(O.moduleName)) !== -1 && N.push(O), N), []);
1510
1505
  }
1511
- function A(O) {
1512
- const w = O.map((M) => getResourceUrl(_, M));
1513
- return I.filter ? w.filter(I.filter) : w;
1506
+ function $(N) {
1507
+ const O = N.map((w) => getResourceUrl(_, w));
1508
+ return S.filter ? O.filter(S.filter) : O;
1514
1509
  }
1515
1510
  if (R) {
1516
- const O = R.length;
1517
- for (let w = 0; w < O; w++) {
1518
- const M = R[w], N = `${b.name}/${M.moduleName}`;
1511
+ const N = R.length;
1512
+ for (let O = 0; O < N; O++) {
1513
+ const w = R[O], P = `${g.name}/${w.moduleName}`;
1519
1514
  n.remoteHandler.hooks.lifecycle.handlePreloadModule.emit({
1520
- id: M.moduleName === "." ? b.name : N,
1521
- name: b.name,
1515
+ id: w.moduleName === "." ? g.name : P,
1516
+ name: g.name,
1522
1517
  remoteSnapshot: _,
1523
- preloadConfig: I,
1524
- remote: b,
1518
+ preloadConfig: S,
1519
+ remote: g,
1525
1520
  origin: n
1526
- }), !getPreloaded(N) && (I.resourceCategory === "all" ? (l.push(...A(M.assets.css.async)), l.push(...A(M.assets.css.sync)), a.push(...A(M.assets.js.async)), a.push(...A(M.assets.js.sync))) : (I.resourceCategory = "sync") && (l.push(...A(M.assets.css.sync)), a.push(...A(M.assets.js.sync))), setPreloaded(N));
1521
+ }), !getPreloaded(P) && (S.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))) : (S.resourceCategory = "sync") && (l.push(...$(w.assets.css.sync)), a.push(...$(w.assets.js.sync))), setPreloaded(P));
1527
1522
  }
1528
1523
  }
1529
1524
  }, !0, {}, s), s.shared) {
1530
- const _ = (b, v) => {
1531
- const I = getRegisteredShare(n.shareScopeMap, v.sharedName, b, n.sharedHandler.hooks.lifecycle.resolveShare);
1532
- I && typeof I.lib == "function" && (v.assets.js.sync.forEach((S) => {
1533
- c.add(S);
1534
- }), v.assets.css.sync.forEach((S) => {
1535
- u.add(S);
1525
+ const _ = (g, v) => {
1526
+ const S = getRegisteredShare(n.shareScopeMap, v.sharedName, g, n.sharedHandler.hooks.lifecycle.resolveShare);
1527
+ S && typeof S.lib == "function" && (v.assets.js.sync.forEach((I) => {
1528
+ c.add(I);
1529
+ }), v.assets.css.sync.forEach((I) => {
1530
+ u.add(I);
1536
1531
  }));
1537
1532
  };
1538
- s.shared.forEach((b) => {
1533
+ s.shared.forEach((g) => {
1539
1534
  var v;
1540
- const I = (v = d.shared) == null ? void 0 : v[b.sharedName];
1541
- if (!I)
1542
- return;
1543
- const S = b.version ? I.find(($) => $.version === b.version) : I;
1535
+ const S = (v = d.shared) == null ? void 0 : v[g.sharedName];
1544
1536
  if (!S)
1545
1537
  return;
1546
- arrayOptions(S).forEach(($) => {
1547
- _($, b);
1538
+ const I = g.version ? S.find((A) => A.version === g.version) : S;
1539
+ if (!I)
1540
+ return;
1541
+ arrayOptions(I).forEach((A) => {
1542
+ _(A, g);
1548
1543
  });
1549
1544
  });
1550
1545
  }
1551
- const g = a.filter((_) => !c.has(_) && !isExisted("script", _));
1546
+ const E = a.filter((_) => !c.has(_) && !isExisted("script", _));
1552
1547
  return {
1553
1548
  cssAssets: l.filter((_) => !u.has(_) && !isExisted("link", _)),
1554
- jsAssetsWithoutEntry: g,
1549
+ jsAssetsWithoutEntry: E,
1555
1550
  entryAssets: i.filter((_) => !isExisted("script", _.url))
1556
1551
  };
1557
1552
  }
@@ -1559,7 +1554,7 @@ const generatePreloadAssetsPlugin = function() {
1559
1554
  return {
1560
1555
  name: "generate-preload-assets-plugin",
1561
1556
  async generatePreloadAssets(n) {
1562
- const { origin: t, preloadOptions: o, remoteInfo: r, remote: s, globalSnapshot: l, remoteSnapshot: a } = n;
1557
+ const { origin: t, preloadOptions: r, remoteInfo: o, remote: s, globalSnapshot: l, remoteSnapshot: a } = n;
1563
1558
  return isBrowserEnv() ? isRemoteInfoWithEntry(s) && isPureRemoteEntry(s) ? {
1564
1559
  cssAssets: [],
1565
1560
  jsAssetsWithoutEntry: [],
@@ -1568,15 +1563,15 @@ const generatePreloadAssetsPlugin = function() {
1568
1563
  name: s.name,
1569
1564
  url: s.entry,
1570
1565
  moduleInfo: {
1571
- name: r.name,
1566
+ name: o.name,
1572
1567
  entry: s.entry,
1573
- type: r.type || "global",
1568
+ type: o.type || "global",
1574
1569
  entryGlobalName: "",
1575
1570
  shareScope: ""
1576
1571
  }
1577
1572
  }
1578
1573
  ]
1579
- } : (assignRemoteInfo(r, a), generatePreloadAssets(t, o, r, l, a)) : {
1574
+ } : (assignRemoteInfo(o, a), generatePreloadAssets(t, r, o, l, a)) : {
1580
1575
  cssAssets: [],
1581
1576
  jsAssetsWithoutEntry: [],
1582
1577
  entryAssets: []
@@ -1585,16 +1580,16 @@ const generatePreloadAssetsPlugin = function() {
1585
1580
  };
1586
1581
  };
1587
1582
  function getGlobalRemoteInfo(n, t) {
1588
- const o = getGlobalSnapshotInfoByModuleInfo({
1583
+ const r = getGlobalSnapshotInfoByModuleInfo({
1589
1584
  name: t.options.name,
1590
1585
  version: t.options.version
1591
- }), r = o && "remotesInfo" in o && o.remotesInfo && getInfoWithoutType(o.remotesInfo, n.name).value;
1592
- return r && r.matchedVersion ? {
1593
- hostGlobalSnapshot: o,
1586
+ }), o = r && "remotesInfo" in r && r.remotesInfo && getInfoWithoutType(r.remotesInfo, n.name).value;
1587
+ return o && o.matchedVersion ? {
1588
+ hostGlobalSnapshot: r,
1594
1589
  globalSnapshot: getGlobalSnapshot(),
1595
1590
  remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({
1596
1591
  name: n.name,
1597
- version: r.matchedVersion
1592
+ version: o.matchedVersion
1598
1593
  })
1599
1594
  } : {
1600
1595
  hostGlobalSnapshot: void 0,
@@ -1607,10 +1602,10 @@ function getGlobalRemoteInfo(n, t) {
1607
1602
  }
1608
1603
  class SnapshotHandler {
1609
1604
  async loadSnapshot(t) {
1610
- const { options: o } = this.HostInstance, { hostGlobalSnapshot: r, remoteSnapshot: s, globalSnapshot: l } = this.getGlobalRemoteInfo(t), { remoteSnapshot: a, globalSnapshot: i } = await this.hooks.lifecycle.loadSnapshot.emit({
1611
- options: o,
1605
+ const { options: r } = this.HostInstance, { hostGlobalSnapshot: o, remoteSnapshot: s, globalSnapshot: l } = this.getGlobalRemoteInfo(t), { remoteSnapshot: a, globalSnapshot: i } = await this.hooks.lifecycle.loadSnapshot.emit({
1606
+ options: r,
1612
1607
  moduleInfo: t,
1613
- hostGlobalSnapshot: r,
1608
+ hostGlobalSnapshot: o,
1614
1609
  remoteSnapshot: s,
1615
1610
  globalSnapshot: l
1616
1611
  });
@@ -1621,28 +1616,28 @@ class SnapshotHandler {
1621
1616
  }
1622
1617
  // eslint-disable-next-line max-lines-per-function
1623
1618
  async loadRemoteSnapshotInfo(t) {
1624
- const { options: o } = this.HostInstance;
1619
+ const { options: r } = this.HostInstance;
1625
1620
  await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
1626
- options: o,
1621
+ options: r,
1627
1622
  moduleInfo: t
1628
1623
  });
1629
- let r = getGlobalSnapshotInfoByModuleInfo({
1624
+ let o = getGlobalSnapshotInfoByModuleInfo({
1630
1625
  name: this.HostInstance.options.name,
1631
1626
  version: this.HostInstance.options.version
1632
1627
  });
1633
- r || (r = {
1628
+ o || (o = {
1634
1629
  version: this.HostInstance.options.version || "",
1635
1630
  remoteEntry: "",
1636
1631
  remotesInfo: {}
1637
1632
  }, addGlobalSnapshot({
1638
- [this.HostInstance.options.name]: r
1639
- })), r && "remotesInfo" in r && !getInfoWithoutType(r.remotesInfo, t.name).value && ("version" in t || "entry" in t) && (r.remotesInfo = _extends$1({}, r == null ? void 0 : r.remotesInfo, {
1633
+ [this.HostInstance.options.name]: o
1634
+ })), 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, {
1640
1635
  [t.name]: {
1641
1636
  matchedVersion: "version" in t ? t.version : t.entry
1642
1637
  }
1643
1638
  }));
1644
1639
  const { hostGlobalSnapshot: s, remoteSnapshot: l, globalSnapshot: a } = this.getGlobalRemoteInfo(t), { remoteSnapshot: i, globalSnapshot: c } = await this.hooks.lifecycle.loadSnapshot.emit({
1645
- options: o,
1640
+ options: r,
1646
1641
  moduleInfo: t,
1647
1642
  hostGlobalSnapshot: s,
1648
1643
  remoteSnapshot: l,
@@ -1651,29 +1646,29 @@ class SnapshotHandler {
1651
1646
  let u, d;
1652
1647
  if (i)
1653
1648
  if (isManifestProvider(i)) {
1654
- const m = isBrowserEnv() ? i.remoteEntry : i.ssrRemoteEntry || i.remoteEntry || "", p = await this.getManifestJson(m, t, {}), y = setGlobalSnapshotInfoByModuleInfo(_extends$1({}, t, {
1649
+ const p = isBrowserEnv() ? i.remoteEntry : i.ssrRemoteEntry || i.remoteEntry || "", m = await this.getManifestJson(p, t, {}), y = setGlobalSnapshotInfoByModuleInfo(_extends$1({}, t, {
1655
1650
  // The global remote may be overridden
1656
1651
  // Therefore, set the snapshot key to the global address of the actual request
1657
- entry: m
1658
- }), p);
1659
- u = p, d = y;
1652
+ entry: p
1653
+ }), m);
1654
+ u = m, d = y;
1660
1655
  } else {
1661
- const { remoteSnapshot: m } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1656
+ const { remoteSnapshot: p } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1662
1657
  options: this.HostInstance.options,
1663
1658
  moduleInfo: t,
1664
1659
  remoteSnapshot: i,
1665
1660
  from: "global"
1666
1661
  });
1667
- u = m, d = c;
1662
+ u = p, d = c;
1668
1663
  }
1669
1664
  else if (isRemoteInfoWithEntry(t)) {
1670
- const m = await this.getManifestJson(t.entry, t, {}), p = setGlobalSnapshotInfoByModuleInfo(t, m), { remoteSnapshot: y } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1665
+ const p = await this.getManifestJson(t.entry, t, {}), m = setGlobalSnapshotInfoByModuleInfo(t, p), { remoteSnapshot: y } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1671
1666
  options: this.HostInstance.options,
1672
1667
  moduleInfo: t,
1673
- remoteSnapshot: m,
1668
+ remoteSnapshot: p,
1674
1669
  from: "global"
1675
1670
  });
1676
- u = y, d = p;
1671
+ u = y, d = m;
1677
1672
  } else
1678
1673
  error(getShortErrorMsg(RUNTIME_007, runtimeDescMap, {
1679
1674
  hostName: t.name,
@@ -1681,7 +1676,7 @@ class SnapshotHandler {
1681
1676
  globalSnapshot: JSON.stringify(c)
1682
1677
  }));
1683
1678
  return await this.hooks.lifecycle.afterLoadSnapshot.emit({
1684
- options: o,
1679
+ options: r,
1685
1680
  moduleInfo: t,
1686
1681
  remoteSnapshot: u
1687
1682
  }), {
@@ -1692,7 +1687,7 @@ class SnapshotHandler {
1692
1687
  getGlobalRemoteInfo(t) {
1693
1688
  return getGlobalRemoteInfo(t, this.HostInstance);
1694
1689
  }
1695
- async getManifestJson(t, o, r) {
1690
+ async getManifestJson(t, r, o) {
1696
1691
  const s = async () => {
1697
1692
  let a = this.manifestCache.get(t);
1698
1693
  if (a)
@@ -1709,7 +1704,7 @@ class SnapshotHandler {
1709
1704
  origin: this.HostInstance
1710
1705
  }), a || (delete this.manifestLoading[t], error(getShortErrorMsg(RUNTIME_003, runtimeDescMap, {
1711
1706
  manifestUrl: t,
1712
- moduleName: o.name,
1707
+ moduleName: r.name,
1713
1708
  hostName: this.HostInstance.options.name
1714
1709
  }, `${i}`)));
1715
1710
  }
@@ -1719,7 +1714,7 @@ class SnapshotHandler {
1719
1714
  version: t
1720
1715
  }), { remoteSnapshot: c } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
1721
1716
  options: this.HostInstance.options,
1722
- moduleInfo: o,
1717
+ moduleInfo: r,
1723
1718
  manifestJson: a,
1724
1719
  remoteSnapshot: i,
1725
1720
  manifestUrl: t,
@@ -1740,29 +1735,29 @@ class SnapshotHandler {
1740
1735
  }
1741
1736
  class SharedHandler {
1742
1737
  // register shared in shareScopeMap
1743
- registerShared(t, o) {
1744
- const { shareInfos: r, shared: s } = formatShareConfigs(t, o);
1745
- return Object.keys(r).forEach((a) => {
1746
- r[a].forEach((c) => {
1738
+ registerShared(t, r) {
1739
+ const { shareInfos: o, shared: s } = formatShareConfigs(t, r);
1740
+ return Object.keys(o).forEach((a) => {
1741
+ o[a].forEach((c) => {
1747
1742
  !getRegisteredShare(this.shareScopeMap, a, c, this.hooks.lifecycle.resolveShare) && c && c.lib && this.setShared({
1748
1743
  pkgName: a,
1749
1744
  lib: c.lib,
1750
1745
  get: c.get,
1751
1746
  loaded: !0,
1752
1747
  shared: c,
1753
- from: o.name
1748
+ from: r.name
1754
1749
  });
1755
1750
  });
1756
1751
  }), {
1757
- shareInfos: r,
1752
+ shareInfos: o,
1758
1753
  shared: s
1759
1754
  };
1760
1755
  }
1761
- async loadShare(t, o) {
1762
- const { host: r } = this, s = getTargetSharedOptions({
1756
+ async loadShare(t, r) {
1757
+ const { host: o } = this, s = getTargetSharedOptions({
1763
1758
  pkgName: t,
1764
- extraOptions: o,
1765
- shareInfos: r.options.shared
1759
+ extraOptions: r,
1760
+ shareInfos: o.options.shared
1766
1761
  });
1767
1762
  s != null && s.scope && await Promise.all(s.scope.map(async (u) => {
1768
1763
  await Promise.all(this.initializeSharing(u, {
@@ -1772,12 +1767,12 @@ class SharedHandler {
1772
1767
  const l = await this.hooks.lifecycle.beforeLoadShare.emit({
1773
1768
  pkgName: t,
1774
1769
  shareInfo: s,
1775
- shared: r.options.shared,
1776
- origin: r
1770
+ shared: o.options.shared,
1771
+ origin: o
1777
1772
  }), { shareInfo: a } = l;
1778
- assert(a, `Cannot find ${t} Share in the ${r.options.name}. Please ensure that the ${t} Share parameters have been injected`);
1773
+ assert(a, `Cannot find ${t} Share in the ${o.options.name}. Please ensure that the ${t} Share parameters have been injected`);
1779
1774
  const i = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare), c = (u) => {
1780
- u.useIn || (u.useIn = []), addUniqueItem(u.useIn, r.options.name);
1775
+ u.useIn || (u.useIn = []), addUniqueItem(u.useIn, o.options.name);
1781
1776
  };
1782
1777
  if (i && i.lib)
1783
1778
  return c(i), i.lib;
@@ -1786,33 +1781,33 @@ class SharedHandler {
1786
1781
  return i.loaded = !0, i.lib || (i.lib = u), c(i), u;
1787
1782
  } else if (i) {
1788
1783
  const d = (async () => {
1789
- const m = await i.get();
1790
- a.lib = m, a.loaded = !0, c(a);
1791
- const p = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare);
1792
- return p && (p.lib = m, p.loaded = !0), m;
1784
+ const p = await i.get();
1785
+ a.lib = p, a.loaded = !0, c(a);
1786
+ const m = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare);
1787
+ return m && (m.lib = p, m.loaded = !0), p;
1793
1788
  })();
1794
1789
  return this.setShared({
1795
1790
  pkgName: t,
1796
1791
  loaded: !1,
1797
1792
  shared: i,
1798
- from: r.options.name,
1793
+ from: o.options.name,
1799
1794
  lib: null,
1800
1795
  loading: d
1801
1796
  }), d;
1802
1797
  } else {
1803
- if (o != null && o.customShareInfo)
1798
+ if (r != null && r.customShareInfo)
1804
1799
  return !1;
1805
1800
  const d = (async () => {
1806
- const m = await a.get();
1807
- a.lib = m, a.loaded = !0, c(a);
1808
- const p = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare);
1809
- return p && (p.lib = m, p.loaded = !0), m;
1801
+ const p = await a.get();
1802
+ a.lib = p, a.loaded = !0, c(a);
1803
+ const m = getRegisteredShare(this.shareScopeMap, t, a, this.hooks.lifecycle.resolveShare);
1804
+ return m && (m.lib = p, m.loaded = !0), p;
1810
1805
  })();
1811
1806
  return this.setShared({
1812
1807
  pkgName: t,
1813
1808
  loaded: !1,
1814
1809
  shared: a,
1815
- from: r.options.name,
1810
+ from: o.options.name,
1816
1811
  lib: null,
1817
1812
  loading: d
1818
1813
  }), d;
@@ -1824,64 +1819,64 @@ class SharedHandler {
1824
1819
  * If the share scope does not exist, it creates one.
1825
1820
  */
1826
1821
  // eslint-disable-next-line @typescript-eslint/member-ordering
1827
- initializeSharing(t = DEFAULT_SCOPE, o) {
1828
- const { host: r } = this, s = o == null ? void 0 : o.from, l = o == null ? void 0 : o.strategy;
1829
- let a = o == null ? void 0 : o.initScope;
1822
+ initializeSharing(t = DEFAULT_SCOPE, r) {
1823
+ const { host: o } = this, s = r == null ? void 0 : r.from, l = r == null ? void 0 : r.strategy;
1824
+ let a = r == null ? void 0 : r.initScope;
1830
1825
  const i = [];
1831
1826
  if (s !== "build") {
1832
- const { initTokens: g } = this;
1827
+ const { initTokens: E } = this;
1833
1828
  a || (a = []);
1834
- let E = g[t];
1835
- if (E || (E = g[t] = {
1829
+ let b = E[t];
1830
+ if (b || (b = E[t] = {
1836
1831
  from: this.host.name
1837
- }), a.indexOf(E) >= 0) return i;
1838
- a.push(E);
1832
+ }), a.indexOf(b) >= 0) return i;
1833
+ a.push(b);
1839
1834
  }
1840
- const c = this.shareScopeMap, u = r.options.name;
1835
+ const c = this.shareScopeMap, u = o.options.name;
1841
1836
  c[t] || (c[t] = {});
1842
- const d = c[t], m = (g, E) => {
1837
+ const d = c[t], p = (E, b) => {
1843
1838
  var _;
1844
- const { version: b, eager: v } = E;
1845
- d[g] = d[g] || {};
1846
- const I = d[g], S = I[b], R = !!(S && (S.eager || (_ = S.shareConfig) != null && _.eager));
1847
- (!S || S.strategy !== "loaded-first" && !S.loaded && (!v != !R ? v : u > S.from)) && (I[b] = E);
1848
- }, p = (g) => g && g.init && g.init(c[t], a), y = async (g) => {
1849
- const { module: E } = await r.remoteHandler.getRemoteModuleAndOptions({
1850
- id: g
1839
+ const { version: g, eager: v } = b;
1840
+ d[E] = d[E] || {};
1841
+ const S = d[E], I = S[g], R = !!(I && (I.eager || (_ = I.shareConfig) != null && _.eager));
1842
+ (!I || I.strategy !== "loaded-first" && !I.loaded && (!v != !R ? v : u > I.from)) && (S[g] = b);
1843
+ }, m = (E) => E && E.init && E.init(c[t], a), y = async (E) => {
1844
+ const { module: b } = await o.remoteHandler.getRemoteModuleAndOptions({
1845
+ id: E
1851
1846
  });
1852
- if (E.getEntry) {
1847
+ if (b.getEntry) {
1853
1848
  let _;
1854
1849
  try {
1855
- _ = await E.getEntry();
1856
- } catch (b) {
1857
- _ = await r.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
1858
- id: g,
1859
- error: b,
1850
+ _ = await b.getEntry();
1851
+ } catch (g) {
1852
+ _ = await o.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
1853
+ id: E,
1854
+ error: g,
1860
1855
  from: "runtime",
1861
1856
  lifecycle: "beforeLoadShare",
1862
- origin: r
1857
+ origin: o
1863
1858
  });
1864
1859
  }
1865
- E.inited || (await p(_), E.inited = !0);
1860
+ b.inited || (await m(_), b.inited = !0);
1866
1861
  }
1867
1862
  };
1868
- return Object.keys(r.options.shared).forEach((g) => {
1869
- r.options.shared[g].forEach((_) => {
1870
- _.scope.includes(t) && m(g, _);
1863
+ return Object.keys(o.options.shared).forEach((E) => {
1864
+ o.options.shared[E].forEach((_) => {
1865
+ _.scope.includes(t) && p(E, _);
1871
1866
  });
1872
- }), (r.options.shareStrategy === "version-first" || l === "version-first") && r.options.remotes.forEach((g) => {
1873
- g.shareScope === t && i.push(y(g.name));
1867
+ }), (o.options.shareStrategy === "version-first" || l === "version-first") && o.options.remotes.forEach((E) => {
1868
+ E.shareScope === t && i.push(y(E.name));
1874
1869
  }), i;
1875
1870
  }
1876
1871
  // The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
1877
1872
  // 1. If the loaded shared already exists globally, then it will be reused
1878
1873
  // 2. If lib exists in local shared, it will be used directly
1879
1874
  // 3. If the local get returns something other than Promise, then it will be used directly
1880
- loadShareSync(t, o) {
1881
- const { host: r } = this, s = getTargetSharedOptions({
1875
+ loadShareSync(t, r) {
1876
+ const { host: o } = this, s = getTargetSharedOptions({
1882
1877
  pkgName: t,
1883
- extraOptions: o,
1884
- shareInfos: r.options.shared
1878
+ extraOptions: r,
1879
+ shareInfos: o.options.shared
1885
1880
  });
1886
1881
  s != null && s.scope && s.scope.forEach((i) => {
1887
1882
  this.initializeSharing(i, {
@@ -1889,18 +1884,18 @@ class SharedHandler {
1889
1884
  });
1890
1885
  });
1891
1886
  const l = getRegisteredShare(this.shareScopeMap, t, s, this.hooks.lifecycle.resolveShare), a = (i) => {
1892
- i.useIn || (i.useIn = []), addUniqueItem(i.useIn, r.options.name);
1887
+ i.useIn || (i.useIn = []), addUniqueItem(i.useIn, o.options.name);
1893
1888
  };
1894
1889
  if (l) {
1895
1890
  if (typeof l.lib == "function")
1896
- return a(l), l.loaded || (l.loaded = !0, l.from === r.options.name && (s.loaded = !0)), l.lib;
1891
+ return a(l), l.loaded || (l.loaded = !0, l.from === o.options.name && (s.loaded = !0)), l.lib;
1897
1892
  if (typeof l.get == "function") {
1898
1893
  const i = l.get();
1899
1894
  if (!(i instanceof Promise))
1900
1895
  return a(l), this.setShared({
1901
1896
  pkgName: t,
1902
1897
  loaded: !0,
1903
- from: r.options.name,
1898
+ from: o.options.name,
1904
1899
  lib: i,
1905
1900
  shared: l
1906
1901
  }), i;
@@ -1911,45 +1906,45 @@ class SharedHandler {
1911
1906
  if (s.get) {
1912
1907
  const i = s.get();
1913
1908
  if (i instanceof Promise) {
1914
- const c = (o == null ? void 0 : o.from) === "build" ? RUNTIME_005 : RUNTIME_006;
1909
+ const c = (r == null ? void 0 : r.from) === "build" ? RUNTIME_005 : RUNTIME_006;
1915
1910
  throw new Error(getShortErrorMsg(c, runtimeDescMap, {
1916
- hostName: r.options.name,
1911
+ hostName: o.options.name,
1917
1912
  sharedPkgName: t
1918
1913
  }));
1919
1914
  }
1920
1915
  return s.lib = i, this.setShared({
1921
1916
  pkgName: t,
1922
1917
  loaded: !0,
1923
- from: r.options.name,
1918
+ from: o.options.name,
1924
1919
  lib: s.lib,
1925
1920
  shared: s
1926
1921
  }), s.lib;
1927
1922
  }
1928
1923
  throw new Error(getShortErrorMsg(RUNTIME_006, runtimeDescMap, {
1929
- hostName: r.options.name,
1924
+ hostName: o.options.name,
1930
1925
  sharedPkgName: t
1931
1926
  }));
1932
1927
  }
1933
- initShareScopeMap(t, o, r = {}) {
1928
+ initShareScopeMap(t, r, o = {}) {
1934
1929
  const { host: s } = this;
1935
- this.shareScopeMap[t] = o, this.hooks.lifecycle.initContainerShareScopeMap.emit({
1936
- shareScope: o,
1930
+ this.shareScopeMap[t] = r, this.hooks.lifecycle.initContainerShareScopeMap.emit({
1931
+ shareScope: r,
1937
1932
  options: s.options,
1938
1933
  origin: s,
1939
1934
  scopeName: t,
1940
- hostShareScopeMap: r.hostShareScopeMap
1935
+ hostShareScopeMap: o.hostShareScopeMap
1941
1936
  });
1942
1937
  }
1943
- setShared({ pkgName: t, shared: o, from: r, lib: s, loading: l, loaded: a, get: i }) {
1944
- const { version: c, scope: u = "default" } = o, d = _object_without_properties_loose(o, [
1938
+ setShared({ pkgName: t, shared: r, from: o, lib: s, loading: l, loaded: a, get: i }) {
1939
+ const { version: c, scope: u = "default" } = r, d = _object_without_properties_loose(r, [
1945
1940
  "version",
1946
1941
  "scope"
1947
1942
  ]);
1948
1943
  (Array.isArray(u) ? u : [
1949
1944
  u
1950
- ]).forEach((p) => {
1951
- if (this.shareScopeMap[p] || (this.shareScopeMap[p] = {}), this.shareScopeMap[p][t] || (this.shareScopeMap[p][t] = {}), !this.shareScopeMap[p][t][c]) {
1952
- this.shareScopeMap[p][t][c] = _extends$1({
1945
+ ]).forEach((m) => {
1946
+ if (this.shareScopeMap[m] || (this.shareScopeMap[m] = {}), this.shareScopeMap[m][t] || (this.shareScopeMap[m][t] = {}), !this.shareScopeMap[m][t][c]) {
1947
+ this.shareScopeMap[m][t][c] = _extends$1({
1953
1948
  version: c,
1954
1949
  scope: [
1955
1950
  "default"
@@ -1958,16 +1953,16 @@ class SharedHandler {
1958
1953
  lib: s,
1959
1954
  loaded: a,
1960
1955
  loading: l
1961
- }), i && (this.shareScopeMap[p][t][c].get = i);
1956
+ }), i && (this.shareScopeMap[m][t][c].get = i);
1962
1957
  return;
1963
1958
  }
1964
- const y = this.shareScopeMap[p][t][c];
1959
+ const y = this.shareScopeMap[m][t][c];
1965
1960
  l && !y.loading && (y.loading = l);
1966
1961
  });
1967
1962
  }
1968
1963
  _setGlobalShareScopeMap(t) {
1969
- const o = getGlobalShareScope(), r = t.id || t.name;
1970
- r && !o[r] && (o[r] = this.shareScopeMap);
1964
+ const r = getGlobalShareScope(), o = t.id || t.name;
1965
+ o && !r[o] && (r[o] = this.shareScopeMap);
1971
1966
  }
1972
1967
  constructor(t) {
1973
1968
  this.hooks = new PluginSystem({
@@ -1982,20 +1977,20 @@ class SharedHandler {
1982
1977
  }
1983
1978
  }
1984
1979
  class RemoteHandler {
1985
- formatAndRegisterRemote(t, o) {
1986
- return (o.remotes || []).reduce((s, l) => (this.registerRemote(l, s, {
1980
+ formatAndRegisterRemote(t, r) {
1981
+ return (r.remotes || []).reduce((s, l) => (this.registerRemote(l, s, {
1987
1982
  force: !1
1988
1983
  }), s), t.remotes);
1989
1984
  }
1990
- setIdToRemoteMap(t, o) {
1991
- const { remote: r, expose: s } = o, { name: l, alias: a } = r;
1985
+ setIdToRemoteMap(t, r) {
1986
+ const { remote: o, expose: s } = r, { name: l, alias: a } = o;
1992
1987
  if (this.idToRemoteMap[t] = {
1993
- name: r.name,
1988
+ name: o.name,
1994
1989
  expose: s
1995
1990
  }, a && t.startsWith(l)) {
1996
1991
  const i = t.replace(l, a);
1997
1992
  this.idToRemoteMap[i] = {
1998
- name: r.name,
1993
+ name: o.name,
1999
1994
  expose: s
2000
1995
  };
2001
1996
  return;
@@ -2003,22 +1998,22 @@ class RemoteHandler {
2003
1998
  if (a && t.startsWith(a)) {
2004
1999
  const i = t.replace(a, l);
2005
2000
  this.idToRemoteMap[i] = {
2006
- name: r.name,
2001
+ name: o.name,
2007
2002
  expose: s
2008
2003
  };
2009
2004
  }
2010
2005
  }
2011
2006
  // eslint-disable-next-line max-lines-per-function
2012
2007
  // eslint-disable-next-line @typescript-eslint/member-ordering
2013
- async loadRemote(t, o) {
2014
- const { host: r } = this;
2008
+ async loadRemote(t, r) {
2009
+ const { host: o } = this;
2015
2010
  try {
2016
- const { loadFactory: s = !0 } = o || {
2011
+ const { loadFactory: s = !0 } = r || {
2017
2012
  loadFactory: !0
2018
2013
  }, { module: l, moduleOptions: a, remoteMatchInfo: i } = await this.getRemoteModuleAndOptions({
2019
2014
  id: t
2020
- }), { pkgNameOrAlias: c, remote: u, expose: d, id: m, remoteSnapshot: p } = i, y = await l.get(m, d, o, p), g = await this.hooks.lifecycle.onLoad.emit({
2021
- id: m,
2015
+ }), { pkgNameOrAlias: c, remote: u, expose: d, id: p, remoteSnapshot: m } = i, y = await l.get(p, d, r, m), E = await this.hooks.lifecycle.onLoad.emit({
2016
+ id: p,
2022
2017
  pkgNameOrAlias: c,
2023
2018
  expose: d,
2024
2019
  exposeModule: s ? y : void 0,
@@ -2026,18 +2021,18 @@ class RemoteHandler {
2026
2021
  remote: u,
2027
2022
  options: a,
2028
2023
  moduleInstance: l,
2029
- origin: r
2024
+ origin: o
2030
2025
  });
2031
- return this.setIdToRemoteMap(t, i), typeof g == "function" ? g : y;
2026
+ return this.setIdToRemoteMap(t, i), typeof E == "function" ? E : y;
2032
2027
  } catch (s) {
2033
- const { from: l = "runtime" } = o || {
2028
+ const { from: l = "runtime" } = r || {
2034
2029
  from: "runtime"
2035
2030
  }, a = await this.hooks.lifecycle.errorLoadRemote.emit({
2036
2031
  id: t,
2037
2032
  error: s,
2038
2033
  from: l,
2039
2034
  lifecycle: "onLoad",
2040
- origin: r
2035
+ origin: o
2041
2036
  });
2042
2037
  if (!a)
2043
2038
  throw s;
@@ -2046,81 +2041,81 @@ class RemoteHandler {
2046
2041
  }
2047
2042
  // eslint-disable-next-line @typescript-eslint/member-ordering
2048
2043
  async preloadRemote(t) {
2049
- const { host: o } = this;
2044
+ const { host: r } = this;
2050
2045
  await this.hooks.lifecycle.beforePreloadRemote.emit({
2051
2046
  preloadOps: t,
2052
- options: o.options,
2053
- origin: o
2047
+ options: r.options,
2048
+ origin: r
2054
2049
  });
2055
- const r = formatPreloadArgs(o.options.remotes, t);
2056
- await Promise.all(r.map(async (s) => {
2057
- const { remote: l } = s, a = getRemoteInfo(l), { globalSnapshot: i, remoteSnapshot: c } = await o.snapshotHandler.loadRemoteSnapshotInfo(l), u = await this.hooks.lifecycle.generatePreloadAssets.emit({
2058
- origin: o,
2050
+ const o = formatPreloadArgs(r.options.remotes, t);
2051
+ await Promise.all(o.map(async (s) => {
2052
+ const { remote: l } = s, a = getRemoteInfo(l), { globalSnapshot: i, remoteSnapshot: c } = await r.snapshotHandler.loadRemoteSnapshotInfo(l), u = await this.hooks.lifecycle.generatePreloadAssets.emit({
2053
+ origin: r,
2059
2054
  preloadOptions: s,
2060
2055
  remote: l,
2061
2056
  remoteInfo: a,
2062
2057
  globalSnapshot: i,
2063
2058
  remoteSnapshot: c
2064
2059
  });
2065
- u && preloadAssets(a, o, u);
2060
+ u && preloadAssets(a, r, u);
2066
2061
  }));
2067
2062
  }
2068
- registerRemotes(t, o) {
2069
- const { host: r } = this;
2063
+ registerRemotes(t, r) {
2064
+ const { host: o } = this;
2070
2065
  t.forEach((s) => {
2071
- this.registerRemote(s, r.options.remotes, {
2072
- force: o == null ? void 0 : o.force
2066
+ this.registerRemote(s, o.options.remotes, {
2067
+ force: r == null ? void 0 : r.force
2073
2068
  });
2074
2069
  });
2075
2070
  }
2076
2071
  async getRemoteModuleAndOptions(t) {
2077
- const { host: o } = this, { id: r } = t;
2072
+ const { host: r } = this, { id: o } = t;
2078
2073
  let s;
2079
2074
  try {
2080
2075
  s = await this.hooks.lifecycle.beforeRequest.emit({
2081
- id: r,
2082
- options: o.options,
2083
- origin: o
2076
+ id: o,
2077
+ options: r.options,
2078
+ origin: r
2084
2079
  });
2085
- } catch (g) {
2080
+ } catch (E) {
2086
2081
  if (s = await this.hooks.lifecycle.errorLoadRemote.emit({
2087
- id: r,
2088
- options: o.options,
2089
- origin: o,
2082
+ id: o,
2083
+ options: r.options,
2084
+ origin: r,
2090
2085
  from: "runtime",
2091
- error: g,
2086
+ error: E,
2092
2087
  lifecycle: "beforeRequest"
2093
2088
  }), !s)
2094
- throw g;
2089
+ throw E;
2095
2090
  }
2096
- const { id: l } = s, a = matchRemoteWithNameAndExpose(o.options.remotes, l);
2091
+ const { id: l } = s, a = matchRemoteWithNameAndExpose(r.options.remotes, l);
2097
2092
  assert(a, getShortErrorMsg(RUNTIME_004, runtimeDescMap, {
2098
- hostName: o.options.name,
2093
+ hostName: r.options.name,
2099
2094
  requestId: l
2100
2095
  }));
2101
- const { remote: i } = a, c = getRemoteInfo(i), u = await o.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({
2096
+ const { remote: i } = a, c = getRemoteInfo(i), u = await r.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({
2102
2097
  id: l
2103
2098
  }, a, {
2104
- options: o.options,
2105
- origin: o,
2099
+ options: r.options,
2100
+ origin: r,
2106
2101
  remoteInfo: c
2107
- })), { remote: d, expose: m } = u;
2108
- assert(d && m, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${l}.`);
2109
- let p = o.moduleCache.get(d.name);
2102
+ })), { remote: d, expose: p } = u;
2103
+ assert(d && p, `The 'beforeRequest' hook was executed, but it failed to return the correct 'remote' and 'expose' values while loading ${l}.`);
2104
+ let m = r.moduleCache.get(d.name);
2110
2105
  const y = {
2111
- host: o,
2106
+ host: r,
2112
2107
  remoteInfo: c
2113
2108
  };
2114
- return p || (p = new Module(y), o.moduleCache.set(d.name, p)), {
2115
- module: p,
2109
+ return m || (m = new Module(y), r.moduleCache.set(d.name, m)), {
2110
+ module: m,
2116
2111
  moduleOptions: y,
2117
2112
  remoteMatchInfo: u
2118
2113
  };
2119
2114
  }
2120
- registerRemote(t, o, r) {
2115
+ registerRemote(t, r, o) {
2121
2116
  const { host: s } = this, l = () => {
2122
2117
  if (t.alias) {
2123
- const i = o.find((c) => {
2118
+ const i = r.find((c) => {
2124
2119
  var u;
2125
2120
  return t.alias && (c.name.startsWith(t.alias) || ((u = c.alias) == null ? void 0 : u.startsWith(t.alias)));
2126
2121
  });
@@ -2132,9 +2127,9 @@ class RemoteHandler {
2132
2127
  remote: t,
2133
2128
  origin: s
2134
2129
  });
2135
- const a = o.find((i) => i.name === t.name);
2130
+ const a = r.find((i) => i.name === t.name);
2136
2131
  if (!a)
2137
- l(), o.push(t), this.hooks.lifecycle.registerRemote.emit({
2132
+ l(), r.push(t), this.hooks.lifecycle.registerRemote.emit({
2138
2133
  remote: t,
2139
2134
  origin: s
2140
2135
  });
@@ -2143,7 +2138,7 @@ class RemoteHandler {
2143
2138
  `The remote "${t.name}" is already registered.`,
2144
2139
  "Please note that overriding it may cause unexpected errors."
2145
2140
  ];
2146
- r != null && r.force && (this.removeRemote(a), l(), o.push(t), this.hooks.lifecycle.registerRemote.emit({
2141
+ o != null && o.force && (this.removeRemote(a), l(), r.push(t), this.hooks.lifecycle.registerRemote.emit({
2147
2142
  remote: t,
2148
2143
  origin: s
2149
2144
  }), warn$1(i.join(" ")));
@@ -2151,61 +2146,61 @@ class RemoteHandler {
2151
2146
  }
2152
2147
  removeRemote(t) {
2153
2148
  try {
2154
- const { host: r } = this, { name: s } = t, l = r.options.remotes.findIndex((i) => i.name === s);
2155
- l !== -1 && r.options.remotes.splice(l, 1);
2156
- const a = r.moduleCache.get(t.name);
2149
+ const { host: o } = this, { name: s } = t, l = o.options.remotes.findIndex((i) => i.name === s);
2150
+ l !== -1 && o.options.remotes.splice(l, 1);
2151
+ const a = o.moduleCache.get(t.name);
2157
2152
  if (a) {
2158
2153
  const i = a.remoteInfo, c = i.entryGlobalName;
2159
2154
  if (CurrentGlobal[c]) {
2160
- var o;
2161
- (o = Object.getOwnPropertyDescriptor(CurrentGlobal, c)) != null && o.configurable ? delete CurrentGlobal[c] : CurrentGlobal[c] = void 0;
2155
+ var r;
2156
+ (r = Object.getOwnPropertyDescriptor(CurrentGlobal, c)) != null && r.configurable ? delete CurrentGlobal[c] : CurrentGlobal[c] = void 0;
2162
2157
  }
2163
2158
  const u = getRemoteEntryUniqueKey(a.remoteInfo);
2164
- globalLoading[u] && delete globalLoading[u], r.snapshotHandler.manifestCache.delete(i.entry);
2159
+ globalLoading[u] && delete globalLoading[u], o.snapshotHandler.manifestCache.delete(i.entry);
2165
2160
  let d = i.buildVersion ? composeKeyWithSeparator(i.name, i.buildVersion) : i.name;
2166
- const m = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => i.buildVersion ? y.options.id === d : y.name === d);
2167
- if (m !== -1) {
2168
- const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[m];
2161
+ const p = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((y) => i.buildVersion ? y.options.id === d : y.name === d);
2162
+ if (p !== -1) {
2163
+ const y = CurrentGlobal.__FEDERATION__.__INSTANCES__[p];
2169
2164
  d = y.options.id || d;
2170
- const g = getGlobalShareScope();
2171
- let E = !0;
2165
+ const E = getGlobalShareScope();
2166
+ let b = !0;
2172
2167
  const _ = [];
2173
- Object.keys(g).forEach((b) => {
2174
- const v = g[b];
2175
- v && Object.keys(v).forEach((I) => {
2176
- const S = v[I];
2177
- S && Object.keys(S).forEach((R) => {
2178
- const $ = S[R];
2179
- $ && Object.keys($).forEach((T) => {
2180
- const A = $[T];
2181
- A && typeof A == "object" && A.from === i.name && (A.loaded || A.loading ? (A.useIn = A.useIn.filter((O) => O !== i.name), A.useIn.length ? E = !1 : _.push([
2182
- b,
2183
- I,
2168
+ Object.keys(E).forEach((g) => {
2169
+ const v = E[g];
2170
+ v && Object.keys(v).forEach((S) => {
2171
+ const I = v[S];
2172
+ I && Object.keys(I).forEach((R) => {
2173
+ const A = I[R];
2174
+ A && Object.keys(A).forEach((T) => {
2175
+ const $ = A[T];
2176
+ $ && typeof $ == "object" && $.from === i.name && ($.loaded || $.loading ? ($.useIn = $.useIn.filter((N) => N !== i.name), $.useIn.length ? b = !1 : _.push([
2177
+ g,
2178
+ S,
2184
2179
  R,
2185
2180
  T
2186
2181
  ])) : _.push([
2187
- b,
2188
- I,
2182
+ g,
2183
+ S,
2189
2184
  R,
2190
2185
  T
2191
2186
  ]));
2192
2187
  });
2193
2188
  });
2194
2189
  });
2195
- }), E && (y.shareScopeMap = {}, delete g[d]), _.forEach(([b, v, I, S]) => {
2196
- var R, $, T;
2197
- (T = g[b]) == null || ($ = T[v]) == null || (R = $[I]) == null || delete R[S];
2198
- }), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(m, 1);
2190
+ }), b && (y.shareScopeMap = {}, delete E[d]), _.forEach(([g, v, S, I]) => {
2191
+ var R, A, T;
2192
+ (T = E[g]) == null || (A = T[v]) == null || (R = A[S]) == null || delete R[I];
2193
+ }), CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(p, 1);
2199
2194
  }
2200
- const { hostGlobalSnapshot: p } = getGlobalRemoteInfo(t, r);
2201
- if (p) {
2202
- const y = p && "remotesInfo" in p && p.remotesInfo && getInfoWithoutType(p.remotesInfo, t.name).key;
2203
- y && (delete p.remotesInfo[y], Global.__FEDERATION__.__MANIFEST_LOADING__[y] && delete Global.__FEDERATION__.__MANIFEST_LOADING__[y]);
2195
+ const { hostGlobalSnapshot: m } = getGlobalRemoteInfo(t, o);
2196
+ if (m) {
2197
+ const y = m && "remotesInfo" in m && m.remotesInfo && getInfoWithoutType(m.remotesInfo, t.name).key;
2198
+ y && (delete m.remotesInfo[y], Global.__FEDERATION__.__MANIFEST_LOADING__[y] && delete Global.__FEDERATION__.__MANIFEST_LOADING__[y]);
2204
2199
  }
2205
- r.moduleCache.delete(t.name);
2200
+ o.moduleCache.delete(t.name);
2206
2201
  }
2207
- } catch (r) {
2208
- logger.log("removeRemote fail: ", r);
2202
+ } catch (o) {
2203
+ logger.log("removeRemote fail: ", o);
2209
2204
  }
2210
2205
  }
2211
2206
  constructor(t) {
@@ -2224,60 +2219,61 @@ class RemoteHandler {
2224
2219
  }), this.host = t, this.idToRemoteMap = {};
2225
2220
  }
2226
2221
  }
2222
+ const USE_SNAPSHOT = typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN == "boolean" ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN : !0;
2227
2223
  class FederationHost {
2228
2224
  initOptions(t) {
2229
2225
  this.registerPlugins(t.plugins);
2230
- const o = this.formatOptions(this.options, t);
2231
- return this.options = o, o;
2226
+ const r = this.formatOptions(this.options, t);
2227
+ return this.options = r, r;
2232
2228
  }
2233
- async loadShare(t, o) {
2234
- return this.sharedHandler.loadShare(t, o);
2229
+ async loadShare(t, r) {
2230
+ return this.sharedHandler.loadShare(t, r);
2235
2231
  }
2236
2232
  // The lib function will only be available if the shared set by eager or runtime init is set or the shared is successfully loaded.
2237
2233
  // 1. If the loaded shared already exists globally, then it will be reused
2238
2234
  // 2. If lib exists in local shared, it will be used directly
2239
2235
  // 3. If the local get returns something other than Promise, then it will be used directly
2240
- loadShareSync(t, o) {
2241
- return this.sharedHandler.loadShareSync(t, o);
2236
+ loadShareSync(t, r) {
2237
+ return this.sharedHandler.loadShareSync(t, r);
2242
2238
  }
2243
- initializeSharing(t = DEFAULT_SCOPE, o) {
2244
- return this.sharedHandler.initializeSharing(t, o);
2239
+ initializeSharing(t = DEFAULT_SCOPE, r) {
2240
+ return this.sharedHandler.initializeSharing(t, r);
2245
2241
  }
2246
- initRawContainer(t, o, r) {
2242
+ initRawContainer(t, r, o) {
2247
2243
  const s = getRemoteInfo({
2248
2244
  name: t,
2249
- entry: o
2245
+ entry: r
2250
2246
  }), l = new Module({
2251
2247
  host: this,
2252
2248
  remoteInfo: s
2253
2249
  });
2254
- return l.remoteEntryExports = r, this.moduleCache.set(t, l), l;
2250
+ return l.remoteEntryExports = o, this.moduleCache.set(t, l), l;
2255
2251
  }
2256
2252
  // eslint-disable-next-line max-lines-per-function
2257
2253
  // eslint-disable-next-line @typescript-eslint/member-ordering
2258
- async loadRemote(t, o) {
2259
- return this.remoteHandler.loadRemote(t, o);
2254
+ async loadRemote(t, r) {
2255
+ return this.remoteHandler.loadRemote(t, r);
2260
2256
  }
2261
2257
  // eslint-disable-next-line @typescript-eslint/member-ordering
2262
2258
  async preloadRemote(t) {
2263
2259
  return this.remoteHandler.preloadRemote(t);
2264
2260
  }
2265
- initShareScopeMap(t, o, r = {}) {
2266
- this.sharedHandler.initShareScopeMap(t, o, r);
2261
+ initShareScopeMap(t, r, o = {}) {
2262
+ this.sharedHandler.initShareScopeMap(t, r, o);
2267
2263
  }
2268
- formatOptions(t, o) {
2269
- const { shared: r } = formatShareConfigs(t, o), { userOptions: s, options: l } = this.hooks.lifecycle.beforeInit.emit({
2264
+ formatOptions(t, r) {
2265
+ const { shared: o } = formatShareConfigs(t, r), { userOptions: s, options: l } = this.hooks.lifecycle.beforeInit.emit({
2270
2266
  origin: this,
2271
- userOptions: o,
2267
+ userOptions: r,
2272
2268
  options: t,
2273
- shareInfo: r
2269
+ shareInfo: o
2274
2270
  }), a = this.remoteHandler.formatAndRegisterRemote(l, s), { shared: i } = this.sharedHandler.registerShared(l, s), c = [
2275
2271
  ...l.plugins
2276
2272
  ];
2277
2273
  s.plugins && s.plugins.forEach((d) => {
2278
2274
  c.includes(d) || c.push(d);
2279
2275
  });
2280
- const u = _extends$1({}, t, o, {
2276
+ const u = _extends$1({}, t, r, {
2281
2277
  plugins: c,
2282
2278
  remotes: a,
2283
2279
  shared: i
@@ -2288,7 +2284,7 @@ class FederationHost {
2288
2284
  }), u;
2289
2285
  }
2290
2286
  registerPlugins(t) {
2291
- const o = registerPlugins(t, [
2287
+ const r = registerPlugins(t, [
2292
2288
  this.hooks,
2293
2289
  this.remoteHandler.hooks,
2294
2290
  this.sharedHandler.hooks,
@@ -2296,10 +2292,10 @@ class FederationHost {
2296
2292
  this.loaderHook,
2297
2293
  this.bridgeHook
2298
2294
  ]);
2299
- this.options.plugins = this.options.plugins.reduce((r, s) => (s && r && !r.find((l) => l.name === s.name) && r.push(s), r), o || []);
2295
+ this.options.plugins = this.options.plugins.reduce((o, s) => (s && o && !o.find((l) => l.name === s.name) && o.push(s), o), r || []);
2300
2296
  }
2301
- registerRemotes(t, o) {
2302
- return this.remoteHandler.registerRemotes(t, o);
2297
+ registerRemotes(t, r) {
2298
+ return this.remoteHandler.registerRemotes(t, r);
2303
2299
  }
2304
2300
  constructor(t) {
2305
2301
  this.hooks = new PluginSystem({
@@ -2309,7 +2305,7 @@ class FederationHost {
2309
2305
  beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
2310
2306
  // maybe will change, temporarily for internal use only
2311
2307
  initContainer: new AsyncWaterfallHook("initContainer")
2312
- }), this.version = "0.13.1", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
2308
+ }), this.version = "0.14.1", this.moduleCache = /* @__PURE__ */ new Map(), this.loaderHook = new PluginSystem({
2313
2309
  // FIXME: may not be suitable , not open to the public yet
2314
2310
  getModuleInfo: new SyncHook(),
2315
2311
  createScript: new SyncHook(),
@@ -2323,13 +2319,13 @@ class FederationHost {
2323
2319
  beforeBridgeDestroy: new SyncHook(),
2324
2320
  afterBridgeDestroy: new SyncHook()
2325
2321
  });
2326
- const o = {
2322
+ const r = USE_SNAPSHOT ? [
2323
+ snapshotPlugin(),
2324
+ generatePreloadAssetsPlugin()
2325
+ ] : [], o = {
2327
2326
  id: getBuilderId(),
2328
2327
  name: t.name,
2329
- plugins: [
2330
- snapshotPlugin(),
2331
- generatePreloadAssetsPlugin()
2332
- ],
2328
+ plugins: r,
2333
2329
  remotes: [],
2334
2330
  shared: {},
2335
2331
  inBrowser: isBrowserEnv()
@@ -2346,37 +2342,50 @@ function getInstance() {
2346
2342
  }
2347
2343
  setGlobalFederationConstructor(FederationHost);
2348
2344
  function createBridgeComponent(n) {
2349
- const t = /* @__PURE__ */ new Map(), o = getInstance();
2345
+ const t = /* @__PURE__ */ new Map(), r = getInstance();
2350
2346
  return () => ({
2351
- __APP_VERSION__: "0.13.1",
2352
- async render(r) {
2353
- var y, g, E;
2354
- LoggerInstance.debug("createBridgeComponent render Info", r);
2355
- const { moduleName: s, dom: l, basename: a, memoryRoute: i, ...c } = r, u = Vue.createApp(n.rootComponent, c);
2356
- t.set(l, u);
2357
- const d = await ((E = (g = (y = o == null ? void 0 : o.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : g.beforeBridgeRender) == null ? void 0 : E.emit(r)), m = d && typeof d == "object" && (d != null && d.extraProps) ? d == null ? void 0 : d.extraProps : {}, p = n.appOptions({
2358
- app: u,
2347
+ __APP_VERSION__: "0.14.1",
2348
+ async render(o) {
2349
+ var E, b, _;
2350
+ LoggerInstance.debug("createBridgeComponent render Info", o);
2351
+ const {
2352
+ moduleName: s,
2353
+ dom: l,
2354
+ basename: a,
2355
+ memoryRoute: i,
2356
+ hashRoute: c,
2357
+ ...u
2358
+ } = o, d = Vue.createApp(n.rootComponent, u);
2359
+ t.set(l, d);
2360
+ const p = await ((_ = (b = (E = r == null ? void 0 : r.bridgeHook) == null ? void 0 : E.lifecycle) == null ? void 0 : b.beforeBridgeRender) == null ? void 0 : _.emit(o)), m = p && typeof p == "object" && (p != null && p.extraProps) ? p == null ? void 0 : p.extraProps : {}, y = n.appOptions({
2361
+ app: d,
2359
2362
  basename: a,
2360
2363
  memoryRoute: i,
2361
- ...c,
2364
+ hashRoute: c,
2365
+ ...u,
2362
2366
  ...m
2363
2367
  });
2364
- if (p != null && p.router) {
2365
- const _ = r.memoryRoute ? VueRouter.createMemoryHistory(r.basename) : VueRouter.createWebHistory(r.basename), b = VueRouter.createRouter({
2366
- ...p.router.options,
2367
- history: _,
2368
- routes: p.router.getRoutes()
2368
+ if (y != null && y.router) {
2369
+ let g, v = y.router.getRoutes();
2370
+ o.memoryRoute ? g = VueRouter.createMemoryHistory(o.basename) : o.hashRoute ? (g = VueRouter.createWebHashHistory(), v = v.map((I) => ({
2371
+ ...I,
2372
+ path: o.basename + I.path
2373
+ }))) : g = VueRouter.createWebHistory(o.basename);
2374
+ const S = VueRouter.createRouter({
2375
+ ...y.router.options,
2376
+ history: g,
2377
+ routes: v
2369
2378
  });
2370
2379
  LoggerInstance.debug("createBridgeComponent render router info>>>", {
2371
2380
  moduleName: s,
2372
- router: b
2373
- }), i && await b.push(i.entryPath), u.use(b);
2381
+ router: S
2382
+ }), i && await S.push(i.entryPath), d.use(S);
2374
2383
  }
2375
- u.mount(l);
2384
+ d.mount(l);
2376
2385
  },
2377
- destroy(r) {
2378
- LoggerInstance.debug("createBridgeComponent destroy Info", r);
2379
- const s = t.get(r == null ? void 0 : r.dom);
2386
+ destroy(o) {
2387
+ LoggerInstance.debug("createBridgeComponent destroy Info", o);
2388
+ const s = t.get(o == null ? void 0 : o.dom);
2380
2389
  s == null || s.unmount();
2381
2390
  }
2382
2391
  });
@@ -2391,33 +2400,35 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2391
2400
  moduleName: String,
2392
2401
  basename: String,
2393
2402
  memoryRoute: Object,
2403
+ hashRoute: Boolean,
2394
2404
  providerInfo: Function,
2395
2405
  rootAttrs: Object
2396
2406
  },
2397
2407
  inheritAttrs: !1,
2398
2408
  setup(n) {
2399
- const t = ref(null), o = ref(null), r = ref(""), s = useRoute(), l = getInstance(), a = useAttrs(), i = async () => {
2400
- var p, y, g, E;
2401
- const u = (p = n.providerInfo) == null ? void 0 : p.call(n);
2402
- o.value = u;
2409
+ const t = ref(null), r = ref(null), o = ref(""), s = useRoute(), l = getInstance(), a = useAttrs(), i = async () => {
2410
+ var m, y, E, b;
2411
+ const u = (m = n.providerInfo) == null ? void 0 : m.call(n);
2412
+ r.value = u;
2403
2413
  let d = {
2404
2414
  ...a,
2405
2415
  moduleName: n.moduleName,
2406
2416
  dom: t.value,
2407
2417
  basename: n.basename,
2408
- memoryRoute: n.memoryRoute
2418
+ memoryRoute: n.memoryRoute,
2419
+ hashRoute: n.hashRoute
2409
2420
  };
2410
2421
  LoggerInstance.debug("createRemoteComponent LazyComponent render >>>", d);
2411
- const m = await ((E = (g = (y = l == null ? void 0 : l.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : g.beforeBridgeRender) == null ? void 0 : E.emit(d)) || {};
2422
+ const p = await ((b = (E = (y = l == null ? void 0 : l.bridgeHook) == null ? void 0 : y.lifecycle) == null ? void 0 : E.beforeBridgeRender) == null ? void 0 : b.emit(d)) || {};
2412
2423
  d = {
2413
2424
  ...d,
2414
- ...m.extraProps
2425
+ ...p.extraProps
2415
2426
  }, u.render(d);
2416
2427
  }, c = watch(() => s == null ? void 0 : s.path, (u) => {
2417
- u !== s.path && i(), r.value !== "" && r.value !== u && (LoggerInstance.debug("createRemoteComponent dispatchPopstateEnv >>>", {
2428
+ u !== s.path && i(), o.value !== "" && o.value !== u && (LoggerInstance.debug("createRemoteComponent dispatchPopstateEnv >>>", {
2418
2429
  ...n,
2419
2430
  pathname: s.path
2420
- }), e()), r.value = u;
2431
+ }), e()), o.value = u;
2421
2432
  });
2422
2433
  return onMounted(() => {
2423
2434
  i();
@@ -2425,7 +2436,7 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2425
2436
  var u;
2426
2437
  LoggerInstance.debug("createRemoteComponent LazyComponent destroy >>>", {
2427
2438
  ...n
2428
- }), c(), (u = o.value) == null || u.destroy({
2439
+ }), c(), (u = r.value) == null || u.destroy({
2429
2440
  dom: t.value
2430
2441
  });
2431
2442
  }), () => createVNode("div", mergeProps(n.rootAttrs || {}, {
@@ -2435,31 +2446,31 @@ const RemoteApp = /* @__PURE__ */ defineComponent({
2435
2446
  });
2436
2447
  function createRemoteComponent(n) {
2437
2448
  return defineAsyncComponent({
2438
- __APP_VERSION__: "0.13.1",
2449
+ __APP_VERSION__: "0.14.1",
2439
2450
  ...n.asyncComponentOptions,
2440
2451
  //@ts-ignore
2441
2452
  loader: async () => {
2442
2453
  var c, u;
2443
2454
  const t = useRoute();
2444
- let o = "/";
2445
- const r = (u = (c = t == null ? void 0 : t.matched) == null ? void 0 : c[0]) == null ? void 0 : u.path;
2446
- r && (r.endsWith("/:pathMatch(.*)*") ? o = r.replace("/:pathMatch(.*)*", "") : o = t.matched[0].path);
2455
+ let r = "/";
2456
+ const o = (u = (c = t == null ? void 0 : t.matched) == null ? void 0 : c[0]) == null ? void 0 : u.path;
2457
+ o && (o.endsWith("/:pathMatch(.*)*") ? r = o.replace("/:pathMatch(.*)*", "") : r = t.matched[0].path);
2447
2458
  const s = (n == null ? void 0 : n.export) || "default";
2448
2459
  LoggerInstance.debug("createRemoteComponent LazyComponent create >>>", {
2449
- basename: o,
2460
+ basename: r,
2450
2461
  info: n
2451
2462
  });
2452
2463
  const l = await n.loader(), a = l && l[Symbol.for("mf_module_id")], i = l[s];
2453
2464
  if (LoggerInstance.debug(
2454
2465
  "createRemoteComponent LazyComponent loadRemote info >>>",
2455
- { moduleName: a, module: l, exportName: s, basename: o, route: t }
2466
+ { moduleName: a, module: l, exportName: s, basename: r, route: t }
2456
2467
  ), s in l && typeof i == "function")
2457
2468
  return {
2458
2469
  render() {
2459
2470
  return h(RemoteApp, {
2460
2471
  moduleName: a,
2461
2472
  providerInfo: i,
2462
- basename: o,
2473
+ basename: r,
2463
2474
  rootAttrs: n.rootAttrs
2464
2475
  });
2465
2476
  }