Skip to main content

Module cache

Module cache 

Source
Expand description

Incremental parse cache with bitcode serialization.

Stores parsed module information (exports, imports, re-exports) on disk so unchanged files can skip AST parsing on subsequent runs. Uses xxh3 content hashing to detect changes.

Structs§

CacheStore
Cached module information stored on disk.
CachedDynamicImport
Cached dynamic import data.
CachedDynamicImportPattern
Cached dynamic import pattern data (template literals, import.meta.glob).
CachedExport
Cached export data for a single export declaration.
CachedImport
Cached import data for a single import declaration.
CachedMember
Cached enum or class member data.
CachedModule
Cached data for a single module.
CachedReExport
Cached re-export data.
CachedRequireCall
Cached require() call data.
CachedSuppression
Cached suppression directive.

Constants§

DEFAULT_CACHE_MAX_SIZE
Default maximum cache size (256 MB). Overridable per-project via cache.maxSizeMb in the config file or FALLOW_CACHE_MAX_SIZE env var. Also used as the hard ceiling on load-time deserialization as a defence against pathological on-disk files.
DUPES_CACHE_VERSION
Duplication token cache version. Bump when duplicate tokenization, normalization, or the on-disk token cache schema changes.

Functions§

cached_to_module
Reconstruct a ModuleInfo from a CachedModule.
cached_to_module_opts
Reconstruct a ModuleInfo from a CachedModule, skipping the per-function complexity vec when need_complexity is false. Avoids the Vec<FunctionComplexity> clone on warm runs of commands (e.g. fallow check) that don’t consume complexity, which adds up across tens of thousands of files.
current_unix_seconds
Seconds-since-Unix-epoch from the wall clock, saturating to 0 if the system clock is set before the epoch. Used as the LRU bookkeeping timestamp on CachedModule.last_access_secs. Wall-clock (not monotonic) is the right source here because the value persists across process invocations.
module_to_cached
Convert a ModuleInfo to a CachedModule for storage.