@nx/angular 21.0.0-beta.1 → 21.0.0-beta.11

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 (117) hide show
  1. package/fesm2022/nx-angular.mjs +0 -352
  2. package/fesm2022/nx-angular.mjs.map +1 -1
  3. package/generators.json +7 -2
  4. package/index.d.ts +1 -1
  5. package/migrations.json +199 -69
  6. package/ng-package.json +1 -1
  7. package/package.json +11 -14
  8. package/src/builders/dev-server/dev-server.impl.js +2 -3
  9. package/src/builders/dev-server/lib/normalize-options.js +1 -0
  10. package/src/builders/dev-server/schema.d.ts +4 -0
  11. package/src/builders/dev-server/schema.json +10 -4
  12. package/src/builders/webpack-browser/schema.d.ts +1 -4
  13. package/src/builders/webpack-browser/schema.json +5 -0
  14. package/src/builders/webpack-browser/webpack-browser.impl.js +5 -5
  15. package/src/executors/delegate-build/delegate-build.impl.d.ts +1 -3
  16. package/src/executors/delegate-build/delegate-build.impl.js +0 -3
  17. package/src/executors/module-federation-dev-server/schema.d.ts +3 -0
  18. package/src/executors/module-federation-dev-server/schema.json +2 -1
  19. package/src/executors/module-federation-ssr-dev-server/schema.json +1 -0
  20. package/src/executors/package/package.impl.js +1 -4
  21. package/src/generators/add-linting/add-linting.js +2 -17
  22. package/src/generators/add-linting/lib/create-eslint-configuration.d.ts +2 -2
  23. package/src/generators/add-linting/lib/create-eslint-configuration.js +2 -2
  24. package/src/generators/add-linting/schema.d.ts +1 -0
  25. package/src/generators/application/application.js +20 -1
  26. package/src/generators/application/files/rspack-ssr/server.ts__tmpl__ +72 -0
  27. package/src/generators/application/lib/add-e2e.js +2 -9
  28. package/src/generators/application/lib/add-linting.js +2 -2
  29. package/src/generators/application/lib/add-serve-static-target.js +1 -0
  30. package/src/generators/application/lib/add-unit-test-runner.js +2 -0
  31. package/src/generators/application/lib/create-project.js +1 -0
  32. package/src/generators/application/lib/normalize-options.d.ts +1 -1
  33. package/src/generators/application/lib/normalize-options.js +10 -4
  34. package/src/generators/application/schema.d.ts +2 -2
  35. package/src/generators/application/schema.json +1 -7
  36. package/src/generators/component-test/component-test.js +1 -1
  37. package/src/generators/convert-to-rspack/convert-to-rspack.d.ts +4 -0
  38. package/src/generators/convert-to-rspack/convert-to-rspack.js +329 -0
  39. package/src/generators/convert-to-rspack/lib/create-config.d.ts +2 -0
  40. package/src/generators/convert-to-rspack/lib/create-config.js +45 -0
  41. package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.d.ts +6 -0
  42. package/src/generators/convert-to-rspack/lib/get-custom-webpack-config.js +77 -0
  43. package/src/generators/convert-to-rspack/lib/update-tsconfig.d.ts +2 -0
  44. package/src/generators/convert-to-rspack/lib/update-tsconfig.js +26 -0
  45. package/src/generators/convert-to-rspack/lib/validate-supported-executor.d.ts +2 -0
  46. package/src/generators/convert-to-rspack/lib/validate-supported-executor.js +14 -0
  47. package/src/generators/convert-to-rspack/schema.d.ts +5 -0
  48. package/src/generators/convert-to-rspack/schema.json +30 -0
  49. package/src/generators/host/host.js +1 -1
  50. package/src/generators/host/schema.d.ts +0 -1
  51. package/src/generators/host/schema.json +0 -6
  52. package/src/generators/library/lib/add-project.d.ts +1 -1
  53. package/src/generators/library/lib/add-project.js +7 -1
  54. package/src/generators/library/lib/normalize-options.js +3 -4
  55. package/src/generators/library/lib/normalized-schema.d.ts +0 -1
  56. package/src/generators/library/library.js +6 -3
  57. package/src/generators/library/schema.d.ts +0 -1
  58. package/src/generators/library/schema.json +0 -6
  59. package/src/generators/move/move.d.ts +3 -0
  60. package/src/generators/move/move.js +3 -0
  61. package/src/generators/ng-add/migrators/projects/e2e.migrator.js +4 -4
  62. package/src/generators/ngrx/ngrx.d.ts +3 -0
  63. package/src/generators/ngrx/ngrx.js +3 -0
  64. package/src/generators/ngrx/schema.json +1 -1
  65. package/src/generators/ngrx-feature-store/schema.d.ts +1 -1
  66. package/src/generators/remote/remote.js +1 -1
  67. package/src/generators/remote/schema.d.ts +0 -1
  68. package/src/generators/remote/schema.json +0 -6
  69. package/src/generators/setup-mf/lib/setup-serve-target.js +1 -0
  70. package/src/generators/setup-ssr/files/v19+/application-builder/ngmodule-src/app/__rootModuleFileName__ +2 -2
  71. package/src/generators/setup-ssr/files/v19+/application-builder/server/__serverFileName__ +1 -1
  72. package/src/generators/setup-ssr/files/v19+/application-builder/standalone-src/app/app.config.server.ts__tpl__ +2 -2
  73. package/src/generators/setup-ssr/files/v19+/application-builder-common-engine/server/__serverFileName__ +2 -0
  74. package/src/generators/setup-ssr/lib/generate-files.js +12 -1
  75. package/src/generators/setup-ssr/lib/update-project-config.js +1 -0
  76. package/src/generators/stories/stories.js +2 -2
  77. package/src/generators/utils/add-jest.d.ts +1 -0
  78. package/src/generators/utils/add-jest.js +2 -2
  79. package/src/generators/utils/add-vitest.d.ts +1 -0
  80. package/src/generators/utils/add-vitest.js +1 -1
  81. package/src/generators/utils/ensure-angular-dependencies.js +0 -1
  82. package/src/generators/utils/testing.js +1 -2
  83. package/src/migrations/update-16-2-0/switch-data-persistence-operators-imports-to-ngrx-router-store.js +4 -4
  84. package/src/migrations/update-19-6-0/turn-off-dts-by-default.js +2 -2
  85. package/src/migrations/{update-16-1-0 → update-20-5-0}/update-angular-cli.d.ts +1 -1
  86. package/src/migrations/{update-16-1-0 → update-20-5-0}/update-angular-cli.js +1 -1
  87. package/src/migrations/{update-16-1-0/remove-ngcc-invocation.d.ts → update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.d.ts} +1 -1
  88. package/src/migrations/update-21-0-0/change-data-persistence-operators-imports-to-ngrx-router-store-data-persistence.js +122 -0
  89. package/src/migrations/update-21-0-0/set-continuous-option.d.ts +3 -0
  90. package/src/migrations/update-21-0-0/set-continuous-option.js +29 -0
  91. package/src/plugins/plugin.js +2 -0
  92. package/src/utils/backward-compatible-versions.js +2 -0
  93. package/src/utils/nx-devkit/ast-utils.d.ts +0 -8
  94. package/src/utils/nx-devkit/ast-utils.js +7 -12
  95. package/src/utils/versions.d.ts +7 -6
  96. package/src/utils/versions.js +8 -7
  97. package/fesm2022/nx-angular-testing.mjs +0 -45
  98. package/fesm2022/nx-angular-testing.mjs.map +0 -1
  99. package/src/migrations/update-16-0-0/remove-karma-defaults.d.ts +0 -2
  100. package/src/migrations/update-16-0-0/remove-karma-defaults.js +0 -52
  101. package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.d.ts +0 -2
  102. package/src/migrations/update-16-0-0/remove-library-generator-simple-module-name-option.js +0 -40
  103. package/src/migrations/update-16-0-0/remove-protractor-defaults.d.ts +0 -2
  104. package/src/migrations/update-16-0-0/remove-protractor-defaults.js +0 -52
  105. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.d.ts +0 -2
  106. package/src/migrations/update-16-0-0-add-nx-packages/update-16-0-0-add-nx-packages.js +0 -9
  107. package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.d.ts +0 -2
  108. package/src/migrations/update-16-1-0/extract-standalone-config-from-bootstrap.js +0 -127
  109. package/src/migrations/update-16-1-0/remove-ngcc-invocation.js +0 -22
  110. package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.d.ts +0 -2
  111. package/src/migrations/update-16-1-0/remove-render-module-platform-server-exports.js +0 -62
  112. package/src/migrations/update-16-1-0/update-server-executor-config.d.ts +0 -2
  113. package/src/migrations/update-16-1-0/update-server-executor-config.js +0 -26
  114. package/src/runtime/nx/data-persistence.d.ts +0 -276
  115. package/testing/index.d.ts +0 -1
  116. package/testing/ng-package.json +0 -6
  117. package/testing/src/testing-utils.d.ts +0 -33
