warm.ts
This file
Path
apps/web/src/features/code/warm.ts
17 lines · 498 bytes · TypeScript
Last changed by
Merge build/comments-web-features into mainoscabrielbefore adoption74bfc72
History of this fileTake it
123456789101112131415161718import { diffsOptions } from "./pierre.ts";import { workerPool } from "./pool.tsx";
export const warmFile = (file: { readonly path: string; readonly sha: string; readonly text?: string | undefined;}): Promise<void> => "Worker" in globalThis && file.text !== undefined && file.text.length <= diffsOptions.tokenizeMaxLength ? workerPool().primeFileHighlightCache({ cacheKey: file.sha, contents: file.text, name: file.path, }) : Promise.resolve();