@module-federation/modern-js 0.0.0-next-20250523112943 → 0.0.0-next-20250523132518

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
@@ -148,10 +148,16 @@ async function fetchData(id, params, remoteInfo) {
148
148
  const mfDowngrade = (0, import_downgrade.getDowngradeTag)();
149
149
  if (mfDowngrade) {
150
150
  if (typeof mfDowngrade === "boolean") {
151
- return (0, import_downgrade.callDowngrade)(id, params);
151
+ return (0, import_downgrade.callDowngrade)(id, {
152
+ ...params,
153
+ isDowngrade: true
154
+ });
152
155
  }
153
156
  if (mfDowngrade.includes(id)) {
154
- return (0, import_downgrade.callDowngrade)(id, params);
157
+ return (0, import_downgrade.callDowngrade)(id, {
158
+ ...params,
159
+ isDowngrade: true
160
+ });
155
161
  }
156
162
  }
157
163
  let res;
@@ -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
  }));
@@ -1,4 +1,6 @@
1
1
  import { _ as _async_to_generator } from "@swc/helpers/_/_async_to_generator";
2
+ import { _ as _object_spread } from "@swc/helpers/_/_object_spread";
3
+ import { _ as _object_spread_props } from "@swc/helpers/_/_object_spread_props";
2
4
  import { _ as _to_array } from "@swc/helpers/_/_to_array";
3
5
  import { _ as _type_of } from "@swc/helpers/_/_type_of";
4
6
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
@@ -151,13 +153,17 @@ function _fetchData() {
151
153
  if (typeof mfDowngrade === "boolean") {
152
154
  return [
153
155
  2,
154
- callDowngrade(id, params)
156
+ callDowngrade(id, _object_spread_props(_object_spread({}, params), {
157
+ isDowngrade: true
158
+ }))
155
159
  ];
156
160
  }
157
161
  if (mfDowngrade.includes(id)) {
158
162
  return [
159
163
  2,
160
- callDowngrade(id, params)
164
+ callDowngrade(id, _object_spread_props(_object_spread({}, params), {
165
+ isDowngrade: true
166
+ }))
161
167
  ];
162
168
  }
163
169
  }
@@ -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
@@ -104,10 +104,16 @@ async function fetchData(id, params, remoteInfo) {
104
104
  const mfDowngrade = getDowngradeTag();
105
105
  if (mfDowngrade) {
106
106
  if (typeof mfDowngrade === "boolean") {
107
- return callDowngrade(id, params);
107
+ return callDowngrade(id, {
108
+ ...params,
109
+ isDowngrade: true
110
+ });
108
111
  }
109
112
  if (mfDowngrade.includes(id)) {
110
- return callDowngrade(id, params);
113
+ return callDowngrade(id, {
114
+ ...params,
115
+ isDowngrade: true
116
+ });
111
117
  }
112
118
  }
113
119
  let res;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.0.0-next-20250523112943",
3
+ "version": "0.0.0-next-20250523132518",
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-20250523112943",
115
- "@module-federation/enhanced": "0.0.0-next-20250523112943",
116
- "@module-federation/runtime": "0.0.0-next-20250523112943",
117
- "@module-federation/node": "0.0.0-next-20250523112943",
118
- "@module-federation/sdk": "0.0.0-next-20250523112943",
119
- "@module-federation/cli": "0.0.0-next-20250523112943"
114
+ "@module-federation/rsbuild-plugin": "0.0.0-next-20250523132518",
115
+ "@module-federation/enhanced": "0.0.0-next-20250523132518",
116
+ "@module-federation/runtime": "0.0.0-next-20250523132518",
117
+ "@module-federation/node": "0.0.0-next-20250523132518",
118
+ "@module-federation/sdk": "0.0.0-next-20250523132518",
119
+ "@module-federation/cli": "0.0.0-next-20250523132518"
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-20250523112943"
129
+ "@module-federation/manifest": "0.0.0-next-20250523132518"
130
130
  },
131
131
  "peerDependencies": {
132
132
  "react": ">=17",