cspell 8.15.7 → 8.16.1
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 +4 -3
- package/dist/esm/cli-reporter.d.ts +1 -1
- package/dist/esm/cli-reporter.js +5 -2
- package/dist/esm/commandLint.js +7 -6
- package/dist/esm/commandTrace.js +5 -2
- package/dist/esm/emitters/traceEmitter.d.ts +1 -0
- package/dist/esm/emitters/traceEmitter.js +6 -0
- package/dist/esm/options.d.ts +6 -0
- package/dist/esm/pkgInfo.d.ts +1 -1
- package/dist/esm/pkgInfo.js +1 -1
- package/dist/esm/util/cache/createCache.js +1 -1
- package/dist/esm/util/canUseColor.d.ts +2 -0
- package/dist/esm/util/canUseColor.js +10 -0
- package/package.json +12 -12
package/README.md
CHANGED
|
@@ -170,7 +170,8 @@ Options:
|
|
|
170
170
|
--no-cache Do not use cache.
|
|
171
171
|
--cache-reset Reset the cache file.
|
|
172
172
|
--cache-strategy <strategy> Strategy to use for detecting changed files.
|
|
173
|
-
(choices: "
|
|
173
|
+
(choices: "content", "metadata", default:
|
|
174
|
+
"content")
|
|
174
175
|
--cache-location <path> Path to the cache file or directory. (default:
|
|
175
176
|
".cspellcache")
|
|
176
177
|
--dot Include files and directories starting with `.`
|
|
@@ -181,8 +182,8 @@ Options:
|
|
|
181
182
|
--gitignore-root <path> Prevent searching for .gitignore files past
|
|
182
183
|
root.
|
|
183
184
|
--validate-directives Validate in-document CSpell directives.
|
|
184
|
-
--no-color Turn off color.
|
|
185
185
|
--color Force color.
|
|
186
|
+
--no-color Turn off color.
|
|
186
187
|
--no-default-configuration Do not load the default configuration and
|
|
187
188
|
dictionaries.
|
|
188
189
|
--debug Output information useful for debugging
|
|
@@ -272,8 +273,8 @@ Options:
|
|
|
272
273
|
--stdin Read words from stdin.
|
|
273
274
|
--all Show all dictionaries.
|
|
274
275
|
--only-found Show only dictionaries that have the words.
|
|
276
|
+
--color Force color.
|
|
275
277
|
--no-color Turn off color.
|
|
276
|
-
--color Force color
|
|
277
278
|
--no-default-configuration Do not load the default configuration and
|
|
278
279
|
dictionaries.
|
|
279
280
|
-h, --help display help for command
|
|
@@ -25,7 +25,7 @@ export interface ReporterIssue extends Issue {
|
|
|
25
25
|
interface IOChalk {
|
|
26
26
|
readonly chalk: ChalkInstance;
|
|
27
27
|
}
|
|
28
|
-
export interface ReporterOptions extends Pick<LinterCliOptions, 'debug' | 'issues' | 'issuesSummaryReport' | 'legacy' | 'progress' | 'relative' | 'root' | 'showContext' | 'showPerfSummary' | 'showSuggestions' | 'silent' | 'summary' | 'verbose' | 'wordsOnly'> {
|
|
28
|
+
export interface ReporterOptions extends Pick<LinterCliOptions, 'color' | 'debug' | 'issues' | 'issuesSummaryReport' | 'legacy' | 'progress' | 'relative' | 'root' | 'showContext' | 'showPerfSummary' | 'showSuggestions' | 'silent' | 'summary' | 'verbose' | 'wordsOnly'> {
|
|
29
29
|
fileGlobs: string[];
|
|
30
30
|
}
|
|
31
31
|
export declare function getReporter(options: ReporterOptions, config?: CSpellReporterConfiguration): FinalizedReporter;
|
package/dist/esm/cli-reporter.js
CHANGED
|
@@ -107,6 +107,8 @@ export function getReporter(options, config) {
|
|
|
107
107
|
elapsedTimeMs: 0,
|
|
108
108
|
perf: Object.create(null),
|
|
109
109
|
};
|
|
110
|
+
const noColor = options.color === false;
|
|
111
|
+
const forceColor = options.color === true;
|
|
110
112
|
const uniqueIssues = config?.unique || false;
|
|
111
113
|
const defaultIssueTemplate = options.wordsOnly
|
|
112
114
|
? templateIssueWordsOnly
|
|
@@ -125,13 +127,14 @@ export function getReporter(options, config) {
|
|
|
125
127
|
const issueTemplate = config?.issueTemplate || defaultIssueTemplate;
|
|
126
128
|
assertCheckTemplate(issueTemplate);
|
|
127
129
|
const console = config?.console || customConsole;
|
|
130
|
+
const colorLevel = noColor ? 0 : forceColor ? 2 : console.stdoutChannel.getColorLevel();
|
|
128
131
|
const stdio = {
|
|
129
132
|
...console.stdoutChannel,
|
|
130
|
-
chalk: new Chalk({ level:
|
|
133
|
+
chalk: new Chalk({ level: colorLevel }),
|
|
131
134
|
};
|
|
132
135
|
const stderr = {
|
|
133
136
|
...console.stderrChannel,
|
|
134
|
-
chalk: new Chalk({ level:
|
|
137
|
+
chalk: new Chalk({ level: colorLevel }),
|
|
135
138
|
};
|
|
136
139
|
const consoleError = (msg) => stderr.writeLine(msg);
|
|
137
140
|
function createInfoLog(wrap) {
|
package/dist/esm/commandLint.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Option as CommanderOption } from 'commander';
|
|
2
2
|
import * as App from './application.mjs';
|
|
3
3
|
import { DEFAULT_CACHE_LOCATION } from './util/cache/index.js';
|
|
4
|
+
import { canUseColor } from './util/canUseColor.js';
|
|
4
5
|
import { CheckFailed } from './util/errors.js';
|
|
5
6
|
import { unindent } from './util/unindent.js';
|
|
6
7
|
// interface InitOptions extends Options {}
|
|
@@ -105,10 +106,9 @@ export function commandLint(prog) {
|
|
|
105
106
|
.option('--cache', 'Use cache to only check changed files.')
|
|
106
107
|
.option('--no-cache', 'Do not use cache.')
|
|
107
108
|
.option('--cache-reset', 'Reset the cache file.')
|
|
108
|
-
.addOption(crOpt('--cache-strategy <strategy>', 'Strategy to use for detecting changed files.')
|
|
109
|
-
'metadata'
|
|
110
|
-
'content'
|
|
111
|
-
]))
|
|
109
|
+
.addOption(crOpt('--cache-strategy <strategy>', 'Strategy to use for detecting changed files.')
|
|
110
|
+
.choices(['content', 'metadata'])
|
|
111
|
+
.default('content'))
|
|
112
112
|
.option('--cache-location <path>', `Path to the cache file or directory. (default: "${DEFAULT_CACHE_LOCATION}")`)
|
|
113
113
|
.option('--dot', 'Include files and directories starting with `.` (period) when matching globs.')
|
|
114
114
|
.option('--gitignore', 'Ignore files matching glob patterns found in .gitignore files.')
|
|
@@ -116,8 +116,8 @@ export function commandLint(prog) {
|
|
|
116
116
|
.option('--gitignore-root <path>', 'Prevent searching for .gitignore files past root.', collect)
|
|
117
117
|
.option('--validate-directives', 'Validate in-document CSpell directives.')
|
|
118
118
|
.addOption(crOpt('--no-validate-directives', 'Do not validate in-document CSpell directives.').hideHelp())
|
|
119
|
-
.
|
|
120
|
-
.
|
|
119
|
+
.addOption(crOpt('--color', 'Force color.').default(undefined))
|
|
120
|
+
.addOption(crOpt('--no-color', 'Turn off color.').default(undefined))
|
|
121
121
|
.addOption(crOpt('--default-configuration', 'Load the default configuration and dictionaries.').hideHelp())
|
|
122
122
|
.addOption(crOpt('--no-default-configuration', 'Do not load the default configuration and dictionaries.'))
|
|
123
123
|
.option('--debug', 'Output information useful for debugging cspell.json files.')
|
|
@@ -141,6 +141,7 @@ export function commandLint(prog) {
|
|
|
141
141
|
if (options.skipValidation) {
|
|
142
142
|
options.cache = false;
|
|
143
143
|
}
|
|
144
|
+
options.color ??= canUseColor(options.color);
|
|
144
145
|
App.parseApplicationFeatureFlags(options.flag);
|
|
145
146
|
const { mustFindFiles, fileList, files, file } = options;
|
|
146
147
|
const result = await App.lint(fileGlobs, options);
|
package/dist/esm/commandTrace.js
CHANGED
|
@@ -3,6 +3,7 @@ import * as App from './application.mjs';
|
|
|
3
3
|
import { console } from './console.js';
|
|
4
4
|
import { isDictionaryPathFormat } from './emitters/DictionaryPathFormat.js';
|
|
5
5
|
import { emitTraceResults } from './emitters/traceEmitter.js';
|
|
6
|
+
import { canUseColor } from './util/canUseColor.js';
|
|
6
7
|
import { CheckFailed } from './util/errors.js';
|
|
7
8
|
export function commandTrace(prog) {
|
|
8
9
|
return prog
|
|
@@ -23,8 +24,8 @@ export function commandTrace(prog) {
|
|
|
23
24
|
.option('--stdin', 'Read words from stdin.')
|
|
24
25
|
.option('--all', 'Show all dictionaries.')
|
|
25
26
|
.addOption(new CommanderOption('--only-found', 'Show only dictionaries that have the words.').conflicts('all'))
|
|
26
|
-
.
|
|
27
|
-
.
|
|
27
|
+
.addOption(new CommanderOption('--color', 'Force color.').default(undefined))
|
|
28
|
+
.addOption(new CommanderOption('--no-color', 'Turn off color.').default(undefined))
|
|
28
29
|
.addOption(new CommanderOption('--default-configuration', 'Load the default configuration and dictionaries.').hideHelp())
|
|
29
30
|
.addOption(new CommanderOption('--no-default-configuration', 'Do not load the default configuration and dictionaries.'))
|
|
30
31
|
.arguments('[words...]')
|
|
@@ -35,6 +36,7 @@ export function commandTrace(prog) {
|
|
|
35
36
|
? options.dictionaryPath
|
|
36
37
|
: 'long';
|
|
37
38
|
let prefix = '';
|
|
39
|
+
const useColor = canUseColor(options.color);
|
|
38
40
|
for await (const results of App.trace(words, options)) {
|
|
39
41
|
const byWord = groupBy(results, (r) => r.word);
|
|
40
42
|
for (const split of results.splits) {
|
|
@@ -45,6 +47,7 @@ export function commandTrace(prog) {
|
|
|
45
47
|
dictionaryPathFormat,
|
|
46
48
|
prefix,
|
|
47
49
|
showWordFound: results.splits.length > 1,
|
|
50
|
+
color: useColor,
|
|
48
51
|
});
|
|
49
52
|
prefix = '\n';
|
|
50
53
|
numFound += results.reduce((n, r) => n + (r.found ? 1 : 0), 0);
|
|
@@ -13,6 +13,7 @@ export interface EmitTraceOptions {
|
|
|
13
13
|
iPath?: PathInterface;
|
|
14
14
|
prefix?: string;
|
|
15
15
|
showWordFound?: boolean;
|
|
16
|
+
color?: boolean | undefined;
|
|
16
17
|
}
|
|
17
18
|
export declare function emitTraceResults(word: string, found: boolean, results: TraceResult[], options: EmitTraceOptions): void;
|
|
18
19
|
export declare function calcTraceResultsReport(word: string, found: boolean, results: TraceResult[], options: EmitTraceOptions): {
|
|
@@ -13,6 +13,12 @@ export function emitTraceResults(word, found, results, options) {
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
export function calcTraceResultsReport(word, found, results, options) {
|
|
16
|
+
if (options.color === true) {
|
|
17
|
+
chalk.level = 2;
|
|
18
|
+
}
|
|
19
|
+
else if (options.color === false) {
|
|
20
|
+
chalk.level = 0;
|
|
21
|
+
}
|
|
16
22
|
const col = new Intl.Collator();
|
|
17
23
|
results.sort((a, b) => col.compare(a.dictName, b.dictName));
|
|
18
24
|
options.showWordFound && console.log(`${options.prefix || ''}${word}: ${found ? 'Found' : 'Not Found'}`);
|
package/dist/esm/options.d.ts
CHANGED
|
@@ -173,6 +173,12 @@ export interface BaseOptions {
|
|
|
173
173
|
* Flags are of the form key:value
|
|
174
174
|
*/
|
|
175
175
|
flag?: string[];
|
|
176
|
+
/**
|
|
177
|
+
* Use color in the output.
|
|
178
|
+
* `true` to force color, `false` to turn off color.
|
|
179
|
+
* `undefined` to use color if the output is a TTY.
|
|
180
|
+
*/
|
|
181
|
+
color?: boolean | undefined;
|
|
176
182
|
}
|
|
177
183
|
export interface LinterCliOptions extends LinterOptions {
|
|
178
184
|
/**
|
package/dist/esm/pkgInfo.d.ts
CHANGED
package/dist/esm/pkgInfo.js
CHANGED
|
@@ -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.
|
|
4
|
+
export const version = '8.16.1';
|
|
5
5
|
export const engines = { node: '>=18' };
|
|
6
6
|
export const npmPackage = { name, version, engines };
|
|
7
7
|
//# sourceMappingURL=pkgInfo.js.map
|
|
@@ -24,7 +24,7 @@ export async function calcCacheSettings(config, cacheOptions, root) {
|
|
|
24
24
|
const cs = config.cache ?? {};
|
|
25
25
|
const useCache = cacheOptions.cache ?? cs.useCache ?? false;
|
|
26
26
|
const cacheLocation = await resolveCacheLocation(path.resolve(root, cacheOptions.cacheLocation ?? cs.cacheLocation ?? DEFAULT_CACHE_LOCATION));
|
|
27
|
-
const cacheStrategy = cacheOptions.cacheStrategy ?? cs.cacheStrategy ?? '
|
|
27
|
+
const cacheStrategy = cacheOptions.cacheStrategy ?? cs.cacheStrategy ?? 'content';
|
|
28
28
|
const cacheFormat = cacheOptions.cacheFormat ?? cs.cacheFormat ?? 'universal';
|
|
29
29
|
const optionals = {};
|
|
30
30
|
if (cacheOptions.cacheReset) {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export function canUseColor(colorOption) {
|
|
2
|
+
if (colorOption !== undefined)
|
|
3
|
+
return colorOption;
|
|
4
|
+
if (!('NO_COLOR' in process.env))
|
|
5
|
+
return undefined;
|
|
6
|
+
if (!process.env['NO_COLOR'] || process.env['NO_COLOR'] === 'false')
|
|
7
|
+
return undefined;
|
|
8
|
+
return false;
|
|
9
|
+
}
|
|
10
|
+
//# sourceMappingURL=canUseColor.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell",
|
|
3
|
-
"version": "8.
|
|
3
|
+
"version": "8.16.1",
|
|
4
4
|
"description": "A Spelling Checker for Code!",
|
|
5
5
|
"funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
|
|
6
6
|
"bin": {
|
|
@@ -81,19 +81,19 @@
|
|
|
81
81
|
},
|
|
82
82
|
"homepage": "https://cspell.org/",
|
|
83
83
|
"dependencies": {
|
|
84
|
-
"@cspell/cspell-json-reporter": "8.
|
|
85
|
-
"@cspell/cspell-pipe": "8.
|
|
86
|
-
"@cspell/cspell-types": "8.
|
|
87
|
-
"@cspell/dynamic-import": "8.
|
|
88
|
-
"@cspell/url": "8.
|
|
84
|
+
"@cspell/cspell-json-reporter": "8.16.1",
|
|
85
|
+
"@cspell/cspell-pipe": "8.16.1",
|
|
86
|
+
"@cspell/cspell-types": "8.16.1",
|
|
87
|
+
"@cspell/dynamic-import": "8.16.1",
|
|
88
|
+
"@cspell/url": "8.16.1",
|
|
89
89
|
"chalk": "^5.3.0",
|
|
90
90
|
"chalk-template": "^1.1.0",
|
|
91
91
|
"commander": "^12.1.0",
|
|
92
|
-
"cspell-dictionary": "8.
|
|
93
|
-
"cspell-gitignore": "8.
|
|
94
|
-
"cspell-glob": "8.
|
|
95
|
-
"cspell-io": "8.
|
|
96
|
-
"cspell-lib": "8.
|
|
92
|
+
"cspell-dictionary": "8.16.1",
|
|
93
|
+
"cspell-gitignore": "8.16.1",
|
|
94
|
+
"cspell-glob": "8.16.1",
|
|
95
|
+
"cspell-io": "8.16.1",
|
|
96
|
+
"cspell-lib": "8.16.1",
|
|
97
97
|
"fast-json-stable-stringify": "^2.1.0",
|
|
98
98
|
"file-entry-cache": "^9.1.0",
|
|
99
99
|
"get-stdin": "^9.0.0",
|
|
@@ -111,5 +111,5 @@
|
|
|
111
111
|
"micromatch": "^4.0.8",
|
|
112
112
|
"minimatch": "^9.0.5"
|
|
113
113
|
},
|
|
114
|
-
"gitHead": "
|
|
114
|
+
"gitHead": "773bb6e701ff0b7fbeb30e4621119bb4315415ad"
|
|
115
115
|
}
|