cspell 10.3.5 → 10.3.6

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/dist/esm/app.js CHANGED
@@ -1,4 +1,4 @@
1
- import { C as ApplicationError, S as width, T as console, _ as padLeft, a as parseApplicationFeatureFlags, b as pruneAnsiTextEnd, c as listDictionaries, d as validateUnitSize, f as unindent, g as tableToLines, i as lint, l as ReportChoicesAll, m as npmPackage, n as checkText, o as suggestions, p as DEFAULT_CACHE_LOCATION, r as createInit, s as trace, t as IncludeExcludeFlag, u as cvtLinterCliCommandOptionsToLinterCliOptions, v as padWidth, w as CheckFailed, x as pruneAnsiTextStart, y as ansiWidth } from "./application-CdcDwTFc.js";
1
+ import { C as ApplicationError, S as width, T as console, _ as padLeft, a as parseApplicationFeatureFlags, b as pruneAnsiTextEnd, c as listDictionaries, d as validateUnitSize, f as unindent, g as tableToLines, i as lint, l as ReportChoicesAll, m as npmPackage, n as checkText, o as suggestions, p as DEFAULT_CACHE_LOCATION, r as createInit, s as trace, t as IncludeExcludeFlag, u as cvtLinterCliCommandOptionsToLinterCliOptions, v as padWidth, w as CheckFailed, x as pruneAnsiTextStart, y as ansiWidth } from "./application-yI9NNGsb.js";
2
2
  import { Link } from "cspell-lib";
3
3
  import chalk from "chalk";
4
4
  import * as iPath from "node:path";
@@ -563,6 +563,9 @@ function getReporter(options, config) {
563
563
  filesCached: 0,
564
564
  accumulatedTimeMs: 0,
565
565
  startTime: performance.now(),
566
+ firstFileStartTime: 0,
567
+ lastFileEndTime: 0,
568
+ betweenFilesTimeMs: 0,
566
569
  perf: Object.create(null)
567
570
  };
568
571
  const noColor = options.color === false;
@@ -637,13 +640,19 @@ function getReporter(options, config) {
637
640
  errorCollection.forEach((error) => consoleError(error));
638
641
  }
