@quillmark/wasm 0.27.0 → 0.29.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/bundler/wasm.d.ts CHANGED
@@ -4,11 +4,9 @@
4
4
  * Initialize the WASM module with panic hooks for better error messages
5
5
  */
6
6
  export function init(): void;
7
- export interface Artifact {
8
- format: OutputFormat;
9
- bytes: Uint8Array;
10
- mimeType: string;
11
- }
7
+ export type OutputFormat = "pdf" | "svg" | "txt";
8
+
9
+ export type Severity = "error" | "warning" | "note";
12
10
 
13
11
  export interface Location {
14
12
  file: string;
@@ -16,6 +14,21 @@ export interface Location {
16
14
  column: number;
17
15
  }
18
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
+
19
32
  export interface RenderResult {
20
33
  artifacts: Artifact[];
21
34
  warnings: Diagnostic[];
@@ -23,8 +36,6 @@ export interface RenderResult {
23
36
  renderTimeMs: number;
24
37
  }
25
38
 
26
- export type OutputFormat = "pdf" | "svg" | "txt";
27
-
28
39
  export interface QuillInfo {
29
40
  name: string;
30
41
  backend: string;
@@ -36,7 +47,10 @@ export interface QuillInfo {
36
47
  supportedFormats: OutputFormat[];
37
48
  }
38
49
 
39
- export type Severity = "error" | "warning" | "note";
50
+ export interface ParsedDocument {
51
+ fields: Record<string, any>;
52
+ quillTag: string;
53
+ }
40
54
 
41
55
  export interface RenderOptions {
42
56
  format?: OutputFormat;
@@ -44,20 +58,6 @@ export interface RenderOptions {
44
58
  quillName?: string;
45
59
  }
46
60
 
47
- export interface Diagnostic {
48
- severity: Severity;
49
- code?: string;
50
- message: string;
51
- location?: Location;
52
- hint?: string;
53
- sourceChain: string[];
54
- }
55
-
56
- export interface ParsedDocument {
57
- fields: Record<string, any>;
58
- quillTag: string;
59
- }
60
-
61
61
  /**
62
62
  * Quillmark WASM Engine
63
63
  *
@@ -67,22 +67,9 @@ export class Quillmark {
67
67
  free(): void;
68
68
  [Symbol.dispose](): void;
69
69
  /**
70
- * List registered Quill names
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
- getQuillInfo(name: string): QuillInfo;
72
+ constructor();
86
73
  /**
87
74
  * Parse markdown into a ParsedDocument
88
75
  *
@@ -98,19 +85,31 @@ export class Quillmark {
98
85
  */
99
86
  registerQuill(quill_json: any): QuillInfo;
100
87
  /**
101
- * Unregister a Quill (free memory)
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
- unregisterQuill(name: string): void;
93
+ getQuillInfo(name: string): QuillInfo;
104
94
  /**
105
- * Get shallow information about a registered Quill with UI metadata stripped
95
+ * Perform a dry run validation without backend compilation.
96
+ *
97
+ * Executes parsing, schema validation, and template composition to
98
+ * surface input errors quickly. Returns successfully on valid input,
99
+ * or throws an error with diagnostic payload on failure.
106
100
  *
107
- * Same as `getQuillInfo`, but removes "x-ui" fields from the schema.
101
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
102
+ *
103
+ * This is useful for fast feedback loops in LLM-driven document generation.
108
104
  */
109
- getQuillInfoSlim(name: string): QuillInfo;
105
+ dryRun(markdown: string): void;
110
106
  /**
111
- * JavaScript constructor: `new Quillmark()`
107
+ * Compile markdown to JSON data without rendering artifacts.
108
+ *
109
+ * This exposes the intermediate data structure that would be passed to the backend.
110
+ * Useful for debugging and validation.
112
111
  */
113
- constructor();
112
+ compileData(markdown: string): any;
114
113
  /**
115
114
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
116
115
  *
@@ -119,15 +118,11 @@ export class Quillmark {
119
118
  */
120
119
  render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
121
120
  /**
122
- * Perform a dry run validation without backend compilation.
123
- *
124
- * Executes parsing, schema validation, and template composition to
125
- * surface input errors quickly. Returns successfully on valid input,
126
- * or throws an error with diagnostic payload on failure.
127
- *
128
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
129
- *
130
- * This is useful for fast feedback loops in LLM-driven document generation.
121
+ * List registered Quill names
131
122
  */
132
- dryRun(markdown: string): void;
123
+ listQuills(): string[];
124
+ /**
125
+ * Unregister a Quill (free memory)
126
+ */
127
+ unregisterQuill(name: string): void;
133
128
  }
@@ -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,72 +246,51 @@ export class Quillmark {
246
246
  wasm.__wbg_quillmark_free(ptr, 0);
247
247
  }
248
248
  /**
249
- * List registered Quill names
250
- * @returns {string[]}
249
+ * JavaScript constructor: `new Quillmark()`
251
250
  */
252
- listQuills() {
253
- try {
254
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
255
- wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
256
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
257
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
258
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
259
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
260
- return v1;
261
- } finally {
262
- wasm.__wbindgen_add_to_stack_pointer(16);
263
- }
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;
264
256
  }
265
257
  /**
266
- * Process markdown through template engine (debugging)
258
+ * Parse markdown into a ParsedDocument
267
259
  *
268
- * Returns template source code (Typst, LaTeX, etc.)
269
- * @param {string} quill_name
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__").
270
262
  * @param {string} markdown
271
- * @returns {string}
263
+ * @returns {ParsedDocument}
272
264
  */
273
- processPlate(quill_name, markdown) {
274
- let deferred4_0;
275
- let deferred4_1;
265
+ static parseMarkdown(markdown) {
276
266
  try {
277
267
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
278
- const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
268
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
279
269
  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);
270
+ wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
283
271
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
284
272
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
285
273
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
286
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
287
- var ptr3 = r0;
288
- var len3 = r1;
289
- if (r3) {
290
- ptr3 = 0; len3 = 0;
291
- throw takeObject(r2);
274
+ if (r2) {
275
+ throw takeObject(r1);
292
276
  }
293
- deferred4_0 = ptr3;
294
- deferred4_1 = len3;
295
- return getStringFromWasm0(ptr3, len3);
277
+ return takeObject(r0);
296
278
  } finally {
297
279
  wasm.__wbindgen_add_to_stack_pointer(16);
298
- wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
299
280
  }
300
281
  }
301
282
  /**
302
- * Get shallow information about a registered Quill
283
+ * Register a Quill template bundle
303
284
  *
304
- * This returns metadata, backend info, field schemas, and supported formats
305
- * that consumers need to configure render options for the next step.
306
- * @param {string} name
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
307
288
  * @returns {QuillInfo}
308
289
  */
309
- getQuillInfo(name) {
290
+ registerQuill(quill_json) {
310
291
  try {
311
292
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
312
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
313
- const len0 = WASM_VECTOR_LEN;
314
- wasm.quillmark_getQuillInfo(retptr, this.__wbg_ptr, ptr0, len0);
293
+ wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
315
294
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
316
295
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
317
296
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -324,19 +303,19 @@ export class Quillmark {
324
303
  }
325
304
  }
326
305
  /**
327
- * Parse markdown into a ParsedDocument
306
+ * Get shallow information about a registered Quill
328
307
  *
329
- * This is the first step in the workflow. The returned ParsedDocument contains
330
- * the parsed YAML frontmatter fields and the quill_tag (from QUILL field or "__default__").
331
- * @param {string} markdown
332
- * @returns {ParsedDocument}
308
+ * This returns metadata, backend info, field schemas, and supported formats
309
+ * that consumers need to configure render options for the next step.
310
+ * @param {string} name
311
+ * @returns {QuillInfo}
333
312
  */
334
- static parseMarkdown(markdown) {
313
+ getQuillInfo(name) {
335
314
  try {
336
315
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
337
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
316
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
338
317
  const len0 = WASM_VECTOR_LEN;
339
- wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
318
+ wasm.quillmark_getQuillInfo(retptr, this.__wbg_ptr, ptr0, len0);
340
319
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
341
320
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
342
321
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -349,50 +328,46 @@ export class Quillmark {
349
328
  }
350
329
  }
351
330
  /**
352
- * Register a Quill template bundle
331
+ * Perform a dry run validation without backend compilation.
353
332
  *
354
- * Accepts either a JSON string or a JsValue object representing the Quill file tree.
355
- * Validation happens automatically on registration.
356
- * @param {any} quill_json
357
- * @returns {QuillInfo}
333
+ * Executes parsing, schema validation, and template composition to
334
+ * surface input errors quickly. Returns successfully on valid input,
335
+ * or throws an error with diagnostic payload on failure.
336
+ *
337
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
338
+ *
339
+ * This is useful for fast feedback loops in LLM-driven document generation.
340
+ * @param {string} markdown
358
341
  */
359
- registerQuill(quill_json) {
342
+ dryRun(markdown) {
360
343
  try {
361
344
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
362
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
345
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
346
+ const len0 = WASM_VECTOR_LEN;
347
+ wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
363
348
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
364
349
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
365
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
366
- if (r2) {
367
- throw takeObject(r1);
350
+ if (r1) {
351
+ throw takeObject(r0);
368
352
  }
369
- return takeObject(r0);
370
353
  } finally {
371
354
  wasm.__wbindgen_add_to_stack_pointer(16);
372
355
  }
373
356
  }
374
357
  /**
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
- * Get shallow information about a registered Quill with UI metadata stripped
358
+ * Compile markdown to JSON data without rendering artifacts.
385
359
  *
386
- * Same as `getQuillInfo`, but removes "x-ui" fields from the schema.
387
- * @param {string} name
388
- * @returns {QuillInfo}
360
+ * This exposes the intermediate data structure that would be passed to the backend.
361
+ * Useful for debugging and validation.
362
+ * @param {string} markdown
363
+ * @returns {any}
389
364
  */
390
- getQuillInfoSlim(name) {
365
+ compileData(markdown) {
391
366
  try {
392
367
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
393
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
368
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
394
369
  const len0 = WASM_VECTOR_LEN;
395
- wasm.quillmark_getQuillInfoSlim(retptr, this.__wbg_ptr, ptr0, len0);
370
+ wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
396
371
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
397
372
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
398
373
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -404,15 +379,6 @@ export class Quillmark {
404
379
  wasm.__wbindgen_add_to_stack_pointer(16);
405
380
  }
406
381
  }
407
- /**
408
- * JavaScript constructor: `new Quillmark()`
409
- */
410
- constructor() {
411
- const ret = wasm.quillmark_new();
412
- this.__wbg_ptr = ret >>> 0;
413
- QuillmarkFinalization.register(this, this.__wbg_ptr, this);
414
- return this;
415
- }
416
382
  /**
417
383
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
418
384
  *
@@ -438,32 +404,31 @@ export class Quillmark {
438
404
  }
439
405
  }
440
406
  /**
441
- * Perform a dry run validation without backend compilation.
442
- *
443
- * Executes parsing, schema validation, and template composition to
444
- * surface input errors quickly. Returns successfully on valid input,
445
- * or throws an error with diagnostic payload on failure.
446
- *
447
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
448
- *
449
- * This is useful for fast feedback loops in LLM-driven document generation.
450
- * @param {string} markdown
407
+ * List registered Quill names
408
+ * @returns {string[]}
451
409
  */
452
- dryRun(markdown) {
410
+ listQuills() {
453
411
  try {
454
412
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
455
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
456
- const len0 = WASM_VECTOR_LEN;
457
- wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
413
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
458
414
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
459
415
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
460
- if (r1) {
461
- throw takeObject(r0);
462
- }
416
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
417
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
418
+ return v1;
463
419
  } finally {
464
420
  wasm.__wbindgen_add_to_stack_pointer(16);
465
421
  }
466
422
  }
423
+ /**
424
+ * Unregister a Quill (free memory)
425
+ * @param {string} name
426
+ */
427
+ unregisterQuill(name) {
428
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
429
+ const len0 = WASM_VECTOR_LEN;
430
+ wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
431
+ }
467
432
  }
468
433
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
469
434
 
@@ -643,6 +608,11 @@ export function __wbg_now_1e80617bcee43265() {
643
608
  return ret;
644
609
  };
645
610
 
611
+ export function __wbg_parse_442f5ba02e5eaf8b() { return handleError(function (arg0, arg1) {
612
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
613
+ return addHeapObject(ret);
614
+ }, arguments) };
615
+
646
616
  export function __wbg_prototypesetcall_3d4a26c1ed734349(arg0, arg1, arg2) {
647
617
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
648
618
  };
Binary file
@@ -2,30 +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_dryRun: (a: number, b: number, c: number, d: number) => void;
7
- export const quillmark_getQuillInfo: (a: number, b: number, c: number, d: number) => void;
8
- export const quillmark_getQuillInfoSlim: (a: number, b: number, c: number, d: number) => void;
9
- export const quillmark_listQuills: (a: number, b: number) => void;
10
5
  export const quillmark_new: () => number;
11
6
  export const quillmark_parseMarkdown: (a: number, b: number, c: number) => void;
12
- export const quillmark_processPlate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
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_dryRun: (a: number, b: number, c: number, d: number) => void;
10
+ export const quillmark_compileData: (a: number, b: number, c: number, d: number) => void;
14
11
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
12
+ export const quillmark_listQuills: (a: number, b: number) => void;
15
13
  export const quillmark_unregisterQuill: (a: number, b: number, c: number) => void;
16
- export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
17
- export const qcms_profile_precache_output_transform: (a: number) => void;
14
+ export const init: () => void;
15
+ export const qcms_profile_is_bogus: (a: number) => number;
18
16
  export const qcms_white_point_sRGB: (a: number) => void;
19
- export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
20
- export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
21
- 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;
22
18
  export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
23
19
  export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
24
20
  export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
25
- export const lut_interp_linear16: (a: number, b: number, c: number) => number;
26
- export const qcms_enable_iccv4: () => void;
27
- export const qcms_profile_is_bogus: (a: number) => number;
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;
28
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;
29
28
  export const __wbindgen_export_0: (a: number, b: number) => number;
30
29
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
31
30
  export const __wbindgen_export_2: (a: number) => void;
@@ -4,11 +4,9 @@
4
4
  * Initialize the WASM module with panic hooks for better error messages
5
5
  */
6
6
  export function init(): void;
7
- export interface Artifact {
8
- format: OutputFormat;
9
- bytes: Uint8Array;
10
- mimeType: string;
11
- }
7
+ export type OutputFormat = "pdf" | "svg" | "txt";
8
+
9
+ export type Severity = "error" | "warning" | "note";
12
10
 
13
11
  export interface Location {
14
12
  file: string;
@@ -16,6 +14,21 @@ export interface Location {
16
14
  column: number;
17
15
  }
18
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
+
19
32
  export interface RenderResult {
20
33
  artifacts: Artifact[];
21
34
  warnings: Diagnostic[];
@@ -23,8 +36,6 @@ export interface RenderResult {
23
36
  renderTimeMs: number;
24
37
  }
25
38
 
26
- export type OutputFormat = "pdf" | "svg" | "txt";
27
-
28
39
  export interface QuillInfo {
29
40
  name: string;
30
41
  backend: string;
@@ -36,7 +47,10 @@ export interface QuillInfo {
36
47
  supportedFormats: OutputFormat[];
37
48
  }
38
49
 
39
- export type Severity = "error" | "warning" | "note";
50
+ export interface ParsedDocument {
51
+ fields: Record<string, any>;
52
+ quillTag: string;
53
+ }
40
54
 
41
55
  export interface RenderOptions {
42
56
  format?: OutputFormat;
@@ -44,20 +58,6 @@ export interface RenderOptions {
44
58
  quillName?: string;
45
59
  }
46
60
 
47
- export interface Diagnostic {
48
- severity: Severity;
49
- code?: string;
50
- message: string;
51
- location?: Location;
52
- hint?: string;
53
- sourceChain: string[];
54
- }
55
-
56
- export interface ParsedDocument {
57
- fields: Record<string, any>;
58
- quillTag: string;
59
- }
60
-
61
61
  /**
62
62
  * Quillmark WASM Engine
63
63
  *
@@ -67,22 +67,9 @@ export class Quillmark {
67
67
  free(): void;
68
68
  [Symbol.dispose](): void;
69
69
  /**
70
- * List registered Quill names
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
- getQuillInfo(name: string): QuillInfo;
72
+ constructor();
86
73
  /**
87
74
  * Parse markdown into a ParsedDocument
88
75
  *
@@ -98,19 +85,31 @@ export class Quillmark {
98
85
  */
99
86
  registerQuill(quill_json: any): QuillInfo;
100
87
  /**
101
- * Unregister a Quill (free memory)
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
- unregisterQuill(name: string): void;
93
+ getQuillInfo(name: string): QuillInfo;
104
94
  /**
105
- * Get shallow information about a registered Quill with UI metadata stripped
95
+ * Perform a dry run validation without backend compilation.
96
+ *
97
+ * Executes parsing, schema validation, and template composition to
98
+ * surface input errors quickly. Returns successfully on valid input,
99
+ * or throws an error with diagnostic payload on failure.
106
100
  *
107
- * Same as `getQuillInfo`, but removes "x-ui" fields from the schema.
101
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
102
+ *
103
+ * This is useful for fast feedback loops in LLM-driven document generation.
108
104
  */
109
- getQuillInfoSlim(name: string): QuillInfo;
105
+ dryRun(markdown: string): void;
110
106
  /**
111
- * JavaScript constructor: `new Quillmark()`
107
+ * Compile markdown to JSON data without rendering artifacts.
108
+ *
109
+ * This exposes the intermediate data structure that would be passed to the backend.
110
+ * Useful for debugging and validation.
112
111
  */
113
- constructor();
112
+ compileData(markdown: string): any;
114
113
  /**
115
114
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
116
115
  *
@@ -119,15 +118,11 @@ export class Quillmark {
119
118
  */
120
119
  render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
121
120
  /**
122
- * Perform a dry run validation without backend compilation.
123
- *
124
- * Executes parsing, schema validation, and template composition to
125
- * surface input errors quickly. Returns successfully on valid input,
126
- * or throws an error with diagnostic payload on failure.
127
- *
128
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
129
- *
130
- * This is useful for fast feedback loops in LLM-driven document generation.
121
+ * List registered Quill names
131
122
  */
132
- dryRun(markdown: string): void;
123
+ listQuills(): string[];
124
+ /**
125
+ * Unregister a Quill (free memory)
126
+ */
127
+ unregisterQuill(name: string): void;
133
128
  }
@@ -201,12 +201,6 @@ function debugString(val) {
201
201
  // TODO we could test for more things here, like `Set`s and `Map`s.
202
202
  return className;
203
203
  }
204
- /**
205
- * Initialize the WASM module with panic hooks for better error messages
206
- */
207
- export function init() {
208
- wasm.init();
209
- }
210
204
 
211
205
  function getArrayJsValueFromWasm0(ptr, len) {
212
206
  ptr = ptr >>> 0;
@@ -217,6 +211,12 @@ function getArrayJsValueFromWasm0(ptr, len) {
217
211
  }
218
212
  return result;
219
213
  }
214
+ /**
215
+ * Initialize the WASM module with panic hooks for better error messages
216
+ */
217
+ export function init() {
218
+ wasm.init();
219
+ }
220
220
 
221
221
  const QuillmarkFinalization = (typeof FinalizationRegistry === 'undefined')
222
222
  ? { register: () => {}, unregister: () => {} }
@@ -240,72 +240,51 @@ export class Quillmark {
240
240
  wasm.__wbg_quillmark_free(ptr, 0);
241
241
  }
242
242
  /**
243
- * List registered Quill names
244
- * @returns {string[]}
243
+ * JavaScript constructor: `new Quillmark()`
245
244
  */
246
- listQuills() {
247
- try {
248
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
249
- wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
250
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
251
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
252
- var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
253
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
254
- return v1;
255
- } finally {
256
- wasm.__wbindgen_add_to_stack_pointer(16);
257
- }
245
+ constructor() {
246
+ const ret = wasm.quillmark_new();
247
+ this.__wbg_ptr = ret >>> 0;
248
+ QuillmarkFinalization.register(this, this.__wbg_ptr, this);
249
+ return this;
258
250
  }
259
251
  /**
260
- * Process markdown through template engine (debugging)
252
+ * Parse markdown into a ParsedDocument
261
253
  *
262
- * Returns template source code (Typst, LaTeX, etc.)
263
- * @param {string} quill_name
254
+ * This is the first step in the workflow. The returned ParsedDocument contains
255
+ * the parsed YAML frontmatter fields and the quill_tag (from QUILL field or "__default__").
264
256
  * @param {string} markdown
265
- * @returns {string}
257
+ * @returns {ParsedDocument}
266
258
  */
267
- processPlate(quill_name, markdown) {
268
- let deferred4_0;
269
- let deferred4_1;
259
+ static parseMarkdown(markdown) {
270
260
  try {
271
261
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
272
- const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
262
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
273
263
  const len0 = WASM_VECTOR_LEN;
274
- const ptr1 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
275
- const len1 = WASM_VECTOR_LEN;
276
- wasm.quillmark_processPlate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
264
+ wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
277
265
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
278
266
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
279
267
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
280
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
281
- var ptr3 = r0;
282
- var len3 = r1;
283
- if (r3) {
284
- ptr3 = 0; len3 = 0;
285
- throw takeObject(r2);
268
+ if (r2) {
269
+ throw takeObject(r1);
286
270
  }
287
- deferred4_0 = ptr3;
288
- deferred4_1 = len3;
289
- return getStringFromWasm0(ptr3, len3);
271
+ return takeObject(r0);
290
272
  } finally {
291
273
  wasm.__wbindgen_add_to_stack_pointer(16);
292
- wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
293
274
  }
294
275
  }
295
276
  /**
296
- * Get shallow information about a registered Quill
277
+ * Register a Quill template bundle
297
278
  *
298
- * This returns metadata, backend info, field schemas, and supported formats
299
- * that consumers need to configure render options for the next step.
300
- * @param {string} name
279
+ * Accepts either a JSON string or a JsValue object representing the Quill file tree.
280
+ * Validation happens automatically on registration.
281
+ * @param {any} quill_json
301
282
  * @returns {QuillInfo}
302
283
  */
303
- getQuillInfo(name) {
284
+ registerQuill(quill_json) {
304
285
  try {
305
286
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
306
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
307
- const len0 = WASM_VECTOR_LEN;
308
- wasm.quillmark_getQuillInfo(retptr, this.__wbg_ptr, ptr0, len0);
287
+ wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
309
288
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
310
289
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
311
290
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -318,19 +297,19 @@ export class Quillmark {
318
297
  }
319
298
  }
320
299
  /**
321
- * Parse markdown into a ParsedDocument
300
+ * Get shallow information about a registered Quill
322
301
  *
323
- * This is the first step in the workflow. The returned ParsedDocument contains
324
- * the parsed YAML frontmatter fields and the quill_tag (from QUILL field or "__default__").
325
- * @param {string} markdown
326
- * @returns {ParsedDocument}
302
+ * This returns metadata, backend info, field schemas, and supported formats
303
+ * that consumers need to configure render options for the next step.
304
+ * @param {string} name
305
+ * @returns {QuillInfo}
327
306
  */
328
- static parseMarkdown(markdown) {
307
+ getQuillInfo(name) {
329
308
  try {
330
309
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
331
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
310
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
332
311
  const len0 = WASM_VECTOR_LEN;
333
- wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
312
+ wasm.quillmark_getQuillInfo(retptr, this.__wbg_ptr, ptr0, len0);
334
313
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
335
314
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
336
315
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -343,50 +322,46 @@ export class Quillmark {
343
322
  }
344
323
  }
345
324
  /**
346
- * Register a Quill template bundle
325
+ * Perform a dry run validation without backend compilation.
347
326
  *
348
- * Accepts either a JSON string or a JsValue object representing the Quill file tree.
349
- * Validation happens automatically on registration.
350
- * @param {any} quill_json
351
- * @returns {QuillInfo}
327
+ * Executes parsing, schema validation, and template composition to
328
+ * surface input errors quickly. Returns successfully on valid input,
329
+ * or throws an error with diagnostic payload on failure.
330
+ *
331
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
332
+ *
333
+ * This is useful for fast feedback loops in LLM-driven document generation.
334
+ * @param {string} markdown
352
335
  */
353
- registerQuill(quill_json) {
336
+ dryRun(markdown) {
354
337
  try {
355
338
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
356
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
339
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
340
+ const len0 = WASM_VECTOR_LEN;
341
+ wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
357
342
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
358
343
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
359
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
360
- if (r2) {
361
- throw takeObject(r1);
344
+ if (r1) {
345
+ throw takeObject(r0);
362
346
  }
363
- return takeObject(r0);
364
347
  } finally {
365
348
  wasm.__wbindgen_add_to_stack_pointer(16);
366
349
  }
367
350
  }
368
351
  /**
369
- * Unregister a Quill (free memory)
370
- * @param {string} name
371
- */
372
- unregisterQuill(name) {
373
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
374
- const len0 = WASM_VECTOR_LEN;
375
- wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
376
- }
377
- /**
378
- * Get shallow information about a registered Quill with UI metadata stripped
352
+ * Compile markdown to JSON data without rendering artifacts.
379
353
  *
380
- * Same as `getQuillInfo`, but removes "x-ui" fields from the schema.
381
- * @param {string} name
382
- * @returns {QuillInfo}
354
+ * This exposes the intermediate data structure that would be passed to the backend.
355
+ * Useful for debugging and validation.
356
+ * @param {string} markdown
357
+ * @returns {any}
383
358
  */
384
- getQuillInfoSlim(name) {
359
+ compileData(markdown) {
385
360
  try {
386
361
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
387
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
362
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
388
363
  const len0 = WASM_VECTOR_LEN;
389
- wasm.quillmark_getQuillInfoSlim(retptr, this.__wbg_ptr, ptr0, len0);
364
+ wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
390
365
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
391
366
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
392
367
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -398,15 +373,6 @@ export class Quillmark {
398
373
  wasm.__wbindgen_add_to_stack_pointer(16);
399
374
  }
400
375
  }
401
- /**
402
- * JavaScript constructor: `new Quillmark()`
403
- */
404
- constructor() {
405
- const ret = wasm.quillmark_new();
406
- this.__wbg_ptr = ret >>> 0;
407
- QuillmarkFinalization.register(this, this.__wbg_ptr, this);
408
- return this;
409
- }
410
376
  /**
411
377
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
412
378
  *
@@ -432,32 +398,31 @@ export class Quillmark {
432
398
  }
433
399
  }
434
400
  /**
435
- * Perform a dry run validation without backend compilation.
436
- *
437
- * Executes parsing, schema validation, and template composition to
438
- * surface input errors quickly. Returns successfully on valid input,
439
- * or throws an error with diagnostic payload on failure.
440
- *
441
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
442
- *
443
- * This is useful for fast feedback loops in LLM-driven document generation.
444
- * @param {string} markdown
401
+ * List registered Quill names
402
+ * @returns {string[]}
445
403
  */
446
- dryRun(markdown) {
404
+ listQuills() {
447
405
  try {
448
406
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
449
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
450
- const len0 = WASM_VECTOR_LEN;
451
- wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
407
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
452
408
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
453
409
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
454
- if (r1) {
455
- throw takeObject(r0);
456
- }
410
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
411
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
412
+ return v1;
457
413
  } finally {
458
414
  wasm.__wbindgen_add_to_stack_pointer(16);
459
415
  }
460
416
  }
417
+ /**
418
+ * Unregister a Quill (free memory)
419
+ * @param {string} name
420
+ */
421
+ unregisterQuill(name) {
422
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
423
+ const len0 = WASM_VECTOR_LEN;
424
+ wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
425
+ }
461
426
  }
462
427
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
463
428
 
@@ -637,6 +602,11 @@ export function __wbg_now_1e80617bcee43265() {
637
602
  return ret;
638
603
  };
639
604
 
605
+ export function __wbg_parse_442f5ba02e5eaf8b() { return handleError(function (arg0, arg1) {
606
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
607
+ return addHeapObject(ret);
608
+ }, arguments) };
609
+
640
610
  export function __wbg_prototypesetcall_3d4a26c1ed734349(arg0, arg1, arg2) {
641
611
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
642
612
  };
Binary file
@@ -2,30 +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_dryRun: (a: number, b: number, c: number, d: number) => void;
7
- export const quillmark_getQuillInfo: (a: number, b: number, c: number, d: number) => void;
8
- export const quillmark_getQuillInfoSlim: (a: number, b: number, c: number, d: number) => void;
9
- export const quillmark_listQuills: (a: number, b: number) => void;
10
5
  export const quillmark_new: () => number;
11
6
  export const quillmark_parseMarkdown: (a: number, b: number, c: number) => void;
12
- export const quillmark_processPlate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
13
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_dryRun: (a: number, b: number, c: number, d: number) => void;
10
+ export const quillmark_compileData: (a: number, b: number, c: number, d: number) => void;
14
11
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
12
+ export const quillmark_listQuills: (a: number, b: number) => void;
15
13
  export const quillmark_unregisterQuill: (a: number, b: number, c: number) => void;
16
- export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
17
- export const qcms_profile_precache_output_transform: (a: number) => void;
14
+ export const init: () => void;
15
+ export const qcms_profile_is_bogus: (a: number) => number;
18
16
  export const qcms_white_point_sRGB: (a: number) => void;
19
- export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
20
- export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
21
- 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;
22
18
  export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
23
19
  export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
24
20
  export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
25
- export const lut_interp_linear16: (a: number, b: number, c: number) => number;
26
- export const qcms_enable_iccv4: () => void;
27
- export const qcms_profile_is_bogus: (a: number) => number;
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;
28
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;
29
28
  export const __wbindgen_export_0: (a: number, b: number) => number;
30
29
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
31
30
  export const __wbindgen_export_2: (a: number) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quillmark/wasm",
3
- "version": "0.27.0",
3
+ "version": "0.29.0",
4
4
  "description": "WebAssembly bindings for quillmark",
5
5
  "type": "module",
6
6
  "license": "MIT OR Apache-2.0",