mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-06-11 10:46:28 -05:00
Use fs.realpathSync.native when available (#41292)
* Test that forceConsistentCasingInFileNames does not apply to Windows drive roots * Add file symlink baselines * Add directory symlink baselines * Update test to retain its meaning Its purpose is (apparently) to demonstrate that forceConsistenCasingInFileNames can interact badly with synthesized react imports. Since the casing of the synthesized import has changed, also modify the casing of the explicit reference to still conflict. * Make VFSWithWatch.realpath use the path on disk * Update VFS realpathSync to behave like realpathSync.native * Use fs.realpathSync.native when available In local measurements of an Office project, we saw initial project loading get 5% faster on Windows and 13% faster on Linux. The only identified behavioral change is that it restores the case used on disk, whereas realpathSync retains the input lowercase. * Rename SortedMap.getKeyAndValue to getEntry
This commit is contained in:
@@ -828,9 +828,9 @@ interface Array<T> { length: number; [n: number]: T; }`
|
||||
return undefined;
|
||||
}
|
||||
|
||||
const realpath = this.realpath(path);
|
||||
const realpath = this.toPath(this.realpath(path));
|
||||
if (path !== realpath) {
|
||||
return this.getRealFsEntry(isFsEntry, this.toPath(realpath));
|
||||
return this.getRealFsEntry(isFsEntry, realpath);
|
||||
}
|
||||
|
||||
return undefined;
|
||||
@@ -1097,7 +1097,8 @@ interface Array<T> { length: number; [n: number]: T; }`
|
||||
return this.realpath(fsEntry.symLink);
|
||||
}
|
||||
|
||||
return realFullPath;
|
||||
// realpath supports non-existent files, so there may not be an fsEntry
|
||||
return fsEntry?.fullPath || realFullPath;
|
||||
}
|
||||
|
||||
readonly exitMessage = "System Exit";
|
||||
|
||||
Reference in New Issue
Block a user