cspell 10.3.2 → 10.3.4-alpha.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.
package/README.md CHANGED
@@ -10,9 +10,9 @@ A Spell Checker for Code!
10
10
 
11
11
  If our spell checkers save you time, please consider supporting their development.
12
12
 
13
- <p align="left">
14
- <a href="https://github.com/sponsors/streetsidesoftware" title="GitHub Sponsor"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cspell.org/img/sponsor/github-sponsor-dark.png" /><img alt="GitHub Sponsor" src="https://cspell.org/img/sponsor/github-sponsor.png" width="180" /></picture></a> &nbsp; <a href="https://www.paypal.com/donate/?hosted_button_id=26LNBP2Q6MKCY" title="PayPal"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cspell.org/img/sponsor/paypal-dark.png" /><img alt="PayPal" src="https://cspell.org/img/sponsor/paypal.png" width="180" /></picture></a> &nbsp; <a href="https://opencollective.com/cspell" title="Open Collective"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cspell.org/img/sponsor/open-collective-dark.png" /><img alt="Open Collective" src="https://cspell.org/img/sponsor/open-collective.png" width="180" /></picture></a> &nbsp; <a href="https://streetsidesoftware.com/sponsor/" title="Street Side Software"><picture><source media="(prefers-color-scheme: dark)" srcset="https://cspell.org/img/sponsor/cspell-dark.png" /><img alt="CSpell" src="https://cspell.org/img/sponsor/cspell.png" width="180" /></picture></a>
15
- </p>
13
+ Please show your support through one of the following sites:
14
+
15
+ [![GitHub Sponsor](https://cspell.org/img/sponsor/github-sponsor-176px.png)](https://github.com/sponsors/streetsidesoftware) [![PayPal](https://cspell.org/img/sponsor/paypal-176px.png)](https://www.paypal.com/donate/?hosted_button_id=26LNBP2Q6MKCY) [![Open Collective](https://cspell.org/img/sponsor/open-collective-176px.png)](https://opencollective.com/cspell) [![CSpell](https://cspell.org/img/sponsor/cspell-176px.png)](https://streetsidesoftware.com/sponsor/)
16
16
 
17
17
  <!--- @@inject-end: ../../static/sponsor.md --->
18
18
 
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-Chs3KBum.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-DwEtcnHu.js";
2
2
  import { Link } from "cspell-lib";
3
3
  import chalk from "chalk";
4
4
  import * as iPath from "node:path";
@@ -6,29 +6,58 @@ import { Option, program } from "commander";
6
6
  import { satisfies } from "semver";
7
7
  //#region src/commandCheck.ts
8
8
  function commandCheck(prog) {
9
- return prog.command("check <files...>").description("Spell check file(s) and display the result. The full file is displayed in color.").option("-c, --config <cspell.json>", "Configuration file to use. By default cspell looks for cspell.json in the current directory.").option("--validate-directives", "Validate in-document CSpell directives.").option("--no-validate-directives", "Do not validate in-document CSpell directives.").option("--no-color", "Turn off color.").option("--color", "Force color").option("--no-exit-code", "Do not return an exit code if issues are found.").addOption(new Option("--default-configuration", "Load the default configuration and dictionaries.").hideHelp()).addOption(new Option("--no-default-configuration", "Do not load the default configuration and dictionaries.")).action(async (files, options) => {
9
+ return prog.command("check <files...>").description("Spell check file(s) and display the result. The full file is displayed in color.").option("-c, --config <cspell.json>", "Configuration file to use. By default cspell looks for cspell.json in the current directory.").option("--validate-directives", "Validate in-document CSpell directives.").option("--no-validate-directives", "Do not validate in-document CSpell directives.").option("--no-color", "Turn off color.").option("--color", "Force color").option("--json", "Output results in JSON format.").option("--no-exit-code", "Do not return an exit code if issues are found.").addOption(new Option("--default-configuration", "Load the default configuration and dictionaries.").hideHelp()).addOption(new Option("--no-default-configuration", "Do not load the default configuration and dictionaries.")).action(async (files, options) => {
10
10
  const useExitCode = options.exitCode ?? true;
11
11
  parseApplicationFeatureFlags(options.flag);
12
- let issueCount = 0;
13
- for (const filename of files) {
14
- console.log(chalk.yellowBright(`Check file: ${filename}`));
15
- console.log();
16
- try {
17
- const result = await checkText(filename, options);
18
- for (const item of result.items) {
19
- const t = (item.flagIE === IncludeExcludeFlag.EXCLUDE ? chalk.gray : item.isError ? chalk.red : chalk.whiteBright)(item.text);
20
- process.stdout.write(t);
21
- issueCount += item.isError ? 1 : 0;
22
- }
23
- console.log();
24
- } catch {
25
- console.error(`File not found "${filename}"`);
26
- throw new CheckFailed("File not found", 1);
12
+ if (options.json ? await processRequestJSON(files, options) : await processRequestAnsi(files, options)) throw new CheckFailed("Issues found", useExitCode ?? true ? 1 : 0);
13
+ });
14
+ }
15
+ async function processRequestAnsi(files, options) {
16
+ let issueCount = 0;
17
+ for (const filename of files) {
18
+ console.log(chalk.yellowBright(`Check file: ${filename}`));
19
+ console.log();
20
+ try {
21
+ const result = await checkText(filename, options);
22
+ for (const item of result.items) {
23
+ const t = (item.flagIE === IncludeExcludeFlag.EXCLUDE ? chalk.gray : item.isError ? chalk.red : chalk.whiteBright)(item.text);
24
+ process.stdout.write(t);
25
+ issueCount += item.isError ? 1 : 0;
27
26
  }
28
27
  console.log();
28
+ } catch (e) {
29
+ const message = isErrNoEnt(e) ? "File not found" : String(e);
30
+ console.error(`${message} "${filename}"`);
31
+ throw new CheckFailed(message, 1);
29
32
  }
30
- if (issueCount) throw new CheckFailed("Issues found", useExitCode ?? true ? 1 : 0);
31
- });
33
+ console.log();
34
+ }
35
+ return issueCount;
36
+ }
37
+ async function processRequestJSON(files, options) {
38
+ let issueCount = 0;
39
+ const results = [];
40
+ for (const filename of files) try {
41
+ const result = await checkText(filename, options);
42
+ results.push({
43
+ filename,
44
+ items: result.items
45
+ });
46
+ for (const item of result.items) issueCount += item.isError ? 1 : 0;
47
+ } catch (e) {
48
+ const message = isErrNoEnt(e) ? "File not found" : String(e);
49
+ results.push({
50
+ filename,
51
+ error: message
52
+ });
53
+ console.log(JSON.stringify(results, void 0, 2));
54
+ throw new CheckFailed(message, 1);
55
+ }
56
+ console.log(JSON.stringify(results, void 0, 2));
57
+ return issueCount;
58
+ }
59
+ function isErrNoEnt(error) {
60
+ return error?.code === "ENOENT";
32
61
  }
33
62
  //#endregion
34
63
  //#region src/commandHelpers.ts
@@ -1213,7 +1213,7 @@ try {
1213
1213
  const pkgDir = _dirname;
1214
1214
  const npmPackage = {
1215
1215
  name: "cspell",
1216
- version: "10.3.2",
1216
+ version: "10.3.4-alpha.0",
1217
1217
  engines: { node: ">=22.18.0" }
1218
1218
  };
1219
1219
  //#endregion
@@ -3532,4 +3532,4 @@ function parseApplicationFeatureFlags(flags) {
3532
3532
  //#endregion
3533
3533
  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 };
3534
3534
 
3535
- //# sourceMappingURL=application-Chs3KBum.js.map
3535
+ //# sourceMappingURL=application-DwEtcnHu.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-Chs3KBum.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-DwEtcnHu.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-Chs3KBum.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-DwEtcnHu.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,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell",
3
- "version": "10.3.2",
3
+ "version": "10.3.4-alpha.0",
4
4
  "description": "A Spelling Checker for Code!",
5
5
  "funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
6
6
  "bin": {
@@ -90,23 +90,23 @@
90
90
  },
91
91
  "homepage": "https://cspell.org/",
92
92
  "dependencies": {
93
- "@cspell/cspell-json-reporter": "10.3.2",
94
- "@cspell/cspell-performance-monitor": "10.3.2",
95
- "@cspell/cspell-pipe": "10.3.2",
96
- "@cspell/cspell-types": "10.3.2",
97
- "@cspell/cspell-worker": "10.3.2",
98
- "@cspell/dynamic-import": "10.3.2",
99
- "@cspell/url": "10.3.2",
93
+ "@cspell/cspell-json-reporter": "10.3.4-alpha.0",
94
+ "@cspell/cspell-performance-monitor": "10.3.4-alpha.0",
95
+ "@cspell/cspell-pipe": "10.3.4-alpha.0",
96
+ "@cspell/cspell-types": "10.3.4-alpha.0",
97
+ "@cspell/cspell-worker": "10.3.4-alpha.0",
98
+ "@cspell/dynamic-import": "10.3.4-alpha.0",
99
+ "@cspell/url": "10.3.4-alpha.0",
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.2",
105
- "cspell-dictionary": "10.3.2",
106
- "cspell-gitignore": "10.3.2",
107
- "cspell-glob": "10.3.2",
108
- "cspell-io": "10.3.2",
109
- "cspell-lib": "10.3.2",
104
+ "cspell-config-lib": "10.3.4-alpha.0",
105
+ "cspell-dictionary": "10.3.4-alpha.0",
106
+ "cspell-gitignore": "10.3.4-alpha.0",
107
+ "cspell-glob": "10.3.4-alpha.0",
108
+ "cspell-io": "10.3.4-alpha.0",
109
+ "cspell-lib": "10.3.4-alpha.0",
110
110
  "flatted": "^3.4.4",
111
111
  "semver": "^7.8.5",
112
112
  "tinyglobby": "^0.2.17"
@@ -120,5 +120,5 @@
120
120
  "micromatch": "^4.0.8",
121
121
  "minimatch": "^9.0.9"
122
122
  },
123
- "gitHead": "d43b5ffd5fbb295fcfd06358cdfc7560b3a84a7f"
123
+ "gitHead": "f52ee7e2f24189eaf8fb5139c0b029c8cb80fc57"
124
124
  }