How it works
Two graphs
For each entry, affected builds the import graph twice:
- Head — the working tree on disk (including uncommitted and untracked files, unless
--committed). - Base — the merge base of
baseandHEAD, read straight from the object database throughgit ls-treeand long-livedgit cat-file --batchprocesses. Nothing is checked out.
A changed file hits an entry when either graph reaches it. That is what makes removed imports and deleted files count: the PR’s own diff can no longer reach them, but the fork point can.
Files that the diff did not touch are parsed once and shared between both graphs. Each breadth-first frontier is resolved in parallel, and the breadth-first parent of each file gives the shortest chain.
Entries
| Entry | Roots | Resolution |
|---|---|---|
tsconfig.json | files + include − exclude, merged through extends (relative or package), plus every project in references, transitively | that tsconfig’s paths, baseUrl and customConditions |
['a.ts', 'b.ts'] | the files | each file’s nearest tsconfig |
Every config in the extends chain is a node of the graph, so editing a shared base config hits.
Edges
| Kind | Examples |
|---|---|
| Modules | import/export … from, import()/require() with a literal, import x = require(), import('…') types, require.resolve(), /// <reference types>, jest.mock/vi.mock and requireActual/importActual |
| Globs | import.meta.glob, require.context, import(`./locales/${l}.json`), import('./pages/' + name) |
| Files | /// <reference path>, new URL('./worker.ts', import.meta.url), join(__dirname, 'prompts', 'a.md'), path.resolve(import.meta.dirname, …) |
| Components | <script> blocks of .vue and .svelte files, Astro frontmatter |
A glob is matched against each revision’s file list, so a file the PR adds under a glob hits. A path that names a directory stands for everything below it, except a directory that contains the importing file (that is a base for further path building, not an asset).
Dynamic requests with no static directory — import(name), import(`${x}`) — are not edges. Declare what they load with inputs.
Packages and manifests
- Workspace packages resolve through their
node_modulessymlink to their source in the repository and are followed like any other file. Theirpackage.jsonjoins the graph, so retargetingexportshits. - Installed packages are leaves. Each stands for its version range in the nearest
package.jsonthat declares it — a node shown aspackage.json#zod. A diff hits that node only when the range changes, so bumpingzodhits exactly the files importingzod, and editingscriptshits nothing. - Lockfile-only changes (a transitive bump with the same range) are not tracked yet; add the lockfile to
globalsif they matter to you.
Limits
- The base graph reads
node_modulesfrom the working tree’s install, not the base revision’s. - An import whose case differs from the file (
./Fooforfoo.ts) resolves on macOS but is not matched to the changed path. - Bundler-only aliases (Vite/webpack
resolve.alias) are not read; mirror them in tsconfigpaths.
See the roadmap for what is planned.