@angular/core 22.0.0-next.1 → 22.0.0-next.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (83) hide show
  1. package/fesm2022/_attribute-chunk.mjs +1 -1
  2. package/fesm2022/_attribute-chunk.mjs.map +1 -1
  3. package/fesm2022/_debug_node-chunk.mjs +2440 -2014
  4. package/fesm2022/_debug_node-chunk.mjs.map +1 -1
  5. package/fesm2022/_effect-chunk.mjs +3 -5
  6. package/fesm2022/_effect-chunk.mjs.map +1 -1
  7. package/fesm2022/_not_found-chunk.mjs +1 -1
  8. package/fesm2022/_not_found-chunk.mjs.map +1 -1
  9. package/fesm2022/_pending_tasks-chunk.mjs +145 -44
  10. package/fesm2022/_pending_tasks-chunk.mjs.map +1 -1
  11. package/fesm2022/_resource-chunk.mjs +108 -33
  12. package/fesm2022/_resource-chunk.mjs.map +1 -1
  13. package/fesm2022/_untracked-chunk.mjs +10 -7
  14. package/fesm2022/_untracked-chunk.mjs.map +1 -1
  15. package/fesm2022/_weak_ref-chunk.mjs +1 -1
  16. package/fesm2022/_weak_ref-chunk.mjs.map +1 -1
  17. package/fesm2022/core.mjs +2368 -1892
  18. package/fesm2022/core.mjs.map +1 -1
  19. package/fesm2022/primitives-di.mjs +1 -1
  20. package/fesm2022/primitives-di.mjs.map +1 -1
  21. package/fesm2022/primitives-event-dispatch.mjs +2 -24
  22. package/fesm2022/primitives-event-dispatch.mjs.map +1 -1
  23. package/fesm2022/primitives-signals.mjs +2 -2
  24. package/fesm2022/primitives-signals.mjs.map +1 -1
  25. package/fesm2022/rxjs-interop.mjs +6 -3
  26. package/fesm2022/rxjs-interop.mjs.map +1 -1
  27. package/fesm2022/testing.mjs +56 -25
  28. package/fesm2022/testing.mjs.map +1 -1
  29. package/package.json +7 -3
  30. package/schematics/bundles/apply_import_manager-CxA_YYgB.cjs +1 -1
  31. package/schematics/bundles/can-match-snapshot-required.cjs +104 -0
  32. package/schematics/bundles/change-detection-eager.cjs +1 -1
  33. package/schematics/bundles/cleanup-unused-imports.cjs +1 -1
  34. package/schematics/bundles/common-to-standalone-migration.cjs +1 -1
  35. package/schematics/bundles/compiler_host-CY14HvaP.cjs +1 -1
  36. package/schematics/bundles/control-flow-migration.cjs +1 -1
  37. package/schematics/bundles/http-xhr-backend.cjs +6 -11
  38. package/schematics/bundles/imports-CKV-ITqD.cjs +1 -1
  39. package/schematics/bundles/incremental-hydration.cjs +94 -0
  40. package/schematics/bundles/{index-BtLcQH8g.cjs → index-DcezkXLN.cjs} +10 -3
  41. package/schematics/bundles/inject-migration.cjs +26 -18
  42. package/schematics/bundles/json-file-Drblb4E1.cjs +1916 -0
  43. package/schematics/bundles/leading_space-BTPRV0wu.cjs +1 -1
  44. package/schematics/bundles/{migrate_ts_type_references-MWoZx-Cb.cjs → migrate_ts_type_references-xRTTASnu.cjs} +48 -28
  45. package/schematics/bundles/model-output.cjs +200 -0
  46. package/schematics/bundles/ng_component_template-DPAF1aEA.cjs +1 -1
  47. package/schematics/bundles/ng_decorators-IVztR9rk.cjs +1 -1
  48. package/schematics/bundles/ngclass-to-class-migration.cjs +14 -6
  49. package/schematics/bundles/ngstyle-to-style-migration.cjs +14 -6
  50. package/schematics/bundles/nodes-ZSQ7WZRB.cjs +1 -1
  51. package/schematics/bundles/output-migration.cjs +2 -2
  52. package/schematics/bundles/parse_html-C8eKA9px.cjs +1 -1
  53. package/schematics/bundles/project_paths-D2V-Uh2L.cjs +1 -1
  54. package/schematics/bundles/project_tsconfig_paths-DkkMibv-.cjs +1 -1
  55. package/schematics/bundles/property_name-BCpALNpZ.cjs +1 -1
  56. package/schematics/bundles/route-lazy-loading.cjs +22 -2
  57. package/schematics/bundles/router-testing-module-migration.cjs +1 -1
  58. package/schematics/bundles/safe-optional-chaining.cjs +571 -0
  59. package/schematics/bundles/self-closing-tags-migration.cjs +1 -1
  60. package/schematics/bundles/signal-input-migration.cjs +3 -3
  61. package/schematics/bundles/signal-queries-migration.cjs +3 -3
  62. package/schematics/bundles/signals.cjs +3 -3
  63. package/schematics/bundles/standalone-migration.cjs +29 -17
  64. package/schematics/bundles/strict-safe-navigation-narrow.cjs +32 -0
  65. package/schematics/bundles/strict-templates-default.cjs +63 -0
  66. package/schematics/migrations.json +30 -0
  67. package/third_party/@mcp-b/webmcp-types/LICENSE +21 -0
  68. package/third_party/@mcp-b/webmcp-types/dist/common.d.ts +297 -0
  69. package/third_party/@mcp-b/webmcp-types/dist/json-schema.d.ts +196 -0
  70. package/third_party/@mcp-b/webmcp-types/index.d.ts +9 -0
  71. package/types/_api-chunk.d.ts +44 -17
  72. package/types/_chrome_dev_tools_performance-chunk.d.ts +4 -3
  73. package/types/{_discovery-chunk.d.ts → _debug_node-chunk.d.ts} +2157 -2258
  74. package/types/_effect-chunk.d.ts +1 -1
  75. package/types/_event_dispatcher-chunk.d.ts +1 -1
  76. package/types/_formatter-chunk.d.ts +1 -1
  77. package/types/_weak_ref-chunk.d.ts +1 -1
  78. package/types/core.d.ts +6833 -6485
  79. package/types/primitives-di.d.ts +1 -1
  80. package/types/primitives-event-dispatch.d.ts +1 -1
  81. package/types/primitives-signals.d.ts +1 -1
  82. package/types/rxjs-interop.d.ts +5 -4
  83. package/types/testing.d.ts +6 -6
