mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-12 11:48:42 +00:00
21 lines
674 B
TypeScript
21 lines
674 B
TypeScript
import { getOrCreateWorkerPoolSingleton } from "@pierre/diffs/worker"
|
|
import ShikiWorkerUrl from "@pierre/diffs/worker/worker.js?worker&url"
|
|
|
|
export function workerFactory(): Worker {
|
|
return new Worker(ShikiWorkerUrl, { type: "module" })
|
|
}
|
|
|
|
export const workerPool = getOrCreateWorkerPoolSingleton({
|
|
poolOptions: {
|
|
workerFactory,
|
|
// poolSize defaults to 8. More workers = more parallelism but
|
|
// also more memory. Too many can actually slow things down.
|
|
// poolSize: 8,
|
|
},
|
|
highlighterOptions: {
|
|
theme: "OpenCode",
|
|
// Optionally preload languages to avoid lazy-loading delays
|
|
// langs: ["typescript", "javascript", "css", "html"],
|
|
},
|
|
})
|