@gmb/bitmark-parser 3.0.2 → 6.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -118,7 +118,45 @@ module.exports.lex = function(input, stage) {
118
118
  };
119
119
 
120
120
  /**
121
- * Breakscape text (escape bitmark special characters).
121
+ * Query information about supported bit types.
122
+ *
123
+ * `info_type`: `"list"`, `"bit"`, `"all"`, or `"deprecated"`
124
+ * `format`: `"text"` or `"json"`
125
+ * `bit`: bit name (required when `info_type` is `"bit"`)
126
+ * `pretty`: whether to pretty-print JSON output
127
+ * `indent`: indent size for pretty-printing (default: 2)
128
+ * @param {string} info_type
129
+ * @param {string} format
130
+ * @param {string} bit
131
+ * @param {boolean} pretty
132
+ * @param {number} indent
133
+ * @returns {string}
134
+ */
135
+ module.exports.info = function(info_type, format, bit, pretty, indent) {
136
+ let deferred4_0;
137
+ let deferred4_1;
138
+ try {
139
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
140
+ const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
141
+ const len0 = WASM_VECTOR_LEN;
142
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
143
+ const len1 = WASM_VECTOR_LEN;
144
+ const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
145
+ const len2 = WASM_VECTOR_LEN;
146
+ wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);
147
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
148
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
149
+ deferred4_0 = r0;
150
+ deferred4_1 = r1;
151
+ return getStringFromWasm0(r0, r1);
152
+ } finally {
153
+ wasm.__wbindgen_add_to_stack_pointer(16);
154
+ wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
155
+ }
156
+ };
157
+
158
+ /**
159
+ * Unbreakscape text (unescape bitmark special characters).
122
160
  *
123
161
  * `format`: `"bitmark++"` (default) or `"plainText"`
124
162
  * `location`: `"body"` (default) or `"tag"`
@@ -127,7 +165,7 @@ module.exports.lex = function(input, stage) {
127
165
  * @param {string} location
128
166
  * @returns {string}
129
167
  */
