@module-federation/runtime 0.0.0-next-20240117121934 → 0.0.0-next-20240119085716
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers.esm.js +1 -1
- package/dist/index.cjs.js +88 -23
- package/dist/index.esm.js +90 -26
- package/dist/package.json +1 -1
- package/dist/share.cjs.js +23 -39
- package/dist/share.esm.js +24 -40
- package/dist/src/global.d.ts +15 -4
- package/dist/src/index.d.ts +1 -0
- package/dist/src/type/config.d.ts +2 -2
- package/dist/src/utils/index.d.ts +1 -0
- package/package.json +2 -2
package/dist/helpers.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { l as getRegisteredShare,
|
|
1
|
+
import { l as getRegisteredShare, t as getGlobalShareScope, G as Global, F as nativeGlobal, H as resetFederationGlobalInfo, A as getGlobalFederationInstance, C as setGlobalFederationInstance, B as getGlobalFederationConstructor, z as setGlobalFederationConstructor, m as getInfoWithoutType, r as getGlobalSnapshot, I as getTargetSnapshotInfoByModuleInfo, p as getGlobalSnapshotInfoByModuleInfo, q as setGlobalSnapshotInfoByModuleInfo, J as addGlobalSnapshot, b as getRemoteEntryExports, E as registerGlobalPlugins, g as getGlobalHostPlugins, n as getPreloaded, o as setPreloaded } from './share.esm.js';
|
|
2
2
|
|
|
3
3
|
const ShareUtils = {
|
|
4
4
|
getRegisteredShare,
|
package/dist/index.cjs.js
CHANGED
|
@@ -674,9 +674,9 @@ function splitId(id) {
|
|
|
674
674
|
}
|
|
675
675
|
}
|
|
676
676
|
// Traverse all nodes in moduleInfo and traverse the entire snapshot
|
|
677
|
-
function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo = {}, remoteSnapshot) {
|
|
677
|
+
function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo = {}, remoteSnapshot, getModuleInfoHook) {
|
|
678
678
|
const id = share.getFMId(remoteInfo);
|
|
679
|
-
const { value: snapshotValue } = share.getInfoWithoutType(globalSnapshot, id);
|
|
679
|
+
const { value: snapshotValue } = share.getInfoWithoutType(globalSnapshot, id, getModuleInfoHook);
|
|
680
680
|
const effectiveRemoteSnapshot = remoteSnapshot || snapshotValue;
|
|
681
681
|
if (effectiveRemoteSnapshot && !sdk.isManifestProvider(effectiveRemoteSnapshot)) {
|
|
682
682
|
traverse(effectiveRemoteSnapshot, remoteInfo, isRoot);
|
|
@@ -692,7 +692,7 @@ function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo =
|
|
|
692
692
|
traverseModuleInfo(globalSnapshot, {
|
|
693
693
|
name: subRemoteInfo.name,
|
|
694
694
|
version: remoteValue.matchedVersion
|
|
695
|
-
}, traverse, false, memo, undefined);
|
|
695
|
+
}, traverse, false, memo, undefined, getModuleInfoHook);
|
|
696
696
|
}
|
|
697
697
|
}
|
|
698
698
|
}
|
|
@@ -792,7 +792,16 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
|
|
|
792
792
|
share.setPreloaded(exposeFullPath);
|
|
793
793
|
}
|
|
794
794
|
}
|
|
795
|
-
}, true, memo, remoteSnapshot)
|
|
795
|
+
}, true, memo, remoteSnapshot, (target, key)=>{
|
|
796
|
+
const res = origin.loaderHook.lifecycle.getModuleInfo.emit({
|
|
797
|
+
target,
|
|
798
|
+
key
|
|
799
|
+
});
|
|
800
|
+
if (res && !(res instanceof Promise)) {
|
|
801
|
+
return res;
|
|
802
|
+
}
|
|
803
|
+
return;
|
|
804
|
+
});
|
|
796
805
|
if (remoteSnapshot.shared) {
|
|
797
806
|
remoteSnapshot.shared.forEach((shared)=>{
|
|
798
807
|
var _options_shared;
|
|
@@ -885,27 +894,37 @@ class SnapshotHandler {
|
|
|
885
894
|
// eslint-disable-next-line max-lines-per-function
|
|
886
895
|
async loadRemoteSnapshotInfo(moduleInfo) {
|
|
887
896
|
const { options } = this.HostInstance;
|
|
897
|
+
const hostSnapshot = share.getGlobalSnapshotInfoByModuleInfo({
|
|
898
|
+
name: this.HostInstance.options.name,
|
|
899
|
+
version: this.HostInstance.options.version
|
|
900
|
+
}, {
|
|
901
|
+
getModuleInfoHook: (target, key)=>{
|
|
902
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
903
|
+
target,
|
|
904
|
+
key
|
|
905
|
+
});
|
|
906
|
+
if (res && !(res instanceof Promise)) {
|
|
907
|
+
return res;
|
|
908
|
+
}
|
|
909
|
+
return;
|
|
910
|
+
}
|
|
911
|
+
});
|
|
888
912
|
await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
|
|
889
913
|
options,
|
|
890
914
|
moduleInfo
|
|
891
915
|
});
|
|
892
|
-
let hostSnapshot = share.getGlobalSnapshotInfoByModuleInfo({
|
|
893
|
-
name: this.HostInstance.options.name,
|
|
894
|
-
version: this.HostInstance.options.version
|
|
895
|
-
});
|
|
896
|
-
if (!hostSnapshot) {
|
|
897
|
-
hostSnapshot = {
|
|
898
|
-
version: this.HostInstance.options.version || '',
|
|
899
|
-
remoteEntry: '',
|
|
900
|
-
remotesInfo: {}
|
|
901
|
-
};
|
|
902
|
-
share.addGlobalSnapshot({
|
|
903
|
-
[this.HostInstance.options.name]: hostSnapshot
|
|
904
|
-
});
|
|
905
|
-
}
|
|
906
916
|
// In dynamic loadRemote scenarios, incomplete remotesInfo delivery may occur. In such cases, the remotesInfo in the host needs to be completed in the snapshot at runtime.
|
|
907
917
|
// This ensures the snapshot's integrity and helps the chrome plugin correctly identify all producer modules, ensuring that proxyable producer modules will not be missing.
|
|
908
|
-
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !share.getInfoWithoutType(hostSnapshot.remotesInfo, moduleInfo.name)
|
|
918
|
+
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !share.getInfoWithoutType(hostSnapshot.remotesInfo, moduleInfo.name, (target, key)=>{
|
|
919
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
920
|
+
target,
|
|
921
|
+
key
|
|
922
|
+
});
|
|
923
|
+
if (res && !(res instanceof Promise)) {
|
|
924
|
+
return res;
|
|
925
|
+
}
|
|
926
|
+
return;
|
|
927
|
+
}).value) {
|
|
909
928
|
if ('version' in moduleInfo || 'entry' in moduleInfo) {
|
|
910
929
|
hostSnapshot.remotesInfo = _extends$1({}, hostSnapshot == null ? void 0 : hostSnapshot.remotesInfo, {
|
|
911
930
|
[moduleInfo.name]: {
|
|
@@ -974,9 +993,29 @@ class SnapshotHandler {
|
|
|
974
993
|
const hostGlobalSnapshot = share.getGlobalSnapshotInfoByModuleInfo({
|
|
975
994
|
name: this.HostInstance.options.name,
|
|
976
995
|
version: this.HostInstance.options.version
|
|
996
|
+
}, {
|
|
997
|
+
getModuleInfoHook: (target, key)=>{
|
|
998
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
999
|
+
target,
|
|
1000
|
+
key
|
|
1001
|
+
});
|
|
1002
|
+
if (res && !(res instanceof Promise)) {
|
|
1003
|
+
return res;
|
|
1004
|
+
}
|
|
1005
|
+
return;
|
|
1006
|
+
}
|
|
977
1007
|
});
|
|
978
1008
|
// get remote detail info from global
|
|
979
|
-
const globalRemoteInfo = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && share.getInfoWithoutType(hostGlobalSnapshot.remotesInfo, moduleInfo.name)
|
|
1009
|
+
const globalRemoteInfo = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && share.getInfoWithoutType(hostGlobalSnapshot.remotesInfo, moduleInfo.name, (target, key)=>{
|
|
1010
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
1011
|
+
target,
|
|
1012
|
+
key
|
|
1013
|
+
});
|
|
1014
|
+
if (res && !(res instanceof Promise)) {
|
|
1015
|
+
return res;
|
|
1016
|
+
}
|
|
1017
|
+
return;
|
|
1018
|
+
}).value;
|
|
980
1019
|
if (globalRemoteInfo && globalRemoteInfo.matchedVersion) {
|
|
981
1020
|
return {
|
|
982
1021
|
hostGlobalSnapshot,
|
|
@@ -984,6 +1023,17 @@ class SnapshotHandler {
|
|
|
984
1023
|
remoteSnapshot: share.getGlobalSnapshotInfoByModuleInfo({
|
|
985
1024
|
name: moduleInfo.name,
|
|
986
1025
|
version: globalRemoteInfo.matchedVersion
|
|
1026
|
+
}, {
|
|
1027
|
+
getModuleInfoHook: (target, key)=>{
|
|
1028
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
1029
|
+
target,
|
|
1030
|
+
key
|
|
1031
|
+
});
|
|
1032
|
+
if (res && !(res instanceof Promise)) {
|
|
1033
|
+
return res;
|
|
1034
|
+
}
|
|
1035
|
+
return;
|
|
1036
|
+
}
|
|
987
1037
|
})
|
|
988
1038
|
};
|
|
989
1039
|
}
|
|
@@ -993,6 +1043,17 @@ class SnapshotHandler {
|
|
|
993
1043
|
remoteSnapshot: share.getGlobalSnapshotInfoByModuleInfo({
|
|
994
1044
|
name: moduleInfo.name,
|
|
995
1045
|
version: 'version' in moduleInfo ? moduleInfo.version : undefined
|
|
1046
|
+
}, {
|
|
1047
|
+
getModuleInfoHook: (target, key)=>{
|
|
1048
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
1049
|
+
target,
|
|
1050
|
+
key
|
|
1051
|
+
});
|
|
1052
|
+
if (res && !(res instanceof Promise)) {
|
|
1053
|
+
return res;
|
|
1054
|
+
}
|
|
1055
|
+
return;
|
|
1056
|
+
}
|
|
996
1057
|
})
|
|
997
1058
|
};
|
|
998
1059
|
}
|
|
@@ -1320,7 +1381,7 @@ class FederationHost {
|
|
|
1320
1381
|
const { module, moduleOptions, remoteMatchInfo } = await this._getRemoteModuleAndOptions(id);
|
|
1321
1382
|
const { pkgNameOrAlias, remote, expose, id: idRes } = remoteMatchInfo;
|
|
1322
1383
|
const moduleOrFactory = await module.get(expose, options);
|
|
1323
|
-
await this.hooks.lifecycle.onLoad.emit({
|
|
1384
|
+
const moduleWrapper = await this.hooks.lifecycle.onLoad.emit({
|
|
1324
1385
|
id: idRes,
|
|
1325
1386
|
pkgNameOrAlias,
|
|
1326
1387
|
expose,
|
|
@@ -1331,6 +1392,9 @@ class FederationHost {
|
|
|
1331
1392
|
moduleInstance: module,
|
|
1332
1393
|
origin: this
|
|
1333
1394
|
});
|
|
1395
|
+
if (typeof moduleWrapper === 'function') {
|
|
1396
|
+
return moduleWrapper;
|
|
1397
|
+
}
|
|
1334
1398
|
return moduleOrFactory;
|
|
1335
1399
|
} catch (error) {
|
|
1336
1400
|
const { from = 'runtime' } = options || {
|
|
@@ -1457,7 +1521,7 @@ class FederationHost {
|
|
|
1457
1521
|
}
|
|
1458
1522
|
// Set the remote entry to a complete path
|
|
1459
1523
|
if ('entry' in remote) {
|
|
1460
|
-
if (share.isBrowserEnv()) {
|
|
1524
|
+
if (share.isBrowserEnv() && !remote.entry.startsWith('http')) {
|
|
1461
1525
|
remote.entry = new URL(remote.entry, window.location.origin).href;
|
|
1462
1526
|
}
|
|
1463
1527
|
}
|
|
@@ -1572,7 +1636,7 @@ class FederationHost {
|
|
|
1572
1636
|
// not used yet
|
|
1573
1637
|
afterPreloadRemote: new AsyncHook()
|
|
1574
1638
|
});
|
|
1575
|
-
this.version = "0.0.
|
|
1639
|
+
this.version = "0.0.9";
|
|
1576
1640
|
this.moduleCache = new Map();
|
|
1577
1641
|
this.loaderHook = new PluginSystem({
|
|
1578
1642
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -1655,6 +1719,7 @@ Object.defineProperty(exports, 'loadScript', {
|
|
|
1655
1719
|
get: function () { return sdk.loadScript; }
|
|
1656
1720
|
});
|
|
1657
1721
|
exports.FederationHost = FederationHost;
|
|
1722
|
+
exports.getRemoteEntry = getRemoteEntry;
|
|
1658
1723
|
exports.init = init;
|
|
1659
1724
|
exports.loadRemote = loadRemote;
|
|
1660
1725
|
exports.loadShare = loadShare;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { g as getGlobalHostPlugins,
|
|
2
|
-
export {
|
|
1
|
+
import { g as getGlobalHostPlugins, a as globalLoading, b as getRemoteEntryExports, c as assert, D as DEFAULT_REMOTE_TYPE, d as DEFAULT_SCOPE, s as safeToString, e as getFMId, i as isObject, f as error, w as warn, h as isPlainObject, j as isRemoteInfoWithEntry, k as isPureRemoteEntry, l as getRegisteredShare, m as getInfoWithoutType, n as getPreloaded, o as setPreloaded, p as getGlobalSnapshotInfoByModuleInfo, q as setGlobalSnapshotInfoByModuleInfo, r as getGlobalSnapshot, G as Global, t as getGlobalShareScope, u as formatShareConfigs, v as isBrowserEnv, x as getBuilderId, y as addUniqueItem, z as setGlobalFederationConstructor, A as getGlobalFederationInstance, B as getGlobalFederationConstructor, C as setGlobalFederationInstance } from './share.esm.js';
|
|
2
|
+
export { E as registerGlobalPlugins } from './share.esm.js';
|
|
3
3
|
import { composeKeyWithSeparator, loadScriptNode, loadScript, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest } from '@module-federation/sdk';
|
|
4
4
|
export { loadScript } from '@module-federation/sdk';
|
|
5
5
|
|
|
@@ -672,9 +672,9 @@ function splitId(id) {
|
|
|
672
672
|
}
|
|
673
673
|
}
|
|
674
674
|
// Traverse all nodes in moduleInfo and traverse the entire snapshot
|
|
675
|
-
function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo = {}, remoteSnapshot) {
|
|
675
|
+
function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo = {}, remoteSnapshot, getModuleInfoHook) {
|
|
676
676
|
const id = getFMId(remoteInfo);
|
|
677
|
-
const { value: snapshotValue } = getInfoWithoutType(globalSnapshot, id);
|
|
677
|
+
const { value: snapshotValue } = getInfoWithoutType(globalSnapshot, id, getModuleInfoHook);
|
|
678
678
|
const effectiveRemoteSnapshot = remoteSnapshot || snapshotValue;
|
|
679
679
|
if (effectiveRemoteSnapshot && !isManifestProvider(effectiveRemoteSnapshot)) {
|
|
680
680
|
traverse(effectiveRemoteSnapshot, remoteInfo, isRoot);
|
|
@@ -690,7 +690,7 @@ function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo =
|
|
|
690
690
|
traverseModuleInfo(globalSnapshot, {
|
|
691
691
|
name: subRemoteInfo.name,
|
|
692
692
|
version: remoteValue.matchedVersion
|
|
693
|
-
}, traverse, false, memo, undefined);
|
|
693
|
+
}, traverse, false, memo, undefined, getModuleInfoHook);
|
|
694
694
|
}
|
|
695
695
|
}
|
|
696
696
|
}
|
|
@@ -790,7 +790,16 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
|
|
|
790
790
|
setPreloaded(exposeFullPath);
|
|
791
791
|
}
|
|
792
792
|
}
|
|
793
|
-
}, true, memo, remoteSnapshot)
|
|
793
|
+
}, true, memo, remoteSnapshot, (target, key)=>{
|
|
794
|
+
const res = origin.loaderHook.lifecycle.getModuleInfo.emit({
|
|
795
|
+
target,
|
|
796
|
+
key
|
|
797
|
+
});
|
|
798
|
+
if (res && !(res instanceof Promise)) {
|
|
799
|
+
return res;
|
|
800
|
+
}
|
|
801
|
+
return;
|
|
802
|
+
});
|
|
794
803
|
if (remoteSnapshot.shared) {
|
|
795
804
|
remoteSnapshot.shared.forEach((shared)=>{
|
|
796
805
|
var _options_shared;
|
|
@@ -883,27 +892,37 @@ class SnapshotHandler {
|
|
|
883
892
|
// eslint-disable-next-line max-lines-per-function
|
|
884
893
|
async loadRemoteSnapshotInfo(moduleInfo) {
|
|
885
894
|
const { options } = this.HostInstance;
|
|
895
|
+
const hostSnapshot = getGlobalSnapshotInfoByModuleInfo({
|
|
896
|
+
name: this.HostInstance.options.name,
|
|
897
|
+
version: this.HostInstance.options.version
|
|
898
|
+
}, {
|
|
899
|
+
getModuleInfoHook: (target, key)=>{
|
|
900
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
901
|
+
target,
|
|
902
|
+
key
|
|
903
|
+
});
|
|
904
|
+
if (res && !(res instanceof Promise)) {
|
|
905
|
+
return res;
|
|
906
|
+
}
|
|
907
|
+
return;
|
|
908
|
+
}
|
|
909
|
+
});
|
|
886
910
|
await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
|
|
887
911
|
options,
|
|
888
912
|
moduleInfo
|
|
889
913
|
});
|
|
890
|
-
let hostSnapshot = getGlobalSnapshotInfoByModuleInfo({
|
|
891
|
-
name: this.HostInstance.options.name,
|
|
892
|
-
version: this.HostInstance.options.version
|
|
893
|
-
});
|
|
894
|
-
if (!hostSnapshot) {
|
|
895
|
-
hostSnapshot = {
|
|
896
|
-
version: this.HostInstance.options.version || '',
|
|
897
|
-
remoteEntry: '',
|
|
898
|
-
remotesInfo: {}
|
|
899
|
-
};
|
|
900
|
-
addGlobalSnapshot({
|
|
901
|
-
[this.HostInstance.options.name]: hostSnapshot
|
|
902
|
-
});
|
|
903
|
-
}
|
|
904
914
|
// In dynamic loadRemote scenarios, incomplete remotesInfo delivery may occur. In such cases, the remotesInfo in the host needs to be completed in the snapshot at runtime.
|
|
905
915
|
// This ensures the snapshot's integrity and helps the chrome plugin correctly identify all producer modules, ensuring that proxyable producer modules will not be missing.
|
|
906
|
-
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !getInfoWithoutType(hostSnapshot.remotesInfo, moduleInfo.name)
|
|
916
|
+
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !getInfoWithoutType(hostSnapshot.remotesInfo, moduleInfo.name, (target, key)=>{
|
|
917
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
918
|
+
target,
|
|
919
|
+
key
|
|
920
|
+
});
|
|
921
|
+
if (res && !(res instanceof Promise)) {
|
|
922
|
+
return res;
|
|
923
|
+
}
|
|
924
|
+
return;
|
|
925
|
+
}).value) {
|
|
907
926
|
if ('version' in moduleInfo || 'entry' in moduleInfo) {
|
|
908
927
|
hostSnapshot.remotesInfo = _extends$1({}, hostSnapshot == null ? void 0 : hostSnapshot.remotesInfo, {
|
|
909
928
|
[moduleInfo.name]: {
|
|
@@ -972,9 +991,29 @@ class SnapshotHandler {
|
|
|
972
991
|
const hostGlobalSnapshot = getGlobalSnapshotInfoByModuleInfo({
|
|
973
992
|
name: this.HostInstance.options.name,
|
|
974
993
|
version: this.HostInstance.options.version
|
|
994
|
+
}, {
|
|
995
|
+
getModuleInfoHook: (target, key)=>{
|
|
996
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
997
|
+
target,
|
|
998
|
+
key
|
|
999
|
+
});
|
|
1000
|
+
if (res && !(res instanceof Promise)) {
|
|
1001
|
+
return res;
|
|
1002
|
+
}
|
|
1003
|
+
return;
|
|
1004
|
+
}
|
|
975
1005
|
});
|
|
976
1006
|
// get remote detail info from global
|
|
977
|
-
const globalRemoteInfo = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && getInfoWithoutType(hostGlobalSnapshot.remotesInfo, moduleInfo.name)
|
|
1007
|
+
const globalRemoteInfo = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && getInfoWithoutType(hostGlobalSnapshot.remotesInfo, moduleInfo.name, (target, key)=>{
|
|
1008
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
1009
|
+
target,
|
|
1010
|
+
key
|
|
1011
|
+
});
|
|
1012
|
+
if (res && !(res instanceof Promise)) {
|
|
1013
|
+
return res;
|
|
1014
|
+
}
|
|
1015
|
+
return;
|
|
1016
|
+
}).value;
|
|
978
1017
|
if (globalRemoteInfo && globalRemoteInfo.matchedVersion) {
|
|
979
1018
|
return {
|
|
980
1019
|
hostGlobalSnapshot,
|
|
@@ -982,6 +1021,17 @@ class SnapshotHandler {
|
|
|
982
1021
|
remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({
|
|
983
1022
|
name: moduleInfo.name,
|
|
984
1023
|
version: globalRemoteInfo.matchedVersion
|
|
1024
|
+
}, {
|
|
1025
|
+
getModuleInfoHook: (target, key)=>{
|
|
1026
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
1027
|
+
target,
|
|
1028
|
+
key
|
|
1029
|
+
});
|
|
1030
|
+
if (res && !(res instanceof Promise)) {
|
|
1031
|
+
return res;
|
|
1032
|
+
}
|
|
1033
|
+
return;
|
|
1034
|
+
}
|
|
985
1035
|
})
|
|
986
1036
|
};
|
|
987
1037
|
}
|
|
@@ -991,6 +1041,17 @@ class SnapshotHandler {
|
|
|
991
1041
|
remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({
|
|
992
1042
|
name: moduleInfo.name,
|
|
993
1043
|
version: 'version' in moduleInfo ? moduleInfo.version : undefined
|
|
1044
|
+
}, {
|
|
1045
|
+
getModuleInfoHook: (target, key)=>{
|
|
1046
|
+
const res = this.HostInstance.loaderHook.lifecycle.getModuleInfo.emit({
|
|
1047
|
+
target,
|
|
1048
|
+
key
|
|
1049
|
+
});
|
|
1050
|
+
if (res && !(res instanceof Promise)) {
|
|
1051
|
+
return res;
|
|
1052
|
+
}
|
|
1053
|
+
return;
|
|
1054
|
+
}
|
|
994
1055
|
})
|
|
995
1056
|
};
|
|
996
1057
|
}
|
|
@@ -1318,7 +1379,7 @@ class FederationHost {
|
|
|
1318
1379
|
const { module, moduleOptions, remoteMatchInfo } = await this._getRemoteModuleAndOptions(id);
|
|
1319
1380
|
const { pkgNameOrAlias, remote, expose, id: idRes } = remoteMatchInfo;
|
|
1320
1381
|
const moduleOrFactory = await module.get(expose, options);
|
|
1321
|
-
await this.hooks.lifecycle.onLoad.emit({
|
|
1382
|
+
const moduleWrapper = await this.hooks.lifecycle.onLoad.emit({
|
|
1322
1383
|
id: idRes,
|
|
1323
1384
|
pkgNameOrAlias,
|
|
1324
1385
|
expose,
|
|
@@ -1329,6 +1390,9 @@ class FederationHost {
|
|
|
1329
1390
|
moduleInstance: module,
|
|
1330
1391
|
origin: this
|
|
1331
1392
|
});
|
|
1393
|
+
if (typeof moduleWrapper === 'function') {
|
|
1394
|
+
return moduleWrapper;
|
|
1395
|
+
}
|
|
1332
1396
|
return moduleOrFactory;
|
|
1333
1397
|
} catch (error) {
|
|
1334
1398
|
const { from = 'runtime' } = options || {
|
|
@@ -1455,7 +1519,7 @@ class FederationHost {
|
|
|
1455
1519
|
}
|
|
1456
1520
|
// Set the remote entry to a complete path
|
|
1457
1521
|
if ('entry' in remote) {
|
|
1458
|
-
if (isBrowserEnv()) {
|
|
1522
|
+
if (isBrowserEnv() && !remote.entry.startsWith('http')) {
|
|
1459
1523
|
remote.entry = new URL(remote.entry, window.location.origin).href;
|
|
1460
1524
|
}
|
|
1461
1525
|
}
|
|
@@ -1570,7 +1634,7 @@ class FederationHost {
|
|
|
1570
1634
|
// not used yet
|
|
1571
1635
|
afterPreloadRemote: new AsyncHook()
|
|
1572
1636
|
});
|
|
1573
|
-
this.version = "0.0.
|
|
1637
|
+
this.version = "0.0.9";
|
|
1574
1638
|
this.moduleCache = new Map();
|
|
1575
1639
|
this.loaderHook = new PluginSystem({
|
|
1576
1640
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -1647,4 +1711,4 @@ function preloadRemote(...args) {
|
|
|
1647
1711
|
// Inject for debug
|
|
1648
1712
|
setGlobalFederationConstructor(FederationHost);
|
|
1649
1713
|
|
|
1650
|
-
export { FederationHost, init, loadRemote, loadShare, loadShareSync, preloadRemote };
|
|
1714
|
+
export { FederationHost, getRemoteEntry, init, loadRemote, loadShare, loadShareSync, preloadRemote };
|
package/dist/package.json
CHANGED
package/dist/share.cjs.js
CHANGED
|
@@ -168,48 +168,29 @@ function setGlobalFederationInstance(FederationInstance) {
|
|
|
168
168
|
function getGlobalFederationConstructor() {
|
|
169
169
|
return globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__;
|
|
170
170
|
}
|
|
171
|
-
function setGlobalFederationConstructor(FederationConstructor
|
|
172
|
-
if (
|
|
171
|
+
function setGlobalFederationConstructor(FederationConstructor) {
|
|
172
|
+
if (isDebugMode()) {
|
|
173
173
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
174
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.
|
|
174
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.9";
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
178
|
-
function getInfoWithoutType(target, key) {
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
} else {
|
|
187
|
-
const targetKeys = Object.keys(target);
|
|
188
|
-
for (let targetKey of targetKeys){
|
|
189
|
-
const [targetTypeOrName, _] = targetKey.split(':');
|
|
190
|
-
const nKey = `${targetTypeOrName}:${key}`;
|
|
191
|
-
const typeWithKeyRes = target[nKey];
|
|
192
|
-
if (typeWithKeyRes) {
|
|
193
|
-
return {
|
|
194
|
-
value: typeWithKeyRes,
|
|
195
|
-
key: nKey
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
return {
|
|
200
|
-
value: undefined,
|
|
201
|
-
key: key
|
|
202
|
-
};
|
|
203
|
-
}
|
|
204
|
-
} else {
|
|
205
|
-
throw new Error('key must be string');
|
|
178
|
+
function getInfoWithoutType(target, key, getModuleInfoHook) {
|
|
179
|
+
let res = {
|
|
180
|
+
value: target[key],
|
|
181
|
+
key: key
|
|
182
|
+
};
|
|
183
|
+
if (getModuleInfoHook) {
|
|
184
|
+
const hookRes = getModuleInfoHook(target, key);
|
|
185
|
+
res = hookRes || res;
|
|
206
186
|
}
|
|
187
|
+
return res;
|
|
207
188
|
}
|
|
208
189
|
const getGlobalSnapshot = ()=>nativeGlobal.__FEDERATION__.moduleInfo;
|
|
209
|
-
const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot)=>{
|
|
190
|
+
const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot, getModuleInfoHook)=>{
|
|
210
191
|
// Check if the remote is included in the hostSnapshot
|
|
211
192
|
const moduleKey = getFMId(moduleInfo);
|
|
212
|
-
const getModuleInfo = getInfoWithoutType(snapshot, moduleKey).value;
|
|
193
|
+
const getModuleInfo = getInfoWithoutType(snapshot, moduleKey, getModuleInfoHook).value;
|
|
213
194
|
// The remoteSnapshot might not include a version
|
|
214
195
|
if (getModuleInfo && !getModuleInfo.version && 'version' in moduleInfo && moduleInfo['version']) {
|
|
215
196
|
getModuleInfo.version = moduleInfo['version'];
|
|
@@ -223,14 +204,14 @@ const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot)=>{
|
|
|
223
204
|
"version"
|
|
224
205
|
]);
|
|
225
206
|
const moduleKeyWithoutVersion = getFMId(resModuleInfo);
|
|
226
|
-
const getModuleInfoWithoutVersion = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion).value;
|
|
207
|
+
const getModuleInfoWithoutVersion = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion, getModuleInfoHook).value;
|
|
227
208
|
if ((getModuleInfoWithoutVersion == null ? void 0 : getModuleInfoWithoutVersion.version) === version) {
|
|
228
209
|
return getModuleInfoWithoutVersion;
|
|
229
210
|
}
|
|
230
211
|
}
|
|
231
212
|
return;
|
|
232
213
|
};
|
|
233
|
-
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo)=>getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo);
|
|
214
|
+
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo, extraOptions)=>getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo, extraOptions == null ? void 0 : extraOptions.getModuleInfoHook);
|
|
234
215
|
const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{
|
|
235
216
|
const moduleKey = getFMId(remoteInfo);
|
|
236
217
|
nativeGlobal.__FEDERATION__.moduleInfo[moduleKey] = moduleDetailInfo;
|
|
@@ -702,24 +683,27 @@ const findVersion = (shareScopeMap, scope, pkgName, cb)=>{
|
|
|
702
683
|
return prev;
|
|
703
684
|
}, 0);
|
|
704
685
|
};
|
|
686
|
+
const isLoaded = (shared)=>{
|
|
687
|
+
return Boolean(shared.loaded) || typeof shared.lib === 'function';
|
|
688
|
+
};
|
|
705
689
|
function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
|
|
706
690
|
const versions = shareScopeMap[scope][pkgName];
|
|
707
691
|
const callback = function(prev, cur) {
|
|
708
|
-
return !versions[prev]
|
|
692
|
+
return !isLoaded(versions[prev]) && versionLt(prev, cur);
|
|
709
693
|
};
|
|
710
694
|
return findVersion(shareScopeMap, scope, pkgName, callback);
|
|
711
695
|
}
|
|
712
696
|
function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
|
|
713
697
|
const versions = shareScopeMap[scope][pkgName];
|
|
714
698
|
const callback = function(prev, cur) {
|
|
715
|
-
if (versions[cur]
|
|
716
|
-
if (versions[prev]
|
|
699
|
+
if (isLoaded(versions[cur])) {
|
|
700
|
+
if (isLoaded(versions[prev])) {
|
|
717
701
|
return Boolean(versionLt(prev, cur));
|
|
718
702
|
} else {
|
|
719
703
|
return true;
|
|
720
704
|
}
|
|
721
705
|
}
|
|
722
|
-
if (versions[prev]
|
|
706
|
+
if (isLoaded(versions[prev])) {
|
|
723
707
|
return false;
|
|
724
708
|
}
|
|
725
709
|
return versionLt(prev, cur);
|
package/dist/share.esm.js
CHANGED
|
@@ -166,48 +166,29 @@ function setGlobalFederationInstance(FederationInstance) {
|
|
|
166
166
|
function getGlobalFederationConstructor() {
|
|
167
167
|
return globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__;
|
|
168
168
|
}
|
|
169
|
-
function setGlobalFederationConstructor(FederationConstructor
|
|
170
|
-
if (
|
|
169
|
+
function setGlobalFederationConstructor(FederationConstructor) {
|
|
170
|
+
if (isDebugMode()) {
|
|
171
171
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
172
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.
|
|
172
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.9";
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
176
|
-
function getInfoWithoutType(target, key) {
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
} else {
|
|
185
|
-
const targetKeys = Object.keys(target);
|
|
186
|
-
for (let targetKey of targetKeys){
|
|
187
|
-
const [targetTypeOrName, _] = targetKey.split(':');
|
|
188
|
-
const nKey = `${targetTypeOrName}:${key}`;
|
|
189
|
-
const typeWithKeyRes = target[nKey];
|
|
190
|
-
if (typeWithKeyRes) {
|
|
191
|
-
return {
|
|
192
|
-
value: typeWithKeyRes,
|
|
193
|
-
key: nKey
|
|
194
|
-
};
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
return {
|
|
198
|
-
value: undefined,
|
|
199
|
-
key: key
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
} else {
|
|
203
|
-
throw new Error('key must be string');
|
|
176
|
+
function getInfoWithoutType(target, key, getModuleInfoHook) {
|
|
177
|
+
let res = {
|
|
178
|
+
value: target[key],
|
|
179
|
+
key: key
|
|
180
|
+
};
|
|
181
|
+
if (getModuleInfoHook) {
|
|
182
|
+
const hookRes = getModuleInfoHook(target, key);
|
|
183
|
+
res = hookRes || res;
|
|
204
184
|
}
|
|
185
|
+
return res;
|
|
205
186
|
}
|
|
206
187
|
const getGlobalSnapshot = ()=>nativeGlobal.__FEDERATION__.moduleInfo;
|
|
207
|
-
const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot)=>{
|
|
188
|
+
const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot, getModuleInfoHook)=>{
|
|
208
189
|
// Check if the remote is included in the hostSnapshot
|
|
209
190
|
const moduleKey = getFMId(moduleInfo);
|
|
210
|
-
const getModuleInfo = getInfoWithoutType(snapshot, moduleKey).value;
|
|
191
|
+
const getModuleInfo = getInfoWithoutType(snapshot, moduleKey, getModuleInfoHook).value;
|
|
211
192
|
// The remoteSnapshot might not include a version
|
|
212
193
|
if (getModuleInfo && !getModuleInfo.version && 'version' in moduleInfo && moduleInfo['version']) {
|
|
213
194
|
getModuleInfo.version = moduleInfo['version'];
|
|
@@ -221,14 +202,14 @@ const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot)=>{
|
|
|
221
202
|
"version"
|
|
222
203
|
]);
|
|
223
204
|
const moduleKeyWithoutVersion = getFMId(resModuleInfo);
|
|
224
|
-
const getModuleInfoWithoutVersion = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion).value;
|
|
205
|
+
const getModuleInfoWithoutVersion = getInfoWithoutType(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion, getModuleInfoHook).value;
|
|
225
206
|
if ((getModuleInfoWithoutVersion == null ? void 0 : getModuleInfoWithoutVersion.version) === version) {
|
|
226
207
|
return getModuleInfoWithoutVersion;
|
|
227
208
|
}
|
|
228
209
|
}
|
|
229
210
|
return;
|
|
230
211
|
};
|
|
231
|
-
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo)=>getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo);
|
|
212
|
+
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo, extraOptions)=>getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo, extraOptions == null ? void 0 : extraOptions.getModuleInfoHook);
|
|
232
213
|
const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{
|
|
233
214
|
const moduleKey = getFMId(remoteInfo);
|
|
234
215
|
nativeGlobal.__FEDERATION__.moduleInfo[moduleKey] = moduleDetailInfo;
|
|
@@ -700,24 +681,27 @@ const findVersion = (shareScopeMap, scope, pkgName, cb)=>{
|
|
|
700
681
|
return prev;
|
|
701
682
|
}, 0);
|
|
702
683
|
};
|
|
684
|
+
const isLoaded = (shared)=>{
|
|
685
|
+
return Boolean(shared.loaded) || typeof shared.lib === 'function';
|
|
686
|
+
};
|
|
703
687
|
function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
|
|
704
688
|
const versions = shareScopeMap[scope][pkgName];
|
|
705
689
|
const callback = function(prev, cur) {
|
|
706
|
-
return !versions[prev]
|
|
690
|
+
return !isLoaded(versions[prev]) && versionLt(prev, cur);
|
|
707
691
|
};
|
|
708
692
|
return findVersion(shareScopeMap, scope, pkgName, callback);
|
|
709
693
|
}
|
|
710
694
|
function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
|
|
711
695
|
const versions = shareScopeMap[scope][pkgName];
|
|
712
696
|
const callback = function(prev, cur) {
|
|
713
|
-
if (versions[cur]
|
|
714
|
-
if (versions[prev]
|
|
697
|
+
if (isLoaded(versions[cur])) {
|
|
698
|
+
if (isLoaded(versions[prev])) {
|
|
715
699
|
return Boolean(versionLt(prev, cur));
|
|
716
700
|
} else {
|
|
717
701
|
return true;
|
|
718
702
|
}
|
|
719
703
|
}
|
|
720
|
-
if (versions[prev]
|
|
704
|
+
if (isLoaded(versions[prev])) {
|
|
721
705
|
return false;
|
|
722
706
|
}
|
|
723
707
|
return versionLt(prev, cur);
|
|
@@ -786,4 +770,4 @@ function getGlobalShareScope() {
|
|
|
786
770
|
return Global.__FEDERATION__.__SHARE__;
|
|
787
771
|
}
|
|
788
772
|
|
|
789
|
-
export {
|
|
773
|
+
export { getGlobalFederationInstance as A, getGlobalFederationConstructor as B, setGlobalFederationInstance as C, DEFAULT_REMOTE_TYPE as D, registerGlobalPlugins as E, nativeGlobal as F, Global as G, resetFederationGlobalInfo as H, getTargetSnapshotInfoByModuleInfo as I, addGlobalSnapshot as J, globalLoading as a, getRemoteEntryExports as b, assert as c, DEFAULT_SCOPE as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, getRegisteredShare as l, getInfoWithoutType as m, getPreloaded as n, setPreloaded as o, getGlobalSnapshotInfoByModuleInfo as p, setGlobalSnapshotInfoByModuleInfo as q, getGlobalSnapshot as r, safeToString as s, getGlobalShareScope as t, formatShareConfigs as u, isBrowserEnv as v, warn as w, getBuilderId as x, addUniqueItem as y, setGlobalFederationConstructor as z };
|
package/dist/src/global.d.ts
CHANGED
|
@@ -23,14 +23,25 @@ export declare function resetFederationGlobalInfo(): void;
|
|
|
23
23
|
export declare function getGlobalFederationInstance(name: string, version: string | undefined): FederationHost | undefined;
|
|
24
24
|
export declare function setGlobalFederationInstance(FederationInstance: FederationHost): void;
|
|
25
25
|
export declare function getGlobalFederationConstructor(): typeof FederationHost | undefined;
|
|
26
|
-
export declare function setGlobalFederationConstructor(FederationConstructor: typeof FederationHost
|
|
27
|
-
export declare function getInfoWithoutType<T extends object>(target: T, key: keyof T
|
|
26
|
+
export declare function setGlobalFederationConstructor(FederationConstructor: typeof FederationHost): void;
|
|
27
|
+
export declare function getInfoWithoutType<T extends object>(target: T, key: keyof T, getModuleInfoHook?: (target: any, key: string | number | symbol) => {
|
|
28
|
+
value: any | undefined;
|
|
29
|
+
key: string;
|
|
30
|
+
} | void): {
|
|
28
31
|
value: T[keyof T] | undefined;
|
|
29
32
|
key: string;
|
|
30
33
|
};
|
|
31
34
|
export declare const getGlobalSnapshot: () => GlobalModuleInfo;
|
|
32
|
-
export declare const getTargetSnapshotInfoByModuleInfo: (moduleInfo: Optional<Remote, 'alias'>, snapshot: GlobalModuleInfo) =>
|
|
33
|
-
|
|
35
|
+
export declare const getTargetSnapshotInfoByModuleInfo: (moduleInfo: Optional<Remote, 'alias'>, snapshot: GlobalModuleInfo, getModuleInfoHook?: ((target: any, key: string | number | symbol) => void | {
|
|
36
|
+
value: any | undefined;
|
|
37
|
+
key: string;
|
|
38
|
+
}) | undefined) => GlobalModuleInfo[string] | undefined;
|
|
39
|
+
export declare const getGlobalSnapshotInfoByModuleInfo: (moduleInfo: Optional<Remote, 'alias'>, extraOptions?: {
|
|
40
|
+
getModuleInfoHook?: ((target: any, key: string | number | symbol) => void | {
|
|
41
|
+
value: any | undefined;
|
|
42
|
+
key: string;
|
|
43
|
+
}) | undefined;
|
|
44
|
+
} | undefined) => GlobalModuleInfo[string] | undefined;
|
|
34
45
|
export declare const setGlobalSnapshotInfoByModuleInfo: (remoteInfo: Remote, moduleDetailInfo: GlobalModuleInfo[string]) => GlobalModuleInfo;
|
|
35
46
|
export declare const addGlobalSnapshot: (moduleInfos: GlobalModuleInfo) => (() => void);
|
|
36
47
|
export declare const getRemoteEntryExports: (name: string, globalName: string | undefined) => {
|
package/dist/src/index.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { FederationHost } from './core';
|
|
|
2
2
|
import { UserOptions, FederationRuntimePlugin } from './type';
|
|
3
3
|
export { FederationHost } from './core';
|
|
4
4
|
export { registerGlobalPlugins } from './global';
|
|
5
|
+
export { getRemoteEntry } from './utils';
|
|
5
6
|
export { loadScript } from '@module-federation/sdk';
|
|
6
7
|
export type { Federation } from './global';
|
|
7
8
|
export type { FederationRuntimePlugin };
|
|
@@ -38,12 +38,12 @@ type SharedBaseArgs = {
|
|
|
38
38
|
deps?: Array<string>;
|
|
39
39
|
strategy?: 'version-first' | 'loaded-first';
|
|
40
40
|
};
|
|
41
|
-
export type SharedGetter = (() => () => Module) | (() => Promise<() => Module>);
|
|
42
41
|
export type ShareArgs = (SharedBaseArgs & {
|
|
43
|
-
get:
|
|
42
|
+
get: () => () => Module | Promise<() => Module>;
|
|
44
43
|
}) | (SharedBaseArgs & {
|
|
45
44
|
lib: () => Module;
|
|
46
45
|
});
|
|
46
|
+
export type SharedGetter = () => () => Promise<() => Module> | Module;
|
|
47
47
|
export type Shared = {
|
|
48
48
|
version: string;
|
|
49
49
|
get: SharedGetter;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20240119085716",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -45,6 +45,6 @@
|
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
48
|
+
"@module-federation/sdk": "0.0.0-next-20240119085716"
|
|
49
49
|
}
|
|
50
50
|
}
|