Repository navigation
fix: resolve symlinks in cwd - #85
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A build through a symlinked project path wrote different script bytes.
bongo build -C /tmp/siteon macOS, where/tmplinks to/private/tmp, gave//#region ../../private/tmp/site/assets/main.ts. A build from inside the folder gave//#region assets/main.ts.normalize()kept the symlink inargv.cwd, while Rolldown names each module by its real path, so the relative path climbed to/and back. Minified builds have no region comments, so they were not affected.Changes
normalize()setsargv.cwdwithfs.real(), which resolves symlinks and keeps a part that does not exist yet. Every path made fromargv.cwdnow matches the module paths.fs.real()is exported, with docs.bundler.summary()drops its check ofrealpathSync(root), since each root is now real. The same check forcontent/inbuild.tsstays: it covers acontent/folder that is itself a symlink.Visible changes
-Cthrough a symlink, the list showsprivate/tmp/site/public/, nottmp/site/public/. A build that runs from inside the folder already had real paths, sinceprocess.cwd()is real.argv.dest, so the first build through a symlinked path after this change renders every page once.Benchmark
bun bench/index.ts site --runs 5, 10 pairs, alternating which side runs first. Wall is the median of 5 fresh builds of 10,000 pages.mainwallmainuserThe branch median is higher in 4 pairs, lower in 1, and the same in 5. Its fastest run is lower than
main's in 5 pairs and higher in 3. User time is the same within 0.02 s.bench/sitehas no symlink in its path, so the only added work is onerealpathcall per build. Every run wrote the same output, sha25671e146856b298c20.Test plan
bun test(854 pass),bunx tsc -p .,bunx tsc -p build,bun run buildmain:normalize()resolves a symlinkedcwdand keeps a missing part, and a script built through a symlinkedcwdhas the bytes of a build through the real pathnormalize()pathsbongo build -C /tmp/rcfrom/writes//#region assets/main.ts, andbongo dev -C /tmp/rcrebuilds on an edit