@angular/core 22.0.0-next.0 → 22.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 (77) hide show
  1. package/fesm2022/_attribute-chunk.mjs +1 -1
  2. package/fesm2022/_debug_node-chunk.mjs +2425 -1941
  3. package/fesm2022/_debug_node-chunk.mjs.map +1 -1
  4. package/fesm2022/_effect-chunk.mjs +3 -5
  5. package/fesm2022/_effect-chunk.mjs.map +1 -1
  6. package/fesm2022/_not_found-chunk.mjs +1 -1
  7. package/fesm2022/_not_found-chunk.mjs.map +1 -1
  8. package/fesm2022/_pending_tasks-chunk.mjs +47 -44
  9. package/fesm2022/_pending_tasks-chunk.mjs.map +1 -1
  10. package/fesm2022/_resource-chunk.mjs +55 -18
  11. package/fesm2022/_resource-chunk.mjs.map +1 -1
  12. package/fesm2022/_untracked-chunk.mjs +10 -7
  13. package/fesm2022/_untracked-chunk.mjs.map +1 -1
  14. package/fesm2022/_weak_ref-chunk.mjs +1 -1
  15. package/fesm2022/_weak_ref-chunk.mjs.map +1 -1
  16. package/fesm2022/core.mjs +2332 -1884
  17. package/fesm2022/core.mjs.map +1 -1
  18. package/fesm2022/primitives-di.mjs +1 -1
  19. package/fesm2022/primitives-di.mjs.map +1 -1
  20. package/fesm2022/primitives-event-dispatch.mjs +2 -24
  21. package/fesm2022/primitives-event-dispatch.mjs.map +1 -1
  22. package/fesm2022/primitives-signals.mjs +2 -2
  23. package/fesm2022/primitives-signals.mjs.map +1 -1
  24. package/fesm2022/rxjs-interop.mjs +6 -3
  25. package/fesm2022/rxjs-interop.mjs.map +1 -1
  26. package/fesm2022/testing.mjs +56 -25
  27. package/fesm2022/testing.mjs.map +1 -1
  28. package/package.json +2 -2
  29. package/schematics/bundles/apply_import_manager-CxA_YYgB.cjs +1 -1
  30. package/schematics/bundles/can-match-snapshot-required.cjs +104 -0
  31. package/schematics/bundles/change-detection-eager.cjs +4 -7
  32. package/schematics/bundles/cleanup-unused-imports.cjs +1 -1
  33. package/schematics/bundles/common-to-standalone-migration.cjs +1 -1
  34. package/schematics/bundles/compiler_host-CY14HvaP.cjs +1 -1
  35. package/schematics/bundles/control-flow-migration.cjs +1 -1
  36. package/schematics/bundles/http-xhr-backend.cjs +6 -11
  37. package/schematics/bundles/imports-CKV-ITqD.cjs +1 -1
  38. package/schematics/bundles/incremental-hydration.cjs +91 -0
  39. package/schematics/bundles/{index-BtLcQH8g.cjs → index-DADA7AvC.cjs} +7 -3
  40. package/schematics/bundles/inject-migration.cjs +26 -18
  41. package/schematics/bundles/json-file-Drblb4E1.cjs +1916 -0
  42. package/schematics/bundles/leading_space-BTPRV0wu.cjs +1 -1
  43. package/schematics/bundles/{migrate_ts_type_references-MWoZx-Cb.cjs → migrate_ts_type_references-CdaIOlGY.cjs} +48 -28
  44. package/schematics/bundles/model-output.cjs +200 -0
  45. package/schematics/bundles/ng_component_template-DPAF1aEA.cjs +1 -1
  46. package/schematics/bundles/ng_decorators-IVztR9rk.cjs +1 -1
  47. package/schematics/bundles/ngclass-to-class-migration.cjs +14 -6
  48. package/schematics/bundles/ngstyle-to-style-migration.cjs +14 -6
  49. package/schematics/bundles/nodes-ZSQ7WZRB.cjs +1 -1
  50. package/schematics/bundles/output-migration.cjs +2 -2
  51. package/schematics/bundles/parse_html-C8eKA9px.cjs +1 -1
  52. package/schematics/bundles/project_paths-D2V-Uh2L.cjs +1 -1
  53. package/schematics/bundles/project_tsconfig_paths-DkkMibv-.cjs +1 -1
  54. package/schematics/bundles/property_name-BCpALNpZ.cjs +1 -1
  55. package/schematics/bundles/route-lazy-loading.cjs +22 -2
  56. package/schematics/bundles/router-testing-module-migration.cjs +1 -1
  57. package/schematics/bundles/self-closing-tags-migration.cjs +1 -1
  58. package/schematics/bundles/signal-input-migration.cjs +3 -3
  59. package/schematics/bundles/signal-queries-migration.cjs +3 -3
  60. package/schematics/bundles/signals.cjs +3 -3
  61. package/schematics/bundles/standalone-migration.cjs +29 -17
  62. package/schematics/bundles/strict-safe-navigation-narrow.cjs +32 -0
  63. package/schematics/bundles/strict-templates-default.cjs +63 -0
  64. package/schematics/migrations.json +25 -0
  65. package/types/_api-chunk.d.ts +22 -4
  66. package/types/_chrome_dev_tools_performance-chunk.d.ts +4 -3
  67. package/types/{_discovery-chunk.d.ts → _debug_node-chunk.d.ts} +2157 -2258
  68. package/types/_effect-chunk.d.ts +1 -1
  69. package/types/_event_dispatcher-chunk.d.ts +1 -1
  70. package/types/_formatter-chunk.d.ts +1 -1
  71. package/types/_weak_ref-chunk.d.ts +1 -1
  72. package/types/core.d.ts +6488 -6285
  73. package/types/primitives-di.d.ts +1 -1
  74. package/types/primitives-event-dispatch.d.ts +1 -1
  75. package/types/primitives-signals.d.ts +1 -1
  76. package/types/rxjs-interop.d.ts +2 -1
  77. package/types/testing.d.ts +6 -6
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "22.0.0-next.0",
3
+ "version": "22.0.0-next.10",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -46,7 +46,7 @@
46
46
  "tslib": "^2.3.0"
