cspell 7.3.9 → 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.
Files changed (37) hide show
  1. package/dist/esm/application.js +3 -3
  2. package/dist/esm/application.mjs +3 -3
  3. package/dist/esm/cli-reporter.d.mts +2 -2
  4. package/dist/esm/cli-reporter.d.ts +2 -2
  5. package/dist/esm/cli-reporter.js +9 -3
  6. package/dist/esm/cli-reporter.mjs +9 -3
  7. package/dist/esm/commandLink.js +6 -6
  8. package/dist/esm/commandLink.mjs +6 -6
  9. package/dist/esm/commandLint.js +21 -15
  10. package/dist/esm/commandLint.mjs +21 -15
  11. package/dist/esm/lint/LintRequest.js +13 -2
  12. package/dist/esm/lint/LintRequest.mjs +13 -2
  13. package/dist/esm/lint/lint.js +33 -16
  14. package/dist/esm/lint/lint.mjs +33 -16
  15. package/dist/esm/options.d.mts +8 -0
  16. package/dist/esm/options.d.ts +8 -0
  17. package/dist/esm/repl/index.js +5 -0
  18. package/dist/esm/repl/index.mjs +5 -0
  19. package/dist/esm/util/InMemoryReporter.js +36 -37
  20. package/dist/esm/util/InMemoryReporter.mjs +36 -37
  21. package/dist/esm/util/cache/DiskCache.js +11 -4
  22. package/dist/esm/util/cache/DiskCache.mjs +11 -4
  23. package/dist/esm/util/cache/ObjectCollection.js +2 -6
  24. package/dist/esm/util/cache/ObjectCollection.mjs +2 -6
  25. package/dist/esm/util/constants.d.mts +4 -5
  26. package/dist/esm/util/constants.d.ts +4 -5
  27. package/dist/esm/util/errors.js +4 -0
  28. package/dist/esm/util/errors.mjs +4 -0
  29. package/dist/esm/util/fileHelper.d.mts +4 -2
  30. package/dist/esm/util/fileHelper.d.ts +4 -2
  31. package/dist/esm/util/fileHelper.js +0 -21
  32. package/dist/esm/util/fileHelper.mjs +0 -21
  33. package/dist/esm/util/timer.d.mts +2 -6
  34. package/dist/esm/util/timer.d.ts +2 -6
  35. package/dist/esm/util/timer.js +5 -7
  36. package/dist/esm/util/timer.mjs +5 -7
  37. package/package.json +14 -14
@@ -4,7 +4,7 @@ import { MessageTypes } from '@cspell/cspell-types';
4
4
  import chalk from 'chalk';
5
5
  import { findRepoRoot, GitIgnore } from 'cspell-gitignore';
6
6
  import { GlobMatcher } from 'cspell-glob';
7
- import * as cspell from 'cspell-lib';
7
+ import { ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, getDictionary, isBinaryFile as cspellIsBinaryFile, setLogger, shouldCheckDocument, spellCheckDocument, Text as cspellText, } from 'cspell-lib';
8
8
  import * as path from 'path';
9
9
  import { format } from 'util';
10
10
  import { URI } from 'vscode-uri';
@@ -23,7 +23,7 @@ const BATCH_SIZE = 8;
23
23
  const { opFilterAsync } = operators;