package/package.json CHANGED
@@ -1,11 +1,11 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "22.0.0-next.1",
3
+ "version": "22.0.0-next.11",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
7
7
  "engines": {
8
- "node": "^22.22.0 || >=24.13.1"
8
+ "node": "^22.22.0 || ^24.13.1 || >=26.0.0"
9
9
  },
10
10
  "exports": {
11
11
  "./schematics/*": {
@@ -45,8 +45,12 @@
45
45
  "dependencies": {
46
46
  "tslib": "^2.3.0"
47
47
  },
48
+ "devDependencies": {
49
+ "@mcp-b/webmcp-polyfill": "^2.2.0",
50
+ "@mcp-b/webmcp-types": "^2.2.0"
51
+ },
48
52
  "peerDependencies": {
49
- "@angular/compiler": "22.0.0-next.1",
53
+ "@angular/compiler": "22.0.0-next.11",
50
54
  "rxjs": "^6.5.3 || ^7.4.0",
51
55
  "zone.js": "~0.15.0 || ~0.16.0"
52
56
  },
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.1
3
+ * @license Angular v22.0.0-next.11
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.11
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.1
3
+ * @license Angular v22.0.0-next.11
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.1
3
+ * @license Angular v22.0.0-next.11
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.1
3
+ * @license Angular v22.0.0-next.11
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.1
3
+ * @license Angular v22.0.0-next.11
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.1
3
+ * @license Angular v22.0.0-next.11
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.1
3
+ * @license Angular v22.0.0-next.11
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.1
3
+ * @license Angular v22.0.0-next.11
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -0,0 +1,94 @@
1
+ 'use strict';
2
+ /**
3
+ * @license Angular v22.0.0-next.11
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
+ let hasNoIncremental = false;
34
+ for (const arg of node.arguments) {
35
+ if (ts.isCallExpression(arg) && ts.isIdentifier(arg.expression)) {
36
+ if (arg.expression.text === 'withIncrementalHydration') {
37
+ hasIncremental = true;
38
+ }
39
+ else if (arg.expression.text === 'withNoIncrementalHydration') {
40
+ hasNoIncremental = true;
41
+ }
42
+ }
43
+ }
44
+ if (!hasIncremental && !hasNoIncremental) {
45
+ // Add withNoIncrementalHydration()
46
+ const withNoIncrementalExpr = importManager.addImport({
47
+ exportModuleSpecifier: '@angular/platform-browser',
48
+ exportSymbolName: 'withNoIncrementalHydration',
49
+ requestedFile: sf,
50
+ });
51
+ const exprText = printer.printNode(ts.EmitHint.Unspecified, withNoIncrementalExpr, sf);
52
+ const insertPos = node.arguments.end;
53
+ const toInsert = node.arguments.length > 0 ? `, ${exprText}()` : `${exprText}()`;
54
+ replacements.push(new project_paths.Replacement(project_paths.projectFile(sf, info), new project_paths.TextUpdate({
55
+ position: insertPos,
56
+ end: insertPos,
57
+ toInsert: toInsert,
58
+ })));
59
+ }
60
+ }
61
+ ts.forEachChild(node, visit);
62
+ });
63
+ }
64
+ apply_import_manager.applyImportManagerChanges(importManager, replacements, sourceFiles, info);
65
+ return project_paths.confirmAsSerializable({
66
+ replacements,
67
+ });
68
+ }
69
+ async combine(unitA, unitB) {
70
+ return project_paths.confirmAsSerializable({
71
+ replacements: [...unitA.replacements, ...unitB.replacements],
72
+ });
73
+ }
74
+ async globalMeta(combinedData) {
75
+ return project_paths.confirmAsSerializable(combinedData);
76
+ }
77
+ async stats(globalMetadata) {
78
+ return project_paths.confirmAsSerializable({});
79
+ }
80
+ async migrate(globalData) {
81
+ return { replacements: globalData.replacements };
82
+ }
83
+ }
84
+
85
+ function migrate() {
86
+ return async (tree, context) => {
87
+ await project_paths.runMigrationInDevkit({
88
+ tree,
89
+ getMigration: (fs) => new IncrementalHydrationMigration(),
90
+ });
91
+ };
92
+ }
93
+
94
+ exports.migrate = migrate;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.1
3
+ * @license Angular v22.0.0-next.11
4
4
  * (c) 2010-2026 Google LLC. https://angular.dev/
5
5
  * License: MIT
6
6
  */
@@ -308,6 +308,9 @@ class TemplateReferenceVisitor extends compiler.TmplAstRecursiveVisitor {
308
308
  this.templateAttributeReferencedFields.push(...referencedFields);
309
309
  }
310
310
  }
311
+ visitLetDeclaration(decl) {
312
+ this.checkExpressionForReferencedFields(decl, decl.value);
313
+ }
311
314
  }
