@angular/core 21.0.0-next.9 → 21.0.0-rc.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.
- package/fesm2022/_attribute-chunk.mjs +2 -14
- package/fesm2022/_attribute-chunk.mjs.map +1 -1
- package/fesm2022/_debug_node-chunk.mjs +15164 -28368
- package/fesm2022/_debug_node-chunk.mjs.map +1 -1
- package/fesm2022/_effect-chunk.mjs +322 -504
- package/fesm2022/_effect-chunk.mjs.map +1 -1
- package/fesm2022/_effect-chunk2.mjs +2204 -4061
- package/fesm2022/_effect-chunk2.mjs.map +1 -1
- package/fesm2022/_not_found-chunk.mjs +18 -35
- package/fesm2022/_not_found-chunk.mjs.map +1 -1
- package/fesm2022/_resource-chunk.mjs +312 -391
- package/fesm2022/_resource-chunk.mjs.map +1 -1
- package/fesm2022/_untracked-chunk.mjs +75 -96
- package/fesm2022/_untracked-chunk.mjs.map +1 -1
- package/fesm2022/_weak_ref-chunk.mjs +2 -4
- package/fesm2022/_weak_ref-chunk.mjs.map +1 -1
- package/fesm2022/core.mjs +2461 -4305
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives-di.mjs +9 -9
- package/fesm2022/primitives-di.mjs.map +1 -1
- package/fesm2022/primitives-event-dispatch.mjs +626 -1460
- package/fesm2022/primitives-event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives-signals.mjs +154 -188
- package/fesm2022/primitives-signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +204 -304
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +2303 -3162
- package/fesm2022/testing.mjs.map +1 -1
- package/package.json +8 -2
- package/resources/best-practices.md +56 -0
- package/schematics/bundles/add-bootstrap-context-to-server-main.cjs +7 -25
- package/schematics/bundles/application-config-core.cjs +8 -19
- package/schematics/bundles/{apply_import_manager-CoeTX_Ob.cjs → apply_import_manager-1Zs_gpB6.cjs} +4 -5
- package/schematics/bundles/bootstrap-options-migration.cjs +93 -132
- package/schematics/bundles/cleanup-unused-imports.cjs +9 -13
- package/schematics/bundles/common-to-standalone-migration.cjs +12 -16
- package/schematics/bundles/{compiler_host-emLDwK2U.cjs → compiler_host-DBwYMlTo.cjs} +10 -11
- package/schematics/bundles/control-flow-migration.cjs +29 -31
- package/schematics/bundles/{imports-DwPXlGFl.cjs → imports-DP72APSx.cjs} +1 -23
- package/schematics/bundles/{index-CLxYZ09c.cjs → index-B7I9sIUx.cjs} +36 -37
- package/schematics/bundles/inject-migration.cjs +9 -26
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-CpM5FPGa.cjs → migrate_ts_type_references-UGIUl7En.cjs} +458 -24
- package/schematics/bundles/{ng_component_template-BRbBIAUX.cjs → ng_component_template-Dsuq1Lw7.cjs} +4 -5
- package/schematics/bundles/{ng_decorators-BI0uV7KI.cjs → ng_decorators-DSFlWYQY.cjs} +2 -2
- package/schematics/bundles/ngclass-to-class-migration.cjs +16 -19
- package/schematics/bundles/ngstyle-to-style-migration.cjs +15 -18
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +16 -19
- package/schematics/bundles/{parse_html-CPWfkfhR.cjs → parse_html-8VLCL37B.cjs} +5 -5
- package/schematics/bundles/{project_paths-C8H7KDJ3.cjs → project_paths-DvD50ouC.cjs} +14 -247
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +90 -0
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +9 -25
- package/schematics/bundles/router-current-navigation.cjs +6 -17
- package/schematics/bundles/router-last-successful-navigation.cjs +6 -17
- package/schematics/bundles/router-testing-module-migration.cjs +7 -18
- package/schematics/bundles/self-closing-tags-migration.cjs +14 -17
- package/schematics/bundles/signal-input-migration.cjs +23 -26
- package/schematics/bundles/signal-queries-migration.cjs +22 -25
- package/schematics/bundles/signals.cjs +10 -13
- package/schematics/bundles/standalone-migration.cjs +22 -56
- package/schematics/bundles/symbol-BObKoqes.cjs +1 -1
- package/types/_api-chunk.d.ts +1 -1
- package/types/_chrome_dev_tools_performance-chunk.d.ts +1 -1
- package/types/_discovery-chunk.d.ts +7 -9
- package/types/_effect-chunk.d.ts +1 -1
- package/types/_event_dispatcher-chunk.d.ts +1 -1
- package/types/_formatter-chunk.d.ts +1 -1
- package/types/_weak_ref-chunk.d.ts +1 -1
- package/types/core.d.ts +1 -81
- package/types/primitives-di.d.ts +1 -1
- package/types/primitives-event-dispatch.d.ts +1 -1
- package/types/primitives-signals.d.ts +1 -1
- package/types/rxjs-interop.d.ts +1 -1
- package/types/testing.d.ts +1 -1
- package/schematics/bundles/index-Dvqnp6JS.cjs +0 -22419
- package/schematics/bundles/project_tsconfig_paths-CiBzGSIa.cjs +0 -51591
|
@@ -1,33 +1,23 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-
|
|
3
|
+
* @license Angular v21.0.0-rc.0
|
|
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
|
|
11
|
-
var compiler_host = require('./compiler_host-
|
|
10
|
+
var path = require('path');
|
|
11
|
+
var compiler_host = require('./compiler_host-DBwYMlTo.cjs');
|
|
12
12
|
var ts = require('typescript');
|
|
13
|
-
var ng_decorators = require('./ng_decorators-
|
|
14
|
-
var imports = require('./imports-
|
|
13
|
+
var ng_decorators = require('./ng_decorators-DSFlWYQY.cjs');
|
|
14
|
+
var imports = require('./imports-DP72APSx.cjs');
|
|
15
15
|
var nodes = require('./nodes-B16H9JUd.cjs');
|
|
16
16
|
var leading_space = require('./leading_space-D9nQ8UQC.cjs');
|
|
17
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-
|
|
18
|
-
require('
|
|
19
|
-
require('fs');
|
|
20
|
-
require('module');
|
|
21
|
-
require('url');
|
|
17
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
18
|
+
require('@angular/compiler-cli/private/migrations');
|
|
22
19
|
require('@angular-devkit/core');
|
|
23
20
|
|
|
24
|
-
/*!
|
|
25
|
-
* @license
|
|
26
|
-
* Copyright Google LLC All Rights Reserved.
|
|
27
|
-
*
|
|
28
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
29
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
30
|
-
*/
|
|
31
21
|
/** Names of decorators that enable DI on a class declaration. */
|
|
32
22
|
const DECORATORS_SUPPORTING_DI = new Set([
|
|
33
23
|
'Component',
|
|
@@ -346,13 +336,6 @@ function isInlineFunction(node) {
|
|
|
346
336
|
return (ts.isFunctionDeclaration(node) || ts.isFunctionExpression(node) || ts.isArrowFunction(node));
|
|
347
337
|
}
|
|
348
338
|
|
|
349
|
-
/*!
|
|
350
|
-
* @license
|
|
351
|
-
* Copyright Google LLC All Rights Reserved.
|
|
352
|
-
*
|
|
353
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
354
|
-
* found in the LICENSE file at https://angular.dev/license
|
|
355
|
-
*/
|
|
356
339
|
/**
|
|
357
340
|
* Finds class property declarations without initializers whose constructor-based initialization
|
|
358
341
|
* can be inlined into the declaration spot after migrating to `inject`. For example:
|
|
@@ -1342,7 +1325,7 @@ function migrate(options) {
|
|
|
1342
1325
|
const { buildPaths, testPaths } = await project_tsconfig_paths.getProjectTsConfigPaths(tree);
|
|
1343
1326
|
const basePath = process.cwd();
|
|
1344
1327
|
const allPaths = [...buildPaths, ...testPaths];
|
|
1345
|
-
const pathToMigrate = compiler_host.normalizePath(
|
|
1328
|
+
const pathToMigrate = compiler_host.normalizePath(path.join(basePath, options.path));
|
|
1346
1329
|
if (!allPaths.length) {
|
|
1347
1330
|
throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run the inject migration.');
|
|
1348
1331
|
}
|
|
@@ -1366,7 +1349,7 @@ function runInjectMigration(tree, tsconfigPath, basePath, pathToMigrate, schemat
|
|
|
1366
1349
|
for (const sourceFile of sourceFiles) {
|
|
1367
1350
|
const changes = migrateFile(sourceFile, schematicOptions);
|
|
1368
1351
|
if (changes.length > 0) {
|
|
1369
|
-
const update = tree.beginUpdate(
|
|
1352
|
+
const update = tree.beginUpdate(path.relative(basePath, sourceFile.fileName));
|
|
1370
1353
|
for (const change of changes) {
|
|
1371
1354
|
if (change.removeLength != null) {
|
|
1372
1355
|
update.remove(change.start, change.removeLength);
|
|
@@ -1,20 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-
|
|
3
|
+
* @license Angular v21.0.0-rc.0
|
|
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-CiBzGSIa.cjs');
|
|
10
|
-
var ts = require('typescript');
|
|
11
|
-
require('os');
|
|
12
9
|
var assert = require('assert');
|
|
13
|
-
var
|
|
14
|
-
var
|
|
10
|
+
var ts = require('typescript');
|
|
11
|
+
var migrations = require('@angular/compiler-cli/private/migrations');
|
|
12
|
+
var index = require('./index-B7I9sIUx.cjs');
|
|
13
|
+
var project_paths = require('./project_paths-DvD50ouC.cjs');
|
|
15
14
|
var leading_space = require('./leading_space-D9nQ8UQC.cjs');
|
|
16
|
-
require('
|
|
17
|
-
require('path');
|
|
15
|
+
require('@angular/compiler-cli');
|
|
18
16
|
require('node:path');
|
|
19
17
|
|
|
20
18
|
/**
|
|
@@ -77,6 +75,441 @@ function pickFieldIncompatibility(a, b) {
|
|
|
77
75
|
return a;
|
|
78
76
|
}
|
|
79
77
|
|
|
78
|
+
/**
|
|
79
|
+
* A lazily created TextEncoder instance for converting strings into UTF-8 bytes
|
|
80
|
+
*/
|
|
81
|
+
// Utils
|
|
82
|
+
var Endian;
|
|
83
|
+
(function (Endian) {
|
|
84
|
+
Endian[Endian["Little"] = 0] = "Little";
|
|
85
|
+
Endian[Endian["Big"] = 1] = "Big";
|
|
86
|
+
})(Endian || (Endian = {}));
|
|
87
|
+
|
|
88
|
+
//// Types
|
|
89
|
+
var TypeModifier;
|
|
90
|
+
(function (TypeModifier) {
|
|
91
|
+
TypeModifier[TypeModifier["None"] = 0] = "None";
|
|
92
|
+
TypeModifier[TypeModifier["Const"] = 1] = "Const";
|
|
93
|
+
})(TypeModifier || (TypeModifier = {}));
|
|
94
|
+
class Type {
|
|
95
|
+
modifiers;
|
|
96
|
+
constructor(modifiers = TypeModifier.None) {
|
|
97
|
+
this.modifiers = modifiers;
|
|
98
|
+
}
|
|
99
|
+
hasModifier(modifier) {
|
|
100
|
+
return (this.modifiers & modifier) !== 0;
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
var BuiltinTypeName;
|
|
104
|
+
(function (BuiltinTypeName) {
|
|
105
|
+
BuiltinTypeName[BuiltinTypeName["Dynamic"] = 0] = "Dynamic";
|
|
106
|
+
BuiltinTypeName[BuiltinTypeName["Bool"] = 1] = "Bool";
|
|
107
|
+
BuiltinTypeName[BuiltinTypeName["String"] = 2] = "String";
|
|
108
|
+
BuiltinTypeName[BuiltinTypeName["Int"] = 3] = "Int";
|
|
109
|
+
BuiltinTypeName[BuiltinTypeName["Number"] = 4] = "Number";
|
|
110
|
+
BuiltinTypeName[BuiltinTypeName["Function"] = 5] = "Function";
|
|
111
|
+
BuiltinTypeName[BuiltinTypeName["Inferred"] = 6] = "Inferred";
|
|
112
|
+
BuiltinTypeName[BuiltinTypeName["None"] = 7] = "None";
|
|
113
|
+
})(BuiltinTypeName || (BuiltinTypeName = {}));
|
|
114
|
+
class BuiltinType extends Type {
|
|
115
|
+
name;
|
|
116
|
+
constructor(name, modifiers) {
|
|
117
|
+
super(modifiers);
|
|
118
|
+
this.name = name;
|
|
119
|
+
}
|
|
120
|
+
visitType(visitor, context) {
|
|
121
|
+
return visitor.visitBuiltinType(this, context);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
new BuiltinType(BuiltinTypeName.Dynamic);
|
|
125
|
+
const INFERRED_TYPE = new BuiltinType(BuiltinTypeName.Inferred);
|
|
126
|
+
new BuiltinType(BuiltinTypeName.Bool);
|
|
127
|
+
new BuiltinType(BuiltinTypeName.Int);
|
|
128
|
+
new BuiltinType(BuiltinTypeName.Number);
|
|
129
|
+
new BuiltinType(BuiltinTypeName.String);
|
|
130
|
+
new BuiltinType(BuiltinTypeName.Function);
|
|
131
|
+
new BuiltinType(BuiltinTypeName.None);
|
|
132
|
+
///// Expressions
|
|
133
|
+
var UnaryOperator;
|
|
134
|
+
(function (UnaryOperator) {
|
|
135
|
+
UnaryOperator[UnaryOperator["Minus"] = 0] = "Minus";
|
|
136
|
+
UnaryOperator[UnaryOperator["Plus"] = 1] = "Plus";
|
|
137
|
+
})(UnaryOperator || (UnaryOperator = {}));
|
|
138
|
+
var BinaryOperator;
|
|
139
|
+
(function (BinaryOperator) {
|
|
140
|
+
BinaryOperator[BinaryOperator["Equals"] = 0] = "Equals";
|
|
141
|
+
BinaryOperator[BinaryOperator["NotEquals"] = 1] = "NotEquals";
|
|
142
|
+
BinaryOperator[BinaryOperator["Assign"] = 2] = "Assign";
|
|
143
|
+
BinaryOperator[BinaryOperator["Identical"] = 3] = "Identical";
|
|
144
|
+
BinaryOperator[BinaryOperator["NotIdentical"] = 4] = "NotIdentical";
|
|
145
|
+
BinaryOperator[BinaryOperator["Minus"] = 5] = "Minus";
|
|
146
|
+
BinaryOperator[BinaryOperator["Plus"] = 6] = "Plus";
|
|
147
|
+
BinaryOperator[BinaryOperator["Divide"] = 7] = "Divide";
|
|
148
|
+
BinaryOperator[BinaryOperator["Multiply"] = 8] = "Multiply";
|
|
149
|
+
BinaryOperator[BinaryOperator["Modulo"] = 9] = "Modulo";
|
|
150
|
+
BinaryOperator[BinaryOperator["And"] = 10] = "And";
|
|
151
|
+
BinaryOperator[BinaryOperator["Or"] = 11] = "Or";
|
|
152
|
+
BinaryOperator[BinaryOperator["BitwiseOr"] = 12] = "BitwiseOr";
|
|
153
|
+
BinaryOperator[BinaryOperator["BitwiseAnd"] = 13] = "BitwiseAnd";
|
|
154
|
+
BinaryOperator[BinaryOperator["Lower"] = 14] = "Lower";
|
|
155
|
+
BinaryOperator[BinaryOperator["LowerEquals"] = 15] = "LowerEquals";
|
|
156
|
+
BinaryOperator[BinaryOperator["Bigger"] = 16] = "Bigger";
|
|
157
|
+
BinaryOperator[BinaryOperator["BiggerEquals"] = 17] = "BiggerEquals";
|
|
158
|
+
BinaryOperator[BinaryOperator["NullishCoalesce"] = 18] = "NullishCoalesce";
|
|
159
|
+
BinaryOperator[BinaryOperator["Exponentiation"] = 19] = "Exponentiation";
|
|
160
|
+
BinaryOperator[BinaryOperator["In"] = 20] = "In";
|
|
161
|
+
BinaryOperator[BinaryOperator["AdditionAssignment"] = 21] = "AdditionAssignment";
|
|
162
|
+
BinaryOperator[BinaryOperator["SubtractionAssignment"] = 22] = "SubtractionAssignment";
|
|
163
|
+
BinaryOperator[BinaryOperator["MultiplicationAssignment"] = 23] = "MultiplicationAssignment";
|
|
164
|
+
BinaryOperator[BinaryOperator["DivisionAssignment"] = 24] = "DivisionAssignment";
|
|
165
|
+
BinaryOperator[BinaryOperator["RemainderAssignment"] = 25] = "RemainderAssignment";
|
|
166
|
+
BinaryOperator[BinaryOperator["ExponentiationAssignment"] = 26] = "ExponentiationAssignment";
|
|
167
|
+
BinaryOperator[BinaryOperator["AndAssignment"] = 27] = "AndAssignment";
|
|
168
|
+
BinaryOperator[BinaryOperator["OrAssignment"] = 28] = "OrAssignment";
|
|
169
|
+
BinaryOperator[BinaryOperator["NullishCoalesceAssignment"] = 29] = "NullishCoalesceAssignment";
|
|
170
|
+
})(BinaryOperator || (BinaryOperator = {}));
|
|
171
|
+
function nullSafeIsEquivalent(base, other) {
|
|
172
|
+
if (base == null || other == null) {
|
|
173
|
+
return base == other;
|
|
174
|
+
}
|
|
175
|
+
return base.isEquivalent(other);
|
|
176
|
+
}
|
|
177
|
+
function areAllEquivalentPredicate(base, other, equivalentPredicate) {
|
|
178
|
+
const len = base.length;
|
|
179
|
+
if (len !== other.length) {
|
|
180
|
+
return false;
|
|
181
|
+
}
|
|
182
|
+
for (let i = 0; i < len; i++) {
|
|
183
|
+
if (!equivalentPredicate(base[i], other[i])) {
|
|
184
|
+
return false;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
return true;
|
|
188
|
+
}
|
|
189
|
+
function areAllEquivalent(base, other) {
|
|
190
|
+
return areAllEquivalentPredicate(base, other, (baseElement, otherElement) => baseElement.isEquivalent(otherElement));
|
|
191
|
+
}
|
|
192
|
+
class Expression {
|
|
193
|
+
type;
|
|
194
|
+
sourceSpan;
|
|
195
|
+
constructor(type, sourceSpan) {
|
|
196
|
+
this.type = type || null;
|
|
197
|
+
this.sourceSpan = sourceSpan || null;
|
|
198
|
+
}
|
|
199
|
+
prop(name, sourceSpan) {
|
|
200
|
+
return new ReadPropExpr(this, name, null, sourceSpan);
|
|
201
|
+
}
|
|
202
|
+
key(index, type, sourceSpan) {
|
|
203
|
+
return new ReadKeyExpr(this, index, type, sourceSpan);
|
|
204
|
+
}
|
|
205
|
+
callFn(params, sourceSpan, pure) {
|
|
206
|
+
return new InvokeFunctionExpr(this, params, null, sourceSpan, pure);
|
|
207
|
+
}
|
|
208
|
+
instantiate(params, type, sourceSpan) {
|
|
209
|
+
return new InstantiateExpr(this, params, type, sourceSpan);
|
|
210
|
+
}
|
|
211
|
+
conditional(trueCase, falseCase = null, sourceSpan) {
|
|
212
|
+
return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan);
|
|
213
|
+
}
|
|
214
|
+
equals(rhs, sourceSpan) {
|
|
215
|
+
return new BinaryOperatorExpr(BinaryOperator.Equals, this, rhs, null, sourceSpan);
|
|
216
|
+
}
|
|
217
|
+
notEquals(rhs, sourceSpan) {
|
|
218
|
+
return new BinaryOperatorExpr(BinaryOperator.NotEquals, this, rhs, null, sourceSpan);
|
|
219
|
+
}
|
|
220
|
+
identical(rhs, sourceSpan) {
|
|
221
|
+
return new BinaryOperatorExpr(BinaryOperator.Identical, this, rhs, null, sourceSpan);
|
|
222
|
+
}
|
|
223
|
+
notIdentical(rhs, sourceSpan) {
|
|
224
|
+
return new BinaryOperatorExpr(BinaryOperator.NotIdentical, this, rhs, null, sourceSpan);
|
|
225
|
+
}
|
|
226
|
+
minus(rhs, sourceSpan) {
|
|
227
|
+
return new BinaryOperatorExpr(BinaryOperator.Minus, this, rhs, null, sourceSpan);
|
|
228
|
+
}
|
|
229
|
+
plus(rhs, sourceSpan) {
|
|
230
|
+
return new BinaryOperatorExpr(BinaryOperator.Plus, this, rhs, null, sourceSpan);
|
|
231
|
+
}
|
|
232
|
+
divide(rhs, sourceSpan) {
|
|
233
|
+
return new BinaryOperatorExpr(BinaryOperator.Divide, this, rhs, null, sourceSpan);
|
|
234
|
+
}
|
|
235
|
+
multiply(rhs, sourceSpan) {
|
|
236
|
+
return new BinaryOperatorExpr(BinaryOperator.Multiply, this, rhs, null, sourceSpan);
|
|
237
|
+
}
|
|
238
|
+
modulo(rhs, sourceSpan) {
|
|
239
|
+
return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan);
|
|
240
|
+
}
|
|
241
|
+
power(rhs, sourceSpan) {
|
|
242
|
+
return new BinaryOperatorExpr(BinaryOperator.Exponentiation, this, rhs, null, sourceSpan);
|
|
243
|
+
}
|
|
244
|
+
and(rhs, sourceSpan) {
|
|
245
|
+
return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
|
|
246
|
+
}
|
|
247
|
+
bitwiseOr(rhs, sourceSpan) {
|
|
248
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseOr, this, rhs, null, sourceSpan);
|
|
249
|
+
}
|
|
250
|
+
bitwiseAnd(rhs, sourceSpan) {
|
|
251
|
+
return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan);
|
|
252
|
+
}
|
|
253
|
+
or(rhs, sourceSpan) {
|
|
254
|
+
return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan);
|
|
255
|
+
}
|
|
256
|
+
lower(rhs, sourceSpan) {
|
|
257
|
+
return new BinaryOperatorExpr(BinaryOperator.Lower, this, rhs, null, sourceSpan);
|
|
258
|
+
}
|
|
259
|
+
lowerEquals(rhs, sourceSpan) {
|
|
260
|
+
return new BinaryOperatorExpr(BinaryOperator.LowerEquals, this, rhs, null, sourceSpan);
|
|
261
|
+
}
|
|
262
|
+
bigger(rhs, sourceSpan) {
|
|
263
|
+
return new BinaryOperatorExpr(BinaryOperator.Bigger, this, rhs, null, sourceSpan);
|
|
264
|
+
}
|
|
265
|
+
biggerEquals(rhs, sourceSpan) {
|
|
266
|
+
return new BinaryOperatorExpr(BinaryOperator.BiggerEquals, this, rhs, null, sourceSpan);
|
|
267
|
+
}
|
|
268
|
+
isBlank(sourceSpan) {
|
|
269
|
+
// Note: We use equals by purpose here to compare to null and undefined in JS.
|
|
270
|
+
// We use the typed null to allow strictNullChecks to narrow types.
|
|
271
|
+
return this.equals(TYPED_NULL_EXPR, sourceSpan);
|
|
272
|
+
}
|
|
273
|
+
nullishCoalesce(rhs, sourceSpan) {
|
|
274
|
+
return new BinaryOperatorExpr(BinaryOperator.NullishCoalesce, this, rhs, null, sourceSpan);
|
|
275
|
+
}
|
|
276
|
+
toStmt() {
|
|
277
|
+
return new ExpressionStatement(this, null);
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
class InvokeFunctionExpr extends Expression {
|
|
281
|
+
fn;
|
|
282
|
+
args;
|
|
283
|
+
pure;
|
|
284
|
+
constructor(fn, args, type, sourceSpan, pure = false) {
|
|
285
|
+
super(type, sourceSpan);
|
|
286
|
+
this.fn = fn;
|
|
287
|
+
this.args = args;
|
|
288
|
+
this.pure = pure;
|
|
289
|
+
}
|
|
290
|
+
// An alias for fn, which allows other logic to handle calls and property reads together.
|
|
291
|
+
get receiver() {
|
|
292
|
+
return this.fn;
|
|
293
|
+
}
|
|
294
|
+
isEquivalent(e) {
|
|
295
|
+
return (e instanceof InvokeFunctionExpr &&
|
|
296
|
+
this.fn.isEquivalent(e.fn) &&
|
|
297
|
+
areAllEquivalent(this.args, e.args) &&
|
|
298
|
+
this.pure === e.pure);
|
|
299
|
+
}
|
|
300
|
+
isConstant() {
|
|
301
|
+
return false;
|
|
302
|
+
}
|
|
303
|
+
visitExpression(visitor, context) {
|
|
304
|
+
return visitor.visitInvokeFunctionExpr(this, context);
|
|
305
|
+
}
|
|
306
|
+
clone() {
|
|
307
|
+
return new InvokeFunctionExpr(this.fn.clone(), this.args.map((arg) => arg.clone()), this.type, this.sourceSpan, this.pure);
|
|
308
|
+
}
|
|
309
|
+
}
|
|
310
|
+
class InstantiateExpr extends Expression {
|
|
311
|
+
classExpr;
|
|
312
|
+
args;
|
|
313
|
+
constructor(classExpr, args, type, sourceSpan) {
|
|
314
|
+
super(type, sourceSpan);
|
|
315
|
+
this.classExpr = classExpr;
|
|
316
|
+
this.args = args;
|
|
317
|
+
}
|
|
318
|
+
isEquivalent(e) {
|
|
319
|
+
return (e instanceof InstantiateExpr &&
|
|
320
|
+
this.classExpr.isEquivalent(e.classExpr) &&
|
|
321
|
+
areAllEquivalent(this.args, e.args));
|
|
322
|
+
}
|
|
323
|
+
isConstant() {
|
|
324
|
+
return false;
|
|
325
|
+
}
|
|
326
|
+
visitExpression(visitor, context) {
|
|
327
|
+
return visitor.visitInstantiateExpr(this, context);
|
|
328
|
+
}
|
|
329
|
+
clone() {
|
|
330
|
+
return new InstantiateExpr(this.classExpr.clone(), this.args.map((arg) => arg.clone()), this.type, this.sourceSpan);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
class LiteralExpr extends Expression {
|
|
334
|
+
value;
|
|
335
|
+
constructor(value, type, sourceSpan) {
|
|
336
|
+
super(type, sourceSpan);
|
|
337
|
+
this.value = value;
|
|
338
|
+
}
|
|
339
|
+
isEquivalent(e) {
|
|
340
|
+
return e instanceof LiteralExpr && this.value === e.value;
|
|
341
|
+
}
|
|
342
|
+
isConstant() {
|
|
343
|
+
return true;
|
|
344
|
+
}
|
|
345
|
+
visitExpression(visitor, context) {
|
|
346
|
+
return visitor.visitLiteralExpr(this, context);
|
|
347
|
+
}
|
|
348
|
+
clone() {
|
|
349
|
+
return new LiteralExpr(this.value, this.type, this.sourceSpan);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
class ConditionalExpr extends Expression {
|
|
353
|
+
condition;
|
|
354
|
+
falseCase;
|
|
355
|
+
trueCase;
|
|
356
|
+
constructor(condition, trueCase, falseCase = null, type, sourceSpan) {
|
|
357
|
+
super(type || trueCase.type, sourceSpan);
|
|
358
|
+
this.condition = condition;
|
|
359
|
+
this.falseCase = falseCase;
|
|
360
|
+
this.trueCase = trueCase;
|
|
361
|
+
}
|
|
362
|
+
isEquivalent(e) {
|
|
363
|
+
return (e instanceof ConditionalExpr &&
|
|
364
|
+
this.condition.isEquivalent(e.condition) &&
|
|
365
|
+
this.trueCase.isEquivalent(e.trueCase) &&
|
|
366
|
+
nullSafeIsEquivalent(this.falseCase, e.falseCase));
|
|
367
|
+
}
|
|
368
|
+
isConstant() {
|
|
369
|
+
return false;
|
|
370
|
+
}
|
|
371
|
+
visitExpression(visitor, context) {
|
|
372
|
+
return visitor.visitConditionalExpr(this, context);
|
|
373
|
+
}
|
|
374
|
+
clone() {
|
|
375
|
+
return new ConditionalExpr(this.condition.clone(), this.trueCase.clone(), this.falseCase?.clone(), this.type, this.sourceSpan);
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
class BinaryOperatorExpr extends Expression {
|
|
379
|
+
operator;
|
|
380
|
+
rhs;
|
|
381
|
+
lhs;
|
|
382
|
+
constructor(operator, lhs, rhs, type, sourceSpan) {
|
|
383
|
+
super(type || lhs.type, sourceSpan);
|
|
384
|
+
this.operator = operator;
|
|
385
|
+
this.rhs = rhs;
|
|
386
|
+
this.lhs = lhs;
|
|
387
|
+
}
|
|
388
|
+
isEquivalent(e) {
|
|
389
|
+
return (e instanceof BinaryOperatorExpr &&
|
|
390
|
+
this.operator === e.operator &&
|
|
391
|
+
this.lhs.isEquivalent(e.lhs) &&
|
|
392
|
+
this.rhs.isEquivalent(e.rhs));
|
|
393
|
+
}
|
|
394
|
+
isConstant() {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
visitExpression(visitor, context) {
|
|
398
|
+
return visitor.visitBinaryOperatorExpr(this, context);
|
|
399
|
+
}
|
|
400
|
+
clone() {
|
|
401
|
+
return new BinaryOperatorExpr(this.operator, this.lhs.clone(), this.rhs.clone(), this.type, this.sourceSpan);
|
|
402
|
+
}
|
|
403
|
+
isAssignment() {
|
|
404
|
+
const op = this.operator;
|
|
405
|
+
return (op === BinaryOperator.Assign ||
|
|
406
|
+
op === BinaryOperator.AdditionAssignment ||
|
|
407
|
+
op === BinaryOperator.SubtractionAssignment ||
|
|
408
|
+
op === BinaryOperator.MultiplicationAssignment ||
|
|
409
|
+
op === BinaryOperator.DivisionAssignment ||
|
|
410
|
+
op === BinaryOperator.RemainderAssignment ||
|
|
411
|
+
op === BinaryOperator.ExponentiationAssignment ||
|
|
412
|
+
op === BinaryOperator.AndAssignment ||
|
|
413
|
+
op === BinaryOperator.OrAssignment ||
|
|
414
|
+
op === BinaryOperator.NullishCoalesceAssignment);
|
|
415
|
+
}
|
|
416
|
+
}
|
|
417
|
+
class ReadPropExpr extends Expression {
|
|
418
|
+
receiver;
|
|
419
|
+
name;
|
|
420
|
+
constructor(receiver, name, type, sourceSpan) {
|
|
421
|
+
super(type, sourceSpan);
|
|
422
|
+
this.receiver = receiver;
|
|
423
|
+
this.name = name;
|
|
424
|
+
}
|
|
425
|
+
// An alias for name, which allows other logic to handle property reads and keyed reads together.
|
|
426
|
+
get index() {
|
|
427
|
+
return this.name;
|
|
428
|
+
}
|
|
429
|
+
isEquivalent(e) {
|
|
430
|
+
return (e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) && this.name === e.name);
|
|
431
|
+
}
|
|
432
|
+
isConstant() {
|
|
433
|
+
return false;
|
|
434
|
+
}
|
|
435
|
+
visitExpression(visitor, context) {
|
|
436
|
+
return visitor.visitReadPropExpr(this, context);
|
|
437
|
+
}
|
|
438
|
+
set(value) {
|
|
439
|
+
return new BinaryOperatorExpr(BinaryOperator.Assign, this.receiver.prop(this.name), value, null, this.sourceSpan);
|
|
440
|
+
}
|
|
441
|
+
clone() {
|
|
442
|
+
return new ReadPropExpr(this.receiver.clone(), this.name, this.type, this.sourceSpan);
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
class ReadKeyExpr extends Expression {
|
|
446
|
+
receiver;
|
|
447
|
+
index;
|
|
448
|
+
constructor(receiver, index, type, sourceSpan) {
|
|
449
|
+
super(type, sourceSpan);
|
|
450
|
+
this.receiver = receiver;
|
|
451
|
+
this.index = index;
|
|
452
|
+
}
|
|
453
|
+
isEquivalent(e) {
|
|
454
|
+
return (e instanceof ReadKeyExpr &&
|
|
455
|
+
this.receiver.isEquivalent(e.receiver) &&
|
|
456
|
+
this.index.isEquivalent(e.index));
|
|
457
|
+
}
|
|
458
|
+
isConstant() {
|
|
459
|
+
return false;
|
|
460
|
+
}
|
|
461
|
+
visitExpression(visitor, context) {
|
|
462
|
+
return visitor.visitReadKeyExpr(this, context);
|
|
463
|
+
}
|
|
464
|
+
set(value) {
|
|
465
|
+
return new BinaryOperatorExpr(BinaryOperator.Assign, this.receiver.key(this.index), value, null, this.sourceSpan);
|
|
466
|
+
}
|
|
467
|
+
clone() {
|
|
468
|
+
return new ReadKeyExpr(this.receiver.clone(), this.index.clone(), this.type, this.sourceSpan);
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
const NULL_EXPR = new LiteralExpr(null, null, null);
|
|
472
|
+
const TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
|
|
473
|
+
//// Statements
|
|
474
|
+
var StmtModifier;
|
|
475
|
+
(function (StmtModifier) {
|
|
476
|
+
StmtModifier[StmtModifier["None"] = 0] = "None";
|
|
477
|
+
StmtModifier[StmtModifier["Final"] = 1] = "Final";
|
|
478
|
+
StmtModifier[StmtModifier["Private"] = 2] = "Private";
|
|
479
|
+
StmtModifier[StmtModifier["Exported"] = 4] = "Exported";
|
|
480
|
+
StmtModifier[StmtModifier["Static"] = 8] = "Static";
|
|
481
|
+
})(StmtModifier || (StmtModifier = {}));
|
|
482
|
+
class Statement {
|
|
483
|
+
modifiers;
|
|
484
|
+
sourceSpan;
|
|
485
|
+
leadingComments;
|
|
486
|
+
constructor(modifiers = StmtModifier.None, sourceSpan = null, leadingComments) {
|
|
487
|
+
this.modifiers = modifiers;
|
|
488
|
+
this.sourceSpan = sourceSpan;
|
|
489
|
+
this.leadingComments = leadingComments;
|
|
490
|
+
}
|
|
491
|
+
hasModifier(modifier) {
|
|
492
|
+
return (this.modifiers & modifier) !== 0;
|
|
493
|
+
}
|
|
494
|
+
addLeadingComment(leadingComment) {
|
|
495
|
+
this.leadingComments = this.leadingComments ?? [];
|
|
496
|
+
this.leadingComments.push(leadingComment);
|
|
497
|
+
}
|
|
498
|
+
}
|
|
499
|
+
class ExpressionStatement extends Statement {
|
|
500
|
+
expr;
|
|
501
|
+
constructor(expr, sourceSpan, leadingComments) {
|
|
502
|
+
super(StmtModifier.None, sourceSpan, leadingComments);
|
|
503
|
+
this.expr = expr;
|
|
504
|
+
}
|
|
505
|
+
isEquivalent(stmt) {
|
|
506
|
+
return stmt instanceof ExpressionStatement && this.expr.isEquivalent(stmt.expr);
|
|
507
|
+
}
|
|
508
|
+
visitStatement(visitor, context) {
|
|
509
|
+
return visitor.visitExpressionStmt(this, context);
|
|
510
|
+
}
|
|
511
|
+
}
|
|
512
|
+
|
|
80
513
|
/**
|
|
81
514
|
* Detects `spyOn(dirInstance, 'myInput')` calls that likely modify
|
|
82
515
|
* the input signal. There is no way to change the value inside the input signal,
|
|
@@ -135,8 +568,8 @@ function checkIncompatiblePatterns(inheritanceGraph, checker, groupedTsAstVisito
|
|
|
135
568
|
const spyOnPattern = new SpyOnFieldPattern(checker, fields);
|
|
136
569
|
const visitor = (node) => {
|
|
137
570
|
// Check for manual class instantiations.
|
|
138
|
-
if (ts.isNewExpression(node) && ts.isIdentifier(
|
|
139
|
-
let newTarget = checker.getSymbolAtLocation(
|
|
571
|
+
if (ts.isNewExpression(node) && ts.isIdentifier(migrations.unwrapExpression(node.expression))) {
|
|
572
|
+
let newTarget = checker.getSymbolAtLocation(migrations.unwrapExpression(node.expression));
|
|
140
573
|
// Plain identifier references can point to alias symbols (e.g. imports).
|
|
141
574
|
if (newTarget !== undefined && newTarget.flags & ts.SymbolFlags.Alias) {
|
|
142
575
|
newTarget = checker.getAliasedSymbol(newTarget);
|
|
@@ -155,7 +588,7 @@ function checkIncompatiblePatterns(inheritanceGraph, checker, groupedTsAstVisito
|
|
|
155
588
|
problematicReferencesCheck: if (insidePropertyDeclaration !== null &&
|
|
156
589
|
ts.isIdentifier(node) &&
|
|
157
590
|
insidePropertyDeclaration.parent.heritageClauses !== undefined) {
|
|
158
|
-
let newTarget = checker.getSymbolAtLocation(
|
|
591
|
+
let newTarget = checker.getSymbolAtLocation(migrations.unwrapExpression(node));
|
|
159
592
|
// Plain identifier references can point to alias symbols (e.g. imports).
|
|
160
593
|
if (newTarget !== undefined && newTarget.flags & ts.SymbolFlags.Alias) {
|
|
161
594
|
newTarget = checker.getAliasedSymbol(newTarget);
|
|
@@ -384,7 +817,7 @@ function checkInheritanceOfKnownFields(inheritanceGraph, metaRegistry, fields, o
|
|
|
384
817
|
if (metaRegistry !== null) {
|
|
385
818
|
for (const derivedClasses of inheritanceGraph.traceDerivedClasses(inputClass)) {
|
|
386
819
|
const derivedMeta = ts.isClassDeclaration(derivedClasses) && derivedClasses.name !== undefined
|
|
387
|
-
? metaRegistry.getDirectiveMetadata(new
|
|
820
|
+
? metaRegistry.getDirectiveMetadata(new migrations.Reference(derivedClasses))
|
|
388
821
|
: null;
|
|
389
822
|
if (derivedMeta !== null && derivedMeta.inputFieldNamesFromMetadataArray !== null) {
|
|
390
823
|
derivedMeta.inputFieldNamesFromMetadataArray.forEach((b) => inputFieldNamesFromMetadataArray.add(b));
|
|
@@ -430,18 +863,6 @@ function checkInheritanceOfKnownFields(inheritanceGraph, metaRegistry, fields, o
|
|
|
430
863
|
}
|
|
431
864
|
}
|
|
432
865
|
|
|
433
|
-
function removeFromUnionIfPossible(union, filter) {
|
|
434
|
-
const filtered = union.types.filter(filter);
|
|
435
|
-
if (filtered.length === union.types.length) {
|
|
436
|
-
return union;
|
|
437
|
-
}
|
|
438
|
-
// If there is only item at this point, avoid the union structure.
|
|
439
|
-
if (filtered.length === 1) {
|
|
440
|
-
return filtered[0];
|
|
441
|
-
}
|
|
442
|
-
return ts.factory.updateUnionTypeNode(union, ts.factory.createNodeArray(filtered));
|
|
443
|
-
}
|
|
444
|
-
|
|
445
866
|
/**
|
|
446
867
|
* Inserts a leading string for the given node, respecting
|
|
447
868
|
* indentation of the given anchor node.
|
|
@@ -482,6 +903,18 @@ function cutStringToLineLimit(str, limit) {
|
|
|
482
903
|
return chunks;
|
|
483
904
|
}
|
|
484
905
|
|
|
906
|
+
function removeFromUnionIfPossible(union, filter) {
|
|
907
|
+
const filtered = union.types.filter(filter);
|
|
908
|
+
if (filtered.length === union.types.length) {
|
|
909
|
+
return union;
|
|
910
|
+
}
|
|
911
|
+
// If there is only item at this point, avoid the union structure.
|
|
912
|
+
if (filtered.length === 1) {
|
|
913
|
+
return filtered[0];
|
|
914
|
+
}
|
|
915
|
+
return ts.factory.updateUnionTypeNode(union, ts.factory.createNodeArray(filtered));
|
|
916
|
+
}
|
|
917
|
+
|
|
485
918
|
/**
|
|
486
919
|
* Gets human-readable message information for the given field incompatibility.
|
|
487
920
|
* This text will be used by the language service, or CLI-based migration.
|
|
@@ -1521,6 +1954,7 @@ function migrateTypeScriptTypeReferences(host, references, importManager, info)
|
|
|
1521
1954
|
|
|
1522
1955
|
exports.GroupedTsAstVisitor = GroupedTsAstVisitor;
|
|
1523
1956
|
exports.InheritanceGraph = InheritanceGraph;
|
|
1957
|
+
exports.NULL_EXPR = NULL_EXPR;
|
|
1524
1958
|
exports.checkIncompatiblePatterns = checkIncompatiblePatterns;
|
|
1525
1959
|
exports.checkInheritanceOfKnownFields = checkInheritanceOfKnownFields;
|
|
1526
1960
|
exports.cutStringToLineLimit = cutStringToLineLimit;
|
package/schematics/bundles/{ng_component_template-BRbBIAUX.cjs → ng_component_template-Dsuq1Lw7.cjs}
RENAMED
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-
|
|
3
|
+
* @license Angular v21.0.0-rc.0
|
|
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
|
|
10
|
+
var compilerCli = require('@angular/compiler-cli');
|
|
11
|
+
var ng_decorators = require('./ng_decorators-DSFlWYQY.cjs');
|
|
11
12
|
var property_name = require('./property_name-BBwFuqMe.cjs');
|
|
12
|
-
require('os');
|
|
13
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-CiBzGSIa.cjs');
|
|
14
13
|
|
|
15
14
|
/**
|
|
16
15
|
* Unwraps a given expression TypeScript node. Expressions can be wrapped within multiple
|
|
@@ -116,7 +115,7 @@ function findClosestLineStartPosition(linesMap, position, low = 0, high = linesM
|
|
|
116
115
|
class NgComponentTemplateVisitor {
|
|
117
116
|
typeChecker;
|
|
118
117
|
resolvedTemplates = [];
|
|
119
|
-
fs =
|
|
118
|
+
fs = compilerCli.getFileSystem();
|
|
120
119
|
constructor(typeChecker) {
|
|
121
120
|
this.typeChecker = typeChecker;
|
|
122
121
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v21.0.0-
|
|
3
|
+
* @license Angular v21.0.0-rc.0
|
|
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-DP72APSx.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
|