@quillmark/wasm 0.27.0 → 0.30.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,26 +85,19 @@ export class Quillmark {
98
85
  */
99
86
  registerQuill(quill_json: any): QuillInfo;
100
87
  /**
101
- * Unregister a Quill (free memory)
102
- */
103
- unregisterQuill(name: string): void;
104
- /**
105
- * Get shallow information about a registered Quill with UI metadata stripped
88
+ * Get shallow information about a registered Quill
106
89
  *
107
- * Same as `getQuillInfo`, but removes "x-ui" fields from the schema.
108
- */
109
- getQuillInfoSlim(name: string): QuillInfo;
110
- /**
111
- * JavaScript constructor: `new Quillmark()`
90
+ * This returns metadata, backend info, field schemas, and supported formats
91
+ * that consumers need to configure render options for the next step.
112
92
  */
113
- constructor();
93
+ getQuillInfo(name: string): QuillInfo;
114
94
  /**
115
- * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
95
+ * Get the stripped JSON schema of a Quill (removes UI metadata)
116
96
  *
117
- * Uses the Quill specified in options.quill_name if provided,
118
- * otherwise infers it from the ParsedDocument's quill_tag field.
97
+ * This returns the schema in a format suitable for feeding to LLMs or
98
+ * other consumers that don't need the UI configuration "x-ui" fields.
119
99
  */
120
- render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
100
+ getStrippedSchema(name: string): any;
121
101
  /**
122
102
  * Perform a dry run validation without backend compilation.
123
103
  *
@@ -130,4 +110,26 @@ export class Quillmark {
130
110
  * This is useful for fast feedback loops in LLM-driven document generation.
131
111
  */
132
112
  dryRun(markdown: string): void;
113
+ /**
114
+ * Compile markdown to JSON data without rendering artifacts.
115
+ *
116
+ * This exposes the intermediate data structure that would be passed to the backend.
117
+ * Useful for debugging and validation.
118
+ */
119
+ compileData(markdown: string): any;
120
+ /**
121
+ * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
122
+ *
123
+ * Uses the Quill specified in options.quill_name if provided,
124
+ * otherwise infers it from the ParsedDocument's quill_tag field.
125
+ */
126
+ render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
127
+ /**
128
+ * List registered Quill names
129
+ */
130
+ listQuills(): string[];
131
+ /**
132
+ * Unregister a Quill (free memory)
133
+ */
134
+ unregisterQuill(name: string): void;
133
135
  }
@@ -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
- * List registered Quill names
250
- * @returns {string[]}
249
+ * JavaScript constructor: `new Quillmark()`
251
250
  */
252
- listQuills() {
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.quillmark_listQuills(retptr, this.__wbg_ptr);
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 v1 = getArrayJsValueFromWasm0(r0, r1).slice();
259
- wasm.__wbindgen_export_3(r0, r1 * 4, 4);
260
- return v1;
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
- * Process markdown through template engine (debugging)
283
+ * Register a Quill template bundle
267
284
  *
268
- * Returns template source code (Typst, LaTeX, etc.)
269
- * @param {string} quill_name
270
- * @param {string} markdown
271
- * @returns {string}
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
- processPlate(quill_name, markdown) {
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
- const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
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
- 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);
297
+ if (r2) {
298
+ throw takeObject(r1);
292
299
  }
293
- deferred4_0 = ptr3;
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,19 +328,19 @@ export class Quillmark {
324
328
  }
325
329
  }
326
330
  /**
327
- * Parse markdown into a ParsedDocument
331
+ * Get the stripped JSON schema of a Quill (removes UI metadata)
328
332
  *
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}
333
+ * This returns the schema in a format suitable for feeding to LLMs or
334
+ * other consumers that don't need the UI configuration "x-ui" fields.
335
+ * @param {string} name
336
+ * @returns {any}
333
337
  */
