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

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 : [
@@ -725,7 +726,12 @@ function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare
725
726
  const defaultResolver = ()=>{
726
727
  if (shareConfig.singleton) {
727
728
  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})`);
729
+ 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})`;
730
+ if (shareConfig.strictVersion) {
731
+ error(msg);
732
+ } else {
733
+ warn(msg);
734
+ }
729
735
  }
730
736
  return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
731
737
  } 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 : [
@@ -723,7 +724,12 @@ function getRegisteredShare(localShareScopeMap, pkgName, shareInfo, resolveShare
723
724
  const defaultResolver = ()=>{
724
725
  if (shareConfig.singleton) {
725
726
  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})`);
727
+ 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})`;
728
+ if (shareConfig.strictVersion) {
729
+ error(msg);
730
+ } else {
731
+ warn(msg);
732
+ }
727
733
  }
728
734
  return localShareScopeMap[sc][pkgName][maxOrSingletonVersion];
729
735
  } 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-20231225095220",
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-20231225095220"
49
49
  }
50
50
  }