@nx/react 21.6.2 → 21.7.0-canary.20250930-e144408

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": "21.6.2",
3
+ "version": "21.7.0-canary.20250930-e144408",
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,19 +38,19 @@
38
38
  "minimatch": "9.0.3",
39
39
  "picocolors": "^1.1.0",
40
40
  "tslib": "^2.3.0",
41
- "@nx/devkit": "21.6.2",
42
- "@nx/js": "21.6.2",
43
- "@nx/eslint": "21.6.2",
44
- "@nx/web": "21.6.2",
45
- "@nx/vite": "21.6.2",
46
- "@nx/module-federation": "21.6.2",
47
- "@nx/rollup": "21.6.2",
41
+ "@nx/devkit": "21.7.0-canary.20250930-e144408",
42
+ "@nx/js": "21.7.0-canary.20250930-e144408",
43
+ "@nx/eslint": "21.7.0-canary.20250930-e144408",
44
+ "@nx/web": "21.7.0-canary.20250930-e144408",
45
+ "@nx/vite": "21.7.0-canary.20250930-e144408",
46
+ "@nx/module-federation": "21.7.0-canary.20250930-e144408",
47
+ "@nx/rollup": "21.7.0-canary.20250930-e144408",
48
48
  "express": "^4.21.2",
49
49
  "http-proxy-middleware": "^3.0.5",
50
50
  "semver": "^7.6.3"
51
51
  },
52
52
  "devDependencies": {
53
- "nx": "21.6.2"
53
+ "nx": "21.7.0-canary.20250930-e144408"
54
54
  },
55
55
  "publishConfig": {
56
56
  "access": "public"
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- // TODO(v22): Remove this in Nx 22 and migrate to explicit rollup.config.cjs files.
4
3
  /**
5
4
  * @deprecated Use `withNx` function from `@nx/rollup/with-nx` in your rollup.config.cjs file instead. Use `nx g @nx/rollup:convert-to-inferred` to generate the rollup.config.cjs file if it does not exist.
6
5
  */
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/plugins/component-testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,yBAAyB,EAC1B,MAAM,oCAAoC,CAAC;AAsB5C,KAAK,aAAa,GAAG;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,SAAS,CAAC;IACnB,aAAa,CAAC,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,yBAAyB,GAClC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,aAAa,GAAG,gBAAgB,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CA+HA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../packages/react/plugins/component-testing/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,yBAAyB,EAC1B,MAAM,oCAAoC,CAAC;AAsB5C,KAAK,aAAa,GAAG;IACnB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,GAAG,CAAC;CAClB,CAAC;AAEF,KAAK,gBAAgB,GAAG;IACtB,SAAS,EAAE,OAAO,CAAC;IACnB,OAAO,EAAE,SAAS,CAAC;IACnB,aAAa,CAAC,EAAE,GAAG,CAAC;CACrB,CAAC;AAEF;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,wBAAwB,CACtC,YAAY,EAAE,MAAM,EACpB,OAAO,CAAC,EAAE,yBAAyB,GAClC;IACD,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,aAAa,GAAG,gBAAgB,CAAC;IAC5C,YAAY,EAAE,MAAM,CAAC;IACrB,iBAAiB,EAAE,MAAM,CAAC;IAC1B,iBAAiB,EAAE,OAAO,CAAC;CAC5B,CAkIA"}
@@ -65,7 +65,7 @@ function nxComponentTestingPreset(pathToConfig, options) {
65
65
  },
66
66
  };
67
67
  }
