@nx/react 20.5.0-canary.20250213-b8ee838 → 21.0.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react",
3
- "version": "20.5.0-canary.20250213-b8ee838",
3
+ "version": "21.0.0-beta.0",
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,11 +38,11 @@
38
38
  "minimatch": "9.0.3",
39
39
  "picocolors": "^1.1.0",
40
40
  "tslib": "^2.3.0",
41
- "@nx/devkit": "20.5.0-canary.20250213-b8ee838",
42
- "@nx/js": "20.5.0-canary.20250213-b8ee838",
43
- "@nx/eslint": "20.5.0-canary.20250213-b8ee838",
44
- "@nx/web": "20.5.0-canary.20250213-b8ee838",
45
- "@nx/module-federation": "20.5.0-canary.20250213-b8ee838",
41
+ "@nx/devkit": "21.0.0-beta.0",
42
+ "@nx/js": "21.0.0-beta.0",
43
+ "@nx/eslint": "21.0.0-beta.0",
44
+ "@nx/web": "21.0.0-beta.0",
45
+ "@nx/module-federation": "21.0.0-beta.0",
46
46
  "express": "^4.21.2",
47
47
  "http-proxy-middleware": "^3.0.3",
48
48
  "semver": "^7.6.3"
@@ -92,6 +92,9 @@ async function applicationGeneratorInternal(tree, schema) {
92
92
  if (options.bundler === 'vite') {
93
93
  await (0, add_vite_1.setupViteConfiguration)(tree, options, tasks);
94
94
  }
95
+ else if (options.bundler === 'rspack') {
96
+ await (0, add_rspack_1.setupRspackConfiguration)(tree, options, tasks);
97
+ }
95
98
  else if (options.bundler === 'rsbuild') {
96
99
  await (0, add_rsbuild_1.setupRsbuildConfiguration)(tree, options, tasks);
97
100
  }
@@ -1,4 +1,5 @@
1
1
  import { type Tree } from '@nx/devkit';
2
2
  import { NormalizedSchema, Schema } from '../../schema';
3
3
  export declare function initRspack(tree: Tree, options: NormalizedSchema<Schema>, tasks: any[]): Promise<void>;
4
+ export declare function setupRspackConfiguration(tree: Tree, options: NormalizedSchema<Schema>, tasks: any[]): Promise<void>;
4
5
  export declare function handleStyledJsxForRspack(tasks: any[], tree: Tree, options: NormalizedSchema<Schema>): void;
@@ -1,18 +1,36 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.initRspack = initRspack;
4
+ exports.setupRspackConfiguration = setupRspackConfiguration;
4
5
  exports.handleStyledJsxForRspack = handleStyledJsxForRspack;
5
6
  const devkit_1 = require("@nx/devkit");
6
7
  const pc = require("picocolors");
7
8
  const versions_1 = require("../../../../utils/versions");
9
+ const maybe_js_1 = require("../../../../utils/maybe-js");
8
10
  async function initRspack(tree, options, tasks) {
9
11
  const { rspackInitGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxVersion);
10
12
  const rspackInitTask = await rspackInitGenerator(tree, {
11
13
  ...options,
14
+ addPlugin: false,
12
15
  skipFormat: true,
13
16
  });
14
17
  tasks.push(rspackInitTask);
15
18
  }
19
+ async function setupRspackConfiguration(tree, options, tasks) {
20
+ const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/rspack', versions_1.nxVersion);
21
+ const rspackTask = await configurationGenerator(tree, {
22
+ project: options.projectName,
23
+ main: (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)({
24
+ js: options.js,
25
+ useJsx: true,
26
+ }, `src/main.tsx`)),
27
+ tsConfig: (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.app.json'),
28
+ target: 'web',
29
+ newProject: true,
30
+ framework: 'react',
31
+ });
32
+ tasks.push(rspackTask);
33
+ }
16
34
  function handleStyledJsxForRspack(tasks, tree, options) {
17
35
  devkit_1.logger.warn(`${pc.bold('styled-jsx')} is not supported by ${pc.bold('Rspack')}. We've added ${pc.bold('babel-loader')} to your project, but using babel will slow down your build.`);
18
36
  tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'babel-loader': versions_1.babelLoaderVersion }));
@@ -11,9 +11,9 @@ function getAppTests(options) {
11
11
 
12
12
  it('should have a greeting as the title', () => {
13
13
  ${options.routing
14
- ? 'const { getAllByText } = render(<BrowserRouter><App /></BrowserRouter>);'
15
- : 'const { getAllByText } = render(<App />);'}
16
- expect(getAllByText(new RegExp('Welcome ${options.projectName}', 'gi')).length > 0).toBeTruthy();
14
+ ? 'const { getByText } = render(<BrowserRouter><App /></BrowserRouter>);'
15
+ : 'const { getByText } = render(<App />);'}
16
+ expect(getByText(new RegExp('Welcome ${options.projectName}', 'gi'))).toBeTruthy();
17
17
  });
18
18
  `;
19
19
  }