mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-16 07:13:45 -05:00
Set hasAddedOrRemovedSymlinks when discovering an existing file by its link (#46569)
* Set hasAddedOrRemovedSymlinks when discovering an existing file by its link * Make it optional
This commit is contained in:
@@ -1674,8 +1674,8 @@ namespace ts {
|
||||
const typesReferenceDirectives = map(newSourceFile.typeReferenceDirectives, ref => toFileNameLowerCase(ref.fileName));
|
||||
const typeReferenceResolutions = resolveTypeReferenceDirectiveNamesWorker(typesReferenceDirectives, newSourceFile);
|
||||
// ensure that types resolutions are still correct
|
||||
const typeReferenceEesolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, typeDirectiveIsEqualTo);
|
||||
if (typeReferenceEesolutionsChanged) {
|
||||
const typeReferenceResolutionsChanged = hasChangesInResolutions(typesReferenceDirectives, typeReferenceResolutions, oldSourceFile.resolvedTypeReferenceDirectiveNames, oldSourceFile, typeDirectiveIsEqualTo);
|
||||
if (typeReferenceResolutionsChanged) {
|
||||
structureIsReused = StructureIsReused.SafeModules;
|
||||
newSourceFile.resolvedTypeReferenceDirectiveNames = zipToModeAwareCache(newSourceFile, typesReferenceDirectives, typeReferenceResolutions);
|
||||
}
|
||||
|
||||
@@ -66,6 +66,7 @@ namespace ts {
|
||||
getCurrentProgram(): Program | undefined;
|
||||
fileIsOpen(filePath: Path): boolean;
|
||||
getCompilerHost?(): CompilerHost | undefined;
|
||||
onDiscoveredSymlink?(): void;
|
||||
}
|
||||
|
||||
interface DirectoryWatchesOfFailedLookup {
|
||||
@@ -431,6 +432,9 @@ namespace ts {
|
||||
else {
|
||||
resolution = loader(name, containingFile, compilerOptions, resolutionHost.getCompilerHost?.() || resolutionHost, redirectedReference, containingSourceFile);
|
||||
perDirectoryResolution.set(name, mode, resolution);
|
||||
if (resolutionHost.onDiscoveredSymlink && resolutionIsSymlink(resolution)) {
|
||||
resolutionHost.onDiscoveredSymlink();
|
||||
}
|
||||
}
|
||||
resolutionsInFile.set(name, mode, resolution);
|
||||
watchFailedLookupLocationsOfExternalModuleResolutions(name, resolution, path, getResolutionWithResolvedFileName);
|
||||
@@ -965,4 +969,11 @@ namespace ts {
|
||||
return dirPath === rootPath || canWatchDirectory(dirPath);
|
||||
}
|
||||
}
|
||||
|
||||
function resolutionIsSymlink(resolution: ResolutionWithFailedLookupLocations) {
|
||||
return !!(
|
||||
(resolution as ResolvedModuleWithFailedLookupLocations).resolvedModule?.originalPath ||
|
||||
(resolution as ResolvedTypeReferenceDirectiveWithFailedLookupLocations).resolvedTypeReferenceDirective?.originalPath
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user