lingotweaker-wasm 0.2.0 → 0.2.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.
@@ -0,0 +1,58 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * An immutable engine loaded from a data pack.
6
+ */
7
+ export class LtEngine {
8
+ free(): void;
9
+ [Symbol.dispose](): void;
10
+ /**
11
+ * Number of rules actively matched by the pattern engine.
12
+ */
13
+ active_rule_count(): number;
14
+ /**
15
+ * Check `text` and return the LT-shaped JSON of `CheckResult`.
16
+ */
17
+ check_json(text: string): string;
18
+ /**
19
+ * Check `text` and return only the matches as JSON: `{"matches":[…]}`.
20
+ *
21
+ * The demo (and any UI that only renders issues) never needs the input
22
+ * text and per-sentence text spans that [`Self::check_json`] also
23
+ * serializes; for long paragraphs this JSON round-trip is a measurable
24
+ * share of the per-check latency.
25
+ */
26
+ check_matches_json(text: string): string;
27
+ /**
28
+ * Rules that failed to compile, as `[{rule, error}, …]` JSON.
29
+ */
30
+ compile_failures_json(): string;
31
+ /**
32
+ * The language code this engine was built for.
33
+ */
34
+ lang(): string;
35
+ /**
36
+ * Build an engine for `lang` (e.g. `en-US`, `gn-ES`) from `pack`.
37
+ *
38
+ * `options` is a JSON object; all fields are optional:
39
+ * `variant` (`en-GB`) selects variant resources, `today` (ISO date or
40
+ * timestamp) pins the date filters, and `picky`, `enabledRules`,
41
+ * `disabledRules`, `enabledCategories`, `disabledCategories`,
42
+ * `enabledOnly` configure rule selection.
43
+ */
44
+ constructor(lang: string, pack: Uint8Array, options?: string | null);
45
+ /**
46
+ * Like [`LtEngine::new`] but built from several packs: the first is the
47
+ * base pack, later ones are sidecars (split packs: `en` base + optional
48
+ * `en.models`/`en-GB`-style variant dictionaries; reads fall through to
49
+ * the later packs). `packs` is a JS array of `Uint8Array`s.
50
+ */
51
+ static new_multi(lang: string, packs: Uint8Array[], options?: string | null): LtEngine;
52
+ /**
53
+ * The variant override, if any.
54
+ */
55
+ variant(): string | undefined;
56
+ }
57
+
58
+ export function start(): void;
@@ -0,0 +1,375 @@
1
+ /* @ts-self-types="./lt_wasm.d.ts" */
2
+
3
+ /**
4
+ * An immutable engine loaded from a data pack.
5
+ */
6
+ class LtEngine {
7
+ static __wrap(ptr) {
8
+ const obj = Object.create(LtEngine.prototype);
9
+ obj.__wbg_ptr = ptr;
10
+ LtEngineFinalization.register(obj, obj.__wbg_ptr, obj);
11
+ return obj;
12
+ }
13
+ __destroy_into_raw() {
14
+ const ptr = this.__wbg_ptr;
15
+ this.__wbg_ptr = 0;
16
+ LtEngineFinalization.unregister(this);
17
+ return ptr;
18
+ }
19
+ free() {
20
+ const ptr = this.__destroy_into_raw();
21
+ wasm.__wbg_ltengine_free(ptr, 0);
22
+ }
23
+ /**
24
+ * Number of rules actively matched by the pattern engine.
25
+ * @returns {number}
26
+ */
27
+ active_rule_count() {
28
+ const ret = wasm.ltengine_active_rule_count(this.__wbg_ptr);
29
+ return ret >>> 0;
30
+ }
31
+ /**
32
+ * Check `text` and return the LT-shaped JSON of `CheckResult`.
33
+ * @param {string} text
34
+ * @returns {string}
35
+ */
36
+ check_json(text) {
37
+ let deferred3_0;
38
+ let deferred3_1;
39
+ try {
40
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
41
+ const len0 = WASM_VECTOR_LEN;
42
+ const ret = wasm.ltengine_check_json(this.__wbg_ptr, ptr0, len0);
43
+ var ptr2 = ret[0];
44
+ var len2 = ret[1];
45
+ if (ret[3]) {
46
+ ptr2 = 0; len2 = 0;
47
+ throw takeFromExternrefTable0(ret[2]);
48
+ }
49
+ deferred3_0 = ptr2;
50
+ deferred3_1 = len2;
51
+ return getStringFromWasm0(ptr2, len2);
52
+ } finally {
53
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
54
+ }
55
+ }
56
+ /**
57
+ * Check `text` and return only the matches as JSON: `{"matches":[…]}`.
58
+ *
59
+ * The demo (and any UI that only renders issues) never needs the input
60
+ * text and per-sentence text spans that [`Self::check_json`] also
61
+ * serializes; for long paragraphs this JSON round-trip is a measurable
62
+ * share of the per-check latency.
63
+ * @param {string} text
64
+ * @returns {string}
65
+ */
66
+ check_matches_json(text) {
67
+ let deferred3_0;
68
+ let deferred3_1;
69
+ try {
70
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
71
+ const len0 = WASM_VECTOR_LEN;
72
+ const ret = wasm.ltengine_check_matches_json(this.__wbg_ptr, ptr0, len0);
73
+ var ptr2 = ret[0];
74
+ var len2 = ret[1];
75
+ if (ret[3]) {
76
+ ptr2 = 0; len2 = 0;
77
+ throw takeFromExternrefTable0(ret[2]);
78
+ }
79
+ deferred3_0 = ptr2;
80
+ deferred3_1 = len2;
81
+ return getStringFromWasm0(ptr2, len2);
82
+ } finally {
83
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
84
+ }
85
+ }
86
+ /**
87
+ * Rules that failed to compile, as `[{rule, error}, …]` JSON.
88
+ * @returns {string}
89
+ */
90
+ compile_failures_json() {
91
+ let deferred2_0;
92
+ let deferred2_1;
93
+ try {
94
+ const ret = wasm.ltengine_compile_failures_json(this.__wbg_ptr);
95
+ var ptr1 = ret[0];
96
+ var len1 = ret[1];
97
+ if (ret[3]) {
98
+ ptr1 = 0; len1 = 0;
99
+ throw takeFromExternrefTable0(ret[2]);
100
+ }
101
+ deferred2_0 = ptr1;
102
+ deferred2_1 = len1;
103
+ return getStringFromWasm0(ptr1, len1);
104
+ } finally {
105
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
106
+ }
107
+ }
108
+ /**
109
+ * The language code this engine was built for.
110
+ * @returns {string}
111
+ */
112
+ lang() {
113
+ let deferred1_0;
114
+ let deferred1_1;
115
+ try {
116
+ const ret = wasm.ltengine_lang(this.__wbg_ptr);
117
+ deferred1_0 = ret[0];
118
+ deferred1_1 = ret[1];
119
+ return getStringFromWasm0(ret[0], ret[1]);
120
+ } finally {
121
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
122
+ }
123
+ }
124
+ /**
125
+ * Build an engine for `lang` (e.g. `en-US`, `gn-ES`) from `pack`.
126
+ *
127
+ * `options` is a JSON object; all fields are optional:
128
+ * `variant` (`en-GB`) selects variant resources, `today` (ISO date or
129
+ * timestamp) pins the date filters, and `picky`, `enabledRules`,
130
+ * `disabledRules`, `enabledCategories`, `disabledCategories`,
131
+ * `enabledOnly` configure rule selection.
132
+ * @param {string} lang
133
+ * @param {Uint8Array} pack
134
+ * @param {string | null} [options]
135
+ */
136
+ constructor(lang, pack, options) {
137
+ const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
138
+ const len0 = WASM_VECTOR_LEN;
139
+ const ptr1 = passArray8ToWasm0(pack, wasm.__wbindgen_malloc);
140
+ const len1 = WASM_VECTOR_LEN;
141
+ var ptr2 = isLikeNone(options) ? 0 : passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
142
+ var len2 = WASM_VECTOR_LEN;
143
+ const ret = wasm.ltengine_new(ptr0, len0, ptr1, len1, ptr2, len2);
144
+ if (ret[2]) {
145
+ throw takeFromExternrefTable0(ret[1]);
146
+ }
147
+ this.__wbg_ptr = ret[0];
148
+ LtEngineFinalization.register(this, this.__wbg_ptr, this);
149
+ return this;
150
+ }
151
+ /**
152
+ * Like [`LtEngine::new`] but built from several packs: the first is the
153
+ * base pack, later ones are sidecars (split packs: `en` base + optional
154
+ * `en.models`/`en-GB`-style variant dictionaries; reads fall through to
155
+ * the later packs). `packs` is a JS array of `Uint8Array`s.
156
+ * @param {string} lang
157
+ * @param {Uint8Array[]} packs
158
+ * @param {string | null} [options]
159
+ * @returns {LtEngine}
160
+ */
161
+ static new_multi(lang, packs, options) {
162
+ const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
163
+ const len0 = WASM_VECTOR_LEN;
164
+ const ptr1 = passArrayJsValueToWasm0(packs, wasm.__wbindgen_malloc);
165
+ const len1 = WASM_VECTOR_LEN;
166
+ var ptr2 = isLikeNone(options) ? 0 : passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
167
+ var len2 = WASM_VECTOR_LEN;
168
+ const ret = wasm.ltengine_new_multi(ptr0, len0, ptr1, len1, ptr2, len2);
169
+ if (ret[2]) {
170
+ throw takeFromExternrefTable0(ret[1]);
171
+ }
172
+ return LtEngine.__wrap(ret[0]);
173
+ }
174
+ /**
175
+ * The variant override, if any.
176
+ * @returns {string | undefined}
177
+ */
178
+ variant() {
179
+ const ret = wasm.ltengine_variant(this.__wbg_ptr);
180
+ let v1;
181
+ if (ret[0] !== 0) {
182
+ v1 = getStringFromWasm0(ret[0], ret[1]);
183
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
184
+ }
185
+ return v1;
186
+ }
187
+ }
188
+ if (Symbol.dispose) LtEngine.prototype[Symbol.dispose] = LtEngine.prototype.free;
189
+ exports.LtEngine = LtEngine;
190
+
191
+ function start() {
192
+ wasm.start();
193
+ }
194
+ exports.start = start;
195
+ function __wbg_get_imports() {
196
+ const import0 = {
197
+ __proto__: null,
198
+ __wbg_Error_67e7344beaa85059: function(arg0, arg1) {
199
+ const ret = Error(getStringFromWasm0(arg0, arg1));
200
+ return ret;
201
+ },
202
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
203
+ throw new Error(getStringFromWasm0(arg0, arg1));
204
+ },
205
+ __wbg_error_757e9472f8410341: function(arg0, arg1) {
206
+ let deferred0_0;
207
+ let deferred0_1;
208
+ try {
209
+ deferred0_0 = arg0;
210
+ deferred0_1 = arg1;
211
+ console.error(getStringFromWasm0(arg0, arg1));
212
+ } finally {
213
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
214
+ }
215
+ },
216
+ __wbg_length_31bdaf014f5fbde2: function(arg0) {
217
+ const ret = arg0.length;
218
+ return ret;
219
+ },
220
+ __wbg_new_227d7c05414eb861: function() {
221
+ const ret = new Error();
222
+ return ret;
223
+ },
224
+ __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
225
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
226
+ },
227
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
228
+ const ret = arg1.stack;
229
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
230
+ const len1 = WASM_VECTOR_LEN;
231
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
232
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
233
+ },
234
+ __wbindgen_init_externref_table: function() {
235
+ const table = wasm.__wbindgen_externrefs;
236
+ const offset = table.grow(4);
237
+ table.set(0, undefined);
238
+ table.set(offset + 0, undefined);
239
+ table.set(offset + 1, null);
240
+ table.set(offset + 2, true);
241
+ table.set(offset + 3, false);
242
+ },
243
+ };
244
+ return {
245
+ __proto__: null,
246
+ "./lt_wasm_bg.js": import0,
247
+ };
248
+ }
249
+
250
+ const LtEngineFinalization = (typeof FinalizationRegistry === 'undefined')
251
+ ? { register: () => {}, unregister: () => {} }
252
+ : new FinalizationRegistry(ptr => wasm.__wbg_ltengine_free(ptr, 1));
253
+
254
+ function addToExternrefTable0(obj) {
255
+ const idx = wasm.__externref_table_alloc();
256
+ wasm.__wbindgen_externrefs.set(idx, obj);
257
+ return idx;
258
+ }
259
+
260
+ function getArrayU8FromWasm0(ptr, len) {
261
+ ptr = ptr >>> 0;
262
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
263
+ }
264
+
265
+ let cachedDataViewMemory0 = null;
266
+ function getDataViewMemory0() {
267
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
268
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
269
+ }
270
+ return cachedDataViewMemory0;
271
+ }
272
+
273
+ function getStringFromWasm0(ptr, len) {
274
+ return decodeText(ptr >>> 0, len);
275
+ }
276
+
277
+ let cachedUint8ArrayMemory0 = null;
278
+ function getUint8ArrayMemory0() {
279
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
280
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
281
+ }
282
+ return cachedUint8ArrayMemory0;
283
+ }
284
+
285
+ function isLikeNone(x) {
286
+ return x === undefined || x === null;
287
+ }
288
+
289
+ function passArray8ToWasm0(arg, malloc) {
290
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
291
+ getUint8ArrayMemory0().set(arg, ptr / 1);
292
+ WASM_VECTOR_LEN = arg.length;
293
+ return ptr;
294
+ }
295
+
296
+ function passArrayJsValueToWasm0(array, malloc) {
297
+ const ptr = malloc(array.length * 4, 4) >>> 0;
298
+ for (let i = 0; i < array.length; i++) {
299
+ const add = addToExternrefTable0(array[i]);
300
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
301
+ }
302
+ WASM_VECTOR_LEN = array.length;
303
+ return ptr;
304
+ }
305
+
306
+ function passStringToWasm0(arg, malloc, realloc) {
307
+ if (realloc === undefined) {
308
+ const buf = cachedTextEncoder.encode(arg);
309
+ const ptr = malloc(buf.length, 1) >>> 0;
310
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
311
+ WASM_VECTOR_LEN = buf.length;
312
+ return ptr;
313
+ }
314
+
315
+ let len = arg.length;
316
+ let ptr = malloc(len, 1) >>> 0;
317
+
318
+ const mem = getUint8ArrayMemory0();
319
+
320
+ let offset = 0;
321
+
322
+ for (; offset < len; offset++) {
323
+ const code = arg.charCodeAt(offset);
324
+ if (code > 0x7F) break;
325
+ mem[ptr + offset] = code;
326
+ }
327
+ if (offset !== len) {
328
+ if (offset !== 0) {
329
+ arg = arg.slice(offset);
330
+ }
331
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
332
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
333
+ const ret = cachedTextEncoder.encodeInto(arg, view);
334
+
335
+ offset += ret.written;
336
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
337
+ }
338
+
339
+ WASM_VECTOR_LEN = offset;
340
+ return ptr;
341
+ }
342
+
343
+ function takeFromExternrefTable0(idx) {
344
+ const value = wasm.__wbindgen_externrefs.get(idx);
345
+ wasm.__externref_table_dealloc(idx);
346
+ return value;
347
+ }
348
+
349
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
350
+ cachedTextDecoder.decode();
351
+ function decodeText(ptr, len) {
352
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
353
+ }
354
+
355
+ const cachedTextEncoder = new TextEncoder();
356
+
357
+ if (!('encodeInto' in cachedTextEncoder)) {
358
+ cachedTextEncoder.encodeInto = function (arg, view) {
359
+ const buf = cachedTextEncoder.encode(arg);
360
+ view.set(buf);
361
+ return {
362
+ read: arg.length,
363
+ written: buf.length
364
+ };
365
+ };
366
+ }
367
+
368
+ let WASM_VECTOR_LEN = 0;
369
+
370
+ const wasmPath = `${__dirname}/lt_wasm_bg.wasm`;
371
+ const wasmBytes = require('fs').readFileSync(wasmPath);
372
+ const wasmModule = new WebAssembly.Module(wasmBytes);
373
+ let wasmInstance = new WebAssembly.Instance(wasmModule, __wbg_get_imports());
374
+ let wasm = wasmInstance.exports;
375
+ wasm.__wbindgen_start();
Binary file
@@ -0,0 +1,20 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const __wbg_ltengine_free: (a: number, b: number) => void;
5
+ export const ltengine_active_rule_count: (a: number) => number;
6
+ export const ltengine_check_json: (a: number, b: number, c: number) => [number, number, number, number];
7
+ export const ltengine_check_matches_json: (a: number, b: number, c: number) => [number, number, number, number];
8
+ export const ltengine_compile_failures_json: (a: number) => [number, number, number, number];
9
+ export const ltengine_lang: (a: number) => [number, number];
10
+ export const ltengine_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
11
+ export const ltengine_new_multi: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
12
+ export const ltengine_variant: (a: number) => [number, number];
13
+ export const start: () => void;
14
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
15
+ export const __wbindgen_malloc: (a: number, b: number) => number;
16
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
17
+ export const __wbindgen_externrefs: WebAssembly.Table;
18
+ export const __externref_table_dealloc: (a: number) => void;
19
+ export const __externref_table_alloc: () => number;
20
+ export const __wbindgen_start: () => void;
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
package/pack.d.ts ADDED
@@ -0,0 +1,35 @@
1
+ // Type definitions for the data-pack helpers in pack.js.
2
+
3
+ /** Default base URL of the per-release GitHub Release data assets. */
4
+ export const DEFAULT_DATA_BASE_URL: string
5
+
6
+ /** The URL of the release data manifest (`{ <lang>: { file, bytes, sha256 } }`). */
7
+ export function manifestUrl(baseUrl?: string): string
8
+
9
+ /** The URL of the gzipped pack for `lang`. */
10
+ export function packUrl(lang: string, baseUrl?: string): string
11
+
12
+ /** Inflate a gzipped pack (browser `DecompressionStream`, else Node `zlib`). */
13
+ export function decompressPack(
14
+ bytes: Uint8Array | ArrayBuffer
15
+ ): Promise<Uint8Array>
16
+
17
+ /**
18
+ * Fetch and inflate the pack for `lang` (`en`, `de`, `gn`, …).
19
+ *
20
+ * Node.js prefers the locally installed `lingotweaker-data-<lang>` data
21
+ * packages; browsers (and any environment without them) fall back to the
22
+ * release assets for this package version. Pass `baseUrl` to use different
23
+ * data.
24
+ */
25
+ export function fetchPack(
26
+ lang: string,
27
+ options?: {baseUrl?: string; fetch?: typeof fetch}
28
+ ): Promise<Uint8Array>
29
+
30
+ /**
31
+ * Read and inflate a pack from the locally installed data packages (the
32
+ * code-only `lingotweaker-data` loader resolving `lingotweaker-data-<lang>`).
33
+ * Returns `null` outside Node.js, or when the package/language is missing.
34
+ */
35
+ export function localPack(lang: string): Promise<Uint8Array | null>
package/pack.js CHANGED
@@ -10,7 +10,7 @@
10
10
 
