@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.
- package/README.md +17 -17
- package/bin/bitmark +55 -0
- package/bin/bitmark.cmd +16 -0
- package/dist/browser/bitmark-parser.min.js +2 -2
- package/dist/browser/bitmark-parser.min.js.map +1 -1
- package/dist/browser/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/cjs/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/cjs/index.cjs +124 -117
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +23 -8
- package/dist/browser/esm/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/esm/index.d.ts +23 -8
- package/dist/browser/esm/index.js +124 -117
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js.map +1 -1
- package/dist/index.cjs +4 -3
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +22 -7
- package/dist/index.d.ts +22 -7
- package/dist/index.js +4 -3
- package/dist/index.js.map +1 -1
- package/package.json +12 -6
- package/wasm/bitmark_wasm.d.ts +63 -54
- package/wasm/bitmark_wasm.js +212 -194
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +3 -3
- package/wasm/package.json +1 -1
- package/dist/cli.js +0 -388
- package/dist/cli.js.map +0 -1
package/wasm/bitmark_wasm.d.ts
CHANGED
|
@@ -1,30 +1,22 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
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
|
-
* `
|
|
15
|
-
* `
|
|
16
|
-
* `
|
|
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
|
|
11
|
+
export function lex(input: string, stage: string): string;
|
|
21
12
|
/**
|
|
22
|
-
*
|
|
13
|
+
* Parse bitmark input text and return the reference JSON format.
|
|
23
14
|
*
|
|
24
|
-
*
|
|
25
|
-
*
|
|
15
|
+
* Uses the full pipeline: parse → validate → serialize.
|
|
16
|
+
*
|
|
17
|
+
* `mode`: `"optimized"` (default) or `"full"`
|
|
26
18
|
*/
|
|
27
|
-
export function
|
|
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
|
-
*
|
|
37
|
-
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
28
|
+
* Unbreakscape text (unescape bitmark special characters).
|
|
38
29
|
*
|
|
39
|
-
* `
|
|
40
|
-
*
|
|
41
|
-
* - `"lex-json"` — combined, JSON array output
|
|
30
|
+
* `format`: `"bitmark++"` (default) or `"plainText"`
|
|
31
|
+
* `location`: `"body"` (default) or `"tag"`
|
|
42
32
|
*/
|
|
43
|
-
export function
|
|
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
|
-
*
|
|
53
|
-
*
|
|
54
|
-
*
|
|
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
|
|
46
|
+
export function prettify(json: string, indent: number): string;
|
|
63
47
|
/**
|
|
64
|
-
*
|
|
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
|
|
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
|
-
*
|
|
68
|
+
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
79
69
|
*
|
|
80
|
-
*
|
|
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
|
-
* `
|
|
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
|
|
82
|
+
export function optimize(input: string, input_format_sel: string, pretty: boolean, indent: number): string;
|
|
85
83
|
/**
|
|
86
|
-
*
|
|
87
|
-
*
|
|
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
|
|
89
|
+
export function fullize(input: string, input_format_sel: string, pretty: boolean, indent: number): string;
|
|
90
90
|
/**
|
|
91
|
-
*
|
|
92
|
-
*
|
|
93
|
-
*
|
|
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
|
|
96
|
+
export function canonicalize(input: string, input_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number): string;
|
|
96
97
|
/**
|
|
97
|
-
*
|
|
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
|
-
*
|
|
100
|
-
*
|
|
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
|
|
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;
|