@gukhanmun/stdict-fst 0.4.0-dev.235 → 0.4.0-dev.236

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.
Files changed (2) hide show
  1. package/dist/index.d.ts +24 -7
  2. package/package.json +2 -2
package/dist/index.d.ts CHANGED
@@ -12,7 +12,8 @@
12
12
  * Deno 2.0+, and Bun only. Throws in browser environments.
13
13
  *
14
14
  * At runtime, a `FileDictionarySource` is distinguished from other values by
15
- * the presence of a `format` property (`"format" in source`).
15
+ * the absence of an `entries` property (`"entries" in source` selects a
16
+ * {@link MapDictionarySource}).
16
17
  */
17
18
  interface FileDictionarySource {
18
19
  /**
@@ -33,21 +34,37 @@ interface FileDictionarySource {
33
34
  * or in-memory bytes; supported in Node-API and (with `from_bytes`) in
34
35
  * WASM builds that include the `cdb` feature.
35
36
  *
36
- * The `"tsv"` format is reserved for future use; passing it throws
37
- * `GukhanmunError` with code `"unsupported-content-type"`.
37
+ * The `"tsv"` format is reserved and never accepted. Pass entries in memory
38
+ * through {@link MapDictionarySource} instead of compiling a table.
38
39
  */
39
40
  readonly format: "fst" | "cdb";
40
41
  }
41
42
  /**
42
- * A dictionary source accepted by {@link GukhanmunOptions.dictionaries}.
43
+ * A dictionary built from entries computed at runtime, such as per-document
44
+ * reading overrides.
43
45
  *
44
- * Currently only {@link FileDictionarySource} (binary file / URL / path) is
45
- * supported. Sources are tried in array order; the first match wins.
46
+ * Use this instead of compiling a TSV file with `gukhanmun-mkdict` when the
47
+ * entries do not exist on disk, for example in a browser, an edge runtime, or a
48
+ * site generator that derives entries per document.
49
+ *
50
+ * A source is distinguished from a {@link FileDictionarySource} by the presence
51
+ * of an `entries` property.
46
52
  *
47
53
  * @example
48
54
  * ```ts
49
55
  * import { stdictFst } from "@gukhanmun/stdict-fst";
50
- * const g = await load({ dictionaries: [await stdictFst()] });
56
+ * const g = await load({
57
+ * dictionaries: [
58
+ * {
59
+ * entries: [
60
+ * { hanja: "高橋", reading: "다카하시" },
61
+ * { hanja: "東京", reading: "도쿄", preference: 10 },
62
+ * { hanja: "年代", reading: "연대", suffixReading: "년대" },
63
+ * ],
64
+ * },
65
+ * await stdictFst(),
66
+ * ],
67
+ * });
51
68
  * ```
52
69
  */
53
70
  //#endregion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gukhanmun/stdict-fst",
3
- "version": "0.4.0-dev.235",
3
+ "version": "0.4.0-dev.236",
4
4
  "description": "Standard Korean Language Dictionary bundled as an FST binary for @gukhanmun/wasm and @gukhanmun/napi.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -55,7 +55,7 @@
55
55
  "@gukhanmun/types": "*"
56
56
  },
57
57
  "devDependencies": {
58
- "@gukhanmun/types": "0.4.0-dev.235+2861f4b"
58
+ "@gukhanmun/types": "0.4.0-dev.236+75afc34"
59
59
  },
60
60
  "scripts": {
61
61
  "build": "tsdown && node -e \"require('node:fs').copyFileSync('stdict.fst','dist/stdict.fst')\""