cspell-dictionary 6.27.0 → 6.29.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.
Files changed (129) hide show
  1. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/CachingDictionary.d.ts +3 -3
  2. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/CachingDictionary.js +9 -9
  3. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/FlagWordsDictionary.d.ts +1 -1
  4. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/FlagWordsDictionary.js +11 -11
  5. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/IgnoreWordsDictionary.d.ts +1 -1
  6. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/IgnoreWordsDictionary.js +5 -5
  7. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionary.d.ts +7 -0
  8. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryCollection.d.ts +1 -1
  9. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryCollection.js +12 -12
  10. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryFromTrie.d.ts +3 -2
  11. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryFromTrie.js +18 -17
  12. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryMethods.d.ts +1 -1
  13. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionaryMethods.js +5 -5
  14. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SuggestDictionary.d.ts +2 -2
  15. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SuggestDictionary.js +9 -9
  16. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Terms/index.d.ts +1 -1
  17. package/dist/cjs/SpellingDictionary/Typos/index.d.ts +4 -0
  18. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/index.js +7 -7
  19. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/typos.d.ts +1 -1
  20. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/typosParser.d.ts +1 -1
  21. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/typosParser.js +6 -6
  22. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/util.d.ts +1 -1
  23. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/TyposDictionary.d.ts +2 -2
  24. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/TyposDictionary.js +10 -10
  25. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/createInlineSpellingDictionary.d.ts +1 -1
  26. package/dist/cjs/SpellingDictionary/createInlineSpellingDictionary.js +25 -0
  27. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/createSpellingDictionary.d.ts +2 -2
  28. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/createSpellingDictionary.js +9 -9
  29. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/index.d.ts +10 -10
  30. package/dist/{SpellingDictionary → cjs/SpellingDictionary}/index.js +20 -20
  31. package/dist/{index.d.ts → cjs/index.d.ts} +2 -2
  32. package/dist/{index.js → cjs/index.js} +11 -11
  33. package/dist/{util → cjs/util}/clean.d.ts +1 -1
  34. package/dist/cjs/util/repMap.d.ts +27 -0
  35. package/dist/cjs/util/repMap.js +158 -0
  36. package/dist/{util → cjs/util}/textMappers.js +2 -2
  37. package/dist/esm/SpellingDictionary/CachingDictionary.d.mts +30 -0
  38. package/dist/esm/SpellingDictionary/CachingDictionary.mjs +45 -0
  39. package/dist/esm/SpellingDictionary/FlagWordsDictionary.d.mts +11 -0
  40. package/dist/esm/SpellingDictionary/FlagWordsDictionary.mjs +134 -0
  41. package/dist/esm/SpellingDictionary/IgnoreWordsDictionary.d.mts +11 -0
  42. package/dist/esm/SpellingDictionary/IgnoreWordsDictionary.mjs +96 -0
  43. package/dist/esm/SpellingDictionary/SpellingDictionary.d.mts +150 -0
  44. package/dist/esm/SpellingDictionary/SpellingDictionary.mjs +4 -0
  45. package/dist/esm/SpellingDictionary/SpellingDictionaryCollection.d.mts +16 -0
  46. package/dist/esm/SpellingDictionary/SpellingDictionaryCollection.mjs +111 -0
  47. package/dist/esm/SpellingDictionary/SpellingDictionaryFromTrie.d.mts +50 -0
  48. package/dist/esm/SpellingDictionary/SpellingDictionaryFromTrie.mjs +172 -0
  49. package/dist/esm/SpellingDictionary/SpellingDictionaryMethods.d.mts +26 -0
  50. package/dist/esm/SpellingDictionary/SpellingDictionaryMethods.mjs +96 -0
  51. package/dist/esm/SpellingDictionary/SuggestDictionary.d.mts +20 -0
  52. package/dist/esm/SpellingDictionary/SuggestDictionary.mjs +97 -0
  53. package/dist/esm/SpellingDictionary/Terms/index.d.mts +2 -0
  54. package/dist/esm/SpellingDictionary/Terms/index.mjs +1 -0
  55. package/dist/esm/SpellingDictionary/Terms/terms.d.mts +12 -0
  56. package/dist/esm/SpellingDictionary/Terms/terms.mjs +1 -0
  57. package/dist/esm/SpellingDictionary/Typos/index.d.mts +4 -0
  58. package/dist/esm/SpellingDictionary/Typos/index.mjs +2 -0
  59. package/dist/esm/SpellingDictionary/Typos/typos.d.mts +18 -0
  60. package/dist/esm/SpellingDictionary/Typos/typos.mjs +1 -0
  61. package/dist/esm/SpellingDictionary/Typos/typosParser.d.mts +34 -0
  62. package/dist/esm/SpellingDictionary/Typos/typosParser.mjs +131 -0
  63. package/dist/esm/SpellingDictionary/Typos/util.d.mts +31 -0
  64. package/dist/esm/SpellingDictionary/Typos/util.mjs +105 -0
  65. package/dist/esm/SpellingDictionary/TyposDictionary.d.mts +21 -0
  66. package/dist/esm/SpellingDictionary/TyposDictionary.mjs +129 -0
  67. package/dist/esm/SpellingDictionary/createInlineSpellingDictionary.d.mts +3 -0
  68. package/dist/esm/SpellingDictionary/createInlineSpellingDictionary.mjs +20 -0
  69. package/dist/esm/SpellingDictionary/createSpellingDictionary.d.mts +23 -0
  70. package/dist/esm/SpellingDictionary/createSpellingDictionary.mjs +68 -0
  71. package/dist/esm/SpellingDictionary/defaults.d.mts +3 -0
  72. package/dist/esm/SpellingDictionary/defaults.mjs +2 -0
  73. package/dist/esm/SpellingDictionary/index.d.mts +11 -0
  74. package/dist/esm/SpellingDictionary/index.mjs +9 -0
  75. package/dist/esm/index.d.mts +3 -0
  76. package/dist/esm/index.mjs +1 -0
  77. package/dist/esm/util/AutoCache.d.mts +25 -0
  78. package/dist/esm/util/AutoCache.mjs +67 -0
  79. package/dist/esm/util/AutoResolve.d.mts +21 -0
  80. package/dist/esm/util/AutoResolve.mjs +52 -0
  81. package/dist/esm/util/IterableLike.d.mts +4 -0
  82. package/dist/esm/util/IterableLike.mjs +1 -0
  83. package/dist/esm/util/clean.d.mts +7 -0
  84. package/dist/esm/util/clean.mjs +13 -0
  85. package/dist/esm/util/regexHelper.d.mts +7 -0
  86. package/dist/esm/util/regexHelper.mjs +8 -0
  87. package/dist/esm/util/repMap.d.mts +27 -0
  88. package/dist/esm/util/repMap.mjs +152 -0
  89. package/dist/esm/util/simpleCache.d.mts +46 -0
  90. package/dist/esm/util/simpleCache.mjs +135 -0
  91. package/dist/esm/util/text.d.mts +10 -0
  92. package/dist/esm/util/text.mjs +46 -0
  93. package/dist/esm/util/textMappers.d.mts +3 -0
  94. package/dist/esm/util/textMappers.mjs +15 -0
  95. package/dist/esm/util/types.d.mts +7 -0
  96. package/dist/esm/util/types.mjs +1 -0
  97. package/dist/esm/util/util.d.mts +2 -0
  98. package/dist/esm/util/util.mjs +3 -0
  99. package/package.json +29 -20
  100. package/dist/SpellingDictionary/Typos/index.d.ts +0 -4
  101. package/dist/SpellingDictionary/createInlineSpellingDictionary.js +0 -25
  102. package/dist/util/repMap.d.ts +0 -11
  103. package/dist/util/repMap.js +0 -65
  104. /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/SpellingDictionary.js +0 -0
  105. /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Terms/index.js +0 -0
  106. /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Terms/terms.d.ts +0 -0
  107. /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Terms/terms.js +0 -0
  108. /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/typos.js +0 -0
  109. /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/Typos/util.js +0 -0
  110. /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/defaults.d.ts +0 -0
  111. /package/dist/{SpellingDictionary → cjs/SpellingDictionary}/defaults.js +0 -0
  112. /package/dist/{util → cjs/util}/AutoCache.d.ts +0 -0
  113. /package/dist/{util → cjs/util}/AutoCache.js +0 -0
  114. /package/dist/{util → cjs/util}/AutoResolve.d.ts +0 -0
  115. /package/dist/{util → cjs/util}/AutoResolve.js +0 -0
  116. /package/dist/{util → cjs/util}/IterableLike.d.ts +0 -0
  117. /package/dist/{util → cjs/util}/IterableLike.js +0 -0
  118. /package/dist/{util → cjs/util}/clean.js +0 -0
  119. /package/dist/{util → cjs/util}/regexHelper.d.ts +0 -0
  120. /package/dist/{util → cjs/util}/regexHelper.js +0 -0
  121. /package/dist/{util → cjs/util}/simpleCache.d.ts +0 -0
  122. /package/dist/{util → cjs/util}/simpleCache.js +0 -0
  123. /package/dist/{util → cjs/util}/text.d.ts +0 -0
  124. /package/dist/{util → cjs/util}/text.js +0 -0
  125. /package/dist/{util → cjs/util}/textMappers.d.ts +0 -0
  126. /package/dist/{util → cjs/util}/types.d.ts +0 -0
  127. /package/dist/{util → cjs/util}/types.js +0 -0
  128. /package/dist/{util → cjs/util}/util.d.ts +0 -0
  129. /package/dist/{util → cjs/util}/util.js +0 -0
