@module-federation/modern-js 0.19.1 → 0.21.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.
|
@@ -40,7 +40,6 @@ __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"));
|
|
44
43
|
var import_utils = require("./utils");
|
|
45
44
|
var import_sdk = require("@module-federation/sdk");
|
|
46
45
|
var import_node_bundle_require = require("@modern-js/node-bundle-require");
|
|
@@ -66,7 +65,14 @@ const getMFConfig = async (userConfig) => {
|
|
|
66
65
|
return mfConfig;
|
|
67
66
|
};
|
|
68
67
|
const injectRuntimePlugins = (runtimePlugin, runtimePlugins) => {
|
|
69
|
-
|
|
68
|
+
const pluginName = typeof runtimePlugin === "string" ? runtimePlugin : runtimePlugin[0];
|
|
69
|
+
const hasPlugin = runtimePlugins.some((existingPlugin) => {
|
|
70
|
+
if (typeof existingPlugin === "string") {
|
|
71
|
+
return existingPlugin === pluginName;
|
|
72
|
+
}
|
|
73
|
+
return existingPlugin[0] === pluginName;
|
|
74
|
+
});
|
|
75
|
+
if (!hasPlugin) {
|
|
70
76
|
runtimePlugins.push(runtimePlugin);
|
|
71
77
|
}
|
|
72
78
|
};
|
|
@@ -147,17 +153,6 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy, enableSSR) => {
|
|
|
147
153
|
const runtimePlugins = [
|
|
148
154
|
...mfConfig.runtimePlugins || []
|
|
149
155
|
];
|
|
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
|
-
}
|
|
161
156
|
patchDTSConfig(mfConfig, isServer);
|
|
162
157
|
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
163
158
|
if (enableSSR && (0, import_utils3.isDev)()) {
|
|
@@ -5,7 +5,6 @@ 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";
|
|
9
8
|
import { getIPV4, isWebTarget, skipByTarget } from "./utils";
|
|
10
9
|
import { encodeName } from "@module-federation/sdk";
|
|
11
10
|
import { bundle } from "@modern-js/node-bundle-require";
|
|
@@ -58,7 +57,14 @@ var getMFConfig = function() {
|
|
|
58
57
|
};
|
|
59
58
|
}();
|
|
60
59
|
var injectRuntimePlugins = function(runtimePlugin, runtimePlugins) {
|
|
61
|
-
|
|
60
|
+
var pluginName = typeof runtimePlugin === "string" ? runtimePlugin : runtimePlugin[0];
|
|
61
|
+
var hasPlugin = runtimePlugins.some(function(existingPlugin) {
|
|
62
|
+
if (typeof existingPlugin === "string") {
|
|
63
|
+
return existingPlugin === pluginName;
|
|
64
|
+
}
|
|
65
|
+
return existingPlugin[0] === pluginName;
|
|
66
|
+
});
|
|
67
|
+
if (!hasPlugin) {
|
|
62
68
|
runtimePlugins.push(runtimePlugin);
|
|
63
69
|
}
|
|
64
70
|
};
|
|
@@ -137,17 +143,6 @@ var patchMFConfig = function(mfConfig, isServer, remoteIpStrategy, enableSSR) {
|
|
|
137
143
|
throw new Error("".concat(PLUGIN_IDENTIFIER, " mfConfig.name can not be empty!"));
|
|
138
144
|
}
|
|
139
145
|
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
|
-
}
|
|
151
146
|
patchDTSConfig(mfConfig, isServer);
|
|
152
147
|
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
153
148
|
if (enableSSR && isDev()) {
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import path from "path";
|
|
2
|
-
import fs from "fs";
|
|
3
2
|
import { getIPV4, isWebTarget, skipByTarget } from "./utils";
|
|
4
3
|
import { encodeName } from "@module-federation/sdk";
|
|
5
4
|
import { bundle } from "@modern-js/node-bundle-require";
|
|
@@ -25,7 +24,14 @@ const getMFConfig = async (userConfig) => {
|
|
|
25
24
|
return mfConfig;
|
|
26
25
|
};
|
|
27
26
|
const injectRuntimePlugins = (runtimePlugin, runtimePlugins) => {
|
|
28
|
-
|
|
27
|
+
const pluginName = typeof runtimePlugin === "string" ? runtimePlugin : runtimePlugin[0];
|
|
28
|
+
const hasPlugin = runtimePlugins.some((existingPlugin) => {
|
|
29
|
+
if (typeof existingPlugin === "string") {
|
|
30
|
+
return existingPlugin === pluginName;
|
|
31
|
+
}
|
|
32
|
+
return existingPlugin[0] === pluginName;
|
|
33
|
+
});
|
|
34
|
+
if (!hasPlugin) {
|
|
29
35
|
runtimePlugins.push(runtimePlugin);
|
|
30
36
|
}
|
|
31
37
|
};
|
|
@@ -106,17 +112,6 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy, enableSSR) => {
|
|
|
106
112
|
const runtimePlugins = [
|
|
107
113
|
...mfConfig.runtimePlugins || []
|
|
108
114
|
];
|
|
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
|
-
}
|
|
120
115
|
patchDTSConfig(mfConfig, isServer);
|
|
121
116
|
injectRuntimePlugins(require.resolve("@module-federation/modern-js/shared-strategy"), runtimePlugins);
|
|
122
117
|
if (enableSSR && isDev()) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.21.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.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/
|
|
123
|
-
"@module-federation/
|
|
124
|
-
"@module-federation/
|
|
125
|
-
"@module-federation/
|
|
126
|
-
"@module-federation/
|
|
127
|
-
"@module-federation/cli": "0.
|
|
128
|
-
"@module-federation/
|
|
122
|
+
"@module-federation/rsbuild-plugin": "0.21.0",
|
|
123
|
+
"@module-federation/enhanced": "0.21.0",
|
|
124
|
+
"@module-federation/bridge-react": "0.21.0",
|
|
125
|
+
"@module-federation/node": "2.7.19",
|
|
126
|
+
"@module-federation/sdk": "0.21.0",
|
|
127
|
+
"@module-federation/cli": "0.21.0",
|
|
128
|
+
"@module-federation/runtime": "0.21.0"
|
|
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.
|
|
140
|
+
"@module-federation/manifest": "0.21.0"
|
|
141
141
|
},
|
|
142
142
|
"peerDependencies": {
|
|
143
143
|
"react": ">=17",
|