@codemerge/hunspell 2.4.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 +21 -0
- package/NOTICE +35 -0
- package/dist/applyRule.d.cts +6 -0
- package/dist/applyRule.d.ts +6 -0
- package/dist/applyRule.d.ts.map +1 -0
- package/dist/check.d.cts +14 -0
- package/dist/check.d.ts +14 -0
- package/dist/check.d.ts.map +1 -0
- package/dist/dictionary.d.cts +7 -0
- package/dist/dictionary.d.ts +7 -0
- package/dist/dictionary.d.ts.map +1 -0
- package/dist/index.cjs +435 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +3 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.mjs +434 -0
- package/dist/index.mjs.map +1 -0
- package/dist/limits.d.cts +12 -0
- package/dist/limits.d.ts +12 -0
- package/dist/limits.d.ts.map +1 -0
- package/dist/parseAff.d.cts +13 -0
- package/dist/parseAff.d.ts +13 -0
- package/dist/parseAff.d.ts.map +1 -0
- package/dist/parseDic.d.cts +13 -0
- package/dist/parseDic.d.ts +13 -0
- package/dist/parseDic.d.ts.map +1 -0
- package/dist/parseRuleCodes.d.cts +7 -0
- package/dist/parseRuleCodes.d.ts +7 -0
- package/dist/parseRuleCodes.d.ts.map +1 -0
- package/dist/suggest.d.cts +6 -0
- package/dist/suggest.d.ts +6 -0
- package/dist/suggest.d.ts.map +1 -0
- package/dist/types.d.cts +45 -0
- package/dist/types.d.ts +45 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +47 -0
package/dist/types.d.cts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** One PFX/SFX entry from a Hunspell `.aff` file. */
|
|
2
|
+
export type AffixEntry = {
|
|
3
|
+
add: string;
|
|
4
|
+
continuationClasses?: string[];
|
|
5
|
+
match?: RegExp;
|
|
6
|
+
/** SFX: trailing RegExp; PFX: literal prefix string to strip. */
|
|
7
|
+
remove?: RegExp | string;
|
|
8
|
+
};
|
|
9
|
+
/** Affix rule keyed by flag code in the `.aff` file. */
|
|
10
|
+
export type AffixRule = {
|
|
11
|
+
type: 'PFX' | 'SFX';
|
|
12
|
+
combineable: boolean;
|
|
13
|
+
entries: AffixEntry[];
|
|
14
|
+
};
|
|
15
|
+
export type AffixRules = Record<string, AffixRule>;
|
|
16
|
+
/** Named flag values from `.aff` (`FLAG`, `KEEPCASE`, `TRY`, …). */
|
|
17
|
+
export type AffFlags = Record<string, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Word → flag-code sets.
|
|
20
|
+
* - `null` — word present with no flags
|
|
21
|
+
* - `string[][]` — one or more flag lists (duplicate dic entries)
|
|
22
|
+
*/
|
|
23
|
+
export type DictionaryTable = Map<string, string[][] | null>;
|
|
24
|
+
export type ReplacementPair = readonly [from: string, to: string];
|
|
25
|
+
export type SuggestMemo = {
|
|
26
|
+
suggestions: string[];
|
|
27
|
+
limit: number;
|
|
28
|
+
};
|
|
29
|
+
/** Mutable engine state after parsing `.aff` + `.dic`. */
|
|
30
|
+
export type HunspellState = {
|
|
31
|
+
dictionaryTable: DictionaryTable;
|
|
32
|
+
/** Compiled compound-word patterns. */
|
|
33
|
+
compoundRules: RegExp[];
|
|
34
|
+
replacementTable: ReplacementPair[];
|
|
35
|
+
flags: AffFlags;
|
|
36
|
+
memoized: Record<string, SuggestMemo>;
|
|
37
|
+
alphabet: string;
|
|
38
|
+
};
|
|
39
|
+
export type HunspellDictionary = {
|
|
40
|
+
readonly loaded: true;
|
|
41
|
+
check(word: string): boolean;
|
|
42
|
+
checkExact(word: string): boolean;
|
|
43
|
+
suggest(word: string, limit?: number): string[];
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.d.ts
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
/** One PFX/SFX entry from a Hunspell `.aff` file. */
|
|
2
|
+
export type AffixEntry = {
|
|
3
|
+
add: string;
|
|
4
|
+
continuationClasses?: string[];
|
|
5
|
+
match?: RegExp;
|
|
6
|
+
/** SFX: trailing RegExp; PFX: literal prefix string to strip. */
|
|
7
|
+
remove?: RegExp | string;
|
|
8
|
+
};
|
|
9
|
+
/** Affix rule keyed by flag code in the `.aff` file. */
|
|
10
|
+
export type AffixRule = {
|
|
11
|
+
type: 'PFX' | 'SFX';
|
|
12
|
+
combineable: boolean;
|
|
13
|
+
entries: AffixEntry[];
|
|
14
|
+
};
|
|
15
|
+
export type AffixRules = Record<string, AffixRule>;
|
|
16
|
+
/** Named flag values from `.aff` (`FLAG`, `KEEPCASE`, `TRY`, …). */
|
|
17
|
+
export type AffFlags = Record<string, string>;
|
|
18
|
+
/**
|
|
19
|
+
* Word → flag-code sets.
|
|
20
|
+
* - `null` — word present with no flags
|
|
21
|
+
* - `string[][]` — one or more flag lists (duplicate dic entries)
|
|
22
|
+
*/
|
|
23
|
+
export type DictionaryTable = Map<string, string[][] | null>;
|
|
24
|
+
export type ReplacementPair = readonly [from: string, to: string];
|
|
25
|
+
export type SuggestMemo = {
|
|
26
|
+
suggestions: string[];
|
|
27
|
+
limit: number;
|
|
28
|
+
};
|
|
29
|
+
/** Mutable engine state after parsing `.aff` + `.dic`. */
|
|
30
|
+
export type HunspellState = {
|
|
31
|
+
dictionaryTable: DictionaryTable;
|
|
32
|
+
/** Compiled compound-word patterns. */
|
|
33
|
+
compoundRules: RegExp[];
|
|
34
|
+
replacementTable: ReplacementPair[];
|
|
35
|
+
flags: AffFlags;
|
|
36
|
+
memoized: Record<string, SuggestMemo>;
|
|
37
|
+
alphabet: string;
|
|
38
|
+
};
|
|
39
|
+
export type HunspellDictionary = {
|
|
40
|
+
readonly loaded: true;
|
|
41
|
+
check(word: string): boolean;
|
|
42
|
+
checkExact(word: string): boolean;
|
|
43
|
+
suggest(word: string, limit?: number): string[];
|
|
44
|
+
};
|
|
45
|
+
//# sourceMappingURL=types.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
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CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,QAAQ,CAAC,MAAM,EAAE,IAAI,CAAC;IACtB,KAAK,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAC7B,UAAU,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC;IAClC,OAAO,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;CACjD,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@codemerge/hunspell",
|
|
3
|
+
"version": "2.4.0",
|
|
4
|
+
"description": "In-house Hunspell .aff/.dic engine (check / suggest) for CodeMerge",
|
|
5
|
+
"license": "MIT AND BSD-3-Clause",
|
|
6
|
+
"author": "Pavel Kuzmin",
|
|
7
|
+
"repository": {
|
|
8
|
+
"type": "git",
|
|
9
|
+
"url": "git+https://github.com/s00d/on-codemerge.git",
|
|
10
|
+
"directory": "packages/hunspell"
|
|
11
|
+
},
|
|
12
|
+
"files": [
|
|
13
|
+
"dist",
|
|
14
|
+
"NOTICE"
|
|
15
|
+
],
|
|
16
|
+
"type": "module",
|
|
17
|
+
"sideEffects": false,
|
|
18
|
+
"main": "./dist/index.cjs",
|
|
19
|
+
"module": "./dist/index.mjs",
|
|
20
|
+
"types": "./dist/index.d.ts",
|
|
21
|
+
"exports": {
|
|
22
|
+
".": {
|
|
23
|
+
"import": {
|
|
24
|
+
"types": "./dist/index.d.ts",
|
|
25
|
+
"default": "./dist/index.mjs"
|
|
26
|
+
},
|
|
27
|
+
"require": {
|
|
28
|
+
"types": "./dist/index.d.cts",
|
|
29
|
+
"default": "./dist/index.cjs"
|
|
30
|
+
}
|
|
31
|
+
},
|
|
32
|
+
"./package.json": "./package.json"
|
|
33
|
+
},
|
|
34
|
+
"publishConfig": {
|
|
35
|
+
"access": "public"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"dictionary-en": "^4.0.0"
|
|
39
|
+
},
|
|
40
|
+
"engines": {
|
|
41
|
+
"node": ">=20"
|
|
42
|
+
},
|
|
43
|
+
"scripts": {
|
|
44
|
+
"build": "vite build",
|
|
45
|
+
"publint": "publint --strict"
|
|
46
|
+
}
|
|
47
|
+
}
|