@baseplate-dev/plugin-auth 0.6.10 → 0.6.12
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/CHANGELOG.md +32 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/index.d.ts +1 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.d.ts +2 -0
- package/dist/local-auth/core/generators/auth-email-password/generated/typed-templates.js +4 -1
- package/dist/web/assets/{_virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth-ClIdhDoz.js → _virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth-Bd_uRhIr.js} +37 -29
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.js-BX1_Ngjt.js +346 -0
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.js-CQuBII8a.js +89 -0
- package/dist/web/assets/{dist-BhvYza4J.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-DsLoA9K7.js} +6408 -2424
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.mjs-CCE3BH4R.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-CGsbw2Lx.js} +206 -1086
- package/dist/web/assets/{_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__zod__loadShare__.mjs-BalS-ZNe.js → _virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__zod__loadShare__.js-DE4UUe5K.js} +271 -20
- package/dist/web/assets/auth-DS8ZnZZr.js +1 -0
- package/dist/web/assets/{common-DsAJIAWm.js → common-B8Z1_D6-.js} +3 -3
- package/dist/web/assets/{common-DpbhYjND.js → common-BFKR_7HQ.js} +5 -5
- package/dist/web/assets/{common-KNIYXbku.js → common-C0Hur22D.js} +3 -3
- package/dist/web/assets/{common-DiDohcsR.js → common-CLtpg163.js} +3 -3
- package/dist/web/assets/{common-ERn8TuKQ.js → common-CTYcv1u_.js} +3 -3
- package/dist/web/assets/{common-C7yhhy8-.js → common-ooa00sM_.js} +5 -5
- package/dist/web/assets/{dist-B0GpYPx6.js → dist-DicVrB_Z.js} +219 -216
- package/dist/web/assets/{get-auth-plugin-definition-Bu_lkrUz.js → get-auth-plugin-definition-DBdchbBZ.js} +2 -2
- package/dist/web/assets/hostInit-CDVLjNbq.js +119 -0
- package/dist/web/assets/{index-D5GoD4M0.js → index-CR54yoeW.js} +2 -2
- package/dist/web/assets/mf-entry-bootstrap-0-4f84e81c.js +32 -0
- package/dist/web/assets/{model-utils-BPfI0c3Y.js → model-utils-CQpTF3uf.js} +16 -16
- package/dist/web/assets/{models-BufWBHGv.js → models-BIKzGkW3.js} +3 -3
- package/dist/web/assets/{models-BTYxwDyB.js → models-Bc3L4Vsl.js} +3 -3
- package/dist/web/assets/{plugin-definition-D5s4GTfd.js → plugin-definition-33i4r91s.js} +3 -3
- package/dist/web/assets/{plugin-definition-BTHzuXv5.js → plugin-definition-BhNnSvrD.js} +3 -3
- package/dist/web/assets/{rolldown-runtime-_TIqcEvS.js → rolldown-runtime-FZ4Itg2g.js} +8 -1
- package/dist/web/assets/{styles-BpmWykfT.js → styles-BT_OTXuv.js} +8 -9
- package/dist/web/assets/{styles-CAm3HyKx.css → styles-Cc26Bbxc.css} +1 -1
- package/dist/web/assets/{virtualExposes-Bru0eAhP.js → virtualExposes-B_hX31Ln.js} +1 -1
- package/dist/web/assets/{dist-CEUHjZe8.js → virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-CtbvyMZJ.js} +1175 -300
- package/dist/web/assets/virtual_mf-exposes-ssr___mfe_internal__plugin-auth__remoteEntry_js-BVNjo6R7.js +129 -0
- package/dist/web/assets/{virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-DBiKf3iL.js → virtual_mf-exposes___mfe_internal__plugin-auth__remoteEntry_js-B_7IVc8D.js} +15 -15
- package/dist/web/assets/vite-preload-helper-iIio8xkS.js +67 -0
- package/dist/web/assets/{web-ffSErgfF.js → web-BC9MejP0.js} +3 -3
- package/dist/web/assets/{web-BUa3uD-P.js → web-BDeHApaZ.js} +16 -19
- package/dist/web/assets/{web-CgosRRUN.js → web-BXB-pvWJ.js} +14 -15
- package/dist/web/assets/{web-DhTqWxxL.js → web-CJlCNegu.js} +3 -3
- package/dist/web/assets/{web-DlJyNEbj.js → web-DYbNyLPi.js} +29 -31
- package/dist/web/assets/{web-nADEuz1b.js → web-Dso6eI9u.js} +11 -12
- package/dist/web/assets/{web-BmHd5WWD.js → web-aKoJoBnQ.js} +10 -11
- package/dist/web/index.html +2 -2
- package/dist/web/remoteEntry.js +1 -1
- package/dist/web/remoteEntry.ssr.js +43 -0
- package/package.json +18 -18
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib__loadShare__.mjs-DMKuehfC.js +0 -100
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_project_mf_2_builder_mf_2_lib_mf_1_web__loadShare__.mjs-D-Ap1aU9.js +0 -38
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.mjs-BwkXxd-B.js +0 -38
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__-D-_Nu6mi.js +0 -2
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__react__loadShare__-Bed38hA6.js +0 -3
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__react_mf_2_dom__loadShare__-Bixm3Wfj.js +0 -2
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__zod__loadShare__-BArWH8PX.js +0 -2
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__prebuild___mf_0_tanstack_mf_1_react_mf_2_router__prebuild__-C01b4AWM.js +0 -2
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__prebuild__react__prebuild__-D4n2cb00.js +0 -3
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__prebuild__react_mf_1_jsx_mf_2_runtime__prebuild__-BkswA-5f.js +0 -2
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__prebuild__react_mf_2_dom__prebuild__-CiX5bkAg.js +0 -2
- package/dist/web/assets/_virtual_mf___mfe_internal__plugin_mf_2_auth__prebuild__zod__prebuild__-BnF6dd62.js +0 -2
- package/dist/web/assets/auth-B91ghZtH.js +0 -1
- package/dist/web/assets/hostInit-BeM6xnlw.js +0 -72
- package/dist/web/assets/index.esm-iUXrvsTx.js +0 -2003
- package/dist/web/assets/md-BLjaL5ZD.js +0 -439
- package/dist/web/assets/react-B4hMnLhV.js +0 -49
- package/dist/web/assets/stringify-pretty-stable-ByfjYf8u.js +0 -155
- package/dist/web/assets/virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-DK03x1PZ.js +0 -270
- package/dist/web/mf-entry-bootstrap-0.js +0 -17
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { t as __vitePreload } from "./vite-preload-helper-iIio8xkS.js";
|
|
2
2
|
var BROWSER_LOG_KEY = "FEDERATION_DEBUG";
|
|
3
3
|
var NameTransformSymbol = {
|
|
4
4
|
AT: "@",
|
|
@@ -46,7 +46,7 @@ function isDebugMode() {
|
|
|
46
46
|
return isBrowserDebug();
|
|
47
47
|
}
|
|
48
48
|
//#endregion
|
|
49
|
-
//#region ../../node_modules/.pnpm/@module-federation+sdk@2.
|
|
49
|
+
//#region ../../node_modules/.pnpm/@module-federation+sdk@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/sdk/dist/utils.js
|
|
50
50
|
var LOG_CATEGORY$1 = "[ Federation Runtime ]";
|
|
51
51
|
var composeKeyWithSeparator = function(...args) {
|
|
52
52
|
if (!args.length) return "";
|
|
@@ -81,7 +81,7 @@ function safeToString(info) {
|
|
|
81
81
|
}
|
|
82
82
|
}
|
|
83
83
|
//#endregion
|
|
84
|
-
//#region ../../node_modules/.pnpm/@module-federation+sdk@2.
|
|
84
|
+
//#region ../../node_modules/.pnpm/@module-federation+sdk@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/sdk/dist/generateSnapshotFromManifest.js
|
|
85
85
|
var simpleJoinRemoteEntry = (rPath, rName) => {
|
|
86
86
|
if (!rPath) return rName;
|
|
87
87
|
const transformPath = (str) => {
|
|
@@ -174,7 +174,7 @@ function isManifestProvider(moduleInfo) {
|
|
|
174
174
|
else return false;
|
|
175
175
|
}
|
|
176
176
|
//#endregion
|
|
177
|
-
//#region ../../node_modules/.pnpm/@module-federation+sdk@2.
|
|
177
|
+
//#region ../../node_modules/.pnpm/@module-federation+sdk@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/sdk/dist/logger.js
|
|
178
178
|
var PREFIX = "[ Module Federation ]";
|
|
179
179
|
var DEFAULT_DELEGATE = console;
|
|
180
180
|
var LOGGER_STACK_SKIP_TOKENS = [
|
|
@@ -284,7 +284,7 @@ function createInfrastructureLogger(prefix) {
|
|
|
284
284
|
createLogger(PREFIX);
|
|
285
285
|
createInfrastructureLogger(PREFIX);
|
|
286
286
|
//#endregion
|
|
287
|
-
//#region ../../node_modules/.pnpm/@module-federation+sdk@2.
|
|
287
|
+
//#region ../../node_modules/.pnpm/@module-federation+sdk@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/sdk/dist/dom.js
|
|
288
288
|
async function safeWrapper(callback, disableWarn) {
|
|
289
289
|
try {
|
|
290
290
|
return await callback();
|
|
@@ -389,6 +389,8 @@ function createScript(info) {
|
|
|
389
389
|
function createLink(info) {
|
|
390
390
|
let link = null;
|
|
391
391
|
let needAttach = true;
|
|
392
|
+
let timeout = 2e4;
|
|
393
|
+
let timeoutId;
|
|
392
394
|
const links = document.getElementsByTagName("link");
|
|
393
395
|
for (let i = 0; i < links.length; i++) {
|
|
394
396
|
const l = links[i];
|
|
@@ -404,19 +406,42 @@ function createLink(info) {
|
|
|
404
406
|
link = document.createElement("link");
|
|
405
407
|
link.setAttribute("href", info.url);
|
|
406
408
|
let createLinkRes = void 0;
|
|
409
|
+
let shouldApplyAttrs = true;
|
|
407
410
|
const attrs = info.attrs;
|
|
408
411
|
if (info.createLinkHook) {
|
|
409
412
|
createLinkRes = info.createLinkHook(info.url, attrs);
|
|
410
|
-
if (createLinkRes instanceof HTMLLinkElement)
|
|
413
|
+
if (createLinkRes instanceof HTMLLinkElement) {
|
|
414
|
+
link = createLinkRes;
|
|
415
|
+
shouldApplyAttrs = false;
|
|
416
|
+
} else if (typeof createLinkRes === "object") {
|
|
417
|
+
if ("link" in createLinkRes && createLinkRes.link) {
|
|
418
|
+
link = createLinkRes.link;
|
|
419
|
+
shouldApplyAttrs = false;
|
|
420
|
+
}
|
|
421
|
+
if ("timeout" in createLinkRes && createLinkRes.timeout) timeout = createLinkRes.timeout;
|
|
422
|
+
}
|
|
411
423
|
}
|
|
412
|
-
if (attrs &&
|
|
424
|
+
if (attrs && shouldApplyAttrs) Object.keys(attrs).forEach((name) => {
|
|
413
425
|
if (link && !link.getAttribute(name)) link.setAttribute(name, attrs[name]);
|
|
414
426
|
});
|
|
415
427
|
}
|
|
428
|
+
if (!needAttach) {
|
|
429
|
+
Promise.resolve().then(() => {
|
|
430
|
+
info?.cb && info?.cb();
|
|
431
|
+
});
|
|
432
|
+
return {
|
|
433
|
+
link,
|
|
434
|
+
needAttach
|
|
435
|
+
};
|
|
436
|
+
}
|
|
416
437
|
const onLinkComplete = (prev, event) => {
|
|
438
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
417
439
|
const onLinkCompleteCallback = () => {
|
|
418
|
-
if (event?.type === "error")
|
|
419
|
-
|
|
440
|
+
if (event?.type === "error") {
|
|
441
|
+
const linkError = /* @__PURE__ */ new Error(event?.isTimeout ? `LinkNetworkError: Link "${info.url}" timed out.` : `LinkNetworkError: Failed to load link "${info.url}" - the URL is unreachable or the server returned an error.`);
|
|
442
|
+
linkError.name = "LinkNetworkError";
|
|
443
|
+
info?.onErrorCallback && info?.onErrorCallback(linkError);
|
|
444
|
+
} else info?.cb && info?.cb();
|
|
420
445
|
};
|
|
421
446
|
if (link) {
|
|
422
447
|
link.onerror = null;
|
|
@@ -435,6 +460,12 @@ function createLink(info) {
|
|
|
435
460
|
};
|
|
436
461
|
link.onerror = onLinkComplete.bind(null, link.onerror);
|
|
437
462
|
link.onload = onLinkComplete.bind(null, link.onload);
|
|
463
|
+
timeoutId = setTimeout(() => {
|
|
464
|
+
onLinkComplete(null, {
|
|
465
|
+
type: "error",
|
|
466
|
+
isTimeout: true
|
|
467
|
+
});
|
|
468
|
+
}, timeout);
|
|
438
469
|
return {
|
|
439
470
|
link,
|
|
440
471
|
needAttach
|
|
@@ -458,7 +489,7 @@ function loadScript(url, info) {
|
|
|
458
489
|
});
|
|
459
490
|
}
|
|
460
491
|
//#endregion
|
|
461
|
-
//#region ../../node_modules/.pnpm/@module-federation+error-codes@2.
|
|
492
|
+
//#region ../../node_modules/.pnpm/@module-federation+error-codes@2.6.0/node_modules/@module-federation/error-codes/dist/getShortErrorMsg.mjs
|
|
462
493
|
var getDocsUrl = (errorCode) => {
|
|
463
494
|
return `View the docs to see how to solve: https://module-federation.io/guide/troubleshooting/${errorCode.split("-")[0].toLowerCase()}#${errorCode.toLowerCase()}`;
|
|
464
495
|
};
|
|
@@ -470,12 +501,12 @@ var getShortErrorMsg = (errorCode, errorDescMap, args, originalErrorMsg) => {
|
|
|
470
501
|
return msg.join("\n");
|
|
471
502
|
};
|
|
472
503
|
//#endregion
|
|
473
|
-
//#region ../../node_modules/.pnpm/@module-federation+error-codes@2.
|
|
504
|
+
//#region ../../node_modules/.pnpm/@module-federation+error-codes@2.6.0/node_modules/@module-federation/error-codes/dist/browser.mjs
|
|
474
505
|
function logAndReport(code, descMap, args, logger, originalErrorMsg, context) {
|
|
475
506
|
return logger(getShortErrorMsg(code, descMap, args, originalErrorMsg));
|
|
476
507
|
}
|
|
477
508
|
//#endregion
|
|
478
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
509
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/logger.js
|
|
479
510
|
var LOG_CATEGORY = "[ Federation Runtime ]";
|
|
480
511
|
var logger = createLogger(LOG_CATEGORY);
|
|
481
512
|
function assert(condition, msgOrCode, descMap, args, context) {
|
|
@@ -500,7 +531,7 @@ function warn$1(msg) {
|
|
|
500
531
|
} else logger.warn(msg);
|
|
501
532
|
}
|
|
502
533
|
//#endregion
|
|
503
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
534
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/tool.js
|
|
504
535
|
function addUniqueItem(arr, item) {
|
|
505
536
|
if (arr.findIndex((name) => name === item) === -1) arr.push(item);
|
|
506
537
|
return arr;
|
|
@@ -546,7 +577,7 @@ var processModuleAlias = (name, subPath) => {
|
|
|
546
577
|
return moduleName;
|
|
547
578
|
};
|
|
548
579
|
//#endregion
|
|
549
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
580
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/global.js
|
|
550
581
|
var CurrentGlobal = typeof globalThis === "object" ? globalThis : window;
|
|
551
582
|
var nativeGlobal = (() => {
|
|
552
583
|
try {
|
|
@@ -599,7 +630,7 @@ function getGlobalFederationConstructor() {
|
|
|
599
630
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
600
631
|
if (isDebug) {
|
|
601
632
|
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
602
|
-
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.
|
|
633
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.6.0";
|
|
603
634
|
}
|
|
604
635
|
}
|
|
605
636
|
function getInfoWithoutType(target, key) {
|
|
@@ -664,7 +695,7 @@ var getGlobalHostPlugins = () => nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__;
|
|
|
664
695
|
var getPreloaded = (id) => CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(id);
|
|
665
696
|
var setPreloaded = (id) => CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(id, true);
|
|
666
697
|
//#endregion
|
|
667
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
698
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/semver/constants.js
|
|
668
699
|
var buildIdentifier = "[0-9A-Za-z-]+";
|
|
669
700
|
var build = `(?:\\+(${buildIdentifier}(?:\\.${buildIdentifier})*))`;
|
|
670
701
|
var numericIdentifier = "0|[1-9]\\d*";
|
|
@@ -692,7 +723,7 @@ var xRange = `^${gtlt}\\s*${xRangePlain}$`;
|
|
|
692
723
|
var comparator = `^${gtlt}\\s*(${fullPlain})$|^$`;
|
|
693
724
|
var gte0 = "^\\s*>=\\s*0.0.0\\s*$";
|
|
694
725
|
//#endregion
|
|
695
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
726
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/semver/utils.js
|
|
696
727
|
function parseRegex(source) {
|
|
697
728
|
return new RegExp(source);
|
|
698
729
|
}
|
|
@@ -711,7 +742,7 @@ function combineVersion(major, minor, patch, preRelease) {
|
|
|
711
742
|
return mainVersion;
|
|
712
743
|
}
|
|
713
744
|
//#endregion
|
|
714
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
745
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/semver/parser.js
|
|
715
746
|
function parseHyphen(range) {
|
|
716
747
|
return range.replace(parseRegex(hyphenRange), (_range, from, fromMajor, fromMinor, fromPatch, _fromPreRelease, _fromBuild, to, toMajor, toMinor, toPatch, toPreRelease) => {
|
|
717
748
|
if (isXVersion(fromMajor)) from = "";
|
|
@@ -801,7 +832,7 @@ function parseGTE0(comparatorString) {
|
|
|
801
832
|
return comparatorString.trim().replace(parseRegex(gte0), "");
|
|
802
833
|
}
|
|
803
834
|
//#endregion
|
|
804
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
835
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/semver/compare.js
|
|
805
836
|
function compareAtom(rangeAtom, versionAtom) {
|
|
806
837
|
rangeAtom = Number(rangeAtom) || rangeAtom;
|
|
807
838
|
versionAtom = Number(versionAtom) || versionAtom;
|
|
@@ -845,7 +876,7 @@ function compare(rangeAtom, versionAtom) {
|
|
|
845
876
|
}
|
|
846
877
|
}
|
|
847
878
|
//#endregion
|
|
848
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
879
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/semver/index.js
|
|
849
880
|
function parseComparatorString(range) {
|
|
850
881
|
return pipe(parseCarets, parseTildes, parseXRanges, parseStar)(range);
|
|
851
882
|
}
|
|
@@ -906,11 +937,11 @@ function satisfy(version, range) {
|
|
|
906
937
|
return false;
|
|
907
938
|
}
|
|
908
939
|
//#endregion
|
|
909
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
940
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/constant.js
|
|
910
941
|
var DEFAULT_SCOPE = "default";
|
|
911
942
|
var DEFAULT_REMOTE_TYPE = "global";
|
|
912
943
|
//#endregion
|
|
913
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
944
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/share.js
|
|
914
945
|
function formatShare(shareArgs, from, name, shareStrategy) {
|
|
915
946
|
let get;
|
|
916
947
|
if ("get" in shareArgs) get = shareArgs.get;
|
|
@@ -1178,7 +1209,11 @@ function directShare(shared, useTreesShaking) {
|
|
|
1178
1209
|
return shared;
|
|
1179
1210
|
}
|
|
1180
1211
|
//#endregion
|
|
1181
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
1212
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/manifest.js
|
|
1213
|
+
function composeRemoteRequestId(remoteName, expose) {
|
|
1214
|
+
if (!expose || expose === ".") return remoteName;
|
|
1215
|
+
return `${remoteName}/${expose.replace(/^\.\//, "")}`;
|
|
1216
|
+
}
|
|
1182
1217
|
function matchRemoteWithNameAndExpose(remotes, id) {
|
|
1183
1218
|
for (const remote of remotes) {
|
|
1184
1219
|
const isNameMatched = id.startsWith(remote.name);
|
|
@@ -1224,7 +1259,7 @@ function matchRemote(remotes, nameOrAlias) {
|
|
|
1224
1259
|
}
|
|
1225
1260
|
}
|
|
1226
1261
|
//#endregion
|
|
1227
|
-
//#region ../../node_modules/.pnpm/@module-federation+error-codes@2.
|
|
1262
|
+
//#region ../../node_modules/.pnpm/@module-federation+error-codes@2.6.0/node_modules/@module-federation/error-codes/dist/error-codes.mjs
|
|
1228
1263
|
var RUNTIME_001 = "RUNTIME-001";
|
|
1229
1264
|
var RUNTIME_002 = "RUNTIME-002";
|
|
1230
1265
|
var RUNTIME_003 = "RUNTIME-003";
|
|
@@ -1237,11 +1272,14 @@ var RUNTIME_009 = "RUNTIME-009";
|
|
|
1237
1272
|
var RUNTIME_010 = "RUNTIME-010";
|
|
1238
1273
|
var RUNTIME_011 = "RUNTIME-011";
|
|
1239
1274
|
var RUNTIME_012 = "RUNTIME-012";
|
|
1275
|
+
var RUNTIME_013 = "RUNTIME-013";
|
|
1276
|
+
var RUNTIME_014 = "RUNTIME-014";
|
|
1277
|
+
var RUNTIME_015 = "RUNTIME-015";
|
|
1240
1278
|
var TYPE_001 = "TYPE-001";
|
|
1241
1279
|
var BUILD_001 = "BUILD-001";
|
|
1242
1280
|
var BUILD_002 = "BUILD-002";
|
|
1243
1281
|
//#endregion
|
|
1244
|
-
//#region ../../node_modules/.pnpm/@module-federation+error-codes@2.
|
|
1282
|
+
//#region ../../node_modules/.pnpm/@module-federation+error-codes@2.6.0/node_modules/@module-federation/error-codes/dist/desc.mjs
|
|
1245
1283
|
var runtimeDescMap = {
|
|
1246
1284
|
[RUNTIME_001]: "Failed to get remoteEntry exports.",
|
|
1247
1285
|
[RUNTIME_002]: "The remote entry interface does not contain \"init\"",
|
|
@@ -1254,7 +1292,10 @@ var runtimeDescMap = {
|
|
|
1254
1292
|
[RUNTIME_009]: "Please call createInstance first.",
|
|
1255
1293
|
[RUNTIME_010]: "The name option cannot be changed after initialization. If you want to create a new instance with a different name, please use \"createInstance\" api.",
|
|
1256
1294
|
[RUNTIME_011]: "The remoteEntry URL is missing from the remote snapshot.",
|
|
1257
|
-
[RUNTIME_012]: "The getter for the shared module is not a function. This may be caused by setting \"shared.import: false\" without the host providing the corresponding lib."
|
|
1295
|
+
[RUNTIME_012]: "The getter for the shared module is not a function. This may be caused by setting \"shared.import: false\" without the host providing the corresponding lib.",
|
|
1296
|
+
[RUNTIME_013]: "The manifest is not a valid Module Federation manifest.",
|
|
1297
|
+
[RUNTIME_014]: "The remote does not expose the requested module.",
|
|
1298
|
+
[RUNTIME_015]: "Remote container initialization failed."
|
|
1258
1299
|
};
|
|
1259
1300
|
var typeDescMap = { [TYPE_001]: "Failed to generate type declaration. Execute the below cmd to reproduce and fix the error." };
|
|
1260
1301
|
var buildDescMap = {
|
|
@@ -1267,7 +1308,7 @@ var buildDescMap = {
|
|
|
1267
1308
|
...buildDescMap
|
|
1268
1309
|
});
|
|
1269
1310
|
//#endregion
|
|
1270
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
1311
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/load.js
|
|
1271
1312
|
var importCallback = ".then(callbacks[0]).catch(callbacks[1])";
|
|
1272
1313
|
async function loadEsmEntry({ entry, remoteEntryExports }) {
|
|
1273
1314
|
return new Promise((resolve, reject) => {
|
|
@@ -1304,7 +1345,7 @@ function handleRemoteEntryLoaded(name, globalName, entry) {
|
|
|
1304
1345
|
});
|
|
1305
1346
|
return entryExports;
|
|
1306
1347
|
}
|
|
1307
|
-
async function loadEntryScript({ name, globalName, entry, remoteInfo, loaderHook, getEntryUrl }) {
|
|
1348
|
+
async function loadEntryScript({ name, globalName, entry, remoteInfo, loaderHook, getEntryUrl, resourceContext }) {
|
|
1308
1349
|
const { entryExports: remoteEntryExports } = getRemoteEntryExports(name, globalName);
|
|
1309
1350
|
if (remoteEntryExports) return remoteEntryExports;
|
|
1310
1351
|
const url = getEntryUrl ? getEntryUrl(entry) : entry;
|
|
@@ -1314,7 +1355,11 @@ async function loadEntryScript({ name, globalName, entry, remoteInfo, loaderHook
|
|
|
1314
1355
|
const res = loaderHook.lifecycle.createScript.emit({
|
|
1315
1356
|
url,
|
|
1316
1357
|
attrs,
|
|
1317
|
-
remoteInfo
|
|
1358
|
+
remoteInfo,
|
|
1359
|
+
resourceContext: resourceContext ? {
|
|
1360
|
+
...resourceContext,
|
|
1361
|
+
url
|
|
1362
|
+
} : void 0
|
|
1318
1363
|
});
|
|
1319
1364
|
if (!res) return;
|
|
1320
1365
|
if (res instanceof HTMLScriptElement) return res;
|
|
@@ -1330,7 +1375,7 @@ async function loadEntryScript({ name, globalName, entry, remoteInfo, loaderHook
|
|
|
1330
1375
|
}, originalMsg);
|
|
1331
1376
|
});
|
|
1332
1377
|
}
|
|
1333
|
-
async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getEntryUrl }) {
|
|
1378
|
+
async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getEntryUrl, resourceContext }) {
|
|
1334
1379
|
const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
|
|
1335
1380
|
switch (type) {
|
|
1336
1381
|
case "esm":
|
|
@@ -1348,7 +1393,8 @@ async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getEnt
|
|
|
1348
1393
|
name,
|
|
1349
1394
|
remoteInfo,
|
|
1350
1395
|
loaderHook,
|
|
1351
|
-
getEntryUrl
|
|
1396
|
+
getEntryUrl,
|
|
1397
|
+
resourceContext
|
|
1352
1398
|
});
|
|
1353
1399
|
}
|
|
1354
1400
|
}
|
|
@@ -1357,13 +1403,14 @@ function getRemoteEntryUniqueKey(remoteInfo) {
|
|
|
1357
1403
|
return composeKeyWithSeparator(name, entry);
|
|
1358
1404
|
}
|
|
1359
1405
|
async function getRemoteEntry(params) {
|
|
1360
|
-
const { origin, remoteEntryExports, remoteInfo, getEntryUrl, _inErrorHandling = false } = params;
|
|
1406
|
+
const { origin, remoteEntryExports, remoteInfo, getEntryUrl, resourceContext, _inErrorHandling = false } = params;
|
|
1361
1407
|
const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
|
|
1362
1408
|
if (remoteEntryExports) return remoteEntryExports;
|
|
1363
1409
|
if (!globalLoading[uniqueKey]) {
|
|
1364
1410
|
const loadEntryHook = origin.remoteHandler.hooks.lifecycle.loadEntry;
|
|
1365
1411
|
const loaderHook = origin.loaderHook;
|
|
1366
1412
|
globalLoading[uniqueKey] = loadEntryHook.emit({
|
|
1413
|
+
origin,
|
|
1367
1414
|
loaderHook,
|
|
1368
1415
|
remoteInfo,
|
|
1369
1416
|
remoteEntryExports
|
|
@@ -1373,8 +1420,16 @@ async function getRemoteEntry(params) {
|
|
|
1373
1420
|
remoteInfo,
|
|
1374
1421
|
remoteEntryExports,
|
|
1375
1422
|
loaderHook,
|
|
1376
|
-
getEntryUrl
|
|
1423
|
+
getEntryUrl,
|
|
1424
|
+
resourceContext
|
|
1425
|
+
});
|
|
1426
|
+
}).then(async (res) => {
|
|
1427
|
+
await origin.loaderHook.lifecycle.afterLoadEntry.emit({
|
|
1428
|
+
origin,
|
|
1429
|
+
remoteInfo,
|
|
1430
|
+
remoteEntryExports: res
|
|
1377
1431
|
});
|
|
1432
|
+
return res;
|
|
1378
1433
|
}).catch(async (err) => {
|
|
1379
1434
|
const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
|
|
1380
1435
|
const isScriptExecutionError = err instanceof Error && err.message.includes("ScriptExecutionError");
|
|
@@ -1393,8 +1448,21 @@ async function getRemoteEntry(params) {
|
|
|
1393
1448
|
globalLoading,
|
|
1394
1449
|
uniqueKey
|
|
1395
1450
|
});
|
|
1396
|
-
if (RemoteEntryExports)
|
|
1451
|
+
if (RemoteEntryExports) {
|
|
1452
|
+
await origin.loaderHook.lifecycle.afterLoadEntry.emit({
|
|
1453
|
+
origin,
|
|
1454
|
+
remoteInfo,
|
|
1455
|
+
remoteEntryExports: RemoteEntryExports,
|
|
1456
|
+
recovered: true
|
|
1457
|
+
});
|
|
1458
|
+
return RemoteEntryExports;
|
|
1459
|
+
}
|
|
1397
1460
|
}
|
|
1461
|
+
await origin.loaderHook.lifecycle.afterLoadEntry.emit({
|
|
1462
|
+
origin,
|
|
1463
|
+
remoteInfo,
|
|
1464
|
+
error: err
|
|
1465
|
+
});
|
|
1398
1466
|
throw err;
|
|
1399
1467
|
});
|
|
1400
1468
|
}
|
|
@@ -1410,12 +1478,12 @@ function getRemoteInfo(remote) {
|
|
|
1410
1478
|
};
|
|
1411
1479
|
}
|
|
1412
1480
|
//#endregion
|
|
1413
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
1481
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/env.js
|
|
1414
1482
|
function getBuilderId$1() {
|
|
1415
1483
|
return typeof FEDERATION_BUILD_IDENTIFIER !== "undefined" ? FEDERATION_BUILD_IDENTIFIER : "";
|
|
1416
1484
|
}
|
|
1417
1485
|
//#endregion
|
|
1418
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
1486
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/plugin.js
|
|
1419
1487
|
function registerPlugins(plugins, instance) {
|
|
1420
1488
|
const globalPlugins = getGlobalHostPlugins();
|
|
1421
1489
|
const hookInstances = [
|
|
@@ -1437,7 +1505,7 @@ function registerPlugins(plugins, instance) {
|
|
|
1437
1505
|
return plugins;
|
|
1438
1506
|
}
|
|
1439
1507
|
//#endregion
|
|
1440
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
1508
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/context.js
|
|
1441
1509
|
function remoteToEntry(r) {
|
|
1442
1510
|
return {
|
|
1443
1511
|
name: r.name,
|
|
@@ -1478,7 +1546,7 @@ function optionsToMFContext(options) {
|
|
|
1478
1546
|
};
|
|
1479
1547
|
}
|
|
1480
1548
|
//#endregion
|
|
1481
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
1549
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/preload.js
|
|
1482
1550
|
function defaultPreloadArgs(preloadConfig) {
|
|
1483
1551
|
return {
|
|
1484
1552
|
resourceCategory: "sync",
|
|
@@ -1508,22 +1576,113 @@ function normalizePreloadExposes(exposes) {
|
|
|
1508
1576
|
return expose;
|
|
1509
1577
|
});
|
|
1510
1578
|
}
|
|
1511
|
-
function
|
|
1579
|
+
function isTimeoutError(error) {
|
|
1580
|
+
if (!(error instanceof Error)) return false;
|
|
1581
|
+
return error.message.includes("timed out") || error.name.includes("Timeout");
|
|
1582
|
+
}
|
|
1583
|
+
function createAssetResult(context, url, status, error) {
|
|
1584
|
+
return {
|
|
1585
|
+
url,
|
|
1586
|
+
status,
|
|
1587
|
+
resourceType: context.resourceType,
|
|
1588
|
+
initiator: context.initiator,
|
|
1589
|
+
id: context.id,
|
|
1590
|
+
error
|
|
1591
|
+
};
|
|
1592
|
+
}
|
|
1593
|
+
async function waitForRemoteEntryPreload(host, remoteInfo, entryRemoteInfo, context) {
|
|
1594
|
+
const cachedRemote = host.moduleCache.get(entryRemoteInfo.name);
|
|
1595
|
+
const url = entryRemoteInfo.entry;
|
|
1596
|
+
if (cachedRemote?.remoteEntryExports) return createAssetResult(context, url, "cached");
|
|
1597
|
+
try {
|
|
1598
|
+
if (!await getRemoteEntry({
|
|
1599
|
+
origin: host,
|
|
1600
|
+
remoteInfo: entryRemoteInfo,
|
|
1601
|
+
remoteEntryExports: cachedRemote?.remoteEntryExports,
|
|
1602
|
+
resourceContext: {
|
|
1603
|
+
...context,
|
|
1604
|
+
url
|
|
1605
|
+
}
|
|
1606
|
+
})) throw new Error(`Failed to load remoteEntry "${url}".`);
|
|
1607
|
+
return createAssetResult(context, url, "success");
|
|
1608
|
+
} catch (error) {
|
|
1609
|
+
return createAssetResult(context, url, isTimeoutError(error) ? "timeout" : "error", error);
|
|
1610
|
+
}
|
|
1611
|
+
}
|
|
1612
|
+
function waitForLinkPreload({ host, remoteInfo, url, attrs, context, needDeleteLink }) {
|
|
1613
|
+
return new Promise((resolve) => {
|
|
1614
|
+
const { link, needAttach } = createLink({
|
|
1615
|
+
url,
|
|
1616
|
+
cb: () => {
|
|
1617
|
+
resolve(createAssetResult(context, url, needAttach ? "success" : "cached"));
|
|
1618
|
+
},
|
|
1619
|
+
onErrorCallback: (error) => {
|
|
1620
|
+
resolve(createAssetResult(context, url, isTimeoutError(error) ? "timeout" : "error", error));
|
|
1621
|
+
},
|
|
1622
|
+
attrs,
|
|
1623
|
+
createLinkHook: (hookUrl, hookAttrs) => {
|
|
1624
|
+
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
1625
|
+
url: hookUrl,
|
|
1626
|
+
attrs: hookAttrs,
|
|
1627
|
+
remoteInfo,
|
|
1628
|
+
resourceContext: {
|
|
1629
|
+
...context,
|
|
1630
|
+
url: hookUrl
|
|
1631
|
+
}
|
|
1632
|
+
});
|
|
1633
|
+
if (res instanceof HTMLLinkElement) return res;
|
|
1634
|
+
return res;
|
|
1635
|
+
},
|
|
1636
|
+
needDeleteLink
|
|
1637
|
+
});
|
|
1638
|
+
needAttach && document.head.appendChild(link);
|
|
1639
|
+
});
|
|
1640
|
+
}
|
|
1641
|
+
function waitForScriptPreload({ host, remoteInfo, url, attrs, context }) {
|
|
1642
|
+
return new Promise((resolve) => {
|
|
1643
|
+
const { script, needAttach } = createScript({
|
|
1644
|
+
url,
|
|
1645
|
+
cb: () => {
|
|
1646
|
+
resolve(createAssetResult(context, url, needAttach ? "success" : "cached"));
|
|
1647
|
+
},
|
|
1648
|
+
onErrorCallback: (error) => {
|
|
1649
|
+
resolve(createAssetResult(context, url, isTimeoutError(error) ? "timeout" : "error", error));
|
|
1650
|
+
},
|
|
1651
|
+
attrs,
|
|
1652
|
+
createScriptHook: (hookUrl, hookAttrs) => {
|
|
1653
|
+
const res = host.loaderHook.lifecycle.createScript.emit({
|
|
1654
|
+
url: hookUrl,
|
|
1655
|
+
attrs: hookAttrs,
|
|
1656
|
+
remoteInfo,
|
|
1657
|
+
resourceContext: {
|
|
1658
|
+
...context,
|
|
1659
|
+
url: hookUrl
|
|
1660
|
+
}
|
|
1661
|
+
});
|
|
1662
|
+
if (res instanceof HTMLScriptElement) return res;
|
|
1663
|
+
return res;
|
|
1664
|
+
},
|
|
1665
|
+
needDeleteScript: true
|
|
1666
|
+
});
|
|
1667
|
+
needAttach && document.head.appendChild(script);
|
|
1668
|
+
});
|
|
1669
|
+
}
|
|
1670
|
+
function createResourceContext(baseContext, resourceType) {
|
|
1671
|
+
return {
|
|
1672
|
+
...baseContext,
|
|
1673
|
+
resourceType
|
|
1674
|
+
};
|
|
1675
|
+
}
|
|
1676
|
+
function preloadAssets(remoteInfo, host, assets, useLinkPreload = true, baseContext = {
|
|
1677
|
+
initiator: "preloadRemote",
|
|
1678
|
+
id: remoteInfo.name
|
|
1679
|
+
}) {
|
|
1512
1680
|
const { cssAssets, jsAssetsWithoutEntry, entryAssets } = assets;
|
|
1681
|
+
const results = [];
|
|
1513
1682
|
if (host.options.inBrowser) {
|
|
1514
1683
|
entryAssets.forEach((asset) => {
|
|
1515
|
-
const { moduleInfo } = asset;
|
|
1516
|
-
|
|
1517
|
-
if (module) getRemoteEntry({
|
|
1518
|
-
origin: host,
|
|
1519
|
-
remoteInfo: moduleInfo,
|
|
1520
|
-
remoteEntryExports: module.remoteEntryExports
|
|
1521
|
-
});
|
|
1522
|
-
else getRemoteEntry({
|
|
1523
|
-
origin: host,
|
|
1524
|
-
remoteInfo: moduleInfo,
|
|
1525
|
-
remoteEntryExports: void 0
|
|
1526
|
-
});
|
|
1684
|
+
const { moduleInfo: entryRemoteInfo } = asset;
|
|
1685
|
+
results.push(waitForRemoteEntryPreload(host, remoteInfo, entryRemoteInfo, createResourceContext(baseContext, "remoteEntry")));
|
|
1527
1686
|
});
|
|
1528
1687
|
if (useLinkPreload) {
|
|
1529
1688
|
const defaultAttrs = {
|
|
@@ -1531,20 +1690,13 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true) {
|
|
|
1531
1690
|
as: "style"
|
|
1532
1691
|
};
|
|
1533
1692
|
cssAssets.forEach((cssUrl) => {
|
|
1534
|
-
|
|
1693
|
+
results.push(waitForLinkPreload({
|
|
1694
|
+
host,
|
|
1695
|
+
remoteInfo,
|
|
1535
1696
|
url: cssUrl,
|
|
1536
|
-
cb: () => {},
|
|
1537
1697
|
attrs: defaultAttrs,
|
|
1538
|
-
|
|
1539
|
-
|
|
1540
|
-
url,
|
|
1541
|
-
attrs,
|
|
1542
|
-
remoteInfo
|
|
1543
|
-
});
|
|
1544
|
-
if (res instanceof HTMLLinkElement) return res;
|
|
1545
|
-
}
|
|
1546
|
-
});
|
|
1547
|
-
needAttach && document.head.appendChild(cssEl);
|
|
1698
|
+
context: createResourceContext(baseContext, "css")
|
|
1699
|
+
}));
|
|
1548
1700
|
});
|
|
1549
1701
|
} else {
|
|
1550
1702
|
const defaultAttrs = {
|
|
@@ -1552,21 +1704,14 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true) {
|
|
|
1552
1704
|
type: "text/css"
|
|
1553
1705
|
};
|
|
1554
1706
|
cssAssets.forEach((cssUrl) => {
|
|
1555
|
-
|
|
1707
|
+
results.push(waitForLinkPreload({
|
|
1708
|
+
host,
|
|
1709
|
+
remoteInfo,
|
|
1556
1710
|
url: cssUrl,
|
|
1557
|
-
cb: () => {},
|
|
1558
1711
|
attrs: defaultAttrs,
|
|
1559
|
-
|
|
1560
|
-
|
|
1561
|
-
|
|
1562
|
-
attrs,
|
|
1563
|
-
remoteInfo
|
|
1564
|
-
});
|
|
1565
|
-
if (res instanceof HTMLLinkElement) return res;
|
|
1566
|
-
},
|
|
1567
|
-
needDeleteLink: false
|
|
1568
|
-
});
|
|
1569
|
-
needAttach && document.head.appendChild(cssEl);
|
|
1712
|
+
needDeleteLink: false,
|
|
1713
|
+
context: createResourceContext(baseContext, "css")
|
|
1714
|
+
}));
|
|
1570
1715
|
});
|
|
1571
1716
|
}
|
|
1572
1717
|
if (useLinkPreload) {
|
|
@@ -1575,20 +1720,13 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true) {
|
|
|
1575
1720
|
as: "script"
|
|
1576
1721
|
};
|
|
1577
1722
|
jsAssetsWithoutEntry.forEach((jsUrl) => {
|
|
1578
|
-
|
|
1723
|
+
results.push(waitForLinkPreload({
|
|
1724
|
+
host,
|
|
1725
|
+
remoteInfo,
|
|
1579
1726
|
url: jsUrl,
|
|
1580
|
-
cb: () => {},
|
|
1581
1727
|
attrs: defaultAttrs,
|
|
1582
|
-
|
|
1583
|
-
|
|
1584
|
-
url,
|
|
1585
|
-
attrs,
|
|
1586
|
-
remoteInfo
|
|
1587
|
-
});
|
|
1588
|
-
if (res instanceof HTMLLinkElement) return res;
|
|
1589
|
-
}
|
|
1590
|
-
});
|
|
1591
|
-
needAttach && document.head.appendChild(linkEl);
|
|
1728
|
+
context: createResourceContext(baseContext, "js")
|
|
1729
|
+
}));
|
|
1592
1730
|
});
|
|
1593
1731
|
} else {
|
|
1594
1732
|
const defaultAttrs = {
|
|
@@ -1596,27 +1734,25 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true) {
|
|
|
1596
1734
|
type: remoteInfo?.type === "module" ? "module" : "text/javascript"
|
|
1597
1735
|
};
|
|
1598
1736
|
jsAssetsWithoutEntry.forEach((jsUrl) => {
|
|
1599
|
-
|
|
1737
|
+
results.push(waitForScriptPreload({
|
|
1738
|
+
host,
|
|
1739
|
+
remoteInfo,
|
|
1600
1740
|
url: jsUrl,
|
|
1601
|
-
cb: () => {},
|
|
1602
1741
|
attrs: defaultAttrs,
|
|
1603
|
-
|
|
1604
|
-
|
|
1605
|
-
url,
|
|
1606
|
-
attrs,
|
|
1607
|
-
remoteInfo
|
|
1608
|
-
});
|
|
1609
|
-
if (res instanceof HTMLScriptElement) return res;
|
|
1610
|
-
},
|
|
1611
|
-
needDeleteScript: true
|
|
1612
|
-
});
|
|
1613
|
-
needAttach && document.head.appendChild(scriptEl);
|
|
1742
|
+
context: createResourceContext(baseContext, "js")
|
|
1743
|
+
}));
|
|
1614
1744
|
});
|
|
1615
1745
|
}
|
|
1616
1746
|
}
|
|
1747
|
+
return Promise.all(results);
|
|
1617
1748
|
}
|
|
1618
1749
|
//#endregion
|
|
1619
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
1750
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/module/index.js
|
|
1751
|
+
function getAvailableExposeNames(remoteSnapshot) {
|
|
1752
|
+
if (!remoteSnapshot || !("modules" in remoteSnapshot) || !Array.isArray(remoteSnapshot.modules)) return;
|
|
1753
|
+
const exposes = remoteSnapshot.modules.map((module) => module.moduleName).filter(Boolean);
|
|
1754
|
+
return exposes.length ? exposes.join(",") : void 0;
|
|
1755
|
+
}
|
|
1620
1756
|
function createRemoteEntryInitOptions(remoteInfo, hostShareScopeMap, rawInitScope) {
|
|
1621
1757
|
const localShareScopeMap = hostShareScopeMap;
|
|
1622
1758
|
const shareScopeKeys = Array.isArray(remoteInfo.shareScope) ? remoteInfo.shareScope : [remoteInfo.shareScope];
|
|
@@ -1646,26 +1782,68 @@ var Module$1 = class {
|
|
|
1646
1782
|
this.remoteInfo = remoteInfo;
|
|
1647
1783
|
this.host = host;
|
|
1648
1784
|
}
|
|
1649
|
-
async getEntry() {
|
|
1785
|
+
async getEntry(expose) {
|
|
1650
1786
|
if (this.remoteEntryExports) return this.remoteEntryExports;
|
|
1651
1787
|
const remoteEntryExports = await getRemoteEntry({
|
|
1652
1788
|
origin: this.host,
|
|
1653
1789
|
remoteInfo: this.remoteInfo,
|
|
1654
|
-
remoteEntryExports: this.remoteEntryExports
|
|
1790
|
+
remoteEntryExports: this.remoteEntryExports,
|
|
1791
|
+
resourceContext: {
|
|
1792
|
+
initiator: "loadRemote",
|
|
1793
|
+
id: composeRemoteRequestId(this.remoteInfo.name, expose),
|
|
1794
|
+
resourceType: "remoteEntry"
|
|
1795
|
+
}
|
|
1655
1796
|
});
|
|
1656
1797
|
assert(remoteEntryExports, `remoteEntryExports is undefined \n ${safeToString(this.remoteInfo)}`);
|
|
1657
1798
|
this.remoteEntryExports = remoteEntryExports;
|
|
1658
1799
|
return this.remoteEntryExports;
|
|
1659
1800
|
}
|
|
1660
|
-
async init(id, remoteSnapshot, rawInitScope) {
|
|
1661
|
-
const remoteEntryExports = await this.getEntry();
|
|
1662
|
-
if (this.inited)
|
|
1801
|
+
async init(id, remoteSnapshot, rawInitScope, expose) {
|
|
1802
|
+
const remoteEntryExports = await this.getEntry(expose);
|
|
1803
|
+
if (this.inited) {
|
|
1804
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
1805
|
+
id,
|
|
1806
|
+
remoteInfo: this.remoteInfo,
|
|
1807
|
+
remoteSnapshot,
|
|
1808
|
+
remoteEntryExports,
|
|
1809
|
+
cached: true,
|
|
1810
|
+
origin: this.host
|
|
1811
|
+
});
|
|
1812
|
+
return remoteEntryExports;
|
|
1813
|
+
}
|
|
1663
1814
|
if (this.initPromise) {
|
|
1664
|
-
|
|
1815
|
+
try {
|
|
1816
|
+
await this.initPromise;
|
|
1817
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
1818
|
+
id,
|
|
1819
|
+
remoteInfo: this.remoteInfo,
|
|
1820
|
+
remoteSnapshot,
|
|
1821
|
+
remoteEntryExports,
|
|
1822
|
+
cached: true,
|
|
1823
|
+
origin: this.host
|
|
1824
|
+
});
|
|
1825
|
+
} catch (initError) {
|
|
1826
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
1827
|
+
id,
|
|
1828
|
+
remoteInfo: this.remoteInfo,
|
|
1829
|
+
remoteSnapshot,
|
|
1830
|
+
remoteEntryExports,
|
|
1831
|
+
error: initError,
|
|
1832
|
+
cached: true,
|
|
1833
|
+
origin: this.host
|
|
1834
|
+
});
|
|
1835
|
+
throw initError;
|
|
1836
|
+
}
|
|
1665
1837
|
return remoteEntryExports;
|
|
1666
1838
|
}
|
|
1667
1839
|
this.initing = true;
|
|
1668
1840
|
this.initPromise = (async () => {
|
|
1841
|
+
await this.host.loaderHook.lifecycle.beforeInitRemote.emit({
|
|
1842
|
+
id,
|
|
1843
|
+
remoteInfo: this.remoteInfo,
|
|
1844
|
+
remoteSnapshot,
|
|
1845
|
+
origin: this.host
|
|
1846
|
+
});
|
|
1669
1847
|
const { remoteEntryInitOptions, shareScope, initScope } = createRemoteEntryInitOptions(this.remoteInfo, this.host.shareScopeMap, rawInitScope);
|
|
1670
1848
|
const initContainerOptions = await this.host.hooks.lifecycle.beforeInitContainer.emit({
|
|
1671
1849
|
shareScope,
|
|
@@ -1680,7 +1858,17 @@ var Module$1 = class {
|
|
|
1680
1858
|
remoteEntryUrl: this.remoteInfo.entry,
|
|
1681
1859
|
remoteEntryKey: this.remoteInfo.entryGlobalName
|
|
1682
1860
|
}, void 0, optionsToMFContext(this.host.options));
|
|
1683
|
-
|
|
1861
|
+
try {
|
|
1862
|
+
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
1863
|
+
} catch (initError) {
|
|
1864
|
+
error(RUNTIME_015, runtimeDescMap, {
|
|
1865
|
+
hostName: this.host.name,
|
|
1866
|
+
remoteName: this.remoteInfo.name,
|
|
1867
|
+
remoteEntryUrl: this.remoteInfo.entry,
|
|
1868
|
+
remoteEntryKey: this.remoteInfo.entryGlobalName,
|
|
1869
|
+
shareScope: this.remoteInfo.shareScope
|
|
1870
|
+
}, `${initError}`, optionsToMFContext(this.host.options));
|
|
1871
|
+
}
|
|
1684
1872
|
await this.host.hooks.lifecycle.initContainer.emit({
|
|
1685
1873
|
...initContainerOptions,
|
|
1686
1874
|
id,
|
|
@@ -1691,6 +1879,23 @@ var Module$1 = class {
|
|
|
1691
1879
|
})();
|
|
1692
1880
|
try {
|
|
1693
1881
|
await this.initPromise;
|
|
1882
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
1883
|
+
id,
|
|
1884
|
+
remoteInfo: this.remoteInfo,
|
|
1885
|
+
remoteSnapshot,
|
|
1886
|
+
remoteEntryExports,
|
|
1887
|
+
origin: this.host
|
|
1888
|
+
});
|
|
1889
|
+
} catch (initError) {
|
|
1890
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
1891
|
+
id,
|
|
1892
|
+
remoteInfo: this.remoteInfo,
|
|
1893
|
+
remoteSnapshot,
|
|
1894
|
+
remoteEntryExports,
|
|
1895
|
+
error: initError,
|
|
1896
|
+
origin: this.host
|
|
1897
|
+
});
|
|
1898
|
+
throw initError;
|
|
1694
1899
|
} finally {
|
|
1695
1900
|
this.initing = false;
|
|
1696
1901
|
this.initPromise = void 0;
|
|
@@ -1699,20 +1904,83 @@ var Module$1 = class {
|
|
|
1699
1904
|
}
|
|
1700
1905
|
async get(id, expose, options, remoteSnapshot) {
|
|
1701
1906
|
const { loadFactory = true } = options || { loadFactory: true };
|
|
1702
|
-
const remoteEntryExports = await this.init(id, remoteSnapshot);
|
|
1907
|
+
const remoteEntryExports = await this.init(id, remoteSnapshot, void 0, expose);
|
|
1703
1908
|
this.lib = remoteEntryExports;
|
|
1704
|
-
|
|
1705
|
-
|
|
1706
|
-
remoteEntryExports,
|
|
1909
|
+
await this.host.loaderHook.lifecycle.beforeGetExpose.emit({
|
|
1910
|
+
id,
|
|
1707
1911
|
expose,
|
|
1708
|
-
moduleInfo: this.remoteInfo
|
|
1912
|
+
moduleInfo: this.remoteInfo,
|
|
1913
|
+
remoteEntryExports,
|
|
1914
|
+
origin: this.host
|
|
1709
1915
|
});
|
|
1710
|
-
|
|
1711
|
-
|
|
1916
|
+
let moduleFactory;
|
|
1917
|
+
try {
|
|
1918
|
+
const hookModuleFactory = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
1919
|
+
remoteEntryExports,
|
|
1920
|
+
expose,
|
|
1921
|
+
moduleInfo: this.remoteInfo
|
|
1922
|
+
});
|
|
1923
|
+
moduleFactory = typeof hookModuleFactory === "function" ? hookModuleFactory : void 0;
|
|
1924
|
+
if (!moduleFactory) moduleFactory = await remoteEntryExports.get(expose);
|
|
1925
|
+
if (!moduleFactory) error(RUNTIME_014, runtimeDescMap, {
|
|
1926
|
+
hostName: this.host.name,
|
|
1927
|
+
remoteName: this.remoteInfo.name,
|
|
1928
|
+
remoteEntryUrl: this.remoteInfo.entry,
|
|
1929
|
+
expose,
|
|
1930
|
+
requestId: id,
|
|
1931
|
+
availableExposes: getAvailableExposeNames(remoteSnapshot)
|
|
1932
|
+
}, void 0, optionsToMFContext(this.host.options));
|
|
1933
|
+
await this.host.loaderHook.lifecycle.afterGetExpose.emit({
|
|
1934
|
+
id,
|
|
1935
|
+
expose,
|
|
1936
|
+
moduleInfo: this.remoteInfo,
|
|
1937
|
+
remoteEntryExports,
|
|
1938
|
+
moduleFactory,
|
|
1939
|
+
origin: this.host
|
|
1940
|
+
});
|
|
1941
|
+
} catch (getExposeError) {
|
|
1942
|
+
await this.host.loaderHook.lifecycle.afterGetExpose.emit({
|
|
1943
|
+
id,
|
|
1944
|
+
expose,
|
|
1945
|
+
moduleInfo: this.remoteInfo,
|
|
1946
|
+
remoteEntryExports,
|
|
1947
|
+
error: getExposeError,
|
|
1948
|
+
origin: this.host
|
|
1949
|
+
});
|
|
1950
|
+
throw getExposeError;
|
|
1951
|
+
}
|
|
1712
1952
|
const symbolName = processModuleAlias(this.remoteInfo.name, expose);
|
|
1713
1953
|
const wrapModuleFactory = this.wraperFactory(moduleFactory, symbolName);
|
|
1714
1954
|
if (!loadFactory) return wrapModuleFactory;
|
|
1715
|
-
|
|
1955
|
+
await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({
|
|
1956
|
+
id,
|
|
1957
|
+
expose,
|
|
1958
|
+
moduleInfo: this.remoteInfo,
|
|
1959
|
+
loadFactory,
|
|
1960
|
+
origin: this.host
|
|
1961
|
+
});
|
|
1962
|
+
try {
|
|
1963
|
+
const exposeContent = await wrapModuleFactory();
|
|
1964
|
+
await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({
|
|
1965
|
+
id,
|
|
1966
|
+
expose,
|
|
1967
|
+
moduleInfo: this.remoteInfo,
|
|
1968
|
+
loadFactory,
|
|
1969
|
+
exposeModule: exposeContent,
|
|
1970
|
+
origin: this.host
|
|
1971
|
+
});
|
|
1972
|
+
return exposeContent;
|
|
1973
|
+
} catch (executeFactoryError) {
|
|
1974
|
+
await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({
|
|
1975
|
+
id,
|
|
1976
|
+
expose,
|
|
1977
|
+
moduleInfo: this.remoteInfo,
|
|
1978
|
+
loadFactory,
|
|
1979
|
+
error: executeFactoryError,
|
|
1980
|
+
origin: this.host
|
|
1981
|
+
});
|
|
1982
|
+
throw executeFactoryError;
|
|
1983
|
+
}
|
|
1716
1984
|
}
|
|
1717
1985
|
wraperFactory(moduleFactory, id) {
|
|
1718
1986
|
function defineModuleId(res, id) {
|
|
@@ -1721,20 +1989,19 @@ var Module$1 = class {
|
|
|
1721
1989
|
enumerable: false
|
|
1722
1990
|
});
|
|
1723
1991
|
}
|
|
1724
|
-
|
|
1725
|
-
const res = await moduleFactory();
|
|
1726
|
-
defineModuleId(res, id);
|
|
1727
|
-
return res;
|
|
1728
|
-
};
|
|
1729
|
-
else return () => {
|
|
1992
|
+
return () => {
|
|
1730
1993
|
const res = moduleFactory();
|
|
1994
|
+
if (res instanceof Promise) return res.then((asyncRes) => {
|
|
1995
|
+
defineModuleId(asyncRes, id);
|
|
1996
|
+
return asyncRes;
|
|
1997
|
+
});
|
|
1731
1998
|
defineModuleId(res, id);
|
|
1732
1999
|
return res;
|
|
1733
2000
|
};
|
|
1734
2001
|
}
|
|
1735
2002
|
};
|
|
1736
2003
|
//#endregion
|
|
1737
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
2004
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/hooks/syncHook.js
|
|
1738
2005
|
var SyncHook = class {
|
|
1739
2006
|
constructor(type) {
|
|
1740
2007
|
this.type = "";
|
|
@@ -1754,7 +2021,8 @@ var SyncHook = class {
|
|
|
1754
2021
|
emit(...data) {
|
|
1755
2022
|
let result;
|
|
1756
2023
|
if (this.listeners.size > 0) this.listeners.forEach((fn) => {
|
|
1757
|
-
|
|
2024
|
+
const nextResult = fn(...data);
|
|
2025
|
+
if (nextResult !== void 0) result = nextResult;
|
|
1758
2026
|
});
|
|
1759
2027
|
return result;
|
|
1760
2028
|
}
|
|
@@ -1766,7 +2034,7 @@ var SyncHook = class {
|
|
|
1766
2034
|
}
|
|
1767
2035
|
};
|
|
1768
2036
|
//#endregion
|
|
1769
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
2037
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/hooks/asyncHook.js
|
|
1770
2038
|
var AsyncHook = class extends SyncHook {
|
|
1771
2039
|
emit(...data) {
|
|
1772
2040
|
let result;
|
|
@@ -1775,7 +2043,10 @@ var AsyncHook = class extends SyncHook {
|
|
|
1775
2043
|
let i = 0;
|
|
1776
2044
|
const call = (prev) => {
|
|
1777
2045
|
if (prev === false) return false;
|
|
1778
|
-
else if (i < ls.length) return Promise.resolve(ls[i++].apply(null, data)).then(
|
|
2046
|
+
else if (i < ls.length) return Promise.resolve(ls[i++].apply(null, data)).then((result) => {
|
|
2047
|
+
if (result === void 0 || data.length === 1 && result === data[0]) return call(prev);
|
|
2048
|
+
return call(result);
|
|
2049
|
+
});
|
|
1779
2050
|
else return prev;
|
|
1780
2051
|
};
|
|
1781
2052
|
result = call();
|
|
@@ -1784,7 +2055,7 @@ var AsyncHook = class extends SyncHook {
|
|
|
1784
2055
|
}
|
|
1785
2056
|
};
|
|
1786
2057
|
//#endregion
|
|
1787
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
2058
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/hooks/syncWaterfallHook.js
|
|
1788
2059
|
function checkReturnData(originalData, returnedData) {
|
|
1789
2060
|
if (!isObject(returnedData)) return false;
|
|
1790
2061
|
if (originalData !== returnedData) {
|
|
@@ -1802,6 +2073,7 @@ var SyncWaterfallHook = class extends SyncHook {
|
|
|
1802
2073
|
if (!isObject(data)) error(`The data for the "${this.type}" hook should be an object.`);
|
|
1803
2074
|
for (const fn of this.listeners) try {
|
|
1804
2075
|
const tempData = fn(data);
|
|
2076
|
+
if (tempData === void 0) continue;
|
|
1805
2077
|
if (checkReturnData(data, tempData)) data = tempData;
|
|
1806
2078
|
else {
|
|
1807
2079
|
this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
|
|
@@ -1815,7 +2087,7 @@ var SyncWaterfallHook = class extends SyncHook {
|
|
|
1815
2087
|
}
|
|
1816
2088
|
};
|
|
1817
2089
|
//#endregion
|
|
1818
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
2090
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/hooks/asyncWaterfallHooks.js
|
|
1819
2091
|
var AsyncWaterfallHook = class extends SyncHook {
|
|
1820
2092
|
constructor(type) {
|
|
1821
2093
|
super();
|
|
@@ -1833,14 +2105,16 @@ var AsyncWaterfallHook = class extends SyncHook {
|
|
|
1833
2105
|
return data;
|
|
1834
2106
|
};
|
|
1835
2107
|
const call = (prevData) => {
|
|
1836
|
-
if (checkReturnData(data, prevData))
|
|
1837
|
-
|
|
1838
|
-
|
|
1839
|
-
|
|
1840
|
-
|
|
1841
|
-
|
|
1842
|
-
|
|
1843
|
-
}
|
|
2108
|
+
if (prevData !== void 0 && checkReturnData(data, prevData)) data = prevData;
|
|
2109
|
+
else if (prevData !== void 0) {
|
|
2110
|
+
this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
|
|
2111
|
+
return data;
|
|
2112
|
+
}
|
|
2113
|
+
if (i < ls.length) try {
|
|
2114
|
+
return Promise.resolve(ls[i++](data)).then(call, processError);
|
|
2115
|
+
} catch (e) {
|
|
2116
|
+
return processError(e);
|
|
2117
|
+
}
|
|
1844
2118
|
return data;
|
|
1845
2119
|
};
|
|
1846
2120
|
return Promise.resolve(call(data));
|
|
@@ -1849,7 +2123,7 @@ var AsyncWaterfallHook = class extends SyncHook {
|
|
|
1849
2123
|
}
|
|
1850
2124
|
};
|
|
1851
2125
|
//#endregion
|
|
1852
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
2126
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/utils/hooks/pluginSystem.js
|
|
1853
2127
|
var PluginSystem = class {
|
|
1854
2128
|
constructor(lifecycle) {
|
|
1855
2129
|
this.registerPlugins = {};
|
|
@@ -1879,7 +2153,7 @@ var PluginSystem = class {
|
|
|
1879
2153
|
}
|
|
1880
2154
|
};
|
|
1881
2155
|
//#endregion
|
|
1882
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
2156
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/plugins/snapshot/index.js
|
|
1883
2157
|
function assignRemoteInfo(remoteInfo, remoteSnapshot) {
|
|
1884
2158
|
const remoteEntryInfo = getRemoteEntryInfoFromSnapshot(remoteSnapshot);
|
|
1885
2159
|
if (!remoteEntryInfo.url) error(RUNTIME_011, runtimeDescMap, { remoteName: remoteInfo.name });
|
|
@@ -1898,7 +2172,7 @@ function snapshotPlugin() {
|
|
|
1898
2172
|
if (!isRemoteInfoWithEntry(remote) || !isPureRemoteEntry(remote)) {
|
|
1899
2173
|
const { remoteSnapshot, globalSnapshot } = await origin.snapshotHandler.loadRemoteSnapshotInfo({
|
|
1900
2174
|
moduleInfo: remote,
|
|
1901
|
-
id
|
|
2175
|
+
id: composeRemoteRequestId(remote.name, expose)
|
|
1902
2176
|
});
|
|
1903
2177
|
assignRemoteInfo(remoteInfo, remoteSnapshot);
|
|
1904
2178
|
const preloadOptions = {
|
|
@@ -1919,7 +2193,10 @@ function snapshotPlugin() {
|
|
|
1919
2193
|
remoteSnapshot,
|
|
1920
2194
|
globalSnapshot
|
|
1921
2195
|
});
|
|
1922
|
-
if (assets) preloadAssets(remoteInfo, origin, assets, false
|
|
2196
|
+
if (assets) preloadAssets(remoteInfo, origin, assets, false, {
|
|
2197
|
+
initiator: "loadRemote",
|
|
2198
|
+
id
|
|
2199
|
+
}).catch(() => void 0);
|
|
1923
2200
|
return {
|
|
1924
2201
|
...args,
|
|
1925
2202
|
remoteSnapshot
|
|
@@ -1930,7 +2207,7 @@ function snapshotPlugin() {
|
|
|
1930
2207
|
};
|
|
1931
2208
|
}
|
|
1932
2209
|
//#endregion
|
|
1933
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
2210
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/plugins/generate-preload-assets.js
|
|
1934
2211
|
function splitId(id) {
|
|
1935
2212
|
const splitInfo = id.split(":");
|
|
1936
2213
|
if (splitInfo.length === 1) return {
|
|
@@ -2096,7 +2373,7 @@ var generatePreloadAssetsPlugin = function() {
|
|
|
2096
2373
|
};
|
|
2097
2374
|
};
|
|
2098
2375
|
//#endregion
|
|
2099
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
2376
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/plugins/snapshot/SnapshotHandler.js
|
|
2100
2377
|
function getGlobalRemoteInfo(moduleInfo, origin) {
|
|
2101
2378
|
const hostGlobalSnapshot = getGlobalSnapshotInfoByModuleInfo({
|
|
2102
2379
|
name: origin.name,
|
|
@@ -2134,11 +2411,12 @@ var SnapshotHandler = class {
|
|
|
2134
2411
|
this.HostInstance = HostInstance;
|
|
2135
2412
|
this.loaderHook = HostInstance.loaderHook;
|
|
2136
2413
|
}
|
|
2137
|
-
async loadRemoteSnapshotInfo({ moduleInfo, id,
|
|
2414
|
+
async loadRemoteSnapshotInfo({ moduleInfo, id, initiator = "loadRemote" }) {
|
|
2138
2415
|
const { options } = this.HostInstance;
|
|
2139
2416
|
await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
|
|
2140
2417
|
options,
|
|
2141
|
-
moduleInfo
|
|
2418
|
+
moduleInfo,
|
|
2419
|
+
origin: this.HostInstance
|
|
2142
2420
|
});
|
|
2143
2421
|
let hostSnapshot = getGlobalSnapshotInfoByModuleInfo({
|
|
2144
2422
|
name: this.HostInstance.options.name,
|
|
@@ -2170,7 +2448,10 @@ var SnapshotHandler = class {
|
|
|
2170
2448
|
let gSnapshot;
|
|
2171
2449
|
if (globalRemoteSnapshot) if (isManifestProvider(globalRemoteSnapshot)) {
|
|
2172
2450
|
const remoteEntry = globalRemoteSnapshot.remoteEntry;
|
|
2173
|
-
const moduleSnapshot = await this.
|
|
2451
|
+
const moduleSnapshot = await this.loadManifestSnapshot(remoteEntry, moduleInfo, {}, {
|
|
2452
|
+
initiator,
|
|
2453
|
+
id: id || moduleInfo.name
|
|
2454
|
+
});
|
|
2174
2455
|
const globalSnapshotRes = setGlobalSnapshotInfoByModuleInfo({
|
|
2175
2456
|
...moduleInfo,
|
|
2176
2457
|
entry: remoteEntry
|
|
@@ -2188,15 +2469,12 @@ var SnapshotHandler = class {
|
|
|
2188
2469
|
gSnapshot = globalSnapshotRes;
|
|
2189
2470
|
}
|
|
2190
2471
|
else if (isRemoteInfoWithEntry(moduleInfo)) {
|
|
2191
|
-
const moduleSnapshot = await this.
|
|
2192
|
-
|
|
2193
|
-
|
|
2194
|
-
options: this.HostInstance.options,
|
|
2195
|
-
moduleInfo,
|
|
2196
|
-
remoteSnapshot: moduleSnapshot,
|
|
2197
|
-
from: "global"
|
|
2472
|
+
const moduleSnapshot = await this.loadManifestSnapshot(moduleInfo.entry, moduleInfo, {}, {
|
|
2473
|
+
initiator,
|
|
2474
|
+
id: id || moduleInfo.name
|
|
2198
2475
|
});
|
|
2199
|
-
|
|
2476
|
+
const globalSnapshotRes = setGlobalSnapshotInfoByModuleInfo(moduleInfo, moduleSnapshot);
|
|
2477
|
+
mSnapshot = moduleSnapshot;
|
|
2200
2478
|
gSnapshot = globalSnapshotRes;
|
|
2201
2479
|
} else error(RUNTIME_007, runtimeDescMap, {
|
|
2202
2480
|
remoteName: moduleInfo.name,
|
|
@@ -2219,12 +2497,17 @@ var SnapshotHandler = class {
|
|
|
2219
2497
|
getGlobalRemoteInfo(moduleInfo) {
|
|
2220
2498
|
return getGlobalRemoteInfo(moduleInfo, this.HostInstance);
|
|
2221
2499
|
}
|
|
2222
|
-
async getManifestJson(manifestUrl, moduleInfo, extraOptions) {
|
|
2500
|
+
async getManifestJson(manifestUrl, moduleInfo, extraOptions, resourceOptions) {
|
|
2223
2501
|
const getManifest = async () => {
|
|
2502
|
+
const remoteInfo = getRemoteInfo(moduleInfo);
|
|
2224
2503
|
let manifestJson = this.manifestCache.get(manifestUrl);
|
|
2225
2504
|
if (manifestJson) return manifestJson;
|
|
2226
2505
|
try {
|
|
2227
|
-
let res = await this.loaderHook.lifecycle.fetch.emit(manifestUrl, {},
|
|
2506
|
+
let res = await this.loaderHook.lifecycle.fetch.emit(manifestUrl, {}, remoteInfo, resourceOptions ? {
|
|
2507
|
+
...resourceOptions,
|
|
2508
|
+
url: manifestUrl,
|
|
2509
|
+
resourceType: "manifest"
|
|
2510
|
+
} : void 0);
|
|
2228
2511
|
if (!res || !(res instanceof Response)) res = await fetch(manifestUrl, {});
|
|
2229
2512
|
manifestJson = await res.json();
|
|
2230
2513
|
} catch (err) {
|
|
@@ -2233,6 +2516,7 @@ var SnapshotHandler = class {
|
|
|
2233
2516
|
error: err,
|
|
2234
2517
|
from: "runtime",
|
|
2235
2518
|
lifecycle: "afterResolve",
|
|
2519
|
+
remote: remoteInfo,
|
|
2236
2520
|
origin: this.HostInstance
|
|
2237
2521
|
});
|
|
2238
2522
|
if (!manifestJson) {
|
|
@@ -2244,16 +2528,33 @@ var SnapshotHandler = class {
|
|
|
2244
2528
|
}, `${err}`, optionsToMFContext(this.HostInstance.options));
|
|
2245
2529
|
}
|
|
2246
2530
|
}
|
|
2247
|
-
|
|
2531
|
+
const missingRequiredFields = [
|
|
2248
2532
|
!manifestJson.metaData && "metaData",
|
|
2249
2533
|
!manifestJson.exposes && "exposes",
|
|
2250
2534
|
!manifestJson.shared && "shared"
|
|
2251
|
-
].filter(Boolean)
|
|
2535
|
+
].filter(Boolean);
|
|
2536
|
+
if (missingRequiredFields.length > 0) await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
2537
|
+
id: manifestUrl,
|
|
2538
|
+
error: /* @__PURE__ */ new Error(`"${manifestUrl}" is not a valid federation manifest for remote "${moduleInfo.name}". Missing required fields: ${missingRequiredFields.join(", ")}.`),
|
|
2539
|
+
from: "runtime",
|
|
2540
|
+
lifecycle: "afterResolve",
|
|
2541
|
+
remote: remoteInfo,
|
|
2542
|
+
origin: this.HostInstance
|
|
2543
|
+
});
|
|
2544
|
+
if (missingRequiredFields.length > 0) error(RUNTIME_013, runtimeDescMap, {
|
|
2545
|
+
manifestUrl,
|
|
2546
|
+
moduleName: moduleInfo.name,
|
|
2547
|
+
hostName: this.HostInstance.options.name,
|
|
2548
|
+
missingFields: missingRequiredFields.join(",")
|
|
2549
|
+
}, void 0, optionsToMFContext(this.HostInstance.options));
|
|
2252
2550
|
this.manifestCache.set(manifestUrl, manifestJson);
|
|
2253
2551
|
return manifestJson;
|
|
2254
2552
|
};
|
|
2553
|
+
return getManifest();
|
|
2554
|
+
}
|
|
2555
|
+
async loadManifestSnapshot(manifestUrl, moduleInfo, extraOptions, resourceOptions) {
|
|
2255
2556
|
const asyncLoadProcess = async () => {
|
|
2256
|
-
const manifestJson = await
|
|
2557
|
+
const manifestJson = await this.getManifestJson(manifestUrl, moduleInfo, extraOptions, resourceOptions);
|
|
2257
2558
|
const remoteSnapshot = generateSnapshotFromManifest(manifestJson, { version: manifestUrl });
|
|
2258
2559
|
const { remoteSnapshot: remoteSnapshotRes } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
2259
2560
|
options: this.HostInstance.options,
|
|
@@ -2270,7 +2571,7 @@ var SnapshotHandler = class {
|
|
|
2270
2571
|
}
|
|
2271
2572
|
};
|
|
2272
2573
|
//#endregion
|
|
2273
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
2574
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/shared/index.js
|
|
2274
2575
|
var SharedHandler = class {
|
|
2275
2576
|
constructor(host) {
|
|
2276
2577
|
this.hooks = new PluginSystem({
|
|
@@ -2278,6 +2579,8 @@ var SharedHandler = class {
|
|
|
2278
2579
|
afterResolve: new AsyncWaterfallHook("afterResolve"),
|
|
2279
2580
|
beforeLoadShare: new AsyncWaterfallHook("beforeLoadShare"),
|
|
2280
2581
|
loadShare: new AsyncHook(),
|
|
2582
|
+
afterLoadShare: new SyncHook("afterLoadShare"),
|
|
2583
|
+
errorLoadShare: new SyncHook("errorLoadShare"),
|
|
2281
2584
|
resolveShare: new SyncWaterfallHook("resolveShare"),
|
|
2282
2585
|
initContainerShareScopeMap: new SyncWaterfallHook("initContainerShareScopeMap")
|
|
2283
2586
|
});
|
|
@@ -2286,6 +2589,37 @@ var SharedHandler = class {
|
|
|
2286
2589
|
this.initTokens = {};
|
|
2287
2590
|
this._setGlobalShareScopeMap(host.options);
|
|
2288
2591
|
}
|
|
2592
|
+
emitAfterLoadShare({ lifecycle, pkgName, shareInfo, selectedShared }) {
|
|
2593
|
+
try {
|
|
2594
|
+
this.hooks.lifecycle.afterLoadShare.emit({
|
|
2595
|
+
pkgName,
|
|
2596
|
+
shareInfo,
|
|
2597
|
+
selectedShared,
|
|
2598
|
+
shared: this.host.options.shared,
|
|
2599
|
+
shareScopeMap: this.shareScopeMap,
|
|
2600
|
+
lifecycle,
|
|
2601
|
+
origin: this.host
|
|
2602
|
+
});
|
|
2603
|
+
} catch (error) {
|
|
2604
|
+
warn$1(error);
|
|
2605
|
+
}
|
|
2606
|
+
}
|
|
2607
|
+
emitErrorLoadShare({ lifecycle, pkgName, shareInfo, error, recovered }) {
|
|
2608
|
+
try {
|
|
2609
|
+
this.hooks.lifecycle.errorLoadShare.emit({
|
|
2610
|
+
pkgName,
|
|
2611
|
+
shareInfo,
|
|
2612
|
+
shared: this.host.options.shared,
|
|
2613
|
+
shareScopeMap: this.shareScopeMap,
|
|
2614
|
+
lifecycle,
|
|
2615
|
+
origin: this.host,
|
|
2616
|
+
error,
|
|
2617
|
+
recovered
|
|
2618
|
+
});
|
|
2619
|
+
} catch (hookError) {
|
|
2620
|
+
warn$1(hookError);
|
|
2621
|
+
}
|
|
2622
|
+
}
|
|
2289
2623
|
registerShared(globalOptions, userOptions) {
|
|
2290
2624
|
const { newShareInfos, allShareInfos } = formatShareConfigs(globalOptions, userOptions);
|
|
2291
2625
|
Object.keys(newShareInfos).forEach((sharedKey) => {
|
|
@@ -2319,77 +2653,123 @@ var SharedHandler = class {
|
|
|
2319
2653
|
extraOptions,
|
|
2320
2654
|
shareInfos: host.options.shared
|
|
2321
2655
|
});
|
|
2322
|
-
|
|
2323
|
-
|
|
2324
|
-
|
|
2325
|
-
|
|
2326
|
-
|
|
2327
|
-
|
|
2328
|
-
|
|
2329
|
-
|
|
2330
|
-
|
|
2331
|
-
|
|
2332
|
-
|
|
2333
|
-
|
|
2334
|
-
const
|
|
2335
|
-
|
|
2336
|
-
|
|
2337
|
-
|
|
2338
|
-
|
|
2339
|
-
|
|
2340
|
-
|
|
2341
|
-
|
|
2342
|
-
|
|
2343
|
-
|
|
2656
|
+
let shareOptionsRes = shareOptions;
|
|
2657
|
+
try {
|
|
2658
|
+
if (shareOptions?.scope) await Promise.all(shareOptions.scope.map(async (shareScope) => {
|
|
2659
|
+
await Promise.all(this.initializeSharing(shareScope, { strategy: shareOptions.strategy }));
|
|
2660
|
+
}));
|
|
2661
|
+
shareOptionsRes = (await this.hooks.lifecycle.beforeLoadShare.emit({
|
|
2662
|
+
pkgName,
|
|
2663
|
+
shareInfo: shareOptions,
|
|
2664
|
+
shared: host.options.shared,
|
|
2665
|
+
origin: host
|
|
2666
|
+
})).shareInfo;
|
|
2667
|
+
assert(shareOptionsRes, `Cannot find shared "${pkgName}" in host "${host.options.name}". Ensure the shared config for "${pkgName}" is declared in the federation plugin options and the host has been initialized before loading shares.`);
|
|
2668
|
+
const resolvedShareOptions = shareOptionsRes;
|
|
2669
|
+
const { shared: registeredShared, useTreesShaking } = getRegisteredShare(this.shareScopeMap, pkgName, shareOptionsRes, this.hooks.lifecycle.resolveShare) || {};
|
|
2670
|
+
if (registeredShared) {
|
|
2671
|
+
const targetShared = directShare(registeredShared, useTreesShaking);
|
|
2672
|
+
if (targetShared.lib) {
|
|
2673
|
+
addUseIn(targetShared, host.options.name);
|
|
2674
|
+
this.emitAfterLoadShare({
|
|
2675
|
+
lifecycle: "loadShare",
|
|
2676
|
+
pkgName,
|
|
2677
|
+
shareInfo: resolvedShareOptions,
|
|
2678
|
+
selectedShared: registeredShared
|
|
2679
|
+
});
|
|
2680
|
+
return targetShared.lib;
|
|
2681
|
+
} else if (targetShared.loading && !targetShared.loaded) {
|
|
2682
|
+
const factory = await targetShared.loading;
|
|
2683
|
+
targetShared.loaded = true;
|
|
2684
|
+
if (!targetShared.lib) targetShared.lib = factory;
|
|
2685
|
+
addUseIn(targetShared, host.options.name);
|
|
2686
|
+
this.emitAfterLoadShare({
|
|
2687
|
+
lifecycle: "loadShare",
|
|
2688
|
+
pkgName,
|
|
2689
|
+
shareInfo: resolvedShareOptions,
|
|
2690
|
+
selectedShared: registeredShared
|
|
2691
|
+
});
|
|
2692
|
+
return factory;
|
|
2693
|
+
} else {
|
|
2694
|
+
const asyncLoadProcess = async () => {
|
|
2695
|
+
const factory = await targetShared.get();
|
|
2696
|
+
addUseIn(targetShared, host.options.name);
|
|
2697
|
+
targetShared.loaded = true;
|
|
2698
|
+
targetShared.lib = factory;
|
|
2699
|
+
return factory;
|
|
2700
|
+
};
|
|
2701
|
+
const loading = asyncLoadProcess();
|
|
2702
|
+
this.setShared({
|
|
2703
|
+
pkgName,
|
|
2704
|
+
loaded: false,
|
|
2705
|
+
shared: registeredShared,
|
|
2706
|
+
from: host.options.name,
|
|
2707
|
+
lib: null,
|
|
2708
|
+
loading,
|
|
2709
|
+
treeShaking: useTreesShaking ? targetShared : void 0
|
|
2710
|
+
});
|
|
2711
|
+
const factory = await loading;
|
|
2712
|
+
this.emitAfterLoadShare({
|
|
2713
|
+
lifecycle: "loadShare",
|
|
2714
|
+
pkgName,
|
|
2715
|
+
shareInfo: resolvedShareOptions,
|
|
2716
|
+
selectedShared: registeredShared
|
|
2717
|
+
});
|
|
2718
|
+
return factory;
|
|
2719
|
+
}
|
|
2344
2720
|
} else {
|
|
2721
|
+
if (extraOptions?.customShareInfo) {
|
|
2722
|
+
this.emitErrorLoadShare({
|
|
2723
|
+
lifecycle: "loadShare",
|
|
2724
|
+
pkgName,
|
|
2725
|
+
shareInfo: resolvedShareOptions,
|
|
2726
|
+
recovered: true
|
|
2727
|
+
});
|
|
2728
|
+
return false;
|
|
2729
|
+
}
|
|
2730
|
+
const _useTreeShaking = shouldUseTreeShaking(resolvedShareOptions.treeShaking);
|
|
2731
|
+
const targetShared = directShare(resolvedShareOptions, _useTreeShaking);
|
|
2345
2732
|
const asyncLoadProcess = async () => {
|
|
2346
2733
|
const factory = await targetShared.get();
|
|
2347
|
-
addUseIn(targetShared, host.options.name);
|
|
2348
|
-
targetShared.loaded = true;
|
|
2349
2734
|
targetShared.lib = factory;
|
|
2735
|
+
targetShared.loaded = true;
|
|
2736
|
+
addUseIn(targetShared, host.options.name);
|
|
2737
|
+
const { shared: gShared, useTreesShaking: gUseTreeShaking } = getRegisteredShare(this.shareScopeMap, pkgName, resolvedShareOptions, this.hooks.lifecycle.resolveShare) || {};
|
|
2738
|
+
if (gShared) {
|
|
2739
|
+
const targetGShared = directShare(gShared, gUseTreeShaking);
|
|
2740
|
+
targetGShared.lib = factory;
|
|
2741
|
+
targetGShared.loaded = true;
|
|
2742
|
+
gShared.from = resolvedShareOptions.from;
|
|
2743
|
+
}
|
|
2350
2744
|
return factory;
|
|
2351
2745
|
};
|
|
2352
2746
|
const loading = asyncLoadProcess();
|
|
2353
2747
|
this.setShared({
|
|
2354
2748
|
pkgName,
|
|
2355
2749
|
loaded: false,
|
|
2356
|
-
shared:
|
|
2750
|
+
shared: resolvedShareOptions,
|
|
2357
2751
|
from: host.options.name,
|
|
2358
2752
|
lib: null,
|
|
2359
2753
|
loading,
|
|
2360
|
-
treeShaking:
|
|
2754
|
+
treeShaking: _useTreeShaking ? targetShared : void 0
|
|
2755
|
+
});
|
|
2756
|
+
const factory = await loading;
|
|
2757
|
+
this.emitAfterLoadShare({
|
|
2758
|
+
lifecycle: "loadShare",
|
|
2759
|
+
pkgName,
|
|
2760
|
+
shareInfo: resolvedShareOptions,
|
|
2761
|
+
selectedShared: resolvedShareOptions
|
|
2361
2762
|
});
|
|
2362
|
-
return loading;
|
|
2363
|
-
}
|
|
2364
|
-
} else {
|
|
2365
|
-
if (extraOptions?.customShareInfo) return false;
|
|
2366
|
-
const _useTreeShaking = shouldUseTreeShaking(shareOptionsRes.treeShaking);
|
|
2367
|
-
const targetShared = directShare(shareOptionsRes, _useTreeShaking);
|
|
2368
|
-
const asyncLoadProcess = async () => {
|
|
2369
|
-
const factory = await targetShared.get();
|
|
2370
|
-
targetShared.lib = factory;
|
|
2371
|
-
targetShared.loaded = true;
|
|
2372
|
-
addUseIn(targetShared, host.options.name);
|
|
2373
|
-
const { shared: gShared, useTreesShaking: gUseTreeShaking } = getRegisteredShare(this.shareScopeMap, pkgName, shareOptionsRes, this.hooks.lifecycle.resolveShare) || {};
|
|
2374
|
-
if (gShared) {
|
|
2375
|
-
const targetGShared = directShare(gShared, gUseTreeShaking);
|
|
2376
|
-
targetGShared.lib = factory;
|
|
2377
|
-
targetGShared.loaded = true;
|
|
2378
|
-
gShared.from = shareOptionsRes.from;
|
|
2379
|
-
}
|
|
2380
2763
|
return factory;
|
|
2381
|
-
}
|
|
2382
|
-
|
|
2383
|
-
this.
|
|
2764
|
+
}
|
|
2765
|
+
} catch (shareError) {
|
|
2766
|
+
this.emitErrorLoadShare({
|
|
2767
|
+
lifecycle: "loadShare",
|
|
2384
2768
|
pkgName,
|
|
2385
|
-
|
|
2386
|
-
|
|
2387
|
-
from: host.options.name,
|
|
2388
|
-
lib: null,
|
|
2389
|
-
loading,
|
|
2390
|
-
treeShaking: _useTreeShaking ? targetShared : void 0
|
|
2769
|
+
shareInfo: shareOptionsRes,
|
|
2770
|
+
error: shareError
|
|
2391
2771
|
});
|
|
2392
|
-
|
|
2772
|
+
throw shareError;
|
|
2393
2773
|
}
|
|
2394
2774
|
}
|
|
2395
2775
|
/**
|
|
@@ -2434,6 +2814,7 @@ var SharedHandler = class {
|
|
|
2434
2814
|
error,
|
|
2435
2815
|
from: "runtime",
|
|
2436
2816
|
lifecycle: "beforeLoadShare",
|
|
2817
|
+
remote: module.remoteInfo,
|
|
2437
2818
|
origin: host
|
|
2438
2819
|
});
|
|
2439
2820
|
if (!remoteEntryExports) return;
|
|
@@ -2461,58 +2842,92 @@ var SharedHandler = class {
|
|
|
2461
2842
|
extraOptions,
|
|
2462
2843
|
shareInfos: host.options.shared
|
|
2463
2844
|
});
|
|
2464
|
-
|
|
2465
|
-
|
|
2466
|
-
|
|
2467
|
-
|
|
2468
|
-
|
|
2469
|
-
if (
|
|
2470
|
-
|
|
2471
|
-
if (!registeredShared.loaded) {
|
|
2472
|
-
registeredShared.loaded = true;
|
|
2473
|
-
if (registeredShared.from === host.options.name) shareOptions.loaded = true;
|
|
2474
|
-
}
|
|
2475
|
-
return registeredShared.lib;
|
|
2476
|
-
}
|
|
2477
|
-
if (typeof registeredShared.get === "function") {
|
|
2478
|
-
const module = registeredShared.get();
|
|
2479
|
-
if (!(module instanceof Promise)) {
|
|
2845
|
+
try {
|
|
2846
|
+
if (shareOptions?.scope) shareOptions.scope.forEach((shareScope) => {
|
|
2847
|
+
this.initializeSharing(shareScope, { strategy: shareOptions.strategy });
|
|
2848
|
+
});
|
|
2849
|
+
const { shared: registeredShared } = getRegisteredShare(this.shareScopeMap, pkgName, shareOptions, this.hooks.lifecycle.resolveShare) || {};
|
|
2850
|
+
if (registeredShared) {
|
|
2851
|
+
if (typeof registeredShared.lib === "function") {
|
|
2480
2852
|
addUseIn(registeredShared, host.options.name);
|
|
2481
|
-
|
|
2853
|
+
if (!registeredShared.loaded) {
|
|
2854
|
+
registeredShared.loaded = true;
|
|
2855
|
+
if (registeredShared.from === host.options.name) shareOptions.loaded = true;
|
|
2856
|
+
}
|
|
2857
|
+
this.emitAfterLoadShare({
|
|
2858
|
+
lifecycle: "loadShareSync",
|
|
2482
2859
|
pkgName,
|
|
2483
|
-
|
|
2484
|
-
|
|
2485
|
-
lib: module,
|
|
2486
|
-
shared: registeredShared
|
|
2860
|
+
shareInfo: shareOptions,
|
|
2861
|
+
selectedShared: registeredShared
|
|
2487
2862
|
});
|
|
2488
|
-
return
|
|
2863
|
+
return registeredShared.lib;
|
|
2864
|
+
}
|
|
2865
|
+
if (typeof registeredShared.get === "function") {
|
|
2866
|
+
const module = registeredShared.get();
|
|
2867
|
+
if (!(module instanceof Promise)) {
|
|
2868
|
+
addUseIn(registeredShared, host.options.name);
|
|
2869
|
+
this.setShared({
|
|
2870
|
+
pkgName,
|
|
2871
|
+
loaded: true,
|
|
2872
|
+
from: host.options.name,
|
|
2873
|
+
lib: module,
|
|
2874
|
+
shared: registeredShared
|
|
2875
|
+
});
|
|
2876
|
+
this.emitAfterLoadShare({
|
|
2877
|
+
lifecycle: "loadShareSync",
|
|
2878
|
+
pkgName,
|
|
2879
|
+
shareInfo: shareOptions,
|
|
2880
|
+
selectedShared: registeredShared
|
|
2881
|
+
});
|
|
2882
|
+
return module;
|
|
2883
|
+
}
|
|
2489
2884
|
}
|
|
2490
2885
|
}
|
|
2491
|
-
|
|
2492
|
-
|
|
2493
|
-
|
|
2494
|
-
|
|
2495
|
-
|
|
2496
|
-
|
|
2497
|
-
|
|
2498
|
-
|
|
2886
|
+
if (shareOptions.lib) {
|
|
2887
|
+
if (!shareOptions.loaded) shareOptions.loaded = true;
|
|
2888
|
+
this.emitAfterLoadShare({
|
|
2889
|
+
lifecycle: "loadShareSync",
|
|
2890
|
+
pkgName,
|
|
2891
|
+
shareInfo: shareOptions,
|
|
2892
|
+
selectedShared: shareOptions
|
|
2893
|
+
});
|
|
2894
|
+
return shareOptions.lib;
|
|
2895
|
+
}
|
|
2896
|
+
if (shareOptions.get) {
|
|
2897
|
+
const module = shareOptions.get();
|
|
2898
|
+
if (module instanceof Promise) error(extraOptions?.from === "build" ? RUNTIME_005 : RUNTIME_006, runtimeDescMap, {
|
|
2899
|
+
hostName: host.options.name,
|
|
2900
|
+
sharedPkgName: pkgName
|
|
2901
|
+
}, void 0, optionsToMFContext(host.options));
|
|
2902
|
+
shareOptions.lib = module;
|
|
2903
|
+
this.setShared({
|
|
2904
|
+
pkgName,
|
|
2905
|
+
loaded: true,
|
|
2906
|
+
from: host.options.name,
|
|
2907
|
+
lib: shareOptions.lib,
|
|
2908
|
+
shared: shareOptions
|
|
2909
|
+
});
|
|
2910
|
+
this.emitAfterLoadShare({
|
|
2911
|
+
lifecycle: "loadShareSync",
|
|
2912
|
+
pkgName,
|
|
2913
|
+
shareInfo: shareOptions,
|
|
2914
|
+
selectedShared: shareOptions
|
|
2915
|
+
});
|
|
2916
|
+
return shareOptions.lib;
|
|
2917
|
+
}
|
|
2918
|
+
error(RUNTIME_006, runtimeDescMap, {
|
|
2499
2919
|
hostName: host.options.name,
|
|
2500
2920
|
sharedPkgName: pkgName
|
|
2501
2921
|
}, void 0, optionsToMFContext(host.options));
|
|
2502
|
-
|
|
2503
|
-
this.
|
|
2922
|
+
} catch (shareError) {
|
|
2923
|
+
this.emitErrorLoadShare({
|
|
2924
|
+
lifecycle: "loadShareSync",
|
|
2504
2925
|
pkgName,
|
|
2505
|
-
|
|
2506
|
-
|
|
2507
|
-
lib: shareOptions.lib,
|
|
2508
|
-
shared: shareOptions
|
|
2926
|
+
shareInfo: shareOptions,
|
|
2927
|
+
error: shareError
|
|
2509
2928
|
});
|
|
2510
|
-
|
|
2929
|
+
throw shareError;
|
|
2511
2930
|
}
|
|
2512
|
-
error(RUNTIME_006, runtimeDescMap, {
|
|
2513
|
-
hostName: host.options.name,
|
|
2514
|
-
sharedPkgName: pkgName
|
|
2515
|
-
}, void 0, optionsToMFContext(host.options));
|
|
2516
2931
|
}
|
|
2517
2932
|
initShareScopeMap(scopeName, shareScope, extraOptions = {}) {
|
|
2518
2933
|
const { host } = this;
|
|
@@ -2558,19 +2973,21 @@ var SharedHandler = class {
|
|
|
2558
2973
|
}
|
|
2559
2974
|
};
|
|
2560
2975
|
//#endregion
|
|
2561
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
2976
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/remote/index.js
|
|
2562
2977
|
var RemoteHandler = class {
|
|
2563
2978
|
constructor(host) {
|
|
2564
2979
|
this.hooks = new PluginSystem({
|
|
2565
2980
|
beforeRegisterRemote: new SyncWaterfallHook("beforeRegisterRemote"),
|
|
2566
2981
|
registerRemote: new SyncWaterfallHook("registerRemote"),
|
|
2567
2982
|
beforeRequest: new AsyncWaterfallHook("beforeRequest"),
|
|
2983
|
+
afterMatchRemote: new AsyncHook("afterMatchRemote"),
|
|
2568
2984
|
onLoad: new AsyncHook("onLoad"),
|
|
2985
|
+
afterLoadRemote: new AsyncHook("afterLoadRemote"),
|
|
2569
2986
|
handlePreloadModule: new SyncHook("handlePreloadModule"),
|
|
2570
2987
|
errorLoadRemote: new AsyncHook("errorLoadRemote"),
|
|
2571
2988
|
beforePreloadRemote: new AsyncHook("beforePreloadRemote"),
|
|
2572
2989
|
generatePreloadAssets: new AsyncHook("generatePreloadAssets"),
|
|
2573
|
-
afterPreloadRemote: new AsyncHook(),
|
|
2990
|
+
afterPreloadRemote: new AsyncHook("afterPreloadRemote"),
|
|
2574
2991
|
loadEntry: new AsyncHook()
|
|
2575
2992
|
});
|
|
2576
2993
|
this.host = host;
|
|
@@ -2607,10 +3024,18 @@ var RemoteHandler = class {
|
|
|
2607
3024
|
}
|
|
2608
3025
|
async loadRemote(id, options) {
|
|
2609
3026
|
const { host } = this;
|
|
3027
|
+
const startMatchInfo = matchRemoteWithNameAndExpose(host.options.remotes, id);
|
|
3028
|
+
let completeRequestId = id;
|
|
3029
|
+
let completeExpose = startMatchInfo?.expose;
|
|
3030
|
+
let completeRemote = startMatchInfo ? getRemoteInfo(startMatchInfo.remote) : void 0;
|
|
3031
|
+
let afterLoadRemoteArgs;
|
|
2610
3032
|
try {
|
|
2611
3033
|
const { loadFactory = true } = options || { loadFactory: true };
|
|
2612
3034
|
const { module, moduleOptions, remoteMatchInfo } = await this.getRemoteModuleAndOptions({ id });
|
|
2613
3035
|
const { pkgNameOrAlias, remote, expose, id: idRes, remoteSnapshot } = remoteMatchInfo;
|
|
3036
|
+
completeRequestId = idRes;
|
|
3037
|
+
completeExpose = expose;
|
|
3038
|
+
completeRemote = getRemoteInfo(remote);
|
|
2614
3039
|
const moduleOrFactory = await module.get(idRes, expose, options, remoteSnapshot);
|
|
2615
3040
|
const moduleWrapper = await this.hooks.lifecycle.onLoad.emit({
|
|
2616
3041
|
id: idRes,
|
|
@@ -2624,44 +3049,155 @@ var RemoteHandler = class {
|
|
|
2624
3049
|
origin: host
|
|
2625
3050
|
});
|
|
2626
3051
|
this.setIdToRemoteMap(id, remoteMatchInfo);
|
|
3052
|
+
afterLoadRemoteArgs = {
|
|
3053
|
+
id: completeRequestId,
|
|
3054
|
+
expose: completeExpose,
|
|
3055
|
+
remote: completeRemote,
|
|
3056
|
+
options,
|
|
3057
|
+
origin: host
|
|
3058
|
+
};
|
|
2627
3059
|
if (typeof moduleWrapper === "function") return moduleWrapper;
|
|
2628
3060
|
return moduleOrFactory;
|
|
2629
3061
|
} catch (error) {
|
|
2630
3062
|
const { from = "runtime" } = options || { from: "runtime" };
|
|
2631
|
-
|
|
2632
|
-
|
|
3063
|
+
let failOver;
|
|
3064
|
+
try {
|
|
3065
|
+
failOver = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
3066
|
+
id,
|
|
3067
|
+
error,
|
|
3068
|
+
from,
|
|
3069
|
+
lifecycle: "onLoad",
|
|
3070
|
+
expose: completeExpose,
|
|
3071
|
+
remote: completeRemote,
|
|
3072
|
+
origin: host
|
|
3073
|
+
});
|
|
3074
|
+
} catch (hookError) {
|
|
3075
|
+
afterLoadRemoteArgs = {
|
|
3076
|
+
id: completeRequestId,
|
|
3077
|
+
expose: completeExpose,
|
|
3078
|
+
remote: completeRemote,
|
|
3079
|
+
options,
|
|
3080
|
+
error: hookError,
|
|
3081
|
+
origin: host
|
|
3082
|
+
};
|
|
3083
|
+
throw hookError;
|
|
3084
|
+
}
|
|
3085
|
+
if (!failOver) {
|
|
3086
|
+
afterLoadRemoteArgs = {
|
|
3087
|
+
id: completeRequestId,
|
|
3088
|
+
expose: completeExpose,
|
|
3089
|
+
remote: completeRemote,
|
|
3090
|
+
options,
|
|
3091
|
+
error,
|
|
3092
|
+
origin: host
|
|
3093
|
+
};
|
|
3094
|
+
throw error;
|
|
3095
|
+
}
|
|
3096
|
+
afterLoadRemoteArgs = {
|
|
3097
|
+
id: completeRequestId,
|
|
3098
|
+
expose: completeExpose,
|
|
3099
|
+
remote: completeRemote,
|
|
3100
|
+
options,
|
|
2633
3101
|
error,
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2637
|
-
});
|
|
2638
|
-
if (!failOver) throw error;
|
|
3102
|
+
origin: host,
|
|
3103
|
+
recovered: true
|
|
3104
|
+
};
|
|
2639
3105
|
return failOver;
|
|
3106
|
+
} finally {
|
|
3107
|
+
if (afterLoadRemoteArgs) await this.hooks.lifecycle.afterLoadRemote.emit(afterLoadRemoteArgs);
|
|
2640
3108
|
}
|
|
2641
3109
|
}
|
|
2642
3110
|
async preloadRemote(preloadOptions) {
|
|
2643
3111
|
const { host } = this;
|
|
3112
|
+
const preloadResults = [];
|
|
2644
3113
|
await this.hooks.lifecycle.beforePreloadRemote.emit({
|
|
2645
3114
|
preloadOps: preloadOptions,
|
|
2646
3115
|
options: host.options,
|
|
2647
3116
|
origin: host
|
|
2648
3117
|
});
|
|
2649
3118
|
const preloadOps = formatPreloadArgs(host.options.remotes, preloadOptions);
|
|
2650
|
-
|
|
2651
|
-
const { remote } = ops;
|
|
3119
|
+
const createPreloadAssetOps = (ops) => {
|
|
3120
|
+
const { preloadConfig, remote } = ops;
|
|
3121
|
+
const exposes = preloadConfig.exposes || [];
|
|
3122
|
+
if (!exposes.length) return [{
|
|
3123
|
+
ops,
|
|
3124
|
+
id: `${remote.name}/*`
|
|
3125
|
+
}];
|
|
3126
|
+
return exposes.map((expose) => ({
|
|
3127
|
+
ops: {
|
|
3128
|
+
...ops,
|
|
3129
|
+
preloadConfig: {
|
|
3130
|
+
...preloadConfig,
|
|
3131
|
+
exposes: [expose]
|
|
3132
|
+
}
|
|
3133
|
+
},
|
|
3134
|
+
id: composeRemoteRequestId(remote.name, expose)
|
|
3135
|
+
}));
|
|
3136
|
+
};
|
|
3137
|
+
let preloadError;
|
|
3138
|
+
await Promise.all(preloadOps.flatMap(createPreloadAssetOps).map(async (assetOps) => {
|
|
3139
|
+
const { ops, id: preloadId } = assetOps;
|
|
3140
|
+
const { remote, preloadConfig } = ops;
|
|
2652
3141
|
const remoteInfo = getRemoteInfo(remote);
|
|
2653
|
-
|
|
2654
|
-
|
|
2655
|
-
|
|
2656
|
-
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
3142
|
+
try {
|
|
3143
|
+
const { globalSnapshot, remoteSnapshot } = await host.snapshotHandler.loadRemoteSnapshotInfo({
|
|
3144
|
+
moduleInfo: remote,
|
|
3145
|
+
id: preloadId,
|
|
3146
|
+
initiator: "preloadRemote"
|
|
3147
|
+
});
|
|
3148
|
+
const assets = await this.hooks.lifecycle.generatePreloadAssets.emit({
|
|
3149
|
+
origin: host,
|
|
3150
|
+
preloadOptions: ops,
|
|
3151
|
+
remote,
|
|
3152
|
+
remoteInfo,
|
|
3153
|
+
globalSnapshot,
|
|
3154
|
+
remoteSnapshot
|
|
3155
|
+
});
|
|
3156
|
+
if (!assets) return;
|
|
3157
|
+
const results = await preloadAssets(remoteInfo, host, assets, true, {
|
|
3158
|
+
initiator: "preloadRemote",
|
|
3159
|
+
id: preloadId
|
|
3160
|
+
});
|
|
3161
|
+
preloadResults.push({
|
|
3162
|
+
remote,
|
|
3163
|
+
remoteInfo,
|
|
3164
|
+
preloadConfig,
|
|
3165
|
+
id: preloadId,
|
|
3166
|
+
results
|
|
3167
|
+
});
|
|
3168
|
+
} catch (error) {
|
|
3169
|
+
preloadResults.push({
|
|
3170
|
+
remote,
|
|
3171
|
+
remoteInfo,
|
|
3172
|
+
preloadConfig,
|
|
3173
|
+
id: preloadId,
|
|
3174
|
+
results: [{
|
|
3175
|
+
url: remoteInfo.entry,
|
|
3176
|
+
status: "error",
|
|
3177
|
+
resourceType: /\.json(?:$|[?#])/i.test(remoteInfo.entry) ? "manifest" : "remoteEntry",
|
|
3178
|
+
initiator: "preloadRemote",
|
|
3179
|
+
id: preloadId,
|
|
3180
|
+
error
|
|
3181
|
+
}]
|
|
3182
|
+
});
|
|
3183
|
+
}
|
|
2664
3184
|
}));
|
|
3185
|
+
const failedResults = preloadResults.flatMap((preloadResult) => preloadResult.results.filter((result) => result.status === "error" || result.status === "timeout"));
|
|
3186
|
+
if (failedResults.length > 0) {
|
|
3187
|
+
preloadError = /* @__PURE__ */ new Error(`preloadRemote failed to load ${failedResults.length} resource(s).`);
|
|
3188
|
+
Object.assign(preloadError, {
|
|
3189
|
+
results: preloadResults,
|
|
3190
|
+
failedResults
|
|
3191
|
+
});
|
|
3192
|
+
}
|
|
3193
|
+
await this.hooks.lifecycle.afterPreloadRemote.emit({
|
|
3194
|
+
preloadOps: preloadOptions,
|
|
3195
|
+
options: host.options,
|
|
3196
|
+
origin: host,
|
|
3197
|
+
results: preloadResults,
|
|
3198
|
+
error: preloadError
|
|
3199
|
+
});
|
|
3200
|
+
if (preloadError) throw preloadError;
|
|
2665
3201
|
}
|
|
2666
3202
|
registerRemotes(remotes, options) {
|
|
2667
3203
|
const { host } = this;
|
|
@@ -2692,12 +3228,29 @@ var RemoteHandler = class {
|
|
|
2692
3228
|
}
|
|
2693
3229
|
const { id: idRes } = loadRemoteArgs;
|
|
2694
3230
|
const remoteSplitInfo = matchRemoteWithNameAndExpose(host.options.remotes, idRes);
|
|
2695
|
-
if (!remoteSplitInfo)
|
|
2696
|
-
|
|
2697
|
-
|
|
2698
|
-
|
|
3231
|
+
if (!remoteSplitInfo) try {
|
|
3232
|
+
error(RUNTIME_004, runtimeDescMap, {
|
|
3233
|
+
hostName: host.options.name,
|
|
3234
|
+
requestId: idRes
|
|
3235
|
+
}, void 0, optionsToMFContext(host.options));
|
|
3236
|
+
} catch (matchError) {
|
|
3237
|
+
await this.hooks.lifecycle.afterMatchRemote.emit({
|
|
3238
|
+
id: idRes,
|
|
3239
|
+
options: host.options,
|
|
3240
|
+
error: matchError,
|
|
3241
|
+
origin: host
|
|
3242
|
+
});
|
|
3243
|
+
throw matchError;
|
|
3244
|
+
}
|
|
2699
3245
|
const { remote: rawRemote } = remoteSplitInfo;
|
|
2700
3246
|
const remoteInfo = getRemoteInfo(rawRemote);
|
|
3247
|
+
await this.hooks.lifecycle.afterMatchRemote.emit({
|
|
3248
|
+
id: idRes,
|
|
3249
|
+
...remoteSplitInfo,
|
|
3250
|
+
options: host.options,
|
|
3251
|
+
remoteInfo,
|
|
3252
|
+
origin: host
|
|
3253
|
+
});
|
|
2701
3254
|
const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit({
|
|
2702
3255
|
id: idRes,
|
|
2703
3256
|
...remoteSplitInfo,
|
|
@@ -2767,6 +3320,17 @@ var RemoteHandler = class {
|
|
|
2767
3320
|
const { name } = remote;
|
|
2768
3321
|
const remoteIndex = host.options.remotes.findIndex((item) => item.name === name);
|
|
2769
3322
|
if (remoteIndex !== -1) host.options.remotes.splice(remoteIndex, 1);
|
|
3323
|
+
const globalSnapshotKey = getInfoWithoutType(CurrentGlobal.__FEDERATION__.moduleInfo, getFMId(remote)).key;
|
|
3324
|
+
delete CurrentGlobal.__FEDERATION__.moduleInfo[globalSnapshotKey];
|
|
3325
|
+
if ("entry" in remote) {
|
|
3326
|
+
host.snapshotHandler.manifestCache.delete(remote.entry);
|
|
3327
|
+
delete Global.__FEDERATION__.__MANIFEST_LOADING__[remote.entry];
|
|
3328
|
+
}
|
|
3329
|
+
const { hostGlobalSnapshot } = getGlobalRemoteInfo(remote, host);
|
|
3330
|
+
if (hostGlobalSnapshot) {
|
|
3331
|
+
const remoteKey = hostGlobalSnapshot && "remotesInfo" in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && getInfoWithoutType(hostGlobalSnapshot.remotesInfo, remote.name).key;
|
|
3332
|
+
if (remoteKey) delete hostGlobalSnapshot.remotesInfo[remoteKey];
|
|
3333
|
+
}
|
|
2770
3334
|
const loadedModule = host.moduleCache.get(remote.name);
|
|
2771
3335
|
if (loadedModule) {
|
|
2772
3336
|
const remoteInfo = loadedModule.remoteInfo;
|
|
@@ -2775,7 +3339,6 @@ var RemoteHandler = class {
|
|
|
2775
3339
|
else CurrentGlobal[key] = void 0;
|
|
2776
3340
|
const remoteEntryUniqueKey = getRemoteEntryUniqueKey(loadedModule.remoteInfo);
|
|
2777
3341
|
if (globalLoading[remoteEntryUniqueKey]) delete globalLoading[remoteEntryUniqueKey];
|
|
2778
|
-
host.snapshotHandler.manifestCache.delete(remoteInfo.entry);
|
|
2779
3342
|
let remoteInsId = remoteInfo.buildVersion ? composeKeyWithSeparator(remoteInfo.name, remoteInfo.buildVersion) : remoteInfo.name;
|
|
2780
3343
|
const remoteInsIndex = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((ins) => {
|
|
2781
3344
|
if (remoteInfo.buildVersion) return ins.options.id === remoteInsId;
|
|
@@ -2823,14 +3386,6 @@ var RemoteHandler = class {
|
|
|
2823
3386
|
});
|
|
2824
3387
|
CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(remoteInsIndex, 1);
|
|
2825
3388
|
}
|
|
2826
|
-
const { hostGlobalSnapshot } = getGlobalRemoteInfo(remote, host);
|
|
2827
|
-
if (hostGlobalSnapshot) {
|
|
2828
|
-
const remoteKey = hostGlobalSnapshot && "remotesInfo" in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && getInfoWithoutType(hostGlobalSnapshot.remotesInfo, remote.name).key;
|
|
2829
|
-
if (remoteKey) {
|
|
2830
|
-
delete hostGlobalSnapshot.remotesInfo[remoteKey];
|
|
2831
|
-
if (Boolean(Global.__FEDERATION__.__MANIFEST_LOADING__[remoteKey])) delete Global.__FEDERATION__.__MANIFEST_LOADING__[remoteKey];
|
|
2832
|
-
}
|
|
2833
|
-
}
|
|
2834
3389
|
host.moduleCache.delete(remote.name);
|
|
2835
3390
|
}
|
|
2836
3391
|
} catch (err) {
|
|
@@ -2839,7 +3394,7 @@ var RemoteHandler = class {
|
|
|
2839
3394
|
}
|
|
2840
3395
|
};
|
|
2841
3396
|
//#endregion
|
|
2842
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.
|
|
3397
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime-core@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime-core/dist/core.js
|
|
2843
3398
|
var USE_SNAPSHOT = typeof FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN === "boolean" ? !FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN : true;
|
|
2844
3399
|
var ModuleFederation = class {
|
|
2845
3400
|
constructor(userOptions) {
|
|
@@ -2849,7 +3404,7 @@ var ModuleFederation = class {
|
|
|
2849
3404
|
beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
|
|
2850
3405
|
initContainer: new AsyncWaterfallHook("initContainer")
|
|
2851
3406
|
});
|
|
2852
|
-
this.version = "2.
|
|
3407
|
+
this.version = "2.6.0";
|
|
2853
3408
|
this.moduleCache = /* @__PURE__ */ new Map();
|
|
2854
3409
|
this.loaderHook = new PluginSystem({
|
|
2855
3410
|
getModuleInfo: new SyncHook(),
|
|
@@ -2857,6 +3412,13 @@ var ModuleFederation = class {
|
|
|
2857
3412
|
createLink: new SyncHook(),
|
|
2858
3413
|
fetch: new AsyncHook(),
|
|
2859
3414
|
loadEntryError: new AsyncHook(),
|
|
3415
|
+
afterLoadEntry: new AsyncHook("afterLoadEntry"),
|
|
3416
|
+
beforeInitRemote: new AsyncHook("beforeInitRemote"),
|
|
3417
|
+
afterInitRemote: new AsyncHook("afterInitRemote"),
|
|
3418
|
+
beforeGetExpose: new AsyncHook("beforeGetExpose"),
|
|
3419
|
+
afterGetExpose: new AsyncHook("afterGetExpose"),
|
|
3420
|
+
beforeExecuteFactory: new AsyncHook("beforeExecuteFactory"),
|
|
3421
|
+
afterExecuteFactory: new AsyncHook("afterExecuteFactory"),
|
|
2860
3422
|
getModuleFactory: new AsyncHook()
|
|
2861
3423
|
});
|
|
2862
3424
|
this.bridgeHook = new PluginSystem({
|
|
@@ -2968,7 +3530,7 @@ var ModuleFederation = class {
|
|
|
2968
3530
|
}
|
|
2969
3531
|
};
|
|
2970
3532
|
//#endregion
|
|
2971
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime@2.
|
|
3533
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime/dist/utils.js
|
|
2972
3534
|
function getBuilderId() {
|
|
2973
3535
|
return typeof FEDERATION_BUILD_IDENTIFIER !== "undefined" ? FEDERATION_BUILD_IDENTIFIER : "";
|
|
2974
3536
|
}
|
|
@@ -2982,7 +3544,7 @@ function getGlobalFederationInstance(name, version) {
|
|
|
2982
3544
|
});
|
|
2983
3545
|
}
|
|
2984
3546
|
//#endregion
|
|
2985
|
-
//#region ../../node_modules/.pnpm/@module-federation+runtime@2.
|
|
3547
|
+
//#region ../../node_modules/.pnpm/@module-federation+runtime@2.6.0_node-fetch@2.7.0/node_modules/@module-federation/runtime/dist/index.js
|
|
2986
3548
|
function createInstance(options) {
|
|
2987
3549
|
const instance = new ((getGlobalFederationConstructor()) || ModuleFederation)({
|
|
2988
3550
|
id: `${options.name}@${options.version || Date.now()}`,
|
|
@@ -2992,10 +3554,7 @@ function createInstance(options) {
|
|
|
2992
3554
|
return instance;
|
|
2993
3555
|
}
|
|
2994
3556
|
var FederationInstance = null;
|
|
2995
|
-
|
|
2996
|
-
* @deprecated Use createInstance or getInstance instead
|
|
2997
|
-
*/
|
|
2998
|
-
function init(options) {
|
|
3557
|
+
function init$1(options) {
|
|
2999
3558
|
const instance = getGlobalFederationInstance(options.name, options.version);
|
|
3000
3559
|
const normalizedOptions = {
|
|
3001
3560
|
...options,
|
|
@@ -3012,6 +3571,322 @@ function init(options) {
|
|
|
3012
3571
|
}
|
|
3013
3572
|
setGlobalFederationConstructor(ModuleFederation);
|
|
3014
3573
|
//#endregion
|
|
3015
|
-
|
|
3574
|
+
//#region virtual:mf-REMOTE_ENTRY_ID:__mfe_internal__plugin-auth__remoteEntry_js
|
|
3575
|
+
if (typeof __VUE_HMR_RUNTIME__ === "undefined") globalThis.__VUE_HMR_RUNTIME__ = {
|
|
3576
|
+
createRecord() {},
|
|
3577
|
+
rerender() {},
|
|
3578
|
+
reload() {}
|
|
3579
|
+
};
|
|
3580
|
+
var __mfResolveGlobalKey = "__mf_init__virtual:mf:__mfe_internal__plugin_mf_2_auth__mf_v__runtimeInit__mf_v__.js__";
|
|
3581
|
+
var __mfResolveState = globalThis[__mfResolveGlobalKey];
|
|
3582
|
+
if (!__mfResolveState) {
|
|
3583
|
+
let initResolve, initReject;
|
|
3584
|
+
const initPromise = new Promise((re, rj) => {
|
|
3585
|
+
initResolve = re;
|
|
3586
|
+
initReject = rj;
|
|
3587
|
+
});
|
|
3588
|
+
__mfResolveState = globalThis[__mfResolveGlobalKey] = {
|
|
3589
|
+
initPromise,
|
|
3590
|
+
initResolve,
|
|
3591
|
+
initReject
|
|
3592
|
+
};
|
|
3593
|
+
}
|
|
3594
|
+
var initResolve = __mfResolveState.initResolve;
|
|
3595
|
+
var __mfCacheGlobalKey = "__mf_module_cache__";
|
|
3596
|
+
globalThis[__mfCacheGlobalKey] ||= {
|
|
3597
|
+
share: {},
|
|
3598
|
+
remote: {}
|
|
3599
|
+
};
|
|
3600
|
+
globalThis[__mfCacheGlobalKey].share ||= {};
|
|
3601
|
+
globalThis[__mfCacheGlobalKey].remote ||= {};
|
|
3602
|
+
var __mfModuleCache = globalThis[__mfCacheGlobalKey];
|
|
3603
|
+
for (const __mfShareKey of Object.keys(__mfModuleCache.share)) if (__mfShareKey.startsWith("default:")) {
|
|
3604
|
+
const __mfLegacyShareKey = __mfShareKey.slice(8);
|
|
3605
|
+
if (__mfModuleCache.share[__mfLegacyShareKey] === void 0) __mfModuleCache.share[__mfLegacyShareKey] = __mfModuleCache.share[__mfShareKey];
|
|
3606
|
+
} else if (!__mfShareKey.includes(":")) {
|
|
3607
|
+
const __mfDefaultShareKey = "default:" + __mfShareKey;
|
|
3608
|
+
if (__mfModuleCache.share[__mfDefaultShareKey] === void 0) __mfModuleCache.share[__mfDefaultShareKey] = __mfModuleCache.share[__mfShareKey];
|
|
3609
|
+
}
|
|
3610
|
+
var initTokens = {};
|
|
3611
|
+
var shareScopeName = "default";
|
|
3612
|
+
var mfName = "plugin-auth";
|
|
3613
|
+
var localSharedImportMapPromise;
|
|
3614
|
+
var exposesMapPromise;
|
|
3615
|
+
async function retrySharedInit(fn) {
|
|
3616
|
+
for (let attempt = 0;; attempt++) try {
|
|
3617
|
+
return await fn();
|
|
3618
|
+
} catch (e) {
|
|
3619
|
+
throw e;
|
|
3620
|
+
}
|
|
3621
|
+
}
|
|
3622
|
+
async function getLocalSharedImportMap() {
|
|
3623
|
+
if (!localSharedImportMapPromise) localSharedImportMapPromise = retrySharedInit(() => __vitePreload(() => import("./_virtual_mf-localSharedImportMap___mfe_internal__plugin_mf_2_auth-Bd_uRhIr.js"), [], import.meta.url)).catch((e) => {
|
|
3624
|
+
localSharedImportMapPromise = void 0;
|
|
3625
|
+
throw e;
|
|
3626
|
+
});
|
|
3627
|
+
return localSharedImportMapPromise;
|
|
3628
|
+
}
|
|
3629
|
+
async function getExposesMap() {
|
|
3630
|
+
if (!exposesMapPromise) exposesMapPromise = retrySharedInit(() => __vitePreload(() => import("./virtualExposes-B_hX31Ln.js"), [], import.meta.url)).then((mod) => mod.default ?? mod).catch((e) => {
|
|
3631
|
+
exposesMapPromise = void 0;
|
|
3632
|
+
throw e;
|
|
3633
|
+
});
|
|
3634
|
+
return exposesMapPromise;
|
|
3635
|
+
}
|
|
3636
|
+
async function init(shared = {}, initScope = []) {
|
|
3637
|
+
const __mfGetSharedCacheKey = (pkg, singleton, version, scope) => {
|
|
3638
|
+
const prefix = ((Array.isArray(scope) ? scope[0] : scope) || "default") + ":";
|
|
3639
|
+
return singleton || !version ? prefix + pkg : prefix + pkg + "@" + version;
|
|
3640
|
+
};
|
|
3641
|
+
const { usedShared, usedRemotes } = await getLocalSharedImportMap();
|
|
3642
|
+
try {
|
|
3643
|
+
const allInstances = globalThis.__FEDERATION__?.__SHARE__;
|
|
3644
|
+
if (allInstances) {
|
|
3645
|
+
const __mfNormalizeRuntimeShare = (mod) => {
|
|
3646
|
+
let current = mod;
|
|
3647
|
+
for (let i = 0; i < 5; i++) {
|
|
3648
|
+
const defaultExport = current?.default;
|
|
3649
|
+
if (!defaultExport || typeof defaultExport !== "object" || Object.keys(defaultExport).length === 0) break;
|
|
3650
|
+
const namedValues = Object.keys(current).filter((key) => key !== "default").map((key) => current[key]);
|
|
3651
|
+
if (namedValues.length > 0 && namedValues.some((value) => value !== void 0)) break;
|
|
3652
|
+
current = defaultExport;
|
|
3653
|
+
}
|
|
3654
|
+
return current;
|
|
3655
|
+
};
|
|
3656
|
+
for (const [, scopes] of Object.entries(allInstances)) {
|
|
3657
|
+
const scopeShare = scopes?.["default"];
|
|
3658
|
+
if (!scopeShare) continue;
|
|
3659
|
+
for (const [pkg, versionMap] of Object.entries(scopeShare)) {
|
|
3660
|
+
const usedShare = usedShared?.[pkg];
|
|
3661
|
+
const selectedProvider = usedShare?.shareConfig?.import === false ? __mfSelectSharedProvider(versionMap, pkg, usedShare, "version-first") : void 0;
|
|
3662
|
+
const providerEntries = usedShare?.shareConfig?.import === false ? Object.entries(versionMap).filter(([, provider]) => provider === selectedProvider) : Object.entries(versionMap);
|
|
3663
|
+
for (const [version, provider] of providerEntries) {
|
|
3664
|
+
if (!provider.lib) continue;
|
|
3665
|
+
const cacheKey = __mfGetSharedCacheKey(pkg, provider.shareConfig?.singleton, version, "default");
|
|
3666
|
+
if (__mfModuleCache.share[cacheKey] !== void 0) continue;
|
|
3667
|
+
const mod = typeof provider.lib === "function" ? provider.lib() : provider.lib;
|
|
3668
|
+
const normalized = __mfNormalizeRuntimeShare(await Promise.resolve(mod));
|
|
3669
|
+
__mfModuleCache.share[cacheKey] = normalized;
|
|
3670
|
+
if (provider.shareConfig?.singleton && usedShare) {
|
|
3671
|
+
const usedCacheKey = __mfGetSharedCacheKey(pkg, usedShare.shareConfig?.singleton, usedShare.version, usedShare.scope);
|
|
3672
|
+
if (__mfModuleCache.share[usedCacheKey] === void 0) __mfModuleCache.share[usedCacheKey] = normalized;
|
|
3673
|
+
}
|
|
3674
|
+
}
|
|
3675
|
+
}
|
|
3676
|
+
}
|
|
3677
|
+
}
|
|
3678
|
+
} catch (e) {
|
|
3679
|
+
console.error("[Module Federation] Failed to bridge external shared modules", e);
|
|
3680
|
+
}
|
|
3681
|
+
for (const [pkg, share] of Object.entries(usedShared)) {
|
|
3682
|
+
const cacheKey = __mfGetSharedCacheKey(pkg, share.shareConfig?.singleton, share.version, share.scope);
|
|
3683
|
+
if (__mfModuleCache.share[cacheKey] !== void 0) continue;
|
|
3684
|
+
const singletonCacheKey = __mfGetSharedCacheKey(pkg, true, share.version, share.scope);
|
|
3685
|
+
if (__mfModuleCache.share[singletonCacheKey] !== void 0) __mfModuleCache.share[cacheKey] = __mfModuleCache.share[singletonCacheKey];
|
|
3686
|
+
}
|
|
3687
|
+
if (__mfModuleCache.share["default:react"] === void 0) {
|
|
3688
|
+
const mod = await __vitePreload(() => import("./_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-DsLoA9K7.js").then((n) => (n._t(), n.gt)), [], import.meta.url);
|
|
3689
|
+
const __mfNormalizeRuntimeShare = (mod) => {
|
|
3690
|
+
let current = mod;
|
|
3691
|
+
for (let i = 0; i < 5; i++) {
|
|
3692
|
+
const defaultExport = current?.default;
|
|
3693
|
+
if (!defaultExport || typeof defaultExport !== "object" || Object.keys(defaultExport).length === 0) break;
|
|
3694
|
+
const namedValues = Object.keys(current).filter((key) => key !== "default").map((key) => current[key]);
|
|
3695
|
+
if (namedValues.length > 0 && namedValues.some((value) => value !== void 0)) break;
|
|
3696
|
+
current = defaultExport;
|
|
3697
|
+
}
|
|
3698
|
+
return current;
|
|
3699
|
+
};
|
|
3700
|
+
const normalizedModule = __mfNormalizeRuntimeShare(mod);
|
|
3701
|
+
const exportModule = normalizedModule === mod ? { ...mod } : normalizedModule;
|
|
3702
|
+
Object.defineProperty(exportModule, "__esModule", {
|
|
3703
|
+
value: true,
|
|
3704
|
+
enumerable: false
|
|
3705
|
+
});
|
|
3706
|
+
__mfModuleCache.share["default:react"] = exportModule;
|
|
3707
|
+
}
|
|
3708
|
+
if (__mfModuleCache.share["default:react-dom"] === void 0) {
|
|
3709
|
+
const mod = await __vitePreload(() => import("./_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-DsLoA9K7.js").then((n) => n.Y), [], import.meta.url);
|
|
3710
|
+
const __mfNormalizeRuntimeShare = (mod) => {
|
|
3711
|
+
let current = mod;
|
|
3712
|
+
for (let i = 0; i < 5; i++) {
|
|
3713
|
+
const defaultExport = current?.default;
|
|
3714
|
+
if (!defaultExport || typeof defaultExport !== "object" || Object.keys(defaultExport).length === 0) break;
|
|
3715
|
+
const namedValues = Object.keys(current).filter((key) => key !== "default").map((key) => current[key]);
|
|
3716
|
+
if (namedValues.length > 0 && namedValues.some((value) => value !== void 0)) break;
|
|
3717
|
+
current = defaultExport;
|
|
3718
|
+
}
|
|
3719
|
+
return current;
|
|
3720
|
+
};
|
|
3721
|
+
const normalizedModule = __mfNormalizeRuntimeShare(mod);
|
|
3722
|
+
const exportModule = normalizedModule === mod ? { ...mod } : normalizedModule;
|
|
3723
|
+
Object.defineProperty(exportModule, "__esModule", {
|
|
3724
|
+
value: true,
|
|
3725
|
+
enumerable: false
|
|
3726
|
+
});
|
|
3727
|
+
__mfModuleCache.share["default:react-dom"] = exportModule;
|
|
3728
|
+
}
|
|
3729
|
+
if (__mfModuleCache.share["default:zod"] === void 0) {
|
|
3730
|
+
const mod = await __vitePreload(() => import("./_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare__zod__loadShare__.js-DE4UUe5K.js").then((n) => n.r), [], import.meta.url);
|
|
3731
|
+
const __mfNormalizeRuntimeShare = (mod) => {
|
|
3732
|
+
let current = mod;
|
|
3733
|
+
for (let i = 0; i < 5; i++) {
|
|
3734
|
+
const defaultExport = current?.default;
|
|
3735
|
+
if (!defaultExport || typeof defaultExport !== "object" || Object.keys(defaultExport).length === 0) break;
|
|
3736
|
+
const namedValues = Object.keys(current).filter((key) => key !== "default").map((key) => current[key]);
|
|
3737
|
+
if (namedValues.length > 0 && namedValues.some((value) => value !== void 0)) break;
|
|
3738
|
+
current = defaultExport;
|
|
3739
|
+
}
|
|
3740
|
+
return current;
|
|
3741
|
+
};
|
|
3742
|
+
const normalizedModule = __mfNormalizeRuntimeShare(mod);
|
|
3743
|
+
const exportModule = normalizedModule === mod ? { ...mod } : normalizedModule;
|
|
3744
|
+
Object.defineProperty(exportModule, "__esModule", {
|
|
3745
|
+
value: true,
|
|
3746
|
+
enumerable: false
|
|
3747
|
+
});
|
|
3748
|
+
__mfModuleCache.share["default:zod"] = exportModule;
|
|
3749
|
+
}
|
|
3750
|
+
if (__mfModuleCache.share["default:@baseplate-dev/ui-components"] === void 0) {
|
|
3751
|
+
const mod = await __vitePreload(() => import("./_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_baseplate_mf_2_dev_mf_1_ui_mf_2_components__loadShare__.js-DsLoA9K7.js").then((n) => n.t), [], import.meta.url);
|
|
3752
|
+
const __mfNormalizeRuntimeShare = (mod) => {
|
|
3753
|
+
let current = mod;
|
|
3754
|
+
for (let i = 0; i < 5; i++) {
|
|
3755
|
+
const defaultExport = current?.default;
|
|
3756
|
+
if (!defaultExport || typeof defaultExport !== "object" || Object.keys(defaultExport).length === 0) break;
|
|
3757
|
+
const namedValues = Object.keys(current).filter((key) => key !== "default").map((key) => current[key]);
|
|
3758
|
+
if (namedValues.length > 0 && namedValues.some((value) => value !== void 0)) break;
|
|
3759
|
+
current = defaultExport;
|
|
3760
|
+
}
|
|
3761
|
+
return current;
|
|
3762
|
+
};
|
|
3763
|
+
const normalizedModule = __mfNormalizeRuntimeShare(mod);
|
|
3764
|
+
const exportModule = normalizedModule === mod ? { ...mod } : normalizedModule;
|
|
3765
|
+
Object.defineProperty(exportModule, "__esModule", {
|
|
3766
|
+
value: true,
|
|
3767
|
+
enumerable: false
|
|
3768
|
+
});
|
|
3769
|
+
__mfModuleCache.share["default:@baseplate-dev/ui-components"] = exportModule;
|
|
3770
|
+
}
|
|
3771
|
+
if (__mfModuleCache.share["default:@baseplate-dev/project-builder-lib"] === void 0) {
|
|
3772
|
+
const mod = await __vitePreload(() => import("./dist-DicVrB_Z.js"), [], import.meta.url);
|
|
3773
|
+
const __mfNormalizeRuntimeShare = (mod) => {
|
|
3774
|
+
let current = mod;
|
|
3775
|
+
for (let i = 0; i < 5; i++) {
|
|
3776
|
+
const defaultExport = current?.default;
|
|
3777
|
+
if (!defaultExport || typeof defaultExport !== "object" || Object.keys(defaultExport).length === 0) break;
|
|
3778
|
+
const namedValues = Object.keys(current).filter((key) => key !== "default").map((key) => current[key]);
|
|
3779
|
+
if (namedValues.length > 0 && namedValues.some((value) => value !== void 0)) break;
|
|
3780
|
+
current = defaultExport;
|
|
3781
|
+
}
|
|
3782
|
+
return current;
|
|
3783
|
+
};
|
|
3784
|
+
const normalizedModule = __mfNormalizeRuntimeShare(mod);
|
|
3785
|
+
const exportModule = normalizedModule === mod ? { ...mod } : normalizedModule;
|
|
3786
|
+
Object.defineProperty(exportModule, "__esModule", {
|
|
3787
|
+
value: true,
|
|
3788
|
+
enumerable: false
|
|
3789
|
+
});
|
|
3790
|
+
__mfModuleCache.share["default:@baseplate-dev/project-builder-lib"] = exportModule;
|
|
3791
|
+
}
|
|
3792
|
+
if (__mfModuleCache.share["default:@baseplate-dev/project-builder-lib/web"] === void 0) {
|
|
3793
|
+
const mod = await __vitePreload(() => import("./web-BDeHApaZ.js"), [], import.meta.url);
|
|
3794
|
+
const __mfNormalizeRuntimeShare = (mod) => {
|
|
3795
|
+
let current = mod;
|
|
3796
|
+
for (let i = 0; i < 5; i++) {
|
|
3797
|
+
const defaultExport = current?.default;
|
|
3798
|
+
if (!defaultExport || typeof defaultExport !== "object" || Object.keys(defaultExport).length === 0) break;
|
|
3799
|
+
const namedValues = Object.keys(current).filter((key) => key !== "default").map((key) => current[key]);
|
|
3800
|
+
if (namedValues.length > 0 && namedValues.some((value) => value !== void 0)) break;
|
|
3801
|
+
current = defaultExport;
|
|
3802
|
+
}
|
|
3803
|
+
return current;
|
|
3804
|
+
};
|
|
3805
|
+
const normalizedModule = __mfNormalizeRuntimeShare(mod);
|
|
3806
|
+
const exportModule = normalizedModule === mod ? { ...mod } : normalizedModule;
|
|
3807
|
+
Object.defineProperty(exportModule, "__esModule", {
|
|
3808
|
+
value: true,
|
|
3809
|
+
enumerable: false
|
|
3810
|
+
});
|
|
3811
|
+
__mfModuleCache.share["default:@baseplate-dev/project-builder-lib/web"] = exportModule;
|
|
3812
|
+
}
|
|
3813
|
+
if (__mfModuleCache.share["default:@tanstack/react-router"] === void 0) {
|
|
3814
|
+
const mod = await __vitePreload(() => import("./_virtual_mf___mfe_internal__plugin_mf_2_auth__loadShare___mf_0_tanstack_mf_1_react_mf_2_router__loadShare__.js-CGsbw2Lx.js").then((n) => n.r), [], import.meta.url);
|
|
3815
|
+
const __mfNormalizeRuntimeShare = (mod) => {
|
|
3816
|
+
let current = mod;
|
|
3817
|
+
for (let i = 0; i < 5; i++) {
|
|
3818
|
+
const defaultExport = current?.default;
|
|
3819
|
+
if (!defaultExport || typeof defaultExport !== "object" || Object.keys(defaultExport).length === 0) break;
|
|
3820
|
+
const namedValues = Object.keys(current).filter((key) => key !== "default").map((key) => current[key]);
|
|
3821
|
+
if (namedValues.length > 0 && namedValues.some((value) => value !== void 0)) break;
|
|
3822
|
+
current = defaultExport;
|
|
3823
|
+
}
|
|
3824
|
+
return current;
|
|
3825
|
+
};
|
|
3826
|
+
const normalizedModule = __mfNormalizeRuntimeShare(mod);
|
|
3827
|
+
const exportModule = normalizedModule === mod ? { ...mod } : normalizedModule;
|
|
3828
|
+
Object.defineProperty(exportModule, "__esModule", {
|
|
3829
|
+
value: true,
|
|
3830
|
+
enumerable: false
|
|
3831
|
+
});
|
|
3832
|
+
__mfModuleCache.share["default:@tanstack/react-router"] = exportModule;
|
|
3833
|
+
}
|
|
3834
|
+
const __browserPlugins = [];
|
|
3835
|
+
const __ssrPlugins = typeof globalThis.window === "undefined" ? await Promise.all([]) : [];
|
|
3836
|
+
const initRes = init$1({
|
|
3837
|
+
name: mfName,
|
|
3838
|
+
remotes: usedRemotes,
|
|
3839
|
+
shared: usedShared,
|
|
3840
|
+
plugins: [...__browserPlugins, ...__ssrPlugins],
|
|
3841
|
+
shareStrategy: "version-first"
|
|
3842
|
+
});
|
|
3843
|
+
var initToken = initTokens[shareScopeName];
|
|
3844
|
+
if (!initToken) initToken = initTokens[shareScopeName] = { from: mfName };
|
|
3845
|
+
if (initScope.indexOf(initToken) >= 0) return;
|
|
3846
|
+
initScope.push(initToken);
|
|
3847
|
+
initRes.initShareScopeMap("default", shared);
|
|
3848
|
+
initResolve(initRes);
|
|
3849
|
+
try {
|
|
3850
|
+
await retrySharedInit(async () => {
|
|
3851
|
+
await Promise.all(await initRes.initializeSharing("default", {
|
|
3852
|
+
strategy: "version-first",
|
|
3853
|
+
from: "build",
|
|
3854
|
+
initScope
|
|
3855
|
+
}));
|
|
3856
|
+
});
|
|
3857
|
+
} catch (e) {
|
|
3858
|
+
console.error("[Module Federation]", e);
|
|
3859
|
+
}
|
|
3860
|
+
for (const [pkg, share] of Object.entries(usedShared)) {
|
|
3861
|
+
const cacheKey = __mfGetSharedCacheKey(pkg, share.shareConfig?.singleton, share.version, share.scope);
|
|
3862
|
+
if (share.shareConfig?.import !== false || __mfModuleCache.share[cacheKey] !== void 0) continue;
|
|
3863
|
+
const __mfNormalizeRuntimeShare = (mod) => {
|
|
3864
|
+
let current = mod;
|
|
3865
|
+
for (let i = 0; i < 5; i++) {
|
|
3866
|
+
const defaultExport = current?.default;
|
|
3867
|
+
if (!defaultExport || typeof defaultExport !== "object" || Object.keys(defaultExport).length === 0) break;
|
|
3868
|
+
const namedValues = Object.keys(current).filter((key) => key !== "default").map((key) => current[key]);
|
|
3869
|
+
if (namedValues.length > 0 && namedValues.some((value) => value !== void 0)) break;
|
|
3870
|
+
current = defaultExport;
|
|
3871
|
+
}
|
|
3872
|
+
return current;
|
|
3873
|
+
};
|
|
3874
|
+
const versions = shared?.[pkg];
|
|
3875
|
+
const provider = __mfSelectSharedProvider(versions, pkg, share, "version-first");
|
|
3876
|
+
if (!provider) continue;
|
|
3877
|
+
const factory = provider.lib || (provider.loading ? await provider.loading : await provider.get?.());
|
|
3878
|
+
const mod = typeof factory === "function" ? factory() : factory;
|
|
3879
|
+
const resolved = await Promise.resolve(mod);
|
|
3880
|
+
__mfModuleCache.share[cacheKey] = __mfNormalizeRuntimeShare(resolved);
|
|
3881
|
+
}
|
|
3882
|
+
return initRes;
|
|
3883
|
+
}
|
|
3884
|
+
async function getExposes(moduleName) {
|
|
3885
|
+
const exposesMap = await getExposesMap();
|
|
3886
|
+
if (!(moduleName in exposesMap)) throw new Error(`[Module Federation] Module ${moduleName} does not exist in container.`);
|
|
3887
|
+
return exposesMap[moduleName]().then((res) => () => res);
|
|
3888
|
+
}
|
|
3889
|
+
//#endregion
|
|
3890
|
+
export { init as n, getExposes as t };
|
|
3016
3891
|
|
|
3017
|
-
//# sourceMappingURL=
|
|
3892
|
+
//# sourceMappingURL=virtual_mf-REMOTE_ENTRY_ID___mfe_internal__plugin-auth__remoteEntry_js-CtbvyMZJ.js.map
|