Worker client utilities and shared worker helpers for the Streaming Markdown V2 pipeline
npm install @stream-mdx/worker@stream-mdx/workerWorker client utilities and hosted worker bundle used by StreamMDX.
Most consumers interact with this package indirectly via . You only need @stream-mdx/worker directly if you want explicit control over worker instantiation, MDX compilation parity helpers, or strict CSP setups.
``bash`
npm install @stream-mdx/worker
For production, host the worker bundle from static assets (avoids blob: CSP requirements):
`bash`
mkdir -p public/workers
cp node_modules/@stream-mdx/worker/dist/hosted/markdown-worker.js public/workers/markdown-worker.js
Then point StreamMDX at it:
`tsx`
To run the hosted worker bundle in Node (e.g., Ink TUIs), use:
`ts`
import { createWorkerThread } from "@stream-mdx/worker/node";
This spawns a worker_threads worker and installs WebWorker-like shims so the hosted bundle can run under Node.
If you compile MDX on the server (e.g. Next.js API route), use the same compilation logic as the worker:
`ts`
import { compileMdxContent } from "@stream-mdx/worker/mdx-compile";
See docs/REACT_INTEGRATION_GUIDE.md for the full wiring and parity notes.
- React integration guide: docs/REACT_INTEGRATION_GUIDE.mddocs/SECURITY_MODEL.md
- Security model / CSP: docs/STREAMING_MARKDOWN_PLUGINS_COOKBOOK.md`
- Plugins & custom worker bundles: