@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.
- package/README.md +9 -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 +8 -1
- package/dist/browser/esm/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/esm/index.d.ts +8 -1
- 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 +7 -0
- package/dist/index.d.ts +7 -0
- 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/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
package/dist/index.d.cts
CHANGED
|
@@ -13879,6 +13879,13 @@ interface ConvertOptions$1 {
|
|
|
13879
13879
|
* back to bitmark, and each occurrence still warns.
|
|
13880
13880
|
*/
|
|
13881
13881
|
includeUnknownProperties?: boolean;
|
|
13882
|
+
/**
|
|
13883
|
+
* Replace the converted output with a human-readable MAPPING REPORT of
|
|
13884
|
+
* what each input construct mapped to — including inputs that are NOT
|
|
13885
|
+
* mapped (default: `false`). Composite conversions (e.g. xml → json)
|
|
13886
|
+
* report every leg, one section after the other.
|
|
13887
|
+
*/
|
|
13888
|
+
mappingReport?: boolean;
|
|
13882
13889
|
}
|
|
13883
13890
|
/** Options for the {@link canonicalize} function (the single same-format
|
|
13884
13891
|
* re-emit surface; `mode` covers what the removed optimize/fullize did). */
|
package/dist/index.d.ts
CHANGED
|
@@ -13879,6 +13879,13 @@ interface ConvertOptions$1 {
|
|
|
13879
13879
|
* back to bitmark, and each occurrence still warns.
|
|
13880
13880
|
*/
|
|
13881
13881
|
includeUnknownProperties?: boolean;
|
|
13882
|
+
/**
|
|
13883
|
+
* Replace the converted output with a human-readable MAPPING REPORT of
|
|
13884
|
+
* what each input construct mapped to — including inputs that are NOT
|
|
13885
|
+
* mapped (default: `false`). Composite conversions (e.g. xml → json)
|
|
13886
|
+
* report every leg, one section after the other.
|
|
13887
|
+
*/
|
|
13888
|
+
mappingReport?: boolean;
|
|
13882
13889
|
}
|
|
13883
13890
|
/** Options for the {@link canonicalize} function (the single same-format
|
|
13884
13891
|
* re-emit surface; `mode` covers what the removed optimize/fullize did). */
|
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.
|
|
13
|
+
"version": "6.7.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(
|
|
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 = {}) {
|