fix: resolve symlinks in directory cache lookups#215
Open
benpsnyder wants to merge 1 commit into
Open
Conversation
- Updated the `bundle` script in `package.json` to use `node --import tsx/esm` for better compatibility. - Introduced a new `realpath` function in `src/path.ts` to resolve symlinks and normalize paths. - Refactored the resolver to utilize `path.realpath` for improved directory handling. - Added new test fixtures for symlink resolution and directory structure validation. - Created example files to demonstrate the new functionality in the `test/__fixtures__` directory.
benpsnyder
force-pushed
the
fix/macos-symlink
branch
from
March 29, 2026 19:09
d4ddde9 to
baad9a5
Compare
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.
Fixes #138. Also includes test fixtures for #130 (
rootDirs) and #210 (explicit.d.tsimports).Symlink resolution (#138)
Root cause:
directoryCachekeys and the importer directory walk both usedpath.normalize(), which does not resolve symlinks. On macOS,/tmp→/private/tmp, so tsconfck discovers configs under/tmp/...while Vite reports importers under/private/tmp/...— the cache lookup never matches.Fix: Added
path.realpath()(wrapsfs.realpathSync+ normalize, with graceful fallback) at three entry points:addProjectgetResolverswatchProjectsTest:
symlink-resolvefixture — project root accessed through a symlink (link → real). tsconfck discovers via the symlink path; Vite reports the real path. Resolution succeeds.Also included
rootDirstest fixture (rootDirssupport? #130) —root-dirsfixture confirmsoxc-resolverhandlesrootDirsnatively (no code change needed).d.tsguard (Cannot import from .d.ts files #210) — same explicit-vs-implicit pattern as the.jsonguard:dtsPattern.test(resolvedId) && !dtsPattern.test(id)