@angular/core 19.1.0-next.4 → 19.1.0

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 (40) hide show
  1. package/LICENSE +1 -1
  2. package/fesm2022/core.mjs +85 -91
  3. package/fesm2022/core.mjs.map +1 -1
  4. package/fesm2022/primitives/event-dispatch.mjs +1 -24
  5. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  6. package/fesm2022/primitives/signals.mjs +1 -1
  7. package/fesm2022/rxjs-interop.mjs +1 -1
  8. package/fesm2022/rxjs-interop.mjs.map +1 -1
  9. package/fesm2022/testing.mjs +4 -4
  10. package/index.d.ts +41 -36
  11. package/package.json +1 -1
  12. package/primitives/event-dispatch/index.d.ts +1 -1
  13. package/primitives/signals/index.d.ts +1 -1
  14. package/rxjs-interop/index.d.ts +1 -1
  15. package/schematics/bundles/apply_import_manager-5082ccea.js +732 -0
  16. package/schematics/bundles/{checker-884633eb.js → checker-aa999c96.js} +50 -25
  17. package/schematics/bundles/cleanup-unused-imports.js +295 -0
  18. package/schematics/bundles/{compiler_host-22f6513d.js → compiler_host-f0b570c8.js} +2 -2
  19. package/schematics/bundles/control-flow-migration.js +3 -3
  20. package/schematics/bundles/explicit-standalone-flag.js +5 -5
  21. package/schematics/bundles/{imports-abe29092.js → imports-31a38653.js} +1 -1
  22. package/schematics/bundles/index-02a11f43.js +30 -0
  23. package/schematics/bundles/{combine_units-4a95b1b9.js → index-15b61bae.js} +10 -723
  24. package/schematics/bundles/inject-migration.js +6 -6
  25. package/schematics/bundles/{leading_space-d190b83b.js → leading_space-6e7a8ec6.js} +1 -1
  26. package/schematics/bundles/{migrate_ts_type_references-4b11f3f2.js → migrate_ts_type_references-042ca765.js} +30 -29
  27. package/schematics/bundles/{nodes-a9f0b985.js → nodes-88c2157f.js} +2 -2
  28. package/schematics/bundles/output-migration.js +27 -26
  29. package/schematics/bundles/pending-tasks.js +5 -5
  30. package/schematics/bundles/{program-094352ba.js → program-393ca8f3.js} +106 -46
  31. package/schematics/bundles/{project_tsconfig_paths-e9ccccbf.js → project_tsconfig_paths-6c9cde78.js} +1 -1
  32. package/schematics/bundles/provide-initializer.js +5 -5
  33. package/schematics/bundles/route-lazy-loading.js +4 -4
  34. package/schematics/bundles/signal-input-migration.js +33 -32
  35. package/schematics/bundles/signal-queries-migration.js +56 -49
  36. package/schematics/bundles/signals.js +8 -7
  37. package/schematics/bundles/standalone-migration.js +12 -28
  38. package/schematics/collection.json +5 -0
  39. package/schematics/ng-generate/cleanup-unused-imports/schema.json +7 -0
  40. package/testing/index.d.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.4
3
+ * @license Angular v19.1.0
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -9,16 +9,17 @@
9
9
  Object.defineProperty(exports, '__esModule', { value: true });
10
10
 
11
11
  var schematics = require('@angular-devkit/schematics');
12
- var migrate_ts_type_references = require('./migrate_ts_type_references-4b11f3f2.js');
12
+ var migrate_ts_type_references = require('./migrate_ts_type_references-042ca765.js');
13
13
  var ts = require('typescript');
14
14
  require('os');
15
- var checker = require('./checker-884633eb.js');
16
- var program = require('./program-094352ba.js');
15
+ var checker = require('./checker-aa999c96.js');
16
+ var program = require('./program-393ca8f3.js');
17
17
  require('path');
18
- var combine_units = require('./combine_units-4a95b1b9.js');
18
+ var apply_import_manager = require('./apply_import_manager-5082ccea.js');
19
+ var index = require('./index-15b61bae.js');
19
20
  var assert = require('assert');
20
- var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js');
21
- require('./leading_space-d190b83b.js');
21
+ var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js');
22
+ require('./leading_space-6e7a8ec6.js');
22
23
  require('fs');
23
24
  require('module');
24
25
  require('url');
@@ -107,7 +108,7 @@ function getInputDescriptor(hostOrInfo, node) {
107
108
  className = node.parent.name?.text ?? '<anonymous>';
108
109
  }
109
110
  const info = hostOrInfo instanceof MigrationHost ? hostOrInfo.programInfo : hostOrInfo;
110
- const file = combine_units.projectFile(node.getSourceFile(), info);
111
+ const file = apply_import_manager.projectFile(node.getSourceFile(), info);
111
112
  // Inputs may be detected in `.d.ts` files. Ensure that if the file IDs
112
113
  // match regardless of extension. E.g. `/google3/blaze-out/bin/my_file.ts` should
113
114
  // have the same ID as `/google3/my_file.ts`.
@@ -126,11 +127,11 @@ function attemptRetrieveInputFromSymbol(programInfo, memberSymbol, knownInputs)
126
127
  // Even for declared classes from `.d.ts`, the value declaration
127
128
  // should exist and point to the property declaration.
