@gmb/bitmark-parser 6.6.0 → 6.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@ interface InitOutput {
2
2
  readonly memory: WebAssembly.Memory;
3
3
  readonly breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
4
4
  readonly canonicalize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
5
- readonly convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
5
+ readonly convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => void;
6
6
  readonly convert_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
7
7
  readonly count_bits: (a: number, b: number, c: number) => void;
8
8
  readonly info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
@@ -15698,6 +15698,13 @@ interface ConvertOptions {
15698
15698
  * back to bitmark, and each occurrence still warns.
15699
15699
  */
15700
15700
  includeUnknownProperties?: boolean;
15701
+ /**
15702
+ * Replace the converted output with a human-readable MAPPING REPORT of
15703
+ * what each input construct mapped to — including inputs that are NOT
15704
+ * mapped (default: `false`). Composite conversions (e.g. xml → json)
15705
+ * report every leg, one section after the other.
15706
+ */
15707
+ mappingReport?: boolean;
15701
15708
  }
15702
15709
  /** Options for the {@link canonicalize} function (the single same-format
15703
15710
  * re-emit surface; `mode` covers what the removed optimize/fullize did). */
@@ -2,7 +2,7 @@ interface InitOutput {
2
2
  readonly memory: WebAssembly.Memory;
3
3
  readonly breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
4
4
  readonly canonicalize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
5
- readonly convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number) => void;
5
+ readonly convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => void;
6
6
  readonly convert_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
7
7
  readonly count_bits: (a: number, b: number, c: number) => void;
8
8
  readonly info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
@@ -15698,6 +15698,13 @@ interface ConvertOptions {
15698
15698
  * back to bitmark, and each occurrence still warns.
15699
15699
  */
15700
15700
  includeUnknownProperties?: boolean;
15701
+ /**
15702
+ * Replace the converted output with a human-readable MAPPING REPORT of
15703
+ * what each input construct mapped to — including inputs that are NOT
15704
+ * mapped (default: `false`). Composite conversions (e.g. xml → json)
15705
+ * report every leg, one section after the other.
15706
+ */
15707
+ mappingReport?: boolean;
15701
15708
  }
15702
15709
  /** Options for the {@link canonicalize} function (the single same-format
15703
15710
  * re-emit surface; `mode` covers what the removed optimize/fullize did). */
@@ -206,7 +206,7 @@ function transform(input, input_format_sel, output_format_sel, mode, patch_json,
206
206
  wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
207
207
  }
208
208
  }
