Skip to content

Fix multi-line TS/JS imports getting dropped from the dep graph#542

Closed
nsxdavid wants to merge 1 commit into
justrach:mainfrom
nsxdavid:fix/ts-multiline-import-extraction
Closed

Fix multi-line TS/JS imports getting dropped from the dep graph#542
nsxdavid wants to merge 1 commit into
justrach:mainfrom
nsxdavid:fix/ts-multiline-import-extraction

Conversation

@nsxdavid

@nsxdavid nsxdavid commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

Fixes #540.

parseTsLine only grabbed the import path off lines that contained import . Multi-line imports put from "..." on the closing } line, so the dependency got dropped. This adds a continuation branch that pulls the path off } from "..." lines, plus export ... from re-exports which were dropped the same way.

The branch is gated on those concrete shapes (} from and export ... from) rather than any line containing from ", so strings and comments like select * from "users" don't get mistaken for dependencies.

Red to green: the new test indexes a multi-line import, a re-export, and a comment containing from "config.json". It checks the real imports land in outline.imports and the comment does not. Fails before the change (multi-line path missing), passes after. The rest of the suite stays green.

Files: src/explore.zig (parseTsLine), src/test_parser.zig.

One function plus a test, no generated artifacts, branch is off current main. Read CONTRIBUTING and followed it.

parseTsLine only extracted an import's `from "..."` specifier when it
appeared on the same line as `import `. Multi-line ES imports place the
`from "..."` clause on a line beginning with `}`, so those dependency
paths were dropped (only single-line imports were captured).

Add a continuation branch that extracts the specifier from `} from "..."`
lines; this also captures `export ... from` re-export dependencies.

Adds a red-to-green parser test.
@justrach

justrach commented Jun 7, 2026

Copy link
Copy Markdown
Owner

Hi @nsxdavid — thank you for this! 🙏 Clean fix, and guarding against from "..." inside comments/strings was exactly the right call.

Quick logistics note: we land changes on the active release/* branch rather than main (just added a CI hint so this is clearer going forward — sorry for the friction). Rather than make you retarget, I've cherry-picked your commit straight onto release/0.2.5825 as 5cd1e6d, with your authorship preserved. Verified there: clean apply, builds on Zig 0.16, your issue-1 test passes, full suite green (725/725).

You're credited as the commit author and will be listed in the 0.2.5825 release notes. Closing this since it's landed there. Thanks again for the contribution! 🙌

@justrach justrach closed this Jun 7, 2026
justrach added a commit that referenced this pull request Jun 7, 2026
…ps/search/CLI + @nsxdavid credit

Documents the work that landed in 0.2.5825 beyond the original #537/#538/#539
cut (codedb_callpath + PageRank #531, symbol filters, JSON/paths_only output,
TS/JS dep-graph fixes #540/#541/#542/#543/#548, search word-index loading #547,
CLI hardening #528) and credits @nsxdavid. Removes the pre-publish TODO.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@nsxdavid

nsxdavid commented Jun 7, 2026

Copy link
Copy Markdown
Contributor Author

Cool... for the future: should I make PRs to the active release/* branch instead? Not sure if I missed something in the CONTRIBUTING docs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi-line TS/JS imports are missing from the dependency graph

2 participants