cspell 9.7.0 → 9.8.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/dist/cjs/commonJsApi.cjs +7 -8
- package/dist/esm/app.d.ts +1 -1
- package/dist/esm/app.js +2 -20
- package/dist/esm/{listDictionaries-DRQ2BGn_.js → application-CpRYrn67.js} +112 -78
- package/dist/esm/{index-BObT-HkR.d.ts → application-DYrUtKeK.d.ts} +15 -4
- package/dist/esm/application.d.ts +2 -17
- package/dist/esm/application.js +1 -96
- package/dist/esm/index.d.ts +2 -4
- package/dist/esm/index.js +3 -6
- package/dist/esm/{options-CeDseSxu.d.ts → options-1v2EW2_1.d.ts} +1 -4
- package/package.json +17 -17
package/dist/cjs/commonJsApi.cjs
CHANGED
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value:
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let _cspell_cspell_types = require("@cspell/cspell-types");
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
});
|
|
3
|
+
Object.defineProperty(exports, "defineConfig", {
|
|
4
|
+
enumerable: true,
|
|
5
|
+
get: function() {
|
|
6
|
+
return _cspell_cspell_types.defineConfig;
|
|
7
|
+
}
|
|
8
|
+
});
|
package/dist/esm/app.d.ts
CHANGED
package/dist/esm/app.js
CHANGED
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { IncludeExcludeFlag, checkText, createInit, lint, parseApplicationFeatureFlags, suggestions, trace } from "./application.js";
|
|
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-CpRYrn67.js";
|
|
3
2
|
import { Link } from "cspell-lib";
|
|
4
3
|
import chalk from "chalk";
|
|
5
4
|
import * as iPath from "node:path";
|
|
6
5
|
import { Option, program } from "commander";
|
|
7
6
|
import { satisfies } from "semver";
|
|
8
|
-
|
|
9
7
|
//#region src/commandCheck.ts
|
|
10
8
|
function commandCheck(prog) {
|
|
11
9
|
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("--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) => {
|
|
@@ -32,7 +30,6 @@ function commandCheck(prog) {
|
|
|
32
30
|
if (issueCount) throw new CheckFailed("Issues found", useExitCode ?? true ? 1 : 0);
|
|
33
31
|
});
|
|
34
32
|
}
|
|
35
|
-
|
|
36
33
|
//#endregion
|
|
37
34
|
//#region src/commandHelpers.ts
|
|
38
35
|
/**
|
|
@@ -70,7 +67,6 @@ function crOpt(name, description, parseArg, defaultValue) {
|
|
|
70
67
|
if (defaultValue !== void 0) option.default(defaultValue);
|
|
71
68
|
return option;
|
|
72
69
|
}
|
|
73
|
-
|
|
74
70
|
//#endregion
|
|
75
71
|
//#region src/emitters/helpers.ts
|
|
76
72
|
function trimMidPath(s, w, sep) {
|
|
@@ -123,7 +119,6 @@ function formatDictionaryLocation(dictSource, maxWidth, { cwd, dictionaryPathFor
|
|
|
123
119
|
relPath = isNodeModule ? relPath.slice(idxNodeModule) : relPath;
|
|
124
120
|
return trimMidPath(relPath.length < dictSource.length ? relPath : dictSource, maxWidth, iPath.sep);
|
|
125
121
|
}
|
|
126
|
-
|
|
127
122
|
//#endregion
|
|
128
123
|
//#region src/emitters/dictionaryListEmitter.ts
|
|
129
124
|
const maxWidth$1 = 120;
|
|
@@ -193,7 +188,6 @@ function dictTableRowToTableRow(row) {
|
|
|
193
188
|
function colorize$1(fn) {
|
|
194
189
|
return (s) => s ? fn(s) : "";
|
|
195
190
|
}
|
|
196
|
-
|
|
197
191
|
//#endregion
|
|
198
192
|
//#region src/emitters/DictionaryPathFormat.ts
|
|
199
193
|
const formats = {
|
|
@@ -206,7 +200,6 @@ function isDictionaryPathFormat(value) {
|
|
|
206
200
|
if (!value || typeof value !== "string") return false;
|
|
207
201
|
return value in formats;
|
|
208
202
|
}
|
|
209
|
-
|
|
210
203
|
//#endregion
|
|
211
204
|
//#region src/util/canUseColor.ts
|
|
212
205
|
function canUseColor(colorOption) {
|
|
@@ -215,7 +208,6 @@ function canUseColor(colorOption) {
|
|
|
215
208
|
if (!process.env["NO_COLOR"] || process.env["NO_COLOR"] === "false") return void 0;
|
|
216
209
|
return false;
|
|
217
210
|
}
|
|
218
|
-
|
|
219
211
|
//#endregion
|
|
220
212
|
//#region src/commandDictionaries.ts
|
|
221
213
|
function commandDictionaries(prog) {
|
|
@@ -235,7 +227,6 @@ function commandDictionaries(prog) {
|
|
|
235
227
|
});
|
|
236
228
|
});
|
|
237
229
|
}
|
|
238
|
-
|
|
239
230
|
//#endregion
|
|
240
231
|
//#region src/commandInit.ts
|
|
241
232
|
function commandInit(prog) {
|
|
@@ -248,7 +239,6 @@ function commandInit(prog) {
|
|
|
248
239
|
return createInit(options);
|
|
249
240
|
});
|
|
250
241
|
}
|
|
251
|
-
|
|
252
242
|
//#endregion
|
|
253
243
|
//#region src/link.ts
|
|
254
244
|
const listGlobalImports = Link.listGlobalImports;
|
|
@@ -290,7 +280,6 @@ function addPathsToGlobalImportsResultToTable(results) {
|
|
|
290
280
|
rows: results.resolvedSettings.map(toColumns)
|
|
291
281
|
};
|
|
292
282
|
}
|
|
293
|
-
|
|
294
283
|
//#endregion
|
|
295
284
|
//#region src/commandLink.ts
|
|
296
285
|
function commandLink(prog) {
|
|
@@ -313,7 +302,6 @@ function commandLink(prog) {
|
|
|
313
302
|
});
|
|
314
303
|
return linkCommand;
|
|
315
304
|
}
|
|
316
|
-
|
|
317
305
|
//#endregion
|
|
318
306
|
//#region src/commandLint.ts
|
|
319
307
|
const usage = `\
|
|
@@ -449,7 +437,6 @@ function validateMaxFileSize(size) {
|
|
|
449
437
|
function increaseVerbosity(_dummyValue, previous) {
|
|
450
438
|
return previous + 1;
|
|
451
439
|
}
|
|
452
|
-
|
|
453
440
|
//#endregion
|
|
454
441
|
//#region src/emitters/suggestionsEmitter.ts
|
|
455
442
|
const regExpRTL = /([ \u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]+)/g;
|
|
@@ -515,7 +502,6 @@ function formatWordSingle(s) {
|
|
|
515
502
|
word = s.isPreferred ? chalk.yellow(word + " *") : word;
|
|
516
503
|
return word;
|
|
517
504
|
}
|
|
518
|
-
|
|
519
505
|
//#endregion
|
|
520
506
|
//#region src/commandSuggestion.ts
|
|
521
507
|
function collect(value, previous) {
|
|
@@ -548,7 +534,6 @@ function mergeArrays(a, b) {
|
|
|
548
534
|
if (b === void 0) return a;
|
|
549
535
|
return [...a, ...b];
|
|
550
536
|
}
|
|
551
|
-
|
|
552
537
|
//#endregion
|
|
553
538
|
//#region src/emitters/traceEmitter.ts
|
|
554
539
|
const maxWidth = 120;
|
|
@@ -629,7 +614,6 @@ function calcFoundChar(r) {
|
|
|
629
614
|
function colorize(fn) {
|
|
630
615
|
return (s) => s ? fn(s) : "";
|
|
631
616
|
}
|
|
632
|
-
|
|
633
617
|
//#endregion
|
|
634
618
|
//#region src/commandTrace.ts
|
|
635
619
|
function commandTrace(prog) {
|
|
@@ -686,7 +670,6 @@ function groupBy(items, key) {
|
|
|
686
670
|
}
|
|
687
671
|
return map;
|
|
688
672
|
}
|
|
689
|
-
|
|
690
673
|
//#endregion
|
|
691
674
|
//#region src/globalOptions.ts
|
|
692
675
|
function addGlobalOptionsToAction(command) {
|
|
@@ -703,7 +686,6 @@ function addGlobalOptionsAndHooks(command) {
|
|
|
703
686
|
function processGlobalOptions(options) {
|
|
704
687
|
parseApplicationFeatureFlags(options.flag);
|
|
705
688
|
}
|
|
706
|
-
|
|
707
689
|
//#endregion
|
|
708
690
|
//#region src/app.mts
|
|
709
691
|
async function run(command, argv) {
|
|
@@ -723,7 +705,7 @@ async function run(command, argv) {
|
|
|
723
705
|
prog.exitOverride();
|
|
724
706
|
await prog.parseAsync(args);
|
|
725
707
|
}
|
|
726
|
-
|
|
727
708
|
//#endregion
|
|
728
709
|
export { ApplicationError, CheckFailed, run };
|
|
710
|
+
|
|
729
711
|
//# sourceMappingURL=app.js.map
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { createRequire } from "node:module";
|
|
2
|
-
import { isAsyncIterable, opFilter, operators, pipeAsync, pipeAsync as asyncPipe, toAsyncIterable as mergeAsyncIterables } from "@cspell/cspell-pipe";
|
|
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, MessageTypes, Text, combineTextAndLanguageSettings, createDictionaryReferenceCollection, createPerfTimer, extractDependencies, extractImportErrors, fileToDocument, getDefaultSettings, getGlobalSettingsAsync, getSystemFeatureFlags, isBinaryFile, isSpellingDictionaryLoadError, mergeSettings, setLogger, shouldCheckDocument, spellCheckDocument } 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";
|
|
5
5
|
import assert from "node:assert";
|
|
6
6
|
import { format, formatWithOptions, stripVTControlCharacters } from "node:util";
|
|
7
7
|
import { isUrlLike, toFileDirURL, toFilePathOrHref, toFileURL, urlRelative } from "@cspell/url";
|
|
@@ -27,7 +27,6 @@ import { getStat, readFileText, toURL } from "cspell-io";
|
|
|
27
27
|
import { glob } from "tinyglobby";
|
|
28
28
|
import * as readline from "node:readline";
|
|
29
29
|
import { parse, stringify } from "flatted";
|
|
30
|
-
|
|
31
30
|
//#region src/console.ts
|
|
32
31
|
var ImplChannel = class {
|
|
33
32
|
constructor(stream) {
|
|
@@ -62,7 +61,6 @@ function getColorLevel(stream) {
|
|
|
62
61
|
default: return 0;
|
|
63
62
|
}
|
|
64
63
|
}
|
|
65
|
-
|
|
66
64
|
//#endregion
|
|
67
65
|
//#region src/util/errors.ts
|
|
68
66
|
var CheckFailed = class extends Error {
|
|
@@ -113,7 +111,6 @@ function toApplicationError(e, message) {
|
|
|
113
111
|
const err = toError$1(e);
|
|
114
112
|
return new ApplicationError(message ?? err.message, void 0, err);
|
|
115
113
|
}
|
|
116
|
-
|
|
117
114
|
//#endregion
|
|
118
115
|
//#region src/util/perfMeasurements.ts
|
|
119
116
|
function getPerfMeasurements() {
|
|
@@ -182,7 +179,6 @@ function getPerfMeasurements() {
|
|
|
182
179
|
m.children.forEach(sortChildren);
|
|
183
180
|
}
|
|
184
181
|
}
|
|
185
|
-
|
|
186
182
|
//#endregion
|
|
187
183
|
//#region src/util/ansi.ts
|
|
188
184
|
function isAnsiString(s) {
|
|
@@ -338,7 +334,6 @@ function pruneTextStart(str, maxWidth, pad = "…") {
|
|
|
338
334
|
}
|
|
339
335
|
return str;
|
|
340
336
|
}
|
|
341
|
-
|
|
342
337
|
//#endregion
|
|
343
338
|
//#region src/util/pad.ts
|
|
344
339
|
function pad(s, w) {
|
|
@@ -355,7 +350,6 @@ function padLeft(s, w) {
|
|
|
355
350
|
if (!p) return s;
|
|
356
351
|
return s.padStart(p + s.length);
|
|
357
352
|
}
|
|
358
|
-
|
|
359
353
|
//#endregion
|
|
360
354
|
//#region src/util/table.ts
|
|
361
355
|
function tableToLines(table, deliminator) {
|
|
@@ -452,7 +446,6 @@ function headerDecorator(t) {
|
|
|
452
446
|
function decorateRowWith(row, ...decorators) {
|
|
453
447
|
return decorators.reduce((row, decorator) => row.map(decorator), row);
|
|
454
448
|
}
|
|
455
|
-
|
|
456
449
|
//#endregion
|
|
457
450
|
//#region src/util/util.ts
|
|
458
451
|
const uniqueFn = uniqueFilterFnGenerator;
|
|
@@ -476,7 +469,6 @@ function clean(src) {
|
|
|
476
469
|
for (const key of Object.keys(r)) if (r[key] === void 0) delete r[key];
|
|
477
470
|
return r;
|
|
478
471
|
}
|
|
479
|
-
|
|
480
472
|
//#endregion
|
|
481
473
|
//#region src/cli-reporter.ts
|
|
482
474
|
const templateIssue = `{green $filename}:{yellow $row:$col} - $message ({red $text}) $quickFix`;
|
|
@@ -870,7 +862,6 @@ function checkTemplate(template) {
|
|
|
870
862
|
return new ApplicationError(e instanceof Error ? e.message : `${e}`);
|
|
871
863
|
}
|
|
872
864
|
}
|
|
873
|
-
|
|
874
865
|
//#endregion
|
|
875
866
|
//#region src/config/adjustConfig.ts
|
|
876
867
|
async function fileExists(url) {
|
|
@@ -975,7 +966,6 @@ function addDictionariesToConfigFile(configFile, dictionaries, comment) {
|
|
|
975
966
|
}
|
|
976
967
|
setConfigFieldValue(configFile, "dictionaries", dicts, comment);
|
|
977
968
|
}
|
|
978
|
-
|
|
979
969
|
//#endregion
|
|
980
970
|
//#region src/config/config.ts
|
|
981
971
|
function applyValuesToConfigFile(config, settings, defaultValues, addComments) {
|
|
@@ -991,7 +981,6 @@ function applyValuesToConfigFile(config, settings, defaultValues, addComments) {
|
|
|
991
981
|
}
|
|
992
982
|
return config;
|
|
993
983
|
}
|
|
994
|
-
|
|
995
984
|
//#endregion
|
|
996
985
|
//#region src/config/constants.ts
|
|
997
986
|
const defaultConfig = {
|
|
@@ -1076,7 +1065,6 @@ const defaultConfig = {
|
|
|
1076
1065
|
comment: " Regular expressions / patterns of text to be included."
|
|
1077
1066
|
}
|
|
1078
1067
|
};
|
|
1079
|
-
|
|
1080
1068
|
//#endregion
|
|
1081
1069
|
//#region src/config/configInit.ts
|
|
1082
1070
|
const schemaRef = cspellConfigFileSchema;
|
|
@@ -1140,7 +1128,6 @@ async function createConfigFile(rw, url, options) {
|
|
|
1140
1128
|
content
|
|
1141
1129
|
});
|
|
1142
1130
|
}
|
|
1143
|
-
|
|
1144
1131
|
//#endregion
|
|
1145
1132
|
//#region src/featureFlags/featureFlags.ts
|
|
1146
1133
|
function getFeatureFlags() {
|
|
@@ -1159,7 +1146,6 @@ function parseFeatureFlags(flags, featureFlags = getFeatureFlags()) {
|
|
|
1159
1146
|
}
|
|
1160
1147
|
return featureFlags;
|
|
1161
1148
|
}
|
|
1162
|
-
|
|
1163
1149
|
//#endregion
|
|
1164
1150
|
//#region src/environment.ts
|
|
1165
1151
|
const environmentKeys = {
|
|
@@ -1186,7 +1172,6 @@ function truthy(value) {
|
|
|
1186
1172
|
}
|
|
1187
1173
|
return false;
|
|
1188
1174
|
}
|
|
1189
|
-
|
|
1190
1175
|
//#endregion
|
|
1191
1176
|
//#region src/dirname.ts
|
|
1192
1177
|
let _dirname;
|
|
@@ -1197,18 +1182,11 @@ try {
|
|
|
1197
1182
|
_dirname = __dirname;
|
|
1198
1183
|
}
|
|
1199
1184
|
const pkgDir = _dirname;
|
|
1200
|
-
|
|
1201
|
-
//#endregion
|
|
1202
|
-
//#region src/pkgInfo.ts
|
|
1203
|
-
const name = "cspell";
|
|
1204
|
-
const version$1 = "9.7.0";
|
|
1205
|
-
const engines = { node: ">=20.18" };
|
|
1206
1185
|
const npmPackage = {
|
|
1207
|
-
name,
|
|
1208
|
-
version:
|
|
1209
|
-
engines
|
|
1186
|
+
name: "cspell",
|
|
1187
|
+
version: "9.8.0",
|
|
1188
|
+
engines: { node: ">=20.18" }
|
|
1210
1189
|
};
|
|
1211
|
-
|
|
1212
1190
|
//#endregion
|
|
1213
1191
|
//#region src/reporters/reporters.ts
|
|
1214
1192
|
function filterFeatureIssues(features, issue, reportOptions) {
|
|
@@ -1411,23 +1389,17 @@ function replayReportItems(reportItemsCollection, reporter) {
|
|
|
1411
1389
|
break;
|
|
1412
1390
|
}
|
|
1413
1391
|
}
|
|
1414
|
-
|
|
1415
1392
|
//#endregion
|
|
1416
1393
|
//#region src/util/async.ts
|
|
1417
1394
|
const asyncMap = operators.opMapAsync;
|
|
1418
|
-
|
|
1395
|
+
operators.opFilterAsync;
|
|
1419
1396
|
const asyncAwait = operators.opAwaitAsync;
|
|
1420
1397
|
const asyncFlatten = operators.opFlattenAsync;
|
|
1421
|
-
|
|
1422
1398
|
//#endregion
|
|
1423
1399
|
//#region src/util/constants.ts
|
|
1424
1400
|
const UTF8 = "utf8";
|
|
1425
|
-
const STDIN = "stdin";
|
|
1426
1401
|
const STDINProtocol = "stdin:";
|
|
1427
1402
|
const STDINUrlPrefix = "stdin://";
|
|
1428
|
-
const FileUrlPrefix = "file://";
|
|
1429
|
-
const FileUrlAbsPrefix = "file:///";
|
|
1430
|
-
|
|
1431
1403
|
//#endregion
|
|
1432
1404
|
//#region src/util/glob.ts
|
|
1433
1405
|
const defaultExcludeGlobs = ["node_modules/**"];
|
|
@@ -1551,13 +1523,11 @@ function glob$1(patterns, options) {
|
|
|
1551
1523
|
patterns = typeof patterns === "string" ? workaroundPicomatchBug(patterns) : patterns.map((g) => workaroundPicomatchBug(g));
|
|
1552
1524
|
return glob(patterns, options);
|
|
1553
1525
|
}
|
|
1554
|
-
|
|
1555
1526
|
//#endregion
|
|
1556
1527
|
//#region src/util/stdin.ts
|
|
1557
1528
|
function readStdin() {
|
|
1558
1529
|
return readline.createInterface(process.stdin);
|
|
1559
1530
|
}
|
|
1560
|
-
|
|
1561
1531
|
//#endregion
|
|
1562
1532
|
//#region src/util/stdinUrl.ts
|
|
1563
1533
|
function isStdinUrl(url) {
|
|
@@ -1572,11 +1542,10 @@ function isStdinUrl(url) {
|
|
|
1572
1542
|
*/
|
|
1573
1543
|
function resolveStdinUrl(url, cwd) {
|
|
1574
1544
|
assert(url.startsWith(STDINProtocol), `Expected url to start with ${STDINProtocol}`);
|
|
1575
|
-
const path = decodeURIComponent(url).slice(
|
|
1545
|
+
const path = decodeURIComponent(url).slice(6).replace(/^\/\//, "").replace(/^\/([a-z]:)/i, "$1");
|
|
1576
1546
|
const fileUrl = toFileURL(path, cwd);
|
|
1577
1547
|
return new URL(fileUrl.toString().replace(/^file:/, STDINProtocol) + (path ? "" : "/"));
|
|
1578
1548
|
}
|
|
1579
|
-
|
|
1580
1549
|
//#endregion
|
|
1581
1550
|
//#region src/util/fileHelper.ts
|
|
1582
1551
|
function fileInfoToDocument(fileInfo, languageId, locale) {
|
|
@@ -1584,7 +1553,7 @@ function fileInfoToDocument(fileInfo, languageId, locale) {
|
|
|
1584
1553
|
languageId = languageId || void 0;
|
|
1585
1554
|
locale = locale || void 0;
|
|
1586
1555
|
const uri = filenameToUrl(filename);
|
|
1587
|
-
if (uri.href.startsWith(
|
|
1556
|
+
if (uri.href.startsWith("stdin:")) return clean({
|
|
1588
1557
|
uri: uri.href,
|
|
1589
1558
|
text,
|
|
1590
1559
|
languageId,
|
|
@@ -1595,7 +1564,7 @@ function fileInfoToDocument(fileInfo, languageId, locale) {
|
|
|
1595
1564
|
function filenameToUrl(filename, cwd = ".") {
|
|
1596
1565
|
if (filename instanceof URL) return filename;
|
|
1597
1566
|
const cwdURL = toFileDirURL(cwd);
|
|
1598
|
-
if (filename ===
|
|
1567
|
+
if (filename === "stdin") return new URL("stdin:///");
|
|
1599
1568
|
if (isStdinUrl(filename)) return new URL(resolveStdinUrl(filename, cwd));
|
|
1600
1569
|
return toFileURL(filename, cwdURL);
|
|
1601
1570
|
}
|
|
@@ -1609,10 +1578,10 @@ function isBinaryFile$1(filename, cwd) {
|
|
|
1609
1578
|
}
|
|
1610
1579
|
function resolveFilenameToUrl(filename, cwd) {
|
|
1611
1580
|
if (filename instanceof URL) return filename;
|
|
1612
|
-
if (filename ===
|
|
1613
|
-
if (filename.startsWith(
|
|
1581
|
+
if (filename === "stdin") return new URL(STDINUrlPrefix);
|
|
1582
|
+
if (filename.startsWith("file:///")) return new URL(filename);
|
|
1614
1583
|
const cwdUrl = toFileDirURL(cwd || process.cwd());
|
|
1615
|
-
if (filename.startsWith(
|
|
1584
|
+
if (filename.startsWith("file://")) return new URL(filename.slice(7), cwdUrl);
|
|
1616
1585
|
if (isStdinUrl(filename)) return resolveStdinUrl(filename, cwdUrl);
|
|
1617
1586
|
return toFileURL(filename, cwdUrl);
|
|
1618
1587
|
}
|
|
@@ -1621,7 +1590,7 @@ function resolveFilename(filename, cwd) {
|
|
|
1621
1590
|
}
|
|
1622
1591
|
function readFileInfo(filename, encoding = UTF8, handleNotFound = false) {
|
|
1623
1592
|
filename = resolveFilename(filename);
|
|
1624
|
-
return (filename.startsWith(
|
|
1593
|
+
return (filename.startsWith("stdin:") ? streamConsumers.text(process.stdin) : readFileText(filename, encoding)).then((text) => ({
|
|
1625
1594
|
text,
|
|
1626
1595
|
filename
|
|
1627
1596
|
}), (e) => {
|
|
@@ -1651,7 +1620,7 @@ function readFile(filename, encoding = UTF8) {
|
|
|
1651
1620
|
*/
|
|
1652
1621
|
async function findFiles(globPatterns, options) {
|
|
1653
1622
|
const stdin = [];
|
|
1654
|
-
const globPats = globPatterns.filter((filename) => !isStdin(filename) && !filename.startsWith(
|
|
1623
|
+
const globPats = globPatterns.filter((filename) => !isStdin(filename) && !filename.startsWith("file://") ? true : (stdin.push(filename), false));
|
|
1655
1624
|
const globResults = globPats.length ? await globP(globPats, options) : [];
|
|
1656
1625
|
const cwd = options.cwd || process.cwd();
|
|
1657
1626
|
return [...stdin, ...globResults].map((filename) => resolveFilename(filename, cwd));
|
|
@@ -1686,7 +1655,7 @@ async function readFileListFile(listFile) {
|
|
|
1686
1655
|
}
|
|
1687
1656
|
}
|
|
1688
1657
|
function isStdin(filename) {
|
|
1689
|
-
return filename ===
|
|
1658
|
+
return filename === "stdin" || isStdinUrl(filename);
|
|
1690
1659
|
}
|
|
1691
1660
|
async function isFile(filename) {
|
|
1692
1661
|
if (isStdin(filename)) return true;
|
|
@@ -1713,7 +1682,6 @@ function relativeToCwd(filename, cwd = process.cwd()) {
|
|
|
1713
1682
|
if (rel.startsWith("..")) return toFilePathOrHref(url);
|
|
1714
1683
|
return rel;
|
|
1715
1684
|
}
|
|
1716
|
-
|
|
1717
1685
|
//#endregion
|
|
1718
1686
|
//#region src/util/cache/file-entry-cache/flatCache.ts
|
|
1719
1687
|
var FlatCache = class {
|
|
@@ -1769,7 +1737,6 @@ var FlatCache = class {
|
|
|
1769
1737
|
function loadCacheFile(cachefile) {
|
|
1770
1738
|
return new FlatCache(cachefile).load();
|
|
1771
1739
|
}
|
|
1772
|
-
|
|
1773
1740
|
//#endregion
|
|
1774
1741
|
//#region src/util/cache/file-entry-cache/file-entry-cache.ts
|
|
1775
1742
|
async function createFromFile$1(cacheFileUrl, useChecksum, currentWorkingDir) {
|
|
@@ -1939,13 +1906,11 @@ function normalizePath$1(filePath) {
|
|
|
1939
1906
|
if (path.sep === "/") return filePath;
|
|
1940
1907
|
return filePath.split(path.sep).join("/");
|
|
1941
1908
|
}
|
|
1942
|
-
|
|
1943
1909
|
//#endregion
|
|
1944
1910
|
//#region src/util/cache/fileEntryCache.ts
|
|
1945
1911
|
function createFromFile(cacheFileUrl, useCheckSum, useRelative) {
|
|
1946
1912
|
return createFromFile$1(cacheFileUrl, useCheckSum, useRelative ? new URL("./", cacheFileUrl) : void 0);
|
|
1947
1913
|
}
|
|
1948
|
-
|
|
1949
1914
|
//#endregion
|
|
1950
1915
|
//#region src/util/cache/ObjectCollection.ts
|
|
1951
1916
|
const compare = Intl.Collator().compare;
|
|
@@ -1970,7 +1935,6 @@ var ShallowObjectCollection = class {
|
|
|
1970
1935
|
return v;
|
|
1971
1936
|
}
|
|
1972
1937
|
};
|
|
1973
|
-
|
|
1974
1938
|
//#endregion
|
|
1975
1939
|
//#region src/util/cache/DiskCache.ts
|
|
1976
1940
|
const META_DATA_VERSION_SUFFIX = "-1-" + Object.keys({
|
|
@@ -2166,7 +2130,6 @@ function normalizePath(filePath) {
|
|
|
2166
2130
|
if (sep === "/") return filePath;
|
|
2167
2131
|
return filePath.split(sep).join("/");
|
|
2168
2132
|
}
|
|
2169
|
-
|
|
2170
2133
|
//#endregion
|
|
2171
2134
|
//#region src/util/cache/DummyCache.ts
|
|
2172
2135
|
/**
|
|
@@ -2186,7 +2149,6 @@ var DummyCache = class {
|
|
|
2186
2149
|
return Promise.resolve();
|
|
2187
2150
|
}
|
|
2188
2151
|
};
|
|
2189
|
-
|
|
2190
2152
|
//#endregion
|
|
2191
2153
|
//#region src/util/cache/createCache.ts
|
|
2192
2154
|
const DEFAULT_CACHE_LOCATION = ".cspellcache";
|
|
@@ -2207,7 +2169,7 @@ async function createCache(options) {
|
|
|
2207
2169
|
async function calcCacheSettings(config, cacheOptions, root) {
|
|
2208
2170
|
const cs = config.cache ?? {};
|
|
2209
2171
|
const useCache = cacheOptions.cache ?? cs.useCache ?? false;
|
|
2210
|
-
const cacheLocation = await resolveCacheLocation(path.resolve(root, cacheOptions.cacheLocation ?? cs.cacheLocation ??
|
|
2172
|
+
const cacheLocation = await resolveCacheLocation(path.resolve(root, cacheOptions.cacheLocation ?? cs.cacheLocation ?? ".cspellcache"));
|
|
2211
2173
|
const cacheStrategy = cacheOptions.cacheStrategy ?? cs.cacheStrategy ?? "content";
|
|
2212
2174
|
const cacheFormat = cacheOptions.cacheFormat ?? cs.cacheFormat ?? "universal";
|
|
2213
2175
|
const optionals = {};
|
|
@@ -2239,7 +2201,6 @@ function normalizeVersion(version) {
|
|
|
2239
2201
|
assert(parts.length === 2);
|
|
2240
2202
|
return parts.join(".") + versionSuffix;
|
|
2241
2203
|
}
|
|
2242
|
-
|
|
2243
2204
|
//#endregion
|
|
2244
2205
|
//#region src/util/configFileHelper.ts
|
|
2245
2206
|
async function readConfig(configFile, root, stopConfigSearchAt) {
|
|
@@ -2280,14 +2241,12 @@ async function readConfigHandleError(filename) {
|
|
|
2280
2241
|
};
|
|
2281
2242
|
}
|
|
2282
2243
|
}
|
|
2283
|
-
|
|
2284
2244
|
//#endregion
|
|
2285
2245
|
//#region src/util/timer.ts
|
|
2286
2246
|
function getTimeMeasurer() {
|
|
2287
2247
|
const timer = createPerfTimer("timer");
|
|
2288
2248
|
return () => timer.elapsed;
|
|
2289
2249
|
}
|
|
2290
|
-
|
|
2291
2250
|
//#endregion
|
|
2292
2251
|
//#region src/util/unindent.ts
|
|
2293
2252
|
/**
|
|
@@ -2344,7 +2303,6 @@ function unindentString(str) {
|
|
|
2344
2303
|
}
|
|
2345
2304
|
return lines.map((line) => line.slice(curPad)).join("\n");
|
|
2346
2305
|
}
|
|
2347
|
-
|
|
2348
2306
|
//#endregion
|
|
2349
2307
|
//#region src/util/wrap.ts
|
|
2350
2308
|
const wrapSep = /\s+|(?<=,)|\.(?=\w)/g;
|
|
@@ -2381,7 +2339,6 @@ function* joinFragments(fragments) {
|
|
|
2381
2339
|
}
|
|
2382
2340
|
if (last) yield last.text;
|
|
2383
2341
|
}
|
|
2384
|
-
|
|
2385
2342
|
//#endregion
|
|
2386
2343
|
//#region src/util/writeFile.ts
|
|
2387
2344
|
async function writeFileOrStream(filename, data) {
|
|
@@ -2404,7 +2361,6 @@ function writeStream(stream, data) {
|
|
|
2404
2361
|
});
|
|
2405
2362
|
});
|
|
2406
2363
|
}
|
|
2407
|
-
|
|
2408
2364
|
//#endregion
|
|
2409
2365
|
//#region src/util/extractContext.ts
|
|
2410
2366
|
function prefCharIndex(text, offset, count = 1) {
|
|
@@ -2459,7 +2415,6 @@ function extractContext(tdo, contextRange) {
|
|
|
2459
2415
|
context.offset += line.offset;
|
|
2460
2416
|
return context;
|
|
2461
2417
|
}
|
|
2462
|
-
|
|
2463
2418
|
//#endregion
|
|
2464
2419
|
//#region src/lint/LinterError.ts
|
|
2465
2420
|
var LinterError = class extends Error {
|
|
@@ -2470,7 +2425,6 @@ var LinterError = class extends Error {
|
|
|
2470
2425
|
return this.message;
|
|
2471
2426
|
}
|
|
2472
2427
|
};
|
|
2473
|
-
|
|
2474
2428
|
//#endregion
|
|
2475
2429
|
//#region src/lint/processFile.ts
|
|
2476
2430
|
async function processFile(file, cache, prefetch, processFileOptions) {
|
|
@@ -2514,10 +2468,9 @@ async function processFile(file, cache, prefetch, processFileOptions) {
|
|
|
2514
2468
|
let spellResult = {};
|
|
2515
2469
|
try {
|
|
2516
2470
|
const { showSuggestions: generateSuggestions, validateDirectives, skipValidation } = cfg.options;
|
|
2517
|
-
const numSuggestions = configInfo.config.numSuggestions ?? 5;
|
|
2518
2471
|
const r = await spellCheckDocument(doc, clean({
|
|
2519
2472
|
generateSuggestions,
|
|
2520
|
-
numSuggestions,
|
|
2473
|
+
numSuggestions: configInfo.config.numSuggestions ?? 5,
|
|
2521
2474
|
validateDirectives,
|
|
2522
2475
|
skipValidation
|
|
2523
2476
|
}), userSettings);
|
|
@@ -2612,7 +2565,6 @@ function reportSpellingResultConfigErrors(reporter, spellResult, processFileOpti
|
|
|
2612
2565
|
function countConfigErrors(reporter, configInfo, processFileOptions) {
|
|
2613
2566
|
return reportConfigurationErrors(reporter, configInfo.config, processFileOptions);
|
|
2614
2567
|
}
|
|
2615
|
-
|
|
2616
2568
|
//#endregion
|
|
2617
2569
|
//#region src/util/prefetch.ts
|
|
2618
2570
|
function* prefetchIterable(iterable, size) {
|
|
@@ -2628,7 +2580,6 @@ function* prefetchIterable(iterable, size) {
|
|
|
2628
2580
|
}
|
|
2629
2581
|
yield* buffer;
|
|
2630
2582
|
}
|
|
2631
|
-
|
|
2632
2583
|
//#endregion
|
|
2633
2584
|
//#region src/util/unitNumbers.ts
|
|
2634
2585
|
const regexUnitNumber = /^((?:\d+(?:\.\d*)?)|(?:\.\d+))([a-z]*)$/i;
|
|
@@ -2672,7 +2623,6 @@ function sizeToNumber(size) {
|
|
|
2672
2623
|
if (p.error) return NaN;
|
|
2673
2624
|
return Number.parseFloat(p.digits) * (unitSizes[p.units] || 1);
|
|
2674
2625
|
}
|
|
2675
|
-
|
|
2676
2626
|
//#endregion
|
|
2677
2627
|
//#region src/lint/processFiles.ts
|
|
2678
2628
|
const BATCH_FETCH_SIZE = 12;
|
|
@@ -2829,9 +2779,8 @@ function runResult(init = {}) {
|
|
|
2829
2779
|
cachedFiles
|
|
2830
2780
|
};
|
|
2831
2781
|
}
|
|
2832
|
-
|
|
2833
2782
|
//#endregion
|
|
2834
|
-
//#region \0@oxc-project+runtime@0.
|
|
2783
|
+
//#region \0@oxc-project+runtime@0.122.0/helpers/usingCtx.js
|
|
2835
2784
|
function _usingCtx() {
|
|
2836
2785
|
var r = "function" == typeof SuppressedError ? SuppressedError : function(r, e) {
|
|
2837
2786
|
var n = Error();
|
|
@@ -2886,7 +2835,6 @@ function _usingCtx() {
|
|
|
2886
2835
|
}
|
|
2887
2836
|
};
|
|
2888
2837
|
}
|
|
2889
|
-
|
|
2890
2838
|
//#endregion
|
|
2891
2839
|
//#region src/lint/lint.ts
|
|
2892
2840
|
const version = npmPackage.version;
|
|
@@ -2909,7 +2857,7 @@ async function runLint(cfg) {
|
|
|
2909
2857
|
async function run() {
|
|
2910
2858
|
try {
|
|
2911
2859
|
var _usingCtx$1 = _usingCtx();
|
|
2912
|
-
|
|
2860
|
+
_usingCtx$1.u(measurePerf("runLint"));
|
|
2913
2861
|
if (cfg.options.root) setEnvironmentVariable(ENV_CSPELL_GLOB_ROOT, cfg.root);
|
|
2914
2862
|
const configInfo = await readConfig(cfg.configFile, cfg.root, cfg.options.stopConfigSearchAt);
|
|
2915
2863
|
const processFileOptions = getProcessFileOptions(configInfo);
|
|
@@ -3148,7 +3096,6 @@ function globPattern(g) {
|
|
|
3148
3096
|
function calcVerboseLevel(options) {
|
|
3149
3097
|
return options.verboseLevel ?? (options.verbose ? 1 : 0);
|
|
3150
3098
|
}
|
|
3151
|
-
|
|
3152
3099
|
//#endregion
|
|
3153
3100
|
//#region src/lint/LintRequest.ts
|
|
3154
3101
|
const defaultContextRange = 20;
|
|
@@ -3218,7 +3165,6 @@ function extractUnknownWordsConfig(options) {
|
|
|
3218
3165
|
}
|
|
3219
3166
|
return config;
|
|
3220
3167
|
}
|
|
3221
|
-
|
|
3222
3168
|
//#endregion
|
|
3223
3169
|
//#region src/options.ts
|
|
3224
3170
|
const ReportChoicesAll = [
|
|
@@ -3241,7 +3187,6 @@ function cvtLinterCliCommandOptionsToLinterCliOptions(options) {
|
|
|
3241
3187
|
}
|
|
3242
3188
|
return cliOptions;
|
|
3243
3189
|
}
|
|
3244
|
-
|
|
3245
3190
|
//#endregion
|
|
3246
3191
|
//#region src/repl/index.ts
|
|
3247
3192
|
function simpleRepl() {
|
|
@@ -3288,7 +3233,6 @@ var SimpleRepl = class {
|
|
|
3288
3233
|
return { next };
|
|
3289
3234
|
}
|
|
3290
3235
|
};
|
|
3291
|
-
|
|
3292
3236
|
//#endregion
|
|
3293
3237
|
//#region src/dictionaries/listDictionaries.ts
|
|
3294
3238
|
const inlineDictionaries = {
|
|
@@ -3399,7 +3343,97 @@ async function listDictionaries(options) {
|
|
|
3399
3343
|
dictionaryDefinitions.sort((a, b) => a.name.localeCompare(b.name));
|
|
3400
3344
|
return [...options.enabled !== false ? extractSpecialDictionaries(config) : [], ...dictionaryDefinitions.map(toListDictionariesResult)];
|
|
3401
3345
|
}
|
|
3402
|
-
|
|
3403
3346
|
//#endregion
|
|
3404
|
-
|
|
3405
|
-
|
|
3347
|
+
//#region src/application.mts
|
|
3348
|
+
function lint(fileGlobs, options, reporter) {
|
|
3349
|
+
options = fixLegacy(options);
|
|
3350
|
+
const unknownWordsConfig = extractUnknownWordsConfig(options);
|
|
3351
|
+
const useOptions = {
|
|
3352
|
+
...options,
|
|
3353
|
+
...unknownWordsConfig
|
|
3354
|
+
};
|
|
3355
|
+
const reporterOptions = {
|
|
3356
|
+
...useOptions,
|
|
3357
|
+
console
|
|
3358
|
+
};
|
|
3359
|
+
return runLint(new LintRequest(fileGlobs, useOptions, finalizeReporter(reporter) ?? getReporter({
|
|
3360
|
+
...useOptions,
|
|
3361
|
+
fileGlobs
|
|
3362
|
+
}, reporterOptions)));
|
|
3363
|
+
}
|
|
3364
|
+
async function* trace(words, options) {
|
|
3365
|
+
options = fixLegacy(options);
|
|
3366
|
+
const iWords = options.stdin ? toAsyncIterable(words, readStdin()) : words;
|
|
3367
|
+
const { languageId, locale, allowCompoundWords, ignoreCase } = options;
|
|
3368
|
+
const configFile = await readConfig(options.config, void 0);
|
|
3369
|
+
const loadDefault = options.defaultConfiguration ?? configFile.config.loadDefaultConfiguration ?? true;
|
|
3370
|
+
const additionalSettings = {};
|
|
3371
|
+
if (options.dictionary) additionalSettings.dictionaries = options.dictionary;
|
|
3372
|
+
yield* traceWordsAsync(iWords, mergeSettings(await getDefaultSettings(loadDefault), await getGlobalSettingsAsync(), configFile.config, additionalSettings), clean({
|
|
3373
|
+
languageId,
|
|
3374
|
+
locale,
|
|
3375
|
+
ignoreCase,
|
|
3376
|
+
allowCompoundWords
|
|
3377
|
+
}));
|
|
3378
|
+
}
|
|
3379
|
+
async function checkText(filename, options) {
|
|
3380
|
+
options = fixLegacy(options);
|
|
3381
|
+
const fileInfo = await readFileInfo(filename);
|
|
3382
|
+
const { locale, languageId, validateDirectives } = options;
|
|
3383
|
+
const doc = fileInfoToDocument(fileInfo, languageId, locale);
|
|
3384
|
+
const checkOptions = {
|
|
3385
|
+
configFile: options.config,
|
|
3386
|
+
validateDirectives
|
|
3387
|
+
};
|
|
3388
|
+
const settingsFromCommandLine = clean({
|
|
3389
|
+
languageId,
|
|
3390
|
+
language: locale,
|
|
3391
|
+
loadDefaultConfiguration: options.defaultConfiguration
|
|
3392
|
+
});
|
|
3393
|
+
return checkTextDocument(doc, clean({ ...checkOptions }), settingsFromCommandLine);
|
|
3394
|
+
}
|
|
3395
|
+
async function* suggestions(words, options) {
|
|
3396
|
+
options = fixLegacy(options);
|
|
3397
|
+
const configFile = await readConfig(options.config, void 0);
|
|
3398
|
+
let timer;
|
|
3399
|
+
function tapStart() {
|
|
3400
|
+
timer = getTimeMeasurer();
|
|
3401
|
+
}
|
|
3402
|
+
function mapStart(v) {
|
|
3403
|
+
tapStart();
|
|
3404
|
+
return v;
|
|
3405
|
+
}
|
|
3406
|
+
function mapEnd(v) {
|
|
3407
|
+
const elapsedTimeMs = timer?.();
|
|
3408
|
+
return elapsedTimeMs ? {
|
|
3409
|
+
...v,
|
|
3410
|
+
elapsedTimeMs
|
|
3411
|
+
} : v;
|
|
3412
|
+
}
|
|
3413
|
+
const iWords = options.repl ? pipeAsync(toAsyncIterable(words, simpleRepl()), opTap(tapStart)) : options.useStdin ? pipeAsync(toAsyncIterable(words, readStdin()), opTap(tapStart)) : words.map(mapStart);
|
|
3414
|
+
try {
|
|
3415
|
+
yield* pipeAsync(suggestionsForWords(iWords, clean({ ...options }), configFile.config), opMap(mapEnd));
|
|
3416
|
+
} catch (e) {
|
|
3417
|
+
if (!(e instanceof SuggestionError)) throw e;
|
|
3418
|
+
console.error(e.message);
|
|
3419
|
+
process.exitCode = 1;
|
|
3420
|
+
}
|
|
3421
|
+
}
|
|
3422
|
+
function createInit(options) {
|
|
3423
|
+
return configInit(options);
|
|
3424
|
+
}
|
|
3425
|
+
function registerApplicationFeatureFlags() {
|
|
3426
|
+
const ff = getFeatureFlags();
|
|
3427
|
+
[{
|
|
3428
|
+
name: "timer",
|
|
3429
|
+
description: "Display elapsed time for command."
|
|
3430
|
+
}].forEach((flag) => ff.register(flag));
|
|
3431
|
+
return ff;
|
|
3432
|
+
}
|
|
3433
|
+
function parseApplicationFeatureFlags(flags) {
|
|
3434
|
+
return parseFeatureFlags(flags, registerApplicationFeatureFlags());
|
|
3435
|
+
}
|
|
3436
|
+
//#endregion
|
|
3437
|
+
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
|
+
|
|
3439
|
+
//# sourceMappingURL=application-CpRYrn67.js.map
|
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import { n as DictionariesOptions } from "./options-
|
|
2
|
-
import { SuggestionsForWordResult } from "cspell-lib";
|
|
1
|
+
import { a as SuggestionOptions, i as LinterCliOptions, n as DictionariesOptions, o as TraceOptions, r as LegacyOptions, t as BaseOptions } from "./options-1v2EW2_1.js";
|
|
2
|
+
import { CheckTextInfo, FeatureFlags, IncludeExcludeFlag, SuggestionsForWordResult, TraceResult, TraceWordResult } from "cspell-lib";
|
|
3
|
+
import { CSpellReporter, RunResult } from "@cspell/cspell-types";
|
|
3
4
|
|
|
4
5
|
//#region src/config/options.d.ts
|
|
5
6
|
interface BaseConfigOptions {
|
|
@@ -105,5 +106,15 @@ interface ListDictionariesResult {
|
|
|
105
106
|
}
|
|
106
107
|
declare function listDictionaries(options: DictionariesOptions): Promise<ListDictionariesResult[]>;
|
|
107
108
|
//#endregion
|
|
108
|
-
|
|
109
|
-
|
|
109
|
+
//#region src/application.d.mts
|
|
110
|
+
type AppError = NodeJS.ErrnoException;
|
|
111
|
+
declare function lint(fileGlobs: string[], options: LinterCliOptions, reporter?: CSpellReporter): Promise<RunResult>;
|
|
112
|
+
declare function trace(words: string[], options: TraceOptions): AsyncIterableIterator<TraceWordResult>;
|
|
113
|
+
type CheckTextResult = CheckTextInfo;
|
|
114
|
+
declare function checkText(filename: string, options: BaseOptions & LegacyOptions): Promise<CheckTextResult>;
|
|
115
|
+
declare function suggestions(words: string[], options: SuggestionOptions): AsyncIterable<TimedSuggestionsForWordResult>;
|
|
116
|
+
declare function createInit(options: InitOptions): Promise<void>;
|
|
117
|
+
declare function parseApplicationFeatureFlags(flags: string[] | undefined): FeatureFlags;
|
|
118
|
+
//#endregion
|
|
119
|
+
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-DYrUtKeK.d.ts.map
|
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
import { a as
|
|
2
|
-
|
|
3
|
-
import { CheckTextInfo, FeatureFlags, IncludeExcludeFlag, TraceResult, TraceWordResult } from "cspell-lib";
|
|
4
|
-
import { CSpellReporter, RunResult } from "@cspell/cspell-types";
|
|
5
|
-
|
|
6
|
-
//#region src/application.d.mts
|
|
7
|
-
type AppError = NodeJS.ErrnoException;
|
|
8
|
-
declare function lint(fileGlobs: string[], options: LinterCliOptions, reporter?: CSpellReporter): Promise<RunResult>;
|
|
9
|
-
declare function trace(words: string[], options: TraceOptions): AsyncIterableIterator<TraceWordResult>;
|
|
10
|
-
type CheckTextResult = CheckTextInfo;
|
|
11
|
-
declare function checkText(filename: string, options: BaseOptions & LegacyOptions): Promise<CheckTextResult>;
|
|
12
|
-
declare function suggestions(words: string[], options: SuggestionOptions): AsyncIterable<TimedSuggestionsForWordResult>;
|
|
13
|
-
declare function createInit(options: InitOptions): Promise<void>;
|
|
14
|
-
declare function parseApplicationFeatureFlags(flags: string[] | undefined): FeatureFlags;
|
|
15
|
-
//#endregion
|
|
16
|
-
export { AppError, CheckTextResult, IncludeExcludeFlag, type TraceResult, checkText, createInit, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
|
17
|
-
//# sourceMappingURL=application.d.ts.map
|
|
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-DYrUtKeK.js";
|
|
2
|
+
export { AppError, CheckTextResult, IncludeExcludeFlag, TraceResult, checkText, createInit, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
package/dist/esm/application.js
CHANGED
|
@@ -1,97 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { opMap, opTap, pipeAsync, toAsyncIterable } from "@cspell/cspell-pipe";
|
|
3
|
-
import { IncludeExcludeFlag, SuggestionError, checkTextDocument, getDefaultSettings, getGlobalSettingsAsync, mergeSettings, suggestionsForWords, traceWordsAsync } from "cspell-lib";
|
|
4
|
-
|
|
5
|
-
//#region src/application.mts
|
|
6
|
-
function lint(fileGlobs, options, reporter) {
|
|
7
|
-
options = fixLegacy(options);
|
|
8
|
-
const unknownWordsConfig = extractUnknownWordsConfig(options);
|
|
9
|
-
const useOptions = {
|
|
10
|
-
...options,
|
|
11
|
-
...unknownWordsConfig
|
|
12
|
-
};
|
|
13
|
-
const reporterOptions = {
|
|
14
|
-
...useOptions,
|
|
15
|
-
console
|
|
16
|
-
};
|
|
17
|
-
return runLint(new LintRequest(fileGlobs, useOptions, finalizeReporter(reporter) ?? getReporter({
|
|
18
|
-
...useOptions,
|
|
19
|
-
fileGlobs
|
|
20
|
-
}, reporterOptions)));
|
|
21
|
-
}
|
|
22
|
-
async function* trace(words, options) {
|
|
23
|
-
options = fixLegacy(options);
|
|
24
|
-
const iWords = options.stdin ? toAsyncIterable(words, readStdin()) : words;
|
|
25
|
-
const { languageId, locale, allowCompoundWords, ignoreCase } = options;
|
|
26
|
-
const configFile = await readConfig(options.config, void 0);
|
|
27
|
-
const loadDefault = options.defaultConfiguration ?? configFile.config.loadDefaultConfiguration ?? true;
|
|
28
|
-
const additionalSettings = {};
|
|
29
|
-
if (options.dictionary) additionalSettings.dictionaries = options.dictionary;
|
|
30
|
-
yield* traceWordsAsync(iWords, mergeSettings(await getDefaultSettings(loadDefault), await getGlobalSettingsAsync(), configFile.config, additionalSettings), clean({
|
|
31
|
-
languageId,
|
|
32
|
-
locale,
|
|
33
|
-
ignoreCase,
|
|
34
|
-
allowCompoundWords
|
|
35
|
-
}));
|
|
36
|
-
}
|
|
37
|
-
async function checkText(filename, options) {
|
|
38
|
-
options = fixLegacy(options);
|
|
39
|
-
const fileInfo = await readFileInfo(filename);
|
|
40
|
-
const { locale, languageId, validateDirectives } = options;
|
|
41
|
-
const doc = fileInfoToDocument(fileInfo, languageId, locale);
|
|
42
|
-
const checkOptions = {
|
|
43
|
-
configFile: options.config,
|
|
44
|
-
validateDirectives
|
|
45
|
-
};
|
|
46
|
-
const settingsFromCommandLine = clean({
|
|
47
|
-
languageId,
|
|
48
|
-
language: locale,
|
|
49
|
-
loadDefaultConfiguration: options.defaultConfiguration
|
|
50
|
-
});
|
|
51
|
-
return checkTextDocument(doc, clean({ ...checkOptions }), settingsFromCommandLine);
|
|
52
|
-
}
|
|
53
|
-
async function* suggestions(words, options) {
|
|
54
|
-
options = fixLegacy(options);
|
|
55
|
-
const configFile = await readConfig(options.config, void 0);
|
|
56
|
-
let timer;
|
|
57
|
-
function tapStart() {
|
|
58
|
-
timer = getTimeMeasurer();
|
|
59
|
-
}
|
|
60
|
-
function mapStart(v) {
|
|
61
|
-
tapStart();
|
|
62
|
-
return v;
|
|
63
|
-
}
|
|
64
|
-
function mapEnd(v) {
|
|
65
|
-
const elapsedTimeMs = timer?.();
|
|
66
|
-
return elapsedTimeMs ? {
|
|
67
|
-
...v,
|
|
68
|
-
elapsedTimeMs
|
|
69
|
-
} : v;
|
|
70
|
-
}
|
|
71
|
-
const iWords = options.repl ? pipeAsync(toAsyncIterable(words, simpleRepl()), opTap(tapStart)) : options.useStdin ? pipeAsync(toAsyncIterable(words, readStdin()), opTap(tapStart)) : words.map(mapStart);
|
|
72
|
-
try {
|
|
73
|
-
yield* pipeAsync(suggestionsForWords(iWords, clean({ ...options }), configFile.config), opMap(mapEnd));
|
|
74
|
-
} catch (e) {
|
|
75
|
-
if (!(e instanceof SuggestionError)) throw e;
|
|
76
|
-
console.error(e.message);
|
|
77
|
-
process.exitCode = 1;
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
function createInit(options) {
|
|
81
|
-
return configInit(options);
|
|
82
|
-
}
|
|
83
|
-
function registerApplicationFeatureFlags() {
|
|
84
|
-
const ff = getFeatureFlags();
|
|
85
|
-
[{
|
|
86
|
-
name: "timer",
|
|
87
|
-
description: "Display elapsed time for command."
|
|
88
|
-
}].forEach((flag) => ff.register(flag));
|
|
89
|
-
return ff;
|
|
90
|
-
}
|
|
91
|
-
function parseApplicationFeatureFlags(flags) {
|
|
92
|
-
return parseFeatureFlags(flags, registerApplicationFeatureFlags());
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
//#endregion
|
|
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-CpRYrn67.js";
|
|
96
2
|
export { IncludeExcludeFlag, checkText, createInit, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
|
97
|
-
//# sourceMappingURL=application.js.map
|
package/dist/esm/index.d.ts
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import { i as LinterCliOptions, o as TraceOptions, s as FinalizedReporter, t as BaseOptions } from "./options-
|
|
2
|
-
import {
|
|
3
|
-
import { AppError, CheckTextResult, IncludeExcludeFlag, TraceResult, checkText, createInit, lint, parseApplicationFeatureFlags, suggestions, trace } from "./application.js";
|
|
4
|
-
import "chalk";
|
|
1
|
+
import { i as LinterCliOptions, o as TraceOptions, s as FinalizedReporter, t as BaseOptions } from "./options-1v2EW2_1.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-DYrUtKeK.js";
|
|
5
3
|
import { CSpellReporter, ReporterConfiguration } from "@cspell/cspell-types";
|
|
6
4
|
import { WriteStream } from "node:tty";
|
|
7
5
|
export * from "@cspell/cspell-types";
|
package/dist/esm/index.js
CHANGED
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export * from "@cspell/cspell-types"
|
|
5
|
-
|
|
6
|
-
export { IncludeExcludeFlag, checkText, createInit, getReporter as getDefaultReporter, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
|
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-CpRYrn67.js";
|
|
2
|
+
export * from "@cspell/cspell-types";
|
|
3
|
+
export { IncludeExcludeFlag, checkText, createInit, getReporter as getDefaultReporter, lint, listDictionaries, parseApplicationFeatureFlags, suggestions, trace };
|
|
@@ -1,8 +1,5 @@
|
|
|
1
|
-
import "cspell-lib";
|
|
2
1
|
import { CSpellReporter, CSpellSettings, CacheFormat, CacheStrategy, ReporterConfiguration, RunResult } from "@cspell/cspell-types";
|
|
3
2
|
import { GlobMatcher } from "cspell-glob";
|
|
4
|
-
import "cspell-io";
|
|
5
|
-
|
|
6
3
|
//#region src/util/cache/CacheOptions.d.ts
|
|
7
4
|
interface CacheOptions {
|
|
8
5
|
/**
|
|
@@ -401,4 +398,4 @@ interface CSpellConfigFile {
|
|
|
401
398
|
}
|
|
402
399
|
//#endregion
|
|
403
400
|
export { SuggestionOptions as a, LinterCliOptions as i, DictionariesOptions as n, TraceOptions as o, LegacyOptions as r, FinalizedReporter as s, BaseOptions as t };
|
|
404
|
-
//# sourceMappingURL=options-
|
|
401
|
+
//# sourceMappingURL=options-1v2EW2_1.d.ts.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell",
|
|
3
|
-
"version": "9.
|
|
3
|
+
"version": "9.8.0",
|
|
4
4
|
"description": "A Spelling Checker for Code!",
|
|
5
5
|
"funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
|
|
6
6
|
"bin": {
|
|
@@ -86,25 +86,25 @@
|
|
|
86
86
|
},
|
|
87
87
|
"homepage": "https://cspell.org/",
|
|
88
88
|
"dependencies": {
|
|
89
|
-
"@cspell/cspell-json-reporter": "9.
|
|
90
|
-
"@cspell/cspell-performance-monitor": "9.
|
|
91
|
-
"@cspell/cspell-pipe": "9.
|
|
92
|
-
"@cspell/cspell-types": "9.
|
|
93
|
-
"@cspell/cspell-worker": "9.
|
|
94
|
-
"@cspell/dynamic-import": "9.
|
|
95
|
-
"@cspell/url": "9.
|
|
89
|
+
"@cspell/cspell-json-reporter": "9.8.0",
|
|
90
|
+
"@cspell/cspell-performance-monitor": "9.8.0",
|
|
91
|
+
"@cspell/cspell-pipe": "9.8.0",
|
|
92
|
+
"@cspell/cspell-types": "9.8.0",
|
|
93
|
+
"@cspell/cspell-worker": "9.8.0",
|
|
94
|
+
"@cspell/dynamic-import": "9.8.0",
|
|
95
|
+
"@cspell/url": "9.8.0",
|
|
96
96
|
"ansi-regex": "^6.2.2",
|
|
97
97
|
"chalk": "^5.6.2",
|
|
98
98
|
"chalk-template": "^1.1.2",
|
|
99
99
|
"commander": "^14.0.3",
|
|
100
|
-
"cspell-config-lib": "9.
|
|
101
|
-
"cspell-dictionary": "9.
|
|
102
|
-
"cspell-gitignore": "9.
|
|
103
|
-
"cspell-glob": "9.
|
|
104
|
-
"cspell-io": "9.
|
|
105
|
-
"cspell-lib": "9.
|
|
100
|
+
"cspell-config-lib": "9.8.0",
|
|
101
|
+
"cspell-dictionary": "9.8.0",
|
|
102
|
+
"cspell-gitignore": "9.8.0",
|
|
103
|
+
"cspell-glob": "9.8.0",
|
|
104
|
+
"cspell-io": "9.8.0",
|
|
105
|
+
"cspell-lib": "9.8.0",
|
|
106
106
|
"fast-json-stable-stringify": "^2.1.0",
|
|
107
|
-
"flatted": "^3.
|
|
107
|
+
"flatted": "^3.4.2",
|
|
108
108
|
"semver": "^7.7.4",
|
|
109
109
|
"tinyglobby": "^0.2.15"
|
|
110
110
|
},
|
|
@@ -115,7 +115,7 @@
|
|
|
115
115
|
"@types/micromatch": "^4.0.10",
|
|
116
116
|
"@types/semver": "^7.7.1",
|
|
117
117
|
"micromatch": "^4.0.8",
|
|
118
|
-
"minimatch": "^9.0.
|
|
118
|
+
"minimatch": "^9.0.9"
|
|
119
119
|
},
|
|
120
|
-
"gitHead": "
|
|
120
|
+
"gitHead": "c822013ce676dffb5fa5544567c25a3ae666718f"
|
|
121
121
|
}
|