@module-federation/modern-js-v3 2.5.1 → 2.7.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 +21 -14
- package/dist/cjs/cli/index.js +11 -7
- package/dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js +9 -5
- package/dist/cjs/cli/mfRuntimePlugins/shared-strategy.js +12 -8
- package/dist/cjs/cli/server/data-fetch-server-plugin.js +9 -5
- package/dist/cjs/cli/ssrPlugin.js +30 -8
- package/dist/cjs/cli/utils.js +9 -5
- package/dist/cjs/constant.js +13 -9
- package/dist/cjs/logger.js +9 -5
- package/dist/cjs/react/data-fetch.js +9 -5
- package/dist/cjs/react/index.js +9 -5
- package/dist/cjs/react/plugin.js +12 -8
- package/dist/cjs/react/v18.js +9 -5
- package/dist/cjs/react/v19.js +9 -5
- package/dist/cjs/runtime/index.js +9 -5
- package/dist/cjs/server/fileCache.js +9 -5
- package/dist/cjs/server/index.js +9 -5
- package/dist/cjs/server/staticMiddleware.js +11 -7
- package/dist/cjs/ssr-runtime/SSRLiveReload.js +9 -5
- package/dist/cjs/ssr-runtime/devPlugin.js +9 -5
- package/dist/cjs/ssr-runtime/injectDataFetchFunctionPlugin.js +9 -5
- package/dist/esm/cli/configPlugin.mjs +14 -19
- package/dist/esm/cli/index.mjs +3 -2
- package/dist/esm/cli/mfRuntimePlugins/inject-node-fetch.mjs +1 -1
- package/dist/esm/cli/mfRuntimePlugins/shared-strategy.mjs +1 -1
- package/dist/esm/cli/server/data-fetch-server-plugin.mjs +1 -1
- package/dist/esm/cli/ssrPlugin.mjs +34 -2
- package/dist/esm/cli/utils.mjs +1 -1
- package/dist/esm/interfaces/bundler.mjs +1 -0
- package/dist/esm/logger.mjs +1 -1
- package/dist/esm/react/plugin.mjs +1 -2
- package/dist/esm/rslib-runtime.mjs +18 -0
- package/dist/esm/server/fileCache.mjs +1 -1
- package/dist/esm/server/index.mjs +2 -1
- package/dist/esm/types/index.mjs +1 -0
- package/dist/esm-node/cli/configPlugin.mjs +14 -19
- package/dist/esm-node/cli/index.mjs +3 -2
- package/dist/esm-node/cli/mfRuntimePlugins/inject-node-fetch.mjs +1 -1
- package/dist/esm-node/cli/mfRuntimePlugins/shared-strategy.mjs +1 -1
- package/dist/esm-node/cli/server/data-fetch-server-plugin.mjs +1 -1
- package/dist/esm-node/cli/ssrPlugin.mjs +21 -2
- package/dist/esm-node/interfaces/bundler.mjs +1 -0
- package/dist/esm-node/logger.mjs +1 -1
- package/dist/esm-node/react/plugin.mjs +1 -2
- package/dist/esm-node/rslib-runtime.mjs +18 -0
- package/dist/esm-node/server/index.mjs +2 -1
- package/dist/esm-node/types/index.mjs +1 -0
- package/dist/types/cli/ssrPlugin.spec.d.ts +1 -0
- package/package.json +20 -18
|
@@ -24,11 +24,15 @@ function __webpack_require__(moduleId) {
|
|
|
24
24
|
};
|
|
25
25
|
})();
|
|
26
26
|
(()=>{
|
|
27
|
-
__webpack_require__.d = (exports1,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
28
|
+
var define = (defs, kind)=>{
|
|
29
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
[kind]: defs[key]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
32
36
|
};
|
|
33
37
|
})();
|
|
34
38
|
(()=>{
|
|
@@ -48,15 +52,15 @@ var __webpack_exports__ = {};
|
|
|
48
52
|
(()=>{
|
|
49
53
|
__webpack_require__.r(__webpack_exports__);
|
|
50
54
|
__webpack_require__.d(__webpack_exports__, {
|
|
51
|
-
|
|
55
|
+
addMyTypes2Ignored: ()=>addMyTypes2Ignored,
|
|
52
56
|
default: ()=>configPlugin,
|
|
53
57
|
getMFConfig: ()=>getMFConfig,
|
|
54
58
|
isWebTarget: ()=>external_utils_js_namespaceObject.isWebTarget,
|
|
55
59
|
moduleFederationConfigPlugin: ()=>moduleFederationConfigPlugin,
|
|
56
|
-
|
|
57
|
-
|
|
60
|
+
patchBundlerConfig: ()=>patchBundlerConfig,
|
|
61
|
+
patchMFConfig: ()=>patchMFConfig,
|
|
58
62
|
setEnv: ()=>setEnv,
|
|
59
|
-
|
|
63
|
+
skipByTarget: ()=>external_utils_js_namespaceObject.skipByTarget
|
|
60
64
|
});
|
|
61
65
|
const external_fs_namespaceObject = require("fs");
|
|
62
66
|
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
@@ -89,9 +93,9 @@ var __webpack_exports__ = {};
|
|
|
89
93
|
const getMFConfig = async (userConfig)=>{
|
|
90
94
|
const { config, configPath } = userConfig;
|
|
91
95
|
if (config) return config;
|
|
92
|
-
const mfConfigPath = configPath
|
|
96
|
+
const mfConfigPath = external_path_default().resolve(configPath || defaultPath);
|
|
93
97
|
const { createJiti } = __webpack_require__("jiti");
|
|
94
|
-
const jit = createJiti(
|
|
98
|
+
const jit = createJiti(mfConfigPath, {
|
|
95
99
|
interopDefault: true
|
|
96
100
|
});
|
|
97
101
|
const configModule = await jit(mfConfigPath);
|
|
@@ -282,15 +286,17 @@ var __webpack_exports__ = {};
|
|
|
282
286
|
});
|
|
283
287
|
api.config(()=>{
|
|
284
288
|
var _ref;
|
|
285
|
-
var _modernjsConfig_tools, _userConfig_csrConfig, _modernjsConfig_source,
|
|
289
|
+
var _modernjsConfig_tools, _userConfig_csrConfig, _modernjsConfig_dev, _modernjsConfig_source, _modernjsConfig_dev1, _modernjsConfig_dev2;
|
|
286
290
|
const devServerConfig = null == (_modernjsConfig_tools = modernjsConfig.tools) ? void 0 : _modernjsConfig_tools.devServer;
|
|
287
291
|
const corsWarnMsgs = [
|
|
288
292
|
'View https://module-federation.io/guide/troubleshooting/other.html#cors-warn for more details.'
|
|
289
293
|
];
|
|
290
294
|
if ('object' != typeof devServerConfig || !('headers' in devServerConfig)) corsWarnMsgs.unshift('Detect devServer.headers is empty, mf modern plugin will add default cors header: devServer.headers["Access-Control-Allow-Headers"] = "*". It is recommended to specify an allowlist of trusted origins instead.');
|
|
291
295
|
const exposes = null == (_userConfig_csrConfig = userConfig.csrConfig) ? void 0 : _userConfig_csrConfig.exposes;
|
|
292
|
-
const hasExposes = exposes && Array.isArray(exposes) ? exposes.length : Object.keys(null != exposes ? exposes : {}).length;
|
|
296
|
+
const hasExposes = exposes && Array.isArray(exposes) ? exposes.length > 0 : Object.keys(null != exposes ? exposes : {}).length > 0;
|
|
297
|
+
const lazyCompilationDisabledByPlugin = hasExposes && (null == modernjsConfig ? void 0 : null == (_modernjsConfig_dev = modernjsConfig.dev) ? void 0 : _modernjsConfig_dev.lazyCompilation) !== false;
|
|
293
298
|
if (corsWarnMsgs.length > 1 && hasExposes) external_logger_js_default().warn(corsWarnMsgs.join('\n'));
|
|
299
|
+
if (lazyCompilationDisabledByPlugin) external_logger_js_default().warn('Detected exposes in the Module Federation config. The Modern.js v3 Module Federation plugin will set dev.lazyCompilation to false for producer apps.');
|
|
294
300
|
const corsHeaders = hasExposes ? {
|
|
295
301
|
'Access-Control-Allow-Origin': '*',
|
|
296
302
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
@@ -311,7 +317,8 @@ var __webpack_exports__ = {};
|
|
|
311
317
|
enableAsyncEntry: null != (_ref = null == (_modernjsConfig_source = modernjsConfig.source) ? void 0 : _modernjsConfig_source.enableAsyncEntry) ? _ref : true
|
|
312
318
|
},
|
|
313
319
|
dev: {
|
|
314
|
-
assetPrefix: (null == modernjsConfig ? void 0 : null == (
|
|
320
|
+
assetPrefix: (null == modernjsConfig ? void 0 : null == (_modernjsConfig_dev1 = modernjsConfig.dev) ? void 0 : _modernjsConfig_dev1.assetPrefix) ? modernjsConfig.dev.assetPrefix : 'auto',
|
|
321
|
+
lazyCompilation: hasExposes ? false : null == modernjsConfig ? void 0 : null == (_modernjsConfig_dev2 = modernjsConfig.dev) ? void 0 : _modernjsConfig_dev2.lazyCompilation
|
|
315
322
|
}
|
|
316
323
|
};
|
|
317
324
|
});
|
package/dist/cjs/cli/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -24,9 +28,9 @@ var __webpack_require__ = {};
|
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
30
|
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
moduleFederationPlugin: ()=>moduleFederationPlugin,
|
|
28
31
|
createModuleFederationConfig: ()=>enhanced_namespaceObject.createModuleFederationConfig,
|
|
29
|
-
default: ()=>cli
|
|
32
|
+
default: ()=>cli,
|
|
33
|
+
moduleFederationPlugin: ()=>moduleFederationPlugin
|
|
30
34
|
});
|
|
31
35
|
const rspack_namespaceObject = require("@module-federation/enhanced/rspack");
|
|
32
36
|
const external_configPlugin_js_namespaceObject = require("./configPlugin.js");
|
|
@@ -10,11 +10,15 @@ var __webpack_require__ = {};
|
|
|
10
10
|
};
|
|
11
11
|
})();
|
|
12
12
|
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
18
22
|
};
|
|
19
23
|
})();
|
|
20
24
|
(()=>{
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -23,9 +27,6 @@ var __webpack_require__ = {};
|
|
|
23
27
|
})();
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
default: ()=>__rspack_default_export
|
|
28
|
-
});
|
|
29
30
|
const sharedStrategy = ()=>({
|
|
30
31
|
name: 'shared-strategy-plugin',
|
|
31
32
|
beforeInit (args) {
|
|
@@ -44,6 +45,9 @@ const sharedStrategy = ()=>({
|
|
|
44
45
|
}
|
|
45
46
|
});
|
|
46
47
|
const __rspack_default_export = sharedStrategy;
|
|
48
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
49
|
+
default: __rspack_default_export
|
|
50
|
+
});
|
|
47
51
|
exports["default"] = __webpack_exports__["default"];
|
|
48
52
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
49
53
|
"default"
|
|
@@ -10,11 +10,15 @@ var __webpack_require__ = {};
|
|
|
10
10
|
};
|
|
11
11
|
})();
|
|
12
12
|
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
18
22
|
};
|
|
19
23
|
})();
|
|
20
24
|
(()=>{
|
|
@@ -10,11 +10,15 @@ var __webpack_require__ = {};
|
|
|
10
10
|
};
|
|
11
11
|
})();
|
|
12
12
|
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
18
22
|
};
|
|
19
23
|
})();
|
|
20
24
|
(()=>{
|
|
@@ -33,10 +37,10 @@ var __webpack_require__ = {};
|
|
|
33
37
|
var __webpack_exports__ = {};
|
|
34
38
|
__webpack_require__.r(__webpack_exports__);
|
|
35
39
|
__webpack_require__.d(__webpack_exports__, {
|
|
40
|
+
CHAIN_MF_PLUGIN_ID: ()=>CHAIN_MF_PLUGIN_ID,
|
|
36
41
|
default: ()=>ssrPlugin,
|
|
37
42
|
moduleFederationSSRPlugin: ()=>moduleFederationSSRPlugin,
|
|
38
|
-
setEnv: ()=>setEnv
|
|
39
|
-
CHAIN_MF_PLUGIN_ID: ()=>CHAIN_MF_PLUGIN_ID
|
|
43
|
+
setEnv: ()=>setEnv
|
|
40
44
|
});
|
|
41
45
|
const external_path_namespaceObject = require("path");
|
|
42
46
|
var external_path_default = /*#__PURE__*/ __webpack_require__.n(external_path_namespaceObject);
|
|
@@ -71,6 +75,22 @@ function getManifestAssetFileNames(manifestOption) {
|
|
|
71
75
|
manifestFileName: (0, sdk_namespaceObject.simpleJoinRemoteEntry)(filePath, manifestFileName)
|
|
72
76
|
};
|
|
73
77
|
}
|
|
78
|
+
const STATIC_ASSET_MODULE_TYPES = [
|
|
79
|
+
'asset',
|
|
80
|
+
'asset/resource'
|
|
81
|
+
];
|
|
82
|
+
const preserveStaticAssetPublicPath = (config, publicPath)=>{
|
|
83
|
+
var _config, _moduleConfig;
|
|
84
|
+
if ('string' != typeof publicPath || '' === publicPath || 'auto' === publicPath) return;
|
|
85
|
+
(_config = config).module || (_config.module = {});
|
|
86
|
+
const moduleConfig = config.module;
|
|
87
|
+
(_moduleConfig = moduleConfig).generator || (_moduleConfig.generator = {});
|
|
88
|
+
for (const moduleType of STATIC_ASSET_MODULE_TYPES){
|
|
89
|
+
var _moduleConfig_generator, _moduleType, _moduleConfig_generator_moduleType;
|
|
90
|
+
(_moduleConfig_generator = moduleConfig.generator)[_moduleType = moduleType] || (_moduleConfig_generator[_moduleType] = {});
|
|
91
|
+
null != (_moduleConfig_generator_moduleType = moduleConfig.generator[moduleType]).publicPath || (_moduleConfig_generator_moduleType.publicPath = publicPath);
|
|
92
|
+
}
|
|
93
|
+
};
|
|
74
94
|
const mfSSRRsbuildPlugin = (pluginOptions)=>({
|
|
75
95
|
name: '@modern-js/plugin-mf-post-config',
|
|
76
96
|
pre: [
|
|
@@ -126,7 +146,9 @@ const mfSSRRsbuildPlugin = (pluginOptions)=>({
|
|
|
126
146
|
if (ssrEnv !== utils.environment.name) return config;
|
|
127
147
|
const userSSRConfig = pluginOptions.userConfig.ssr ? 'object' == typeof pluginOptions.userConfig.ssr ? pluginOptions.userConfig.ssr : {} : {};
|
|
128
148
|
if (!userSSRConfig.distOutputDir) return;
|
|
129
|
-
|
|
149
|
+
const publicPath = config.output.publicPath;
|
|
150
|
+
preserveStaticAssetPublicPath(config, publicPath);
|
|
151
|
+
config.output.publicPath = `${publicPath}${external_path_default().relative(csrOutputPath, ssrOutputPath)}/`;
|
|
130
152
|
return config;
|
|
131
153
|
};
|
|
132
154
|
api.modifyRspackConfig((config, utils)=>{
|
package/dist/cjs/cli/utils.js
CHANGED
|
@@ -10,11 +10,15 @@ var __webpack_require__ = {};
|
|
|
10
10
|
};
|
|
11
11
|
})();
|
|
12
12
|
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
18
22
|
};
|
|
19
23
|
})();
|
|
20
24
|
(()=>{
|
package/dist/cjs/constant.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -23,12 +27,12 @@ var __webpack_require__ = {};
|
|
|
23
27
|
})();
|
|
24
28
|
var __webpack_exports__ = {};
|
|
25
29
|
__webpack_require__.r(__webpack_exports__);
|
|
26
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
27
|
-
LOCALHOST: ()=>LOCALHOST,
|
|
28
|
-
PLUGIN_IDENTIFIER: ()=>PLUGIN_IDENTIFIER
|
|
29
|
-
});
|
|
30
30
|
const LOCALHOST = 'localhost';
|
|
31
31
|
const PLUGIN_IDENTIFIER = '[ Modern.js Module Federation ]';
|
|
32
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
33
|
+
LOCALHOST: LOCALHOST,
|
|
34
|
+
PLUGIN_IDENTIFIER: PLUGIN_IDENTIFIER
|
|
35
|
+
});
|
|
32
36
|
exports.LOCALHOST = __webpack_exports__.LOCALHOST;
|
|
33
37
|
exports.PLUGIN_IDENTIFIER = __webpack_exports__.PLUGIN_IDENTIFIER;
|
|
34
38
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
package/dist/cjs/logger.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -24,11 +24,15 @@ function __webpack_require__(moduleId) {
|
|
|
24
24
|
};
|
|
25
25
|
})();
|
|
26
26
|
(()=>{
|
|
27
|
-
__webpack_require__.d = (exports1,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
28
|
+
var define = (defs, kind)=>{
|
|
29
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
[kind]: defs[key]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
32
36
|
};
|
|
33
37
|
})();
|
|
34
38
|
(()=>{
|
package/dist/cjs/react/index.js
CHANGED
|
@@ -24,11 +24,15 @@ function __webpack_require__(moduleId) {
|
|
|
24
24
|
};
|
|
25
25
|
})();
|
|
26
26
|
(()=>{
|
|
27
|
-
__webpack_require__.d = (exports1,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
28
|
+
var define = (defs, kind)=>{
|
|
29
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
[kind]: defs[key]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
32
36
|
};
|
|
33
37
|
})();
|
|
34
38
|
(()=>{
|
package/dist/cjs/react/plugin.js
CHANGED
|
@@ -24,11 +24,15 @@ function __webpack_require__(moduleId) {
|
|
|
24
24
|
};
|
|
25
25
|
})();
|
|
26
26
|
(()=>{
|
|
27
|
-
__webpack_require__.d = (exports1,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
28
|
+
var define = (defs, kind)=>{
|
|
29
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
[kind]: defs[key]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
32
36
|
};
|
|
33
37
|
})();
|
|
34
38
|
(()=>{
|
|
@@ -47,14 +51,14 @@ function __webpack_require__(moduleId) {
|
|
|
47
51
|
var __webpack_exports__ = {};
|
|
48
52
|
(()=>{
|
|
49
53
|
__webpack_require__.r(__webpack_exports__);
|
|
50
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
51
|
-
default: ()=>_module_federation_bridge_react_plugin__rspack_import_0_default.a
|
|
52
|
-
});
|
|
53
54
|
var _module_federation_bridge_react_plugin__rspack_import_0 = __webpack_require__("@module-federation/bridge-react/plugin");
|
|
54
55
|
var _module_federation_bridge_react_plugin__rspack_import_0_default = /*#__PURE__*/ __webpack_require__.n(_module_federation_bridge_react_plugin__rspack_import_0);
|
|
55
56
|
var __rspack_reexport = {};
|
|
56
57
|
for(const __rspack_import_key in _module_federation_bridge_react_plugin__rspack_import_0)if ("default" !== __rspack_import_key) __rspack_reexport[__rspack_import_key] = ()=>_module_federation_bridge_react_plugin__rspack_import_0[__rspack_import_key];
|
|
57
58
|
__webpack_require__.d(__webpack_exports__, __rspack_reexport);
|
|
59
|
+
__webpack_require__.d(__webpack_exports__, {
|
|
60
|
+
default: ()=>_module_federation_bridge_react_plugin__rspack_import_0_default.a
|
|
61
|
+
});
|
|
58
62
|
})();
|
|
59
63
|
exports["default"] = __webpack_exports__["default"];
|
|
60
64
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
package/dist/cjs/react/v18.js
CHANGED
|
@@ -24,11 +24,15 @@ function __webpack_require__(moduleId) {
|
|
|
24
24
|
};
|
|
25
25
|
})();
|
|
26
26
|
(()=>{
|
|
27
|
-
__webpack_require__.d = (exports1,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
28
|
+
var define = (defs, kind)=>{
|
|
29
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
[kind]: defs[key]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
32
36
|
};
|
|
33
37
|
})();
|
|
34
38
|
(()=>{
|
package/dist/cjs/react/v19.js
CHANGED
|
@@ -24,11 +24,15 @@ function __webpack_require__(moduleId) {
|
|
|
24
24
|
};
|
|
25
25
|
})();
|
|
26
26
|
(()=>{
|
|
27
|
-
__webpack_require__.d = (exports1,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
28
|
+
var define = (defs, kind)=>{
|
|
29
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
[kind]: defs[key]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
32
36
|
};
|
|
33
37
|
})();
|
|
34
38
|
(()=>{
|
|
@@ -24,11 +24,15 @@ function __webpack_require__(moduleId) {
|
|
|
24
24
|
};
|
|
25
25
|
})();
|
|
26
26
|
(()=>{
|
|
27
|
-
__webpack_require__.d = (exports1,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
27
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
28
|
+
var define = (defs, kind)=>{
|
|
29
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
30
|
+
enumerable: true,
|
|
31
|
+
[kind]: defs[key]
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
define(getters, "get");
|
|
35
|
+
define(values, "value");
|
|
32
36
|
};
|
|
33
37
|
})();
|
|
34
38
|
(()=>{
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
package/dist/cjs/server/index.js
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -10,11 +10,15 @@ var __webpack_require__ = {};
|
|
|
10
10
|
};
|
|
11
11
|
})();
|
|
12
12
|
(()=>{
|
|
13
|
-
__webpack_require__.d = (exports1,
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
13
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
14
|
+
var define = (defs, kind)=>{
|
|
15
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
16
|
+
enumerable: true,
|
|
17
|
+
[kind]: defs[key]
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
define(getters, "get");
|
|
21
|
+
define(values, "value");
|
|
18
22
|
};
|
|
19
23
|
})();
|
|
20
24
|
(()=>{
|
|
@@ -33,8 +37,8 @@ var __webpack_require__ = {};
|
|
|
33
37
|
var __webpack_exports__ = {};
|
|
34
38
|
__webpack_require__.r(__webpack_exports__);
|
|
35
39
|
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
|
|
37
|
-
|
|
40
|
+
createCorsMiddleware: ()=>createCorsMiddleware,
|
|
41
|
+
createStaticMiddleware: ()=>createStaticMiddleware
|
|
38
42
|
});
|
|
39
43
|
const promises_namespaceObject = require("fs/promises");
|
|
40
44
|
const external_path_namespaceObject = require("path");
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.d = (exports1,
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
__webpack_require__.d = (exports1, getters, values)=>{
|
|
5
|
+
var define = (defs, kind)=>{
|
|
6
|
+
for(var key in defs)if (__webpack_require__.o(defs, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
7
|
+
enumerable: true,
|
|
8
|
+
[kind]: defs[key]
|
|
9
|
+
});
|
|
10
|
+
};
|
|
11
|
+
define(getters, "get");
|
|
12
|
+
define(values, "value");
|
|
9
13
|
};
|
|
10
14
|
})();
|
|
11
15
|
(()=>{
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as __rspack_external_jiti from "jiti";
|
|
2
1
|
import { _ } from "@swc/helpers/_/_async_to_generator";
|
|
3
2
|
import { _ as _object_spread__ } from "@swc/helpers/_/_object_spread";
|
|
4
3
|
import { _ as _object_spread_props__ } from "@swc/helpers/_/_object_spread_props";
|
|
@@ -12,21 +11,13 @@ import { encodeName } from "@module-federation/sdk";
|
|
|
12
11
|
import { PLUGIN_IDENTIFIER } from "../constant.mjs";
|
|
13
12
|
import { addDataFetchExposes, autoDeleteSplitChunkCacheGroups } from "@module-federation/rsbuild-plugin/utils";
|
|
14
13
|
import logger from "../logger.mjs";
|
|
15
|
-
|
|
14
|
+
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
15
|
+
import * as __rspack_external_jiti from "jiti";
|
|
16
|
+
__webpack_require__.add({
|
|
16
17
|
jiti: function(module) {
|
|
17
18
|
module.exports = __rspack_external_jiti;
|
|
18
19
|
}
|
|
19
|
-
};
|
|
20
|
-
var __webpack_module_cache__ = {};
|
|
21
|
-
function __webpack_require__(moduleId) {
|
|
22
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
23
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
24
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
25
|
-
exports: {}
|
|
26
|
-
};
|
|
27
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
28
|
-
return module.exports;
|
|
29
|
-
}
|
|
20
|
+
});
|
|
30
21
|
var defaultPath = path.resolve(process.cwd(), 'module-federation.config.ts');
|
|
31
22
|
var configPlugin_resolvePackageFile = function(packageName, esmRelativePath, cjsRelativePath) {
|
|
32
23
|
var packageEntry = require.resolve(packageName);
|
|
@@ -64,9 +55,9 @@ var configPlugin_getMFConfig = function(userConfig) {
|
|
|
64
55
|
2,
|
|
65
56
|
config
|
|
66
57
|
];
|
|
67
|
-
mfConfigPath = configPath
|
|
58
|
+
mfConfigPath = path.resolve(configPath || defaultPath);
|
|
68
59
|
createJiti = __webpack_require__("jiti").createJiti;
|
|
69
|
-
jit = createJiti(
|
|
60
|
+
jit = createJiti(mfConfigPath, {
|
|
70
61
|
interopDefault: true
|
|
71
62
|
});
|
|
72
63
|
return [
|
|
@@ -273,15 +264,17 @@ var configPlugin_moduleFederationConfigPlugin = function(userConfig) {
|
|
|
273
264
|
});
|
|
274
265
|
api.config(function() {
|
|
275
266
|
var _ref;
|
|
276
|
-
var _modernjsConfig_tools, _userConfig_csrConfig, _modernjsConfig_source,
|
|
267
|
+
var _modernjsConfig_tools, _userConfig_csrConfig, _modernjsConfig_dev, _modernjsConfig_source, _modernjsConfig_dev1, _modernjsConfig_dev2;
|
|
277
268
|
var devServerConfig = null == (_modernjsConfig_tools = modernjsConfig.tools) ? void 0 : _modernjsConfig_tools.devServer;
|
|
278
269
|
var corsWarnMsgs = [
|
|
279
270
|
'View https://module-federation.io/guide/troubleshooting/other.html#cors-warn for more details.'
|
|
280
271
|
];
|
|
281
272
|
if ((void 0 === devServerConfig ? "undefined" : _type_of__(devServerConfig)) !== 'object' || !('headers' in devServerConfig)) corsWarnMsgs.unshift('Detect devServer.headers is empty, mf modern plugin will add default cors header: devServer.headers["Access-Control-Allow-Headers"] = "*". It is recommended to specify an allowlist of trusted origins instead.');
|
|
282
273
|
var exposes = null == (_userConfig_csrConfig = userConfig.csrConfig) ? void 0 : _userConfig_csrConfig.exposes;
|
|
283
|
-
var hasExposes = exposes && Array.isArray(exposes) ? exposes.length : Object.keys(null != exposes ? exposes : {}).length;
|
|
274
|
+
var hasExposes = exposes && Array.isArray(exposes) ? exposes.length > 0 : Object.keys(null != exposes ? exposes : {}).length > 0;
|
|
275
|
+
var lazyCompilationDisabledByPlugin = hasExposes && (null == modernjsConfig ? void 0 : null == (_modernjsConfig_dev = modernjsConfig.dev) ? void 0 : _modernjsConfig_dev.lazyCompilation) !== false;
|
|
284
276
|
if (corsWarnMsgs.length > 1 && hasExposes) logger.warn(corsWarnMsgs.join('\n'));
|
|
277
|
+
if (lazyCompilationDisabledByPlugin) logger.warn('Detected exposes in the Module Federation config. The Modern.js v3 Module Federation plugin will set dev.lazyCompilation to false for producer apps.');
|
|
285
278
|
var corsHeaders = hasExposes ? {
|
|
286
279
|
'Access-Control-Allow-Origin': '*',
|
|
287
280
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
@@ -302,7 +295,8 @@ var configPlugin_moduleFederationConfigPlugin = function(userConfig) {
|
|
|
302
295
|
enableAsyncEntry: null != (_ref = null == (_modernjsConfig_source = modernjsConfig.source) ? void 0 : _modernjsConfig_source.enableAsyncEntry) ? _ref : true
|
|
303
296
|
},
|
|
304
297
|
dev: {
|
|
305
|
-
assetPrefix: (null == modernjsConfig ? void 0 : null == (
|
|
298
|
+
assetPrefix: (null == modernjsConfig ? void 0 : null == (_modernjsConfig_dev1 = modernjsConfig.dev) ? void 0 : _modernjsConfig_dev1.assetPrefix) ? modernjsConfig.dev.assetPrefix : 'auto',
|
|
299
|
+
lazyCompilation: hasExposes ? false : null == modernjsConfig ? void 0 : null == (_modernjsConfig_dev2 = modernjsConfig.dev) ? void 0 : _modernjsConfig_dev2.lazyCompilation
|
|
306
300
|
}
|
|
307
301
|
};
|
|
308
302
|
});
|
|
@@ -316,4 +310,5 @@ var configPlugin_moduleFederationConfigPlugin = function(userConfig) {
|
|
|
316
310
|
};
|
|
317
311
|
};
|
|
318
312
|
var configPlugin = configPlugin_moduleFederationConfigPlugin;
|
|
319
|
-
export
|
|
313
|
+
export default configPlugin;
|
|
314
|
+
export { addMyTypes2Ignored, configPlugin_getMFConfig as getMFConfig, configPlugin_moduleFederationConfigPlugin as moduleFederationConfigPlugin, configPlugin_patchMFConfig as patchMFConfig, isWebTarget, patchBundlerConfig, setEnv, skipByTarget };
|
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -5,7 +5,6 @@ import { ModuleFederationPlugin, TreeShakingSharedPlugin } from "@module-federat
|
|
|
5
5
|
import { moduleFederationConfigPlugin } from "./configPlugin.mjs";
|
|
6
6
|
import { moduleFederationSSRPlugin } from "./ssrPlugin.mjs";
|
|
7
7
|
import { isWebTarget } from "./utils.mjs";
|
|
8
|
-
import { createModuleFederationConfig } from "@module-federation/enhanced";
|
|
9
8
|
var cli_moduleFederationPlugin = function() {
|
|
10
9
|
var userConfig = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : {};
|
|
11
10
|
var _userConfig_fetchServerQuery, _userConfig_secondarySharedTreeShaking;
|
|
@@ -65,4 +64,6 @@ var cli_moduleFederationPlugin = function() {
|
|
|
65
64
|
};
|
|
66
65
|
};
|
|
67
66
|
var cli = cli_moduleFederationPlugin;
|
|
68
|
-
export { createModuleFederationConfig
|
|
67
|
+
export { createModuleFederationConfig } from "@module-federation/enhanced";
|
|
68
|
+
export default cli;
|
|
69
|
+
export { cli_moduleFederationPlugin as moduleFederationPlugin };
|
|
@@ -35,6 +35,35 @@ function getManifestAssetFileNames(manifestOption) {
|
|
|
35
35
|
manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName)
|
|
36
36
|
};
|
|
37
37
|
}
|
|
38
|
+
var STATIC_ASSET_MODULE_TYPES = [
|
|
39
|
+
'asset',
|
|
40
|
+
'asset/resource'
|
|
41
|
+
];
|
|
42
|
+
var ssrPlugin_preserveStaticAssetPublicPath = function(config, publicPath) {
|
|
43
|
+
var _config, _moduleConfig;
|
|
44
|
+
if ('string' != typeof publicPath || '' === publicPath || 'auto' === publicPath) return;
|
|
45
|
+
(_config = config).module || (_config.module = {});
|
|
46
|
+
var moduleConfig = config.module;
|
|
47
|
+
(_moduleConfig = moduleConfig).generator || (_moduleConfig.generator = {});
|
|
48
|
+
var _iteratorNormalCompletion = true, _didIteratorError = false, _iteratorError = void 0;
|
|
49
|
+
try {
|
|
50
|
+
for(var _iterator = STATIC_ASSET_MODULE_TYPES[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true){
|
|
51
|
+
var moduleType = _step.value;
|
|
52
|
+
var _moduleConfig_generator, _moduleType, _moduleConfig_generator_moduleType;
|
|
53
|
+
(_moduleConfig_generator = moduleConfig.generator)[_moduleType = moduleType] || (_moduleConfig_generator[_moduleType] = {});
|
|
54
|
+
null != (_moduleConfig_generator_moduleType = moduleConfig.generator[moduleType]).publicPath || (_moduleConfig_generator_moduleType.publicPath = publicPath);
|
|
55
|
+
}
|
|
56
|
+
} catch (err) {
|
|
57
|
+
_didIteratorError = true;
|
|
58
|
+
_iteratorError = err;
|
|
59
|
+
} finally{
|
|
60
|
+
try {
|
|
61
|
+
if (!_iteratorNormalCompletion && null != _iterator.return) _iterator.return();
|
|
62
|
+
} finally{
|
|
63
|
+
if (_didIteratorError) throw _iteratorError;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
};
|
|
38
67
|
var ssrPlugin_mfSSRRsbuildPlugin = function(pluginOptions) {
|
|
39
68
|
return {
|
|
40
69
|
name: '@modern-js/plugin-mf-post-config',
|
|
@@ -92,7 +121,9 @@ var ssrPlugin_mfSSRRsbuildPlugin = function(pluginOptions) {
|
|
|
92
121
|
if (ssrEnv !== utils.environment.name) return config;
|
|
93
122
|
var userSSRConfig = pluginOptions.userConfig.ssr ? 'object' === _type_of__(pluginOptions.userConfig.ssr) ? pluginOptions.userConfig.ssr : {} : {};
|
|
94
123
|
if (!userSSRConfig.distOutputDir) return;
|
|
95
|
-
|
|
124
|
+
var publicPath = config.output.publicPath;
|
|
125
|
+
ssrPlugin_preserveStaticAssetPublicPath(config, publicPath);
|
|
126
|
+
config.output.publicPath = "".concat(publicPath).concat(path.relative(csrOutputPath, ssrOutputPath), "/");
|
|
96
127
|
return config;
|
|
97
128
|
};
|
|
98
129
|
api.modifyRspackConfig(function(config, utils) {
|
|
@@ -255,4 +286,5 @@ var ssrPlugin_moduleFederationSSRPlugin = function(pluginOptions) {
|
|
|
255
286
|
};
|
|
256
287
|
};
|
|
257
288
|
var ssrPlugin = ssrPlugin_moduleFederationSSRPlugin;
|
|
258
|
-
export
|
|
289
|
+
export default ssrPlugin;
|
|
290
|
+
export { CHAIN_MF_PLUGIN_ID, setEnv, ssrPlugin_moduleFederationSSRPlugin as moduleFederationSSRPlugin };
|
package/dist/esm/cli/utils.mjs
CHANGED
|
@@ -37,4 +37,4 @@ var utils_skipByTarget = function(target) {
|
|
|
37
37
|
function isDev() {
|
|
38
38
|
return 'development' === process.env.NODE_ENV;
|
|
39
39
|
}
|
|
40
|
-
export { utils_getIPV4 as getIPV4,
|
|
40
|
+
export { isDev, utils_getIPV4 as getIPV4, utils_isWebTarget as isWebTarget, utils_skipByTarget as skipByTarget };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/esm/logger.mjs
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __webpack_modules__ = {};
|
|
2
|
+
var __webpack_module_cache__ = {};
|
|
3
|
+
function __webpack_require__(moduleId) {
|
|
4
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
5
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
6
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
7
|
+
exports: {}
|
|
8
|
+
};
|
|
9
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
10
|
+
return module.exports;
|
|
11
|
+
}
|
|
12
|
+
__webpack_require__.m = __webpack_modules__;
|
|
13
|
+
!function() {
|
|
14
|
+
__webpack_require__.add = function(modules) {
|
|
15
|
+
Object.assign(__webpack_require__.m, modules);
|
|
16
|
+
};
|
|
17
|
+
}();
|
|
18
|
+
export { __webpack_require__ };
|
package/dist/esm/types/index.mjs
CHANGED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import * as __rspack_external_jiti from "jiti";
|
|
2
1
|
import fs from "fs";
|
|
3
2
|
import path from "path";
|
|
4
3
|
import { isDev, isWebTarget, skipByTarget } from "./utils.mjs";
|
|
@@ -6,21 +5,13 @@ import { encodeName } from "@module-federation/sdk";
|
|
|
6
5
|
import { PLUGIN_IDENTIFIER } from "../constant.mjs";
|
|
7
6
|
import { addDataFetchExposes, autoDeleteSplitChunkCacheGroups } from "@module-federation/rsbuild-plugin/utils";
|
|
8
7
|
import logger from "../logger.mjs";
|
|
9
|
-
|
|
8
|
+
import { __webpack_require__ } from "../rslib-runtime.mjs";
|
|
9
|
+
import * as __rspack_external_jiti from "jiti";
|
|
10
|
+
__webpack_require__.add({
|
|
10
11
|
jiti (module) {
|
|
11
12
|
module.exports = __rspack_external_jiti;
|
|
12
13
|
}
|
|
13
|
-
};
|
|
14
|
-
var __webpack_module_cache__ = {};
|
|
15
|
-
function __webpack_require__(moduleId) {
|
|
16
|
-
var cachedModule = __webpack_module_cache__[moduleId];
|
|
17
|
-
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
18
|
-
var module = __webpack_module_cache__[moduleId] = {
|
|
19
|
-
exports: {}
|
|
20
|
-
};
|
|
21
|
-
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
22
|
-
return module.exports;
|
|
23
|
-
}
|
|
14
|
+
});
|
|
24
15
|
const defaultPath = path.resolve(process.cwd(), 'module-federation.config.ts');
|
|
25
16
|
const resolvePackageFile = (packageName, esmRelativePath, cjsRelativePath)=>{
|
|
26
17
|
const packageEntry = require.resolve(packageName);
|
|
@@ -42,9 +33,9 @@ function setEnv(enableSSR) {
|
|
|
42
33
|
const getMFConfig = async (userConfig)=>{
|
|
43
34
|
const { config, configPath } = userConfig;
|
|
44
35
|
if (config) return config;
|
|
45
|
-
const mfConfigPath = configPath
|
|
36
|
+
const mfConfigPath = path.resolve(configPath || defaultPath);
|
|
46
37
|
const { createJiti } = __webpack_require__("jiti");
|
|
47
|
-
const jit = createJiti(
|
|
38
|
+
const jit = createJiti(mfConfigPath, {
|
|
48
39
|
interopDefault: true
|
|
49
40
|
});
|
|
50
41
|
const configModule = await jit(mfConfigPath);
|
|
@@ -235,15 +226,17 @@ const moduleFederationConfigPlugin = (userConfig)=>({
|
|
|
235
226
|
});
|
|
236
227
|
api.config(()=>{
|
|
237
228
|
var _ref;
|
|
238
|
-
var _modernjsConfig_tools, _userConfig_csrConfig, _modernjsConfig_source,
|
|
229
|
+
var _modernjsConfig_tools, _userConfig_csrConfig, _modernjsConfig_dev, _modernjsConfig_source, _modernjsConfig_dev1, _modernjsConfig_dev2;
|
|
239
230
|
const devServerConfig = null == (_modernjsConfig_tools = modernjsConfig.tools) ? void 0 : _modernjsConfig_tools.devServer;
|
|
240
231
|
const corsWarnMsgs = [
|
|
241
232
|
'View https://module-federation.io/guide/troubleshooting/other.html#cors-warn for more details.'
|
|
242
233
|
];
|
|
243
234
|
if ('object' != typeof devServerConfig || !('headers' in devServerConfig)) corsWarnMsgs.unshift('Detect devServer.headers is empty, mf modern plugin will add default cors header: devServer.headers["Access-Control-Allow-Headers"] = "*". It is recommended to specify an allowlist of trusted origins instead.');
|
|
244
235
|
const exposes = null == (_userConfig_csrConfig = userConfig.csrConfig) ? void 0 : _userConfig_csrConfig.exposes;
|
|
245
|
-
const hasExposes = exposes && Array.isArray(exposes) ? exposes.length : Object.keys(null != exposes ? exposes : {}).length;
|
|
236
|
+
const hasExposes = exposes && Array.isArray(exposes) ? exposes.length > 0 : Object.keys(null != exposes ? exposes : {}).length > 0;
|
|
237
|
+
const lazyCompilationDisabledByPlugin = hasExposes && (null == modernjsConfig ? void 0 : null == (_modernjsConfig_dev = modernjsConfig.dev) ? void 0 : _modernjsConfig_dev.lazyCompilation) !== false;
|
|
246
238
|
if (corsWarnMsgs.length > 1 && hasExposes) logger.warn(corsWarnMsgs.join('\n'));
|
|
239
|
+
if (lazyCompilationDisabledByPlugin) logger.warn('Detected exposes in the Module Federation config. The Modern.js v3 Module Federation plugin will set dev.lazyCompilation to false for producer apps.');
|
|
247
240
|
const corsHeaders = hasExposes ? {
|
|
248
241
|
'Access-Control-Allow-Origin': '*',
|
|
249
242
|
'Access-Control-Allow-Methods': 'GET, POST, PUT, DELETE, PATCH, OPTIONS',
|
|
@@ -264,11 +257,13 @@ const moduleFederationConfigPlugin = (userConfig)=>({
|
|
|
264
257
|
enableAsyncEntry: null != (_ref = null == (_modernjsConfig_source = modernjsConfig.source) ? void 0 : _modernjsConfig_source.enableAsyncEntry) ? _ref : true
|
|
265
258
|
},
|
|
266
259
|
dev: {
|
|
267
|
-
assetPrefix: (null == modernjsConfig ? void 0 : null == (
|
|
260
|
+
assetPrefix: (null == modernjsConfig ? void 0 : null == (_modernjsConfig_dev1 = modernjsConfig.dev) ? void 0 : _modernjsConfig_dev1.assetPrefix) ? modernjsConfig.dev.assetPrefix : 'auto',
|
|
261
|
+
lazyCompilation: hasExposes ? false : null == modernjsConfig ? void 0 : null == (_modernjsConfig_dev2 = modernjsConfig.dev) ? void 0 : _modernjsConfig_dev2.lazyCompilation
|
|
268
262
|
}
|
|
269
263
|
};
|
|
270
264
|
});
|
|
271
265
|
}
|
|
272
266
|
});
|
|
273
267
|
const configPlugin = moduleFederationConfigPlugin;
|
|
274
|
-
export
|
|
268
|
+
export default configPlugin;
|
|
269
|
+
export { addMyTypes2Ignored, getMFConfig, isWebTarget, moduleFederationConfigPlugin, patchBundlerConfig, patchMFConfig, setEnv, skipByTarget };
|
|
@@ -2,7 +2,6 @@ import { ModuleFederationPlugin, TreeShakingSharedPlugin } from "@module-federat
|
|
|
2
2
|
import { moduleFederationConfigPlugin } from "./configPlugin.mjs";
|
|
3
3
|
import { moduleFederationSSRPlugin } from "./ssrPlugin.mjs";
|
|
4
4
|
import { isWebTarget } from "./utils.mjs";
|
|
5
|
-
import { createModuleFederationConfig } from "@module-federation/enhanced";
|
|
6
5
|
const moduleFederationPlugin = (userConfig = {})=>{
|
|
7
6
|
var _userConfig_fetchServerQuery, _userConfig_secondarySharedTreeShaking;
|
|
8
7
|
const internalModernPluginOptions = {
|
|
@@ -55,4 +54,6 @@ const moduleFederationPlugin = (userConfig = {})=>{
|
|
|
55
54
|
};
|
|
56
55
|
};
|
|
57
56
|
const cli = moduleFederationPlugin;
|
|
58
|
-
export { createModuleFederationConfig
|
|
57
|
+
export { createModuleFederationConfig } from "@module-federation/enhanced";
|
|
58
|
+
export default cli;
|
|
59
|
+
export { moduleFederationPlugin };
|
|
@@ -27,6 +27,22 @@ function getManifestAssetFileNames(manifestOption) {
|
|
|
27
27
|
manifestFileName: simpleJoinRemoteEntry(filePath, manifestFileName)
|
|
28
28
|
};
|
|
29
29
|
}
|
|
30
|
+
const STATIC_ASSET_MODULE_TYPES = [
|
|
31
|
+
'asset',
|
|
32
|
+
'asset/resource'
|
|
33
|
+
];
|
|
34
|
+
const preserveStaticAssetPublicPath = (config, publicPath)=>{
|
|
35
|
+
var _config, _moduleConfig;
|
|
36
|
+
if ('string' != typeof publicPath || '' === publicPath || 'auto' === publicPath) return;
|
|
37
|
+
(_config = config).module || (_config.module = {});
|
|
38
|
+
const moduleConfig = config.module;
|
|
39
|
+
(_moduleConfig = moduleConfig).generator || (_moduleConfig.generator = {});
|
|
40
|
+
for (const moduleType of STATIC_ASSET_MODULE_TYPES){
|
|
41
|
+
var _moduleConfig_generator, _moduleType, _moduleConfig_generator_moduleType;
|
|
42
|
+
(_moduleConfig_generator = moduleConfig.generator)[_moduleType = moduleType] || (_moduleConfig_generator[_moduleType] = {});
|
|
43
|
+
null != (_moduleConfig_generator_moduleType = moduleConfig.generator[moduleType]).publicPath || (_moduleConfig_generator_moduleType.publicPath = publicPath);
|
|
44
|
+
}
|
|
45
|
+
};
|
|
30
46
|
const mfSSRRsbuildPlugin = (pluginOptions)=>({
|
|
31
47
|
name: '@modern-js/plugin-mf-post-config',
|
|
32
48
|
pre: [
|
|
@@ -82,7 +98,9 @@ const mfSSRRsbuildPlugin = (pluginOptions)=>({
|
|
|
82
98
|
if (ssrEnv !== utils.environment.name) return config;
|
|
83
99
|
const userSSRConfig = pluginOptions.userConfig.ssr ? 'object' == typeof pluginOptions.userConfig.ssr ? pluginOptions.userConfig.ssr : {} : {};
|
|
84
100
|
if (!userSSRConfig.distOutputDir) return;
|
|
85
|
-
|
|
101
|
+
const publicPath = config.output.publicPath;
|
|
102
|
+
preserveStaticAssetPublicPath(config, publicPath);
|
|
103
|
+
config.output.publicPath = `${publicPath}${path.relative(csrOutputPath, ssrOutputPath)}/`;
|
|
86
104
|
return config;
|
|
87
105
|
};
|
|
88
106
|
api.modifyRspackConfig((config, utils)=>{
|
|
@@ -227,4 +245,5 @@ const moduleFederationSSRPlugin = (pluginOptions)=>({
|
|
|
227
245
|
}
|
|
228
246
|
});
|
|
229
247
|
const ssrPlugin = moduleFederationSSRPlugin;
|
|
230
|
-
export
|
|
248
|
+
export default ssrPlugin;
|
|
249
|
+
export { CHAIN_MF_PLUGIN_ID, moduleFederationSSRPlugin, setEnv };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
package/dist/esm-node/logger.mjs
CHANGED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
var __webpack_modules__ = {};
|
|
2
|
+
var __webpack_module_cache__ = {};
|
|
3
|
+
function __webpack_require__(moduleId) {
|
|
4
|
+
var cachedModule = __webpack_module_cache__[moduleId];
|
|
5
|
+
if (void 0 !== cachedModule) return cachedModule.exports;
|
|
6
|
+
var module = __webpack_module_cache__[moduleId] = {
|
|
7
|
+
exports: {}
|
|
8
|
+
};
|
|
9
|
+
__webpack_modules__[moduleId](module, module.exports, __webpack_require__);
|
|
10
|
+
return module.exports;
|
|
11
|
+
}
|
|
12
|
+
__webpack_require__.m = __webpack_modules__;
|
|
13
|
+
(()=>{
|
|
14
|
+
__webpack_require__.add = function(modules) {
|
|
15
|
+
Object.assign(__webpack_require__.m, modules);
|
|
16
|
+
};
|
|
17
|
+
})();
|
|
18
|
+
export { __webpack_require__ };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js-v3",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.7.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -137,34 +137,36 @@
|
|
|
137
137
|
"node-fetch": "3.3.0",
|
|
138
138
|
"jiti": "2.4.2",
|
|
139
139
|
"react-error-boundary": "4.1.2",
|
|
140
|
-
"@module-federation/rsbuild-plugin": "2.
|
|
141
|
-
"@module-federation/
|
|
142
|
-
"@module-federation/
|
|
143
|
-
"@module-federation/
|
|
144
|
-
"@module-federation/node": "2.7.
|
|
145
|
-
"@module-federation/
|
|
146
|
-
"@module-federation/
|
|
140
|
+
"@module-federation/rsbuild-plugin": "2.7.0",
|
|
141
|
+
"@module-federation/enhanced": "2.7.0",
|
|
142
|
+
"@module-federation/bridge-react": "2.7.0",
|
|
143
|
+
"@module-federation/runtime": "2.7.0",
|
|
144
|
+
"@module-federation/node": "2.7.46",
|
|
145
|
+
"@module-federation/cli": "2.7.0",
|
|
146
|
+
"@module-federation/sdk": "2.7.0"
|
|
147
147
|
},
|
|
148
148
|
"devDependencies": {
|
|
149
149
|
"@rsbuild/plugin-react": "1.4.5",
|
|
150
|
-
"@
|
|
151
|
-
"@
|
|
152
|
-
"@
|
|
153
|
-
"@
|
|
150
|
+
"@rstest/core": "^0.10.6",
|
|
151
|
+
"@rslib/core": "0.23.2",
|
|
152
|
+
"@rsbuild/core": "2.1.4",
|
|
153
|
+
"@rspack/core": "2.0.6",
|
|
154
|
+
"@modern-js/app-tools": "3.5.0",
|
|
155
|
+
"@modern-js/server-runtime": "3.5.0",
|
|
154
156
|
"@modern-js/module-tools": "2.70.5",
|
|
155
|
-
"@modern-js/runtime": "3.0
|
|
156
|
-
"@modern-js/tsconfig": "3.0
|
|
157
|
+
"@modern-js/runtime": "3.5.0",
|
|
158
|
+
"@modern-js/tsconfig": "3.5.0",
|
|
157
159
|
"@types/react": "^18.3.11",
|
|
158
160
|
"@types/react-dom": "^18.3.0",
|
|
159
161
|
"react": "~18.3.1",
|
|
160
162
|
"react-dom": "~18.3.1",
|
|
161
|
-
"
|
|
162
|
-
"@module-federation/manifest": "2.
|
|
163
|
+
"typescript": "6.0.3",
|
|
164
|
+
"@module-federation/manifest": "2.7.0"
|
|
163
165
|
},
|
|
164
166
|
"peerDependencies": {
|
|
165
167
|
"react": ">=17",
|
|
166
168
|
"react-dom": ">=17",
|
|
167
|
-
"typescript": "^4.9.0 || ^5.0.0",
|
|
169
|
+
"typescript": "^4.9.0 || ^5.0.0 || ^6.0.0",
|
|
168
170
|
"vue-tsc": "^1.0.24",
|
|
169
171
|
"react-router-dom": "^4 || ^5 || ^6 || ^7",
|
|
170
172
|
"react-router": "^7"
|
|
@@ -186,7 +188,7 @@
|
|
|
186
188
|
"scripts": {
|
|
187
189
|
"build": "rslib build",
|
|
188
190
|
"lint": "ESLINT_USE_FLAT_CONFIG=false pnpm exec eslint --ignore-pattern node_modules \"**/*.ts\"",
|
|
189
|
-
"test": "pnpm exec
|
|
191
|
+
"test": "pnpm exec rstest --passWithNoTests",
|
|
190
192
|
"pre-release": "pnpm run test && pnpm run build"
|
|
191
193
|
}
|
|
192
194
|
}
|