312
315
  /**
313
316
  * Expression AST visitor that checks whether a given expression references
@@ -402,13 +405,17 @@ class TemplateExpressionReferenceVisitor extends compiler.RecursiveAstVisitor {
402
405
  return false;
403
406
  }
404
407
  const symbol = this.templateTypeChecker.getSymbolOfNode(ast, this.componentClass);
405
- if (symbol?.kind !== migrations.SymbolKind.Expression || symbol.tsSymbol === null) {
408
+ if (symbol?.kind !== migrations.SymbolKind.Expression) {
409
+ return false;
410
+ }
411
+ const tsSymbol = this.templateTypeChecker.getTsSymbolOfSymbol(symbol);
412
+ if (tsSymbol === null) {
406
413
  return false;
407
414
  }
408
415
  // Dangerous: Type checking symbol retrieval is a totally different `ts.Program`,
409
416
  // than the one where we analyzed `knownInputs`.
410
417
  // --> Find the input via its input id.
411
- const targetInput = this.knownFields.attemptRetrieveDescriptorFromSymbol(symbol.tsSymbol);
418
+ const targetInput = this.knownFields.attemptRetrieveDescriptorFromSymbol(tsSymbol);
412
419
  if (targetInput === null) {
413
420
  return false;
414
421
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v22.0.0-next.1
3
+ * @license Angular v22.0.0-next.11
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;