@gmb/bitmark-parser 7.6.0 → 7.7.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.
Files changed (43) hide show
  1. package/README.md +54 -1
  2. package/config/bitmark.json +2 -2
  3. package/dist/browser/bitmark-parser.min.js +6 -6
  4. package/dist/browser/bitmark-parser.min.js.map +1 -1
  5. package/dist/browser/cjs/index.cjs +669 -241
  6. package/dist/browser/cjs/index.cjs.map +1 -1
  7. package/dist/browser/cjs/index.d.cts +104 -7
  8. package/dist/browser/esm/index.d.ts +104 -7
  9. package/dist/browser/esm/index.js +668 -241
  10. package/dist/browser/esm/index.js.map +1 -1
  11. package/dist/browser/esm/worker-entry.js +626 -233
  12. package/dist/browser/esm/worker-entry.js.map +1 -1
  13. package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
  14. package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
  15. package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
  16. package/dist/index.cjs +39 -4
  17. package/dist/index.cjs.map +1 -1
  18. package/dist/index.d.cts +104 -7
  19. package/dist/index.d.ts +104 -7
  20. package/dist/index.js +38 -4
  21. package/dist/index.js.map +1 -1
  22. package/dist/legacy.cjs +1 -1
  23. package/dist/legacy.cjs.map +1 -1
  24. package/dist/legacy.js +1 -1
  25. package/dist/legacy.js.map +1 -1
  26. package/dist/worker-entry.cjs.map +1 -1
  27. package/package.json +7 -7
  28. package/schema/bitmark.schema.json +1 -1
  29. package/wasm/bitmark_wasm.d.ts +65 -31
  30. package/wasm/bitmark_wasm.js +288 -122
  31. package/wasm/bitmark_wasm_bg.wasm +0 -0
  32. package/wasm/bitmark_wasm_bg.wasm.d.ts +6 -1
  33. package/wasm/package.json +1 -1
  34. package/wasm-bitmark-json/bitmark_json_wasm.d.ts +72 -38
  35. package/wasm-bitmark-json/bitmark_json_wasm.js +301 -135
  36. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
  37. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +6 -1
  38. package/wasm-bitmark-json/package.json +1 -1
  39. package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +65 -31
  40. package/wasm-browser-full/bitmark_browser_full_wasm.js +288 -122
  41. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
  42. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +6 -1
  43. package/wasm-browser-full/package.json +1 -1
