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.
Construction
Section titled “Construction”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.
File Discovery
Section titled “File Discovery”| Category | Pattern | Example |
|---|---|---|
| Sources | *.ts (excluding tests and declarations) | src/data-bucket.ts |
| Excluded | .test.ts, .spec.ts, .d.ts, node_modules/ | — |
Incremental Rebuilds
Section titled “Incremental Rebuilds”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.
Watch Mode Integration
Section titled “Watch Mode Integration”When --watch is active:
- File system events are debounced
- If a file was modified, the module graph computes dependents
- Only affected files are re-evaluated
- If a file was created or deleted, a full rebuild runs