@stream-mdx/worker 0.2.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.
- package/README.md +6 -4
- package/dist/direct.cjs +3978 -0
- package/dist/direct.d.cts +50 -0
- package/dist/direct.d.ts +50 -0
- package/dist/direct.mjs +3961 -0
- package/dist/hosted/markdown-worker.js +303 -23
- package/dist/index.cjs +3954 -3
- package/dist/index.d.cts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.mjs +3960 -0
- package/dist/node/index.cjs +383 -4
- package/dist/node/index.d.cts +68 -1
- package/dist/node/index.d.ts +68 -1
- package/dist/node/index.mjs +381 -4
- package/dist/node/worker-thread-entry.cjs +127 -3
- package/dist/node/worker-thread-entry.d.cts +2 -1
- package/dist/node/worker-thread-entry.d.ts +2 -1
- package/dist/node/worker-thread-entry.mjs +106 -3
- package/dist/worker-client-wln-351a.d.cts +84 -0
- package/dist/worker-client-wln-351a.d.ts +84 -0
- package/dist/worker-client.d.cts +2 -81
- package/dist/worker-client.d.ts +2 -81
- package/package.json +8 -3
|
@@ -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 };
|
package/dist/direct.d.ts
ADDED
|
@@ -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 };
|