Skip to content

Module Graph

The module graph tracks import relationships between TypeScript files in a chant project. It is used for incremental rebuilds in watch mode and for cross-file lint rules.

The module graph walks all import declarations across source files, resolving each module specifier. The result is a directed graph where edges point from a file to its dependencies.

CategoryPatternExample
Sources*.ts (excluding tests and declarations)src/data-bucket.ts
Excluded.test.ts, .spec.ts, .d.ts, node_modules/

The module graph computes affected files for incremental rebuilds by performing a reverse walk from changed files, returning all files that transitively depend on them.

When --watch is active:

  1. File system events are debounced
  2. If a file was modified, the module graph computes dependents
  3. Only affected files are re-evaluated
  4. If a file was created or deleted, a full rebuild runs