@gmb/bitmark-parser 6.5.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.
- package/README.md +12 -0
- 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 +25 -13
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +351 -51
- package/dist/browser/esm/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/esm/index.d.ts +351 -51
- package/dist/browser/esm/index.js +25 -13
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js.map +1 -1
- package/dist/index.cjs +23 -11
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +350 -50
- package/dist/index.d.ts +350 -50
- package/dist/index.js +23 -11
- package/dist/index.js.map +1 -1
- package/dist/legacy.cjs +8 -8
- package/dist/legacy.cjs.map +1 -1
- package/dist/legacy.js +8 -8
- package/dist/legacy.js.map +1 -1
- package/package.json +6 -6
- package/schema/bitmark.schema.json +1500 -321
- package/wasm/bitmark_wasm.d.ts +3 -1
- package/wasm/bitmark_wasm.js +5 -2
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +1 -1
- package/wasm/package.json +1 -1
|
@@ -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.
|
|
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(
|
|
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 = {}) {
|