fix(extract-import-map): resolve tsconfig paths with './' prefix (#214)#239
Open
Ylsssq926 wants to merge 2 commits into
Open
fix(extract-import-map): resolve tsconfig paths with './' prefix (#214)#239Ylsssq926 wants to merge 2 commits into
Ylsssq926 wants to merge 2 commits into
Conversation
…nex-AI#214) When tsconfig.json uses `"@/*": ["./*"]` (the default in Next.js, Vite, Nuxt), applyTsAlias produces paths like "./utils". The ternary at line 433 skipped posix.join when tsConfigDir was empty, leaving the "./" prefix intact. Since fileSet stores paths without "./" (e.g. "utils.ts"), the probe always missed — dropping all alias-based import edges. Fix: always run posix.join(tsConfigDir, relativeToConfig). When tsConfigDir is '', posix.join('', './utils') normalizes to 'utils', matching fileSet. Added 3 test cases covering "./*", "./src/*", and multi-target fallback with "./" prefixes.
…base Latest main already carries the Egonex-AI#214 resolver fix and focused regression coverage. After rebasing, the original PR tests were duplicated in the tree-sitter failure block and no longer formed a useful diff. Drop the duplicate block so the PR branch matches the resolved main behavior.
ef0dac6 to
cef7e01
Compare
Author
|
Rebased this branch onto current main to resolve the conflict. The net PR diff is now empty because current main already includes the #214 import-map fix and focused regression coverage for tsconfig path targets with leading ./ prefixes. Leaving the PR open for maintainer/author decision rather than closing it unilaterally. |
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.
Hit this on a Next.js project — all
@/alias imports were missing from the knowledge graph. Traced it toextract-import-map.mjsline 433.Root cause: When tsconfig uses
"@/*": ["./*"](the default in Next.js / Vite / Nuxt),applyTsAliasproduces paths like"./utils". The ternary expression at line 433 skippedposix.joinwhentsConfigDirwas empty (root tsconfig), so the"./"prefix passed through toprobeWithExtensionsunchanged. SincefileSetstores paths without"./"(e.g."utils.ts"), the probe never matched.Fix: Remove the ternary and always run
posix.join(tsConfigDir, relativeToConfig). WhentsConfigDiris'',posix.join('', './utils')normalizes to'utils'— matching fileSet. WhentsConfigDiris non-empty, behavior is identical to before.3 lines → 1 line change in the script, plus 3 new test cases:
"./*"target (Next.js App Router default)"./src/*"target"./"prefixesExisting tests still pass — the
"src/*"form (without./) was never affected.