@quillmark/wasm 0.21.0 → 0.21.1

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
@@ -6,6 +6,14 @@
6
6
  export function init(): void;
7
7
  export type OutputFormat = "pdf" | "svg" | "txt";
8
8
 
9
+ export type Severity = "error" | "warning" | "note";
10
+
11
+ export interface Location {
12
+ file: string;
13
+ line: number;
14
+ column: number;
15
+ }
16
+
9
17
  export interface Diagnostic {
10
18
  severity: Severity;
11
19
  code?: string;
@@ -15,29 +23,17 @@ export interface Diagnostic {
15
23
  sourceChain: string[];
16
24
  }
17
25
 
18
- export interface RenderResult {
19
- artifacts: Artifact[];
20
- warnings: Diagnostic[];
21
- outputFormat: OutputFormat;
22
- renderTimeMs: number;
23
- }
24
-
25
- export interface Location {
26
- file: string;
27
- line: number;
28
- column: number;
29
- }
30
-
31
26
  export interface Artifact {
32
27
  format: OutputFormat;
33
28
  bytes: Uint8Array;
34
29
  mimeType: string;
35
30
  }
36
31
 
37
- export interface RenderOptions {
38
- format?: OutputFormat;
39
- assets?: Record<string, Uint8Array | number[]>;
40
- quillName?: string;
32
+ export interface RenderResult {
33
+ artifacts: Artifact[];
34
+ warnings: Diagnostic[];
35
+ outputFormat: OutputFormat;
36
+ renderTimeMs: number;
41
37
  }
42
38
 
43
39
  export interface QuillInfo {
@@ -56,7 +52,11 @@ export interface ParsedDocument {
56
52
  quillTag: string;
57
53
  }
58
54
 
59
- export type Severity = "error" | "warning" | "note";
55
+ export interface RenderOptions {
56
+ format?: OutputFormat;
57
+ assets?: Record<string, Uint8Array | number[]>;
58
+ quillName?: string;
59
+ }
60
60
 
61
61
  /**
62
62
  * Quillmark WASM Engine
@@ -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,20 +85,18 @@ 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
- * JavaScript constructor: `new Quillmark()`
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.
106
92
  */
107
- constructor();
93
+ getQuillInfo(name: string): QuillInfo;
108
94
  /**
109
- * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
95
+ * Process markdown through template engine (debugging)
110
96
  *
111
- * Uses the Quill specified in options.quill_name if provided,
112
- * otherwise infers it from the ParsedDocument's quill_tag field.
97
+ * Returns template source code (Typst, LaTeX, etc.)
113
98
  */
114
- render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
99
+ processPlate(quill_name: string, markdown: string): string;
115
100
  /**
116
101
  * Perform a dry run validation without backend compilation.
117
102
  *
@@ -124,4 +109,19 @@ export class Quillmark {
124
109
  * This is useful for fast feedback loops in LLM-driven document generation.
125
110
  */
126
111
  dryRun(markdown: string): void;
112
+ /**
113
+ * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
114
+ *
115
+ * Uses the Quill specified in options.quill_name if provided,
116
+ * otherwise infers it from the ParsedDocument's quill_tag field.
117
+ */
118
+ render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
119
+ /**
120
+ * List registered Quill names
121
+ */
122
+ listQuills(): string[];
123
+ /**
124
+ * Unregister a Quill (free memory)
125
+ */
126
+ unregisterQuill(name: string): void;
127
127
  }
@@ -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,71 +328,68 @@ export class Quillmark {
324
328
  }
325
329
  }
326
330
  /**
327
- * Parse markdown into a ParsedDocument
331
+ * Process markdown through template engine (debugging)
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__").
333
+ * Returns template source code (Typst, LaTeX, etc.)
334
+ * @param {string} quill_name
331
335
  * @param {string} markdown
332
- * @returns {ParsedDocument}
336
+ * @returns {string}
333
337
  */
334
- static parseMarkdown(markdown) {
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(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
343
+ const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
338
344
  const len0 = WASM_VECTOR_LEN;
339
- wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
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
- if (r2) {
344
- throw takeObject(r1);
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
- return takeObject(r0);
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
- * Register a Quill template bundle
367
+ * Perform a dry run validation without backend compilation.
353
368
  *
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}
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
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
374
+ *
375
+ * This is useful for fast feedback loops in LLM-driven document generation.
376
+ * @param {string} markdown
358
377
  */
359
- registerQuill(quill_json) {
378
+ dryRun(markdown) {
360
379
  try {
361
380
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
362
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
381
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
382
+ const len0 = WASM_VECTOR_LEN;
383
+ wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
363
384
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
364
385
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
365
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
366
- if (r2) {
367
- throw takeObject(r1);
386
+ if (r1) {
387
+ throw takeObject(r0);
368
388
  }
369
- return takeObject(r0);
370
389
  } finally {
371
390
  wasm.__wbindgen_add_to_stack_pointer(16);
372
391
  }
373
392
  }
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
393
  /**
393
394
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
394
395
  *
@@ -414,32 +415,31 @@ export class Quillmark {
414
415
  }
415
416
  }
416
417
  /**
417
- * Perform a dry run validation without backend compilation.
418
- *
419
- * Executes parsing, schema validation, and template composition to
420
- * surface input errors quickly. Returns successfully on valid input,
421
- * or throws an error with diagnostic payload on failure.
422
- *
423
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
424
- *
425
- * This is useful for fast feedback loops in LLM-driven document generation.
426
- * @param {string} markdown
418
+ * List registered Quill names
419
+ * @returns {string[]}
427
420
  */
428
- dryRun(markdown) {
421
+ listQuills() {
429
422
  try {
430
423
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
431
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
432
- const len0 = WASM_VECTOR_LEN;
433
- wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
424
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
434
425
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
435
426
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
436
- if (r1) {
437
- throw takeObject(r0);
438
- }
427
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
428
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
429
+ return v1;
439
430
  } finally {
440
431
  wasm.__wbindgen_add_to_stack_pointer(16);
441
432
  }
442
433
  }
434
+ /**
435
+ * Unregister a Quill (free memory)
436
+ * @param {string} name
437
+ */
438
+ unregisterQuill(name) {
439
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
440
+ const len0 = WASM_VECTOR_LEN;
441
+ wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
442
+ }
443
443
  }
444
444
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
445
445
 
Binary file
@@ -2,29 +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_listQuills: (a: number, b: number) => void;
9
5
  export const quillmark_new: () => number;
10
6
  export const quillmark_parseMarkdown: (a: number, b: number, c: number) => void;
11
- export const quillmark_processPlate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
12
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) => void;
13
11
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
12
+ export const quillmark_listQuills: (a: number, b: number) => void;
14
13
  export const quillmark_unregisterQuill: (a: number, b: number, c: number) => void;
15
- export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
16
- 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;
17
16
  export const qcms_white_point_sRGB: (a: number) => void;
18
- export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
19
- export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
20
- 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;
21
18
  export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
22
19
  export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
23
20
  export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
24
- export const lut_interp_linear16: (a: number, b: number, c: number) => number;
25
- export const qcms_enable_iccv4: () => void;
26
- 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;
27
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;
28
28
  export const __wbindgen_export_0: (a: number, b: number) => number;
29
29
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
30
30
  export const __wbindgen_export_2: (a: number) => void;
@@ -6,6 +6,14 @@
6
6
  export function init(): void;
7
7
  export type OutputFormat = "pdf" | "svg" | "txt";
8
8
 
9
+ export type Severity = "error" | "warning" | "note";
10
+
11
+ export interface Location {
12
+ file: string;
13
+ line: number;
14
+ column: number;
15
+ }
16
+
9
17
  export interface Diagnostic {
10
18
  severity: Severity;
11
19
  code?: string;
@@ -15,29 +23,17 @@ export interface Diagnostic {
15
23
  sourceChain: string[];
16
24
  }
17
25
 
18
- export interface RenderResult {
19
- artifacts: Artifact[];
20
- warnings: Diagnostic[];
21
- outputFormat: OutputFormat;
22
- renderTimeMs: number;
23
- }
24
-
25
- export interface Location {
26
- file: string;
27
- line: number;
28
- column: number;
29
- }
30
-
31
26
  export interface Artifact {
32
27
  format: OutputFormat;
33
28
  bytes: Uint8Array;
34
29
  mimeType: string;
35
30
  }
36
31
 
37
- export interface RenderOptions {
38
- format?: OutputFormat;
39
- assets?: Record<string, Uint8Array | number[]>;
40
- quillName?: string;
32
+ export interface RenderResult {
33
+ artifacts: Artifact[];
34
+ warnings: Diagnostic[];
35
+ outputFormat: OutputFormat;
36
+ renderTimeMs: number;
41
37
  }
42
38
 
43
39
  export interface QuillInfo {
@@ -56,7 +52,11 @@ export interface ParsedDocument {
56
52
  quillTag: string;
57
53
  }
58
54
 
59
- export type Severity = "error" | "warning" | "note";
55
+ export interface RenderOptions {
56
+ format?: OutputFormat;
57
+ assets?: Record<string, Uint8Array | number[]>;
58
+ quillName?: string;
59
+ }
60
60
 
61
61
  /**
62
62
  * Quillmark WASM Engine
@@ -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,20 +85,18 @@ 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
- * JavaScript constructor: `new Quillmark()`
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.
106
92
  */
107
- constructor();
93
+ getQuillInfo(name: string): QuillInfo;
108
94
  /**
109
- * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
95
+ * Process markdown through template engine (debugging)
110
96
  *
111
- * Uses the Quill specified in options.quill_name if provided,
112
- * otherwise infers it from the ParsedDocument's quill_tag field.
97
+ * Returns template source code (Typst, LaTeX, etc.)
113
98
  */
114
- render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
99
+ processPlate(quill_name: string, markdown: string): string;
115
100
  /**
116
101
  * Perform a dry run validation without backend compilation.
117
102
  *
@@ -124,4 +109,19 @@ export class Quillmark {
124
109
  * This is useful for fast feedback loops in LLM-driven document generation.
125
110
  */
126
111
  dryRun(markdown: string): void;
112
+ /**
113
+ * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
114
+ *
115
+ * Uses the Quill specified in options.quill_name if provided,
116
+ * otherwise infers it from the ParsedDocument's quill_tag field.
117
+ */
118
+ render(parsed: ParsedDocument, opts: RenderOptions): RenderResult;
119
+ /**
120
+ * List registered Quill names
121
+ */
122
+ listQuills(): string[];
123
+ /**
124
+ * Unregister a Quill (free memory)
125
+ */
126
+ unregisterQuill(name: string): void;
127
127
  }
@@ -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,71 +322,68 @@ export class Quillmark {
318
322
  }
319
323
  }
320
324
  /**
321
- * Parse markdown into a ParsedDocument
325
+ * Process markdown through template engine (debugging)
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__").
327
+ * Returns template source code (Typst, LaTeX, etc.)
328
+ * @param {string} quill_name
325
329
  * @param {string} markdown
326
- * @returns {ParsedDocument}
330
+ * @returns {string}
327
331
  */
328
- static parseMarkdown(markdown) {
332
+ processPlate(quill_name, markdown) {
333
+ let deferred4_0;
334
+ let deferred4_1;
329
335
  try {
330
336
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
331
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
337
+ const ptr0 = passStringToWasm0(quill_name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
332
338
  const len0 = WASM_VECTOR_LEN;
333
- wasm.quillmark_parseMarkdown(retptr, ptr0, len0);
339
+ const ptr1 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
340
+ const len1 = WASM_VECTOR_LEN;
341
+ wasm.quillmark_processPlate(retptr, this.__wbg_ptr, ptr0, len0, ptr1, len1);
334
342
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
335
343
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
336
344
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
337
- if (r2) {
338
- throw takeObject(r1);
345
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
346
+ var ptr3 = r0;
347
+ var len3 = r1;
348
+ if (r3) {
349
+ ptr3 = 0; len3 = 0;
350
+ throw takeObject(r2);
339
351
  }
340
- return takeObject(r0);
352
+ deferred4_0 = ptr3;
353
+ deferred4_1 = len3;
354
+ return getStringFromWasm0(ptr3, len3);
341
355
  } finally {
342
356
  wasm.__wbindgen_add_to_stack_pointer(16);
357
+ wasm.__wbindgen_export_3(deferred4_0, deferred4_1, 1);
343
358
  }
344
359
  }
345
360
  /**
346
- * Register a Quill template bundle
361
+ * Perform a dry run validation without backend compilation.
347
362
  *
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}
363
+ * Executes parsing, schema validation, and template composition to
364
+ * surface input errors quickly. Returns successfully on valid input,
365
+ * or throws an error with diagnostic payload on failure.
366
+ *
367
+ * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
368
+ *
369
+ * This is useful for fast feedback loops in LLM-driven document generation.
370
+ * @param {string} markdown
352
371
  */
353
- registerQuill(quill_json) {
372
+ dryRun(markdown) {
354
373
  try {
355
374
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
356
- wasm.quillmark_registerQuill(retptr, this.__wbg_ptr, addHeapObject(quill_json));
375
+ const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
376
+ const len0 = WASM_VECTOR_LEN;
377
+ wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
357
378
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
358
379
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
359
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
360
- if (r2) {
361
- throw takeObject(r1);
380
+ if (r1) {
381
+ throw takeObject(r0);
362
382
  }
363
- return takeObject(r0);
364
383
  } finally {
365
384
  wasm.__wbindgen_add_to_stack_pointer(16);
366
385
  }
367
386
  }
368
- /**
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
- * JavaScript constructor: `new Quillmark()`
379
- */
380
- constructor() {
381
- const ret = wasm.quillmark_new();
382
- this.__wbg_ptr = ret >>> 0;
383
- QuillmarkFinalization.register(this, this.__wbg_ptr, this);
384
- return this;
385
- }
386
387
  /**
387
388
  * Render a ParsedDocument to final artifacts (PDF, SVG, TXT)
388
389
  *
@@ -408,32 +409,31 @@ export class Quillmark {
408
409
  }
409
410
  }
410
411
  /**
411
- * Perform a dry run validation without backend compilation.
412
- *
413
- * Executes parsing, schema validation, and template composition to
414
- * surface input errors quickly. Returns successfully on valid input,
415
- * or throws an error with diagnostic payload on failure.
416
- *
417
- * The quill name is inferred from the markdown's QUILL tag (or defaults to "__default__").
418
- *
419
- * This is useful for fast feedback loops in LLM-driven document generation.
420
- * @param {string} markdown
412
+ * List registered Quill names
413
+ * @returns {string[]}
421
414
  */
422
- dryRun(markdown) {
415
+ listQuills() {
423
416
  try {
424
417
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
425
- const ptr0 = passStringToWasm0(markdown, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
426
- const len0 = WASM_VECTOR_LEN;
427
- wasm.quillmark_dryRun(retptr, this.__wbg_ptr, ptr0, len0);
418
+ wasm.quillmark_listQuills(retptr, this.__wbg_ptr);
428
419
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
429
420
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
430
- if (r1) {
431
- throw takeObject(r0);
432
- }
421
+ var v1 = getArrayJsValueFromWasm0(r0, r1).slice();
422
+ wasm.__wbindgen_export_3(r0, r1 * 4, 4);
423
+ return v1;
433
424
  } finally {
434
425
  wasm.__wbindgen_add_to_stack_pointer(16);
435
426
  }
436
427
  }
428
+ /**
429
+ * Unregister a Quill (free memory)
430
+ * @param {string} name
431
+ */
432
+ unregisterQuill(name) {
433
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
434
+ const len0 = WASM_VECTOR_LEN;
435
+ wasm.quillmark_unregisterQuill(this.__wbg_ptr, ptr0, len0);
436
+ }
437
437
  }
438
438
  if (Symbol.dispose) Quillmark.prototype[Symbol.dispose] = Quillmark.prototype.free;
439
439
 
Binary file
@@ -2,29 +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_listQuills: (a: number, b: number) => void;
9
5
  export const quillmark_new: () => number;
10
6
  export const quillmark_parseMarkdown: (a: number, b: number, c: number) => void;
11
- export const quillmark_processPlate: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
12
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) => void;
13
11
  export const quillmark_render: (a: number, b: number, c: number, d: number) => void;
12
+ export const quillmark_listQuills: (a: number, b: number) => void;
14
13
  export const quillmark_unregisterQuill: (a: number, b: number, c: number) => void;
15
- export const lut_inverse_interp16: (a: number, b: number, c: number) => number;
16
- 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;
17
16
  export const qcms_white_point_sRGB: (a: number) => void;
18
- export const qcms_transform_data_rgb_out_lut: (a: number, b: number, c: number, d: number) => void;
19
- export const qcms_transform_data_rgba_out_lut: (a: number, b: number, c: number, d: number) => void;
20
- 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;
21
18
  export const qcms_transform_data_rgb_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
22
19
  export const qcms_transform_data_rgba_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
23
20
  export const qcms_transform_data_bgra_out_lut_precache: (a: number, b: number, c: number, d: number) => void;
24
- export const lut_interp_linear16: (a: number, b: number, c: number) => number;
25
- export const qcms_enable_iccv4: () => void;
26
- 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;
27
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;
28
28
  export const __wbindgen_export_0: (a: number, b: number) => number;
29
29
  export const __wbindgen_export_1: (a: number, b: number, c: number, d: number) => number;
30
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.21.0",
3
+ "version": "0.21.1",
4
4
  "description": "WebAssembly bindings for quillmark",
5
5
  "type": "module",
6
6
  "license": "MIT OR Apache-2.0",