@angular/core 20.1.4 → 20.1.5
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 +1 -1
- package/discovery.d.d.ts +1 -1
- package/event_dispatcher.d.d.ts +1 -1
- package/fesm2022/attribute.mjs +1 -1
- package/fesm2022/attribute.mjs.map +1 -1
- package/fesm2022/core.mjs +2 -2
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/debug_node.mjs +14 -5
- package/fesm2022/debug_node.mjs.map +1 -1
- package/fesm2022/not_found.mjs +1 -1
- package/fesm2022/not_found.mjs.map +1 -1
- package/fesm2022/primitives/di.mjs +1 -1
- package/fesm2022/primitives/di.mjs.map +1 -1
- package/fesm2022/primitives/event-dispatch.mjs +1 -1
- package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
- package/fesm2022/primitives/signals.mjs +1 -1
- package/fesm2022/primitives/signals.mjs.map +1 -1
- package/fesm2022/resource.mjs +1 -1
- package/fesm2022/resource.mjs.map +1 -1
- package/fesm2022/root_effect_scheduler.mjs +1 -1
- package/fesm2022/root_effect_scheduler.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +1 -1
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/signal.mjs +1 -1
- package/fesm2022/signal.mjs.map +1 -1
- package/fesm2022/testing.mjs +1 -1
- package/fesm2022/testing.mjs.map +1 -1
- package/fesm2022/untracked.mjs +1 -1
- package/fesm2022/untracked.mjs.map +1 -1
- package/fesm2022/weak_ref.mjs +1 -1
- package/fesm2022/weak_ref.mjs.map +1 -1
- package/graph.d.d.ts +1 -1
- package/index.d.ts +3 -1
- 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-BwG_XNz3.cjs → apply_import_manager-BeiseOfz.cjs} +4 -4
- package/schematics/bundles/cleanup-unused-imports.cjs +7 -8
- package/schematics/bundles/{compiler_host-BouiutKy.cjs → compiler_host-CIkS8EIQ.cjs} +3 -3
- package/schematics/bundles/control-flow-migration.cjs +18 -19
- package/schematics/bundles/document-core.cjs +6 -7
- package/schematics/bundles/imports-CIX-JgAN.cjs +1 -1
- package/schematics/bundles/{index-C7alPIzS.cjs → index-CuCkSYir.cjs} +1254 -1246
- package/schematics/bundles/{index-C4RI5-xz.cjs → index-Dek52tJB.cjs} +49 -49
- package/schematics/bundles/inject-flags.cjs +6 -7
- package/schematics/bundles/inject-migration.cjs +6 -7
- package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
- package/schematics/bundles/{migrate_ts_type_references-BXdun0jT.cjs → migrate_ts_type_references-MVe5vYII.cjs} +14 -14
- package/schematics/bundles/ng_decorators-B5HCqr20.cjs +1 -1
- package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
- package/schematics/bundles/output-migration.cjs +20 -21
- package/schematics/bundles/{project_paths-KZ5syi8v.cjs → project_paths-BKtwr3ir.cjs} +16 -17
- package/schematics/bundles/{checker-B1MkHERe.cjs → project_tsconfig_paths-DA1eve-D.cjs} +139 -24
- package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
- package/schematics/bundles/route-lazy-loading.cjs +6 -7
- package/schematics/bundles/self-closing-tags-migration.cjs +10 -11
- package/schematics/bundles/signal-input-migration.cjs +21 -22
- package/schematics/bundles/signal-queries-migration.cjs +31 -32
- package/schematics/bundles/signals.cjs +8 -9
- package/schematics/bundles/standalone-migration.cjs +10 -11
- package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
- package/schematics/bundles/test-bed-get.cjs +4 -5
- package/signal.d.d.ts +1 -1
- package/testing/index.d.ts +1 -1
- package/weak_ref.d.d.ts +1 -1
- package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +0 -90
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.1.
|
|
3
|
+
* @license Angular v20.1.5
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,11 +8,11 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var
|
|
12
|
-
var index = require('./index-
|
|
11
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DA1eve-D.cjs');
|
|
12
|
+
var index = require('./index-CuCkSYir.cjs');
|
|
13
13
|
require('path');
|
|
14
14
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
15
|
+
var project_paths = require('./project_paths-BKtwr3ir.cjs');
|
|
16
16
|
|
|
17
17
|
function getMemberName(member) {
|
|
18
18
|
if (member.name === undefined) {
|
|
@@ -189,7 +189,7 @@ function lookupPropertyAccess(checker, type, path, options = {}) {
|
|
|
189
189
|
* This resolution is important to be able to migrate references to inputs
|
|
190
190
|
* that will be migrated to signal inputs.
|
|
191
191
|
*/
|
|
192
|
-
class TemplateReferenceVisitor extends
|
|
192
|
+
class TemplateReferenceVisitor extends project_tsconfig_paths.RecursiveVisitor {
|
|
193
193
|
result = [];
|
|
194
194
|
/**
|
|
195
195
|
* Whether we are currently descending into HTML AST nodes
|
|
@@ -236,21 +236,21 @@ class TemplateReferenceVisitor extends checker.RecursiveVisitor {
|
|
|
236
236
|
// of signal calls in templates.
|
|
237
237
|
// TODO: Remove with: https://github.com/angular/angular/pull/55456.
|
|
238
238
|
this.templateAttributeReferencedFields = [];
|
|
239
|
-
|
|
240
|
-
|
|
239
|
+
project_tsconfig_paths.visitAll(this, template.attributes);
|
|
240
|
+
project_tsconfig_paths.visitAll(this, template.templateAttrs);
|
|
241
241
|
// If we are dealing with a microsyntax template, do not check
|
|
242
242
|
// inputs and outputs as those are already passed to the children.
|
|
243
243
|
// Template attributes may contain relevant expressions though.
|
|
244
244
|
if (template.tagName === 'ng-template') {
|
|
245
|
-
|
|
246
|
-
|
|
245
|
+
project_tsconfig_paths.visitAll(this, template.inputs);
|
|
246
|
+
project_tsconfig_paths.visitAll(this, template.outputs);
|
|
247
247
|
}
|
|
248
248
|
const referencedInputs = this.templateAttributeReferencedFields;
|
|
249
249
|
this.templateAttributeReferencedFields = null;
|
|
250
250
|
this.descendAndCheckForNarrowedSimilarReferences(referencedInputs, () => {
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
251
|
+
project_tsconfig_paths.visitAll(this, template.children);
|
|
252
|
+
project_tsconfig_paths.visitAll(this, template.references);
|
|
253
|
+
project_tsconfig_paths.visitAll(this, template.variables);
|
|
254
254
|
});
|
|
255
255
|
}
|
|
256
256
|
visitIfBlockBranch(block) {
|
|
@@ -317,7 +317,7 @@ class TemplateReferenceVisitor extends checker.RecursiveVisitor {
|
|
|
317
317
|
* This resolution is important to be able to migrate references to inputs
|
|
318
318
|
* that will be migrated to signal inputs.
|
|
319
319
|
*/
|
|
320
|
-
class TemplateExpressionReferenceVisitor extends
|
|
320
|
+
class TemplateExpressionReferenceVisitor extends project_tsconfig_paths.RecursiveAstVisitor {
|
|
321
321
|
typeChecker;
|
|
322
322
|
templateTypeChecker;
|
|
323
323
|
componentClass;
|
|
@@ -364,7 +364,7 @@ class TemplateExpressionReferenceVisitor extends checker.RecursiveAstVisitor {
|
|
|
364
364
|
super.visitPropertyRead(ast, context);
|
|
365
365
|
}
|
|
366
366
|
visitBinary(ast, context) {
|
|
367
|
-
if (ast.operation === '=' && ast.left instanceof
|
|
367
|
+
if (ast.operation === '=' && ast.left instanceof project_tsconfig_paths.PropertyRead) {
|
|
368
368
|
this._inspectPropertyAccess(ast.left, true, [...context, ast, ast.left]);
|
|
369
369
|
}
|
|
370
370
|
else {
|
|
@@ -402,7 +402,7 @@ class TemplateExpressionReferenceVisitor extends checker.RecursiveAstVisitor {
|
|
|
402
402
|
return false;
|
|
403
403
|
}
|
|
404
404
|
const symbol = this.templateTypeChecker.getSymbolOfNode(ast, this.componentClass);
|
|
405
|
-
if (symbol?.kind !==
|
|
405
|
+
if (symbol?.kind !== project_tsconfig_paths.SymbolKind.Expression || symbol.tsSymbol === null) {
|
|
406
406
|
return false;
|
|
407
407
|
}
|
|
408
408
|
// Dangerous: Type checking symbol retrieval is a totally different `ts.Program`,
|
|
@@ -464,25 +464,25 @@ class TemplateExpressionReferenceVisitor extends checker.RecursiveAstVisitor {
|
|
|
464
464
|
_isPartOfNarrowingTernary(read) {
|
|
465
465
|
// Note: We do not safe check that the reads are fully matching 1:1. This is acceptable
|
|
466
466
|
// as worst case we just skip an input from being migrated. This is very unlikely too.
|
|
467
|
-
return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof
|
|
467
|
+
return this.insideConditionalExpressionsWithReads.some((r) => (r instanceof project_tsconfig_paths.PropertyRead || r instanceof project_tsconfig_paths.SafePropertyRead) && r.name === read.name);
|
|
468
468
|
}
|
|
469
469
|
}
|
|
470
470
|
/**
|
|
471
471
|
* Emulates an access to a given field using the TypeScript `ts.Type`
|
|
472
472
|
* of the given class. The resolved symbol of the access is returned.
|
|
473
473
|
*/
|
|
474
|
-
function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker
|
|
474
|
+
function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker) {
|
|
475
475
|
const path = [readOrWrite.name];
|
|
476
476
|
let node = readOrWrite;
|
|
477
|
-
while (node.receiver instanceof
|
|
477
|
+
while (node.receiver instanceof project_tsconfig_paths.PropertyRead) {
|
|
478
478
|
node = node.receiver;
|
|
479
479
|
path.unshift(node.name);
|
|
480
480
|
}
|
|
481
|
-
if (!(node.receiver instanceof
|
|
481
|
+
if (!(node.receiver instanceof project_tsconfig_paths.ImplicitReceiver || node.receiver instanceof project_tsconfig_paths.ThisReceiver)) {
|
|
482
482
|
return null;
|
|
483
483
|
}
|
|
484
|
-
const classType = checker
|
|
485
|
-
return (lookupPropertyAccess(checker
|
|
484
|
+
const classType = checker.getTypeAtLocation(componentClass.name);
|
|
485
|
+
return (lookupPropertyAccess(checker, classType, path, {
|
|
486
486
|
// Necessary to avoid breaking the resolution if there is
|
|
487
487
|
// some narrowing involved. E.g. `myClass ? myClass.input`.
|
|
488
488
|
ignoreNullability: true,
|
|
@@ -490,8 +490,8 @@ function traverseReceiverAndLookupSymbol(readOrWrite, componentClass, checker$1)
|
|
|
490
490
|
}
|
|
491
491
|
/** Whether the given node refers to a two-way binding AST node. */
|
|
492
492
|
function isTwoWayBindingNode(node) {
|
|
493
|
-
return ((node instanceof
|
|
494
|
-
(node instanceof
|
|
493
|
+
return ((node instanceof project_tsconfig_paths.BoundAttribute && node.type === project_tsconfig_paths.BindingType.TwoWay) ||
|
|
494
|
+
(node instanceof project_tsconfig_paths.BoundEvent && node.type === project_tsconfig_paths.ParsedEventType.TwoWay));
|
|
495
495
|
}
|
|
496
496
|
|
|
497
497
|
/** Possible types of references to known fields detected. */
|
|
@@ -526,7 +526,7 @@ function isTsClassTypeReference(ref) {
|
|
|
526
526
|
* Checks host bindings of the given class and tracks all
|
|
527
527
|
* references to inputs within bindings.
|
|
528
528
|
*/
|
|
529
|
-
function identifyHostBindingReferences(node, programInfo, checker
|
|
529
|
+
function identifyHostBindingReferences(node, programInfo, checker, reflector, result, knownFields, fieldNamesToConsiderForReferenceLookup) {
|
|
530
530
|
if (node.name === undefined) {
|
|
531
531
|
return;
|
|
532
532
|
}
|
|
@@ -534,7 +534,7 @@ function identifyHostBindingReferences(node, programInfo, checker$1, reflector,
|
|
|
534
534
|
if (decorators === null) {
|
|
535
535
|
return;
|
|
536
536
|
}
|
|
537
|
-
const angularDecorators =
|
|
537
|
+
const angularDecorators = project_tsconfig_paths.getAngularDecorators(decorators, ['Directive', 'Component'],
|
|
538
538
|
/* isAngularCore */ false);
|
|
539
539
|
if (angularDecorators.length === 0) {
|
|
540
540
|
return;
|
|
@@ -544,22 +544,22 @@ function identifyHostBindingReferences(node, programInfo, checker$1, reflector,
|
|
|
544
544
|
if (ngDecorator.args?.length !== 1) {
|
|
545
545
|
return;
|
|
546
546
|
}
|
|
547
|
-
const metadataNode =
|
|
547
|
+
const metadataNode = project_tsconfig_paths.unwrapExpression(ngDecorator.args[0]);
|
|
548
548
|
if (!ts.isObjectLiteralExpression(metadataNode)) {
|
|
549
549
|
return;
|
|
550
550
|
}
|
|
551
|
-
const metadata =
|
|
551
|
+
const metadata = project_tsconfig_paths.reflectObjectLiteral(metadataNode);
|
|
552
552
|
if (!metadata.has('host')) {
|
|
553
553
|
return;
|
|
554
554
|
}
|
|
555
|
-
let hostField =
|
|
555
|
+
let hostField = project_tsconfig_paths.unwrapExpression(metadata.get('host'));
|
|
556
556
|
// Special-case in case host bindings are shared via a variable.
|
|
557
557
|
// e.g. Material button shares host bindings as a constant in the same target.
|
|
558
558
|
if (ts.isIdentifier(hostField)) {
|
|
559
|
-
let symbol = checker
|
|
559
|
+
let symbol = checker.getSymbolAtLocation(hostField);
|
|
560
560
|
// Plain identifier references can point to alias symbols (e.g. imports).
|
|
561
561
|
if (symbol !== undefined && symbol.flags & ts.SymbolFlags.Alias) {
|
|
562
|
-
symbol = checker
|
|
562
|
+
symbol = checker.getAliasedSymbol(symbol);
|
|
563
563
|
}
|
|
564
564
|
if (symbol !== undefined &&
|
|
565
565
|
symbol.valueDeclaration !== undefined &&
|
|
@@ -570,9 +570,9 @@ function identifyHostBindingReferences(node, programInfo, checker$1, reflector,
|
|
|
570
570
|
if (hostField === undefined || !ts.isObjectLiteralExpression(hostField)) {
|
|
571
571
|
return;
|
|
572
572
|
}
|
|
573
|
-
const hostMap =
|
|
573
|
+
const hostMap = project_tsconfig_paths.reflectObjectLiteral(hostField);
|
|
574
574
|
const expressionResult = [];
|
|
575
|
-
const expressionVisitor = new TemplateExpressionReferenceVisitor(checker
|
|
575
|
+
const expressionVisitor = new TemplateExpressionReferenceVisitor(checker, null, node, knownFields, fieldNamesToConsiderForReferenceLookup);
|
|
576
576
|
for (const [rawName, expression] of hostMap.entries()) {
|
|
577
577
|
if (!ts.isStringLiteralLike(expression)) {
|
|
578
578
|
continue;
|
|
@@ -583,11 +583,11 @@ function identifyHostBindingReferences(node, programInfo, checker$1, reflector,
|
|
|
583
583
|
if (!isPropertyBinding && !isEventBinding) {
|
|
584
584
|
continue;
|
|
585
585
|
}
|
|
586
|
-
const parser =
|
|
587
|
-
const sourceSpan = new
|
|
586
|
+
const parser = project_tsconfig_paths.makeBindingParser();
|
|
587
|
+
const sourceSpan = new project_tsconfig_paths.ParseSourceSpan(
|
|
588
588
|
// Fake source span to keep parsing offsets zero-based.
|
|
589
589
|
// We then later combine these with the expression TS node offsets.
|
|
590
|
-
new
|
|
590
|
+
new project_tsconfig_paths.ParseLocation({ content: '', url: '' }, 0, 0, 0), new project_tsconfig_paths.ParseLocation({ content: '', url: '' }, 0, 0, 0));
|
|
591
591
|
const name = rawName.substring(1, rawName.length - 1);
|
|
592
592
|
let parsed = undefined;
|
|
593
593
|
if (isEventBinding) {
|
|
@@ -628,11 +628,11 @@ function identifyHostBindingReferences(node, programInfo, checker$1, reflector,
|
|
|
628
628
|
* The definition can then be used with the Angular compiler to
|
|
629
629
|
* load/parse the given template.
|
|
630
630
|
*/
|
|
631
|
-
function attemptExtractTemplateDefinition(node, checker
|
|
631
|
+
function attemptExtractTemplateDefinition(node, checker, reflector, resourceLoader) {
|
|
632
632
|
const classDecorators = reflector.getDecoratorsOfDeclaration(node);
|
|
633
|
-
const evaluator = new index.PartialEvaluator(reflector, checker
|
|
633
|
+
const evaluator = new index.PartialEvaluator(reflector, checker, null);
|
|
634
634
|
const ngDecorators = classDecorators !== null
|
|
635
|
-
?
|
|
635
|
+
? project_tsconfig_paths.getAngularDecorators(classDecorators, ['Component'], /* isAngularCore */ false)
|
|
636
636
|
: [];
|
|
637
637
|
if (ngDecorators.length === 0 ||
|
|
638
638
|
ngDecorators[0].args === null ||
|
|
@@ -640,7 +640,7 @@ function attemptExtractTemplateDefinition(node, checker$1, reflector, resourceLo
|
|
|
640
640
|
!ts.isObjectLiteralExpression(ngDecorators[0].args[0])) {
|
|
641
641
|
return null;
|
|
642
642
|
}
|
|
643
|
-
const properties =
|
|
643
|
+
const properties = project_tsconfig_paths.reflectObjectLiteral(ngDecorators[0].args[0]);
|
|
644
644
|
const templateProp = properties.get('template');
|
|
645
645
|
const templateUrlProp = properties.get('templateUrl');
|
|
646
646
|
const containingFile = node.getSourceFile().fileName;
|
|
@@ -651,7 +651,7 @@ function attemptExtractTemplateDefinition(node, checker$1, reflector, resourceLo
|
|
|
651
651
|
return {
|
|
652
652
|
isInline: true,
|
|
653
653
|
expression: templateProp,
|
|
654
|
-
interpolationConfig:
|
|
654
|
+
interpolationConfig: project_tsconfig_paths.DEFAULT_INTERPOLATION_CONFIG,
|
|
655
655
|
preserveWhitespaces: false,
|
|
656
656
|
resolvedTemplateUrl: containingFile,
|
|
657
657
|
templateUrl: containingFile,
|
|
@@ -665,7 +665,7 @@ function attemptExtractTemplateDefinition(node, checker$1, reflector, resourceLo
|
|
|
665
665
|
if (typeof templateUrl === 'string') {
|
|
666
666
|
return {
|
|
667
667
|
isInline: false,
|
|
668
|
-
interpolationConfig:
|
|
668
|
+
interpolationConfig: project_tsconfig_paths.DEFAULT_INTERPOLATION_CONFIG,
|
|
669
669
|
preserveWhitespaces: false,
|
|
670
670
|
templateUrlExpression: templateUrlProp,
|
|
671
671
|
templateUrl,
|
|
@@ -684,14 +684,14 @@ function attemptExtractTemplateDefinition(node, checker$1, reflector, resourceLo
|
|
|
684
684
|
* Checks whether the given class has an Angular template, and resolves
|
|
685
685
|
* all of the references to inputs.
|
|
686
686
|
*/
|
|
687
|
-
function identifyTemplateReferences(programInfo, node, reflector, checker
|
|
688
|
-
const template = templateTypeChecker.getTemplate(node,
|
|
687
|
+
function identifyTemplateReferences(programInfo, node, reflector, checker, evaluator, templateTypeChecker, resourceLoader, options, result, knownFields, fieldNamesToConsiderForReferenceLookup) {
|
|
688
|
+
const template = templateTypeChecker.getTemplate(node, project_tsconfig_paths.OptimizeFor.WholeProgram) ??
|
|
689
689
|
// If there is no template registered in the TCB or compiler, the template may
|
|
690
690
|
// be skipped due to an explicit `jit: true` setting. We try to detect this case
|
|
691
691
|
// and parse the template manually.
|
|
692
|
-
extractTemplateWithoutCompilerAnalysis(node, checker
|
|
692
|
+
extractTemplateWithoutCompilerAnalysis(node, checker, reflector, resourceLoader, evaluator, options);
|
|
693
693
|
if (template !== null) {
|
|
694
|
-
const visitor = new TemplateReferenceVisitor(checker
|
|
694
|
+
const visitor = new TemplateReferenceVisitor(checker, templateTypeChecker, node, knownFields, fieldNamesToConsiderForReferenceLookup);
|
|
695
695
|
template.forEach((node) => node.visit(visitor));
|
|
696
696
|
for (const res of visitor.result) {
|
|
697
697
|
const templateFilePath = res.context.sourceSpan.start.file.url;
|
|
@@ -714,7 +714,7 @@ function identifyTemplateReferences(programInfo, node, reflector, checker$1, eva
|
|
|
714
714
|
node: res.context,
|
|
715
715
|
isObjectShorthandExpression: res.isObjectShorthandExpression,
|
|
716
716
|
originatingTsFile: project_paths.projectFile(node.getSourceFile(), programInfo),
|
|
717
|
-
templateFile: project_paths.projectFile(
|
|
717
|
+
templateFile: project_paths.projectFile(project_tsconfig_paths.absoluteFrom(templateFilePath), programInfo),
|
|
718
718
|
isLikelyPartOfNarrowing: res.isLikelyNarrowed,
|
|
719
719
|
isWrite: res.isWrite,
|
|
720
720
|
},
|
|
@@ -732,11 +732,11 @@ function identifyTemplateReferences(programInfo, node, reflector, checker$1, eva
|
|
|
732
732
|
* contain references to inputs that we can resolve via the fallback
|
|
733
733
|
* reference resolutions (that does not use the type check block).
|
|
734
734
|
*/
|
|
735
|
-
function extractTemplateWithoutCompilerAnalysis(node, checker
|
|
735
|
+
function extractTemplateWithoutCompilerAnalysis(node, checker, reflector, resourceLoader, evaluator, options) {
|
|
736
736
|
if (node.name === undefined) {
|
|
737
737
|
return null;
|
|
738
738
|
}
|
|
739
|
-
const tmplDef = attemptExtractTemplateDefinition(node, checker
|
|
739
|
+
const tmplDef = attemptExtractTemplateDefinition(node, checker, reflector, resourceLoader);
|
|
740
740
|
if (tmplDef === null) {
|
|
741
741
|
return null;
|
|
742
742
|
}
|
|
@@ -747,7 +747,7 @@ function extractTemplateWithoutCompilerAnalysis(node, checker$1, reflector, reso
|
|
|
747
747
|
enableI18nLegacyMessageIdFormat: options.enableI18nLegacyMessageIdFormat !== false,
|
|
748
748
|
i18nNormalizeLineEndingsInICUs: options.i18nNormalizeLineEndingsInICUs === true,
|
|
749
749
|
enableSelectorless: false,
|
|
750
|
-
},
|
|
750
|
+
}, project_tsconfig_paths.CompilationMode.FULL).nodes;
|
|
751
751
|
}
|
|
752
752
|
|
|
753
753
|
/** Gets the pattern and property name for a given binding element. */
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.1.
|
|
3
|
+
* @license Angular v20.1.5
|
|
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
|
-
var
|
|
12
|
-
require('./index-
|
|
11
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DA1eve-D.cjs');
|
|
12
|
+
require('./index-CuCkSYir.cjs');
|
|
13
13
|
require('path');
|
|
14
14
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
16
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
15
|
+
var project_paths = require('./project_paths-BKtwr3ir.cjs');
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-BeiseOfz.cjs');
|
|
17
17
|
var imports = require('./imports-CIX-JgAN.cjs');
|
|
18
18
|
require('@angular-devkit/core');
|
|
19
19
|
require('node:path/posix');
|
|
@@ -21,7 +21,6 @@ require('fs');
|
|
|
21
21
|
require('module');
|
|
22
22
|
require('url');
|
|
23
23
|
require('@angular-devkit/schematics');
|
|
24
|
-
require('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
25
24
|
|
|
26
25
|
/** Mapping between `InjectFlag` enum members to their object literal equvalients. */
|
|
27
26
|
const FLAGS_TO_FIELDS = {
|
|
@@ -42,7 +41,7 @@ class InjectFlagsMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
42
41
|
continue;
|
|
43
42
|
}
|
|
44
43
|
const file = project_paths.projectFile(sourceFile, info);
|
|
45
|
-
const importManager = new
|
|
44
|
+
const importManager = new project_tsconfig_paths.ImportManager();
|
|
46
45
|
const importReplacements = [];
|
|
47
46
|
// Always remove the `InjectFlags` since it has been removed from Angular.
|
|
48
47
|
// Note that it be better to do this inside of `migrate`, but we don't have AST access there.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.1.
|
|
3
|
+
* @license Angular v20.1.5
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,17 +8,18 @@
|
|
|
8
8
|
|
|
9
9
|
var schematics = require('@angular-devkit/schematics');
|
|
10
10
|
var p = require('path');
|
|
11
|
-
var compiler_host = require('./compiler_host-
|
|
11
|
+
var compiler_host = require('./compiler_host-CIkS8EIQ.cjs');
|
|
12
12
|
var ts = require('typescript');
|
|
13
13
|
var ng_decorators = require('./ng_decorators-B5HCqr20.cjs');
|
|
14
14
|
var imports = require('./imports-CIX-JgAN.cjs');
|
|
15
15
|
var nodes = require('./nodes-B16H9JUd.cjs');
|
|
16
16
|
var leading_space = require('./leading_space-D9nQ8UQC.cjs');
|
|
17
|
-
require('./
|
|
17
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DA1eve-D.cjs');
|
|
18
18
|
require('os');
|
|
19
19
|
require('fs');
|
|
20
20
|
require('module');
|
|
21
21
|
require('url');
|
|
22
|
+
require('@angular-devkit/core');
|
|
22
23
|
|
|
23
24
|
/*!
|
|
24
25
|
* @license
|
|
@@ -1243,12 +1244,10 @@ function isStringType(node, checker) {
|
|
|
1243
1244
|
|
|
1244
1245
|
function migrate(options) {
|
|
1245
1246
|
return async (tree) => {
|
|
1247
|
+
const { buildPaths, testPaths } = await project_tsconfig_paths.getProjectTsConfigPaths(tree);
|
|
1246
1248
|
const basePath = process.cwd();
|
|
1249
|
+
const allPaths = [...buildPaths, ...testPaths];
|
|
1247
1250
|
const pathToMigrate = compiler_host.normalizePath(p.join(basePath, options.path));
|
|
1248
|
-
let allPaths = [];
|
|
1249
|
-
if (pathToMigrate.trim() !== '') {
|
|
1250
|
-
allPaths.push(pathToMigrate);
|
|
1251
|
-
}
|
|
1252
1251
|
if (!allPaths.length) {
|
|
1253
1252
|
throw new schematics.SchematicsException('Could not find any tsconfig file. Cannot run the inject migration.');
|
|
1254
1253
|
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.1.
|
|
3
|
+
* @license Angular v20.1.5
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
7
7
|
'use strict';
|
|
8
8
|
|
|
9
|
-
var
|
|
9
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DA1eve-D.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-Dek52tJB.cjs');
|
|
14
|
+
var project_paths = require('./project_paths-BKtwr3ir.cjs');
|
|
15
15
|
var leading_space = require('./leading_space-D9nQ8UQC.cjs');
|
|
16
|
-
require('./index-
|
|
16
|
+
require('./index-CuCkSYir.cjs');
|
|
17
17
|
require('path');
|
|
18
18
|
require('node:path');
|
|
19
19
|
|
|
@@ -122,24 +122,24 @@ class SpyOnFieldPattern {
|
|
|
122
122
|
* In addition, spying onto an input may be problematic- so we skip migrating
|
|
123
123
|
* such.
|
|
124
124
|
*/
|
|
125
|
-
function checkIncompatiblePatterns(inheritanceGraph, checker
|
|
125
|
+
function checkIncompatiblePatterns(inheritanceGraph, checker, groupedTsAstVisitor, fields, getAllClassesWithKnownFields) {
|
|
126
126
|
const inputClassSymbolsToClass = new Map();
|
|
127
127
|
for (const knownFieldClass of getAllClassesWithKnownFields()) {
|
|
128
|
-
const classSymbol = checker
|
|
128
|
+
const classSymbol = checker.getTypeAtLocation(knownFieldClass).symbol;
|
|
129
129
|
assert(classSymbol != null, 'Expected a symbol to exist for the container of known field class.');
|
|
130
130
|
assert(classSymbol.valueDeclaration !== undefined, 'Expected declaration to exist for known field class.');
|
|
131
131
|
assert(ts.isClassDeclaration(classSymbol.valueDeclaration), 'Expected declaration to be a class.');
|
|
132
132
|
// track class symbol for derived class checks.
|
|
133
133
|
inputClassSymbolsToClass.set(classSymbol, classSymbol.valueDeclaration);
|
|
134
134
|
}
|
|
135
|
-
const spyOnPattern = new SpyOnFieldPattern(checker
|
|
135
|
+
const spyOnPattern = new SpyOnFieldPattern(checker, fields);
|
|
136
136
|
const visitor = (node) => {
|
|
137
137
|
// Check for manual class instantiations.
|
|
138
|
-
if (ts.isNewExpression(node) && ts.isIdentifier(
|
|
139
|
-
let newTarget = checker
|
|
138
|
+
if (ts.isNewExpression(node) && ts.isIdentifier(project_tsconfig_paths.unwrapExpression(node.expression))) {
|
|
139
|
+
let newTarget = checker.getSymbolAtLocation(project_tsconfig_paths.unwrapExpression(node.expression));
|
|
140
140
|
// Plain identifier references can point to alias symbols (e.g. imports).
|
|
141
141
|
if (newTarget !== undefined && newTarget.flags & ts.SymbolFlags.Alias) {
|
|
142
|
-
newTarget = checker
|
|
142
|
+
newTarget = checker.getAliasedSymbol(newTarget);
|
|
143
143
|
}
|
|
144
144
|
if (newTarget && inputClassSymbolsToClass.has(newTarget)) {
|
|
145
145
|
fields.markClassIncompatible(inputClassSymbolsToClass.get(newTarget), exports.ClassIncompatibilityReason.ClassManuallyInstantiated);
|
|
@@ -155,10 +155,10 @@ function checkIncompatiblePatterns(inheritanceGraph, checker$1, groupedTsAstVisi
|
|
|
155
155
|
problematicReferencesCheck: if (insidePropertyDeclaration !== null &&
|
|
156
156
|
ts.isIdentifier(node) &&
|
|
157
157
|
insidePropertyDeclaration.parent.heritageClauses !== undefined) {
|
|
158
|
-
let newTarget = checker
|
|
158
|
+
let newTarget = checker.getSymbolAtLocation(project_tsconfig_paths.unwrapExpression(node));
|
|
159
159
|
// Plain identifier references can point to alias symbols (e.g. imports).
|
|
160
160
|
if (newTarget !== undefined && newTarget.flags & ts.SymbolFlags.Alias) {
|
|
161
|
-
newTarget = checker
|
|
161
|
+
newTarget = checker.getAliasedSymbol(newTarget);
|
|
162
162
|
}
|
|
163
163
|
if (newTarget && inputClassSymbolsToClass.has(newTarget)) {
|
|
164
164
|
const memberName = index.getMemberName(insidePropertyDeclaration);
|
|
@@ -384,7 +384,7 @@ function checkInheritanceOfKnownFields(inheritanceGraph, metaRegistry, fields, o
|
|
|
384
384
|
if (metaRegistry !== null) {
|
|
385
385
|
for (const derivedClasses of inheritanceGraph.traceDerivedClasses(inputClass)) {
|
|
386
386
|
const derivedMeta = ts.isClassDeclaration(derivedClasses) && derivedClasses.name !== undefined
|
|
387
|
-
? metaRegistry.getDirectiveMetadata(new
|
|
387
|
+
? metaRegistry.getDirectiveMetadata(new project_tsconfig_paths.Reference(derivedClasses))
|
|
388
388
|
: null;
|
|
389
389
|
if (derivedMeta !== null && derivedMeta.inputFieldNamesFromMetadataArray !== null) {
|
|
390
390
|
derivedMeta.inputFieldNamesFromMetadataArray.forEach((b) => inputFieldNamesFromMetadataArray.add(b));
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
/**
|
|
3
|
-
* @license Angular v20.1.
|
|
3
|
+
* @license Angular v20.1.5
|
|
4
4
|
* (c) 2010-2025 Google LLC. https://angular.io/
|
|
5
5
|
* License: MIT
|
|
6
6
|
*/
|
|
@@ -8,20 +8,19 @@
|
|
|
8
8
|
|
|
9
9
|
var ts = require('typescript');
|
|
10
10
|
require('os');
|
|
11
|
-
var
|
|
12
|
-
var index$1 = require('./index-
|
|
11
|
+
var project_tsconfig_paths = require('./project_tsconfig_paths-DA1eve-D.cjs');
|
|
12
|
+
var index$1 = require('./index-CuCkSYir.cjs');
|
|
13
13
|
require('path');
|
|
14
14
|
require('node:path');
|
|
15
|
-
var project_paths = require('./project_paths-
|
|
16
|
-
var apply_import_manager = require('./apply_import_manager-
|
|
17
|
-
var index = require('./index-
|
|
15
|
+
var project_paths = require('./project_paths-BKtwr3ir.cjs');
|
|
16
|
+
var apply_import_manager = require('./apply_import_manager-BeiseOfz.cjs');
|
|
17
|
+
var index = require('./index-Dek52tJB.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('./project_tsconfig_paths-CDVxT6Ov.cjs');
|
|
25
24
|
|
|
26
25
|
function isOutputDeclarationEligibleForMigration(node) {
|
|
27
26
|
return (node.initializer !== undefined &&
|
|
@@ -68,7 +67,7 @@ function isOutputDeclaration(node, reflector, dtsReader) {
|
|
|
68
67
|
node.parent.name === undefined) {
|
|
69
68
|
return false;
|
|
70
69
|
}
|
|
71
|
-
const ref = new
|
|
70
|
+
const ref = new project_tsconfig_paths.Reference(node.parent);
|
|
72
71
|
const directiveMeta = dtsReader.getDirectiveMetadata(ref);
|
|
73
72
|
return !!directiveMeta?.outputs.getByClassPropertyName(node.name.text);
|
|
74
73
|
}
|
|
@@ -85,7 +84,7 @@ function getTargetPropertyDeclaration(targetSymbol) {
|
|
|
85
84
|
/** Returns Angular `@Output` decorator or null when a given property declaration is not an @Output */
|
|
86
85
|
function getOutputDecorator(node, reflector) {
|
|
87
86
|
const decorators = reflector.getDecoratorsOfDeclaration(node);
|
|
88
|
-
const ngDecorators = decorators !== null ?
|
|
87
|
+
const ngDecorators = decorators !== null ? project_tsconfig_paths.getAngularDecorators(decorators, ['Output'], /* isCore */ false) : [];
|
|
89
88
|
return ngDecorators.length > 0 ? ngDecorators[0] : null;
|
|
90
89
|
}
|
|
91
90
|
// THINK: this utility + type is not specific to @Output, really, maybe move it to tsurge?
|
|
@@ -115,7 +114,7 @@ function checkNonTsReferenceAccessesField(ref, fieldName) {
|
|
|
115
114
|
if (ref.from.read !== readFromPath) {
|
|
116
115
|
return null;
|
|
117
116
|
}
|
|
118
|
-
if (!(parentRead instanceof
|
|
117
|
+
if (!(parentRead instanceof project_tsconfig_paths.PropertyRead) || parentRead.name !== fieldName) {
|
|
119
118
|
return null;
|
|
120
119
|
}
|
|
121
120
|
return parentRead;
|
|
@@ -171,7 +170,7 @@ function calculateDeclarationReplacement(info, node, aliasParam) {
|
|
|
171
170
|
function calculateImportReplacements(info, sourceFiles) {
|
|
172
171
|
const importReplacements = {};
|
|
173
172
|
for (const sf of sourceFiles) {
|
|
174
|
-
const importManager = new
|
|
173
|
+
const importManager = new project_tsconfig_paths.ImportManager();
|
|
175
174
|
const addOnly = [];
|
|
176
175
|
const addRemove = [];
|
|
177
176
|
const file = project_paths.projectFile(sf, info);
|
|
@@ -206,7 +205,7 @@ function calculateCompleteCallReplacement(info, node) {
|
|
|
206
205
|
function calculatePipeCallReplacement(info, node) {
|
|
207
206
|
if (ts.isPropertyAccessExpression(node.expression)) {
|
|
208
207
|
const sf = node.getSourceFile();
|
|
209
|
-
const importManager = new
|
|
208
|
+
const importManager = new project_tsconfig_paths.ImportManager();
|
|
210
209
|
const outputToObservableIdent = importManager.addImport({
|
|
211
210
|
requestedFile: sf,
|
|
212
211
|
exportModuleSpecifier: '@angular/core/rxjs-interop',
|
|
@@ -256,10 +255,10 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
256
255
|
const problematicUsages = {};
|
|
257
256
|
let problematicDeclarationCount = 0;
|
|
258
257
|
const filesWithOutputDeclarations = new Set();
|
|
259
|
-
const checker
|
|
260
|
-
const reflector = new
|
|
261
|
-
const dtsReader = new index$1.DtsMetadataReader(checker
|
|
262
|
-
const evaluator = new index$1.PartialEvaluator(reflector, checker
|
|
258
|
+
const checker = program.getTypeChecker();
|
|
259
|
+
const reflector = new project_tsconfig_paths.TypeScriptReflectionHost(checker);
|
|
260
|
+
const dtsReader = new index$1.DtsMetadataReader(checker, reflector);
|
|
261
|
+
const evaluator = new index$1.PartialEvaluator(reflector, checker, null);
|
|
263
262
|
const resourceLoader = info.ngCompiler?.['resourceManager'] ?? null;
|
|
264
263
|
// Pre-analyze the program and get access to the template type checker.
|
|
265
264
|
// If we are processing a non-Angular target, there is no template info.
|
|
@@ -320,7 +319,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
320
319
|
}
|
|
321
320
|
// detect .next usages that should be migrated to .emit
|
|
322
321
|
if (isPotentialNextCallUsage(node) && ts.isPropertyAccessExpression(node.expression)) {
|
|
323
|
-
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker
|
|
322
|
+
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker, reflector, dtsReader);
|
|
324
323
|
if (propertyDeclaration !== null) {
|
|
325
324
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
326
325
|
const outputFile = project_paths.projectFile(node.getSourceFile(), info);
|
|
@@ -329,7 +328,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
329
328
|
}
|
|
330
329
|
// detect .complete usages that should be removed
|
|
331
330
|
if (isPotentialCompleteCallUsage(node) && ts.isPropertyAccessExpression(node.expression)) {
|
|
332
|
-
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker
|
|
331
|
+
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker, reflector, dtsReader);
|
|
333
332
|
if (propertyDeclaration !== null) {
|
|
334
333
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
335
334
|
const outputFile = project_paths.projectFile(node.getSourceFile(), info);
|
|
@@ -341,14 +340,14 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
341
340
|
}
|
|
342
341
|
}
|
|
343
342
|
}
|
|
344
|
-
addCommentForEmptyEmit(node, info, checker
|
|
343
|
+
addCommentForEmptyEmit(node, info, checker, reflector, dtsReader, outputFieldReplacements);
|
|
345
344
|
// detect imports of test runners
|
|
346
345
|
if (isTestRunnerImport(node)) {
|
|
347
346
|
isTestFile = true;
|
|
348
347
|
}
|
|
349
348
|
// detect unsafe access of the output property
|
|
350
349
|
if (isPotentialPipeCallUsage(node) && ts.isPropertyAccessExpression(node.expression)) {
|
|
351
|
-
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker
|
|
350
|
+
const propertyDeclaration = isTargetOutputDeclaration(node.expression.expression, checker, reflector, dtsReader);
|
|
352
351
|
if (propertyDeclaration !== null) {
|
|
353
352
|
const id = getUniqueIdForProperty(info, propertyDeclaration);
|
|
354
353
|
if (isTestFile) {
|
|
@@ -369,7 +368,7 @@ class OutputMigration extends project_paths.TsurgeFunnelMigration {
|
|
|
369
368
|
}
|
|
370
369
|
// take care of the references in templates and host bindings
|
|
371
370
|
const referenceResult = { references: [] };
|
|
372
|
-
const { visitor: templateHostRefVisitor } = index.createFindAllSourceFileReferencesVisitor(info, checker
|
|
371
|
+
const { visitor: templateHostRefVisitor } = index.createFindAllSourceFileReferencesVisitor(info, checker, reflector, resourceLoader, evaluator, templateTypeChecker, knownFields, null, // TODO: capture known output names as an optimization
|
|
373
372
|
referenceResult);
|
|
374
373
|
// calculate template / host binding replacements
|
|
375
374
|
for (const sf of sourceFiles) {
|