typescript 5.8.0-dev.20250109 → 5.8.0-dev.20250110
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/lib/_tsc.js +485 -341
- package/lib/lib.es2020.bigint.d.ts +4 -2
- package/lib/lib.es5.d.ts +9 -0
- package/lib/typescript.js +506 -344
- package/package.json +2 -2
package/lib/typescript.js
CHANGED
@@ -436,6 +436,7 @@ __export(typescript_exports, {
|
|
436
436
|
createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
|
437
437
|
createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
|
438
438
|
createProgram: () => createProgram,
|
439
|
+
createProgramDiagnostics: () => createProgramDiagnostics,
|
439
440
|
createProgramHost: () => createProgramHost,
|
440
441
|
createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
|
441
442
|
createQueue: () => createQueue,
|
@@ -605,6 +606,8 @@ __export(typescript_exports, {
|
|
605
606
|
forEachLeadingCommentRange: () => forEachLeadingCommentRange,
|
606
607
|
forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
|
607
608
|
forEachNameOfDefaultExport: () => forEachNameOfDefaultExport,
|
609
|
+
forEachOptionsSyntaxByName: () => forEachOptionsSyntaxByName,
|
610
|
+
forEachProjectReference: () => forEachProjectReference,
|
608
611
|
forEachPropertyAssignment: () => forEachPropertyAssignment,
|
609
612
|
forEachResolvedProjectReference: () => forEachResolvedProjectReference,
|
610
613
|
forEachReturnStatement: () => forEachReturnStatement,
|
@@ -844,6 +847,8 @@ __export(typescript_exports, {
|
|
844
847
|
getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
|
845
848
|
getLeftmostAccessExpression: () => getLeftmostAccessExpression,
|
846
849
|
getLeftmostExpression: () => getLeftmostExpression,
|
850
|
+
getLibFileNameFromLibReference: () => getLibFileNameFromLibReference,
|
851
|
+
getLibNameFromLibReference: () => getLibNameFromLibReference,
|
847
852
|
getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
|
848
853
|
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
|
849
854
|
getLineInfo: () => getLineInfo,
|
@@ -916,6 +921,8 @@ __export(typescript_exports, {
|
|
916
921
|
getOptionFromName: () => getOptionFromName,
|
917
922
|
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
|
918
923
|
getOptionsNameMap: () => getOptionsNameMap,
|
924
|
+
getOptionsSyntaxByArrayElementValue: () => getOptionsSyntaxByArrayElementValue,
|
925
|
+
getOptionsSyntaxByValue: () => getOptionsSyntaxByValue,
|
919
926
|
getOrCreateEmitNode: () => getOrCreateEmitNode,
|
920
927
|
getOrUpdate: () => getOrUpdate,
|
921
928
|
getOriginalNode: () => getOriginalNode,
|
@@ -952,7 +959,6 @@ __export(typescript_exports, {
|
|
952
959
|
getPrivateIdentifier: () => getPrivateIdentifier,
|
953
960
|
getProperties: () => getProperties,
|
954
961
|
getProperty: () => getProperty,
|
955
|
-
getPropertyArrayElementValue: () => getPropertyArrayElementValue,
|
956
962
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
957
963
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
958
964
|
getPropertyNameFromType: () => getPropertyNameFromType,
|
@@ -2279,7 +2285,7 @@ module.exports = __toCommonJS(typescript_exports);
|
|
2279
2285
|
|
2280
2286
|
// src/compiler/corePublic.ts
|
2281
2287
|
var versionMajorMinor = "5.8";
|
2282
|
-
var version = `${versionMajorMinor}.0-dev.
|
2288
|
+
var version = `${versionMajorMinor}.0-dev.20250110`;
|
2283
2289
|
var Comparison = /* @__PURE__ */ ((Comparison3) => {
|
2284
2290
|
Comparison3[Comparison3["LessThan"] = -1] = "LessThan";
|
2285
2291
|
Comparison3[Comparison3["EqualTo"] = 0] = "EqualTo";
|
@@ -8875,23 +8881,105 @@ function resolvePath(path, ...paths) {
|
|
8875
8881
|
function getNormalizedPathComponents(path, currentDirectory) {
|
8876
8882
|
return reducePathComponents(getPathComponents(path, currentDirectory));
|
8877
8883
|
}
|
8878
|
-
function getNormalizedAbsolutePath(
|
8879
|
-
|
8884
|
+
function getNormalizedAbsolutePath(path, currentDirectory) {
|
8885
|
+
let rootLength = getRootLength(path);
|
8886
|
+
if (rootLength === 0 && currentDirectory) {
|
8887
|
+
path = combinePaths(currentDirectory, path);
|
8888
|
+
rootLength = getRootLength(path);
|
8889
|
+
} else {
|
8890
|
+
path = normalizeSlashes(path);
|
8891
|
+
}
|
8892
|
+
const simpleNormalized = simpleNormalizePath(path);
|
8893
|
+
if (simpleNormalized !== void 0) {
|
8894
|
+
return simpleNormalized.length > rootLength ? removeTrailingDirectorySeparator(simpleNormalized) : simpleNormalized;
|
8895
|
+
}
|
8896
|
+
const length2 = path.length;
|
8897
|
+
const root = path.substring(0, rootLength);
|
8898
|
+
let normalized;
|
8899
|
+
let index = rootLength;
|
8900
|
+
let segmentStart = index;
|
8901
|
+
let normalizedUpTo = index;
|
8902
|
+
let seenNonDotDotSegment = rootLength !== 0;
|
8903
|
+
while (index < length2) {
|
8904
|
+
segmentStart = index;
|
8905
|
+
let ch = path.charCodeAt(index);
|
8906
|
+
while (ch === 47 /* slash */ && index + 1 < length2) {
|
8907
|
+
index++;
|
8908
|
+
ch = path.charCodeAt(index);
|
8909
|
+
}
|
8910
|
+
if (index > segmentStart) {
|
8911
|
+
normalized ?? (normalized = path.substring(0, segmentStart - 1));
|
8912
|
+
segmentStart = index;
|
8913
|
+
}
|
8914
|
+
let segmentEnd = path.indexOf(directorySeparator, index + 1);
|
8915
|
+
if (segmentEnd === -1) {
|
8916
|
+
segmentEnd = length2;
|
8917
|
+
}
|
8918
|
+
const segmentLength = segmentEnd - segmentStart;
|
8919
|
+
if (segmentLength === 1 && path.charCodeAt(index) === 46 /* dot */) {
|
8920
|
+
normalized ?? (normalized = path.substring(0, normalizedUpTo));
|
8921
|
+
} else if (segmentLength === 2 && path.charCodeAt(index) === 46 /* dot */ && path.charCodeAt(index + 1) === 46 /* dot */) {
|
8922
|
+
if (!seenNonDotDotSegment) {
|
8923
|
+
if (normalized !== void 0) {
|
8924
|
+
normalized += normalized.length === rootLength ? ".." : "/..";
|
8925
|
+
} else {
|
8926
|
+
normalizedUpTo = index + 2;
|
8927
|
+
}
|
8928
|
+
} else if (normalized === void 0) {
|
8929
|
+
if (normalizedUpTo - 2 >= 0) {
|
8930
|
+
normalized = path.substring(0, Math.max(rootLength, path.lastIndexOf(directorySeparator, normalizedUpTo - 2)));
|
8931
|
+
} else {
|
8932
|
+
normalized = path.substring(0, normalizedUpTo);
|
8933
|
+
}
|
8934
|
+
} else {
|
8935
|
+
const lastSlash = normalized.lastIndexOf(directorySeparator);
|
8936
|
+
if (lastSlash !== -1) {
|
8937
|
+
normalized = normalized.substring(0, Math.max(rootLength, lastSlash));
|
8938
|
+
} else {
|
8939
|
+
normalized = root;
|
8940
|
+
}
|
8941
|
+
if (normalized.length === rootLength) {
|
8942
|
+
seenNonDotDotSegment = rootLength !== 0;
|
8943
|
+
}
|
8944
|
+
}
|
8945
|
+
} else if (normalized !== void 0) {
|
8946
|
+
if (normalized.length !== rootLength) {
|
8947
|
+
normalized += directorySeparator;
|
8948
|
+
}
|
8949
|
+
seenNonDotDotSegment = true;
|
8950
|
+
normalized += path.substring(segmentStart, segmentEnd);
|
8951
|
+
} else {
|
8952
|
+
seenNonDotDotSegment = true;
|
8953
|
+
normalizedUpTo = segmentEnd;
|
8954
|
+
}
|
8955
|
+
index = segmentEnd + 1;
|
8956
|
+
}
|
8957
|
+
return normalized ?? (length2 > rootLength ? removeTrailingDirectorySeparator(path) : path);
|
8880
8958
|
}
|
8881
8959
|
function normalizePath(path) {
|
8882
8960
|
path = normalizeSlashes(path);
|
8961
|
+
let normalized = simpleNormalizePath(path);
|
8962
|
+
if (normalized !== void 0) {
|
8963
|
+
return normalized;
|
8964
|
+
}
|
8965
|
+
normalized = getNormalizedAbsolutePath(path, "");
|
8966
|
+
return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
|
8967
|
+
}
|
8968
|
+
function simpleNormalizePath(path) {
|
8883
8969
|
if (!relativePathSegmentRegExp.test(path)) {
|
8884
8970
|
return path;
|
8885
8971
|
}
|
8886
|
-
|
8972
|
+
let simplified = path.replace(/\/\.\//g, "/");
|
8973
|
+
if (simplified.startsWith("./")) {
|
8974
|
+
simplified = simplified.slice(2);
|
8975
|
+
}
|
8887
8976
|
if (simplified !== path) {
|
8888
8977
|
path = simplified;
|
8889
8978
|
if (!relativePathSegmentRegExp.test(path)) {
|
8890
8979
|
return path;
|
8891
8980
|
}
|
8892
8981
|
}
|
8893
|
-
|
8894
|
-
return normalized && hasTrailingDirectorySeparator(path) ? ensureTrailingDirectorySeparator(normalized) : normalized;
|
8982
|
+
return void 0;
|
8895
8983
|
}
|
8896
8984
|
function getPathWithoutRoot(pathComponents2) {
|
8897
8985
|
if (pathComponents2.length === 0) return "";
|
@@ -17942,9 +18030,6 @@ function forEachPropertyAssignment(objectLiteral, key, callback, key2) {
|
|
17942
18030
|
return key === propName || key2 && key2 === propName ? callback(property) : void 0;
|
17943
18031
|
});
|
17944
18032
|
}
|
17945
|
-
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
17946
|
-
return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
|
17947
|
-
}
|
17948
18033
|
function getTsConfigObjectLiteralExpression(tsConfigSourceFile) {
|
17949
18034
|
if (tsConfigSourceFile && tsConfigSourceFile.statements.length) {
|
17950
18035
|
const expression = tsConfigSourceFile.statements[0].expression;
|
@@ -23952,6 +24037,64 @@ function getNodeAtPosition(sourceFile, position, includeJSDoc) {
|
|
23952
24037
|
function isNewScopeNode(node) {
|
23953
24038
|
return isFunctionLike(node) || isJSDocSignature(node) || isMappedTypeNode(node);
|
23954
24039
|
}
|
24040
|
+
function getLibNameFromLibReference(libReference) {
|
24041
|
+
return toFileNameLowerCase(libReference.fileName);
|
24042
|
+
}
|
24043
|
+
function getLibFileNameFromLibReference(libReference) {
|
24044
|
+
const libName = getLibNameFromLibReference(libReference);
|
24045
|
+
return libMap.get(libName);
|
24046
|
+
}
|
24047
|
+
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
24048
|
+
return forEachProjectReference(
|
24049
|
+
/*projectReferences*/
|
24050
|
+
void 0,
|
24051
|
+
resolvedProjectReferences,
|
24052
|
+
(resolvedRef, parent2) => resolvedRef && cb(resolvedRef, parent2)
|
24053
|
+
);
|
24054
|
+
}
|
24055
|
+
function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
|
24056
|
+
let seenResolvedRefs;
|
24057
|
+
return worker(
|
24058
|
+
projectReferences,
|
24059
|
+
resolvedProjectReferences,
|
24060
|
+
/*parent*/
|
24061
|
+
void 0
|
24062
|
+
);
|
24063
|
+
function worker(projectReferences2, resolvedProjectReferences2, parent2) {
|
24064
|
+
if (cbRef) {
|
24065
|
+
const result = cbRef(projectReferences2, parent2);
|
24066
|
+
if (result) return result;
|
24067
|
+
}
|
24068
|
+
let skipChildren;
|
24069
|
+
return forEach(
|
24070
|
+
resolvedProjectReferences2,
|
24071
|
+
(resolvedRef, index) => {
|
24072
|
+
if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
|
24073
|
+
(skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
|
24074
|
+
return void 0;
|
24075
|
+
}
|
24076
|
+
const result = cbResolvedRef(resolvedRef, parent2, index);
|
24077
|
+
if (result || !resolvedRef) return result;
|
24078
|
+
(seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
|
24079
|
+
}
|
24080
|
+
) || forEach(
|
24081
|
+
resolvedProjectReferences2,
|
24082
|
+
(resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
|
24083
|
+
);
|
24084
|
+
}
|
24085
|
+
}
|
24086
|
+
function getOptionsSyntaxByArrayElementValue(optionsObject, name, value) {
|
24087
|
+
return optionsObject && getPropertyArrayElementValue(optionsObject, name, value);
|
24088
|
+
}
|
24089
|
+
function getPropertyArrayElementValue(objectLiteral, propKey, elementValue) {
|
24090
|
+
return forEachPropertyAssignment(objectLiteral, propKey, (property) => isArrayLiteralExpression(property.initializer) ? find(property.initializer.elements, (element) => isStringLiteral(element) && element.text === elementValue) : void 0);
|
24091
|
+
}
|
24092
|
+
function getOptionsSyntaxByValue(optionsObject, name, value) {
|
24093
|
+
return forEachOptionsSyntaxByName(optionsObject, name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
|
24094
|
+
}
|
24095
|
+
function forEachOptionsSyntaxByName(optionsObject, name, callback) {
|
24096
|
+
return forEachPropertyAssignment(optionsObject, name, callback);
|
24097
|
+
}
|
23955
24098
|
|
23956
24099
|
// src/compiler/factory/baseNodeFactory.ts
|
23957
24100
|
function createBaseNodeFactory() {
|
@@ -125720,45 +125863,6 @@ function loadWithModeAwareCache(entries, containingFile, redirectedReference, op
|
|
125720
125863
|
}
|
125721
125864
|
return resolutions;
|
125722
125865
|
}
|
125723
|
-
function forEachResolvedProjectReference(resolvedProjectReferences, cb) {
|
125724
|
-
return forEachProjectReference(
|
125725
|
-
/*projectReferences*/
|
125726
|
-
void 0,
|
125727
|
-
resolvedProjectReferences,
|
125728
|
-
(resolvedRef, parent2) => resolvedRef && cb(resolvedRef, parent2)
|
125729
|
-
);
|
125730
|
-
}
|
125731
|
-
function forEachProjectReference(projectReferences, resolvedProjectReferences, cbResolvedRef, cbRef) {
|
125732
|
-
let seenResolvedRefs;
|
125733
|
-
return worker(
|
125734
|
-
projectReferences,
|
125735
|
-
resolvedProjectReferences,
|
125736
|
-
/*parent*/
|
125737
|
-
void 0
|
125738
|
-
);
|
125739
|
-
function worker(projectReferences2, resolvedProjectReferences2, parent2) {
|
125740
|
-
if (cbRef) {
|
125741
|
-
const result = cbRef(projectReferences2, parent2);
|
125742
|
-
if (result) return result;
|
125743
|
-
}
|
125744
|
-
let skipChildren;
|
125745
|
-
return forEach(
|
125746
|
-
resolvedProjectReferences2,
|
125747
|
-
(resolvedRef, index) => {
|
125748
|
-
if (resolvedRef && (seenResolvedRefs == null ? void 0 : seenResolvedRefs.has(resolvedRef.sourceFile.path))) {
|
125749
|
-
(skipChildren ?? (skipChildren = /* @__PURE__ */ new Set())).add(resolvedRef);
|
125750
|
-
return void 0;
|
125751
|
-
}
|
125752
|
-
const result = cbResolvedRef(resolvedRef, parent2, index);
|
125753
|
-
if (result || !resolvedRef) return result;
|
125754
|
-
(seenResolvedRefs || (seenResolvedRefs = /* @__PURE__ */ new Set())).add(resolvedRef.sourceFile.path);
|
125755
|
-
}
|
125756
|
-
) || forEach(
|
125757
|
-
resolvedProjectReferences2,
|
125758
|
-
(resolvedRef) => resolvedRef && !(skipChildren == null ? void 0 : skipChildren.has(resolvedRef)) ? worker(resolvedRef.commandLine.projectReferences, resolvedRef.references, resolvedRef) : void 0
|
125759
|
-
);
|
125760
|
-
}
|
125761
|
-
}
|
125762
125866
|
var inferredTypesContainingFile = "__inferred type names__.ts";
|
125763
125867
|
function getInferredLibraryNameResolveFrom(options, currentDirectory, libFileName) {
|
125764
125868
|
const containingDirectory = options.configFilePath ? getDirectoryPath(options.configFilePath) : currentDirectory;
|
@@ -125774,13 +125878,6 @@ function getLibraryNameFromLibFileName(libFileName) {
|
|
125774
125878
|
}
|
125775
125879
|
return "@typescript/lib-" + path;
|
125776
125880
|
}
|
125777
|
-
function getLibNameFromLibReference(libReference) {
|
125778
|
-
return toFileNameLowerCase(libReference.fileName);
|
125779
|
-
}
|
125780
|
-
function getLibFileNameFromLibReference(libReference) {
|
125781
|
-
const libName = getLibNameFromLibReference(libReference);
|
125782
|
-
return libMap.get(libName);
|
125783
|
-
}
|
125784
125881
|
function isReferencedFile(reason) {
|
125785
125882
|
switch (reason == null ? void 0 : reason.kind) {
|
125786
125883
|
case 3 /* Import */:
|
@@ -126015,16 +126112,12 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126015
126112
|
let processingOtherFiles;
|
126016
126113
|
let files;
|
126017
126114
|
let symlinks;
|
126018
|
-
let commonSourceDirectory;
|
126019
126115
|
let typeChecker;
|
126020
126116
|
let classifiableNames;
|
126021
|
-
let fileReasons = createMultiMap();
|
126022
126117
|
let filesWithReferencesProcessed;
|
126023
|
-
let fileReasonsToChain;
|
126024
|
-
let reasonToRelatedInfo;
|
126025
126118
|
let cachedBindAndCheckDiagnosticsForFile;
|
126026
126119
|
let cachedDeclarationDiagnosticsForFile;
|
126027
|
-
|
126120
|
+
const programDiagnostics = createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax);
|
126028
126121
|
let automaticTypeDirectiveNames;
|
126029
126122
|
let automaticTypeDirectiveResolutions;
|
126030
126123
|
let resolvedLibReferences;
|
@@ -126051,8 +126144,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126051
126144
|
let skipDefaultLib = options.noLib;
|
126052
126145
|
const getDefaultLibraryFileName = memoize(() => host.getDefaultLibFileName(options));
|
126053
126146
|
const defaultLibraryPath = host.getDefaultLibLocation ? host.getDefaultLibLocation() : getDirectoryPath(getDefaultLibraryFileName());
|
126054
|
-
|
126055
|
-
let lazyProgramDiagnosticExplainingFile = [];
|
126147
|
+
let skipVerifyCompilerOptions = false;
|
126056
126148
|
const currentDirectory = host.getCurrentDirectory();
|
126057
126149
|
const supportedExtensions = getSupportedExtensions(options);
|
126058
126150
|
const supportedExtensionsWithJsonIfResolveJsonModule = getSupportedExtensionsWithJsonIfResolveJsonModule(options, supportedExtensions);
|
@@ -126330,7 +126422,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126330
126422
|
getTypeCount: () => getTypeChecker().getTypeCount(),
|
126331
126423
|
getInstantiationCount: () => getTypeChecker().getInstantiationCount(),
|
126332
126424
|
getRelationCacheSizes: () => getTypeChecker().getRelationCacheSizes(),
|
126333
|
-
getFileProcessingDiagnostics: () =>
|
126425
|
+
getFileProcessingDiagnostics: () => programDiagnostics.getFileProcessingDiagnostics(),
|
126334
126426
|
getAutomaticTypeDirectiveNames: () => automaticTypeDirectiveNames,
|
126335
126427
|
getAutomaticTypeDirectiveResolutions: () => automaticTypeDirectiveResolutions,
|
126336
126428
|
isSourceFileFromExternalLibrary,
|
@@ -126346,6 +126438,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126346
126438
|
resolvedModules,
|
126347
126439
|
resolvedTypeReferenceDirectiveNames,
|
126348
126440
|
resolvedLibReferences,
|
126441
|
+
getProgramDiagnosticsContainer: () => programDiagnostics,
|
126349
126442
|
getResolvedModule,
|
126350
126443
|
getResolvedModuleFromModuleSpecifier,
|
126351
126444
|
getResolvedTypeReferenceDirective,
|
@@ -126378,70 +126471,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126378
126471
|
realpath: (_o = host.realpath) == null ? void 0 : _o.bind(host),
|
126379
126472
|
useCaseSensitiveFileNames: () => host.useCaseSensitiveFileNames(),
|
126380
126473
|
getCanonicalFileName,
|
126381
|
-
getFileIncludeReasons: () =>
|
126474
|
+
getFileIncludeReasons: () => programDiagnostics.getFileReasons(),
|
126382
126475
|
structureIsReused,
|
126383
126476
|
writeFile: writeFile2,
|
126384
126477
|
getGlobalTypingsCacheLocation: maybeBind(host, host.getGlobalTypingsCacheLocation)
|
126385
126478
|
};
|
126386
126479
|
onProgramCreateComplete();
|
126387
|
-
|
126480
|
+
if (!skipVerifyCompilerOptions) {
|
126481
|
+
verifyCompilerOptions();
|
126482
|
+
}
|
126388
126483
|
mark("afterProgram");
|
126389
126484
|
measure("Program", "beforeProgram", "afterProgram");
|
126390
126485
|
(_p = tracing) == null ? void 0 : _p.pop();
|
126391
126486
|
return program;
|
126392
|
-
function updateAndGetProgramDiagnostics() {
|
126393
|
-
if (lazyProgramDiagnosticExplainingFile) {
|
126394
|
-
fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
|
126395
|
-
switch (diagnostic.kind) {
|
126396
|
-
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
126397
|
-
return programDiagnostics.add(
|
126398
|
-
createDiagnosticExplainingFile(
|
126399
|
-
diagnostic.file && getSourceFileByPath(diagnostic.file),
|
126400
|
-
diagnostic.fileProcessingReason,
|
126401
|
-
diagnostic.diagnostic,
|
126402
|
-
diagnostic.args || emptyArray
|
126403
|
-
)
|
126404
|
-
);
|
126405
|
-
case 0 /* FilePreprocessingLibReferenceDiagnostic */:
|
126406
|
-
return programDiagnostics.add(filePreprocessingLibreferenceDiagnostic(diagnostic));
|
126407
|
-
case 2 /* ResolutionDiagnostics */:
|
126408
|
-
return diagnostic.diagnostics.forEach((d) => programDiagnostics.add(d));
|
126409
|
-
default:
|
126410
|
-
Debug.assertNever(diagnostic);
|
126411
|
-
}
|
126412
|
-
});
|
126413
|
-
lazyProgramDiagnosticExplainingFile.forEach(
|
126414
|
-
({ file, diagnostic, args }) => programDiagnostics.add(
|
126415
|
-
createDiagnosticExplainingFile(
|
126416
|
-
file,
|
126417
|
-
/*fileProcessingReason*/
|
126418
|
-
void 0,
|
126419
|
-
diagnostic,
|
126420
|
-
args
|
126421
|
-
)
|
126422
|
-
)
|
126423
|
-
);
|
126424
|
-
lazyProgramDiagnosticExplainingFile = void 0;
|
126425
|
-
fileReasonsToChain = void 0;
|
126426
|
-
reasonToRelatedInfo = void 0;
|
126427
|
-
}
|
126428
|
-
return programDiagnostics;
|
126429
|
-
}
|
126430
|
-
function filePreprocessingLibreferenceDiagnostic({ reason }) {
|
126431
|
-
const { file, pos, end } = getReferencedFileLocation(program, reason);
|
126432
|
-
const libReference = file.libReferenceDirectives[reason.index];
|
126433
|
-
const libName = getLibNameFromLibReference(libReference);
|
126434
|
-
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
126435
|
-
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
126436
|
-
return createFileDiagnostic(
|
126437
|
-
file,
|
126438
|
-
Debug.checkDefined(pos),
|
126439
|
-
Debug.checkDefined(end) - pos,
|
126440
|
-
suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
|
126441
|
-
libName,
|
126442
|
-
suggestion
|
126443
|
-
);
|
126444
|
-
}
|
126445
126487
|
function getResolvedModule(file, moduleName, mode) {
|
126446
126488
|
var _a2;
|
126447
126489
|
return (_a2 = resolvedModules == null ? void 0 : resolvedModules.get(file.path)) == null ? void 0 : _a2.get(moduleName, mode);
|
@@ -126490,7 +126532,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126490
126532
|
function addResolutionDiagnostics(resolution) {
|
126491
126533
|
var _a2;
|
126492
126534
|
if (!((_a2 = resolution.resolutionDiagnostics) == null ? void 0 : _a2.length)) return;
|
126493
|
-
|
126535
|
+
programDiagnostics.addFileProcessingDiagnostic({
|
126494
126536
|
kind: 2 /* ResolutionDiagnostics */,
|
126495
126537
|
diagnostics: resolution.resolutionDiagnostics
|
126496
126538
|
});
|
@@ -126584,16 +126626,19 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126584
126626
|
return toPath(fileName, currentDirectory, getCanonicalFileName);
|
126585
126627
|
}
|
126586
126628
|
function getCommonSourceDirectory2() {
|
126587
|
-
|
126588
|
-
|
126589
|
-
commonSourceDirectory
|
126590
|
-
options,
|
126591
|
-
() => mapDefined(emittedFiles, (file) => file.isDeclarationFile ? void 0 : file.fileName),
|
126592
|
-
currentDirectory,
|
126593
|
-
getCanonicalFileName,
|
126594
|
-
(commonSourceDirectory2) => checkSourceFilesBelongToPath(emittedFiles, commonSourceDirectory2)
|
126595
|
-
);
|
126629
|
+
let commonSourceDirectory = programDiagnostics.getCommonSourceDirectory();
|
126630
|
+
if (commonSourceDirectory !== void 0) {
|
126631
|
+
return commonSourceDirectory;
|
126596
126632
|
}
|
126633
|
+
const emittedFiles = filter(files, (file) => sourceFileMayBeEmitted(file, program));
|
126634
|
+
commonSourceDirectory = getCommonSourceDirectory(
|
126635
|
+
options,
|
126636
|
+
() => mapDefined(emittedFiles, (file) => file.isDeclarationFile ? void 0 : file.fileName),
|
126637
|
+
currentDirectory,
|
126638
|
+
getCanonicalFileName,
|
126639
|
+
(commonSourceDirectory2) => checkSourceFilesBelongToPath(emittedFiles, commonSourceDirectory2)
|
126640
|
+
);
|
126641
|
+
programDiagnostics.setCommonSourceDirectory(commonSourceDirectory);
|
126597
126642
|
return commonSourceDirectory;
|
126598
126643
|
}
|
126599
126644
|
function getClassifiableNames() {
|
@@ -126904,9 +126949,10 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
126904
126949
|
}
|
126905
126950
|
filesByName.set(path, filesByName.get(oldFile.path));
|
126906
126951
|
});
|
126952
|
+
const isConfigIdentical = oldOptions.configFile && oldOptions.configFile === options.configFile || !oldOptions.configFile && !options.configFile && !optionsHaveChanges(oldOptions, options, optionDeclarations);
|
126953
|
+
programDiagnostics.reuseStateFromOldProgram(oldProgram.getProgramDiagnosticsContainer(), isConfigIdentical);
|
126954
|
+
skipVerifyCompilerOptions = isConfigIdentical;
|
126907
126955
|
files = newSourceFiles;
|
126908
|
-
fileReasons = oldProgram.getFileIncludeReasons();
|
126909
|
-
fileProcessingDiagnostics = oldProgram.getFileProcessingDiagnostics();
|
126910
126956
|
automaticTypeDirectiveNames = oldProgram.getAutomaticTypeDirectiveNames();
|
126911
126957
|
automaticTypeDirectiveResolutions = oldProgram.getAutomaticTypeDirectiveResolutions();
|
126912
126958
|
sourceFileToPackageName = oldProgram.sourceFileToPackageName;
|
@@ -127122,7 +127168,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127122
127168
|
if (skipTypeChecking(sourceFile, options, program)) {
|
127123
127169
|
return emptyArray;
|
127124
127170
|
}
|
127125
|
-
const programDiagnosticsInFile =
|
127171
|
+
const programDiagnosticsInFile = programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(sourceFile.fileName);
|
127126
127172
|
if (!((_a2 = sourceFile.commentDirectives) == null ? void 0 : _a2.length)) {
|
127127
127173
|
return programDiagnosticsInFile;
|
127128
127174
|
}
|
@@ -127480,15 +127526,15 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127480
127526
|
}
|
127481
127527
|
function getOptionsDiagnostics() {
|
127482
127528
|
return sortAndDeduplicateDiagnostics(concatenate(
|
127483
|
-
|
127529
|
+
programDiagnostics.getCombinedDiagnostics(program).getGlobalDiagnostics(),
|
127484
127530
|
getOptionsDiagnosticsOfConfigFile()
|
127485
127531
|
));
|
127486
127532
|
}
|
127487
127533
|
function getOptionsDiagnosticsOfConfigFile() {
|
127488
127534
|
if (!options.configFile) return emptyArray;
|
127489
|
-
let diagnostics =
|
127535
|
+
let diagnostics = programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(options.configFile.fileName);
|
127490
127536
|
forEachResolvedProjectReference2((resolvedRef) => {
|
127491
|
-
diagnostics = concatenate(diagnostics,
|
127537
|
+
diagnostics = concatenate(diagnostics, programDiagnostics.getCombinedDiagnostics(program).getDiagnostics(resolvedRef.sourceFile.fileName));
|
127492
127538
|
});
|
127493
127539
|
return diagnostics;
|
127494
127540
|
}
|
@@ -127695,7 +127741,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127695
127741
|
);
|
127696
127742
|
}
|
127697
127743
|
function reportFileNamesDifferOnlyInCasingError(fileName, existingFile, reason) {
|
127698
|
-
const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(
|
127744
|
+
const hasExistingReasonToReportErrorOn = !isReferencedFile(reason) && some(programDiagnostics.getFileReasons().get(existingFile.path), isReferencedFile);
|
127699
127745
|
if (hasExistingReasonToReportErrorOn) {
|
127700
127746
|
addFilePreprocessingFileExplainingDiagnostic(existingFile, reason, Diagnostics.Already_included_file_name_0_differs_from_file_name_1_only_in_casing, [existingFile.fileName, fileName]);
|
127701
127747
|
} else {
|
@@ -127882,7 +127928,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
127882
127928
|
}
|
127883
127929
|
function addFileIncludeReason(file, reason, checkExisting) {
|
127884
127930
|
if (file && (!checkExisting || !isReferencedFile(reason) || !(filesWithReferencesProcessed == null ? void 0 : filesWithReferencesProcessed.has(reason.file)))) {
|
127885
|
-
|
127931
|
+
programDiagnostics.getFileReasons().add(file.path, reason);
|
127886
127932
|
return true;
|
127887
127933
|
}
|
127888
127934
|
return false;
|
@@ -128081,7 +128127,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128081
128127
|
{ kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
128082
128128
|
);
|
128083
128129
|
} else {
|
128084
|
-
|
128130
|
+
programDiagnostics.addFileProcessingDiagnostic({
|
128085
128131
|
kind: 0 /* FilePreprocessingLibReferenceDiagnostic */,
|
128086
128132
|
reason: { kind: 7 /* LibReferenceDirective */, file: file.path, index }
|
128087
128133
|
});
|
@@ -128144,10 +128190,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128144
128190
|
if (!sourceFile.isDeclarationFile) {
|
128145
128191
|
const absoluteSourceFilePath = host.getCanonicalFileName(getNormalizedAbsolutePath(sourceFile.fileName, currentDirectory));
|
128146
128192
|
if (absoluteSourceFilePath.indexOf(absoluteRootDirectoryPath) !== 0) {
|
128147
|
-
|
128193
|
+
programDiagnostics.addLazyConfigDiagnostic(
|
128148
128194
|
sourceFile,
|
128149
128195
|
Diagnostics.File_0_is_not_under_rootDir_1_rootDir_is_expected_to_contain_all_source_files,
|
128150
|
-
|
128196
|
+
sourceFile.fileName,
|
128197
|
+
rootDirectory
|
128151
128198
|
);
|
128152
128199
|
allFilesBelongToPath = false;
|
128153
128200
|
}
|
@@ -128262,7 +128309,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128262
128309
|
}
|
128263
128310
|
const outputFile = options.outFile;
|
128264
128311
|
if (!options.tsBuildInfoFile && options.incremental && !outputFile && !options.configFilePath) {
|
128265
|
-
programDiagnostics.
|
128312
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(Diagnostics.Option_incremental_can_only_be_specified_using_tsconfig_emitting_to_single_file_or_when_option_tsBuildInfoFile_is_specified));
|
128266
128313
|
}
|
128267
128314
|
verifyDeprecatedCompilerOptions();
|
128268
128315
|
verifyProjectReferences();
|
@@ -128270,10 +128317,11 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128270
128317
|
const rootPaths = new Set(rootNames.map(toPath3));
|
128271
128318
|
for (const file of files) {
|
128272
128319
|
if (sourceFileMayBeEmitted(file, program) && !rootPaths.has(file.path)) {
|
128273
|
-
|
128320
|
+
programDiagnostics.addLazyConfigDiagnostic(
|
128274
128321
|
file,
|
128275
128322
|
Diagnostics.File_0_is_not_listed_within_the_file_list_of_project_1_Projects_must_list_all_files_or_use_an_include_pattern,
|
128276
|
-
|
128323
|
+
file.fileName,
|
128324
|
+
options.configFilePath || ""
|
128277
128325
|
);
|
128278
128326
|
}
|
128279
128327
|
}
|
@@ -128364,14 +128412,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128364
128412
|
}
|
128365
128413
|
} else if (firstNonAmbientExternalModuleSourceFile && languageVersion < 2 /* ES2015 */ && options.module === 0 /* None */) {
|
128366
128414
|
const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
|
128367
|
-
programDiagnostics.
|
128415
|
+
programDiagnostics.addConfigDiagnostic(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_use_imports_exports_or_module_augmentations_when_module_is_none));
|
128368
128416
|
}
|
128369
128417
|
if (outputFile && !options.emitDeclarationOnly) {
|
128370
128418
|
if (options.module && !(options.module === 2 /* AMD */ || options.module === 4 /* System */)) {
|
128371
128419
|
createDiagnosticForOptionName(Diagnostics.Only_amd_and_system_modules_are_supported_alongside_0, "outFile", "module");
|
128372
128420
|
} else if (options.module === void 0 && firstNonAmbientExternalModuleSourceFile) {
|
128373
128421
|
const span = getErrorSpanForNode(firstNonAmbientExternalModuleSourceFile, typeof firstNonAmbientExternalModuleSourceFile.externalModuleIndicator === "boolean" ? firstNonAmbientExternalModuleSourceFile : firstNonAmbientExternalModuleSourceFile.externalModuleIndicator);
|
128374
|
-
programDiagnostics.
|
128422
|
+
programDiagnostics.addConfigDiagnostic(createFileDiagnostic(firstNonAmbientExternalModuleSourceFile, span.start, span.length, Diagnostics.Cannot_compile_modules_using_option_0_unless_the_module_flag_is_amd_or_system, "outFile"));
|
128375
128423
|
}
|
128376
128424
|
}
|
128377
128425
|
if (getResolveJsonModule(options)) {
|
@@ -128623,90 +128671,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128623
128671
|
}
|
128624
128672
|
});
|
128625
128673
|
}
|
128626
|
-
function createDiagnosticExplainingFile(file, fileProcessingReason, diagnostic, args) {
|
128627
|
-
let seenReasons;
|
128628
|
-
const reasons = file && fileReasons.get(file.path);
|
128629
|
-
let fileIncludeReasons;
|
128630
|
-
let relatedInfo;
|
128631
|
-
let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
|
128632
|
-
let fileIncludeReasonDetails;
|
128633
|
-
let redirectInfo;
|
128634
|
-
let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
|
128635
|
-
let chain;
|
128636
|
-
if (cachedChain) {
|
128637
|
-
if (cachedChain.fileIncludeReasonDetails) {
|
128638
|
-
seenReasons = new Set(reasons);
|
128639
|
-
reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
|
128640
|
-
} else {
|
128641
|
-
reasons == null ? void 0 : reasons.forEach(processReason);
|
128642
|
-
}
|
128643
|
-
redirectInfo = cachedChain.redirectInfo;
|
128644
|
-
} else {
|
128645
|
-
reasons == null ? void 0 : reasons.forEach(processReason);
|
128646
|
-
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, getCompilerOptionsForFile(file));
|
128647
|
-
}
|
128648
|
-
if (fileProcessingReason) processReason(fileProcessingReason);
|
128649
|
-
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
128650
|
-
if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1) seenReasons = void 0;
|
128651
|
-
if (seenReasons && cachedChain) {
|
128652
|
-
if (cachedChain.details && !processedExtraReason) {
|
128653
|
-
chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args || emptyArray);
|
128654
|
-
} else if (cachedChain.fileIncludeReasonDetails) {
|
128655
|
-
if (!processedExtraReason) {
|
128656
|
-
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
128657
|
-
fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
|
128658
|
-
} else {
|
128659
|
-
fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
|
128660
|
-
}
|
128661
|
-
} else {
|
128662
|
-
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
128663
|
-
fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
|
128664
|
-
} else {
|
128665
|
-
fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
|
128666
|
-
}
|
128667
|
-
}
|
128668
|
-
}
|
128669
|
-
}
|
128670
|
-
if (!chain) {
|
128671
|
-
if (!fileIncludeReasonDetails) fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
128672
|
-
chain = chainDiagnosticMessages(
|
128673
|
-
redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
|
128674
|
-
diagnostic,
|
128675
|
-
...args || emptyArray
|
128676
|
-
);
|
128677
|
-
}
|
128678
|
-
if (file) {
|
128679
|
-
if (cachedChain) {
|
128680
|
-
if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
|
128681
|
-
cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
|
128682
|
-
}
|
128683
|
-
} else {
|
128684
|
-
(fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
|
128685
|
-
}
|
128686
|
-
if (!cachedChain.details && !processedExtraReason) cachedChain.details = chain.next;
|
128687
|
-
}
|
128688
|
-
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
128689
|
-
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
128690
|
-
function processReason(reason) {
|
128691
|
-
if (seenReasons == null ? void 0 : seenReasons.has(reason)) return;
|
128692
|
-
(seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
|
128693
|
-
(fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
|
128694
|
-
populateRelatedInfo(reason);
|
128695
|
-
}
|
128696
|
-
function populateRelatedInfo(reason) {
|
128697
|
-
if (!locationReason && isReferencedFile(reason)) {
|
128698
|
-
locationReason = reason;
|
128699
|
-
} else if (locationReason !== reason) {
|
128700
|
-
relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(reason));
|
128701
|
-
}
|
128702
|
-
}
|
128703
|
-
function cachedFileIncludeDetailsHasProcessedExtraReason() {
|
128704
|
-
var _a2;
|
128705
|
-
return ((_a2 = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a2.length) !== (reasons == null ? void 0 : reasons.length);
|
128706
|
-
}
|
128707
|
-
}
|
128708
128674
|
function addFilePreprocessingFileExplainingDiagnostic(file, fileProcessingReason, diagnostic, args) {
|
128709
|
-
|
128675
|
+
programDiagnostics.addFileProcessingDiagnostic({
|
128710
128676
|
kind: 1 /* FilePreprocessingFileExplainingDiagnostic */,
|
128711
128677
|
file: file && file.path,
|
128712
128678
|
fileProcessingReason,
|
@@ -128714,99 +128680,6 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128714
128680
|
args
|
128715
128681
|
});
|
128716
128682
|
}
|
128717
|
-
function addLazyProgramDiagnosticExplainingFile(file, diagnostic, args) {
|
128718
|
-
lazyProgramDiagnosticExplainingFile.push({ file, diagnostic, args });
|
128719
|
-
}
|
128720
|
-
function getFileIncludeReasonToRelatedInformation(reason) {
|
128721
|
-
let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
|
128722
|
-
if (relatedInfo === void 0) (reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(reason) ?? false);
|
128723
|
-
return relatedInfo || void 0;
|
128724
|
-
}
|
128725
|
-
function fileIncludeReasonToRelatedInformation(reason) {
|
128726
|
-
if (isReferencedFile(reason)) {
|
128727
|
-
const referenceLocation = getReferencedFileLocation(program, reason);
|
128728
|
-
let message2;
|
128729
|
-
switch (reason.kind) {
|
128730
|
-
case 3 /* Import */:
|
128731
|
-
message2 = Diagnostics.File_is_included_via_import_here;
|
128732
|
-
break;
|
128733
|
-
case 4 /* ReferenceFile */:
|
128734
|
-
message2 = Diagnostics.File_is_included_via_reference_here;
|
128735
|
-
break;
|
128736
|
-
case 5 /* TypeReferenceDirective */:
|
128737
|
-
message2 = Diagnostics.File_is_included_via_type_library_reference_here;
|
128738
|
-
break;
|
128739
|
-
case 7 /* LibReferenceDirective */:
|
128740
|
-
message2 = Diagnostics.File_is_included_via_library_reference_here;
|
128741
|
-
break;
|
128742
|
-
default:
|
128743
|
-
Debug.assertNever(reason);
|
128744
|
-
}
|
128745
|
-
return isReferenceFileLocation(referenceLocation) ? createFileDiagnostic(
|
128746
|
-
referenceLocation.file,
|
128747
|
-
referenceLocation.pos,
|
128748
|
-
referenceLocation.end - referenceLocation.pos,
|
128749
|
-
message2
|
128750
|
-
) : void 0;
|
128751
|
-
}
|
128752
|
-
if (!options.configFile) return void 0;
|
128753
|
-
let configFileNode;
|
128754
|
-
let message;
|
128755
|
-
switch (reason.kind) {
|
128756
|
-
case 0 /* RootFile */:
|
128757
|
-
if (!options.configFile.configFileSpecs) return void 0;
|
128758
|
-
const fileName = getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory);
|
128759
|
-
const matchedByFiles = getMatchedFileSpec(program, fileName);
|
128760
|
-
if (matchedByFiles) {
|
128761
|
-
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles);
|
128762
|
-
message = Diagnostics.File_is_matched_by_files_list_specified_here;
|
128763
|
-
break;
|
128764
|
-
}
|
128765
|
-
const matchedByInclude = getMatchedIncludeSpec(program, fileName);
|
128766
|
-
if (!matchedByInclude || !isString(matchedByInclude)) return void 0;
|
128767
|
-
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
|
128768
|
-
message = Diagnostics.File_is_matched_by_include_pattern_specified_here;
|
128769
|
-
break;
|
128770
|
-
case 1 /* SourceFromProjectReference */:
|
128771
|
-
case 2 /* OutputFromProjectReference */:
|
128772
|
-
const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
|
128773
|
-
const referenceInfo = forEachProjectReference(
|
128774
|
-
projectReferences,
|
128775
|
-
resolvedProjectReferences,
|
128776
|
-
(resolvedRef, parent2, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent2 == null ? void 0 : parent2.sourceFile) || options.configFile, index: index2 } : void 0
|
128777
|
-
);
|
128778
|
-
if (!referenceInfo) return void 0;
|
128779
|
-
const { sourceFile, index } = referenceInfo;
|
128780
|
-
const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
128781
|
-
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
|
128782
|
-
sourceFile,
|
128783
|
-
referencesSyntax.elements[index],
|
128784
|
-
reason.kind === 2 /* OutputFromProjectReference */ ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here
|
128785
|
-
) : void 0;
|
128786
|
-
case 8 /* AutomaticTypeDirectiveFile */:
|
128787
|
-
if (!options.types) return void 0;
|
128788
|
-
configFileNode = getOptionsSyntaxByArrayElementValue("types", reason.typeReference);
|
128789
|
-
message = Diagnostics.File_is_entry_point_of_type_library_specified_here;
|
128790
|
-
break;
|
128791
|
-
case 6 /* LibFile */:
|
128792
|
-
if (reason.index !== void 0) {
|
128793
|
-
configFileNode = getOptionsSyntaxByArrayElementValue("lib", options.lib[reason.index]);
|
128794
|
-
message = Diagnostics.File_is_library_specified_here;
|
128795
|
-
break;
|
128796
|
-
}
|
128797
|
-
const target = getNameOfScriptTarget(getEmitScriptTarget(options));
|
128798
|
-
configFileNode = target ? getOptionsSyntaxByValue("target", target) : void 0;
|
128799
|
-
message = Diagnostics.File_is_default_library_for_target_specified_here;
|
128800
|
-
break;
|
128801
|
-
default:
|
128802
|
-
Debug.assertNever(reason);
|
128803
|
-
}
|
128804
|
-
return configFileNode && createDiagnosticForNodeInSourceFile(
|
128805
|
-
options.configFile,
|
128806
|
-
configFileNode,
|
128807
|
-
message
|
128808
|
-
);
|
128809
|
-
}
|
128810
128683
|
function verifyProjectReferences() {
|
128811
128684
|
const buildInfoPath = !options.suppressOutputPathCheck ? getTsBuildInfoEmitOutputFilePath(options) : void 0;
|
128812
128685
|
forEachProjectReference(
|
@@ -128842,7 +128715,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128842
128715
|
forEachPropertyAssignment(pathProp.initializer, key, (keyProps) => {
|
128843
128716
|
const initializer = keyProps.initializer;
|
128844
128717
|
if (isArrayLiteralExpression(initializer) && initializer.elements.length > valueIndex) {
|
128845
|
-
programDiagnostics.
|
128718
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, initializer.elements[valueIndex], message, ...args));
|
128846
128719
|
needCompilerDiagnostic = false;
|
128847
128720
|
}
|
128848
128721
|
});
|
@@ -128871,18 +128744,8 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128871
128744
|
createCompilerOptionsDiagnostic(message, ...args);
|
128872
128745
|
}
|
128873
128746
|
}
|
128874
|
-
function forEachOptionsSyntaxByName(name, callback) {
|
128875
|
-
return forEachPropertyAssignment(getCompilerOptionsObjectLiteralSyntax(), name, callback);
|
128876
|
-
}
|
128877
128747
|
function forEachOptionPathsSyntax(callback) {
|
128878
|
-
return forEachOptionsSyntaxByName("paths", callback);
|
128879
|
-
}
|
128880
|
-
function getOptionsSyntaxByValue(name, value) {
|
128881
|
-
return forEachOptionsSyntaxByName(name, (property) => isStringLiteral(property.initializer) && property.initializer.text === value ? property.initializer : void 0);
|
128882
|
-
}
|
128883
|
-
function getOptionsSyntaxByArrayElementValue(name, value) {
|
128884
|
-
const compilerOptionsObjectLiteralSyntax = getCompilerOptionsObjectLiteralSyntax();
|
128885
|
-
return compilerOptionsObjectLiteralSyntax && getPropertyArrayElementValue(compilerOptionsObjectLiteralSyntax, name, value);
|
128748
|
+
return forEachOptionsSyntaxByName(getCompilerOptionsObjectLiteralSyntax(), "paths", callback);
|
128886
128749
|
}
|
128887
128750
|
function createDiagnosticForOptionName(message, option1, option2, option3) {
|
128888
128751
|
createDiagnosticForOption(
|
@@ -128910,9 +128773,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128910
128773
|
function createDiagnosticForReference(sourceFile, index, message, ...args) {
|
128911
128774
|
const referencesSyntax = forEachTsConfigPropArray(sourceFile || options.configFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
128912
128775
|
if (referencesSyntax && referencesSyntax.elements.length > index) {
|
128913
|
-
programDiagnostics.
|
128776
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(sourceFile || options.configFile, referencesSyntax.elements[index], message, ...args));
|
128914
128777
|
} else {
|
128915
|
-
programDiagnostics.
|
128778
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(message, ...args));
|
128916
128779
|
}
|
128917
128780
|
}
|
128918
128781
|
function createDiagnosticForOption(onKey, option1, option2, message, ...args) {
|
@@ -128926,14 +128789,14 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128926
128789
|
const compilerOptionsProperty = getCompilerOptionsPropertySyntax();
|
128927
128790
|
if (compilerOptionsProperty) {
|
128928
128791
|
if ("messageText" in message) {
|
128929
|
-
programDiagnostics.
|
128792
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeFromMessageChain(options.configFile, compilerOptionsProperty.name, message));
|
128930
128793
|
} else {
|
128931
|
-
programDiagnostics.
|
128794
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, compilerOptionsProperty.name, message, ...args));
|
128932
128795
|
}
|
128933
128796
|
} else if ("messageText" in message) {
|
128934
|
-
programDiagnostics.
|
128797
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnosticFromMessageChain(message));
|
128935
128798
|
} else {
|
128936
|
-
programDiagnostics.
|
128799
|
+
programDiagnostics.addConfigDiagnostic(createCompilerDiagnostic(message, ...args));
|
128937
128800
|
}
|
128938
128801
|
}
|
128939
128802
|
function getCompilerOptionsObjectLiteralSyntax() {
|
@@ -128957,9 +128820,9 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128957
128820
|
let needsCompilerDiagnostic = false;
|
128958
128821
|
forEachPropertyAssignment(objectLiteral, key1, (prop) => {
|
128959
128822
|
if ("messageText" in message) {
|
128960
|
-
programDiagnostics.
|
128823
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeFromMessageChain(options.configFile, onKey ? prop.name : prop.initializer, message));
|
128961
128824
|
} else {
|
128962
|
-
programDiagnostics.
|
128825
|
+
programDiagnostics.addConfigDiagnostic(createDiagnosticForNodeInSourceFile(options.configFile, onKey ? prop.name : prop.initializer, message, ...args));
|
128963
128826
|
}
|
128964
128827
|
needsCompilerDiagnostic = true;
|
128965
128828
|
}, key2);
|
@@ -128967,7 +128830,7 @@ function createProgram(rootNamesOrOptions, _options, _host, _oldProgram, _config
|
|
128967
128830
|
}
|
128968
128831
|
function blockEmittingOfFile(emitFileName, diag2) {
|
128969
128832
|
hasEmitBlockingDiagnostics.set(toPath3(emitFileName), true);
|
128970
|
-
programDiagnostics.
|
128833
|
+
programDiagnostics.addConfigDiagnostic(diag2);
|
128971
128834
|
}
|
128972
128835
|
function isEmittedFile(file) {
|
128973
128836
|
if (options.noEmit) {
|
@@ -129290,6 +129153,293 @@ function getModuleNameStringLiteralAt({ imports, moduleAugmentations }, index) {
|
|
129290
129153
|
Debug.fail("should never ask for module name at index higher than possible module name");
|
129291
129154
|
}
|
129292
129155
|
|
129156
|
+
// src/compiler/programDiagnostics.ts
|
129157
|
+
function createProgramDiagnostics(getCompilerOptionsObjectLiteralSyntax) {
|
129158
|
+
let computedDiagnostics;
|
129159
|
+
let fileReasons = createMultiMap();
|
129160
|
+
let fileProcessingDiagnostics;
|
129161
|
+
let commonSourceDirectory;
|
129162
|
+
let configDiagnostics;
|
129163
|
+
let lazyConfigDiagnostics;
|
129164
|
+
let fileReasonsToChain;
|
129165
|
+
let reasonToRelatedInfo;
|
129166
|
+
return {
|
129167
|
+
addConfigDiagnostic(diag2) {
|
129168
|
+
Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
|
129169
|
+
(configDiagnostics ?? (configDiagnostics = createDiagnosticCollection())).add(diag2);
|
129170
|
+
},
|
129171
|
+
addLazyConfigDiagnostic(file, message, ...args) {
|
129172
|
+
Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
|
129173
|
+
(lazyConfigDiagnostics ?? (lazyConfigDiagnostics = [])).push({ file, diagnostic: message, args });
|
129174
|
+
},
|
129175
|
+
addFileProcessingDiagnostic(diag2) {
|
129176
|
+
Debug.assert(computedDiagnostics === void 0, "Cannot modify program diagnostic state after requesting combined diagnostics");
|
129177
|
+
(fileProcessingDiagnostics ?? (fileProcessingDiagnostics = [])).push(diag2);
|
129178
|
+
},
|
129179
|
+
setCommonSourceDirectory(directory) {
|
129180
|
+
commonSourceDirectory = directory;
|
129181
|
+
},
|
129182
|
+
reuseStateFromOldProgram(oldProgramDiagnostics, isConfigIdentical) {
|
129183
|
+
fileReasons = oldProgramDiagnostics.getFileReasons();
|
129184
|
+
fileProcessingDiagnostics = oldProgramDiagnostics.getFileProcessingDiagnostics();
|
129185
|
+
if (isConfigIdentical) {
|
129186
|
+
commonSourceDirectory = oldProgramDiagnostics.getCommonSourceDirectory();
|
129187
|
+
configDiagnostics = oldProgramDiagnostics.getConfigDiagnostics();
|
129188
|
+
lazyConfigDiagnostics = oldProgramDiagnostics.getLazyConfigDiagnostics();
|
129189
|
+
}
|
129190
|
+
},
|
129191
|
+
getFileProcessingDiagnostics() {
|
129192
|
+
return fileProcessingDiagnostics;
|
129193
|
+
},
|
129194
|
+
getFileReasons() {
|
129195
|
+
return fileReasons;
|
129196
|
+
},
|
129197
|
+
getCommonSourceDirectory() {
|
129198
|
+
return commonSourceDirectory;
|
129199
|
+
},
|
129200
|
+
getConfigDiagnostics() {
|
129201
|
+
return configDiagnostics;
|
129202
|
+
},
|
129203
|
+
getLazyConfigDiagnostics() {
|
129204
|
+
return lazyConfigDiagnostics;
|
129205
|
+
},
|
129206
|
+
getCombinedDiagnostics(program) {
|
129207
|
+
if (computedDiagnostics) {
|
129208
|
+
return computedDiagnostics;
|
129209
|
+
}
|
129210
|
+
computedDiagnostics = createDiagnosticCollection();
|
129211
|
+
configDiagnostics == null ? void 0 : configDiagnostics.getDiagnostics().forEach((d) => computedDiagnostics.add(d));
|
129212
|
+
fileProcessingDiagnostics == null ? void 0 : fileProcessingDiagnostics.forEach((diagnostic) => {
|
129213
|
+
switch (diagnostic.kind) {
|
129214
|
+
case 1 /* FilePreprocessingFileExplainingDiagnostic */:
|
129215
|
+
return computedDiagnostics.add(
|
129216
|
+
createDiagnosticExplainingFile(
|
129217
|
+
program,
|
129218
|
+
diagnostic.file && program.getSourceFileByPath(diagnostic.file),
|
129219
|
+
diagnostic.fileProcessingReason,
|
129220
|
+
diagnostic.diagnostic,
|
129221
|
+
diagnostic.args || emptyArray
|
129222
|
+
)
|
129223
|
+
);
|
129224
|
+
case 0 /* FilePreprocessingLibReferenceDiagnostic */:
|
129225
|
+
return computedDiagnostics.add(filePreprocessingLibreferenceDiagnostic(program, diagnostic));
|
129226
|
+
case 2 /* ResolutionDiagnostics */:
|
129227
|
+
return diagnostic.diagnostics.forEach((d) => computedDiagnostics.add(d));
|
129228
|
+
default:
|
129229
|
+
Debug.assertNever(diagnostic);
|
129230
|
+
}
|
129231
|
+
});
|
129232
|
+
lazyConfigDiagnostics == null ? void 0 : lazyConfigDiagnostics.forEach(
|
129233
|
+
({ file, diagnostic, args }) => computedDiagnostics.add(
|
129234
|
+
createDiagnosticExplainingFile(
|
129235
|
+
program,
|
129236
|
+
file,
|
129237
|
+
/*fileProcessingReason*/
|
129238
|
+
void 0,
|
129239
|
+
diagnostic,
|
129240
|
+
args
|
129241
|
+
)
|
129242
|
+
)
|
129243
|
+
);
|
129244
|
+
fileReasonsToChain = void 0;
|
129245
|
+
reasonToRelatedInfo = void 0;
|
129246
|
+
return computedDiagnostics;
|
129247
|
+
}
|
129248
|
+
};
|
129249
|
+
function filePreprocessingLibreferenceDiagnostic(program, { reason }) {
|
129250
|
+
const { file, pos, end } = getReferencedFileLocation(program, reason);
|
129251
|
+
const libReference = file.libReferenceDirectives[reason.index];
|
129252
|
+
const libName = getLibNameFromLibReference(libReference);
|
129253
|
+
const unqualifiedLibName = removeSuffix(removePrefix(libName, "lib."), ".d.ts");
|
129254
|
+
const suggestion = getSpellingSuggestion(unqualifiedLibName, libs, identity);
|
129255
|
+
return createFileDiagnostic(
|
129256
|
+
file,
|
129257
|
+
Debug.checkDefined(pos),
|
129258
|
+
Debug.checkDefined(end) - pos,
|
129259
|
+
suggestion ? Diagnostics.Cannot_find_lib_definition_for_0_Did_you_mean_1 : Diagnostics.Cannot_find_lib_definition_for_0,
|
129260
|
+
libName,
|
129261
|
+
suggestion
|
129262
|
+
);
|
129263
|
+
}
|
129264
|
+
function createDiagnosticExplainingFile(program, file, fileProcessingReason, diagnostic, args) {
|
129265
|
+
let seenReasons;
|
129266
|
+
let fileIncludeReasons;
|
129267
|
+
let relatedInfo;
|
129268
|
+
let fileIncludeReasonDetails;
|
129269
|
+
let redirectInfo;
|
129270
|
+
let chain;
|
129271
|
+
const reasons = file && fileReasons.get(file.path);
|
129272
|
+
let locationReason = isReferencedFile(fileProcessingReason) ? fileProcessingReason : void 0;
|
129273
|
+
let cachedChain = file && (fileReasonsToChain == null ? void 0 : fileReasonsToChain.get(file.path));
|
129274
|
+
if (cachedChain) {
|
129275
|
+
if (cachedChain.fileIncludeReasonDetails) {
|
129276
|
+
seenReasons = new Set(reasons);
|
129277
|
+
reasons == null ? void 0 : reasons.forEach(populateRelatedInfo);
|
129278
|
+
} else {
|
129279
|
+
reasons == null ? void 0 : reasons.forEach(processReason);
|
129280
|
+
}
|
129281
|
+
redirectInfo = cachedChain.redirectInfo;
|
129282
|
+
} else {
|
129283
|
+
reasons == null ? void 0 : reasons.forEach(processReason);
|
129284
|
+
redirectInfo = file && explainIfFileIsRedirectAndImpliedFormat(file, program.getCompilerOptionsForFile(file));
|
129285
|
+
}
|
129286
|
+
if (fileProcessingReason) processReason(fileProcessingReason);
|
129287
|
+
const processedExtraReason = (seenReasons == null ? void 0 : seenReasons.size) !== (reasons == null ? void 0 : reasons.length);
|
129288
|
+
if (locationReason && (seenReasons == null ? void 0 : seenReasons.size) === 1) seenReasons = void 0;
|
129289
|
+
if (seenReasons && cachedChain) {
|
129290
|
+
if (cachedChain.details && !processedExtraReason) {
|
129291
|
+
chain = chainDiagnosticMessages(cachedChain.details, diagnostic, ...args ?? emptyArray);
|
129292
|
+
} else if (cachedChain.fileIncludeReasonDetails) {
|
129293
|
+
if (!processedExtraReason) {
|
129294
|
+
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
129295
|
+
fileIncludeReasonDetails = cachedChain.fileIncludeReasonDetails;
|
129296
|
+
} else {
|
129297
|
+
fileIncludeReasons = cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length);
|
129298
|
+
}
|
129299
|
+
} else {
|
129300
|
+
if (!cachedFileIncludeDetailsHasProcessedExtraReason()) {
|
129301
|
+
fileIncludeReasons = [...cachedChain.fileIncludeReasonDetails.next, fileIncludeReasons[0]];
|
129302
|
+
} else {
|
129303
|
+
fileIncludeReasons = append(cachedChain.fileIncludeReasonDetails.next.slice(0, reasons.length), fileIncludeReasons[0]);
|
129304
|
+
}
|
129305
|
+
}
|
129306
|
+
}
|
129307
|
+
}
|
129308
|
+
if (!chain) {
|
129309
|
+
if (!fileIncludeReasonDetails) fileIncludeReasonDetails = seenReasons && chainDiagnosticMessages(fileIncludeReasons, Diagnostics.The_file_is_in_the_program_because_Colon);
|
129310
|
+
chain = chainDiagnosticMessages(
|
129311
|
+
redirectInfo ? fileIncludeReasonDetails ? [fileIncludeReasonDetails, ...redirectInfo] : redirectInfo : fileIncludeReasonDetails,
|
129312
|
+
diagnostic,
|
129313
|
+
...args || emptyArray
|
129314
|
+
);
|
129315
|
+
}
|
129316
|
+
if (file) {
|
129317
|
+
if (cachedChain) {
|
129318
|
+
if (!cachedChain.fileIncludeReasonDetails || !processedExtraReason && fileIncludeReasonDetails) {
|
129319
|
+
cachedChain.fileIncludeReasonDetails = fileIncludeReasonDetails;
|
129320
|
+
}
|
129321
|
+
} else {
|
129322
|
+
(fileReasonsToChain ?? (fileReasonsToChain = /* @__PURE__ */ new Map())).set(file.path, cachedChain = { fileIncludeReasonDetails, redirectInfo });
|
129323
|
+
}
|
129324
|
+
if (!cachedChain.details && !processedExtraReason) cachedChain.details = chain.next;
|
129325
|
+
}
|
129326
|
+
const location = locationReason && getReferencedFileLocation(program, locationReason);
|
129327
|
+
return location && isReferenceFileLocation(location) ? createFileDiagnosticFromMessageChain(location.file, location.pos, location.end - location.pos, chain, relatedInfo) : createCompilerDiagnosticFromMessageChain(chain, relatedInfo);
|
129328
|
+
function processReason(reason) {
|
129329
|
+
if (seenReasons == null ? void 0 : seenReasons.has(reason)) return;
|
129330
|
+
(seenReasons ?? (seenReasons = /* @__PURE__ */ new Set())).add(reason);
|
129331
|
+
(fileIncludeReasons ?? (fileIncludeReasons = [])).push(fileIncludeReasonToDiagnostics(program, reason));
|
129332
|
+
populateRelatedInfo(reason);
|
129333
|
+
}
|
129334
|
+
function populateRelatedInfo(reason) {
|
129335
|
+
if (!locationReason && isReferencedFile(reason)) {
|
129336
|
+
locationReason = reason;
|
129337
|
+
} else if (locationReason !== reason) {
|
129338
|
+
relatedInfo = append(relatedInfo, getFileIncludeReasonToRelatedInformation(program, reason));
|
129339
|
+
}
|
129340
|
+
}
|
129341
|
+
function cachedFileIncludeDetailsHasProcessedExtraReason() {
|
129342
|
+
var _a;
|
129343
|
+
return ((_a = cachedChain.fileIncludeReasonDetails.next) == null ? void 0 : _a.length) !== (reasons == null ? void 0 : reasons.length);
|
129344
|
+
}
|
129345
|
+
}
|
129346
|
+
function getFileIncludeReasonToRelatedInformation(program, reason) {
|
129347
|
+
let relatedInfo = reasonToRelatedInfo == null ? void 0 : reasonToRelatedInfo.get(reason);
|
129348
|
+
if (relatedInfo === void 0) (reasonToRelatedInfo ?? (reasonToRelatedInfo = /* @__PURE__ */ new Map())).set(reason, relatedInfo = fileIncludeReasonToRelatedInformation(program, reason) ?? false);
|
129349
|
+
return relatedInfo || void 0;
|
129350
|
+
}
|
129351
|
+
function fileIncludeReasonToRelatedInformation(program, reason) {
|
129352
|
+
if (isReferencedFile(reason)) {
|
129353
|
+
const referenceLocation = getReferencedFileLocation(program, reason);
|
129354
|
+
let message2;
|
129355
|
+
switch (reason.kind) {
|
129356
|
+
case 3 /* Import */:
|
129357
|
+
message2 = Diagnostics.File_is_included_via_import_here;
|
129358
|
+
break;
|
129359
|
+
case 4 /* ReferenceFile */:
|
129360
|
+
message2 = Diagnostics.File_is_included_via_reference_here;
|
129361
|
+
break;
|
129362
|
+
case 5 /* TypeReferenceDirective */:
|
129363
|
+
message2 = Diagnostics.File_is_included_via_type_library_reference_here;
|
129364
|
+
break;
|
129365
|
+
case 7 /* LibReferenceDirective */:
|
129366
|
+
message2 = Diagnostics.File_is_included_via_library_reference_here;
|
129367
|
+
break;
|
129368
|
+
default:
|
129369
|
+
Debug.assertNever(reason);
|
129370
|
+
}
|
129371
|
+
return isReferenceFileLocation(referenceLocation) ? createFileDiagnostic(
|
129372
|
+
referenceLocation.file,
|
129373
|
+
referenceLocation.pos,
|
129374
|
+
referenceLocation.end - referenceLocation.pos,
|
129375
|
+
message2
|
129376
|
+
) : void 0;
|
129377
|
+
}
|
129378
|
+
const currentDirectory = program.getCurrentDirectory();
|
129379
|
+
const rootNames = program.getRootFileNames();
|
129380
|
+
const options = program.getCompilerOptions();
|
129381
|
+
if (!options.configFile) return void 0;
|
129382
|
+
let configFileNode;
|
129383
|
+
let message;
|
129384
|
+
switch (reason.kind) {
|
129385
|
+
case 0 /* RootFile */:
|
129386
|
+
if (!options.configFile.configFileSpecs) return void 0;
|
129387
|
+
const fileName = getNormalizedAbsolutePath(rootNames[reason.index], currentDirectory);
|
129388
|
+
const matchedByFiles = getMatchedFileSpec(program, fileName);
|
129389
|
+
if (matchedByFiles) {
|
129390
|
+
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "files", matchedByFiles);
|
129391
|
+
message = Diagnostics.File_is_matched_by_files_list_specified_here;
|
129392
|
+
break;
|
129393
|
+
}
|
129394
|
+
const matchedByInclude = getMatchedIncludeSpec(program, fileName);
|
129395
|
+
if (!matchedByInclude || !isString(matchedByInclude)) return void 0;
|
129396
|
+
configFileNode = getTsConfigPropArrayElementValue(options.configFile, "include", matchedByInclude);
|
129397
|
+
message = Diagnostics.File_is_matched_by_include_pattern_specified_here;
|
129398
|
+
break;
|
129399
|
+
case 1 /* SourceFromProjectReference */:
|
129400
|
+
case 2 /* OutputFromProjectReference */:
|
129401
|
+
const resolvedProjectReferences = program.getResolvedProjectReferences();
|
129402
|
+
const projectReferences = program.getProjectReferences();
|
129403
|
+
const referencedResolvedRef = Debug.checkDefined(resolvedProjectReferences == null ? void 0 : resolvedProjectReferences[reason.index]);
|
129404
|
+
const referenceInfo = forEachProjectReference(
|
129405
|
+
projectReferences,
|
129406
|
+
resolvedProjectReferences,
|
129407
|
+
(resolvedRef, parent2, index2) => resolvedRef === referencedResolvedRef ? { sourceFile: (parent2 == null ? void 0 : parent2.sourceFile) || options.configFile, index: index2 } : void 0
|
129408
|
+
);
|
129409
|
+
if (!referenceInfo) return void 0;
|
129410
|
+
const { sourceFile, index } = referenceInfo;
|
129411
|
+
const referencesSyntax = forEachTsConfigPropArray(sourceFile, "references", (property) => isArrayLiteralExpression(property.initializer) ? property.initializer : void 0);
|
129412
|
+
return referencesSyntax && referencesSyntax.elements.length > index ? createDiagnosticForNodeInSourceFile(
|
129413
|
+
sourceFile,
|
129414
|
+
referencesSyntax.elements[index],
|
129415
|
+
reason.kind === 2 /* OutputFromProjectReference */ ? Diagnostics.File_is_output_from_referenced_project_specified_here : Diagnostics.File_is_source_from_referenced_project_specified_here
|
129416
|
+
) : void 0;
|
129417
|
+
case 8 /* AutomaticTypeDirectiveFile */:
|
129418
|
+
if (!options.types) return void 0;
|
129419
|
+
configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "types", reason.typeReference);
|
129420
|
+
message = Diagnostics.File_is_entry_point_of_type_library_specified_here;
|
129421
|
+
break;
|
129422
|
+
case 6 /* LibFile */:
|
129423
|
+
if (reason.index !== void 0) {
|
129424
|
+
configFileNode = getOptionsSyntaxByArrayElementValue(getCompilerOptionsObjectLiteralSyntax(), "lib", options.lib[reason.index]);
|
129425
|
+
message = Diagnostics.File_is_library_specified_here;
|
129426
|
+
break;
|
129427
|
+
}
|
129428
|
+
const target = getNameOfScriptTarget(getEmitScriptTarget(options));
|
129429
|
+
configFileNode = target ? getOptionsSyntaxByValue(getCompilerOptionsObjectLiteralSyntax(), "target", target) : void 0;
|
129430
|
+
message = Diagnostics.File_is_default_library_for_target_specified_here;
|
129431
|
+
break;
|
129432
|
+
default:
|
129433
|
+
Debug.assertNever(reason);
|
129434
|
+
}
|
129435
|
+
return configFileNode && createDiagnosticForNodeInSourceFile(
|
129436
|
+
options.configFile,
|
129437
|
+
configFileNode,
|
129438
|
+
message
|
129439
|
+
);
|
129440
|
+
}
|
129441
|
+
}
|
129442
|
+
|
129293
129443
|
// src/compiler/builderState.ts
|
129294
129444
|
function getFileEmitOutput(program, sourceFile, emitOnlyDtsFiles, cancellationToken, customTransformers, forceDtsEmit) {
|
129295
129445
|
const outputFiles = [];
|
@@ -182620,6 +182770,7 @@ __export(ts_exports2, {
|
|
182620
182770
|
createPrinterWithRemoveCommentsNeverAsciiEscape: () => createPrinterWithRemoveCommentsNeverAsciiEscape,
|
182621
182771
|
createPrinterWithRemoveCommentsOmitTrailingSemicolon: () => createPrinterWithRemoveCommentsOmitTrailingSemicolon,
|
182622
182772
|
createProgram: () => createProgram,
|
182773
|
+
createProgramDiagnostics: () => createProgramDiagnostics,
|
182623
182774
|
createProgramHost: () => createProgramHost,
|
182624
182775
|
createPropertyNameNodeForIdentifierOrLiteral: () => createPropertyNameNodeForIdentifierOrLiteral,
|
182625
182776
|
createQueue: () => createQueue,
|
@@ -182789,6 +182940,8 @@ __export(ts_exports2, {
|
|
182789
182940
|
forEachLeadingCommentRange: () => forEachLeadingCommentRange,
|
182790
182941
|
forEachNameInAccessChainWalkingLeft: () => forEachNameInAccessChainWalkingLeft,
|
182791
182942
|
forEachNameOfDefaultExport: () => forEachNameOfDefaultExport,
|
182943
|
+
forEachOptionsSyntaxByName: () => forEachOptionsSyntaxByName,
|
182944
|
+
forEachProjectReference: () => forEachProjectReference,
|
182792
182945
|
forEachPropertyAssignment: () => forEachPropertyAssignment,
|
182793
182946
|
forEachResolvedProjectReference: () => forEachResolvedProjectReference,
|
182794
182947
|
forEachReturnStatement: () => forEachReturnStatement,
|
@@ -183028,6 +183181,8 @@ __export(ts_exports2, {
|
|
183028
183181
|
getLeadingCommentRangesOfNode: () => getLeadingCommentRangesOfNode,
|
183029
183182
|
getLeftmostAccessExpression: () => getLeftmostAccessExpression,
|
183030
183183
|
getLeftmostExpression: () => getLeftmostExpression,
|
183184
|
+
getLibFileNameFromLibReference: () => getLibFileNameFromLibReference,
|
183185
|
+
getLibNameFromLibReference: () => getLibNameFromLibReference,
|
183031
183186
|
getLibraryNameFromLibFileName: () => getLibraryNameFromLibFileName,
|
183032
183187
|
getLineAndCharacterOfPosition: () => getLineAndCharacterOfPosition,
|
183033
183188
|
getLineInfo: () => getLineInfo,
|
@@ -183100,6 +183255,8 @@ __export(ts_exports2, {
|
|
183100
183255
|
getOptionFromName: () => getOptionFromName,
|
183101
183256
|
getOptionsForLibraryResolution: () => getOptionsForLibraryResolution,
|
183102
183257
|
getOptionsNameMap: () => getOptionsNameMap,
|
183258
|
+
getOptionsSyntaxByArrayElementValue: () => getOptionsSyntaxByArrayElementValue,
|
183259
|
+
getOptionsSyntaxByValue: () => getOptionsSyntaxByValue,
|
183103
183260
|
getOrCreateEmitNode: () => getOrCreateEmitNode,
|
183104
183261
|
getOrUpdate: () => getOrUpdate,
|
183105
183262
|
getOriginalNode: () => getOriginalNode,
|
@@ -183136,7 +183293,6 @@ __export(ts_exports2, {
|
|
183136
183293
|
getPrivateIdentifier: () => getPrivateIdentifier,
|
183137
183294
|
getProperties: () => getProperties,
|
183138
183295
|
getProperty: () => getProperty,
|
183139
|
-
getPropertyArrayElementValue: () => getPropertyArrayElementValue,
|
183140
183296
|
getPropertyAssignmentAliasLikeExpression: () => getPropertyAssignmentAliasLikeExpression,
|
183141
183297
|
getPropertyNameForPropertyNameNode: () => getPropertyNameForPropertyNameNode,
|
183142
183298
|
getPropertyNameFromType: () => getPropertyNameFromType,
|
@@ -197368,6 +197524,7 @@ if (typeof console !== "undefined") {
|
|
197368
197524
|
createPrinterWithRemoveCommentsNeverAsciiEscape,
|
197369
197525
|
createPrinterWithRemoveCommentsOmitTrailingSemicolon,
|
197370
197526
|
createProgram,
|
197527
|
+
createProgramDiagnostics,
|
197371
197528
|
createProgramHost,
|
197372
197529
|
createPropertyNameNodeForIdentifierOrLiteral,
|
197373
197530
|
createQueue,
|
@@ -197537,6 +197694,8 @@ if (typeof console !== "undefined") {
|
|
197537
197694
|
forEachLeadingCommentRange,
|
197538
197695
|
forEachNameInAccessChainWalkingLeft,
|
197539
197696
|
forEachNameOfDefaultExport,
|
197697
|
+
forEachOptionsSyntaxByName,
|
197698
|
+
forEachProjectReference,
|
197540
197699
|
forEachPropertyAssignment,
|
197541
197700
|
forEachResolvedProjectReference,
|
197542
197701
|
forEachReturnStatement,
|
@@ -197776,6 +197935,8 @@ if (typeof console !== "undefined") {
|
|
197776
197935
|
getLeadingCommentRangesOfNode,
|
197777
197936
|
getLeftmostAccessExpression,
|
197778
197937
|
getLeftmostExpression,
|
197938
|
+
getLibFileNameFromLibReference,
|
197939
|
+
getLibNameFromLibReference,
|
197779
197940
|
getLibraryNameFromLibFileName,
|
197780
197941
|
getLineAndCharacterOfPosition,
|
197781
197942
|
getLineInfo,
|
@@ -197848,6 +198009,8 @@ if (typeof console !== "undefined") {
|
|
197848
198009
|
getOptionFromName,
|
197849
198010
|
getOptionsForLibraryResolution,
|
197850
198011
|
getOptionsNameMap,
|
198012
|
+
getOptionsSyntaxByArrayElementValue,
|
198013
|
+
getOptionsSyntaxByValue,
|
197851
198014
|
getOrCreateEmitNode,
|
197852
198015
|
getOrUpdate,
|
197853
198016
|
getOriginalNode,
|
@@ -197884,7 +198047,6 @@ if (typeof console !== "undefined") {
|
|
197884
198047
|
getPrivateIdentifier,
|
197885
198048
|
getProperties,
|
197886
198049
|
getProperty,
|
197887
|
-
getPropertyArrayElementValue,
|
197888
198050
|
getPropertyAssignmentAliasLikeExpression,
|
197889
198051
|
getPropertyNameForPropertyNameNode,
|
197890
198052
|
getPropertyNameFromType,
|