@gmb/bitmark-parser 6.1.1 → 6.1.3

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.
@@ -1,30 +1,22 @@
1
1
  /* tslint:disable */
2
2
  /* eslint-disable */
3
3
  /**
4
- * Re-emit input in its own format in canonical form at `mode`.
5
- */
6
- export function canonicalize(input: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number): string;
7
- /**
8
- * Re-emit input in its own format at full mode (all keys).
9
- */
10
- export function fullize(input: string, pretty: boolean, indent: number): string;
11
- /**
12
- * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
4
+ * Lex bitmark input text, returning one line per token in the same format as
5
+ * the Rust CLI: `{kind:?} {span:?} "{text}"`.
13
6
  *
14
- * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
15
- * `output_format_sel`: `"bitmark"` | `"json"` (default json).
16
- * `patch_json`: the patch entry array (empty string = no patches, i.e. a
17
- * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
18
- * runs sequentially. Returns the document text/JSON, or `error: …`.
7
+ * `stage` selects the lexer pipeline:
8
+ * - `"lex"` — combined (default)
9
+ * - `"lex-json"` — combined, JSON array output
19
10
  */
20
- 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;
11
+ export function lex(input: string, stage: string): string;
21
12
  /**
22
- * Split a bitmark document into per-bit source slices.
13
+ * Parse bitmark input text and return the reference JSON format.
23
14
  *
24
- * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS
25
- * caller chunk a document at bit boundaries (e.g. to feed a worker pool).
15
+ * Uses the full pipeline: parse → validate → serialize.
16
+ *
17
+ * `mode`: `"optimized"` (default) or `"full"`
26
18
  */
27
- export function split_bits(input: string): string;
19
+ export function parse(input: string, mode: string): string;
28
20
  /**
29
21
  * Breakscape text (escape bitmark special characters).
30
22
  *
@@ -33,14 +25,12 @@ export function split_bits(input: string): string;
33
25
  */
34
26
  export function breakscape_text(input: string, format: string, location: string): string;
35
27
  /**
36
- * Lex bitmark input text, returning one line per token in the same format as
37
- * the Rust CLI: `{kind:?} {span:?} "{text}"`.
28
+ * Unbreakscape text (unescape bitmark special characters).
38
29
  *
39
- * `stage` selects the lexer pipeline:
40
- * - `"lex"` — combined (default)
41
- * - `"lex-json"` — combined, JSON array output
30
+ * `format`: `"bitmark++"` (default) or `"plainText"`
31
+ * `location`: `"body"` (default) or `"tag"`
42
32
  */
43
- export function lex(input: string, stage: string): string;
33
+ export function unbreakscape_text(input: string, format: string, location: string): string;
44
34
  /**
45
35
  * Split a JSON document (a top-level array of bit envelopes) into its per-bit
46
36
  * envelope objects, returned as a JSON array string. Lets a JS caller iterate
@@ -49,21 +39,21 @@ export function lex(input: string, stage: string): string;
49
39
  */
50
40
  export function split_json_bits(input: string): string;
51
41
  /**
52
- * Unbreakscape text (unescape bitmark special characters).
53
- *
54
- * `format`: `"bitmark++"` (default) or `"plainText"`
55
- * `location`: `"body"` (default) or `"tag"`
56
- */
57
- export function unbreakscape_text(input: string, format: string, location: string): string;
58
- /**
59
- * Count the bits in `input` (auto-detecting bitmark vs JSON).
60
- * Returns the count as a decimal string, or `error: …`.
42
+ * Pretty-print a compact JSON string with the given indent. Used to format a
43
+ * document recombined on the JS side (the per-bit hook path) so its output
44
+ * matches the in-Rust recombination byte-for-byte.
61
45
  */
62
- export function count_bits(input: string): string;
46
+ export function prettify(json: string, indent: number): string;
63
47
  /**
64
- * Re-emit input in its own format at optimized mode (omit natural defaults).
48
+ * Apply a patch (a JSON array of patch entries) to every bit and re-emit.
49
+ *
50
+ * `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
51
+ * `output_format_sel`: `"bitmark"` | `"json"` (default json).
52
+ * `patch_json`: the patch entry array (empty string = no patches, i.e. a
53
+ * canonicalizing pass). Parallelism is a JS-side concern (web workers); this
54
+ * runs sequentially. Returns the document text/JSON, or `error: …`.
65
55
  */
66
- export function optimize(input: string, pretty: boolean, indent: number): string;
56
+ 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;
67
57
  /**
68
58
  * Query information about supported bit types.
69
59
  *
@@ -75,30 +65,49 @@ export function optimize(input: string, pretty: boolean, indent: number): string
75
65
  */
76
66
  export function info(info_type: string, format: string, bit: string, pretty: boolean, indent: number): string;
77
67
  /**
78
- * Parse bitmark input text and return the reference JSON format.
68
+ * Convert between bitmark and JSON with explicit input/output formats + mode.
79
69
  *
80
- * Uses the full pipeline: parse → validate → serialize.
70
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"`.
71
+ * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"`.
72
+ * `mode`: `"optimized"` (default) | `"full"`.
73
+ * Returns the converted text/JSON, or a string prefixed `error:` on failure.
74
+ */
75
+ export function convert(input: string, input_format_sel: string, output_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number): string;
76
+ /**
77
+ * Re-emit input in its own format at optimized mode (omit natural defaults).
81
78
  *
82
- * `mode`: `"optimized"` (default) or `"full"`
79
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | any config
80
+ * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.
83
81
  */
84
- export function parse(input: string, mode: string): string;
82
+ export function optimize(input: string, input_format_sel: string, pretty: boolean, indent: number): string;
85
83
  /**
86
- * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
87
- * used across the API so a JS caller can resolve `"auto"` consistently.
84
+ * Re-emit input in its own format at full mode (all keys).
85
+ *
86
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | any config
87
+ * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.
88
88
  */
89
- export function is_bitmark(input: string): boolean;
89
+ export function fullize(input: string, input_format_sel: string, pretty: boolean, indent: number): string;
90
90
  /**
91
- * Pretty-print a compact JSON string with the given indent. Used to format a
92
- * document recombined on the JS side (the per-bit hook path) so its output
93
- * matches the in-Rust recombination byte-for-byte.
91
+ * Re-emit input in its own format in canonical form at `mode`.
92
+ *
93
+ * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | any config
94
+ * mapping id (`html`, `xml`, …). The output is re-emitted in this same format.
94
95
  */
95
- export function prettify(json: string, indent: number): string;
96
+ export function canonicalize(input: string, input_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number): string;
96
97
  /**
97
- * Convert between bitmark and JSON with explicit input/output formats + mode.
98
+ * Count the bits in `input` (auto-detecting bitmark vs JSON).
99
+ * Returns the count as a decimal string, or `error: …`.
100
+ */
101
+ export function count_bits(input: string): string;
102
+ /**
103
+ * Split a bitmark document into per-bit source slices.
98
104
  *
99
- * `input_format`: `"auto"` (default) | `"bitmark"` | `"json"`.
100
- * `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"`.
101
- * `mode`: `"optimized"` (default) | `"full"`.
102
- * Returns the converted text/JSON, or a string prefixed `error:` on failure.
105
+ * Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS
106
+ * caller chunk a document at bit boundaries (e.g. to feed a worker pool).
103
107
  */
104
- export function convert(input: string, input_format_sel: string, output_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number): string;
108
+ export function split_bits(input: string): string;
109
+ /**
110
+ * Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
111
+ * used across the API so a JS caller can resolve `"auto"` consistently.
112
+ */
113
+ export function is_bitmark(input: string): boolean;