interface EsbuildCache

A slot holding esbuild's incremental build context plus the key it was built for. Two lifetimes share this shape: the per-process one on BuildState (watch mode) and the daemon's persistent one, which survives across runs. buildIncrementally takes either — it disposes and recreates the context whenever the key changes.

const cache: EsbuildCache = { context: null };
cache.contextKey = ['a-test.ts', 'b-test.ts'].join('\0');
cache.contextKey === ['a-test.ts'].join('\0'); // false — file set changed, context is stale

Properties

optional
context: BuildContext | null

Live esbuild incremental context, or null/absent before the first build.

optional
contextKey: string

Cache key for context: allTestFilePaths.join('\0'). Invalidated when files change.

Usage

import { type EsbuildCache } from "lib/types.ts";