@module-federation/modern-js-v3 2.0.1 → 2.1.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.
- package/dist/cjs/cli/configPlugin.js +2 -30
- package/dist/cjs/cli/index.js +0 -1
- package/dist/esm/cli/configPlugin.mjs +4 -32
- package/dist/esm/cli/index.mjs +0 -1
- package/dist/esm-node/cli/configPlugin.mjs +4 -32
- package/dist/esm-node/cli/index.mjs +0 -1
- package/dist/types/cli/configPlugin.d.ts +1 -1
- package/dist/types/types/index.d.ts +0 -2
- package/package.json +9 -17
- package/dist/cjs/cli/mfRuntimePlugins/resolve-entry-ipv4.js +0 -80
- package/dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.mjs +0 -58
- package/dist/esm-node/cli/mfRuntimePlugins/resolve-entry-ipv4.mjs +0 -46
- package/dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts +0 -3
|
@@ -91,24 +91,6 @@ var __webpack_exports__ = {};
|
|
|
91
91
|
});
|
|
92
92
|
if (!hasPlugin) runtimePlugins.push(runtimePlugin);
|
|
93
93
|
};
|
|
94
|
-
const replaceRemoteUrl = (mfConfig, remoteIpStrategy)=>{
|
|
95
|
-
if (remoteIpStrategy && 'inherit' === remoteIpStrategy) return;
|
|
96
|
-
if (!mfConfig.remotes) return;
|
|
97
|
-
const ipv4 = (0, external_utils_js_namespaceObject.getIPV4)();
|
|
98
|
-
const handleRemoteObject = (remoteObject)=>{
|
|
99
|
-
Object.keys(remoteObject).forEach((remoteKey)=>{
|
|
100
|
-
const remote = remoteObject[remoteKey];
|
|
101
|
-
if (Array.isArray(remote)) return;
|
|
102
|
-
if ('string' == typeof remote && remote.includes(external_constant_js_namespaceObject.LOCALHOST)) remoteObject[remoteKey] = remote.replace(external_constant_js_namespaceObject.LOCALHOST, ipv4);
|
|
103
|
-
if ('object' == typeof remote && !Array.isArray(remote.external) && remote.external.includes(external_constant_js_namespaceObject.LOCALHOST)) remote.external = remote.external.replace(external_constant_js_namespaceObject.LOCALHOST, ipv4);
|
|
104
|
-
});
|
|
105
|
-
};
|
|
106
|
-
if (Array.isArray(mfConfig.remotes)) mfConfig.remotes.forEach((remoteObject)=>{
|
|
107
|
-
if ('string' == typeof remoteObject) return;
|
|
108
|
-
handleRemoteObject(remoteObject);
|
|
109
|
-
});
|
|
110
|
-
else if ('string' != typeof mfConfig.remotes) handleRemoteObject(mfConfig.remotes);
|
|
111
|
-
};
|
|
112
94
|
const patchDTSConfig = (mfConfig, isServer)=>{
|
|
113
95
|
if (isServer) return;
|
|
114
96
|
const ModernJSRuntime = '@module-federation/modern-js-v3/runtime';
|
|
@@ -135,8 +117,7 @@ var __webpack_exports__ = {};
|
|
|
135
117
|
}
|
|
136
118
|
}
|
|
137
119
|
};
|
|
138
|
-
const patchMFConfig = (mfConfig, isServer
|
|
139
|
-
replaceRemoteUrl(mfConfig, remoteIpStrategy);
|
|
120
|
+
const patchMFConfig = (mfConfig, isServer)=>{
|
|
140
121
|
(0, utils_namespaceObject.addDataFetchExposes)(mfConfig.exposes, isServer);
|
|
141
122
|
if (void 0 === mfConfig.remoteType) mfConfig.remoteType = "script";
|
|
142
123
|
if (!mfConfig.name) throw new Error(`${external_constant_js_namespaceObject.PLUGIN_IDENTIFIER} mfConfig.name can not be empty!`);
|
|
@@ -145,7 +126,6 @@ var __webpack_exports__ = {};
|
|
|
145
126
|
];
|
|
146
127
|
patchDTSConfig(mfConfig, isServer);
|
|
147
128
|
injectRuntimePlugins(require.resolve('@module-federation/modern-js-v3/shared-strategy'), runtimePlugins);
|
|
148
|
-
if (enableSSR && (0, external_utils_js_namespaceObject.isDev)()) injectRuntimePlugins(require.resolve('@module-federation/modern-js-v3/resolve-entry-ipv4'), runtimePlugins);
|
|
149
129
|
if (isServer) {
|
|
150
130
|
injectRuntimePlugins(require.resolve('@module-federation/node/runtimePlugin'), runtimePlugins);
|
|
151
131
|
if ((0, external_utils_js_namespaceObject.isDev)()) injectRuntimePlugins(require.resolve('@module-federation/node/record-dynamic-remote-entry-hash-plugin'), runtimePlugins);
|
|
@@ -262,7 +242,7 @@ var __webpack_exports__ = {};
|
|
|
262
242
|
const isWeb = (0, external_utils_js_namespaceObject.isWebTarget)(target);
|
|
263
243
|
addMyTypes2Ignored(chain, isWeb ? csrConfig : ssrConfig);
|
|
264
244
|
const targetMFConfig = isWeb ? csrConfig : ssrConfig;
|
|
265
|
-
patchMFConfig(targetMFConfig, !isWeb
|
|
245
|
+
patchMFConfig(targetMFConfig, !isWeb);
|
|
266
246
|
patchBundlerConfig({
|
|
267
247
|
chain,
|
|
268
248
|
isServer: !isWeb,
|
|
@@ -282,9 +262,6 @@ var __webpack_exports__ = {};
|
|
|
282
262
|
api.config(()=>{
|
|
283
263
|
var _ref;
|
|
284
264
|
var _modernjsConfig_tools, _userConfig_csrConfig, _modernjsConfig_source, _modernjsConfig_dev;
|
|
285
|
-
const ipv4 = (0, external_utils_js_namespaceObject.getIPV4)();
|
|
286
|
-
if (void 0 === userConfig.remoteIpStrategy) if (enableSSR) userConfig.remoteIpStrategy = 'ipv4';
|
|
287
|
-
else userConfig.remoteIpStrategy = 'inherit';
|
|
288
265
|
const devServerConfig = null == (_modernjsConfig_tools = modernjsConfig.tools) ? void 0 : _modernjsConfig_tools.devServer;
|
|
289
266
|
const corsWarnMsgs = [
|
|
290
267
|
'View https://module-federation.io/guide/troubleshooting/other.html#cors-warn for more details.'
|
|
@@ -298,10 +275,6 @@ var __webpack_exports__ = {};
|
|
|
298
275
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
299
276
|
'Access-Control-Allow-Headers': '*'
|
|
300
277
|
} : void 0;
|
|
301
|
-
const defineConfig = {
|
|
302
|
-
REMOTE_IP_STRATEGY: JSON.stringify(userConfig.remoteIpStrategy)
|
|
303
|
-
};
|
|
304
|
-
if (enableSSR && (0, external_utils_js_namespaceObject.isDev)()) defineConfig['FEDERATION_IPV4'] = JSON.stringify(ipv4);
|
|
305
278
|
return {
|
|
306
279
|
tools: {
|
|
307
280
|
devServer: {
|
|
@@ -314,7 +287,6 @@ var __webpack_exports__ = {};
|
|
|
314
287
|
}
|
|
315
288
|
},
|
|
316
289
|
source: {
|
|
317
|
-
define: defineConfig,
|
|
318
290
|
enableAsyncEntry: null != (_ref = null == (_modernjsConfig_source = modernjsConfig.source) ? void 0 : _modernjsConfig_source.enableAsyncEntry) ? _ref : true
|
|
319
291
|
},
|
|
320
292
|
dev: {
|
package/dist/cjs/cli/index.js
CHANGED
|
@@ -45,7 +45,6 @@ const moduleFederationPlugin = (userConfig = {})=>{
|
|
|
45
45
|
originPluginOptions: {
|
|
46
46
|
...userConfig
|
|
47
47
|
},
|
|
48
|
-
remoteIpStrategy: null == userConfig ? void 0 : userConfig.remoteIpStrategy,
|
|
49
48
|
userConfig: userConfig || {},
|
|
50
49
|
assetFileNames: {},
|
|
51
50
|
fetchServerQuery: null != (_userConfig_fetchServerQuery = userConfig.fetchServerQuery) ? _userConfig_fetchServerQuery : void 0,
|
|
@@ -6,9 +6,9 @@ import { _ as _to_consumable_array__ } from "@swc/helpers/_/_to_consumable_array
|
|
|
6
6
|
import { _ as _type_of__ } from "@swc/helpers/_/_type_of";
|
|
7
7
|
import { _ as _ts_generator__ } from "@swc/helpers/_/_ts_generator";
|
|
8
8
|
import path from "path";
|
|
9
|
-
import {
|
|
9
|
+
import { isDev, isWebTarget, skipByTarget } from "./utils.mjs";
|
|
10
10
|
import { encodeName } from "@module-federation/sdk";
|
|
11
|
-
import {
|
|
11
|
+
import { PLUGIN_IDENTIFIER } from "../constant.mjs";
|
|
12
12
|
import { addDataFetchExposes, autoDeleteSplitChunkCacheGroups } from "@module-federation/rsbuild-plugin/utils";
|
|
13
13
|
import logger from "../logger.mjs";
|
|
14
14
|
var __webpack_modules__ = {
|
|
@@ -70,24 +70,6 @@ var injectRuntimePlugins = function(runtimePlugin, runtimePlugins) {
|
|
|
70
70
|
});
|
|
71
71
|
if (!hasPlugin) runtimePlugins.push(runtimePlugin);
|
|
72
72
|
};
|
|
73
|
-
var replaceRemoteUrl = function(mfConfig, remoteIpStrategy) {
|
|
74
|
-
if (remoteIpStrategy && 'inherit' === remoteIpStrategy) return;
|
|
75
|
-
if (!mfConfig.remotes) return;
|
|
76
|
-
var ipv4 = getIPV4();
|
|
77
|
-
var handleRemoteObject = function(remoteObject) {
|
|
78
|
-
Object.keys(remoteObject).forEach(function(remoteKey) {
|
|
79
|
-
var remote = remoteObject[remoteKey];
|
|
80
|
-
if (Array.isArray(remote)) return;
|
|
81
|
-
if ('string' == typeof remote && remote.includes(LOCALHOST)) remoteObject[remoteKey] = remote.replace(LOCALHOST, ipv4);
|
|
82
|
-
if ((void 0 === remote ? "undefined" : _type_of__(remote)) === 'object' && !Array.isArray(remote.external) && remote.external.includes(LOCALHOST)) remote.external = remote.external.replace(LOCALHOST, ipv4);
|
|
83
|
-
});
|
|
84
|
-
};
|
|
85
|
-
if (Array.isArray(mfConfig.remotes)) mfConfig.remotes.forEach(function(remoteObject) {
|
|
86
|
-
if ('string' == typeof remoteObject) return;
|
|
87
|
-
handleRemoteObject(remoteObject);
|
|
88
|
-
});
|
|
89
|
-
else if ('string' != typeof mfConfig.remotes) handleRemoteObject(mfConfig.remotes);
|
|
90
|
-
};
|
|
91
73
|
var patchDTSConfig = function(mfConfig, isServer) {
|
|
92
74
|
if (isServer) return;
|
|
93
75
|
var ModernJSRuntime = '@module-federation/modern-js-v3/runtime';
|
|
@@ -114,15 +96,13 @@ var patchDTSConfig = function(mfConfig, isServer) {
|
|
|
114
96
|
}
|
|
115
97
|
}
|
|
116
98
|
};
|
|
117
|
-
var patchMFConfig = function(mfConfig, isServer
|
|
118
|
-
replaceRemoteUrl(mfConfig, remoteIpStrategy);
|
|
99
|
+
var patchMFConfig = function(mfConfig, isServer) {
|
|
119
100
|
addDataFetchExposes(mfConfig.exposes, isServer);
|
|
120
101
|
if (void 0 === mfConfig.remoteType) mfConfig.remoteType = "script";
|
|
121
102
|
if (!mfConfig.name) throw new Error("".concat(PLUGIN_IDENTIFIER, " mfConfig.name can not be empty!"));
|
|
122
103
|
var runtimePlugins = _to_consumable_array__(mfConfig.runtimePlugins || []);
|
|
123
104
|
patchDTSConfig(mfConfig, isServer);
|
|
124
105
|
injectRuntimePlugins(require.resolve('@module-federation/modern-js-v3/shared-strategy'), runtimePlugins);
|
|
125
|
-
if (enableSSR && isDev()) injectRuntimePlugins(require.resolve('@module-federation/modern-js-v3/resolve-entry-ipv4'), runtimePlugins);
|
|
126
106
|
if (isServer) {
|
|
127
107
|
injectRuntimePlugins(require.resolve('@module-federation/node/runtimePlugin'), runtimePlugins);
|
|
128
108
|
if (isDev()) injectRuntimePlugins(require.resolve('@module-federation/node/record-dynamic-remote-entry-hash-plugin'), runtimePlugins);
|
|
@@ -246,7 +226,7 @@ var moduleFederationConfigPlugin = function(userConfig) {
|
|
|
246
226
|
var isWeb = isWebTarget(target);
|
|
247
227
|
addMyTypes2Ignored(chain, isWeb ? csrConfig : ssrConfig);
|
|
248
228
|
var targetMFConfig = isWeb ? csrConfig : ssrConfig;
|
|
249
|
-
patchMFConfig(targetMFConfig, !isWeb
|
|
229
|
+
patchMFConfig(targetMFConfig, !isWeb);
|
|
250
230
|
patchBundlerConfig({
|
|
251
231
|
chain: chain,
|
|
252
232
|
isServer: !isWeb,
|
|
@@ -266,9 +246,6 @@ var moduleFederationConfigPlugin = function(userConfig) {
|
|
|
266
246
|
api.config(function() {
|
|
267
247
|
var _ref;
|
|
268
248
|
var _modernjsConfig_tools, _userConfig_csrConfig, _modernjsConfig_source, _modernjsConfig_dev;
|
|
269
|
-
var ipv4 = getIPV4();
|
|
270
|
-
if (void 0 === userConfig.remoteIpStrategy) if (enableSSR) userConfig.remoteIpStrategy = 'ipv4';
|
|
271
|
-
else userConfig.remoteIpStrategy = 'inherit';
|
|
272
249
|
var devServerConfig = null == (_modernjsConfig_tools = modernjsConfig.tools) ? void 0 : _modernjsConfig_tools.devServer;
|
|
273
250
|
var corsWarnMsgs = [
|
|
274
251
|
'View https://module-federation.io/guide/troubleshooting/other.html#cors-warn for more details.'
|
|
@@ -282,10 +259,6 @@ var moduleFederationConfigPlugin = function(userConfig) {
|
|
|
282
259
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
283
260
|
'Access-Control-Allow-Headers': '*'
|
|
284
261
|
} : void 0;
|
|
285
|
-
var defineConfig = {
|
|
286
|
-
REMOTE_IP_STRATEGY: JSON.stringify(userConfig.remoteIpStrategy)
|
|
287
|
-
};
|
|
288
|
-
if (enableSSR && isDev()) defineConfig['FEDERATION_IPV4'] = JSON.stringify(ipv4);
|
|
289
262
|
return {
|
|
290
263
|
tools: {
|
|
291
264
|
devServer: {
|
|
@@ -298,7 +271,6 @@ var moduleFederationConfigPlugin = function(userConfig) {
|
|
|
298
271
|
}
|
|
299
272
|
},
|
|
300
273
|
source: {
|
|
301
|
-
define: defineConfig,
|
|
302
274
|
enableAsyncEntry: null != (_ref = null == (_modernjsConfig_source = modernjsConfig.source) ? void 0 : _modernjsConfig_source.enableAsyncEntry) ? _ref : true
|
|
303
275
|
},
|
|
304
276
|
dev: {
|
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -17,7 +17,6 @@ var moduleFederationPlugin = function() {
|
|
|
17
17
|
assetResources: {},
|
|
18
18
|
distOutputDir: '',
|
|
19
19
|
originPluginOptions: _object_spread__({}, userConfig),
|
|
20
|
-
remoteIpStrategy: null == userConfig ? void 0 : userConfig.remoteIpStrategy,
|
|
21
20
|
userConfig: userConfig || {},
|
|
22
21
|
assetFileNames: {},
|
|
23
22
|
fetchServerQuery: null != (_userConfig_fetchServerQuery = userConfig.fetchServerQuery) ? _userConfig_fetchServerQuery : void 0,
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import * as __rspack_external_jiti from "jiti";
|
|
2
2
|
import path from "path";
|
|
3
|
-
import {
|
|
3
|
+
import { isDev, isWebTarget, skipByTarget } from "./utils.mjs";
|
|
4
4
|
import { encodeName } from "@module-federation/sdk";
|
|
5
|
-
import {
|
|
5
|
+
import { PLUGIN_IDENTIFIER } from "../constant.mjs";
|
|
6
6
|
import { addDataFetchExposes, autoDeleteSplitChunkCacheGroups } from "@module-federation/rsbuild-plugin/utils";
|
|
7
7
|
import logger from "../logger.mjs";
|
|
8
8
|
var __webpack_modules__ = {
|
|
@@ -45,24 +45,6 @@ const injectRuntimePlugins = (runtimePlugin, runtimePlugins)=>{
|
|
|
45
45
|
});
|
|
46
46
|
if (!hasPlugin) runtimePlugins.push(runtimePlugin);
|
|
47
47
|
};
|
|
48
|
-
const replaceRemoteUrl = (mfConfig, remoteIpStrategy)=>{
|
|
49
|
-
if (remoteIpStrategy && 'inherit' === remoteIpStrategy) return;
|
|
50
|
-
if (!mfConfig.remotes) return;
|
|
51
|
-
const ipv4 = getIPV4();
|
|
52
|
-
const handleRemoteObject = (remoteObject)=>{
|
|
53
|
-
Object.keys(remoteObject).forEach((remoteKey)=>{
|
|
54
|
-
const remote = remoteObject[remoteKey];
|
|
55
|
-
if (Array.isArray(remote)) return;
|
|
56
|
-
if ('string' == typeof remote && remote.includes(LOCALHOST)) remoteObject[remoteKey] = remote.replace(LOCALHOST, ipv4);
|
|
57
|
-
if ('object' == typeof remote && !Array.isArray(remote.external) && remote.external.includes(LOCALHOST)) remote.external = remote.external.replace(LOCALHOST, ipv4);
|
|
58
|
-
});
|
|
59
|
-
};
|
|
60
|
-
if (Array.isArray(mfConfig.remotes)) mfConfig.remotes.forEach((remoteObject)=>{
|
|
61
|
-
if ('string' == typeof remoteObject) return;
|
|
62
|
-
handleRemoteObject(remoteObject);
|
|
63
|
-
});
|
|
64
|
-
else if ('string' != typeof mfConfig.remotes) handleRemoteObject(mfConfig.remotes);
|
|
65
|
-
};
|
|
66
48
|
const patchDTSConfig = (mfConfig, isServer)=>{
|
|
67
49
|
if (isServer) return;
|
|
68
50
|
const ModernJSRuntime = '@module-federation/modern-js-v3/runtime';
|
|
@@ -89,8 +71,7 @@ const patchDTSConfig = (mfConfig, isServer)=>{
|
|
|
89
71
|
}
|
|
90
72
|
}
|
|
91
73
|
};
|
|
92
|
-
const patchMFConfig = (mfConfig, isServer
|
|
93
|
-
replaceRemoteUrl(mfConfig, remoteIpStrategy);
|
|
74
|
+
const patchMFConfig = (mfConfig, isServer)=>{
|
|
94
75
|
addDataFetchExposes(mfConfig.exposes, isServer);
|
|
95
76
|
if (void 0 === mfConfig.remoteType) mfConfig.remoteType = "script";
|
|
96
77
|
if (!mfConfig.name) throw new Error(`${PLUGIN_IDENTIFIER} mfConfig.name can not be empty!`);
|
|
@@ -99,7 +80,6 @@ const patchMFConfig = (mfConfig, isServer, remoteIpStrategy, enableSSR)=>{
|
|
|
99
80
|
];
|
|
100
81
|
patchDTSConfig(mfConfig, isServer);
|
|
101
82
|
injectRuntimePlugins(require.resolve('@module-federation/modern-js-v3/shared-strategy'), runtimePlugins);
|
|
102
|
-
if (enableSSR && isDev()) injectRuntimePlugins(require.resolve('@module-federation/modern-js-v3/resolve-entry-ipv4'), runtimePlugins);
|
|
103
83
|
if (isServer) {
|
|
104
84
|
injectRuntimePlugins(require.resolve('@module-federation/node/runtimePlugin'), runtimePlugins);
|
|
105
85
|
if (isDev()) injectRuntimePlugins(require.resolve('@module-federation/node/record-dynamic-remote-entry-hash-plugin'), runtimePlugins);
|
|
@@ -216,7 +196,7 @@ const moduleFederationConfigPlugin = (userConfig)=>({
|
|
|
216
196
|
const isWeb = isWebTarget(target);
|
|
217
197
|
addMyTypes2Ignored(chain, isWeb ? csrConfig : ssrConfig);
|
|
218
198
|
const targetMFConfig = isWeb ? csrConfig : ssrConfig;
|
|
219
|
-
patchMFConfig(targetMFConfig, !isWeb
|
|
199
|
+
patchMFConfig(targetMFConfig, !isWeb);
|
|
220
200
|
patchBundlerConfig({
|
|
221
201
|
chain,
|
|
222
202
|
isServer: !isWeb,
|
|
@@ -236,9 +216,6 @@ const moduleFederationConfigPlugin = (userConfig)=>({
|
|
|
236
216
|
api.config(()=>{
|
|
237
217
|
var _ref;
|
|
238
218
|
var _modernjsConfig_tools, _userConfig_csrConfig, _modernjsConfig_source, _modernjsConfig_dev;
|
|
239
|
-
const ipv4 = getIPV4();
|
|
240
|
-
if (void 0 === userConfig.remoteIpStrategy) if (enableSSR) userConfig.remoteIpStrategy = 'ipv4';
|
|
241
|
-
else userConfig.remoteIpStrategy = 'inherit';
|
|
242
219
|
const devServerConfig = null == (_modernjsConfig_tools = modernjsConfig.tools) ? void 0 : _modernjsConfig_tools.devServer;
|
|
243
220
|
const corsWarnMsgs = [
|
|
244
221
|
'View https://module-federation.io/guide/troubleshooting/other.html#cors-warn for more details.'
|
|
@@ -252,10 +229,6 @@ const moduleFederationConfigPlugin = (userConfig)=>({
|
|
|
252
229
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
253
230
|
'Access-Control-Allow-Headers': '*'
|
|
254
231
|
} : void 0;
|
|
255
|
-
const defineConfig = {
|
|
256
|
-
REMOTE_IP_STRATEGY: JSON.stringify(userConfig.remoteIpStrategy)
|
|
257
|
-
};
|
|
258
|
-
if (enableSSR && isDev()) defineConfig['FEDERATION_IPV4'] = JSON.stringify(ipv4);
|
|
259
232
|
return {
|
|
260
233
|
tools: {
|
|
261
234
|
devServer: {
|
|
@@ -268,7 +241,6 @@ const moduleFederationConfigPlugin = (userConfig)=>({
|
|
|
268
241
|
}
|
|
269
242
|
},
|
|
270
243
|
source: {
|
|
271
|
-
define: defineConfig,
|
|
272
244
|
enableAsyncEntry: null != (_ref = null == (_modernjsConfig_source = modernjsConfig.source) ? void 0 : _modernjsConfig_source.enableAsyncEntry) ? _ref : true
|
|
273
245
|
},
|
|
274
246
|
dev: {
|
|
@@ -15,7 +15,6 @@ const moduleFederationPlugin = (userConfig = {})=>{
|
|
|
15
15
|
originPluginOptions: {
|
|
16
16
|
...userConfig
|
|
17
17
|
},
|
|
18
|
-
remoteIpStrategy: null == userConfig ? void 0 : userConfig.remoteIpStrategy,
|
|
19
18
|
userConfig: userConfig || {},
|
|
20
19
|
assetFileNames: {},
|
|
21
20
|
fetchServerQuery: null != (_userConfig_fetchServerQuery = userConfig.fetchServerQuery) ? _userConfig_fetchServerQuery : void 0,
|
|
@@ -7,7 +7,7 @@ import type { BundlerChainConfig } from '../interfaces/bundler';
|
|
|
7
7
|
export type ConfigType = Rspack.Configuration;
|
|
8
8
|
export declare function setEnv(enableSSR: boolean): void;
|
|
9
9
|
export declare const getMFConfig: (userConfig: PluginOptions) => Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;
|
|
10
|
-
export declare const patchMFConfig: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, isServer: boolean
|
|
10
|
+
export declare const patchMFConfig: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, isServer: boolean) => moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
11
11
|
export declare function addMyTypes2Ignored(chain: BundlerChainConfig, mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions): void;
|
|
12
12
|
export declare function patchBundlerConfig(options: {
|
|
13
13
|
chain: BundlerChainConfig;
|
|
@@ -6,7 +6,6 @@ export interface PluginOptions {
|
|
|
6
6
|
ssr?: {
|
|
7
7
|
distOutputDir?: string;
|
|
8
8
|
} | boolean;
|
|
9
|
-
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
10
9
|
fetchServerQuery?: Record<string, unknown>;
|
|
11
10
|
secondarySharedTreeShaking?: boolean;
|
|
12
11
|
}
|
|
@@ -29,7 +28,6 @@ export interface InternalModernPluginOptions {
|
|
|
29
28
|
browser?: StatsAssetResource;
|
|
30
29
|
node?: StatsAssetResource;
|
|
31
30
|
};
|
|
32
|
-
remoteIpStrategy?: 'ipv4' | 'inherit';
|
|
33
31
|
userConfig?: PluginOptions;
|
|
34
32
|
fetchServerQuery?: Record<string, unknown>;
|
|
35
33
|
secondarySharedTreeShaking?: boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js-v3",
|
|
3
|
-
"version": "2.0
|
|
3
|
+
"version": "2.1.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -63,11 +63,6 @@
|
|
|
63
63
|
"import": "./dist/esm/cli/mfRuntimePlugins/shared-strategy.mjs",
|
|
64
64
|
"require": "./dist/cjs/cli/mfRuntimePlugins/shared-strategy.js"
|
|
65
65
|
},
|
|
66
|
-
"./resolve-entry-ipv4": {
|
|
67
|
-
"types": "./dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts",
|
|
68
|
-
"import": "./dist/esm/cli/mfRuntimePlugins/resolve-entry-ipv4.mjs",
|
|
69
|
-
"require": "./dist/cjs/cli/mfRuntimePlugins/resolve-entry-ipv4.js"
|
|
70
|
-
},
|
|
71
66
|
"./inject-node-fetch": {
|
|
72
67
|
"types": "./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts",
|
|
73
68
|
"import": "./dist/esm/cli/mfRuntimePlugins/inject-node-fetch.mjs",
|
|
@@ -111,9 +106,6 @@
|
|
|
111
106
|
"shared-strategy": [
|
|
112
107
|
"./dist/types/cli/mfRuntimePlugins/shared-strategy.d.ts"
|
|
113
108
|
],
|
|
114
|
-
"resolve-entry-ipv4": [
|
|
115
|
-
"./dist/types/cli/mfRuntimePlugins/resolve-entry-ipv4.d.ts"
|
|
116
|
-
],
|
|
117
109
|
"inject-node-fetch": [
|
|
118
110
|
"./dist/types/cli/mfRuntimePlugins/inject-node-fetch.d.ts"
|
|
119
111
|
],
|
|
@@ -139,13 +131,13 @@
|
|
|
139
131
|
"node-fetch": "~3.3.0",
|
|
140
132
|
"jiti": "2.4.2",
|
|
141
133
|
"react-error-boundary": "4.1.2",
|
|
142
|
-
"@module-federation/rsbuild-plugin": "2.0
|
|
143
|
-
"@module-federation/
|
|
144
|
-
"@module-federation/
|
|
145
|
-
"@module-federation/
|
|
146
|
-
"@module-federation/sdk": "2.0
|
|
147
|
-
"@module-federation/cli": "2.0
|
|
148
|
-
"@module-federation/
|
|
134
|
+
"@module-federation/rsbuild-plugin": "2.1.0",
|
|
135
|
+
"@module-federation/enhanced": "2.1.0",
|
|
136
|
+
"@module-federation/bridge-react": "2.1.0",
|
|
137
|
+
"@module-federation/node": "2.7.33",
|
|
138
|
+
"@module-federation/sdk": "2.1.0",
|
|
139
|
+
"@module-federation/cli": "2.1.0",
|
|
140
|
+
"@module-federation/runtime": "2.1.0"
|
|
149
141
|
},
|
|
150
142
|
"devDependencies": {
|
|
151
143
|
"@rsbuild/plugin-react": "1.4.5",
|
|
@@ -158,7 +150,7 @@
|
|
|
158
150
|
"@modern-js/tsconfig": "3.0.1",
|
|
159
151
|
"@types/react": "^18.3.11",
|
|
160
152
|
"@types/react-dom": "^18.3.0",
|
|
161
|
-
"@module-federation/manifest": "2.0
|
|
153
|
+
"@module-federation/manifest": "2.1.0"
|
|
162
154
|
},
|
|
163
155
|
"peerDependencies": {
|
|
164
156
|
"react": ">=17",
|
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __webpack_require__ = {};
|
|
3
|
-
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
5
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: definition[key]
|
|
8
|
-
});
|
|
9
|
-
};
|
|
10
|
-
})();
|
|
11
|
-
(()=>{
|
|
12
|
-
__webpack_require__.o = (obj, prop)=>Object.prototype.hasOwnProperty.call(obj, prop);
|
|
13
|
-
})();
|
|
14
|
-
(()=>{
|
|
15
|
-
__webpack_require__.r = (exports1)=>{
|
|
16
|
-
if ("u" > typeof Symbol && Symbol.toStringTag) Object.defineProperty(exports1, Symbol.toStringTag, {
|
|
17
|
-
value: 'Module'
|
|
18
|
-
});
|
|
19
|
-
Object.defineProperty(exports1, '__esModule', {
|
|
20
|
-
value: true
|
|
21
|
-
});
|
|
22
|
-
};
|
|
23
|
-
})();
|
|
24
|
-
var __webpack_exports__ = {};
|
|
25
|
-
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
default: ()=>resolve_entry_ipv4
|
|
28
|
-
});
|
|
29
|
-
const external_constant_js_namespaceObject = require("../../constant.js");
|
|
30
|
-
const ipv4 = "u" > typeof FEDERATION_IPV4 ? FEDERATION_IPV4 : '127.0.0.1';
|
|
31
|
-
const remoteIpStrategy = "u" > typeof REMOTE_IP_STRATEGY ? REMOTE_IP_STRATEGY : 'inherit';
|
|
32
|
-
function replaceObjectLocalhost(key, obj) {
|
|
33
|
-
if ('ipv4' !== remoteIpStrategy) return;
|
|
34
|
-
if (!(key in obj)) return;
|
|
35
|
-
const remote = obj[key];
|
|
36
|
-
if (remote && 'string' == typeof remote && remote.includes(external_constant_js_namespaceObject.LOCALHOST)) obj[key] = replaceLocalhost(remote);
|
|
37
|
-
}
|
|
38
|
-
function replaceLocalhost(url) {
|
|
39
|
-
return url.replace(external_constant_js_namespaceObject.LOCALHOST, ipv4);
|
|
40
|
-
}
|
|
41
|
-
const resolveEntryIpv4Plugin = ()=>({
|
|
42
|
-
name: 'resolve-entry-ipv4',
|
|
43
|
-
beforeRegisterRemote (args) {
|
|
44
|
-
const { remote } = args;
|
|
45
|
-
replaceObjectLocalhost('entry', remote);
|
|
46
|
-
return args;
|
|
47
|
-
},
|
|
48
|
-
async afterResolve (args) {
|
|
49
|
-
const { remoteInfo } = args;
|
|
50
|
-
replaceObjectLocalhost('entry', remoteInfo);
|
|
51
|
-
return args;
|
|
52
|
-
},
|
|
53
|
-
beforeLoadRemoteSnapshot (args) {
|
|
54
|
-
const { moduleInfo } = args;
|
|
55
|
-
if ('entry' in moduleInfo) {
|
|
56
|
-
replaceObjectLocalhost('entry', moduleInfo);
|
|
57
|
-
return args;
|
|
58
|
-
}
|
|
59
|
-
if ('version' in moduleInfo) replaceObjectLocalhost('version', moduleInfo);
|
|
60
|
-
return args;
|
|
61
|
-
},
|
|
62
|
-
loadRemoteSnapshot (args) {
|
|
63
|
-
const { remoteSnapshot } = args;
|
|
64
|
-
if ('publicPath' in remoteSnapshot) replaceObjectLocalhost('publicPath', remoteSnapshot);
|
|
65
|
-
if ('getPublicPath' in remoteSnapshot) replaceObjectLocalhost('getPublicPath', remoteSnapshot);
|
|
66
|
-
if (remoteSnapshot.remotesInfo) Object.keys(remoteSnapshot.remotesInfo).forEach((key)=>{
|
|
67
|
-
const remoteInfo = remoteSnapshot.remotesInfo[key];
|
|
68
|
-
replaceObjectLocalhost('matchedVersion', remoteInfo);
|
|
69
|
-
});
|
|
70
|
-
return args;
|
|
71
|
-
}
|
|
72
|
-
});
|
|
73
|
-
const resolve_entry_ipv4 = resolveEntryIpv4Plugin;
|
|
74
|
-
exports["default"] = __webpack_exports__["default"];
|
|
75
|
-
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
76
|
-
"default"
|
|
77
|
-
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
|
78
|
-
Object.defineProperty(exports, '__esModule', {
|
|
79
|
-
value: true
|
|
80
|
-
});
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
import { _ } from "@swc/helpers/_/_async_to_generator";
|
|
2
|
-
import { _ as _ts_generator__ } from "@swc/helpers/_/_ts_generator";
|
|
3
|
-
import { LOCALHOST } from "../../constant.mjs";
|
|
4
|
-
var ipv4 = "u" > typeof FEDERATION_IPV4 ? FEDERATION_IPV4 : '127.0.0.1';
|
|
5
|
-
var remoteIpStrategy = "u" > typeof REMOTE_IP_STRATEGY ? REMOTE_IP_STRATEGY : 'inherit';
|
|
6
|
-
function replaceObjectLocalhost(key, obj) {
|
|
7
|
-
if ('ipv4' !== remoteIpStrategy) return;
|
|
8
|
-
if (!(key in obj)) return;
|
|
9
|
-
var remote = obj[key];
|
|
10
|
-
if (remote && 'string' == typeof remote && remote.includes(LOCALHOST)) obj[key] = replaceLocalhost(remote);
|
|
11
|
-
}
|
|
12
|
-
function replaceLocalhost(url) {
|
|
13
|
-
return url.replace(LOCALHOST, ipv4);
|
|
14
|
-
}
|
|
15
|
-
var resolveEntryIpv4Plugin = function() {
|
|
16
|
-
return {
|
|
17
|
-
name: 'resolve-entry-ipv4',
|
|
18
|
-
beforeRegisterRemote: function(args) {
|
|
19
|
-
var remote = args.remote;
|
|
20
|
-
replaceObjectLocalhost('entry', remote);
|
|
21
|
-
return args;
|
|
22
|
-
},
|
|
23
|
-
afterResolve: function(args) {
|
|
24
|
-
return _(function() {
|
|
25
|
-
var remoteInfo;
|
|
26
|
-
return _ts_generator__(this, function(_state) {
|
|
27
|
-
remoteInfo = args.remoteInfo;
|
|
28
|
-
replaceObjectLocalhost('entry', remoteInfo);
|
|
29
|
-
return [
|
|
30
|
-
2,
|
|
31
|
-
args
|
|
32
|
-
];
|
|
33
|
-
});
|
|
34
|
-
})();
|
|
35
|
-
},
|
|
36
|
-
beforeLoadRemoteSnapshot: function(args) {
|
|
37
|
-
var moduleInfo = args.moduleInfo;
|
|
38
|
-
if ('entry' in moduleInfo) {
|
|
39
|
-
replaceObjectLocalhost('entry', moduleInfo);
|
|
40
|
-
return args;
|
|
41
|
-
}
|
|
42
|
-
if ('version' in moduleInfo) replaceObjectLocalhost('version', moduleInfo);
|
|
43
|
-
return args;
|
|
44
|
-
},
|
|
45
|
-
loadRemoteSnapshot: function(args) {
|
|
46
|
-
var remoteSnapshot = args.remoteSnapshot;
|
|
47
|
-
if ('publicPath' in remoteSnapshot) replaceObjectLocalhost('publicPath', remoteSnapshot);
|
|
48
|
-
if ('getPublicPath' in remoteSnapshot) replaceObjectLocalhost('getPublicPath', remoteSnapshot);
|
|
49
|
-
if (remoteSnapshot.remotesInfo) Object.keys(remoteSnapshot.remotesInfo).forEach(function(key) {
|
|
50
|
-
var remoteInfo = remoteSnapshot.remotesInfo[key];
|
|
51
|
-
replaceObjectLocalhost('matchedVersion', remoteInfo);
|
|
52
|
-
});
|
|
53
|
-
return args;
|
|
54
|
-
}
|
|
55
|
-
};
|
|
56
|
-
};
|
|
57
|
-
var resolve_entry_ipv4 = resolveEntryIpv4Plugin;
|
|
58
|
-
export { resolve_entry_ipv4 as default };
|
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { LOCALHOST } from "../../constant.mjs";
|
|
2
|
-
const ipv4 = "u" > typeof FEDERATION_IPV4 ? FEDERATION_IPV4 : '127.0.0.1';
|
|
3
|
-
const remoteIpStrategy = "u" > typeof REMOTE_IP_STRATEGY ? REMOTE_IP_STRATEGY : 'inherit';
|
|
4
|
-
function replaceObjectLocalhost(key, obj) {
|
|
5
|
-
if ('ipv4' !== remoteIpStrategy) return;
|
|
6
|
-
if (!(key in obj)) return;
|
|
7
|
-
const remote = obj[key];
|
|
8
|
-
if (remote && 'string' == typeof remote && remote.includes(LOCALHOST)) obj[key] = replaceLocalhost(remote);
|
|
9
|
-
}
|
|
10
|
-
function replaceLocalhost(url) {
|
|
11
|
-
return url.replace(LOCALHOST, ipv4);
|
|
12
|
-
}
|
|
13
|
-
const resolveEntryIpv4Plugin = ()=>({
|
|
14
|
-
name: 'resolve-entry-ipv4',
|
|
15
|
-
beforeRegisterRemote (args) {
|
|
16
|
-
const { remote } = args;
|
|
17
|
-
replaceObjectLocalhost('entry', remote);
|
|
18
|
-
return args;
|
|
19
|
-
},
|
|
20
|
-
async afterResolve (args) {
|
|
21
|
-
const { remoteInfo } = args;
|
|
22
|
-
replaceObjectLocalhost('entry', remoteInfo);
|
|
23
|
-
return args;
|
|
24
|
-
},
|
|
25
|
-
beforeLoadRemoteSnapshot (args) {
|
|
26
|
-
const { moduleInfo } = args;
|
|
27
|
-
if ('entry' in moduleInfo) {
|
|
28
|
-
replaceObjectLocalhost('entry', moduleInfo);
|
|
29
|
-
return args;
|
|
30
|
-
}
|
|
31
|
-
if ('version' in moduleInfo) replaceObjectLocalhost('version', moduleInfo);
|
|
32
|
-
return args;
|
|
33
|
-
},
|
|
34
|
-
loadRemoteSnapshot (args) {
|
|
35
|
-
const { remoteSnapshot } = args;
|
|
36
|
-
if ('publicPath' in remoteSnapshot) replaceObjectLocalhost('publicPath', remoteSnapshot);
|
|
37
|
-
if ('getPublicPath' in remoteSnapshot) replaceObjectLocalhost('getPublicPath', remoteSnapshot);
|
|
38
|
-
if (remoteSnapshot.remotesInfo) Object.keys(remoteSnapshot.remotesInfo).forEach((key)=>{
|
|
39
|
-
const remoteInfo = remoteSnapshot.remotesInfo[key];
|
|
40
|
-
replaceObjectLocalhost('matchedVersion', remoteInfo);
|
|
41
|
-
});
|
|
42
|
-
return args;
|
|
43
|
-
}
|
|
44
|
-
});
|
|
45
|
-
const resolve_entry_ipv4 = resolveEntryIpv4Plugin;
|
|
46
|
-
export { resolve_entry_ipv4 as default };
|