@quillmark/wasm 0.13.2 → 0.15.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/{wasm.d.ts → bundler/wasm.d.ts} +57 -47
- package/{wasm_bg.js → bundler/wasm_bg.js} +103 -75
- package/{wasm_bg.wasm → bundler/wasm_bg.wasm} +0 -0
- package/{wasm_bg.wasm.d.ts → bundler/wasm_bg.wasm.d.ts} +13 -12
- package/node-esm/wasm.d.ts +125 -0
- package/node-esm/wasm.js +17 -0
- package/node-esm/wasm_bg.wasm +0 -0
- package/package.json +17 -13
- /package/{wasm.js → bundler/wasm.js} +0 -0
|
@@ -4,16 +4,7 @@
|
|
|
4
4
|
* Initialize the WASM module with panic hooks for better error messages
|
|
5
5
|
*/
|
|
6
6
|
export function init(): void;
|
|
7
|
-
export
|
|
8
|
-
name: string;
|
|
9
|
-
backend: string;
|
|
10
|
-
metadata: Record<string, any>;
|
|
11
|
-
example?: string;
|
|
12
|
-
schema: Record<string, any>;
|
|
13
|
-
defaults: Record<string, any>;
|
|
14
|
-
examples: Record<string, any[]>;
|
|
15
|
-
supportedFormats: OutputFormat[];
|
|
16
|
-
}
|
|
7
|
+
export type OutputFormat = "pdf" | "svg" | "txt";
|
|
17
8
|
|
|
18
9
|
export type Severity = "error" | "warning" | "note";
|
|
19
10
|
|
|
@@ -23,15 +14,13 @@ export interface Location {
|
|
|
23
14
|
column: number;
|
|
24
15
|
}
|
|
25
16
|
|
|
26
|
-
export interface
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
assets?: Record<string, Uint8Array | number[]>;
|
|
34
|
-
quillName?: string;
|
|
17
|
+
export interface Diagnostic {
|
|
18
|
+
severity: Severity;
|
|
19
|
+
code?: string;
|
|
20
|
+
message: string;
|
|
21
|
+
location?: Location;
|
|
22
|
+
hint?: string;
|
|
23
|
+
sourceChain: string[];
|
|
35
24
|
}
|
|
36
25
|
|
|
37
26
|
export interface Artifact {
|
|
@@ -40,8 +29,6 @@ export interface Artifact {
|
|
|
40
29
|
mimeType: string;
|
|
41
30
|
}
|
|
42
31
|
|
|
43
|
-
export type OutputFormat = "pdf" | "svg" | "txt";
|
|
44
|
-
|
|
45
32
|
export interface RenderResult {
|
|
46
33
|
artifacts: Artifact[];
|
|
47
34
|
warnings: Diagnostic[];
|
|
@@ -49,13 +36,26 @@ export interface RenderResult {
|
|
|
49
36
|
renderTimeMs: number;
|
|
50
37
|
}
|
|
51
38
|
|
|
52
|
-
export interface
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
39
|
+
export interface QuillInfo {
|
|
40
|
+
name: string;
|
|
41
|
+
backend: string;
|
|
42
|
+
metadata: Record<string, any>;
|
|
43
|
+
example?: string;
|
|
44
|
+
schema: Record<string, any>;
|
|
45
|
+
defaults: Record<string, any>;
|
|
46
|
+
examples: Record<string, any[]>;
|
|
47
|
+
supportedFormats: OutputFormat[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ParsedDocument {
|
|
51
|
+
fields: Record<string, any>;
|
|
52
|
+
quillTag: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface RenderOptions {
|
|
56
|
+
format?: OutputFormat;
|
|
57
|
+
assets?: Record<string, Uint8Array | number[]>;
|
|
58
|
+
quillName?: string;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
61
|
/**
|
|
@@ -67,22 +67,9 @@ export class Quillmark {
|
|
|
67
67
|
free(): void;
|
|
68
68
|
[Symbol.dispose](): void;
|
|
69
69
|
/**
|
|
70
|
-
*
|
|
71
|
-
*/
|
|
72
|
-
listQuills(): string[];
|
|
73
|
-
/**
|
|
74
|
-
* Process markdown through template engine (debugging)
|
|
75
|
-
*
|
|
76
|
-
* Returns template source code (Typst, LaTeX, etc.)
|
|
77
|
-
*/
|
|
78
|
-
processPlate(quill_name: string, markdown: string): string;
|
|
79
|
-
/**
|
|
80
|
-
* Get shallow information about a registered Quill
|
|
81
|
-
*
|
|
82
|
-
* This returns metadata, backend info, field schemas, and supported formats
|
|
83
|
-
* that consumers need to configure render options for the next step.
|
|
70
|
+
* JavaScript constructor: `new Quillmark()`
|
|
84
71
|
*/
|
|
85
|
-
|
|
72
|
+
constructor();
|
|
86
73
|
/**
|
|
87
74
|
* Parse markdown into a ParsedDocument
|
|
88
75
|
*
|
|
@@ -98,13 +85,28 @@ export class Quillmark {
|
|
|
98
85
|
*/
|
|
99
86
|
registerQuill(quill_json: any): QuillInfo;
|
|
100
87
|
/**
|
|
101
|
-
*
|
|
88
|
+
* Get shallow information about a registered Quill
|
|
89
|
+
*
|
|
90
|
+
* This returns metadata, backend info, field schemas, and supported formats
|
|
91
|
+
* that consumers need to configure render options for the next step.
|
|
102
92
|
*/
|
|
103
|
-
|
|
93
|
+
getQuillInfo(name: string): QuillInfo;
|
|
104
94
|
/**
|
|
105
|
-
*
|
|
95
|
+
* Process markdown through template engine (debugging)
|
|
96
|
+
*
|
|
97
|
+
* Returns template source code (Typst, LaTeX, etc.)
|
|
106
98
|
*/
|
|
107
|
-
|
|
99
|
+
processPlate(quill_name: string, markdown: string): string;
|
|
100
|
+
/**
|
|
101
|
+
* Perform a dry run validation without backend compilation.
|
|
102
|
+
*
|
|
103
|
+
* Executes parsing, schema validation, and template composition to
|
|
104
|
+
* surface input errors quickly. Returns successfully on valid input,
|
|
105
|
+
* or throws an error with diagnostic payload on failure.
|
|
106
|
+
*
|
|
107
|
+
* This is useful for fast feedback loops in LLM-driven document generation.
|
|
108
|
+
*/
|
|
109
|
+
dryRun(quill_name: string, markdown: string): void;
|
|
108
110
|
/**
|
|
109
111
|
* Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
|
|
110
112
|
*
|
|
@@ -112,4 +114,12 @@ export class Quillmark {
|
|
|
112
114
|
* otherwise infers it from the ParsedDocument's quill_tag field.
|
|
113
115
|
*/
|
|
114
116
|
render(parsed_wasm: ParsedDocument, opts: RenderOptions): RenderResult;
|
|
117
|
+
/**
|
|
118
|
+
* List registered Quill names
|
|
119
|
+
*/
|
|
120
|
+
listQuills(): string[];
|
|
121
|
+
/**
|
|
122
|
+
* Unregister a Quill (free memory)
|
|
123
|
+
*/
|
|
124
|
+
unregisterQuill(name: string): void;
|
|
115
125
|
}
|
|
@@ -207,12 +207,6 @@ function debugString(val) {
|
|
|
207
207
|
// TODO we could test for more things here, like `Set`s and `Map`s.
|
|
208
208
|
return className;
|
|
209
209
|
}
|
|
210
|
-
/**
|
|
211
|
-
* Initialize the WASM module with panic hooks for better error messages
|
|
212
|
-
*/
|
|
213
|
-
export function init() {
|
|
214
|
-
wasm.init();
|
|
215
|
-
}
|
|
216
210
|
|
|
217
211
|
function getArrayJsValueFromWasm0(ptr, len) {
|
|
218
212
|
ptr = ptr >>> 0;
|
|
@@ -223,6 +217,12 @@ function getArrayJsValueFromWasm0(ptr, len) {
|
|
|
223
217
|
}
|
|
224
218
|
return result;
|
|
225
219
|
}
|
|
220
|
+
/**
|
|
221
|
+
* Initialize the WASM module with panic hooks for better error messages
|
|
222
|
+
*/
|
|
223
|
+
export function init() {
|
|
224
|
+
wasm.init();
|
|
225
|
+
}
|
|
226
226
|
|
|
227
227
|
const QuillmarkFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
228
228
|
? { register: () => {}, unregister: () => {} }
|
|
@@ -246,56 +246,60 @@ export class Quillmark {
|
|
|
246
246
|
wasm.__wbg_quillmark_free(ptr, 0);
|
|
247
247
|
}
|
|
248
248
|
/**
|
|
249
|
-
*
|
|
250
|
-
* @returns {string[]}
|
|
249
|
+
* JavaScript constructor: `new Quillmark()`
|
|
251
250
|
*/
|
|
252
|
-
|
|
251
|
+
constructor() {
|
|
252
|
+
const ret = wasm.quillmark_new();
|
|
253
|
+
this.__wbg_ptr = ret >>> 0;
|
|
254
|
+
QuillmarkFinalization.register(this, this.__wbg_ptr, this);
|
|
255
|
+
return this;
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* Parse markdown into a ParsedDocument
|
|
259
|
+
*
|
|
260
|
+
* This is the first step in the workflow. The returned ParsedDocument contains
|
|
261
|
+
* the parsed YAML frontmatter fields and the quill_tag (from QUILL field or "__default__").
|
|
262
|
+
* @param {string} markdown
|
|
263
|
+
* @returns {ParsedDocument}
|
|
264
|
+
*/
|
|
265
|
+
static parseMarkdown(markdown) {
|
|
253
266
|
try {
|
|
254
267
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
255
|
-
wasm.
|
|
268
|
+
const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
269
|
+
const len0 = WASM_VECTOR_LEN;
|
|
270
|
+
wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
|
|
256
271
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
257
272
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
258
|
-
var
|
|
259
|
-
|
|
260
|
-
|
|
273
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
274
|
+
if (r2) {
|
|
275
|
+
throw takeObject(r1);
|
|
276
|
+
}
|
|
277
|
+
return takeObject(r0);
|
|
261
278
|
} finally {
|
|
262
279
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
263
280
|
}
|
|
264
281
|
}
|
|
265
282
|
/**
|
|
266
|
-
*
|
|
283
|
+
* Register a Quill template bundle
|
|
267
284
|
*
|
|
268
|
-
*
|
|
269
|
-
*
|
|
270
|
-
* @param {
|
|
271
|
-
* @returns {
|
|
285
|
+
* Accepts either a JSON string or a JsValue object representing the Quill file tree.
|
|
286
|
+
* Validation happens automatically on registration.
|
|
287
|
+
* @param {any} quill_json
|
|
288
|
+
* @returns {QuillInfo}
|
|
272
289
|
*/
|
|
273
|
-
|
|
274
|
-
let deferred4_0;
|
|
275
|
-
let deferred4_1;
|
|
290
|
+
registerQuill(quill_json) {
|
|
276
291
|
try {
|
|
277
292
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
278
|
-
|
|
279
|
-
const len0 = WASM_VECTOR_LEN;
|
|
280
|
-
const ptr1 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
281
|
-
const len1 = WASM_VECTOR_LEN;
|
|
282
|
-
wasm.quillmark_processPlate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
293
|
+
wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
|
|
283
294
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
284
295
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
285
296
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
var len3 = r1;
|
|
289
|
-
if (r3) {
|
|
290
|
-
ptr3 = 0; len3 = 0;
|
|
291
|
-
throw takeObject(r2);
|
|
297
|
+
if (r2) {
|
|
298
|
+
throw takeObject(r1);
|
|
292
299
|
}
|
|
293
|
-
|
|
294
|
-
deferred4_1 = len3;
|
|
295
|
-
return getStringFromWasm0(ptr3, len3);
|
|
300
|
+
return takeObject(r0);
|
|
296
301
|
} finally {
|
|
297
302
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
298
|
-
wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
|
|
299
303
|
}
|
|
300
304
|
}
|
|
301
305
|
/**
|
|
@@ -324,71 +328,69 @@ export class Quillmark {
|
|
|
324
328
|
}
|
|
325
329
|
}
|
|
326
330
|
/**
|
|
327
|
-
*
|
|
331
|
+
* Process markdown through template engine (debugging)
|
|
328
332
|
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
333
|
+
* Returns template source code (Typst, LaTeX, etc.)
|
|
334
|
+
* @param {string} quill_name
|
|
331
335
|
* @param {string} markdown
|
|
332
|
-
* @returns {
|
|
336
|
+
* @returns {string}
|
|
333
337
|
*/
|
|
334
|
-
|
|
338
|
+
processPlate(quill_name, markdown) {
|
|
339
|
+
let deferred4_0;
|
|
340
|
+
let deferred4_1;
|
|
335
341
|
try {
|
|
336
342
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
337
|
-
const ptr0 = passStringToWasm0(
|
|
343
|
+
const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
338
344
|
const len0 = WASM_VECTOR_LEN;
|
|
339
|
-
|
|
345
|
+
const ptr1 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
346
|
+
const len1 = WASM_VECTOR_LEN;
|
|
347
|
+
wasm.quillmark_processPlate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
340
348
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
341
349
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
342
350
|
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
343
|
-
|
|
344
|
-
|
|
351
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
352
|
+
var ptr3 = r0;
|
|
353
|
+
var len3 = r1;
|
|
354
|
+
if (r3) {
|
|
355
|
+
ptr3 = 0; len3 = 0;
|
|
356
|
+
throw takeObject(r2);
|
|
345
357
|
}
|
|
346
|
-
|
|
358
|
+
deferred4_0 = ptr3;
|
|
359
|
+
deferred4_1 = len3;
|
|
360
|
+
return getStringFromWasm0(ptr3, len3);
|
|
347
361
|
} finally {
|
|
348
362
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
363
|
+
wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
|
|
349
364
|
}
|
|
350
365
|
}
|
|
351
366
|
/**
|
|
352
|
-
*
|
|
367
|
+
* Perform a dry run validation without backend compilation.
|
|
353
368
|
*
|
|
354
|
-
*
|
|
355
|
-
*
|
|
356
|
-
*
|
|
357
|
-
*
|
|
369
|
+
* Executes parsing, schema validation, and template composition to
|
|
370
|
+
* surface input errors quickly. Returns successfully on valid input,
|
|
371
|
+
* or throws an error with diagnostic payload on failure.
|
|
372
|
+
*
|
|
373
|
+
* This is useful for fast feedback loops in LLM-driven document generation.
|
|
374
|
+
* @param {string} quill_name
|
|
375
|
+
* @param {string} markdown
|
|
358
376
|
*/
|
|
359
|
-
|
|
377
|
+
dryRun(quill_name, markdown) {
|
|
360
378
|
try {
|
|
361
379
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
362
|
-
|
|
380
|
+
const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
381
|
+
const len0 = WASM_VECTOR_LEN;
|
|
382
|
+
const ptr1 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
383
|
+
const len1 = WASM_VECTOR_LEN;
|
|
384
|
+
wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
|
|
363
385
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
364
386
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
throw takeObject(r1);
|
|
387
|
+
if (r1) {
|
|
388
|
+
throw takeObject(r0);
|
|
368
389
|
}
|
|
369
|
-
return takeObject(r0);
|
|
370
390
|
} finally {
|
|
371
391
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
372
392
|
}
|
|
373
393
|
}
|
|
374
|
-
/**
|
|
375
|
-
* Unregister a Quill (free memory)
|
|
376
|
-
* @param {string} name
|
|
377
|
-
*/
|
|
378
|
-
unregisterQuill(name) {
|
|
379
|
-
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
380
|
-
const len0 = WASM_VECTOR_LEN;
|
|
381
|
-
wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
|
|
382
|
-
}
|
|
383
|
-
/**
|
|
384
|
-
* JavaScript constructor: `new Quillmark()`
|
|
385
|
-
*/
|
|
386
|
-
constructor() {
|
|
387
|
-
const ret = wasm.quillmark_new();
|
|
388
|
-
this.__wbg_ptr = ret >>> 0;
|
|
389
|
-
QuillmarkFinalization.register(this, this.__wbg_ptr, this);
|
|
390
|
-
return this;
|
|
391
|
-
}
|
|
392
394
|
/**
|
|
393
395
|
* Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
|
|
394
396
|
*
|
|
@@ -413,6 +415,32 @@ export class Quillmark {
|
|
|
413
415
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
414
416
|
}
|
|
415
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* List registered Quill names
|
|
420
|
+
* @returns {string[]}
|
|
421
|
+
*/
|
|
422
|
+
listQuills() {
|
|
423
|
+
try {
|
|
424
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
425
|
+
wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
|
|
426
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
427
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
428
|
+
var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
|
|
429
|
+
wasm.__wbindgen_export_3(r0, r1 * 4, 4);
|
|
430
|
+
return v1;
|
|
431
|
+
} finally {
|
|
432
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
433
|
+
}
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* Unregister a Quill (free memory)
|
|
437
|
+
* @param {string} name
|
|
438
|
+
*/
|
|
439
|
+
unregisterQuill(name) {
|
|
440
|
+
const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
441
|
+
const len0 = WASM_VECTOR_LEN;
|
|
442
|
+
wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
|
|
443
|
+
}
|
|
416
444
|
}
|
|
417
445
|
if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
|
|
418
446
|
|
|
Binary file
|
|
@@ -2,28 +2,29 @@
|
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
4
|
export const __wbg_quillmark_free: (a: number, b: number) => void;
|
|
5
|
-
export const init: () => void;
|
|
6
|
-
export const quillmark_getQuillInfo: (a: number, b: number, c: number, d: number) => void;
|
|
7
|
-
export const quillmark_listQuills: (a: number, b: number) => void;
|
|
8
5
|
export const quillmark_new: () => number;
|
|
9
6
|
export const quillmark_parseMarkdown: (a: number, b: number, c: number) => void;
|
|
10
|
-
export const quillmark_processPlate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
11
7
|
export const quillmark_registerQuill: (a: number, b: number, c: number) => void;
|
|
8
|
+
export const quillmark_getQuillInfo: (a: number, b: number, c: number, d: number) => void;
|
|
9
|
+
export const quillmark_processPlate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
10
|
+
export const quillmark_dryRun: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
12
11
|
export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
|
|
12
|
+
export const quillmark_listQuills: (a: number, b: number) => void;
|
|
13
13
|
export const quillmark_unregisterQuill: (a: number, b: number, c: number) => void;
|
|
14
|
-
export const
|
|
15
|
-
export const
|
|
14
|
+
export const init: () => void;
|
|
15
|
+
export const qcms_profile_is_bogus: (a: number) => number;
|
|
16
16
|
export const qcms_white_point_sRGB: (a: number) => void;
|
|
17
|
-
export const
|
|
18
|
-
export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
|
|
19
|
-
export const qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
|
|
17
|
+
export const qcms_profile_precache_output_transform: (a: number) => void;
|
|
20
18
|
export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
|
|
21
19
|
export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
|
|
22
20
|
export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
|
|
23
|
-
export const
|
|
24
|
-
export const
|
|
25
|
-
export const
|
|
21
|
+
export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
|
|
22
|
+
export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
|
|
23
|
+
export const qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
|
|
26
24
|
export const qcms_transform_release: (a: number) => void;
|
|
25
|
+
export const qcms_enable_iccv4: () => void;
|
|
26
|
+
export const lut_interp_linear16: (a: number, b: number, c: number) => number;
|
|
27
|
+
export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
|
|
27
28
|
export const __wbindgen_export_0: (a: number, b: number) => number;
|
|
28
29
|
export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
|
|
29
30
|
export const __wbindgen_export_2: (a: number) => void;
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Initialize the WASM module with panic hooks for better error messages
|
|
5
|
+
*/
|
|
6
|
+
export function init(): void;
|
|
7
|
+
export type OutputFormat = "pdf" | "svg" | "txt";
|
|
8
|
+
|
|
9
|
+
export type Severity = "error" | "warning" | "note";
|
|
10
|
+
|
|
11
|
+
export interface Location {
|
|
12
|
+
file: string;
|
|
13
|
+
line: number;
|
|
14
|
+
column: number;
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
export interface Diagnostic {
|
|
18
|
+
severity: Severity;
|
|
19
|
+
code?: string;
|
|
20
|
+
message: string;
|
|
21
|
+
location?: Location;
|
|
22
|
+
hint?: string;
|
|
23
|
+
sourceChain: string[];
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
export interface Artifact {
|
|
27
|
+
format: OutputFormat;
|
|
28
|
+
bytes: Uint8Array;
|
|
29
|
+
mimeType: string;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export interface RenderResult {
|
|
33
|
+
artifacts: Artifact[];
|
|
34
|
+
warnings: Diagnostic[];
|
|
35
|
+
outputFormat: OutputFormat;
|
|
36
|
+
renderTimeMs: number;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
export interface QuillInfo {
|
|
40
|
+
name: string;
|
|
41
|
+
backend: string;
|
|
42
|
+
metadata: Record<string, any>;
|
|
43
|
+
example?: string;
|
|
44
|
+
schema: Record<string, any>;
|
|
45
|
+
defaults: Record<string, any>;
|
|
46
|
+
examples: Record<string, any[]>;
|
|
47
|
+
supportedFormats: OutputFormat[];
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
export interface ParsedDocument {
|
|
51
|
+
fields: Record<string, any>;
|
|
52
|
+
quillTag: string;
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export interface RenderOptions {
|
|
56
|
+
format?: OutputFormat;
|
|
57
|
+
assets?: Record<string, Uint8Array | number[]>;
|
|
58
|
+
quillName?: string;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Quillmark WASM Engine
|
|
63
|
+
*
|
|
64
|
+
* Create once, register Quills, render markdown. That's it.
|
|
65
|
+
*/
|
|
66
|
+
export class Quillmark {
|
|
67
|
+
free(): void;
|
|
68
|
+
[Symbol.dispose](): void;
|
|
69
|
+
/**
|
|
70
|
+
* JavaScript constructor: `new Quillmark()`
|
|
71
|
+
*/
|
|
72
|
+
constructor();
|
|
73
|
+
/**
|
|
74
|
+
* Parse markdown into a ParsedDocument
|
|
75
|
+
*
|
|
76
|
+
* This is the first step in the workflow. The returned ParsedDocument contains
|
|
77
|
+
* the parsed YAML frontmatter fields and the quill_tag (from QUILL field or "__default__").
|
|
78
|
+
*/
|
|
79
|
+
static parseMarkdown(markdown: string): ParsedDocument;
|
|
80
|
+
/**
|
|
81
|
+
* Register a Quill template bundle
|
|
82
|
+
*
|
|
83
|
+
* Accepts either a JSON string or a JsValue object representing the Quill file tree.
|
|
84
|
+
* Validation happens automatically on registration.
|
|
85
|
+
*/
|
|
86
|
+
registerQuill(quill_json: any): QuillInfo;
|
|
87
|
+
/**
|
|
88
|
+
* Get shallow information about a registered Quill
|
|
89
|
+
*
|
|
90
|
+
* This returns metadata, backend info, field schemas, and supported formats
|
|
91
|
+
* that consumers need to configure render options for the next step.
|
|
92
|
+
*/
|
|
93
|
+
getQuillInfo(name: string): QuillInfo;
|
|
94
|
+
/**
|
|
95
|
+
* Process markdown through template engine (debugging)
|
|
96
|
+
*
|
|
97
|
+
* Returns template source code (Typst, LaTeX, etc.)
|
|
98
|
+
*/
|
|
99
|
+
processPlate(quill_name: string, markdown: string): string;
|
|
100
|
+
/**
|
|
101
|
+
* Perform a dry run validation without backend compilation.
|
|
102
|
+
*
|
|
103
|
+
* Executes parsing, schema validation, and template composition to
|
|
104
|
+
* surface input errors quickly. Returns successfully on valid input,
|
|
105
|
+
* or throws an error with diagnostic payload on failure.
|
|
106
|
+
*
|
|
107
|
+
* This is useful for fast feedback loops in LLM-driven document generation.
|
|
108
|
+
*/
|
|
109
|
+
dryRun(quill_name: string, markdown: string): void;
|
|
110
|
+
/**
|
|
111
|
+
* Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
|
|
112
|
+
*
|
|
113
|
+
* Uses the Quill specified in options.quill_name if provided,
|
|
114
|
+
* otherwise infers it from the ParsedDocument's quill_tag field.
|
|
115
|
+
*/
|
|
116
|
+
render(parsed_wasm: ParsedDocument, opts: RenderOptions): RenderResult;
|
|
117
|
+
/**
|
|
118
|
+
* List registered Quill names
|
|
119
|
+
*/
|
|
120
|
+
listQuills(): string[];
|
|
121
|
+
/**
|
|
122
|
+
* Unregister a Quill (free memory)
|
|
123
|
+
*/
|
|
124
|
+
unregisterQuill(name: string): void;
|
|
125
|
+
}
|
package/node-esm/wasm.js
ADDED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
|
|
2
|
+
let imports = {};
|
|
3
|
+
import * as import0 from './wasm_bg.js';
|
|
4
|
+
imports['./wasm_bg.js'] = import0;
|
|
5
|
+
|
|
6
|
+
import { readFileSync } from 'node:fs';
|
|
7
|
+
|
|
8
|
+
const wasmUrl = new URL('wasm_bg.wasm', import.meta.url);
|
|
9
|
+
const wasmBytes = readFileSync(wasmUrl);
|
|
10
|
+
const wasmModule = new WebAssembly.Module(wasmBytes);
|
|
11
|
+
const wasm = new WebAssembly.Instance(wasmModule, imports).exports;
|
|
12
|
+
export { wasm as __wasm };
|
|
13
|
+
|
|
14
|
+
imports["./wasm_bg.js"].__wbg_set_wasm(wasm, wasmModule);
|
|
15
|
+
wasm.__wbindgen_start();
|
|
16
|
+
|
|
17
|
+
export * from "./wasm_bg.js";
|
|
Binary file
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@quillmark/wasm",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.0",
|
|
4
4
|
"description": "WebAssembly bindings for quillmark",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT OR Apache-2.0",
|
|
@@ -9,23 +9,27 @@
|
|
|
9
9
|
"url": "git+https://github.com/nibsbin/quillmark.git"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"wasm_bg.wasm",
|
|
13
|
-
"wasm_bg.js",
|
|
14
|
-
"wasm_bg.wasm.d.ts",
|
|
15
|
-
"wasm.js",
|
|
16
|
-
"wasm.d.ts"
|
|
12
|
+
"bundler/wasm_bg.wasm",
|
|
13
|
+
"bundler/wasm_bg.js",
|
|
14
|
+
"bundler/wasm_bg.wasm.d.ts",
|
|
15
|
+
"bundler/wasm.js",
|
|
16
|
+
"bundler/wasm.d.ts",
|
|
17
|
+
"node-esm/wasm_bg.wasm",
|
|
18
|
+
"node-esm/wasm.js",
|
|
19
|
+
"node-esm/wasm.d.ts"
|
|
17
20
|
],
|
|
18
|
-
"main": "./wasm.js",
|
|
19
|
-
"module": "./wasm.js",
|
|
20
|
-
"types": "./wasm.d.ts",
|
|
21
|
+
"main": "./node-esm/wasm.js",
|
|
22
|
+
"module": "./bundler/wasm.js",
|
|
23
|
+
"types": "./bundler/wasm.d.ts",
|
|
21
24
|
"exports": {
|
|
22
25
|
".": {
|
|
23
|
-
"types": "./wasm.d.ts",
|
|
24
|
-
"
|
|
25
|
-
"
|
|
26
|
+
"types": "./bundler/wasm.d.ts",
|
|
27
|
+
"node": "./node-esm/wasm.js",
|
|
28
|
+
"import": "./bundler/wasm.js",
|
|
29
|
+
"default": "./bundler/wasm.js"
|
|
26
30
|
}
|
|
27
31
|
},
|
|
28
32
|
"sideEffects": [
|
|
29
|
-
"./wasm.js"
|
|
33
|
+
"./bundler/wasm.js"
|
|
30
34
|
]
|
|
31
35
|
}
|
|
File without changes
|