@module-federation/rspack 0.13.1 → 0.14.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.
@@ -99,12 +99,26 @@ var ModuleFederationPlugin = /*#__PURE__*/ function() {
99
99
  {
100
100
  key: "_patchBundlerConfig",
101
101
  value: function _patchBundlerConfig(compiler) {
102
- var name = this._options.name;
102
+ var _experiments_optimization;
103
+ var _this__options = this._options, name = _this__options.name, experiments = _this__options.experiments;
104
+ var definePluginOptions = {};
103
105
  if (name) {
104
- new compiler.webpack.DefinePlugin({
105
- FEDERATION_BUILD_IDENTIFIER: JSON.stringify(sdk.composeKeyWithSeparator(name, managers.utils.getBuildVersion()))
106
- }).apply(compiler);
106
+ definePluginOptions['FEDERATION_BUILD_IDENTIFIER'] = JSON.stringify(sdk.composeKeyWithSeparator(name, managers.utils.getBuildVersion()));
107
+ }
108
+ var _experiments_optimization_disableSnapshot;
109
+ // Add FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN
110
+ var disableSnapshot = (_experiments_optimization_disableSnapshot = experiments === null || experiments === void 0 ? void 0 : (_experiments_optimization = experiments.optimization) === null || _experiments_optimization === void 0 ? void 0 : _experiments_optimization.disableSnapshot) !== null && _experiments_optimization_disableSnapshot !== void 0 ? _experiments_optimization_disableSnapshot : false;
111
+ definePluginOptions['FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN'] = disableSnapshot;
112
+ // Determine ENV_TARGET: only if manually specified in experiments.optimization.target
113
+ if ((experiments === null || experiments === void 0 ? void 0 : experiments.optimization) && _type_of(experiments.optimization) === 'object' && experiments.optimization !== null && 'target' in experiments.optimization) {
114
+ var manualTarget = experiments.optimization.target;
115
+ // Ensure the target is one of the expected values before setting
116
+ if (manualTarget === 'web' || manualTarget === 'node') {
117
+ definePluginOptions['ENV_TARGET'] = JSON.stringify(manualTarget);
118
+ }
107
119
  }
120
+ // No inference for ENV_TARGET. If not manually set and valid, it's not defined.
121
+ new compiler.webpack.DefinePlugin(definePluginOptions).apply(compiler);
108
122
  }
109
123
  },
110
124
  {
@@ -159,8 +173,10 @@ var ModuleFederationPlugin = /*#__PURE__*/ function() {
159
173
  var disableManifest = options.manifest === false;
160
174
  var disableDts = options.dts === false;
161
175
  if (!disableDts) {
176
+ var dtsPlugin$1 = new dtsPlugin.DtsPlugin(options);
162
177
  // @ts-ignore
163
- new dtsPlugin.DtsPlugin(options).apply(compiler);
178
+ dtsPlugin$1.apply(compiler);
179
+ dtsPlugin$1.addRuntimePlugins();
164
180
  }
165
181
  if (!disableManifest && options.exposes) {
166
182
  try {
@@ -186,7 +202,7 @@ var ModuleFederationPlugin = /*#__PURE__*/ function() {
186
202
  });
187
203
  if (!disableManifest) {
188
204
  this._statsPlugin = new manifest.StatsPlugin(options, {
189
- pluginVersion: "0.13.1",
205
+ pluginVersion: "0.14.0",
190
206
  bundler: 'rspack'
191
207
  });
192
208
  // @ts-ignore
@@ -97,12 +97,26 @@ var ModuleFederationPlugin = /*#__PURE__*/ function() {
97
97
  {
98
98
  key: "_patchBundlerConfig",
99
99
  value: function _patchBundlerConfig(compiler) {
100
- var name = this._options.name;
100
+ var _experiments_optimization;
101
+ var _this__options = this._options, name = _this__options.name, experiments = _this__options.experiments;
102
+ var definePluginOptions = {};
101
103
  if (name) {
102
- new compiler.webpack.DefinePlugin({
103
- FEDERATION_BUILD_IDENTIFIER: JSON.stringify(composeKeyWithSeparator(name, utils.getBuildVersion()))
104
- }).apply(compiler);
104
+ definePluginOptions['FEDERATION_BUILD_IDENTIFIER'] = JSON.stringify(composeKeyWithSeparator(name, utils.getBuildVersion()));
105
+ }
106
+ var _experiments_optimization_disableSnapshot;
107
+ // Add FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN
108
+ var disableSnapshot = (_experiments_optimization_disableSnapshot = experiments === null || experiments === void 0 ? void 0 : (_experiments_optimization = experiments.optimization) === null || _experiments_optimization === void 0 ? void 0 : _experiments_optimization.disableSnapshot) !== null && _experiments_optimization_disableSnapshot !== void 0 ? _experiments_optimization_disableSnapshot : false;
109
+ definePluginOptions['FEDERATION_OPTIMIZE_NO_SNAPSHOT_PLUGIN'] = disableSnapshot;
110
+ // Determine ENV_TARGET: only if manually specified in experiments.optimization.target
111
+ if ((experiments === null || experiments === void 0 ? void 0 : experiments.optimization) && _type_of(experiments.optimization) === 'object' && experiments.optimization !== null && 'target' in experiments.optimization) {
112
+ var manualTarget = experiments.optimization.target;
113
+ // Ensure the target is one of the expected values before setting
114
+ if (manualTarget === 'web' || manualTarget === 'node') {
115
+ definePluginOptions['ENV_TARGET'] = JSON.stringify(manualTarget);
116
+ }
105
117
  }
118
+ // No inference for ENV_TARGET. If not manually set and valid, it's not defined.
119
+ new compiler.webpack.DefinePlugin(definePluginOptions).apply(compiler);
106
120
  }
107
121
  },
108
122
  {
@@ -157,8 +171,10 @@ var ModuleFederationPlugin = /*#__PURE__*/ function() {
157
171
  var disableManifest = options.manifest === false;
158
172
  var disableDts = options.dts === false;
159
173
  if (!disableDts) {
174
+ var dtsPlugin = new DtsPlugin(options);
160
175
  // @ts-ignore
161
- new DtsPlugin(options).apply(compiler);
176
+ dtsPlugin.apply(compiler);
177
+ dtsPlugin.addRuntimePlugins();
162
178
  }
163
179
  if (!disableManifest && options.exposes) {
164
180
  try {
@@ -184,7 +200,7 @@ var ModuleFederationPlugin = /*#__PURE__*/ function() {
184
200
  });
185
201
  if (!disableManifest) {
186
202
  this._statsPlugin = new StatsPlugin(options, {
187
- pluginVersion: "0.13.1",
203
+ pluginVersion: "0.14.0",
188
204
  bundler: 'rspack'
189
205
  });
190
206
  // @ts-ignore
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@module-federation/rspack",
3
- "version": "0.13.1",
3
+ "version": "0.14.0",
4
4
  "license": "MIT",
5
5
  "keywords": [
6
6
  "Module Federation",
@@ -25,13 +25,13 @@
25
25
  "types": "./dist/index.cjs.d.ts",
26
26
  "dependencies": {
27
27
  "btoa": "1.2.1",
28
- "@module-federation/bridge-react-webpack-plugin": "0.13.1",
29
- "@module-federation/dts-plugin": "0.13.1",
30
- "@module-federation/managers": "0.13.1",
31
- "@module-federation/manifest": "0.13.1",
32
- "@module-federation/runtime-tools": "0.13.1",
33
- "@module-federation/inject-external-runtime-core-plugin": "0.13.1",
34
- "@module-federation/sdk": "0.13.1"
28
+ "@module-federation/bridge-react-webpack-plugin": "0.14.0",
29
+ "@module-federation/dts-plugin": "0.14.0",
30
+ "@module-federation/managers": "0.14.0",
31
+ "@module-federation/manifest": "0.14.0",
32
+ "@module-federation/runtime-tools": "0.14.0",
33
+ "@module-federation/inject-external-runtime-core-plugin": "0.14.0",
34
+ "@module-federation/sdk": "0.14.0"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@rspack/core": "^1.0.2"