@nx/react 22.1.0-beta.5 → 22.1.0-beta.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react",
3
- "version": "22.1.0-beta.5",
3
+ "version": "22.1.0-beta.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,26 +38,27 @@
38
38
  "minimatch": "9.0.3",
39
39
  "picocolors": "^1.1.0",
40
40
  "tslib": "^2.3.0",
41
- "@nx/devkit": "22.1.0-beta.5",
42
- "@nx/js": "22.1.0-beta.5",
43
- "@nx/eslint": "22.1.0-beta.5",
44
- "@nx/web": "22.1.0-beta.5",
45
- "@nx/module-federation": "22.1.0-beta.5",
46
- "@nx/rollup": "22.1.0-beta.5",
41
+ "@nx/devkit": "22.1.0-beta.7",
42
+ "@nx/js": "22.1.0-beta.7",
43
+ "@nx/eslint": "22.1.0-beta.7",
44
+ "@nx/web": "22.1.0-beta.7",
45
+ "@nx/module-federation": "22.1.0-beta.7",
46
+ "@nx/rollup": "22.1.0-beta.7",
47
47
  "express": "^4.21.2",
48
48
  "http-proxy-middleware": "^3.0.5",
49
49
  "semver": "^7.6.3"
50
50
  },
51
51
  "devDependencies": {
52
- "@nx/cypress": "22.1.0-beta.5",
53
- "@nx/playwright": "22.1.0-beta.5",
54
- "@nx/rsbuild": "22.1.0-beta.5",
55
- "@nx/vite": "22.1.0-beta.5",
56
- "@nx/webpack": "22.1.0-beta.5",
57
- "nx": "22.1.0-beta.5"
52
+ "@nx/cypress": "22.1.0-beta.7",
53
+ "@nx/playwright": "22.1.0-beta.7",
54
+ "@nx/rsbuild": "22.1.0-beta.7",
55
+ "@nx/vite": "22.1.0-beta.7",
56
+ "@nx/vitest": "22.1.0-beta.7",
57
+ "@nx/webpack": "22.1.0-beta.7",
58
+ "nx": "22.1.0-beta.7"
58
59
  },
59
60
  "optionalDependencies": {
60
- "@nx/vite": "22.1.0-beta.5"
61
+ "@nx/vite": "22.1.0-beta.7"
61
62
  },
