framework internals
vercel/next.js · #97825
Fix Turbopack resolution through chained symlinksRust · 135 + / 13 −
148 source lines changed in turbopack/crates/turbo-tasks-fs/src/disk.rs.
A reviewable change in a preferred framework internals path. Focused tests changed with it.
@@ -1958,6 +1958,67 @@ mod tests { tt.stop_and_wait().await; } + #[cfg(unix)]+ #[tokio::test(flavor = "multi_thread", worker_threads = 2)]+ async fn test_link_target_resolved_type_through_chain() {+ use std::os::unix::fs::symlink;++ let scratch = tempfile::tempdir().unwrap();+ let path = scratch.path().to_owned();+ create_dir_all(path.join("target-dir")).unwrap();+ File::create_new(path.join("target-file")).unwrap();+ symlink("target-dir", path.join("dir-inner")).unwrap();+ symlink("dir-inner", path.join("dir-outer")).unwrap();+ symlink("target-file", path.join("file-inner")).unwrap();+ symlink("file-inner", path.join("file-outer")).unwrap();+ symlink("../outside", path.join("invalid-inner")).unwrap();+ symlink("invalid-inner", path.join("invalid-outer")).unwrap();++ let root = canonicalize_to_rcstr(&path).unwrap();++ #[turbo_tasks::function(operation, root)]+ async fn assert_operation(+ fs: ResolvedVc<DiskFileSystem>,+ root_path: FileSystemPath,+ ) -> anyhow::Result<()> {+ for (input_path, expected_output) in [+ ("dir-outer", FileSystemEntryType::Directory),+ ("file-outer", FileSystemEntryType::File),+ ("invalid-outer", FileSystemEntryType::Error),+ ] {+ let link = fs.read_link(root_path.join(input_path)?).await?;+ let LinkContent::Link { target } = &*link else {