130
- module.exports.breakscape_text = function(input, format, location) {
168
+ module.exports.unbreakscape_text = function(input, format, location) {
131
169
  let deferred4_0;
132
170
  let deferred4_1;
133
171
  try {
@@ -138,7 +176,7 @@ module.exports.breakscape_text = function(input, format, location) {
138
176
  const len1 = WASM_VECTOR_LEN;
139
177
  const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
140
178
  const len2 = WASM_VECTOR_LEN;
141
- wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
179
+ wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
142
180
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
143
181
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
144
182
  deferred4_0 = r0;
@@ -151,25 +189,16 @@ module.exports.breakscape_text = function(input, format, location) {
151
189
  };
152
190
 
153
191
  /**
154
- * Auto-detect input format and convert between bitmark and JSON.
192
+ * Parse bitmark input text and return the reference JSON format.
155
193
  *
156
- * `mode`: `"optimized"` (default) or `"full"`
157
- * `warnings`: whether to include validation warnings (default: false)
158
- * `plain_text`: output text as plain text — debug mode (default: false)
159
- * `pretty`: prettify JSON output (default: false)
160
- * `indent`: indent size for pretty-printing (default: 2)
194
+ * Uses the full pipeline: parse → validate → serialize.
161
195
  *
162
- * Returns JSON if input is bitmark, or an error message if input is JSON
163
- * (generator not yet implemented).
196
+ * `mode`: `"optimized"` (default) or `"full"`
164
197
  * @param {string} input
165
198
  * @param {string} mode
166
- * @param {boolean} warnings
167
- * @param {boolean} plain_text
168
- * @param {boolean} pretty
169
- * @param {number} indent
170
199
  * @returns {string}
171
200
  */
172
- module.exports.convert = function(input, mode, warnings, plain_text, pretty, indent) {
201
+ module.exports.parse = function(input, mode) {
173
202
  let deferred3_0;
174
203
  let deferred3_1;
175
204
  try {
@@ -178,7 +207,7 @@ module.exports.convert = function(input, mode, warnings, plain_text, pretty, ind
178
207
  const len0 = WASM_VECTOR_LEN;
179
208
  const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
180
209
  const len1 = WASM_VECTOR_LEN;
181
- wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
210
+ wasm.parse(retptr, ptr0, len0, ptr1, len1);
182
211
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
183
212
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
184
213
  deferred3_0 = r0;
@@ -191,45 +220,47 @@ module.exports.convert = function(input, mode, warnings, plain_text, pretty, ind
191
220
  };
192
221
 
193
222
  /**
194
- * Query information about supported bit types.
223
+ * Auto-detect input format and convert between bitmark and JSON.
195
224
  *
196
- * `info_type`: `"list"`, `"bit"`, `"all"`, or `"deprecated"`
197
- * `format`: `"text"` or `"json"`
198
- * `bit`: bit name (required when `info_type` is `"bit"`)
199
- * `pretty`: whether to pretty-print JSON output
225
+ * `mode`: `"optimized"` (default) or `"full"`
226
+ * `warnings`: whether to include validation warnings (default: false)
227
+ * `plain_text`: output text as plain text — debug mode (default: false)
228
+ * `pretty`: prettify JSON output (default: false)
200
229
  * `indent`: indent size for pretty-printing (default: 2)
201
- * @param {string} info_type
202
- * @param {string} format
203
- * @param {string} bit
230
+ *
231
+ * Returns JSON if input is bitmark, or an error message if input is JSON
232
+ * (generator not yet implemented).
233
+ * @param {string} input
234
+ * @param {string} mode
235
+ * @param {boolean} warnings
236
+ * @param {boolean} plain_text
204
237
  * @param {boolean} pretty
205
238
  * @param {number} indent
206
239
  * @returns {string}
207
240
  */
208
- module.exports.info = function(info_type, format, bit, pretty, indent) {
209
- let deferred4_0;
210
- let deferred4_1;
241
+ module.exports.convert = function(input, mode, warnings, plain_text, pretty, indent) {
242
+ let deferred3_0;
243
+ let deferred3_1;
211
244
  try {
212
245
  const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
213
- const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
246
+ const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
214
247
  const len0 = WASM_VECTOR_LEN;
215
- const ptr1 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
248
+ const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
216
249
  const len1 = WASM_VECTOR_LEN;
217
- const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
218
- const len2 = WASM_VECTOR_LEN;
219
- wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent);
250
+ wasm.convert(retptr, ptr0, len0, ptr1, len1, warnings, plain_text, pretty, indent);
220
251
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
221
252
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
222
- deferred4_0 = r0;
223
- deferred4_1 = r1;
253
+ deferred3_0 = r0;
254
+ deferred3_1 = r1;
224
255
  return getStringFromWasm0(r0, r1);
225
256
  } finally {
226
257
  wasm.__wbindgen_add_to_stack_pointer(16);
227
- wasm.__wbindgen_export_2(deferred4_0, deferred4_1, 1);
258
+ wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
228
259
  }
229
260
  };
230
261
 
231
262
  /**
232
- * Unbreakscape text (unescape bitmark special characters).
263
+ * Breakscape text (escape bitmark special characters).
233
264
  *
234
265
  * `format`: `"bitmark++"` (default) or `"plainText"`
235
266
  * `location`: `"body"` (default) or `"tag"`
@@ -238,7 +269,7 @@ module.exports.info = function(info_type, format, bit, pretty, indent) {
238
269
  * @param {string} location
239
270
  * @returns {string}
240
271
  */
241
- module.exports.unbreakscape_text = function(input, format, location) {
272
+ module.exports.breakscape_text = function(input, format, location) {
242
273
  let deferred4_0;
243
274
  let deferred4_1;
244
275
  try {
@@ -249,7 +280,7 @@ module.exports.unbreakscape_text = function(input, format, location) {
249
280
  const len1 = WASM_VECTOR_LEN;
250
281
  const ptr2 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
251
282
  const len2 = WASM_VECTOR_LEN;
252
- wasm.unbreakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
283
+ wasm.breakscape_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2);
253
284
  var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
254
285
  var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
255
286
  deferred4_0 = r0;
@@ -261,37 +292,6 @@ module.exports.unbreakscape_text = function(input, format, location) {
261
292
  }
262
293
  };
263
294
 
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) {
275
- let deferred3_0;
276
- let deferred3_1;
277
- try {
278
- const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
279
- const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
280
- const len0 = WASM_VECTOR_LEN;
281
- const ptr1 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
282
- const len1 = WASM_VECTOR_LEN;
283
- wasm.parse(retptr, ptr0, len0, ptr1, len1);
284
- var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
285
- var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
286
- deferred3_0 = r0;
287
- deferred3_1 = r1;
288
- return getStringFromWasm0(r0, r1);
289
- } finally {
290
- wasm.__wbindgen_add_to_stack_pointer(16);
291
- wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
292
- }
293
- };
294
-
295
295
  const path = require('path').join(__dirname, 'bitmark_wasm_bg.wasm');
296
296
  const bytes = require('fs').readFileSync(path);
297
297
 
Binary file
package/wasm/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "Get More Brain Ltd <info@getmorebrain.com>"
5
5
  ],
6
6
  "description": "WebAssembly bindings for the bitmark parser",
7
- "version": "3.0.2",
7
+ "version": "6.0.0",
8
8
  "license": "ISC",
9
9
  "repository": {
10
10
  "type": "git",