@gmb/bitmark-parser 6.6.0 → 6.8.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/dist/index.js CHANGED
@@ -10,7 +10,7 @@ import { createRequire } from "module";
10
10
  // src/generated/package_info.ts
11
11
  var PACKAGE_INFO = {
12
12
  "name": "@gmb/bitmark-parser",
13
- "version": "6.6.0",
13
+ "version": "6.8.0",
14
14
  "author": "Get More Brain Ltd <info@getmorebrain.com>",
15
15
  "license": "ISC",
16
16
  "description": "A parser for bitmark text, powered by WebAssembly."
@@ -489,7 +489,7 @@ var Builder = class {
489
489
  }
490
490
  }
491
491
  this.parseStringTexts(bit);
492
- const out = wasm2.convert(JSON.stringify([{ bit }]), "json", "json", "optimized", false, 2, 1, false);
492
+ const out = wasm2.convert(JSON.stringify([{ bit }]), "json", "json", "optimized", false, 2, 1, false, false);
493
493
  if (out.startsWith("error:")) {
494
494
  throw new Error(out.slice("error:".length).trim());
495
495
  }
@@ -629,7 +629,7 @@ var BitmarkParserGenerator = class {
629
629
  const emit = coreFormat === "bitmark" ? prettyIndent(bitmarkOptions.prettifyJson) : { pretty, indent };
630
630
  const spaces = spacesAround(bitmarkOptions.spacesAroundValues);
631
631
  const includeUnknown = !jsonOptions.excludeUnknownProperties;
632
- const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", coreFormat, "optimized", emit.pretty, emit.indent, spaces, includeUnknown);
632
+ const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", coreFormat, "optimized", emit.pretty, emit.indent, spaces, includeUnknown, false);
633
633
  this.throwOnError(out);
634
634
  if (outputFormat === "bitmark" || outputFormat === "text") {
635
635
  return this.deliver(out, opts.outputFile, opts.fileOptions);
@@ -713,7 +713,7 @@ var BitmarkParserGenerator = class {
713
713
  const isHtmlInput = opts.inputFormat === "html" || opts.inputFormat === void 0 && typeof input === "string" && /<table[\s>]/iu.test(inStr);
714
714
  if (!isHtmlInput) {
715
715
  const { source, isBitmark } = this.resolveInput(input, void 0);
716
- const out2 = wasm2.convert(source, isBitmark ? "bitmark" : "json", "html", "optimized", false, 2, 1, false);
716
+ const out2 = wasm2.convert(source, isBitmark ? "bitmark" : "json", "html", "optimized", false, 2, 1, false, false);
717
717
  this.throwOnError(out2);
718
718
  return this.deliver(extractHtmlTables(out2).join("\n"), opts.outputFile, opts.fileOptions);
719
719
  }
@@ -723,12 +723,12 @@ var BitmarkParserGenerator = class {
723
723
  const { pretty, indent } = prettyIndent(jsonOptions.prettify);
724
724
  const spaces = spacesAround(bitmarkOptions.spacesAroundValues);
725
725
  if (outputFormat === "html") {
726
- const out2 = wasm2.convert(wrapped, "html", "html", "optimized", false, 2, 1, false);
726
+ const out2 = wasm2.convert(wrapped, "html", "html", "optimized", false, 2, 1, false, false);
727
727
  this.throwOnError(out2);
728
728
  return this.deliver(extractHtmlTables(out2).join("\n"), opts.outputFile, opts.fileOptions);
729
729
  }
730
730
  const coreFormat = outputFormat === "ast" ? "json" : outputFormat;
731
- const out = wasm2.convert(wrapped, "html", coreFormat, "optimized", pretty, indent, spaces, false);
731
+ const out = wasm2.convert(wrapped, "html", coreFormat, "optimized", pretty, indent, spaces, false, false);
732
732
  this.throwOnError(out);
733
733
  if (outputFormat === "bitmark" || outputFormat === "text") {
734
734
  return this.deliver(out, opts.outputFile, opts.fileOptions);
@@ -753,7 +753,7 @@ var BitmarkParserGenerator = class {
753
753
  const opts = Object.assign({}, options);
754
754
  const wasm2 = getLegacyWasm();
755
755
  const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);
756
- const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "json", "optimized", false, 2, 1, true);
756
+ const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "json", "optimized", false, 2, 1, true, false);
757
757
  this.throwOnError(out);
758
758
  return makePseudoAst(JSON.parse(out));
759
759
  }
@@ -860,7 +860,7 @@ var BitmarkParserGenerator = class {
860
860
  }
861
861
  }
862
862
  const { source, isBitmark } = this.resolveInput(input, void 0);
863
- const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "text", "optimized", false, 2, 1, false);
863
+ const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "text", "optimized", false, 2, 1, false, false);
864
864
  this.throwOnError(out);
865
865
  return out;
866
866
  }
@@ -1354,7 +1354,8 @@ function bitmarkToObjects(input, options = {}) {
1354
1354
  false,
1355
1355
  2,
1356
1356
  1,
1357
- options.includeUnknownProperties ?? false
1357
+ options.includeUnknownProperties ?? false,
1358
+ false
1358
1359
  );
1359
1360
  if (out.startsWith("error:")) throw new Error(out.slice("error:".length).trim());
1360
1361
  return JSON.parse(out);
@@ -1363,7 +1364,17 @@ function objectsToBitmark(bits, options = {}) {
1363
1364
  const entries = bits.map(
1364
1365
  (b) => b !== null && typeof b === "object" && "bit" in b && typeof b.bit === "object" ? b : { bit: b }
1365
1366
  );
1366
- const out = wasm.convert(JSON.stringify(entries), "json", "bitmark", options.mode ?? "optimized", false, 2, 1, false);
1367
+ const out = wasm.convert(
1368
+ JSON.stringify(entries),
1369
+ "json",
1370
+ "bitmark",
1371
+ options.mode ?? "optimized",
1372
+ false,
1373
+ 2,
1374
+ 1,
1375
+ false,
1376
+ false
1377
+ );
1367
1378
  if (out.startsWith("error:")) throw new Error(out.slice("error:".length).trim());
1368
1379
  return out;
1369
1380
  }
@@ -1376,7 +1387,8 @@ function convert(input, options = {}) {
1376
1387
  options.pretty ?? false,
1377
1388
  options.indent ?? 2,
1378
1389
  options.spacesAroundValues ?? 1,
1379
- options.includeUnknownProperties ?? false
1390
+ options.includeUnknownProperties ?? false,
1391
+ options.mappingReport ?? false
1380
1392
  );
1381
1393
  }
1382
1394
  function canonicalize(input, options = {}) {