@laisuk/opencc-fmmseg-wasm 0.3.0 → 0.3.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 CHANGED
@@ -546,11 +546,10 @@ fs.writeFileSync("output.docx", outputBytes);
546
546
 
547
547
  > **Note**
548
548
  >
549
- > The npm package automatically loads the bundled WebAssembly module when
550
- > installed normally via npm.
549
+ > Normally, `await init();` is sufficient when using the published npm package.
551
550
  >
552
- > If you are running examples directly from a local repository checkout,
553
- > you may need to initialize using explicit WASM bytes:
551
+ > When running directly from a local repository checkout (for example in tests
552
+ > or development scripts), initialize using explicit WASM bytes:
554
553
  >
555
554
  > ```javascript
556
555
  > import fs from "fs";
@@ -560,9 +559,10 @@ fs.writeFileSync("output.docx", outputBytes);
560
559
  > "../pkg/opencc_fmmseg_wasm_bg.wasm"
561
560
  > );
562
561
  >
563
- > await init({ module: wasmBytes });
562
+ > await init({
563
+ > module_or_path: wasmBytes
564
+ > });
564
565
  > ```
565
- >
566
566
 
567
567
  ---
568
568
 
@@ -49,6 +49,7 @@ export class OpenccWasm {
49
49
  static newWithEnum(config?: OpenccConfigWasm | null): OpenccWasm;
50
50
  setConfig(config: string): boolean;
51
51
  setConfigEnum(config: OpenccConfigWasm): void;
52
+ static version(): string;
52
53
  zhoCheck(text: string): number;
53
54
  }
54
55
 
@@ -73,6 +74,7 @@ export interface InitOutput {
73
74
  readonly openccwasm_newWithEnum: (a: number) => [number, number, number];
74
75
  readonly openccwasm_setConfig: (a: number, b: number, c: number) => number;
75
76
  readonly openccwasm_setConfigEnum: (a: number, b: number) => void;
77
+ readonly openccwasm_version: () => [number, number];
76
78
  readonly openccwasm_zhoCheck: (a: number, b: number, c: number) => number;
77
79
  readonly __wbindgen_malloc: (a: number, b: number) => number;
78
80
  readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
@@ -224,6 +224,21 @@ export class OpenccWasm {
224
224
  setConfigEnum(config) {
225
225
  wasm.openccwasm_setConfigEnum(this.__wbg_ptr, config);
226
226
  }
227
+ /**
228
+ * @returns {string}
229
+ */
230
+ static version() {
231
+ let deferred1_0;
232
+ let deferred1_1;
233
+ try {
234
+ const ret = wasm.openccwasm_version();
235
+ deferred1_0 = ret[0];
236
+ deferred1_1 = ret[1];
237
+ return getStringFromWasm0(ret[0], ret[1]);
238
+ } finally {
239
+ wasm.__wbindgen_free(deferred1_0, deferred1_1, 1);
240
+ }
241
+ }
227
242
  /**
228
243
  * @param {string} text
229
244
  * @returns {number}
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.0",
5
+ "version": "0.3.1",
6
6
  "license": "MIT",
7
7
  "repository": {
8
8
  "type": "git",