@module-federation/runtime 0.0.0-next-20231229074949 → 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 -115
- package/dist/share.esm.js +136 -115
- 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,73 +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
|
-
|
|
127
|
-
|
|
128
|
-
|
|
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__;
|
|
129
135
|
}
|
|
130
|
-
|
|
131
|
-
(___GLOBAL_PLUGIN__ = (_target___FEDERATION__ = target.__FEDERATION__).__GLOBAL_PLUGIN__) != null ? ___GLOBAL_PLUGIN__ : _target___FEDERATION__.__GLOBAL_PLUGIN__ = [];
|
|
132
|
-
var ___INSTANCES__;
|
|
133
|
-
(___INSTANCES__ = (_target___FEDERATION__1 = target.__FEDERATION__).__INSTANCES__) != null ? ___INSTANCES__ : _target___FEDERATION__1.__INSTANCES__ = [];
|
|
134
|
-
var _moduleInfo;
|
|
135
|
-
(_moduleInfo = (_target___FEDERATION__2 = target.__FEDERATION__).moduleInfo) != null ? _moduleInfo : _target___FEDERATION__2.moduleInfo = {};
|
|
136
|
-
var ___SHARE__;
|
|
137
|
-
(___SHARE__ = (_target___FEDERATION__3 = target.__FEDERATION__).__SHARE__) != null ? ___SHARE__ : _target___FEDERATION__3.__SHARE__ = {};
|
|
138
|
-
var ___MANIFEST_LOADING__;
|
|
139
|
-
(___MANIFEST_LOADING__ = (_target___FEDERATION__4 = target.__FEDERATION__).__MANIFEST_LOADING__) != null ? ___MANIFEST_LOADING__ : _target___FEDERATION__4.__MANIFEST_LOADING__ = {};
|
|
140
|
-
var ___SHARE_SCOPE_LOADING__;
|
|
141
|
-
(___SHARE_SCOPE_LOADING__ = (_target___FEDERATION__5 = target.__FEDERATION__).__SHARE_SCOPE_LOADING__) != null ? ___SHARE_SCOPE_LOADING__ : _target___FEDERATION__5.__SHARE_SCOPE_LOADING__ = {};
|
|
142
|
-
var ___PRELOADED_MAP__;
|
|
143
|
-
(___PRELOADED_MAP__ = (_target___FEDERATION__6 = target.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _target___FEDERATION__6.__PRELOADED_MAP__ = new Map();
|
|
144
|
-
}
|
|
145
|
-
setGlobalDefaultVal(globalThis);
|
|
146
|
-
setGlobalDefaultVal(nativeGlobal);
|
|
136
|
+
};
|
|
147
137
|
function resetFederationGlobalInfo() {
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
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__ = {};
|
|
154
143
|
}
|
|
155
144
|
function getGlobalFederationInstance(name, version) {
|
|
156
145
|
const buildId = getBuilderId();
|
|
157
|
-
return
|
|
146
|
+
return Global.__FEDERATION__.__INSTANCES__.find((GMInstance)=>{
|
|
158
147
|
if (buildId && GMInstance.options.id === getBuilderId()) {
|
|
159
148
|
return true;
|
|
160
149
|
}
|
|
@@ -168,15 +157,15 @@ function getGlobalFederationInstance(name, version) {
|
|
|
168
157
|
});
|
|
169
158
|
}
|
|
170
159
|
function setGlobalFederationInstance(FederationInstance) {
|
|
171
|
-
|
|
160
|
+
Global.__FEDERATION__.__INSTANCES__.push(FederationInstance);
|
|
172
161
|
}
|
|
173
162
|
function getGlobalFederationConstructor() {
|
|
174
|
-
return
|
|
163
|
+
return Global.__FEDERATION__.__DEBUG_CONSTRUCTOR__;
|
|
175
164
|
}
|
|
176
165
|
function setGlobalFederationConstructor(FederationConstructor) {
|
|
177
166
|
if (isDebugMode()) {
|
|
178
|
-
|
|
179
|
-
|
|
167
|
+
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
168
|
+
Global.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '0.0.5';
|
|
180
169
|
}
|
|
181
170
|
}
|
|
182
171
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -191,7 +180,7 @@ function getInfoWithoutType(target, key, getModuleInfoHook) {
|
|
|
191
180
|
}
|
|
192
181
|
return res;
|
|
193
182
|
}
|
|
194
|
-
const getGlobalSnapshot = ()=>
|
|
183
|
+
const getGlobalSnapshot = ()=>Global.__FEDERATION__.moduleInfo;
|
|
195
184
|
const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot, getModuleInfoHook)=>{
|
|
196
185
|
// Check if the remote is included in the hostSnapshot
|
|
197
186
|
const moduleKey = getFMId(moduleInfo);
|
|
@@ -209,25 +198,25 @@ const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot, getModuleInfoHo
|
|
|
209
198
|
"version"
|
|
210
199
|
]);
|
|
211
200
|
const moduleKeyWithoutVersion = getFMId(resModuleInfo);
|
|
212
|
-
const getModuleInfoWithoutVersion = getInfoWithoutType(
|
|
201
|
+
const getModuleInfoWithoutVersion = getInfoWithoutType(Global.__FEDERATION__.moduleInfo, moduleKeyWithoutVersion, getModuleInfoHook).value;
|
|
213
202
|
if ((getModuleInfoWithoutVersion == null ? void 0 : getModuleInfoWithoutVersion.version) === version) {
|
|
214
203
|
return getModuleInfoWithoutVersion;
|
|
215
204
|
}
|
|
216
205
|
}
|
|
217
206
|
return;
|
|
218
207
|
};
|
|
219
|
-
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo, extraOptions)=>getTargetSnapshotInfoByModuleInfo(moduleInfo,
|
|
208
|
+
const getGlobalSnapshotInfoByModuleInfo = (moduleInfo, extraOptions)=>getTargetSnapshotInfoByModuleInfo(moduleInfo, Global.__FEDERATION__.moduleInfo, extraOptions == null ? void 0 : extraOptions.getModuleInfoHook);
|
|
220
209
|
const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{
|
|
221
210
|
const moduleKey = getFMId(remoteInfo);
|
|
222
|
-
|
|
223
|
-
return
|
|
211
|
+
Global.__FEDERATION__.moduleInfo[moduleKey] = moduleDetailInfo;
|
|
212
|
+
return Global.__FEDERATION__.moduleInfo;
|
|
224
213
|
};
|
|
225
214
|
const addGlobalSnapshot = (moduleInfos)=>{
|
|
226
|
-
|
|
215
|
+
Global.__FEDERATION__.moduleInfo = _extends$1({}, Global.__FEDERATION__.moduleInfo, moduleInfos);
|
|
227
216
|
return ()=>{
|
|
228
217
|
const keys = Object.keys(moduleInfos);
|
|
229
218
|
for (const key of keys){
|
|
230
|
-
delete
|
|
219
|
+
delete Global.__FEDERATION__.moduleInfo[key];
|
|
231
220
|
}
|
|
232
221
|
};
|
|
233
222
|
};
|
|
@@ -244,7 +233,7 @@ const getRemoteEntryExports = (name, globalName)=>{
|
|
|
244
233
|
// If a plugin is not registered, it is added to the global plugins.
|
|
245
234
|
// If a plugin is already registered, a warning message is logged.
|
|
246
235
|
const registerGlobalPlugins = (plugins)=>{
|
|
247
|
-
const { __GLOBAL_PLUGIN__ } =
|
|
236
|
+
const { __GLOBAL_PLUGIN__ } = Global.__FEDERATION__;
|
|
248
237
|
plugins.forEach((plugin)=>{
|
|
249
238
|
if (__GLOBAL_PLUGIN__.findIndex((p)=>p.name === plugin.name) === -1) {
|
|
250
239
|
__GLOBAL_PLUGIN__.push(plugin);
|
|
@@ -253,9 +242,9 @@ const registerGlobalPlugins = (plugins)=>{
|
|
|
253
242
|
}
|
|
254
243
|
});
|
|
255
244
|
};
|
|
256
|
-
const getGlobalHostPlugins = ()=>
|
|
257
|
-
const getPreloaded = (id)=>
|
|
258
|
-
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);
|
|
259
248
|
|
|
260
249
|
const DEFAULT_SCOPE = 'default';
|
|
261
250
|
const DEFAULT_REMOTE_TYPE = 'global';
|
|
@@ -625,14 +614,16 @@ function formatShare(shareArgs, from) {
|
|
|
625
614
|
deps: [],
|
|
626
615
|
useIn: [],
|
|
627
616
|
from,
|
|
628
|
-
shareConfig: {
|
|
629
|
-
requiredVersion: `^${shareArgs.version}`,
|
|
630
|
-
singleton: false,
|
|
631
|
-
eager: false
|
|
632
|
-
},
|
|
633
617
|
loading: null
|
|
634
618
|
}, shareArgs, {
|
|
619
|
+
shareConfig: _extends({
|
|
620
|
+
requiredVersion: `^${shareArgs.version}`,
|
|
621
|
+
singleton: false,
|
|
622
|
+
eager: false,
|
|
623
|
+
strictVersion: false
|
|
624
|
+
}, shareArgs.shareConfig),
|
|
635
625
|
get,
|
|
626
|
+
loaded: 'lib' in shareArgs ? true : undefined,
|
|
636
627
|
scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [
|
|
637
628
|
'default'
|
|
638
629
|
],
|
|
@@ -649,15 +640,26 @@ function formatShareConfigs(shareArgs, from) {
|
|
|
649
640
|
}, {});
|
|
650
641
|
}
|
|
651
642
|
function versionLt(a, b) {
|
|
652
|
-
|
|
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)}`)) {
|
|
653
656
|
return true;
|
|
654
657
|
} else {
|
|
655
658
|
return false;
|
|
656
659
|
}
|
|
657
660
|
}
|
|
658
|
-
const findVersion = (scope, pkgName, cb)=>{
|
|
659
|
-
const
|
|
660
|
-
const versions = globalShares[scope][pkgName];
|
|
661
|
+
const findVersion = (shareScopeMap, scope, pkgName, cb)=>{
|
|
662
|
+
const versions = shareScopeMap[scope][pkgName];
|
|
661
663
|
const callback = cb || function(prev, cur) {
|
|
662
664
|
return versionLt(prev, cur);
|
|
663
665
|
};
|
|
@@ -668,20 +670,22 @@ const findVersion = (scope, pkgName, cb)=>{
|
|
|
668
670
|
if (callback(prev, cur)) {
|
|
669
671
|
return cur;
|
|
670
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
|
+
}
|
|
671
677
|
return prev;
|
|
672
678
|
}, 0);
|
|
673
679
|
};
|
|
674
|
-
function findSingletonVersionOrderByVersion(scope, pkgName) {
|
|
675
|
-
const
|
|
676
|
-
const versions = globalShares[scope][pkgName];
|
|
680
|
+
function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
|
|
681
|
+
const versions = shareScopeMap[scope][pkgName];
|
|
677
682
|
const callback = function(prev, cur) {
|
|
678
683
|
return !versions[prev].loaded && versionLt(prev, cur);
|
|
679
684
|
};
|
|
680
|
-
return findVersion(scope, pkgName, callback);
|
|
685
|
+
return findVersion(shareScopeMap, scope, pkgName, callback);
|
|
681
686
|
}
|
|
682
|
-
function findSingletonVersionOrderByLoaded(scope, pkgName) {
|
|
683
|
-
const
|
|
684
|
-
const versions = globalShares[scope][pkgName];
|
|
687
|
+
function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
|
|
688
|
+
const versions = shareScopeMap[scope][pkgName];
|
|
685
689
|
const callback = function(prev, cur) {
|
|
686
690
|
if (versions[cur].loaded) {
|
|
687
691
|
if (versions[prev].loaded) {
|
|
@@ -695,45 +699,62 @@ function findSingletonVersionOrderByLoaded(scope, pkgName) {
|
|
|
695
699
|
}
|
|
696
700
|
return versionLt(prev, cur);
|
|
697
701
|
};
|
|
698
|
-
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;
|
|
699
709
|
}
|
|
700
710
|
// Details about shared resources
|
|
701
711
|
// TODO: Implement strictVersion for alignment with module federation.
|
|
702
|
-
function
|
|
703
|
-
|
|
712
|
+
function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare) {
|
|
713
|
+
if (!localShareScopeMap) {
|
|
714
|
+
return;
|
|
715
|
+
}
|
|
704
716
|
const { shareConfig, scope = DEFAULT_SCOPE, strategy } = shareInfo;
|
|
705
717
|
const scopes = Array.isArray(scope) ? scope : [
|
|
706
718
|
scope
|
|
707
719
|
];
|
|
708
720
|
for (const sc of scopes){
|
|
709
|
-
if (shareConfig &&
|
|
721
|
+
if (shareConfig && localShareScopeMap[sc] && localShareScopeMap[sc][pkgName]) {
|
|
710
722
|
const { requiredVersion } = shareConfig;
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
if (
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
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
|
+
}
|
|
734
745
|
}
|
|
735
746
|
}
|
|
736
|
-
}
|
|
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();
|
|
737
758
|
}
|
|
738
759
|
}
|
|
739
760
|
}
|
|
@@ -754,12 +775,12 @@ exports.getFMId = getFMId;
|
|
|
754
775
|
exports.getGlobalFederationConstructor = getGlobalFederationConstructor;
|
|
755
776
|
exports.getGlobalFederationInstance = getGlobalFederationInstance;
|
|
756
777
|
exports.getGlobalHostPlugins = getGlobalHostPlugins;
|
|
757
|
-
exports.getGlobalShare = getGlobalShare;
|
|
758
778
|
exports.getGlobalShareScope = getGlobalShareScope;
|
|
759
779
|
exports.getGlobalSnapshot = getGlobalSnapshot;
|
|
760
780
|
exports.getGlobalSnapshotInfoByModuleInfo = getGlobalSnapshotInfoByModuleInfo;
|
|
761
781
|
exports.getInfoWithoutType = getInfoWithoutType;
|
|
762
782
|
exports.getPreloaded = getPreloaded;
|
|
783
|
+
exports.getRegisteredShare = getRegisteredShare;
|
|
763
784
|
exports.getRemoteEntryExports = getRemoteEntryExports;
|
|
764
785
|
exports.getTargetSnapshotInfoByModuleInfo = getTargetSnapshotInfoByModuleInfo;
|
|
765
786
|
exports.globalLoading = globalLoading;
|