@nx/react 19.6.5 → 19.6.7

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/migrations.json CHANGED
@@ -229,6 +229,19 @@
229
229
  "alwaysAddToPackageJson": false
230
230
  }
231
231
  }
232
+ },
233
+ "19.7.0": {
234
+ "version": "19.7.0-beta.0",
235
+ "packages": {
236
+ "@module-federation/enhanced": {
237
+ "version": "~0.6.0",
238
+ "alwaysAddToPackageJson": false
239
+ },
240
+ "@module-federation/node": {
241
+ "version": "~2.5.0",
242
+ "alwaysAddToPackageJson": false
243
+ }
244
+ }
232
245
  }
233
246
  }
234
247
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react",
3
- "version": "19.6.5",
3
+ "version": "19.6.7",
4
4
  "private": false,
5
5
  "description": "The React plugin for Nx contains executors and generators for managing React applications and libraries within an Nx workspace. It provides:\n\n\n- Integration with libraries such as Jest, Vitest, Playwright, Cypress, and Storybook.\n\n- Generators for applications, libraries, components, hooks, and more.\n\n- Library build support for publishing packages to npm or other registries.\n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -38,12 +38,12 @@
38
38
  "file-loader": "^6.2.0",
39
39
  "minimatch": "9.0.3",
40
40
  "tslib": "^2.3.0",
41
- "@module-federation/enhanced": "~0.2.3",
42
- "@nx/devkit": "19.6.5",
43
- "@nx/js": "19.6.5",
44
- "@nx/eslint": "19.6.5",
45
- "@nx/web": "19.6.5",
46
- "@nrwl/react": "19.6.5"
41
+ "@module-federation/enhanced": "~0.6.0",
42
+ "@nx/devkit": "19.6.7",
43
+ "@nx/js": "19.6.7",
44
+ "@nx/eslint": "19.6.7",
45
+ "@nx/web": "19.6.7",
46
+ "@nrwl/react": "19.6.7"
47
47
  },
48
48
  "publishConfig": {
49
49
  "access": "public"
@@ -28,8 +28,9 @@ function getBuildOptions(buildTarget, context) {
28
28
  ...buildOptions,
29
29
  };
30
30
  }
31
- function startSsrStaticRemotesFileServer(ssrStaticRemotesConfig, context, options) {
31
+ async function* startSsrStaticRemotesFileServer(ssrStaticRemotesConfig, context, options) {
32
32
  if (ssrStaticRemotesConfig.remotes.length === 0) {
33
+ yield { success: true };
33
34
  return;
34
35
  }
35
36
  // The directories are usually generated with /browser and /server suffixes so we need to copy them to a common directory
@@ -55,7 +56,7 @@ function startSsrStaticRemotesFileServer(ssrStaticRemotesConfig, context, option
55
56
  sslKey: options.sslKey,
56
57
  cacheSeconds: -1,
57
58
  }, context);
58
- return staticRemotesIter;
59
+ yield* staticRemotesIter;
59
60
  }
60
61
  async function startRemotes(remotes, context, options) {
61
62
  const remoteIters = [];
@@ -176,18 +177,30 @@ async function* moduleFederationSsrDevServer(ssrDevServerOptions, context) {
176
177
  pathToKey: options.sslKey,
177
178
  }
178
179
  : undefined);
