cspell-lib 5.9.1-alpha.1 → 5.10.0-alpha.4

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 (69) hide show
  1. package/dist/Cache/cspell.cache.d.ts +1 -0
  2. package/dist/Cache/index.d.ts +1 -0
  3. package/dist/LanguageIds.d.ts +1 -0
  4. package/dist/Settings/CSpellSettingsServer.d.ts +2 -1
  5. package/dist/Settings/DefaultSettings.d.ts +2 -1
  6. package/dist/Settings/DefaultSettings.js +4 -3
  7. package/dist/Settings/DictionaryReferenceCollection.d.ts +2 -1
  8. package/dist/Settings/DictionarySettings.d.ts +2 -1
  9. package/dist/Settings/GlobalSettings.d.ts +2 -1
  10. package/dist/Settings/GlobalSettings.js +6 -2
  11. package/dist/Settings/ImportError.d.ts +3 -2
  12. package/dist/Settings/ImportError.js +2 -1
  13. package/dist/Settings/InDocSettings.d.ts +2 -1
  14. package/dist/Settings/LanguageSettings.d.ts +2 -1
  15. package/dist/Settings/RegExpPatterns.d.ts +1 -0
  16. package/dist/Settings/TextDocumentSettings.d.ts +2 -1
  17. package/dist/Settings/TextDocumentSettings.js +1 -1
  18. package/dist/Settings/index.d.ts +2 -1
  19. package/dist/Settings/index.js +1 -1
  20. package/dist/Settings/link.d.ts +2 -1
  21. package/dist/Settings/link.js +1 -1
  22. package/dist/Settings/pnpLoader.d.ts +1 -0
  23. package/dist/SpellingDictionary/Dictionaries.d.ts +2 -1
  24. package/dist/SpellingDictionary/DictionaryLoader.d.ts +2 -1
  25. package/dist/SpellingDictionary/DictionaryLoader.js +3 -3
  26. package/dist/SpellingDictionary/DictionaryLoaderTypes.d.ts +1 -0
  27. package/dist/SpellingDictionary/SpellingDictionary.d.ts +3 -2
  28. package/dist/SpellingDictionary/SpellingDictionaryCollection.d.ts +1 -0
  29. package/dist/SpellingDictionary/SpellingDictionaryError.d.ts +1 -0
  30. package/dist/SpellingDictionary/SpellingDictionaryFromTrie.d.ts +1 -0
  31. package/dist/SpellingDictionary/SpellingDictionaryMethods.d.ts +1 -0
  32. package/dist/SpellingDictionary/SuggestExperimental/SuggestionCollector.d.ts +1 -0
  33. package/dist/SpellingDictionary/SuggestExperimental/entities.d.ts +1 -0
  34. package/dist/SpellingDictionary/SuggestExperimental/helpers.d.ts +1 -0
  35. package/dist/SpellingDictionary/SuggestExperimental/suggest.d.ts +1 -0
  36. package/dist/SpellingDictionary/createSpellingDictionary.d.ts +1 -0
  37. package/dist/SpellingDictionary/index.d.ts +1 -0
  38. package/dist/exclusionHelper.d.ts +2 -1
  39. package/dist/index.d.ts +1 -1
  40. package/dist/spellCheckFile.d.ts +2 -1
  41. package/dist/spellCheckFile.js +6 -4
  42. package/dist/textValidator.d.ts +6 -6
  43. package/dist/textValidator.js +1 -1
  44. package/dist/trace.d.ts +2 -1
  45. package/dist/util/Comparable.d.ts +1 -0
  46. package/dist/util/FreqCounter.d.ts +1 -0
  47. package/dist/util/IterableLike.d.ts +1 -0
  48. package/dist/util/Memorizer.d.ts +1 -0
  49. package/dist/util/MinHeapQueue.d.ts +1 -0
  50. package/dist/util/PairingHeap.d.ts +1 -0
  51. package/dist/util/TextRange.d.ts +1 -0
  52. package/dist/util/errors.d.ts +9 -0
  53. package/dist/util/errors.js +39 -0
  54. package/dist/util/fileReader.d.ts +1 -0
  55. package/dist/util/iterableIteratorLib.d.ts +1 -0
  56. package/dist/util/logger.d.ts +1 -0
  57. package/dist/util/regexHelper.d.ts +1 -0
  58. package/dist/util/repMap.d.ts +2 -1
  59. package/dist/util/resolveFile.d.ts +1 -0
  60. package/dist/util/search.d.ts +1 -0
  61. package/dist/util/text.d.ts +2 -11
  62. package/dist/util/text.js +1 -0
  63. package/dist/util/textRegex.d.ts +1 -0
  64. package/dist/util/types.d.ts +1 -0
  65. package/dist/util/util.d.ts +1 -0
  66. package/dist/util/wordSplitter.d.ts +2 -1
  67. package/dist/validator.d.ts +2 -1
  68. package/dist/wordListHelper.d.ts +1 -0
  69. package/package.json +11 -10
@@ -39,3 +39,4 @@ export declare type IssueLine = [
39
39
  text: IssueEntry['text'],
40
40
  len: IssueEntry['len']
41
41
  ];
42
+ //# sourceMappingURL=cspell.cache.d.ts.map
@@ -1 +1,2 @@
1
1
  export type { CSpellCache } from './cspell.cache';
2
+ //# sourceMappingURL=index.d.ts.map
@@ -22,3 +22,4 @@ export declare function isGeneratedExt(ext: string): boolean;
22
22
  export declare function isGenerated(languageId: LanguageId | LanguageId[] | Iterable<LanguageId>): boolean;
23
23
  export declare function buildLanguageExtensionMap(defs: LanguageExtensionDefinitions): ExtensionToLanguageIdMap;
24
24
  export declare function getLanguagesForExt(ext: string): string[];
25
+ //# sourceMappingURL=LanguageIds.d.ts.map
@@ -1,4 +1,4 @@
1
- import { CSpellSettingsWithSourceTrace, CSpellUserSettings, Glob, ImportFileRef, PnPSettings } from '@cspell/cspell-types';
1
+ import type { CSpellSettingsWithSourceTrace, CSpellUserSettings, Glob, ImportFileRef, PnPSettings } from '@cspell/cspell-types';
2
2
  import { URI } from 'vscode-uri';
