cspell-lib 6.6.1 → 6.7.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.
@@ -0,0 +1,11 @@
1
+ export declare class ImportError extends Error {
2
+ readonly cause: Error | undefined;
3
+ constructor(msg: string, cause?: Error | unknown);
4
+ }
5
+ export declare class UnsupportedSchema extends Error {
6
+ constructor(msg: string);
7
+ }
8
+ export declare class UnsupportedPnpFile extends Error {
9
+ constructor(msg: string);
10
+ }
11
+ //# sourceMappingURL=ImportError.d.ts.map
@@ -0,0 +1,24 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.UnsupportedPnpFile = exports.UnsupportedSchema = exports.ImportError = void 0;
4
+ const errors_1 = require("../../util/errors");
5
+ class ImportError extends Error {
6
+ constructor(msg, cause) {
7
+ super(msg);
8
+ this.cause = (0, errors_1.isError)(cause) ? cause : undefined;
9
+ }
10
+ }
11
+ exports.ImportError = ImportError;
12
+ class UnsupportedSchema extends Error {
13
+ constructor(msg) {
14
+ super(msg);
15
+ }
16
+ }
17
+ exports.UnsupportedSchema = UnsupportedSchema;
18
+ class UnsupportedPnpFile extends Error {
19
+ constructor(msg) {
20
+ super(msg);
21
+ }
22
+ }
23
+ exports.UnsupportedPnpFile = UnsupportedPnpFile;
24
+ //# sourceMappingURL=ImportError.js.map
@@ -0,0 +1,9 @@
1
+ import { CSpellIO } from 'cspell-io';
2
+ /**
3
+ * The settings controller manages requests to resolve configuration settings and files.
4
+ */
5
+ export declare class SettingsController {
6
+ readonly cspellIO: CSpellIO;
7
+ constructor(cspellIO: CSpellIO);
8
+ }
9
+ //# sourceMappingURL=SettingsController.d.ts.map
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsController = void 0;
4
+ /**
5
+ * The settings controller manages requests to resolve configuration settings and files.
6
+ */
7
+ class SettingsController {
8
+ constructor(cspellIO) {
9
+ this.cspellIO = cspellIO;
10
+ }
11
+ }
12
+ exports.SettingsController = SettingsController;
13
+ //# sourceMappingURL=SettingsController.js.map
@@ -1,7 +1,7 @@
1
1
  import type { CSpellSettingsWithSourceTrace, CSpellUserSettings, ImportFileRef, PnPSettings as PnPSettingsStrict } from '@cspell/cspell-types';
2
2
  import { URI } from 'vscode-uri';
3
- import { CSpellSettingsInternal } from '../Models/CSpellSettingsInternalDef';
4
- import { OptionalOrUndefined } from '../util/types';
3
+ import { CSpellSettingsInternal } from '../../Models/CSpellSettingsInternalDef';
4
+ import { OptionalOrUndefined } from '../../util/types';
5
5
  import { LoaderResult } from './pnpLoader';
6
6
  declare type CSpellSettingsWST = CSpellSettingsWithSourceTrace;
7
7
  declare type CSpellSettingsI = CSpellSettingsInternal;
@@ -28,13 +28,13 @@ const json = __importStar(require("comment-json"));
28
28
  const cosmiconfig_1 = require("cosmiconfig");
29
29
  const path = __importStar(require("path"));
30
30
  const vscode_uri_1 = require("vscode-uri");
31
- const CSpellSettingsInternalDef_1 = require("../Models/CSpellSettingsInternalDef");
32
- const logger_1 = require("../util/logger");
33
- const resolveFile_1 = require("../util/resolveFile");
34
- const util = __importStar(require("../util/util"));
35
- const CSpellSettingsServer_1 = require("./CSpellSettingsServer");
36
- const DictionarySettings_1 = require("./DictionarySettings");
37
- const GlobalSettings_1 = require("./GlobalSettings");
31
+ const CSpellSettingsInternalDef_1 = require("../../Models/CSpellSettingsInternalDef");
32
+ const logger_1 = require("../../util/logger");
33
+ const resolveFile_1 = require("../../util/resolveFile");
34
+ const util = __importStar(require("../../util/util"));
35
+ const CSpellSettingsServer_1 = require("../CSpellSettingsServer");
36
+ const DictionarySettings_1 = require("../DictionarySettings");
37
+ const GlobalSettings_1 = require("../GlobalSettings");
38
38
  const ImportError_1 = require("./ImportError");
39
39
  const pnpLoader_1 = require("./pnpLoader");
40
40
  const supportedCSpellConfigVersions = [CSpellSettingsServer_1.configSettingsFileVersion0_2];
@@ -0,0 +1,2 @@
1
+ export { SettingsController } from './SettingsController';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.SettingsController = void 0;
4
+ var SettingsController_1 = require("./SettingsController");
5
+ Object.defineProperty(exports, "SettingsController", { enumerable: true, get: function () { return SettingsController_1.SettingsController; } });
6
+ //# sourceMappingURL=index.js.map
@@ -28,11 +28,5 @@ export declare class PnpLoader {
28
28
  private calcKey;
29
29
  }
30
30
  export declare function pnpLoader(pnpFiles?: string[]): PnpLoader;
31
- export declare class UnsupportedSchema extends Error {
32
- constructor(msg: string);
33
- }
34
- export declare class UnsupportedPnpFile extends Error {
35
- constructor(msg: string);
36
- }
37
31
  export declare function clearPnPGlobalCache(): Promise<undefined>;
38
32
  //# sourceMappingURL=pnpLoader.d.ts.map
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.clearPnPGlobalCache = exports.UnsupportedPnpFile = exports.UnsupportedSchema = exports.pnpLoader = exports.PnpLoader = void 0;
6
+ exports.clearPnPGlobalCache = exports.pnpLoader = exports.PnpLoader = void 0;
7
7
  /**
8
8
  * Handles loading of `.pnp.js` and `.pnp.js` files.
9
9
  */
@@ -11,6 +11,7 @@ const vscode_uri_1 = require("vscode-uri");
11
11
  const import_fresh_1 = __importDefault(require("import-fresh"));
12
12
  const find_up_1 = __importDefault(require("find-up"));
13
13
  const clear_module_1 = __importDefault(require("clear-module"));
14
+ const ImportError_1 = require("./ImportError");
14
15
  const defaultPnpFiles = ['.pnp.cjs', '.pnp.js'];
