@gmb/bitmark-parser 6.0.1 → 6.1.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.
@@ -1,25 +1,37 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Unbreakscape text (unescape bitmark special characters).
4
+ * Re-emit input in its own format in canonical form at `mode`.
5
+ */
6
+ export function canonicalize(input: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number): string;
7
+ /**
8
+ * Re-emit input in its own format at full mode (all keys).
9
+ */
10
+ export function fullize(input: string, pretty: boolean, indent: number): string;
11
+ /**
12
+ * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
5
13
  *
6
- * `format`: `"bitmark++"` (default) or `"plainText"`
7
- * `location`: `"body"` (default) or `"tag"`
14
+ * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
15
+ * `output_format_sel`: `"bitmark"` | `"json"` (default json).
16
+ * `patch_json`: the patch entry array (empty string = no patches, i.e. a
17
+ * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
18
+ * runs sequentially. Returns the document text/JSON, or `error: …`.
8
19
  */
9
- export function unbreakscape_text(input: string, format: string, location: string): string;
20
+ 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;
10
21
  /**
11
- * Auto-detect input format and convert between bitmark and JSON.
22
+ * Split a bitmark document into per-bit source slices.
12
23
  *
13
- * `mode`: `"optimized"` (default) or `"full"`
14
- * `warnings`: whether to include validation warnings (default: false)
15
- * `plain_text`: output text as plain text — debug mode (default: false)
16
- * `pretty`: prettify JSON output (default: false)
17
- * `indent`: indent size for pretty-printing (default: 2)
24
+ * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS
25
+ * caller chunk a document at bit boundaries (e.g. to feed a worker pool).
26
+ */
27
+ export function split_bits(input: string): string;
28
+ /**
29
+ * Breakscape text (escape bitmark special characters).
18
30
  *
19
- * Returns JSON if input is bitmark, or an error message if input is JSON
20
- * (generator not yet implemented).
31
+ * `format`: `"bitmark++"` (default) or `"plainText"`
32
+ * `location`: `"body"` (default) or `"tag"`
21
33
  */
22
- export function convert(input: string, mode: string, warnings: boolean, plain_text: boolean, pretty: boolean, indent: number): string;
34
+ export function breakscape_text(input: string, format: string, location: string): string;
23
35
  /**
24
36
  * Lex bitmark input text, returning one line per token in the same format as
25
37
  * the Rust CLI: `{kind:?} {span:?} "{text}"`.
@@ -30,12 +42,28 @@ export function convert(input: string, mode: string, warnings: boolean, plain_te
30
42
  */
31
43
  export function lex(input: string, stage: string): string;
32
44
  /**
33
- * Breakscape text (escape bitmark special characters).
45
+ * Split a JSON document (a top-level array of bit envelopes) into its per-bit
46
+ * envelope objects, returned as a JSON array string. Lets a JS caller iterate
47
+ * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).
48
+ * Returns `error: …` if the input is not a JSON array of bits.
49
+ */
50
+ export function split_json_bits(input: string): string;
51
+ /**
52
+ * Unbreakscape text (unescape bitmark special characters).
34
53
  *
35
54
  * `format`: `"bitmark++"` (default) or `"plainText"`
36
55
  * `location`: `"body"` (default) or `"tag"`
37
56
  */
38
- export function breakscape_text(input: string, format: string, location: string): string;
57
+ export function unbreakscape_text(input: string, format: string, location: string): string;
58
+ /**
59
+ * Count the bits in `input` (auto-detecting bitmark vs JSON).
60
+ * Returns the count as a decimal string, or `error: …`.
61
+ */
62
+ export function count_bits(input: string): string;
63
+ /**
64
+ * Re-emit input in its own format at optimized mode (omit natural defaults).
65
+ */
66
+ export function optimize(input: string, pretty: boolean, indent: number): string;
39
67
  /**
40
68
  * Query information about supported bit types.
41
69
  *
@@ -54,3 +82,23 @@ export function info(info_type: string, format: string, bit: string, pretty: boo
54
82
  * `mode`: `"optimized"` (default) or `"full"`
55
83
  */
