@module-federation/modern-js 0.18.0 → 0.18.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.
@@ -40,6 +40,7 @@ __export(configPlugin_exports, {
40
40
  });
41
41
  module.exports = __toCommonJS(configPlugin_exports);
42
42
  var import_path = __toESM(require("path"));
43
+ var import_fs = __toESM(require("fs"));
43
44
  var import_utils = require("./utils");
44
45
  var import_sdk = require("@module-federation/sdk");
45
46
  var import_node_bundle_require = require("@modern-js/node-bundle-require");
@@ -146,6 +147,17 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy, enableSSR) => {
146
147
  const runtimePlugins = [
147
148
  ...mfConfig.runtimePlugins || []
148
149
  ];
150
+ try {
151
+ const nodeModulesPath = import_path.default.resolve(process.cwd(), "node_modules");
152
+ const bridgeReactPath = import_path.default.join(nodeModulesPath, "@module-federation/bridge-react");
153
+ if (import_fs.default.existsSync(bridgeReactPath) && (!(mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.bridge) || !mfConfig.bridge.disableAlias)) {
154
+ mfConfig.bridge = {
155
+ disableAlias: true
156
+ };
157
+ import_logger.default.debug(`${import_constant.PLUGIN_IDENTIFIER} use "@module-federation/modern-js/react" instead of "@module-federation/bridge-react" !`);
158
+ }
159
+ } catch (e) {
160
+ }
149
161
  patchDTSConfig(mfConfig, isServer);
150
162
  injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
151
163
  if (enableSSR && (0, import_utils3.isDev)()) {
@@ -3,10 +3,6 @@ var __defProp = Object.defineProperty;
3
3
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
4
  var __getOwnPropNames = Object.getOwnPropertyNames;
5
5
  var __hasOwnProp = Object.prototype.hasOwnProperty;
6
- var __export = (target, all) => {
7
- for (var name in all)
8
- __defProp(target, name, { get: all[name], enumerable: true });
9
- };
10
6
  var __copyProps = (to, from, except, desc) => {
11
7
  if (from && typeof from === "object" || typeof from === "function") {
12
8
  for (let key of __getOwnPropNames(from))
@@ -15,30 +11,12 @@ var __copyProps = (to, from, except, desc) => {
15
11
  }
16
12
  return to;
17
13
  };
14
+ var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
18
15
  var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
16
  var react_exports = {};
20
- __export(react_exports, {
21
- CacheSize: () => import_bridge_react.CacheSize,
22
- CacheTime: () => import_bridge_react.CacheTime,
23
- ERROR_TYPE: () => import_bridge_react.ERROR_TYPE,
24
- cache: () => import_bridge_react.cache,
25
- clearStore: () => import_bridge_react.clearStore,
26
- configureCache: () => import_bridge_react.configureCache,
27
- generateKey: () => import_bridge_react.generateKey,
28
- lazyLoadComponentPlugin: () => import_bridge_react.lazyLoadComponentPlugin,
29
- revalidateTag: () => import_bridge_react.revalidateTag
30
- });
31
17
  module.exports = __toCommonJS(react_exports);
32
- var import_bridge_react = require("@module-federation/bridge-react");
18
+ __reExport(react_exports, require("@module-federation/bridge-react"), module.exports);
33
19
  // Annotate the CommonJS export names for ESM import in node:
34
20
  0 && (module.exports = {
35
- CacheSize,
36
- CacheTime,
37
- ERROR_TYPE,
38
- cache,
39
- clearStore,
40
- configureCache,
41
- generateKey,
42
- lazyLoadComponentPlugin,
43
- revalidateTag
21
+ ...require("@module-federation/bridge-react")
44
22
  });
@@ -5,6 +5,7 @@ import { _ as _to_consumable_array } from "@swc/helpers/_/_to_consumable_array";
5
5
  import { _ as _type_of } from "@swc/helpers/_/_type_of";
6
6
  import { _ as _ts_generator } from "@swc/helpers/_/_ts_generator";
7
7
  import path from "path";
8
+ import fs from "fs";
8
9
  import { getIPV4, isWebTarget, skipByTarget } from "./utils";
9
10
  import { encodeName } from "@module-federation/sdk";
10
11
  import { bundle } from "@modern-js/node-bundle-require";
@@ -136,6 +137,17 @@ var patchMFConfig = function(mfConfig, isServer, remoteIpStrategy, enableSSR) {
136
137
  throw new Error("".concat(PLUGIN_IDENTIFIER, " mfConfig.name can not be empty!"));
137
138
  }
138
139
  var runtimePlugins = _to_consumable_array(mfConfig.runtimePlugins || []);
140
+ try {
141
+ var nodeModulesPath = path.resolve(process.cwd(), "node_modules");
142
+ var bridgeReactPath = path.join(nodeModulesPath, "@module-federation/bridge-react");
143
+ if (fs.existsSync(bridgeReactPath) && (!(mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.bridge) || !mfConfig.bridge.disableAlias)) {
144
+ mfConfig.bridge = {
145
+ disableAlias: true
146
+ };
147
+ logger.debug("".concat(PLUGIN_IDENTIFIER, ' use "@module-federation/modern-js/react" instead of "@module-federation/bridge-react" !'));
148
+ }
149
+ } catch (e) {
150
+ }
139
151
  patchDTSConfig(mfConfig, isServer);
140
152
  injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
141
153
  if (enableSSR && isDev()) {
@@ -1,12 +1 @@
1
- import { ERROR_TYPE, CacheSize, CacheTime, configureCache, generateKey, cache, revalidateTag, clearStore, lazyLoadComponentPlugin } from "@module-federation/bridge-react";
2
- export {
3
- CacheSize,
4
- CacheTime,
5
- ERROR_TYPE,
6
- cache,
7
- clearStore,
8
- configureCache,
9
- generateKey,
10
- lazyLoadComponentPlugin,
11
- revalidateTag
12
- };
1
+ export * from "@module-federation/bridge-react";
@@ -1,4 +1,5 @@
1
1
  import path from "path";
2
+ import fs from "fs";
2
3
  import { getIPV4, isWebTarget, skipByTarget } from "./utils";
3
4
  import { encodeName } from "@module-federation/sdk";
4
5
  import { bundle } from "@modern-js/node-bundle-require";
@@ -105,6 +106,17 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy, enableSSR) => {
105
106
  const runtimePlugins = [
106
107
  ...mfConfig.runtimePlugins || []
107
108
  ];
109
+ try {
110
+ const nodeModulesPath = path.resolve(process.cwd(), "node_modules");
111
+ const bridgeReactPath = path.join(nodeModulesPath, "@module-federation/bridge-react");
112
+ if (fs.existsSync(bridgeReactPath) && (!(mfConfig === null || mfConfig === void 0 ? void 0 : mfConfig.bridge) || !mfConfig.bridge.disableAlias)) {
113
+ mfConfig.bridge = {
114
+ disableAlias: true
115
+ };
116
+ logger.debug(`${PLUGIN_IDENTIFIER} use "@module-federation/modern-js/react" instead of "@module-federation/bridge-react" !`);
117
+ }
118
+ } catch (e) {
119
+ }
108
120
  patchDTSConfig(mfConfig, isServer);
109
121
  injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
110
122
  if (enableSSR && isDev()) {
@@ -1,12 +1 @@
1
- import { ERROR_TYPE, CacheSize, CacheTime, configureCache, generateKey, cache, revalidateTag, clearStore, lazyLoadComponentPlugin } from "@module-federation/bridge-react";
2
- export {
3
- CacheSize,
4
- CacheTime,
5
- ERROR_TYPE,
6
- cache,
7
- clearStore,
8
- configureCache,
9
- generateKey,
10
- lazyLoadComponentPlugin,
11
- revalidateTag
12
- };
1
+ export * from "@module-federation/bridge-react";
@@ -1,2 +1 @@
1
- export { ERROR_TYPE, CacheSize, CacheTime, configureCache, generateKey, cache, revalidateTag, clearStore, lazyLoadComponentPlugin, } from '@module-federation/bridge-react';
2
- export type { DataFetchParams, CacheStatus, CacheStatsInfo, } from '@module-federation/bridge-react';
1
+ export * from '@module-federation/bridge-react';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/modern-js",
3
- "version": "0.18.0",
3
+ "version": "0.18.1",
4
4
  "files": [
5
5
  "dist/",
6
6
  "types.d.ts",
@@ -49,17 +49,17 @@
49
49
  "./shared-strategy": {
50
50
  "types": "./dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts",
51
51
  "import": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.js",
52
- "require": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.js"
52
+ "require": "./dist/cjs/cli/mfRuntimePlugins/shared-strategy.js"
53
53
  },
54
54
  "./resolve-entry-ipv4": {
55
55
  "types": "./dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts",
56
56
  "import": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js",
57
- "require": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.js"
57
+ "require": "./dist/cjs/cli/mfRuntimePlugins/resolve-entry-ipv4.js"
58
58
  },
59
59
  "./inject-node-fetch": {
60
60
  "types": "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts",
61
61
  "import": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js",
62
- "require": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.js"
62
+ "require": "./dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js"
63
63
  },
64
64
  "./data-fetch-server-plugin": {
65
65
  "types": "./dist/types/cli/server/data-fetch-server-plugin.d.ts",
@@ -119,13 +119,13 @@
119
119
  "@swc/helpers": "^0.5.17",
120
120
  "node-fetch": "~3.3.0",
121
121
  "react-error-boundary": "4.1.2",
122
- "@module-federation/rsbuild-plugin": "0.18.0",
123
- "@module-federation/bridge-react": "0.18.0",
124
- "@module-federation/enhanced": "0.18.0",
125
- "@module-federation/runtime": "0.18.0",
126
- "@module-federation/node": "2.7.11",
127
- "@module-federation/sdk": "0.18.0",
128
- "@module-federation/cli": "0.18.0"
122
+ "@module-federation/rsbuild-plugin": "0.18.1",
123
+ "@module-federation/bridge-react": "0.18.1",
124
+ "@module-federation/enhanced": "0.18.1",
125
+ "@module-federation/runtime": "0.18.1",
126
+ "@module-federation/node": "2.7.12",
127
+ "@module-federation/sdk": "0.18.1",
128
+ "@module-federation/cli": "0.18.1"
129
129
  },
130
130
  "devDependencies": {
131
131
  "@modern-js/core": "2.68.2",
@@ -137,7 +137,7 @@
137
137
  "@modern-js/tsconfig": "2.68.2",
138
138
  "@types/react": "^18.3.11",
139
139
  "@types/react-dom": "^18.3.0",
140
- "@module-federation/manifest": "0.18.0"
140
+ "@module-federation/manifest": "0.18.1"
141
141
  },
142
142
  "peerDependencies": {
143
143
  "react": ">=17",