cspell 9.6.2 → 9.6.3
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/esm/app.d.ts +1 -1
- package/dist/esm/app.js +24 -24
- package/dist/esm/{application-Ce_s5c1d.d.ts → application-5MjpInZh.d.ts} +2 -2
- package/dist/esm/{application-BBOBF62T.js → application-DxeSY2Ho.js} +406 -363
- package/dist/esm/application.d.ts +2 -2
- package/dist/esm/application.js +1 -1
- package/dist/esm/index.d.ts +3 -6
- package/dist/esm/index.js +1 -1
- package/dist/esm/{options-D_PtlSKK.d.ts → options-CeDseSxu.d.ts} +6 -3
- package/package.json +16 -16
package/dist/esm/app.d.ts
CHANGED
package/dist/esm/app.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { C as CheckFailed, S as ApplicationError, _ as padLeft, a as parseApplicationFeatureFlags, b as pruneAnsiTextStart, 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 console, x as width, y as pruneAnsiTextEnd } from "./application-
|
|
1
|
+
import { C as CheckFailed, S as ApplicationError, _ as padLeft, a as parseApplicationFeatureFlags, b as pruneAnsiTextStart, 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 console, x as width, y as pruneAnsiTextEnd } from "./application-DxeSY2Ho.js";
|
|
2
2
|
import { Link } from "cspell-lib";
|
|
3
3
|
import chalk from "chalk";
|
|
4
4
|
import * as iPath from "node:path";
|
|
@@ -61,16 +61,16 @@ function crOpt(name, description, parseArg, defaultValue) {
|
|
|
61
61
|
|
|
62
62
|
//#endregion
|
|
63
63
|
//#region src/emitters/helpers.ts
|
|
64
|
-
function trimMidPath(s, w, sep
|
|
64
|
+
function trimMidPath(s, w, sep) {
|
|
65
65
|
if (s.length <= w) return s;
|
|
66
|
-
const parts = s.split(sep
|
|
66
|
+
const parts = s.split(sep);
|
|
67
67
|
if (parts[parts.length - 1].length > w) return trimMid(s, w);
|
|
68
|
-
function join(left
|
|
68
|
+
function join(left, right) {
|
|
69
69
|
return [
|
|
70
|
-
...parts.slice(0, left
|
|
70
|
+
...parts.slice(0, left),
|
|
71
71
|
"…",
|
|
72
|
-
...parts.slice(right
|
|
73
|
-
].join(sep
|
|
72
|
+
...parts.slice(right)
|
|
73
|
+
].join(sep);
|
|
74
74
|
}
|
|
75
75
|
let left = 0, right = parts.length, last = "";
|
|
76
76
|
for (let i = 0; i < parts.length; ++i) {
|
|
@@ -101,15 +101,15 @@ function trimMid(s, w) {
|
|
|
101
101
|
const r = Math.ceil((w - 1) / 2);
|
|
102
102
|
return s.slice(0, l) + "…" + s.slice(-r);
|
|
103
103
|
}
|
|
104
|
-
function formatDictionaryLocation(dictSource, maxWidth
|
|
105
|
-
let relPath = cwd ? iPath
|
|
104
|
+
function formatDictionaryLocation(dictSource, maxWidth, { cwd, dictionaryPathFormat: format, iPath }) {
|
|
105
|
+
let relPath = cwd ? iPath.relative(cwd, dictSource) : dictSource;
|
|
106
106
|
const idxNodeModule = relPath.lastIndexOf("node_modules");
|
|
107
107
|
const isNodeModule = idxNodeModule >= 0;
|
|
108
108
|
if (format === "hide") return "";
|
|
109
|
-
if (format === "short") return (isNodeModule ? "[node_modules]/" : relPath.startsWith(".." + iPath
|
|
109
|
+
if (format === "short") return (isNodeModule ? "[node_modules]/" : relPath.startsWith(".." + iPath.sep + "..") ? "…/" : relPath.startsWith(".." + iPath.sep) ? "../" : "") + iPath.basename(dictSource);
|
|
110
110
|
if (format === "full") return dictSource;
|
|
111
111
|
relPath = isNodeModule ? relPath.slice(idxNodeModule) : relPath;
|
|
112
|
-
return trimMidPath(relPath.length < dictSource.length ? relPath : dictSource, maxWidth
|
|
112
|
+
return trimMidPath(relPath.length < dictSource.length ? relPath : dictSource, maxWidth, iPath.sep);
|
|
113
113
|
}
|
|
114
114
|
|
|
115
115
|
//#endregion
|
|
@@ -155,10 +155,10 @@ function calcHeaders(options) {
|
|
|
155
155
|
function emitDictResult(r, options) {
|
|
156
156
|
const a = r.enabled ? "*" : " ";
|
|
157
157
|
const dictColor = r.enabled ? chalk.yellowBright : chalk.rgb(200, 128, 50);
|
|
158
|
-
const n = (width
|
|
158
|
+
const n = (width) => dictColor(pruneAnsiTextEnd(r.name, width && width - a.length) + a);
|
|
159
159
|
const c = colorize$1(chalk.white);
|
|
160
|
-
const locales = (width
|
|
161
|
-
const fileTypes = (width
|
|
160
|
+
const locales = (width) => c(pruneAnsiTextEnd(r.locales?.join(",") || "", width));
|
|
161
|
+
const fileTypes = (width) => c(pruneAnsiTextEnd(r.fileTypes?.join(",") || "", width));
|
|
162
162
|
if (!r.path) return {
|
|
163
163
|
name: n,
|
|
164
164
|
location: c(r.inline?.join(", ") || ""),
|
|
@@ -442,32 +442,32 @@ function increaseVerbosity(_dummyValue, previous) {
|
|
|
442
442
|
//#region src/emitters/suggestionsEmitter.ts
|
|
443
443
|
const regExpRTL = /([ \u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC]+)/g;
|
|
444
444
|
function reverseRtlText(s) {
|
|
445
|
-
return s.replaceAll(regExpRTL, (s
|
|
445
|
+
return s.replaceAll(regExpRTL, (s) => [...s].reverse().join(""));
|
|
446
446
|
}
|
|
447
447
|
function emitSuggestionResult(result, options) {
|
|
448
|
-
const { word, suggestions
|
|
448
|
+
const { word, suggestions } = result;
|
|
449
449
|
const { verbose, output = console } = options;
|
|
450
450
|
const elapsed = verbose && verbose > 1 && result.elapsedTimeMs ? ` ${result.elapsedTimeMs.toFixed(2)} ms` : "";
|
|
451
451
|
const rWord = reverseRtlText(word);
|
|
452
452
|
const wordEx = rWord !== word ? ` (${chalk.yellow(rWord)})` : "";
|
|
453
453
|
output.log((word ? chalk.yellow(word) + wordEx : chalk.yellow("<empty>")) + ":" + elapsed);
|
|
454
|
-
if (!suggestions
|
|
454
|
+
if (!suggestions.length) {
|
|
455
455
|
console.log(chalk.yellow(" <no suggestions>"));
|
|
456
456
|
return;
|
|
457
457
|
}
|
|
458
|
-
function handleRtl(word
|
|
459
|
-
const r = reverseRtlText(word
|
|
460
|
-
return r === word
|
|
458
|
+
function handleRtl(word) {
|
|
459
|
+
const r = reverseRtlText(word);
|
|
460
|
+
return r === word ? word : `${word} (${r})`;
|
|
461
461
|
}
|
|
462
462
|
if (verbose) {
|
|
463
|
-
const mappedSugs = suggestions
|
|
463
|
+
const mappedSugs = suggestions.map((s) => ({
|
|
464
464
|
...s,
|
|
465
465
|
w: handleRtl(s.compoundWord || s.wordAdjustedToMatchCase || s.word)
|
|
466
466
|
}));
|
|
467
|
-
const maxWidth
|
|
467
|
+
const maxWidth = mappedSugs.map((s) => width(s.w)).reduce((max, len) => Math.max(max, len), 0);
|
|
468
468
|
for (const sug of mappedSugs) {
|
|
469
469
|
const { cost, dictionaries, w } = sug;
|
|
470
|
-
const padding = " ".repeat(padWidth(w, maxWidth
|
|
470
|
+
const padding = " ".repeat(padWidth(w, maxWidth));
|
|
471
471
|
const forbid = sug.forbidden && sug.isPreferred ? chalk.red("*") : sug.forbidden ? chalk.red("X") : sug.isPreferred ? chalk.yellow("*") : " ";
|
|
472
472
|
const ignore = sug.noSuggest ? chalk.yellow("N") : " ";
|
|
473
473
|
const strCost = padLeft(cost.toString(10), 4);
|
|
@@ -475,7 +475,7 @@ function emitSuggestionResult(result, options) {
|
|
|
475
475
|
output.log(` - ${formatWord(w, sug)}${padding} ${forbid}${ignore} - ${chalk.yellow(strCost)} ${dicts}`);
|
|
476
476
|
}
|
|
477
477
|
} else {
|
|
478
|
-
const mappedSugs = suggestions
|
|
478
|
+
const mappedSugs = suggestions.map((s) => ({
|
|
479
479
|
...s,
|
|
480
480
|
word: handleRtl(s.wordAdjustedToMatchCase || s.word)
|
|
481
481
|
}));
|
|
@@ -1,4 +1,4 @@
|
|
|
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-CeDseSxu.js";
|
|
2
2
|
import { CheckTextInfo, FeatureFlags, IncludeExcludeFlag, SuggestionsForWordResult, TraceResult, TraceWordResult } from "cspell-lib";
|
|
3
3
|
import { CSpellReporter, RunResult } from "@cspell/cspell-types";
|
|
4
4
|
|
|
@@ -113,4 +113,4 @@ declare function createInit(options: InitOptions): Promise<void>;
|
|
|
113
113
|
declare function parseApplicationFeatureFlags(flags: string[] | undefined): FeatureFlags;
|
|
114
114
|
//#endregion
|
|
115
115
|
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 };
|
|
116
|
-
//# sourceMappingURL=application-
|
|
116
|
+
//# sourceMappingURL=application-5MjpInZh.d.ts.map
|