@angular/compiler-cli 20.3.6 → 20.3.7
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-BPDNYZBC.js +1 -1
- package/bundles/{chunk-TFJ2HFCB.js → chunk-WLUQ7BOF.js} +243 -190
- package/bundles/{chunk-ZE3ZGBK3.js → chunk-YCKNQVIQ.js} +1 -1
- package/bundles/index.js +2 -2
- package/bundles/src/bin/ng_xi18n.js +2 -2
- package/bundles/src/bin/ngc.js +2 -2
- package/linker/src/file_linker/partial_linkers/util.d.ts +1 -1
- package/package.json +2 -2
- 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
|
@@ -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.8.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
|
|
|
@@ -3123,7 +3176,7 @@ var factory5 = {
|
|
|
3123
3176
|
|
|
3124
3177
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/checks/nullish_coalescing_not_nullable/index.js
|
|
3125
3178
|
import { Binary } from "@angular/compiler";
|
|
3126
|
-
import
|
|
3179
|
+
import ts21 from "typescript";
|
|
3127
3180
|
var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
3128
3181
|
canVisitStructuralAttributes = false;
|
|
3129
3182
|
code = ErrorCode.NULLISH_COALESCING_NOT_NULLABLE;
|
|
@@ -3135,7 +3188,7 @@ var NullishCoalescingNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3135
3188
|
return [];
|
|
3136
3189
|
}
|
|
3137
3190
|
const typeLeft = symbolLeft.tsType;
|
|
3138
|
-
if (typeLeft.flags & (
|
|
3191
|
+
if (typeLeft.flags & (ts21.TypeFlags.Any | ts21.TypeFlags.Unknown)) {
|
|
3139
3192
|
return [];
|
|
3140
3193
|
}
|
|
3141
3194
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -3166,7 +3219,7 @@ var factory6 = {
|
|
|
3166
3219
|
|
|
3167
3220
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/checks/optional_chain_not_nullable/index.js
|
|
3168
3221
|
import { KeyedRead, SafeCall, SafeKeyedRead, SafePropertyRead } from "@angular/compiler";
|
|
3169
|
-
import
|
|
3222
|
+
import ts22 from "typescript";
|
|
3170
3223
|
var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
3171
3224
|
noUncheckedIndexedAccess;
|
|
3172
3225
|
canVisitStructuralAttributes = false;
|
|
@@ -3187,7 +3240,7 @@ var OptionalChainNotNullableCheck = class extends TemplateCheckWithVisitor {
|
|
|
3187
3240
|
return [];
|
|
3188
3241
|
}
|
|
3189
3242
|
const typeLeft = symbolLeft.tsType;
|
|
3190
|
-
if (typeLeft.flags & (
|
|
3243
|
+
if (typeLeft.flags & (ts22.TypeFlags.Any | ts22.TypeFlags.Unknown)) {
|
|
3191
3244
|
return [];
|
|
3192
3245
|
}
|
|
3193
3246
|
if (typeLeft.getNonNullableType() !== typeLeft)
|
|
@@ -3493,7 +3546,7 @@ var factory15 = {
|
|
|
3493
3546
|
};
|
|
3494
3547
|
|
|
3495
3548
|
// packages/compiler-cli/src/ngtsc/typecheck/extended/src/extended_template_checker.js
|
|
3496
|
-
import
|
|
3549
|
+
import ts23 from "typescript";
|
|
3497
3550
|
|
|
3498
3551
|
// packages/compiler-cli/src/ngtsc/core/api/src/public_options.js
|
|
3499
3552
|
var DiagnosticCategoryLabel;
|
|
@@ -3545,9 +3598,9 @@ var ExtendedTemplateCheckerImpl = class {
|
|
|
3545
3598
|
function diagnosticLabelToCategory(label) {
|
|
3546
3599
|
switch (label) {
|
|
3547
3600
|
case DiagnosticCategoryLabel.Warning:
|
|
3548
|
-
return
|
|
3601
|
+
return ts23.DiagnosticCategory.Warning;
|
|
3549
3602
|
case DiagnosticCategoryLabel.Error:
|
|
3550
|
-
return
|
|
3603
|
+
return ts23.DiagnosticCategory.Error;
|
|
3551
3604
|
case DiagnosticCategoryLabel.Suppress:
|
|
3552
3605
|
return null;
|
|
3553
3606
|
default:
|
|
@@ -3585,7 +3638,7 @@ var SUPPORTED_DIAGNOSTIC_NAMES = /* @__PURE__ */ new Set([
|
|
|
3585
3638
|
|
|
3586
3639
|
// packages/compiler-cli/src/ngtsc/typecheck/template_semantics/src/template_semantics_checker.js
|
|
3587
3640
|
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";
|
|
3588
|
-
import
|
|
3641
|
+
import ts24 from "typescript";
|
|
3589
3642
|
var TemplateSemanticsCheckerImpl = class {
|
|
3590
3643
|
templateTypeChecker;
|
|
3591
3644
|
constructor(templateTypeChecker) {
|
|
@@ -3668,7 +3721,7 @@ var ExpressionsSemanticsVisitor = class extends RecursiveAstVisitor {
|
|
|
3668
3721
|
}
|
|
3669
3722
|
makeIllegalTemplateVarDiagnostic(target, expressionNode, errorMessage) {
|
|
3670
3723
|
const span = target instanceof TmplAstVariable2 ? target.valueSpan || target.sourceSpan : target.sourceSpan;
|
|
3671
|
-
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan,
|
|
3724
|
+
return this.templateTypeChecker.makeTemplateDiagnostic(this.component, expressionNode.handlerSpan, ts24.DiagnosticCategory.Error, ngErrorCode(ErrorCode.WRITE_TO_READ_ONLY_VARIABLE), errorMessage, [
|
|
3672
3725
|
{
|
|
3673
3726
|
text: `'${target.name}' is declared here.`,
|
|
3674
3727
|
start: span.start.offset,
|
|
@@ -3683,7 +3736,7 @@ function unwrapAstWithSource(ast) {
|
|
|
3683
3736
|
}
|
|
3684
3737
|
|
|
3685
3738
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/initializer_api_usage_rule.js
|
|
3686
|
-
import
|
|
3739
|
+
import ts25 from "typescript";
|
|
3687
3740
|
var APIS_TO_CHECK = [
|
|
3688
3741
|
INPUT_INITIALIZER_FN,
|
|
3689
3742
|
MODEL_INITIALIZER_FN,
|
|
@@ -3703,13 +3756,13 @@ var InitializerApiUsageRule = class {
|
|
|
3703
3756
|
});
|
|
3704
3757
|
}
|
|
3705
3758
|
checkNode(node) {
|
|
3706
|
-
if (!
|
|
3759
|
+
if (!ts25.isCallExpression(node)) {
|
|
3707
3760
|
return null;
|
|
3708
3761
|
}
|
|
3709
|
-
while (node.parent && (
|
|
3762
|
+
while (node.parent && (ts25.isParenthesizedExpression(node.parent) || ts25.isAsExpression(node.parent))) {
|
|
3710
3763
|
node = node.parent;
|
|
3711
3764
|
}
|
|
3712
|
-
if (!node.parent || !
|
|
3765
|
+
if (!node.parent || !ts25.isCallExpression(node)) {
|
|
3713
3766
|
return null;
|
|
3714
3767
|
}
|
|
3715
3768
|
const identifiedInitializer = tryParseInitializerApi(APIS_TO_CHECK, node, this.reflector, this.importedSymbolsTracker);
|
|
@@ -3717,12 +3770,12 @@ var InitializerApiUsageRule = class {
|
|
|
3717
3770
|
return null;
|
|
3718
3771
|
}
|
|
3719
3772
|
const functionName = identifiedInitializer.api.functionName + (identifiedInitializer.isRequired ? ".required" : "");
|
|
3720
|
-
if (
|
|
3773
|
+
if (ts25.isPropertyDeclaration(node.parent) && node.parent.initializer === node) {
|
|
3721
3774
|
let closestClass = node.parent;
|
|
3722
|
-
while (closestClass && !
|
|
3775
|
+
while (closestClass && !ts25.isClassDeclaration(closestClass)) {
|
|
3723
3776
|
closestClass = closestClass.parent;
|
|
3724
3777
|
}
|
|
3725
|
-
if (closestClass &&
|
|
3778
|
+
if (closestClass && ts25.isClassDeclaration(closestClass)) {
|
|
3726
3779
|
const decorators = this.reflector.getDecoratorsOfDeclaration(closestClass);
|
|
3727
3780
|
const isComponentOrDirective = decorators !== null && decorators.some((decorator) => {
|
|
3728
3781
|
return decorator.import?.from === "@angular/core" && (decorator.name === "Component" || decorator.name === "Directive");
|
|
@@ -3735,7 +3788,7 @@ var InitializerApiUsageRule = class {
|
|
|
3735
3788
|
};
|
|
3736
3789
|
|
|
3737
3790
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/unused_standalone_imports_rule.js
|
|
3738
|
-
import
|
|
3791
|
+
import ts26 from "typescript";
|
|
3739
3792
|
var UnusedStandaloneImportsRule = class {
|
|
3740
3793
|
templateTypeChecker;
|
|
3741
3794
|
typeCheckingConfig;
|
|
@@ -3749,7 +3802,7 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3749
3802
|
return this.typeCheckingConfig.unusedStandaloneImports !== "suppress" && (this.importedSymbolsTracker.hasNamedImport(sourceFile, "Component", "@angular/core") || this.importedSymbolsTracker.hasNamespaceImport(sourceFile, "@angular/core"));
|
|
3750
3803
|
}
|
|
3751
3804
|
checkNode(node) {
|
|
3752
|
-
if (!
|
|
3805
|
+
if (!ts26.isClassDeclaration(node)) {
|
|
3753
3806
|
return null;
|
|
3754
3807
|
}
|
|
3755
3808
|
const metadata = this.templateTypeChecker.getDirectiveMetadata(node);
|
|
@@ -3765,8 +3818,8 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3765
3818
|
if (unused === null) {
|
|
3766
3819
|
return null;
|
|
3767
3820
|
}
|
|
3768
|
-
const propertyAssignment = closestNode(metadata.rawImports,
|
|
3769
|
-
const category = this.typeCheckingConfig.unusedStandaloneImports === "error" ?
|
|
3821
|
+
const propertyAssignment = closestNode(metadata.rawImports, ts26.isPropertyAssignment);
|
|
3822
|
+
const category = this.typeCheckingConfig.unusedStandaloneImports === "error" ? ts26.DiagnosticCategory.Error : ts26.DiagnosticCategory.Warning;
|
|
3770
3823
|
if (unused.length === metadata.imports.length && propertyAssignment !== null) {
|
|
3771
3824
|
return makeDiagnostic(ErrorCode.UNUSED_STANDALONE_IMPORTS, propertyAssignment.name, "All imports are unused", void 0, category);
|
|
3772
3825
|
}
|
|
@@ -3810,8 +3863,8 @@ var UnusedStandaloneImportsRule = class {
|
|
|
3810
3863
|
}
|
|
3811
3864
|
let current = reference.getIdentityIn(rawImports.getSourceFile());
|
|
3812
3865
|
while (current !== null) {
|
|
3813
|
-
if (
|
|
3814
|
-
return !!current.modifiers?.some((m) => m.kind ===
|
|
3866
|
+
if (ts26.isVariableStatement(current)) {
|
|
3867
|
+
return !!current.modifiers?.some((m) => m.kind === ts26.SyntaxKind.ExportKeyword);
|
|
3815
3868
|
}
|
|
3816
3869
|
current = current.parent ?? null;
|
|
3817
3870
|
}
|
|
@@ -3831,7 +3884,7 @@ function closestNode(start, predicate) {
|
|
|
3831
3884
|
}
|
|
3832
3885
|
|
|
3833
3886
|
// packages/compiler-cli/src/ngtsc/validation/src/rules/forbidden_required_initializer_invocation_rule.js
|
|
3834
|
-
import
|
|
3887
|
+
import ts27 from "typescript";
|
|
3835
3888
|
var APIS_TO_CHECK2 = [
|
|
3836
3889
|
INPUT_INITIALIZER_FN,
|
|
3837
3890
|
MODEL_INITIALIZER_FN,
|
|
@@ -3850,12 +3903,12 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3850
3903
|
});
|
|
3851
3904
|
}
|
|
3852
3905
|
checkNode(node) {
|
|
3853
|
-
if (!
|
|
3906
|
+
if (!ts27.isClassDeclaration(node))
|
|
3854
3907
|
return null;
|
|
3855
|
-
const requiredInitializerDeclarations = node.members.filter((m) =>
|
|
3908
|
+
const requiredInitializerDeclarations = node.members.filter((m) => ts27.isPropertyDeclaration(m) && this.isPropDeclarationARequiredInitializer(m));
|
|
3856
3909
|
const diagnostics = [];
|
|
3857
3910
|
for (let decl of node.members) {
|
|
3858
|
-
if (!
|
|
3911
|
+
if (!ts27.isPropertyDeclaration(decl))
|
|
3859
3912
|
continue;
|
|
3860
3913
|
const initiallizerExpr = decl.initializer;
|
|
3861
3914
|
if (!initiallizerExpr)
|
|
@@ -3863,10 +3916,10 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3863
3916
|
checkForbiddenInvocation(initiallizerExpr);
|
|
3864
3917
|
}
|
|
3865
3918
|
function checkForbiddenInvocation(node2) {
|
|
3866
|
-
if (
|
|
3919
|
+
if (ts27.isArrowFunction(node2) || ts27.isFunctionExpression(node2))
|
|
3867
3920
|
return;
|
|
3868
|
-
if (
|
|
3869
|
-
|
|
3921
|
+
if (ts27.isPropertyAccessExpression(node2) && node2.expression.kind === ts27.SyntaxKind.ThisKeyword && // With the following we make sure we only flag invoked required initializers
|
|
3922
|
+
ts27.isCallExpression(node2.parent) && node2.parent.expression === node2) {
|
|
3870
3923
|
const requiredProp = requiredInitializerDeclarations.find((prop) => prop.name.getText() === node2.name.getText());
|
|
3871
3924
|
if (requiredProp) {
|
|
3872
3925
|
const initializerFn = requiredProp.initializer.expression.expression.getText();
|
|
@@ -3891,7 +3944,7 @@ var ForbiddenRequiredInitializersInvocationRule = class {
|
|
|
3891
3944
|
}
|
|
3892
3945
|
};
|
|
3893
3946
|
function getConstructorFromClass(node) {
|
|
3894
|
-
return node.members.find((m) =>
|
|
3947
|
+
return node.members.find((m) => ts27.isConstructorDeclaration(m) && m.body !== void 0);
|
|
3895
3948
|
}
|
|
3896
3949
|
|
|
3897
3950
|
// packages/compiler-cli/src/ngtsc/validation/src/source_file_validator.js
|
|
@@ -4100,7 +4153,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4100
4153
|
this.currentProgram = inputProgram;
|
|
4101
4154
|
this.closureCompilerEnabled = !!this.options.annotateForClosureCompiler;
|
|
4102
4155
|
this.entryPoint = adapter.entryPoint !== null ? getSourceFileOrNull(inputProgram, adapter.entryPoint) : null;
|
|
4103
|
-
const moduleResolutionCache =
|
|
4156
|
+
const moduleResolutionCache = ts28.createModuleResolutionCache(
|
|
4104
4157
|
this.adapter.getCurrentDirectory(),
|
|
4105
4158
|
// doen't retain a reference to `this`, if other closures in the constructor here reference
|
|
4106
4159
|
// `this` internally then a closure created here would retain them. This can cause major
|
|
@@ -4148,7 +4201,7 @@ var NgCompiler = class _NgCompiler {
|
|
|
4148
4201
|
}
|
|
4149
4202
|
for (const clazz of classesToUpdate) {
|
|
4150
4203
|
this.compilation.traitCompiler.updateResources(clazz);
|
|
4151
|
-
if (!
|
|
4204
|
+
if (!ts28.isClassDeclaration(clazz)) {
|
|
4152
4205
|
continue;
|
|
4153
4206
|
}
|
|
4154
4207
|
this.compilation.templateTypeChecker.invalidateClass(clazz);
|
|
@@ -4358,12 +4411,12 @@ var NgCompiler = class _NgCompiler {
|
|
|
4358
4411
|
if (compilation.supportJitMode && compilation.jitDeclarationRegistry.jitDeclarations.size > 0) {
|
|
4359
4412
|
const { jitDeclarations } = compilation.jitDeclarationRegistry;
|
|
4360
4413
|
const jitDeclarationsArray = Array.from(jitDeclarations);
|
|
4361
|
-
const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) =>
|
|
4414
|
+
const jitDeclarationOriginalNodes = new Set(jitDeclarationsArray.map((d) => ts28.getOriginalNode(d)));
|
|
4362
4415
|
const sourceFilesWithJit = new Set(jitDeclarationsArray.map((d) => d.getSourceFile().fileName));
|
|
4363
4416
|
before.push((ctx) => {
|
|
4364
4417
|
const reflectionHost = new TypeScriptReflectionHost(this.inputProgram.getTypeChecker());
|
|
4365
4418
|
const jitTransform = angularJitApplicationTransform(this.inputProgram, compilation.isCore, (node) => {
|
|
4366
|
-
node =
|
|
4419
|
+
node = ts28.getOriginalNode(node, ts28.isClassDeclaration);
|
|
4367
4420
|
return reflectionHost.isClass(node) && jitDeclarationOriginalNodes.has(node);
|
|
4368
4421
|
})(ctx);
|
|
4369
4422
|
return (sourceFile) => {
|
|
@@ -4442,16 +4495,16 @@ var NgCompiler = class _NgCompiler {
|
|
|
4442
4495
|
return null;
|
|
4443
4496
|
}
|
|
4444
4497
|
const sourceFile = node.getSourceFile();
|
|
4445
|
-
const printer =
|
|
4446
|
-
const nodeText = printer.printNode(
|
|
4447
|
-
return
|
|
4498
|
+
const printer = ts28.createPrinter();
|
|
4499
|
+
const nodeText = printer.printNode(ts28.EmitHint.Unspecified, callback, sourceFile);
|
|
4500
|
+
return ts28.transpileModule(nodeText, {
|
|
4448
4501
|
compilerOptions: {
|
|
4449
4502
|
...this.options,
|
|
4450
4503
|
// Some module types can produce additional code (see #60795) whereas we need the
|
|
4451
4504
|
// HMR update module to use a native `export`. Override the `target` and `module`
|
|
4452
4505
|
// to ensure that it looks as expected.
|
|
4453
|
-
module:
|
|
4454
|
-
target:
|
|
4506
|
+
module: ts28.ModuleKind.ES2022,
|
|
4507
|
+
target: ts28.ScriptTarget.ES2022
|
|
4455
4508
|
},
|
|
4456
4509
|
fileName: sourceFile.fileName,
|
|
4457
4510
|
reportDiagnostics: false
|
|
@@ -4827,18 +4880,18 @@ function isAngularCorePackage(program) {
|
|
|
4827
4880
|
return false;
|
|
4828
4881
|
}
|
|
4829
4882
|
return r3Symbols.statements.some((stmt) => {
|
|
4830
|
-
if (!
|
|
4883
|
+
if (!ts28.isVariableStatement(stmt)) {
|
|
4831
4884
|
return false;
|
|
4832
4885
|
}
|
|
4833
|
-
const modifiers =
|
|
4834
|
-
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind ===
|
|
4886
|
+
const modifiers = ts28.getModifiers(stmt);
|
|
4887
|
+
if (modifiers === void 0 || !modifiers.some((mod) => mod.kind === ts28.SyntaxKind.ExportKeyword)) {
|
|
4835
4888
|
return false;
|
|
4836
4889
|
}
|
|
4837
4890
|
return stmt.declarationList.declarations.some((decl) => {
|
|
4838
|
-
if (!
|
|
4891
|
+
if (!ts28.isIdentifier(decl.name) || decl.name.text !== "ITS_JUST_ANGULAR") {
|
|
4839
4892
|
return false;
|
|
4840
4893
|
}
|
|
4841
|
-
if (decl.initializer === void 0 || decl.initializer.kind !==
|
|
4894
|
+
if (decl.initializer === void 0 || decl.initializer.kind !== ts28.SyntaxKind.TrueKeyword) {
|
|
4842
4895
|
return false;
|
|
4843
4896
|
}
|
|
4844
4897
|
return true;
|
|
@@ -4851,7 +4904,7 @@ function getR3SymbolsFile(program) {
|
|
|
4851
4904
|
function* verifyCompatibleTypeCheckOptions(options) {
|
|
4852
4905
|
if (options.fullTemplateTypeCheck === false && options.strictTemplates === true) {
|
|
4853
4906
|
yield makeConfigDiagnostic({
|
|
4854
|
-
category:
|
|
4907
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4855
4908
|
code: ErrorCode.CONFIG_STRICT_TEMPLATES_IMPLIES_FULL_TEMPLATE_TYPECHECK,
|
|
4856
4909
|
messageText: `
|
|
4857
4910
|
Angular compiler option "strictTemplates" is enabled, however "fullTemplateTypeCheck" is disabled.
|
|
@@ -4870,7 +4923,7 @@ https://angular.dev/tools/cli/template-typecheck
|
|
|
4870
4923
|
}
|
|
4871
4924
|
if (options.extendedDiagnostics && options.strictTemplates === false) {
|
|
4872
4925
|
yield makeConfigDiagnostic({
|
|
4873
|
-
category:
|
|
4926
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4874
4927
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_IMPLIES_STRICT_TEMPLATES,
|
|
4875
4928
|
messageText: `
|
|
4876
4929
|
Angular compiler option "extendedDiagnostics" is configured, however "strictTemplates" is disabled.
|
|
@@ -4887,7 +4940,7 @@ One of the following actions is required:
|
|
|
4887
4940
|
const defaultCategory = options.extendedDiagnostics?.defaultCategory;
|
|
4888
4941
|
if (defaultCategory && !allowedCategoryLabels.includes(defaultCategory)) {
|
|
4889
4942
|
yield makeConfigDiagnostic({
|
|
4890
|
-
category:
|
|
4943
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4891
4944
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
4892
4945
|
messageText: `
|
|
4893
4946
|
Angular compiler option "extendedDiagnostics.defaultCategory" has an unknown diagnostic category: "${defaultCategory}".
|
|
@@ -4900,7 +4953,7 @@ ${allowedCategoryLabels.join("\n")}
|
|
|
4900
4953
|
for (const [checkName, category] of Object.entries(options.extendedDiagnostics?.checks ?? {})) {
|
|
4901
4954
|
if (!SUPPORTED_DIAGNOSTIC_NAMES.has(checkName)) {
|
|
4902
4955
|
yield makeConfigDiagnostic({
|
|
4903
|
-
category:
|
|
4956
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4904
4957
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CHECK,
|
|
4905
4958
|
messageText: `
|
|
4906
4959
|
Angular compiler option "extendedDiagnostics.checks" has an unknown check: "${checkName}".
|
|
@@ -4912,7 +4965,7 @@ ${Array.from(SUPPORTED_DIAGNOSTIC_NAMES).join("\n")}
|
|
|
4912
4965
|
}
|
|
4913
4966
|
if (!allowedCategoryLabels.includes(category)) {
|
|
4914
4967
|
yield makeConfigDiagnostic({
|
|
4915
|
-
category:
|
|
4968
|
+
category: ts28.DiagnosticCategory.Error,
|
|
4916
4969
|
code: ErrorCode.CONFIG_EXTENDED_DIAGNOSTICS_UNKNOWN_CATEGORY_LABEL,
|
|
4917
4970
|
messageText: `
|
|
4918
4971
|
Angular compiler option "extendedDiagnostics.checks['${checkName}']" has an unknown diagnostic category: "${category}".
|
|
@@ -4943,7 +4996,7 @@ var ReferenceGraphAdapter = class {
|
|
|
4943
4996
|
for (const { node } of references) {
|
|
4944
4997
|
let sourceFile = node.getSourceFile();
|
|
4945
4998
|
if (sourceFile === void 0) {
|
|
4946
|
-
sourceFile =
|
|
4999
|
+
sourceFile = ts28.getOriginalNode(node).getSourceFile();
|
|
4947
5000
|
}
|
|
4948
5001
|
if (sourceFile === void 0 || !isDtsPath(sourceFile.fileName)) {
|
|
4949
5002
|
this.graph.add(source, node);
|
|
@@ -4984,7 +5037,7 @@ function versionMapFromProgram(program, driver) {
|
|
|
4984
5037
|
}
|
|
4985
5038
|
|
|
4986
5039
|
// packages/compiler-cli/src/ngtsc/core/src/host.js
|
|
4987
|
-
import
|
|
5040
|
+
import ts29 from "typescript";
|
|
4988
5041
|
var DelegatingCompilerHost = class {
|
|
4989
5042
|
delegate;
|
|
4990
5043
|
createHash;
|
|
@@ -5123,7 +5176,7 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5123
5176
|
entryPoint = findFlatIndexEntryPoint(normalizedTsInputFiles);
|
|
5124
5177
|
if (entryPoint === null) {
|
|
5125
5178
|
diagnostics.push({
|
|
5126
|
-
category:
|
|
5179
|
+
category: ts29.DiagnosticCategory.Error,
|
|
5127
5180
|
code: ngErrorCode(ErrorCode.CONFIG_FLAT_MODULE_NO_INDEX),
|
|
5128
5181
|
file: void 0,
|
|
5129
5182
|
start: void 0,
|
|
@@ -5177,10 +5230,10 @@ var NgCompilerHost = class _NgCompilerHost extends DelegatingCompilerHost {
|
|
|
5177
5230
|
return this.fileNameToModuleName !== void 0 ? this : null;
|
|
5178
5231
|
}
|
|
5179
5232
|
createCachedResolveModuleNamesFunction() {
|
|
5180
|
-
const moduleResolutionCache =
|
|
5233
|
+
const moduleResolutionCache = ts29.createModuleResolutionCache(this.getCurrentDirectory(), this.getCanonicalFileName.bind(this));
|
|
5181
5234
|
return (moduleNames, containingFile, reusedNames, redirectedReference, options) => {
|
|
5182
5235
|
return moduleNames.map((moduleName) => {
|
|
5183
|
-
const module =
|
|
5236
|
+
const module = ts29.resolveModuleName(moduleName, containingFile, options, this, moduleResolutionCache, redirectedReference);
|
|
5184
5237
|
return module.resolvedModule;
|
|
5185
5238
|
});
|
|
5186
5239
|
};
|
|
@@ -5212,7 +5265,7 @@ var NgtscProgram = class {
|
|
|
5212
5265
|
if (reuseProgram !== void 0) {
|
|
5213
5266
|
retagAllTsFiles(reuseProgram);
|
|
5214
5267
|
}
|
|
5215
|
-
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () =>
|
|
5268
|
+
this.tsProgram = perfRecorder.inPhase(PerfPhase.TypeScriptProgramCreate, () => ts30.createProgram(this.host.inputFiles, options, this.host, reuseProgram));
|
|
5216
5269
|
perfRecorder.phase(PerfPhase.Unaccounted);
|
|
5217
5270
|
perfRecorder.memory(PerfCheckpoint.TypeScriptProgramCreate);
|
|
5218
5271
|
this.host.postProgramCreationCleanup();
|
|
@@ -5441,16 +5494,16 @@ function createProgram({ rootNames, options, host, oldProgram }) {
|
|
|
5441
5494
|
}
|
|
5442
5495
|
|
|
5443
5496
|
// packages/compiler-cli/src/perform_compile.js
|
|
5444
|
-
import
|
|
5497
|
+
import ts32 from "typescript";
|
|
5445
5498
|
|
|
5446
5499
|
// packages/compiler-cli/src/transformers/util.js
|
|
5447
|
-
import
|
|
5500
|
+
import ts31 from "typescript";
|
|
5448
5501
|
function createMessageDiagnostic(messageText) {
|
|
5449
5502
|
return {
|
|
5450
5503
|
file: void 0,
|
|
5451
5504
|
start: void 0,
|
|
5452
5505
|
length: void 0,
|
|
5453
|
-
category:
|
|
5506
|
+
category: ts31.DiagnosticCategory.Message,
|
|
5454
5507
|
messageText,
|
|
5455
5508
|
code: DEFAULT_ERROR_CODE,
|
|
5456
5509
|
source: SOURCE
|
|
@@ -5459,13 +5512,13 @@ function createMessageDiagnostic(messageText) {
|
|
|
5459
5512
|
|
|
5460
5513
|
// packages/compiler-cli/src/perform_compile.js
|
|
5461
5514
|
var defaultFormatHost = {
|
|
5462
|
-
getCurrentDirectory: () =>
|
|
5515
|
+
getCurrentDirectory: () => ts32.sys.getCurrentDirectory(),
|
|
5463
5516
|
getCanonicalFileName: (fileName) => fileName,
|
|
5464
|
-
getNewLine: () =>
|
|
5517
|
+
getNewLine: () => ts32.sys.newLine
|
|
5465
5518
|
};
|
|
5466
5519
|
function formatDiagnostics(diags, host = defaultFormatHost) {
|
|
5467
5520
|
if (diags && diags.length) {
|
|
5468
|
-
return diags.map((diagnostic) => replaceTsWithNgInErrors(
|
|
5521
|
+
return diags.map((diagnostic) => replaceTsWithNgInErrors(ts32.formatDiagnosticsWithColorAndContext([diagnostic], host))).join("");
|
|
5469
5522
|
} else {
|
|
5470
5523
|
return "";
|
|
5471
5524
|
}
|
|
@@ -5481,7 +5534,7 @@ function calcProjectFileAndBasePath(project, host = getFileSystem()) {
|
|
|
5481
5534
|
function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
5482
5535
|
try {
|
|
5483
5536
|
const fs = getFileSystem();
|
|
5484
|
-
const readConfigFile = (configFile) =>
|
|
5537
|
+
const readConfigFile = (configFile) => ts32.readConfigFile(configFile, (file) => host.readFile(host.resolve(file)));
|
|
5485
5538
|
const readAngularCompilerOptions = (configFile, parentOptions = {}) => {
|
|
5486
5539
|
const { config: config2, error: error2 } = readConfigFile(configFile);
|
|
5487
5540
|
if (error2) {
|
|
@@ -5517,7 +5570,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
5517
5570
|
...existingOptions
|
|
5518
5571
|
};
|
|
5519
5572
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
5520
|
-
const { options, errors, fileNames: rootNames, projectReferences } =
|
|
5573
|
+
const { options, errors, fileNames: rootNames, projectReferences } = ts32.parseJsonConfigFileContent(config, parseConfigHost, basePath, existingCompilerOptions, configFileName);
|
|
5521
5574
|
let emitFlags = EmitFlags.Default;
|
|
5522
5575
|
if (!(options["skipMetadataEmit"] || options["flatModuleOutFile"])) {
|
|
5523
5576
|
emitFlags |= EmitFlags.Metadata;
|
|
@@ -5529,7 +5582,7 @@ function readConfiguration(project, existingOptions, host = getFileSystem()) {
|
|
|
5529
5582
|
} catch (e) {
|
|
5530
5583
|
const errors = [
|
|
5531
5584
|
{
|
|
5532
|
-
category:
|
|
5585
|
+
category: ts32.DiagnosticCategory.Error,
|
|
5533
5586
|
messageText: e.stack ?? e.message,
|
|
5534
5587
|
file: void 0,
|
|
5535
5588
|
start: void 0,
|
|
@@ -5564,7 +5617,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
5564
5617
|
}
|
|
5565
5618
|
} else {
|
|
5566
5619
|
const parseConfigHost = createParseConfigHost(host, fs);
|
|
5567
|
-
const { resolvedModule } =
|
|
5620
|
+
const { resolvedModule } = ts32.nodeModuleNameResolver(extendsValue, configFile, { moduleResolution: ts32.ModuleResolutionKind.Node10, resolveJsonModule: true }, parseConfigHost);
|
|
5568
5621
|
if (resolvedModule) {
|
|
5569
5622
|
return absoluteFrom(resolvedModule.resolvedFileName);
|
|
5570
5623
|
}
|
|
@@ -5574,7 +5627,7 @@ function getExtendedConfigPathWorker(configFile, extendsValue, host, fs) {
|
|
|
5574
5627
|
function exitCodeFromResult(diags) {
|
|
5575
5628
|
if (!diags)
|
|
5576
5629
|
return 0;
|
|
5577
|
-
if (diags.every((diag) => diag.category !==
|
|
5630
|
+
if (diags.every((diag) => diag.category !== ts32.DiagnosticCategory.Error)) {
|
|
5578
5631
|
return 0;
|
|
5579
5632
|
}
|
|
5580
5633
|
return diags.some((d) => d.source === "angular" && d.code === UNKNOWN_ERROR_CODE) ? 2 : 1;
|
|
@@ -5612,7 +5665,7 @@ function performCompilation({ rootNames, options, host, oldProgram, emitCallback
|
|
|
5612
5665
|
} catch (e) {
|
|
5613
5666
|
program = void 0;
|
|
5614
5667
|
allDiagnostics.push({
|
|
5615
|
-
category:
|
|
5668
|
+
category: ts32.DiagnosticCategory.Error,
|
|
5616
5669
|
messageText: e.stack ?? e.message,
|
|
5617
5670
|
code: UNKNOWN_ERROR_CODE,
|
|
5618
5671
|
file: void 0,
|
|
@@ -5642,7 +5695,7 @@ function defaultGatherDiagnostics(program) {
|
|
|
5642
5695
|
return allDiagnostics;
|
|
5643
5696
|
}
|
|
5644
5697
|
function hasErrors(diags) {
|
|
5645
|
-
return diags.some((d) => d.category ===
|
|
5698
|
+
return diags.some((d) => d.category === ts32.DiagnosticCategory.Error);
|
|
5646
5699
|
}
|
|
5647
5700
|
|
|
5648
5701
|
export {
|