@@ -53,23 +53,6 @@ export function info(info_type: string, format: string, bit: string, pretty: boo
53
53
  * exactly where a consumer must supply the file themselves.
54
54
  */
55
55
  export function register(data_type: string, data: string): void;
56
- /**
57
- * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
58
- *
59
- * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
60
- * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
61
- * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
62
- * the opposite of the resolved input format. The whole-document outputs
63
- * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
64
- * pipeline refuses them and that refusal is what throws.
65
- * `patch_json`: the patch entry array (empty string = no patches, i.e. a
66
- * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
67
- * runs sequentially. Returns `{ "data": <document text/JSON>, "diagnostics":
68
- * [ { "path", "kind", "message" } ] }` — the diagnostics are the entries the
69
- * pipeline skipped (PLAN-209 T9; `kind` is the error contract's identifier,
70
- * e.g. `patch-index-out-of-range`); throws on failure.
71
- */
72
- export function transform(input: string, input_format_sel: string, output_format_sel: string, mode: string, patch_json: string, pretty: boolean, indent: number, spaces_around_values: number): string;
73
56
  /**
74
57
  * Resolve a patch document against `input` (bitmark or JSON) into the
75
58
  * ordered output items, so a JS per-bit planner (hooks, worker pool) can
@@ -109,24 +92,6 @@ export function resolve(input: string, line: number, character: number, position
109
92
  * there is nothing to show (PLAN-196 D8). Arguments as `complete`.
110
93
  */
111
94
  export function hover(input: string, line: number, character: number, position_encoding: string): string;
112
- /**
113
- * Convert between bitmark and JSON with explicit input/output formats + mode.
114
- *
115
- * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
116
- * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
117
- * `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
118
- * `"diagnostics"` (the last three bitmark input only) | a mapping id.
119
- * `mode`: `"optimized"` (default) | `"full"`.
120
- * `mapping_report`: replace the output with a human-readable report of the
121
- * input→output mappings, including inputs that are NOT mapped (PLAN-147).
122
- * `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
123
- * `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
124
- * PLAN-196) — and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
125
- * `semantic-tokens` layout; `""` means the default, and every other output
126
- * format ignores them.
127
- * Returns the converted text/JSON; throws on failure.
128
- */
129
- export function convert(input: string, input_format_sel: string, output_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number, include_unknown_properties: boolean, mapping_report: boolean, position_encoding: string, tokens_layout: string): string;
130
95
  /**
131
96
  * Re-emit input in its own format in canonical form at `mode`.
132
97
  *
@@ -142,10 +107,13 @@ export function count_bits(input: string): string;
142
107
  /**
143
108
  * Split a bitmark document into per-bit source slices.
144
109
  *
145
- * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS
146
- * caller chunk a document at bit boundaries (e.g. to feed a worker pool).
110
+ * Returns a JSON array of `{ index, start, end, byteStart, byteEnd, source }`:
111
+ * `start` / `end` locate `source` in `position_encoding` units (`"utf-16"`
112
+ * default | `"utf-8"`; PLAN-221 D3), `byteStart` / `byteEnd` are the byte
113
+ * partition. Lets a JS caller chunk a document at bit boundaries (e.g. to
114
+ * feed a worker pool).
147
115
  */
148
- export function split_bits(input: string): string;
116
+ export function split_bits(input: string, position_encoding: string): string;
149
117
  /**
150
118
  * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
151
119
  * used across the API so a JS caller can resolve `"auto"` consistently.
@@ -174,3 +142,69 @@ export function prettify(json: string, indent: number): string;
174
142
  * Returns the converted fragment; throws on failure.
175
143
  */
176
144
  export function convert_text(input: string, direction: string, format: string, location: string): string;
145
+ /**
146
+ * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
147
+ *
148
+ * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
149
+ * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
150
+ * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
151
+ * the opposite of the resolved input format. The whole-document outputs
152
+ * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
153
+ * pipeline refuses them and that refusal is what throws.
154
+ * `patch_json`: the patch entry array (empty string = no patches, i.e. a
155
+ * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
156
+ * runs sequentially. Returns `{ "data": <document text/JSON>, "diagnostics":
157
+ * [ { "path", "kind", "message" } ] }` — the diagnostics are the entries the
158
+ * pipeline skipped (PLAN-209 T9; `kind` is the error contract's identifier,
159
+ * e.g. `patch-index-out-of-range`); throws on failure.
160
+ */
161
+ export function transform(input: string, input_format_sel: string, output_format_sel: string, mode: string, patch_json: string, pretty: boolean, indent: number, spaces_around_values: number): string;
162
+ /**
163
+ * Convert between bitmark and JSON with explicit input/output formats + mode.
164
+ *
165
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
166
+ * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
167
+ * `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
168
+ * `"diagnostics"` (the last three bitmark input only) | a mapping id.
169
+ * `mode`: `"optimized"` (default) | `"full"`.
170
+ * `mapping_report`: replace the output with a human-readable report of the
171
+ * input→output mappings, including inputs that are NOT mapped (PLAN-147).
172
+ * `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
173
+ * `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
174
+ * PLAN-196), and that of `convert_with_details`' bit spans (PLAN-221) —
175
+ * and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
176
+ * `semantic-tokens` layout; `""` means the default, and every other output
177
+ * format ignores them.
178
+ * Returns the converted text/JSON; throws on failure.
179
+ */
180
+ export function convert(input: string, input_format_sel: string, output_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number, include_unknown_properties: boolean, mapping_report: boolean, position_encoding: string, tokens_layout: string): string;
181
+ /**
182
+ * [`convert`] plus the extras asked for (PLAN-221 D1a, F7): the same
183
+ * arguments, then one flag per extra — today `bit_spans`. Returns a
184
+ * [`ConvertDetails`] the caller must `free()`; throws as `convert` does.
185
+ */
186
+ export function convert_with_details(input: string, input_format_sel: string, output_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number, include_unknown_properties: boolean, mapping_report: boolean, position_encoding: string, tokens_layout: string, bit_spans: boolean): ConvertDetails;
187
+ /**
188
+ * The result of [`convert_with_details`] (PLAN-221 F7): the output and each
189
+ * extra that was asked for, handed over without a JSON round trip. It lives
190
+ * in wasm memory: the caller must `free()` it. One accessor per extra.
191
+ */
192
+ export class ConvertDetails {
193
+ private constructor();
194
+ free(): void;
195
+ /**
196
+ * The encoding the bit spans' offsets are counted in; `undefined` when
197
+ * not asked for.
198
+ */
199
+ bit_spans_encoding(): string | undefined;
200
+ /**
201
+ * The bit spans, flat `[index, start, end, …]`; `undefined` when not
202
+ * asked for.
203
+ */
204
+ bit_spans(): Uint32Array | undefined;
205
+ /**
206
+ * The converted output, moved out so it crosses to JS once: a second
207
+ * call returns `""`.
208
+ */
209
+ take_data(): string;
210
+ }
@@ -282,66 +282,6 @@ module.exports.register = function(data_type, data) {
282
282
  }
283
283
  };