3
3
  import { LoaderResult } from './pnpLoader';
4
4
  export declare const sectionCSpell = "cSpell";
@@ -53,3 +53,4 @@ export declare const __testing__: {
53
53
  validateRawConfigExports: typeof validateRawConfigExports;
54
54
  };
55
55
  export {};
56
+ //# sourceMappingURL=CSpellSettingsServer.d.ts.map
@@ -1,3 +1,4 @@
1
- import { CSpellSettings, CSpellSettingsWithSourceTrace } from '@cspell/cspell-types';
1
+ import type { CSpellSettings, CSpellSettingsWithSourceTrace } from '@cspell/cspell-types';
2
2
  export declare const _defaultSettings: Readonly<CSpellSettingsWithSourceTrace>;
3
3
  export declare function getDefaultSettings(): CSpellSettings;
4
+ //# sourceMappingURL=DefaultSettings.d.ts.map
@@ -20,11 +20,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.getDefaultSettings = exports._defaultSettings = void 0;
23
- const LanguageSettings = __importStar(require("./LanguageSettings"));
24
- const RegPat = __importStar(require("./RegExpPatterns"));
23
+ const resolveFile_1 = require("../util/resolveFile");
25
24
  const CSpellSettingsServer_1 = require("./CSpellSettingsServer");
26
25
  const index_1 = require("./index");
27
- const resolveFile_1 = require("../util/resolveFile");
26
+ const LanguageSettings = __importStar(require("./LanguageSettings"));
27
+ const RegPat = __importStar(require("./RegExpPatterns"));
28
28
  const defaultConfigFileModuleRef = '@cspell/cspell-bundled-dicts/cspell-default.json';
29
29
  // Do not use require.resolve because webpack will mess it up.
30
30
  const defaultConfigFile = resolveConfigModule(defaultConfigFileModuleRef);
@@ -124,6 +124,7 @@ exports._defaultSettings = {
124
124
  ignoreRegExpList: defaultRegExpExcludeList,
125
125
  languageSettings: LanguageSettings.getDefaultLanguageSettings(),
126
126
  source: { name: 'defaultSettings' },
127
+ reporters: [],
127
128
  };
