Skip to content

TsconfigCache

This content is not available in your language yet.

Defined in: core/index.ts:488

Cache of tsconfig autodiscovery walk results (#2367). A NAPI consumer that repeatedly transpiles many files in-process (Vite/Rollup plugin, etc.) creates one instance and reuses it across transpile calls → saves 5–10 fs syscalls per file.

Passed via the cache option of transpile(). When tsconfigPath / tsconfigRaw is specified, the cache is bypassed and the explicit value is used. The instance is cleaned up automatically on GC — explicit dispose is not required.

Aligned with rolldown TsconfigCache (the design is an N-slot HashMap, not a single slot).

const cache = new TsconfigCache();
for (const file of files) {
transpile(source, { filename: file, cache });
}

new TsconfigCache(): TsconfigCache

Defined in: core/index.ts:492

TsconfigCache

get size(): number

Defined in: core/index.ts:502

Current number of cached entries (testing / debugging).

number

[dispose](): void

Defined in: core/index.ts:512

Explicit Resource Management (TC39 Stage 4) — using cache = new TsconfigCache(); automatically calls clear() on scope exit. The memory itself is reclaimed by the GC finalizer, so this method only “empties the cache” (the instance can be reused).

void


clear(): void

Defined in: core/index.ts:497

Reclaims all cache entries and internal string memory. The instance can be reused.

void