@module-federation/rsbuild-plugin 0.0.0-next-20250522130707 → 0.0.0-next-20250523061743

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.
@@ -1,2 +1,2 @@
1
1
  import type { moduleFederationPlugin } from '@module-federation/sdk';
2
- export declare function addDataFetchExposes(exposes: moduleFederationPlugin.ModuleFederationPluginOptions['exposes'], isServer: boolean, enableSSR: boolean): void;
2
+ export declare function addDataFetchExposes(exposes: moduleFederationPlugin.ModuleFederationPluginOptions['exposes'], isServer: boolean): void;
package/dist/utils.cjs.js CHANGED
@@ -83,12 +83,16 @@ var addDataFetchExpose = function(exposes, key, filepath) {
83
83
  return false;
84
84
  }
85
85
  var dataFetchKey = key === '.' ? "./".concat(constant.DATA_FETCH_IDENTIFIER).concat(suffix) : "".concat(key, ".").concat(constant.DATA_FETCH_IDENTIFIER).concat(suffix);
86
- if (!exposes[dataFetchKey]) {
87
- exposes[dataFetchKey] = filepath;
86
+ if (exposes[dataFetchKey]) {
87
+ throw new Error("data fetch key ".concat(dataFetchKey, " already exists, please modify this expose key, do not end with '").concat(constant.DATA_FETCH_IDENTIFIER, "' or '").concat(constant.DATA_FETCH_CLIENT_SUFFIX, "'"));
88
88
  }
89
+ exposes[dataFetchKey] = filepath;
89
90
  return dataFetchKey;
90
91
  };
