@module-federation/rsbuild-plugin 0.0.0-chore-bump-node-22-20260710161714
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/LICENSE +21 -0
- package/README.md +125 -0
- package/dist/LICENSE +21 -0
- package/dist/cli/index.d.ts +33 -0
- package/dist/cli/index.js +468 -0
- package/dist/cli/index.mjs +389 -0
- package/dist/constant.d.ts +10 -0
- package/dist/constant.js +76 -0
- package/dist/constant.mjs +12 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.js +96 -0
- package/dist/index.mjs +4 -0
- package/dist/logger.d.ts +2 -0
- package/dist/logger.js +62 -0
- package/dist/logger.mjs +8 -0
- package/dist/utils/addDataFetchExposes.d.ts +2 -0
- package/dist/utils/addDataFetchExposes.js +130 -0
- package/dist/utils/addDataFetchExposes.mjs +62 -0
- package/dist/utils/autoDeleteSplitChunkCacheGroups.d.ts +6 -0
- package/dist/utils/autoDeleteSplitChunkCacheGroups.js +102 -0
- package/dist/utils/autoDeleteSplitChunkCacheGroups.mjs +51 -0
- package/dist/utils/index.d.ts +7 -0
- package/dist/utils/index.js +111 -0
- package/dist/utils/index.mjs +24 -0
- package/dist/utils/manifest.d.ts +11 -0
- package/dist/utils/manifest.js +115 -0
- package/dist/utils/manifest.mjs +47 -0
- package/dist/utils/ssr.d.ts +50 -0
- package/dist/utils/ssr.js +260 -0
- package/dist/utils/ssr.mjs +175 -0
- package/dist/utils.d.ts +1 -0
- package/dist/utils.js +96 -0
- package/dist/utils.mjs +4 -0
- package/package.json +83 -0
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
3
|
+
return typeof document === 'undefined'
|
|
4
|
+
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
|
|
5
|
+
: (document.currentScript && document.currentScript.src) ||
|
|
6
|
+
new URL('main.js', document.baseURI).href;
|
|
7
|
+
})();
|
|
8
|
+
;
|
|
9
|
+
// The require scope
|
|
10
|
+
var __webpack_require__ = {};
|
|
11
|
+
|
|
12
|
+
// webpack/runtime/compat_get_default_export
|
|
13
|
+
(() => {
|
|
14
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
15
|
+
__webpack_require__.n = (module) => {
|
|
16
|
+
var getter = module && module.__esModule ?
|
|
17
|
+
() => (module['default']) :
|
|
18
|
+
() => (module);
|
|
19
|
+
__webpack_require__.d(getter, { a: getter });
|
|
20
|
+
return getter;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
})();
|
|
24
|
+
// webpack/runtime/define_property_getters
|
|
25
|
+
(() => {
|
|
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");
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
// webpack/runtime/has_own_property
|
|
39
|
+
(() => {
|
|
40
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
41
|
+
})();
|
|
42
|
+
// webpack/runtime/make_namespace_object
|
|
43
|
+
(() => {
|
|
44
|
+
// define __esModule on exports
|
|
45
|
+
__webpack_require__.r = (exports) => {
|
|
46
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
47
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
48
|
+
}
|
|
49
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
52
|
+
var __webpack_exports__ = {};
|
|
53
|
+
// ESM COMPAT FLAG
|
|
54
|
+
__webpack_require__.r(__webpack_exports__);
|
|
55
|
+
|
|
56
|
+
// EXPORTS
|
|
57
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
58
|
+
addDataFetchExposes: () => (/* binding */ addDataFetchExposes)
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
;// CONCATENATED MODULE: external "fs"
|
|
62
|
+
const external_fs_namespaceObject = require("fs");
|
|
63
|
+
var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_namespaceObject);
|
|
64
|
+
;// CONCATENATED MODULE: external "path"
|
|
65
|
+
const external_path_namespaceObject = require("path");
|
|
66
|
+
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_namespaceObject);
|
|
67
|
+
;// CONCATENATED MODULE: external "@module-federation/sdk"
|
|
68
|
+
const sdk_namespaceObject = require("@module-federation/sdk");
|
|
69
|
+
;// CONCATENATED MODULE: external "../constant.js"
|
|
70
|
+
const external_constant_js_namespaceObject = require("../constant.js");
|
|
71
|
+
;// CONCATENATED MODULE: ./src/utils/addDataFetchExposes.ts
|
|
72
|
+
|
|
73
|
+
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
const addDataFetchExpose = (exposes, key, filepath, suffix = '')=>{
|
|
77
|
+
if (!external_fs_default().existsSync(filepath)) {
|
|
78
|
+
return false;
|
|
79
|
+
}
|
|
80
|
+
const dataFetchKey = key === '.' ? `./${external_constant_js_namespaceObject.DATA_FETCH_IDENTIFIER}${suffix}` : `${key}.${external_constant_js_namespaceObject.DATA_FETCH_IDENTIFIER}${suffix}`;
|
|
81
|
+
if (exposes[dataFetchKey] && exposes[dataFetchKey] !== filepath) {
|
|
82
|
+
throw new Error(`data fetch key ${dataFetchKey} already exists, please modify this expose key, do not end with '${external_constant_js_namespaceObject.DATA_FETCH_IDENTIFIER}' or '${external_constant_js_namespaceObject.DATA_FETCH_CLIENT_SUFFIX}'`);
|
|
83
|
+
}
|
|
84
|
+
exposes[dataFetchKey] = filepath;
|
|
85
|
+
return dataFetchKey;
|
|
86
|
+
};
|
|
87
|
+
const addExcludeDtsSuffix = (filepath)=>{
|
|
88
|
+
return `${filepath}?exclude-mf-dts=true`;
|
|
89
|
+
};
|
|
90
|
+
function addDataFetchExposes(exposes, isServer) {
|
|
91
|
+
if (typeof exposes !== 'object' || Array.isArray(exposes)) {
|
|
92
|
+
return;
|
|
93
|
+
}
|
|
94
|
+
if (Object.keys(exposes).length === 0) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
const tempDataFetch = external_path_default().resolve(process.cwd(), `node_modules/${sdk_namespaceObject.TEMP_DIR}`);
|
|
98
|
+
const content = `export const fetchData=()=>{throw new Error('should not be called')};`;
|
|
99
|
+
external_fs_default().mkdirSync(tempDataFetch, {
|
|
100
|
+
recursive: true
|
|
101
|
+
});
|
|
102
|
+
Object.keys(exposes).forEach((key, index)=>{
|
|
103
|
+
const expose = exposes[key];
|
|
104
|
+
if (typeof expose !== 'string') {
|
|
105
|
+
return;
|
|
106
|
+
}
|
|
107
|
+
const absPath = external_path_default().resolve(process.cwd(), expose);
|
|
108
|
+
const dataFetchPath = `${absPath.replace(external_path_default().extname(absPath), '')}.${external_constant_js_namespaceObject.DATA_FETCH_IDENTIFIER}.ts`;
|
|
109
|
+
const dataFetchClientPath = `${absPath.replace(external_path_default().extname(absPath), '')}.${external_constant_js_namespaceObject.DATA_FETCH_IDENTIFIER}.client.ts`;
|
|
110
|
+
const tempFile = external_path_default().join(tempDataFetch, `data-fetch-fallback${index}.ts`);
|
|
111
|
+
external_fs_default().writeFileSync(tempFile, content);
|
|
112
|
+
const dateFetchClientKey = addDataFetchExpose(exposes, key, dataFetchClientPath, external_constant_js_namespaceObject.DATA_FETCH_CLIENT_SUFFIX);
|
|
113
|
+
if (!isServer && dateFetchClientKey) {
|
|
114
|
+
exposes[dateFetchClientKey.replace(external_constant_js_namespaceObject.DATA_FETCH_CLIENT_SUFFIX, '')] = addExcludeDtsSuffix(tempFile);
|
|
115
|
+
return;
|
|
116
|
+
}
|
|
117
|
+
const dataFetchKey = addDataFetchExpose(exposes, key, dataFetchPath);
|
|
118
|
+
if (dataFetchKey && external_fs_default().existsSync(dataFetchClientPath)) {
|
|
119
|
+
exposes[`${dataFetchKey}${external_constant_js_namespaceObject.DATA_FETCH_CLIENT_SUFFIX}`] = addExcludeDtsSuffix(tempFile);
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
exports.addDataFetchExposes = __webpack_exports__.addDataFetchExposes;
|
|
125
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
126
|
+
if(["addDataFetchExposes"].indexOf(__rspack_i) === -1) {
|
|
127
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import fs from "fs";
|
|
2
|
+
import path from "path";
|
|
3
|
+
import { TEMP_DIR } from "@module-federation/sdk";
|
|
4
|
+
import { DATA_FETCH_CLIENT_SUFFIX, DATA_FETCH_IDENTIFIER } from "../constant.mjs";
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
const addDataFetchExpose = (exposes, key, filepath, suffix = '')=>{
|
|
15
|
+
if (!fs.existsSync(filepath)) {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
const dataFetchKey = key === '.' ? `./${DATA_FETCH_IDENTIFIER}${suffix}` : `${key}.${DATA_FETCH_IDENTIFIER}${suffix}`;
|
|
19
|
+
if (exposes[dataFetchKey] && exposes[dataFetchKey] !== filepath) {
|
|
20
|
+
throw new Error(`data fetch key ${dataFetchKey} already exists, please modify this expose key, do not end with '${DATA_FETCH_IDENTIFIER}' or '${DATA_FETCH_CLIENT_SUFFIX}'`);
|
|
21
|
+
}
|
|
22
|
+
exposes[dataFetchKey] = filepath;
|
|
23
|
+
return dataFetchKey;
|
|
24
|
+
};
|
|
25
|
+
const addExcludeDtsSuffix = (filepath)=>{
|
|
26
|
+
return `${filepath}?exclude-mf-dts=true`;
|
|
27
|
+
};
|
|
28
|
+
function addDataFetchExposes(exposes, isServer) {
|
|
29
|
+
if (typeof exposes !== 'object' || Array.isArray(exposes)) {
|
|
30
|
+
return;
|
|
31
|
+
}
|
|
32
|
+
if (Object.keys(exposes).length === 0) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const tempDataFetch = path.resolve(process.cwd(), `node_modules/${TEMP_DIR}`);
|
|
36
|
+
const content = `export const fetchData=()=>{throw new Error('should not be called')};`;
|
|
37
|
+
fs.mkdirSync(tempDataFetch, {
|
|
38
|
+
recursive: true
|
|
39
|
+
});
|
|
40
|
+
Object.keys(exposes).forEach((key, index)=>{
|
|
41
|
+
const expose = exposes[key];
|
|
42
|
+
if (typeof expose !== 'string') {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const absPath = path.resolve(process.cwd(), expose);
|
|
46
|
+
const dataFetchPath = `${absPath.replace(path.extname(absPath), '')}.${DATA_FETCH_IDENTIFIER}.ts`;
|
|
47
|
+
const dataFetchClientPath = `${absPath.replace(path.extname(absPath), '')}.${DATA_FETCH_IDENTIFIER}.client.ts`;
|
|
48
|
+
const tempFile = path.join(tempDataFetch, `data-fetch-fallback${index}.ts`);
|
|
49
|
+
fs.writeFileSync(tempFile, content);
|
|
50
|
+
const dateFetchClientKey = addDataFetchExpose(exposes, key, dataFetchClientPath, DATA_FETCH_CLIENT_SUFFIX);
|
|
51
|
+
if (!isServer && dateFetchClientKey) {
|
|
52
|
+
exposes[dateFetchClientKey.replace(DATA_FETCH_CLIENT_SUFFIX, '')] = addExcludeDtsSuffix(tempFile);
|
|
53
|
+
return;
|
|
54
|
+
}
|
|
55
|
+
const dataFetchKey = addDataFetchExpose(exposes, key, dataFetchPath);
|
|
56
|
+
if (dataFetchKey && fs.existsSync(dataFetchClientPath)) {
|
|
57
|
+
exposes[`${dataFetchKey}${DATA_FETCH_CLIENT_SUFFIX}`] = addExcludeDtsSuffix(tempFile);
|
|
58
|
+
}
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export { addDataFetchExposes };
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { moduleFederationPlugin } from '@module-federation/sdk';
|
|
2
|
+
import type { Rspack } from '@rsbuild/core';
|
|
3
|
+
type OptimizationConfig = Rspack.Configuration['optimization'];
|
|
4
|
+
type SplitChunksConfig = NonNullable<OptimizationConfig>['splitChunks'];
|
|
5
|
+
export declare function autoDeleteSplitChunkCacheGroups(mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, splitChunks: SplitChunksConfig): Rspack.OptimizationSplitChunksOptions | undefined;
|
|
6
|
+
export {};
|
|
@@ -0,0 +1,102 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
3
|
+
return typeof document === 'undefined'
|
|
4
|
+
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
|
|
5
|
+
: (document.currentScript && document.currentScript.src) ||
|
|
6
|
+
new URL('main.js', document.baseURI).href;
|
|
7
|
+
})();
|
|
8
|
+
;
|
|
9
|
+
// The require scope
|
|
10
|
+
var __webpack_require__ = {};
|
|
11
|
+
|
|
12
|
+
// webpack/runtime/define_property_getters
|
|
13
|
+
(() => {
|
|
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");
|
|
24
|
+
};
|
|
25
|
+
})();
|
|
26
|
+
// webpack/runtime/has_own_property
|
|
27
|
+
(() => {
|
|
28
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
29
|
+
})();
|
|
30
|
+
// webpack/runtime/make_namespace_object
|
|
31
|
+
(() => {
|
|
32
|
+
// define __esModule on exports
|
|
33
|
+
__webpack_require__.r = (exports) => {
|
|
34
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
35
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
36
|
+
}
|
|
37
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
38
|
+
};
|
|
39
|
+
})();
|
|
40
|
+
var __webpack_exports__ = {};
|
|
41
|
+
__webpack_require__.r(__webpack_exports__);
|
|
42
|
+
// lib-polyfill.js: include core-js,@babel/runtime,@swc/helpers,tslib.
|
|
43
|
+
// lib-react.js: include react,react-dom.
|
|
44
|
+
// lib-router.js: include react-router,react-router-dom,history,@remix-run/router.
|
|
45
|
+
// lib-lodash.js: include lodash,lodash-es.
|
|
46
|
+
// lib-antd.js: include antd.
|
|
47
|
+
// lib-arco.js: include @arco-design/web-react.
|
|
48
|
+
// lib-semi.js: include @douyinfe/semi-ui.
|
|
49
|
+
// lib-axios.js: include axios.
|
|
50
|
+
const SPLIT_CHUNK_MAP = {
|
|
51
|
+
REACT: 'react',
|
|
52
|
+
ROUTER: 'router',
|
|
53
|
+
LODASH: 'lib-lodash',
|
|
54
|
+
ANTD: 'lib-antd',
|
|
55
|
+
ARCO: 'lib-arco',
|
|
56
|
+
SEMI: 'lib-semi',
|
|
57
|
+
AXIOS: 'lib-axios'
|
|
58
|
+
};
|
|
59
|
+
const SHARED_SPLIT_CHUNK_MAP = {
|
|
60
|
+
react: SPLIT_CHUNK_MAP.REACT,
|
|
61
|
+
'react-dom': SPLIT_CHUNK_MAP.REACT,
|
|
62
|
+
'react-router': SPLIT_CHUNK_MAP.ROUTER,
|
|
63
|
+
'react-router-dom': SPLIT_CHUNK_MAP.ROUTER,
|
|
64
|
+
'@remix-run/router': SPLIT_CHUNK_MAP.ROUTER,
|
|
65
|
+
lodash: SPLIT_CHUNK_MAP.LODASH,
|
|
66
|
+
'lodash-es': SPLIT_CHUNK_MAP.LODASH,
|
|
67
|
+
antd: SPLIT_CHUNK_MAP.ANTD,
|
|
68
|
+
'@arco-design/web-react': SPLIT_CHUNK_MAP.ARCO,
|
|
69
|
+
'@douyinfe/semi-ui': SPLIT_CHUNK_MAP.SEMI,
|
|
70
|
+
axios: SPLIT_CHUNK_MAP.AXIOS
|
|
71
|
+
};
|
|
72
|
+
function autoDeleteSplitChunkCacheGroups(mfConfig, splitChunks) {
|
|
73
|
+
if (!mfConfig.shared) {
|
|
74
|
+
return;
|
|
75
|
+
}
|
|
76
|
+
if (!splitChunks || !splitChunks?.cacheGroups) {
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
|
|
80
|
+
for (const shared of arrayShared){
|
|
81
|
+
const splitChunkKey = SHARED_SPLIT_CHUNK_MAP[shared];
|
|
82
|
+
if (!splitChunkKey) {
|
|
83
|
+
continue;
|
|
84
|
+
}
|
|
85
|
+
if (splitChunks.cacheGroups[splitChunkKey]) {
|
|
86
|
+
delete splitChunks.cacheGroups[splitChunkKey];
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
return splitChunks;
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
93
|
+
autoDeleteSplitChunkCacheGroups: () => (autoDeleteSplitChunkCacheGroups)
|
|
94
|
+
});
|
|
95
|
+
|
|
96
|
+
exports.autoDeleteSplitChunkCacheGroups = __webpack_exports__.autoDeleteSplitChunkCacheGroups;
|
|
97
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
98
|
+
if(["autoDeleteSplitChunkCacheGroups"].indexOf(__rspack_i) === -1) {
|
|
99
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
// lib-polyfill.js: include core-js,@babel/runtime,@swc/helpers,tslib.
|
|
2
|
+
// lib-react.js: include react,react-dom.
|
|
3
|
+
// lib-router.js: include react-router,react-router-dom,history,@remix-run/router.
|
|
4
|
+
// lib-lodash.js: include lodash,lodash-es.
|
|
5
|
+
// lib-antd.js: include antd.
|
|
6
|
+
// lib-arco.js: include @arco-design/web-react.
|
|
7
|
+
// lib-semi.js: include @douyinfe/semi-ui.
|
|
8
|
+
// lib-axios.js: include axios.
|
|
9
|
+
const SPLIT_CHUNK_MAP = {
|
|
10
|
+
REACT: 'react',
|
|
11
|
+
ROUTER: 'router',
|
|
12
|
+
LODASH: 'lib-lodash',
|
|
13
|
+
ANTD: 'lib-antd',
|
|
14
|
+
ARCO: 'lib-arco',
|
|
15
|
+
SEMI: 'lib-semi',
|
|
16
|
+
AXIOS: 'lib-axios'
|
|
17
|
+
};
|
|
18
|
+
const SHARED_SPLIT_CHUNK_MAP = {
|
|
19
|
+
react: SPLIT_CHUNK_MAP.REACT,
|
|
20
|
+
'react-dom': SPLIT_CHUNK_MAP.REACT,
|
|
21
|
+
'react-router': SPLIT_CHUNK_MAP.ROUTER,
|
|
22
|
+
'react-router-dom': SPLIT_CHUNK_MAP.ROUTER,
|
|
23
|
+
'@remix-run/router': SPLIT_CHUNK_MAP.ROUTER,
|
|
24
|
+
lodash: SPLIT_CHUNK_MAP.LODASH,
|
|
25
|
+
'lodash-es': SPLIT_CHUNK_MAP.LODASH,
|
|
26
|
+
antd: SPLIT_CHUNK_MAP.ANTD,
|
|
27
|
+
'@arco-design/web-react': SPLIT_CHUNK_MAP.ARCO,
|
|
28
|
+
'@douyinfe/semi-ui': SPLIT_CHUNK_MAP.SEMI,
|
|
29
|
+
axios: SPLIT_CHUNK_MAP.AXIOS
|
|
30
|
+
};
|
|
31
|
+
function autoDeleteSplitChunkCacheGroups(mfConfig, splitChunks) {
|
|
32
|
+
if (!mfConfig.shared) {
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
if (!splitChunks || !splitChunks?.cacheGroups) {
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
const arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
|
|
39
|
+
for (const shared of arrayShared){
|
|
40
|
+
const splitChunkKey = SHARED_SPLIT_CHUNK_MAP[shared];
|
|
41
|
+
if (!splitChunkKey) {
|
|
42
|
+
continue;
|
|
43
|
+
}
|
|
44
|
+
if (splitChunks.cacheGroups[splitChunkKey]) {
|
|
45
|
+
delete splitChunks.cacheGroups[splitChunkKey];
|
|
46
|
+
}
|
|
47
|
+
}
|
|
48
|
+
return splitChunks;
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
export { autoDeleteSplitChunkCacheGroups };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare function isRegExp(target: any): target is RegExp;
|
|
2
|
+
export { DEFAULT_ASSET_PREFIX } from '../constant';
|
|
3
|
+
export { autoDeleteSplitChunkCacheGroups } from './autoDeleteSplitChunkCacheGroups';
|
|
4
|
+
export { addDataFetchExposes } from './addDataFetchExposes';
|
|
5
|
+
export { updateStatsAndManifest } from './manifest';
|
|
6
|
+
export type { StatsAssetResource } from './manifest';
|
|
7
|
+
export { patchSSRRspackConfig, createSSRREnvConfig, createSSRMFConfig, setSSREnv, SSR_DIR, SSR_ENV_NAME, } from './ssr';
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
3
|
+
return typeof document === 'undefined'
|
|
4
|
+
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
|
|
5
|
+
: (document.currentScript && document.currentScript.src) ||
|
|
6
|
+
new URL('main.js', document.baseURI).href;
|
|
7
|
+
})();
|
|
8
|
+
;
|
|
9
|
+
// The require scope
|
|
10
|
+
var __webpack_require__ = {};
|
|
11
|
+
|
|
12
|
+
// webpack/runtime/compat_get_default_export
|
|
13
|
+
(() => {
|
|
14
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
15
|
+
__webpack_require__.n = (module) => {
|
|
16
|
+
var getter = module && module.__esModule ?
|
|
17
|
+
() => (module['default']) :
|
|
18
|
+
() => (module);
|
|
19
|
+
__webpack_require__.d(getter, { a: getter });
|
|
20
|
+
return getter;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
})();
|
|
24
|
+
// webpack/runtime/define_property_getters
|
|
25
|
+
(() => {
|
|
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");
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
// webpack/runtime/has_own_property
|
|
39
|
+
(() => {
|
|
40
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
41
|
+
})();
|
|
42
|
+
// webpack/runtime/make_namespace_object
|
|
43
|
+
(() => {
|
|
44
|
+
// define __esModule on exports
|
|
45
|
+
__webpack_require__.r = (exports) => {
|
|
46
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
47
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
48
|
+
}
|
|
49
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
52
|
+
var __webpack_exports__ = {};
|
|
53
|
+
// ESM COMPAT FLAG
|
|
54
|
+
__webpack_require__.r(__webpack_exports__);
|
|
55
|
+
|
|
56
|
+
// EXPORTS
|
|
57
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
58
|
+
DEFAULT_ASSET_PREFIX: () => (/* reexport */ external_constant_js_namespaceObject.DEFAULT_ASSET_PREFIX),
|
|
59
|
+
SSR_DIR: () => (/* reexport */ external_ssr_js_namespaceObject.SSR_DIR),
|
|
60
|
+
SSR_ENV_NAME: () => (/* reexport */ external_ssr_js_namespaceObject.SSR_ENV_NAME),
|
|
61
|
+
addDataFetchExposes: () => (/* reexport */ external_addDataFetchExposes_js_namespaceObject.addDataFetchExposes),
|
|
62
|
+
autoDeleteSplitChunkCacheGroups: () => (/* reexport */ external_autoDeleteSplitChunkCacheGroups_js_namespaceObject.autoDeleteSplitChunkCacheGroups),
|
|
63
|
+
createSSRMFConfig: () => (/* reexport */ external_ssr_js_namespaceObject.createSSRMFConfig),
|
|
64
|
+
createSSRREnvConfig: () => (/* reexport */ external_ssr_js_namespaceObject.createSSRREnvConfig),
|
|
65
|
+
isRegExp: () => (/* binding */ isRegExp),
|
|
66
|
+
patchSSRRspackConfig: () => (/* reexport */ external_ssr_js_namespaceObject.patchSSRRspackConfig),
|
|
67
|
+
setSSREnv: () => (/* reexport */ external_ssr_js_namespaceObject.setSSREnv),
|
|
68
|
+
updateStatsAndManifest: () => (/* reexport */ external_manifest_js_namespaceObject.updateStatsAndManifest)
|
|
69
|
+
});
|
|
70
|
+
|
|
71
|
+
;// CONCATENATED MODULE: external "util"
|
|
72
|
+
const external_util_namespaceObject = require("util");
|
|
73
|
+
var external_util_default = /*#__PURE__*/__webpack_require__.n(external_util_namespaceObject);
|
|
74
|
+
;// CONCATENATED MODULE: external "../constant.js"
|
|
75
|
+
const external_constant_js_namespaceObject = require("../constant.js");
|
|
76
|
+
;// CONCATENATED MODULE: external "./autoDeleteSplitChunkCacheGroups.js"
|
|
77
|
+
const external_autoDeleteSplitChunkCacheGroups_js_namespaceObject = require("./autoDeleteSplitChunkCacheGroups.js");
|
|
78
|
+
;// CONCATENATED MODULE: external "./addDataFetchExposes.js"
|
|
79
|
+
const external_addDataFetchExposes_js_namespaceObject = require("./addDataFetchExposes.js");
|
|
80
|
+
;// CONCATENATED MODULE: external "./manifest.js"
|
|
81
|
+
const external_manifest_js_namespaceObject = require("./manifest.js");
|
|
82
|
+
;// CONCATENATED MODULE: external "./ssr.js"
|
|
83
|
+
const external_ssr_js_namespaceObject = require("./ssr.js");
|
|
84
|
+
;// CONCATENATED MODULE: ./src/utils/index.ts
|
|
85
|
+
|
|
86
|
+
function isRegExp(target) {
|
|
87
|
+
return external_util_default().types.isRegExp(target);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
exports.DEFAULT_ASSET_PREFIX = __webpack_exports__.DEFAULT_ASSET_PREFIX;
|
|
96
|
+
exports.SSR_DIR = __webpack_exports__.SSR_DIR;
|
|
97
|
+
exports.SSR_ENV_NAME = __webpack_exports__.SSR_ENV_NAME;
|
|
98
|
+
exports.addDataFetchExposes = __webpack_exports__.addDataFetchExposes;
|
|
99
|
+
exports.autoDeleteSplitChunkCacheGroups = __webpack_exports__.autoDeleteSplitChunkCacheGroups;
|
|
100
|
+
exports.createSSRMFConfig = __webpack_exports__.createSSRMFConfig;
|
|
101
|
+
exports.createSSRREnvConfig = __webpack_exports__.createSSRREnvConfig;
|
|
102
|
+
exports.isRegExp = __webpack_exports__.isRegExp;
|
|
103
|
+
exports.patchSSRRspackConfig = __webpack_exports__.patchSSRRspackConfig;
|
|
104
|
+
exports.setSSREnv = __webpack_exports__.setSSREnv;
|
|
105
|
+
exports.updateStatsAndManifest = __webpack_exports__.updateStatsAndManifest;
|
|
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];
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import util from "util";
|
|
2
|
+
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
function isRegExp(target) {
|
|
11
|
+
return util.types.isRegExp(target);
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
|
|
18
|
+
|
|
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";
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { Stats, Manifest } from '@module-federation/sdk';
|
|
2
|
+
type AssetResource<T> = {
|
|
3
|
+
data: T;
|
|
4
|
+
filename: string;
|
|
5
|
+
};
|
|
6
|
+
export type StatsAssetResource = {
|
|
7
|
+
stats?: AssetResource<Stats>;
|
|
8
|
+
manifest?: AssetResource<Manifest>;
|
|
9
|
+
};
|
|
10
|
+
export declare function updateStatsAndManifest(nodeAssets: StatsAssetResource, browserAssets: StatsAssetResource, outputDir: string): void;
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
const __rslib_import_meta_url__ = /*#__PURE__*/ (function () {
|
|
3
|
+
return typeof document === 'undefined'
|
|
4
|
+
? new (require('url'.replace('', '')).URL)('file:' + __filename).href
|
|
5
|
+
: (document.currentScript && document.currentScript.src) ||
|
|
6
|
+
new URL('main.js', document.baseURI).href;
|
|
7
|
+
})();
|
|
8
|
+
;
|
|
9
|
+
// The require scope
|
|
10
|
+
var __webpack_require__ = {};
|
|
11
|
+
|
|
12
|
+
// webpack/runtime/compat_get_default_export
|
|
13
|
+
(() => {
|
|
14
|
+
// getDefaultExport function for compatibility with non-ESM modules
|
|
15
|
+
__webpack_require__.n = (module) => {
|
|
16
|
+
var getter = module && module.__esModule ?
|
|
17
|
+
() => (module['default']) :
|
|
18
|
+
() => (module);
|
|
19
|
+
__webpack_require__.d(getter, { a: getter });
|
|
20
|
+
return getter;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
})();
|
|
24
|
+
// webpack/runtime/define_property_getters
|
|
25
|
+
(() => {
|
|
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");
|
|
36
|
+
};
|
|
37
|
+
})();
|
|
38
|
+
// webpack/runtime/has_own_property
|
|
39
|
+
(() => {
|
|
40
|
+
__webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
|
|
41
|
+
})();
|
|
42
|
+
// webpack/runtime/make_namespace_object
|
|
43
|
+
(() => {
|
|
44
|
+
// define __esModule on exports
|
|
45
|
+
__webpack_require__.r = (exports) => {
|
|
46
|
+
if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
|
|
47
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
48
|
+
}
|
|
49
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|
|
50
|
+
};
|
|
51
|
+
})();
|
|
52
|
+
var __webpack_exports__ = {};
|
|
53
|
+
// ESM COMPAT FLAG
|
|
54
|
+
__webpack_require__.r(__webpack_exports__);
|
|
55
|
+
|
|
56
|
+
// EXPORTS
|
|
57
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
58
|
+
updateStatsAndManifest: () => (/* binding */ updateStatsAndManifest)
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
;// CONCATENATED MODULE: external "path"
|
|
62
|
+
const external_path_namespaceObject = require("path");
|
|
63
|
+
var external_path_default = /*#__PURE__*/__webpack_require__.n(external_path_namespaceObject);
|
|
64
|
+
;// CONCATENATED MODULE: external "fs"
|
|
65
|
+
const external_fs_namespaceObject = require("fs");
|
|
66
|
+
var external_fs_default = /*#__PURE__*/__webpack_require__.n(external_fs_namespaceObject);
|
|
67
|
+
;// CONCATENATED MODULE: ./src/utils/manifest.ts
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
function mergeStats(browserStats, nodeStats) {
|
|
71
|
+
const ssrRemoteEntry = nodeStats.metaData.remoteEntry;
|
|
72
|
+
browserStats.metaData.ssrRemoteEntry = ssrRemoteEntry;
|
|
73
|
+
if ('publicPath' in browserStats.metaData) {
|
|
74
|
+
// @ts-ignore nodeStats has the same structure with browserStats
|
|
75
|
+
browserStats.metaData.ssrPublicPath = nodeStats.metaData.publicPath;
|
|
76
|
+
}
|
|
77
|
+
return browserStats;
|
|
78
|
+
}
|
|
79
|
+
function mergeManifest(browserManifest, nodeManifest) {
|
|
80
|
+
const ssrRemoteEntry = nodeManifest.metaData.remoteEntry;
|
|
81
|
+
browserManifest.metaData.ssrRemoteEntry = ssrRemoteEntry;
|
|
82
|
+
if ('publicPath' in browserManifest.metaData) {
|
|
83
|
+
// @ts-ignore nodeStats has the same structure with browserStats
|
|
84
|
+
browserManifest.metaData.ssrPublicPath = nodeManifest.metaData.publicPath;
|
|
85
|
+
}
|
|
86
|
+
return browserManifest;
|
|
87
|
+
}
|
|
88
|
+
function mergeStatsAndManifest(nodeAssets, browserAssets) {
|
|
89
|
+
const { stats: browserStats, manifest: browserManifest } = browserAssets;
|
|
90
|
+
const { stats: nodeStats, manifest: nodeManifest } = nodeAssets;
|
|
91
|
+
if (!browserStats || !nodeStats || !browserManifest || !nodeManifest) {
|
|
92
|
+
throw new Error('Failed to read stats or manifest assets for merge');
|
|
93
|
+
}
|
|
94
|
+
const mergedStats = mergeStats(browserStats.data, nodeStats.data);
|
|
95
|
+
const mergedManifest = mergeManifest(browserManifest.data, nodeManifest.data);
|
|
96
|
+
return {
|
|
97
|
+
mergedStats: mergedStats,
|
|
98
|
+
mergedStatsFilePath: browserStats.filename,
|
|
99
|
+
mergedManifest: mergedManifest,
|
|
100
|
+
mergedManifestFilePath: browserManifest.filename
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
function updateStatsAndManifest(nodeAssets, browserAssets, outputDir) {
|
|
104
|
+
const { mergedStats, mergedStatsFilePath, mergedManifest, mergedManifestFilePath } = mergeStatsAndManifest(nodeAssets, browserAssets);
|
|
105
|
+
external_fs_default().writeFileSync(external_path_default().resolve(outputDir, mergedStatsFilePath), JSON.stringify(mergedStats, null, 2));
|
|
106
|
+
external_fs_default().writeFileSync(external_path_default().resolve(outputDir, mergedManifestFilePath), JSON.stringify(mergedManifest, null, 2));
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
exports.updateStatsAndManifest = __webpack_exports__.updateStatsAndManifest;
|
|
110
|
+
for(var __rspack_i in __webpack_exports__) {
|
|
111
|
+
if(["updateStatsAndManifest"].indexOf(__rspack_i) === -1) {
|
|
112
|
+
exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
Object.defineProperty(exports, '__esModule', { value: true });
|