Fix multi-line TS/JS imports getting dropped from the dep graph#542
Fix multi-line TS/JS imports getting dropped from the dep graph#542nsxdavid wants to merge 1 commit into
Conversation
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.
|
Hi @nsxdavid — thank you for this! 🙏 Clean fix, and guarding against Quick logistics note: we land changes on the active 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! 🙌 |
…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>
|
Cool... for the future: should I make PRs to the active release/* branch instead? Not sure if I missed something in the CONTRIBUTING docs. |
Fixes #540.
parseTsLineonly grabbed the import path off lines that containedimport. Multi-line imports putfrom "..."on the closing}line, so the dependency got dropped. This adds a continuation branch that pulls the path off} from "..."lines, plusexport ... fromre-exports which were dropped the same way.The branch is gated on those concrete shapes (
} fromandexport ... from) rather than any line containingfrom ", so strings and comments likeselect * 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 inoutline.importsand 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.