11
11
  // Updated by scripts/release/set-version.sh together with the package version.
12
12
  export const DEFAULT_DATA_BASE_URL =
13
- "https://github.com/fiduswriter/LingoTweaker/releases/download/v0.2.0";
13
+ "https://github.com/fiduswriter/LingoTweaker/releases/download/v0.2.2";
14
14
 
15
15
  /** The URL of the release data manifest (`{ <lang>: { file, bytes, sha256 } }`). */
16
16
  export function manifestUrl(baseUrl = DEFAULT_DATA_BASE_URL) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "lingotweaker-wasm",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "LingoTweaker proofreading engine compiled to WebAssembly (browser and Node)",
5
5
  "license": "LGPL-2.1-or-later",
6
6
  "repository": {
@@ -22,7 +22,7 @@
22
22
  "module": "./web/lt_wasm.js",
23
23
  "types": "./web/lt_wasm.d.ts",
24
24
  "dependencies": {
25
- "lingotweaker-data": "0.2.0"
25
+ "lingotweaker-data": "0.2.2"
26
26
  },
27
27
  "exports": {
28
28
  ".": {
@@ -41,6 +41,7 @@
41
41
  "default": "./node/lt_wasm.js"
42
42
  },
43
43
  "./pack": {
44
+ "types": "./pack.d.ts",
44
45
  "default": "./pack.js"
45
46
  },
46
47
  "./package.json": "./package.json"
@@ -49,6 +50,7 @@
49
50
  "web",
50
51
  "node",
51
52
  "pack.js",
53
+ "pack.d.ts",
52
54
  "README.md"
53
55
  ],
54
56
  "engines": {
@@ -0,0 +1,103 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+
4
+ /**
5
+ * An immutable engine loaded from a data pack.
6
+ */
7
+ export class LtEngine {
8
+ free(): void;
9
+ [Symbol.dispose](): void;
10
+ /**
11
+ * Number of rules actively matched by the pattern engine.
12
+ */
13
+ active_rule_count(): number;
14
+ /**
15
+ * Check `text` and return the LT-shaped JSON of `CheckResult`.
16
+ */
17
+ check_json(text: string): string;
18
+ /**
19
+ * Check `text` and return only the matches as JSON: `{"matches":[…]}`.
20
+ *
21
+ * The demo (and any UI that only renders issues) never needs the input
22
+ * text and per-sentence text spans that [`Self::check_json`] also
23
+ * serializes; for long paragraphs this JSON round-trip is a measurable
24
+ * share of the per-check latency.
25
+ */
26
+ check_matches_json(text: string): string;
27
+ /**
28
+ * Rules that failed to compile, as `[{rule, error}, …]` JSON.
29
+ */
30
+ compile_failures_json(): string;
31
+ /**
32
+ * The language code this engine was built for.
33
+ */
34
+ lang(): string;
35
+ /**
36
+ * Build an engine for `lang` (e.g. `en-US`, `gn-ES`) from `pack`.
37
+ *
38
+ * `options` is a JSON object; all fields are optional:
39
+ * `variant` (`en-GB`) selects variant resources, `today` (ISO date or
40
+ * timestamp) pins the date filters, and `picky`, `enabledRules`,
41
+ * `disabledRules`, `enabledCategories`, `disabledCategories`,
42
+ * `enabledOnly` configure rule selection.
43
+ */
44
+ constructor(lang: string, pack: Uint8Array, options?: string | null);
45
+ /**
46
+ * Like [`LtEngine::new`] but built from several packs: the first is the
47
+ * base pack, later ones are sidecars (split packs: `en` base + optional
48
+ * `en.models`/`en-GB`-style variant dictionaries; reads fall through to
49
+ * the later packs). `packs` is a JS array of `Uint8Array`s.
50
+ */
51
+ static new_multi(lang: string, packs: Uint8Array[], options?: string | null): LtEngine;
52
+ /**
53
+ * The variant override, if any.
54
+ */
55
+ variant(): string | undefined;
56
+ }
57
+
58
+ export function start(): void;
59
+
60
+ export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
61
+
62
+ export interface InitOutput {
63
+ readonly memory: WebAssembly.Memory;
64
+ readonly __wbg_ltengine_free: (a: number, b: number) => void;
65
+ readonly ltengine_active_rule_count: (a: number) => number;
66
+ readonly ltengine_check_json: (a: number, b: number, c: number) => [number, number, number, number];
67
+ readonly ltengine_check_matches_json: (a: number, b: number, c: number) => [number, number, number, number];
68
+ readonly ltengine_compile_failures_json: (a: number) => [number, number, number, number];
69
+ readonly ltengine_lang: (a: number) => [number, number];
70
+ readonly ltengine_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
71
+ readonly ltengine_new_multi: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
72
+ readonly ltengine_variant: (a: number) => [number, number];
73
+ readonly start: () => void;
74
+ readonly __wbindgen_free: (a: number, b: number, c: number) => void;
75
+ readonly __wbindgen_malloc: (a: number, b: number) => number;
76
+ readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
77
+ readonly __wbindgen_externrefs: WebAssembly.Table;
78
+ readonly __externref_table_dealloc: (a: number) => void;
79
+ readonly __externref_table_alloc: () => number;
80
+ readonly __wbindgen_start: () => void;
81
+ }
82
+
83
+ export type SyncInitInput = BufferSource | WebAssembly.Module;
84
+
85
+ /**
86
+ * Instantiates the given `module`, which can either be bytes or
87
+ * a precompiled `WebAssembly.Module`.
88
+ *
89
+ * @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
90
+ *
91
+ * @returns {InitOutput}
92
+ */
93
+ export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
94
+
95
+ /**
96
+ * If `module_or_path` is {RequestInfo} or {URL}, makes a request and
97
+ * for everything else, calls `WebAssembly.instantiate` directly.
98
+ *
99
+ * @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
100
+ *
101
+ * @returns {Promise<InitOutput>}
102
+ */
103
+ export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
package/web/lt_wasm.js ADDED
@@ -0,0 +1,472 @@
1
+ /* @ts-self-types="./lt_wasm.d.ts" */
2
+
3
+ /**
4
+ * An immutable engine loaded from a data pack.
5
+ */
6
+ export class LtEngine {
7
+ static __wrap(ptr) {
8
+ const obj = Object.create(LtEngine.prototype);
9
+ obj.__wbg_ptr = ptr;
10
+ LtEngineFinalization.register(obj, obj.__wbg_ptr, obj);
11
+ return obj;
12
+ }
13
+ __destroy_into_raw() {
14
+ const ptr = this.__wbg_ptr;
15
+ this.__wbg_ptr = 0;
16
+ LtEngineFinalization.unregister(this);
17
+ return ptr;
18
+ }
19
+ free() {
20
+ const ptr = this.__destroy_into_raw();
21
+ wasm.__wbg_ltengine_free(ptr, 0);
22
+ }
23
+ /**
24
+ * Number of rules actively matched by the pattern engine.
25
+ * @returns {number}
26
+ */
27
+ active_rule_count() {
28
+ const ret = wasm.ltengine_active_rule_count(this.__wbg_ptr);
29
+ return ret >>> 0;
30
+ }
31
+ /**
32
+ * Check `text` and return the LT-shaped JSON of `CheckResult`.
33
+ * @param {string} text
34
+ * @returns {string}
35
+ */
36
+ check_json(text) {
37
+ let deferred3_0;
38
+ let deferred3_1;
39
+ try {
40
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
41
+ const len0 = WASM_VECTOR_LEN;
42
+ const ret = wasm.ltengine_check_json(this.__wbg_ptr, ptr0, len0);
43
+ var ptr2 = ret[0];
44
+ var len2 = ret[1];
45
+ if (ret[3]) {
46
+ ptr2 = 0; len2 = 0;
47
+ throw takeFromExternrefTable0(ret[2]);
48
+ }
49
+ deferred3_0 = ptr2;
50
+ deferred3_1 = len2;
51
+ return getStringFromWasm0(ptr2, len2);
52
+ } finally {
53
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
54
+ }
55
+ }
56
+ /**
57
+ * Check `text` and return only the matches as JSON: `{"matches":[…]}`.
58
+ *
59
+ * The demo (and any UI that only renders issues) never needs the input
60
+ * text and per-sentence text spans that [`Self::check_json`] also
61
+ * serializes; for long paragraphs this JSON round-trip is a measurable
62
+ * share of the per-check latency.
63
+ * @param {string} text
64
+ * @returns {string}
65
+ */
66
+ check_matches_json(text) {
67
+ let deferred3_0;
68
+ let deferred3_1;
69
+ try {
70
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
71
+ const len0 = WASM_VECTOR_LEN;
72
+ const ret = wasm.ltengine_check_matches_json(this.__wbg_ptr, ptr0, len0);
73
+ var ptr2 = ret[0];
74
+ var len2 = ret[1];
75
+ if (ret[3]) {
76
+ ptr2 = 0; len2 = 0;
77
+ throw takeFromExternrefTable0(ret[2]);
78
+ }
79
+ deferred3_0 = ptr2;
80
+ deferred3_1 = len2;
81
+ return getStringFromWasm0(ptr2, len2);
82
+ } finally {
83
+ wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
84
+ }
85
+ }
86
+ /**
87
+ * Rules that failed to compile, as `[{rule, error}, …]` JSON.
88
+ * @returns {string}
89
+ */
90
+ compile_failures_json() {
91
+ let deferred2_0;
92
+ let deferred2_1;
93
+ try {
94
+ const ret = wasm.ltengine_compile_failures_json(this.__wbg_ptr);
95
+ var ptr1 = ret[0];
96
+ var len1 = ret[1];
97
+ if (ret[3]) {
98
+ ptr1 = 0; len1 = 0;
99
+ throw takeFromExternrefTable0(ret[2]);
100
+ }
101
+ deferred2_0 = ptr1;
102
+ deferred2_1 = len1;
103
+ return getStringFromWasm0(ptr1, len1);
104
+ } finally {
105
+ wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
106
+ }
107
+ }
108
+ /**
109
+ * The language code this engine was built for.
110
+ * @returns {string}
111
+ */
112
+ lang() {
113
+ let deferred1_0;
114
+ let deferred1_1;
115
+ try {
116
+ const ret = wasm.ltengine_lang(this.__wbg_ptr);
117
+ deferred1_0 = ret[0];
118
+ deferred1_1 = ret[1];
119
+ return getStringFromWasm0(ret[0], ret[1]);
120
+ } finally {
121
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
122
+ }
123
+ }
124
+ /**
125
+ * Build an engine for `lang` (e.g. `en-US`, `gn-ES`) from `pack`.
126
+ *
127
+ * `options` is a JSON object; all fields are optional:
128
+ * `variant` (`en-GB`) selects variant resources, `today` (ISO date or
129
+ * timestamp) pins the date filters, and `picky`, `enabledRules`,
130
+ * `disabledRules`, `enabledCategories`, `disabledCategories`,
131
+ * `enabledOnly` configure rule selection.
132
+ * @param {string} lang
133
+ * @param {Uint8Array} pack
134
+ * @param {string | null} [options]
135
+ */
136
+ constructor(lang, pack, options) {
137
+ const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
138
+ const len0 = WASM_VECTOR_LEN;
139
+ const ptr1 = passArray8ToWasm0(pack, wasm.__wbindgen_malloc);
140
+ const len1 = WASM_VECTOR_LEN;
141
+ var ptr2 = isLikeNone(options) ? 0 : passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
142
+ var len2 = WASM_VECTOR_LEN;
143
+ const ret = wasm.ltengine_new(ptr0, len0, ptr1, len1, ptr2, len2);
144
+ if (ret[2]) {
145
+ throw takeFromExternrefTable0(ret[1]);
146
+ }
147
+ this.__wbg_ptr = ret[0];
148
+ LtEngineFinalization.register(this, this.__wbg_ptr, this);
149
+ return this;
150
+ }
151
+ /**
152
+ * Like [`LtEngine::new`] but built from several packs: the first is the
153
+ * base pack, later ones are sidecars (split packs: `en` base + optional
154
+ * `en.models`/`en-GB`-style variant dictionaries; reads fall through to
155
+ * the later packs). `packs` is a JS array of `Uint8Array`s.
156
+ * @param {string} lang
157
+ * @param {Uint8Array[]} packs
158
+ * @param {string | null} [options]
159
+ * @returns {LtEngine}
160
+ */
161
+ static new_multi(lang, packs, options) {
162
+ const ptr0 = passStringToWasm0(lang, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
163
+ const len0 = WASM_VECTOR_LEN;
164
+ const ptr1 = passArrayJsValueToWasm0(packs, wasm.__wbindgen_malloc);
165
+ const len1 = WASM_VECTOR_LEN;
166
+ var ptr2 = isLikeNone(options) ? 0 : passStringToWasm0(options, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
167
+ var len2 = WASM_VECTOR_LEN;
168
+ const ret = wasm.ltengine_new_multi(ptr0, len0, ptr1, len1, ptr2, len2);
169
+ if (ret[2]) {
170
+ throw takeFromExternrefTable0(ret[1]);
171
+ }
172
+ return LtEngine.__wrap(ret[0]);
173
+ }
174
+ /**
175
+ * The variant override, if any.
176
+ * @returns {string | undefined}
177
+ */
178
+ variant() {
179
+ const ret = wasm.ltengine_variant(this.__wbg_ptr);
180
+ let v1;
181
+ if (ret[0] !== 0) {
182
+ v1 = getStringFromWasm0(ret[0], ret[1]);
183
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
184
+ }
185
+ return v1;
186
+ }
187
+ }
188
+ if (Symbol.dispose) LtEngine.prototype[Symbol.dispose] = LtEngine.prototype.free;
189
+
190
+ export function start() {
191
+ wasm.start();
192
+ }
193
+ function __wbg_get_imports() {
194
+ const import0 = {
195
+ __proto__: null,
196
+ __wbg_Error_67e7344beaa85059: function(arg0, arg1) {
197
+ const ret = Error(getStringFromWasm0(arg0, arg1));
198
+ return ret;
199
+ },
200
+ __wbg___wbindgen_throw_5d9e815e6fdf150f: function(arg0, arg1) {
201
+ throw new Error(getStringFromWasm0(arg0, arg1));
202
+ },
203
+ __wbg_error_757e9472f8410341: function(arg0, arg1) {
204
+ let deferred0_0;
205
+ let deferred0_1;
206
+ try {
207
+ deferred0_0 = arg0;
208
+ deferred0_1 = arg1;
209
+ console.error(getStringFromWasm0(arg0, arg1));
210
+ } finally {
211
+ wasm.__wbindgen_free(deferred0_0, deferred0_1, 1);
212
+ }
213
+ },
214
+ __wbg_length_31bdaf014f5fbde2: function(arg0) {
215
+ const ret = arg0.length;
216
+ return ret;
217
+ },
218
+ __wbg_new_227d7c05414eb861: function() {
219
+ const ret = new Error();
220
+ return ret;
221
+ },
222
+ __wbg_prototypesetcall_ae9f5e7459250748: function(arg0, arg1, arg2) {
223
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
224
+ },
225
+ __wbg_stack_3b0d974bbf31e44f: function(arg0, arg1) {
226
+ const ret = arg1.stack;
227
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
228
+ const len1 = WASM_VECTOR_LEN;
229
+ getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
230
+ getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
231
+ },
232
+ __wbindgen_init_externref_table: function() {
233
+ const table = wasm.__wbindgen_externrefs;
234
+ const offset = table.grow(4);
235
+ table.set(0, undefined);
236
+ table.set(offset + 0, undefined);
237
+ table.set(offset + 1, null);
238
+ table.set(offset + 2, true);
239
+ table.set(offset + 3, false);
240
+ },
241
+ };
242
+ return {
243
+ __proto__: null,
244
+ "./lt_wasm_bg.js": import0,
245
+ };
246
+ }
247
+
248
+ const LtEngineFinalization = (typeof FinalizationRegistry === 'undefined')
249
+ ? { register: () => {}, unregister: () => {} }
250
+ : new FinalizationRegistry(ptr => wasm.__wbg_ltengine_free(ptr, 1));
251
+
252
+ function addToExternrefTable0(obj) {
253
+ const idx = wasm.__externref_table_alloc();
254
+ wasm.__wbindgen_externrefs.set(idx, obj);
255
+ return idx;
256
+ }
257
+
258
+ function getArrayU8FromWasm0(ptr, len) {
259
+ ptr = ptr >>> 0;
260
+ return getUint8ArrayMemory0().subarray(ptr / 1, ptr / 1 + len);
261
+ }
262
+
263
+ let cachedDataViewMemory0 = null;
264
+ function getDataViewMemory0() {
265
+ if (cachedDataViewMemory0 === null || cachedDataViewMemory0.buffer.detached === true || (cachedDataViewMemory0.buffer.detached === undefined && cachedDataViewMemory0.buffer !== wasm.memory.buffer)) {
266
+ cachedDataViewMemory0 = new DataView(wasm.memory.buffer);
267
+ }
268
+ return cachedDataViewMemory0;
269
+ }
270
+
271
+ function getStringFromWasm0(ptr, len) {
272
+ return decodeText(ptr >>> 0, len);
273
+ }
274
+
275
+ let cachedUint8ArrayMemory0 = null;
276
+ function getUint8ArrayMemory0() {
277
+ if (cachedUint8ArrayMemory0 === null || cachedUint8ArrayMemory0.byteLength === 0) {
278
+ cachedUint8ArrayMemory0 = new Uint8Array(wasm.memory.buffer);
279
+ }
280
+ return cachedUint8ArrayMemory0;
281
+ }
282
+
283
+ function isLikeNone(x) {
284
+ return x === undefined || x === null;
285
+ }
286
+
287
+ function passArray8ToWasm0(arg, malloc) {
288
+ const ptr = malloc(arg.length * 1, 1) >>> 0;
289
+ getUint8ArrayMemory0().set(arg, ptr / 1);
290
+ WASM_VECTOR_LEN = arg.length;
291
+ return ptr;
292
+ }
293
+
294
+ function passArrayJsValueToWasm0(array, malloc) {
295
+ const ptr = malloc(array.length * 4, 4) >>> 0;
296
+ for (let i = 0; i < array.length; i++) {
297
+ const add = addToExternrefTable0(array[i]);
298
+ getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
299
+ }
300
+ WASM_VECTOR_LEN = array.length;
301
+ return ptr;
302
+ }
303
+
304
+ function passStringToWasm0(arg, malloc, realloc) {
305
+ if (realloc === undefined) {
306
+ const buf = cachedTextEncoder.encode(arg);
307
+ const ptr = malloc(buf.length, 1) >>> 0;
308
+ getUint8ArrayMemory0().subarray(ptr, ptr + buf.length).set(buf);
309
+ WASM_VECTOR_LEN = buf.length;
310
+ return ptr;
311
+ }
312
+
313
+ let len = arg.length;
314
+ let ptr = malloc(len, 1) >>> 0;
315
+
316
+ const mem = getUint8ArrayMemory0();
317
+
318
+ let offset = 0;
319
+
320
+ for (; offset < len; offset++) {
321
+ const code = arg.charCodeAt(offset);
322
+ if (code > 0x7F) break;
323
+ mem[ptr + offset] = code;
324
+ }
325
+ if (offset !== len) {
326
+ if (offset !== 0) {
327
+ arg = arg.slice(offset);
328
+ }
329
+ ptr = realloc(ptr, len, len = offset + arg.length * 3, 1) >>> 0;
330
+ const view = getUint8ArrayMemory0().subarray(ptr + offset, ptr + len);
331
+ const ret = cachedTextEncoder.encodeInto(arg, view);
332
+
333
+ offset += ret.written;
334
+ ptr = realloc(ptr, len, offset, 1) >>> 0;
335
+ }
336
+
337
+ WASM_VECTOR_LEN = offset;
338
+ return ptr;
339
+ }
340
+
341
+ function takeFromExternrefTable0(idx) {
342
+ const value = wasm.__wbindgen_externrefs.get(idx);
343
+ wasm.__externref_table_dealloc(idx);
344
+ return value;
345
+ }
346
+
347
+ let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
348
+ cachedTextDecoder.decode();
349
+ const MAX_SAFARI_DECODE_BYTES = 2146435072;
350
+ let numBytesDecoded = 0;
351
+ function decodeText(ptr, len) {
352
+ numBytesDecoded += len;
353
+ if (numBytesDecoded >= MAX_SAFARI_DECODE_BYTES) {
354
+ cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
355
+ cachedTextDecoder.decode();
356
+ numBytesDecoded = len;
357
+ }
358
+ return cachedTextDecoder.decode(getUint8ArrayMemory0().subarray(ptr, ptr + len));
359
+ }
360
+
361
+ const cachedTextEncoder = new TextEncoder();
362
+
363
+ if (!('encodeInto' in cachedTextEncoder)) {
364
+ cachedTextEncoder.encodeInto = function (arg, view) {
365
+ const buf = cachedTextEncoder.encode(arg);
366
+ view.set(buf);
367
+ return {
368
+ read: arg.length,
369
+ written: buf.length
370
+ };
371
+ };
372
+ }
373
+
374
+ let WASM_VECTOR_LEN = 0;
375
+
376
+ let wasmModule, wasmInstance, wasm;
377
+ function __wbg_finalize_init(instance, module) {
378
+ wasmInstance = instance;
379
+ wasm = instance.exports;
380
+ wasmModule = module;
381
+ cachedDataViewMemory0 = null;
382
+ cachedUint8ArrayMemory0 = null;
383
+ wasm.__wbindgen_start();
384
+ return wasm;
385
+ }
386
+
387
+ async function __wbg_load(module, imports) {
388
+ if (typeof Response === 'function' && module instanceof Response) {
389
+ if (!module.ok) {
390
+ throw new Error(`failed to fetch Wasm: ${module.status} ${module.statusText} fetching '${module.url}'`);
391
+ }
392
+
393
+ if (typeof WebAssembly.instantiateStreaming === 'function') {
394
+ try {
395
+ return await WebAssembly.instantiateStreaming(module, imports);
396
+ } catch (e) {
397
+ const validResponse = expectedResponseType(module.type);
398
+
399
+ if (validResponse && module.headers.get('Content-Type') !== 'application/wasm') {
400
+ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
401
+
402
+ } else { throw e; }
403
+ }
404
+ }
405
+
406
+ const bytes = await module.arrayBuffer();
407
+ return await WebAssembly.instantiate(bytes, imports);
408
+ } else {
409
+ const instance = await WebAssembly.instantiate(module, imports);
410
+
411
+ if (instance instanceof WebAssembly.Instance) {
412
+ return { instance, module };
413
+ } else {
414
+ return instance;
415
+ }
416
+ }
417
+
418
+ function expectedResponseType(type) {
419
+ switch (type) {
420
+ case 'basic': case 'cors': case 'default': return true;
421
+ }
422
+ return false;
423
+ }
424
+ }
425
+
426
+ function initSync(module) {
427
+ if (wasm !== undefined) return wasm;
428
+
429
+
430
+ if (module !== undefined) {
431
+ if (Object.getPrototypeOf(module) === Object.prototype) {
432
+ ({module} = module)
433
+ } else {
434
+ console.warn('using deprecated parameters for `initSync()`; pass a single object instead')
435
+ }
436
+ }
437
+
438
+ const imports = __wbg_get_imports();
439
+ if (!(module instanceof WebAssembly.Module)) {
440
+ module = new WebAssembly.Module(module);
441
+ }
442
+ const instance = new WebAssembly.Instance(module, imports);
443
+ return __wbg_finalize_init(instance, module);
444
+ }
445
+
446
+ async function __wbg_init(module_or_path) {
447
+ if (wasm !== undefined) return wasm;
448
+
449
+
450
+ if (module_or_path !== undefined) {
451
+ if (Object.getPrototypeOf(module_or_path) === Object.prototype) {
452
+ ({module_or_path} = module_or_path)
453
+ } else {
454
+ console.warn('using deprecated parameters for the initialization function; pass a single object instead')
455
+ }
456
+ }
457
+
458
+ if (module_or_path === undefined) {
459
+ module_or_path = new URL('lt_wasm_bg.wasm', import.meta.url);
460
+ }
461
+ const imports = __wbg_get_imports();
462
+
463
+ if (typeof module_or_path === 'string' || (typeof Request === 'function' && module_or_path instanceof Request) || (typeof URL === 'function' && module_or_path instanceof URL)) {
464
+ module_or_path = fetch(module_or_path);
465
+ }
466
+
467
+ const { instance, module } = await __wbg_load(await module_or_path, imports);
468
+
469
+ return __wbg_finalize_init(instance, module);
470
+ }
471
+
472
+ export { initSync, __wbg_init as default };
Binary file
@@ -0,0 +1,20 @@
1
+ /* tslint:disable */
2
+ /* eslint-disable */
3
+ export const memory: WebAssembly.Memory;
4
+ export const __wbg_ltengine_free: (a: number, b: number) => void;
5
+ export const ltengine_active_rule_count: (a: number) => number;
6
+ export const ltengine_check_json: (a: number, b: number, c: number) => [number, number, number, number];
7
+ export const ltengine_check_matches_json: (a: number, b: number, c: number) => [number, number, number, number];
8
+ export const ltengine_compile_failures_json: (a: number) => [number, number, number, number];
9
+ export const ltengine_lang: (a: number) => [number, number];
10
+ export const ltengine_new: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
11
+ export const ltengine_new_multi: (a: number, b: number, c: number, d: number, e: number, f: number) => [number, number, number];
12
+ export const ltengine_variant: (a: number) => [number, number];
13
+ export const start: () => void;
14
+ export const __wbindgen_free: (a: number, b: number, c: number) => void;
15
+ export const __wbindgen_malloc: (a: number, b: number) => number;
16
+ export const __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
17
+ export const __wbindgen_externrefs: WebAssembly.Table;
18
+ export const __externref_table_dealloc: (a: number) => void;
19
+ export const __externref_table_alloc: () => number;
20
+ export const __wbindgen_start: () => void;
@@ -0,0 +1 @@
1
+ {"type":"module"}