@nx/react 21.4.0-beta.1 → 21.4.0-beta.10

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.
Files changed (27) hide show
  1. package/migrations.json +9 -0
  2. package/package.json +10 -10
  3. package/src/generators/application/application.d.ts.map +1 -1
  4. package/src/generators/application/application.js +2 -1
  5. package/src/generators/application/lib/create-application-files.js +2 -2
  6. package/src/generators/component-story/component-story.d.ts.map +1 -1
  7. package/src/generators/component-story/component-story.js +2 -1
  8. package/src/generators/host/host.js +1 -1
  9. package/src/generators/host/lib/add-module-federation-files.d.ts.map +1 -1
  10. package/src/generators/host/lib/add-module-federation-files.js +3 -2
  11. package/src/generators/library/lib/create-files.d.ts.map +1 -1
  12. package/src/generators/library/lib/create-files.js +3 -2
  13. package/src/generators/library/library.d.ts.map +1 -1
  14. package/src/generators/library/library.js +2 -0
  15. package/src/generators/remote/lib/setup-tspath-for-remote.d.ts.map +1 -1
  16. package/src/generators/remote/lib/setup-tspath-for-remote.js +2 -1
  17. package/src/generators/remote/remote.d.ts.map +1 -1
  18. package/src/generators/remote/remote.js +6 -7
  19. package/src/generators/remote/schema.json +1 -1
  20. package/src/utils/normalize-remote.d.ts +9 -0
  21. package/src/utils/normalize-remote.d.ts.map +1 -0
  22. package/src/utils/versions.d.ts +2 -2
  23. package/src/utils/versions.d.ts.map +1 -1
  24. package/src/utils/versions.js +2 -2
  25. package/src/generators/host/lib/normalize-remote.d.ts +0 -5
  26. package/src/generators/host/lib/normalize-remote.d.ts.map +0 -1
  27. /package/src/{generators/host/lib → utils}/normalize-remote.js +0 -0
package/migrations.json CHANGED
@@ -174,6 +174,15 @@
174
174
  "alwaysAddToPackageJson": false
175
175
  }
176
176
  }
177
+ },
178
+ "21.4.0": {
179
+ "version": "21.4.0-beta.8",
180
+ "packages": {
181
+ "http-proxy-middleware": {
182
+ "version": "^3.0.5",
183
+ "alwaysAddToPackageJson": false
184
+ }
185
+ }
177
186
  }
178
187
  }
179
188
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/react",
3
- "version": "21.4.0-beta.1",
3
+ "version": "21.4.0-beta.10",
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.1",
42
- "@nx/js": "21.4.0-beta.1",
43
- "@nx/eslint": "21.4.0-beta.1",
44
- "@nx/web": "21.4.0-beta.1",
45
- "@nx/vite": "21.4.0-beta.1",
46
- "@nx/module-federation": "21.4.0-beta.1",
47
- "@nx/rollup": "21.4.0-beta.1",
41
+ "@nx/devkit": "21.4.0-beta.10",
42
+ "@nx/js": "21.4.0-beta.10",
43
+ "@nx/eslint": "21.4.0-beta.10",
44
+ "@nx/web": "21.4.0-beta.10",
45
+ "@nx/vite": "21.4.0-beta.10",
46
+ "@nx/module-federation": "21.4.0-beta.10",
47
+ "@nx/rollup": "21.4.0-beta.10",
48
48
  "express": "^4.21.2",
49
- "http-proxy-middleware": "^3.0.3",
49
+ "http-proxy-middleware": "^3.0.5",
50
50
  "semver": "^7.6.3"
51
51
  },
52
52
  "devDependencies": {
53
- "nx": "21.4.0-beta.1"
53
+ "nx": "21.4.0-beta.10"
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
  });
@@ -221,10 +221,10 @@ function generateReactRouterFiles(tree, options, templateVariables) {
221
221
  tree.write('.gitignore', `${gitignore}\n.cache\nbuild\npublic/build\n.env\n\.react-router\n`);
222
222
  }
223
223
  else {
224
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/react-router-ssr/non-root'), options.appProjectRoot, templateVariables);
224
+ (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, '../files/react-router-ssr/non-root'), options.appProjectRoot, templateVariables);
225
225
  }
