Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 20 additions & 0 deletions src/file_system.rs
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,26 @@ impl FileSystem for FileSystemOs {
}

fn symlink_metadata(&self, path: &Path) -> io::Result<FileMetadata> {
cfg_if! {
if #[cfg(feature = "yarn_pnp")] {
if self.yarn_pnp {
// Mirror `metadata`'s virtual-path translation. Without it, `lstat`-ing a
// virtual or zip path directly stats a path that may not physically exist, so
// canonicalization cannot detect symlinks correctly under Yarn PnP. Zip entries
// are never symlinks, so reuse the same file-type lookup as `metadata`.
return match VPath::from(path)? {
VPath::Zip(info) => self
.pnp_lru
.file_type(info.physical_base_path(), info.zip_path)
.map(FileMetadata::from),
VPath::Virtual(info) => {
Self::symlink_metadata(&info.physical_base_path())
}
VPath::Native(path) => Self::symlink_metadata(&path),
}
}
}
}
Self::symlink_metadata(path)
}

Expand Down
Loading