@module-federation/bridge-vue3 0.15.0 → 0.17.0

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