@gmb/bitmark-parser 6.2.0 → 6.3.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/README.md +139 -58
- package/dist/browser/bitmark-parser.min.js +4 -4
- package/dist/browser/bitmark-parser.min.js.map +1 -1
- package/dist/browser/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/cjs/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/cjs/index.cjs +161 -193
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +157 -119
- package/dist/browser/esm/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/esm/index.d.ts +157 -119
- package/dist/browser/esm/index.js +159 -187
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js.map +1 -1
- package/dist/index.cjs +92 -66
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1921 -300
- package/dist/index.d.ts +1921 -300
- package/dist/index.js +90 -59
- package/dist/index.js.map +1 -1
- package/dist/legacy.cjs +73 -34
- package/dist/legacy.cjs.map +1 -1
- package/dist/legacy.d.cts +43 -16
- package/dist/legacy.d.ts +43 -16
- package/dist/legacy.js +73 -34
- package/dist/legacy.js.map +1 -1
- package/package.json +8 -7
- package/wasm/bitmark_wasm.d.ts +31 -53
- package/wasm/bitmark_wasm.js +115 -209
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +1 -4
- package/wasm/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
@@ -22,21 +22,17 @@ var __publicField = (obj, key, value) => __defNormalProp(obj, typeof key !== "sy
|
|
|
22
22
|
// src/browser/index.ts
|
|
23
23
|
var index_exports = {};
|
|
24
24
|
__export(index_exports, {
|
|
25
|
+
bitmarkToObjects: () => bitmarkToObjects,
|
|
25
26
|
breakscapeText: () => breakscapeText,
|
|
26
27
|
canonicalize: () => canonicalize2,
|
|
27
28
|
convert: () => convert2,
|
|
28
29
|
countBits: () => countBits,
|
|
29
|
-
expand: () => expand,
|
|
30
|
-
fullize: () => fullize2,
|
|
31
|
-
generateBits: () => generateBits,
|
|
32
30
|
info: () => info2,
|
|
33
31
|
init: () => init,
|
|
34
32
|
initSync: () => initSync,
|
|
35
33
|
legacy: () => legacy_exports,
|
|
36
34
|
lex: () => lex2,
|
|
37
|
-
|
|
38
|
-
parse: () => parse2,
|
|
39
|
-
parseBits: () => parseBits,
|
|
35
|
+
objectsToBitmark: () => objectsToBitmark,
|
|
40
36
|
patchEntry: () => patchEntry,
|
|
41
37
|
splitBits: () => splitBits,
|
|
42
38
|
transform: () => transform2,
|
|
@@ -59,13 +55,10 @@ __export(bitmark_wasm_exports, {
|
|
|
59
55
|
convert_text: () => convert_text,
|
|
60
56
|
count_bits: () => count_bits,
|
|
61
57
|
default: () => bitmark_wasm_default,
|
|
62
|
-
fullize: () => fullize,
|
|
63
58
|
info: () => info,
|
|
64
59
|
initSync: () => initSync,
|
|
65
60
|
is_bitmark: () => is_bitmark,
|
|
66
61
|
lex: () => lex,
|
|
67
|
-
optimize: () => optimize,
|
|
68
|
-
parse: () => parse,
|
|
69
62
|
prettify: () => prettify,
|
|
70
63
|
split_bits: () => split_bits,
|
|
71
64
|
split_json_bits: () => split_json_bits,
|
|
@@ -161,26 +154,6 @@ function lex(input, stage) {
|
|
|
161
154
|
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
162
155
|
}
|
|
163
156
|
}
|
|
164
|
-
function parse(input, mode) {
|
|
165
|
-
let deferred3_0;
|
|
166
|
-
let deferred3_1;
|
|
167
|
-
try {
|
|
168
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
169
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
170
|
-
const len0 = WASM_VECTOR_LEN;
|
|
171
|
-
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
172
|
-
const len1 = WASM_VECTOR_LEN;
|
|
173
|
-
wasm.parse(retptr, ptr0, len0, ptr1, len1);
|
|
174
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
175
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
176
|
-
deferred3_0 = r0;
|
|
177
|
-
deferred3_1 = r1;
|
|
178
|
-
return getStringFromWasm0(r0, r1);
|
|
179
|
-
} finally {
|
|
180
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
181
|
-
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
157
|
function breakscape_text(input, format, location) {
|
|
185
158
|
let deferred4_0;
|
|
186
159
|
let deferred4_1;
|
|
@@ -225,64 +198,26 @@ function unbreakscape_text(input, format, location) {
|
|
|
225
198
|
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
226
199
|
}
|
|
227
200
|
}
|
|
228
|
-
function
|
|
229
|
-
let
|
|
230
|
-
let
|
|
231
|
-
try {
|
|
232
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
233
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
234
|
-
const len0 = WASM_VECTOR_LEN;
|
|
235
|
-
wasm.split_json_bits(retptr, ptr0, len0);
|
|
236
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
237
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
238
|
-
deferred2_0 = r0;
|
|
239
|
-
deferred2_1 = r1;
|
|
240
|
-
return getStringFromWasm0(r0, r1);
|
|
241
|
-
} finally {
|
|
242
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
243
|
-
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
function prettify(json, indent) {
|
|
247
|
-
let deferred2_0;
|
|
248
|
-
let deferred2_1;
|
|
249
|
-
try {
|
|
250
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
251
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
252
|
-
const len0 = WASM_VECTOR_LEN;
|
|
253
|
-
wasm.prettify(retptr, ptr0, len0, indent);
|
|
254
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
255
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
256
|
-
deferred2_0 = r0;
|
|
257
|
-
deferred2_1 = r1;
|
|
258
|
-
return getStringFromWasm0(r0, r1);
|
|
259
|
-
} finally {
|
|
260
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
261
|
-
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
function convert_text(input, direction, format, location) {
|
|
265
|
-
let deferred5_0;
|
|
266
|
-
let deferred5_1;
|
|
201
|
+
function info(info_type, format, bit, pretty, indent) {
|
|
202
|
+
let deferred4_0;
|
|
203
|
+
let deferred4_1;
|
|
267
204
|
try {
|
|
268
205
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
269
|
-
const ptr0 = passStringToWasm0(
|
|
206
|
+
const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
270
207
|
const len0 = WASM_VECTOR_LEN;
|
|
271
|
-
const ptr1 = passStringToWasm0(
|
|
208
|
+
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
272
209
|
const len1 = WASM_VECTOR_LEN;
|
|
273
|
-
const ptr2 = passStringToWasm0(
|
|
210
|
+
const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
274
211
|
const len2 = WASM_VECTOR_LEN;
|
|
275
|
-
|
|
276
|
-
const len3 = WASM_VECTOR_LEN;
|
|
277
|
-
wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
212
|
+
wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);
|
|
278
213
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
279
214
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
280
|
-
|
|
281
|
-
|
|
215
|
+
deferred4_0 = r0;
|
|
216
|
+
deferred4_1 = r1;
|
|
282
217
|
return getStringFromWasm0(r0, r1);
|
|
283
218
|
} finally {
|
|
284
219
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
285
|
-
wasm.__wbindgen_export_2(
|
|
220
|
+
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
286
221
|
}
|
|
287
222
|
}
|
|
288
223
|
function transform(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {
|
|
@@ -311,29 +246,7 @@ function transform(input, input_format_sel, output_format_sel, mode, patch_json,
|
|
|
311
246
|
wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
|
|
312
247
|
}
|
|
313
248
|
}
|
|
314
|
-
function
|
|
315
|
-
let deferred4_0;
|
|
316
|
-
let deferred4_1;
|
|
317
|
-
try {
|
|
318
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
319
|
-
const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
320
|
-
const len0 = WASM_VECTOR_LEN;
|
|
321
|
-
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
322
|
-
const len1 = WASM_VECTOR_LEN;
|
|
323
|
-
const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
324
|
-
const len2 = WASM_VECTOR_LEN;
|
|
325
|
-
wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);
|
|
326
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
327
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
328
|
-
deferred4_0 = r0;
|
|
329
|
-
deferred4_1 = r1;
|
|
330
|
-
return getStringFromWasm0(r0, r1);
|
|
331
|
-
} finally {
|
|
332
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
333
|
-
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
334
|
-
}
|
|
335
|
-
}
|
|
336
|
-
function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values) {
|
|
249
|
+
function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties) {
|
|
337
250
|
let deferred5_0;
|
|
338
251
|
let deferred5_1;
|
|
339
252
|
try {
|
|
@@ -346,7 +259,7 @@ function convert(input, input_format_sel, output_format_sel, mode, pretty, inden
|
|
|
346
259
|
const len2 = WASM_VECTOR_LEN;
|
|
347
260
|
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
348
261
|
const len3 = WASM_VECTOR_LEN;
|
|
349
|
-
wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values);
|
|
262
|
+
wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties);
|
|
350
263
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
351
264
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
352
265
|
deferred5_0 = r0;
|
|
@@ -357,76 +270,78 @@ function convert(input, input_format_sel, output_format_sel, mode, pretty, inden
|
|
|
357
270
|
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
358
271
|
}
|
|
359
272
|
}
|
|
360
|
-
function
|
|
361
|
-
let
|
|
362
|
-
let
|
|
273
|
+
function canonicalize(input, input_format_sel, mode, pretty, indent, spaces_around_values) {
|
|
274
|
+
let deferred4_0;
|
|
275
|
+
let deferred4_1;
|
|
363
276
|
try {
|
|
364
277
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
365
278
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
366
279
|
const len0 = WASM_VECTOR_LEN;
|
|
367
280
|
const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
368
281
|
const len1 = WASM_VECTOR_LEN;
|
|
369
|
-
|
|
282
|
+
const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
283
|
+
const len2 = WASM_VECTOR_LEN;
|
|
284
|
+
wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);
|
|
370
285
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
371
286
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
372
|
-
|
|
373
|
-
|
|
287
|
+
deferred4_0 = r0;
|
|
288
|
+
deferred4_1 = r1;
|
|
374
289
|
return getStringFromWasm0(r0, r1);
|
|
375
290
|
} finally {
|
|
376
291
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
377
|
-
wasm.__wbindgen_export_2(
|
|
292
|
+
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
378
293
|
}
|
|
379
294
|
}
|
|
380
|
-
function
|
|
381
|
-
let
|
|
382
|
-
let
|
|
295
|
+
function count_bits(input) {
|
|
296
|
+
let deferred2_0;
|
|
297
|
+
let deferred2_1;
|
|
383
298
|
try {
|
|
384
299
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
385
300
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
386
301
|
const len0 = WASM_VECTOR_LEN;
|
|
387
|
-
|
|
388
|
-
const len1 = WASM_VECTOR_LEN;
|
|
389
|
-
wasm.fullize(retptr, ptr0, len0, ptr1, len1, pretty, indent);
|
|
302
|
+
wasm.count_bits(retptr, ptr0, len0);
|
|
390
303
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
391
304
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
392
|
-
|
|
393
|
-
|
|
305
|
+
deferred2_0 = r0;
|
|
306
|
+
deferred2_1 = r1;
|
|
394
307
|
return getStringFromWasm0(r0, r1);
|
|
395
308
|
} finally {
|
|
396
309
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
397
|
-
wasm.__wbindgen_export_2(
|
|
310
|
+
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
398
311
|
}
|
|
399
312
|
}
|
|
400
|
-
function
|
|
401
|
-
let
|
|
402
|
-
let
|
|
313
|
+
function split_bits(input) {
|
|
314
|
+
let deferred2_0;
|
|
315
|
+
let deferred2_1;
|
|
403
316
|
try {
|
|
404
317
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
405
318
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
406
319
|
const len0 = WASM_VECTOR_LEN;
|
|
407
|
-
|
|
408
|
-
const len1 = WASM_VECTOR_LEN;
|
|
409
|
-
const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
410
|
-
const len2 = WASM_VECTOR_LEN;
|
|
411
|
-
wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);
|
|
320
|
+
wasm.split_bits(retptr, ptr0, len0);
|
|
412
321
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
413
322
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
414
|
-
|
|
415
|
-
|
|
323
|
+
deferred2_0 = r0;
|
|
324
|
+
deferred2_1 = r1;
|
|
416
325
|
return getStringFromWasm0(r0, r1);
|
|
417
326
|
} finally {
|
|
418
327
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
419
|
-
wasm.__wbindgen_export_2(
|
|
328
|
+
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
420
329
|
}
|
|
421
330
|
}
|
|
422
|
-
function
|
|
331
|
+
function is_bitmark(input) {
|
|
332
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
333
|
+
const len0 = WASM_VECTOR_LEN;
|
|
334
|
+
const ret = wasm.is_bitmark(ptr0, len0);
|
|
335
|
+
return ret !== 0;
|
|
336
|
+
}
|
|
337
|
+
function split_json_bits(input) {
|
|
423
338
|
let deferred2_0;
|
|
424
339
|
let deferred2_1;
|
|
425
340
|
try {
|
|
426
341
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
427
342
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
428
343
|
const len0 = WASM_VECTOR_LEN;
|
|
429
|
-
wasm.
|
|
344
|
+
wasm.split_json_bits(retptr, ptr0, len0);
|
|
430
345
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
431
346
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
432
347
|
deferred2_0 = r0;
|
|
@@ -437,14 +352,14 @@ function count_bits(input) {
|
|
|
437
352
|
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
438
353
|
}
|
|
439
354
|
}
|
|
440
|
-
function
|
|
355
|
+
function prettify(json, indent) {
|
|
441
356
|
let deferred2_0;
|
|
442
357
|
let deferred2_1;
|
|
443
358
|
try {
|
|
444
359
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
445
|
-
const ptr0 = passStringToWasm0(
|
|
360
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
446
361
|
const len0 = WASM_VECTOR_LEN;
|
|
447
|
-
wasm.
|
|
362
|
+
wasm.prettify(retptr, ptr0, len0, indent);
|
|
448
363
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
449
364
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
450
365
|
deferred2_0 = r0;
|
|
@@ -455,11 +370,29 @@ function split_bits(input) {
|
|
|
455
370
|
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
456
371
|
}
|
|
457
372
|
}
|
|
458
|
-
function
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
373
|
+
function convert_text(input, direction, format, location) {
|
|
374
|
+
let deferred5_0;
|
|
375
|
+
let deferred5_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
|
+
const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
381
|
+
const len1 = WASM_VECTOR_LEN;
|
|
382
|
+
const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
383
|
+
const len2 = WASM_VECTOR_LEN;
|
|
384
|
+
const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
385
|
+
const len3 = WASM_VECTOR_LEN;
|
|
386
|
+
wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
387
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
388
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
389
|
+
deferred5_0 = r0;
|
|
390
|
+
deferred5_1 = r1;
|
|
391
|
+
return getStringFromWasm0(r0, r1);
|
|
392
|
+
} finally {
|
|
393
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
394
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
395
|
+
}
|
|
463
396
|
}
|
|
464
397
|
async function __wbg_load(module2, imports) {
|
|
465
398
|
if (typeof Response === "function" && module2 instanceof Response) {
|
|
@@ -541,7 +474,7 @@ var bitmark_wasm_default = __wbg_init;
|
|
|
541
474
|
// src/generated/package_info.ts
|
|
542
475
|
var PACKAGE_INFO = {
|
|
543
476
|
"name": "@gmb/bitmark-parser",
|
|
544
|
-
"version": "6.
|
|
477
|
+
"version": "6.3.1",
|
|
545
478
|
"author": "Get More Brain Ltd <info@getmorebrain.com>",
|
|
546
479
|
"license": "ISC",
|
|
547
480
|
"description": "A parser for bitmark text, powered by WebAssembly."
|
|
@@ -811,16 +744,14 @@ function validateVersionOptions(opts) {
|
|
|
811
744
|
}
|
|
812
745
|
function validateBitmarkOptions(o) {
|
|
813
746
|
if (o.explicitTextFormat) unsupportedOption("bitmarkOptions.explicitTextFormat");
|
|
814
|
-
if (o.
|
|
815
|
-
unsupportedOption("bitmarkOptions.
|
|
747
|
+
if (o.cardSetVersion === 1) {
|
|
748
|
+
unsupportedOption("bitmarkOptions.cardSetVersion: 1", V3_ONLY);
|
|
816
749
|
}
|
|
817
|
-
if (o.cardSetVersion === 1) unsupportedOption("bitmarkOptions.cardSetVersion: 1", V3_ONLY);
|
|
818
750
|
if (o.debugGenerationInline) unsupportedOption("bitmarkOptions.debugGenerationInline");
|
|
819
751
|
if (o.noBreakscaping) unsupportedOption("bitmarkOptions.noBreakscaping");
|
|
820
752
|
}
|
|
821
753
|
function validateJsonOptions(o) {
|
|
822
754
|
if (o.textAsPlainText) unsupportedOption("jsonOptions.textAsPlainText", V3_ONLY);
|
|
823
|
-
if (o.excludeUnknownProperties) unsupportedOption("jsonOptions.excludeUnknownProperties");
|
|
824
755
|
if (o.debugGenerationInline) unsupportedOption("jsonOptions.debugGenerationInline");
|
|
825
756
|
}
|
|
826
757
|
function prettyIndent(prettify2) {
|
|
@@ -856,6 +787,14 @@ function isPseudoAst(v) {
|
|
|
856
787
|
return v !== null && typeof v === "object" && (PSEUDO_AST_MARKER in v || Array.isArray(v.bits));
|
|
857
788
|
}
|
|
858
789
|
|
|
790
|
+
// src/legacy/generated/resource-collection-keys.ts
|
|
791
|
+
var RESOURCE_COLLECTION_KEYS = {
|
|
792
|
+
"extractor-image": { key: "images", resourceType: "image" },
|
|
793
|
+
"extractor-image-collapsible": { key: "images", resourceType: "image" },
|
|
794
|
+
"images-logo-grave": { key: "logos", resourceType: "image" },
|
|
795
|
+
"prototype-images": { key: "images", resourceType: "image" }
|
|
796
|
+
};
|
|
797
|
+
|
|
859
798
|
// src/legacy/builder.ts
|
|
860
799
|
var BUILT_BIT_PARSER = /* @__PURE__ */ Symbol.for("@gmb/bitmark-parser/legacy-built-bit-parser");
|
|
861
800
|
var DATA_KEY_TO_JSON_KEY = {
|
|
@@ -868,6 +807,13 @@ var DEPRECATED_TEXT_FORMATS = {
|
|
|
868
807
|
"bitmark--": "bitmark++",
|
|
869
808
|
"bitmark+": "bitmark++"
|
|
870
809
|
};
|
|
810
|
+
var CONFIG_BODY_FORMAT_TO_TEXT_FORMAT = {
|
|
811
|
+
bitmark: "bitmark++",
|
|
812
|
+
text: "text",
|
|
813
|
+
json: "json",
|
|
814
|
+
latex: "latex",
|
|
815
|
+
xml: "xml"
|
|
816
|
+
};
|
|
871
817
|
var TAG_TEXT_KEYS = [
|
|
872
818
|
"title",
|
|
873
819
|
"subtitle",
|
|
@@ -900,16 +846,20 @@ var Builder = class {
|
|
|
900
846
|
* NOTE (documented divergences from bpg):
|
|
901
847
|
* - the return value is bit JSON, not bpg's internal AST node model;
|
|
902
848
|
* - `resourceType` (an inference hint in bpg) is not carried into the
|
|
903
|
-
* JSON — the attached `resource` object is authoritative
|
|
904
|
-
*
|
|
905
|
-
*
|
|
906
|
-
*
|
|
849
|
+
* JSON — the attached `resource` object is authoritative.
|
|
850
|
+
*
|
|
851
|
+
* `resources` follows bpg's JsonGenerator routing: on a bit whose config
|
|
852
|
+
* maps a repeatable resource tag group onto a collection key (e.g.
|
|
853
|
+
* `images` / `logos` — see the generated RESOURCE_COLLECTION_KEYS), the
|
|
854
|
+
* matching-type entries land under that key; on every other bit the first
|
|
855
|
+
* entry becomes the canonical single `resource` (as bpg: "if there is
|
|
856
|
+
* more than one resource, use the first one").
|
|
907
857
|
*/
|
|
908
858
|
buildBit(data, _options) {
|
|
909
859
|
const wasm2 = getLegacyWasm();
|
|
910
860
|
const src = { ...data };
|
|
911
861
|
const bitType = src.bitType;
|
|
912
|
-
this.
|
|
862
|
+
const bitConfig = this.getBitConfig(bitType);
|
|
913
863
|
const bit = {};
|
|
914
864
|
bit.type = bitType;
|
|
915
865
|
if (src.isCommented) {
|
|
@@ -922,6 +872,8 @@ var Builder = class {
|
|
|
922
872
|
if (textFormat !== void 0) {
|
|
923
873
|
bit.format = DEPRECATED_TEXT_FORMATS[textFormat] ?? textFormat;
|
|
924
874
|
delete src.textFormat;
|
|
875
|
+
} else {
|
|
876
|
+
bit.format = CONFIG_BODY_FORMAT_TO_TEXT_FORMAT[bitConfig.bodyFormat ?? ""] ?? "bitmark++";
|
|
925
877
|
}
|
|
926
878
|
delete src.resourceType;
|
|
927
879
|
const body = src.body;
|
|
@@ -939,12 +891,15 @@ var Builder = class {
|
|
|
939
891
|
delete src.__isDefaultExample;
|
|
940
892
|
}
|
|
941
893
|
const resources = src.resources;
|
|
942
|
-
if (resources !== void 0) {
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
894
|
+
if (resources !== void 0 && bitType !== void 0) {
|
|
895
|
+
const list = Array.isArray(resources) ? resources : [resources];
|
|
896
|
+
const collection = RESOURCE_COLLECTION_KEYS[bitType];
|
|
897
|
+
if (collection) {
|
|
898
|
+
bit[collection.key] = list.filter(
|
|
899
|
+
(r) => r !== null && typeof r === "object" && r.type === collection.resourceType
|
|
900
|
+
);
|
|
901
|
+
} else if (list.length >= 1) {
|
|
902
|
+
bit.resource = list[0];
|
|
948
903
|
}
|
|
949
904
|
delete src.resources;
|
|
950
905
|
}
|
|
@@ -962,7 +917,7 @@ var Builder = class {
|
|
|
962
917
|
}
|
|
963
918
|
}
|
|
964
919
|
this.parseStringTexts(bit);
|
|
965
|
-
const out = wasm2.convert(JSON.stringify([{ bit }]), "json", "json", "optimized", false, 2, 1);
|
|
920
|
+
const out = wasm2.convert(JSON.stringify([{ bit }]), "json", "json", "optimized", false, 2, 1, false);
|
|
966
921
|
if (out.startsWith("error:")) {
|
|
967
922
|
throw new Error(out.slice("error:".length).trim());
|
|
968
923
|
}
|
|
@@ -1010,6 +965,12 @@ var Builder = class {
|
|
|
1010
965
|
* (inline marks become TextAst marks); the composer would otherwise treat
|
|
1011
966
|
* them as literal text. Converts top-level JsonText fields in place.
|
|
1012
967
|
* Nested (card-content) strings are left literal — documented divergence.
|
|
968
|
+
*
|
|
969
|
+
* A string body is dispatched on the bit's resolved text format, as bpg's
|
|
970
|
+
* buildBody: bitmark text is parsed to TextAst, `json` is JSON.parsed
|
|
971
|
+
* (unparseable → null), and plain-text formats (text/latex/xml) stay
|
|
972
|
+
* verbatim. Tag texts are always bitmark text, independent of body format
|
|
973
|
+
* (bpg TextParser.toAst ignores format; only location matters).
|
|
1013
974
|
*/
|
|
1014
975
|
parseStringTexts(bit) {
|
|
1015
976
|
const wasm2 = getLegacyWasm();
|
|
@@ -1024,29 +985,36 @@ var Builder = class {
|
|
|
1024
985
|
};
|
|
1025
986
|
const format = bit.format;
|
|
1026
987
|
const bitmarkBody = format === void 0 || format === "bitmark++" || format === "bitmark+";
|
|
1027
|
-
if (typeof bit.body === "string"
|
|
1028
|
-
|
|
988
|
+
if (typeof bit.body === "string") {
|
|
989
|
+
if (format === "json") {
|
|
990
|
+
try {
|
|
991
|
+
bit.body = JSON.parse(bit.body);
|
|
992
|
+
} catch {
|
|
993
|
+
bit.body = null;
|
|
994
|
+
}
|
|
995
|
+
} else if (bitmarkBody) {
|
|
996
|
+
bit.body = toAst(bit.body, "body");
|
|
997
|
+
}
|
|
1029
998
|
}
|
|
1030
999
|
for (const key of TAG_TEXT_KEYS) {
|
|
1031
1000
|
const v = bit[key];
|
|
1032
1001
|
if (typeof v === "string") bit[key] = toAst(v, "tag");
|
|
1033
1002
|
}
|
|
1034
1003
|
}
|
|
1035
|
-
/**
|
|
1036
|
-
|
|
1004
|
+
/**
|
|
1005
|
+
* Look up the bit's config (`wasm.info`); throws bpg's exact
|
|
1006
|
+
* unknown-bit-type error (`Config.getBitConfig` parity).
|
|
1007
|
+
*/
|
|
1008
|
+
getBitConfig(bitType) {
|
|
1037
1009
|
const wasm2 = getLegacyWasm();
|
|
1038
|
-
let known = false;
|
|
1039
1010
|
if (bitType !== void 0) {
|
|
1040
1011
|
try {
|
|
1041
1012
|
const info3 = JSON.parse(wasm2.info("bit", "json", bitType, false, 2));
|
|
1042
|
-
|
|
1013
|
+
if (info3.error === void 0) return info3;
|
|
1043
1014
|
} catch {
|
|
1044
|
-
known = false;
|
|
1045
1015
|
}
|
|
1046
1016
|
}
|
|
1047
|
-
|
|
1048
|
-
throw new Error(`No config found for bit: ${bitType}`);
|
|
1049
|
-
}
|
|
1017
|
+
throw new Error(`No config found for bit: ${bitType}`);
|
|
1050
1018
|
}
|
|
1051
1019
|
};
|
|
1052
1020
|
function stripUndefined(src, exclude) {
|
|
@@ -1086,8 +1054,10 @@ var BitmarkParserGenerator = class {
|
|
|
1086
1054
|
const outputFormat = opts.outputFormat ?? (isBitmark ? "json" : "bitmark");
|
|
1087
1055
|
const coreFormat = outputFormat === "ast" ? "json" : outputFormat;
|
|
1088
1056
|
const { pretty, indent } = prettyIndent(jsonOptions.prettify);
|
|
1057
|
+
const emit = coreFormat === "bitmark" ? prettyIndent(bitmarkOptions.prettifyJson) : { pretty, indent };
|
|
1089
1058
|
const spaces = spacesAround(bitmarkOptions.spacesAroundValues);
|
|
1090
|
-
const
|
|
1059
|
+
const includeUnknown = !jsonOptions.excludeUnknownProperties;
|
|
1060
|
+
const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", coreFormat, "optimized", emit.pretty, emit.indent, spaces, includeUnknown);
|
|
1091
1061
|
this.throwOnError(out);
|
|
1092
1062
|
if (outputFormat === "bitmark" || outputFormat === "text") {
|
|
1093
1063
|
return this.deliver(out, opts.outputFile, opts.fileOptions);
|
|
@@ -1117,7 +1087,9 @@ var BitmarkParserGenerator = class {
|
|
|
1117
1087
|
this.checkBrowserFileWrite(opts.outputFile);
|
|
1118
1088
|
const wasm2 = getLegacyWasm();
|
|
1119
1089
|
const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);
|
|
1120
|
-
const { pretty, indent } = prettyIndent(
|
|
1090
|
+
const { pretty, indent } = prettyIndent(
|
|
1091
|
+
isBitmark ? bitmarkOptions.prettifyJson : jsonOptions.prettify
|
|
1092
|
+
);
|
|
1121
1093
|
const spaces = spacesAround(bitmarkOptions.spacesAroundValues);
|
|
1122
1094
|
const out = wasm2.canonicalize(source, isBitmark ? "bitmark" : "json", "optimized", pretty, indent, spaces);
|
|
1123
1095
|
this.throwOnError(out);
|
|
@@ -1169,7 +1141,7 @@ var BitmarkParserGenerator = class {
|
|
|
1169
1141
|
const isHtmlInput = opts.inputFormat === "html" || opts.inputFormat === void 0 && typeof input === "string" && /<table[\s>]/iu.test(inStr);
|
|
1170
1142
|
if (!isHtmlInput) {
|
|
1171
1143
|
const { source, isBitmark } = this.resolveInput(input, void 0);
|
|
1172
|
-
const out2 = wasm2.convert(source, isBitmark ? "bitmark" : "json", "html", "optimized", false, 2, 1);
|
|
1144
|
+
const out2 = wasm2.convert(source, isBitmark ? "bitmark" : "json", "html", "optimized", false, 2, 1, false);
|
|
1173
1145
|
this.throwOnError(out2);
|
|
1174
1146
|
return this.deliver(extractHtmlTables(out2).join("\n"), opts.outputFile, opts.fileOptions);
|
|
1175
1147
|
}
|
|
@@ -1179,12 +1151,12 @@ var BitmarkParserGenerator = class {
|
|
|
1179
1151
|
const { pretty, indent } = prettyIndent(jsonOptions.prettify);
|
|
1180
1152
|
const spaces = spacesAround(bitmarkOptions.spacesAroundValues);
|
|
1181
1153
|
if (outputFormat === "html") {
|
|
1182
|
-
const out2 = wasm2.convert(wrapped, "html", "html", "optimized", false, 2, 1);
|
|
1154
|
+
const out2 = wasm2.convert(wrapped, "html", "html", "optimized", false, 2, 1, false);
|
|
1183
1155
|
this.throwOnError(out2);
|
|
1184
1156
|
return this.deliver(extractHtmlTables(out2).join("\n"), opts.outputFile, opts.fileOptions);
|
|
1185
1157
|
}
|
|
1186
1158
|
const coreFormat = outputFormat === "ast" ? "json" : outputFormat;
|
|
1187
|
-
const out = wasm2.convert(wrapped, "html", coreFormat, "optimized", pretty, indent, spaces);
|
|
1159
|
+
const out = wasm2.convert(wrapped, "html", coreFormat, "optimized", pretty, indent, spaces, false);
|
|
1188
1160
|
this.throwOnError(out);
|
|
1189
1161
|
if (outputFormat === "bitmark" || outputFormat === "text") {
|
|
1190
1162
|
return this.deliver(out, opts.outputFile, opts.fileOptions);
|
|
@@ -1209,7 +1181,7 @@ var BitmarkParserGenerator = class {
|
|
|
1209
1181
|
const opts = Object.assign({}, options);
|
|
1210
1182
|
const wasm2 = getLegacyWasm();
|
|
1211
1183
|
const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);
|
|
1212
|
-
const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "json", "optimized", false, 2, 1);
|
|
1184
|
+
const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "json", "optimized", false, 2, 1, true);
|
|
1213
1185
|
this.throwOnError(out);
|
|
1214
1186
|
return makePseudoAst(JSON.parse(out));
|
|
1215
1187
|
}
|
|
@@ -1316,7 +1288,7 @@ var BitmarkParserGenerator = class {
|
|
|
1316
1288
|
}
|
|
1317
1289
|
}
|
|
1318
1290
|
const { source, isBitmark } = this.resolveInput(input, void 0);
|
|
1319
|
-
const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "text", "optimized", false, 2, 1);
|
|
1291
|
+
const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "text", "optimized", false, 2, 1, false);
|
|
1320
1292
|
this.throwOnError(out);
|
|
1321
1293
|
return out;
|
|
1322
1294
|
}
|
|
@@ -1807,19 +1779,25 @@ function version() {
|
|
|
1807
1779
|
function lex2(input, options = {}) {
|
|
1808
1780
|
return lex(input, options.stage ?? "lex");
|
|
1809
1781
|
}
|
|
1810
|
-
function
|
|
1811
|
-
|
|
1812
|
-
|
|
1813
|
-
|
|
1814
|
-
|
|
1782
|
+
function bitmarkToObjects(input, options = {}) {
|
|
1783
|
+
const out = convert(
|
|
1784
|
+
input,
|
|
1785
|
+
"bitmark",
|
|
1786
|
+
"json",
|
|
1787
|
+
options.mode ?? "optimized",
|
|
1788
|
+
false,
|
|
1789
|
+
2,
|
|
1790
|
+
1,
|
|
1791
|
+
options.includeUnknownProperties ?? false
|
|
1792
|
+
);
|
|
1815
1793
|
if (out.startsWith("error:")) throw new Error(out.slice("error:".length).trim());
|
|
1816
1794
|
return JSON.parse(out);
|
|
1817
1795
|
}
|
|
1818
|
-
function
|
|
1796
|
+
function objectsToBitmark(bits, options = {}) {
|
|
1819
1797
|
const entries = bits.map(
|
|
1820
1798
|
(b) => b !== null && typeof b === "object" && "bit" in b && typeof b.bit === "object" ? b : { bit: b }
|
|
1821
1799
|
);
|
|
1822
|
-
const out = convert(JSON.stringify(entries), "json", "bitmark", options.mode ?? "optimized", false, 2, 1);
|
|
1800
|
+
const out = convert(JSON.stringify(entries), "json", "bitmark", options.mode ?? "optimized", false, 2, 1, false);
|
|
1823
1801
|
if (out.startsWith("error:")) throw new Error(out.slice("error:".length).trim());
|
|
1824
1802
|
return out;
|
|
1825
1803
|
}
|
|
@@ -1831,16 +1809,10 @@ function convert2(input, options = {}) {
|
|
|
1831
1809
|
options.mode ?? "optimized",
|
|
1832
1810
|
options.pretty ?? false,
|
|
1833
1811
|
options.indent ?? 2,
|
|
1834
|
-
options.spacesAroundValues ?? 1
|
|
1812
|
+
options.spacesAroundValues ?? 1,
|
|
1813
|
+
options.includeUnknownProperties ?? false
|
|
1835
1814
|
);
|
|
1836
1815
|
}
|
|
1837
|
-
function optimize2(input, options = {}) {
|
|
1838
|
-
return optimize(input, options.inputFormat ?? "auto", options.pretty ?? false, options.indent ?? 2);
|
|
1839
|
-
}
|
|
1840
|
-
function fullize2(input, options = {}) {
|
|
1841
|
-
return fullize(input, options.inputFormat ?? "auto", options.pretty ?? false, options.indent ?? 2);
|
|
1842
|
-
}
|
|
1843
|
-
var expand = fullize2;
|
|
1844
1816
|
function canonicalize2(input, options = {}) {
|
|
1845
1817
|
return canonicalize(
|
|
1846
1818
|
input,
|
|
@@ -1898,21 +1870,17 @@ function info2(options = {}) {
|
|
|
1898
1870
|
}
|
|
1899
1871
|
// Annotate the CommonJS export names for ESM import in node:
|
|
1900
1872
|
0 && (module.exports = {
|
|
1873
|
+
bitmarkToObjects,
|
|
1901
1874
|
breakscapeText,
|
|
1902
1875
|
canonicalize,
|
|
1903
1876
|
convert,
|
|
1904
1877
|
countBits,
|
|
1905
|
-
expand,
|
|
1906
|
-
fullize,
|
|
1907
|
-
generateBits,
|
|
1908
1878
|
info,
|
|
1909
1879
|
init,
|
|
1910
1880
|
initSync,
|
|
1911
1881
|
legacy,
|
|
1912
1882
|
lex,
|
|
1913
|
-
|
|
1914
|
-
parse,
|
|
1915
|
-
parseBits,
|
|
1883
|
+
objectsToBitmark,
|
|
1916
1884
|
patchEntry,
|
|
1917
1885
|
splitBits,
|
|
1918
1886
|
transform,
|