hearth-graph
hearth-graph is a standalone Rust library for tree-sitter symbol extraction,
incremental symbol indexing, import analysis, and module-graph queries. It has
no global engine state and does not require Hearth's cache or transport crates.
Hosts own the language registry, source loading, cancellation, and concurrency
policy.
Capabilities
- injectable
LanguageRegistrywith an optional bundled grammar set - one-pass symbol and import analysis over tree-sitter parse trees
- Vue 3 SFC analysis through JavaScript, TypeScript, JSX, and TSX script injections
- incremental
SymbolIndexsearch and definition lookup - incremental
ModuleGraphdependency, reverse-dependency, and neighborhood queries withExactorApproximateguarantees - JavaScript/TypeScript resolution through
oxc_resolver - best-effort Rust module resolution
- cancellation-aware parallel index construction through a host-provided
SourceLoader
Vue support covers inline JavaScript, TypeScript, JSX, and TSX <script>
blocks. External src scripts and custom non-JavaScript block languages are
not currently modeled.
Quick start
use ;
let registry = bundled;
let mut parsers = new;
let symbols = extract_symbols;
assert!;
The default feature set includes the bundled languages, filesystem loader, and both resolver implementations. A host can disable defaults and inject its own grammar:
use ;
#
Features
| Feature | Enabled by default | Purpose |
|---|---|---|
bundled-languages |
yes | Bundled grammars, symbol queries, import extractors, and Vue 3 SFC script injections |
fs |
yes | FsLoader implementation for direct filesystem indexing |
resolve-js |
yes | JavaScript and TypeScript resolution through oxc_resolver |
resolve-rust |
yes | Best-effort Rust module resolution |
resolve-rust deliberately reports partial completeness. Exact Rust resolution
requires Cargo target metadata and a module declaration tree that can model
cfg, #[path], macros, and inline modules.
Resolver config reads use no-follow opens and opened-handle validation on Unix and Windows. Targets without a secure no-follow primitive fail closed instead of reading resolver configuration through a potentially redirected path.
Versioning and MSRV
The minimum supported Rust version is 1.95. The crate is currently in the
0.2 series; public APIs may evolve between minor releases. Pin an exact
version when integrating a compatibility facade.
The detailed cache adapter, freshness model, and graph guarantees used by the Hearth tools are documented in the Hearth architecture guide.
License
MIT