@module-federation/runtime 0.0.0-next-20240909073915 → 0.0.0-next-20240909092952
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 -1
- package/dist/helpers.esm.js +0 -1
- package/dist/index.cjs.js +138 -18
- package/dist/index.esm.js +137 -16
- package/dist/package.json +1 -6
- package/dist/share.cjs.js +46 -7
- package/dist/share.esm.js +42 -3
- package/dist/src/core.d.ts +1 -3
- package/dist/src/index.d.ts +0 -1
- package/dist/src/module/index.d.ts +1 -2
- package/dist/src/remote/index.d.ts +2 -2
- package/dist/src/utils/env.d.ts +0 -1
- package/package.json +2 -7
- package/dist/embedded.cjs.d.ts +0 -1
- package/dist/embedded.cjs.js +0 -20
- package/dist/embedded.esm.js +0 -3
- package/dist/polyfills.cjs.js +0 -28
- package/dist/polyfills.esm.js +0 -25
- package/dist/src/embedded.d.ts +0 -2
package/dist/helpers.cjs.js
CHANGED
package/dist/helpers.esm.js
CHANGED
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { o as getRegisteredShare, y as getGlobalShareScope, G as Global, I as nativeGlobal, J as resetFederationGlobalInfo, C as getGlobalFederationInstance, F as setGlobalFederationInstance, E as getGlobalFederationConstructor, B as setGlobalFederationConstructor, m as getInfoWithoutType, u as getGlobalSnapshot, K as getTargetSnapshotInfoByModuleInfo, q as getGlobalSnapshotInfoByModuleInfo, t as setGlobalSnapshotInfoByModuleInfo, r as addGlobalSnapshot, c as getRemoteEntryExports, H as registerGlobalPlugins, g as getGlobalHostPlugins, n as getPreloaded, s as setPreloaded } from './share.esm.js';
|
|
2
|
-
import './polyfills.esm.js';
|
|
3
2
|
import '@module-federation/sdk';
|
|
4
3
|
|
|
5
4
|
const ShareUtils = {
|
package/dist/index.cjs.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var polyfills = require('./polyfills.cjs.js');
|
|
6
5
|
var sdk = require('@module-federation/sdk');
|
|
7
6
|
var share = require('./share.cjs.js');
|
|
8
7
|
|
|
@@ -90,6 +89,20 @@ function registerPlugins$1(plugins, hookInstances) {
|
|
|
90
89
|
return plugins;
|
|
91
90
|
}
|
|
92
91
|
|
|
92
|
+
function _extends$7() {
|
|
93
|
+
_extends$7 = Object.assign || function(target) {
|
|
94
|
+
for(var i = 1; i < arguments.length; i++){
|
|
95
|
+
var source = arguments[i];
|
|
96
|
+
for(var key in source){
|
|
97
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
98
|
+
target[key] = source[key];
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
return target;
|
|
103
|
+
};
|
|
104
|
+
return _extends$7.apply(this, arguments);
|
|
105
|
+
}
|
|
93
106
|
async function loadEsmEntry({ entry, remoteEntryExports }) {
|
|
94
107
|
return new Promise((resolve, reject)=>{
|
|
95
108
|
try {
|
|
@@ -252,7 +265,7 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
|
|
|
252
265
|
return share.globalLoading[uniqueKey];
|
|
253
266
|
}
|
|
254
267
|
function getRemoteInfo(remote) {
|
|
255
|
-
return
|
|
268
|
+
return _extends$7({}, remote, {
|
|
256
269
|
entry: 'entry' in remote ? remote.entry : '',
|
|
257
270
|
type: remote.type || share.DEFAULT_REMOTE_TYPE,
|
|
258
271
|
entryGlobalName: remote.entryGlobalName || remote.name,
|
|
@@ -260,6 +273,20 @@ function getRemoteInfo(remote) {
|
|
|
260
273
|
});
|
|
261
274
|
}
|
|
262
275
|
|
|
276
|
+
function _extends$6() {
|
|
277
|
+
_extends$6 = Object.assign || function(target) {
|
|
278
|
+
for(var i = 1; i < arguments.length; i++){
|
|
279
|
+
var source = arguments[i];
|
|
280
|
+
for(var key in source){
|
|
281
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
282
|
+
target[key] = source[key];
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return target;
|
|
287
|
+
};
|
|
288
|
+
return _extends$6.apply(this, arguments);
|
|
289
|
+
}
|
|
263
290
|
let Module = class Module {
|
|
264
291
|
async getEntry() {
|
|
265
292
|
if (this.remoteEntryExports) {
|
|
@@ -276,7 +303,7 @@ let Module = class Module {
|
|
|
276
303
|
return this.remoteEntryExports;
|
|
277
304
|
}
|
|
278
305
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
279
|
-
async get(id, expose, options
|
|
306
|
+
async get(id, expose, options) {
|
|
280
307
|
const { loadFactory = true } = options || {
|
|
281
308
|
loadFactory: true
|
|
282
309
|
};
|
|
@@ -311,9 +338,7 @@ let Module = class Module {
|
|
|
311
338
|
console.error('The remote entry interface does not contain "init"', '\n', 'Ensure the name of this remote is not reserved or in use. Check if anything already exists on window[nameOfRemote]', '\n', 'Ensure that window[nameOfRemote] is returning a {get,init} object.');
|
|
312
339
|
}
|
|
313
340
|
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
314
|
-
await this.host.hooks.lifecycle.initContainer.emit(
|
|
315
|
-
id,
|
|
316
|
-
remoteSnapshot,
|
|
341
|
+
await this.host.hooks.lifecycle.initContainer.emit(_extends$6({}, initContainerOptions, {
|
|
317
342
|
remoteEntryExports
|
|
318
343
|
}));
|
|
319
344
|
}
|
|
@@ -549,8 +574,22 @@ class PluginSystem {
|
|
|
549
574
|
}
|
|
550
575
|
}
|
|
551
576
|
|
|
577
|
+
function _extends$5() {
|
|
578
|
+
_extends$5 = Object.assign || function(target) {
|
|
579
|
+
for(var i = 1; i < arguments.length; i++){
|
|
580
|
+
var source = arguments[i];
|
|
581
|
+
for(var key in source){
|
|
582
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
583
|
+
target[key] = source[key];
|
|
584
|
+
}
|
|
585
|
+
}
|
|
586
|
+
}
|
|
587
|
+
return target;
|
|
588
|
+
};
|
|
589
|
+
return _extends$5.apply(this, arguments);
|
|
590
|
+
}
|
|
552
591
|
function defaultPreloadArgs(preloadConfig) {
|
|
553
|
-
return
|
|
592
|
+
return _extends$5({
|
|
554
593
|
resourceCategory: 'sync',
|
|
555
594
|
share: true,
|
|
556
595
|
depsRemote: true,
|
|
@@ -706,6 +745,20 @@ useLinkPreload = true) {
|
|
|
706
745
|
}
|
|
707
746
|
}
|
|
708
747
|
|
|
748
|
+
function _extends$4() {
|
|
749
|
+
_extends$4 = Object.assign || function(target) {
|
|
750
|
+
for(var i = 1; i < arguments.length; i++){
|
|
751
|
+
var source = arguments[i];
|
|
752
|
+
for(var key in source){
|
|
753
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
754
|
+
target[key] = source[key];
|
|
755
|
+
}
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
return target;
|
|
759
|
+
};
|
|
760
|
+
return _extends$4.apply(this, arguments);
|
|
761
|
+
}
|
|
709
762
|
function assignRemoteInfo(remoteInfo, remoteSnapshot) {
|
|
710
763
|
const remoteEntryInfo = share.getRemoteEntryInfoFromSnapshot(remoteSnapshot);
|
|
711
764
|
if (!remoteEntryInfo.url) {
|
|
@@ -753,7 +806,7 @@ function snapshotPlugin() {
|
|
|
753
806
|
if (assets) {
|
|
754
807
|
preloadAssets(remoteInfo, origin, assets, false);
|
|
755
808
|
}
|
|
756
|
-
return
|
|
809
|
+
return _extends$4({}, args, {
|
|
757
810
|
remoteSnapshot
|
|
758
811
|
});
|
|
759
812
|
}
|
|
@@ -974,6 +1027,20 @@ const generatePreloadAssetsPlugin = function() {
|
|
|
974
1027
|
};
|
|
975
1028
|
};
|
|
976
1029
|
|
|
1030
|
+
function _extends$3() {
|
|
1031
|
+
_extends$3 = Object.assign || function(target) {
|
|
1032
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1033
|
+
var source = arguments[i];
|
|
1034
|
+
for(var key in source){
|
|
1035
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1036
|
+
target[key] = source[key];
|
|
1037
|
+
}
|
|
1038
|
+
}
|
|
1039
|
+
}
|
|
1040
|
+
return target;
|
|
1041
|
+
};
|
|
1042
|
+
return _extends$3.apply(this, arguments);
|
|
1043
|
+
}
|
|
977
1044
|
function getGlobalRemoteInfo(moduleInfo, origin) {
|
|
978
1045
|
const hostGlobalSnapshot = share.getGlobalSnapshotInfoByModuleInfo({
|
|
979
1046
|
name: origin.options.name,
|
|
@@ -1041,7 +1108,7 @@ class SnapshotHandler {
|
|
|
1041
1108
|
// 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.
|
|
1042
1109
|
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !share.getInfoWithoutType(hostSnapshot.remotesInfo, moduleInfo.name).value) {
|
|
1043
1110
|
if ('version' in moduleInfo || 'entry' in moduleInfo) {
|
|
1044
|
-
hostSnapshot.remotesInfo =
|
|
1111
|
+
hostSnapshot.remotesInfo = _extends$3({}, hostSnapshot == null ? void 0 : hostSnapshot.remotesInfo, {
|
|
1045
1112
|
[moduleInfo.name]: {
|
|
1046
1113
|
matchedVersion: 'version' in moduleInfo ? moduleInfo.version : moduleInfo.entry
|
|
1047
1114
|
}
|
|
@@ -1062,7 +1129,7 @@ class SnapshotHandler {
|
|
|
1062
1129
|
const remoteEntry = sdk.isBrowserEnv() ? globalRemoteSnapshot.remoteEntry : globalRemoteSnapshot.ssrRemoteEntry || globalRemoteSnapshot.remoteEntry || '';
|
|
1063
1130
|
const moduleSnapshot = await this.getManifestJson(remoteEntry, moduleInfo, {});
|
|
1064
1131
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
1065
|
-
const globalSnapshotRes = share.setGlobalSnapshotInfoByModuleInfo(
|
|
1132
|
+
const globalSnapshotRes = share.setGlobalSnapshotInfoByModuleInfo(_extends$3({}, moduleInfo, {
|
|
1066
1133
|
// The global remote may be overridden
|
|
1067
1134
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
1068
1135
|
entry: remoteEntry
|
|
@@ -1168,6 +1235,32 @@ class SnapshotHandler {
|
|
|
1168
1235
|
}
|
|
1169
1236
|
}
|
|
1170
1237
|
|
|
1238
|
+
function _extends$2() {
|
|
1239
|
+
_extends$2 = Object.assign || function(target) {
|
|
1240
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1241
|
+
var source = arguments[i];
|
|
1242
|
+
for(var key in source){
|
|
1243
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1244
|
+
target[key] = source[key];
|
|
1245
|
+
}
|
|
1246
|
+
}
|
|
1247
|
+
}
|
|
1248
|
+
return target;
|
|
1249
|
+
};
|
|
1250
|
+
return _extends$2.apply(this, arguments);
|
|
1251
|
+
}
|
|
1252
|
+
function _object_without_properties_loose(source, excluded) {
|
|
1253
|
+
if (source == null) return {};
|
|
1254
|
+
var target = {};
|
|
1255
|
+
var sourceKeys = Object.keys(source);
|
|
1256
|
+
var key, i;
|
|
1257
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
1258
|
+
key = sourceKeys[i];
|
|
1259
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1260
|
+
target[key] = source[key];
|
|
1261
|
+
}
|
|
1262
|
+
return target;
|
|
1263
|
+
}
|
|
1171
1264
|
class SharedHandler {
|
|
1172
1265
|
// register shared in shareScopeMap
|
|
1173
1266
|
registerShared(globalOptions, userOptions) {
|
|
@@ -1459,7 +1552,7 @@ class SharedHandler {
|
|
|
1459
1552
|
});
|
|
1460
1553
|
}
|
|
1461
1554
|
setShared({ pkgName, shared, from, lib, loading, loaded, get }) {
|
|
1462
|
-
const { version, scope = 'default' } = shared, shareInfo =
|
|
1555
|
+
const { version, scope = 'default' } = shared, shareInfo = _object_without_properties_loose(shared, [
|
|
1463
1556
|
"version",
|
|
1464
1557
|
"scope"
|
|
1465
1558
|
]);
|
|
@@ -1476,7 +1569,7 @@ class SharedHandler {
|
|
|
1476
1569
|
if (this.shareScopeMap[sc][pkgName][version]) {
|
|
1477
1570
|
return;
|
|
1478
1571
|
}
|
|
1479
|
-
this.shareScopeMap[sc][pkgName][version] =
|
|
1572
|
+
this.shareScopeMap[sc][pkgName][version] = _extends$2({
|
|
1480
1573
|
version,
|
|
1481
1574
|
scope: [
|
|
1482
1575
|
'default'
|
|
@@ -1515,6 +1608,20 @@ class SharedHandler {
|
|
|
1515
1608
|
}
|
|
1516
1609
|
}
|
|
1517
1610
|
|
|
1611
|
+
function _extends$1() {
|
|
1612
|
+
_extends$1 = Object.assign || function(target) {
|
|
1613
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1614
|
+
var source = arguments[i];
|
|
1615
|
+
for(var key in source){
|
|
1616
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1617
|
+
target[key] = source[key];
|
|
1618
|
+
}
|
|
1619
|
+
}
|
|
1620
|
+
}
|
|
1621
|
+
return target;
|
|
1622
|
+
};
|
|
1623
|
+
return _extends$1.apply(this, arguments);
|
|
1624
|
+
}
|
|
1518
1625
|
class RemoteHandler {
|
|
1519
1626
|
formatAndRegisterRemote(globalOptions, userOptions) {
|
|
1520
1627
|
const userRemotes = userOptions.remotes || [];
|
|
@@ -1566,8 +1673,8 @@ class RemoteHandler {
|
|
|
1566
1673
|
const { module, moduleOptions, remoteMatchInfo } = await this.getRemoteModuleAndOptions({
|
|
1567
1674
|
id
|
|
1568
1675
|
});
|
|
1569
|
-
const { pkgNameOrAlias, remote, expose, id: idRes
|
|
1570
|
-
const moduleOrFactory = await module.get(idRes, expose, options
|
|
1676
|
+
const { pkgNameOrAlias, remote, expose, id: idRes } = remoteMatchInfo;
|
|
1677
|
+
const moduleOrFactory = await module.get(idRes, expose, options);
|
|
1571
1678
|
const moduleWrapper = await this.hooks.lifecycle.onLoad.emit({
|
|
1572
1679
|
id: idRes,
|
|
1573
1680
|
pkgNameOrAlias,
|
|
@@ -1671,7 +1778,7 @@ class RemoteHandler {
|
|
|
1671
1778
|
`);
|
|
1672
1779
|
const { remote: rawRemote } = remoteSplitInfo;
|
|
1673
1780
|
const remoteInfo = getRemoteInfo(rawRemote);
|
|
1674
|
-
const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit(
|
|
1781
|
+
const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({
|
|
1675
1782
|
id: idRes
|
|
1676
1783
|
}, remoteSplitInfo, {
|
|
1677
1784
|
options: host.options,
|
|
@@ -1871,6 +1978,20 @@ class RemoteHandler {
|
|
|
1871
1978
|
}
|
|
1872
1979
|
}
|
|
1873
1980
|
|
|
1981
|
+
function _extends() {
|
|
1982
|
+
_extends = Object.assign || function(target) {
|
|
1983
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1984
|
+
var source = arguments[i];
|
|
1985
|
+
for(var key in source){
|
|
1986
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1987
|
+
target[key] = source[key];
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
}
|
|
1991
|
+
return target;
|
|
1992
|
+
};
|
|
1993
|
+
return _extends.apply(this, arguments);
|
|
1994
|
+
}
|
|
1874
1995
|
class FederationHost {
|
|
1875
1996
|
initOptions(userOptions) {
|
|
1876
1997
|
this.registerPlugins(userOptions.plugins);
|
|
@@ -1936,7 +2057,7 @@ class FederationHost {
|
|
|
1936
2057
|
}
|
|
1937
2058
|
});
|
|
1938
2059
|
}
|
|
1939
|
-
const optionsRes =
|
|
2060
|
+
const optionsRes = _extends({}, globalOptions, userOptions, {
|
|
1940
2061
|
plugins,
|
|
1941
2062
|
remotes,
|
|
1942
2063
|
shared: handledShared
|
|
@@ -1976,7 +2097,7 @@ class FederationHost {
|
|
|
1976
2097
|
// maybe will change, temporarily for internal use only
|
|
1977
2098
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1978
2099
|
});
|
|
1979
|
-
this.version = "0.6.
|
|
2100
|
+
this.version = "0.6.0";
|
|
1980
2101
|
this.moduleCache = new Map();
|
|
1981
2102
|
this.loaderHook = new PluginSystem({
|
|
1982
2103
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -2081,7 +2202,6 @@ Object.defineProperty(exports, 'loadScriptNode', {
|
|
|
2081
2202
|
});
|
|
2082
2203
|
exports.registerGlobalPlugins = share.registerGlobalPlugins;
|
|
2083
2204
|
exports.FederationHost = FederationHost;
|
|
2084
|
-
exports.Module = Module;
|
|
2085
2205
|
exports.getInstance = getInstance;
|
|
2086
2206
|
exports.getRemoteEntry = getRemoteEntry;
|
|
2087
2207
|
exports.getRemoteInfo = getRemoteInfo;
|
package/dist/index.esm.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { _ as _extends, a as _object_without_properties_loose } from './polyfills.esm.js';
|
|
2
1
|
import { isBrowserEnv, loadScriptNode, composeKeyWithSeparator, loadScript, safeToString, createLink, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
|
|
3
2
|
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
4
3
|
import { g as getGlobalHostPlugins, a as globalLoading, D as DEFAULT_REMOTE_TYPE, b as DEFAULT_SCOPE, c as getRemoteEntryExports, d as assert, e as getFMId, i as isObject, f as error, w as warn, h as isPlainObject, j as isRemoteInfoWithEntry, k as isPureRemoteEntry, l as getRemoteEntryInfoFromSnapshot, m as getInfoWithoutType, n as getPreloaded, s as setPreloaded, o as getRegisteredShare, p as arrayOptions, q as getGlobalSnapshotInfoByModuleInfo, r as addGlobalSnapshot, t as setGlobalSnapshotInfoByModuleInfo, G as Global, u as getGlobalSnapshot, v as formatShareConfigs, x as getTargetSharedOptions, y as getGlobalShareScope, z as addUniqueItem, A as getBuilderId, B as setGlobalFederationConstructor, C as getGlobalFederationInstance, E as getGlobalFederationConstructor, F as setGlobalFederationInstance } from './share.esm.js';
|
|
@@ -88,6 +87,20 @@ function registerPlugins$1(plugins, hookInstances) {
|
|
|
88
87
|
return plugins;
|
|
89
88
|
}
|
|
90
89
|
|
|
90
|
+
function _extends$7() {
|
|
91
|
+
_extends$7 = Object.assign || function(target) {
|
|
92
|
+
for(var i = 1; i < arguments.length; i++){
|
|
93
|
+
var source = arguments[i];
|
|
94
|
+
for(var key in source){
|
|
95
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
96
|
+
target[key] = source[key];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return target;
|
|
101
|
+
};
|
|
102
|
+
return _extends$7.apply(this, arguments);
|
|
103
|
+
}
|
|
91
104
|
async function loadEsmEntry({ entry, remoteEntryExports }) {
|
|
92
105
|
return new Promise((resolve, reject)=>{
|
|
93
106
|
try {
|
|
@@ -250,7 +263,7 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
|
|
|
250
263
|
return globalLoading[uniqueKey];
|
|
251
264
|
}
|
|
252
265
|
function getRemoteInfo(remote) {
|
|
253
|
-
return _extends({}, remote, {
|
|
266
|
+
return _extends$7({}, remote, {
|
|
254
267
|
entry: 'entry' in remote ? remote.entry : '',
|
|
255
268
|
type: remote.type || DEFAULT_REMOTE_TYPE,
|
|
256
269
|
entryGlobalName: remote.entryGlobalName || remote.name,
|
|
@@ -258,6 +271,20 @@ function getRemoteInfo(remote) {
|
|
|
258
271
|
});
|
|
259
272
|
}
|
|
260
273
|
|
|
274
|
+
function _extends$6() {
|
|
275
|
+
_extends$6 = Object.assign || function(target) {
|
|
276
|
+
for(var i = 1; i < arguments.length; i++){
|
|
277
|
+
var source = arguments[i];
|
|
278
|
+
for(var key in source){
|
|
279
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
280
|
+
target[key] = source[key];
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
return target;
|
|
285
|
+
};
|
|
286
|
+
return _extends$6.apply(this, arguments);
|
|
287
|
+
}
|
|
261
288
|
let Module = class Module {
|
|
262
289
|
async getEntry() {
|
|
263
290
|
if (this.remoteEntryExports) {
|
|
@@ -274,7 +301,7 @@ let Module = class Module {
|
|
|
274
301
|
return this.remoteEntryExports;
|
|
275
302
|
}
|
|
276
303
|
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
277
|
-
async get(id, expose, options
|
|
304
|
+
async get(id, expose, options) {
|
|
278
305
|
const { loadFactory = true } = options || {
|
|
279
306
|
loadFactory: true
|
|
280
307
|
};
|
|
@@ -309,9 +336,7 @@ let Module = class Module {
|
|
|
309
336
|
console.error('The remote entry interface does not contain "init"', '\n', 'Ensure the name of this remote is not reserved or in use. Check if anything already exists on window[nameOfRemote]', '\n', 'Ensure that window[nameOfRemote] is returning a {get,init} object.');
|
|
310
337
|
}
|
|
311
338
|
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
312
|
-
await this.host.hooks.lifecycle.initContainer.emit(_extends({}, initContainerOptions, {
|
|
313
|
-
id,
|
|
314
|
-
remoteSnapshot,
|
|
339
|
+
await this.host.hooks.lifecycle.initContainer.emit(_extends$6({}, initContainerOptions, {
|
|
315
340
|
remoteEntryExports
|
|
316
341
|
}));
|
|
317
342
|
}
|
|
@@ -547,8 +572,22 @@ class PluginSystem {
|
|
|
547
572
|
}
|
|
548
573
|
}
|
|
549
574
|
|
|
575
|
+
function _extends$5() {
|
|
576
|
+
_extends$5 = Object.assign || function(target) {
|
|
577
|
+
for(var i = 1; i < arguments.length; i++){
|
|
578
|
+
var source = arguments[i];
|
|
579
|
+
for(var key in source){
|
|
580
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
581
|
+
target[key] = source[key];
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
}
|
|
585
|
+
return target;
|
|
586
|
+
};
|
|
587
|
+
return _extends$5.apply(this, arguments);
|
|
588
|
+
}
|
|
550
589
|
function defaultPreloadArgs(preloadConfig) {
|
|
551
|
-
return _extends({
|
|
590
|
+
return _extends$5({
|
|
552
591
|
resourceCategory: 'sync',
|
|
553
592
|
share: true,
|
|
554
593
|
depsRemote: true,
|
|
@@ -704,6 +743,20 @@ useLinkPreload = true) {
|
|
|
704
743
|
}
|
|
705
744
|
}
|
|
706
745
|
|
|
746
|
+
function _extends$4() {
|
|
747
|
+
_extends$4 = Object.assign || function(target) {
|
|
748
|
+
for(var i = 1; i < arguments.length; i++){
|
|
749
|
+
var source = arguments[i];
|
|
750
|
+
for(var key in source){
|
|
751
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
752
|
+
target[key] = source[key];
|
|
753
|
+
}
|
|
754
|
+
}
|
|
755
|
+
}
|
|
756
|
+
return target;
|
|
757
|
+
};
|
|
758
|
+
return _extends$4.apply(this, arguments);
|
|
759
|
+
}
|
|
707
760
|
function assignRemoteInfo(remoteInfo, remoteSnapshot) {
|
|
708
761
|
const remoteEntryInfo = getRemoteEntryInfoFromSnapshot(remoteSnapshot);
|
|
709
762
|
if (!remoteEntryInfo.url) {
|
|
@@ -751,7 +804,7 @@ function snapshotPlugin() {
|
|
|
751
804
|
if (assets) {
|
|
752
805
|
preloadAssets(remoteInfo, origin, assets, false);
|
|
753
806
|
}
|
|
754
|
-
return _extends({}, args, {
|
|
807
|
+
return _extends$4({}, args, {
|
|
755
808
|
remoteSnapshot
|
|
756
809
|
});
|
|
757
810
|
}
|
|
@@ -972,6 +1025,20 @@ const generatePreloadAssetsPlugin = function() {
|
|
|
972
1025
|
};
|
|
973
1026
|
};
|
|
974
1027
|
|
|
1028
|
+
function _extends$3() {
|
|
1029
|
+
_extends$3 = Object.assign || function(target) {
|
|
1030
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1031
|
+
var source = arguments[i];
|
|
1032
|
+
for(var key in source){
|
|
1033
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1034
|
+
target[key] = source[key];
|
|
1035
|
+
}
|
|
1036
|
+
}
|
|
1037
|
+
}
|
|
1038
|
+
return target;
|
|
1039
|
+
};
|
|
1040
|
+
return _extends$3.apply(this, arguments);
|
|
1041
|
+
}
|
|
975
1042
|
function getGlobalRemoteInfo(moduleInfo, origin) {
|
|
976
1043
|
const hostGlobalSnapshot = getGlobalSnapshotInfoByModuleInfo({
|
|
977
1044
|
name: origin.options.name,
|
|
@@ -1039,7 +1106,7 @@ class SnapshotHandler {
|
|
|
1039
1106
|
// 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.
|
|
1040
1107
|
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !getInfoWithoutType(hostSnapshot.remotesInfo, moduleInfo.name).value) {
|
|
1041
1108
|
if ('version' in moduleInfo || 'entry' in moduleInfo) {
|
|
1042
|
-
hostSnapshot.remotesInfo = _extends({}, hostSnapshot == null ? void 0 : hostSnapshot.remotesInfo, {
|
|
1109
|
+
hostSnapshot.remotesInfo = _extends$3({}, hostSnapshot == null ? void 0 : hostSnapshot.remotesInfo, {
|
|
1043
1110
|
[moduleInfo.name]: {
|
|
1044
1111
|
matchedVersion: 'version' in moduleInfo ? moduleInfo.version : moduleInfo.entry
|
|
1045
1112
|
}
|
|
@@ -1060,7 +1127,7 @@ class SnapshotHandler {
|
|
|
1060
1127
|
const remoteEntry = isBrowserEnv() ? globalRemoteSnapshot.remoteEntry : globalRemoteSnapshot.ssrRemoteEntry || globalRemoteSnapshot.remoteEntry || '';
|
|
1061
1128
|
const moduleSnapshot = await this.getManifestJson(remoteEntry, moduleInfo, {});
|
|
1062
1129
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
1063
|
-
const globalSnapshotRes = setGlobalSnapshotInfoByModuleInfo(_extends({}, moduleInfo, {
|
|
1130
|
+
const globalSnapshotRes = setGlobalSnapshotInfoByModuleInfo(_extends$3({}, moduleInfo, {
|
|
1064
1131
|
// The global remote may be overridden
|
|
1065
1132
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
1066
1133
|
entry: remoteEntry
|
|
@@ -1166,6 +1233,32 @@ class SnapshotHandler {
|
|
|
1166
1233
|
}
|
|
1167
1234
|
}
|
|
1168
1235
|
|
|
1236
|
+
function _extends$2() {
|
|
1237
|
+
_extends$2 = Object.assign || function(target) {
|
|
1238
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1239
|
+
var source = arguments[i];
|
|
1240
|
+
for(var key in source){
|
|
1241
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1242
|
+
target[key] = source[key];
|
|
1243
|
+
}
|
|
1244
|
+
}
|
|
1245
|
+
}
|
|
1246
|
+
return target;
|
|
1247
|
+
};
|
|
1248
|
+
return _extends$2.apply(this, arguments);
|
|
1249
|
+
}
|
|
1250
|
+
function _object_without_properties_loose(source, excluded) {
|
|
1251
|
+
if (source == null) return {};
|
|
1252
|
+
var target = {};
|
|
1253
|
+
var sourceKeys = Object.keys(source);
|
|
1254
|
+
var key, i;
|
|
1255
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
1256
|
+
key = sourceKeys[i];
|
|
1257
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
1258
|
+
target[key] = source[key];
|
|
1259
|
+
}
|
|
1260
|
+
return target;
|
|
1261
|
+
}
|
|
1169
1262
|
class SharedHandler {
|
|
1170
1263
|
// register shared in shareScopeMap
|
|
1171
1264
|
registerShared(globalOptions, userOptions) {
|
|
@@ -1474,7 +1567,7 @@ class SharedHandler {
|
|
|
1474
1567
|
if (this.shareScopeMap[sc][pkgName][version]) {
|
|
1475
1568
|
return;
|
|
1476
1569
|
}
|
|
1477
|
-
this.shareScopeMap[sc][pkgName][version] = _extends({
|
|
1570
|
+
this.shareScopeMap[sc][pkgName][version] = _extends$2({
|
|
1478
1571
|
version,
|
|
1479
1572
|
scope: [
|
|
1480
1573
|
'default'
|
|
@@ -1513,6 +1606,20 @@ class SharedHandler {
|
|
|
1513
1606
|
}
|
|
1514
1607
|
}
|
|
1515
1608
|
|
|
1609
|
+
function _extends$1() {
|
|
1610
|
+
_extends$1 = Object.assign || function(target) {
|
|
1611
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1612
|
+
var source = arguments[i];
|
|
1613
|
+
for(var key in source){
|
|
1614
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1615
|
+
target[key] = source[key];
|
|
1616
|
+
}
|
|
1617
|
+
}
|
|
1618
|
+
}
|
|
1619
|
+
return target;
|
|
1620
|
+
};
|
|
1621
|
+
return _extends$1.apply(this, arguments);
|
|
1622
|
+
}
|
|
1516
1623
|
class RemoteHandler {
|
|
1517
1624
|
formatAndRegisterRemote(globalOptions, userOptions) {
|
|
1518
1625
|
const userRemotes = userOptions.remotes || [];
|
|
@@ -1564,8 +1671,8 @@ class RemoteHandler {
|
|
|
1564
1671
|
const { module, moduleOptions, remoteMatchInfo } = await this.getRemoteModuleAndOptions({
|
|
1565
1672
|
id
|
|
1566
1673
|
});
|
|
1567
|
-
const { pkgNameOrAlias, remote, expose, id: idRes
|
|
1568
|
-
const moduleOrFactory = await module.get(idRes, expose, options
|
|
1674
|
+
const { pkgNameOrAlias, remote, expose, id: idRes } = remoteMatchInfo;
|
|
1675
|
+
const moduleOrFactory = await module.get(idRes, expose, options);
|
|
1569
1676
|
const moduleWrapper = await this.hooks.lifecycle.onLoad.emit({
|
|
1570
1677
|
id: idRes,
|
|
1571
1678
|
pkgNameOrAlias,
|
|
@@ -1669,7 +1776,7 @@ class RemoteHandler {
|
|
|
1669
1776
|
`);
|
|
1670
1777
|
const { remote: rawRemote } = remoteSplitInfo;
|
|
1671
1778
|
const remoteInfo = getRemoteInfo(rawRemote);
|
|
1672
|
-
const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends({
|
|
1779
|
+
const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({
|
|
1673
1780
|
id: idRes
|
|
1674
1781
|
}, remoteSplitInfo, {
|
|
1675
1782
|
options: host.options,
|
|
@@ -1869,6 +1976,20 @@ class RemoteHandler {
|
|
|
1869
1976
|
}
|
|
1870
1977
|
}
|
|
1871
1978
|
|
|
1979
|
+
function _extends() {
|
|
1980
|
+
_extends = Object.assign || function(target) {
|
|
1981
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1982
|
+
var source = arguments[i];
|
|
1983
|
+
for(var key in source){
|
|
1984
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1985
|
+
target[key] = source[key];
|
|
1986
|
+
}
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
return target;
|
|
1990
|
+
};
|
|
1991
|
+
return _extends.apply(this, arguments);
|
|
1992
|
+
}
|
|
1872
1993
|
class FederationHost {
|
|
1873
1994
|
initOptions(userOptions) {
|
|
1874
1995
|
this.registerPlugins(userOptions.plugins);
|
|
@@ -1974,7 +2095,7 @@ class FederationHost {
|
|
|
1974
2095
|
// maybe will change, temporarily for internal use only
|
|
1975
2096
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1976
2097
|
});
|
|
1977
|
-
this.version = "0.6.
|
|
2098
|
+
this.version = "0.6.0";
|
|
1978
2099
|
this.moduleCache = new Map();
|
|
1979
2100
|
this.loaderHook = new PluginSystem({
|
|
1980
2101
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -2069,4 +2190,4 @@ function getInstance() {
|
|
|
2069
2190
|
// Inject for debug
|
|
2070
2191
|
setGlobalFederationConstructor(FederationHost);
|
|
2071
2192
|
|
|
2072
|
-
export { FederationHost,
|
|
2193
|
+
export { FederationHost, getInstance, getRemoteEntry, getRemoteInfo, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerPlugins, registerRemotes };
|
package/dist/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.6.
|
|
3
|
+
"version": "0.6.0",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -29,11 +29,6 @@
|
|
|
29
29
|
"import": "./dist/types.esm.js",
|
|
30
30
|
"require": "./dist/types.cjs.js"
|
|
31
31
|
},
|
|
32
|
-
"./embedded": {
|
|
33
|
-
"types": "./dist/embedded.cjs.d.ts",
|
|
34
|
-
"import": "./dist/embedded.esm.js",
|
|
35
|
-
"require": "./dist/embedded.cjs.js"
|
|
36
|
-
},
|
|
37
32
|
"./*": "./*"
|
|
38
33
|
},
|
|
39
34
|
"typesVersions": {
|
package/dist/share.cjs.js
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var polyfills = require('./polyfills.cjs.js');
|
|
4
3
|
var sdk = require('@module-federation/sdk');
|
|
5
4
|
|
|
6
5
|
function getBuilderId() {
|
|
@@ -88,6 +87,32 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
|
|
|
88
87
|
return defaultRemoteEntryInfo;
|
|
89
88
|
}
|
|
90
89
|
|
|
90
|
+
function _extends$1() {
|
|
91
|
+
_extends$1 = Object.assign || function(target) {
|
|
92
|
+
for(var i = 1; i < arguments.length; i++){
|
|
93
|
+
var source = arguments[i];
|
|
94
|
+
for(var key in source){
|
|
95
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
96
|
+
target[key] = source[key];
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
return target;
|
|
101
|
+
};
|
|
102
|
+
return _extends$1.apply(this, arguments);
|
|
103
|
+
}
|
|
104
|
+
function _object_without_properties_loose(source, excluded) {
|
|
105
|
+
if (source == null) return {};
|
|
106
|
+
var target = {};
|
|
107
|
+
var sourceKeys = Object.keys(source);
|
|
108
|
+
var key, i;
|
|
109
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
110
|
+
key = sourceKeys[i];
|
|
111
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
112
|
+
target[key] = source[key];
|
|
113
|
+
}
|
|
114
|
+
return target;
|
|
115
|
+
}
|
|
91
116
|
const nativeGlobal = (()=>{
|
|
92
117
|
try {
|
|
93
118
|
return new Function('return this')();
|
|
@@ -175,7 +200,7 @@ function getGlobalFederationConstructor() {
|
|
|
175
200
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
|
|
176
201
|
if (isDebug) {
|
|
177
202
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
178
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.
|
|
203
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.0";
|
|
179
204
|
}
|
|
180
205
|
}
|
|
181
206
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -223,7 +248,7 @@ const getTargetSnapshotInfoByModuleInfo = (moduleInfo, snapshot)=>{
|
|
|
223
248
|
}
|
|
224
249
|
// If the remote is not included in the hostSnapshot, deploy a micro app snapshot
|
|
225
250
|
if ('version' in moduleInfo && moduleInfo['version']) {
|
|
226
|
-
const { version } = moduleInfo, resModuleInfo =
|
|
251
|
+
const { version } = moduleInfo, resModuleInfo = _object_without_properties_loose(moduleInfo, [
|
|
227
252
|
"version"
|
|
228
253
|
]);
|
|
229
254
|
const moduleKeyWithoutVersion = getFMId(resModuleInfo);
|
|
@@ -241,7 +266,7 @@ const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{
|
|
|
241
266
|
return nativeGlobal.__FEDERATION__.moduleInfo;
|
|
242
267
|
};
|
|
243
268
|
const addGlobalSnapshot = (moduleInfos)=>{
|
|
244
|
-
nativeGlobal.__FEDERATION__.moduleInfo =
|
|
269
|
+
nativeGlobal.__FEDERATION__.moduleInfo = _extends$1({}, nativeGlobal.__FEDERATION__.moduleInfo, moduleInfos);
|
|
245
270
|
return ()=>{
|
|
246
271
|
const keys = Object.keys(moduleInfos);
|
|
247
272
|
for (const key of keys){
|
|
@@ -634,6 +659,20 @@ function satisfy(version, range) {
|
|
|
634
659
|
return true;
|
|
635
660
|
}
|
|
636
661
|
|
|
662
|
+
function _extends() {
|
|
663
|
+
_extends = Object.assign || function(target) {
|
|
664
|
+
for(var i = 1; i < arguments.length; i++){
|
|
665
|
+
var source = arguments[i];
|
|
666
|
+
for(var key in source){
|
|
667
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
668
|
+
target[key] = source[key];
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
}
|
|
672
|
+
return target;
|
|
673
|
+
};
|
|
674
|
+
return _extends.apply(this, arguments);
|
|
675
|
+
}
|
|
637
676
|
function formatShare(shareArgs, from, name, shareStrategy) {
|
|
638
677
|
let get;
|
|
639
678
|
if ('get' in shareArgs) {
|
|
@@ -650,13 +689,13 @@ function formatShare(shareArgs, from, name, shareStrategy) {
|
|
|
650
689
|
warn(`"shared.strategy is deprecated, please set in initOptions.shareStrategy instead!"`);
|
|
651
690
|
}
|
|
652
691
|
var _shareArgs_version, _shareArgs_scope, _shareArgs_strategy;
|
|
653
|
-
return
|
|
692
|
+
return _extends({
|
|
654
693
|
deps: [],
|
|
655
694
|
useIn: [],
|
|
656
695
|
from,
|
|
657
696
|
loading: null
|
|
658
697
|
}, shareArgs, {
|
|
659
|
-
shareConfig:
|
|
698
|
+
shareConfig: _extends({
|
|
660
699
|
requiredVersion: `^${shareArgs.version}`,
|
|
661
700
|
singleton: false,
|
|
662
701
|
eager: false,
|
|
@@ -682,7 +721,7 @@ function formatShareConfigs(globalOptions, userOptions) {
|
|
|
682
721
|
});
|
|
683
722
|
return res;
|
|
684
723
|
}, {});
|
|
685
|
-
const shared =
|
|
724
|
+
const shared = _extends({}, globalOptions.shared);
|
|
686
725
|
Object.keys(shareInfos).forEach((shareKey)=>{
|
|
687
726
|
if (!shared[shareKey]) {
|
|
688
727
|
shared[shareKey] = shareInfos[shareKey];
|
package/dist/share.esm.js
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { a as _object_without_properties_loose, _ as _extends } from './polyfills.esm.js';
|
|
2
1
|
import { isBrowserEnv, isDebugMode } from '@module-federation/sdk';
|
|
3
2
|
|
|
4
3
|
function getBuilderId() {
|
|
@@ -86,6 +85,32 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
|
|
|
86
85
|
return defaultRemoteEntryInfo;
|
|
87
86
|
}
|
|
88
87
|
|
|
88
|
+
function _extends$1() {
|
|
89
|
+
_extends$1 = Object.assign || function(target) {
|
|
90
|
+
for(var i = 1; i < arguments.length; i++){
|
|
91
|
+
var source = arguments[i];
|
|
92
|
+
for(var key in source){
|
|
93
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
94
|
+
target[key] = source[key];
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
return target;
|
|
99
|
+
};
|
|
100
|
+
return _extends$1.apply(this, arguments);
|
|
101
|
+
}
|
|
102
|
+
function _object_without_properties_loose(source, excluded) {
|
|
103
|
+
if (source == null) return {};
|
|
104
|
+
var target = {};
|
|
105
|
+
var sourceKeys = Object.keys(source);
|
|
106
|
+
var key, i;
|
|
107
|
+
for(i = 0; i < sourceKeys.length; i++){
|
|
108
|
+
key = sourceKeys[i];
|
|
109
|
+
if (excluded.indexOf(key) >= 0) continue;
|
|
110
|
+
target[key] = source[key];
|
|
111
|
+
}
|
|
112
|
+
return target;
|
|
113
|
+
}
|
|
89
114
|
const nativeGlobal = (()=>{
|
|
90
115
|
try {
|
|
91
116
|
return new Function('return this')();
|
|
@@ -173,7 +198,7 @@ function getGlobalFederationConstructor() {
|
|
|
173
198
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
174
199
|
if (isDebug) {
|
|
175
200
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
176
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.
|
|
201
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.0";
|
|
177
202
|
}
|
|
178
203
|
}
|
|
179
204
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -239,7 +264,7 @@ const setGlobalSnapshotInfoByModuleInfo = (remoteInfo, moduleDetailInfo)=>{
|
|
|
239
264
|
return nativeGlobal.__FEDERATION__.moduleInfo;
|
|
240
265
|
};
|
|
241
266
|
const addGlobalSnapshot = (moduleInfos)=>{
|
|
242
|
-
nativeGlobal.__FEDERATION__.moduleInfo = _extends({}, nativeGlobal.__FEDERATION__.moduleInfo, moduleInfos);
|
|
267
|
+
nativeGlobal.__FEDERATION__.moduleInfo = _extends$1({}, nativeGlobal.__FEDERATION__.moduleInfo, moduleInfos);
|
|
243
268
|
return ()=>{
|
|
244
269
|
const keys = Object.keys(moduleInfos);
|
|
245
270
|
for (const key of keys){
|
|
@@ -632,6 +657,20 @@ function satisfy(version, range) {
|
|
|
632
657
|
return true;
|
|
633
658
|
}
|
|
634
659
|
|
|
660
|
+
function _extends() {
|
|
661
|
+
_extends = Object.assign || function(target) {
|
|
662
|
+
for(var i = 1; i < arguments.length; i++){
|
|
663
|
+
var source = arguments[i];
|
|
664
|
+
for(var key in source){
|
|
665
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
666
|
+
target[key] = source[key];
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
}
|
|
670
|
+
return target;
|
|
671
|
+
};
|
|
672
|
+
return _extends.apply(this, arguments);
|
|
673
|
+
}
|
|
635
674
|
function formatShare(shareArgs, from, name, shareStrategy) {
|
|
636
675
|
let get;
|
|
637
676
|
if ('get' in shareArgs) {
|
package/dist/src/core.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CreateScriptHookReturn
|
|
1
|
+
import type { CreateScriptHookReturn } from '@module-federation/sdk';
|
|
2
2
|
import { Options, PreloadRemoteArgs, RemoteEntryExports, Remote, Shared, ShareInfos, UserOptions, RemoteInfo, ShareScopeMap, InitScope, RemoteEntryInitOptions, CallFrom } from './type';
|
|
3
3
|
import { Module } from './module';
|
|
4
4
|
import { AsyncHook, AsyncWaterfallHook, PluginSystem, SyncHook, SyncWaterfallHook } from './utils/hooks';
|
|
@@ -32,8 +32,6 @@ export declare class FederationHost {
|
|
|
32
32
|
remoteInfo: RemoteInfo;
|
|
33
33
|
remoteEntryExports: RemoteEntryExports;
|
|
34
34
|
origin: FederationHost;
|
|
35
|
-
id: string;
|
|
36
|
-
remoteSnapshot?: ModuleInfo;
|
|
37
35
|
}>;
|
|
38
36
|
}>;
|
|
39
37
|
version: string;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -4,7 +4,6 @@ export { FederationHost } from './core';
|
|
|
4
4
|
export { registerGlobalPlugins } from './global';
|
|
5
5
|
export { getRemoteEntry, getRemoteInfo } from './utils';
|
|
6
6
|
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
7
|
-
export { Module } from './module';
|
|
8
7
|
export type { Federation } from './global';
|
|
9
8
|
export type { FederationRuntimePlugin };
|
|
10
9
|
export declare function init(options: UserOptions): FederationHost;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { ModuleInfo } from '@module-federation/sdk';
|
|
2
1
|
import { FederationHost } from '../core';
|
|
3
2
|
import { RemoteEntryExports, RemoteInfo } from '../type';
|
|
4
3
|
export type ModuleOptions = ConstructorParameters<typeof Module>[0];
|
|
@@ -15,7 +14,7 @@ declare class Module {
|
|
|
15
14
|
getEntry(): Promise<RemoteEntryExports>;
|
|
16
15
|
get(id: string, expose: string, options?: {
|
|
17
16
|
loadFactory?: boolean;
|
|
18
|
-
}
|
|
17
|
+
}): Promise<any>;
|
|
19
18
|
private wraperFactory;
|
|
20
19
|
}
|
|
21
20
|
export { Module };
|
|
@@ -44,14 +44,14 @@ export declare class RemoteHandler {
|
|
|
44
44
|
exposeModuleFactory: any;
|
|
45
45
|
moduleInstance: Module;
|
|
46
46
|
}], void>;
|
|
47
|
-
handlePreloadModule: SyncHook<
|
|
47
|
+
handlePreloadModule: SyncHook<{
|
|
48
48
|
id: string;
|
|
49
49
|
name: string;
|
|
50
50
|
remote: Remote;
|
|
51
51
|
remoteSnapshot: ModuleInfo;
|
|
52
52
|
preloadConfig: PreloadRemoteArgs;
|
|
53
53
|
origin: FederationHost;
|
|
54
|
-
}
|
|
54
|
+
}, void>;
|
|
55
55
|
errorLoadRemote: AsyncHook<[{
|
|
56
56
|
id: string;
|
|
57
57
|
error: unknown;
|
package/dist/src/utils/env.d.ts
CHANGED
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-20240909092952",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
6
|
"module": "./dist/index.esm.js",
|
|
@@ -29,11 +29,6 @@
|
|
|
29
29
|
"import": "./dist/types.esm.js",
|
|
30
30
|
"require": "./dist/types.cjs.js"
|
|
31
31
|
},
|
|
32
|
-
"./embedded": {
|
|
33
|
-
"types": "./dist/embedded.cjs.d.ts",
|
|
34
|
-
"import": "./dist/embedded.esm.js",
|
|
35
|
-
"require": "./dist/embedded.cjs.js"
|
|
36
|
-
},
|
|
37
32
|
"./*": "./*"
|
|
38
33
|
},
|
|
39
34
|
"typesVersions": {
|
|
@@ -50,6 +45,6 @@
|
|
|
50
45
|
}
|
|
51
46
|
},
|
|
52
47
|
"dependencies": {
|
|
53
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
48
|
+
"@module-federation/sdk": "0.0.0-next-20240909092952"
|
|
54
49
|
}
|
|
55
50
|
}
|
package/dist/embedded.cjs.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./src/embedded";
|
package/dist/embedded.cjs.js
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
|
-
|
|
5
|
-
const { FederationHost, registerGlobalPlugins, getRemoteEntry, getRemoteInfo, loadScript, loadScriptNode, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerRemotes, registerPlugins, getInstance } = __webpack_require__.federation.runtime;
|
|
6
|
-
|
|
7
|
-
exports.FederationHost = FederationHost;
|
|
8
|
-
exports.getInstance = getInstance;
|
|
9
|
-
exports.getRemoteEntry = getRemoteEntry;
|
|
10
|
-
exports.getRemoteInfo = getRemoteInfo;
|
|
11
|
-
exports.init = init;
|
|
12
|
-
exports.loadRemote = loadRemote;
|
|
13
|
-
exports.loadScript = loadScript;
|
|
14
|
-
exports.loadScriptNode = loadScriptNode;
|
|
15
|
-
exports.loadShare = loadShare;
|
|
16
|
-
exports.loadShareSync = loadShareSync;
|
|
17
|
-
exports.preloadRemote = preloadRemote;
|
|
18
|
-
exports.registerGlobalPlugins = registerGlobalPlugins;
|
|
19
|
-
exports.registerPlugins = registerPlugins;
|
|
20
|
-
exports.registerRemotes = registerRemotes;
|
package/dist/embedded.esm.js
DELETED
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
const { FederationHost, registerGlobalPlugins, getRemoteEntry, getRemoteInfo, loadScript, loadScriptNode, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerRemotes, registerPlugins, getInstance } = __webpack_require__.federation.runtime;
|
|
2
|
-
|
|
3
|
-
export { FederationHost, getInstance, getRemoteEntry, getRemoteInfo, init, loadRemote, loadScript, loadScriptNode, loadShare, loadShareSync, preloadRemote, registerGlobalPlugins, registerPlugins, registerRemotes };
|
package/dist/polyfills.cjs.js
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _extends() {
|
|
4
|
-
_extends = Object.assign || function assign(target) {
|
|
5
|
-
for(var i = 1; i < arguments.length; i++){
|
|
6
|
-
var source = arguments[i];
|
|
7
|
-
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
8
|
-
}
|
|
9
|
-
return target;
|
|
10
|
-
};
|
|
11
|
-
return _extends.apply(this, arguments);
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
function _object_without_properties_loose(source, excluded) {
|
|
15
|
-
if (source == null) return {};
|
|
16
|
-
var target = {};
|
|
17
|
-
var sourceKeys = Object.keys(source);
|
|
18
|
-
var key, i;
|
|
19
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
20
|
-
key = sourceKeys[i];
|
|
21
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
22
|
-
target[key] = source[key];
|
|
23
|
-
}
|
|
24
|
-
return target;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
exports._extends = _extends;
|
|
28
|
-
exports._object_without_properties_loose = _object_without_properties_loose;
|
package/dist/polyfills.esm.js
DELETED
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
function _extends() {
|
|
2
|
-
_extends = Object.assign || function assign(target) {
|
|
3
|
-
for(var i = 1; i < arguments.length; i++){
|
|
4
|
-
var source = arguments[i];
|
|
5
|
-
for(var key in source)if (Object.prototype.hasOwnProperty.call(source, key)) target[key] = source[key];
|
|
6
|
-
}
|
|
7
|
-
return target;
|
|
8
|
-
};
|
|
9
|
-
return _extends.apply(this, arguments);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function _object_without_properties_loose(source, excluded) {
|
|
13
|
-
if (source == null) return {};
|
|
14
|
-
var target = {};
|
|
15
|
-
var sourceKeys = Object.keys(source);
|
|
16
|
-
var key, i;
|
|
17
|
-
for(i = 0; i < sourceKeys.length; i++){
|
|
18
|
-
key = sourceKeys[i];
|
|
19
|
-
if (excluded.indexOf(key) >= 0) continue;
|
|
20
|
-
target[key] = source[key];
|
|
21
|
-
}
|
|
22
|
-
return target;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export { _extends as _, _object_without_properties_loose as a };
|
package/dist/src/embedded.d.ts
DELETED
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
declare const FederationHost: any, registerGlobalPlugins: any, getRemoteEntry: any, getRemoteInfo: any, loadScript: any, loadScriptNode: any, init: any, loadRemote: any, loadShare: any, loadShareSync: any, preloadRemote: any, registerRemotes: any, registerPlugins: any, getInstance: any;
|
|
2
|
-
export { FederationHost, registerGlobalPlugins, getRemoteEntry, getRemoteInfo, loadScript, loadScriptNode, init, loadRemote, loadShare, loadShareSync, preloadRemote, registerRemotes, registerPlugins, getInstance, };
|