@angular/core 20.2.3 → 21.0.0-next.1

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 (66) hide show
  1. package/api.d.d.ts +1 -1
  2. package/chrome_dev_tools_performance.d.d.ts +2 -17
  3. package/discovery.d.d.ts +25 -27
  4. package/effect.d.d.ts +1 -1
  5. package/event_dispatcher.d.d.ts +1 -1
  6. package/fesm2022/attribute.mjs +1 -1
  7. package/fesm2022/core.mjs +19 -14
  8. package/fesm2022/core.mjs.map +1 -1
  9. package/fesm2022/debug_node.mjs +48 -50
  10. package/fesm2022/debug_node.mjs.map +1 -1
  11. package/fesm2022/effect.mjs +1 -1
  12. package/fesm2022/not_found.mjs +1 -1
  13. package/fesm2022/primitives/di.mjs +1 -1
  14. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  15. package/fesm2022/primitives/signals.mjs +1 -1
  16. package/fesm2022/resource.mjs +1 -1
  17. package/fesm2022/root_effect_scheduler.mjs +2 -8
  18. package/fesm2022/root_effect_scheduler.mjs.map +1 -1
  19. package/fesm2022/rxjs-interop.mjs +2 -2
  20. package/fesm2022/rxjs-interop.mjs.map +1 -1
  21. package/fesm2022/signal.mjs +1 -1
  22. package/fesm2022/testing.mjs +6 -4
  23. package/fesm2022/testing.mjs.map +1 -1
  24. package/fesm2022/weak_ref.mjs +1 -1
  25. package/graph.d.d.ts +1 -1
  26. package/index.d.ts +6 -13
  27. package/package.json +2 -2
  28. package/primitives/di/index.d.ts +1 -1
  29. package/primitives/event-dispatch/index.d.ts +1 -1
  30. package/primitives/signals/index.d.ts +1 -1
  31. package/rxjs-interop/index.d.ts +1 -1
  32. package/schematics/bundles/{apply_import_manager-BTXb3nRr.cjs → apply_import_manager-yycO3l8f.cjs} +3 -3
  33. package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
  34. package/schematics/bundles/{compiler_host-Btt7nH4b.cjs → compiler_host-DrXTGf_7.cjs} +2 -2
  35. package/schematics/bundles/control-flow-migration.cjs +19 -48
  36. package/schematics/bundles/{imports-CIX-JgAN.cjs → imports-26VeX8i-.cjs} +2 -1
  37. package/schematics/bundles/{index-rL7rOVXa.cjs → index-BdH2rlWJ.cjs} +4 -4
  38. package/schematics/bundles/{index-CAfBb4YL.cjs → index-jjHOgYYs.cjs} +28 -14
  39. package/schematics/bundles/inject-migration.cjs +5 -5
  40. package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
  41. package/schematics/bundles/{migrate_ts_type_references-Dyjkgb1x.cjs → migrate_ts_type_references-BVSg43hf.cjs} +9 -10
  42. package/schematics/bundles/ng_component_template-DjLc4mdL.cjs +186 -0
  43. package/schematics/bundles/{ng_decorators-B5HCqr20.cjs → ng_decorators-CtYwz9Lw.cjs} +2 -2
  44. package/schematics/bundles/ngclass-to-class-migration.cjs +533 -0
  45. package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
  46. package/schematics/bundles/output-migration.cjs +6 -6
  47. package/schematics/bundles/parse_html-CXR8hziE.cjs +41 -0
  48. package/schematics/bundles/{project_paths-BUuKobrE.cjs → project_paths-T_M15e2g.cjs} +3 -3
  49. package/schematics/bundles/{project_tsconfig_paths-x7xrmbI9.cjs → project_tsconfig_paths-D7xzGqRi.cjs} +8 -5
  50. package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
  51. package/schematics/bundles/route-lazy-loading.cjs +3 -3
  52. package/schematics/bundles/router-current-navigation.cjs +5 -5
  53. package/schematics/bundles/{test-bed-get.cjs → router-last-successful-navigation.cjs} +30 -14
  54. package/schematics/bundles/self-closing-tags-migration.cjs +11 -207
  55. package/schematics/bundles/signal-input-migration.cjs +12 -13
  56. package/schematics/bundles/signal-queries-migration.cjs +7 -8
  57. package/schematics/bundles/signals.cjs +7 -8
  58. package/schematics/bundles/standalone-migration.cjs +6 -6
  59. package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
  60. package/schematics/collection.json +6 -0
  61. package/schematics/migrations/ngclass-to-class-migration/schema.json +20 -0
  62. package/schematics/migrations.json +7 -17
  63. package/testing/index.d.ts +1 -1
  64. package/weak_ref.d.d.ts +1 -1
  65. package/schematics/bundles/document-core.cjs +0 -95
  66. package/schematics/bundles/inject-flags.cjs +0 -147
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -452,6 +452,7 @@ exports.ViewEncapsulation = void 0;
452
452
  // Historically the 1 value was for `Native` encapsulation which has been removed as of v11.