284
284
 
285
- /**
286
- * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
287
- *
288
- * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
289
- * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
290
- * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
291
- * the opposite of the resolved input format. The whole-document outputs
292
- * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
293
- * pipeline refuses them and that refusal is what throws.
294
- * `patch_json`: the patch entry array (empty string = no patches, i.e. a
295
- * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
296
- * runs sequentially. Returns `{ "data": <document text/JSON>, "diagnostics":
297
- * [ { "path", "kind", "message" } ] }` — the diagnostics are the entries the
298
- * pipeline skipped (PLAN-209 T9; `kind` is the error contract's identifier,
299
- * e.g. `patch-index-out-of-range`); throws on failure.
300
- * @param {string} input
301
- * @param {string} input_format_sel
302
- * @param {string} output_format_sel
303
- * @param {string} mode
304
- * @param {string} patch_json
305
- * @param {boolean} pretty
306
- * @param {number} indent
307
- * @param {number} spaces_around_values
308
- * @returns {string}
309
- */
310
- module.exports.transform = function(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {
311
- let deferred7_0;
312
- let deferred7_1;
313
- try {
314
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
315
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
316
- const len0 = WASM_VECTOR_LEN;
317
- const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
318
- const len1 = WASM_VECTOR_LEN;
319
- const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
320
- const len2 = WASM_VECTOR_LEN;
321
- const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
322
- const len3 = WASM_VECTOR_LEN;
323
- const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
324
- const len4 = WASM_VECTOR_LEN;
325
- wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);
326
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
327
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
328
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
329
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
330
- var ptr6 = r0;
331
- var len6 = r1;
332
- if (r3) {
333
- ptr6 = 0; len6 = 0;
334
- throw takeObject(r2);
335
- }
336
- deferred7_0 = ptr6;
337
- deferred7_1 = len6;
338
- return getStringFromWasm0(ptr6, len6);
339
- } finally {
340
- wasm.__wbindgen_add_to_stack_pointer(16);
341
- wasm.__wbindgen_export_2(deferred7_0, deferred7_1, 1);
342
- }
343
- };
344
-
345
285
  /**
346
286
  * Resolve a patch document against `input` (bitmark or JSON) into the
347
287
  * ordered output items, so a JS per-bit planner (hooks, worker pool) can
@@ -523,72 +463,6 @@ module.exports.hover = function(input, line, character, position_encoding) {
523
463
  }
524
464
  };
525
465
 
526
- /**
527
- * Convert between bitmark and JSON with explicit input/output formats + mode.
528
- *
529
- * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
530
- * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
531
- * `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
532
- * `"diagnostics"` (the last three bitmark input only) | a mapping id.
533
- * `mode`: `"optimized"` (default) | `"full"`.
534
- * `mapping_report`: replace the output with a human-readable report of the
535
- * input→output mappings, including inputs that are NOT mapped (PLAN-147).
536
- * `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
537
- * `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
538
- * PLAN-196) — and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
539
- * `semantic-tokens` layout; `""` means the default, and every other output
540
- * format ignores them.
541
- * Returns the converted text/JSON; throws on failure.
542
- * @param {string} input
543
- * @param {string} input_format_sel
544
- * @param {string} output_format_sel
545
- * @param {string} mode
546
- * @param {boolean} pretty
547
- * @param {number} indent
548
- * @param {number} spaces_around_values
549
- * @param {boolean} include_unknown_properties
550
- * @param {boolean} mapping_report
551
- * @param {string} position_encoding
552
- * @param {string} tokens_layout
553
- * @returns {string}
554
- */
555
- module.exports.convert = function(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, position_encoding, tokens_layout) {
556
- let deferred8_0;
557
- let deferred8_1;
558
- try {
559
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
560
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
561
- const len0 = WASM_VECTOR_LEN;
562
- const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
563
- const len1 = WASM_VECTOR_LEN;
564
- const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
565
- const len2 = WASM_VECTOR_LEN;
566
- const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
567
- const len3 = WASM_VECTOR_LEN;
568
- const ptr4 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
569
- const len4 = WASM_VECTOR_LEN;
570
- const ptr5 = passStringToWasm0(tokens_layout, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
571
- const len5 = WASM_VECTOR_LEN;
572
- wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, ptr4, len4, ptr5, len5);
573
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
574
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
575
- var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
576
- var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
577
- var ptr7 = r0;
578
- var len7 = r1;
579
- if (r3) {
580
- ptr7 = 0; len7 = 0;
581
- throw takeObject(r2);
582
- }
583
- deferred8_0 = ptr7;
584
- deferred8_1 = len7;
585
- return getStringFromWasm0(ptr7, len7);
586
- } finally {
587
- wasm.__wbindgen_add_to_stack_pointer(16);
588
- wasm.__wbindgen_export_2(deferred8_0, deferred8_1, 1);
589
- }
590
- };
591
-
592
466
  /**
593
467
  * Re-emit input in its own format in canonical form at `mode`.
594
468
  *
@@ -669,27 +543,33 @@ module.exports.count_bits = function(input) {
669
543
  /**
670
544
  * Split a bitmark document into per-bit source slices.
671
545
  *
672
- * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS
673
- * caller chunk a document at bit boundaries (e.g. to feed a worker pool).
546
+ * Returns a JSON array of `{ index, start, end, byteStart, byteEnd, source }`:
547
+ * `start` / `end` locate `source` in `position_encoding` units (`"utf-16"`
548
+ * default | `"utf-8"`; PLAN-221 D3), `byteStart` / `byteEnd` are the byte
549
+ * partition. Lets a JS caller chunk a document at bit boundaries (e.g. to
550
+ * feed a worker pool).
674
551
  * @param {string} input
552
+ * @param {string} position_encoding
675
553
  * @returns {string}
676
554
  */
