@gmb/bitmark-parser 7.0.0 → 7.2.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.
Files changed (42) hide show
  1. package/README.md +147 -11
  2. package/dist/browser/bitmark-parser.min.js +4 -4
  3. package/dist/browser/bitmark-parser.min.js.map +1 -1
  4. package/dist/browser/cjs/index.cjs +439 -67
  5. package/dist/browser/cjs/index.cjs.map +1 -1
  6. package/dist/browser/cjs/index.d.cts +320 -17
  7. package/dist/browser/esm/index.d.ts +320 -17
  8. package/dist/browser/esm/index.js +432 -67
  9. package/dist/browser/esm/index.js.map +1 -1
  10. package/dist/browser/esm/worker-entry.js +317 -29
  11. package/dist/browser/esm/worker-entry.js.map +1 -1
  12. package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
  13. package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
  14. package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
  15. package/dist/index.cjs +114 -38
  16. package/dist/index.cjs.map +1 -1
  17. package/dist/index.d.cts +315 -17
  18. package/dist/index.d.ts +315 -17
  19. package/dist/index.js +107 -38
  20. package/dist/index.js.map +1 -1
  21. package/dist/legacy.cjs +1 -1
  22. package/dist/legacy.cjs.map +1 -1
  23. package/dist/legacy.js +1 -1
  24. package/dist/legacy.js.map +1 -1
  25. package/dist/worker-entry.cjs.map +1 -1
  26. package/package.json +7 -7
  27. package/schema/bitmark.schema.json +30 -6
  28. package/wasm/bitmark_wasm.d.ts +43 -8
  29. package/wasm/bitmark_wasm.js +165 -19
  30. package/wasm/bitmark_wasm_bg.wasm +0 -0
  31. package/wasm/bitmark_wasm_bg.wasm.d.ts +4 -1
  32. package/wasm/package.json +1 -1
  33. package/wasm-bitmark-json/bitmark_json_wasm.d.ts +43 -8
  34. package/wasm-bitmark-json/bitmark_json_wasm.js +156 -10
  35. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
  36. package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +4 -1
  37. package/wasm-bitmark-json/package.json +1 -1
  38. package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +43 -8
  39. package/wasm-browser-full/bitmark_browser_full_wasm.js +165 -19
  40. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
  41. package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +4 -1
  42. package/wasm-browser-full/package.json +1 -1
