@angular/core 21.0.0-next.1 → 21.0.0-next.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (107) hide show
  1. package/fesm2022/_attribute-chunk.mjs +12 -0
  2. package/fesm2022/_attribute-chunk.mjs.map +1 -0
  3. package/fesm2022/_debug_node-chunk.mjs +18469 -0
  4. package/fesm2022/_debug_node-chunk.mjs.map +1 -0
  5. package/fesm2022/_effect-chunk.mjs +423 -0
  6. package/fesm2022/_effect-chunk.mjs.map +1 -0
  7. package/fesm2022/_effect-chunk2.mjs +2951 -0
  8. package/fesm2022/_effect-chunk2.mjs.map +1 -0
  9. package/fesm2022/_not_found-chunk.mjs +39 -0
  10. package/fesm2022/_not_found-chunk.mjs.map +1 -0
  11. package/fesm2022/_resource-chunk.mjs +378 -0
  12. package/fesm2022/_resource-chunk.mjs.map +1 -0
  13. package/fesm2022/_untracked-chunk.mjs +96 -0
  14. package/fesm2022/_untracked-chunk.mjs.map +1 -0
  15. package/fesm2022/_weak_ref-chunk.mjs +10 -0
  16. package/fesm2022/_weak_ref-chunk.mjs.map +1 -0
  17. package/fesm2022/core.mjs +2499 -4185
  18. package/fesm2022/core.mjs.map +1 -1
  19. package/fesm2022/primitives-di.mjs +23 -0
  20. package/fesm2022/primitives-di.mjs.map +1 -0
  21. package/fesm2022/primitives-event-dispatch.mjs +788 -0
  22. package/fesm2022/primitives-event-dispatch.mjs.map +1 -0
  23. package/fesm2022/primitives-signals.mjs +187 -0
  24. package/fesm2022/primitives-signals.mjs.map +1 -0
  25. package/fesm2022/rxjs-interop.mjs +210 -308
  26. package/fesm2022/rxjs-interop.mjs.map +1 -1
  27. package/fesm2022/testing.mjs +2309 -3170
  28. package/fesm2022/testing.mjs.map +1 -1
  29. package/package.json +18 -12
  30. package/resources/best-practices.md +56 -0
  31. package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +117 -0
  32. package/schematics/bundles/application-config-core.cjs +84 -0
  33. package/schematics/bundles/{apply_import_manager-yycO3l8f.cjs → apply_import_manager-1Zs_gpB6.cjs} +4 -5
  34. package/schematics/bundles/bootstrap-options-migration.cjs +598 -0
  35. package/schematics/bundles/cleanup-unused-imports.cjs +9 -13
  36. package/schematics/bundles/common-to-standalone-migration.cjs +381 -0
  37. package/schematics/bundles/{compiler_host-DrXTGf_7.cjs → compiler_host-DBwYMlTo.cjs} +10 -11
  38. package/schematics/bundles/control-flow-migration.cjs +113 -82
  39. package/schematics/bundles/{imports-26VeX8i-.cjs → imports-DP72APSx.cjs} +5 -1
  40. package/schematics/bundles/{index-BdH2rlWJ.cjs → index-B7I9sIUx.cjs} +36 -39
  41. package/schematics/bundles/inject-migration.cjs +148 -70
  42. package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
  43. package/schematics/bundles/{migrate_ts_type_references-BVSg43hf.cjs → migrate_ts_type_references-UGIUl7En.cjs} +500 -24
  44. package/schematics/bundles/{ng_component_template-DjLc4mdL.cjs → ng_component_template-Dsuq1Lw7.cjs} +4 -5
  45. package/schematics/bundles/{ng_decorators-CtYwz9Lw.cjs → ng_decorators-DSFlWYQY.cjs} +2 -2
  46. package/schematics/bundles/ngclass-to-class-migration.cjs +118 -109
  47. package/schematics/bundles/ngstyle-to-style-migration.cjs +487 -0
  48. package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
  49. package/schematics/bundles/output-migration.cjs +16 -19
  50. package/schematics/bundles/parse_html-8VLCL37B.cjs +132 -0
  51. package/schematics/bundles/{project_paths-T_M15e2g.cjs → project_paths-DvD50ouC.cjs} +14 -247
  52. package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +90 -0
  53. package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
  54. package/schematics/bundles/route-lazy-loading.cjs +54 -26
  55. package/schematics/bundles/router-current-navigation.cjs +7 -18
  56. package/schematics/bundles/router-last-successful-navigation.cjs +7 -18
  57. package/schematics/bundles/router-testing-module-migration.cjs +502 -0
  58. package/schematics/bundles/self-closing-tags-migration.cjs +14 -17
  59. package/schematics/bundles/signal-input-migration.cjs +93 -29
  60. package/schematics/bundles/signal-queries-migration.cjs +22 -25
  61. package/schematics/bundles/signals.cjs +10 -13
  62. package/schematics/bundles/standalone-migration.cjs +135 -102
  63. package/schematics/bundles/{symbol-VPWguRxr.cjs → symbol-BObKoqes.cjs} +3 -2
  64. package/schematics/collection.json +17 -0
  65. package/schematics/migrations/common-to-standalone-migration/schema.json +14 -0
  66. package/schematics/migrations/ngclass-to-class-migration/schema.json +2 -2
  67. package/schematics/migrations/ngstyle-to-style-migration/schema.json +20 -0
  68. package/schematics/migrations/router-testing-module-migration/schema.json +14 -0
  69. package/schematics/migrations.json +16 -2
  70. package/{api.d.d.ts → types/_api-chunk.d.ts} +9 -6
  71. package/{chrome_dev_tools_performance.d.d.ts → types/_chrome_dev_tools_performance-chunk.d.ts} +25 -15
  72. package/{discovery.d.d.ts → types/_discovery-chunk.d.ts} +130 -75
  73. package/{effect.d.d.ts → types/_effect-chunk.d.ts} +3 -4
  74. package/{event_dispatcher.d.d.ts → types/_event_dispatcher-chunk.d.ts} +2 -2
  75. package/{graph.d.d.ts → types/_formatter-chunk.d.ts} +40 -7
  76. package/{weak_ref.d.d.ts → types/_weak_ref-chunk.d.ts} +2 -2
  77. package/{index.d.ts → types/core.d.ts} +233 -298
  78. package/{primitives/di/index.d.ts → types/primitives-di.d.ts} +2 -2
  79. package/{primitives/event-dispatch/index.d.ts → types/primitives-event-dispatch.d.ts} +4 -4
  80. package/{primitives/signals/index.d.ts → types/primitives-signals.d.ts} +7 -8
  81. package/{rxjs-interop/index.d.ts → types/rxjs-interop.d.ts} +8 -6
  82. package/{testing/index.d.ts → types/testing.d.ts} +7 -7
  83. package/fesm2022/attribute.mjs +0 -24
  84. package/fesm2022/attribute.mjs.map +0 -1
  85. package/fesm2022/debug_node.mjs +0 -31829
  86. package/fesm2022/debug_node.mjs.map +0 -1
  87. package/fesm2022/effect.mjs +0 -142
  88. package/fesm2022/effect.mjs.map +0 -1
  89. package/fesm2022/not_found.mjs +0 -56
  90. package/fesm2022/not_found.mjs.map +0 -1
  91. package/fesm2022/primitives/di.mjs +0 -23
  92. package/fesm2022/primitives/di.mjs.map +0 -1
  93. package/fesm2022/primitives/event-dispatch.mjs +0 -1622
  94. package/fesm2022/primitives/event-dispatch.mjs.map +0 -1
  95. package/fesm2022/primitives/signals.mjs +0 -89
  96. package/fesm2022/primitives/signals.mjs.map +0 -1
  97. package/fesm2022/resource.mjs +0 -624
  98. package/fesm2022/resource.mjs.map +0 -1
  99. package/fesm2022/root_effect_scheduler.mjs +0 -4001
  100. package/fesm2022/root_effect_scheduler.mjs.map +0 -1
  101. package/fesm2022/signal.mjs +0 -560
  102. package/fesm2022/signal.mjs.map +0 -1
  103. package/fesm2022/weak_ref.mjs +0 -12
  104. package/fesm2022/weak_ref.mjs.map +0 -1
  105. package/schematics/bundles/index-jjHOgYYs.cjs +0 -22074
  106. package/schematics/bundles/parse_html-CXR8hziE.cjs +0 -41
  107. package/schematics/bundles/project_tsconfig_paths-D7xzGqRi.cjs +0 -51085