209
- function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties) {
209
+ function convert(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report) {
210
210
  let deferred5_0;
211
211
  let deferred5_1;
212
212
  try {
@@ -219,7 +219,7 @@ function convert(input, input_format_sel, output_format_sel, mode, pretty, inden
219
219
  const len2 = WASM_VECTOR_LEN;
220
220
  const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
221
221
  const len3 = WASM_VECTOR_LEN;
222
- wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties);
222
+ wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report);
223
223
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
224
224
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
225
225
  deferred5_0 = r0;
@@ -434,7 +434,7 @@ var bitmark_wasm_default = __wbg_init;
434
434
  // src/generated/package_info.ts
435
435
  var PACKAGE_INFO = {
436
436
  "name": "@gmb/bitmark-parser",
437
- "version": "6.6.0",
437
+ "version": "6.7.0",
438
438
  "author": "Get More Brain Ltd <info@getmorebrain.com>",
439
439
  "license": "ISC",
440
440
  "description": "A parser for bitmark text, powered by WebAssembly."
@@ -877,7 +877,7 @@ var Builder = class {
877
877
  }
878
878
  }
879
879
  this.parseStringTexts(bit);
880
- const out = wasm2.convert(JSON.stringify([{ bit }]), "json", "json", "optimized", false, 2, 1, false);
880
+ const out = wasm2.convert(JSON.stringify([{ bit }]), "json", "json", "optimized", false, 2, 1, false, false);
881
881
  if (out.startsWith("error:")) {
882
882
  throw new Error(out.slice("error:".length).trim());
883
883
  }
@@ -1017,7 +1017,7 @@ var BitmarkParserGenerator = class {
1017
1017
  const emit = coreFormat === "bitmark" ? prettyIndent(bitmarkOptions.prettifyJson) : { pretty, indent };
1018
1018
  const spaces = spacesAround(bitmarkOptions.spacesAroundValues);
1019
1019
  const includeUnknown = !jsonOptions.excludeUnknownProperties;
1020
- const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", coreFormat, "optimized", emit.pretty, emit.indent, spaces, includeUnknown);
1020
+ const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", coreFormat, "optimized", emit.pretty, emit.indent, spaces, includeUnknown, false);
1021
1021
  this.throwOnError(out);
1022
1022
  if (outputFormat === "bitmark" || outputFormat === "text") {
1023
1023
  return this.deliver(out, opts.outputFile, opts.fileOptions);
@@ -1101,7 +1101,7 @@ var BitmarkParserGenerator = class {
1101
1101
  const isHtmlInput = opts.inputFormat === "html" || opts.inputFormat === void 0 && typeof input === "string" && /<table[\s>]/iu.test(inStr);
1102
1102
  if (!isHtmlInput) {
1103
1103
  const { source, isBitmark } = this.resolveInput(input, void 0);
1104
- const out2 = wasm2.convert(source, isBitmark ? "bitmark" : "json", "html", "optimized", false, 2, 1, false);
1104
+ const out2 = wasm2.convert(source, isBitmark ? "bitmark" : "json", "html", "optimized", false, 2, 1, false, false);
1105
1105
  this.throwOnError(out2);
1106
1106
  return this.deliver(extractHtmlTables(out2).join("\n"), opts.outputFile, opts.fileOptions);
1107
1107
  }
@@ -1111,12 +1111,12 @@ var BitmarkParserGenerator = class {
1111
1111
  const { pretty, indent } = prettyIndent(jsonOptions.prettify);
1112
1112
  const spaces = spacesAround(bitmarkOptions.spacesAroundValues);
1113
1113
  if (outputFormat === "html") {
1114
- const out2 = wasm2.convert(wrapped, "html", "html", "optimized", false, 2, 1, false);
1114
+ const out2 = wasm2.convert(wrapped, "html", "html", "optimized", false, 2, 1, false, false);
1115
1115
  this.throwOnError(out2);
1116
1116
  return this.deliver(extractHtmlTables(out2).join("\n"), opts.outputFile, opts.fileOptions);
1117
1117
  }
1118
1118
  const coreFormat = outputFormat === "ast" ? "json" : outputFormat;
1119
- const out = wasm2.convert(wrapped, "html", coreFormat, "optimized", pretty, indent, spaces, false);
1119
+ const out = wasm2.convert(wrapped, "html", coreFormat, "optimized", pretty, indent, spaces, false, false);
1120
1120
  this.throwOnError(out);
1121
1121
  if (outputFormat === "bitmark" || outputFormat === "text") {
1122
1122
  return this.deliver(out, opts.outputFile, opts.fileOptions);
@@ -1141,7 +1141,7 @@ var BitmarkParserGenerator = class {
1141
1141
  const opts = Object.assign({}, options);
1142
1142
  const wasm2 = getLegacyWasm();
1143
1143
  const { source, isBitmark } = this.resolveInput(input, opts.inputFormat);
1144
- const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "json", "optimized", false, 2, 1, true);
1144
+ const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "json", "optimized", false, 2, 1, true, false);
1145
1145
  this.throwOnError(out);
1146
1146
  return makePseudoAst(JSON.parse(out));
1147
1147
  }
@@ -1248,7 +1248,7 @@ var BitmarkParserGenerator = class {
1248
1248
  }
1249
1249
  }
1250
1250
  const { source, isBitmark } = this.resolveInput(input, void 0);
1251
- const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "text", "optimized", false, 2, 1, false);
1251
+ const out = wasm2.convert(source, isBitmark ? "bitmark" : "json", "text", "optimized", false, 2, 1, false, false);
1252
1252
  this.throwOnError(out);
1253
1253
  return out;
1254
1254
  }
@@ -1748,7 +1748,8 @@ function bitmarkToObjects(input, options = {}) {
1748
1748
  false,
1749
1749
  2,
1750
1750
  1,
1751
- options.includeUnknownProperties ?? false
1751
+ options.includeUnknownProperties ?? false,
1752
+ false
1752
1753
  );
1753
1754
  if (out.startsWith("error:")) throw new Error(out.slice("error:".length).trim());
1754
1755
  return JSON.parse(out);
@@ -1757,7 +1758,17 @@ function objectsToBitmark(bits, options = {}) {
1757
1758
  const entries = bits.map(
1758
1759
  (b) => b !== null && typeof b === "object" && "bit" in b && typeof b.bit === "object" ? b : { bit: b }
1759
1760
  );
1760
- const out = convert(JSON.stringify(entries), "json", "bitmark", options.mode ?? "optimized", false, 2, 1, false);
1761
+ const out = convert(
1762
+ JSON.stringify(entries),
1763
+ "json",
1764
+ "bitmark",
1765
+ options.mode ?? "optimized",
1766
+ false,
1767
+ 2,
1768
+ 1,
1769
+ false,
1770
+ false
1771
+ );
1761
1772
  if (out.startsWith("error:")) throw new Error(out.slice("error:".length).trim());
1762
1773
  return out;
1763
1774
  }
@@ -1770,7 +1781,8 @@ function convert2(input, options = {}) {
1770
1781
  options.pretty ?? false,
1771
1782
  options.indent ?? 2,
1772
1783
  options.spacesAroundValues ?? 1,
1773
- options.includeUnknownProperties ?? false
1784
+ options.includeUnknownProperties ?? false,
1785
+ options.mappingReport ?? false
1774
1786
  );
1775
1787
  }
1776
1788
  function canonicalize2(input, options = {}) {