@stream-mdx/worker 0.3.0 → 0.4.0

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.
@@ -0,0 +1,50 @@
1
+ import { Block, TocHeading, WorkerIn, DocumentSnapshot } from '@stream-mdx/core';
2
+
3
+ type WorkerInitMessage = Extract<WorkerIn, {
4
+ type: "INIT";
5
+ }>;
6
+ interface SnapshotArtifactV1 {
7
+ version: 1;
8
+ schemaId: "streammdx.snapshot.v1";
9
+ createdAt: string;
10
+ hash: string;
11
+ contentHash: string;
12
+ configHash: string;
13
+ hashSalt?: string;
14
+ blocks: Block[];
15
+ tocHeadings?: TocHeading[];
16
+ init?: {
17
+ docPlugins?: WorkerInitMessage["docPlugins"];
18
+ mdx?: WorkerInitMessage["mdx"];
19
+ prewarmLangs?: string[];
20
+ };
21
+ }
22
+ interface CompileMarkdownSnapshotDirectOptions {
23
+ text: string;
24
+ init?: Omit<WorkerInitMessage, "type" | "initialContent">;
25
+ hashSalt?: string;
26
+ cache?: {
27
+ dir: string;
28
+ key?: string;
29
+ readOnly?: boolean;
30
+ };
31
+ timeoutMs?: number;
32
+ settleMs?: number;
33
+ finalize?: boolean;
34
+ }
35
+ interface CompileMarkdownSnapshotDirectResult {
36
+ blocks: Block[];
37
+ snapshot: DocumentSnapshot;
38
+ artifact: SnapshotArtifactV1;
39
+ fromCache: boolean;
40
+ }
41
+ /**
42
+ * Compiles markdown in-process without spawning `worker_threads`.
43
+ *
44
+ * This runtime is useful when a platform cannot host workers (for example edge
45
+ * functions that disallow `worker_threads`) but still needs deterministic
46
+ * `Block[]` snapshots from the canonical worker pipeline.
47
+ */
48
+ declare function compileMarkdownSnapshotDirect(options: CompileMarkdownSnapshotDirectOptions): Promise<CompileMarkdownSnapshotDirectResult>;
49
+
50
+ export { type CompileMarkdownSnapshotDirectOptions, type CompileMarkdownSnapshotDirectResult, type SnapshotArtifactV1, compileMarkdownSnapshotDirect };
@@ -0,0 +1,50 @@
1
+ import { Block, TocHeading, WorkerIn, DocumentSnapshot } from '@stream-mdx/core';
2
+
3
+ type WorkerInitMessage = Extract<WorkerIn, {
4
+ type: "INIT";
5
+ }>;
6
+ interface SnapshotArtifactV1 {
7
+ version: 1;
8
+ schemaId: "streammdx.snapshot.v1";
9
+ createdAt: string;
10
+ hash: string;
11
+ contentHash: string;
12
+ configHash: string;
13
+ hashSalt?: string;
14
+ blocks: Block[];
15
+ tocHeadings?: TocHeading[];
16
+ init?: {
17
+ docPlugins?: WorkerInitMessage["docPlugins"];
18
+ mdx?: WorkerInitMessage["mdx"];
19
+ prewarmLangs?: string[];
20
+ };
21
+ }
22
+ interface CompileMarkdownSnapshotDirectOptions {
23
+ text: string;
24
+ init?: Omit<WorkerInitMessage, "type" | "initialContent">;
25
+ hashSalt?: string;
26
+ cache?: {
27
+ dir: string;
28
+ key?: string;
29
+ readOnly?: boolean;
30
+ };
31
+ timeoutMs?: number;
32
+ settleMs?: number;
33
+ finalize?: boolean;
34
+ }
35
+ interface CompileMarkdownSnapshotDirectResult {
36
+ blocks: Block[];
37
+ snapshot: DocumentSnapshot;
38
+ artifact: SnapshotArtifactV1;
39
+ fromCache: boolean;
40
+ }
41
+ /**
42
+ * Compiles markdown in-process without spawning `worker_threads`.
43
+ *
44
+ * This runtime is useful when a platform cannot host workers (for example edge
45
+ * functions that disallow `worker_threads`) but still needs deterministic
46
+ * `Block[]` snapshots from the canonical worker pipeline.
47
+ */
48
+ declare function compileMarkdownSnapshotDirect(options: CompileMarkdownSnapshotDirectOptions): Promise<CompileMarkdownSnapshotDirectResult>;
49
+
50
+ export { type CompileMarkdownSnapshotDirectOptions, type CompileMarkdownSnapshotDirectResult, type SnapshotArtifactV1, compileMarkdownSnapshotDirect };