15
16
  const supportedSchemas = new Set(['file']);
16
17
  const cachedRequests = new Map();
@@ -28,6 +29,8 @@ class PnpLoader {
28
29
  * @returns promise - rejects on error - success if loaded or not found.
29
30
  */
30
31
  async load(uriDirectory) {
32
+ if (!supportedSchemas.has(uriDirectory.scheme))
33
+ return undefined;
31
34
  await lock;
32
35
  const cacheKey = this.calcKey(uriDirectory);
33
36
  const cached = cachedRequests.get(cacheKey);
@@ -40,6 +43,8 @@ class PnpLoader {
40
43
  return result;
41
44
  }
42
45
  async peek(uriDirectory) {
46
+ if (!supportedSchemas.has(uriDirectory.scheme))
47
+ return undefined;
43
48
  await lock;
44
49
  const cacheKey = this.calcKey(uriDirectory);
45
50
  return cachedRequests.get(cacheKey) ?? Promise.resolve(undefined);
@@ -50,6 +55,8 @@ class PnpLoader {
50
55
  * @returns promise - rejects on error - success if loaded or not found.
51
56
  */
52
57
  loadSync(uriDirectory) {
58
+ if (!supportedSchemas.has(uriDirectory.scheme))
59
+ return undefined;
53
60
  const cacheKey = this.calcKey(uriDirectory);
54
61
  const cached = cachedRequestsSync.get(cacheKey);
55
62
  if (cached)
@@ -60,6 +67,8 @@ class PnpLoader {
60
67
  return r;
61
68
  }
62
69
  peekSync(uriDirectory) {
70
+ if (!supportedSchemas.has(uriDirectory.scheme))
71
+ return undefined;
63
72
  const cacheKey = this.calcKey(uriDirectory);
64
73
  return cachedRequestsSync.get(cacheKey);
65
74
  }
@@ -78,23 +87,10 @@ function pnpLoader(pnpFiles) {
78
87
  return new PnpLoader(pnpFiles);
79
88
  }
80
89
  exports.pnpLoader = pnpLoader;
81
- class UnsupportedSchema extends Error {
82
- constructor(msg) {
83
- super(msg);
84
- }
85
- }
86
- exports.UnsupportedSchema = UnsupportedSchema;
87
- class UnsupportedPnpFile extends Error {
88
- constructor(msg) {
89
- super(msg);
90
- }
91
- }
92
- exports.UnsupportedPnpFile = UnsupportedPnpFile;
93
90
  /**
94
91
  * @param uriDirectory - directory to start at.
95
92
  */
96
93
  async function findPnpAndLoad(uriDirectory, pnpFiles) {
97
- validateSchema(uriDirectory);
98
94
  const found = await (0, find_up_1.default)(pnpFiles, { cwd: uriDirectory.fsPath });
99
95
  return loadPnpIfNeeded(found);
100
96
  }
@@ -102,7 +98,6 @@ async function findPnpAndLoad(uriDirectory, pnpFiles) {
102
98
  * @param uriDirectory - directory to start at.
103
99
  */
104
100
  function findPnpAndLoadSync(uriDirectory, pnpFiles) {
105
- validateSchema(uriDirectory);
106
101
  const found = find_up_1.default.sync(pnpFiles, { cwd: uriDirectory.fsPath });
107
102
  return loadPnpIfNeeded(found);
108
103
  }
@@ -122,13 +117,7 @@ function loadPnp(pnpFile) {
122
117
  pnp.setup();
123
118
  return vscode_uri_1.URI.file(pnpFile);
124
119
  }
125
- throw new UnsupportedPnpFile(`Unsupported pnp file: "${pnpFile}"`);
126
- }
127
- function validateSchema(uri) {
128
- if (!supportedSchemas.has(uri.scheme)) {
129
- throw new UnsupportedSchema(`Unsupported schema for PNP: "${uri.scheme}"`);
130
- }
131
- return true;
120
+ throw new ImportError_1.UnsupportedPnpFile(`Unsupported pnp file: "${pnpFile}"`);
132
121
  }
133
122
  function clearPnPGlobalCache() {
134
123
  if (lock)
@@ -28,7 +28,7 @@ const cspell_grammar_1 = require("cspell-grammar");
28
28
  const CSpellSettingsInternalDef_1 = require("../Models/CSpellSettingsInternalDef");
29
29
  const PatternRegExp_1 = require("../Models/PatternRegExp");
30
30
  const resolveFile_1 = require("../util/resolveFile");
31
- const configLoader_1 = require("./configLoader");
31
+ const configLoader_1 = require("./Controller/configLoader");
32
32
  const index_1 = require("./index");
33
33
  const LanguageSettings = __importStar(require("./LanguageSettings"));
34
34
  const RegPat = __importStar(require("./RegExpPatterns"));
@@ -1,6 +1,6 @@
1
- export { clearCachedSettingsFiles, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getGlobalSettings, loadConfig, loadPnP, loadPnPSync, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './configLoader';
1
+ export { clearCachedSettingsFiles, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getGlobalSettings, loadConfig, loadPnP, loadPnPSync, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Controller/configLoader';
2
2
  export { calcOverrideSettings, checkFilenameMatchesGlob, currentSettingsFileVersion, ENV_CSPELL_GLOB_ROOT, extractDependencies, finalizeSettings, getSources, mergeInDocSettings, mergeSettings, } from './CSpellSettingsServer';
3
3
  export type { ConfigurationDependencies, ImportFileRefWithError } from './CSpellSettingsServer';
4
4
  export { getDefaultSettings, getDefaultBundledSettings } from './DefaultSettings';
5
- export { ImportError } from './ImportError';
5
+ export { ImportError } from './Controller/ImportError';
6
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ImportError = exports.getDefaultBundledSettings = exports.getDefaultSettings = exports.mergeSettings = exports.mergeInDocSettings = exports.getSources = exports.finalizeSettings = exports.extractDependencies = exports.ENV_CSPELL_GLOB_ROOT = exports.currentSettingsFileVersion = exports.checkFilenameMatchesGlob = exports.calcOverrideSettings = exports.sectionCSpell = exports.searchForConfig = exports.readSettingsFiles = exports.readSettings = exports.readRawSettings = exports.loadPnPSync = exports.loadPnP = exports.loadConfig = exports.getGlobalSettings = exports.getCachedFileSize = exports.extractImportErrors = exports.defaultFileName = exports.defaultConfigFilenames = exports.clearCachedSettingsFiles = void 0;
4
- var configLoader_1 = require("./configLoader");
4
+ var configLoader_1 = require("./Controller/configLoader");
5
5
  Object.defineProperty(exports, "clearCachedSettingsFiles", { enumerable: true, get: function () { return configLoader_1.clearCachedSettingsFiles; } });
6
6
  Object.defineProperty(exports, "defaultConfigFilenames", { enumerable: true, get: function () { return configLoader_1.defaultConfigFilenames; } });
7
7
  Object.defineProperty(exports, "defaultFileName", { enumerable: true, get: function () { return configLoader_1.defaultFileName; } });
@@ -29,6 +29,6 @@ Object.defineProperty(exports, "mergeSettings", { enumerable: true, get: functio
29
29
  var DefaultSettings_1 = require("./DefaultSettings");
30
30
  Object.defineProperty(exports, "getDefaultSettings", { enumerable: true, get: function () { return DefaultSettings_1.getDefaultSettings; } });
31
31
  Object.defineProperty(exports, "getDefaultBundledSettings", { enumerable: true, get: function () { return DefaultSettings_1.getDefaultBundledSettings; } });
32
- var ImportError_1 = require("./ImportError");
32
+ var ImportError_1 = require("./Controller/ImportError");
33
33
  Object.defineProperty(exports, "ImportError", { enumerable: true, get: function () { return ImportError_1.ImportError; } });
34
34
  //# sourceMappingURL=index.js.map
@@ -27,7 +27,7 @@ exports.__testing__ = exports.removePathsFromGlobalImports = exports.addPathsToG
27
27
  const fs = __importStar(require("fs"));
28
28
  const Path = __importStar(require("path"));
29
29
  const util_1 = require("../util/util");
30
- const configLoader_1 = require("./configLoader");
30
+ const configLoader_1 = require("./Controller/configLoader");
31
31
  const GlobalSettings_1 = require("./GlobalSettings");
32
32
  function listGlobalImports() {
33
33
  const globalSettings = (0, GlobalSettings_1.getRawGlobalSettings)();
@@ -0,0 +1,30 @@
1
+ import { CSpellIO } from 'cspell-io';
2
+ import { DictionaryDefinitionInternal } from '../../Models/CSpellSettingsInternalDef';
3
+ import { SpellingDictionary } from '../SpellingDictionary';
4
+ export declare type LoadOptions = DictionaryDefinitionInternal;
5
+ export declare class DictionaryLoader {
6
+ private cspellIO;
7
+ private dictionaryCache;
8
+ private dictionaryCacheByDef;
9
+ private reader;
10
+ private readerSync;
11
+ constructor(cspellIO: CSpellIO);
12
+ loadDictionary(def: DictionaryDefinitionInternal): Promise<SpellingDictionary>;
13
+ loadDictionarySync(def: DictionaryDefinitionInternal): SpellingDictionary;
14
+ /**
15
+ * Check to see if any of the cached dictionaries have changed. If one has changed, reload it.
16
+ * @param maxAge - Only check the dictionary if it has been at least `maxAge` ms since the last check.
17
+ * @param now - optional timestamp representing now. (Mostly used in testing)
18
+ */
19
+ refreshCacheEntries(maxAge?: number, now?: number): Promise<void>;
20
+ private getCacheEntry;
21
+ private setCacheEntry;
22
+ private refreshEntry;
23
+ private loadEntry;
24
+ private loadEntrySync;
25
+ private getStat;
26
+ private getStatSync;
27
+ private isEqual;
28
+ private normalizeOptions;
29
+ }
30
+ //# sourceMappingURL=DictionaryLoader.d.ts.map
@@ -0,0 +1,273 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DictionaryLoader = void 0;
4
+ const cspell_pipe_1 = require("@cspell/cspell-pipe");
5
+ const errors_1 = require("../../util/errors");
6
+ const createSpellingDictionary_1 = require("../createSpellingDictionary");
7
+ const SpellingDictionaryError_1 = require("../SpellingDictionaryError");
8
+ const SpellingDictionaryFromTrie_1 = require("../SpellingDictionaryFromTrie");
9
+ const MAX_AGE = 10000;
10
+ const loaders = {
11
+ S: loadSimpleWordList,
12
+ C: legacyWordList,
13
+ W: wordsPerLineWordList,
14
+ T: loadTrie,
15
+ default: loadSimpleWordList,
16
+ };
17
+ const loadersSync = {
18
+ S: loadSimpleWordListSync,
19
+ C: legacyWordListSync,
20
+ W: wordsPerLineWordListSync,
21
+ T: loadTrieSync,
22
+ default: loadSimpleWordListSync,
23
+ };
24
+ var LoadingState;
25
+ (function (LoadingState) {
26
+ LoadingState[LoadingState["Loaded"] = 0] = "Loaded";
27
+ LoadingState[LoadingState["Loading"] = 1] = "Loading";
28
+ })(LoadingState || (LoadingState = {}));
29
+ class DictionaryLoader {
30
+ constructor(cspellIO) {
31
+ this.cspellIO = cspellIO;
32
+ this.dictionaryCache = new Map();
33
+ this.dictionaryCacheByDef = new Map();
34
+ this.reader = toReader(cspellIO);
35
+ this.readerSync = toReaderSync(cspellIO);
36
+ }
37
+ loadDictionary(def) {
38
+ const { key, entry } = this.getCacheEntry(def);
39
+ if (entry) {
40
+ return entry.pending.then(([dictionary]) => dictionary);
41
+ }
42
+ const loadedEntry = this.loadEntry(def.path, def);
43
+ this.setCacheEntry(key, loadedEntry, def);
44
+ return loadedEntry.pending.then(([dictionary]) => dictionary);
45
+ }
46
+ loadDictionarySync(def) {
47
+ const { key, entry } = this.getCacheEntry(def);
48
+ if (entry?.dictionary && entry.loadingState === LoadingState.Loaded) {
49
+ return entry.dictionary;
50
+ }
51
+ const loadedEntry = this.loadEntrySync(def.path, def);
52
+ this.setCacheEntry(key, loadedEntry, def);
53
+ return loadedEntry.dictionary;
54
+ }
55
+ /**
56
+ * Check to see if any of the cached dictionaries have changed. If one has changed, reload it.
57
+ * @param maxAge - Only check the dictionary if it has been at least `maxAge` ms since the last check.
58
+ * @param now - optional timestamp representing now. (Mostly used in testing)
59
+ */
60
+ async refreshCacheEntries(maxAge = MAX_AGE, now = Date.now()) {
61
+ await Promise.all([...this.dictionaryCache.values()].map((entry) => this.refreshEntry(entry, maxAge, now)));
62
+ }
63
+ getCacheEntry(def) {
64
+ const defEntry = this.dictionaryCacheByDef.get(def);
65
+ if (defEntry) {
66
+ return defEntry;
67
+ }
68
+ const key = calcKey(def);
69
+ const entry = this.dictionaryCache.get(key);
70
+ if (entry) {
71
+ // replace old entry so it can be released.
72
+ entry.options = def;
73
+ }
74
+ return { key, entry };
75
+ }
76
+ setCacheEntry(key, entry, def) {
77
+ this.dictionaryCache.set(key, entry);
78
+ this.dictionaryCacheByDef.set(def, { key, entry });
79
+ }
80
+ async refreshEntry(entry, maxAge, now) {
81
+ if (now - entry.ts >= maxAge) {
82
+ const sig = now + Math.random();
83
+ // Write to the ts, so the next one will not do it.
84
+ entry.sig = sig;
85
+ entry.ts = now;
86
+ const pStat = this.getStat(entry.uri);
87
+ const [newStat] = await Promise.all([pStat, entry.pending]);
88
+ const hasChanged = !this.isEqual(newStat, entry.stat);
89
+ const sigMatches = entry.sig === sig;
90
+ if (sigMatches && hasChanged) {
91
+ entry.loadingState = LoadingState.Loading;
92
+ const key = calcKey(entry.options);
93
+ const newEntry = this.loadEntry(entry.uri, entry.options);
94
+ this.dictionaryCache.set(key, newEntry);
95
+ this.dictionaryCacheByDef.set(entry.options, { key, entry: newEntry });
96
+ }
97
+ }
98
+ }
99
+ loadEntry(uri, options, now = Date.now()) {
100
+ options = this.normalizeOptions(uri, options);
101
+ const pDictionary = load(this.reader, uri, options).catch((e) => (0, createSpellingDictionary_1.createFailedToLoadDictionary)(new SpellingDictionaryError_1.SpellingDictionaryLoadError(uri, options, e, 'failed to load')));
102
+ const pStat = this.getStat(uri);
103
+ const pending = Promise.all([pDictionary, pStat]);
104
+ const sig = now + Math.random();
105
+ const entry = {
106
+ uri,
107
+ options,
108
+ ts: now,
109
+ stat: undefined,
110
+ dictionary: undefined,
111
+ pending,
112
+ loadingState: LoadingState.Loading,
113
+ sig,
114
+ };
115
+ // eslint-disable-next-line promise/catch-or-return
116
+ pending.then(([dictionary, stat]) => {
117
+ entry.stat = stat;
118
+ entry.dictionary = dictionary;
119
+ entry.loadingState = LoadingState.Loaded;
120
+ return;
121
+ });
122
+ return entry;
123
+ }
124
+ loadEntrySync(uri, options, now = Date.now()) {
125
+ options = this.normalizeOptions(uri, options);
126
+ const stat = this.getStatSync(uri);
127
+ const sig = now + Math.random();
128
+ try {
129
+ const dictionary = loadSync(this.readerSync, uri, options);
130
+ const pending = Promise.resolve([dictionary, stat]);
131
+ return {
132
+ uri,
133
+ options,
134
+ ts: now,
135
+ stat,
136
+ dictionary,
137
+ pending,
138
+ loadingState: LoadingState.Loaded,
139
+ sig,
140
+ };
141
+ }
142
+ catch (e) {
143
+ const error = (0, errors_1.toError)(e);
144
+ const dictionary = (0, createSpellingDictionary_1.createFailedToLoadDictionary)(new SpellingDictionaryError_1.SpellingDictionaryLoadError(uri, options, error, 'failed to load'));
145
+ const pending = Promise.resolve([dictionary, stat]);
146
+ return {
147
+ uri,
148
+ options,
149
+ ts: now,
150
+ stat,
151
+ dictionary,
152
+ pending,
153
+ loadingState: LoadingState.Loaded,
154
+ sig,
155
+ };
156
+ }
157
+ }
158
+ getStat(uri) {
159
+ return this.cspellIO.getStat(uri).catch(errors_1.toError);
160
+ }
161
+ getStatSync(uri) {
162
+ try {
163
+ return this.cspellIO.getStatSync(uri);
164
+ }
165
+ catch (e) {
166
+ return (0, errors_1.toError)(e);
167
+ }
168
+ }
169
+ isEqual(a, b) {
170
+ if (!b)
171
+ return false;
172
+ if (isError(a)) {
173
+ return isError(b) && a.message === b.message && a.name === b.name;
174
+ }
175
+ return !isError(b) && !this.cspellIO.compareStats(a, b);
176
+ }
177
+ normalizeOptions(uri, options) {
178
+ if (options.name)
179
+ return options;
180
+ return { ...options, name: this.cspellIO.uriBasename(uri) };
181
+ }
182
+ }
183
+ exports.DictionaryLoader = DictionaryLoader;
184
+ function toReader(cspellIO) {
185
+ return async function (filename) {
186
+ const res = await cspellIO.readFile(filename);
187
+ return res.content.split(/\n|\r\n|\r/);
188
+ };
189
+ }
190
+ function toReaderSync(cspellIO) {
191
+ return function (filename) {
192
+ const res = cspellIO.readFileSync(filename);
193
+ return res.content.split(/\n|\r\n|\r/);
194
+ };
195
+ }
196
+ const importantOptionKeys = ['name', 'noSuggest', 'useCompounds', 'type'];
197
+ function calcKey(def) {
198
+ const path = def.path;
199
+ const loaderType = determineType(path, def);
200
+ const optValues = importantOptionKeys.map((k) => def[k]?.toString() || '');
201
+ const parts = [path, loaderType].concat(optValues);
202
+ return parts.join('|');
203
+ }
204
+ function isError(e) {
205
+ const err = e;
206
+ return !!err.message;
207
+ }
208
+ function determineType(uri, opts) {
209
+ const t = (opts.type && opts.type in loaders && opts.type) || 'S';
210
+ const defLoaderType = t;
211
+ const defType = uri.endsWith('.trie.gz') ? 'T' : defLoaderType;
212
+ const regTrieTest = /\.trie\b/i;
213
+ return regTrieTest.test(uri) ? 'T' : defType;
214
+ }
215
+ function load(reader, uri, options) {
216
+ const type = determineType(uri, options);
217
+ const loader = loaders[type] || loaders.default;
218
+ return loader(reader, uri, options);
219
+ }
220
+ function loadSync(reader, uri, options) {
221
+ const type = determineType(uri, options);
222
+ const loader = loadersSync[type] || loaders.default;
223
+ return loader(reader, uri, options);
224
+ }
225
+ async function legacyWordList(readLines, filename, options) {
226
+ const lines = await readLines(filename);
227
+ return _legacyWordListSync(lines, filename, options);
228
+ }
229
+ function legacyWordListSync(readLinesSync, filename, options) {
230
+ const lines = readLinesSync(filename);
231
+ return _legacyWordListSync(lines, filename, options);
232
+ }
233
+ function _legacyWordListSync(lines, filename, options) {
234
+ const words = (0, cspell_pipe_1.pipeSync)(lines,
235
+ // Remove comments
236
+ (0, cspell_pipe_1.opMap)((line) => line.replace(/#.*/g, '')),
237
+ // Split on everything else
238
+ (0, cspell_pipe_1.opConcatMap)((line) => line.split(/[^\w\p{L}\p{M}'’]+/gu)), (0, cspell_pipe_1.opFilter)((word) => !!word));
239
+ return (0, createSpellingDictionary_1.createSpellingDictionary)(words, options.name, filename, options);
240
+ }
241
+ async function wordsPerLineWordList(readLines, filename, options) {
242
+ const lines = await readLines(filename);
243
+ return _wordsPerLineWordList(lines, filename, options);
244
+ }
245
+ function wordsPerLineWordListSync(readLinesSync, filename, options) {
246
+ const lines = readLinesSync(filename);
247
+ return _wordsPerLineWordList(lines, filename, options);
248
+ }
249
+ function _wordsPerLineWordList(lines, filename, options) {
250
+ const words = (0, cspell_pipe_1.pipeSync)(lines,
251
+ // Remove comments
252
+ (0, cspell_pipe_1.opMap)((line) => line.replace(/#.*/g, '')),
253
+ // Split on everything else
254
+ (0, cspell_pipe_1.opConcatMap)((line) => line.split(/\s+/gu)), (0, cspell_pipe_1.opFilter)((word) => !!word));
255
+ return (0, createSpellingDictionary_1.createSpellingDictionary)(words, options.name, filename, options);
256
+ }
257
+ async function loadSimpleWordList(reader, filename, options) {
258
+ const lines = await reader(filename);
259
+ return (0, createSpellingDictionary_1.createSpellingDictionary)(lines, options.name, filename, options);
260
+ }
261
+ function loadSimpleWordListSync(readLinesSync, filename, options) {
262
+ const lines = readLinesSync(filename);
263
+ return (0, createSpellingDictionary_1.createSpellingDictionary)(lines, options.name, filename, options);
264
+ }
265
+ async function loadTrie(readLines, filename, options) {
266
+ const lines = await readLines(filename);
267
+ return (0, SpellingDictionaryFromTrie_1.createSpellingDictionaryTrie)(lines, options.name, filename, options);
268
+ }
269
+ function loadTrieSync(readLinesSync, filename, options) {
270
+ const lines = readLinesSync(filename);
271
+ return (0, SpellingDictionaryFromTrie_1.createSpellingDictionaryTrie)(lines, options.name, filename, options);
272
+ }
273
+ //# sourceMappingURL=DictionaryLoader.js.map
@@ -0,0 +1,2 @@
1
+ export { DictionaryLoader, type LoadOptions } from './DictionaryLoader';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.DictionaryLoader = void 0;
4
+ var DictionaryLoader_1 = require("./DictionaryLoader");
5
+ Object.defineProperty(exports, "DictionaryLoader", { enumerable: true, get: function () { return DictionaryLoader_1.DictionaryLoader; } });
6
+ //# sourceMappingURL=index.js.map
@@ -1,38 +1,9 @@
1
- import { Stats } from 'cspell-io';
1
+ import { CSpellIO } from 'cspell-io';
2
2
  import { DictionaryDefinitionInternal } from '../Models/CSpellSettingsInternalDef';
3
+ import { DictionaryLoader } from './DictionaryController';
3
4
  import { SpellingDictionary } from './SpellingDictionary';
4
- export declare type LoadOptions = DictionaryDefinitionInternal;
5
- declare enum LoadingState {
6
- Loaded = 0,
7
- Loading = 1
8
- }
9
- interface CacheEntry {
10
- uri: string;
11
- options: LoadOptions;
12
- ts: number;
13
- stat: Stats | Error | undefined;
14
- dictionary: SpellingDictionary | undefined;
15
- pending: Promise<readonly [SpellingDictionary, Stats | Error]>;
16
- loadingState: LoadingState;
17
- sig: number;
18
- }
19
- export declare type LoaderType = keyof Loaders;
20
- export declare type Loader = (filename: string, options: LoadOptions) => Promise<SpellingDictionary>;
21
- export declare type LoaderSync = (filename: string, options: LoadOptions) => SpellingDictionary;
22
- export interface Loaders {
23
- S: Loader;
24
- C: Loader;
25
- T: Loader;
26
- W: Loader;
27
- default: Loader;
28
- }
29
- export interface SyncLoaders {
30
- S: LoaderSync;
31
- C: LoaderSync;
32
- T: LoaderSync;
33
- W: LoaderSync;
34
- default: LoaderSync;
35
- }
5
+ export type { LoadOptions } from './DictionaryController';
6
+ export declare function getDictionaryLoader(cspellIO?: CSpellIO): DictionaryLoader;
36
7
  export declare function loadDictionary(def: DictionaryDefinitionInternal): Promise<SpellingDictionary>;
37
8
  export declare function loadDictionarySync(def: DictionaryDefinitionInternal): SpellingDictionary;
38
9
  /**
@@ -41,17 +12,4 @@ export declare function loadDictionarySync(def: DictionaryDefinitionInternal): S
41
12
  * @param now - optional timestamp representing now. (Mostly used in testing)
42
13
  */
43
14
  export declare function refreshCacheEntries(maxAge?: number, now?: number): Promise<void>;
44
- declare function refreshEntry(entry: CacheEntry, maxAge: number, now: number): Promise<void>;
45
- declare function loadEntry(uri: string, options: LoadOptions, now?: number): CacheEntry;
46
- declare function load(uri: string, options: LoadOptions): Promise<SpellingDictionary>;
47
- export declare const testing: {
48
- dictionaryCache: Map<string, CacheEntry>;
49
- refreshEntry: typeof refreshEntry;
50
- loadEntry: typeof loadEntry;
51
- load: typeof load;
52
- };
53
- export declare const __testing__: {
54
- debugLog: string[];
55
- };
56
- export {};
57
15
  //# sourceMappingURL=DictionaryLoader.d.ts.map
@@ -1,294 +1,30 @@
1
1
  "use strict";
2
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
3
- if (k2 === undefined) k2 = k;
4
- var desc = Object.getOwnPropertyDescriptor(m, k);
5
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
6
- desc = { enumerable: true, get: function() { return m[k]; } };
7
- }
8
- Object.defineProperty(o, k2, desc);
9
- }) : (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- o[k2] = m[k];
12
- }));
13
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
14
- Object.defineProperty(o, "default", { enumerable: true, value: v });
15
- }) : function(o, v) {
16
- o["default"] = v;
17
- });
18
- var __importStar = (this && this.__importStar) || function (mod) {
19
- if (mod && mod.__esModule) return mod;
20
- var result = {};
21
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
22
- __setModuleDefault(result, mod);
23
- return result;
24
- };
25
2
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.__testing__ = exports.testing = exports.refreshCacheEntries = exports.loadDictionarySync = exports.loadDictionary = void 0;
27
- const cspell_io_1 = require("cspell-io");
28
- const gensequence_1 = require("gensequence");
29
- const path = __importStar(require("path"));
30
- const util_1 = require("util");
31
- const fileReader_1 = require("../util/fileReader");
32
- const createSpellingDictionary_1 = require("./createSpellingDictionary");
33
- const SpellingDictionaryError_1 = require("./SpellingDictionaryError");
34
- const SpellingDictionaryFromTrie_1 = require("./SpellingDictionaryFromTrie");
35
- const MAX_AGE = 10000;
36
- const loaders = {
37
- S: loadSimpleWordList,
38
- C: legacyWordList,
39
- W: wordsPerLineWordList,
40
- T: loadTrie,
41
- default: loadSimpleWordList,
42
- };
43
- const loadersSync = {
44
- S: loadSimpleWordListSync,
45
- C: legacyWordListSync,
46
- W: wordsPerLineWordListSync,
47
- T: loadTrieSync,
48
- default: loadSimpleWordListSync,
49
- };
50
- var LoadingState;
51
- (function (LoadingState) {
52
- LoadingState[LoadingState["Loaded"] = 0] = "Loaded";
53
- LoadingState[LoadingState["Loading"] = 1] = "Loading";
54
- })(LoadingState || (LoadingState = {}));
55
- const debugLog = [];
56
- const debugMode = false;
57
- function __log(msg) {
58
- debugMode && debugLog.push(msg);
59
- }
60
- const dictionaryCache = new Map();
61
- const dictionaryCacheByDef = new Map();
62
- function getCacheEntry(def) {
63
- const defEntry = dictionaryCacheByDef.get(def);
64
- if (defEntry) {
65
- return defEntry;
66
- }
67
- const key = calcKey(def);
68
- const entry = dictionaryCache.get(key);
69
- if (entry) {
70
- // replace old entry so it can be released.
71
- entry.options = def;
72
- }
73
- return { key, entry };
74
- }
75
- function setCacheEntry(key, entry, def) {
76
- dictionaryCache.set(key, entry);
77
- dictionaryCacheByDef.set(def, { key, entry });
78
- }
3
+ exports.refreshCacheEntries = exports.loadDictionarySync = exports.loadDictionary = exports.getDictionaryLoader = void 0;
4
+ const static_1 = require("../static");
5
+ const DictionaryController_1 = require("./DictionaryController");
6
+ let loader;
7
+ function getDictionaryLoader(cspellIO) {
8
+ if (loader)
9
+ return loader;
10
+ return (loader = new DictionaryController_1.DictionaryLoader(cspellIO || (0, static_1.getCSpellIO)()));
11
+ }
12
+ exports.getDictionaryLoader = getDictionaryLoader;
79
13
  function loadDictionary(def) {
80
- const { key, entry } = getCacheEntry(def);
81
- if (entry) {
82
- return entry.pending.then(([dictionary]) => dictionary);
83
- }
84
- const loadedEntry = loadEntry(def.path, def);
85
- setCacheEntry(key, loadedEntry, def);
86
- return loadedEntry.pending.then(([dictionary]) => dictionary);
14
+ return getDictionaryLoader().loadDictionary(def);
87
15
  }
88
16
  exports.loadDictionary = loadDictionary;
89
17
  function loadDictionarySync(def) {
90
- const { key, entry } = getCacheEntry(def);
91
- if (entry?.dictionary && entry.loadingState === LoadingState.Loaded) {
92
- return entry.dictionary;
93
- }
94
- const loadedEntry = loadEntrySync(def.path, def);
95
- setCacheEntry(key, loadedEntry, def);
96
- return loadedEntry.dictionary;
18
+ return getDictionaryLoader().loadDictionarySync(def);
97
19
  }
98
20
  exports.loadDictionarySync = loadDictionarySync;
99
- const importantOptionKeys = ['name', 'noSuggest', 'useCompounds', 'type'];
100
- function calcKey(def) {
101
- const path = def.path;
102
- const loaderType = determineType(path, def);
103
- const optValues = importantOptionKeys.map((k) => def[k]?.toString() || '');
104
- const parts = [path, loaderType].concat(optValues);
105
- return parts.join('|');
106
- }
107
21
  /**
108
22
  * Check to see if any of the cached dictionaries have changed. If one has changed, reload it.
109
23
  * @param maxAge - Only check the dictionary if it has been at least `maxAge` ms since the last check.
110
24
  * @param now - optional timestamp representing now. (Mostly used in testing)
111
25
  */
112
- async function refreshCacheEntries(maxAge = MAX_AGE, now = Date.now()) {
113
- await Promise.all([...dictionaryCache.values()].map((entry) => refreshEntry(entry, maxAge, now)));
26
+ async function refreshCacheEntries(maxAge, now) {
27
+ return getDictionaryLoader().refreshCacheEntries(maxAge, now);
114
28
  }
115
29
  exports.refreshCacheEntries = refreshCacheEntries;
116
- async function refreshEntry(entry, maxAge, now) {
117
- if (now - entry.ts >= maxAge) {
118
- const sig = now + Math.random();
119
- // Write to the ts, so the next one will not do it.
120
- entry.sig = sig;
121
- entry.ts = now;
122
- const pStat = (0, cspell_io_1.getStat)(entry.uri);
123
- const [newStat] = await Promise.all([pStat, entry.pending]);
124
- const hasChanged = !isEqual(newStat, entry.stat);
125
- const sigMatches = entry.sig === sig;
126
- // if (entry.options.name === 'temp') {
127
- // const processedAt = Date.now();
128
- // __log(
129
- // `Refresh ${entry.options.name}; sig: ${sig.toFixed(
130
- // 2
131
- // )} at ${processedAt}; Sig Matches: ${sigMatches.toString()}; changed: ${hasChanged.toString()}; file: ${path.relative(
132
- // process.cwd(),
133
- // entry.uri
134
- // )}`
135
- // );
136
- // }
137
- if (sigMatches && hasChanged) {
138
- entry.loadingState = LoadingState.Loading;
139
- const key = calcKey(entry.options);
140
- const newEntry = loadEntry(entry.uri, entry.options);
141
- dictionaryCache.set(key, newEntry);
142
- dictionaryCacheByDef.set(entry.options, { key, entry: newEntry });
143
- }
144
- }
145
- }
146
- function isEqual(a, b) {
147
- if (!b)
148
- return false;
149
- if (isError(a)) {
150
- return isError(b) && a.message === b.message && a.name === b.name;
151
- }
152
- return !isError(b) && a.mtimeMs === b.mtimeMs && a.size === b.size && a.eTag === b.eTag;
153
- }
154
- function isError(e) {
155
- const err = e;
156
- return !!err.message;
157
- }
158
- function loadEntry(uri, options, now = Date.now()) {
159
- const pDictionary = load(uri, options).catch((e) => (0, createSpellingDictionary_1.createFailedToLoadDictionary)(new SpellingDictionaryError_1.SpellingDictionaryLoadError(uri, options, e, 'failed to load')));
160
- const pStat = (0, cspell_io_1.getStat)(uri);
161
- const pending = Promise.all([pDictionary, pStat]);
162
- const sig = now + Math.random();
163
- const entry = {
164
- uri,
165
- options,
166
- ts: now,
167
- stat: undefined,
168
- dictionary: undefined,
169
- pending,
170
- loadingState: LoadingState.Loading,
171
- sig,
172
- };
173
- // eslint-disable-next-line promise/catch-or-return
174
- pending.then(([dictionary, stat]) => {
175
- entry.stat = stat;
176
- entry.dictionary = dictionary;
177
- entry.loadingState = LoadingState.Loaded;
178
- return;
179
- });
180
- return entry;
181
- }
182
- function loadEntrySync(uri, options, now = Date.now()) {
183
- const stat = (0, cspell_io_1.getStatSync)(uri);
184
- const sig = now + Math.random();
185
- try {
186
- const dictionary = loadSync(uri, options);
187
- const pending = Promise.resolve([dictionary, stat]);
188
- return {
189
- uri,
190
- options,
191
- ts: now,
192
- stat,
193
- dictionary,
194
- pending,
195
- loadingState: LoadingState.Loaded,
196
- sig,
197
- };
198
- }
199
- catch (e) {
200
- const error = e instanceof Error ? e : new Error((0, util_1.format)(e));
201
- const dictionary = (0, createSpellingDictionary_1.createFailedToLoadDictionary)(new SpellingDictionaryError_1.SpellingDictionaryLoadError(uri, options, error, 'failed to load'));
202
- const pending = Promise.resolve([dictionary, stat]);
203
- return {
204
- uri,
205
- options,
206
- ts: now,
207
- stat,
208
- dictionary,
209
- pending,
210
- loadingState: LoadingState.Loaded,
211
- sig,
212
- };
213
- }
214
- }
215
- function determineType(uri, opts) {
216
- const t = (opts.type && opts.type in loaders && opts.type) || 'S';
217
- const defLoaderType = t;
218
- const defType = uri.endsWith('.trie.gz') ? 'T' : defLoaderType;
219
- const regTrieTest = /\.trie\b/i;
220
- return regTrieTest.test(uri) ? 'T' : defType;
221
- }
222
- function load(uri, options) {
223
- const type = determineType(uri, options);
224
- const loader = loaders[type] || loaders.default;
225
- return loader(uri, options);
226
- }
227
- function loadSync(uri, options) {
228
- const type = determineType(uri, options);
229
- const loader = loadersSync[type] || loaders.default;
230
- return loader(uri, options);
231
- }
232
- async function legacyWordList(filename, options) {
233
- const lines = await (0, fileReader_1.readLines)(filename);
234
- return _legacyWordListSync(lines, filename, options);
235
- }
236
- function legacyWordListSync(filename, options) {
237
- const lines = (0, fileReader_1.readLinesSync)(filename);
238
- return _legacyWordListSync(lines, filename, options);
239
- }
240
- function _legacyWordListSync(lines, filename, options) {
241
- const words = (0, gensequence_1.genSequence)(lines)
242
- // Remove comments
243
- .map((line) => line.replace(/#.*/g, ''))
244
- // Split on everything else
245
- .concatMap((line) => line.split(/[^\w\p{L}\p{M}'’]+/gu))
246
- .filter((word) => !!word);
247
- return (0, createSpellingDictionary_1.createSpellingDictionary)(words, determineName(filename, options), filename, options);
248
- }
249
- async function wordsPerLineWordList(filename, options) {
250
- const lines = await (0, fileReader_1.readLines)(filename);
251
- return _wordsPerLineWordList(lines, filename, options);
252
- }
253
- function wordsPerLineWordListSync(filename, options) {
254
- const lines = (0, fileReader_1.readLinesSync)(filename);
255
- return _wordsPerLineWordList(lines, filename, options);
256
- }
257
- function _wordsPerLineWordList(lines, filename, options) {
258
- const words = (0, gensequence_1.genSequence)(lines)
259
- // Remove comments
260
- .map((line) => line.replace(/#.*/g, ''))
261
- // Split on everything else
262
- .concatMap((line) => line.split(/\s+/gu))
263
- .filter((word) => !!word);
264
- return (0, createSpellingDictionary_1.createSpellingDictionary)(words, determineName(filename, options), filename, options);
265
- }
266
- async function loadSimpleWordList(filename, options) {
267
- const lines = await (0, fileReader_1.readLines)(filename);
268
- return (0, createSpellingDictionary_1.createSpellingDictionary)(lines, determineName(filename, options), filename, options);
269
- }
270
- function loadSimpleWordListSync(filename, options) {
271
- const lines = (0, fileReader_1.readLinesSync)(filename);
272
- return (0, createSpellingDictionary_1.createSpellingDictionary)(lines, determineName(filename, options), filename, options);
273
- }
274
- async function loadTrie(filename, options) {
275
- const lines = await (0, fileReader_1.readLines)(filename);
276
- return (0, SpellingDictionaryFromTrie_1.createSpellingDictionaryTrie)(lines, determineName(filename, options), filename, options);
277
- }
278
- function loadTrieSync(filename, options) {
279
- const lines = (0, fileReader_1.readLinesSync)(filename);
280
- return (0, SpellingDictionaryFromTrie_1.createSpellingDictionaryTrie)(lines, determineName(filename, options), filename, options);
281
- }
282
- function determineName(filename, options) {
283
- return options.name || path.basename(filename);
284
- }
285
- exports.testing = {
286
- dictionaryCache,
287
- refreshEntry,
288
- loadEntry,
289
- load,
290
- };
291
- exports.__testing__ = {
292
- debugLog,
293
- };
294
30
  //# sourceMappingURL=DictionaryLoader.js.map
@@ -0,0 +1,3 @@
1
+ import { CSpellIO } from 'cspell-io';
2
+ export declare function getCSpellIO(): CSpellIO;
3
+ //# sourceMappingURL=static.d.ts.map
package/dist/static.js ADDED
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getCSpellIO = void 0;
4
+ const cspell_io_1 = require("cspell-io");
5
+ const cspellIO = new cspell_io_1.CSpellIONode();
6
+ function getCSpellIO() {
7
+ return cspellIO;
8
+ }
9
+ exports.getCSpellIO = getCSpellIO;
10
+ //# sourceMappingURL=static.js.map
@@ -9,7 +9,7 @@ const assert_1 = __importDefault(require("assert"));
9
9
  const cspell_glob_1 = require("cspell-glob");
10
10
  const TextDocument_1 = require("../Models/TextDocument");
11
11
  const Settings_1 = require("../Settings");
12
- const configLoader_1 = require("../Settings/configLoader");
12
+ const configLoader_1 = require("../Settings/Controller/configLoader");
13
13
  const SpellingDictionary_1 = require("../SpellingDictionary");
14
14
  const errors_1 = require("../util/errors");
15
15
  const Memorizer_1 = require("../util/Memorizer");
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell-lib",
3
- "version": "6.6.1",
3
+ "version": "6.7.0",
4
4
  "description": "A library of useful functions used across various cspell tools.",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -48,17 +48,17 @@
48
48
  },
49
49
  "homepage": "https://github.com/streetsidesoftware/cspell#readme",
50
50
  "dependencies": {
51
- "@cspell/cspell-bundled-dicts": "^6.6.1",
52
- "@cspell/cspell-pipe": "^6.6.1",
53
- "@cspell/cspell-types": "^6.6.1",
51
+ "@cspell/cspell-bundled-dicts": "^6.7.0",
52
+ "@cspell/cspell-pipe": "^6.7.0",
53
+ "@cspell/cspell-types": "^6.7.0",
54
54
  "clear-module": "^4.1.2",
55
- "comment-json": "^4.2.2",
55
+ "comment-json": "^4.2.3",
56
56
  "configstore": "^5.0.1",
57
57
  "cosmiconfig": "^7.0.1",
58
- "cspell-glob": "^6.6.1",
59
- "cspell-grammar": "^6.6.1",
60
- "cspell-io": "^6.6.1",
61
- "cspell-trie-lib": "^6.6.1",
58
+ "cspell-glob": "^6.7.0",
59
+ "cspell-grammar": "^6.7.0",
60
+ "cspell-io": "^6.7.0",
61
+ "cspell-trie-lib": "^6.7.0",
62
62
  "fast-equals": "^4.0.1",
63
63
  "find-up": "^5.0.0",
64
64
  "fs-extra": "^10.1.0",
@@ -83,15 +83,15 @@
83
83
  "@cspell/dict-python": "^2.0.6",
84
84
  "@types/configstore": "^5.0.1",
85
85
  "@types/fs-extra": "^9.0.13",
86
- "@types/jest": "^28.1.6",
87
- "@types/node": "^18.6.5",
86
+ "@types/jest": "^28.1.7",
87
+ "@types/node": "^18.7.6",
88
88
  "cspell-dict-nl-nl": "^1.1.2",
89
89
  "jest": "^28.1.3",
90
90
  "lorem-ipsum": "^2.0.8",
91
91
  "rimraf": "^3.0.2",
92
- "rollup": "^2.77.2",
92
+ "rollup": "^2.78.0",
93
93
  "rollup-plugin-dts": "^4.2.2",
94
- "ts-jest": "^28.0.7"
94
+ "ts-jest": "^28.0.8"
95
95
  },
96
- "gitHead": "3c9c24d1cebd558ac3729d3fbf441e6ed751d8cf"
96
+ "gitHead": "3a7312a15d2df1507d9e01863ec5842f5a99e0cc"
97
97
  }
@@ -1,5 +0,0 @@
1
- export declare class ImportError extends Error {
2
- readonly cause: Error | undefined;
3
- constructor(msg: string, cause?: Error | unknown);
4
- }
5
- //# sourceMappingURL=ImportError.d.ts.map
@@ -1,12 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ImportError = void 0;
4
- const errors_1 = require("../util/errors");
5
- class ImportError extends Error {
6
- constructor(msg, cause) {
7
- super(msg);
8
- this.cause = (0, errors_1.isError)(cause) ? cause : undefined;
9
- }
10
- }
11
- exports.ImportError = ImportError;
12
- //# sourceMappingURL=ImportError.js.map