@gukhanmun/wasm 0.1.0-dev.0
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/LICENSE +674 -0
- package/dist/index.d.ts +575 -0
- package/dist/index.js +248 -0
- package/dist/wasm/deno/gukhanmun_wasm.d.ts +68 -0
- package/dist/wasm/deno/gukhanmun_wasm.js +576 -0
- package/dist/wasm/deno/gukhanmun_wasm_bg.wasm +0 -0
- package/dist/wasm/deno/gukhanmun_wasm_bg.wasm.d.ts +18 -0
- package/dist/wasm/nodejs/gukhanmun_wasm.d.ts +68 -0
- package/dist/wasm/nodejs/gukhanmun_wasm.js +590 -0
- package/dist/wasm/nodejs/gukhanmun_wasm_bg.wasm +0 -0
- package/dist/wasm/nodejs/gukhanmun_wasm_bg.wasm.d.ts +18 -0
- package/dist/wasm/nodejs/package.json +21 -0
- package/dist/wasm/web/gukhanmun_wasm.d.ts +111 -0
- package/dist/wasm/web/gukhanmun_wasm.js +683 -0
- package/dist/wasm/web/gukhanmun_wasm_bg.wasm +0 -0
- package/dist/wasm/web/gukhanmun_wasm_bg.wasm.d.ts +18 -0
- package/dist/wasm/web/package.json +25 -0
- package/package.json +53 -0
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
/* tslint:disable */
|
|
2
|
+
/* eslint-disable */
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Owning hanja-to-hangul converter exposed to JavaScript.
|
|
6
|
+
*
|
|
7
|
+
* Construct via the `constructor` and keep the instance alive for the
|
|
8
|
+
* duration of all conversions. Each call to [`WasmGukhanmun::open_stream`]
|
|
9
|
+
* borrows this instance via a reference count; calling `free()` on the JS
|
|
10
|
+
* side drops the Rust value when the last stream is also freed.
|
|
11
|
+
*/
|
|
12
|
+
export class WasmGukhanmun {
|
|
13
|
+
free(): void;
|
|
14
|
+
[Symbol.dispose](): void;
|
|
15
|
+
/**
|
|
16
|
+
* Converts `source` in one shot and returns the result string.
|
|
17
|
+
*
|
|
18
|
+
* `format` is `"text"` (default), `"html"`, `"markdown"`, or
|
|
19
|
+
* `{ format: "markdown", gfm?: boolean }`. Throws a `GukhanmunError`
|
|
20
|
+
* on conversion failure.
|
|
21
|
+
*/
|
|
22
|
+
convert(source: string, format: any): string;
|
|
23
|
+
/**
|
|
24
|
+
* Creates a new converter from a JS options object and an array of
|
|
25
|
+
* dictionary records.
|
|
26
|
+
*
|
|
27
|
+
* `options` is a JSON-serialisable `GukhanmunOptions` object (may be
|
|
28
|
+
* `null` / `undefined` for all-defaults). `dictionaries` is a JS `Array`
|
|
29
|
+
* where each element is `{ format: "fst", bytes: Uint8Array }`.
|
|
30
|
+
*
|
|
31
|
+
* Throws a `GukhanmunError`-shaped object on invalid input or a failed
|
|
32
|
+
* dictionary load.
|
|
33
|
+
*/
|
|
34
|
+
constructor(options: any, dictionaries: any);
|
|
35
|
+
/**
|
|
36
|
+
* Opens a streaming handle for chunked conversion.
|
|
37
|
+
*
|
|
38
|
+
* The caller must feed string chunks via [`WasmStream::push`] and call
|
|
39
|
+
* [`WasmStream::finish`] to flush the final output. The batch-equivalence
|
|
40
|
+
* invariant holds: concatenating all `push` and `finish` return values
|
|
41
|
+
* equals the result of a single `convert` call on the concatenated input.
|
|
42
|
+
*/
|
|
43
|
+
open_stream(format: any): WasmStream;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
/**
|
|
47
|
+
* Chunked streaming handle produced by [`WasmGukhanmun::open_stream`].
|
|
48
|
+
*
|
|
49
|
+
* Accumulates string chunks and performs the full conversion at
|
|
50
|
+
* [`WasmStream::finish`]. This satisfies the batch-equivalence invariant:
|
|
51
|
+
* every arbitrary chunk partition of an input produces the same final output
|
|
52
|
+
* as a single [`WasmGukhanmun::convert`] call.
|
|
53
|
+
*/
|
|
54
|
+
export class WasmStream {
|
|
55
|
+
private constructor();
|
|
56
|
+
free(): void;
|
|
57
|
+
[Symbol.dispose](): void;
|
|
58
|
+
/**
|
|
59
|
+
* Converts the buffered input and returns the result. Clears the buffer
|
|
60
|
+
* so the stream handle can be reused.
|
|
61
|
+
*/
|
|
62
|
+
finish(): string;
|
|
63
|
+
/**
|
|
64
|
+
* Appends `chunk` to the internal buffer. Returns an empty string; all
|
|
65
|
+
* output is deferred to [`WasmStream::finish`].
|
|
66
|
+
*/
|
|
67
|
+
push(chunk: string): string;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
export type InitInput = RequestInfo | URL | Response | BufferSource | WebAssembly.Module;
|
|
71
|
+
|
|
72
|
+
export interface InitOutput {
|
|
73
|
+
readonly memory: WebAssembly.Memory;
|
|
74
|
+
readonly __wbg_wasmgukhanmun_free: (a: number, b: number) => void;
|
|
75
|
+
readonly __wbg_wasmstream_free: (a: number, b: number) => void;
|
|
76
|
+
readonly wasmgukhanmun_convert: (a: number, b: number, c: number, d: any) => [number, number, number, number];
|
|
77
|
+
readonly wasmgukhanmun_new: (a: any, b: any) => [number, number, number];
|
|
78
|
+
readonly wasmgukhanmun_open_stream: (a: number, b: any) => [number, number, number];
|
|
79
|
+
readonly wasmstream_finish: (a: number) => [number, number, number, number];
|
|
80
|
+
readonly wasmstream_push: (a: number, b: number, c: number) => [number, number, number, number];
|
|
81
|
+
readonly __wbindgen_malloc: (a: number, b: number) => number;
|
|
82
|
+
readonly __wbindgen_realloc: (a: number, b: number, c: number, d: number) => number;
|
|
83
|
+
readonly __wbindgen_exn_store: (a: number) => void;
|
|
84
|
+
readonly __externref_table_alloc: () => number;
|
|
85
|
+
readonly __wbindgen_externrefs: WebAssembly.Table;
|
|
86
|
+
readonly __externref_table_dealloc: (a: number) => void;
|
|
87
|
+
readonly __wbindgen_free: (a: number, b: number, c: number) => void;
|
|
88
|
+
readonly __wbindgen_start: () => void;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
export type SyncInitInput = BufferSource | WebAssembly.Module;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* Instantiates the given `module`, which can either be bytes or
|
|
95
|
+
* a precompiled `WebAssembly.Module`.
|
|
96
|
+
*
|
|
97
|
+
* @param {{ module: SyncInitInput }} module - Passing `SyncInitInput` directly is deprecated.
|
|
98
|
+
*
|
|
99
|
+
* @returns {InitOutput}
|
|
100
|
+
*/
|
|
101
|
+
export function initSync(module: { module: SyncInitInput } | SyncInitInput): InitOutput;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* If `module_or_path` is {RequestInfo} or {URL}, makes a request and
|
|
105
|
+
* for everything else, calls `WebAssembly.instantiate` directly.
|
|
106
|
+
*
|
|
107
|
+
* @param {{ module_or_path: InitInput | Promise<InitInput> }} module_or_path - Passing `InitInput` directly is deprecated.
|
|
108
|
+
*
|
|
109
|
+
* @returns {Promise<InitOutput>}
|
|
110
|
+
*/
|
|
111
|
+
export default function __wbg_init (module_or_path?: { module_or_path: InitInput | Promise<InitInput> } | InitInput | Promise<InitInput>): Promise<InitOutput>;
|