/** * Runtime-registration extractor (issue #15 — Phases 1, 2, 3). * * Recognises framework registration patterns where a handler is wired into a * dispatch table at module-load time. Static call extraction sees the * registration call/decorator but not the edge from registrar → handler. * * Downstream consumers (e.g. dead-code reachability) read * `ir.runtime_registrations` and add each resolved handler as a virtual entry * root, eliminating "unreachable" false positives for framework handlers. * * Phase 1 — JS/TS Express-family (shipped 3.32.0): * - HTTP routes: `app.METHOD(path?, ...handlers)` for METHOD ∈ HTTP_VERBS * - Middleware: `app.use(...handlers)` * - Event listeners: `emitter.on('event', handler)` on express-shaped receivers * * Phase 2 — Python decorators (3.33.0): * - Every `@decorator` on a function emits a registration with handler = * decorated function. Known frameworks are tagged (flask, fastapi, * django, click, pytest, celery, numba); built-in (property, * staticmethod, etc.) is tagged `stdlib`. Routing-style decorators * (`@app.route`, `@app.get`, `@router.post`) are classified as * `kind: 'http_route'` so downstream consumers can treat JS routes and * Python routes uniformly. * * Phase 3 — Rust trait dispatch (3.34.0): * - `impl Trait for Type { fn method(...) }` emits one `trait_impl` * registration per method, recording the Self type as `receiver`, the * trait path as `path`, and the method as both `registrar.method` and * `handler.name`. Stdlib traits (Display, Debug, Iterator, …) are tagged * `framework: 'stdlib'`; known web/async/serde frameworks (actix, axum, * rocket, tokio, serde) are tagged accordingly. * - `inventory::submit! { … }` and `#[linkme::distributed_slice]` emit * `trait_impl` registrations with framework `'inventory'` / `'linkme'`. * * Out of scope: * - Subapp mounting (`app.use('/api', subApp)`) handler resolution. * - Cross-file trait → impl resolution scoped by `Cargo.toml` reachability * (file-local impls only at extraction time; project-level resolution is * deferred to a later cross-file pass). */ import type { Tree } from 'web-tree-sitter'; import type { RuntimeRegistration, ImportInfo } from '../../types/index.js'; import { type NodeCache } from '../parser.js'; import type { SupportedLanguage } from '../parser.js'; /** * Extract runtime-registration patterns from a parsed file. * * Phase 1 covers JavaScript/TypeScript. Phase 2 adds Python decorators. * Phase 3 adds Rust trait dispatch (`impl Trait for Type`, `inventory::submit!`, * `#[linkme::distributed_slice]`). Returns `[]` for any other language. */ export declare function extractRuntimeRegistrations(tree: Tree, cache: NodeCache | undefined, language: SupportedLanguage | string, imports?: ImportInfo[]): RuntimeRegistration[]; //# sourceMappingURL=runtime-registrations.d.ts.map