334
- static parseMarkdown(markdown) {
338
+ getStrippedSchema(name) {
335
339
  try {
336
340
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
337
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
341
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
338
342
  const len0 = WASM_VECTOR_LEN;
339
- wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
343
+ wasm.quillmark_getStrippedSchema(retptr, this.__wbg_ptr, ptr0, len0);
340
344
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
341
345
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
342
346
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -349,50 +353,46 @@ export class Quillmark {
349
353
  }
350
354
  }
351
355
  /**
352
- * Register a Quill template bundle
356
+ * Perform a dry run validation without backend compilation.
353
357
  *
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}
358
+ * Executes parsing, schema validation, and template composition to
359
+ * surface input errors quickly. Returns successfully on valid input,
360
+ * or throws an error with diagnostic payload on failure.
361
+ *
362
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
363
+ *
364
+ * This is useful for fast feedback loops in LLM-driven document generation.
365
+ * @param {string} markdown
358
366
  */
359
- registerQuill(quill_json) {
367
+ dryRun(markdown) {
360
368
  try {
361
369
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
362
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
370
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
371
+ const len0 = WASM_VECTOR_LEN;
372
+ wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
363
373
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
364
374
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
365
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
366
- if (r2) {
367
- throw takeObject(r1);
375
+ if (r1) {
376
+ throw takeObject(r0);
368
377
  }
369
- return takeObject(r0);
370
378
  } finally {
371
379
  wasm.__wbindgen_add_to_stack_pointer(16);
372
380
  }
373
381
  }
374
382
  /**
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
383
+ * Compile markdown to JSON data without rendering artifacts.
385
384
  *
386
- * Same as `getQuillInfo`, but removes "x-ui" fields from the schema.
387
- * @param {string} name
388
- * @returns {QuillInfo}
385
+ * This exposes the intermediate data structure that would be passed to the backend.
386
+ * Useful for debugging and validation.
387
+ * @param {string} markdown
388
+ * @returns {any}
389
389
  */
390
- getQuillInfoSlim(name) {
390
+ compileData(markdown) {
391
391
  try {
392
392
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
393
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
393
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
394
394
  const len0 = WASM_VECTOR_LEN;
395
- wasm.quillmark_getQuillInfoSlim(retptr, this.__wbg_ptr, ptr0, len0);
395
+ wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
396
396
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
397
397
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
398
398
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -404,15 +404,6 @@ export class Quillmark {
404
404
  wasm.__wbindgen_add_to_stack_pointer(16);
405
405
  }
406
406
  }
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
407
  /**
417
408
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
418
409
  *
@@ -438,32 +429,31 @@ export class Quillmark {
438
429
  }
439
430
  }
440
431
  /**
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
432
+ * List registered Quill names
433
+ * @returns {string[]}
451
434
  */
452
- dryRun(markdown) {
435
+ listQuills() {
453
436
  try {
454
437
  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);
438
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
458
439
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
459
440
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
460
- if (r1) {
461
- throw takeObject(r0);
462
- }
441
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
442
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
443
+ return v1;
463
444
  } finally {
464
445
  wasm.__wbindgen_add_to_stack_pointer(16);
465
446
  }
466
447
  }
448
+ /**
449
+ * Unregister a Quill (free memory)
450
+ * @param {string} name
451
+ */
452
+ unregisterQuill(name) {
453
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
454
+ const len0 = WASM_VECTOR_LEN;
455
+ wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
456
+ }
467
457
  }
468
458
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
469
459
 
@@ -643,6 +633,11 @@ export function __wbg_now_1e80617bcee43265() {
643
633
  return ret;
644
634
  };
645
635
 
636
+ export function __wbg_parse_442f5ba02e5eaf8b() { return handleError(function (arg0, arg1) {
637
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
638
+ return addHeapObject(ret);
639
+ }, arguments) };
640
+
646
641
  export function __wbg_prototypesetcall_3d4a26c1ed734349(arg0, arg1, arg2) {
647
642
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
648
643
  };
Binary file
@@ -2,30 +2,30 @@
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_getStrippedSchema: (a: number, b: number, c: number, d: number) => void;
10
+ export const quillmark_dryRun: (a: number, b: number, c: number, d: number) => void;
11
+ export const quillmark_compileData: (a: number, b: number, c: number, d: number) => void;
14
12
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
13
+ export const quillmark_listQuills: (a: number, b: number) => void;
15
14
  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;
15
+ export const init: () => void;
16
+ export const qcms_profile_is_bogus: (a: number) => number;
18
17
  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;
18
+ export const qcms_profile_precache_output_transform: (a: number) => void;
22
19
  export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
23
20
  export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
24
21
  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;
22
+ export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
23
+ export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
24
+ export const qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
28
25
  export const qcms_transform_release: (a: number) => void;
26
+ export const qcms_enable_iccv4: () => void;
27
+ export const lut_interp_linear16: (a: number, b: number, c: number) => number;
28
+ export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
29
29
  export const __wbindgen_export_0: (a: number, b: number) => number;
30
30
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
31
31
  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,26 +85,19 @@ export class Quillmark {
98
85
  */
99
86
  registerQuill(quill_json: any): QuillInfo;
100
87
  /**
101
- * Unregister a Quill (free memory)
102
- */
103
- unregisterQuill(name: string): void;
104
- /**
105
- * Get shallow information about a registered Quill with UI metadata stripped
88
+ * Get shallow information about a registered Quill
106
89
  *
107
- * Same as `getQuillInfo`, but removes "x-ui" fields from the schema.
108
- */
109
- getQuillInfoSlim(name: string): QuillInfo;
110
- /**
111
- * JavaScript constructor: `new Quillmark()`
90
+ * This returns metadata, backend info, field schemas, and supported formats
91
+ * that consumers need to configure render options for the next step.
112
92
  */
113
- constructor();
93
+ getQuillInfo(name: string): QuillInfo;
114
94
  /**
115
- * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
95
+ * Get the stripped JSON schema of a Quill (removes UI metadata)
116
96
  *
117
- * Uses the Quill specified in options.quill_name if provided,
118
- * otherwise infers it from the ParsedDocument's quill_tag field.
97
+ * This returns the schema in a format suitable for feeding to LLMs or
98
+ * other consumers that don't need the UI configuration "x-ui" fields.
119
99
  */
120
- render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
100
+ getStrippedSchema(name: string): any;
121
101
  /**
122
102
  * Perform a dry run validation without backend compilation.
123
103
  *
@@ -130,4 +110,26 @@ export class Quillmark {
130
110
  * This is useful for fast feedback loops in LLM-driven document generation.
131
111
  */
132
112
  dryRun(markdown: string): void;
113
+ /**
114
+ * Compile markdown to JSON data without rendering artifacts.
115
+ *
116
+ * This exposes the intermediate data structure that would be passed to the backend.
117
+ * Useful for debugging and validation.
118
+ */
119
+ compileData(markdown: string): any;
120
+ /**
121
+ * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
122
+ *
123
+ * Uses the Quill specified in options.quill_name if provided,
124
+ * otherwise infers it from the ParsedDocument's quill_tag field.
125
+ */
126
+ render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
127
+ /**
128
+ * List registered Quill names
129
+ */
130
+ listQuills(): string[];
131
+ /**
132
+ * Unregister a Quill (free memory)
133
+ */
134
+ unregisterQuill(name: string): void;
133
135
  }
@@ -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,56 +240,60 @@ 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() {
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;
250
+ }
251
+ /**
252
+ * Parse markdown into a ParsedDocument
253
+ *
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__").
256
+ * @param {string} markdown
257
+ * @returns {ParsedDocument}
258
+ */
259
+ static parseMarkdown(markdown) {
247
260
  try {
248
261
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
249
- wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
262
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
263
+ const len0 = WASM_VECTOR_LEN;
264
+ wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
250
265
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
251
266
  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;
267
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
268
+ if (r2) {
269
+ throw takeObject(r1);
270
+ }
271
+ return takeObject(r0);
255
272
  } finally {
256
273
  wasm.__wbindgen_add_to_stack_pointer(16);
257
274
  }
258
275
  }
259
276
  /**
260
- * Process markdown through template engine (debugging)
277
+ * Register a Quill template bundle
261
278
  *
262
- * Returns template source code (Typst, LaTeX, etc.)
263
- * @param {string} quill_name
264
- * @param {string} markdown
265
- * @returns {string}
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
282
+ * @returns {QuillInfo}
266
283
  */
267
- processPlate(quill_name, markdown) {
268
- let deferred4_0;
269
- let deferred4_1;
284
+ registerQuill(quill_json) {
270
285
  try {
271
286
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
272
- const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
273
- 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);
287
+ wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
277
288
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
278
289
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
279
290
  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);
291
+ if (r2) {
292
+ throw takeObject(r1);
286
293
  }
287
- deferred4_0 = ptr3;
288
- deferred4_1 = len3;
289
- return getStringFromWasm0(ptr3, len3);
294
+ return takeObject(r0);
290
295
  } finally {
291
296
  wasm.__wbindgen_add_to_stack_pointer(16);
292
- wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
293
297
  }
294
298
  }
295
299
  /**
@@ -318,19 +322,19 @@ export class Quillmark {
318
322
  }
319
323
  }
320
324
  /**
321
- * Parse markdown into a ParsedDocument
325
+ * Get the stripped JSON schema of a Quill (removes UI metadata)
322
326
  *
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}
327
+ * This returns the schema in a format suitable for feeding to LLMs or
328
+ * other consumers that don't need the UI configuration "x-ui" fields.
329
+ * @param {string} name
330
+ * @returns {any}
327
331
  */
328
- static parseMarkdown(markdown) {
332
+ getStrippedSchema(name) {
329
333
  try {
330
334
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
331
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
335
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
332
336
  const len0 = WASM_VECTOR_LEN;
333
- wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
337
+ wasm.quillmark_getStrippedSchema(retptr, this.__wbg_ptr, ptr0, len0);
334
338
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
335
339
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
336
340
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -343,50 +347,46 @@ export class Quillmark {
343
347
  }
344
348
  }
345
349
  /**
346
- * Register a Quill template bundle
350
+ * Perform a dry run validation without backend compilation.
347
351
  *
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}
352
+ * Executes parsing, schema validation, and template composition to
353
+ * surface input errors quickly. Returns successfully on valid input,
354
+ * or throws an error with diagnostic payload on failure.
355
+ *
356
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
357
+ *
358
+ * This is useful for fast feedback loops in LLM-driven document generation.
359
+ * @param {string} markdown
352
360
  */
353
- registerQuill(quill_json) {
361
+ dryRun(markdown) {
354
362
  try {
355
363
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
356
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
364
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
365
+ const len0 = WASM_VECTOR_LEN;
366
+ wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
357
367
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
358
368
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
359
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
360
- if (r2) {
361
- throw takeObject(r1);
369
+ if (r1) {
370
+ throw takeObject(r0);
362
371
  }
363
- return takeObject(r0);
364
372
  } finally {
365
373
  wasm.__wbindgen_add_to_stack_pointer(16);
366
374
  }
367
375
  }
368
376
  /**
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
377
+ * Compile markdown to JSON data without rendering artifacts.
379
378
  *
380
- * Same as `getQuillInfo`, but removes "x-ui" fields from the schema.
381
- * @param {string} name
382
- * @returns {QuillInfo}
379
+ * This exposes the intermediate data structure that would be passed to the backend.
380
+ * Useful for debugging and validation.
381
+ * @param {string} markdown
382
+ * @returns {any}
383
383
  */
384
- getQuillInfoSlim(name) {
384
+ compileData(markdown) {
385
385
  try {
386
386
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
387
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
387
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
388
388
  const len0 = WASM_VECTOR_LEN;
389
- wasm.quillmark_getQuillInfoSlim(retptr, this.__wbg_ptr, ptr0, len0);
389
+ wasm.quillmark_compileData(retptr, this.__wbg_ptr, ptr0, len0);
390
390
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
391
391
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
392
392
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -398,15 +398,6 @@ export class Quillmark {
398
398
  wasm.__wbindgen_add_to_stack_pointer(16);
399
399
  }
400
400
  }
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
401
  /**
411
402
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
412
403
  *
@@ -432,32 +423,31 @@ export class Quillmark {
432
423
  }
433
424
  }
434
425
  /**
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
426
+ * List registered Quill names
427
+ * @returns {string[]}
445
428
  */
446
- dryRun(markdown) {
429
+ listQuills() {
447
430
  try {
448
431
  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);
432
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
452
433
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
453
434
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
454
- if (r1) {
455
- throw takeObject(r0);
456
- }
435
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
436
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
437
+ return v1;
457
438
  } finally {
458
439
  wasm.__wbindgen_add_to_stack_pointer(16);
459
440
  }
460
441
  }
442
+ /**
443
+ * Unregister a Quill (free memory)
444
+ * @param {string} name
445
+ */
446
+ unregisterQuill(name) {
447
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
448
+ const len0 = WASM_VECTOR_LEN;
449
+ wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
450
+ }
461
451
  }
462
452
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
463
453
 
@@ -637,6 +627,11 @@ export function __wbg_now_1e80617bcee43265() {
637
627
  return ret;
638
628
  };
639
629
 
630
+ export function __wbg_parse_442f5ba02e5eaf8b() { return handleError(function (arg0, arg1) {
631
+ const ret = JSON.parse(getStringFromWasm0(arg0, arg1));
632
+ return addHeapObject(ret);
633
+ }, arguments) };
634
+
640
635
  export function __wbg_prototypesetcall_3d4a26c1ed734349(arg0, arg1, arg2) {
641
636
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
642
637
  };
Binary file
@@ -2,30 +2,30 @@
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_getStrippedSchema: (a: number, b: number, c: number, d: number) => void;
10
+ export const quillmark_dryRun: (a: number, b: number, c: number, d: number) => void;
11
+ export const quillmark_compileData: (a: number, b: number, c: number, d: number) => void;
14
12
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
13
+ export const quillmark_listQuills: (a: number, b: number) => void;
15
14
  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;
15
+ export const init: () => void;
16
+ export const qcms_profile_is_bogus: (a: number) => number;
18
17
  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;
18
+ export const qcms_profile_precache_output_transform: (a: number) => void;
22
19
  export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
23
20
  export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
24
21
  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;
22
+ export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
23
+ export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
24
+ export const qcms_transform_data_bgra_out_lut: (a: number, b: number, c: number, d: number) => void;
28
25
  export const qcms_transform_release: (a: number) => void;
26
+ export const qcms_enable_iccv4: () => void;
27
+ export const lut_interp_linear16: (a: number, b: number, c: number) => number;
28
+ export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
29
29
  export const __wbindgen_export_0: (a: number, b: number) => number;
30
30
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
31
31
  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.30.0",
4
4
  "description": "WebAssembly bindings for quillmark",
5
5
  "type": "module",
6
6
  "license": "MIT OR Apache-2.0",