@angular/core 21.0.0-next.5 → 21.0.0-next.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/fesm2022/{attribute.mjs → _attribute-chunk.mjs} +3 -3
  2. package/fesm2022/_attribute-chunk.mjs.map +1 -0
  3. package/fesm2022/{debug_node.mjs → _debug_node-chunk.mjs} +606 -92
  4. package/fesm2022/_debug_node-chunk.mjs.map +1 -0
  5. package/fesm2022/{effect.mjs → _effect-chunk.mjs} +4 -4
  6. package/fesm2022/_effect-chunk.mjs.map +1 -0
  7. package/fesm2022/{not_found.mjs → _not_found-chunk.mjs} +3 -3
  8. package/fesm2022/_not_found-chunk.mjs.map +1 -0
  9. package/fesm2022/{resource.mjs → _resource-chunk.mjs} +6 -6
  10. package/fesm2022/_resource-chunk.mjs.map +1 -0
  11. package/fesm2022/{root_effect_scheduler.mjs → _root_effect_scheduler-chunk.mjs} +6 -6
  12. package/fesm2022/_root_effect_scheduler-chunk.mjs.map +1 -0
  13. package/fesm2022/{signal.mjs → _signal-chunk.mjs} +10 -10
  14. package/fesm2022/_signal-chunk.mjs.map +1 -0
  15. package/fesm2022/{weak_ref.mjs → _weak_ref-chunk.mjs} +3 -3
  16. package/fesm2022/_weak_ref-chunk.mjs.map +1 -0
  17. package/fesm2022/core.mjs +14 -14
  18. package/fesm2022/core.mjs.map +1 -1
  19. package/fesm2022/{primitives/di.mjs → primitives-di.mjs} +4 -4
  20. package/fesm2022/primitives-di.mjs.map +1 -0
  21. package/fesm2022/{primitives/event-dispatch.mjs → primitives-event-dispatch.mjs} +4 -4
  22. package/fesm2022/primitives-event-dispatch.mjs.map +1 -0
  23. package/fesm2022/primitives-signals.mjs +221 -0
  24. package/fesm2022/primitives-signals.mjs.map +1 -0
  25. package/fesm2022/rxjs-interop.mjs +7 -7
  26. package/fesm2022/rxjs-interop.mjs.map +1 -1
  27. package/fesm2022/testing.mjs +7 -7
  28. package/fesm2022/testing.mjs.map +1 -1
  29. package/package.json +12 -12
  30. package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +5 -5
  31. package/schematics/bundles/application-config-core.cjs +5 -5
  32. package/schematics/bundles/{apply_import_manager-Bx60Uquz.cjs → apply_import_manager-D_4NSuRa.cjs} +3 -3
  33. package/schematics/bundles/bootstrap-options-migration.cjs +5 -5
  34. package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
  35. package/schematics/bundles/{compiler_host-Aouk-n4F.cjs → compiler_host-C1KRWoxv.cjs} +2 -2
  36. package/schematics/bundles/control-flow-migration.cjs +22 -21
  37. package/schematics/bundles/imports-DwPXlGFl.cjs +1 -1
  38. package/schematics/bundles/{index-Bb6iejCd.cjs → index-BFENxhdR.cjs} +32 -36
  39. package/schematics/bundles/{index-BZQb51Qf.cjs → index-DYqR8Lpq.cjs} +4 -6
  40. package/schematics/bundles/inject-migration.cjs +3 -3
  41. package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
  42. package/schematics/bundles/{migrate_ts_type_references-By2ZtKls.cjs → migrate_ts_type_references-CemH7A8e.cjs} +5 -5
  43. package/schematics/bundles/{ng_component_template-B4M8mTyv.cjs → ng_component_template-AYs8YXuT.cjs} +2 -2
  44. package/schematics/bundles/ng_decorators-BI0uV7KI.cjs +1 -1
  45. package/schematics/bundles/ngclass-to-class-migration.cjs +7 -7
  46. package/schematics/bundles/ngstyle-to-style-migration.cjs +7 -7
  47. package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
  48. package/schematics/bundles/output-migration.cjs +6 -6
  49. package/schematics/bundles/{parse_html-7Wl_HDnw.cjs → parse_html-6-AB4O-A.cjs} +2 -2
  50. package/schematics/bundles/{project_paths-Dr2s3Pq3.cjs → project_paths-EiOrjlNS.cjs} +3 -3
  51. package/schematics/bundles/{project_tsconfig_paths-DX9KHLn9.cjs → project_tsconfig_paths-BbVhi4fG.cjs} +156 -133
  52. package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
  53. package/schematics/bundles/route-lazy-loading.cjs +3 -3
  54. package/schematics/bundles/router-current-navigation.cjs +4 -4
  55. package/schematics/bundles/router-last-successful-navigation.cjs +4 -4
  56. package/schematics/bundles/self-closing-tags-migration.cjs +6 -6
  57. package/schematics/bundles/signal-input-migration.cjs +67 -8
  58. package/schematics/bundles/signal-queries-migration.cjs +7 -7
  59. package/schematics/bundles/signals.cjs +7 -7
  60. package/schematics/bundles/standalone-migration.cjs +106 -46
  61. package/schematics/bundles/symbol-BObKoqes.cjs +1 -1
  62. package/schematics/migrations.json +1 -2
  63. package/{api.d.d.ts → types/_api-chunk.d.ts} +3 -3
  64. package/{chrome_dev_tools_performance.d.d.ts → types/_chrome_dev_tools_performance-chunk.d.ts} +4 -4
  65. package/{discovery.d.d.ts → types/_discovery-chunk.d.ts} +15 -8
  66. package/{effect.d.d.ts → types/_effect-chunk.d.ts} +3 -3
  67. package/{event_dispatcher.d.d.ts → types/_event_dispatcher-chunk.d.ts} +2 -2
  68. package/{graph.d.d.ts → types/_formatter-chunk.d.ts} +15 -3
  69. package/{weak_ref.d.d.ts → types/_weak_ref-chunk.d.ts} +2 -2
  70. package/{index.d.ts → types/core.d.ts} +134 -16
  71. package/{primitives/di/index.d.ts → types/primitives-di.d.ts} +2 -2
  72. package/{primitives/event-dispatch/index.d.ts → types/primitives-event-dispatch.d.ts} +4 -4
  73. package/{primitives/signals/index.d.ts → types/primitives-signals.d.ts} +7 -7
  74. package/{rxjs-interop/index.d.ts → types/rxjs-interop.d.ts} +6 -6
  75. package/{testing/index.d.ts → types/testing.d.ts} +7 -7
  76. package/fesm2022/attribute.mjs.map +0 -1
  77. package/fesm2022/debug_node.mjs.map +0 -1
  78. package/fesm2022/effect.mjs.map +0 -1
  79. package/fesm2022/not_found.mjs.map +0 -1
  80. package/fesm2022/primitives/di.mjs.map +0 -1
  81. package/fesm2022/primitives/event-dispatch.mjs.map +0 -1
  82. package/fesm2022/primitives/signals.mjs +0 -88
  83. package/fesm2022/primitives/signals.mjs.map +0 -1
  84. package/fesm2022/resource.mjs.map +0 -1
  85. package/fesm2022/root_effect_scheduler.mjs.map +0 -1
  86. package/fesm2022/signal.mjs.map +0 -1
  87. package/fesm2022/weak_ref.mjs.map +0 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.5
