@nx/react 21.4.0-beta.5 → 21.4.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": "21.4.0-beta.5",
3
+ "version": "21.4.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,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.4.0-beta.5",
42
- "@nx/js": "21.4.0-beta.5",
43
- "@nx/eslint": "21.4.0-beta.5",
44
- "@nx/web": "21.4.0-beta.5",
45
- "@nx/vite": "21.4.0-beta.5",
46
- "@nx/module-federation": "21.4.0-beta.5",
47
- "@nx/rollup": "21.4.0-beta.5",
41
+ "@nx/devkit": "21.4.0-beta.7",
42
+ "@nx/js": "21.4.0-beta.7",
43
+ "@nx/eslint": "21.4.0-beta.7",
44
+ "@nx/web": "21.4.0-beta.7",
45
+ "@nx/vite": "21.4.0-beta.7",
46
+ "@nx/module-federation": "21.4.0-beta.7",
47
+ "@nx/rollup": "21.4.0-beta.7",
48
48
  "express": "^4.21.2",
49
49
  "http-proxy-middleware": "^3.0.3",
50
50
  "semver": "^7.6.3"
51
51
  },
52
52
  "devDependencies": {
53
- "nx": "21.4.0-beta.5"
53
+ "nx": "21.4.0-beta.7"
54
54
  },
55
55
  "publishConfig": {
56
56
  "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;AAmCpB,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,CA8L5B;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,CAmM5B;AAED,eAAe,oBAAoB,CAAC"}
@@ -36,11 +36,12 @@ async function applicationGenerator(tree, schema) {
36
36
  }
