@module-federation/bridge-vue3 0.0.0-next-20250607130731 → 0.0.0-next-20250609065828

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