453
453
  ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
454
454
  ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
455
+ ViewEncapsulation[ViewEncapsulation["IsolatedShadowDom"] = 4] = "IsolatedShadowDom";
455
456
  })(exports.ViewEncapsulation || (exports.ViewEncapsulation = {}));
456
457
  exports.ChangeDetectionStrategy = void 0;
457
458
  (function (ChangeDetectionStrategy) {
@@ -545,6 +546,7 @@ var ViewEncapsulation;
545
546
  // Historically the 1 value was for `Native` encapsulation which has been removed as of v11.
546
547
  ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
547
548
  ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
549
+ ViewEncapsulation[ViewEncapsulation["IsolatedShadowDom"] = 4] = "IsolatedShadowDom";
548
550
  })(ViewEncapsulation || (ViewEncapsulation = {}));
549
551
 
550
552
  /**
@@ -27968,7 +27970,7 @@ class BindingParser {
27968
27970
  if (isLegacyAnimationProp) {
27969
27971
  this._parseLegacyAnimation(name, expression, sourceSpan, absoluteOffset, keySpan, valueSpan, targetMatchableAttrs, targetProps);
27970
27972
  }
27971
- else if (name.startsWith(`${ANIMATE_PREFIX}${PROPERTY_PARTS_SEPARATOR}`)) {
27973
+ else if (name.startsWith(ANIMATE_PREFIX)) {
27972
27974
  this._parseAnimation(name, this.parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
27973
27975
  }
27974
27976
  else {
@@ -28131,7 +28133,7 @@ class BindingParser {
28131
28133
  if (isAssignmentEvent) {
28132
28134
  eventType = exports.ParsedEventType.TwoWay;
28133
28135
  }
28134
- if (name.startsWith(`${ANIMATE_PREFIX}${PROPERTY_PARTS_SEPARATOR}`)) {
28136
+ if (name.startsWith(ANIMATE_PREFIX)) {
28135
28137
  eventType = exports.ParsedEventType.Animation;
28136
28138
  }
28137
28139
  targetEvents.push(new ParsedEvent(eventName, target, eventType, ast, sourceSpan, handlerSpan, keySpan));
@@ -32838,7 +32840,7 @@ function isAttrNode(ast) {
32838
32840
  * @description
32839
32841
  * Entry point for all public APIs of the compiler package.
32840
32842
  */
32841
- new Version('20.2.3');
32843
+ new Version('21.0.0-next.1');
32842
32844
 
32843
32845
  //////////////////////////////////////
32844
32846
  // THIS FILE HAS GLOBAL SIDE EFFECT //
@@ -33020,6 +33022,7 @@ exports.ErrorCode = void 0;
33020
33022
  ErrorCode[ErrorCode["CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES"] = 4003] = "CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES";
33021
33023
  ErrorCode[ErrorCode["CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL"] = 4004] = "CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL";
33022
33024
  ErrorCode[ErrorCode["CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK"] = 4005] = "CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK";