@@ -1,21 +1,19 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.1
3
+ * @license Angular v21.0.0-next.10
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 p = require('path');
11
- var compiler_host = require('./compiler_host-DrXTGf_7.cjs');
12
- var project_tsconfig_paths = require('./project_tsconfig_paths-D7xzGqRi.cjs');
10
+ var path = require('path');
11
+ var compiler_host = require('./compiler_host-DBwYMlTo.cjs');
12
+ var compiler = require('@angular/compiler');
13
13
  var ts = require('typescript');
14
- var parse_html = require('./parse_html-CXR8hziE.cjs');
15
- require('os');
16
- require('fs');
17
- require('module');
18
- require('url');
14
+ var parse_html = require('./parse_html-8VLCL37B.cjs');
15
+ var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.cjs');
16
+ require('@angular/compiler-cli/private/migrations');
19
17
  require('@angular-devkit/core');
20
18
 
21
19
  function lookupIdentifiersInSourceFile(sourceFile, names) {
@@ -275,7 +273,7 @@ class AnalyzedFile {
275
273
  }
276
274
  }
277
275
  /** Finds all non-control flow elements from common module. */
278
- class CommonCollector extends project_tsconfig_paths.RecursiveVisitor$1 {
276
+ class CommonCollector extends compiler.RecursiveVisitor {
279
277
  count = 0;
280
278
  visitElement(el) {
281
279
  if (el.attrs.length > 0) {
@@ -314,7 +312,7 @@ class CommonCollector extends project_tsconfig_paths.RecursiveVisitor$1 {
314
312
  }
315
313
  }
316
314
  /** Finds all elements that represent i18n blocks. */
317
- class i18nCollector extends project_tsconfig_paths.RecursiveVisitor$1 {
315
+ class i18nCollector extends compiler.RecursiveVisitor {
318
316
  elements = [];
319
317
  visitElement(el) {
320
318
  if (el.attrs.find((a) => a.name === 'i18n') !== undefined) {
@@ -324,7 +322,7 @@ class i18nCollector extends project_tsconfig_paths.RecursiveVisitor$1 {
324
322
  }
325
323
  }
326
324
  /** Finds all elements with ngif structural directives. */
327
- class ElementCollector extends project_tsconfig_paths.RecursiveVisitor$1 {
325
+ class ElementCollector extends compiler.RecursiveVisitor {
328
326
  _attributes;
329
327
  elements = [];
330
328
  constructor(_attributes = []) {
@@ -377,7 +375,7 @@ class ElementCollector extends project_tsconfig_paths.RecursiveVisitor$1 {
377
375
  }
378
376
  }
379
377
  /** Finds all elements with ngif structural directives. */
380
- class TemplateCollector extends project_tsconfig_paths.RecursiveVisitor$1 {
378
+ class TemplateCollector extends compiler.RecursiveVisitor {
381
379
  elements = [];
382
380
  templates = new Map();
383
381
  visitElement(el) {
@@ -410,6 +408,7 @@ const endMarkerRegex = new RegExp(endMarker, 'gm');
410
408
  const startI18nMarkerRegex = new RegExp(startI18nMarker, 'gm');
411
409
  const endI18nMarkerRegex = new RegExp(endI18nMarker, 'gm');
412
410
  const replaceMarkerRegex = new RegExp(`${startMarker}|${endMarker}`, 'gm');
411
+ const PRIORITY_WEIGHT_TEMPLATE_REFERENCE_BY_OUTLET = 2;
413
412
  /**
414
413
  * Analyzes a source file to find file that need to be migrated and the text ranges within them.
415
414
  * @param sourceFile File to be analyzed.
@@ -549,8 +548,8 @@ function analyzeDecorators(node, sourceFile, analyzedFiles) {
549
548
  case 'templateUrl':
550
549
  // Leave the end as undefined which means that the range is until the end of the file.
551
550
  if (ts.isStringLiteralLike(prop.initializer)) {
552
- const path = p.join(p.dirname(sourceFile.fileName), prop.initializer.text);
553
- AnalyzedFile.addRange(path, sourceFile, analyzedFiles, {
551
+ const path$1 = path.join(path.dirname(sourceFile.fileName), prop.initializer.text);
552
+ AnalyzedFile.addRange(path$1, sourceFile, analyzedFiles, {
554
553
  start: 0,
555
554
  node: prop,
556
555
  type: 'templateUrl',
@@ -600,7 +599,7 @@ function validateMigratedTemplate(migrated, fileName) {
600
599
  }
601
600
  function validateI18nStructure(parsed, fileName) {
602
601
  const visitor = new i18nCollector();
603
- project_tsconfig_paths.visitAll$1(visitor, parsed.rootNodes);
602
+ compiler.visitAll(visitor, parsed.rootNodes);
604
603
  const parents = visitor.elements.filter((el) => el.children.length > 0);
605
604
  for (const p of parents) {
606
605
  for (const el of visitor.elements) {
@@ -680,7 +679,7 @@ function getTemplates(template) {
680
679
  const parsed = parse_html.parseTemplate(template);
681
680
  if (parsed.tree !== undefined) {
682
681
  const visitor = new TemplateCollector();
683
- project_tsconfig_paths.visitAll$1(visitor, parsed.tree.rootNodes);
682
+ compiler.visitAll(visitor, parsed.tree.rootNodes);
684
683
  for (let [key, tmpl] of visitor.templates) {
685
684
  tmpl.count = countTemplateUsage(parsed.tree.rootNodes, key);
686
685
  tmpl.generateContents(template);
@@ -689,34 +688,6 @@ function getTemplates(template) {
689
688
  }
690
689
  return new Map();
691
690
  }
692
- function countTemplateUsage(nodes, templateName) {
693
- let count = 0;
694
- let isReferencedInTemplateOutlet = false;
695
- for (const node of nodes) {
696
- if (node.attrs) {
697
- for (const attr of node.attrs) {
698
- if (attr.name === '*ngTemplateOutlet' && attr.value === templateName.slice(1)) {
699
- isReferencedInTemplateOutlet = true;
700
- break;
701
- }
702
- if (attr.name.trim() === templateName) {
703
- count++;
704
- }
705
- }
706
- }
707
- if (node.children) {
708
- if (node.name === 'for') {
709
- for (const child of node.children) {
710
- if (child.value?.includes(templateName.slice(1))) {
711
- count++;
712
- }
713
- }
714
- }
715
- count += countTemplateUsage(node.children, templateName);
716
- }
717
- }
718
- return isReferencedInTemplateOutlet ? count + 2 : count;
719
- }
720
691
  function updateTemplates(template, templates) {
721
692
  const updatedTemplates = getTemplates(template);
722
693
  for (let [key, tmpl] of updatedTemplates) {
@@ -740,9 +711,10 @@ function processNgTemplates(template, sourceFile) {
740
711
  try {
741
712
  const templates = getTemplates(template);
742
713
  // swap placeholders and remove
743
- for (const [name, t] of templates) {
744
- const replaceRegex = new RegExp(getPlaceholder(name.slice(1)), 'g');
745
- const forRegex = new RegExp(getPlaceholder(name.slice(1), PlaceholderKind.Alternate), 'g');
714
+ for (const [nameWithHash, t] of templates) {
715
+ const name = nameWithHash.slice(1);
716
+ const replaceRegex = new RegExp(getPlaceholder(name), 'g');
717
+ const forRegex = new RegExp(getPlaceholder(nameWithHash.slice(1), PlaceholderKind.Alternate), 'g');
746
718
  const forMatches = [...template.matchAll(forRegex)];
747
719
  const matches = [...forMatches, ...template.matchAll(replaceRegex)];
748
720
  let safeToRemove = true;
@@ -767,7 +739,12 @@ function processNgTemplates(template, sourceFile) {
767
739
  template = template.replace(replaceRegex, t.children);
768
740
  }
769
741
  const dist = matches.filter((obj, index, self) => index === self.findIndex((t) => t.input === obj.input));
770
- if ((t.count === dist.length || t.count - matches.length === 1) && safeToRemove) {
742
+ // Check if template is used by ngTemplateOutlet in addition to control flow
743
+ const hasTemplateOutletUsage = checkForTemplateOutletUsage(template, nameWithHash.slice(1));
744
+ // Only remove template if it's safe to do so AND not used by ngTemplateOutlet
745
+ if ((t.count === dist.length || t.count - matches.length === 1) &&
746
+ safeToRemove &&
747
+ !hasTemplateOutletUsage) {
771
748
  const refsInComponentFile = getViewChildOrViewChildrenNames(sourceFile);
772
749
  if (refsInComponentFile?.length > 0) {
773
750
  const templateRefs = getTemplateReferences(template);
@@ -797,6 +774,59 @@ function processNgTemplates(template, sourceFile) {
797
774
  return { migrated: template, err: err };
798
775
  }
799
776
  }
777
+ function analyzeTemplateUsage(nodes, templateName) {
778
+ let count = 0;
779
+ let isReferencedInTemplateOutlet = false;
780
+ const templateNameWithHash = `#${templateName}`;
781
+ function traverseNodes(nodeList) {
782
+ for (const node of nodeList) {
783
+ if (node.attrs) {
784
+ for (const attr of node.attrs) {
785
+ if ((attr.name === '*ngTemplateOutlet' || attr.name === '[ngTemplateOutlet]') &&
786
+ attr.value?.split(';')[0] === templateName) {
787
+ isReferencedInTemplateOutlet = true;
788
+ }
789
+ if (attr.name.trim() === templateNameWithHash) {
790
+ count++;
791
+ }
792
+ }
793
+ }
794
+ if (node.children) {
795
+ if (node.name === 'for') {
796
+ for (const child of node.children) {
797
+ if (child.value?.includes(templateName)) {
798
+ count++;
799
+ }
800
+ }
801
+ }
802
+ traverseNodes(node.children);
803
+ }
804
+ }
805
+ }
806
+ traverseNodes(nodes);
807
+ return {
808
+ isReferencedInTemplateOutlet,
809
+ totalCount: isReferencedInTemplateOutlet
810
+ ? count + PRIORITY_WEIGHT_TEMPLATE_REFERENCE_BY_OUTLET
811
+ : count,
812
+ };
813
+ }
814
+ /**
815
+ * Checks if a template is used by ngTemplateOutlet directive
816
+ */
817
+ function checkForTemplateOutletUsage(template, templateName) {
818
+ const parsed = parse_html.parseTemplate(template);
819
+ if (parsed.tree === undefined) {
820
+ return false;
821
+ }
822
+ const result = analyzeTemplateUsage(parsed.tree.rootNodes, templateName);
823
+ return result.isReferencedInTemplateOutlet;
824
+ }
825
+ function countTemplateUsage(nodes, templateNameWithHash) {
826
+ const templateName = templateNameWithHash.slice(1);
827
+ const result = analyzeTemplateUsage(nodes, templateName);
828
+ return result.totalCount;
829
+ }
800
830
  function getViewChildOrViewChildrenNames(sourceFile) {
801
831
  const names = [];
802
832
  function visit(node) {
@@ -821,11 +851,11 @@ function getTemplateReferences(template) {
821
851
  if (parsed.tree === undefined) {
822
852
  return [];
823
853
  }
824
- const references = [];
854
+ const templateNameRefWithoutHash = [];
825
855
  function visitNodes(nodes) {
826
856
  for (const node of nodes) {
827
857
  if (node?.name === 'ng-template') {
828
- references.push(...node.attrs?.map((ref) => ref?.name?.slice(1)));
858
+ templateNameRefWithoutHash.push(...node.attrs?.map((ref) => ref?.name?.slice(1)));
829
859
  }
830
860
  if (node.children) {
831
861
  visitNodes(node.children);
@@ -833,7 +863,7 @@ function getTemplateReferences(template) {
833
863
  }
834
864
  }
835
865
  visitNodes(parsed.tree.rootNodes);
836
- return references;
866
+ return templateNameRefWithoutHash;
837
867
  }
838
868
  function replaceRemainingPlaceholders(template) {
839
869
  const pattern = '.*';
@@ -856,7 +886,7 @@ function canRemoveCommonModule(template) {
856
886
  let removeCommonModule = false;
857
887
  if (parsed.tree !== undefined) {
858
888
  const visitor = new CommonCollector();
859
- project_tsconfig_paths.visitAll$1(visitor, parsed.tree.rootNodes);
889
+ compiler.visitAll(visitor, parsed.tree.rootNodes);
860
890
  removeCommonModule = visitor.count === 0;
861
891
  }
862
892
  return removeCommonModule;
@@ -979,7 +1009,7 @@ function generateI18nMarkers(tmpl) {
979
1009
  let parsed = parse_html.parseTemplate(tmpl);
980
1010
  if (parsed.tree !== undefined) {
981
1011
  const visitor = new i18nCollector();
982
- project_tsconfig_paths.visitAll$1(visitor, parsed.tree.rootNodes);
1012
+ compiler.visitAll(visitor, parsed.tree.rootNodes);
983
1013
  for (const [ix, el] of visitor.elements.entries()) {
984
1014
  // we only care about elements with children and i18n tags
985
1015
  // elements without children have nothing to translate
@@ -1181,7 +1211,7 @@ function migrateCase(template) {
1181
1211
  }
1182
1212
  let result = template;
1183
1213
  const visitor = new ElementCollector(cases);
1184
- project_tsconfig_paths.visitAll$1(visitor, parsed.tree.rootNodes);
1214
+ compiler.visitAll(visitor, parsed.tree.rootNodes);
1185
1215
  calculateNesting(visitor, hasLineBreaks(template));
1186
1216
  // this tracks the character shift from different lengths of blocks from
1187
1217
  // the prior directives so as to adjust for nested block replacement during
@@ -1278,7 +1308,7 @@ function migrateFor(template) {
1278
1308
  }
1279
1309
  let result = template;
1280
1310
  const visitor = new ElementCollector(fors);
1281
- project_tsconfig_paths.visitAll$1(visitor, parsed.tree.rootNodes);
1311
+ compiler.visitAll(visitor, parsed.tree.rootNodes);
1282
1312
  calculateNesting(visitor, hasLineBreaks(template));
1283
1313
  // this tracks the character shift from different lengths of blocks from
1284
1314
  // the prior directives so as to adjust for nested block replacement during
@@ -1483,7 +1513,7 @@ function migrateIf(template) {
1483
1513
  }
1484
1514
  let result = template;
1485
1515
  const visitor = new ElementCollector(ifs);
1486
- project_tsconfig_paths.visitAll$1(visitor, parsed.tree.rootNodes);
1516
+ compiler.visitAll(visitor, parsed.tree.rootNodes);
1487
1517
  calculateNesting(visitor, hasLineBreaks(template));
1488
1518
  // this tracks the character shift from different lengths of blocks from
1489
1519
  // the prior directives so as to adjust for nested block replacement during
@@ -1676,7 +1706,7 @@ function migrateSwitch(template) {
1676
1706
  }
1677
1707
  let result = template;
1678
1708
  const visitor = new ElementCollector(switches);
1679
- project_tsconfig_paths.visitAll$1(visitor, parsed.tree.rootNodes);
1709
+ compiler.visitAll(visitor, parsed.tree.rootNodes);
1680
1710
  calculateNesting(visitor, hasLineBreaks(template));
1681
1711
  // this tracks the character shift from different lengths of blocks from
1682
1712
  // the prior directives so as to adjust for nested block replacement during
@@ -1707,11 +1737,11 @@ function migrateSwitch(template) {
1707
1737
  }
1708
1738
  function assertValidSwitchStructure(children) {
1709
1739
  for (const child of children) {
1710
- if (child instanceof project_tsconfig_paths.Text && child.value.trim() !== '') {
1740
+ if (child instanceof compiler.Text && child.value.trim() !== '') {
1711
1741
  throw new Error(`Text node: "${child.value}" would result in invalid migrated @switch block structure. ` +
1712
1742
  `@switch can only have @case or @default as children.`);
1713
1743
  }
1714
- else if (child instanceof project_tsconfig_paths.Element) {
1744
+ else if (child instanceof compiler.Element) {
1715
1745
  let hasCase = false;
1716
1746
  for (const attr of child.attrs) {
1717
1747
  if (cases.includes(attr.name)) {
@@ -1815,7 +1845,10 @@ function migrate(options) {
1815
1845
  const basePath = process.cwd();
1816
1846
  let pathToMigrate;
1817
1847
  if (options.path) {
1818
- pathToMigrate = compiler_host.normalizePath(p.join(basePath, options.path));
1848
+ if (options.path.startsWith('..')) {
1849
+ throw new schematics.SchematicsException('Cannot run control flow migration outside of the current project.');
1850
+ }
1851
+ pathToMigrate = compiler_host.normalizePath(path.join(basePath, options.path));
1819
1852
  if (pathToMigrate.trim() !== '') {
1820
1853
  allPaths.push(pathToMigrate);
1821
1854
  }
@@ -1825,33 +1858,31 @@ function migrate(options) {
1825
1858
  allPaths = [...buildPaths, ...testPaths];
1826
1859
  }
1827
1860
  if (!allPaths.length) {
1828
- throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run the http providers migration.');
1861
+ context.logger.warn('Could not find any tsconfig file. Cannot run the control flow migration.');
1862
+ return;
1829
1863
  }
1830
1864
  let errors = [];
1865
+ let sourceFilesCount = 0;
1831
1866
  for (const tsconfigPath of allPaths) {
1832
- const migrateErrors = runControlFlowMigration(tree, tsconfigPath, basePath, pathToMigrate, options);
1867
+ const program = compiler_host.createMigrationProgram(tree, tsconfigPath, basePath);
1868
+ const sourceFiles = program
1869
+ .getSourceFiles()
1870
+ .filter((sourceFile) => (pathToMigrate ? sourceFile.fileName.startsWith(pathToMigrate) : true) &&
1871
+ compiler_host.canMigrateFile(basePath, sourceFile, program));
1872
+ const migrateErrors = runControlFlowMigration(tree, sourceFiles, basePath, options);
1833
1873
  errors = [...errors, ...migrateErrors];
1874
+ sourceFilesCount += sourceFiles.length;
1834
1875
  }
1835
1876
  if (errors.length > 0) {
1836
1877
  context.logger.warn(`WARNING: ${errors.length} errors occurred during your migration:\n`);
1837
- errors.forEach((err) => {
1838
- context.logger.warn(err);
1839
- });
1878
+ errors.forEach((err) => context.logger.warn(err));
1879
+ }
1880
+ else if (sourceFilesCount === 0) {
1881
+ context.logger.warn('Control flow migration did not find any files to migrate');
1840
1882
  }
1841
1883
  };
1842
1884
  }
1843
- function runControlFlowMigration(tree, tsconfigPath, basePath, pathToMigrate, schematicOptions) {
1844
- if (schematicOptions?.path?.startsWith('..')) {
1845
- throw new schematics.SchematicsException('Cannot run control flow migration outside of the current project.');
1846
- }
1847
- const program = compiler_host.createMigrationProgram(tree, tsconfigPath, basePath);
1848
- const sourceFiles = program
1849
- .getSourceFiles()
1850
- .filter((sourceFile) => (pathToMigrate ? sourceFile.fileName.startsWith(pathToMigrate) : true) &&
1851
- compiler_host.canMigrateFile(basePath, sourceFile, program));
1852
- if (sourceFiles.length === 0) {
1853
- throw new schematics.SchematicsException(`Could not find any files to migrate under the path ${pathToMigrate}. Cannot run the control flow migration.`);
1854
- }
1885
+ function runControlFlowMigration(tree, sourceFiles, basePath, schematicOptions) {
1855
1886
  const analysis = new Map();
1856
1887
  const migrateErrors = new Map();
1857
1888
  for (const sourceFile of sourceFiles) {
@@ -1860,10 +1891,10 @@ function runControlFlowMigration(tree, tsconfigPath, basePath, pathToMigrate, sc
1860
1891
  // sort files with .html files first
1861
1892
  // this ensures class files know if it's safe to remove CommonModule
1862
1893
  const paths = sortFilePaths([...analysis.keys()]);
1863
- for (const path of paths) {
1864
- const file = analysis.get(path);
1894
+ for (const path$1 of paths) {
1895
+ const file = analysis.get(path$1);
1865
1896
  const ranges = file.getSortedRanges();
1866
- const relativePath = p.relative(basePath, path);
1897
+ const relativePath = path.relative(basePath, path$1);
1867
1898
  const content = tree.readText(relativePath);
1868
1899
  const update = tree.beginUpdate(relativePath);
1869
1900
  for (const { start, end, node, type } of ranges) {
@@ -1875,7 +1906,7 @@ function runControlFlowMigration(tree, tsconfigPath, basePath, pathToMigrate, sc
1875
1906
  update.insertLeft(start, migrated);
1876
1907
  }
1877
1908
  if (errors.length > 0) {
1878
- migrateErrors.set(path, errors);
1909
+ migrateErrors.set(path$1, errors);
1879
1910
  }
1880
1911
  }
1881
1912
  tree.commitUpdate(update);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.1
3
+ * @license Angular v21.0.0-next.10
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -49,6 +49,10 @@ function getImportOfIdentifier(typeChecker, node) {
49
49
  function getImportSpecifier(sourceFile, moduleName, specifierName) {
50
50
  return getImportSpecifiers(sourceFile, moduleName, specifierName)[0] ?? null;
51
51
  }
52
+ /**
53
+ * Note: returns only matching imports specifiers,
54
+ * Unmatched imports will be ignored (you won't get undefined), but a shorter array.
55
+ */
52
56
  function getImportSpecifiers(sourceFile, moduleName, specifierOrSpecifiers) {
53
57
  const matches = [];
54
58
  for (const node of sourceFile.statements) {
@@ -1,18 +1,17 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v21.0.0-next.1
3
+ * @license Angular v21.0.0-next.10
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 ts = require('typescript');
10
- require('os');
11
- var project_tsconfig_paths = require('./project_tsconfig_paths-D7xzGqRi.cjs');
12
- var index = require('./index-jjHOgYYs.cjs');
13
- require('path');
10
+ var compilerCli = require('@angular/compiler-cli');
11
+ var migrations = require('@angular/compiler-cli/private/migrations');
14
12
  require('node:path');
15
- var project_paths = require('./project_paths-T_M15e2g.cjs');
13
+ var project_paths = require('./project_paths-DvD50ouC.cjs');
14
+ var compiler = require('@angular/compiler');
16
15
 
17
16
  function getMemberName(member) {
18
17
  if (member.name === undefined) {
@@ -189,7 +188,7 @@ function lookupPropertyAccess(checker, type, path, options = {}) {
189
188
  * This resolution is important to be able to migrate references to inputs
190
189
  * that will be migrated to signal inputs.
191
190
  */
192
- class TemplateReferenceVisitor extends project_tsconfig_paths.RecursiveVisitor {
191
+ class TemplateReferenceVisitor extends compiler.TmplAstRecursiveVisitor {
193
192
  result = [];
194
193
  /**
195
194
  * Whether we are currently descending into HTML AST nodes
@@ -236,21 +235,21 @@ class TemplateReferenceVisitor extends project_tsconfig_paths.RecursiveVisitor {
236
235
  // of signal calls in templates.
237
236
  // TODO: Remove with: https://github.com/angular/angular/pull/55456.
238
237
  this.templateAttributeReferencedFields = [];
239
- project_tsconfig_paths.visitAll(this, template.attributes);
240
- project_tsconfig_paths.visitAll(this, template.templateAttrs);
238
+ compiler.tmplAstVisitAll(this, template.attributes);
239
+ compiler.tmplAstVisitAll(this, template.templateAttrs);
241
240
  // If we are dealing with a microsyntax template, do not check
242
241
  // inputs and outputs as those are already passed to the children.
243
242
  // Template attributes may contain relevant expressions though.
244
243
  if (template.tagName === 'ng-template') {
245
- project_tsconfig_paths.visitAll(this, template.inputs);
246
- project_tsconfig_paths.visitAll(this, template.outputs);
244
+ compiler.tmplAstVisitAll(this, template.inputs);
245
+ compiler.tmplAstVisitAll(this, template.outputs);
247
246
  }
248
247
  const referencedInputs = this.templateAttributeReferencedFields;
249
248
  this.templateAttributeReferencedFields = null;
250
249
  this.descendAndCheckForNarrowedSimilarReferences(referencedInputs, () => {
251
- project_tsconfig_paths.visitAll(this, template.children);
252
- project_tsconfig_paths.visitAll(this, template.references);
253
- project_tsconfig_paths.visitAll(this, template.variables);
250
+ compiler.tmplAstVisitAll(this, template.children);
251
+ compiler.tmplAstVisitAll(this, template.references);
252
+ compiler.tmplAstVisitAll(this, template.variables);
254
253
  });
255
254
  }
256
255
  visitIfBlockBranch(block) {
@@ -317,7 +316,7 @@ class TemplateReferenceVisitor extends project_tsconfig_paths.RecursiveVisitor {
317
316
  * This resolution is important to be able to migrate references to inputs
318
317
  * that will be migrated to signal inputs.
319
318
  */
320
- class TemplateExpressionReferenceVisitor extends project_tsconfig_paths.RecursiveAstVisitor {
319
+ class TemplateExpressionReferenceVisitor extends compiler.RecursiveAstVisitor {
321
320
  typeChecker;
322
321
  templateTypeChecker;
323
322
  componentClass;
@@ -364,7 +363,7 @@ class TemplateExpressionReferenceVisitor extends project_tsconfig_paths.Recursiv
364
363
  super.visitPropertyRead(ast, context);
365
364
  }
366
365
  visitBinary(ast, context) {
367
- if (ast.operation === '=' && ast.left instanceof project_tsconfig_paths.PropertyRead) {
366
+ if (ast.operation === '=' && ast.left instanceof compiler.PropertyRead) {
368
367
  this._inspectPropertyAccess(ast.left, true, [...context, ast, ast.left]);
369
368
  }
370
369
  else {
@@ -402,7 +401,7 @@ class TemplateExpressionReferenceVisitor extends project_tsconfig_paths.Recursiv
402
401
  return false;
403
402
  }
404
403
  const symbol = this.templateTypeChecker.getSymbolOfNode(ast, this.componentClass);
405
- if (symbol?.kind !== project_tsconfig_paths.SymbolKind.Expression || symbol.tsSymbol === null) {
404
+ if (symbol?.kind !== migrations.SymbolKind.Expression || symbol.tsSymbol === null) {
406
405
  return false;
407
406
  }
408
407
  // Dangerous: Type checking symbol retrieval is a totally different `ts.Program`,
@@ -464,7 +463,7 @@ class TemplateExpressionReferenceVisitor extends project_tsconfig_paths.Recursiv
464
463
  _isPartOfNarrowingTernary(read) {
465
464
  // Note: We do not safe check that the reads are fully matching 1:1. This is acceptable
466
465
  // as worst case we just skip an input from being migrated. This is very unlikely too.
467
- return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof project_tsconfig_paths.PropertyRead || r instanceof project_tsconfig_paths.SafePropertyRead) && r.name === read.name);
466
+ return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof compiler.PropertyRead || r instanceof compiler.SafePropertyRead) && r.name === read.name);
468
467
  }
469
468
  }
470
469
  /**
@@ -474,11 +473,11 @@ class TemplateExpressionReferenceVisitor extends project_tsconfig_paths.Recursiv
474
473
  function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker) {
475
474
  const path = [readOrWrite.name];
476
475
  let node = readOrWrite;
477
- while (node.receiver instanceof project_tsconfig_paths.PropertyRead) {
476
+ while (node.receiver instanceof compiler.PropertyRead) {
478
477
  node = node.receiver;
479
478
  path.unshift(node.name);
480
479
  }
481
- if (!(node.receiver instanceof project_tsconfig_paths.ImplicitReceiver || node.receiver instanceof project_tsconfig_paths.ThisReceiver)) {
480
+ if (!(node.receiver instanceof compiler.ImplicitReceiver || node.receiver instanceof compiler.ThisReceiver)) {
482
481
  return null;
483
482
  }
484
483
  const classType = checker.getTypeAtLocation(componentClass.name);
@@ -490,8 +489,8 @@ function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker) {
490
489
  }
491
490
  /** Whether the given node refers to a two-way binding AST node. */
492
491
  function isTwoWayBindingNode(node) {
493
- return ((node instanceof project_tsconfig_paths.BoundAttribute && node.type === project_tsconfig_paths.BindingType.TwoWay) ||
494
- (node instanceof project_tsconfig_paths.BoundEvent && node.type === project_tsconfig_paths.ParsedEventType.TwoWay));
492
+ return ((node instanceof compiler.TmplAstBoundAttribute && node.type === compiler.BindingType.TwoWay) ||
493
+ (node instanceof compiler.TmplAstBoundEvent && node.type === compiler.ParsedEventType.TwoWay));
495
494
  }
496
495
 
497
496
  /** Possible types of references to known fields detected. */
@@ -534,7 +533,7 @@ function identifyHostBindingReferences(node, programInfo, checker, reflector, re
534
533
  if (decorators === null) {
535
534
  return;
536
535
  }
537
- const angularDecorators = project_tsconfig_paths.getAngularDecorators(decorators, ['Directive', 'Component'],
536
+ const angularDecorators = migrations.getAngularDecorators(decorators, ['Directive', 'Component'],
538
537
  /* isAngularCore */ false);
539
538
  if (angularDecorators.length === 0) {
540
539
  return;
@@ -544,15 +543,15 @@ function identifyHostBindingReferences(node, programInfo, checker, reflector, re
544
543
  if (ngDecorator.args?.length !== 1) {
545
544
  return;
546
545
  }
547
- const metadataNode = project_tsconfig_paths.unwrapExpression(ngDecorator.args[0]);
546
+ const metadataNode = migrations.unwrapExpression(ngDecorator.args[0]);
548
547
  if (!ts.isObjectLiteralExpression(metadataNode)) {
549
548
  return;
550
549
  }
551
- const metadata = project_tsconfig_paths.reflectObjectLiteral(metadataNode);
550
+ const metadata = migrations.reflectObjectLiteral(metadataNode);
552
551
  if (!metadata.has('host')) {
553
552
  return;
554
553
  }
555
- let hostField = project_tsconfig_paths.unwrapExpression(metadata.get('host'));
554
+ let hostField = migrations.unwrapExpression(metadata.get('host'));
556
555
  // Special-case in case host bindings are shared via a variable.
557
556
  // e.g. Material button shares host bindings as a constant in the same target.
558
557
  if (ts.isIdentifier(hostField)) {
@@ -570,7 +569,7 @@ function identifyHostBindingReferences(node, programInfo, checker, reflector, re
570
569
  if (hostField === undefined || !ts.isObjectLiteralExpression(hostField)) {
571
570
  return;
572
571
  }
573
- const hostMap = project_tsconfig_paths.reflectObjectLiteral(hostField);
572
+ const hostMap = migrations.reflectObjectLiteral(hostField);
574
573
  const expressionResult = [];
575
574
  const expressionVisitor = new TemplateExpressionReferenceVisitor(checker, null, node, knownFields, fieldNamesToConsiderForReferenceLookup);
576
575
  for (const [rawName, expression] of hostMap.entries()) {
@@ -583,11 +582,11 @@ function identifyHostBindingReferences(node, programInfo, checker, reflector, re
583
582
  if (!isPropertyBinding && !isEventBinding) {
584
583
  continue;
585
584
  }
586
- const parser = project_tsconfig_paths.makeBindingParser();
587
- const sourceSpan = new project_tsconfig_paths.ParseSourceSpan(
585
+ const parser = compiler.makeBindingParser();
586
+ const sourceSpan = new compiler.ParseSourceSpan(
588
587
  // Fake source span to keep parsing offsets zero-based.
589
588
  // We then later combine these with the expression TS node offsets.
590
- new project_tsconfig_paths.ParseLocation({ content: '', url: '' }, 0, 0, 0), new project_tsconfig_paths.ParseLocation({ content: '', url: '' }, 0, 0, 0));
589
+ new compiler.ParseLocation({ content: '', url: '' }, 0, 0, 0), new compiler.ParseLocation({ content: '', url: '' }, 0, 0, 0));
591
590
  const name = rawName.substring(1, rawName.length - 1);
592
591
  let parsed = undefined;
593
592
  if (isEventBinding) {
@@ -630,9 +629,9 @@ function identifyHostBindingReferences(node, programInfo, checker, reflector, re
630
629
  */
631
630
  function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoader) {
632
631
  const classDecorators = reflector.getDecoratorsOfDeclaration(node);
633
- const evaluator = new index.PartialEvaluator(reflector, checker, null);
632
+ const evaluator = new migrations.PartialEvaluator(reflector, checker, null);
634
633
  const ngDecorators = classDecorators !== null
635
- ? project_tsconfig_paths.getAngularDecorators(classDecorators, ['Component'], /* isAngularCore */ false)
634
+ ? migrations.getAngularDecorators(classDecorators, ['Component'], /* isAngularCore */ false)
636
635
  : [];
637
636
  if (ngDecorators.length === 0 ||
638
637
  ngDecorators[0].args === null ||
@@ -640,7 +639,7 @@ function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoad
640
639
  !ts.isObjectLiteralExpression(ngDecorators[0].args[0])) {
641
640
  return null;
642
641
  }
643
- const properties = project_tsconfig_paths.reflectObjectLiteral(ngDecorators[0].args[0]);
642
+ const properties = migrations.reflectObjectLiteral(ngDecorators[0].args[0]);
644
643
  const templateProp = properties.get('template');
645
644
  const templateUrlProp = properties.get('templateUrl');
646
645
  const containingFile = node.getSourceFile().fileName;
@@ -651,7 +650,6 @@ function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoad
651
650
  return {
652
651
  isInline: true,
653
652
  expression: templateProp,
654
- interpolationConfig: project_tsconfig_paths.DEFAULT_INTERPOLATION_CONFIG,
655
653
  preserveWhitespaces: false,
656
654
  resolvedTemplateUrl: containingFile,
657
655
  templateUrl: containingFile,
@@ -665,7 +663,6 @@ function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoad
665
663
  if (typeof templateUrl === 'string') {
666
664
  return {
667
665
  isInline: false,
668
- interpolationConfig: project_tsconfig_paths.DEFAULT_INTERPOLATION_CONFIG,
669
666
  preserveWhitespaces: false,
670
667
  templateUrlExpression: templateUrlProp,
671
668
  templateUrl,
@@ -685,7 +682,7 @@ function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoad
685
682
  * all of the references to inputs.
686
683
  */
687
684
  function identifyTemplateReferences(programInfo, node, reflector, checker, evaluator, templateTypeChecker, resourceLoader, options, result, knownFields, fieldNamesToConsiderForReferenceLookup) {
688
- const template = templateTypeChecker.getTemplate(node, project_tsconfig_paths.OptimizeFor.WholeProgram) ??
685
+ const template = templateTypeChecker.getTemplate(node, compilerCli.OptimizeFor.WholeProgram) ??
689
686
  // If there is no template registered in the TCB or compiler, the template may
690
687
  // be skipped due to an explicit `jit: true` setting. We try to detect this case
691
688
  // and parse the template manually.
@@ -714,7 +711,7 @@ function identifyTemplateReferences(programInfo, node, reflector, checker, evalu
714
711
  node: res.context,
715
712
  isObjectShorthandExpression: res.isObjectShorthandExpression,
716
713
  originatingTsFile: project_paths.projectFile(node.getSourceFile(), programInfo),
717
- templateFile: project_paths.projectFile(project_tsconfig_paths.absoluteFrom(templateFilePath), programInfo),
714
+ templateFile: project_paths.projectFile(compilerCli.absoluteFrom(templateFilePath), programInfo),
718
715
  isLikelyPartOfNarrowing: res.isLikelyNarrowed,
719
716
  isWrite: res.isWrite,
720
717
  },
@@ -740,14 +737,14 @@ function extractTemplateWithoutCompilerAnalysis(node, checker, reflector, resour
740
737
  if (tmplDef === null) {
741
738
  return null;
742
739
  }
743
- return index.extractTemplate(node, tmplDef, evaluator, null, resourceLoader, {
740
+ return migrations.extractTemplate(node, tmplDef, evaluator, null, resourceLoader, {
744
741
  enableBlockSyntax: true,
745
742
  enableLetSyntax: true,
746
743
  usePoisonedData: true,
747
744
  enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat !== false,
748
745
  i18nNormalizeLineEndingsInICUs: options.i18nNormalizeLineEndingsInICUs === true,
749
746
  enableSelectorless: false,
750
- }, project_tsconfig_paths.CompilationMode.FULL).nodes;
747
+ }, migrations.CompilationMode.FULL).nodes;
751
748
  }
752
749
 
753
750
  /** Gets the pattern and property name for a given binding element. */