cspell 10.4.0-alpha.1 → 10.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/esm/app.d.ts +5 -9
- package/dist/esm/app.js +37 -42
- package/dist/esm/{application-DRa52DKq.js → application-9lyhPNzW.js} +139 -177
- package/dist/esm/{application-CFfMlhE_.d.ts → application-CcaBK3o9.d.ts} +7 -12
- package/dist/esm/application.d.ts +1 -1
- package/dist/esm/application.js +1 -2
- package/dist/esm/index.d.ts +2 -8
- package/dist/esm/index.js +1 -2
- package/dist/esm/{options-D5lC3IZu.d.ts → options-Dr5rOq5n.d.ts} +1 -7
- package/package.json +20 -19
package/README.md
CHANGED
|
@@ -12,7 +12,7 @@ If our spell checkers save you time, please consider supporting their developmen
|
|
|
12
12
|
|
|
13
13
|
Please show your support through one of the following sites:
|
|
14
14
|
|
|
15
|
-
[](https://github.com/sponsors/streetsidesoftware)
|
|
15
|
+
[](https://github.com/sponsors/streetsidesoftware) [](https://www.paypal.com/donate/?hosted_button_id=26LNBP2Q6MKCY) [](https://opencollective.com/cspell) [](https://streetsidesoftware.com/sponsor/)
|
|
16
16
|
|
|
17
17
|
<!--- @@inject-end: ../../static/sponsor.md --->
|
|
18
18
|
|
package/dist/esm/app.d.ts
CHANGED
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
import { i as LinterCliOptions } from "./options-
|
|
1
|
+
import { i as LinterCliOptions } from "./options-Dr5rOq5n.js";
|
|
2
2
|
import { Command } from "commander";
|
|
3
|
-
|
|
4
|
-
declare class CheckFailed extends Error {
|
|
3
|
+
export declare class CheckFailed extends Error {
|
|
5
4
|
readonly exitCode: number;
|
|
6
5
|
constructor(message: string, exitCode?: number);
|
|
7
6
|
}
|
|
8
|
-
declare class ApplicationError extends Error {
|
|
7
|
+
export declare class ApplicationError extends Error {
|
|
9
8
|
readonly exitCode: number;
|
|
10
9
|
readonly cause?: Error | undefined;
|
|
11
10
|
constructor(message: string, exitCode?: number, cause?: Error | undefined);
|
|
12
11
|
}
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
declare function run(command?: Command, argv?: string[]): Promise<void>;
|
|
16
|
-
//#endregion
|
|
17
|
-
export { ApplicationError, CheckFailed, type LinterCliOptions as Options, run };
|
|
12
|
+
export declare function run(command?: Command, argv?: string[]): Promise<void>;
|
|
13
|
+
export type { LinterCliOptions as Options };
|
|
18
14
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/esm/app.js
CHANGED
|
@@ -1,10 +1,11 @@
|
|
|
1
|
-
import { C as
|
|
1
|
+
import { C as CheckFailed, S as ApplicationError, _ as padWidth, a as parseApplicationFeatureFlags, b as pruneAnsiTextStart, c as listDictionaries, d as validateUnitSize, f as DEFAULT_CACHE_LOCATION, g as padLeft, h as tableToLines, i as lint, l as ReportChoicesAll, n as checkText, o as suggestions, p as npmPackage, r as createInit, s as trace, t as IncludeExcludeFlag, u as cvtLinterCliCommandOptionsToLinterCliOptions, v as ansiWidth, w as console, x as width, y as pruneAnsiTextEnd } from "./application-9lyhPNzW.js";
|
|
2
2
|
import { Link } from "cspell-lib";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import * as iPath from "node:path";
|
|
5
|
+
import { unindent } from "@streetsidesoftware/unindent";
|
|
5
6
|
import { Option, program } from "commander";
|
|
6
7
|
import { satisfies } from "semver";
|
|
7
|
-
|
|
8
|
+
// src/commandCheck.ts
|
|
8
9
|
function commandCheck(prog) {
|
|
9
10
|
return prog.command("check <files...>").description("Spell check file(s) and display the result. The full file is displayed in color.").option("-c, --config <cspell.json>", "Configuration file to use. By default cspell looks for cspell.json in the current directory.").option("--validate-directives", "Validate in-document CSpell directives.").option("--no-validate-directives", "Do not validate in-document CSpell directives.").option("--no-color", "Turn off color.").option("--color", "Force color").option("--json", "Output results in JSON format.").option("--no-exit-code", "Do not return an exit code if issues are found.").addOption(new Option("--default-configuration", "Load the default configuration and dictionaries.").hideHelp()).addOption(new Option("--no-default-configuration", "Do not load the default configuration and dictionaries.")).action(async (files, options) => {
|
|
10
11
|
const useExitCode = options.exitCode ?? true;
|
|
@@ -59,8 +60,7 @@ async function processRequestJSON(files, options) {
|
|
|
59
60
|
function isErrNoEnt(error) {
|
|
60
61
|
return error?.code === "ENOENT";
|
|
61
62
|
}
|
|
62
|
-
|
|
63
|
-
//#region src/commandHelpers.ts
|
|
63
|
+
// src/commandHelpers.ts
|
|
64
64
|
/**
|
|
65
65
|
* Collects string values into an array.
|
|
66
66
|
* @param value the new value(s) to collect.
|
|
@@ -96,8 +96,7 @@ function crOpt(name, description, parseArg, defaultValue) {
|
|
|
96
96
|
if (defaultValue !== void 0) option.default(defaultValue);
|
|
97
97
|
return option;
|
|
98
98
|
}
|
|
99
|
-
|
|
100
|
-
//#region src/util/outputWidth.ts
|
|
99
|
+
// src/util/outputWidth.ts
|
|
101
100
|
/**
|
|
102
101
|
* The width to format output for.
|
|
103
102
|
* `COLUMNS` wins when it is a positive integer, otherwise the width of the stream if it has one.
|
|
@@ -109,8 +108,7 @@ function parseColumns(value) {
|
|
|
109
108
|
if (!value || !/^\s*\d+\s*$/.test(value)) return void 0;
|
|
110
109
|
return Number.parseInt(value, 10) || void 0;
|
|
111
110
|
}
|
|
112
|
-
|
|
113
|
-
//#region src/emitters/helpers.ts
|
|
111
|
+
// src/emitters/helpers.ts
|
|
114
112
|
function trimMidPath(s, w, sep) {
|
|
115
113
|
if (s.length <= w) return s;
|
|
116
114
|
const parts = s.split(sep);
|
|
@@ -161,8 +159,7 @@ function formatDictionaryLocation(dictSource, maxWidth, { cwd, dictionaryPathFor
|
|
|
161
159
|
relPath = isNodeModule ? relPath.slice(idxNodeModule) : relPath;
|
|
162
160
|
return trimMidPath(relPath.length < dictSource.length ? relPath : dictSource, maxWidth, iPath.sep);
|
|
163
161
|
}
|
|
164
|
-
|
|
165
|
-
//#region src/emitters/dictionaryListEmitter.ts
|
|
162
|
+
// src/emitters/dictionaryListEmitter.ts
|
|
166
163
|
const maxWidth$1 = 120;
|
|
167
164
|
function emitListDictionariesResults(results, options) {
|
|
168
165
|
const report = calcListDictsResultsReport(results, options);
|
|
@@ -232,8 +229,7 @@ function dictTableRowToTableRow(row) {
|
|
|
232
229
|
function colorize$1(fn) {
|
|
233
230
|
return (s) => s ? fn(s) : "";
|
|
234
231
|
}
|
|
235
|
-
|
|
236
|
-
//#region src/emitters/DictionaryPathFormat.ts
|
|
232
|
+
// src/emitters/DictionaryPathFormat.ts
|
|
237
233
|
const formats = {
|
|
238
234
|
full: true,
|
|
239
235
|
hide: true,
|
|
@@ -244,16 +240,14 @@ function isDictionaryPathFormat(value) {
|
|
|
244
240
|
if (!value || typeof value !== "string") return false;
|
|
245
241
|
return value in formats;
|
|
246
242
|
}
|
|
247
|
-
|
|
248
|
-
//#region src/util/canUseColor.ts
|
|
243
|
+
// src/util/canUseColor.ts
|
|
249
244
|
function canUseColor(colorOption) {
|
|
250
245
|
if (colorOption !== void 0) return colorOption;
|
|
251
246
|
if (!("NO_COLOR" in process.env)) return void 0;
|
|
252
247
|
if (!process.env["NO_COLOR"] || process.env["NO_COLOR"] === "false") return void 0;
|
|
253
248
|
return false;
|
|
254
249
|
}
|
|
255
|
-
|
|
256
|
-
//#region src/commandDictionaries.ts
|
|
250
|
+
// src/commandDictionaries.ts
|
|
257
251
|
function commandDictionaries(prog) {
|
|
258
252
|
return prog.command("dictionaries").description(`List dictionaries`).option("-c, --config <cspell.json>", "Configuration file to use. By default cspell looks for cspell.json in the current directory.").addOption(crOpt("--path-format <format>", "Configure how to display the dictionary path.").choices([
|
|
259
253
|
"hide",
|
|
@@ -271,20 +265,18 @@ function commandDictionaries(prog) {
|
|
|
271
265
|
});
|
|
272
266
|
});
|
|
273
267
|
}
|
|
274
|
-
|
|
275
|
-
//#region src/commandInit.ts
|
|
268
|
+
// src/commandInit.ts
|
|
276
269
|
function commandInit(prog) {
|
|
277
|
-
return prog.command("init").description("Initialize a CSpell configuration file.").addOption(crOpt("-c, --config <path>", "Path to the CSpell configuration file. Conflicts with --output and --format.").conflicts(["output", "format"])).option("-o, --output <path>", "Define where to write file.").addOption(crOpt("--format <format>", "Define the format of
|
|
270
|
+
return prog.command("init").description("Initialize a CSpell configuration file.").addOption(crOpt("-c, --config <path>", "Path to the CSpell configuration file. Defaults to the one in the current directory. Conflicts with --output and --format.").conflicts(["output", "format"])).option("-o, --output <path>", "Define where to write a new file instead of using an existing config.").addOption(crOpt("--format <format>", "Define the format of a new file. Default: yaml.").choices([
|
|
278
271
|
"yaml",
|
|
279
272
|
"yml",
|
|
280
273
|
"json",
|
|
281
274
|
"jsonc"
|
|
282
|
-
])
|
|
275
|
+
])).option("--import <path|package>", "Import a configuration file or dictionary package.", collect$1).option("--locale <locale>", "Define the locale to use when spell checking (e.g., en, en-US, de).").addOption(crOpt("--dictionary <dictionary>", "Enable a dictionary. Can be used multiple times.", collect$1).default(void 0)).addOption(crOpt("--comments", "Add comments to the config file.").default(void 0).hideHelp()).option("--no-comments", "Do not add comments to the config file.").addOption(crOpt("--remove-comments", "Remove all comments from the config file.").implies({ comments: false })).addOption(crOpt("--schema", "Add or update the schema reference. Default for a config with no settings.").default(void 0)).option("--no-schema", "Do not add the schema reference to the config file.").option("--stdout", "Write the configuration to stdout instead of a file.").action((options) => {
|
|
283
276
|
return createInit(options);
|
|
284
277
|
});
|
|
285
278
|
}
|
|
286
|
-
|
|
287
|
-
//#region src/link.ts
|
|
279
|
+
// src/link.ts
|
|
288
280
|
const listGlobalImports = Link.listGlobalImports;
|
|
289
281
|
const addPathsToGlobalImports = Link.addPathsToGlobalImports;
|
|
290
282
|
const removePathsFromGlobalImports = Link.removePathsFromGlobalImports;
|
|
@@ -324,8 +316,7 @@ function addPathsToGlobalImportsResultToTable(results) {
|
|
|
324
316
|
rows: results.resolvedSettings.map(toColumns)
|
|
325
317
|
};
|
|
326
318
|
}
|
|
327
|
-
|
|
328
|
-
//#region src/commandLink.ts
|
|
319
|
+
// src/commandLink.ts
|
|
329
320
|
function commandLink(prog) {
|
|
330
321
|
const linkCommand = prog.command("link").description("Link dictionaries and other settings to the cspell global config.");
|
|
331
322
|
linkCommand.command("list", { isDefault: true }).alias("ls").description("List currently linked configurations.").action(async () => {
|
|
@@ -347,8 +338,7 @@ function commandLink(prog) {
|
|
|
347
338
|
});
|
|
348
339
|
return linkCommand;
|
|
349
340
|
}
|
|
350
|
-
|
|
351
|
-
//#region src/commandLint.ts
|
|
341
|
+
// src/commandLint.ts
|
|
352
342
|
const usage = `\
|
|
353
343
|
[options] [globs...] [file://<path> ...]
|
|
354
344
|
[stdin[://<path>]]
|
|
@@ -468,8 +458,20 @@ function helpIssueTemplate(opts) {
|
|
|
468
458
|
* @returns
|
|
469
459
|
*/
|
|
470
460
|
function augmentCommandHelp(context) {
|
|
461
|
+
return lintHelpAfterOptions(context.command, "Hidden Options:");
|
|
462
|
+
}
|
|
463
|
+
/**
|
|
464
|
+
* The extra lint help for `cspell --help`.
|
|
465
|
+
* The program answers `--help` before the lint options are parsed, so parse them from its arguments.
|
|
466
|
+
* @param context - the program's help context.
|
|
467
|
+
* @param lintCommand - the lint command.
|
|
468
|
+
*/
|
|
469
|
+
function lintHelpForProgram(context, lintCommand) {
|
|
470
|
+
lintCommand.parseOptions(context.command.args);
|
|
471
|
+
return lintHelpAfterOptions(lintCommand, `Hidden options for "${lintCommand.name()}":`);
|
|
472
|
+
}
|
|
473
|
+
function lintHelpAfterOptions(command, hiddenOptionsHeading) {
|
|
471
474
|
const output = [];
|
|
472
|
-
const command = context.command;
|
|
473
475
|
const opts = command.opts();
|
|
474
476
|
const showHidden = !!opts.verbose;
|
|
475
477
|
const hiddenHelp = [];
|
|
@@ -478,7 +480,7 @@ function augmentCommandHelp(context) {
|
|
|
478
480
|
const hiddenOptions = command.options.filter((opt) => opt.hidden && showHidden);
|
|
479
481
|
const flagColWidth = Math.max(...command.options.map((opt) => opt.flags.length), 0);
|
|
480
482
|
for (const options of hiddenOptions) {
|
|
481
|
-
if (!hiddenHelp.length) hiddenHelp.push("\
|
|
483
|
+
if (!hiddenHelp.length) hiddenHelp.push("\n" + hiddenOptionsHeading);
|
|
482
484
|
hiddenHelp.push(help.formatItem(options.flags, flagColWidth, options.description, help));
|
|
483
485
|
}
|
|
484
486
|
output.push(...hiddenHelp, advanced);
|
|
@@ -491,8 +493,7 @@ function validateMaxFileSize(size) {
|
|
|
491
493
|
function increaseVerbosity(_dummyValue, previous) {
|
|
492
494
|
return previous + 1;
|
|
493
495
|
}
|
|
494
|
-
|
|
495
|
-
//#region src/emitters/suggestionsEmitter.ts
|
|
496
|
+
// src/emitters/suggestionsEmitter.ts
|
|
496
497
|
const regExpRTL = /([ \u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]+)/g;
|
|
497
498
|
function reverseRtlText(s) {
|
|
498
499
|
return s.replaceAll(regExpRTL, (s) => [...s].reverse().join(""));
|
|
@@ -556,8 +557,7 @@ function formatWordSingle(s) {
|
|
|
556
557
|
word = s.isPreferred ? chalk.yellow(word + " *") : word;
|
|
557
558
|
return word;
|
|
558
559
|
}
|
|
559
|
-
|
|
560
|
-
//#region src/commandSuggestion.ts
|
|
560
|
+
// src/commandSuggestion.ts
|
|
561
561
|
function collect(value, previous) {
|
|
562
562
|
value = value.replace(/^=/, "");
|
|
563
563
|
if (!previous) return [value];
|
|
@@ -588,8 +588,7 @@ function mergeArrays(a, b) {
|
|
|
588
588
|
if (b === void 0) return a;
|
|
589
589
|
return [...a, ...b];
|
|
590
590
|
}
|
|
591
|
-
|
|
592
|
-
//#region src/emitters/traceEmitter.ts
|
|
591
|
+
// src/emitters/traceEmitter.ts
|
|
593
592
|
const maxWidth = 120;
|
|
594
593
|
function emitTraceResults(word, found, results, options) {
|
|
595
594
|
const report = calcTraceResultsReport(word, found, results, options);
|
|
@@ -669,8 +668,7 @@ function calcFoundChar(r) {
|
|
|
669
668
|
function colorize(fn) {
|
|
670
669
|
return (s) => s ? fn(s) : "";
|
|
671
670
|
}
|
|
672
|
-
|
|
673
|
-
//#region src/commandTrace.ts
|
|
671
|
+
// src/commandTrace.ts
|
|
674
672
|
function commandTrace(prog) {
|
|
675
673
|
return prog.command("trace").description(`Trace words -- Search for words in the configuration and dictionaries.`).option("-c, --config <cspell.json>", "Configuration file to use. By default cspell looks for cspell.json in the current directory.").option("--locale <locale>", "Set language locales. i.e. \"en,fr\" for English and French, or \"en-GB\" for British English.").option("--language-id <language>", "Use programming language. i.e. \"php\" or \"scala\".").addOption(new Option("--languageId <language>", "Use programming language. i.e. \"php\" or \"scala\".").hideHelp()).option("--allow-compound-words", "Turn on allowCompoundWords").addOption(new Option("--allowCompoundWords", "Turn on allowCompoundWords.").hideHelp()).option("--no-allow-compound-words", "Turn off allowCompoundWords").option("--ignore-case", "Ignore case and accents when searching for words.").option("--no-ignore-case", "Do not ignore case and accents when searching for words.").option("--dictionary <name>", "Enable a dictionary by name. Can be used multiple times.", collect$1).option("--no-dictionary <name>", "Disable a dictionary by name. Can be used multiple times.", prefixCollect("!")).addOption(new Option("--dictionary-path <format>", "Configure how to display the dictionary path.").choices([
|
|
676
674
|
"hide",
|
|
@@ -725,8 +723,7 @@ function groupBy(items, key) {
|
|
|
725
723
|
}
|
|
726
724
|
return map;
|
|
727
725
|
}
|
|
728
|
-
|
|
729
|
-
//#region src/globalOptions.ts
|
|
726
|
+
// src/globalOptions.ts
|
|
730
727
|
function addGlobalOptionsToAction(command) {
|
|
731
728
|
command = command.addOption(new Option("-f,--flag <flag:value>", "Declare an execution flag value").hideHelp().argParser(collect$1));
|
|
732
729
|
return command;
|
|
@@ -741,8 +738,7 @@ function addGlobalOptionsAndHooks(command) {
|
|
|
741
738
|
function processGlobalOptions(options) {
|
|
742
739
|
parseApplicationFeatureFlags(options.flag);
|
|
743
740
|
}
|
|
744
|
-
|
|
745
|
-
//#region src/app.mts
|
|
741
|
+
// src/app.mts
|
|
746
742
|
async function run(command, argv) {
|
|
747
743
|
const prog = command || program;
|
|
748
744
|
const args = argv || process.argv;
|
|
@@ -755,7 +751,7 @@ async function run(command, argv) {
|
|
|
755
751
|
prog.version(npmPackage.version).description("Spelling Checker for Code").name("cspell");
|
|
756
752
|
if (!satisfies(process.versions.node, npmPackage.engines.node)) throw new ApplicationError(`Unsupported NodeJS version (${process.versions.node}); ${npmPackage.engines.node} is required`);
|
|
757
753
|
const lintCommand = addGlobalOptionsToAction(commandLint(prog, { isDefault: true }));
|
|
758
|
-
prog.addHelpText("after", (context) => defaultCommandOptionsHelp(context, lintCommand));
|
|
754
|
+
prog.addHelpText("after", (context) => defaultCommandOptionsHelp(context, lintCommand) + lintHelpForProgram(context, lintCommand));
|
|
759
755
|
addGlobalOptionsToAction(commandTrace(prog));
|
|
760
756
|
addGlobalOptionsToAction(commandCheck(prog));
|
|
761
757
|
addGlobalOptionsToAction(commandSuggestion(prog));
|
|
@@ -778,7 +774,6 @@ function defaultCommandOptionsHelp(context, defaultCommand) {
|
|
|
778
774
|
const heading = `Options for "${defaultCommand.name()}" (the default command):`;
|
|
779
775
|
return "\n" + helper.formatItemList(heading, items, helper).join("\n");
|
|
780
776
|
}
|
|
781
|
-
//#endregion
|
|
782
777
|
export { ApplicationError, CheckFailed, run };
|
|
783
778
|
|
|
784
779
|
//# sourceMappingURL=app.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
2
|
import { isAsyncIterable, opFilter, opMap, opTap, operators, pipeAsync, pipeAsync as asyncPipe, toAsyncIterable, toAsyncIterable as mergeAsyncIterables } from "@cspell/cspell-pipe";
|
|
3
3
|
import * as cspell from "cspell-lib";
|
|
4
|
-
import { ENV_CSPELL_GLOB_ROOT, IncludeExcludeFlag, MessageTypes, SuggestionError, Text, checkTextDocument, combineTextAndLanguageSettings, createDictionaryReferenceCollection, createPerfTimer, extractDependencies, extractImportErrors, fileToDocument, getDefaultSettings, getGlobalSettingsAsync, getSystemFeatureFlags, isBinaryFile, isSpellingDictionaryLoadError, mergeSettings, setLogger, shouldCheckDocument, spellCheckDocument, suggestionsForWords, traceWordsAsync } from "cspell-lib";
|
|
4
|
+
import { ENV_CSPELL_GLOB_ROOT, IncludeExcludeFlag, MessageTypes, SuggestionError, Text, checkTextDocument, combineTextAndLanguageSettings, createDictionaryReferenceCollection, createPerfTimer, defaultConfigFilenames, extractDependencies, extractImportErrors, fileToDocument, getDefaultSettings, getGlobalSettingsAsync, getSystemFeatureFlags, isBinaryFile, isSpellingDictionaryLoadError, mergeSettings, setLogger, shouldCheckDocument, spellCheckDocument, suggestionsForWords, traceWordsAsync } from "cspell-lib";
|
|
5
5
|
import assert from "node:assert";
|
|
6
6
|
import { format, formatWithOptions, stripVTControlCharacters } from "node:util";
|
|
7
7
|
import { enablePerformanceMeasurements, getCounters, measurePerf } from "@cspell/cspell-performance-monitor";
|
|
@@ -17,6 +17,7 @@ import * as path$1 from "node:path";
|
|
|
17
17
|
import path, { isAbsolute, posix, relative, resolve, sep } from "node:path";
|
|
18
18
|
import { opMap as opMap$1, pipe } from "@cspell/cspell-pipe/sync";
|
|
19
19
|
import { IssueType, MessageTypes as MessageTypes$1, unknownWordsChoices } from "@cspell/cspell-types";
|
|
20
|
+
import { indent, unindent } from "@streetsidesoftware/unindent";
|
|
20
21
|
import { dictionaryCacheEnableLogging, dictionaryCacheGetLog } from "cspell-dictionary";
|
|
21
22
|
import { GitIgnore, findRepoRoot } from "cspell-gitignore";
|
|
22
23
|
import { GlobMatcher, fileOrGlobToGlob, workaroundPicomatchBug } from "cspell-glob";
|
|
@@ -27,7 +28,7 @@ import { getStat, readFileText, toURL } from "cspell-io";
|
|
|
27
28
|
import { glob, isDynamicPattern } from "tinyglobby";
|
|
28
29
|
import * as readline from "node:readline";
|
|
29
30
|
import { parse, stringify } from "flatted";
|
|
30
|
-
|
|
31
|
+
// src/console.ts
|
|
31
32
|
var ImplChannel = class {
|
|
32
33
|
stream;
|
|
33
34
|
constructor(stream) {
|
|
@@ -64,8 +65,7 @@ function getColorLevel(stream) {
|
|
|
64
65
|
default: return 0;
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
|
|
68
|
-
//#region src/util/errors.ts
|
|
68
|
+
// src/util/errors.ts
|
|
69
69
|
var CheckFailed = class extends Error {
|
|
70
70
|
exitCode;
|
|
71
71
|
constructor(message, exitCode = 1) {
|
|
@@ -118,8 +118,7 @@ function toApplicationError(e, message) {
|
|
|
118
118
|
const err = toError$1(e);
|
|
119
119
|
return new ApplicationError(message ?? err.message, void 0, err);
|
|
120
120
|
}
|
|
121
|
-
|
|
122
|
-
//#region src/formatIssue.ts
|
|
121
|
+
// src/formatIssue.ts
|
|
123
122
|
function formatIssue(io, templateStr, issue, maxIssueTextWidth) {
|
|
124
123
|
function clean(t) {
|
|
125
124
|
return t.replace(/\s+/, " ");
|
|
@@ -219,8 +218,12 @@ function checkTemplate(template) {
|
|
|
219
218
|
return new ApplicationError(e instanceof Error ? e.message : `${e}`);
|
|
220
219
|
}
|
|
221
220
|
}
|
|
222
|
-
|
|
223
|
-
|
|
221
|
+
// src/util/constants.ts
|
|
222
|
+
const UTF8 = "utf8";
|
|
223
|
+
const STDIN = "stdin";
|
|
224
|
+
const STDINProtocol = "stdin:";
|
|
225
|
+
const STDINUrlPrefix = "stdin://";
|
|
226
|
+
// src/util/perfMeasurements.ts
|
|
224
227
|
function getPerfMeasurements() {
|
|
225
228
|
const measurements = performance.getEntriesByType("measure");
|
|
226
229
|
const root = {
|
|
@@ -287,8 +290,7 @@ function getPerfMeasurements() {
|
|
|
287
290
|
m.children.forEach(sortChildren);
|
|
288
291
|
}
|
|
289
292
|
}
|
|
290
|
-
|
|
291
|
-
//#region src/util/ansi.ts
|
|
293
|
+
// src/util/ansi.ts
|
|
292
294
|
function isAnsiString(s) {
|
|
293
295
|
return s.includes("\x1B") || s.includes("");
|
|
294
296
|
}
|
|
@@ -442,8 +444,7 @@ function pruneTextStart(str, maxWidth, pad = "…") {
|
|
|
442
444
|
}
|
|
443
445
|
return str;
|
|
444
446
|
}
|
|
445
|
-
|
|
446
|
-
//#region src/util/pad.ts
|
|
447
|
+
// src/util/pad.ts
|
|
447
448
|
function pad(s, w) {
|
|
448
449
|
const p = padWidth(s, w);
|
|
449
450
|
if (!p) return s;
|
|
@@ -458,8 +459,7 @@ function padLeft(s, w) {
|
|
|
458
459
|
if (!p) return s;
|
|
459
460
|
return s.padStart(p + s.length);
|
|
460
461
|
}
|
|
461
|
-
|
|
462
|
-
//#region src/util/table.ts
|
|
462
|
+
// src/util/table.ts
|
|
463
463
|
function tableToLines(table, deliminator) {
|
|
464
464
|
const del = deliminator || table.deliminator || " | ";
|
|
465
465
|
const columnWidths = [];
|
|
@@ -554,8 +554,7 @@ function headerDecorator(t) {
|
|
|
554
554
|
function decorateRowWith(row, ...decorators) {
|
|
555
555
|
return decorators.reduce((row, decorator) => row.map(decorator), row);
|
|
556
556
|
}
|
|
557
|
-
|
|
558
|
-
//#region src/util/util.ts
|
|
557
|
+
// src/util/util.ts
|
|
559
558
|
const uniqueFn = uniqueFilterFnGenerator;
|
|
560
559
|
function uniqueFilterFnGenerator(extractFn) {
|
|
561
560
|
const values = /* @__PURE__ */ new Set();
|
|
@@ -577,8 +576,7 @@ function clean(src) {
|
|
|
577
576
|
for (const key of Object.keys(r)) if (r[key] === void 0) delete r[key];
|
|
578
577
|
return r;
|
|
579
578
|
}
|
|
580
|
-
|
|
581
|
-
//#region src/cli-reporter.ts
|
|
579
|
+
// src/cli-reporter.ts
|
|
582
580
|
const templateIssue = `{green $filename}:{yellow $row:$col} - $message ({red $text}) $quickFix`;
|
|
583
581
|
const templateIssueNoFix = `{green $filename}:{yellow $row:$col} - $message ({red $text})`;
|
|
584
582
|
const templateIssueWithSuggestions = `{green $filename}:{yellow $row:$col} - $message ({red $text}) Suggestions: {yellow [$suggestions]}`;
|
|
@@ -614,10 +612,21 @@ function genIssueEmitter(stdIO, errIO, template, uniqueIssues, reportedIssuesCol
|
|
|
614
612
|
function nullEmitter() {}
|
|
615
613
|
function relativeUriFilename(uri, rootURL) {
|
|
616
614
|
const url = toFileURL(uri);
|
|
615
|
+
if (isStdinWithoutPath(url)) return STDIN;
|
|
617
616
|
const rel = urlRelative(rootURL, url);
|
|
618
617
|
if (rel.startsWith("..")) return toFilePathOrHref(url);
|
|
619
618
|
return rel;
|
|
620
619
|
}
|
|
620
|
+
function absoluteUriFilename(uri, rootURL) {
|
|
621
|
+
const url = toFileURL(uri, rootURL);
|
|
622
|
+
return isStdinWithoutPath(url) ? STDIN : toFilePathOrHref(url);
|
|
623
|
+
}
|
|
624
|
+
/**
|
|
625
|
+
* Plain `stdin` is given the current directory as its location, so it has no file name to show.
|
|
626
|
+
*/
|
|
627
|
+
function isStdinWithoutPath(url) {
|
|
628
|
+
return url.protocol === "stdin:" && url.pathname.endsWith("/");
|
|
629
|
+
}
|
|
621
630
|
function reportProgress(io, p, cwdURL, options) {
|
|
622
631
|
if (p.type === "ProgressFileComplete") return reportProgressFileComplete(io, p, cwdURL, options);
|
|
623
632
|
if (p.type === "ProgressFileBegin") return reportProgressFileBegin(io, p, cwdURL);
|
|
@@ -700,7 +709,7 @@ function getReporter(options, config) {
|
|
|
700
709
|
}
|
|
701
710
|
const rootURL = toFileDirURL(options.root || process.cwd());
|
|
702
711
|
function relativeIssue(fn) {
|
|
703
|
-
const fnFilename = options.relative ? (uri) => relativeUriFilename(uri, rootURL) : (uri) =>
|
|
712
|
+
const fnFilename = options.relative ? (uri) => relativeUriFilename(uri, rootURL) : (uri) => absoluteUriFilename(uri, rootURL);
|
|
704
713
|
return (i) => {
|
|
705
714
|
const fullFilename = i.uri ? toFilePathOrHref(toFileURL(i.uri, rootURL)) : "";
|
|
706
715
|
const filename = i.uri ? fnFilename(i.uri) : "";
|
|
@@ -910,8 +919,7 @@ function assertCheckTemplate(template) {
|
|
|
910
919
|
const r = checkTemplate(template);
|
|
911
920
|
if (r instanceof Error) throw r;
|
|
912
921
|
}
|
|
913
|
-
|
|
914
|
-
//#region src/config/adjustConfig.ts
|
|
922
|
+
// src/config/adjustConfig.ts
|
|
915
923
|
async function fileExists(url) {
|
|
916
924
|
if (url.protocol !== "file:") return false;
|
|
917
925
|
try {
|
|
@@ -1014,8 +1022,7 @@ function addDictionariesToConfigFile(configFile, dictionaries, comment) {
|
|
|
1014
1022
|
}
|
|
1015
1023
|
setConfigFieldValue(configFile, "dictionaries", dicts, comment);
|
|
1016
1024
|
}
|
|
1017
|
-
|
|
1018
|
-
//#region src/config/config.ts
|
|
1025
|
+
// src/config/config.ts
|
|
1019
1026
|
function applyValuesToConfigFile(config, settings, defaultValues, addComments) {
|
|
1020
1027
|
const currentSettings = config.settings || {};
|
|
1021
1028
|
for (const [k, entry] of Object.entries(defaultValues)) {
|
|
@@ -1029,8 +1036,7 @@ function applyValuesToConfigFile(config, settings, defaultValues, addComments) {
|
|
|
1029
1036
|
}
|
|
1030
1037
|
return config;
|
|
1031
1038
|
}
|
|
1032
|
-
|
|
1033
|
-
//#region src/config/constants.ts
|
|
1039
|
+
// src/config/constants.ts
|
|
1034
1040
|
const defaultConfig = {
|
|
1035
1041
|
$schema: {
|
|
1036
1042
|
value: void 0,
|
|
@@ -1113,8 +1119,7 @@ const defaultConfig = {
|
|
|
1113
1119
|
comment: " Regular expressions / patterns of text to be included."
|
|
1114
1120
|
}
|
|
1115
1121
|
};
|
|
1116
|
-
|
|
1117
|
-
//#region src/config/configInit.ts
|
|
1122
|
+
// src/config/configInit.ts
|
|
1118
1123
|
const schemaRef = cspellConfigFileSchema;
|
|
1119
1124
|
const defaultConfigJson = `\
|
|
1120
1125
|
{
|
|
@@ -1124,23 +1129,73 @@ const defaultConfigYaml = `
|
|
|
1124
1129
|
`;
|
|
1125
1130
|
async function configInit(options) {
|
|
1126
1131
|
const rw = createReaderWriter();
|
|
1127
|
-
const
|
|
1128
|
-
|
|
1132
|
+
const existingConfig = await findExistingConfig(options);
|
|
1133
|
+
const importFile = existingConfig && isCodeConfig(existingConfig) ? existingConfig : void 0;
|
|
1134
|
+
if (importFile && !hasRequestedChange(options)) return;
|
|
1135
|
+
const configFile = await createConfigFile(rw, importFile ? determineFileNameURL({}) : existingConfig ?? determineFileNameURL(options));
|
|
1136
|
+
const hasSettings = !!importFile || Object.keys(configFile.settings).length > 0;
|
|
1137
|
+
await applyOptionsToConfigFile(configFile, withImportFile(options, importFile), hasSettings);
|
|
1129
1138
|
await fs.mkdir(new URL("./", configFile.url), { recursive: true });
|
|
1130
1139
|
if (options.stdout) console.stdoutChannel.write(rw.serialize(configFile));
|
|
1131
1140
|
else await rw.writeConfig(configFile);
|
|
1132
1141
|
}
|
|
1133
|
-
|
|
1142
|
+
/**
|
|
1143
|
+
* Find the config file cspell would load for the current directory, without looking in parent directories.
|
|
1144
|
+
* Naming the file or its format with an option means the existing config isn't wanted.
|
|
1145
|
+
*/
|
|
1146
|
+
async function findExistingConfig(options) {
|
|
1147
|
+
if (options.config || options.output || options.format) return void 0;
|
|
1148
|
+
const cwd = toFileDirURL("./");
|
|
1149
|
+
for (const filename of defaultConfigFilenames) {
|
|
1150
|
+
const url = new URL(filename, cwd);
|
|
1151
|
+
if (await isConfigFile(url)) return url;
|
|
1152
|
+
}
|
|
1153
|
+
}
|
|
1154
|
+
async function isConfigFile(url) {
|
|
1155
|
+
if (!(await fs.stat(url).catch(() => void 0))?.isFile()) return false;
|
|
1156
|
+
return !url.pathname.endsWith("/package.json") || hasCSpellSection(url);
|
|
1157
|
+
}
|
|
1158
|
+
async function hasCSpellSection(packageJsonUrl) {
|
|
1159
|
+
try {
|
|
1160
|
+
return typeof JSON.parse(await fs.readFile(packageJsonUrl, "utf8")).cspell === "object";
|
|
1161
|
+
} catch {
|
|
1162
|
+
return false;
|
|
1163
|
+
}
|
|
1164
|
+
}
|
|
1165
|
+
function isCodeConfig(url) {
|
|
1166
|
+
return /\.[cm]?[jt]s$/.test(url.pathname);
|
|
1167
|
+
}
|
|
1168
|
+
/**
|
|
1169
|
+
* A code config can't be edited, so changes are only possible through a new config file.
|
|
1170
|
+
*/
|
|
1171
|
+
function hasRequestedChange(options) {
|
|
1172
|
+
return !!(options.locale || options.schema || options.import?.length || options.dictionary?.length);
|
|
1173
|
+
}
|
|
1174
|
+
function withImportFile(options, importFile) {
|
|
1175
|
+
if (!importFile) return options;
|
|
1176
|
+
const relativePath = "./" + urlRelative(toFileDirURL("./"), importFile);
|
|
1177
|
+
return {
|
|
1178
|
+
...options,
|
|
1179
|
+
import: [relativePath, ...options.import ?? []]
|
|
1180
|
+
};
|
|
1181
|
+
}
|
|
1182
|
+
async function applyOptionsToConfigFile(configFile, options, hasSettings) {
|
|
1134
1183
|
const settings = {};
|
|
1135
1184
|
const addComments = options.comments || options.comments === void 0 && !options.removeComments && !configFile.url.pathname.endsWith(".json");
|
|
1136
1185
|
if (options.comments === false) configFile.removeAllComments();
|
|
1137
|
-
if (options.schema ??
|
|
1186
|
+
if (options.schema ?? !hasSettings) configFile.setSchema(schemaRef);
|
|
1138
1187
|
if (options.locale) settings.language = options.locale;
|
|
1139
|
-
applyValuesToConfigFile(configFile, settings, defaultConfig, addComments);
|
|
1188
|
+
applyValuesToConfigFile(configFile, settings, hasSettings ? withoutDefaultValues(defaultConfig) : defaultConfig, addComments);
|
|
1140
1189
|
if (options.import) await addImportsToConfigFile(configFile, options.import, addComments && defaultConfig.import?.comment || void 0);
|
|
1141
1190
|
if (options.dictionary) addDictionariesToConfigFile(configFile, options.dictionary, addComments && defaultConfig.dictionaries?.comment || void 0);
|
|
1142
1191
|
return configFile;
|
|
1143
1192
|
}
|
|
1193
|
+
function withoutDefaultValues(config) {
|
|
1194
|
+
return Object.fromEntries(Object.entries(config).map(([key, entry]) => [key, {
|
|
1195
|
+
...entry,
|
|
1196
|
+
value: void 0
|
|
1197
|
+
}]));
|
|
1198
|
+
}
|
|
1144
1199
|
function determineFileNameURL(options) {
|
|
1145
1200
|
if (options.config) return toFileURL(options.config);
|
|
1146
1201
|
const defaultFileName = determineDefaultFileName(options);
|
|
@@ -1159,25 +1214,18 @@ function determineDefaultFileName(options) {
|
|
|
1159
1214
|
}
|
|
1160
1215
|
throw new Error(`Unsupported format: ${options.format}`);
|
|
1161
1216
|
}
|
|
1162
|
-
function getDefaultContent(
|
|
1163
|
-
|
|
1164
|
-
case void 0:
|
|
1165
|
-
case "yaml": return defaultConfigYaml;
|
|
1166
|
-
case "json":
|
|
1167
|
-
case "jsonc": return defaultConfigJson;
|
|
1168
|
-
default: throw new Error(`Unsupported format: ${options.format}`);
|
|
1169
|
-
}
|
|
1217
|
+
function getDefaultContent(url) {
|
|
1218
|
+
return /\.jsonc?$/.test(url.pathname) ? defaultConfigJson : defaultConfigYaml;
|
|
1170
1219
|
}
|
|
1171
|
-
async function createConfigFile(rw, url
|
|
1220
|
+
async function createConfigFile(rw, url) {
|
|
1172
1221
|
if (url.pathname.endsWith("package.json")) return rw.readConfig(url);
|
|
1173
|
-
const content = await fs.readFile(url, "utf8").catch(() => getDefaultContent(
|
|
1222
|
+
const content = await fs.readFile(url, "utf8").catch(() => getDefaultContent(url));
|
|
1174
1223
|
return rw.parse({
|
|
1175
1224
|
url,
|
|
1176
1225
|
content
|
|
1177
1226
|
});
|
|
1178
1227
|
}
|
|
1179
|
-
|
|
1180
|
-
//#region src/featureFlags/featureFlags.ts
|
|
1228
|
+
// src/featureFlags/featureFlags.ts
|
|
1181
1229
|
function getFeatureFlags() {
|
|
1182
1230
|
return getSystemFeatureFlags();
|
|
1183
1231
|
}
|
|
@@ -1194,8 +1242,7 @@ function parseFeatureFlags(flags, featureFlags = getFeatureFlags()) {
|
|
|
1194
1242
|
}
|
|
1195
1243
|
return featureFlags;
|
|
1196
1244
|
}
|
|
1197
|
-
|
|
1198
|
-
//#region src/environment.ts
|
|
1245
|
+
// src/environment.ts
|
|
1199
1246
|
const environmentKeys = {
|
|
1200
1247
|
CSPELL_ENABLE_DICTIONARY_LOGGING: "CSPELL_ENABLE_DICTIONARY_LOGGING",
|
|
1201
1248
|
CSPELL_ENABLE_DICTIONARY_LOG_FILE: "CSPELL_ENABLE_DICTIONARY_LOG_FILE",
|
|
@@ -1222,11 +1269,10 @@ function truthy(value) {
|
|
|
1222
1269
|
}
|
|
1223
1270
|
return false;
|
|
1224
1271
|
}
|
|
1225
|
-
|
|
1226
|
-
//#region src/dirname.ts
|
|
1272
|
+
// src/dirname.ts
|
|
1227
1273
|
let _dirname;
|
|
1228
1274
|
try {
|
|
1229
|
-
if (typeof import.meta.url !== "string") throw new
|
|
1275
|
+
if (typeof import.meta.url !== "string") throw new TypeError("assert");
|
|
1230
1276
|
_dirname = fileURLToPath(new URL(".", import.meta.url));
|
|
1231
1277
|
} catch {
|
|
1232
1278
|
_dirname = __dirname;
|
|
@@ -1234,11 +1280,10 @@ try {
|
|
|
1234
1280
|
const pkgDir = _dirname;
|
|
1235
1281
|
const npmPackage = {
|
|
1236
1282
|
name: "cspell",
|
|
1237
|
-
version: "10.4.
|
|
1283
|
+
version: "10.4.1",
|
|
1238
1284
|
engines: { node: ">=22.18.0" }
|
|
1239
1285
|
};
|
|
1240
|
-
|
|
1241
|
-
//#region src/reporters/reporters.ts
|
|
1286
|
+
// src/reporters/reporters.ts
|
|
1242
1287
|
function filterFeatureIssues(features, issue, reportOptions) {
|
|
1243
1288
|
if (issue.issueType === IssueType.directive) return features?.issueType && reportOptions?.validateDirectives || false;
|
|
1244
1289
|
if (features?.unknownWords) return true;
|
|
@@ -1438,19 +1483,12 @@ function replayReportItems(reportItemsCollection, reporter) {
|
|
|
1438
1483
|
case "error": reporter.error(...item.payload);
|
|
1439
1484
|
}
|
|
1440
1485
|
}
|
|
1441
|
-
|
|
1442
|
-
//#region src/util/async.ts
|
|
1486
|
+
// src/util/async.ts
|
|
1443
1487
|
const asyncMap = operators.opMapAsync;
|
|
1444
1488
|
operators.opFilterAsync;
|
|
1445
1489
|
const asyncAwait = operators.opAwaitAsync;
|
|
1446
1490
|
const asyncFlatten = operators.opFlattenAsync;
|
|
1447
|
-
|
|
1448
|
-
//#region src/util/constants.ts
|
|
1449
|
-
const UTF8 = "utf8";
|
|
1450
|
-
const STDINProtocol = "stdin:";
|
|
1451
|
-
const STDINUrlPrefix = "stdin://";
|
|
1452
|
-
//#endregion
|
|
1453
|
-
//#region src/util/glob.ts
|
|
1491
|
+
// src/util/glob.ts
|
|
1454
1492
|
const defaultExcludeGlobs = ["node_modules/**"];
|
|
1455
1493
|
/**
|
|
1456
1494
|
*
|
|
@@ -1573,8 +1611,7 @@ function glob$1(patterns, options) {
|
|
|
1573
1611
|
patterns = typeof patterns === "string" ? workaroundPicomatchBug(patterns) : patterns.map((g) => workaroundPicomatchBug(g));
|
|
1574
1612
|
return glob(patterns, options);
|
|
1575
1613
|
}
|
|
1576
|
-
|
|
1577
|
-
//#region src/util/stdin.ts
|
|
1614
|
+
// src/util/stdin.ts
|
|
1578
1615
|
async function* readStdin() {
|
|
1579
1616
|
const rl = readline.createInterface(process.stdin);
|
|
1580
1617
|
try {
|
|
@@ -1586,8 +1623,7 @@ async function* readStdin() {
|
|
|
1586
1623
|
function isReadlineClosedError(e) {
|
|
1587
1624
|
return e instanceof Error && e.message.includes("closed");
|
|
1588
1625
|
}
|
|
1589
|
-
|
|
1590
|
-
//#region src/util/stdinUrl.ts
|
|
1626
|
+
// src/util/stdinUrl.ts
|
|
1591
1627
|
function isStdinUrl(url) {
|
|
1592
1628
|
if (url instanceof URL) return url.protocol === STDINProtocol;
|
|
1593
1629
|
return url.startsWith(STDINProtocol);
|
|
@@ -1604,8 +1640,7 @@ function resolveStdinUrl(url, cwd) {
|
|
|
1604
1640
|
const fileUrl = toFileURL(path, cwd);
|
|
1605
1641
|
return new URL(fileUrl.toString().replace(/^file:/, STDINProtocol) + (path ? "" : "/"));
|
|
1606
1642
|
}
|
|
1607
|
-
|
|
1608
|
-
//#region src/util/fileHelper.ts
|
|
1643
|
+
// src/util/fileHelper.ts
|
|
1609
1644
|
function fileInfoToDocument(fileInfo, languageId, locale) {
|
|
1610
1645
|
const { filename, text } = fileInfo;
|
|
1611
1646
|
languageId = languageId || void 0;
|
|
@@ -1743,8 +1778,7 @@ function relativeToCwd(filename, cwd = process.cwd()) {
|
|
|
1743
1778
|
if (rel.startsWith("..")) return toFilePathOrHref(url);
|
|
1744
1779
|
return rel;
|
|
1745
1780
|
}
|
|
1746
|
-
|
|
1747
|
-
//#region src/util/cache/file-entry-cache/flatCache.ts
|
|
1781
|
+
// src/util/cache/file-entry-cache/flatCache.ts
|
|
1748
1782
|
var FlatCache = class {
|
|
1749
1783
|
cacheFilename;
|
|
1750
1784
|
#cache;
|
|
@@ -1799,8 +1833,7 @@ var FlatCache = class {
|
|
|
1799
1833
|
function loadCacheFile(cachefile) {
|
|
1800
1834
|
return new FlatCache(cachefile).load();
|
|
1801
1835
|
}
|
|
1802
|
-
|
|
1803
|
-
//#region src/util/cache/file-entry-cache/file-entry-cache.ts
|
|
1836
|
+
// src/util/cache/file-entry-cache/file-entry-cache.ts
|
|
1804
1837
|
async function createFromFile$1(cacheFileUrl, useChecksum, currentWorkingDir) {
|
|
1805
1838
|
const fec = new ImplFileEntryCache(await loadCacheFile(cacheFileUrl), useChecksum ?? false, currentWorkingDir);
|
|
1806
1839
|
await fec.removeNotFoundFiles();
|
|
@@ -1968,13 +2001,11 @@ function normalizePath$1(filePath) {
|
|
|
1968
2001
|
if (path.sep === "/") return filePath;
|
|
1969
2002
|
return filePath.split(path.sep).join("/");
|
|
1970
2003
|
}
|
|
1971
|
-
|
|
1972
|
-
//#region src/util/cache/fileEntryCache.ts
|
|
2004
|
+
// src/util/cache/fileEntryCache.ts
|
|
1973
2005
|
function createFromFile(cacheFileUrl, useCheckSum, useRelative) {
|
|
1974
2006
|
return createFromFile$1(cacheFileUrl, useCheckSum, useRelative ? new URL("./", cacheFileUrl) : void 0);
|
|
1975
2007
|
}
|
|
1976
|
-
|
|
1977
|
-
//#region src/util/cache/ObjectCollection.ts
|
|
2008
|
+
// src/util/cache/ObjectCollection.ts
|
|
1978
2009
|
const compare = Intl.Collator().compare;
|
|
1979
2010
|
var ShallowObjectCollection = class {
|
|
1980
2011
|
tree = {};
|
|
@@ -1997,8 +2028,7 @@ var ShallowObjectCollection = class {
|
|
|
1997
2028
|
return v;
|
|
1998
2029
|
}
|
|
1999
2030
|
};
|
|
2000
|
-
|
|
2001
|
-
//#region src/util/cache/DiskCache.ts
|
|
2031
|
+
// src/util/cache/DiskCache.ts
|
|
2002
2032
|
const META_DATA_VERSION_SUFFIX = "-1-" + Object.keys({
|
|
2003
2033
|
v: "v",
|
|
2004
2034
|
r: "r",
|
|
@@ -2046,8 +2076,13 @@ var DiskCache = class {
|
|
|
2046
2076
|
const hasErrors = !!result && (result.errors > 0 || result.configErrors > 0 || result.issues.length > 0);
|
|
2047
2077
|
const cached = true;
|
|
2048
2078
|
const shouldReadFile = hasErrors;
|
|
2079
|
+
const uri = toFileURL(filename).href;
|
|
2049
2080
|
return {
|
|
2050
2081
|
...result,
|
|
2082
|
+
issues: result.issues.map((issue) => ({
|
|
2083
|
+
...issue,
|
|
2084
|
+
uri
|
|
2085
|
+
})),
|
|
2051
2086
|
elapsedTimeMs: void 0,
|
|
2052
2087
|
fileInfo: shouldReadFile ? await readFileInfo(filename) : { filename },
|
|
2053
2088
|
cached
|
|
@@ -2057,9 +2092,13 @@ var DiskCache = class {
|
|
|
2057
2092
|
const fileDescriptor = await this.fileEntryCache.getFileDescriptor(fileInfo.filename);
|
|
2058
2093
|
const meta = fileDescriptor.meta;
|
|
2059
2094
|
if (fileDescriptor.notFound || !meta) return;
|
|
2095
|
+
const issues = result.issues.map(({ uri: _, ...issue }) => issue);
|
|
2060
2096
|
meta.data = this.objectCollection.get({
|
|
2061
2097
|
v: this.version,
|
|
2062
|
-
r: this.normalizeResult(
|
|
2098
|
+
r: this.normalizeResult({
|
|
2099
|
+
...result,
|
|
2100
|
+
issues
|
|
2101
|
+
}),
|
|
2063
2102
|
d: await this.calcDependencyHashes(dependsUponFiles),
|
|
2064
2103
|
...this.optionsKey ? { o: this.optionsKey } : {}
|
|
2065
2104
|
});
|
|
@@ -2201,8 +2240,7 @@ function normalizePath(filePath) {
|
|
|
2201
2240
|
if (sep === "/") return filePath;
|
|
2202
2241
|
return filePath.split(sep).join("/");
|
|
2203
2242
|
}
|
|
2204
|
-
|
|
2205
|
-
//#region src/util/cache/DummyCache.ts
|
|
2243
|
+
// src/util/cache/DummyCache.ts
|
|
2206
2244
|
/**
|
|
2207
2245
|
* Dummy cache implementation that should be usd if caching option is disabled.
|
|
2208
2246
|
*/
|
|
@@ -2220,8 +2258,7 @@ var DummyCache = class {
|
|
|
2220
2258
|
return Promise.resolve();
|
|
2221
2259
|
}
|
|
2222
2260
|
};
|
|
2223
|
-
|
|
2224
|
-
//#region src/util/cache/createCache.ts
|
|
2261
|
+
// src/util/cache/createCache.ts
|
|
2225
2262
|
const DEFAULT_CACHE_LOCATION = ".cspellcache";
|
|
2226
2263
|
const versionSuffix = "";
|
|
2227
2264
|
/**
|
|
@@ -2285,8 +2322,7 @@ function normalizeVersion(version) {
|
|
|
2285
2322
|
assert(parts.length === 2);
|
|
2286
2323
|
return parts.join(".") + versionSuffix;
|
|
2287
2324
|
}
|
|
2288
|
-
|
|
2289
|
-
//#region src/util/configFileHelper.ts
|
|
2325
|
+
// src/util/configFileHelper.ts
|
|
2290
2326
|
async function readConfig(configFile, root, stopConfigSearchAt) {
|
|
2291
2327
|
configFile ??= getEnvironmentVariable(environmentKeys.CSPELL_CONFIG_PATH);
|
|
2292
2328
|
if (configFile) return configFileToConfigInfo(typeof configFile === "string" ? await readConfigHandleError(configFile) : configFile);
|
|
@@ -2325,8 +2361,7 @@ async function readConfigHandleError(filename) {
|
|
|
2325
2361
|
};
|
|
2326
2362
|
}
|
|
2327
2363
|
}
|
|
2328
|
-
|
|
2329
|
-
//#region src/util/symlinks.ts
|
|
2364
|
+
// src/util/symlinks.ts
|
|
2330
2365
|
function createSymlinkChecker(root) {
|
|
2331
2366
|
const rootPath = path$1.resolve(root);
|
|
2332
2367
|
const cache = /* @__PURE__ */ new Map();
|
|
@@ -2367,70 +2402,12 @@ function createSymlinkChecker(root) {
|
|
|
2367
2402
|
isGlobReachedThroughSymlink
|
|
2368
2403
|
};
|
|
2369
2404
|
}
|
|
2370
|
-
|
|
2371
|
-
//#region src/util/timer.ts
|
|
2405
|
+
// src/util/timer.ts
|
|
2372
2406
|
function getTimeMeasurer() {
|
|
2373
2407
|
const timer = createPerfTimer("timer");
|
|
2374
2408
|
return () => timer.elapsed;
|
|
2375
2409
|
}
|
|
2376
|
-
|
|
2377
|
-
//#region src/util/unindent.ts
|
|
2378
|
-
/**
|
|
2379
|
-
* Indent each line of a multi-line string.
|
|
2380
|
-
* @param str - multi-line string to left pad
|
|
2381
|
-
* @param padding - the padding to use for all lines except the first.
|
|
2382
|
-
* @param firstLinePadding - optional padding of first line.
|
|
2383
|
-
* @returns
|
|
2384
|
-
*/
|
|
2385
|
-
function indent(str, padding, firstLinePadding = "") {
|
|
2386
|
-
let pad = firstLinePadding;
|
|
2387
|
-
const lines = [];
|
|
2388
|
-
for (const line of str.split("\n")) {
|
|
2389
|
-
lines.push(pad + line);
|
|
2390
|
-
pad = padding;
|
|
2391
|
-
}
|
|
2392
|
-
return lines.join("\n");
|
|
2393
|
-
}
|
|
2394
|
-
/**
|
|
2395
|
-
* Inject values into a template string while keeping indentation of multi-line values.
|
|
2396
|
-
* @param template - template string
|
|
2397
|
-
* @param values- values to inject
|
|
2398
|
-
* @returns the injected string
|
|
2399
|
-
*/
|
|
2400
|
-
function keepIndent(template, ...values) {
|
|
2401
|
-
const strings = template;
|
|
2402
|
-
const adjValues = [];
|
|
2403
|
-
for (let i = 0; i < values.length; ++i) {
|
|
2404
|
-
const prevLines = strings[i].split("\n");
|
|
2405
|
-
const currLine = prevLines[prevLines.length - 1];
|
|
2406
|
-
const padLen = padLength(currLine);
|
|
2407
|
-
const padding = " ".repeat(padLen);
|
|
2408
|
-
adjValues.push(indent(`${values[i]}`, padding));
|
|
2409
|
-
}
|
|
2410
|
-
return String.raw({ raw: strings }, ...adjValues);
|
|
2411
|
-
}
|
|
2412
|
-
/**
|
|
2413
|
-
* Calculate the padding at the start of the string.
|
|
2414
|
-
* @param s - string to evaluate
|
|
2415
|
-
* @returns number of padding characters
|
|
2416
|
-
*/
|
|
2417
|
-
function padLength(s) {
|
|
2418
|
-
return s.length - s.trimStart().length;
|
|
2419
|
-
}
|
|
2420
|
-
function unindent(templateOrString, ...values) {
|
|
2421
|
-
return unindentString(typeof templateOrString === "string" ? templateOrString : keepIndent(templateOrString, ...values));
|
|
2422
|
-
}
|
|
2423
|
-
function unindentString(str) {
|
|
2424
|
-
const lines = str.split("\n");
|
|
2425
|
-
let curPad = str.length;
|
|
2426
|
-
for (const line of lines) {
|
|
2427
|
-
if (!line.trim()) continue;
|
|
2428
|
-
curPad = Math.min(curPad, padLength(line));
|
|
2429
|
-
}
|
|
2430
|
-
return lines.map((line) => line.slice(curPad)).join("\n");
|
|
2431
|
-
}
|
|
2432
|
-
//#endregion
|
|
2433
|
-
//#region src/util/wrap.ts
|
|
2410
|
+
// src/util/wrap.ts
|
|
2434
2411
|
const wrapSep = /\s+|(?<=,)|\.(?=\w)/g;
|
|
2435
2412
|
function wordWrapAnsiText(str, maxWidth, indent = "", sep = wrapSep) {
|
|
2436
2413
|
if (!maxWidth || maxWidth <= 0) return str;
|
|
@@ -2465,8 +2442,7 @@ function* joinFragments(fragments) {
|
|
|
2465
2442
|
}
|
|
2466
2443
|
if (last) yield last.text;
|
|
2467
2444
|
}
|
|
2468
|
-
|
|
2469
|
-
//#region src/util/writeFile.ts
|
|
2445
|
+
// src/util/writeFile.ts
|
|
2470
2446
|
async function writeFileOrStream(filename, data) {
|
|
2471
2447
|
switch (filename) {
|
|
2472
2448
|
case "stdout":
|
|
@@ -2487,8 +2463,7 @@ function writeStream(stream, data) {
|
|
|
2487
2463
|
});
|
|
2488
2464
|
});
|
|
2489
2465
|
}
|
|
2490
|
-
|
|
2491
|
-
//#region src/util/extractContext.ts
|
|
2466
|
+
// src/util/extractContext.ts
|
|
2492
2467
|
function prefCharIndex(text, offset, count = 1) {
|
|
2493
2468
|
if (offset - count < 0) return 0;
|
|
2494
2469
|
for (; count > 0 && offset > 0; count--) {
|
|
@@ -2541,8 +2516,7 @@ function extractContext(tdo, contextRange) {
|
|
|
2541
2516
|
context.offset += line.offset;
|
|
2542
2517
|
return context;
|
|
2543
2518
|
}
|
|
2544
|
-
|
|
2545
|
-
//#region src/lint/LinterError.ts
|
|
2519
|
+
// src/lint/LinterError.ts
|
|
2546
2520
|
var LinterError = class extends Error {
|
|
2547
2521
|
constructor(message) {
|
|
2548
2522
|
super(message);
|
|
@@ -2551,8 +2525,7 @@ var LinterError = class extends Error {
|
|
|
2551
2525
|
return this.message;
|
|
2552
2526
|
}
|
|
2553
2527
|
};
|
|
2554
|
-
|
|
2555
|
-
//#region src/lint/processFile.ts
|
|
2528
|
+
// src/lint/processFile.ts
|
|
2556
2529
|
async function processFile(file, cache, prefetch, processFileOptions) {
|
|
2557
2530
|
if (prefetch?.fileResult) return prefetch.fileResult;
|
|
2558
2531
|
const { filename } = file;
|
|
@@ -2694,8 +2667,7 @@ function reportSpellingResultConfigErrors(reporter, spellResult, processFileOpti
|
|
|
2694
2667
|
function countConfigErrors(reporter, configInfo, processFileOptions) {
|
|
2695
2668
|
return reportConfigurationErrors(reporter, configInfo.config, processFileOptions);
|
|
2696
2669
|
}
|
|
2697
|
-
|
|
2698
|
-
//#region src/util/prefetch.ts
|
|
2670
|
+
// src/util/prefetch.ts
|
|
2699
2671
|
function* prefetchIterable(iterable, size) {
|
|
2700
2672
|
assert(size >= 0);
|
|
2701
2673
|
const buffer = [];
|
|
@@ -2709,8 +2681,7 @@ function* prefetchIterable(iterable, size) {
|
|
|
2709
2681
|
}
|
|
2710
2682
|
yield* buffer;
|
|
2711
2683
|
}
|
|
2712
|
-
|
|
2713
|
-
//#region src/util/unitNumbers.ts
|
|
2684
|
+
// src/util/unitNumbers.ts
|
|
2714
2685
|
const regexUnitNumber = /^((?:\d+(?:\.\d*)?)|(?:\.\d+))([a-z]*)$/i;
|
|
2715
2686
|
const unitSizes = {
|
|
2716
2687
|
"": 1,
|
|
@@ -2752,8 +2723,7 @@ function sizeToNumber(size) {
|
|
|
2752
2723
|
if (p.error) return NaN;
|
|
2753
2724
|
return Number.parseFloat(p.digits) * (unitSizes[p.units] || 1);
|
|
2754
2725
|
}
|
|
2755
|
-
|
|
2756
|
-
//#region src/lint/processFiles.ts
|
|
2726
|
+
// src/lint/processFiles.ts
|
|
2757
2727
|
const BATCH_FETCH_SIZE = 12;
|
|
2758
2728
|
function prefetch(fileToProcess, cfg) {
|
|
2759
2729
|
const { filename } = fileToProcess;
|
|
@@ -2934,8 +2904,7 @@ function runResult(init = {}) {
|
|
|
2934
2904
|
skippedFiles
|
|
2935
2905
|
};
|
|
2936
2906
|
}
|
|
2937
|
-
|
|
2938
|
-
//#region \0@oxc-project+runtime@0.151.0/helpers/esm/usingCtx.js
|
|
2907
|
+
// \0@oxc-project+runtime@0.156.0/helpers/esm/usingCtx.js
|
|
2939
2908
|
function _usingCtx() {
|
|
2940
2909
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
2941
2910
|
var n = Error();
|
|
@@ -2990,8 +2959,7 @@ function _usingCtx() {
|
|
|
2990
2959
|
}
|
|
2991
2960
|
};
|
|
2992
2961
|
}
|
|
2993
|
-
|
|
2994
|
-
//#region src/lint/lint.ts
|
|
2962
|
+
// src/lint/lint.ts
|
|
2995
2963
|
const version = npmPackage.version;
|
|
2996
2964
|
const { opFilterAsync } = operators;
|
|
2997
2965
|
async function runLint(cfg) {
|
|
@@ -3321,8 +3289,7 @@ function globPattern(g) {
|
|
|
3321
3289
|
function calcVerboseLevel(options) {
|
|
3322
3290
|
return options.verboseLevel ?? (options.verbose ? 1 : 0);
|
|
3323
3291
|
}
|
|
3324
|
-
|
|
3325
|
-
//#region src/lint/LintRequest.ts
|
|
3292
|
+
// src/lint/LintRequest.ts
|
|
3326
3293
|
const defaultContextRange = 20;
|
|
3327
3294
|
var LintRequest = class {
|
|
3328
3295
|
fileGlobs;
|
|
@@ -3392,8 +3359,7 @@ function extractUnknownWordsConfig(options) {
|
|
|
3392
3359
|
}
|
|
3393
3360
|
return config;
|
|
3394
3361
|
}
|
|
3395
|
-
|
|
3396
|
-
//#region src/options.ts
|
|
3362
|
+
// src/options.ts
|
|
3397
3363
|
const ReportChoicesAll = [
|
|
3398
3364
|
"all",
|
|
3399
3365
|
"simple",
|
|
@@ -3414,8 +3380,7 @@ function cvtLinterCliCommandOptionsToLinterCliOptions(options) {
|
|
|
3414
3380
|
}
|
|
3415
3381
|
return cliOptions;
|
|
3416
3382
|
}
|
|
3417
|
-
|
|
3418
|
-
//#region src/repl/index.ts
|
|
3383
|
+
// src/repl/index.ts
|
|
3419
3384
|
function simpleRepl() {
|
|
3420
3385
|
return new SimpleRepl();
|
|
3421
3386
|
}
|
|
@@ -3461,8 +3426,7 @@ var SimpleRepl = class {
|
|
|
3461
3426
|
return { next };
|
|
3462
3427
|
}
|
|
3463
3428
|
};
|
|
3464
|
-
|
|
3465
|
-
//#region src/dictionaries/listDictionaries.ts
|
|
3429
|
+
// src/dictionaries/listDictionaries.ts
|
|
3466
3430
|
const inlineDictionaries = {
|
|
3467
3431
|
"[words]": {
|
|
3468
3432
|
name: "[words]",
|
|
@@ -3572,8 +3536,7 @@ async function listDictionaries(options) {
|
|
|
3572
3536
|
dictionaryDefinitions.sort((a, b) => a.name.localeCompare(b.name));
|
|
3573
3537
|
return [...options.enabled !== false ? extractSpecialDictionaries(config) : [], ...dictionaryDefinitions.map(toListDictionariesResult)];
|
|
3574
3538
|
}
|
|
3575
|
-
|
|
3576
|
-
//#region src/application.mts
|
|
3539
|
+
// src/application.mts
|
|
3577
3540
|
function lint(fileGlobs, options, reporter) {
|
|
3578
3541
|
options = fixLegacy(options);
|
|
3579
3542
|
const unknownWordsConfig = extractUnknownWordsConfig(options);
|
|
@@ -3663,7 +3626,6 @@ function registerApplicationFeatureFlags() {
|
|
|
3663
3626
|
function parseApplicationFeatureFlags(flags) {
|
|
3664
3627
|
return parseFeatureFlags(flags, registerApplicationFeatureFlags());
|
|
3665
3628
|
}
|
|
3666
|
-
|
|
3667
|
-
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 };
|
|
3629
|
+
export { CheckFailed as C, ApplicationError as S, padWidth as _, parseApplicationFeatureFlags as a, pruneAnsiTextStart as b, listDictionaries as c, validateUnitSize as d, DEFAULT_CACHE_LOCATION as f, padLeft as g, tableToLines as h, lint as i, ReportChoicesAll as l, getReporter as m, checkText as n, suggestions as o, npmPackage as p, createInit as r, trace as s, IncludeExcludeFlag as t, cvtLinterCliCommandOptionsToLinterCliOptions as u, ansiWidth as v, console as w, width as x, pruneAnsiTextEnd as y };
|
|
3668
3630
|
|
|
3669
|
-
//# sourceMappingURL=application-
|
|
3631
|
+
//# sourceMappingURL=application-9lyhPNzW.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
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-Dr5rOq5n.js";
|
|
2
2
|
import { CheckTextInfo, FeatureFlags, IncludeExcludeFlag, SuggestionsForWordResult, TraceResult, TraceWordResult } from "cspell-lib";
|
|
3
3
|
import { CSpellReporter, RunResult } from "@cspell/cspell-types";
|
|
4
|
-
//#region src/config/options.d.ts
|
|
5
4
|
interface BaseConfigOptions {
|
|
6
5
|
/**
|
|
7
6
|
* The path to the configuration file to create / update.
|
|
8
|
-
* If not provided,
|
|
7
|
+
* If not provided, the configuration file in the current directory is updated.
|
|
8
|
+
* If there is none, a default file name will be used based on the format.
|
|
9
9
|
*/
|
|
10
10
|
config?: string;
|
|
11
11
|
/**
|
|
@@ -35,6 +35,7 @@ interface BaseConfigOptions {
|
|
|
35
35
|
* Whether to add the schema reference to the configuration file.
|
|
36
36
|
* - `true` - the schema reference will be added / updated.
|
|
37
37
|
* - `false` - no schema reference will be added.
|
|
38
|
+
* - `undefined` - the schema reference will be added only if the configuration has no settings yet.
|
|
38
39
|
*/
|
|
39
40
|
schema?: boolean;
|
|
40
41
|
/**
|
|
@@ -51,7 +52,8 @@ interface BaseConfigOptions {
|
|
|
51
52
|
interface InitOptions extends BaseConfigOptions {
|
|
52
53
|
/**
|
|
53
54
|
* The path where the configuration file will be written, it can be a file path or a URL.
|
|
54
|
-
* If not provided,
|
|
55
|
+
* If not provided, the configuration file in the current directory is updated.
|
|
56
|
+
* If there is none, a default file name will be used based on the format.
|
|
55
57
|
* The default will be `cspell.config.yaml` or `cspell.json` based on the format.
|
|
56
58
|
* @conflicts `config` - If `config` is provided, it will be used instead of `output`.
|
|
57
59
|
*/
|
|
@@ -62,13 +64,9 @@ interface InitOptions extends BaseConfigOptions {
|
|
|
62
64
|
*/
|
|
63
65
|
format?: "yaml" | "yml" | "json" | "jsonc";
|
|
64
66
|
}
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region src/emitters/suggestionsEmitter.d.ts
|
|
67
67
|
interface TimedSuggestionsForWordResult extends SuggestionsForWordResult {
|
|
68
68
|
elapsedTimeMs?: number;
|
|
69
69
|
}
|
|
70
|
-
//#endregion
|
|
71
|
-
//#region src/dictionaries/listDictionaries.d.ts
|
|
72
70
|
interface ListDictionariesResult {
|
|
73
71
|
/**
|
|
74
72
|
* The name of the dictionary.
|
|
@@ -104,8 +102,6 @@ interface ListDictionariesResult {
|
|
|
104
102
|
fileTypes?: string[] | undefined;
|
|
105
103
|
}
|
|
106
104
|
declare function listDictionaries(options: DictionariesOptions): Promise<ListDictionariesResult[]>;
|
|
107
|
-
//#endregion
|
|
108
|
-
//#region src/application.d.mts
|
|
109
105
|
/**
|
|
110
106
|
* The same shape as `NodeJS.ErrnoException`, declared here so the published types do not need `@types/node`.
|
|
111
107
|
*/
|
|
@@ -122,6 +118,5 @@ declare function checkText(filename: string, options: BaseOptions & LegacyOption
|
|
|
122
118
|
declare function suggestions(words: string[], options: SuggestionOptions): AsyncIterable<TimedSuggestionsForWordResult>;
|
|
123
119
|
declare function createInit(options: InitOptions): Promise<void>;
|
|
124
120
|
declare function parseApplicationFeatureFlags(flags: string[] | undefined): FeatureFlags;
|
|
125
|
-
//#endregion
|
|
126
121
|
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 };
|
|
127
|
-
//# sourceMappingURL=application-
|
|
122
|
+
//# sourceMappingURL=application-CcaBK3o9.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-
|
|
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-CcaBK3o9.js";
|
|
2
2
|
export { AppError, CheckTextResult, IncludeExcludeFlag, type TraceResult, checkText, createInit, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
package/dist/esm/application.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
export { IncludeExcludeFlag, checkText, createInit, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
|
1
|
+
export { t as IncludeExcludeFlag, n as checkText, r as createInit, i as lint, c as listDictionaries, a as parseApplicationFeatureFlags, o as suggestions, s as trace } from "./application-9lyhPNzW.js";
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import { i as
|
|
2
|
-
import {
|
|
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-CcaBK3o9.js";
|
|
2
|
+
import { i as LinterCliOptions, o as TraceOptions, s as FinalizedReporter, t as BaseOptions } from "./options-Dr5rOq5n.js";
|
|
3
3
|
import { CSpellReporter, ReporterConfiguration } from "@cspell/cspell-types";
|
|
4
4
|
export * from "@cspell/cspell-types";
|
|
5
|
-
//#region src/console.d.ts
|
|
6
5
|
type Log = (format?: any, ...params: any[]) => void;
|
|
7
6
|
/**
|
|
8
7
|
* The parts of an output stream, such as `process.stdout`, that the console uses.
|
|
@@ -32,8 +31,6 @@ interface Channel {
|
|
|
32
31
|
printLine: (format?: any, ...params: any[]) => void;
|
|
33
32
|
getColorLevel: () => 0 | 1 | 2 | 3;
|
|
34
33
|
}
|
|
35
|
-
//#endregion
|
|
36
|
-
//#region src/models.d.ts
|
|
37
34
|
type ReporterConsole = IConsole;
|
|
38
35
|
interface CSpellReporterConfiguration extends Readonly<ReporterConfiguration>, Readonly<LinterCliOptions> {
|
|
39
36
|
/**
|
|
@@ -45,12 +42,9 @@ interface CSpellReporterConfiguration extends Readonly<ReporterConfiguration>, R
|
|
|
45
42
|
interface CSpellReporterModule {
|
|
46
43
|
getReporter: <T>(settings: T, config: CSpellReporterConfiguration) => CSpellReporter;
|
|
47
44
|
}
|
|
48
|
-
//#endregion
|
|
49
|
-
//#region src/cli-reporter.d.ts
|
|
50
45
|
interface ReporterOptions extends Pick<LinterCliOptions, "color" | "debug" | "issues" | "issuesSummaryReport" | "legacy" | "progress" | "relative" | "root" | "showContext" | "showPerfSummary" | "showSuggestions" | "silent" | "summary" | "verbose" | "verboseLevel" | "wordsOnly"> {
|
|
51
46
|
fileGlobs: string[];
|
|
52
47
|
}
|
|
53
48
|
declare function getReporter(options: ReporterOptions, config?: CSpellReporterConfiguration): FinalizedReporter;
|
|
54
|
-
//#endregion
|
|
55
49
|
export { type AppError, type BaseOptions, type LinterCliOptions as CSpellApplicationOptions, type CSpellReporterConfiguration, type CSpellReporterModule, type CheckTextResult, IncludeExcludeFlag, type TraceOptions, type TraceResult, checkText, createInit, getReporter as getDefaultReporter, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
|
56
50
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,2 @@
|
|
|
1
|
-
|
|
1
|
+
export { t as IncludeExcludeFlag, n as checkText, r as createInit, m as getDefaultReporter, i as lint, c as listDictionaries, a as parseApplicationFeatureFlags, o as suggestions, s as trace } from "./application-9lyhPNzW.js";
|
|
2
2
|
export * from "@cspell/cspell-types";
|
|
3
|
-
export { IncludeExcludeFlag, checkText, createInit, getReporter as getDefaultReporter, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
|
@@ -2,7 +2,6 @@ import "cspell-lib";
|
|
|
2
2
|
import { CSpellReporter, CSpellSettings, CacheFormat, CacheStrategy, ReporterConfiguration, RunResult } from "@cspell/cspell-types";
|
|
3
3
|
import { GlobMatcher } from "cspell-glob";
|
|
4
4
|
import "cspell-io";
|
|
5
|
-
//#region src/util/cache/CacheOptions.d.ts
|
|
6
5
|
interface CacheOptions {
|
|
7
6
|
/**
|
|
8
7
|
* The version of `cspell` that made the cache entry.
|
|
@@ -35,11 +34,7 @@ interface CacheOptions {
|
|
|
35
34
|
*/
|
|
36
35
|
cacheFormat?: CacheFormat;
|
|
37
36
|
}
|
|
38
|
-
//#endregion
|
|
39
|
-
//#region src/reporters/LintFileResult.d.ts
|
|
40
37
|
type FinalizedReporter = Required<CSpellReporter>;
|
|
41
|
-
//#endregion
|
|
42
|
-
//#region src/options.d.ts
|
|
43
38
|
interface LinterOptions extends Omit<BaseOptions, "config">, Omit<CacheOptions, "version">, ReporterConfiguration {
|
|
44
39
|
/**
|
|
45
40
|
* Display verbose information
|
|
@@ -422,6 +417,5 @@ interface CSpellConfigFile {
|
|
|
422
417
|
url: URL;
|
|
423
418
|
settings: CSpellSettings;
|
|
424
419
|
}
|
|
425
|
-
//#endregion
|
|
426
420
|
export { SuggestionOptions as a, LinterCliOptions as i, DictionariesOptions as n, TraceOptions as o, LegacyOptions as r, FinalizedReporter as s, BaseOptions as t };
|
|
427
|
-
//# sourceMappingURL=options-
|
|
421
|
+
//# sourceMappingURL=options-Dr5rOq5n.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.1",
|
|
4
4
|
"description": "A Spelling Checker for Code!",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public",
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"scripts": {
|
|
73
73
|
"build": "tsdown && pnpm build:tsc",
|
|
74
74
|
"build:readme": "pnpm build:readme:help",
|
|
75
|
-
"build:readme:help": "pnpm build:readme:help:lint && pnpm build:readme:help:trace && inject-markdown README.md && prettier -w README.md",
|
|
75
|
+
"build:readme:help": "pnpm build:readme:help:lint && pnpm build:readme:help:trace && inject-markdown --allow-outside-root ../.. README.md && prettier -w README.md",
|
|
76
76
|
"build:readme:help:lint": "COLUMNS=72 ./bin.mjs lint --help > static/help-lint.txt",
|
|
77
77
|
"build:readme:help:trace": "COLUMNS=72 ./bin.mjs trace --help > static/help-trace.txt",
|
|
78
78
|
"build:tsc": "tsc -p .",
|
|
@@ -90,35 +90,36 @@
|
|
|
90
90
|
"watch:tsc": "tsc -p . -w"
|
|
91
91
|
},
|
|
92
92
|
"dependencies": {
|
|
93
|
-
"@cspell/cspell-json-reporter": "10.4.
|
|
94
|
-
"@cspell/cspell-performance-monitor": "10.4.
|
|
95
|
-
"@cspell/cspell-pipe": "10.4.
|
|
96
|
-
"@cspell/cspell-types": "10.4.
|
|
97
|
-
"@cspell/cspell-worker": "10.4.
|
|
98
|
-
"@cspell/dynamic-import": "10.4.
|
|
99
|
-
"@cspell/url": "10.4.
|
|
100
|
-
"
|
|
93
|
+
"@cspell/cspell-json-reporter": "10.4.1",
|
|
94
|
+
"@cspell/cspell-performance-monitor": "10.4.1",
|
|
95
|
+
"@cspell/cspell-pipe": "10.4.1",
|
|
96
|
+
"@cspell/cspell-types": "10.4.1",
|
|
97
|
+
"@cspell/cspell-worker": "10.4.1",
|
|
98
|
+
"@cspell/dynamic-import": "10.4.1",
|
|
99
|
+
"@cspell/url": "10.4.1",
|
|
100
|
+
"@streetsidesoftware/unindent": "^1.0.1",
|
|
101
|
+
"ansi-regex": "^6.5.0",
|
|
101
102
|
"chalk": "^6.0.1",
|
|
102
103
|
"chalk-template": "^1.1.3",
|
|
103
104
|
"commander": "^15.0.0",
|
|
104
|
-
"cspell-config-lib": "10.4.
|
|
105
|
-
"cspell-dictionary": "10.4.
|
|
106
|
-
"cspell-gitignore": "10.4.
|
|
107
|
-
"cspell-glob": "10.4.
|
|
108
|
-
"cspell-io": "10.4.
|
|
109
|
-
"cspell-lib": "10.4.
|
|
105
|
+
"cspell-config-lib": "10.4.1",
|
|
106
|
+
"cspell-dictionary": "10.4.1",
|
|
107
|
+
"cspell-gitignore": "10.4.1",
|
|
108
|
+
"cspell-glob": "10.4.1",
|
|
109
|
+
"cspell-io": "10.4.1",
|
|
110
|
+
"cspell-lib": "10.4.1",
|
|
110
111
|
"flatted": "^3.4.4",
|
|
111
|
-
"semver": "^7.8.
|
|
112
|
+
"semver": "^7.8.6",
|
|
112
113
|
"tinyglobby": "^0.2.17"
|
|
113
114
|
},
|
|
114
115
|
"devDependencies": {
|
|
115
116
|
"@types/micromatch": "^4.0.10",
|
|
116
117
|
"@types/semver": "^7.8.0",
|
|
117
118
|
"micromatch": "^4.0.8",
|
|
118
|
-
"minimatch": "^
|
|
119
|
+
"minimatch": "^11.0.4"
|
|
119
120
|
},
|
|
120
121
|
"engines": {
|
|
121
122
|
"node": ">=22.18.0"
|
|
122
123
|
},
|
|
123
|
-
"gitHead": "
|
|
124
|
+
"gitHead": "ddb1699a4bfc2766675c2c97412a813d775772eb"
|
|
124
125
|
}
|