@gmb/bitmark-parser 3.0.1-alpha.4 → 3.0.2
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 +23 -21
- 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 +46 -32
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +16 -11
- package/dist/browser/esm/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/esm/index.d.ts +16 -11
- package/dist/browser/esm/index.js +44 -31
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/cli.js +6 -3
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +1 -1
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +9 -10
- package/dist/index.d.ts +9 -10
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/wasm/bitmark_wasm.d.ts +20 -24
- package/wasm/bitmark_wasm.js +58 -62
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/package.json +1 -1
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\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions } from \"./types.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat } from \"./types.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 options - Lex options (e.g. `{ stage: \"lex
|
|
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\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions } from \"./types.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat } from \"./types.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 options - Lex options (e.g. `{ stage: \"lex\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark input text and return structured JSON entries.\n *\n * Each entry contains `bit`, `parser`, and `bitmark` fields.\n *\n * @param input - The bitmark source text.\n * @param options - Parse options (e.g. `{ mode: \"full\" }`).\n * @returns JSON string array of structured parsed entries.\n */\nexport function parse(input: string, options: ParseOptions = {}): string {\n return wasm.parse(input, options.mode ?? \"optimized\");\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 options - Convert options (e.g. `{ mode: \"full\", warnings: true }`).\n * @returns Converted output string. For bitmark input, this is a JSON string\n * array of structured parsed entries (`bit`, `parser`, `bitmark`).\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return wasm.convert(input, options.mode ?? \"optimized\", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\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 options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\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.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"],"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;;;ADV9D,yBAA8B;;;AEEvB,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,eAAe;AACjB;;;AFLA,IAAMA,eAAU,kCAAc,aAAe;AAC7C,IAAM,OAAOA,SAAQ,yBAAyB;AASvC,SAAS,UAAkB;AAChC,SAAO,aAAa;AACtB;AASO,SAAS,IAAI,OAAe,UAAsB,CAAC,GAAW;AACnE,SAAO,KAAK,IAAI,OAAO,QAAQ,SAAS,KAAK;AAC/C;AAWO,SAAS,MAAM,OAAe,UAAwB,CAAC,GAAW;AACvE,SAAO,KAAK,MAAM,OAAO,QAAQ,QAAQ,WAAW;AACtD;AAUO,SAAS,QAAQ,OAAe,UAA0B,CAAC,GAAW;AAC3E,SAAO,KAAK,QAAQ,OAAO,QAAQ,QAAQ,aAAa,QAAQ,YAAY,OAAO,QAAQ,aAAa,OAAO,QAAQ,UAAU,OAAO,QAAQ,UAAU,CAAC;AAC7J;AASO,SAAS,eAAe,OAAe,UAA6B,CAAC,GAAW;AACrF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,WAAW,QAAQ,YAAY;AACrC,SAAO,KAAK,gBAAgB,OAAO,QAAQ,QAAQ;AACrD;AASO,SAAS,iBAAiB,OAAe,UAA6B,CAAC,GAAW;AACvF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,WAAW,QAAQ,YAAY;AACrC,SAAO,KAAK,kBAAkB,OAAO,QAAQ,QAAQ;AACvD;AAQO,SAAS,KAAK,UAAuB,CAAC,GAAW;AACtD,QAAM,WAAW,QAAQ,YAAY;AACrC,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,MAAM,QAAQ,OAAO;AAC3B,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,SAAS,QAAQ,UAAU;AACjC,SAAO,KAAK,KAAK,UAAU,QAAQ,KAAK,QAAQ,MAAM;AACxD;AAQO,SAAS,SAAS,OAAuB;AAC9C,QAAM,IAAI,MAAM,iCAAiC;AACnD;","names":["require"]}
|
package/dist/index.d.cts
CHANGED
|
@@ -9,13 +9,9 @@ type OutputMode = "optimized" | "full";
|
|
|
9
9
|
* Lexer stage selector.
|
|
10
10
|
*
|
|
11
11
|
* - `"lex"` — combined lexer, text output (default).
|
|
12
|
-
* - `"lex-bitmark"` — bitmark-level only, text output.
|
|
13
|
-
* - `"lex-text"` — text-level only, text output.
|
|
14
12
|
* - `"lex-json"` — combined lexer, JSON array output.
|
|
15
|
-
* - `"lex-bitmark-json"` — bitmark-level only, JSON array output.
|
|
16
|
-
* - `"lex-text-json"` — text-level only, JSON array output.
|
|
17
13
|
*/
|
|
18
|
-
type LexStage = "lex" | "lex-
|
|
14
|
+
type LexStage = "lex" | "lex-json";
|
|
19
15
|
/** Options for the {@link lex} function. */
|
|
20
16
|
interface LexOptions {
|
|
21
17
|
/** Selects the lexer pipeline stage (default: `"lex"`). */
|
|
@@ -30,7 +26,7 @@ interface ParseOptions {
|
|
|
30
26
|
interface ConvertOptions {
|
|
31
27
|
/** JSON output mode (default: `"optimized"`). */
|
|
32
28
|
mode?: OutputMode;
|
|
33
|
-
/** Include validation warnings in output (default: `false`). */
|
|
29
|
+
/** Include validation warnings in `parser.warnings` output (default: `false`). */
|
|
34
30
|
warnings?: boolean;
|
|
35
31
|
/** Output text as plain text — debug mode (default: `false`). */
|
|
36
32
|
plainText?: boolean;
|
|
@@ -78,16 +74,18 @@ declare function version(): string;
|
|
|
78
74
|
* Lex bitmark input text, returning one line per token.
|
|
79
75
|
*
|
|
80
76
|
* @param input - The bitmark source text.
|
|
81
|
-
* @param options - Lex options (e.g. `{ stage: "lex
|
|
77
|
+
* @param options - Lex options (e.g. `{ stage: "lex" }`).
|
|
82
78
|
* @returns Token dump string (one token per line).
|
|
83
79
|
*/
|
|
84
80
|
declare function lex(input: string, options?: LexOptions): string;
|
|
85
81
|
/**
|
|
86
|
-
* Parse bitmark input text and return
|
|
82
|
+
* Parse bitmark input text and return structured JSON entries.
|
|
83
|
+
*
|
|
84
|
+
* Each entry contains `bit`, `parser`, and `bitmark` fields.
|
|
87
85
|
*
|
|
88
86
|
* @param input - The bitmark source text.
|
|
89
87
|
* @param options - Parse options (e.g. `{ mode: "full" }`).
|
|
90
|
-
* @returns JSON string of
|
|
88
|
+
* @returns JSON string array of structured parsed entries.
|
|
91
89
|
*/
|
|
92
90
|
declare function parse(input: string, options?: ParseOptions): string;
|
|
93
91
|
/**
|
|
@@ -95,7 +93,8 @@ declare function parse(input: string, options?: ParseOptions): string;
|
|
|
95
93
|
*
|
|
96
94
|
* @param input - Bitmark or JSON input text.
|
|
97
95
|
* @param options - Convert options (e.g. `{ mode: "full", warnings: true }`).
|
|
98
|
-
* @returns Converted output string.
|
|
96
|
+
* @returns Converted output string. For bitmark input, this is a JSON string
|
|
97
|
+
* array of structured parsed entries (`bit`, `parser`, `bitmark`).
|
|
99
98
|
*/
|
|
100
99
|
declare function convert(input: string, options?: ConvertOptions): string;
|
|
101
100
|
/**
|
package/dist/index.d.ts
CHANGED
|
@@ -9,13 +9,9 @@ type OutputMode = "optimized" | "full";
|
|
|
9
9
|
* Lexer stage selector.
|
|
10
10
|
*
|
|
11
11
|
* - `"lex"` — combined lexer, text output (default).
|
|
12
|
-
* - `"lex-bitmark"` — bitmark-level only, text output.
|
|
13
|
-
* - `"lex-text"` — text-level only, text output.
|
|
14
12
|
* - `"lex-json"` — combined lexer, JSON array output.
|
|
15
|
-
* - `"lex-bitmark-json"` — bitmark-level only, JSON array output.
|
|
16
|
-
* - `"lex-text-json"` — text-level only, JSON array output.
|
|
17
13
|
*/
|
|
18
|
-
type LexStage = "lex" | "lex-
|
|
14
|
+
type LexStage = "lex" | "lex-json";
|
|
19
15
|
/** Options for the {@link lex} function. */
|
|
20
16
|
interface LexOptions {
|
|
21
17
|
/** Selects the lexer pipeline stage (default: `"lex"`). */
|
|
@@ -30,7 +26,7 @@ interface ParseOptions {
|
|
|
30
26
|
interface ConvertOptions {
|
|
31
27
|
/** JSON output mode (default: `"optimized"`). */
|
|
32
28
|
mode?: OutputMode;
|
|
33
|
-
/** Include validation warnings in output (default: `false`). */
|
|
29
|
+
/** Include validation warnings in `parser.warnings` output (default: `false`). */
|
|
34
30
|
warnings?: boolean;
|
|
35
31
|
/** Output text as plain text — debug mode (default: `false`). */
|
|
36
32
|
plainText?: boolean;
|
|
@@ -78,16 +74,18 @@ declare function version(): string;
|
|
|
78
74
|
* Lex bitmark input text, returning one line per token.
|
|
79
75
|
*
|
|
80
76
|
* @param input - The bitmark source text.
|
|
81
|
-
* @param options - Lex options (e.g. `{ stage: "lex
|
|
77
|
+
* @param options - Lex options (e.g. `{ stage: "lex" }`).
|
|
82
78
|
* @returns Token dump string (one token per line).
|
|
83
79
|
*/
|
|
84
80
|
declare function lex(input: string, options?: LexOptions): string;
|
|
85
81
|
/**
|
|
86
|
-
* Parse bitmark input text and return
|
|
82
|
+
* Parse bitmark input text and return structured JSON entries.
|
|
83
|
+
*
|
|
84
|
+
* Each entry contains `bit`, `parser`, and `bitmark` fields.
|
|
87
85
|
*
|
|
88
86
|
* @param input - The bitmark source text.
|
|
89
87
|
* @param options - Parse options (e.g. `{ mode: "full" }`).
|
|
90
|
-
* @returns JSON string of
|
|
88
|
+
* @returns JSON string array of structured parsed entries.
|
|
91
89
|
*/
|
|
92
90
|
declare function parse(input: string, options?: ParseOptions): string;
|
|
93
91
|
/**
|
|
@@ -95,7 +93,8 @@ declare function parse(input: string, options?: ParseOptions): string;
|
|
|
95
93
|
*
|
|
96
94
|
* @param input - Bitmark or JSON input text.
|
|
97
95
|
* @param options - Convert options (e.g. `{ mode: "full", warnings: true }`).
|
|
98
|
-
* @returns Converted output string.
|
|
96
|
+
* @returns Converted output string. For bitmark input, this is a JSON string
|
|
97
|
+
* array of structured parsed entries (`bit`, `parser`, `bitmark`).
|
|
99
98
|
*/
|
|
100
99
|
declare function convert(input: string, options?: ConvertOptions): string;
|
|
101
100
|
/**
|
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.
|
|
7
|
+
"version": "3.0.2",
|
|
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."
|
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\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions } from \"./types.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat } from \"./types.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 options - Lex options (e.g. `{ stage: \"lex
|
|
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\";\nimport type { LexOptions, ParseOptions, ConvertOptions, BreakscapeOptions, InfoOptions } from \"./types.js\";\nconst require = createRequire(import.meta.url);\nconst wasm = require(\"../wasm/bitmark_wasm.js\") as typeof import(\"../wasm/bitmark_wasm.js\");\n\nexport type { LexOptions, LexStage, ParseOptions, ConvertOptions, OutputMode, BreakscapeOptions, TextFormat, TextLocation, InfoOptions, InfoType, InfoFormat } from \"./types.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 options - Lex options (e.g. `{ stage: \"lex\" }`).\n * @returns Token dump string (one token per line).\n */\nexport function lex(input: string, options: LexOptions = {}): string {\n return wasm.lex(input, options.stage ?? \"lex\");\n}\n\n/**\n * Parse bitmark input text and return structured JSON entries.\n *\n * Each entry contains `bit`, `parser`, and `bitmark` fields.\n *\n * @param input - The bitmark source text.\n * @param options - Parse options (e.g. `{ mode: \"full\" }`).\n * @returns JSON string array of structured parsed entries.\n */\nexport function parse(input: string, options: ParseOptions = {}): string {\n return wasm.parse(input, options.mode ?? \"optimized\");\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 options - Convert options (e.g. `{ mode: \"full\", warnings: true }`).\n * @returns Converted output string. For bitmark input, this is a JSON string\n * array of structured parsed entries (`bit`, `parser`, `bitmark`).\n */\nexport function convert(input: string, options: ConvertOptions = {}): string {\n return wasm.convert(input, options.mode ?? \"optimized\", options.warnings ?? false, options.plainText ?? false, options.pretty ?? false, options.indent ?? 2);\n}\n\n/**\n * Breakscape text (escape bitmark special characters).\n *\n * @param input - The text to breakscape.\n * @param options - Breakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Breakscaped text.\n */\nexport function breakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\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 options - Unbreakscape options (e.g. `{ format: \"plainText\", location: \"tag\" }`).\n * @returns Unbreakscaped text.\n */\nexport function unbreakscapeText(input: string, options: BreakscapeOptions = {}): string {\n const format = options.format ?? \"bitmark++\";\n const location = options.location ?? \"body\";\n return wasm.unbreakscape_text(input, format, location);\n}\n\n/**\n * Query information about supported bit types.\n *\n * @param options - Info options (e.g. `{ infoType: \"bit\", format: \"json\", bit: \"cloze\" }`).\n * @returns Information string.\n */\nexport function info(options: InfoOptions = {}): string {\n const infoType = options.infoType ?? \"list\";\n const format = options.format ?? \"text\";\n const bit = options.bit ?? \"\";\n const pretty = options.pretty ?? false;\n const indent = options.indent ?? 2;\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.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"],"mappings":";AAEA,SAAS,qBAAqB;;;ACEvB,IAAM,eAAe;AAAA,EAC1B,QAAQ;AAAA,EACR,WAAW;AAAA,EACX,UAAU;AAAA,EACV,WAAW;AAAA,EACX,eAAe;AACjB;;;ADLA,IAAMA,WAAU,cAAc,YAAY,GAAG;AAC7C,IAAM,OAAOA,SAAQ,yBAAyB;AASvC,SAAS,UAAkB;AAChC,SAAO,aAAa;AACtB;AASO,SAAS,IAAI,OAAe,UAAsB,CAAC,GAAW;AACnE,SAAO,KAAK,IAAI,OAAO,QAAQ,SAAS,KAAK;AAC/C;AAWO,SAAS,MAAM,OAAe,UAAwB,CAAC,GAAW;AACvE,SAAO,KAAK,MAAM,OAAO,QAAQ,QAAQ,WAAW;AACtD;AAUO,SAAS,QAAQ,OAAe,UAA0B,CAAC,GAAW;AAC3E,SAAO,KAAK,QAAQ,OAAO,QAAQ,QAAQ,aAAa,QAAQ,YAAY,OAAO,QAAQ,aAAa,OAAO,QAAQ,UAAU,OAAO,QAAQ,UAAU,CAAC;AAC7J;AASO,SAAS,eAAe,OAAe,UAA6B,CAAC,GAAW;AACrF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,WAAW,QAAQ,YAAY;AACrC,SAAO,KAAK,gBAAgB,OAAO,QAAQ,QAAQ;AACrD;AASO,SAAS,iBAAiB,OAAe,UAA6B,CAAC,GAAW;AACvF,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,WAAW,QAAQ,YAAY;AACrC,SAAO,KAAK,kBAAkB,OAAO,QAAQ,QAAQ;AACvD;AAQO,SAAS,KAAK,UAAuB,CAAC,GAAW;AACtD,QAAM,WAAW,QAAQ,YAAY;AACrC,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,MAAM,QAAQ,OAAO;AAC3B,QAAM,SAAS,QAAQ,UAAU;AACjC,QAAM,SAAS,QAAQ,UAAU;AACjC,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
|
@@ -1,27 +1,21 @@
|
|
|
1
1
|
/* tslint:disable */
|
|
2
2
|
/* eslint-disable */
|
|
3
3
|
/**
|
|
4
|
-
*
|
|
4
|
+
* Lex bitmark input text, returning one line per token in the same format as
|
|
5
|
+
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
5
6
|
*
|
|
6
|
-
* `
|
|
7
|
-
* `
|
|
7
|
+
* `stage` selects the lexer pipeline:
|
|
8
|
+
* - `"lex"` — combined (default)
|
|
9
|
+
* - `"lex-json"` — combined, JSON array output
|
|
8
10
|
*/
|
|
9
|
-
export function
|
|
11
|
+
export function lex(input: string, stage: string): string;
|
|
10
12
|
/**
|
|
11
|
-
*
|
|
13
|
+
* Breakscape text (escape bitmark special characters).
|
|
12
14
|
*
|
|
13
15
|
* `format`: `"bitmark++"` (default) or `"plainText"`
|
|
14
16
|
* `location`: `"body"` (default) or `"tag"`
|
|
15
17
|
*/
|
|
16
|
-
export function
|
|
17
|
-
/**
|
|
18
|
-
* Parse bitmark input text and return the reference JSON format.
|
|
19
|
-
*
|
|
20
|
-
* Uses the full pipeline: parse → validate → serialize.
|
|
21
|
-
*
|
|
22
|
-
* `mode`: `"optimized"` (default) or `"full"`
|
|
23
|
-
*/
|
|
24
|
-
export function parse(input: string, mode: string): string;
|
|
18
|
+
export function breakscape_text(input: string, format: string, location: string): string;
|
|
25
19
|
/**
|
|
26
20
|
* Auto-detect input format and convert between bitmark and JSON.
|
|
27
21
|
*
|
|
@@ -46,15 +40,17 @@ export function convert(input: string, mode: string, warnings: boolean, plain_te
|
|
|
46
40
|
*/
|
|
47
41
|
export function info(info_type: string, format: string, bit: string, pretty: boolean, indent: number): string;
|
|
48
42
|
/**
|
|
49
|
-
*
|
|
50
|
-
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
43
|
+
* Unbreakscape text (unescape bitmark special characters).
|
|
51
44
|
*
|
|
52
|
-
* `
|
|
53
|
-
*
|
|
54
|
-
* - `"lex-bitmark"` — bitmark-level only
|
|
55
|
-
* - `"lex-text"` — text-level only
|
|
56
|
-
* - `"lex-json"` — combined, JSON array output
|
|
57
|
-
* - `"lex-bitmark-json"` — bitmark-level, JSON array output
|
|
58
|
-
* - `"lex-text-json"` — text-level, JSON array output
|
|
45
|
+
* `format`: `"bitmark++"` (default) or `"plainText"`
|
|
46
|
+
* `location`: `"body"` (default) or `"tag"`
|
|
59
47
|
*/
|
|
60
|
-
export function
|
|
48
|
+
export function unbreakscape_text(input: string, format: string, location: string): string;
|
|
49
|
+
/**
|
|
50
|
+
* Parse bitmark input text and return the reference JSON format.
|
|
51
|
+
*
|
|
52
|
+
* Uses the full pipeline: parse → validate → serialize.
|
|
53
|
+
*
|
|
54
|
+
* `mode`: `"optimized"` (default) or `"full"`
|
|
55
|
+
*/
|
|
56
|
+
export function parse(input: string, mode: string): string;
|
package/wasm/bitmark_wasm.js
CHANGED
|
@@ -86,40 +86,39 @@ function getStringFromWasm0(ptr, len) {
|
|
|
86
86
|
return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
|
|
87
87
|
}
|
|
88
88
|
/**
|
|
89
|
-
*
|
|
89
|
+
* Lex bitmark input text, returning one line per token in the same format as
|
|
90
|
+
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
90
91
|
*
|
|
91
|
-
* `
|
|
92
|
-
* `
|
|
92
|
+
* `stage` selects the lexer pipeline:
|
|
93
|
+
* - `"lex"` — combined (default)
|
|
94
|
+
* - `"lex-json"` — combined, JSON array output
|
|
93
95
|
* @param {string} input
|
|
94
|
-
* @param {string}
|
|
95
|
-
* @param {string} location
|
|
96
|
+
* @param {string} stage
|
|
96
97
|
* @returns {string}
|
|
97
98
|
*/
|
|
98
|
-
module.exports.
|
|
99
|
-
let
|
|
100
|
-
let
|
|
99
|
+
module.exports.lex = function(input, stage) {
|
|
100
|
+
let deferred3_0;
|
|
101
|
+
let deferred3_1;
|
|
101
102
|
try {
|
|
102
103
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
103
104
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
104
105
|
const len0 = WASM_VECTOR_LEN;
|
|
105
|
-
const ptr1 = passStringToWasm0(
|
|
106
|
+
const ptr1 = passStringToWasm0(stage, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
106
107
|
const len1 = WASM_VECTOR_LEN;
|
|
107
|
-
|
|
108
|
-
const len2 = WASM_VECTOR_LEN;
|
|
109
|
-
wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
108
|
+
wasm.lex(retptr, ptr0, len0, ptr1, len1);
|
|
110
109
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
111
110
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
112
|
-
|
|
113
|
-
|
|
111
|
+
deferred3_0 = r0;
|
|
112
|
+
deferred3_1 = r1;
|
|
114
113
|
return getStringFromWasm0(r0, r1);
|
|
115
114
|
} finally {
|
|
116
115
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
117
|
-
wasm.__wbindgen_export_2(
|
|
116
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
118
117
|
}
|
|
119
118
|
};
|
|
120
119
|
|
|
121
120
|
/**
|
|
122
|
-
*
|
|
121
|
+
* Breakscape text (escape bitmark special characters).
|
|
123
122
|
*
|
|
124
123
|
* `format`: `"bitmark++"` (default) or `"plainText"`
|
|
125
124
|
* `location`: `"body"` (default) or `"tag"`
|
|
@@ -128,7 +127,7 @@ module.exports.breakscape_text = function(input, format, location) {
|
|
|
128
127
|
* @param {string} location
|
|
129
128
|
* @returns {string}
|
|
130
129
|
*/
|
|
131
|
-
module.exports.
|
|
130
|
+
module.exports.breakscape_text = function(input, format, location) {
|
|
132
131
|
let deferred4_0;
|
|
133
132
|
let deferred4_1;
|
|
134
133
|
try {
|
|
@@ -139,7 +138,7 @@ module.exports.unbreakscape_text = function(input, format, location) {
|
|
|
139
138
|
const len1 = WASM_VECTOR_LEN;
|
|
140
139
|
const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
141
140
|
const len2 = WASM_VECTOR_LEN;
|
|
142
|
-
wasm.
|
|
141
|
+
wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
143
142
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
144
143
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
145
144
|
deferred4_0 = r0;
|
|
@@ -151,37 +150,6 @@ module.exports.unbreakscape_text = function(input, format, location) {
|
|
|
151
150
|
}
|
|
152
151
|
};
|
|
153
152
|
|
|
154
|
-
/**
|
|
155
|
-
* Parse bitmark input text and return the reference JSON format.
|
|
156
|
-
*
|
|
157
|
-
* Uses the full pipeline: parse → validate → serialize.
|
|
158
|
-
*
|
|
159
|
-
* `mode`: `"optimized"` (default) or `"full"`
|
|
160
|
-
* @param {string} input
|
|
161
|
-
* @param {string} mode
|
|
162
|
-
* @returns {string}
|
|
163
|
-
*/
|
|
164
|
-
module.exports.parse = function(input, mode) {
|
|
165
|
-
let deferred3_0;
|
|
166
|
-
let deferred3_1;
|
|
167
|
-
try {
|
|
168
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
169
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
170
|
-
const len0 = WASM_VECTOR_LEN;
|
|
171
|
-
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
172
|
-
const len1 = WASM_VECTOR_LEN;
|
|
173
|
-
wasm.parse(retptr, ptr0, len0, ptr1, len1);
|
|
174
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
175
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
176
|
-
deferred3_0 = r0;
|
|
177
|
-
deferred3_1 = r1;
|
|
178
|
-
return getStringFromWasm0(r0, r1);
|
|
179
|
-
} finally {
|
|
180
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
181
|
-
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
182
|
-
}
|
|
183
|
-
};
|
|
184
|
-
|
|
185
153
|
/**
|
|
186
154
|
* Auto-detect input format and convert between bitmark and JSON.
|
|
187
155
|
*
|
|
@@ -261,30 +229,58 @@ module.exports.info = function(info_type, format, bit, pretty, indent) {
|
|
|
261
229
|
};
|
|
262
230
|
|
|
263
231
|
/**
|
|
264
|
-
*
|
|
265
|
-
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
232
|
+
* Unbreakscape text (unescape bitmark special characters).
|
|
266
233
|
*
|
|
267
|
-
* `
|
|
268
|
-
*
|
|
269
|
-
* - `"lex-bitmark"` — bitmark-level only
|
|
270
|
-
* - `"lex-text"` — text-level only
|
|
271
|
-
* - `"lex-json"` — combined, JSON array output
|
|
272
|
-
* - `"lex-bitmark-json"` — bitmark-level, JSON array output
|
|
273
|
-
* - `"lex-text-json"` — text-level, JSON array output
|
|
234
|
+
* `format`: `"bitmark++"` (default) or `"plainText"`
|
|
235
|
+
* `location`: `"body"` (default) or `"tag"`
|
|
274
236
|
* @param {string} input
|
|
275
|
-
* @param {string}
|
|
237
|
+
* @param {string} format
|
|
238
|
+
* @param {string} location
|
|
276
239
|
* @returns {string}
|
|
277
240
|
*/
|
|
278
|
-
module.exports.
|
|
241
|
+
module.exports.unbreakscape_text = function(input, format, location) {
|
|
242
|
+
let deferred4_0;
|
|
243
|
+
let deferred4_1;
|
|
244
|
+
try {
|
|
245
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
246
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
247
|
+
const len0 = WASM_VECTOR_LEN;
|
|
248
|
+
const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
249
|
+
const len1 = WASM_VECTOR_LEN;
|
|
250
|
+
const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
251
|
+
const len2 = WASM_VECTOR_LEN;
|
|
252
|
+
wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
|
|
253
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
254
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
255
|
+
deferred4_0 = r0;
|
|
256
|
+
deferred4_1 = r1;
|
|
257
|
+
return getStringFromWasm0(r0, r1);
|
|
258
|
+
} finally {
|
|
259
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
260
|
+
wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
|
|
261
|
+
}
|
|
262
|
+
};
|
|
263
|
+
|
|
264
|
+
/**
|
|
265
|
+
* Parse bitmark input text and return the reference JSON format.
|
|
266
|
+
*
|
|
267
|
+
* Uses the full pipeline: parse → validate → serialize.
|
|
268
|
+
*
|
|
269
|
+
* `mode`: `"optimized"` (default) or `"full"`
|
|
270
|
+
* @param {string} input
|
|
271
|
+
* @param {string} mode
|
|
272
|
+
* @returns {string}
|
|
273
|
+
*/
|
|
274
|
+
module.exports.parse = function(input, mode) {
|
|
279
275
|
let deferred3_0;
|
|
280
276
|
let deferred3_1;
|
|
281
277
|
try {
|
|
282
278
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
283
279
|
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
284
280
|
const len0 = WASM_VECTOR_LEN;
|
|
285
|
-
const ptr1 = passStringToWasm0(
|
|
281
|
+
const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
286
282
|
const len1 = WASM_VECTOR_LEN;
|
|
287
|
-
wasm.
|
|
283
|
+
wasm.parse(retptr, ptr0, len0, ptr1, len1);
|
|
288
284
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
289
285
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
290
286
|
deferred3_0 = r0;
|
|
Binary file
|