@module-federation/runtime 0.0.0-next-20240102023857 → 0.0.0-next-20240102063242

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.esm.js CHANGED
@@ -1,6 +1,7 @@
1
- import { g as getGlobalHostPlugins, D as DEFAULT_REMOTE_TYPE, a as DEFAULT_SCOPE, b as globalLoading, c as getRemoteEntryExports, d as assert, s as safeToString, G as Global, e as getFMId, i as isObject, f as error, w as warn, h as isPlainObject, j as isRemoteInfoWithEntry, k as isPureRemoteEntry, l as getGlobalShare, m as getInfoWithoutType, n as getPreloaded, o as setPreloaded, p as getGlobalSnapshotInfoByModuleInfo, q as setGlobalSnapshotInfoByModuleInfo, r as getGlobalSnapshot, t as addUniqueItem, u as formatShareConfigs, v as isBrowserEnv, x as getGlobalShareScope, y as getBuilderId, z as setGlobalFederationConstructor, A as getGlobalFederationInstance, B as getGlobalFederationConstructor, C as setGlobalFederationInstance } from './share.esm.js';
1
+ import { g as getGlobalHostPlugins, D as DEFAULT_REMOTE_TYPE, a as DEFAULT_SCOPE, b as globalLoading, c as getRemoteEntryExports, d as assert, s as safeToString, G as Global, e as getFMId, i as isObject, f as error, w as warn, h as isPlainObject, j as isRemoteInfoWithEntry, k as isPureRemoteEntry, l as getRegisteredShare, m as getInfoWithoutType, n as getPreloaded, o as setPreloaded, p as getGlobalSnapshotInfoByModuleInfo, q as setGlobalSnapshotInfoByModuleInfo, r as getGlobalSnapshot, t as getGlobalShareScope, u as addUniqueItem, v as formatShareConfigs, x as isBrowserEnv, y as getBuilderId, z as setGlobalFederationConstructor, A as getGlobalFederationInstance, B as getGlobalFederationConstructor, C as setGlobalFederationInstance } from './share.esm.js';
2
2
  export { E as registerGlobalPlugins } from './share.esm.js';
3
- import { composeKeyWithSeparator, loadScript, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest } from '@module-federation/sdk';
3
+ import { composeKeyWithSeparator, loadScriptNode, loadScript, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest } from '@module-federation/sdk';
4
+ export { loadScript } from '@module-federation/sdk';
4
5
 
5
6
  // Function to match a remote with its name and expose
6
7
  // id: pkgName(@federation/app1) + expose(button) = @federation/app1/button
@@ -118,6 +119,27 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
118
119
  if (remoteEntryExports) {
119
120
  return remoteEntryExports;
120
121
  }
