@gmb/bitmark-parser 6.11.1 → 7.1.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 +361 -57
- 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 +966 -372
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +642 -70
- package/dist/browser/esm/index.d.ts +642 -70
- package/dist/browser/esm/index.js +958 -371
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js +790 -247
- 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 +163 -124
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +637 -70
- package/dist/index.d.ts +637 -70
- package/dist/index.js +155 -123
- 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 +7 -7
- package/schema/bitmark.schema.json +507 -141
- package/wasm/bitmark_wasm.d.ts +65 -26
- package/wasm/bitmark_wasm.js +348 -116
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +6 -3
- package/wasm/package.json +1 -1
- package/wasm-bitmark-json/bitmark_json_wasm.d.ts +56 -15
- package/wasm-bitmark-json/bitmark_json_wasm.js +321 -77
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +5 -2
- package/wasm-bitmark-json/package.json +1 -1
- package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +65 -26
- package/wasm-browser-full/bitmark_browser_full_wasm.js +348 -116
- 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 -3
- 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,28 +46,35 @@ 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
|
/**
|
|
55
53
|
* Apply a patch (a JSON array of patch entries) to every bit and re-emit.
|
|
56
54
|
*
|
|
57
55
|
* `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
|
|
58
|
-
* `output_format_sel`: `
|
|
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.
|
|
59
61
|
* `patch_json`: the patch entry array (empty string = no patches, i.e. a
|
|
60
62
|
* canonicalizing pass). Parallelism is a JS-side concern (web workers); this
|
|
61
|
-
* runs sequentially. Returns the document text/JSON
|
|
63
|
+
* runs sequentially. Returns the document text/JSON; throws on failure.
|
|
62
64
|
*/
|
|
63
65
|
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
66
|
/**
|
|
65
67
|
* Resolve a patch document against `input` (bitmark or JSON) into the
|
|
66
68
|
* ordered output items, so a JS per-bit planner (hooks, worker pool) can
|
|
67
69
|
* reorder, drop and insert jobs from the one Rust implementation
|
|
68
|
-
* (PLAN-179).
|
|
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
|
|
69
74
|
* `{ "source": <original index> | null, "bit": <inner bit> | null,
|
|
70
|
-
* "patch": [ … ] }
|
|
75
|
+
* "patch": [ … ] }`; throws on failure.
|
|
71
76
|
*/
|
|
72
|
-
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;
|
|
73
78
|
/**
|
|
74
79
|
* Semantic diff of two documents (PLAN-179). Flat arguments like every
|
|
75
80
|
* other export:
|
|
@@ -80,10 +85,37 @@ export function resolve_patch_document(input: string, patch_json: string): strin
|
|
|
80
85
|
* - `context`, `locate`, `similarity`, `bbox_tolerance`,
|
|
81
86
|
* `spaces_around_values` as documented on `DiffOptions`.
|
|
82
87
|
* Returns the diff (empty text / `[]` of unchanged bits / a patch document
|
|
83
|
-
* with no entries when the documents are semantically equal)
|
|
84
|
-
*
|
|
88
|
+
* with no entries when the documents are semantically equal); throws on
|
|
89
|
+
* failure.
|
|
85
90
|
*/
|
|
86
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;
|
|
87
119
|
/**
|
|
88
120
|
* Register data with the parser process (PLAN-173 P12).
|
|
89
121
|
*
|
|
@@ -92,24 +124,31 @@ export function diff(a: string, b: string, input_format_sel: string, output_form
|
|
|
92
124
|
*
|
|
93
125
|
* `data` is the file's own text. Semantics are REPLACE: a second call
|
|
94
126
|
* supersedes the first entirely, and the built-in table (where the variant
|
|
95
|
-
* bakes one) stays underneath.
|
|
96
|
-
*
|
|
127
|
+
* bakes one) stays underneath. Throws on bad data — like every other
|
|
128
|
+
* fallible export (PLAN-192 D1).
|
|
97
129
|
*
|
|
98
130
|
* Available in EVERY variant, including those that bake nothing: that is
|
|
99
131
|
* exactly where a consumer must supply the file themselves.
|
|
100
132
|
*/
|
|
101
|
-
export function register(data_type: string, data: string):
|
|
133
|
+
export function register(data_type: string, data: string): void;
|
|
102
134
|
/**
|
|
103
135
|
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
104
136
|
*
|
|
105
|
-
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"
|
|
106
|
-
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"
|
|
137
|
+
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | a mapping id.
|
|
138
|
+
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"` |
|
|
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
|
-
*
|
|
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
|
|
148
|
+
* format ignores them.
|
|
149
|
+
* Returns the converted text/JSON; throws on failure.
|
|
111
150
|
*/
|
|
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;
|
|
151
|
+
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
152
|
/**
|
|
114
153
|
* Re-emit input in its own format in canonical form at `mode`.
|
|
115
154
|
*
|
|
@@ -119,7 +158,7 @@ export function convert(input: string, input_format_sel: string, output_format_s
|
|
|
119
158
|
export function canonicalize(input: string, input_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number): string;
|
|
120
159
|
/**
|
|
121
160
|
* Count the bits in `input` (auto-detecting bitmark vs JSON).
|
|
122
|
-
* Returns the count as a decimal string
|
|
161
|
+
* Returns the count as a decimal string; throws on failure.
|
|
123
162
|
*/
|
|
124
163
|
export function count_bits(input: string): string;
|
|
125
164
|
/**
|
|
@@ -138,7 +177,7 @@ export function is_bitmark(input: string): boolean;
|
|
|
138
177
|
* Split a JSON document (a top-level array of bit envelopes) into its per-bit
|
|
139
178
|
* envelope objects, returned as a JSON array string. Lets a JS caller iterate
|
|
140
179
|
* JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).
|
|
141
|
-
*
|
|
180
|
+
* Throws if the input is not a JSON array of bits.
|
|
142
181
|
*/
|
|
143
182
|
export function split_json_bits(input: string): string;
|
|
144
183
|
/**
|