@@ -1,14 +1,6 @@
1
1
  import { Tree } from '@nx/devkit';
2
2
  import type * as ts from 'typescript';
3
3
  type DecoratorName = 'Component' | 'Directive' | 'NgModule' | 'Pipe';
4
- /**
5
- * Check if the Component, Directive or Pipe is standalone
6
- * @param sourceFile TS Source File containing the token to check
7
- * @param decoratorName The type of decorator to check (Component, Directive, Pipe)
8
- *
9
- * @deprecated Use the function signature with a Tree. This signature will be removed in v21.
10
- */
11
- export declare function isStandalone(sourceFile: ts.SourceFile, decoratorName: DecoratorName): boolean;
12
4
  /**
13
5
  * Check if the Component, Directive or Pipe is standalone
14
6
  * @param tree The file system tree
@@ -77,18 +77,13 @@ function _angularImportsFromNode(node, _sourceFile) {
77
77
  return {};
78
78
  }
79
79
  }
80
- function isStandalone(treeOrSourceFile, sourceFileOrDecoratorName, decoratorName) {
81
- let tree;
82
- let sourceFile;
83
- if (decoratorName === undefined) {
84
- sourceFile = treeOrSourceFile;
85
- decoratorName = sourceFileOrDecoratorName;
86
- }
87
- else {
88
- tree = treeOrSourceFile;
89
- sourceFile = sourceFileOrDecoratorName;
90
- decoratorName = decoratorName;
91
- }
80
+ /**
81
+ * Check if the Component, Directive or Pipe is standalone
82
+ * @param tree The file system tree
83
+ * @param sourceFile TS Source File containing the token to check
84
+ * @param decoratorName The type of decorator to check (Component, Directive, Pipe)
85
+ */
86
+ function isStandalone(tree, sourceFile, decoratorName) {
92
87
  const decoratorMetadata = getDecoratorMetadata(sourceFile, decoratorName, '@angular/core');
93
88
  const hasStandaloneTrue = decoratorMetadata.some((node) => node.getText().includes('standalone: true'));
94
89
  if (hasStandaloneTrue) {
@@ -1,7 +1,8 @@
1
1
  export declare const nxVersion: any;
2
- export declare const angularVersion = "~19.1.0";
3
- export declare const angularDevkitVersion = "~19.1.0";
4
- export declare const ngPackagrVersion = "~19.1.0";
2
+ export declare const angularVersion = "~19.2.0";
3
+ export declare const angularDevkitVersion = "~19.2.0";
4
+ export declare const ngPackagrVersion = "~19.2.0";
5
+ export declare const angularRspackVersion = "^20.7.0";
5
6
  export declare const ngrxVersion = "^19.0.0";
6
7
  export declare const rxjsVersion = "~7.8.0";
7
8
  export declare const zoneJsVersion = "~0.15.0";
@@ -12,9 +13,9 @@ export declare const typesCorsVersion = "~2.8.5";
12
13
  export declare const expressVersion = "^4.21.2";
13
14
  export declare const typesExpressVersion = "^4.17.21";
14
15
  export declare const browserSyncVersion = "^3.0.0";
15
- export declare const moduleFederationNodeVersion = "^2.6.21";
16
- export declare const moduleFederationEnhancedVersion = "^0.8.8";
17
- export declare const angularEslintVersion = "^19.0.2";
16
+ export declare const moduleFederationNodeVersion = "^2.6.26";
17
+ export declare const moduleFederationEnhancedVersion = "^0.9.0";
18
+ export declare const angularEslintVersion = "^19.2.0";
18
19
  export declare const typescriptEslintVersion = "^7.16.0";
19
20
  export declare const tailwindVersion = "^3.0.2";
20
21
  export declare const postcssVersion = "^8.4.5";
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptEslintVersion = exports.angularEslintVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.browserSyncVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.angularJsVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.ngPackagrVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
3
+ exports.jsoncEslintParserVersion = exports.jasmineMarblesVersion = exports.typesNodeVersion = exports.jestPresetAngularVersion = exports.tsNodeVersion = exports.autoprefixerVersion = exports.postcssUrlVersion = exports.postcssVersion = exports.tailwindVersion = exports.typescriptEslintVersion = exports.angularEslintVersion = exports.moduleFederationEnhancedVersion = exports.moduleFederationNodeVersion = exports.browserSyncVersion = exports.typesExpressVersion = exports.expressVersion = exports.typesCorsVersion = exports.corsVersion = exports.tsLibVersion = exports.angularJsVersion = exports.zoneJsVersion = exports.rxjsVersion = exports.ngrxVersion = exports.angularRspackVersion = exports.ngPackagrVersion = exports.angularDevkitVersion = exports.angularVersion = exports.nxVersion = void 0;
4
4
  exports.nxVersion = require('../../package.json').version;
5
- exports.angularVersion = '~19.1.0';
6
- exports.angularDevkitVersion = '~19.1.0';
7
- exports.ngPackagrVersion = '~19.1.0';
5
+ exports.angularVersion = '~19.2.0';
6
+ exports.angularDevkitVersion = '~19.2.0';
7
+ exports.ngPackagrVersion = '~19.2.0';
8
+ exports.angularRspackVersion = '^20.7.0';
8
9
  exports.ngrxVersion = '^19.0.0';
9
10
  exports.rxjsVersion = '~7.8.0';
10
11
  exports.zoneJsVersion = '~0.15.0';
@@ -15,9 +16,9 @@ exports.typesCorsVersion = '~2.8.5';
15
16
  exports.expressVersion = '^4.21.2';
16
17
  exports.typesExpressVersion = '^4.17.21';
17
18
  exports.browserSyncVersion = '^3.0.0';
18
- exports.moduleFederationNodeVersion = '^2.6.21';
19
- exports.moduleFederationEnhancedVersion = '^0.8.8';
20
- exports.angularEslintVersion = '^19.0.2';
19
+ exports.moduleFederationNodeVersion = '^2.6.26';
20
+ exports.moduleFederationEnhancedVersion = '^0.9.0';
21
+ exports.angularEslintVersion = '^19.2.0';
21
22
  exports.typescriptEslintVersion = '^7.16.0';
22
23
  exports.tailwindVersion = '^3.0.2';
23
24
  exports.postcssVersion = '^8.4.5';
@@ -1,45 +0,0 @@
1
- import { toArray, first } from 'rxjs/operators';
2
-
3
- /**
4
- * @deprecated This will be removed in Nx v21. If using RxJS 7, use `firstValueFrom(obs$.pipe(toArray()))`
5
- * or `lastValueFrom(obs$.pipe(toArray()))`. If using RxJS 6, use `obs$.pipe(toArray()).toPromise()`.
6
- *
7
- * @whatItDoes reads all the values from an observable and returns a promise
8
- * with an array of all values. This should be used in combination with async/await.
9
- *
10
- * ## Example
11
- *
12
- * ```typescript
13
- * const obs = of(1, 2, 3, 4);
14
- * const res = await readAll(obs)
15
- * expect(res).toEqual([1, 2, 3, 4]);
16
- * ```
17
- */
18
- function readAll(o) {
19
- return o.pipe(toArray()).toPromise();
20
- }
21
- /**
22
- * @deprecated This will be removed in Nx v21. Since RxJS 7, use `firstValueFrom(obs$)`. If using RxJS 6,
23
- * use `obs$.pipe(first()).toPromise()`.
24
- *
25
- * @whatItDoes reads the first value from an observable and returns a promise
26
- * with it. This should be used in combination with async/await.
27
- *
28
- * ## Example
29
- *
30
- * ```typescript
31
- * const obs = of(1, 2, 3, 4);
32
- * const res = await readFirst(obs)
33
- * expect(res).toEqual(1);
34
- * ```
35
- */
36
- function readFirst(o) {
37
- return o.pipe(first()).toPromise();
38
- }
39
-
40
- /**
41
- * Generated bundle index. Do not edit.
42
- */
43
-
44
- export { readAll, readFirst };
45
- //# sourceMappingURL=nx-angular-testing.mjs.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"nx-angular-testing.mjs","sources":["../../../../packages/angular/testing/src/testing-utils.ts","../../../../packages/angular/testing/nx-angular-testing.ts"],"sourcesContent":["import type { Observable } from 'rxjs';\nimport { first, toArray } from 'rxjs/operators';\n\n/**\n * @deprecated This will be removed in Nx v21. If using RxJS 7, use `firstValueFrom(obs$.pipe(toArray()))`\n * or `lastValueFrom(obs$.pipe(toArray()))`. If using RxJS 6, use `obs$.pipe(toArray()).toPromise()`.\n *\n * @whatItDoes reads all the values from an observable and returns a promise\n * with an array of all values. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readAll(obs)\n * expect(res).toEqual([1, 2, 3, 4]);\n * ```\n */\nexport function readAll<T>(o: Observable<T>): Promise<T[]> {\n return o.pipe(toArray()).toPromise();\n}\n\n/**\n * @deprecated This will be removed in Nx v21. Since RxJS 7, use `firstValueFrom(obs$)`. If using RxJS 6,\n * use `obs$.pipe(first()).toPromise()`.\n *\n * @whatItDoes reads the first value from an observable and returns a promise\n * with it. This should be used in combination with async/await.\n *\n * ## Example\n *\n * ```typescript\n * const obs = of(1, 2, 3, 4);\n * const res = await readFirst(obs)\n * expect(res).toEqual(1);\n * ```\n */\nexport function readFirst<T>(o: Observable<T>): Promise<T> {\n return o.pipe(first()).toPromise();\n}\n","/**\n * Generated bundle index. Do not edit.\n */\n\nexport * from './index';\n"],"names":[],"mappings":";;AAGA;;;;;;;;;;;;;;AAcG;AACG,SAAU,OAAO,CAAI,CAAgB,EAAA;IACzC,OAAO,CAAC,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC,CAAC,SAAS,EAAE;AACtC;AAEA;;;;;;;;;;;;;;AAcG;AACG,SAAU,SAAS,CAAI,CAAgB,EAAA;IAC3C,OAAO,CAAC,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC,SAAS,EAAE;AACpC;;ACvCA;;AAEG;;;;"}
@@ -1,2 +0,0 @@
1
- import type { Tree } from '@nx/devkit';
2
- export default function removeKarmaDefaults(tree: Tree): Promise<void>;
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = removeKarmaDefaults;
4
- const devkit_1 = require("@nx/devkit");
5
- const GENERATORS = ['application', 'library', 'host', 'remote'];
6
- const CANDIDATE_GENERATOR_COLLECTIONS = ['@nrwl/angular', '@nx/angular'];
7
- async function removeKarmaDefaults(tree) {
8
- const nxJson = (0, devkit_1.readNxJson)(tree);
9
- if (nxJson.generators) {
10
- const updatedConfig = updateUnitTestRunner(nxJson.generators);
11
- if (updatedConfig) {
12
- (0, devkit_1.updateNxJson)(tree, nxJson);
13
- }
14
- }
15
- const projects = (0, devkit_1.getProjects)(tree);
16
- for (const [projectName, projectConfig] of projects) {
17
- if (projectConfig.generators) {
18
- const updatedProject = updateUnitTestRunner(projectConfig.generators);
19
- if (updatedProject) {
20
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
21
- }
22
- }
23
- }
24
- await (0, devkit_1.formatFiles)(tree);
25
- }
26
- function updateUnitTestRunner(generatorsConfig) {
27
- const generators = Object.entries(generatorsConfig);
28
- let updatedConfig = false;
29
- for (const [generatorName, generatorDefaults] of generators) {
30
- if (CANDIDATE_GENERATOR_COLLECTIONS.includes(generatorName)) {
31
- for (const possibleGenerator of GENERATORS) {
32
- if (generatorDefaults[possibleGenerator] &&
33
- generatorDefaults[possibleGenerator]['unitTestRunner'] &&
34
- generatorDefaults[possibleGenerator]['unitTestRunner'] === 'karma') {
35
- generatorsConfig[generatorName][possibleGenerator]['unitTestRunner'] =
36
- undefined;
37
- updatedConfig = true;
38
- }
39
- }
40
- }
41
- if (!GENERATORS.map((v) => `@nrwl/angular:${v}`).includes(generatorName) &&
42
- !GENERATORS.map((v) => `@nx/angular:${v}`).includes(generatorName)) {
43
- continue;
44
- }
45
- if (generatorDefaults['unitTestRunner'] &&
46
- generatorDefaults['unitTestRunner'] === 'karma') {
47
- generatorsConfig[generatorName]['unitTestRunner'] = undefined;
48
- updatedConfig = true;
49
- }
50
- }
51
- return updatedConfig;
52
- }
@@ -1,2 +0,0 @@
1
- import type { Tree } from '@nx/devkit';
2
- export default function removeLibraryGeneratorSimpleModuleNameOption(tree: Tree): Promise<void>;
@@ -1,40 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = removeLibraryGeneratorSimpleModuleNameOption;
4
- const devkit_1 = require("@nx/devkit");
5
- async function removeLibraryGeneratorSimpleModuleNameOption(tree) {
6
- const nxJson = (0, devkit_1.readNxJson)(tree);
7
- // update global config
8
- const nxJsonUpdated = replaceSimpleModuleNameInConfig(nxJson);
9
- if (nxJsonUpdated) {
10
- (0, devkit_1.updateNxJson)(tree, nxJson);
11
- }
12
- // update project configs
13
- const projects = (0, devkit_1.getProjects)(tree);
14
- for (const [name, project] of projects) {
15
- const projectUpdated = replaceSimpleModuleNameInConfig(project);
16
- if (projectUpdated) {
17
- (0, devkit_1.updateProjectConfiguration)(tree, name, project);
18
- }
19
- }
20
- await (0, devkit_1.formatFiles)(tree);
21
- }
22
- function replaceSimpleModuleNameInConfig(configObject) {
23
- if (!configObject?.generators) {
24
- return false;
25
- }
26
- let updated = false;
27
- if (configObject.generators['@nrwl/angular']?.['library']?.simpleModuleName) {
28
- configObject.generators['@nrwl/angular']['library'].simpleName ??=
29
- configObject.generators['@nrwl/angular']['library'].simpleModuleName;
30
- delete configObject.generators['@nrwl/angular']['library'].simpleModuleName;
31
- updated = true;
32
- }
33
- else if (configObject.generators['@nrwl/angular:library']?.simpleModuleName) {
34
- configObject.generators['@nrwl/angular:library'].simpleName ??=
35
- configObject.generators['@nrwl/angular:library'].simpleModuleName;
36
- delete configObject.generators['@nrwl/angular:library'].simpleModuleName;
37
- updated = true;
38
- }
39
- return updated;
40
- }
@@ -1,2 +0,0 @@
1
- import type { Tree } from '@nx/devkit';
2
- export default function removeProtractorDefaults(tree: Tree): Promise<void>;
@@ -1,52 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = removeProtractorDefaults;
4
- const devkit_1 = require("@nx/devkit");
5
- const GENERATORS = ['application', 'host', 'remote'];
6
- const CANDIDATE_GENERATOR_COLLECTIONS = ['@nrwl/angular', '@nx/angular'];
7
- async function removeProtractorDefaults(tree) {
8
- const nxJson = (0, devkit_1.readNxJson)(tree);
9
- if (nxJson.generators) {
10
- const updatedConfig = updateE2ETestRunner(nxJson.generators);
11
- if (updatedConfig) {
12
- (0, devkit_1.updateNxJson)(tree, nxJson);
13
- }
14
- }
15
- const projects = (0, devkit_1.getProjects)(tree);
16
- for (const [projectName, projectConfig] of projects) {
17
- if (projectConfig.generators) {
18
- const updatedProject = updateE2ETestRunner(projectConfig.generators);
19
- if (updatedProject) {
20
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfig);
21
- }
22
- }
23
- }
24
- await (0, devkit_1.formatFiles)(tree);
25
- }
26
- function updateE2ETestRunner(generatorsConfig) {
27
- const generators = Object.entries(generatorsConfig);
28
- let updatedConfig = false;
29
- for (const [generatorName, generatorDefaults] of generators) {
30
- if (CANDIDATE_GENERATOR_COLLECTIONS.includes(generatorName)) {
31
- for (const possibleGenerator of GENERATORS) {
32
- if (generatorDefaults[possibleGenerator] &&
33
- generatorDefaults[possibleGenerator]['e2eTestRunner'] &&
34
- generatorDefaults[possibleGenerator]['e2eTestRunner'] === 'protractor') {
35
- generatorsConfig[generatorName][possibleGenerator]['e2eTestRunner'] =
36
- undefined;
37
- updatedConfig = true;
38
- }
39
- }
40
- }
41
- if (!GENERATORS.map((v) => `@nrwl/angular:${v}`).includes(generatorName) &&
42
- !GENERATORS.map((v) => `@nx/angular:${v}`).includes(generatorName)) {
43
- continue;
44
- }
45
- if (generatorDefaults['e2eTestRunner'] &&
46
- generatorDefaults['e2eTestRunner'] === 'protractor') {
47
- generatorsConfig[generatorName]['e2eTestRunner'] = undefined;
48
- updatedConfig = true;
49
- }
50
- }
51
- return updatedConfig;
52
- }
@@ -1,2 +0,0 @@
1
- import { Tree } from '@nx/devkit';
2
- export default function replacePackage(tree: Tree): Promise<void>;
@@ -1,9 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = replacePackage;
4
- const devkit_1 = require("@nx/devkit");
5
- const replace_package_1 = require("@nx/devkit/src/utils/replace-package");
6
- async function replacePackage(tree) {
7
- await (0, replace_package_1.replaceNrwlPackageWithNxPackage)(tree, '@nrwl/angular', '@nx/angular');
8
- await (0, devkit_1.formatFiles)(tree);
9
- }
@@ -1,2 +0,0 @@
1
- import type { Tree } from '@nx/devkit';
2
- export default function extractStandaloneConfig(tree: Tree): Promise<void>;
@@ -1,127 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = extractStandaloneConfig;
4
- const devkit_1 = require("@nx/devkit");
5
- const ensure_typescript_1 = require("@nx/js/src/utils/typescript/ensure-typescript");
6
- const path_1 = require("path");
7
- const projects_1 = require("../utils/projects");
8
- let tsModule;
9
- let tsquery;
10
- function getBootstrapCallFileInfo(tree, project, mainFilePath) {
11
- const IMPORT_BOOTSTRAP_FILE = 'CallExpression:has(ImportKeyword) > StringLiteral';
12
- let bootstrapCallFilePath = mainFilePath;
13
- let bootstrapCallFileContents = tree.read(bootstrapCallFilePath, 'utf-8');
14
- const ast = tsquery.ast(bootstrapCallFileContents);
15
- const importBootstrapNodes = tsquery(ast, IMPORT_BOOTSTRAP_FILE, {
16
- visitAllChildren: true,
17
- });
18
- if (importBootstrapNodes.length > 0 &&
19
- importBootstrapNodes[0].getText().includes('./bootstrap')) {
20
- bootstrapCallFilePath = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'bootstrap.ts');
21
- bootstrapCallFileContents = tree.read(bootstrapCallFilePath, 'utf-8');
22
- }
23
- return { bootstrapCallFilePath, bootstrapCallFileContents };
24
- }
25
- function getImportTokenMap(bootstrapCallFileContentsAst) {
26
- const importTokenMap = new Map();
27
- const importedTokensNodes = tsquery(bootstrapCallFileContentsAst, 'ImportDeclaration > ImportClause', { visitAllChildren: true });
28
- for (const node of importedTokensNodes) {
29
- importTokenMap.set(node.getText(), node.parent.getText());
30
- }
31
- return importTokenMap;
32
- }
33
- function getImportsRequiredForAppConfig(importTokenMap, appConfigNode, oldSourceFilePath, newSourceFilePath) {
34
- const identifiers = tsquery.query(appConfigNode, 'Identifier:not(PropertyAssignment > Identifier)', { visitAllChildren: true });
35
- const appConfigImports = new Set();
36
- const originalImportsToRemove = new Set();
37
- for (const identifier of identifiers) {
38
- for (const key of importTokenMap.keys()) {
39
- if (!key.includes(identifier.getText())) {
40
- continue;
41
- }
42
- let importText = importTokenMap.get(key);
43
- originalImportsToRemove.add(importText);
44
- if (oldSourceFilePath === newSourceFilePath ||
45
- oldSourceFilePath.split('/').length ===
46
- newSourceFilePath.split('/').length) {
47
- appConfigImports.add(importText);
48
- continue;
49
- }
50
- const importPath = tsquery
51
- .query(importText, 'StringLiteral', {
52
- visitAllChildren: true,
53
- })[0]
54
- .getText()
55
- .replace(/'/g, '')
56
- .replace(/"/g, '');
57
- if (importPath.startsWith('.')) {
58
- const resolvedImportPath = (0, path_1.resolve)((0, path_1.dirname)(oldSourceFilePath), importPath);
59
- const newRelativeImportPath = (0, path_1.relative)((0, path_1.dirname)(newSourceFilePath), resolvedImportPath);
60
- importText = importText.replace(importPath, newRelativeImportPath.startsWith('.')
61
- ? newRelativeImportPath
62
- : `./${newRelativeImportPath}`);
63
- }
64
- appConfigImports.add(importText);
65
- }
66
- }
67
- return {
68
- appConfigImports: Array.from(appConfigImports),
69
- importsToRemoveFromSource: Array.from(originalImportsToRemove),
70
- };
71
- }
72
- function getAppConfigFileContents(importsRequiredForAppConfig, appConfigText) {
73
- const buildAppConfigFileContents = (importStatements, appConfig) => `import { ApplicationConfig } from '@angular/core';${importStatements.join('\n')}
74
- export const appConfig: ApplicationConfig = ${appConfig}`;
75
- const appConfigFileContents = buildAppConfigFileContents(importsRequiredForAppConfig, appConfigText);
76
- return appConfigFileContents;
77
- }
78
- function getBootstrapCallFileContents(bootstrapCallFileContents, appConfigNode, importsRequiredForAppConfig) {
79
- let newBootstrapCallFileContents = `import { appConfig } from './app/app.config';
80
- ${bootstrapCallFileContents.slice(0, appConfigNode.getStart())}appConfig${bootstrapCallFileContents.slice(appConfigNode.getEnd())}`;
81
- for (const importStatement of importsRequiredForAppConfig) {
82
- newBootstrapCallFileContents = newBootstrapCallFileContents.replace(importStatement, '');
83
- }
84
- return newBootstrapCallFileContents;
85
- }
86
- async function extractStandaloneConfig(tree) {
87
- if (!tsModule) {
88
- tsModule = (0, ensure_typescript_1.ensureTypescript)();
89
- }
90
- if (!tsquery) {
91
- tsquery = require('@phenomnomnominal/tsquery').tsquery;
92
- }
93
- const projects = await (0, projects_1.getProjectsFilteredByDependencies)(tree, [
94
- 'npm:@angular/core',
95
- ]);
96
- const BOOTSTRAP_APPLICATION_CALL_SELECTOR = 'CallExpression:has(Identifier[name=bootstrapApplication])';
97
- const BOOTSTRAP_APPLICATION_CALL_CONFIG_SELECTOR = 'CallExpression:has(Identifier[name=bootstrapApplication]) > ObjectLiteralExpression';
98
- for (const { project } of projects) {
99
- if (project.projectType !== 'application') {
100
- continue;
101
- }
102
- if (project.targets?.build?.options?.main === undefined) {
103
- continue;
104
- }
105
- const { bootstrapCallFilePath, bootstrapCallFileContents } = getBootstrapCallFileInfo(tree, project, project.targets.build.options.main);
106
- const bootstrapCallFileContentsAst = tsquery.ast(bootstrapCallFileContents);
107
- const nodes = tsquery(bootstrapCallFileContentsAst, BOOTSTRAP_APPLICATION_CALL_SELECTOR, { visitAllChildren: true });
108
- if (nodes.length === 0) {
109
- continue;
110
- }
111
- const importTokenMap = getImportTokenMap(bootstrapCallFileContentsAst);
112
- const bootstrapCallNode = nodes[0];
113
- const appConfigNodes = tsquery(bootstrapCallNode, BOOTSTRAP_APPLICATION_CALL_CONFIG_SELECTOR, { visitAllChildren: true });
114
- if (appConfigNodes.length === 0) {
115
- continue;
116
- }
117
- const appConfigNode = appConfigNodes[0];
118
- const appConfigText = appConfigNode.getText();
119
- const appConfigFilePath = (0, devkit_1.joinPathFragments)(project.sourceRoot, 'app/app.config.ts');
120
- const { appConfigImports, importsToRemoveFromSource } = getImportsRequiredForAppConfig(importTokenMap, appConfigNode, bootstrapCallFilePath, appConfigFilePath);
121
- const appConfigFileContents = getAppConfigFileContents(appConfigImports, appConfigText);
122
- tree.write(appConfigFilePath, appConfigFileContents);
123
- let newBootstrapCallFileContents = getBootstrapCallFileContents(bootstrapCallFileContents, appConfigNode, importsToRemoveFromSource);
124
- tree.write(bootstrapCallFilePath, newBootstrapCallFileContents);
125
- }
126
- await (0, devkit_1.formatFiles)(tree);
127
- }
@@ -1,22 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const devkit_1 = require("@nx/devkit");
5
- async function default_1(tree) {
6
- (0, devkit_1.updateJson)(tree, 'package.json', (json) => {
7
- if (!json.scripts?.postinstall?.includes('ngcc ')) {
8
- return json;
9
- }
10
- json.scripts.postinstall = json.scripts.postinstall
11
- // special case when ngcc is at the start so we remove the && as well
12
- .replace(/^(ngcc.*?&& *)(.*)/, '$2')
13
- // everything else
14
- .replace(/(.*?)((&& *)?ngcc.*?)((?=&)|$)(.*)/, '$1$5')
15
- .trim();
16
- if (json.scripts.postinstall === '') {
17
- json.scripts.postinstall = undefined;
18
- }
19
- return json;
20
- });
21
- await (0, devkit_1.formatFiles)(tree);
22
- }
@@ -1,2 +0,0 @@
1
- import type { Tree } from '@nx/devkit';
2
- export default function (tree: Tree): Promise<void>;
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const tslib_1 = require("tslib");
5
- const devkit_1 = require("@nx/devkit");
6
- const ts = tslib_1.__importStar(require("typescript"));
7
- const file_change_recorder_1 = require("../../utils/file-change-recorder");
8
- async function default_1(tree) {
9
- (0, devkit_1.visitNotIgnoredFiles)(tree, '/', (path) => {
10
- if (path.endsWith('.ts') && !path.endsWith('.d.ts')) {
11
- const content = tree.read(path, 'utf8');
12
- if (content.includes('@angular/platform-server') &&
13
- content.includes('renderModule')) {
14
- const source = ts.createSourceFile(path, content.toString().replace(/^\uFEFF/, ''), ts.ScriptTarget.Latest, true);
15
- let recorder;
16
- let printer;
17
- ts.forEachChild(source, function analyze(node) {
18
- if (!(ts.isExportDeclaration(node) &&
19
- node.moduleSpecifier &&
20
- ts.isStringLiteral(node.moduleSpecifier) &&
21
- node.moduleSpecifier.text === '@angular/platform-server' &&
22
- node.exportClause &&
23
- ts.isNamedExports(node.exportClause))) {
24
- // Not a @angular/platform-server named export.
25
- return;
26
- }
27
- const exportClause = node.exportClause;
28
- const newElements = [];
29
- for (const element of exportClause.elements) {
30
- if (element.name.text !== 'renderModule') {
31
- newElements.push(element);
32
- }
33
- }
34
- if (newElements.length === exportClause.elements.length) {
35
- // No changes
36
- return;
37
- }
38
- recorder ??= new file_change_recorder_1.FileChangeRecorder(tree, path);
39
- if (newElements.length) {
40
- // Update named exports as there are leftovers.
41
- const newExportClause = ts.factory.updateNamedExports(exportClause, newElements);
42
- printer ??= ts.createPrinter();
43
- const fix = printer.printNode(ts.EmitHint.Unspecified, newExportClause, source);
44
- const index = exportClause.getStart();
45
- const length = exportClause.getWidth();
46
- recorder.remove(index, index + length);
47
- recorder.insertLeft(index, fix);
48
- }
49
- else {
50
- // Delete export as no exports remain.
51
- recorder.remove(node.getStart(), node.getStart() + node.getWidth());
52
- }
53
- ts.forEachChild(node, analyze);
54
- });
55
- if (recorder) {
56
- recorder.applyChanges();
57
- }
58
- }
59
- }
60
- });
61
- await (0, devkit_1.formatFiles)(tree);
62
- }
@@ -1,2 +0,0 @@
1
- import type { Tree } from '@nx/devkit';
2
- export default function (tree: Tree): Promise<void>;
@@ -1,26 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.default = default_1;
4
- const devkit_1 = require("@nx/devkit");
5
- const executor_options_utils_1 = require("@nx/devkit/src/generators/executor-options-utils");
6
- const executors = [
7
- '@angular-devkit/build-angular:server',
8
- '@nx/angular:server',
9
- '@nrwl/angular:server',
10
- ];
11
- async function default_1(tree) {
12
- executors.forEach((executor) => {
13
- (0, executor_options_utils_1.forEachExecutorOptions)(tree, executor, (_options, projectName, targetName, configurationName) => {
14
- const projectConfiguration = (0, devkit_1.readProjectConfiguration)(tree, projectName);
15
- const configToUpdate = configurationName
16
- ? projectConfiguration.targets[targetName].configurations[configurationName]
17
- : projectConfiguration.targets[targetName].options;
18
- if (configToUpdate?.buildOptimizer === undefined &&
19
- configToUpdate?.optimization !== undefined) {
20
- configToUpdate.buildOptimizer = !!configToUpdate.optimization;
21
- }
22
- (0, devkit_1.updateProjectConfiguration)(tree, projectName, projectConfiguration);
23
- });
24
- });
25
- await (0, devkit_1.formatFiles)(tree);
26
- }