@module-federation/runtime 0.0.0-next-20240108071116 → 0.0.0-next-20240111135630

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs.js CHANGED
@@ -1489,6 +1489,11 @@ class FederationHost {
1489
1489
  }
1490
1490
  initShareScopeMap(scopeName, shareScope) {
1491
1491
  this.shareScopeMap[scopeName] = shareScope;
1492
+ this.hooks.lifecycle.initContainerShareScopeMap.emit({
1493
+ shareScope,
1494
+ options: this.options,
1495
+ origin: this
1496
+ });
1492
1497
  }
1493
1498
  formatOptions(globalOptions, userOptions) {
1494
1499
  const formatShareOptions = share.formatShareConfigs(userOptions.shared || {}, userOptions.name);
@@ -1521,7 +1526,6 @@ class FederationHost {
1521
1526
  remote.shareScope = share.DEFAULT_SCOPE;
1522
1527
  }
1523
1528
  if (!remote.type) {
1524
- // FIXME: The build plugin needs to support this field
1525
1529
  remote.type = share.DEFAULT_REMOTE_TYPE;
1526
1530
  }
1527
1531
  res.push(remote);
@@ -1588,13 +1592,6 @@ class FederationHost {
1588
1592
  this.shareScopeMap[sc][pkgName] = {};
1589
1593
  }
1590
1594
  if (this.shareScopeMap[sc][pkgName][version]) {
1591
- share.warn(// eslint-disable-next-line max-len
1592
- `The share \n ${share.safeToString({
1593
- scope: sc,
1594
- pkgName,
1595
- version,
1596
- from: this.shareScopeMap[sc][pkgName][version].from
1597
- })} has been registered`);
1598
1595
  return;
1599
1596
  }
1600
1597
  this.shareScopeMap[sc][pkgName][version] = _extends({
@@ -1621,6 +1618,8 @@ class FederationHost {
1621
1618
  // maybe will change, temporarily for internal use only
1622
1619
  beforeInitContainer: new AsyncWaterfallHook('beforeInitContainer'),
1623
1620
  // maybe will change, temporarily for internal use only
1621
+ initContainerShareScopeMap: new AsyncWaterfallHook('initContainer'),
1622
+ // maybe will change, temporarily for internal use only
1624
1623
  initContainer: new AsyncWaterfallHook('initContainer'),
1625
1624
  onLoad: new AsyncHook('onLoad'),
1626
1625
  handlePreloadModule: new SyncHook('handlePreloadModule'),
@@ -1634,8 +1633,7 @@ class FederationHost {
1634
1633
  // not used yet
1635
1634
  afterPreloadRemote: new AsyncHook()
1636
1635
  });
1637
- this.releaseNumber = `7`;
1638
- this.version = `'0.0.7'`;
1636
+ this.version = "0.0.8";
1639
1637
  this.moduleCache = new Map();
1640
1638
  this.loaderHook = new PluginSystem({
1641
1639
  // FIXME: may not be suitable , not open to the public yet
package/dist/index.esm.js CHANGED
@@ -1487,6 +1487,11 @@ class FederationHost {
1487
1487
  }
1488
1488
  initShareScopeMap(scopeName, shareScope) {
1489
1489
  this.shareScopeMap[scopeName] = shareScope;
1490
+ this.hooks.lifecycle.initContainerShareScopeMap.emit({
1491
+ shareScope,
1492
+ options: this.options,
1493
+ origin: this
1494
+ });
1490
1495
  }
1491
1496
  formatOptions(globalOptions, userOptions) {
1492
1497
  const formatShareOptions = formatShareConfigs(userOptions.shared || {}, userOptions.name);
@@ -1519,7 +1524,6 @@ class FederationHost {
1519
1524
  remote.shareScope = DEFAULT_SCOPE;
1520
1525
  }
1521
1526
  if (!remote.type) {
1522
- // FIXME: The build plugin needs to support this field
1523
1527
  remote.type = DEFAULT_REMOTE_TYPE;
1524
1528
  }
1525
1529
  res.push(remote);
@@ -1586,13 +1590,6 @@ class FederationHost {
1586
1590
  this.shareScopeMap[sc][pkgName] = {};
1587
1591
  }
1588
1592
  if (this.shareScopeMap[sc][pkgName][version]) {
1589
- warn(// eslint-disable-next-line max-len
1590
- `The share \n ${safeToString({
1591
- scope: sc,
1592
- pkgName,
1593
- version,
1594
- from: this.shareScopeMap[sc][pkgName][version].from
1595
- })} has been registered`);
1596
1593
  return;
1597
1594
  }
1598
1595
  this.shareScopeMap[sc][pkgName][version] = _extends({
@@ -1619,6 +1616,8 @@ class FederationHost {
1619
1616
  // maybe will change, temporarily for internal use only
1620
1617
  beforeInitContainer: new AsyncWaterfallHook('beforeInitContainer'),
1621
1618
  // maybe will change, temporarily for internal use only
1619
+ initContainerShareScopeMap: new AsyncWaterfallHook('initContainer'),
1620
+ // maybe will change, temporarily for internal use only
1622
1621
  initContainer: new AsyncWaterfallHook('initContainer'),
1623
1622
  onLoad: new AsyncHook('onLoad'),
1624
1623
  handlePreloadModule: new SyncHook('handlePreloadModule'),
@@ -1632,8 +1631,7 @@ class FederationHost {
1632
1631
  // not used yet
1633
1632
  afterPreloadRemote: new AsyncHook()
1634
1633
  });
1635
- this.releaseNumber = `7`;
1636
- this.version = `'0.0.7'`;
1634
+ this.version = "0.0.8";
1637
1635
  this.moduleCache = new Map();
1638
1636
  this.loaderHook = new PluginSystem({
1639
1637
  // FIXME: may not be suitable , not open to the public yet
package/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.7",
3
+ "version": "0.0.8",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./index.cjs.js",
6
6
  "module": "./index.esm.js",
package/dist/share.cjs.js CHANGED
@@ -5,7 +5,7 @@ function getBuilderId() {
5
5
  return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined' ? FEDERATION_BUILD_IDENTIFIER : '';
6
6
  }
7
7
  function isDebugMode() {
8
- return Boolean('');
8
+ return Boolean("");
9
9
  }
10
10
  function isBrowserEnv() {
11
11
  return typeof window !== 'undefined';
@@ -171,7 +171,7 @@ function getGlobalFederationConstructor() {
171
171
  function setGlobalFederationConstructor(FederationConstructor) {
172
172
  if (isDebugMode()) {
173
173
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
174
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '0.0.7';
174
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.8";
175
175
  }
176
176
  }
177
177
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -713,8 +713,6 @@ function getFindShareFunction(strategy) {
713
713
  }
714
714
  return findSingletonVersionOrderByVersion;
715
715
  }
716
- // Details about shared resources
717
- // TODO: Implement strictVersion for alignment with module federation.
718
716
  function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare) {
719
717
  if (!localShareScopeMap) {
720
718
  return;
package/dist/share.esm.js CHANGED
@@ -3,7 +3,7 @@ function getBuilderId() {
3
3
  return typeof FEDERATION_BUILD_IDENTIFIER !== 'undefined' ? FEDERATION_BUILD_IDENTIFIER : '';
4
4
  }
5
5
  function isDebugMode() {
6
- return Boolean('');
6
+ return Boolean("");
7
7
  }
8
8
  function isBrowserEnv() {
9
9
  return typeof window !== 'undefined';
@@ -169,7 +169,7 @@ function getGlobalFederationConstructor() {
169
169
  function setGlobalFederationConstructor(FederationConstructor) {
170
170
  if (isDebugMode()) {
171
171
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
172
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = '0.0.7';
172
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.8";
173
173
  }
174
174
  }
175
175
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -711,8 +711,6 @@ function getFindShareFunction(strategy) {
711
711
  }
712
712
  return findSingletonVersionOrderByVersion;
713
713
  }
714
- // Details about shared resources
715
- // TODO: Implement strictVersion for alignment with module federation.
716
714
  function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare) {
717
715
  if (!localShareScopeMap) {
718
716
  return;
@@ -40,6 +40,11 @@ export declare class FederationHost {
40
40
  remoteInfo: RemoteInfo;
41
41
  origin: FederationHost;
42
42
  }>;
43
+ initContainerShareScopeMap: AsyncWaterfallHook<{
44
+ shareScope: ShareScopeMap[string];
45
+ options: Options;
46
+ origin: FederationHost;
47
+ }>;
43
48
  initContainer: AsyncWaterfallHook<{
44
49
  shareScope: ShareScopeMap[string];
45
50
  initScope: InitScope;
@@ -105,7 +110,6 @@ export declare class FederationHost {
105
110
  origin: FederationHost;
106
111
  }, false | void | Promise<false | void>>;
107
112
  }>;
108
- releaseNumber: string;
109
113
  version: string;
110
114
  name: string;
111
115
  moduleCache: Map<string, Module>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.0-next-20240108071116",
3
+ "version": "0.0.0-next-20240111135630",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./dist/index.cjs",
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-20240108071116"
48
+ "@module-federation/sdk": "0.0.0-next-20240111135630"
49
49
  }
50
50
  }