cspell 8.1.2 → 8.2.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.
@@ -36,7 +36,7 @@ function errorEmitter(message, error) {
36
36
  function nullEmitter() {
37
37
  /* empty */
38
38
  }
39
- function relativeFilename(filename, cwd = process.cwd()) {
39
+ function relativeFilename(filename, cwd) {
40
40
  const rel = path.relative(cwd, filename);
41
41
  if (rel.startsWith('..'))
42
42
  return filename;
@@ -49,19 +49,19 @@ function relativeUriFilename(uri, fsPathRoot) {
49
49
  return fsPath;
50
50
  return '.' + path.sep + rel;
51
51
  }
52
- function reportProgress(p) {
52
+ function reportProgress(p, cwd) {
53
53
  if (p.type === 'ProgressFileComplete') {
54
54
  return reportProgressFileComplete(p);
55
55
  }
56
56
  if (p.type === 'ProgressFileBegin') {
57
- return reportProgressFileBegin(p);
57
+ return reportProgressFileBegin(p, cwd);
58
58
  }
59
59
  }
60
- function reportProgressFileBegin(p) {
60
+ function reportProgressFileBegin(p, cwd) {
61
61
  const fc = '' + p.fileCount;
62
62
  const fn = (' '.repeat(fc.length) + p.fileNum).slice(-fc.length);
63
63
  const idx = fn + '/' + fc;
64
- const filename = chalk.gray(relativeFilename(p.filename));
64
+ const filename = chalk.gray(relativeFilename(p.filename, cwd));
65
65
  process.stderr.write(`\r${idx} ${filename}`);
66
66
  }
67
67
  function reportProgressFileComplete(p) {
@@ -102,7 +102,7 @@ export function getReporter(options, config) {
102
102
  function infoEmitter(message, msgType) {
103
103
  emitters[msgType]?.(message);
104
104
  }
105
- const root = URI.file(options.root || process.cwd());
105
+ const root = URI.file(path.resolve(options.root || process.cwd()));
106
106
  const fsPathRoot = root.fsPath;
107
107
  function relativeIssue(fn) {
108
108
  const fnFilename = options.relative
@@ -129,7 +129,7 @@ export function getReporter(options, config) {
129
129
  error: silent ? nullEmitter : errorEmitter,
130
130
  info: infoEmitter,
131
131
  debug: emitters.Debug,
132
- progress: !silent && progress ? reportProgress : nullEmitter,
132
+ progress: !silent && progress ? (p) => reportProgress(p, fsPathRoot) : nullEmitter,
133
133
  result: !silent && summary ? resultEmitter : nullEmitter,
134
134
  };
135
135
  }
@@ -36,7 +36,7 @@ function errorEmitter(message, error) {
36
36
  function nullEmitter() {
37
37
  /* empty */
38
38
  }
39
- function relativeFilename(filename, cwd = process.cwd()) {
39
+ function relativeFilename(filename, cwd) {
40
40
  const rel = path.relative(cwd, filename);
41
41
  if (rel.startsWith('..'))
42
42
  return filename;
@@ -49,19 +49,19 @@ function relativeUriFilename(uri, fsPathRoot) {
49
49
  return fsPath;
50
50
  return '.' + path.sep + rel;
51
51
  }
52
- function reportProgress(p) {
52
+ function reportProgress(p, cwd) {
53
53
  if (p.type === 'ProgressFileComplete') {
54
54
  return reportProgressFileComplete(p);
55
55
  }
56
56
  if (p.type === 'ProgressFileBegin') {
57
- return reportProgressFileBegin(p);
57
+ return reportProgressFileBegin(p, cwd);
58
58
  }
59
59
  }
60
- function reportProgressFileBegin(p) {
60
+ function reportProgressFileBegin(p, cwd) {
61
61
  const fc = '' + p.fileCount;
62
62
  const fn = (' '.repeat(fc.length) + p.fileNum).slice(-fc.length);
63
63
  const idx = fn + '/' + fc;
64
- const filename = chalk.gray(relativeFilename(p.filename));
64
+ const filename = chalk.gray(relativeFilename(p.filename, cwd));
65
65
  process.stderr.write(`\r${idx} ${filename}`);
66
66
  }
67
67
  function reportProgressFileComplete(p) {
@@ -102,7 +102,7 @@ export function getReporter(options, config) {
102
102
  function infoEmitter(message, msgType) {
103
103
  emitters[msgType]?.(message);
104
104
  }
105
- const root = URI.file(options.root || process.cwd());
105
+ const root = URI.file(path.resolve(options.root || process.cwd()));
106
106
  const fsPathRoot = root.fsPath;
107
107
  function relativeIssue(fn) {
108
108
  const fnFilename = options.relative
@@ -129,7 +129,7 @@ export function getReporter(options, config) {
129
129
  error: silent ? nullEmitter : errorEmitter,
130
130
  info: infoEmitter,
131
131
  debug: emitters.Debug,
132
- progress: !silent && progress ? reportProgress : nullEmitter,
132
+ progress: !silent && progress ? (p) => reportProgress(p, fsPathRoot) : nullEmitter,
133
133
  result: !silent && summary ? resultEmitter : nullEmitter,
134
134
  };
135
135
  }
@@ -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 { ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, getDictionary, isBinaryFile as cspellIsBinaryFile, setLogger, shouldCheckDocument, spellCheckDocument, Text as cspellText, } from 'cspell-lib';
7
+ import { ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, getDefaultConfigLoader, 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';
@@ -20,6 +20,7 @@ import { getTimeMeasurer } from '../util/timer.js';
20
20
  import * as util from '../util/util.js';
21
21
  const version = npmPackage.version;
22
22
  const BATCH_SIZE = 8;
23
+ const debugStats = false;
23
24
  const { opFilterAsync } = operators;
24
25
  export async function runLint(cfg) {
25
26
  let { reporter } = cfg;
@@ -302,7 +303,9 @@ export async function runLint(cfg) {
302
303
  try {
303
304
  const cacheSettings = await calcCacheSettings(configInfo.config, { ...cfg.options, version }, root);
304
305
  const files = await determineFilesToCheck(configInfo, cfg, reporter, globInfo);
305
- return await processFiles(files, configInfo, cacheSettings);
306
+ const result = await processFiles(files, configInfo, cacheSettings);
307
+ debugStats && console.error('stats: %o', getDefaultConfigLoader().getStats());
308
+ return result;
306
309
  }
307
310
  catch (e) {
308
311
  const err = toApplicationError(e);
@@ -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 { ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, getDictionary, isBinaryFile as cspellIsBinaryFile, setLogger, shouldCheckDocument, spellCheckDocument, Text as cspellText, } from 'cspell-lib';
7
+ import { ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, getDefaultConfigLoader, 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';
@@ -20,6 +20,7 @@ import { getTimeMeasurer } from '../util/timer.mjs';
20
20
  import * as util from '../util/util.mjs';
21
21
  const version = npmPackage.version;
22
22
  const BATCH_SIZE = 8;
23
+ const debugStats = false;
23
24
  const { opFilterAsync } = operators;
24
25
  export async function runLint(cfg) {
25
26
  let { reporter } = cfg;
@@ -302,7 +303,9 @@ export async function runLint(cfg) {
302
303
  try {
303
304
  const cacheSettings = await calcCacheSettings(configInfo.config, { ...cfg.options, version }, root);
304
305
  const files = await determineFilesToCheck(configInfo, cfg, reporter, globInfo);
305
- return await processFiles(files, configInfo, cacheSettings);
306
+ const result = await processFiles(files, configInfo, cacheSettings);
307
+ debugStats && console.error('stats: %o', getDefaultConfigLoader().getStats());
308
+ return result;
306
309
  }
307
310
  catch (e) {
308
311
  const err = toApplicationError(e);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell",
3
- "version": "8.1.2",
3
+ "version": "8.2.0",
4
4
  "description": "A Spelling Checker for Code!",
5
5
  "funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
6
6
  "bin": {
@@ -81,20 +81,20 @@
81
81
  },
82
82
  "homepage": "https://streetsidesoftware.github.io/cspell/",
83
83
  "dependencies": {
84
- "@cspell/cspell-json-reporter": "8.1.2",
85
- "@cspell/cspell-pipe": "8.1.2",
86
- "@cspell/cspell-types": "8.1.2",
87
- "@cspell/dynamic-import": "8.1.2",
84
+ "@cspell/cspell-json-reporter": "8.2.0",
85
+ "@cspell/cspell-pipe": "8.2.0",
86
+ "@cspell/cspell-types": "8.2.0",
87
+ "@cspell/dynamic-import": "8.2.0",
88
88
  "chalk": "^5.3.0",
89
89
  "chalk-template": "^1.1.0",
90
90
  "commander": "^11.1.0",
91
- "cspell-gitignore": "8.1.2",
92
- "cspell-glob": "8.1.2",
93
- "cspell-io": "8.1.2",
94
- "cspell-lib": "8.1.2",
91
+ "cspell-gitignore": "8.2.0",
92
+ "cspell-glob": "8.2.0",
93
+ "cspell-io": "8.2.0",
94
+ "cspell-lib": "8.2.0",
95
95
  "fast-glob": "^3.3.2",
96
96
  "fast-json-stable-stringify": "^2.1.0",
97
- "file-entry-cache": "^7.0.2",
97
+ "file-entry-cache": "^8.0.0",
98
98
  "get-stdin": "^9.0.0",
99
99
  "semver": "^7.5.4",
100
100
  "strip-ansi": "^7.1.0",
@@ -111,5 +111,5 @@
111
111
  "micromatch": "^4.0.5",
112
112
  "minimatch": "^9.0.3"
113
113
  },
114
- "gitHead": "ba4eef94480562e7641298b32cb99723fd64aeca"
114
+ "gitHead": "3bcd6430bb33fb221d07030a60a2d61a2479e7ae"
115
115
  }