33025
+ ErrorCode[ErrorCode["CONFIG_EMIT_DECLARATION_ONLY_UNSUPPORTED"] = 4006] = "CONFIG_EMIT_DECLARATION_ONLY_UNSUPPORTED";
33023
33026
  /**
33024
33027
  * Raised when a host expression has a parse error, such as a host listener or host binding
33025
33028
  * expression containing a pipe.
@@ -33873,7 +33876,7 @@ class NodeJSPathManipulation {
33873
33876
  // G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
33874
33877
  // CommonJS/ESM interop for determining the current file name and containing dir.
33875
33878
  const isCommonJS = typeof __filename !== 'undefined';
33876
- const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('project_tsconfig_paths-x7xrmbI9.cjs', document.baseURI).href));
33879
+ const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('project_tsconfig_paths-D7xzGqRi.cjs', document.baseURI).href));
33877
33880
  // Note, when this code loads in the browser, `url` may be an empty `{}` due to the Closure shims.
33878
33881
  const currentFileName = isCommonJS
33879
33882
  ? __filename
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -9,8 +9,8 @@
9
9
  var schematics = require('@angular-devkit/schematics');
10
10
  var fs = require('fs');
11
11
  var p = require('path');
12
- var compiler_host = require('./compiler_host-Btt7nH4b.cjs');
13
- var project_tsconfig_paths = require('./project_tsconfig_paths-x7xrmbI9.cjs');
12
+ var compiler_host = require('./compiler_host-DrXTGf_7.cjs');
13
+ var project_tsconfig_paths = require('./project_tsconfig_paths-D7xzGqRi.cjs');
14
14
  var ts = require('typescript');
15
15
  var property_name = require('./property_name-BBwFuqMe.cjs');
16
16
  require('os');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -8,12 +8,12 @@
8
8
 
9
9
  var ts = require('typescript');
10
10
  require('os');
11
- require('./project_tsconfig_paths-x7xrmbI9.cjs');
12
- require('./index-CAfBb4YL.cjs');
11
+ require('./project_tsconfig_paths-D7xzGqRi.cjs');
12
+ require('./index-jjHOgYYs.cjs');
13
13
  require('path');
14
14
  require('node:path');
15
- var project_paths = require('./project_paths-BUuKobrE.cjs');
16
- var imports = require('./imports-CIX-JgAN.cjs');
15
+ var project_paths = require('./project_paths-T_M15e2g.cjs');
16
+ var imports = require('./imports-26VeX8i-.cjs');
17
17
  var symbol = require('./symbol-VPWguRxr.cjs');
18
18
  require('@angular-devkit/core');
19
19
  require('node:path/posix');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -8,12 +8,12 @@
8
8
 
9
9
  var ts = require('typescript');
10
10
  require('os');
11
- require('./project_tsconfig_paths-x7xrmbI9.cjs');
12
- require('./index-CAfBb4YL.cjs');
11
+ require('./project_tsconfig_paths-D7xzGqRi.cjs');
12
+ require('./index-jjHOgYYs.cjs');
13
13
  require('path');
14
14
  require('node:path');
15
- var project_paths = require('./project_paths-BUuKobrE.cjs');
16
- var imports = require('./imports-CIX-JgAN.cjs');
15
+ var project_paths = require('./project_paths-T_M15e2g.cjs');
16
+ var imports = require('./imports-26VeX8i-.cjs');
17
17
  var symbol = require('./symbol-VPWguRxr.cjs');
18
18
  require('@angular-devkit/core');
19
19
  require('node:path/posix');
@@ -23,22 +23,21 @@ require('url');
23
23
  require('@angular-devkit/schematics');
24
24
 
25
25
  /** Name of the method being replaced. */