37
37
  async function applicationGeneratorInternal(tree, schema) {
38
38
  const tasks = [];
39
+ const addTsPlugin = (0, ts_solution_setup_1.shouldConfigureTsSolutionSetup)(tree, schema.addPlugin, schema.useTsSolution);
39
40
  const jsInitTask = await (0, js_1.initGenerator)(tree, {
40
41
  ...schema,
41
42
  tsConfigName: schema.rootProject ? 'tsconfig.json' : 'tsconfig.base.json',
42
43
  skipFormat: true,
43
- addTsPlugin: schema.useTsSolution,
44
+ addTsPlugin,
44
45
  formatter: schema.formatter,
45
46
  platform: 'web',
46
47
  });
@@ -8,7 +8,7 @@ const normalize_options_1 = require("../application/lib/normalize-options");
8
8
  const remote_1 = require("../remote/remote");
9
9
  const setup_ssr_1 = require("../setup-ssr/setup-ssr");
10
10
  const add_module_federation_files_1 = require("./lib/add-module-federation-files");
11
- const normalize_remote_1 = require("./lib/normalize-remote");
11
+ const normalize_remote_1 = require("../../utils/normalize-remote");
12
12
  const setup_ssr_for_host_1 = require("./lib/setup-ssr-for-host");
13
13
  const update_module_federation_e2e_project_1 = require("./lib/update-module-federation-e2e-project");
14
14
  const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
@@ -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,8BA0RxE;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,8BA4RxE;AAED,eAAe,gBAAgB,CAAC"}
@@ -34,8 +34,10 @@ async function libraryGenerator(host, schema) {
34
34
  }
35
35
  async function libraryGeneratorInternal(host, schema) {
36
36
  const tasks = [];
37
+ const addTsPlugin = (0, ts_solution_setup_1.shouldConfigureTsSolutionSetup)(host, schema.addPlugin);
37
38
  const jsInitTask = await (0, js_1.initGenerator)(host, {
38
39
  ...schema,
40
+ addTsPlugin,
39
41
  skipFormat: true,
40
42
  });
41
43
  tasks.push(jsInitTask);
@@ -1 +1 @@
1
- {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/remote/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAOjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAmBpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAMzD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAsElC;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAqJ/D;AAED,eAAe,eAAe,CAAC"}
1
+ {"version":3,"file":"remote.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/remote/remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAIL,iBAAiB,EAMjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAoBpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,uBAAuB,CAAC;AAMzD,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAElC,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,CAAC,MAAM,CAAC,QAsElC;AAED,wBAAsB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,8BAmJ/D;AAED,eAAe,eAAe,CAAC"}
@@ -9,6 +9,7 @@ const js_1 = require("@nx/js");
9
9
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
10
10
  const update_module_federation_project_1 = require("../../rules/update-module-federation-project");
11
11
  const add_mf_env_to_inputs_1 = require("../../utils/add-mf-env-to-inputs");
12
+ const normalize_remote_1 = require("../../utils/normalize-remote");
12
13
  const maybe_js_1 = require("../../utils/maybe-js");
13
14
  const versions_1 = require("../../utils/versions");
14
15
  const application_1 = require("../application/application");
@@ -57,9 +58,11 @@ function addModuleFederationFiles(host, options) {
57
58
  }
58
59
  async function remoteGenerator(host, schema) {
59
60
  const tasks = [];
61
+ const name = await (0, normalize_remote_1.normalizeRemoteName)(host, schema.name, schema);
60
62
  const options = {
61
63
  ...(await (0, normalize_options_1.normalizeOptions)(host, {
62
64
  ...schema,
65
+ name,
63
66
  useProjectJson: true,
64
67
  })),
65
68
  // when js is set to true, we want to use the js configuration
@@ -81,13 +84,9 @@ async function remoteGenerator(host, schema) {
81
84
  }
82
85
  }
83
86
  await (0, project_name_and_root_utils_1.ensureRootProjectName)(options, 'application');
84
- const REMOTE_NAME_REGEX = '^[a-zA-Z_$][a-zA-Z_$0-9]*$';
85
- const remoteNameRegex = new RegExp(REMOTE_NAME_REGEX);
86
- if (!remoteNameRegex.test(options.projectName)) {
87
- throw new Error((0, devkit_1.stripIndents) `Invalid remote name: ${options.projectName}. Remote project names must:
88
- - Start with a letter, dollar sign ($) or underscore (_)
89
- - Followed by any valid character (letters, digits, underscores, or dollar signs)
90
- The regular expression used is ${REMOTE_NAME_REGEX}.`);
87
+ const isValidRemote = (0, js_1.isValidVariable)(options.projectName);
88
+ if (!isValidRemote.isValid) {
89
+ throw new Error(`Invalid remote name provided: ${options.projectName}. ${isValidRemote.message}`);
91
90
  }
92
91
  const initAppTask = await (0, application_1.default)(host, {
93
92
  ...options,
@@ -19,7 +19,7 @@
19
19
  "name": {
20
20
  "type": "string",
21
21
  "description": "The name of the Producer (remote) application to generate the Module Federation configuration",
22
- "pattern": "^[a-zA-Z_$][a-zA-Z_$0-9]*$",
22
+ "pattern": "^[a-zA-Z][^:]*$",
23
23
  "x-priority": "important"
24
24
  },
25
25
  "dynamic": {
@@ -0,0 +1,9 @@
1
+ import { Tree } from '@nx/devkit';
2
+ export declare function normalizeRemoteName(tree: Tree, remote: string, options: {
3
+ directory: string;
4
+ }): Promise<string>;
5
+ export declare function normalizeRemoteDirectory(remote: string, options: {
6
+ directory: string;
7
+ appProjectRoot: string;
8
+ }): string;
9
+ //# sourceMappingURL=normalize-remote.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"normalize-remote.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/utils/normalize-remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,EAAE,MAAM,YAAY,CAAC;AAGrD,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAA;CAAE,mBAY/B;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE;IAAE,SAAS,EAAE,MAAM,CAAC;IAAC,cAAc,EAAE,MAAM,CAAA;CAAE,UAgBvD"}
@@ -1,5 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- import { NormalizedSchema } from '../schema';
3
- export declare function normalizeRemoteName(tree: Tree, remote: string, options: NormalizedSchema): Promise<string>;
4
- export declare function normalizeRemoteDirectory(remote: string, options: NormalizedSchema): string;
5
- //# sourceMappingURL=normalize-remote.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"normalize-remote.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/host/lib/normalize-remote.ts"],"names":[],"mappings":"AAAA,OAAO,EAAqB,IAAI,EAAE,MAAM,YAAY,CAAC;AAErD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,mBAY1B;AAED,wBAAgB,wBAAwB,CACtC,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,gBAAgB,UAgB1B"}