128
129
  if (memberSymbol.valueDeclaration !== undefined &&
129
- combine_units.isInputContainerNode(memberSymbol.valueDeclaration)) {
130
+ index.isInputContainerNode(memberSymbol.valueDeclaration)) {
130
131
  const member = memberSymbol.valueDeclaration;
131
132
  // If the member itself is an input that is being migrated, we
132
133
  // do not need to check, as overriding would be fine then— like before.
133
- const memberInputDescr = combine_units.isInputContainerNode(member)
134
+ const memberInputDescr = index.isInputContainerNode(member)
134
135
  ? getInputDescriptor(programInfo, member)
135
136
  : null;
136
137
  return memberInputDescr !== null ? (knownInputs.get(memberInputDescr) ?? null) : null;
@@ -186,7 +187,7 @@ class KnownInputs {
186
187
  }
187
188
  const directiveInfo = this._classToDirectiveInfo.get(data.node.parent);
188
189
  const inputInfo = {
189
- file: combine_units.projectFile(data.node.getSourceFile(), this.programInfo),
190
+ file: apply_import_manager.projectFile(data.node.getSourceFile(), this.programInfo),
190
191
  metadata: data.metadata,
191
192
  descriptor: data.descriptor,
192
193
  container: directiveInfo,
@@ -326,7 +327,7 @@ function extractDecoratorInput(node, host, reflector, metadataReader, evaluator)
326
327
  * part of a `.d.ts` file.
327
328
  */
328
329
  function extractDtsInput(node, metadataReader) {
329
- if (!combine_units.isInputContainerNode(node) ||
330
+ if (!index.isInputContainerNode(node) ||
330
331
  !ts__default["default"].isIdentifier(node.name) ||
331
332
  !node.getSourceFile().isDeclarationFile) {
332
333
  return null;
@@ -369,7 +370,7 @@ function extractDtsInput(node, metadataReader) {
369
370
  * directly defined inside a source file (`.ts`).
370
371
  */
371
372
  function extractSourceCodeInput(node, host, reflector, evaluator) {
372
- if (!combine_units.isInputContainerNode(node) ||
373
+ if (!index.isInputContainerNode(node) ||
373
374
  !ts__default["default"].isIdentifier(node.name) ||
374
375
  node.getSourceFile().isDeclarationFile) {
375
376
  return null;
@@ -602,7 +603,7 @@ function pass1__IdentifySourceFileAndDeclarationInputs(sf, host, checker, reflec
602
603
  const visitor = (node) => {
603
604
  const decoratorInput = extractDecoratorInput(node, host, reflector, dtsMetadataReader, evaluator);
604
605
  if (decoratorInput !== null) {
605
- assert__default["default"](combine_units.isInputContainerNode(node), 'Expected input to be declared on accessor or property.');
606
+ assert__default["default"](index.isInputContainerNode(node), 'Expected input to be declared on accessor or property.');
606
607
  const inputDescr = getInputDescriptor(host, node);
607
608
  // track all inputs, even from declarations for reference resolution.
608
609
  knownDecoratorInputs.register({ descriptor: inputDescr, metadata: decoratorInput, node });
@@ -673,7 +674,7 @@ function pass3__checkIncompatiblePatterns(host, inheritanceGraph, checker$1, gro
673
674
  * such.
674
675
  */
675
676
  function pass2_IdentifySourceFileReferences(programInfo, checker, reflector, resourceLoader, evaluator, templateTypeChecker, groupedTsAstVisitor, knownInputs, result, fieldNamesToConsiderForReferenceLookup) {
676
- groupedTsAstVisitor.register(combine_units.createFindAllSourceFileReferencesVisitor(programInfo, checker, reflector, resourceLoader, evaluator, templateTypeChecker, knownInputs, fieldNamesToConsiderForReferenceLookup, result).visitor);
677
+ groupedTsAstVisitor.register(index.createFindAllSourceFileReferencesVisitor(programInfo, checker, reflector, resourceLoader, evaluator, templateTypeChecker, knownInputs, fieldNamesToConsiderForReferenceLookup, result).visitor);
677
678
  }
678
679
 
679
680
  /**
@@ -711,13 +712,13 @@ function executeAnalysisPhase(host, knownInputs, result, { sourceFiles, fullProg
711
712
  pass2And3SourceFileVisitor.execute();
712
713
  // Determine incompatible inputs based on resolved references.
713
714
  for (const reference of result.references) {
714
- if (combine_units.isTsReference(reference) && reference.from.isWrite) {
715
+ if (index.isTsReference(reference) && reference.from.isWrite) {
715
716
  knownInputs.markFieldIncompatible(reference.target, {
716
717
  reason: migrate_ts_type_references.FieldIncompatibilityReason.WriteAssignment,
717
718
  context: reference.from.node,
718
719
  });
719
720
  }
720
- if (combine_units.isTemplateReference(reference) || combine_units.isHostBindingReference(reference)) {
721
+ if (index.isTemplateReference(reference) || index.isHostBindingReference(reference)) {
721
722
  if (reference.from.isWrite) {
722
723
  knownInputs.markFieldIncompatible(reference.target, {
723
724
  reason: migrate_ts_type_references.FieldIncompatibilityReason.WriteAssignment,
@@ -728,7 +729,7 @@ function executeAnalysisPhase(host, knownInputs, result, { sourceFiles, fullProg
728
729
  }
729
730
  // TODO: Remove this when we support signal narrowing in templates.
730
731
  // https://github.com/angular/angular/pull/55456.
731
- if (combine_units.isTemplateReference(reference)) {
732
+ if (index.isTemplateReference(reference)) {
732
733
  if (reference.from.isLikelyPartOfNarrowing) {
733
734
  knownInputs.markFieldIncompatible(reference.target, {
734
735
  reason: migrate_ts_type_references.FieldIncompatibilityReason.PotentiallyNarrowedInTemplateButNoSupportYet,
@@ -1040,7 +1041,7 @@ function convertToSignalInput(node, { resolvedMetadata: metadata, resolvedType,
1040
1041
  if (leadingTodoText !== null) {
1041
1042
  replacements.push(migrate_ts_type_references.insertPrecedingLine(node, info, '// TODO: Notes from signal input migration:'), ...migrate_ts_type_references.cutStringToLineLimit(leadingTodoText, 70).map((line) => migrate_ts_type_references.insertPrecedingLine(node, info, `// ${line}`)));
1042
1043
  }
1043
- replacements.push(new combine_units.Replacement(combine_units.projectFile(node.getSourceFile(), info), new combine_units.TextUpdate({
1044
+ replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(node.getSourceFile(), info), new apply_import_manager.TextUpdate({
1044
1045
  position: node.getStart(),
1045
1046
  end: node.getEnd(),
1046
1047
  toInsert: newPropertyText,
@@ -1120,7 +1121,7 @@ function pass6__migrateInputDeclarations(host, checker, result, knownInputs, imp
1120
1121
  * previous migrate phases.
1121
1122
  */
1122
1123
  function pass10_applyImportManager(importManager, result, sourceFiles, info) {
1123
- combine_units.applyImportManagerChanges(importManager, result.replacements, sourceFiles, info);
1124
+ apply_import_manager.applyImportManagerChanges(importManager, result.replacements, sourceFiles, info);
1124
1125
  }
1125
1126
 
1126
1127
  /**
@@ -1141,7 +1142,7 @@ function pass7__migrateTemplateReferences(host, references) {
1141
1142
  const seenFileReferences = new Set();
1142
1143
  for (const reference of references) {
1143
1144
  // This pass only deals with HTML template references.
1144
- if (!combine_units.isTemplateReference(reference)) {
1145
+ if (!index.isTemplateReference(reference)) {
1145
1146
  continue;
1146
1147
  }
1147
1148
  // Skip references to incompatible inputs.
@@ -1158,7 +1159,7 @@ function pass7__migrateTemplateReferences(host, references) {
1158
1159
  const appendText = reference.from.isObjectShorthandExpression
1159
1160
  ? `: ${reference.from.read.name}()`
1160
1161
  : `()`;
1161
- host.replacements.push(new combine_units.Replacement(reference.from.templateFile, new combine_units.TextUpdate({
1162
+ host.replacements.push(new apply_import_manager.Replacement(reference.from.templateFile, new apply_import_manager.TextUpdate({
1162
1163
  position: reference.from.read.sourceSpan.end,
1163
1164
  end: reference.from.read.sourceSpan.end,
1164
1165
  toInsert: appendText,
@@ -1174,7 +1175,7 @@ function pass8__migrateHostBindings(host, references, info) {
1174
1175
  const seenReferences = new WeakMap();
1175
1176
  for (const reference of references) {
1176
1177
  // This pass only deals with host binding references.
1177
- if (!combine_units.isHostBindingReference(reference)) {
1178
+ if (!index.isHostBindingReference(reference)) {
1178
1179
  continue;
1179
1180
  }
1180
1181
  // Skip references to incompatible inputs.
@@ -1198,7 +1199,7 @@ function pass8__migrateHostBindings(host, references, info) {
1198
1199
  const appendText = reference.from.isObjectShorthandExpression
1199
1200
  ? `: ${reference.from.read.name}()`
1200
1201
  : `()`;
1201
- host.replacements.push(new combine_units.Replacement(combine_units.projectFile(bindingField.getSourceFile(), info), new combine_units.TextUpdate({ position: readEndPos, end: readEndPos, toInsert: appendText })));
1202
+ host.replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(bindingField.getSourceFile(), info), new apply_import_manager.TextUpdate({ position: readEndPos, end: readEndPos, toInsert: appendText })));
1202
1203
  }
1203
1204
  }
1204
1205
 
@@ -1261,7 +1262,7 @@ function filterIncompatibilitiesForBestEffortMode(knownInputs) {
1261
1262
  * Tsurge migration for migrating Angular `@Input()` declarations to
1262
1263
  * signal inputs, with support for batch execution.
1263
1264
  */
1264
- class SignalInputMigration extends combine_units.TsurgeComplexMigration {
1265
+ class SignalInputMigration extends apply_import_manager.TsurgeComplexMigration {
1265
1266
  config;
1266
1267
  upgradedAnalysisPhaseResults = null;
1267
1268
  constructor(config = {}) {
@@ -1270,7 +1271,7 @@ class SignalInputMigration extends combine_units.TsurgeComplexMigration {
1270
1271
  }
1271
1272
  // Override the default program creation, to add extra flags.
1272
1273
  createProgram(tsconfigAbsPath, fs) {
1273
- return combine_units.createBaseProgramInfo(tsconfigAbsPath, fs, {
1274
+ return apply_import_manager.createBaseProgramInfo(tsconfigAbsPath, fs, {
1274
1275
  _compilePoisonedComponents: true,
1275
1276
  // We want to migrate non-exported classes too.
1276
1277
  compileNonExportedClasses: true,
@@ -1342,13 +1343,13 @@ class SignalInputMigration extends combine_units.TsurgeComplexMigration {
1342
1343
  knownInputs,
1343
1344
  };
1344
1345
  }
1345
- return combine_units.confirmAsSerializable(unitData);
1346
+ return apply_import_manager.confirmAsSerializable(unitData);
1346
1347
  }
1347
1348
  async combine(unitA, unitB) {
1348
- return combine_units.confirmAsSerializable(combineCompilationUnitData(unitA, unitB));
1349
+ return apply_import_manager.confirmAsSerializable(combineCompilationUnitData(unitA, unitB));
1349
1350
  }
1350
1351
  async globalMeta(combinedData) {
1351
- return combine_units.confirmAsSerializable(convertToGlobalMeta(combinedData));
1352
+ return apply_import_manager.confirmAsSerializable(convertToGlobalMeta(combinedData));
1352
1353
  }
1353
1354
  async migrate(globalMetadata, info, nonBatchData) {
1354
1355
  const knownInputs = nonBatchData?.knownInputs ?? new KnownInputs(info, this.config);
@@ -1442,7 +1443,7 @@ function migrate(options) {
1442
1443
  if (!buildPaths.length && !testPaths.length) {
1443
1444
  throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run signal input migration.');
1444
1445
  }
1445
- const fs = new combine_units.DevkitMigrationFilesystem(tree);
1446
+ const fs = new apply_import_manager.DevkitMigrationFilesystem(tree);
1446
1447
  checker.setFileSystem(fs);
1447
1448
  const migration = new SignalInputMigration({
1448
1449
  bestEffortMode: options.bestEffortMode,
@@ -1474,7 +1475,7 @@ function migrate(options) {
1474
1475
  context.logger.info(``);
1475
1476
  context.logger.info(`Processing analysis data between targets..`);
1476
1477
  context.logger.info(``);
1477
- const combined = await combine_units.synchronouslyCombineUnitData(migration, unitResults);
1478
+ const combined = await apply_import_manager.synchronouslyCombineUnitData(migration, unitResults);
1478
1479
  if (combined === null) {
1479
1480
  context.logger.error('Migration failed unexpectedly with no analysis data');
1480
1481
  return;
@@ -1484,7 +1485,7 @@ function migrate(options) {
1484
1485
  for (const { info, tsconfigPath } of programInfos) {
1485
1486
  context.logger.info(`Migrating: ${tsconfigPath}..`);
1486
1487
  const { replacements } = await migration.migrate(globalMeta, info);
1487
- const changesPerFile = combine_units.groupReplacementsByFile(replacements);
1488
+ const changesPerFile = apply_import_manager.groupReplacementsByFile(replacements);
1488
1489
  for (const [file, changes] of changesPerFile) {
1489
1490
  if (!replacementsPerFile.has(file)) {
1490
1491
  replacementsPerFile.set(file, changes);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.4
3
+ * @license Angular v19.1.0
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -9,21 +9,22 @@
9
9
  Object.defineProperty(exports, '__esModule', { value: true });
10
10
 
11
11
  var schematics = require('@angular-devkit/schematics');
12
- var project_tsconfig_paths = require('./project_tsconfig_paths-e9ccccbf.js');
13
- var combine_units = require('./combine_units-4a95b1b9.js');
12
+ var project_tsconfig_paths = require('./project_tsconfig_paths-6c9cde78.js');
13
+ var apply_import_manager = require('./apply_import_manager-5082ccea.js');
14
14
  require('os');
15
15
  var ts = require('typescript');
16
- var checker = require('./checker-884633eb.js');
17
- var program = require('./program-094352ba.js');
16
+ var checker = require('./checker-aa999c96.js');
17
+ var program = require('./program-393ca8f3.js');
18
18
  require('path');
19
- var migrate_ts_type_references = require('./migrate_ts_type_references-4b11f3f2.js');
19
+ var migrate_ts_type_references = require('./migrate_ts_type_references-042ca765.js');
20
20
  var assert = require('assert');
21
+ var index = require('./index-15b61bae.js');
21
22
  require('@angular-devkit/core');
22
23
  require('node:path/posix');
23
24
  require('fs');
24
25
  require('module');
25
26
  require('url');
26
- require('./leading_space-d190b83b.js');
27
+ require('./leading_space-6e7a8ec6.js');
27
28
 
28
29
  function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
29
30
 
@@ -38,7 +39,7 @@ function migrateHostBindings(host, references, info) {
38
39
  const seenReferences = new WeakMap();
39
40
  for (const reference of references) {
40
41
  // This pass only deals with host binding references.
41
- if (!combine_units.isHostBindingReference(reference)) {
42
+ if (!index.isHostBindingReference(reference)) {
42
43
  continue;
43
44
  }
44
45
  // Skip references to incompatible inputs.
@@ -62,7 +63,7 @@ function migrateHostBindings(host, references, info) {
62
63
  const appendText = reference.from.isObjectShorthandExpression
63
64
  ? `: ${reference.from.read.name}()`
64
65
  : `()`;
65
- host.replacements.push(new combine_units.Replacement(combine_units.projectFile(bindingField.getSourceFile(), info), new combine_units.TextUpdate({ position: readEndPos, end: readEndPos, toInsert: appendText })));
66
+ host.replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(bindingField.getSourceFile(), info), new apply_import_manager.TextUpdate({ position: readEndPos, end: readEndPos, toInsert: appendText })));
66
67
  }
67
68
  }
68
69
 
@@ -74,7 +75,7 @@ function migrateTemplateReferences(host, references) {
74
75
  const seenFileReferences = new Set();
75
76
  for (const reference of references) {
76
77
  // This pass only deals with HTML template references.
77
- if (!combine_units.isTemplateReference(reference)) {
78
+ if (!index.isTemplateReference(reference)) {
78
79
  continue;
79
80
  }
80
81
  // Skip references to incompatible inputs.
@@ -91,7 +92,7 @@ function migrateTemplateReferences(host, references) {
91
92
  const appendText = reference.from.isObjectShorthandExpression
92
93
  ? `: ${reference.from.read.name}()`
93
94
  : `()`;
94
- host.replacements.push(new combine_units.Replacement(reference.from.templateFile, new combine_units.TextUpdate({
95
+ host.replacements.push(new apply_import_manager.Replacement(reference.from.templateFile, new apply_import_manager.TextUpdate({
95
96
  position: reference.from.read.sourceSpan.end,
96
97
  end: reference.from.read.sourceSpan.end,
97
98
  toInsert: appendText,
@@ -222,7 +223,7 @@ function computeReplacementsToMigrateQuery(node, metadata, importManager, info,
222
223
  resolvedReadType === null && type !== undefined ? [type] : undefined, args);
223
224
  const updated = ts__default["default"].factory.createPropertyDeclaration([ts__default["default"].factory.createModifier(ts__default["default"].SyntaxKind.ReadonlyKeyword)], node.name, undefined, undefined, call);
224
225
  return [
225
- new combine_units.Replacement(combine_units.projectFile(node.getSourceFile(), info), new combine_units.TextUpdate({
226
+ new apply_import_manager.Replacement(apply_import_manager.projectFile(node.getSourceFile(), info), new apply_import_manager.TextUpdate({
226
227
  position: node.getStart(),
227
228
  end: node.getEnd(),
228
229
  toInsert: printer.printNode(ts__default["default"].EmitHint.Unspecified, updated, sf),
@@ -263,7 +264,7 @@ function getUniqueIDForClassProperty(property, info) {
263
264
  if (property.name === undefined) {
264
265
  return null;
265
266
  }
266
- const id = combine_units.projectFile(property.getSourceFile(), info).id.replace(/\.d\.ts$/, '.ts');
267
+ const id = apply_import_manager.projectFile(property.getSourceFile(), info).id.replace(/\.d\.ts$/, '.ts');
267
268
  // Note: If a class is nested, there could be an ID clash.
268
269
  // This is highly unlikely though, and this is not a problem because
269
270
  // in such cases, there is even less chance there are any references to
@@ -387,7 +388,7 @@ class KnownQueries {
387
388
  });
388
389
  this.knownQueryIDs.set(id, { key: id, node: queryField });
389
390
  const descriptor = { key: id, node: queryField };
390
- const file = combine_units.projectFile(queryField.getSourceFile(), this.info);
391
+ const file = apply_import_manager.projectFile(queryField.getSourceFile(), this.info);
391
392
  if (this.config.shouldMigrateQuery !== undefined &&
392
393
  !this.config.shouldMigrateQuery(descriptor, file)) {
393
394
  this.markFieldIncompatible(descriptor, {
@@ -501,7 +502,7 @@ function queryFunctionNameToDecorator(name) {
501
502
  * E.g. whether `<my-read>.toArray` is detected.
502
503
  */
503
504
  function checkTsReferenceAccessesField(ref, fieldName) {
504
- const accessNode = combine_units.traverseAccess(ref.from.node);
505
+ const accessNode = index.traverseAccess(ref.from.node);
505
506
  // Check if the reference is part of a property access.
506
507
  if (!ts__default["default"].isPropertyAccessExpression(accessNode.parent) ||
507
508
  !ts__default["default"].isIdentifier(accessNode.parent.name)) {
@@ -570,7 +571,7 @@ function checkNonTsReferenceCallsField(ref, fieldName) {
570
571
  }
571
572
 
572
573
  function removeQueryListToArrayCall(ref, info, globalMetadata, knownQueries, replacements) {
573
- if (!combine_units.isHostBindingReference(ref) && !combine_units.isTemplateReference(ref) && !combine_units.isTsReference(ref)) {
574
+ if (!index.isHostBindingReference(ref) && !index.isTemplateReference(ref) && !index.isTsReference(ref)) {
574
575
  return;
575
576
  }
576
577
  if (knownQueries.isFieldIncompatible(ref.target)) {
@@ -580,13 +581,13 @@ function removeQueryListToArrayCall(ref, info, globalMetadata, knownQueries, rep
580
581
  return;
581
582
  }
582
583
  // TS references.
583
- if (combine_units.isTsReference(ref)) {
584
+ if (index.isTsReference(ref)) {
584
585
  const toArrayCallExpr = checkTsReferenceCallsField(ref, 'toArray');
585
586
  if (toArrayCallExpr === null) {
586
587
  return;
587
588
  }
588
589
  const toArrayExpr = toArrayCallExpr.expression;
589
- replacements.push(new combine_units.Replacement(combine_units.projectFile(toArrayExpr.getSourceFile(), info), new combine_units.TextUpdate({
590
+ replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(toArrayExpr.getSourceFile(), info), new apply_import_manager.TextUpdate({
590
591
  // Delete from expression end to call end. E.g. `.toArray(<..>)`.
591
592
  position: toArrayExpr.expression.getEnd(),
592
593
  end: toArrayCallExpr.getEnd(),
@@ -599,9 +600,9 @@ function removeQueryListToArrayCall(ref, info, globalMetadata, knownQueries, rep
599
600
  if (callExpr === null) {
600
601
  return;
601
602
  }
602
- const file = combine_units.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
603
- const offset = combine_units.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
604
- replacements.push(new combine_units.Replacement(file, new combine_units.TextUpdate({
603
+ const file = index.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
604
+ const offset = index.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
605
+ replacements.push(new apply_import_manager.Replacement(file, new apply_import_manager.TextUpdate({
605
606
  // Delete from expression end to call end. E.g. `.toArray(<..>)`.
606
607
  position: offset + callExpr.receiver.receiver.sourceSpan.end,
607
608
  end: offset + callExpr.sourceSpan.end,
@@ -610,7 +611,7 @@ function removeQueryListToArrayCall(ref, info, globalMetadata, knownQueries, rep
610
611
  }
611
612
 
612
613
  function replaceQueryListGetCall(ref, info, globalMetadata, knownQueries, replacements) {
613
- if (!combine_units.isHostBindingReference(ref) && !combine_units.isTemplateReference(ref) && !combine_units.isTsReference(ref)) {
614
+ if (!index.isHostBindingReference(ref) && !index.isTemplateReference(ref) && !index.isTsReference(ref)) {
614
615
  return;
615
616
  }
616
617
  if (knownQueries.isFieldIncompatible(ref.target)) {
@@ -619,13 +620,13 @@ function replaceQueryListGetCall(ref, info, globalMetadata, knownQueries, replac
619
620
  if (!globalMetadata.knownQueryFields[ref.target.key]?.isMulti) {
620
621
  return;
621
622
  }
622
- if (combine_units.isTsReference(ref)) {
623
+ if (index.isTsReference(ref)) {
623
624
  const getCallExpr = checkTsReferenceCallsField(ref, 'get');
624
625
  if (getCallExpr === null) {
625
626
  return;
626
627
  }
627
628
  const getExpr = getCallExpr.expression;
628
- replacements.push(new combine_units.Replacement(combine_units.projectFile(getExpr.getSourceFile(), info), new combine_units.TextUpdate({
629
+ replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(getExpr.getSourceFile(), info), new apply_import_manager.TextUpdate({
629
630
  position: getExpr.name.getStart(),
630
631
  end: getExpr.name.getEnd(),
631
632
  toInsert: 'at',
@@ -637,9 +638,9 @@ function replaceQueryListGetCall(ref, info, globalMetadata, knownQueries, replac
637
638
  if (callExpr === null) {
638
639
  return;
639
640
  }
640
- const file = combine_units.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
641
- const offset = combine_units.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
642
- replacements.push(new combine_units.Replacement(file, new combine_units.TextUpdate({
641
+ const file = index.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
642
+ const offset = index.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
643
+ replacements.push(new apply_import_manager.Replacement(file, new apply_import_manager.TextUpdate({
643
644
  position: offset + callExpr.receiver.nameSpan.start,
644
645
  end: offset + callExpr.receiver.nameSpan.end,
645
646
  toInsert: 'at',
@@ -655,7 +656,7 @@ const problematicQueryListMethods = [
655
656
  'destroy',
656
657
  ];
657
658
  function checkForIncompatibleQueryListAccesses(ref, result) {
658
- if (combine_units.isTsReference(ref)) {
659
+ if (index.isTsReference(ref)) {
659
660
  for (const problematicFn of problematicQueryListMethods) {
660
661
  const access = checkTsReferenceAccessesField(ref, problematicFn);
661
662
  if (access !== null) {
@@ -664,7 +665,7 @@ function checkForIncompatibleQueryListAccesses(ref, result) {
664
665
  }
665
666
  }
666
667
  }
667
- if (combine_units.isHostBindingReference(ref) || combine_units.isTemplateReference(ref)) {
668
+ if (index.isHostBindingReference(ref) || index.isTemplateReference(ref)) {
668
669
  for (const problematicFn of problematicQueryListMethods) {
669
670
  const access = checkNonTsReferenceAccessesField(ref, problematicFn);
670
671
  if (access !== null) {
@@ -680,7 +681,7 @@ const mapping = new Map([
680
681
  ['last', 'at(-1)!'],
681
682
  ]);
682
683
  function replaceQueryListFirstAndLastReferences(ref, info, globalMetadata, knownQueries, replacements) {
683
- if (!combine_units.isHostBindingReference(ref) && !combine_units.isTemplateReference(ref) && !combine_units.isTsReference(ref)) {
684
+ if (!index.isHostBindingReference(ref) && !index.isTemplateReference(ref) && !index.isTsReference(ref)) {
684
685
  return;
685
686
  }
686
687
  if (knownQueries.isFieldIncompatible(ref.target)) {
@@ -689,12 +690,12 @@ function replaceQueryListFirstAndLastReferences(ref, info, globalMetadata, known
689
690
  if (!globalMetadata.knownQueryFields[ref.target.key]?.isMulti) {
690
691
  return;
691
692
  }
692
- if (combine_units.isTsReference(ref)) {
693
+ if (index.isTsReference(ref)) {
693
694
  const expr = checkTsReferenceAccessesField(ref, 'first') ?? checkTsReferenceAccessesField(ref, 'last');
694
695
  if (expr === null) {
695
696
  return;
696
697
  }
697
- replacements.push(new combine_units.Replacement(combine_units.projectFile(expr.getSourceFile(), info), new combine_units.TextUpdate({
698
+ replacements.push(new apply_import_manager.Replacement(apply_import_manager.projectFile(expr.getSourceFile(), info), new apply_import_manager.TextUpdate({
698
699
  position: expr.name.getStart(),
699
700
  end: expr.name.getEnd(),
700
701
  toInsert: mapping.get(expr.name.text),
@@ -706,16 +707,16 @@ function replaceQueryListFirstAndLastReferences(ref, info, globalMetadata, known
706
707
  if (expr === null) {
707
708
  return;
708
709
  }
709
- const file = combine_units.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
710
- const offset = combine_units.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
711
- replacements.push(new combine_units.Replacement(file, new combine_units.TextUpdate({
710
+ const file = index.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
711
+ const offset = index.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
712
+ replacements.push(new apply_import_manager.Replacement(file, new apply_import_manager.TextUpdate({
712
713
  position: offset + expr.nameSpan.start,
713
714
  end: offset + expr.nameSpan.end,
714
715
  toInsert: mapping.get(expr.name),
715
716
  })));
716
717
  }
717
718
 
718
- class SignalQueriesMigration extends combine_units.TsurgeComplexMigration {
719
+ class SignalQueriesMigration extends apply_import_manager.TsurgeComplexMigration {
719
720
  config;
720
721
  constructor(config = {}) {
721
722
  super();
@@ -753,7 +754,7 @@ class SignalQueriesMigration extends combine_units.TsurgeComplexMigration {
753
754
  key: extractedQuery.id,
754
755
  node: queryNode,
755
756
  };
756
- const containingFile = combine_units.projectFile(queryNode.getSourceFile(), info);
757
+ const containingFile = apply_import_manager.projectFile(queryNode.getSourceFile(), info);
757
758
  // If we have a config filter function, use it here for later
758
759
  // perf-boosted reference lookups. Useful in non-batch mode.
759
760
  if (this.config.shouldMigrateQuery === undefined ||
@@ -812,7 +813,7 @@ class SignalQueriesMigration extends combine_units.TsurgeComplexMigration {
812
813
  return descriptor;
813
814
  },
814
815
  };
815
- groupedAstVisitor.register(combine_units.createFindAllSourceFileReferencesVisitor(info, checker$1, reflector, resourceLoader, evaluator, templateTypeChecker, allFieldsOrKnownQueries,
816
+ groupedAstVisitor.register(index.createFindAllSourceFileReferencesVisitor(info, checker$1, reflector, resourceLoader, evaluator, templateTypeChecker, allFieldsOrKnownQueries,
816
817
  // In non-batch mode, we know what inputs exist and can optimize the reference
817
818
  // resolution significantly (for e.g. VSCode integration)— as we know what
818
819
  // field names may be used to reference potential queries.
@@ -840,15 +841,15 @@ class SignalQueriesMigration extends combine_units.TsurgeComplexMigration {
840
841
  // Determine incompatible queries based on problematic references
841
842
  // we saw in TS code, templates or host bindings.
842
843
  for (const ref of referenceResult.references) {
843
- if (combine_units.isTsReference(ref) && ref.from.isWrite) {
844
+ if (index.isTsReference(ref) && ref.from.isWrite) {
844
845
  markFieldIncompatibleInMetadata(res.potentialProblematicQueries, ref.target.key, migrate_ts_type_references.FieldIncompatibilityReason.WriteAssignment);
845
846
  }
846
- if ((combine_units.isTemplateReference(ref) || combine_units.isHostBindingReference(ref)) && ref.from.isWrite) {
847
+ if ((index.isTemplateReference(ref) || index.isHostBindingReference(ref)) && ref.from.isWrite) {
847
848
  markFieldIncompatibleInMetadata(res.potentialProblematicQueries, ref.target.key, migrate_ts_type_references.FieldIncompatibilityReason.WriteAssignment);
848
849
  }
849
850
  // TODO: Remove this when we support signal narrowing in templates.
850
851
  // https://github.com/angular/angular/pull/55456.
851
- if (combine_units.isTemplateReference(ref) && ref.from.isLikelyPartOfNarrowing) {
852
+ if (index.isTemplateReference(ref) && ref.from.isLikelyPartOfNarrowing) {
852
853
  markFieldIncompatibleInMetadata(res.potentialProblematicQueries, ref.target.key, migrate_ts_type_references.FieldIncompatibilityReason.PotentiallyNarrowedInTemplateButNoSupportYet);
853
854
  }
854
855
  // Check for other incompatible query list accesses.
@@ -857,7 +858,7 @@ class SignalQueriesMigration extends combine_units.TsurgeComplexMigration {
857
858
  if (this.config.assumeNonBatch) {
858
859
  res.reusableAnalysisReferences = referenceResult.references;
859
860
  }
860
- return combine_units.confirmAsSerializable(res);
861
+ return apply_import_manager.confirmAsSerializable(res);
861
862
  }
862
863
  async combine(unitA, unitB) {
863
864
  const combined = {
@@ -897,7 +898,7 @@ class SignalQueriesMigration extends combine_units.TsurgeComplexMigration {
897
898
  }
898
899
  }
899
900
  }
900
- return combine_units.confirmAsSerializable(combined);
901
+ return apply_import_manager.confirmAsSerializable(combined);
901
902
  }
902
903
  async globalMeta(combinedData) {
903
904
  const globalUnitData = {
@@ -910,7 +911,7 @@ class SignalQueriesMigration extends combine_units.TsurgeComplexMigration {
910
911
  markFieldIncompatibleInMetadata(globalUnitData.problematicQueries, id, migrate_ts_type_references.FieldIncompatibilityReason.SignalQueries__QueryListProblematicFieldAccessed);
911
912
  }
912
913
  }
913
- return combine_units.confirmAsSerializable(globalUnitData);
914
+ return apply_import_manager.confirmAsSerializable(globalUnitData);
914
915
  }
915
916
  async migrate(globalMetadata, info) {
916
917
  // Pre-Analyze the program and get access to the template type checker.
@@ -973,7 +974,7 @@ class SignalQueriesMigration extends combine_units.TsurgeComplexMigration {
973
974
  referenceResult.references = globalMetadata.reusableAnalysisReferences;
974
975
  }
975
976
  else {
976
- groupedAstVisitor.register(combine_units.createFindAllSourceFileReferencesVisitor(info, checker$1, reflector, resourceLoader, evaluator, templateTypeChecker, knownQueries, fieldNamesToConsiderForReferenceLookup, referenceResult).visitor);
977
+ groupedAstVisitor.register(index.createFindAllSourceFileReferencesVisitor(info, checker$1, reflector, resourceLoader, evaluator, templateTypeChecker, knownQueries, fieldNamesToConsiderForReferenceLookup, referenceResult).visitor);
977
978
  }
978
979
  // Check inheritance.
979
980
  // NOTE: Inheritance is only checked in the migrate stage as we cannot reliably
@@ -1046,7 +1047,7 @@ class SignalQueriesMigration extends combine_units.TsurgeComplexMigration {
1046
1047
  importManager.removeImport(file, 'QueryList', '@angular/core');
1047
1048
  }
1048
1049
  }
1049
- combine_units.applyImportManagerChanges(importManager, replacements, sourceFiles, info);
1050
+ apply_import_manager.applyImportManagerChanges(importManager, replacements, sourceFiles, info);
1050
1051
  return { replacements, knownQueries };
1051
1052
  }
1052
1053
  async stats(globalMetadata) {
@@ -1065,6 +1066,12 @@ class SignalQueriesMigration extends combine_units.TsurgeComplexMigration {
1065
1066
  if (globalMetadata.knownQueryFields[id] === undefined) {
1066
1067
  continue;
1067
1068
  }
1069
+ // Do not count queries that were forcibly ignored via best effort mode.
1070
+ if (this.config.bestEffortMode &&
1071
+ (info.fieldReason === null ||
1072
+ !migrate_ts_type_references.nonIgnorableFieldIncompatibilities.includes(info.fieldReason))) {
1073
+ continue;
1074
+ }
1068
1075
  incompatibleQueries++;
1069
1076
  if (info.classReason !== null) {
1070
1077
  const reasonName = migrate_ts_type_references.ClassIncompatibilityReason[info.classReason];
@@ -1109,7 +1116,7 @@ function migrate(options) {
1109
1116
  if (!buildPaths.length && !testPaths.length) {
1110
1117
  throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run signal queries migration.');
1111
1118
  }
1112
- const fs = new combine_units.DevkitMigrationFilesystem(tree);
1119
+ const fs = new apply_import_manager.DevkitMigrationFilesystem(tree);
1113
1120
  checker.setFileSystem(fs);
1114
1121
  const migration = new SignalQueriesMigration({
1115
1122
  bestEffortMode: options.bestEffortMode,
@@ -1141,7 +1148,7 @@ function migrate(options) {
1141
1148
  context.logger.info(``);
1142
1149
  context.logger.info(`Processing analysis data between targets..`);
1143
1150
  context.logger.info(``);
1144
- const combined = await combine_units.synchronouslyCombineUnitData(migration, unitResults);
1151
+ const combined = await apply_import_manager.synchronouslyCombineUnitData(migration, unitResults);
1145
1152
  if (combined === null) {
1146
1153
  context.logger.error('Migration failed unexpectedly with no analysis data');
1147
1154
  return;
@@ -1151,7 +1158,7 @@ function migrate(options) {
1151
1158
  for (const { info, tsconfigPath } of programInfos) {
1152
1159
  context.logger.info(`Migrating: ${tsconfigPath}..`);
1153
1160
  const { replacements } = await migration.migrate(globalMeta, info);
1154
- const changesPerFile = combine_units.groupReplacementsByFile(replacements);
1161
+ const changesPerFile = apply_import_manager.groupReplacementsByFile(replacements);
1155
1162
  for (const [file, changes] of changesPerFile) {
1156
1163
  if (!replacementsPerFile.has(file)) {
1157
1164
  replacementsPerFile.set(file, changes);
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v19.1.0-next.4
3
+ * @license Angular v19.1.0
4
4
  * (c) 2010-2024 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -12,21 +12,22 @@ var schematics = require('@angular-devkit/schematics');
12
12
  var signalQueriesMigration = require('./signal-queries-migration.js');
13
13
  var signalInputMigration = require('./signal-input-migration.js');
14
14
  var outputMigration = require('./output-migration.js');
15
- require('./project_tsconfig_paths-e9ccccbf.js');
15
+ require('./project_tsconfig_paths-6c9cde78.js');
16
16
  require('@angular-devkit/core');
17
- require('./combine_units-4a95b1b9.js');
17
+ require('./apply_import_manager-5082ccea.js');
18
18
  require('node:path/posix');
19
19
  require('os');
20
20
  require('typescript');
21
- require('./checker-884633eb.js');
21
+ require('./checker-aa999c96.js');
22
22
  require('fs');
23
23
  require('module');
24
24
  require('path');
25
25
  require('url');
26
- require('./program-094352ba.js');
27
- require('./migrate_ts_type_references-4b11f3f2.js');
26
+ require('./program-393ca8f3.js');
27
+ require('./migrate_ts_type_references-042ca765.js');
28
28
  require('assert');
29
- require('./leading_space-d190b83b.js');
29
+ require('./index-15b61bae.js');
30
+ require('./leading_space-6e7a8ec6.js');
30
31
 
31
32
  function migrate(options) {
32
33
  // The migrations are independent so we can run them in any order, but we sort them here