@gmb/bitmark-parser 7.2.0 → 7.3.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 +155 -23
- package/config/bitmark-json.tsp +330 -0
- package/config/bitmark.json +83394 -0
- package/dist/browser/bitmark-parser.min.js +6 -4
- package/dist/browser/bitmark-parser.min.js.map +1 -1
- package/dist/browser/cjs/index.cjs +140 -72
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +6286 -6806
- package/dist/browser/esm/index.d.ts +6286 -6806
- package/dist/browser/esm/index.js +139 -72
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js +86 -57
- 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 +76 -29
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +6286 -6806
- package/dist/index.d.ts +6286 -6806
- package/dist/index.js +75 -29
- package/dist/index.js.map +1 -1
- package/dist/legacy.cjs +4 -3
- package/dist/legacy.cjs.map +1 -1
- package/dist/legacy.d.cts +2 -1
- package/dist/legacy.d.ts +2 -1
- package/dist/legacy.js +4 -3
- package/dist/legacy.js.map +1 -1
- package/dist/worker-entry.cjs +23 -15
- package/dist/worker-entry.cjs.map +1 -1
- package/package.json +11 -7
- package/schema/bitmark.schema.json +10427 -14051
- package/wasm/bitmark_wasm.d.ts +12 -3
- package/wasm/bitmark_wasm.js +34 -15
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +2 -2
- package/wasm/package.json +1 -1
- package/wasm-bitmark-json/bitmark_json_wasm.d.ts +12 -3
- package/wasm-bitmark-json/bitmark_json_wasm.js +34 -15
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +2 -2
- package/wasm-bitmark-json/package.json +1 -1
- package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +12 -3
- package/wasm-browser-full/bitmark_browser_full_wasm.js +34 -15
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +2 -2
- package/wasm-browser-full/package.json +1 -1
|
@@ -27,6 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
CompletionItemTag: () => CompletionItemTag,
|
|
28
28
|
DiagnosticSeverity: () => DiagnosticSeverity,
|
|
29
29
|
NotInitializedError: () => NotInitializedError,
|
|
30
|
+
PatchError: () => PatchError,
|
|
30
31
|
RegisterError: () => RegisterError,
|
|
31
32
|
UnsupportedFeatureError: () => UnsupportedFeatureError,
|
|
32
33
|
bitmarkToObjects: () => bitmarkToObjects,
|
|
@@ -158,6 +159,9 @@ function passStringToWasm0(arg, malloc, realloc) {
|
|
|
158
159
|
WASM_VECTOR_LEN = offset;
|
|
159
160
|
return ptr;
|
|
160
161
|
}
|
|
162
|
+
function isLikeNone(x) {
|
|
163
|
+
return x === void 0 || x === null;
|
|
164
|
+
}
|
|
161
165
|
var cachedDataViewMemory0 = null;
|
|
162
166
|
function getDataViewMemory0() {
|
|
163
167
|
if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || cachedDataViewMemory0.buffer.detached === void 0 && cachedDataViewMemory0.buffer !== wasm.memory.buffer) {
|
|
@@ -165,9 +169,9 @@ function getDataViewMemory0() {
|
|
|
165
169
|
}
|
|
166
170
|
return cachedDataViewMemory0;
|
|
167
171
|
}
|
|
168
|
-
function breakscape_text(input, format, location) {
|
|
169
|
-
let
|
|
170
|
-
let
|
|
172
|
+
function breakscape_text(input, format, location, sub_location) {
|
|
173
|
+
let deferred5_0;
|
|
174
|
+
let deferred5_1;
|
|
171
175
|
try {
|
|
172
176
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
173
177
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -176,20 +180,22 @@ function breakscape_text(input, format, location) {
|
|
|
176
180
|
const len1 = WASM_VECTOR_LEN;
|
|
177
181
|
const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
178
182
|
const len2 = WASM_VECTOR_LEN;
|
|
179
|
-
|
|
183
|
+
var ptr3 = isLikeNone(sub_location) ? 0 : passStringToWasm0(sub_location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
184
|
+
var len3 = WASM_VECTOR_LEN;
|
|
185
|
+
wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
180
186
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
181
187
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
182
|
-
|
|
183
|
-
|
|
188
|
+
deferred5_0 = r0;
|
|
189
|
+
deferred5_1 = r1;
|
|
184
190
|
return getStringFromWasm0(r0, r1);
|
|
185
191
|
} finally {
|
|
186
192
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
187
|
-
wasm.__wbindgen_export_2(
|
|
193
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
188
194
|
}
|
|
189
195
|
}
|
|
190
|
-
function unbreakscape_text(input, format, location) {
|
|
191
|
-
let
|
|
192
|
-
let
|
|
196
|
+
function unbreakscape_text(input, format, location, sub_location) {
|
|
197
|
+
let deferred5_0;
|
|
198
|
+
let deferred5_1;
|
|
193
199
|
try {
|
|
194
200
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
195
201
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -198,15 +204,17 @@ function unbreakscape_text(input, format, location) {
|
|
|
198
204
|
const len1 = WASM_VECTOR_LEN;
|
|
199
205
|
const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
200
206
|
const len2 = WASM_VECTOR_LEN;
|
|
201
|
-
|
|
207
|
+
var ptr3 = isLikeNone(sub_location) ? 0 : passStringToWasm0(sub_location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
208
|
+
var len3 = WASM_VECTOR_LEN;
|
|
209
|
+
wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
202
210
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
203
211
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
204
|
-
|
|
205
|
-
|
|
212
|
+
deferred5_0 = r0;
|
|
213
|
+
deferred5_1 = r1;
|
|
206
214
|
return getStringFromWasm0(r0, r1);
|
|
207
215
|
} finally {
|
|
208
216
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
209
|
-
wasm.__wbindgen_export_2(
|
|
217
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
210
218
|
}
|
|
211
219
|
}
|
|
212
220
|
function info(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {
|
|
@@ -832,6 +840,9 @@ function passStringToWasm02(arg, malloc, realloc) {
|
|
|
832
840
|
WASM_VECTOR_LEN2 = offset;
|
|
833
841
|
return ptr;
|
|
834
842
|
}
|
|
843
|
+
function isLikeNone2(x) {
|
|
844
|
+
return x === void 0 || x === null;
|
|
845
|
+
}
|
|
835
846
|
var cachedDataViewMemory02 = null;
|
|
836
847
|
function getDataViewMemory02() {
|
|
837
848
|
if (cachedDataViewMemory02 === null || cachedDataViewMemory02.buffer.detached === true || cachedDataViewMemory02.buffer.detached === void 0 && cachedDataViewMemory02.buffer !== wasm2.memory.buffer) {
|
|
@@ -839,9 +850,9 @@ function getDataViewMemory02() {
|
|
|
839
850
|
}
|
|
840
851
|
return cachedDataViewMemory02;
|
|
841
852
|
}
|
|
842
|
-
function breakscape_text2(input, format, location) {
|
|
843
|
-
let
|
|
844
|
-
let
|
|
853
|
+
function breakscape_text2(input, format, location, sub_location) {
|
|
854
|
+
let deferred5_0;
|
|
855
|
+
let deferred5_1;
|
|
845
856
|
try {
|
|
846
857
|
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
847
858
|
const ptr0 = passStringToWasm02(input, wasm2.__wbindgen_export_0, wasm2.__wbindgen_export_1);
|
|
@@ -850,20 +861,22 @@ function breakscape_text2(input, format, location) {
|
|
|
850
861
|
const len1 = WASM_VECTOR_LEN2;
|
|
851
862
|
const ptr2 = passStringToWasm02(location, wasm2.__wbindgen_export_0, wasm2.__wbindgen_export_1);
|
|
852
863
|
const len2 = WASM_VECTOR_LEN2;
|
|
853
|
-
|
|
864
|
+
var ptr3 = isLikeNone2(sub_location) ? 0 : passStringToWasm02(sub_location, wasm2.__wbindgen_export_0, wasm2.__wbindgen_export_1);
|
|
865
|
+
var len3 = WASM_VECTOR_LEN2;
|
|
866
|
+
wasm2.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
854
867
|
var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
|
|
855
868
|
var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
|
|
856
|
-
|
|
857
|
-
|
|
869
|
+
deferred5_0 = r0;
|
|
870
|
+
deferred5_1 = r1;
|
|
858
871
|
return getStringFromWasm02(r0, r1);
|
|
859
872
|
} finally {
|
|
860
873
|
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
861
|
-
wasm2.__wbindgen_export_2(
|
|
874
|
+
wasm2.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
862
875
|
}
|
|
863
876
|
}
|
|
864
|
-
function unbreakscape_text2(input, format, location) {
|
|
865
|
-
let
|
|
866
|
-
let
|
|
877
|
+
function unbreakscape_text2(input, format, location, sub_location) {
|
|
878
|
+
let deferred5_0;
|
|
879
|
+
let deferred5_1;
|
|
867
880
|
try {
|
|
868
881
|
const retptr = wasm2.__wbindgen_add_to_stack_pointer(-16);
|
|
869
882
|
const ptr0 = passStringToWasm02(input, wasm2.__wbindgen_export_0, wasm2.__wbindgen_export_1);
|
|
@@ -872,15 +885,17 @@ function unbreakscape_text2(input, format, location) {
|
|
|
872
885
|
const len1 = WASM_VECTOR_LEN2;
|
|
873
886
|
const ptr2 = passStringToWasm02(location, wasm2.__wbindgen_export_0, wasm2.__wbindgen_export_1);
|
|
874
887
|
const len2 = WASM_VECTOR_LEN2;
|
|
875
|
-
|
|
888
|
+
var ptr3 = isLikeNone2(sub_location) ? 0 : passStringToWasm02(sub_location, wasm2.__wbindgen_export_0, wasm2.__wbindgen_export_1);
|
|
889
|
+
var len3 = WASM_VECTOR_LEN2;
|
|
890
|
+
wasm2.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
876
891
|
var r0 = getDataViewMemory02().getInt32(retptr + 4 * 0, true);
|
|
877
892
|
var r1 = getDataViewMemory02().getInt32(retptr + 4 * 1, true);
|
|
878
|
-
|
|
879
|
-
|
|
893
|
+
deferred5_0 = r0;
|
|
894
|
+
deferred5_1 = r1;
|
|
880
895
|
return getStringFromWasm02(r0, r1);
|
|
881
896
|
} finally {
|
|
882
897
|
wasm2.__wbindgen_add_to_stack_pointer(16);
|
|
883
|
-
wasm2.__wbindgen_export_2(
|
|
898
|
+
wasm2.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
884
899
|
}
|
|
885
900
|
}
|
|
886
901
|
function info2(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {
|
|
@@ -1504,6 +1519,9 @@ function passStringToWasm03(arg, malloc, realloc) {
|
|
|
1504
1519
|
WASM_VECTOR_LEN3 = offset;
|
|
1505
1520
|
return ptr;
|
|
1506
1521
|
}
|
|
1522
|
+
function isLikeNone3(x) {
|
|
1523
|
+
return x === void 0 || x === null;
|
|
1524
|
+
}
|
|
1507
1525
|
var cachedDataViewMemory03 = null;
|
|
1508
1526
|
function getDataViewMemory03() {
|
|
1509
1527
|
if (cachedDataViewMemory03 === null || cachedDataViewMemory03.buffer.detached === true || cachedDataViewMemory03.buffer.detached === void 0 && cachedDataViewMemory03.buffer !== wasm3.memory.buffer) {
|
|
@@ -1511,9 +1529,9 @@ function getDataViewMemory03() {
|
|
|
1511
1529
|
}
|
|
1512
1530
|
return cachedDataViewMemory03;
|
|
1513
1531
|
}
|
|
1514
|
-
function breakscape_text3(input, format, location) {
|
|
1515
|
-
let
|
|
1516
|
-
let
|
|
1532
|
+
function breakscape_text3(input, format, location, sub_location) {
|
|
1533
|
+
let deferred5_0;
|
|
1534
|
+
let deferred5_1;
|
|
1517
1535
|
try {
|
|
1518
1536
|
const retptr = wasm3.__wbindgen_add_to_stack_pointer(-16);
|
|
1519
1537
|
const ptr0 = passStringToWasm03(input, wasm3.__wbindgen_export_0, wasm3.__wbindgen_export_1);
|
|
@@ -1522,20 +1540,22 @@ function breakscape_text3(input, format, location) {
|
|
|
1522
1540
|
const len1 = WASM_VECTOR_LEN3;
|
|
1523
1541
|
const ptr2 = passStringToWasm03(location, wasm3.__wbindgen_export_0, wasm3.__wbindgen_export_1);
|
|
1524
1542
|
const len2 = WASM_VECTOR_LEN3;
|
|
1525
|
-
|
|
1543
|
+
var ptr3 = isLikeNone3(sub_location) ? 0 : passStringToWasm03(sub_location, wasm3.__wbindgen_export_0, wasm3.__wbindgen_export_1);
|
|
1544
|
+
var len3 = WASM_VECTOR_LEN3;
|
|
1545
|
+
wasm3.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1526
1546
|
var r0 = getDataViewMemory03().getInt32(retptr + 4 * 0, true);
|
|
1527
1547
|
var r1 = getDataViewMemory03().getInt32(retptr + 4 * 1, true);
|
|
1528
|
-
|
|
1529
|
-
|
|
1548
|
+
deferred5_0 = r0;
|
|
1549
|
+
deferred5_1 = r1;
|
|
1530
1550
|
return getStringFromWasm03(r0, r1);
|
|
1531
1551
|
} finally {
|
|
1532
1552
|
wasm3.__wbindgen_add_to_stack_pointer(16);
|
|
1533
|
-
wasm3.__wbindgen_export_2(
|
|
1553
|
+
wasm3.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
1534
1554
|
}
|
|
1535
1555
|
}
|
|
1536
|
-
function unbreakscape_text3(input, format, location) {
|
|
1537
|
-
let
|
|
1538
|
-
let
|
|
1556
|
+
function unbreakscape_text3(input, format, location, sub_location) {
|
|
1557
|
+
let deferred5_0;
|
|
1558
|
+
let deferred5_1;
|
|
1539
1559
|
try {
|
|
1540
1560
|
const retptr = wasm3.__wbindgen_add_to_stack_pointer(-16);
|
|
1541
1561
|
const ptr0 = passStringToWasm03(input, wasm3.__wbindgen_export_0, wasm3.__wbindgen_export_1);
|
|
@@ -1544,15 +1564,17 @@ function unbreakscape_text3(input, format, location) {
|
|
|
1544
1564
|
const len1 = WASM_VECTOR_LEN3;
|
|
1545
1565
|
const ptr2 = passStringToWasm03(location, wasm3.__wbindgen_export_0, wasm3.__wbindgen_export_1);
|
|
1546
1566
|
const len2 = WASM_VECTOR_LEN3;
|
|
1547
|
-
|
|
1567
|
+
var ptr3 = isLikeNone3(sub_location) ? 0 : passStringToWasm03(sub_location, wasm3.__wbindgen_export_0, wasm3.__wbindgen_export_1);
|
|
1568
|
+
var len3 = WASM_VECTOR_LEN3;
|
|
1569
|
+
wasm3.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
1548
1570
|
var r0 = getDataViewMemory03().getInt32(retptr + 4 * 0, true);
|
|
1549
1571
|
var r1 = getDataViewMemory03().getInt32(retptr + 4 * 1, true);
|
|
1550
|
-
|
|
1551
|
-
|
|
1572
|
+
deferred5_0 = r0;
|
|
1573
|
+
deferred5_1 = r1;
|
|
1552
1574
|
return getStringFromWasm03(r0, r1);
|
|
1553
1575
|
} finally {
|
|
1554
1576
|
wasm3.__wbindgen_add_to_stack_pointer(16);
|
|
1555
|
-
wasm3.__wbindgen_export_2(
|
|
1577
|
+
wasm3.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
1556
1578
|
}
|
|
1557
1579
|
}
|
|
1558
1580
|
function info3(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {
|
|
@@ -2047,7 +2069,7 @@ var bitmark_json_wasm_default = __wbg_init3;
|
|
|
2047
2069
|
// src/generated/package_info.ts
|
|
2048
2070
|
var PACKAGE_INFO = {
|
|
2049
2071
|
"name": "@gmb/bitmark-parser",
|
|
2050
|
-
"version": "7.
|
|
2072
|
+
"version": "7.3.0",
|
|
2051
2073
|
"author": "Get More Brain Ltd <info@getmorebrain.com>",
|
|
2052
2074
|
"license": "ISC",
|
|
2053
2075
|
"description": "A parser for bitmark text, powered by WebAssembly."
|
|
@@ -2067,6 +2089,18 @@ var RegisterError = class extends Error {
|
|
|
2067
2089
|
this.name = "RegisterError";
|
|
2068
2090
|
}
|
|
2069
2091
|
};
|
|
2092
|
+
var PatchError = class extends Error {
|
|
2093
|
+
constructor(diagnostics2) {
|
|
2094
|
+
const lines = diagnostics2.map((d) => `${d.kind} at ${d.path}: ${d.message}`);
|
|
2095
|
+
super(
|
|
2096
|
+
`${diagnostics2.length} patch ${diagnostics2.length === 1 ? "entry was" : "entries were"} skipped:
|
|
2097
|
+
` + lines.join("\n")
|
|
2098
|
+
);
|
|
2099
|
+
__publicField(this, "diagnostics");
|
|
2100
|
+
this.name = "PatchError";
|
|
2101
|
+
this.diagnostics = diagnostics2;
|
|
2102
|
+
}
|
|
2103
|
+
};
|
|
2070
2104
|
var UnsupportedFeatureError = class extends Error {
|
|
2071
2105
|
constructor(what, active2) {
|
|
2072
2106
|
super(
|
|
@@ -2173,6 +2207,18 @@ function planTransform(wasm4, input, options) {
|
|
|
2173
2207
|
spacesAroundValues
|
|
2174
2208
|
});
|
|
2175
2209
|
views.push(units[item.source].view);
|
|
2210
|
+
} else if (typeof item.bit === "string") {
|
|
2211
|
+
const index = jobs.length;
|
|
2212
|
+
jobs.push({
|
|
2213
|
+
index,
|
|
2214
|
+
source: item.bit,
|
|
2215
|
+
inputFormat: "bitmark",
|
|
2216
|
+
outputFormat: output,
|
|
2217
|
+
mode,
|
|
2218
|
+
patchJson: JSON.stringify(item.patch),
|
|
2219
|
+
spacesAroundValues
|
|
2220
|
+
});
|
|
2221
|
+
views.push({ format: "bitmark", index, total, source: item.bit });
|
|
2176
2222
|
} else {
|
|
2177
2223
|
const bit = item.bit ?? {};
|
|
2178
2224
|
const index = jobs.length;
|
|
@@ -2190,18 +2236,24 @@ function planTransform(wasm4, input, options) {
|
|
|
2190
2236
|
}
|
|
2191
2237
|
return { jobs, views, output, pretty, indent };
|
|
2192
2238
|
}
|
|
2239
|
+
function bitOutput(envelopeJson, outputFormat) {
|
|
2240
|
+
const { data, diagnostics: diagnostics2 } = JSON.parse(envelopeJson);
|
|
2241
|
+
return { element: outputFormat === "json" ? stripArray(data) : data, diagnostics: diagnostics2 };
|
|
2242
|
+
}
|
|
2193
2243
|
function computeBit(wasm4, job) {
|
|
2194
|
-
|
|
2195
|
-
|
|
2196
|
-
|
|
2197
|
-
|
|
2198
|
-
|
|
2199
|
-
|
|
2200
|
-
|
|
2201
|
-
|
|
2202
|
-
|
|
2244
|
+
return bitOutput(
|
|
2245
|
+
wasm4.transform(
|
|
2246
|
+
job.source,
|
|
2247
|
+
job.inputFormat,
|
|
2248
|
+
job.outputFormat,
|
|
2249
|
+
job.mode,
|
|
2250
|
+
job.patchJson,
|
|
2251
|
+
false,
|
|
2252
|
+
2,
|
|
2253
|
+
job.spacesAroundValues
|
|
2254
|
+
),
|
|
2255
|
+
job.outputFormat
|
|
2203
2256
|
);
|
|
2204
|
-
return job.outputFormat === "json" ? stripArray(out) : out;
|
|
2205
2257
|
}
|
|
2206
2258
|
function recombine(wasm4, elements, output, pretty, indent) {
|
|
2207
2259
|
if (output !== "json") return elements.join("\n");
|
|
@@ -2211,21 +2263,29 @@ function recombine(wasm4, elements, output, pretty, indent) {
|
|
|
2211
2263
|
function runHookedTransform(wasm4, input, options) {
|
|
2212
2264
|
const plan = planTransform(wasm4, input, options);
|
|
2213
2265
|
const rendered = [];
|
|
2266
|
+
const skipped = [];
|
|
2214
2267
|
for (let i = 0; i < plan.jobs.length; i++) {
|
|
2215
|
-
const element = computeBit(wasm4, plan.jobs[i]);
|
|
2268
|
+
const { element, diagnostics: diagnostics2 } = computeBit(wasm4, plan.jobs[i]);
|
|
2269
|
+
skipped.push(...diagnostics2);
|
|
2216
2270
|
options.postHook?.(plan.views[i], element);
|
|
2217
2271
|
rendered.push(element);
|
|
2218
2272
|
}
|
|
2273
|
+
if (skipped.length > 0) throw new PatchError(skipped);
|
|
2219
2274
|
return recombine(wasm4, rendered, plan.output, plan.pretty, plan.indent);
|
|
2220
2275
|
}
|
|
2221
2276
|
|
|
2222
2277
|
// src/core/parallel.ts
|
|
2223
2278
|
async function orchestrateParallel(wasm4, input, options, runJobs) {
|
|
2224
2279
|
const plan = planTransform(wasm4, input, options);
|
|
2225
|
-
const
|
|
2226
|
-
|
|
2227
|
-
|
|
2228
|
-
|
|
2280
|
+
const outputs = await runJobs(plan.jobs, options.workers ?? 4);
|
|
2281
|
+
const elements = [];
|
|
2282
|
+
const skipped = [];
|
|
2283
|
+
for (let i = 0; i < outputs.length; i++) {
|
|
2284
|
+
elements.push(outputs[i].element);
|
|
2285
|
+
skipped.push(...outputs[i].diagnostics);
|
|
2286
|
+
options.postHook?.(plan.views[i], outputs[i].element);
|
|
2287
|
+
}
|
|
2288
|
+
if (skipped.length > 0) throw new PatchError(skipped);
|
|
2229
2289
|
return recombine(wasm4, elements, plan.output, plan.pretty, plan.indent);
|
|
2230
2290
|
}
|
|
2231
2291
|
|
|
@@ -2273,7 +2333,7 @@ function runJobsWithPool(jobs, workers, spawn) {
|
|
|
2273
2333
|
const w = spawn((res) => {
|
|
2274
2334
|
if (done) return;
|
|
2275
2335
|
if (!res.ok) return finish(new Error(res.error ?? "worker job failed"));
|
|
2276
|
-
results[res.id] = res.element;
|
|
2336
|
+
results[res.id] = { element: res.element, diagnostics: res.diagnostics ?? [] };
|
|
2277
2337
|
if (++settled === jobs.length) finish();
|
|
2278
2338
|
else dispatch(w);
|
|
2279
2339
|
}, finish);
|
|
@@ -2615,7 +2675,7 @@ var Builder = class {
|
|
|
2615
2675
|
}
|
|
2616
2676
|
/**
|
|
2617
2677
|
* Look up the bit's config (`wasm.info`); throws bpg's exact
|
|
2618
|
-
*
|
|
2678
|
+
* bit-type-invalid error (`Config.getBitConfig` parity).
|
|
2619
2679
|
*/
|
|
2620
2680
|
getBitConfig(bitType) {
|
|
2621
2681
|
const wasm4 = getLegacyWasm();
|
|
@@ -3194,7 +3254,8 @@ var BodyTextFormat = {
|
|
|
3194
3254
|
};
|
|
3195
3255
|
var TextLocation = {
|
|
3196
3256
|
tag: "tag",
|
|
3197
|
-
body: "body"
|
|
3257
|
+
body: "body",
|
|
3258
|
+
cardBody: "cardBody"
|
|
3198
3259
|
};
|
|
3199
3260
|
|
|
3200
3261
|
// src/legacy/enums-extra.ts
|
|
@@ -3506,16 +3567,20 @@ function transform4(input, options = {}) {
|
|
|
3506
3567
|
return runHookedTransform(wasm4, input, options);
|
|
3507
3568
|
}
|
|
3508
3569
|
const patchJson = options.patch === void 0 ? "" : typeof options.patch === "string" ? options.patch : JSON.stringify(options.patch);
|
|
3509
|
-
|
|
3510
|
-
|
|
3511
|
-
|
|
3512
|
-
|
|
3513
|
-
|
|
3514
|
-
|
|
3515
|
-
|
|
3516
|
-
|
|
3517
|
-
|
|
3570
|
+
const { data, diagnostics: diagnostics2 } = JSON.parse(
|
|
3571
|
+
wasm4.transform(
|
|
3572
|
+
input,
|
|
3573
|
+
options.inputFormat ?? "auto",
|
|
3574
|
+
options.outputFormat ?? "json",
|
|
3575
|
+
options.mode ?? "optimized",
|
|
3576
|
+
patchJson,
|
|
3577
|
+
options.pretty ?? false,
|
|
3578
|
+
options.indent ?? 2,
|
|
3579
|
+
options.spacesAroundValues ?? 1
|
|
3580
|
+
)
|
|
3518
3581
|
);
|
|
3582
|
+
if (diagnostics2.length > 0) throw new PatchError(diagnostics2);
|
|
3583
|
+
return data;
|
|
3519
3584
|
}
|
|
3520
3585
|
function diff3(a, b, options = {}) {
|
|
3521
3586
|
const wasm4 = getActive();
|
|
@@ -3539,12 +3604,14 @@ function diffBits(a, b, options = {}) {
|
|
|
3539
3604
|
function breakscapeText(input, options = {}) {
|
|
3540
3605
|
const format = options.format ?? "bitmark++";
|
|
3541
3606
|
const location = options.location ?? "body";
|
|
3542
|
-
|
|
3607
|
+
const subLocation = options.subLocation ?? "text";
|
|
3608
|
+
return getActive().breakscape_text(input, format, location, subLocation);
|
|
3543
3609
|
}
|
|
3544
3610
|
function unbreakscapeText(input, options = {}) {
|
|
3545
3611
|
const format = options.format ?? "bitmark++";
|
|
3546
3612
|
const location = options.location ?? "body";
|
|
3547
|
-
|
|
3613
|
+
const subLocation = options.subLocation ?? "text";
|
|
3614
|
+
return getActive().unbreakscape_text(input, format, location, subLocation);
|
|
3548
3615
|
}
|
|
3549
3616
|
function info4(options = {}) {
|
|
3550
3617
|
const infoType = options.infoType ?? "list";
|
|
@@ -3682,6 +3749,7 @@ function transformParallel(input, options = {}) {
|
|
|
3682
3749
|
CompletionItemTag,
|
|
3683
3750
|
DiagnosticSeverity,
|
|
3684
3751
|
NotInitializedError,
|
|
3752
|
+
PatchError,
|
|
3685
3753
|
RegisterError,
|
|
3686
3754
|
UnsupportedFeatureError,
|
|
3687
3755
|
bitmarkToObjects,
|