cspell-dictionary 8.0.0 → 8.1.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.
|
@@ -19,5 +19,5 @@ export interface SpellingDictionaryLoadError extends Error {
|
|
|
19
19
|
/** Dictionary Information */
|
|
20
20
|
readonly info: DictionaryInfo;
|
|
21
21
|
}
|
|
22
|
-
export declare function createFailedToLoadDictionary(name: string,
|
|
22
|
+
export declare function createFailedToLoadDictionary(name: string, sourceUrl: URL | string, error: Error, options?: SpellingDictionaryOptions | undefined): SpellingDictionary;
|
|
23
23
|
//# sourceMappingURL=createSpellingDictionary.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { fileURLToPath } from 'node:url';
|
|
1
2
|
import { buildITrieFromWords, parseDictionaryLines } from 'cspell-trie-lib';
|
|
2
3
|
import { deepEqual } from 'fast-equals';
|
|
3
4
|
import { AutoWeakCache, SimpleCache } from '../util/simpleCache.js';
|
|
@@ -16,7 +17,7 @@ const cachedParamsByWordList = new SimpleCache(64);
|
|
|
16
17
|
* @returns a Spelling Dictionary
|
|
17
18
|
*/
|
|
18
19
|
export function createSpellingDictionary(wordList, name, source, options) {
|
|
19
|
-
const params = [wordList, name, source, options];
|
|
20
|
+
const params = [wordList, name, source.toString(), options];
|
|
20
21
|
if (!Array.isArray(wordList)) {
|
|
21
22
|
return _createSpellingDictionary(params);
|
|
22
23
|
}
|
|
@@ -44,7 +45,9 @@ function _createSpellingDictionary(params) {
|
|
|
44
45
|
}
|
|
45
46
|
return new SpellingDictionaryFromTrie(trie, name, opts, source);
|
|
46
47
|
}
|
|
47
|
-
export function createFailedToLoadDictionary(name,
|
|
48
|
+
export function createFailedToLoadDictionary(name, sourceUrl, error, options) {
|
|
49
|
+
const sourceHref = typeof sourceUrl === 'string' ? sourceUrl : sourceUrl.href;
|
|
50
|
+
const source = sourceHref.startsWith('file:') ? fileURLToPath(sourceUrl) : sourceHref;
|
|
48
51
|
options = options || {};
|
|
49
52
|
return {
|
|
50
53
|
name,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell-dictionary",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.1.0",
|
|
4
4
|
"description": "A spelling dictionary library useful for checking words and getting suggestions.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -45,11 +45,11 @@
|
|
|
45
45
|
"node": ">=18"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@cspell/cspell-pipe": "8.
|
|
49
|
-
"@cspell/cspell-types": "8.
|
|
50
|
-
"cspell-trie-lib": "8.
|
|
51
|
-
"fast-equals": "^
|
|
48
|
+
"@cspell/cspell-pipe": "8.1.0",
|
|
49
|
+
"@cspell/cspell-types": "8.1.0",
|
|
50
|
+
"cspell-trie-lib": "8.1.0",
|
|
51
|
+
"fast-equals": "^5.0.1",
|
|
52
52
|
"gensequence": "^6.0.0"
|
|
53
53
|
},
|
|
54
|
-
"gitHead": "
|
|
54
|
+
"gitHead": "28568808deaf39b9ffa71fd0f722441ff1b8c794"
|
|
55
55
|
}
|