extract_file_cached.ts

Cache-aware single-file class extraction shared by the Gro generator and the Vite plugin. Returns extraction sourced from cache when the content hash matches, else freshly parsed, plus the cache path to write on a miss.

Callers own everything around this — in-memory hash short-circuits, the Vite deletion-race guard, diagnostic logging, stats counting, and how/when to write the cache (fire-and-forget vs. batched).

Declarations
#

3 declarations

view source

extract_file_cached
#

extract_file_cached.ts view source

(options: ExtractFileCachedOptions): Promise<ExtractFileCachedResult>

Loads the cached extraction when its content hash matches, otherwise extracts fresh. On a miss with caching enabled, cache_path_to_write carries the path the caller should write.

options

returns

Promise<ExtractFileCachedResult>

ExtractFileCachedOptions
#

extract_file_cached.ts view source

ExtractFileCachedOptions

deps

type CacheDeps

content

Source file contents.

type string

content_hash

Content hash to validate the cache against.

type string

cache_path

Cache file path, or null to skip the cache (CI or caching disabled).

type string | null

filename

File path, for parser selection and diagnostic locations.

type string

acorn_plugins

type Array<AcornPlugin>

ExtractFileCachedResult
#

extract_file_cached.ts view source

ExtractFileCachedResult

extraction

type ExtractionData

from_cache

Whether the extraction came from cache.

type boolean

cache_path_to_write

Cache file to write (miss with caching enabled), or null.

type string | null

Depends on
#

Imported by
#