@stream-mdx/worker 0.0.0 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +19 -0
- package/README.md +22 -40
- package/dist/hosted/markdown-worker.js +23 -16833
- package/dist/index.cjs +0 -1
- package/dist/index.mjs +0 -1
- package/dist/mdx-compile.cjs +81 -0
- package/dist/mdx-compile.d.cts +13 -0
- package/dist/mdx-compile.d.ts +13 -0
- package/dist/mdx-compile.mjs +46 -0
- package/dist/streaming/custom-matcher.cjs +3 -119
- package/dist/streaming/custom-matcher.d.cts +1 -54
- package/dist/streaming/custom-matcher.d.ts +1 -54
- package/dist/streaming/custom-matcher.mjs +1 -114
- package/dist/worker-client.cjs +0 -1
- package/dist/worker-client.d.cts +1 -0
- package/dist/worker-client.d.ts +1 -0
- package/dist/worker-client.mjs +0 -1
- package/package.json +18 -5
- package/dist/hosted/markdown-worker.js.map +0 -1
- package/dist/index.cjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/streaming/custom-matcher.cjs.map +0 -1
- package/dist/streaming/custom-matcher.mjs.map +0 -1
- package/dist/worker-client.cjs.map +0 -1
- package/dist/worker-client.mjs.map +0 -1
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# @stream-mdx/worker
|
|
2
|
+
|
|
3
|
+
## 0.0.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 9e94660: Docs and release-quality improvements: ship package READMEs/CHANGELOGs, add pack+install smoke tests, expose MDX parity helper entrypoints, and add a deployable docs site workflow.
|
|
8
|
+
- Updated dependencies [9e94660]
|
|
9
|
+
- @stream-mdx/core@0.0.2
|
|
10
|
+
- @stream-mdx/plugins@0.0.2
|
|
11
|
+
|
|
12
|
+
## 0.0.1
|
|
13
|
+
|
|
14
|
+
### Patch Changes
|
|
15
|
+
|
|
16
|
+
- Release maintenance: CI/build fixes, missing runtime deps (e.g. `rehype-katex`), and improved docs/README wiring for the `stream-mdx` package page.
|
|
17
|
+
- Updated dependencies
|
|
18
|
+
- @stream-mdx/core@0.0.1
|
|
19
|
+
- @stream-mdx/plugins@0.0.1
|
package/README.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# `@stream-mdx/worker`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
Worker client utilities and hosted worker bundle used by StreamMDX.
|
|
4
|
+
|
|
5
|
+
Most consumers interact with this package indirectly via `<StreamingMarkdown />`. You only need `@stream-mdx/worker` directly if you want explicit control over worker instantiation, MDX compilation parity helpers, or strict CSP setups.
|
|
4
6
|
|
|
5
7
|
## Install
|
|
6
8
|
|
|
@@ -8,53 +10,33 @@ Web Worker entry point for the streaming renderer. Handles markdown parsing (Lez
|
|
|
8
10
|
npm install @stream-mdx/worker
|
|
9
11
|
```
|
|
10
12
|
|
|
11
|
-
##
|
|
12
|
-
|
|
13
|
-
```ts
|
|
14
|
-
import { MarkdownWorkerClient } from "@stream-mdx/worker";
|
|
13
|
+
## Hosted worker bundle (recommended)
|
|
15
14
|
|
|
16
|
-
|
|
17
|
-
// For CSP-restricted environments, host the worker and point to it here:
|
|
18
|
-
workerUrl: "/workers/markdown-worker.js",
|
|
19
|
-
});
|
|
15
|
+
For production, host the worker bundle from static assets (avoids `blob:` CSP requirements):
|
|
20
16
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
});
|
|
26
|
-
|
|
27
|
-
client.init("# Hello");
|
|
17
|
+
```bash
|
|
18
|
+
mkdir -p public/workers
|
|
19
|
+
cp node_modules/@stream-mdx/worker/dist/hosted/markdown-worker.js public/workers/markdown-worker.js
|
|
28
20
|
```
|
|
29
21
|
|
|
30
|
-
|
|
22
|
+
Then point StreamMDX at it:
|
|
31
23
|
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
| Type | Direction | Payload |
|
|
37
|
-
| --- | --- | --- |
|
|
38
|
-
| `INIT` | Main → Worker | `{ text?: string; stream?: boolean; prewarmLangs?: string[]; plugins?: PluginConfig }` |
|
|
39
|
-
| `APPEND` | Main → Worker | `{ chunk: string }` |
|
|
40
|
-
| `FINALIZE` | Main → Worker | Flush + emit remaining patches. |
|
|
41
|
-
| `RESET` | Main → Worker | Clear state (used on restart). |
|
|
42
|
-
| `PATCH` | Worker → Main | `{ tx, at, patches: Patch[], notes }` |
|
|
43
|
-
| `METRICS` | Worker → Main | Parse/highlight timings, block stats. |
|
|
44
|
-
| `INITIALIZED`, `ERROR`, `DEBUG` | Worker → Main | Lifecycle events. |
|
|
24
|
+
```tsx
|
|
25
|
+
<StreamingMarkdown worker="/workers/markdown-worker.js" />
|
|
26
|
+
```
|
|
45
27
|
|
|
46
|
-
|
|
28
|
+
## MDX compilation parity helper
|
|
47
29
|
|
|
48
|
-
|
|
30
|
+
If you compile MDX on the server (e.g. Next.js API route), use the same compilation logic as the worker:
|
|
49
31
|
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
32
|
+
```ts
|
|
33
|
+
import { compileMdxContent } from "@stream-mdx/worker/mdx-compile";
|
|
34
|
+
```
|
|
53
35
|
|
|
54
|
-
|
|
36
|
+
See `docs/REACT_INTEGRATION_GUIDE.md` for the full wiring and parity notes.
|
|
55
37
|
|
|
56
|
-
##
|
|
38
|
+
## Docs
|
|
57
39
|
|
|
58
|
-
-
|
|
59
|
-
-
|
|
60
|
-
-
|
|
40
|
+
- React integration guide: `docs/REACT_INTEGRATION_GUIDE.md`
|
|
41
|
+
- Security model / CSP: `docs/SECURITY_MODEL.md`
|
|
42
|
+
- Plugins & custom worker bundles: `docs/STREAMING_MARKDOWN_PLUGINS_COOKBOOK.md`
|