677
- module.exports.split_bits = function(input) {
678
- let deferred2_0;
679
- let deferred2_1;
555
+ module.exports.split_bits = function(input, position_encoding) {
556
+ let deferred3_0;
557
+ let deferred3_1;
680
558
  try {
681
559
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
682
560
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
683
561
  const len0 = WASM_VECTOR_LEN;
684
- wasm.split_bits(retptr, ptr0, len0);
562
+ const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
563
+ const len1 = WASM_VECTOR_LEN;
564
+ wasm.split_bits(retptr, ptr0, len0, ptr1, len1);
685
565
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
686
566
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
687
- deferred2_0 = r0;
688
- deferred2_1 = r1;
567
+ deferred3_0 = r0;
568
+ deferred3_1 = r1;
689
569
  return getStringFromWasm0(r0, r1);
690
570
  } finally {
691
571
  wasm.__wbindgen_add_to_stack_pointer(16);
692
- wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
572
+ wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
693
573
  }
694
574
  };
695
575
 
@@ -815,11 +695,297 @@ module.exports.convert_text = function(input, direction, format, location) {
815
695
  }
816
696
  };
817
697
 
698
+ /**
699
+ * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
700
+ *
701
+ * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
702
+ * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
703
+ * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
704
+ * the opposite of the resolved input format. The whole-document outputs
705
+ * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
706
+ * pipeline refuses them and that refusal is what throws.
707
+ * `patch_json`: the patch entry array (empty string = no patches, i.e. a
708
+ * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
709
+ * runs sequentially. Returns `{ "data": <document text/JSON>, "diagnostics":
710
+ * [ { "path", "kind", "message" } ] }` — the diagnostics are the entries the
711
+ * pipeline skipped (PLAN-209 T9; `kind` is the error contract's identifier,
712
+ * e.g. `patch-index-out-of-range`); throws on failure.
713
+ * @param {string} input
714
+ * @param {string} input_format_sel
715
+ * @param {string} output_format_sel
716
+ * @param {string} mode
717
+ * @param {string} patch_json
718
+ * @param {boolean} pretty
719
+ * @param {number} indent
720
+ * @param {number} spaces_around_values
721
+ * @returns {string}
722
+ */
723
+ module.exports.transform = function(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {
724
+ let deferred7_0;
725
+ let deferred7_1;
726
+ try {
727
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
728
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
729
+ const len0 = WASM_VECTOR_LEN;
730
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
731
+ const len1 = WASM_VECTOR_LEN;
732
+ const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
733
+ const len2 = WASM_VECTOR_LEN;
734
+ const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
735
+ const len3 = WASM_VECTOR_LEN;
736
+ const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
737
+ const len4 = WASM_VECTOR_LEN;
738
+ wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);
739
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
740
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
741
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
742
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
743
+ var ptr6 = r0;
744
+ var len6 = r1;
745
+ if (r3) {
746
+ ptr6 = 0; len6 = 0;
747
+ throw takeObject(r2);
748
+ }
749
+ deferred7_0 = ptr6;
750
+ deferred7_1 = len6;
751
+ return getStringFromWasm0(ptr6, len6);
752
+ } finally {
753
+ wasm.__wbindgen_add_to_stack_pointer(16);
754
+ wasm.__wbindgen_export_2(deferred7_0, deferred7_1, 1);
755
+ }
756
+ };
757
+
758
+ /**
759
+ * Convert between bitmark and JSON with explicit input/output formats + mode.
760
+ *
761
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
762
+ * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
763
+ * `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
764
+ * `"diagnostics"` (the last three bitmark input only) | a mapping id.
765
+ * `mode`: `"optimized"` (default) | `"full"`.
766
+ * `mapping_report`: replace the output with a human-readable report of the
767
+ * input→output mappings, including inputs that are NOT mapped (PLAN-147).
768
+ * `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
769
+ * `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
770
+ * PLAN-196), and that of `convert_with_details`' bit spans (PLAN-221) —
771
+ * and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
772
+ * `semantic-tokens` layout; `""` means the default, and every other output
773
+ * format ignores them.
774
+ * Returns the converted text/JSON; throws on failure.
775
+ * @param {string} input
776
+ * @param {string} input_format_sel
777
+ * @param {string} output_format_sel
778
+ * @param {string} mode
779
+ * @param {boolean} pretty
780
+ * @param {number} indent
781
+ * @param {number} spaces_around_values
782
+ * @param {boolean} include_unknown_properties
783
+ * @param {boolean} mapping_report
784
+ * @param {string} position_encoding
785
+ * @param {string} tokens_layout
786
+ * @returns {string}
787
+ */
788
+ module.exports.convert = function(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, position_encoding, tokens_layout) {
789
+ let deferred8_0;
790
+ let deferred8_1;
791
+ try {
792
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
793
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
794
+ const len0 = WASM_VECTOR_LEN;
795
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
796
+ const len1 = WASM_VECTOR_LEN;
797
+ const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
798
+ const len2 = WASM_VECTOR_LEN;
799
+ const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
800
+ const len3 = WASM_VECTOR_LEN;
801
+ const ptr4 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
802
+ const len4 = WASM_VECTOR_LEN;
803
+ const ptr5 = passStringToWasm0(tokens_layout, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
804
+ const len5 = WASM_VECTOR_LEN;
805
+ wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, ptr4, len4, ptr5, len5);
806
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
807
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
808
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
809
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
810
+ var ptr7 = r0;
811
+ var len7 = r1;
812
+ if (r3) {
813
+ ptr7 = 0; len7 = 0;
814
+ throw takeObject(r2);
815
+ }
816
+ deferred8_0 = ptr7;
817
+ deferred8_1 = len7;
818
+ return getStringFromWasm0(ptr7, len7);
819
+ } finally {
820
+ wasm.__wbindgen_add_to_stack_pointer(16);
821
+ wasm.__wbindgen_export_2(deferred8_0, deferred8_1, 1);
822
+ }
823
+ };
824
+
825
+ /**
826
+ * [`convert`] plus the extras asked for (PLAN-221 D1a, F7): the same
827
+ * arguments, then one flag per extra — today `bit_spans`. Returns a
828
+ * [`ConvertDetails`] the caller must `free()`; throws as `convert` does.
829
+ * @param {string} input
830
+ * @param {string} input_format_sel
831
+ * @param {string} output_format_sel
832
+ * @param {string} mode
833
+ * @param {boolean} pretty
834
+ * @param {number} indent
835
+ * @param {number} spaces_around_values
836
+ * @param {boolean} include_unknown_properties
837
+ * @param {boolean} mapping_report
838
+ * @param {string} position_encoding
839
+ * @param {string} tokens_layout
840
+ * @param {boolean} bit_spans
841
+ * @returns {ConvertDetails}
842
+ */
843
+ module.exports.convert_with_details = function(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, position_encoding, tokens_layout, bit_spans) {
844
+ try {
845
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
846
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
847
+ const len0 = WASM_VECTOR_LEN;
848
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
849
+ const len1 = WASM_VECTOR_LEN;
850
+ const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
851
+ const len2 = WASM_VECTOR_LEN;
852
+ const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
853
+ const len3 = WASM_VECTOR_LEN;
854
+ const ptr4 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
855
+ const len4 = WASM_VECTOR_LEN;
856
+ const ptr5 = passStringToWasm0(tokens_layout, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
857
+ const len5 = WASM_VECTOR_LEN;
858
+ wasm.convert_with_details(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, ptr4, len4, ptr5, len5, bit_spans);
859
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
860
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
861
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
862
+ if (r2) {
863
+ throw takeObject(r1);
864
+ }
865
+ return ConvertDetails.__wrap(r0);
866
+ } finally {
867
+ wasm.__wbindgen_add_to_stack_pointer(16);
868
+ }
869
+ };
870
+
871
+ let cachedUint32ArrayMemory0 = null;
872
+
873
+ function getUint32ArrayMemory0() {
874
+ if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
875
+ cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
876
+ }
877
+ return cachedUint32ArrayMemory0;
878
+ }
879
+
880
+ function getArrayU32FromWasm0(ptr, len) {
881
+ ptr = ptr >>> 0;
882
+ return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
883
+ }
884
+
885
+ const ConvertDetailsFinalization = (typeof FinalizationRegistry === 'undefined')
886
+ ? { register: () => {}, unregister: () => {} }
887
+ : new FinalizationRegistry(ptr => wasm.__wbg_convertdetails_free(ptr >>> 0, 1));
888
+ /**
889
+ * The result of [`convert_with_details`] (PLAN-221 F7): the output and each
890
+ * extra that was asked for, handed over without a JSON round trip. It lives
891
+ * in wasm memory: the caller must `free()` it. One accessor per extra.
892
+ */
893
+ class ConvertDetails {
894
+
895
+ static __wrap(ptr) {
896
+ ptr = ptr >>> 0;
897
+ const obj = Object.create(ConvertDetails.prototype);
898
+ obj.__wbg_ptr = ptr;
899
+ ConvertDetailsFinalization.register(obj, obj.__wbg_ptr, obj);
900
+ return obj;
901
+ }
902
+
903
+ __destroy_into_raw() {
904
+ const ptr = this.__wbg_ptr;
905
+ this.__wbg_ptr = 0;
906
+ ConvertDetailsFinalization.unregister(this);
907
+ return ptr;
908
+ }
909
+
910
+ free() {
911
+ const ptr = this.__destroy_into_raw();
912
+ wasm.__wbg_convertdetails_free(ptr, 0);
913
+ }
914
+ /**
915
+ * The encoding the bit spans' offsets are counted in; `undefined` when
916
+ * not asked for.
917
+ * @returns {string | undefined}
918
+ */
919
+ bit_spans_encoding() {
920
+ try {
921
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
922
+ wasm.convertdetails_bit_spans_encoding(retptr, this.__wbg_ptr);
923
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
924
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
925
+ let v1;
926
+ if (r0 !== 0) {
927
+ v1 = getStringFromWasm0(r0, r1).slice();
928
+ wasm.__wbindgen_export_2(r0, r1 * 1, 1);
929
+ }
930
+ return v1;
931
+ } finally {
932
+ wasm.__wbindgen_add_to_stack_pointer(16);
933
+ }
934
+ }
935
+ /**
936
+ * The bit spans, flat `[index, start, end, …]`; `undefined` when not
937
+ * asked for.
938
+ * @returns {Uint32Array | undefined}
939
+ */
940
+ bit_spans() {
941
+ try {
942
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
943
+ wasm.convertdetails_bit_spans(retptr, this.__wbg_ptr);
944
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
945
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
946
+ let v1;
947
+ if (r0 !== 0) {
948
+ v1 = getArrayU32FromWasm0(r0, r1).slice();
949
+ wasm.__wbindgen_export_2(r0, r1 * 4, 4);
950
+ }
951
+ return v1;
952
+ } finally {
953
+ wasm.__wbindgen_add_to_stack_pointer(16);
954
+ }
955
+ }
956
+ /**
957
+ * The converted output, moved out so it crosses to JS once: a second
958
+ * call returns `""`.
959
+ * @returns {string}
960
+ */
961
+ take_data() {
962
+ let deferred1_0;
963
+ let deferred1_1;
964
+ try {
965
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
966
+ wasm.convertdetails_take_data(retptr, this.__wbg_ptr);
967
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
968
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
969
+ deferred1_0 = r0;
970
+ deferred1_1 = r1;
971
+ return getStringFromWasm0(r0, r1);
972
+ } finally {
973
+ wasm.__wbindgen_add_to_stack_pointer(16);
974
+ wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
975
+ }
976
+ }
977
+ }
978
+ module.exports.ConvertDetails = ConvertDetails;
979
+
818
980
  module.exports.__wbindgen_error_new = function(arg0, arg1) {
819
981
  const ret = new Error(getStringFromWasm0(arg0, arg1));
820
982
  return addHeapObject(ret);
821
983
  };