47
47
  },
48
48
  "peerDependencies": {
49
- "@angular/compiler": "22.0.0-next.0",
49
+ "@angular/compiler": "22.0.0-next.10",
50
50
  "rxjs": "^6.5.3 || ^7.4.0",
51
51
  "zone.js": "~0.15.0 || ~0.16.0"
52
52
  },
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.0
3
+ * @license Angular v22.0.0-next.10
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -0,0 +1,104 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v22.0.0-next.10
4
+ * (c) 2010-2026 Google LLC. https://angular.dev/
5
+ * License: MIT
6
+ */
7
+ 'use strict';
8
+
9
+ require('@angular-devkit/core');
10
+ require('node:path/posix');
11
+ var project_paths = require('./project_paths-D2V-Uh2L.cjs');
12
+ var ts = require('typescript');
13
+ require('@angular/compiler-cli');
14
+ require('@angular/compiler-cli/private/migrations');
15
+ require('node:path');
16
+ require('@angular-devkit/schematics');
17
+ require('./project_tsconfig_paths-DkkMibv-.cjs');
18
+
19
+ class CanMatchSnapshotRequiredMigration extends project_paths.TsurgeFunnelMigration {
20
+ async analyze(info) {
21
+ const replacements = [];
22
+ const { sourceFiles, program } = info;
23
+ const typeChecker = program.getTypeChecker();
24
+ for (const sourceFile of sourceFiles) {
25
+ const walk = (node) => {
26
+ ts.forEachChild(node, walk);
27
+ if (ts.isCallExpression(node)) {
28
+ let shouldMigrate = false;
29
+ // 1. Method calls objective: obj.canMatch(a, b)
30
+ if (ts.isPropertyAccessExpression(node.expression) &&
31
+ node.expression.name.text === 'canMatch') {
32
+ const type = typeChecker.getTypeAtLocation(node.expression.expression);
33
+ const classSymbol = type.getSymbol();
34
+ if (classSymbol && classSymbol.declarations) {
35
+ const decl = classSymbol.declarations[0];
36
+ if (ts.isClassDeclaration(decl)) {
37
+ if (implementsInterface(decl, 'CanMatch')) {
38
+ shouldMigrate = true;
39
+ }
40
+ }
41
+ }
42
+ }
43
+ // 2. Function calls objective: canMatch(a, b)
44
+ if (ts.isIdentifier(node.expression) && node.expression.text === 'canMatch') {
45
+ const type = typeChecker.getTypeAtLocation(node.expression);
46
+ const typeStr = typeChecker.typeToString(type);
47
+ if (typeStr.includes('CanMatchFn')) {
48
+ shouldMigrate = true;
49
+ }
50
+ }
51
+ if (shouldMigrate && node.arguments.length === 2) {
52
+ const lastArg = node.arguments[1];
53
+ replacements.push(new project_paths.Replacement(project_paths.projectFile(sourceFile, info), new project_paths.TextUpdate({
54
+ position: lastArg.getEnd(),
55
+ end: lastArg.getEnd(),
56
+ toInsert: ', {} as any /* added by migration */',
57
+ })));
58
+ }
59
+ }
60
+ };
61
+ ts.forEachChild(sourceFile, walk);
62
+ }
63
+ return project_paths.confirmAsSerializable({ replacements });
64
+ }
65
+ async combine(unitA, unitB) {
66
+ return project_paths.confirmAsSerializable({
67
+ replacements: [...unitA.replacements, ...unitB.replacements],
68
+ });
69
+ }
70
+ async globalMeta(combinedData) {
71
+ return project_paths.confirmAsSerializable(combinedData);
72
+ }
73
+ async stats(globalMetadata) {
74
+ return project_paths.confirmAsSerializable({});
75
+ }
76
+ async migrate(globalData) {
77
+ return { replacements: globalData.replacements };
78
+ }
79
+ }
80
+ function implementsInterface(decl, interfaceName) {
81
+ if (!decl.heritageClauses)
82
+ return false;
83
+ for (const clause of decl.heritageClauses) {
84
+ if (clause.token === ts.SyntaxKind.ImplementsKeyword) {
85
+ for (const expr of clause.types) {
86
+ if (ts.isIdentifier(expr.expression) && expr.expression.text === interfaceName) {
87
+ return true;
88
+ }
89
+ }
90
+ }
91
+ }
92
+ return false;
93
+ }
94
+
95
+ function migrate(options) {
96
+ return async (tree, context) => {
97
+ await project_paths.runMigrationInDevkit({
98
+ tree,
99
+ getMigration: (fs) => new CanMatchSnapshotRequiredMigration(),
100
+ });
101
+ };
102
+ }
103
+
104
+ exports.migrate = migrate;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.0
3
+ * @license Angular v22.0.0-next.10
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -15,6 +15,7 @@ var ng_decorators = require('./ng_decorators-IVztR9rk.cjs');
15
15
  require('@angular/compiler-cli');