62
63
  "publishConfig": {
63
64
  "access": "public"
@@ -1 +1 @@
1
- {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAIjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAoCpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAM5B;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAoM5B;AAED,eAAe,oBAAoB,CAAC"}
1
+ {"version":3,"file":"application.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/application/application.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,iBAAiB,EAIjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAoCpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAIlC,wBAAsB,oBAAoB,CACxC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAM5B;AAED,wBAAsB,4BAA4B,CAChD,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,iBAAiB,CAAC,CAqM5B;AAED,eAAe,oBAAoB,CAAC"}
@@ -152,6 +152,7 @@ async function applicationGeneratorInternal(tree, schema) {
152
152
  (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'tsconfig.json'), (json) => {
153
153
  const types = new Set(json.compilerOptions?.types || []);
154
154
  types.add('@react-router/node');
155
+ types.add('node');
155
156
  return {
156
157
  ...json,
157
158
  compilerOptions: {
@@ -2,7 +2,7 @@
2
2
  "extends": "<%= offsetFromRoot %>tsconfig.base.json",
3
3
  "compilerOptions": {
4
4
  "lib": ["DOM", "DOM.Iterable", "ES2019"],
5
- "types": ["@react-router/node", "vite/client"],
5
+ "types": ["@react-router/node", "vite/client", "node"],
6
6
  "isolatedModules": true,
7
7
  "esModuleInterop": true,
8
8
  "jsx": "react-jsx",
@@ -1 +1 @@
1
- {"version":3,"file":"add-vite.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/react/src/generators/application/lib/bundlers/add-vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAoC,MAAM,YAAY,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAExD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,EACjC,KAAK,EAAE,GAAG,EAAE,iBAwDb;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,EACjC,KAAK,EAAE,GAAG,EAAE,iBAsCb"}
1
+ {"version":3,"file":"add-vite.d.ts","sourceRoot":"","sources":["../../../../../../../../packages/react/src/generators/application/lib/bundlers/add-vite.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,IAAI,EAAoC,MAAM,YAAY,CAAC;AAEzE,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,cAAc,CAAC;AAExD,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,EACjC,KAAK,EAAE,GAAG,EAAE,iBAwDb;AAED,wBAAsB,wBAAwB,CAC5C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,EACjC,KAAK,EAAE,GAAG,EAAE,iBA2Cb"}
@@ -50,8 +50,9 @@ async function setupViteConfiguration(tree, options, tasks) {
50
50
  }, false);
51
51
  }
52
52
  async function setupVitestConfiguration(tree, options, tasks) {
53
- const { createOrEditViteConfig, vitestGenerator } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
54
- const vitestTask = await vitestGenerator(tree, {
53
+ const { createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
54
+ const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/vitest', versions_1.nxVersion);
55
+ const vitestTask = await configurationGenerator(tree, {
55
56
  uiFramework: 'react',
56
57
  coverageProvider: 'v8',
57
58
  project: options.projectName,
@@ -1 +1 @@
1
- {"version":3,"file":"update-jest-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/update-jest-config.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAE9C,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAoCrE"}
1
+ {"version":3,"file":"update-jest-config.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/application/lib/update-jest-config.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,EAAE,IAAI,EAAc,MAAM,YAAY,CAAC;AAE9C,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAoCrE"}
@@ -1,7 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateSpecConfig = updateSpecConfig;
4
- const maybe_js_1 = require("../../../utils/maybe-js");
5
4
  const jest_utils_1 = require("../../../utils/jest-utils");
6
5
  const devkit_1 = require("@nx/devkit");
7
6
  function updateSpecConfig(host, options) {
@@ -27,7 +26,10 @@ function updateSpecConfig(host, options) {
27
26
  if (options.unitTestRunner !== 'jest') {
28
27
  return;
29
28
  }
30
- const configPath = (0, maybe_js_1.maybeJs)(options, `${options.appProjectRoot}/jest.config.ts`);
29
+ const configPath = (0, jest_utils_1.findProjectJestConfig)(host, options.appProjectRoot);
30
+ if (!configPath) {
31
+ return;
32
+ }
31
33
  const originalContent = host.read(configPath, 'utf-8');
32
34
  const content = (0, jest_utils_1.updateJestConfigContent)(originalContent);
33
35
  host.write(configPath, content);
@@ -1 +1 @@
1
- {"version":3,"file":"component-test.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-test/component-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EACL,MAAM,YAAY,CAAC;AAUpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,mBAAmB,iBAsB7B;AAqED,eAAe,sBAAsB,CAAC"}
1
+ {"version":3,"file":"component-test.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-test/component-test.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,IAAI,EACL,MAAM,YAAY,CAAC;AAUpB,OAAO,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAI/C,wBAAsB,sBAAsB,CAC1C,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,mBAAmB,iBAkB7B;AAqED,eAAe,sBAAsB,CAAC"}
@@ -11,8 +11,6 @@ const versions_1 = require("../../utils/versions");
11
11
  let tsModule;
12
12
  async function componentTestGenerator(tree, options) {
13
13
  (0, devkit_1.ensurePackage)('@nx/cypress', versions_1.nxVersion);
14
- const { assertMinimumCypressVersion } = await Promise.resolve().then(() => require('@nx/cypress/src/utils/versions'));
15
- assertMinimumCypressVersion(10);
16
14
  // normalize any windows paths
17
15
  options.componentPath = options.componentPath.replace(/\\/g, '/');
18
16
  const projectConfig = (0, devkit_1.readProjectConfiguration)(tree, options.project);
@@ -9,6 +9,6 @@
9
9
  "@nx/react/typings/image.d.ts"
10
10
  ]
11
11
  },
12
- "exclude": ["jest.config.ts", "src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
12
+ "exclude": ["jest.config.ts", "jest.config.cts", "src/**/*.spec.ts", "src/**/*.test.ts", "src/**/*.spec.tsx", "src/**/*.test.tsx", "src/**/*.spec.js", "src/**/*.test.js", "src/**/*.spec.jsx", "src/**/*.test.jsx"],
13
13
  "include": ["src/**/*.js", "src/**/*.jsx", "src/**/*.ts", "src/**/*.tsx"]
14
14
  }
@@ -1 +1 @@
1
- {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAOjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAgCpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMhE;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAqRxE;AAED,eAAe,gBAAgB,CAAC"}
1
+ {"version":3,"file":"library.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/library/library.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAOjB,IAAI,EAGL,MAAM,YAAY,CAAC;AAgCpB,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAsB,gBAAgB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAMhE;AAED,wBAAsB,wBAAwB,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAyRxE;AAED,eAAe,gBAAgB,CAAC"}
@@ -139,7 +139,7 @@ async function libraryGeneratorInternal(host, schema) {
139
139
  skipFormat: true,
140
140
  });
141
141
  tasks.push(jestTask);
142
- const jestConfigPath = (0, devkit_1.joinPathFragments)(options.projectRoot, options.js ? 'jest.config.js' : 'jest.config.ts');
142
+ const jestConfigPath = (0, devkit_1.joinPathFragments)(options.projectRoot, options.js ? 'jest.config.js' : 'jest.config.cts');
143
143
  if (options.compiler === 'babel' && host.exists(jestConfigPath)) {
144
144
  const updatedContent = (0, jest_utils_1.updateJestConfigContent)(host.read(jestConfigPath, 'utf-8'));
145
145
  host.write(jestConfigPath, updatedContent);
@@ -148,8 +148,9 @@ async function libraryGeneratorInternal(host, schema) {
148
148
  else if (options.unitTestRunner === 'vitest' &&
149
149
  options.bundler !== 'vite' // tests are already configured if bundler is vite
150
150
  ) {
151
- const { vitestGenerator, createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
152
- const vitestTask = await vitestGenerator(host, {
151
+ const { createOrEditViteConfig } = (0, devkit_1.ensurePackage)('@nx/vite', versions_1.nxVersion);
152
+ const { configurationGenerator } = (0, devkit_1.ensurePackage)('@nx/vitest', versions_1.nxVersion);
153
+ const vitestTask = await configurationGenerator(host, {
153
154
  uiFramework: 'react',
154
155
  project: options.name,
155
156
  coverageProvider: 'v8',
@@ -1,2 +1,4 @@
1
+ import { type Tree } from '@nx/devkit';
1
2
  export declare function updateJestConfigContent(content: string): string;
3
+ export declare function findProjectJestConfig(tree: Tree, projectRoot: string): string | null;
2
4
  //# sourceMappingURL=jest-utils.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"jest-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/utils/jest-utils.ts"],"names":[],"mappings":"AAAA,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,UAUtD"}
1
+ {"version":3,"file":"jest-utils.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/utils/jest-utils.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,KAAK,IAAI,EAAE,MAAM,YAAY,CAAC;AAE1D,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,MAAM,UAUtD;AAED,wBAAgB,qBAAqB,CACnC,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,GAClB,MAAM,GAAG,IAAI,CAWf"}
@@ -1,8 +1,20 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.updateJestConfigContent = updateJestConfigContent;
4
+ exports.findProjectJestConfig = findProjectJestConfig;
5
+ const devkit_1 = require("@nx/devkit");
4
6
  function updateJestConfigContent(content) {
5
7
  return content
6
8
  .replace('transform: {', "transform: {\n '^(?!.*\\\\.(js|jsx|ts|tsx|css|json)$)': '@nx/react/plugins/jest',")
7
9
  .replace(`'babel-jest'`, `['babel-jest', { presets: ['@nx/react/babel'] }]`);
8
10
  }
11
+ function findProjectJestConfig(tree, projectRoot) {
12
+ const extensions = ['js', 'ts', 'cts'];
13
+ for (const ext of extensions) {
14
+ const configPath = (0, devkit_1.joinPathFragments)(projectRoot, `jest.config.${ext}`);
15
+ if (tree.exists(configPath)) {
16
+ return configPath;
17
+ }
18
+ }
19
+ return null;
20
+ }