@module-federation/runtime 0.0.0-next-20241106024856 → 0.0.0-next-20241106033151

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
@@ -1999,7 +1999,7 @@ class FederationHost {
1999
1999
  // maybe will change, temporarily for internal use only
2000
2000
  initContainer: new AsyncWaterfallHook('initContainer')
2001
2001
  });
2002
- this.version = "0.6.16";
2002
+ this.version = "0.7.0";
2003
2003
  this.moduleCache = new Map();
2004
2004
  this.loaderHook = new PluginSystem({
2005
2005
  // FIXME: may not be suitable , not open to the public yet
@@ -1999,7 +1999,7 @@ class FederationHost {
1999
1999
  // maybe will change, temporarily for internal use only
2000
2000
  initContainer: new AsyncWaterfallHook('initContainer')
2001
2001
  });
2002
- this.version = "0.6.16";
2002
+ this.version = "0.7.0";
2003
2003
  this.moduleCache = new Map();
2004
2004
  this.loaderHook = new PluginSystem({
2005
2005
  // 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.6.16",
3
+ "version": "0.7.0",
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
@@ -154,6 +154,9 @@ function resetFederationGlobalInfo() {
154
154
  globalThis.__FEDERATION__.moduleInfo = {};
155
155
  globalThis.__FEDERATION__.__SHARE__ = {};
156
156
  globalThis.__FEDERATION__.__MANIFEST_LOADING__ = {};
157
+ Object.keys(globalLoading).forEach((key)=>{
158
+ delete globalLoading[key];
159
+ });
157
160
  }
158
161
  function getGlobalFederationInstance(name, version) {
159
162
  const buildId = getBuilderId();
@@ -179,7 +182,7 @@ function getGlobalFederationConstructor() {
179
182
  function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
180
183
  if (isDebug) {
181
184
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
182
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.16";
185
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.0";
183
186
  }
184
187
  }
185
188
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -765,6 +768,9 @@ const findVersion = (shareVersionMap, cb)=>{
765
768
  const isLoaded = (shared)=>{
766
769
  return Boolean(shared.loaded) || typeof shared.lib === 'function';
767
770
  };
771
+ const isLoading = (shared)=>{
772
+ return Boolean(shared.loading);
773
+ };
768
774
  function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
769
775
  const versions = shareScopeMap[scope][pkgName];
770
776
  const callback = function(prev, cur) {
@@ -775,14 +781,17 @@ function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
775
781
  function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
776
782
  const versions = shareScopeMap[scope][pkgName];
777
783
  const callback = function(prev, cur) {
778
- if (isLoaded(versions[cur])) {
779
- if (isLoaded(versions[prev])) {
784
+ const isLoadingOrLoaded = (shared)=>{
785
+ return isLoaded(shared) || isLoading(shared);
786
+ };
787
+ if (isLoadingOrLoaded(versions[cur])) {
788
+ if (isLoadingOrLoaded(versions[prev])) {
780
789
  return Boolean(versionLt(prev, cur));
781
790
  } else {
782
791
  return true;
783
792
  }
784
793
  }
785
- if (isLoaded(versions[prev])) {
794
+ if (isLoadingOrLoaded(versions[prev])) {
786
795
  return false;
787
796
  }
788
797
  return versionLt(prev, cur);
@@ -152,6 +152,9 @@ function resetFederationGlobalInfo() {
152
152
  globalThis.__FEDERATION__.moduleInfo = {};
153
153
  globalThis.__FEDERATION__.__SHARE__ = {};
154
154
  globalThis.__FEDERATION__.__MANIFEST_LOADING__ = {};
155
+ Object.keys(globalLoading).forEach((key)=>{
156
+ delete globalLoading[key];
157
+ });
155
158
  }
156
159
  function getGlobalFederationInstance(name, version) {
157
160
  const buildId = getBuilderId();
@@ -177,7 +180,7 @@ function getGlobalFederationConstructor() {
177
180
  function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
178
181
  if (isDebug) {
179
182
  globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
180
- globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.6.16";
183
+ globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.0";
181
184
  }
182
185
  }
183
186
  // eslint-disable-next-line @typescript-eslint/ban-types
@@ -763,6 +766,9 @@ const findVersion = (shareVersionMap, cb)=>{
763
766
  const isLoaded = (shared)=>{
764
767
  return Boolean(shared.loaded) || typeof shared.lib === 'function';
765
768
  };
769
+ const isLoading = (shared)=>{
770
+ return Boolean(shared.loading);
771
+ };
766
772
  function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
767
773
  const versions = shareScopeMap[scope][pkgName];
768
774
  const callback = function(prev, cur) {
@@ -773,14 +779,17 @@ function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
773
779
  function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
774
780
  const versions = shareScopeMap[scope][pkgName];
775
781
  const callback = function(prev, cur) {
776
- if (isLoaded(versions[cur])) {
777
- if (isLoaded(versions[prev])) {
782
+ const isLoadingOrLoaded = (shared)=>{
783
+ return isLoaded(shared) || isLoading(shared);
784
+ };
785
+ if (isLoadingOrLoaded(versions[cur])) {
786
+ if (isLoadingOrLoaded(versions[prev])) {
778
787
  return Boolean(versionLt(prev, cur));
779
788
  } else {
780
789
  return true;
781
790
  }
782
791
  }
783
- if (isLoaded(versions[prev])) {
792
+ if (isLoadingOrLoaded(versions[prev])) {
784
793
  return false;
785
794
  }
786
795
  return versionLt(prev, cur);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/runtime",
3
- "version": "0.0.0-next-20241106024856",
3
+ "version": "0.0.0-next-20241106033151",
4
4
  "author": "zhouxiao <codingzx@gmail.com>",
5
5
  "main": "./dist/index.cjs.js",
6
6
  "module": "./dist/index.esm.mjs",
@@ -50,7 +50,7 @@
50
50
  }
51
51
  },
52
52
  "dependencies": {
53
- "@module-federation/sdk": "0.0.0-next-20241106024856",
54
- "@module-federation/error-codes": "0.0.0-next-20241106024856"
53
+ "@module-federation/sdk": "0.0.0-next-20241106033151",
54
+ "@module-federation/error-codes": "0.0.0-next-20241106033151"
55
55
  }
56
56
  }