16
16
  require('node:path');
17
17
  var apply_import_manager = require('./apply_import_manager-CxA_YYgB.cjs');
18
+ var leading_space = require('./leading_space-BTPRV0wu.cjs');
18
19
  require('@angular-devkit/schematics');
19
20
  require('./project_tsconfig_paths-DkkMibv-.cjs');
20
21
  require('./imports-CKV-ITqD.cjs');
@@ -70,12 +71,8 @@ class ChangeDetectionEagerMigration extends project_paths.TsurgeFunnelMigration
70
71
  let toInsert;
71
72
  if (properties.length > 0) {
72
73
  const lastProp = properties[properties.length - 1];
73
- insertPos = lastProp.getEnd();
74
- // Simpler approach: check comma after last property.
75
- const textAfter = sf.text.substring(lastProp.getEnd());
76
- const hasComma = /^\s*,/.test(textAfter);
77
- const prefix = hasComma ? '' : ',';
78
- toInsert = `${prefix}\n changeDetection: ${exprText}.Eager`;
74
+ insertPos = lastProp.getStart();
75
+ toInsert = `changeDetection: ${exprText}.Eager,\n${leading_space.getLeadingLineWhitespaceOfNode(lastProp)}`;
79
76
  }
80
77
  else {
81
78
  insertPos = metadata.getStart() + 1;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.0
3
+ * @license Angular v22.0.0-next.10
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.0
3
+ * @license Angular v22.0.0-next.10
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.0
3
+ * @license Angular v22.0.0-next.10
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.0
3
+ * @license Angular v22.0.0-next.10
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.0
3
+ * @license Angular v22.0.0-next.10
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -23,7 +23,11 @@ const provideHttpClient = 'provideHttpClient';
23
23
  const WITH_FETCH = 'withFetch';
24
24
  const WITH_XHR = 'withXhr';
25
25
  const HTTP_PACKAGE = '@angular/common/http';
26
- ts.factory.createIdentifier('provideHttpClient');
26
+ /**
27
+ * Prior to v22, provideHttpClient() had a Xhr backend by default. In v22, the default was switched to a Fetch backend.
28
+ * This migration adds the withXhr() option to any provideHttpClient() calls that do not already have either withFetch() or withXhr() specified,
29
+ * to preserve the Xhr backend behavior.
30
+ */
27
31
  class XhrBackendMigration extends project_paths.TsurgeFunnelMigration {
28
32
  config;
29
33
  constructor(config = {}) {
@@ -76,15 +80,6 @@ class XhrBackendMigration extends project_paths.TsurgeFunnelMigration {
76
80
  requestedFile: sourceFile,
77
81
  });
78
82
  }
79
- else if (withFetchNode) {
80
- const isLastArg = node.arguments[node.arguments.length - 1] === withFetchNode;
81
- replacements.push(new project_paths.Replacement(project_paths.projectFile(sourceFile, info), new project_paths.TextUpdate({
82
- position: withFetchNode.getStart(),
83
- end: isLastArg ? withFetchNode.getEnd() : withFetchNode.getEnd() + 2, // +2 to remove the comma and space, could be improved
84
- toInsert: '',
85
- })));
86
- importManager.removeImport(sourceFile, 'withFetch', HTTP_PACKAGE);
87
- }
88
83
  };