@@ -1,6 +1,6 @@
1
- import type { CacheStats } from '../util/AutoCache';
2
- import type { SearchOptions, SpellingDictionary } from './SpellingDictionary';
3
- import type { SpellingDictionaryCollection } from './SpellingDictionaryCollection';
1
+ import type { CacheStats } from '../util/AutoCache.js';
2
+ import type { SearchOptions, SpellingDictionary } from './SpellingDictionary.js';
3
+ import type { SpellingDictionaryCollection } from './SpellingDictionaryCollection.js';
4
4
  interface CallStats {
5
5
  name: string;
6
6
  id: number;
@@ -1,17 +1,17 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createCachingDictionary = void 0;
4
- const AutoCache_1 = require("../util/AutoCache");
5
- const SpellingDictionaryMethods_1 = require("./SpellingDictionaryMethods");
4
+ const AutoCache_js_1 = require("../util/AutoCache.js");
5
+ const SpellingDictionaryMethods_js_1 = require("./SpellingDictionaryMethods.js");
6
6
  let dictionaryCounter = 0;
7
7
  class CachedDict {
8
8
  constructor(dict, options) {
9
9
  this.dict = dict;
10
10
  this.options = options;
11
11
  this.id = ++dictionaryCounter;
12
- this.has = (0, AutoCache_1.autoCache)((word) => this.dict.has(word, this.options));
13
- this.isNoSuggestWord = (0, AutoCache_1.autoCache)((word) => this.dict.isNoSuggestWord(word, this.options));
14
- this.isForbidden = (0, AutoCache_1.autoCache)((word) => this.dict.isForbidden(word));
12
+ this.has = (0, AutoCache_js_1.autoCache)((word) => this.dict.has(word, this.options));
13
+ this.isNoSuggestWord = (0, AutoCache_js_1.autoCache)((word) => this.dict.isNoSuggestWord(word, this.options));
14
+ this.isForbidden = (0, AutoCache_js_1.autoCache)((word) => this.dict.isForbidden(word));
15
15
  this.name = dict.name;
16
16
  // console.log(`CachedDict for ${this.name}`);
17
17
  }
@@ -19,9 +19,9 @@ class CachedDict {
19
19
  return {
20
20
  name: this.name,
21
21
  id: this.id,
22
- has: (0, AutoCache_1.extractStats)(this.has),
23
- isNoSuggestWord: (0, AutoCache_1.extractStats)(this.isNoSuggestWord),
24
- isForbidden: (0, AutoCache_1.extractStats)(this.isForbidden),
22
+ has: (0, AutoCache_js_1.extractStats)(this.has),
23
+ isNoSuggestWord: (0, AutoCache_js_1.extractStats)(this.isNoSuggestWord),
24
+ isForbidden: (0, AutoCache_js_1.extractStats)(this.isForbidden),
25
25
  };
26
26
  }
27
27
  }
@@ -33,7 +33,7 @@ const knownDicts = new Map();
33
33
  * @returns CachingDictionary
34
34
  */
35
35
  function createCachingDictionary(dict, options) {
36
- options = (0, SpellingDictionaryMethods_1.canonicalSearchOptions)(options);
36
+ options = (0, SpellingDictionaryMethods_js_1.canonicalSearchOptions)(options);
37
37
  let knownOptions = knownDicts.get(options);
38
38
  if (!knownOptions) {
39
39
  knownOptions = new WeakMap();
@@ -1,4 +1,4 @@
1
- import type { SpellingDictionary } from './SpellingDictionary';
1
+ import type { SpellingDictionary } from './SpellingDictionary.js';
2
2
  /**
3
3
  * Create a dictionary where all words are to be forbidden.
4
4
  * @param wordList - list of words
@@ -26,15 +26,15 @@ 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 AutoResolve_1 = require("../util/AutoResolve");
30
- const Defaults = __importStar(require("./defaults"));
31
- const SpellingDictionary_1 = require("./SpellingDictionary");
32
- const SpellingDictionaryFromTrie_1 = require("./SpellingDictionaryFromTrie");
33
- const SpellingDictionaryMethods_1 = require("./SpellingDictionaryMethods");
34
- const TyposDictionary_1 = require("./TyposDictionary");
35
- class FlagWordsDictionaryTrie extends SpellingDictionaryFromTrie_1.SpellingDictionaryFromTrie {
29
+ const AutoResolve_js_1 = require("../util/AutoResolve.js");
30
+ const Defaults = __importStar(require("./defaults.js"));
31
+ const SpellingDictionary_js_1 = require("./SpellingDictionary.js");
32
+ const SpellingDictionaryFromTrie_js_1 = require("./SpellingDictionaryFromTrie.js");
33
+ const SpellingDictionaryMethods_js_1 = require("./SpellingDictionaryMethods.js");
34
+ const TyposDictionary_js_1 = require("./TyposDictionary.js");
35
+ class FlagWordsDictionaryTrie extends SpellingDictionaryFromTrie_js_1.SpellingDictionaryFromTrie {
36
36
  constructor(trie, name, source) {
37
- super(trie, name, SpellingDictionary_1.defaultOptions, source);
37
+ super(trie, name, SpellingDictionary_js_1.defaultOptions, source);
38
38
  this.name = name;
39
39
  this.source = source;
40
40
  this.containsNoSuggestWords = false;
@@ -104,7 +104,7 @@ class FlagWordsDictionary {
104
104
  }
105
105
  suggest(...args) {
106
106
  const [word] = args;
107
- const suggestOptions = (0, SpellingDictionaryMethods_1.suggestArgsToSuggestOptions)(args);
107
+ const suggestOptions = (0, SpellingDictionaryMethods_js_1.suggestArgsToSuggestOptions)(args);
108
108
  return this.dictTypos.suggest(word, suggestOptions);
109
109
  }
110
110
  genSuggestions() {
@@ -120,7 +120,7 @@ class FlagWordsDictionary {
120
120
  return [];
121
121
  }
122
122
  }
123
- const createCache = (0, AutoResolve_1.createAutoResolveWeakCache)();
123
+ const createCache = (0, AutoResolve_js_1.createAutoResolveWeakCache)();
124
124
  /**
125
125
  * Create a dictionary where all words are to be forbidden.
126
126
  * @param wordList - list of words
@@ -134,7 +134,7 @@ function createFlagWordsDictionary(wordList, name, source) {
134
134
  const testSpecialCharacters = /[~*+]/;
135
135
  const { t: specialWords, f: typoWords } = bisect((0, cspell_trie_lib_1.parseDictionaryLines)(wordList, { stripCaseAndAccents: false }), (line) => testSpecialCharacters.test(line));
136
136
  const trieDict = specialWords.size ? buildTrieDict(specialWords, name, source) : undefined;
137
- const typosDict = (0, TyposDictionary_1.createTyposDictionary)(typoWords, name, source);
137
+ const typosDict = (0, TyposDictionary_js_1.createTyposDictionary)(typoWords, name, source);
138
138
  if (!trieDict)
139
139
  return typosDict;
140
140
  return new FlagWordsDictionary(name, source, typosDict, trieDict);
@@ -1,4 +1,4 @@
1
- import type { SpellingDictionary } from './SpellingDictionary';
1
+ import type { SpellingDictionary } from './SpellingDictionary.js';
2
2
  /**
3
3
  * Create a dictionary where all words are to be ignored.
4
4
  * Ignored words override forbidden words.
@@ -26,9 +26,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.createIgnoreWordsDictionary = 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 AutoResolve_1 = require("../util/AutoResolve");
30
- const createSpellingDictionary_1 = require("./createSpellingDictionary");
31
- const Defaults = __importStar(require("./defaults"));
29
+ const AutoResolve_js_1 = require("../util/AutoResolve.js");
30
+ const createSpellingDictionary_js_1 = require("./createSpellingDictionary.js");
31
+ const Defaults = __importStar(require("./defaults.js"));
32
32
  const NormalizeForm = 'NFC';
33
33
  class IgnoreWordsDictionary {
34
34
  constructor(name, source, words) {
@@ -95,7 +95,7 @@ class IgnoreWordsDictionary {
95
95
  return [];
96
96
  }
97
97
  }
98
- const createCache = (0, AutoResolve_1.createAutoResolveWeakCache)();
98
+ const createCache = (0, AutoResolve_js_1.createAutoResolveWeakCache)();
99
99
  /**
100
100
  * Create a dictionary where all words are to be ignored.
101
101
  * Ignored words override forbidden words.
@@ -110,7 +110,7 @@ function createIgnoreWordsDictionary(wordList, name, source) {
110
110
  const words = [...(0, cspell_trie_lib_1.parseDictionaryLines)(wordList, { stripCaseAndAccents: true })].map((w) => w.normalize(NormalizeForm));
111
111
  const hasSpecial = words.findIndex((word) => testSpecialCharacters.test(word)) >= 0;
112
112
  if (hasSpecial) {
113
- return (0, createSpellingDictionary_1.createSpellingDictionary)(words, name, source, {
113
+ return (0, createSpellingDictionary_js_1.createSpellingDictionary)(words, name, source, {
114
114
  caseSensitive: true,
115
115
  noSuggest: true,
116
116
  weightMap: undefined,
@@ -134,6 +134,13 @@ export interface SpellingDictionary extends DictionaryInfo {
134
134
  suggest(word: string, suggestOptions: SuggestOptions): SuggestionResult[];
135
135
  genSuggestions(collector: SuggestionCollector, suggestOptions: SuggestOptions): void;
136
136
  mapWord(word: string): string;
137
+ /**
138
+ * Generates all possible word combinations by applying `repMap`.
139
+ * This acts a bit like brace expansions in globs.
140
+ * @param word - the word to map
141
+ * @returns array of adjusted words.
142
+ */
143
+ remapWord?: (word: string) => string[];
137
144
  readonly size: number;
138
145
  readonly isDictionaryCaseSensitive: boolean;
139
146
  getErrors?(): Error[];
@@ -1,4 +1,4 @@
1
- import type { SearchOptions, SpellingDictionary } from './SpellingDictionary';
1
+ import type { SearchOptions, SpellingDictionary } from './SpellingDictionary.js';
2
2
  export interface SpellingDictionaryCollection extends SpellingDictionary {
3
3
  readonly type: 'SpellingDictionaryCollection';
4
4
  readonly dictionaries: SpellingDictionary[];
@@ -26,10 +26,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.__testing__ = exports.isSpellingDictionaryCollection = exports.createCollection = void 0;
27
27
  const cspell_trie_lib_1 = require("cspell-trie-lib");
28
28
  const gensequence_1 = require("gensequence");
29
- const util_1 = require("../util/util");
30
- const Defaults = __importStar(require("./defaults"));
31
- const SpellingDictionary_1 = require("./SpellingDictionary");
32
- const SpellingDictionaryMethods_1 = require("./SpellingDictionaryMethods");
29
+ const util_js_1 = require("../util/util.js");
30
+ const Defaults = __importStar(require("./defaults.js"));
31
+ const SpellingDictionary_js_1 = require("./SpellingDictionary.js");
32
+ const SpellingDictionaryMethods_js_1 = require("./SpellingDictionaryMethods.js");
33
33
  function identityString(w) {
34
34
  return w;
35
35
  }
@@ -51,11 +51,11 @@ class SpellingDictionaryCollectionImpl {
51
51
  this.containsNoSuggestWords = this.dictionaries.reduce((a, b) => a || b.containsNoSuggestWords, false);
52
52
  }
53
53
  has(word, hasOptions) {
54
- const options = (0, SpellingDictionaryMethods_1.hasOptionToSearchOption)(hasOptions);
54
+ const options = (0, SpellingDictionaryMethods_js_1.hasOptionToSearchOption)(hasOptions);
55
55
  return !!isWordInAnyDictionary(this.dictionaries, word, options) && !this.isForbidden(word);
56
56
  }
57
57
  find(word, hasOptions) {
58
- const options = (0, SpellingDictionaryMethods_1.hasOptionToSearchOption)(hasOptions);
58
+ const options = (0, SpellingDictionaryMethods_js_1.hasOptionToSearchOption)(hasOptions);
59
59
  return findInAnyDictionary(this.dictionaries, word, options);
60
60
  }
61
61
  isNoSuggestWord(word, options) {
@@ -67,11 +67,11 @@ class SpellingDictionaryCollectionImpl {
67
67
  }
68
68
  suggest(...args) {
69
69
  const [word] = args;
70
- const suggestOptions = (0, SpellingDictionaryMethods_1.suggestArgsToSuggestOptions)(args);
70
+ const suggestOptions = (0, SpellingDictionaryMethods_js_1.suggestArgsToSuggestOptions)(args);
71
71
  return this._suggest(word, suggestOptions);
72
72
  }
73
73
  _suggest(word, suggestOptions) {
74
- const { numSuggestions = SpellingDictionaryMethods_1.defaultNumSuggestions, numChanges, ignoreCase, includeTies, timeout } = suggestOptions;
74
+ const { numSuggestions = SpellingDictionaryMethods_js_1.defaultNumSuggestions, numChanges, ignoreCase, includeTies, timeout } = suggestOptions;
75
75
  const prefixNoCase = cspell_trie_lib_1.CASE_INSENSITIVE_PREFIX;
76
76
  const filter = (word, _cost) => {
77
77
  return ((ignoreCase || word[0] !== prefixNoCase) &&
@@ -86,7 +86,7 @@ class SpellingDictionaryCollectionImpl {
86
86
  ignoreCase,
87
87
  timeout,
88
88
  };
89
- const collector = (0, SpellingDictionaryMethods_1.suggestionCollector)(word, collectorOptions);
89
+ const collector = (0, SpellingDictionaryMethods_js_1.suggestionCollector)(word, collectorOptions);
90
90
  this.genSuggestions(collector, suggestOptions);
91
91
  return collector.suggestions.map((r) => ({ ...r, word: r.word }));
92
92
  }
@@ -95,8 +95,8 @@ class SpellingDictionaryCollectionImpl {
95
95
  }
96
96
  genSuggestions(collector, suggestOptions) {
97
97
  const _suggestOptions = { ...suggestOptions };
98
- const { compoundMethod = SpellingDictionary_1.CompoundWordsMethod.SEPARATE_WORDS } = suggestOptions;
99
- _suggestOptions.compoundMethod = this.options.useCompounds ? SpellingDictionary_1.CompoundWordsMethod.JOIN_WORDS : compoundMethod;
98
+ const { compoundMethod = SpellingDictionary_js_1.CompoundWordsMethod.SEPARATE_WORDS } = suggestOptions;
99
+ _suggestOptions.compoundMethod = this.options.useCompounds ? SpellingDictionary_js_1.CompoundWordsMethod.JOIN_WORDS : compoundMethod;
100
100
  this.dictionaries.forEach((dict) => dict.genSuggestions(collector, _suggestOptions));
101
101
  }
102
102
  getErrors() {
@@ -114,7 +114,7 @@ function isWordInAnyDictionary(dicts, word, options) {
114
114
  return (0, gensequence_1.genSequence)(dicts).first((dict) => dict.has(word, options));
115
115
  }
116
116
  function findInAnyDictionary(dicts, word, options) {
117
- const found = dicts.map((dict) => dict.find(word, options)).filter(util_1.isDefined);
117
+ const found = dicts.map((dict) => dict.find(word, options)).filter(util_js_1.isDefined);
118
118
  if (!found.length)
119
119
  return undefined;
120
120
  return found.reduce((a, b) => ({
@@ -1,6 +1,6 @@
1
1
  import type { SuggestionCollector, SuggestionResult } from 'cspell-trie-lib';
2
2
  import { CompoundWordsMethod, Trie } from 'cspell-trie-lib';
3
- import type { FindResult, HasOptions, SpellingDictionary, SpellingDictionaryOptions, SuggestOptions } from './SpellingDictionary';
3
+ import type { FindResult, HasOptions, SpellingDictionary, SpellingDictionaryOptions, SuggestOptions } from './SpellingDictionary.js';
4
4
  export declare class SpellingDictionaryFromTrie implements SpellingDictionary {
5
5
  readonly trie: Trie;
6
6
  readonly name: string;
@@ -11,6 +11,7 @@ export declare class SpellingDictionaryFromTrie implements SpellingDictionary {
11
11
  readonly knownWords: Set<string>;
12
12
  readonly unknownWords: Set<string>;
13
13
  readonly mapWord: (word: string) => string;
14
+ readonly remapWord: (word: string) => string[];
14
15
  readonly type = "SpellingDictionaryFromTrie";
15
16
  readonly isDictionaryCaseSensitive: boolean;
16
17
  readonly containsNoSuggestWords: boolean;
@@ -41,7 +42,7 @@ export declare class SpellingDictionaryFromTrie implements SpellingDictionary {
41
42
  * @returns SpellingDictionary
42
43
  */
43
44
  export declare function createSpellingDictionaryFromTrieFile(data: Iterable<string> | string, name: string, source: string, options: SpellingDictionaryOptions): SpellingDictionary;
44
- declare function outerWordForms(word: string, mapWord: (word: string) => string): Set<string>;
45
+ declare function outerWordForms(word: string, mapWord: (word: string) => string[]): Set<string>;
45
46
  export declare const __testing__: {
46
47
  outerWordForms: typeof outerWordForms;
47
48
  };
@@ -26,11 +26,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.__testing__ = exports.createSpellingDictionaryFromTrieFile = exports.SpellingDictionaryFromTrie = 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 AutoCache_1 = require("../util/AutoCache");
30
- const clean_1 = require("../util/clean");
31
- const repMap_1 = require("../util/repMap");
32
- const Defaults = __importStar(require("./defaults"));
33
- const SpellingDictionaryMethods_1 = require("./SpellingDictionaryMethods");
29
+ const AutoCache_js_1 = require("../util/AutoCache.js");
30
+ const clean_js_1 = require("../util/clean.js");
31
+ const repMap_js_1 = require("../util/repMap.js");
32
+ const Defaults = __importStar(require("./defaults.js"));
33
+ const SpellingDictionaryMethods_js_1 = require("./SpellingDictionaryMethods.js");
34
34
  const findWordOptionsCaseSensitive = Object.freeze({ caseSensitive: true });
35
35
  const findWordOptionsNotCaseSensitive = Object.freeze({ caseSensitive: false });
36
36
  class SpellingDictionaryFromTrie {
@@ -44,14 +44,15 @@ class SpellingDictionaryFromTrie {
44
44
  this.unknownWords = new Set();
45
45
  this.type = 'SpellingDictionaryFromTrie';
46
46
  this._find = findCache((word, useCompounds, ignoreCase) => this.findAnyForm(word, useCompounds, ignoreCase));
47
- this._isForbidden = (0, AutoCache_1.autoCache)((word) => {
47
+ this._isForbidden = (0, AutoCache_js_1.autoCache)((word) => {
48
48
  return this.trie.isForbiddenWord(word);
49
49
  });
50
- this.mapWord = (0, repMap_1.createMapper)(options.repMap, options.dictionaryInformation?.ignore);
50
+ this.mapWord = (0, repMap_js_1.createMapper)(options.repMap, options.dictionaryInformation?.ignore);
51
+ this.remapWord = (0, repMap_js_1.createRepMapper)(options.repMap, options.dictionaryInformation?.ignore);
51
52
  this.isDictionaryCaseSensitive = options.caseSensitive ?? !trie.isLegacy;
52
53
  this.containsNoSuggestWords = options.noSuggest || false;
53
54
  this._size = size || 0;
54
- this.weightMap = options.weightMap || (0, SpellingDictionaryMethods_1.createWeightMapFromDictionaryInformation)(options.dictionaryInformation);
55
+ this.weightMap = options.weightMap || (0, SpellingDictionaryMethods_js_1.createWeightMapFromDictionaryInformation)(options.dictionaryInformation);
55
56
  }
56
57
  get size() {
57
58
  if (!this._size) {
@@ -85,11 +86,11 @@ class SpellingDictionaryFromTrie {
85
86
  return { found, forbidden, noSuggest };
86
87
  }
87
88
  resolveOptions(hasOptions) {
88
- const { useCompounds = this.options.useCompounds, ignoreCase = Defaults.ignoreCase } = (0, SpellingDictionaryMethods_1.hasOptionToSearchOption)(hasOptions);
89
+ const { useCompounds = this.options.useCompounds, ignoreCase = Defaults.ignoreCase } = (0, SpellingDictionaryMethods_js_1.hasOptionToSearchOption)(hasOptions);
89
90
  return { useCompounds, ignoreCase };
90
91
  }
91
92
  findAnyForm(word, useCompounds, ignoreCase) {
92
- const outerForms = outerWordForms(word, this.mapWord);
93
+ const outerForms = outerWordForms(word, this.remapWord ? this.remapWord : (word) => [this.mapWord(word)]);
93
94
  for (const form of outerForms) {
94
95
  const r = this._findAnyForm(form, useCompounds, ignoreCase);
95
96
  if (r)
@@ -103,7 +104,7 @@ class SpellingDictionaryFromTrie {
103
104
  if (findResult.found !== false) {
104
105
  return findResult;
105
106
  }
106
- const forms = (0, SpellingDictionaryMethods_1.wordSearchForms)(mWord, this.isDictionaryCaseSensitive, ignoreCase);
107
+ const forms = (0, SpellingDictionaryMethods_js_1.wordSearchForms)(mWord, this.isDictionaryCaseSensitive, ignoreCase);
107
108
  for (const w of forms) {
108
109
  const findResult = this.trie.findWord(w, opts);
109
110
  if (findResult.found !== false) {
@@ -129,15 +130,15 @@ class SpellingDictionaryFromTrie {
129
130
  }
130
131
  suggest(...args) {
131
132
  const [word] = args;
132
- const suggestOptions = (0, SpellingDictionaryMethods_1.suggestArgsToSuggestOptions)(args);
133
+ const suggestOptions = (0, SpellingDictionaryMethods_js_1.suggestArgsToSuggestOptions)(args);
133
134
  return this._suggest(word, suggestOptions);
134
135
  }
135
136
  _suggest(word, suggestOptions) {
136
- const { numSuggestions = SpellingDictionaryMethods_1.defaultNumSuggestions, numChanges, includeTies, ignoreCase, timeout } = suggestOptions;
137
+ const { numSuggestions = SpellingDictionaryMethods_js_1.defaultNumSuggestions, numChanges, includeTies, ignoreCase, timeout } = suggestOptions;
137
138
  function filter(_word) {
138
139
  return true;
139
140
  }
140
- const collector = (0, cspell_trie_lib_1.suggestionCollector)(word, (0, clean_1.clean)({
141
+ const collector = (0, cspell_trie_lib_1.suggestionCollector)(word, (0, clean_js_1.clean)({
141
142
  numSuggestions,
142
143
  filter,
143
144
  changeLimit: numChanges,
@@ -154,7 +155,7 @@ class SpellingDictionaryFromTrie {
154
155
  return;
155
156
  const _compoundMethod = suggestOptions.compoundMethod ??
156
157
  (this.options.useCompounds ? cspell_trie_lib_1.CompoundWordsMethod.JOIN_WORDS : cspell_trie_lib_1.CompoundWordsMethod.NONE);
157
- (0, SpellingDictionaryMethods_1.wordSuggestFormsArray)(collector.word).forEach((w) => this.trie.genSuggestions((0, SpellingDictionaryMethods_1.impersonateCollector)(collector, w), _compoundMethod));
158
+ (0, SpellingDictionaryMethods_js_1.wordSuggestFormsArray)(collector.word).forEach((w) => this.trie.genSuggestions((0, SpellingDictionaryMethods_js_1.impersonateCollector)(collector, w), _compoundMethod));
158
159
  }
159
160
  getErrors() {
160
161
  return [];
@@ -178,7 +179,7 @@ function createSpellingDictionaryFromTrieFile(data, name, source, options) {
178
179
  }
179
180
  exports.createSpellingDictionaryFromTrieFile = createSpellingDictionaryFromTrieFile;
180
181
  function findCache(fn, size = 2000) {
181
- const cache = (0, AutoCache_1.createCache01)(size);
182
+ const cache = (0, AutoCache_js_1.createCache01)(size);
182
183
  function find(word, useCompounds, ignoreCase) {
183
184
  const r = cache.get(word);
184
185
  if (r !== undefined) {
@@ -193,7 +194,7 @@ function findCache(fn, size = 2000) {
193
194
  return find;
194
195
  }
195
196
  function outerWordForms(word, mapWord) {
196
- const forms = (0, sync_1.pipe)([word], (0, sync_1.opConcatMap)((word) => [word, word.normalize('NFC'), word.normalize('NFD')]), (0, sync_1.opConcatMap)((word) => [word, mapWord(word)]));
197
+ const forms = (0, sync_1.pipe)([word], (0, sync_1.opConcatMap)((word) => [word, word.normalize('NFC'), word.normalize('NFD')]), (0, sync_1.opConcatMap)((word) => [word, ...mapWord(word)]));
197
198
  return new Set(forms);
198
199
  }
199
200
  exports.__testing__ = { outerWordForms };
@@ -1,6 +1,6 @@
1
1
  import type { DictionaryInformation } from '@cspell/cspell-types';
2
2
  import type { SuggestionResult, WeightMap } from 'cspell-trie-lib';
3
- import type { HasOptions, SearchOptions, SuggestArgs, SuggestOptions } from './SpellingDictionary';
3
+ import type { HasOptions, SearchOptions, SuggestArgs, SuggestOptions } from './SpellingDictionary.js';
4
4
  export { impersonateCollector, suggestionCollector } from 'cspell-trie-lib';
5
5
  export type FilterSuggestionsPredicate = (word: SuggestionResult) => boolean;
6
6
  export declare const defaultNumSuggestions = 10;
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.__testMethods__ = exports.createWeightMapFromDictionaryInformation = exports.suggestArgsToSuggestOptions = exports.canonicalSearchOptions = exports.hasOptionToSearchOption = exports.wordSuggestForms = exports.wordSuggestFormsArray = exports.wordSearchForms = exports.defaultNumSuggestions = exports.suggestionCollector = exports.impersonateCollector = void 0;
4
4
  const cspell_trie_lib_1 = require("cspell-trie-lib");
5
- const text_1 = require("../util/text");
5
+ const text_js_1 = require("../util/text.js");
6
6
  var cspell_trie_lib_2 = require("cspell-trie-lib");
7
7
  Object.defineProperty(exports, "impersonateCollector", { enumerable: true, get: function () { return cspell_trie_lib_2.impersonateCollector; } });
8
8
  Object.defineProperty(exports, "suggestionCollector", { enumerable: true, get: function () { return cspell_trie_lib_2.suggestionCollector; } });
@@ -21,7 +21,7 @@ function wordSearchForms(word, isDictionaryCaseSensitive, ignoreCase) {
21
21
  else {
22
22
  forms.add(wordLc);
23
23
  // Legacy remove any unbound accents
24
- forms.add((0, text_1.removeUnboundAccents)(wordLc));
24
+ forms.add((0, text_js_1.removeUnboundAccents)(wordLc));
25
25
  }
26
26
  }
27
27
  else {
@@ -29,14 +29,14 @@ function wordSearchForms(word, isDictionaryCaseSensitive, ignoreCase) {
29
29
  forms.add(word);
30
30
  forms.add(wordLc);
31
31
  // HOUSE -> House, house
32
- if ((0, text_1.isUpperCase)(word)) {
33
- forms.add((0, text_1.ucFirst)(wordLc));
32
+ if ((0, text_js_1.isUpperCase)(word)) {
33
+ forms.add((0, text_js_1.ucFirst)(wordLc));
34
34
  }
35
35
  }
36
36
  else {
37
37
  forms.add(wordLc);
38
38
  // Legacy remove any unbound accents
39
- forms.add((0, text_1.removeUnboundAccents)(wordLc));
39
+ forms.add((0, text_js_1.removeUnboundAccents)(wordLc));
40
40
  }
41
41
  }
42
42
  return forms;
@@ -1,5 +1,5 @@
1
- import type { IgnoreCaseOption, SpellingDictionary } from './SpellingDictionary';
2
- import { type TypoEntry, type TyposDef } from './Typos';
1
+ import type { IgnoreCaseOption, SpellingDictionary } from './SpellingDictionary.js';
2
+ import { type TypoEntry, type TyposDef } from './Typos/index.js';
3
3
  export interface SuggestDictionary extends SpellingDictionary {
4
4
  /**
5
5
  * Determine if the word can appear in a list of suggestions.
@@ -25,11 +25,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.createSuggestDictionary = void 0;
27
27
  const sync_1 = require("@cspell/cspell-pipe/sync");
28
- const AutoResolve_1 = require("../util/AutoResolve");
29
- const textMappers_1 = require("../util/textMappers");
30
- const defaults = __importStar(require("./defaults"));
31
- const Typos_1 = require("./Typos");
32
- const util_1 = require("./Typos/util");
28
+ const AutoResolve_js_1 = require("../util/AutoResolve.js");
29
+ const textMappers_js_1 = require("../util/textMappers.js");
30
+ const defaults = __importStar(require("./defaults.js"));
31
+ const index_js_1 = require("./Typos/index.js");
32
+ const util_js_1 = require("./Typos/util.js");
33
33
  class SuggestDictionaryImpl {
34
34
  constructor(name, source, typosDef) {
35
35
  this.name = name;
@@ -40,8 +40,8 @@ class SuggestDictionaryImpl {
40
40
  this.type = 'suggest';
41
41
  this.isDictionaryCaseSensitive = true;
42
42
  this.size = Object.keys(typosDef).length;
43
- this.suggestions = (0, util_1.extractAllSuggestions)(typosDef);
44
- this.suggestionsLower = new Set((0, sync_1.pipe)(this.suggestions, textMappers_1.mapperRemoveCaseAndAccents));
43
+ this.suggestions = (0, util_js_1.extractAllSuggestions)(typosDef);
44
+ this.suggestionsLower = new Set((0, sync_1.pipe)(this.suggestions, textMappers_js_1.mapperRemoveCaseAndAccents));
45
45
  }
46
46
  /**
47
47
  * A Forbidden word list does not "have" valid words.
@@ -107,7 +107,7 @@ class SuggestDictionaryImpl {
107
107
  return [];
108
108
  }
109
109
  }
110
- const createCache = (0, AutoResolve_1.createAutoResolveWeakCache)();
110
+ const createCache = (0, AutoResolve_js_1.createAutoResolveWeakCache)();
111
111
  /**
112
112
  * Create a dictionary where all words are to be forbidden.
113
113
  * @param entries - list of Typos Entries
@@ -117,7 +117,7 @@ const createCache = (0, AutoResolve_1.createAutoResolveWeakCache)();
117
117
  */
118
118
  function createSuggestDictionary(entries, name, source) {
119
119
  return createCache.get(entries, () => {
120
- const def = (0, Typos_1.processEntriesToTyposDef)(entries);
120
+ const def = (0, index_js_1.processEntriesToTyposDef)(entries);
121
121
  return new SuggestDictionaryImpl(name, source, def);
122
122
  });
123
123
  }
@@ -1,2 +1,2 @@
1
- export { TermsDef, TermsDefKey, TermsDefValue, TermValueIgnoreWord, TermValueOk, TermValueTypo, TermValueTypoNoSuggestions, TermValueTypoWithSuggestions, } from './terms';
1
+ export { TermsDef, TermsDefKey, TermsDefValue, TermValueIgnoreWord, TermValueOk, TermValueTypo, TermValueTypoNoSuggestions, TermValueTypoWithSuggestions, } from './terms.js';
2
2
  //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,4 @@
1
+ export type { TypoEntry, TyposDef } from './typos.js';
2
+ export { parseTyposFile, parseTyposLine, processEntriesToTyposDef } from './typosParser.js';
3
+ export { createTyposDef, extractAllSuggestions } from './util.js';
4
+ //# sourceMappingURL=index.d.ts.map
@@ -1,11 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.extractAllSuggestions = exports.createTyposDef = exports.processEntriesToTyposDef = exports.parseTyposLine = exports.parseTyposFile = void 0;
4
- var typosParser_1 = require("./typosParser");
5
- Object.defineProperty(exports, "parseTyposFile", { enumerable: true, get: function () { return typosParser_1.parseTyposFile; } });
6
- Object.defineProperty(exports, "parseTyposLine", { enumerable: true, get: function () { return typosParser_1.parseTyposLine; } });
7
- Object.defineProperty(exports, "processEntriesToTyposDef", { enumerable: true, get: function () { return typosParser_1.processEntriesToTyposDef; } });
8
- var util_1 = require("./util");
9
- Object.defineProperty(exports, "createTyposDef", { enumerable: true, get: function () { return util_1.createTyposDef; } });
10
- Object.defineProperty(exports, "extractAllSuggestions", { enumerable: true, get: function () { return util_1.extractAllSuggestions; } });
4
+ var typosParser_js_1 = require("./typosParser.js");
5
+ Object.defineProperty(exports, "parseTyposFile", { enumerable: true, get: function () { return typosParser_js_1.parseTyposFile; } });
6
+ Object.defineProperty(exports, "parseTyposLine", { enumerable: true, get: function () { return typosParser_js_1.parseTyposLine; } });
7
+ Object.defineProperty(exports, "processEntriesToTyposDef", { enumerable: true, get: function () { return typosParser_js_1.processEntriesToTyposDef; } });
8
+ var util_js_1 = require("./util.js");
9
+ Object.defineProperty(exports, "createTyposDef", { enumerable: true, get: function () { return util_js_1.createTyposDef; } });
10
+ Object.defineProperty(exports, "extractAllSuggestions", { enumerable: true, get: function () { return util_js_1.extractAllSuggestions; } });
11
11
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import type { TermsDefKey, TermValueTypo, TermValueTypoNoSuggestions, TermValueTypoWithSuggestions } from '../Terms';
1
+ import type { TermsDefKey, TermValueTypo, TermValueTypoNoSuggestions, TermValueTypoWithSuggestions } from '../Terms/index.js';
2
2
  export type TypoValueNoSuggestions = TermValueTypoNoSuggestions;
3
3
  export type TypoValueWithSuggestions = TermValueTypoWithSuggestions;
4
4
  export type TyposDefValue = TermValueTypo;
@@ -1,4 +1,4 @@
1
- import type { TypoEntry, TyposDef } from './typos';
1
+ import type { TypoEntry, TyposDef } from './typos.js';
2
2
  export declare function createTyposDefFromEntries(entries: Iterable<TypoEntry>): TyposDef;
3
3
  export declare function sanitizeIntoTypoDef(dirtyDef: TyposDef | Record<string, unknown> | unknown): TyposDef | undefined;
4
4
  /**
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.parseTyposFile = exports.parseTyposLine = exports.processEntriesToTyposDef = exports.sanitizeIntoTypoDef = exports.createTyposDefFromEntries = void 0;
7
7
  const assert_1 = __importDefault(require("assert"));
8
- const util_1 = require("./util");
8
+ const util_js_1 = require("./util.js");
9
9
  function assertString(v) {
10
10
  (0, assert_1.default)(typeof v === 'string', 'A string was expected.');
11
11
  return true;
@@ -17,7 +17,7 @@ const inlineComment = /#.*/gm;
17
17
  function createTyposDefFromEntries(entries) {
18
18
  const def = Object.create(null);
19
19
  for (const entry of entries) {
20
- (0, util_1.appendToDef)(def, entry);
20
+ (0, util_js_1.appendToDef)(def, entry);
21
21
  }
22
22
  return def;
23
23
  }
@@ -41,7 +41,7 @@ function splitSuggestionsValue(value) {
41
41
  function sanitizeIntoTypoDef(dirtyDef) {
42
42
  if (!dirtyDef || typeof dirtyDef !== 'object')
43
43
  return undefined;
44
- const def = (0, util_1.createTyposDef)();
44
+ const def = (0, util_js_1.createTyposDef)();
45
45
  for (const [rawKey, value] of Object.entries(dirtyDef)) {
46
46
  const key = normalize(rawKey.trim());
47
47
  if (!key)
@@ -91,9 +91,9 @@ function processEntriesToTyposDef(entries) {
91
91
  }
92
92
  exports.processEntriesToTyposDef = processEntriesToTyposDef;
93
93
  function reduceToTyposDef(entries) {
94
- const def = (0, util_1.createTyposDef)();
94
+ const def = (0, util_js_1.createTyposDef)();
95
95
  for (const entry of entries) {
96
- (0, util_1.appendToDef)(def, parseTyposLine(entry));
96
+ (0, util_js_1.appendToDef)(def, parseTyposLine(entry));
97
97
  }
98
98
  return def;
99
99
  }
@@ -106,7 +106,7 @@ function parseTyposLine(line) {
106
106
  if (!line)
107
107
  return undefined;
108
108
  if (typeof line === 'string') {
109
- const def = (0, util_1.createTyposDef)();
109
+ const def = (0, util_js_1.createTyposDef)();
110
110
  for (const subEntry of splitIntoLines(line)) {
111
111
  const [left, right] = splitEntry(subEntry);
112
112
  const typo = left.trim();
@@ -1,4 +1,4 @@
1
- import type { TypoEntry, TyposDef, TyposDefKey, TyposDefValue } from './typos';
1
+ import type { TypoEntry, TyposDef, TyposDefKey, TyposDefValue } from './typos.js';
2
2
  export declare function mergeDefEntry(targetDef: TyposDef, key: string, value: TyposDefValue): TyposDef;
3
3
  /**
4
4
  * Merge in place the entries `fromDef` into `targetDef`
@@ -1,5 +1,5 @@
1
- import type { IgnoreCaseOption, SpellingDictionary } from './SpellingDictionary';
2
- import { type TypoEntry, type TyposDef } from './Typos';
1
+ import type { IgnoreCaseOption, SpellingDictionary } from './SpellingDictionary.js';
2
+ import { type TypoEntry, type TyposDef } from './Typos/index.js';
3
3
  export interface TyposDictionary extends SpellingDictionary {
4
4
  isForbidden(word: string, ignoreCaseAndAccents?: IgnoreCaseOption): boolean;
5
5
  /**