3
+ * @license Angular v21.0.0-next.7
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.5
3
+ * @license Angular v21.0.0-next.7
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -9,8 +9,8 @@
9
9
  var schematics = require('@angular-devkit/schematics');
10
10
  var fs = require('fs');
11
11
  var p = require('path');
12
- var compiler_host = require('./compiler_host-Aouk-n4F.cjs');
13
- var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
12
+ var compiler_host = require('./compiler_host-C1KRWoxv.cjs');
13
+ var project_tsconfig_paths = require('./project_tsconfig_paths-BbVhi4fG.cjs');
14
14
  var ts = require('typescript');
15
15
  var property_name = require('./property_name-BBwFuqMe.cjs');
16
16
  require('os');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.5
3
+ * @license Angular v21.0.0-next.7
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -8,11 +8,11 @@
8
8
 
9
9
  var ts = require('typescript');
10
10
  require('os');
11
- require('./project_tsconfig_paths-DX9KHLn9.cjs');
12
- require('./index-Bb6iejCd.cjs');
11
+ require('./project_tsconfig_paths-BbVhi4fG.cjs');
12
+ require('./index-BFENxhdR.cjs');
13
13
  require('path');
14
14
  require('node:path');
15
- var project_paths = require('./project_paths-Dr2s3Pq3.cjs');
15
+ var project_paths = require('./project_paths-EiOrjlNS.cjs');
16
16
  var imports = require('./imports-DwPXlGFl.cjs');
17
17
  var symbol = require('./symbol-BObKoqes.cjs');
18
18
  require('@angular-devkit/core');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.5
3
+ * @license Angular v21.0.0-next.7
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -8,11 +8,11 @@
8
8
 
9
9
  var ts = require('typescript');
10
10
  require('os');
11
- require('./project_tsconfig_paths-DX9KHLn9.cjs');
12
- require('./index-Bb6iejCd.cjs');
11
+ require('./project_tsconfig_paths-BbVhi4fG.cjs');
12
+ require('./index-BFENxhdR.cjs');
13
13
  require('path');
14
14
  require('node:path');
15
- var project_paths = require('./project_paths-Dr2s3Pq3.cjs');
15
+ var project_paths = require('./project_paths-EiOrjlNS.cjs');
16
16
  var imports = require('./imports-DwPXlGFl.cjs');
17
17
  var symbol = require('./symbol-BObKoqes.cjs');
18
18
  require('@angular-devkit/core');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.5
3
+ * @license Angular v21.0.0-next.7
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -8,13 +8,13 @@
8
8
 
