@module-federation/runtime 0.0.0-next-20231225073141 → 0.0.0-next-20231225094207

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/share.cjs.js CHANGED
@@ -614,13 +614,14 @@ function formatShare(shareArgs, from) {
614
614
  deps: [],
615
615
  useIn: [],
616
616
  from,
617
- shareConfig: {
618
- requiredVersion: `^${shareArgs.version}`,
619
- singleton: false,
620
- eager: false
621
- },
622
617
  loading: null
623
618
  }, shareArgs, {
619
+ shareConfig: _extends({
620
+ requiredVersion: `^${shareArgs.version}`,
621
+ singleton: false,
622
+ eager: false,
623
+ strictVersion: false
624
+ }, shareArgs.shareConfig),
624
625
  get,
625
626
  loaded: 'lib' in shareArgs ? true : undefined,
626
627
  scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [
@@ -723,9 +724,15 @@ function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare
723
724
  const maxOrSingletonVersion = findShareFunction(localShareScopeMap, sc, pkgName);
724
725
  //@ts-ignore
725
726
  const defaultResolver = ()=>{
727
+ debugger;
726
728
  if (shareConfig.singleton) {
727
729
  if (typeof requiredVersion === 'string' && !satisfy(maxOrSingletonVersion, requiredVersion)) {
728
- warn(`Version ${maxOrSingletonVersion} from ${maxOrSingletonVersion && localShareScopeMap[sc][pkgName][maxOrSingletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`);
730
+ const msg = `Version ${maxOrSingletonVersion} from ${maxOrSingletonVersion && localShareScopeMap[sc][pkgName][maxOrSingletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`;
731
+ if (shareConfig.strictVersion) {
732
+ error(msg);
733
+ } else {
734
+ warn(msg);
735
+ }
729
736
  }
730
737
  return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
731
738
  } else {
package/dist/share.esm.js CHANGED
@@ -612,13 +612,14 @@ function formatShare(shareArgs, from) {
612
612
  deps: [],
613
613
  useIn: [],
614
614
  from,
615
- shareConfig: {
616
- requiredVersion: `^${shareArgs.version}`,
617
- singleton: false,
618
- eager: false
619
- },
620
615
  loading: null
621
616
  }, shareArgs, {
617
+ shareConfig: _extends({
618
+ requiredVersion: `^${shareArgs.version}`,
619
+ singleton: false,
620
+ eager: false,
621
+ strictVersion: false
622
+ }, shareArgs.shareConfig),
622
623
  get,
623
624
  loaded: 'lib' in shareArgs ? true : undefined,
624
625
  scope: Array.isArray(shareArgs.scope) ? shareArgs.scope : [
@@ -721,9 +722,15 @@ function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare
721
722
  const maxOrSingletonVersion = findShareFunction(localShareScopeMap, sc, pkgName);
722
723
  //@ts-ignore
723
724
  const defaultResolver = ()=>{
725
+ debugger;
724
726
  if (shareConfig.singleton) {
725
727
  if (typeof requiredVersion === 'string' && !satisfy(maxOrSingletonVersion, requiredVersion)) {
726
- warn(`Version ${maxOrSingletonVersion} from ${maxOrSingletonVersion && localShareScopeMap[sc][pkgName][maxOrSingletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`);
728
+ const msg = `Version ${maxOrSingletonVersion} from ${maxOrSingletonVersion && localShareScopeMap[sc][pkgName][maxOrSingletonVersion].from} of shared singleton module ${pkgName} does not satisfy the requirement of ${shareInfo.from} which needs ${requiredVersion})`;
729
+ if (shareConfig.strictVersion) {
730
+ error(msg);
731
+ } else {
732
+ warn(msg);
733
+ }
727
734
  }
728
735
  return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
729
736
  } else {
@@ -29,6 +29,7 @@ export interface SharedConfig {
29
29
  singleton?: boolean;
30
30
  requiredVersion: false | string;
31
31
  eager?: boolean;
32
+ strictVersion?: boolean;
32
33
  }
33
34
  type SharedBaseArgs = {
34
35
  version: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.0-next-20231225073141",
3
+ "version": "0.0.0-next-20231225094207",
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-20231225073141"
48
+ "@module-federation/sdk": "0.0.0-next-20231225094207"
49
49
  }
50
50
  }