@nx/angular 23.0.0-beta.15 → 23.0.0-beta.17

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 (23) hide show
  1. package/package.json +8 -8
  2. package/src/builders/utilities/module-federation.d.ts.map +1 -1
  3. package/src/builders/utilities/module-federation.js +7 -8
  4. package/src/builders/utilities/webpack.d.ts.map +1 -1
  5. package/src/builders/utilities/webpack.js +2 -6
  6. package/src/executors/utilities/esbuild-extensions.d.ts.map +1 -1
  7. package/src/executors/utilities/esbuild-extensions.js +5 -24
  8. package/src/executors/utilities/module-loader.d.ts +1 -1
  9. package/src/executors/utilities/module-loader.d.ts.map +1 -1
  10. package/src/executors/utilities/module-loader.js +24 -20
  11. package/src/generators/add-linting/add-linting.d.ts.map +1 -1
  12. package/src/generators/add-linting/add-linting.js +10 -12
  13. package/src/generators/add-linting/lib/add-angular-eslint-dependencies.d.ts.map +1 -1
  14. package/src/generators/add-linting/lib/add-angular-eslint-dependencies.js +3 -4
  15. package/src/generators/convert-to-rspack/lib/create-config.js +1 -1
  16. package/src/generators/cypress-component-configuration/cypress-component-configuration.d.ts.map +1 -1
  17. package/src/generators/cypress-component-configuration/cypress-component-configuration.js +2 -2
  18. package/src/generators/ng-add/utilities/workspace.js +4 -4
  19. package/src/generators/setup-mf/files/ts-webpack/module-federation.config.ts__tmpl__ +1 -1
  20. package/src/generators/setup-mf/setup-mf.d.ts.map +1 -1
  21. package/src/generators/setup-mf/setup-mf.js +6 -0
  22. package/src/migrations/update-20-2-0/disable-angular-eslint-prefer-standalone.js +8 -8
  23. package/src/migrations/update-20-2-0/remove-angular-eslint-rules.js +6 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nx/angular",
3
- "version": "23.0.0-beta.15",
3
+ "version": "23.0.0-beta.17",
4
4
  "private": false,
5
5
  "description": "The Nx Plugin for Angular contains executors, generators, and utilities for managing Angular applications and libraries within an Nx workspace. It provides: \n\n- Integration with libraries such as Storybook, Jest, ESLint, Playwright and Cypress. \n\n- Generators to help scaffold code quickly (like: Micro Frontends, Libraries, both internal to your codebase and publishable to npm) \n\n- Single Component Application Modules (SCAMs) \n\n- NgRx helpers. \n\n- Utilities for automatic workspace refactoring.",
6
6
  "repository": {
@@ -61,13 +61,13 @@
61
61
  "migrations": "./migrations.json"
62
62
  },