128
129
  const getSettings = (function () {
129
130
  let settings = undefined;
@@ -1,4 +1,4 @@
1
- import { DictionaryId, DictionaryReference } from '@cspell/cspell-types';
1
+ import type { DictionaryId, DictionaryReference } from '@cspell/cspell-types';
2
2
  export interface DictionaryReferenceCollection {
3
3
  isEnabled(name: DictionaryId): boolean | undefined;
4
4
  isBlocked(name: DictionaryId): boolean | undefined;
@@ -7,3 +7,4 @@ export interface DictionaryReferenceCollection {
7
7
  dictionaryIds: DictionaryId[];
8
8
  }
9
9
  export declare function createDictionaryReferenceCollection(dictionaries: DictionaryReference[]): DictionaryReferenceCollection;
10
+ //# sourceMappingURL=DictionaryReferenceCollection.d.ts.map
@@ -1,4 +1,4 @@
1
- import { DictionaryDefinition, DictionaryDefinitionPreferred, DictionaryReference } from '@cspell/cspell-types';
1
+ import type { DictionaryDefinition, DictionaryDefinitionPreferred, DictionaryReference } from '@cspell/cspell-types';
2
2
  export interface DictionaryDefinitionWithSource extends DictionaryDefinitionPreferred {
3
3
  /** The path to the config file that contains this dictionary definition */
4
4
  __source: string;
@@ -22,3 +22,4 @@ export declare function normalizePathForDictDefs(defs: DictionaryDefinition[], p
22
22
  export declare function normalizePathForDictDefs(defs: DictionaryDefinition[] | undefined, pathToSettingsFile: string): DictionaryDefinitionWithSource[] | undefined;
23
23
  export declare function normalizePathForDictDef(def: DictionaryDefinition, pathToSettingsFile: string): DictionaryDefinitionWithSource;
24
24
  export declare function isDictionaryDefinitionWithSource(d: DictionaryDefinition | DictionaryDefinitionWithSource): d is DictionaryDefinitionWithSource;
25
+ //# sourceMappingURL=DictionarySettings.d.ts.map
@@ -1,4 +1,4 @@
1
- import { CSpellSettings, CSpellSettingsWithSourceTrace } from '@cspell/cspell-types';
1
+ import type { CSpellSettings, CSpellSettingsWithSourceTrace } from '@cspell/cspell-types';
2
2
  export interface GlobalSettingsWithSource extends Partial<GlobalCSpellSettings> {
3
3
  source: CSpellSettingsWithSourceTrace['source'];
4
4
  }
@@ -8,3 +8,4 @@ export interface GlobalCSpellSettings {
8
8
  export declare function getRawGlobalSettings(): GlobalSettingsWithSource;
9
9
  export declare function writeRawGlobalSettings(settings: GlobalCSpellSettings): Error | undefined;
10
10
  export declare function getGlobalConfigPath(): string;
11
+ //# sourceMappingURL=GlobalSettings.d.ts.map
@@ -5,6 +5,8 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.getGlobalConfigPath = exports.writeRawGlobalSettings = exports.getRawGlobalSettings = void 0;
7
7
  const configstore_1 = __importDefault(require("configstore"));
8
+ const util_1 = require("util");
9
+ const errors_1 = require("../util/errors");
8
10
  const logger_1 = require("../util/logger");
9
11
  const packageName = 'cspell';
10
12
  function getRawGlobalSettings() {
@@ -28,7 +30,9 @@ function getRawGlobalSettings() {
28
30
  }
29
31
  }
30
32
  catch (error) {
31
- if (!['ENOENT', 'EACCES', 'ENOTDIR', 'EISDIR'].includes(error.code)) {
33
+ if (!(0, errors_1.isErrnoException)(error) ||
34
+ !error.code ||
35
+ !['ENOENT', 'EACCES', 'ENOTDIR', 'EISDIR'].includes(error.code)) {
32
36
  (0, logger_1.logError)(error);
33
37
  }
34
38
  }
@@ -47,7 +51,7 @@ function writeRawGlobalSettings(settings) {
47
51
  catch (error) {
48
52
  if (error instanceof Error)
49
53
  return error;
50
- return new Error(error.toString());
54
+ return new Error((0, util_1.format)(error));
51
55
  }
52
56
  }
53
57
  exports.writeRawGlobalSettings = writeRawGlobalSettings;
@@ -1,4 +1,5 @@
1
1
  export declare class ImportError extends Error {
2
- readonly cause?: Error | undefined;
3
- constructor(msg: string, cause?: Error | undefined);
2
+ readonly cause?: Error;
3
+ constructor(msg: string, cause?: Error | unknown);
4
4
  }
5
+ //# sourceMappingURL=ImportError.d.ts.map
@@ -1,10 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.ImportError = void 0;
4
+ const errors_1 = require("../util/errors");
4
5
  class ImportError extends Error {
5
6
  constructor(msg, cause) {
6
7
  super(msg);
7
- this.cause = cause;
8
+ this.cause = (0, errors_1.isError)(cause) ? cause : undefined;
8
9
  }
9
10
  }
10
11
  exports.ImportError = ImportError;
@@ -1,5 +1,5 @@
1
+ import type { CSpellUserSettings } from '@cspell/cspell-types';
1
2
  import { Sequence } from 'gensequence';
2
- import { CSpellUserSettings } from '@cspell/cspell-types';
3
3
  export declare type CSpellUserSettingsKeys = keyof CSpellUserSettings;
4
4
  export declare function getInDocumentSettings(text: string): CSpellUserSettings;
5
5
  declare function parseCompoundWords(match: string): CSpellUserSettings;
@@ -22,3 +22,4 @@ export declare const internal: {
22
22
  parseIgnoreWords: typeof parseIgnoreWords;
23
23
  };
24
24
  export {};
25
+ //# sourceMappingURL=InDocSettings.d.ts.map
@@ -1,4 +1,4 @@
1
- import { LanguageSetting, CSpellUserSettings, LocaleId, LanguageId, BaseSetting } from '@cspell/cspell-types';
1
+ import type { LanguageSetting, CSpellUserSettings, LocaleId, LanguageId, BaseSetting } from '@cspell/cspell-types';
2
2
  export declare type LanguageSettings = LanguageSetting[];
3
3
  export declare function getDefaultLanguageSettings(): LanguageSettings;
4
4
  export declare function normalizeLanguageId(langId: LanguageId | LanguageId[]): Set<LanguageId>;
@@ -7,3 +7,4 @@ export declare function isLocaleInSet(locale: LocaleId | LocaleId[], setOfLocals
7
7
  export declare function calcSettingsForLanguage(languageSettings: LanguageSettings, languageId: LanguageId, locale: LocaleId | LocaleId[]): BaseSetting;
8
8
  export declare function calcUserSettingsForLanguage(settings: CSpellUserSettings, languageId: string): CSpellUserSettings;
9
9
  export declare function calcSettingsForLanguageId(baseSettings: CSpellUserSettings, languageId: LanguageId[] | LanguageId): CSpellUserSettings;
10
+ //# sourceMappingURL=LanguageSettings.d.ts.map
@@ -22,3 +22,4 @@ export declare const rexExPythonStyleComments: RegExp;
22
22
  export declare const regExEmail: RegExp;
23
23
  export declare const regExRepeatedChar: RegExp;
24
24
  export declare const regExSha: RegExp;
25
+ //# sourceMappingURL=RegExpPatterns.d.ts.map
@@ -1,3 +1,4 @@
1
- import { CSpellSettings, CSpellUserSettings } from '@cspell/cspell-types';
1
+ import type { CSpellSettings, CSpellUserSettings } from '@cspell/cspell-types';
2
2
  export declare function combineTextAndLanguageSettings(settings: CSpellUserSettings, text: string, languageId: string | string[]): CSpellUserSettings;
3
3
  export declare function extractSettingsFromText(text: string): CSpellSettings;
4
+ //# sourceMappingURL=TextDocumentSettings.d.ts.map
@@ -20,9 +20,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.extractSettingsFromText = exports.combineTextAndLanguageSettings = void 0;
23
- const LanguageSettings_1 = require("./LanguageSettings");
24
23
  const CSpellSettingsServer = __importStar(require("./CSpellSettingsServer"));
25
24
  const InDocSettings_1 = require("./InDocSettings");
25
+ const LanguageSettings_1 = require("./LanguageSettings");
26
26
  function combineTextAndLanguageSettings(settings, text, languageId) {
27
27
  const docSettings = extractSettingsFromText(text);
28
28
  const settingsForText = CSpellSettingsServer.mergeSettings(settings, docSettings);
@@ -1,4 +1,5 @@
1
+ export * from '@cspell/cspell-types';
1
2
  export * from './CSpellSettingsServer';
2
3
  export * from './DefaultSettings';
3
- export * from '@cspell/cspell-types';
4
4
  export * from './ImportError';
5
+ //# sourceMappingURL=index.d.ts.map
@@ -10,8 +10,8 @@ var __exportStar = (this && this.__exportStar) || function(m, exports) {
10
10
  for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
+ __exportStar(require("@cspell/cspell-types"), exports);
13
14
  __exportStar(require("./CSpellSettingsServer"), exports);
14
15
  __exportStar(require("./DefaultSettings"), exports);
15
- __exportStar(require("@cspell/cspell-types"), exports);
16
16
  __exportStar(require("./ImportError"), exports);
17
17
  //# sourceMappingURL=index.js.map
@@ -1,4 +1,4 @@
1
- import { CSpellSettingsWithSourceTrace } from '@cspell/cspell-types';
1
+ import type { CSpellSettingsWithSourceTrace } from '@cspell/cspell-types';
2
2
  export interface ListGlobalImportsResult {
3
3
  filename: string;
4
4
  name: string | undefined;
@@ -47,3 +47,4 @@ export declare const __testing__: {
47
47
  findPackageForCSpellConfig: typeof findPackageForCSpellConfig;
48
48
  };
49
49
  export {};
50
+ //# sourceMappingURL=link.d.ts.map
@@ -20,8 +20,8 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.__testing__ = exports.removePathsFromGlobalImports = exports.addPathsToGlobalImports = exports.listGlobalImports = void 0;
23
- const Path = __importStar(require("path"));
24
23
  const fs = __importStar(require("fs"));
24
+ const Path = __importStar(require("path"));
25
25
  const CSpellSettingsServer_1 = require("./CSpellSettingsServer");
26
26
  const GlobalSettings_1 = require("./GlobalSettings");
27
27
  function listGlobalImports() {
@@ -35,3 +35,4 @@ export declare class UnsupportedPnpFile extends Error {
35
35
  constructor(msg: string);
36
36
  }
37
37
  export declare function clearPnPGlobalCache(): Promise<undefined>;
38
+ //# sourceMappingURL=pnpLoader.d.ts.map
@@ -1,6 +1,7 @@
1
- import { CSpellUserSettings, DictionaryDefinition, DictionaryReference } from '@cspell/cspell-types';
1
+ import type { CSpellUserSettings, DictionaryDefinition, DictionaryReference } from '@cspell/cspell-types';
2
2
  import { SpellingDictionaryCollection } from './index';
3
3
  import { SpellingDictionary } from './SpellingDictionary';
4
4
  export declare function loadDictionaries(dictIds: DictionaryReference[], defs: DictionaryDefinition[]): Promise<SpellingDictionary>[];
5
5
  export declare function refreshDictionaryCache(maxAge?: number): Promise<void>;
6
6
  export declare function getDictionary(settings: CSpellUserSettings): Promise<SpellingDictionaryCollection>;
7
+ //# sourceMappingURL=Dictionaries.d.ts.map
@@ -1,5 +1,5 @@
1
+ import type { DictionaryDefinitionPreferred } from '@cspell/cspell-types';
1
2
  import { SpellingDictionary } from './SpellingDictionary';
2
- import { DictionaryDefinitionPreferred } from '@cspell/cspell-types';
3
3
  export declare type LoadOptions = DictionaryDefinitionPreferred;
4
4
  interface CacheEntry {
5
5
  uri: string;
@@ -64,3 +64,4 @@ interface StatsBase<T> {
64
64
  }
65
65
  export declare type Stats = StatsBase<number>;
66
66
  export {};
67
+ //# sourceMappingURL=DictionaryLoader.d.ts.map
@@ -20,12 +20,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.testing = exports.refreshCacheEntries = exports.loadDictionary = void 0;
23
- const SpellingDictionaryFromTrie_1 = require("./SpellingDictionaryFromTrie");
24
- const createSpellingDictionary_1 = require("./createSpellingDictionary");
23
+ const fs_extra_1 = require("fs-extra");
25
24
  const path = __importStar(require("path"));
26
25
  const fileReader_1 = require("../util/fileReader");
27
- const fs_extra_1 = require("fs-extra");
26
+ const createSpellingDictionary_1 = require("./createSpellingDictionary");
28
27
  const SpellingDictionaryError_1 = require("./SpellingDictionaryError");
28
+ const SpellingDictionaryFromTrie_1 = require("./SpellingDictionaryFromTrie");
29
29
  const MAX_AGE = 10000;
30
30
  const loaders = {
31
31
  S: loadSimpleWordList,
@@ -0,0 +1 @@
1
+ //# sourceMappingURL=DictionaryLoaderTypes.d.ts.map
@@ -1,5 +1,5 @@
1
- import { SuggestionCollector, SuggestionResult, CompoundWordsMethod } from 'cspell-trie-lib';
2
- import { ReplaceMap } from '@cspell/cspell-types';
1
+ import type { ReplaceMap } from '@cspell/cspell-types';
2
+ import { CompoundWordsMethod, SuggestionCollector, SuggestionResult } from 'cspell-trie-lib';
3
3
  export { CompoundWordsMethod, SuggestionCollector, SuggestionResult } from 'cspell-trie-lib';
4
4
  export interface SearchOptions {
5
5
  useCompounds?: boolean | number;
@@ -70,3 +70,4 @@ export interface SpellingDictionary {
70
70
  readonly isDictionaryCaseSensitive: boolean;
71
71
  getErrors?(): Error[];
72
72
  }
73
+ //# sourceMappingURL=SpellingDictionary.d.ts.map
@@ -32,3 +32,4 @@ export declare const __testing__: {
32
32
  isWordForbiddenInAnyDictionary: typeof isWordForbiddenInAnyDictionary;
33
33
  };
34
34
  export {};
35
+ //# sourceMappingURL=SpellingDictionaryCollection.d.ts.map
@@ -7,3 +7,4 @@ export declare class SpellingDictionaryLoadError extends Error {
7
7
  constructor(uri: string, options: LoadOptions, cause: Error, message: string);
8
8
  }
9
9
  export declare function isSpellingDictionaryLoadError(e: Error): e is SpellingDictionaryLoadError;
10
+ //# sourceMappingURL=SpellingDictionaryError.d.ts.map
@@ -29,3 +29,4 @@ export declare class SpellingDictionaryFromTrie implements SpellingDictionary {
29
29
  getErrors(): Error[];
30
30
  }
31
31
  export declare function createSpellingDictionaryTrie(data: Iterable<string>, name: string, source: string, options: SpellingDictionaryOptions): Promise<SpellingDictionary>;
32
+ //# sourceMappingURL=SpellingDictionaryFromTrie.d.ts.map
@@ -24,3 +24,4 @@ export declare const __testMethods: {
24
24
  wordDictionaryForms: typeof wordDictionaryForms;
25
25
  wordDictionaryFormsCollector: typeof wordDictionaryFormsCollector;
26
26
  };
27
+ //# sourceMappingURL=SpellingDictionaryMethods.d.ts.map
@@ -7,3 +7,4 @@ export declare class SuggestionCollector {
7
7
  get collection(): SuggestionResult[];
8
8
  get sortedCollection(): SuggestionResult[];
9
9
  }
10
+ //# sourceMappingURL=SuggestionCollector.d.ts.map
@@ -3,3 +3,4 @@ export interface SuggestionResult {
3
3
  word: string;
4
4
  score: number;
5
5
  }
6
+ //# sourceMappingURL=entities.d.ts.map
@@ -18,3 +18,4 @@ export declare class FeatureMap extends Map<string, number> {
18
18
  correlationScore(m: FeatureMap): number;
19
19
  intersectionScore(m: FeatureMap): number;
20
20
  }
21
+ //# sourceMappingURL=helpers.d.ts.map
@@ -3,3 +3,4 @@ import { SuggestionResult } from './entities';
3
3
  export declare type SuggestionIterator = Generator<SuggestionResult, void, number | undefined>;
4
4
  export declare function suggest(trie: Trie, word: string, minScore?: number): SuggestionIterator;
5
5
  export declare function suggestIteration(i: WalkerIterator, word: string, minScore?: number): SuggestionIterator;
6
+ //# sourceMappingURL=suggest.d.ts.map
@@ -4,3 +4,4 @@ import { SpellingDictionaryLoadError } from './SpellingDictionaryError';
4
4
  export declare function createSpellingDictionary(wordList: string[] | IterableLike<string>, name: string, source: string, options: SpellingDictionaryOptions | undefined): SpellingDictionary;
5
5
  export declare function createForbiddenWordsDictionary(wordList: string[], name: string, source: string, options: SpellingDictionaryOptions | undefined): SpellingDictionary;
6
6
  export declare function createFailedToLoadDictionary(error: SpellingDictionaryLoadError): SpellingDictionary;
7
+ //# sourceMappingURL=createSpellingDictionary.d.ts.map
@@ -3,3 +3,4 @@ export * from './SpellingDictionaryCollection';
3
3
  export * from './Dictionaries';
4
4
  export * from './createSpellingDictionary';
5
5
  export * from './SpellingDictionaryError';
6
+ //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- import { Glob } from '@cspell/cspell-types';
1
+ import type { Glob } from '@cspell/cspell-types';
2
2
  export declare type ExclusionFunction = (fileUri: string) => boolean;
3
3
  export declare type FileExclusionFunction = (file: string) => boolean;
4
4
  /** The structure of the VS Code search.exclude settings */
@@ -20,3 +20,4 @@ export declare function generateExclusionFunctionForUri(globs: Glob[], root: str
20
20
  * @param allowedSchemes - allowed schemas
21
21
  */
22
22
  export declare function generateExclusionFunctionForFiles(globs: Glob[], root: string): FileExclusionFunction;
23
+ //# sourceMappingURL=exclusionHelper.d.ts.map
package/dist/index.d.ts CHANGED
@@ -13,8 +13,8 @@ export { CompoundWordsMethod, createSpellingDictionary, getDictionary, isSpellin
13
13
  export * from './trace';
14
14
  export { getLogger, Logger, setLogger } from './util/logger';
15
15
  export { resolveFile } from './util/resolveFile';
16
- export { TextDocumentOffset, TextOffset } from './util/text';
17
16
  export { checkText, CheckTextInfo, IncludeExcludeFlag, IncludeExcludeOptions, TextInfoItem, validateText, ValidationIssue, } from './validator';
18
17
  export { Text, Link };
19
18
  export { ExclusionHelper };
20
19
  export declare function clearCachedFiles(): Promise<void>;
20
+ //# sourceMappingURL=index.d.ts.map
@@ -1,5 +1,5 @@
1
1
  /// <reference types="node" />
2
- import { CSpellSettingsWithSourceTrace, CSpellUserSettings } from '@cspell/cspell-types';
2
+ import type { CSpellSettingsWithSourceTrace, CSpellUserSettings } from '@cspell/cspell-types';
3
3
  import { URI } from 'vscode-uri';
4
4
  import { ValidateTextOptions, ValidationIssue } from './validator';
5
5
  export interface SpellCheckFileOptions extends ValidateTextOptions {
@@ -78,3 +78,4 @@ export declare function isBinaryFile(filename: URI, languageId?: string | string
78
78
  export declare function fileToDocument(file: string): Document;
79
79
  export declare function fileToDocument(file: string, text: string, languageId?: string, locale?: string): DocumentWithText;
80
80
  export declare function fileToDocument(file: string, text?: string, languageId?: string, locale?: string): Document | DocumentWithText;
81
+ //# sourceMappingURL=spellCheckFile.d.ts.map
@@ -20,15 +20,16 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports.fileToDocument = exports.isBinaryFile = exports.isBinaryDoc = exports.determineFinalDocumentSettings = exports.spellCheckDocument = exports.spellCheckFile = void 0;
23
+ const cspell_glob_1 = require("cspell-glob");
23
24
  const fs_extra_1 = require("fs-extra");
25
+ const path = __importStar(require("path"));
24
26
  const vscode_uri_1 = require("vscode-uri");
25
27
  const LanguageIds_1 = require("./LanguageIds");
26
28
  const Settings_1 = require("./Settings");
27
- const validator_1 = require("./validator");
28
- const path = __importStar(require("path"));
29
29
  const TextDocumentSettings_1 = require("./Settings/TextDocumentSettings");
30
- const cspell_glob_1 = require("cspell-glob");
30
+ const errors_1 = require("./util/errors");
31
31
  const Memorizer_1 = require("./util/Memorizer");
32
+ const validator_1 = require("./validator");
32
33
  const getLanguagesForExt = (0, Memorizer_1.memorizer)(LanguageIds_1.getLanguagesForExt);
33
34
  const defaultEncoding = 'utf8';
34
35
  /**
@@ -66,6 +67,7 @@ async function spellCheckDocument(document, options, settings) {
66
67
  return spellCheckFullDocument(await resolveDocument(document), options, settings);
67
68
  }
68
69
  catch (e) {
70
+ const errors = (0, errors_1.isError)(e) ? [e] : [];
69
71
  return {
70
72
  document,
71
73
  options,
@@ -73,7 +75,7 @@ async function spellCheckDocument(document, options, settings) {
73
75
  localConfigFilepath: undefined,
74
76
  issues: [],
75
77
  checked: false,
76
- errors: [e],
78
+ errors,
77
79
  };
78
80
  }
79
81
  }
@@ -1,8 +1,7 @@
1
- import * as Text from './util/text';
2
- import { TextOffset } from './util/text';
3
- import * as TextRange from './util/TextRange';
4
- import { SpellingDictionary } from './SpellingDictionary/SpellingDictionary';
1
+ import type { TextOffset } from '@cspell/cspell-types';
5
2
  import { Sequence } from 'gensequence';
3
+ import { SpellingDictionary } from './SpellingDictionary/SpellingDictionary';
4
+ import * as TextRange from './util/TextRange';
6
5
  export interface ValidationOptions extends IncludeExcludeOptions {
7
6
  maxNumberOfProblems?: number;
8
7
  maxDuplicateProblems?: number;
@@ -21,7 +20,7 @@ export interface IncludeExcludeOptions {
21
20
  includeRegExpList?: (RegExp | string)[];
22
21
  }
23
22
  export interface WordRangeAcc {
24
- textOffset: Text.TextOffset;
23
+ textOffset: TextOffset;
25
24
  isIncluded: boolean;
26
25
  rangePos: number;
27
26
  }
@@ -36,7 +35,7 @@ export declare const defaultMinWordLength = 4;
36
35
  export declare const minWordSplitLen = 3;
37
36
  export declare function validateText(text: string, dict: SpellingDictionary, options: ValidationOptions): Sequence<ValidationResult>;
38
37
  export declare function calcTextInclusionRanges(text: string, options: IncludeExcludeOptions): TextRange.MatchRange[];
39
- export declare function isWordValid(dict: SpellingDictionary, wo: Text.TextOffset, line: TextOffset, options: HasWordOptions): boolean;
38
+ export declare function isWordValid(dict: SpellingDictionary, wo: TextOffset, line: TextOffset, options: HasWordOptions): boolean;
40
39
  export interface HasWordOptions {
41
40
  ignoreCase: boolean;
42
41
  useCompounds: boolean | undefined;
@@ -51,3 +50,4 @@ export declare const _testMethods: {
51
50
  mapWordsAgainstRanges: typeof mapTextOffsetsAgainstRanges;
52
51
  };
53
52
  export {};
53
+ //# sourceMappingURL=textValidator.d.ts.map
@@ -20,9 +20,9 @@ var __importStar = (this && this.__importStar) || function (mod) {
20
20
  };
21
21
  Object.defineProperty(exports, "__esModule", { value: true });
22
22
  exports._testMethods = exports.hasWordCheck = exports.isWordValid = exports.calcTextInclusionRanges = exports.validateText = exports.minWordSplitLen = exports.defaultMinWordLength = exports.defaultMaxDuplicateProblems = exports.defaultMaxNumberOfProblems = void 0;
23
+ const RxPat = __importStar(require("./Settings/RegExpPatterns"));
23
24
  const Text = __importStar(require("./util/text"));
24
25
  const TextRange = __importStar(require("./util/TextRange"));
25
- const RxPat = __importStar(require("./Settings/RegExpPatterns"));
26
26
  const wordSplitter_1 = require("./util/wordSplitter");
27
27
  exports.defaultMaxNumberOfProblems = 200;
28
28
  exports.defaultMaxDuplicateProblems = 5;
package/dist/trace.d.ts CHANGED
@@ -1,4 +1,4 @@
1
- import { CSpellSettings, LocaleId } from '@cspell/cspell-types';
1
+ import type { CSpellSettings, LocaleId } from '@cspell/cspell-types';
2
2
  import { LanguageId } from './LanguageIds';
3
3
  export interface TraceResult {
4
4
  word: string;
@@ -18,3 +18,4 @@ export interface TraceOptions {
18
18
  ignoreCase?: boolean;
19
19
  }
20
20
  export declare function traceWords(words: string[], settings: CSpellSettings, options: TraceOptions | undefined): Promise<TraceResult[]>;
21
+ //# sourceMappingURL=trace.d.ts.map
@@ -17,3 +17,4 @@ export declare function compareByRev<T>(extract1: CompareArg<T>, extract2: Compa
17
17
  export declare function compareEach<T>(...compareFn: CompareFn<T>[]): CompareFn<T>;
18
18
  export declare function compare<T>(a: ComparableFilter<T>, b: ComparableFilter<T>): number;
19
19
  export declare function reverse<T>(fn: CompareFn<T>): CompareFn<T>;
20
+ //# sourceMappingURL=Comparable.d.ts.map
@@ -13,3 +13,4 @@ export declare class FreqCounter<T> {
13
13
  merge(...freqCounters: FreqCounter<T>[]): FreqCounter<T>;
14
14
  static create<T>(values?: IterableLike<T>): FreqCounter<T>;
15
15
  }
16
+ //# sourceMappingURL=FreqCounter.d.ts.map
@@ -1,3 +1,4 @@
1
1
  export interface IterableLike<T> {
2
2
  [Symbol.iterator]: () => Iterator<T> | IterableIterator<T>;
3
3
  }
4
+ //# sourceMappingURL=IterableLike.d.ts.map
@@ -36,3 +36,4 @@ export declare function memorizer<F extends (...args: Primitive[]) => any, Args
36
36
  */
37
37
  export declare function memorizerKeyBy<F extends (...args: any[]) => any, Args extends Parameters<F> = Parameters<F>, R extends ReturnType<F> = ReturnType<F>>(fn: F, keyFn: (...args: Args) => string, size?: number): (...args: Args) => R;
38
38
  export {};
39
+ //# sourceMappingURL=Memorizer.d.ts.map
@@ -20,3 +20,4 @@ export declare const __testing__: {
20
20
  takeFromHeap: typeof takeFromHeap;
21
21
  };
22
22
  export {};
23
+ //# sourceMappingURL=MinHeapQueue.d.ts.map
@@ -29,3 +29,4 @@ export declare const heapMethods: {
29
29
  mergeSiblings: typeof mergeSiblings;
30
30
  };
31
31
  export {};
32
+ //# sourceMappingURL=PairingHeap.d.ts.map
@@ -16,3 +16,4 @@ export declare function findMatchingRangesForPatterns(patterns: (string | RegExp
16
16
  */
17
17
  export declare function excludeRanges(includeRanges: MatchRange[], excludeRanges: MatchRange[]): MatchRange[];
18
18
  export declare function extractRangeText(text: string, ranges: MatchRange[]): MatchRangeWithText[];
19
+ //# sourceMappingURL=TextRange.d.ts.map
@@ -0,0 +1,9 @@
1
+ /// <reference types="node" />
2
+ declare function getTypeOf(t: unknown): "string" | "number" | "bigint" | "boolean" | "symbol" | "undefined" | "object" | "function";
3
+ export declare function isErrnoException(e: unknown): e is NodeJS.ErrnoException;
4
+ export declare function isError(e: unknown): e is Error;
5
+ export declare const __testing__: {
6
+ getTypeOf: typeof getTypeOf;
7
+ };
8
+ export {};
9
+ //# sourceMappingURL=errors.d.ts.map
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.__testing__ = exports.isError = exports.isErrnoException = void 0;
4
+ // eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
5
+ function getTypeOf(t) {
6
+ return typeof t;
7
+ }
8
+ const allowStringOrUndefined = {
9
+ string: true,
10
+ undefined: true,
11
+ };
12
+ const allowNumberOrUndefined = {
13
+ number: true,
14
+ undefined: true,
15
+ };
16
+ function isErrnoException(e) {
17
+ if (!e || typeof e !== 'object')
18
+ return false;
19
+ if (!isError(e))
20
+ return false;
21
+ const ex = e;
22
+ return (typeof ex.errno in allowNumberOrUndefined &&
23
+ typeof ex.code in allowStringOrUndefined &&
24
+ typeof ex.path in allowStringOrUndefined);
25
+ }
26
+ exports.isErrnoException = isErrnoException;
27
+ function isError(e) {
28
+ if (e instanceof Error)
29
+ return true;
30
+ if (!e || typeof e !== 'object')
31
+ return false;
32
+ const ex = e;
33
+ return typeof ex.name == 'string' && typeof ex.message == 'string' && typeof ex.stack in allowStringOrUndefined;
34
+ }
35
+ exports.isError = isError;
36
+ exports.__testing__ = {
37
+ getTypeOf,
38
+ };
39
+ //# sourceMappingURL=errors.js.map
@@ -1,2 +1,3 @@
1
1
  /// <reference types="node" />
2
2
  export declare function readLines(filename: string, encoding?: BufferEncoding): Promise<IterableIterator<string>>;
3
+ //# sourceMappingURL=fileReader.d.ts.map
@@ -1,3 +1,4 @@
1
1
  import { IterableLike } from './IterableLike';
2
2
  export declare function toIterableIterator<T>(i: IterableLike<T>): IterableIterator<T>;
3
3
  export declare function concatIterables<T>(...iterables: IterableLike<T>[]): IterableIterator<T>;
4
+ //# sourceMappingURL=iterableIteratorLib.d.ts.map
@@ -29,3 +29,4 @@ export declare function setLogger(logger: Logger): Logger;
29
29
  */
30
30
  export declare function getLogger(): Logger;
31
31
  export {};
32
+ //# sourceMappingURL=logger.d.ts.map
@@ -4,3 +4,4 @@
4
4
  * @returns - the escaped string.
5
5
  */
6
6
  export declare function escapeRegEx(s: string): string;
7
+ //# sourceMappingURL=regexHelper.d.ts.map
@@ -1,3 +1,4 @@
1
- import { ReplaceMap } from '@cspell/cspell-types';
1
+ import type { ReplaceMap } from '@cspell/cspell-types';
2
2
  export declare type ReplaceMapper = (src: string) => string;
3
3
  export declare function createMapper(repMap: ReplaceMap): ReplaceMapper;
4
+ //# sourceMappingURL=repMap.d.ts.map
@@ -10,3 +10,4 @@ export interface ResolveFileResult {
10
10
  * @param relativeTo absolute path
11
11
  */
12
12
  export declare function resolveFile(filename: string, relativeTo: string): ResolveFileResult;
13
+ //# sourceMappingURL=resolveFile.d.ts.map
@@ -3,3 +3,4 @@
3
3
  * The value returned is either the position of the item or where it should be inserted.
4
4
  */
5
5
  export declare function binarySearch<T>(arr: Array<T>, item: T, leftOffset?: number, rightOffset?: number): number;
6
+ //# sourceMappingURL=search.d.ts.map
@@ -1,15 +1,5 @@
1
+ import type { TextDocumentOffset, TextOffset } from '@cspell/cspell-types';
1
2
  import { Sequence } from 'gensequence';
2
- export interface TextOffset {
3
- text: string;
4
- offset: number;
5
- }
6
- export interface TextDocumentOffset extends TextOffset {
7
- uri?: string;
8
- doc: string;
9
- row: number;
10
- col: number;
11
- line: TextOffset;
12
- }
13
3
  export declare function splitCamelCaseWordWithOffset(wo: TextOffset): Array<TextOffset>;
14
4
  /**
15
5
  * Split camelCase words into an array of strings.
@@ -56,3 +46,4 @@ export declare const __testing__: {
56
46
  regExWords: RegExp;
57
47
  regExWordsAndDigits: RegExp;
58
48
  };
49
+ //# sourceMappingURL=text.d.ts.map
package/dist/util/text.js CHANGED
@@ -5,6 +5,7 @@ const gensequence_1 = require("gensequence");
5
5
  const search_1 = require("./search");
6
6
  const textRegex_1 = require("./textRegex");
7
7
  const util_1 = require("./util");
8
+ // CSpell:ignore ings ning gimuy tsmerge
8
9
  function splitCamelCaseWordWithOffset(wo) {
9
10
  return splitCamelCaseWord(wo.text).map((0, util_1.scanMap)((last, text) => ({ text, offset: last.offset + last.text.length }), {
10
11
  text: '',
@@ -16,3 +16,4 @@ export declare const regExEscapeCharacters: RegExp;
16
16
  export declare const regExDanglingQuote: RegExp;
17
17
  /** Match tailing endings after CAPS words */
18
18
  export declare const regExTrailingEndings: RegExp;
19
+ //# sourceMappingURL=textRegex.d.ts.map
@@ -1 +1,2 @@
1
1
  export declare type FunctionArgs<T> = T extends (...args: infer U) => any ? U : any;
2
+ //# sourceMappingURL=types.d.ts.map
@@ -13,3 +13,4 @@ export declare function clean<T>(src: T): T;
13
13
  export declare function scanMap<T>(accFn: (acc: T, value: T) => T, init?: T): (value: T) => T;
14
14
  export declare function scanMap<T, U>(accFn: (acc: U, value: T) => U, init: U): (value: T) => U;
15
15
  export declare function isDefined<T>(v: T | undefined): v is T;
16
+ //# sourceMappingURL=util.d.ts.map
@@ -1,4 +1,4 @@
1
- import { TextOffset } from './text';
1
+ import type { TextOffset } from '@cspell/cspell-types';
2
2
  export declare type IsValidWordFn = (word: TextOffset) => boolean;
3
3
  export interface SplitResult {
4
4
  /** Original line passed to the split function */
@@ -43,3 +43,4 @@ export declare const __testing__: {
43
43
  generateWordBreaks: typeof generateWordBreaks;
44
44
  };
45
45
  export {};
46
+ //# sourceMappingURL=wordSplitter.d.ts.map
@@ -1,4 +1,4 @@
1
- import { CSpellUserSettings } from '@cspell/cspell-types';
1
+ import type { CSpellUserSettings } from '@cspell/cspell-types';
2
2
  import * as TV from './textValidator';
3
3
  export declare const diagSource = "cSpell Checker";
4
4
  export { IncludeExcludeOptions } from './textValidator';
@@ -29,3 +29,4 @@ export declare enum IncludeExcludeFlag {
29
29
  EXCLUDE = "E"
30
30
  }
31
31
  export declare function checkText(text: string, settings: CSpellUserSettings): Promise<CheckTextInfo>;
32
+ //# sourceMappingURL=validator.d.ts.map
@@ -11,3 +11,4 @@ export declare function splitLine(line: string): string[];
11
11
  export declare function splitCodeWords(words: string[]): string[];
12
12
  export declare function splitLineIntoCodeWords(line: string): IterableIterator<string>;
13
13
  export declare function splitLineIntoWords(line: string): IterableIterator<string>;
14
+ //# sourceMappingURL=wordListHelper.d.ts.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell-lib",
3
- "version": "5.9.1-alpha.1",
3
+ "version": "5.10.0-alpha.4",
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",
@@ -13,8 +13,9 @@
13
13
  "!**/*.map"
14
14
  ],
15
15
  "scripts": {
16
- "clean": "rimraf dist temp coverage",
16
+ "clean": "rimraf dist temp coverage .tsbuildinfo",
17
17
  "build": "npm run compile",
18
+ "build-dev": "tsc -p tsconfig.dev.json",
18
19
  "clean-build": "npm run clean && npm run build",
19
20
  "compile": "tsc -p .",
20
21
  "watch": "tsc --watch -p .",
@@ -46,15 +47,15 @@
46
47
  },
47
48
  "homepage": "https://github.com/streetsidesoftware/cspell#readme",
48
49
  "dependencies": {
49
- "@cspell/cspell-bundled-dicts": "^5.9.1-alpha.1",
50
- "@cspell/cspell-types": "^5.9.1-alpha.1",
50
+ "@cspell/cspell-bundled-dicts": "^5.10.0-alpha.4",
51
+ "@cspell/cspell-types": "^5.10.0-alpha.3",
51
52
  "clear-module": "^4.1.1",
52
53
  "comment-json": "^4.1.1",
53
54
  "configstore": "^5.0.1",
54
55
  "cosmiconfig": "^7.0.1",
55
- "cspell-glob": "^5.9.1-alpha.1",
56
- "cspell-io": "^5.9.1-alpha.1",
57
- "cspell-trie-lib": "^5.9.1-alpha.1",
56
+ "cspell-glob": "^5.10.0-alpha.3",
57
+ "cspell-io": "^5.10.0-alpha.3",
58
+ "cspell-trie-lib": "^5.10.0-alpha.4",
58
59
  "find-up": "^5.0.0",
59
60
  "fs-extra": "^10.0.0",
60
61
  "gensequence": "^3.1.1",
@@ -73,17 +74,17 @@
73
74
  "@cspell/dict-fa-ir": "^1.0.17",
74
75
  "@cspell/dict-fr-fr": "^1.2.21",
75
76
  "@cspell/dict-html": "^1.1.9",
76
- "@cspell/dict-nl-nl": "^2.0.0",
77
+ "@cspell/dict-nl-nl": "^2.0.1",
77
78
  "@cspell/dict-python": "^1.0.37",
78
79
  "@types/configstore": "^5.0.1",
79
80
  "@types/fs-extra": "^9.0.12",
80
81
  "@types/jest": "^27.0.1",
81
82
  "@types/node": "^16.9.1",
82
83
  "cspell-dict-nl-nl": "^1.1.2",
83
- "jest": "^27.1.1",
84
+ "jest": "^27.2.0",
84
85
  "lorem-ipsum": "^2.0.3",
85
86
  "rimraf": "^3.0.2",
86
87
  "ts-jest": "^27.0.5"
87
88
  },
88
- "gitHead": "e79d890b347f53e49a05d683ec83c23db4c59b00"
89
+ "gitHead": "8ab784ca30990a2abf1ebfc76ede3436205d2c79"
89
90
  }