179
- return yield* (0, async_iterable_1.combineAsyncIterables)(iter, ...devRemoteIters, ...(staticRemotesIter ? [staticRemotesIter] : []), (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
180
+ const combined = (0, async_iterable_1.combineAsyncIterables)(staticRemotesIter, ...devRemoteIters);
181
+ let refs = 1 + (devRemoteIters?.length ?? 0);
182
+ for await (const result of combined) {
183
+ if (result.success === false)
184
+ throw new Error('Remotes failed to start');
185
+ if (result.success)
186
+ refs--;
187
+ if (refs === 0)
188
+ break;
189
+ }
190
+ return yield* (0, async_iterable_1.combineAsyncIterables)(iter, (0, async_iterable_1.createAsyncIterable)(async ({ next, done }) => {
191
+ const host = options.host ?? 'localhost';
192
+ const baseUrl = `http${options.ssl ? 's' : ''}://${host}:${options.port}`;
180
193
  if (!options.isInitialHost) {
194
+ next({ success: true, baseUrl });
181
195
  done();
182
196
  return;
183
197
  }
184
198
  if (remotes.remotePorts.length === 0) {
199
+ next({ success: true, baseUrl });
185
200
  done();
186
201
  return;
187
202
  }
188
203
  try {
189
- const host = options.host ?? 'localhost';
190
- const baseUrl = `http${options.ssl ? 's' : ''}://${host}:${options.port}`;
191
204
  const portsToWaitFor = staticRemotesIter
192
205
  ? [options.staticRemotesPort, ...remotes.remotePorts]
193
206
  : [...remotes.remotePorts];
@@ -10,13 +10,13 @@ async function withModuleFederationForSSR(options, configOverride) {
10
10
  isServer: true,
11
11
  });
12
12
  return (config) => {
13
- config.target = false;
13
+ config.target = 'async-node';
14
14
  config.output.uniqueName = options.name;
15
15
  config.optimization = {
16
16
  ...(config.optimization ?? {}),
17
17
  runtimeChunk: false,
18
18
  };
19
- config.plugins.push(new (require('@module-federation/node').UniversalFederationPlugin)({
19
+ config.plugins.push(new (require('@module-federation/enhanced').ModuleFederationPlugin)({
20
20
  name: options.name,
21
21
  filename: 'remoteEntry.js',
22
22
  exposes: options.exposes,
@@ -24,10 +24,6 @@ async function withModuleFederationForSSR(options, configOverride) {
24
24
  shared: {
25
25
  ...sharedDependencies,
26
26
  },
27
- library: {
28
- type: 'commonjs-module',
29
- },
30
- isServer: true,
31
27
  /**
32
28
  * Apply user-defined config overrides
33
29
  */
@@ -38,7 +34,11 @@ async function withModuleFederationForSSR(options, configOverride) {
38
34
  ...(configOverride?.runtimePlugins ?? []),
39
35
  require.resolve('@nx/webpack/src/utils/module-federation/plugins/runtime-library-control.plugin.js'),
40
36
  ]
41
- : configOverride?.runtimePlugins,
37
+ : [
38
+ ...(configOverride?.runtimePlugins ?? []),
39
+ require.resolve('@module-federation/node/runtimePlugin'),
40
+ ],
41
+ virtualRuntimeEntry: true,
42
42
  }, {}), sharedLibraries.getReplacementPlugin());
43
43
  // The env var is only set from the module-federation-dev-server
44
44
  // Attach the runtime plugin
@@ -60,6 +60,7 @@ async function withModuleFederation(options, configOverride) {
60
60
  require.resolve('@nx/webpack/src/utils/module-federation/plugins/runtime-library-control.plugin.js'),
61
61
  ]
62
62
  : configOverride?.runtimePlugins,
63
+ virtualRuntimeEntry: true,
63
64
  }), sharedLibraries.getReplacementPlugin());
64
65
  // The env var is only set from the module-federation-dev-server
65
66
  // Attach the runtime plugin
@@ -22,6 +22,7 @@ function addMfEnvToTargetDefaultInputs(tree) {
22
22
  }
23
23
  if (!mfEnvVarExists) {
24
24
  nxJson.targetDefaults[webpackExecutor].inputs.push({ env: mfEnvVar });
25
- (0, devkit_1.updateNxJson)(tree, nxJson);
26
25
  }
26
+ nxJson.targetDefaults[webpackExecutor].cache = true;
27
+ (0, devkit_1.updateNxJson)(tree, nxJson);
27
28
  }
@@ -37,8 +37,8 @@ export declare const typesExpressVersion = "4.17.17";
37
37
  export declare const isbotVersion = "^3.6.5";
38
38
  export declare const corsVersion = "~2.8.5";
39
39
  export declare const typesCorsVersion = "~2.8.12";
40
- export declare const moduleFederationNodeVersion = "~2.4.0";
41
- export declare const moduleFederationEnhancedVersion = "~0.2.3";
40
+ export declare const moduleFederationNodeVersion = "~2.5.0";
41
+ export declare const moduleFederationEnhancedVersion = "~0.6.0";
42
42
  export declare const lessVersion = "3.12.2";
43
43
  export declare const sassVersion = "^1.55.0";
44
44
  export declare const rollupPluginUrlVersion = "^8.0.2";
@@ -43,8 +43,8 @@ exports.typesExpressVersion = '4.17.17';
43
43
  exports.isbotVersion = '^3.6.5';
44
44
  exports.corsVersion = '~2.8.5';
45
45
  exports.typesCorsVersion = '~2.8.12';
46
- exports.moduleFederationNodeVersion = '~2.4.0';
47
- exports.moduleFederationEnhancedVersion = '~0.2.3';
46
+ exports.moduleFederationNodeVersion = '~2.5.0';
47
+ exports.moduleFederationEnhancedVersion = '~0.6.0';
48
48
  // style preprocessors
49
49
  exports.lessVersion = '3.12.2';
50
50
  exports.sassVersion = '^1.55.0';