122
+ if (typeof document === 'undefined') {
123
+ return loadScriptNode(entry, {
124
+ attrs: {
125
+ name,
126
+ globalName
127
+ },
128
+ createScriptHook
129
+ }).then(()=>{
130
+ const { remoteEntryKey, entryExports } = getRemoteEntryExports(name, globalName);
131
+ assert(entryExports, `
132
+ Unable to use the ${name}'s '${entry}' URL with ${remoteEntryKey}'s globalName to get remoteEntry exports.
133
+ Possible reasons could be:\n
134
+ 1. '${entry}' is not the correct URL, or the remoteEntry resource or name is incorrect.\n
135
+ 2. ${remoteEntryKey} cannot be used to get remoteEntry exports in the window object.
136
+ `);
137
+ console.log(entryExports);
138
+ return entryExports;
139
+ }).catch((e)=>{
140
+ return e;
141
+ });
142
+ }
121
143
  return loadScript(entry, {
122
144
  attrs: {},
123
145
  createScriptHook
@@ -130,6 +152,8 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
130
152
  2. ${remoteEntryKey} cannot be used to get remoteEntry exports in the window object.
131
153
  `);
132
154
  return entryExports;
155
+ }).catch((e)=>{
156
+ return e;
133
157
  });
134
158
  }
135
159
  async function getRemoteEntry({ remoteEntryExports, remoteInfo, createScriptHook }) {
@@ -191,6 +215,10 @@ let Module = class Module {
191
215
  const res = this.loaderHook.lifecycle.createScript.emit({
192
216
  url
193
217
  });
218
+ if (typeof document === 'undefined') {
219
+ //todo: needs real fix
220
+ return res;
221
+ }
194
222
  if (res instanceof HTMLScriptElement) {
195
223
  return res;
196
224
  }
@@ -206,15 +234,16 @@ let Module = class Module {
206
234
  const { loadFactory = true } = options || {
207
235
  loadFactory: true
208
236
  };
237
+ this.hostInfo.name;
209
238
  // Get remoteEntry.js
210
239
  const remoteEntryExports = await this.getEntry();
211
240
  if (!this.inited) {
212
- const globalShareScope = Global.__FEDERATION__.__SHARE__;
241
+ const localShareScopeMap = this.shareScopeMap;
213
242
  const remoteShareScope = this.remoteInfo.shareScope || 'default';
214
- if (!globalShareScope[remoteShareScope]) {
215
- globalShareScope[remoteShareScope] = {};
243
+ if (!localShareScopeMap[remoteShareScope]) {
244
+ localShareScopeMap[remoteShareScope] = {};
216
245
  }
217
- const shareScope = globalShareScope[remoteShareScope];
246
+ const shareScope = localShareScopeMap[remoteShareScope];
218
247
  // TODO: compat logic , it could be moved after providing startup hooks
219
248
  const remoteEntryInitOptions = {
220
249
  version: this.remoteInfo.version || '',
@@ -224,10 +253,18 @@ let Module = class Module {
224
253
  remoteEntryExports.init(shareScope, [], remoteEntryInitOptions);
225
254
  const federationInstance = Global.__FEDERATION__.__INSTANCES__.find((i)=>i.options.id === composeKeyWithSeparator(this.remoteInfo.name, this.remoteInfo.buildVersion));
226
255
  if (federationInstance) {
227
- federationInstance.initOptions(_extends$4({}, remoteEntryInitOptions, {
228
- remotes: [],
229
- name: this.remoteInfo.name
230
- }));
256
+ // means the instance is prev vmok instance
257
+ if (!federationInstance.releaseNumber || Number(federationInstance.releaseNumber) <= 100) {
258
+ // 兼容旧的生产者传参
259
+ federationInstance.initOptions(_extends$4({}, remoteEntryInitOptions, {
260
+ remotes: [],
261
+ name: this.remoteInfo.name
262
+ }));
263
+ if (!__FEDERATION__.__SHARE__['default'] && this.shareScopeMap && this.shareScopeMap['default']) {
264
+ // @ts-ignore compat prev logic , and it will be optimized by supporting startup hook
265
+ __FEDERATION__.__SHARE__['default'] = this.shareScopeMap['default'];
266
+ }
267
+ }
231
268
  }
232
269
  }
233
270
  this.lib = remoteEntryExports;
@@ -242,7 +279,7 @@ let Module = class Module {
242
279
  return exposeContent;
243
280
  }
244
281
  // loading: Record<string, undefined | Promise<RemoteEntryExports | void>> = {};
245
- constructor({ hostInfo, remoteInfo, shared, loaderHook }){
282
+ constructor({ hostInfo, remoteInfo, shared, loaderHook, shareScopeMap }){
246
283
  this.inited = false;
247
284
  this.shared = {};
248
285
  this.lib = undefined;
@@ -250,6 +287,7 @@ let Module = class Module {
250
287
  this.remoteInfo = remoteInfo;
251
288
  this.shared = shared;
252
289
  this.loaderHook = loaderHook;
290
+ this.shareScopeMap = shareScopeMap;
253
291
  }
254
292
  };
255
293
 
@@ -776,9 +814,9 @@ function generatePreloadAssets(origin, preloadOptions, remote, globalSnapshot, r
776
814
  if (!shareInfo) {
777
815
  return;
778
816
  }
779
- const globalShare = getGlobalShare(shared.sharedName, shareInfo);
817
+ const registeredShared = getRegisteredShare(origin.shareScopeMap, shared.sharedName, shareInfo, origin.hooks.lifecycle.resolveShare);
780
818
  // If the global share does not exist, or the lib function does not exist, it means that the shared has not been loaded yet and can be preloaded.
781
- if (globalShare && typeof globalShare.lib === 'function') {
819
+ if (registeredShared && typeof registeredShared.lib === 'function') {
782
820
  shared.assets.js.sync.forEach((asset)=>{
783
821
  loadedSharedJsAssets.add(asset);
784
822
  });
@@ -1105,6 +1143,13 @@ function _object_without_properties_loose(source, excluded) {
1105
1143
  return target;
1106
1144
  }
1107
1145
  class FederationHost {
1146
+ _setGlobalShareScopeMap() {
1147
+ const globalShareScopeMap = getGlobalShareScope();
1148
+ const identifier = this.options.id || this.options.name;
1149
+ if (identifier && !globalShareScopeMap[identifier]) {
1150
+ globalShareScopeMap[identifier] = this.shareScopeMap;
1151
+ }
1152
+ }
1108
1153
  initOptions(userOptions) {
1109
1154
  this.registerPlugins(userOptions.plugins);
1110
1155
  const options = this.formatOptions(this.options, userOptions);
@@ -1119,6 +1164,11 @@ class FederationHost {
1119
1164
  // 2. Searches globally for a matching share, if found, it uses it directly
1120
1165
  // 3. If not found, it retrieves it from the current share and stores the obtained share globally.
1121
1166
  const shareInfo = Object.assign({}, (_this_options_shared = this.options.shared) == null ? void 0 : _this_options_shared[pkgName], customShareInfo);
1167
+ if (shareInfo == null ? void 0 : shareInfo.scope) {
1168
+ shareInfo.scope.forEach((shareScope)=>{
1169
+ this.initializeSharing(shareScope, shareInfo.strategy);
1170
+ });
1171
+ }
1122
1172
  const loadShareRes = await this.hooks.lifecycle.beforeLoadShare.emit({
1123
1173
  pkgName,
1124
1174
  shareInfo,
@@ -1129,30 +1179,42 @@ class FederationHost {
1129
1179
  // Assert that shareInfoRes exists, if not, throw an error
1130
1180
  assert(shareInfoRes, `Cannot find ${pkgName} Share in the ${this.options.name}. Please ensure that the ${pkgName} Share parameters have been injected`);
1131
1181
  // Retrieve from cache
1132
- const globalShare = getGlobalShare(pkgName, shareInfoRes);
1133
- if (globalShare && globalShare.lib) {
1134
- addUniqueItem(globalShare.useIn, this.options.name);
1135
- return globalShare.lib;
1136
- } else if (globalShare && globalShare.loading) {
1137
- const factory = await globalShare.loading;
1138
- addUniqueItem(globalShare.useIn, this.options.name);
1182
+ const registeredShared = getRegisteredShare(this.shareScopeMap, pkgName, shareInfoRes, this.hooks.lifecycle.resolveShare);
1183
+ const addUseIn = (shared)=>{
1184
+ if (!shared.useIn) {
1185
+ shared.useIn = [];
1186
+ }
1187
+ addUniqueItem(shared.useIn, this.options.name);
1188
+ };
1189
+ if (registeredShared && registeredShared.lib) {
1190
+ addUseIn(registeredShared);
1191
+ return registeredShared.lib;
1192
+ } else if (registeredShared && registeredShared.loading && !registeredShared.loaded) {
1193
+ const factory = await registeredShared.loading;
1194
+ registeredShared.loaded = true;
1195
+ if (!registeredShared.lib) {
1196
+ registeredShared.lib = factory;
1197
+ }
1198
+ addUseIn(registeredShared);
1139
1199
  return factory;
1140
- } else if (globalShare) {
1200
+ } else if (registeredShared) {
1141
1201
  const asyncLoadProcess = async ()=>{
1142
- const factory = await globalShare.get();
1202
+ const factory = await registeredShared.get();
1143
1203
  shareInfoRes.lib = factory;
1144
- addUniqueItem(shareInfoRes.useIn, this.options.name);
1145
- const gShared = getGlobalShare(pkgName, shareInfoRes);
1204
+ shareInfoRes.loaded = true;
1205
+ addUseIn(shareInfoRes);
1206
+ const gShared = getRegisteredShare(this.shareScopeMap, pkgName, shareInfoRes, this.hooks.lifecycle.resolveShare);
1146
1207
  if (gShared) {
1147
1208
  gShared.lib = factory;
1209
+ gShared.loaded = true;
1148
1210
  }
1149
1211
  return factory;
1150
1212
  };
1151
1213
  const loading = asyncLoadProcess();
1152
1214
  this.setShared({
1153
1215
  pkgName,
1154
- loaded: true,
1155
- shared: shareInfoRes,
1216
+ loaded: false,
1217
+ shared: registeredShared,
1156
1218
  from: this.options.name,
1157
1219
  lib: null,
1158
1220
  loading
@@ -1165,17 +1227,19 @@ class FederationHost {
1165
1227
  const asyncLoadProcess = async ()=>{
1166
1228
  const factory = await shareInfoRes.get();
1167
1229
  shareInfoRes.lib = factory;
1168
- addUniqueItem(shareInfoRes.useIn, this.options.name);
1169
- const gShared = getGlobalShare(pkgName, shareInfoRes);
1230
+ shareInfoRes.loaded = true;
1231
+ addUseIn(shareInfoRes);
1232
+ const gShared = getRegisteredShare(this.shareScopeMap, pkgName, shareInfoRes, this.hooks.lifecycle.resolveShare);
1170
1233
  if (gShared) {
1171
1234
  gShared.lib = factory;
1235
+ gShared.loaded = true;
1172
1236
  }
1173
1237
  return factory;
1174
1238
  };
1175
1239
  const loading = asyncLoadProcess();
1176
1240
  this.setShared({
1177
1241
  pkgName,
1178
- loaded: true,
1242
+ loaded: false,
1179
1243
  shared: shareInfoRes,
1180
1244
  from: this.options.name,
1181
1245
  lib: null,
@@ -1191,16 +1255,16 @@ class FederationHost {
1191
1255
  loadShareSync(pkgName) {
1192
1256
  var _this_options_shared;
1193
1257
  const shareInfo = (_this_options_shared = this.options.shared) == null ? void 0 : _this_options_shared[pkgName];
1194
- const globalShare = getGlobalShare(pkgName, shareInfo);
1195
- if (globalShare && typeof globalShare.lib === 'function') {
1196
- addUniqueItem(globalShare.useIn, this.options.name);
1197
- if (!globalShare.loaded) {
1198
- globalShare.loaded = true;
1199
- if (globalShare.from === this.options.name) {
1258
+ const registeredShared = getRegisteredShare(this.shareScopeMap, pkgName, shareInfo, this.hooks.lifecycle.resolveShare);
1259
+ if (registeredShared && typeof registeredShared.lib === 'function') {
1260
+ addUniqueItem(registeredShared.useIn, this.options.name);
1261
+ if (!registeredShared.loaded) {
1262
+ registeredShared.loaded = true;
1263
+ if (registeredShared.from === this.options.name) {
1200
1264
  shareInfo.loaded = true;
1201
1265
  }
1202
1266
  }
1203
- return globalShare.lib;
1267
+ return registeredShared.lib;
1204
1268
  }
1205
1269
  if (shareInfo.lib) {
1206
1270
  if (!shareInfo.loaded) {
@@ -1271,7 +1335,8 @@ class FederationHost {
1271
1335
  remoteInfo,
1272
1336
  shared: this.options.shared || {},
1273
1337
  plugins: this.options.plugins,
1274
- loaderHook: this.loaderHook
1338
+ loaderHook: this.loaderHook,
1339
+ shareScopeMap: this.shareScopeMap
1275
1340
  };
1276
1341
  if (!module) {
1277
1342
  module = new Module(moduleOptions);
@@ -1313,11 +1378,19 @@ class FederationHost {
1313
1378
  });
1314
1379
  return moduleOrFactory;
1315
1380
  } catch (error) {
1316
- this.hooks.lifecycle.errorLoadRemote.emit({
1381
+ const { from = 'runtime' } = options || {
1382
+ from: 'runtime'
1383
+ };
1384
+ const failOver = await this.hooks.lifecycle.errorLoadRemote.emit({
1317
1385
  id,
1318
- error
1386
+ error,
1387
+ from,
1388
+ origin: this
1319
1389
  });
1320
- throw error;
1390
+ if (!failOver) {
1391
+ throw error;
1392
+ }
1393
+ return failOver;
1321
1394
  }
1322
1395
  }
1323
1396
  // eslint-disable-next-line @typescript-eslint/member-ordering
@@ -1351,14 +1424,9 @@ class FederationHost {
1351
1424
  * It accepts one argument, the name of the share scope.
1352
1425
  * If the share scope does not exist, it creates one.
1353
1426
  */ // eslint-disable-next-line @typescript-eslint/member-ordering
1354
- initializeSharing(shareScopeName = DEFAULT_SCOPE) {
1355
- const shareScopeLoading = Global.__FEDERATION__.__SHARE_SCOPE_LOADING__;
1356
- const shareScope = Global.__FEDERATION__.__SHARE__;
1427
+ initializeSharing(shareScopeName = DEFAULT_SCOPE, strategy) {
1428
+ const shareScope = this.shareScopeMap;
1357
1429
  const hostName = this.options.name;
1358
- // Executes only once
1359
- if (shareScopeLoading[shareScopeName]) {
1360
- return shareScopeLoading[shareScopeName];
1361
- }
1362
1430
  // Creates a new share scope if necessary
1363
1431
  if (!shareScope[shareScopeName]) {
1364
1432
  shareScope[shareScopeName] = {};
@@ -1366,21 +1434,27 @@ class FederationHost {
1366
1434
  // Executes all initialization snippets from all accessible modules
1367
1435
  const scope = shareScope[shareScopeName];
1368
1436
  const register = (name, shared)=>{
1437
+ var _activeVersion_shareConfig;
1369
1438
  const { version, eager } = shared;
1370
1439
  scope[name] = scope[name] || {};
1371
1440
  const versions = scope[name];
1372
1441
  const activeVersion = versions[version];
1373
- const activeVersionEager = Boolean(activeVersion && (activeVersion.eager || activeVersion.shareConfig.eager));
1442
+ const activeVersionEager = Boolean(activeVersion && (activeVersion.eager || ((_activeVersion_shareConfig = activeVersion.shareConfig) == null ? void 0 : _activeVersion_shareConfig.eager)));
1374
1443
  if (!activeVersion || !activeVersion.loaded && (Boolean(!eager) !== !activeVersionEager ? eager : hostName > activeVersion.from)) {
1375
1444
  versions[version] = shared;
1376
1445
  }
1377
1446
  };
1378
1447
  const promises = [];
1448
+ const initFn = (mod)=>mod && mod.init && mod.init(shareScope[shareScopeName]);
1379
1449
  const initRemoteModule = async (key)=>{
1380
1450
  const { module } = await this._getRemoteModuleAndOptions(key);
1381
- const initFn = (mod)=>mod && mod.init && mod.init(shareScope[shareScopeName]);
1382
- const entry = await module.getEntry();
1383
- initFn(entry);
1451
+ if (module.getEntry) {
1452
+ const entry = await module.getEntry();
1453
+ if (!module.inited) {
1454
+ initFn(entry);
1455
+ module.inited = true;
1456
+ }
1457
+ }
1384
1458
  };
1385
1459
  Object.keys(this.options.shared).forEach((shareName)=>{
1386
1460
  const shared = this.options.shared[shareName];
@@ -1388,15 +1462,17 @@ class FederationHost {
1388
1462
  register(shareName, shared);
1389
1463
  }
1390
1464
  });
1391
- this.options.remotes.forEach((remote)=>{
1392
- if (remote.shareScope === shareScopeName) {
1393
- promises.push(initRemoteModule(remote.name));
1394
- }
1395
- });
1396
- if (!promises.length) {
1397
- return shareScopeLoading[shareScopeName] = true;
1465
+ if (strategy === 'version-first') {
1466
+ this.options.remotes.forEach((remote)=>{
1467
+ if (remote.shareScope === shareScopeName) {
1468
+ promises.push(initRemoteModule(remote.name));
1469
+ }
1470
+ });
1398
1471
  }
1399
- return shareScopeLoading[shareScopeName] = Promise.all(promises).then(()=>shareScopeLoading[shareScopeName] = true);
1472
+ return promises;
1473
+ }
1474
+ initShareScopeMap(scopeName, shareScope) {
1475
+ this.shareScopeMap[scopeName] = shareScope;
1400
1476
  }
1401
1477
  formatOptions(globalOptions, userOptions) {
1402
1478
  const formatShareOptions = formatShareConfigs(userOptions.shared || {}, userOptions.name);
@@ -1436,16 +1512,17 @@ class FederationHost {
1436
1512
  }
1437
1513
  return res;
1438
1514
  }, globalOptionsRes.remotes);
1439
- // register shared include lib
1515
+ // register shared in shareScopeMap
1440
1516
  const sharedKeys = Object.keys(formatShareOptions);
1441
1517
  sharedKeys.forEach((sharedKey)=>{
1442
1518
  const sharedVal = formatShareOptions[sharedKey];
1443
- const globalShare = getGlobalShare(sharedKey, sharedVal);
1444
- if (!globalShare && sharedVal && sharedVal.lib) {
1519
+ const registeredShared = getRegisteredShare(this.shareScopeMap, sharedKey, sharedVal, this.hooks.lifecycle.resolveShare);
1520
+ if (!registeredShared && sharedVal && sharedVal.lib) {
1445
1521
  this.setShared({
1446
1522
  pkgName: sharedKey,
1447
1523
  lib: sharedVal.lib,
1448
1524
  get: sharedVal.get,
1525
+ loaded: true,
1449
1526
  shared: sharedVal,
1450
1527
  from: userOptions.name
1451
1528
  });
@@ -1480,7 +1557,6 @@ class FederationHost {
1480
1557
  ]);
1481
1558
  }
1482
1559
  setShared({ pkgName, shared, from, lib, loading, loaded, get }) {
1483
- const target = getGlobalShareScope();
1484
1560
  const { version, scope = 'default' } = shared, shareInfo = _object_without_properties_loose(shared, [
1485
1561
  "version",
1486
1562
  "scope"
@@ -1489,23 +1565,23 @@ class FederationHost {
1489
1565
  scope
1490
1566
  ];
1491
1567
  scopes.forEach((sc)=>{
1492
- if (!target[sc]) {
1493
- target[sc] = {};
1568
+ if (!this.shareScopeMap[sc]) {
1569
+ this.shareScopeMap[sc] = {};
1494
1570
  }
1495
- if (!target[sc][pkgName]) {
1496
- target[sc][pkgName] = {};
1571
+ if (!this.shareScopeMap[sc][pkgName]) {
1572
+ this.shareScopeMap[sc][pkgName] = {};
1497
1573
  }
1498
- if (target[sc][pkgName][version]) {
1574
+ if (this.shareScopeMap[sc][pkgName][version]) {
1499
1575
  warn(// eslint-disable-next-line max-len
1500
1576
  `The share \n ${safeToString({
1501
1577
  scope: sc,
1502
1578
  pkgName,
1503
1579
  version,
1504
- from: target[sc][pkgName][version].from
1580
+ from: this.shareScopeMap[sc][pkgName][version].from
1505
1581
  })} has been registered`);
1506
1582
  return;
1507
1583
  }
1508
- target[sc][pkgName][version] = _extends({
1584
+ this.shareScopeMap[sc][pkgName][version] = _extends({
1509
1585
  version,
1510
1586
  scope: [
1511
1587
  'default'
@@ -1516,7 +1592,7 @@ class FederationHost {
1516
1592
  loading
1517
1593
  });
1518
1594
  if (get) {
1519
- target[sc][pkgName][version].get = get;
1595
+ this.shareScopeMap[sc][pkgName][version].get = get;
1520
1596
  }
1521
1597
  });
1522
1598
  }
@@ -1531,11 +1607,13 @@ class FederationHost {
1531
1607
  errorLoadRemote: new AsyncHook('errorLoadRemote'),
1532
1608
  beforeLoadShare: new AsyncWaterfallHook('beforeLoadShare'),
1533
1609
  loadShare: new AsyncHook(),
1610
+ resolveShare: new SyncWaterfallHook('resolveShare'),
1534
1611
  beforePreloadRemote: new AsyncHook(),
1535
1612
  generatePreloadAssets: new AsyncHook('generatePreloadAssets'),
1536
1613
  afterPreloadRemote: new AsyncHook()
1537
1614
  });
1538
- this.version = '0.0.5';
1615
+ this.releaseNumber = `5`;
1616
+ this.version = `0.0.5`;
1539
1617
  this.moduleCache = new Map();
1540
1618
  this.loaderHook = new PluginSystem({
1541
1619
  // FIXME: may not be suitable
@@ -1543,7 +1621,6 @@ class FederationHost {
1543
1621
  createScript: new SyncHook(),
1544
1622
  fetch: new AsyncHook('fetch')
1545
1623
  });
1546
- this.loadingShare = {};
1547
1624
  // TODO: Validate the details of the options
1548
1625
  // Initialize options with default values
1549
1626
  const defaultOptions = {
@@ -1559,6 +1636,8 @@ class FederationHost {
1559
1636
  };
1560
1637
  this.name = userOptions.name;
1561
1638
  this.options = defaultOptions;
1639
+ this.shareScopeMap = {};
1640
+ this._setGlobalShareScopeMap();
1562
1641
  this.snapshotHandler = new SnapshotHandler(this);
1563
1642
  this.registerPlugins([
1564
1643
  ...defaultOptions.plugins,
package/dist/package.json CHANGED
@@ -39,8 +39,8 @@
39
39
  "helpers": [
40
40
  "./dist/helpers.cjs.d.ts"
41
41
  ],
42
- "type": [
43
- "./dist/type.cjs.d.ts"
42
+ "types": [
43
+ "./dist/types.cjs.d.ts"
44
44
  ]
45
45
  }
46
46
  },