@module-federation/runtime 0.0.0-next-20231229091919 → 0.0.0-next-20231230034830
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 +1 -1
- package/dist/helpers.esm.js +2 -2
- package/dist/index.cjs.js +156 -74
- package/dist/index.esm.js +155 -76
- package/dist/package.json +3 -3
- package/dist/share.cjs.js +136 -113
- package/dist/share.esm.js +136 -113
- package/dist/src/core.d.ts +18 -5
- package/dist/src/global.d.ts +5 -4
- package/dist/src/helpers.d.ts +2 -2
- package/dist/src/index.d.ts +1 -0
- package/dist/src/module/index.d.ts +4 -2
- package/dist/src/type/config.d.ts +6 -2
- package/dist/src/utils/hooks/pluginSystem.d.ts +1 -1
- package/dist/src/utils/share.d.ts +12 -3
- package/dist/types.cjs.d.ts +1 -0
- package/package.json +4 -4
- package/dist/type.cjs.d.ts +0 -1
- /package/dist/{type.cjs.js → types.cjs.js} +0 -0
- /package/dist/{type.esm.js → types.esm.js} +0 -0
package/dist/share.cjs.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
function getBuilderId() {
|
|
4
|
+
//@ts-ignore
|
|
4
5
|
return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined' ? FEDERATION_BUILD_IDENTIFIER : '';
|
|
5
6
|
}
|
|
6
7
|
function isDebugMode() {
|
|
@@ -88,71 +89,61 @@ function _object_without_properties_loose(source, excluded) {
|
|
|
88
89
|
}
|
|
89
90
|
return target;
|
|
90
91
|
}
|
|
92
|
+
var _nativeGlobal___FEDERATION__, _nativeGlobal___FEDERATION__1, _nativeGlobal___FEDERATION__2, _nativeGlobal___FEDERATION__3, _nativeGlobal___FEDERATION__4, _nativeGlobal___FEDERATION__5;
|
|
91
93
|
// export const nativeGlobal: typeof global = new Function('return this')();
|
|
92
94
|
const nativeGlobal = new Function('return this')();
|
|
93
|
-
const Global = nativeGlobal;
|
|
94
|
-
function definePropertyGlobalVal(target, key, val) {
|
|
95
|
-
Object.defineProperty(target, key, {
|
|
96
|
-
value: val,
|
|
97
|
-
configurable: false,
|
|
98
|
-
writable: true
|
|
99
|
-
});
|
|
100
|
-
}
|
|
101
|
-
function includeOwnProperty(target, key) {
|
|
102
|
-
return Object.hasOwnProperty.call(target, key);
|
|
103
|
-
}
|
|
104
95
|
// This section is to prevent encapsulation by certain microfrontend frameworks. Due to reuse policies, sandbox escapes.
|
|
105
96
|
// The sandbox in the microfrontend does not replicate the value of 'configurable'.
|
|
106
97
|
// If there is no loading content on the global object, this section defines the loading object.
|
|
107
|
-
if (!
|
|
108
|
-
|
|
98
|
+
if (!Object.hasOwnProperty.call(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__')) {
|
|
99
|
+
Object.defineProperty(globalThis, '__GLOBAL_LOADING_REMOTE_ENTRY__', {
|
|
100
|
+
value: {},
|
|
101
|
+
configurable: false
|
|
102
|
+
});
|
|
109
103
|
}
|
|
110
104
|
const globalLoading = globalThis.__GLOBAL_LOADING_REMOTE_ENTRY__;
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
105
|
+
//
|
|
106
|
+
if (nativeGlobal.__VMOK__) {
|
|
107
|
+
nativeGlobal.__FEDERATION__ = nativeGlobal.__VMOK__;
|
|
108
|
+
} else if (!nativeGlobal.__FEDERATION__) {
|
|
109
|
+
nativeGlobal.__FEDERATION__ = {
|
|
110
|
+
__GLOBAL_PLUGIN__: [],
|
|
111
|
+
__INSTANCES__: [],
|
|
112
|
+
moduleInfo: {},
|
|
113
|
+
__SHARE__: {},
|
|
114
|
+
__MANIFEST_LOADING__: {},
|
|
115
|
+
__PRELOADED_MAP__: new Map()
|
|
116
|
+
};
|
|
117
|
+
nativeGlobal.__VMOK__ = nativeGlobal.__FEDERATION__;
|
|
118
|
+
}
|
|
119
|
+
var ___GLOBAL_PLUGIN__;
|
|
120
|
+
(___GLOBAL_PLUGIN__ = (_nativeGlobal___FEDERATION__ = nativeGlobal.__FEDERATION__).__GLOBAL_PLUGIN__) != null ? ___GLOBAL_PLUGIN__ : _nativeGlobal___FEDERATION__.__GLOBAL_PLUGIN__ = [];
|
|
121
|
+
var ___INSTANCES__;
|
|
122
|
+
(___INSTANCES__ = (_nativeGlobal___FEDERATION__1 = nativeGlobal.__FEDERATION__).__INSTANCES__) != null ? ___INSTANCES__ : _nativeGlobal___FEDERATION__1.__INSTANCES__ = [];
|
|
123
|
+
var _moduleInfo;
|
|
124
|
+
(_moduleInfo = (_nativeGlobal___FEDERATION__2 = nativeGlobal.__FEDERATION__).moduleInfo) != null ? _moduleInfo : _nativeGlobal___FEDERATION__2.moduleInfo = {};
|
|
125
|
+
var ___SHARE__;
|
|
126
|
+
(___SHARE__ = (_nativeGlobal___FEDERATION__3 = nativeGlobal.__FEDERATION__).__SHARE__) != null ? ___SHARE__ : _nativeGlobal___FEDERATION__3.__SHARE__ = {};
|
|
127
|
+
var ___MANIFEST_LOADING__;
|
|
128
|
+
(___MANIFEST_LOADING__ = (_nativeGlobal___FEDERATION__4 = nativeGlobal.__FEDERATION__).__MANIFEST_LOADING__) != null ? ___MANIFEST_LOADING__ : _nativeGlobal___FEDERATION__4.__MANIFEST_LOADING__ = {};
|
|
129
|
+
var ___PRELOADED_MAP__;
|
|
130
|
+
(___PRELOADED_MAP__ = (_nativeGlobal___FEDERATION__5 = nativeGlobal.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _nativeGlobal___FEDERATION__5.__PRELOADED_MAP__ = new Map();
|
|
131
|
+
const Global = {
|
|
132
|
+
get __FEDERATION__ () {
|
|
133
|
+
const globalThisVal = new Function('return globalThis')();
|
|
134
|
+
return globalThisVal.__FEDERATION__;
|
|
127
135
|
}
|
|
128
|
-
|
|
129
|
-
(___GLOBAL_PLUGIN__ = (_target___FEDERATION__ = target.__FEDERATION__).__GLOBAL_PLUGIN__) != null ? ___GLOBAL_PLUGIN__ : _target___FEDERATION__.__GLOBAL_PLUGIN__ = [];
|
|
130
|
-
var ___INSTANCES__;
|
|
131
|
-
(___INSTANCES__ = (_target___FEDERATION__1 = target.__FEDERATION__).__INSTANCES__) != null ? ___INSTANCES__ : _target___FEDERATION__1.__INSTANCES__ = [];
|
|
132
|
-
var _moduleInfo;
|
|
133
|
-
(_moduleInfo = (_target___FEDERATION__2 = target.__FEDERATION__).moduleInfo) != null ? _moduleInfo : _target___FEDERATION__2.moduleInfo = {};
|
|
134
|
-
var ___SHARE__;
|
|
135
|
-
(___SHARE__ = (_target___FEDERATION__3 = target.__FEDERATION__).__SHARE__) != null ? ___SHARE__ : _target___FEDERATION__3.__SHARE__ = {};
|
|
136
|
-
var ___MANIFEST_LOADING__;
|
|
137
|
-
(___MANIFEST_LOADING__ = (_target___FEDERATION__4 = target.__FEDERATION__).__MANIFEST_LOADING__) != null ? ___MANIFEST_LOADING__ : _target___FEDERATION__4.__MANIFEST_LOADING__ = {};
|
|
138
|
-
var ___SHARE_SCOPE_LOADING__;
|
|
139
|
-
(___SHARE_SCOPE_LOADING__ = (_target___FEDERATION__5 = target.__FEDERATION__).__SHARE_SCOPE_LOADING__) != null ? ___SHARE_SCOPE_LOADING__ : _target___FEDERATION__5.__SHARE_SCOPE_LOADING__ = {};
|
|
140
|
-
var ___PRELOADED_MAP__;
|
|
141
|
-
(___PRELOADED_MAP__ = (_target___FEDERATION__6 = target.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _target___FEDERATION__6.__PRELOADED_MAP__ = new Map();
|
|
142
|
-
}
|
|
143
|
-
setGlobalDefaultVal(globalThis);
|
|
144
|
-
setGlobalDefaultVal(nativeGlobal);
|
|
136
|
+
};
|
|
145
137
|
function resetFederationGlobalInfo() {
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
globalThis.__FEDERATION__.__SHARE_SCOPE_LOADING__ = {};
|
|
138
|
+
nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__ = [];
|
|
139
|
+
nativeGlobal.__FEDERATION__.__INSTANCES__ = [];
|
|
140
|
+
nativeGlobal.__FEDERATION__.moduleInfo = {};
|
|
141
|
+
nativeGlobal.__FEDERATION__.__SHARE__ = {};
|
|
142
|
+
nativeGlobal.__FEDERATION__.__MANIFEST_LOADING__ = {};
|
|
152
143
|
}
|
|
153
144
|
function getGlobalFederationInstance(name, version) {
|
|
154
145
|
const buildId = getBuilderId();
|
|
155
|
-
return
|
|
146
|
+
return Global.__FEDERATION__.__INSTANCES__.find((GMInstance)=>{
|
|
156
147
|
if (buildId && GMInstance.options.id === getBuilderId()) {
|
|
157
148
|
return true;
|
|
158
149
|
}
|
|
@@ -166,15 +157,15 @@ function getGlobalFederationInstance(name, version) {
|
|
|
166
157
|
});
|
|
167
158
|
}
|
|
168
159
|
function setGlobalFederationInstance(FederationInstance) {
|
|
169
|
-
|
|
160
|
+
Global.__FEDERATION__.__INSTANCES__.push(FederationInstance);
|
|
170
161
|
}
|
|
171
162
|
function getGlobalFederationConstructor() {
|
|
172
|
-
return
|
|
163
|
+
return Global.__FEDERATION__.__DEBUG_CONSTRUCTOR__;
|
|
173
164
|
}
|
|
174
165
|
function setGlobalFederationConstructor(FederationConstructor) {
|
|
175
166
|
if (isDebugMode()) {
|
|
176
|
-
|
|
177
|
-
|
|
167
|
+
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
168
|
+
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '0.0.5';
|
|
178
169
|
}
|
|
179
170
|
}
|
|
180
171
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -189,7 +180,7 @@ function getInfoWithoutType(target, key, getModuleInfoHook) {
|
|
|
189
180
|
}
|
|
190
181
|
return res;
|
|
191
182
|
}
|
|
192
|
-
const getGlobalSnapshot = ()=>
|
|
183
|
+
const getGlobalSnapshot = ()=>Global.__FEDERATION__.moduleInfo;
|
|
193
184
|
const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot, getModuleInfoHook)=>{
|
|
194
185
|
// Check if the remote is included in the hostSnapshot
|
|
195
186
|
const moduleKey = getFMId(moduleInfo);
|
|
@@ -207,25 +198,25 @@ const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot, getModuleInfoHo
|
|
|
207
198
|
"version"
|
|
208
199
|
]);
|
|
209
200
|
const moduleKeyWithoutVersion = getFMId(resModuleInfo);
|
|
210
|
-
const getModuleInfoWithoutVersion = getInfoWithoutType(
|
|
201
|
+
const getModuleInfoWithoutVersion = getInfoWithoutType(Global.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion, getModuleInfoHook).value;
|
|
211
202
|
if ((getModuleInfoWithoutVersion == null ? void 0 : getModuleInfoWithoutVersion.version) === version) {
|
|
212
203
|
return getModuleInfoWithoutVersion;
|
|
213
204
|
}
|
|
214
205
|
}
|
|
215
206
|
return;
|
|
216
207
|
};
|
|
217
|
-
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo, extraOptions)=>getTargetSnapshotInfoByModuleInfo(moduleInfo,
|
|
208
|
+
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo, extraOptions)=>getTargetSnapshotInfoByModuleInfo(moduleInfo, Global.__FEDERATION__.moduleInfo, extraOptions == null ? void 0 : extraOptions.getModuleInfoHook);
|
|
218
209
|
const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{
|
|
219
210
|
const moduleKey = getFMId(remoteInfo);
|
|
220
|
-
|
|
221
|
-
return
|
|
211
|
+
Global.__FEDERATION__.moduleInfo[moduleKey] = moduleDetailInfo;
|
|
212
|
+
return Global.__FEDERATION__.moduleInfo;
|
|
222
213
|
};
|
|
223
214
|
const addGlobalSnapshot = (moduleInfos)=>{
|
|
224
|
-
|
|
215
|
+
Global.__FEDERATION__.moduleInfo = _extends$1({}, Global.__FEDERATION__.moduleInfo, moduleInfos);
|
|
225
216
|
return ()=>{
|
|
226
217
|
const keys = Object.keys(moduleInfos);
|
|
227
218
|
for (const key of keys){
|
|
228
|
-
delete
|
|
219
|
+
delete Global.__FEDERATION__.moduleInfo[key];
|
|
229
220
|
}
|
|
230
221
|
};
|
|
231
222
|
};
|
|
@@ -242,7 +233,7 @@ const getRemoteEntryExports = (name, globalName)=>{
|
|
|
242
233
|
// If a plugin is not registered, it is added to the global plugins.
|
|
243
234
|
// If a plugin is already registered, a warning message is logged.
|
|
244
235
|
const registerGlobalPlugins = (plugins)=>{
|
|
245
|
-
const { __GLOBAL_PLUGIN__ } =
|
|
236
|
+
const { __GLOBAL_PLUGIN__ } = Global.__FEDERATION__;
|
|
246
237
|
plugins.forEach((plugin)=>{
|
|
247
238
|
if (__GLOBAL_PLUGIN__.findIndex((p)=>p.name === plugin.name) === -1) {
|
|
248
239
|
__GLOBAL_PLUGIN__.push(plugin);
|
|
@@ -251,9 +242,9 @@ const registerGlobalPlugins = (plugins)=>{
|
|
|
251
242
|
}
|
|
252
243
|
});
|
|
253
244
|
};
|
|
254
|
-
const getGlobalHostPlugins = ()=>
|
|
255
|
-
const getPreloaded = (id)=>
|
|
256
|
-
const setPreloaded = (id)=>
|
|
245
|
+
const getGlobalHostPlugins = ()=>Global.__FEDERATION__.__GLOBAL_PLUGIN__;
|
|
246
|
+
const getPreloaded = (id)=>Global.__FEDERATION__.__PRELOADED_MAP__.get(id);
|
|
247
|
+
const setPreloaded = (id)=>Global.__FEDERATION__.__PRELOADED_MAP__.set(id, true);
|
|
257
248
|
|
|
258
249
|
const DEFAULT_SCOPE = 'default';
|
|
259
250
|
const DEFAULT_REMOTE_TYPE = 'global';
|
|
@@ -623,14 +614,16 @@ function formatShare(shareArgs, from) {
|
|
|
623
614
|
deps: [],
|
|
624
615
|
useIn: [],
|
|
625
616
|
from,
|
|
626
|
-
shareConfig: {
|
|
627
|
-
requiredVersion: `^${shareArgs.version}`,
|
|
628
|
-
singleton: false,
|
|
629
|
-
eager: false
|
|
630
|
-
},
|
|
631
617
|
loading: null
|
|
632
618
|
}, shareArgs, {
|
|
619
|
+
shareConfig: _extends({
|
|
620
|
+
requiredVersion: `^${shareArgs.version}`,
|
|
621
|
+
singleton: false,
|
|
622
|
+
eager: false,
|
|
623
|
+
strictVersion: false
|
|
624
|
+
}, shareArgs.shareConfig),
|
|
633
625
|
get,
|
|
626
|
+
loaded: 'lib' in shareArgs ? true : undefined,
|
|
634
627
|
scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [
|
|
635
628
|
'default'
|
|
636
629
|
],
|
|
@@ -647,15 +640,26 @@ function formatShareConfigs(shareArgs, from) {
|
|
|
647
640
|
}, {});
|
|
648
641
|
}
|
|
649
642
|
function versionLt(a, b) {
|
|
650
|
-
|
|
643
|
+
const transformInvalidVersion = (version)=>{
|
|
644
|
+
const isNumberVersion = !Number.isNaN(Number(version));
|
|
645
|
+
if (isNumberVersion) {
|
|
646
|
+
const splitArr = version.split('.');
|
|
647
|
+
let validVersion = version;
|
|
648
|
+
for(let i = 0; i < 3 - splitArr.length; i++){
|
|
649
|
+
validVersion += '.0';
|
|
650
|
+
}
|
|
651
|
+
return validVersion;
|
|
652
|
+
}
|
|
653
|
+
return version;
|
|
654
|
+
};
|
|
655
|
+
if (satisfy(transformInvalidVersion(a), `<=${transformInvalidVersion(b)}`)) {
|
|
651
656
|
return true;
|
|
652
657
|
} else {
|
|
653
658
|
return false;
|
|
654
659
|
}
|
|
655
660
|
}
|
|
656
|
-
const findVersion = (scope, pkgName, cb)=>{
|
|
657
|
-
const
|
|
658
|
-
const versions = globalShares[scope][pkgName];
|
|
661
|
+
const findVersion = (shareScopeMap, scope, pkgName, cb)=>{
|
|
662
|
+
const versions = shareScopeMap[scope][pkgName];
|
|
659
663
|
const callback = cb || function(prev, cur) {
|
|
660
664
|
return versionLt(prev, cur);
|
|
661
665
|
};
|
|
@@ -666,20 +670,22 @@ const findVersion = (scope, pkgName, cb)=>{
|
|
|
666
670
|
if (callback(prev, cur)) {
|
|
667
671
|
return cur;
|
|
668
672
|
}
|
|
673
|
+
// default version is '0' https://github.com/webpack/webpack/blob/main/lib/sharing/ProvideSharedModule.js#L136
|
|
674
|
+
if (prev === '0') {
|
|
675
|
+
return cur;
|
|
676
|
+
}
|
|
669
677
|
return prev;
|
|
670
678
|
}, 0);
|
|
671
679
|
};
|
|
672
|
-
function findSingletonVersionOrderByVersion(scope, pkgName) {
|
|
673
|
-
const
|
|
674
|
-
const versions = globalShares[scope][pkgName];
|
|
680
|
+
function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
|
|
681
|
+
const versions = shareScopeMap[scope][pkgName];
|
|
675
682
|
const callback = function(prev, cur) {
|
|
676
683
|
return !versions[prev].loaded && versionLt(prev, cur);
|
|
677
684
|
};
|
|
678
|
-
return findVersion(scope, pkgName, callback);
|
|
685
|
+
return findVersion(shareScopeMap, scope, pkgName, callback);
|
|
679
686
|
}
|
|
680
|
-
function findSingletonVersionOrderByLoaded(scope, pkgName) {
|
|
681
|
-
const
|
|
682
|
-
const versions = globalShares[scope][pkgName];
|
|
687
|
+
function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
|
|
688
|
+
const versions = shareScopeMap[scope][pkgName];
|
|
683
689
|
const callback = function(prev, cur) {
|
|
684
690
|
if (versions[cur].loaded) {
|
|
685
691
|
if (versions[prev].loaded) {
|
|
@@ -693,45 +699,62 @@ function findSingletonVersionOrderByLoaded(scope, pkgName) {
|
|
|
693
699
|
}
|
|
694
700
|
return versionLt(prev, cur);
|
|
695
701
|
};
|
|
696
|
-
return findVersion(scope, pkgName, callback);
|
|
702
|
+
return findVersion(shareScopeMap, scope, pkgName, callback);
|
|
703
|
+
}
|
|
704
|
+
function getFindShareFunction(strategy) {
|
|
705
|
+
if (strategy === 'loaded-first') {
|
|
706
|
+
return findSingletonVersionOrderByLoaded;
|
|
707
|
+
}
|
|
708
|
+
return findSingletonVersionOrderByVersion;
|
|
697
709
|
}
|
|
698
710
|
// Details about shared resources
|
|
699
711
|
// TODO: Implement strictVersion for alignment with module federation.
|
|
700
|
-
function
|
|
701
|
-
|
|
712
|
+
function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare) {
|
|
713
|
+
if (!localShareScopeMap) {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
702
716
|
const { shareConfig, scope = DEFAULT_SCOPE, strategy } = shareInfo;
|
|
703
717
|
const scopes = Array.isArray(scope) ? scope : [
|
|
704
718
|
scope
|
|
705
719
|
];
|
|
706
720
|
for (const sc of scopes){
|
|
707
|
-
if (shareConfig &&
|
|
721
|
+
if (shareConfig && localShareScopeMap[sc] && localShareScopeMap[sc][pkgName]) {
|
|
708
722
|
const { requiredVersion } = shareConfig;
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
if (
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
return versionValue;
|
|
723
|
+
const findShareFunction = getFindShareFunction(strategy);
|
|
724
|
+
const maxOrSingletonVersion = findShareFunction(localShareScopeMap, sc, pkgName);
|
|
725
|
+
//@ts-ignore
|
|
726
|
+
const defaultResolver = ()=>{
|
|
727
|
+
if (shareConfig.singleton) {
|
|
728
|
+
if (typeof requiredVersion === 'string' && !satisfy(maxOrSingletonVersion, requiredVersion)) {
|
|
729
|
+
const msg = `Version ${maxOrSingletonVersion} from ${maxOrSingletonVersion && localShareScopeMap[sc][pkgName][maxOrSingletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`;
|
|
730
|
+
if (shareConfig.strictVersion) {
|
|
731
|
+
error(msg);
|
|
732
|
+
} else {
|
|
733
|
+
warn(msg);
|
|
734
|
+
}
|
|
735
|
+
}
|
|
736
|
+
return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
|
|
737
|
+
} else {
|
|
738
|
+
if (requiredVersion === false || requiredVersion === '*') {
|
|
739
|
+
return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
|
|
740
|
+
}
|
|
741
|
+
for (const [versionKey, versionValue] of Object.entries(localShareScopeMap[sc][pkgName])){
|
|
742
|
+
if (satisfy(versionKey, requiredVersion)) {
|
|
743
|
+
return versionValue;
|
|
744
|
+
}
|
|
732
745
|
}
|
|
733
746
|
}
|
|
734
|
-
}
|
|
747
|
+
};
|
|
748
|
+
const params = {
|
|
749
|
+
shareScopeMap: localShareScopeMap,
|
|
750
|
+
scope: sc,
|
|
751
|
+
pkgName,
|
|
752
|
+
version: maxOrSingletonVersion,
|
|
753
|
+
GlobalFederation: Global.__FEDERATION__,
|
|
754
|
+
resolver: defaultResolver
|
|
755
|
+
};
|
|
756
|
+
const resolveShared = resolveShare.emit(params) || params;
|
|
757
|
+
return resolveShared.resolver();
|
|
735
758
|
}
|
|
736
759
|
}
|
|
737
760
|
}
|
|
@@ -752,12 +775,12 @@ exports.getFMId = getFMId;
|
|
|
752
775
|
exports.getGlobalFederationConstructor = getGlobalFederationConstructor;
|
|
753
776
|
exports.getGlobalFederationInstance = getGlobalFederationInstance;
|
|
754
777
|
exports.getGlobalHostPlugins = getGlobalHostPlugins;
|
|
755
|
-
exports.getGlobalShare = getGlobalShare;
|
|
756
778
|
exports.getGlobalShareScope = getGlobalShareScope;
|
|
757
779
|
exports.getGlobalSnapshot = getGlobalSnapshot;
|
|
758
780
|
exports.getGlobalSnapshotInfoByModuleInfo = getGlobalSnapshotInfoByModuleInfo;
|
|
759
781
|
exports.getInfoWithoutType = getInfoWithoutType;
|
|
760
782
|
exports.getPreloaded = getPreloaded;
|
|
783
|
+
exports.getRegisteredShare = getRegisteredShare;
|
|
761
784
|
exports.getRemoteEntryExports = getRemoteEntryExports;
|
|
762
785
|
exports.getTargetSnapshotInfoByModuleInfo = getTargetSnapshotInfoByModuleInfo;
|
|
763
786
|
exports.globalLoading = globalLoading;
|