9
9
  var ts = require('typescript');
10
10
  require('os');
11
- var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
12
- require('./index-Bb6iejCd.cjs');
11
+ var project_tsconfig_paths = require('./project_tsconfig_paths-BbVhi4fG.cjs');
12
+ require('./index-BFENxhdR.cjs');
13
13
  require('path');
14
14
  require('node:path');
15
- var project_paths = require('./project_paths-Dr2s3Pq3.cjs');
16
- var ng_component_template = require('./ng_component_template-B4M8mTyv.cjs');
17
- var parse_html = require('./parse_html-7Wl_HDnw.cjs');
15
+ var project_paths = require('./project_paths-EiOrjlNS.cjs');
16
+ var ng_component_template = require('./ng_component_template-AYs8YXuT.cjs');
17
+ var parse_html = require('./parse_html-6-AB4O-A.cjs');
18
18
  require('@angular-devkit/core');
19
19
  require('node:path/posix');
20
20
  require('fs');
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.5
3
+ * @license Angular v21.0.0-next.7
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
- var migrate_ts_type_references = require('./migrate_ts_type_references-By2ZtKls.cjs');
9
+ var migrate_ts_type_references = require('./migrate_ts_type_references-CemH7A8e.cjs');
10
10
  var ts = require('typescript');
11
11
  require('os');
12
- var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
13
- var index$1 = require('./index-Bb6iejCd.cjs');
12
+ var project_tsconfig_paths = require('./project_tsconfig_paths-BbVhi4fG.cjs');
13
+ var index$1 = require('./index-BFENxhdR.cjs');
14
14
  require('path');
15
15
  require('node:path');
16
- var project_paths = require('./project_paths-Dr2s3Pq3.cjs');
17
- var index = require('./index-BZQb51Qf.cjs');
16
+ var project_paths = require('./project_paths-EiOrjlNS.cjs');
17
+ var index = require('./index-DYqR8Lpq.cjs');
18
18
  var assert = require('assert');
19
- var apply_import_manager = require('./apply_import_manager-Bx60Uquz.cjs');
19
+ var apply_import_manager = require('./apply_import_manager-D_4NSuRa.cjs');
20
20
  require('@angular-devkit/core');
21
21
  require('node:path/posix');
22
22
  require('./leading_space-D9nQ8UQC.cjs');
