cspell 9.1.2 → 9.1.5
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 +29 -21
- package/bin.mjs +1 -1
- package/dist/esm/app.d.ts +19 -0
- package/dist/esm/app.js +1033 -0
- package/dist/esm/application-D-NwS6qb.js +2573 -0
- package/dist/esm/application-DbOQYm56.d.ts +116 -0
- package/dist/esm/application.d.ts +3 -0
- package/dist/esm/application.js +3 -0
- package/dist/esm/index.d.ts +55 -0
- package/dist/esm/index.js +5 -0
- package/dist/esm/options-ChaXtdFn.d.ts +387 -0
- package/package.json +27 -25
- package/dist/esm/app.d.mts +0 -5
- package/dist/esm/app.mjs +0 -34
- package/dist/esm/application.d.mts +0 -17
- package/dist/esm/application.mjs +0 -99
- package/dist/esm/cli-reporter.d.ts +0 -38
- package/dist/esm/cli-reporter.js +0 -386
- package/dist/esm/commandCheck.d.ts +0 -3
- package/dist/esm/commandCheck.js +0 -52
- package/dist/esm/commandConfig.d.ts +0 -3
- package/dist/esm/commandConfig.js +0 -18
- package/dist/esm/commandDictionaries.d.ts +0 -3
- package/dist/esm/commandDictionaries.js +0 -40
- package/dist/esm/commandHelpers.d.ts +0 -18
- package/dist/esm/commandHelpers.js +0 -30
- package/dist/esm/commandInit.d.ts +0 -3
- package/dist/esm/commandInit.js +0 -25
- package/dist/esm/commandLink.d.ts +0 -3
- package/dist/esm/commandLink.js +0 -48
- package/dist/esm/commandLint.d.ts +0 -3
- package/dist/esm/commandLint.js +0 -226
- package/dist/esm/commandSuggestion.d.ts +0 -3
- package/dist/esm/commandSuggestion.js +0 -61
- package/dist/esm/commandTrace.d.ts +0 -3
- package/dist/esm/commandTrace.js +0 -91
- package/dist/esm/config/adjustConfig.d.ts +0 -7
- package/dist/esm/config/adjustConfig.js +0 -137
- package/dist/esm/config/config.d.ts +0 -5
- package/dist/esm/config/config.js +0 -18
- package/dist/esm/config/configInit.d.ts +0 -3
- package/dist/esm/config/configInit.js +0 -104
- package/dist/esm/config/constants.d.ts +0 -17
- package/dist/esm/config/constants.js +0 -23
- package/dist/esm/config/index.d.ts +0 -3
- package/dist/esm/config/index.js +0 -2
- package/dist/esm/config/options.d.ts +0 -62
- package/dist/esm/config/options.js +0 -2
- package/dist/esm/config/updateConfig.d.ts +0 -3
- package/dist/esm/config/updateConfig.js +0 -2
- package/dist/esm/console.d.ts +0 -25
- package/dist/esm/console.js +0 -53
- package/dist/esm/dictionaries/index.d.ts +0 -3
- package/dist/esm/dictionaries/index.js +0 -2
- package/dist/esm/dictionaries/listDictionaries.d.ts +0 -33
- package/dist/esm/dictionaries/listDictionaries.js +0 -131
- package/dist/esm/dirname.d.ts +0 -2
- package/dist/esm/dirname.js +0 -13
- package/dist/esm/emitters/DictionaryPathFormat.d.ts +0 -3
- package/dist/esm/emitters/DictionaryPathFormat.js +0 -12
- package/dist/esm/emitters/dictionaryListEmitter.d.ts +0 -19
- package/dist/esm/emitters/dictionaryListEmitter.js +0 -82
- package/dist/esm/emitters/helpers.d.ts +0 -14
- package/dist/esm/emitters/helpers.js +0 -67
- package/dist/esm/emitters/suggestionsEmitter.d.ts +0 -13
- package/dist/esm/emitters/suggestionsEmitter.js +0 -79
- package/dist/esm/emitters/traceEmitter.d.ts +0 -19
- package/dist/esm/emitters/traceEmitter.js +0 -87
- package/dist/esm/environment.d.ts +0 -39
- package/dist/esm/environment.js +0 -30
- package/dist/esm/featureFlags/featureFlags.d.ts +0 -4
- package/dist/esm/featureFlags/featureFlags.js +0 -21
- package/dist/esm/featureFlags/index.d.ts +0 -2
- package/dist/esm/featureFlags/index.js +0 -2
- package/dist/esm/index.d.mts +0 -6
- package/dist/esm/index.mjs +0 -4
- package/dist/esm/link.d.ts +0 -8
- package/dist/esm/link.js +0 -39
- package/dist/esm/lint/LintRequest.d.ts +0 -26
- package/dist/esm/lint/LintRequest.js +0 -83
- package/dist/esm/lint/index.d.ts +0 -3
- package/dist/esm/lint/index.js +0 -3
- package/dist/esm/lint/lint.d.ts +0 -8
- package/dist/esm/lint/lint.js +0 -515
- package/dist/esm/models.d.ts +0 -15
- package/dist/esm/models.js +0 -2
- package/dist/esm/options.d.ts +0 -353
- package/dist/esm/options.js +0 -9
- package/dist/esm/pkgInfo.d.ts +0 -14
- package/dist/esm/pkgInfo.js +0 -7
- package/dist/esm/repl/index.d.ts +0 -18
- package/dist/esm/repl/index.js +0 -52
- package/dist/esm/util/InMemoryReporter.d.ts +0 -31
- package/dist/esm/util/InMemoryReporter.js +0 -49
- package/dist/esm/util/LintFileResult.d.ts +0 -14
- package/dist/esm/util/LintFileResult.js +0 -2
- package/dist/esm/util/async.d.ts +0 -3
- package/dist/esm/util/async.js +0 -4
- package/dist/esm/util/cache/CSpellLintResultCache.d.ts +0 -20
- package/dist/esm/util/cache/CSpellLintResultCache.js +0 -2
- package/dist/esm/util/cache/CacheOptions.d.ts +0 -34
- package/dist/esm/util/cache/CacheOptions.js +0 -2
- package/dist/esm/util/cache/DiskCache.d.ts +0 -63
- package/dist/esm/util/cache/DiskCache.js +0 -214
- package/dist/esm/util/cache/DummyCache.d.ts +0 -11
- package/dist/esm/util/cache/DummyCache.js +0 -18
- package/dist/esm/util/cache/ObjectCollection.d.ts +0 -17
- package/dist/esm/util/cache/ObjectCollection.js +0 -127
- package/dist/esm/util/cache/createCache.d.ts +0 -31
- package/dist/esm/util/cache/createCache.js +0 -69
- package/dist/esm/util/cache/file-entry-cache.d.mts +0 -4
- package/dist/esm/util/cache/file-entry-cache.mjs +0 -5
- package/dist/esm/util/cache/fileEntryCache.d.ts +0 -9
- package/dist/esm/util/cache/fileEntryCache.js +0 -79
- package/dist/esm/util/cache/index.d.ts +0 -4
- package/dist/esm/util/cache/index.js +0 -2
- package/dist/esm/util/canUseColor.d.ts +0 -2
- package/dist/esm/util/canUseColor.js +0 -10
- package/dist/esm/util/configFileHelper.d.ts +0 -15
- package/dist/esm/util/configFileHelper.js +0 -43
- package/dist/esm/util/constants.d.ts +0 -6
- package/dist/esm/util/constants.js +0 -6
- package/dist/esm/util/errors.d.ts +0 -24
- package/dist/esm/util/errors.js +0 -60
- package/dist/esm/util/extractContext.d.ts +0 -5
- package/dist/esm/util/extractContext.js +0 -75
- package/dist/esm/util/fileHelper.d.ts +0 -44
- package/dist/esm/util/fileHelper.js +0 -165
- package/dist/esm/util/glob.d.ts +0 -45
- package/dist/esm/util/glob.js +0 -147
- package/dist/esm/util/pad.d.ts +0 -45
- package/dist/esm/util/pad.js +0 -191
- package/dist/esm/util/prefetch.d.ts +0 -2
- package/dist/esm/util/prefetch.js +0 -15
- package/dist/esm/util/reporters.d.ts +0 -30
- package/dist/esm/util/reporters.js +0 -209
- package/dist/esm/util/stdin.d.ts +0 -2
- package/dist/esm/util/stdin.js +0 -5
- package/dist/esm/util/stdinUrl.d.ts +0 -9
- package/dist/esm/util/stdinUrl.js +0 -26
- package/dist/esm/util/table.d.ts +0 -41
- package/dist/esm/util/table.js +0 -115
- package/dist/esm/util/timer.d.ts +0 -4
- package/dist/esm/util/timer.js +0 -9
- package/dist/esm/util/types.d.ts +0 -7
- package/dist/esm/util/types.js +0 -5
- package/dist/esm/util/unindent.d.ts +0 -14
- package/dist/esm/util/unindent.js +0 -55
- package/dist/esm/util/util.d.ts +0 -14
- package/dist/esm/util/util.js +0 -30
- package/dist/esm/util/writeFile.d.ts +0 -3
- package/dist/esm/util/writeFile.js +0 -30
package/dist/esm/util/table.js
DELETED
|
@@ -1,115 +0,0 @@
|
|
|
1
|
-
import chalk from 'chalk';
|
|
2
|
-
import { ansiWidth, pad, pruneTextEnd } from './pad.js';
|
|
3
|
-
export function tableToLines(table, deliminator) {
|
|
4
|
-
const del = deliminator || table.deliminator || ' | ';
|
|
5
|
-
const columnWidths = [];
|
|
6
|
-
const maxColumnWidthsMap = table.maxColumnWidths || {};
|
|
7
|
-
const { header, rows } = table;
|
|
8
|
-
const simpleHeader = header.map((col) => (Array.isArray(col) ? col[1] : col));
|
|
9
|
-
const columnFieldNames = header.map((col) => (Array.isArray(col) ? col[0] : col));
|
|
10
|
-
const maxColumnWidths = columnFieldNames.map((field, idx) => maxColumnWidthsMap[field] ?? maxColumnWidthsMap[idx]);
|
|
11
|
-
function getCell(row, col) {
|
|
12
|
-
return getCellFromRow(rows[row], col);
|
|
13
|
-
}
|
|
14
|
-
function getCellFromRow(row, col) {
|
|
15
|
-
if (!row)
|
|
16
|
-
return undefined;
|
|
17
|
-
if (Array.isArray(row)) {
|
|
18
|
-
return row[col];
|
|
19
|
-
}
|
|
20
|
-
const fieldName = columnFieldNames[col];
|
|
21
|
-
return row[fieldName];
|
|
22
|
-
}
|
|
23
|
-
function rowToCells(row) {
|
|
24
|
-
if (Array.isArray(row)) {
|
|
25
|
-
return row;
|
|
26
|
-
}
|
|
27
|
-
return columnFieldNames.map((fieldName) => row[fieldName]);
|
|
28
|
-
}
|
|
29
|
-
function getText(col, maxWidth) {
|
|
30
|
-
return !col ? '' : typeof col === 'string' ? pruneTextEnd(col, maxWidth) : col(maxWidth);
|
|
31
|
-
}
|
|
32
|
-
function getRCText(row, col, maxWidth) {
|
|
33
|
-
return getText(getCell(row, col), maxWidth);
|
|
34
|
-
}
|
|
35
|
-
function recordHeaderWidths(header) {
|
|
36
|
-
header.forEach((col, idx) => {
|
|
37
|
-
columnWidths[idx] = Math.max(ansiWidth(col), columnWidths[idx] || 0);
|
|
38
|
-
});
|
|
39
|
-
}
|
|
40
|
-
function recordColWidths() {
|
|
41
|
-
for (let rowIndex = 0; rowIndex < rows.length; rowIndex++) {
|
|
42
|
-
for (let colIndex = 0; colIndex < columnFieldNames.length; colIndex++) {
|
|
43
|
-
columnWidths[colIndex] = Math.max(ansiWidth(getRCText(rowIndex, colIndex, undefined)), columnWidths[colIndex] || 0);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
function justifyRow(c, i) {
|
|
48
|
-
return pad(c, columnWidths[i]);
|
|
49
|
-
}
|
|
50
|
-
function toHeaderLine(header) {
|
|
51
|
-
return decorateRowWith(header.map((c, i) => getText(c, columnWidths[i])), justifyRow, headerDecorator).join(del);
|
|
52
|
-
}
|
|
53
|
-
function toLine(row) {
|
|
54
|
-
return decorateRowWith(rowToCells(row).map((c, i) => getText(c, columnWidths[i])), justifyRow).join(del);
|
|
55
|
-
}
|
|
56
|
-
function* process() {
|
|
57
|
-
yield toHeaderLine(simpleHeader);
|
|
58
|
-
yield* rows.map(toLine);
|
|
59
|
-
}
|
|
60
|
-
function sumColumnWidths() {
|
|
61
|
-
return columnWidths.reduce((sum, width) => sum + width, 0);
|
|
62
|
-
}
|
|
63
|
-
function adjustColWidths() {
|
|
64
|
-
for (let i = 0; i < columnWidths.length; i++) {
|
|
65
|
-
const mw = maxColumnWidths[i];
|
|
66
|
-
if (!mw)
|
|
67
|
-
continue;
|
|
68
|
-
columnWidths[i] = Math.min(columnWidths[i], mw);
|
|
69
|
-
}
|
|
70
|
-
if (!table.terminalWidth)
|
|
71
|
-
return;
|
|
72
|
-
const dWidth = (columnWidths.length - 1) * ansiWidth(del);
|
|
73
|
-
const lineWidth = table.terminalWidth - dWidth;
|
|
74
|
-
if (lineWidth <= columnWidths.length * 2) {
|
|
75
|
-
const fixedWidth = Math.max(Math.min(...columnWidths), 5);
|
|
76
|
-
for (let i = 0; i < columnWidths.length; i++) {
|
|
77
|
-
columnWidths[i] = fixedWidth;
|
|
78
|
-
}
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (columnWidths.length === 1) {
|
|
82
|
-
columnWidths[0] = lineWidth;
|
|
83
|
-
return;
|
|
84
|
-
}
|
|
85
|
-
function trimWidestColumn(neededToTrim) {
|
|
86
|
-
let first = 0;
|
|
87
|
-
let second = 0;
|
|
88
|
-
for (let i = 0; i < columnWidths.length; i++) {
|
|
89
|
-
if (columnWidths[i] > columnWidths[first]) {
|
|
90
|
-
second = first;
|
|
91
|
-
first = i;
|
|
92
|
-
}
|
|
93
|
-
else if (columnWidths[i] > columnWidths[second]) {
|
|
94
|
-
second = i;
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
const diff = Math.max(columnWidths[first] - columnWidths[second], 1);
|
|
98
|
-
columnWidths[first] -= Math.min(diff, neededToTrim);
|
|
99
|
-
}
|
|
100
|
-
for (let sum = sumColumnWidths(); sum > lineWidth; sum = sumColumnWidths()) {
|
|
101
|
-
trimWidestColumn(sum - lineWidth);
|
|
102
|
-
}
|
|
103
|
-
}
|
|
104
|
-
recordHeaderWidths(simpleHeader);
|
|
105
|
-
recordColWidths();
|
|
106
|
-
adjustColWidths();
|
|
107
|
-
return [...process()];
|
|
108
|
-
}
|
|
109
|
-
function headerDecorator(t) {
|
|
110
|
-
return chalk.bold(chalk.underline(t));
|
|
111
|
-
}
|
|
112
|
-
export function decorateRowWith(row, ...decorators) {
|
|
113
|
-
return decorators.reduce((row, decorator) => row.map(decorator), row);
|
|
114
|
-
}
|
|
115
|
-
//# sourceMappingURL=table.js.map
|
package/dist/esm/util/timer.d.ts
DELETED
package/dist/esm/util/timer.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
import { createPerfTimer } from 'cspell-lib';
|
|
2
|
-
export function getTimeMeasurer() {
|
|
3
|
-
const timer = createPerfTimer('timer');
|
|
4
|
-
return () => timer.elapsed;
|
|
5
|
-
}
|
|
6
|
-
export function getTimer(name, onEnd) {
|
|
7
|
-
return createPerfTimer(name, onEnd);
|
|
8
|
-
}
|
|
9
|
-
//# sourceMappingURL=timer.js.map
|
package/dist/esm/util/types.d.ts
DELETED
package/dist/esm/util/types.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Remove the left padding from a multi-line string.
|
|
3
|
-
* @param {string} str
|
|
4
|
-
* @returns {string}
|
|
5
|
-
*/
|
|
6
|
-
export declare function unindent(str: string): string;
|
|
7
|
-
/**
|
|
8
|
-
* Unindent a template string.
|
|
9
|
-
* @param {TemplateStringsArray} template
|
|
10
|
-
* @param {...any} values
|
|
11
|
-
* @returns
|
|
12
|
-
*/
|
|
13
|
-
export declare function unindent(template: TemplateStringsArray, ...values: unknown[]): string;
|
|
14
|
-
//# sourceMappingURL=unindent.d.ts.map
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Inject values into a template string.
|
|
3
|
-
* @param {TemplateStringsArray} template
|
|
4
|
-
* @param {...any} values
|
|
5
|
-
* @returns
|
|
6
|
-
*/
|
|
7
|
-
function _inject(template, ...values) {
|
|
8
|
-
const strings = template;
|
|
9
|
-
const adjValues = [];
|
|
10
|
-
for (let i = 0; i < values.length; ++i) {
|
|
11
|
-
const prevLines = strings[i].split('\n');
|
|
12
|
-
const currLine = prevLines[prevLines.length - 1];
|
|
13
|
-
const padLen = padLength(currLine);
|
|
14
|
-
const padding = ' '.repeat(padLen);
|
|
15
|
-
const value = `${values[i]}`;
|
|
16
|
-
let pad = '';
|
|
17
|
-
const valueLines = [];
|
|
18
|
-
for (const line of value.split('\n')) {
|
|
19
|
-
valueLines.push(pad + line);
|
|
20
|
-
pad = padding;
|
|
21
|
-
}
|
|
22
|
-
adjValues.push(valueLines.join('\n'));
|
|
23
|
-
}
|
|
24
|
-
return _unindent(String.raw({ raw: strings }, ...adjValues));
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
|
-
* Calculate the padding at the start of the string.
|
|
28
|
-
* @param {string} s
|
|
29
|
-
* @returns {number}
|
|
30
|
-
*/
|
|
31
|
-
function padLength(s) {
|
|
32
|
-
return s.length - s.trimStart().length;
|
|
33
|
-
}
|
|
34
|
-
export function unindent(template, ...values) {
|
|
35
|
-
if (typeof template === 'string') {
|
|
36
|
-
return _unindent(template);
|
|
37
|
-
}
|
|
38
|
-
return _inject(template, ...values);
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Remove the left padding from a multi-line string.
|
|
42
|
-
* @param {string} str
|
|
43
|
-
* @returns {string}
|
|
44
|
-
*/
|
|
45
|
-
function _unindent(str) {
|
|
46
|
-
const lines = str.split('\n');
|
|
47
|
-
let curPad = str.length;
|
|
48
|
-
for (const line of lines) {
|
|
49
|
-
if (!line.trim())
|
|
50
|
-
continue;
|
|
51
|
-
curPad = Math.min(curPad, padLength(line));
|
|
52
|
-
}
|
|
53
|
-
return lines.map((line) => line.slice(curPad)).join('\n');
|
|
54
|
-
}
|
|
55
|
-
//# sourceMappingURL=unindent.js.map
|
package/dist/esm/util/util.d.ts
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import type { RemoveUndefined } from './types.js';
|
|
2
|
-
export declare const uniqueFn: typeof uniqueFilterFnGenerator;
|
|
3
|
-
type FilterFn<T> = (_v: T) => boolean;
|
|
4
|
-
export declare function uniqueFilterFnGenerator<T>(): FilterFn<T>;
|
|
5
|
-
export declare function uniqueFilterFnGenerator<T, U>(extractFn: (v: T) => U): FilterFn<T>;
|
|
6
|
-
export declare function unique<T>(src: T[]): T[];
|
|
7
|
-
/**
|
|
8
|
-
* Removed all properties with a value of `undefined` from the object.
|
|
9
|
-
* @param src - the object to clean.
|
|
10
|
-
* @returns the same object with all properties with a value of `undefined` removed.
|
|
11
|
-
*/
|
|
12
|
-
export declare function clean<T extends object>(src: T): RemoveUndefined<T>;
|
|
13
|
-
export {};
|
|
14
|
-
//# sourceMappingURL=util.d.ts.map
|
package/dist/esm/util/util.js
DELETED
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
// alias for uniqueFilterFnGenerator
|
|
2
|
-
export const uniqueFn = uniqueFilterFnGenerator;
|
|
3
|
-
export function uniqueFilterFnGenerator(extractFn) {
|
|
4
|
-
const values = new Set();
|
|
5
|
-
const extractor = extractFn || ((a) => a);
|
|
6
|
-
return (v) => {
|
|
7
|
-
const vv = extractor(v);
|
|
8
|
-
const ret = !values.has(vv);
|
|
9
|
-
values.add(vv);
|
|
10
|
-
return ret;
|
|
11
|
-
};
|
|
12
|
-
}
|
|
13
|
-
export function unique(src) {
|
|
14
|
-
return [...new Set(src)];
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Removed all properties with a value of `undefined` from the object.
|
|
18
|
-
* @param src - the object to clean.
|
|
19
|
-
* @returns the same object with all properties with a value of `undefined` removed.
|
|
20
|
-
*/
|
|
21
|
-
export function clean(src) {
|
|
22
|
-
const r = src;
|
|
23
|
-
for (const key of Object.keys(r)) {
|
|
24
|
-
if (r[key] === undefined) {
|
|
25
|
-
delete r[key];
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
return r;
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=util.js.map
|
|
@@ -1,30 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs/promises';
|
|
2
|
-
export async function writeFileOrStream(filename, data) {
|
|
3
|
-
switch (filename) {
|
|
4
|
-
case 'stdout': {
|
|
5
|
-
await writeStream(process.stdout, data);
|
|
6
|
-
return;
|
|
7
|
-
}
|
|
8
|
-
case 'stderr': {
|
|
9
|
-
await writeStream(process.stderr, data);
|
|
10
|
-
return;
|
|
11
|
-
}
|
|
12
|
-
case 'null': {
|
|
13
|
-
return;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
return fs.writeFile(filename, data);
|
|
17
|
-
}
|
|
18
|
-
export function writeStream(stream, data) {
|
|
19
|
-
return new Promise((resolve, reject) => {
|
|
20
|
-
stream.write(data, (err) => {
|
|
21
|
-
if (err) {
|
|
22
|
-
reject(err);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
resolve();
|
|
26
|
-
}
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
//# sourceMappingURL=writeFile.js.map
|