56
84
  export function parse(input: string, mode: string): string;
85
+ /**
86
+ * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
87
+ * used across the API so a JS caller can resolve `"auto"` consistently.
88
+ */
89
+ export function is_bitmark(input: string): boolean;
90
+ /**
91
+ * Pretty-print a compact JSON string with the given indent. Used to format a
92
+ * document recombined on the JS side (the per-bit hook path) so its output
93
+ * matches the in-Rust recombination byte-for-byte.
94
+ */
95
+ export function prettify(json: string, indent: number): string;
96
+ /**
97
+ * Convert between bitmark and JSON with explicit input/output formats + mode.
98
+ *
99
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"`.
100
+ * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"`.
101
+ * `mode`: `"optimized"` (default) | `"full"`.
102
+ * Returns the converted text/JSON, or a string prefixed `error:` on failure.
103
+ */
104
+ export function convert(input: string, input_format_sel: string, output_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number): string;
@@ -86,75 +86,163 @@ function getStringFromWasm0(ptr, len) {
86
86
  return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
87
87
  }
88
88
  /**
89
- * Unbreakscape text (unescape bitmark special characters).
90
- *
91
- * `format`: `"bitmark++"` (default) or `"plainText"`
92
- * `location`: `"body"` (default) or `"tag"`
89
+ * Re-emit input in its own format in canonical form at `mode`.
93
90
  * @param {string} input
94
- * @param {string} format
95
- * @param {string} location
91
+ * @param {string} mode
92
+ * @param {boolean} pretty
93
+ * @param {number} indent
94
+ * @param {number} spaces_around_values
96
95
  * @returns {string}
97
96
  */
98
- module.exports.unbreakscape_text = function(input, format, location) {
99
- let deferred4_0;
100
- let deferred4_1;
97
+ module.exports.canonicalize = function(input, mode, pretty, indent, spaces_around_values) {
98
+ let deferred3_0;
99
+ let deferred3_1;
101
100
  try {
102
101
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
103
102
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
104
103
  const len0 = WASM_VECTOR_LEN;
105
- const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
104
+ const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
106
105
  const len1 = WASM_VECTOR_LEN;
107
- const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
108
- const len2 = WASM_VECTOR_LEN;
109
- wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
106
+ wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, pretty, indent, spaces_around_values);
110
107
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
111
108
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
112
- deferred4_0 = r0;
113
- deferred4_1 = r1;
109
+ deferred3_0 = r0;
110
+ deferred3_1 = r1;
114
111
  return getStringFromWasm0(r0, r1);
115
112
  } finally {
116
113
  wasm.__wbindgen_add_to_stack_pointer(16);
117
- wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
114
+ wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
118
115
  }
119
116
  };
120
117
 
121
118
  /**
122
- * Auto-detect input format and convert between bitmark and JSON.
123
- *
124
- * `mode`: `"optimized"` (default) or `"full"`
125
- * `warnings`: whether to include validation warnings (default: false)
126
- * `plain_text`: output text as plain text — debug mode (default: false)
127
- * `pretty`: prettify JSON output (default: false)
128
- * `indent`: indent size for pretty-printing (default: 2)
119
+ * Re-emit input in its own format at full mode (all keys).
120
+ * @param {string} input
121
+ * @param {boolean} pretty
122
+ * @param {number} indent
123
+ * @returns {string}
124
+ */
125
+ module.exports.fullize = function(input, pretty, indent) {
126
+ let deferred2_0;
127
+ let deferred2_1;
128
+ try {
129
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
130
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
131
+ const len0 = WASM_VECTOR_LEN;
132
+ wasm.fullize(retptr, ptr0, len0, pretty, indent);
133
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
134
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
135
+ deferred2_0 = r0;
136
+ deferred2_1 = r1;
137
+ return getStringFromWasm0(r0, r1);
138
+ } finally {
139
+ wasm.__wbindgen_add_to_stack_pointer(16);
140
+ wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
141
+ }
142
+ };
143
+
144
+ /**
145
+ * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
129
146
  *
130
- * Returns JSON if input is bitmark, or an error message if input is JSON
131
- * (generator not yet implemented).
147
+ * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
148
+ * `output_format_sel`: `"bitmark"` | `"json"` (default json).
149
+ * `patch_json`: the patch entry array (empty string = no patches, i.e. a
150
+ * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
151
+ * runs sequentially. Returns the document text/JSON, or `error: …`.
132
152
  * @param {string} input
153
+ * @param {string} input_format_sel
154
+ * @param {string} output_format_sel
133
155
  * @param {string} mode
134
- * @param {boolean} warnings
135
- * @param {boolean} plain_text
156
+ * @param {string} patch_json
136
157
  * @param {boolean} pretty
137
158
  * @param {number} indent
159
+ * @param {number} spaces_around_values
138
160
  * @returns {string}
139
161
  */