68
- let webpackConfig;
68
+ let webpackConfig = null;
69
69
  try {
70
70
  const graph = (0, devkit_1.readCachedProjectGraph)();
71
71
  const { targets: ctTargets, name: ctProjectName } = (0, ct_helpers_1.getProjectConfigByPath)(graph, pathToConfig);
@@ -93,6 +93,9 @@ function nxComponentTestingPreset(pathToConfig, options) {
93
93
  devkit_1.logger.warn((0, devkit_1.stripIndents) `Unable to build a webpack config with the project graph.
94
94
  Falling back to default webpack config.`);
95
95
  devkit_1.logger.warn(e);
96
+ }
97
+ // Fallback config
98
+ if (!webpackConfig) {
96
99
  const { buildBaseWebpackConfig } = require('./webpack-fallback');
97
100
  webpackConfig = buildBaseWebpackConfig({
98
101
  tsConfigPath: findTsConfig(normalizedProjectRootPath),
@@ -170,32 +173,31 @@ function buildTargetWebpack(ctx, buildTarget, componentTestingProjectName) {
170
173
  }
171
174
  return async () => {
172
175
  customWebpack = await customWebpack;
173
- // TODO(v22): Component testing need to be agnostic of the underlying executor. With Crystal, we're not using `@nx/webpack:webpack` by default.
174
- // We need to decouple CT from the build target of the app, we just care about bundler config (e.g. webpack.config.js).
175
- // The generated setup should support both Webpack and Vite as documented here: https://docs.cypress.io/guides/component-testing/react/overview
176
- // Related issue: https://github.com/nrwl/nx/issues/21546
177
- const configure = composePluginsSync(withNx(), withWeb());
178
- const defaultWebpack = configure({}, {
179
- options: {
180
- ...options,
181
- // cypress will generate its own index.html from component-index.html
182
- generateIndexHtml: false,
183
- // causes issues with buildable libraries with ENOENT: no such file or directory, scandir error
184
- extractLicenses: false,
185
- root: devkit_1.workspaceRoot,
186
- projectRoot: ctProjectConfig.root,
187
- sourceRoot: (0, ts_solution_setup_1.getProjectSourceRoot)(ctProjectConfig),
188
- },
189
- context,
190
- });
191
- if (customWebpack) {
192
- return await customWebpack(defaultWebpack, {
193
- options,
176
+ // For legacy `composePlugins(...)` setup, we need change some options to make Cypress CT work properly.
177
+ if (customWebpack &&
178
+ require('@nx/webpack').isNxWebpackComposablePlugin(customWebpack) // using inline since @nx/webpack may not be installed when using vite so top-level import would error
179
+ ) {
180
+ return await customWebpack({}, {
181
+ options: {
182
+ ...options,
183
+ // cypress will generate its own index.html from component-index.html
184
+ generateIndexHtml: false,
185
+ // causes issues with buildable libraries with ENOENT: no such file or directory, scandir error
186
+ extractLicenses: false,
187
+ root: devkit_1.workspaceRoot,
188
+ projectRoot: ctProjectConfig.root,
189
+ sourceRoot: (0, ts_solution_setup_1.getProjectSourceRoot)(ctProjectConfig),
190
+ },
194
191
  context,
195
192
  configuration: parsed.configuration,
196
193
  });
197
194
  }
198
- return defaultWebpack;
195
+ else if (typeof customWebpack === 'object' ||
196
+ typeof customWebpack === 'function') {
197
+ // If this is a standard webpack config object or function, just return. it
198
+ return customWebpack;
199
+ }
200
+ return null; // return null to use fallback config
199
201
  };
200
202
  }
201
203
  function findViteConfig(projectRootFullPath) {
@@ -6,6 +6,7 @@ const { join } = require('path');
6
6
  module.exports = {
7
7
  output: {
8
8
  path: join(__dirname, '<%= webpackPluginOptions.outputPath %>'),
9
+ clean: true,
9
10
  },
10
11
  devServer: {
11
12
  port: <%= port %>,
@@ -49,6 +50,7 @@ module.exports = composePlugins(
49
50
  (config) => {
50
51
  // Update the webpack config as needed here.
51
52
  // e.g. `config.plugins.push(new MyPlugin())`
53
+ config.output.clean = true;
52
54
  return config;
53
55
  }
54
56
  );
@@ -1 +1 @@
1
- {"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/library/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EACL,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOrD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAqG3B"}
1
+ {"version":3,"file":"normalize-options.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/library/lib/normalize-options.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EACL,MAAM,YAAY,CAAC;AAMpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,EAAE,MAAM,WAAW,CAAC;AAOrD,wBAAsB,gBAAgB,CACpC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,gBAAgB,CAAC,CAmG3B"}
@@ -18,9 +18,7 @@ async function normalizeOptions(host, options) {
18
18
  const addPlugin = process.env.NX_ADD_PLUGINS !== 'false' &&
19
19
  nxJson.useInferencePlugins !== false;
20
20
  options.addPlugin ??= addPlugin;
21
- const fileName = options.simpleName
22
- ? projectNames.projectSimpleName
23
- : projectNames.projectFileName;
21
+ const fileName = projectNames.projectFileName;
24
22
  const parsedTags = options.tags
25
23
  ? options.tags.split(',').map((s) => s.trim())
26
24
  : [];
@@ -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;AAiCpB,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,8BA6RxE;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;AAiCpB,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,8BAsRxE;AAED,eAAe,gBAAgB,CAAC"}
@@ -47,10 +47,6 @@ async function libraryGeneratorInternal(host, schema) {
47
47
  !schema.importPath) {
48
48
  throw new Error(`For publishable libs you have to provide a proper "--importPath" which needs to be a valid npm package name (e.g. my-awesome-lib or @myorg/my-lib)`);
49
49
  }
50
- if (schema.simpleName !== undefined && schema.simpleName !== false) {
51
- // TODO(v22): Remove simpleName as user should be using name.
52
- devkit_1.logger.warn(`The "--simpleName" option is deprecated and will be removed in Nx 22. Please use the "--name" option to provide the exact name you want for the library.`);
53
- }
54
50
  if (!options.component) {
55
51
  options.style = 'none';
56
52
  }
@@ -25,7 +25,6 @@ export interface Schema {
25
25
  tags?: string;
26
26
  unitTestRunner?: 'jest' | 'vitest' | 'none';
27
27
  minimal?: boolean;
28
- simpleName?: boolean;
29
28
  addPlugin?: boolean;
30
29
  useProjectJson?: boolean;
31
30
  }
@@ -186,12 +186,6 @@
186
186
  "type": "boolean",
187
187
  "default": false
188
188
  },
189
- "simpleName": {
190
- "description": "Don't include the directory in the name of the module of the library.",
191
- "type": "boolean",
192
- "default": false,
193
- "x-deprecated": "Use the --name option to provide the exact name instead. This option will be removed in Nx 22."
194
- },
195
189
  "useProjectJson": {
196
190
  "type": "boolean",
197
191
  "description": "Use a `project.json` configuration file instead of inlining the Nx configuration in the `package.json` file."