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:
Andrew Casey
2020-12-18 09:23:42 -08:00
committed by GitHub
parent e789cb1356
commit 902fcb0cc7
18 changed files with 2725 additions and 14 deletions

View File

@@ -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";