/** * @fileoverview `LanguageParseCache` class definition. * * Lives in its own module so `RunScope` (which holds a default * `LanguageParseCache` instance) and the module-level helpers in * `parse-cache.ts` (which read `currentScope()`) don't form an * import cycle. The class has zero deps on `run-scope.ts`; the helpers * import the class from here, and `run-scope.ts` also imports the * class from here. */ import type { LanguageAdapter } from './adapter.js'; /** * Fast content fingerprint for the parse-cache key (FNV-1a 32-bit over the FULL * content + length). Distinguishes raw source from same-length filtered variants * (`filterContent` blanks string/comment regions to spaces, preserving length), * so an AST check that needs raw source never receives a strings-stripped tree. * O(n) but far cheaper than the parse it gates; the trailing length guards * against the (astronomically unlikely) per-file hash collision across the * handful of content variants seen for one path. */ export declare function fingerprintContent(content: string): string; /** * Per-instance parse cache. Each instance owns its own parse-tree * `Map`, a sibling `filteredContent` `Map` (for language-specific * filtered-content caching keyed by raw content), and (optionally) an * auto-clear timer that fires `AUTO_CLEAR_MS` after the cache is * started. * * The two maps live together because they share the same lifecycle — * a fresh run starts both at empty, a `dispose()` clears both, and the * auto-clear timer drops both. The maps use different keys (parse-tree * map is keyed by adapter+filePath+fingerprint; filtered-content map * is keyed by raw content) because the two upstream call paths use * different identities. */ export declare class LanguageParseCache { private readonly cache; /** * Language-specific filtered-content cache. Keyed by raw content * string (no adapter or file path prefix) because the * `filterContent(content)` API in `@opensip-tools/lang-typescript` * is content-only. Phase 6 Task 6.4 moved this off a separate * module-level Map; the merge is by lifecycle, not by key shape. */ readonly filteredContent: Map; private autoClearTimer; /** * Start the auto-clear timer. Calling this twice resets the timer. * Production code goes through `initParseCache()` (which targets the * module-level instance); tests call this directly on a fresh * instance. The timer is `unref`'d so it doesn't keep the process * alive; `dispose()` clears it deterministically. */ startAutoClear(): void; getOrParse(adapter: LanguageAdapter, filePath: string, content: string): TTree | null; clear(): void; /** * Clear the cache and any pending auto-clear timer. Tests that * construct a fresh `LanguageParseCache()` should call `dispose()` * before the test exits so the runner doesn't see a lingering * timer handle. */ dispose(): void; get size(): number; } //# sourceMappingURL=parse-cache-class.d.ts.map