@module-federation/rspack 2.7.0 → 2.8.1
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.
|
@@ -98,6 +98,9 @@ const external_TreeShakingSharedPlugin_js_namespaceObject = require("./TreeShaki
|
|
|
98
98
|
|
|
99
99
|
|
|
100
100
|
const PLUGIN_NAME = 'RspackModuleFederationPlugin';
|
|
101
|
+
function hasExposes(exposes) {
|
|
102
|
+
return Boolean(exposes && (Array.isArray(exposes) ? exposes.length > 0 : Object.keys(exposes).length > 0));
|
|
103
|
+
}
|
|
101
104
|
function resolveRuntimeEntry(spec, implementation, resolve = require.resolve) {
|
|
102
105
|
const candidates = [
|
|
103
106
|
spec.bundler,
|
|
@@ -135,7 +138,7 @@ function resolveRspackRuntimeAlias(implementation, resolve = require.resolve) {
|
|
|
135
138
|
}
|
|
136
139
|
class ModuleFederationPlugin {
|
|
137
140
|
_patchBundlerConfig(compiler) {
|
|
138
|
-
const { name, experiments } = this._options;
|
|
141
|
+
const { name, experiments, exposes } = this._options;
|
|
139
142
|
const definePluginOptions = {};
|
|
140
143
|
if (name) {
|
|
141
144
|
definePluginOptions['FEDERATION_BUILD_IDENTIFIER'] = JSON.stringify((0,sdk_namespaceObject.composeKeyWithSeparator)(name, managers_namespaceObject.utils.getBuildVersion()));
|
|
@@ -143,6 +146,9 @@ class ModuleFederationPlugin {
|
|
|
143
146
|
// Add FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN
|
|
144
147
|
const disableSnapshot = experiments?.optimization?.disableSnapshot ?? false;
|
|
145
148
|
definePluginOptions['FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN'] = disableSnapshot;
|
|
149
|
+
definePluginOptions['FEDERATION_OPTIMIZE_NO_REMOTE'] = experiments?.optimization?.disableRemote ?? false;
|
|
150
|
+
definePluginOptions['FEDERATION_OPTIMIZE_NO_SHARED'] = experiments?.optimization?.disableShared ?? false;
|
|
151
|
+
definePluginOptions['FEDERATION_HAS_EXPOSES'] = hasExposes(exposes);
|
|
146
152
|
// Determine ENV_TARGET: only if manually specified in experiments.optimization.target
|
|
147
153
|
if (experiments?.optimization && typeof experiments.optimization === 'object' && experiments.optimization !== null && 'target' in experiments.optimization) {
|
|
148
154
|
const manualTarget = experiments.optimization.target;
|
|
@@ -233,7 +239,7 @@ class ModuleFederationPlugin {
|
|
|
233
239
|
});
|
|
234
240
|
if (!disableManifest) {
|
|
235
241
|
this._statsPlugin = new manifest_namespaceObject.StatsPlugin(options, {
|
|
236
|
-
pluginVersion: "2.
|
|
242
|
+
pluginVersion: "2.8.1",
|
|
237
243
|
bundler: 'rspack'
|
|
238
244
|
});
|
|
239
245
|
// @ts-ignore
|
|
@@ -28,6 +28,9 @@ import logger from "./logger.mjs";
|
|
|
28
28
|
|
|
29
29
|
|
|
30
30
|
const PLUGIN_NAME = 'RspackModuleFederationPlugin';
|
|
31
|
+
function hasExposes(exposes) {
|
|
32
|
+
return Boolean(exposes && (Array.isArray(exposes) ? exposes.length > 0 : Object.keys(exposes).length > 0));
|
|
33
|
+
}
|
|
31
34
|
function resolveRuntimeEntry(spec, implementation, resolve = require.resolve) {
|
|
32
35
|
const candidates = [
|
|
33
36
|
spec.bundler,
|
|
@@ -65,7 +68,7 @@ function resolveRspackRuntimeAlias(implementation, resolve = require.resolve) {
|
|
|
65
68
|
}
|
|
66
69
|
class ModuleFederationPlugin {
|
|
67
70
|
_patchBundlerConfig(compiler) {
|
|
68
|
-
const { name, experiments } = this._options;
|
|
71
|
+
const { name, experiments, exposes } = this._options;
|
|
69
72
|
const definePluginOptions = {};
|
|
70
73
|
if (name) {
|
|
71
74
|
definePluginOptions['FEDERATION_BUILD_IDENTIFIER'] = JSON.stringify(composeKeyWithSeparator(name, utils.getBuildVersion()));
|
|
@@ -73,6 +76,9 @@ class ModuleFederationPlugin {
|
|
|
73
76
|
// Add FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN
|
|
74
77
|
const disableSnapshot = experiments?.optimization?.disableSnapshot ?? false;
|
|
75
78
|
definePluginOptions['FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN'] = disableSnapshot;
|
|
79
|
+
definePluginOptions['FEDERATION_OPTIMIZE_NO_REMOTE'] = experiments?.optimization?.disableRemote ?? false;
|
|
80
|
+
definePluginOptions['FEDERATION_OPTIMIZE_NO_SHARED'] = experiments?.optimization?.disableShared ?? false;
|
|
81
|
+
definePluginOptions['FEDERATION_HAS_EXPOSES'] = hasExposes(exposes);
|
|
76
82
|
// Determine ENV_TARGET: only if manually specified in experiments.optimization.target
|
|
77
83
|
if (experiments?.optimization && typeof experiments.optimization === 'object' && experiments.optimization !== null && 'target' in experiments.optimization) {
|
|
78
84
|
const manualTarget = experiments.optimization.target;
|
|
@@ -163,7 +169,7 @@ class ModuleFederationPlugin {
|
|
|
163
169
|
});
|
|
164
170
|
if (!disableManifest) {
|
|
165
171
|
this._statsPlugin = new StatsPlugin(options, {
|
|
166
|
-
pluginVersion: "2.
|
|
172
|
+
pluginVersion: "2.8.1",
|
|
167
173
|
bundler: 'rspack'
|
|
168
174
|
});
|
|
169
175
|
// @ts-ignore
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
1
|
export { ModuleFederationPlugin, PLUGIN_NAME } from './ModuleFederationPlugin';
|
|
2
|
-
|
|
3
|
-
export declare const
|
|
2
|
+
import { container } from '@rspack/core';
|
|
3
|
+
export declare const ContainerPlugin: typeof container.ContainerPlugin;
|
|
4
|
+
export declare const ContainerReferencePlugin: typeof container.ContainerReferencePlugin;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@module-federation/rspack",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"Module Federation",
|
|
@@ -24,17 +24,17 @@
|
|
|
24
24
|
"module": "./dist/index.mjs",
|
|
25
25
|
"types": "./dist/index.d.ts",
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"@module-federation/bridge-react-webpack-plugin": "2.
|
|
28
|
-
"@module-federation/dts-plugin": "2.
|
|
29
|
-
"@module-federation/managers": "2.
|
|
30
|
-
"@module-federation/
|
|
31
|
-
"@module-federation/
|
|
32
|
-
"@module-federation/inject-external-runtime-core-plugin": "2.
|
|
33
|
-
"@module-federation/sdk": "2.
|
|
27
|
+
"@module-federation/bridge-react-webpack-plugin": "2.8.1",
|
|
28
|
+
"@module-federation/dts-plugin": "2.8.1",
|
|
29
|
+
"@module-federation/managers": "2.8.1",
|
|
30
|
+
"@module-federation/runtime-tools": "2.8.1",
|
|
31
|
+
"@module-federation/manifest": "2.8.1",
|
|
32
|
+
"@module-federation/inject-external-runtime-core-plugin": "2.8.1",
|
|
33
|
+
"@module-federation/sdk": "2.8.1"
|
|
34
34
|
},
|
|
35
35
|
"devDependencies": {
|
|
36
36
|
"@rspack/core": "^1.0.2",
|
|
37
|
-
"typescript": "
|
|
37
|
+
"typescript": "7.0.2"
|
|
38
38
|
},
|
|
39
39
|
"exports": {
|
|
40
40
|
".": {
|
|
@@ -82,7 +82,7 @@
|
|
|
82
82
|
}
|
|
83
83
|
},
|
|
84
84
|
"peerDependencies": {
|
|
85
|
-
"typescript": "^4.9.0 || ^5.0.0 || ^6.0.0",
|
|
85
|
+
"typescript": "^4.9.0 || ^5.0.0 || ^6.0.0 || ^7.0.0",
|
|
86
86
|
"vue-tsc": ">=1.0.24",
|
|
87
87
|
"@rspack/core": "^0.7.0 || ^1.0.0 || ^2.0.0-0"
|
|
88
88
|
},
|