cspell 5.18.0 → 5.18.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/dist/application.d.ts +3 -2
- package/dist/application.js +22 -4
- package/dist/cli-reporter.js +19 -3
- package/dist/commandSuggestion.js +2 -1
- package/dist/emitters/suggestionsEmitter.d.ts +4 -1
- package/dist/emitters/suggestionsEmitter.js +9 -5
- package/dist/emitters/traceEmitter.js +2 -2
- package/dist/lint/lint.js +12 -5
- package/dist/options.d.ts +4 -0
- package/dist/repl/index.d.ts +18 -0
- package/dist/repl/index.js +71 -0
- package/dist/util/InMemoryReporter.d.ts +2 -2
- package/dist/util/util.d.ts +2 -0
- package/dist/util/util.js +17 -5
- package/package.json +12 -12
package/dist/application.d.ts
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { CSpellReporter, RunResult } from '@cspell/cspell-types';
|
|
3
|
-
import type { CheckTextInfo,
|
|
3
|
+
import type { CheckTextInfo, TraceResult } from 'cspell-lib';
|
|
4
|
+
import { TimedSuggestionsForWordResult } from './emitters/suggestionsEmitter';
|
|
4
5
|
import { BaseOptions, LegacyOptions, LinterOptions, SuggestionOptions, TraceOptions } from './options';
|
|
5
6
|
export { IncludeExcludeFlag } from 'cspell-lib';
|
|
6
7
|
export type { TraceResult } from 'cspell-lib';
|
|
@@ -9,6 +10,6 @@ export declare function lint(fileGlobs: string[], options: LinterOptions, emitte
|
|
|
9
10
|
export declare function trace(words: string[], options: TraceOptions): AsyncIterableIterator<TraceResult[]>;
|
|
10
11
|
export declare type CheckTextResult = CheckTextInfo;
|
|
11
12
|
export declare function checkText(filename: string, options: BaseOptions & LegacyOptions): Promise<CheckTextResult>;
|
|
12
|
-
export declare function suggestions(words: string[], options: SuggestionOptions): AsyncIterable<
|
|
13
|
+
export declare function suggestions(words: string[], options: SuggestionOptions): AsyncIterable<TimedSuggestionsForWordResult>;
|
|
13
14
|
export declare function createInit(): Promise<void>;
|
|
14
15
|
//# sourceMappingURL=application.d.ts.map
|
package/dist/application.js
CHANGED
|
@@ -20,13 +20,15 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.createInit = exports.suggestions = exports.checkText = exports.trace = exports.lint = exports.IncludeExcludeFlag = void 0;
|
|
23
|
+
const cspell_pipe_1 = require("@cspell/cspell-pipe");
|
|
23
24
|
const cspell_lib_1 = require("cspell-lib");
|
|
24
25
|
const path = __importStar(require("path"));
|
|
25
26
|
const lint_1 = require("./lint");
|
|
26
27
|
const options_1 = require("./options");
|
|
27
|
-
const
|
|
28
|
+
const repl_1 = require("./repl");
|
|
28
29
|
const fileHelper_1 = require("./util/fileHelper");
|
|
29
30
|
const stdin_1 = require("./util/stdin");
|
|
31
|
+
const timer_1 = require("./util/timer");
|
|
30
32
|
const util = __importStar(require("./util/util"));
|
|
31
33
|
var cspell_lib_2 = require("cspell-lib");
|
|
32
34
|
Object.defineProperty(exports, "IncludeExcludeFlag", { enumerable: true, get: function () { return cspell_lib_2.IncludeExcludeFlag; } });
|
|
@@ -38,7 +40,7 @@ function lint(fileGlobs, options, emitters) {
|
|
|
38
40
|
exports.lint = lint;
|
|
39
41
|
async function* trace(words, options) {
|
|
40
42
|
options = (0, options_1.fixLegacy)(options);
|
|
41
|
-
const iWords = options.stdin ?
|
|
43
|
+
const iWords = options.stdin ? (0, cspell_pipe_1.toAsyncIterable)(words, (0, stdin_1.readStdin)()) : words;
|
|
42
44
|
const { languageId, locale, allowCompoundWords, ignoreCase } = options;
|
|
43
45
|
const configFile = await (0, fileHelper_1.readConfig)(options.config, undefined);
|
|
44
46
|
const config = (0, cspell_lib_1.mergeSettings)((0, cspell_lib_1.getDefaultSettings)(), (0, cspell_lib_1.getGlobalSettings)(), configFile.config);
|
|
@@ -60,9 +62,25 @@ exports.checkText = checkText;
|
|
|
60
62
|
async function* suggestions(words, options) {
|
|
61
63
|
options = (0, options_1.fixLegacy)(options);
|
|
62
64
|
const configFile = await (0, fileHelper_1.readConfig)(options.config, undefined);
|
|
63
|
-
|
|
65
|
+
let timer;
|
|
66
|
+
function tapStart() {
|
|
67
|
+
timer = (0, timer_1.getTimeMeasurer)();
|
|
68
|
+
}
|
|
69
|
+
function mapStart(v) {
|
|
70
|
+
tapStart();
|
|
71
|
+
return v;
|
|
72
|
+
}
|
|
73
|
+
function mapEnd(v) {
|
|
74
|
+
const elapsedTimeMs = timer === null || timer === void 0 ? void 0 : timer();
|
|
75
|
+
return { ...v, elapsedTimeMs };
|
|
76
|
+
}
|
|
77
|
+
const iWords = options.repl
|
|
78
|
+
? (0, cspell_pipe_1.pipeAsync)((0, cspell_pipe_1.toAsyncIterable)(words, (0, repl_1.simpleRepl)()), (0, cspell_pipe_1.opTap)(tapStart))
|
|
79
|
+
: options.useStdin
|
|
80
|
+
? (0, cspell_pipe_1.pipeAsync)((0, cspell_pipe_1.toAsyncIterable)(words, (0, stdin_1.readStdin)()), (0, cspell_pipe_1.opTap)(tapStart))
|
|
81
|
+
: words.map(mapStart);
|
|
64
82
|
try {
|
|
65
|
-
const results = (0, cspell_lib_1.suggestionsForWords)(iWords, options, configFile.config);
|
|
83
|
+
const results = (0, cspell_pipe_1.pipeAsync)((0, cspell_lib_1.suggestionsForWords)(iWords, options, configFile.config), (0, cspell_pipe_1.opMap)(mapEnd));
|
|
66
84
|
yield* results;
|
|
67
85
|
}
|
|
68
86
|
catch (e) {
|
package/dist/cli-reporter.js
CHANGED
|
@@ -66,9 +66,21 @@ function relativeUriFilename(uri, fsPathRoot) {
|
|
|
66
66
|
return '.' + path.sep + rel;
|
|
67
67
|
}
|
|
68
68
|
function reportProgress(p) {
|
|
69
|
-
if (p.type
|
|
70
|
-
return;
|
|
69
|
+
if (p.type === 'ProgressFileComplete') {
|
|
70
|
+
return reportProgressFileComplete(p);
|
|
71
71
|
}
|
|
72
|
+
if (p.type === 'ProgressFileBegin') {
|
|
73
|
+
return reportProgressFileBegin(p);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function reportProgressFileBegin(p) {
|
|
77
|
+
const fc = '' + p.fileCount;
|
|
78
|
+
const fn = (' '.repeat(fc.length) + p.fileNum).slice(-fc.length);
|
|
79
|
+
const idx = fn + '/' + fc;
|
|
80
|
+
const filename = chalk.gray(relativeFilename(p.filename));
|
|
81
|
+
process.stderr.write(`\r${idx} ${filename} ...`);
|
|
82
|
+
}
|
|
83
|
+
function reportProgressFileComplete(p) {
|
|
72
84
|
const fc = '' + p.fileCount;
|
|
73
85
|
const fn = (' '.repeat(fc.length) + p.fileNum).slice(-fc.length);
|
|
74
86
|
const idx = fn + '/' + fc;
|
|
@@ -76,7 +88,7 @@ function reportProgress(p) {
|
|
|
76
88
|
const time = reportTime(p.elapsedTimeMs, !!p.cached);
|
|
77
89
|
const skipped = p.processed === false ? ' skipped' : '';
|
|
78
90
|
const hasErrors = p.numErrors ? chalk.red ` X` : '';
|
|
79
|
-
console.error(
|
|
91
|
+
console.error(`\r${idx} ${filename} ${time}${skipped}${hasErrors}`);
|
|
80
92
|
}
|
|
81
93
|
function reportTime(elapsedTimeMs, cached) {
|
|
82
94
|
if (cached)
|
|
@@ -124,6 +136,10 @@ function getReporter(options) {
|
|
|
124
136
|
if (!fileGlobs.length && !result.files) {
|
|
125
137
|
return;
|
|
126
138
|
}
|
|
139
|
+
if (result.cachedFiles) {
|
|
140
|
+
console.error('CSpell: Files checked: %d (%d from cache), Issues found: %d in %d files', result.files, result.cachedFiles, result.issues, result.filesWithIssues.size);
|
|
141
|
+
return;
|
|
142
|
+
}
|
|
127
143
|
console.error('CSpell: Files checked: %d, Issues found: %d in %d files', result.files, result.issues, result.filesWithIssues.size);
|
|
128
144
|
};
|
|
129
145
|
return {
|
|
@@ -53,6 +53,7 @@ function commandSuggestion(prog) {
|
|
|
53
53
|
.option('--num-suggestions <number>', 'Number of suggestions', asNumber, 8)
|
|
54
54
|
.option('--no-include-ties', 'Force the number of suggested to be limited, by not including suggestions that have the same edit cost.')
|
|
55
55
|
.option('--stdin', 'Use stdin for input.')
|
|
56
|
+
.addOption(new commander_1.Option('--repl', 'REPL interface for looking up suggestions.').hideHelp())
|
|
56
57
|
.option('-v, --verbose', 'Show detailed output.', count, 0)
|
|
57
58
|
.option('-d, --dictionary <dictionary name>', 'Use the dictionary specified. Only dictionaries specified will be used.', collect)
|
|
58
59
|
.option('--dictionaries <dictionary names...>', 'Use the dictionaries specified. Only dictionaries specified will be used.')
|
|
@@ -62,7 +63,7 @@ function commandSuggestion(prog) {
|
|
|
62
63
|
.action(async (words, options) => {
|
|
63
64
|
options.useStdin = options.stdin;
|
|
64
65
|
options.dictionaries = mergeArrays(options.dictionaries, options.dictionary);
|
|
65
|
-
if (!words.length && !options.useStdin) {
|
|
66
|
+
if (!words.length && !options.useStdin && !options.repl) {
|
|
66
67
|
suggestionCommand.outputHelp();
|
|
67
68
|
throw new errors_1.CheckFailed('outputHelp', 1);
|
|
68
69
|
}
|
|
@@ -6,5 +6,8 @@ export interface EmitSuggestionOptions {
|
|
|
6
6
|
log: (text: string) => void;
|
|
7
7
|
};
|
|
8
8
|
}
|
|
9
|
-
export
|
|
9
|
+
export interface TimedSuggestionsForWordResult extends SuggestionsForWordResult {
|
|
10
|
+
elapsedTimeMs?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare function emitSuggestionResult(result: TimedSuggestionsForWordResult, options: EmitSuggestionOptions): void;
|
|
10
13
|
//# sourceMappingURL=suggestionsEmitter.d.ts.map
|
|
@@ -6,21 +6,25 @@ const util_1 = require("../util/util");
|
|
|
6
6
|
function emitSuggestionResult(result, options) {
|
|
7
7
|
const { word, suggestions } = result;
|
|
8
8
|
const { verbose, output = console } = options;
|
|
9
|
-
|
|
9
|
+
const elapsed = verbose && verbose > 1 && result.elapsedTimeMs ? ` ${result.elapsedTimeMs.toFixed(2)} ms` : '';
|
|
10
|
+
output.log((word ? chalk.yellow(word) : chalk.yellow('<empty>')) + ':' + elapsed);
|
|
10
11
|
if (!suggestions.length) {
|
|
11
12
|
console.log(chalk.yellow(' <no suggestions>'));
|
|
12
13
|
return;
|
|
13
14
|
}
|
|
14
15
|
if (verbose) {
|
|
15
|
-
const maxWidth = suggestions
|
|
16
|
+
const maxWidth = suggestions
|
|
17
|
+
.map((r) => (0, util_1.width)(r.compoundWord || r.word))
|
|
18
|
+
.reduce((max, len) => Math.max(max, len), 0);
|
|
16
19
|
for (const sug of suggestions) {
|
|
17
|
-
const { word, cost, dictionaries } = sug;
|
|
18
|
-
const
|
|
20
|
+
const { word, cost, dictionaries, compoundWord } = sug;
|
|
21
|
+
const w = compoundWord || word;
|
|
22
|
+
const padding = ' '.repeat((0, util_1.padWidth)(w, maxWidth));
|
|
19
23
|
const forbid = sug.forbidden ? chalk.red('X') : ' ';
|
|
20
24
|
const ignore = sug.noSuggest ? chalk.yellow('N') : ' ';
|
|
21
25
|
const strCost = (0, util_1.padLeft)(cost.toString(10), 4);
|
|
22
26
|
const dicts = dictionaries.map((n) => chalk.gray(n)).join(', ');
|
|
23
|
-
output.log(` - ${formatWord(
|
|
27
|
+
output.log(` - ${formatWord(w, sug)}${padding} ${forbid}${ignore} - ${chalk.yellow(strCost)} ${dicts}`);
|
|
24
28
|
}
|
|
25
29
|
}
|
|
26
30
|
else {
|
|
@@ -32,7 +32,7 @@ function emitTraceResults(results, options) {
|
|
|
32
32
|
var _a;
|
|
33
33
|
const maxWordLength = results
|
|
34
34
|
.map((r) => r.foundWord || r.word)
|
|
35
|
-
.reduce((a, b) => Math.max(a,
|
|
35
|
+
.reduce((a, b) => Math.max(a, (0, util_1.width)(b)), 'Word'.length);
|
|
36
36
|
const cols = {
|
|
37
37
|
word: maxWordLength,
|
|
38
38
|
dictName: colWidthDictionaryName,
|
|
@@ -66,7 +66,7 @@ function emitTraceResult(r, colWidths, options) {
|
|
|
66
66
|
const dictColor = r.dictActive ? chalk.yellowBright : chalk.rgb(200, 128, 50);
|
|
67
67
|
const n = dictColor(dictName);
|
|
68
68
|
const info = [w, f, n].join(' ') + ' ';
|
|
69
|
-
const used = (0, strip_ansi_1.default)(info)
|
|
69
|
+
const used = (0, util_1.width)((0, strip_ansi_1.default)(info));
|
|
70
70
|
const widthSrc = terminalWidth - used;
|
|
71
71
|
const c = errors ? chalk.red : chalk.white;
|
|
72
72
|
const s = c(formatDictionaryLocation(r.dictSource, widthSrc, options.cwd));
|
package/dist/lint/lint.js
CHANGED
|
@@ -46,10 +46,11 @@ async function runLint(cfg) {
|
|
|
46
46
|
return lintResult;
|
|
47
47
|
async function processFile(filename, configInfo, cache) {
|
|
48
48
|
var _a, _b, _c, _d;
|
|
49
|
+
const getElapsedTimeMs = (0, timer_1.getTimeMeasurer)();
|
|
49
50
|
const cachedResult = await cache.getCachedLintResults(filename);
|
|
50
51
|
if (cachedResult) {
|
|
51
52
|
reporter.debug(`Filename: ${filename}, using cache`);
|
|
52
|
-
return cachedResult;
|
|
53
|
+
return { ...cachedResult, elapsedTimeMs: getElapsedTimeMs() };
|
|
53
54
|
}
|
|
54
55
|
const result = {
|
|
55
56
|
fileInfo: {
|
|
@@ -74,7 +75,6 @@ async function runLint(cfg) {
|
|
|
74
75
|
const { text } = fileInfo;
|
|
75
76
|
reporter.debug(`Filename: ${filename}, LanguageIds: ${(_a = doc.languageId) !== null && _a !== void 0 ? _a : 'default'}`);
|
|
76
77
|
result.fileInfo = fileInfo;
|
|
77
|
-
const getElapsedTimeMs = (0, timer_1.getTimeMeasurer)();
|
|
78
78
|
let spellResult = {};
|
|
79
79
|
reporter.info(`Checking: ${filename}, File type: ${(_b = doc.languageId) !== null && _b !== void 0 ? _b : 'auto'}, Language: ${(_c = doc.locale) !== null && _c !== void 0 ? _c : 'default'}`, cspell_types_1.MessageTypes.Info);
|
|
80
80
|
try {
|
|
@@ -114,10 +114,16 @@ async function runLint(cfg) {
|
|
|
114
114
|
const status = runResult();
|
|
115
115
|
const cache = (0, cache_1.createCache)(cacheSettings);
|
|
116
116
|
const failFast = (_b = (_a = cfg.options.failFast) !== null && _a !== void 0 ? _a : configInfo.config.failFast) !== null && _b !== void 0 ? _b : false;
|
|
117
|
-
const
|
|
117
|
+
const emitProgressBegin = (filename, fileNum, fileCount) => reporter.progress({
|
|
118
|
+
type: 'ProgressFileBegin',
|
|
119
|
+
fileNum,
|
|
120
|
+
fileCount,
|
|
121
|
+
filename,
|
|
122
|
+
});
|
|
123
|
+
const emitProgressComplete = (filename, fileNum, fileCount, result) => reporter.progress({
|
|
118
124
|
type: 'ProgressFileComplete',
|
|
119
125
|
fileNum,
|
|
120
|
-
fileCount
|
|
126
|
+
fileCount,
|
|
121
127
|
filename,
|
|
122
128
|
elapsedTimeMs: result === null || result === void 0 ? void 0 : result.elapsedTimeMs,
|
|
123
129
|
processed: result === null || result === void 0 ? void 0 : result.processed,
|
|
@@ -128,6 +134,7 @@ async function runLint(cfg) {
|
|
|
128
134
|
let i = 0;
|
|
129
135
|
for await (const filename of files) {
|
|
130
136
|
++i;
|
|
137
|
+
emitProgressBegin(filename, i, fileCount !== null && fileCount !== void 0 ? fileCount : i);
|
|
131
138
|
const result = await processFile(filename, configInfo, cache);
|
|
132
139
|
yield { filename, fileNum: i, result };
|
|
133
140
|
}
|
|
@@ -136,7 +143,7 @@ async function runLint(cfg) {
|
|
|
136
143
|
const { filename, fileNum, result } = await fileP;
|
|
137
144
|
status.files += 1;
|
|
138
145
|
status.cachedFiles = (status.cachedFiles || 0) + (result.cached ? 1 : 0);
|
|
139
|
-
|
|
146
|
+
emitProgressComplete(filename, fileNum, fileCount !== null && fileCount !== void 0 ? fileCount : fileNum, result);
|
|
140
147
|
// Show the spelling errors after emitting the progress.
|
|
141
148
|
result.issues.filter(cfg.uniqueFilter).forEach((issue) => reporter.issue(issue));
|
|
142
149
|
if (result.issues.length || result.errors) {
|
package/dist/options.d.ts
CHANGED
|
@@ -98,6 +98,10 @@ export interface SuggestionOptions extends BaseOptions {
|
|
|
98
98
|
* Use stdin for the input
|
|
99
99
|
*/
|
|
100
100
|
useStdin?: boolean;
|
|
101
|
+
/**
|
|
102
|
+
* Use REPL interface for making suggestions.
|
|
103
|
+
*/
|
|
104
|
+
repl?: boolean;
|
|
101
105
|
}
|
|
102
106
|
export interface LegacyOptions {
|
|
103
107
|
local?: string;
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export declare function simpleRepl(): AsyncIterable<string>;
|
|
2
|
+
export declare type CompleterResult = [string[], string];
|
|
3
|
+
export declare type Completer = (line: string) => CompleterResult;
|
|
4
|
+
export declare class SimpleRepl implements AsyncIterable<string> {
|
|
5
|
+
prompt: string;
|
|
6
|
+
beforeEach: undefined | (() => void);
|
|
7
|
+
completer: undefined | Completer;
|
|
8
|
+
private _history;
|
|
9
|
+
private rl;
|
|
10
|
+
constructor(prompt?: string);
|
|
11
|
+
question(query: string): Promise<string>;
|
|
12
|
+
private _completer;
|
|
13
|
+
get history(): string[];
|
|
14
|
+
[Symbol.asyncIterator](): {
|
|
15
|
+
next: () => Promise<IteratorResult<string, undefined>>;
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } });
|
|
5
|
+
}) : (function(o, m, k, k2) {
|
|
6
|
+
if (k2 === undefined) k2 = k;
|
|
7
|
+
o[k2] = m[k];
|
|
8
|
+
}));
|
|
9
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
10
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
11
|
+
}) : function(o, v) {
|
|
12
|
+
o["default"] = v;
|
|
13
|
+
});
|
|
14
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
15
|
+
if (mod && mod.__esModule) return mod;
|
|
16
|
+
var result = {};
|
|
17
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
18
|
+
__setModuleDefault(result, mod);
|
|
19
|
+
return result;
|
|
20
|
+
};
|
|
21
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
|
+
exports.SimpleRepl = exports.simpleRepl = void 0;
|
|
23
|
+
const readline = __importStar(require("readline"));
|
|
24
|
+
function simpleRepl() {
|
|
25
|
+
return new SimpleRepl();
|
|
26
|
+
}
|
|
27
|
+
exports.simpleRepl = simpleRepl;
|
|
28
|
+
class SimpleRepl {
|
|
29
|
+
constructor(prompt = '> ') {
|
|
30
|
+
this.prompt = prompt;
|
|
31
|
+
this._history = [];
|
|
32
|
+
this.rl = readline.createInterface({
|
|
33
|
+
input: process.stdin,
|
|
34
|
+
output: process.stdout,
|
|
35
|
+
prompt,
|
|
36
|
+
history: this._history,
|
|
37
|
+
historySize: 100,
|
|
38
|
+
completer: (line) => this._completer(line),
|
|
39
|
+
});
|
|
40
|
+
this.rl.on('history', (h) => ((this._history = h), undefined));
|
|
41
|
+
}
|
|
42
|
+
question(query) {
|
|
43
|
+
return new Promise((resolve) => {
|
|
44
|
+
this.rl.question(query, resolve);
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
_completer(line) {
|
|
48
|
+
// console.log('Complete: %s', line);
|
|
49
|
+
// console.log('History: %o', this._history);
|
|
50
|
+
if (this.completer)
|
|
51
|
+
return this.completer(line);
|
|
52
|
+
const hist = this._history.filter((h) => h.startsWith(line));
|
|
53
|
+
return [hist, line];
|
|
54
|
+
}
|
|
55
|
+
get history() {
|
|
56
|
+
return this._history;
|
|
57
|
+
}
|
|
58
|
+
[Symbol.asyncIterator]() {
|
|
59
|
+
const next = () => {
|
|
60
|
+
if (this.beforeEach)
|
|
61
|
+
this.beforeEach();
|
|
62
|
+
// console.log('%o', this.rl);
|
|
63
|
+
return this.question(this.prompt)
|
|
64
|
+
.then((value) => ({ value }))
|
|
65
|
+
.catch(() => ({ done: true, value: undefined }));
|
|
66
|
+
};
|
|
67
|
+
return { next };
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
exports.SimpleRepl = SimpleRepl;
|
|
71
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { CSpellReporter, Issue,
|
|
1
|
+
import type { CSpellReporter, Issue, ProgressItem, RunResult } from '@cspell/cspell-types';
|
|
2
2
|
export interface InMemoryResult {
|
|
3
3
|
log: string[];
|
|
4
4
|
issues: Issue[];
|
|
@@ -21,7 +21,7 @@ export declare class InMemoryReporter implements CSpellReporter, InMemoryResult
|
|
|
21
21
|
error: (message: string, error: Error) => void;
|
|
22
22
|
info: (message: string) => void;
|
|
23
23
|
debug: (message: string) => void;
|
|
24
|
-
progress: (p:
|
|
24
|
+
progress: (p: ProgressItem) => void;
|
|
25
25
|
result: (r: RunResult) => void;
|
|
26
26
|
dump: () => InMemoryResult;
|
|
27
27
|
}
|
package/dist/util/util.d.ts
CHANGED
|
@@ -4,7 +4,9 @@ export declare function uniqueFilterFnGenerator<T>(): FilterFn<T>;
|
|
|
4
4
|
export declare function uniqueFilterFnGenerator<T, U>(extractFn: (v: T) => U): FilterFn<T>;
|
|
5
5
|
export declare function unique<T>(src: T[]): T[];
|
|
6
6
|
export declare function clean<T>(src: T): T;
|
|
7
|
+
export declare function padWidth(s: string, target: number): number;
|
|
7
8
|
export declare function pad(s: string, w: number): string;
|
|
8
9
|
export declare function padLeft(s: string, w: number): string;
|
|
10
|
+
export declare function width(s: string): number;
|
|
9
11
|
export {};
|
|
10
12
|
//# sourceMappingURL=util.d.ts.map
|
package/dist/util/util.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.padLeft = exports.pad = exports.clean = exports.unique = exports.uniqueFilterFnGenerator = exports.uniqueFn = void 0;
|
|
3
|
+
exports.width = exports.padLeft = exports.pad = exports.padWidth = exports.clean = exports.unique = exports.uniqueFilterFnGenerator = exports.uniqueFn = void 0;
|
|
4
4
|
// alias for uniqueFilterFnGenerator
|
|
5
5
|
exports.uniqueFn = uniqueFilterFnGenerator;
|
|
6
6
|
function uniqueFilterFnGenerator(extractFn) {
|
|
@@ -28,16 +28,28 @@ function clean(src) {
|
|
|
28
28
|
return r;
|
|
29
29
|
}
|
|
30
30
|
exports.clean = clean;
|
|
31
|
+
function padWidth(s, target) {
|
|
32
|
+
const sWidth = width(s);
|
|
33
|
+
return Math.max(target - sWidth, 0);
|
|
34
|
+
}
|
|
35
|
+
exports.padWidth = padWidth;
|
|
31
36
|
function pad(s, w) {
|
|
32
|
-
|
|
37
|
+
const p = padWidth(s, w);
|
|
38
|
+
if (!p)
|
|
33
39
|
return s;
|
|
34
|
-
return
|
|
40
|
+
return s + ' '.repeat(p);
|
|
35
41
|
}
|
|
36
42
|
exports.pad = pad;
|
|
37
43
|
function padLeft(s, w) {
|
|
38
|
-
|
|
44
|
+
const p = padWidth(s, w);
|
|
45
|
+
if (!p)
|
|
39
46
|
return s;
|
|
40
|
-
return
|
|
47
|
+
return ' '.repeat(p) + s;
|
|
41
48
|
}
|
|
42
49
|
exports.padLeft = padLeft;
|
|
50
|
+
function width(s) {
|
|
51
|
+
// eslint-disable-next-line no-control-regex
|
|
52
|
+
return s.replace(/[\u0300-\u036f\x00-\x1f]/g, '').length;
|
|
53
|
+
}
|
|
54
|
+
exports.width = width;
|
|
43
55
|
//# sourceMappingURL=util.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell",
|
|
3
|
-
"version": "5.18.
|
|
3
|
+
"version": "5.18.4",
|
|
4
4
|
"description": "A Spelling Checker for Code!",
|
|
5
5
|
"funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -70,13 +70,13 @@
|
|
|
70
70
|
},
|
|
71
71
|
"homepage": "https://streetsidesoftware.github.io/cspell/",
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@cspell/cspell-pipe": "^5.18.
|
|
73
|
+
"@cspell/cspell-pipe": "^5.18.4",
|
|
74
74
|
"chalk": "^4.1.2",
|
|
75
|
-
"commander": "^
|
|
76
|
-
"comment-json": "^4.
|
|
77
|
-
"cspell-gitignore": "^5.18.
|
|
78
|
-
"cspell-glob": "^5.18.
|
|
79
|
-
"cspell-lib": "^5.18.
|
|
75
|
+
"commander": "^9.0.0",
|
|
76
|
+
"comment-json": "^4.2.2",
|
|
77
|
+
"cspell-gitignore": "^5.18.4",
|
|
78
|
+
"cspell-glob": "^5.18.4",
|
|
79
|
+
"cspell-lib": "^5.18.4",
|
|
80
80
|
"fast-json-stable-stringify": "^2.1.0",
|
|
81
81
|
"file-entry-cache": "^6.0.1",
|
|
82
82
|
"fs-extra": "^10.0.0",
|
|
@@ -91,8 +91,8 @@
|
|
|
91
91
|
"node": ">=12.13.0"
|
|
92
92
|
},
|
|
93
93
|
"devDependencies": {
|
|
94
|
-
"@cspell/cspell-json-reporter": "^5.18.
|
|
95
|
-
"@cspell/cspell-types": "^5.18.
|
|
94
|
+
"@cspell/cspell-json-reporter": "^5.18.4",
|
|
95
|
+
"@cspell/cspell-types": "^5.18.4",
|
|
96
96
|
"@types/file-entry-cache": "^5.0.2",
|
|
97
97
|
"@types/fs-extra": "^9.0.13",
|
|
98
98
|
"@types/glob": "^7.2.0",
|
|
@@ -100,12 +100,12 @@
|
|
|
100
100
|
"@types/micromatch": "^4.0.2",
|
|
101
101
|
"@types/minimatch": "^3.0.5",
|
|
102
102
|
"@types/semver": "^7.3.9",
|
|
103
|
-
"jest": "^27.
|
|
103
|
+
"jest": "^27.5.0",
|
|
104
104
|
"micromatch": "^4.0.4",
|
|
105
105
|
"minimatch": "^3.0.4",
|
|
106
106
|
"rimraf": "^3.0.2",
|
|
107
|
-
"rollup": "^2.
|
|
107
|
+
"rollup": "^2.67.0",
|
|
108
108
|
"rollup-plugin-dts": "^4.1.0"
|
|
109
109
|
},
|
|
110
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "26769ba64ce9eff227492524e5210709bec36416"
|
|
111
111
|
}
|