@module-federation/modern-js 0.8.4 → 0.8.6

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.
@@ -42,6 +42,7 @@ var import_sdk = require("@module-federation/sdk");
42
42
  var import_node_bundle_require = require("@modern-js/node-bundle-require");
43
43
  var import_constant = require("../constant");
44
44
  var import_logger = __toESM(require("./logger"));
45
+ var import_utils = require("@module-federation/rsbuild-plugin/utils");
45
46
  const defaultPath = import_path.default.resolve(process.cwd(), "module-federation.config.ts");
46
47
  const isDev = process.env.NODE_ENV === "development";
47
48
  const getMFConfig = async (userConfig) => {
@@ -238,7 +239,7 @@ function patchBundlerConfig(options) {
238
239
  }
239
240
  }
240
241
  if (!isServer) {
241
- autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig);
242
+ (0, import_utils.autoDeleteSplitChunkCacheGroups)(mfConfig, bundlerConfig);
242
243
  }
243
244
  if (!isServer && enableSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
244
245
  bundlerConfig.optimization.splitChunks.chunks = "async";
@@ -321,25 +322,6 @@ const SHARED_SPLIT_CHUNK_MAP = {
321
322
  "@douyinfe/semi-ui": SPLIT_CHUNK_MAP.SEMI,
322
323
  axios: SPLIT_CHUNK_MAP.AXIOS
323
324
  };
324
- function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
325
- var _bundlerConfig_optimization;
326
- if (!mfConfig.shared) {
327
- return;
328
- }
329
- if (!((_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? void 0 : _bundlerConfig_optimization.splitChunks) || !bundlerConfig.optimization.splitChunks.cacheGroups) {
330
- return;
331
- }
332
- const arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
333
- for (const shared of arrayShared) {
334
- const splitChunkKey = SHARED_SPLIT_CHUNK_MAP[shared];
335
- if (!splitChunkKey) {
336
- continue;
337
- }
338
- if (bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey]) {
339
- delete bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey];
340
- }
341
- }
342
- }
343
325
  // Annotate the CommonJS export names for ESM import in node:
344
326
  0 && (module.exports = {
345
327
  addMyTypes2Ignored,
@@ -10,6 +10,7 @@ import { encodeName } from "@module-federation/sdk";
10
10
  import { bundle } from "@modern-js/node-bundle-require";
11
11
  import { LOCALHOST, PLUGIN_IDENTIFIER } from "../constant";
12
12
  import logger from "./logger";
13
+ import { autoDeleteSplitChunkCacheGroups } from "@module-federation/rsbuild-plugin/utils";
13
14
  var defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
14
15
  var isDev = process.env.NODE_ENV === "development";
15
16
  var getMFConfig = function() {
@@ -311,42 +312,6 @@ var SHARED_SPLIT_CHUNK_MAP = {
311
312
  "@douyinfe/semi-ui": SPLIT_CHUNK_MAP.SEMI,
312
313
  axios: SPLIT_CHUNK_MAP.AXIOS
313
314
  };
314
- function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
315
- var _bundlerConfig_optimization;
316
- if (!mfConfig.shared) {
317
- return;
318
- }
319
- if (!((_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? void 0 : _bundlerConfig_optimization.splitChunks) || !bundlerConfig.optimization.splitChunks.cacheGroups) {
320
- return;
321
- }
322
- var arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
323
- var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
324
- try {
325
- for (var _iterator = arrayShared[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {
326
- var shared = _step.value;
327
- var splitChunkKey = SHARED_SPLIT_CHUNK_MAP[shared];
328
- if (!splitChunkKey) {
329
- continue;
330
- }
331
- if (bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey]) {
332
- delete bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey];
333
- }
334
- }
335
- } catch (err) {
336
- _didIteratorError = true;
337
- _iteratorError = err;
338
- } finally {
339
- try {
340
- if (!_iteratorNormalCompletion && _iterator.return != null) {
341
- _iterator.return();
342
- }
343
- } finally {
344
- if (_didIteratorError) {
345
- throw _iteratorError;
346
- }
347
- }
348
- }
349
- }
350
315
  export {
351
316
  addMyTypes2Ignored,
352
317
  getIPV4,
@@ -4,6 +4,7 @@ import { encodeName } from "@module-federation/sdk";
4
4
  import { bundle } from "@modern-js/node-bundle-require";
5
5
  import { LOCALHOST, PLUGIN_IDENTIFIER } from "../constant";
6
6
  import logger from "./logger";
7
+ import { autoDeleteSplitChunkCacheGroups } from "@module-federation/rsbuild-plugin/utils";
7
8
  const defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
8
9
  const isDev = process.env.NODE_ENV === "development";
9
10
  const getMFConfig = async (userConfig) => {
@@ -283,25 +284,6 @@ const SHARED_SPLIT_CHUNK_MAP = {
283
284
  "@douyinfe/semi-ui": SPLIT_CHUNK_MAP.SEMI,
284
285
  axios: SPLIT_CHUNK_MAP.AXIOS
285
286
  };
286
- function autoDeleteSplitChunkCacheGroups(mfConfig, bundlerConfig) {
287
- var _bundlerConfig_optimization;
288
- if (!mfConfig.shared) {
289
- return;
290
- }
291
- if (!((_bundlerConfig_optimization = bundlerConfig.optimization) === null || _bundlerConfig_optimization === void 0 ? void 0 : _bundlerConfig_optimization.splitChunks) || !bundlerConfig.optimization.splitChunks.cacheGroups) {
292
- return;
293
- }
294
- const arrayShared = Array.isArray(mfConfig.shared) ? mfConfig.shared : Object.keys(mfConfig.shared);
295
- for (const shared of arrayShared) {
296
- const splitChunkKey = SHARED_SPLIT_CHUNK_MAP[shared];
297
- if (!splitChunkKey) {
298
- continue;
299
- }
300
- if (bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey]) {
301
- delete bundlerConfig.optimization.splitChunks.cacheGroups[splitChunkKey];
302
- }
303
- }
304
- }
305
287
  export {
306
288
  addMyTypes2Ignored,
307
289
  getIPV4,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.8.4",
3
+ "version": "0.8.6",
4
4
  "files": [
5
5
  "dist/",
6
6
  "types.d.ts",
@@ -89,10 +89,11 @@
89
89
  "@swc/helpers": "0.5.13",
90
90
  "hoist-non-react-statics": "3.3.2",
91
91
  "node-fetch": "~3.3.0",
92
- "react-error-boundary": "4.0.13",
93
- "@module-federation/enhanced": "0.8.4",
94
- "@module-federation/node": "2.6.17",
95
- "@module-federation/sdk": "0.8.4"
92
+ "react-error-boundary": "4.1.2",
93
+ "@module-federation/rsbuild-plugin": "0.8.6",
94
+ "@module-federation/enhanced": "0.8.6",
95
+ "@module-federation/node": "2.6.19",
96
+ "@module-federation/sdk": "0.8.6"
96
97
  },
97
98
  "devDependencies": {
98
99
  "@modern-js/app-tools": "2.60.6",
@@ -101,7 +102,7 @@
101
102
  "@modern-js/runtime": "2.60.6",
102
103
  "@modern-js/tsconfig": "2.60.6",
103
104
  "@types/hoist-non-react-statics": "3.3.5",
104
- "@module-federation/manifest": "0.8.4"
105
+ "@module-federation/manifest": "0.8.6"
105
106
  },
106
107
  "peerDependencies": {
107
108
  "react": ">=17",