@gmb/bitmark-parser 6.11.1 → 7.0.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 +222 -54
- package/dist/browser/bitmark-parser.min.js +4 -4
- package/dist/browser/bitmark-parser.min.js.map +1 -1
- package/dist/browser/cjs/index.cjs +547 -325
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +342 -68
- package/dist/browser/esm/index.d.ts +342 -68
- package/dist/browser/esm/index.js +546 -324
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js +497 -242
- 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 +51 -88
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +342 -68
- package/dist/index.d.ts +342 -68
- package/dist/index.js +50 -87
- package/dist/index.js.map +1 -1
- package/dist/legacy.cjs +8 -30
- package/dist/legacy.cjs.map +1 -1
- package/dist/legacy.d.cts +0 -2
- package/dist/legacy.d.ts +0 -2
- package/dist/legacy.js +8 -30
- package/dist/legacy.js.map +1 -1
- package/dist/worker-entry.cjs +1 -5
- package/dist/worker-entry.cjs.map +1 -1
- package/package.json +6 -6
- package/schema/bitmark.schema.json +496 -139
- package/wasm/bitmark_wasm.d.ts +27 -23
- package/wasm/bitmark_wasm.js +198 -112
- 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 +18 -12
- package/wasm-bitmark-json/bitmark_json_wasm.js +170 -72
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +1 -1
- package/wasm-bitmark-json/package.json +1 -1
- package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +27 -23
- package/wasm-browser-full/bitmark_browser_full_wasm.js +198 -112
- 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
|
@@ -1,14 +1,5 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
|
-
/**
|
|
4
|
-
* Lex bitmark input text, returning one line per token in the same format as
|
|
5
|
-
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
6
|
-
*
|
|
7
|
-
* `stage` selects the lexer pipeline:
|
|
8
|
-
* - `"lex"` — combined (default)
|
|
9
|
-
* - `"lex-json"` — combined, JSON array output
|
|
10
|
-
*/
|
|
11
|
-
export function lex(input: string, stage: string): string;
|
|
12
3
|
/**
|
|
13
4
|
* Breakscape text (escape bitmark special characters).
|
|
14
5
|
*
|
|
@@ -41,6 +32,13 @@ export function unbreakscape_text(input: string, format: string, location: strin
|
|
|
41
32
|
* several (adds a `titles` map), `"all"` for every resolvable language
|
|
42
33
|
*/
|
|
43
34
|
export function info(info_type: string, format: string, bit: string, pretty: boolean, indent: number, include_deprecated: boolean, only_deprecated: boolean, full: boolean, language: string): string;
|
|
35
|
+
/**
|
|
36
|
+
* Whether this build can render `info` as TEXT (PLAN-192 D6). The export is
|
|
37
|
+
* ABSENT when it cannot — the same "presence is the capability" signal
|
|
38
|
+
* `diff` uses, so a caller tests for the function rather than for a
|
|
39
|
+
* variant name.
|
|
40
|
+
*/
|
|
41
|
+
export function info_text_supported(): boolean;
|
|
44
42
|
/**
|
|
45
43
|
* Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
|
|
46
44
|
*
|
|
@@ -48,7 +46,7 @@ export function info(info_type: string, format: string, bit: string, pretty: boo
|
|
|
48
46
|
* `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
|
|
49
47
|
* inline marks; anything else is treated as plain text (textToAst only).
|
|
50
48
|
* `location`: `"body"` (default) or `"tag"`.
|
|
51
|
-
* Returns the converted fragment
|
|
49
|
+
* Returns the converted fragment; throws on failure.
|
|
52
50
|
*/
|
|
53
51
|
export function convert_text(input: string, direction: string, format: string, location: string): string;
|
|
54
52
|
/**
|
|
@@ -58,7 +56,7 @@ export function convert_text(input: string, direction: string, format: string, l
|
|
|
58
56
|
* `output_format_sel`: `"bitmark"` | `"json"` (default json).
|
|
59
57
|
* `patch_json`: the patch entry array (empty string = no patches, i.e. a
|
|
60
58
|
* canonicalizing pass). Parallelism is a JS-side concern (web workers); this
|
|
61
|
-
* runs sequentially. Returns the document text/JSON
|
|
59
|
+
* runs sequentially. Returns the document text/JSON; throws on failure.
|
|
62
60
|
*/
|
|
63
61
|
export function transform(input: string, input_format_sel: string, output_format_sel: string, mode: string, patch_json: string, pretty: boolean, indent: number, spaces_around_values: number): string;
|
|
64
62
|
/**
|
|
@@ -67,7 +65,7 @@ export function transform(input: string, input_format_sel: string, output_format
|
|
|
67
65
|
* reorder, drop and insert jobs from the one Rust implementation
|
|
68
66
|
* (PLAN-179). Returns a JSON array of
|
|
69
67
|
* `{ "source": <original index> | null, "bit": <inner bit> | null,
|
|
70
|
-
* "patch": [ … ] }
|
|
68
|
+
* "patch": [ … ] }`; throws on failure.
|
|
71
69
|
*/
|
|
72
70
|
export function resolve_patch_document(input: string, patch_json: string): string;
|
|
73
71
|
/**
|
|
@@ -80,8 +78,8 @@ export function resolve_patch_document(input: string, patch_json: string): strin
|
|
|
80
78
|
* - `context`, `locate`, `similarity`, `bbox_tolerance`,
|
|
81
79
|
* `spaces_around_values` as documented on `DiffOptions`.
|
|
82
80
|
* Returns the diff (empty text / `[]` of unchanged bits / a patch document
|
|
83
|
-
* with no entries when the documents are semantically equal)
|
|
84
|
-
*
|
|
81
|
+
* with no entries when the documents are semantically equal); throws on
|
|
82
|
+
* failure.
|
|
85
83
|
*/
|
|
86
84
|
export function diff(a: string, b: string, input_format_sel: string, output_format_sel: string, context: number, locate: boolean, similarity: number, bbox_tolerance: number, spaces_around_values: number): string;
|
|
87
85
|
/**
|
|
@@ -92,24 +90,30 @@ export function diff(a: string, b: string, input_format_sel: string, output_form
|
|
|
92
90
|
*
|
|
93
91
|
* `data` is the file's own text. Semantics are REPLACE: a second call
|
|
94
92
|
* supersedes the first entirely, and the built-in table (where the variant
|
|
95
|
-
* bakes one) stays underneath.
|
|
96
|
-
*
|
|
93
|
+
* bakes one) stays underneath. Throws on bad data — like every other
|
|
94
|
+
* fallible export (PLAN-192 D1).
|
|
97
95
|
*
|
|
98
96
|
* Available in EVERY variant, including those that bake nothing: that is
|
|
99
97
|
* exactly where a consumer must supply the file themselves.
|
|
100
98
|
*/
|
|
101
|
-
export function register(data_type: string, data: string):
|
|
99
|
+
export function register(data_type: string, data: string): void;
|
|
102
100
|
/**
|
|
103
101
|
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
104
102
|
*
|
|
105
|
-
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"
|
|
106
|
-
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"
|
|
103
|
+
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
|
|
104
|
+
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
|
|
105
|
+
* `"text"` | `"lex"` (the token stream as JSON, bitmark input only) | a
|
|
106
|
+
* mapping id.
|
|
107
107
|
* `mode`: `"optimized"` (default) | `"full"`.
|
|
108
108
|
* `mapping_report`: replace the output with a human-readable report of the
|
|
109
109
|
* input→output mappings, including inputs that are NOT mapped (PLAN-147).
|
|
110
|
-
*
|
|
110
|
+
* `position_encoding`: `"utf-16"` (default) | `"utf-8"` and `tokens_layout`:
|
|
111
|
+
* `"lsp"` (default) | `"absolute"` — the `semantic-tokens` output's two
|
|
112
|
+
* options (PLAN-193); `""` means the default, and every other output
|
|
113
|
+
* format ignores them.
|
|
114
|
+
* Returns the converted text/JSON; throws on failure.
|
|
111
115
|
*/
|
|
112
|
-
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): string;
|
|
116
|
+
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;
|
|
113
117
|
/**
|
|
114
118
|
* Re-emit input in its own format in canonical form at `mode`.
|
|
115
119
|
*
|
|
@@ -119,7 +123,7 @@ export function convert(input: string, input_format_sel: string, output_format_s
|
|
|
119
123
|
export function canonicalize(input: string, input_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number): string;
|
|
120
124
|
/**
|
|
121
125
|
* Count the bits in `input` (auto-detecting bitmark vs JSON).
|
|
122
|
-
* Returns the count as a decimal string
|
|
126
|
+
* Returns the count as a decimal string; throws on failure.
|
|
123
127
|
*/
|
|
124
128
|
export function count_bits(input: string): string;
|
|
125
129
|
/**
|
|
@@ -138,7 +142,7 @@ export function is_bitmark(input: string): boolean;
|
|
|
138
142
|
* Split a JSON document (a top-level array of bit envelopes) into its per-bit
|
|
139
143
|
* envelope objects, returned as a JSON array string. Lets a JS caller iterate
|
|
140
144
|
* JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).
|
|
141
|
-
*
|
|
145
|
+
* Throws if the input is not a JSON array of bits.
|
|
142
146
|
*/
|
|
143
147
|
export function split_json_bits(input: string): string;
|
|
144
148
|
/**
|
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
|
|
2
2
|
let imports = {};
|
|
3
|
+
imports['__wbindgen_placeholder__'] = module.exports;
|
|
3
4
|
let wasm;
|
|
4
|
-
const {
|
|
5
|
+
const { TextDecoder, TextEncoder } = require(`util`);
|
|
5
6
|
|
|
6
|
-
let
|
|
7
|
+
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
8
|
+
|
|
9
|
+
cachedTextDecoder.decode();
|
|
7
10
|
|
|
8
11
|
let cachedUint8ArrayMemory0 = null;
|
|
9
12
|
|
|
@@ -14,6 +17,28 @@ function getUint8ArrayMemory0() {
|
|
|
14
17
|
return cachedUint8ArrayMemory0;
|
|
15
18
|
}
|
|
16
19
|
|
|
20
|
+
function getStringFromWasm0(ptr, len) {
|
|
21
|
+
ptr = ptr >>> 0;
|
|
22
|
+
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const heap = new Array(128).fill(undefined);
|
|
26
|
+
|
|
27
|
+
heap.push(undefined, null, true, false);
|
|
28
|
+
|
|
29
|
+
let heap_next = heap.length;
|
|
30
|
+
|
|
31
|
+
function addHeapObject(obj) {
|
|
32
|
+
if (heap_next === heap.length) heap.push(heap.length + 1);
|
|
33
|
+
const idx = heap_next;
|
|
34
|
+
heap_next = heap[idx];
|
|
35
|
+
|
|
36
|
+
heap[idx] = obj;
|
|
37
|
+
return idx;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
let WASM_VECTOR_LEN = 0;
|
|
41
|
+
|
|
17
42
|
let cachedTextEncoder = new TextEncoder('utf-8');
|
|
18
43
|
|
|
19
44
|
const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
|
|
@@ -76,47 +101,6 @@ function getDataViewMemory0() {
|
|
|
76
101
|
}
|
|
77
102
|
return cachedDataViewMemory0;
|
|
78
103
|
}
|
|
79
|
-
|
|
80
|
-
let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
|
|
81
|
-
|
|
82
|
-
cachedTextDecoder.decode();
|
|
83
|
-
|
|
84
|
-
function getStringFromWasm0(ptr, len) {
|
|
85
|
-
ptr = ptr >>> 0;
|
|
86
|
-
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
87
|
-
}
|
|
88
|
-
/**
|
|
89
|
-
* Lex bitmark input text, returning one line per token in the same format as
|
|
90
|
-
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
91
|
-
*
|
|
92
|
-
* `stage` selects the lexer pipeline:
|
|
93
|
-
* - `"lex"` — combined (default)
|
|
94
|
-
* - `"lex-json"` — combined, JSON array output
|
|
95
|
-
* @param {string} input
|
|
96
|
-
* @param {string} stage
|
|
97
|
-
* @returns {string}
|
|
98
|
-
*/
|
|
99
|
-
module.exports.lex = function(input, stage) {
|
|
100
|
-
let deferred3_0;
|
|
101
|
-
let deferred3_1;
|
|
102
|
-
try {
|
|
103
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
104
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
105
|
-
const len0 = WASM_VECTOR_LEN;
|
|
106
|
-
const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
107
|
-
const len1 = WASM_VECTOR_LEN;
|
|
108
|
-
wasm.lex(retptr, ptr0, len0, ptr1, len1);
|
|
109
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
110
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
111
|
-
deferred3_0 = r0;
|
|
112
|
-
deferred3_1 = r1;
|
|
113
|
-
return getStringFromWasm0(r0, r1);
|
|
114
|
-
} finally {
|
|
115
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
116
|
-
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
117
|
-
}
|
|
118
|
-
};
|
|
119
|
-
|
|
120
104
|
/**
|
|
121
105
|
* Breakscape text (escape bitmark special characters).
|
|
122
106
|
*
|
|
@@ -235,6 +219,31 @@ module.exports.info = function(info_type, format, bit, pretty, indent, include_d
|
|
|
235
219
|
}
|
|
236
220
|
};
|
|
237
221
|
|
|
222
|
+
/**
|
|
223
|
+
* Whether this build can render `info` as TEXT (PLAN-192 D6). The export is
|
|
224
|
+
* ABSENT when it cannot — the same "presence is the capability" signal
|
|
225
|
+
* `diff` uses, so a caller tests for the function rather than for a
|
|
226
|
+
* variant name.
|
|
227
|
+
* @returns {boolean}
|
|
228
|
+
*/
|
|
229
|
+
module.exports.info_text_supported = function() {
|
|
230
|
+
const ret = wasm.info_text_supported();
|
|
231
|
+
return ret !== 0;
|
|
232
|
+
};
|
|
233
|
+
|
|
234
|
+
function getObject(idx) { return heap[idx]; }
|
|
235
|
+
|
|
236
|
+
function dropObject(idx) {
|
|
237
|
+
if (idx < 132) return;
|
|
238
|
+
heap[idx] = heap_next;
|
|
239
|
+
heap_next = idx;
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
function takeObject(idx) {
|
|
243
|
+
const ret = getObject(idx);
|
|
244
|
+
dropObject(idx);
|
|
245
|
+
return ret;
|
|
246
|
+
}
|
|
238
247
|
/**
|
|
239
248
|
* Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
|
|
240
249
|
*
|
|
@@ -242,7 +251,7 @@ module.exports.info = function(info_type, format, bit, pretty, indent, include_d
|
|
|
242
251
|
* `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
|
|
243
252
|
* inline marks; anything else is treated as plain text (textToAst only).
|
|
244
253
|
* `location`: `"body"` (default) or `"tag"`.
|
|
245
|
-
* Returns the converted fragment
|
|
254
|
+
* Returns the converted fragment; throws on failure.
|
|
246
255
|
* @param {string} input
|
|
247
256
|
* @param {string} direction
|
|
248
257
|
* @param {string} format
|
|
@@ -250,8 +259,8 @@ module.exports.info = function(info_type, format, bit, pretty, indent, include_d
|
|
|
250
259
|
* @returns {string}
|
|
251
260
|
*/
|
|
252
261
|
module.exports.convert_text = function(input, direction, format, location) {
|
|
253
|
-
let
|
|
254
|
-
let
|
|
262
|
+
let deferred6_0;
|
|
263
|
+
let deferred6_1;
|
|
255
264
|
try {
|
|
256
265
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
257
266
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -265,12 +274,20 @@ module.exports.convert_text = function(input, direction, format, location) {
|
|
|
265
274
|
wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
266
275
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
267
276
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
277
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
278
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
279
|
+
var ptr5 = r0;
|
|
280
|
+
var len5 = r1;
|
|
281
|
+
if (r3) {
|
|
282
|
+
ptr5 = 0; len5 = 0;
|
|
283
|
+
throw takeObject(r2);
|
|
284
|
+
}
|
|
285
|
+
deferred6_0 = ptr5;
|
|
286
|
+
deferred6_1 = len5;
|
|
287
|
+
return getStringFromWasm0(ptr5, len5);
|
|
271
288
|
} finally {
|
|
272
289
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
273
|
-
wasm.__wbindgen_export_2(
|
|
290
|
+
wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
|
|
274
291
|
}
|
|
275
292
|
};
|
|
276
293
|
|
|
@@ -281,7 +298,7 @@ module.exports.convert_text = function(input, direction, format, location) {
|
|
|
281
298
|
* `output_format_sel`: `"bitmark"` | `"json"` (default json).
|
|
282
299
|
* `patch_json`: the patch entry array (empty string = no patches, i.e. a
|
|
283
300
|
* canonicalizing pass). Parallelism is a JS-side concern (web workers); this
|
|
284
|
-
* runs sequentially. Returns the document text/JSON
|
|
301
|
+
* runs sequentially. Returns the document text/JSON; throws on failure.
|
|
285
302
|
* @param {string} input
|
|
286
303
|
* @param {string} input_format_sel
|
|
287
304
|
* @param {string} output_format_sel
|
|
@@ -293,8 +310,8 @@ module.exports.convert_text = function(input, direction, format, location) {
|
|
|
293
310
|
* @returns {string}
|
|
294
311
|
*/
|
|
295
312
|
module.exports.transform = function(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {
|
|
296
|
-
let
|
|
297
|
-
let
|
|
313
|
+
let deferred7_0;
|
|
314
|
+
let deferred7_1;
|
|
298
315
|
try {
|
|
299
316
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
300
317
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -310,12 +327,20 @@ module.exports.transform = function(input, input_format_sel, output_format_sel,
|
|
|
310
327
|
wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);
|
|
311
328
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
312
329
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
330
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
331
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
332
|
+
var ptr6 = r0;
|
|
333
|
+
var len6 = r1;
|
|
334
|
+
if (r3) {
|
|
335
|
+
ptr6 = 0; len6 = 0;
|
|
336
|
+
throw takeObject(r2);
|
|
337
|
+
}
|
|
338
|
+
deferred7_0 = ptr6;
|
|
339
|
+
deferred7_1 = len6;
|
|
340
|
+
return getStringFromWasm0(ptr6, len6);
|
|
316
341
|
} finally {
|
|
317
342
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
318
|
-
wasm.__wbindgen_export_2(
|
|
343
|
+
wasm.__wbindgen_export_2(deferred7_0, deferred7_1, 1);
|
|
319
344
|
}
|
|
320
345
|
};
|
|
321
346
|
|
|
@@ -325,14 +350,14 @@ module.exports.transform = function(input, input_format_sel, output_format_sel,
|
|
|
325
350
|
* reorder, drop and insert jobs from the one Rust implementation
|
|
326
351
|
* (PLAN-179). Returns a JSON array of
|
|
327
352
|
* `{ "source": <original index> | null, "bit": <inner bit> | null,
|
|
328
|
-
* "patch": [ … ] }
|
|
353
|
+
* "patch": [ … ] }`; throws on failure.
|
|
329
354
|
* @param {string} input
|
|
330
355
|
* @param {string} patch_json
|
|
331
356
|
* @returns {string}
|
|
332
357
|
*/
|
|
333
358
|
module.exports.resolve_patch_document = function(input, patch_json) {
|
|
334
|
-
let
|
|
335
|
-
let
|
|
359
|
+
let deferred4_0;
|
|
360
|
+
let deferred4_1;
|
|
336
361
|
try {
|
|
337
362
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
338
363
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -342,12 +367,20 @@ module.exports.resolve_patch_document = function(input, patch_json) {
|
|
|
342
367
|
wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);
|
|
343
368
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
344
369
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
370
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
371
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
372
|
+
var ptr3 = r0;
|
|
373
|
+
var len3 = r1;
|
|
374
|
+
if (r3) {
|
|
375
|
+
ptr3 = 0; len3 = 0;
|
|
376
|
+
throw takeObject(r2);
|
|
377
|
+
}
|
|
378
|
+
deferred4_0 = ptr3;
|
|
379
|
+
deferred4_1 = len3;
|
|
380
|
+
return getStringFromWasm0(ptr3, len3);
|
|
348
381
|
} finally {
|
|
349
382
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
350
|
-
wasm.__wbindgen_export_2(
|
|
383
|
+
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
351
384
|
}
|
|
352
385
|
};
|
|
353
386
|
|
|
@@ -361,8 +394,8 @@ module.exports.resolve_patch_document = function(input, patch_json) {
|
|
|
361
394
|
* - `context`, `locate`, `similarity`, `bbox_tolerance`,
|
|
362
395
|
* `spaces_around_values` as documented on `DiffOptions`.
|
|
363
396
|
* Returns the diff (empty text / `[]` of unchanged bits / a patch document
|
|
364
|
-
* with no entries when the documents are semantically equal)
|
|
365
|
-
*
|
|
397
|
+
* with no entries when the documents are semantically equal); throws on
|
|
398
|
+
* failure.
|
|
366
399
|
* @param {string} a
|
|
367
400
|
* @param {string} b
|
|
368
401
|
* @param {string} input_format_sel
|
|
@@ -375,8 +408,8 @@ module.exports.resolve_patch_document = function(input, patch_json) {
|
|
|
375
408
|
* @returns {string}
|
|
376
409
|
*/
|
|
377
410
|
module.exports.diff = function(a, b, input_format_sel, output_format_sel, context, locate, similarity, bbox_tolerance, spaces_around_values) {
|
|
378
|
-
let
|
|
379
|
-
let
|
|
411
|
+
let deferred6_0;
|
|
412
|
+
let deferred6_1;
|
|
380
413
|
try {
|
|
381
414
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
382
415
|
const ptr0 = passStringToWasm0(a, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -390,12 +423,20 @@ module.exports.diff = function(a, b, input_format_sel, output_format_sel, contex
|
|
|
390
423
|
wasm.diff(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, context, locate, similarity, bbox_tolerance, spaces_around_values);
|
|
391
424
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
392
425
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
426
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
427
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
428
|
+
var ptr5 = r0;
|
|
429
|
+
var len5 = r1;
|
|
430
|
+
if (r3) {
|
|
431
|
+
ptr5 = 0; len5 = 0;
|
|
432
|
+
throw takeObject(r2);
|
|
433
|
+
}
|
|
434
|
+
deferred6_0 = ptr5;
|
|
435
|
+
deferred6_1 = len5;
|
|
436
|
+
return getStringFromWasm0(ptr5, len5);
|
|
396
437
|
} finally {
|
|
397
438
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
398
|
-
wasm.__wbindgen_export_2(
|
|
439
|
+
wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
|
|
399
440
|
}
|
|
400
441
|
};
|
|
401
442
|
|
|
@@ -407,18 +448,15 @@ module.exports.diff = function(a, b, input_format_sel, output_format_sel, contex
|
|
|
407
448
|
*
|
|
408
449
|
* `data` is the file's own text. Semantics are REPLACE: a second call
|
|
409
450
|
* supersedes the first entirely, and the built-in table (where the variant
|
|
410
|
-
* bakes one) stays underneath.
|
|
411
|
-
*
|
|
451
|
+
* bakes one) stays underneath. Throws on bad data — like every other
|
|
452
|
+
* fallible export (PLAN-192 D1).
|
|
412
453
|
*
|
|
413
454
|
* Available in EVERY variant, including those that bake nothing: that is
|
|
414
455
|
* exactly where a consumer must supply the file themselves.
|
|
415
456
|
* @param {string} data_type
|
|
416
457
|
* @param {string} data
|
|
417
|
-
* @returns {string}
|
|
418
458
|
*/
|
|
419
459
|
module.exports.register = function(data_type, data) {
|
|
420
|
-
let deferred3_0;
|
|
421
|
-
let deferred3_1;
|
|
422
460
|
try {
|
|
423
461
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
424
462
|
const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -428,24 +466,29 @@ module.exports.register = function(data_type, data) {
|
|
|
428
466
|
wasm.register(retptr, ptr0, len0, ptr1, len1);
|
|
429
467
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
430
468
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
469
|
+
if (r1) {
|
|
470
|
+
throw takeObject(r0);
|
|
471
|
+
}
|
|
434
472
|
} finally {
|
|
435
473
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
436
|
-
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
437
474
|
}
|
|
438
475
|
};
|
|
439
476
|
|
|
440
477
|
/**
|
|
441
478
|
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
442
479
|
*
|
|
443
|
-
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"
|
|
444
|
-
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"
|
|
480
|
+
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
|
|
481
|
+
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
|
|
482
|
+
* `"text"` | `"lex"` (the token stream as JSON, bitmark input only) | a
|
|
483
|
+
* mapping id.
|
|
445
484
|
* `mode`: `"optimized"` (default) | `"full"`.
|
|
446
485
|
* `mapping_report`: replace the output with a human-readable report of the
|
|
447
486
|
* input→output mappings, including inputs that are NOT mapped (PLAN-147).
|
|
448
|
-
*
|
|
487
|
+
* `position_encoding`: `"utf-16"` (default) | `"utf-8"` and `tokens_layout`:
|
|
488
|
+
* `"lsp"` (default) | `"absolute"` — the `semantic-tokens` output's two
|
|
489
|
+
* options (PLAN-193); `""` means the default, and every other output
|
|
490
|
+
* format ignores them.
|
|
491
|
+
* Returns the converted text/JSON; throws on failure.
|
|
449
492
|
* @param {string} input
|
|
450
493
|
* @param {string} input_format_sel
|
|
451
494
|
* @param {string} output_format_sel
|
|
@@ -455,11 +498,13 @@ module.exports.register = function(data_type, data) {
|
|
|
455
498
|
* @param {number} spaces_around_values
|
|
456
499
|
* @param {boolean} include_unknown_properties
|
|
457
500
|
* @param {boolean} mapping_report
|
|
501
|
+
* @param {string} position_encoding
|
|
502
|
+
* @param {string} tokens_layout
|
|
458
503
|
* @returns {string}
|
|
459
504
|
*/
|
|
460
|
-
module.exports.convert = function(input, input_format_sel, output_format_sel, mode, pretty, indent, spaces_around_values, include_unknown_properties, mapping_report) {
|
|
461
|
-
let
|
|
462
|
-
let
|
|
505
|
+
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) {
|
|
506
|
+
let deferred8_0;
|
|
507
|
+
let deferred8_1;
|
|
463
508
|
try {
|
|
464
509
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
465
510
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -470,15 +515,27 @@ module.exports.convert = function(input, input_format_sel, output_format_sel, mo
|
|
|
470
515
|
const len2 = WASM_VECTOR_LEN;
|
|
471
516
|
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
472
517
|
const len3 = WASM_VECTOR_LEN;
|
|
473
|
-
|
|
518
|
+
const ptr4 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
519
|
+
const len4 = WASM_VECTOR_LEN;
|
|
520
|
+
const ptr5 = passStringToWasm0(tokens_layout, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
521
|
+
const len5 = WASM_VECTOR_LEN;
|
|
522
|
+
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);
|
|
474
523
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
475
524
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
525
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
526
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
527
|
+
var ptr7 = r0;
|
|
528
|
+
var len7 = r1;
|
|
529
|
+
if (r3) {
|
|
530
|
+
ptr7 = 0; len7 = 0;
|
|
531
|
+
throw takeObject(r2);
|
|
532
|
+
}
|
|
533
|
+
deferred8_0 = ptr7;
|
|
534
|
+
deferred8_1 = len7;
|
|
535
|
+
return getStringFromWasm0(ptr7, len7);
|
|
479
536
|
} finally {
|
|
480
537
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
481
|
-
wasm.__wbindgen_export_2(
|
|
538
|
+
wasm.__wbindgen_export_2(deferred8_0, deferred8_1, 1);
|
|
482
539
|
}
|
|
483
540
|
};
|
|
484
541
|
|
|
@@ -496,8 +553,8 @@ module.exports.convert = function(input, input_format_sel, output_format_sel, mo
|
|
|
496
553
|
* @returns {string}
|
|
497
554
|
*/
|
|
498
555
|
module.exports.canonicalize = function(input, input_format_sel, mode, pretty, indent, spaces_around_values) {
|
|
499
|
-
let
|
|
500
|
-
let
|
|
556
|
+
let deferred5_0;
|
|
557
|
+
let deferred5_1;
|
|
501
558
|
try {
|
|
502
559
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
503
560
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -509,24 +566,32 @@ module.exports.canonicalize = function(input, input_format_sel, mode, pretty, in
|
|
|
509
566
|
wasm.canonicalize(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, spaces_around_values);
|
|
510
567
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
511
568
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
569
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
570
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
571
|
+
var ptr4 = r0;
|
|
572
|
+
var len4 = r1;
|
|
573
|
+
if (r3) {
|
|
574
|
+
ptr4 = 0; len4 = 0;
|
|
575
|
+
throw takeObject(r2);
|
|
576
|
+
}
|
|
577
|
+
deferred5_0 = ptr4;
|
|
578
|
+
deferred5_1 = len4;
|
|
579
|
+
return getStringFromWasm0(ptr4, len4);
|
|
515
580
|
} finally {
|
|
516
581
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
517
|
-
wasm.__wbindgen_export_2(
|
|
582
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
518
583
|
}
|
|
519
584
|
};
|
|
520
585
|
|
|
521
586
|
/**
|
|
522
587
|
* Count the bits in `input` (auto-detecting bitmark vs JSON).
|
|
523
|
-
* Returns the count as a decimal string
|
|
588
|
+
* Returns the count as a decimal string; throws on failure.
|
|
524
589
|
* @param {string} input
|
|
525
590
|
* @returns {string}
|
|
526
591
|
*/
|
|
527
592
|
module.exports.count_bits = function(input) {
|
|
528
|
-
let
|
|
529
|
-
let
|
|
593
|
+
let deferred3_0;
|
|
594
|
+
let deferred3_1;
|
|
530
595
|
try {
|
|
531
596
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
532
597
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -534,12 +599,20 @@ module.exports.count_bits = function(input) {
|
|
|
534
599
|
wasm.count_bits(retptr, ptr0, len0);
|
|
535
600
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
536
601
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
602
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
603
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
604
|
+
var ptr2 = r0;
|
|
605
|
+
var len2 = r1;
|
|
606
|
+
if (r3) {
|
|
607
|
+
ptr2 = 0; len2 = 0;
|
|
608
|
+
throw takeObject(r2);
|
|
609
|
+
}
|
|
610
|
+
deferred3_0 = ptr2;
|
|
611
|
+
deferred3_1 = len2;
|
|
612
|
+
return getStringFromWasm0(ptr2, len2);
|
|
540
613
|
} finally {
|
|
541
614
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
542
|
-
wasm.__wbindgen_export_2(
|
|
615
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
543
616
|
}
|
|
544
617
|
};
|
|
545
618
|
|
|
@@ -587,13 +660,13 @@ module.exports.is_bitmark = function(input) {
|
|
|
587
660
|
* Split a JSON document (a top-level array of bit envelopes) into its per-bit
|
|
588
661
|
* envelope objects, returned as a JSON array string. Lets a JS caller iterate
|
|
589
662
|
* JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).
|
|
590
|
-
*
|
|
663
|
+
* Throws if the input is not a JSON array of bits.
|
|
591
664
|
* @param {string} input
|
|
592
665
|
* @returns {string}
|
|
593
666
|
*/
|
|
594
667
|
module.exports.split_json_bits = function(input) {
|
|
595
|
-
let
|
|
596
|
-
let
|
|
668
|
+
let deferred3_0;
|
|
669
|
+
let deferred3_1;
|
|
597
670
|
try {
|
|
598
671
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
599
672
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -601,12 +674,20 @@ module.exports.split_json_bits = function(input) {
|
|
|
601
674
|
wasm.split_json_bits(retptr, ptr0, len0);
|
|
602
675
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
603
676
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
677
|
+
var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
|
|
678
|
+
var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
|
|
679
|
+
var ptr2 = r0;
|
|
680
|
+
var len2 = r1;
|
|
681
|
+
if (r3) {
|
|
682
|
+
ptr2 = 0; len2 = 0;
|
|
683
|
+
throw takeObject(r2);
|
|
684
|
+
}
|
|
685
|
+
deferred3_0 = ptr2;
|
|
686
|
+
deferred3_1 = len2;
|
|
687
|
+
return getStringFromWasm0(ptr2, len2);
|
|
607
688
|
} finally {
|
|
608
689
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
609
|
-
wasm.__wbindgen_export_2(
|
|
690
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
610
691
|
}
|
|
611
692
|
};
|
|
612
693
|
|
|
@@ -637,6 +718,11 @@ module.exports.prettify = function(json, indent) {
|
|
|
637
718
|
}
|
|
638
719
|
};
|
|
639
720
|
|
|
721
|
+
module.exports.__wbindgen_error_new = function(arg0, arg1) {
|
|
722
|
+
const ret = new Error(getStringFromWasm0(arg0, arg1));
|
|
723
|
+
return addHeapObject(ret);
|
|
724
|
+
};
|
|
725
|
+
|
|
640
726
|
const path = require('path').join(__dirname, 'bitmark_browser_full_wasm_bg.wasm');
|
|
641
727
|
const bytes = require('fs').readFileSync(path);
|
|
642
728
|
|
|
Binary file
|