@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
package/wasm/bitmark_wasm.d.ts
CHANGED
|
@@ -26,7 +26,8 @@ export function unbreakscape_text(input: string, format: string, location: strin
|
|
|
26
26
|
/**
|
|
27
27
|
* Query information about supported bit types.
|
|
28
28
|
*
|
|
29
|
-
* `info_type`: `"list"`, `"bit"`, `"all"`,
|
|
29
|
+
* `info_type`: `"list"`, `"bit"`, `"all"`, `"deprecated"`, `"bit-groups"`,
|
|
30
|
+
* or `"resource-groups"`
|
|
30
31
|
* `format`: `"text"` or `"json"`
|
|
31
32
|
* `bit`: bit name (required when `info_type` is `"bit"`)
|
|
32
33
|
* `pretty`: whether to pretty-print JSON output
|
|
@@ -36,8 +37,20 @@ export function unbreakscape_text(input: string, format: string, location: strin
|
|
|
36
37
|
* `include_deprecated`)
|
|
37
38
|
* `full`: complete outline for `bit`/`all` (default is the compact
|
|
38
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
|
|
39
42
|
*/
|
|
40
|
-
export function info(info_type: string, format: string, bit: string, pretty: boolean, indent: number, include_deprecated: boolean, only_deprecated: boolean, full: boolean): string;
|
|
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;
|
|
41
54
|
/**
|
|
42
55
|
* Apply a patch (a JSON array of patch entries) to every bit and re-emit.
|
|
43
56
|
*
|
|
@@ -48,6 +61,44 @@ export function info(info_type: string, format: string, bit: string, pretty: boo
|
|
|
48
61
|
* runs sequentially. Returns the document text/JSON, or `error: …`.
|
|
49
62
|
*/
|
|
50
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;
|
|
51
102
|
/**
|
|
52
103
|
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
53
104
|
*
|
|
@@ -96,13 +147,3 @@ export function split_json_bits(input: string): string;
|
|
|
96
147
|
* matches the in-Rust recombination byte-for-byte.
|
|
97
148
|
*/
|
|
98
149
|
export function prettify(json: string, indent: number): string;
|
|
99
|
-
/**
|
|
100
|
-
* Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
|
|
101
|
-
*
|
|
102
|
-
* `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
|
|
103
|
-
* `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
|
|
104
|
-
* inline marks; anything else is treated as plain text (textToAst only).
|
|
105
|
-
* `location`: `"body"` (default) or `"tag"`.
|
|
106
|
-
* Returns the converted fragment, or `error: …`.
|
|
107
|
-
*/
|
|
108
|
-
export function convert_text(input: string, direction: string, format: string, location: string): string;
|
package/wasm/bitmark_wasm.js
CHANGED
|
@@ -186,7 +186,8 @@ module.exports.unbreakscape_text = function(input, format, location) {
|
|
|
186
186
|
/**
|
|
187
187
|
* Query information about supported bit types.
|
|
188
188
|
*
|
|
189
|
-
* `info_type`: `"list"`, `"bit"`, `"all"`,
|
|
189
|
+
* `info_type`: `"list"`, `"bit"`, `"all"`, `"deprecated"`, `"bit-groups"`,
|
|
190
|
+
* or `"resource-groups"`
|
|
190
191
|
* `format`: `"text"` or `"json"`
|
|
191
192
|
* `bit`: bit name (required when `info_type` is `"bit"`)
|
|
192
193
|
* `pretty`: whether to pretty-print JSON output
|
|
@@ -196,6 +197,8 @@ module.exports.unbreakscape_text = function(input, format, location) {
|
|
|
196
197
|
* `include_deprecated`)
|
|
197
198
|
* `full`: complete outline for `bit`/`all` (default is the compact
|
|
198
199
|
* one-line-per-tag view)
|
|
200
|
+
* `language`: BCP-47 tag(s) for display names — "" = English, `"de,fr"` for
|
|
201
|
+
* several (adds a `titles` map), `"all"` for every resolvable language
|
|
199
202
|
* @param {string} info_type
|
|
200
203
|
* @param {string} format
|
|
201
204
|
* @param {string} bit
|
|
@@ -204,11 +207,12 @@ module.exports.unbreakscape_text = function(input, format, location) {
|
|
|
204
207
|
* @param {boolean} include_deprecated
|
|
205
208
|
* @param {boolean} only_deprecated
|
|
206
209
|
* @param {boolean} full
|
|
210
|
+
* @param {string} language
|
|
207
211
|
* @returns {string}
|
|
208
212
|
*/
|
|
209
|
-
module.exports.info = function(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full) {
|
|
210
|
-
let
|
|
211
|
-
let
|
|
213
|
+
module.exports.info = function(info_type, format, bit, pretty, indent, include_deprecated, only_deprecated, full, language) {
|
|
214
|
+
let deferred5_0;
|
|
215
|
+
let deferred5_1;
|
|
212
216
|
try {
|
|
213
217
|
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
214
218
|
const ptr0 = passStringToWasm0(info_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
@@ -217,15 +221,56 @@ module.exports.info = function(info_type, format, bit, pretty, indent, include_d
|
|
|
217
221
|
const len1 = WASM_VECTOR_LEN;
|
|
218
222
|
const ptr2 = passStringToWasm0(bit, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
219
223
|
const len2 = WASM_VECTOR_LEN;
|
|
220
|
-
|
|
224
|
+
const ptr3 = passStringToWasm0(language, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
225
|
+
const len3 = WASM_VECTOR_LEN;
|
|
226
|
+
wasm.info(retptr, ptr0, len0, ptr1, len1, ptr2, len2, pretty, indent, include_deprecated, only_deprecated, full, ptr3, len3);
|
|
221
227
|
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
222
228
|
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
223
|
-
|
|
224
|
-
|
|
229
|
+
deferred5_0 = r0;
|
|
230
|
+
deferred5_1 = r1;
|
|
225
231
|
return getStringFromWasm0(r0, r1);
|
|
226
232
|
} finally {
|
|
227
233
|
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
228
|
-
wasm.__wbindgen_export_2(
|
|
234
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
235
|
+
}
|
|
236
|
+
};
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
|
|
240
|
+
*
|
|
241
|
+
* `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
|
|
242
|
+
* `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
|
|
243
|
+
* inline marks; anything else is treated as plain text (textToAst only).
|
|
244
|
+
* `location`: `"body"` (default) or `"tag"`.
|
|
245
|
+
* Returns the converted fragment, or `error: …`.
|
|
246
|
+
* @param {string} input
|
|
247
|
+
* @param {string} direction
|
|
248
|
+
* @param {string} format
|
|
249
|
+
* @param {string} location
|
|
250
|
+
* @returns {string}
|
|
251
|
+
*/
|
|
252
|
+
module.exports.convert_text = function(input, direction, format, location) {
|
|
253
|
+
let deferred5_0;
|
|
254
|
+
let deferred5_1;
|
|
255
|
+
try {
|
|
256
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
257
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
258
|
+
const len0 = WASM_VECTOR_LEN;
|
|
259
|
+
const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
260
|
+
const len1 = WASM_VECTOR_LEN;
|
|
261
|
+
const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
262
|
+
const len2 = WASM_VECTOR_LEN;
|
|
263
|
+
const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
264
|
+
const len3 = WASM_VECTOR_LEN;
|
|
265
|
+
wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
266
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
267
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
268
|
+
deferred5_0 = r0;
|
|
269
|
+
deferred5_1 = r1;
|
|
270
|
+
return getStringFromWasm0(r0, r1);
|
|
271
|
+
} finally {
|
|
272
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
273
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
229
274
|
}
|
|
230
275
|
};
|
|
231
276
|
|
|
@@ -274,6 +319,124 @@ module.exports.transform = function(input, input_format_sel, output_format_sel,
|
|
|
274
319
|
}
|
|
275
320
|
};
|
|
276
321
|
|
|
322
|
+
/**
|
|
323
|
+
* Resolve a patch document against `input` (bitmark or JSON) into the
|
|
324
|
+
* ordered output items, so a JS per-bit planner (hooks, worker pool) can
|
|
325
|
+
* reorder, drop and insert jobs from the one Rust implementation
|
|
326
|
+
* (PLAN-179). Returns a JSON array of
|
|
327
|
+
* `{ "source": <original index> | null, "bit": <inner bit> | null,
|
|
328
|
+
* "patch": [ … ] }`, or `error: …`.
|
|
329
|
+
* @param {string} input
|
|
330
|
+
* @param {string} patch_json
|
|
331
|
+
* @returns {string}
|
|
332
|
+
*/
|
|
333
|
+
module.exports.resolve_patch_document = function(input, patch_json) {
|
|
334
|
+
let deferred3_0;
|
|
335
|
+
let deferred3_1;
|
|
336
|
+
try {
|
|
337
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
338
|
+
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
339
|
+
const len0 = WASM_VECTOR_LEN;
|
|
340
|
+
const ptr1 = passStringToWasm0(patch_json, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
341
|
+
const len1 = WASM_VECTOR_LEN;
|
|
342
|
+
wasm.resolve_patch_document(retptr, ptr0, len0, ptr1, len1);
|
|
343
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
344
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
345
|
+
deferred3_0 = r0;
|
|
346
|
+
deferred3_1 = r1;
|
|
347
|
+
return getStringFromWasm0(r0, r1);
|
|
348
|
+
} finally {
|
|
349
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
350
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
|
|
354
|
+
/**
|
|
355
|
+
* Semantic diff of two documents (PLAN-179). Flat arguments like every
|
|
356
|
+
* other export:
|
|
357
|
+
* - `input_format`: `"auto"` | `"bitmark"` | `"json"` | a mapping id,
|
|
358
|
+
* applied to both sides;
|
|
359
|
+
* - `output_format`: `"bitmark"` (unified-style text) | `"json"` |
|
|
360
|
+
* `"patch"`;
|
|
361
|
+
* - `context`, `locate`, `similarity`, `bbox_tolerance`,
|
|
362
|
+
* `spaces_around_values` as documented on `DiffOptions`.
|
|
363
|
+
* Returns the diff (empty text / `[]` of unchanged bits / a patch document
|
|
364
|
+
* with no entries when the documents are semantically equal), or
|
|
365
|
+
* `error: …`.
|
|
366
|
+
* @param {string} a
|
|
367
|
+
* @param {string} b
|
|
368
|
+
* @param {string} input_format_sel
|
|
369
|
+
* @param {string} output_format_sel
|
|
370
|
+
* @param {number} context
|
|
371
|
+
* @param {boolean} locate
|
|
372
|
+
* @param {number} similarity
|
|
373
|
+
* @param {number} bbox_tolerance
|
|
374
|
+
* @param {number} spaces_around_values
|
|
375
|
+
* @returns {string}
|
|
376
|
+
*/
|
|
377
|
+
module.exports.diff = function(a, b, input_format_sel, output_format_sel, context, locate, similarity, bbox_tolerance, spaces_around_values) {
|
|
378
|
+
let deferred5_0;
|
|
379
|
+
let deferred5_1;
|
|
380
|
+
try {
|
|
381
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
382
|
+
const ptr0 = passStringToWasm0(a, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
383
|
+
const len0 = WASM_VECTOR_LEN;
|
|
384
|
+
const ptr1 = passStringToWasm0(b, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
385
|
+
const len1 = WASM_VECTOR_LEN;
|
|
386
|
+
const ptr2 = passStringToWasm0(input_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
387
|
+
const len2 = WASM_VECTOR_LEN;
|
|
388
|
+
const ptr3 = passStringToWasm0(output_format_sel, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
389
|
+
const len3 = WASM_VECTOR_LEN;
|
|
390
|
+
wasm.diff(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, context, locate, similarity, bbox_tolerance, spaces_around_values);
|
|
391
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
392
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
393
|
+
deferred5_0 = r0;
|
|
394
|
+
deferred5_1 = r1;
|
|
395
|
+
return getStringFromWasm0(r0, r1);
|
|
396
|
+
} finally {
|
|
397
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
398
|
+
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
399
|
+
}
|
|
400
|
+
};
|
|
401
|
+
|
|
402
|
+
/**
|
|
403
|
+
* Register data with the parser process (PLAN-173 P12).
|
|
404
|
+
*
|
|
405
|
+
* `data_type`: `"translations"` today. One verb rather than one function per
|
|
406
|
+
* registerable thing — the same discriminated-options idiom as `info`.
|
|
407
|
+
*
|
|
408
|
+
* `data` is the file's own text. Semantics are REPLACE: a second call
|
|
409
|
+
* supersedes the first entirely, and the built-in table (where the variant
|
|
410
|
+
* bakes one) stays underneath. Returns `""` on success, or an
|
|
411
|
+
* `error:`-prefixed message — matching the other string-returning exports.
|
|
412
|
+
*
|
|
413
|
+
* Available in EVERY variant, including those that bake nothing: that is
|
|
414
|
+
* exactly where a consumer must supply the file themselves.
|
|
415
|
+
* @param {string} data_type
|
|
416
|
+
* @param {string} data
|
|
417
|
+
* @returns {string}
|
|
418
|
+
*/
|
|
419
|
+
module.exports.register = function(data_type, data) {
|
|
420
|
+
let deferred3_0;
|
|
421
|
+
let deferred3_1;
|
|
422
|
+
try {
|
|
423
|
+
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
424
|
+
const ptr0 = passStringToWasm0(data_type, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
425
|
+
const len0 = WASM_VECTOR_LEN;
|
|
426
|
+
const ptr1 = passStringToWasm0(data, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
427
|
+
const len1 = WASM_VECTOR_LEN;
|
|
428
|
+
wasm.register(retptr, ptr0, len0, ptr1, len1);
|
|
429
|
+
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
430
|
+
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
431
|
+
deferred3_0 = r0;
|
|
432
|
+
deferred3_1 = r1;
|
|
433
|
+
return getStringFromWasm0(r0, r1);
|
|
434
|
+
} finally {
|
|
435
|
+
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
436
|
+
wasm.__wbindgen_export_2(deferred3_0, deferred3_1, 1);
|
|
437
|
+
}
|
|
438
|
+
};
|
|
439
|
+
|
|
277
440
|
/**
|
|
278
441
|
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
279
442
|
*
|
|
@@ -474,45 +637,6 @@ module.exports.prettify = function(json, indent) {
|
|
|
474
637
|
}
|
|
475
638
|
};
|
|
476
639
|
|
|
477
|
-
/**
|
|
478
|
-
* Convert a standalone bitmark text fragment ↔ TextAst (ProseMirror JSON).
|
|
479
|
-
*
|
|
480
|
-
* `direction`: `"textToAst"` | `"astToText"` | `"astToPlainText"`.
|
|
481
|
-
* `format`: a bitmark text format (`"bitmark++"`, `"bitmark+"`) parses
|
|
482
|
-
* inline marks; anything else is treated as plain text (textToAst only).
|
|
483
|
-
* `location`: `"body"` (default) or `"tag"`.
|
|
484
|
-
* Returns the converted fragment, or `error: …`.
|
|
485
|
-
* @param {string} input
|
|
486
|
-
* @param {string} direction
|
|
487
|
-
* @param {string} format
|
|
488
|
-
* @param {string} location
|
|
489
|
-
* @returns {string}
|
|
490
|
-
*/
|
|
491
|
-
module.exports.convert_text = function(input, direction, format, location) {
|
|
492
|
-
let deferred5_0;
|
|
493
|
-
let deferred5_1;
|
|
494
|
-
try {
|
|
495
|
-
const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
|
|
496
|
-
const ptr0 = passStringToWasm0(input, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
497
|
-
const len0 = WASM_VECTOR_LEN;
|
|
498
|
-
const ptr1 = passStringToWasm0(direction, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
499
|
-
const len1 = WASM_VECTOR_LEN;
|
|
500
|
-
const ptr2 = passStringToWasm0(format, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
501
|
-
const len2 = WASM_VECTOR_LEN;
|
|
502
|
-
const ptr3 = passStringToWasm0(location, wasm.__wbindgen_export_0, wasm.__wbindgen_export_1);
|
|
503
|
-
const len3 = WASM_VECTOR_LEN;
|
|
504
|
-
wasm.convert_text(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3);
|
|
505
|
-
var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
|
|
506
|
-
var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
|
|
507
|
-
deferred5_0 = r0;
|
|
508
|
-
deferred5_1 = r1;
|
|
509
|
-
return getStringFromWasm0(r0, r1);
|
|
510
|
-
} finally {
|
|
511
|
-
wasm.__wbindgen_add_to_stack_pointer(16);
|
|
512
|
-
wasm.__wbindgen_export_2(deferred5_0, deferred5_1, 1);
|
|
513
|
-
}
|
|
514
|
-
};
|
|
515
|
-
|
|
516
640
|
const path = require('path').join(__dirname, 'bitmark_wasm_bg.wasm');
|
|
517
641
|
const bytes = require('fs').readFileSync(path);
|
|
518
642
|
|
|
Binary file
|
|
@@ -6,10 +6,13 @@ 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
|
|
9
|
+
export const diff: (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
|
+
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
11
|
export const is_bitmark: (a: number, b: number) => number;
|
|
11
12
|
export const lex: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
12
13
|
export const prettify: (a: number, b: number, c: number, d: number) => void;
|
|
14
|
+
export const register: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
15
|
+
export const resolve_patch_document: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
13
16
|
export const split_bits: (a: number, b: number, c: number) => void;
|
|
14
17
|
export const split_json_bits: (a: number, b: number, c: number) => void;
|
|
15
18
|
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;
|
package/wasm/package.json
CHANGED
|
@@ -17,7 +17,8 @@ export function unbreakscape_text(input: string, format: string, location: strin
|
|
|
17
17
|
/**
|
|
18
18
|
* Query information about supported bit types.
|
|
19
19
|
*
|
|
20
|
-
* `info_type`: `"list"`, `"bit"`, `"all"`,
|
|
20
|
+
* `info_type`: `"list"`, `"bit"`, `"all"`, `"deprecated"`, `"bit-groups"`,
|
|
21
|
+
* or `"resource-groups"`
|
|
21
22
|
* `format`: `"text"` or `"json"`
|
|
22
23
|
* `bit`: bit name (required when `info_type` is `"bit"`)
|
|
23
24
|
* `pretty`: whether to pretty-print JSON output
|
|
@@ -27,8 +28,44 @@ export function unbreakscape_text(input: string, format: string, location: strin
|
|
|
27
28
|
* `include_deprecated`)
|
|
28
29
|
* `full`: complete outline for `bit`/`all` (default is the compact
|
|
29
30
|
* one-line-per-tag view)
|
|
31
|
+
* `language`: BCP-47 tag(s) for display names — "" = English, `"de,fr"` for
|
|
32
|
+
* several (adds a `titles` map), `"all"` for every resolvable language
|
|
30
33
|
*/
|
|
31
|
-
export function info(info_type: string, format: string, bit: string, pretty: boolean, indent: number, include_deprecated: boolean, only_deprecated: boolean, full: boolean): string;
|
|
34
|
+
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;
|
|
35
|
+
/**
|
|
36
|
+
* Register data with the parser process (PLAN-173 P12).
|
|
37
|
+
*
|
|
38
|
+
* `data_type`: `"translations"` today. One verb rather than one function per
|
|
39
|
+
* registerable thing — the same discriminated-options idiom as `info`.
|
|
40
|
+
*
|
|
41
|
+
* `data` is the file's own text. Semantics are REPLACE: a second call
|
|
42
|
+
* supersedes the first entirely, and the built-in table (where the variant
|
|
43
|
+
* bakes one) stays underneath. Returns `""` on success, or an
|
|
44
|
+
* `error:`-prefixed message — matching the other string-returning exports.
|
|
45
|
+
*
|
|
46
|
+
* Available in EVERY variant, including those that bake nothing: that is
|
|
47
|
+
* exactly where a consumer must supply the file themselves.
|
|
48
|
+
*/
|
|
49
|
+
export function register(data_type: string, data: string): string;
|
|
50
|
+
/**
|
|
51
|
+
* Apply a patch (a JSON array of patch entries) to every bit and re-emit.
|
|
52
|
+
*
|
|
53
|
+
* `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
|
|
54
|
+
* `output_format_sel`: `"bitmark"` | `"json"` (default json).
|
|
55
|
+
* `patch_json`: the patch entry array (empty string = no patches, i.e. a
|
|
56
|
+
* canonicalizing pass). Parallelism is a JS-side concern (web workers); this
|
|
57
|
+
* runs sequentially. Returns the document text/JSON, or `error: …`.
|
|
58
|
+
*/
|
|
59
|
+
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;
|
|
60
|
+
/**
|
|
61
|
+
* Resolve a patch document against `input` (bitmark or JSON) into the
|
|
62
|
+
* ordered output items, so a JS per-bit planner (hooks, worker pool) can
|
|
63
|
+
* reorder, drop and insert jobs from the one Rust implementation
|
|
64
|
+
* (PLAN-179). Returns a JSON array of
|
|
65
|
+
* `{ "source": <original index> | null, "bit": <inner bit> | null,
|
|
66
|
+
* "patch": [ … ] }`, or `error: …`.
|
|
67
|
+
*/
|
|
68
|
+
export function resolve_patch_document(input: string, patch_json: string): string;
|
|
32
69
|
/**
|
|
33
70
|
* Convert between bitmark and JSON with explicit input/output formats + mode.
|
|
34
71
|
*
|
|
@@ -87,13 +124,3 @@ export function prettify(json: string, indent: number): string;
|
|
|
87
124
|
* Returns the converted fragment, or `error: …`.
|
|
88
125
|
*/
|
|
89
126
|
export function convert_text(input: string, direction: string, format: string, location: string): string;
|
|
90
|
-
/**
|
|
91
|
-
* Apply a patch (a JSON array of patch entries) to every bit and re-emit.
|
|
92
|
-
*
|
|
93
|
-
* `input_format_sel`: `"auto"` | `"bitmark"` | `"json"`.
|
|
94
|
-
* `output_format_sel`: `"bitmark"` | `"json"` (default json).
|
|
95
|
-
* `patch_json`: the patch entry array (empty string = no patches, i.e. a
|
|
96
|
-
* canonicalizing pass). Parallelism is a JS-side concern (web workers); this
|
|
97
|
-
* runs sequentially. Returns the document text/JSON, or `error: …`.
|
|
98
|
-
*/
|
|
99
|
-
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;
|