140
- module.exports.convert = function(input, mode, warnings, plain_text, pretty, indent) {
141
- let deferred3_0;
142
- let deferred3_1;
162
+ module.exports.transform = function(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {
163
+ let deferred6_0;
164
+ let deferred6_1;
143
165
  try {
144
166
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
145
167
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
146
168
  const len0 = WASM_VECTOR_LEN;
147
- const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
169
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
148
170
  const len1 = WASM_VECTOR_LEN;
149
- wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
171
+ const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
172
+ const len2 = WASM_VECTOR_LEN;
173
+ const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
174
+ const len3 = WASM_VECTOR_LEN;
175
+ const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
176
+ const len4 = WASM_VECTOR_LEN;
177
+ wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);
150
178
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
151
179
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
152
- deferred3_0 = r0;
153
- deferred3_1 = r1;
180
+ deferred6_0 = r0;
181
+ deferred6_1 = r1;
154
182
  return getStringFromWasm0(r0, r1);
155
183
  } finally {
156
184
  wasm.__wbindgen_add_to_stack_pointer(16);
157
- wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
185
+ wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
186
+ }
187
+ };
188
+
189
+ /**
190
+ * Split a bitmark document into per-bit source slices.
191
+ *
192
+ * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS
193
+ * caller chunk a document at bit boundaries (e.g. to feed a worker pool).
194
+ * @param {string} input
195
+ * @returns {string}
196
+ */
197
+ module.exports.split_bits = function(input) {
198
+ let deferred2_0;
199
+ let deferred2_1;
200
+ try {
201
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
202
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
203
+ const len0 = WASM_VECTOR_LEN;
204
+ wasm.split_bits(retptr, ptr0, len0);
205
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
206
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
207
+ deferred2_0 = r0;
208
+ deferred2_1 = r1;
209
+ return getStringFromWasm0(r0, r1);
210
+ } finally {
211
+ wasm.__wbindgen_add_to_stack_pointer(16);
212
+ wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
213
+ }
214
+ };
215
+
216
+ /**
217
+ * Breakscape text (escape bitmark special characters).
218
+ *
219
+ * `format`: `"bitmark++"` (default) or `"plainText"`
220
+ * `location`: `"body"` (default) or `"tag"`
221
+ * @param {string} input
222
+ * @param {string} format
223
+ * @param {string} location
224
+ * @returns {string}
225
+ */
226
+ module.exports.breakscape_text = function(input, format, location) {
227
+ let deferred4_0;
228
+ let deferred4_1;
229
+ try {
230
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
231
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
232
+ const len0 = WASM_VECTOR_LEN;
233
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
234
+ const len1 = WASM_VECTOR_LEN;
235
+ const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
236
+ const len2 = WASM_VECTOR_LEN;
237
+ wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
238
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
239
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
240
+ deferred4_0 = r0;
241
+ deferred4_1 = r1;
242
+ return getStringFromWasm0(r0, r1);
243
+ } finally {
244
+ wasm.__wbindgen_add_to_stack_pointer(16);
245
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
158
246
  }
159
247
  };
160
248
 
@@ -191,7 +279,34 @@ module.exports.lex = function(input, stage) {
191
279
  };
192
280
 
193
281
  /**
194
- * Breakscape text (escape bitmark special characters).
282
+ * Split a JSON document (a top-level array of bit envelopes) into its per-bit
283
+ * envelope objects, returned as a JSON array string. Lets a JS caller iterate
284
+ * JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).
285
+ * Returns `error: …` if the input is not a JSON array of bits.
286
+ * @param {string} input
287
+ * @returns {string}
288
+ */
289
+ module.exports.split_json_bits = function(input) {
290
+ let deferred2_0;
291
+ let deferred2_1;
292
+ try {
293
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
294
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
295
+ const len0 = WASM_VECTOR_LEN;
296
+ wasm.split_json_bits(retptr, ptr0, len0);
297
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
298
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
299
+ deferred2_0 = r0;
300
+ deferred2_1 = r1;
301
+ return getStringFromWasm0(r0, r1);
302
+ } finally {
303
+ wasm.__wbindgen_add_to_stack_pointer(16);
304
+ wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
305
+ }
306
+ };
307
+
308
+ /**
309
+ * Unbreakscape text (unescape bitmark special characters).
195
310
  *
196
311
  * `format`: `"bitmark++"` (default) or `"plainText"`
197
312
  * `location`: `"body"` (default) or `"tag"`
@@ -200,7 +315,7 @@ module.exports.lex = function(input, stage) {
200
315
  * @param {string} location
201
316
  * @returns {string}
202
317
  */
203
- module.exports.breakscape_text = function(input, format, location) {
318
+ module.exports.unbreakscape_text = function(input, format, location) {
204
319
  let deferred4_0;
205
320
  let deferred4_1;
206
321
  try {
@@ -211,7 +326,7 @@ module.exports.breakscape_text = function(input, format, location) {
211
326
  const len1 = WASM_VECTOR_LEN;
212
327
  const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
213
328
  const len2 = WASM_VECTOR_LEN;
214
- wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
329
+ wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
215
330
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
216
331
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
217
332
  deferred4_0 = r0;
@@ -223,6 +338,57 @@ module.exports.breakscape_text = function(input, format, location) {
223
338
  }
224
339
  };
225
340
 
341
+ /**
342
+ * Count the bits in `input` (auto-detecting bitmark vs JSON).
343
+ * Returns the count as a decimal string, or `error: …`.
344
+ * @param {string} input
345
+ * @returns {string}
346
+ */
347
+ module.exports.count_bits = function(input) {
348
+ let deferred2_0;
349
+ let deferred2_1;
350
+ try {
351
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
352
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
353
+ const len0 = WASM_VECTOR_LEN;
354
+ wasm.count_bits(retptr, ptr0, len0);
355
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
356
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
357
+ deferred2_0 = r0;
358
+ deferred2_1 = r1;
359
+ return getStringFromWasm0(r0, r1);
360
+ } finally {
361
+ wasm.__wbindgen_add_to_stack_pointer(16);
362
+ wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
363
+ }
364
+ };
365
+
366
+ /**
367
+ * Re-emit input in its own format at optimized mode (omit natural defaults).
368
+ * @param {string} input
369
+ * @param {boolean} pretty
370
+ * @param {number} indent
371
+ * @returns {string}
372
+ */
373
+ module.exports.optimize = function(input, pretty, indent) {
374
+ let deferred2_0;
375
+ let deferred2_1;
376
+ try {
377
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
378
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
379
+ const len0 = WASM_VECTOR_LEN;
380
+ wasm.optimize(retptr, ptr0, len0, pretty, indent);
381
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
382
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
383
+ deferred2_0 = r0;
384
+ deferred2_1 = r1;
385
+ return getStringFromWasm0(r0, r1);
386
+ } finally {
387
+ wasm.__wbindgen_add_to_stack_pointer(16);
388
+ wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
389
+ }
390
+ };
391
+
226
392
  /**
227
393
  * Query information about supported bit types.
228
394
  *
@@ -292,6 +458,87 @@ module.exports.parse = function(input, mode) {
292
458
  }
293
459
  };
294
460
 
461
+ /**
462
+ * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
463
+ * used across the API so a JS caller can resolve `"auto"` consistently.
464
+ * @param {string} input
465
+ * @returns {boolean}
466
+ */
467
+ module.exports.is_bitmark = function(input) {
468
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
469
+ const len0 = WASM_VECTOR_LEN;
470
+ const ret = wasm.is_bitmark(ptr0, len0);
471
+ return ret !== 0;
472
+ };
473
+
474
+ /**
475
+ * Pretty-print a compact JSON string with the given indent. Used to format a
476
+ * document recombined on the JS side (the per-bit hook path) so its output
477
+ * matches the in-Rust recombination byte-for-byte.
478
+ * @param {string} json
479
+ * @param {number} indent
480
+ * @returns {string}
481
+ */
482
+ module.exports.prettify = function(json, indent) {
483
+ let deferred2_0;
484
+ let deferred2_1;
485
+ try {
486
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
487
+ const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
488
+ const len0 = WASM_VECTOR_LEN;
489
+ wasm.prettify(retptr, ptr0, len0, indent);
490
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
491
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
492
+ deferred2_0 = r0;
493
+ deferred2_1 = r1;
494
+ return getStringFromWasm0(r0, r1);
495
+ } finally {
496
+ wasm.__wbindgen_add_to_stack_pointer(16);
497
+ wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
498
+ }
499
+ };
500
+
501
+ /**
502
+ * Convert between bitmark and JSON with explicit input/output formats + mode.
503
+ *
504
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"`.
505
+ * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"`.
506
+ * `mode`: `"optimized"` (default) | `"full"`.
507
+ * Returns the converted text/JSON, or a string prefixed `error:` on failure.
508
+ * @param {string} input
509
+ * @param {string} input_format_sel
510
+ * @param {string} output_format_sel
511
+ * @param {string} mode
512
+ * @param {boolean} pretty
513
+ * @param {number} indent
514
+ * @param {number} spaces_around_values
515
+ * @returns {string}
516
+ */
517
+ module.exports.convert = function(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values) {
518
+ let deferred5_0;
519
+ let deferred5_1;
520
+ try {
521
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
522
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
523
+ const len0 = WASM_VECTOR_LEN;
524
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
525
+ const len1 = WASM_VECTOR_LEN;
526
+ const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
527
+ const len2 = WASM_VECTOR_LEN;
528
+ const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
529
+ const len3 = WASM_VECTOR_LEN;
530
+ wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values);
531
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
532
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
533
+ deferred5_0 = r0;
534
+ deferred5_1 = r1;
535
+ return getStringFromWasm0(r0, r1);
536
+ } finally {
537
+ wasm.__wbindgen_add_to_stack_pointer(16);
538
+ wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
539
+ }
540
+ };
541
+
295
542
  const path = require('path').join(__dirname, 'bitmark_wasm_bg.wasm');
296
543
  const bytes = require('fs').readFileSync(path);
297
544
 
Binary file
@@ -2,10 +2,19 @@
2
2
  /* eslint-disable */
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
5
- export const convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
5
+ export const canonicalize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
6
+ 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) => void;
7
+ export const count_bits: (a: number, b: number, c: number) => void;
8
+ export const fullize: (a: number, b: number, c: number, d: number, e: number) => void;
6
9
  export const info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
10
+ export const is_bitmark: (a: number, b: number) => number;
7
11
  export const lex: (a: number, b: number, c: number, d: number, e: number) => void;
12
+ export const optimize: (a: number, b: number, c: number, d: number, e: number) => void;
8
13
  export const parse: (a: number, b: number, c: number, d: number, e: number) => void;
14
+ export const prettify: (a: number, b: number, c: number, d: number) => void;
15
+ export const split_bits: (a: number, b: number, c: number) => void;
16
+ export const split_json_bits: (a: number, b: number, c: number) => void;
17
+ 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;
9
18
  export const unbreakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
10
19
  export const __wbindgen_add_to_stack_pointer: (a: number) => number;
11
20
  export const __wbindgen_export_0: (a: number, b: number) => number;
package/wasm/package.json CHANGED
@@ -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": "6.0.1",
7
+ "version": "6.1.1",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",
@@ -17,4 +17,4 @@
17
17
  ],
18
18
  "main": "bitmark_wasm.js",
19
19
  "types": "bitmark_wasm.d.ts"
20
- }
20
+ }