26
- const METHOD_NAME = 'get';
27
- /** Migration that replaces `TestBed.get` usages with `TestBed.inject`. */
28
- class TestBedGetMigration extends project_paths.TsurgeFunnelMigration {
26
+ const METHOD_NAME = 'lastSuccessfulNavigation';
27
+ /** Migration that replaces `Router.lastSuccessfulNavigation` usages with `Router.lastSuccessfulNavigation()`. */
28
+ class RouterLastSuccessfulNavigationMigration extends project_paths.TsurgeFunnelMigration {
29
29
  async analyze(info) {
30
30
  const locations = [];
31
31
  for (const sourceFile of info.sourceFiles) {
32
- const specifier = imports.getImportSpecifier(sourceFile, '@angular/core/testing', 'TestBed');
33
- if (specifier === null) {
32
+ const routerSpecifier = imports.getImportSpecifier(sourceFile, '@angular/router', 'Router');
33
+ if (routerSpecifier === null) {
34
34
  continue;
35
35
  }
36
36
  const typeChecker = info.program.getTypeChecker();
37
37
  sourceFile.forEachChild(function walk(node) {
38
38
  if (ts.isPropertyAccessExpression(node) &&
39
39
  node.name.text === METHOD_NAME &&
40
- ts.isIdentifier(node.expression) &&
41
- symbol.isReferenceToImport(typeChecker, node.expression, specifier)) {
40
+ isRouterType(typeChecker, node.expression, routerSpecifier)) {
42
41
  locations.push({ file: project_paths.projectFile(sourceFile, info), position: node.name.getStart() });
43
42
  }
44
43
  else {
@@ -53,7 +52,7 @@ class TestBedGetMigration extends project_paths.TsurgeFunnelMigration {
53
52
  return new project_paths.Replacement(file, new project_paths.TextUpdate({
54
53
  position: position,
55
54
  end: position + METHOD_NAME.length,
56
- toInsert: 'inject',
55
+ toInsert: 'lastSuccessfulNavigation()',
57
56
  }));
58
57
  });
59
58
  return project_paths.confirmAsSerializable({ replacements });
@@ -78,6 +77,23 @@ class TestBedGetMigration extends project_paths.TsurgeFunnelMigration {
78
77
  return project_paths.confirmAsSerializable({});
79
78
  }
80
79
  }
80
+ /**
81
+ * Checks if the given symbol represents a Router type.
82
+ */
83
+ function isRouterType(typeChecker, expression, routerSpecifier) {
84
+ const expressionType = typeChecker.getTypeAtLocation(expression);
85
+ const expressionSymbol = expressionType.getSymbol();
86
+ if (!expressionSymbol) {
87
+ return false;
88
+ }
89
+ const declarations = expressionSymbol.getDeclarations() ?? [];
90
+ for (const declaration of declarations) {
91
+ if (symbol.isReferenceToImport(typeChecker, declaration, routerSpecifier)) {
92
+ return true;
93
+ }
94
+ }
95
+ return declarations.some((decl) => decl === routerSpecifier);
96
+ }
81
97
 
82
98
  /*!
83
99
  * @license
@@ -90,7 +106,7 @@ function migrate() {
90
106
  return async (tree) => {
91
107
  await project_paths.runMigrationInDevkit({
92
108
  tree,
93
- getMigration: () => new TestBedGetMigration(),
109
+ getMigration: () => new RouterLastSuccessfulNavigationMigration(),
94
110
  });
95
111
  };
96
112
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -8,221 +8,25 @@
8
8
 
9
9
  var ts = require('typescript');
10
10
  require('os');
11
- var project_tsconfig_paths = require('./project_tsconfig_paths-x7xrmbI9.cjs');
12
- require('./index-CAfBb4YL.cjs');
11
+ var project_tsconfig_paths = require('./project_tsconfig_paths-D7xzGqRi.cjs');
12
+ require('./index-jjHOgYYs.cjs');
13
13
  require('path');
14
14
  require('node:path');
15
- var project_paths = require('./project_paths-BUuKobrE.cjs');
16
- var ng_decorators = require('./ng_decorators-B5HCqr20.cjs');
17
- var property_name = require('./property_name-BBwFuqMe.cjs');
15
+ var project_paths = require('./project_paths-T_M15e2g.cjs');
16
+ var ng_component_template = require('./ng_component_template-DjLc4mdL.cjs');
17
+ var parse_html = require('./parse_html-CXR8hziE.cjs');
18
18
  require('@angular-devkit/core');
19
19
  require('node:path/posix');
20
20
  require('fs');
21
21
  require('module');
22
22
  require('url');
23
23
  require('@angular-devkit/schematics');
24
- require('./imports-CIX-JgAN.cjs');
25
-
26
- /**
27
- * Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
28
- * parentheses or as expression. e.g. "(((({exp}))))()". The function should return the
29
- * TypeScript node referring to the inner expression. e.g "exp".
30
- */
31
- function unwrapExpression(node) {
32
- if (ts.isParenthesizedExpression(node) || ts.isAsExpression(node)) {
33
- return unwrapExpression(node.expression);
34
- }
35
- else {
36
- return node;
37
- }
38
- }
39
-
40
- /** Extracts `@Directive` or `@Component` metadata from the given class. */
41
- function extractAngularClassMetadata(typeChecker, node) {
42
- const decorators = ts.getDecorators(node);
43
- if (!decorators || !decorators.length) {
44
- return null;
45
- }
46
- const ngDecorators = ng_decorators.getAngularDecorators(typeChecker, decorators);
47
- const componentDecorator = ngDecorators.find((dec) => dec.name === 'Component');
48
- const directiveDecorator = ngDecorators.find((dec) => dec.name === 'Directive');
49
- const decorator = componentDecorator ?? directiveDecorator;
50
- // In case no decorator could be found on the current class, skip.
51
- if (!decorator) {
52
- return null;
53
- }
54
- const decoratorCall = decorator.node.expression;
55
- // In case the decorator call is not valid, skip this class declaration.
56
- if (decoratorCall.arguments.length !== 1) {
57
- return null;
58
- }
59
- const metadata = unwrapExpression(decoratorCall.arguments[0]);
60
- // Ensure that the metadata is an object literal expression.
61
- if (!ts.isObjectLiteralExpression(metadata)) {
62
- return null;
63
- }
64
- return {
65
- type: componentDecorator ? 'component' : 'directive',
66
- node: metadata,
67
- };
68
- }
69
-
70
- const LF_CHAR = 10;
71
- const CR_CHAR = 13;
72
- const LINE_SEP_CHAR = 8232;
73
- const PARAGRAPH_CHAR = 8233;
74
- /** Gets the line and character for the given position from the line starts map. */
75
- function getLineAndCharacterFromPosition(lineStartsMap, position) {
76
- const lineIndex = findClosestLineStartPosition(lineStartsMap, position);
77
- return { character: position - lineStartsMap[lineIndex], line: lineIndex };
78
- }
79
- /**
80
- * Computes the line start map of the given text. This can be used in order to
81
- * retrieve the line and character of a given text position index.
82
- */
83
- function computeLineStartsMap(text) {
84
- const result = [0];
85
- let pos = 0;
86
- while (pos < text.length) {
87
- const char = text.charCodeAt(pos++);
88
- // Handles the "CRLF" line break. In that case we peek the character
89
- // after the "CR" and check if it is a line feed.
90
- if (char === CR_CHAR) {
91
- if (text.charCodeAt(pos) === LF_CHAR) {
92
- pos++;
93
- }
94
- result.push(pos);
95
- }
96
- else if (char === LF_CHAR || char === LINE_SEP_CHAR || char === PARAGRAPH_CHAR) {
97
- result.push(pos);
98
- }
99
- }
100
- result.push(pos);
101
- return result;
102
- }
103
- /** Finds the closest line start for the given position. */
104
- function findClosestLineStartPosition(linesMap, position, low = 0, high = linesMap.length - 1) {
105
- while (low <= high) {
106
- const pivotIdx = Math.floor((low + high) / 2);
107
- const pivotEl = linesMap[pivotIdx];
108
- if (pivotEl === position) {
109
- return pivotIdx;
110
- }
111
- else if (position > pivotEl) {
112
- low = pivotIdx + 1;
113
- }
114
- else {
115
- high = pivotIdx - 1;
116
- }
117
- }
118
- // In case there was no exact match, return the closest "lower" line index. We also
119
- // subtract the index by one because want the index of the previous line start.
120
- return low - 1;
121
- }
122
-
123
- /**
124
- * Visitor that can be used to determine Angular templates referenced within given
125
- * TypeScript source files (inline templates or external referenced templates)
126
- */
127
- class NgComponentTemplateVisitor {
128
- typeChecker;
129
- resolvedTemplates = [];
130
- fs = project_tsconfig_paths.getFileSystem();
131
- constructor(typeChecker) {
132
- this.typeChecker = typeChecker;
133
- }
134
- visitNode(node) {
135
- if (node.kind === ts.SyntaxKind.ClassDeclaration) {
136
- this.visitClassDeclaration(node);
137
- }
138
- ts.forEachChild(node, (n) => this.visitNode(n));
139
- }
140
- visitClassDeclaration(node) {
141
- const metadata = extractAngularClassMetadata(this.typeChecker, node);
142
- if (metadata === null || metadata.type !== 'component') {
143
- return;
144
- }
145
- const sourceFile = node.getSourceFile();
146
- const sourceFileName = sourceFile.fileName;
147
- // Walk through all component metadata properties and determine the referenced
148
- // HTML templates (either external or inline)
149
- metadata.node.properties.forEach((property) => {
150
- if (!ts.isPropertyAssignment(property)) {
151
- return;
152
- }
153
- const propertyName = property_name.getPropertyNameText(property.name);
154
- // In case there is an inline template specified, ensure that the value is statically
155
- // analyzable by checking if the initializer is a string literal-like node.
156
- if (propertyName === 'template' && ts.isStringLiteralLike(property.initializer)) {
157
- // Need to add an offset of one to the start because the template quotes are
158
- // not part of the template content.
159
- // The `getText()` method gives us the original raw text.
160
- // We could have used the `text` property, but if the template is defined as a backtick
161
- // string then the `text` property contains a "cooked" version of the string. Such cooked
162
- // strings will have converted CRLF characters to only LF. This messes up string
163
- // replacements in template migrations.
164
- // The raw text returned by `getText()` includes the enclosing quotes so we change the
165
- // `content` and `start` values accordingly.
166
- const content = property.initializer.getText().slice(1, -1);
167
- const start = property.initializer.getStart() + 1;
168
- this.resolvedTemplates.push({
169
- filePath: sourceFileName,
170
- container: node,
171
- content,
172
- inline: true,
173
- start: start,
174
- getCharacterAndLineOfPosition: (pos) => ts.getLineAndCharacterOfPosition(sourceFile, pos + start),
175
- });
176
- }
177
- if (propertyName === 'templateUrl' && ts.isStringLiteralLike(property.initializer)) {
178
- const absolutePath = this.fs.resolve(this.fs.dirname(sourceFileName), property.initializer.text);
179
- if (!this.fs.exists(absolutePath)) {
180
- return;
181
- }
182
- const fileContent = this.fs.readFile(absolutePath);
183
- const lineStartsMap = computeLineStartsMap(fileContent);
184
- this.resolvedTemplates.push({
185
- filePath: absolutePath,
186
- container: node,
187
- content: fileContent,
188
- inline: false,
189
- start: 0,
190
- getCharacterAndLineOfPosition: (pos) => getLineAndCharacterFromPosition(lineStartsMap, pos),
191
- });
192
- }
193
- });
194
- }
195
- }
196
-
197
- function parseTemplate(template) {
198
- let parsed;
199
- try {
200
- // Note: we use the HtmlParser here, instead of the `parseTemplate` function, because the
201
- // latter returns an Ivy AST, not an HTML AST. The HTML AST has the advantage of preserving
202
- // interpolated text as text nodes containing a mixture of interpolation tokens and text tokens,
203
- // rather than turning them into `BoundText` nodes like the Ivy AST does. This allows us to
204
- // easily get the text-only ranges without having to reconstruct the original text.
205
- parsed = new project_tsconfig_paths.HtmlParser().parse(template, '', {
206
- // Allows for ICUs to be parsed.
207
- tokenizeExpansionForms: true,
208
- // Explicitly disable blocks so that their characters are treated as plain text.
209
- tokenizeBlocks: true,
210
- preserveLineEndings: true,
211
- });
212
- // Don't migrate invalid templates.
213
- if (parsed.errors && parsed.errors.length > 0) {
214
- const errors = parsed.errors.map((e) => ({ type: 'parse', error: e }));
215
- return { tree: undefined, errors };
216
- }
217
- }
218
- catch (e) {
219
- return { tree: undefined, errors: [{ type: 'parse', error: e }] };
220
- }
221
- return { tree: parsed, errors: [] };
222
- }
24
+ require('./ng_decorators-CtYwz9Lw.cjs');
25
+ require('./imports-26VeX8i-.cjs');
26
+ require('./property_name-BBwFuqMe.cjs');
223
27
 
224
28
  function migrateTemplateToSelfClosingTags(template) {
225
- let parsed = parseTemplate(template);
29
+ let parsed = parse_html.parseTemplate(template);
226
30
  if (parsed.tree === undefined) {
227
31
  return { migrated: template, changed: false, replacementCount: 0 };
228
32
  }
@@ -305,7 +109,7 @@ class SelfClosingTagsMigration extends project_paths.TsurgeFunnelMigration {
305
109
  if (this.config.shouldMigrate && this.config.shouldMigrate(file) === false) {
306
110
  return;
307
111
  }
308
- const templateVisitor = new NgComponentTemplateVisitor(typeChecker);
112
+ const templateVisitor = new ng_component_template.NgComponentTemplateVisitor(typeChecker);
309
113
  templateVisitor.visitNode(node);
310
114
  templateVisitor.resolvedTemplates.forEach((template) => {
311
115
  const { migrated, changed, replacementCount } = migrateTemplateToSelfClosingTags(template.content);
@@ -1,23 +1,22 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
- var migrate_ts_type_references = require('./migrate_ts_type_references-Dyjkgb1x.cjs');
9
+ var migrate_ts_type_references = require('./migrate_ts_type_references-BVSg43hf.cjs');
10
10
  var ts = require('typescript');
11
11
  require('os');
12
- var project_tsconfig_paths = require('./project_tsconfig_paths-x7xrmbI9.cjs');
13
- var index$1 = require('./index-CAfBb4YL.cjs');
12
+ var project_tsconfig_paths = require('./project_tsconfig_paths-D7xzGqRi.cjs');
13
+ var index$1 = require('./index-jjHOgYYs.cjs');
14
14
  require('path');
15
15
  require('node:path');
16
- var project_paths = require('./project_paths-BUuKobrE.cjs');
17
- var index = require('./index-rL7rOVXa.cjs');
18
- var assert$1 = require('assert');
19
- var assert = require('node:assert');
20
- var apply_import_manager = require('./apply_import_manager-BTXb3nRr.cjs');
16
+ var project_paths = require('./project_paths-T_M15e2g.cjs');
17
+ var index = require('./index-BdH2rlWJ.cjs');
18
+ var assert = require('assert');
19
+ var apply_import_manager = require('./apply_import_manager-yycO3l8f.cjs');
21
20
  require('@angular-devkit/core');
22
21
  require('node:path/posix');
23
22
  require('./leading_space-D9nQ8UQC.cjs');
@@ -599,7 +598,7 @@ function pass1__IdentifySourceFileAndDeclarationInputs(sf, host, checker, reflec
599
598
  const visitor = (node) => {
600
599
  const decoratorInput = extractDecoratorInput(node, host, reflector, dtsMetadataReader, evaluator);
601
600
  if (decoratorInput !== null) {
602
- assert$1(index.isInputContainerNode(node), 'Expected input to be declared on accessor or property.');
601
+ assert(index.isInputContainerNode(node), 'Expected input to be declared on accessor or property.');
603
602
  const inputDescr = getInputDescriptor(host, node);
604
603
  // track all inputs, even from declarations for reference resolution.
605
604
  knownDecoratorInputs.register({ descriptor: inputDescr, metadata: decoratorInput, node });
@@ -762,7 +761,7 @@ function pass4__checkInheritanceOfInputs(inheritanceGraph, metaRegistry, knownIn
762
761
  isClassWithKnownFields: (clazz) => knownInputs.isInputContainingClass(clazz),
763
762
  getFieldsForClass: (clazz) => {
764
763
  const directiveInfo = knownInputs.getDirectiveInfoForClass(clazz);
765
- assert$1(directiveInfo !== undefined, 'Expected directive info to exist for input.');
764
+ assert(directiveInfo !== undefined, 'Expected directive info to exist for input.');
766
765
  return Array.from(directiveInfo.inputFields.values()).map((i) => i.descriptor);
767
766
  },
768
767
  });
@@ -1099,8 +1098,8 @@ function pass6__migrateInputDeclarations(host, checker, result, knownInputs, imp
1099
1098
  filesWithIncompatibleInputs.add(sf);
1100
1099
  continue;
1101
1100
  }
1102
- assert$1(metadata !== null, `Expected metadata to exist for input isn't marked incompatible.`);
1103
- assert$1(!ts.isAccessor(input.node), 'Accessor inputs are incompatible.');
1101
+ assert(metadata !== null, `Expected metadata to exist for input isn't marked incompatible.`);
1102
+ assert(!ts.isAccessor(input.node), 'Accessor inputs are incompatible.');
1104
1103
  filesWithMigratedInputs.add(sf);
1105
1104
  result.replacements.push(...convertToSignalInput(input.node, metadata, info, checker, importManager, result));
1106
1105
  }
@@ -1,23 +1,22 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
- var project_tsconfig_paths = require('./project_tsconfig_paths-x7xrmbI9.cjs');
9
+ var project_tsconfig_paths = require('./project_tsconfig_paths-D7xzGqRi.cjs');
10
10
  var ts = require('typescript');
11
11
  require('os');
12
- var index$1 = require('./index-CAfBb4YL.cjs');
12
+ var index$1 = require('./index-jjHOgYYs.cjs');
13
13
  require('path');
14
14
  require('node:path');
15
- var project_paths = require('./project_paths-BUuKobrE.cjs');
16
- var apply_import_manager = require('./apply_import_manager-BTXb3nRr.cjs');
17
- var migrate_ts_type_references = require('./migrate_ts_type_references-Dyjkgb1x.cjs');
15
+ var project_paths = require('./project_paths-T_M15e2g.cjs');
16
+ var apply_import_manager = require('./apply_import_manager-yycO3l8f.cjs');
17
+ var migrate_ts_type_references = require('./migrate_ts_type_references-BVSg43hf.cjs');
18
18
  var assert = require('assert');
19
- require('node:assert');
20
- var index = require('./index-rL7rOVXa.cjs');
19
+ var index = require('./index-BdH2rlWJ.cjs');
21
20
  require('@angular-devkit/core');
22
21
  require('node:path/posix');
23
22
  require('fs');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -10,7 +10,7 @@ var schematics = require('@angular-devkit/schematics');
10
10
  var signalQueriesMigration = require('./signal-queries-migration.cjs');
11
11
  var signalInputMigration = require('./signal-input-migration.cjs');
12
12
  var outputMigration = require('./output-migration.cjs');
13
- require('./project_tsconfig_paths-x7xrmbI9.cjs');
13
+ require('./project_tsconfig_paths-D7xzGqRi.cjs');
14
14
  require('typescript');
15
15
  require('os');
16
16
  require('fs');
@@ -18,16 +18,15 @@ require('module');
18
18
  require('path');
19
19
  require('url');
20
20
  require('@angular-devkit/core');
21
- require('./index-CAfBb4YL.cjs');
21
+ require('./index-jjHOgYYs.cjs');
22
22
  require('node:path');
23
- require('./project_paths-BUuKobrE.cjs');
23
+ require('./project_paths-T_M15e2g.cjs');
24
24
  require('node:path/posix');
25
- require('./apply_import_manager-BTXb3nRr.cjs');
26
- require('./migrate_ts_type_references-Dyjkgb1x.cjs');
25
+ require('./apply_import_manager-yycO3l8f.cjs');
26
+ require('./migrate_ts_type_references-BVSg43hf.cjs');
27
27
  require('assert');
28
- require('./index-rL7rOVXa.cjs');
28
+ require('./index-BdH2rlWJ.cjs');
29
29
  require('./leading_space-D9nQ8UQC.cjs');
30
- require('node:assert');
31
30
 
32
31
  function migrate(options) {
33
32
  // The migrations are independent so we can run them in any order, but we sort them here
@@ -1,22 +1,22 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
9
  var schematics = require('@angular-devkit/schematics');
10
- var index = require('./index-CAfBb4YL.cjs');
10
+ var index = require('./index-jjHOgYYs.cjs');
11
11
  var fs = require('fs');
12
12
  var p = require('path');
13
13
  var ts = require('typescript');
14
- var compiler_host = require('./compiler_host-Btt7nH4b.cjs');
15
- var project_tsconfig_paths = require('./project_tsconfig_paths-x7xrmbI9.cjs');
16
- var ng_decorators = require('./ng_decorators-B5HCqr20.cjs');
14
+ var compiler_host = require('./compiler_host-DrXTGf_7.cjs');
15
+ var project_tsconfig_paths = require('./project_tsconfig_paths-D7xzGqRi.cjs');
16
+ var ng_decorators = require('./ng_decorators-CtYwz9Lw.cjs');
17
17
  var nodes = require('./nodes-B16H9JUd.cjs');
18
18
  var symbol = require('./symbol-VPWguRxr.cjs');
19
- var imports = require('./imports-CIX-JgAN.cjs');
19
+ var imports = require('./imports-26VeX8i-.cjs');
20
20
  require('os');
21
21
  require('module');
22
22
  require('url');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.2.3
3
+ * @license Angular v21.0.0-next.1
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -57,6 +57,12 @@
57
57
  "factory": "./bundles/control-flow-migration.cjs#migrate",
58
58
  "schema": "./migrations/control-flow-migration/schema.json",
59
59
  "aliases": ["control-flow"]
60
+ },
61
+ "ngclass-to-class-migration": {
62
+ "description": "Updates usages of `ngClass` directives to the `class` bindings where possible",
63
+ "factory": "./bundles/ngclass-to-class-migration.cjs#migrate",
64
+ "schema": "./migrations/ngclass-to-class-migration/schema.json",
65
+ "aliases": ["ngclass-to-class"]
60
66
  }
61
67
  }
62
68
  }