@@ -969,6 +969,12 @@ function populateKnownInputsFromGlobalData(knownInputs, globalData) {
969
969
  * @returns Replacements for converting the input.
970
970
  */
971
971
  function convertToSignalInput(node, { resolvedMetadata: metadata, resolvedType, preferShorthandIfPossible, originalInputDecorator, initialValue, leadingTodoText, }, info, checker, importManager, result) {
972
+ // Check for 'this' references in initializer before doing anything else
973
+ if (node.initializer &&
974
+ (ts.isArrowFunction(node.initializer) || ts.isFunctionExpression(node.initializer)) &&
975
+ containsThisReferences(node.initializer)) {
976
+ return []; // Skip migration for this input by returning empty replacements
977
+ }
972
978
  let optionsLiteral = null;
973
979
  // We need an options array for the input because:
974
980
  // - the input is either aliased,
@@ -1038,7 +1044,23 @@ function convertToSignalInput(node, { resolvedMetadata: metadata, resolvedType,
1038
1044
  if (!modifiersWithoutInputDecorator?.some((s) => s.kind === ts.SyntaxKind.ReadonlyKeyword)) {
1039
1045
  modifiersWithoutInputDecorator.push(ts.factory.createModifier(ts.SyntaxKind.ReadonlyKeyword));
1040
1046
  }
1041
- const newNode = ts.factory.createPropertyDeclaration(modifiersWithoutInputDecorator, node.name, undefined, undefined, inputInitializer);
1047
+ // Skip migration if the input is a function that references class members via 'this'
1048
+ if (inputInitializer &&
1049
+ (ts.isArrowFunction(inputInitializer) || ts.isFunctionExpression(inputInitializer))) {
1050
+ if (containsThisReferences(inputInitializer)) {
1051
+ return []; // Skip migration for this input by returning empty replacements
1052
+ }
1053
+ }
1054
+ let finalInitializer = inputInitializer;
1055
+ if (inputInitializer === undefined) {
1056
+ if (preferShorthandIfPossible === null) {
1057
+ finalInitializer = ts.factory.createIdentifier('undefined');
1058
+ }
1059
+ else {
1060
+ resolvedType = preferShorthandIfPossible.originalType;
1061
+ }
1062
+ }
1063
+ const newNode = ts.factory.createPropertyDeclaration(modifiersWithoutInputDecorator, node.name, undefined, undefined, finalInitializer);
1042
1064
  const newPropertyText = result.printer.printNode(ts.EmitHint.Unspecified, newNode, node.getSourceFile());
1043
1065
  const replacements = [];
1044
1066
  if (leadingTodoText !== null) {
@@ -1082,6 +1104,43 @@ function extractTransformOfInput(transform, resolvedType, checker) {
1082
1104
  leadingTodoText,
1083
1105
  };
1084
1106
  }
1107
+ /**
1108
+ * Checks if a function node contains any references to 'this'.
1109
+ * This is used to skip migration for functions that reference class members.
1110
+ */
1111
+ function containsThisReferences(node) {
1112
+ let hasThis = false;
1113
+ const visit = (node) => {
1114
+ if (hasThis)
1115
+ return;
1116
+ if (node.kind === ts.SyntaxKind.ThisKeyword) {
1117
+ hasThis = true;
1118
+ return;
1119
+ }
1120
+ if (ts.isPropertyAccessExpression(node)) {
1121
+ const expr = node.expression;
1122
+ if (ts.isIdentifier(expr) && expr.text === 'this') {
1123
+ hasThis = true;
1124
+ return;
1125
+ }
1126
+ }
1127
+ ts.forEachChild(node, visit);
1128
+ };
1129
+ if (ts.isArrowFunction(node) || ts.isFunctionExpression(node)) {
1130
+ if (node.body) {
1131
+ if (node.body.kind === ts.SyntaxKind.Block) {
1132
+ node.body.statements.forEach(visit);
1133
+ }
1134
+ else {
1135
+ visit(node.body);
1136
+ }
1137
+ }
1138
+ }
1139
+ else {
1140
+ ts.forEachChild(node, visit);
1141
+ }
1142
+ return hasThis;
1143
+ }
1085
1144
 
1086
1145
  /**
1087
1146
  * Phase that migrates `@Input()` declarations to signal inputs and
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.5
3
+ * @license Angular v21.0.0-next.7
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
- var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
9
+ var project_tsconfig_paths = require('./project_tsconfig_paths-BbVhi4fG.cjs');
10
10
  var ts = require('typescript');
11
11
  require('os');
12
- var index$1 = require('./index-Bb6iejCd.cjs');
12
+ var index$1 = require('./index-BFENxhdR.cjs');
13
13
  require('path');
14
14
  require('node:path');
15
- var project_paths = require('./project_paths-Dr2s3Pq3.cjs');
16
- var apply_import_manager = require('./apply_import_manager-Bx60Uquz.cjs');
17
- var migrate_ts_type_references = require('./migrate_ts_type_references-By2ZtKls.cjs');
15
+ var project_paths = require('./project_paths-EiOrjlNS.cjs');
16
+ var apply_import_manager = require('./apply_import_manager-D_4NSuRa.cjs');
17
+ var migrate_ts_type_references = require('./migrate_ts_type_references-CemH7A8e.cjs');
18
18
  var assert = require('assert');
19
- var index = require('./index-BZQb51Qf.cjs');
19
+ var index = require('./index-DYqR8Lpq.cjs');
20
20
  require('@angular-devkit/core');
21
21
  require('node:path/posix');
22
22
  require('fs');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.5
3
+ * @license Angular v21.0.0-next.7
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -10,7 +10,7 @@ var schematics = require('@angular-devkit/schematics');
10
10
  var signalQueriesMigration = require('./signal-queries-migration.cjs');
11
11
  var signalInputMigration = require('./signal-input-migration.cjs');
12
12
  var outputMigration = require('./output-migration.cjs');
13
- require('./project_tsconfig_paths-DX9KHLn9.cjs');
13
+ require('./project_tsconfig_paths-BbVhi4fG.cjs');
14
14
  require('typescript');
15
15
  require('os');
16
16
  require('fs');
@@ -18,14 +18,14 @@ require('module');
18
18
  require('path');
19
19
  require('url');
20
20
  require('@angular-devkit/core');
21
- require('./index-Bb6iejCd.cjs');
21
+ require('./index-BFENxhdR.cjs');
22
22
  require('node:path');
23
- require('./project_paths-Dr2s3Pq3.cjs');
23
+ require('./project_paths-EiOrjlNS.cjs');
24
24
  require('node:path/posix');
25
- require('./apply_import_manager-Bx60Uquz.cjs');
26
- require('./migrate_ts_type_references-By2ZtKls.cjs');
25
+ require('./apply_import_manager-D_4NSuRa.cjs');
26
+ require('./migrate_ts_type_references-CemH7A8e.cjs');
27
27
  require('assert');
28
- require('./index-BZQb51Qf.cjs');
28
+ require('./index-DYqR8Lpq.cjs');
29
29
  require('./leading_space-D9nQ8UQC.cjs');
30
30
 
31
31
  function migrate(options) {
@@ -1,18 +1,18 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.5
3
+ * @license Angular v21.0.0-next.7
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
9
  var schematics = require('@angular-devkit/schematics');
10
- var index = require('./index-Bb6iejCd.cjs');
10
+ var index = require('./index-BFENxhdR.cjs');
11
11
  var fs = require('fs');
12
12
  var p = require('path');
13
13
  var ts = require('typescript');
14
- var compiler_host = require('./compiler_host-Aouk-n4F.cjs');
15
- var project_tsconfig_paths = require('./project_tsconfig_paths-DX9KHLn9.cjs');
14
+ var compiler_host = require('./compiler_host-C1KRWoxv.cjs');
15
+ var project_tsconfig_paths = require('./project_tsconfig_paths-BbVhi4fG.cjs');
16
16
  var ng_decorators = require('./ng_decorators-BI0uV7KI.cjs');
17
17
  var nodes = require('./nodes-B16H9JUd.cjs');
18
18
  var symbol = require('./symbol-BObKoqes.cjs');
@@ -477,33 +477,42 @@ function moveDeclarationsToImports(literal, allDeclarations, typeChecker, templa
477
477
  ts.isArrayLiteralExpression(prop.initializer) &&
478
478
  prop.initializer.elements.hasTrailingComma);
479
479
  // Separate the declarations that we want to keep and ones we need to copy into the `imports`.
480
- if (ts.isPropertyAssignment(declarationsProp)) {
481
- // If the declarations are an array, we can analyze it to
482
- // find any classes from the current migration.
483
- if (ts.isArrayLiteralExpression(declarationsProp.initializer)) {
484
- for (const el of declarationsProp.initializer.elements) {
485
- if (ts.isIdentifier(el)) {
486
- const correspondingClass = findClassDeclaration(el, typeChecker);
487
- if (!correspondingClass ||
488
- // Check whether the declaration is either standalone already or is being converted
489
- // in this migration. We need to check if it's standalone already, in order to correct
490
- // some cases where the main app and the test files are being migrated in separate
491
- // programs.
492
- isStandaloneDeclaration(correspondingClass, allDeclarations, templateTypeChecker)) {
493
- declarationsToCopy.push(el);
480
+ if (ts.isPropertyAssignment(declarationsProp) ||
481
+ ts.isShorthandPropertyAssignment(declarationsProp)) {
482
+ // Handle both regular and shorthand property assignments
483
+ if (ts.isPropertyAssignment(declarationsProp)) {
484
+ // If the declarations are an array, we can analyze it to
485
+ // find any classes from the current migration.
486
+ if (ts.isArrayLiteralExpression(declarationsProp.initializer)) {
487
+ for (const el of declarationsProp.initializer.elements) {
488
+ if (ts.isIdentifier(el)) {
489
+ const correspondingClass = findClassDeclaration(el, typeChecker);
490
+ if (!correspondingClass ||
491
+ // Check whether the declaration is either standalone already or is being converted
492
+ // in this migration. We need to check if it's standalone already, in order to correct
493
+ // some cases where the main app and the test files are being migrated in separate
494
+ // programs.
495
+ isStandaloneDeclaration(correspondingClass, allDeclarations, templateTypeChecker)) {
496
+ declarationsToCopy.push(el);
497
+ }
498
+ else {
499
+ declarationsToPreserve.push(el);
500
+ }
494
501
  }
495
502
  else {
496
- declarationsToPreserve.push(el);
503
+ declarationsToCopy.push(el);
497
504
  }
498
505
  }
499
- else {
500
- declarationsToCopy.push(el);
501
- }
506
+ }
507
+ else {
508
+ // Otherwise create a spread that will be copied into the `imports`.
509
+ declarationsToCopy.push(ts.factory.createSpreadElement(declarationsProp.initializer));
502
510
  }
503
511
  }
504
512
  else {
505
- // Otherwise create a spread that will be copied into the `imports`.
506
- declarationsToCopy.push(ts.factory.createSpreadElement(declarationsProp.initializer));
513
+ // For shorthand properties, treat them as unanalyzable and use spread syntax
514
+ // shorthand properties were being ignored, now they're detected and treated as spreads
515
+ declarationsToCopy.push(ts.factory.createSpreadElement(declarationsProp.name));
507
516
  }
508
517
  }
509
518
  // If there are no `imports`, create them with the declarations we want to copy.
@@ -511,35 +520,38 @@ function moveDeclarationsToImports(literal, allDeclarations, typeChecker, templa
511
520
  properties.push(ts.factory.createPropertyAssignment('imports', ts.factory.createArrayLiteralExpression(ts.factory.createNodeArray(declarationsToCopy, hasAnyArrayTrailingComma && declarationsToCopy.length > 2))));
512
521
  }
513
522
  for (const prop of literal.properties) {
514
- if (!isNamedPropertyAssignment(prop)) {
523
+ if (!isNamedPropertyAssignment(prop) && !ts.isShorthandPropertyAssignment(prop)) {
515
524
  properties.push(prop);
516
525
  continue;
517
526
  }
518
527
  // If we have declarations to preserve, update the existing property, otherwise drop it.
519
528
  if (prop === declarationsProp) {
520
529
  if (declarationsToPreserve.length > 0) {
521
- const hasTrailingComma = ts.isArrayLiteralExpression(prop.initializer)
530
+ const hasTrailingComma = ts.isPropertyAssignment(prop) && ts.isArrayLiteralExpression(prop.initializer)
522
531
  ? prop.initializer.elements.hasTrailingComma
523
532
  : hasAnyArrayTrailingComma;
524
- properties.push(ts.factory.updatePropertyAssignment(prop, prop.name, ts.factory.createArrayLiteralExpression(ts.factory.createNodeArray(declarationsToPreserve, hasTrailingComma && declarationsToPreserve.length > 2))));
533
+ properties.push(ts.factory.createPropertyAssignment(prop.name, ts.factory.createArrayLiteralExpression(ts.factory.createNodeArray(declarationsToPreserve, hasTrailingComma && declarationsToPreserve.length > 2))));
525
534
  }
526
535
  continue;
527
536
  }
528
537
  // If we have an `imports` array and declarations
529
538
  // that should be copied, we merge the two arrays.
530
539
  if (prop === importsProp && declarationsToCopy.length > 0) {
531
- let initializer;
532
- if (ts.isArrayLiteralExpression(prop.initializer)) {
533
- initializer = ts.factory.updateArrayLiteralExpression(prop.initializer, ts.factory.createNodeArray([...prop.initializer.elements, ...declarationsToCopy], prop.initializer.elements.hasTrailingComma));
534
- }
535
- else {
536
- initializer = ts.factory.createArrayLiteralExpression(ts.factory.createNodeArray([ts.factory.createSpreadElement(prop.initializer), ...declarationsToCopy],
537
- // Expect the declarations to be greater than 1 since
538
- // we have the pre-existing initializer already.
539
- hasAnyArrayTrailingComma && declarationsToCopy.length > 1));
540
+ // Only regular property assignments have initializers that we can merge
541
+ if (ts.isPropertyAssignment(prop)) {
542
+ let initializer;
543
+ if (ts.isArrayLiteralExpression(prop.initializer)) {
544
+ initializer = ts.factory.updateArrayLiteralExpression(prop.initializer, ts.factory.createNodeArray([...prop.initializer.elements, ...declarationsToCopy], prop.initializer.elements.hasTrailingComma));
545
+ }
546
+ else {
547
+ initializer = ts.factory.createArrayLiteralExpression(ts.factory.createNodeArray([ts.factory.createSpreadElement(prop.initializer), ...declarationsToCopy],
548
+ // Expect the declarations to be greater than 1 since
549
+ // we have the pre-existing initializer already.
550
+ hasAnyArrayTrailingComma && declarationsToCopy.length > 1));
551
+ }
552
+ properties.push(ts.factory.updatePropertyAssignment(prop, prop.name, initializer));
553
+ continue;
540
554
  }
541
- properties.push(ts.factory.updatePropertyAssignment(prop, prop.name, initializer));
542
- continue;
543
555
  }
544
556
  // Retain any remaining properties.
545
557
  properties.push(prop);
@@ -649,8 +661,14 @@ function findImportLocation(target, inContext, importMode, typeChecker) {
649
661
  * but not `declarations: []`.
650
662
  */
651
663
  function hasNgModuleMetadataElements(node) {
652
- return (ts.isPropertyAssignment(node) &&
653
- (!ts.isArrayLiteralExpression(node.initializer) || node.initializer.elements.length > 0));
664
+ if (ts.isPropertyAssignment(node)) {
665
+ return !ts.isArrayLiteralExpression(node.initializer) || node.initializer.elements.length > 0;
666
+ }
667
+ if (ts.isShorthandPropertyAssignment(node)) {
668
+ // For shorthand properties, we assume they have elements since they reference a variable
669
+ return true;
670
+ }
671
+ return false;
654
672
  }
655
673
  /** Finds all modules whose declarations can be migrated. */
656
674
  function findNgModuleClassesToMigrate(sourceFile, typeChecker) {
@@ -827,6 +845,7 @@ function analyzeTestingModules(testObjects, typeChecker) {
827
845
  const importsProp = findLiteralProperty(obj, 'imports');
828
846
  const importElements = importsProp &&
829
847
  hasNgModuleMetadataElements(importsProp) &&
848
+ ts.isPropertyAssignment(importsProp) &&
830
849
  ts.isArrayLiteralExpression(importsProp.initializer)
831
850
  ? importsProp.initializer.elements.filter((el) => {
832
851
  // Filter out calls since they may be a `ModuleWithProviders`.
@@ -871,6 +890,7 @@ function extractDeclarationsFromTestObject(obj, typeChecker) {
871
890
  const declarations = findLiteralProperty(obj, 'declarations');
872
891
  if (declarations &&
873
892
  hasNgModuleMetadataElements(declarations) &&
893
+ ts.isPropertyAssignment(declarations) &&
874
894
  ts.isArrayLiteralExpression(declarations.initializer)) {
875
895
  for (const element of declarations.initializer.elements) {
876
896
  const declaration = findClassDeclaration(element, typeChecker);
@@ -951,7 +971,7 @@ function pruneNgModules(program, host, basePath, rootFileNames, sourceFiles, pri
951
971
  }
952
972
  node.forEachChild(walk);
953
973
  });
954
- replaceInComponentImportsArray(componentImportArrays, classesToRemove, tracker, typeChecker, templateTypeChecker, declarationImportRemapper);
974
+ replaceInComponentImportsArray(componentImportArrays, classesToRemove, removalLocations, tracker, typeChecker, templateTypeChecker, declarationImportRemapper);
955
975
  replaceInTestImportsArray(testArrays, removalLocations, classesToRemove, tracker, typeChecker, templateTypeChecker, declarationImportRemapper);
956
976
  // We collect all the places where we need to remove references first before generating the
957
977
  // removal instructions since we may have to remove multiple references from one node.
@@ -1057,12 +1077,13 @@ function collectChangeLocations(ngModule, removalLocations, componentImportArray
1057
1077
  * Replaces all the leftover modules in component `imports` arrays with their exports.
1058
1078
  * @param componentImportArrays All the imports arrays and their nodes that represent NgModules.
1059
1079
  * @param classesToRemove Set of classes that were marked for removal.
1080
+ * @param removalLocations Tracks the different places from which imports should be removed.
1060
1081
  * @param tracker
1061
1082
  * @param typeChecker
1062
1083
  * @param templateTypeChecker
1063
1084
  * @param importRemapper
1064
1085
  */
1065
- function replaceInComponentImportsArray(componentImportArrays, classesToRemove, tracker, typeChecker, templateTypeChecker, importRemapper) {
1086
+ function replaceInComponentImportsArray(componentImportArrays, classesToRemove, removalLocations, tracker, typeChecker, templateTypeChecker, importRemapper) {
1066
1087
  for (const [array, toReplace] of componentImportArrays.getEntries()) {
1067
1088
  const closestClass = nodes.closestNode(array, ts.isClassDeclaration);
1068
1089
  if (!closestClass) {
@@ -1070,16 +1091,35 @@ function replaceInComponentImportsArray(componentImportArrays, classesToRemove,
1070
1091
  }
1071
1092
  const replacements = new UniqueItemTracker();
1072
1093
  const usedImports = new Set(findTemplateDependencies(closestClass, templateTypeChecker).map((ref) => ref.node));
1094
+ const nodesToRemove = new Set();
1073
1095
  for (const node of toReplace) {
1074
1096
  const moduleDecl = findClassDeclaration(node, typeChecker);
1075
1097
  if (moduleDecl) {
1076
1098
  const moduleMeta = templateTypeChecker.getNgModuleMetadata(moduleDecl);
1077
1099
  if (moduleMeta) {
1100
+ let hasUsedExports = false;
1078
1101
  moduleMeta.exports.forEach((exp) => {
1079
1102
  if (usedImports.has(exp.node)) {
1080
1103
  replacements.track(node, exp);
1104
+ hasUsedExports = true;
1081
1105
  }
1082
1106
  });
1107
+ // If none of the module's exports are used, track the node for removal
1108
+ if (!hasUsedExports) {
1109
+ nodesToRemove.add(node);
1110
+ }
1111
+ else if (ts.isIdentifier(node)) {
1112
+ // Track the import statement for removal when replacing with exports
1113
+ const symbol = typeChecker.getSymbolAtLocation(node);
1114
+ const declarations = symbol?.declarations;
1115
+ if (declarations) {
1116
+ for (const declaration of declarations) {
1117
+ if (ts.isImportSpecifier(declaration)) {
1118
+ removalLocations.imports.track(declaration.parent, declaration);
1119
+ }
1120
+ }
1121
+ }
1122
+ }
1083
1123
  }
1084
1124
  else {
1085
1125
  // It's unlikely not to have module metadata at this point, but just in
@@ -1088,12 +1128,13 @@ function replaceInComponentImportsArray(componentImportArrays, classesToRemove,
1088
1128
  }
1089
1129
  }
1090
1130
  }
1091
- replaceModulesInImportsArray(array, replacements, tracker, templateTypeChecker, importRemapper);
1131
+ replaceModulesInImportsArray(array, replacements, nodesToRemove, tracker, templateTypeChecker, importRemapper);
1092
1132
  }
1093
1133
  }
1094
1134
  /**
1095
1135
  * Replaces all the leftover modules in testing `imports` arrays with their exports.
1096
1136
  * @param testImportArrays All test `imports` arrays and their nodes that represent modules.
1137
+ * @param removalLocations Tracks the different places from which imports should be removed.
1097
1138
  * @param classesToRemove Classes marked for removal by the migration.
1098
1139
  * @param tracker
1099
1140
  * @param typeChecker
@@ -1103,6 +1144,7 @@ function replaceInComponentImportsArray(componentImportArrays, classesToRemove,
1103
1144
  function replaceInTestImportsArray(testImportArrays, removalLocations, classesToRemove, tracker, typeChecker, templateTypeChecker, importRemapper) {
1104
1145
  for (const [array, toReplace] of testImportArrays.getEntries()) {
1105
1146
  const replacements = new UniqueItemTracker();
1147
+ const nodesToRemove = new Set();
1106
1148
  for (const node of toReplace) {
1107
1149
  const moduleDecl = findClassDeclaration(node, typeChecker);
1108
1150
  if (moduleDecl) {
@@ -1113,6 +1155,18 @@ function replaceInTestImportsArray(testImportArrays, removalLocations, classesTo
1113
1155
  const exports = moduleMeta.exports.filter((exp) => !classesToRemove.has(exp.node));
1114
1156
  if (exports.length > 0) {
1115
1157
  exports.forEach((exp) => replacements.track(node, exp));
1158
+ // Track the import statement for removal when replacing with exports
1159
+ if (ts.isIdentifier(node)) {
1160
+ const symbol = typeChecker.getSymbolAtLocation(node);
1161
+ const declarations = symbol?.declarations;
1162
+ if (declarations) {
1163
+ for (const declaration of declarations) {
1164
+ if (ts.isImportSpecifier(declaration)) {
1165
+ removalLocations.imports.track(declaration.parent, declaration);
1166
+ }
1167
+ }
1168
+ }
1169
+ }
1116
1170
  }
1117
1171
  else {
1118
1172
  removalLocations.arrays.track(array, node);
@@ -1125,19 +1179,21 @@ function replaceInTestImportsArray(testImportArrays, removalLocations, classesTo
1125
1179
  }
1126
1180
  }
1127
1181
  }
1128
- replaceModulesInImportsArray(array, replacements, tracker, templateTypeChecker, importRemapper);
1182
+ replaceModulesInImportsArray(array, replacements, nodesToRemove, tracker, templateTypeChecker, importRemapper);
1129
1183
  }
1130
1184
  }
1131
1185
  /**
1132
1186
  * Replaces any leftover modules in an `imports` arrays with a set of specified exports
1133
1187
  * @param array Imports array which is being migrated.
1134
1188
  * @param replacements Map of NgModule references to their exports.
1189
+ * @param nodesToRemove Set of nodes that should be removed without replacement (unused modules).
1135
1190
  * @param tracker
1191
+ * @param typeChecker
1136
1192
  * @param templateTypeChecker
1137
1193
  * @param importRemapper
1138
1194
  */
1139
- function replaceModulesInImportsArray(array, replacements, tracker, templateTypeChecker, importRemapper) {
1140
- if (replacements.isEmpty()) {
1195
+ function replaceModulesInImportsArray(array, replacements, nodesToRemove, tracker, templateTypeChecker, importRemapper) {
1196
+ if (replacements.isEmpty() && nodesToRemove.size === 0) {
1141
1197
  return;
1142
1198
  }
1143
1199
  const newElements = [];
@@ -1148,6 +1204,10 @@ function replaceModulesInImportsArray(array, replacements, tracker, templateType
1148
1204
  }
1149
1205
  }
1150
1206
  for (const element of array.elements) {
1207
+ // Check if this element should be removed entirely (unused module)
1208
+ if (nodesToRemove.has(element)) {
1209
+ continue;
1210
+ }
1151
1211
  const replacementRefs = replacements.get(element);
1152
1212
  if (!replacementRefs) {
1153
1213
  newElements.push(element);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.5
3
+ * @license Angular v21.0.0-next.7
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -3,8 +3,7 @@
3
3
  "control-flow-migration": {
4
4
  "version": "21.0.0",
5
5
  "description": "Converts the entire application to block control flow syntax",
6
- "factory": "./bundles/control-flow-migration.cjs#migrate",
7
- "optional": true
6
+ "factory": "./bundles/control-flow-migration.cjs#migrate"
8
7
  },
9
8
  "router-current-navigation": {
10
9
  "version": "21.0.0",
@@ -1,10 +1,10 @@
1
1
  /**
2
- * @license Angular v21.0.0-next.5
3
- * (c) 2010-2025 Google LLC. https://angular.io/
2
+ * @license Angular v21.0.0-next.7
3
+ * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { OutputRef, OutputRefSubscription, DestroyRef, Signal, WritableSignal, ValueEqualityFn, Injector } from './chrome_dev_tools_performance.d.js';
7
+ import { OutputRef, OutputRefSubscription, DestroyRef, Signal, WritableSignal, ValueEqualityFn, Injector } from './_chrome_dev_tools_performance-chunk.js';
8
8
 
9
9
  /**
10
10
  * An `OutputEmitterRef` is created by the `output()` function and can be
@@ -1,11 +1,11 @@
1
1
  /**
2
- * @license Angular v21.0.0-next.5
3
- * (c) 2010-2025 Google LLC. https://angular.io/
2
+ * @license Angular v21.0.0-next.7
3
+ * (c) 2010-2025 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { SIGNAL } from './graph.d.js';
8
- import { EventContract } from './event_dispatcher.d.js';
7
+ import { SIGNAL } from './_formatter-chunk.js';
8
+ import { EventContract } from './_event_dispatcher-chunk.js';
9
9
 
10
10
  /**
11
11
  * A reactive value which notifies consumers of any changes.