@gmb/bitmark-parser 6.10.1 → 6.11.1
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 +288 -22
- package/dist/browser/bitmark-parser.min.js +4 -4
- package/dist/browser/bitmark-parser.min.js.map +1 -1
- package/dist/browser/cjs/index.cjs +1053 -345
- package/dist/browser/cjs/index.cjs.map +1 -1
- package/dist/browser/cjs/index.d.cts +1175 -34
- package/dist/browser/esm/index.d.ts +1175 -34
- package/dist/browser/esm/index.js +1048 -345
- package/dist/browser/esm/index.js.map +1 -1
- package/dist/browser/esm/worker-entry.js +712 -96
- package/dist/browser/esm/worker-entry.js.map +1 -1
- package/dist/browser/wasm/bitmark_browser_full_wasm_bg.wasm +0 -0
- package/dist/browser/wasm/bitmark_json_wasm_bg.wasm +0 -0
- package/dist/browser/wasm/bitmark_wasm_bg.wasm +0 -0
- package/dist/index.cjs +124 -32
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +1175 -34
- package/dist/index.d.ts +1175 -34
- package/dist/index.js +119 -32
- package/dist/index.js.map +1 -1
- package/dist/legacy.cjs +4 -4
- package/dist/legacy.cjs.map +1 -1
- package/dist/legacy.js +4 -4
- package/dist/legacy.js.map +1 -1
- package/dist/worker-entry.cjs +7 -1
- package/dist/worker-entry.cjs.map +1 -1
- package/package.json +14 -8
- package/schema/bitmark.schema.json +2746 -573
- package/translations/translations.json +2940 -0
- package/wasm/bitmark_wasm.d.ts +53 -12
- package/wasm/bitmark_wasm.js +171 -47
- package/wasm/bitmark_wasm_bg.wasm +0 -0
- package/wasm/bitmark_wasm_bg.wasm.d.ts +4 -1
- package/wasm/package.json +1 -1
- package/wasm-bitmark-json/bitmark_json_wasm.d.ts +39 -12
- package/wasm-bitmark-json/bitmark_json_wasm.js +129 -53
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm +0 -0
- package/wasm-bitmark-json/bitmark_json_wasm_bg.wasm.d.ts +3 -1
- package/wasm-bitmark-json/package.json +1 -1
- package/wasm-browser-full/bitmark_browser_full_wasm.d.ts +149 -0
- package/wasm-browser-full/bitmark_browser_full_wasm.js +647 -0
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm +0 -0
- package/wasm-browser-full/bitmark_browser_full_wasm_bg.wasm.d.ts +23 -0
- package/wasm-browser-full/package.json +20 -0
- package/dist/browser/bitmark_json_wasm_bg.wasm +0 -0
- package/dist/browser/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/cjs/bitmark_json_wasm_bg.wasm +0 -0
- package/dist/browser/cjs/bitmark_wasm_bg.wasm +0 -0
- package/dist/browser/esm/bitmark_json_wasm_bg.wasm +0 -0
- package/dist/browser/esm/bitmark_wasm_bg.wasm +0 -0
|
@@ -154,7 +154,8 @@ module.exports.unbreakscape_text = function(input, format, location) {
|
|
|
154
154
|
/**
|
|
155
155
|
* Query information about supported bit types.
|
|
156
156
|
*
|
|
157
|
-
* `info_type`: `"list"`, `"bit"`, `"all"`,
|
|
157
|
+
* `info_type`: `"list"`, `"bit"`, `"all"`, `"deprecated"`, `"bit-groups"`,
|
|
158
|
+
* or `"resource-groups"`
|
|
158
159
|
* `format`: `"text"` or `"json"`
|
|
159
160
|
* `bit`: bit name (required when `info_type` is `"bit"`)
|
|
160
161
|
* `pretty`: whether to pretty-print JSON output
|
|
@@ -164,6 +165,8 @@ module.exports.unbreakscape_text = function(input, format, location) {
|
|
|
164
165
|
* `include_deprecated`)
|
|
165
166
|
* `full`: complete outline for `bit`/`all` (default is the compact
|
|
166
167
|
* one-line-per-tag view)
|
|
168
|
+
* `language`: BCP-47 tag(s) for display names — "" = English, `"de,fr"` for
|
|
169
|
+
* several (adds a `titles` map), `"all"` for every resolvable language
|
|
167
170
|
* @param {string} info_type
|
|
168
171
|
* @param {string} format
|
|
169
172
|
* @param {string} bit
|
|
@@ -172,11 +175,12 @@ module.exports.unbreakscape_text = function(input, format, location) {
|
|
|
172
175
|
* @param {boolean} include_deprecated
|
|
173
176
|
* @param {boolean} only_deprecated
|
|
174
177
|
* @param {boolean} full
|
|
178
|
+
* @param {string} language
|
|
175
179
|
* @returns {string}
|
|
176
180
|
*/
|
|
177
|
-
module.exports.info = function(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full) {
|
|
178
|
-
let
|
|
179
|
-
let
|
|
181
|
+
module.exports.info = function(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {
|
|
182
|
+
let deferred5_0;
|
|
183
|
+
let deferred5_1;
|
|
180
184
|
try {
|
|
181
185
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
182
186
|
const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -185,15 +189,132 @@ module.exports.info = function(info_type, format, bit, pretty, indent, include_d
|
|
|
185
189
|
const len1 = WASM_VECTOR_LEN;
|
|
186
190
|
const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
187
191
|
const len2 = WASM_VECTOR_LEN;
|
|
188
|
-
|
|
192
|
+
const ptr3 = passStringToWasm0(language, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
193
|
+
const len3 = WASM_VECTOR_LEN;
|
|
194
|
+
wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, include_deprecated, only_deprecated, full, ptr3, len3);
|
|
189
195
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
190
196
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
191
|
-
|
|
192
|
-
|
|
197
|
+
deferred5_0 = r0;
|
|
198
|
+
deferred5_1 = r1;
|
|
193
199
|
return getStringFromWasm0(r0, r1);
|
|
194
200
|
} finally {
|
|
195
201
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
196
|
-
wasm.__wbindgen_export_2(
|
|
202
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Register data with the parser process (PLAN-173 P12).
|
|
208
|
+
*
|
|
209
|
+
* `data_type`: `"translations"` today. One verb rather than one function per
|
|
210
|
+
* registerable thing — the same discriminated-options idiom as `info`.
|
|
211
|
+
*
|
|
212
|
+
* `data` is the file's own text. Semantics are REPLACE: a second call
|
|
213
|
+
* supersedes the first entirely, and the built-in table (where the variant
|
|
214
|
+
* bakes one) stays underneath. Returns `""` on success, or an
|
|
215
|
+
* `error:`-prefixed message — matching the other string-returning exports.
|
|
216
|
+
*
|
|
217
|
+
* Available in EVERY variant, including those that bake nothing: that is
|
|
218
|
+
* exactly where a consumer must supply the file themselves.
|
|
219
|
+
* @param {string} data_type
|
|
220
|
+
* @param {string} data
|
|
221
|
+
* @returns {string}
|
|
222
|
+
*/
|
|
223
|
+
module.exports.register = function(data_type, data) {
|
|
224
|
+
let deferred3_0;
|
|
225
|
+
let deferred3_1;
|
|
226
|
+
try {
|
|
227
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
228
|
+
const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
229
|
+
const len0 = WASM_VECTOR_LEN;
|
|
230
|
+
const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
231
|
+
const len1 = WASM_VECTOR_LEN;
|
|
232
|
+
wasm.register(retptr, ptr0, len0, ptr1, len1);
|
|
233
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
234
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
235
|
+
deferred3_0 = r0;
|
|
236
|
+
deferred3_1 = r1;
|
|
237
|
+
return getStringFromWasm0(r0, r1);
|
|
238
|
+
} finally {
|
|
239
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
240
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
241
|
+
}
|
|
242
|
+
};
|
|
243
|
+
|
|
244
|
+
/**
|
|
245
|
+
* Apply a patch (a JSON array of patch entries) to every bit and re-emit.
|
|
246
|
+
*
|
|
247
|
+
* `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
|
|
248
|
+
* `output_format_sel`: `"bitmark"` | `"json"` (default json).
|
|
249
|
+
* `patch_json`: the patch entry array (empty string = no patches, i.e. a
|
|
250
|
+
* canonicalizing pass). Parallelism is a JS-side concern (web workers); this
|
|
251
|
+
* runs sequentially. Returns the document text/JSON, or `error: …`.
|
|
252
|
+
* @param {string} input
|
|
253
|
+
* @param {string} input_format_sel
|
|
254
|
+
* @param {string} output_format_sel
|
|
255
|
+
* @param {string} mode
|
|
256
|
+
* @param {string} patch_json
|
|
257
|
+
* @param {boolean} pretty
|
|
258
|
+
* @param {number} indent
|
|
259
|
+
* @param {number} spaces_around_values
|
|
260
|
+
* @returns {string}
|
|
261
|
+
*/
|
|
262
|
+
module.exports.transform = function(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {
|
|
263
|
+
let deferred6_0;
|
|
264
|
+
let deferred6_1;
|
|
265
|
+
try {
|
|
266
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
267
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
268
|
+
const len0 = WASM_VECTOR_LEN;
|
|
269
|
+
const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
270
|
+
const len1 = WASM_VECTOR_LEN;
|
|
271
|
+
const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
272
|
+
const len2 = WASM_VECTOR_LEN;
|
|
273
|
+
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
274
|
+
const len3 = WASM_VECTOR_LEN;
|
|
275
|
+
const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
276
|
+
const len4 = WASM_VECTOR_LEN;
|
|
277
|
+
wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);
|
|
278
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
279
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
280
|
+
deferred6_0 = r0;
|
|
281
|
+
deferred6_1 = r1;
|
|
282
|
+
return getStringFromWasm0(r0, r1);
|
|
283
|
+
} finally {
|
|
284
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
285
|
+
wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
|
|
286
|
+
}
|
|
287
|
+
};
|
|
288
|
+
|
|
289
|
+
/**
|
|
290
|
+
* Resolve a patch document against `input` (bitmark or JSON) into the
|
|
291
|
+
* ordered output items, so a JS per-bit planner (hooks, worker pool) can
|
|
292
|
+
* reorder, drop and insert jobs from the one Rust implementation
|
|
293
|
+
* (PLAN-179). Returns a JSON array of
|
|
294
|
+
* `{ "source": <original index> | null, "bit": <inner bit> | null,
|
|
295
|
+
* "patch": [ … ] }`, or `error: …`.
|
|
296
|
+
* @param {string} input
|
|
297
|
+
* @param {string} patch_json
|
|
298
|
+
* @returns {string}
|
|
299
|
+
*/
|
|
300
|
+
module.exports.resolve_patch_document = function(input, patch_json) {
|
|
301
|
+
let deferred3_0;
|
|
302
|
+
let deferred3_1;
|
|
303
|
+
try {
|
|
304
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
305
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
306
|
+
const len0 = WASM_VECTOR_LEN;
|
|
307
|
+
const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
308
|
+
const len1 = WASM_VECTOR_LEN;
|
|
309
|
+
wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);
|
|
310
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
311
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
312
|
+
deferred3_0 = r0;
|
|
313
|
+
deferred3_1 = r1;
|
|
314
|
+
return getStringFromWasm0(r0, r1);
|
|
315
|
+
} finally {
|
|
316
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
317
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
197
318
|
}
|
|
198
319
|
};
|
|
199
320
|
|
|
@@ -436,51 +557,6 @@ module.exports.convert_text = function(input, direction, format, location) {
|
|
|
436
557
|
}
|
|
437
558
|
};
|
|
438
559
|
|
|
439
|
-
/**
|
|
440
|
-
* Apply a patch (a JSON array of patch entries) to every bit and re-emit.
|
|
441
|
-
*
|
|
442
|
-
* `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
|
|
443
|
-
* `output_format_sel`: `"bitmark"` | `"json"` (default json).
|
|
444
|
-
* `patch_json`: the patch entry array (empty string = no patches, i.e. a
|
|
445
|
-
* canonicalizing pass). Parallelism is a JS-side concern (web workers); this
|
|
446
|
-
* runs sequentially. Returns the document text/JSON, or `error: …`.
|
|
447
|
-
* @param {string} input
|
|
448
|
-
* @param {string} input_format_sel
|
|
449
|
-
* @param {string} output_format_sel
|
|
450
|
-
* @param {string} mode
|
|
451
|
-
* @param {string} patch_json
|
|
452
|
-
* @param {boolean} pretty
|
|
453
|
-
* @param {number} indent
|
|
454
|
-
* @param {number} spaces_around_values
|
|
455
|
-
* @returns {string}
|
|
456
|
-
*/
|
|
457
|
-
module.exports.transform = function(input, input_format_sel, output_format_sel, mode, patch_json, pretty, indent, spaces_around_values) {
|
|
458
|
-
let deferred6_0;
|
|
459
|
-
let deferred6_1;
|
|
460
|
-
try {
|
|
461
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
462
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
463
|
-
const len0 = WASM_VECTOR_LEN;
|
|
464
|
-
const ptr1 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
465
|
-
const len1 = WASM_VECTOR_LEN;
|
|
466
|
-
const ptr2 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
467
|
-
const len2 = WASM_VECTOR_LEN;
|
|
468
|
-
const ptr3 = passStringToWasm0(mode, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
469
|
-
const len3 = WASM_VECTOR_LEN;
|
|
470
|
-
const ptr4 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
471
|
-
const len4 = WASM_VECTOR_LEN;
|
|
472
|
-
wasm.transform(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, pretty, indent, spaces_around_values);
|
|
473
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
474
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
475
|
-
deferred6_0 = r0;
|
|
476
|
-
deferred6_1 = r1;
|
|
477
|
-
return getStringFromWasm0(r0, r1);
|
|
478
|
-
} finally {
|
|
479
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
480
|
-
wasm.__wbindgen_export_2(deferred6_0, deferred6_1, 1);
|
|
481
|
-
}
|
|
482
|
-
};
|
|
483
|
-
|
|
484
560
|
const path = require('path').join(__dirname, 'bitmark_json_wasm_bg.wasm');
|
|
485
561
|
const bytes = require('fs').readFileSync(path);
|
|
486
562
|
|
|
Binary file
|
|
@@ -6,9 +6,11 @@ export const canonicalize: (a: number, b: number, c: number, d: number, e: numbe
|
|
|
6
6
|
export const convert: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => void;
|
|
7
7
|
export const convert_text: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
8
8
|
export const count_bits: (a: number, b: number, c: number) => void;
|
|
9
|
-
export const info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
|
9
|
+
export const info: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => void;
|
|
10
10
|
export const is_bitmark: (a: number, b: number) => number;
|
|
11
11
|
export const prettify: (a: number, b: number, c: number, d: number) => void;
|
|
12
|
+
export const register: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
13
|
+
export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
12
14
|
export const split_bits: (a: number, b: number, c: number) => void;
|
|
13
15
|
export const split_json_bits: (a: number, b: number, c: number) => void;
|
|
14
16
|
export const transform: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number, m: number, n: number) => void;
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
/**
|
|
4
|
+
* Lex bitmark input text, returning one line per token in the same format as
|
|
5
|
+
* the Rust CLI: `{kind:?} {span:?} "{text}"`.
|
|
6
|
+
*
|
|
7
|
+
* `stage` selects the lexer pipeline:
|
|
8
|
+
* - `"lex"` — combined (default)
|
|
9
|
+
* - `"lex-json"` — combined, JSON array output
|
|
10
|
+
*/
|
|
11
|
+
export function lex(input: string, stage: string): string;
|
|
12
|
+
/**
|
|
13
|
+
* Breakscape text (escape bitmark special characters).
|
|
14
|
+
*
|
|
15
|
+
* `format`: `"bitmark++"` (default) or `"plainText"`
|
|
16
|
+
* `location`: `"body"` (default) or `"tag"`
|
|
17
|
+
*/
|
|
18
|
+
export function breakscape_text(input: string, format: string, location: string): string;
|
|
19
|
+
/**
|
|
20
|
+
* Unbreakscape text (unescape bitmark special characters).
|
|
21
|
+
*
|
|
22
|
+
* `format`: `"bitmark++"` (default) or `"plainText"`
|
|
23
|
+
* `location`: `"body"` (default) or `"tag"`
|
|
24
|
+
*/
|
|
25
|
+
export function unbreakscape_text(input: string, format: string, location: string): string;
|
|
26
|
+
/**
|
|
27
|
+
* Query information about supported bit types.
|
|
28
|
+
*
|
|
29
|
+
* `info_type`: `"list"`, `"bit"`, `"all"`, `"deprecated"`, `"bit-groups"`,
|
|
30
|
+
* or `"resource-groups"`
|
|
31
|
+
* `format`: `"text"` or `"json"`
|
|
32
|
+
* `bit`: bit name (required when `info_type` is `"bit"`)
|
|
33
|
+
* `pretty`: whether to pretty-print JSON output
|
|
34
|
+
* `indent`: indent size for pretty-printing (default: 2)
|
|
35
|
+
* `include_deprecated`: include deprecated bits in `list`/`all` (PLAN-149)
|
|
36
|
+
* `only_deprecated`: restrict `list`/`all` to deprecated bits (wins over
|
|
37
|
+
* `include_deprecated`)
|
|
38
|
+
* `full`: complete outline for `bit`/`all` (default is the compact
|
|
39
|
+
* one-line-per-tag view)
|
|
40
|
+
* `language`: BCP-47 tag(s) for display names — "" = English, `"de,fr"` for
|
|
41
|
+
* several (adds a `titles` map), `"all"` for every resolvable language
|
|
42
|
+
*/
|
|
43
|
+
export function info(info_type: string, format: string, bit: string, pretty: boolean, indent: number, include_deprecated: boolean, only_deprecated: boolean, full: boolean, language: string): string;
|
|
44
|
+
/**
|
|
45
|
+
* Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
|
|
46
|
+
*
|
|
47
|
+
* `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
|
|
48
|
+
* `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
|
|
49
|
+
* inline marks; anything else is treated as plain text (textToAst only).
|
|
50
|
+
* `location`: `"body"` (default) or `"tag"`.
|
|
51
|
+
* Returns the converted fragment, or `error: …`.
|
|
52
|
+
*/
|
|
53
|
+
export function convert_text(input: string, direction: string, format: string, location: string): string;
|
|
54
|
+
/**
|
|
55
|
+
* Apply a patch (a JSON array of patch entries) to every bit and re-emit.
|
|
56
|
+
*
|
|
57
|
+
* `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
|
|
58
|
+
* `output_format_sel`: `"bitmark"` | `"json"` (default json).
|
|
59
|
+
* `patch_json`: the patch entry array (empty string = no patches, i.e. a
|
|
60
|
+
* canonicalizing pass). Parallelism is a JS-side concern (web workers); this
|
|
61
|
+
* runs sequentially. Returns the document text/JSON, or `error: …`.
|
|
62
|
+
*/
|
|
63
|
+
export function transform(input: string, input_format_sel: string, output_format_sel: string, mode: string, patch_json: string, pretty: boolean, indent: number, spaces_around_values: number): string;
|
|
64
|
+
/**
|
|
65
|
+
* Resolve a patch document against `input` (bitmark or JSON) into the
|
|
66
|
+
* ordered output items, so a JS per-bit planner (hooks, worker pool) can
|
|
67
|
+
* reorder, drop and insert jobs from the one Rust implementation
|
|
68
|
+
* (PLAN-179). Returns a JSON array of
|
|
69
|
+
* `{ "source": <original index> | null, "bit": <inner bit> | null,
|
|
70
|
+
* "patch": [ … ] }`, or `error: …`.
|
|
71
|
+
*/
|
|
72
|
+
export function resolve_patch_document(input: string, patch_json: string): string;
|
|
73
|
+
/**
|
|
74
|
+
* Semantic diff of two documents (PLAN-179). Flat arguments like every
|
|
75
|
+
* other export:
|
|
76
|
+
* - `input_format`: `"auto"` | `"bitmark"` | `"json"` | a mapping id,
|
|
77
|
+
* applied to both sides;
|
|
78
|
+
* - `output_format`: `"bitmark"` (unified-style text) | `"json"` |
|
|
79
|
+
* `"patch"`;
|
|
80
|
+
* - `context`, `locate`, `similarity`, `bbox_tolerance`,
|
|
81
|
+
* `spaces_around_values` as documented on `DiffOptions`.
|
|
82
|
+
* Returns the diff (empty text / `[]` of unchanged bits / a patch document
|
|
83
|
+
* with no entries when the documents are semantically equal), or
|
|
84
|
+
* `error: …`.
|
|
85
|
+
*/
|
|
86
|
+
export function diff(a: string, b: string, input_format_sel: string, output_format_sel: string, context: number, locate: boolean, similarity: number, bbox_tolerance: number, spaces_around_values: number): string;
|
|
87
|
+
/**
|
|
88
|
+
* Register data with the parser process (PLAN-173 P12).
|
|
89
|
+
*
|
|
90
|
+
* `data_type`: `"translations"` today. One verb rather than one function per
|
|
91
|
+
* registerable thing — the same discriminated-options idiom as `info`.
|
|
92
|
+
*
|
|
93
|
+
* `data` is the file's own text. Semantics are REPLACE: a second call
|
|
94
|
+
* supersedes the first entirely, and the built-in table (where the variant
|
|
95
|
+
* bakes one) stays underneath. Returns `""` on success, or an
|
|
96
|
+
* `error:`-prefixed message — matching the other string-returning exports.
|
|
97
|
+
*
|
|
98
|
+
* Available in EVERY variant, including those that bake nothing: that is
|
|
99
|
+
* exactly where a consumer must supply the file themselves.
|
|
100
|
+
*/
|
|
101
|
+
export function register(data_type: string, data: string): string;
|
|
102
|
+
/**
|
|
103
|
+
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
104
|
+
*
|
|
105
|
+
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"`.
|
|
106
|
+
* `output_format`: `"auto"` (opposite of input) | `"bitmark"` | `"json"`.
|
|
107
|
+
* `mode`: `"optimized"` (default) | `"full"`.
|
|
108
|
+
* `mapping_report`: replace the output with a human-readable report of the
|
|
109
|
+
* input→output mappings, including inputs that are NOT mapped (PLAN-147).
|
|
110
|
+
* Returns the converted text/JSON, or a string prefixed `error:` on failure.
|
|
111
|
+
*/
|
|
112
|
+
export function convert(input: string, input_format_sel: string, output_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number, include_unknown_properties: boolean, mapping_report: boolean): string;
|
|
113
|
+
/**
|
|
114
|
+
* Re-emit input in its own format in canonical form at `mode`.
|
|
115
|
+
*
|
|
116
|
+
* `input_format`: `"auto"` (default) | `"bitmark"` | `"json"` | any config
|
|
117
|
+
* mapping id (`html`, `xml`, …). The output is re-emitted in this same format.
|
|
118
|
+
*/
|
|
119
|
+
export function canonicalize(input: string, input_format_sel: string, mode: string, pretty: boolean, indent: number, spaces_around_values: number): string;
|
|
120
|
+
/**
|
|
121
|
+
* Count the bits in `input` (auto-detecting bitmark vs JSON).
|
|
122
|
+
* Returns the count as a decimal string, or `error: …`.
|
|
123
|
+
*/
|
|
124
|
+
export function count_bits(input: string): string;
|
|
125
|
+
/**
|
|
126
|
+
* Split a bitmark document into per-bit source slices.
|
|
127
|
+
*
|
|
128
|
+
* Returns a JSON array of `{ index, byteStart, byteEnd, source }`. Lets a JS
|
|
129
|
+
* caller chunk a document at bit boundaries (e.g. to feed a worker pool).
|
|
130
|
+
*/
|
|
131
|
+
export function split_bits(input: string): string;
|
|
132
|
+
/**
|
|
133
|
+
* Whether `input` looks like bitmark (vs JSON). Mirrors the auto-detection
|
|
134
|
+
* used across the API so a JS caller can resolve `"auto"` consistently.
|
|
135
|
+
*/
|
|
136
|
+
export function is_bitmark(input: string): boolean;
|
|
137
|
+
/**
|
|
138
|
+
* Split a JSON document (a top-level array of bit envelopes) into its per-bit
|
|
139
|
+
* envelope objects, returned as a JSON array string. Lets a JS caller iterate
|
|
140
|
+
* JSON-input bits for per-bit hooks (the JSON counterpart of [`split_bits`]).
|
|
141
|
+
* Returns `error: …` if the input is not a JSON array of bits.
|
|
142
|
+
*/
|
|
143
|
+
export function split_json_bits(input: string): string;
|
|
144
|
+
/**
|
|
145
|
+
* Pretty-print a compact JSON string with the given indent. Used to format a
|
|
146
|
+
* document recombined on the JS side (the per-bit hook path) so its output
|
|
147
|
+
* matches the in-Rust recombination byte-for-byte.
|
|
148
|
+
*/
|
|
149
|
+
export function prettify(json: string, indent: number): string;
|