Files
Marcos Hernanz 19ebdc4cba Fix Turbopack resolution through chained symlinks (#97825)
## Summary

- classify symlinks by the final target of the full chain with
`LinkTarget::resolved_type`
- preserve non-directory behavior for dangling, invalid, and cyclic
chains and retain the existing ancestor-loop guard
- fold two-hop directory-symlink coverage into the existing production
symbolic-links suite

Fixes #97786.

## Verification

- `CARGO_INCREMENTAL=0 pnpm build-all`
- `cargo test -p turbo-tasks-fs
test_link_target_resolved_type_through_chain -- --nocapture`
- `cargo test -p turbo-tasks-fs read_glob_symlinks -- --nocapture`
- `cargo test -p turbopack-core test_read_matches -- --nocapture`
- `cargo clippy -p turbo-tasks-fs -p turbopack-core --all-targets -- -D
warnings`
- `cargo fmt --all -- --check`
- `pnpm test-start-turbo test/production/app-dir/symbolic-links -t
"chained directory symlinks"`
- manually verified `/directory-symlink-chain` under `next dev
--turbopack`

---------

Co-authored-by: Benjamin Woodruff <benjamin.woodruff@vercel.com>
2026-08-25 14:58:30 -07:00
..

Symbolic Links

The /file-symlink route represents what the Next.js file structure may look like when run under a build orchestrator, such as Bazel, where its sandbox sets up source files as symlinks to their original source.

The /directory-symlink route covers resolving a module through a directory symlink under src. The /directory-symlink-chain route covers the same resolution through two consecutive directory symlinks.