@module-federation/modern-js 0.0.0-next-20250523110447 → 0.0.0-next-20250523115044
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.
|
@@ -67,6 +67,7 @@ const getDecodeQuery = (url, name) => {
|
|
|
67
67
|
return decodeURIComponent(res);
|
|
68
68
|
};
|
|
69
69
|
const middleware = async (ctx, next) => {
|
|
70
|
+
var _globalThis___FEDERATION__;
|
|
70
71
|
let url;
|
|
71
72
|
let dataFetchId;
|
|
72
73
|
let params;
|
|
@@ -78,6 +79,7 @@ const middleware = async (ctx, next) => {
|
|
|
78
79
|
const remoteInfoQuery = getDecodeQuery(url, "remoteInfo");
|
|
79
80
|
remoteInfo = remoteInfoQuery ? JSON.parse(remoteInfoQuery) : null;
|
|
80
81
|
} catch (e) {
|
|
82
|
+
console.log("fetch data from server, error: ", e);
|
|
81
83
|
console.error(e);
|
|
82
84
|
return next();
|
|
83
85
|
}
|
|
@@ -85,6 +87,7 @@ const middleware = async (ctx, next) => {
|
|
|
85
87
|
return next();
|
|
86
88
|
}
|
|
87
89
|
import_logger.default.log("fetch data from server, dataFetchId: ", dataFetchId);
|
|
90
|
+
console.log("fetch data from server, moduleInfo: ", (_globalThis___FEDERATION__ = globalThis.__FEDERATION__) === null || _globalThis___FEDERATION__ === void 0 ? void 0 : _globalThis___FEDERATION__.moduleInfo);
|
|
88
91
|
try {
|
|
89
92
|
var _dataFetchMap_dataFetchId, _dataFetchMap_dataFetchId1;
|
|
90
93
|
const dataFetchMap = (0, import_utils.getDataFetchMap)();
|
|
@@ -92,6 +95,7 @@ const middleware = async (ctx, next) => {
|
|
|
92
95
|
(0, import_dataFetch.initDataFetchMap)();
|
|
93
96
|
}
|
|
94
97
|
const fetchDataPromise = (_dataFetchMap_dataFetchId = dataFetchMap[dataFetchId]) === null || _dataFetchMap_dataFetchId === void 0 ? void 0 : _dataFetchMap_dataFetchId[1];
|
|
98
|
+
console.log("fetch data from server, fetchDataPromise: ", fetchDataPromise);
|
|
95
99
|
if (fetchDataPromise && ((_dataFetchMap_dataFetchId1 = dataFetchMap[dataFetchId]) === null || _dataFetchMap_dataFetchId1 === void 0 ? void 0 : _dataFetchMap_dataFetchId1[2]) !== import_constant.MF_DATA_FETCH_STATUS.ERROR) {
|
|
96
100
|
import_logger.default.log("fetch data from server, fetchDataPromise: ", fetchDataPromise);
|
|
97
101
|
const targetPromise = fetchDataPromise[0];
|
|
@@ -138,7 +142,9 @@ const middleware = async (ctx, next) => {
|
|
|
138
142
|
}
|
|
139
143
|
}
|
|
140
144
|
const dataFetchItem = dataFetchMap[dataFetchId];
|
|
145
|
+
console.log("fetch data from server, dataFetchItem: ", dataFetchItem);
|
|
141
146
|
if (dataFetchItem) {
|
|
147
|
+
import_logger.default.log("fetch data from server, dataFetchItem: ", dataFetchItem);
|
|
142
148
|
const callFetchDataPromise = (0, import_dataFetch.fetchData)(dataFetchId, {
|
|
143
149
|
...params,
|
|
144
150
|
isDowngrade: true
|
|
@@ -161,8 +167,7 @@ const middleware = async (ctx, next) => {
|
|
|
161
167
|
});
|
|
162
168
|
return ctx.json(data);
|
|
163
169
|
} catch (e) {
|
|
164
|
-
console.log("server plugin data fetch error: ");
|
|
165
|
-
console.error(e);
|
|
170
|
+
console.log("server plugin data fetch error: ", e);
|
|
166
171
|
ctx.status(500);
|
|
167
172
|
return ctx.text(`failed to fetch ${remoteInfo.name} data, error:
|
|
168
173
|
${e}`);
|
|
@@ -40,7 +40,7 @@ var getDecodeQuery = function(url, name) {
|
|
|
40
40
|
};
|
|
41
41
|
var middleware = function() {
|
|
42
42
|
var _ref = _async_to_generator(function(ctx, next) {
|
|
43
|
-
var url, dataFetchId, params, remoteInfo, remoteInfoQuery, _dataFetchMap_dataFetchId, _dataFetchMap_dataFetchId1, dataFetchMap, fetchDataPromise, targetPromise, wrappedPromise, res, hostInstance, remoteEntry, remote, _hostInstance_snapshotHandler_getGlobalRemoteInfo, hostGlobalSnapshot, remoteSnapshot, dataFetchItem, callFetchDataPromise, wrappedPromise1, res1, remoteId, hostInstance1, dataFetchFn, data, e;
|
|
43
|
+
var _globalThis___FEDERATION__, url, dataFetchId, params, remoteInfo, remoteInfoQuery, _dataFetchMap_dataFetchId, _dataFetchMap_dataFetchId1, dataFetchMap, fetchDataPromise, targetPromise, wrappedPromise, res, hostInstance, remoteEntry, remote, _hostInstance_snapshotHandler_getGlobalRemoteInfo, hostGlobalSnapshot, remoteSnapshot, dataFetchItem, callFetchDataPromise, wrappedPromise1, res1, remoteId, hostInstance1, dataFetchFn, data, e;
|
|
44
44
|
return _ts_generator(this, function(_state) {
|
|
45
45
|
switch (_state.label) {
|
|
46
46
|
case 0:
|
|
@@ -51,6 +51,7 @@ var middleware = function() {
|
|
|
51
51
|
remoteInfoQuery = getDecodeQuery(url, "remoteInfo");
|
|
52
52
|
remoteInfo = remoteInfoQuery ? JSON.parse(remoteInfoQuery) : null;
|
|
53
53
|
} catch (e2) {
|
|
54
|
+
console.log("fetch data from server, error: ", e2);
|
|
54
55
|
console.error(e2);
|
|
55
56
|
return [
|
|
56
57
|
2,
|
|
@@ -64,6 +65,7 @@ var middleware = function() {
|
|
|
64
65
|
];
|
|
65
66
|
}
|
|
66
67
|
logger.log("fetch data from server, dataFetchId: ", dataFetchId);
|
|
68
|
+
console.log("fetch data from server, moduleInfo: ", (_globalThis___FEDERATION__ = globalThis.__FEDERATION__) === null || _globalThis___FEDERATION__ === void 0 ? void 0 : _globalThis___FEDERATION__.moduleInfo);
|
|
67
69
|
_state.label = 1;
|
|
68
70
|
case 1:
|
|
69
71
|
_state.trys.push([
|
|
@@ -77,6 +79,7 @@ var middleware = function() {
|
|
|
77
79
|
initDataFetchMap();
|
|
78
80
|
}
|
|
79
81
|
fetchDataPromise = (_dataFetchMap_dataFetchId = dataFetchMap[dataFetchId]) === null || _dataFetchMap_dataFetchId === void 0 ? void 0 : _dataFetchMap_dataFetchId[1];
|
|
82
|
+
console.log("fetch data from server, fetchDataPromise: ", fetchDataPromise);
|
|
80
83
|
if (!(fetchDataPromise && ((_dataFetchMap_dataFetchId1 = dataFetchMap[dataFetchId]) === null || _dataFetchMap_dataFetchId1 === void 0 ? void 0 : _dataFetchMap_dataFetchId1[2]) !== MF_DATA_FETCH_STATUS.ERROR))
|
|
81
84
|
return [
|
|
82
85
|
3,
|
|
@@ -144,11 +147,13 @@ var middleware = function() {
|
|
|
144
147
|
}
|
|
145
148
|
}
|
|
146
149
|
dataFetchItem = dataFetchMap[dataFetchId];
|
|
150
|
+
console.log("fetch data from server, dataFetchItem: ", dataFetchItem);
|
|
147
151
|
if (!dataFetchItem)
|
|
148
152
|
return [
|
|
149
153
|
3,
|
|
150
154
|
6
|
|
151
155
|
];
|
|
156
|
+
logger.log("fetch data from server, dataFetchItem: ", dataFetchItem);
|
|
152
157
|
callFetchDataPromise = fetchData(dataFetchId, _object_spread_props(_object_spread({}, params), {
|
|
153
158
|
isDowngrade: true
|
|
154
159
|
}));
|
|
@@ -194,8 +199,7 @@ var middleware = function() {
|
|
|
194
199
|
];
|
|
195
200
|
case 9:
|
|
196
201
|
e = _state.sent();
|
|
197
|
-
console.log("server plugin data fetch error: ");
|
|
198
|
-
console.error(e);
|
|
202
|
+
console.log("server plugin data fetch error: ", e);
|
|
199
203
|
ctx.status(500);
|
|
200
204
|
return [
|
|
201
205
|
2,
|
|
@@ -34,6 +34,7 @@ const getDecodeQuery = (url, name) => {
|
|
|
34
34
|
return decodeURIComponent(res);
|
|
35
35
|
};
|
|
36
36
|
const middleware = async (ctx, next) => {
|
|
37
|
+
var _globalThis___FEDERATION__;
|
|
37
38
|
let url;
|
|
38
39
|
let dataFetchId;
|
|
39
40
|
let params;
|
|
@@ -45,6 +46,7 @@ const middleware = async (ctx, next) => {
|
|
|
45
46
|
const remoteInfoQuery = getDecodeQuery(url, "remoteInfo");
|
|
46
47
|
remoteInfo = remoteInfoQuery ? JSON.parse(remoteInfoQuery) : null;
|
|
47
48
|
} catch (e) {
|
|
49
|
+
console.log("fetch data from server, error: ", e);
|
|
48
50
|
console.error(e);
|
|
49
51
|
return next();
|
|
50
52
|
}
|
|
@@ -52,6 +54,7 @@ const middleware = async (ctx, next) => {
|
|
|
52
54
|
return next();
|
|
53
55
|
}
|
|
54
56
|
logger.log("fetch data from server, dataFetchId: ", dataFetchId);
|
|
57
|
+
console.log("fetch data from server, moduleInfo: ", (_globalThis___FEDERATION__ = globalThis.__FEDERATION__) === null || _globalThis___FEDERATION__ === void 0 ? void 0 : _globalThis___FEDERATION__.moduleInfo);
|
|
55
58
|
try {
|
|
56
59
|
var _dataFetchMap_dataFetchId, _dataFetchMap_dataFetchId1;
|
|
57
60
|
const dataFetchMap = getDataFetchMap();
|
|
@@ -59,6 +62,7 @@ const middleware = async (ctx, next) => {
|
|
|
59
62
|
initDataFetchMap();
|
|
60
63
|
}
|
|
61
64
|
const fetchDataPromise = (_dataFetchMap_dataFetchId = dataFetchMap[dataFetchId]) === null || _dataFetchMap_dataFetchId === void 0 ? void 0 : _dataFetchMap_dataFetchId[1];
|
|
65
|
+
console.log("fetch data from server, fetchDataPromise: ", fetchDataPromise);
|
|
62
66
|
if (fetchDataPromise && ((_dataFetchMap_dataFetchId1 = dataFetchMap[dataFetchId]) === null || _dataFetchMap_dataFetchId1 === void 0 ? void 0 : _dataFetchMap_dataFetchId1[2]) !== MF_DATA_FETCH_STATUS.ERROR) {
|
|
63
67
|
logger.log("fetch data from server, fetchDataPromise: ", fetchDataPromise);
|
|
64
68
|
const targetPromise = fetchDataPromise[0];
|
|
@@ -105,7 +109,9 @@ const middleware = async (ctx, next) => {
|
|
|
105
109
|
}
|
|
106
110
|
}
|
|
107
111
|
const dataFetchItem = dataFetchMap[dataFetchId];
|
|
112
|
+
console.log("fetch data from server, dataFetchItem: ", dataFetchItem);
|
|
108
113
|
if (dataFetchItem) {
|
|
114
|
+
logger.log("fetch data from server, dataFetchItem: ", dataFetchItem);
|
|
109
115
|
const callFetchDataPromise = fetchData(dataFetchId, {
|
|
110
116
|
...params,
|
|
111
117
|
isDowngrade: true
|
|
@@ -128,8 +134,7 @@ const middleware = async (ctx, next) => {
|
|
|
128
134
|
});
|
|
129
135
|
return ctx.json(data);
|
|
130
136
|
} catch (e) {
|
|
131
|
-
console.log("server plugin data fetch error: ");
|
|
132
|
-
console.error(e);
|
|
137
|
+
console.log("server plugin data fetch error: ", e);
|
|
133
138
|
ctx.status(500);
|
|
134
139
|
return ctx.text(`failed to fetch ${remoteInfo.name} data, error:
|
|
135
140
|
${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-20250523115044",
|
|
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-20250523115044",
|
|
115
|
+
"@module-federation/enhanced": "0.0.0-next-20250523115044",
|
|
116
|
+
"@module-federation/runtime": "0.0.0-next-20250523115044",
|
|
117
|
+
"@module-federation/node": "0.0.0-next-20250523115044",
|
|
118
|
+
"@module-federation/sdk": "0.0.0-next-20250523115044",
|
|
119
|
+
"@module-federation/cli": "0.0.0-next-20250523115044"
|
|
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-20250523115044"
|
|
130
130
|
},
|
|
131
131
|
"peerDependencies": {
|
|
132
132
|
"react": ">=17",
|