@module-federation/rsbuild-plugin 2.3.0 → 2.3.2
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.
|
@@ -56,9 +56,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
56
56
|
addDataFetchExposes: () => (/* binding */ addDataFetchExposes)
|
|
57
57
|
});
|
|
58
58
|
|
|
59
|
-
;// CONCATENATED MODULE: external "fs
|
|
60
|
-
const
|
|
61
|
-
var
|
|
59
|
+
;// CONCATENATED MODULE: external "fs"
|
|
60
|
+
const external_fs_namespaceObject = require("fs");
|
|
61
|
+
var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_namespaceObject);
|
|
62
62
|
;// CONCATENATED MODULE: external "path"
|
|
63
63
|
const external_path_namespaceObject = require("path");
|
|
64
64
|
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_namespaceObject);
|
|
@@ -72,7 +72,7 @@ const external_constant_js_namespaceObject = require("../constant.js");
|
|
|
72
72
|
|
|
73
73
|
|
|
74
74
|
const addDataFetchExpose = (exposes, key, filepath, suffix = '')=>{
|
|
75
|
-
if (!
|
|
75
|
+
if (!external_fs_default().existsSync(filepath)) {
|
|
76
76
|
return false;
|
|
77
77
|
}
|
|
78
78
|
const dataFetchKey = key === '.' ? `./${external_constant_js_namespaceObject.DATA_FETCH_IDENTIFIER}${suffix}` : `${key}.${external_constant_js_namespaceObject.DATA_FETCH_IDENTIFIER}${suffix}`;
|
|
@@ -94,7 +94,9 @@ function addDataFetchExposes(exposes, isServer) {
|
|
|
94
94
|
}
|
|
95
95
|
const tempDataFetch = external_path_default().resolve(process.cwd(), `node_modules/${sdk_namespaceObject.TEMP_DIR}`);
|
|
96
96
|
const content = `export const fetchData=()=>{throw new Error('should not be called')};`;
|
|
97
|
-
|
|
97
|
+
external_fs_default().mkdirSync(tempDataFetch, {
|
|
98
|
+
recursive: true
|
|
99
|
+
});
|
|
98
100
|
Object.keys(exposes).forEach((key, index)=>{
|
|
99
101
|
const expose = exposes[key];
|
|
100
102
|
if (typeof expose !== 'string') {
|
|
@@ -104,14 +106,14 @@ function addDataFetchExposes(exposes, isServer) {
|
|
|
104
106
|
const dataFetchPath = `${absPath.replace(external_path_default().extname(absPath), '')}.${external_constant_js_namespaceObject.DATA_FETCH_IDENTIFIER}.ts`;
|
|
105
107
|
const dataFetchClientPath = `${absPath.replace(external_path_default().extname(absPath), '')}.${external_constant_js_namespaceObject.DATA_FETCH_IDENTIFIER}.client.ts`;
|
|
106
108
|
const tempFile = external_path_default().join(tempDataFetch, `data-fetch-fallback${index}.ts`);
|
|
107
|
-
|
|
109
|
+
external_fs_default().writeFileSync(tempFile, content);
|
|
108
110
|
const dateFetchClientKey = addDataFetchExpose(exposes, key, dataFetchClientPath, external_constant_js_namespaceObject.DATA_FETCH_CLIENT_SUFFIX);
|
|
109
111
|
if (!isServer && dateFetchClientKey) {
|
|
110
112
|
exposes[dateFetchClientKey.replace(external_constant_js_namespaceObject.DATA_FETCH_CLIENT_SUFFIX, '')] = addExcludeDtsSuffix(tempFile);
|
|
111
113
|
return;
|
|
112
114
|
}
|
|
113
115
|
const dataFetchKey = addDataFetchExpose(exposes, key, dataFetchPath);
|
|
114
|
-
if (dataFetchKey &&
|
|
116
|
+
if (dataFetchKey && external_fs_default().existsSync(dataFetchClientPath)) {
|
|
115
117
|
exposes[`${dataFetchKey}${external_constant_js_namespaceObject.DATA_FETCH_CLIENT_SUFFIX}`] = addExcludeDtsSuffix(tempFile);
|
|
116
118
|
}
|
|
117
119
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import
|
|
1
|
+
import fs from "fs";
|
|
2
2
|
import path from "path";
|
|
3
3
|
import { TEMP_DIR } from "@module-federation/sdk";
|
|
4
4
|
import { DATA_FETCH_CLIENT_SUFFIX, DATA_FETCH_IDENTIFIER } from "../constant.mjs";
|
|
5
5
|
|
|
6
|
-
;// CONCATENATED MODULE: external "fs
|
|
6
|
+
;// CONCATENATED MODULE: external "fs"
|
|
7
7
|
|
|
8
8
|
;// CONCATENATED MODULE: external "path"
|
|
9
9
|
|
|
@@ -17,7 +17,7 @@ import { DATA_FETCH_CLIENT_SUFFIX, DATA_FETCH_IDENTIFIER } from "../constant.mjs
|
|
|
17
17
|
|
|
18
18
|
|
|
19
19
|
const addDataFetchExpose = (exposes, key, filepath, suffix = '')=>{
|
|
20
|
-
if (!
|
|
20
|
+
if (!fs.existsSync(filepath)) {
|
|
21
21
|
return false;
|
|
22
22
|
}
|
|
23
23
|
const dataFetchKey = key === '.' ? `./${DATA_FETCH_IDENTIFIER}${suffix}` : `${key}.${DATA_FETCH_IDENTIFIER}${suffix}`;
|
|
@@ -39,7 +39,9 @@ function addDataFetchExposes(exposes, isServer) {
|
|
|
39
39
|
}
|
|
40
40
|
const tempDataFetch = path.resolve(process.cwd(), `node_modules/${TEMP_DIR}`);
|
|
41
41
|
const content = `export const fetchData=()=>{throw new Error('should not be called')};`;
|
|
42
|
-
|
|
42
|
+
fs.mkdirSync(tempDataFetch, {
|
|
43
|
+
recursive: true
|
|
44
|
+
});
|
|
43
45
|
Object.keys(exposes).forEach((key, index)=>{
|
|
44
46
|
const expose = exposes[key];
|
|
45
47
|
if (typeof expose !== 'string') {
|
|
@@ -49,14 +51,14 @@ function addDataFetchExposes(exposes, isServer) {
|
|
|
49
51
|
const dataFetchPath = `${absPath.replace(path.extname(absPath), '')}.${DATA_FETCH_IDENTIFIER}.ts`;
|
|
50
52
|
const dataFetchClientPath = `${absPath.replace(path.extname(absPath), '')}.${DATA_FETCH_IDENTIFIER}.client.ts`;
|
|
51
53
|
const tempFile = path.join(tempDataFetch, `data-fetch-fallback${index}.ts`);
|
|
52
|
-
|
|
54
|
+
fs.writeFileSync(tempFile, content);
|
|
53
55
|
const dateFetchClientKey = addDataFetchExpose(exposes, key, dataFetchClientPath, DATA_FETCH_CLIENT_SUFFIX);
|
|
54
56
|
if (!isServer && dateFetchClientKey) {
|
|
55
57
|
exposes[dateFetchClientKey.replace(DATA_FETCH_CLIENT_SUFFIX, '')] = addExcludeDtsSuffix(tempFile);
|
|
56
58
|
return;
|
|
57
59
|
}
|
|
58
60
|
const dataFetchKey = addDataFetchExpose(exposes, key, dataFetchPath);
|
|
59
|
-
if (dataFetchKey &&
|
|
61
|
+
if (dataFetchKey && fs.existsSync(dataFetchClientPath)) {
|
|
60
62
|
exposes[`${dataFetchKey}${DATA_FETCH_CLIENT_SUFFIX}`] = addExcludeDtsSuffix(tempFile);
|
|
61
63
|
}
|
|
62
64
|
});
|
package/dist/utils/manifest.js
CHANGED
|
@@ -59,9 +59,9 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
59
59
|
;// CONCATENATED MODULE: external "path"
|
|
60
60
|
const external_path_namespaceObject = require("path");
|
|
61
61
|
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_namespaceObject);
|
|
62
|
-
;// CONCATENATED MODULE: external "fs
|
|
63
|
-
const
|
|
64
|
-
var
|
|
62
|
+
;// CONCATENATED MODULE: external "fs"
|
|
63
|
+
const external_fs_namespaceObject = require("fs");
|
|
64
|
+
var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_namespaceObject);
|
|
65
65
|
;// CONCATENATED MODULE: ./src/utils/manifest.ts
|
|
66
66
|
|
|
67
67
|
|
|
@@ -100,8 +100,8 @@ function mergeStatsAndManifest(nodeAssets, browserAssets) {
|
|
|
100
100
|
}
|
|
101
101
|
function updateStatsAndManifest(nodeAssets, browserAssets, outputDir) {
|
|
102
102
|
const { mergedStats, mergedStatsFilePath, mergedManifest, mergedManifestFilePath } = mergeStatsAndManifest(nodeAssets, browserAssets);
|
|
103
|
-
|
|
104
|
-
|
|
103
|
+
external_fs_default().writeFileSync(external_path_default().resolve(outputDir, mergedStatsFilePath), JSON.stringify(mergedStats, null, 2));
|
|
104
|
+
external_fs_default().writeFileSync(external_path_default().resolve(outputDir, mergedManifestFilePath), JSON.stringify(mergedManifest, null, 2));
|
|
105
105
|
}
|
|
106
106
|
|
|
107
107
|
exports.updateStatsAndManifest = __webpack_exports__.updateStatsAndManifest;
|
package/dist/utils/manifest.mjs
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import
|
|
2
|
+
import fs from "fs";
|
|
3
3
|
|
|
4
4
|
;// CONCATENATED MODULE: external "path"
|
|
5
5
|
|
|
6
|
-
;// CONCATENATED MODULE: external "fs
|
|
6
|
+
;// CONCATENATED MODULE: external "fs"
|
|
7
7
|
|
|
8
8
|
;// CONCATENATED MODULE: ./src/utils/manifest.ts
|
|
9
9
|
|
|
@@ -43,8 +43,8 @@ function mergeStatsAndManifest(nodeAssets, browserAssets) {
|
|
|
43
43
|
}
|
|
44
44
|
function updateStatsAndManifest(nodeAssets, browserAssets, outputDir) {
|
|
45
45
|
const { mergedStats, mergedStatsFilePath, mergedManifest, mergedManifestFilePath } = mergeStatsAndManifest(nodeAssets, browserAssets);
|
|
46
|
-
|
|
47
|
-
|
|
46
|
+
fs.writeFileSync(path.resolve(outputDir, mergedStatsFilePath), JSON.stringify(mergedStats, null, 2));
|
|
47
|
+
fs.writeFileSync(path.resolve(outputDir, mergedManifestFilePath), JSON.stringify(mergedManifest, null, 2));
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export { updateStatsAndManifest };
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/rsbuild-plugin",
|
|
3
|
-
"version": "2.3.
|
|
3
|
+
"version": "2.3.2",
|
|
4
4
|
"description": "Module Federation plugin for Rsbuild",
|
|
5
5
|
"homepage": "https://module-federation.io",
|
|
6
6
|
"bugs": {
|
|
@@ -49,10 +49,9 @@
|
|
|
49
49
|
"dist"
|
|
50
50
|
],
|
|
51
51
|
"dependencies": {
|
|
52
|
-
"
|
|
53
|
-
"@module-federation/enhanced": "2.3.
|
|
54
|
-
"@module-federation/node": "2.7.
|
|
55
|
-
"@module-federation/sdk": "2.3.0"
|
|
52
|
+
"@module-federation/sdk": "2.3.2",
|
|
53
|
+
"@module-federation/enhanced": "2.3.2",
|
|
54
|
+
"@module-federation/node": "2.7.40"
|
|
56
55
|
},
|
|
57
56
|
"devDependencies": {
|
|
58
57
|
"@rslib/core": "^0.12.4",
|