@gmb/bitmark-parser 3.0.1-alpha.2 → 3.0.1-alpha.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 +92 -11
- package/dist/browser/bitmark-parser.min.js +1 -1
- 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 +11 -9
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +15 -11
- package/dist/browser/esm/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/esm/index.d.ts +15 -11
- package/dist/browser/esm/index.js +11 -9
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/cli.js +9 -5
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +5 -5
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +4 -3
- package/dist/index.d.ts +4 -3
- package/dist/index.js +5 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/wasm/bitmark_wasm.d.ts +14 -10
- package/wasm/bitmark_wasm.js +25 -18
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +1 -1
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @gmb/bitmark-parser
|
|
2
2
|
|
|
3
|
-
A high-performance parser for [bitmark](https://docs.bitmark.cloud/)
|
|
3
|
+
A high-performance parser for [bitmark](https://docs.bitmark.cloud/), powered by WebAssembly. Provides both a programmatic API and a CLI for converting between bitmark markup and JSON.
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -11,23 +11,50 @@ npm install @gmb/bitmark-parser
|
|
|
11
11
|
## Programmatic API (Node.js)
|
|
12
12
|
|
|
13
13
|
```js
|
|
14
|
-
import { parse, lex } from "@gmb/bitmark-parser";
|
|
14
|
+
import { convert, parse, lex, breakscapeText, unbreakscapeText, info, version } from "@gmb/bitmark-parser";
|
|
15
15
|
|
|
16
|
-
//
|
|
17
|
-
const json =
|
|
16
|
+
// Convert bitmark to JSON (auto-detects input format)
|
|
17
|
+
const json = convert("[.article]\nHello **bold**");
|
|
18
18
|
console.log(json);
|
|
19
19
|
|
|
20
|
+
// Convert JSON back to bitmark
|
|
21
|
+
const bitmark = convert('[{"bitmark":"[.article]\\nHello **bold**","bit":{"type":"article","body":"Hello **bold**"}}]');
|
|
22
|
+
console.log(bitmark);
|
|
23
|
+
|
|
24
|
+
// Parse bitmark to JSON (same as convert for bitmark input)
|
|
25
|
+
const parsed = parse("[.article]\nHello **bold**");
|
|
26
|
+
|
|
20
27
|
// Lex bitmark to token dump
|
|
21
28
|
const tokens = lex("[.article]\nHello **bold**");
|
|
22
|
-
console.log(tokens);
|
|
23
29
|
|
|
24
30
|
// Lex with a specific stage
|
|
25
31
|
const bitmarkTokens = lex(input, "lex-bitmark");
|
|
26
32
|
const textTokens = lex(input, "lex-text");
|
|
33
|
+
|
|
34
|
+
// Breakscape / unbreakscape text
|
|
35
|
+
const escaped = breakscapeText("[!example]", "bitmark++", "body");
|
|
36
|
+
const unescaped = unbreakscapeText(escaped, "bitmark++", "body");
|
|
37
|
+
|
|
38
|
+
// Query supported bit types
|
|
39
|
+
const bitInfo = info("list", "text");
|
|
40
|
+
|
|
41
|
+
// Get library version
|
|
42
|
+
console.log(version());
|
|
27
43
|
```
|
|
28
44
|
|
|
29
45
|
### API
|
|
30
46
|
|
|
47
|
+
#### `convert(input: string, optionsJson?: string): string`
|
|
48
|
+
|
|
49
|
+
Auto-detect input format and convert between bitmark and JSON.
|
|
50
|
+
|
|
51
|
+
Options (passed as a JSON string):
|
|
52
|
+
- `mode` — `"optimized"` (default) or `"full"`
|
|
53
|
+
- `warnings` — include validation warnings (default: `false`)
|
|
54
|
+
- `plainText` — output text as plain text (default: `false`)
|
|
55
|
+
- `pretty` — prettify JSON output (default: `false`)
|
|
56
|
+
- `indent` — indent size for pretty JSON (default: `2`)
|
|
57
|
+
|
|
31
58
|
#### `parse(input: string): string`
|
|
32
59
|
|
|
33
60
|
Parse bitmark text and return the AST as a JSON string.
|
|
@@ -41,26 +68,80 @@ Stages:
|
|
|
41
68
|
- `"lex-bitmark"` — Bitmark structural tokens only
|
|
42
69
|
- `"lex-text"` — Text formatting tokens only
|
|
43
70
|
|
|
71
|
+
#### `breakscapeText(input: string, format?: string, location?: string): string`
|
|
72
|
+
|
|
73
|
+
Breakscape text (escape bitmark special characters).
|
|
74
|
+
|
|
75
|
+
- `format` — `"bitmark++"` (default) or `"plainText"`
|
|
76
|
+
- `location` — `"body"` (default) or `"tag"`
|
|
77
|
+
|
|
78
|
+
#### `unbreakscapeText(input: string, format?: string, location?: string): string`
|
|
79
|
+
|
|
80
|
+
Unbreakscape text (unescape bitmark special characters).
|
|
81
|
+
|
|
82
|
+
- `format` — `"bitmark++"` (default) or `"plainText"`
|
|
83
|
+
- `location` — `"body"` (default) or `"tag"`
|
|
84
|
+
|
|
85
|
+
#### `info(infoType?: string, format?: string, bit?: string, pretty?: boolean, indent?: number): string`
|
|
86
|
+
|
|
87
|
+
Query information about supported bit types.
|
|
88
|
+
|
|
89
|
+
- `infoType` — `"list"` (default), `"bit"`, `"all"`, or `"deprecated"`
|
|
90
|
+
- `format` — `"text"` (default) or `"json"`
|
|
91
|
+
- `bit` — filter to a specific bit type (when `infoType` is `"bit"`)
|
|
92
|
+
- `pretty` — prettify JSON output (default: `false`)
|
|
93
|
+
- `indent` — indent size for pretty JSON (default: `2`)
|
|
94
|
+
|
|
95
|
+
#### `version(): string`
|
|
96
|
+
|
|
97
|
+
Return the library version string.
|
|
98
|
+
|
|
44
99
|
#### `generate(json: string): string`
|
|
45
100
|
|
|
46
101
|
Generate bitmark text from JSON. **Not yet implemented** — throws an error.
|
|
47
102
|
|
|
48
103
|
## CLI
|
|
49
104
|
|
|
105
|
+
The CLI binary is `bitmark-parser-wasm`.
|
|
106
|
+
|
|
50
107
|
```bash
|
|
51
|
-
#
|
|
52
|
-
bitmark-parser
|
|
108
|
+
# Convert bitmark to JSON (auto-detects format)
|
|
109
|
+
bitmark-parser-wasm convert input.bitmark
|
|
110
|
+
bitmark-parser-wasm convert input.bitmark -o output.json
|
|
53
111
|
|
|
54
|
-
#
|
|
55
|
-
bitmark-parser
|
|
112
|
+
# Convert JSON to bitmark
|
|
113
|
+
bitmark-parser-wasm convert input.json -o output.bitmark
|
|
114
|
+
|
|
115
|
+
# Convert with options
|
|
116
|
+
bitmark-parser-wasm convert input.bitmark --mode full --pretty --warnings
|
|
117
|
+
|
|
118
|
+
# Parse a bitmark file to JSON
|
|
119
|
+
bitmark-parser-wasm parse input.bitmark
|
|
120
|
+
bitmark-parser-wasm parse input.bitmark -o output.json
|
|
121
|
+
bitmark-parser-wasm parse input.bitmark --mode full
|
|
56
122
|
|
|
57
123
|
# Lex instead of parse
|
|
58
|
-
bitmark-parser parse --stage=lex input.bitmark
|
|
124
|
+
bitmark-parser-wasm parse --stage=lex input.bitmark
|
|
59
125
|
|
|
60
126
|
# Available stages: all (default), lex, lex-bitmark, lex-text
|
|
61
|
-
bitmark-parser parse --stage=lex-bitmark input.bitmark
|
|
127
|
+
bitmark-parser-wasm parse --stage=lex-bitmark input.bitmark
|
|
128
|
+
|
|
129
|
+
# Breakscape / unbreakscape text
|
|
130
|
+
bitmark-parser-wasm breakscape input.txt
|
|
131
|
+
bitmark-parser-wasm breakscape input.txt --format plainText --location tag
|
|
132
|
+
bitmark-parser-wasm unbreakscape input.txt
|
|
133
|
+
|
|
134
|
+
# Query bit type information
|
|
135
|
+
bitmark-parser-wasm info
|
|
136
|
+
bitmark-parser-wasm info all -f json --pretty
|
|
137
|
+
bitmark-parser-wasm info bit --bit article
|
|
138
|
+
|
|
139
|
+
# Generate bitmark from JSON (not yet implemented)
|
|
140
|
+
bitmark-parser-wasm generate input.json output.bitmark
|
|
62
141
|
```
|
|
63
142
|
|
|
143
|
+
All commands support `-o, --output <file>` and `-a, --append` flags. Commands that accept input support file paths, literal strings, or stdin (when no arguments are given).
|
|
144
|
+
|
|
64
145
|
## Browser Usage
|
|
65
146
|
|
|
66
147
|
The package includes pre-built browser bundles with the WASM module.
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var t,d=0,m=null;function k(){return (m===null||m.byteLength===0)&&(m=new Uint8Array(t.memory.buffer)),m}var v=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},O=typeof v.encodeInto=="function"?function(e,
|
|
1
|
+
var t,d=0,m=null;function k(){return (m===null||m.byteLength===0)&&(m=new Uint8Array(t.memory.buffer)),m}var v=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},O=typeof v.encodeInto=="function"?function(e,r){return v.encodeInto(e,r)}:function(e,r){let _=v.encode(e);return r.set(_),{read:e.length,written:_.length}};function f(e,r,_){if(_===void 0){let i=v.encode(e),a=r(i.length,1)>>>0;return k().subarray(a,a+i.length).set(i),d=i.length,a}let o=e.length,s=r(o,1)>>>0,c=k(),n=0;for(;n<o;n++){let i=e.charCodeAt(n);if(i>127)break;c[s+n]=i;}if(n!==o){n!==0&&(e=e.slice(n)),s=_(s,o,o=n+e.length*3,1)>>>0;let i=k().subarray(s+n,s+o),a=O(e,i);n+=a.written,s=_(s,o,n,1)>>>0;}return d=n,s}var w=null;function b(){return (w===null||w.buffer.detached===true||w.buffer.detached===void 0&&w.buffer!==t.memory.buffer)&&(w=new DataView(t.memory.buffer)),w}var I=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:true,fatal:true}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&I.decode();function u(e,r){return e=e>>>0,I.decode(k().subarray(e,e+r))}function D(e,r,_){let o,s;try{let i=t.__wbindgen_add_to_stack_pointer(-16),a=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),p=d,g=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),l=d,x=f(_,t.__wbindgen_export_0,t.__wbindgen_export_1),y=d;t.breakscape_text(i,a,p,g,l,x,y);var c=b().getInt32(i+0,!0),n=b().getInt32(i+4,!0);return o=c,s=n,u(c,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(o,s,1);}}function R(e,r,_){let o,s;try{let i=t.__wbindgen_add_to_stack_pointer(-16),a=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),p=d,g=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),l=d,x=f(_,t.__wbindgen_export_0,t.__wbindgen_export_1),y=d;t.unbreakscape_text(i,a,p,g,l,x,y);var c=b().getInt32(i+0,!0),n=b().getInt32(i+4,!0);return o=c,s=n,u(c,n)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(o,s,1);}}function j(e,r){let _,o;try{let n=t.__wbindgen_add_to_stack_pointer(-16),i=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),a=d,p=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),g=d;t.parse(n,i,a,p,g);var s=b().getInt32(n+0,!0),c=b().getInt32(n+4,!0);return _=s,o=c,u(s,c)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(_,o,1);}}function U(e,r){let _,o;try{let n=t.__wbindgen_add_to_stack_pointer(-16),i=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),a=d,p=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),g=d;t.convert(n,i,a,p,g);var s=b().getInt32(n+0,!0),c=b().getInt32(n+4,!0);return _=s,o=c,u(s,c)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(_,o,1);}}function L(e,r,_,o,s){let c,n;try{let p=t.__wbindgen_add_to_stack_pointer(-16),g=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),l=d,x=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),y=d,W=f(_,t.__wbindgen_export_0,t.__wbindgen_export_1),M=d;t.info(p,g,l,x,y,W,M,o,s);var i=b().getInt32(p+0,!0),a=b().getInt32(p+4,!0);return c=i,n=a,u(i,a)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(c,n,1);}}function V(e,r){let _,o;try{let n=t.__wbindgen_add_to_stack_pointer(-16),i=f(e,t.__wbindgen_export_0,t.__wbindgen_export_1),a=d,p=f(r,t.__wbindgen_export_0,t.__wbindgen_export_1),g=d;t.lex(n,i,a,p,g);var s=b().getInt32(n+0,!0),c=b().getInt32(n+4,!0);return _=s,o=c,u(s,c)}finally{t.__wbindgen_add_to_stack_pointer(16),t.__wbindgen_export_2(_,o,1);}}async function C(e,r){if(typeof Response=="function"&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(e,r)}catch(o){if(e.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",o);else throw o}let _=await e.arrayBuffer();return await WebAssembly.instantiate(_,r)}else {let _=await WebAssembly.instantiate(e,r);return _ instanceof WebAssembly.Instance?{instance:_,module:e}:_}}function A(){let e={};return e.wbg={},e}function h(e,r){return t=e.exports,T.__wbindgen_wasm_module=r,w=null,m=null,t}function F(e){if(t!==void 0)return t;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module:e}=e:console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));let r=A();e instanceof WebAssembly.Module||(e=new WebAssembly.Module(e));let _=new WebAssembly.Instance(e,r);return h(_,e)}async function T(e){if(t!==void 0)return t;typeof e<"u"&&(Object.getPrototypeOf(e)===Object.prototype?{module_or_path:e}=e:console.warn("using deprecated parameters for the initialization function; pass a single object instead")),typeof e>"u"&&(e=new URL("bitmark_wasm_bg.wasm",import.meta.url));let r=A();(typeof e=="string"||typeof Request=="function"&&e instanceof Request||typeof URL=="function"&&e instanceof URL)&&(e=fetch(e));let{instance:_,module:o}=await C(await e,r);return h(_,o)}var q=T;export{D as breakscapeText,U as convert,L as info,q as init,F as initSync,V as lex,j as parse,R as unbreakscapeText};//# sourceMappingURL=bitmark-parser.min.js.map
|
|
2
2
|
//# sourceMappingURL=bitmark-parser.min.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../wasm-web/bitmark_wasm.js"],"names":["wasm","WASM_VECTOR_LEN","cachedUint8ArrayMemory0","getUint8ArrayMemory0","cachedTextEncoder","encodeString","arg","view","buf","passStringToWasm0","malloc","realloc","ptr","len","mem","offset","code","ret","cachedDataViewMemory0","getDataViewMemory0","cachedTextDecoder","getStringFromWasm0","breakscape_text","input","format","location","deferred4_0","deferred4_1","retptr","ptr0","len0","ptr1","len1","ptr2","len2","r0","r1","unbreakscape_text","parse","deferred2_0","deferred2_1","convert","options_json","deferred3_0","deferred3_1","info","info_type","bit","pretty","indent","lex","stage","__wbg_load","module","imports","e","bytes","instance","__wbg_get_imports","__wbg_finalize_init","__wbg_init","initSync","module_or_path","bitmark_wasm_default"],"mappings":"AAAA,IAAIA,CAAAA,CAEAC,CAAAA,CAAkB,CAAA,CAElBC,CAAAA,CAA0B,IAAA,CAE9B,SAASC,CAAAA,EAAuB,CAC5B,OAAA,CAAID,CAAAA,GAA4B,IAAA,EAAQA,CAAAA,CAAwB,UAAA,GAAe,CAAA,IAC3EA,CAAAA,CAA0B,IAAI,UAAA,CAAWF,CAAAA,CAAK,MAAA,CAAO,MAAM,CAAA,CAAA,CAExDE,CACX,CAEA,IAAME,CAAAA,CAAqB,OAAO,WAAA,CAAgB,GAAA,CAAc,IAAI,WAAA,CAAY,OAAO,CAAA,CAAI,CAAE,MAAA,CAAQ,IAAM,CAAE,MAAM,KAAA,CAAM,2BAA2B,CAAE,CAAE,CAAA,CAElJC,CAAAA,CAAgB,OAAOD,CAAAA,CAAkB,YAAe,UAAA,CACxD,SAAUE,CAAAA,CA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CAAQ,IAAA,CAAK,2FAA2F,GAI5G,OAAOA,CAAAA,CAAmB,GAAA,GAC1BA,CAAAA,CAAiB,IAAI,GAAA,CAAI,sBAAA,CAAwB,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA,CAAA,CAEpE,IAAMR,CAAAA,CAAUI,CAAAA,EAAkB,CAAA,CAE9B,OAAOI,CAAAA,EAAmB,UAAa,OAAO,OAAA,EAAY,UAAA,EAAcA,CAAAA,YAA0B,OAAA,EAAa,OAAO,GAAA,EAAQ,UAAA,EAAcA,CAAAA,YAA0B,GAAA,IACtKA,CAAAA,CAAiB,KAAA,CAAMA,CAAc,CAAA,CAAA,CAKzC,GAAM,CAAE,SAAAL,CAAAA,CAAU,MAAA,CAAAJ,CAAO,CAAA,CAAI,MAAMD,CAAAA,CAAW,MAAMU,CAAAA,CAAgBR,CAAO,CAAA,CAE3E,OAAOK,CAAAA,CAAoBF,CAAAA,CAAUJ,CAAM,CAC/C,KAGOU,CAAAA,CAAQH","file":"bitmark-parser.min.js","sourcesContent":["let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize with optimized mode.\n * @param {string} input\n * @returns {string}\n */\nexport function parse(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * - `\"warnings\"`: `true` or `false` (default)\n * - `\"plainText\"`: `true` or `false` (default)\n * - `\"pretty\"`: `true` or `false` (default)\n * - `\"indent\"`: number (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function convert(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `stage` selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} stage\n * @returns {string}\n */\nexport function lex(input, stage) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"]}
|
|
1
|
+
{"version":3,"sources":["../../wasm-web/bitmark_wasm.js"],"names":["wasm","WASM_VECTOR_LEN","cachedUint8ArrayMemory0","getUint8ArrayMemory0","cachedTextEncoder","encodeString","arg","view","buf","passStringToWasm0","malloc","realloc","ptr","len","mem","offset","code","ret","cachedDataViewMemory0","getDataViewMemory0","cachedTextDecoder","getStringFromWasm0","breakscape_text","input","format","location","deferred4_0","deferred4_1","retptr","ptr0","len0","ptr1","len1","ptr2","len2","r0","r1","unbreakscape_text","parse","options_json","deferred3_0","deferred3_1","convert","info","info_type","bit","pretty","indent","lex","__wbg_load","module","imports","e","bytes","instance","__wbg_get_imports","__wbg_finalize_init","__wbg_init","initSync","module_or_path","bitmark_wasm_default"],"mappings":"AAAA,IAAIA,CAAAA,CAEAC,CAAAA,CAAkB,CAAA,CAElBC,CAAAA,CAA0B,IAAA,CAE9B,SAASC,CAAAA,EAAuB,CAC5B,OAAA,CAAID,CAAAA,GAA4B,IAAA,EAAQA,CAAAA,CAAwB,aAAe,CAAA,IAC3EA,CAAAA,CAA0B,IAAI,UAAA,CAAWF,CAAAA,CAAK,MAAA,CAAO,MAAM,CAAA,CAAA,CAExDE,CACX,CAEA,IAAME,CAAAA,CAAqB,OAAO,WAAA,CAAgB,GAAA,CAAc,IAAI,YAAY,OAAO,CAAA,CAAI,CAAE,MAAA,CAAQ,IAAM,CAAE,MAAM,KAAA,CAAM,2BAA2B,CAAE,CAAE,CAAA,CAElJC,CAAAA,CAAgB,OAAOD,CAAAA,CAAkB,UAAA,EAAe,WACxD,SAAUE,CAAAA,CAAKC,CAAAA,CAAM,CACvB,OAAOH,CAAAA,CAAkB,UAAA,CAAWE,CAAAA,CAAKC,CAAI,CACjD,CAAA,CACM,SAAUD,CAAAA,CAAKC,CAAAA,CAAM,CACvB,IAAMC,EAAMJ,CAAAA,CAAkB,MAAA,CAAOE,CAAG,CAAA,CACxC,OAAAC,CAAAA,CAAK,GAAA,CAAIC,CAAG,CAAA,CACL,CACH,IAAA,CAAMF,CAAAA,CAAI,MAAA,CACV,OAAA,CAASE,CAAAA,CAAI,MACjB,CACJ,CAAA,CAEA,SAASC,CAAAA,CAAkBH,CAAAA,CAAKI,CAAAA,CAAQC,CAAAA,CAAS,CAE7C,GAAIA,CAAAA,GAAY,MAAA,CAAW,CACvB,IAAMH,CAAAA,CAAMJ,CAAAA,CAAkB,MAAA,CAAOE,CAAG,EAClCM,CAAAA,CAAMF,CAAAA,CAAOF,CAAAA,CAAI,MAAA,CA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AAc,CAAA,CAAA,CAKzC,GAAM,CAAE,QAAA,CAAAL,CAAAA,CAAU,MAAA,CAAAJ,CAAO,CAAA,CAAI,MAAMD,CAAAA,CAAW,MAAMU,EAAgBR,CAAO,CAAA,CAE3E,OAAOK,CAAAA,CAAoBF,CAAAA,CAAUJ,CAAM,CAC/C,KAGOU,CAAAA,CAAQH","file":"bitmark-parser.min.js","sourcesContent":["let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function parse(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * - `\"warnings\"`: `true` or `false` (default)\n * - `\"plainText\"`: `true` or `false` (default)\n * - `\"pretty\"`: `true` or `false` (default)\n * - `\"indent\"`: number (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function convert(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"stage\"`: selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function lex(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"]}
|
|
Binary file
|
|
Binary file
|
|
@@ -149,22 +149,24 @@ function unbreakscape_text(input, format, location) {
|
|
|
149
149
|
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
150
150
|
}
|
|
151
151
|
}
|
|
152
|
-
function parse(input) {
|
|
153
|
-
let
|
|
154
|
-
let
|
|
152
|
+
function parse(input, options_json) {
|
|
153
|
+
let deferred3_0;
|
|
154
|
+
let deferred3_1;
|
|
155
155
|
try {
|
|
156
156
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
157
157
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
158
158
|
const len0 = WASM_VECTOR_LEN;
|
|
159
|
-
|
|
159
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
160
|
+
const len1 = WASM_VECTOR_LEN;
|
|
161
|
+
wasm.parse(retptr, ptr0, len0, ptr1, len1);
|
|
160
162
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
161
163
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
162
|
-
|
|
163
|
-
|
|
164
|
+
deferred3_0 = r0;
|
|
165
|
+
deferred3_1 = r1;
|
|
164
166
|
return getStringFromWasm0(r0, r1);
|
|
165
167
|
} finally {
|
|
166
168
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
167
|
-
wasm.__wbindgen_export_2(
|
|
169
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
168
170
|
}
|
|
169
171
|
}
|
|
170
172
|
function convert(input, options_json) {
|
|
@@ -209,14 +211,14 @@ function info(info_type, format, bit, pretty, indent) {
|
|
|
209
211
|
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
210
212
|
}
|
|
211
213
|
}
|
|
212
|
-
function lex(input,
|
|
214
|
+
function lex(input, options_json) {
|
|
213
215
|
let deferred3_0;
|
|
214
216
|
let deferred3_1;
|
|
215
217
|
try {
|
|
216
218
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
217
219
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
218
220
|
const len0 = WASM_VECTOR_LEN;
|
|
219
|
-
const ptr1 = passStringToWasm0(
|
|
221
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
220
222
|
const len1 = WASM_VECTOR_LEN;
|
|
221
223
|
wasm.lex(retptr, ptr0, len0, ptr1, len1);
|
|
222
224
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/browser/index.ts","../../../../../node_modules/tsup/assets/cjs_shims.js","../../../wasm-web/bitmark_wasm.js"],"sourcesContent":["// This is a browser entry point that wraps the wasm-web bindings.\n// It re-exports all WASM functions so browser consumers can use:\n// import { parse, convert, ... } from '@gmb/bitmark-parser/browser'\n\nexport { convert, breakscape_text as breakscapeText, unbreakscape_text as unbreakscapeText, parse, lex, info } from \"../../wasm-web/bitmark_wasm.js\";\n\nexport { default as init, initSync } from \"../../wasm-web/bitmark_wasm.js\";\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize with optimized mode.\n * @param {string} input\n * @returns {string}\n */\nexport function parse(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * - `\"warnings\"`: `true` or `false` (default)\n * - `\"plainText\"`: `true` or `false` (default)\n * - `\"pretty\"`: `true` or `false` (default)\n * - `\"indent\"`: number (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function convert(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `stage` selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} stage\n * @returns {string}\n */\nexport function lex(input, stage) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ACZ9D,IAAI;AAEJ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I;AAAA,IACxB,OAAO;AACH,cAAQ,KAAK,2FAA2F;AAAA,IAC5G;AAAA,EACJ;AAEA,MAAI,OAAO,mBAAmB,aAAa;AACvC,qBAAiB,IAAI,IAAI,wBAAwB,aAAe;AAAA,EACpE;AACA,QAAM,UAAU,kBAAkB;AAElC,MAAI,OAAO,mBAAmB,YAAa,OAAO,YAAY,cAAc,0BAA0B,WAAa,OAAO,QAAQ,cAAc,0BAA0B,KAAM;AAC5K,qBAAiB,MAAM,cAAc;AAAA,EACzC;AAEA,oBAAkB,OAAO;AAEzB,QAAM,EAAE,UAAU,QAAAA,QAAO,IAAI,MAAM,WAAW,MAAM,gBAAgB,OAAO;AAE3E,SAAO,oBAAoB,UAAUA,OAAM;AAC/C;AAGA,IAAO,uBAAQ;","names":["ptr","module"]}
|
|
1
|
+
{"version":3,"sources":["../../../src/browser/index.ts","../../../../../node_modules/tsup/assets/cjs_shims.js","../../../wasm-web/bitmark_wasm.js"],"sourcesContent":["// This is a browser entry point that wraps the wasm-web bindings.\n// It re-exports all WASM functions so browser consumers can use:\n// import { parse, convert, ... } from '@gmb/bitmark-parser/browser'\n\nexport { convert, breakscape_text as breakscapeText, unbreakscape_text as unbreakscapeText, parse, lex, info } from \"../../wasm-web/bitmark_wasm.js\";\n\nexport { default as init, initSync } from \"../../wasm-web/bitmark_wasm.js\";\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function parse(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * - `\"warnings\"`: `true` or `false` (default)\n * - `\"plainText\"`: `true` or `false` (default)\n * - `\"pretty\"`: `true` or `false` (default)\n * - `\"indent\"`: number (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function convert(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"stage\"`: selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function lex(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACKA,IAAM,mBAAmB,MACvB,OAAO,aAAa,cAChB,IAAI,IAAI,QAAQ,UAAU,EAAE,EAAE,OAC7B,SAAS,iBAAiB,SAAS,cAAc,QAAQ,YAAY,MAAM,WAC1E,SAAS,cAAc,MACvB,IAAI,IAAI,WAAW,SAAS,OAAO,EAAE;AAEtC,IAAM,gBAAgC,iCAAiB;;;ACZ9D,IAAI;AAEJ,IAAI,kBAAkB;AAEtB,IAAI,0BAA0B;AAE9B,SAAS,uBAAuB;AAC5B,MAAI,4BAA4B,QAAQ,wBAAwB,eAAe,GAAG;AAC9E,8BAA0B,IAAI,WAAW,KAAK,OAAO,MAAM;AAAA,EAC/D;AACA,SAAO;AACX;AAEA,IAAM,oBAAqB,OAAO,gBAAgB,cAAc,IAAI,YAAY,OAAO,IAAI,EAAE,QAAQ,MAAM;AAAE,QAAM,MAAM,2BAA2B;AAAE,EAAE;AAExJ,IAAM,eAAgB,OAAO,kBAAkB,eAAe,aACxD,SAAU,KAAK,MAAM;AACvB,SAAO,kBAAkB,WAAW,KAAK,IAAI;AACjD,IACM,SAAU,KAAK,MAAM;AACvB,QAAM,MAAM,kBAAkB,OAAO,GAAG;AACxC,OAAK,IA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AW,MAAM,gBAAgB,OAAO;AAE3E,SAAO,oBAAoB,UAAUA,OAAM;AAC/C;AAGA,IAAO,uBAAQ;","names":["ptr","module"]}
|
|
@@ -17,9 +17,12 @@ declare function unbreakscape_text(input: string, format: string, location: stri
|
|
|
17
17
|
/**
|
|
18
18
|
* Parse bitmark input text and return the reference JSON format.
|
|
19
19
|
*
|
|
20
|
-
* Uses the full pipeline: parse → validate → serialize
|
|
20
|
+
* Uses the full pipeline: parse → validate → serialize.
|
|
21
|
+
*
|
|
22
|
+
* `options_json` is a JSON string with optional fields:
|
|
23
|
+
* - `"mode"`: `"optimized"` (default) or `"full"`
|
|
21
24
|
*/
|
|
22
|
-
declare function parse(input: string): string;
|
|
25
|
+
declare function parse(input: string, options_json: string): string;
|
|
23
26
|
/**
|
|
24
27
|
* Auto-detect input format and convert between bitmark and JSON.
|
|
25
28
|
*
|
|
@@ -48,15 +51,16 @@ declare function info(info_type: string, format: string, bit: string, pretty: bo
|
|
|
48
51
|
* Lex bitmark input text, returning one line per token in the same format as
|
|
49
52
|
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
50
53
|
*
|
|
51
|
-
* `
|
|
52
|
-
* - `"
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
54
|
+
* `options_json` is a JSON string with optional fields:
|
|
55
|
+
* - `"stage"`: selects the lexer pipeline:
|
|
56
|
+
* - `"lex"` — combined (default)
|
|
57
|
+
* - `"lex-bitmark"` — bitmark-level only
|
|
58
|
+
* - `"lex-text"` — text-level only
|
|
59
|
+
* - `"lex-json"` — combined, JSON array output
|
|
60
|
+
* - `"lex-bitmark-json"` — bitmark-level, JSON array output
|
|
61
|
+
* - `"lex-text-json"` — text-level, JSON array output
|
|
58
62
|
*/
|
|
59
|
-
declare function lex(input: string,
|
|
63
|
+
declare function lex(input: string, options_json: string): string;
|
|
60
64
|
|
|
61
65
|
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
62
66
|
|
|
@@ -66,7 +70,7 @@ interface InitOutput {
|
|
|
66
70
|
readonly convert: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
67
71
|
readonly info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
68
72
|
readonly lex: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
69
|
-
readonly parse: (a: number, b: number, c: number) => void;
|
|
73
|
+
readonly parse: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
70
74
|
readonly unbreakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
71
75
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
72
76
|
readonly __wbindgen_export_0: (a: number, b: number) => number;
|
|
Binary file
|
|
@@ -17,9 +17,12 @@ declare function unbreakscape_text(input: string, format: string, location: stri
|
|
|
17
17
|
/**
|
|
18
18
|
* Parse bitmark input text and return the reference JSON format.
|
|
19
19
|
*
|
|
20
|
-
* Uses the full pipeline: parse → validate → serialize
|
|
20
|
+
* Uses the full pipeline: parse → validate → serialize.
|
|
21
|
+
*
|
|
22
|
+
* `options_json` is a JSON string with optional fields:
|
|
23
|
+
* - `"mode"`: `"optimized"` (default) or `"full"`
|
|
21
24
|
*/
|
|
22
|
-
declare function parse(input: string): string;
|
|
25
|
+
declare function parse(input: string, options_json: string): string;
|
|
23
26
|
/**
|
|
24
27
|
* Auto-detect input format and convert between bitmark and JSON.
|
|
25
28
|
*
|
|
@@ -48,15 +51,16 @@ declare function info(info_type: string, format: string, bit: string, pretty: bo
|
|
|
48
51
|
* Lex bitmark input text, returning one line per token in the same format as
|
|
49
52
|
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
50
53
|
*
|
|
51
|
-
* `
|
|
52
|
-
* - `"
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
54
|
+
* `options_json` is a JSON string with optional fields:
|
|
55
|
+
* - `"stage"`: selects the lexer pipeline:
|
|
56
|
+
* - `"lex"` — combined (default)
|
|
57
|
+
* - `"lex-bitmark"` — bitmark-level only
|
|
58
|
+
* - `"lex-text"` — text-level only
|
|
59
|
+
* - `"lex-json"` — combined, JSON array output
|
|
60
|
+
* - `"lex-bitmark-json"` — bitmark-level, JSON array output
|
|
61
|
+
* - `"lex-text-json"` — text-level, JSON array output
|
|
58
62
|
*/
|
|
59
|
-
declare function lex(input: string,
|
|
63
|
+
declare function lex(input: string, options_json: string): string;
|
|
60
64
|
|
|
61
65
|
type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
62
66
|
|
|
@@ -66,7 +70,7 @@ interface InitOutput {
|
|
|
66
70
|
readonly convert: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
67
71
|
readonly info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
68
72
|
readonly lex: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
69
|
-
readonly parse: (a: number, b: number, c: number) => void;
|
|
73
|
+
readonly parse: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
70
74
|
readonly unbreakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
71
75
|
readonly __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
72
76
|
readonly __wbindgen_export_0: (a: number, b: number) => number;
|
|
@@ -112,22 +112,24 @@ function unbreakscape_text(input, format, location) {
|
|
|
112
112
|
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
function parse(input) {
|
|
116
|
-
let
|
|
117
|
-
let
|
|
115
|
+
function parse(input, options_json) {
|
|
116
|
+
let deferred3_0;
|
|
117
|
+
let deferred3_1;
|
|
118
118
|
try {
|
|
119
119
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
120
120
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
121
121
|
const len0 = WASM_VECTOR_LEN;
|
|
122
|
-
|
|
122
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
123
|
+
const len1 = WASM_VECTOR_LEN;
|
|
124
|
+
wasm.parse(retptr, ptr0, len0, ptr1, len1);
|
|
123
125
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
124
126
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
125
|
-
|
|
126
|
-
|
|
127
|
+
deferred3_0 = r0;
|
|
128
|
+
deferred3_1 = r1;
|
|
127
129
|
return getStringFromWasm0(r0, r1);
|
|
128
130
|
} finally {
|
|
129
131
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
130
|
-
wasm.__wbindgen_export_2(
|
|
132
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
131
133
|
}
|
|
132
134
|
}
|
|
133
135
|
function convert(input, options_json) {
|
|
@@ -172,14 +174,14 @@ function info(info_type, format, bit, pretty, indent) {
|
|
|
172
174
|
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
173
175
|
}
|
|
174
176
|
}
|
|
175
|
-
function lex(input,
|
|
177
|
+
function lex(input, options_json) {
|
|
176
178
|
let deferred3_0;
|
|
177
179
|
let deferred3_1;
|
|
178
180
|
try {
|
|
179
181
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
180
182
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
181
183
|
const len0 = WASM_VECTOR_LEN;
|
|
182
|
-
const ptr1 = passStringToWasm0(
|
|
184
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
183
185
|
const len1 = WASM_VECTOR_LEN;
|
|
184
186
|
wasm.lex(retptr, ptr0, len0, ptr1, len1);
|
|
185
187
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../wasm-web/bitmark_wasm.js"],"sourcesContent":["let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize with optimized mode.\n * @param {string} input\n * @returns {string}\n */\nexport function parse(input) {\n let deferred2_0;\n let deferred2_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred2_0 = r0;\n deferred2_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred2_0, deferred2_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * - `\"warnings\"`: `true` or `false` (default)\n * - `\"plainText\"`: `true` or `false` (default)\n * - `\"pretty\"`: `true` or `false` (default)\n * - `\"indent\"`: number (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function convert(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `stage` selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} stage\n * @returns {string}\n */\nexport function lex(input, stage) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"mappings":";AAAA,IAAI;AAEJ,IAAI,kBAAkB;AAEtB,IAAI,0BAA0B;AAE9B,SAAS,uBAAuB;AAC5B,MAAI,4BAA4B,QAAQ,wBAAwB,eAAe,GAAG;AAC9E,8BAA0B,IAAI,WAAW,KAAK,OAAO,MAAM;AAAA,EAC/D;AACA,SAAO;AACX;AAEA,IAAM,oBAAqB,OAAO,gBAAgB,cAAc,IAAI,YAAY,OAAO,IAAI,EAAE,QAAQ,MAAM;AAAE,QAAM,MAAM,2BAA2B;AAAE,EAAE;AAExJ,IAAM,eAAgB,OAAO,kBAAkB,eAAe,aACxD,SAAU,KAAK,MAAM;AACvB,SAAO,kBAAkB,WAAW,KAAK,IAAI;AACjD,IACM,SAAU,KAAK,MAAM;AACvB,QAAM,MAAM,kBAAkB,OAAO,GAAG;AACxC,OAAK,IAAI,GAAG;AACZ,SAAO;AAAA,IACH,MAAM,IAAI;AAAA,IACV,SAAS,IAAI;AAAA,EACjB;AACJ;AAEA,SAAS,kBAAkB,KAAK,QAAQ,SAAS;AAE7C,MAAI,YAAY,QAAW;AACvB,UAAM,MAAM,kBAAkB,OAAO,GAAG;AACxC,UAAMA,OAAM,OAAO,IAAI,QAAQ,CAAC,MAAM;AACtC,yBAAqB,EAAE,SAASA,MAAKA,OAAM,IAAI,MAAM,EAAE,IAAI,GAAG;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AEA,QAAM,UAAU,kBAAkB;AAElC,oBAAkB,OAAO;AAEzB,MAAI,EAAE,kBAAkB,YAAY,SAAS;AACzC,aAAS,IAAI,YAAY,OAAO,MAAM;AAAA,EAC1C;AAEA,QAAM,WAAW,IAAI,YAAY,SAAS,QAAQ,OAAO;AAEzD,SAAO,oBAAoB,UAAU,MAAM;AAC/C;AAEA,eAAe,WAAW,gBAAgB;AACtC,MAAI,SAAS,OAAW,QAAO;AAG/B,MAAI,OAAO,mBAAmB,aAAa;AACvC,QAAI,OAAO,eAAe,cAAc,MAAM,OAAO,WAAW;AAC5D,OAAC,EAAC,eAAc,IAAI;AAAA,IACxB,OAAO;AACH,cAAQ,KAAK,2FAA2F;AAAA,IAC5G;AAAA,EACJ;AAEA,MAAI,OAAO,mBAAmB,aAAa;AACvC,qBAAiB,IAAI,IAAI,wBAAwB,YAAY,GAAG;AAAA,EACpE;AACA,QAAM,UAAU,kBAAkB;AAElC,MAAI,OAAO,mBAAmB,YAAa,OAAO,YAAY,cAAc,0BAA0B,WAAa,OAAO,QAAQ,cAAc,0BAA0B,KAAM;AAC5K,qBAAiB,MAAM,cAAc;AAAA,EACzC;AAEA,oBAAkB,OAAO;AAEzB,QAAM,EAAE,UAAU,OAAO,IAAI,MAAM,WAAW,MAAM,gBAAgB,OAAO;AAE3E,SAAO,oBAAoB,UAAU,MAAM;AAC/C;AAGA,IAAO,uBAAQ;","names":["ptr"]}
|
|
1
|
+
{"version":3,"sources":["../../../wasm-web/bitmark_wasm.js"],"sourcesContent":["let wasm;\n\nlet WASM_VECTOR_LEN = 0;\n\nlet cachedUint8ArrayMemory0 = null;\n\nfunction getUint8ArrayMemory0() {\n if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {\n cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);\n }\n return cachedUint8ArrayMemory0;\n}\n\nconst cachedTextEncoder = (typeof TextEncoder !== 'undefined' ? new TextEncoder('utf-8') : { encode: () => { throw Error('TextEncoder not available') } } );\n\nconst encodeString = (typeof cachedTextEncoder.encodeInto === 'function'\n ? function (arg, view) {\n return cachedTextEncoder.encodeInto(arg, view);\n}\n : function (arg, view) {\n const buf = cachedTextEncoder.encode(arg);\n view.set(buf);\n return {\n read: arg.length,\n written: buf.length\n };\n});\n\nfunction passStringToWasm0(arg, malloc, realloc) {\n\n if (realloc === undefined) {\n const buf = cachedTextEncoder.encode(arg);\n const ptr = malloc(buf.length, 1) >>> 0;\n getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);\n WASM_VECTOR_LEN = buf.length;\n return ptr;\n }\n\n let len = arg.length;\n let ptr = malloc(len, 1) >>> 0;\n\n const mem = getUint8ArrayMemory0();\n\n let offset = 0;\n\n for (; offset < len; offset++) {\n const code = arg.charCodeAt(offset);\n if (code > 0x7F) break;\n mem[ptr + offset] = code;\n }\n\n if (offset !== len) {\n if (offset !== 0) {\n arg = arg.slice(offset);\n }\n ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;\n const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);\n const ret = encodeString(arg, view);\n\n offset += ret.written;\n ptr = realloc(ptr, len, offset, 1) >>> 0;\n }\n\n WASM_VECTOR_LEN = offset;\n return ptr;\n}\n\nlet cachedDataViewMemory0 = null;\n\nfunction getDataViewMemory0() {\n if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {\n cachedDataViewMemory0 = new DataView(wasm.memory.buffer);\n }\n return cachedDataViewMemory0;\n}\n\nconst cachedTextDecoder = (typeof TextDecoder !== 'undefined' ? new TextDecoder('utf-8', { ignoreBOM: true, fatal: true }) : { decode: () => { throw Error('TextDecoder not available') } } );\n\nif (typeof TextDecoder !== 'undefined') { cachedTextDecoder.decode(); };\n\nfunction getStringFromWasm0(ptr, len) {\n ptr = ptr >>> 0;\n return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));\n}\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function breakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * `format`: `\"bitmark++\"` (default) or `\"plainText\"`\n * `location`: `\"body\"` (default) or `\"tag\"`\n * @param {string} input\n * @param {string} format\n * @param {string} location\n * @returns {string}\n */\nexport function unbreakscape_text(input, format, location) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * Uses the full pipeline: parse → validate → serialize.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function parse(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.parse(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"mode\"`: `\"optimized\"` (default) or `\"full\"`\n * - `\"warnings\"`: `true` or `false` (default)\n * - `\"plainText\"`: `true` or `false` (default)\n * - `\"pretty\"`: `true` or `false` (default)\n * - `\"indent\"`: number (default: 2)\n *\n * Returns JSON if input is bitmark, or an error message if input is JSON\n * (generator not yet implemented).\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function convert(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.convert(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\n/**\n * Query information about supported bit types.\n *\n * `info_type`: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`\n * `format`: `\"text\"` or `\"json\"`\n * `bit`: bit name (required when `info_type` is `\"bit\"`)\n * `pretty`: whether to pretty-print JSON output\n * `indent`: indent size for pretty-printing (default: 2)\n * @param {string} info_type\n * @param {string} format\n * @param {string} bit\n * @param {boolean} pretty\n * @param {number} indent\n * @returns {string}\n */\nexport function info(info_type, format, bit, pretty, indent) {\n let deferred4_0;\n let deferred4_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len2 = WASM_VECTOR_LEN;\n wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred4_0 = r0;\n deferred4_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);\n }\n}\n\n/**\n * Lex bitmark input text, returning one line per token in the same format as\n * the Rust CLI: `{kind:?} {span:?} \"{text}\"`.\n *\n * `options_json` is a JSON string with optional fields:\n * - `\"stage\"`: selects the lexer pipeline:\n * - `\"lex\"` — combined (default)\n * - `\"lex-bitmark\"` — bitmark-level only\n * - `\"lex-text\"` — text-level only\n * - `\"lex-json\"` — combined, JSON array output\n * - `\"lex-bitmark-json\"` — bitmark-level, JSON array output\n * - `\"lex-text-json\"` — text-level, JSON array output\n * @param {string} input\n * @param {string} options_json\n * @returns {string}\n */\nexport function lex(input, options_json) {\n let deferred3_0;\n let deferred3_1;\n try {\n const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);\n const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len0 = WASM_VECTOR_LEN;\n const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);\n const len1 = WASM_VECTOR_LEN;\n wasm.lex(retptr, ptr0, len0, ptr1, len1);\n var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);\n var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);\n deferred3_0 = r0;\n deferred3_1 = r1;\n return getStringFromWasm0(r0, r1);\n } finally {\n wasm.__wbindgen_add_to_stack_pointer(16);\n wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);\n }\n}\n\nasync function __wbg_load(module, imports) {\n if (typeof Response === 'function' && module instanceof Response) {\n if (typeof WebAssembly.instantiateStreaming === 'function') {\n try {\n return await WebAssembly.instantiateStreaming(module, imports);\n\n } catch (e) {\n if (module.headers.get('Content-Type') != 'application/wasm') {\n console.warn(\"`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\\n\", e);\n\n } else {\n throw e;\n }\n }\n }\n\n const bytes = await module.arrayBuffer();\n return await WebAssembly.instantiate(bytes, imports);\n\n } else {\n const instance = await WebAssembly.instantiate(module, imports);\n\n if (instance instanceof WebAssembly.Instance) {\n return { instance, module };\n\n } else {\n return instance;\n }\n }\n}\n\nfunction __wbg_get_imports() {\n const imports = {};\n imports.wbg = {};\n\n return imports;\n}\n\nfunction __wbg_init_memory(imports, memory) {\n\n}\n\nfunction __wbg_finalize_init(instance, module) {\n wasm = instance.exports;\n __wbg_init.__wbindgen_wasm_module = module;\n cachedDataViewMemory0 = null;\n cachedUint8ArrayMemory0 = null;\n\n\n\n return wasm;\n}\n\nfunction initSync(module) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module !== 'undefined') {\n if (Object.getPrototypeOf(module) === Object.prototype) {\n ({module} = module)\n } else {\n console.warn('using deprecated parameters for `initSync()`; pass a single object instead')\n }\n }\n\n const imports = __wbg_get_imports();\n\n __wbg_init_memory(imports);\n\n if (!(module instanceof WebAssembly.Module)) {\n module = new WebAssembly.Module(module);\n }\n\n const instance = new WebAssembly.Instance(module, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nasync function __wbg_init(module_or_path) {\n if (wasm !== undefined) return wasm;\n\n\n if (typeof module_or_path !== 'undefined') {\n if (Object.getPrototypeOf(module_or_path) === Object.prototype) {\n ({module_or_path} = module_or_path)\n } else {\n console.warn('using deprecated parameters for the initialization function; pass a single object instead')\n }\n }\n\n if (typeof module_or_path === 'undefined') {\n module_or_path = new URL('bitmark_wasm_bg.wasm', import.meta.url);\n }\n const imports = __wbg_get_imports();\n\n if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {\n module_or_path = fetch(module_or_path);\n }\n\n __wbg_init_memory(imports);\n\n const { instance, module } = await __wbg_load(await module_or_path, imports);\n\n return __wbg_finalize_init(instance, module);\n}\n\nexport { initSync };\nexport default __wbg_init;\n"],"mappings":";AAAA,IAAI;AAEJ,IAAI,kBAAkB;AAEtB,IAAI,0BAA0B;AAE9B,SAAS,uBAAuB;AAC5B,MAAI,4BAA4B,QAAQ,wBAAwB,eAAe,GAAG;AAC9E,8BAA0B,IAAI,WAAW,KAAK,OAAO,MAAM;AAAA,EAC/D;AACA,SAAO;AACX;AAEA,IAAM,oBAAqB,OAAO,gBAAgB,cAAc,IAAI,YAAY,OAAO,IAAI,EAAE,QAAQ,MAAM;AAAE,QAAM,MAAM,2BAA2B;AAAE,EAAE;AAExJ,IAAM,eAAgB,OAAO,kBAAkB,eAAe,aACxD,SAAU,KAAK,MAAM;AACvB,SAAO,kBAAkB,WAAW,KAAK,IAAI;AACjD,IACM,SAAU,KAAK,MAAM;AACvB,QAAM,MAAM,kBAAkB,OAAO,GAAG;AACxC,OAAK,IAAI,GAAG;AACZ,SAAO;AAAA,IACH,MAAM,IAAI;AAAA,IACV,SAAS,IAAI;AAAA,EACjB;AACJ;AAEA,SAAS,kBAAkB,KAAK,QAAQ,SAAS;AAE7C,MAAI,YAAY,QAAW;AACvB,UAAM,MAAM,kBAAkB,OAAO,GAAG;AACxC,UAAMA,OAAM,OAAO,IAAI,QAAQ,CAAC,MAAM;AACtC,yBAAqB,EAAE,SAASA,MAAKA,OAAM,IAAI,MAAM,EAAE,IAAI,GAAG;AAC9D,sBAAkB,IAAI;AACtB,WAAOA;AAAA,EACX;AAEA,MAAI,MAAM,IAAI;AACd,MAAI,MAAM,OAAO,KAAK,CAAC,MAAM;AAE7B,QAAM,MAAM,qBAAqB;AAEjC,MAAI,SAAS;AAEb,SAAO,SAAS,KAAK,UAAU;AAC3B,UAAM,O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AAY,OAAO,MAAM;AAAA,EAC1C;AAEA,QAAM,WAAW,IAAI,YAAY,SAAS,QAAQ,OAAO;AAEzD,SAAO,oBAAoB,UAAU,MAAM;AAC/C;AAEA,eAAe,WAAW,gBAAgB;AACtC,MAAI,SAAS,OAAW,QAAO;AAG/B,MAAI,OAAO,mBAAmB,aAAa;AACvC,QAAI,OAAO,eAAe,cAAc,MAAM,OAAO,WAAW;AAC5D,OAAC,EAAC,eAAc,IAAI;AAAA,IACxB,OAAO;AACH,cAAQ,KAAK,2FAA2F;AAAA,IAC5G;AAAA,EACJ;AAEA,MAAI,OAAO,mBAAmB,aAAa;AACvC,qBAAiB,IAAI,IAAI,wBAAwB,YAAY,GAAG;AAAA,EACpE;AACA,QAAM,UAAU,kBAAkB;AAElC,MAAI,OAAO,mBAAmB,YAAa,OAAO,YAAY,cAAc,0BAA0B,WAAa,OAAO,QAAQ,cAAc,0BAA0B,KAAM;AAC5K,qBAAiB,MAAM,cAAc;AAAA,EACzC;AAEA,oBAAkB,OAAO;AAEzB,QAAM,EAAE,UAAU,OAAO,IAAI,MAAM,WAAW,MAAM,gBAAgB,OAAO;AAE3E,SAAO,oBAAoB,UAAU,MAAM;AAC/C;AAGA,IAAO,uBAAQ;","names":["ptr"]}
|
package/dist/cli.js
CHANGED
|
@@ -6,11 +6,14 @@ import { dirname } from 'path';
|
|
|
6
6
|
|
|
7
7
|
// src/generated/package_info.ts
|
|
8
8
|
var PACKAGE_INFO = {
|
|
9
|
-
"version": "3.0.1-alpha.
|
|
9
|
+
"version": "3.0.1-alpha.3"};
|
|
10
10
|
var require2 = createRequire(import.meta.url);
|
|
11
11
|
var wasm = require2("../wasm/bitmark_wasm.js");
|
|
12
|
-
function lex(input,
|
|
13
|
-
return wasm.lex(input,
|
|
12
|
+
function lex(input, optionsJson = "{}") {
|
|
13
|
+
return wasm.lex(input, optionsJson);
|
|
14
|
+
}
|
|
15
|
+
function parse(input, optionsJson = "{}") {
|
|
16
|
+
return wasm.parse(input, optionsJson);
|
|
14
17
|
}
|
|
15
18
|
function convert(input, optionsJson = "{}") {
|
|
16
19
|
return wasm.convert(input, optionsJson);
|
|
@@ -69,10 +72,11 @@ function registerParseCommand(program2) {
|
|
|
69
72
|
const content = readInputs(inputs);
|
|
70
73
|
let result;
|
|
71
74
|
if (options.stage === "lex" || options.stage === "lex-bitmark" || options.stage === "lex-text") {
|
|
72
|
-
|
|
75
|
+
const lexOptionsJson = JSON.stringify({ stage: options.stage });
|
|
76
|
+
result = lex(content, lexOptionsJson);
|
|
73
77
|
} else {
|
|
74
78
|
const optionsJson = JSON.stringify({ mode: options.mode });
|
|
75
|
-
result =
|
|
79
|
+
result = parse(content, optionsJson);
|
|
76
80
|
}
|
|
77
81
|
writeOutput(result, options.output, options.append);
|
|
78
82
|
});
|
package/dist/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/generated/package_info.ts","../src/index.ts","../src/utils/io.ts","../src/commands/parse.ts","../src/commands/generate.ts","../src/commands/convert.ts","../src/commands/breakscape.ts","../src/commands/unbreakscape.ts","../src/commands/info.ts","../src/cli.ts"],"names":["require","program"],"mappings":";;;;;;;AAIO,IAAM,YAAA,GAAe;AAAA,EAE1B,SAAA,EAAW,eAIb,CAAA;ACNA,IAAMA,QAAAA,GAAU,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAC7C,IAAM,IAAA,GAAOA,SAAQ,yBAAyB,CAAA;AAkBvC,SAAS,GAAA,CAAI,KAAA,EAAe,KAAA,GAAgB,KAAA,EAAe;AAChE,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,KAAK,CAAA;AAC9B;AAmBO,SAAS,OAAA,CAAQ,KAAA,EAAe,WAAA,GAAsB,IAAA,EAAc;AACzE,EAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,WAAW,CAAA;AACxC;AAUO,SAAS,cAAA,CAAe,KAAA,EAAe,MAAA,GA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,GAAG,CAAA,CACzD,MAAA;AAAA,IACC,CACE,UACA,OAAA,KAUG;AACH,MAAA,MAAM,MAAA,GAAS,IAAA,CAAK,QAAA,EAAU,OAAA,CAAQ,QAAQ,OAAA,CAAQ,GAAA,IAAO,EAAA,EAAI,OAAA,CAAQ,MAAA,EAAQ,QAAA,CAAS,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAC,CAAA;AAC7G,MAAA,WAAA,CAAY,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAQ,OAAA,CAAQ,MAAM,CAAA;AAAA,IACpD;AAAA,GACF;AACJ;;;ACzBA,IAAM,OAAA,GAAU,IAAI,OAAA,EAAQ;AAE5B,OAAA,CAAQ,IAAA,CAAK,gBAAgB,CAAA,CAAE,WAAA,CAAY,iCAAiC,CAAA,CAAE,OAAA,CAAQ,aAAa,OAAO,CAAA;AAE1G,oBAAA,CAAqB,OAAO,CAAA;AAC5B,uBAAA,CAAwB,OAAO,CAAA;AAC/B,sBAAA,CAAuB,OAAO,CAAA;AAC9B,yBAAA,CAA0B,OAAO,CAAA;AACjC,2BAAA,CAA4B,OAAO,CAAA;AACnC,mBAAA,CAAoB,OAAO,CAAA;AAE3B,OAAA,CAAQ,KAAA,EAAM","file":"cli.js","sourcesContent":["// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"3.0.1-alpha.2\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n","// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param stage - Lexer stage: `\"lex\"` (combined), `\"lex-bitmark\"`, or `\"lex-text\"`.\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, stage: string = \"lex\"): string {\n return wasm.lex(input, stage);\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string): string {\n return wasm.parse(input);\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param optionsJson - JSON string with options: mode, warnings, plainText.\n * @returns Converted output string.\n */\nexport function convert(input: string, optionsJson: string = \"{}\"): string {\n return wasm.convert(input, optionsJson);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param infoType - Info type: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`.\n * @param format - Output format: `\"text\"` (default) or `\"json\"`.\n * @param bit - Bit name (required when `infoType` is `\"bit\"`).\n * @param pretty - Whether to pretty-print JSON output.\n * @param indent - Indent size for pretty-printing (default: 2).\n * @returns Information string.\n */\nexport function info(infoType: string = \"list\", format: string = \"text\", bit: string = \"\", pretty: boolean = false, indent: number = 2): string {\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * @param _json - JSON string of the AST.\n * @throws Always throws — not yet implemented.\n */\nexport function generate(_json: string): string {\n throw new Error(\"generate is not yet implemented\");\n}\n","// @zen-component: CLI-SharedIO\n//! Shared I/O utilities for the TS CLI.\n\nimport { readFileSync, writeFileSync, appendFileSync, existsSync, mkdirSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\n\n/**\n * Resolve multiple inputs into a single concatenated string.\n *\n * If the array is empty, reads from stdin.\n * Multiple inputs are concatenated with `\\n` — valid for bitmark\n * because bits are `\\n`-delimited.\n */\nexport function readInputs(inputs: string[]): string {\n if (inputs.length === 0) {\n return readStdin();\n }\n if (inputs.length === 1) {\n return readSingle(inputs[0]);\n }\n return inputs.map(readSingle).join(\"\\n\");\n}\n\n/**\n * Resolve a single input string (file path or literal).\n */\nfunction readSingle(input: string): string {\n if (existsSync(input)) {\n return readFileSync(input, \"utf-8\");\n }\n return input;\n}\n\n/**\n * Read all of stdin synchronously.\n */\nfunction readStdin(): string {\n const buf = readFileSync(0, \"utf-8\") as string;\n if (!buf) {\n console.error(\"No input provided. Pass a file path, literal string, or pipe via stdin.\");\n process.exit(1);\n }\n return buf;\n}\n\n/**\n * Write output to stdout or a file.\n *\n * - If `outputPath` is undefined → write to stdout\n * - If `append` is true → append to file\n * - Otherwise → overwrite file\n */\nexport function writeOutput(content: string, outputPath: string | undefined, append: boolean): void {\n if (outputPath === undefined) {\n process.stdout.write(content);\n return;\n }\n\n // Ensure parent directory exists\n const dir = dirname(outputPath);\n if (dir && !existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n if (append) {\n appendFileSync(outputPath, content, \"utf-8\");\n } else {\n writeFileSync(outputPath, content, \"utf-8\");\n }\n}\n","// @zen-component: WASM-TSBindings\n\nimport type { Command } from \"commander\";\nimport { lex, convert } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerParseCommand(program: Command): void {\n program\n .command(\"parse\")\n .description(\"Parse a bitmark file to JSON\")\n .argument(\"[INPUT...]\", \"Input: bitmark files, literal strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--stage <STAGE>\", \"Stage to run: all, lex, lex-bitmark, lex-text\", \"all\")\n .option(\"--mode <MODE>\", \"JSON output mode: optimized or full\", \"optimized\")\n .action((inputs: string[], options: { output?: string; append: boolean; stage: string; mode: string }) => {\n const content = readInputs(inputs);\n let result: string;\n\n if (options.stage === \"lex\" || options.stage === \"lex-bitmark\" || options.stage === \"lex-text\") {\n result = lex(content, options.stage);\n } else {\n const optionsJson = JSON.stringify({ mode: options.mode });\n result = convert(content, optionsJson);\n }\n\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: WASM-TSBindings\n\nimport type { Command } from \"commander\";\n\nexport function registerGenerateCommand(program: Command): void {\n program\n .command(\"generate\")\n .description(\"Generate bitmark text from JSON\")\n .argument(\"<INPUT>\", \"Input JSON file\")\n .argument(\"<OUTPUT>\", \"Output bitmark file\")\n .action((_input: string, _output: string) => {\n console.error(\"generate not yet implemented\");\n process.exit(1);\n });\n}\n","// @zen-component: CLI-Convert\n\nimport type { Command } from \"commander\";\nimport { convert } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerConvertCommand(program: Command): void {\n program\n .command(\"convert\")\n .description(\"Auto-detect input format and convert between bitmark and JSON\")\n .argument(\"[INPUT...]\", \"Input: file paths, bitmark/JSON strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"-w, --warnings\", \"Enable validation warnings in output\", false)\n .option(\"-p, --pretty\", \"Prettify JSON output\", false)\n .option(\"--indent <n>\", \"Indent size for pretty JSON\", \"2\")\n .option(\"--mode <MODE>\", \"JSON output mode: optimized or full\", \"optimized\")\n .option(\"--plain-text\", \"Output text as plain text (debug)\", false)\n .action(\n (\n inputs: string[],\n options: {\n output?: string;\n append: boolean;\n warnings: boolean;\n pretty: boolean;\n indent: string;\n mode: string;\n plainText: boolean;\n },\n ) => {\n const content = readInputs(inputs);\n const optionsJson = JSON.stringify({\n mode: options.mode,\n warnings: options.warnings,\n plainText: options.plainText,\n pretty: options.pretty,\n indent: parseInt(options.indent, 10),\n });\n const result = convert(content, optionsJson);\n writeOutput(result, options.output, options.append);\n },\n );\n}\n","// @zen-component: CLI-Breakscape\n\nimport type { Command } from \"commander\";\nimport { breakscapeText } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerBreakscapeCommand(program: Command): void {\n program\n .command(\"breakscape\")\n .description(\"Breakscape text (escape bitmark special characters)\")\n .argument(\"[INPUT...]\", \"Input: file paths, text strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--format <FORMAT>\", \"Text format: bitmark++ or plainText\", \"bitmark++\")\n .option(\"--location <LOCATION>\", \"Text location: body or tag\", \"body\")\n .action((inputs: string[], options: { output?: string; append: boolean; format: string; location: string }) => {\n const content = readInputs(inputs);\n const result = breakscapeText(content, options.format, options.location);\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: CLI-Breakscape\n\nimport type { Command } from \"commander\";\nimport { unbreakscapeText } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerUnbreakscapeCommand(program: Command): void {\n program\n .command(\"unbreakscape\")\n .description(\"Unbreakscape text (unescape bitmark special characters)\")\n .argument(\"[INPUT...]\", \"Input: file paths, text strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--format <FORMAT>\", \"Text format: bitmark++ or plainText\", \"bitmark++\")\n .option(\"--location <LOCATION>\", \"Text location: body or tag\", \"body\")\n .action((inputs: string[], options: { output?: string; append: boolean; format: string; location: string }) => {\n const content = readInputs(inputs);\n const result = unbreakscapeText(content, options.format, options.location);\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: CLI-Info\n\nimport type { Command } from \"commander\";\nimport { info } from \"../index.js\";\nimport { writeOutput } from \"../utils/io.js\";\n\nexport function registerInfoCommand(program: Command): void {\n program\n .command(\"info\")\n .description(\"Show information about supported bit types\")\n .argument(\"[INFO]\", \"Info type: list, bit, all, deprecated\", \"list\")\n .option(\"-f, --format <FORMAT>\", \"Output format: text or json\", \"text\")\n .option(\"--all\", \"Include deprecated bits\", false)\n .option(\"--bit <NAME>\", \"Filter to specific bit type\")\n .option(\"--deprecated\", \"Show only deprecated bits\", false)\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"-p, --pretty\", \"Prettify JSON output\", false)\n .option(\"--indent <n>\", \"Indent size for pretty JSON\", \"2\")\n .action(\n (\n infoType: string,\n options: {\n format: string;\n all: boolean;\n bit?: string;\n deprecated: boolean;\n output?: string;\n append: boolean;\n pretty: boolean;\n indent: string;\n },\n ) => {\n const result = info(infoType, options.format, options.bit ?? \"\", options.pretty, parseInt(options.indent, 10));\n writeOutput(result, options.output, options.append);\n },\n );\n}\n","#!/usr/bin/env node\n// @zen-component: WASM-TSBindings\n\nimport { Command } from \"commander\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nimport { registerParseCommand } from \"./commands/parse.js\";\nimport { registerGenerateCommand } from \"./commands/generate.js\";\nimport { registerConvertCommand } from \"./commands/convert.js\";\nimport { registerBreakscapeCommand } from \"./commands/breakscape.js\";\nimport { registerUnbreakscapeCommand } from \"./commands/unbreakscape.js\";\nimport { registerInfoCommand } from \"./commands/info.js\";\n\nconst program = new Command();\n\nprogram.name(\"bitmark-parser\").description(\"Parse and generate bitmark text\").version(PACKAGE_INFO.version);\n\nregisterParseCommand(program);\nregisterGenerateCommand(program);\nregisterConvertCommand(program);\nregisterBreakscapeCommand(program);\nregisterUnbreakscapeCommand(program);\nregisterInfoCommand(program);\n\nprogram.parse();\n"]}
|
|
1
|
+
{"version":3,"sources":["../src/generated/package_info.ts","../src/index.ts","../src/utils/io.ts","../src/commands/parse.ts","../src/commands/generate.ts","../src/commands/convert.ts","../src/commands/breakscape.ts","../src/commands/unbreakscape.ts","../src/commands/info.ts","../src/cli.ts"],"names":["require","program"],"mappings":";;;;;;;AAIO,IAAM,YAAA,GAAe;AAAA,EAE1B,SAAA,EAAW,eAIb,CAAA;ACNA,IAAMA,QAAAA,GAAU,aAAA,CAAc,MAAA,CAAA,IAAA,CAAY,GAAG,CAAA;AAC7C,IAAM,IAAA,GAAOA,SAAQ,yBAAyB,CAAA;AAkBvC,SAAS,GAAA,CAAI,KAAA,EAAe,WAAA,GAAsB,IAAA,EAAc;AACrE,EAAA,OAAO,IAAA,CAAK,GAAA,CAAI,KAAA,EAAO,WAAW,CAAA;AACpC;AASO,SAAS,KAAA,CAAM,KAAA,EAAe,WAAA,GAAsB,IAAA,EAAc;AACvE,EAAA,OAAO,IAAA,CAAK,KAAA,CAAM,KAAA,EAAO,WAAW,CAAA;AACtC;AASO,SAAS,OAAA,CAAQ,KAAA,EAAe,WAAA,GAAsB,IAAA,EAAc;AACzE,EAAA,OAAO,IAAA,CAAK,OAAA,CAAQ,KAAA,EAAO,WAAW,CAAA;AACxC;AAUO,SAAS,cAAA,CAAe,KAAA,EAAe,MAAA,GAAiB,WAAA,EAAa,WAAmB,MAAA,EAAgB;AAC7G,EAAA,OAAO,IAAA,CAAK,eAAA,CAAgB,KAAA,EAAO,MAAA,EAAQ,QAAQ,CAAA;AACrD;AAUO,SAAS,gBAAA,CAAiB,KAAA,EAAe,MAAA,GAAiB,WAAA,EAAa,WAAmB,MAAA,EAAgB;AAC/G,EAAA,OAAO,IAAA,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,EAAI,OAAA,CAAQ,MAAA,EAAQ,QAAA,CAAS,OAAA,CAAQ,MAAA,EAAQ,EAAE,CAAC,CAAA;AAC7G,MAAA,WAAA,CAAY,MAAA,EAAQ,OAAA,CAAQ,MAAA,EAAQ,OAAA,CAAQ,MAAM,CAAA;AAAA,IACpD;AAAA,GACF;AACJ;;;ACzBA,IAAM,OAAA,GAAU,IAAI,OAAA,EAAQ;AAE5B,OAAA,CAAQ,IAAA,CAAK,gBAAgB,CAAA,CAAE,WAAA,CAAY,iCAAiC,CAAA,CAAE,OAAA,CAAQ,aAAa,OAAO,CAAA;AAE1G,oBAAA,CAAqB,OAAO,CAAA;AAC5B,uBAAA,CAAwB,OAAO,CAAA;AAC/B,sBAAA,CAAuB,OAAO,CAAA;AAC9B,yBAAA,CAA0B,OAAO,CAAA;AACjC,2BAAA,CAA4B,OAAO,CAAA;AACnC,mBAAA,CAAoB,OAAO,CAAA;AAE3B,OAAA,CAAQ,KAAA,EAAM","file":"cli.js","sourcesContent":["// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"3.0.1-alpha.3\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n","// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: stage.\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, optionsJson: string = \"{}\"): string {\n return wasm.lex(input, optionsJson);\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: mode.\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, optionsJson: string = \"{}\"): string {\n return wasm.parse(input, optionsJson);\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param optionsJson - JSON string with options: mode, warnings, plainText.\n * @returns Converted output string.\n */\nexport function convert(input: string, optionsJson: string = \"{}\"): string {\n return wasm.convert(input, optionsJson);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param infoType - Info type: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`.\n * @param format - Output format: `\"text\"` (default) or `\"json\"`.\n * @param bit - Bit name (required when `infoType` is `\"bit\"`).\n * @param pretty - Whether to pretty-print JSON output.\n * @param indent - Indent size for pretty-printing (default: 2).\n * @returns Information string.\n */\nexport function info(infoType: string = \"list\", format: string = \"text\", bit: string = \"\", pretty: boolean = false, indent: number = 2): string {\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * @param _json - JSON string of the AST.\n * @throws Always throws — not yet implemented.\n */\nexport function generate(_json: string): string {\n throw new Error(\"generate is not yet implemented\");\n}\n","// @zen-component: CLI-SharedIO\n//! Shared I/O utilities for the TS CLI.\n\nimport { readFileSync, writeFileSync, appendFileSync, existsSync, mkdirSync } from \"node:fs\";\nimport { dirname } from \"node:path\";\n\n/**\n * Resolve multiple inputs into a single concatenated string.\n *\n * If the array is empty, reads from stdin.\n * Multiple inputs are concatenated with `\\n` — valid for bitmark\n * because bits are `\\n`-delimited.\n */\nexport function readInputs(inputs: string[]): string {\n if (inputs.length === 0) {\n return readStdin();\n }\n if (inputs.length === 1) {\n return readSingle(inputs[0]);\n }\n return inputs.map(readSingle).join(\"\\n\");\n}\n\n/**\n * Resolve a single input string (file path or literal).\n */\nfunction readSingle(input: string): string {\n if (existsSync(input)) {\n return readFileSync(input, \"utf-8\");\n }\n return input;\n}\n\n/**\n * Read all of stdin synchronously.\n */\nfunction readStdin(): string {\n const buf = readFileSync(0, \"utf-8\") as string;\n if (!buf) {\n console.error(\"No input provided. Pass a file path, literal string, or pipe via stdin.\");\n process.exit(1);\n }\n return buf;\n}\n\n/**\n * Write output to stdout or a file.\n *\n * - If `outputPath` is undefined → write to stdout\n * - If `append` is true → append to file\n * - Otherwise → overwrite file\n */\nexport function writeOutput(content: string, outputPath: string | undefined, append: boolean): void {\n if (outputPath === undefined) {\n process.stdout.write(content);\n return;\n }\n\n // Ensure parent directory exists\n const dir = dirname(outputPath);\n if (dir && !existsSync(dir)) {\n mkdirSync(dir, { recursive: true });\n }\n\n if (append) {\n appendFileSync(outputPath, content, \"utf-8\");\n } else {\n writeFileSync(outputPath, content, \"utf-8\");\n }\n}\n","// @zen-component: WASM-TSBindings\n\nimport type { Command } from \"commander\";\nimport { lex, parse } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerParseCommand(program: Command): void {\n program\n .command(\"parse\")\n .description(\"Parse a bitmark file to JSON\")\n .argument(\"[INPUT...]\", \"Input: bitmark files, literal strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--stage <STAGE>\", \"Stage to run: all, lex, lex-bitmark, lex-text\", \"all\")\n .option(\"--mode <MODE>\", \"JSON output mode: optimized or full\", \"optimized\")\n .action((inputs: string[], options: { output?: string; append: boolean; stage: string; mode: string }) => {\n const content = readInputs(inputs);\n let result: string;\n\n if (options.stage === \"lex\" || options.stage === \"lex-bitmark\" || options.stage === \"lex-text\") {\n const lexOptionsJson = JSON.stringify({ stage: options.stage });\n result = lex(content, lexOptionsJson);\n } else {\n const optionsJson = JSON.stringify({ mode: options.mode });\n result = parse(content, optionsJson);\n }\n\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: WASM-TSBindings\n\nimport type { Command } from \"commander\";\n\nexport function registerGenerateCommand(program: Command): void {\n program\n .command(\"generate\")\n .description(\"Generate bitmark text from JSON\")\n .argument(\"<INPUT>\", \"Input JSON file\")\n .argument(\"<OUTPUT>\", \"Output bitmark file\")\n .action((_input: string, _output: string) => {\n console.error(\"generate not yet implemented\");\n process.exit(1);\n });\n}\n","// @zen-component: CLI-Convert\n\nimport type { Command } from \"commander\";\nimport { convert } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerConvertCommand(program: Command): void {\n program\n .command(\"convert\")\n .description(\"Auto-detect input format and convert between bitmark and JSON\")\n .argument(\"[INPUT...]\", \"Input: file paths, bitmark/JSON strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"-w, --warnings\", \"Enable validation warnings in output\", false)\n .option(\"-p, --pretty\", \"Prettify JSON output\", false)\n .option(\"--indent <n>\", \"Indent size for pretty JSON\", \"2\")\n .option(\"--mode <MODE>\", \"JSON output mode: optimized or full\", \"optimized\")\n .option(\"--plain-text\", \"Output text as plain text (debug)\", false)\n .action(\n (\n inputs: string[],\n options: {\n output?: string;\n append: boolean;\n warnings: boolean;\n pretty: boolean;\n indent: string;\n mode: string;\n plainText: boolean;\n },\n ) => {\n const content = readInputs(inputs);\n const optionsJson = JSON.stringify({\n mode: options.mode,\n warnings: options.warnings,\n plainText: options.plainText,\n pretty: options.pretty,\n indent: parseInt(options.indent, 10),\n });\n const result = convert(content, optionsJson);\n writeOutput(result, options.output, options.append);\n },\n );\n}\n","// @zen-component: CLI-Breakscape\n\nimport type { Command } from \"commander\";\nimport { breakscapeText } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerBreakscapeCommand(program: Command): void {\n program\n .command(\"breakscape\")\n .description(\"Breakscape text (escape bitmark special characters)\")\n .argument(\"[INPUT...]\", \"Input: file paths, text strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--format <FORMAT>\", \"Text format: bitmark++ or plainText\", \"bitmark++\")\n .option(\"--location <LOCATION>\", \"Text location: body or tag\", \"body\")\n .action((inputs: string[], options: { output?: string; append: boolean; format: string; location: string }) => {\n const content = readInputs(inputs);\n const result = breakscapeText(content, options.format, options.location);\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: CLI-Breakscape\n\nimport type { Command } from \"commander\";\nimport { unbreakscapeText } from \"../index.js\";\nimport { readInputs, writeOutput } from \"../utils/io.js\";\n\nexport function registerUnbreakscapeCommand(program: Command): void {\n program\n .command(\"unbreakscape\")\n .description(\"Unbreakscape text (unescape bitmark special characters)\")\n .argument(\"[INPUT...]\", \"Input: file paths, text strings, or omit for stdin\")\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"--format <FORMAT>\", \"Text format: bitmark++ or plainText\", \"bitmark++\")\n .option(\"--location <LOCATION>\", \"Text location: body or tag\", \"body\")\n .action((inputs: string[], options: { output?: string; append: boolean; format: string; location: string }) => {\n const content = readInputs(inputs);\n const result = unbreakscapeText(content, options.format, options.location);\n writeOutput(result, options.output, options.append);\n });\n}\n","// @zen-component: CLI-Info\n\nimport type { Command } from \"commander\";\nimport { info } from \"../index.js\";\nimport { writeOutput } from \"../utils/io.js\";\n\nexport function registerInfoCommand(program: Command): void {\n program\n .command(\"info\")\n .description(\"Show information about supported bit types\")\n .argument(\"[INFO]\", \"Info type: list, bit, all, deprecated\", \"list\")\n .option(\"-f, --format <FORMAT>\", \"Output format: text or json\", \"text\")\n .option(\"--all\", \"Include deprecated bits\", false)\n .option(\"--bit <NAME>\", \"Filter to specific bit type\")\n .option(\"--deprecated\", \"Show only deprecated bits\", false)\n .option(\"-o, --output <file>\", \"Output file (default: stdout)\")\n .option(\"-a, --append\", \"Append to output file\", false)\n .option(\"-p, --pretty\", \"Prettify JSON output\", false)\n .option(\"--indent <n>\", \"Indent size for pretty JSON\", \"2\")\n .action(\n (\n infoType: string,\n options: {\n format: string;\n all: boolean;\n bit?: string;\n deprecated: boolean;\n output?: string;\n append: boolean;\n pretty: boolean;\n indent: string;\n },\n ) => {\n const result = info(infoType, options.format, options.bit ?? \"\", options.pretty, parseInt(options.indent, 10));\n writeOutput(result, options.output, options.append);\n },\n );\n}\n","#!/usr/bin/env node\n// @zen-component: WASM-TSBindings\n\nimport { Command } from \"commander\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nimport { registerParseCommand } from \"./commands/parse.js\";\nimport { registerGenerateCommand } from \"./commands/generate.js\";\nimport { registerConvertCommand } from \"./commands/convert.js\";\nimport { registerBreakscapeCommand } from \"./commands/breakscape.js\";\nimport { registerUnbreakscapeCommand } from \"./commands/unbreakscape.js\";\nimport { registerInfoCommand } from \"./commands/info.js\";\n\nconst program = new Command();\n\nprogram.name(\"bitmark-parser\").description(\"Parse and generate bitmark text\").version(PACKAGE_INFO.version);\n\nregisterParseCommand(program);\nregisterGenerateCommand(program);\nregisterConvertCommand(program);\nregisterBreakscapeCommand(program);\nregisterUnbreakscapeCommand(program);\nregisterInfoCommand(program);\n\nprogram.parse();\n"]}
|
package/dist/index.cjs
CHANGED
|
@@ -41,7 +41,7 @@ var import_node_module = require("module");
|
|
|
41
41
|
// src/generated/package_info.ts
|
|
42
42
|
var PACKAGE_INFO = {
|
|
43
43
|
"name": "@gmb/bitmark-parser",
|
|
44
|
-
"version": "3.0.1-alpha.
|
|
44
|
+
"version": "3.0.1-alpha.3",
|
|
45
45
|
"author": "Get More Brain Ltd <info@getmorebrain.com>",
|
|
46
46
|
"license": "ISC",
|
|
47
47
|
"description": "A parser for bitmark text, powered by WebAssembly."
|
|
@@ -53,11 +53,11 @@ var wasm = require2("../wasm/bitmark_wasm.js");
|
|
|
53
53
|
function version() {
|
|
54
54
|
return PACKAGE_INFO.version;
|
|
55
55
|
}
|
|
56
|
-
function lex(input,
|
|
57
|
-
return wasm.lex(input,
|
|
56
|
+
function lex(input, optionsJson = "{}") {
|
|
57
|
+
return wasm.lex(input, optionsJson);
|
|
58
58
|
}
|
|
59
|
-
function parse(input) {
|
|
60
|
-
return wasm.parse(input);
|
|
59
|
+
function parse(input, optionsJson = "{}") {
|
|
60
|
+
return wasm.parse(input, optionsJson);
|
|
61
61
|
}
|
|
62
62
|
function convert(input, optionsJson = "{}") {
|
|
63
63
|
return wasm.convert(input, optionsJson);
|
package/dist/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../../../node_modules/tsup/assets/cjs_shims.js","../src/generated/package_info.ts"],"sourcesContent":["// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../../../node_modules/tsup/assets/cjs_shims.js","../src/generated/package_info.ts"],"sourcesContent":["// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: stage.\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, optionsJson: string = \"{}\"): string {\n return wasm.lex(input, optionsJson);\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: mode.\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, optionsJson: string = \"{}\"): string {\n return wasm.parse(input, optionsJson);\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param optionsJson - JSON string with options: mode, warnings, plainText.\n * @returns Converted output string.\n */\nexport function convert(input: string, optionsJson: string = \"{}\"): string {\n return wasm.convert(input, optionsJson);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param infoType - Info type: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`.\n * @param format - Output format: `\"text\"` (default) or `\"json\"`.\n * @param bit - Bit name (required when `infoType` is `\"bit\"`).\n * @param pretty - Whether to pretty-print JSON output.\n * @param indent - Indent size for pretty-printing (default: 2).\n * @returns Information string.\n */\nexport function info(infoType: string = \"list\", format: string = \"text\", bit: string = \"\", pretty: boolean = false, indent: number = 2): string {\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * @param _json - JSON string of the AST.\n * @throws Always throws — not yet implemented.\n */\nexport function generate(_json: string): string {\n throw new Error(\"generate is not yet implemented\");\n}\n","// Shim globals in cjs bundle\n// There's a weird bug that esbuild will always inject importMetaUrl\n// if we export it as `const importMetaUrl = ... __filename ...`\n// But using a function will not cause this issue\n\nconst getImportMetaUrl = () => \n typeof document === \"undefined\" \n ? new URL(`file:${__filename}`).href \n : (document.currentScript && document.currentScript.tagName.toUpperCase() === 'SCRIPT') \n ? document.currentScript.src \n : new URL(\"main.js\", document.baseURI).href;\n\nexport const importMetaUrl = /* @__PURE__ */ getImportMetaUrl()\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"3.0.1-alpha.3\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA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string;
|
|
|
8
8
|
* Lex bitmark input text, returning one line per token.
|
|
9
9
|
*
|
|
10
10
|
* @param input - The bitmark source text.
|
|
11
|
-
* @param
|
|
11
|
+
* @param optionsJson - JSON string with options: stage.
|
|
12
12
|
* @returns Token dump string (one token per line).
|
|
13
13
|
*/
|
|
14
|
-
declare function lex(input: string,
|
|
14
|
+
declare function lex(input: string, optionsJson?: string): string;
|
|
15
15
|
/**
|
|
16
16
|
* Parse bitmark input text and return the reference JSON format.
|
|
17
17
|
*
|
|
18
18
|
* @param input - The bitmark source text.
|
|
19
|
+
* @param optionsJson - JSON string with options: mode.
|
|
19
20
|
* @returns JSON string of the parsed bitmark document.
|
|
20
21
|
*/
|
|
21
|
-
declare function parse(input: string): string;
|
|
22
|
+
declare function parse(input: string, optionsJson?: string): string;
|
|
22
23
|
/**
|
|
23
24
|
* Auto-detect input format and convert between bitmark and JSON.
|
|
24
25
|
*
|
package/dist/index.d.ts
CHANGED
|
@@ -8,17 +8,18 @@ declare function version(): string;
|
|
|
8
8
|
* Lex bitmark input text, returning one line per token.
|
|
9
9
|
*
|
|
10
10
|
* @param input - The bitmark source text.
|
|
11
|
-
* @param
|
|
11
|
+
* @param optionsJson - JSON string with options: stage.
|
|
12
12
|
* @returns Token dump string (one token per line).
|
|
13
13
|
*/
|
|
14
|
-
declare function lex(input: string,
|
|
14
|
+
declare function lex(input: string, optionsJson?: string): string;
|
|
15
15
|
/**
|
|
16
16
|
* Parse bitmark input text and return the reference JSON format.
|
|
17
17
|
*
|
|
18
18
|
* @param input - The bitmark source text.
|
|
19
|
+
* @param optionsJson - JSON string with options: mode.
|
|
19
20
|
* @returns JSON string of the parsed bitmark document.
|
|
20
21
|
*/
|
|
21
|
-
declare function parse(input: string): string;
|
|
22
|
+
declare function parse(input: string, optionsJson?: string): string;
|
|
22
23
|
/**
|
|
23
24
|
* Auto-detect input format and convert between bitmark and JSON.
|
|
24
25
|
*
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { createRequire } from "module";
|
|
|
4
4
|
// src/generated/package_info.ts
|
|
5
5
|
var PACKAGE_INFO = {
|
|
6
6
|
"name": "@gmb/bitmark-parser",
|
|
7
|
-
"version": "3.0.1-alpha.
|
|
7
|
+
"version": "3.0.1-alpha.3",
|
|
8
8
|
"author": "Get More Brain Ltd <info@getmorebrain.com>",
|
|
9
9
|
"license": "ISC",
|
|
10
10
|
"description": "A parser for bitmark text, powered by WebAssembly."
|
|
@@ -16,11 +16,11 @@ var wasm = require2("../wasm/bitmark_wasm.js");
|
|
|
16
16
|
function version() {
|
|
17
17
|
return PACKAGE_INFO.version;
|
|
18
18
|
}
|
|
19
|
-
function lex(input,
|
|
20
|
-
return wasm.lex(input,
|
|
19
|
+
function lex(input, optionsJson = "{}") {
|
|
20
|
+
return wasm.lex(input, optionsJson);
|
|
21
21
|
}
|
|
22
|
-
function parse(input) {
|
|
23
|
-
return wasm.parse(input);
|
|
22
|
+
function parse(input, optionsJson = "{}") {
|
|
23
|
+
return wasm.parse(input, optionsJson);
|
|
24
24
|
}
|
|
25
25
|
function convert(input, optionsJson = "{}") {
|
|
26
26
|
return wasm.convert(input, optionsJson);
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/index.ts","../src/generated/package_info.ts"],"sourcesContent":["// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param
|
|
1
|
+
{"version":3,"sources":["../src/index.ts","../src/generated/package_info.ts"],"sourcesContent":["// @zen-component: WASM-TSBindings\n\nimport { createRequire } from \"node:module\";\nimport { PACKAGE_INFO } from \"./generated/package_info.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\n/**\n * Get the version of the @gmb/bitmark-parser library.\n *\n * @returns Version string (e.g. \"3.0.0\").\n */\nexport function version(): string {\n return PACKAGE_INFO.version;\n}\n\n/**\n * Lex bitmark input text, returning one line per token.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: stage.\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, optionsJson: string = \"{}\"): string {\n return wasm.lex(input, optionsJson);\n}\n\n/**\n * Parse bitmark input text and return the reference JSON format.\n *\n * @param input - The bitmark source text.\n * @param optionsJson - JSON string with options: mode.\n * @returns JSON string of the parsed bitmark document.\n */\nexport function parse(input: string, optionsJson: string = \"{}\"): string {\n return wasm.parse(input, optionsJson);\n}\n\n/**\n * Auto-detect input format and convert between bitmark and JSON.\n *\n * @param input - Bitmark or JSON input text.\n * @param optionsJson - JSON string with options: mode, warnings, plainText.\n * @returns Converted output string.\n */\nexport function convert(input: string, optionsJson: string = \"{}\"): string {\n return wasm.convert(input, optionsJson);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.breakscape_text(input, format, location);\n}\n\n/**\n * Unbreakscape text (unescape bitmark special characters).\n *\n * @param input - The text to unbreakscape.\n * @param format - Text format: `\"bitmark++\"` (default) or `\"plainText\"`.\n * @param location - Text location: `\"body\"` (default) or `\"tag\"`.\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, format: string = \"bitmark++\", location: string = \"body\"): string {\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param infoType - Info type: `\"list\"`, `\"bit\"`, `\"all\"`, or `\"deprecated\"`.\n * @param format - Output format: `\"text\"` (default) or `\"json\"`.\n * @param bit - Bit name (required when `infoType` is `\"bit\"`).\n * @param pretty - Whether to pretty-print JSON output.\n * @param indent - Indent size for pretty-printing (default: 2).\n * @returns Information string.\n */\nexport function info(infoType: string = \"list\", format: string = \"text\", bit: string = \"\", pretty: boolean = false, indent: number = 2): string {\n return wasm.info(infoType, format, bit, pretty, indent);\n}\n\n/**\n * Generate bitmark text from a JSON AST.\n *\n * @param _json - JSON string of the AST.\n * @throws Always throws — not yet implemented.\n */\nexport function generate(_json: string): string {\n throw new Error(\"generate is not yet implemented\");\n}\n","// This file is automatically generated. DO NOT EDIT.\n\n/* eslint-disable */\n\nexport const PACKAGE_INFO = {\n \"name\": \"@gmb/bitmark-parser\",\n \"version\": \"3.0.1-alpha.3\",\n \"author\": \"Get More Brain Ltd <info@getmorebrain.com>\",\n \"license\": \"ISC\",\n \"description\": \"A parser for bitmark text, powered by WebAssembly.\"\n};\n"],"mappings":";AAEA,SAAS,qBAAqB;;;ACEvB,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,eAAe;AACjB;;;ADNA,IAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,OAAOA,SAAQ,yBAAyB;AAOvC,SAAS,UAAkB;AAChC,SAAO,aAAa;AACtB;AASO,SAAS,IAAI,OAAe,cAAsB,MAAc;AACrE,SAAO,KAAK,IAAI,OAAO,WAAW;AACpC;AASO,SAAS,MAAM,OAAe,cAAsB,MAAc;AACvE,SAAO,KAAK,MAAM,OAAO,WAAW;AACtC;AASO,SAAS,QAAQ,OAAe,cAAsB,MAAc;AACzE,SAAO,KAAK,QAAQ,OAAO,WAAW;AACxC;AAUO,SAAS,eAAe,OAAe,SAAiB,aAAa,WAAmB,QAAgB;AAC7G,SAAO,KAAK,gBAAgB,OAAO,QAAQ,QAAQ;AACrD;AAUO,SAAS,iBAAiB,OAAe,SAAiB,aAAa,WAAmB,QAAgB;AAC/G,SAAO,KAAK,kBAAkB,OAAO,QAAQ,QAAQ;AACvD;AAYO,SAAS,KAAK,WAAmB,QAAQ,SAAiB,QAAQ,MAAc,IAAI,SAAkB,OAAO,SAAiB,GAAW;AAC9I,SAAO,KAAK,KAAK,UAAU,QAAQ,KAAK,QAAQ,MAAM;AACxD;AAQO,SAAS,SAAS,OAAuB;AAC9C,QAAM,IAAI,MAAM,iCAAiC;AACnD;","names":["require"]}
|
package/package.json
CHANGED
package/wasm/bitmark_wasm.d.ts
CHANGED
|
@@ -17,9 +17,12 @@ export function unbreakscape_text(input: string, format: string, location: strin
|
|
|
17
17
|
/**
|
|
18
18
|
* Parse bitmark input text and return the reference JSON format.
|
|
19
19
|
*
|
|
20
|
-
* Uses the full pipeline: parse → validate → serialize
|
|
20
|
+
* Uses the full pipeline: parse → validate → serialize.
|
|
21
|
+
*
|
|
22
|
+
* `options_json` is a JSON string with optional fields:
|
|
23
|
+
* - `"mode"`: `"optimized"` (default) or `"full"`
|
|
21
24
|
*/
|
|
22
|
-
export function parse(input: string): string;
|
|
25
|
+
export function parse(input: string, options_json: string): string;
|
|
23
26
|
/**
|
|
24
27
|
* Auto-detect input format and convert between bitmark and JSON.
|
|
25
28
|
*
|
|
@@ -48,12 +51,13 @@ export function info(info_type: string, format: string, bit: string, pretty: boo
|
|
|
48
51
|
* Lex bitmark input text, returning one line per token in the same format as
|
|
49
52
|
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
50
53
|
*
|
|
51
|
-
* `
|
|
52
|
-
* - `"
|
|
53
|
-
*
|
|
54
|
-
*
|
|
55
|
-
*
|
|
56
|
-
*
|
|
57
|
-
*
|
|
54
|
+
* `options_json` is a JSON string with optional fields:
|
|
55
|
+
* - `"stage"`: selects the lexer pipeline:
|
|
56
|
+
* - `"lex"` — combined (default)
|
|
57
|
+
* - `"lex-bitmark"` — bitmark-level only
|
|
58
|
+
* - `"lex-text"` — text-level only
|
|
59
|
+
* - `"lex-json"` — combined, JSON array output
|
|
60
|
+
* - `"lex-bitmark-json"` — bitmark-level, JSON array output
|
|
61
|
+
* - `"lex-text-json"` — text-level, JSON array output
|
|
58
62
|
*/
|
|
59
|
-
export function lex(input: string,
|
|
63
|
+
export function lex(input: string, options_json: string): string;
|
package/wasm/bitmark_wasm.js
CHANGED
|
@@ -154,26 +154,32 @@ module.exports.unbreakscape_text = function(input, format, location) {
|
|
|
154
154
|
/**
|
|
155
155
|
* Parse bitmark input text and return the reference JSON format.
|
|
156
156
|
*
|
|
157
|
-
* Uses the full pipeline: parse → validate → serialize
|
|
157
|
+
* Uses the full pipeline: parse → validate → serialize.
|
|
158
|
+
*
|
|
159
|
+
* `options_json` is a JSON string with optional fields:
|
|
160
|
+
* - `"mode"`: `"optimized"` (default) or `"full"`
|
|
158
161
|
* @param {string} input
|
|
162
|
+
* @param {string} options_json
|
|
159
163
|
* @returns {string}
|
|
160
164
|
*/
|
|
161
|
-
module.exports.parse = function(input) {
|
|
162
|
-
let
|
|
163
|
-
let
|
|
165
|
+
module.exports.parse = function(input, options_json) {
|
|
166
|
+
let deferred3_0;
|
|
167
|
+
let deferred3_1;
|
|
164
168
|
try {
|
|
165
169
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
166
170
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
167
171
|
const len0 = WASM_VECTOR_LEN;
|
|
168
|
-
|
|
172
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
173
|
+
const len1 = WASM_VECTOR_LEN;
|
|
174
|
+
wasm.parse(retptr, ptr0, len0, ptr1, len1);
|
|
169
175
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
170
176
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
171
|
-
|
|
172
|
-
|
|
177
|
+
deferred3_0 = r0;
|
|
178
|
+
deferred3_1 = r1;
|
|
173
179
|
return getStringFromWasm0(r0, r1);
|
|
174
180
|
} finally {
|
|
175
181
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
176
|
-
wasm.__wbindgen_export_2(
|
|
182
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
177
183
|
}
|
|
178
184
|
};
|
|
179
185
|
|
|
@@ -256,25 +262,26 @@ module.exports.info = function(info_type, format, bit, pretty, indent) {
|
|
|
256
262
|
* Lex bitmark input text, returning one line per token in the same format as
|
|
257
263
|
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
258
264
|
*
|
|
259
|
-
* `
|
|
260
|
-
* - `"
|
|
261
|
-
*
|
|
262
|
-
*
|
|
263
|
-
*
|
|
264
|
-
*
|
|
265
|
-
*
|
|
265
|
+
* `options_json` is a JSON string with optional fields:
|
|
266
|
+
* - `"stage"`: selects the lexer pipeline:
|
|
267
|
+
* - `"lex"` — combined (default)
|
|
268
|
+
* - `"lex-bitmark"` — bitmark-level only
|
|
269
|
+
* - `"lex-text"` — text-level only
|
|
270
|
+
* - `"lex-json"` — combined, JSON array output
|
|
271
|
+
* - `"lex-bitmark-json"` — bitmark-level, JSON array output
|
|
272
|
+
* - `"lex-text-json"` — text-level, JSON array output
|
|
266
273
|
* @param {string} input
|
|
267
|
-
* @param {string}
|
|
274
|
+
* @param {string} options_json
|
|
268
275
|
* @returns {string}
|
|
269
276
|
*/
|
|
270
|
-
module.exports.lex = function(input,
|
|
277
|
+
module.exports.lex = function(input, options_json) {
|
|
271
278
|
let deferred3_0;
|
|
272
279
|
let deferred3_1;
|
|
273
280
|
try {
|
|
274
281
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
275
282
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
276
283
|
const len0 = WASM_VECTOR_LEN;
|
|
277
|
-
const ptr1 = passStringToWasm0(
|
|
284
|
+
const ptr1 = passStringToWasm0(options_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
278
285
|
const len1 = WASM_VECTOR_LEN;
|
|
279
286
|
wasm.lex(retptr, ptr0, len0, ptr1, len1);
|
|
280
287
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
Binary file
|
|
@@ -5,7 +5,7 @@ export const breakscape_text: (a: number, b: number, c: number, d: number, e: nu
|
|
|
5
5
|
export const convert: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
6
6
|
export const info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
7
7
|
export const lex: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
8
|
-
export const parse: (a: number, b: number, c: number) => void;
|
|
8
|
+
export const parse: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
9
9
|
export const unbreakscape_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
10
10
|
export const __wbindgen_add_to_stack_pointer: (a: number) => number;
|
|
11
11
|
export const __wbindgen_export_0: (a: number, b: number) => number;
|