63
63
  "dependencies": {
64
- "@nx/devkit": "23.0.0-beta.15",
65
- "@nx/eslint": "23.0.0-beta.15",
66
- "@nx/js": "23.0.0-beta.15",
67
- "@nx/module-federation": "23.0.0-beta.15",
68
- "@nx/rspack": "23.0.0-beta.15",
69
- "@nx/web": "23.0.0-beta.15",
70
- "@nx/webpack": "23.0.0-beta.15",
64
+ "@nx/devkit": "23.0.0-beta.17",
65
+ "@nx/eslint": "23.0.0-beta.17",
66
+ "@nx/js": "23.0.0-beta.17",
67
+ "@nx/module-federation": "23.0.0-beta.17",
68
+ "@nx/rspack": "23.0.0-beta.17",
69
+ "@nx/web": "23.0.0-beta.17",
70
+ "@nx/webpack": "23.0.0-beta.17",
71
71
  "@phenomnomnominal/tsquery": "~6.2.0",
72
72
  "@typescript-eslint/type-utils": "^8.0.0",
73
73
  "enquirer": "~2.3.6",
@@ -1 +1 @@
1
- {"version":3,"file":"module-federation.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/builders/utilities/module-federation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAK1D,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAElD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,OAAO,2BAA2B,EAAE,cAAc,EAC3D,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EACvD,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,EAC1B,kBAAkB,EAAE,MAAM,GAAG,SAAS,GACrC,MAAM,EAAE,CA6DV;AA0CD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,OAAO,2BAA2B,EAAE,cAAc,EAC3D,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EACvD,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GACzB,MAAM,EAAE,CAoCV;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE;IACP,UAAU,EAAE,mBAAmB,EAAE,CAAC;CACnC,EACD,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,GACtD,IAAI,CAgBN;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,oBAAoB,EAC7B,aAAa,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CAepB"}
1
+ {"version":3,"file":"module-federation.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/builders/utilities/module-federation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAK1D,MAAM,MAAM,mBAAmB,GAC3B,MAAM,GACN;IAAE,UAAU,EAAE,MAAM,CAAC;IAAC,aAAa,EAAE,MAAM,CAAA;CAAE,CAAC;AAElD,wBAAgB,iBAAiB,CAC/B,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,OAAO,2BAA2B,EAAE,cAAc,EAC3D,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EACvD,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,EAC1B,kBAAkB,EAAE,MAAM,GAAG,SAAS,GACrC,MAAM,EAAE,CA6DV;AA2CD,wBAAgB,gBAAgB,CAC9B,OAAO,EAAE,oBAAoB,EAC7B,OAAO,EAAE,OAAO,2BAA2B,EAAE,cAAc,EAC3D,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,EACvD,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,GACzB,MAAM,EAAE,CAoCV;AAED,wBAAgB,kBAAkB,CAChC,OAAO,EAAE;IACP,UAAU,EAAE,mBAAmB,EAAE,CAAC;CACnC,EACD,iBAAiB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAAC,GACtD,IAAI,CAgBN;AAED,wBAAgB,wBAAwB,CACtC,OAAO,EAAE,oBAAoB,EAC7B,aAAa,EAAE,MAAM,GACpB,MAAM,GAAG,SAAS,CAepB"}
@@ -47,15 +47,14 @@ function getDynamicRemotes(project, context, workspaceProjects, remotesToSkip, p
47
47
  function getModuleFederationConfig(tsconfigPath, workspaceRoot, projectRoot) {
48
48
  const moduleFederationConfigPathJS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.js');
49
49
  const moduleFederationConfigPathTS = (0, path_1.join)(workspaceRoot, projectRoot, 'module-federation.config.ts');
50
- let moduleFederationConfigPath = moduleFederationConfigPathJS;
51
- let cleanupTranspiler = () => { };
52
- if ((0, fs_1.existsSync)(moduleFederationConfigPathTS)) {
53
- cleanupTranspiler = (0, internal_1.registerTsProject)((0, path_1.join)(workspaceRoot, tsconfigPath));
54
- moduleFederationConfigPath = moduleFederationConfigPathTS;
55
- }
50
+ const isTsConfig = (0, fs_1.existsSync)(moduleFederationConfigPathTS);
51
+ const moduleFederationConfigPath = isTsConfig
52
+ ? moduleFederationConfigPathTS
53
+ : moduleFederationConfigPathJS;
56
54
  try {
57
- const config = require(moduleFederationConfigPath);
58
- cleanupTranspiler();
55
+ const config = isTsConfig
56
+ ? (0, internal_1.loadTsFile)(moduleFederationConfigPath, (0, path_1.join)(workspaceRoot, tsconfigPath))
57
+ : require(moduleFederationConfigPath);
59
58
  return {
60
59
  mfeConfig: config.default || config,
61
60
  mfConfigPath: moduleFederationConfigPath,
@@ -1 +1 @@
1
- {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/builders/utilities/webpack.ts"],"names":[],"mappings":"AAMA,wBAAsB,wBAAwB,CAC5C,iBAAiB,EAAE,GAAG,EACtB,mBAAmB,EAAE,MAAM,EAC3B,OAAO,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC/C,MAAM,EAAE,OAAO,2BAA2B,EAAE,MAAM,gBAqDnD;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAUxE;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,2BAA2B,EAAE,MAAM,IAQ1C,cAAS,SAClB"}
1
+ {"version":3,"file":"webpack.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/builders/utilities/webpack.ts"],"names":[],"mappings":"AAMA,wBAAsB,wBAAwB,CAC5C,iBAAiB,EAAE,GAAG,EACtB,mBAAmB,EAAE,MAAM,EAC3B,OAAO,EAAE;IAAE,QAAQ,EAAE,MAAM,CAAC;IAAC,CAAC,CAAC,EAAE,MAAM,GAAG,GAAG,CAAA;CAAE,EAC/C,MAAM,EAAE,OAAO,2BAA2B,EAAE,MAAM,gBAqDnD;AAED,wBAAgB,0BAA0B,CAAC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAQxE;AAED,wBAAgB,2BAA2B,CACzC,IAAI,EAAE,MAAM,EACZ,QAAQ,EAAE,MAAM,EAChB,MAAM,EAAE,OAAO,2BAA2B,EAAE,MAAM,IAK1C,cAAS,SAClB"}
@@ -51,9 +51,7 @@ async function mergeCustomWebpackConfig(baseWebpackConfig, pathToWebpackConfig,
51
51
  return newConfig;
52
52
  }
53
53
  function resolveCustomWebpackConfig(path, tsConfig) {
54
- const cleanupTranspiler = (0, internal_1.registerTsProject)(tsConfig);
55
- const customWebpackConfig = require(path);
56
- cleanupTranspiler();
54
+ const customWebpackConfig = (0, internal_1.loadTsFile)(path, tsConfig);
57
55
  // If the user provides a configuration in TS file
58
56
  // then there are 2 cases for exporting an object. The first one is:
59
57
  // `module.exports = { ... }`. And the second one is:
@@ -62,9 +60,7 @@ function resolveCustomWebpackConfig(path, tsConfig) {
62
60
  return customWebpackConfig.default ?? customWebpackConfig;
63
61
  }
64
62
  function resolveIndexHtmlTransformer(path, tsConfig, target) {
65
- const cleanupTranspiler = (0, internal_1.registerTsProject)(tsConfig);
66
- const indexTransformer = require(path);
67
- cleanupTranspiler();
63
+ const indexTransformer = (0, internal_1.loadTsFile)(path, tsConfig);
68
64
  const transform = indexTransformer.default ?? indexTransformer;
69
65
  return (indexHtml) => transform(target, indexHtml);
70
66
  }
@@ -1 +1 @@
1
- {"version":3,"file":"esbuild-extensions.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/executors/utilities/esbuild-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAOvD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,GAAG,SAAS,EAC5C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAcnB;AAgBD,wBAAsB,cAAc,CAClC,aAAa,EAAE,MAAM,EAAE,GAAG,SAAS,EACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,GAAG,EAAE,CAAC,CAWhB;AAED,wBAAsB,wBAAwB,CAC5C,wBAAwB,EAAE,MAAM,EAChC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,GAAG,CAAC,CAQd"}
1
+ {"version":3,"file":"esbuild-extensions.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/executors/utilities/esbuild-extensions.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAMvD,KAAK,MAAM,GAAG,UAAU,CAAC,OAAO,gBAAgB,CAAC,CAAC,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,MAAM,MAAM,UAAU,GAAG;IACvB,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,GAAG,CAAC;CACd,CAAC;AAEF,wBAAsB,WAAW,CAC/B,OAAO,EAAE,MAAM,EAAE,GAAG,UAAU,EAAE,GAAG,SAAS,EAC5C,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,MAAM,EAAE,CAAC,CAQnB;AAmBD,wBAAsB,cAAc,CAClC,aAAa,EAAE,MAAM,EAAE,GAAG,SAAS,EACnC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,GAAG,EAAE,CAAC,CAOhB;AAED,wBAAsB,wBAAwB,CAC5C,wBAAwB,EAAE,MAAM,EAChC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,GAAG,CAAC,CAEd"}
@@ -3,23 +3,16 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.loadPlugins = loadPlugins;
4
4
  exports.loadMiddleware = loadMiddleware;
5
5
  exports.loadIndexHtmlTransformer = loadIndexHtmlTransformer;
6
- const internal_1 = require("@nx/js/internal");
7
6
  const module_loader_1 = require("./module-loader");
8
7
  async function loadPlugins(plugins, tsConfig) {
9
8
  if (!plugins?.length) {
10
9
  return [];
11
10
  }
12
- const cleanupTranspiler = (0, internal_1.registerTsProject)(tsConfig);
13
- try {
14
- return await Promise.all(plugins.map((plugin) => loadPlugin(plugin)));
15
- }
16
- finally {
17
- cleanupTranspiler();
18
- }
11
+ return Promise.all(plugins.map((plugin) => loadPlugin(plugin, tsConfig)));
19
12
  }
20
- async function loadPlugin(pluginSpec) {
13
+ async function loadPlugin(pluginSpec, tsConfig) {
21
14
  const pluginPath = typeof pluginSpec === 'string' ? pluginSpec : pluginSpec.path;
22
- let plugin = await (0, module_loader_1.loadModule)(pluginPath);
15
+ let plugin = await (0, module_loader_1.loadModule)(pluginPath, tsConfig);
23
16
  if (typeof plugin === 'function') {
24
17
  plugin =
25
18
  typeof pluginSpec === 'object' ? plugin(pluginSpec.options) : plugin();
@@ -30,20 +23,8 @@ async function loadMiddleware(middlewareFns, tsConfig) {
30
23
  if (!middlewareFns?.length) {
31
24
  return [];
32
25
  }
33
- const cleanupTranspiler = (0, internal_1.registerTsProject)(tsConfig);
34
- try {
35
- return await Promise.all(middlewareFns.map((fnPath) => (0, module_loader_1.loadModule)(fnPath)));
36
- }
37
- finally {
38
- cleanupTranspiler();
39
- }
26
+ return Promise.all(middlewareFns.map((fnPath) => (0, module_loader_1.loadModule)(fnPath, tsConfig)));
40
27
  }
41
28
  async function loadIndexHtmlTransformer(indexHtmlTransformerPath, tsConfig) {
42
- const cleanupTranspiler = (0, internal_1.registerTsProject)(tsConfig);
43
- try {
44
- return await (0, module_loader_1.loadModule)(indexHtmlTransformerPath);
45
- }
46
- finally {
47
- cleanupTranspiler();
48
- }
29
+ return (0, module_loader_1.loadModule)(indexHtmlTransformerPath, tsConfig);
49
30
  }
@@ -1,4 +1,4 @@
1
- export declare function loadModule<T = any>(path: string): Promise<T>;
1
+ export declare function loadModule<T = any>(path: string, tsConfig?: string): Promise<T>;
2
2
  /**
3
3
  * This uses a dynamic import to load a module which may be ESM.
4
4
  * CommonJS code can load ESM code via a dynamic import. Unfortunately, TypeScript
@@ -1 +1 @@
1
- {"version":3,"file":"module-loader.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/executors/utilities/module-loader.ts"],"names":[],"mappings":"AAGA,wBAAsB,UAAU,CAAC,CAAC,GAAG,GAAG,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,CAAC,CAAC,CAyBlE;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAO3E"}
1
+ {"version":3,"file":"module-loader.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/executors/utilities/module-loader.ts"],"names":[],"mappings":"AAIA,wBAAsB,UAAU,CAAC,CAAC,GAAG,GAAG,EACtC,IAAI,EAAE,MAAM,EACZ,QAAQ,CAAC,EAAE,MAAM,GAChB,OAAO,CAAC,CAAC,CAAC,CA+BZ;AAOD;;;;;;;;;;;GAWG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,GAAG,EAAE,UAAU,EAAE,MAAM,GAAG,GAAG,GAAG,OAAO,CAAC,CAAC,CAAC,CAO3E"}
@@ -4,29 +4,33 @@ exports.loadModule = loadModule;
4
4
  exports.loadEsmModule = loadEsmModule;
5
5
  const path_1 = require("path");
6
6
  const node_url_1 = require("node:url");
7
- async function loadModule(path) {
8
- switch ((0, path_1.extname)(path)) {
9
- case '.mjs': {
7
+ const internal_1 = require("@nx/js/internal");
8
+ async function loadModule(path, tsConfig) {
9
+ const ext = (0, path_1.extname)(path);
10
+ if (ext === '.mjs') {
11
+ const result = await loadEsmModule((0, node_url_1.pathToFileURL)(path));
12
+ return result.default ?? result;
13
+ }
14
+ if (ext === '.cjs') {
15
+ const result = (0, internal_1.requireWithTsconfigFallback)(path, tsConfig);
16
+ return result.default ?? result;
17
+ }
18
+ const isTs = ext === '.ts' || ext === '.cts' || ext === '.mts';
19
+ try {
20
+ const result = isTs && tsConfig
21
+ ? (0, internal_1.loadTsFile)(path, tsConfig)
22
+ : (0, internal_1.requireWithTsconfigFallback)(path, tsConfig);
23
+ return result.default ?? result;
24
+ }
25
+ catch (e) {
26
+ // ERR_REQUIRE_ESM (legacy) and ERR_REQUIRE_ASYNC_MODULE (Node 22.12+,
27
+ // ESM with top-level await) both indicate the module must be loaded via
28
+ // dynamic import.
29
+ if (e.code === 'ERR_REQUIRE_ESM' || e.code === 'ERR_REQUIRE_ASYNC_MODULE') {
10
30
  const result = await loadEsmModule((0, node_url_1.pathToFileURL)(path));
11
31
  return result.default ?? result;
12
32
  }
13
- case '.cjs': {
14
- const result = require(path);
15
- return result.default ?? result;
16
- }
17
- default:
18
- // it can be CommonJS or ESM, try both
19
- try {
20
- const result = require(path);
21
- return result.default ?? result;
22
- }
23
- catch (e) {
24
- if (e.code === 'ERR_REQUIRE_ESM') {
25
- const result = await loadEsmModule((0, node_url_1.pathToFileURL)(path));
26
- return result.default ?? result;
27
- }
28
- throw e;
29
- }
33
+ throw e;
30
34
  }
31
35
  }
32
36
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"add-linting.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/add-linting/add-linting.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAgBpB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAG1D,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CA8I5B;AAED,eAAe,mBAAmB,CAAC"}
1
+ {"version":3,"file":"add-linting.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/add-linting/add-linting.ts"],"names":[],"mappings":"AACA,OAAO,EAIL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAepB,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,UAAU,CAAC;AAE1D,wBAAsB,mBAAmB,CACvC,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,iBAAiB,CAAC,CA8I5B;AAED,eAAe,mBAAmB,CAAC"}
@@ -5,11 +5,9 @@ const internal_1 = require("@nx/devkit/internal");
5
5
  const devkit_1 = require("@nx/devkit");
6
6
  const eslint_1 = require("@nx/eslint");
7
7
  const assert_supported_angular_version_1 = require("../../utils/assert-supported-angular-version");
8
- const global_eslint_config_1 = require("@nx/eslint/src/generators/init/global-eslint-config");
9
- const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
8
+ const internal_2 = require("@nx/eslint/internal");
10
9
  const add_angular_eslint_dependencies_1 = require("./lib/add-angular-eslint-dependencies");
11
10
  const buildable_project_1 = require("./lib/buildable-project");
12
- const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
13
11
  async function addLintingGenerator(tree, options) {
14
12
  (0, assert_supported_angular_version_1.assertSupportedAngularVersion)(tree);
15
13
  const tasks = [];
@@ -29,16 +27,16 @@ async function addLintingGenerator(tree, options) {
29
27
  skipPackageJson: options.skipPackageJson,
30
28
  });
31
29
  tasks.push(lintTask);
32
- if ((0, eslint_file_1.isEslintConfigSupported)(tree)) {
33
- const eslintFile = (0, eslint_file_1.findEslintFile)(tree, options.projectRoot);
30
+ if ((0, internal_2.isEslintConfigSupported)(tree)) {
31
+ const eslintFile = (0, internal_2.findEslintFile)(tree, options.projectRoot);
34
32
  // keep parser options if they exist
35
33
  const hasParserOptions = tree
36
34
  .read((0, devkit_1.joinPathFragments)(options.projectRoot, eslintFile), 'utf8')
37
35
  .includes(`${options.projectRoot}/tsconfig.*?.json`);
38
- if ((0, flat_config_1.useFlatConfig)(tree)) {
39
- (0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(tree, options.projectRoot, 'flat/angular', { checkBaseConfig: true });
40
- (0, eslint_file_1.addPredefinedConfigToFlatLintConfig)(tree, options.projectRoot, 'flat/angular-template', { checkBaseConfig: true });
41
- (0, eslint_file_1.addOverrideToLintConfig)(tree, options.projectRoot, {
36
+ if ((0, internal_2.useFlatConfig)(tree)) {
37
+ (0, internal_2.addPredefinedConfigToFlatLintConfig)(tree, options.projectRoot, 'flat/angular', { checkBaseConfig: true });
38
+ (0, internal_2.addPredefinedConfigToFlatLintConfig)(tree, options.projectRoot, 'flat/angular-template', { checkBaseConfig: true });
39
+ (0, internal_2.addOverrideToLintConfig)(tree, options.projectRoot, {
42
40
  files: ['*.ts'],
43
41
  rules: {
44
42
  '@angular-eslint/directive-selector': [
@@ -59,14 +57,14 @@ async function addLintingGenerator(tree, options) {
59
57
  ],
60
58
  },
61
59
  });
62
- (0, eslint_file_1.addOverrideToLintConfig)(tree, options.projectRoot, {
60
+ (0, internal_2.addOverrideToLintConfig)(tree, options.projectRoot, {
63
61
  files: ['*.html'],
64
62
  rules: {},
65
63
  });
66
64
  }
67
65
  else {
68
- (0, eslint_file_1.replaceOverridesInLintConfig)(tree, options.projectRoot, [
69
- ...(rootProject ? [global_eslint_config_1.typeScriptOverride, global_eslint_config_1.javaScriptOverride] : []),
66
+ (0, internal_2.replaceOverridesInLintConfig)(tree, options.projectRoot, [
67
+ ...(rootProject ? [internal_2.typeScriptOverride, internal_2.javaScriptOverride] : []),
70
68
  {
71
69
  files: ['*.ts'],
72
70
  ...(hasParserOptions
@@ -1 +1 @@
1
- {"version":3,"file":"add-angular-eslint-dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/add-linting/lib/add-angular-eslint-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAMpB,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAiCnB"}
1
+ {"version":3,"file":"add-angular-eslint-dependencies.d.ts","sourceRoot":"","sources":["../../../../../../../packages/angular/src/generators/add-linting/lib/add-angular-eslint-dependencies.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AAQpB,wBAAgB,4BAA4B,CAC1C,IAAI,EAAE,IAAI,EACV,WAAW,EAAE,MAAM,GAClB,iBAAiB,CAiCnB"}
@@ -2,14 +2,13 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.addAngularEsLintDependencies = addAngularEsLintDependencies;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const flat_config_1 = require("@nx/eslint/src/utils/flat-config");
6
- const versions_1 = require("@nx/eslint/src/utils/versions");
5
+ const internal_1 = require("@nx/eslint/internal");
7
6
  const version_utils_1 = require("../../utils/version-utils");
8
7
  const buildable_project_1 = require("./buildable-project");
9
8
  function addAngularEsLintDependencies(tree, projectName) {
10
9
  const compatVersions = (0, version_utils_1.versions)(tree);
11
10
  const angularEslintVersionToInstall = compatVersions.angularEslintVersion;
12
- const usesEslintFlatConfig = (0, flat_config_1.useFlatConfig)(tree);
11
+ const usesEslintFlatConfig = (0, internal_1.useFlatConfig)(tree);
13
12
  const devDependencies = usesEslintFlatConfig
14
13
  ? {
15
14
  'angular-eslint': angularEslintVersionToInstall,
@@ -21,7 +20,7 @@ function addAngularEsLintDependencies(tree, projectName) {
21
20
  };
22
21
  if ('typescriptEslintVersion' in compatVersions) {
23
22
  devDependencies['@typescript-eslint/utils'] = usesEslintFlatConfig
24
- ? versions_1.eslint9__typescriptESLintVersion
23
+ ? internal_1.eslint9__typescriptESLintVersion
25
24
  : compatVersions.typescriptEslintVersion;
26
25
  }
27
26
  if ((0, buildable_project_1.isBuildableLibraryProject)(tree, projectName)) {
@@ -17,7 +17,7 @@ function createConfig(tree, opts, configurationOptions = {}, existingWebpackConf
17
17
  })
18
18
  .join(',\n')
19
19
  : '';
20
- const createConfigContents = `createConfig({
20
+ const createConfigContents = `createConfig({
21
21
  options: {
22
22
  root: __dirname,
23
23
  ${JSON.stringify(createConfigOptions, undefined, 2).slice(1, -1)}
@@ -1 +1 @@
1
- {"version":3,"file":"cypress-component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,EAMjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAapB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAiBxD;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CAuD5B;AAoJD,eAAe,6BAA6B,CAAC"}
1
+ {"version":3,"file":"cypress-component-configuration.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/cypress-component-configuration/cypress-component-configuration.ts"],"names":[],"mappings":"AAEA,OAAO,EAGL,iBAAiB,EAMjB,IAAI,EAEL,MAAM,YAAY,CAAC;AAapB,OAAO,EAAE,4BAA4B,EAAE,MAAM,UAAU,CAAC;AAiBxD;;;GAGG;AACH,wBAAsB,6BAA6B,CACjD,IAAI,EAAE,IAAI,EACV,OAAO,EAAE,4BAA4B,GACpC,OAAO,CAAC,iBAAiB,CAAC,CAuD5B;AAkJD,eAAe,6BAA6B,CAAC"}
@@ -183,7 +183,7 @@ async function configureCypressCT(tree, options) {
183
183
  }
184
184
  const { addDefaultCTConfig, getProjectCypressConfigPath } = require('@nx/cypress/src/utils/config');
185
185
  const cypressConfigPath = getProjectCypressConfigPath(tree, projectConfig.root);
186
- const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigPath, 'utf-8'), ctConfigOptions);
187
- tree.write(cypressConfigPath, `import { nxComponentTestingPreset } from '@nx/angular/plugins/component-testing';\n${updatedCyConfig}`);
186
+ const updatedCyConfig = await addDefaultCTConfig(tree.read(cypressConfigPath, 'utf-8'), ctConfigOptions, '@nx/angular/plugins/component-testing');
187
+ tree.write(cypressConfigPath, updatedCyConfig);
188
188
  }
189
189
  exports.default = cypressComponentConfiguration;
@@ -15,10 +15,10 @@ exports.deleteAngularJson = deleteAngularJson;
15
15
  exports.deleteGitKeepFilesIfNotNeeded = deleteGitKeepFilesIfNotNeeded;
16
16
  const devkit_1 = require("@nx/devkit");
17
17
  const eslint_1 = require("@nx/eslint");
18
- const setup_root_eslint_1 = require("@nx/eslint/src/generators/lint-project/setup-root-eslint");
18
+ const internal_1 = require("@nx/eslint/internal");
19
19
  const js_1 = require("@nx/js");
20
20
  const default_base_1 = require("nx/src/utils/default-base");
21
- const internal_1 = require("@nx/js/internal");
21
+ const internal_2 = require("@nx/js/internal");
22
22
  const angular_json_1 = require("nx/src/adapter/angular-json");
23
23
  const versions_1 = require("../../../utils/versions");
24
24
  const path_1 = require("path");
@@ -151,7 +151,7 @@ function updatePackageJson(tree) {
151
151
  packageJson.devDependencies['nx'] = versions_1.nxVersion;
152
152
  }
153
153
  if (!packageJson.devDependencies['prettier']) {
154
- packageJson.devDependencies['prettier'] = internal_1.prettierVersion;
154
+ packageJson.devDependencies['prettier'] = internal_2.prettierVersion;
155
155
  }
156
156
  return packageJson;
157
157
  });
@@ -162,7 +162,7 @@ async function updateRootEsLintConfig(tree, existingEsLintConfig, unitTestRunner
162
162
  });
163
163
  if (!existingEsLintConfig) {
164
164
  // There was no eslint config in the root, so we set it up and use it as-is
165
- (0, setup_root_eslint_1.setupRootEsLint)(tree, { unitTestRunner });
165
+ (0, internal_1.setupRootEsLint)(tree, { unitTestRunner });
166
166
  return;
167
167
  }
168
168
  existingEsLintConfig.ignorePatterns = ['**/*'];
@@ -1,4 +1,4 @@
1
- import { ModuleFederationConfig } from '@nx/module-federation';
1
+ import type { ModuleFederationConfig } from '@nx/module-federation';
2
2
 
3
3
  const config: ModuleFederationConfig = {
4
4
  name: '<%= name %>',<% if(type === 'host') { %>
@@ -1 +1 @@
1
- {"version":3,"file":"setup-mf.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/setup-mf/setup-mf.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AA4BpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,8BA2G3D;AAED,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"setup-mf.d.ts","sourceRoot":"","sources":["../../../../../../packages/angular/src/generators/setup-mf/setup-mf.ts"],"names":[],"mappings":"AAAA,OAAO,EAKL,KAAK,iBAAiB,EACtB,KAAK,IAAI,EACV,MAAM,YAAY,CAAC;AA6BpB,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,UAAU,CAAC;AAEvC,wBAAsB,OAAO,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,MAAM,8BA0H3D;AAED,eAAe,OAAO,CAAC"}
@@ -67,6 +67,12 @@ async function setupMf(tree, rawOptions) {
67
67
  if (!options.skipE2E) {
68
68
  (0, lib_1.addCypressOnErrorWorkaround)(tree, options);
69
69
  }
70
+ if (!options.skipPackageJson && options.typescriptConfiguration) {
71
+ // Angular custom-webpack loads webpack.config.ts at build time. Node native
72
+ // TS strip can't resolve the extensionless `./module-federation.config`
73
+ // import under strict ESM, so loadTsFile needs ts-node as the fallback.
74
+ tasks.push((0, devkit_1.addDependenciesToPackageJson)(tree, {}, { 'ts-node': versions_1.tsNodeVersion }, undefined, true));
75
+ }
70
76
  if (!options.skipPackageJson) {
71
77
  const { major: angularMajorVersion } = (0, version_utils_1.getInstalledAngularVersionInfo)(tree);
72
78
  if (angularMajorVersion >= 20) {
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.default = default_1;
4
4
  const devkit_1 = require("@nx/devkit");
5
- const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
5
+ const internal_1 = require("@nx/eslint/internal");
6
6
  const projects_1 = require("../utils/projects");
7
7
  const preferStandaloneRule = '@angular-eslint/prefer-standalone';
8
8
  async function default_1(tree) {
@@ -11,20 +11,20 @@ async function default_1(tree) {
11
11
  ]);
12
12
  for (const graphNode of projects) {
13
13
  const root = graphNode.data.root;
14
- if (!(0, eslint_file_1.isEslintConfigSupported)(tree, root)) {
14
+ if (!(0, internal_1.isEslintConfigSupported)(tree, root)) {
15
15
  // ESLint config is not supported, skip
16
16
  continue;
17
17
  }
18
- if ((0, eslint_file_1.lintConfigHasOverride)(tree, root, (o) => !!o.rules?.[preferStandaloneRule], true)) {
18
+ if ((0, internal_1.lintConfigHasOverride)(tree, root, (o) => !!o.rules?.[preferStandaloneRule], true)) {
19
19
  // the @angular-eslint/prefer-standalone rule is set in an override, skip
20
20
  continue;
21
21
  }
22
22
  const ngEslintOverrideLookup = (o) => o.files?.includes('*.ts') &&
23
23
  Object.keys(o.rules ?? {}).some((r) => r.startsWith('@angular-eslint/'));
24
24
  const tsFilesOverrideLookup = (o) => o.files?.length === 1 && o.files[0] === '*.ts';
25
- if ((0, eslint_file_1.lintConfigHasOverride)(tree, root, ngEslintOverrideLookup, false)) {
25
+ if ((0, internal_1.lintConfigHasOverride)(tree, root, ngEslintOverrideLookup, false)) {
26
26
  // there is an override containing an Angular ESLint rule
27
- (0, eslint_file_1.updateOverrideInLintConfig)(tree, root, ngEslintOverrideLookup, (o) => {
27
+ (0, internal_1.updateOverrideInLintConfig)(tree, root, ngEslintOverrideLookup, (o) => {
28
28
  o.rules = {
29
29
  ...o.rules,
30
30
  [preferStandaloneRule]: 'off',
@@ -32,9 +32,9 @@ async function default_1(tree) {
32
32
  return o;
33
33
  });
34
34
  }
35
- else if ((0, eslint_file_1.lintConfigHasOverride)(tree, root, tsFilesOverrideLookup, false)) {
35
+ else if ((0, internal_1.lintConfigHasOverride)(tree, root, tsFilesOverrideLookup, false)) {
36
36
  // there is an override for just *.ts files
37
- (0, eslint_file_1.updateOverrideInLintConfig)(tree, root, tsFilesOverrideLookup, (o) => {
37
+ (0, internal_1.updateOverrideInLintConfig)(tree, root, tsFilesOverrideLookup, (o) => {
38
38
  o.rules = {
39
39
  ...o.rules,
40
40
  [preferStandaloneRule]: 'off',
@@ -44,7 +44,7 @@ async function default_1(tree) {
44
44
  }
45
45
  else {
46
46
  // there are no overrides for any Angular ESLint rule or just *.ts files, add a new override
47
- (0, eslint_file_1.addOverrideToLintConfig)(tree, root, {
47
+ (0, internal_1.addOverrideToLintConfig)(tree, root, {
48
48
  files: ['*.ts'],
49
49
  rules: {
50
50
  [preferStandaloneRule]: 'off',
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.rulesToRemove = void 0;
4
4
  exports.default = default_1;
5
5
  const devkit_1 = require("@nx/devkit");
6
- const eslint_file_1 = require("@nx/eslint/src/generators/utils/eslint-file");
6
+ const internal_1 = require("@nx/eslint/internal");
7
7
  const projects_1 = require("../utils/projects");
8
8
  exports.rulesToRemove = [
9
9
  '@angular-eslint/no-host-metadata-property',
@@ -17,7 +17,7 @@ async function default_1(tree) {
17
17
  let hasRootProject = false;
18
18
  for (const graphNode of projects) {
19
19
  const root = graphNode.data.root;
20
- if (!(0, eslint_file_1.isEslintConfigSupported)(tree, root)) {
20
+ if (!(0, internal_1.isEslintConfigSupported)(tree, root)) {
21
21
  // ESLint config is not supported, skip
22
22
  continue;
23
23
  }
@@ -36,12 +36,12 @@ async function default_1(tree) {
36
36
  // check root config, provide a root so it doesn't try to lookup a base config
37
37
  if (!hasRootProject) {
38
38
  // if there is no root project the root eslint config has not been processed
39
- if ((0, eslint_file_1.isEslintConfigSupported)(tree, '')) {
39
+ if ((0, internal_1.isEslintConfigSupported)(tree, '')) {
40
40
  removeRules(tree, '');
41
41
  }
42
42
  }
43
43
  // handle root base config, not providing a root will prioritize a base config
44
- const baseEslintConfig = (0, eslint_file_1.findEslintFile)(tree);
44
+ const baseEslintConfig = (0, internal_1.findEslintFile)(tree);
45
45
  if (baseEslintConfig && baseEslintConfig.includes('.base.')) {
46
46
  removeRules(tree, baseEslintConfig);
47
47
  }
@@ -50,12 +50,12 @@ async function default_1(tree) {
50
50
  function removeRules(tree, root) {
51
51
  for (const rule of exports.rulesToRemove) {
52
52
  const lookup = (o) => !!o.rules?.[rule];
53
- if (!(0, eslint_file_1.lintConfigHasOverride)(tree, root, lookup)) {
53
+ if (!(0, internal_1.lintConfigHasOverride)(tree, root, lookup)) {
54
54
  // it's not using the rule, skip
55
55
  continue;
56
56
  }
57
57
  // there is an override containing the rule, remove the rule
58
- (0, eslint_file_1.updateOverrideInLintConfig)(tree, root, lookup, (o) => {
58
+ (0, internal_1.updateOverrideInLintConfig)(tree, root, lookup, (o) => {
59
59
  delete o.rules[rule];
60
60
  return o;
61
61
  });