cspell-dictionary 6.22.0 → 6.23.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.
@@ -26,14 +26,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.createFlagWordsDictionary = void 0;
27
27
  const sync_1 = require("@cspell/cspell-pipe/sync");
28
28
  const cspell_trie_lib_1 = require("cspell-trie-lib");
29
- const createSpellingDictionary_1 = require("./createSpellingDictionary");
30
29
  const Defaults = __importStar(require("./defaults"));
30
+ const SpellingDictionary_1 = require("./SpellingDictionary");
31
31
  const SpellingDictionaryFromTrie_1 = require("./SpellingDictionaryFromTrie");
32
32
  const SpellingDictionaryMethods_1 = require("./SpellingDictionaryMethods");
33
33
  const TyposDictionary_1 = require("./TyposDictionary");
34
34
  class FlagWordsDictionaryTrie extends SpellingDictionaryFromTrie_1.SpellingDictionaryFromTrie {
35
35
  constructor(trie, name, source) {
36
- super(trie, name, createSpellingDictionary_1.defaultOptions, source);
36
+ super(trie, name, SpellingDictionary_1.defaultOptions, source);
37
37
  this.name = name;
38
38
  this.source = source;
39
39
  this.containsNoSuggestWords = false;
@@ -1,6 +1,7 @@
1
1
  import type { DictionaryInformation, ReplaceMap } from '@cspell/cspell-types';
2
2
  import type { CompoundWordsMethod, SuggestionCollector, SuggestionResult, WeightMap } from 'cspell-trie-lib';
3
- export { CompoundWordsMethod, SuggestionCollector, SuggestionResult } from 'cspell-trie-lib';
3
+ export type { DictionaryDefinitionInline } from '@cspell/cspell-types';
4
+ export { CompoundWordsMethod, type SuggestionCollector, type SuggestionResult } from 'cspell-trie-lib';
4
5
  export interface SearchOptions {
5
6
  /**
6
7
  * Legacy compounds have been deprecated.
@@ -138,4 +139,5 @@ export interface SpellingDictionary extends DictionaryInfo {
138
139
  getErrors?(): Error[];
139
140
  }
140
141
  export type SuggestArgs = Parameters<SpellingDictionary['suggest']> | Parameters<(word: string, numSuggestions?: number, compoundMethod?: CompoundWordsMethod, numChanges?: number, ignoreCase?: boolean) => SuggestionResult[]>;
142
+ export declare const defaultOptions: SpellingDictionaryOptions;
141
143
  //# sourceMappingURL=SpellingDictionary.d.ts.map
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.CompoundWordsMethod = void 0;
3
+ exports.defaultOptions = exports.CompoundWordsMethod = void 0;
4
4
  var cspell_trie_lib_1 = require("cspell-trie-lib");
5
5
  Object.defineProperty(exports, "CompoundWordsMethod", { enumerable: true, get: function () { return cspell_trie_lib_1.CompoundWordsMethod; } });
6
+ exports.defaultOptions = Object.freeze({
7
+ weightMap: undefined,
8
+ });
6
9
  //# sourceMappingURL=SpellingDictionary.js.map
@@ -0,0 +1,3 @@
1
+ import type { DictionaryDefinitionInline, SpellingDictionary } from './SpellingDictionary';
2
+ export declare function createInlineSpellingDictionary(inlineDict: DictionaryDefinitionInline, source: string): SpellingDictionary;
3
+ //# sourceMappingURL=createInlineSpellingDictionary.d.ts.map
@@ -0,0 +1,19 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createInlineSpellingDictionary = void 0;
4
+ const util_1 = require("../util/util");
5
+ const createSpellingDictionary_1 = require("./createSpellingDictionary");
6
+ const FlagWordsDictionary_1 = require("./FlagWordsDictionary");
7
+ const IgnoreWordsDictionary_1 = require("./IgnoreWordsDictionary");
8
+ const SpellingDictionaryCollection_1 = require("./SpellingDictionaryCollection");
9
+ function createInlineSpellingDictionary(inlineDict, source) {
10
+ const { words, flagWords, ignoreWords, name } = inlineDict;
11
+ const dictSources = [
12
+ words && (0, createSpellingDictionary_1.createSpellingDictionary)(words, name + '-words', source, inlineDict),
13
+ flagWords && (0, FlagWordsDictionary_1.createFlagWordsDictionary)(flagWords, name + '-flag-words', source),
14
+ ignoreWords && (0, IgnoreWordsDictionary_1.createIgnoreWordsDictionary)(ignoreWords, name + '-ignore-words', source),
15
+ ].filter(util_1.isDefined);
16
+ return (0, SpellingDictionaryCollection_1.createCollection)(dictSources, name);
17
+ }
18
+ exports.createInlineSpellingDictionary = createInlineSpellingDictionary;
19
+ //# sourceMappingURL=createInlineSpellingDictionary.js.map
@@ -1,6 +1,5 @@
1
1
  import type { IterableLike } from '../util/IterableLike';
2
2
  import type { DictionaryInfo, SpellingDictionary, SpellingDictionaryOptions } from './SpellingDictionary';
3
- export declare const defaultOptions: SpellingDictionaryOptions;
4
3
  /**
5
4
  * Create a SpellingDictionary
6
5
  * @param wordList - list of words
@@ -1,14 +1,12 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createFailedToLoadDictionary = exports.createSpellingDictionary = exports.defaultOptions = void 0;
3
+ exports.createFailedToLoadDictionary = exports.createSpellingDictionary = void 0;
4
4
  const cspell_trie_lib_1 = require("cspell-trie-lib");
5
5
  const fast_equals_1 = require("fast-equals");
6
6
  const simpleCache_1 = require("../util/simpleCache");
7
+ const SpellingDictionary_1 = require("./SpellingDictionary");
7
8
  const SpellingDictionaryFromTrie_1 = require("./SpellingDictionaryFromTrie");
8
9
  const SpellingDictionaryMethods_1 = require("./SpellingDictionaryMethods");
9
- exports.defaultOptions = Object.freeze({
10
- weightMap: undefined,
11
- });
12
10
  const cachedDictionaries = new simpleCache_1.AutoWeakCache(_createSpellingDictionary, 64);
13
11
  const maxSetSize = 3;
14
12
  const cachedParamsByWordList = new simpleCache_1.SimpleCache(64);
@@ -44,7 +42,7 @@ function _createSpellingDictionary(params) {
44
42
  const parseOptions = { stripCaseAndAccents: options?.supportNonStrictSearches ?? true };
45
43
  const words = (0, cspell_trie_lib_1.parseDictionaryLines)(wordList, parseOptions);
46
44
  const trie = (0, cspell_trie_lib_1.buildTrieFast)(words);
47
- const opts = { ...(options || exports.defaultOptions) };
45
+ const opts = { ...(options || SpellingDictionary_1.defaultOptions) };
48
46
  if (opts.weightMap === undefined && opts.dictionaryInformation) {
49
47
  opts.weightMap = (0, SpellingDictionaryMethods_1.createWeightMapFromDictionaryInformation)(opts.dictionaryInformation);
50
48
  }
@@ -1,8 +1,9 @@
1
1
  export { CachingDictionary, createCachingDictionary } from './CachingDictionary';
2
+ export { createInlineSpellingDictionary } from './createInlineSpellingDictionary';
2
3
  export { createFailedToLoadDictionary, createSpellingDictionary } from './createSpellingDictionary';
3
4
  export { createFlagWordsDictionary, createFlagWordsDictionary as createForbiddenWordsDictionary, } from './FlagWordsDictionary';
4
5
  export { createIgnoreWordsDictionary } from './IgnoreWordsDictionary';
5
- export type { FindOptions, FindResult, HasOptions, SearchOptions, SpellingDictionary, SpellingDictionaryOptions, SuggestionCollector, SuggestionResult, SuggestOptions, } from './SpellingDictionary';
6
+ export type { DictionaryDefinitionInline, FindOptions, FindResult, HasOptions, SearchOptions, SpellingDictionary, SpellingDictionaryOptions, SuggestionCollector, SuggestionResult, SuggestOptions, } from './SpellingDictionary';
6
7
  export { createCollection, SpellingDictionaryCollection } from './SpellingDictionaryCollection';
7
8
  export { createSpellingDictionaryFromTrieFile } from './SpellingDictionaryFromTrie';
8
9
  export { createTyposDictionary } from './TyposDictionary';
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createTyposDictionary = exports.createSpellingDictionaryFromTrieFile = exports.createCollection = exports.createIgnoreWordsDictionary = exports.createForbiddenWordsDictionary = exports.createFlagWordsDictionary = exports.createSpellingDictionary = exports.createFailedToLoadDictionary = exports.createCachingDictionary = void 0;
3
+ exports.createTyposDictionary = exports.createSpellingDictionaryFromTrieFile = exports.createCollection = exports.createIgnoreWordsDictionary = exports.createForbiddenWordsDictionary = exports.createFlagWordsDictionary = exports.createSpellingDictionary = exports.createFailedToLoadDictionary = exports.createInlineSpellingDictionary = exports.createCachingDictionary = void 0;
4
4
  var CachingDictionary_1 = require("./CachingDictionary");
5
5
  Object.defineProperty(exports, "createCachingDictionary", { enumerable: true, get: function () { return CachingDictionary_1.createCachingDictionary; } });
6
+ var createInlineSpellingDictionary_1 = require("./createInlineSpellingDictionary");
7
+ Object.defineProperty(exports, "createInlineSpellingDictionary", { enumerable: true, get: function () { return createInlineSpellingDictionary_1.createInlineSpellingDictionary; } });
6
8
  var createSpellingDictionary_1 = require("./createSpellingDictionary");
7
9
  Object.defineProperty(exports, "createFailedToLoadDictionary", { enumerable: true, get: function () { return createSpellingDictionary_1.createFailedToLoadDictionary; } });
8
10
  Object.defineProperty(exports, "createSpellingDictionary", { enumerable: true, get: function () { return createSpellingDictionary_1.createSpellingDictionary; } });
package/dist/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export type { CachingDictionary, FindOptions, FindResult, HasOptions, SearchOptions, SpellingDictionary, SpellingDictionaryCollection, SpellingDictionaryOptions, SuggestionCollector, SuggestionResult, SuggestOptions, } from './SpellingDictionary';
2
- export { createCachingDictionary, createCollection, createFailedToLoadDictionary, createFlagWordsDictionary, createForbiddenWordsDictionary, createIgnoreWordsDictionary, createSpellingDictionary, createSpellingDictionaryFromTrieFile, } from './SpellingDictionary';
2
+ export { createCachingDictionary, createCollection, createFailedToLoadDictionary, createFlagWordsDictionary, createForbiddenWordsDictionary, createIgnoreWordsDictionary, createInlineSpellingDictionary, createSpellingDictionary, createSpellingDictionaryFromTrieFile, } from './SpellingDictionary';
3
3
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSpellingDictionaryFromTrieFile = exports.createSpellingDictionary = exports.createIgnoreWordsDictionary = exports.createForbiddenWordsDictionary = exports.createFlagWordsDictionary = exports.createFailedToLoadDictionary = exports.createCollection = exports.createCachingDictionary = void 0;
3
+ exports.createSpellingDictionaryFromTrieFile = exports.createSpellingDictionary = exports.createInlineSpellingDictionary = exports.createIgnoreWordsDictionary = exports.createForbiddenWordsDictionary = exports.createFlagWordsDictionary = exports.createFailedToLoadDictionary = exports.createCollection = exports.createCachingDictionary = void 0;
4
4
  var SpellingDictionary_1 = require("./SpellingDictionary");
5
5
  Object.defineProperty(exports, "createCachingDictionary", { enumerable: true, get: function () { return SpellingDictionary_1.createCachingDictionary; } });
6
6
  Object.defineProperty(exports, "createCollection", { enumerable: true, get: function () { return SpellingDictionary_1.createCollection; } });
@@ -8,6 +8,7 @@ Object.defineProperty(exports, "createFailedToLoadDictionary", { enumerable: tru
8
8
  Object.defineProperty(exports, "createFlagWordsDictionary", { enumerable: true, get: function () { return SpellingDictionary_1.createFlagWordsDictionary; } });
9
9
  Object.defineProperty(exports, "createForbiddenWordsDictionary", { enumerable: true, get: function () { return SpellingDictionary_1.createForbiddenWordsDictionary; } });
10
10
  Object.defineProperty(exports, "createIgnoreWordsDictionary", { enumerable: true, get: function () { return SpellingDictionary_1.createIgnoreWordsDictionary; } });
11
+ Object.defineProperty(exports, "createInlineSpellingDictionary", { enumerable: true, get: function () { return SpellingDictionary_1.createInlineSpellingDictionary; } });
11
12
  Object.defineProperty(exports, "createSpellingDictionary", { enumerable: true, get: function () { return SpellingDictionary_1.createSpellingDictionary; } });
12
13
  Object.defineProperty(exports, "createSpellingDictionaryFromTrieFile", { enumerable: true, get: function () { return SpellingDictionary_1.createSpellingDictionaryFromTrieFile; } });
13
14
  //# sourceMappingURL=index.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell-dictionary",
3
- "version": "6.22.0",
3
+ "version": "6.23.0",
4
4
  "description": "A spelling dictionary library useful for checking words and getting suggestions.",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -39,15 +39,15 @@
39
39
  },
40
40
  "devDependencies": {
41
41
  "@types/jest": "^29.4.0",
42
- "jest": "^29.4.1",
42
+ "jest": "^29.4.2",
43
43
  "ts-jest": "^29.0.5"
44
44
  },
45
45
  "dependencies": {
46
- "@cspell/cspell-pipe": "6.22.0",
47
- "@cspell/cspell-types": "6.22.0",
48
- "cspell-trie-lib": "6.22.0",
46
+ "@cspell/cspell-pipe": "6.23.0",
47
+ "@cspell/cspell-types": "6.23.0",
48
+ "cspell-trie-lib": "6.23.0",
49
49
  "fast-equals": "^4.0.3",
50
50
  "gensequence": "^4.0.3"
51
51
  },
52
- "gitHead": "a133874ed7590cbe140f5067cfa80db84b644a5d"
52
+ "gitHead": "a7cfbfa6cf42c9d9746dd8229d9f1317472e5af8"
53
53
  }