@angular/compiler-cli 21.0.0-next.8 → 21.0.0-next.9
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/bundles/{chunk-ELPMV5DB.js → chunk-3UF7UI6H.js} +37 -0
- package/bundles/chunk-DT6FD4OE.js +1 -1
- package/bundles/{chunk-WXJFCHPN.js → chunk-HRLHX4UA.js} +1 -1
- package/bundles/{chunk-MVFPDRXS.js → chunk-IE2YQNTQ.js} +1 -1
- package/bundles/{chunk-NBFYHUMW.js → chunk-SIOKS4LN.js} +251 -196
- package/bundles/index.js +4 -4
- package/bundles/private/migrations.js +1 -1
- package/bundles/private/tooling.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +4 -4
- package/bundles/src/bin/ngc.js +4 -4
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +2 -2
- package/src/ngtsc/diagnostics/src/error_code.d.ts +5 -0
- package/src/ngtsc/docs/src/class_extractor.d.ts +4 -5
- package/src/ngtsc/docs/src/entities.d.ts +7 -2
- package/src/ngtsc/docs/src/interface_extractor.d.ts +11 -0
- package/src/ngtsc/docs/src/properties_extractor.d.ts +96 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
|
|
5
5
|
import {
|
|
6
6
|
angularJitApplicationTransform
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-HRLHX4UA.js";
|
|
8
8
|
import {
|
|
9
9
|
AbsoluteModuleStrategy,
|
|
10
10
|
ActivePerfRecorder,
|
|
@@ -92,7 +92,7 @@ import {
|
|
|
92
92
|
toUnredirectedSourceFile,
|
|
93
93
|
tryParseInitializerApi,
|
|
94
94
|
untagAllTsFiles
|
|
95
|
-
} from "./chunk-
|
|
95
|
+
} from "./chunk-3UF7UI6H.js";
|
|
96
96
|
import {
|
|
97
97
|
LogicalFileSystem,
|
|
98
98
|
absoluteFrom,
|
|
@@ -180,28 +180,10 @@ function isDocEntryWithSourceInfo(entry) {
|
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
// packages/compiler-cli/src/ngtsc/docs/src/extractor.js
|
|
183
|
-
import
|
|
183
|
+
import ts14 from "typescript";
|
|
184
184
|
|
|
185
185
|
// packages/compiler-cli/src/ngtsc/docs/src/class_extractor.js
|
|
186
|
-
import
|
|
187
|
-
|
|
188
|
-
// packages/compiler-cli/src/ngtsc/docs/src/filters.js
|
|
189
|
-
function isAngularPrivateName(name) {
|
|
190
|
-
const firstChar = name[0] ?? "";
|
|
191
|
-
return firstChar === "\u0275" || firstChar === "_";
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
// packages/compiler-cli/src/ngtsc/docs/src/function_extractor.js
|
|
195
|
-
import ts4 from "typescript";
|
|
196
|
-
|
|
197
|
-
// packages/compiler-cli/src/ngtsc/docs/src/generics_extractor.js
|
|
198
|
-
function extractGenerics(declaration) {
|
|
199
|
-
return declaration.typeParameters?.map((typeParam) => ({
|
|
200
|
-
name: typeParam.name.getText(),
|
|
201
|
-
constraint: typeParam.constraint?.getText(),
|
|
202
|
-
default: typeParam.default?.getText()
|
|
203
|
-
})) ?? [];
|
|
204
|
-
}
|
|
186
|
+
import ts7 from "typescript";
|
|
205
187
|
|
|
206
188
|
// packages/compiler-cli/src/ngtsc/docs/src/jsdoc_extractor.js
|
|
207
189
|
import ts2 from "typescript";
|
|
@@ -244,6 +226,27 @@ function unescapeAngularDecorators(comment) {
|
|
|
244
226
|
return comment.replace(/_NG_AT_/g, "@");
|
|
245
227
|
}
|
|
246
228
|
|
|
229
|
+
// packages/compiler-cli/src/ngtsc/docs/src/properties_extractor.js
|
|
230
|
+
import ts6 from "typescript";
|
|
231
|
+
|
|
232
|
+
// packages/compiler-cli/src/ngtsc/docs/src/filters.js
|
|
233
|
+
function isAngularPrivateName(name) {
|
|
234
|
+
const firstChar = name[0] ?? "";
|
|
235
|
+
return firstChar === "\u0275" || firstChar === "_";
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
// packages/compiler-cli/src/ngtsc/docs/src/function_extractor.js
|
|
239
|
+
import ts4 from "typescript";
|
|
240
|
+
|
|
241
|
+
// packages/compiler-cli/src/ngtsc/docs/src/generics_extractor.js
|
|
242
|
+
function extractGenerics(declaration) {
|
|
243
|
+
return declaration.typeParameters?.map((typeParam) => ({
|
|
244
|
+
name: typeParam.name.getText(),
|
|
245
|
+
constraint: typeParam.constraint?.getText(),
|
|
246
|
+
default: typeParam.default?.getText()
|
|
247
|
+
})) ?? [];
|
|
248
|
+
}
|
|
249
|
+
|
|
247
250
|
// packages/compiler-cli/src/ngtsc/docs/src/type_extractor.js
|
|
248
251
|
import ts3 from "typescript";
|
|
249
252
|
function extractResolvedTypeString(node, checker) {
|
|
@@ -381,8 +384,8 @@ function hasLeadingInternalComment(member) {
|
|
|
381
384
|
) ?? false;
|
|
382
385
|
}
|
|
383
386
|
|
|
384
|
-
// packages/compiler-cli/src/ngtsc/docs/src/
|
|
385
|
-
var
|
|
387
|
+
// packages/compiler-cli/src/ngtsc/docs/src/properties_extractor.js
|
|
388
|
+
var PropertiesExtractor = class {
|
|
386
389
|
declaration;
|
|
387
390
|
typeChecker;
|
|
388
391
|
constructor(declaration, typeChecker) {
|
|
@@ -392,16 +395,8 @@ var ClassExtractor = class {
|
|
|
392
395
|
/** Extract docs info specific to classes. */
|
|
393
396
|
extract() {
|
|
394
397
|
return {
|
|
395
|
-
name: this.declaration.name.text,
|
|
396
|
-
isAbstract: this.isAbstract(),
|
|
397
|
-
entryType: ts6.isInterfaceDeclaration(this.declaration) ? EntryType.Interface : EntryType.UndecoratedClass,
|
|
398
398
|
members: this.extractSignatures().concat(this.extractAllClassMembers()),
|
|
399
|
-
generics: extractGenerics(this.declaration)
|
|
400
|
-
description: extractJsDocDescription(this.declaration),
|
|
401
|
-
jsdocTags: extractJsDocTags(this.declaration),
|
|
402
|
-
rawComment: extractRawJsDoc(this.declaration),
|
|
403
|
-
extends: this.extractInheritance(this.declaration),
|
|
404
|
-
implements: this.extractInterfaceConformance(this.declaration)
|
|
399
|
+
generics: extractGenerics(this.declaration)
|
|
405
400
|
};
|
|
406
401
|
}
|
|
407
402
|
/** Extracts doc info for a class's members. */
|
|
@@ -478,21 +473,6 @@ var ClassExtractor = class {
|
|
|
478
473
|
memberTags: this.getMemberTags(constructorDeclaration)
|
|
479
474
|
};
|
|
480
475
|
}
|
|
481
|
-
extractInheritance(declaration) {
|
|
482
|
-
if (!declaration.heritageClauses) {
|
|
483
|
-
return void 0;
|
|
484
|
-
}
|
|
485
|
-
for (const clause of declaration.heritageClauses) {
|
|
486
|
-
if (clause.token === ts6.SyntaxKind.ExtendsKeyword) {
|
|
487
|
-
const types = clause.types;
|
|
488
|
-
if (types.length > 0) {
|
|
489
|
-
const baseClass = types[0];
|
|
490
|
-
return baseClass.getText();
|
|
491
|
-
}
|
|
492
|
-
}
|
|
493
|
-
}
|
|
494
|
-
return void 0;
|
|
495
|
-
}
|
|
496
476
|
extractInterfaceConformance(declaration) {
|
|
497
477
|
const implementClause = declaration.heritageClauses?.find((clause) => clause.token === ts6.SyntaxKind.ImplementsKeyword);
|
|
498
478
|
return implementClause?.types.map((m) => m.getText()) ?? [];
|
|
@@ -614,11 +594,6 @@ var ClassExtractor = class {
|
|
|
614
594
|
isDocumentableSignature(signature) {
|
|
615
595
|
return ts6.isConstructSignatureDeclaration(signature) || ts6.isCallSignatureDeclaration(signature);
|
|
616
596
|
}
|
|
617
|
-
/** Gets whether the declaration for this extractor is abstract. */
|
|
618
|
-
isAbstract() {
|
|
619
|
-
const modifiers = this.declaration.modifiers ?? [];
|
|
620
|
-
return modifiers.some((mod) => mod.kind === ts6.SyntaxKind.AbstractKeyword);
|
|
621
|
-
}
|
|
622
597
|
/**
|
|
623
598
|
* Check wether a member has a private computed property name like [ɵWRITABLE_SIGNAL]
|
|
624
599
|
*
|
|
@@ -628,6 +603,47 @@ var ClassExtractor = class {
|
|
|
628
603
|
return ts6.isComputedPropertyName(property.name) && property.name.expression.getText().startsWith("\u0275");
|
|
629
604
|
}
|
|
630
605
|
};
|
|
606
|
+
|
|
607
|
+
// packages/compiler-cli/src/ngtsc/docs/src/class_extractor.js
|
|
608
|
+
var ClassExtractor = class extends PropertiesExtractor {
|
|
609
|
+
constructor(declaration, typeChecker) {
|
|
610
|
+
super(declaration, typeChecker);
|
|
611
|
+
}
|
|
612
|
+
/** Extract docs info specific to classes. */
|
|
613
|
+
extract() {
|
|
614
|
+
return {
|
|
615
|
+
name: this.declaration.name.text,
|
|
616
|
+
isAbstract: this.isAbstract(),
|
|
617
|
+
entryType: EntryType.UndecoratedClass,
|
|
618
|
+
...super.extract(),
|
|
619
|
+
description: extractJsDocDescription(this.declaration),
|
|
620
|
+
jsdocTags: extractJsDocTags(this.declaration),
|
|
621
|
+
rawComment: extractRawJsDoc(this.declaration),
|
|
622
|
+
extends: this.extractInheritance(this.declaration),
|
|
623
|
+
implements: this.extractInterfaceConformance(this.declaration)
|
|
624
|
+
};
|
|
625
|
+
}
|
|
626
|
+
/** Gets whether the declaration for this extractor is abstract. */
|
|
627
|
+
isAbstract() {
|
|
628
|
+
const modifiers = this.declaration.modifiers ?? [];
|
|
629
|
+
return modifiers.some((mod) => mod.kind === ts7.SyntaxKind.AbstractKeyword);
|
|
630
|
+
}
|
|
631
|
+
extractInheritance(declaration) {
|
|
632
|
+
if (!declaration.heritageClauses) {
|
|
633
|
+
return void 0;
|
|
634
|
+
}
|
|
635
|
+
for (const clause of declaration.heritageClauses) {
|
|
636
|
+
if (clause.token === ts7.SyntaxKind.ExtendsKeyword) {
|
|
637
|
+
const types = clause.types;
|
|
638
|
+
if (types.length > 0) {
|
|
639
|
+
const baseClass = types[0];
|
|
640
|
+
return baseClass.getText();
|
|
641
|
+
}
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return void 0;
|
|
645
|
+
}
|
|
646
|
+
};
|
|
631
647
|
var DirectiveExtractor = class extends ClassExtractor {
|
|
632
648
|
reference;
|
|
633
649
|
metadata;
|
|
@@ -724,13 +740,9 @@ function extractClass(classDeclaration, metadataReader, typeChecker) {
|
|
|
724
740
|
}
|
|
725
741
|
return extractor.extract();
|
|
726
742
|
}
|
|
727
|
-
function extractInterface(declaration, typeChecker) {
|
|
728
|
-
const extractor = new ClassExtractor(declaration, typeChecker);
|
|
729
|
-
return extractor.extract();
|
|
730
|
-
}
|
|
731
743
|
function extractPipeSyntax(metadata, classDeclaration) {
|
|
732
744
|
const transformParams = classDeclaration.members.find((member) => {
|
|
733
|
-
return
|
|
745
|
+
return ts7.isMethodDeclaration(member) && member.name && ts7.isIdentifier(member.name) && member.name.getText() === "transform";
|
|
734
746
|
});
|
|
735
747
|
let paramNames = transformParams.parameters.slice(1).map((param) => {
|
|
736
748
|
return param.name.getText();
|
|
@@ -739,7 +751,7 @@ function extractPipeSyntax(metadata, classDeclaration) {
|
|
|
739
751
|
}
|
|
740
752
|
|
|
741
753
|
// packages/compiler-cli/src/ngtsc/docs/src/constant_extractor.js
|
|
742
|
-
import
|
|
754
|
+
import ts8 from "typescript";
|
|
743
755
|
var LITERAL_AS_ENUM_TAG = "object-literal-as-enum";
|
|
744
756
|
function extractConstant(declaration, typeChecker) {
|
|
745
757
|
const resolvedType = typeChecker.getBaseTypeOfLiteralType(typeChecker.getTypeAtLocation(declaration));
|
|
@@ -771,17 +783,17 @@ function isSyntheticAngularConstant(declaration) {
|
|
|
771
783
|
}
|
|
772
784
|
function extractLiteralPropertiesAsEnumMembers(declaration) {
|
|
773
785
|
let initializer = declaration.initializer;
|
|
774
|
-
while (initializer && (
|
|
786
|
+
while (initializer && (ts8.isAsExpression(initializer) || ts8.isParenthesizedExpression(initializer))) {
|
|
775
787
|
initializer = initializer.expression;
|
|
776
788
|
}
|
|
777
|
-
if (initializer === void 0 || !
|
|
778
|
-
throw new Error(`Declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to an object literal, but received ${initializer ?
|
|
789
|
+
if (initializer === void 0 || !ts8.isObjectLiteralExpression(initializer)) {
|
|
790
|
+
throw new Error(`Declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to an object literal, but received ${initializer ? ts8.SyntaxKind[initializer.kind] : "undefined"}`);
|
|
779
791
|
}
|
|
780
792
|
return initializer.properties.map((prop) => {
|
|
781
|
-
if (!
|
|
793
|
+
if (!ts8.isPropertyAssignment(prop) || !ts8.isIdentifier(prop.name)) {
|
|
782
794
|
throw new Error(`Property in declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be a property assignment with a static name`);
|
|
783
795
|
}
|
|
784
|
-
if (!
|
|
796
|
+
if (!ts8.isNumericLiteral(prop.initializer) && !ts8.isStringLiteralLike(prop.initializer)) {
|
|
785
797
|
throw new Error(`Property in declaration tagged with "${LITERAL_AS_ENUM_TAG}" must be initialized to a number or string literal`);
|
|
786
798
|
}
|
|
787
799
|
return {
|
|
@@ -797,7 +809,48 @@ function extractLiteralPropertiesAsEnumMembers(declaration) {
|
|
|
797
809
|
}
|
|
798
810
|
|
|
799
811
|
// packages/compiler-cli/src/ngtsc/docs/src/decorator_extractor.js
|
|
800
|
-
import
|
|
812
|
+
import ts10 from "typescript";
|
|
813
|
+
|
|
814
|
+
// packages/compiler-cli/src/ngtsc/docs/src/interface_extractor.js
|
|
815
|
+
import ts9 from "typescript";
|
|
816
|
+
var InterfaceExtractor = class extends PropertiesExtractor {
|
|
817
|
+
constructor(declaration, typeChecker) {
|
|
818
|
+
super(declaration, typeChecker);
|
|
819
|
+
}
|
|
820
|
+
/** Extract docs info specific to classes. */
|
|
821
|
+
extract() {
|
|
822
|
+
return {
|
|
823
|
+
name: this.declaration.name.text,
|
|
824
|
+
entryType: EntryType.Interface,
|
|
825
|
+
...super.extract(),
|
|
826
|
+
description: extractJsDocDescription(this.declaration),
|
|
827
|
+
jsdocTags: extractJsDocTags(this.declaration),
|
|
828
|
+
rawComment: extractRawJsDoc(this.declaration),
|
|
829
|
+
extends: this.extractInheritance(this.declaration),
|
|
830
|
+
implements: this.extractInterfaceConformance(this.declaration)
|
|
831
|
+
};
|
|
832
|
+
}
|
|
833
|
+
extractInheritance(declaration) {
|
|
834
|
+
if (!declaration.heritageClauses) {
|
|
835
|
+
return [];
|
|
836
|
+
}
|
|
837
|
+
for (const clause of declaration.heritageClauses) {
|
|
838
|
+
if (clause.token === ts9.SyntaxKind.ExtendsKeyword) {
|
|
839
|
+
const types = clause.types;
|
|
840
|
+
if (types.length > 0) {
|
|
841
|
+
return types.map((t) => t.getText());
|
|
842
|
+
}
|
|
843
|
+
}
|
|
844
|
+
}
|
|
845
|
+
return [];
|
|
846
|
+
}
|
|
847
|
+
};
|
|
848
|
+
function extractInterface(declaration, typeChecker) {
|
|
849
|
+
const extractor = new InterfaceExtractor(declaration, typeChecker);
|
|
850
|
+
return extractor.extract();
|
|
851
|
+
}
|
|
852
|
+
|
|
853
|
+
// packages/compiler-cli/src/ngtsc/docs/src/decorator_extractor.js
|
|
801
854
|
function extractorDecorator(declaration, typeChecker) {
|
|
802
855
|
const documentedNode = getDecoratorJsDocNode(declaration, typeChecker);
|
|
803
856
|
const decoratorType = getDecoratorType(declaration);
|
|
@@ -808,7 +861,7 @@ function extractorDecorator(declaration, typeChecker) {
|
|
|
808
861
|
let signatures = [];
|
|
809
862
|
if (!members) {
|
|
810
863
|
const decoratorInterface = getDecoratorDeclaration(declaration, typeChecker);
|
|
811
|
-
const callSignatures = decoratorInterface.members.filter(
|
|
864
|
+
const callSignatures = decoratorInterface.members.filter(ts10.isCallSignatureDeclaration);
|
|
812
865
|
signatures = getDecoratorSignatures(callSignatures, typeChecker);
|
|
813
866
|
}
|
|
814
867
|
return {
|
|
@@ -826,7 +879,7 @@ function isDecoratorDeclaration(declaration) {
|
|
|
826
879
|
return !!getDecoratorType(declaration);
|
|
827
880
|
}
|
|
828
881
|
function isDecoratorOptionsInterface(declaration) {
|
|
829
|
-
return declaration.getSourceFile().statements.some((s) =>
|
|
882
|
+
return declaration.getSourceFile().statements.some((s) => ts10.isVariableStatement(s) && s.declarationList.declarations.some((d) => isDecoratorDeclaration(d) && d.name.getText() === declaration.name.getText()));
|
|
830
883
|
}
|
|
831
884
|
function getDecoratorType(declaration) {
|
|
832
885
|
const initializer = declaration.initializer?.getFullText() ?? "";
|
|
@@ -844,7 +897,7 @@ function getDecoratorDeclaration(declaration, typeChecker) {
|
|
|
844
897
|
const decoratorType = typeChecker.getTypeAtLocation(decoratorDeclaration);
|
|
845
898
|
const aliasDeclaration = decoratorType.getSymbol().getDeclarations()[0];
|
|
846
899
|
const decoratorInterface = aliasDeclaration;
|
|
847
|
-
if (!decoratorInterface || !
|
|
900
|
+
if (!decoratorInterface || !ts10.isInterfaceDeclaration(decoratorInterface)) {
|
|
848
901
|
throw new Error(`No decorator interface found for "${decoratorName}".`);
|
|
849
902
|
}
|
|
850
903
|
return decoratorInterface;
|
|
@@ -855,12 +908,12 @@ function getDecoratorProperties(declaration, typeChecker) {
|
|
|
855
908
|
const firstParamType = typeChecker.getTypeAtLocation(decoratorFirstParam);
|
|
856
909
|
let firstParamTypeDecl;
|
|
857
910
|
if (firstParamType.isUnion()) {
|
|
858
|
-
const firstParamTypeUnion = firstParamType.types.find((t) => (t.flags &
|
|
911
|
+
const firstParamTypeUnion = firstParamType.types.find((t) => (t.flags & ts10.TypeFlags.Undefined) === 0);
|
|
859
912
|
firstParamTypeDecl = firstParamTypeUnion?.getSymbol()?.getDeclarations()[0];
|
|
860
913
|
} else {
|
|
861
914
|
firstParamTypeDecl = firstParamType.getSymbol()?.getDeclarations()[0];
|
|
862
915
|
}
|
|
863
|
-
if (!firstParamTypeDecl || !
|
|
916
|
+
if (!firstParamTypeDecl || !ts10.isInterfaceDeclaration(firstParamTypeDecl)) {
|
|
864
917
|
return null;
|
|
865
918
|
}
|
|
866
919
|
const interfaceDeclaration = firstParamTypeDecl;
|
|
@@ -888,7 +941,7 @@ function getDecoratorInterface(declaration, typeChecker) {
|
|
|
888
941
|
const symbol = typeChecker.getSymbolAtLocation(declaration.name);
|
|
889
942
|
const decoratorType = typeChecker.getTypeOfSymbolAtLocation(symbol, symbol.valueDeclaration);
|
|
890
943
|
const decoratorInterface = decoratorType.getSymbol()?.getDeclarations()[0];
|
|
891
|
-
if (!decoratorInterface || !
|
|
944
|
+
if (!decoratorInterface || !ts10.isInterfaceDeclaration(decoratorInterface)) {
|
|
892
945
|
throw new Error(`No decorator interface found for "${name}".`);
|
|
893
946
|
}
|
|
894
947
|
return decoratorInterface;
|
|
@@ -897,22 +950,22 @@ function getDecoratorJsDocNode(declaration, typeChecker) {
|
|
|
897
950
|
const name = declaration.name.getText();
|
|
898
951
|
const decoratorInterface = getDecoratorInterface(declaration, typeChecker);
|
|
899
952
|
const callSignature = decoratorInterface.members.filter((node) => {
|
|
900
|
-
return
|
|
953
|
+
return ts10.isCallSignatureDeclaration(node) && extractRawJsDoc(node);
|
|
901
954
|
}).at(-1);
|
|
902
|
-
if (!callSignature || !
|
|
955
|
+
if (!callSignature || !ts10.isCallSignatureDeclaration(callSignature)) {
|
|
903
956
|
throw new Error(`No call signature with JsDoc on "${name}Decorator"`);
|
|
904
957
|
}
|
|
905
958
|
return callSignature;
|
|
906
959
|
}
|
|
907
960
|
function getParamTypeString(paramNode, typeChecker) {
|
|
908
961
|
const type = typeChecker.getTypeAtLocation(paramNode);
|
|
909
|
-
const printer =
|
|
962
|
+
const printer = ts10.createPrinter({ removeComments: true });
|
|
910
963
|
const sourceFile = paramNode.getSourceFile();
|
|
911
964
|
const replace = [];
|
|
912
965
|
if (type.isUnion()) {
|
|
913
966
|
for (const subType of type.types) {
|
|
914
967
|
const decl = subType.getSymbol()?.getDeclarations()?.[0];
|
|
915
|
-
if (decl &&
|
|
968
|
+
if (decl && ts10.isInterfaceDeclaration(decl) && decl.name.text !== "Function") {
|
|
916
969
|
replace.push({
|
|
917
970
|
initial: subType.symbol.name,
|
|
918
971
|
replacedWith: expandType(decl, sourceFile, printer)
|
|
@@ -920,19 +973,19 @@ function getParamTypeString(paramNode, typeChecker) {
|
|
|
920
973
|
}
|
|
921
974
|
}
|
|
922
975
|
}
|
|
923
|
-
let result = printer.printNode(
|
|
976
|
+
let result = printer.printNode(ts10.EmitHint.Unspecified, paramNode, sourceFile).replace(new RegExp(`${paramNode.name.getText()}\\??: `), "").replaceAll(/\s+/g, " ");
|
|
924
977
|
for (const { initial, replacedWith } of replace) {
|
|
925
978
|
result = result.replace(initial, replacedWith);
|
|
926
979
|
}
|
|
927
980
|
return result;
|
|
928
981
|
}
|
|
929
982
|
function expandType(decl, sourceFile, printer) {
|
|
930
|
-
const props = decl.members.map((member) => printer.printNode(
|
|
983
|
+
const props = decl.members.map((member) => printer.printNode(ts10.EmitHint.Unspecified, member, sourceFile)).join(" ").replaceAll(/\s+/g, " ");
|
|
931
984
|
return `{${props}}`;
|
|
932
985
|
}
|
|
933
986
|
|
|
934
987
|
// packages/compiler-cli/src/ngtsc/docs/src/enum_extractor.js
|
|
935
|
-
import
|
|
988
|
+
import ts11 from "typescript";
|
|
936
989
|
function extractEnum(declaration, typeChecker) {
|
|
937
990
|
return {
|
|
938
991
|
name: declaration.name.getText(),
|
|
@@ -956,36 +1009,36 @@ function extractEnumMembers(declaration, checker) {
|
|
|
956
1009
|
}
|
|
957
1010
|
function getEnumMemberValue(memberNode) {
|
|
958
1011
|
const literal = memberNode.getChildren().find((n) => {
|
|
959
|
-
return
|
|
1012
|
+
return ts11.isNumericLiteral(n) || ts11.isStringLiteral(n) || ts11.isPrefixUnaryExpression(n) && n.operator === ts11.SyntaxKind.MinusToken && ts11.isNumericLiteral(n.operand);
|
|
960
1013
|
});
|
|
961
1014
|
return literal?.getText() ?? "";
|
|
962
1015
|
}
|
|
963
1016
|
|
|
964
1017
|
// packages/compiler-cli/src/ngtsc/docs/src/initializer_api_function_extractor.js
|
|
965
|
-
import
|
|
1018
|
+
import ts12 from "typescript";
|
|
966
1019
|
var initializerApiTag = "initializerApiFunction";
|
|
967
1020
|
function isInitializerApiFunction(node, typeChecker) {
|
|
968
|
-
if (
|
|
1021
|
+
if (ts12.isFunctionDeclaration(node) && node.name !== void 0 && node.body === void 0) {
|
|
969
1022
|
const implementation = findImplementationOfFunction(node, typeChecker);
|
|
970
1023
|
if (implementation !== void 0) {
|
|
971
1024
|
node = implementation;
|
|
972
1025
|
}
|
|
973
1026
|
}
|
|
974
|
-
if (!
|
|
1027
|
+
if (!ts12.isFunctionDeclaration(node) && !ts12.isVariableDeclaration(node)) {
|
|
975
1028
|
return false;
|
|
976
1029
|
}
|
|
977
|
-
let tagContainer =
|
|
1030
|
+
let tagContainer = ts12.isFunctionDeclaration(node) ? node : getContainerVariableStatement(node);
|
|
978
1031
|
if (tagContainer === null) {
|
|
979
1032
|
return false;
|
|
980
1033
|
}
|
|
981
|
-
const tags =
|
|
1034
|
+
const tags = ts12.getJSDocTags(tagContainer);
|
|
982
1035
|
return tags.some((t) => t.tagName.text === initializerApiTag);
|
|
983
1036
|
}
|
|
984
1037
|
function extractInitializerApiFunction(node, typeChecker) {
|
|
985
|
-
if (node.name === void 0 || !
|
|
1038
|
+
if (node.name === void 0 || !ts12.isIdentifier(node.name)) {
|
|
986
1039
|
throw new Error(`Initializer API: Expected literal variable name.`);
|
|
987
1040
|
}
|
|
988
|
-
const container =
|
|
1041
|
+
const container = ts12.isFunctionDeclaration(node) ? node : getContainerVariableStatement(node);
|
|
989
1042
|
if (container === null) {
|
|
990
1043
|
throw new Error("Initializer API: Could not find container AST node of variable.");
|
|
991
1044
|
}
|
|
@@ -996,7 +1049,7 @@ function extractInitializerApiFunction(node, typeChecker) {
|
|
|
996
1049
|
for (const property of type.getProperties()) {
|
|
997
1050
|
const subName = property.getName();
|
|
998
1051
|
const subDecl = property.getDeclarations()?.[0];
|
|
999
|
-
if (subDecl === void 0 || !
|
|
1052
|
+
if (subDecl === void 0 || !ts12.isPropertySignature(subDecl)) {
|
|
1000
1053
|
throw new Error(`Initializer API: Could not resolve declaration of sub-property: ${name}.${subName}`);
|
|
1001
1054
|
}
|
|
1002
1055
|
const subType = typeChecker.getTypeAtLocation(subDecl);
|
|
@@ -1005,7 +1058,7 @@ function extractInitializerApiFunction(node, typeChecker) {
|
|
|
1005
1058
|
let jsdocTags;
|
|
1006
1059
|
let description;
|
|
1007
1060
|
let rawComment;
|
|
1008
|
-
if (
|
|
1061
|
+
if (ts12.isFunctionDeclaration(node)) {
|
|
1009
1062
|
const implementation = findImplementationOfFunction(node, typeChecker);
|
|
1010
1063
|
if (implementation === void 0) {
|
|
1011
1064
|
throw new Error(`Initializer API: Could not find implementation of function: ${name}`);
|
|
@@ -1053,10 +1106,10 @@ function extractInitializerApiFunction(node, typeChecker) {
|
|
|
1053
1106
|
};
|
|
1054
1107
|
}
|
|
1055
1108
|
function getContainerVariableStatement(node) {
|
|
1056
|
-
if (!
|
|
1109
|
+
if (!ts12.isVariableDeclarationList(node.parent)) {
|
|
1057
1110
|
return null;
|
|
1058
1111
|
}
|
|
1059
|
-
if (!
|
|
1112
|
+
if (!ts12.isVariableStatement(node.parent.parent)) {
|
|
1060
1113
|
return null;
|
|
1061
1114
|
}
|
|
1062
1115
|
return node.parent.parent;
|
|
@@ -1084,15 +1137,15 @@ function extractTypeAlias(declaration) {
|
|
|
1084
1137
|
}
|
|
1085
1138
|
|
|
1086
1139
|
// packages/compiler-cli/src/ngtsc/docs/src/import_extractor.js
|
|
1087
|
-
import
|
|
1140
|
+
import ts13 from "typescript";
|
|
1088
1141
|
function getImportedSymbols(sourceFile) {
|
|
1089
1142
|
const importSpecifiers = /* @__PURE__ */ new Map();
|
|
1090
1143
|
function visit(node) {
|
|
1091
|
-
if (
|
|
1144
|
+
if (ts13.isImportDeclaration(node)) {
|
|
1092
1145
|
let moduleSpecifier = node.moduleSpecifier.getText(sourceFile).replace(/['"]/g, "");
|
|
1093
1146
|
if (moduleSpecifier.startsWith("@angular/")) {
|
|
1094
1147
|
const namedBindings = node.importClause?.namedBindings;
|
|
1095
|
-
if (namedBindings &&
|
|
1148
|
+
if (namedBindings && ts13.isNamedImports(namedBindings)) {
|
|
1096
1149
|
namedBindings.elements.forEach((importSpecifier) => {
|
|
1097
1150
|
const importName = importSpecifier.name.text;
|
|
1098
1151
|
const importAlias = importSpecifier.propertyName ? importSpecifier.propertyName.text : void 0;
|
|
@@ -1101,7 +1154,7 @@ function getImportedSymbols(sourceFile) {
|
|
|
1101
1154
|
}
|
|
1102
1155
|
}
|
|
1103
1156
|
}
|
|
1104
|
-
|
|
1157
|
+
ts13.forEachChild(node, visit);
|
|
1105
1158
|
}
|
|
1106
1159
|
visit(sourceFile);
|
|
1107
1160
|
return importSpecifiers;
|
|
@@ -1145,8 +1198,8 @@ var DocsExtractor = class {
|
|
|
1145
1198
|
entry.source = {
|
|
1146
1199
|
filePath: getRelativeFilePath(realSourceFile, rootDir),
|
|
1147
1200
|
// Start & End are off by 1
|
|
1148
|
-
startLine:
|
|
1149
|
-
endLine:
|
|
1201
|
+
startLine: ts14.getLineAndCharacterOfPosition(realSourceFile, node.getStart()).line + 1,
|
|
1202
|
+
endLine: ts14.getLineAndCharacterOfPosition(realSourceFile, node.getEnd()).line + 1
|
|
1150
1203
|
};
|
|
1151
1204
|
entries.push({ ...entry, name: exportName });
|
|
1152
1205
|
}
|
|
@@ -1161,20 +1214,20 @@ var DocsExtractor = class {
|
|
|
1161
1214
|
if (isInitializerApiFunction(node, this.typeChecker)) {
|
|
1162
1215
|
return extractInitializerApiFunction(node, this.typeChecker);
|
|
1163
1216
|
}
|
|
1164
|
-
if (
|
|
1217
|
+
if (ts14.isInterfaceDeclaration(node) && !isIgnoredInterface(node)) {
|
|
1165
1218
|
return extractInterface(node, this.typeChecker);
|
|
1166
1219
|
}
|
|
1167
|
-
if (
|
|
1220
|
+
if (ts14.isFunctionDeclaration(node)) {
|
|
1168
1221
|
const functionExtractor = new FunctionExtractor(node.name.getText(), node, this.typeChecker);
|
|
1169
1222
|
return functionExtractor.extract();
|
|
1170
1223
|
}
|
|
1171
|
-
if (
|
|
1224
|
+
if (ts14.isVariableDeclaration(node) && !isSyntheticAngularConstant(node)) {
|
|
1172
1225
|
return isDecoratorDeclaration(node) ? extractorDecorator(node, this.typeChecker) : extractConstant(node, this.typeChecker);
|
|
1173
1226
|
}
|
|
1174
|
-
if (
|
|
1227
|
+
if (ts14.isTypeAliasDeclaration(node)) {
|
|
1175
1228
|
return extractTypeAlias(node);
|
|
1176
1229
|
}
|
|
1177
|
-
if (
|
|
1230
|
+
if (ts14.isEnumDeclaration(node)) {
|
|
1178
1231
|
return extractEnum(node, this.typeChecker);
|
|
1179
1232
|
}
|
|
1180
1233
|
return null;
|
|
@@ -1205,7 +1258,7 @@ function getRelativeFilePath(sourceFile, rootDir) {
|
|
|
1205
1258
|
|
|
1206
1259
|
// packages/compiler-cli/src/ngtsc/program.js
|
|
1207
1260
|
import { HtmlParser, MessageBundle } from "@angular/compiler";
|
|
1208
|
-
import
|
|
1261
|
+
import ts30 from "typescript";
|
|
1209
1262
|
|
|
1210
1263
|
// packages/compiler-cli/src/transformers/i18n.js
|
|
1211
1264
|
import { Xliff, Xliff2, Xmb } from "@angular/compiler";
|
|
@@ -1259,7 +1312,7 @@ function getPathNormalizer(basePath) {
|
|
|
1259
1312
|
}
|
|
1260
1313
|
|
|
1261
1314
|
// packages/compiler-cli/src/typescript_support.js
|
|
1262
|
-
import
|
|
1315
|
+
import ts15 from "typescript";
|
|
1263
1316
|
|
|
1264
1317
|
// packages/compiler-cli/src/version_helpers.js
|
|
1265
1318
|
function toNumbers(value) {
|
|
@@ -1299,7 +1352,7 @@ function compareVersions(v1, v2) {
|
|
|
1299
1352
|
// packages/compiler-cli/src/typescript_support.js
|
|
1300
1353
|
var MIN_TS_VERSION = "5.9.0";
|
|
1301
1354
|
var MAX_TS_VERSION = "6.0.0";
|
|
1302
|
-
var tsVersion =
|
|
1355
|
+
var tsVersion = ts15.version;
|
|
1303
1356
|
function checkVersion(version, minVersion, maxVersion) {
|
|
1304
1357
|
if (compareVersions(version, minVersion) < 0 || compareVersions(version, maxVersion) >= 0) {
|
|
1305
1358
|
throw new Error(`The Angular Compiler requires TypeScript >=${minVersion} and <${maxVersion} but ${version} was found instead.`);
|
|
@@ -1310,7 +1363,7 @@ function verifySupportedTypeScriptVersion() {
|
|
|
1310
1363
|
}
|
|
1311
1364
|
|
|
1312
1365
|
// packages/compiler-cli/src/ngtsc/core/src/compiler.js
|
|
1313
|
-
import
|
|
1366
|
+
import ts28 from "typescript";
|
|
1314
1367
|
|
|
1315
1368
|
// packages/compiler-cli/src/ngtsc/cycles/src/analyzer.js
|
|
1316
1369
|
var CycleAnalyzer = class {
|
|
@@ -1419,7 +1472,7 @@ var Cycle = class {
|
|
|
1419
1472
|
};
|
|
1420
1473
|
|
|
1421
1474
|
// packages/compiler-cli/src/ngtsc/cycles/src/imports.js
|
|
1422
|
-
import
|
|
1475
|
+
import ts16 from "typescript";
|
|
1423
1476
|
var ImportGraph = class {
|
|
1424
1477
|
checker;
|
|
1425
1478
|
perf;
|
|
@@ -1485,10 +1538,10 @@ var ImportGraph = class {
|
|
|
1485
1538
|
return this.perf.inPhase(PerfPhase.CycleDetection, () => {
|
|
1486
1539
|
const imports = /* @__PURE__ */ new Set();
|
|
1487
1540
|
for (const stmt of sf.statements) {
|
|
1488
|
-
if (!
|
|
1541
|
+
if (!ts16.isImportDeclaration(stmt) && !ts16.isExportDeclaration(stmt) || stmt.moduleSpecifier === void 0) {
|
|
1489
1542
|
continue;
|
|
1490
1543
|
}
|
|
1491
|
-
if (
|
|
1544
|
+
if (ts16.isImportDeclaration(stmt) && stmt.importClause !== void 0 && isTypeOnlyImportClause(stmt.importClause)) {
|
|
1492
1545
|
continue;
|
|
1493
1546
|
}
|
|
1494
1547
|
const symbol = this.checker.getSymbolAtLocation(stmt.moduleSpecifier);
|
|
@@ -1496,7 +1549,7 @@ var ImportGraph = class {
|
|
|
1496
1549
|
continue;
|
|
1497
1550
|
}
|
|
1498
1551
|
const moduleFile = symbol.valueDeclaration;
|
|
1499
|
-
if (
|
|
1552
|
+
if (ts16.isSourceFile(moduleFile) && isLocalFile(moduleFile)) {
|
|
1500
1553
|
imports.add(moduleFile);
|
|
1501
1554
|
}
|
|
1502
1555
|
}
|
|
@@ -1511,7 +1564,7 @@ function isTypeOnlyImportClause(node) {
|
|
|
1511
1564
|
if (node.isTypeOnly) {
|
|
1512
1565
|
return true;
|
|
1513
1566
|
}
|
|
1514
|
-
if (node.namedBindings !== void 0 &&
|
|
1567
|
+
if (node.namedBindings !== void 0 && ts16.isNamedImports(node.namedBindings) && node.namedBindings.elements.every((specifier) => specifier.isTypeOnly)) {
|
|
1515
1568
|
return true;
|
|
1516
1569
|
}
|
|
1517
1570
|
return false;
|
|
@@ -1539,7 +1592,7 @@ var Found = class {
|
|
|
1539
1592
|
};
|
|
1540
1593
|
|
|
1541
1594
|
// packages/compiler-cli/src/ngtsc/entry_point/src/generator.js
|
|
1542
|
-
import
|
|
1595
|
+
import ts17 from "typescript";
|
|
1543
1596
|
var FlatIndexGenerator = class {
|
|
1544
1597
|
entryPoint;
|
|
1545
1598
|
moduleName;
|
|
@@ -1558,7 +1611,7 @@ var FlatIndexGenerator = class {
|
|
|
1558
1611
|
|
|
1559
1612
|
export * from '${relativeEntryPoint}';
|
|
1560
1613
|
`;
|
|
1561
|
-
const genFile =
|
|
1614
|
+
const genFile = ts17.createSourceFile(this.flatIndexPath, contents, ts17.ScriptTarget.ES2015, true, ts17.ScriptKind.TS);
|
|
1562
1615
|
if (this.moduleName !== null) {
|
|
1563
1616
|
genFile.moduleName = this.moduleName;
|
|
1564
1617
|
}
|
|
@@ -1583,7 +1636,7 @@ function findFlatIndexEntryPoint(rootFiles) {
|
|
|
1583
1636
|
}
|
|
1584
1637
|
|
|
1585
1638
|
// packages/compiler-cli/src/ngtsc/entry_point/src/private_export_checker.js
|
|
1586
|
-
import
|
|
1639
|
+
import ts18 from "typescript";
|
|
1587
1640
|
function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
1588
1641
|
const diagnostics = [];
|
|
1589
1642
|
const topLevelExports = /* @__PURE__ */ new Set();
|
|
@@ -1593,7 +1646,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
1593
1646
|
}
|
|
1594
1647
|
const exportedSymbols = checker.getExportsOfModule(moduleSymbol);
|
|
1595
1648
|
exportedSymbols.forEach((symbol) => {
|
|
1596
|
-
if (symbol.flags &
|
|
1649
|
+
if (symbol.flags & ts18.SymbolFlags.Alias) {
|
|
1597
1650
|
symbol = checker.getAliasedSymbol(symbol);
|
|
1598
1651
|
}
|
|
1599
1652
|
const decl = symbol.valueDeclaration;
|
|
@@ -1617,7 +1670,7 @@ function checkForPrivateExports(entryPoint, checker, refGraph) {
|
|
|
1617
1670
|
visibleVia = transitivePath.map((seg) => getNameOfDeclaration(seg)).join(" -> ");
|
|
1618
1671
|
}
|
|
1619
1672
|
const diagnostic = {
|
|
1620
|
-
category:
|
|
1673
|
+
category: ts18.DiagnosticCategory.Error,
|
|
1621
1674
|
code: ngErrorCode(ErrorCode.SYMBOL_NOT_EXPORTED),
|
|
1622
1675
|
file: transitiveReference.getSourceFile(),
|
|
1623
1676
|
...getPosOfDeclaration(transitiveReference),
|
|
@@ -1637,7 +1690,7 @@ function getPosOfDeclaration(decl) {
|
|
|
1637
1690
|
};
|
|
1638
1691
|
}
|
|
1639
1692
|
function getIdentifierOfDeclaration(decl) {
|
|
1640
|
-
if ((
|
|
1693
|
+
if ((ts18.isClassDeclaration(decl) || ts18.isVariableDeclaration(decl) || ts18.isFunctionDeclaration(decl)) && decl.name !== void 0 && ts18.isIdentifier(decl.name)) {
|
|
1641
1694
|
return decl.name;
|
|
1642
1695
|
} else {
|
|
1643
1696
|
return null;
|
|
@@ -1649,13 +1702,13 @@ function getNameOfDeclaration(decl) {
|
|
|
1649
1702
|
}
|
|
1650
1703
|
function getDescriptorOfDeclaration(decl) {
|
|
1651
1704
|
switch (decl.kind) {
|
|
1652
|
-
case
|
|
1705
|
+
case ts18.SyntaxKind.ClassDeclaration:
|
|
1653
1706
|
return "class";
|
|
1654
|
-
case
|
|
1707
|
+
case ts18.SyntaxKind.FunctionDeclaration:
|
|
1655
1708
|
return "function";
|
|
1656
|
-
case
|
|
1709
|
+
case ts18.SyntaxKind.VariableDeclaration:
|
|
1657
1710
|
return "variable";
|
|
1658
|
-
case
|
|
1711
|
+
case ts18.SyntaxKind.EnumDeclaration:
|
|
1659
1712
|
return "enum";
|
|
1660
1713
|
default:
|
|
1661
1714
|
return "declaration";
|
|
@@ -2495,7 +2548,7 @@ var NgModuleIndexImpl = class {
|
|
|
2495
2548
|
};
|
|
2496
2549
|
|
|
2497
2550
|
// packages/compiler-cli/src/ngtsc/resource/src/loader.js
|
|
2498
|
-
import
|
|
2551
|
+
import ts19 from "typescript";
|
|
2499
2552
|
var CSS_PREPROCESSOR_EXT = /(\.scss|\.sass|\.less|\.styl)$/;
|
|
2500
2553
|
var RESOURCE_MARKER = ".$ngresource$";
|
|
2501
2554
|
var RESOURCE_MARKER_TS = RESOURCE_MARKER + ".ts";
|
|
@@ -2671,7 +2724,7 @@ var AdapterResourceLoader = class {
|
|
|
2671
2724
|
* for the file by setting up a module resolution for it that will fail.
|
|
2672
2725
|
*/
|
|
2673
2726
|
getResolvedCandidateLocations(url, fromFile) {
|
|
2674
|
-
const failedLookup =
|
|
2727
|
+
const failedLookup = ts19.resolveModuleName(url + RESOURCE_MARKER, fromFile, this.options, this.lookupResolutionHost);
|
|
2675
2728
|
if (failedLookup.failedLookupLocations === void 0) {
|
|
2676
2729
|
throw new Error(`Internal error: expected to find failedLookupLocations during resolution of resource '${url}' in context of ${fromFile}`);
|
|
2677
2730
|
}
|
|
@@ -2807,7 +2860,7 @@ var StandaloneComponentScopeReader = class {
|
|
|
2807
2860
|
import { ASTWithSource as ASTWithSource2, BindingType, Interpolation, PrefixNot, PropertyRead as PropertyRead2, TmplAstBoundAttribute, TmplAstElement as TmplAstElement2, TmplAstIfBlock, TmplAstSwitchBlock, TmplAstTemplate as TmplAstTemplate2 } from "@angular/compiler";
|
|
2808
2861
|
|
|
2809
2862
|
// packages/compiler-cli/src/ngtsc/typecheck/src/symbol_util.js
|
|
2810
|
-
import
|
|
2863
|
+
import ts20 from "typescript";
|
|
2811
2864
|
var SIGNAL_FNS = /* @__PURE__ */ new Set([
|
|
2812
2865
|
"WritableSignal",
|
|
2813
2866
|
"Signal",
|
|
@@ -2824,7 +2877,7 @@ function isSignalSymbol(symbol) {
|
|
|
2824
2877
|
const declarations = symbol.getDeclarations();
|
|
2825
2878
|
return declarations !== void 0 && declarations.some((decl) => {
|
|
2826
2879
|
const fileName = decl.getSourceFile().fileName;
|
|
2827
|
-
return (
|
|
2880
|
+
return (ts20.isInterfaceDeclaration(decl) || ts20.isTypeAliasDeclaration(decl)) && SIGNAL_FNS.has(decl.name.text) && (fileName.includes("@angular/core") || fileName.includes("angular2/rc/packages/core") || fileName.includes("bin/packages/core"));
|
|
2828
2881
|
});
|
|
2829
2882
|
}
|
|
2830
2883
|
|
|
@@ -3077,7 +3130,9 @@ var KNOWN_CONTROL_FLOW_DIRECTIVES2 = /* @__PURE__ */ new Set([
|
|
|
3077
3130
|
"ngForOf",
|
|
3078
3131
|
"ngForTrackBy",
|
|
3079
3132
|
"ngSwitchCase",
|
|
3080
|
-
"ngSwitchDefault"
|
|
3133
|
+
"ngSwitchDefault",
|
|
3134
|
+
"ngIfThen",
|
|
3135
|
+
"ngIfElse"
|
|
3081
3136
|
]);
|
|
3082
3137
|
var MissingStructuralDirectiveCheck = class extends TemplateCheckWithVisitor {
|
|
3083
3138
|
code = ErrorCode.MISSING_STRUCTURAL_DIRECTIVE;
|
|
@@ -3095,9 +3150,9 @@ var MissingStructuralDirectiveCheck = class extends TemplateCheckWithVisitor {
|
|
|
3095
3150
|
if (!customStructuralDirective)
|
|
3096
3151
|
return [];
|
|
3097
3152
|
const symbol = ctx.templateTypeChecker.getSymbolOfNode(node, component);
|
|
3098
|
-
|
|
3153
|
+
const hasStructuralDirective = symbol?.directives.some((dir) => dir.selector?.includes(`[${customStructuralDirective.name}]`));
|
|
3154
|
+
if (hasStructuralDirective)
|
|
3099
3155
|
return [];
|
|
3100
|
-
}
|
|
3101
3156
|
const sourceSpan = customStructuralDirective.keySpan || customStructuralDirective.sourceSpan;
|
|
3102
3157
|
const errorMessage = `A structural directive \`${customStructuralDirective.name}\` was used in the template without a corresponding import in the component. Make sure that the directive is included in the \`@Component.imports\` array of this component.`;
|
|
3103
3158
|
return [ctx.makeTemplateDiagnostic(sourceSpan, errorMessage)];
|
|
@@ -3111,7 +3166,7 @@ var factory5 = {
|
|
|
3111
3166
|
|
|
3112
3167
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.js
|
|
3113
3168
|
import { Binary } from "@angular/compiler";
|
|
3114
|
-
import
|
|
3169
|
+
import ts21 from "typescript";
|
|
3115
3170
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
3116
3171
|
code = ErrorCode.NULLISH_COALESCING_NOT_NULLABLE;
|
|
3117
3172
|
visitNode(ctx, component, node) {
|
|
@@ -3122,7 +3177,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3122
3177
|
return [];
|
|
3123
3178
|
}
|
|
3124
3179
|
const typeLeft = symbolLeft.tsType;
|
|
3125
|
-
if (typeLeft.flags & (
|
|
3180
|
+
if (typeLeft.flags & (ts21.TypeFlags.Any | ts21.TypeFlags.Unknown)) {
|
|
3126
3181
|
return [];
|
|
3127
3182
|
}
|
|
3128
3183
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -3153,7 +3208,7 @@ var factory6 = {
|
|
|
3153
3208
|
|
|
3154
3209
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.js
|
|
3155
3210
|
import { KeyedRead, SafeCall, SafeKeyedRead, SafePropertyRead } from "@angular/compiler";
|
|
3156
|
-
import
|
|
3211
|
+
import ts22 from "typescript";
|
|
3157
3212
|
var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
3158
3213
|
noUncheckedIndexedAccess;
|
|
3159
3214
|
code = ErrorCode.OPTIONAL_CHAIN_NOT_NULLABLE;
|
|
@@ -3173,7 +3228,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3173
3228
|
return [];
|
|
3174
3229
|
}
|
|
3175
3230
|
const typeLeft = symbolLeft.tsType;
|
|
3176
|
-
if (typeLeft.flags & (
|
|
3231
|
+
if (typeLeft.flags & (ts22.TypeFlags.Any | ts22.TypeFlags.Unknown)) {
|
|
3177
3232
|
return [];
|
|
3178
3233
|
}
|
|
3179
3234
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -3543,7 +3598,7 @@ var factory16 = {
|
|
|
3543
3598
|
};
|
|
3544
3599
|
|
|
3545
3600
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
|
|
3546
|
-
import
|
|
3601
|
+
import ts23 from "typescript";
|
|
3547
3602
|
|
|
3548
3603
|
// packages/compiler-cli/src/ngtsc/core/api/src/public_options.js
|
|
3549
3604
|
var DiagnosticCategoryLabel;
|
|
@@ -3595,9 +3650,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
3595
3650
|
function diagnosticLabelToCategory(label) {
|
|
3596
3651
|
switch (label) {
|
|
3597
3652
|
case DiagnosticCategoryLabel.Warning:
|
|
3598
|
-
return
|
|
3653
|
+
return ts23.DiagnosticCategory.Warning;
|
|
3599
3654
|
case DiagnosticCategoryLabel.Error:
|
|
3600
|
-
return
|
|
3655
|
+
return ts23.DiagnosticCategory.Error;
|
|
3601
3656
|
case DiagnosticCategoryLabel.Suppress:
|
|
3602
3657
|
return null;
|
|
3603
3658
|
default:
|
|
@@ -3636,7 +3691,7 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
|
|
|
3636
3691
|
|
|
3637
3692
|
// packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.js
|
|
3638
3693
|
import { ASTWithSource as ASTWithSource5, ImplicitReceiver as ImplicitReceiver2, ParsedEventType as ParsedEventType2, PropertyRead as PropertyRead6, Binary as Binary3, RecursiveAstVisitor, TmplAstBoundEvent as TmplAstBoundEvent3, TmplAstLetDeclaration as TmplAstLetDeclaration2, TmplAstRecursiveVisitor, TmplAstVariable as TmplAstVariable2 } from "@angular/compiler";
|
|
3639
|
-
import
|
|
3694
|
+
import ts24 from "typescript";
|
|
3640
3695
|
var TemplateSemanticsCheckerImpl = class {
|
|
3641
3696
|
templateTypeChecker;
|
|
3642
3697
|
constructor(templateTypeChecker) {
|
|
@@ -3719,7 +3774,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor {
|
|
|
3719
3774
|
}
|
|
3720
3775
|
makeIllegalTemplateVarDiagnostic(target, expressionNode, errorMessage) {
|
|
3721
3776
|
const span = target instanceof TmplAstVariable2 ? target.valueSpan || target.sourceSpan : target.sourceSpan;
|
|
3722
|
-
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan,
|
|
3777
|
+
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan, ts24.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMessage, [
|
|
3723
3778
|
{
|
|
3724
3779
|
text: `'${target.name}' is declared here.`,
|
|
3725
3780
|
start: span.start.offset,
|
|
@@ -3734,7 +3789,7 @@ function unwrapAstWithSource(ast) {
|
|
|
3734
3789
|
}
|
|
3735
3790
|
|
|
3736
3791
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.js
|
|
3737
|
-
import
|
|
3792
|
+
import ts25 from "typescript";
|
|
3738
3793
|
var APIS_TO_CHECK = [
|
|
3739
3794
|
INPUT_INITIALIZER_FN,
|
|
3740
3795
|
MODEL_INITIALIZER_FN,
|
|
@@ -3754,13 +3809,13 @@ var InitializerApiUsageRule = class {
|
|
|
3754
3809
|
});
|
|
3755
3810
|
}
|
|
3756
3811
|
checkNode(node) {
|
|
3757
|
-
if (!
|
|
3812
|
+
if (!ts25.isCallExpression(node)) {
|
|
3758
3813
|
return null;
|
|
3759
3814
|
}
|
|
3760
|
-
while (node.parent && (
|
|
3815
|
+
while (node.parent && (ts25.isParenthesizedExpression(node.parent) || ts25.isAsExpression(node.parent))) {
|
|
3761
3816
|
node = node.parent;
|
|
3762
3817
|
}
|
|
3763
|
-
if (!node.parent || !
|
|
3818
|
+
if (!node.parent || !ts25.isCallExpression(node)) {
|
|
3764
3819
|
return null;
|
|
3765
3820
|
}
|
|
3766
3821
|
const identifiedInitializer = tryParseInitializerApi(APIS_TO_CHECK, node, this.reflector, this.importedSymbolsTracker);
|
|
@@ -3768,12 +3823,12 @@ var InitializerApiUsageRule = class {
|
|
|
3768
3823
|
return null;
|
|
3769
3824
|
}
|
|
3770
3825
|
const functionName = identifiedInitializer.api.functionName + (identifiedInitializer.isRequired ? ".required" : "");
|
|
3771
|
-
if (
|
|
3826
|
+
if (ts25.isPropertyDeclaration(node.parent) && node.parent.initializer === node) {
|
|
3772
3827
|
let closestClass = node.parent;
|
|
3773
|
-
while (closestClass && !
|
|
3828
|
+
while (closestClass && !ts25.isClassDeclaration(closestClass)) {
|
|
3774
3829
|
closestClass = closestClass.parent;
|
|
3775
3830
|
}
|
|
3776
|
-
if (closestClass &&
|
|
3831
|
+
if (closestClass && ts25.isClassDeclaration(closestClass)) {
|
|
3777
3832
|
const decorators = this.reflector.getDecoratorsOfDeclaration(closestClass);
|
|
3778
3833
|
const isComponentOrDirective = decorators !== null && decorators.some((decorator) => {
|
|
3779
3834
|
return decorator.import?.from === "@angular/core" && (decorator.name === "Component" || decorator.name === "Directive");
|
|
@@ -3786,7 +3841,7 @@ var InitializerApiUsageRule = class {
|
|
|
3786
3841
|
};
|
|
3787
3842
|
|
|
3788
3843
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/unused_standalone_imports_rule.js
|
|
3789
|
-
import
|
|
3844
|
+
import ts26 from "typescript";
|
|
3790
3845
|
var UnusedStandaloneImportsRule = class {
|
|
3791
3846
|
templateTypeChecker;
|
|
3792
3847
|
typeCheckingConfig;
|
|
@@ -3800,7 +3855,7 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3800
3855
|
return this.typeCheckingConfig.unusedStandaloneImports !== "suppress" && (this.importedSymbolsTracker.hasNamedImport(sourceFile, "Component", "@angular/core") || this.importedSymbolsTracker.hasNamespaceImport(sourceFile, "@angular/core"));
|
|
3801
3856
|
}
|
|
3802
3857
|
checkNode(node) {
|
|
3803
|
-
if (!
|
|
3858
|
+
if (!ts26.isClassDeclaration(node)) {
|
|
3804
3859
|
return null;
|
|
3805
3860
|
}
|
|
3806
3861
|
const metadata = this.templateTypeChecker.getDirectiveMetadata(node);
|
|
@@ -3816,8 +3871,8 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3816
3871
|
if (unused === null) {
|
|
3817
3872
|
return null;
|
|
3818
3873
|
}
|
|
3819
|
-
const propertyAssignment = closestNode(metadata.rawImports,
|
|
3820
|
-
const category = this.typeCheckingConfig.unusedStandaloneImports === "error" ?
|
|
3874
|
+
const propertyAssignment = closestNode(metadata.rawImports, ts26.isPropertyAssignment);
|
|
3875
|
+
const category = this.typeCheckingConfig.unusedStandaloneImports === "error" ? ts26.DiagnosticCategory.Error : ts26.DiagnosticCategory.Warning;
|
|
3821
3876
|
if (unused.length === metadata.imports.length && propertyAssignment !== null) {
|
|
3822
3877
|
return makeDiagnostic(ErrorCode.UNUSED_STANDALONE_IMPORTS, propertyAssignment.name, "All imports are unused", void 0, category);
|
|
3823
3878
|
}
|
|
@@ -3861,8 +3916,8 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3861
3916
|
}
|
|
3862
3917
|
let current = reference.getIdentityIn(rawImports.getSourceFile());
|
|
3863
3918
|
while (current !== null) {
|
|
3864
|
-
if (
|
|
3865
|
-
return !!current.modifiers?.some((m) => m.kind ===
|
|
3919
|
+
if (ts26.isVariableStatement(current)) {
|
|
3920
|
+
return !!current.modifiers?.some((m) => m.kind === ts26.SyntaxKind.ExportKeyword);
|
|
3866
3921
|
}
|
|
3867
3922
|
current = current.parent ?? null;
|
|
3868
3923
|
}
|
|
@@ -3882,7 +3937,7 @@ function closestNode(start, predicate) {
|
|
|
3882
3937
|
}
|
|
3883
3938
|
|
|
3884
3939
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/forbidden_required_initializer_invocation_rule.js
|
|
3885
|
-
import
|
|
3940
|
+
import ts27 from "typescript";
|
|
3886
3941
|
var APIS_TO_CHECK2 = [
|
|
3887
3942
|
INPUT_INITIALIZER_FN,
|
|
3888
3943
|
MODEL_INITIALIZER_FN,
|
|
@@ -3901,12 +3956,12 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3901
3956
|
});
|
|
3902
3957
|
}
|
|
3903
3958
|
checkNode(node) {
|
|
3904
|
-
if (!
|
|
3959
|
+
if (!ts27.isClassDeclaration(node))
|
|
3905
3960
|
return null;
|
|
3906
|
-
const requiredInitializerDeclarations = node.members.filter((m) =>
|
|
3961
|
+
const requiredInitializerDeclarations = node.members.filter((m) => ts27.isPropertyDeclaration(m) && this.isPropDeclarationARequiredInitializer(m));
|
|
3907
3962
|
const diagnostics = [];
|
|
3908
3963
|
for (let decl of node.members) {
|
|
3909
|
-
if (!
|
|
3964
|
+
if (!ts27.isPropertyDeclaration(decl))
|
|
3910
3965
|
continue;
|
|
3911
3966
|
const initiallizerExpr = decl.initializer;
|
|
3912
3967
|
if (!initiallizerExpr)
|
|
@@ -3914,10 +3969,10 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3914
3969
|
checkForbiddenInvocation(initiallizerExpr);
|
|
3915
3970
|
}
|
|
3916
3971
|
function checkForbiddenInvocation(node2) {
|
|
3917
|
-
if (
|
|
3972
|
+
if (ts27.isArrowFunction(node2) || ts27.isFunctionExpression(node2))
|
|
3918
3973
|
return;
|
|
3919
|
-
if (
|
|
3920
|
-
|
|
3974
|
+
if (ts27.isPropertyAccessExpression(node2) && node2.expression.kind === ts27.SyntaxKind.ThisKeyword && // With the following we make sure we only flag invoked required initializers
|
|
3975
|
+
ts27.isCallExpression(node2.parent) && node2.parent.expression === node2) {
|
|
3921
3976
|
const requiredProp = requiredInitializerDeclarations.find((prop) => prop.name.getText() === node2.name.getText());
|
|
3922
3977
|
if (requiredProp) {
|
|
3923
3978
|
const initializerFn = requiredProp.initializer.expression.expression.getText();
|
|
@@ -3942,7 +3997,7 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3942
3997
|
}
|
|
3943
3998
|
};
|
|
3944
3999
|
function getConstructorFromClass(node) {
|
|
3945
|
-
return node.members.find((m) =>
|
|
4000
|
+
return node.members.find((m) => ts27.isConstructorDeclaration(m) && m.body !== void 0);
|
|
3946
4001
|
}
|
|
3947
4002
|
|
|
3948
4003
|
// packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
|
|
@@ -4151,7 +4206,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4151
4206
|
this.currentProgram = inputProgram;
|
|
4152
4207
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
4153
4208
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
4154
|
-
const moduleResolutionCache =
|
|
4209
|
+
const moduleResolutionCache = ts28.createModuleResolutionCache(
|
|
4155
4210
|
this.adapter.getCurrentDirectory(),
|
|
4156
4211
|
// doen't retain a reference to `this`, if other closures in the constructor here reference
|
|
4157
4212
|
// `this` internally then a closure created here would retain them. This can cause major
|
|
@@ -4199,7 +4254,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4199
4254
|
}
|
|
4200
4255
|
for (const clazz of classesToUpdate) {
|
|
4201
4256
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
4202
|
-
if (!
|
|
4257
|
+
if (!ts28.isClassDeclaration(clazz)) {
|
|
4203
4258
|
continue;
|
|
4204
4259
|
}
|
|
4205
4260
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -4409,12 +4464,12 @@ var NgCompiler = class _NgCompiler {
|
|
|
4409
4464
|
if (compilation.supportJitMode && compilation.jitDeclarationRegistry.jitDeclarations.size > 0) {
|
|
4410
4465
|
const { jitDeclarations } = compilation.jitDeclarationRegistry;
|
|
4411
4466
|
const jitDeclarationsArray = Array.from(jitDeclarations);
|
|
4412
|
-
const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) =>
|
|
4467
|
+
const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) => ts28.getOriginalNode(d)));
|
|
4413
4468
|
const sourceFilesWithJit = new Set(jitDeclarationsArray.map((d) => d.getSourceFile().fileName));
|
|
4414
4469
|
before.push((ctx) => {
|
|
4415
4470
|
const reflectionHost = new TypeScriptReflectionHost(this.inputProgram.getTypeChecker());
|
|
4416
4471
|
const jitTransform = angularJitApplicationTransform(this.inputProgram, compilation.isCore, (node) => {
|
|
4417
|
-
node =
|
|
4472
|
+
node = ts28.getOriginalNode(node, ts28.isClassDeclaration);
|
|
4418
4473
|
return reflectionHost.isClass(node) && jitDeclarationOriginalNodes.has(node);
|
|
4419
4474
|
})(ctx);
|
|
4420
4475
|
return (sourceFile) => {
|
|
@@ -4493,16 +4548,16 @@ var NgCompiler = class _NgCompiler {
|
|
|
4493
4548
|
return null;
|
|
4494
4549
|
}
|
|
4495
4550
|
const sourceFile = node.getSourceFile();
|
|
4496
|
-
const printer =
|
|
4497
|
-
const nodeText = printer.printNode(
|
|
4498
|
-
return
|
|
4551
|
+
const printer = ts28.createPrinter();
|
|
4552
|
+
const nodeText = printer.printNode(ts28.EmitHint.Unspecified, callback, sourceFile);
|
|
4553
|
+
return ts28.transpileModule(nodeText, {
|
|
4499
4554
|
compilerOptions: {
|
|
4500
4555
|
...this.options,
|
|
4501
4556
|
// Some module types can produce additional code (see #60795) whereas we need the
|
|
4502
4557
|
// HMR update module to use a native `export`. Override the `target` and `module`
|
|
4503
4558
|
// to ensure that it looks as expected.
|
|
4504
|
-
module:
|
|
4505
|
-
target:
|
|
4559
|
+
module: ts28.ModuleKind.ES2022,
|
|
4560
|
+
target: ts28.ScriptTarget.ES2022
|
|
4506
4561
|
},
|
|
4507
4562
|
fileName: sourceFile.fileName,
|
|
4508
4563
|
reportDiagnostics: false
|
|
@@ -4878,18 +4933,18 @@ function isAngularCorePackage(program) {
|
|
|
4878
4933
|
return false;
|
|
4879
4934
|
}
|
|
4880
4935
|
return r3Symbols.statements.some((stmt) => {
|
|
4881
|
-
if (!
|
|
4936
|
+
if (!ts28.isVariableStatement(stmt)) {
|
|
4882
4937
|
return false;
|
|
4883
4938
|
}
|
|
4884
|
-
const modifiers =
|
|
4885
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
4939
|
+
const modifiers = ts28.getModifiers(stmt);
|
|
4940
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts28.SyntaxKind.ExportKeyword)) {
|
|
4886
4941
|
return false;
|
|
4887
4942
|
}
|
|
4888
4943
|
return stmt.declarationList.declarations.some((decl) => {
|
|
4889
|
-
if (!
|
|
4944
|
+
if (!ts28.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
4890
4945
|
return false;
|
|
4891
4946
|
}
|
|
4892
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
4947
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts28.SyntaxKind.TrueKeyword) {
|
|
4893
4948
|
return false;
|
|
4894
4949
|
}
|
|
4895
4950
|
return true;
|
|
@@ -4902,7 +4957,7 @@ function getR3SymbolsFile(program) {
|
|
|
4902
4957
|
function* verifyCompatibleTypeCheckOptions(options) {
|
|
4903
4958
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
4904
4959
|
yield makeConfigDiagnostic({
|
|
4905
|
-
category:
|
|
4960
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4906
4961
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
4907
4962
|
messageText: `
|
|
4908
4963
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -4921,7 +4976,7 @@ https://angular.dev/tools/cli/template-typecheck
|
|
|
4921
4976
|
}
|
|
4922
4977
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
4923
4978
|
yield makeConfigDiagnostic({
|
|
4924
|
-
category:
|
|
4979
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4925
4980
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
4926
4981
|
messageText: `
|
|
4927
4982
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -4938,7 +4993,7 @@ One of the following actions is required:
|
|
|
4938
4993
|
const defaultCategory = options.extendedDiagnostics?.defaultCategory;
|
|
4939
4994
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
4940
4995
|
yield makeConfigDiagnostic({
|
|
4941
|
-
category:
|
|
4996
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4942
4997
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
4943
4998
|
messageText: `
|
|
4944
4999
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -4951,7 +5006,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
4951
5006
|
for (const [checkName, category] of Object.entries(options.extendedDiagnostics?.checks ?? {})) {
|
|
4952
5007
|
if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
|
|
4953
5008
|
yield makeConfigDiagnostic({
|
|
4954
|
-
category:
|
|
5009
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4955
5010
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
4956
5011
|
messageText: `
|
|
4957
5012
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -4963,7 +5018,7 @@ ${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
|
|
|
4963
5018
|
}
|
|
4964
5019
|
if (!allowedCategoryLabels.includes(category)) {
|
|
4965
5020
|
yield makeConfigDiagnostic({
|
|
4966
|
-
category:
|
|
5021
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4967
5022
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
4968
5023
|
messageText: `
|
|
4969
5024
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -4981,7 +5036,7 @@ function verifyEmitDeclarationOnly(options) {
|
|
|
4981
5036
|
}
|
|
4982
5037
|
return [
|
|
4983
5038
|
makeConfigDiagnostic({
|
|
4984
|
-
category:
|
|
5039
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4985
5040
|
code: ErrorCode.CONFIG_EMIT_DECLARATION_ONLY_UNSUPPORTED,
|
|
4986
5041
|
messageText: 'TS compiler option "emitDeclarationOnly" is not supported.'
|
|
4987
5042
|
})
|
|
@@ -5006,7 +5061,7 @@ var ReferenceGraphAdapter = class {
|
|
|
5006
5061
|
for (const { node } of references) {
|
|
5007
5062
|
let sourceFile = node.getSourceFile();
|
|
5008
5063
|
if (sourceFile === void 0) {
|
|
5009
|
-
sourceFile =
|
|
5064
|
+
sourceFile = ts28.getOriginalNode(node).getSourceFile();
|
|
5010
5065
|
}
|
|
5011
5066
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
5012
5067
|
this.graph.add(source, node);
|
|
@@ -5047,7 +5102,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
5047
5102
|
}
|
|
5048
5103
|
|
|
5049
5104
|
// packages/compiler-cli/src/ngtsc/core/src/host.js
|
|
5050
|
-
import
|
|
5105
|
+
import ts29 from "typescript";
|
|
5051
5106
|
var DelegatingCompilerHost = class {
|
|
5052
5107
|
delegate;
|
|
5053
5108
|
createHash;
|
|
@@ -5186,7 +5241,7 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5186
5241
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
5187
5242
|
if (entryPoint === null) {
|
|
5188
5243
|
diagnostics.push({
|
|
5189
|
-
category:
|
|
5244
|
+
category: ts29.DiagnosticCategory.Error,
|
|
5190
5245
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
5191
5246
|
file: void 0,
|
|
5192
5247
|
start: void 0,
|
|
@@ -5240,10 +5295,10 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5240
5295
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
5241
5296
|
}
|
|
5242
5297
|
createCachedResolveModuleNamesFunction() {
|
|
5243
|
-
const moduleResolutionCache =
|
|
5298
|
+
const moduleResolutionCache = ts29.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
5244
5299
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
5245
5300
|
return moduleNames.map((moduleName) => {
|
|
5246
|
-
const module =
|
|
5301
|
+
const module = ts29.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
5247
5302
|
return module.resolvedModule;
|
|
5248
5303
|
});
|
|
5249
5304
|
};
|
|
@@ -5275,7 +5330,7 @@ var NgtscProgram = class {
|
|
|
5275
5330
|
if (reuseProgram !== void 0) {
|
|
5276
5331
|
retagAllTsFiles(reuseProgram);
|
|
5277
5332
|
}
|
|
5278
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
5333
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts30.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
5279
5334
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
5280
5335
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
5281
5336
|
this.host.postProgramCreationCleanup();
|
|
@@ -5504,16 +5559,16 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
5504
5559
|
}
|
|
5505
5560
|
|
|
5506
5561
|
// packages/compiler-cli/src/perform_compile.js
|
|
5507
|
-
import
|
|
5562
|
+
import ts32 from "typescript";
|
|
5508
5563
|
|
|
5509
5564
|
// packages/compiler-cli/src/transformers/util.js
|
|
5510
|
-
import
|
|
5565
|
+
import ts31 from "typescript";
|
|
5511
5566
|
function createMessageDiagnostic(messageText) {
|
|
5512
5567
|
return {
|
|
5513
5568
|
file: void 0,
|
|
5514
5569
|
start: void 0,
|
|
5515
5570
|
length: void 0,
|
|
5516
|
-
category:
|
|
5571
|
+
category: ts31.DiagnosticCategory.Message,
|
|
5517
5572
|
messageText,
|
|
5518
5573
|
code: DEFAULT_ERROR_CODE,
|
|
5519
5574
|
source: SOURCE
|
|
@@ -5522,13 +5577,13 @@ function createMessageDiagnostic(messageText) {
|
|
|
5522
5577
|
|
|
5523
5578
|
// packages/compiler-cli/src/perform_compile.js
|
|
5524
5579
|
var defaultFormatHost = {
|
|
5525
|
-
getCurrentDirectory: () =>
|
|
5580
|
+
getCurrentDirectory: () => ts32.sys.getCurrentDirectory(),
|
|
5526
5581
|
getCanonicalFileName: (fileName) => fileName,
|
|
5527
|
-
getNewLine: () =>
|
|
5582
|
+
getNewLine: () => ts32.sys.newLine
|
|
5528
5583
|
};
|
|
5529
5584
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
5530
5585
|
if (diags && diags.length) {
|
|
5531
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
5586
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts32.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
5532
5587
|
} else {
|
|
5533
5588
|
return "";
|
|
5534
5589
|
}
|
|
@@ -5544,7 +5599,7 @@ function calcProjectFileAndBasePath(project, host = getFileSystem()) {
|
|
|
5544
5599
|
function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
5545
5600
|
try {
|
|
5546
5601
|
const fs = getFileSystem();
|
|
5547
|
-
const readConfigFile = (configFile) =>
|
|
5602
|
+
const readConfigFile = (configFile) => ts32.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
5548
5603
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
5549
5604
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
5550
5605
|
if (error2) {
|
|
@@ -5580,7 +5635,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
5580
5635
|
...existingOptions
|
|
5581
5636
|
};
|
|
5582
5637
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
5583
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
5638
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts32.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
5584
5639
|
let emitFlags = EmitFlags.Default;
|
|
5585
5640
|
if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
|
|
5586
5641
|
emitFlags |= EmitFlags.Metadata;
|
|
@@ -5592,7 +5647,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
5592
5647
|
} catch (e) {
|
|
5593
5648
|
const errors = [
|
|
5594
5649
|
{
|
|
5595
|
-
category:
|
|
5650
|
+
category: ts32.DiagnosticCategory.Error,
|
|
5596
5651
|
messageText: e.stack ?? e.message,
|
|
5597
5652
|
file: void 0,
|
|
5598
5653
|
start: void 0,
|
|
@@ -5627,7 +5682,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
5627
5682
|
}
|
|
5628
5683
|
} else {
|
|
5629
5684
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
5630
|
-
const { resolvedModule } =
|
|
5685
|
+
const { resolvedModule } = ts32.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts32.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
|
|
5631
5686
|
if (resolvedModule) {
|
|
5632
5687
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
5633
5688
|
}
|
|
@@ -5637,7 +5692,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
5637
5692
|
function exitCodeFromResult(diags) {
|
|
5638
5693
|
if (!diags)
|
|
5639
5694
|
return 0;
|
|
5640
|
-
if (diags.every((diag) => diag.category !==
|
|
5695
|
+
if (diags.every((diag) => diag.category !== ts32.DiagnosticCategory.Error)) {
|
|
5641
5696
|
return 0;
|
|
5642
5697
|
}
|
|
5643
5698
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -5675,7 +5730,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
5675
5730
|
} catch (e) {
|
|
5676
5731
|
program = void 0;
|
|
5677
5732
|
allDiagnostics.push({
|
|
5678
|
-
category:
|
|
5733
|
+
category: ts32.DiagnosticCategory.Error,
|
|
5679
5734
|
messageText: e.stack ?? e.message,
|
|
5680
5735
|
code: UNKNOWN_ERROR_CODE,
|
|
5681
5736
|
file: void 0,
|
|
@@ -5705,7 +5760,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
5705
5760
|
return allDiagnostics;
|
|
5706
5761
|
}
|
|
5707
5762
|
function hasErrors(diags) {
|
|
5708
|
-
return diags.some((d) => d.category ===
|
|
5763
|
+
return diags.some((d) => d.category === ts32.DiagnosticCategory.Error);
|
|
5709
5764
|
}
|
|
5710
5765
|
|
|
5711
5766
|
export {
|