@module-federation/runtime 0.0.8 → 0.0.9
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 +2 -2
- package/dist/index.esm.js +2 -2
- package/dist/package.json +1 -1
- package/dist/share.cjs.js +8 -5
- package/dist/share.esm.js +8 -5
- package/package.json +2 -2
package/dist/index.cjs.js
CHANGED
|
@@ -1518,7 +1518,7 @@ class FederationHost {
|
|
|
1518
1518
|
}
|
|
1519
1519
|
// Set the remote entry to a complete path
|
|
1520
1520
|
if ('entry' in remote) {
|
|
1521
|
-
if (share.isBrowserEnv()) {
|
|
1521
|
+
if (share.isBrowserEnv() && !remote.entry.startsWith('http')) {
|
|
1522
1522
|
remote.entry = new URL(remote.entry, window.location.origin).href;
|
|
1523
1523
|
}
|
|
1524
1524
|
}
|
|
@@ -1633,7 +1633,7 @@ class FederationHost {
|
|
|
1633
1633
|
// not used yet
|
|
1634
1634
|
afterPreloadRemote: new AsyncHook()
|
|
1635
1635
|
});
|
|
1636
|
-
this.version = "0.0.
|
|
1636
|
+
this.version = "0.0.9";
|
|
1637
1637
|
this.moduleCache = new Map();
|
|
1638
1638
|
this.loaderHook = new PluginSystem({
|
|
1639
1639
|
// FIXME: may not be suitable , not open to the public yet
|
package/dist/index.esm.js
CHANGED
|
@@ -1516,7 +1516,7 @@ class FederationHost {
|
|
|
1516
1516
|
}
|
|
1517
1517
|
// Set the remote entry to a complete path
|
|
1518
1518
|
if ('entry' in remote) {
|
|
1519
|
-
if (isBrowserEnv()) {
|
|
1519
|
+
if (isBrowserEnv() && !remote.entry.startsWith('http')) {
|
|
1520
1520
|
remote.entry = new URL(remote.entry, window.location.origin).href;
|
|
1521
1521
|
}
|
|
1522
1522
|
}
|
|
@@ -1631,7 +1631,7 @@ class FederationHost {
|
|
|
1631
1631
|
// not used yet
|
|
1632
1632
|
afterPreloadRemote: new AsyncHook()
|
|
1633
1633
|
});
|
|
1634
|
-
this.version = "0.0.
|
|
1634
|
+
this.version = "0.0.9";
|
|
1635
1635
|
this.moduleCache = new Map();
|
|
1636
1636
|
this.loaderHook = new PluginSystem({
|
|
1637
1637
|
// FIXME: may not be suitable , not open to the public yet
|
package/dist/package.json
CHANGED
package/dist/share.cjs.js
CHANGED
|
@@ -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.
|
|
174
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.9";
|
|
175
175
|
}
|
|
176
176
|
}
|
|
177
177
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -683,24 +683,27 @@ const findVersion = (shareScopeMap, scope, pkgName, cb)=>{
|
|
|
683
683
|
return prev;
|
|
684
684
|
}, 0);
|
|
685
685
|
};
|
|
686
|
+
const isLoaded = (shared)=>{
|
|
687
|
+
return Boolean(shared.loaded) || typeof shared.lib === 'function';
|
|
688
|
+
};
|
|
686
689
|
function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
|
|
687
690
|
const versions = shareScopeMap[scope][pkgName];
|
|
688
691
|
const callback = function(prev, cur) {
|
|
689
|
-
return !versions[prev]
|
|
692
|
+
return !isLoaded(versions[prev]) && versionLt(prev, cur);
|
|
690
693
|
};
|
|
691
694
|
return findVersion(shareScopeMap, scope, pkgName, callback);
|
|
692
695
|
}
|
|
693
696
|
function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
|
|
694
697
|
const versions = shareScopeMap[scope][pkgName];
|
|
695
698
|
const callback = function(prev, cur) {
|
|
696
|
-
if (versions[cur]
|
|
697
|
-
if (versions[prev]
|
|
699
|
+
if (isLoaded(versions[cur])) {
|
|
700
|
+
if (isLoaded(versions[prev])) {
|
|
698
701
|
return Boolean(versionLt(prev, cur));
|
|
699
702
|
} else {
|
|
700
703
|
return true;
|
|
701
704
|
}
|
|
702
705
|
}
|
|
703
|
-
if (versions[prev]
|
|
706
|
+
if (isLoaded(versions[prev])) {
|
|
704
707
|
return false;
|
|
705
708
|
}
|
|
706
709
|
return versionLt(prev, cur);
|
package/dist/share.esm.js
CHANGED
|
@@ -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.
|
|
172
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.0.9";
|
|
173
173
|
}
|
|
174
174
|
}
|
|
175
175
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -681,24 +681,27 @@ const findVersion = (shareScopeMap, scope, pkgName, cb)=>{
|
|
|
681
681
|
return prev;
|
|
682
682
|
}, 0);
|
|
683
683
|
};
|
|
684
|
+
const isLoaded = (shared)=>{
|
|
685
|
+
return Boolean(shared.loaded) || typeof shared.lib === 'function';
|
|
686
|
+
};
|
|
684
687
|
function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
|
|
685
688
|
const versions = shareScopeMap[scope][pkgName];
|
|
686
689
|
const callback = function(prev, cur) {
|
|
687
|
-
return !versions[prev]
|
|
690
|
+
return !isLoaded(versions[prev]) && versionLt(prev, cur);
|
|
688
691
|
};
|
|
689
692
|
return findVersion(shareScopeMap, scope, pkgName, callback);
|
|
690
693
|
}
|
|
691
694
|
function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
|
|
692
695
|
const versions = shareScopeMap[scope][pkgName];
|
|
693
696
|
const callback = function(prev, cur) {
|
|
694
|
-
if (versions[cur]
|
|
695
|
-
if (versions[prev]
|
|
697
|
+
if (isLoaded(versions[cur])) {
|
|
698
|
+
if (isLoaded(versions[prev])) {
|
|
696
699
|
return Boolean(versionLt(prev, cur));
|
|
697
700
|
} else {
|
|
698
701
|
return true;
|
|
699
702
|
}
|
|
700
703
|
}
|
|
701
|
-
if (versions[prev]
|
|
704
|
+
if (isLoaded(versions[prev])) {
|
|
702
705
|
return false;
|
|
703
706
|
}
|
|
704
707
|
return versionLt(prev, cur);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.9",
|
|
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.
|
|
48
|
+
"@module-federation/sdk": "0.0.9"
|
|
49
49
|
}
|
|
50
50
|
}
|