24
24
  export async function runLint(cfg) {
25
25
  let { reporter } = cfg;
26
- cspell.setLogger(getLoggerFromReporter(reporter));
26
+ setLogger(getLoggerFromReporter(reporter));
27
27
  const configErrors = new Set();
28
28
  const timer = getTimeMeasurer();
29
29
  const lintResult = await run();
@@ -45,7 +45,7 @@ export async function runLint(cfg) {
45
45
  return { fileResult };
46
46
  }
47
47
  const uri = filenameToUri(filename, cfg.root);
48
- const checkResult = await cspell.shouldCheckDocument({ uri }, {}, configInfo.config);
48
+ const checkResult = await shouldCheckDocument({ uri }, {}, configInfo.config);
49
49
  if (!checkResult.shouldCheck)
50
50
  return { skip: true };
51
51
  const fileInfo = await readFileInfo(filename, undefined, true);
@@ -88,13 +88,20 @@ export async function runLint(cfg) {
88
88
  let spellResult = {};
89
89
  reporter.info(`Checking: ${filename}, File type: ${doc.languageId ?? 'auto'}, Language: ${doc.locale ?? 'default'}`, MessageTypes.Info);
90
90
  try {
91
- const { showSuggestions: generateSuggestions, validateDirectives } = cfg.options;
91
+ const { showSuggestions: generateSuggestions, validateDirectives, skipValidation } = cfg.options;
92
92
  const numSuggestions = configInfo.config.numSuggestions ?? 5;
93
- const validateOptions = util.clean({ generateSuggestions, numSuggestions, validateDirectives });
94
- const r = await cspell.spellCheckDocument(doc, validateOptions, configInfo.config);
93
+ const validateOptions = util.clean({
94
+ generateSuggestions,
95
+ numSuggestions,
96
+ validateDirectives,
97
+ skipValidation,
98
+ });
99
+ const r = await spellCheckDocument(doc, validateOptions, configInfo.config);
100
+ // console.warn('filename: %o %o', path.relative(process.cwd(), filename), r.perf);
95
101
  spellResult = r;
96
102
  result.processed = r.checked;
97
- result.issues = cspell.Text.calculateTextDocumentOffsets(doc.uri, text, r.issues).map(mapIssue);
103
+ result.perf = r.perf ? { ...r.perf } : undefined;
104
+ result.issues = cspellText.calculateTextDocumentOffsets(doc.uri, text, r.issues).map(mapIssue);
98
105
  }
99
106
  catch (e) {
100
107
  reporter.error(`Failed to process "${filename}"`, toError(e));
@@ -103,9 +110,9 @@ export async function runLint(cfg) {
103
110
  result.elapsedTimeMs = getElapsedTimeMs();
104
111
  const config = spellResult.settingsUsed ?? {};
105
112
  result.configErrors += await reportConfigurationErrors(config);
106
- const elapsed = result.elapsedTimeMs / 1000.0;
113
+ const elapsed = result.elapsedTimeMs;
107
114
  const dictionaries = config.dictionaries || [];
108
- reporter.info(`Checked: ${filename}, File type: ${config.languageId}, Language: ${config.language} ... Issues: ${result.issues.length} ${elapsed}S`, MessageTypes.Info);
115
+ reporter.info(`Checked: ${filename}, File type: ${config.languageId}, Language: ${config.language} ... Issues: ${result.issues.length} ${elapsed.toFixed(2)}ms`, MessageTypes.Info);
109
116
  reporter.info(`Config file Used: ${spellResult.localConfigFilepath || configInfo.source}`, MessageTypes.Info);
110
117
  reporter.info(`Dictionaries Used: ${dictionaries.join(', ')}`, MessageTypes.Info);
111
118
  if (cfg.options.debug) {
@@ -193,8 +200,18 @@ export async function runLint(cfg) {
193
200
  else {
194
201
  for (const pf of prefetchFiles(files)) {
195
202
  await pf.result;
196
- yield await processPrefetchFileResult(pf, ++i);
203
+ yield processPrefetchFileResult(pf, ++i);
197
204
  }
205
+ // const iter = prefetchIterable(
206
+ // pipe(
207
+ // prefetchFiles(files),
208
+ // opMap(async (pf) => {
209
+ // return processPrefetchFileResult(pf, ++i);
210
+ // }),
211
+ // ),
212
+ // BATCH_SIZE,
213
+ // );
214
+ // yield* iter;
198
215
  }
199
216
  }
200
217
  for await (const fileP of loadAndProcessFiles()) {
@@ -218,11 +235,11 @@ export async function runLint(cfg) {
218
235
  return status;
219
236
  }
220
237
  function calcDependencies(config) {
221
- const { configFiles, dictionaryFiles } = cspell.extractDependencies(config);
238
+ const { configFiles, dictionaryFiles } = extractDependencies(config);
222
239
  return { files: configFiles.concat(dictionaryFiles) };
223
240
  }
224
241
  async function reportConfigurationErrors(config) {
225
- const errors = cspell.extractImportErrors(config);
242
+ const errors = extractImportErrors(config);
226
243
  let count = 0;
227
244
  errors.forEach((ref) => {
228
245
  const key = ref.error.toString();
@@ -232,7 +249,7 @@ export async function runLint(cfg) {
232
249
  count += 1;
233
250
  reporter.error('Configuration', ref.error);
234
251
  });
235
- const dictCollection = await cspell.getDictionary(config);
252
+ const dictCollection = await getDictionary(config);
236
253
  dictCollection.dictionaries.forEach((dict) => {
237
254
  const dictErrors = dict.getErrors?.() || [];
238
255
  const msg = `Dictionary Error with (${dict.name})`;
@@ -252,7 +269,7 @@ export async function runLint(cfg) {
252
269
  }
253
270
  async function run() {
254
271
  if (cfg.options.root) {
255
- process.env[cspell.ENV_CSPELL_GLOB_ROOT] = cfg.root;
272
+ process.env[ENV_CSPELL_GLOB_ROOT] = cfg.root;
256
273
  }
257
274
  const configInfo = await readConfig(cfg.configFile, cfg.root);
258
275
  if (cfg.options.defaultConfiguration !== undefined) {
@@ -266,7 +283,7 @@ export async function runLint(cfg) {
266
283
  });
267
284
  const reporters = cfg.options.reporter ?? configInfo.config.reporters;
268
285
  reporter = mergeReporters(...(await loadReporters(reporters, cfg.reporter, reporterConfig)));
269
- cspell.setLogger(getLoggerFromReporter(reporter));
286
+ setLogger(getLoggerFromReporter(reporter));
270
287
  const globInfo = await determineGlobs(configInfo, cfg);
271
288
  const { fileGlobs, excludeGlobs } = globInfo;
272
289
  const hasFileLists = !!cfg.fileLists.length;
@@ -361,7 +378,7 @@ async function determineFilesToCheck(configInfo, cfg, reporter, globInfo) {
361
378
  return files;
362
379
  }
363
380
  function isExcluded(filename, globMatcherExclude) {
364
- if (cspell.isBinaryFile(URI.file(filename))) {
381
+ if (cspellIsBinaryFile(URI.file(filename))) {
365
382
  return true;
366
383
  }
367
384
  const { root } = cfg;
@@ -67,6 +67,10 @@ export interface LinterOptions extends BaseOptions, Omit<CacheOptions, 'version'
67
67
  * configuration.
68
68
  */
69
69
  reporter?: string[];
70
+ /**
71
+ * Load and parse documents, but do not spell check.
72
+ */
73
+ skipValidation?: boolean;
70
74
  }
71
75
  export interface TraceOptions extends BaseOptions {
72
76
  stdin?: boolean;
@@ -178,6 +182,10 @@ export interface LinterCliOptions extends LinterOptions {
178
182
  * Files must be found or cli will exit with an error.
179
183
  */
180
184
  mustFindFiles?: boolean;
185
+ /**
186
+ * Generate a summary report of issues.
187
+ */
188
+ issuesSummaryReport?: boolean;
181
189
  }
182
190
  export declare function fixLegacy<T extends BaseOptions>(opts: T & LegacyOptions): Omit<T & LegacyOptions, 'local'>;
183
191
  //# sourceMappingURL=options.d.mts.map
@@ -67,6 +67,10 @@ export interface LinterOptions extends BaseOptions, Omit<CacheOptions, 'version'
67
67
  * configuration.
68
68
  */
69
69
  reporter?: string[];
70
+ /**
71
+ * Load and parse documents, but do not spell check.
72
+ */
73
+ skipValidation?: boolean;
70
74
  }
71
75
  export interface TraceOptions extends BaseOptions {
72
76
  stdin?: boolean;
@@ -178,6 +182,10 @@ export interface LinterCliOptions extends LinterOptions {
178
182
  * Files must be found or cli will exit with an error.
179
183
  */
180
184
  mustFindFiles?: boolean;
185
+ /**
186
+ * Generate a summary report of issues.
187
+ */
188
+ issuesSummaryReport?: boolean;
181
189
  }
182
190
  export declare function fixLegacy<T extends BaseOptions>(opts: T & LegacyOptions): Omit<T & LegacyOptions, 'local'>;
183
191
  //# sourceMappingURL=options.d.ts.map
@@ -3,6 +3,11 @@ export function simpleRepl() {
3
3
  return new SimpleRepl();
4
4
  }
5
5
  export class SimpleRepl {
6
+ prompt;
7
+ beforeEach;
8
+ completer;
9
+ _history;
10
+ rl;
6
11
  constructor(prompt = '> ') {
7
12
  this.prompt = prompt;
8
13
  this._history = [];
@@ -3,6 +3,11 @@ export function simpleRepl() {
3
3
  return new SimpleRepl();
4
4
  }
5
5
  export class SimpleRepl {
6
+ prompt;
7
+ beforeEach;
8
+ completer;
9
+ _history;
10
+ rl;
6
11
  constructor(prompt = '> ') {
7
12
  this.prompt = prompt;
8
13
  this._history = [];
@@ -2,42 +2,41 @@
2
2
  * Simple reporter for test purposes
3
3
  */
4
4
  export class InMemoryReporter {
5
- constructor() {
6
- this.log = [];
7
- this.errors = [];
8
- this.issueCount = 0;
9
- this.errorCount = 0;
10
- this.debugCount = 0;
11
- this.infoCount = 0;
12
- this.progressCount = 0;
13
- this.issues = [];
14
- this.issue = (issue) => {
15
- this.issues.push(issue);
16
- this.issueCount += 1;
17
- const { uri, row, col, text } = issue;
18
- this.log.push(`Issue: ${uri}[${row}, ${col}]: Unknown word: ${text}`);
19
- };
20
- this.error = (message, error) => {
21
- this.errorCount += 1;
22
- this.errors.push(error);
23
- this.log.push(`Error: ${message} ${error.toString()}`);
24
- };
25
- this.info = (message) => {
26
- this.infoCount += 1;
27
- this.log.push(`Info: ${message}`);
28
- };
29
- this.debug = (message) => {
30
- this.debugCount += 1;
31
- this.log.push(`Debug: ${message}`);
32
- };
33
- this.progress = (p) => {
34
- this.progressCount += 1;
35
- this.log.push(`Progress: ${p.type} ${p.fileNum} ${p.fileCount} ${p.filename}`);
36
- };
37
- this.result = (r) => {
38
- this.runResult = r;
39
- };
40
- this.dump = () => ({ log: this.log, issues: this.issues, runResult: this.runResult });
41
- }
5
+ log = [];
6
+ errors = [];
7
+ issueCount = 0;
8
+ errorCount = 0;
9
+ debugCount = 0;
10
+ infoCount = 0;
11
+ progressCount = 0;
12
+ issues = [];
13
+ runResult;
14
+ issue = (issue) => {
15
+ this.issues.push(issue);
16
+ this.issueCount += 1;
17
+ const { uri, row, col, text } = issue;
18
+ this.log.push(`Issue: ${uri}[${row}, ${col}]: Unknown word: ${text}`);
19
+ };
20
+ error = (message, error) => {
21
+ this.errorCount += 1;
22
+ this.errors.push(error);
23
+ this.log.push(`Error: ${message} ${error.toString()}`);
24
+ };
25
+ info = (message) => {
26
+ this.infoCount += 1;
27
+ this.log.push(`Info: ${message}`);
28
+ };
29
+ debug = (message) => {
30
+ this.debugCount += 1;
31
+ this.log.push(`Debug: ${message}`);
32
+ };
33
+ progress = (p) => {
34
+ this.progressCount += 1;
35
+ this.log.push(`Progress: ${p.type} ${p.fileNum} ${p.fileCount} ${p.filename}`);
36
+ };
37
+ result = (r) => {
38
+ this.runResult = r;
39
+ };
40
+ dump = () => ({ log: this.log, issues: this.issues, runResult: this.runResult });
42
41
  }
43
42
  //# sourceMappingURL=InMemoryReporter.js.map
@@ -2,42 +2,41 @@
2
2
  * Simple reporter for test purposes
3
3
  */
4
4
  export class InMemoryReporter {
5
- constructor() {
6
- this.log = [];
7
- this.errors = [];
8
- this.issueCount = 0;
9
- this.errorCount = 0;
10
- this.debugCount = 0;
11
- this.infoCount = 0;
12
- this.progressCount = 0;
13
- this.issues = [];
14
- this.issue = (issue) => {
15
- this.issues.push(issue);
16
- this.issueCount += 1;
17
- const { uri, row, col, text } = issue;
18
- this.log.push(`Issue: ${uri}[${row}, ${col}]: Unknown word: ${text}`);
19
- };
20
- this.error = (message, error) => {
21
- this.errorCount += 1;
22
- this.errors.push(error);
23
- this.log.push(`Error: ${message} ${error.toString()}`);
24
- };
25
- this.info = (message) => {
26
- this.infoCount += 1;
27
- this.log.push(`Info: ${message}`);
28
- };
29
- this.debug = (message) => {
30
- this.debugCount += 1;
31
- this.log.push(`Debug: ${message}`);
32
- };
33
- this.progress = (p) => {
34
- this.progressCount += 1;
35
- this.log.push(`Progress: ${p.type} ${p.fileNum} ${p.fileCount} ${p.filename}`);
36
- };
37
- this.result = (r) => {
38
- this.runResult = r;
39
- };
40
- this.dump = () => ({ log: this.log, issues: this.issues, runResult: this.runResult });
41
- }
5
+ log = [];
6
+ errors = [];
7
+ issueCount = 0;
8
+ errorCount = 0;
9
+ debugCount = 0;
10
+ infoCount = 0;
11
+ progressCount = 0;
12
+ issues = [];
13
+ runResult;
14
+ issue = (issue) => {
15
+ this.issues.push(issue);
16
+ this.issueCount += 1;
17
+ const { uri, row, col, text } = issue;
18
+ this.log.push(`Issue: ${uri}[${row}, ${col}]: Unknown word: ${text}`);
19
+ };
20
+ error = (message, error) => {
21
+ this.errorCount += 1;
22
+ this.errors.push(error);
23
+ this.log.push(`Error: ${message} ${error.toString()}`);
24
+ };
25
+ info = (message) => {
26
+ this.infoCount += 1;
27
+ this.log.push(`Info: ${message}`);
28
+ };
29
+ debug = (message) => {
30
+ this.debugCount += 1;
31
+ this.log.push(`Debug: ${message}`);
32
+ };
33
+ progress = (p) => {
34
+ this.progressCount += 1;
35
+ this.log.push(`Progress: ${p.type} ${p.fileNum} ${p.fileCount} ${p.filename}`);
36
+ };
37
+ result = (r) => {
38
+ this.runResult = r;
39
+ };
40
+ dump = () => ({ log: this.log, issues: this.issues, runResult: this.runResult });
42
41
  }
43
42
  //# sourceMappingURL=InMemoryReporter.mjs.map
@@ -20,14 +20,21 @@ const META_DATA_VERSION_SUFFIX = '-' + META_DATA_BASE_VERSION + '-' + Object.key
20
20
  * Caches cspell results on disk
21
21
  */
22
22
  export class DiskCache {
23
+ useCheckSum;
24
+ cspellVersion;
25
+ useUniversalCache;
26
+ cacheFileLocation;
27
+ cacheDir;
28
+ fileEntryCache;
29
+ dependencyCache = new Map();
30
+ dependencyCacheTree = {};
31
+ objectCollection = new ShallowObjectCollection();
32
+ ocCacheFileResult = new ShallowObjectCollection();
33
+ version;
23
34
  constructor(cacheFileLocation, useCheckSum, cspellVersion, useUniversalCache) {
24
35
  this.useCheckSum = useCheckSum;
25
36
  this.cspellVersion = cspellVersion;
26
37
  this.useUniversalCache = useUniversalCache;
27
- this.dependencyCache = new Map();
28
- this.dependencyCacheTree = {};
29
- this.objectCollection = new ShallowObjectCollection();
30
- this.ocCacheFileResult = new ShallowObjectCollection();
31
38
  this.cacheFileLocation = resolvePath(cacheFileLocation);
32
39
  this.cacheDir = dirname(this.cacheFileLocation);
33
40
  this.fileEntryCache = createFromFile(this.cacheFileLocation, useCheckSum, useUniversalCache);
@@ -20,14 +20,21 @@ const META_DATA_VERSION_SUFFIX = '-' + META_DATA_BASE_VERSION + '-' + Object.key
20
20
  * Caches cspell results on disk
21
21
  */
22
22
  export class DiskCache {
23
+ useCheckSum;
24
+ cspellVersion;
25
+ useUniversalCache;
26
+ cacheFileLocation;
27
+ cacheDir;
28
+ fileEntryCache;
29
+ dependencyCache = new Map();
30
+ dependencyCacheTree = {};
31
+ objectCollection = new ShallowObjectCollection();
32
+ ocCacheFileResult = new ShallowObjectCollection();
33
+ version;
23
34
  constructor(cacheFileLocation, useCheckSum, cspellVersion, useUniversalCache) {
24
35
  this.useCheckSum = useCheckSum;
25
36
  this.cspellVersion = cspellVersion;
26
37
  this.useUniversalCache = useUniversalCache;
27
- this.dependencyCache = new Map();
28
- this.dependencyCacheTree = {};
29
- this.objectCollection = new ShallowObjectCollection();
30
- this.ocCacheFileResult = new ShallowObjectCollection();
31
38
  this.cacheFileLocation = resolvePath(cacheFileLocation);
32
39
  this.cacheDir = dirname(this.cacheFileLocation);
33
40
  this.fileEntryCache = createFromFile(this.cacheFileLocation, useCheckSum, useUniversalCache);
@@ -1,9 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  const compare = Intl.Collator().compare;
3
3
  export class ShallowObjectCollection {
4
- constructor() {
5
- this.tree = {};
6
- }
4
+ tree = {};
7
5
  get(v) {
8
6
  if (typeof v !== 'object' || v === null) {
9
7
  return v;
@@ -35,9 +33,7 @@ export class ShallowObjectCollection {
35
33
  }
36
34
  }
37
35
  export class Collection {
38
- constructor() {
39
- this.col = { contains: new Map() };
40
- }
36
+ col = { contains: new Map() };
41
37
  /**
42
38
  * Add a plain object to the collection.
43
39
  * The actual object used is returned.
@@ -1,9 +1,7 @@
1
1
  /* eslint-disable @typescript-eslint/no-explicit-any */
2
2
  const compare = Intl.Collator().compare;
3
3
  export class ShallowObjectCollection {
4
- constructor() {
5
- this.tree = {};
6
- }
4
+ tree = {};
7
5
  get(v) {
8
6
  if (typeof v !== 'object' || v === null) {
9
7
  return v;
@@ -35,9 +33,7 @@ export class ShallowObjectCollection {
35
33
  }
36
34
  }
37
35
  export class Collection {
38
- constructor() {
39
- this.col = { contains: new Map() };
40
- }
36
+ col = { contains: new Map() };
41
37
  /**
42
38
  * Add a plain object to the collection.
43
39
  * The actual object used is returned.
@@ -1,6 +1,5 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- export declare const UTF8: BufferEncoding;
3
- export declare const STDIN = "stdin";
4
- export declare const STDINProtocol = "stdin://";
5
- export declare const FileProtocol = "file://";
1
+ export declare const UTF8: "utf8";
2
+ export declare const STDIN: "stdin";
3
+ export declare const STDINProtocol: "stdin://";
4
+ export declare const FileProtocol: "file://";
6
5
  //# sourceMappingURL=constants.d.mts.map
@@ -1,6 +1,5 @@
1
- /// <reference types="node" resolution-mode="require"/>
2
- export declare const UTF8: BufferEncoding;
3
- export declare const STDIN = "stdin";
4
- export declare const STDINProtocol = "stdin://";
5
- export declare const FileProtocol = "file://";
1
+ export declare const UTF8: "utf8";
2
+ export declare const STDIN: "stdin";
3
+ export declare const STDINProtocol: "stdin://";
4
+ export declare const FileProtocol: "file://";
6
5
  //# sourceMappingURL=constants.d.ts.map
@@ -1,11 +1,14 @@
1
1
  import { format } from 'util';
2
2
  export class CheckFailed extends Error {
3
+ exitCode;
3
4
  constructor(message, exitCode = 1) {
4
5
  super(message);
5
6
  this.exitCode = exitCode;
6
7
  }
7
8
  }
8
9
  export class ApplicationError extends Error {
10
+ exitCode;
11
+ cause;
9
12
  constructor(message, exitCode = 1, cause) {
10
13
  super(message);
11
14
  this.exitCode = exitCode;
@@ -13,6 +16,7 @@ export class ApplicationError extends Error {
13
16
  }
14
17
  }
15
18
  export class IOError extends ApplicationError {
19
+ cause;
16
20
  constructor(message, cause) {
17
21
  super(message, undefined, cause);
18
22
  this.cause = cause;
@@ -1,11 +1,14 @@
1
1
  import { format } from 'util';
2
2
  export class CheckFailed extends Error {
3
+ exitCode;
3
4
  constructor(message, exitCode = 1) {
4
5
  super(message);
5
6
  this.exitCode = exitCode;
6
7
  }
7
8
  }
8
9
  export class ApplicationError extends Error {
10
+ exitCode;
11
+ cause;
9
12
  constructor(message, exitCode = 1, cause) {
10
13
  super(message);
11
14
  this.exitCode = exitCode;
@@ -13,6 +16,7 @@ export class ApplicationError extends Error {
13
16
  }
14
17
  }
15
18
  export class IOError extends ApplicationError {
19
+ cause;
16
20
  constructor(message, cause) {
17
21
  super(message, undefined, cause);
18
22
  this.cause = cause;
@@ -1,4 +1,4 @@
1
- /// <reference types="node" resolution-mode="require"/>
1
+ import type { BufferEncoding } from 'cspell-io';
2
2
  import type { CSpellUserSettings, Document, Issue } from 'cspell-lib';
3
3
  import { URI } from 'vscode-uri';
4
4
  import type { GlobOptions } from './glob.mjs';
@@ -18,6 +18,7 @@ export interface FileInfo {
18
18
  text?: string;
19
19
  errorCode?: string;
20
20
  }
21
+ type Perf = Record<string, number | undefined>;
21
22
  export interface FileResult {
22
23
  fileInfo: FileInfo;
23
24
  processed: boolean;
@@ -25,6 +26,7 @@ export interface FileResult {
25
26
  errors: number;
26
27
  configErrors: number;
27
28
  elapsedTimeMs: number | undefined;
29
+ perf?: Perf | undefined;
28
30
  cached?: boolean;
29
31
  }
30
32
  export declare function fileInfoToDocument(fileInfo: FileInfo, languageId: string | undefined, locale: string | undefined): Document;
@@ -42,7 +44,6 @@ export declare function readFile(filename: string, encoding?: BufferEncoding): P
42
44
  * @param globPatterns patterns or stdin
43
45
  */
44
46
  export declare function findFiles(globPatterns: string[], options: GlobOptions): Promise<string[]>;
45
- export declare function calcFinalConfigInfo(configInfo: ConfigInfo, settingsFromCommandLine: CSpellUserSettings, filename: string, text: string): FileConfigInfo;
46
47
  /**
47
48
  * Read
48
49
  * @param listFiles - array of file paths to read that will contain a list of files. Paths contained in each
@@ -60,4 +61,5 @@ export declare function readFileListFile(listFile: string): Promise<string[]>;
60
61
  export declare function isFile(filename: string): Promise<boolean>;
61
62
  export declare function isDir(filename: string): Promise<boolean>;
62
63
  export declare function isNotDir(filename: string): Promise<boolean>;
64
+ export {};
63
65
  //# sourceMappingURL=fileHelper.d.mts.map
@@ -1,4 +1,4 @@
1
- /// <reference types="node" resolution-mode="require"/>
1
+ import type { BufferEncoding } from 'cspell-io';
2
2
  import type { CSpellUserSettings, Document, Issue } from 'cspell-lib';
3
3
  import { URI } from 'vscode-uri';
4
4
  import type { GlobOptions } from './glob.js';
@@ -18,6 +18,7 @@ export interface FileInfo {
18
18
  text?: string;
19
19
  errorCode?: string;
20
20
  }
21
+ type Perf = Record<string, number | undefined>;
21
22
  export interface FileResult {
22
23
  fileInfo: FileInfo;
23
24
  processed: boolean;
@@ -25,6 +26,7 @@ export interface FileResult {
25
26
  errors: number;
26
27
  configErrors: number;
27
28
  elapsedTimeMs: number | undefined;
29
+ perf?: Perf | undefined;
28
30
  cached?: boolean;
29
31
  }
30
32
  export declare function fileInfoToDocument(fileInfo: FileInfo, languageId: string | undefined, locale: string | undefined): Document;
@@ -42,7 +44,6 @@ export declare function readFile(filename: string, encoding?: BufferEncoding): P
42
44
  * @param globPatterns patterns or stdin
43
45
  */
44
46
  export declare function findFiles(globPatterns: string[], options: GlobOptions): Promise<string[]>;
45
- export declare function calcFinalConfigInfo(configInfo: ConfigInfo, settingsFromCommandLine: CSpellUserSettings, filename: string, text: string): FileConfigInfo;
46
47
  /**
47
48
  * Read
48
49
  * @param listFiles - array of file paths to read that will contain a list of files. Paths contained in each
@@ -60,4 +61,5 @@ export declare function readFileListFile(listFile: string): Promise<string[]>;
60
61
  export declare function isFile(filename: string): Promise<boolean>;
61
62
  export declare function isDir(filename: string): Promise<boolean>;
62
63
  export declare function isNotDir(filename: string): Promise<boolean>;
64
+ export {};
63
65
  //# sourceMappingURL=fileHelper.d.ts.map
@@ -97,27 +97,6 @@ export async function findFiles(globPatterns, options) {
97
97
  const cwd = options.cwd || process.cwd();
98
98
  return [...stdin, ...globResults].map((filename) => resolveFilename(filename, cwd));
99
99
  }
100
- export function calcFinalConfigInfo(configInfo, settingsFromCommandLine, filename, text) {
101
- const basename = path.basename(filename);
102
- const fileSettings = cspell.calcOverrideSettings(configInfo.config, path.resolve(filename));
103
- const loadDefault = settingsFromCommandLine.loadDefaultConfiguration ??
104
- configInfo.config.loadDefaultConfiguration ??
105
- fileSettings.loadDefaultConfiguration ??
106
- true;
107
- const settings = cspell.mergeSettings(cspell.getDefaultSettings(loadDefault), cspell.getGlobalSettings(), fileSettings, settingsFromCommandLine);
108
- const languageIds = settings.languageId
109
- ? Array.isArray(settings.languageId)
110
- ? settings.languageId
111
- : [settings.languageId]
112
- : cspell.getLanguageIdsForBaseFilename(basename);
113
- const config = cspell.constructSettingsForText(settings, text, languageIds);
114
- return {
115
- configInfo: { ...configInfo, config },
116
- filename,
117
- text,
118
- languageIds,
119
- };
120
- }
121
100
  const resolveFilenames = asyncMap(resolveFilename);
122
101
  /**
123
102
  * Read
@@ -97,27 +97,6 @@ export async function findFiles(globPatterns, options) {
97
97
  const cwd = options.cwd || process.cwd();
98
98
  return [...stdin, ...globResults].map((filename) => resolveFilename(filename, cwd));
99
99
  }
100
- export function calcFinalConfigInfo(configInfo, settingsFromCommandLine, filename, text) {
101
- const basename = path.basename(filename);
102
- const fileSettings = cspell.calcOverrideSettings(configInfo.config, path.resolve(filename));
103
- const loadDefault = settingsFromCommandLine.loadDefaultConfiguration ??
104
- configInfo.config.loadDefaultConfiguration ??
105
- fileSettings.loadDefaultConfiguration ??
106
- true;
107
- const settings = cspell.mergeSettings(cspell.getDefaultSettings(loadDefault), cspell.getGlobalSettings(), fileSettings, settingsFromCommandLine);
108
- const languageIds = settings.languageId
109
- ? Array.isArray(settings.languageId)
110
- ? settings.languageId
111
- : [settings.languageId]
112
- : cspell.getLanguageIdsForBaseFilename(basename);
113
- const config = cspell.constructSettingsForText(settings, text, languageIds);
114
- return {
115
- configInfo: { ...configInfo, config },
116
- filename,
117
- text,
118
- languageIds,
119
- };
120
- }
121
100
  const resolveFilenames = asyncMap(resolveFilename);
122
101
  /**
123
102
  * Read