@module-federation/runtime 0.0.0-next-20240824225724 → 0.0.0-next-20240826075118
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 -3
- package/dist/helpers.esm.js +1 -4
- package/dist/index.cjs.js +167 -28
- package/dist/index.esm.js +168 -29
- package/dist/package.json +1 -6
- package/dist/retry-plugin.cjs.js +15 -3
- package/dist/retry-plugin.esm.js +15 -3
- package/dist/share.cjs.js +64 -12
- package/dist/share.esm.js +61 -11
- package/dist/src/core.d.ts +7 -3
- package/dist/src/remote/index.d.ts +4 -4
- package/dist/src/shared/index.d.ts +7 -2
- package/dist/src/type/config.d.ts +3 -1
- package/dist/src/utils/env.d.ts +2 -1
- package/dist/src/utils/tool.d.ts +1 -0
- 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/src/embedded.d.ts +0 -2
package/dist/helpers.cjs.js
CHANGED
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
var share = require('./share.cjs.js');
|
|
4
|
-
require('@swc/helpers/_/_extends');
|
|
5
|
-
require('@swc/helpers/_/_object_without_properties_loose');
|
|
6
|
-
require('@module-federation/sdk');
|
|
7
4
|
|
|
8
5
|
const ShareUtils = {
|
|
9
6
|
getRegisteredShare: share.getRegisteredShare,
|
package/dist/helpers.esm.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import '@swc/helpers/_/_extends';
|
|
3
|
-
import '@swc/helpers/_/_object_without_properties_loose';
|
|
4
|
-
import '@module-federation/sdk';
|
|
1
|
+
import { q as getRegisteredShare, A as getGlobalShareScope, G as Global, K as nativeGlobal, L as resetFederationGlobalInfo, F as getGlobalFederationInstance, I as setGlobalFederationInstance, H as getGlobalFederationConstructor, E as setGlobalFederationConstructor, n as getInfoWithoutType, x as getGlobalSnapshot, M as getTargetSnapshotInfoByModuleInfo, t as getGlobalSnapshotInfoByModuleInfo, v as setGlobalSnapshotInfoByModuleInfo, u as addGlobalSnapshot, c as getRemoteEntryExports, J as registerGlobalPlugins, g as getGlobalHostPlugins, o as getPreloaded, p as setPreloaded } from './share.esm.js';
|
|
5
2
|
|
|
6
3
|
const ShareUtils = {
|
|
7
4
|
getRegisteredShare,
|
package/dist/index.cjs.js
CHANGED
|
@@ -2,10 +2,8 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
|
-
var _extends = require('@swc/helpers/_/_extends');
|
|
6
5
|
var share = require('./share.cjs.js');
|
|
7
6
|
var sdk = require('@module-federation/sdk');
|
|
8
|
-
var _object_without_properties_loose = require('@swc/helpers/_/_object_without_properties_loose');
|
|
9
7
|
|
|
10
8
|
// Function to match a remote with its name and expose
|
|
11
9
|
// id: pkgName(@federation/app1) + expose(button) = @federation/app1/button
|
|
@@ -91,6 +89,20 @@ function registerPlugins$1(plugins, hookInstances) {
|
|
|
91
89
|
return plugins;
|
|
92
90
|
}
|
|
93
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
|
+
}
|
|
94
106
|
async function loadEsmEntry({ entry, remoteEntryExports }) {
|
|
95
107
|
return new Promise((resolve, reject)=>{
|
|
96
108
|
try {
|
|
@@ -253,7 +265,7 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
|
|
|
253
265
|
return share.globalLoading[uniqueKey];
|
|
254
266
|
}
|
|
255
267
|
function getRemoteInfo(remote) {
|
|
256
|
-
return _extends
|
|
268
|
+
return _extends$7({}, remote, {
|
|
257
269
|
entry: 'entry' in remote ? remote.entry : '',
|
|
258
270
|
type: remote.type || share.DEFAULT_REMOTE_TYPE,
|
|
259
271
|
entryGlobalName: remote.entryGlobalName || remote.name,
|
|
@@ -261,6 +273,20 @@ function getRemoteInfo(remote) {
|
|
|
261
273
|
});
|
|
262
274
|
}
|
|
263
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
|
+
}
|
|
264
290
|
let Module = class Module {
|
|
265
291
|
async getEntry() {
|
|
266
292
|
if (this.remoteEntryExports) {
|
|
@@ -272,7 +298,7 @@ let Module = class Module {
|
|
|
272
298
|
remoteInfo: this.remoteInfo,
|
|
273
299
|
remoteEntryExports: this.remoteEntryExports
|
|
274
300
|
});
|
|
275
|
-
share.assert(remoteEntryExports, `remoteEntryExports is undefined \n ${
|
|
301
|
+
share.assert(remoteEntryExports, `remoteEntryExports is undefined \n ${share.safeToString(this.remoteInfo)}`);
|
|
276
302
|
this.remoteEntryExports = remoteEntryExports;
|
|
277
303
|
return this.remoteEntryExports;
|
|
278
304
|
}
|
|
@@ -312,7 +338,7 @@ let Module = class Module {
|
|
|
312
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.');
|
|
313
339
|
}
|
|
314
340
|
await remoteEntryExports.init(initContainerOptions.shareScope, initContainerOptions.initScope, initContainerOptions.remoteEntryInitOptions);
|
|
315
|
-
await this.host.hooks.lifecycle.initContainer.emit(_extends
|
|
341
|
+
await this.host.hooks.lifecycle.initContainer.emit(_extends$6({}, initContainerOptions, {
|
|
316
342
|
remoteEntryExports
|
|
317
343
|
}));
|
|
318
344
|
}
|
|
@@ -548,8 +574,22 @@ class PluginSystem {
|
|
|
548
574
|
}
|
|
549
575
|
}
|
|
550
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
|
+
}
|
|
551
591
|
function defaultPreloadArgs(preloadConfig) {
|
|
552
|
-
return _extends
|
|
592
|
+
return _extends$5({
|
|
553
593
|
resourceCategory: 'sync',
|
|
554
594
|
share: true,
|
|
555
595
|
depsRemote: true,
|
|
@@ -559,7 +599,7 @@ function defaultPreloadArgs(preloadConfig) {
|
|
|
559
599
|
function formatPreloadArgs(remotes, preloadArgs) {
|
|
560
600
|
return preloadArgs.map((args)=>{
|
|
561
601
|
const remoteInfo = matchRemote(remotes, args.nameOrAlias);
|
|
562
|
-
share.assert(remoteInfo, `Unable to preload ${args.nameOrAlias} as it is not included in ${!remoteInfo &&
|
|
602
|
+
share.assert(remoteInfo, `Unable to preload ${args.nameOrAlias} as it is not included in ${!remoteInfo && share.safeToString({
|
|
563
603
|
remoteInfo,
|
|
564
604
|
remotes
|
|
565
605
|
})}`);
|
|
@@ -705,13 +745,27 @@ useLinkPreload = true) {
|
|
|
705
745
|
}
|
|
706
746
|
}
|
|
707
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
|
+
}
|
|
708
762
|
function assignRemoteInfo(remoteInfo, remoteSnapshot) {
|
|
709
763
|
const remoteEntryInfo = share.getRemoteEntryInfoFromSnapshot(remoteSnapshot);
|
|
710
764
|
if (!remoteEntryInfo.url) {
|
|
711
765
|
share.error(`The attribute remoteEntry of ${remoteInfo.name} must not be undefined.`);
|
|
712
766
|
}
|
|
713
767
|
let entryUrl = sdk.getResourceUrl(remoteSnapshot, remoteEntryInfo.url);
|
|
714
|
-
if (!
|
|
768
|
+
if (!share.isBrowserEnv() && !entryUrl.startsWith('http')) {
|
|
715
769
|
entryUrl = `https:${entryUrl}`;
|
|
716
770
|
}
|
|
717
771
|
remoteInfo.type = remoteEntryInfo.type;
|
|
@@ -752,7 +806,7 @@ function snapshotPlugin() {
|
|
|
752
806
|
if (assets) {
|
|
753
807
|
preloadAssets(remoteInfo, origin, assets, false);
|
|
754
808
|
}
|
|
755
|
-
return _extends
|
|
809
|
+
return _extends$4({}, args, {
|
|
756
810
|
remoteSnapshot
|
|
757
811
|
});
|
|
758
812
|
}
|
|
@@ -973,6 +1027,20 @@ const generatePreloadAssetsPlugin = function() {
|
|
|
973
1027
|
};
|
|
974
1028
|
};
|
|
975
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
|
+
}
|
|
976
1044
|
function getGlobalRemoteInfo(moduleInfo, origin) {
|
|
977
1045
|
const hostGlobalSnapshot = share.getGlobalSnapshotInfoByModuleInfo({
|
|
978
1046
|
name: origin.options.name,
|
|
@@ -1040,7 +1108,7 @@ class SnapshotHandler {
|
|
|
1040
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.
|
|
1041
1109
|
if (hostSnapshot && 'remotesInfo' in hostSnapshot && !share.getInfoWithoutType(hostSnapshot.remotesInfo, moduleInfo.name).value) {
|
|
1042
1110
|
if ('version' in moduleInfo || 'entry' in moduleInfo) {
|
|
1043
|
-
hostSnapshot.remotesInfo = _extends
|
|
1111
|
+
hostSnapshot.remotesInfo = _extends$3({}, hostSnapshot == null ? void 0 : hostSnapshot.remotesInfo, {
|
|
1044
1112
|
[moduleInfo.name]: {
|
|
1045
1113
|
matchedVersion: 'version' in moduleInfo ? moduleInfo.version : moduleInfo.entry
|
|
1046
1114
|
}
|
|
@@ -1058,10 +1126,10 @@ class SnapshotHandler {
|
|
|
1058
1126
|
// global snapshot includes manifest or module info includes manifest
|
|
1059
1127
|
if (globalRemoteSnapshot) {
|
|
1060
1128
|
if (sdk.isManifestProvider(globalRemoteSnapshot)) {
|
|
1061
|
-
const remoteEntry =
|
|
1129
|
+
const remoteEntry = share.isBrowserEnv() ? globalRemoteSnapshot.remoteEntry : globalRemoteSnapshot.ssrRemoteEntry || globalRemoteSnapshot.remoteEntry || '';
|
|
1062
1130
|
const moduleSnapshot = await this.getManifestJson(remoteEntry, moduleInfo, {});
|
|
1063
1131
|
// eslint-disable-next-line @typescript-eslint/no-shadow
|
|
1064
|
-
const globalSnapshotRes = share.setGlobalSnapshotInfoByModuleInfo(_extends
|
|
1132
|
+
const globalSnapshotRes = share.setGlobalSnapshotInfoByModuleInfo(_extends$3({}, moduleInfo, {
|
|
1065
1133
|
// The global remote may be overridden
|
|
1066
1134
|
// Therefore, set the snapshot key to the global address of the actual request
|
|
1067
1135
|
entry: remoteEntry
|
|
@@ -1167,6 +1235,32 @@ class SnapshotHandler {
|
|
|
1167
1235
|
}
|
|
1168
1236
|
}
|
|
1169
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
|
+
}
|
|
1170
1264
|
class SharedHandler {
|
|
1171
1265
|
// register shared in shareScopeMap
|
|
1172
1266
|
registerShared(globalOptions, userOptions) {
|
|
@@ -1206,7 +1300,9 @@ class SharedHandler {
|
|
|
1206
1300
|
});
|
|
1207
1301
|
if (shareInfo == null ? void 0 : shareInfo.scope) {
|
|
1208
1302
|
await Promise.all(shareInfo.scope.map(async (shareScope)=>{
|
|
1209
|
-
await Promise.all(this.initializeSharing(shareScope,
|
|
1303
|
+
await Promise.all(this.initializeSharing(shareScope, {
|
|
1304
|
+
strategy: shareInfo.strategy
|
|
1305
|
+
}));
|
|
1210
1306
|
return;
|
|
1211
1307
|
}));
|
|
1212
1308
|
}
|
|
@@ -1294,8 +1390,22 @@ class SharedHandler {
|
|
|
1294
1390
|
* It accepts one argument, the name of the share scope.
|
|
1295
1391
|
* If the share scope does not exist, it creates one.
|
|
1296
1392
|
*/ // eslint-disable-next-line @typescript-eslint/member-ordering
|
|
1297
|
-
initializeSharing(shareScopeName = share.DEFAULT_SCOPE,
|
|
1393
|
+
initializeSharing(shareScopeName = share.DEFAULT_SCOPE, extraOptions) {
|
|
1298
1394
|
const { host } = this;
|
|
1395
|
+
const from = extraOptions == null ? void 0 : extraOptions.from;
|
|
1396
|
+
const strategy = extraOptions == null ? void 0 : extraOptions.strategy;
|
|
1397
|
+
let initScope = extraOptions == null ? void 0 : extraOptions.initScope;
|
|
1398
|
+
const promises = [];
|
|
1399
|
+
if (from !== 'build') {
|
|
1400
|
+
const { initTokens } = this;
|
|
1401
|
+
if (!initScope) initScope = [];
|
|
1402
|
+
let initToken = initTokens[shareScopeName];
|
|
1403
|
+
if (!initToken) initToken = initTokens[shareScopeName] = {
|
|
1404
|
+
from: this.host.name
|
|
1405
|
+
};
|
|
1406
|
+
if (initScope.indexOf(initToken) >= 0) return promises;
|
|
1407
|
+
initScope.push(initToken);
|
|
1408
|
+
}
|
|
1299
1409
|
const shareScope = this.shareScopeMap;
|
|
1300
1410
|
const hostName = host.options.name;
|
|
1301
1411
|
// Creates a new share scope if necessary
|
|
@@ -1315,8 +1425,7 @@ class SharedHandler {
|
|
|
1315
1425
|
versions[version] = shared;
|
|
1316
1426
|
}
|
|
1317
1427
|
};
|
|
1318
|
-
const
|
|
1319
|
-
const initFn = (mod)=>mod && mod.init && mod.init(shareScope[shareScopeName]);
|
|
1428
|
+
const initFn = (mod)=>mod && mod.init && mod.init(shareScope[shareScopeName], initScope);
|
|
1320
1429
|
const initRemoteModule = async (key)=>{
|
|
1321
1430
|
const { module } = await host.remoteHandler.getRemoteModuleAndOptions({
|
|
1322
1431
|
id: key
|
|
@@ -1324,7 +1433,7 @@ class SharedHandler {
|
|
|
1324
1433
|
if (module.getEntry) {
|
|
1325
1434
|
const entry = await module.getEntry();
|
|
1326
1435
|
if (!module.inited) {
|
|
1327
|
-
initFn(entry);
|
|
1436
|
+
await initFn(entry);
|
|
1328
1437
|
module.inited = true;
|
|
1329
1438
|
}
|
|
1330
1439
|
}
|
|
@@ -1360,7 +1469,9 @@ class SharedHandler {
|
|
|
1360
1469
|
});
|
|
1361
1470
|
if (shareInfo == null ? void 0 : shareInfo.scope) {
|
|
1362
1471
|
shareInfo.scope.forEach((shareScope)=>{
|
|
1363
|
-
this.initializeSharing(shareScope,
|
|
1472
|
+
this.initializeSharing(shareScope, {
|
|
1473
|
+
strategy: shareInfo.strategy
|
|
1474
|
+
});
|
|
1364
1475
|
});
|
|
1365
1476
|
}
|
|
1366
1477
|
const registeredShared = share.getRegisteredShare(this.shareScopeMap, pkgName, shareInfo, this.hooks.lifecycle.resolveShare);
|
|
@@ -1441,7 +1552,7 @@ class SharedHandler {
|
|
|
1441
1552
|
});
|
|
1442
1553
|
}
|
|
1443
1554
|
setShared({ pkgName, shared, from, lib, loading, loaded, get }) {
|
|
1444
|
-
const { version, scope = 'default' } = shared, shareInfo = _object_without_properties_loose
|
|
1555
|
+
const { version, scope = 'default' } = shared, shareInfo = _object_without_properties_loose(shared, [
|
|
1445
1556
|
"version",
|
|
1446
1557
|
"scope"
|
|
1447
1558
|
]);
|
|
@@ -1458,7 +1569,7 @@ class SharedHandler {
|
|
|
1458
1569
|
if (this.shareScopeMap[sc][pkgName][version]) {
|
|
1459
1570
|
return;
|
|
1460
1571
|
}
|
|
1461
|
-
this.shareScopeMap[sc][pkgName][version] = _extends
|
|
1572
|
+
this.shareScopeMap[sc][pkgName][version] = _extends$2({
|
|
1462
1573
|
version,
|
|
1463
1574
|
scope: [
|
|
1464
1575
|
'default'
|
|
@@ -1492,10 +1603,25 @@ class SharedHandler {
|
|
|
1492
1603
|
});
|
|
1493
1604
|
this.host = host;
|
|
1494
1605
|
this.shareScopeMap = {};
|
|
1606
|
+
this.initTokens = {};
|
|
1495
1607
|
this._setGlobalShareScopeMap(host.options);
|
|
1496
1608
|
}
|
|
1497
1609
|
}
|
|
1498
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
|
+
}
|
|
1499
1625
|
class RemoteHandler {
|
|
1500
1626
|
formatAndRegisterRemote(globalOptions, userOptions) {
|
|
1501
1627
|
const userRemotes = userOptions.remotes || [];
|
|
@@ -1652,7 +1778,7 @@ class RemoteHandler {
|
|
|
1652
1778
|
`);
|
|
1653
1779
|
const { remote: rawRemote } = remoteSplitInfo;
|
|
1654
1780
|
const remoteInfo = getRemoteInfo(rawRemote);
|
|
1655
|
-
const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends
|
|
1781
|
+
const matchInfo = await host.sharedHandler.hooks.lifecycle.afterResolve.emit(_extends$1({
|
|
1656
1782
|
id: idRes
|
|
1657
1783
|
}, remoteSplitInfo, {
|
|
1658
1784
|
options: host.options,
|
|
@@ -1821,8 +1947,7 @@ class RemoteHandler {
|
|
|
1821
1947
|
const remoteKey = hostGlobalSnapshot && 'remotesInfo' in hostGlobalSnapshot && hostGlobalSnapshot.remotesInfo && share.getInfoWithoutType(hostGlobalSnapshot.remotesInfo, remote.name).key;
|
|
1822
1948
|
if (remoteKey) {
|
|
1823
1949
|
delete hostGlobalSnapshot.remotesInfo[remoteKey];
|
|
1824
|
-
if (
|
|
1825
|
-
Boolean(share.Global.__FEDERATION__.__MANIFEST_LOADING__[remoteKey])) {
|
|
1950
|
+
if (Boolean(share.Global.__FEDERATION__.__MANIFEST_LOADING__[remoteKey])) {
|
|
1826
1951
|
delete share.Global.__FEDERATION__.__MANIFEST_LOADING__[remoteKey];
|
|
1827
1952
|
}
|
|
1828
1953
|
}
|
|
@@ -1852,6 +1977,20 @@ class RemoteHandler {
|
|
|
1852
1977
|
}
|
|
1853
1978
|
}
|
|
1854
1979
|
|
|
1980
|
+
function _extends() {
|
|
1981
|
+
_extends = Object.assign || function(target) {
|
|
1982
|
+
for(var i = 1; i < arguments.length; i++){
|
|
1983
|
+
var source = arguments[i];
|
|
1984
|
+
for(var key in source){
|
|
1985
|
+
if (Object.prototype.hasOwnProperty.call(source, key)) {
|
|
1986
|
+
target[key] = source[key];
|
|
1987
|
+
}
|
|
1988
|
+
}
|
|
1989
|
+
}
|
|
1990
|
+
return target;
|
|
1991
|
+
};
|
|
1992
|
+
return _extends.apply(this, arguments);
|
|
1993
|
+
}
|
|
1855
1994
|
class FederationHost {
|
|
1856
1995
|
initOptions(userOptions) {
|
|
1857
1996
|
this.registerPlugins(userOptions.plugins);
|
|
@@ -1869,8 +2008,8 @@ class FederationHost {
|
|
|
1869
2008
|
loadShareSync(pkgName, extraOptions) {
|
|
1870
2009
|
return this.sharedHandler.loadShareSync(pkgName, extraOptions);
|
|
1871
2010
|
}
|
|
1872
|
-
initializeSharing(shareScopeName = share.DEFAULT_SCOPE,
|
|
1873
|
-
return this.sharedHandler.initializeSharing(shareScopeName,
|
|
2011
|
+
initializeSharing(shareScopeName = share.DEFAULT_SCOPE, extraOptions) {
|
|
2012
|
+
return this.sharedHandler.initializeSharing(shareScopeName, extraOptions);
|
|
1874
2013
|
}
|
|
1875
2014
|
initRawContainer(name, url, container) {
|
|
1876
2015
|
const remoteInfo = getRemoteInfo({
|
|
@@ -1917,7 +2056,7 @@ class FederationHost {
|
|
|
1917
2056
|
}
|
|
1918
2057
|
});
|
|
1919
2058
|
}
|
|
1920
|
-
const optionsRes = _extends
|
|
2059
|
+
const optionsRes = _extends({}, globalOptions, userOptions, {
|
|
1921
2060
|
plugins,
|
|
1922
2061
|
remotes,
|
|
1923
2062
|
shared: handledShared
|
|
@@ -1957,7 +2096,7 @@ class FederationHost {
|
|
|
1957
2096
|
// maybe will change, temporarily for internal use only
|
|
1958
2097
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1959
2098
|
});
|
|
1960
|
-
this.version = "0.5.
|
|
2099
|
+
this.version = "0.5.2";
|
|
1961
2100
|
this.moduleCache = new Map();
|
|
1962
2101
|
this.loaderHook = new PluginSystem({
|
|
1963
2102
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -1978,7 +2117,7 @@ class FederationHost {
|
|
|
1978
2117
|
],
|
|
1979
2118
|
remotes: [],
|
|
1980
2119
|
shared: {},
|
|
1981
|
-
inBrowser:
|
|
2120
|
+
inBrowser: share.isBrowserEnv()
|
|
1982
2121
|
};
|
|
1983
2122
|
this.name = userOptions.name;
|
|
1984
2123
|
this.options = defaultOptions;
|