@mui/internal-docs-infra
Version:
MUI Infra - internal documentation creation tools.
19 lines • 937 B
text/typescript
/**
* Worker entry point for off-main-thread syntax highlighting.
*
* Lifecycle:
* 1. Main thread posts `{ type: 'init', grammars }` once. The worker calls
* `createStarryNight(grammars)` and primes the singleton used by
* `parseSource`. Posts `{ type: 'init-ack' }` when ready.
* 2. For each parse request, main thread posts
* `{ type: 'parse', id, source, fileName, language? }`. The worker runs
* the same sync `parseSource` body that the main thread uses (so the HAST
* output is byte-identical) and posts `{ type: 'parse', id, ok, hast? , error? }`.
*
* Parse requests that arrive before init completes are queued and drained on
* `init-ack`. The worker does not import `./grammars` statically — the heavy
* grammar JSON payload travels across the boundary exactly once via the init
* message so that the (lazy) main-thread grammar chunk is the single shared
* source of truth.
*/
export {};