@module-federation/runtime 0.0.0-next-20240415102546 → 0.0.0-next-20240417205114

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
@@ -1567,6 +1567,7 @@ class FederationHost {
1567
1567
  ]);
1568
1568
  // Merge plugin
1569
1569
  this.options.plugins = this.options.plugins.reduce((res, plugin)=>{
1570
+ if (!plugin) return res;
1570
1571
  if (res && !res.find((item)=>item.name === plugin.name)) {
1571
1572
  res.push(plugin);
1572
1573
  }
@@ -1698,7 +1699,7 @@ class FederationHost {
1698
1699
  // not used yet
1699
1700
  afterPreloadRemote: new AsyncHook()
1700
1701
  });
1701
- this.version = "0.1.5";
1702
+ this.version = "0.1.6";
1702
1703
  this.moduleCache = new Map();
1703
1704
  this.loaderHook = new PluginSystem({
1704
1705
  // FIXME: may not be suitable , not open to the public yet
package/dist/index.esm.js CHANGED
@@ -1565,6 +1565,7 @@ class FederationHost {
1565
1565
  ]);
1566
1566
  // Merge plugin
1567
1567
  this.options.plugins = this.options.plugins.reduce((res, plugin)=>{
1568
+ if (!plugin) return res;
1568
1569
  if (res && !res.find((item)=>item.name === plugin.name)) {
1569
1570
  res.push(plugin);
1570
1571
  }
@@ -1696,7 +1697,7 @@ class FederationHost {
1696
1697
  // not used yet
1697
1698
  afterPreloadRemote: new AsyncHook()
1698
1699
  });
1699
- this.version = "0.1.5";
1700
+ this.version = "0.1.6";
1700
1701
  this.moduleCache = new Map();
1701
1702
  this.loaderHook = new PluginSystem({
1702
1703
  // 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.1.5",
3
+ "version": "0.1.6",
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
@@ -190,7 +190,7 @@ function getGlobalFederationConstructor() {
190
190
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
191
191
  if (isDebug) {
192
192
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
193
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.5";
193
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.6";
194
194
  }
195
195
  }
196
196
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -645,15 +645,19 @@ function _extends() {
645
645
  };
646
646
  return _extends.apply(this, arguments);
647
647
  }
648
- function formatShare(shareArgs, from) {
648
+ function formatShare(shareArgs, from, name) {
649
649
  let get;
650
650
  if ('get' in shareArgs) {
651
651
  // eslint-disable-next-line prefer-destructuring
652
652
  get = shareArgs.get;
653
- } else {
654
- // @ts-ignore ignore
653
+ } else if ('lib' in shareArgs) {
655
654
  get = ()=>Promise.resolve(shareArgs.lib);
655
+ } else {
656
+ get = ()=>Promise.resolve(()=>{
657
+ throw new Error(`Can not get shared '${name}'!`);
658
+ });
656
659
  }
660
+ var _shareArgs_version, _shareArgs_scope;
657
661
  return _extends({
658
662
  deps: [],
659
663
  useIn: [],
@@ -668,8 +672,9 @@ function formatShare(shareArgs, from) {
668
672
  }, shareArgs.shareConfig),
669
673
  get,
670
674
  loaded: 'lib' in shareArgs ? true : undefined,
675
+ version: (_shareArgs_version = shareArgs.version) != null ? _shareArgs_version : '0',
671
676
  scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [
672
- 'default'
677
+ (_shareArgs_scope = shareArgs.scope) != null ? _shareArgs_scope : 'default'
673
678
  ],
674
679
  strategy: shareArgs.strategy || 'version-first'
675
680
  });
@@ -682,7 +687,7 @@ function formatShareConfigs(shareArgs, from) {
682
687
  const arrayShareArgs = arrayOptions(shareArgs[pkgName]);
683
688
  res[pkgName] = res[pkgName] || [];
684
689
  arrayShareArgs.forEach((shareConfig)=>{
685
- res[pkgName].push(formatShare(shareConfig, from));
690
+ res[pkgName].push(formatShare(shareConfig, from, pkgName));
686
691
  });
687
692
  return res;
688
693
  }, {});
package/dist/share.esm.js CHANGED
@@ -188,7 +188,7 @@ function getGlobalFederationConstructor() {
188
188
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
189
189
  if (isDebug) {
190
190
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
191
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.5";
191
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.1.6";
192
192
  }
193
193
  }
194
194
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -643,15 +643,19 @@ function _extends() {
643
643
  };
644
644
  return _extends.apply(this, arguments);
645
645
  }
646
- function formatShare(shareArgs, from) {
646
+ function formatShare(shareArgs, from, name) {
647
647
  let get;
648
648
  if ('get' in shareArgs) {
649
649
  // eslint-disable-next-line prefer-destructuring
650
650
  get = shareArgs.get;
651
- } else {
652
- // @ts-ignore ignore
651
+ } else if ('lib' in shareArgs) {
653
652
  get = ()=>Promise.resolve(shareArgs.lib);
653
+ } else {
654
+ get = ()=>Promise.resolve(()=>{
655
+ throw new Error(`Can not get shared '${name}'!`);
656
+ });
654
657
  }
658
+ var _shareArgs_version, _shareArgs_scope;
655
659
  return _extends({
656
660
  deps: [],
657
661
  useIn: [],
@@ -666,8 +670,9 @@ function formatShare(shareArgs, from) {
666
670
  }, shareArgs.shareConfig),
667
671
  get,
668
672
  loaded: 'lib' in shareArgs ? true : undefined,
673
+ version: (_shareArgs_version = shareArgs.version) != null ? _shareArgs_version : '0',
669
674
  scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [
670
- 'default'
675
+ (_shareArgs_scope = shareArgs.scope) != null ? _shareArgs_scope : 'default'
671
676
  ],
672
677
  strategy: shareArgs.strategy || 'version-first'
673
678
  });
@@ -680,7 +685,7 @@ function formatShareConfigs(shareArgs, from) {
680
685
  const arrayShareArgs = arrayOptions(shareArgs[pkgName]);
681
686
  res[pkgName] = res[pkgName] || [];
682
687
  arrayShareArgs.forEach((shareConfig)=>{
683
- res[pkgName].push(formatShare(shareConfig, from));
688
+ res[pkgName].push(formatShare(shareConfig, from, pkgName));
684
689
  });
685
690
  return res;
686
691
  }, {});
@@ -1,7 +1,7 @@
1
1
  import { Federation } from '../global';
2
2
  import { GlobalShareScopeMap, Shared, ShareArgs, ShareInfos, ShareScopeMap, LoadShareExtraOptions, UserOptions } from '../type';
3
3
  import { SyncWaterfallHook } from './hooks';
4
- export declare function formatShare(shareArgs: ShareArgs, from: string): Shared;
4
+ export declare function formatShare(shareArgs: ShareArgs, from: string, name: string): Shared;
5
5
  export declare function formatShareConfigs(shareArgs: UserOptions['shared'], from: string): ShareInfos;
6
6
  export declare function versionLt(a: string, b: string): boolean;
7
7
  export declare const findVersion: (shareVersionMap: ShareScopeMap[string][string], cb?: ((prev: string, cur: string) => boolean) | undefined) => string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.0-next-20240415102546",
3
+ "version": "0.0.0-next-20240417205114",
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-20240415102546"
48
+ "@module-federation/sdk": "0.0.0-next-20240417205114"
49
49
  }
50
50
  }