@@ -270,7 +270,11 @@ module.exports.register = function(data_type, data) {
270
270
  * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
271
271
  *
272
272
  * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
273
- * `output_format_sel`: `"bitmark"` | `"json"` (default json).
273
+ * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
274
+ * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
275
+ * the opposite of the resolved input format. The whole-document outputs
276
+ * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
277
+ * pipeline refuses them and that refusal is what throws.
274
278
  * `patch_json`: the patch entry array (empty string = no patches, i.e. a
275
279
  * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
276
280
  * runs sequentially. Returns the document text/JSON; throws on failure.
@@ -323,23 +327,164 @@ module.exports.transform = function(input, input_format_sel, output_format_sel,
323
327
  * Resolve a patch document against `input` (bitmark or JSON) into the
324
328
  * ordered output items, so a JS per-bit planner (hooks, worker pool) can
325
329
  * reorder, drop and insert jobs from the one Rust implementation
326
- * (PLAN-179). Returns a JSON array of
330
+ * (PLAN-179). `input_format_sel` is the caller's input-format selector
331
+ * (`"auto"` | `"bitmark"` | `"json"`): the document is split under the SAME
332
+ * selection the planner already resolved, never re-sniffed (PLAN-187 D1).
333
+ * Returns a JSON array of
327
334
  * `{ "source": <original index> | null, "bit": <inner bit> | null,
328
335
  * "patch": [ … ] }`; throws on failure.
329
336
  * @param {string} input
337
+ * @param {string} input_format_sel
330
338
  * @param {string} patch_json
331
339
  * @returns {string}
332
340
  */
333
- module.exports.resolve_patch_document = function(input, patch_json) {
341
+ module.exports.resolve_patch_document = function(input, input_format_sel, patch_json) {
342
+ let deferred5_0;
343
+ let deferred5_1;
344
+ try {
345
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
346
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
347
+ const len0 = WASM_VECTOR_LEN;
348
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
349
+ const len1 = WASM_VECTOR_LEN;
350
+ const ptr2 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
351
+ const len2 = WASM_VECTOR_LEN;
352
+ wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
353
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
354
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
355
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
356
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
357
+ var ptr4 = r0;
358
+ var len4 = r1;
359
+ if (r3) {
360
+ ptr4 = 0; len4 = 0;
361
+ throw takeObject(r2);
362
+ }
363
+ deferred5_0 = ptr4;
364
+ deferred5_1 = len4;
365
+ return getStringFromWasm0(ptr4, len4);
366
+ } finally {
367
+ wasm.__wbindgen_add_to_stack_pointer(16);
368
+ wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
369
+ }
370
+ };
371
+
372
+ /**
373
+ * The constructs valid at a position, as an LSP `CompletionList` (PLAN-196
374
+ * D7; contract `API-EDT-editor-services.tsp`). `line` / `character` are
375
+ * 0-based, `character` in `position_encoding` units (`"utf-16"`, the
376
+ * default, or `"utf-8"`); `include_deprecated` offers deprecated bits too;
377
+ * `trigger_character` is the character the editor sent as the trigger (LSP
378
+ * `CompletionContext.triggerCharacter`; empty when invoked explicitly) — a
379
+ * trigger that opens nothing where the cursor is answers the empty list
380
+ * (PLAN-203 D1). ABSENT on a variant built without `editor` — the same
381
+ * "presence is the capability" signal `diff` uses. Throws when the line is
382
+ * past the text.
383
+ * @param {string} input
384
+ * @param {number} line
385
+ * @param {number} character
386
+ * @param {string} position_encoding
387
+ * @param {boolean} include_deprecated
388
+ * @param {string} trigger_character
389
+ * @returns {string}
390
+ */
391
+ module.exports.complete = function(input, line, character, position_encoding, include_deprecated, trigger_character) {
392
+ let deferred5_0;
393
+ let deferred5_1;
394
+ try {
395
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
396
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
397
+ const len0 = WASM_VECTOR_LEN;
398
+ const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
399
+ const len1 = WASM_VECTOR_LEN;
400
+ const ptr2 = passStringToWasm0(trigger_character, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
401
+ const len2 = WASM_VECTOR_LEN;
402
+ wasm.complete(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2);
403
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
404
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
405
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
406
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
407
+ var ptr4 = r0;
408
+ var len4 = r1;
409
+ if (r3) {
410
+ ptr4 = 0; len4 = 0;
411
+ throw takeObject(r2);
412
+ }
413
+ deferred5_0 = ptr4;
414
+ deferred5_1 = len4;
415
+ return getStringFromWasm0(ptr4, len4);
416
+ } finally {
417
+ wasm.__wbindgen_add_to_stack_pointer(16);
418
+ wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
419
+ }
420
+ };
421
+
422
+ /**
423
+ * One item of the list `complete` returns at this position, its Markdown
424
+ * `documentation` filled in — LSP `completionItem/resolve` (PLAN-202):
425
+ * `complete` ships no documentation, an editor asks for the one item it is
426
+ * about to show. `label` and `kind` (the LSP `CompletionItemKind` number)
427
+ * name the item; the JSON `null` when the list has no such item. Arguments
428
+ * otherwise as `complete`.
429
+ * @param {string} input
430
+ * @param {number} line
431
+ * @param {number} character
432
+ * @param {string} position_encoding
433
+ * @param {boolean} include_deprecated
434
+ * @param {string} label
435
+ * @param {number} kind
436
+ * @returns {string}
437
+ */
438
+ module.exports.resolve = function(input, line, character, position_encoding, include_deprecated, label, kind) {
439
+ let deferred5_0;
440
+ let deferred5_1;
441
+ try {
442
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
443
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
444
+ const len0 = WASM_VECTOR_LEN;
445
+ const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
446
+ const len1 = WASM_VECTOR_LEN;
447
+ const ptr2 = passStringToWasm0(label, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
448
+ const len2 = WASM_VECTOR_LEN;
449
+ wasm.resolve(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2, kind);
450
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
451
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
452
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
453
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
454
+ var ptr4 = r0;
455
+ var len4 = r1;
456
+ if (r3) {
457
+ ptr4 = 0; len4 = 0;
458
+ throw takeObject(r2);
459
+ }
460
+ deferred5_0 = ptr4;
461
+ deferred5_1 = len4;
462
+ return getStringFromWasm0(ptr4, len4);
463
+ } finally {
464
+ wasm.__wbindgen_add_to_stack_pointer(16);
465
+ wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
466
+ }
467
+ };
468
+
469
+ /**
470
+ * The construct at a position, as an LSP `Hover` — or the JSON `null` when
471
+ * there is nothing to show (PLAN-196 D8). Arguments as `complete`.
472
+ * @param {string} input
473
+ * @param {number} line
474
+ * @param {number} character
475
+ * @param {string} position_encoding
476
+ * @returns {string}
477
+ */
478
+ module.exports.hover = function(input, line, character, position_encoding) {
334
479
  let deferred4_0;
335
480
  let deferred4_1;
336
481
  try {
337
482
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
338
483
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
339
484
  const len0 = WASM_VECTOR_LEN;
340
- const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
485
+ const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
341
486
  const len1 = WASM_VECTOR_LEN;
342
- wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);
487
+ wasm.hover(retptr, ptr0, len0, line, character, ptr1, len1);
343
488
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
344
489
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
345
490
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
@@ -364,14 +509,15 @@ module.exports.resolve_patch_document = function(input, patch_json) {
364
509
  *
365
510
  * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
366
511
  * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
367
- * `"text"` | `"lex"` (the token stream as JSON, bitmark input only) | a
368
- * mapping id.
512
+ * `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
513
+ * `"diagnostics"` (the last three bitmark input only) | a mapping id.
369
514
  * `mode`: `"optimized"` (default) | `"full"`.
370
515
  * `mapping_report`: replace the output with a human-readable report of the
371
516
  * input→output mappings, including inputs that are NOT mapped (PLAN-147).
372
- * `position_encoding`: `"utf-16"` (default) | `"utf-8"` and `tokens_layout`:
373
- * `"lsp"` (default) | `"absolute"` — the `semantic-tokens` output's two
374
- * options (PLAN-193); `""` means the default, and every other output
517
+ * `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
518
+ * `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
519
+ * PLAN-196) — and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
520
+ * `semantic-tokens` layout; `""` means the default, and every other output
375
521
  * format ignores them.
376
522
  * Returns the converted text/JSON; throws on failure.
377
523
  * @param {string} input
@@ -3,14 +3,17 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
5
5
  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
+ export const complete: (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 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;
7
8
  export const convert_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
8
9
  export const count_bits: (a: number, b: number, c: number) => void;
10
+ export const hover: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
9
11
  export const info: (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;
10
12
  export const is_bitmark: (a: number, b: number) => number;
11
13
  export const prettify: (a: number, b: number, c: number, d: number) => void;
12
14
  export const register: (a: number, b: number, c: number, d: number, e: number) => void;
13
- export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number) => void;
15
+ 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;
16
+ export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
14
17
  export const split_bits: (a: number, b: number, c: number) => void;
15
18
  export const split_json_bits: (a: number, b: number, c: number) => void;
16
19
  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;
@@ -4,7 +4,7 @@
4
4
  "Get More Brain Ltd <info@getmorebrain.com>"
5
5
  ],
6
6
  "description": "WebAssembly bindings for the bitmark parser",
7
- "version": "7.0.0",
7
+ "version": "7.2.0",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",
@@ -53,7 +53,11 @@ export function convert_text(input: string, direction: string, format: string, l
53
53
  * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
54
54
  *
55
55
  * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
56
- * `output_format_sel`: `"bitmark"` | `"json"` (default json).
56
+ * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
57
+ * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
58
+ * the opposite of the resolved input format. The whole-document outputs
59
+ * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
60
+ * pipeline refuses them and that refusal is what throws.
57
61
  * `patch_json`: the patch entry array (empty string = no patches, i.e. a
58
62
  * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
59
63
  * runs sequentially. Returns the document text/JSON; throws on failure.
@@ -63,11 +67,14 @@ export function transform(input: string, input_format_sel: string, output_format
63
67
  * Resolve a patch document against `input` (bitmark or JSON) into the
64
68
  * ordered output items, so a JS per-bit planner (hooks, worker pool) can
65
69
  * reorder, drop and insert jobs from the one Rust implementation
66
- * (PLAN-179). Returns a JSON array of
70
+ * (PLAN-179). `input_format_sel` is the caller's input-format selector
71
+ * (`"auto"` | `"bitmark"` | `"json"`): the document is split under the SAME
72
+ * selection the planner already resolved, never re-sniffed (PLAN-187 D1).
73
+ * Returns a JSON array of
67
74
  * `{ "source": <original index> | null, "bit": <inner bit> | null,
68
75
  * "patch": [ … ] }`; throws on failure.
69
76
  */
70
- export function resolve_patch_document(input: string, patch_json: string): string;
77
+ export function resolve_patch_document(input: string, input_format_sel: string, patch_json: string): string;
71
78
  /**
72
79
  * Semantic diff of two documents (PLAN-179). Flat arguments like every
73
80
  * other export:
@@ -82,6 +89,33 @@ export function resolve_patch_document(input: string, patch_json: string): strin
82
89
  * failure.
83
90
  */
84
91
  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;
92
+ /**
93
+ * The constructs valid at a position, as an LSP `CompletionList` (PLAN-196
94
+ * D7; contract `API-EDT-editor-services.tsp`). `line` / `character` are
95
+ * 0-based, `character` in `position_encoding` units (`"utf-16"`, the
96
+ * default, or `"utf-8"`); `include_deprecated` offers deprecated bits too;
97
+ * `trigger_character` is the character the editor sent as the trigger (LSP
98
+ * `CompletionContext.triggerCharacter`; empty when invoked explicitly) — a
99
+ * trigger that opens nothing where the cursor is answers the empty list
100
+ * (PLAN-203 D1). ABSENT on a variant built without `editor` — the same
101
+ * "presence is the capability" signal `diff` uses. Throws when the line is
102
+ * past the text.
103
+ */
104
+ export function complete(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, trigger_character: string): string;
105
+ /**
106
+ * One item of the list `complete` returns at this position, its Markdown
107
+ * `documentation` filled in — LSP `completionItem/resolve` (PLAN-202):
108
+ * `complete` ships no documentation, an editor asks for the one item it is
109
+ * about to show. `label` and `kind` (the LSP `CompletionItemKind` number)
110
+ * name the item; the JSON `null` when the list has no such item. Arguments
111
+ * otherwise as `complete`.
112
+ */
113
+ export function resolve(input: string, line: number, character: number, position_encoding: string, include_deprecated: boolean, label: string, kind: number): string;
114
+ /**
115
+ * The construct at a position, as an LSP `Hover` — or the JSON `null` when
116
+ * there is nothing to show (PLAN-196 D8). Arguments as `complete`.
117
+ */
118
+ export function hover(input: string, line: number, character: number, position_encoding: string): string;
85
119
  /**
86
120
  * Register data with the parser process (PLAN-173 P12).
87
121
  *
@@ -102,14 +136,15 @@ export function register(data_type: string, data: string): void;
102
136
  *
103
137
  * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
104
138
  * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
105
- * `"text"` | `"lex"` (the token stream as JSON, bitmark input only) | a
106
- * mapping id.
139
+ * `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
140
+ * `"diagnostics"` (the last three bitmark input only) | a mapping id.
107
141
  * `mode`: `"optimized"` (default) | `"full"`.
108
142
  * `mapping_report`: replace the output with a human-readable report of the
109
143
  * input→output mappings, including inputs that are NOT mapped (PLAN-147).
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
144
+ * `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
145
+ * `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
146
+ * PLAN-196) — and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
147
+ * `semantic-tokens` layout; `""` means the default, and every other output
113
148
  * format ignores them.
114
149
  * Returns the converted text/JSON; throws on failure.
115
150
  */
@@ -295,7 +295,11 @@ module.exports.convert_text = function(input, direction, format, location) {
295
295
  * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
296
296
  *
297
297
  * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
298
- * `output_format_sel`: `"bitmark"` | `"json"` (default json).
298
+ * `output_format_sel`: the same vocabulary as `convert` — `"bitmark"` |
299
+ * `"json"` | `"text"` | a mapping id (`"html"`, …), `"auto"` (or empty) being
300
+ * the opposite of the resolved input format. The whole-document outputs
301
+ * (`lex`, `semantic-tokens`, `diagnostics`) are not per-bit formats; the
302
+ * pipeline refuses them and that refusal is what throws.
299
303
  * `patch_json`: the patch entry array (empty string = no patches, i.e. a
300
304
  * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
301
305
  * runs sequentially. Returns the document text/JSON; throws on failure.
@@ -348,39 +352,45 @@ module.exports.transform = function(input, input_format_sel, output_format_sel,
348
352
  * Resolve a patch document against `input` (bitmark or JSON) into the
349
353
  * ordered output items, so a JS per-bit planner (hooks, worker pool) can
350
354
  * reorder, drop and insert jobs from the one Rust implementation
351
- * (PLAN-179). Returns a JSON array of
355
+ * (PLAN-179). `input_format_sel` is the caller's input-format selector
356
+ * (`"auto"` | `"bitmark"` | `"json"`): the document is split under the SAME
357
+ * selection the planner already resolved, never re-sniffed (PLAN-187 D1).
358
+ * Returns a JSON array of
352
359
  * `{ "source": <original index> | null, "bit": <inner bit> | null,
353
360
  * "patch": [ … ] }`; throws on failure.
354
361
  * @param {string} input
362
+ * @param {string} input_format_sel
355
363
  * @param {string} patch_json
356
364
  * @returns {string}
357
365
  */
358
- module.exports.resolve_patch_document = function(input, patch_json) {
359
- let deferred4_0;
360
- let deferred4_1;
366
+ module.exports.resolve_patch_document = function(input, input_format_sel, patch_json) {
367
+ let deferred5_0;
368
+ let deferred5_1;
361
369
  try {
362
370
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
363
371
  const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
364
372
  const len0 = WASM_VECTOR_LEN;
365
- const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
373
+ const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
366
374
  const len1 = WASM_VECTOR_LEN;
367
- wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);
375
+ const ptr2 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
376
+ const len2 = WASM_VECTOR_LEN;
377
+ wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
368
378
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
369
379
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
370
380
  var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
371
381
  var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
372
- var ptr3 = r0;
373
- var len3 = r1;
382
+ var ptr4 = r0;
383
+ var len4 = r1;
374
384
  if (r3) {
375
- ptr3 = 0; len3 = 0;
385
+ ptr4 = 0; len4 = 0;
376
386
  throw takeObject(r2);
377
387
  }
378
- deferred4_0 = ptr3;
379
- deferred4_1 = len3;
380
- return getStringFromWasm0(ptr3, len3);
388
+ deferred5_0 = ptr4;
389
+ deferred5_1 = len4;
390
+ return getStringFromWasm0(ptr4, len4);
381
391
  } finally {
382
392
  wasm.__wbindgen_add_to_stack_pointer(16);
383
- wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
393
+ wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
384
394
  }
385
395
  };
386
396
 
@@ -440,6 +450,141 @@ module.exports.diff = function(a, b, input_format_sel, output_format_sel, contex
440
450
  }
441
451
  };
442
452
 
453
+ /**
454
+ * The constructs valid at a position, as an LSP `CompletionList` (PLAN-196
455
+ * D7; contract `API-EDT-editor-services.tsp`). `line` / `character` are
456
+ * 0-based, `character` in `position_encoding` units (`"utf-16"`, the
457
+ * default, or `"utf-8"`); `include_deprecated` offers deprecated bits too;
458
+ * `trigger_character` is the character the editor sent as the trigger (LSP
459
+ * `CompletionContext.triggerCharacter`; empty when invoked explicitly) — a
460
+ * trigger that opens nothing where the cursor is answers the empty list
461
+ * (PLAN-203 D1). ABSENT on a variant built without `editor` — the same
462
+ * "presence is the capability" signal `diff` uses. Throws when the line is
463
+ * past the text.
464
+ * @param {string} input
465
+ * @param {number} line
466
+ * @param {number} character
467
+ * @param {string} position_encoding
468
+ * @param {boolean} include_deprecated
469
+ * @param {string} trigger_character
470
+ * @returns {string}
471
+ */
472
+ module.exports.complete = function(input, line, character, position_encoding, include_deprecated, trigger_character) {
473
+ let deferred5_0;
474
+ let deferred5_1;
475
+ try {
476
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
477
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
478
+ const len0 = WASM_VECTOR_LEN;
479
+ const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
480
+ const len1 = WASM_VECTOR_LEN;
481
+ const ptr2 = passStringToWasm0(trigger_character, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
482
+ const len2 = WASM_VECTOR_LEN;
483
+ wasm.complete(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2);
484
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
485
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
486
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
487
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
488
+ var ptr4 = r0;
489
+ var len4 = r1;
490
+ if (r3) {
491
+ ptr4 = 0; len4 = 0;
492
+ throw takeObject(r2);
493
+ }
494
+ deferred5_0 = ptr4;
495
+ deferred5_1 = len4;
496
+ return getStringFromWasm0(ptr4, len4);
497
+ } finally {
498
+ wasm.__wbindgen_add_to_stack_pointer(16);
499
+ wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
500
+ }
501
+ };
502
+
503
+ /**
504
+ * One item of the list `complete` returns at this position, its Markdown
505
+ * `documentation` filled in — LSP `completionItem/resolve` (PLAN-202):
506
+ * `complete` ships no documentation, an editor asks for the one item it is
507
+ * about to show. `label` and `kind` (the LSP `CompletionItemKind` number)
508
+ * name the item; the JSON `null` when the list has no such item. Arguments
509
+ * otherwise as `complete`.
510
+ * @param {string} input
511
+ * @param {number} line
512
+ * @param {number} character
513
+ * @param {string} position_encoding
514
+ * @param {boolean} include_deprecated
515
+ * @param {string} label
516
+ * @param {number} kind
517
+ * @returns {string}
518
+ */
519
+ module.exports.resolve = function(input, line, character, position_encoding, include_deprecated, label, kind) {
520
+ let deferred5_0;
521
+ let deferred5_1;
522
+ try {
523
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
524
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
525
+ const len0 = WASM_VECTOR_LEN;
526
+ const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
527
+ const len1 = WASM_VECTOR_LEN;
528
+ const ptr2 = passStringToWasm0(label, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
529
+ const len2 = WASM_VECTOR_LEN;
530
+ wasm.resolve(retptr, ptr0, len0, line, character, ptr1, len1, include_deprecated, ptr2, len2, kind);
531
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
532
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
533
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
534
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
535
+ var ptr4 = r0;
536
+ var len4 = r1;
537
+ if (r3) {
538
+ ptr4 = 0; len4 = 0;
539
+ throw takeObject(r2);
540
+ }
541
+ deferred5_0 = ptr4;
542
+ deferred5_1 = len4;
543
+ return getStringFromWasm0(ptr4, len4);
544
+ } finally {
545
+ wasm.__wbindgen_add_to_stack_pointer(16);
546
+ wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
547
+ }
548
+ };
549
+
550
+ /**
551
+ * The construct at a position, as an LSP `Hover` — or the JSON `null` when
552
+ * there is nothing to show (PLAN-196 D8). Arguments as `complete`.
553
+ * @param {string} input
554
+ * @param {number} line
555
+ * @param {number} character
556
+ * @param {string} position_encoding
557
+ * @returns {string}
558
+ */
559
+ module.exports.hover = function(input, line, character, position_encoding) {
560
+ let deferred4_0;
561
+ let deferred4_1;
562
+ try {
563
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
564
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
565
+ const len0 = WASM_VECTOR_LEN;
566
+ const ptr1 = passStringToWasm0(position_encoding, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
567
+ const len1 = WASM_VECTOR_LEN;
568
+ wasm.hover(retptr, ptr0, len0, line, character, ptr1, len1);
569
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
570
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
571
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
572
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
573
+ var ptr3 = r0;
574
+ var len3 = r1;
575
+ if (r3) {
576
+ ptr3 = 0; len3 = 0;
577
+ throw takeObject(r2);
578
+ }
579
+ deferred4_0 = ptr3;
580
+ deferred4_1 = len3;
581
+ return getStringFromWasm0(ptr3, len3);
582
+ } finally {
583
+ wasm.__wbindgen_add_to_stack_pointer(16);
584
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
585
+ }
586
+ };
587
+
443
588
  /**
444
589
  * Register data with the parser process (PLAN-173 P12).
445
590
  *
@@ -479,14 +624,15 @@ module.exports.register = function(data_type, data) {
479
624
  *
480
625
  * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
481
626
  * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
482
- * `"text"` | `"lex"` (the token stream as JSON, bitmark input only) | a
483
- * mapping id.
627
+ * `"text"` | `"lex"` (the token stream as JSON) | `"semantic-tokens"` |
628
+ * `"diagnostics"` (the last three bitmark input only) | a mapping id.
484
629
  * `mode`: `"optimized"` (default) | `"full"`.
485
630
  * `mapping_report`: replace the output with a human-readable report of the
486
631
  * input→output mappings, including inputs that are NOT mapped (PLAN-147).
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
632
+ * `position_encoding`: `"utf-16"` (default) | `"utf-8"` — the
633
+ * `semantic-tokens` and `diagnostics` outputs' encoding (PLAN-193 /
634
+ * PLAN-196) — and `tokens_layout`: `"lsp"` (default) | `"absolute"` — the
635
+ * `semantic-tokens` layout; `""` means the default, and every other output
490
636
  * format ignores them.
491
637
  * Returns the converted text/JSON; throws on failure.
492
638
  * @param {string} input
@@ -3,16 +3,19 @@
3
3
  export const memory: WebAssembly.Memory;
4
4
  export const breakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
5
5
  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
+ export const complete: (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 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;
7
8
  export const convert_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
8
9
  export const count_bits: (a: number, b: number, c: number) => void;
9
10
  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
+ export const hover: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
10
12
  export const info: (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
13
  export const info_text_supported: () => number;
12
14
  export const is_bitmark: (a: number, b: number) => number;
13
15
  export const prettify: (a: number, b: number, c: number, d: number) => void;
14
16
  export const register: (a: number, b: number, c: number, d: number, e: number) => void;
15
- export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number) => void;
17
+ 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
+ export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
16
19
  export const split_bits: (a: number, b: number, c: number) => void;
17
20
  export const split_json_bits: (a: number, b: number, c: number) => void;
18
21
  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;
@@ -4,7 +4,7 @@
4
4
  "Get More Brain Ltd <info@getmorebrain.com>"
5
5
  ],
6
6
  "description": "WebAssembly bindings for the bitmark parser",
7
- "version": "7.0.0",
7
+ "version": "7.2.0",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",