@gmb/bitmark-parser 7.6.0 → 7.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 +54 -1
- package/config/bitmark.json +2 -2
- package/dist/browser/bitmark-parser.min.js +6 -6
- package/dist/browser/bitmark-parser.min.js.map +1 -1
- package/dist/browser/cjs/index.cjs +669 -241
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +104 -7
- package/dist/browser/esm/index.d.ts +104 -7
- package/dist/browser/esm/index.js +668 -241
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js +626 -233
- package/dist/browser/esm/worker-entry.js.map +1 -1
- package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
- package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
- package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
- package/dist/index.cjs +39 -4
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +104 -7
- package/dist/index.d.ts +104 -7
- package/dist/index.js +38 -4
- package/dist/index.js.map +1 -1
- package/dist/legacy.cjs +1 -1
- package/dist/legacy.cjs.map +1 -1
- package/dist/legacy.js +1 -1
- package/dist/legacy.js.map +1 -1
- package/dist/worker-entry.cjs.map +1 -1
- package/package.json +7 -7
- package/schema/bitmark.schema.json +1 -1
- package/wasm/bitmark_wasm.d.ts +65 -31
- package/wasm/bitmark_wasm.js +288 -122
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +6 -1
- package/wasm/package.json +1 -1
- package/wasm-bitmark-json/bitmark_json_wasm.d.ts +72 -38
- package/wasm-bitmark-json/bitmark_json_wasm.js +301 -135
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +6 -1
- package/wasm-bitmark-json/package.json +1 -1
- package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +65 -31
- package/wasm-browser-full/bitmark_browser_full_wasm.js +288 -122
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +6 -1
- package/wasm-browser-full/package.json +1 -1
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/dist/index.cjs
CHANGED
|
@@ -43,6 +43,7 @@ __export(src_exports, {
|
|
|
43
43
|
canonicalize: () => canonicalize,
|
|
44
44
|
complete: () => complete,
|
|
45
45
|
convert: () => convert,
|
|
46
|
+
convertWithDetails: () => convertWithDetails,
|
|
46
47
|
countBits: () => countBits,
|
|
47
48
|
diagnostics: () => diagnostics,
|
|
48
49
|
diff: () => diff,
|
|
@@ -76,7 +77,7 @@ var import_node_module = require("module");
|
|
|
76
77
|
// src/generated/package_info.ts
|
|
77
78
|
var PACKAGE_INFO = {
|
|
78
79
|
"name": "@gmb/bitmark-parser",
|
|
79
|
-
"version": "7.
|
|
80
|
+
"version": "7.7.0",
|
|
80
81
|
"author": "Get More Brain Ltd <info@getmorebrain.com>",
|
|
81
82
|
"license": "ISC",
|
|
82
83
|
"description": "A parser for bitmark text, powered by WebAssembly."
|
|
@@ -158,7 +159,7 @@ function patchJsonOf(patch) {
|
|
|
158
159
|
}
|
|
159
160
|
function buildUnits(wasm, input, inputIsBitmark) {
|
|
160
161
|
if (inputIsBitmark) {
|
|
161
|
-
const slices = JSON.parse(wasm.split_bits(input));
|
|
162
|
+
const slices = JSON.parse(wasm.split_bits(input, "utf-8"));
|
|
162
163
|
return slices.map((s) => ({
|
|
163
164
|
view: { format: "bitmark", index: s.index, total: slices.length, source: s.source },
|
|
164
165
|
source: s.source
|
|
@@ -1538,6 +1539,39 @@ function convert(input, options = {}) {
|
|
|
1538
1539
|
options.tokensLayout ?? ""
|
|
1539
1540
|
);
|
|
1540
1541
|
}
|
|
1542
|
+
function convertWithDetails(input, options = {}) {
|
|
1543
|
+
const details = getActive().convert_with_details(
|
|
1544
|
+
input,
|
|
1545
|
+
options.inputFormat ?? "auto",
|
|
1546
|
+
options.outputFormat ?? "auto",
|
|
1547
|
+
options.mode ?? "optimized",
|
|
1548
|
+
options.pretty ?? false,
|
|
1549
|
+
options.indent ?? 2,
|
|
1550
|
+
options.spacesAroundValues ?? 1,
|
|
1551
|
+
options.includeUnknownProperties ?? false,
|
|
1552
|
+
options.mappingReport ?? false,
|
|
1553
|
+
options.positionEncoding ?? "",
|
|
1554
|
+
options.tokensLayout ?? "",
|
|
1555
|
+
options.bitSpans ?? false
|
|
1556
|
+
);
|
|
1557
|
+
try {
|
|
1558
|
+
const result = { output: details.take_data() };
|
|
1559
|
+
const flat = details.bit_spans();
|
|
1560
|
+
if (flat !== void 0) {
|
|
1561
|
+
const spans = new Array(flat.length / 3);
|
|
1562
|
+
for (let i = 0, j = 0; j < flat.length; i++, j += 3) {
|
|
1563
|
+
spans[i] = { index: flat[j], start: flat[j + 1], end: flat[j + 2] };
|
|
1564
|
+
}
|
|
1565
|
+
result.bitSpans = {
|
|
1566
|
+
positionEncoding: details.bit_spans_encoding(),
|
|
1567
|
+
spans
|
|
1568
|
+
};
|
|
1569
|
+
}
|
|
1570
|
+
return result;
|
|
1571
|
+
} finally {
|
|
1572
|
+
details.free();
|
|
1573
|
+
}
|
|
1574
|
+
}
|
|
1541
1575
|
function semanticTokens(input, options = {}) {
|
|
1542
1576
|
return JSON.parse(
|
|
1543
1577
|
convert(input, {
|
|
@@ -1607,8 +1641,8 @@ function canonicalize(input, options = {}) {
|
|
|
1607
1641
|
function countBits(input) {
|
|
1608
1642
|
return Number.parseInt(getActive().count_bits(input), 10);
|
|
1609
1643
|
}
|
|
1610
|
-
function splitBits(input) {
|
|
1611
|
-
return JSON.parse(getActive().split_bits(input));
|
|
1644
|
+
function splitBits(input, options = {}) {
|
|
1645
|
+
return JSON.parse(getActive().split_bits(input, options.positionEncoding ?? ""));
|
|
1612
1646
|
}
|
|
1613
1647
|
function transform(input, options = {}) {
|
|
1614
1648
|
const wasm = getActive();
|
|
@@ -1741,6 +1775,7 @@ function transformParallel(input, options = {}) {
|
|
|
1741
1775
|
canonicalize,
|
|
1742
1776
|
complete,
|
|
1743
1777
|
convert,
|
|
1778
|
+
convertWithDetails,
|
|
1744
1779
|
countBits,
|
|
1745
1780
|
diagnostics,
|
|
1746
1781
|
diff,
|