@laisuk/opencc-fmmseg-wasm 0.3.3 → 0.3.4

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 CHANGED
@@ -387,7 +387,9 @@ const cc = OpenccWasm.newWithCustomDicts("s2t", [
387
387
  `Override` replaces the selected slot before inserting the provided pairs. It is powerful and should be used only when
388
388
  the caller intentionally wants to discard built-in entries for that slot.
389
389
 
390
- Custom dictionary specs use strict canonical `DictSlot` names:
390
+ Custom dictionary specs identify the target dictionary slot by `DictSlot` name. Slot names are trimmed and normalized
391
+ case-insensitively for the known slots, so `"stphrases"`, `" STPhrases "`, and `"STPhrases"` all select
392
+ `STPhrases`. Canonical names are recommended in TypeScript code and docs:
391
393
 
392
394
  ```text
393
395
  STPhrases
@@ -406,15 +408,15 @@ HKVariants
406
408
  HKVariantsPhrases
407
409
  HKVariantsRev
408
410
  HKVariantsRevPhrases
409
- JPShinjitaiCharacters
410
- JPShinjitaiPhrases
411
- JPVariants
412
- JPVariantsRev
411
+ JPSCharacters
412
+ JPSCharactersRev
413
+ JPSPhrases
413
414
  STPunctuations
414
415
  TSPunctuations
415
416
  ```
416
417
 
417
- Suffixes such as `.txt` are not accepted. Use `"STPhrases"`, not `"STPhrases.txt"`.
418
+ Suffixes such as `.txt` are not accepted, even though case and surrounding whitespace are normalized. Use
419
+ `"STPhrases"` or `"stphrases"`, not `"STPhrases.txt"`.
418
420
 
419
421
  Merge contract:
420
422
 
@@ -447,15 +449,17 @@ docx, xlsx, pptx, odt, ods, odp, epub
447
449
  File size is limited by available browser or Node.js memory, but there is no upload or server-side limit. Font
448
450
  preservation is supported with the `keepFont` option.
449
451
 
452
+ Use the instance method when possible. It reuses the converter configuration and any custom dictionaries already held by
453
+ the `OpenccWasm` instance.
454
+
450
455
  ```javascript
451
- convert_office_bytes(inputBytes, format, config, punctuation, keepFont)
456
+ cc.convertOfficeBytes(inputBytes, format, punctuation, keepFont)
452
457
  ```
453
458
 
454
459
  Parameters:
455
460
 
456
461
  * `inputBytes`: `Uint8Array` document bytes
457
462
  * `format`: `docx`, `xlsx`, `pptx`, `odt`, `ods`, `odp`, or `epub`
458
- * `config`: OpenCC config string, such as `"s2t"`
459
463
  * `punctuation`: whether to convert punctuation variants
460
464
  * `keepFont`: whether to preserve font declarations where supported
461
465
 
@@ -463,20 +467,26 @@ Returns:
463
467
 
464
468
  * converted output bytes
465
469
 
470
+ The older free function remains available for compatibility:
471
+
472
+ ```javascript
473
+ convert_office_bytes(inputBytes, format, config, punctuation, keepFont)
474
+ ```
475
+
466
476
  ### Browser Office Example
467
477
 
468
478
  ```javascript
469
- import init, {convert_office_bytes} from "@laisuk/opencc-fmmseg-wasm";
479
+ import init, {OpenccWasm} from "@laisuk/opencc-fmmseg-wasm";
470
480
 
471
481
  await init();
472
482
 
483
+ const cc = new OpenccWasm("s2t");
473
484
  const file = document.querySelector("input[type=file]").files[0];
474
485
  const inputBytes = new Uint8Array(await file.arrayBuffer());
475
486
 
476
- const outputBytes = convert_office_bytes(
487
+ const outputBytes = cc.convertOfficeBytes(
477
488
  inputBytes,
478
489
  "docx",
479
- "s2t",
480
490
  true,
481
491
  true
482
492
  );
@@ -496,16 +506,16 @@ URL.revokeObjectURL(a.href);
496
506
 
497
507
  ```javascript
498
508
  import fs from "fs";
499
- import init, {convert_office_bytes} from "@laisuk/opencc-fmmseg-wasm";
509
+ import init, {OpenccWasm} from "@laisuk/opencc-fmmseg-wasm";
500
510
 
501
511
  await init();
502
512
 
513
+ const cc = new OpenccWasm("s2t");
503
514
  const inputBytes = fs.readFileSync("input.docx");
504
515
 
505
- const outputBytes = convert_office_bytes(
516
+ const outputBytes = cc.convertOfficeBytes(
506
517
  inputBytes,
507
518
  "docx",
508
- "s2t",
509
519
  true,
510
520
  true
511
521
  );
@@ -574,6 +584,16 @@ The package includes a zero-dependency Node.js CLI:
574
584
  opencc-fmmseg convert -i input.txt -o output.txt -c s2t -p
575
585
  opencc-fmmseg convert -i input.txt -o output.txt -c t2s -p --detofu all
576
586
  echo "别随便录影侵犯个人隐私权" | opencc-fmmseg convert -c s2hkp
587
+ echo "這個細路哥很靈活" | opencc-fmmseg convert -c hk2sp --custom-dict hkphrasesrev:append:my_hk_dict.txt
588
+ // 这个小男孩很灵活
589
+ ```
590
+
591
+ my_hk_dict.txt:
592
+
593
+ ```
594
+ # Custom Dictionary
595
+
596
+ 細路哥 小男孩
577
597
  ```
578
598
 
579
599
  ```bash
@@ -590,6 +610,12 @@ opencc-fmmseg office -i input.docx -o output.docx -c s2t -p --keep-font
590
610
  --detofu [level] Replace tofu-risk rare CJK extension chars after conversion
591
611
  level: all | ext-b | ext-c | ext-d | ext-e | ext-f | ext-g | ext-h | ext-i
592
612
  default when omitted value: all
613
+ --custom-dict <slot:mode:file>
614
+ Load a custom dictionary.
615
+ May be specified multiple times.
616
+ Examples:
617
+ --custom-dict hkphrasesrev:append:my_hk_dict.txt
618
+ --custom-dict stphrases:override:terms.txt
593
619
  --in-enc <encoding> Input encoding
594
620
  --out-enc <encoding> Output encoding
595
621
  ```
package/bin/opencc.js CHANGED
@@ -6,8 +6,7 @@ import process from "process";
6
6
 
7
7
  import init, {
8
8
  OpenccWasm,
9
- DetofuLevelWasm,
10
- convert_office_bytes
9
+ DetofuLevelWasm
11
10
  } from "../opencc_fmmseg_wasm.js";
12
11
 
13
12
  const OFFICE_FORMATS = new Set([
@@ -58,6 +57,12 @@ Convert options:
58
57
  level: all | ext-b | ext-c | ext-d | ext-e | ext-f | ext-g | ext-h | ext-i
59
58
  default when omitted value: all
60
59
  --keep-ids Preserve complete IDS expressions during conversion (default: false)
60
+ --custom-dict <slot:mode:file>
61
+ Load a custom dictionary.
62
+ May be specified multiple times.
63
+ Examples:
64
+ --custom-dict hkphrasesrev:append:my_hk_dict.txt
65
+ --custom-dict stphrases:override:terms.txt
61
66
  --in-enc <encoding> Input encoding (default: utf8)
62
67
  --out-enc <encoding> Output encoding (default: utf8)
63
68
 
@@ -71,9 +76,15 @@ Office options:
71
76
  -c, --config <conversion> Conversion config (default: s2t)
72
77
  -p, --punct Enable punctuation conversion
73
78
  --format <format> docx | xlsx | pptx | odt | ods | odp | epub
74
- --auto-ext Append extension to output if missing
79
+ --convert-filename Convert generated output filename stem (default: false)
75
80
  --keep-font Preserve font-family information (default)
76
81
  --no-keep-font Do not preserve font-family information
82
+ --custom-dict <slot:mode:file>
83
+ Load a custom dictionary.
84
+ May be specified multiple times.
85
+ Examples:
86
+ --custom-dict hkphrasesrev:append:my_hk_dict.txt
87
+ --custom-dict stphrases:override:terms.txt
77
88
 
78
89
  General options:
79
90
  -h, --help Show help
@@ -85,9 +96,12 @@ Examples:
85
96
  echo "别随便录影侵犯个人隐私权" | npx opencc-fmmseg convert -c s2hkp
86
97
  npx opencc-fmmseg convert -i a.txt -o b.txt -c t2s --detofu
87
98
  npx opencc-fmmseg convert -i a.txt -o b.txt -c t2s --detofu ext-c
99
+ echo "⿰氵漢" | npx opencc-fmmseg convert -c t2s
100
+ echo "⿰氵漢" | npx opencc-fmmseg convert -c t2s --keep-ids
88
101
 
89
102
  npx opencc-fmmseg office -i a.docx -o b.docx -c s2t -p
90
- npx opencc-fmmseg office -i a.epub -c s2tw --auto-ext
103
+ npx opencc-fmmseg office -i a.epub -c s2tw
104
+ npx opencc-fmmseg office -i 软件手册.docx -c s2t --convert-filename
91
105
  `);
92
106
  }
93
107
 
@@ -112,6 +126,91 @@ function getArg(args, shortName, longName, defaultValue = null) {
112
126
  return defaultValue;
113
127
  }
114
128
 
129
+ function getArgs(args, longName) {
130
+ const values = [];
131
+
132
+ for (let i = 0; i < args.length; i++) {
133
+ if (args[i] === longName && i + 1 < args.length) {
134
+ values.push(parseCustomDictSpec(args[i + 1]));
135
+ i++;
136
+ }
137
+ }
138
+
139
+ return values;
140
+ }
141
+
142
+ function parseCustomDictSpec(value) {
143
+ const first = value.indexOf(":");
144
+ const second = value.indexOf(":", first + 1);
145
+
146
+ if (first < 0 || second < 0) {
147
+ throw new Error(
148
+ `Invalid custom dictionary specification: ${value}\n` +
149
+ "Expected: <slot>:<append|override>:<file>"
150
+ );
151
+ }
152
+
153
+ const slot = value.substring(0, first).trim();
154
+ const mode = value.substring(first + 1, second).trim();
155
+ const file = value.substring(second + 1).trim();
156
+
157
+ if (!slot) throw new Error("Custom dictionary slot is empty.");
158
+ if (!mode) throw new Error("Custom dictionary mode is empty.");
159
+ if (!file) throw new Error("Custom dictionary file is empty.");
160
+
161
+ return {
162
+ slot,
163
+ mode,
164
+ pairs: loadCustomDictPairs(file)
165
+ };
166
+ }
167
+
168
+ function loadCustomDictPairs(file) {
169
+ if (!fs.existsSync(file)) {
170
+ throw new Error(`Custom dictionary file not found: ${file}`);
171
+ }
172
+
173
+ const text = fs.readFileSync(file, "utf8");
174
+ const lines = text.split(/\r?\n/);
175
+ const pairs = [];
176
+
177
+ for (let i = 0; i < lines.length; i++) {
178
+ let line = lines[i].replace(/\r$/, "");
179
+
180
+ if (i === 0 && line.charCodeAt(0) === 0xfeff) {
181
+ line = line.slice(1);
182
+ }
183
+
184
+ line = line.trimEnd();
185
+
186
+ if (!line || line.startsWith("#")) {
187
+ continue;
188
+ }
189
+
190
+ const tab = line.indexOf("\t");
191
+
192
+ if (tab < 0) {
193
+ throw new Error(
194
+ `Invalid custom dictionary file ${file}:${i + 1}: missing TAB separator`
195
+ );
196
+ }
197
+
198
+ const source = line.substring(0, tab);
199
+ const values = line.substring(tab + 1).trim().split(/\s+/);
200
+ const target = values[0] || "";
201
+
202
+ if (!source || !target) {
203
+ throw new Error(
204
+ `Invalid custom dictionary file ${file}:${i + 1}: empty source or target`
205
+ );
206
+ }
207
+
208
+ pairs.push([source, target]);
209
+ }
210
+
211
+ return pairs;
212
+ }
213
+
115
214
  function hasFlag(args, shortName, longName) {
116
215
  return (
117
216
  (shortName && args.includes(shortName)) ||
@@ -167,24 +266,20 @@ function inferOfficeFormat(inputFile, explicitFormat) {
167
266
  return ext;
168
267
  }
169
268
 
170
- function makeDefaultOfficeOutput(inputFile, officeFormat, autoExt) {
269
+ function makeDefaultOfficeOutput(inputFile, officeFormat, convertFilename, cc, config, punct) {
171
270
  const parsed = path.parse(inputFile);
172
- const ext = autoExt && OFFICE_FORMATS.has(officeFormat)
173
- ? `.${officeFormat}`
174
- : parsed.ext;
271
+ const stem = convertFilename
272
+ ? cc.convert(parsed.name, punct)
273
+ : parsed.name;
175
274
 
176
275
  return path.join(
177
276
  parsed.dir || process.cwd(),
178
- `${parsed.name}_converted${ext}`
277
+ `${stem}_converted.${officeFormat}`
179
278
  );
180
279
  }
181
280
 
182
- function applyAutoExt(outputFile, officeFormat, autoExt) {
183
- if (!autoExt || path.extname(outputFile)) {
184
- return outputFile;
185
- }
186
-
187
- if (!OFFICE_FORMATS.has(officeFormat)) {
281
+ function applyOutputExtension(outputFile, officeFormat) {
282
+ if (path.extname(outputFile)) {
188
283
  return outputFile;
189
284
  }
190
285
 
@@ -249,6 +344,7 @@ async function runConvert(args) {
249
344
  const outEnc = getArg(args, null, "--out-enc", "utf8");
250
345
  const punct = hasFlag(args, "-p", "--punct");
251
346
  const keepIds = hasFlag(args, null, "--keep-ids");
347
+ const customDicts = getArgs(args, "--custom-dict");
252
348
 
253
349
  const detofuIndex = args.indexOf("--detofu");
254
350
  const detofuEnabled = detofuIndex !== -1;
@@ -266,7 +362,10 @@ async function runConvert(args) {
266
362
 
267
363
  await ensureWasmInitialized();
268
364
 
269
- const cc = new OpenccWasm(config);
365
+ // const cc = new OpenccWasm(config);
366
+ const cc = customDicts.length === 0
367
+ ? new OpenccWasm(config)
368
+ : OpenccWasm.newWithCustomDicts(config, customDicts);
270
369
 
271
370
  if (keepIds) {
272
371
  cc.setPreserveIds(true);
@@ -299,7 +398,7 @@ async function runConvert(args) {
299
398
  if (keepIds) suffixParts.push("keep-ids");
300
399
 
301
400
  const suffix = suffixParts.length ? `, ${suffixParts.join(", ")}` : "";
302
- console.error(`Conversion completed (${config}${suffix}): ${inFrom} -> ${outTo}`);
401
+ console.error(`Conversion completed (${cc.getConfig()}${suffix}): ${inFrom} -> ${outTo}`);
303
402
  }
304
403
  }
305
404
 
@@ -309,8 +408,9 @@ async function runOffice(args) {
309
408
  const config = getArg(args, "-c", "--config", "s2t");
310
409
  const explicitFormat = getArg(args, null, "--format");
311
410
  const punct = hasFlag(args, "-p", "--punct");
312
- const autoExt = hasFlag(args, null, "--auto-ext");
411
+ const convertFilename = hasFlag(args, null, "--convert-filename");
313
412
  const keepFont = !hasFlag(args, null, "--no-keep-font");
413
+ const customDicts = getArgs(args, "--custom-dict");
314
414
 
315
415
  if (!input) {
316
416
  throw new Error("Input file is missing.");
@@ -322,18 +422,23 @@ async function runOffice(args) {
322
422
 
323
423
  const officeFormat = inferOfficeFormat(input, explicitFormat);
324
424
 
425
+ await ensureWasmInitialized();
426
+
427
+ // const cc = new OpenccWasm(config);
428
+ const cc = customDicts.length === 0
429
+ ? new OpenccWasm(config)
430
+ : OpenccWasm.newWithCustomDicts(config, customDicts);
431
+
325
432
  if (!output) {
326
- output = makeDefaultOfficeOutput(input, officeFormat, autoExt);
433
+ output = makeDefaultOfficeOutput(input, officeFormat, convertFilename, cc, config, punct);
327
434
  console.error(`Output file not specified. Using: ${output}`);
328
435
  } else {
329
- output = applyAutoExt(output, officeFormat, autoExt);
436
+ output = applyOutputExtension(output, officeFormat);
330
437
  }
331
438
 
332
- await ensureWasmInitialized();
333
-
334
439
  const inputBytes = fs.readFileSync(input);
335
440
 
336
- const outputBytes = convert_office_bytes(
441
+ const outputBytes = cc.convertOfficeBytes(
337
442
  inputBytes,
338
443
  officeFormat,
339
444
  config,
@@ -343,7 +448,7 @@ async function runOffice(args) {
343
448
 
344
449
  fs.writeFileSync(output, outputBytes);
345
450
 
346
- console.error(`Conversion completed (${config}, ${officeFormat}): ${input} -> ${output}`);
451
+ console.error(`Conversion completed (${cc.getConfig()}, ${officeFormat}): ${input} -> ${output}`);
347
452
  }
348
453
 
349
454
  async function main() {
@@ -38,6 +38,7 @@ export class OpenccWasm {
38
38
  [Symbol.dispose](): void;
39
39
  convert(text: string, punctuation: boolean): string;
40
40
  convertDetofu(text: string, punctuation: boolean, level: DetofuLevelWasm): string;
41
+ convertOfficeBytes(input: Uint8Array, format: string, punctuation: boolean, keep_font: boolean): Uint8Array;
41
42
  debugPing(): string;
42
43
  detofu(text: string, level: DetofuLevelWasm): string;
43
44
  getConfig(): string;
@@ -65,6 +66,7 @@ export interface InitOutput {
65
66
  readonly convert_office_bytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => [number, number, number, number];
66
67
  readonly openccwasm_convert: (a: number, b: number, c: number, d: number) => [number, number];
67
68
  readonly openccwasm_convertDetofu: (a: number, b: number, c: number, d: number, e: number) => [number, number];
69
+ readonly openccwasm_convertOfficeBytes: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => [number, number, number, number];
68
70
  readonly openccwasm_debugPing: (a: number) => [number, number];
69
71
  readonly openccwasm_detofu: (a: number, b: number, c: number, d: number) => [number, number];
70
72
  readonly openccwasm_getConfig: (a: number) => [number, number];
@@ -94,6 +94,26 @@ export class OpenccWasm {
94
94
  wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
95
95
  }
96
96
  }
97
+ /**
98
+ * @param {Uint8Array} input
99
+ * @param {string} format
100
+ * @param {boolean} punctuation
101
+ * @param {boolean} keep_font
102
+ * @returns {Uint8Array}
103
+ */
104
+ convertOfficeBytes(input, format, punctuation, keep_font) {
105
+ const ptr0 = passArray8ToWasm0(input, wasm.__wbindgen_malloc);
106
+ const len0 = WASM_VECTOR_LEN;
107
+ const ptr1 = passStringToWasm0(format, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
108
+ const len1 = WASM_VECTOR_LEN;
109
+ const ret = wasm.openccwasm_convertOfficeBytes(this.__wbg_ptr, ptr0, len0, ptr1, len1, punctuation, keep_font);
110
+ if (ret[3]) {
111
+ throw takeFromExternrefTable0(ret[2]);
112
+ }
113
+ var v3 = getArrayU8FromWasm0(ret[0], ret[1]).slice();
114
+ wasm.__wbindgen_free(ret[0], ret[1] * 1, 1);
115
+ return v3;
116
+ }
97
117
  /**
98
118
  * @returns {string}
99
119
  */
@@ -291,7 +311,7 @@ export function convert_office_bytes(input, format, config, punctuation, keep_fo
291
311
  function __wbg_get_imports() {
292
312
  const import0 = {
293
313
  __proto__: null,
294
- __wbg_Error_ef53bc310eb298a0: function(arg0, arg1) {
314
+ __wbg_Error_92b29b0548f8b746: function(arg0, arg1) {
295
315
  const ret = Error(getStringFromWasm0(arg0, arg1));
296
316
  return ret;
297
317
  },
@@ -302,46 +322,46 @@ function __wbg_get_imports() {
302
322
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
303
323
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
304
324
  },
305
- __wbg___wbindgen_boolean_get_1a45e2c38d4d41b9: function(arg0) {
325
+ __wbg___wbindgen_boolean_get_fa956cfa2d1bd751: function(arg0) {
306
326
  const v = arg0;
307
327
  const ret = typeof(v) === 'boolean' ? v : undefined;
308
328
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
309
329
  },
310
- __wbg___wbindgen_debug_string_0accd80f45e5faa2: function(arg0, arg1) {
330
+ __wbg___wbindgen_debug_string_c25d447a39f5578f: function(arg0, arg1) {
311
331
  const ret = debugString(arg1);
312
332
  const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
313
333
  const len1 = WASM_VECTOR_LEN;
314
334
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
315
335
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
316
336
  },
317
- __wbg___wbindgen_in_70a403a56e771704: function(arg0, arg1) {
337
+ __wbg___wbindgen_in_aca499c5de7ff5e5: function(arg0, arg1) {
318
338
  const ret = arg0 in arg1;
319
339
  return ret;
320
340
  },
321
- __wbg___wbindgen_is_function_754e9f305ff6029e: function(arg0) {
341
+ __wbg___wbindgen_is_function_1ff95bcc5517c252: function(arg0) {
322
342
  const ret = typeof(arg0) === 'function';
323
343
  return ret;
324
344
  },
325
- __wbg___wbindgen_is_object_56732c2bc353f41d: function(arg0) {
345
+ __wbg___wbindgen_is_object_a27215656b807791: function(arg0) {
326
346
  const val = arg0;
327
347
  const ret = typeof(val) === 'object' && val !== null;
328
348
  return ret;
329
349
  },
330
- __wbg___wbindgen_is_undefined_67b456be8673d3d7: function(arg0) {
350
+ __wbg___wbindgen_is_undefined_c05833b95a3cf397: function(arg0) {
331
351
  const ret = arg0 === undefined;
332
352
  return ret;
333
353
  },
334
- __wbg___wbindgen_jsval_loose_eq_2c56564c75129511: function(arg0, arg1) {
354
+ __wbg___wbindgen_jsval_loose_eq_db4c3b15f63fc170: function(arg0, arg1) {
335
355
  const ret = arg0 == arg1;
336
356
  return ret;
337
357
  },
338
- __wbg___wbindgen_number_get_9bb1761122181af2: function(arg0, arg1) {
358
+ __wbg___wbindgen_number_get_394265ed1e1b84ee: function(arg0, arg1) {
339
359
  const obj = arg1;
340
360
  const ret = typeof(obj) === 'number' ? obj : undefined;
341
361
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
342
362
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
343
363
  },
344
- __wbg___wbindgen_string_get_72bdf95d3ae505b1: function(arg0, arg1) {
364
+ __wbg___wbindgen_string_get_b0ca35b86a603356: function(arg0, arg1) {
345
365
  const obj = arg1;
346
366
  const ret = typeof(obj) === 'string' ? obj : undefined;
347
367
  var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
@@ -349,22 +369,22 @@ function __wbg_get_imports() {
349
369
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
350
370
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
351
371
  },
352
- __wbg___wbindgen_throw_1506f2235d1bdba0: function(arg0, arg1) {
372
+ __wbg___wbindgen_throw_344f42d3211c4765: function(arg0, arg1) {
353
373
  throw new Error(getStringFromWasm0(arg0, arg1));
354
374
  },
355
- __wbg_call_8a89609d89f6608a: function() { return handleError(function (arg0, arg1) {
375
+ __wbg_call_8a2dd23819f8a60a: function() { return handleError(function (arg0, arg1) {
356
376
  const ret = arg0.call(arg1);
357
377
  return ret;
358
378
  }, arguments); },
359
- __wbg_done_60cf307fcc680536: function(arg0) {
379
+ __wbg_done_89b2b13e91a60321: function(arg0) {
360
380
  const ret = arg0.done;
361
381
  return ret;
362
382
  },
363
- __wbg_get_1f8f054ddbaa7db2: function() { return handleError(function (arg0, arg1) {
383
+ __wbg_get_c7eb1f358a7654df: function() { return handleError(function (arg0, arg1) {
364
384
  const ret = Reflect.get(arg0, arg1);
365
385
  return ret;
366
386
  }, arguments); },
367
- __wbg_get_unchecked_33f6e5c9e2f2d6b2: function(arg0, arg1) {
387
+ __wbg_get_unchecked_6e0ad6d2a41b06f6: function(arg0, arg1) {
368
388
  const ret = arg0[arg1 >>> 0];
369
389
  return ret;
370
390
  },
@@ -372,7 +392,7 @@ function __wbg_get_imports() {
372
392
  const ret = arg0[arg1];
373
393
  return ret;
374
394
  },
375
- __wbg_instanceof_ArrayBuffer_8f49811467741499: function(arg0) {
395
+ __wbg_instanceof_ArrayBuffer_4480b9e0068a8adb: function(arg0) {
376
396
  let result;
377
397
  try {
378
398
  result = arg0 instanceof ArrayBuffer;
@@ -382,7 +402,7 @@ function __wbg_get_imports() {
382
402
  const ret = result;
383
403
  return ret;
384
404
  },
385
- __wbg_instanceof_Uint8Array_86f30649f63ef9c2: function(arg0) {
405
+ __wbg_instanceof_Uint8Array_309b927aaf7a3fc7: function(arg0) {
386
406
  let result;
387
407
  try {
388
408
  result = arg0 instanceof Uint8Array;
@@ -392,38 +412,38 @@ function __wbg_get_imports() {
392
412
  const ret = result;
393
413
  return ret;
394
414
  },
395
- __wbg_isArray_67c2c9c4313f4448: function(arg0) {
415
+ __wbg_isArray_0677c962b281d01a: function(arg0) {
396
416
  const ret = Array.isArray(arg0);
397
417
  return ret;
398
418
  },
399
- __wbg_iterator_8732428d309e270e: function() {
419
+ __wbg_iterator_6f722e4a93058b71: function() {
400
420
  const ret = Symbol.iterator;
401
421
  return ret;
402
422
  },
403
- __wbg_length_4a591ecaa01354d9: function(arg0) {
423
+ __wbg_length_1f0964f4a5e2c6d8: function(arg0) {
404
424
  const ret = arg0.length;
405
425
  return ret;
406
426
  },
407
- __wbg_length_66f1a4b2e9026940: function(arg0) {
427
+ __wbg_length_370319915dc99107: function(arg0) {
408
428
  const ret = arg0.length;
409
429
  return ret;
410
430
  },
411
- __wbg_new_578aeef4b6b94378: function(arg0) {
431
+ __wbg_new_cd45aabdf6073e84: function(arg0) {
412
432
  const ret = new Uint8Array(arg0);
413
433
  return ret;
414
434
  },
415
- __wbg_next_9e03acdf51c4960d: function(arg0) {
435
+ __wbg_next_6dbf2c0ac8cde20f: function(arg0) {
416
436
  const ret = arg0.next;
417
437
  return ret;
418
438
  },
419
- __wbg_next_eb8ca7351fa27906: function() { return handleError(function (arg0) {
439
+ __wbg_next_71f2aa1cb3d1e37e: function() { return handleError(function (arg0) {
420
440
  const ret = arg0.next();
421
441
  return ret;
422
442
  }, arguments); },
423
- __wbg_prototypesetcall_3249fc62a0fafa30: function(arg0, arg1, arg2) {
443
+ __wbg_prototypesetcall_4770620bbe4688a0: function(arg0, arg1, arg2) {
424
444
  Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
425
445
  },
426
- __wbg_value_f3625092ee4b37f4: function(arg0) {
446
+ __wbg_value_a5d5488a9589444a: function(arg0) {
427
447
  const ret = arg0.value;
428
448
  return ret;
429
449
  },
Binary file
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@laisuk/opencc-fmmseg-wasm",
3
3
  "type": "module",
4
4
  "description": "WebAssembly bindings for opencc-fmmseg, a high-performance OpenCC-compatible Simplified/Traditional Chinese converter.",
5
- "version": "0.3.3",
5
+ "version": "0.3.4",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",