cspell 8.17.2 → 8.17.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.
package/README.md CHANGED
@@ -314,7 +314,7 @@ exec git diff --cached --name-only | npx cspell --no-summary --no-progress --no-
314
314
 
315
315
  ## Requirements
316
316
 
317
- cspell needs Node 14 and above.
317
+ CSpell needs Node 18 and above.
318
318
 
319
319
  ## How it works
320
320
 
@@ -1,4 +1,8 @@
1
1
  import type { RunResult } from '@cspell/cspell-types';
2
2
  import type { LintRequest } from './LintRequest.js';
3
3
  export declare function runLint(cfg: LintRequest): Promise<RunResult>;
4
+ export declare class LinterError extends Error {
5
+ constructor(message: string);
6
+ toString(): string;
7
+ }
4
8
  //# sourceMappingURL=lint.d.ts.map
@@ -88,7 +88,7 @@ export async function runLint(cfg) {
88
88
  const fileInfo = prefetch?.fileInfo || (await readFileInfo(filename, undefined, true));
89
89
  if (fileInfo.errorCode) {
90
90
  if (fileInfo.errorCode !== 'EISDIR' && cfg.options.mustFindFiles) {
91
- const err = toError(`File not found: "${filename}"`);
91
+ const err = new LinterError(`File not found: "${filename}"`);
92
92
  reporter.error('Linter:', err);
93
93
  result.errors += 1;
94
94
  }
@@ -541,4 +541,12 @@ async function writeDictionaryLog() {
541
541
  function globPattern(g) {
542
542
  return typeof g === 'string' ? g : g.glob;
543
543
  }
544
+ export class LinterError extends Error {
545
+ constructor(message) {
546
+ super(message);
547
+ }
548
+ toString() {
549
+ return this.message;
550
+ }
551
+ }
544
552
  //# sourceMappingURL=lint.js.map
@@ -1,6 +1,6 @@
1
1
  export { pkgDir } from './dirname.js';
2
2
  export declare const name = "cspell";
3
- export declare const version = "8.17.2";
3
+ export declare const version = "8.17.4";
4
4
  export declare const engines: {
5
5
  node: string;
6
6
  };
@@ -1,7 +1,7 @@
1
1
  // This file is generated by tools/patch-version.mjs
2
2
  export { pkgDir } from './dirname.js';
3
3
  export const name = 'cspell';
4
- export const version = '8.17.2';
4
+ export const version = '8.17.4';
5
5
  export const engines = { node: '>=18' };
6
6
  export const npmPackage = { name, version, engines };
7
7
  //# sourceMappingURL=pkgInfo.js.map
@@ -1,7 +1,7 @@
1
1
  import assert from 'node:assert';
2
2
  import { stat } from 'node:fs/promises';
3
3
  import path from 'node:path';
4
- import { isError } from '../errors.js';
4
+ import { isErrorLike } from '../errors.js';
5
5
  import { DiskCache } from './DiskCache.js';
6
6
  import { DummyCache } from './DummyCache.js';
7
7
  // cspell:word cspellcache
@@ -47,7 +47,7 @@ async function resolveCacheLocation(cacheLocation) {
47
47
  return path.join(cacheLocation, DEFAULT_CACHE_LOCATION);
48
48
  }
49
49
  catch (err) {
50
- if (isError(err) && err.code === 'ENOENT') {
50
+ if (isErrorLike(err) && err.code === 'ENOENT') {
51
51
  return cacheLocation;
52
52
  }
53
53
  throw err;
@@ -15,6 +15,7 @@ export declare class IOError extends ApplicationError {
15
15
  }
16
16
  export declare function toError(e: unknown): NodeError;
17
17
  export declare function isError(e: unknown): e is NodeError;
18
+ export declare function isErrorLike(e: unknown): e is NodeError;
18
19
  export declare function toApplicationError(e: unknown, message?: string): ApplicationError;
19
20
  export interface NodeError extends Error {
20
21
  code?: string;
@@ -31,14 +31,19 @@ export class IOError extends ApplicationError {
31
31
  export function toError(e) {
32
32
  if (isError(e))
33
33
  return e;
34
+ if (isErrorLike(e)) {
35
+ const ex = new Error(e.message, { cause: e });
36
+ if (e.code !== undefined)
37
+ ex.code = e.code;
38
+ return ex;
39
+ }
34
40
  const message = format(e);
35
- return {
36
- name: 'error',
37
- message,
38
- toString: () => message,
39
- };
41
+ return new Error(message);
40
42
  }
41
43
  export function isError(e) {
44
+ return e instanceof Error;
45
+ }
46
+ export function isErrorLike(e) {
42
47
  if (e instanceof Error)
43
48
  return true;
44
49
  if (!e || typeof e !== 'object')
@@ -12,7 +12,8 @@ const defaultExcludeGlobs = ['node_modules/**'];
12
12
  */
13
13
  export async function globP(pattern, options) {
14
14
  const cwd = options?.root || options?.cwd || process.cwd();
15
- const ignore = typeof options?.ignore === 'string' ? [options.ignore] : options?.ignore;
15
+ const ignoreRaw = typeof options?.ignore === 'string' ? [options.ignore] : options?.ignore;
16
+ const ignore = ignoreRaw?.filter((g) => !g.startsWith('../'));
16
17
  const onlyFiles = options?.nodir;
17
18
  const dot = options?.dot;
18
19
  const patterns = typeof pattern === 'string' ? [pattern] : pattern;
@@ -24,6 +25,7 @@ export async function globP(pattern, options) {
24
25
  absolute: true,
25
26
  followSymbolicLinks: false,
26
27
  expandDirectories: false,
28
+ // debug: true,
27
29
  });
28
30
  const compare = new Intl.Collator('en').compare;
29
31
  const absolutePaths = (await glob(patterns, useOptions)).sort(compare);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell",
3
- "version": "8.17.2",
3
+ "version": "8.17.4",
4
4
  "description": "A Spelling Checker for Code!",
5
5
  "funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
6
6
  "bin": {
@@ -81,24 +81,24 @@
81
81
  },
82
82
  "homepage": "https://cspell.org/",
83
83
  "dependencies": {
84
- "@cspell/cspell-json-reporter": "8.17.2",
85
- "@cspell/cspell-pipe": "8.17.2",
86
- "@cspell/cspell-types": "8.17.2",
87
- "@cspell/dynamic-import": "8.17.2",
88
- "@cspell/url": "8.17.2",
84
+ "@cspell/cspell-json-reporter": "8.17.4",
85
+ "@cspell/cspell-pipe": "8.17.4",
86
+ "@cspell/cspell-types": "8.17.4",
87
+ "@cspell/dynamic-import": "8.17.4",
88
+ "@cspell/url": "8.17.4",
89
89
  "chalk": "^5.4.1",
90
90
  "chalk-template": "^1.1.0",
91
- "commander": "^13.0.0",
92
- "cspell-dictionary": "8.17.2",
93
- "cspell-gitignore": "8.17.2",
94
- "cspell-glob": "8.17.2",
95
- "cspell-io": "8.17.2",
96
- "cspell-lib": "8.17.2",
91
+ "commander": "^13.1.0",
92
+ "cspell-dictionary": "8.17.4",
93
+ "cspell-gitignore": "8.17.4",
94
+ "cspell-glob": "8.17.4",
95
+ "cspell-io": "8.17.4",
96
+ "cspell-lib": "8.17.4",
97
97
  "fast-json-stable-stringify": "^2.1.0",
98
98
  "file-entry-cache": "^9.1.0",
99
99
  "get-stdin": "^9.0.0",
100
- "semver": "^7.6.3",
101
- "tinyglobby": "^0.2.10"
100
+ "semver": "^7.7.1",
101
+ "tinyglobby": "^0.2.11"
102
102
  },
103
103
  "engines": {
104
104
  "node": ">=18"
@@ -111,5 +111,5 @@
111
111
  "micromatch": "^4.0.8",
112
112
  "minimatch": "^9.0.5"
113
113
  },
114
- "gitHead": "160c982e8d1e3b4951acb6fc003d013f3b0597e0"
114
+ "gitHead": "59b6876dd77fedc84fca3433b13ad9baa653c77d"
115
115
  }