@module-federation/rsbuild-plugin 2.5.1 → 2.7.0
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.
- package/dist/cli/index.js +34 -40
- package/dist/cli/index.mjs +19 -35
- package/dist/constant.js +24 -20
- package/dist/constant.mjs +0 -2
- package/dist/index.js +19 -18
- package/dist/index.mjs +1 -2
- package/dist/logger.js +14 -12
- package/dist/logger.mjs +2 -4
- package/dist/utils/addDataFetchExposes.js +13 -11
- package/dist/utils/addDataFetchExposes.mjs +0 -5
- package/dist/utils/autoDeleteSplitChunkCacheGroups.js +18 -15
- package/dist/utils/autoDeleteSplitChunkCacheGroups.mjs +1 -3
- package/dist/utils/index.js +19 -17
- package/dist/utils/index.mjs +6 -13
- package/dist/utils/manifest.js +13 -11
- package/dist/utils/manifest.mjs +0 -3
- package/dist/utils/ssr.js +36 -45
- package/dist/utils/ssr.mjs +16 -32
- package/dist/utils.js +19 -18
- package/dist/utils.mjs +1 -2
- package/package.json +9 -8
|
@@ -9,7 +9,6 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
|
9
9
|
// The require scope
|
|
10
10
|
var __webpack_require__ = {};
|
|
11
11
|
|
|
12
|
-
/************************************************************************/
|
|
13
12
|
// webpack/runtime/compat_get_default_export
|
|
14
13
|
(() => {
|
|
15
14
|
// getDefaultExport function for compatibility with non-ESM modules
|
|
@@ -24,12 +23,16 @@ __webpack_require__.n = (module) => {
|
|
|
24
23
|
})();
|
|
25
24
|
// webpack/runtime/define_property_getters
|
|
26
25
|
(() => {
|
|
27
|
-
__webpack_require__.d = (exports,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
27
|
+
var define = (defs, kind) => {
|
|
28
|
+
for(var key in defs) {
|
|
29
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
30
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
33
36
|
};
|
|
34
37
|
})();
|
|
35
38
|
// webpack/runtime/has_own_property
|
|
@@ -46,7 +49,6 @@ __webpack_require__.r = (exports) => {
|
|
|
46
49
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47
50
|
};
|
|
48
51
|
})();
|
|
49
|
-
/************************************************************************/
|
|
50
52
|
var __webpack_exports__ = {};
|
|
51
53
|
// ESM COMPAT FLAG
|
|
52
54
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -120,9 +122,9 @@ function addDataFetchExposes(exposes, isServer) {
|
|
|
120
122
|
}
|
|
121
123
|
|
|
122
124
|
exports.addDataFetchExposes = __webpack_exports__.addDataFetchExposes;
|
|
123
|
-
for(var
|
|
124
|
-
if(["addDataFetchExposes"].indexOf(
|
|
125
|
-
exports[
|
|
125
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
126
|
+
if(["addDataFetchExposes"].indexOf(__rspack_i) === -1) {
|
|
127
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
126
128
|
}
|
|
127
129
|
}
|
|
128
130
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -3,15 +3,10 @@ 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"
|
|
7
6
|
|
|
8
|
-
;// CONCATENATED MODULE: external "path"
|
|
9
7
|
|
|
10
|
-
;// CONCATENATED MODULE: external "@module-federation/sdk"
|
|
11
8
|
|
|
12
|
-
;// CONCATENATED MODULE: external "../constant.mjs"
|
|
13
9
|
|
|
14
|
-
;// CONCATENATED MODULE: ./src/utils/addDataFetchExposes.ts
|
|
15
10
|
|
|
16
11
|
|
|
17
12
|
|
|
@@ -9,15 +9,18 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
|
9
9
|
// The require scope
|
|
10
10
|
var __webpack_require__ = {};
|
|
11
11
|
|
|
12
|
-
/************************************************************************/
|
|
13
12
|
// webpack/runtime/define_property_getters
|
|
14
13
|
(() => {
|
|
15
|
-
__webpack_require__.d = (exports,
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
14
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
15
|
+
var define = (defs, kind) => {
|
|
16
|
+
for(var key in defs) {
|
|
17
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
18
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
define(getters, "get");
|
|
23
|
+
define(values, "value");
|
|
21
24
|
};
|
|
22
25
|
})();
|
|
23
26
|
// webpack/runtime/has_own_property
|
|
@@ -34,12 +37,8 @@ __webpack_require__.r = (exports) => {
|
|
|
34
37
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
35
38
|
};
|
|
36
39
|
})();
|
|
37
|
-
/************************************************************************/
|
|
38
40
|
var __webpack_exports__ = {};
|
|
39
41
|
__webpack_require__.r(__webpack_exports__);
|
|
40
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
41
|
-
autoDeleteSplitChunkCacheGroups: () => (autoDeleteSplitChunkCacheGroups)
|
|
42
|
-
});
|
|
43
42
|
// lib-polyfill.js: include core-js,@babel/runtime,@swc/helpers,tslib.
|
|
44
43
|
// lib-react.js: include react,react-dom.
|
|
45
44
|
// lib-router.js: include react-router,react-router-dom,history,@remix-run/router.
|
|
@@ -74,7 +73,7 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, splitChunks) {
|
|
|
74
73
|
if (!mfConfig.shared) {
|
|
75
74
|
return;
|
|
76
75
|
}
|
|
77
|
-
if (!splitChunks || !
|
|
76
|
+
if (!splitChunks || !splitChunks?.cacheGroups) {
|
|
78
77
|
return;
|
|
79
78
|
}
|
|
80
79
|
const arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
|
|
@@ -90,10 +89,14 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, splitChunks) {
|
|
|
90
89
|
return splitChunks;
|
|
91
90
|
}
|
|
92
91
|
|
|
92
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
93
|
+
autoDeleteSplitChunkCacheGroups: () => (autoDeleteSplitChunkCacheGroups)
|
|
94
|
+
});
|
|
95
|
+
|
|
93
96
|
exports.autoDeleteSplitChunkCacheGroups = __webpack_exports__.autoDeleteSplitChunkCacheGroups;
|
|
94
|
-
for(var
|
|
95
|
-
if(["autoDeleteSplitChunkCacheGroups"].indexOf(
|
|
96
|
-
exports[
|
|
97
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
98
|
+
if(["autoDeleteSplitChunkCacheGroups"].indexOf(__rspack_i) === -1) {
|
|
99
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
97
100
|
}
|
|
98
101
|
}
|
|
99
102
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
|
|
2
|
-
;// CONCATENATED MODULE: ./src/utils/autoDeleteSplitChunkCacheGroups.ts
|
|
3
1
|
// lib-polyfill.js: include core-js,@babel/runtime,@swc/helpers,tslib.
|
|
4
2
|
// lib-react.js: include react,react-dom.
|
|
5
3
|
// lib-router.js: include react-router,react-router-dom,history,@remix-run/router.
|
|
@@ -34,7 +32,7 @@ function autoDeleteSplitChunkCacheGroups(mfConfig, splitChunks) {
|
|
|
34
32
|
if (!mfConfig.shared) {
|
|
35
33
|
return;
|
|
36
34
|
}
|
|
37
|
-
if (!splitChunks || !
|
|
35
|
+
if (!splitChunks || !splitChunks?.cacheGroups) {
|
|
38
36
|
return;
|
|
39
37
|
}
|
|
40
38
|
const arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
|
package/dist/utils/index.js
CHANGED
|
@@ -9,7 +9,6 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
|
9
9
|
// The require scope
|
|
10
10
|
var __webpack_require__ = {};
|
|
11
11
|
|
|
12
|
-
/************************************************************************/
|
|
13
12
|
// webpack/runtime/compat_get_default_export
|
|
14
13
|
(() => {
|
|
15
14
|
// getDefaultExport function for compatibility with non-ESM modules
|
|
@@ -24,12 +23,16 @@ __webpack_require__.n = (module) => {
|
|
|
24
23
|
})();
|
|
25
24
|
// webpack/runtime/define_property_getters
|
|
26
25
|
(() => {
|
|
27
|
-
__webpack_require__.d = (exports,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
27
|
+
var define = (defs, kind) => {
|
|
28
|
+
for(var key in defs) {
|
|
29
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
30
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
33
36
|
};
|
|
34
37
|
})();
|
|
35
38
|
// webpack/runtime/has_own_property
|
|
@@ -46,24 +49,23 @@ __webpack_require__.r = (exports) => {
|
|
|
46
49
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47
50
|
};
|
|
48
51
|
})();
|
|
49
|
-
/************************************************************************/
|
|
50
52
|
var __webpack_exports__ = {};
|
|
51
53
|
// ESM COMPAT FLAG
|
|
52
54
|
__webpack_require__.r(__webpack_exports__);
|
|
53
55
|
|
|
54
56
|
// EXPORTS
|
|
55
57
|
__webpack_require__.d(__webpack_exports__, {
|
|
56
|
-
createSSRREnvConfig: () => (/* reexport */ external_ssr_js_namespaceObject.createSSRREnvConfig),
|
|
57
58
|
DEFAULT_ASSET_PREFIX: () => (/* reexport */ external_constant_js_namespaceObject.DEFAULT_ASSET_PREFIX),
|
|
59
|
+
SSR_DIR: () => (/* reexport */ external_ssr_js_namespaceObject.SSR_DIR),
|
|
58
60
|
SSR_ENV_NAME: () => (/* reexport */ external_ssr_js_namespaceObject.SSR_ENV_NAME),
|
|
61
|
+
addDataFetchExposes: () => (/* reexport */ external_addDataFetchExposes_js_namespaceObject.addDataFetchExposes),
|
|
59
62
|
autoDeleteSplitChunkCacheGroups: () => (/* reexport */ external_autoDeleteSplitChunkCacheGroups_js_namespaceObject.autoDeleteSplitChunkCacheGroups),
|
|
60
|
-
|
|
61
|
-
|
|
63
|
+
createSSRMFConfig: () => (/* reexport */ external_ssr_js_namespaceObject.createSSRMFConfig),
|
|
64
|
+
createSSRREnvConfig: () => (/* reexport */ external_ssr_js_namespaceObject.createSSRREnvConfig),
|
|
62
65
|
isRegExp: () => (/* binding */ isRegExp),
|
|
63
66
|
patchSSRRspackConfig: () => (/* reexport */ external_ssr_js_namespaceObject.patchSSRRspackConfig),
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
addDataFetchExposes: () => (/* reexport */ external_addDataFetchExposes_js_namespaceObject.addDataFetchExposes)
|
|
67
|
+
setSSREnv: () => (/* reexport */ external_ssr_js_namespaceObject.setSSREnv),
|
|
68
|
+
updateStatsAndManifest: () => (/* reexport */ external_manifest_js_namespaceObject.updateStatsAndManifest)
|
|
67
69
|
});
|
|
68
70
|
|
|
69
71
|
;// CONCATENATED MODULE: external "util"
|
|
@@ -101,9 +103,9 @@ exports.isRegExp = __webpack_exports__.isRegExp;
|
|
|
101
103
|
exports.patchSSRRspackConfig = __webpack_exports__.patchSSRRspackConfig;
|
|
102
104
|
exports.setSSREnv = __webpack_exports__.setSSREnv;
|
|
103
105
|
exports.updateStatsAndManifest = __webpack_exports__.updateStatsAndManifest;
|
|
104
|
-
for(var
|
|
105
|
-
if(["DEFAULT_ASSET_PREFIX","SSR_DIR","SSR_ENV_NAME","addDataFetchExposes","autoDeleteSplitChunkCacheGroups","createSSRMFConfig","createSSRREnvConfig","isRegExp","patchSSRRspackConfig","setSSREnv","updateStatsAndManifest"].indexOf(
|
|
106
|
-
exports[
|
|
106
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
107
|
+
if(["DEFAULT_ASSET_PREFIX","SSR_DIR","SSR_ENV_NAME","addDataFetchExposes","autoDeleteSplitChunkCacheGroups","createSSRMFConfig","createSSRREnvConfig","isRegExp","patchSSRRspackConfig","setSSREnv","updateStatsAndManifest"].indexOf(__rspack_i) === -1) {
|
|
108
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
107
109
|
}
|
|
108
110
|
}
|
|
109
111
|
Object.defineProperty(exports, '__esModule', { value: true });
|
package/dist/utils/index.mjs
CHANGED
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
import util from "util";
|
|
2
|
-
import { DEFAULT_ASSET_PREFIX } from "../constant.mjs";
|
|
3
|
-
import { autoDeleteSplitChunkCacheGroups } from "./autoDeleteSplitChunkCacheGroups.mjs";
|
|
4
|
-
import { addDataFetchExposes } from "./addDataFetchExposes.mjs";
|
|
5
|
-
import { updateStatsAndManifest } from "./manifest.mjs";
|
|
6
|
-
import { SSR_DIR, SSR_ENV_NAME, createSSRMFConfig, createSSRREnvConfig, patchSSRRspackConfig, setSSREnv } from "./ssr.mjs";
|
|
7
2
|
|
|
8
|
-
;// CONCATENATED MODULE: external "util"
|
|
9
3
|
|
|
10
|
-
;// CONCATENATED MODULE: external "../constant.mjs"
|
|
11
4
|
|
|
12
|
-
;// CONCATENATED MODULE: external "./autoDeleteSplitChunkCacheGroups.mjs"
|
|
13
5
|
|
|
14
|
-
;// CONCATENATED MODULE: external "./addDataFetchExposes.mjs"
|
|
15
6
|
|
|
16
|
-
;// CONCATENATED MODULE: external "./manifest.mjs"
|
|
17
7
|
|
|
18
|
-
;// CONCATENATED MODULE: external "./ssr.mjs"
|
|
19
8
|
|
|
20
|
-
;// CONCATENATED MODULE: ./src/utils/index.ts
|
|
21
9
|
|
|
22
10
|
function isRegExp(target) {
|
|
23
11
|
return util.types.isRegExp(target);
|
|
@@ -28,4 +16,9 @@ function isRegExp(target) {
|
|
|
28
16
|
|
|
29
17
|
|
|
30
18
|
|
|
31
|
-
export {
|
|
19
|
+
export { isRegExp };
|
|
20
|
+
export { DEFAULT_ASSET_PREFIX } from "../constant.mjs";
|
|
21
|
+
export { autoDeleteSplitChunkCacheGroups } from "./autoDeleteSplitChunkCacheGroups.mjs";
|
|
22
|
+
export { addDataFetchExposes } from "./addDataFetchExposes.mjs";
|
|
23
|
+
export { updateStatsAndManifest } from "./manifest.mjs";
|
|
24
|
+
export { SSR_DIR, SSR_ENV_NAME, createSSRMFConfig, createSSRREnvConfig, patchSSRRspackConfig, setSSREnv } from "./ssr.mjs";
|
package/dist/utils/manifest.js
CHANGED
|
@@ -9,7 +9,6 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
|
9
9
|
// The require scope
|
|
10
10
|
var __webpack_require__ = {};
|
|
11
11
|
|
|
12
|
-
/************************************************************************/
|
|
13
12
|
// webpack/runtime/compat_get_default_export
|
|
14
13
|
(() => {
|
|
15
14
|
// getDefaultExport function for compatibility with non-ESM modules
|
|
@@ -24,12 +23,16 @@ __webpack_require__.n = (module) => {
|
|
|
24
23
|
})();
|
|
25
24
|
// webpack/runtime/define_property_getters
|
|
26
25
|
(() => {
|
|
27
|
-
__webpack_require__.d = (exports,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
27
|
+
var define = (defs, kind) => {
|
|
28
|
+
for(var key in defs) {
|
|
29
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
30
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
33
36
|
};
|
|
34
37
|
})();
|
|
35
38
|
// webpack/runtime/has_own_property
|
|
@@ -46,7 +49,6 @@ __webpack_require__.r = (exports) => {
|
|
|
46
49
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47
50
|
};
|
|
48
51
|
})();
|
|
49
|
-
/************************************************************************/
|
|
50
52
|
var __webpack_exports__ = {};
|
|
51
53
|
// ESM COMPAT FLAG
|
|
52
54
|
__webpack_require__.r(__webpack_exports__);
|
|
@@ -105,9 +107,9 @@ function updateStatsAndManifest(nodeAssets, browserAssets, outputDir) {
|
|
|
105
107
|
}
|
|
106
108
|
|
|
107
109
|
exports.updateStatsAndManifest = __webpack_exports__.updateStatsAndManifest;
|
|
108
|
-
for(var
|
|
109
|
-
if(["updateStatsAndManifest"].indexOf(
|
|
110
|
-
exports[
|
|
110
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
111
|
+
if(["updateStatsAndManifest"].indexOf(__rspack_i) === -1) {
|
|
112
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
111
113
|
}
|
|
112
114
|
}
|
|
113
115
|
Object.defineProperty(exports, '__esModule', { value: true });
|
package/dist/utils/manifest.mjs
CHANGED
package/dist/utils/ssr.js
CHANGED
|
@@ -9,7 +9,6 @@ const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
|
9
9
|
// The require scope
|
|
10
10
|
var __webpack_require__ = {};
|
|
11
11
|
|
|
12
|
-
/************************************************************************/
|
|
13
12
|
// webpack/runtime/compat_get_default_export
|
|
14
13
|
(() => {
|
|
15
14
|
// getDefaultExport function for compatibility with non-ESM modules
|
|
@@ -24,12 +23,16 @@ __webpack_require__.n = (module) => {
|
|
|
24
23
|
})();
|
|
25
24
|
// webpack/runtime/define_property_getters
|
|
26
25
|
(() => {
|
|
27
|
-
__webpack_require__.d = (exports,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
26
|
+
__webpack_require__.d = (exports, getters, values) => {
|
|
27
|
+
var define = (defs, kind) => {
|
|
28
|
+
for(var key in defs) {
|
|
29
|
+
if(__webpack_require__.o(defs, key) && !__webpack_require__.o(exports, key)) {
|
|
30
|
+
Object.defineProperty(exports, key, { enumerable: true, [kind]: defs[key] });
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
33
36
|
};
|
|
34
37
|
})();
|
|
35
38
|
// webpack/runtime/has_own_property
|
|
@@ -46,23 +49,22 @@ __webpack_require__.r = (exports) => {
|
|
|
46
49
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
47
50
|
};
|
|
48
51
|
})();
|
|
49
|
-
/************************************************************************/
|
|
50
52
|
var __webpack_exports__ = {};
|
|
51
53
|
// ESM COMPAT FLAG
|
|
52
54
|
__webpack_require__.r(__webpack_exports__);
|
|
53
55
|
|
|
54
56
|
// EXPORTS
|
|
55
57
|
__webpack_require__.d(__webpack_exports__, {
|
|
56
|
-
|
|
58
|
+
ENV_NAME: () => (/* binding */ ENV_NAME),
|
|
59
|
+
SSR_DIR: () => (/* binding */ SSR_DIR),
|
|
60
|
+
SSR_ENV_NAME: () => (/* binding */ SSR_ENV_NAME),
|
|
61
|
+
createSSRMFConfig: () => (/* binding */ createSSRMFConfig),
|
|
57
62
|
createSSRREnvConfig: () => (/* binding */ createSSRREnvConfig),
|
|
58
|
-
|
|
63
|
+
patchNodeConfig: () => (/* binding */ patchNodeConfig),
|
|
59
64
|
patchNodeMFConfig: () => (/* binding */ patchNodeMFConfig),
|
|
60
|
-
SSR_ENV_NAME: () => (/* binding */ SSR_ENV_NAME),
|
|
61
|
-
patchToolsTspack: () => (/* binding */ patchToolsTspack),
|
|
62
65
|
patchSSRRspackConfig: () => (/* binding */ patchSSRRspackConfig),
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
createSSRMFConfig: () => (/* binding */ createSSRMFConfig)
|
|
66
|
+
patchToolsTspack: () => (/* binding */ patchToolsTspack),
|
|
67
|
+
setSSREnv: () => (/* binding */ setSSREnv)
|
|
66
68
|
});
|
|
67
69
|
|
|
68
70
|
;// CONCATENATED MODULE: external "path"
|
|
@@ -105,7 +107,6 @@ const isDev = ()=>{
|
|
|
105
107
|
return process.env['NODE_ENV'] === 'development';
|
|
106
108
|
};
|
|
107
109
|
function patchNodeConfig(config, mfConfig) {
|
|
108
|
-
var _config_output;
|
|
109
110
|
config.output ||= {};
|
|
110
111
|
if (config.output.publicPath === 'auto') {
|
|
111
112
|
config.output.publicPath = '';
|
|
@@ -118,12 +119,12 @@ function patchNodeConfig(config, mfConfig) {
|
|
|
118
119
|
config.output.chunkLoading = 'async-node';
|
|
119
120
|
delete config.output.chunkLoadingGlobal;
|
|
120
121
|
const UniverseEntryChunkTrackerPluginModule = safeRequire('@module-federation/node/universe-entry-chunk-tracker-plugin');
|
|
121
|
-
const UniverseEntryChunkTrackerPlugin = UniverseEntryChunkTrackerPluginModule
|
|
122
|
+
const UniverseEntryChunkTrackerPlugin = UniverseEntryChunkTrackerPluginModule?.default;
|
|
122
123
|
config.plugins ||= [];
|
|
123
124
|
if (isDev() && UniverseEntryChunkTrackerPlugin) {
|
|
124
125
|
config.plugins.push(new UniverseEntryChunkTrackerPlugin());
|
|
125
126
|
}
|
|
126
|
-
const uniqueName = mfConfig.name ||
|
|
127
|
+
const uniqueName = mfConfig.name || config.output?.uniqueName;
|
|
127
128
|
const chunkFileName = config.output.chunkFilename;
|
|
128
129
|
if (typeof chunkFileName === 'string' && uniqueName && !chunkFileName.includes(uniqueName)) {
|
|
129
130
|
const encodedName = (0,sdk_namespaceObject.encodeName)(uniqueName);
|
|
@@ -133,8 +134,7 @@ function patchNodeConfig(config, mfConfig) {
|
|
|
133
134
|
function patchSSRRspackConfig(config, mfConfig, ssrDir, callerName, resetEntry = true, modifyPublicPath = true) {
|
|
134
135
|
config.output ||= {};
|
|
135
136
|
if (modifyPublicPath) {
|
|
136
|
-
|
|
137
|
-
if (typeof ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.publicPath) !== 'string') {
|
|
137
|
+
if (typeof config.output?.publicPath !== 'string') {
|
|
138
138
|
throw new Error('publicPath must be string!');
|
|
139
139
|
}
|
|
140
140
|
const publicPath = config.output.publicPath;
|
|
@@ -151,16 +151,12 @@ function patchSSRRspackConfig(config, mfConfig, ssrDir, callerName, resetEntry =
|
|
|
151
151
|
return config;
|
|
152
152
|
}
|
|
153
153
|
function patchToolsTspack(envConfig, fn) {
|
|
154
|
-
var _envConfig_tools;
|
|
155
154
|
const rspackArr = [];
|
|
156
|
-
if (
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
rspackArr.push(
|
|
161
|
-
} else if (typeof ((_envConfig_tools2 = envConfig.tools) === null || _envConfig_tools2 === void 0 ? void 0 : _envConfig_tools2.rspack) === 'function') {
|
|
162
|
-
var _envConfig_tools4;
|
|
163
|
-
rspackArr.push((_envConfig_tools4 = envConfig.tools) === null || _envConfig_tools4 === void 0 ? void 0 : _envConfig_tools4.rspack);
|
|
155
|
+
if (envConfig.tools?.rspack) {
|
|
156
|
+
if (Array.isArray(envConfig.tools?.rspack)) {
|
|
157
|
+
rspackArr.push(...envConfig.tools?.rspack);
|
|
158
|
+
} else if (typeof envConfig.tools?.rspack === 'function') {
|
|
159
|
+
rspackArr.push(envConfig.tools?.rspack);
|
|
164
160
|
}
|
|
165
161
|
}
|
|
166
162
|
envConfig.tools ||= {};
|
|
@@ -170,16 +166,12 @@ function patchToolsTspack(envConfig, fn) {
|
|
|
170
166
|
];
|
|
171
167
|
}
|
|
172
168
|
function createSSRREnvConfig(envConfig, mfConfig, ssrDir, rsbuildConfig, callerName) {
|
|
173
|
-
var _envConfig_tools, _ssrEnvConfig_output, _ssrEnvConfig_output_distPath, _ssrEnvConfig_output1, _rsbuildConfig_output_distPath, _rsbuildConfig_output;
|
|
174
169
|
const rspackArr = [];
|
|
175
|
-
if (
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
rspackArr.push(
|
|
180
|
-
} else if (typeof ((_envConfig_tools2 = envConfig.tools) === null || _envConfig_tools2 === void 0 ? void 0 : _envConfig_tools2.rspack) === 'function') {
|
|
181
|
-
var _envConfig_tools4;
|
|
182
|
-
rspackArr.push((_envConfig_tools4 = envConfig.tools) === null || _envConfig_tools4 === void 0 ? void 0 : _envConfig_tools4.rspack);
|
|
170
|
+
if (envConfig.tools?.rspack) {
|
|
171
|
+
if (Array.isArray(envConfig.tools?.rspack)) {
|
|
172
|
+
rspackArr.push(...envConfig.tools?.rspack);
|
|
173
|
+
} else if (typeof envConfig.tools?.rspack === 'function') {
|
|
174
|
+
rspackArr.push(envConfig.tools?.rspack);
|
|
183
175
|
}
|
|
184
176
|
}
|
|
185
177
|
const ssrEnvConfig = {
|
|
@@ -197,15 +189,14 @@ function createSSRREnvConfig(envConfig, mfConfig, ssrDir, rsbuildConfig, callerN
|
|
|
197
189
|
// Rsbuild not support all rspack targets, so modify to async-node in modifyRspackConfig
|
|
198
190
|
target: 'node',
|
|
199
191
|
distPath: {
|
|
200
|
-
...
|
|
201
|
-
root: external_path_default().join(
|
|
192
|
+
...ssrEnvConfig.output?.distPath,
|
|
193
|
+
root: external_path_default().join(ssrEnvConfig.output?.distPath?.root || rsbuildConfig.output?.distPath?.root || '', ssrDir)
|
|
202
194
|
},
|
|
203
195
|
emitAssets: true
|
|
204
196
|
};
|
|
205
197
|
return ssrEnvConfig;
|
|
206
198
|
}
|
|
207
199
|
function patchNodeMFConfig(mfConfig) {
|
|
208
|
-
var _mfConfig_library;
|
|
209
200
|
if (mfConfig.remotes) {
|
|
210
201
|
mfConfig.remoteType = 'script';
|
|
211
202
|
}
|
|
@@ -215,7 +206,7 @@ function patchNodeMFConfig(mfConfig) {
|
|
|
215
206
|
mfConfig.library = {
|
|
216
207
|
...mfConfig.library,
|
|
217
208
|
name: mfConfig.name,
|
|
218
|
-
type:
|
|
209
|
+
type: mfConfig.library?.type ?? 'commonjs-module'
|
|
219
210
|
};
|
|
220
211
|
mfConfig.runtimePlugins = [
|
|
221
212
|
...mfConfig.runtimePlugins || []
|
|
@@ -245,9 +236,9 @@ exports.patchNodeMFConfig = __webpack_exports__.patchNodeMFConfig;
|
|
|
245
236
|
exports.patchSSRRspackConfig = __webpack_exports__.patchSSRRspackConfig;
|
|
246
237
|
exports.patchToolsTspack = __webpack_exports__.patchToolsTspack;
|
|
247
238
|
exports.setSSREnv = __webpack_exports__.setSSREnv;
|
|
248
|
-
for(var
|
|
249
|
-
if(["ENV_NAME","SSR_DIR","SSR_ENV_NAME","createSSRMFConfig","createSSRREnvConfig","patchNodeConfig","patchNodeMFConfig","patchSSRRspackConfig","patchToolsTspack","setSSREnv"].indexOf(
|
|
250
|
-
exports[
|
|
239
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
240
|
+
if(["ENV_NAME","SSR_DIR","SSR_ENV_NAME","createSSRMFConfig","createSSRREnvConfig","patchNodeConfig","patchNodeMFConfig","patchSSRRspackConfig","patchToolsTspack","setSSREnv"].indexOf(__rspack_i) === -1) {
|
|
241
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
251
242
|
}
|
|
252
243
|
}
|
|
253
244
|
Object.defineProperty(exports, '__esModule', { value: true });
|
package/dist/utils/ssr.mjs
CHANGED
|
@@ -3,15 +3,10 @@ import { createRequire } from "node:module";
|
|
|
3
3
|
import { encodeName } from "@module-federation/sdk";
|
|
4
4
|
import { CALL_NAME_MAP } from "../constant.mjs";
|
|
5
5
|
|
|
6
|
-
;// CONCATENATED MODULE: external "path"
|
|
7
6
|
|
|
8
|
-
;// CONCATENATED MODULE: external "node:module"
|
|
9
7
|
|
|
10
|
-
;// CONCATENATED MODULE: external "@module-federation/sdk"
|
|
11
8
|
|
|
12
|
-
;// CONCATENATED MODULE: external "../constant.mjs"
|
|
13
9
|
|
|
14
|
-
;// CONCATENATED MODULE: ./src/utils/ssr.ts
|
|
15
10
|
|
|
16
11
|
|
|
17
12
|
|
|
@@ -42,7 +37,6 @@ const isDev = ()=>{
|
|
|
42
37
|
return process.env['NODE_ENV'] === 'development';
|
|
43
38
|
};
|
|
44
39
|
function patchNodeConfig(config, mfConfig) {
|
|
45
|
-
var _config_output;
|
|
46
40
|
config.output ||= {};
|
|
47
41
|
if (config.output.publicPath === 'auto') {
|
|
48
42
|
config.output.publicPath = '';
|
|
@@ -55,12 +49,12 @@ function patchNodeConfig(config, mfConfig) {
|
|
|
55
49
|
config.output.chunkLoading = 'async-node';
|
|
56
50
|
delete config.output.chunkLoadingGlobal;
|
|
57
51
|
const UniverseEntryChunkTrackerPluginModule = safeRequire('@module-federation/node/universe-entry-chunk-tracker-plugin');
|
|
58
|
-
const UniverseEntryChunkTrackerPlugin = UniverseEntryChunkTrackerPluginModule
|
|
52
|
+
const UniverseEntryChunkTrackerPlugin = UniverseEntryChunkTrackerPluginModule?.default;
|
|
59
53
|
config.plugins ||= [];
|
|
60
54
|
if (isDev() && UniverseEntryChunkTrackerPlugin) {
|
|
61
55
|
config.plugins.push(new UniverseEntryChunkTrackerPlugin());
|
|
62
56
|
}
|
|
63
|
-
const uniqueName = mfConfig.name ||
|
|
57
|
+
const uniqueName = mfConfig.name || config.output?.uniqueName;
|
|
64
58
|
const chunkFileName = config.output.chunkFilename;
|
|
65
59
|
if (typeof chunkFileName === 'string' && uniqueName && !chunkFileName.includes(uniqueName)) {
|
|
66
60
|
const encodedName = encodeName(uniqueName);
|
|
@@ -70,8 +64,7 @@ function patchNodeConfig(config, mfConfig) {
|
|
|
70
64
|
function patchSSRRspackConfig(config, mfConfig, ssrDir, callerName, resetEntry = true, modifyPublicPath = true) {
|
|
71
65
|
config.output ||= {};
|
|
72
66
|
if (modifyPublicPath) {
|
|
73
|
-
|
|
74
|
-
if (typeof ((_config_output = config.output) === null || _config_output === void 0 ? void 0 : _config_output.publicPath) !== 'string') {
|
|
67
|
+
if (typeof config.output?.publicPath !== 'string') {
|
|
75
68
|
throw new Error('publicPath must be string!');
|
|
76
69
|
}
|
|
77
70
|
const publicPath = config.output.publicPath;
|
|
@@ -88,16 +81,12 @@ function patchSSRRspackConfig(config, mfConfig, ssrDir, callerName, resetEntry =
|
|
|
88
81
|
return config;
|
|
89
82
|
}
|
|
90
83
|
function patchToolsTspack(envConfig, fn) {
|
|
91
|
-
var _envConfig_tools;
|
|
92
84
|
const rspackArr = [];
|
|
93
|
-
if (
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
rspackArr.push(
|
|
98
|
-
} else if (typeof ((_envConfig_tools2 = envConfig.tools) === null || _envConfig_tools2 === void 0 ? void 0 : _envConfig_tools2.rspack) === 'function') {
|
|
99
|
-
var _envConfig_tools4;
|
|
100
|
-
rspackArr.push((_envConfig_tools4 = envConfig.tools) === null || _envConfig_tools4 === void 0 ? void 0 : _envConfig_tools4.rspack);
|
|
85
|
+
if (envConfig.tools?.rspack) {
|
|
86
|
+
if (Array.isArray(envConfig.tools?.rspack)) {
|
|
87
|
+
rspackArr.push(...envConfig.tools?.rspack);
|
|
88
|
+
} else if (typeof envConfig.tools?.rspack === 'function') {
|
|
89
|
+
rspackArr.push(envConfig.tools?.rspack);
|
|
101
90
|
}
|
|
102
91
|
}
|
|
103
92
|
envConfig.tools ||= {};
|
|
@@ -107,16 +96,12 @@ function patchToolsTspack(envConfig, fn) {
|
|
|
107
96
|
];
|
|
108
97
|
}
|
|
109
98
|
function createSSRREnvConfig(envConfig, mfConfig, ssrDir, rsbuildConfig, callerName) {
|
|
110
|
-
var _envConfig_tools, _ssrEnvConfig_output, _ssrEnvConfig_output_distPath, _ssrEnvConfig_output1, _rsbuildConfig_output_distPath, _rsbuildConfig_output;
|
|
111
99
|
const rspackArr = [];
|
|
112
|
-
if (
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
rspackArr.push(
|
|
117
|
-
} else if (typeof ((_envConfig_tools2 = envConfig.tools) === null || _envConfig_tools2 === void 0 ? void 0 : _envConfig_tools2.rspack) === 'function') {
|
|
118
|
-
var _envConfig_tools4;
|
|
119
|
-
rspackArr.push((_envConfig_tools4 = envConfig.tools) === null || _envConfig_tools4 === void 0 ? void 0 : _envConfig_tools4.rspack);
|
|
100
|
+
if (envConfig.tools?.rspack) {
|
|
101
|
+
if (Array.isArray(envConfig.tools?.rspack)) {
|
|
102
|
+
rspackArr.push(...envConfig.tools?.rspack);
|
|
103
|
+
} else if (typeof envConfig.tools?.rspack === 'function') {
|
|
104
|
+
rspackArr.push(envConfig.tools?.rspack);
|
|
120
105
|
}
|
|
121
106
|
}
|
|
122
107
|
const ssrEnvConfig = {
|
|
@@ -134,15 +119,14 @@ function createSSRREnvConfig(envConfig, mfConfig, ssrDir, rsbuildConfig, callerN
|
|
|
134
119
|
// Rsbuild not support all rspack targets, so modify to async-node in modifyRspackConfig
|
|
135
120
|
target: 'node',
|
|
136
121
|
distPath: {
|
|
137
|
-
...
|
|
138
|
-
root: path.join(
|
|
122
|
+
...ssrEnvConfig.output?.distPath,
|
|
123
|
+
root: path.join(ssrEnvConfig.output?.distPath?.root || rsbuildConfig.output?.distPath?.root || '', ssrDir)
|
|
139
124
|
},
|
|
140
125
|
emitAssets: true
|
|
141
126
|
};
|
|
142
127
|
return ssrEnvConfig;
|
|
143
128
|
}
|
|
144
129
|
function patchNodeMFConfig(mfConfig) {
|
|
145
|
-
var _mfConfig_library;
|
|
146
130
|
if (mfConfig.remotes) {
|
|
147
131
|
mfConfig.remoteType = 'script';
|
|
148
132
|
}
|
|
@@ -152,7 +136,7 @@ function patchNodeMFConfig(mfConfig) {
|
|
|
152
136
|
mfConfig.library = {
|
|
153
137
|
...mfConfig.library,
|
|
154
138
|
name: mfConfig.name,
|
|
155
|
-
type:
|
|
139
|
+
type: mfConfig.library?.type ?? 'commonjs-module'
|
|
156
140
|
};
|
|
157
141
|
mfConfig.runtimePlugins = [
|
|
158
142
|
...mfConfig.runtimePlugins || []
|