@module-federation/runtime 0.0.0-next-20240115042410 → 0.0.0-next-20240117093010
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.cjs.js +0 -3
- package/dist/helpers.esm.js +1 -4
- package/dist/index.cjs.js +26 -85
- package/dist/index.esm.js +27 -86
- package/dist/share.cjs.js +46 -35
- package/dist/share.esm.js +46 -33
- package/dist/src/global.d.ts +11 -18
- package/dist/src/helpers.d.ts +1 -4
- package/dist/src/plugins/snapshot/SnapshotHandler.d.ts +2 -1
- package/dist/src/type/config.d.ts +2 -2
- package/package.json +2 -2
package/dist/helpers.cjs.js
CHANGED
|
@@ -14,10 +14,7 @@ const GlobalUtils = {
|
|
|
14
14
|
setGlobalFederationInstance: share.setGlobalFederationInstance,
|
|
15
15
|
getGlobalFederationConstructor: share.getGlobalFederationConstructor,
|
|
16
16
|
setGlobalFederationConstructor: share.setGlobalFederationConstructor,
|
|
17
|
-
getInfoWithoutType: share.getInfoWithoutType,
|
|
18
17
|
getGlobalSnapshot: share.getGlobalSnapshot,
|
|
19
|
-
getTargetSnapshotInfoByModuleInfo: share.getTargetSnapshotInfoByModuleInfo,
|
|
20
|
-
getGlobalSnapshotInfoByModuleInfo: share.getGlobalSnapshotInfoByModuleInfo,
|
|
21
18
|
setGlobalSnapshotInfoByModuleInfo: share.setGlobalSnapshotInfoByModuleInfo,
|
|
22
19
|
addGlobalSnapshot: share.addGlobalSnapshot,
|
|
23
20
|
getRemoteEntryExports: share.getRemoteEntryExports,
|
package/dist/helpers.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { n 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, q as getGlobalSnapshot, p as setGlobalSnapshotInfoByModuleInfo, o as addGlobalSnapshot, c as getRemoteEntryExports, E as registerGlobalPlugins, g as getGlobalHostPlugins, l as getPreloaded, m as setPreloaded } from './share.esm.js';
|
|
2
2
|
|
|
3
3
|
const ShareUtils = {
|
|
4
4
|
getRegisteredShare,
|
|
@@ -12,10 +12,7 @@ const GlobalUtils = {
|
|
|
12
12
|
setGlobalFederationInstance,
|
|
13
13
|
getGlobalFederationConstructor,
|
|
14
14
|
setGlobalFederationConstructor,
|
|
15
|
-
getInfoWithoutType,
|
|
16
15
|
getGlobalSnapshot,
|
|
17
|
-
getTargetSnapshotInfoByModuleInfo,
|
|
18
|
-
getGlobalSnapshotInfoByModuleInfo,
|
|
19
16
|
setGlobalSnapshotInfoByModuleInfo,
|
|
20
17
|
addGlobalSnapshot,
|
|
21
18
|
getRemoteEntryExports,
|
package/dist/index.cjs.js
CHANGED
|
@@ -214,6 +214,7 @@ let Module = class Module {
|
|
|
214
214
|
remoteInfo: this.remoteInfo,
|
|
215
215
|
remoteEntryExports: this.remoteEntryExports,
|
|
216
216
|
createScriptHook: (url)=>{
|
|
217
|
+
console.log('xxxxxxx', this.host.loaderHook);
|
|
217
218
|
const res = this.host.loaderHook.lifecycle.createScript.emit({
|
|
218
219
|
url
|
|
219
220
|
});
|
|
@@ -674,9 +675,9 @@ function splitId(id) {
|
|
|
674
675
|
}
|
|
675
676
|
}
|
|
676
677
|
// Traverse all nodes in moduleInfo and traverse the entire snapshot
|
|
677
|
-
function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo = {},
|
|
678
|
+
function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo = {}, getSnapshotInfoWithHook, remoteSnapshot) {
|
|
678
679
|
const id = share.getFMId(remoteInfo);
|
|
679
|
-
const { value: snapshotValue } =
|
|
680
|
+
const { value: snapshotValue } = getSnapshotInfoWithHook.getInfoWithoutTypeWithHook(globalSnapshot, id);
|
|
680
681
|
const effectiveRemoteSnapshot = remoteSnapshot || snapshotValue;
|
|
681
682
|
if (effectiveRemoteSnapshot && !sdk.isManifestProvider(effectiveRemoteSnapshot)) {
|
|
682
683
|
traverse(effectiveRemoteSnapshot, remoteInfo, isRoot);
|
|
@@ -692,7 +693,7 @@ function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo =
|
|
|
692
693
|
traverseModuleInfo(globalSnapshot, {
|
|
693
694
|
name: subRemoteInfo.name,
|
|
694
695
|
version: remoteValue.matchedVersion
|
|
695
|
-
}, traverse, false, memo,
|
|
696
|
+
}, traverse, false, memo, getSnapshotInfoWithHook, undefined);
|
|
696
697
|
}
|
|
697
698
|
}
|
|
698
699
|
}
|
|
@@ -792,16 +793,7 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
|
|
|
792
793
|
share.setPreloaded(exposeFullPath);
|
|
793
794
|
}
|
|
794
795
|
}
|
|
795
|
-
}, true, memo,
|
|
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
|
+
}, true, memo, origin.snapshotHandler.getSnapshotInfoHandler, remoteSnapshot);
|
|
805
797
|
if (remoteSnapshot.shared) {
|
|
806
798
|
remoteSnapshot.shared.forEach((shared)=>{
|
|
807
799
|
var _options_shared;
|
|
@@ -894,37 +886,27 @@ class SnapshotHandler {
|
|
|
894
886
|
// eslint-disable-next-line max-lines-per-function
|
|
895
887
|
async loadRemoteSnapshotInfo(moduleInfo) {
|
|
896
888
|
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
|
-
});
|
|
912
889
|
await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
|
|
913
890
|
options,
|
|
914
891
|
moduleInfo
|
|
915
892
|
});
|
|
893
|
+
let hostSnapshot = this.getSnapshotInfoHandler.getGlobalSnapshotInfoByModuleInfo({
|
|
894
|
+
name: this.HostInstance.options.name,
|
|
895
|
+
version: this.HostInstance.options.version
|
|
896
|
+
});
|
|
897
|
+
if (!hostSnapshot) {
|
|
898
|
+
hostSnapshot = {
|
|
899
|
+
version: this.HostInstance.options.version || '',
|
|
900
|
+
remoteEntry: '',
|
|
901
|
+
remotesInfo: {}
|
|
902
|
+
};
|
|
903
|
+
share.addGlobalSnapshot({
|
|
904
|
+
[this.HostInstance.options.name]: hostSnapshot
|
|
905
|
+
});
|
|
906
|
+
}
|
|
916
907
|
// 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.
|
|
917
908
|
// 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.
|
|
918
|
-
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !
|
|
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
|
+
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !this.getSnapshotInfoHandler.getInfoWithoutTypeWithHook(hostSnapshot.remotesInfo, moduleInfo.name).value) {
|
|
928
910
|
if ('version' in moduleInfo || 'entry' in moduleInfo) {
|
|
929
911
|
hostSnapshot.remotesInfo = _extends$1({}, hostSnapshot == null ? void 0 : hostSnapshot.remotesInfo, {
|
|
930
912
|
[moduleInfo.name]: {
|
|
@@ -990,70 +972,28 @@ class SnapshotHandler {
|
|
|
990
972
|
}
|
|
991
973
|
}
|
|
992
974
|
getGlobalRemoteInfo(moduleInfo) {
|
|
993
|
-
const hostGlobalSnapshot =
|
|
975
|
+
const hostGlobalSnapshot = this.getSnapshotInfoHandler.getGlobalSnapshotInfoByModuleInfo({
|
|
994
976
|
name: this.HostInstance.options.name,
|
|
995
977
|
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
|
-
}
|
|
1007
978
|
});
|
|
1008
979
|
// get remote detail info from global
|
|
1009
|
-
const globalRemoteInfo = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo &&
|
|
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
|
+
const globalRemoteInfo = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && this.getSnapshotInfoHandler.getInfoWithoutTypeWithHook(hostGlobalSnapshot.remotesInfo, moduleInfo.name).value;
|
|
1019
981
|
if (globalRemoteInfo && globalRemoteInfo.matchedVersion) {
|
|
1020
982
|
return {
|
|
1021
983
|
hostGlobalSnapshot,
|
|
1022
984
|
globalSnapshot: share.getGlobalSnapshot(),
|
|
1023
|
-
remoteSnapshot:
|
|
985
|
+
remoteSnapshot: this.getSnapshotInfoHandler.getGlobalSnapshotInfoByModuleInfo({
|
|
1024
986
|
name: moduleInfo.name,
|
|
1025
987
|
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
|
-
}
|
|
1037
988
|
})
|
|
1038
989
|
};
|
|
1039
990
|
}
|
|
1040
991
|
return {
|
|
1041
992
|
hostGlobalSnapshot: undefined,
|
|
1042
993
|
globalSnapshot: share.getGlobalSnapshot(),
|
|
1043
|
-
remoteSnapshot:
|
|
994
|
+
remoteSnapshot: this.getSnapshotInfoHandler.getGlobalSnapshotInfoByModuleInfo({
|
|
1044
995
|
name: moduleInfo.name,
|
|
1045
996
|
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
|
-
}
|
|
1057
997
|
})
|
|
1058
998
|
};
|
|
1059
999
|
}
|
|
@@ -1109,6 +1049,7 @@ class SnapshotHandler {
|
|
|
1109
1049
|
this.manifestLoading = share.Global.__FEDERATION__.__MANIFEST_LOADING__;
|
|
1110
1050
|
this.HostInstance = HostInstance;
|
|
1111
1051
|
this.loaderHook = HostInstance.loaderHook;
|
|
1052
|
+
this.getSnapshotInfoHandler = new share.GetSnapshotInfoWithHook(this.loaderHook);
|
|
1112
1053
|
}
|
|
1113
1054
|
}
|
|
1114
1055
|
|
|
@@ -1518,7 +1459,7 @@ class FederationHost {
|
|
|
1518
1459
|
}
|
|
1519
1460
|
// Set the remote entry to a complete path
|
|
1520
1461
|
if ('entry' in remote) {
|
|
1521
|
-
if (share.isBrowserEnv()
|
|
1462
|
+
if (share.isBrowserEnv()) {
|
|
1522
1463
|
remote.entry = new URL(remote.entry, window.location.origin).href;
|
|
1523
1464
|
}
|
|
1524
1465
|
}
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getGlobalHostPlugins, D as DEFAULT_REMOTE_TYPE, a as DEFAULT_SCOPE, b as globalLoading, c as getRemoteEntryExports, d as assert, 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
|
|
1
|
+
import { g as getGlobalHostPlugins, D as DEFAULT_REMOTE_TYPE, a as DEFAULT_SCOPE, b as globalLoading, c as getRemoteEntryExports, d as assert, 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 getPreloaded, m as setPreloaded, n as getRegisteredShare, o as addGlobalSnapshot, p as setGlobalSnapshotInfoByModuleInfo, q as getGlobalSnapshot, G as Global, r as GetSnapshotInfoWithHook, 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
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';
|
|
@@ -212,6 +212,7 @@ let Module = class Module {
|
|
|
212
212
|
remoteInfo: this.remoteInfo,
|
|
213
213
|
remoteEntryExports: this.remoteEntryExports,
|
|
214
214
|
createScriptHook: (url)=>{
|
|
215
|
+
console.log('xxxxxxx', this.host.loaderHook);
|
|
215
216
|
const res = this.host.loaderHook.lifecycle.createScript.emit({
|
|
216
217
|
url
|
|
217
218
|
});
|
|
@@ -672,9 +673,9 @@ function splitId(id) {
|
|
|
672
673
|
}
|
|
673
674
|
}
|
|
674
675
|
// Traverse all nodes in moduleInfo and traverse the entire snapshot
|
|
675
|
-
function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo = {},
|
|
676
|
+
function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo = {}, getSnapshotInfoWithHook, remoteSnapshot) {
|
|
676
677
|
const id = getFMId(remoteInfo);
|
|
677
|
-
const { value: snapshotValue } =
|
|
678
|
+
const { value: snapshotValue } = getSnapshotInfoWithHook.getInfoWithoutTypeWithHook(globalSnapshot, id);
|
|
678
679
|
const effectiveRemoteSnapshot = remoteSnapshot || snapshotValue;
|
|
679
680
|
if (effectiveRemoteSnapshot && !isManifestProvider(effectiveRemoteSnapshot)) {
|
|
680
681
|
traverse(effectiveRemoteSnapshot, remoteInfo, isRoot);
|
|
@@ -690,7 +691,7 @@ function traverseModuleInfo(globalSnapshot, remoteInfo, traverse, isRoot, memo =
|
|
|
690
691
|
traverseModuleInfo(globalSnapshot, {
|
|
691
692
|
name: subRemoteInfo.name,
|
|
692
693
|
version: remoteValue.matchedVersion
|
|
693
|
-
}, traverse, false, memo,
|
|
694
|
+
}, traverse, false, memo, getSnapshotInfoWithHook, undefined);
|
|
694
695
|
}
|
|
695
696
|
}
|
|
696
697
|
}
|
|
@@ -790,16 +791,7 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
|
|
|
790
791
|
setPreloaded(exposeFullPath);
|
|
791
792
|
}
|
|
792
793
|
}
|
|
793
|
-
}, true, memo,
|
|
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
|
+
}, true, memo, origin.snapshotHandler.getSnapshotInfoHandler, remoteSnapshot);
|
|
803
795
|
if (remoteSnapshot.shared) {
|
|
804
796
|
remoteSnapshot.shared.forEach((shared)=>{
|
|
805
797
|
var _options_shared;
|
|
@@ -892,37 +884,27 @@ class SnapshotHandler {
|
|
|
892
884
|
// eslint-disable-next-line max-lines-per-function
|
|
893
885
|
async loadRemoteSnapshotInfo(moduleInfo) {
|
|
894
886
|
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
|
-
});
|
|
910
887
|
await this.hooks.lifecycle.beforeLoadRemoteSnapshot.emit({
|
|
911
888
|
options,
|
|
912
889
|
moduleInfo
|
|
913
890
|
});
|
|
891
|
+
let hostSnapshot = this.getSnapshotInfoHandler.getGlobalSnapshotInfoByModuleInfo({
|
|
892
|
+
name: this.HostInstance.options.name,
|
|
893
|
+
version: this.HostInstance.options.version
|
|
894
|
+
});
|
|
895
|
+
if (!hostSnapshot) {
|
|
896
|
+
hostSnapshot = {
|
|
897
|
+
version: this.HostInstance.options.version || '',
|
|
898
|
+
remoteEntry: '',
|
|
899
|
+
remotesInfo: {}
|
|
900
|
+
};
|
|
901
|
+
addGlobalSnapshot({
|
|
902
|
+
[this.HostInstance.options.name]: hostSnapshot
|
|
903
|
+
});
|
|
904
|
+
}
|
|
914
905
|
// 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.
|
|
915
906
|
// 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.
|
|
916
|
-
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !
|
|
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
|
+
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !this.getSnapshotInfoHandler.getInfoWithoutTypeWithHook(hostSnapshot.remotesInfo, moduleInfo.name).value) {
|
|
926
908
|
if ('version' in moduleInfo || 'entry' in moduleInfo) {
|
|
927
909
|
hostSnapshot.remotesInfo = _extends$1({}, hostSnapshot == null ? void 0 : hostSnapshot.remotesInfo, {
|
|
928
910
|
[moduleInfo.name]: {
|
|
@@ -988,70 +970,28 @@ class SnapshotHandler {
|
|
|
988
970
|
}
|
|
989
971
|
}
|
|
990
972
|
getGlobalRemoteInfo(moduleInfo) {
|
|
991
|
-
const hostGlobalSnapshot = getGlobalSnapshotInfoByModuleInfo({
|
|
973
|
+
const hostGlobalSnapshot = this.getSnapshotInfoHandler.getGlobalSnapshotInfoByModuleInfo({
|
|
992
974
|
name: this.HostInstance.options.name,
|
|
993
975
|
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
|
-
}
|
|
1005
976
|
});
|
|
1006
977
|
// get remote detail info from global
|
|
1007
|
-
const globalRemoteInfo = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo &&
|
|
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
|
+
const globalRemoteInfo = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && this.getSnapshotInfoHandler.getInfoWithoutTypeWithHook(hostGlobalSnapshot.remotesInfo, moduleInfo.name).value;
|
|
1017
979
|
if (globalRemoteInfo && globalRemoteInfo.matchedVersion) {
|
|
1018
980
|
return {
|
|
1019
981
|
hostGlobalSnapshot,
|
|
1020
982
|
globalSnapshot: getGlobalSnapshot(),
|
|
1021
|
-
remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({
|
|
983
|
+
remoteSnapshot: this.getSnapshotInfoHandler.getGlobalSnapshotInfoByModuleInfo({
|
|
1022
984
|
name: moduleInfo.name,
|
|
1023
985
|
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
|
-
}
|
|
1035
986
|
})
|
|
1036
987
|
};
|
|
1037
988
|
}
|
|
1038
989
|
return {
|
|
1039
990
|
hostGlobalSnapshot: undefined,
|
|
1040
991
|
globalSnapshot: getGlobalSnapshot(),
|
|
1041
|
-
remoteSnapshot: getGlobalSnapshotInfoByModuleInfo({
|
|
992
|
+
remoteSnapshot: this.getSnapshotInfoHandler.getGlobalSnapshotInfoByModuleInfo({
|
|
1042
993
|
name: moduleInfo.name,
|
|
1043
994
|
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
|
-
}
|
|
1055
995
|
})
|
|
1056
996
|
};
|
|
1057
997
|
}
|
|
@@ -1107,6 +1047,7 @@ class SnapshotHandler {
|
|
|
1107
1047
|
this.manifestLoading = Global.__FEDERATION__.__MANIFEST_LOADING__;
|
|
1108
1048
|
this.HostInstance = HostInstance;
|
|
1109
1049
|
this.loaderHook = HostInstance.loaderHook;
|
|
1050
|
+
this.getSnapshotInfoHandler = new GetSnapshotInfoWithHook(this.loaderHook);
|
|
1110
1051
|
}
|
|
1111
1052
|
}
|
|
1112
1053
|
|
|
@@ -1516,7 +1457,7 @@ class FederationHost {
|
|
|
1516
1457
|
}
|
|
1517
1458
|
// Set the remote entry to a complete path
|
|
1518
1459
|
if ('entry' in remote) {
|
|
1519
|
-
if (isBrowserEnv()
|
|
1460
|
+
if (isBrowserEnv()) {
|
|
1520
1461
|
remote.entry = new URL(remote.entry, window.location.origin).href;
|
|
1521
1462
|
}
|
|
1522
1463
|
}
|
package/dist/share.cjs.js
CHANGED
|
@@ -168,50 +168,63 @@ 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, isDebug = isDebugMode()) {
|
|
172
|
+
if (isDebug) {
|
|
173
173
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
174
174
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.8";
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
178
|
-
function getInfoWithoutType(target, key
|
|
179
|
-
|
|
178
|
+
function getInfoWithoutType(target, key) {
|
|
179
|
+
return {
|
|
180
180
|
value: target[key],
|
|
181
181
|
key: key
|
|
182
182
|
};
|
|
183
|
-
if (getModuleInfoHook) {
|
|
184
|
-
const hookRes = getModuleInfoHook(target, key);
|
|
185
|
-
res = hookRes || res;
|
|
186
|
-
}
|
|
187
|
-
return res;
|
|
188
183
|
}
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
return
|
|
184
|
+
class GetSnapshotInfoWithHook {
|
|
185
|
+
getInfoWithoutTypeWithHook(target, key) {
|
|
186
|
+
let res = getInfoWithoutType(target, key);
|
|
187
|
+
const hookRes = this.loaderHook.lifecycle.getModuleInfo.emit({
|
|
188
|
+
target,
|
|
189
|
+
key
|
|
190
|
+
});
|
|
191
|
+
if (hookRes && !(hookRes instanceof Promise)) {
|
|
192
|
+
res = hookRes || res;
|
|
193
|
+
}
|
|
194
|
+
return res;
|
|
200
195
|
}
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
const
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
196
|
+
getTargetSnapshotInfoByModuleInfo(moduleInfo, snapshot) {
|
|
197
|
+
// Check if the remote is included in the hostSnapshot
|
|
198
|
+
const moduleKey = getFMId(moduleInfo);
|
|
199
|
+
const getModuleInfo = this.getInfoWithoutTypeWithHook(snapshot, moduleKey).value;
|
|
200
|
+
// The remoteSnapshot might not include a version
|
|
201
|
+
if (getModuleInfo && !getModuleInfo.version && 'version' in moduleInfo && moduleInfo['version']) {
|
|
202
|
+
getModuleInfo.version = moduleInfo['version'];
|
|
203
|
+
}
|
|
204
|
+
if (getModuleInfo) {
|
|
205
|
+
return getModuleInfo;
|
|
210
206
|
}
|
|
207
|
+
// If the remote is not included in the hostSnapshot, deploy a micro app snapshot
|
|
208
|
+
if ('version' in moduleInfo && moduleInfo['version']) {
|
|
209
|
+
const { version } = moduleInfo, resModuleInfo = _object_without_properties_loose(moduleInfo, [
|
|
210
|
+
"version"
|
|
211
|
+
]);
|
|
212
|
+
const moduleKeyWithoutVersion = getFMId(resModuleInfo);
|
|
213
|
+
const getModuleInfoWithoutVersion = this.getInfoWithoutTypeWithHook(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion).value;
|
|
214
|
+
if ((getModuleInfoWithoutVersion == null ? void 0 : getModuleInfoWithoutVersion.version) === version) {
|
|
215
|
+
return getModuleInfoWithoutVersion;
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return;
|
|
211
219
|
}
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
220
|
+
getGlobalSnapshotInfoByModuleInfo(moduleInfo) {
|
|
221
|
+
return this.getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo);
|
|
222
|
+
}
|
|
223
|
+
constructor(loaderHook){
|
|
224
|
+
this.loaderHook = loaderHook;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
const getGlobalSnapshot = ()=>nativeGlobal.__FEDERATION__.moduleInfo;
|
|
215
228
|
const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{
|
|
216
229
|
const moduleKey = getFMId(remoteInfo);
|
|
217
230
|
nativeGlobal.__FEDERATION__.moduleInfo[moduleKey] = moduleDetailInfo;
|
|
@@ -771,6 +784,7 @@ function getGlobalShareScope() {
|
|
|
771
784
|
|
|
772
785
|
exports.DEFAULT_REMOTE_TYPE = DEFAULT_REMOTE_TYPE;
|
|
773
786
|
exports.DEFAULT_SCOPE = DEFAULT_SCOPE;
|
|
787
|
+
exports.GetSnapshotInfoWithHook = GetSnapshotInfoWithHook;
|
|
774
788
|
exports.Global = Global;
|
|
775
789
|
exports.addGlobalSnapshot = addGlobalSnapshot;
|
|
776
790
|
exports.addUniqueItem = addUniqueItem;
|
|
@@ -784,12 +798,9 @@ exports.getGlobalFederationInstance = getGlobalFederationInstance;
|
|
|
784
798
|
exports.getGlobalHostPlugins = getGlobalHostPlugins;
|
|
785
799
|
exports.getGlobalShareScope = getGlobalShareScope;
|
|
786
800
|
exports.getGlobalSnapshot = getGlobalSnapshot;
|
|
787
|
-
exports.getGlobalSnapshotInfoByModuleInfo = getGlobalSnapshotInfoByModuleInfo;
|
|
788
|
-
exports.getInfoWithoutType = getInfoWithoutType;
|
|
789
801
|
exports.getPreloaded = getPreloaded;
|
|
790
802
|
exports.getRegisteredShare = getRegisteredShare;
|
|
791
803
|
exports.getRemoteEntryExports = getRemoteEntryExports;
|
|
792
|
-
exports.getTargetSnapshotInfoByModuleInfo = getTargetSnapshotInfoByModuleInfo;
|
|
793
804
|
exports.globalLoading = globalLoading;
|
|
794
805
|
exports.isBrowserEnv = isBrowserEnv;
|
|
795
806
|
exports.isObject = isObject;
|
package/dist/share.esm.js
CHANGED
|
@@ -166,50 +166,63 @@ 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, isDebug = isDebugMode()) {
|
|
170
|
+
if (isDebug) {
|
|
171
171
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
172
172
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.8";
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
176
|
-
function getInfoWithoutType(target, key
|
|
177
|
-
|
|
176
|
+
function getInfoWithoutType(target, key) {
|
|
177
|
+
return {
|
|
178
178
|
value: target[key],
|
|
179
179
|
key: key
|
|
180
180
|
};
|
|
181
|
-
if (getModuleInfoHook) {
|
|
182
|
-
const hookRes = getModuleInfoHook(target, key);
|
|
183
|
-
res = hookRes || res;
|
|
184
|
-
}
|
|
185
|
-
return res;
|
|
186
181
|
}
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
return
|
|
182
|
+
class GetSnapshotInfoWithHook {
|
|
183
|
+
getInfoWithoutTypeWithHook(target, key) {
|
|
184
|
+
let res = getInfoWithoutType(target, key);
|
|
185
|
+
const hookRes = this.loaderHook.lifecycle.getModuleInfo.emit({
|
|
186
|
+
target,
|
|
187
|
+
key
|
|
188
|
+
});
|
|
189
|
+
if (hookRes && !(hookRes instanceof Promise)) {
|
|
190
|
+
res = hookRes || res;
|
|
191
|
+
}
|
|
192
|
+
return res;
|
|
198
193
|
}
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
const
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
194
|
+
getTargetSnapshotInfoByModuleInfo(moduleInfo, snapshot) {
|
|
195
|
+
// Check if the remote is included in the hostSnapshot
|
|
196
|
+
const moduleKey = getFMId(moduleInfo);
|
|
197
|
+
const getModuleInfo = this.getInfoWithoutTypeWithHook(snapshot, moduleKey).value;
|
|
198
|
+
// The remoteSnapshot might not include a version
|
|
199
|
+
if (getModuleInfo && !getModuleInfo.version && 'version' in moduleInfo && moduleInfo['version']) {
|
|
200
|
+
getModuleInfo.version = moduleInfo['version'];
|
|
201
|
+
}
|
|
202
|
+
if (getModuleInfo) {
|
|
203
|
+
return getModuleInfo;
|
|
208
204
|
}
|
|
205
|
+
// If the remote is not included in the hostSnapshot, deploy a micro app snapshot
|
|
206
|
+
if ('version' in moduleInfo && moduleInfo['version']) {
|
|
207
|
+
const { version } = moduleInfo, resModuleInfo = _object_without_properties_loose(moduleInfo, [
|
|
208
|
+
"version"
|
|
209
|
+
]);
|
|
210
|
+
const moduleKeyWithoutVersion = getFMId(resModuleInfo);
|
|
211
|
+
const getModuleInfoWithoutVersion = this.getInfoWithoutTypeWithHook(nativeGlobal.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion).value;
|
|
212
|
+
if ((getModuleInfoWithoutVersion == null ? void 0 : getModuleInfoWithoutVersion.version) === version) {
|
|
213
|
+
return getModuleInfoWithoutVersion;
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
return;
|
|
209
217
|
}
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
218
|
+
getGlobalSnapshotInfoByModuleInfo(moduleInfo) {
|
|
219
|
+
return this.getTargetSnapshotInfoByModuleInfo(moduleInfo, nativeGlobal.__FEDERATION__.moduleInfo);
|
|
220
|
+
}
|
|
221
|
+
constructor(loaderHook){
|
|
222
|
+
this.loaderHook = loaderHook;
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const getGlobalSnapshot = ()=>nativeGlobal.__FEDERATION__.moduleInfo;
|
|
213
226
|
const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{
|
|
214
227
|
const moduleKey = getFMId(remoteInfo);
|
|
215
228
|
nativeGlobal.__FEDERATION__.moduleInfo[moduleKey] = moduleDetailInfo;
|
|
@@ -767,4 +780,4 @@ function getGlobalShareScope() {
|
|
|
767
780
|
return Global.__FEDERATION__.__SHARE__;
|
|
768
781
|
}
|
|
769
782
|
|
|
770
|
-
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,
|
|
783
|
+
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, DEFAULT_SCOPE as a, globalLoading as b, getRemoteEntryExports as c, assert as d, getFMId as e, error as f, getGlobalHostPlugins as g, isPlainObject as h, isObject as i, isRemoteInfoWithEntry as j, isPureRemoteEntry as k, getPreloaded as l, setPreloaded as m, getRegisteredShare as n, addGlobalSnapshot as o, setGlobalSnapshotInfoByModuleInfo as p, getGlobalSnapshot as q, GetSnapshotInfoWithHook 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,25 +23,18 @@ 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): void;
|
|
27
|
-
export declare
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
key: string;
|
|
33
|
-
};
|
|
34
|
-
export declare const getGlobalSnapshot: () => GlobalModuleInfo;
|
|
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;
|
|
26
|
+
export declare function setGlobalFederationConstructor(FederationConstructor: typeof FederationHost | undefined, isDebug?: boolean): void;
|
|
27
|
+
export declare class GetSnapshotInfoWithHook {
|
|
28
|
+
loaderHook: FederationHost['loaderHook'];
|
|
29
|
+
constructor(loaderHook: FederationHost['loaderHook']);
|
|
30
|
+
getInfoWithoutTypeWithHook<T extends object>(target: T, key: keyof T): {
|
|
31
|
+
value: T[keyof T] | undefined;
|
|
42
32
|
key: string;
|
|
43
|
-
}
|
|
44
|
-
|
|
33
|
+
};
|
|
34
|
+
getTargetSnapshotInfoByModuleInfo(moduleInfo: Optional<Remote, 'alias'>, snapshot: GlobalModuleInfo): import("@module-federation/sdk").PureConsumerModuleInfo | import("@module-federation/sdk").ManifestProvider | undefined;
|
|
35
|
+
getGlobalSnapshotInfoByModuleInfo(moduleInfo: Optional<Remote, 'alias'>): import("@module-federation/sdk").PureConsumerModuleInfo | import("@module-federation/sdk").ManifestProvider | undefined;
|
|
36
|
+
}
|
|
37
|
+
export declare const getGlobalSnapshot: () => GlobalModuleInfo;
|
|
45
38
|
export declare const setGlobalSnapshotInfoByModuleInfo: (remoteInfo: Remote, moduleDetailInfo: GlobalModuleInfo[string]) => GlobalModuleInfo;
|
|
46
39
|
export declare const addGlobalSnapshot: (moduleInfos: GlobalModuleInfo) => (() => void);
|
|
47
40
|
export declare const getRemoteEntryExports: (name: string, globalName: string | undefined) => {
|
package/dist/src/helpers.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
|
-
import { resetFederationGlobalInfo, getGlobalFederationInstance, setGlobalFederationInstance, getGlobalFederationConstructor, setGlobalFederationConstructor,
|
|
2
|
+
import { resetFederationGlobalInfo, getGlobalFederationInstance, setGlobalFederationInstance, getGlobalFederationConstructor, setGlobalFederationConstructor, getGlobalSnapshot, setGlobalSnapshotInfoByModuleInfo, addGlobalSnapshot, getRemoteEntryExports, registerGlobalPlugins, getGlobalHostPlugins, getPreloaded, setPreloaded, Global } from './global';
|
|
3
3
|
import { getRegisteredShare, getGlobalShareScope } from './utils/share';
|
|
4
4
|
interface IShareUtils {
|
|
5
5
|
getRegisteredShare: typeof getRegisteredShare;
|
|
@@ -13,10 +13,7 @@ interface IGlobalUtils {
|
|
|
13
13
|
setGlobalFederationInstance: typeof setGlobalFederationInstance;
|
|
14
14
|
getGlobalFederationConstructor: typeof getGlobalFederationConstructor;
|
|
15
15
|
setGlobalFederationConstructor: typeof setGlobalFederationConstructor;
|
|
16
|
-
getInfoWithoutType: typeof getInfoWithoutType;
|
|
17
16
|
getGlobalSnapshot: typeof getGlobalSnapshot;
|
|
18
|
-
getTargetSnapshotInfoByModuleInfo: typeof getTargetSnapshotInfoByModuleInfo;
|
|
19
|
-
getGlobalSnapshotInfoByModuleInfo: typeof getGlobalSnapshotInfoByModuleInfo;
|
|
20
17
|
setGlobalSnapshotInfoByModuleInfo: typeof setGlobalSnapshotInfoByModuleInfo;
|
|
21
18
|
addGlobalSnapshot: typeof addGlobalSnapshot;
|
|
22
19
|
getRemoteEntryExports: typeof getRemoteEntryExports;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { GlobalModuleInfo, Manifest, ModuleInfo } from '@module-federation/sdk';
|
|
2
2
|
import { Options, Remote } from '../../type';
|
|
3
|
-
import { getGlobalSnapshot } from '../../global';
|
|
3
|
+
import { getGlobalSnapshot, GetSnapshotInfoWithHook } from '../../global';
|
|
4
4
|
import { PluginSystem, AsyncHook, AsyncWaterfallHook } from '../../utils/hooks';
|
|
5
5
|
import { FederationHost } from '../../core';
|
|
6
6
|
export declare class SnapshotHandler {
|
|
@@ -30,6 +30,7 @@ export declare class SnapshotHandler {
|
|
|
30
30
|
}>;
|
|
31
31
|
loaderHook: FederationHost['loaderHook'];
|
|
32
32
|
manifestLoading: Record<string, Promise<ModuleInfo>>;
|
|
33
|
+
getSnapshotInfoHandler: GetSnapshotInfoWithHook;
|
|
33
34
|
constructor(HostInstance: FederationHost);
|
|
34
35
|
loadSnapshot(moduleInfo: Remote): Promise<{
|
|
35
36
|
remoteSnapshot: GlobalModuleInfo[string] | undefined;
|
|
@@ -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>);
|
|
41
42
|
export type ShareArgs = (SharedBaseArgs & {
|
|
42
|
-
get:
|
|
43
|
+
get: SharedGetter;
|
|
43
44
|
}) | (SharedBaseArgs & {
|
|
44
45
|
lib: () => Module;
|
|
45
46
|
});
|
|
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-20240117093010",
|
|
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-20240117093010"
|
|
49
49
|
}
|
|
50
50
|
}
|