@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
|
@@ -45,16 +45,6 @@ export function info(info_type: string, format: string, bit: string, pretty: boo
|
|
|
45
45
|
* variant name.
|
|
46
46
|
*/
|
|
47
47
|
export function info_text_supported(): boolean;
|
|
48
|
-
/**
|
|
49
|
-
* Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
|
|
50
|
-
*
|
|
51
|
-
* `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
|
|
52
|
-
* `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
|
|
53
|
-
* inline marks; anything else is treated as plain text (textToAst only).
|
|
54
|
-
* `location`: `"body"` (default) or `"tag"`.
|
|
55
|
-
* Returns the converted fragment; throws on failure.
|
|
56
|
-
*/
|
|
57
|
-
export function convert_text(input: string, direction: string, format: string, location: string): string;
|
|
58
48
|
/**
|
|
59
49
|
* Apply a patch (a JSON array of patch entries) to every bit and re-emit.
|
|
60
50
|
*
|
|
@@ -140,24 +130,6 @@ export function hover(input: string, line: number, character: number, position_e
|
|
|
140
130
|
* exactly where a consumer must supply the file themselves.
|
|
141
131
|
*/
|
|
142
132
|
export function register(data_type: string, data: string): void;
|
|
143
|
-
/**
|
|
144
|
-
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
145
|
-
*
|
|
146
|
-
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
|
|
147
|
-
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
|
|
148
|
-
* `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
|
|
149
|
-
* `"diagnostics"` (the last three bitmark input only) | a mapping id.
|
|
150
|
-
* `mode`: `"optimized"` (default) | `"full"`.
|
|
151
|
-
* `mapping_report`: replace the output with a human-readable report of the
|
|
152
|
-
* input→output mappings, including inputs that are NOT mapped (PLAN-147).
|
|
153
|
-
* `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
|
|
154
|
-
* `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
|
|
155
|
-
* PLAN-196) — and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
|
|
156
|
-
* `semantic-tokens` layout; `""` means the default, and every other output
|
|
157
|
-
* format ignores them.
|
|
158
|
-
* Returns the converted text/JSON; throws on failure.
|
|
159
|
-
*/
|
|
160
|
-
export function convert(input: string, input_format_sel: string, output_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number, include_unknown_properties: boolean, mapping_report: boolean, position_encoding: string, tokens_layout: string): string;
|
|
161
133
|
/**
|
|
162
134
|
* Re-emit input in its own format in canonical form at `mode`.
|
|
163
135
|
*
|
|
@@ -173,10 +145,13 @@ export function count_bits(input: string): string;
|
|
|
173
145
|
/**
|
|
174
146
|
* Split a bitmark document into per-bit source slices.
|
|
175
147
|
*
|
|
176
|
-
* Returns a JSON array of `{ index, byteStart, byteEnd, source }
|
|
177
|
-
*
|
|
148
|
+
* Returns a JSON array of `{ index, start, end, byteStart, byteEnd, source }`:
|
|
149
|
+
* `start` / `end` locate `source` in `position_encoding` units (`"utf-16"`
|
|
150
|
+
* default | `"utf-8"`; PLAN-221 D3), `byteStart` / `byteEnd` are the byte
|
|
151
|
+
* partition. Lets a JS caller chunk a document at bit boundaries (e.g. to
|
|
152
|
+
* feed a worker pool).
|
|
178
153
|
*/
|
|
179
|
-
export function split_bits(input: string): string;
|
|
154
|
+
export function split_bits(input: string, position_encoding: string): string;
|
|
180
155
|
/**
|
|
181
156
|
* Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
|
|
182
157
|
* used across the API so a JS caller can resolve `"auto"` consistently.
|
|
@@ -195,3 +170,62 @@ export function split_json_bits(input: string): string;
|
|
|
195
170
|
* matches the in-Rust recombination byte-for-byte.
|
|
196
171
|
*/
|
|
197
172
|
export function prettify(json: string, indent: number): string;
|
|
173
|
+
/**
|
|
174
|
+
* Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
|
|
175
|
+
*
|
|
176
|
+
* `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
|
|
177
|
+
* `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
|
|
178
|
+
* inline marks; anything else is treated as plain text (textToAst only).
|
|
179
|
+
* `location`: `"body"` (default) or `"tag"`.
|
|
180
|
+
* Returns the converted fragment; throws on failure.
|
|
181
|
+
*/
|
|
182
|
+
export function convert_text(input: string, direction: string, format: string, location: string): string;
|
|
183
|
+
/**
|
|
184
|
+
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
185
|
+
*
|
|
186
|
+
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
|
|
187
|
+
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
|
|
188
|
+
* `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
|
|
189
|
+
* `"diagnostics"` (the last three bitmark input only) | a mapping id.
|
|
190
|
+
* `mode`: `"optimized"` (default) | `"full"`.
|
|
191
|
+
* `mapping_report`: replace the output with a human-readable report of the
|
|
192
|
+
* input→output mappings, including inputs that are NOT mapped (PLAN-147).
|
|
193
|
+
* `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
|
|
194
|
+
* `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
|
|
195
|
+
* PLAN-196), and that of `convert_with_details`' bit spans (PLAN-221) —
|
|
196
|
+
* and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
|
|
197
|
+
* `semantic-tokens` layout; `""` means the default, and every other output
|
|
198
|
+
* format ignores them.
|
|
199
|
+
* Returns the converted text/JSON; throws on failure.
|
|
200
|
+
*/
|
|
201
|
+
export function convert(input: string, input_format_sel: string, output_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number, include_unknown_properties: boolean, mapping_report: boolean, position_encoding: string, tokens_layout: string): string;
|
|
202
|
+
/**
|
|
203
|
+
* [`convert`] plus the extras asked for (PLAN-221 D1a, F7): the same
|
|
204
|
+
* arguments, then one flag per extra — today `bit_spans`. Returns a
|
|
205
|
+
* [`ConvertDetails`] the caller must `free()`; throws as `convert` does.
|
|
206
|
+
*/
|
|
207
|
+
export function convert_with_details(input: string, input_format_sel: string, output_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number, include_unknown_properties: boolean, mapping_report: boolean, position_encoding: string, tokens_layout: string, bit_spans: boolean): ConvertDetails;
|
|
208
|
+
/**
|
|
209
|
+
* The result of [`convert_with_details`] (PLAN-221 F7): the output and each
|
|
210
|
+
* extra that was asked for, handed over without a JSON round trip. It lives
|
|
211
|
+
* in wasm memory: the caller must `free()` it. One accessor per extra.
|
|
212
|
+
*/
|
|
213
|
+
export class ConvertDetails {
|
|
214
|
+
private constructor();
|
|
215
|
+
free(): void;
|
|
216
|
+
/**
|
|
217
|
+
* The encoding the bit spans' offsets are counted in; `undefined` when
|
|
218
|
+
* not asked for.
|
|
219
|
+
*/
|
|
220
|
+
bit_spans_encoding(): string | undefined;
|
|
221
|
+
/**
|
|
222
|
+
* The bit spans, flat `[index, start, end, …]`; `undefined` when not
|
|
223
|
+
* asked for.
|
|
224
|
+
*/
|
|
225
|
+
bit_spans(): Uint32Array | undefined;
|
|
226
|
+
/**
|
|
227
|
+
* The converted output, moved out so it crosses to JS once: a second
|
|
228
|
+
* call returns `""`.
|
|
229
|
+
*/
|
|
230
|
+
take_data(): string;
|
|
231
|
+
}
|
|
@@ -260,53 +260,6 @@ function takeObject(idx) {
|
|
|
260
260
|
dropObject(idx);
|
|
261
261
|
return ret;
|
|
262
262
|
}
|
|
263
|
-
/**
|
|
264
|
-
* Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
|
|
265
|
-
*
|
|
266
|
-
* `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
|
|
267
|
-
* `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
|
|
268
|
-
* inline marks; anything else is treated as plain text (textToAst only).
|
|
269
|
-
* `location`: `"body"` (default) or `"tag"`.
|
|
270
|
-
* Returns the converted fragment; throws on failure.
|
|
271
|
-
* @param {string} input
|
|
272
|
-
* @param {string} direction
|
|
273
|
-
* @param {string} format
|
|
274
|
-
* @param {string} location
|
|
275
|
-
* @returns {string}
|
|
276
|
-
*/
|
|
277
|
-
module.exports.convert_text = function(input, direction, format, location) {
|
|
278
|
-
let deferred6_0;
|
|
279
|
-
let deferred6_1;
|
|
280
|
-
try {
|
|
281
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
282
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
283
|
-
const len0 = WASM_VECTOR_LEN;
|
|
284
|
-
const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
285
|
-
const len1 = WASM_VECTOR_LEN;
|
|
286
|
-
const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
287
|
-
const len2 = WASM_VECTOR_LEN;
|
|
288
|
-
const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
289
|
-
const len3 = WASM_VECTOR_LEN;
|
|
290
|
-
wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
291
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
292
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
293
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
294
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
295
|
-
var ptr5 = r0;
|
|
296
|
-
var len5 = r1;
|
|
297
|
-
if (r3) {
|
|
298
|
-
ptr5 = 0; len5 = 0;
|
|
299
|
-
throw takeObject(r2);
|
|
300
|
-
}
|
|
301
|
-
deferred6_0 = ptr5;
|
|
302
|
-
deferred6_1 = len5;
|
|
303
|
-
return getStringFromWasm0(ptr5, len5);
|
|
304
|
-
} finally {
|
|
305
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
306
|
-
wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
|
|
307
|
-
}
|
|
308
|
-
};
|
|
309
|
-
|
|
310
263
|
/**
|
|
311
264
|
* Apply a patch (a JSON array of patch entries) to every bit and re-emit.
|
|
312
265
|
*
|
|
@@ -638,72 +591,6 @@ module.exports.register = function(data_type, data) {
|
|
|
638
591
|
}
|
|
639
592
|
};
|
|
640
593
|
|
|
641
|
-
/**
|
|
642
|
-
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
643
|
-
*
|
|
644
|
-
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
|
|
645
|
-
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
|
|
646
|
-
* `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
|
|
647
|
-
* `"diagnostics"` (the last three bitmark input only) | a mapping id.
|
|
648
|
-
* `mode`: `"optimized"` (default) | `"full"`.
|
|
649
|
-
* `mapping_report`: replace the output with a human-readable report of the
|
|
650
|
-
* input→output mappings, including inputs that are NOT mapped (PLAN-147).
|
|
651
|
-
* `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
|
|
652
|
-
* `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
|
|
653
|
-
* PLAN-196) — and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
|
|
654
|
-
* `semantic-tokens` layout; `""` means the default, and every other output
|
|
655
|
-
* format ignores them.
|
|
656
|
-
* Returns the converted text/JSON; throws on failure.
|
|
657
|
-
* @param {string} input
|
|
658
|
-
* @param {string} input_format_sel
|
|
659
|
-
* @param {string} output_format_sel
|
|
660
|
-
* @param {string} mode
|
|
661
|
-
* @param {boolean} pretty
|
|
662
|
-
* @param {number} indent
|
|
663
|
-
* @param {number} spaces_around_values
|
|
664
|
-
* @param {boolean} include_unknown_properties
|
|
665
|
-
* @param {boolean} mapping_report
|
|
666
|
-
* @param {string} position_encoding
|
|
667
|
-
* @param {string} tokens_layout
|
|
668
|
-
* @returns {string}
|
|
669
|
-
*/
|
|
670
|
-
module.exports.convert = function(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, position_encoding, tokens_layout) {
|
|
671
|
-
let deferred8_0;
|
|
672
|
-
let deferred8_1;
|
|
673
|
-
try {
|
|
674
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
675
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
676
|
-
const len0 = WASM_VECTOR_LEN;
|
|
677
|
-
const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
678
|
-
const len1 = WASM_VECTOR_LEN;
|
|
679
|
-
const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
680
|
-
const len2 = WASM_VECTOR_LEN;
|
|
681
|
-
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
682
|
-
const len3 = WASM_VECTOR_LEN;
|
|
683
|
-
const ptr4 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
684
|
-
const len4 = WASM_VECTOR_LEN;
|
|
685
|
-
const ptr5 = passStringToWasm0(tokens_layout, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
686
|
-
const len5 = WASM_VECTOR_LEN;
|
|
687
|
-
wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, ptr4, len4, ptr5, len5);
|
|
688
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
689
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
690
|
-
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
691
|
-
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
692
|
-
var ptr7 = r0;
|
|
693
|
-
var len7 = r1;
|
|
694
|
-
if (r3) {
|
|
695
|
-
ptr7 = 0; len7 = 0;
|
|
696
|
-
throw takeObject(r2);
|
|
697
|
-
}
|
|
698
|
-
deferred8_0 = ptr7;
|
|
699
|
-
deferred8_1 = len7;
|
|
700
|
-
return getStringFromWasm0(ptr7, len7);
|
|
701
|
-
} finally {
|
|
702
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
703
|
-
wasm.__wbindgen_export_2(deferred8_0, deferred8_1, 1);
|
|
704
|
-
}
|
|
705
|
-
};
|
|
706
|
-
|
|
707
594
|
/**
|
|
708
595
|
* Re-emit input in its own format in canonical form at `mode`.
|
|
709
596
|
*
|
|
@@ -784,27 +671,33 @@ module.exports.count_bits = function(input) {
|
|
|
784
671
|
/**
|
|
785
672
|
* Split a bitmark document into per-bit source slices.
|
|
786
673
|
*
|
|
787
|
-
* Returns a JSON array of `{ index, byteStart, byteEnd, source }
|
|
788
|
-
*
|
|
674
|
+
* Returns a JSON array of `{ index, start, end, byteStart, byteEnd, source }`:
|
|
675
|
+
* `start` / `end` locate `source` in `position_encoding` units (`"utf-16"`
|
|
676
|
+
* default | `"utf-8"`; PLAN-221 D3), `byteStart` / `byteEnd` are the byte
|
|
677
|
+
* partition. Lets a JS caller chunk a document at bit boundaries (e.g. to
|
|
678
|
+
* feed a worker pool).
|
|
789
679
|
* @param {string} input
|
|
680
|
+
* @param {string} position_encoding
|
|
790
681
|
* @returns {string}
|
|
791
682
|
*/
|
|
792
|
-
module.exports.split_bits = function(input) {
|
|
793
|
-
let
|
|
794
|
-
let
|
|
683
|
+
module.exports.split_bits = function(input, position_encoding) {
|
|
684
|
+
let deferred3_0;
|
|
685
|
+
let deferred3_1;
|
|
795
686
|
try {
|
|
796
687
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
797
688
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
798
689
|
const len0 = WASM_VECTOR_LEN;
|
|
799
|
-
|
|
690
|
+
const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
691
|
+
const len1 = WASM_VECTOR_LEN;
|
|
692
|
+
wasm.split_bits(retptr, ptr0, len0, ptr1, len1);
|
|
800
693
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
801
694
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
802
|
-
|
|
803
|
-
|
|
695
|
+
deferred3_0 = r0;
|
|
696
|
+
deferred3_1 = r1;
|
|
804
697
|
return getStringFromWasm0(r0, r1);
|
|
805
698
|
} finally {
|
|
806
699
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
807
|
-
wasm.__wbindgen_export_2(
|
|
700
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
808
701
|
}
|
|
809
702
|
};
|
|
810
703
|
|
|
@@ -883,11 +776,284 @@ module.exports.prettify = function(json, indent) {
|
|
|
883
776
|
}
|
|
884
777
|
};
|
|
885
778
|
|
|
779
|
+
/**
|
|
780
|
+
* Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
|
|
781
|
+
*
|
|
782
|
+
* `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
|
|
783
|
+
* `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
|
|
784
|
+
* inline marks; anything else is treated as plain text (textToAst only).
|
|
785
|
+
* `location`: `"body"` (default) or `"tag"`.
|
|
786
|
+
* Returns the converted fragment; throws on failure.
|
|
787
|
+
* @param {string} input
|
|
788
|
+
* @param {string} direction
|
|
789
|
+
* @param {string} format
|
|
790
|
+
* @param {string} location
|
|
791
|
+
* @returns {string}
|
|
792
|
+
*/
|
|
793
|
+
module.exports.convert_text = function(input, direction, format, location) {
|
|
794
|
+
let deferred6_0;
|
|
795
|
+
let deferred6_1;
|
|
796
|
+
try {
|
|
797
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
798
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
799
|
+
const len0 = WASM_VECTOR_LEN;
|
|
800
|
+
const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
801
|
+
const len1 = WASM_VECTOR_LEN;
|
|
802
|
+
const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
803
|
+
const len2 = WASM_VECTOR_LEN;
|
|
804
|
+
const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
805
|
+
const len3 = WASM_VECTOR_LEN;
|
|
806
|
+
wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
807
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
808
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
809
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
810
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
811
|
+
var ptr5 = r0;
|
|
812
|
+
var len5 = r1;
|
|
813
|
+
if (r3) {
|
|
814
|
+
ptr5 = 0; len5 = 0;
|
|
815
|
+
throw takeObject(r2);
|
|
816
|
+
}
|
|
817
|
+
deferred6_0 = ptr5;
|
|
818
|
+
deferred6_1 = len5;
|
|
819
|
+
return getStringFromWasm0(ptr5, len5);
|
|
820
|
+
} finally {
|
|
821
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
822
|
+
wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
|
|
823
|
+
}
|
|
824
|
+
};
|
|
825
|
+
|
|
826
|
+
/**
|
|
827
|
+
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
828
|
+
*
|
|
829
|
+
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
|
|
830
|
+
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
|
|
831
|
+
* `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
|
|
832
|
+
* `"diagnostics"` (the last three bitmark input only) | a mapping id.
|
|
833
|
+
* `mode`: `"optimized"` (default) | `"full"`.
|
|
834
|
+
* `mapping_report`: replace the output with a human-readable report of the
|
|
835
|
+
* input→output mappings, including inputs that are NOT mapped (PLAN-147).
|
|
836
|
+
* `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
|
|
837
|
+
* `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
|
|
838
|
+
* PLAN-196), and that of `convert_with_details`' bit spans (PLAN-221) —
|
|
839
|
+
* and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
|
|
840
|
+
* `semantic-tokens` layout; `""` means the default, and every other output
|
|
841
|
+
* format ignores them.
|
|
842
|
+
* Returns the converted text/JSON; throws on failure.
|
|
843
|
+
* @param {string} input
|
|
844
|
+
* @param {string} input_format_sel
|
|
845
|
+
* @param {string} output_format_sel
|
|
846
|
+
* @param {string} mode
|
|
847
|
+
* @param {boolean} pretty
|
|
848
|
+
* @param {number} indent
|
|
849
|
+
* @param {number} spaces_around_values
|
|
850
|
+
* @param {boolean} include_unknown_properties
|
|
851
|
+
* @param {boolean} mapping_report
|
|
852
|
+
* @param {string} position_encoding
|
|
853
|
+
* @param {string} tokens_layout
|
|
854
|
+
* @returns {string}
|
|
855
|
+
*/
|
|
856
|
+
module.exports.convert = function(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, position_encoding, tokens_layout) {
|
|
857
|
+
let deferred8_0;
|
|
858
|
+
let deferred8_1;
|
|
859
|
+
try {
|
|
860
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
861
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
862
|
+
const len0 = WASM_VECTOR_LEN;
|
|
863
|
+
const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
864
|
+
const len1 = WASM_VECTOR_LEN;
|
|
865
|
+
const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
866
|
+
const len2 = WASM_VECTOR_LEN;
|
|
867
|
+
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
868
|
+
const len3 = WASM_VECTOR_LEN;
|
|
869
|
+
const ptr4 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
870
|
+
const len4 = WASM_VECTOR_LEN;
|
|
871
|
+
const ptr5 = passStringToWasm0(tokens_layout, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
872
|
+
const len5 = WASM_VECTOR_LEN;
|
|
873
|
+
wasm.convert(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, ptr4, len4, ptr5, len5);
|
|
874
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
875
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
876
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
877
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
878
|
+
var ptr7 = r0;
|
|
879
|
+
var len7 = r1;
|
|
880
|
+
if (r3) {
|
|
881
|
+
ptr7 = 0; len7 = 0;
|
|
882
|
+
throw takeObject(r2);
|
|
883
|
+
}
|
|
884
|
+
deferred8_0 = ptr7;
|
|
885
|
+
deferred8_1 = len7;
|
|
886
|
+
return getStringFromWasm0(ptr7, len7);
|
|
887
|
+
} finally {
|
|
888
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
889
|
+
wasm.__wbindgen_export_2(deferred8_0, deferred8_1, 1);
|
|
890
|
+
}
|
|
891
|
+
};
|
|
892
|
+
|
|
893
|
+
/**
|
|
894
|
+
* [`convert`] plus the extras asked for (PLAN-221 D1a, F7): the same
|
|
895
|
+
* arguments, then one flag per extra — today `bit_spans`. Returns a
|
|
896
|
+
* [`ConvertDetails`] the caller must `free()`; throws as `convert` does.
|
|
897
|
+
* @param {string} input
|
|
898
|
+
* @param {string} input_format_sel
|
|
899
|
+
* @param {string} output_format_sel
|
|
900
|
+
* @param {string} mode
|
|
901
|
+
* @param {boolean} pretty
|
|
902
|
+
* @param {number} indent
|
|
903
|
+
* @param {number} spaces_around_values
|
|
904
|
+
* @param {boolean} include_unknown_properties
|
|
905
|
+
* @param {boolean} mapping_report
|
|
906
|
+
* @param {string} position_encoding
|
|
907
|
+
* @param {string} tokens_layout
|
|
908
|
+
* @param {boolean} bit_spans
|
|
909
|
+
* @returns {ConvertDetails}
|
|
910
|
+
*/
|
|
911
|
+
module.exports.convert_with_details = function(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, position_encoding, tokens_layout, bit_spans) {
|
|
912
|
+
try {
|
|
913
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
914
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
915
|
+
const len0 = WASM_VECTOR_LEN;
|
|
916
|
+
const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
917
|
+
const len1 = WASM_VECTOR_LEN;
|
|
918
|
+
const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
919
|
+
const len2 = WASM_VECTOR_LEN;
|
|
920
|
+
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
921
|
+
const len3 = WASM_VECTOR_LEN;
|
|
922
|
+
const ptr4 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
923
|
+
const len4 = WASM_VECTOR_LEN;
|
|
924
|
+
const ptr5 = passStringToWasm0(tokens_layout, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
925
|
+
const len5 = WASM_VECTOR_LEN;
|
|
926
|
+
wasm.convert_with_details(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report, ptr4, len4, ptr5, len5, bit_spans);
|
|
927
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
928
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
929
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
930
|
+
if (r2) {
|
|
931
|
+
throw takeObject(r1);
|
|
932
|
+
}
|
|
933
|
+
return ConvertDetails.__wrap(r0);
|
|
934
|
+
} finally {
|
|
935
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
936
|
+
}
|
|
937
|
+
};
|
|
938
|
+
|
|
939
|
+
let cachedUint32ArrayMemory0 = null;
|
|
940
|
+
|
|
941
|
+
function getUint32ArrayMemory0() {
|
|
942
|
+
if (cachedUint32ArrayMemory0 === null || cachedUint32ArrayMemory0.byteLength === 0) {
|
|
943
|
+
cachedUint32ArrayMemory0 = new Uint32Array(wasm.memory.buffer);
|
|
944
|
+
}
|
|
945
|
+
return cachedUint32ArrayMemory0;
|
|
946
|
+
}
|
|
947
|
+
|
|
948
|
+
function getArrayU32FromWasm0(ptr, len) {
|
|
949
|
+
ptr = ptr >>> 0;
|
|
950
|
+
return getUint32ArrayMemory0().subarray(ptr / 4, ptr / 4 + len);
|
|
951
|
+
}
|
|
952
|
+
|
|
953
|
+
const ConvertDetailsFinalization = (typeof FinalizationRegistry === 'undefined')
|
|
954
|
+
? { register: () => {}, unregister: () => {} }
|
|
955
|
+
: new FinalizationRegistry(ptr => wasm.__wbg_convertdetails_free(ptr >>> 0, 1));
|
|
956
|
+
/**
|
|
957
|
+
* The result of [`convert_with_details`] (PLAN-221 F7): the output and each
|
|
958
|
+
* extra that was asked for, handed over without a JSON round trip. It lives
|
|
959
|
+
* in wasm memory: the caller must `free()` it. One accessor per extra.
|
|
960
|
+
*/
|
|
961
|
+
class ConvertDetails {
|
|
962
|
+
|
|
963
|
+
static __wrap(ptr) {
|
|
964
|
+
ptr = ptr >>> 0;
|
|
965
|
+
const obj = Object.create(ConvertDetails.prototype);
|
|
966
|
+
obj.__wbg_ptr = ptr;
|
|
967
|
+
ConvertDetailsFinalization.register(obj, obj.__wbg_ptr, obj);
|
|
968
|
+
return obj;
|
|
969
|
+
}
|
|
970
|
+
|
|
971
|
+
__destroy_into_raw() {
|
|
972
|
+
const ptr = this.__wbg_ptr;
|
|
973
|
+
this.__wbg_ptr = 0;
|
|
974
|
+
ConvertDetailsFinalization.unregister(this);
|
|
975
|
+
return ptr;
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
free() {
|
|
979
|
+
const ptr = this.__destroy_into_raw();
|
|
980
|
+
wasm.__wbg_convertdetails_free(ptr, 0);
|
|
981
|
+
}
|
|
982
|
+
/**
|
|
983
|
+
* The encoding the bit spans' offsets are counted in; `undefined` when
|
|
984
|
+
* not asked for.
|
|
985
|
+
* @returns {string | undefined}
|
|
986
|
+
*/
|
|
987
|
+
bit_spans_encoding() {
|
|
988
|
+
try {
|
|
989
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
990
|
+
wasm.convertdetails_bit_spans_encoding(retptr, this.__wbg_ptr);
|
|
991
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
992
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
993
|
+
let v1;
|
|
994
|
+
if (r0 !== 0) {
|
|
995
|
+
v1 = getStringFromWasm0(r0, r1).slice();
|
|
996
|
+
wasm.__wbindgen_export_2(r0, r1 * 1, 1);
|
|
997
|
+
}
|
|
998
|
+
return v1;
|
|
999
|
+
} finally {
|
|
1000
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
1003
|
+
/**
|
|
1004
|
+
* The bit spans, flat `[index, start, end, …]`; `undefined` when not
|
|
1005
|
+
* asked for.
|
|
1006
|
+
* @returns {Uint32Array | undefined}
|
|
1007
|
+
*/
|
|
1008
|
+
bit_spans() {
|
|
1009
|
+
try {
|
|
1010
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1011
|
+
wasm.convertdetails_bit_spans(retptr, this.__wbg_ptr);
|
|
1012
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1013
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1014
|
+
let v1;
|
|
1015
|
+
if (r0 !== 0) {
|
|
1016
|
+
v1 = getArrayU32FromWasm0(r0, r1).slice();
|
|
1017
|
+
wasm.__wbindgen_export_2(r0, r1 * 4, 4);
|
|
1018
|
+
}
|
|
1019
|
+
return v1;
|
|
1020
|
+
} finally {
|
|
1021
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1022
|
+
}
|
|
1023
|
+
}
|
|
1024
|
+
/**
|
|
1025
|
+
* The converted output, moved out so it crosses to JS once: a second
|
|
1026
|
+
* call returns `""`.
|
|
1027
|
+
* @returns {string}
|
|
1028
|
+
*/
|
|
1029
|
+
take_data() {
|
|
1030
|
+
let deferred1_0;
|
|
1031
|
+
let deferred1_1;
|
|
1032
|
+
try {
|
|
1033
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
1034
|
+
wasm.convertdetails_take_data(retptr, this.__wbg_ptr);
|
|
1035
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
1036
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
1037
|
+
deferred1_0 = r0;
|
|
1038
|
+
deferred1_1 = r1;
|
|
1039
|
+
return getStringFromWasm0(r0, r1);
|
|
1040
|
+
} finally {
|
|
1041
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
1042
|
+
wasm.__wbindgen_export_2(deferred1_0, deferred1_1, 1);
|
|
1043
|
+
}
|
|
1044
|
+
}
|
|
1045
|
+
}
|
|
1046
|
+
module.exports.ConvertDetails = ConvertDetails;
|
|
1047
|
+
|
|
886
1048
|
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
887
1049
|
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
888
1050
|
return addHeapObject(ret);
|
|
889
1051
|
};
|
|
890
1052
|
|
|
1053
|
+
module.exports.__wbindgen_throw = function(arg0, arg1) {
|
|
1054
|
+
throw new Error(getStringFromWasm0(arg0, arg1));
|
|
1055
|
+
};
|
|
1056
|
+
|
|
891
1057
|
const path = require('path').join(__dirname, 'bitmark_browser_full_wasm_bg.wasm');
|
|
892
1058
|
const bytes = require('fs').readFileSync(path);
|
|
893
1059
|
|
|
Binary file
|
|
@@ -1,11 +1,16 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
export const memory: WebAssembly.Memory;
|
|
4
|
+
export const __wbg_convertdetails_free: (a: number, b: number) => void;
|
|
4
5
|
export const breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
5
6
|
export const canonicalize: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
6
7
|
export const complete: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
7
8
|
export const 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, o: number, p: number, q: number, r: number) => void;
|
|
8
9
|
export const convert_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
10
|
+
export const convert_with_details: (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, o: number, p: number, q: number, r: number, s: number) => void;
|
|
11
|
+
export const convertdetails_bit_spans: (a: number, b: number) => void;
|
|
12
|
+
export const convertdetails_bit_spans_encoding: (a: number, b: number) => void;
|
|
13
|
+
export const convertdetails_take_data: (a: number, b: number) => void;
|
|
9
14
|
export const count_bits: (a: number, b: number, c: number) => void;
|
|
10
15
|
export const diff: (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;
|
|
11
16
|
export const hover: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
@@ -16,7 +21,7 @@ export const prettify: (a: number, b: number, c: number, d: number) => void;
|
|
|
16
21
|
export const register: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
17
22
|
export const resolve: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
|
18
23
|
export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
19
|
-
export const split_bits: (a: number, b: number, c: number) => void;
|
|
24
|
+
export const split_bits: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
20
25
|
export const split_json_bits: (a: number, b: number, c: number) => void;
|
|
21
26
|
export const transform: (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;
|
|
22
27
|
export const unbreakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|