@module-federation/runtime 0.0.0-next-20240528100448 → 0.0.0-next-20240528203231
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/helpers.esm.js +1 -1
- package/dist/index.cjs.js +17 -32
- package/dist/index.esm.js +23 -37
- package/dist/share.cjs.js +0 -23
- package/dist/share.esm.js +1 -23
- package/dist/src/index.d.ts +0 -1
- package/dist/src/plugins/snapshot/SnapshotHandler.d.ts +1 -5
- package/dist/src/remote/index.d.ts +0 -4
- package/dist/src/utils/tool.d.ts +1 -6
- package/package.json +2 -2
package/dist/helpers.esm.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { o as getRegisteredShare, y as getGlobalShareScope, G as Global, J as nativeGlobal, K as resetFederationGlobalInfo, E as getGlobalFederationInstance, H as setGlobalFederationInstance, F as getGlobalFederationConstructor, C as setGlobalFederationConstructor, l as getInfoWithoutType, u as getGlobalSnapshot, L as getTargetSnapshotInfoByModuleInfo, q as getGlobalSnapshotInfoByModuleInfo, t as setGlobalSnapshotInfoByModuleInfo, r as addGlobalSnapshot, c as getRemoteEntryExports, I as registerGlobalPlugins, g as getGlobalHostPlugins, m as getPreloaded, n as setPreloaded } from './share.esm.js';
|
|
2
2
|
|
|
3
3
|
const ShareUtils = {
|
|
4
4
|
getRegisteredShare,
|
package/dist/index.cjs.js
CHANGED
|
@@ -142,7 +142,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
142
142
|
`);
|
|
143
143
|
return entryExports;
|
|
144
144
|
}).catch((e)=>{
|
|
145
|
-
|
|
145
|
+
return e;
|
|
146
146
|
});
|
|
147
147
|
}
|
|
148
148
|
return sdk.loadScript(entry, {
|
|
@@ -158,7 +158,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
158
158
|
`);
|
|
159
159
|
return entryExports;
|
|
160
160
|
}).catch((e)=>{
|
|
161
|
-
|
|
161
|
+
return e;
|
|
162
162
|
});
|
|
163
163
|
}
|
|
164
164
|
function getRemoteEntryUniqueKey(remoteInfo) {
|
|
@@ -638,16 +638,13 @@ function _extends$4() {
|
|
|
638
638
|
return _extends$4.apply(this, arguments);
|
|
639
639
|
}
|
|
640
640
|
function assignRemoteInfo(remoteInfo, remoteSnapshot) {
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
share.error(`The attribute remoteEntry of ${remoteInfo.name} must not be undefined.`);
|
|
641
|
+
if (!('remoteEntry' in remoteSnapshot) || !remoteSnapshot.remoteEntry) {
|
|
642
|
+
share.error(`The attribute remoteEntry of ${name} must not be undefined.`);
|
|
644
643
|
}
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
remoteInfo.type = remoteEntryInfo.type;
|
|
650
|
-
remoteInfo.entryGlobalName = remoteEntryInfo.globalName;
|
|
644
|
+
const { remoteEntry } = remoteSnapshot;
|
|
645
|
+
const entryUrl = sdk.getResourceUrl(remoteSnapshot, remoteEntry);
|
|
646
|
+
remoteInfo.type = remoteSnapshot.remoteEntryType;
|
|
647
|
+
remoteInfo.entryGlobalName = remoteSnapshot.globalName;
|
|
651
648
|
remoteInfo.entry = entryUrl;
|
|
652
649
|
remoteInfo.version = remoteSnapshot.version;
|
|
653
650
|
remoteInfo.buildVersion = remoteSnapshot.buildVersion;
|
|
@@ -772,7 +769,7 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
|
|
|
772
769
|
return;
|
|
773
770
|
}
|
|
774
771
|
}
|
|
775
|
-
const remoteEntryUrl = sdk.getResourceUrl(moduleInfoSnapshot,
|
|
772
|
+
const remoteEntryUrl = sdk.getResourceUrl(moduleInfoSnapshot, 'remoteEntry' in moduleInfoSnapshot ? moduleInfoSnapshot.remoteEntry : '');
|
|
776
773
|
if (remoteEntryUrl) {
|
|
777
774
|
entryAssets.push({
|
|
778
775
|
name: remoteInfo.name,
|
|
@@ -978,13 +975,12 @@ class SnapshotHandler {
|
|
|
978
975
|
// global snapshot includes manifest or module info includes manifest
|
|
979
976
|
if (globalRemoteSnapshot) {
|
|
980
977
|
if (sdk.isManifestProvider(globalRemoteSnapshot)) {
|
|
981
|
-
const
|
|
982
|
-
const moduleSnapshot = await this.getManifestJson(remoteEntry, moduleInfo, {});
|
|
978
|
+
const moduleSnapshot = await this.getManifestJson(globalRemoteSnapshot.remoteEntry, moduleInfo, {});
|
|
983
979
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
984
980
|
const globalSnapshotRes = share.setGlobalSnapshotInfoByModuleInfo(_extends$3({}, moduleInfo, {
|
|
985
981
|
// The global remote may be overridden
|
|
986
982
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
987
|
-
entry: remoteEntry
|
|
983
|
+
entry: globalRemoteSnapshot.remoteEntry
|
|
988
984
|
}), moduleSnapshot);
|
|
989
985
|
return {
|
|
990
986
|
remoteSnapshot: moduleSnapshot,
|
|
@@ -1516,10 +1512,6 @@ class RemoteHandler {
|
|
|
1516
1512
|
moduleInstance: module,
|
|
1517
1513
|
origin: host
|
|
1518
1514
|
});
|
|
1519
|
-
this.idToRemoteMap[id] = {
|
|
1520
|
-
name: remote.name,
|
|
1521
|
-
expose
|
|
1522
|
-
};
|
|
1523
1515
|
if (typeof moduleWrapper === 'function') {
|
|
1524
1516
|
return moduleWrapper;
|
|
1525
1517
|
}
|
|
@@ -1686,9 +1678,10 @@ class RemoteHandler {
|
|
|
1686
1678
|
}
|
|
1687
1679
|
const loadedModule = host.moduleCache.get(remote.name);
|
|
1688
1680
|
if (loadedModule) {
|
|
1681
|
+
var _Object_getOwnPropertyDescriptor;
|
|
1689
1682
|
const remoteInfo = loadedModule.remoteInfo;
|
|
1690
1683
|
const key = remoteInfo.entryGlobalName;
|
|
1691
|
-
if (globalThis[key]) {
|
|
1684
|
+
if (globalThis[key] && ((_Object_getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(globalThis, key)) == null ? void 0 : _Object_getOwnPropertyDescriptor.configurable)) {
|
|
1692
1685
|
delete globalThis[key];
|
|
1693
1686
|
}
|
|
1694
1687
|
const remoteEntryUniqueKey = getRemoteEntryUniqueKey(loadedModule.remoteInfo);
|
|
@@ -1711,13 +1704,10 @@ class RemoteHandler {
|
|
|
1711
1704
|
let isAllSharedNotUsed = true;
|
|
1712
1705
|
const needDeleteKeys = [];
|
|
1713
1706
|
Object.keys(globalShareScopeMap).forEach((instId)=>{
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
const sharedPkgs = shareScopeVal[shareName];
|
|
1719
|
-
sharedPkgs && Object.keys(sharedPkgs).forEach((shareVersion)=>{
|
|
1720
|
-
const shared = sharedPkgs[shareVersion];
|
|
1707
|
+
Object.keys(globalShareScopeMap[instId]).forEach((shareScope)=>{
|
|
1708
|
+
Object.keys(globalShareScopeMap[instId][shareScope]).forEach((shareName)=>{
|
|
1709
|
+
Object.keys(globalShareScopeMap[instId][shareScope][shareName]).forEach((shareVersion)=>{
|
|
1710
|
+
const shared = globalShareScopeMap[instId][shareScope][shareName][shareVersion];
|
|
1721
1711
|
if (shared.from === remoteInfo.name) {
|
|
1722
1712
|
if (shared.loaded || shared.loading) {
|
|
1723
1713
|
shared.useIn = shared.useIn.filter((usedHostName)=>usedHostName !== remoteInfo.name);
|
|
@@ -1769,7 +1759,6 @@ class RemoteHandler {
|
|
|
1769
1759
|
afterPreloadRemote: new AsyncHook()
|
|
1770
1760
|
});
|
|
1771
1761
|
this.host = host;
|
|
1772
|
-
this.idToRemoteMap = {};
|
|
1773
1762
|
}
|
|
1774
1763
|
}
|
|
1775
1764
|
|
|
@@ -1981,9 +1970,6 @@ function registerPlugins(...args) {
|
|
|
1981
1970
|
// eslint-disable-next-line prefer-spread
|
|
1982
1971
|
return FederationInstance.registerPlugins.apply(FederationInstance, args);
|
|
1983
1972
|
}
|
|
1984
|
-
function getInstance() {
|
|
1985
|
-
return FederationInstance;
|
|
1986
|
-
}
|
|
1987
1973
|
// Inject for debug
|
|
1988
1974
|
share.setGlobalFederationConstructor(FederationHost);
|
|
1989
1975
|
|
|
@@ -1997,7 +1983,6 @@ Object.defineProperty(exports, 'loadScriptNode', {
|
|
|
1997
1983
|
get: function () { return sdk.loadScriptNode; }
|
|
1998
1984
|
});
|
|
1999
1985
|
exports.FederationHost = FederationHost;
|
|
2000
|
-
exports.getInstance = getInstance;
|
|
2001
1986
|
exports.getRemoteEntry = getRemoteEntry;
|
|
2002
1987
|
exports.getRemoteInfo = getRemoteInfo;
|
|
2003
1988
|
exports.init = init;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { g as getGlobalHostPlugins, a as globalLoading, D as DEFAULT_REMOTE_TYPE, b as DEFAULT_SCOPE, 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
|
|
2
|
-
export {
|
|
3
|
-
import { loadScriptNode, loadScript, composeKeyWithSeparator, createLink, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1, isBrowserEnv
|
|
1
|
+
import { g as getGlobalHostPlugins, a as globalLoading, D as DEFAULT_REMOTE_TYPE, b as DEFAULT_SCOPE, 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 getInfoWithoutType, m as getPreloaded, n as setPreloaded, o as getRegisteredShare, p as arrayOptions, q as getGlobalSnapshotInfoByModuleInfo, r as addGlobalSnapshot, t as setGlobalSnapshotInfoByModuleInfo, u as getGlobalSnapshot, G as Global, v as formatShareConfigs, x as getTargetSharedOptions, y as getGlobalShareScope, z as addUniqueItem, A as getBuilderId, B as isBrowserEnv$1, C as setGlobalFederationConstructor, E as getGlobalFederationInstance, F as getGlobalFederationConstructor, H as setGlobalFederationInstance } from './share.esm.js';
|
|
2
|
+
export { I as registerGlobalPlugins } from './share.esm.js';
|
|
3
|
+
import { loadScriptNode, loadScript, composeKeyWithSeparator, createLink, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1, isBrowserEnv } from '@module-federation/sdk';
|
|
4
4
|
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
5
5
|
|
|
6
6
|
// Function to match a remote with its name and expose
|
|
@@ -140,7 +140,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
140
140
|
`);
|
|
141
141
|
return entryExports;
|
|
142
142
|
}).catch((e)=>{
|
|
143
|
-
|
|
143
|
+
return e;
|
|
144
144
|
});
|
|
145
145
|
}
|
|
146
146
|
return loadScript(entry, {
|
|
@@ -156,7 +156,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
156
156
|
`);
|
|
157
157
|
return entryExports;
|
|
158
158
|
}).catch((e)=>{
|
|
159
|
-
|
|
159
|
+
return e;
|
|
160
160
|
});
|
|
161
161
|
}
|
|
162
162
|
function getRemoteEntryUniqueKey(remoteInfo) {
|
|
@@ -636,16 +636,13 @@ function _extends$4() {
|
|
|
636
636
|
return _extends$4.apply(this, arguments);
|
|
637
637
|
}
|
|
638
638
|
function assignRemoteInfo(remoteInfo, remoteSnapshot) {
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
error(`The attribute remoteEntry of ${remoteInfo.name} must not be undefined.`);
|
|
639
|
+
if (!('remoteEntry' in remoteSnapshot) || !remoteSnapshot.remoteEntry) {
|
|
640
|
+
error(`The attribute remoteEntry of ${name} must not be undefined.`);
|
|
642
641
|
}
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
remoteInfo.type = remoteEntryInfo.type;
|
|
648
|
-
remoteInfo.entryGlobalName = remoteEntryInfo.globalName;
|
|
642
|
+
const { remoteEntry } = remoteSnapshot;
|
|
643
|
+
const entryUrl = getResourceUrl(remoteSnapshot, remoteEntry);
|
|
644
|
+
remoteInfo.type = remoteSnapshot.remoteEntryType;
|
|
645
|
+
remoteInfo.entryGlobalName = remoteSnapshot.globalName;
|
|
649
646
|
remoteInfo.entry = entryUrl;
|
|
650
647
|
remoteInfo.version = remoteSnapshot.version;
|
|
651
648
|
remoteInfo.buildVersion = remoteSnapshot.buildVersion;
|
|
@@ -770,7 +767,7 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
|
|
|
770
767
|
return;
|
|
771
768
|
}
|
|
772
769
|
}
|
|
773
|
-
const remoteEntryUrl = getResourceUrl(moduleInfoSnapshot,
|
|
770
|
+
const remoteEntryUrl = getResourceUrl(moduleInfoSnapshot, 'remoteEntry' in moduleInfoSnapshot ? moduleInfoSnapshot.remoteEntry : '');
|
|
774
771
|
if (remoteEntryUrl) {
|
|
775
772
|
entryAssets.push({
|
|
776
773
|
name: remoteInfo.name,
|
|
@@ -976,13 +973,12 @@ class SnapshotHandler {
|
|
|
976
973
|
// global snapshot includes manifest or module info includes manifest
|
|
977
974
|
if (globalRemoteSnapshot) {
|
|
978
975
|
if (isManifestProvider(globalRemoteSnapshot)) {
|
|
979
|
-
const
|
|
980
|
-
const moduleSnapshot = await this.getManifestJson(remoteEntry, moduleInfo, {});
|
|
976
|
+
const moduleSnapshot = await this.getManifestJson(globalRemoteSnapshot.remoteEntry, moduleInfo, {});
|
|
981
977
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
982
978
|
const globalSnapshotRes = setGlobalSnapshotInfoByModuleInfo(_extends$3({}, moduleInfo, {
|
|
983
979
|
// The global remote may be overridden
|
|
984
980
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
985
|
-
entry: remoteEntry
|
|
981
|
+
entry: globalRemoteSnapshot.remoteEntry
|
|
986
982
|
}), moduleSnapshot);
|
|
987
983
|
return {
|
|
988
984
|
remoteSnapshot: moduleSnapshot,
|
|
@@ -1514,10 +1510,6 @@ class RemoteHandler {
|
|
|
1514
1510
|
moduleInstance: module,
|
|
1515
1511
|
origin: host
|
|
1516
1512
|
});
|
|
1517
|
-
this.idToRemoteMap[id] = {
|
|
1518
|
-
name: remote.name,
|
|
1519
|
-
expose
|
|
1520
|
-
};
|
|
1521
1513
|
if (typeof moduleWrapper === 'function') {
|
|
1522
1514
|
return moduleWrapper;
|
|
1523
1515
|
}
|
|
@@ -1646,7 +1638,7 @@ class RemoteHandler {
|
|
|
1646
1638
|
}
|
|
1647
1639
|
// Set the remote entry to a complete path
|
|
1648
1640
|
if ('entry' in remote) {
|
|
1649
|
-
if (isBrowserEnv
|
|
1641
|
+
if (isBrowserEnv() && !remote.entry.startsWith('http')) {
|
|
1650
1642
|
remote.entry = new URL(remote.entry, window.location.origin).href;
|
|
1651
1643
|
}
|
|
1652
1644
|
}
|
|
@@ -1684,9 +1676,10 @@ class RemoteHandler {
|
|
|
1684
1676
|
}
|
|
1685
1677
|
const loadedModule = host.moduleCache.get(remote.name);
|
|
1686
1678
|
if (loadedModule) {
|
|
1679
|
+
var _Object_getOwnPropertyDescriptor;
|
|
1687
1680
|
const remoteInfo = loadedModule.remoteInfo;
|
|
1688
1681
|
const key = remoteInfo.entryGlobalName;
|
|
1689
|
-
if (globalThis[key]) {
|
|
1682
|
+
if (globalThis[key] && ((_Object_getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor(globalThis, key)) == null ? void 0 : _Object_getOwnPropertyDescriptor.configurable)) {
|
|
1690
1683
|
delete globalThis[key];
|
|
1691
1684
|
}
|
|
1692
1685
|
const remoteEntryUniqueKey = getRemoteEntryUniqueKey(loadedModule.remoteInfo);
|
|
@@ -1709,13 +1702,10 @@ class RemoteHandler {
|
|
|
1709
1702
|
let isAllSharedNotUsed = true;
|
|
1710
1703
|
const needDeleteKeys = [];
|
|
1711
1704
|
Object.keys(globalShareScopeMap).forEach((instId)=>{
|
|
1712
|
-
|
|
1713
|
-
|
|
1714
|
-
|
|
1715
|
-
|
|
1716
|
-
const sharedPkgs = shareScopeVal[shareName];
|
|
1717
|
-
sharedPkgs && Object.keys(sharedPkgs).forEach((shareVersion)=>{
|
|
1718
|
-
const shared = sharedPkgs[shareVersion];
|
|
1705
|
+
Object.keys(globalShareScopeMap[instId]).forEach((shareScope)=>{
|
|
1706
|
+
Object.keys(globalShareScopeMap[instId][shareScope]).forEach((shareName)=>{
|
|
1707
|
+
Object.keys(globalShareScopeMap[instId][shareScope][shareName]).forEach((shareVersion)=>{
|
|
1708
|
+
const shared = globalShareScopeMap[instId][shareScope][shareName][shareVersion];
|
|
1719
1709
|
if (shared.from === remoteInfo.name) {
|
|
1720
1710
|
if (shared.loaded || shared.loading) {
|
|
1721
1711
|
shared.useIn = shared.useIn.filter((usedHostName)=>usedHostName !== remoteInfo.name);
|
|
@@ -1767,7 +1757,6 @@ class RemoteHandler {
|
|
|
1767
1757
|
afterPreloadRemote: new AsyncHook()
|
|
1768
1758
|
});
|
|
1769
1759
|
this.host = host;
|
|
1770
|
-
this.idToRemoteMap = {};
|
|
1771
1760
|
}
|
|
1772
1761
|
}
|
|
1773
1762
|
|
|
@@ -1911,7 +1900,7 @@ class FederationHost {
|
|
|
1911
1900
|
],
|
|
1912
1901
|
remotes: [],
|
|
1913
1902
|
shared: {},
|
|
1914
|
-
inBrowser: isBrowserEnv()
|
|
1903
|
+
inBrowser: isBrowserEnv$1()
|
|
1915
1904
|
};
|
|
1916
1905
|
this.name = userOptions.name;
|
|
1917
1906
|
this.options = defaultOptions;
|
|
@@ -1979,10 +1968,7 @@ function registerPlugins(...args) {
|
|
|
1979
1968
|
// eslint-disable-next-line prefer-spread
|
|
1980
1969
|
return FederationInstance.registerPlugins.apply(FederationInstance, args);
|
|
1981
1970
|
}
|
|
1982
|
-
function getInstance() {
|
|
1983
|
-
return FederationInstance;
|
|
1984
|
-
}
|
|
1985
1971
|
// Inject for debug
|
|
1986
1972
|
setGlobalFederationConstructor(FederationHost);
|
|
1987
1973
|
|
|
1988
|
-
export { FederationHost,
|
|
1974
|
+
export { FederationHost, getRemoteEntry, getRemoteInfo, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerPlugins, registerRemotes };
|
package/dist/share.cjs.js
CHANGED
|
@@ -76,28 +76,6 @@ function arrayOptions(options) {
|
|
|
76
76
|
options
|
|
77
77
|
];
|
|
78
78
|
}
|
|
79
|
-
function getRemoteEntryInfoFromSnapshot(snapshot) {
|
|
80
|
-
const defaultRemoteEntryInfo = {
|
|
81
|
-
url: '',
|
|
82
|
-
type: 'global',
|
|
83
|
-
globalName: ''
|
|
84
|
-
};
|
|
85
|
-
if (isBrowserEnv()) {
|
|
86
|
-
return 'remoteEntry' in snapshot ? {
|
|
87
|
-
url: snapshot.remoteEntry,
|
|
88
|
-
type: snapshot.remoteEntryType,
|
|
89
|
-
globalName: snapshot.globalName
|
|
90
|
-
} : defaultRemoteEntryInfo;
|
|
91
|
-
}
|
|
92
|
-
if ('ssrRemoteEntry' in snapshot) {
|
|
93
|
-
return {
|
|
94
|
-
url: snapshot.ssrRemoteEntry || defaultRemoteEntryInfo.url,
|
|
95
|
-
type: snapshot.ssrRemoteEntryType || defaultRemoteEntryInfo.type,
|
|
96
|
-
globalName: snapshot.globalName
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
return defaultRemoteEntryInfo;
|
|
100
|
-
}
|
|
101
79
|
|
|
102
80
|
function _extends$1() {
|
|
103
81
|
_extends$1 = Object.assign || function(target) {
|
|
@@ -915,7 +893,6 @@ exports.getInfoWithoutType = getInfoWithoutType;
|
|
|
915
893
|
exports.getPreloaded = getPreloaded;
|
|
916
894
|
exports.getRegisteredShare = getRegisteredShare;
|
|
917
895
|
exports.getRemoteEntryExports = getRemoteEntryExports;
|
|
918
|
-
exports.getRemoteEntryInfoFromSnapshot = getRemoteEntryInfoFromSnapshot;
|
|
919
896
|
exports.getTargetSharedOptions = getTargetSharedOptions;
|
|
920
897
|
exports.getTargetSnapshotInfoByModuleInfo = getTargetSnapshotInfoByModuleInfo;
|
|
921
898
|
exports.globalLoading = globalLoading;
|
package/dist/share.esm.js
CHANGED
|
@@ -74,28 +74,6 @@ function arrayOptions(options) {
|
|
|
74
74
|
options
|
|
75
75
|
];
|
|
76
76
|
}
|
|
77
|
-
function getRemoteEntryInfoFromSnapshot(snapshot) {
|
|
78
|
-
const defaultRemoteEntryInfo = {
|
|
79
|
-
url: '',
|
|
80
|
-
type: 'global',
|
|
81
|
-
globalName: ''
|
|
82
|
-
};
|
|
83
|
-
if (isBrowserEnv()) {
|
|
84
|
-
return 'remoteEntry' in snapshot ? {
|
|
85
|
-
url: snapshot.remoteEntry,
|
|
86
|
-
type: snapshot.remoteEntryType,
|
|
87
|
-
globalName: snapshot.globalName
|
|
88
|
-
} : defaultRemoteEntryInfo;
|
|
89
|
-
}
|
|
90
|
-
if ('ssrRemoteEntry' in snapshot) {
|
|
91
|
-
return {
|
|
92
|
-
url: snapshot.ssrRemoteEntry || defaultRemoteEntryInfo.url,
|
|
93
|
-
type: snapshot.ssrRemoteEntryType || defaultRemoteEntryInfo.type,
|
|
94
|
-
globalName: snapshot.globalName
|
|
95
|
-
};
|
|
96
|
-
}
|
|
97
|
-
return defaultRemoteEntryInfo;
|
|
98
|
-
}
|
|
99
77
|
|
|
100
78
|
function _extends$1() {
|
|
101
79
|
_extends$1 = Object.assign || function(target) {
|
|
@@ -892,4 +870,4 @@ function getTargetSharedOptions(options) {
|
|
|
892
870
|
return Object.assign({}, resolver(shareInfos[pkgName]), extraOptions == null ? void 0 : extraOptions.customShareInfo);
|
|
893
871
|
}
|
|
894
872
|
|
|
895
|
-
export {
|
|
873
|
+
export { getBuilderId as A, isBrowserEnv as B, setGlobalFederationConstructor as C, DEFAULT_REMOTE_TYPE as D, getGlobalFederationInstance as E, getGlobalFederationConstructor as F, Global as G, setGlobalFederationInstance as H, registerGlobalPlugins as I, nativeGlobal as J, resetFederationGlobalInfo as K, getTargetSnapshotInfoByModuleInfo as L, globalLoading as a, DEFAULT_SCOPE 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, getInfoWithoutType as l, getPreloaded as m, setPreloaded as n, getRegisteredShare as o, arrayOptions as p, getGlobalSnapshotInfoByModuleInfo as q, addGlobalSnapshot as r, safeToString as s, setGlobalSnapshotInfoByModuleInfo as t, getGlobalSnapshot as u, formatShareConfigs as v, warn as w, getTargetSharedOptions as x, getGlobalShareScope as y, addUniqueItem as z };
|
package/dist/src/index.d.ts
CHANGED
|
@@ -13,4 +13,3 @@ export declare function loadShareSync<T>(...args: Parameters<FederationHost['loa
|
|
|
13
13
|
export declare function preloadRemote(...args: Parameters<FederationHost['preloadRemote']>): ReturnType<FederationHost['preloadRemote']>;
|
|
14
14
|
export declare function registerRemotes(...args: Parameters<FederationHost['registerRemotes']>): ReturnType<FederationHost['registerRemotes']>;
|
|
15
15
|
export declare function registerPlugins(...args: Parameters<FederationHost['registerPlugins']>): ReturnType<FederationHost['registerRemotes']>;
|
|
16
|
-
export declare function getInstance(): FederationHost | null;
|
|
@@ -39,10 +39,6 @@ export declare class SnapshotHandler {
|
|
|
39
39
|
remoteSnapshot: ModuleInfo;
|
|
40
40
|
globalSnapshot: GlobalModuleInfo;
|
|
41
41
|
}> | never;
|
|
42
|
-
getGlobalRemoteInfo
|
|
43
|
-
hostGlobalSnapshot: ModuleInfo | undefined;
|
|
44
|
-
globalSnapshot: ReturnType<typeof getGlobalSnapshot>;
|
|
45
|
-
remoteSnapshot: GlobalModuleInfo[string] | undefined;
|
|
46
|
-
};
|
|
42
|
+
private getGlobalRemoteInfo;
|
|
47
43
|
private getManifestJson;
|
|
48
44
|
}
|
|
@@ -15,10 +15,6 @@ export interface LoadRemoteMatch {
|
|
|
15
15
|
}
|
|
16
16
|
export declare class RemoteHandler {
|
|
17
17
|
host: FederationHost;
|
|
18
|
-
idToRemoteMap: Record<string, {
|
|
19
|
-
name: string;
|
|
20
|
-
expose: string;
|
|
21
|
-
}>;
|
|
22
18
|
hooks: PluginSystem<{
|
|
23
19
|
beforeRequest: AsyncWaterfallHook<{
|
|
24
20
|
id: string;
|
package/dist/src/utils/tool.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RemoteWithEntry
|
|
1
|
+
import type { RemoteWithEntry } from '@module-federation/sdk';
|
|
2
2
|
import { Remote, RemoteInfoOptionalVersion } from '../type';
|
|
3
3
|
export declare function addUniqueItem(arr: Array<string>, item: string): Array<string>;
|
|
4
4
|
export declare function getFMId(remoteInfo: RemoteInfoOptionalVersion | RemoteWithEntry): string;
|
|
@@ -11,8 +11,3 @@ export declare const objectToString: () => string;
|
|
|
11
11
|
export declare function isPlainObject(val: any): val is object;
|
|
12
12
|
export declare function isStaticResourcesEqual(url1: string, url2: string): boolean;
|
|
13
13
|
export declare function arrayOptions<T>(options: T | Array<T>): Array<T>;
|
|
14
|
-
export declare function getRemoteEntryInfoFromSnapshot(snapshot: ModuleInfo): {
|
|
15
|
-
url: string;
|
|
16
|
-
type: RemoteEntryType;
|
|
17
|
-
globalName: string;
|
|
18
|
-
};
|
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-20240528203231",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
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-20240528203231"
|
|
49
49
|
}
|
|
50
50
|
}
|