639
642
  if (options.showPerfSummary) {
640
- const elapsedTotal = performance.now() - perfStats.startTime;
643
+ const now = performance.now();
644
+ const elapsedTotal = now - perfStats.startTime;
645
+ const setupTime = (perfStats.firstFileStartTime || now) - perfStats.startTime;
646
+ const otherTime = elapsedTotal - setupTime - perfStats.accumulatedTimeMs - perfStats.betweenFilesTimeMs;
641
647
  consoleError("-------------------------------------------");
642
648
  consoleError("Performance Summary:");
643
649
  consoleError(` Files Processed : ${perfStats.filesProcessed.toString().padStart(11)}`);
644
650
  consoleError(` Files Skipped : ${perfStats.filesSkipped.toString().padStart(11)}`);
645
651
  consoleError(` Files Cached : ${perfStats.filesCached.toString().padStart(11)}`);
652
+ consoleError(` Setup Time : ${setupTime.toFixed(2).padStart(9)}ms`);
646
653
  consoleError(` Processing Time : ${perfStats.accumulatedTimeMs.toFixed(2).padStart(9)}ms`);
654
+ consoleError(` Between Files : ${perfStats.betweenFilesTimeMs.toFixed(2).padStart(9)}ms`);
655
+ consoleError(` Other Time : ${otherTime.toFixed(2).padStart(9)}ms`);
647
656
  consoleError(` Total Time : ${elapsedTotal.toFixed(2).padStart(9)}ms`);
648
657
  const tableStats = {
649
658
  title: chalk.bold("Perf Stats:"),
@@ -755,7 +764,15 @@ function getReporter(options, config) {
755
764
  }
756
765
  function progress(p) {
757
766
  if (!silent && showProgress) reportProgress(stderr, p, rootURL, options);
758
- if (p.type === "ProgressFileComplete") collectPerfStats(p);
767
+ if (p.type === "ProgressFileBegin") {
768
+ const now = performance.now();
769
+ perfStats.firstFileStartTime ||= now;
770
+ if (perfStats.lastFileEndTime) perfStats.betweenFilesTimeMs += now - perfStats.lastFileEndTime;
771
+ }
772
+ if (p.type === "ProgressFileComplete") {
773
+ perfStats.lastFileEndTime = performance.now();
774
+ collectPerfStats(p);
775
+ }
759
776
  }
760
777
  return {
761
778
  issue: relativeIssue(silent || !issues ? nullEmitter : genIssueEmitter(stdio, stderr, issueTemplate, uniqueIssues, issuesCollection)),
@@ -764,7 +781,7 @@ function getReporter(options, config) {
764
781
  debug: emitters.Debug,
765
782
  progress,
766
783
  result: !silent && summary ? resultEmitter : nullEmitter,
767
- features: void 0
784
+ features: { issueType: true }
768
785
  };
769
786
  }
770
787
  function extractNotableBySelfTimeInGroup(measurements) {
@@ -1213,7 +1230,7 @@ try {
1213
1230
  const pkgDir = _dirname;
1214
1231
  const npmPackage = {
1215
1232
  name: "cspell",
1216
- version: "10.3.5",
1233
+ version: "10.3.6",
1217
1234
  engines: { node: ">=22.18.0" }
1218
1235
  };
1219
1236
  //#endregion
@@ -1351,7 +1368,7 @@ var LintReporter = class {
1351
1368
  });
1352
1369
  }
1353
1370
  emitProgressComplete(filename, fileNum, fileCount, result) {
1354
- const numIssues = result.issues.filter((issue) => filterFeatureIssues({}, issue, result.reportIssueOptions)).length;
1371
+ const numIssues = result.issues.filter((issue) => filterFeatureIssues({ issueType: true }, issue, result.reportIssueOptions)).length;
1355
1372
  for (const reporter of this.#reporters) {
1356
1373
  const progress = clean({
1357
1374
  type: "ProgressFileComplete",
@@ -1992,18 +2009,20 @@ var DiskCache = class {
1992
2009
  cspellVersion;
1993
2010
  useUniversalCache;
1994
2011
  fileEntryCache;
2012
+ optionsKey;
1995
2013
  cacheDir;
1996
2014
  dependencyCache = /* @__PURE__ */ new Map();
1997
2015
  dependencyCacheTree = {};
1998
2016
  objectCollection = new ShallowObjectCollection();
1999
2017
  ocCacheFileResult = new ShallowObjectCollection();
2000
2018
  version;
2001
- constructor(cacheFileLocation, useCheckSum, cspellVersion, useUniversalCache, fileEntryCache) {
2019
+ constructor(cacheFileLocation, useCheckSum, cspellVersion, useUniversalCache, fileEntryCache, optionsKey) {
2002
2020
  this.cacheFileLocation = cacheFileLocation;
2003
2021
  this.useCheckSum = useCheckSum;
2004
2022
  this.cspellVersion = cspellVersion;
2005
2023
  this.useUniversalCache = useUniversalCache;
2006
2024
  this.fileEntryCache = fileEntryCache;
2025
+ this.optionsKey = optionsKey;
2007
2026
  this.cacheDir = fileURLToPath(new URL("./", cacheFileLocation));
2008
2027
  this.version = calcVersion(cspellVersion);
2009
2028
  }
@@ -2014,7 +2033,8 @@ var DiskCache = class {
2014
2033
  const data = meta?.data;
2015
2034
  const result = data?.r;
2016
2035
  const versionMatches = this.version === data?.v;
2017
- if (fileDescriptor.notFound || fileDescriptor.changed || !meta || !result || !versionMatches || !await this.checkDependencies(data.d)) return;
2036
+ const optionsMatch = this.optionsKey === data?.o;
2037
+ if (fileDescriptor.notFound || fileDescriptor.changed || !meta || !result || !versionMatches || !optionsMatch || !await this.checkDependencies(data.d)) return;
2018
2038
  const dd = { ...data };
2019
2039
  if (dd.d) dd.d = setTreeEntry(this.dependencyCacheTree, dd.d);
2020
2040
  dd.r = dd.r && this.normalizeResult(dd.r);
@@ -2036,7 +2056,8 @@ var DiskCache = class {
2036
2056
  meta.data = this.objectCollection.get({
2037
2057
  v: this.version,
2038
2058
  r: this.normalizeResult(result),
2039
- d: await this.calcDependencyHashes(dependsUponFiles)
2059
+ d: await this.calcDependencyHashes(dependsUponFiles),
2060
+ ...this.optionsKey ? { o: this.optionsKey } : {}
2040
2061
  });
2041
2062
  }
2042
2063
  async reconcile() {
@@ -2138,8 +2159,8 @@ async function getDependencyForUrl(remoteUrl) {
2138
2159
  };
2139
2160
  }
2140
2161
  }
2141
- async function createDiskCache(cacheFileLocation, useCheckSum, cspellVersion, useUniversalCache) {
2142
- return new DiskCache(cacheFileLocation, useCheckSum, cspellVersion, useUniversalCache, await createFromFile(cacheFileLocation, useCheckSum, useUniversalCache));
2162
+ async function createDiskCache(cacheFileLocation, useCheckSum, cspellVersion, useUniversalCache, optionsKey) {
2163
+ return new DiskCache(cacheFileLocation, useCheckSum, cspellVersion, useUniversalCache, await createFromFile(cacheFileLocation, useCheckSum, useUniversalCache), optionsKey);
2143
2164
  }
2144
2165
  function getTreeEntry(tree, keys) {
2145
2166
  let r = tree;
@@ -2208,7 +2229,7 @@ async function createCache(options) {
2208
2229
  const useChecksum = cacheStrategy === "content";
2209
2230
  const version = normalizeVersion(options.version);
2210
2231
  const useUniversal = options.cacheFormat === "universal";
2211
- const cache = useCache ? await createDiskCache(location, useChecksum, version, useUniversal) : new DummyCache();
2232
+ const cache = useCache ? await createDiskCache(location, useChecksum, version, useUniversal, options.optionsKey) : new DummyCache();
2212
2233
  if (reset) await cache.reset();
2213
2234
  return cache;
2214
2235
  }
@@ -2220,6 +2241,8 @@ async function calcCacheSettings(config, cacheOptions, root) {
2220
2241
  const cacheFormat = cacheOptions.cacheFormat ?? cs.cacheFormat ?? "universal";
2221
2242
  const optionals = {};
2222
2243
  if (cacheOptions.cacheReset) optionals.reset = true;
2244
+ const optionsKey = calcOptionsKey(cacheOptions);
2245
+ if (optionsKey) optionals.optionsKey = optionsKey;
2223
2246
  return {
2224
2247
  ...optionals,
2225
2248
  useCache,
@@ -2229,6 +2252,17 @@ async function calcCacheSettings(config, cacheOptions, root) {
2229
2252
  cacheFormat
2230
2253
  };
2231
2254
  }
2255
+ function calcOptionsKey(cacheOptions) {
2256
+ const { languageId, locale, report, showSuggestions, validateDirectives } = cacheOptions;
2257
+ const set = Object.entries({
2258
+ languageId: languageId || void 0,
2259
+ locale: locale || void 0,
2260
+ report: report || void 0,
2261
+ showSuggestions,
2262
+ validateDirectives
2263
+ }).filter(([, value]) => value !== void 0);
2264
+ return set.length ? JSON.stringify(Object.fromEntries(set)) : void 0;
2265
+ }
2232
2266
  async function resolveCacheLocation(cacheLocation) {
2233
2267
  try {
2234
2268
  if ((await stat(cacheLocation)).isFile()) return cacheLocation;
@@ -3227,6 +3261,7 @@ var LintRequest = class {
3227
3261
  }];
3228
3262
  this.cspellSettingsFromCliOptions = {
3229
3263
  ...noConfigSearch !== void 0 ? { noConfigSearch } : {},
3264
+ ...options.validateDirectives !== void 0 ? { validateDirectives: options.validateDirectives } : {},
3230
3265
  ...extractUnknownWordsConfig(options),
3231
3266
  languageSettings
3232
3267
  };
@@ -3534,4 +3569,4 @@ function parseApplicationFeatureFlags(flags) {
3534
3569
  //#endregion
3535
3570
  export { ApplicationError as C, width as S, console as T, padLeft as _, parseApplicationFeatureFlags as a, pruneAnsiTextEnd as b, listDictionaries as c, validateUnitSize as d, unindent as f, tableToLines as g, getReporter as h, lint as i, ReportChoicesAll as l, npmPackage as m, checkText as n, suggestions as o, DEFAULT_CACHE_LOCATION as p, createInit as r, trace as s, IncludeExcludeFlag as t, cvtLinterCliCommandOptionsToLinterCliOptions as u, padWidth as v, CheckFailed as w, pruneAnsiTextStart as x, ansiWidth as y };
3536
3571
 
3537
- //# sourceMappingURL=application-CdcDwTFc.js.map
3572
+ //# sourceMappingURL=application-yI9NNGsb.js.map
@@ -1,2 +1,2 @@
1
- import { a as parseApplicationFeatureFlags, c as listDictionaries, i as lint, n as checkText, o as suggestions, r as createInit, s as trace, t as IncludeExcludeFlag } from "./application-CdcDwTFc.js";
1
+ import { a as parseApplicationFeatureFlags, c as listDictionaries, i as lint, n as checkText, o as suggestions, r as createInit, s as trace, t as IncludeExcludeFlag } from "./application-yI9NNGsb.js";
2
2
  export { IncludeExcludeFlag, checkText, createInit, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
package/dist/esm/index.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as parseApplicationFeatureFlags, c as listDictionaries, h as getReporter, i as lint, n as checkText, o as suggestions, r as createInit, s as trace, t as IncludeExcludeFlag } from "./application-CdcDwTFc.js";
1
+ import { a as parseApplicationFeatureFlags, c as listDictionaries, h as getReporter, i as lint, n as checkText, o as suggestions, r as createInit, s as trace, t as IncludeExcludeFlag } from "./application-yI9NNGsb.js";
2
2
  export * from "@cspell/cspell-types";
3
3
  export { IncludeExcludeFlag, checkText, createInit, getReporter as getDefaultReporter, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
package/package.json CHANGED
@@ -1,17 +1,36 @@
1
1
  {
2
2
  "name": "cspell",
3
- "version": "10.3.5",
3
+ "version": "10.3.6",
4
4
  "description": "A Spelling Checker for Code!",
5
- "funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
6
- "bin": {
7
- "cspell": "bin.mjs",
8
- "cspell-esm": "bin.mjs"
5
+ "publishConfig": {
6
+ "access": "public",
7
+ "provenance": true
9
8
  },
10
- "type": "module",
9
+ "homepage": "https://cspell.org/",
10
+ "repository": {
11
+ "type": "git",
12
+ "url": "https://github.com/streetsidesoftware/cspell.git",
13
+ "directory": "packages/cspell"
14
+ },
15
+ "bugs": {
16
+ "url": "https://github.com/streetsidesoftware/cspell/issues?q=is%3Aissue%20state%3Aopen%20label%3Acspell"
17
+ },
18
+ "funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
19
+ "keywords": [
20
+ "spell",
21
+ "checker",
22
+ "code",
23
+ "camel",
24
+ "case",
25
+ "spelling",
26
+ "spell checker",
27
+ "spelling checker",
28
+ "lint"
29
+ ],
30
+ "license": "MIT",
31
+ "author": "Jason Dent",
11
32
  "sideEffects": false,
12
- "types": "dist/cjs/commonJsApi.d.cts",
13
- "main": "dist/cjs/commonJsApi.cjs",
14
- "module": "dist/esm/index.js",
33
+ "type": "module",
15
34
  "exports": {
16
35
  ".": {
17
36
  "import": "./dist/esm/index.js",
@@ -30,6 +49,13 @@
30
49
  "import": "./dist/esm/application.js"
31
50
  }
32
51
  },
52
+ "main": "dist/cjs/commonJsApi.cjs",
53
+ "module": "dist/esm/index.js",
54
+ "types": "dist/cjs/commonJsApi.d.cts",
55
+ "bin": {
56
+ "cspell": "bin.mjs",
57
+ "cspell-esm": "bin.mjs"
58
+ },
33
59
  "files": [
34
60
  "bin.mjs",
35
61
  "dist",
@@ -44,81 +70,55 @@
44
70
  "!dist/tsc"
45
71
  ],
46
72
  "scripts": {
47
- "clean": "shx rm -rf dist temp coverage \"*.tsbuildInfo\"",
48
73
  "build": "tsdown && pnpm build:tsc",
49
- "build:tsc": "tsc -p .",
50
74
  "build:readme": "pnpm build:readme:help",
51
75
  "build:readme:help": "pnpm build:readme:help:lint && pnpm build:readme:help:trace && inject-markdown README.md && prettier -w README.md",
52
76
  "build:readme:help:lint": "./bin.mjs lint --help > static/help-lint.txt",
53
77
  "build:readme:help:trace": "./bin.mjs trace --help > static/help-trace.txt",
78
+ "build:tsc": "tsc -p .",
79
+ "clean": "shx rm -rf dist temp coverage \"*.tsbuildInfo\"",
54
80
  "clean-build": "pnpm run clean && pnpm run build",
81
+ "compile": "tsc -p .",
55
82
  "coverage": "vitest run --coverage",
56
- "test:watch": "vitest",
83
+ "prepublishOnly": "pnpm run clean-build",
57
84
  "test": "vitest run",
58
- "watch": "tsdown -w",
59
- "watch:tsc": "tsc -p . -w",
60
- "compile": "tsc -p .",
85
+ "test:update-snapshot": "vitest run --update",
86
+ "test:watch": "vitest",
61
87
  "test-watch": "vitest",
62
88
  "version": "node ./tools/patch-version.mjs && git add .",
63
- "prepublishOnly": "pnpm run clean-build",
64
- "test:update-snapshot": "vitest run --update"
65
- },
66
- "repository": {
67
- "type": "git",
68
- "url": "https://github.com/streetsidesoftware/cspell.git",
69
- "directory": "packages/cspell"
70
- },
71
- "keywords": [
72
- "spell",
73
- "checker",
74
- "code",
75
- "camel",
76
- "case",
77
- "spelling",
78
- "spell checker",
79
- "spelling checker",
80
- "lint"
81
- ],
82
- "author": "Jason Dent",
83
- "license": "MIT",
84
- "publishConfig": {
85
- "access": "public",
86
- "provenance": true
87
- },
88
- "bugs": {
89
- "url": "https://github.com/streetsidesoftware/cspell/issues"
89
+ "watch": "tsdown -w",
90
+ "watch:tsc": "tsc -p . -w"
90
91
  },
91
- "homepage": "https://cspell.org/",
92
92
  "dependencies": {
93
- "@cspell/cspell-json-reporter": "10.3.5",
94
- "@cspell/cspell-performance-monitor": "10.3.5",
95
- "@cspell/cspell-pipe": "10.3.5",
96
- "@cspell/cspell-types": "10.3.5",
97
- "@cspell/cspell-worker": "10.3.5",
98
- "@cspell/dynamic-import": "10.3.5",
99
- "@cspell/url": "10.3.5",
93
+ "@cspell/cspell-json-reporter": "10.3.6",
94
+ "@cspell/cspell-performance-monitor": "10.3.6",
95
+ "@cspell/cspell-pipe": "10.3.6",
96
+ "@cspell/cspell-types": "10.3.6",
97
+ "@cspell/cspell-worker": "10.3.6",
98
+ "@cspell/dynamic-import": "10.3.6",
99
+ "@cspell/url": "10.3.6",
100
100
  "ansi-regex": "^6.3.0",
101
101
  "chalk": "^6.0.0",
102
102
  "chalk-template": "^1.1.2",
103
103
  "commander": "^15.0.0",
104
- "cspell-config-lib": "10.3.5",
105
- "cspell-dictionary": "10.3.5",
106
- "cspell-gitignore": "10.3.5",
107
- "cspell-glob": "10.3.5",
108
- "cspell-io": "10.3.5",
109
- "cspell-lib": "10.3.5",
104
+ "cspell-config-lib": "10.3.6",
105
+ "cspell-dictionary": "10.3.6",
106
+ "cspell-gitignore": "10.3.6",
107
+ "cspell-glob": "10.3.6",
108
+ "cspell-io": "10.3.6",
109
+ "cspell-lib": "10.3.6",
110
110
  "flatted": "^3.4.4",
111
111
  "semver": "^7.8.5",
112
112
  "tinyglobby": "^0.2.17"
113
113
  },
114
- "engines": {
115
- "node": ">=22.18.0"
116
- },
117
114
  "devDependencies": {
118
115
  "@types/micromatch": "^4.0.10",
119
116
  "@types/semver": "^7.8.0",
120
117
  "micromatch": "^4.0.8",
121
118
  "minimatch": "^9.0.9"
122
119
  },
123
- "gitHead": "f37a244a54b686fc1ac11272d6019b9a059b062a"
120
+ "engines": {
121
+ "node": ">=22.18.0"
122
+ },
123
+ "gitHead": "8559198ccfcac2f745911db1ffe2ee62c17cba49"
124
124
  }