822
984
 
985
+ module.exports.__wbindgen_throw = function(arg0, arg1) {
986
+ throw new Error(getStringFromWasm0(arg0, arg1));
987
+ };
988
+
823
989
  const path = require('path').join(__dirname, 'bitmark_json_wasm_bg.wasm');
824
990
  const bytes = require('fs').readFileSync(path);
825
991
 
@@ -1,11 +1,16 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
+ export const __wbg_convertdetails_free: (a: number, b: number) => void;
4
5
  export const breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
5
6
  export const canonicalize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
6
7
  export const complete: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
7
8
  export const convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number) => void;
8
9
  export const convert_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
10
+ export const convert_with_details: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number, o: number, p: number, q: number, r: number, s: number) => void;
11
+ export const convertdetails_bit_spans: (a: number, b: number) => void;
12
+ export const convertdetails_bit_spans_encoding: (a: number, b: number) => void;
13
+ export const convertdetails_take_data: (a: number, b: number) => void;
9
14
  export const count_bits: (a: number, b: number, c: number) => void;
10
15
  export const hover: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
11
16
  export const info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => void;
@@ -14,7 +19,7 @@ export const prettify: (a: number, b: number, c: number, d: number) => void;
14
19
  export const register: (a: number, b: number, c: number, d: number, e: number) => void;
15
20
  export const resolve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
16
21
  export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
17
- export const split_bits: (a: number, b: number, c: number) => void;
22
+ export const split_bits: (a: number, b: number, c: number, d: number, e: number) => void;
18
23
  export const split_json_bits: (a: number, b: number, c: number) => void;
19
24
  export const transform: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => void;
20
25
  export const unbreakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
@@ -4,7 +4,7 @@
4
4
  "Get More Brain Ltd <info@getmorebrain.com>"
5
5
  ],
6
6
  "description": "WebAssembly bindings for the bitmark parser",
7
- "version": "7.6.0",
7
+ "version": "7.7.0",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",