89
84
  sourceFile.forEachChild(walk);
90
85
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.0
3
+ * @license Angular v22.0.0-next.10
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -0,0 +1,91 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v22.0.0-next.10
4
+ * (c) 2010-2026 Google LLC. https://angular.dev/
5
+ * License: MIT
6
+ */
7
+ 'use strict';
8
+
9
+ require('@angular-devkit/core');
10
+ require('node:path/posix');
11
+ var project_paths = require('./project_paths-D2V-Uh2L.cjs');
12
+ var migrations = require('@angular/compiler-cli/private/migrations');
13
+ var ts = require('typescript');
14
+ require('@angular/compiler-cli');
15
+ require('node:path');
16
+ var apply_import_manager = require('./apply_import_manager-CxA_YYgB.cjs');
17
+ require('@angular-devkit/schematics');
18
+ require('./project_tsconfig_paths-DkkMibv-.cjs');
19
+
20
+ class IncrementalHydrationMigration extends project_paths.TsurgeFunnelMigration {
21
+ async analyze(info) {
22
+ const { sourceFiles, program } = info;
23
+ program.getTypeChecker();
24
+ const replacements = [];
25
+ const importManager = new migrations.ImportManager();
26
+ const printer = ts.createPrinter();
27
+ for (const sf of sourceFiles) {
28
+ ts.forEachChild(sf, function visit(node) {
29
+ if (ts.isCallExpression(node) &&
30
+ ts.isIdentifier(node.expression) &&
31
+ node.expression.text === 'provideClientHydration') {
32
+ let hasIncremental = false;
33
+ for (const arg of node.arguments) {
34
+ if (ts.isCallExpression(arg) &&
35
+ ts.isIdentifier(arg.expression) &&
36
+ arg.expression.text === 'withIncrementalHydration') {
37
+ hasIncremental = true;
38
+ break;
39
+ }
40
+ }
41
+ if (!hasIncremental) {
42
+ // Add withNoIncrementalHydration()
43
+ const withNoIncrementalExpr = importManager.addImport({
44
+ exportModuleSpecifier: '@angular/platform-browser',
45
+ exportSymbolName: 'withNoIncrementalHydration',
46
+ requestedFile: sf,
47
+ });
48
+ const exprText = printer.printNode(ts.EmitHint.Unspecified, withNoIncrementalExpr, sf);
49
+ const insertPos = node.arguments.end;
50
+ const toInsert = node.arguments.length > 0 ? `, ${exprText}()` : `${exprText}()`;
51
+ replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
52
+ position: insertPos,
53
+ end: insertPos,
54
+ toInsert: toInsert,
55
+ })));
56
+ }
57
+ }
58
+ ts.forEachChild(node, visit);
59
+ });
60
+ }
61
+ apply_import_manager.applyImportManagerChanges(importManager, replacements, sourceFiles, info);
62
+ return project_paths.confirmAsSerializable({
63
+ replacements,
64
+ });
65
+ }
66
+ async combine(unitA, unitB) {
67
+ return project_paths.confirmAsSerializable({
68
+ replacements: [...unitA.replacements, ...unitB.replacements],
69
+ });
70
+ }
71
+ async globalMeta(combinedData) {
72
+ return project_paths.confirmAsSerializable(combinedData);
73
+ }
74
+ async stats(globalMetadata) {
75
+ return project_paths.confirmAsSerializable({});
76
+ }
77
+ async migrate(globalData) {
78
+ return { replacements: globalData.replacements };
79
+ }
80
+ }
81
+
82
+ function migrate() {
83
+ return async (tree, context) => {
84
+ await project_paths.runMigrationInDevkit({
85
+ tree,
86
+ getMigration: (fs) => new IncrementalHydrationMigration(),
87
+ });
88
+ };
89
+ }
90
+
91
+ exports.migrate = migrate;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.0
3
+ * @license Angular v22.0.0-next.10
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -402,13 +402,17 @@ class TemplateExpressionReferenceVisitor extends compiler.RecursiveAstVisitor {
402
402
  return false;
403
403
  }
