@module-federation/runtime 0.7.0 → 0.7.2
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/index.cjs.js +8 -8
- package/dist/index.esm.mjs +9 -9
- package/dist/package.json +1 -1
- package/dist/share.cjs.js +23 -18
- package/dist/share.esm.mjs +23 -19
- package/dist/src/global.d.ts +1 -0
- package/package.json +3 -3
package/dist/index.cjs.js
CHANGED
|
@@ -1785,13 +1785,13 @@ class RemoteHandler {
|
|
|
1785
1785
|
if (loadedModule) {
|
|
1786
1786
|
const remoteInfo = loadedModule.remoteInfo;
|
|
1787
1787
|
const key = remoteInfo.entryGlobalName;
|
|
1788
|
-
if (
|
|
1788
|
+
if (share.CurrentGlobal[key]) {
|
|
1789
1789
|
var _Object_getOwnPropertyDescriptor;
|
|
1790
|
-
if ((_Object_getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
|
|
1791
|
-
delete
|
|
1790
|
+
if ((_Object_getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(share.CurrentGlobal, key)) == null ? void 0 : _Object_getOwnPropertyDescriptor.configurable) {
|
|
1791
|
+
delete share.CurrentGlobal[key];
|
|
1792
1792
|
} else {
|
|
1793
1793
|
// @ts-ignore
|
|
1794
|
-
|
|
1794
|
+
share.CurrentGlobal[key] = undefined;
|
|
1795
1795
|
}
|
|
1796
1796
|
}
|
|
1797
1797
|
const remoteEntryUniqueKey = getRemoteEntryUniqueKey(loadedModule.remoteInfo);
|
|
@@ -1801,7 +1801,7 @@ class RemoteHandler {
|
|
|
1801
1801
|
host.snapshotHandler.manifestCache.delete(remoteInfo.entry);
|
|
1802
1802
|
// delete unloaded shared and instance
|
|
1803
1803
|
let remoteInsId = remoteInfo.buildVersion ? sdk.composeKeyWithSeparator(remoteInfo.name, remoteInfo.buildVersion) : remoteInfo.name;
|
|
1804
|
-
const remoteInsIndex =
|
|
1804
|
+
const remoteInsIndex = share.CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((ins)=>{
|
|
1805
1805
|
if (remoteInfo.buildVersion) {
|
|
1806
1806
|
return ins.options.id === remoteInsId;
|
|
1807
1807
|
} else {
|
|
@@ -1809,7 +1809,7 @@ class RemoteHandler {
|
|
|
1809
1809
|
}
|
|
1810
1810
|
});
|
|
1811
1811
|
if (remoteInsIndex !== -1) {
|
|
1812
|
-
const remoteIns =
|
|
1812
|
+
const remoteIns = share.CurrentGlobal.__FEDERATION__.__INSTANCES__[remoteInsIndex];
|
|
1813
1813
|
remoteInsId = remoteIns.options.id || remoteInsId;
|
|
1814
1814
|
const globalShareScopeMap = share.getGlobalShareScope();
|
|
1815
1815
|
let isAllSharedNotUsed = true;
|
|
@@ -1856,7 +1856,7 @@ class RemoteHandler {
|
|
|
1856
1856
|
var _globalShareScopeMap_insId_shareScope_shareName, _globalShareScopeMap_insId_shareScope, _globalShareScopeMap_insId;
|
|
1857
1857
|
(_globalShareScopeMap_insId = globalShareScopeMap[insId]) == null ? true : (_globalShareScopeMap_insId_shareScope = _globalShareScopeMap_insId[shareScope]) == null ? true : (_globalShareScopeMap_insId_shareScope_shareName = _globalShareScopeMap_insId_shareScope[shareName]) == null ? true : delete _globalShareScopeMap_insId_shareScope_shareName[shareVersion];
|
|
1858
1858
|
});
|
|
1859
|
-
|
|
1859
|
+
share.CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(remoteInsIndex, 1);
|
|
1860
1860
|
}
|
|
1861
1861
|
const { hostGlobalSnapshot } = getGlobalRemoteInfo(remote, host);
|
|
1862
1862
|
if (hostGlobalSnapshot) {
|
|
@@ -1999,7 +1999,7 @@ class FederationHost {
|
|
|
1999
1999
|
// maybe will change, temporarily for internal use only
|
|
2000
2000
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
2001
2001
|
});
|
|
2002
|
-
this.version = "0.7.
|
|
2002
|
+
this.version = "0.7.2";
|
|
2003
2003
|
this.moduleCache = new Map();
|
|
2004
2004
|
this.loaderHook = new PluginSystem({
|
|
2005
2005
|
// FIXME: may not be suitable , not open to the public yet
|
package/dist/index.esm.mjs
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { a as _extends, _ as _object_without_properties_loose } from './polyfills.esm.mjs';
|
|
2
2
|
import { isBrowserEnv, loadScriptNode, composeKeyWithSeparator, loadScript, safeToString, createLink, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
|
|
3
3
|
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
4
|
-
import { o as getGlobalHostPlugins, t as globalLoading, D as DEFAULT_REMOTE_TYPE, u as DEFAULT_SCOPE, l as getRemoteEntryExports, v as assert, w as error, x as getFMId, y as isObject, z as warn, A as isPlainObject, B as isRemoteInfoWithEntry, C as isPureRemoteEntry, E as getRemoteEntryInfoFromSnapshot, e as getInfoWithoutType, p as getPreloaded, q as setPreloaded, g as getRegisteredShare, F as arrayOptions, i as getGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, j as setGlobalSnapshotInfoByModuleInfo, G as Global, f as getGlobalSnapshot, H as formatShareConfigs, I as getTargetSharedOptions, a as getGlobalShareScope, J as addUniqueItem, K as
|
|
4
|
+
import { o as getGlobalHostPlugins, t as globalLoading, D as DEFAULT_REMOTE_TYPE, u as DEFAULT_SCOPE, l as getRemoteEntryExports, v as assert, w as error, x as getFMId, y as isObject, z as warn, A as isPlainObject, B as isRemoteInfoWithEntry, C as isPureRemoteEntry, E as getRemoteEntryInfoFromSnapshot, e as getInfoWithoutType, p as getPreloaded, q as setPreloaded, g as getRegisteredShare, F as arrayOptions, i as getGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, j as setGlobalSnapshotInfoByModuleInfo, G as Global, f as getGlobalSnapshot, H as formatShareConfigs, I as getTargetSharedOptions, a as getGlobalShareScope, J as addUniqueItem, K as CurrentGlobal, L as logger, M as getBuilderId, d as setGlobalFederationConstructor, b as getGlobalFederationInstance, c as getGlobalFederationConstructor, s as setGlobalFederationInstance } from './share.esm.mjs';
|
|
5
5
|
export { m as registerGlobalPlugins } from './share.esm.mjs';
|
|
6
6
|
import { getShortErrorMsg, RUNTIME_001, runtimeDescMap, RUNTIME_002, RUNTIME_007, RUNTIME_003, RUNTIME_005, RUNTIME_006, RUNTIME_004 } from '@module-federation/error-codes';
|
|
7
7
|
|
|
@@ -1785,13 +1785,13 @@ class RemoteHandler {
|
|
|
1785
1785
|
if (loadedModule) {
|
|
1786
1786
|
const remoteInfo = loadedModule.remoteInfo;
|
|
1787
1787
|
const key = remoteInfo.entryGlobalName;
|
|
1788
|
-
if (
|
|
1788
|
+
if (CurrentGlobal[key]) {
|
|
1789
1789
|
var _Object_getOwnPropertyDescriptor;
|
|
1790
|
-
if ((_Object_getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(
|
|
1791
|
-
delete
|
|
1790
|
+
if ((_Object_getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(CurrentGlobal, key)) == null ? void 0 : _Object_getOwnPropertyDescriptor.configurable) {
|
|
1791
|
+
delete CurrentGlobal[key];
|
|
1792
1792
|
} else {
|
|
1793
1793
|
// @ts-ignore
|
|
1794
|
-
|
|
1794
|
+
CurrentGlobal[key] = undefined;
|
|
1795
1795
|
}
|
|
1796
1796
|
}
|
|
1797
1797
|
const remoteEntryUniqueKey = getRemoteEntryUniqueKey(loadedModule.remoteInfo);
|
|
@@ -1801,7 +1801,7 @@ class RemoteHandler {
|
|
|
1801
1801
|
host.snapshotHandler.manifestCache.delete(remoteInfo.entry);
|
|
1802
1802
|
// delete unloaded shared and instance
|
|
1803
1803
|
let remoteInsId = remoteInfo.buildVersion ? composeKeyWithSeparator(remoteInfo.name, remoteInfo.buildVersion) : remoteInfo.name;
|
|
1804
|
-
const remoteInsIndex =
|
|
1804
|
+
const remoteInsIndex = CurrentGlobal.__FEDERATION__.__INSTANCES__.findIndex((ins)=>{
|
|
1805
1805
|
if (remoteInfo.buildVersion) {
|
|
1806
1806
|
return ins.options.id === remoteInsId;
|
|
1807
1807
|
} else {
|
|
@@ -1809,7 +1809,7 @@ class RemoteHandler {
|
|
|
1809
1809
|
}
|
|
1810
1810
|
});
|
|
1811
1811
|
if (remoteInsIndex !== -1) {
|
|
1812
|
-
const remoteIns =
|
|
1812
|
+
const remoteIns = CurrentGlobal.__FEDERATION__.__INSTANCES__[remoteInsIndex];
|
|
1813
1813
|
remoteInsId = remoteIns.options.id || remoteInsId;
|
|
1814
1814
|
const globalShareScopeMap = getGlobalShareScope();
|
|
1815
1815
|
let isAllSharedNotUsed = true;
|
|
@@ -1856,7 +1856,7 @@ class RemoteHandler {
|
|
|
1856
1856
|
var _globalShareScopeMap_insId_shareScope_shareName, _globalShareScopeMap_insId_shareScope, _globalShareScopeMap_insId;
|
|
1857
1857
|
(_globalShareScopeMap_insId = globalShareScopeMap[insId]) == null ? true : (_globalShareScopeMap_insId_shareScope = _globalShareScopeMap_insId[shareScope]) == null ? true : (_globalShareScopeMap_insId_shareScope_shareName = _globalShareScopeMap_insId_shareScope[shareName]) == null ? true : delete _globalShareScopeMap_insId_shareScope_shareName[shareVersion];
|
|
1858
1858
|
});
|
|
1859
|
-
|
|
1859
|
+
CurrentGlobal.__FEDERATION__.__INSTANCES__.splice(remoteInsIndex, 1);
|
|
1860
1860
|
}
|
|
1861
1861
|
const { hostGlobalSnapshot } = getGlobalRemoteInfo(remote, host);
|
|
1862
1862
|
if (hostGlobalSnapshot) {
|
|
@@ -1999,7 +1999,7 @@ class FederationHost {
|
|
|
1999
1999
|
// maybe will change, temporarily for internal use only
|
|
2000
2000
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
2001
2001
|
});
|
|
2002
|
-
this.version = "0.7.
|
|
2002
|
+
this.version = "0.7.2";
|
|
2003
2003
|
this.moduleCache = new Map();
|
|
2004
2004
|
this.loaderHook = new PluginSystem({
|
|
2005
2005
|
// FIXME: may not be suitable , not open to the public yet
|
package/dist/package.json
CHANGED
package/dist/share.cjs.js
CHANGED
|
@@ -90,13 +90,14 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
|
|
|
90
90
|
return defaultRemoteEntryInfo;
|
|
91
91
|
}
|
|
92
92
|
|
|
93
|
+
const CurrentGlobal = typeof globalThis === 'object' ? globalThis : window;
|
|
93
94
|
const nativeGlobal = (()=>{
|
|
94
95
|
try {
|
|
95
96
|
// get real window (incase of sandbox)
|
|
96
97
|
return document.defaultView;
|
|
97
98
|
} catch (e) {
|
|
98
99
|
// node env
|
|
99
|
-
return
|
|
100
|
+
return CurrentGlobal;
|
|
100
101
|
}
|
|
101
102
|
})();
|
|
102
103
|
const Global = nativeGlobal;
|
|
@@ -113,10 +114,10 @@ function includeOwnProperty(target, key) {
|
|
|
113
114
|
// This section is to prevent encapsulation by certain microfrontend frameworks. Due to reuse policies, sandbox escapes.
|
|
114
115
|
// The sandbox in the microfrontend does not replicate the value of 'configurable'.
|
|
115
116
|
// If there is no loading content on the global object, this section defines the loading object.
|
|
116
|
-
if (!includeOwnProperty(
|
|
117
|
-
definePropertyGlobalVal(
|
|
117
|
+
if (!includeOwnProperty(CurrentGlobal, '__GLOBAL_LOADING_REMOTE_ENTRY__')) {
|
|
118
|
+
definePropertyGlobalVal(CurrentGlobal, '__GLOBAL_LOADING_REMOTE_ENTRY__', {});
|
|
118
119
|
}
|
|
119
|
-
const globalLoading =
|
|
120
|
+
const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;
|
|
120
121
|
function setGlobalDefaultVal(target) {
|
|
121
122
|
var _target___FEDERATION__, _target___FEDERATION__1, _target___FEDERATION__2, _target___FEDERATION__3, _target___FEDERATION__4, _target___FEDERATION__5;
|
|
122
123
|
if (includeOwnProperty(target, '__VMOK__') && !includeOwnProperty(target, '__FEDERATION__')) {
|
|
@@ -146,18 +147,21 @@ function setGlobalDefaultVal(target) {
|
|
|
146
147
|
var ___PRELOADED_MAP__;
|
|
147
148
|
(___PRELOADED_MAP__ = (_target___FEDERATION__5 = target.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _target___FEDERATION__5.__PRELOADED_MAP__ = new Map();
|
|
148
149
|
}
|
|
149
|
-
setGlobalDefaultVal(
|
|
150
|
+
setGlobalDefaultVal(CurrentGlobal);
|
|
150
151
|
setGlobalDefaultVal(nativeGlobal);
|
|
151
152
|
function resetFederationGlobalInfo() {
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
153
|
+
CurrentGlobal.__FEDERATION__.__GLOBAL_PLUGIN__ = [];
|
|
154
|
+
CurrentGlobal.__FEDERATION__.__INSTANCES__ = [];
|
|
155
|
+
CurrentGlobal.__FEDERATION__.moduleInfo = {};
|
|
156
|
+
CurrentGlobal.__FEDERATION__.__SHARE__ = {};
|
|
157
|
+
CurrentGlobal.__FEDERATION__.__MANIFEST_LOADING__ = {};
|
|
158
|
+
Object.keys(globalLoading).forEach((key)=>{
|
|
159
|
+
delete globalLoading[key];
|
|
160
|
+
});
|
|
157
161
|
}
|
|
158
162
|
function getGlobalFederationInstance(name, version) {
|
|
159
163
|
const buildId = getBuilderId();
|
|
160
|
-
return
|
|
164
|
+
return CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance)=>{
|
|
161
165
|
if (buildId && GMInstance.options.id === getBuilderId()) {
|
|
162
166
|
return true;
|
|
163
167
|
}
|
|
@@ -171,15 +175,15 @@ function getGlobalFederationInstance(name, version) {
|
|
|
171
175
|
});
|
|
172
176
|
}
|
|
173
177
|
function setGlobalFederationInstance(FederationInstance) {
|
|
174
|
-
|
|
178
|
+
CurrentGlobal.__FEDERATION__.__INSTANCES__.push(FederationInstance);
|
|
175
179
|
}
|
|
176
180
|
function getGlobalFederationConstructor() {
|
|
177
|
-
return
|
|
181
|
+
return CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__;
|
|
178
182
|
}
|
|
179
183
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
|
|
180
184
|
if (isDebug) {
|
|
181
|
-
|
|
182
|
-
|
|
185
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
186
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.2";
|
|
183
187
|
}
|
|
184
188
|
}
|
|
185
189
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -255,7 +259,7 @@ const addGlobalSnapshot = (moduleInfos)=>{
|
|
|
255
259
|
};
|
|
256
260
|
const getRemoteEntryExports = (name, globalName)=>{
|
|
257
261
|
const remoteEntryKey = globalName || `__FEDERATION_${name}:custom__`;
|
|
258
|
-
const entryExports =
|
|
262
|
+
const entryExports = CurrentGlobal[remoteEntryKey];
|
|
259
263
|
return {
|
|
260
264
|
remoteEntryKey,
|
|
261
265
|
entryExports
|
|
@@ -276,8 +280,8 @@ const registerGlobalPlugins = (plugins)=>{
|
|
|
276
280
|
});
|
|
277
281
|
};
|
|
278
282
|
const getGlobalHostPlugins = ()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__;
|
|
279
|
-
const getPreloaded = (id)=>
|
|
280
|
-
const setPreloaded = (id)=>
|
|
283
|
+
const getPreloaded = (id)=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(id);
|
|
284
|
+
const setPreloaded = (id)=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(id, true);
|
|
281
285
|
|
|
282
286
|
const DEFAULT_SCOPE = 'default';
|
|
283
287
|
const DEFAULT_REMOTE_TYPE = 'global';
|
|
@@ -877,6 +881,7 @@ function getTargetSharedOptions(options) {
|
|
|
877
881
|
return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
|
|
878
882
|
}
|
|
879
883
|
|
|
884
|
+
exports.CurrentGlobal = CurrentGlobal;
|
|
880
885
|
exports.DEFAULT_REMOTE_TYPE = DEFAULT_REMOTE_TYPE;
|
|
881
886
|
exports.DEFAULT_SCOPE = DEFAULT_SCOPE;
|
|
882
887
|
exports.Global = Global;
|
package/dist/share.esm.mjs
CHANGED
|
@@ -88,13 +88,14 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
|
|
|
88
88
|
return defaultRemoteEntryInfo;
|
|
89
89
|
}
|
|
90
90
|
|
|
91
|
+
const CurrentGlobal = typeof globalThis === 'object' ? globalThis : window;
|
|
91
92
|
const nativeGlobal = (()=>{
|
|
92
93
|
try {
|
|
93
94
|
// get real window (incase of sandbox)
|
|
94
95
|
return document.defaultView;
|
|
95
96
|
} catch (e) {
|
|
96
97
|
// node env
|
|
97
|
-
return
|
|
98
|
+
return CurrentGlobal;
|
|
98
99
|
}
|
|
99
100
|
})();
|
|
100
101
|
const Global = nativeGlobal;
|
|
@@ -111,10 +112,10 @@ function includeOwnProperty(target, key) {
|
|
|
111
112
|
// This section is to prevent encapsulation by certain microfrontend frameworks. Due to reuse policies, sandbox escapes.
|
|
112
113
|
// The sandbox in the microfrontend does not replicate the value of 'configurable'.
|
|
113
114
|
// If there is no loading content on the global object, this section defines the loading object.
|
|
114
|
-
if (!includeOwnProperty(
|
|
115
|
-
definePropertyGlobalVal(
|
|
115
|
+
if (!includeOwnProperty(CurrentGlobal, '__GLOBAL_LOADING_REMOTE_ENTRY__')) {
|
|
116
|
+
definePropertyGlobalVal(CurrentGlobal, '__GLOBAL_LOADING_REMOTE_ENTRY__', {});
|
|
116
117
|
}
|
|
117
|
-
const globalLoading =
|
|
118
|
+
const globalLoading = CurrentGlobal.__GLOBAL_LOADING_REMOTE_ENTRY__;
|
|
118
119
|
function setGlobalDefaultVal(target) {
|
|
119
120
|
var _target___FEDERATION__, _target___FEDERATION__1, _target___FEDERATION__2, _target___FEDERATION__3, _target___FEDERATION__4, _target___FEDERATION__5;
|
|
120
121
|
if (includeOwnProperty(target, '__VMOK__') && !includeOwnProperty(target, '__FEDERATION__')) {
|
|
@@ -144,18 +145,21 @@ function setGlobalDefaultVal(target) {
|
|
|
144
145
|
var ___PRELOADED_MAP__;
|
|
145
146
|
(___PRELOADED_MAP__ = (_target___FEDERATION__5 = target.__FEDERATION__).__PRELOADED_MAP__) != null ? ___PRELOADED_MAP__ : _target___FEDERATION__5.__PRELOADED_MAP__ = new Map();
|
|
146
147
|
}
|
|
147
|
-
setGlobalDefaultVal(
|
|
148
|
+
setGlobalDefaultVal(CurrentGlobal);
|
|
148
149
|
setGlobalDefaultVal(nativeGlobal);
|
|
149
150
|
function resetFederationGlobalInfo() {
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
151
|
+
CurrentGlobal.__FEDERATION__.__GLOBAL_PLUGIN__ = [];
|
|
152
|
+
CurrentGlobal.__FEDERATION__.__INSTANCES__ = [];
|
|
153
|
+
CurrentGlobal.__FEDERATION__.moduleInfo = {};
|
|
154
|
+
CurrentGlobal.__FEDERATION__.__SHARE__ = {};
|
|
155
|
+
CurrentGlobal.__FEDERATION__.__MANIFEST_LOADING__ = {};
|
|
156
|
+
Object.keys(globalLoading).forEach((key)=>{
|
|
157
|
+
delete globalLoading[key];
|
|
158
|
+
});
|
|
155
159
|
}
|
|
156
160
|
function getGlobalFederationInstance(name, version) {
|
|
157
161
|
const buildId = getBuilderId();
|
|
158
|
-
return
|
|
162
|
+
return CurrentGlobal.__FEDERATION__.__INSTANCES__.find((GMInstance)=>{
|
|
159
163
|
if (buildId && GMInstance.options.id === getBuilderId()) {
|
|
160
164
|
return true;
|
|
161
165
|
}
|
|
@@ -169,15 +173,15 @@ function getGlobalFederationInstance(name, version) {
|
|
|
169
173
|
});
|
|
170
174
|
}
|
|
171
175
|
function setGlobalFederationInstance(FederationInstance) {
|
|
172
|
-
|
|
176
|
+
CurrentGlobal.__FEDERATION__.__INSTANCES__.push(FederationInstance);
|
|
173
177
|
}
|
|
174
178
|
function getGlobalFederationConstructor() {
|
|
175
|
-
return
|
|
179
|
+
return CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__;
|
|
176
180
|
}
|
|
177
181
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
178
182
|
if (isDebug) {
|
|
179
|
-
|
|
180
|
-
|
|
183
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
184
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.2";
|
|
181
185
|
}
|
|
182
186
|
}
|
|
183
187
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -253,7 +257,7 @@ const addGlobalSnapshot = (moduleInfos)=>{
|
|
|
253
257
|
};
|
|
254
258
|
const getRemoteEntryExports = (name, globalName)=>{
|
|
255
259
|
const remoteEntryKey = globalName || `__FEDERATION_${name}:custom__`;
|
|
256
|
-
const entryExports =
|
|
260
|
+
const entryExports = CurrentGlobal[remoteEntryKey];
|
|
257
261
|
return {
|
|
258
262
|
remoteEntryKey,
|
|
259
263
|
entryExports
|
|
@@ -274,8 +278,8 @@ const registerGlobalPlugins = (plugins)=>{
|
|
|
274
278
|
});
|
|
275
279
|
};
|
|
276
280
|
const getGlobalHostPlugins = ()=>nativeGlobal.__FEDERATION__.__GLOBAL_PLUGIN__;
|
|
277
|
-
const getPreloaded = (id)=>
|
|
278
|
-
const setPreloaded = (id)=>
|
|
281
|
+
const getPreloaded = (id)=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.get(id);
|
|
282
|
+
const setPreloaded = (id)=>CurrentGlobal.__FEDERATION__.__PRELOADED_MAP__.set(id, true);
|
|
279
283
|
|
|
280
284
|
const DEFAULT_SCOPE = 'default';
|
|
281
285
|
const DEFAULT_REMOTE_TYPE = 'global';
|
|
@@ -875,4 +879,4 @@ function getTargetSharedOptions(options) {
|
|
|
875
879
|
return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
|
|
876
880
|
}
|
|
877
881
|
|
|
878
|
-
export { isPlainObject as A, isRemoteInfoWithEntry as B, isPureRemoteEntry as C, DEFAULT_REMOTE_TYPE as D, getRemoteEntryInfoFromSnapshot as E, arrayOptions as F, Global as G, formatShareConfigs as H, getTargetSharedOptions as I, addUniqueItem as J,
|
|
882
|
+
export { isPlainObject as A, isRemoteInfoWithEntry as B, isPureRemoteEntry as C, DEFAULT_REMOTE_TYPE as D, getRemoteEntryInfoFromSnapshot as E, arrayOptions as F, Global as G, formatShareConfigs as H, getTargetSharedOptions as I, addUniqueItem as J, CurrentGlobal as K, logger as L, getBuilderId as M, getGlobalShareScope as a, getGlobalFederationInstance as b, getGlobalFederationConstructor as c, setGlobalFederationConstructor as d, getInfoWithoutType as e, getGlobalSnapshot as f, getRegisteredShare as g, getTargetSnapshotInfoByModuleInfo as h, getGlobalSnapshotInfoByModuleInfo as i, setGlobalSnapshotInfoByModuleInfo as j, addGlobalSnapshot as k, getRemoteEntryExports as l, registerGlobalPlugins as m, nativeGlobal as n, getGlobalHostPlugins as o, getPreloaded as p, setPreloaded as q, resetFederationGlobalInfo as r, setGlobalFederationInstance as s, globalLoading as t, DEFAULT_SCOPE as u, assert as v, error as w, getFMId as x, isObject as y, warn as z };
|
package/dist/src/global.d.ts
CHANGED
|
@@ -12,6 +12,7 @@ export interface Federation {
|
|
|
12
12
|
__MANIFEST_LOADING__: Record<string, Promise<ModuleInfo>>;
|
|
13
13
|
__PRELOADED_MAP__: Map<string, boolean>;
|
|
14
14
|
}
|
|
15
|
+
export declare const CurrentGlobal: typeof globalThis;
|
|
15
16
|
export declare const nativeGlobal: typeof global;
|
|
16
17
|
export declare const Global: typeof globalThis;
|
|
17
18
|
declare global {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.2",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.mjs",
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@module-federation/sdk": "0.7.
|
|
54
|
-
"@module-federation/error-codes": "0.7.
|
|
53
|
+
"@module-federation/sdk": "0.7.2",
|
|
54
|
+
"@module-federation/error-codes": "0.7.2"
|
|
55
55
|
}
|
|
56
56
|
}
|