| 1 | "use client"; |
| 2 | |
| 3 | import { WorkerPoolContextProvider } from "@pierre/diffs/react"; |
| 4 | import type { ReactNode |
| 5 | |
| 6 | const poolOptions = { |
| 7 | poolSize: 4, |
| 8 | workerFactory: () => |
| 9 | new Worker(new |
| 10 | type: "module", |
| 11 | }), |
| 12 | }; |
| 13 | |
| 14 | const highlighterOptions = { |
| 15 | theme: { light: " |
| 16 | } as const; |
| 17 | |
| 18 | /** Highlights diffs off the main thread. Every diff renders inside one, and a page mounts one for all of them. */ |
| 19 | export function DiffsProvider({ |
| 20 | return ( |
| 21 | <WorkerPoolContextProvider |
| 22 | poolOptions={poolOptions} |
| 23 | highlighterOptions={highlighterOptions} |
| 24 | > |
| 25 | {children} |
| 26 | </WorkerPoolContextProvider> |
| 27 | ); |
| 28 | } |