@module-federation/modern-js 2.7.0 → 2.8.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 +28 -10
- package/dist/cjs/cli/index.js +11 -7
- package/dist/cjs/cli/mfRuntimePlugins/inject-node-fetch.js +14 -21
- 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 +11 -7
- 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 +13 -9
- 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 +19 -15
- package/dist/esm/cli/index.mjs +2 -1
- package/dist/esm/cli/mfRuntimePlugins/inject-node-fetch.mjs +2 -3
- 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 +2 -1
- 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 +5 -4
- package/dist/esm/server/index.mjs +2 -1
- package/dist/esm/types/index.mjs +1 -0
- package/dist/esm-node/cli/configPlugin.mjs +18 -15
- package/dist/esm-node/cli/index.mjs +2 -1
- package/dist/esm-node/cli/mfRuntimePlugins/inject-node-fetch.mjs +2 -3
- 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 +2 -1
- 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/fileCache.mjs +4 -4
- package/dist/esm-node/server/index.mjs +2 -1
- package/dist/esm-node/types/index.mjs +1 -0
- package/dist/types/cli/configPlugin.d.ts +1 -0
- package/dist/types/server/fileCache.d.ts +1 -0
- package/dist/types/types/index.d.ts +6 -0
- package/package.json +15 -17
- package/dist/types/cli/configPlugin.spec.d.ts +0 -1
- package/dist/types/cli/ssrPlugin.spec.d.ts +0 -1
- package/dist/types/server/fileCache.spec.d.ts +0 -1
- package/dist/types/server/staticMiddleware.spec.d.ts +0 -1
|
@@ -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,16 @@ 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,
|
|
62
|
+
setDefaultOptimizationTarget: ()=>setDefaultOptimizationTarget,
|
|
58
63
|
setEnv: ()=>setEnv,
|
|
59
|
-
|
|
64
|
+
skipByTarget: ()=>external_utils_js_namespaceObject.skipByTarget
|
|
60
65
|
});
|
|
61
66
|
const external_fs_namespaceObject = require("fs");
|
|
62
67
|
var external_fs_default = /*#__PURE__*/ __webpack_require__.n(external_fs_namespaceObject);
|
|
@@ -163,6 +168,13 @@ var __webpack_exports__ = {};
|
|
|
163
168
|
mfConfig.dev = false;
|
|
164
169
|
return mfConfig;
|
|
165
170
|
};
|
|
171
|
+
const setDefaultOptimizationTarget = (mfConfig, enableSSR, isServer, autoOptimization = true)=>{
|
|
172
|
+
var _mfConfig, _mfConfig_experiments, _mfConfig_experiments_optimization;
|
|
173
|
+
if (!autoOptimization) return;
|
|
174
|
+
(_mfConfig = mfConfig).experiments || (_mfConfig.experiments = {});
|
|
175
|
+
(_mfConfig_experiments = mfConfig.experiments).optimization || (_mfConfig_experiments.optimization = {});
|
|
176
|
+
null != (_mfConfig_experiments_optimization = mfConfig.experiments.optimization).target || (_mfConfig_experiments_optimization.target = enableSSR && isServer ? 'node' : 'web');
|
|
177
|
+
};
|
|
166
178
|
function patchIgnoreWarning(chain) {
|
|
167
179
|
const ignoreWarnings = chain.get('ignoreWarnings') || [];
|
|
168
180
|
const ignoredMsgs = [
|
|
@@ -231,7 +243,10 @@ var __webpack_exports__ = {};
|
|
|
231
243
|
}
|
|
232
244
|
}
|
|
233
245
|
if ((0, external_utils_js_namespaceObject.isDev)() && enableSSR && !isServer) chain.resolve.fallback.set('crypto', false).set('stream', false).set('vm', false);
|
|
234
|
-
if ((null == (_modernjsConfig_deploy = modernjsConfig.deploy) ? void 0 : _modernjsConfig_deploy.microFrontend) && Object.keys(mfConfig.exposes || {}).length)
|
|
246
|
+
if ((null == (_modernjsConfig_deploy = modernjsConfig.deploy) ? void 0 : _modernjsConfig_deploy.microFrontend) && Object.keys(mfConfig.exposes || {}).length) {
|
|
247
|
+
external_logger_js_default().info('optimization.usedExports is set to "global" to avoid tree shaking issues in micro frontend mode.');
|
|
248
|
+
chain.optimization.usedExports('global');
|
|
249
|
+
}
|
|
235
250
|
}
|
|
236
251
|
const moduleFederationConfigPlugin = (userConfig)=>({
|
|
237
252
|
name: '@modern-js/plugin-module-federation-config',
|
|
@@ -259,6 +274,7 @@ var __webpack_exports__ = {};
|
|
|
259
274
|
const isWeb = (0, external_utils_js_namespaceObject.isWebTarget)(target);
|
|
260
275
|
addMyTypes2Ignored(chain, isWeb ? csrConfig : ssrConfig);
|
|
261
276
|
const targetMFConfig = isWeb ? csrConfig : ssrConfig;
|
|
277
|
+
setDefaultOptimizationTarget(targetMFConfig, enableSSR, !isWeb, userConfig.originPluginOptions.autoOptimization);
|
|
262
278
|
patchMFConfig(targetMFConfig, !isWeb);
|
|
263
279
|
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) {
|
|
264
280
|
var _targetMFConfig;
|
|
@@ -328,6 +344,7 @@ exports.isWebTarget = __webpack_exports__.isWebTarget;
|
|
|
328
344
|
exports.moduleFederationConfigPlugin = __webpack_exports__.moduleFederationConfigPlugin;
|
|
329
345
|
exports.patchBundlerConfig = __webpack_exports__.patchBundlerConfig;
|
|
330
346
|
exports.patchMFConfig = __webpack_exports__.patchMFConfig;
|
|
347
|
+
exports.setDefaultOptimizationTarget = __webpack_exports__.setDefaultOptimizationTarget;
|
|
331
348
|
exports.setEnv = __webpack_exports__.setEnv;
|
|
332
349
|
exports.skipByTarget = __webpack_exports__.skipByTarget;
|
|
333
350
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
@@ -338,6 +355,7 @@ for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
|
338
355
|
"moduleFederationConfigPlugin",
|
|
339
356
|
"patchBundlerConfig",
|
|
340
357
|
"patchMFConfig",
|
|
358
|
+
"setDefaultOptimizationTarget",
|
|
341
359
|
"setEnv",
|
|
342
360
|
"skipByTarget"
|
|
343
361
|
].indexOf(__rspack_i)) exports[__rspack_i] = __webpack_exports__[__rspack_i];
|
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 enhanced_namespaceObject = require("@module-federation/enhanced");
|
|
32
36
|
const rspack_namespaceObject = require("@module-federation/enhanced/rspack");
|
|
@@ -1,20 +1,15 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var __webpack_require__ = {};
|
|
3
3
|
(()=>{
|
|
4
|
-
__webpack_require__.
|
|
5
|
-
var
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
(
|
|
13
|
-
__webpack_require__.d = (exports1, definition)=>{
|
|
14
|
-
for(var key in definition)if (__webpack_require__.o(definition, key) && !__webpack_require__.o(exports1, key)) Object.defineProperty(exports1, key, {
|
|
15
|
-
enumerable: true,
|
|
16
|
-
get: definition[key]
|
|
17
|
-
});
|
|
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");
|
|
18
13
|
};
|
|
19
14
|
})();
|
|
20
15
|
(()=>{
|
|
@@ -32,19 +27,17 @@ var __webpack_require__ = {};
|
|
|
32
27
|
})();
|
|
33
28
|
var __webpack_exports__ = {};
|
|
34
29
|
__webpack_require__.r(__webpack_exports__);
|
|
35
|
-
__webpack_require__.d(__webpack_exports__, {
|
|
36
|
-
default: ()=>inject_node_fetch
|
|
37
|
-
});
|
|
38
|
-
const external_node_fetch_namespaceObject = require("node-fetch");
|
|
39
|
-
var external_node_fetch_default = /*#__PURE__*/ __webpack_require__.n(external_node_fetch_namespaceObject);
|
|
40
30
|
const injectNodeFetchPlugin = ()=>({
|
|
41
31
|
name: 'inject-node-fetch-plugin',
|
|
42
32
|
beforeInit (args) {
|
|
43
|
-
if (!globalThis.fetch)
|
|
33
|
+
if (!globalThis.fetch) throw new Error('@module-federation/modern-js requires Node.js 18 or later.');
|
|
44
34
|
return args;
|
|
45
35
|
}
|
|
46
36
|
});
|
|
47
|
-
const
|
|
37
|
+
const __rspack_default_export = injectNodeFetchPlugin;
|
|
38
|
+
__webpack_require__.d(__webpack_exports__, {}, {
|
|
39
|
+
default: __rspack_default_export
|
|
40
|
+
});
|
|
48
41
|
exports["default"] = __webpack_exports__["default"];
|
|
49
42
|
for(var __rspack_i in __webpack_exports__)if (-1 === [
|
|
50
43
|
"default"
|
|
@@ -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);
|
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
|
(()=>{
|
|
@@ -28,7 +32,7 @@ __webpack_require__.d(__webpack_exports__, {
|
|
|
28
32
|
fileCache: ()=>fileCache
|
|
29
33
|
});
|
|
30
34
|
const promises_namespaceObject = require("fs/promises");
|
|
31
|
-
const
|
|
35
|
+
const size_limited_cache_namespaceObject = require("@module-federation/bridge-react/size-limited-cache");
|
|
32
36
|
const pathExists = async (filepath)=>{
|
|
33
37
|
try {
|
|
34
38
|
await (0, promises_namespaceObject.access)(filepath);
|
|
@@ -64,9 +68,9 @@ class FileCache {
|
|
|
64
68
|
return null;
|
|
65
69
|
}
|
|
66
70
|
}
|
|
67
|
-
constructor(){
|
|
68
|
-
this.cache = new
|
|
69
|
-
maxSize
|
|
71
|
+
constructor(maxSize = 209715200){
|
|
72
|
+
this.cache = new size_limited_cache_namespaceObject.SizeLimitedCache({
|
|
73
|
+
maxSize
|
|
70
74
|
});
|
|
71
75
|
}
|
|
72
76
|
}
|
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);
|
|
@@ -147,6 +138,14 @@ var configPlugin_patchMFConfig = function(mfConfig, isServer) {
|
|
|
147
138
|
mfConfig.dev = false;
|
|
148
139
|
return mfConfig;
|
|
149
140
|
};
|
|
141
|
+
var configPlugin_setDefaultOptimizationTarget = function(mfConfig, enableSSR, isServer) {
|
|
142
|
+
var autoOptimization = arguments.length > 3 && void 0 !== arguments[3] ? arguments[3] : true;
|
|
143
|
+
var _mfConfig, _mfConfig_experiments, _mfConfig_experiments_optimization;
|
|
144
|
+
if (!autoOptimization) return;
|
|
145
|
+
(_mfConfig = mfConfig).experiments || (_mfConfig.experiments = {});
|
|
146
|
+
(_mfConfig_experiments = mfConfig.experiments).optimization || (_mfConfig_experiments.optimization = {});
|
|
147
|
+
null != (_mfConfig_experiments_optimization = mfConfig.experiments.optimization).target || (_mfConfig_experiments_optimization.target = enableSSR && isServer ? 'node' : 'web');
|
|
148
|
+
};
|
|
150
149
|
function patchIgnoreWarning(chain) {
|
|
151
150
|
var ignoreWarnings = chain.get('ignoreWarnings') || [];
|
|
152
151
|
var ignoredMsgs = [
|
|
@@ -213,7 +212,10 @@ function patchBundlerConfig(options) {
|
|
|
213
212
|
}
|
|
214
213
|
}
|
|
215
214
|
if (isDev() && enableSSR && !isServer) chain.resolve.fallback.set('crypto', false).set('stream', false).set('vm', false);
|
|
216
|
-
if ((null == (_modernjsConfig_deploy = modernjsConfig.deploy) ? void 0 : _modernjsConfig_deploy.microFrontend) && Object.keys(mfConfig.exposes || {}).length)
|
|
215
|
+
if ((null == (_modernjsConfig_deploy = modernjsConfig.deploy) ? void 0 : _modernjsConfig_deploy.microFrontend) && Object.keys(mfConfig.exposes || {}).length) {
|
|
216
|
+
logger.info('optimization.usedExports is set to "global" to avoid tree shaking issues in micro frontend mode.');
|
|
217
|
+
chain.optimization.usedExports('global');
|
|
218
|
+
}
|
|
217
219
|
}
|
|
218
220
|
var configPlugin_moduleFederationConfigPlugin = function(userConfig) {
|
|
219
221
|
return {
|
|
@@ -250,6 +252,7 @@ var configPlugin_moduleFederationConfigPlugin = function(userConfig) {
|
|
|
250
252
|
var isWeb = isWebTarget(target);
|
|
251
253
|
addMyTypes2Ignored(chain, isWeb ? csrConfig : ssrConfig);
|
|
252
254
|
var targetMFConfig = isWeb ? csrConfig : ssrConfig;
|
|
255
|
+
configPlugin_setDefaultOptimizationTarget(targetMFConfig, enableSSR, !isWeb, userConfig.originPluginOptions.autoOptimization);
|
|
253
256
|
configPlugin_patchMFConfig(targetMFConfig, !isWeb);
|
|
254
257
|
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
258
|
var _targetMFConfig;
|
|
@@ -318,4 +321,5 @@ var configPlugin_moduleFederationConfigPlugin = function(userConfig) {
|
|
|
318
321
|
};
|
|
319
322
|
};
|
|
320
323
|
var configPlugin = configPlugin_moduleFederationConfigPlugin;
|
|
321
|
-
export
|
|
324
|
+
export default configPlugin;
|
|
325
|
+
export { addMyTypes2Ignored, configPlugin_getMFConfig as getMFConfig, configPlugin_moduleFederationConfigPlugin as moduleFederationConfigPlugin, configPlugin_patchMFConfig as patchMFConfig, configPlugin_setDefaultOptimizationTarget as setDefaultOptimizationTarget, isWebTarget, patchBundlerConfig, setEnv, skipByTarget };
|
package/dist/esm/cli/index.mjs
CHANGED
|
@@ -88,4 +88,5 @@ var cli_moduleFederationPlugin = function() {
|
|
|
88
88
|
};
|
|
89
89
|
};
|
|
90
90
|
var cli = cli_moduleFederationPlugin;
|
|
91
|
-
export
|
|
91
|
+
export default cli;
|
|
92
|
+
export { cli_moduleFederationPlugin as moduleFederationPlugin, createModuleFederationConfig };
|
|
@@ -1,12 +1,11 @@
|
|
|
1
|
-
import node_fetch from "node-fetch";
|
|
2
1
|
var inject_node_fetch_injectNodeFetchPlugin = function() {
|
|
3
2
|
return {
|
|
4
3
|
name: 'inject-node-fetch-plugin',
|
|
5
4
|
beforeInit: function(args) {
|
|
6
|
-
if (!globalThis.fetch)
|
|
5
|
+
if (!globalThis.fetch) throw new Error('@module-federation/modern-js requires Node.js 18 or later.');
|
|
7
6
|
return args;
|
|
8
7
|
}
|
|
9
8
|
};
|
|
10
9
|
};
|
|
11
10
|
var inject_node_fetch = inject_node_fetch_injectNodeFetchPlugin;
|
|
12
|
-
export
|
|
11
|
+
export default inject_node_fetch;
|
|
@@ -294,4 +294,5 @@ var ssrPlugin_moduleFederationSSRPlugin = function(pluginOptions) {
|
|
|
294
294
|
};
|
|
295
295
|
};
|
|
296
296
|
var ssrPlugin = ssrPlugin_moduleFederationSSRPlugin;
|
|
297
|
-
export
|
|
297
|
+
export default ssrPlugin;
|
|
298
|
+
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__ };
|
|
@@ -2,7 +2,7 @@ import { _ } from "@swc/helpers/_/_async_to_generator";
|
|
|
2
2
|
import { _ as _class_call_check__ } from "@swc/helpers/_/_class_call_check";
|
|
3
3
|
import { _ as _ts_generator__ } from "@swc/helpers/_/_ts_generator";
|
|
4
4
|
import { access, lstat, readFile } from "fs/promises";
|
|
5
|
-
import {
|
|
5
|
+
import { SizeLimitedCache } from "@module-federation/bridge-react/size-limited-cache";
|
|
6
6
|
var fileCache_pathExists = function(filepath) {
|
|
7
7
|
return _(function() {
|
|
8
8
|
return _ts_generator__(this, function(_state) {
|
|
@@ -41,9 +41,10 @@ var fileCache_pathExists = function(filepath) {
|
|
|
41
41
|
var fileCache_FileCache = /*#__PURE__*/ function() {
|
|
42
42
|
"use strict";
|
|
43
43
|
function FileCache() {
|
|
44
|
+
var maxSize = arguments.length > 0 && void 0 !== arguments[0] ? arguments[0] : 209715200;
|
|
44
45
|
_class_call_check__(this, FileCache);
|
|
45
|
-
this.cache = new
|
|
46
|
-
maxSize:
|
|
46
|
+
this.cache = new SizeLimitedCache({
|
|
47
|
+
maxSize: maxSize
|
|
47
48
|
});
|
|
48
49
|
}
|
|
49
50
|
var _proto = FileCache.prototype;
|
|
@@ -122,4 +123,4 @@ var fileCache_FileCache = /*#__PURE__*/ function() {
|
|
|
122
123
|
return FileCache;
|
|
123
124
|
}();
|
|
124
125
|
var fileCache = new fileCache_FileCache();
|
|
125
|
-
export { fileCache_FileCache as FileCache
|
|
126
|
+
export { fileCache, fileCache_FileCache as FileCache };
|
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);
|
|
@@ -116,6 +107,13 @@ const patchMFConfig = (mfConfig, isServer)=>{
|
|
|
116
107
|
mfConfig.dev = false;
|
|
117
108
|
return mfConfig;
|
|
118
109
|
};
|
|
110
|
+
const setDefaultOptimizationTarget = (mfConfig, enableSSR, isServer, autoOptimization = true)=>{
|
|
111
|
+
var _mfConfig, _mfConfig_experiments, _mfConfig_experiments_optimization;
|
|
112
|
+
if (!autoOptimization) return;
|
|
113
|
+
(_mfConfig = mfConfig).experiments || (_mfConfig.experiments = {});
|
|
114
|
+
(_mfConfig_experiments = mfConfig.experiments).optimization || (_mfConfig_experiments.optimization = {});
|
|
115
|
+
null != (_mfConfig_experiments_optimization = mfConfig.experiments.optimization).target || (_mfConfig_experiments_optimization.target = enableSSR && isServer ? 'node' : 'web');
|
|
116
|
+
};
|
|
119
117
|
function patchIgnoreWarning(chain) {
|
|
120
118
|
const ignoreWarnings = chain.get('ignoreWarnings') || [];
|
|
121
119
|
const ignoredMsgs = [
|
|
@@ -184,7 +182,10 @@ function patchBundlerConfig(options) {
|
|
|
184
182
|
}
|
|
185
183
|
}
|
|
186
184
|
if (isDev() && enableSSR && !isServer) chain.resolve.fallback.set('crypto', false).set('stream', false).set('vm', false);
|
|
187
|
-
if ((null == (_modernjsConfig_deploy = modernjsConfig.deploy) ? void 0 : _modernjsConfig_deploy.microFrontend) && Object.keys(mfConfig.exposes || {}).length)
|
|
185
|
+
if ((null == (_modernjsConfig_deploy = modernjsConfig.deploy) ? void 0 : _modernjsConfig_deploy.microFrontend) && Object.keys(mfConfig.exposes || {}).length) {
|
|
186
|
+
logger.info('optimization.usedExports is set to "global" to avoid tree shaking issues in micro frontend mode.');
|
|
187
|
+
chain.optimization.usedExports('global');
|
|
188
|
+
}
|
|
188
189
|
}
|
|
189
190
|
const moduleFederationConfigPlugin = (userConfig)=>({
|
|
190
191
|
name: '@modern-js/plugin-module-federation-config',
|
|
@@ -212,6 +213,7 @@ const moduleFederationConfigPlugin = (userConfig)=>({
|
|
|
212
213
|
const isWeb = isWebTarget(target);
|
|
213
214
|
addMyTypes2Ignored(chain, isWeb ? csrConfig : ssrConfig);
|
|
214
215
|
const targetMFConfig = isWeb ? csrConfig : ssrConfig;
|
|
216
|
+
setDefaultOptimizationTarget(targetMFConfig, enableSSR, !isWeb, userConfig.originPluginOptions.autoOptimization);
|
|
215
217
|
patchMFConfig(targetMFConfig, !isWeb);
|
|
216
218
|
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) {
|
|
217
219
|
var _targetMFConfig;
|
|
@@ -273,4 +275,5 @@ const moduleFederationConfigPlugin = (userConfig)=>({
|
|
|
273
275
|
}
|
|
274
276
|
});
|
|
275
277
|
const configPlugin = moduleFederationConfigPlugin;
|
|
276
|
-
export
|
|
278
|
+
export default configPlugin;
|
|
279
|
+
export { addMyTypes2Ignored, getMFConfig, isWebTarget, moduleFederationConfigPlugin, patchBundlerConfig, patchMFConfig, setDefaultOptimizationTarget, setEnv, skipByTarget };
|
|
@@ -72,4 +72,5 @@ const moduleFederationPlugin = (userConfig = {})=>{
|
|
|
72
72
|
};
|
|
73
73
|
};
|
|
74
74
|
const cli = moduleFederationPlugin;
|
|
75
|
-
export
|
|
75
|
+
export default cli;
|
|
76
|
+
export { createModuleFederationConfig, moduleFederationPlugin };
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import node_fetch from "node-fetch";
|
|
2
1
|
const injectNodeFetchPlugin = ()=>({
|
|
3
2
|
name: 'inject-node-fetch-plugin',
|
|
4
3
|
beforeInit (args) {
|
|
5
|
-
if (!globalThis.fetch)
|
|
4
|
+
if (!globalThis.fetch) throw new Error('@module-federation/modern-js requires Node.js 18 or later.');
|
|
6
5
|
return args;
|
|
7
6
|
}
|
|
8
7
|
});
|
|
9
8
|
const inject_node_fetch = injectNodeFetchPlugin;
|
|
10
|
-
export
|
|
9
|
+
export default inject_node_fetch;
|
|
@@ -255,4 +255,5 @@ const moduleFederationSSRPlugin = (pluginOptions)=>({
|
|
|
255
255
|
}
|
|
256
256
|
});
|
|
257
257
|
const ssrPlugin = moduleFederationSSRPlugin;
|
|
258
|
-
export
|
|
258
|
+
export default ssrPlugin;
|
|
259
|
+
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__ };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { access, lstat, readFile } from "fs/promises";
|
|
2
|
-
import {
|
|
2
|
+
import { SizeLimitedCache } from "@module-federation/bridge-react/size-limited-cache";
|
|
3
3
|
const pathExists = async (filepath)=>{
|
|
4
4
|
try {
|
|
5
5
|
await access(filepath);
|
|
@@ -35,9 +35,9 @@ class FileCache {
|
|
|
35
35
|
return null;
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
|
-
constructor(){
|
|
39
|
-
this.cache = new
|
|
40
|
-
maxSize
|
|
38
|
+
constructor(maxSize = 209715200){
|
|
39
|
+
this.cache = new SizeLimitedCache({
|
|
40
|
+
maxSize
|
|
41
41
|
});
|
|
42
42
|
}
|
|
43
43
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { };
|
|
@@ -8,6 +8,7 @@ export type ConfigType<T> = T extends 'webpack' ? webpack.Configuration : T exte
|
|
|
8
8
|
export declare function setEnv(enableSSR: boolean): void;
|
|
9
9
|
export declare const getMFConfig: (userConfig: PluginOptions) => Promise<moduleFederationPlugin.ModuleFederationPluginOptions>;
|
|
10
10
|
export declare const patchMFConfig: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, isServer: boolean) => moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
11
|
+
export declare const setDefaultOptimizationTarget: (mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions, enableSSR: boolean, isServer: boolean, autoOptimization?: boolean) => void;
|
|
11
12
|
export declare function addMyTypes2Ignored(chain: BundlerChainConfig, mfConfig: moduleFederationPlugin.ModuleFederationPluginOptions): void;
|
|
12
13
|
export declare function patchBundlerConfig(options: {
|
|
13
14
|
chain: BundlerChainConfig;
|
|
@@ -3,6 +3,12 @@ import type { StatsAssetResource } from '@module-federation/rsbuild-plugin/utils
|
|
|
3
3
|
export interface PluginOptions {
|
|
4
4
|
config?: moduleFederationPlugin.ModuleFederationPluginOptions;
|
|
5
5
|
configPath?: string;
|
|
6
|
+
/**
|
|
7
|
+
* Automatically set the federation optimization target from the Modern.js
|
|
8
|
+
* SSR and bundler target configuration.
|
|
9
|
+
* @default true
|
|
10
|
+
*/
|
|
11
|
+
autoOptimization?: boolean;
|
|
6
12
|
ssr?: {
|
|
7
13
|
distOutputDir?: string;
|
|
8
14
|
} | boolean;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/modern-js",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"files": [
|
|
5
5
|
"dist/",
|
|
6
6
|
"types.d.ts",
|
|
@@ -131,40 +131,38 @@
|
|
|
131
131
|
"types": "./dist/types/cli/index.d.ts",
|
|
132
132
|
"author": "hanric <hanric.zhang@gmail.com>",
|
|
133
133
|
"license": "MIT",
|
|
134
|
+
"engines": {
|
|
135
|
+
"node": ">=18.0.0"
|
|
136
|
+
},
|
|
134
137
|
"dependencies": {
|
|
135
|
-
"@modern-js/utils": "2.70.5",
|
|
136
|
-
"lru-cache": "10.4.3",
|
|
137
138
|
"@swc/helpers": "0.5.17",
|
|
138
|
-
"node-fetch": "3.3.0",
|
|
139
139
|
"jiti": "2.4.2",
|
|
140
|
-
"
|
|
141
|
-
"@module-federation/
|
|
142
|
-
"@module-federation/bridge-react": "2.
|
|
143
|
-
"@module-federation/
|
|
144
|
-
"@module-federation/
|
|
145
|
-
"@module-federation/
|
|
146
|
-
"@module-federation/
|
|
147
|
-
"@module-federation/node": "2.7.46"
|
|
140
|
+
"@module-federation/rsbuild-plugin": "2.8.0",
|
|
141
|
+
"@module-federation/runtime": "2.8.0",
|
|
142
|
+
"@module-federation/bridge-react": "2.8.0",
|
|
143
|
+
"@module-federation/node": "2.7.47",
|
|
144
|
+
"@module-federation/sdk": "2.8.0",
|
|
145
|
+
"@module-federation/cli": "2.8.0",
|
|
146
|
+
"@module-federation/enhanced": "2.8.0"
|
|
148
147
|
},
|
|
149
148
|
"devDependencies": {
|
|
150
149
|
"@rsbuild/plugin-react": "1.4.5",
|
|
151
150
|
"@rstest/core": "^0.10.6",
|
|
152
|
-
"@rslib/core": "0.
|
|
151
|
+
"@rslib/core": "0.23.2",
|
|
153
152
|
"@rsbuild/core": "1.3.21",
|
|
154
153
|
"@modern-js/app-tools": "2.70.5",
|
|
155
154
|
"@modern-js/server-runtime": "2.70.5",
|
|
156
155
|
"@modern-js/module-tools": "2.70.5",
|
|
157
156
|
"@modern-js/runtime": "2.70.5",
|
|
158
|
-
"@modern-js/tsconfig": "2.70.5",
|
|
159
157
|
"@types/react": "^18.3.11",
|
|
160
158
|
"@types/react-dom": "^18.3.0",
|
|
161
|
-
"typescript": "
|
|
162
|
-
"@module-federation/manifest": "2.
|
|
159
|
+
"typescript": "7.0.2",
|
|
160
|
+
"@module-federation/manifest": "2.8.0"
|
|
163
161
|
},
|
|
164
162
|
"peerDependencies": {
|
|
165
163
|
"react": ">=17",
|
|
166
164
|
"react-dom": ">=17",
|
|
167
|
-
"typescript": "^4.9.0 || ^5.0.0 || ^6.0.0",
|
|
165
|
+
"typescript": "^4.9.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
168
166
|
"vue-tsc": "^1.0.24",
|
|
169
167
|
"react-router-dom": "^4 || ^5 || ^6 || ^7",
|
|
170
168
|
"react-router": "^7"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|