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.
Files changed (152) hide show
  1. package/README.md +29 -21
  2. package/bin.mjs +1 -1
  3. package/dist/esm/app.d.ts +19 -0
  4. package/dist/esm/app.js +1033 -0
  5. package/dist/esm/application-D-NwS6qb.js +2573 -0
  6. package/dist/esm/application-DbOQYm56.d.ts +116 -0
  7. package/dist/esm/application.d.ts +3 -0
  8. package/dist/esm/application.js +3 -0
  9. package/dist/esm/index.d.ts +55 -0
  10. package/dist/esm/index.js +5 -0
  11. package/dist/esm/options-ChaXtdFn.d.ts +387 -0
  12. package/package.json +27 -25
  13. package/dist/esm/app.d.mts +0 -5
  14. package/dist/esm/app.mjs +0 -34
  15. package/dist/esm/application.d.mts +0 -17
  16. package/dist/esm/application.mjs +0 -99
  17. package/dist/esm/cli-reporter.d.ts +0 -38
  18. package/dist/esm/cli-reporter.js +0 -386
  19. package/dist/esm/commandCheck.d.ts +0 -3
  20. package/dist/esm/commandCheck.js +0 -52
  21. package/dist/esm/commandConfig.d.ts +0 -3
  22. package/dist/esm/commandConfig.js +0 -18
  23. package/dist/esm/commandDictionaries.d.ts +0 -3
  24. package/dist/esm/commandDictionaries.js +0 -40
  25. package/dist/esm/commandHelpers.d.ts +0 -18
  26. package/dist/esm/commandHelpers.js +0 -30
  27. package/dist/esm/commandInit.d.ts +0 -3
  28. package/dist/esm/commandInit.js +0 -25
  29. package/dist/esm/commandLink.d.ts +0 -3
  30. package/dist/esm/commandLink.js +0 -48
  31. package/dist/esm/commandLint.d.ts +0 -3
  32. package/dist/esm/commandLint.js +0 -226
  33. package/dist/esm/commandSuggestion.d.ts +0 -3
  34. package/dist/esm/commandSuggestion.js +0 -61
  35. package/dist/esm/commandTrace.d.ts +0 -3
  36. package/dist/esm/commandTrace.js +0 -91
  37. package/dist/esm/config/adjustConfig.d.ts +0 -7
  38. package/dist/esm/config/adjustConfig.js +0 -137
  39. package/dist/esm/config/config.d.ts +0 -5
  40. package/dist/esm/config/config.js +0 -18
  41. package/dist/esm/config/configInit.d.ts +0 -3
  42. package/dist/esm/config/configInit.js +0 -104
  43. package/dist/esm/config/constants.d.ts +0 -17
  44. package/dist/esm/config/constants.js +0 -23
  45. package/dist/esm/config/index.d.ts +0 -3
  46. package/dist/esm/config/index.js +0 -2
  47. package/dist/esm/config/options.d.ts +0 -62
  48. package/dist/esm/config/options.js +0 -2
  49. package/dist/esm/config/updateConfig.d.ts +0 -3
  50. package/dist/esm/config/updateConfig.js +0 -2
  51. package/dist/esm/console.d.ts +0 -25
  52. package/dist/esm/console.js +0 -53
  53. package/dist/esm/dictionaries/index.d.ts +0 -3
  54. package/dist/esm/dictionaries/index.js +0 -2
  55. package/dist/esm/dictionaries/listDictionaries.d.ts +0 -33
  56. package/dist/esm/dictionaries/listDictionaries.js +0 -131
  57. package/dist/esm/dirname.d.ts +0 -2
  58. package/dist/esm/dirname.js +0 -13
  59. package/dist/esm/emitters/DictionaryPathFormat.d.ts +0 -3
  60. package/dist/esm/emitters/DictionaryPathFormat.js +0 -12
  61. package/dist/esm/emitters/dictionaryListEmitter.d.ts +0 -19
  62. package/dist/esm/emitters/dictionaryListEmitter.js +0 -82
  63. package/dist/esm/emitters/helpers.d.ts +0 -14
  64. package/dist/esm/emitters/helpers.js +0 -67
  65. package/dist/esm/emitters/suggestionsEmitter.d.ts +0 -13
  66. package/dist/esm/emitters/suggestionsEmitter.js +0 -79
  67. package/dist/esm/emitters/traceEmitter.d.ts +0 -19
  68. package/dist/esm/emitters/traceEmitter.js +0 -87
  69. package/dist/esm/environment.d.ts +0 -39
  70. package/dist/esm/environment.js +0 -30
  71. package/dist/esm/featureFlags/featureFlags.d.ts +0 -4
  72. package/dist/esm/featureFlags/featureFlags.js +0 -21
  73. package/dist/esm/featureFlags/index.d.ts +0 -2
  74. package/dist/esm/featureFlags/index.js +0 -2
  75. package/dist/esm/index.d.mts +0 -6
  76. package/dist/esm/index.mjs +0 -4
  77. package/dist/esm/link.d.ts +0 -8
  78. package/dist/esm/link.js +0 -39
  79. package/dist/esm/lint/LintRequest.d.ts +0 -26
  80. package/dist/esm/lint/LintRequest.js +0 -83
  81. package/dist/esm/lint/index.d.ts +0 -3
  82. package/dist/esm/lint/index.js +0 -3
  83. package/dist/esm/lint/lint.d.ts +0 -8
  84. package/dist/esm/lint/lint.js +0 -515
  85. package/dist/esm/models.d.ts +0 -15
  86. package/dist/esm/models.js +0 -2
  87. package/dist/esm/options.d.ts +0 -353
  88. package/dist/esm/options.js +0 -9
  89. package/dist/esm/pkgInfo.d.ts +0 -14
  90. package/dist/esm/pkgInfo.js +0 -7
  91. package/dist/esm/repl/index.d.ts +0 -18
  92. package/dist/esm/repl/index.js +0 -52
  93. package/dist/esm/util/InMemoryReporter.d.ts +0 -31
  94. package/dist/esm/util/InMemoryReporter.js +0 -49
  95. package/dist/esm/util/LintFileResult.d.ts +0 -14
  96. package/dist/esm/util/LintFileResult.js +0 -2
  97. package/dist/esm/util/async.d.ts +0 -3
  98. package/dist/esm/util/async.js +0 -4
  99. package/dist/esm/util/cache/CSpellLintResultCache.d.ts +0 -20
  100. package/dist/esm/util/cache/CSpellLintResultCache.js +0 -2
  101. package/dist/esm/util/cache/CacheOptions.d.ts +0 -34
  102. package/dist/esm/util/cache/CacheOptions.js +0 -2
  103. package/dist/esm/util/cache/DiskCache.d.ts +0 -63
  104. package/dist/esm/util/cache/DiskCache.js +0 -214
  105. package/dist/esm/util/cache/DummyCache.d.ts +0 -11
  106. package/dist/esm/util/cache/DummyCache.js +0 -18
  107. package/dist/esm/util/cache/ObjectCollection.d.ts +0 -17
  108. package/dist/esm/util/cache/ObjectCollection.js +0 -127
  109. package/dist/esm/util/cache/createCache.d.ts +0 -31
  110. package/dist/esm/util/cache/createCache.js +0 -69
  111. package/dist/esm/util/cache/file-entry-cache.d.mts +0 -4
  112. package/dist/esm/util/cache/file-entry-cache.mjs +0 -5
  113. package/dist/esm/util/cache/fileEntryCache.d.ts +0 -9
  114. package/dist/esm/util/cache/fileEntryCache.js +0 -79
  115. package/dist/esm/util/cache/index.d.ts +0 -4
  116. package/dist/esm/util/cache/index.js +0 -2
  117. package/dist/esm/util/canUseColor.d.ts +0 -2
  118. package/dist/esm/util/canUseColor.js +0 -10
  119. package/dist/esm/util/configFileHelper.d.ts +0 -15
  120. package/dist/esm/util/configFileHelper.js +0 -43
  121. package/dist/esm/util/constants.d.ts +0 -6
  122. package/dist/esm/util/constants.js +0 -6
  123. package/dist/esm/util/errors.d.ts +0 -24
  124. package/dist/esm/util/errors.js +0 -60
  125. package/dist/esm/util/extractContext.d.ts +0 -5
  126. package/dist/esm/util/extractContext.js +0 -75
  127. package/dist/esm/util/fileHelper.d.ts +0 -44
  128. package/dist/esm/util/fileHelper.js +0 -165
  129. package/dist/esm/util/glob.d.ts +0 -45
  130. package/dist/esm/util/glob.js +0 -147
  131. package/dist/esm/util/pad.d.ts +0 -45
  132. package/dist/esm/util/pad.js +0 -191
  133. package/dist/esm/util/prefetch.d.ts +0 -2
  134. package/dist/esm/util/prefetch.js +0 -15
  135. package/dist/esm/util/reporters.d.ts +0 -30
  136. package/dist/esm/util/reporters.js +0 -209
  137. package/dist/esm/util/stdin.d.ts +0 -2
  138. package/dist/esm/util/stdin.js +0 -5
  139. package/dist/esm/util/stdinUrl.d.ts +0 -9
  140. package/dist/esm/util/stdinUrl.js +0 -26
  141. package/dist/esm/util/table.d.ts +0 -41
  142. package/dist/esm/util/table.js +0 -115
  143. package/dist/esm/util/timer.d.ts +0 -4
  144. package/dist/esm/util/timer.js +0 -9
  145. package/dist/esm/util/types.d.ts +0 -7
  146. package/dist/esm/util/types.js +0 -5
  147. package/dist/esm/util/unindent.d.ts +0 -14
  148. package/dist/esm/util/unindent.js +0 -55
  149. package/dist/esm/util/util.d.ts +0 -14
  150. package/dist/esm/util/util.js +0 -30
  151. package/dist/esm/util/writeFile.d.ts +0 -3
  152. package/dist/esm/util/writeFile.js +0 -30
@@ -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
@@ -1,4 +0,0 @@
1
- import type { PerfTimer } from 'cspell-lib';
2
- export declare function getTimeMeasurer(): () => number;
3
- export declare function getTimer(name: string, onEnd?: (elapsed: number, name: string) => void): PerfTimer;
4
- //# sourceMappingURL=timer.d.ts.map
@@ -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
@@ -1,7 +0,0 @@
1
- /**
2
- * Make all properties in T required
3
- */
4
- export type RemoveUndefined<T> = {
5
- [P in keyof T]: Exclude<T[P], undefined>;
6
- };
7
- //# sourceMappingURL=types.d.ts.map
@@ -1,5 +0,0 @@
1
- /**
2
- * Make all properties in T required
3
- */
4
- export {};
5
- //# sourceMappingURL=types.js.map
@@ -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
@@ -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
@@ -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,3 +0,0 @@
1
- export declare function writeFileOrStream(filename: string, data: string): Promise<void>;
2
- export declare function writeStream(stream: NodeJS.WriteStream, data: string): Promise<void>;
3
- //# sourceMappingURL=writeFile.d.ts.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