cspell-dictionary 9.0.2 → 9.1.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.
@@ -1,6 +1,7 @@
1
1
  import type { CacheStats } from '../util/AutoCache.js';
2
2
  import type { PreferredSuggestion, SearchOptions, SpellingDictionary } from './SpellingDictionary.js';
3
3
  import type { SpellingDictionaryCollection } from './SpellingDictionaryCollection.js';
4
+ import type { SuggestOptionsRO } from './SuggestOptions.js';
4
5
  interface CallStats {
5
6
  name: string;
6
7
  id: number;
@@ -20,6 +21,7 @@ export interface CachingDictionary {
20
21
  isForbidden(word: string): boolean;
21
22
  stats(): CallStats;
22
23
  getPreferredSuggestions(word: string): PreferredSuggestion[] | undefined;
24
+ suggest(word: string, suggestOptions?: SuggestOptionsRO): import('cspell-trie-lib').SuggestionResult[];
23
25
  }
24
26
  interface LogEntryBase extends SearchOptions {
25
27
  time: number;
@@ -28,6 +28,7 @@ class CachedDict {
28
28
  isNoSuggestWord = autoCache((word) => this.dict.isNoSuggestWord(word, this.options), DefaultAutoCacheSize);
29
29
  isForbidden = autoCache((word) => this.dict.isForbidden(word), DefaultAutoCacheSize);
30
30
  getPreferredSuggestions = autoCache((word) => this.dict.getPreferredSuggestions?.(word), DefaultAutoCacheSize);
31
+ suggest = (word, suggestOptions) => this.dict.suggest(word, suggestOptions);
31
32
  stats() {
32
33
  return {
33
34
  name: this.name,
@@ -36,11 +36,11 @@ export type HasOptions = SearchOptions;
36
36
  export type HasOptionsRO = Readonly<HasOptions>;
37
37
  export type IgnoreCaseOption = boolean;
38
38
  export interface SpellingDictionaryOptions {
39
- repMap?: ReplaceMap;
39
+ repMap?: ReplaceMap | undefined;
40
40
  /**
41
41
  * The dictionary is case aware.
42
42
  */
43
- caseSensitive?: boolean;
43
+ caseSensitive?: boolean | undefined;
44
44
  /**
45
45
  * This is a NO Suggest dictionary used for words to be ignored.
46
46
  */
@@ -56,7 +56,7 @@ export interface SpellingDictionaryOptions {
56
56
  * Extra dictionary information used in improving suggestions
57
57
  * based upon locale.
58
58
  */
59
- dictionaryInformation?: DictionaryInformation;
59
+ dictionaryInformation?: DictionaryInformation | undefined;
60
60
  /**
61
61
  * Strip Case and Accents to allow for case insensitive searches and
62
62
  * words without accents.
@@ -25,7 +25,7 @@ export interface SuggestOptions {
25
25
  */
26
26
  includeTies?: boolean | undefined;
27
27
  /**
28
- * Maximum amount of time to allow for generating suggestions.
28
+ * Maximum amount of time in milliseconds to allow for generating suggestions.
29
29
  */
30
30
  timeout?: number | undefined;
31
31
  }
@@ -3,7 +3,7 @@ export { createInlineSpellingDictionary } from './createInlineSpellingDictionary
3
3
  export { createFailedToLoadDictionary, createSpellingDictionary } from './createSpellingDictionary.js';
4
4
  export { createFlagWordsDictionary, createFlagWordsDictionary as createForbiddenWordsDictionary, } from './FlagWordsDictionary.js';
5
5
  export { createIgnoreWordsDictionary } from './IgnoreWordsDictionary.js';
6
- export type { DictionaryDefinitionInline, FindOptions, FindResult, HasOptions, SearchOptions, SpellingDictionary, SpellingDictionaryOptions, } from './SpellingDictionary.js';
6
+ export type { DictionaryDefinitionInline, FindOptions, FindResult, HasOptions, PreferredSuggestion, SearchOptions, SpellingDictionary, SpellingDictionaryOptions, } from './SpellingDictionary.js';
7
7
  export { createCollection, SpellingDictionaryCollection } from './SpellingDictionaryCollection.js';
8
8
  export { createSpellingDictionaryFromTrieFile } from './SpellingDictionaryFromTrie.js';
9
9
  export { createSuggestDictionary } from './SuggestDictionary.js';
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  import { enableLogging as cacheDictionaryEnableLogging, getLog as cacheDictionaryGetLog } from './SpellingDictionary/CachingDictionary.js';
2
- export type { CachingDictionary, FindOptions, FindResult, HasOptions, SearchOptions, SpellingDictionary, SpellingDictionaryCollection, SpellingDictionaryOptions, SuggestionCollector, SuggestionResult, SuggestOptions, } from './SpellingDictionary/index.js';
2
+ export type { CachingDictionary, FindOptions, FindResult, HasOptions, PreferredSuggestion, SearchOptions, SpellingDictionary, SpellingDictionaryCollection, SpellingDictionaryOptions, SuggestionCollector, SuggestionResult, SuggestOptions, } from './SpellingDictionary/index.js';
3
3
  export { createCachingDictionary, createCollection, createFailedToLoadDictionary, createFlagWordsDictionary, createForbiddenWordsDictionary, createIgnoreWordsDictionary, createInlineSpellingDictionary, createSpellingDictionary, createSpellingDictionaryFromTrieFile, createSuggestDictionary, createSuggestOptions, } from './SpellingDictionary/index.js';
4
4
  /**
5
5
  * Debugging utilities.
package/package.json CHANGED
@@ -4,7 +4,7 @@
4
4
  "access": "public",
5
5
  "provenance": true
6
6
  },
7
- "version": "9.0.2",
7
+ "version": "9.1.1",
8
8
  "description": "A spelling dictionary library useful for checking words and getting suggestions.",
9
9
  "type": "module",
10
10
  "sideEffects": false,
@@ -54,14 +54,14 @@
54
54
  "node": ">=20"
55
55
  },
56
56
  "dependencies": {
57
- "@cspell/cspell-pipe": "9.0.2",
58
- "@cspell/cspell-types": "9.0.2",
59
- "cspell-trie-lib": "9.0.2",
57
+ "@cspell/cspell-pipe": "9.1.1",
58
+ "@cspell/cspell-types": "9.1.1",
59
+ "cspell-trie-lib": "9.1.1",
60
60
  "fast-equals": "^5.2.2"
61
61
  },
62
62
  "devDependencies": {
63
63
  "gensequence": "^7.0.0",
64
64
  "lorem-ipsum": "^2.0.8"
65
65
  },
66
- "gitHead": "39dbd9ab9b8943a023d9eda7f65f81e822f939b5"
66
+ "gitHead": "40c6e1a331f38a0c008aacf2cb527270752c35ad"
67
67
  }