@module-federation/bridge-vue3 0.0.0-next-20250707074728 → 0.0.0-next-20250708104625

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