@angular/core 20.0.0-next.1 → 20.0.0-next.3
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/core.mjs +770 -2144
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/primitives/di.mjs +3 -2
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +2 -589
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +44 -13
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +7 -39
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +116 -143
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/weak_ref-DrMdAIDh.mjs +12 -0
- package/fesm2022/weak_ref-DrMdAIDh.mjs.map +1 -0
- package/index.d.ts +14366 -15214
- package/navigation_types.d-u4EOrrdZ.d.ts +121 -0
- package/package.json +2 -2
- package/primitives/di/index.d.ts +66 -59
- package/primitives/event-dispatch/index.d.ts +205 -309
- package/primitives/signals/index.d.ts +161 -195
- package/rxjs-interop/index.d.ts +71 -100
- package/schematics/bundles/{apply_import_manager-e2a7fe5b.js → apply_import_manager-BXQEjo09.js} +15 -19
- package/schematics/bundles/{checker-af521da6.js → checker-BHb19MHt.js} +3695 -1175
- package/schematics/bundles/cleanup-unused-imports.js +56 -89
- package/schematics/bundles/{compiler_host-5a29293c.js → compiler_host-Bk3repE2.js} +19 -23
- package/schematics/bundles/control-flow-migration.js +81 -38
- package/schematics/bundles/{imports-047fbbc8.js → imports-CIX-JgAN.js} +9 -14
- package/schematics/bundles/{index-1bef3025.js → index-BL9kAIe5.js} +62 -66
- package/schematics/bundles/{program-a449f9bf.js → index-I8VbxQcO.js} +1508 -3178
- package/schematics/bundles/inject-flags.js +147 -0
- package/schematics/bundles/inject-migration.js +121 -127
- package/schematics/bundles/{leading_space-f8944434.js → leading_space-D9nQ8UQC.js} +1 -1
- package/schematics/bundles/{migrate_ts_type_references-2a3e9e6b.js → migrate_ts_type_references-KlOTWeDl.js} +121 -126
- package/schematics/bundles/{ng_decorators-b0d8b324.js → ng_decorators-DznZ5jMl.js} +4 -8
- package/schematics/bundles/{nodes-7758dbf6.js → nodes-B16H9JUd.js} +2 -6
- package/schematics/bundles/output-migration.js +94 -128
- package/schematics/bundles/{project_tsconfig_paths-b558633b.js → project_tsconfig_paths-CDVxT6Ov.js} +1 -1
- package/schematics/bundles/{property_name-ac18447e.js → property_name-BBwFuqMe.js} +3 -7
- package/schematics/bundles/route-lazy-loading.js +35 -41
- package/schematics/bundles/{project_paths-17dc204d.js → run_in_devkit-C0JPtK2u.js} +283 -216
- package/schematics/bundles/self-closing-tags-migration.js +55 -91
- package/schematics/bundles/signal-input-migration.js +121 -156
- package/schematics/bundles/signal-queries-migration.js +119 -154
- package/schematics/bundles/signals.js +12 -14
- package/schematics/bundles/standalone-migration.js +180 -200
- package/schematics/bundles/symbol-VPWguRxr.js +25 -0
- package/schematics/bundles/test-bed-get.js +98 -0
- package/schematics/migrations.json +8 -14
- package/testing/index.d.ts +289 -471
- package/weak_ref.d-ttyj86RV.d.ts +9 -0
- package/schematics/bundles/explicit-standalone-flag.js +0 -184
- package/schematics/bundles/index-ef1bffbb.js +0 -30
- package/schematics/bundles/pending-tasks.js +0 -103
- package/schematics/bundles/provide-initializer.js +0 -186
|
@@ -1,36 +1,29 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.3
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
var schematics = require('@angular-devkit/schematics');
|
|
12
|
-
var project_tsconfig_paths = require('./project_tsconfig_paths-b558633b.js');
|
|
13
|
-
var project_paths = require('./project_paths-17dc204d.js');
|
|
14
|
-
require('os');
|
|
9
|
+
var checker = require('./checker-BHb19MHt.js');
|
|
15
10
|
var ts = require('typescript');
|
|
16
|
-
|
|
17
|
-
var
|
|
11
|
+
require('os');
|
|
12
|
+
var index$1 = require('./index-I8VbxQcO.js');
|
|
18
13
|
require('path');
|
|
19
|
-
var
|
|
20
|
-
var
|
|
14
|
+
var run_in_devkit = require('./run_in_devkit-C0JPtK2u.js');
|
|
15
|
+
var apply_import_manager = require('./apply_import_manager-BXQEjo09.js');
|
|
16
|
+
var migrate_ts_type_references = require('./migrate_ts_type_references-KlOTWeDl.js');
|
|
21
17
|
var assert = require('assert');
|
|
22
|
-
var index = require('./index-
|
|
18
|
+
var index = require('./index-BL9kAIe5.js');
|
|
23
19
|
require('@angular-devkit/core');
|
|
24
20
|
require('node:path/posix');
|
|
25
21
|
require('fs');
|
|
26
22
|
require('module');
|
|
27
23
|
require('url');
|
|
28
|
-
require('
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
var ts__default = /*#__PURE__*/_interopDefaultLegacy(ts);
|
|
33
|
-
var assert__default = /*#__PURE__*/_interopDefaultLegacy(assert);
|
|
24
|
+
require('@angular-devkit/schematics');
|
|
25
|
+
require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
26
|
+
require('./leading_space-D9nQ8UQC.js');
|
|
34
27
|
|
|
35
28
|
/**
|
|
36
29
|
* Phase that migrates Angular host binding references to
|
|
@@ -64,7 +57,7 @@ function migrateHostBindings(host, references, info) {
|
|
|
64
57
|
const appendText = reference.from.isObjectShorthandExpression
|
|
65
58
|
? `: ${reference.from.read.name}()`
|
|
66
59
|
: `()`;
|
|
67
|
-
host.replacements.push(new
|
|
60
|
+
host.replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(bindingField.getSourceFile(), info), new run_in_devkit.TextUpdate({ position: readEndPos, end: readEndPos, toInsert: appendText })));
|
|
68
61
|
}
|
|
69
62
|
}
|
|
70
63
|
|
|
@@ -93,7 +86,7 @@ function migrateTemplateReferences(host, references) {
|
|
|
93
86
|
const appendText = reference.from.isObjectShorthandExpression
|
|
94
87
|
? `: ${reference.from.read.name}()`
|
|
95
88
|
: `()`;
|
|
96
|
-
host.replacements.push(new
|
|
89
|
+
host.replacements.push(new run_in_devkit.Replacement(reference.from.templateFile, new run_in_devkit.TextUpdate({
|
|
97
90
|
position: reference.from.read.sourceSpan.end,
|
|
98
91
|
end: reference.from.read.sourceSpan.end,
|
|
99
92
|
toInsert: appendText,
|
|
@@ -106,14 +99,14 @@ function migrateTemplateReferences(host, references) {
|
|
|
106
99
|
*/
|
|
107
100
|
function extractQueryListType(node) {
|
|
108
101
|
// Initializer variant of `new QueryList<T>()`.
|
|
109
|
-
if (
|
|
110
|
-
|
|
102
|
+
if (ts.isNewExpression(node) &&
|
|
103
|
+
ts.isIdentifier(node.expression) &&
|
|
111
104
|
node.expression.text === 'QueryList') {
|
|
112
105
|
return node.typeArguments?.[0];
|
|
113
106
|
}
|
|
114
107
|
// Type variant of `: QueryList<T>`.
|
|
115
|
-
if (
|
|
116
|
-
|
|
108
|
+
if (ts.isTypeReferenceNode(node) &&
|
|
109
|
+
ts.isIdentifier(node.typeName) &&
|
|
117
110
|
node.typeName.text === 'QueryList') {
|
|
118
111
|
return node.typeArguments?.[0];
|
|
119
112
|
}
|
|
@@ -166,14 +159,14 @@ function computeReplacementsToMigrateQuery(node, metadata, importManager, info,
|
|
|
166
159
|
}
|
|
167
160
|
}
|
|
168
161
|
if (metadata.queryInfo.read !== null) {
|
|
169
|
-
|
|
170
|
-
optionProperties.push(
|
|
162
|
+
assert(metadata.queryInfo.read instanceof checker.WrappedNodeExpr);
|
|
163
|
+
optionProperties.push(ts.factory.createPropertyAssignment('read', metadata.queryInfo.read.node));
|
|
171
164
|
}
|
|
172
165
|
if (metadata.queryInfo.descendants !== defaultDescendants) {
|
|
173
|
-
optionProperties.push(
|
|
166
|
+
optionProperties.push(ts.factory.createPropertyAssignment('descendants', metadata.queryInfo.descendants ? ts.factory.createTrue() : ts.factory.createFalse()));
|
|
174
167
|
}
|
|
175
168
|
if (optionProperties.length > 0) {
|
|
176
|
-
args.push(
|
|
169
|
+
args.push(ts.factory.createObjectLiteralExpression(optionProperties));
|
|
177
170
|
}
|
|
178
171
|
const strictNullChecksEnabled = options.strict === true || options.strictNullChecks === true;
|
|
179
172
|
const strictPropertyInitialization = options.strict === true || options.strictPropertyInitialization === true;
|
|
@@ -196,12 +189,12 @@ function computeReplacementsToMigrateQuery(node, metadata, importManager, info,
|
|
|
196
189
|
if (isRequired && metadata.queryInfo.first) {
|
|
197
190
|
// If the query is required already via some indicators, and this is a "single"
|
|
198
191
|
// query, use the available `.required` method.
|
|
199
|
-
newQueryFn =
|
|
192
|
+
newQueryFn = ts.factory.createPropertyAccessExpression(newQueryFn, 'required');
|
|
200
193
|
}
|
|
201
194
|
// If this query is still nullable (i.e. not required), attempt to remove
|
|
202
195
|
// explicit `undefined` types if possible.
|
|
203
|
-
if (!isRequired && type !== undefined &&
|
|
204
|
-
type = migrate_ts_type_references.removeFromUnionIfPossible(type, (v) => v.kind !==
|
|
196
|
+
if (!isRequired && type !== undefined && ts.isUnionTypeNode(type)) {
|
|
197
|
+
type = migrate_ts_type_references.removeFromUnionIfPossible(type, (v) => v.kind !== ts.SyntaxKind.UndefinedKeyword);
|
|
205
198
|
}
|
|
206
199
|
let locatorType = Array.isArray(metadata.queryInfo.predicate)
|
|
207
200
|
? null
|
|
@@ -211,23 +204,23 @@ function computeReplacementsToMigrateQuery(node, metadata, importManager, info,
|
|
|
211
204
|
// on the TS inference, instead of repeating types, like in `viewChild<Button>(Button)`.
|
|
212
205
|
if (type !== undefined &&
|
|
213
206
|
resolvedReadType instanceof checker.WrappedNodeExpr &&
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
207
|
+
ts.isIdentifier(resolvedReadType.node) &&
|
|
208
|
+
ts.isTypeReferenceNode(type) &&
|
|
209
|
+
ts.isIdentifier(type.typeName) &&
|
|
217
210
|
type.typeName.text === resolvedReadType.node.text) {
|
|
218
211
|
locatorType = null;
|
|
219
212
|
}
|
|
220
|
-
const call =
|
|
213
|
+
const call = ts.factory.createCallExpression(newQueryFn,
|
|
221
214
|
// If there is no resolved `ReadT` (e.g. string predicate), we use the
|
|
222
215
|
// original type explicitly as generic. Otherwise, query API is smart
|
|
223
216
|
// enough to always infer.
|
|
224
217
|
resolvedReadType === null && type !== undefined ? [type] : undefined, args);
|
|
225
|
-
const updated =
|
|
218
|
+
const updated = ts.factory.createPropertyDeclaration([ts.factory.createModifier(ts.SyntaxKind.ReadonlyKeyword)], node.name, undefined, undefined, call);
|
|
226
219
|
return [
|
|
227
|
-
new
|
|
220
|
+
new run_in_devkit.Replacement(run_in_devkit.projectFile(node.getSourceFile(), info), new run_in_devkit.TextUpdate({
|
|
228
221
|
position: node.getStart(),
|
|
229
222
|
end: node.getEnd(),
|
|
230
|
-
toInsert: printer.printNode(
|
|
223
|
+
toInsert: printer.printNode(ts.EmitHint.Unspecified, updated, sf),
|
|
231
224
|
})),
|
|
232
225
|
];
|
|
233
226
|
}
|
|
@@ -238,7 +231,7 @@ function computeReplacementsToMigrateQuery(node, metadata, importManager, info,
|
|
|
238
231
|
*/
|
|
239
232
|
function getClassFieldDescriptorForSymbol(symbol, info) {
|
|
240
233
|
if (symbol?.valueDeclaration === undefined ||
|
|
241
|
-
!
|
|
234
|
+
!ts.isPropertyDeclaration(symbol.valueDeclaration)) {
|
|
242
235
|
return null;
|
|
243
236
|
}
|
|
244
237
|
const key = getUniqueIDForClassProperty(symbol.valueDeclaration, info);
|
|
@@ -259,13 +252,13 @@ function getClassFieldDescriptorForSymbol(symbol, info) {
|
|
|
259
252
|
* would then match identity.
|
|
260
253
|
*/
|
|
261
254
|
function getUniqueIDForClassProperty(property, info) {
|
|
262
|
-
if (!
|
|
255
|
+
if (!ts.isClassDeclaration(property.parent) || property.parent.name === undefined) {
|
|
263
256
|
return null;
|
|
264
257
|
}
|
|
265
258
|
if (property.name === undefined) {
|
|
266
259
|
return null;
|
|
267
260
|
}
|
|
268
|
-
const id =
|
|
261
|
+
const id = run_in_devkit.projectFile(property.getSourceFile(), info).id.replace(/\.d\.ts$/, '.ts');
|
|
269
262
|
// Note: If a class is nested, there could be an ID clash.
|
|
270
263
|
// This is highly unlikely though, and this is not a problem because
|
|
271
264
|
// in such cases, there is even less chance there are any references to
|
|
@@ -279,14 +272,14 @@ function getUniqueIDForClassProperty(property, info) {
|
|
|
279
272
|
* returns its resolved metadata if possible.
|
|
280
273
|
*/
|
|
281
274
|
function extractSourceQueryDefinition(node, reflector, evaluator, info) {
|
|
282
|
-
if ((!
|
|
283
|
-
!
|
|
275
|
+
if ((!ts.isPropertyDeclaration(node) && !ts.isAccessor(node)) ||
|
|
276
|
+
!ts.isClassDeclaration(node.parent) ||
|
|
284
277
|
node.parent.name === undefined ||
|
|
285
|
-
!
|
|
278
|
+
!ts.isIdentifier(node.name)) {
|
|
286
279
|
return null;
|
|
287
280
|
}
|
|
288
281
|
const decorators = reflector.getDecoratorsOfDeclaration(node) ?? [];
|
|
289
|
-
const ngDecorators = checker.getAngularDecorators(decorators,
|
|
282
|
+
const ngDecorators = checker.getAngularDecorators(decorators, checker.queryDecoratorNames, /* isCore */ false);
|
|
290
283
|
if (ngDecorators.length === 0) {
|
|
291
284
|
return null;
|
|
292
285
|
}
|
|
@@ -313,7 +306,7 @@ function extractSourceQueryDefinition(node, reflector, evaluator, info) {
|
|
|
313
306
|
}
|
|
314
307
|
let queryInfo = null;
|
|
315
308
|
try {
|
|
316
|
-
queryInfo =
|
|
309
|
+
queryInfo = checker.extractDecoratorQueryMetadata(node, decorator.name, decorator.args ?? [], node.name.text, reflector, evaluator);
|
|
317
310
|
}
|
|
318
311
|
catch (e) {
|
|
319
312
|
if (!(e instanceof checker.FatalDiagnosticError)) {
|
|
@@ -389,7 +382,7 @@ class KnownQueries {
|
|
|
389
382
|
});
|
|
390
383
|
this.knownQueryIDs.set(id, { key: id, node: queryField });
|
|
391
384
|
const descriptor = { key: id, node: queryField };
|
|
392
|
-
const file =
|
|
385
|
+
const file = run_in_devkit.projectFile(queryField.getSourceFile(), this.info);
|
|
393
386
|
if (this.config.shouldMigrateQuery !== undefined &&
|
|
394
387
|
!this.config.shouldMigrateQuery(descriptor, file)) {
|
|
395
388
|
this.markFieldIncompatible(descriptor, {
|
|
@@ -412,7 +405,7 @@ class KnownQueries {
|
|
|
412
405
|
return this.classToQueryFields.get(clazz);
|
|
413
406
|
}
|
|
414
407
|
getAllClassesWithQueries() {
|
|
415
|
-
return Array.from(this.classToQueryFields.keys()).filter((c) =>
|
|
408
|
+
return Array.from(this.classToQueryFields.keys()).filter((c) => ts.isClassDeclaration(c));
|
|
416
409
|
}
|
|
417
410
|
captureKnownFieldInheritanceRelationship(derived, parent) {
|
|
418
411
|
// Note: The edge problematic pattern recognition is not as good as the one
|
|
@@ -505,8 +498,8 @@ function queryFunctionNameToDecorator(name) {
|
|
|
505
498
|
function checkTsReferenceAccessesField(ref, fieldName) {
|
|
506
499
|
const accessNode = index.traverseAccess(ref.from.node);
|
|
507
500
|
// Check if the reference is part of a property access.
|
|
508
|
-
if (!
|
|
509
|
-
!
|
|
501
|
+
if (!ts.isPropertyAccessExpression(accessNode.parent) ||
|
|
502
|
+
!ts.isIdentifier(accessNode.parent.name)) {
|
|
510
503
|
return null;
|
|
511
504
|
}
|
|
512
505
|
// Check if the reference is refers to the given field name.
|
|
@@ -543,7 +536,7 @@ function checkTsReferenceCallsField(ref, fieldName) {
|
|
|
543
536
|
if (propertyAccess === null) {
|
|
544
537
|
return null;
|
|
545
538
|
}
|
|
546
|
-
if (
|
|
539
|
+
if (ts.isCallExpression(propertyAccess.parent) &&
|
|
547
540
|
propertyAccess.parent.expression === propertyAccess) {
|
|
548
541
|
return propertyAccess.parent;
|
|
549
542
|
}
|
|
@@ -588,7 +581,7 @@ function removeQueryListToArrayCall(ref, info, globalMetadata, knownQueries, rep
|
|
|
588
581
|
return;
|
|
589
582
|
}
|
|
590
583
|
const toArrayExpr = toArrayCallExpr.expression;
|
|
591
|
-
replacements.push(new
|
|
584
|
+
replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(toArrayExpr.getSourceFile(), info), new run_in_devkit.TextUpdate({
|
|
592
585
|
// Delete from expression end to call end. E.g. `.toArray(<..>)`.
|
|
593
586
|
position: toArrayExpr.expression.getEnd(),
|
|
594
587
|
end: toArrayCallExpr.getEnd(),
|
|
@@ -603,7 +596,7 @@ function removeQueryListToArrayCall(ref, info, globalMetadata, knownQueries, rep
|
|
|
603
596
|
}
|
|
604
597
|
const file = index.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
|
|
605
598
|
const offset = index.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
|
|
606
|
-
replacements.push(new
|
|
599
|
+
replacements.push(new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
607
600
|
// Delete from expression end to call end. E.g. `.toArray(<..>)`.
|
|
608
601
|
position: offset + callExpr.receiver.receiver.sourceSpan.end,
|
|
609
602
|
end: offset + callExpr.sourceSpan.end,
|
|
@@ -627,7 +620,7 @@ function replaceQueryListGetCall(ref, info, globalMetadata, knownQueries, replac
|
|
|
627
620
|
return;
|
|
628
621
|
}
|
|
629
622
|
const getExpr = getCallExpr.expression;
|
|
630
|
-
replacements.push(new
|
|
623
|
+
replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(getExpr.getSourceFile(), info), new run_in_devkit.TextUpdate({
|
|
631
624
|
position: getExpr.name.getStart(),
|
|
632
625
|
end: getExpr.name.getEnd(),
|
|
633
626
|
toInsert: 'at',
|
|
@@ -641,7 +634,7 @@ function replaceQueryListGetCall(ref, info, globalMetadata, knownQueries, replac
|
|
|
641
634
|
}
|
|
642
635
|
const file = index.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
|
|
643
636
|
const offset = index.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
|
|
644
|
-
replacements.push(new
|
|
637
|
+
replacements.push(new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
645
638
|
position: offset + callExpr.receiver.nameSpan.start,
|
|
646
639
|
end: offset + callExpr.receiver.nameSpan.end,
|
|
647
640
|
toInsert: 'at',
|
|
@@ -696,7 +689,7 @@ function replaceQueryListFirstAndLastReferences(ref, info, globalMetadata, known
|
|
|
696
689
|
if (expr === null) {
|
|
697
690
|
return;
|
|
698
691
|
}
|
|
699
|
-
replacements.push(new
|
|
692
|
+
replacements.push(new run_in_devkit.Replacement(run_in_devkit.projectFile(expr.getSourceFile(), info), new run_in_devkit.TextUpdate({
|
|
700
693
|
position: expr.name.getStart(),
|
|
701
694
|
end: expr.name.getEnd(),
|
|
702
695
|
toInsert: mapping.get(expr.name.text),
|
|
@@ -710,14 +703,14 @@ function replaceQueryListFirstAndLastReferences(ref, info, globalMetadata, known
|
|
|
710
703
|
}
|
|
711
704
|
const file = index.isHostBindingReference(ref) ? ref.from.file : ref.from.templateFile;
|
|
712
705
|
const offset = index.isHostBindingReference(ref) ? ref.from.hostPropertyNode.getStart() + 1 : 0;
|
|
713
|
-
replacements.push(new
|
|
706
|
+
replacements.push(new run_in_devkit.Replacement(file, new run_in_devkit.TextUpdate({
|
|
714
707
|
position: offset + expr.nameSpan.start,
|
|
715
708
|
end: offset + expr.nameSpan.end,
|
|
716
709
|
toInsert: mapping.get(expr.name),
|
|
717
710
|
})));
|
|
718
711
|
}
|
|
719
712
|
|
|
720
|
-
class SignalQueriesMigration extends
|
|
713
|
+
class SignalQueriesMigration extends run_in_devkit.TsurgeComplexMigration {
|
|
721
714
|
config;
|
|
722
715
|
constructor(config = {}) {
|
|
723
716
|
super();
|
|
@@ -733,10 +726,10 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
733
726
|
if (templateTypeChecker !== null) {
|
|
734
727
|
templateTypeChecker.generateAllTypeCheckBlocks();
|
|
735
728
|
}
|
|
736
|
-
const { sourceFiles, program
|
|
737
|
-
const checker$1 = program
|
|
729
|
+
const { sourceFiles, program } = info;
|
|
730
|
+
const checker$1 = program.getTypeChecker();
|
|
738
731
|
const reflector = new checker.TypeScriptReflectionHost(checker$1);
|
|
739
|
-
const evaluator = new
|
|
732
|
+
const evaluator = new index$1.PartialEvaluator(reflector, checker$1, null);
|
|
740
733
|
const res = {
|
|
741
734
|
knownQueryFields: {},
|
|
742
735
|
potentialProblematicQueries: {},
|
|
@@ -755,7 +748,7 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
755
748
|
key: extractedQuery.id,
|
|
756
749
|
node: queryNode,
|
|
757
750
|
};
|
|
758
|
-
const containingFile =
|
|
751
|
+
const containingFile = run_in_devkit.projectFile(queryNode.getSourceFile(), info);
|
|
759
752
|
// If we have a config filter function, use it here for later
|
|
760
753
|
// perf-boosted reference lookups. Useful in non-batch mode.
|
|
761
754
|
if (this.config.shouldMigrateQuery === undefined ||
|
|
@@ -769,17 +762,17 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
769
762
|
fieldName: extractedQuery.queryInfo.propertyName,
|
|
770
763
|
isMulti: extractedQuery.queryInfo.first === false,
|
|
771
764
|
};
|
|
772
|
-
if (
|
|
765
|
+
if (ts.isAccessor(queryNode)) {
|
|
773
766
|
markFieldIncompatibleInMetadata(res.potentialProblematicQueries, extractedQuery.id, migrate_ts_type_references.FieldIncompatibilityReason.Accessor);
|
|
774
767
|
}
|
|
775
768
|
// Detect queries with union types that are uncommon to be
|
|
776
769
|
// automatically migrate-able. E.g. `refs: ElementRef|null`,
|
|
777
770
|
// or `ElementRef|SomeOtherType`.
|
|
778
771
|
if (queryNode.type !== undefined &&
|
|
779
|
-
|
|
772
|
+
ts.isUnionTypeNode(queryNode.type) &&
|
|
780
773
|
// Either too large union, or doesn't match `T|undefined`.
|
|
781
774
|
(queryNode.type.types.length > 2 ||
|
|
782
|
-
!queryNode.type.types.some((t) => t.kind ===
|
|
775
|
+
!queryNode.type.types.some((t) => t.kind === ts.SyntaxKind.UndefinedKeyword))) {
|
|
783
776
|
markFieldIncompatibleInMetadata(res.potentialProblematicQueries, extractedQuery.id, migrate_ts_type_references.FieldIncompatibilityReason.SignalQueries__IncompatibleMultiUnionType);
|
|
784
777
|
}
|
|
785
778
|
// Migrating fields with `@HostBinding` is incompatible as
|
|
@@ -859,7 +852,7 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
859
852
|
if (this.config.assumeNonBatch) {
|
|
860
853
|
res.reusableAnalysisReferences = referenceResult.references;
|
|
861
854
|
}
|
|
862
|
-
return
|
|
855
|
+
return run_in_devkit.confirmAsSerializable(res);
|
|
863
856
|
}
|
|
864
857
|
async combine(unitA, unitB) {
|
|
865
858
|
const combined = {
|
|
@@ -899,7 +892,7 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
899
892
|
}
|
|
900
893
|
}
|
|
901
894
|
}
|
|
902
|
-
return
|
|
895
|
+
return run_in_devkit.confirmAsSerializable(combined);
|
|
903
896
|
}
|
|
904
897
|
async globalMeta(combinedData) {
|
|
905
898
|
const globalUnitData = {
|
|
@@ -912,7 +905,7 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
912
905
|
markFieldIncompatibleInMetadata(globalUnitData.problematicQueries, id, migrate_ts_type_references.FieldIncompatibilityReason.SignalQueries__QueryListProblematicFieldAccessed);
|
|
913
906
|
}
|
|
914
907
|
}
|
|
915
|
-
return
|
|
908
|
+
return run_in_devkit.confirmAsSerializable(globalUnitData);
|
|
916
909
|
}
|
|
917
910
|
async migrate(globalMetadata, info) {
|
|
918
911
|
// Pre-Analyze the program and get access to the template type checker.
|
|
@@ -921,13 +914,13 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
921
914
|
metaReader: null,
|
|
922
915
|
};
|
|
923
916
|
const resourceLoader = info.ngCompiler?.['resourceManager'] ?? null;
|
|
924
|
-
const { program
|
|
925
|
-
const checker$1 = program
|
|
917
|
+
const { program, sourceFiles } = info;
|
|
918
|
+
const checker$1 = program.getTypeChecker();
|
|
926
919
|
const reflector = new checker.TypeScriptReflectionHost(checker$1);
|
|
927
|
-
const evaluator = new
|
|
920
|
+
const evaluator = new index$1.PartialEvaluator(reflector, checker$1, null);
|
|
928
921
|
const replacements = [];
|
|
929
922
|
const importManager = new checker.ImportManager();
|
|
930
|
-
const printer =
|
|
923
|
+
const printer = ts.createPrinter();
|
|
931
924
|
const filesWithSourceQueries = new Map();
|
|
932
925
|
const filesWithIncompleteMigration = new Map();
|
|
933
926
|
const filesWithQueryListOutsideOfDeclarations = new WeakSet();
|
|
@@ -944,8 +937,8 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
944
937
|
return;
|
|
945
938
|
}
|
|
946
939
|
// Detect OTHER queries, inside `.d.ts`. Needed for reference resolution below.
|
|
947
|
-
if (
|
|
948
|
-
(
|
|
940
|
+
if (ts.isPropertyDeclaration(node) ||
|
|
941
|
+
(ts.isAccessor(node) && ts.isClassDeclaration(node.parent))) {
|
|
949
942
|
const classFieldID = getUniqueIDForClassProperty(node, info);
|
|
950
943
|
if (classFieldID !== null && globalMetadata.knownQueryFields[classFieldID] !== undefined) {
|
|
951
944
|
knownQueries.registerQueryField(node, classFieldID);
|
|
@@ -954,15 +947,15 @@ class SignalQueriesMigration extends project_paths.TsurgeComplexMigration {
|
|
|
954
947
|
}
|
|
955
948
|
// Detect potential usages of `QueryList` outside of queries or imports.
|
|
956
949
|
// Those prevent us from removing the import later.
|
|
957
|
-
if (
|
|
950
|
+
if (ts.isIdentifier(node) &&
|
|
958
951
|
node.text === 'QueryList' &&
|
|
959
|
-
|
|
952
|
+
ts.findAncestor(node, ts.isImportDeclaration) === undefined) {
|
|
960
953
|
filesWithQueryListOutsideOfDeclarations.add(node.getSourceFile());
|
|
961
954
|
}
|
|
962
|
-
|
|
955
|
+
ts.forEachChild(node, queryWholeProgramVisitor);
|
|
963
956
|
};
|
|
964
957
|
for (const sf of info.fullProgramSourceFiles) {
|
|
965
|
-
|
|
958
|
+
ts.forEachChild(sf, queryWholeProgramVisitor);
|
|
966
959
|
}
|
|
967
960
|
// Set of all queries in the program. Useful for speeding up reference
|
|
968
961
|
// lookups below.
|
|
@@ -1113,84 +1106,56 @@ function updateFileState(stateMap, node, queryType) {
|
|
|
1113
1106
|
|
|
1114
1107
|
function migrate(options) {
|
|
1115
1108
|
return async (tree, context) => {
|
|
1116
|
-
|
|
1117
|
-
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1109
|
+
await run_in_devkit.runMigrationInDevkit({
|
|
1110
|
+
tree,
|
|
1111
|
+
getMigration: (fs) => new SignalQueriesMigration({
|
|
1112
|
+
bestEffortMode: options.bestEffortMode,
|
|
1113
|
+
insertTodosForSkippedFields: options.insertTodos,
|
|
1114
|
+
shouldMigrateQuery: (_query, file) => {
|
|
1115
|
+
return (file.rootRelativePath.startsWith(fs.normalize(options.path)) &&
|
|
1116
|
+
!/(^|\/)node_modules\//.test(file.rootRelativePath));
|
|
1117
|
+
},
|
|
1118
|
+
}),
|
|
1119
|
+
beforeProgramCreation: (tsconfigPath) => {
|
|
1120
|
+
context.logger.info(`Preparing analysis for: ${tsconfigPath}...`);
|
|
1128
1121
|
},
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
const info = migration.prepareProgram(baseInfo);
|
|
1136
|
-
// Support restricting the analysis to subfolders for larger projects.
|
|
1137
|
-
if (analysisPath !== '/') {
|
|
1138
|
-
info.sourceFiles = info.sourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1139
|
-
info.fullProgramSourceFiles = info.fullProgramSourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1140
|
-
}
|
|
1141
|
-
return { info, tsconfigPath };
|
|
1142
|
-
});
|
|
1143
|
-
// Analyze phase. Treat all projects as compilation units as
|
|
1144
|
-
// this allows us to support references between those.
|
|
1145
|
-
for (const { info, tsconfigPath } of programInfos) {
|
|
1146
|
-
context.logger.info(`Scanning for queries: ${tsconfigPath}..`);
|
|
1147
|
-
unitResults.push(await migration.analyze(info));
|
|
1148
|
-
}
|
|
1149
|
-
context.logger.info(``);
|
|
1150
|
-
context.logger.info(`Processing analysis data between targets..`);
|
|
1151
|
-
context.logger.info(``);
|
|
1152
|
-
const combined = await project_paths.synchronouslyCombineUnitData(migration, unitResults);
|
|
1153
|
-
if (combined === null) {
|
|
1154
|
-
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
1155
|
-
return;
|
|
1156
|
-
}
|
|
1157
|
-
const globalMeta = await migration.globalMeta(combined);
|
|
1158
|
-
const replacementsPerFile = new Map();
|
|
1159
|
-
for (const { info, tsconfigPath } of programInfos) {
|
|
1160
|
-
context.logger.info(`Migrating: ${tsconfigPath}..`);
|
|
1161
|
-
const { replacements } = await migration.migrate(globalMeta, info);
|
|
1162
|
-
const changesPerFile = project_paths.groupReplacementsByFile(replacements);
|
|
1163
|
-
for (const [file, changes] of changesPerFile) {
|
|
1164
|
-
if (!replacementsPerFile.has(file)) {
|
|
1165
|
-
replacementsPerFile.set(file, changes);
|
|
1122
|
+
afterProgramCreation: (info, fs) => {
|
|
1123
|
+
const analysisPath = fs.resolve(options.analysisDir);
|
|
1124
|
+
// Support restricting the analysis to subfolders for larger projects.
|
|
1125
|
+
if (analysisPath !== '/') {
|
|
1126
|
+
info.sourceFiles = info.sourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1127
|
+
info.fullProgramSourceFiles = info.fullProgramSourceFiles.filter((sf) => sf.fileName.startsWith(analysisPath));
|
|
1166
1128
|
}
|
|
1167
|
-
}
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1129
|
+
},
|
|
1130
|
+
beforeUnitAnalysis: (tsconfigPath) => {
|
|
1131
|
+
context.logger.info(`Scanning for queries: ${tsconfigPath}...`);
|
|
1132
|
+
},
|
|
1133
|
+
afterAnalysisFailure: () => {
|
|
1134
|
+
context.logger.error('Migration failed unexpectedly with no analysis data');
|
|
1135
|
+
},
|
|
1136
|
+
afterAllAnalyzed: () => {
|
|
1137
|
+
context.logger.info(``);
|
|
1138
|
+
context.logger.info(`Processing analysis data between targets...`);
|
|
1139
|
+
context.logger.info(``);
|
|
1140
|
+
},
|
|
1141
|
+
whenDone: ({ counters }) => {
|
|
1142
|
+
context.logger.info('');
|
|
1143
|
+
context.logger.info(`Successfully migrated to signal queries 🎉`);
|
|
1144
|
+
const { queriesCount, incompatibleQueries } = counters;
|
|
1145
|
+
const migratedQueries = queriesCount - incompatibleQueries;
|
|
1146
|
+
context.logger.info('');
|
|
1147
|
+
context.logger.info(`Successfully migrated to signal queries 🎉`);
|
|
1148
|
+
context.logger.info(` -> Migrated ${migratedQueries}/${queriesCount} queries.`);
|
|
1149
|
+
if (incompatibleQueries > 0 && !options.insertTodos) {
|
|
1150
|
+
context.logger.warn(`To see why ${incompatibleQueries} queries couldn't be migrated`);
|
|
1151
|
+
context.logger.warn(`consider re-running with "--insert-todos" or "--best-effort-mode".`);
|
|
1152
|
+
}
|
|
1153
|
+
if (options.bestEffortMode) {
|
|
1154
|
+
context.logger.warn(`You ran with best effort mode. Manually verify all code ` +
|
|
1155
|
+
`works as intended, and fix where necessary.`);
|
|
1156
|
+
}
|
|
1157
|
+
},
|
|
1158
|
+
});
|
|
1194
1159
|
};
|
|
1195
1160
|
}
|
|
1196
1161
|
|
|
@@ -1,34 +1,32 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.0.0-next.
|
|
3
|
+
* @license Angular v20.0.0-next.3
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
Object.defineProperty(exports, '__esModule', { value: true });
|
|
10
|
-
|
|
11
9
|
var schematics = require('@angular-devkit/schematics');
|
|
12
10
|
var signalQueriesMigration = require('./signal-queries-migration.js');
|
|
13
11
|
var signalInputMigration = require('./signal-input-migration.js');
|
|
14
12
|
var outputMigration = require('./output-migration.js');
|
|
15
|
-
require('./
|
|
16
|
-
require('@angular-devkit/core');
|
|
17
|
-
require('./project_paths-17dc204d.js');
|
|
18
|
-
require('node:path/posix');
|
|
19
|
-
require('os');
|
|
13
|
+
require('./checker-BHb19MHt.js');
|
|
20
14
|
require('typescript');
|
|
21
|
-
require('
|
|
15
|
+
require('os');
|
|
22
16
|
require('fs');
|
|
23
17
|
require('module');
|
|
24
18
|
require('path');
|
|
25
19
|
require('url');
|
|
26
|
-
require('./
|
|
27
|
-
require('./
|
|
28
|
-
require('
|
|
20
|
+
require('./index-I8VbxQcO.js');
|
|
21
|
+
require('./run_in_devkit-C0JPtK2u.js');
|
|
22
|
+
require('@angular-devkit/core');
|
|
23
|
+
require('node:path/posix');
|
|
24
|
+
require('./project_tsconfig_paths-CDVxT6Ov.js');
|
|
25
|
+
require('./apply_import_manager-BXQEjo09.js');
|
|
26
|
+
require('./migrate_ts_type_references-KlOTWeDl.js');
|
|
29
27
|
require('assert');
|
|
30
|
-
require('./index-
|
|
31
|
-
require('./leading_space-
|
|
28
|
+
require('./index-BL9kAIe5.js');
|
|
29
|
+
require('./leading_space-D9nQ8UQC.js');
|
|
32
30
|
|
|
33
31
|
function migrate(options) {
|
|
34
32
|
// The migrations are independent so we can run them in any order, but we sort them here
|