91
- function addDataFetchExposes(exposes, isServer, enableSSR) {
92
+ var addExcludeDtsSuffix = function(filepath) {
93
+ return "".concat(filepath, "?exclude-mf-dts=true");
94
+ };
95
+ function addDataFetchExposes(exposes, isServer) {
92
96
  if ((typeof exposes === "undefined" ? "undefined" : _type_of(exposes)) !== 'object' || Array.isArray(exposes)) {
93
97
  return;
94
98
  }
@@ -99,7 +103,7 @@ function addDataFetchExposes(exposes, isServer, enableSSR) {
99
103
  var content = "export const fetchData=()=>{throw new Error('should not be called')};";
100
104
  fs.ensureDirSync(path.dirname(tempDataFetchFilepath));
101
105
  fs.writeFileSync(tempDataFetchFilepath, content);
102
- Object.keys(exposes).forEach(function(key, index) {
106
+ Object.keys(exposes).forEach(function(key) {
103
107
  var expose = exposes[key];
104
108
  if (typeof expose !== 'string') {
105
109
  return;
@@ -109,12 +113,12 @@ function addDataFetchExposes(exposes, isServer, enableSSR) {
109
113
  var dataFetchClientPath = "".concat(absPath.replace(path.extname(absPath), ''), ".").concat(constant.DATA_FETCH_IDENTIFIER, ".client.ts");
110
114
  var dateFetchClientKey = addDataFetchExpose(exposes, key, dataFetchClientPath, constant.DATA_FETCH_CLIENT_SUFFIX);
111
115
  if (!isServer && dateFetchClientKey) {
112
- exposes[dateFetchClientKey.replace(constant.DATA_FETCH_CLIENT_SUFFIX, '')] = tempDataFetchFilepath;
116
+ exposes[dateFetchClientKey.replace(constant.DATA_FETCH_CLIENT_SUFFIX, '')] = addExcludeDtsSuffix(tempDataFetchFilepath);
113
117
  return;
114
118
  }
115
119
  var dataFetchKey = addDataFetchExpose(exposes, key, dataFetchPath);
116
120
  if (dataFetchKey && fs.existsSync(dataFetchClientPath)) {
117
- exposes["".concat(dataFetchKey).concat(constant.DATA_FETCH_CLIENT_SUFFIX)] = tempDataFetchFilepath;
121
+ exposes["".concat(dataFetchKey).concat(constant.DATA_FETCH_CLIENT_SUFFIX)] = addExcludeDtsSuffix(tempDataFetchFilepath);
118
122
  }
119
123
  });
120
124
  }
package/dist/utils.esm.js CHANGED
@@ -82,12 +82,16 @@ var addDataFetchExpose = function(exposes, key, filepath) {
82
82
  return false;
83
83
  }
84
84
  var dataFetchKey = key === '.' ? "./".concat(DATA_FETCH_IDENTIFIER).concat(suffix) : "".concat(key, ".").concat(DATA_FETCH_IDENTIFIER).concat(suffix);
85
- if (!exposes[dataFetchKey]) {
86
- exposes[dataFetchKey] = filepath;
85
+ if (exposes[dataFetchKey]) {
86
+ throw new Error("data fetch key ".concat(dataFetchKey, " already exists, please modify this expose key, do not end with '").concat(DATA_FETCH_IDENTIFIER, "' or '").concat(DATA_FETCH_CLIENT_SUFFIX, "'"));
87
87
  }
88
+ exposes[dataFetchKey] = filepath;
88
89
  return dataFetchKey;
89
90
  };
90
- function addDataFetchExposes(exposes, isServer, enableSSR) {
91
+ var addExcludeDtsSuffix = function(filepath) {
92
+ return "".concat(filepath, "?exclude-mf-dts=true");
93
+ };
94
+ function addDataFetchExposes(exposes, isServer) {
91
95
  if ((typeof exposes === "undefined" ? "undefined" : _type_of(exposes)) !== 'object' || Array.isArray(exposes)) {
92
96
  return;
93
97
  }
@@ -98,7 +102,7 @@ function addDataFetchExposes(exposes, isServer, enableSSR) {
98
102
  var content = "export const fetchData=()=>{throw new Error('should not be called')};";
99
103
  fs.ensureDirSync(path.dirname(tempDataFetchFilepath));
100
104
  fs.writeFileSync(tempDataFetchFilepath, content);
101
- Object.keys(exposes).forEach(function(key, index) {
105
+ Object.keys(exposes).forEach(function(key) {
102
106
  var expose = exposes[key];
103
107
  if (typeof expose !== 'string') {
104
108
  return;
@@ -108,12 +112,12 @@ function addDataFetchExposes(exposes, isServer, enableSSR) {
108
112
  var dataFetchClientPath = "".concat(absPath.replace(path.extname(absPath), ''), ".").concat(DATA_FETCH_IDENTIFIER, ".client.ts");
109
113
  var dateFetchClientKey = addDataFetchExpose(exposes, key, dataFetchClientPath, DATA_FETCH_CLIENT_SUFFIX);
110
114
  if (!isServer && dateFetchClientKey) {
111
- exposes[dateFetchClientKey.replace(DATA_FETCH_CLIENT_SUFFIX, '')] = tempDataFetchFilepath;
115
+ exposes[dateFetchClientKey.replace(DATA_FETCH_CLIENT_SUFFIX, '')] = addExcludeDtsSuffix(tempDataFetchFilepath);
112
116
  return;
113
117
  }
114
118
  var dataFetchKey = addDataFetchExpose(exposes, key, dataFetchPath);
115
119
  if (dataFetchKey && fs.existsSync(dataFetchClientPath)) {
116
- exposes["".concat(dataFetchKey).concat(DATA_FETCH_CLIENT_SUFFIX)] = tempDataFetchFilepath;
120
+ exposes["".concat(dataFetchKey).concat(DATA_FETCH_CLIENT_SUFFIX)] = addExcludeDtsSuffix(tempDataFetchFilepath);
117
121
  }
118
122
  });
119
123
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/rsbuild-plugin",
3
- "version": "0.0.0-next-20250522130707",
3
+ "version": "0.0.0-next-20250523061743",
4
4
  "description": "Module Federation plugin for Rsbuild",
5
5
  "homepage": "https://module-federation.io",
6
6
  "bugs": {
@@ -49,8 +49,8 @@
49
49
  ],
50
50
  "dependencies": {
51
51
  "fs-extra": "9.1.0",
52
- "@module-federation/sdk": "0.0.0-next-20250522130707",
53
- "@module-federation/enhanced": "0.0.0-next-20250522130707"
52
+ "@module-federation/sdk": "0.0.0-next-20250523061743",
53
+ "@module-federation/enhanced": "0.0.0-next-20250523061743"
54
54
  },
55
55
  "devDependencies": {
56
56
  "@rsbuild/core": "^1.3.17"