@module-federation/runtime 0.6.16 → 0.7.0
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/{helpers.esm.js → helpers.esm.mjs} +1 -1
- package/dist/index.cjs.js +22 -19
- package/dist/{index.esm.js → index.esm.mjs} +25 -22
- package/dist/package.json +5 -5
- package/dist/share.cjs.js +13 -5
- package/dist/{share.esm.js → share.esm.mjs} +14 -6
- package/dist/src/remote/index.d.ts +1 -1
- package/package.json +8 -8
- /package/dist/{embedded.esm.js → embedded.esm.mjs} +0 -0
- /package/dist/{polyfills.esm.js → polyfills.esm.mjs} +0 -0
- /package/dist/{types.esm.js → types.esm.mjs} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { g as getRegisteredShare, a as getGlobalShareScope, G as Global, n as nativeGlobal, r as resetFederationGlobalInfo, b as getGlobalFederationInstance, s as setGlobalFederationInstance, c as getGlobalFederationConstructor, d as setGlobalFederationConstructor, e as getInfoWithoutType, f as getGlobalSnapshot, h as getTargetSnapshotInfoByModuleInfo, i as getGlobalSnapshotInfoByModuleInfo, j as setGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, l as getRemoteEntryExports, m as registerGlobalPlugins, o as getGlobalHostPlugins, p as getPreloaded, q as setPreloaded } from './share.esm.
|
|
1
|
+
import { g as getRegisteredShare, a as getGlobalShareScope, G as Global, n as nativeGlobal, r as resetFederationGlobalInfo, b as getGlobalFederationInstance, s as setGlobalFederationInstance, c as getGlobalFederationConstructor, d as setGlobalFederationConstructor, e as getInfoWithoutType, f as getGlobalSnapshot, h as getTargetSnapshotInfoByModuleInfo, i as getGlobalSnapshotInfoByModuleInfo, j as setGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, l as getRemoteEntryExports, m as registerGlobalPlugins, o as getGlobalHostPlugins, p as getPreloaded, q as setPreloaded } from './share.esm.mjs';
|
|
2
2
|
|
|
3
3
|
const ShareUtils = {
|
|
4
4
|
getRegisteredShare,
|
package/dist/index.cjs.js
CHANGED
|
@@ -124,7 +124,7 @@ async function loadSystemJsEntry({ entry, remoteEntryExports }) {
|
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
async function loadEntryScript({ name, globalName, entry,
|
|
127
|
+
async function loadEntryScript({ name, globalName, entry, loaderHook }) {
|
|
128
128
|
const { entryExports: remoteEntryExports } = share.getRemoteEntryExports(name, globalName);
|
|
129
129
|
if (remoteEntryExports) {
|
|
130
130
|
return remoteEntryExports;
|
|
@@ -132,7 +132,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
132
132
|
return sdk.loadScript(entry, {
|
|
133
133
|
attrs: {},
|
|
134
134
|
createScriptHook: (url, attrs)=>{
|
|
135
|
-
const res =
|
|
135
|
+
const res = loaderHook.lifecycle.createScript.emit({
|
|
136
136
|
url,
|
|
137
137
|
attrs
|
|
138
138
|
});
|
|
@@ -157,7 +157,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
157
157
|
throw e;
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
|
-
async function loadEntryDom({ remoteInfo, remoteEntryExports,
|
|
160
|
+
async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook }) {
|
|
161
161
|
const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
|
|
162
162
|
switch(type){
|
|
163
163
|
case 'esm':
|
|
@@ -176,11 +176,11 @@ async function loadEntryDom({ remoteInfo, remoteEntryExports, createScriptHook }
|
|
|
176
176
|
entry,
|
|
177
177
|
globalName,
|
|
178
178
|
name,
|
|
179
|
-
|
|
179
|
+
loaderHook
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
async function loadEntryNode({ remoteInfo,
|
|
183
|
+
async function loadEntryNode({ remoteInfo, loaderHook }) {
|
|
184
184
|
const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
|
|
185
185
|
const { entryExports: remoteEntryExports } = share.getRemoteEntryExports(name, globalName);
|
|
186
186
|
if (remoteEntryExports) {
|
|
@@ -192,16 +192,18 @@ async function loadEntryNode({ remoteInfo, createScriptHook }) {
|
|
|
192
192
|
globalName,
|
|
193
193
|
type
|
|
194
194
|
},
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
195
|
+
loaderHook: {
|
|
196
|
+
createScriptHook: (url, attrs = {})=>{
|
|
197
|
+
const res = loaderHook.lifecycle.createScript.emit({
|
|
198
|
+
url,
|
|
199
|
+
attrs
|
|
200
|
+
});
|
|
201
|
+
if (!res) return;
|
|
202
|
+
if ('url' in res) {
|
|
203
|
+
return res;
|
|
204
|
+
}
|
|
205
|
+
return;
|
|
203
206
|
}
|
|
204
|
-
return;
|
|
205
207
|
}
|
|
206
208
|
}).then(()=>{
|
|
207
209
|
const { remoteEntryKey, entryExports } = share.getRemoteEntryExports(name, globalName);
|
|
@@ -226,9 +228,10 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
|
|
|
226
228
|
}
|
|
227
229
|
if (!share.globalLoading[uniqueKey]) {
|
|
228
230
|
const loadEntryHook = origin.remoteHandler.hooks.lifecycle.loadEntry;
|
|
229
|
-
|
|
231
|
+
origin.loaderHook.lifecycle.createScript;
|
|
232
|
+
const loaderHook = origin.loaderHook;
|
|
230
233
|
share.globalLoading[uniqueKey] = loadEntryHook.emit({
|
|
231
|
-
|
|
234
|
+
loaderHook,
|
|
232
235
|
remoteInfo,
|
|
233
236
|
remoteEntryExports
|
|
234
237
|
}).then((res)=>{
|
|
@@ -238,10 +241,10 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
|
|
|
238
241
|
return sdk.isBrowserEnv() ? loadEntryDom({
|
|
239
242
|
remoteInfo,
|
|
240
243
|
remoteEntryExports,
|
|
241
|
-
|
|
244
|
+
loaderHook
|
|
242
245
|
}) : loadEntryNode({
|
|
243
246
|
remoteInfo,
|
|
244
|
-
|
|
247
|
+
loaderHook
|
|
245
248
|
});
|
|
246
249
|
});
|
|
247
250
|
}
|
|
@@ -1996,7 +1999,7 @@ class FederationHost {
|
|
|
1996
1999
|
// maybe will change, temporarily for internal use only
|
|
1997
2000
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1998
2001
|
});
|
|
1999
|
-
this.version = "0.
|
|
2002
|
+
this.version = "0.7.0";
|
|
2000
2003
|
this.moduleCache = new Map();
|
|
2001
2004
|
this.loaderHook = new PluginSystem({
|
|
2002
2005
|
// FIXME: may not be suitable , not open to the public yet
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { a as _extends, _ as _object_without_properties_loose } from './polyfills.esm.
|
|
1
|
+
import { a as _extends, _ as _object_without_properties_loose } from './polyfills.esm.mjs';
|
|
2
2
|
import { isBrowserEnv, loadScriptNode, composeKeyWithSeparator, loadScript, safeToString, createLink, createScript, getResourceUrl, isManifestProvider, generateSnapshotFromManifest, warn as warn$1 } from '@module-federation/sdk';
|
|
3
3
|
export { loadScript, loadScriptNode } from '@module-federation/sdk';
|
|
4
|
-
import { o as getGlobalHostPlugins, t as globalLoading, D as DEFAULT_REMOTE_TYPE, u as DEFAULT_SCOPE, l as getRemoteEntryExports, v as assert, w as error, x as getFMId, y as isObject, z as warn, A as isPlainObject, B as isRemoteInfoWithEntry, C as isPureRemoteEntry, E as getRemoteEntryInfoFromSnapshot, e as getInfoWithoutType, p as getPreloaded, q as setPreloaded, g as getRegisteredShare, F as arrayOptions, i as getGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, j as setGlobalSnapshotInfoByModuleInfo, G as Global, f as getGlobalSnapshot, H as formatShareConfigs, I as getTargetSharedOptions, a as getGlobalShareScope, J as addUniqueItem, K as logger, L as getBuilderId, d as setGlobalFederationConstructor, b as getGlobalFederationInstance, c as getGlobalFederationConstructor, s as setGlobalFederationInstance } from './share.esm.
|
|
5
|
-
export { m as registerGlobalPlugins } from './share.esm.
|
|
4
|
+
import { o as getGlobalHostPlugins, t as globalLoading, D as DEFAULT_REMOTE_TYPE, u as DEFAULT_SCOPE, l as getRemoteEntryExports, v as assert, w as error, x as getFMId, y as isObject, z as warn, A as isPlainObject, B as isRemoteInfoWithEntry, C as isPureRemoteEntry, E as getRemoteEntryInfoFromSnapshot, e as getInfoWithoutType, p as getPreloaded, q as setPreloaded, g as getRegisteredShare, F as arrayOptions, i as getGlobalSnapshotInfoByModuleInfo, k as addGlobalSnapshot, j as setGlobalSnapshotInfoByModuleInfo, G as Global, f as getGlobalSnapshot, H as formatShareConfigs, I as getTargetSharedOptions, a as getGlobalShareScope, J as addUniqueItem, K as logger, L as getBuilderId, d as setGlobalFederationConstructor, b as getGlobalFederationInstance, c as getGlobalFederationConstructor, s as setGlobalFederationInstance } from './share.esm.mjs';
|
|
5
|
+
export { m as registerGlobalPlugins } from './share.esm.mjs';
|
|
6
6
|
import { getShortErrorMsg, RUNTIME_001, runtimeDescMap, RUNTIME_002, RUNTIME_007, RUNTIME_003, RUNTIME_005, RUNTIME_006, RUNTIME_004 } from '@module-federation/error-codes';
|
|
7
7
|
|
|
8
8
|
// Function to match a remote with its name and expose
|
|
@@ -124,7 +124,7 @@ async function loadSystemJsEntry({ entry, remoteEntryExports }) {
|
|
|
124
124
|
}
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
async function loadEntryScript({ name, globalName, entry,
|
|
127
|
+
async function loadEntryScript({ name, globalName, entry, loaderHook }) {
|
|
128
128
|
const { entryExports: remoteEntryExports } = getRemoteEntryExports(name, globalName);
|
|
129
129
|
if (remoteEntryExports) {
|
|
130
130
|
return remoteEntryExports;
|
|
@@ -132,7 +132,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
132
132
|
return loadScript(entry, {
|
|
133
133
|
attrs: {},
|
|
134
134
|
createScriptHook: (url, attrs)=>{
|
|
135
|
-
const res =
|
|
135
|
+
const res = loaderHook.lifecycle.createScript.emit({
|
|
136
136
|
url,
|
|
137
137
|
attrs
|
|
138
138
|
});
|
|
@@ -157,7 +157,7 @@ async function loadEntryScript({ name, globalName, entry, createScriptHook }) {
|
|
|
157
157
|
throw e;
|
|
158
158
|
});
|
|
159
159
|
}
|
|
160
|
-
async function loadEntryDom({ remoteInfo, remoteEntryExports,
|
|
160
|
+
async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook }) {
|
|
161
161
|
const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
|
|
162
162
|
switch(type){
|
|
163
163
|
case 'esm':
|
|
@@ -176,11 +176,11 @@ async function loadEntryDom({ remoteInfo, remoteEntryExports, createScriptHook }
|
|
|
176
176
|
entry,
|
|
177
177
|
globalName,
|
|
178
178
|
name,
|
|
179
|
-
|
|
179
|
+
loaderHook
|
|
180
180
|
});
|
|
181
181
|
}
|
|
182
182
|
}
|
|
183
|
-
async function loadEntryNode({ remoteInfo,
|
|
183
|
+
async function loadEntryNode({ remoteInfo, loaderHook }) {
|
|
184
184
|
const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
|
|
185
185
|
const { entryExports: remoteEntryExports } = getRemoteEntryExports(name, globalName);
|
|
186
186
|
if (remoteEntryExports) {
|
|
@@ -192,16 +192,18 @@ async function loadEntryNode({ remoteInfo, createScriptHook }) {
|
|
|
192
192
|
globalName,
|
|
193
193
|
type
|
|
194
194
|
},
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
195
|
+
loaderHook: {
|
|
196
|
+
createScriptHook: (url, attrs = {})=>{
|
|
197
|
+
const res = loaderHook.lifecycle.createScript.emit({
|
|
198
|
+
url,
|
|
199
|
+
attrs
|
|
200
|
+
});
|
|
201
|
+
if (!res) return;
|
|
202
|
+
if ('url' in res) {
|
|
203
|
+
return res;
|
|
204
|
+
}
|
|
205
|
+
return;
|
|
203
206
|
}
|
|
204
|
-
return;
|
|
205
207
|
}
|
|
206
208
|
}).then(()=>{
|
|
207
209
|
const { remoteEntryKey, entryExports } = getRemoteEntryExports(name, globalName);
|
|
@@ -226,9 +228,10 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
|
|
|
226
228
|
}
|
|
227
229
|
if (!globalLoading[uniqueKey]) {
|
|
228
230
|
const loadEntryHook = origin.remoteHandler.hooks.lifecycle.loadEntry;
|
|
229
|
-
|
|
231
|
+
origin.loaderHook.lifecycle.createScript;
|
|
232
|
+
const loaderHook = origin.loaderHook;
|
|
230
233
|
globalLoading[uniqueKey] = loadEntryHook.emit({
|
|
231
|
-
|
|
234
|
+
loaderHook,
|
|
232
235
|
remoteInfo,
|
|
233
236
|
remoteEntryExports
|
|
234
237
|
}).then((res)=>{
|
|
@@ -238,10 +241,10 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
|
|
|
238
241
|
return isBrowserEnv() ? loadEntryDom({
|
|
239
242
|
remoteInfo,
|
|
240
243
|
remoteEntryExports,
|
|
241
|
-
|
|
244
|
+
loaderHook
|
|
242
245
|
}) : loadEntryNode({
|
|
243
246
|
remoteInfo,
|
|
244
|
-
|
|
247
|
+
loaderHook
|
|
245
248
|
});
|
|
246
249
|
});
|
|
247
250
|
}
|
|
@@ -1996,7 +1999,7 @@ class FederationHost {
|
|
|
1996
1999
|
// maybe will change, temporarily for internal use only
|
|
1997
2000
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
1998
2001
|
});
|
|
1999
|
-
this.version = "0.
|
|
2002
|
+
this.version = "0.7.0";
|
|
2000
2003
|
this.moduleCache = new Map();
|
|
2001
2004
|
this.loaderHook = new PluginSystem({
|
|
2002
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.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./index.cjs.js",
|
|
6
6
|
"module": "./index.esm.js",
|
|
@@ -16,22 +16,22 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
18
|
"types": "./dist/index.cjs.d.ts",
|
|
19
|
-
"import": "./dist/index.esm.
|
|
19
|
+
"import": "./dist/index.esm.mjs",
|
|
20
20
|
"require": "./dist/index.cjs.js"
|
|
21
21
|
},
|
|
22
22
|
"./helpers": {
|
|
23
23
|
"types": "./dist/helpers.cjs.d.ts",
|
|
24
|
-
"import": "./dist/helpers.esm.
|
|
24
|
+
"import": "./dist/helpers.esm.mjs",
|
|
25
25
|
"require": "./dist/helpers.cjs.js"
|
|
26
26
|
},
|
|
27
27
|
"./types": {
|
|
28
28
|
"types": "./dist/types.cjs.d.ts",
|
|
29
|
-
"import": "./dist/types.esm.
|
|
29
|
+
"import": "./dist/types.esm.mjs",
|
|
30
30
|
"require": "./dist/types.cjs.js"
|
|
31
31
|
},
|
|
32
32
|
"./embedded": {
|
|
33
33
|
"types": "./dist/embedded.cjs.d.ts",
|
|
34
|
-
"import": "./dist/embedded.esm.
|
|
34
|
+
"import": "./dist/embedded.esm.mjs",
|
|
35
35
|
"require": "./dist/embedded.cjs.js"
|
|
36
36
|
},
|
|
37
37
|
"./*": "./*"
|
package/dist/share.cjs.js
CHANGED
|
@@ -92,8 +92,10 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
|
|
|
92
92
|
|
|
93
93
|
const nativeGlobal = (()=>{
|
|
94
94
|
try {
|
|
95
|
-
|
|
95
|
+
// get real window (incase of sandbox)
|
|
96
|
+
return document.defaultView;
|
|
96
97
|
} catch (e) {
|
|
98
|
+
// node env
|
|
97
99
|
return globalThis;
|
|
98
100
|
}
|
|
99
101
|
})();
|
|
@@ -177,7 +179,7 @@ function getGlobalFederationConstructor() {
|
|
|
177
179
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
|
|
178
180
|
if (isDebug) {
|
|
179
181
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
180
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.
|
|
182
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.0";
|
|
181
183
|
}
|
|
182
184
|
}
|
|
183
185
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -763,6 +765,9 @@ const findVersion = (shareVersionMap, cb)=>{
|
|
|
763
765
|
const isLoaded = (shared)=>{
|
|
764
766
|
return Boolean(shared.loaded) || typeof shared.lib === 'function';
|
|
765
767
|
};
|
|
768
|
+
const isLoading = (shared)=>{
|
|
769
|
+
return Boolean(shared.loading);
|
|
770
|
+
};
|
|
766
771
|
function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
|
|
767
772
|
const versions = shareScopeMap[scope][pkgName];
|
|
768
773
|
const callback = function(prev, cur) {
|
|
@@ -773,14 +778,17 @@ function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
|
|
|
773
778
|
function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
|
|
774
779
|
const versions = shareScopeMap[scope][pkgName];
|
|
775
780
|
const callback = function(prev, cur) {
|
|
776
|
-
|
|
777
|
-
|
|
781
|
+
const isLoadingOrLoaded = (shared)=>{
|
|
782
|
+
return isLoaded(shared) || isLoading(shared);
|
|
783
|
+
};
|
|
784
|
+
if (isLoadingOrLoaded(versions[cur])) {
|
|
785
|
+
if (isLoadingOrLoaded(versions[prev])) {
|
|
778
786
|
return Boolean(versionLt(prev, cur));
|
|
779
787
|
} else {
|
|
780
788
|
return true;
|
|
781
789
|
}
|
|
782
790
|
}
|
|
783
|
-
if (
|
|
791
|
+
if (isLoadingOrLoaded(versions[prev])) {
|
|
784
792
|
return false;
|
|
785
793
|
}
|
|
786
794
|
return versionLt(prev, cur);
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { _ as _object_without_properties_loose, a as _extends } from './polyfills.esm.
|
|
1
|
+
import { _ as _object_without_properties_loose, a as _extends } from './polyfills.esm.mjs';
|
|
2
2
|
import { createLogger, isBrowserEnv, isDebugMode } from '@module-federation/sdk';
|
|
3
3
|
|
|
4
4
|
function getBuilderId() {
|
|
@@ -90,8 +90,10 @@ function getRemoteEntryInfoFromSnapshot(snapshot) {
|
|
|
90
90
|
|
|
91
91
|
const nativeGlobal = (()=>{
|
|
92
92
|
try {
|
|
93
|
-
|
|
93
|
+
// get real window (incase of sandbox)
|
|
94
|
+
return document.defaultView;
|
|
94
95
|
} catch (e) {
|
|
96
|
+
// node env
|
|
95
97
|
return globalThis;
|
|
96
98
|
}
|
|
97
99
|
})();
|
|
@@ -175,7 +177,7 @@ function getGlobalFederationConstructor() {
|
|
|
175
177
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
176
178
|
if (isDebug) {
|
|
177
179
|
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
178
|
-
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.
|
|
180
|
+
globalThis.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.7.0";
|
|
179
181
|
}
|
|
180
182
|
}
|
|
181
183
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -761,6 +763,9 @@ const findVersion = (shareVersionMap, cb)=>{
|
|
|
761
763
|
const isLoaded = (shared)=>{
|
|
762
764
|
return Boolean(shared.loaded) || typeof shared.lib === 'function';
|
|
763
765
|
};
|
|
766
|
+
const isLoading = (shared)=>{
|
|
767
|
+
return Boolean(shared.loading);
|
|
768
|
+
};
|
|
764
769
|
function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
|
|
765
770
|
const versions = shareScopeMap[scope][pkgName];
|
|
766
771
|
const callback = function(prev, cur) {
|
|
@@ -771,14 +776,17 @@ function findSingletonVersionOrderByVersion(shareScopeMap, scope, pkgName) {
|
|
|
771
776
|
function findSingletonVersionOrderByLoaded(shareScopeMap, scope, pkgName) {
|
|
772
777
|
const versions = shareScopeMap[scope][pkgName];
|
|
773
778
|
const callback = function(prev, cur) {
|
|
774
|
-
|
|
775
|
-
|
|
779
|
+
const isLoadingOrLoaded = (shared)=>{
|
|
780
|
+
return isLoaded(shared) || isLoading(shared);
|
|
781
|
+
};
|
|
782
|
+
if (isLoadingOrLoaded(versions[cur])) {
|
|
783
|
+
if (isLoadingOrLoaded(versions[prev])) {
|
|
776
784
|
return Boolean(versionLt(prev, cur));
|
|
777
785
|
} else {
|
|
778
786
|
return true;
|
|
779
787
|
}
|
|
780
788
|
}
|
|
781
|
-
if (
|
|
789
|
+
if (isLoadingOrLoaded(versions[prev])) {
|
|
782
790
|
return false;
|
|
783
791
|
}
|
|
784
792
|
return versionLt(prev, cur);
|
|
@@ -79,7 +79,7 @@ export declare class RemoteHandler {
|
|
|
79
79
|
origin: FederationHost;
|
|
80
80
|
}, false | void | Promise<false | void>>;
|
|
81
81
|
loadEntry: AsyncHook<[{
|
|
82
|
-
|
|
82
|
+
loaderHook: FederationHost["loaderHook"];
|
|
83
83
|
remoteInfo: RemoteInfo;
|
|
84
84
|
remoteEntryExports?: RemoteEntryExports;
|
|
85
85
|
}], Promise<RemoteEntryExports>>;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.7.0",
|
|
4
4
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
5
5
|
"main": "./dist/index.cjs.js",
|
|
6
|
-
"module": "./dist/index.esm.
|
|
6
|
+
"module": "./dist/index.esm.mjs",
|
|
7
7
|
"types": "./dist/index.cjs.d.ts",
|
|
8
8
|
"license": "MIT",
|
|
9
9
|
"publishConfig": {
|
|
@@ -16,22 +16,22 @@
|
|
|
16
16
|
"exports": {
|
|
17
17
|
".": {
|
|
18
18
|
"types": "./dist/index.cjs.d.ts",
|
|
19
|
-
"import": "./dist/index.esm.
|
|
19
|
+
"import": "./dist/index.esm.mjs",
|
|
20
20
|
"require": "./dist/index.cjs.js"
|
|
21
21
|
},
|
|
22
22
|
"./helpers": {
|
|
23
23
|
"types": "./dist/helpers.cjs.d.ts",
|
|
24
|
-
"import": "./dist/helpers.esm.
|
|
24
|
+
"import": "./dist/helpers.esm.mjs",
|
|
25
25
|
"require": "./dist/helpers.cjs.js"
|
|
26
26
|
},
|
|
27
27
|
"./types": {
|
|
28
28
|
"types": "./dist/types.cjs.d.ts",
|
|
29
|
-
"import": "./dist/types.esm.
|
|
29
|
+
"import": "./dist/types.esm.mjs",
|
|
30
30
|
"require": "./dist/types.cjs.js"
|
|
31
31
|
},
|
|
32
32
|
"./embedded": {
|
|
33
33
|
"types": "./dist/embedded.cjs.d.ts",
|
|
34
|
-
"import": "./dist/embedded.esm.
|
|
34
|
+
"import": "./dist/embedded.esm.mjs",
|
|
35
35
|
"require": "./dist/embedded.cjs.js"
|
|
36
36
|
},
|
|
37
37
|
"./*": "./*"
|
|
@@ -50,7 +50,7 @@
|
|
|
50
50
|
}
|
|
51
51
|
},
|
|
52
52
|
"dependencies": {
|
|
53
|
-
"@module-federation/sdk": "0.
|
|
54
|
-
"@module-federation/error-codes": "0.
|
|
53
|
+
"@module-federation/sdk": "0.7.0",
|
|
54
|
+
"@module-federation/error-codes": "0.7.0"
|
|
55
55
|
}
|
|
56
56
|
}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|