@module-federation/rsbuild-plugin 0.24.1 → 2.0.1

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