@gmb/bitmark-parser 6.2.0 → 6.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +105 -54
- 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 +128 -182
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +146 -117
- package/dist/browser/esm/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/esm/index.d.ts +146 -117
- package/dist/browser/esm/index.js +126 -176
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js.map +1 -1
- package/dist/index.cjs +59 -55
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1912 -300
- package/dist/index.d.ts +1912 -300
- package/dist/index.js +57 -48
- package/dist/index.js.map +1 -1
- package/dist/legacy.cjs +40 -23
- package/dist/legacy.cjs.map +1 -1
- package/dist/legacy.d.cts +32 -14
- package/dist/legacy.d.ts +32 -14
- package/dist/legacy.js +40 -23
- 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
|
@@ -15,13 +15,10 @@ __export(bitmark_wasm_exports, {
|
|
|
15
15
|
convert_text: () => convert_text,
|
|
16
16
|
count_bits: () => count_bits,
|
|
17
17
|
default: () => bitmark_wasm_default,
|
|
18
|
-
fullize: () => fullize,
|
|
19
18
|
info: () => info,
|
|
20
19
|
initSync: () => initSync,
|
|
21
20
|
is_bitmark: () => is_bitmark,
|
|
22
21
|
lex: () => lex,
|
|
23
|
-
optimize: () => optimize,
|
|
24
|
-
parse: () => parse,
|
|
25
22
|
prettify: () => prettify,
|
|
26
23
|
split_bits: () => split_bits,
|
|
27
24
|
split_json_bits: () => split_json_bits,
|
|
@@ -117,26 +114,6 @@ function lex(input, stage) {
|
|
|
117
114
|
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
118
115
|
}
|
|
119
116
|
}
|
|
120
|
-
function parse(input, mode) {
|
|
121
|
-
let deferred3_0;
|
|
122
|
-
let deferred3_1;
|
|
123
|
-
try {
|
|
124
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
125
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
126
|
-
const len0 = WASM_VECTOR_LEN;
|
|
127
|
-
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
128
|
-
const len1 = WASM_VECTOR_LEN;
|
|
129
|
-
wasm.parse(retptr, ptr0, len0, ptr1, len1);
|
|
130
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
131
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
132
|
-
deferred3_0 = r0;
|
|
133
|
-
deferred3_1 = r1;
|
|
134
|
-
return getStringFromWasm0(r0, r1);
|
|
135
|
-
} finally {
|
|
136
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
137
|
-
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
117
|
function breakscape_text(input, format, location) {
|
|
141
118
|
let deferred4_0;
|
|
142
119
|
let deferred4_1;
|
|
@@ -181,64 +158,26 @@ function unbreakscape_text(input, format, location) {
|
|
|
181
158
|
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
182
159
|
}
|
|
183
160
|
}
|
|
184
|
-
function
|
|
185
|
-
let
|
|
186
|
-
let
|
|
187
|
-
try {
|
|
188
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
189
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
190
|
-
const len0 = WASM_VECTOR_LEN;
|
|
191
|
-
wasm.split_json_bits(retptr, ptr0, len0);
|
|
192
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
193
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
194
|
-
deferred2_0 = r0;
|
|
195
|
-
deferred2_1 = r1;
|
|
196
|
-
return getStringFromWasm0(r0, r1);
|
|
197
|
-
} finally {
|
|
198
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
199
|
-
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
function prettify(json, indent) {
|
|
203
|
-
let deferred2_0;
|
|
204
|
-
let deferred2_1;
|
|
205
|
-
try {
|
|
206
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
207
|
-
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
208
|
-
const len0 = WASM_VECTOR_LEN;
|
|
209
|
-
wasm.prettify(retptr, ptr0, len0, indent);
|
|
210
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
211
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
212
|
-
deferred2_0 = r0;
|
|
213
|
-
deferred2_1 = r1;
|
|
214
|
-
return getStringFromWasm0(r0, r1);
|
|
215
|
-
} finally {
|
|
216
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
217
|
-
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
function convert_text(input, direction, format, location) {
|
|
221
|
-
let deferred5_0;
|
|
222
|
-
let deferred5_1;
|
|
161
|
+
function info(info_type, format, bit, pretty, indent) {
|
|
162
|
+
let deferred4_0;
|
|
163
|
+
let deferred4_1;
|
|
223
164
|
try {
|
|
224
165
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
225
|
-
const ptr0 = passStringToWasm0(
|
|
166
|
+
const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
226
167
|
const len0 = WASM_VECTOR_LEN;
|
|
227
|
-
const ptr1 = passStringToWasm0(
|
|
168
|
+
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
228
169
|
const len1 = WASM_VECTOR_LEN;
|
|
229
|
-
const ptr2 = passStringToWasm0(
|
|
170
|
+
const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
230
171
|
const len2 = WASM_VECTOR_LEN;
|
|
231
|
-
|
|
232
|
-
const len3 = WASM_VECTOR_LEN;
|
|
233
|
-
wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
172
|
+
wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);
|
|
234
173
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
235
174
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
236
|
-
|
|
237
|
-
|
|
175
|
+
deferred4_0 = r0;
|
|
176
|
+
deferred4_1 = r1;
|
|
238
177
|
return getStringFromWasm0(r0, r1);
|
|
239
178
|
} finally {
|
|
240
179
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
241
|
-
wasm.__wbindgen_export_2(
|
|
180
|
+
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
242
181
|
}
|
|
243
182
|
}
|
|
244
183
|
function transform(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {
|
|
@@ -267,29 +206,7 @@ function transform(input, input_format_sel, output_format_sel, mode, patch_json,
|
|
|
267
206
|
wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
|
|
268
207
|
}
|
|
269
208
|
}
|
|
270
|
-
function
|
|
271
|
-
let deferred4_0;
|
|
272
|
-
let deferred4_1;
|
|
273
|
-
try {
|
|
274
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
275
|
-
const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
276
|
-
const len0 = WASM_VECTOR_LEN;
|
|
277
|
-
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
278
|
-
const len1 = WASM_VECTOR_LEN;
|
|
279
|
-
const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
280
|
-
const len2 = WASM_VECTOR_LEN;
|
|
281
|
-
wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);
|
|
282
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
283
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
284
|
-
deferred4_0 = r0;
|
|
285
|
-
deferred4_1 = r1;
|
|
286
|
-
return getStringFromWasm0(r0, r1);
|
|
287
|
-
} finally {
|
|
288
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
289
|
-
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values) {
|
|
209
|
+
function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties) {
|
|
293
210
|
let deferred5_0;
|
|
294
211
|
let deferred5_1;
|
|
295
212
|
try {
|
|
@@ -302,7 +219,7 @@ function convert(input, input_format_sel, output_format_sel, mode, pretty, inden
|
|
|
302
219
|
const len2 = WASM_VECTOR_LEN;
|
|
303
220
|
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
304
221
|
const len3 = WASM_VECTOR_LEN;
|
|
305
|
-
wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values);
|
|
222
|
+
wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties);
|
|
306
223
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
307
224
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
308
225
|
deferred5_0 = r0;
|
|
@@ -313,76 +230,78 @@ function convert(input, input_format_sel, output_format_sel, mode, pretty, inden
|
|
|
313
230
|
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
314
231
|
}
|
|
315
232
|
}
|
|
316
|
-
function
|
|
317
|
-
let
|
|
318
|
-
let
|
|
233
|
+
function canonicalize(input, input_format_sel, mode, pretty, indent, spaces_around_values) {
|
|
234
|
+
let deferred4_0;
|
|
235
|
+
let deferred4_1;
|
|
319
236
|
try {
|
|
320
237
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
321
238
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
322
239
|
const len0 = WASM_VECTOR_LEN;
|
|
323
240
|
const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
324
241
|
const len1 = WASM_VECTOR_LEN;
|
|
325
|
-
|
|
242
|
+
const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
243
|
+
const len2 = WASM_VECTOR_LEN;
|
|
244
|
+
wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);
|
|
326
245
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
327
246
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
328
|
-
|
|
329
|
-
|
|
247
|
+
deferred4_0 = r0;
|
|
248
|
+
deferred4_1 = r1;
|
|
330
249
|
return getStringFromWasm0(r0, r1);
|
|
331
250
|
} finally {
|
|
332
251
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
333
|
-
wasm.__wbindgen_export_2(
|
|
252
|
+
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
334
253
|
}
|
|
335
254
|
}
|
|
336
|
-
function
|
|
337
|
-
let
|
|
338
|
-
let
|
|
255
|
+
function count_bits(input) {
|
|
256
|
+
let deferred2_0;
|
|
257
|
+
let deferred2_1;
|
|
339
258
|
try {
|
|
340
259
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
341
260
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
342
261
|
const len0 = WASM_VECTOR_LEN;
|
|
343
|
-
|
|
344
|
-
const len1 = WASM_VECTOR_LEN;
|
|
345
|
-
wasm.fullize(retptr, ptr0, len0, ptr1, len1, pretty, indent);
|
|
262
|
+
wasm.count_bits(retptr, ptr0, len0);
|
|
346
263
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
347
264
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
348
|
-
|
|
349
|
-
|
|
265
|
+
deferred2_0 = r0;
|
|
266
|
+
deferred2_1 = r1;
|
|
350
267
|
return getStringFromWasm0(r0, r1);
|
|
351
268
|
} finally {
|
|
352
269
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
353
|
-
wasm.__wbindgen_export_2(
|
|
270
|
+
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
354
271
|
}
|
|
355
272
|
}
|
|
356
|
-
function
|
|
357
|
-
let
|
|
358
|
-
let
|
|
273
|
+
function split_bits(input) {
|
|
274
|
+
let deferred2_0;
|
|
275
|
+
let deferred2_1;
|
|
359
276
|
try {
|
|
360
277
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
361
278
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
362
279
|
const len0 = WASM_VECTOR_LEN;
|
|
363
|
-
|
|
364
|
-
const len1 = WASM_VECTOR_LEN;
|
|
365
|
-
const ptr2 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
366
|
-
const len2 = WASM_VECTOR_LEN;
|
|
367
|
-
wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);
|
|
280
|
+
wasm.split_bits(retptr, ptr0, len0);
|
|
368
281
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
369
282
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
370
|
-
|
|
371
|
-
|
|
283
|
+
deferred2_0 = r0;
|
|
284
|
+
deferred2_1 = r1;
|
|
372
285
|
return getStringFromWasm0(r0, r1);
|
|
373
286
|
} finally {
|
|
374
287
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
375
|
-
wasm.__wbindgen_export_2(
|
|
288
|
+
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
376
289
|
}
|
|
377
290
|
}
|
|
378
|
-
function
|
|
291
|
+
function is_bitmark(input) {
|
|
292
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
293
|
+
const len0 = WASM_VECTOR_LEN;
|
|
294
|
+
const ret = wasm.is_bitmark(ptr0, len0);
|
|
295
|
+
return ret !== 0;
|
|
296
|
+
}
|
|
297
|
+
function split_json_bits(input) {
|
|
379
298
|
let deferred2_0;
|
|
380
299
|
let deferred2_1;
|
|
381
300
|
try {
|
|
382
301
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
383
302
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
384
303
|
const len0 = WASM_VECTOR_LEN;
|
|
385
|
-
wasm.
|
|
304
|
+
wasm.split_json_bits(retptr, ptr0, len0);
|
|
386
305
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
387
306
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
388
307
|
deferred2_0 = r0;
|
|
@@ -393,14 +312,14 @@ function count_bits(input) {
|
|
|
393
312
|
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
394
313
|
}
|
|
395
314
|
}
|
|
396
|
-
function
|
|
315
|
+
function prettify(json, indent) {
|
|
397
316
|
let deferred2_0;
|
|
398
317
|
let deferred2_1;
|
|
399
318
|
try {
|
|
400
319
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
401
|
-
const ptr0 = passStringToWasm0(
|
|
320
|
+
const ptr0 = passStringToWasm0(json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
402
321
|
const len0 = WASM_VECTOR_LEN;
|
|
403
|
-
wasm.
|
|
322
|
+
wasm.prettify(retptr, ptr0, len0, indent);
|
|
404
323
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
405
324
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
406
325
|
deferred2_0 = r0;
|
|
@@ -411,11 +330,29 @@ function split_bits(input) {
|
|
|
411
330
|
wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);
|
|
412
331
|
}
|
|
413
332
|
}
|
|
414
|
-
function
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
333
|
+
function convert_text(input, direction, format, location) {
|
|
334
|
+
let deferred5_0;
|
|
335
|
+
let deferred5_1;
|
|
336
|
+
try {
|
|
337
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
338
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
339
|
+
const len0 = WASM_VECTOR_LEN;
|
|
340
|
+
const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
341
|
+
const len1 = WASM_VECTOR_LEN;
|
|
342
|
+
const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
343
|
+
const len2 = WASM_VECTOR_LEN;
|
|
344
|
+
const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
345
|
+
const len3 = WASM_VECTOR_LEN;
|
|
346
|
+
wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
347
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
348
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
349
|
+
deferred5_0 = r0;
|
|
350
|
+
deferred5_1 = r1;
|
|
351
|
+
return getStringFromWasm0(r0, r1);
|
|
352
|
+
} finally {
|
|
353
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
354
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
355
|
+
}
|
|
419
356
|
}
|
|
420
357
|
async function __wbg_load(module, imports) {
|
|
421
358
|
if (typeof Response === "function" && module instanceof Response) {
|
|
@@ -497,7 +434,7 @@ var bitmark_wasm_default = __wbg_init;
|
|
|
497
434
|
// src/generated/package_info.ts
|
|
498
435
|
var PACKAGE_INFO = {
|
|
499
436
|
"name": "@gmb/bitmark-parser",
|
|
500
|
-
"version": "6.
|
|
437
|
+
"version": "6.3.0",
|
|
501
438
|
"author": "Get More Brain Ltd <info@getmorebrain.com>",
|
|
502
439
|
"license": "ISC",
|
|
503
440
|
"description": "A parser for bitmark text, powered by WebAssembly."
|
|
@@ -767,16 +704,14 @@ function validateVersionOptions(opts) {
|
|
|
767
704
|
}
|
|
768
705
|
function validateBitmarkOptions(o) {
|
|
769
706
|
if (o.explicitTextFormat) unsupportedOption("bitmarkOptions.explicitTextFormat");
|
|
770
|
-
if (o.
|
|
771
|
-
unsupportedOption("bitmarkOptions.
|
|
707
|
+
if (o.cardSetVersion === 1) {
|
|
708
|
+
unsupportedOption("bitmarkOptions.cardSetVersion: 1", V3_ONLY);
|
|
772
709
|
}
|
|
773
|
-
if (o.cardSetVersion === 1) unsupportedOption("bitmarkOptions.cardSetVersion: 1", V3_ONLY);
|
|
774
710
|
if (o.debugGenerationInline) unsupportedOption("bitmarkOptions.debugGenerationInline");
|
|
775
711
|
if (o.noBreakscaping) unsupportedOption("bitmarkOptions.noBreakscaping");
|
|
776
712
|
}
|
|
777
713
|
function validateJsonOptions(o) {
|
|
778
714
|
if (o.textAsPlainText) unsupportedOption("jsonOptions.textAsPlainText", V3_ONLY);
|
|
779
|
-
if (o.excludeUnknownProperties) unsupportedOption("jsonOptions.excludeUnknownProperties");
|
|
780
715
|
if (o.debugGenerationInline) unsupportedOption("jsonOptions.debugGenerationInline");
|
|
781
716
|
}
|
|
782
717
|
function prettyIndent(prettify2) {
|
|
@@ -812,6 +747,14 @@ function isPseudoAst(v) {
|
|
|
812
747
|
return v !== null && typeof v === "object" && (PSEUDO_AST_MARKER in v || Array.isArray(v.bits));
|
|
813
748
|
}
|
|
814
749
|
|
|
750
|
+
// src/legacy/generated/resource-collection-keys.ts
|
|
751
|
+
var RESOURCE_COLLECTION_KEYS = {
|
|
752
|
+
"extractor-image": { key: "images", resourceType: "image" },
|
|
753
|
+
"extractor-image-collapsible": { key: "images", resourceType: "image" },
|
|
754
|
+
"images-logo-grave": { key: "logos", resourceType: "image" },
|
|
755
|
+
"prototype-images": { key: "images", resourceType: "image" }
|
|
756
|
+
};
|
|
757
|
+
|
|
815
758
|
// src/legacy/builder.ts
|
|
816
759
|
var BUILT_BIT_PARSER = /* @__PURE__ */ Symbol.for("@gmb/bitmark-parser/legacy-built-bit-parser");
|
|
817
760
|
var DATA_KEY_TO_JSON_KEY = {
|
|
@@ -856,10 +799,14 @@ var Builder = class {
|
|
|
856
799
|
* NOTE (documented divergences from bpg):
|
|
857
800
|
* - the return value is bit JSON, not bpg's internal AST node model;
|
|
858
801
|
* - `resourceType` (an inference hint in bpg) is not carried into the
|
|
859
|
-
* JSON — the attached `resource` object is authoritative
|
|
860
|
-
*
|
|
861
|
-
*
|
|
862
|
-
*
|
|
802
|
+
* JSON — the attached `resource` object is authoritative.
|
|
803
|
+
*
|
|
804
|
+
* `resources` follows bpg's JsonGenerator routing: on a bit whose config
|
|
805
|
+
* maps a repeatable resource tag group onto a collection key (e.g.
|
|
806
|
+
* `images` / `logos` — see the generated RESOURCE_COLLECTION_KEYS), the
|
|
807
|
+
* matching-type entries land under that key; on every other bit the first
|
|
808
|
+
* entry becomes the canonical single `resource` (as bpg: "if there is
|
|
809
|
+
* more than one resource, use the first one").
|
|
863
810
|
*/
|
|
864
811
|
buildBit(data, _options) {
|
|
865
812
|
const wasm2 = getLegacyWasm();
|
|
@@ -895,12 +842,15 @@ var Builder = class {
|
|
|
895
842
|
delete src.__isDefaultExample;
|
|
896
843
|
}
|
|
897
844
|
const resources = src.resources;
|
|
898
|
-
if (resources !== void 0) {
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
845
|
+
if (resources !== void 0 && bitType !== void 0) {
|
|
846
|
+
const list = Array.isArray(resources) ? resources : [resources];
|
|
847
|
+
const collection = RESOURCE_COLLECTION_KEYS[bitType];
|
|
848
|
+
if (collection) {
|
|
849
|
+
bit[collection.key] = list.filter(
|
|
850
|
+
(r) => r !== null && typeof r === "object" && r.type === collection.resourceType
|
|
851
|
+
);
|
|
852
|
+
} else if (list.length >= 1) {
|
|
853
|
+
bit.resource = list[0];
|
|
904
854
|
}
|
|
905
855
|
delete src.resources;
|
|
906
856
|
}
|
|
@@ -918,7 +868,7 @@ var Builder = class {
|
|
|
918
868
|
}
|
|
919
869
|
}
|
|
920
870
|
this.parseStringTexts(bit);
|
|
921
|
-
const out = wasm2.convert(JSON.stringify([{ bit }]), "json", "json", "optimized", false, 2, 1);
|
|
871
|
+
const out = wasm2.convert(JSON.stringify([{ bit }]), "json", "json", "optimized", false, 2, 1, false);
|
|
922
872
|
if (out.startsWith("error:")) {
|
|
923
873
|
throw new Error(out.slice("error:".length).trim());
|
|
924
874
|
}
|
|
@@ -1042,8 +992,10 @@ var BitmarkParserGenerator = class {
|
|
|
1042
992
|
const outputFormat = opts.outputFormat ?? (isBitmark ? "json" : "bitmark");
|
|
1043
993
|
const coreFormat = outputFormat === "ast" ? "json" : outputFormat;
|
|
1044
994
|
const { pretty, indent } = prettyIndent(jsonOptions.prettify);
|
|
995
|
+
const emit = coreFormat === "bitmark" ? prettyIndent(bitmarkOptions.prettifyJson) : { pretty, indent };
|
|
1045
996
|
const spaces = spacesAround(bitmarkOptions.spacesAroundValues);
|
|
1046
|
-
const
|
|
997
|
+
const includeUnknown = !jsonOptions.excludeUnknownProperties;
|
|
998
|
+
const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", coreFormat, "optimized", emit.pretty, emit.indent, spaces, includeUnknown);
|
|
1047
999
|
this.throwOnError(out);
|
|
1048
1000
|
if (outputFormat === "bitmark" || outputFormat === "text") {
|
|
1049
1001
|
return this.deliver(out, opts.outputFile, opts.fileOptions);
|
|
@@ -1073,7 +1025,9 @@ var BitmarkParserGenerator = class {
|
|
|
1073
1025
|
this.checkBrowserFileWrite(opts.outputFile);
|
|
1074
1026
|
const wasm2 = getLegacyWasm();
|
|
1075
1027
|
const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);
|
|
1076
|
-
const { pretty, indent } = prettyIndent(
|
|
1028
|
+
const { pretty, indent } = prettyIndent(
|
|
1029
|
+
isBitmark ? bitmarkOptions.prettifyJson : jsonOptions.prettify
|
|
1030
|
+
);
|
|
1077
1031
|
const spaces = spacesAround(bitmarkOptions.spacesAroundValues);
|
|
1078
1032
|
const out = wasm2.canonicalize(source, isBitmark ? "bitmark" : "json", "optimized", pretty, indent, spaces);
|
|
1079
1033
|
this.throwOnError(out);
|
|
@@ -1125,7 +1079,7 @@ var BitmarkParserGenerator = class {
|
|
|
1125
1079
|
const isHtmlInput = opts.inputFormat === "html" || opts.inputFormat === void 0 && typeof input === "string" && /<table[\s>]/iu.test(inStr);
|
|
1126
1080
|
if (!isHtmlInput) {
|
|
1127
1081
|
const { source, isBitmark } = this.resolveInput(input, void 0);
|
|
1128
|
-
const out2 = wasm2.convert(source, isBitmark ? "bitmark" : "json", "html", "optimized", false, 2, 1);
|
|
1082
|
+
const out2 = wasm2.convert(source, isBitmark ? "bitmark" : "json", "html", "optimized", false, 2, 1, false);
|
|
1129
1083
|
this.throwOnError(out2);
|
|
1130
1084
|
return this.deliver(extractHtmlTables(out2).join("\n"), opts.outputFile, opts.fileOptions);
|
|
1131
1085
|
}
|
|
@@ -1135,12 +1089,12 @@ var BitmarkParserGenerator = class {
|
|
|
1135
1089
|
const { pretty, indent } = prettyIndent(jsonOptions.prettify);
|
|
1136
1090
|
const spaces = spacesAround(bitmarkOptions.spacesAroundValues);
|
|
1137
1091
|
if (outputFormat === "html") {
|
|
1138
|
-
const out2 = wasm2.convert(wrapped, "html", "html", "optimized", false, 2, 1);
|
|
1092
|
+
const out2 = wasm2.convert(wrapped, "html", "html", "optimized", false, 2, 1, false);
|
|
1139
1093
|
this.throwOnError(out2);
|
|
1140
1094
|
return this.deliver(extractHtmlTables(out2).join("\n"), opts.outputFile, opts.fileOptions);
|
|
1141
1095
|
}
|
|
1142
1096
|
const coreFormat = outputFormat === "ast" ? "json" : outputFormat;
|
|
1143
|
-
const out = wasm2.convert(wrapped, "html", coreFormat, "optimized", pretty, indent, spaces);
|
|
1097
|
+
const out = wasm2.convert(wrapped, "html", coreFormat, "optimized", pretty, indent, spaces, false);
|
|
1144
1098
|
this.throwOnError(out);
|
|
1145
1099
|
if (outputFormat === "bitmark" || outputFormat === "text") {
|
|
1146
1100
|
return this.deliver(out, opts.outputFile, opts.fileOptions);
|
|
@@ -1165,7 +1119,7 @@ var BitmarkParserGenerator = class {
|
|
|
1165
1119
|
const opts = Object.assign({}, options);
|
|
1166
1120
|
const wasm2 = getLegacyWasm();
|
|
1167
1121
|
const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);
|
|
1168
|
-
const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "json", "optimized", false, 2, 1);
|
|
1122
|
+
const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "json", "optimized", false, 2, 1, true);
|
|
1169
1123
|
this.throwOnError(out);
|
|
1170
1124
|
return makePseudoAst(JSON.parse(out));
|
|
1171
1125
|
}
|
|
@@ -1272,7 +1226,7 @@ var BitmarkParserGenerator = class {
|
|
|
1272
1226
|
}
|
|
1273
1227
|
}
|
|
1274
1228
|
const { source, isBitmark } = this.resolveInput(input, void 0);
|
|
1275
|
-
const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "text", "optimized", false, 2, 1);
|
|
1229
|
+
const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "text", "optimized", false, 2, 1, false);
|
|
1276
1230
|
this.throwOnError(out);
|
|
1277
1231
|
return out;
|
|
1278
1232
|
}
|
|
@@ -1763,19 +1717,25 @@ function version() {
|
|
|
1763
1717
|
function lex2(input, options = {}) {
|
|
1764
1718
|
return lex(input, options.stage ?? "lex");
|
|
1765
1719
|
}
|
|
1766
|
-
function
|
|
1767
|
-
|
|
1768
|
-
|
|
1769
|
-
|
|
1770
|
-
|
|
1720
|
+
function bitmarkToObjects(input, options = {}) {
|
|
1721
|
+
const out = convert(
|
|
1722
|
+
input,
|
|
1723
|
+
"bitmark",
|
|
1724
|
+
"json",
|
|
1725
|
+
options.mode ?? "optimized",
|
|
1726
|
+
false,
|
|
1727
|
+
2,
|
|
1728
|
+
1,
|
|
1729
|
+
options.includeUnknownProperties ?? false
|
|
1730
|
+
);
|
|
1771
1731
|
if (out.startsWith("error:")) throw new Error(out.slice("error:".length).trim());
|
|
1772
1732
|
return JSON.parse(out);
|
|
1773
1733
|
}
|
|
1774
|
-
function
|
|
1734
|
+
function objectsToBitmark(bits, options = {}) {
|
|
1775
1735
|
const entries = bits.map(
|
|
1776
1736
|
(b) => b !== null && typeof b === "object" && "bit" in b && typeof b.bit === "object" ? b : { bit: b }
|
|
1777
1737
|
);
|
|
1778
|
-
const out = convert(JSON.stringify(entries), "json", "bitmark", options.mode ?? "optimized", false, 2, 1);
|
|
1738
|
+
const out = convert(JSON.stringify(entries), "json", "bitmark", options.mode ?? "optimized", false, 2, 1, false);
|
|
1779
1739
|
if (out.startsWith("error:")) throw new Error(out.slice("error:".length).trim());
|
|
1780
1740
|
return out;
|
|
1781
1741
|
}
|
|
@@ -1787,16 +1747,10 @@ function convert2(input, options = {}) {
|
|
|
1787
1747
|
options.mode ?? "optimized",
|
|
1788
1748
|
options.pretty ?? false,
|
|
1789
1749
|
options.indent ?? 2,
|
|
1790
|
-
options.spacesAroundValues ?? 1
|
|
1750
|
+
options.spacesAroundValues ?? 1,
|
|
1751
|
+
options.includeUnknownProperties ?? false
|
|
1791
1752
|
);
|
|
1792
1753
|
}
|
|
1793
|
-
function optimize2(input, options = {}) {
|
|
1794
|
-
return optimize(input, options.inputFormat ?? "auto", options.pretty ?? false, options.indent ?? 2);
|
|
1795
|
-
}
|
|
1796
|
-
function fullize2(input, options = {}) {
|
|
1797
|
-
return fullize(input, options.inputFormat ?? "auto", options.pretty ?? false, options.indent ?? 2);
|
|
1798
|
-
}
|
|
1799
|
-
var expand = fullize2;
|
|
1800
1754
|
function canonicalize2(input, options = {}) {
|
|
1801
1755
|
return canonicalize(
|
|
1802
1756
|
input,
|
|
@@ -1853,21 +1807,17 @@ function info2(options = {}) {
|
|
|
1853
1807
|
return info(infoType, format, bit, pretty, indent);
|
|
1854
1808
|
}
|
|
1855
1809
|
export {
|
|
1810
|
+
bitmarkToObjects,
|
|
1856
1811
|
breakscapeText,
|
|
1857
1812
|
canonicalize2 as canonicalize,
|
|
1858
1813
|
convert2 as convert,
|
|
1859
1814
|
countBits,
|
|
1860
|
-
expand,
|
|
1861
|
-
fullize2 as fullize,
|
|
1862
|
-
generateBits,
|
|
1863
1815
|
info2 as info,
|
|
1864
1816
|
init,
|
|
1865
1817
|
initSync,
|
|
1866
1818
|
legacy_exports as legacy,
|
|
1867
1819
|
lex2 as lex,
|
|
1868
|
-
|
|
1869
|
-
parse2 as parse,
|
|
1870
|
-
parseBits,
|
|
1820
|
+
objectsToBitmark,
|
|
1871
1821
|
patchEntry,
|
|
1872
1822
|
splitBits,
|
|
1873
1823
|
transform2 as transform,
|