The cache lived inline in vite.config.ts, and the renderer builder tests use a bare fixture config, so nothing exercised it: a broken warm path would still pass every test. Move it to scripts/compiler-cache.mjs (behaviour unchanged; toolchain files and cache root are now parameters, and an existing closeBundle hook is chained instead of replaced) and test hit vs fresh output, toolchain/NODE_ENV generations, corrupt entries, pruning, incremental (watch) rebuilds and the dev-server bypass. A cold and warm production build of the real app stay byte-identical. Reported by Greptile on #135092.
11 lines
266 B
TypeScript
11 lines
266 B
TypeScript
export function withCompilerCache<P extends { transform: { handler: (...args: any[]) => unknown } }>(
|
|
plugin: P,
|
|
options: {
|
|
command: string
|
|
cacheRoot: string
|
|
base: string
|
|
toolchain: string[]
|
|
env?: Record<string, string | undefined>
|
|
},
|
|
): P
|