Skip to content

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

@nsxdavid

Description

@nsxdavid

The TS/JS parser only records an import when from "..." is on the same line as import. When an import spans multiple lines, the from "..." ends up alone on the closing } line, and that line never gets parsed as an import. The dependency is silently dropped.

This hits almost every formatted codebase, since Prettier and Biome both wrap imports like this:

import {
  a,
  b,
} from "./thing.ts";

codedb deps file.ts --depends-on shows nothing for ./thing.ts. Single-line imports work. Multi-line ones disappear.

Cause: parseTsLine only looks for the string literal on lines that contain import . The } from "..." continuation line doesn't, so it falls through. The Go parser already tracks multi-line import blocks. TS has no equivalent.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions