cspell 10.0.0 → 10.1.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 +4 -4
- package/dist/esm/app.d.ts +1 -2
- package/dist/esm/app.js +12 -8
- package/dist/esm/{application-BeNl-OE0.js → application-BQ6838px.js} +60 -36
- package/dist/esm/{application-DYrUtKeK.d.ts → application-BeYqH0KN.d.ts} +54 -55
- package/dist/esm/application.d.ts +2 -2
- package/dist/esm/application.js +1 -1
- package/dist/esm/index.d.ts +7 -7
- package/dist/esm/index.js +1 -1
- package/dist/esm/options-CG62AIq-.d.ts +403 -0
- package/package.json +22 -22
- package/dist/esm/options-1v2EW2_1.d.ts +0 -401
package/README.md
CHANGED
|
@@ -25,7 +25,7 @@ A Spell Checker for Code!
|
|
|
25
25
|
## Features
|
|
26
26
|
|
|
27
27
|
- Spell Checks Code -- Able to spell check code by parsing it into words before checking against the dictionaries.
|
|
28
|
-
- Supports CamelCase,
|
|
28
|
+
- Supports CamelCase, snake\_case, and compoundwords naming styles.
|
|
29
29
|
- Self contained -- does not depend upon OS libraries like Hunspell or aspell. Nor does it depend upon online services.
|
|
30
30
|
- Fast -- checks 1000's of lines of code in seconds.
|
|
31
31
|
- Programming Language Specific Dictionaries -- Has dedicated support for:
|
|
@@ -341,11 +341,11 @@ exec git diff --cached --name-only | npx cspell --no-summary --no-progress --no-
|
|
|
341
341
|
|
|
342
342
|
## Requirements
|
|
343
343
|
|
|
344
|
-
CSpell needs Node
|
|
344
|
+
CSpell needs Node 22 and above.
|
|
345
345
|
|
|
346
346
|
## How it works
|
|
347
347
|
|
|
348
|
-
The concept is simple, split camelCase and
|
|
348
|
+
The concept is simple, split camelCase and snake\_case words before checking them against a list of known words.
|
|
349
349
|
|
|
350
350
|
- `camelCase` -> `camel case`
|
|
351
351
|
- `HTMLInput` -> `html input`
|
|
@@ -681,7 +681,7 @@ The spell checker includes a set of default dictionaries.
|
|
|
681
681
|
|
|
682
682
|
### General Dictionaries
|
|
683
683
|
|
|
684
|
-
- **
|
|
684
|
+
- **en\_US** - Derived from Hunspell US English words.
|
|
685
685
|
- **en-gb** - Derived from Hunspell GB English words.
|
|
686
686
|
- **companies** - List of well known companies
|
|
687
687
|
- **softwareTerms** - Software Terms and concepts like "coroutine", "debounce", "tree", etc.
|
package/dist/esm/app.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
import { i as LinterCliOptions } from "./options-
|
|
1
|
+
import { i as LinterCliOptions } from "./options-CG62AIq-.js";
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
-
|
|
4
3
|
//#region src/util/errors.d.ts
|
|
5
4
|
declare class CheckFailed extends Error {
|
|
6
5
|
readonly exitCode: number;
|
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-
|
|
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-BQ6838px.js";
|
|
2
2
|
import { Link } from "cspell-lib";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import * as iPath from "node:path";
|
|
@@ -135,10 +135,12 @@ function calcListDictsResultsReport(results, options) {
|
|
|
135
135
|
else if (options.color === false) chalk.level = 0;
|
|
136
136
|
const col = new Intl.Collator();
|
|
137
137
|
results.sort((a, b) => col.compare(a.name, b.name));
|
|
138
|
+
const header = calcHeaders(options);
|
|
139
|
+
const rows = results.map((r) => dictTableRowToTableRow(emitDictResult(r, options)));
|
|
138
140
|
return {
|
|
139
141
|
table: tableToLines({
|
|
140
|
-
header
|
|
141
|
-
rows
|
|
142
|
+
header,
|
|
143
|
+
rows,
|
|
142
144
|
terminalWidth: options.lineWidth || process.stdout.columns || maxWidth$1,
|
|
143
145
|
deliminator: " ",
|
|
144
146
|
maxColumnWidths: {
|
|
@@ -285,7 +287,8 @@ function addPathsToGlobalImportsResultToTable(results) {
|
|
|
285
287
|
function commandLink(prog) {
|
|
286
288
|
const linkCommand = prog.command("link").description("Link dictionaries and other settings to the cspell global config.");
|
|
287
289
|
linkCommand.command("list", { isDefault: true }).alias("ls").description("List currently linked configurations.").action(async () => {
|
|
288
|
-
|
|
290
|
+
const table = listGlobalImportsResultToTable((await listGlobalImports()).list);
|
|
291
|
+
tableToLines(table).forEach((line) => console.log(line));
|
|
289
292
|
});
|
|
290
293
|
linkCommand.command("add <dictionaries...>").alias("a").description("Add dictionaries any other settings to the cspell global config.").action(async (dictionaries) => {
|
|
291
294
|
const r = await addPathsToGlobalImports(dictionaries);
|
|
@@ -537,7 +540,6 @@ function mergeArrays(a, b) {
|
|
|
537
540
|
//#endregion
|
|
538
541
|
//#region src/emitters/traceEmitter.ts
|
|
539
542
|
const maxWidth = 120;
|
|
540
|
-
const colWidthDictionaryName = 20;
|
|
541
543
|
function emitTraceResults(word, found, results, options) {
|
|
542
544
|
const report = calcTraceResultsReport(word, found, results, options);
|
|
543
545
|
console.log(report.table);
|
|
@@ -552,10 +554,12 @@ function calcTraceResultsReport(word, found, results, options) {
|
|
|
552
554
|
const col = new Intl.Collator();
|
|
553
555
|
results.sort((a, b) => col.compare(a.dictName, b.dictName));
|
|
554
556
|
options.showWordFound && console.log(`${options.prefix || ""}${word}: ${found ? "Found" : "Not Found"}`);
|
|
557
|
+
const header = emitHeader(options.dictionaryPathFormat !== "hide");
|
|
558
|
+
const rows = results.map((r) => emitTraceResult(r, options));
|
|
555
559
|
return {
|
|
556
560
|
table: tableToLines({
|
|
557
|
-
header
|
|
558
|
-
rows
|
|
561
|
+
header,
|
|
562
|
+
rows,
|
|
559
563
|
terminalWidth: options.lineWidth || process.stdout.columns || maxWidth,
|
|
560
564
|
deliminator: " "
|
|
561
565
|
}).map((line) => line.trimEnd()).join("\n"),
|
|
@@ -578,7 +582,7 @@ function emitTraceResult(r, options) {
|
|
|
578
582
|
const w = (r.forbidden ? chalk.red(cWord) : chalk.green(cWord)) + (sug ? `->(${sug})` : "");
|
|
579
583
|
const f = calcFoundChar(r);
|
|
580
584
|
const a = (r.dictBlocked ? chalk.redBright("!") : "") + (r.dictActive ? "*" : " ");
|
|
581
|
-
const dictName = r.dictName.slice(0,
|
|
585
|
+
const dictName = r.dictName.slice(0, 19) + a;
|
|
582
586
|
const n = (r.dictActive ? chalk.yellowBright : chalk.rgb(200, 128, 50))(dictName);
|
|
583
587
|
const c = colorize(errors ? chalk.red : chalk.white);
|
|
584
588
|
return [
|
|
@@ -29,6 +29,7 @@ import * as readline from "node:readline";
|
|
|
29
29
|
import { parse, stringify } from "flatted";
|
|
30
30
|
//#region src/console.ts
|
|
31
31
|
var ImplChannel = class {
|
|
32
|
+
stream;
|
|
32
33
|
constructor(stream) {
|
|
33
34
|
this.stream = stream;
|
|
34
35
|
}
|
|
@@ -39,6 +40,8 @@ var ImplChannel = class {
|
|
|
39
40
|
getColorLevel = () => getColorLevel(this.stream);
|
|
40
41
|
};
|
|
41
42
|
var Console = class {
|
|
43
|
+
stdout;
|
|
44
|
+
stderr;
|
|
42
45
|
stderrChannel;
|
|
43
46
|
stdoutChannel;
|
|
44
47
|
constructor(stdout = process.stdout, stderr = process.stderr) {
|
|
@@ -64,12 +67,15 @@ function getColorLevel(stream) {
|
|
|
64
67
|
//#endregion
|
|
65
68
|
//#region src/util/errors.ts
|
|
66
69
|
var CheckFailed = class extends Error {
|
|
70
|
+
exitCode;
|
|
67
71
|
constructor(message, exitCode = 1) {
|
|
68
72
|
super(message);
|
|
69
73
|
this.exitCode = exitCode;
|
|
70
74
|
}
|
|
71
75
|
};
|
|
72
76
|
var ApplicationError = class extends Error {
|
|
77
|
+
exitCode;
|
|
78
|
+
cause;
|
|
73
79
|
constructor(message, exitCode = 1, cause) {
|
|
74
80
|
super(message);
|
|
75
81
|
this.exitCode = exitCode;
|
|
@@ -77,6 +83,7 @@ var ApplicationError = class extends Error {
|
|
|
77
83
|
}
|
|
78
84
|
};
|
|
79
85
|
var IOError = class extends ApplicationError {
|
|
86
|
+
cause;
|
|
80
87
|
constructor(message, cause) {
|
|
81
88
|
super(message, void 0, cause);
|
|
82
89
|
this.cause = cause;
|
|
@@ -617,16 +624,13 @@ function getReporter(options, config) {
|
|
|
617
624
|
stderr.write("\r");
|
|
618
625
|
stderr.clearLine(0);
|
|
619
626
|
}
|
|
620
|
-
if (
|
|
621
|
-
if (issuesCollection?.length) {
|
|
622
|
-
consoleError("Issues found:");
|
|
623
|
-
issuesCollection.forEach((issue) => consoleError(issue));
|
|
624
|
-
}
|
|
627
|
+
if (errorCollection?.length) consoleError("-------------------------------------------");
|
|
625
628
|
const filesChecked = files - (skippedFiles || 0);
|
|
626
629
|
const cachedFilesText = cachedFiles ? ` (${cachedFiles} from cache)` : "";
|
|
627
630
|
const skippedFilesText = skippedFiles ? `, skipped: ${skippedFiles}` : "";
|
|
628
631
|
const withErrorsText = errors ? ` with ${errors} error${errors === 1 ? "" : "s"}` : "";
|
|
629
|
-
|
|
632
|
+
const summaryMessage = `CSpell\u003A Files checked: ${filesChecked}${cachedFilesText}${skippedFilesText}, Issues found: ${issues} in ${numFilesWithIssues === 1 ? "1 file" : `${numFilesWithIssues} files`}${withErrorsText}.`;
|
|
633
|
+
consoleError(summaryMessage);
|
|
630
634
|
if (errorCollection?.length && issues > 5) {
|
|
631
635
|
consoleError("-------------------------------------------");
|
|
632
636
|
consoleError("Errors:");
|
|
@@ -766,8 +770,9 @@ function formatIssue(io, templateStr, issue, maxIssueTextWidth) {
|
|
|
766
770
|
return t.replace(/\s+/, " ");
|
|
767
771
|
}
|
|
768
772
|
const { uri = "", filename, row, col, text, context = issue.line, offset } = issue;
|
|
773
|
+
const textLen = issue.length ?? text.length;
|
|
769
774
|
const contextLeft = clean(context.text.slice(0, offset - context.offset));
|
|
770
|
-
const contextRight = clean(context.text.slice(offset +
|
|
775
|
+
const contextRight = clean(context.text.slice(offset + textLen - context.offset));
|
|
771
776
|
const contextFull = clean(context.text);
|
|
772
777
|
const padContext = " ".repeat(Math.max(maxIssueTextWidth - text.length, 0));
|
|
773
778
|
const rowText = row.toString();
|
|
@@ -837,7 +842,8 @@ function assertCheckTemplate(template) {
|
|
|
837
842
|
if (r instanceof Error) throw r;
|
|
838
843
|
}
|
|
839
844
|
function checkTemplate(template) {
|
|
840
|
-
const
|
|
845
|
+
const chalk = new Chalk();
|
|
846
|
+
const chalkTemplate = makeTemplate(chalk);
|
|
841
847
|
const substitutions = {
|
|
842
848
|
$col: "<col>",
|
|
843
849
|
$contextFull: "<contextFull>",
|
|
@@ -1184,7 +1190,7 @@ try {
|
|
|
1184
1190
|
const pkgDir = _dirname;
|
|
1185
1191
|
const npmPackage = {
|
|
1186
1192
|
name: "cspell",
|
|
1187
|
-
version: "10.
|
|
1193
|
+
version: "10.1.0",
|
|
1188
1194
|
engines: { node: ">=22.18.0" }
|
|
1189
1195
|
};
|
|
1190
1196
|
//#endregion
|
|
@@ -1268,6 +1274,7 @@ function mergeReportIssueOptions(a, b) {
|
|
|
1268
1274
|
return options;
|
|
1269
1275
|
}
|
|
1270
1276
|
var LintReporter = class {
|
|
1277
|
+
defaultReporter;
|
|
1271
1278
|
#reporters = [];
|
|
1272
1279
|
#config;
|
|
1273
1280
|
#finalized = false;
|
|
@@ -1384,9 +1391,7 @@ function replayReportItems(reportItemsCollection, reporter) {
|
|
|
1384
1391
|
case "debug":
|
|
1385
1392
|
reporter.debug(...item.payload);
|
|
1386
1393
|
break;
|
|
1387
|
-
case "error":
|
|
1388
|
-
reporter.error(...item.payload);
|
|
1389
|
-
break;
|
|
1394
|
+
case "error": reporter.error(...item.payload);
|
|
1390
1395
|
}
|
|
1391
1396
|
}
|
|
1392
1397
|
//#endregion
|
|
@@ -1464,12 +1469,13 @@ function calcExcludeGlobInfo(root, commandLineExclude) {
|
|
|
1464
1469
|
* @param root - directory to use as the root
|
|
1465
1470
|
*/
|
|
1466
1471
|
function buildGlobMatcher(globs, root, isExclude) {
|
|
1467
|
-
|
|
1472
|
+
const withRoots = globs.map((g) => {
|
|
1468
1473
|
return {
|
|
1469
1474
|
source: typeof g === "string" ? "command line" : void 0,
|
|
1470
1475
|
...fileOrGlobToGlob(g, root)
|
|
1471
1476
|
};
|
|
1472
|
-
})
|
|
1477
|
+
});
|
|
1478
|
+
return new GlobMatcher(withRoots, {
|
|
1473
1479
|
root,
|
|
1474
1480
|
mode: isExclude ? "exclude" : "include"
|
|
1475
1481
|
});
|
|
@@ -1525,8 +1531,16 @@ function glob$1(patterns, options) {
|
|
|
1525
1531
|
}
|
|
1526
1532
|
//#endregion
|
|
1527
1533
|
//#region src/util/stdin.ts
|
|
1528
|
-
function readStdin() {
|
|
1529
|
-
|
|
1534
|
+
async function* readStdin() {
|
|
1535
|
+
const rl = readline.createInterface(process.stdin);
|
|
1536
|
+
try {
|
|
1537
|
+
yield* rl;
|
|
1538
|
+
} catch (e) {
|
|
1539
|
+
if (!isReadlineClosedError(e)) throw e;
|
|
1540
|
+
}
|
|
1541
|
+
}
|
|
1542
|
+
function isReadlineClosedError(e) {
|
|
1543
|
+
return e instanceof Error && e.message.includes("closed");
|
|
1530
1544
|
}
|
|
1531
1545
|
//#endregion
|
|
1532
1546
|
//#region src/util/stdinUrl.ts
|
|
@@ -1634,11 +1648,14 @@ const resolveFilenames = asyncMap(resolveFilename);
|
|
|
1634
1648
|
*/
|
|
1635
1649
|
function readFileListFiles(listFiles) {
|
|
1636
1650
|
let useStdin = false;
|
|
1637
|
-
|
|
1651
|
+
const files = listFiles.filter((file) => {
|
|
1638
1652
|
const isStdin = file === "stdin";
|
|
1639
1653
|
useStdin = useStdin || isStdin;
|
|
1640
1654
|
return !isStdin;
|
|
1641
|
-
})
|
|
1655
|
+
});
|
|
1656
|
+
const found = asyncPipe(files, asyncMap((file) => readFileListFile(file)), asyncAwait(), asyncFlatten());
|
|
1657
|
+
const stdin = useStdin ? readStdin() : [];
|
|
1658
|
+
return asyncPipe(mergeAsyncIterables(found, stdin), resolveFilenames);
|
|
1642
1659
|
}
|
|
1643
1660
|
/**
|
|
1644
1661
|
* Read a `listFile` and return the containing file paths resolved relative to the `listFile`.
|
|
@@ -1685,6 +1702,7 @@ function relativeToCwd(filename, cwd = process.cwd()) {
|
|
|
1685
1702
|
//#endregion
|
|
1686
1703
|
//#region src/util/cache/file-entry-cache/flatCache.ts
|
|
1687
1704
|
var FlatCache = class {
|
|
1705
|
+
cacheFilename;
|
|
1688
1706
|
#cache;
|
|
1689
1707
|
constructor(cacheFilename) {
|
|
1690
1708
|
this.cacheFilename = cacheFilename;
|
|
@@ -1946,6 +1964,11 @@ const META_DATA_VERSION_SUFFIX = "-1-" + Object.keys({
|
|
|
1946
1964
|
* Caches cspell results on disk
|
|
1947
1965
|
*/
|
|
1948
1966
|
var DiskCache = class {
|
|
1967
|
+
cacheFileLocation;
|
|
1968
|
+
useCheckSum;
|
|
1969
|
+
cspellVersion;
|
|
1970
|
+
useUniversalCache;
|
|
1971
|
+
fileEntryCache;
|
|
1949
1972
|
cacheDir;
|
|
1950
1973
|
dependencyCache = /* @__PURE__ */ new Map();
|
|
1951
1974
|
dependencyCacheTree = {};
|
|
@@ -2468,12 +2491,13 @@ async function processFile(file, cache, prefetch, processFileOptions) {
|
|
|
2468
2491
|
let spellResult = {};
|
|
2469
2492
|
try {
|
|
2470
2493
|
const { showSuggestions: generateSuggestions, validateDirectives, skipValidation } = cfg.options;
|
|
2471
|
-
const
|
|
2494
|
+
const validateOptions = clean({
|
|
2472
2495
|
generateSuggestions,
|
|
2473
2496
|
numSuggestions: configInfo.config.numSuggestions ?? 5,
|
|
2474
2497
|
validateDirectives,
|
|
2475
2498
|
skipValidation
|
|
2476
|
-
})
|
|
2499
|
+
});
|
|
2500
|
+
const r = await spellCheckDocument(doc, validateOptions, userSettings);
|
|
2477
2501
|
spellResult = r;
|
|
2478
2502
|
result.processed = r.checked;
|
|
2479
2503
|
result.perf = r.perf ? { ...r.perf } : void 0;
|
|
@@ -2626,7 +2650,6 @@ function sizeToNumber(size) {
|
|
|
2626
2650
|
//#endregion
|
|
2627
2651
|
//#region src/lint/processFiles.ts
|
|
2628
2652
|
const BATCH_FETCH_SIZE = 12;
|
|
2629
|
-
const BATCH_PROCESS_SIZE = 1;
|
|
2630
2653
|
function prefetch(fileToProcess, cfg) {
|
|
2631
2654
|
const { filename } = fileToProcess;
|
|
2632
2655
|
if (isBinaryFile$1(filename, cfg.root)) return {
|
|
@@ -2734,14 +2757,10 @@ async function processFiles(files, options) {
|
|
|
2734
2757
|
for await (const pf of prefetchFilesAsync(files)) yield processPrefetchFileResult(pf);
|
|
2735
2758
|
return;
|
|
2736
2759
|
}
|
|
2737
|
-
|
|
2738
|
-
|
|
2739
|
-
|
|
2740
|
-
yield processPrefetchFileResult(pf);
|
|
2741
|
-
}
|
|
2742
|
-
return;
|
|
2760
|
+
for (const pf of prefetchFiles(files)) {
|
|
2761
|
+
await pf.result;
|
|
2762
|
+
yield processPrefetchFileResult(pf);
|
|
2743
2763
|
}
|
|
2744
|
-
yield* pipe(prefetchIterable(pipe(prefetchFiles(files), opMap$1(async (pf) => processPrefetchFileResult(pf))), BATCH_PROCESS_SIZE));
|
|
2745
2764
|
}
|
|
2746
2765
|
for await (const processed of loadAndProcessFiles()) {
|
|
2747
2766
|
const { filename, sequence, sequenceSize, result } = processed;
|
|
@@ -2780,7 +2799,7 @@ function runResult(init = {}) {
|
|
|
2780
2799
|
};
|
|
2781
2800
|
}
|
|
2782
2801
|
//#endregion
|
|
2783
|
-
//#region \0@oxc-project+runtime@0.
|
|
2802
|
+
//#region \0@oxc-project+runtime@0.144.0/helpers/esm/usingCtx.js
|
|
2784
2803
|
function _usingCtx() {
|
|
2785
2804
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
2786
2805
|
var n = Error();
|
|
@@ -3066,7 +3085,8 @@ async function generateGitIgnore(roots) {
|
|
|
3066
3085
|
return new GitIgnore(root?.map((p) => path$1.resolve(p)));
|
|
3067
3086
|
}
|
|
3068
3087
|
async function useFileLists(fileListFiles, filterFiles) {
|
|
3069
|
-
|
|
3088
|
+
const files = readFileListFiles(fileListFiles);
|
|
3089
|
+
return pipeAsync(files, opFilter(filterFiles), opFilterAsync(isNotDir));
|
|
3070
3090
|
}
|
|
3071
3091
|
function createIncludeFileFilterFn(includeGlobPatterns, root, dot) {
|
|
3072
3092
|
if (!includeGlobPatterns?.length) return () => true;
|
|
@@ -3100,6 +3120,9 @@ function calcVerboseLevel(options) {
|
|
|
3100
3120
|
//#region src/lint/LintRequest.ts
|
|
3101
3121
|
const defaultContextRange = 20;
|
|
3102
3122
|
var LintRequest = class {
|
|
3123
|
+
fileGlobs;
|
|
3124
|
+
options;
|
|
3125
|
+
reporter;
|
|
3103
3126
|
locale;
|
|
3104
3127
|
configFile;
|
|
3105
3128
|
excludes;
|
|
@@ -3159,9 +3182,7 @@ function extractUnknownWordsConfig(options) {
|
|
|
3159
3182
|
case "typos":
|
|
3160
3183
|
config.unknownWords = unknownWordsChoices.ReportCommonTypos;
|
|
3161
3184
|
break;
|
|
3162
|
-
case "flagged":
|
|
3163
|
-
config.unknownWords = unknownWordsChoices.ReportFlagged;
|
|
3164
|
-
break;
|
|
3185
|
+
case "flagged": config.unknownWords = unknownWordsChoices.ReportFlagged;
|
|
3165
3186
|
}
|
|
3166
3187
|
return config;
|
|
3167
3188
|
}
|
|
@@ -3193,6 +3214,7 @@ function simpleRepl() {
|
|
|
3193
3214
|
return new SimpleRepl();
|
|
3194
3215
|
}
|
|
3195
3216
|
var SimpleRepl = class {
|
|
3217
|
+
prompt;
|
|
3196
3218
|
beforeEach;
|
|
3197
3219
|
completer;
|
|
3198
3220
|
_history;
|
|
@@ -3310,7 +3332,8 @@ function extractSpecialDictionaries(config) {
|
|
|
3310
3332
|
}
|
|
3311
3333
|
async function listDictionaries(options) {
|
|
3312
3334
|
const configFile = await readConfig(options.config, void 0);
|
|
3313
|
-
const
|
|
3335
|
+
const loadDefault = options.defaultConfiguration ?? configFile.config.loadDefaultConfiguration ?? true;
|
|
3336
|
+
const configBase = mergeSettings(await getDefaultSettings(loadDefault), await getGlobalSettingsAsync(), configFile.config);
|
|
3314
3337
|
const useFileType = options.fileType === "text" ? "plaintext" : options.fileType;
|
|
3315
3338
|
if (options.locale) configBase.language = options.locale;
|
|
3316
3339
|
const config = combineTextAndLanguageSettings(configBase, "", useFileType || configBase.languageId || "plaintext");
|
|
@@ -3369,7 +3392,8 @@ async function* trace(words, options) {
|
|
|
3369
3392
|
const loadDefault = options.defaultConfiguration ?? configFile.config.loadDefaultConfiguration ?? true;
|
|
3370
3393
|
const additionalSettings = {};
|
|
3371
3394
|
if (options.dictionary) additionalSettings.dictionaries = options.dictionary;
|
|
3372
|
-
|
|
3395
|
+
const config = mergeSettings(await getDefaultSettings(loadDefault), await getGlobalSettingsAsync(), configFile.config, additionalSettings);
|
|
3396
|
+
yield* traceWordsAsync(iWords, config, clean({
|
|
3373
3397
|
languageId,
|
|
3374
3398
|
locale,
|
|
3375
3399
|
ignoreCase,
|
|
@@ -3436,4 +3460,4 @@ function parseApplicationFeatureFlags(flags) {
|
|
|
3436
3460
|
//#endregion
|
|
3437
3461
|
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 };
|
|
3438
3462
|
|
|
3439
|
-
//# sourceMappingURL=application-
|
|
3463
|
+
//# sourceMappingURL=application-BQ6838px.js.map
|
|
@@ -1,66 +1,65 @@
|
|
|
1
|
-
import { a as SuggestionOptions, i as LinterCliOptions, n as DictionariesOptions, o as TraceOptions, r as LegacyOptions, t as BaseOptions } from "./options-
|
|
1
|
+
import { a as SuggestionOptions, i as LinterCliOptions, n as DictionariesOptions, o as TraceOptions, r as LegacyOptions, t as BaseOptions } from "./options-CG62AIq-.js";
|
|
2
2
|
import { CheckTextInfo, FeatureFlags, IncludeExcludeFlag, SuggestionsForWordResult, TraceResult, TraceWordResult } from "cspell-lib";
|
|
3
3
|
import { CSpellReporter, RunResult } from "@cspell/cspell-types";
|
|
4
|
-
|
|
5
4
|
//#region src/config/options.d.ts
|
|
6
5
|
interface BaseConfigOptions {
|
|
7
6
|
/**
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
7
|
+
* The path to the configuration file to create / update.
|
|
8
|
+
* If not provided, a default file name will be used based on the format.
|
|
9
|
+
*/
|
|
11
10
|
config?: string;
|
|
12
11
|
/**
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
12
|
+
* The list of configuration files or dictionary packages to import.
|
|
13
|
+
* This can be a list of file paths, package names, or URLs.
|
|
14
|
+
*/
|
|
16
15
|
import?: string[];
|
|
17
16
|
/**
|
|
18
|
-
|
|
19
|
-
|
|
17
|
+
* The locale to use when spell checking (e.g., en, en-US, de).
|
|
18
|
+
*/
|
|
20
19
|
locale?: string;
|
|
21
20
|
/**
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
21
|
+
* Whether to add comments to the configuration file.
|
|
22
|
+
* - `true` - comments will be added to the configuration file.
|
|
23
|
+
* - `false` - no comments will be added.
|
|
24
|
+
* - `undefined` - the default behavior will be used based on the format.
|
|
25
|
+
*/
|
|
27
26
|
comments?: boolean;
|
|
28
27
|
/**
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
28
|
+
* Whether to remove all comments from the configuration file.
|
|
29
|
+
* - `true` - all comments will be removed.
|
|
30
|
+
* - `false` | `undefined` - no comments will be removed.
|
|
31
|
+
* @implies `comments: false`
|
|
32
|
+
*/
|
|
34
33
|
removeComments?: boolean;
|
|
35
34
|
/**
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
35
|
+
* Whether to add the schema reference to the configuration file.
|
|
36
|
+
* - `true` - the schema reference will be added / updated.
|
|
37
|
+
* - `false` - no schema reference will be added.
|
|
38
|
+
*/
|
|
40
39
|
schema?: boolean;
|
|
41
40
|
/**
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
41
|
+
* The list of dictionaries to enable in the configuration file.
|
|
42
|
+
* These are added to an existing configuration file or a new one.
|
|
43
|
+
* Existing dictionaries will not be removed.
|
|
44
|
+
*/
|
|
46
45
|
dictionary?: string[];
|
|
47
46
|
/**
|
|
48
|
-
|
|
49
|
-
|
|
47
|
+
* Whether to write the configuration to stdout instead of a file.
|
|
48
|
+
*/
|
|
50
49
|
stdout?: boolean;
|
|
51
50
|
}
|
|
52
51
|
interface InitOptions extends BaseConfigOptions {
|
|
53
52
|
/**
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
53
|
+
* The path where the configuration file will be written, it can be a file path or a URL.
|
|
54
|
+
* If not provided, a default file name will be used based on the format.
|
|
55
|
+
* The default will be `cspell.config.yaml` or `cspell.json` based on the format.
|
|
56
|
+
* @conflicts `config` - If `config` is provided, it will be used instead of `output`.
|
|
57
|
+
*/
|
|
59
58
|
output?: string;
|
|
60
59
|
/**
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
60
|
+
* The format of the configuration file.
|
|
61
|
+
* @conflicts `config` - If `config` is provided, the format will be inferred from the file extension.
|
|
62
|
+
*/
|
|
64
63
|
format?: "yaml" | "yml" | "json" | "jsonc";
|
|
65
64
|
}
|
|
66
65
|
//#endregion
|
|
@@ -72,36 +71,36 @@ interface TimedSuggestionsForWordResult extends SuggestionsForWordResult {
|
|
|
72
71
|
//#region src/dictionaries/listDictionaries.d.ts
|
|
73
72
|
interface ListDictionariesResult {
|
|
74
73
|
/**
|
|
75
|
-
|
|
76
|
-
|
|
74
|
+
* The name of the dictionary.
|
|
75
|
+
*/
|
|
77
76
|
name: string;
|
|
78
77
|
/**
|
|
79
|
-
|
|
80
|
-
|
|
78
|
+
* The description of the dictionary.
|
|
79
|
+
*/
|
|
81
80
|
description?: string | undefined;
|
|
82
81
|
/**
|
|
83
|
-
|
|
84
|
-
|
|
82
|
+
* The path to the dictionary file.
|
|
83
|
+
*/
|
|
85
84
|
path?: string | undefined;
|
|
86
85
|
/**
|
|
87
|
-
|
|
88
|
-
|
|
86
|
+
* True if the dictionary is enabled.
|
|
87
|
+
*/
|
|
89
88
|
enabled: boolean;
|
|
90
89
|
/**
|
|
91
|
-
|
|
92
|
-
|
|
90
|
+
* True if the dictionary is blocked.
|
|
91
|
+
*/
|
|
93
92
|
blocked: boolean;
|
|
94
93
|
/**
|
|
95
|
-
|
|
96
|
-
|
|
94
|
+
* The inline dictionaries supported by the dictionary.
|
|
95
|
+
*/
|
|
97
96
|
inline?: string[] | undefined;
|
|
98
97
|
/**
|
|
99
|
-
|
|
100
|
-
|
|
98
|
+
* the languages locales supported by the dictionary.
|
|
99
|
+
*/
|
|
101
100
|
locales?: string[] | undefined;
|
|
102
101
|
/**
|
|
103
|
-
|
|
104
|
-
|
|
102
|
+
* The file types supported by the dictionary.
|
|
103
|
+
*/
|
|
105
104
|
fileTypes?: string[] | undefined;
|
|
106
105
|
}
|
|
107
106
|
declare function listDictionaries(options: DictionariesOptions): Promise<ListDictionariesResult[]>;
|
|
@@ -117,4 +116,4 @@ declare function createInit(options: InitOptions): Promise<void>;
|
|
|
117
116
|
declare function parseApplicationFeatureFlags(flags: string[] | undefined): FeatureFlags;
|
|
118
117
|
//#endregion
|
|
119
118
|
export { checkText as a, parseApplicationFeatureFlags as c, listDictionaries as d, TraceResult as i, suggestions as l, CheckTextResult as n, createInit as o, IncludeExcludeFlag as r, lint as s, AppError as t, trace as u };
|
|
120
|
-
//# sourceMappingURL=application-
|
|
119
|
+
//# sourceMappingURL=application-BeYqH0KN.d.ts.map
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as checkText, c as parseApplicationFeatureFlags, d as listDictionaries, i as TraceResult, l as suggestions, n as CheckTextResult, o as createInit, r as IncludeExcludeFlag, s as lint, t as AppError, u as trace } from "./application-
|
|
2
|
-
export { AppError, CheckTextResult, IncludeExcludeFlag, TraceResult, checkText, createInit, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
|
1
|
+
import { a as checkText, c as parseApplicationFeatureFlags, d as listDictionaries, i as TraceResult, l as suggestions, n as CheckTextResult, o as createInit, r as IncludeExcludeFlag, s as lint, t as AppError, u as trace } from "./application-BeYqH0KN.js";
|
|
2
|
+
export { AppError, CheckTextResult, IncludeExcludeFlag, type TraceResult, checkText, createInit, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
package/dist/esm/application.js
CHANGED
|
@@ -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-
|
|
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-BQ6838px.js";
|
|
2
2
|
export { IncludeExcludeFlag, checkText, createInit, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { i as LinterCliOptions, o as TraceOptions, s as FinalizedReporter, t as BaseOptions } from "./options-
|
|
2
|
-
import { a as checkText, c as parseApplicationFeatureFlags, d as listDictionaries, i as TraceResult, l as suggestions, n as CheckTextResult, o as createInit, r as IncludeExcludeFlag, s as lint, t as AppError, u as trace } from "./application-
|
|
1
|
+
import { i as LinterCliOptions, o as TraceOptions, s as FinalizedReporter, t as BaseOptions } from "./options-CG62AIq-.js";
|
|
2
|
+
import { a as checkText, c as parseApplicationFeatureFlags, d as listDictionaries, i as TraceResult, l as suggestions, n as CheckTextResult, o as createInit, r as IncludeExcludeFlag, s as lint, t as AppError, u as trace } from "./application-BeYqH0KN.js";
|
|
3
|
+
import "chalk";
|
|
3
4
|
import { CSpellReporter, ReporterConfiguration } from "@cspell/cspell-types";
|
|
4
5
|
import { WriteStream } from "node:tty";
|
|
5
6
|
export * from "@cspell/cspell-types";
|
|
6
|
-
|
|
7
7
|
//#region src/console.d.ts
|
|
8
8
|
type Log = (format?: any, ...params: any[]) => void;
|
|
9
9
|
type IOStream = NodeJS.WritableStream & Pick<WriteStream, "isTTY" | "rows" | "columns"> & Pick<Partial<WriteStream>, "hasColors" | "clearLine" | "getColorDepth">;
|
|
@@ -28,9 +28,9 @@ interface Channel {
|
|
|
28
28
|
type ReporterConsole = IConsole;
|
|
29
29
|
interface CSpellReporterConfiguration extends Readonly<ReporterConfiguration>, Readonly<LinterCliOptions> {
|
|
30
30
|
/**
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
31
|
+
* The console to use for reporting.
|
|
32
|
+
* @since 8.11.1
|
|
33
|
+
*/
|
|
34
34
|
readonly console?: ReporterConsole;
|
|
35
35
|
}
|
|
36
36
|
interface CSpellReporterModule {
|
|
@@ -43,5 +43,5 @@ interface ReporterOptions extends Pick<LinterCliOptions, "color" | "debug" | "is
|
|
|
43
43
|
}
|
|
44
44
|
declare function getReporter(options: ReporterOptions, config?: CSpellReporterConfiguration): FinalizedReporter;
|
|
45
45
|
//#endregion
|
|
46
|
-
export { AppError, type BaseOptions, type LinterCliOptions as CSpellApplicationOptions, type CSpellReporterConfiguration, type CSpellReporterModule, CheckTextResult, IncludeExcludeFlag, type TraceOptions, TraceResult, checkText, createInit, getReporter as getDefaultReporter, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
|
46
|
+
export { AppError, type BaseOptions, type LinterCliOptions as CSpellApplicationOptions, type CSpellReporterConfiguration, type CSpellReporterModule, CheckTextResult, IncludeExcludeFlag, type TraceOptions, type TraceResult, checkText, createInit, getReporter as getDefaultReporter, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
|
47
47
|
//# sourceMappingURL=index.d.ts.map
|
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-
|
|
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-BQ6838px.js";
|
|
2
2
|
export * from "@cspell/cspell-types";
|
|
3
3
|
export { IncludeExcludeFlag, checkText, createInit, getReporter as getDefaultReporter, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|