@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.
- package/api.d.d.ts +1 -1
- package/chrome_dev_tools_performance.d.d.ts +2 -17
- package/discovery.d.d.ts +25 -27
- package/effect.d.d.ts +1 -1
- package/event_dispatcher.d.d.ts +1 -1
- package/fesm2022/attribute.mjs +1 -1
- package/fesm2022/core.mjs +19 -14
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/debug_node.mjs +48 -50
- package/fesm2022/debug_node.mjs.map +1 -1
- package/fesm2022/effect.mjs +1 -1
- package/fesm2022/not_found.mjs +1 -1
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/resource.mjs +1 -1
- package/fesm2022/root_effect_scheduler.mjs +2 -8
- package/fesm2022/root_effect_scheduler.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +2 -2
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/signal.mjs +1 -1
- package/fesm2022/testing.mjs +6 -4
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/weak_ref.mjs +1 -1
- package/graph.d.d.ts +1 -1
- package/index.d.ts +6 -13
- package/package.json +2 -2
- package/primitives/di/index.d.ts +1 -1
- package/primitives/event-dispatch/index.d.ts +1 -1
- package/primitives/signals/index.d.ts +1 -1
- package/rxjs-interop/index.d.ts +1 -1
- package/schematics/bundles/{apply_import_manager-BTXb3nRr.cjs → apply_import_manager-yycO3l8f.cjs} +3 -3
- package/schematics/bundles/cleanup-unused-imports.cjs +5 -5
- package/schematics/bundles/{compiler_host-Btt7nH4b.cjs → compiler_host-DrXTGf_7.cjs} +2 -2
- package/schematics/bundles/control-flow-migration.cjs +19 -48
- package/schematics/bundles/{imports-CIX-JgAN.cjs → imports-26VeX8i-.cjs} +2 -1
- package/schematics/bundles/{index-rL7rOVXa.cjs → index-BdH2rlWJ.cjs} +4 -4
- package/schematics/bundles/{index-CAfBb4YL.cjs → index-jjHOgYYs.cjs} +28 -14
- package/schematics/bundles/inject-migration.cjs +5 -5
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-Dyjkgb1x.cjs → migrate_ts_type_references-BVSg43hf.cjs} +9 -10
- package/schematics/bundles/ng_component_template-DjLc4mdL.cjs +186 -0
- package/schematics/bundles/{ng_decorators-B5HCqr20.cjs → ng_decorators-CtYwz9Lw.cjs} +2 -2
- package/schematics/bundles/ngclass-to-class-migration.cjs +533 -0
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +6 -6
- package/schematics/bundles/parse_html-CXR8hziE.cjs +41 -0
- package/schematics/bundles/{project_paths-BUuKobrE.cjs → project_paths-T_M15e2g.cjs} +3 -3
- package/schematics/bundles/{project_tsconfig_paths-x7xrmbI9.cjs → project_tsconfig_paths-D7xzGqRi.cjs} +8 -5
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +3 -3
- package/schematics/bundles/router-current-navigation.cjs +5 -5
- package/schematics/bundles/{test-bed-get.cjs → router-last-successful-navigation.cjs} +30 -14
- package/schematics/bundles/self-closing-tags-migration.cjs +11 -207
- package/schematics/bundles/signal-input-migration.cjs +12 -13
- package/schematics/bundles/signal-queries-migration.cjs +7 -8
- package/schematics/bundles/signals.cjs +7 -8
- package/schematics/bundles/standalone-migration.cjs +6 -6
- package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
- package/schematics/collection.json +6 -0
- package/schematics/migrations/ngclass-to-class-migration/schema.json +20 -0
- package/schematics/migrations.json +7 -17
- package/testing/index.d.ts +1 -1
- package/weak_ref.d.d.ts +1 -1
- package/schematics/bundles/document-core.cjs +0 -95
- package/schematics/bundles/inject-flags.cjs +0 -147
|
@@ -1,22 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular
|
|
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-
|
|
9
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-D7xzGqRi.cjs');
|
|
10
10
|
var ts = require('typescript');
|
|
11
11
|
require('os');
|
|
12
12
|
var assert = require('assert');
|
|
13
|
-
var index = require('./index-
|
|
14
|
-
var project_paths = require('./project_paths-
|
|
13
|
+
var index = require('./index-BdH2rlWJ.cjs');
|
|
14
|
+
var project_paths = require('./project_paths-T_M15e2g.cjs');
|
|
15
15
|
var leading_space = require('./leading_space-D9nQ8UQC.cjs');
|
|
16
|
-
require('./index-
|
|
16
|
+
require('./index-jjHOgYYs.cjs');
|
|
17
17
|
require('path');
|
|
18
18
|
require('node:path');
|
|
19
|
-
var assert$1 = require('node:assert');
|
|
20
19
|
|
|
21
20
|
/**
|
|
22
21
|
* Reasons why a field cannot be migrated.
|
|
@@ -1128,7 +1127,7 @@ function analyzeControlFlow(entries, checker) {
|
|
|
1128
1127
|
for (const entry of entries) {
|
|
1129
1128
|
const { flowContainer, resultIndex } = referenceToMetadata.get(entry);
|
|
1130
1129
|
const flowPathInterestingNodes = traverseFlowForInterestingNodes(getFlowNode(entry));
|
|
1131
|
-
assert
|
|
1130
|
+
assert(flowContainer !== null && flowPathInterestingNodes !== null, 'Expected a flow container to exist.');
|
|
1132
1131
|
const narrowPartners = getAllMatchingReferencesInFlowPath(flowPathInterestingNodes, entry, referenceToMetadata, flowContainer, checker);
|
|
1133
1132
|
if (narrowPartners.length !== 0) {
|
|
1134
1133
|
connectSharedReferences(result, narrowPartners, resultIndex);
|
|
@@ -1154,8 +1153,8 @@ function connectSharedReferences(result, flowPartners, refId) {
|
|
|
1154
1153
|
earliestPartnerId = partnerId;
|
|
1155
1154
|
}
|
|
1156
1155
|
}
|
|
1157
|
-
assert
|
|
1158
|
-
assert
|
|
1156
|
+
assert(earliestPartner !== null, 'Expected an earliest partner to be found.');
|
|
1157
|
+
assert(earliestPartnerId !== null, 'Expected an earliest partner to be found.');
|
|
1159
1158
|
// Earliest partner ID could be higher than `refId` in cyclic
|
|
1160
1159
|
// situations like `loop` flow nodes. We need to find the minimum
|
|
1161
1160
|
// and maximum to iterate through partners in between.
|
|
@@ -1196,7 +1195,7 @@ function connectSharedReferences(result, flowPartners, refId) {
|
|
|
1196
1195
|
if (!highestBlock) {
|
|
1197
1196
|
console.error(earliestPartnerId, refId, refFlowContainer.getText(), seenBlocks);
|
|
1198
1197
|
}
|
|
1199
|
-
assert
|
|
1198
|
+
assert(highestBlock, 'Expected a block anchor to be found');
|
|
1200
1199
|
result[earliestPartnerId].recommendedNode = highestBlock;
|
|
1201
1200
|
}
|
|
1202
1201
|
function isPotentialInsertionAncestor(node) {
|
|
@@ -0,0 +1,186 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
/**
|
|
3
|
+
* @license Angular v21.0.0-next.1
|
|
4
|
+
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
|
+
* License: MIT
|
|
6
|
+
*/
|
|
7
|
+
'use strict';
|
|
8
|
+
|
|
9
|
+
var ts = require('typescript');
|
|
10
|
+
var ng_decorators = require('./ng_decorators-CtYwz9Lw.cjs');
|
|
11
|
+
var property_name = require('./property_name-BBwFuqMe.cjs');
|
|
12
|
+
require('os');
|
|
13
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-D7xzGqRi.cjs');
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
|
|
17
|
+
* parentheses or as expression. e.g. "(((({exp}))))()". The function should return the
|
|
18
|
+
* TypeScript node referring to the inner expression. e.g "exp".
|
|
19
|
+
*/
|
|
20
|
+
function unwrapExpression(node) {
|
|
21
|
+
if (ts.isParenthesizedExpression(node) || ts.isAsExpression(node)) {
|
|
22
|
+
return unwrapExpression(node.expression);
|
|
23
|
+
}
|
|
24
|
+
else {
|
|
25
|
+
return node;
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** Extracts `@Directive` or `@Component` metadata from the given class. */
|
|
30
|
+
function extractAngularClassMetadata(typeChecker, node) {
|
|
31
|
+
const decorators = ts.getDecorators(node);
|
|
32
|
+
if (!decorators || !decorators.length) {
|
|
33
|
+
return null;
|
|
34
|
+
}
|
|
35
|
+
const ngDecorators = ng_decorators.getAngularDecorators(typeChecker, decorators);
|
|
36
|
+
const componentDecorator = ngDecorators.find((dec) => dec.name === 'Component');
|
|
37
|
+
const directiveDecorator = ngDecorators.find((dec) => dec.name === 'Directive');
|
|
38
|
+
const decorator = componentDecorator ?? directiveDecorator;
|
|
39
|
+
// In case no decorator could be found on the current class, skip.
|
|
40
|
+
if (!decorator) {
|
|
41
|
+
return null;
|
|
42
|
+
}
|
|
43
|
+
const decoratorCall = decorator.node.expression;
|
|
44
|
+
// In case the decorator call is not valid, skip this class declaration.
|
|
45
|
+
if (decoratorCall.arguments.length !== 1) {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
const metadata = unwrapExpression(decoratorCall.arguments[0]);
|
|
49
|
+
// Ensure that the metadata is an object literal expression.
|
|
50
|
+
if (!ts.isObjectLiteralExpression(metadata)) {
|
|
51
|
+
return null;
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
type: componentDecorator ? 'component' : 'directive',
|
|
55
|
+
node: metadata,
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
const LF_CHAR = 10;
|
|
60
|
+
const CR_CHAR = 13;
|
|
61
|
+
const LINE_SEP_CHAR = 8232;
|
|
62
|
+
const PARAGRAPH_CHAR = 8233;
|
|
63
|
+
/** Gets the line and character for the given position from the line starts map. */
|
|
64
|
+
function getLineAndCharacterFromPosition(lineStartsMap, position) {
|
|
65
|
+
const lineIndex = findClosestLineStartPosition(lineStartsMap, position);
|
|
66
|
+
return { character: position - lineStartsMap[lineIndex], line: lineIndex };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Computes the line start map of the given text. This can be used in order to
|
|
70
|
+
* retrieve the line and character of a given text position index.
|
|
71
|
+
*/
|
|
72
|
+
function computeLineStartsMap(text) {
|
|
73
|
+
const result = [0];
|
|
74
|
+
let pos = 0;
|
|
75
|
+
while (pos < text.length) {
|
|
76
|
+
const char = text.charCodeAt(pos++);
|
|
77
|
+
// Handles the "CRLF" line break. In that case we peek the character
|
|
78
|
+
// after the "CR" and check if it is a line feed.
|
|
79
|
+
if (char === CR_CHAR) {
|
|
80
|
+
if (text.charCodeAt(pos) === LF_CHAR) {
|
|
81
|
+
pos++;
|
|
82
|
+
}
|
|
83
|
+
result.push(pos);
|
|
84
|
+
}
|
|
85
|
+
else if (char === LF_CHAR || char === LINE_SEP_CHAR || char === PARAGRAPH_CHAR) {
|
|
86
|
+
result.push(pos);
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
result.push(pos);
|
|
90
|
+
return result;
|
|
91
|
+
}
|
|
92
|
+
/** Finds the closest line start for the given position. */
|
|
93
|
+
function findClosestLineStartPosition(linesMap, position, low = 0, high = linesMap.length - 1) {
|
|
94
|
+
while (low <= high) {
|
|
95
|
+
const pivotIdx = Math.floor((low + high) / 2);
|
|
96
|
+
const pivotEl = linesMap[pivotIdx];
|
|
97
|
+
if (pivotEl === position) {
|
|
98
|
+
return pivotIdx;
|
|
99
|
+
}
|
|
100
|
+
else if (position > pivotEl) {
|
|
101
|
+
low = pivotIdx + 1;
|
|
102
|
+
}
|
|
103
|
+
else {
|
|
104
|
+
high = pivotIdx - 1;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
// In case there was no exact match, return the closest "lower" line index. We also
|
|
108
|
+
// subtract the index by one because want the index of the previous line start.
|
|
109
|
+
return low - 1;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
/**
|
|
113
|
+
* Visitor that can be used to determine Angular templates referenced within given
|
|
114
|
+
* TypeScript source files (inline templates or external referenced templates)
|
|
115
|
+
*/
|
|
116
|
+
class NgComponentTemplateVisitor {
|
|
117
|
+
typeChecker;
|
|
118
|
+
resolvedTemplates = [];
|
|
119
|
+
fs = project_tsconfig_paths.getFileSystem();
|
|
120
|
+
constructor(typeChecker) {
|
|
121
|
+
this.typeChecker = typeChecker;
|
|
122
|
+
}
|
|
123
|
+
visitNode(node) {
|
|
124
|
+
if (node.kind === ts.SyntaxKind.ClassDeclaration) {
|
|
125
|
+
this.visitClassDeclaration(node);
|
|
126
|
+
}
|
|
127
|
+
ts.forEachChild(node, (n) => this.visitNode(n));
|
|
128
|
+
}
|
|
129
|
+
visitClassDeclaration(node) {
|
|
130
|
+
const metadata = extractAngularClassMetadata(this.typeChecker, node);
|
|
131
|
+
if (metadata === null || metadata.type !== 'component') {
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
const sourceFile = node.getSourceFile();
|
|
135
|
+
const sourceFileName = sourceFile.fileName;
|
|
136
|
+
// Walk through all component metadata properties and determine the referenced
|
|
137
|
+
// HTML templates (either external or inline)
|
|
138
|
+
metadata.node.properties.forEach((property) => {
|
|
139
|
+
if (!ts.isPropertyAssignment(property)) {
|
|
140
|
+
return;
|
|
141
|
+
}
|
|
142
|
+
const propertyName = property_name.getPropertyNameText(property.name);
|
|
143
|
+
// In case there is an inline template specified, ensure that the value is statically
|
|
144
|
+
// analyzable by checking if the initializer is a string literal-like node.
|
|
145
|
+
if (propertyName === 'template' && ts.isStringLiteralLike(property.initializer)) {
|
|
146
|
+
// Need to add an offset of one to the start because the template quotes are
|
|
147
|
+
// not part of the template content.
|
|
148
|
+
// The `getText()` method gives us the original raw text.
|
|
149
|
+
// We could have used the `text` property, but if the template is defined as a backtick
|
|
150
|
+
// string then the `text` property contains a "cooked" version of the string. Such cooked
|
|
151
|
+
// strings will have converted CRLF characters to only LF. This messes up string
|
|
152
|
+
// replacements in template migrations.
|
|
153
|
+
// The raw text returned by `getText()` includes the enclosing quotes so we change the
|
|
154
|
+
// `content` and `start` values accordingly.
|
|
155
|
+
const content = property.initializer.getText().slice(1, -1);
|
|
156
|
+
const start = property.initializer.getStart() + 1;
|
|
157
|
+
this.resolvedTemplates.push({
|
|
158
|
+
filePath: sourceFileName,
|
|
159
|
+
container: node,
|
|
160
|
+
content,
|
|
161
|
+
inline: true,
|
|
162
|
+
start: start,
|
|
163
|
+
getCharacterAndLineOfPosition: (pos) => ts.getLineAndCharacterOfPosition(sourceFile, pos + start),
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
if (propertyName === 'templateUrl' && ts.isStringLiteralLike(property.initializer)) {
|
|
167
|
+
const absolutePath = this.fs.resolve(this.fs.dirname(sourceFileName), property.initializer.text);
|
|
168
|
+
if (!this.fs.exists(absolutePath)) {
|
|
169
|
+
return;
|
|
170
|
+
}
|
|
171
|
+
const fileContent = this.fs.readFile(absolutePath);
|
|
172
|
+
const lineStartsMap = computeLineStartsMap(fileContent);
|
|
173
|
+
this.resolvedTemplates.push({
|
|
174
|
+
filePath: absolutePath,
|
|
175
|
+
container: node,
|
|
176
|
+
content: fileContent,
|
|
177
|
+
inline: false,
|
|
178
|
+
start: 0,
|
|
179
|
+
getCharacterAndLineOfPosition: (pos) => getLineAndCharacterFromPosition(lineStartsMap, pos),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
});
|
|
183
|
+
}
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
exports.NgComponentTemplateVisitor = NgComponentTemplateVisitor;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular
|
|
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 ts = require('typescript');
|
|
10
|
-
var imports = require('./imports-
|
|
10
|
+
var imports = require('./imports-26VeX8i-.cjs');
|
|
11
11
|
|
|
12
12
|
function getCallDecoratorImport(typeChecker, decorator) {
|
|
13
13
|
// Note that this does not cover the edge case where decorators are called from
|