Skip to content
Myr

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 file

Take it

Merge build/1211-code-browseroscabrielbefore adoptiona6808d3

lines 1–17why, one step back
1import { diffsOptions } from "./pierre.ts";
2import { workerPool } from "./pool.tsx";34export const warmFile = (file: {5 readonly path: string;6 readonly sha: string;7 readonly text?: string | undefined;8}): Promise<void> =>9 "Worker" in globalThis &&10 file.text !== undefined &&11 file.text.length <= diffsOptions.tokenizeMaxLength12 ? workerPool().primeFileHighlightCache({13 cacheKey: file.sha,14 contents: file.text,15 name: file.path,16 })17 : Promise.resolve();