@module-federation/modern-js 0.0.0-next-20240625025206 → 0.0.0-next-20240625070454
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/README.md +1 -1
- package/dist/cjs/cli/index.js +1 -1
- package/dist/cjs/cli/utils.js +12 -6
- package/dist/cjs/constant.js +5 -2
- package/dist/esm/cli/index.js +2 -2
- package/dist/esm/cli/utils.js +11 -5
- package/dist/esm/constant.js +3 -1
- package/dist/esm-node/cli/index.js +2 -2
- package/dist/esm-node/cli/utils.js +13 -7
- package/dist/esm-node/constant.js +3 -1
- package/dist/types/constant.d.ts +1 -0
- package/package.json +12 -12
package/README.md
CHANGED
package/dist/cjs/cli/index.js
CHANGED
|
@@ -94,7 +94,7 @@ const moduleFederationPlugin = (userConfig = {}) => ({
|
|
|
94
94
|
tools: {
|
|
95
95
|
rspack(config) {
|
|
96
96
|
if (enableSSR) {
|
|
97
|
-
throw new Error(
|
|
97
|
+
throw new Error(`${import_constant.PLUGIN_IDENTIFIER} not support ssr for rspack bundler yet!`);
|
|
98
98
|
}
|
|
99
99
|
modifyBundlerConfig(config, false);
|
|
100
100
|
},
|
package/dist/cjs/cli/utils.js
CHANGED
|
@@ -90,11 +90,10 @@ const replaceRemoteUrl = async (mfConfig) => {
|
|
|
90
90
|
handleRemoteObject(mfConfig.remotes);
|
|
91
91
|
}
|
|
92
92
|
};
|
|
93
|
-
const
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
];
|
|
93
|
+
const patchDTSConfig = (mfConfig, isServer) => {
|
|
94
|
+
if (isServer) {
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
98
97
|
const ModernJSRuntime = "@modern-js/runtime/mf";
|
|
99
98
|
if (mfConfig.dts !== false) {
|
|
100
99
|
var _mfConfig_dts, _mfConfig_dts1;
|
|
@@ -122,6 +121,13 @@ const patchMFConfig = (mfConfig, isServer) => {
|
|
|
122
121
|
}
|
|
123
122
|
}
|
|
124
123
|
}
|
|
124
|
+
};
|
|
125
|
+
const patchMFConfig = (mfConfig, isServer) => {
|
|
126
|
+
const isDev = process.env.NODE_ENV === "development";
|
|
127
|
+
const runtimePlugins = [
|
|
128
|
+
...mfConfig.runtimePlugins || []
|
|
129
|
+
];
|
|
130
|
+
patchDTSConfig(mfConfig, isServer);
|
|
125
131
|
injectRuntimePlugins(import_path.default.resolve(__dirname, "./mfRuntimePlugins/shared-strategy.js"), runtimePlugins);
|
|
126
132
|
if (isDev) {
|
|
127
133
|
injectRuntimePlugins(import_path.default.resolve(__dirname, "./mfRuntimePlugins/resolve-entry-ipv4.js"), runtimePlugins);
|
|
@@ -178,7 +184,7 @@ function patchWebpackConfig(options) {
|
|
|
178
184
|
}
|
|
179
185
|
if (!isServer && enableSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
|
|
180
186
|
bundlerConfig.optimization.splitChunks.chunks = "async";
|
|
181
|
-
console.warn(
|
|
187
|
+
console.warn(`${import_constant.PLUGIN_IDENTIFIER} splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
|
|
182
188
|
}
|
|
183
189
|
if (((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
|
|
184
190
|
var _modernjsConfig_dev, _modernjsConfig_server1;
|
package/dist/cjs/constant.js
CHANGED
|
@@ -19,13 +19,16 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
19
19
|
var constant_exports = {};
|
|
20
20
|
__export(constant_exports, {
|
|
21
21
|
LOCALHOST: () => LOCALHOST,
|
|
22
|
-
MODERN_JS_SERVER_DIR: () => MODERN_JS_SERVER_DIR
|
|
22
|
+
MODERN_JS_SERVER_DIR: () => MODERN_JS_SERVER_DIR,
|
|
23
|
+
PLUGIN_IDENTIFIER: () => PLUGIN_IDENTIFIER
|
|
23
24
|
});
|
|
24
25
|
module.exports = __toCommonJS(constant_exports);
|
|
25
26
|
const MODERN_JS_SERVER_DIR = "bundles";
|
|
26
27
|
const LOCALHOST = "localhost";
|
|
28
|
+
const PLUGIN_IDENTIFIER = "[ Modern.js Module Federation ]";
|
|
27
29
|
// Annotate the CommonJS export names for ESM import in node:
|
|
28
30
|
0 && (module.exports = {
|
|
29
31
|
LOCALHOST,
|
|
30
|
-
MODERN_JS_SERVER_DIR
|
|
32
|
+
MODERN_JS_SERVER_DIR,
|
|
33
|
+
PLUGIN_IDENTIFIER
|
|
31
34
|
});
|
package/dist/esm/cli/index.js
CHANGED
|
@@ -7,7 +7,7 @@ import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-
|
|
|
7
7
|
import { StreamingTargetPlugin, EntryChunkTrackerPlugin } from "@module-federation/node";
|
|
8
8
|
import { getMFConfig, getTargetEnvConfig, patchWebpackConfig, getIPV4 } from "./utils";
|
|
9
9
|
import { updateStatsAndManifest } from "./manifest";
|
|
10
|
-
import { MODERN_JS_SERVER_DIR } from "../constant";
|
|
10
|
+
import { MODERN_JS_SERVER_DIR, PLUGIN_IDENTIFIER } from "../constant";
|
|
11
11
|
var SSR_PLUGIN_IDENTIFIER = "mfPluginSSR";
|
|
12
12
|
var isDev = process.env.NODE_ENV === "development";
|
|
13
13
|
var moduleFederationPlugin = function() {
|
|
@@ -75,7 +75,7 @@ var moduleFederationPlugin = function() {
|
|
|
75
75
|
tools: {
|
|
76
76
|
rspack: function rspack(config) {
|
|
77
77
|
if (enableSSR) {
|
|
78
|
-
throw new Error("
|
|
78
|
+
throw new Error("".concat(PLUGIN_IDENTIFIER, " not support ssr for rspack bundler yet!"));
|
|
79
79
|
}
|
|
80
80
|
modifyBundlerConfig(config, false);
|
|
81
81
|
},
|
package/dist/esm/cli/utils.js
CHANGED
|
@@ -7,7 +7,7 @@ import { encodeName } from "@module-federation/sdk";
|
|
|
7
7
|
import path from "path";
|
|
8
8
|
import os from "os";
|
|
9
9
|
import { bundle } from "@modern-js/node-bundle-require";
|
|
10
|
-
import { LOCALHOST } from "../constant";
|
|
10
|
+
import { LOCALHOST, PLUGIN_IDENTIFIER } from "../constant";
|
|
11
11
|
var defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
|
|
12
12
|
var getMFConfig = function() {
|
|
13
13
|
var _ref = _async_to_generator(function(userConfig) {
|
|
@@ -103,9 +103,10 @@ var replaceRemoteUrl = function() {
|
|
|
103
103
|
return _ref.apply(this, arguments);
|
|
104
104
|
};
|
|
105
105
|
}();
|
|
106
|
-
var
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
var patchDTSConfig = function(mfConfig, isServer) {
|
|
107
|
+
if (isServer) {
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
109
110
|
var ModernJSRuntime = "@modern-js/runtime/mf";
|
|
110
111
|
if (mfConfig.dts !== false) {
|
|
111
112
|
var _mfConfig_dts, _mfConfig_dts1;
|
|
@@ -133,6 +134,11 @@ var patchMFConfig = function(mfConfig, isServer) {
|
|
|
133
134
|
}
|
|
134
135
|
}
|
|
135
136
|
}
|
|
137
|
+
};
|
|
138
|
+
var patchMFConfig = function(mfConfig, isServer) {
|
|
139
|
+
var isDev = process.env.NODE_ENV === "development";
|
|
140
|
+
var runtimePlugins = _to_consumable_array(mfConfig.runtimePlugins || []);
|
|
141
|
+
patchDTSConfig(mfConfig, isServer);
|
|
136
142
|
injectRuntimePlugins(path.resolve(__dirname, "./mfRuntimePlugins/shared-strategy.js"), runtimePlugins);
|
|
137
143
|
if (isDev) {
|
|
138
144
|
injectRuntimePlugins(path.resolve(__dirname, "./mfRuntimePlugins/resolve-entry-ipv4.js"), runtimePlugins);
|
|
@@ -184,7 +190,7 @@ function patchWebpackConfig(options) {
|
|
|
184
190
|
}
|
|
185
191
|
if (!isServer && enableSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
|
|
186
192
|
bundlerConfig.optimization.splitChunks.chunks = "async";
|
|
187
|
-
console.warn(
|
|
193
|
+
console.warn("".concat(PLUGIN_IDENTIFIER, ' splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"'));
|
|
188
194
|
}
|
|
189
195
|
if (((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
|
|
190
196
|
var _modernjsConfig_dev, _modernjsConfig_server1;
|
package/dist/esm/constant.js
CHANGED
|
@@ -5,7 +5,7 @@ import { ModuleFederationPlugin as RspackModuleFederationPlugin } from "@module-
|
|
|
5
5
|
import { StreamingTargetPlugin, EntryChunkTrackerPlugin } from "@module-federation/node";
|
|
6
6
|
import { getMFConfig, getTargetEnvConfig, patchWebpackConfig, getIPV4 } from "./utils";
|
|
7
7
|
import { updateStatsAndManifest } from "./manifest";
|
|
8
|
-
import { MODERN_JS_SERVER_DIR } from "../constant";
|
|
8
|
+
import { MODERN_JS_SERVER_DIR, PLUGIN_IDENTIFIER } from "../constant";
|
|
9
9
|
const SSR_PLUGIN_IDENTIFIER = "mfPluginSSR";
|
|
10
10
|
const isDev = process.env.NODE_ENV === "development";
|
|
11
11
|
const moduleFederationPlugin = (userConfig = {}) => ({
|
|
@@ -58,7 +58,7 @@ const moduleFederationPlugin = (userConfig = {}) => ({
|
|
|
58
58
|
tools: {
|
|
59
59
|
rspack(config) {
|
|
60
60
|
if (enableSSR) {
|
|
61
|
-
throw new Error(
|
|
61
|
+
throw new Error(`${PLUGIN_IDENTIFIER} not support ssr for rspack bundler yet!`);
|
|
62
62
|
}
|
|
63
63
|
modifyBundlerConfig(config, false);
|
|
64
64
|
},
|
|
@@ -2,7 +2,7 @@ import { encodeName } from "@module-federation/sdk";
|
|
|
2
2
|
import path from "path";
|
|
3
3
|
import os from "os";
|
|
4
4
|
import { bundle } from "@modern-js/node-bundle-require";
|
|
5
|
-
import { LOCALHOST } from "../constant";
|
|
5
|
+
import { LOCALHOST, PLUGIN_IDENTIFIER } from "../constant";
|
|
6
6
|
const defaultPath = path.resolve(process.cwd(), "module-federation.config.ts");
|
|
7
7
|
const getMFConfig = async (userConfig) => {
|
|
8
8
|
const { config, configPath } = userConfig;
|
|
@@ -53,11 +53,10 @@ const replaceRemoteUrl = async (mfConfig) => {
|
|
|
53
53
|
handleRemoteObject(mfConfig.remotes);
|
|
54
54
|
}
|
|
55
55
|
};
|
|
56
|
-
const
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
];
|
|
56
|
+
const patchDTSConfig = (mfConfig, isServer) => {
|
|
57
|
+
if (isServer) {
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
61
60
|
const ModernJSRuntime = "@modern-js/runtime/mf";
|
|
62
61
|
if (mfConfig.dts !== false) {
|
|
63
62
|
var _mfConfig_dts, _mfConfig_dts1;
|
|
@@ -85,6 +84,13 @@ const patchMFConfig = (mfConfig, isServer) => {
|
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
}
|
|
87
|
+
};
|
|
88
|
+
const patchMFConfig = (mfConfig, isServer) => {
|
|
89
|
+
const isDev = process.env.NODE_ENV === "development";
|
|
90
|
+
const runtimePlugins = [
|
|
91
|
+
...mfConfig.runtimePlugins || []
|
|
92
|
+
];
|
|
93
|
+
patchDTSConfig(mfConfig, isServer);
|
|
88
94
|
injectRuntimePlugins(path.resolve(__dirname, "./mfRuntimePlugins/shared-strategy.js"), runtimePlugins);
|
|
89
95
|
if (isDev) {
|
|
90
96
|
injectRuntimePlugins(path.resolve(__dirname, "./mfRuntimePlugins/resolve-entry-ipv4.js"), runtimePlugins);
|
|
@@ -141,7 +147,7 @@ function patchWebpackConfig(options) {
|
|
|
141
147
|
}
|
|
142
148
|
if (!isServer && enableSSR && typeof ((_bundlerConfig_optimization1 = bundlerConfig.optimization) === null || _bundlerConfig_optimization1 === void 0 ? void 0 : _bundlerConfig_optimization1.splitChunks) === "object" && bundlerConfig.optimization.splitChunks.cacheGroups) {
|
|
143
149
|
bundlerConfig.optimization.splitChunks.chunks = "async";
|
|
144
|
-
console.warn(
|
|
150
|
+
console.warn(`${PLUGIN_IDENTIFIER} splitChunks.chunks = async is not allowed with stream SSR mode, it will auto changed to "async"`);
|
|
145
151
|
}
|
|
146
152
|
if (((_bundlerConfig_output = bundlerConfig.output) === null || _bundlerConfig_output === void 0 ? void 0 : _bundlerConfig_output.publicPath) === "auto") {
|
|
147
153
|
var _modernjsConfig_dev, _modernjsConfig_server1;
|
package/dist/types/constant.d.ts
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "0.0.0-next-
|
|
3
|
+
"version": "0.0.0-next-20240625070454",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -43,21 +43,21 @@
|
|
|
43
43
|
"license": "MIT",
|
|
44
44
|
"dependencies": {
|
|
45
45
|
"@swc/helpers": "0.5.3",
|
|
46
|
-
"@modern-js/utils": "^2.
|
|
47
|
-
"@modern-js/node-bundle-require": "^2.
|
|
46
|
+
"@modern-js/utils": "^2.54.2",
|
|
47
|
+
"@modern-js/node-bundle-require": "^2.54.2",
|
|
48
48
|
"node-fetch": "~3.3.0",
|
|
49
49
|
"react-error-boundary": "4.0.13",
|
|
50
|
-
"@module-federation/sdk": "0.0.0-next-
|
|
51
|
-
"@module-federation/enhanced": "0.0.0-next-
|
|
52
|
-
"@module-federation/node": "0.0.0-next-
|
|
50
|
+
"@module-federation/sdk": "0.0.0-next-20240625070454",
|
|
51
|
+
"@module-federation/enhanced": "0.0.0-next-20240625070454",
|
|
52
|
+
"@module-federation/node": "0.0.0-next-20240625070454"
|
|
53
53
|
},
|
|
54
54
|
"devDependencies": {
|
|
55
|
-
"@modern-js/app-tools": "^2.
|
|
56
|
-
"@modern-js/core": "^2.
|
|
57
|
-
"@modern-js/runtime": "^2.
|
|
58
|
-
"@modern-js/module-tools": "^2.
|
|
59
|
-
"@modern-js/tsconfig": "^2.
|
|
60
|
-
"@module-federation/manifest": "0.0.0-next-
|
|
55
|
+
"@modern-js/app-tools": "^2.54.2",
|
|
56
|
+
"@modern-js/core": "^2.54.2",
|
|
57
|
+
"@modern-js/runtime": "^2.54.2",
|
|
58
|
+
"@modern-js/module-tools": "^2.54.2",
|
|
59
|
+
"@modern-js/tsconfig": "^2.54.2",
|
|
60
|
+
"@module-federation/manifest": "0.0.0-next-20240625070454"
|
|
61
61
|
},
|
|
62
62
|
"peerDependencies": {
|
|
63
63
|
"react": ">=17",
|