@module-federation/runtime-core 0.0.0-next-20250815060347 → 0.0.0-next-20250827124348
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.cjs +13 -8
- package/dist/index.esm.js +13 -8
- package/dist/src/utils/load.d.ts +2 -1
- package/package.json +3 -3
package/dist/index.cjs.cjs
CHANGED
|
@@ -202,7 +202,7 @@ function getGlobalFederationConstructor() {
|
|
|
202
202
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = sdk.isDebugMode()) {
|
|
203
203
|
if (isDebug) {
|
|
204
204
|
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
205
|
-
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.
|
|
205
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.3";
|
|
206
206
|
}
|
|
207
207
|
}
|
|
208
208
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -1098,12 +1098,14 @@ function handleRemoteEntryLoaded(name, globalName, entry) {
|
|
|
1098
1098
|
}));
|
|
1099
1099
|
return entryExports;
|
|
1100
1100
|
}
|
|
1101
|
-
async function loadEntryScript({ name, globalName, entry, loaderHook }) {
|
|
1101
|
+
async function loadEntryScript({ name, globalName, entry, loaderHook, getRetryPath }) {
|
|
1102
1102
|
const { entryExports: remoteEntryExports } = getRemoteEntryExports(name, globalName);
|
|
1103
1103
|
if (remoteEntryExports) {
|
|
1104
1104
|
return remoteEntryExports;
|
|
1105
1105
|
}
|
|
1106
|
-
|
|
1106
|
+
// if this is a retry request, if user pass the getRetryPath parameter, use the getRetryPath to get the retry url
|
|
1107
|
+
const url = getRetryPath ? getRetryPath(entry) : entry;
|
|
1108
|
+
return sdk.loadScript(url, {
|
|
1107
1109
|
attrs: {},
|
|
1108
1110
|
createScriptHook: (url, attrs)=>{
|
|
1109
1111
|
const res = loaderHook.lifecycle.createScript.emit({
|
|
@@ -1129,7 +1131,7 @@ async function loadEntryScript({ name, globalName, entry, loaderHook }) {
|
|
|
1129
1131
|
throw e;
|
|
1130
1132
|
});
|
|
1131
1133
|
}
|
|
1132
|
-
async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook }) {
|
|
1134
|
+
async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getRetryPath }) {
|
|
1133
1135
|
const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
|
|
1134
1136
|
switch(type){
|
|
1135
1137
|
case 'esm':
|
|
@@ -1148,7 +1150,8 @@ async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook }) {
|
|
|
1148
1150
|
entry,
|
|
1149
1151
|
globalName,
|
|
1150
1152
|
name,
|
|
1151
|
-
loaderHook
|
|
1153
|
+
loaderHook,
|
|
1154
|
+
getRetryPath
|
|
1152
1155
|
});
|
|
1153
1156
|
}
|
|
1154
1157
|
}
|
|
@@ -1187,7 +1190,8 @@ function getRemoteEntryUniqueKey(remoteInfo) {
|
|
|
1187
1190
|
const { entry, name } = remoteInfo;
|
|
1188
1191
|
return sdk.composeKeyWithSeparator(name, entry);
|
|
1189
1192
|
}
|
|
1190
|
-
async function getRemoteEntry(
|
|
1193
|
+
async function getRemoteEntry(params) {
|
|
1194
|
+
const { origin, remoteEntryExports, remoteInfo, getRetryPath } = params;
|
|
1191
1195
|
const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
|
|
1192
1196
|
if (remoteEntryExports) {
|
|
1193
1197
|
return remoteEntryExports;
|
|
@@ -1208,7 +1212,8 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
|
|
|
1208
1212
|
return isWebEnvironment ? loadEntryDom({
|
|
1209
1213
|
remoteInfo,
|
|
1210
1214
|
remoteEntryExports,
|
|
1211
|
-
loaderHook
|
|
1215
|
+
loaderHook,
|
|
1216
|
+
getRetryPath
|
|
1212
1217
|
}) : loadEntryNode({
|
|
1213
1218
|
remoteInfo,
|
|
1214
1219
|
loaderHook
|
|
@@ -3035,7 +3040,7 @@ class ModuleFederation {
|
|
|
3035
3040
|
// maybe will change, temporarily for internal use only
|
|
3036
3041
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
3037
3042
|
});
|
|
3038
|
-
this.version = "0.18.
|
|
3043
|
+
this.version = "0.18.3";
|
|
3039
3044
|
this.moduleCache = new Map();
|
|
3040
3045
|
this.loaderHook = new PluginSystem({
|
|
3041
3046
|
// FIXME: may not be suitable , not open to the public yet
|
package/dist/index.esm.js
CHANGED
|
@@ -201,7 +201,7 @@ function getGlobalFederationConstructor() {
|
|
|
201
201
|
function setGlobalFederationConstructor(FederationConstructor, isDebug = isDebugMode()) {
|
|
202
202
|
if (isDebug) {
|
|
203
203
|
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR__ = FederationConstructor;
|
|
204
|
-
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.
|
|
204
|
+
CurrentGlobal.__FEDERATION__.__DEBUG_CONSTRUCTOR_VERSION__ = "0.18.3";
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
207
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
|
@@ -1097,12 +1097,14 @@ function handleRemoteEntryLoaded(name, globalName, entry) {
|
|
|
1097
1097
|
}));
|
|
1098
1098
|
return entryExports;
|
|
1099
1099
|
}
|
|
1100
|
-
async function loadEntryScript({ name, globalName, entry, loaderHook }) {
|
|
1100
|
+
async function loadEntryScript({ name, globalName, entry, loaderHook, getRetryPath }) {
|
|
1101
1101
|
const { entryExports: remoteEntryExports } = getRemoteEntryExports(name, globalName);
|
|
1102
1102
|
if (remoteEntryExports) {
|
|
1103
1103
|
return remoteEntryExports;
|
|
1104
1104
|
}
|
|
1105
|
-
|
|
1105
|
+
// if this is a retry request, if user pass the getRetryPath parameter, use the getRetryPath to get the retry url
|
|
1106
|
+
const url = getRetryPath ? getRetryPath(entry) : entry;
|
|
1107
|
+
return loadScript(url, {
|
|
1106
1108
|
attrs: {},
|
|
1107
1109
|
createScriptHook: (url, attrs)=>{
|
|
1108
1110
|
const res = loaderHook.lifecycle.createScript.emit({
|
|
@@ -1128,7 +1130,7 @@ async function loadEntryScript({ name, globalName, entry, loaderHook }) {
|
|
|
1128
1130
|
throw e;
|
|
1129
1131
|
});
|
|
1130
1132
|
}
|
|
1131
|
-
async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook }) {
|
|
1133
|
+
async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook, getRetryPath }) {
|
|
1132
1134
|
const { entry, entryGlobalName: globalName, name, type } = remoteInfo;
|
|
1133
1135
|
switch(type){
|
|
1134
1136
|
case 'esm':
|
|
@@ -1147,7 +1149,8 @@ async function loadEntryDom({ remoteInfo, remoteEntryExports, loaderHook }) {
|
|
|
1147
1149
|
entry,
|
|
1148
1150
|
globalName,
|
|
1149
1151
|
name,
|
|
1150
|
-
loaderHook
|
|
1152
|
+
loaderHook,
|
|
1153
|
+
getRetryPath
|
|
1151
1154
|
});
|
|
1152
1155
|
}
|
|
1153
1156
|
}
|
|
@@ -1186,7 +1189,8 @@ function getRemoteEntryUniqueKey(remoteInfo) {
|
|
|
1186
1189
|
const { entry, name } = remoteInfo;
|
|
1187
1190
|
return composeKeyWithSeparator(name, entry);
|
|
1188
1191
|
}
|
|
1189
|
-
async function getRemoteEntry(
|
|
1192
|
+
async function getRemoteEntry(params) {
|
|
1193
|
+
const { origin, remoteEntryExports, remoteInfo, getRetryPath } = params;
|
|
1190
1194
|
const uniqueKey = getRemoteEntryUniqueKey(remoteInfo);
|
|
1191
1195
|
if (remoteEntryExports) {
|
|
1192
1196
|
return remoteEntryExports;
|
|
@@ -1207,7 +1211,8 @@ async function getRemoteEntry({ origin, remoteEntryExports, remoteInfo }) {
|
|
|
1207
1211
|
return isWebEnvironment ? loadEntryDom({
|
|
1208
1212
|
remoteInfo,
|
|
1209
1213
|
remoteEntryExports,
|
|
1210
|
-
loaderHook
|
|
1214
|
+
loaderHook,
|
|
1215
|
+
getRetryPath
|
|
1211
1216
|
}) : loadEntryNode({
|
|
1212
1217
|
remoteInfo,
|
|
1213
1218
|
loaderHook
|
|
@@ -3034,7 +3039,7 @@ class ModuleFederation {
|
|
|
3034
3039
|
// maybe will change, temporarily for internal use only
|
|
3035
3040
|
initContainer: new AsyncWaterfallHook('initContainer')
|
|
3036
3041
|
});
|
|
3037
|
-
this.version = "0.18.
|
|
3042
|
+
this.version = "0.18.3";
|
|
3038
3043
|
this.moduleCache = new Map();
|
|
3039
3044
|
this.loaderHook = new PluginSystem({
|
|
3040
3045
|
// FIXME: may not be suitable , not open to the public yet
|
package/dist/src/utils/load.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import { ModuleFederation } from '../core';
|
|
2
2
|
import { Remote, RemoteEntryExports, RemoteInfo } from '../type';
|
|
3
3
|
export declare function getRemoteEntryUniqueKey(remoteInfo: RemoteInfo): string;
|
|
4
|
-
export declare function getRemoteEntry(
|
|
4
|
+
export declare function getRemoteEntry(params: {
|
|
5
5
|
origin: ModuleFederation;
|
|
6
6
|
remoteInfo: RemoteInfo;
|
|
7
7
|
remoteEntryExports?: RemoteEntryExports | undefined;
|
|
8
|
+
getRetryPath?: (url: string) => string;
|
|
8
9
|
}): Promise<RemoteEntryExports | false | void>;
|
|
9
10
|
export declare function getRemoteInfo(remote: Remote): RemoteInfo;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/runtime-core",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20250827124348",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"author": "zhouxiao <codingzx@gmail.com>",
|
|
6
6
|
"main": "./dist/index.cjs.cjs",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
}
|
|
53
53
|
},
|
|
54
54
|
"dependencies": {
|
|
55
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
56
|
-
"@module-federation/error-codes": "0.0.0-next-
|
|
55
|
+
"@module-federation/sdk": "0.0.0-next-20250827124348",
|
|
56
|
+
"@module-federation/error-codes": "0.0.0-next-20250827124348"
|
|
57
57
|
}
|
|
58
58
|
}
|