@module-federation/modern-js 0.0.0-next-20250523132518 → 0.0.0-next-20250526025159
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.
|
@@ -102,6 +102,7 @@ const middleware = async (ctx, next) => {
|
|
|
102
102
|
const wrappedPromise = wrapSetTimeout(targetPromise, 2e4, dataFetchId);
|
|
103
103
|
if (wrappedPromise) {
|
|
104
104
|
const res = await wrappedPromise;
|
|
105
|
+
import_logger.default.log("fetch data from server, fetchDataPromise res: ", res);
|
|
105
106
|
return ctx.json(res);
|
|
106
107
|
}
|
|
107
108
|
import_logger.default.error(`Expected a Promise from fetchDataPromise[0] for dataFetchId ${dataFetchId}, but received:`, targetPromise, "Will try call new dataFetch again...");
|
|
@@ -123,7 +124,7 @@ const middleware = async (ctx, next) => {
|
|
|
123
124
|
entryGlobalName: remoteInfo.globalName
|
|
124
125
|
}
|
|
125
126
|
]);
|
|
126
|
-
} else {
|
|
127
|
+
} else if (!("entry" in remote) || !remote.entry.includes(import_sdk.MANIFEST_EXT)) {
|
|
127
128
|
const { hostGlobalSnapshot, remoteSnapshot } = hostInstance2.snapshotHandler.getGlobalRemoteInfo(remoteInfo);
|
|
128
129
|
import_logger.default.debug("find hostGlobalSnapshot: ", JSON.stringify(hostGlobalSnapshot));
|
|
129
130
|
import_logger.default.debug("find remoteSnapshot: ", JSON.stringify(remoteSnapshot));
|
|
@@ -152,6 +153,7 @@ const middleware = async (ctx, next) => {
|
|
|
152
153
|
const wrappedPromise = wrapSetTimeout(callFetchDataPromise, 2e4, dataFetchId);
|
|
153
154
|
if (wrappedPromise) {
|
|
154
155
|
const res = await wrappedPromise;
|
|
156
|
+
import_logger.default.log("fetch data from server, dataFetchItem res: ", res);
|
|
155
157
|
return ctx.json(res);
|
|
156
158
|
}
|
|
157
159
|
}
|
|
@@ -165,6 +167,7 @@ const middleware = async (ctx, next) => {
|
|
|
165
167
|
...params,
|
|
166
168
|
isDowngrade: !remoteInfo
|
|
167
169
|
});
|
|
170
|
+
import_logger.default.log("fetch data from server, loadDataFetchModule res: ", data);
|
|
168
171
|
return ctx.json(data);
|
|
169
172
|
} catch (e) {
|
|
170
173
|
console.log("server plugin data fetch error: ", e);
|
|
@@ -6,7 +6,7 @@ import { DATA_FETCH_QUERY, MF_DATA_FETCH_STATUS } from "../../constant";
|
|
|
6
6
|
import logger from "../../logger";
|
|
7
7
|
import { getDataFetchMap } from "../../utils";
|
|
8
8
|
import { fetchData, initDataFetchMap, loadDataFetchModule } from "../../utils/dataFetch";
|
|
9
|
-
import { SEPARATOR } from "@module-federation/sdk";
|
|
9
|
+
import { SEPARATOR, MANIFEST_EXT } from "@module-federation/sdk";
|
|
10
10
|
function wrapSetTimeout(targetPromise) {
|
|
11
11
|
var delay = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 2e4, id = arguments.length > 2 ? arguments[2] : void 0;
|
|
12
12
|
if (targetPromise && typeof targetPromise.then === "function") {
|
|
@@ -99,6 +99,7 @@ var middleware = function() {
|
|
|
99
99
|
];
|
|
100
100
|
case 2:
|
|
101
101
|
res = _state.sent();
|
|
102
|
+
logger.log("fetch data from server, fetchDataPromise res: ", res);
|
|
102
103
|
return [
|
|
103
104
|
2,
|
|
104
105
|
ctx.json(res)
|
|
@@ -126,7 +127,7 @@ var middleware = function() {
|
|
|
126
127
|
entryGlobalName: remoteInfo.globalName
|
|
127
128
|
}
|
|
128
129
|
]);
|
|
129
|
-
} else {
|
|
130
|
+
} else if (!("entry" in remote) || !remote.entry.includes(MANIFEST_EXT)) {
|
|
130
131
|
_hostInstance_snapshotHandler_getGlobalRemoteInfo = hostInstance.snapshotHandler.getGlobalRemoteInfo(remoteInfo), hostGlobalSnapshot = _hostInstance_snapshotHandler_getGlobalRemoteInfo.hostGlobalSnapshot, remoteSnapshot = _hostInstance_snapshotHandler_getGlobalRemoteInfo.remoteSnapshot;
|
|
131
132
|
logger.debug("find hostGlobalSnapshot: ", JSON.stringify(hostGlobalSnapshot));
|
|
132
133
|
logger.debug("find remoteSnapshot: ", JSON.stringify(remoteSnapshot));
|
|
@@ -169,6 +170,7 @@ var middleware = function() {
|
|
|
169
170
|
];
|
|
170
171
|
case 5:
|
|
171
172
|
res1 = _state.sent();
|
|
173
|
+
logger.log("fetch data from server, dataFetchItem res: ", res1);
|
|
172
174
|
return [
|
|
173
175
|
2,
|
|
174
176
|
ctx.json(res1)
|
|
@@ -193,6 +195,7 @@ var middleware = function() {
|
|
|
193
195
|
];
|
|
194
196
|
case 8:
|
|
195
197
|
data = _state.sent();
|
|
198
|
+
logger.log("fetch data from server, loadDataFetchModule res: ", data);
|
|
196
199
|
return [
|
|
197
200
|
2,
|
|
198
201
|
ctx.json(data)
|
|
@@ -2,7 +2,7 @@ import { DATA_FETCH_QUERY, MF_DATA_FETCH_STATUS } from "../../constant";
|
|
|
2
2
|
import logger from "../../logger";
|
|
3
3
|
import { getDataFetchMap } from "../../utils";
|
|
4
4
|
import { fetchData, initDataFetchMap, loadDataFetchModule } from "../../utils/dataFetch";
|
|
5
|
-
import { SEPARATOR } from "@module-federation/sdk";
|
|
5
|
+
import { SEPARATOR, MANIFEST_EXT } from "@module-federation/sdk";
|
|
6
6
|
function wrapSetTimeout(targetPromise, delay = 2e4, id) {
|
|
7
7
|
if (targetPromise && typeof targetPromise.then === "function") {
|
|
8
8
|
return new Promise((resolve, reject) => {
|
|
@@ -69,6 +69,7 @@ const middleware = async (ctx, next) => {
|
|
|
69
69
|
const wrappedPromise = wrapSetTimeout(targetPromise, 2e4, dataFetchId);
|
|
70
70
|
if (wrappedPromise) {
|
|
71
71
|
const res = await wrappedPromise;
|
|
72
|
+
logger.log("fetch data from server, fetchDataPromise res: ", res);
|
|
72
73
|
return ctx.json(res);
|
|
73
74
|
}
|
|
74
75
|
logger.error(`Expected a Promise from fetchDataPromise[0] for dataFetchId ${dataFetchId}, but received:`, targetPromise, "Will try call new dataFetch again...");
|
|
@@ -90,7 +91,7 @@ const middleware = async (ctx, next) => {
|
|
|
90
91
|
entryGlobalName: remoteInfo.globalName
|
|
91
92
|
}
|
|
92
93
|
]);
|
|
93
|
-
} else {
|
|
94
|
+
} else if (!("entry" in remote) || !remote.entry.includes(MANIFEST_EXT)) {
|
|
94
95
|
const { hostGlobalSnapshot, remoteSnapshot } = hostInstance2.snapshotHandler.getGlobalRemoteInfo(remoteInfo);
|
|
95
96
|
logger.debug("find hostGlobalSnapshot: ", JSON.stringify(hostGlobalSnapshot));
|
|
96
97
|
logger.debug("find remoteSnapshot: ", JSON.stringify(remoteSnapshot));
|
|
@@ -119,6 +120,7 @@ const middleware = async (ctx, next) => {
|
|
|
119
120
|
const wrappedPromise = wrapSetTimeout(callFetchDataPromise, 2e4, dataFetchId);
|
|
120
121
|
if (wrappedPromise) {
|
|
121
122
|
const res = await wrappedPromise;
|
|
123
|
+
logger.log("fetch data from server, dataFetchItem res: ", res);
|
|
122
124
|
return ctx.json(res);
|
|
123
125
|
}
|
|
124
126
|
}
|
|
@@ -132,6 +134,7 @@ const middleware = async (ctx, next) => {
|
|
|
132
134
|
...params,
|
|
133
135
|
isDowngrade: !remoteInfo
|
|
134
136
|
});
|
|
137
|
+
logger.log("fetch data from server, loadDataFetchModule res: ", data);
|
|
135
138
|
return ctx.json(data);
|
|
136
139
|
} catch (e) {
|
|
137
140
|
console.log("server plugin data fetch error: ", e);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20250526025159",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -111,12 +111,12 @@
|
|
|
111
111
|
"@swc/helpers": "0.5.13",
|
|
112
112
|
"node-fetch": "~3.3.0",
|
|
113
113
|
"react-error-boundary": "4.1.2",
|
|
114
|
-
"@module-federation/rsbuild-plugin": "0.0.0-next-
|
|
115
|
-
"@module-federation/enhanced": "0.0.0-next-
|
|
116
|
-
"@module-federation/runtime": "0.0.0-next-
|
|
117
|
-
"@module-federation/node": "0.0.0-next-
|
|
118
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
119
|
-
"@module-federation/cli": "0.0.0-next-
|
|
114
|
+
"@module-federation/rsbuild-plugin": "0.0.0-next-20250526025159",
|
|
115
|
+
"@module-federation/enhanced": "0.0.0-next-20250526025159",
|
|
116
|
+
"@module-federation/runtime": "0.0.0-next-20250526025159",
|
|
117
|
+
"@module-federation/node": "0.0.0-next-20250526025159",
|
|
118
|
+
"@module-federation/sdk": "0.0.0-next-20250526025159",
|
|
119
|
+
"@module-federation/cli": "0.0.0-next-20250526025159"
|
|
120
120
|
},
|
|
121
121
|
"devDependencies": {
|
|
122
122
|
"@rsbuild/core": "1.2.8",
|
|
@@ -126,7 +126,7 @@
|
|
|
126
126
|
"@modern-js/runtime": "2.67.5",
|
|
127
127
|
"@modern-js/tsconfig": "2.67.5",
|
|
128
128
|
"@modern-js/server-runtime": "2.67.5",
|
|
129
|
-
"@module-federation/manifest": "0.0.0-next-
|
|
129
|
+
"@module-federation/manifest": "0.0.0-next-20250526025159"
|
|
130
130
|
},
|
|
131
131
|
"peerDependencies": {
|
|
132
132
|
"react": ">=17",
|