404
404
  const symbol = this.templateTypeChecker.getSymbolOfNode(ast, this.componentClass);
405
- if (symbol?.kind !== migrations.SymbolKind.Expression || symbol.tsSymbol === null) {
405
+ if (symbol?.kind !== migrations.SymbolKind.Expression) {
406
+ return false;
407
+ }
408
+ const tsSymbol = this.templateTypeChecker.getTsSymbolOfSymbol(symbol);
409
+ if (tsSymbol === null) {
406
410
  return false;
407
411
  }
408
412
  // Dangerous: Type checking symbol retrieval is a totally different `ts.Program`,
409
413
  // than the one where we analyzed `knownInputs`.
410
414
  // --> Find the input via its input id.
411
- const targetInput = this.knownFields.attemptRetrieveDescriptorFromSymbol(symbol.tsSymbol);
415
+ const targetInput = this.knownFields.attemptRetrieveDescriptorFromSymbol(tsSymbol);
412
416
  if (targetInput === null) {
413
417
  return false;
414
418
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.0
3
+ * @license Angular v22.0.0-next.10
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -1321,31 +1321,37 @@ function isStringType(node, checker) {
1321
1321
  }
1322
1322
 
1323
1323
  function migrate(options) {
1324
- return async (tree) => {
1325
- const { buildPaths, testPaths } = await project_tsconfig_paths.getProjectTsConfigPaths(tree);
1324
+ return async (tree, context) => {
1326
1325
  const basePath = process.cwd();
1326
+ let pathToMigrate;
1327
+ if (options.path) {
1328
+ if (options.path.startsWith('..')) {
1329
+ throw new schematics.SchematicsException('Cannot run inject migration outside of the current project.');
1330
+ }
1331
+ pathToMigrate = compiler_host.normalizePath(path.join(basePath, options.path));
1332
+ }
1333
+ const { buildPaths, testPaths } = await project_tsconfig_paths.getProjectTsConfigPaths(tree);
1327
1334
  const allPaths = [...buildPaths, ...testPaths];
1328
- const pathToMigrate = compiler_host.normalizePath(path.join(basePath, options.path));
1329
1335
  if (!allPaths.length) {
1330
- throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run the inject migration.');
1336
+ context.logger.warn('Could not find any tsconfig file. Cannot run the inject migration.');
1337
+ return;
1331
1338
  }
1339
+ let sourceFilesCount = 0;
1332
1340
  for (const tsconfigPath of allPaths) {
1333
- runInjectMigration(tree, tsconfigPath, basePath, pathToMigrate, options);
1341
+ const program = compiler_host.createMigrationProgram(tree, tsconfigPath, basePath);
1342
+ const sourceFiles = program
1343
+ .getSourceFiles()
1344
+ .filter((sourceFile) => (pathToMigrate ? sourceFile.fileName.startsWith(pathToMigrate) : true) &&
1345
+ compiler_host.canMigrateFile(basePath, sourceFile, program));
1346
+ sourceFilesCount += runInjectMigration(tree, sourceFiles, basePath, options);
1347
+ }
1348
+ if (sourceFilesCount === 0) {
1349
+ context.logger.warn('Inject migration did not find any files to migrate');
1334
1350
  }
1335
1351
  };
1336
1352
  }
1337
- function runInjectMigration(tree, tsconfigPath, basePath, pathToMigrate, schematicOptions) {
1338
- if (schematicOptions.path.startsWith('..')) {
1339
- throw new schematics.SchematicsException('Cannot run inject migration outside of the current project.');
1340
- }
1341
- const program = compiler_host.createMigrationProgram(tree, tsconfigPath, basePath);
1342
- const sourceFiles = program
1343
- .getSourceFiles()
1344
- .filter((sourceFile) => sourceFile.fileName.startsWith(pathToMigrate) &&
1345
- compiler_host.canMigrateFile(basePath, sourceFile, program));
1346
- if (sourceFiles.length === 0) {
1347
- throw new schematics.SchematicsException(`Could not find any files to migrate under the path ${pathToMigrate}. Cannot run the inject migration.`);
1348
- }
1353
+ function runInjectMigration(tree, sourceFiles, basePath, schematicOptions) {
1354
+ let migratedFiles = 0;
1349
1355
  for (const sourceFile of sourceFiles) {
1350
1356
  const changes = migrateFile(sourceFile, schematicOptions);
1351
1357
  if (changes.length > 0) {
@@ -1357,8 +1363,10 @@ function runInjectMigration(tree, tsconfigPath, basePath, pathToMigrate, schemat
1357
1363
  update.insertRight(change.start, change.text);
1358
1364
  }
1359
1365
  tree.commitUpdate(update);
1366
+ migratedFiles++;
1360
1367
  }
1361
1368
  }
1369
+ return migratedFiles;
1362
1370
  }
1363
1371
 
1364
1372
  exports.migrate = migrate;