@luzmo/embed 6.13.0 → 6.13.2-es2021
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 +10 -0
- package/index.cjs +76 -70
- package/index.js +75 -69
- package/luzmo-embed.min.js +1032 -467
- package/package.json +9 -3
- package/src/lib/dashboard/dashboard-base.d.ts +1 -0
- package/src/lib/viz-item/viz-item.base.d.ts +1 -1
package/luzmo-embed.min.js
CHANGED
|
@@ -391,7 +391,7 @@ var createIframeUrl = (dashboardContent) => {
|
|
|
391
391
|
searchString.push(`accentColor=${accentColor}`);
|
|
392
392
|
}
|
|
393
393
|
if (screenMode && screenMode !== "auto") {
|
|
394
|
-
searchString.push(`screenMode
|
|
394
|
+
searchString.push(`screenMode=${screenMode}`);
|
|
395
395
|
}
|
|
396
396
|
if (timezoneId) {
|
|
397
397
|
searchString.push("timezoneId=" + timezoneId);
|
|
@@ -1262,7 +1262,7 @@ var libraryTypeToWebComponentTypeMapping = {
|
|
|
1262
1262
|
// libs/embed-libs/shared-embed/src/lib/constants/class-constants.ts
|
|
1263
1263
|
var luzmoEmbedContainerClass = "luzmo-embed-container";
|
|
1264
1264
|
|
|
1265
|
-
// node_modules/@module-federation/
|
|
1265
|
+
// node_modules/@module-federation/sdk/dist/constant.js
|
|
1266
1266
|
var MANIFEST_EXT = ".json";
|
|
1267
1267
|
var BROWSER_LOG_KEY = "FEDERATION_DEBUG";
|
|
1268
1268
|
var NameTransformSymbol = {
|
|
@@ -1288,7 +1288,7 @@ var TreeShakingStatus = /* @__PURE__ */ (function(TreeShakingStatus2) {
|
|
|
1288
1288
|
return TreeShakingStatus2;
|
|
1289
1289
|
})({});
|
|
1290
1290
|
|
|
1291
|
-
// node_modules/@module-federation/
|
|
1291
|
+
// node_modules/@module-federation/sdk/dist/env.js
|
|
1292
1292
|
var isBrowserEnvValue = typeof ENV_TARGET !== "undefined" ? ENV_TARGET === "web" : typeof window !== "undefined" && typeof window.document !== "undefined";
|
|
1293
1293
|
function isBrowserEnv() {
|
|
1294
1294
|
return isBrowserEnvValue;
|
|
@@ -1310,7 +1310,7 @@ function isDebugMode() {
|
|
|
1310
1310
|
return isBrowserDebug();
|
|
1311
1311
|
}
|
|
1312
1312
|
|
|
1313
|
-
// node_modules/@module-federation/
|
|
1313
|
+
// node_modules/@module-federation/sdk/dist/utils.js
|
|
1314
1314
|
var LOG_CATEGORY = "[ Federation Runtime ]";
|
|
1315
1315
|
var composeKeyWithSeparator = function(...args) {
|
|
1316
1316
|
if (!args.length) return "";
|
|
@@ -1345,7 +1345,7 @@ function safeToString(info) {
|
|
|
1345
1345
|
}
|
|
1346
1346
|
}
|
|
1347
1347
|
|
|
1348
|
-
// node_modules/@module-federation/
|
|
1348
|
+
// node_modules/@module-federation/sdk/dist/generateSnapshotFromManifest.js
|
|
1349
1349
|
var simpleJoinRemoteEntry = (rPath, rName) => {
|
|
1350
1350
|
if (!rPath) return rName;
|
|
1351
1351
|
const transformPath = (str) => {
|
|
@@ -1416,21 +1416,6 @@ function generateSnapshotFromManifest(manifest, options = {}) {
|
|
|
1416
1416
|
assets: expose.assets
|
|
1417
1417
|
}))
|
|
1418
1418
|
};
|
|
1419
|
-
if (manifest.metaData?.prefetchInterface) {
|
|
1420
|
-
const prefetchInterface = manifest.metaData.prefetchInterface;
|
|
1421
|
-
basicRemoteSnapshot = {
|
|
1422
|
-
...basicRemoteSnapshot,
|
|
1423
|
-
prefetchInterface
|
|
1424
|
-
};
|
|
1425
|
-
}
|
|
1426
|
-
if (manifest.metaData?.prefetchEntry) {
|
|
1427
|
-
const { path, name, type } = manifest.metaData.prefetchEntry;
|
|
1428
|
-
basicRemoteSnapshot = {
|
|
1429
|
-
...basicRemoteSnapshot,
|
|
1430
|
-
prefetchEntry: simpleJoinRemoteEntry(path, name),
|
|
1431
|
-
prefetchEntryType: type
|
|
1432
|
-
};
|
|
1433
|
-
}
|
|
1434
1419
|
if ("publicPath" in manifest.metaData) {
|
|
1435
1420
|
remoteSnapshot = {
|
|
1436
1421
|
...basicRemoteSnapshot,
|
|
@@ -1453,7 +1438,7 @@ function isManifestProvider(moduleInfo) {
|
|
|
1453
1438
|
else return false;
|
|
1454
1439
|
}
|
|
1455
1440
|
|
|
1456
|
-
// node_modules/@module-federation/
|
|
1441
|
+
// node_modules/@module-federation/sdk/dist/logger.js
|
|
1457
1442
|
var PREFIX = "[ Module Federation ]";
|
|
1458
1443
|
var DEFAULT_DELEGATE = console;
|
|
1459
1444
|
var LOGGER_STACK_SKIP_TOKENS = [
|
|
@@ -1569,7 +1554,7 @@ function createInfrastructureLogger(prefix) {
|
|
|
1569
1554
|
var logger = createLogger(PREFIX);
|
|
1570
1555
|
var infrastructureLogger = createInfrastructureLogger(PREFIX);
|
|
1571
1556
|
|
|
1572
|
-
// node_modules/@module-federation/
|
|
1557
|
+
// node_modules/@module-federation/sdk/dist/dom.js
|
|
1573
1558
|
async function safeWrapper(callback, disableWarn) {
|
|
1574
1559
|
try {
|
|
1575
1560
|
return await callback();
|
|
@@ -1674,6 +1659,8 @@ function createScript(info) {
|
|
|
1674
1659
|
function createLink(info) {
|
|
1675
1660
|
let link = null;
|
|
1676
1661
|
let needAttach = true;
|
|
1662
|
+
let timeout = 2e4;
|
|
1663
|
+
let timeoutId;
|
|
1677
1664
|
const links = document.getElementsByTagName("link");
|
|
1678
1665
|
for (let i7 = 0; i7 < links.length; i7++) {
|
|
1679
1666
|
const l3 = links[i7];
|
|
@@ -1689,19 +1676,42 @@ function createLink(info) {
|
|
|
1689
1676
|
link = document.createElement("link");
|
|
1690
1677
|
link.setAttribute("href", info.url);
|
|
1691
1678
|
let createLinkRes = void 0;
|
|
1679
|
+
let shouldApplyAttrs = true;
|
|
1692
1680
|
const attrs = info.attrs;
|
|
1693
1681
|
if (info.createLinkHook) {
|
|
1694
1682
|
createLinkRes = info.createLinkHook(info.url, attrs);
|
|
1695
|
-
if (createLinkRes instanceof HTMLLinkElement)
|
|
1683
|
+
if (createLinkRes instanceof HTMLLinkElement) {
|
|
1684
|
+
link = createLinkRes;
|
|
1685
|
+
shouldApplyAttrs = false;
|
|
1686
|
+
} else if (typeof createLinkRes === "object") {
|
|
1687
|
+
if ("link" in createLinkRes && createLinkRes.link) {
|
|
1688
|
+
link = createLinkRes.link;
|
|
1689
|
+
shouldApplyAttrs = false;
|
|
1690
|
+
}
|
|
1691
|
+
if ("timeout" in createLinkRes && createLinkRes.timeout) timeout = createLinkRes.timeout;
|
|
1692
|
+
}
|
|
1696
1693
|
}
|
|
1697
|
-
if (attrs &&
|
|
1694
|
+
if (attrs && shouldApplyAttrs) Object.keys(attrs).forEach((name) => {
|
|
1698
1695
|
if (link && !link.getAttribute(name)) link.setAttribute(name, attrs[name]);
|
|
1699
1696
|
});
|
|
1700
1697
|
}
|
|
1698
|
+
if (!needAttach) {
|
|
1699
|
+
Promise.resolve().then(() => {
|
|
1700
|
+
info?.cb && info?.cb();
|
|
1701
|
+
});
|
|
1702
|
+
return {
|
|
1703
|
+
link,
|
|
1704
|
+
needAttach
|
|
1705
|
+
};
|
|
1706
|
+
}
|
|
1701
1707
|
const onLinkComplete = (prev, event) => {
|
|
1708
|
+
if (timeoutId) clearTimeout(timeoutId);
|
|
1702
1709
|
const onLinkCompleteCallback = () => {
|
|
1703
|
-
if (event?.type === "error")
|
|
1704
|
-
|
|
1710
|
+
if (event?.type === "error") {
|
|
1711
|
+
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.`);
|
|
1712
|
+
linkError.name = "LinkNetworkError";
|
|
1713
|
+
info?.onErrorCallback && info?.onErrorCallback(linkError);
|
|
1714
|
+
} else info?.cb && info?.cb();
|
|
1705
1715
|
};
|
|
1706
1716
|
if (link) {
|
|
1707
1717
|
link.onerror = null;
|
|
@@ -1720,6 +1730,12 @@ function createLink(info) {
|
|
|
1720
1730
|
};
|
|
1721
1731
|
link.onerror = onLinkComplete.bind(null, link.onerror);
|
|
1722
1732
|
link.onload = onLinkComplete.bind(null, link.onload);
|
|
1733
|
+
timeoutId = setTimeout(() => {
|
|
1734
|
+
onLinkComplete(null, {
|
|
1735
|
+
type: "error",
|
|
1736
|
+
isTimeout: true
|
|
1737
|
+
});
|
|
1738
|
+
}, timeout);
|
|
1723
1739
|
return {
|
|
1724
1740
|
link,
|
|
1725
1741
|
needAttach
|
|
@@ -1743,7 +1759,7 @@ function loadScript(url, info) {
|
|
|
1743
1759
|
});
|
|
1744
1760
|
}
|
|
1745
1761
|
|
|
1746
|
-
// node_modules/@module-federation/
|
|
1762
|
+
// node_modules/@module-federation/sdk/dist/node.js
|
|
1747
1763
|
var sdkImportCache = /* @__PURE__ */ new Map();
|
|
1748
1764
|
function importNodeModule(name) {
|
|
1749
1765
|
if (!name) throw new Error("import specifier is required");
|
|
@@ -2010,7 +2026,7 @@ function getGlobalFederationConstructor() {
|
|
|
2010
2026
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
2011
2027
|
if (isDebug) {
|
|
2012
2028
|
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
2013
|
-
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.
|
|
2029
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "2.5.0";
|
|
2014
2030
|
}
|
|
2015
2031
|
}
|
|
2016
2032
|
function getInfoWithoutType(target, key) {
|
|
@@ -2594,6 +2610,10 @@ function directShare(shared, useTreesShaking) {
|
|
|
2594
2610
|
}
|
|
2595
2611
|
|
|
2596
2612
|
// node_modules/@module-federation/runtime-core/dist/utils/manifest.js
|
|
2613
|
+
function composeRemoteRequestId(remoteName, expose) {
|
|
2614
|
+
if (!expose || expose === ".") return remoteName;
|
|
2615
|
+
return `${remoteName}/${expose.replace(/^\.\//, "")}`;
|
|
2616
|
+
}
|
|
2597
2617
|
function matchRemoteWithNameAndExpose(remotes, id) {
|
|
2598
2618
|
for (const remote of remotes) {
|
|
2599
2619
|
const isNameMatched = id.startsWith(remote.name);
|
|
@@ -2652,6 +2672,9 @@ var RUNTIME_009 = "RUNTIME-009";
|
|
|
2652
2672
|
var RUNTIME_010 = "RUNTIME-010";
|
|
2653
2673
|
var RUNTIME_011 = "RUNTIME-011";
|
|
2654
2674
|
var RUNTIME_012 = "RUNTIME-012";
|
|
2675
|
+
var RUNTIME_013 = "RUNTIME-013";
|
|
2676
|
+
var RUNTIME_014 = "RUNTIME-014";
|
|
2677
|
+
var RUNTIME_015 = "RUNTIME-015";
|
|
2655
2678
|
var TYPE_001 = "TYPE-001";
|
|
2656
2679
|
var BUILD_001 = "BUILD-001";
|
|
2657
2680
|
var BUILD_002 = "BUILD-002";
|
|
@@ -2669,7 +2692,10 @@ var runtimeDescMap = {
|
|
|
2669
2692
|
[RUNTIME_009]: "Please call createInstance first.",
|
|
2670
2693
|
[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.',
|
|
2671
2694
|
[RUNTIME_011]: "The remoteEntry URL is missing from the remote snapshot.",
|
|
2672
|
-
[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.'
|
|
2695
|
+
[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.',
|
|
2696
|
+
[RUNTIME_013]: "The manifest is not a valid Module Federation manifest.",
|
|
2697
|
+
[RUNTIME_014]: "The remote does not expose the requested module.",
|
|
2698
|
+
[RUNTIME_015]: "Remote container initialization failed."
|
|
2673
2699
|
};
|
|
2674
2700
|
var typeDescMap = { [TYPE_001]: "Failed to generate type declaration. Execute the below cmd to reproduce and fix the error." };
|
|
2675
2701
|
var buildDescMap = {
|
|
@@ -2719,7 +2745,7 @@ function handleRemoteEntryLoaded(name, globalName, entry) {
|
|
|
2719
2745
|
});
|
|
2720
2746
|
return entryExports;
|
|
2721
2747
|
}
|
|
2722
|
-
async function loadEntryScript({ name, globalName, entry, loaderHook, getEntryUrl }) {
|
|
2748
|
+
async function loadEntryScript({ name, globalName, entry, remoteInfo, loaderHook, getEntryUrl, resourceContext }) {
|
|
2723
2749
|
const { entryExports: remoteEntryExports } = getRemoteEntryExports(name, globalName);
|
|
2724
2750
|
if (remoteEntryExports) return remoteEntryExports;
|
|
2725
2751
|
const url = getEntryUrl ? getEntryUrl(entry) : entry;
|
|
@@ -2728,7 +2754,12 @@ async function loadEntryScript({ name, globalName, entry, loaderHook, getEntryUr
|
|
|
2728
2754
|
createScriptHook: (url2, attrs) => {
|
|
2729
2755
|
const res = loaderHook.lifecycle.createScript.emit({
|
|
2730
2756
|
url: url2,
|
|
2731
|
-
attrs
|
|
2757
|
+
attrs,
|
|
2758
|
+
remoteInfo,
|
|
2759
|
+
resourceContext: resourceContext ? {
|
|
2760
|
+
...resourceContext,
|
|
2761
|
+
url: url2
|
|
2762
|
+
} : void 0
|
|
2732
2763
|
});
|
|
2733
2764
|
if (!res) return;
|
|
2734
2765
|
if (res instanceof HTMLScriptElement) return res;
|
|
@@ -2744,7 +2775,7 @@ async function loadEntryScript({ name, globalName, entry, loaderHook, getEntryUr
|
|
|
2744
2775
|
}, originalMsg);
|
|
2745
2776
|
});
|
|
2746
2777
|
}
|
|
2747
|
-
async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getEntryUrl }) {
|
|
2778
|
+
async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getEntryUrl, resourceContext }) {
|
|
2748
2779
|
const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
|
|
2749
2780
|
switch (type) {
|
|
2750
2781
|
case "esm":
|
|
@@ -2763,12 +2794,14 @@ async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getEnt
|
|
|
2763
2794
|
entry,
|
|
2764
2795
|
globalName,
|
|
2765
2796
|
name,
|
|
2797
|
+
remoteInfo,
|
|
2766
2798
|
loaderHook,
|
|
2767
|
-
getEntryUrl
|
|
2799
|
+
getEntryUrl,
|
|
2800
|
+
resourceContext
|
|
2768
2801
|
});
|
|
2769
2802
|
}
|
|
2770
2803
|
}
|
|
2771
|
-
async function loadEntryNode({ remoteInfo, loaderHook }) {
|
|
2804
|
+
async function loadEntryNode({ remoteInfo, loaderHook, resourceContext }) {
|
|
2772
2805
|
const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
|
|
2773
2806
|
const { entryExports: remoteEntryExports } = getRemoteEntryExports(name, globalName);
|
|
2774
2807
|
if (remoteEntryExports) return remoteEntryExports;
|
|
@@ -2781,7 +2814,12 @@ async function loadEntryNode({ remoteInfo, loaderHook }) {
|
|
|
2781
2814
|
loaderHook: { createScriptHook: (url, attrs = {}) => {
|
|
2782
2815
|
const res = loaderHook.lifecycle.createScript.emit({
|
|
2783
2816
|
url,
|
|
2784
|
-
attrs
|
|
2817
|
+
attrs,
|
|
2818
|
+
remoteInfo,
|
|
2819
|
+
resourceContext: resourceContext ? {
|
|
2820
|
+
...resourceContext,
|
|
2821
|
+
url
|
|
2822
|
+
} : void 0
|
|
2785
2823
|
});
|
|
2786
2824
|
if (!res) return;
|
|
2787
2825
|
if ("url" in res) return res;
|
|
@@ -2797,13 +2835,14 @@ function getRemoteEntryUniqueKey(remoteInfo) {
|
|
|
2797
2835
|
return composeKeyWithSeparator(name, entry);
|
|
2798
2836
|
}
|
|
2799
2837
|
async function getRemoteEntry(params) {
|
|
2800
|
-
const { origin, remoteEntryExports, remoteInfo, getEntryUrl, _inErrorHandling = false } = params;
|
|
2838
|
+
const { origin, remoteEntryExports, remoteInfo, getEntryUrl, resourceContext, _inErrorHandling = false } = params;
|
|
2801
2839
|
const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
|
|
2802
2840
|
if (remoteEntryExports) return remoteEntryExports;
|
|
2803
2841
|
if (!globalLoading[uniqueKey]) {
|
|
2804
2842
|
const loadEntryHook = origin.remoteHandler.hooks.lifecycle.loadEntry;
|
|
2805
2843
|
const loaderHook = origin.loaderHook;
|
|
2806
2844
|
globalLoading[uniqueKey] = loadEntryHook.emit({
|
|
2845
|
+
origin,
|
|
2807
2846
|
loaderHook,
|
|
2808
2847
|
remoteInfo,
|
|
2809
2848
|
remoteEntryExports
|
|
@@ -2813,11 +2852,20 @@ async function getRemoteEntry(params) {
|
|
|
2813
2852
|
remoteInfo,
|
|
2814
2853
|
remoteEntryExports,
|
|
2815
2854
|
loaderHook,
|
|
2816
|
-
getEntryUrl
|
|
2855
|
+
getEntryUrl,
|
|
2856
|
+
resourceContext
|
|
2817
2857
|
}) : loadEntryNode({
|
|
2818
2858
|
remoteInfo,
|
|
2819
|
-
loaderHook
|
|
2859
|
+
loaderHook,
|
|
2860
|
+
resourceContext
|
|
2820
2861
|
});
|
|
2862
|
+
}).then(async (res) => {
|
|
2863
|
+
await origin.loaderHook.lifecycle.afterLoadEntry.emit({
|
|
2864
|
+
origin,
|
|
2865
|
+
remoteInfo,
|
|
2866
|
+
remoteEntryExports: res
|
|
2867
|
+
});
|
|
2868
|
+
return res;
|
|
2821
2869
|
}).catch(async (err) => {
|
|
2822
2870
|
const uniqueKey2 = getRemoteEntryUniqueKey(remoteInfo);
|
|
2823
2871
|
const isScriptExecutionError = err instanceof Error && err.message.includes("ScriptExecutionError");
|
|
@@ -2836,8 +2884,21 @@ async function getRemoteEntry(params) {
|
|
|
2836
2884
|
globalLoading,
|
|
2837
2885
|
uniqueKey: uniqueKey2
|
|
2838
2886
|
});
|
|
2839
|
-
if (RemoteEntryExports)
|
|
2887
|
+
if (RemoteEntryExports) {
|
|
2888
|
+
await origin.loaderHook.lifecycle.afterLoadEntry.emit({
|
|
2889
|
+
origin,
|
|
2890
|
+
remoteInfo,
|
|
2891
|
+
remoteEntryExports: RemoteEntryExports,
|
|
2892
|
+
recovered: true
|
|
2893
|
+
});
|
|
2894
|
+
return RemoteEntryExports;
|
|
2895
|
+
}
|
|
2840
2896
|
}
|
|
2897
|
+
await origin.loaderHook.lifecycle.afterLoadEntry.emit({
|
|
2898
|
+
origin,
|
|
2899
|
+
remoteInfo,
|
|
2900
|
+
error: err
|
|
2901
|
+
});
|
|
2841
2902
|
throw err;
|
|
2842
2903
|
});
|
|
2843
2904
|
}
|
|
@@ -2923,7 +2984,6 @@ function defaultPreloadArgs(preloadConfig) {
|
|
|
2923
2984
|
resourceCategory: "sync",
|
|
2924
2985
|
share: true,
|
|
2925
2986
|
depsRemote: true,
|
|
2926
|
-
prefetchInterface: false,
|
|
2927
2987
|
...preloadConfig
|
|
2928
2988
|
};
|
|
2929
2989
|
}
|
|
@@ -2948,22 +3008,113 @@ function normalizePreloadExposes(exposes) {
|
|
|
2948
3008
|
return expose;
|
|
2949
3009
|
});
|
|
2950
3010
|
}
|
|
2951
|
-
function
|
|
3011
|
+
function isTimeoutError(error3) {
|
|
3012
|
+
if (!(error3 instanceof Error)) return false;
|
|
3013
|
+
return error3.message.includes("timed out") || error3.name.includes("Timeout");
|
|
3014
|
+
}
|
|
3015
|
+
function createAssetResult(context, url, status, error3) {
|
|
3016
|
+
return {
|
|
3017
|
+
url,
|
|
3018
|
+
status,
|
|
3019
|
+
resourceType: context.resourceType,
|
|
3020
|
+
initiator: context.initiator,
|
|
3021
|
+
id: context.id,
|
|
3022
|
+
error: error3
|
|
3023
|
+
};
|
|
3024
|
+
}
|
|
3025
|
+
async function waitForRemoteEntryPreload(host, remoteInfo, entryRemoteInfo, context) {
|
|
3026
|
+
const cachedRemote = host.moduleCache.get(entryRemoteInfo.name);
|
|
3027
|
+
const url = entryRemoteInfo.entry;
|
|
3028
|
+
if (cachedRemote?.remoteEntryExports) return createAssetResult(context, url, "cached");
|
|
3029
|
+
try {
|
|
3030
|
+
if (!await getRemoteEntry({
|
|
3031
|
+
origin: host,
|
|
3032
|
+
remoteInfo: entryRemoteInfo,
|
|
3033
|
+
remoteEntryExports: cachedRemote?.remoteEntryExports,
|
|
3034
|
+
resourceContext: {
|
|
3035
|
+
...context,
|
|
3036
|
+
url
|
|
3037
|
+
}
|
|
3038
|
+
})) throw new Error(`Failed to load remoteEntry "${url}".`);
|
|
3039
|
+
return createAssetResult(context, url, "success");
|
|
3040
|
+
} catch (error3) {
|
|
3041
|
+
return createAssetResult(context, url, isTimeoutError(error3) ? "timeout" : "error", error3);
|
|
3042
|
+
}
|
|
3043
|
+
}
|
|
3044
|
+
function waitForLinkPreload({ host, remoteInfo, url, attrs, context, needDeleteLink }) {
|
|
3045
|
+
return new Promise((resolve) => {
|
|
3046
|
+
const { link, needAttach } = createLink({
|
|
3047
|
+
url,
|
|
3048
|
+
cb: () => {
|
|
3049
|
+
resolve(createAssetResult(context, url, needAttach ? "success" : "cached"));
|
|
3050
|
+
},
|
|
3051
|
+
onErrorCallback: (error3) => {
|
|
3052
|
+
resolve(createAssetResult(context, url, isTimeoutError(error3) ? "timeout" : "error", error3));
|
|
3053
|
+
},
|
|
3054
|
+
attrs,
|
|
3055
|
+
createLinkHook: (hookUrl, hookAttrs) => {
|
|
3056
|
+
const res = host.loaderHook.lifecycle.createLink.emit({
|
|
3057
|
+
url: hookUrl,
|
|
3058
|
+
attrs: hookAttrs,
|
|
3059
|
+
remoteInfo,
|
|
3060
|
+
resourceContext: {
|
|
3061
|
+
...context,
|
|
3062
|
+
url: hookUrl
|
|
3063
|
+
}
|
|
3064
|
+
});
|
|
3065
|
+
if (res instanceof HTMLLinkElement) return res;
|
|
3066
|
+
return res;
|
|
3067
|
+
},
|
|
3068
|
+
needDeleteLink
|
|
3069
|
+
});
|
|
3070
|
+
needAttach && document.head.appendChild(link);
|
|
3071
|
+
});
|
|
3072
|
+
}
|
|
3073
|
+
function waitForScriptPreload({ host, remoteInfo, url, attrs, context }) {
|
|
3074
|
+
return new Promise((resolve) => {
|
|
3075
|
+
const { script, needAttach } = createScript({
|
|
3076
|
+
url,
|
|
3077
|
+
cb: () => {
|
|
3078
|
+
resolve(createAssetResult(context, url, needAttach ? "success" : "cached"));
|
|
3079
|
+
},
|
|
3080
|
+
onErrorCallback: (error3) => {
|
|
3081
|
+
resolve(createAssetResult(context, url, isTimeoutError(error3) ? "timeout" : "error", error3));
|
|
3082
|
+
},
|
|
3083
|
+
attrs,
|
|
3084
|
+
createScriptHook: (hookUrl, hookAttrs) => {
|
|
3085
|
+
const res = host.loaderHook.lifecycle.createScript.emit({
|
|
3086
|
+
url: hookUrl,
|
|
3087
|
+
attrs: hookAttrs,
|
|
3088
|
+
remoteInfo,
|
|
3089
|
+
resourceContext: {
|
|
3090
|
+
...context,
|
|
3091
|
+
url: hookUrl
|
|
3092
|
+
}
|
|
3093
|
+
});
|
|
3094
|
+
if (res instanceof HTMLScriptElement) return res;
|
|
3095
|
+
return res;
|
|
3096
|
+
},
|
|
3097
|
+
needDeleteScript: true
|
|
3098
|
+
});
|
|
3099
|
+
needAttach && document.head.appendChild(script);
|
|
3100
|
+
});
|
|
3101
|
+
}
|
|
3102
|
+
function createResourceContext(baseContext, resourceType) {
|
|
3103
|
+
return {
|
|
3104
|
+
...baseContext,
|
|
3105
|
+
resourceType
|
|
3106
|
+
};
|
|
3107
|
+
}
|
|
3108
|
+
function preloadAssets(remoteInfo, host, assets, useLinkPreload = true, baseContext = {
|
|
3109
|
+
initiator: "preloadRemote",
|
|
3110
|
+
id: remoteInfo.name
|
|
3111
|
+
}) {
|
|
2952
3112
|
const { cssAssets, jsAssetsWithoutEntry, entryAssets } = assets;
|
|
3113
|
+
const results = [];
|
|
2953
3114
|
if (host.options.inBrowser) {
|
|
2954
3115
|
entryAssets.forEach((asset) => {
|
|
2955
|
-
const { moduleInfo } = asset;
|
|
2956
|
-
|
|
2957
|
-
if (module2) getRemoteEntry({
|
|
2958
|
-
origin: host,
|
|
2959
|
-
remoteInfo: moduleInfo,
|
|
2960
|
-
remoteEntryExports: module2.remoteEntryExports
|
|
2961
|
-
});
|
|
2962
|
-
else getRemoteEntry({
|
|
2963
|
-
origin: host,
|
|
2964
|
-
remoteInfo: moduleInfo,
|
|
2965
|
-
remoteEntryExports: void 0
|
|
2966
|
-
});
|
|
3116
|
+
const { moduleInfo: entryRemoteInfo } = asset;
|
|
3117
|
+
results.push(waitForRemoteEntryPreload(host, remoteInfo, entryRemoteInfo, createResourceContext(baseContext, "remoteEntry")));
|
|
2967
3118
|
});
|
|
2968
3119
|
if (useLinkPreload) {
|
|
2969
3120
|
const defaultAttrs = {
|
|
@@ -2971,20 +3122,13 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true) {
|
|
|
2971
3122
|
as: "style"
|
|
2972
3123
|
};
|
|
2973
3124
|
cssAssets.forEach((cssUrl) => {
|
|
2974
|
-
|
|
3125
|
+
results.push(waitForLinkPreload({
|
|
3126
|
+
host,
|
|
3127
|
+
remoteInfo,
|
|
2975
3128
|
url: cssUrl,
|
|
2976
|
-
cb: () => {
|
|
2977
|
-
},
|
|
2978
3129
|
attrs: defaultAttrs,
|
|
2979
|
-
|
|
2980
|
-
|
|
2981
|
-
url,
|
|
2982
|
-
attrs
|
|
2983
|
-
});
|
|
2984
|
-
if (res instanceof HTMLLinkElement) return res;
|
|
2985
|
-
}
|
|
2986
|
-
});
|
|
2987
|
-
needAttach && document.head.appendChild(cssEl);
|
|
3130
|
+
context: createResourceContext(baseContext, "css")
|
|
3131
|
+
}));
|
|
2988
3132
|
});
|
|
2989
3133
|
} else {
|
|
2990
3134
|
const defaultAttrs = {
|
|
@@ -2992,21 +3136,14 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true) {
|
|
|
2992
3136
|
type: "text/css"
|
|
2993
3137
|
};
|
|
2994
3138
|
cssAssets.forEach((cssUrl) => {
|
|
2995
|
-
|
|
3139
|
+
results.push(waitForLinkPreload({
|
|
3140
|
+
host,
|
|
3141
|
+
remoteInfo,
|
|
2996
3142
|
url: cssUrl,
|
|
2997
|
-
cb: () => {
|
|
2998
|
-
},
|
|
2999
3143
|
attrs: defaultAttrs,
|
|
3000
|
-
|
|
3001
|
-
|
|
3002
|
-
|
|
3003
|
-
attrs
|
|
3004
|
-
});
|
|
3005
|
-
if (res instanceof HTMLLinkElement) return res;
|
|
3006
|
-
},
|
|
3007
|
-
needDeleteLink: false
|
|
3008
|
-
});
|
|
3009
|
-
needAttach && document.head.appendChild(cssEl);
|
|
3144
|
+
needDeleteLink: false,
|
|
3145
|
+
context: createResourceContext(baseContext, "css")
|
|
3146
|
+
}));
|
|
3010
3147
|
});
|
|
3011
3148
|
}
|
|
3012
3149
|
if (useLinkPreload) {
|
|
@@ -3015,20 +3152,13 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true) {
|
|
|
3015
3152
|
as: "script"
|
|
3016
3153
|
};
|
|
3017
3154
|
jsAssetsWithoutEntry.forEach((jsUrl) => {
|
|
3018
|
-
|
|
3155
|
+
results.push(waitForLinkPreload({
|
|
3156
|
+
host,
|
|
3157
|
+
remoteInfo,
|
|
3019
3158
|
url: jsUrl,
|
|
3020
|
-
cb: () => {
|
|
3021
|
-
},
|
|
3022
3159
|
attrs: defaultAttrs,
|
|
3023
|
-
|
|
3024
|
-
|
|
3025
|
-
url,
|
|
3026
|
-
attrs
|
|
3027
|
-
});
|
|
3028
|
-
if (res instanceof HTMLLinkElement) return res;
|
|
3029
|
-
}
|
|
3030
|
-
});
|
|
3031
|
-
needAttach && document.head.appendChild(linkEl);
|
|
3160
|
+
context: createResourceContext(baseContext, "js")
|
|
3161
|
+
}));
|
|
3032
3162
|
});
|
|
3033
3163
|
} else {
|
|
3034
3164
|
const defaultAttrs = {
|
|
@@ -3036,27 +3166,25 @@ function preloadAssets(remoteInfo, host, assets, useLinkPreload = true) {
|
|
|
3036
3166
|
type: remoteInfo?.type === "module" ? "module" : "text/javascript"
|
|
3037
3167
|
};
|
|
3038
3168
|
jsAssetsWithoutEntry.forEach((jsUrl) => {
|
|
3039
|
-
|
|
3169
|
+
results.push(waitForScriptPreload({
|
|
3170
|
+
host,
|
|
3171
|
+
remoteInfo,
|
|
3040
3172
|
url: jsUrl,
|
|
3041
|
-
cb: () => {
|
|
3042
|
-
},
|
|
3043
3173
|
attrs: defaultAttrs,
|
|
3044
|
-
|
|
3045
|
-
|
|
3046
|
-
url,
|
|
3047
|
-
attrs
|
|
3048
|
-
});
|
|
3049
|
-
if (res instanceof HTMLScriptElement) return res;
|
|
3050
|
-
},
|
|
3051
|
-
needDeleteScript: true
|
|
3052
|
-
});
|
|
3053
|
-
needAttach && document.head.appendChild(scriptEl);
|
|
3174
|
+
context: createResourceContext(baseContext, "js")
|
|
3175
|
+
}));
|
|
3054
3176
|
});
|
|
3055
3177
|
}
|
|
3056
3178
|
}
|
|
3179
|
+
return Promise.all(results);
|
|
3057
3180
|
}
|
|
3058
3181
|
|
|
3059
3182
|
// node_modules/@module-federation/runtime-core/dist/module/index.js
|
|
3183
|
+
function getAvailableExposeNames(remoteSnapshot) {
|
|
3184
|
+
if (!remoteSnapshot || !("modules" in remoteSnapshot) || !Array.isArray(remoteSnapshot.modules)) return;
|
|
3185
|
+
const exposes = remoteSnapshot.modules.map((module2) => module2.moduleName).filter(Boolean);
|
|
3186
|
+
return exposes.length ? exposes.join(",") : void 0;
|
|
3187
|
+
}
|
|
3060
3188
|
function createRemoteEntryInitOptions(remoteInfo, hostShareScopeMap, rawInitScope) {
|
|
3061
3189
|
const localShareScopeMap = hostShareScopeMap;
|
|
3062
3190
|
const shareScopeKeys = Array.isArray(remoteInfo.shareScope) ? remoteInfo.shareScope : [remoteInfo.shareScope];
|
|
@@ -3086,27 +3214,69 @@ var Module$1 = class {
|
|
|
3086
3214
|
this.remoteInfo = remoteInfo;
|
|
3087
3215
|
this.host = host;
|
|
3088
3216
|
}
|
|
3089
|
-
async getEntry() {
|
|
3217
|
+
async getEntry(expose) {
|
|
3090
3218
|
if (this.remoteEntryExports) return this.remoteEntryExports;
|
|
3091
3219
|
const remoteEntryExports = await getRemoteEntry({
|
|
3092
3220
|
origin: this.host,
|
|
3093
3221
|
remoteInfo: this.remoteInfo,
|
|
3094
|
-
remoteEntryExports: this.remoteEntryExports
|
|
3222
|
+
remoteEntryExports: this.remoteEntryExports,
|
|
3223
|
+
resourceContext: {
|
|
3224
|
+
initiator: "loadRemote",
|
|
3225
|
+
id: composeRemoteRequestId(this.remoteInfo.name, expose),
|
|
3226
|
+
resourceType: "remoteEntry"
|
|
3227
|
+
}
|
|
3095
3228
|
});
|
|
3096
3229
|
assert2(remoteEntryExports, `remoteEntryExports is undefined
|
|
3097
3230
|
${safeToString(this.remoteInfo)}`);
|
|
3098
3231
|
this.remoteEntryExports = remoteEntryExports;
|
|
3099
3232
|
return this.remoteEntryExports;
|
|
3100
3233
|
}
|
|
3101
|
-
async init(id, remoteSnapshot, rawInitScope) {
|
|
3102
|
-
const remoteEntryExports = await this.getEntry();
|
|
3103
|
-
if (this.inited)
|
|
3234
|
+
async init(id, remoteSnapshot, rawInitScope, expose) {
|
|
3235
|
+
const remoteEntryExports = await this.getEntry(expose);
|
|
3236
|
+
if (this.inited) {
|
|
3237
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
3238
|
+
id,
|
|
3239
|
+
remoteInfo: this.remoteInfo,
|
|
3240
|
+
remoteSnapshot,
|
|
3241
|
+
remoteEntryExports,
|
|
3242
|
+
cached: true,
|
|
3243
|
+
origin: this.host
|
|
3244
|
+
});
|
|
3245
|
+
return remoteEntryExports;
|
|
3246
|
+
}
|
|
3104
3247
|
if (this.initPromise) {
|
|
3105
|
-
|
|
3248
|
+
try {
|
|
3249
|
+
await this.initPromise;
|
|
3250
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
3251
|
+
id,
|
|
3252
|
+
remoteInfo: this.remoteInfo,
|
|
3253
|
+
remoteSnapshot,
|
|
3254
|
+
remoteEntryExports,
|
|
3255
|
+
cached: true,
|
|
3256
|
+
origin: this.host
|
|
3257
|
+
});
|
|
3258
|
+
} catch (initError) {
|
|
3259
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
3260
|
+
id,
|
|
3261
|
+
remoteInfo: this.remoteInfo,
|
|
3262
|
+
remoteSnapshot,
|
|
3263
|
+
remoteEntryExports,
|
|
3264
|
+
error: initError,
|
|
3265
|
+
cached: true,
|
|
3266
|
+
origin: this.host
|
|
3267
|
+
});
|
|
3268
|
+
throw initError;
|
|
3269
|
+
}
|
|
3106
3270
|
return remoteEntryExports;
|
|
3107
3271
|
}
|
|
3108
3272
|
this.initing = true;
|
|
3109
3273
|
this.initPromise = (async () => {
|
|
3274
|
+
await this.host.loaderHook.lifecycle.beforeInitRemote.emit({
|
|
3275
|
+
id,
|
|
3276
|
+
remoteInfo: this.remoteInfo,
|
|
3277
|
+
remoteSnapshot,
|
|
3278
|
+
origin: this.host
|
|
3279
|
+
});
|
|
3110
3280
|
const { remoteEntryInitOptions, shareScope, initScope } = createRemoteEntryInitOptions(this.remoteInfo, this.host.shareScopeMap, rawInitScope);
|
|
3111
3281
|
const initContainerOptions = await this.host.hooks.lifecycle.beforeInitContainer.emit({
|
|
3112
3282
|
shareScope,
|
|
@@ -3121,7 +3291,17 @@ var Module$1 = class {
|
|
|
3121
3291
|
remoteEntryUrl: this.remoteInfo.entry,
|
|
3122
3292
|
remoteEntryKey: this.remoteInfo.entryGlobalName
|
|
3123
3293
|
}, void 0, optionsToMFContext(this.host.options));
|
|
3124
|
-
|
|
3294
|
+
try {
|
|
3295
|
+
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
3296
|
+
} catch (initError) {
|
|
3297
|
+
error2(RUNTIME_015, runtimeDescMap, {
|
|
3298
|
+
hostName: this.host.name,
|
|
3299
|
+
remoteName: this.remoteInfo.name,
|
|
3300
|
+
remoteEntryUrl: this.remoteInfo.entry,
|
|
3301
|
+
remoteEntryKey: this.remoteInfo.entryGlobalName,
|
|
3302
|
+
shareScope: this.remoteInfo.shareScope
|
|
3303
|
+
}, `${initError}`, optionsToMFContext(this.host.options));
|
|
3304
|
+
}
|
|
3125
3305
|
await this.host.hooks.lifecycle.initContainer.emit({
|
|
3126
3306
|
...initContainerOptions,
|
|
3127
3307
|
id,
|
|
@@ -3132,6 +3312,23 @@ var Module$1 = class {
|
|
|
3132
3312
|
})();
|
|
3133
3313
|
try {
|
|
3134
3314
|
await this.initPromise;
|
|
3315
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
3316
|
+
id,
|
|
3317
|
+
remoteInfo: this.remoteInfo,
|
|
3318
|
+
remoteSnapshot,
|
|
3319
|
+
remoteEntryExports,
|
|
3320
|
+
origin: this.host
|
|
3321
|
+
});
|
|
3322
|
+
} catch (initError) {
|
|
3323
|
+
await this.host.loaderHook.lifecycle.afterInitRemote.emit({
|
|
3324
|
+
id,
|
|
3325
|
+
remoteInfo: this.remoteInfo,
|
|
3326
|
+
remoteSnapshot,
|
|
3327
|
+
remoteEntryExports,
|
|
3328
|
+
error: initError,
|
|
3329
|
+
origin: this.host
|
|
3330
|
+
});
|
|
3331
|
+
throw initError;
|
|
3135
3332
|
} finally {
|
|
3136
3333
|
this.initing = false;
|
|
3137
3334
|
this.initPromise = void 0;
|
|
@@ -3140,20 +3337,83 @@ var Module$1 = class {
|
|
|
3140
3337
|
}
|
|
3141
3338
|
async get(id, expose, options, remoteSnapshot) {
|
|
3142
3339
|
const { loadFactory = true } = options || { loadFactory: true };
|
|
3143
|
-
const remoteEntryExports = await this.init(id, remoteSnapshot);
|
|
3340
|
+
const remoteEntryExports = await this.init(id, remoteSnapshot, void 0, expose);
|
|
3144
3341
|
this.lib = remoteEntryExports;
|
|
3145
|
-
|
|
3146
|
-
|
|
3147
|
-
remoteEntryExports,
|
|
3342
|
+
await this.host.loaderHook.lifecycle.beforeGetExpose.emit({
|
|
3343
|
+
id,
|
|
3148
3344
|
expose,
|
|
3149
|
-
moduleInfo: this.remoteInfo
|
|
3345
|
+
moduleInfo: this.remoteInfo,
|
|
3346
|
+
remoteEntryExports,
|
|
3347
|
+
origin: this.host
|
|
3150
3348
|
});
|
|
3151
|
-
|
|
3152
|
-
|
|
3349
|
+
let moduleFactory;
|
|
3350
|
+
try {
|
|
3351
|
+
const hookModuleFactory = await this.host.loaderHook.lifecycle.getModuleFactory.emit({
|
|
3352
|
+
remoteEntryExports,
|
|
3353
|
+
expose,
|
|
3354
|
+
moduleInfo: this.remoteInfo
|
|
3355
|
+
});
|
|
3356
|
+
moduleFactory = typeof hookModuleFactory === "function" ? hookModuleFactory : void 0;
|
|
3357
|
+
if (!moduleFactory) moduleFactory = await remoteEntryExports.get(expose);
|
|
3358
|
+
if (!moduleFactory) error2(RUNTIME_014, runtimeDescMap, {
|
|
3359
|
+
hostName: this.host.name,
|
|
3360
|
+
remoteName: this.remoteInfo.name,
|
|
3361
|
+
remoteEntryUrl: this.remoteInfo.entry,
|
|
3362
|
+
expose,
|
|
3363
|
+
requestId: id,
|
|
3364
|
+
availableExposes: getAvailableExposeNames(remoteSnapshot)
|
|
3365
|
+
}, void 0, optionsToMFContext(this.host.options));
|
|
3366
|
+
await this.host.loaderHook.lifecycle.afterGetExpose.emit({
|
|
3367
|
+
id,
|
|
3368
|
+
expose,
|
|
3369
|
+
moduleInfo: this.remoteInfo,
|
|
3370
|
+
remoteEntryExports,
|
|
3371
|
+
moduleFactory,
|
|
3372
|
+
origin: this.host
|
|
3373
|
+
});
|
|
3374
|
+
} catch (getExposeError) {
|
|
3375
|
+
await this.host.loaderHook.lifecycle.afterGetExpose.emit({
|
|
3376
|
+
id,
|
|
3377
|
+
expose,
|
|
3378
|
+
moduleInfo: this.remoteInfo,
|
|
3379
|
+
remoteEntryExports,
|
|
3380
|
+
error: getExposeError,
|
|
3381
|
+
origin: this.host
|
|
3382
|
+
});
|
|
3383
|
+
throw getExposeError;
|
|
3384
|
+
}
|
|
3153
3385
|
const symbolName = processModuleAlias(this.remoteInfo.name, expose);
|
|
3154
3386
|
const wrapModuleFactory = this.wraperFactory(moduleFactory, symbolName);
|
|
3155
3387
|
if (!loadFactory) return wrapModuleFactory;
|
|
3156
|
-
|
|
3388
|
+
await this.host.loaderHook.lifecycle.beforeExecuteFactory.emit({
|
|
3389
|
+
id,
|
|
3390
|
+
expose,
|
|
3391
|
+
moduleInfo: this.remoteInfo,
|
|
3392
|
+
loadFactory,
|
|
3393
|
+
origin: this.host
|
|
3394
|
+
});
|
|
3395
|
+
try {
|
|
3396
|
+
const exposeContent = await wrapModuleFactory();
|
|
3397
|
+
await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({
|
|
3398
|
+
id,
|
|
3399
|
+
expose,
|
|
3400
|
+
moduleInfo: this.remoteInfo,
|
|
3401
|
+
loadFactory,
|
|
3402
|
+
exposeModule: exposeContent,
|
|
3403
|
+
origin: this.host
|
|
3404
|
+
});
|
|
3405
|
+
return exposeContent;
|
|
3406
|
+
} catch (executeFactoryError) {
|
|
3407
|
+
await this.host.loaderHook.lifecycle.afterExecuteFactory.emit({
|
|
3408
|
+
id,
|
|
3409
|
+
expose,
|
|
3410
|
+
moduleInfo: this.remoteInfo,
|
|
3411
|
+
loadFactory,
|
|
3412
|
+
error: executeFactoryError,
|
|
3413
|
+
origin: this.host
|
|
3414
|
+
});
|
|
3415
|
+
throw executeFactoryError;
|
|
3416
|
+
}
|
|
3157
3417
|
}
|
|
3158
3418
|
wraperFactory(moduleFactory, id) {
|
|
3159
3419
|
function defineModuleId(res, id2) {
|
|
@@ -3162,13 +3422,12 @@ var Module$1 = class {
|
|
|
3162
3422
|
enumerable: false
|
|
3163
3423
|
});
|
|
3164
3424
|
}
|
|
3165
|
-
|
|
3166
|
-
const res = await moduleFactory();
|
|
3167
|
-
defineModuleId(res, id);
|
|
3168
|
-
return res;
|
|
3169
|
-
};
|
|
3170
|
-
else return () => {
|
|
3425
|
+
return () => {
|
|
3171
3426
|
const res = moduleFactory();
|
|
3427
|
+
if (res instanceof Promise) return res.then((asyncRes) => {
|
|
3428
|
+
defineModuleId(asyncRes, id);
|
|
3429
|
+
return asyncRes;
|
|
3430
|
+
});
|
|
3172
3431
|
defineModuleId(res, id);
|
|
3173
3432
|
return res;
|
|
3174
3433
|
};
|
|
@@ -3195,7 +3454,8 @@ var SyncHook = class {
|
|
|
3195
3454
|
emit(...data) {
|
|
3196
3455
|
let result;
|
|
3197
3456
|
if (this.listeners.size > 0) this.listeners.forEach((fn) => {
|
|
3198
|
-
|
|
3457
|
+
const nextResult = fn(...data);
|
|
3458
|
+
if (nextResult !== void 0) result = nextResult;
|
|
3199
3459
|
});
|
|
3200
3460
|
return result;
|
|
3201
3461
|
}
|
|
@@ -3216,7 +3476,10 @@ var AsyncHook = class extends SyncHook {
|
|
|
3216
3476
|
let i7 = 0;
|
|
3217
3477
|
const call = (prev) => {
|
|
3218
3478
|
if (prev === false) return false;
|
|
3219
|
-
else if (i7 < ls.length) return Promise.resolve(ls[i7++].apply(null, data)).then(
|
|
3479
|
+
else if (i7 < ls.length) return Promise.resolve(ls[i7++].apply(null, data)).then((result2) => {
|
|
3480
|
+
if (result2 === void 0 || data.length === 1 && result2 === data[0]) return call(prev);
|
|
3481
|
+
return call(result2);
|
|
3482
|
+
});
|
|
3220
3483
|
else return prev;
|
|
3221
3484
|
};
|
|
3222
3485
|
result = call();
|
|
@@ -3243,6 +3506,7 @@ var SyncWaterfallHook = class extends SyncHook {
|
|
|
3243
3506
|
if (!isObject2(data)) error2(`The data for the "${this.type}" hook should be an object.`);
|
|
3244
3507
|
for (const fn of this.listeners) try {
|
|
3245
3508
|
const tempData = fn(data);
|
|
3509
|
+
if (tempData === void 0) continue;
|
|
3246
3510
|
if (checkReturnData(data, tempData)) data = tempData;
|
|
3247
3511
|
else {
|
|
3248
3512
|
this.onerror(`A plugin returned an unacceptable value for the "${this.type}" type.`);
|
|
@@ -3274,14 +3538,16 @@ var AsyncWaterfallHook = class extends SyncHook {
|
|
|
3274
3538
|
return data;
|
|
3275
3539
|
};
|
|
3276
3540
|
const call = (prevData) => {
|
|
3277
|
-
if (checkReturnData(data, prevData))
|
|
3278
|
-
|
|
3279
|
-
|
|
3280
|
-
|
|
3281
|
-
|
|
3282
|
-
|
|
3283
|
-
|
|
3284
|
-
}
|
|
3541
|
+
if (prevData !== void 0 && checkReturnData(data, prevData)) data = prevData;
|
|
3542
|
+
else if (prevData !== void 0) {
|
|
3543
|
+
this.onerror(`A plugin returned an incorrect value for the "${this.type}" type.`);
|
|
3544
|
+
return data;
|
|
3545
|
+
}
|
|
3546
|
+
if (i7 < ls.length) try {
|
|
3547
|
+
return Promise.resolve(ls[i7++](data)).then(call, processError);
|
|
3548
|
+
} catch (e7) {
|
|
3549
|
+
return processError(e7);
|
|
3550
|
+
}
|
|
3285
3551
|
return data;
|
|
3286
3552
|
};
|
|
3287
3553
|
return Promise.resolve(call(data));
|
|
@@ -3340,7 +3606,7 @@ function snapshotPlugin() {
|
|
|
3340
3606
|
if (!isRemoteInfoWithEntry(remote) || !isPureRemoteEntry(remote)) {
|
|
3341
3607
|
const { remoteSnapshot, globalSnapshot } = await origin.snapshotHandler.loadRemoteSnapshotInfo({
|
|
3342
3608
|
moduleInfo: remote,
|
|
3343
|
-
id
|
|
3609
|
+
id: composeRemoteRequestId(remote.name, expose)
|
|
3344
3610
|
});
|
|
3345
3611
|
assignRemoteInfo(remoteInfo, remoteSnapshot);
|
|
3346
3612
|
const preloadOptions = {
|
|
@@ -3361,7 +3627,10 @@ function snapshotPlugin() {
|
|
|
3361
3627
|
remoteSnapshot,
|
|
3362
3628
|
globalSnapshot
|
|
3363
3629
|
});
|
|
3364
|
-
if (assets) preloadAssets(remoteInfo, origin, assets, false
|
|
3630
|
+
if (assets) preloadAssets(remoteInfo, origin, assets, false, {
|
|
3631
|
+
initiator: "loadRemote",
|
|
3632
|
+
id
|
|
3633
|
+
}).catch(() => void 0);
|
|
3365
3634
|
return {
|
|
3366
3635
|
...args,
|
|
3367
3636
|
remoteSnapshot
|
|
@@ -3581,11 +3850,12 @@ var SnapshotHandler = class {
|
|
|
3581
3850
|
this.HostInstance = HostInstance;
|
|
3582
3851
|
this.loaderHook = HostInstance.loaderHook;
|
|
3583
3852
|
}
|
|
3584
|
-
async loadRemoteSnapshotInfo({ moduleInfo, id,
|
|
3853
|
+
async loadRemoteSnapshotInfo({ moduleInfo, id, initiator = "loadRemote" }) {
|
|
3585
3854
|
const { options } = this.HostInstance;
|
|
3586
3855
|
await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
|
|
3587
3856
|
options,
|
|
3588
|
-
moduleInfo
|
|
3857
|
+
moduleInfo,
|
|
3858
|
+
origin: this.HostInstance
|
|
3589
3859
|
});
|
|
3590
3860
|
let hostSnapshot = getGlobalSnapshotInfoByModuleInfo({
|
|
3591
3861
|
name: this.HostInstance.options.name,
|
|
@@ -3617,7 +3887,10 @@ var SnapshotHandler = class {
|
|
|
3617
3887
|
let gSnapshot;
|
|
3618
3888
|
if (globalRemoteSnapshot) if (isManifestProvider(globalRemoteSnapshot)) {
|
|
3619
3889
|
const remoteEntry = isBrowserEnvValue ? globalRemoteSnapshot.remoteEntry : globalRemoteSnapshot.ssrRemoteEntry || globalRemoteSnapshot.remoteEntry || "";
|
|
3620
|
-
const moduleSnapshot = await this.
|
|
3890
|
+
const moduleSnapshot = await this.loadManifestSnapshot(remoteEntry, moduleInfo, {}, {
|
|
3891
|
+
initiator,
|
|
3892
|
+
id: id || moduleInfo.name
|
|
3893
|
+
});
|
|
3621
3894
|
const globalSnapshotRes2 = setGlobalSnapshotInfoByModuleInfo({
|
|
3622
3895
|
...moduleInfo,
|
|
3623
3896
|
entry: remoteEntry
|
|
@@ -3635,15 +3908,12 @@ var SnapshotHandler = class {
|
|
|
3635
3908
|
gSnapshot = globalSnapshotRes;
|
|
3636
3909
|
}
|
|
3637
3910
|
else if (isRemoteInfoWithEntry(moduleInfo)) {
|
|
3638
|
-
const moduleSnapshot = await this.
|
|
3639
|
-
|
|
3640
|
-
|
|
3641
|
-
options: this.HostInstance.options,
|
|
3642
|
-
moduleInfo,
|
|
3643
|
-
remoteSnapshot: moduleSnapshot,
|
|
3644
|
-
from: "global"
|
|
3911
|
+
const moduleSnapshot = await this.loadManifestSnapshot(moduleInfo.entry, moduleInfo, {}, {
|
|
3912
|
+
initiator,
|
|
3913
|
+
id: id || moduleInfo.name
|
|
3645
3914
|
});
|
|
3646
|
-
|
|
3915
|
+
const globalSnapshotRes2 = setGlobalSnapshotInfoByModuleInfo(moduleInfo, moduleSnapshot);
|
|
3916
|
+
mSnapshot = moduleSnapshot;
|
|
3647
3917
|
gSnapshot = globalSnapshotRes2;
|
|
3648
3918
|
} else error2(RUNTIME_007, runtimeDescMap, {
|
|
3649
3919
|
remoteName: moduleInfo.name,
|
|
@@ -3666,12 +3936,17 @@ var SnapshotHandler = class {
|
|
|
3666
3936
|
getGlobalRemoteInfo(moduleInfo) {
|
|
3667
3937
|
return getGlobalRemoteInfo(moduleInfo, this.HostInstance);
|
|
3668
3938
|
}
|
|
3669
|
-
async getManifestJson(manifestUrl, moduleInfo, extraOptions) {
|
|
3939
|
+
async getManifestJson(manifestUrl, moduleInfo, extraOptions, resourceOptions) {
|
|
3670
3940
|
const getManifest = async () => {
|
|
3941
|
+
const remoteInfo = getRemoteInfo(moduleInfo);
|
|
3671
3942
|
let manifestJson = this.manifestCache.get(manifestUrl);
|
|
3672
3943
|
if (manifestJson) return manifestJson;
|
|
3673
3944
|
try {
|
|
3674
|
-
let res = await this.loaderHook.lifecycle.fetch.emit(manifestUrl, {}
|
|
3945
|
+
let res = await this.loaderHook.lifecycle.fetch.emit(manifestUrl, {}, remoteInfo, resourceOptions ? {
|
|
3946
|
+
...resourceOptions,
|
|
3947
|
+
url: manifestUrl,
|
|
3948
|
+
resourceType: "manifest"
|
|
3949
|
+
} : void 0);
|
|
3675
3950
|
if (!res || !(res instanceof Response)) res = await fetch(manifestUrl, {});
|
|
3676
3951
|
manifestJson = await res.json();
|
|
3677
3952
|
} catch (err) {
|
|
@@ -3680,6 +3955,7 @@ var SnapshotHandler = class {
|
|
|
3680
3955
|
error: err,
|
|
3681
3956
|
from: "runtime",
|
|
3682
3957
|
lifecycle: "afterResolve",
|
|
3958
|
+
remote: remoteInfo,
|
|
3683
3959
|
origin: this.HostInstance
|
|
3684
3960
|
});
|
|
3685
3961
|
if (!manifestJson) {
|
|
@@ -3691,16 +3967,33 @@ var SnapshotHandler = class {
|
|
|
3691
3967
|
}, `${err}`, optionsToMFContext(this.HostInstance.options));
|
|
3692
3968
|
}
|
|
3693
3969
|
}
|
|
3694
|
-
|
|
3970
|
+
const missingRequiredFields = [
|
|
3695
3971
|
!manifestJson.metaData && "metaData",
|
|
3696
3972
|
!manifestJson.exposes && "exposes",
|
|
3697
3973
|
!manifestJson.shared && "shared"
|
|
3698
|
-
].filter(Boolean)
|
|
3974
|
+
].filter(Boolean);
|
|
3975
|
+
if (missingRequiredFields.length > 0) await this.HostInstance.remoteHandler.hooks.lifecycle.errorLoadRemote.emit({
|
|
3976
|
+
id: manifestUrl,
|
|
3977
|
+
error: /* @__PURE__ */ new Error(`"${manifestUrl}" is not a valid federation manifest for remote "${moduleInfo.name}". Missing required fields: ${missingRequiredFields.join(", ")}.`),
|
|
3978
|
+
from: "runtime",
|
|
3979
|
+
lifecycle: "afterResolve",
|
|
3980
|
+
remote: remoteInfo,
|
|
3981
|
+
origin: this.HostInstance
|
|
3982
|
+
});
|
|
3983
|
+
if (missingRequiredFields.length > 0) error2(RUNTIME_013, runtimeDescMap, {
|
|
3984
|
+
manifestUrl,
|
|
3985
|
+
moduleName: moduleInfo.name,
|
|
3986
|
+
hostName: this.HostInstance.options.name,
|
|
3987
|
+
missingFields: missingRequiredFields.join(",")
|
|
3988
|
+
}, void 0, optionsToMFContext(this.HostInstance.options));
|
|
3699
3989
|
this.manifestCache.set(manifestUrl, manifestJson);
|
|
3700
3990
|
return manifestJson;
|
|
3701
3991
|
};
|
|
3992
|
+
return getManifest();
|
|
3993
|
+
}
|
|
3994
|
+
async loadManifestSnapshot(manifestUrl, moduleInfo, extraOptions, resourceOptions) {
|
|
3702
3995
|
const asyncLoadProcess = async () => {
|
|
3703
|
-
const manifestJson = await
|
|
3996
|
+
const manifestJson = await this.getManifestJson(manifestUrl, moduleInfo, extraOptions, resourceOptions);
|
|
3704
3997
|
const remoteSnapshot = generateSnapshotFromManifest(manifestJson, { version: manifestUrl });
|
|
3705
3998
|
const { remoteSnapshot: remoteSnapshotRes } = await this.hooks.lifecycle.loadRemoteSnapshot.emit({
|
|
3706
3999
|
options: this.HostInstance.options,
|
|
@@ -3725,6 +4018,8 @@ var SharedHandler = class {
|
|
|
3725
4018
|
afterResolve: new AsyncWaterfallHook("afterResolve"),
|
|
3726
4019
|
beforeLoadShare: new AsyncWaterfallHook("beforeLoadShare"),
|
|
3727
4020
|
loadShare: new AsyncHook(),
|
|
4021
|
+
afterLoadShare: new SyncHook("afterLoadShare"),
|
|
4022
|
+
errorLoadShare: new SyncHook("errorLoadShare"),
|
|
3728
4023
|
resolveShare: new SyncWaterfallHook("resolveShare"),
|
|
3729
4024
|
initContainerShareScopeMap: new SyncWaterfallHook("initContainerShareScopeMap")
|
|
3730
4025
|
});
|
|
@@ -3733,6 +4028,37 @@ var SharedHandler = class {
|
|
|
3733
4028
|
this.initTokens = {};
|
|
3734
4029
|
this._setGlobalShareScopeMap(host.options);
|
|
3735
4030
|
}
|
|
4031
|
+
emitAfterLoadShare({ lifecycle, pkgName, shareInfo, selectedShared }) {
|
|
4032
|
+
try {
|
|
4033
|
+
this.hooks.lifecycle.afterLoadShare.emit({
|
|
4034
|
+
pkgName,
|
|
4035
|
+
shareInfo,
|
|
4036
|
+
selectedShared,
|
|
4037
|
+
shared: this.host.options.shared,
|
|
4038
|
+
shareScopeMap: this.shareScopeMap,
|
|
4039
|
+
lifecycle,
|
|
4040
|
+
origin: this.host
|
|
4041
|
+
});
|
|
4042
|
+
} catch (error3) {
|
|
4043
|
+
warn$1(error3);
|
|
4044
|
+
}
|
|
4045
|
+
}
|
|
4046
|
+
emitErrorLoadShare({ lifecycle, pkgName, shareInfo, error: error3, recovered }) {
|
|
4047
|
+
try {
|
|
4048
|
+
this.hooks.lifecycle.errorLoadShare.emit({
|
|
4049
|
+
pkgName,
|
|
4050
|
+
shareInfo,
|
|
4051
|
+
shared: this.host.options.shared,
|
|
4052
|
+
shareScopeMap: this.shareScopeMap,
|
|
4053
|
+
lifecycle,
|
|
4054
|
+
origin: this.host,
|
|
4055
|
+
error: error3,
|
|
4056
|
+
recovered
|
|
4057
|
+
});
|
|
4058
|
+
} catch (hookError) {
|
|
4059
|
+
warn$1(hookError);
|
|
4060
|
+
}
|
|
4061
|
+
}
|
|
3736
4062
|
registerShared(globalOptions, userOptions) {
|
|
3737
4063
|
const { newShareInfos, allShareInfos } = formatShareConfigs(globalOptions, userOptions);
|
|
3738
4064
|
Object.keys(newShareInfos).forEach((sharedKey) => {
|
|
@@ -3766,77 +4092,123 @@ var SharedHandler = class {
|
|
|
3766
4092
|
extraOptions,
|
|
3767
4093
|
shareInfos: host.options.shared
|
|
3768
4094
|
});
|
|
3769
|
-
|
|
3770
|
-
|
|
3771
|
-
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3775
|
-
|
|
3776
|
-
|
|
3777
|
-
|
|
3778
|
-
|
|
3779
|
-
|
|
3780
|
-
|
|
3781
|
-
const
|
|
3782
|
-
|
|
3783
|
-
|
|
3784
|
-
|
|
3785
|
-
|
|
3786
|
-
const factory = await targetShared.loading;
|
|
3787
|
-
targetShared.loaded = true;
|
|
3788
|
-
if (!targetShared.lib) targetShared.lib = factory;
|
|
3789
|
-
addUseIn(targetShared, host.options.name);
|
|
3790
|
-
return factory;
|
|
3791
|
-
} else {
|
|
3792
|
-
const asyncLoadProcess = async () => {
|
|
3793
|
-
const factory = await targetShared.get();
|
|
4095
|
+
let shareOptionsRes = shareOptions;
|
|
4096
|
+
try {
|
|
4097
|
+
if (shareOptions?.scope) await Promise.all(shareOptions.scope.map(async (shareScope) => {
|
|
4098
|
+
await Promise.all(this.initializeSharing(shareScope, { strategy: shareOptions.strategy }));
|
|
4099
|
+
}));
|
|
4100
|
+
shareOptionsRes = (await this.hooks.lifecycle.beforeLoadShare.emit({
|
|
4101
|
+
pkgName,
|
|
4102
|
+
shareInfo: shareOptions,
|
|
4103
|
+
shared: host.options.shared,
|
|
4104
|
+
origin: host
|
|
4105
|
+
})).shareInfo;
|
|
4106
|
+
assert2(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.`);
|
|
4107
|
+
const resolvedShareOptions = shareOptionsRes;
|
|
4108
|
+
const { shared: registeredShared, useTreesShaking } = getRegisteredShare(this.shareScopeMap, pkgName, shareOptionsRes, this.hooks.lifecycle.resolveShare) || {};
|
|
4109
|
+
if (registeredShared) {
|
|
4110
|
+
const targetShared = directShare(registeredShared, useTreesShaking);
|
|
4111
|
+
if (targetShared.lib) {
|
|
3794
4112
|
addUseIn(targetShared, host.options.name);
|
|
4113
|
+
this.emitAfterLoadShare({
|
|
4114
|
+
lifecycle: "loadShare",
|
|
4115
|
+
pkgName,
|
|
4116
|
+
shareInfo: resolvedShareOptions,
|
|
4117
|
+
selectedShared: registeredShared
|
|
4118
|
+
});
|
|
4119
|
+
return targetShared.lib;
|
|
4120
|
+
} else if (targetShared.loading && !targetShared.loaded) {
|
|
4121
|
+
const factory = await targetShared.loading;
|
|
3795
4122
|
targetShared.loaded = true;
|
|
3796
|
-
targetShared.lib = factory;
|
|
4123
|
+
if (!targetShared.lib) targetShared.lib = factory;
|
|
4124
|
+
addUseIn(targetShared, host.options.name);
|
|
4125
|
+
this.emitAfterLoadShare({
|
|
4126
|
+
lifecycle: "loadShare",
|
|
4127
|
+
pkgName,
|
|
4128
|
+
shareInfo: resolvedShareOptions,
|
|
4129
|
+
selectedShared: registeredShared
|
|
4130
|
+
});
|
|
3797
4131
|
return factory;
|
|
4132
|
+
} else {
|
|
4133
|
+
const asyncLoadProcess = async () => {
|
|
4134
|
+
const factory2 = await targetShared.get();
|
|
4135
|
+
addUseIn(targetShared, host.options.name);
|
|
4136
|
+
targetShared.loaded = true;
|
|
4137
|
+
targetShared.lib = factory2;
|
|
4138
|
+
return factory2;
|
|
4139
|
+
};
|
|
4140
|
+
const loading = asyncLoadProcess();
|
|
4141
|
+
this.setShared({
|
|
4142
|
+
pkgName,
|
|
4143
|
+
loaded: false,
|
|
4144
|
+
shared: registeredShared,
|
|
4145
|
+
from: host.options.name,
|
|
4146
|
+
lib: null,
|
|
4147
|
+
loading,
|
|
4148
|
+
treeShaking: useTreesShaking ? targetShared : void 0
|
|
4149
|
+
});
|
|
4150
|
+
const factory = await loading;
|
|
4151
|
+
this.emitAfterLoadShare({
|
|
4152
|
+
lifecycle: "loadShare",
|
|
4153
|
+
pkgName,
|
|
4154
|
+
shareInfo: resolvedShareOptions,
|
|
4155
|
+
selectedShared: registeredShared
|
|
4156
|
+
});
|
|
4157
|
+
return factory;
|
|
4158
|
+
}
|
|
4159
|
+
} else {
|
|
4160
|
+
if (extraOptions?.customShareInfo) {
|
|
4161
|
+
this.emitErrorLoadShare({
|
|
4162
|
+
lifecycle: "loadShare",
|
|
4163
|
+
pkgName,
|
|
4164
|
+
shareInfo: resolvedShareOptions,
|
|
4165
|
+
recovered: true
|
|
4166
|
+
});
|
|
4167
|
+
return false;
|
|
4168
|
+
}
|
|
4169
|
+
const _useTreeShaking = shouldUseTreeShaking(resolvedShareOptions.treeShaking);
|
|
4170
|
+
const targetShared = directShare(resolvedShareOptions, _useTreeShaking);
|
|
4171
|
+
const asyncLoadProcess = async () => {
|
|
4172
|
+
const factory2 = await targetShared.get();
|
|
4173
|
+
targetShared.lib = factory2;
|
|
4174
|
+
targetShared.loaded = true;
|
|
4175
|
+
addUseIn(targetShared, host.options.name);
|
|
4176
|
+
const { shared: gShared, useTreesShaking: gUseTreeShaking } = getRegisteredShare(this.shareScopeMap, pkgName, resolvedShareOptions, this.hooks.lifecycle.resolveShare) || {};
|
|
4177
|
+
if (gShared) {
|
|
4178
|
+
const targetGShared = directShare(gShared, gUseTreeShaking);
|
|
4179
|
+
targetGShared.lib = factory2;
|
|
4180
|
+
targetGShared.loaded = true;
|
|
4181
|
+
gShared.from = resolvedShareOptions.from;
|
|
4182
|
+
}
|
|
4183
|
+
return factory2;
|
|
3798
4184
|
};
|
|
3799
4185
|
const loading = asyncLoadProcess();
|
|
3800
4186
|
this.setShared({
|
|
3801
4187
|
pkgName,
|
|
3802
4188
|
loaded: false,
|
|
3803
|
-
shared:
|
|
4189
|
+
shared: resolvedShareOptions,
|
|
3804
4190
|
from: host.options.name,
|
|
3805
4191
|
lib: null,
|
|
3806
4192
|
loading,
|
|
3807
|
-
treeShaking:
|
|
4193
|
+
treeShaking: _useTreeShaking ? targetShared : void 0
|
|
4194
|
+
});
|
|
4195
|
+
const factory = await loading;
|
|
4196
|
+
this.emitAfterLoadShare({
|
|
4197
|
+
lifecycle: "loadShare",
|
|
4198
|
+
pkgName,
|
|
4199
|
+
shareInfo: resolvedShareOptions,
|
|
4200
|
+
selectedShared: resolvedShareOptions
|
|
3808
4201
|
});
|
|
3809
|
-
return loading;
|
|
3810
|
-
}
|
|
3811
|
-
} else {
|
|
3812
|
-
if (extraOptions?.customShareInfo) return false;
|
|
3813
|
-
const _useTreeShaking = shouldUseTreeShaking(shareOptionsRes.treeShaking);
|
|
3814
|
-
const targetShared = directShare(shareOptionsRes, _useTreeShaking);
|
|
3815
|
-
const asyncLoadProcess = async () => {
|
|
3816
|
-
const factory = await targetShared.get();
|
|
3817
|
-
targetShared.lib = factory;
|
|
3818
|
-
targetShared.loaded = true;
|
|
3819
|
-
addUseIn(targetShared, host.options.name);
|
|
3820
|
-
const { shared: gShared, useTreesShaking: gUseTreeShaking } = getRegisteredShare(this.shareScopeMap, pkgName, shareOptionsRes, this.hooks.lifecycle.resolveShare) || {};
|
|
3821
|
-
if (gShared) {
|
|
3822
|
-
const targetGShared = directShare(gShared, gUseTreeShaking);
|
|
3823
|
-
targetGShared.lib = factory;
|
|
3824
|
-
targetGShared.loaded = true;
|
|
3825
|
-
gShared.from = shareOptionsRes.from;
|
|
3826
|
-
}
|
|
3827
4202
|
return factory;
|
|
3828
|
-
}
|
|
3829
|
-
|
|
3830
|
-
this.
|
|
4203
|
+
}
|
|
4204
|
+
} catch (shareError) {
|
|
4205
|
+
this.emitErrorLoadShare({
|
|
4206
|
+
lifecycle: "loadShare",
|
|
3831
4207
|
pkgName,
|
|
3832
|
-
|
|
3833
|
-
|
|
3834
|
-
from: host.options.name,
|
|
3835
|
-
lib: null,
|
|
3836
|
-
loading,
|
|
3837
|
-
treeShaking: _useTreeShaking ? targetShared : void 0
|
|
4208
|
+
shareInfo: shareOptionsRes,
|
|
4209
|
+
error: shareError
|
|
3838
4210
|
});
|
|
3839
|
-
|
|
4211
|
+
throw shareError;
|
|
3840
4212
|
}
|
|
3841
4213
|
}
|
|
3842
4214
|
/**
|
|
@@ -3881,6 +4253,7 @@ var SharedHandler = class {
|
|
|
3881
4253
|
error: error3,
|
|
3882
4254
|
from: "runtime",
|
|
3883
4255
|
lifecycle: "beforeLoadShare",
|
|
4256
|
+
remote: module2.remoteInfo,
|
|
3884
4257
|
origin: host
|
|
3885
4258
|
});
|
|
3886
4259
|
if (!remoteEntryExports) return;
|
|
@@ -3908,58 +4281,92 @@ var SharedHandler = class {
|
|
|
3908
4281
|
extraOptions,
|
|
3909
4282
|
shareInfos: host.options.shared
|
|
3910
4283
|
});
|
|
3911
|
-
|
|
3912
|
-
|
|
3913
|
-
|
|
3914
|
-
|
|
3915
|
-
|
|
3916
|
-
if (
|
|
3917
|
-
|
|
3918
|
-
if (!registeredShared.loaded) {
|
|
3919
|
-
registeredShared.loaded = true;
|
|
3920
|
-
if (registeredShared.from === host.options.name) shareOptions.loaded = true;
|
|
3921
|
-
}
|
|
3922
|
-
return registeredShared.lib;
|
|
3923
|
-
}
|
|
3924
|
-
if (typeof registeredShared.get === "function") {
|
|
3925
|
-
const module2 = registeredShared.get();
|
|
3926
|
-
if (!(module2 instanceof Promise)) {
|
|
4284
|
+
try {
|
|
4285
|
+
if (shareOptions?.scope) shareOptions.scope.forEach((shareScope) => {
|
|
4286
|
+
this.initializeSharing(shareScope, { strategy: shareOptions.strategy });
|
|
4287
|
+
});
|
|
4288
|
+
const { shared: registeredShared } = getRegisteredShare(this.shareScopeMap, pkgName, shareOptions, this.hooks.lifecycle.resolveShare) || {};
|
|
4289
|
+
if (registeredShared) {
|
|
4290
|
+
if (typeof registeredShared.lib === "function") {
|
|
3927
4291
|
addUseIn(registeredShared, host.options.name);
|
|
3928
|
-
|
|
4292
|
+
if (!registeredShared.loaded) {
|
|
4293
|
+
registeredShared.loaded = true;
|
|
4294
|
+
if (registeredShared.from === host.options.name) shareOptions.loaded = true;
|
|
4295
|
+
}
|
|
4296
|
+
this.emitAfterLoadShare({
|
|
4297
|
+
lifecycle: "loadShareSync",
|
|
3929
4298
|
pkgName,
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
lib: module2,
|
|
3933
|
-
shared: registeredShared
|
|
4299
|
+
shareInfo: shareOptions,
|
|
4300
|
+
selectedShared: registeredShared
|
|
3934
4301
|
});
|
|
3935
|
-
return
|
|
4302
|
+
return registeredShared.lib;
|
|
4303
|
+
}
|
|
4304
|
+
if (typeof registeredShared.get === "function") {
|
|
4305
|
+
const module2 = registeredShared.get();
|
|
4306
|
+
if (!(module2 instanceof Promise)) {
|
|
4307
|
+
addUseIn(registeredShared, host.options.name);
|
|
4308
|
+
this.setShared({
|
|
4309
|
+
pkgName,
|
|
4310
|
+
loaded: true,
|
|
4311
|
+
from: host.options.name,
|
|
4312
|
+
lib: module2,
|
|
4313
|
+
shared: registeredShared
|
|
4314
|
+
});
|
|
4315
|
+
this.emitAfterLoadShare({
|
|
4316
|
+
lifecycle: "loadShareSync",
|
|
4317
|
+
pkgName,
|
|
4318
|
+
shareInfo: shareOptions,
|
|
4319
|
+
selectedShared: registeredShared
|
|
4320
|
+
});
|
|
4321
|
+
return module2;
|
|
4322
|
+
}
|
|
3936
4323
|
}
|
|
3937
4324
|
}
|
|
3938
|
-
|
|
3939
|
-
|
|
3940
|
-
|
|
3941
|
-
|
|
3942
|
-
|
|
3943
|
-
|
|
3944
|
-
|
|
3945
|
-
|
|
4325
|
+
if (shareOptions.lib) {
|
|
4326
|
+
if (!shareOptions.loaded) shareOptions.loaded = true;
|
|
4327
|
+
this.emitAfterLoadShare({
|
|
4328
|
+
lifecycle: "loadShareSync",
|
|
4329
|
+
pkgName,
|
|
4330
|
+
shareInfo: shareOptions,
|
|
4331
|
+
selectedShared: shareOptions
|
|
4332
|
+
});
|
|
4333
|
+
return shareOptions.lib;
|
|
4334
|
+
}
|
|
4335
|
+
if (shareOptions.get) {
|
|
4336
|
+
const module2 = shareOptions.get();
|
|
4337
|
+
if (module2 instanceof Promise) error2(extraOptions?.from === "build" ? RUNTIME_005 : RUNTIME_006, runtimeDescMap, {
|
|
4338
|
+
hostName: host.options.name,
|
|
4339
|
+
sharedPkgName: pkgName
|
|
4340
|
+
}, void 0, optionsToMFContext(host.options));
|
|
4341
|
+
shareOptions.lib = module2;
|
|
4342
|
+
this.setShared({
|
|
4343
|
+
pkgName,
|
|
4344
|
+
loaded: true,
|
|
4345
|
+
from: host.options.name,
|
|
4346
|
+
lib: shareOptions.lib,
|
|
4347
|
+
shared: shareOptions
|
|
4348
|
+
});
|
|
4349
|
+
this.emitAfterLoadShare({
|
|
4350
|
+
lifecycle: "loadShareSync",
|
|
4351
|
+
pkgName,
|
|
4352
|
+
shareInfo: shareOptions,
|
|
4353
|
+
selectedShared: shareOptions
|
|
4354
|
+
});
|
|
4355
|
+
return shareOptions.lib;
|
|
4356
|
+
}
|
|
4357
|
+
error2(RUNTIME_006, runtimeDescMap, {
|
|
3946
4358
|
hostName: host.options.name,
|
|
3947
4359
|
sharedPkgName: pkgName
|
|
3948
4360
|
}, void 0, optionsToMFContext(host.options));
|
|
3949
|
-
|
|
3950
|
-
this.
|
|
4361
|
+
} catch (shareError) {
|
|
4362
|
+
this.emitErrorLoadShare({
|
|
4363
|
+
lifecycle: "loadShareSync",
|
|
3951
4364
|
pkgName,
|
|
3952
|
-
|
|
3953
|
-
|
|
3954
|
-
lib: shareOptions.lib,
|
|
3955
|
-
shared: shareOptions
|
|
4365
|
+
shareInfo: shareOptions,
|
|
4366
|
+
error: shareError
|
|
3956
4367
|
});
|
|
3957
|
-
|
|
4368
|
+
throw shareError;
|
|
3958
4369
|
}
|
|
3959
|
-
error2(RUNTIME_006, runtimeDescMap, {
|
|
3960
|
-
hostName: host.options.name,
|
|
3961
|
-
sharedPkgName: pkgName
|
|
3962
|
-
}, void 0, optionsToMFContext(host.options));
|
|
3963
4370
|
}
|
|
3964
4371
|
initShareScopeMap(scopeName, shareScope, extraOptions = {}) {
|
|
3965
4372
|
const { host } = this;
|
|
@@ -4012,12 +4419,14 @@ var RemoteHandler = class {
|
|
|
4012
4419
|
beforeRegisterRemote: new SyncWaterfallHook("beforeRegisterRemote"),
|
|
4013
4420
|
registerRemote: new SyncWaterfallHook("registerRemote"),
|
|
4014
4421
|
beforeRequest: new AsyncWaterfallHook("beforeRequest"),
|
|
4422
|
+
afterMatchRemote: new AsyncHook("afterMatchRemote"),
|
|
4015
4423
|
onLoad: new AsyncHook("onLoad"),
|
|
4424
|
+
afterLoadRemote: new AsyncHook("afterLoadRemote"),
|
|
4016
4425
|
handlePreloadModule: new SyncHook("handlePreloadModule"),
|
|
4017
4426
|
errorLoadRemote: new AsyncHook("errorLoadRemote"),
|
|
4018
4427
|
beforePreloadRemote: new AsyncHook("beforePreloadRemote"),
|
|
4019
4428
|
generatePreloadAssets: new AsyncHook("generatePreloadAssets"),
|
|
4020
|
-
afterPreloadRemote: new AsyncHook(),
|
|
4429
|
+
afterPreloadRemote: new AsyncHook("afterPreloadRemote"),
|
|
4021
4430
|
loadEntry: new AsyncHook()
|
|
4022
4431
|
});
|
|
4023
4432
|
this.host = host;
|
|
@@ -4054,10 +4463,18 @@ var RemoteHandler = class {
|
|
|
4054
4463
|
}
|
|
4055
4464
|
async loadRemote(id, options) {
|
|
4056
4465
|
const { host } = this;
|
|
4466
|
+
const startMatchInfo = matchRemoteWithNameAndExpose(host.options.remotes, id);
|
|
4467
|
+
let completeRequestId = id;
|
|
4468
|
+
let completeExpose = startMatchInfo?.expose;
|
|
4469
|
+
let completeRemote = startMatchInfo ? getRemoteInfo(startMatchInfo.remote) : void 0;
|
|
4470
|
+
let afterLoadRemoteArgs;
|
|
4057
4471
|
try {
|
|
4058
4472
|
const { loadFactory = true } = options || { loadFactory: true };
|
|
4059
4473
|
const { module: module2, moduleOptions, remoteMatchInfo } = await this.getRemoteModuleAndOptions({ id });
|
|
4060
4474
|
const { pkgNameOrAlias, remote, expose, id: idRes, remoteSnapshot } = remoteMatchInfo;
|
|
4475
|
+
completeRequestId = idRes;
|
|
4476
|
+
completeExpose = expose;
|
|
4477
|
+
completeRemote = getRemoteInfo(remote);
|
|
4061
4478
|
const moduleOrFactory = await module2.get(idRes, expose, options, remoteSnapshot);
|
|
4062
4479
|
const moduleWrapper = await this.hooks.lifecycle.onLoad.emit({
|
|
4063
4480
|
id: idRes,
|
|
@@ -4071,44 +4488,155 @@ var RemoteHandler = class {
|
|
|
4071
4488
|
origin: host
|
|
4072
4489
|
});
|
|
4073
4490
|
this.setIdToRemoteMap(id, remoteMatchInfo);
|
|
4491
|
+
afterLoadRemoteArgs = {
|
|
4492
|
+
id: completeRequestId,
|
|
4493
|
+
expose: completeExpose,
|
|
4494
|
+
remote: completeRemote,
|
|
4495
|
+
options,
|
|
4496
|
+
origin: host
|
|
4497
|
+
};
|
|
4074
4498
|
if (typeof moduleWrapper === "function") return moduleWrapper;
|
|
4075
4499
|
return moduleOrFactory;
|
|
4076
4500
|
} catch (error3) {
|
|
4077
4501
|
const { from = "runtime" } = options || { from: "runtime" };
|
|
4078
|
-
|
|
4079
|
-
|
|
4502
|
+
let failOver;
|
|
4503
|
+
try {
|
|
4504
|
+
failOver = await this.hooks.lifecycle.errorLoadRemote.emit({
|
|
4505
|
+
id,
|
|
4506
|
+
error: error3,
|
|
4507
|
+
from,
|
|
4508
|
+
lifecycle: "onLoad",
|
|
4509
|
+
expose: completeExpose,
|
|
4510
|
+
remote: completeRemote,
|
|
4511
|
+
origin: host
|
|
4512
|
+
});
|
|
4513
|
+
} catch (hookError) {
|
|
4514
|
+
afterLoadRemoteArgs = {
|
|
4515
|
+
id: completeRequestId,
|
|
4516
|
+
expose: completeExpose,
|
|
4517
|
+
remote: completeRemote,
|
|
4518
|
+
options,
|
|
4519
|
+
error: hookError,
|
|
4520
|
+
origin: host
|
|
4521
|
+
};
|
|
4522
|
+
throw hookError;
|
|
4523
|
+
}
|
|
4524
|
+
if (!failOver) {
|
|
4525
|
+
afterLoadRemoteArgs = {
|
|
4526
|
+
id: completeRequestId,
|
|
4527
|
+
expose: completeExpose,
|
|
4528
|
+
remote: completeRemote,
|
|
4529
|
+
options,
|
|
4530
|
+
error: error3,
|
|
4531
|
+
origin: host
|
|
4532
|
+
};
|
|
4533
|
+
throw error3;
|
|
4534
|
+
}
|
|
4535
|
+
afterLoadRemoteArgs = {
|
|
4536
|
+
id: completeRequestId,
|
|
4537
|
+
expose: completeExpose,
|
|
4538
|
+
remote: completeRemote,
|
|
4539
|
+
options,
|
|
4080
4540
|
error: error3,
|
|
4081
|
-
|
|
4082
|
-
|
|
4083
|
-
|
|
4084
|
-
});
|
|
4085
|
-
if (!failOver) throw error3;
|
|
4541
|
+
origin: host,
|
|
4542
|
+
recovered: true
|
|
4543
|
+
};
|
|
4086
4544
|
return failOver;
|
|
4545
|
+
} finally {
|
|
4546
|
+
if (afterLoadRemoteArgs) await this.hooks.lifecycle.afterLoadRemote.emit(afterLoadRemoteArgs);
|
|
4087
4547
|
}
|
|
4088
4548
|
}
|
|
4089
4549
|
async preloadRemote(preloadOptions) {
|
|
4090
4550
|
const { host } = this;
|
|
4551
|
+
const preloadResults = [];
|
|
4091
4552
|
await this.hooks.lifecycle.beforePreloadRemote.emit({
|
|
4092
4553
|
preloadOps: preloadOptions,
|
|
4093
4554
|
options: host.options,
|
|
4094
4555
|
origin: host
|
|
4095
4556
|
});
|
|
4096
4557
|
const preloadOps = formatPreloadArgs(host.options.remotes, preloadOptions);
|
|
4097
|
-
|
|
4098
|
-
const { remote } = ops;
|
|
4558
|
+
const createPreloadAssetOps = (ops) => {
|
|
4559
|
+
const { preloadConfig, remote } = ops;
|
|
4560
|
+
const exposes = preloadConfig.exposes || [];
|
|
4561
|
+
if (!exposes.length) return [{
|
|
4562
|
+
ops,
|
|
4563
|
+
id: `${remote.name}/*`
|
|
4564
|
+
}];
|
|
4565
|
+
return exposes.map((expose) => ({
|
|
4566
|
+
ops: {
|
|
4567
|
+
...ops,
|
|
4568
|
+
preloadConfig: {
|
|
4569
|
+
...preloadConfig,
|
|
4570
|
+
exposes: [expose]
|
|
4571
|
+
}
|
|
4572
|
+
},
|
|
4573
|
+
id: composeRemoteRequestId(remote.name, expose)
|
|
4574
|
+
}));
|
|
4575
|
+
};
|
|
4576
|
+
let preloadError;
|
|
4577
|
+
await Promise.all(preloadOps.flatMap(createPreloadAssetOps).map(async (assetOps) => {
|
|
4578
|
+
const { ops, id: preloadId } = assetOps;
|
|
4579
|
+
const { remote, preloadConfig } = ops;
|
|
4099
4580
|
const remoteInfo = getRemoteInfo(remote);
|
|
4100
|
-
|
|
4101
|
-
|
|
4102
|
-
|
|
4103
|
-
|
|
4104
|
-
|
|
4105
|
-
|
|
4106
|
-
|
|
4107
|
-
|
|
4108
|
-
|
|
4109
|
-
|
|
4110
|
-
|
|
4581
|
+
try {
|
|
4582
|
+
const { globalSnapshot, remoteSnapshot } = await host.snapshotHandler.loadRemoteSnapshotInfo({
|
|
4583
|
+
moduleInfo: remote,
|
|
4584
|
+
id: preloadId,
|
|
4585
|
+
initiator: "preloadRemote"
|
|
4586
|
+
});
|
|
4587
|
+
const assets = await this.hooks.lifecycle.generatePreloadAssets.emit({
|
|
4588
|
+
origin: host,
|
|
4589
|
+
preloadOptions: ops,
|
|
4590
|
+
remote,
|
|
4591
|
+
remoteInfo,
|
|
4592
|
+
globalSnapshot,
|
|
4593
|
+
remoteSnapshot
|
|
4594
|
+
});
|
|
4595
|
+
if (!assets) return;
|
|
4596
|
+
const results = await preloadAssets(remoteInfo, host, assets, true, {
|
|
4597
|
+
initiator: "preloadRemote",
|
|
4598
|
+
id: preloadId
|
|
4599
|
+
});
|
|
4600
|
+
preloadResults.push({
|
|
4601
|
+
remote,
|
|
4602
|
+
remoteInfo,
|
|
4603
|
+
preloadConfig,
|
|
4604
|
+
id: preloadId,
|
|
4605
|
+
results
|
|
4606
|
+
});
|
|
4607
|
+
} catch (error3) {
|
|
4608
|
+
preloadResults.push({
|
|
4609
|
+
remote,
|
|
4610
|
+
remoteInfo,
|
|
4611
|
+
preloadConfig,
|
|
4612
|
+
id: preloadId,
|
|
4613
|
+
results: [{
|
|
4614
|
+
url: remoteInfo.entry,
|
|
4615
|
+
status: "error",
|
|
4616
|
+
resourceType: /\.json(?:$|[?#])/i.test(remoteInfo.entry) ? "manifest" : "remoteEntry",
|
|
4617
|
+
initiator: "preloadRemote",
|
|
4618
|
+
id: preloadId,
|
|
4619
|
+
error: error3
|
|
4620
|
+
}]
|
|
4621
|
+
});
|
|
4622
|
+
}
|
|
4111
4623
|
}));
|
|
4624
|
+
const failedResults = preloadResults.flatMap((preloadResult) => preloadResult.results.filter((result) => result.status === "error" || result.status === "timeout"));
|
|
4625
|
+
if (failedResults.length > 0) {
|
|
4626
|
+
preloadError = /* @__PURE__ */ new Error(`preloadRemote failed to load ${failedResults.length} resource(s).`);
|
|
4627
|
+
Object.assign(preloadError, {
|
|
4628
|
+
results: preloadResults,
|
|
4629
|
+
failedResults
|
|
4630
|
+
});
|
|
4631
|
+
}
|
|
4632
|
+
await this.hooks.lifecycle.afterPreloadRemote.emit({
|
|
4633
|
+
preloadOps: preloadOptions,
|
|
4634
|
+
options: host.options,
|
|
4635
|
+
origin: host,
|
|
4636
|
+
results: preloadResults,
|
|
4637
|
+
error: preloadError
|
|
4638
|
+
});
|
|
4639
|
+
if (preloadError) throw preloadError;
|
|
4112
4640
|
}
|
|
4113
4641
|
registerRemotes(remotes, options) {
|
|
4114
4642
|
const { host } = this;
|
|
@@ -4139,12 +4667,29 @@ var RemoteHandler = class {
|
|
|
4139
4667
|
}
|
|
4140
4668
|
const { id: idRes } = loadRemoteArgs;
|
|
4141
4669
|
const remoteSplitInfo = matchRemoteWithNameAndExpose(host.options.remotes, idRes);
|
|
4142
|
-
if (!remoteSplitInfo)
|
|
4143
|
-
|
|
4144
|
-
|
|
4145
|
-
|
|
4670
|
+
if (!remoteSplitInfo) try {
|
|
4671
|
+
error2(RUNTIME_004, runtimeDescMap, {
|
|
4672
|
+
hostName: host.options.name,
|
|
4673
|
+
requestId: idRes
|
|
4674
|
+
}, void 0, optionsToMFContext(host.options));
|
|
4675
|
+
} catch (matchError) {
|
|
4676
|
+
await this.hooks.lifecycle.afterMatchRemote.emit({
|
|
4677
|
+
id: idRes,
|
|
4678
|
+
options: host.options,
|
|
4679
|
+
error: matchError,
|
|
4680
|
+
origin: host
|
|
4681
|
+
});
|
|
4682
|
+
throw matchError;
|
|
4683
|
+
}
|
|
4146
4684
|
const { remote: rawRemote } = remoteSplitInfo;
|
|
4147
4685
|
const remoteInfo = getRemoteInfo(rawRemote);
|
|
4686
|
+
await this.hooks.lifecycle.afterMatchRemote.emit({
|
|
4687
|
+
id: idRes,
|
|
4688
|
+
...remoteSplitInfo,
|
|
4689
|
+
options: host.options,
|
|
4690
|
+
remoteInfo,
|
|
4691
|
+
origin: host
|
|
4692
|
+
});
|
|
4148
4693
|
const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit({
|
|
4149
4694
|
id: idRes,
|
|
4150
4695
|
...remoteSplitInfo,
|
|
@@ -4296,7 +4841,7 @@ var ModuleFederation = class {
|
|
|
4296
4841
|
beforeInitContainer: new AsyncWaterfallHook("beforeInitContainer"),
|
|
4297
4842
|
initContainer: new AsyncWaterfallHook("initContainer")
|
|
4298
4843
|
});
|
|
4299
|
-
this.version = "2.
|
|
4844
|
+
this.version = "2.5.0";
|
|
4300
4845
|
this.moduleCache = /* @__PURE__ */ new Map();
|
|
4301
4846
|
this.loaderHook = new PluginSystem({
|
|
4302
4847
|
getModuleInfo: new SyncHook(),
|
|
@@ -4304,6 +4849,13 @@ var ModuleFederation = class {
|
|
|
4304
4849
|
createLink: new SyncHook(),
|
|
4305
4850
|
fetch: new AsyncHook(),
|
|
4306
4851
|
loadEntryError: new AsyncHook(),
|
|
4852
|
+
afterLoadEntry: new AsyncHook("afterLoadEntry"),
|
|
4853
|
+
beforeInitRemote: new AsyncHook("beforeInitRemote"),
|
|
4854
|
+
afterInitRemote: new AsyncHook("afterInitRemote"),
|
|
4855
|
+
beforeGetExpose: new AsyncHook("beforeGetExpose"),
|
|
4856
|
+
afterGetExpose: new AsyncHook("afterGetExpose"),
|
|
4857
|
+
beforeExecuteFactory: new AsyncHook("beforeExecuteFactory"),
|
|
4858
|
+
afterExecuteFactory: new AsyncHook("afterExecuteFactory"),
|
|
4307
4859
|
getModuleFactory: new AsyncHook()
|
|
4308
4860
|
});
|
|
4309
4861
|
this.bridgeHook = new PluginSystem({
|
|
@@ -4387,7 +4939,8 @@ var ModuleFederation = class {
|
|
|
4387
4939
|
...userOptions,
|
|
4388
4940
|
plugins,
|
|
4389
4941
|
remotes,
|
|
4390
|
-
shared: allShareInfos
|
|
4942
|
+
shared: allShareInfos,
|
|
4943
|
+
id: userOptionsRes.id || globalOptions.id
|
|
4391
4944
|
};
|
|
4392
4945
|
this.hooks.lifecycle.init.emit({
|
|
4393
4946
|
origin: this,
|
|
@@ -4416,7 +4969,10 @@ var ModuleFederation = class {
|
|
|
4416
4969
|
|
|
4417
4970
|
// node_modules/@module-federation/runtime/dist/index.js
|
|
4418
4971
|
function createInstance(options) {
|
|
4419
|
-
const instance = new (getGlobalFederationConstructor() || ModuleFederation)(
|
|
4972
|
+
const instance = new (getGlobalFederationConstructor() || ModuleFederation)({
|
|
4973
|
+
id: `${options.name}@${options.version || Date.now()}`,
|
|
4974
|
+
...options
|
|
4975
|
+
});
|
|
4420
4976
|
setGlobalFederationInstance(instance);
|
|
4421
4977
|
return instance;
|
|
4422
4978
|
}
|
|
@@ -4793,94 +5349,95 @@ y.elementStyles = [], y.shadowRootOptions = { mode: "open" }, y[d("elementProper
|
|
|
4793
5349
|
|
|
4794
5350
|
// node_modules/lit-html/lit-html.js
|
|
4795
5351
|
var t2 = globalThis;
|
|
4796
|
-
var i3 =
|
|
4797
|
-
var s2 =
|
|
4798
|
-
var e3 = "
|
|
4799
|
-
var h2 =
|
|
4800
|
-
var o3 =
|
|
4801
|
-
var n3 =
|
|
4802
|
-
var r3 =
|
|
4803
|
-
var l2 =
|
|
4804
|
-
var c3 = (
|
|
4805
|
-
var a2 =
|
|
4806
|
-
var u2 =
|
|
4807
|
-
var d2 = "[
|
|
4808
|
-
var f2 =
|
|
4809
|
-
var v =
|
|
4810
|
-
var _ =
|
|
4811
|
-
var m =
|
|
5352
|
+
var i3 = (t4) => t4;
|
|
5353
|
+
var s2 = t2.trustedTypes;
|
|
5354
|
+
var e3 = s2 ? s2.createPolicy("lit-html", { createHTML: (t4) => t4 }) : void 0;
|
|
5355
|
+
var h2 = "$lit$";
|
|
5356
|
+
var o3 = `lit$${Math.random().toFixed(9).slice(2)}$`;
|
|
5357
|
+
var n3 = "?" + o3;
|
|
5358
|
+
var r3 = `<${n3}>`;
|
|
5359
|
+
var l2 = document;
|
|
5360
|
+
var c3 = () => l2.createComment("");
|
|
5361
|
+
var a2 = (t4) => null === t4 || "object" != typeof t4 && "function" != typeof t4;
|
|
5362
|
+
var u2 = Array.isArray;
|
|
5363
|
+
var d2 = (t4) => u2(t4) || "function" == typeof t4?.[Symbol.iterator];
|
|
5364
|
+
var f2 = "[ \n\f\r]";
|
|
5365
|
+
var v = /<(?:(!--|\/[^a-zA-Z])|(\/?[a-zA-Z][^>\s]*)|(\/?$))/g;
|
|
5366
|
+
var _ = /-->/g;
|
|
5367
|
+
var m = />/g;
|
|
5368
|
+
var p2 = RegExp(`>|${f2}(?:([^\\s"'>=/]+)(${f2}*=${f2}*(?:[^
|
|
4812
5369
|
\f\r"'\`<>=]|("|')|))|$)`, "g");
|
|
4813
|
-
var
|
|
4814
|
-
var
|
|
4815
|
-
var
|
|
4816
|
-
var
|
|
4817
|
-
var
|
|
4818
|
-
var
|
|
4819
|
-
var
|
|
4820
|
-
var
|
|
4821
|
-
var
|
|
4822
|
-
var
|
|
4823
|
-
var
|
|
4824
|
-
function
|
|
4825
|
-
if (!
|
|
4826
|
-
return void 0 !==
|
|
4827
|
-
}
|
|
4828
|
-
var
|
|
4829
|
-
const s4 = t4.length - 1,
|
|
4830
|
-
let
|
|
5370
|
+
var g = /'/g;
|
|
5371
|
+
var $ = /"/g;
|
|
5372
|
+
var y2 = /^(?:script|style|textarea|title)$/i;
|
|
5373
|
+
var x = (t4) => (i7, ...s4) => ({ _$litType$: t4, strings: i7, values: s4 });
|
|
5374
|
+
var b2 = x(1);
|
|
5375
|
+
var w = x(2);
|
|
5376
|
+
var T = x(3);
|
|
5377
|
+
var E = /* @__PURE__ */ Symbol.for("lit-noChange");
|
|
5378
|
+
var A = /* @__PURE__ */ Symbol.for("lit-nothing");
|
|
5379
|
+
var C = /* @__PURE__ */ new WeakMap();
|
|
5380
|
+
var P = l2.createTreeWalker(l2, 129);
|
|
5381
|
+
function V(t4, i7) {
|
|
5382
|
+
if (!u2(t4) || !t4.hasOwnProperty("raw")) throw Error("invalid template strings array");
|
|
5383
|
+
return void 0 !== e3 ? e3.createHTML(i7) : i7;
|
|
5384
|
+
}
|
|
5385
|
+
var N = (t4, i7) => {
|
|
5386
|
+
const s4 = t4.length - 1, e7 = [];
|
|
5387
|
+
let n6, l3 = 2 === i7 ? "<svg>" : 3 === i7 ? "<math>" : "", c4 = v;
|
|
4831
5388
|
for (let i8 = 0; i8 < s4; i8++) {
|
|
4832
5389
|
const s5 = t4[i8];
|
|
4833
|
-
let a3, u3, d3 = -1,
|
|
4834
|
-
for (;
|
|
4835
|
-
const x2 = c4 ===
|
|
4836
|
-
l3 += c4 ===
|
|
5390
|
+
let a3, u3, d3 = -1, f3 = 0;
|
|
5391
|
+
for (; f3 < s5.length && (c4.lastIndex = f3, u3 = c4.exec(s5), null !== u3); ) f3 = c4.lastIndex, c4 === v ? "!--" === u3[1] ? c4 = _ : void 0 !== u3[1] ? c4 = m : void 0 !== u3[2] ? (y2.test(u3[2]) && (n6 = RegExp("</" + u3[2], "g")), c4 = p2) : void 0 !== u3[3] && (c4 = p2) : c4 === p2 ? ">" === u3[0] ? (c4 = n6 ?? v, d3 = -1) : void 0 === u3[1] ? d3 = -2 : (d3 = c4.lastIndex - u3[2].length, a3 = u3[1], c4 = void 0 === u3[3] ? p2 : '"' === u3[3] ? $ : g) : c4 === $ || c4 === g ? c4 = p2 : c4 === _ || c4 === m ? c4 = v : (c4 = p2, n6 = void 0);
|
|
5392
|
+
const x2 = c4 === p2 && t4[i8 + 1].startsWith("/>") ? " " : "";
|
|
5393
|
+
l3 += c4 === v ? s5 + r3 : d3 >= 0 ? (e7.push(a3), s5.slice(0, d3) + h2 + s5.slice(d3) + o3 + x2) : s5 + o3 + (-2 === d3 ? i8 : x2);
|
|
4837
5394
|
}
|
|
4838
|
-
return [
|
|
5395
|
+
return [V(t4, l3 + (t4[s4] || "<?>") + (2 === i7 ? "</svg>" : 3 === i7 ? "</math>" : "")), e7];
|
|
4839
5396
|
};
|
|
4840
|
-
var
|
|
4841
|
-
constructor({ strings: t4, _$litType$:
|
|
5397
|
+
var S2 = class _S {
|
|
5398
|
+
constructor({ strings: t4, _$litType$: i7 }, e7) {
|
|
4842
5399
|
let r6;
|
|
4843
5400
|
this.parts = [];
|
|
4844
|
-
let
|
|
4845
|
-
const u3 = t4.length - 1, d3 = this.parts, [f3, v2] =
|
|
4846
|
-
if (this.el =
|
|
5401
|
+
let l3 = 0, a3 = 0;
|
|
5402
|
+
const u3 = t4.length - 1, d3 = this.parts, [f3, v2] = N(t4, i7);
|
|
5403
|
+
if (this.el = _S.createElement(f3, e7), P.currentNode = this.el.content, 2 === i7 || 3 === i7) {
|
|
4847
5404
|
const t5 = this.el.content.firstChild;
|
|
4848
5405
|
t5.replaceWith(...t5.childNodes);
|
|
4849
5406
|
}
|
|
4850
|
-
for (; null !== (r6 =
|
|
5407
|
+
for (; null !== (r6 = P.nextNode()) && d3.length < u3; ) {
|
|
4851
5408
|
if (1 === r6.nodeType) {
|
|
4852
|
-
if (r6.hasAttributes()) for (const t5 of r6.getAttributeNames()) if (t5.endsWith(
|
|
4853
|
-
const
|
|
4854
|
-
d3.push({ type: 1, index:
|
|
4855
|
-
} else t5.startsWith(
|
|
4856
|
-
if (
|
|
4857
|
-
const t5 = r6.textContent.split(
|
|
4858
|
-
if (
|
|
4859
|
-
r6.textContent =
|
|
4860
|
-
for (let
|
|
4861
|
-
r6.append(t5[
|
|
5409
|
+
if (r6.hasAttributes()) for (const t5 of r6.getAttributeNames()) if (t5.endsWith(h2)) {
|
|
5410
|
+
const i8 = v2[a3++], s4 = r6.getAttribute(t5).split(o3), e8 = /([.?@])?(.*)/.exec(i8);
|
|
5411
|
+
d3.push({ type: 1, index: l3, name: e8[2], strings: s4, ctor: "." === e8[1] ? I : "?" === e8[1] ? L : "@" === e8[1] ? z : H }), r6.removeAttribute(t5);
|
|
5412
|
+
} else t5.startsWith(o3) && (d3.push({ type: 6, index: l3 }), r6.removeAttribute(t5));
|
|
5413
|
+
if (y2.test(r6.tagName)) {
|
|
5414
|
+
const t5 = r6.textContent.split(o3), i8 = t5.length - 1;
|
|
5415
|
+
if (i8 > 0) {
|
|
5416
|
+
r6.textContent = s2 ? s2.emptyScript : "";
|
|
5417
|
+
for (let s4 = 0; s4 < i8; s4++) r6.append(t5[s4], c3()), P.nextNode(), d3.push({ type: 2, index: ++l3 });
|
|
5418
|
+
r6.append(t5[i8], c3());
|
|
4862
5419
|
}
|
|
4863
5420
|
}
|
|
4864
|
-
} else if (8 === r6.nodeType) if (r6.data ===
|
|
5421
|
+
} else if (8 === r6.nodeType) if (r6.data === n3) d3.push({ type: 2, index: l3 });
|
|
4865
5422
|
else {
|
|
4866
5423
|
let t5 = -1;
|
|
4867
|
-
for (; -1 !== (t5 = r6.data.indexOf(
|
|
5424
|
+
for (; -1 !== (t5 = r6.data.indexOf(o3, t5 + 1)); ) d3.push({ type: 7, index: l3 }), t5 += o3.length - 1;
|
|
4868
5425
|
}
|
|
4869
|
-
|
|
5426
|
+
l3++;
|
|
4870
5427
|
}
|
|
4871
5428
|
}
|
|
4872
5429
|
static createElement(t4, i7) {
|
|
4873
|
-
const s4 =
|
|
5430
|
+
const s4 = l2.createElement("template");
|
|
4874
5431
|
return s4.innerHTML = t4, s4;
|
|
4875
5432
|
}
|
|
4876
5433
|
};
|
|
4877
|
-
function
|
|
4878
|
-
if (i7 ===
|
|
5434
|
+
function M(t4, i7, s4 = t4, e7) {
|
|
5435
|
+
if (i7 === E) return i7;
|
|
4879
5436
|
let h3 = void 0 !== e7 ? s4._$Co?.[e7] : s4._$Cl;
|
|
4880
|
-
const o7 =
|
|
4881
|
-
return h3?.constructor !== o7 && (h3?._$AO?.(false), void 0 === o7 ? h3 = void 0 : (h3 = new o7(t4), h3._$AT(t4, s4, e7)), void 0 !== e7 ? (s4._$Co ??= [])[e7] = h3 : s4._$Cl = h3), void 0 !== h3 && (i7 =
|
|
5437
|
+
const o7 = a2(i7) ? void 0 : i7._$litDirective$;
|
|
5438
|
+
return h3?.constructor !== o7 && (h3?._$AO?.(false), void 0 === o7 ? h3 = void 0 : (h3 = new o7(t4), h3._$AT(t4, s4, e7)), void 0 !== e7 ? (s4._$Co ??= [])[e7] = h3 : s4._$Cl = h3), void 0 !== h3 && (i7 = M(t4, h3._$AS(t4, i7.values), h3, e7)), i7;
|
|
4882
5439
|
}
|
|
4883
|
-
var
|
|
5440
|
+
var R = class {
|
|
4884
5441
|
constructor(t4, i7) {
|
|
4885
5442
|
this._$AV = [], this._$AN = void 0, this._$AD = t4, this._$AM = i7;
|
|
4886
5443
|
}
|
|
@@ -4891,29 +5448,29 @@ var M = class {
|
|
|
4891
5448
|
return this._$AM._$AU;
|
|
4892
5449
|
}
|
|
4893
5450
|
u(t4) {
|
|
4894
|
-
const { el: { content: i7 }, parts: s4 } = this._$AD, e7 = (t4?.creationScope ??
|
|
4895
|
-
|
|
4896
|
-
let h3 =
|
|
4897
|
-
for (; void 0 !==
|
|
4898
|
-
if (o7 ===
|
|
5451
|
+
const { el: { content: i7 }, parts: s4 } = this._$AD, e7 = (t4?.creationScope ?? l2).importNode(i7, true);
|
|
5452
|
+
P.currentNode = e7;
|
|
5453
|
+
let h3 = P.nextNode(), o7 = 0, n6 = 0, r6 = s4[0];
|
|
5454
|
+
for (; void 0 !== r6; ) {
|
|
5455
|
+
if (o7 === r6.index) {
|
|
4899
5456
|
let i8;
|
|
4900
|
-
2 ===
|
|
5457
|
+
2 === r6.type ? i8 = new k(h3, h3.nextSibling, this, t4) : 1 === r6.type ? i8 = new r6.ctor(h3, r6.name, r6.strings, this, t4) : 6 === r6.type && (i8 = new Z(h3, this, t4)), this._$AV.push(i8), r6 = s4[++n6];
|
|
4901
5458
|
}
|
|
4902
|
-
o7 !==
|
|
5459
|
+
o7 !== r6?.index && (h3 = P.nextNode(), o7++);
|
|
4903
5460
|
}
|
|
4904
|
-
return
|
|
5461
|
+
return P.currentNode = l2, e7;
|
|
4905
5462
|
}
|
|
4906
5463
|
p(t4) {
|
|
4907
5464
|
let i7 = 0;
|
|
4908
5465
|
for (const s4 of this._$AV) void 0 !== s4 && (void 0 !== s4.strings ? (s4._$AI(t4, s4, i7), i7 += s4.strings.length - 2) : s4._$AI(t4[i7])), i7++;
|
|
4909
5466
|
}
|
|
4910
5467
|
};
|
|
4911
|
-
var
|
|
5468
|
+
var k = class _k {
|
|
4912
5469
|
get _$AU() {
|
|
4913
5470
|
return this._$AM?._$AU ?? this._$Cv;
|
|
4914
5471
|
}
|
|
4915
5472
|
constructor(t4, i7, s4, e7) {
|
|
4916
|
-
this.type = 2, this._$AH =
|
|
5473
|
+
this.type = 2, this._$AH = A, this._$AN = void 0, this._$AA = t4, this._$AB = i7, this._$AM = s4, this.options = e7, this._$Cv = e7?.isConnected ?? true;
|
|
4917
5474
|
}
|
|
4918
5475
|
get parentNode() {
|
|
4919
5476
|
let t4 = this._$AA.parentNode;
|
|
@@ -4927,7 +5484,7 @@ var R = class _R {
|
|
|
4927
5484
|
return this._$AB;
|
|
4928
5485
|
}
|
|
4929
5486
|
_$AI(t4, i7 = this) {
|
|
4930
|
-
t4 =
|
|
5487
|
+
t4 = M(this, t4, i7), a2(t4) ? t4 === A || null == t4 || "" === t4 ? (this._$AH !== A && this._$AR(), this._$AH = A) : t4 !== this._$AH && t4 !== E && this._(t4) : void 0 !== t4._$litType$ ? this.$(t4) : void 0 !== t4.nodeType ? this.T(t4) : d2(t4) ? this.k(t4) : this._(t4);
|
|
4931
5488
|
}
|
|
4932
5489
|
O(t4) {
|
|
4933
5490
|
return this._$AA.parentNode.insertBefore(t4, this._$AB);
|
|
@@ -4936,38 +5493,38 @@ var R = class _R {
|
|
|
4936
5493
|
this._$AH !== t4 && (this._$AR(), this._$AH = this.O(t4));
|
|
4937
5494
|
}
|
|
4938
5495
|
_(t4) {
|
|
4939
|
-
this._$AH !==
|
|
5496
|
+
this._$AH !== A && a2(this._$AH) ? this._$AA.nextSibling.data = t4 : this.T(l2.createTextNode(t4)), this._$AH = t4;
|
|
4940
5497
|
}
|
|
4941
5498
|
$(t4) {
|
|
4942
|
-
const { values: i7, _$litType$: s4 } = t4, e7 = "number" == typeof s4 ? this._$AC(t4) : (void 0 === s4.el && (s4.el =
|
|
5499
|
+
const { values: i7, _$litType$: s4 } = t4, e7 = "number" == typeof s4 ? this._$AC(t4) : (void 0 === s4.el && (s4.el = S2.createElement(V(s4.h, s4.h[0]), this.options)), s4);
|
|
4943
5500
|
if (this._$AH?._$AD === e7) this._$AH.p(i7);
|
|
4944
5501
|
else {
|
|
4945
|
-
const t5 = new
|
|
5502
|
+
const t5 = new R(e7, this), s5 = t5.u(this.options);
|
|
4946
5503
|
t5.p(i7), this.T(s5), this._$AH = t5;
|
|
4947
5504
|
}
|
|
4948
5505
|
}
|
|
4949
5506
|
_$AC(t4) {
|
|
4950
|
-
let i7 =
|
|
4951
|
-
return void 0 === i7 &&
|
|
5507
|
+
let i7 = C.get(t4.strings);
|
|
5508
|
+
return void 0 === i7 && C.set(t4.strings, i7 = new S2(t4)), i7;
|
|
4952
5509
|
}
|
|
4953
5510
|
k(t4) {
|
|
4954
|
-
|
|
5511
|
+
u2(this._$AH) || (this._$AH = [], this._$AR());
|
|
4955
5512
|
const i7 = this._$AH;
|
|
4956
5513
|
let s4, e7 = 0;
|
|
4957
|
-
for (const h3 of t4) e7 === i7.length ? i7.push(s4 = new
|
|
5514
|
+
for (const h3 of t4) e7 === i7.length ? i7.push(s4 = new _k(this.O(c3()), this.O(c3()), this, this.options)) : s4 = i7[e7], s4._$AI(h3), e7++;
|
|
4958
5515
|
e7 < i7.length && (this._$AR(s4 && s4._$AB.nextSibling, e7), i7.length = e7);
|
|
4959
5516
|
}
|
|
4960
|
-
_$AR(t4 = this._$AA.nextSibling,
|
|
4961
|
-
for (this._$AP?.(false, true,
|
|
4962
|
-
const
|
|
4963
|
-
t4.remove(), t4 =
|
|
5517
|
+
_$AR(t4 = this._$AA.nextSibling, s4) {
|
|
5518
|
+
for (this._$AP?.(false, true, s4); t4 !== this._$AB; ) {
|
|
5519
|
+
const s5 = i3(t4).nextSibling;
|
|
5520
|
+
i3(t4).remove(), t4 = s5;
|
|
4964
5521
|
}
|
|
4965
5522
|
}
|
|
4966
5523
|
setConnected(t4) {
|
|
4967
5524
|
void 0 === this._$AM && (this._$Cv = t4, this._$AP?.(t4));
|
|
4968
5525
|
}
|
|
4969
5526
|
};
|
|
4970
|
-
var
|
|
5527
|
+
var H = class {
|
|
4971
5528
|
get tagName() {
|
|
4972
5529
|
return this.element.tagName;
|
|
4973
5530
|
}
|
|
@@ -4975,53 +5532,53 @@ var k = class {
|
|
|
4975
5532
|
return this._$AM._$AU;
|
|
4976
5533
|
}
|
|
4977
5534
|
constructor(t4, i7, s4, e7, h3) {
|
|
4978
|
-
this.type = 1, this._$AH =
|
|
5535
|
+
this.type = 1, this._$AH = A, this._$AN = void 0, this.element = t4, this.name = i7, this._$AM = e7, this.options = h3, s4.length > 2 || "" !== s4[0] || "" !== s4[1] ? (this._$AH = Array(s4.length - 1).fill(new String()), this.strings = s4) : this._$AH = A;
|
|
4979
5536
|
}
|
|
4980
5537
|
_$AI(t4, i7 = this, s4, e7) {
|
|
4981
5538
|
const h3 = this.strings;
|
|
4982
5539
|
let o7 = false;
|
|
4983
|
-
if (void 0 === h3) t4 =
|
|
5540
|
+
if (void 0 === h3) t4 = M(this, t4, i7, 0), o7 = !a2(t4) || t4 !== this._$AH && t4 !== E, o7 && (this._$AH = t4);
|
|
4984
5541
|
else {
|
|
4985
5542
|
const e8 = t4;
|
|
4986
5543
|
let n6, r6;
|
|
4987
|
-
for (t4 = h3[0], n6 = 0; n6 < h3.length - 1; n6++) r6 =
|
|
5544
|
+
for (t4 = h3[0], n6 = 0; n6 < h3.length - 1; n6++) r6 = M(this, e8[s4 + n6], i7, n6), r6 === E && (r6 = this._$AH[n6]), o7 ||= !a2(r6) || r6 !== this._$AH[n6], r6 === A ? t4 = A : t4 !== A && (t4 += (r6 ?? "") + h3[n6 + 1]), this._$AH[n6] = r6;
|
|
4988
5545
|
}
|
|
4989
5546
|
o7 && !e7 && this.j(t4);
|
|
4990
5547
|
}
|
|
4991
5548
|
j(t4) {
|
|
4992
|
-
t4 ===
|
|
5549
|
+
t4 === A ? this.element.removeAttribute(this.name) : this.element.setAttribute(this.name, t4 ?? "");
|
|
4993
5550
|
}
|
|
4994
5551
|
};
|
|
4995
|
-
var
|
|
5552
|
+
var I = class extends H {
|
|
4996
5553
|
constructor() {
|
|
4997
5554
|
super(...arguments), this.type = 3;
|
|
4998
5555
|
}
|
|
4999
5556
|
j(t4) {
|
|
5000
|
-
this.element[this.name] = t4 ===
|
|
5557
|
+
this.element[this.name] = t4 === A ? void 0 : t4;
|
|
5001
5558
|
}
|
|
5002
5559
|
};
|
|
5003
|
-
var
|
|
5560
|
+
var L = class extends H {
|
|
5004
5561
|
constructor() {
|
|
5005
5562
|
super(...arguments), this.type = 4;
|
|
5006
5563
|
}
|
|
5007
5564
|
j(t4) {
|
|
5008
|
-
this.element.toggleAttribute(this.name, !!t4 && t4 !==
|
|
5565
|
+
this.element.toggleAttribute(this.name, !!t4 && t4 !== A);
|
|
5009
5566
|
}
|
|
5010
5567
|
};
|
|
5011
|
-
var
|
|
5568
|
+
var z = class extends H {
|
|
5012
5569
|
constructor(t4, i7, s4, e7, h3) {
|
|
5013
5570
|
super(t4, i7, s4, e7, h3), this.type = 5;
|
|
5014
5571
|
}
|
|
5015
5572
|
_$AI(t4, i7 = this) {
|
|
5016
|
-
if ((t4 =
|
|
5017
|
-
const s4 = this._$AH, e7 = t4 ===
|
|
5573
|
+
if ((t4 = M(this, t4, i7, 0) ?? A) === E) return;
|
|
5574
|
+
const s4 = this._$AH, e7 = t4 === A && s4 !== A || t4.capture !== s4.capture || t4.once !== s4.once || t4.passive !== s4.passive, h3 = t4 !== A && (s4 === A || e7);
|
|
5018
5575
|
e7 && this.element.removeEventListener(this.name, this, s4), h3 && this.element.addEventListener(this.name, this, t4), this._$AH = t4;
|
|
5019
5576
|
}
|
|
5020
5577
|
handleEvent(t4) {
|
|
5021
5578
|
"function" == typeof this._$AH ? this._$AH.call(this.options?.host ?? this.element, t4) : this._$AH.handleEvent(t4);
|
|
5022
5579
|
}
|
|
5023
5580
|
};
|
|
5024
|
-
var
|
|
5581
|
+
var Z = class {
|
|
5025
5582
|
constructor(t4, i7, s4) {
|
|
5026
5583
|
this.element = t4, this.type = 6, this._$AN = void 0, this._$AM = i7, this.options = s4;
|
|
5027
5584
|
}
|
|
@@ -5029,17 +5586,17 @@ var z = class {
|
|
|
5029
5586
|
return this._$AM._$AU;
|
|
5030
5587
|
}
|
|
5031
5588
|
_$AI(t4) {
|
|
5032
|
-
|
|
5589
|
+
M(this, t4);
|
|
5033
5590
|
}
|
|
5034
5591
|
};
|
|
5035
|
-
var
|
|
5036
|
-
|
|
5037
|
-
var
|
|
5592
|
+
var B = t2.litHtmlPolyfillSupport;
|
|
5593
|
+
B?.(S2, k), (t2.litHtmlVersions ??= []).push("3.3.2");
|
|
5594
|
+
var D = (t4, i7, s4) => {
|
|
5038
5595
|
const e7 = s4?.renderBefore ?? i7;
|
|
5039
5596
|
let h3 = e7._$litPart$;
|
|
5040
5597
|
if (void 0 === h3) {
|
|
5041
5598
|
const t5 = s4?.renderBefore ?? null;
|
|
5042
|
-
e7._$litPart$ = h3 = new
|
|
5599
|
+
e7._$litPart$ = h3 = new k(i7.insertBefore(c3(), t5), t5, void 0, s4 ?? {});
|
|
5043
5600
|
}
|
|
5044
5601
|
return h3._$AI(t4), h3;
|
|
5045
5602
|
};
|
|
@@ -5056,7 +5613,7 @@ var i4 = class extends y {
|
|
|
5056
5613
|
}
|
|
5057
5614
|
update(t4) {
|
|
5058
5615
|
const r6 = this.render();
|
|
5059
|
-
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t4), this._$Do =
|
|
5616
|
+
this.hasUpdated || (this.renderOptions.isConnected = this.isConnected), super.update(t4), this._$Do = D(r6, this.renderRoot, this.renderOptions);
|
|
5060
5617
|
}
|
|
5061
5618
|
connectedCallback() {
|
|
5062
5619
|
super.connectedCallback(), this._$Do?.setConnected(true);
|
|
@@ -5065,7 +5622,7 @@ var i4 = class extends y {
|
|
|
5065
5622
|
super.disconnectedCallback(), this._$Do?.setConnected(false);
|
|
5066
5623
|
}
|
|
5067
5624
|
render() {
|
|
5068
|
-
return
|
|
5625
|
+
return E;
|
|
5069
5626
|
}
|
|
5070
5627
|
};
|
|
5071
5628
|
i4._$litElement$ = true, i4["finalized"] = true, s3.litElementHydrateSupport?.({ LitElement: i4 });
|
|
@@ -5163,10 +5720,10 @@ var o6 = e6(class extends i5 {
|
|
|
5163
5720
|
if (super(t4), t4.type !== t3.ATTRIBUTE || "style" !== t4.name || t4.strings?.length > 2) throw Error("The `styleMap` directive must be used in the `style` attribute and must be the only part in the attribute.");
|
|
5164
5721
|
}
|
|
5165
5722
|
render(t4) {
|
|
5166
|
-
return Object.keys(t4).reduce((
|
|
5723
|
+
return Object.keys(t4).reduce((e7, r6) => {
|
|
5167
5724
|
const s4 = t4[r6];
|
|
5168
5725
|
return null == s4 ? e7 : e7 + `${r6 = r6.includes("-") ? r6 : r6.replace(/(?:^(webkit|moz|ms|o)|)(?=[A-Z])/g, "-$&").toLowerCase()}:${s4};`;
|
|
5169
|
-
}
|
|
5726
|
+
}, "");
|
|
5170
5727
|
}
|
|
5171
5728
|
update(e7, [r6]) {
|
|
5172
5729
|
const { style: s4 } = e7.element;
|
|
@@ -5180,12 +5737,12 @@ var o6 = e6(class extends i5 {
|
|
|
5180
5737
|
t4.includes("-") || r7 ? s4.setProperty(t4, r7 ? e8.slice(0, -11) : e8, r7 ? n5 : "") : s4[t4] = e8;
|
|
5181
5738
|
}
|
|
5182
5739
|
}
|
|
5183
|
-
return
|
|
5740
|
+
return E;
|
|
5184
5741
|
}
|
|
5185
5742
|
});
|
|
5186
5743
|
|
|
5187
5744
|
// libs/embed-libs/embed/package.json
|
|
5188
|
-
var version = "6.13.
|
|
5745
|
+
var version = "6.13.2";
|
|
5189
5746
|
|
|
5190
5747
|
// libs/embed-libs/embed/src/lib/luzmo-service.ts
|
|
5191
5748
|
var LuzmoDashboardService = class {
|
|
@@ -5599,22 +6156,25 @@ var LuzmoDashboard = class extends i4 {
|
|
|
5599
6156
|
loadLibrary(this.params.appServer, dashboardRemote).then(async () => {
|
|
5600
6157
|
this.isLibraryLoaded = true;
|
|
5601
6158
|
await this.updateComplete;
|
|
5602
|
-
const
|
|
5603
|
-
this.
|
|
5604
|
-
|
|
5605
|
-
|
|
5606
|
-
this.containerWidth = this.dashboardReference.offsetWidth;
|
|
6159
|
+
const el = document.createElement("dashboard-component");
|
|
6160
|
+
this.setAllAttributesOnElement(el);
|
|
6161
|
+
el.addEventListener("load", (payload) => {
|
|
6162
|
+
this.containerWidth = el.offsetWidth;
|
|
5607
6163
|
this.dimensions = payload.detail.dimensions;
|
|
5608
6164
|
_setCalculatedDimensions(this);
|
|
5609
6165
|
window.dispatchEvent(new Event("resize"));
|
|
5610
6166
|
this.dispatchEvent(new CustomEvent("load", payload));
|
|
5611
6167
|
});
|
|
5612
|
-
|
|
5613
|
-
|
|
5614
|
-
|
|
5615
|
-
|
|
5616
|
-
|
|
5617
|
-
this.
|
|
6168
|
+
el.addEventListener("itemsRendered", (payload) => this.dispatchEvent(new CustomEvent("itemsRendered", payload)));
|
|
6169
|
+
el.addEventListener("customEvent", (payload) => this.dispatchEvent(new CustomEvent("customEvent", payload)));
|
|
6170
|
+
el.addEventListener("changedFilters", (payload) => this.dispatchEvent(new CustomEvent("changedFilters", payload)));
|
|
6171
|
+
el.addEventListener("dashboardAction", (payload) => this.dispatchEvent(new CustomEvent("dashboardAction", payload)));
|
|
6172
|
+
el.addEventListener("export", (payload) => this.dispatchEvent(new CustomEvent("exported", payload)));
|
|
6173
|
+
const container = this.renderRoot.querySelector("#dashboard-wc-container");
|
|
6174
|
+
if (container) {
|
|
6175
|
+
container.append(el);
|
|
6176
|
+
this.dashboardReference = el;
|
|
6177
|
+
}
|
|
5618
6178
|
});
|
|
5619
6179
|
} else {
|
|
5620
6180
|
this.containerWidth = this.container?.clientWidth;
|
|
@@ -5632,24 +6192,36 @@ var LuzmoDashboard = class extends i4 {
|
|
|
5632
6192
|
}
|
|
5633
6193
|
setAllAttributes() {
|
|
5634
6194
|
if (this.dashboardReference) {
|
|
5635
|
-
|
|
5636
|
-
|
|
5637
|
-
|
|
5638
|
-
|
|
5639
|
-
|
|
5640
|
-
|
|
5641
|
-
|
|
5642
|
-
|
|
5643
|
-
|
|
5644
|
-
|
|
5645
|
-
|
|
5646
|
-
|
|
5647
|
-
|
|
5648
|
-
|
|
5649
|
-
|
|
5650
|
-
|
|
6195
|
+
this.setAllAttributesOnElement(this.dashboardReference);
|
|
6196
|
+
}
|
|
6197
|
+
}
|
|
6198
|
+
setAllAttributesOnElement(el) {
|
|
6199
|
+
if (!el) {
|
|
6200
|
+
return;
|
|
6201
|
+
}
|
|
6202
|
+
if (this.params.dashboardId) {
|
|
6203
|
+
el.setAttribute("dashboard-id", this.params.dashboardId);
|
|
6204
|
+
}
|
|
6205
|
+
if (this.params.appServer) {
|
|
6206
|
+
el.setAttribute("app-server", this.params.appServer);
|
|
6207
|
+
}
|
|
6208
|
+
if (this.params.apiHost) {
|
|
6209
|
+
el.setAttribute("api-host", removeTrailingSlash(this.params.apiHost));
|
|
6210
|
+
}
|
|
6211
|
+
for (const key in this.attributesMap) {
|
|
6212
|
+
if (!["authKey", "authToken", "apiHost", "itemDimensions", "dashboardId", "appServer"].includes(key) && this.params[key]) {
|
|
6213
|
+
el.setAttribute(this.attributesMap[key], this.params[key]);
|
|
5651
6214
|
}
|
|
5652
6215
|
}
|
|
6216
|
+
if (this.params.itemDimensions) {
|
|
6217
|
+
el.setAttribute("item-dimensions", JSON.stringify(this.params.itemDimensions));
|
|
6218
|
+
}
|
|
6219
|
+
if (this.params.key) {
|
|
6220
|
+
el.setAttribute("auth-key", this.params.key);
|
|
6221
|
+
}
|
|
6222
|
+
if (this.params.token) {
|
|
6223
|
+
el.setAttribute("auth-token", this.params.token);
|
|
6224
|
+
}
|
|
5653
6225
|
}
|
|
5654
6226
|
// Reload dashboard when triggerproperty changes
|
|
5655
6227
|
updated(changedProperties) {
|
|
@@ -5849,7 +6421,7 @@ var LuzmoDashboard = class extends i4 {
|
|
|
5849
6421
|
}
|
|
5850
6422
|
render() {
|
|
5851
6423
|
let toBeRenderedHTML;
|
|
5852
|
-
const loader =
|
|
6424
|
+
const loader = b2`
|
|
5853
6425
|
<div
|
|
5854
6426
|
class="luzmo-container-loader"
|
|
5855
6427
|
id="luzmo-container-loader-${this._containerId}"
|
|
@@ -5872,7 +6444,7 @@ var LuzmoDashboard = class extends i4 {
|
|
|
5872
6444
|
this._loadingCircleStyle
|
|
5873
6445
|
)}
|
|
5874
6446
|
></div>
|
|
5875
|
-
${this._itemEmbedding ? "" :
|
|
6447
|
+
${this._itemEmbedding ? "" : b2`
|
|
5876
6448
|
<div
|
|
5877
6449
|
class="luzmo-loading-message"
|
|
5878
6450
|
style=${o6({ color: this.loaderFontColor })}
|
|
@@ -5885,19 +6457,18 @@ var LuzmoDashboard = class extends i4 {
|
|
|
5885
6457
|
</div>
|
|
5886
6458
|
`;
|
|
5887
6459
|
if (this.isWebComponentViewMode()) {
|
|
5888
|
-
toBeRenderedHTML = this.isLibraryLoaded ?
|
|
5889
|
-
${this.dashboardId || this.dashboardSlug ?
|
|
5890
|
-
<
|
|
5891
|
-
|
|
5892
|
-
` : x`
|
|
6460
|
+
toBeRenderedHTML = this.isLibraryLoaded ? b2`
|
|
6461
|
+
${this.dashboardId || this.dashboardSlug ? b2`
|
|
6462
|
+
<div id="dashboard-wc-container"></div>
|
|
6463
|
+
` : b2`
|
|
5893
6464
|
<div id="luzmo-error-${this._containerId}">
|
|
5894
6465
|
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
5895
6466
|
</div>
|
|
5896
6467
|
`}
|
|
5897
|
-
` :
|
|
6468
|
+
` : b2`${loader}`;
|
|
5898
6469
|
} else {
|
|
5899
|
-
toBeRenderedHTML =
|
|
5900
|
-
${this.dashboardId || this.dashboardSlug ?
|
|
6470
|
+
toBeRenderedHTML = b2`
|
|
6471
|
+
${this.dashboardId || this.dashboardSlug ? b2`
|
|
5901
6472
|
${loader}
|
|
5902
6473
|
<iframe
|
|
5903
6474
|
class="luzmo-embed-dashboard ${this.isWebComponentViewMode() ? "" : `luzmo-embed-dashboard-ede`}"
|
|
@@ -5907,15 +6478,15 @@ var LuzmoDashboard = class extends i4 {
|
|
|
5907
6478
|
src="${this._iframeUrl}"
|
|
5908
6479
|
frameborder="0"
|
|
5909
6480
|
></iframe>
|
|
5910
|
-
` :
|
|
5911
|
-
${this.browserError ?
|
|
6481
|
+
` : b2`<!-- the dashboard will inititialize when you provide a dashboardSlug or a dashboardId -->`}
|
|
6482
|
+
${this.browserError ? b2`
|
|
5912
6483
|
<div id="luzmo-error-${this._containerId}">
|
|
5913
6484
|
<h3 class="luzmo-error">${this.browserErrorMsg}</h3>
|
|
5914
6485
|
</div>
|
|
5915
6486
|
` : ""}
|
|
5916
6487
|
`;
|
|
5917
6488
|
}
|
|
5918
|
-
return
|
|
6489
|
+
return b2`
|
|
5919
6490
|
<div class="${luzmoEmbedContainerClass} ${this.isWebComponentViewMode() ? "" : `${luzmoEmbedContainerClass}-ede`}">
|
|
5920
6491
|
<div
|
|
5921
6492
|
class="dashboard-container"
|
|
@@ -6225,7 +6796,7 @@ if (!customElements.get("luzmo-embed-dashboard")) {
|
|
|
6225
6796
|
}
|
|
6226
6797
|
|
|
6227
6798
|
// libs/dashboard-contents-types/src/lib/shared/version.ts
|
|
6228
|
-
var CONTENTS_VERSION = "0.1.
|
|
6799
|
+
var CONTENTS_VERSION = "0.1.100";
|
|
6229
6800
|
|
|
6230
6801
|
// libs/embed-libs/embed/src/lib/viz-item/viz-item.base.ts
|
|
6231
6802
|
var dashboardContentsVersion = CONTENTS_VERSION;
|
|
@@ -6241,22 +6812,6 @@ var LuzmoBaseVizItem = class extends i4 {
|
|
|
6241
6812
|
this.libVersion = version + "-wc-luzmo";
|
|
6242
6813
|
this.postInitCallQueue = [];
|
|
6243
6814
|
}
|
|
6244
|
-
static {
|
|
6245
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
6246
|
-
this.styles = i`
|
|
6247
|
-
:host {
|
|
6248
|
-
display: block;
|
|
6249
|
-
width: 100%;
|
|
6250
|
-
height: 100%;
|
|
6251
|
-
}
|
|
6252
|
-
|
|
6253
|
-
luzmo-embed-viz-item {
|
|
6254
|
-
width: 100%;
|
|
6255
|
-
height: 1000%;
|
|
6256
|
-
display: block;
|
|
6257
|
-
}
|
|
6258
|
-
`;
|
|
6259
|
-
}
|
|
6260
6815
|
createRenderRoot() {
|
|
6261
6816
|
if (!this.style.display) {
|
|
6262
6817
|
this.style.display = "block";
|
|
@@ -6364,9 +6919,23 @@ var LuzmoBaseVizItem = class extends i4 {
|
|
|
6364
6919
|
}
|
|
6365
6920
|
}
|
|
6366
6921
|
render() {
|
|
6367
|
-
return
|
|
6922
|
+
return b2` `;
|
|
6368
6923
|
}
|
|
6369
6924
|
};
|
|
6925
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
6926
|
+
LuzmoBaseVizItem.styles = i`
|
|
6927
|
+
:host {
|
|
6928
|
+
display: block;
|
|
6929
|
+
width: 100%;
|
|
6930
|
+
height: 100%;
|
|
6931
|
+
}
|
|
6932
|
+
|
|
6933
|
+
luzmo-embed-viz-item {
|
|
6934
|
+
width: 100%;
|
|
6935
|
+
height: 1000%;
|
|
6936
|
+
display: block;
|
|
6937
|
+
}
|
|
6938
|
+
`;
|
|
6370
6939
|
__decorateClass([
|
|
6371
6940
|
n4()
|
|
6372
6941
|
], LuzmoBaseVizItem.prototype, "appServer", 2);
|
|
@@ -6457,16 +7026,6 @@ var LuzmoIQEmbedChatComponent = class extends i4 {
|
|
|
6457
7026
|
this.remoteEntryServer = "http://localhost:4202/";
|
|
6458
7027
|
this.aydHost = "https://ayd.luzmo.com/";
|
|
6459
7028
|
}
|
|
6460
|
-
static {
|
|
6461
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
6462
|
-
this.styles = i`
|
|
6463
|
-
:host {
|
|
6464
|
-
display: block;
|
|
6465
|
-
width: 100%;
|
|
6466
|
-
height: 100%;
|
|
6467
|
-
}
|
|
6468
|
-
`;
|
|
6469
|
-
}
|
|
6470
7029
|
createRenderRoot() {
|
|
6471
7030
|
return this;
|
|
6472
7031
|
}
|
|
@@ -6513,7 +7072,7 @@ var LuzmoIQEmbedChatComponent = class extends i4 {
|
|
|
6513
7072
|
}
|
|
6514
7073
|
}
|
|
6515
7074
|
render() {
|
|
6516
|
-
return
|
|
7075
|
+
return b2``;
|
|
6517
7076
|
}
|
|
6518
7077
|
connectedCallback() {
|
|
6519
7078
|
super.connectedCallback();
|
|
@@ -6535,6 +7094,14 @@ var LuzmoIQEmbedChatComponent = class extends i4 {
|
|
|
6535
7094
|
observer.observe(embedChat, { childList: true, subtree: true });
|
|
6536
7095
|
}
|
|
6537
7096
|
};
|
|
7097
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
7098
|
+
LuzmoIQEmbedChatComponent.styles = i`
|
|
7099
|
+
:host {
|
|
7100
|
+
display: block;
|
|
7101
|
+
width: 100%;
|
|
7102
|
+
height: 100%;
|
|
7103
|
+
}
|
|
7104
|
+
`;
|
|
6538
7105
|
__decorateClass([
|
|
6539
7106
|
n4()
|
|
6540
7107
|
], LuzmoIQEmbedChatComponent.prototype, "appServer", 2);
|
|
@@ -6597,16 +7164,6 @@ var LuzmoIQEmbedAnswerComponent = class extends i4 {
|
|
|
6597
7164
|
this.libVersion = version + "-wc-luzmo";
|
|
6598
7165
|
this.remoteEntryServer = "http://localhost:4202";
|
|
6599
7166
|
}
|
|
6600
|
-
static {
|
|
6601
|
-
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
6602
|
-
this.styles = i`
|
|
6603
|
-
:host {
|
|
6604
|
-
display: block;
|
|
6605
|
-
width: 100%;
|
|
6606
|
-
height: 100%;
|
|
6607
|
-
}
|
|
6608
|
-
`;
|
|
6609
|
-
}
|
|
6610
7167
|
createRenderRoot() {
|
|
6611
7168
|
return this;
|
|
6612
7169
|
}
|
|
@@ -6654,9 +7211,17 @@ var LuzmoIQEmbedAnswerComponent = class extends i4 {
|
|
|
6654
7211
|
}
|
|
6655
7212
|
}
|
|
6656
7213
|
render() {
|
|
6657
|
-
return
|
|
7214
|
+
return b2` `;
|
|
6658
7215
|
}
|
|
6659
7216
|
};
|
|
7217
|
+
// Static styles to set host display to block, else it is not shown at all for some reason.
|
|
7218
|
+
LuzmoIQEmbedAnswerComponent.styles = i`
|
|
7219
|
+
:host {
|
|
7220
|
+
display: block;
|
|
7221
|
+
width: 100%;
|
|
7222
|
+
height: 100%;
|
|
7223
|
+
}
|
|
7224
|
+
`;
|
|
6660
7225
|
__decorateClass([
|
|
6661
7226
|
n4()
|
|
6662
7227
|
], LuzmoIQEmbedAnswerComponent.prototype, "appServer", 2);
|