@module-federation/modern-js 2.2.2 → 2.3.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 +1 -1
- package/dist/esm/cli/configPlugin.mjs +24 -24
- package/dist/esm/cli/index.mjs +3 -3
- package/dist/esm/cli/mfRuntimePlugins/inject-node-fetch.mjs +2 -2
- package/dist/esm/cli/mfRuntimePlugins/shared-strategy.mjs +2 -2
- package/dist/esm/cli/server/data-fetch-server-plugin.mjs +2 -2
- package/dist/esm/cli/ssrPlugin.mjs +5 -5
- package/dist/esm/cli/utils.mjs +6 -6
- package/dist/esm/server/index.mjs +3 -3
- package/dist/esm/server/staticMiddleware.mjs +5 -5
- package/dist/esm/ssr-runtime/devPlugin.mjs +2 -2
- package/dist/esm/ssr-runtime/injectDataFetchFunctionPlugin.mjs +2 -2
- package/dist/esm-node/cli/configPlugin.mjs +1 -1
- package/dist/types/cli/configPlugin.d.ts +0 -7
- package/package.json +9 -9
|
@@ -77,7 +77,7 @@ var __webpack_exports__ = {};
|
|
|
77
77
|
if (parentDir === packageRoot) throw new Error(`Unable to resolve package root for ${packageName} from ${packageEntry}`);
|
|
78
78
|
packageRoot = parentDir;
|
|
79
79
|
}
|
|
80
|
-
return require.resolve(external_path_default().join(packageRoot, 'true' === process.env
|
|
80
|
+
return require.resolve(external_path_default().join(packageRoot, 'true' === process.env['IS_ESM_BUILD'] ? esmRelativePath : cjsRelativePath));
|
|
81
81
|
};
|
|
82
82
|
const resolveSharedStrategyPlugin = ()=>resolvePackageFile('@module-federation/modern-js', 'dist/esm/cli/mfRuntimePlugins/shared-strategy.mjs', 'dist/cjs/cli/mfRuntimePlugins/shared-strategy.js');
|
|
83
83
|
const resolveInjectNodeFetchPlugin = ()=>resolvePackageFile('@module-federation/modern-js', 'dist/esm/cli/mfRuntimePlugins/inject-node-fetch.mjs', 'dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js');
|
|
@@ -28,7 +28,7 @@ function __webpack_require__(moduleId) {
|
|
|
28
28
|
return module.exports;
|
|
29
29
|
}
|
|
30
30
|
var defaultPath = path.resolve(process.cwd(), 'module-federation.config.ts');
|
|
31
|
-
var
|
|
31
|
+
var configPlugin_resolvePackageFile = function(packageName, esmRelativePath, cjsRelativePath) {
|
|
32
32
|
var packageEntry = require.resolve(packageName);
|
|
33
33
|
var packageRoot = path.dirname(packageEntry);
|
|
34
34
|
while(!fs.existsSync(path.join(packageRoot, 'package.json'))){
|
|
@@ -36,24 +36,24 @@ var resolvePackageFile = function(packageName, esmRelativePath, cjsRelativePath)
|
|
|
36
36
|
if (parentDir === packageRoot) throw new Error("Unable to resolve package root for ".concat(packageName, " from ").concat(packageEntry));
|
|
37
37
|
packageRoot = parentDir;
|
|
38
38
|
}
|
|
39
|
-
return require.resolve(path.join(packageRoot, 'true' === process.env
|
|
39
|
+
return require.resolve(path.join(packageRoot, 'true' === process.env['IS_ESM_BUILD'] ? esmRelativePath : cjsRelativePath));
|
|
40
40
|
};
|
|
41
|
-
var
|
|
42
|
-
return
|
|
41
|
+
var configPlugin_resolveSharedStrategyPlugin = function() {
|
|
42
|
+
return configPlugin_resolvePackageFile('@module-federation/modern-js', 'dist/esm/cli/mfRuntimePlugins/shared-strategy.mjs', 'dist/cjs/cli/mfRuntimePlugins/shared-strategy.js');
|
|
43
43
|
};
|
|
44
|
-
var
|
|
45
|
-
return
|
|
44
|
+
var configPlugin_resolveInjectNodeFetchPlugin = function() {
|
|
45
|
+
return configPlugin_resolvePackageFile('@module-federation/modern-js', 'dist/esm/cli/mfRuntimePlugins/inject-node-fetch.mjs', 'dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js');
|
|
46
46
|
};
|
|
47
|
-
var
|
|
48
|
-
return
|
|
47
|
+
var configPlugin_resolveNodeRuntimePlugin = function() {
|
|
48
|
+
return configPlugin_resolvePackageFile('@module-federation/node', 'dist/src/runtimePlugin.mjs', 'dist/src/runtimePlugin.js');
|
|
49
49
|
};
|
|
50
|
-
var
|
|
51
|
-
return
|
|
50
|
+
var configPlugin_resolveNodeRecordRemoteHashPlugin = function() {
|
|
51
|
+
return configPlugin_resolvePackageFile('@module-federation/node', 'dist/src/recordDynamicRemoteEntryHashPlugin.mjs', 'dist/src/recordDynamicRemoteEntryHashPlugin.js');
|
|
52
52
|
};
|
|
53
53
|
function setEnv(enableSSR) {
|
|
54
54
|
if (enableSSR) process.env['MF_SSR_PRJ'] = 'true';
|
|
55
55
|
}
|
|
56
|
-
var
|
|
56
|
+
var configPlugin_getMFConfig = function(userConfig) {
|
|
57
57
|
return _(function() {
|
|
58
58
|
var config, configPath, mfConfigPath, createJiti, jit, configModule, resolvedConfig;
|
|
59
59
|
return _ts_generator__(this, function(_state) {
|
|
@@ -84,7 +84,7 @@ var getMFConfig = function(userConfig) {
|
|
|
84
84
|
});
|
|
85
85
|
})();
|
|
86
86
|
};
|
|
87
|
-
var
|
|
87
|
+
var configPlugin_injectRuntimePlugins = function(runtimePlugin, runtimePlugins) {
|
|
88
88
|
var pluginName = 'string' == typeof runtimePlugin ? runtimePlugin : runtimePlugin[0];
|
|
89
89
|
var hasPlugin = runtimePlugins.some(function(existingPlugin) {
|
|
90
90
|
if ('string' == typeof existingPlugin) return existingPlugin === pluginName;
|
|
@@ -92,7 +92,7 @@ var injectRuntimePlugins = function(runtimePlugin, runtimePlugins) {
|
|
|
92
92
|
});
|
|
93
93
|
if (!hasPlugin) runtimePlugins.push(runtimePlugin);
|
|
94
94
|
};
|
|
95
|
-
var
|
|
95
|
+
var configPlugin_patchDTSConfig = function(mfConfig, isServer) {
|
|
96
96
|
if (isServer) return;
|
|
97
97
|
var ModernJSRuntime = '@module-federation/modern-js/runtime';
|
|
98
98
|
if (false !== mfConfig.dts) {
|
|
@@ -118,17 +118,17 @@ var patchDTSConfig = function(mfConfig, isServer) {
|
|
|
118
118
|
}
|
|
119
119
|
}
|
|
120
120
|
};
|
|
121
|
-
var
|
|
121
|
+
var configPlugin_patchMFConfig = function(mfConfig, isServer) {
|
|
122
122
|
addDataFetchExposes(mfConfig.exposes, isServer);
|
|
123
123
|
if (void 0 === mfConfig.remoteType) mfConfig.remoteType = "script";
|
|
124
124
|
if (!mfConfig.name) throw new Error("".concat(PLUGIN_IDENTIFIER, " mfConfig.name can not be empty!"));
|
|
125
125
|
var runtimePlugins = _to_consumable_array__(mfConfig.runtimePlugins || []);
|
|
126
|
-
|
|
127
|
-
|
|
126
|
+
configPlugin_patchDTSConfig(mfConfig, isServer);
|
|
127
|
+
configPlugin_injectRuntimePlugins(configPlugin_resolveSharedStrategyPlugin(), runtimePlugins);
|
|
128
128
|
if (isServer) {
|
|
129
|
-
|
|
130
|
-
if (isDev())
|
|
131
|
-
|
|
129
|
+
configPlugin_injectRuntimePlugins(configPlugin_resolveNodeRuntimePlugin(), runtimePlugins);
|
|
130
|
+
if (isDev()) configPlugin_injectRuntimePlugins(configPlugin_resolveNodeRecordRemoteHashPlugin(), runtimePlugins);
|
|
131
|
+
configPlugin_injectRuntimePlugins(configPlugin_resolveInjectNodeFetchPlugin(), runtimePlugins);
|
|
132
132
|
if (mfConfig.library) {
|
|
133
133
|
if (!mfConfig.library.type) mfConfig.library.type = 'commonjs-module';
|
|
134
134
|
if (!mfConfig.library.name) mfConfig.library.name = mfConfig.name;
|
|
@@ -215,7 +215,7 @@ function patchBundlerConfig(options) {
|
|
|
215
215
|
if (isDev() && enableSSR && !isServer) chain.resolve.fallback.set('crypto', false).set('stream', false).set('vm', false);
|
|
216
216
|
if ((null == (_modernjsConfig_deploy = modernjsConfig.deploy) ? void 0 : _modernjsConfig_deploy.microFrontend) && Object.keys(mfConfig.exposes || {}).length) chain.optimization.usedExports(false);
|
|
217
217
|
}
|
|
218
|
-
var
|
|
218
|
+
var configPlugin_moduleFederationConfigPlugin = function(userConfig) {
|
|
219
219
|
return {
|
|
220
220
|
name: '@modern-js/plugin-module-federation-config',
|
|
221
221
|
pre: [
|
|
@@ -233,7 +233,7 @@ var moduleFederationConfigPlugin = function(userConfig) {
|
|
|
233
233
|
modernjsConfig = api.getConfig();
|
|
234
234
|
return [
|
|
235
235
|
4,
|
|
236
|
-
|
|
236
|
+
configPlugin_getMFConfig(userConfig.originPluginOptions)
|
|
237
237
|
];
|
|
238
238
|
case 1:
|
|
239
239
|
mfConfig = _state.sent();
|
|
@@ -250,7 +250,7 @@ var moduleFederationConfigPlugin = function(userConfig) {
|
|
|
250
250
|
var isWeb = isWebTarget(target);
|
|
251
251
|
addMyTypes2Ignored(chain, isWeb ? csrConfig : ssrConfig);
|
|
252
252
|
var targetMFConfig = isWeb ? csrConfig : ssrConfig;
|
|
253
|
-
|
|
253
|
+
configPlugin_patchMFConfig(targetMFConfig, !isWeb);
|
|
254
254
|
if ('rspack' === bundlerType && (null == (_modernjsConfig_source = modernjsConfig.source) ? void 0 : _modernjsConfig_source.enableAsyncEntry) !== true && (null == (_targetMFConfig_experiments = targetMFConfig.experiments) ? void 0 : _targetMFConfig_experiments.asyncStartup) !== false) {
|
|
255
255
|
var _targetMFConfig;
|
|
256
256
|
(_targetMFConfig = targetMFConfig).experiments || (_targetMFConfig.experiments = {});
|
|
@@ -317,5 +317,5 @@ var moduleFederationConfigPlugin = function(userConfig) {
|
|
|
317
317
|
}
|
|
318
318
|
};
|
|
319
319
|
};
|
|
320
|
-
var configPlugin =
|
|
321
|
-
export { addMyTypes2Ignored, configPlugin as default, getMFConfig, isWebTarget, moduleFederationConfigPlugin, patchBundlerConfig, patchMFConfig, setEnv, skipByTarget };
|
|
320
|
+
var configPlugin = configPlugin_moduleFederationConfigPlugin;
|
|
321
|
+
export { addMyTypes2Ignored, configPlugin as default, configPlugin_getMFConfig as getMFConfig, isWebTarget, configPlugin_moduleFederationConfigPlugin as moduleFederationConfigPlugin, patchBundlerConfig, configPlugin_patchMFConfig as patchMFConfig, setEnv, skipByTarget };
|
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -7,7 +7,7 @@ import { ModuleFederationPlugin as rspack_ModuleFederationPlugin, TreeShakingSha
|
|
|
7
7
|
import { moduleFederationConfigPlugin } from "./configPlugin.mjs";
|
|
8
8
|
import { moduleFederationSSRPlugin } from "./ssrPlugin.mjs";
|
|
9
9
|
import { isWebTarget } from "./utils.mjs";
|
|
10
|
-
var
|
|
10
|
+
var cli_moduleFederationPlugin = function() {
|
|
11
11
|
var userConfig = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
12
12
|
var _userConfig_fetchServerQuery, _userConfig_secondarySharedTreeShaking;
|
|
13
13
|
var internalModernPluginOptions = {
|
|
@@ -87,5 +87,5 @@ var moduleFederationPlugin = function() {
|
|
|
87
87
|
]
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
|
-
var cli =
|
|
91
|
-
export { createModuleFederationConfig, cli as default, moduleFederationPlugin };
|
|
90
|
+
var cli = cli_moduleFederationPlugin;
|
|
91
|
+
export { createModuleFederationConfig, cli as default, cli_moduleFederationPlugin as moduleFederationPlugin };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import node_fetch from "node-fetch";
|
|
2
|
-
var
|
|
2
|
+
var inject_node_fetch_injectNodeFetchPlugin = function() {
|
|
3
3
|
return {
|
|
4
4
|
name: 'inject-node-fetch-plugin',
|
|
5
5
|
beforeInit: function(args) {
|
|
@@ -8,5 +8,5 @@ var injectNodeFetchPlugin = function() {
|
|
|
8
8
|
}
|
|
9
9
|
};
|
|
10
10
|
};
|
|
11
|
-
var inject_node_fetch =
|
|
11
|
+
var inject_node_fetch = inject_node_fetch_injectNodeFetchPlugin;
|
|
12
12
|
export { inject_node_fetch as default };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var
|
|
1
|
+
var shared_strategy_sharedStrategy = function() {
|
|
2
2
|
return {
|
|
3
3
|
name: 'shared-strategy-plugin',
|
|
4
4
|
beforeInit: function(args) {
|
|
@@ -17,5 +17,5 @@ var sharedStrategy = function() {
|
|
|
17
17
|
}
|
|
18
18
|
};
|
|
19
19
|
};
|
|
20
|
-
var shared_strategy =
|
|
20
|
+
var shared_strategy = shared_strategy_sharedStrategy;
|
|
21
21
|
export { shared_strategy as default };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import data_fetch_server_middleware from "@module-federation/bridge-react/data-fetch-server-middleware";
|
|
2
|
-
var
|
|
2
|
+
var data_fetch_server_plugin_dataFetchServePlugin = function() {
|
|
3
3
|
return {
|
|
4
4
|
name: 'mf-data-fetch-server-plugin',
|
|
5
5
|
setup: function(api) {
|
|
@@ -13,5 +13,5 @@ var dataFetchServePlugin = function() {
|
|
|
13
13
|
}
|
|
14
14
|
};
|
|
15
15
|
};
|
|
16
|
-
var data_fetch_server_plugin =
|
|
16
|
+
var data_fetch_server_plugin = data_fetch_server_plugin_dataFetchServePlugin;
|
|
17
17
|
export { data_fetch_server_plugin as default };
|
|
@@ -36,7 +36,7 @@ function getManifestAssetFileNames(manifestOption) {
|
|
|
36
36
|
manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName)
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
|
-
var
|
|
39
|
+
var ssrPlugin_mfSSRRsbuildPlugin = function(pluginOptions) {
|
|
40
40
|
return {
|
|
41
41
|
name: '@modern-js/plugin-mf-post-config',
|
|
42
42
|
pre: [
|
|
@@ -122,7 +122,7 @@ var mfSSRRsbuildPlugin = function(pluginOptions) {
|
|
|
122
122
|
}
|
|
123
123
|
};
|
|
124
124
|
};
|
|
125
|
-
var
|
|
125
|
+
var ssrPlugin_moduleFederationSSRPlugin = function(pluginOptions) {
|
|
126
126
|
return {
|
|
127
127
|
name: '@modern-js/plugin-module-federation-ssr',
|
|
128
128
|
pre: [
|
|
@@ -210,7 +210,7 @@ var moduleFederationSSRPlugin = function(pluginOptions) {
|
|
|
210
210
|
api.config(function() {
|
|
211
211
|
return {
|
|
212
212
|
builderPlugins: [
|
|
213
|
-
|
|
213
|
+
ssrPlugin_mfSSRRsbuildPlugin(pluginOptions)
|
|
214
214
|
],
|
|
215
215
|
tools: {
|
|
216
216
|
devServer: {
|
|
@@ -262,5 +262,5 @@ var moduleFederationSSRPlugin = function(pluginOptions) {
|
|
|
262
262
|
}
|
|
263
263
|
};
|
|
264
264
|
};
|
|
265
|
-
var ssrPlugin =
|
|
266
|
-
export { CHAIN_MF_PLUGIN_ID, ssrPlugin as default, moduleFederationSSRPlugin, setEnv };
|
|
265
|
+
var ssrPlugin = ssrPlugin_moduleFederationSSRPlugin;
|
|
266
|
+
export { CHAIN_MF_PLUGIN_ID, ssrPlugin as default, ssrPlugin_moduleFederationSSRPlugin as moduleFederationSSRPlugin, setEnv };
|
package/dist/esm/cli/utils.mjs
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import os from "os";
|
|
2
2
|
var localIpv4 = '127.0.0.1';
|
|
3
|
-
var
|
|
3
|
+
var utils_getIpv4Interfaces = function() {
|
|
4
4
|
try {
|
|
5
5
|
var interfaces = os.networkInterfaces();
|
|
6
6
|
var ipv4Interfaces = [];
|
|
@@ -15,20 +15,20 @@ var getIpv4Interfaces = function() {
|
|
|
15
15
|
return [];
|
|
16
16
|
}
|
|
17
17
|
};
|
|
18
|
-
var
|
|
19
|
-
var ipv4Interfaces =
|
|
18
|
+
var utils_getIPV4 = function() {
|
|
19
|
+
var ipv4Interfaces = utils_getIpv4Interfaces();
|
|
20
20
|
var ipv4Interface = ipv4Interfaces[0] || {
|
|
21
21
|
address: localIpv4
|
|
22
22
|
};
|
|
23
23
|
return ipv4Interface.address;
|
|
24
24
|
};
|
|
25
|
-
var
|
|
25
|
+
var utils_isWebTarget = function(target) {
|
|
26
26
|
var WEB_TARGET = 'web';
|
|
27
27
|
if (Array.isArray(target)) return target.includes(WEB_TARGET);
|
|
28
28
|
if ('string' == typeof target) return target === WEB_TARGET;
|
|
29
29
|
return false;
|
|
30
30
|
};
|
|
31
|
-
var
|
|
31
|
+
var utils_skipByTarget = function(target) {
|
|
32
32
|
var IGNORE_TARGET = 'webworker';
|
|
33
33
|
if (Array.isArray(target)) return target.includes(IGNORE_TARGET);
|
|
34
34
|
if ('string' == typeof target) return target === IGNORE_TARGET;
|
|
@@ -37,4 +37,4 @@ var skipByTarget = function(target) {
|
|
|
37
37
|
function isDev() {
|
|
38
38
|
return 'development' === process.env.NODE_ENV;
|
|
39
39
|
}
|
|
40
|
-
export { getIPV4, isDev, isWebTarget, skipByTarget };
|
|
40
|
+
export { utils_getIPV4 as getIPV4, isDev, utils_isWebTarget as isWebTarget, utils_skipByTarget as skipByTarget };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { createCorsMiddleware, createStaticMiddleware } from "./staticMiddleware.mjs";
|
|
2
|
-
var
|
|
2
|
+
var server_staticServePlugin = function() {
|
|
3
3
|
return {
|
|
4
4
|
name: '@modern-js/module-federation/server',
|
|
5
5
|
setup: function(api) {
|
|
@@ -32,5 +32,5 @@ var staticServePlugin = function() {
|
|
|
32
32
|
}
|
|
33
33
|
};
|
|
34
34
|
};
|
|
35
|
-
var server =
|
|
36
|
-
export { server as default, staticServePlugin };
|
|
35
|
+
var server = server_staticServePlugin;
|
|
36
|
+
export { server as default, server_staticServePlugin as staticServePlugin };
|
|
@@ -4,7 +4,7 @@ import fs_extra from "fs-extra";
|
|
|
4
4
|
import path from "path";
|
|
5
5
|
import { fileCache } from "./fileCache.mjs";
|
|
6
6
|
var bundlesAssetPrefix = '/bundles';
|
|
7
|
-
var
|
|
7
|
+
var staticMiddleware_removeHost = function(url) {
|
|
8
8
|
try {
|
|
9
9
|
var hasProtocol = url.includes('://');
|
|
10
10
|
var hasDomain = hasProtocol || url.startsWith('//');
|
|
@@ -14,7 +14,7 @@ var removeHost = function(url) {
|
|
|
14
14
|
return url;
|
|
15
15
|
}
|
|
16
16
|
};
|
|
17
|
-
var
|
|
17
|
+
var staticMiddleware_createStaticMiddleware = function(options) {
|
|
18
18
|
var assetPrefix = options.assetPrefix, pwd = options.pwd;
|
|
19
19
|
return function(c, next) {
|
|
20
20
|
return _(function() {
|
|
@@ -27,7 +27,7 @@ var createStaticMiddleware = function(options) {
|
|
|
27
27
|
2,
|
|
28
28
|
next()
|
|
29
29
|
];
|
|
30
|
-
prefixWithoutHost =
|
|
30
|
+
prefixWithoutHost = staticMiddleware_removeHost(assetPrefix);
|
|
31
31
|
prefixWithBundle = path.join(prefixWithoutHost, bundlesAssetPrefix);
|
|
32
32
|
if (!pathname.startsWith(prefixWithBundle)) return [
|
|
33
33
|
2,
|
|
@@ -65,7 +65,7 @@ var createStaticMiddleware = function(options) {
|
|
|
65
65
|
})();
|
|
66
66
|
};
|
|
67
67
|
};
|
|
68
|
-
var
|
|
68
|
+
var staticMiddleware_createCorsMiddleware = function() {
|
|
69
69
|
return function(c, next) {
|
|
70
70
|
return _(function() {
|
|
71
71
|
var pathname;
|
|
@@ -84,4 +84,4 @@ var createCorsMiddleware = function() {
|
|
|
84
84
|
})();
|
|
85
85
|
};
|
|
86
86
|
};
|
|
87
|
-
export { createCorsMiddleware, createStaticMiddleware };
|
|
87
|
+
export { staticMiddleware_createCorsMiddleware as createCorsMiddleware, staticMiddleware_createStaticMiddleware as createStaticMiddleware };
|
|
@@ -4,7 +4,7 @@ import { _ as _ts_generator__ } from "@swc/helpers/_/_ts_generator";
|
|
|
4
4
|
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
5
5
|
import { SSRLiveReload } from "./SSRLiveReload.mjs";
|
|
6
6
|
import { flushDataFetch } from "@module-federation/bridge-react/lazy-utils";
|
|
7
|
-
var
|
|
7
|
+
var devPlugin_mfSSRDevPlugin = function() {
|
|
8
8
|
return {
|
|
9
9
|
name: '@module-federation/modern-js',
|
|
10
10
|
setup: function(api) {
|
|
@@ -67,4 +67,4 @@ var mfSSRDevPlugin = function() {
|
|
|
67
67
|
}
|
|
68
68
|
};
|
|
69
69
|
};
|
|
70
|
-
export { mfSSRDevPlugin };
|
|
70
|
+
export { devPlugin_mfSSRDevPlugin as mfSSRDevPlugin };
|
|
@@ -2,7 +2,7 @@ import { _ } from "@swc/helpers/_/_async_to_generator";
|
|
|
2
2
|
import { _ as _ts_generator__ } from "@swc/helpers/_/_ts_generator";
|
|
3
3
|
import { callDataFetch } from "@module-federation/bridge-react/data-fetch-utils";
|
|
4
4
|
import { setSSREnv } from "@module-federation/bridge-react/lazy-utils";
|
|
5
|
-
var
|
|
5
|
+
var injectDataFetchFunctionPlugin_injectDataFetchFunctionPlugin = function(param) {
|
|
6
6
|
var fetchServerQuery = param.fetchServerQuery;
|
|
7
7
|
return {
|
|
8
8
|
name: '@module-federation/inject-data-fetch-function-plugin',
|
|
@@ -31,4 +31,4 @@ var injectDataFetchFunctionPlugin = function(param) {
|
|
|
31
31
|
}
|
|
32
32
|
};
|
|
33
33
|
};
|
|
34
|
-
export { injectDataFetchFunctionPlugin };
|
|
34
|
+
export { injectDataFetchFunctionPlugin_injectDataFetchFunctionPlugin as injectDataFetchFunctionPlugin };
|
|
@@ -30,7 +30,7 @@ const resolvePackageFile = (packageName, esmRelativePath, cjsRelativePath)=>{
|
|
|
30
30
|
if (parentDir === packageRoot) throw new Error(`Unable to resolve package root for ${packageName} from ${packageEntry}`);
|
|
31
31
|
packageRoot = parentDir;
|
|
32
32
|
}
|
|
33
|
-
return require.resolve(path.join(packageRoot, 'true' === process.env
|
|
33
|
+
return require.resolve(path.join(packageRoot, 'true' === process.env['IS_ESM_BUILD'] ? esmRelativePath : cjsRelativePath));
|
|
34
34
|
};
|
|
35
35
|
const resolveSharedStrategyPlugin = ()=>resolvePackageFile('@module-federation/modern-js', 'dist/esm/cli/mfRuntimePlugins/shared-strategy.mjs', 'dist/cjs/cli/mfRuntimePlugins/shared-strategy.js');
|
|
36
36
|
const resolveInjectNodeFetchPlugin = ()=>resolvePackageFile('@module-federation/modern-js', 'dist/esm/cli/mfRuntimePlugins/inject-node-fetch.mjs', 'dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js');
|
|
@@ -4,13 +4,6 @@ import { PluginOptions } from '../types';
|
|
|
4
4
|
import type { InternalModernPluginOptions } from '../types';
|
|
5
5
|
import type { AppTools, webpack, UserConfig, Rspack, CliPluginFuture } from '@modern-js/app-tools';
|
|
6
6
|
import type { BundlerChainConfig } from '../interfaces/bundler';
|
|
7
|
-
declare global {
|
|
8
|
-
namespace NodeJS {
|
|
9
|
-
interface ProcessEnv {
|
|
10
|
-
IS_ESM_BUILD?: string;
|
|
11
|
-
}
|
|
12
|
-
}
|
|
13
|
-
}
|
|
14
7
|
export type ConfigType<T> = T extends 'webpack' ? webpack.Configuration : T extends 'rspack' ? Rspack.Configuration : never;
|
|
15
8
|
export declare function setEnv(enableSSR: boolean): void;
|
|
16
9
|
export declare const getMFConfig: (userConfig: PluginOptions) => Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -132,13 +132,13 @@
|
|
|
132
132
|
"node-fetch": "~3.3.0",
|
|
133
133
|
"jiti": "2.4.2",
|
|
134
134
|
"react-error-boundary": "4.1.2",
|
|
135
|
-
"@module-federation/rsbuild-plugin": "2.
|
|
136
|
-
"@module-federation/
|
|
137
|
-
"@module-federation/
|
|
138
|
-
"@module-federation/
|
|
139
|
-
"@module-federation/
|
|
140
|
-
"@module-federation/cli": "2.
|
|
141
|
-
"@module-federation/
|
|
135
|
+
"@module-federation/rsbuild-plugin": "2.3.0",
|
|
136
|
+
"@module-federation/bridge-react": "2.3.0",
|
|
137
|
+
"@module-federation/runtime": "2.3.0",
|
|
138
|
+
"@module-federation/node": "2.7.38",
|
|
139
|
+
"@module-federation/sdk": "2.3.0",
|
|
140
|
+
"@module-federation/cli": "2.3.0",
|
|
141
|
+
"@module-federation/enhanced": "2.3.0"
|
|
142
142
|
},
|
|
143
143
|
"devDependencies": {
|
|
144
144
|
"@rsbuild/plugin-react": "1.4.5",
|
|
@@ -152,7 +152,7 @@
|
|
|
152
152
|
"@types/react": "^18.3.11",
|
|
153
153
|
"@types/react-dom": "^18.3.0",
|
|
154
154
|
"vitest": "1.6.0",
|
|
155
|
-
"@module-federation/manifest": "2.
|
|
155
|
+
"@module-federation/manifest": "2.3.0"
|
|
156
156
|
},
|
|
157
157
|
"peerDependencies": {
|
|
158
158
|
"react": ">=17",
|