226
226
  if (options.isUsingTsSolutionConfig) {
227
- (0, devkit_1.generateFiles)(tree, (0, devkit_1.joinPathFragments)(__dirname, '../files/react-router-ssr/ts-solution'), options.appProjectRoot, templateVariables);
227
+ (0, devkit_1.generateFiles)(tree, (0, path_1.join)(__dirname, '../files/react-router-ssr/ts-solution'), options.appProjectRoot, templateVariables);
228
228
  (0, devkit_1.updateJson)(tree, (0, devkit_1.joinPathFragments)(options.appProjectRoot, 'package.json'), (json) => {
229
229
  if (options.projectName !== options.importPath) {
230
230
  json.nx = { name: options.projectName };
@@ -1 +1 @@
1
- {"version":3,"file":"component-story.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-story/component-story.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EACL,MAAM,YAAY,CAAC;AAGpB,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAUtC,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,EACE,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,WAAW,GACZ,EAAE,gCAAgC,QA2EpC;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,cAAc,EAAE,EAAE,CAAC,IAAI,EACvB,kBAAkB,EAAE,MAAM,EAC1B,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,OAAO,EACzB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,OAAO,EAClB,aAAa,CAAC,EAAE,OAAO,QAwBxB;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gCAAgC,iBAWzC;AAED,eAAe,uBAAuB,CAAC"}
1
+ {"version":3,"file":"component-story.d.ts","sourceRoot":"","sources":["../../../../../../packages/react/src/generators/component-story/component-story.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EACL,MAAM,YAAY,CAAC;AAGpB,OAAO,KAAK,KAAK,EAAE,MAAM,YAAY,CAAC;AAWtC,MAAM,WAAW,gCAAgC;IAC/C,OAAO,EAAE,MAAM,CAAC;IAChB,aAAa,EAAE,MAAM,CAAC;IACtB,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,wBAAgB,0BAA0B,CACxC,IAAI,EAAE,IAAI,EACV,EACE,OAAO,EACP,aAAa,EACb,gBAAgB,EAChB,WAAW,GACZ,EAAE,gCAAgC,QA2EpC;AAED,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,UAAU,EAAE,EAAE,CAAC,UAAU,EACzB,cAAc,EAAE,EAAE,CAAC,IAAI,EACvB,kBAAkB,EAAE,MAAM,EAC1B,IAAI,EAAE,MAAM,EACZ,gBAAgB,EAAE,OAAO,EACzB,WAAW,EAAE,MAAM,EACnB,SAAS,EAAE,OAAO,EAClB,aAAa,CAAC,EAAE,OAAO,QAwBxB;AAED,wBAAsB,uBAAuB,CAC3C,IAAI,EAAE,IAAI,EACV,MAAM,EAAE,gCAAgC,iBAWzC;AAED,eAAe,uBAAuB,CAAC"}
@@ -9,6 +9,7 @@ const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-set
9
9
  const ast_utils_1 = require("../../utils/ast-utils");
10
10
  const component_props_1 = require("../../utils/component-props");
11
11
  const framework_1 = require("../../utils/framework");
12
+ const path_1 = require("path");
12
13
  let tsModule;
13
14
  function createComponentStoriesFile(host, { project, componentPath, interactionTests, uiFramework, }) {
14
15
  if (!tsModule) {
@@ -47,7 +48,7 @@ function createComponentStoriesFile(host, { project, componentPath, interactionT
47
48
  }
48
49
  function findPropsAndGenerateFile(host, sourceFile, cmpDeclaration, componentDirectory, name, interactionTests, uiFramework, isPlainJs, fromNodeArray) {
49
50
  const { props, argTypes } = (0, component_props_1.getComponentPropDefaults)(sourceFile, cmpDeclaration);
50
- (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, `./files${isPlainJs ? '/jsx' : '/tsx'}`), (0, devkit_1.normalizePath)(componentDirectory), {
51
+ (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `./files${isPlainJs ? '/jsx' : '/tsx'}`), (0, devkit_1.normalizePath)(componentDirectory), {
51
52
  tmpl: '',
52
53
  componentFileName: fromNodeArray
53
54
  ? `${name}--${cmpDeclaration.name.text}`
@@ -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":"add-module-federation-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/host/lib/add-module-federation-files.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAML,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAE7C,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,EACzB,qBAAqB,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,QAuIxD"}
1
+ {"version":3,"file":"add-module-federation-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/host/lib/add-module-federation-files.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,IAAI,EAML,MAAM,YAAY,CAAC;AAOpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,wBAAgB,wBAAwB,CACtC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,gBAAgB,EACzB,qBAAqB,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,EAAE,QAuIxD"}
@@ -5,6 +5,7 @@ const devkit_1 = require("@nx/devkit");
5
5
  const ts_solution_setup_1 = require("@nx/js/src/utils/typescript/ts-solution-setup");
6
6
  const maybe_js_1 = require("../../../utils/maybe-js");
7
7
  const create_application_files_1 = require("../../application/lib/create-application-files");
8
+ const path_1 = require("path");
8
9
  function addModuleFederationFiles(host, options, defaultRemoteManifest) {
9
10
  const templateVariables = options.bundler === 'rspack'
10
11
  ? {
@@ -39,7 +40,7 @@ function addModuleFederationFiles(host, options, defaultRemoteManifest) {
39
40
  // Renaming original entry file so we can use `import(./bootstrap)` in
40
41
  // new entry file.
41
42
  host.rename((0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)({ js: options.js, useJsx: options.bundler === 'rspack' }, 'src/main.tsx')), (0, devkit_1.joinPathFragments)(options.appProjectRoot, (0, maybe_js_1.maybeJs)({ js: options.js, useJsx: options.bundler === 'rspack' }, 'src/bootstrap.tsx')));
42
- (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, `../files/${options.js
43
+ (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/${options.js
43
44
  ? options.bundler === 'rspack'
44
45
  ? 'rspack-common'
45
46
  : 'common'
@@ -48,7 +49,7 @@ function addModuleFederationFiles(host, options, defaultRemoteManifest) {
48
49
  ? `${options.bundler === 'rspack' ? 'rspack-' : 'webpack-'}module-federation-ts`
49
50
  : `${options.bundler === 'rspack' ? 'rspack-' : 'webpack-'}module-federation`;
50
51
  // New entry file is created here.
51
- (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, `../files/${pathToModuleFederationFiles}`), options.appProjectRoot, templateVariables);
52
+ (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, `../files/${pathToModuleFederationFiles}`), options.appProjectRoot, templateVariables);
52
53
  function deleteFileIfExists(host, filePath) {
53
54
  if (host.exists(filePath)) {
54
55
  host.delete(filePath);
@@ -1 +1 @@
1
- {"version":3,"file":"create-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/library/lib/create-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EAEL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAG7C,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QA6FhE"}
1
+ {"version":3,"file":"create-files.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/library/lib/create-files.ts"],"names":[],"mappings":"AAAA,OAAO,EAML,IAAI,EAEL,MAAM,YAAY,CAAC;AAGpB,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAI7C,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QA6FhE"}
@@ -4,6 +4,7 @@ exports.createFiles = createFiles;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const js_1 = require("@nx/js");
6
6
  const create_ts_config_1 = require("../../../utils/create-ts-config");
7
+ const path_1 = require("path");
7
8
  function createFiles(host, options) {
8
9
  const relativePathToRootTsConfig = (0, js_1.getRelativePathToRootTsConfig)(host, options.projectRoot);
9
10
  const substitutions = {
@@ -13,9 +14,9 @@ function createFiles(host, options) {
13
14
  offsetFromRoot: (0, devkit_1.offsetFromRoot)(options.projectRoot),
14
15
  fileName: options.fileName,
15
16
  };
16
- (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, '../files/common'), options.projectRoot, substitutions);
17
+ (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/common'), options.projectRoot, substitutions);
17
18
  if (options.bundler === 'vite' || options.unitTestRunner === 'vitest') {
18
- (0, devkit_1.generateFiles)(host, (0, devkit_1.joinPathFragments)(__dirname, '../files/vite'), options.projectRoot, substitutions);
19
+ (0, devkit_1.generateFiles)(host, (0, path_1.join)(__dirname, '../files/vite'), options.projectRoot, substitutions);
19
20
  }
20
21
  if (options.compiler === 'babel') {
21
22
  (0, devkit_1.writeJson)(host, (0, devkit_1.joinPathFragments)(options.projectRoot, '.babelrc'), {
@@ -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":"setup-tspath-for-remote.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/remote/lib/setup-tspath-for-remote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAE5D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAYzE"}
1
+ {"version":3,"file":"setup-tspath-for-remote.d.ts","sourceRoot":"","sources":["../../../../../../../packages/react/src/generators/remote/lib/setup-tspath-for-remote.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,MAAM,YAAY,CAAC;AAIvC,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAG5D,wBAAgB,oBAAoB,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,gBAAgB,QAYzE"}
@@ -4,9 +4,10 @@ exports.setupTspathForRemote = setupTspathForRemote;
4
4
  const devkit_1 = require("@nx/devkit");
5
5
  const js_1 = require("@nx/js");
6
6
  const maybe_js_1 = require("../../../utils/maybe-js");
7
+ const module_federation_1 = require("@nx/module-federation");
7
8
  function setupTspathForRemote(tree, options) {
8
9
  const project = (0, devkit_1.readProjectConfiguration)(tree, options.projectName);
9
10
  const exportPath = (0, maybe_js_1.maybeJs)(options, './src/remote-entry.ts');
10
11
  const exportName = 'Module';
11
- (0, js_1.addTsConfigPath)(tree, `${options.projectName.replace(/-/g, '_')}/${exportName}`, [(0, devkit_1.joinPathFragments)(project.root, exportPath)]);
12
+ (0, js_1.addTsConfigPath)(tree, `${(0, module_federation_1.normalizeProjectName)(options.projectName)}/${exportName}`, [(0, devkit_1.joinPathFragments)(project.root, exportPath)]);
12
13
  }
@@ -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"}
@@ -44,8 +44,8 @@ export declare const typesExpressVersion = "^4.17.21";
44
44
  export declare const isbotVersion = "^3.6.5";
45
45
  export declare const corsVersion = "~2.8.5";
46
46
  export declare const typesCorsVersion = "~2.8.12";
47
- export declare const moduleFederationNodeVersion = "^2.7.9";
48
- export declare const moduleFederationEnhancedVersion = "^0.17.0";
47
+ export declare const moduleFederationNodeVersion = "^2.7.11";
48
+ export declare const moduleFederationEnhancedVersion = "^0.18.0";
49
49
  export declare const lessVersion = "3.12.2";
50
50
  export declare const sassVersion = "^1.55.0";
51
51
  export declare const rollupPluginUrlVersion = "^8.0.2";
@@ -1 +1 @@
1
- {"version":3,"file":"versions.d.ts","sourceRoot":"","sources":["../../../../../packages/react/src/utils/versions.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,SAAS,KAAwC,CAAC;AAE/D,eAAO,MAAM,YAAY,WAAW,CAAC;AACrC,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,eAAe,WAAW,CAAC;AACxC,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAC1C,eAAO,MAAM,gBAAgB,WAAW,CAAC;AACzC,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC3C,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAC7C,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAC1C,eAAO,MAAM,uBAAuB,WAAW,CAAC;AAChD,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAC7C,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAC/C,eAAO,MAAM,mBAAmB,WAAW,CAAC;AAC5C,eAAO,MAAM,gBAAgB,WAAW,CAAC;AAGzC,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,eAAO,MAAM,uBAAuB,YAAY,CAAC;AACjD,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAE1C,eAAO,MAAM,uBAAuB,UAAU,CAAC;AAC/C,eAAO,MAAM,4BAA4B,WAAW,CAAC;AAErD,eAAO,MAAM,oBAAoB,YAAY,CAAC;AAC9C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAC7C,eAAO,MAAM,kBAAkB,YAAY,CAAC;AAG5C,eAAO,MAAM,gBAAgB,UAAU,CAAC;AAExC,eAAO,MAAM,qBAAqB,WAAW,CAAC;AAC9C,eAAO,MAAM,kBAAkB,WAAW,CAAC;AAC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BAA0B,WAAW,CAAC;AACnD,eAAO,MAAM,wBAAwB,WAAW,CAAC;AACjD,eAAO,MAAM,6BAA6B,UAAU,CAAC;AAErD,eAAO,MAAM,kCAAkC,WAAW,CAAC;AAE3D,eAAO,MAAM,YAAY,WAAW,CAAC;AAErC,eAAO,MAAM,cAAc,WAAW,CAAC;AACvC,eAAO,MAAM,kBAAkB,UAAU,CAAC;AAC1C,eAAO,MAAM,mBAAmB,YAAY,CAAC;AAG7C,eAAO,MAAM,cAAc,YAAY,CAAC;AACxC,eAAO,MAAM,mBAAmB,aAAa,CAAC;AAC9C,eAAO,MAAM,YAAY,WAAW,CAAC;AACrC,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,gBAAgB,YAAY,CAAC;AAC1C,eAAO,MAAM,2BAA2B,YAAY,CAAC;AACrD,eAAO,MAAM,+BAA+B,YAAY,CAAC;AAGzD,eAAO,MAAM,WAAW,WAAW,CAAC;AACpC,eAAO,MAAM,WAAW,YAAY,CAAC;AAGrC,eAAO,MAAM,sBAAsB,WAAW,CAAC;AAC/C,eAAO,MAAM,iBAAiB,WAAW,CAAC;AAE1C,eAAO,MAAM,yBAAyB,YAAY,CAAC;AACnD,eAAO,MAAM,uBAAuB,YAAY,CAAC;AACjD,eAAO,MAAM,gCAAgC,YAAY,CAAC"}
@@ -51,8 +51,8 @@ exports.typesExpressVersion = '^4.17.21';
51
51
  exports.isbotVersion = '^3.6.5';
52
52
  exports.corsVersion = '~2.8.5';
53
53
  exports.typesCorsVersion = '~2.8.12';
54
- exports.moduleFederationNodeVersion = '^2.7.9';
55
- exports.moduleFederationEnhancedVersion = '^0.17.0';
54
+ exports.moduleFederationNodeVersion = '^2.7.11';
55
+ exports.moduleFederationEnhancedVersion = '^0.18.0';
56
56
  // style preprocessors
57
57
  exports.lessVersion = '3.12.2';
58
58
  exports.sassVersion = '^1.55.0';
@@ -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"}