cspell 5.17.0-alpha.0 → 5.18.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/dist/app.d.ts +2 -2
- package/dist/app.js +6 -6
- package/dist/application.d.ts +2 -3
- package/dist/application.js +6 -7
- package/dist/emitters/suggestionsEmitter.js +5 -4
- package/dist/lint/lint.js +15 -7
- package/dist/util/async.d.ts +1 -45
- package/dist/util/async.js +4 -98
- package/dist/util/glob.d.ts +10 -2
- package/package.json +14 -10
package/dist/app.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import
|
|
1
|
+
import type { Command } from 'commander';
|
|
2
2
|
export { LinterCliOptions as Options } from './options';
|
|
3
3
|
export { CheckFailed } from './util/errors';
|
|
4
|
-
export declare function run(
|
|
4
|
+
export declare function run(command?: Command, argv?: string[]): Promise<void>;
|
|
5
5
|
//# sourceMappingURL=app.d.ts.map
|
package/dist/app.js
CHANGED
|
@@ -20,25 +20,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.run = exports.CheckFailed = void 0;
|
|
23
|
-
const
|
|
23
|
+
const commander_1 = require("commander");
|
|
24
24
|
const path = __importStar(require("path"));
|
|
25
|
-
const
|
|
25
|
+
const semver_1 = require("semver");
|
|
26
26
|
const commandCheck_1 = require("./commandCheck");
|
|
27
27
|
const commandLink_1 = require("./commandLink");
|
|
28
28
|
const commandLint_1 = require("./commandLint");
|
|
29
|
-
const commandTrace_1 = require("./commandTrace");
|
|
30
29
|
const commandSuggestion_1 = require("./commandSuggestion");
|
|
30
|
+
const commandTrace_1 = require("./commandTrace");
|
|
31
31
|
const errors_1 = require("./util/errors");
|
|
32
32
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
33
33
|
const npmPackage = require(path.join(__dirname, '..', 'package.json'));
|
|
34
34
|
var errors_2 = require("./util/errors");
|
|
35
35
|
Object.defineProperty(exports, "CheckFailed", { enumerable: true, get: function () { return errors_2.CheckFailed; } });
|
|
36
|
-
async function run(
|
|
37
|
-
const prog =
|
|
36
|
+
async function run(command, argv) {
|
|
37
|
+
const prog = command || commander_1.program;
|
|
38
38
|
const args = argv || process.argv;
|
|
39
39
|
prog.exitOverride();
|
|
40
40
|
prog.version(npmPackage.version).description('Spelling Checker for Code').name('cspell');
|
|
41
|
-
if (!
|
|
41
|
+
if (!(0, semver_1.satisfies)(process.versions.node, npmPackage.engines.node)) {
|
|
42
42
|
throw new errors_1.ApplicationError(`Unsupported NodeJS version (${process.versions.node}); ${npmPackage.engines.node} is required`);
|
|
43
43
|
}
|
|
44
44
|
(0, commandLint_1.commandLint)(prog);
|
package/dist/application.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { CSpellReporter, RunResult } from '@cspell/cspell-types';
|
|
3
|
-
import
|
|
4
|
-
import { CheckTextInfo, TraceResult } from 'cspell-lib';
|
|
3
|
+
import type { CheckTextInfo, SuggestionsForWordResult, TraceResult } from 'cspell-lib';
|
|
5
4
|
import { BaseOptions, LegacyOptions, LinterOptions, SuggestionOptions, TraceOptions } from './options';
|
|
6
5
|
export { IncludeExcludeFlag } from 'cspell-lib';
|
|
7
6
|
export type { TraceResult } from 'cspell-lib';
|
|
@@ -10,6 +9,6 @@ export declare function lint(fileGlobs: string[], options: LinterOptions, emitte
|
|
|
10
9
|
export declare function trace(words: string[], options: TraceOptions): AsyncIterableIterator<TraceResult[]>;
|
|
11
10
|
export declare type CheckTextResult = CheckTextInfo;
|
|
12
11
|
export declare function checkText(filename: string, options: BaseOptions & LegacyOptions): Promise<CheckTextResult>;
|
|
13
|
-
export declare function suggestions(words: string[], options: SuggestionOptions): AsyncIterable<
|
|
12
|
+
export declare function suggestions(words: string[], options: SuggestionOptions): AsyncIterable<SuggestionsForWordResult>;
|
|
14
13
|
export declare function createInit(): Promise<void>;
|
|
15
14
|
//# sourceMappingURL=application.d.ts.map
|
package/dist/application.js
CHANGED
|
@@ -20,15 +20,14 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
20
20
|
};
|
|
21
21
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
22
22
|
exports.createInit = exports.suggestions = exports.checkText = exports.trace = exports.lint = exports.IncludeExcludeFlag = void 0;
|
|
23
|
-
const cspell = __importStar(require("cspell-lib"));
|
|
24
23
|
const cspell_lib_1 = require("cspell-lib");
|
|
25
24
|
const path = __importStar(require("path"));
|
|
26
|
-
const fileHelper_1 = require("./util/fileHelper");
|
|
27
25
|
const lint_1 = require("./lint");
|
|
28
26
|
const options_1 = require("./options");
|
|
27
|
+
const async = __importStar(require("@cspell/cspell-pipe"));
|
|
28
|
+
const fileHelper_1 = require("./util/fileHelper");
|
|
29
29
|
const stdin_1 = require("./util/stdin");
|
|
30
30
|
const util = __importStar(require("./util/util"));
|
|
31
|
-
const async = __importStar(require("./util/async"));
|
|
32
31
|
var cspell_lib_2 = require("cspell-lib");
|
|
33
32
|
Object.defineProperty(exports, "IncludeExcludeFlag", { enumerable: true, get: function () { return cspell_lib_2.IncludeExcludeFlag; } });
|
|
34
33
|
function lint(fileGlobs, options, emitters) {
|
|
@@ -39,10 +38,10 @@ function lint(fileGlobs, options, emitters) {
|
|
|
39
38
|
exports.lint = lint;
|
|
40
39
|
async function* trace(words, options) {
|
|
41
40
|
options = (0, options_1.fixLegacy)(options);
|
|
42
|
-
const iWords = options.stdin ? async.
|
|
41
|
+
const iWords = options.stdin ? async.toAsyncIterable(words, (0, stdin_1.readStdin)()) : words;
|
|
43
42
|
const { languageId, locale, allowCompoundWords, ignoreCase } = options;
|
|
44
43
|
const configFile = await (0, fileHelper_1.readConfig)(options.config, undefined);
|
|
45
|
-
const config =
|
|
44
|
+
const config = (0, cspell_lib_1.mergeSettings)((0, cspell_lib_1.getDefaultSettings)(), (0, cspell_lib_1.getGlobalSettings)(), configFile.config);
|
|
46
45
|
yield* (0, cspell_lib_1.traceWordsAsync)(iWords, config, { languageId, locale, ignoreCase, allowCompoundWords });
|
|
47
46
|
}
|
|
48
47
|
exports.trace = trace;
|
|
@@ -55,13 +54,13 @@ async function checkText(filename, options) {
|
|
|
55
54
|
language: options.locale || options.local || undefined,
|
|
56
55
|
});
|
|
57
56
|
const info = (0, fileHelper_1.calcFinalConfigInfo)(foundSettings, settingsFromCommandLine, filename, text);
|
|
58
|
-
return
|
|
57
|
+
return (0, cspell_lib_1.checkText)(text, info.configInfo.config);
|
|
59
58
|
}
|
|
60
59
|
exports.checkText = checkText;
|
|
61
60
|
async function* suggestions(words, options) {
|
|
62
61
|
options = (0, options_1.fixLegacy)(options);
|
|
63
62
|
const configFile = await (0, fileHelper_1.readConfig)(options.config, undefined);
|
|
64
|
-
const iWords = options.useStdin ? async.
|
|
63
|
+
const iWords = options.useStdin ? async.toAsyncIterable(words, (0, stdin_1.readStdin)()) : words;
|
|
65
64
|
try {
|
|
66
65
|
const results = (0, cspell_lib_1.suggestionsForWords)(iWords, options, configFile.config);
|
|
67
66
|
yield* results;
|
|
@@ -6,7 +6,7 @@ const util_1 = require("../util/util");
|
|
|
6
6
|
function emitSuggestionResult(result, options) {
|
|
7
7
|
const { word, suggestions } = result;
|
|
8
8
|
const { verbose, output = console } = options;
|
|
9
|
-
output.log(word ? chalk.
|
|
9
|
+
output.log(word ? chalk.yellow(word) : chalk.yellow('<empty>') + ':');
|
|
10
10
|
if (!suggestions.length) {
|
|
11
11
|
console.log(chalk.yellow(' <no suggestions>'));
|
|
12
12
|
return;
|
|
@@ -14,13 +14,14 @@ function emitSuggestionResult(result, options) {
|
|
|
14
14
|
if (verbose) {
|
|
15
15
|
const maxWidth = suggestions.map((r) => r.word.length).reduce((max, len) => Math.max(max, len), 0);
|
|
16
16
|
for (const sug of suggestions) {
|
|
17
|
-
const { word, cost, dictionaries } = sug;
|
|
18
|
-
const
|
|
17
|
+
const { word, cost, dictionaries, compoundWord } = sug;
|
|
18
|
+
const w = compoundWord || word;
|
|
19
|
+
const padding = ' '.repeat(maxWidth - w.length);
|
|
19
20
|
const forbid = sug.forbidden ? chalk.red('X') : ' ';
|
|
20
21
|
const ignore = sug.noSuggest ? chalk.yellow('N') : ' ';
|
|
21
22
|
const strCost = (0, util_1.padLeft)(cost.toString(10), 4);
|
|
22
23
|
const dicts = dictionaries.map((n) => chalk.gray(n)).join(', ');
|
|
23
|
-
output.log(` - ${formatWord(
|
|
24
|
+
output.log(` - ${formatWord(w, sug)}${padding} ${forbid}${ignore} - ${chalk.yellow(strCost)} ${dicts}`);
|
|
24
25
|
}
|
|
25
26
|
}
|
|
26
27
|
else {
|
package/dist/lint/lint.js
CHANGED
|
@@ -28,14 +28,15 @@ const cspell = __importStar(require("cspell-lib"));
|
|
|
28
28
|
const path = __importStar(require("path"));
|
|
29
29
|
const util_1 = require("util");
|
|
30
30
|
const vscode_uri_1 = require("vscode-uri");
|
|
31
|
-
const
|
|
31
|
+
const cspell_pipe_1 = require("@cspell/cspell-pipe");
|
|
32
32
|
const cache_1 = require("../util/cache");
|
|
33
33
|
const errors_1 = require("../util/errors");
|
|
34
|
+
const fileHelper_1 = require("../util/fileHelper");
|
|
34
35
|
const glob_1 = require("../util/glob");
|
|
35
36
|
const reporters_1 = require("../util/reporters");
|
|
36
37
|
const timer_1 = require("../util/timer");
|
|
37
38
|
const util = __importStar(require("../util/util"));
|
|
38
|
-
const
|
|
39
|
+
const chalk = require("chalk");
|
|
39
40
|
async function runLint(cfg) {
|
|
40
41
|
let { reporter } = cfg;
|
|
41
42
|
cspell.setLogger(getLoggerFromReporter(reporter));
|
|
@@ -200,6 +201,7 @@ async function runLint(cfg) {
|
|
|
200
201
|
return runResult();
|
|
201
202
|
}
|
|
202
203
|
header(fileGlobs, excludeGlobs);
|
|
204
|
+
checkGlobs(cfg.fileGlobs, reporter);
|
|
203
205
|
reporter.info(`Config Files Found:\n ${configInfo.source}\n`, cspell_types_1.MessageTypes.Info);
|
|
204
206
|
const configErrors = await countConfigErrors(configInfo);
|
|
205
207
|
if (configErrors)
|
|
@@ -233,6 +235,12 @@ Options:
|
|
|
233
235
|
}
|
|
234
236
|
}
|
|
235
237
|
exports.runLint = runLint;
|
|
238
|
+
function checkGlobs(globs, reporter) {
|
|
239
|
+
globs
|
|
240
|
+
.filter((g) => g.startsWith("'") || g.endsWith("'"))
|
|
241
|
+
.map((glob) => chalk.yellow(glob))
|
|
242
|
+
.forEach((glob) => reporter.error('Linter', new errors_1.CheckFailed(`Glob starting or ending with ' (single quote) is not likely to match any files: ${glob}.`)));
|
|
243
|
+
}
|
|
236
244
|
async function determineGlobs(configInfo, cfg) {
|
|
237
245
|
var _a, _b, _c;
|
|
238
246
|
const useGitignore = (_b = (_a = cfg.options.gitignore) !== null && _a !== void 0 ? _a : configInfo.config.useGitignore) !== null && _b !== void 0 ? _b : false;
|
|
@@ -270,14 +278,14 @@ async function determineFilesToCheck(configInfo, cfg, reporter, globInfo) {
|
|
|
270
278
|
if (enableGlobDot !== undefined) {
|
|
271
279
|
globOptions.dot = enableGlobDot;
|
|
272
280
|
}
|
|
273
|
-
const filterFiles = (0,
|
|
281
|
+
const filterFiles = (0, cspell_pipe_1.opFilter)(filterFilesFn(globMatcher));
|
|
274
282
|
const foundFiles = await (hasFileLists
|
|
275
283
|
? useFileLists(fileLists, allGlobs, root, enableGlobDot)
|
|
276
284
|
: (0, fileHelper_1.findFiles)(fileGlobs, globOptions));
|
|
277
285
|
const filtered = gitIgnore ? await gitIgnore.filterOutIgnored(foundFiles) : foundFiles;
|
|
278
|
-
const files = (0,
|
|
279
|
-
? (0,
|
|
280
|
-
: [...(0,
|
|
286
|
+
const files = (0, cspell_pipe_1.isAsyncIterable)(filtered)
|
|
287
|
+
? (0, cspell_pipe_1.pipeAsync)(filtered, filterFiles)
|
|
288
|
+
: [...(0, cspell_pipe_1.pipeSync)(filtered, filterFiles)];
|
|
281
289
|
return files;
|
|
282
290
|
}
|
|
283
291
|
function isExcluded(filename, globMatcherExclude) {
|
|
@@ -384,6 +392,6 @@ async function useFileLists(fileListFiles, includeGlobPatterns, root, dot) {
|
|
|
384
392
|
const globMatcher = new cspell_glob_1.GlobMatcher(includeGlobPatterns, options);
|
|
385
393
|
const files = await (0, fileHelper_1.readFileListFiles)(fileListFiles);
|
|
386
394
|
const filterFiles = (file) => globMatcher.match(file);
|
|
387
|
-
return files instanceof Array ? files.filter(filterFiles) : (0,
|
|
395
|
+
return files instanceof Array ? files.filter(filterFiles) : (0, cspell_pipe_1.pipeAsync)(files, (0, cspell_pipe_1.opFilter)(filterFiles));
|
|
388
396
|
}
|
|
389
397
|
//# sourceMappingURL=lint.js.map
|
package/dist/util/async.d.ts
CHANGED
|
@@ -1,46 +1,2 @@
|
|
|
1
|
-
export
|
|
2
|
-
export declare function asyncAwait<T>(): (iter: AsyncIterable<T>) => AsyncIterable<Awaited<T>>;
|
|
3
|
-
export declare const filter: <T>(fn: (i: T) => boolean) => PipeFn<T, T>;
|
|
4
|
-
interface PipeFnSync<T, U> {
|
|
5
|
-
(iter: Iterable<T>): Iterable<U>;
|
|
6
|
-
/** This is just to help TypeScript figure out the type. */
|
|
7
|
-
__PipeFnSync__?: [T, U];
|
|
8
|
-
}
|
|
9
|
-
interface PipeFnAsync<T, U> {
|
|
10
|
-
(iter: AsyncIterable<T>): AsyncIterable<U>;
|
|
11
|
-
/** This is just to help TypeScript figure out the type. */
|
|
12
|
-
__PipeFnAsync__?: [T, U];
|
|
13
|
-
}
|
|
14
|
-
declare type PipeFn<T, U> = PipeFnSync<T, U> & PipeFnAsync<T, U>;
|
|
15
|
-
export declare function pipeAsync<T>(i: AnyIterable<T>): AsyncIterable<T>;
|
|
16
|
-
export declare function pipeAsync<T, T0>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0]>): AsyncIterable<T0>;
|
|
17
|
-
export declare function pipeAsync<T, T0, T1>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1]>): AsyncIterable<T1>;
|
|
18
|
-
export declare function pipeAsync<T, T0, T1, T2>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1, T2]>): AsyncIterable<T2>;
|
|
19
|
-
export declare function pipeAsync<T, T0, T1, T2, T3>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1, T2, T3]>): AsyncIterable<T3>;
|
|
20
|
-
export declare function pipeAsync<T, T0, T1, T2, T3, T4>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1, T2, T3, T4]>): AsyncIterable<T4>;
|
|
21
|
-
export declare function pipeAsync<T, T0, T1, T2, T3, T4, T5>(i: AnyIterable<T>, ...f: PipeAsyncTx<[T, T0, T1, T2, T3, T4, T5]>): AsyncIterable<T5>;
|
|
22
|
-
declare type PsFn<T, U> = PipeFnSync<T, U> | ((i: Iterable<T>) => Iterable<U>);
|
|
23
|
-
export declare function pipeSync<T>(i: Iterable<T>): Iterable<T>;
|
|
24
|
-
export declare function pipeSync<T, T0 = T>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0]>): Iterable<T0>;
|
|
25
|
-
export declare function pipeSync<T, T0, T1>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1]>): Iterable<T1>;
|
|
26
|
-
export declare function pipeSync<T, T0, T1, T2>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1, T2]>): Iterable<T2>;
|
|
27
|
-
export declare function pipeSync<T, T0, T1, T2, T3>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1, T2, T3]>): Iterable<T3>;
|
|
28
|
-
export declare function pipeSync<T, T0, T1, T2, T3, T4>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1, T2, T3, T4]>): Iterable<T4>;
|
|
29
|
-
export declare function pipeSync<T, T0, T1, T2, T3, T4, T5>(i: Iterable<T>, ...f: PipeSyncTx<[T, T0, T1, T2, T3, T4, T5]>): Iterable<T5>;
|
|
30
|
-
declare type AnyIterable<T> = Iterable<T> | AsyncIterable<T> | Promise<Iterable<T>> | Iterable<Promise<T>>;
|
|
31
|
-
export declare function mergeAsyncIterables<T>(iter: Iterable<T>): AsyncIterable<T>;
|
|
32
|
-
export declare function mergeAsyncIterables<T>(iter: AsyncIterable<T>): AsyncIterable<T>;
|
|
33
|
-
export declare function mergeAsyncIterables<T>(iter: Promise<Iterable<T>>): AsyncIterable<T>;
|
|
34
|
-
export declare function mergeAsyncIterables<T>(iter: AnyIterable<T>): AsyncIterable<T>;
|
|
35
|
-
export declare function mergeAsyncIterables<T>(iter: AnyIterable<T>, ...rest: AnyIterable<T>[]): AsyncIterable<T>;
|
|
36
|
-
/**
|
|
37
|
-
* Convert one or more iterables to an AsyncIterable
|
|
38
|
-
*/
|
|
39
|
-
export declare const toAsyncIterable: typeof mergeAsyncIterables;
|
|
40
|
-
export declare function asyncIterableToArray<T>(iter: Iterable<T> | AsyncIterable<T>): Promise<Awaited<T>[]>;
|
|
41
|
-
export declare function isAsyncIterable<T>(i: AnyIterable<T>): i is AsyncIterable<T>;
|
|
42
|
-
declare type PaFn<T, U> = PipeFnAsync<T, U> | ((i: AsyncIterable<T>) => AsyncIterable<U>);
|
|
43
|
-
declare type PipeAsyncTx<T extends [...any]> = T extends [infer Left, infer Right, ...infer Rest] ? Rest extends [any, ...any] ? [PaFn<Left, Right>, ...PipeAsyncTx<[Right, ...Rest]>] : [PaFn<Left, Right>] : never;
|
|
44
|
-
declare type PipeSyncTx<T extends [...any]> = T extends [infer Left, infer Right, ...infer Rest] ? Rest extends [any, ...any] ? [PsFn<Left, Right>, ...PipeSyncTx<[Right, ...Rest]>] : [PsFn<Left, Right>] : never;
|
|
45
|
-
export {};
|
|
1
|
+
export { toAsyncIterable as mergeAsyncIterables, toArray as asyncIterableToArray } from '@cspell/cspell-pipe';
|
|
46
2
|
//# sourceMappingURL=async.d.ts.map
|
package/dist/util/async.js
CHANGED
|
@@ -1,101 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
yield mapFn(v);
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
return fn;
|
|
11
|
-
}
|
|
12
|
-
function syncMap(mapFn) {
|
|
13
|
-
function* fn(iter) {
|
|
14
|
-
for (const v of iter) {
|
|
15
|
-
yield mapFn(v);
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
return fn;
|
|
19
|
-
}
|
|
20
|
-
const map = (fn) => toPipeFn(syncMap(fn), asyncMap(fn));
|
|
21
|
-
exports.map = map;
|
|
22
|
-
function asyncFilter(filterFn) {
|
|
23
|
-
async function* fn(iter) {
|
|
24
|
-
for await (const v of iter) {
|
|
25
|
-
if (filterFn(v))
|
|
26
|
-
yield v;
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
return fn;
|
|
30
|
-
}
|
|
31
|
-
function syncFilter(filterFn) {
|
|
32
|
-
function* fn(iter) {
|
|
33
|
-
for (const v of iter) {
|
|
34
|
-
if (filterFn(v))
|
|
35
|
-
yield v;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
return fn;
|
|
39
|
-
}
|
|
40
|
-
async function* _asyncAwait(iter) {
|
|
41
|
-
for await (const v of iter) {
|
|
42
|
-
yield v;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
function asyncAwait() {
|
|
46
|
-
return _asyncAwait;
|
|
47
|
-
}
|
|
48
|
-
exports.asyncAwait = asyncAwait;
|
|
49
|
-
const filter = (fn) => toPipeFn(syncFilter(fn), asyncFilter(fn));
|
|
50
|
-
exports.filter = filter;
|
|
51
|
-
function toPipeFn(syncFn, asyncFn) {
|
|
52
|
-
function _(i) {
|
|
53
|
-
return isAsyncIterable(i) ? asyncFn(i) : syncFn(i);
|
|
54
|
-
}
|
|
55
|
-
return _;
|
|
56
|
-
}
|
|
57
|
-
function pipeAsync(i, ...fns) {
|
|
58
|
-
let iter = (0, exports.toAsyncIterable)(i);
|
|
59
|
-
for (const fn of fns) {
|
|
60
|
-
iter = fn(iter);
|
|
61
|
-
}
|
|
62
|
-
return iter;
|
|
63
|
-
}
|
|
64
|
-
exports.pipeAsync = pipeAsync;
|
|
65
|
-
function pipeSync(i, ...fns) {
|
|
66
|
-
let iter = i;
|
|
67
|
-
for (const fn of fns) {
|
|
68
|
-
iter = fn(iter);
|
|
69
|
-
}
|
|
70
|
-
return iter;
|
|
71
|
-
}
|
|
72
|
-
exports.pipeSync = pipeSync;
|
|
73
|
-
/**
|
|
74
|
-
* Merge multiple iterables into an AsyncIterable
|
|
75
|
-
* @param iter - initial iterable.
|
|
76
|
-
* @param rest - iterables to merge.
|
|
77
|
-
*/
|
|
78
|
-
async function* mergeAsyncIterables(iter, ...rest) {
|
|
79
|
-
for await (const i of [iter, ...rest]) {
|
|
80
|
-
yield* i;
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
exports.mergeAsyncIterables = mergeAsyncIterables;
|
|
84
|
-
/**
|
|
85
|
-
* Convert one or more iterables to an AsyncIterable
|
|
86
|
-
*/
|
|
87
|
-
exports.toAsyncIterable = mergeAsyncIterables;
|
|
88
|
-
async function asyncIterableToArray(iter) {
|
|
89
|
-
const r = [];
|
|
90
|
-
for await (const t of iter) {
|
|
91
|
-
r.push(t);
|
|
92
|
-
}
|
|
93
|
-
return r;
|
|
94
|
-
}
|
|
95
|
-
exports.asyncIterableToArray = asyncIterableToArray;
|
|
96
|
-
function isAsyncIterable(i) {
|
|
97
|
-
return typeof i[Symbol.asyncIterator] === 'function';
|
|
98
|
-
}
|
|
99
|
-
exports.isAsyncIterable = isAsyncIterable;
|
|
100
|
-
// type Last<T extends [...any]> = T extends [infer U, ...infer R] ? (R extends [any, ...any] ? Last<R> : U) : never;
|
|
3
|
+
exports.asyncIterableToArray = exports.mergeAsyncIterables = void 0;
|
|
4
|
+
var cspell_pipe_1 = require("@cspell/cspell-pipe");
|
|
5
|
+
Object.defineProperty(exports, "mergeAsyncIterables", { enumerable: true, get: function () { return cspell_pipe_1.toAsyncIterable; } });
|
|
6
|
+
Object.defineProperty(exports, "asyncIterableToArray", { enumerable: true, get: function () { return cspell_pipe_1.toArray; } });
|
|
101
7
|
//# sourceMappingURL=async.js.map
|
package/dist/util/glob.d.ts
CHANGED
|
@@ -1,7 +1,15 @@
|
|
|
1
1
|
import type { CSpellUserSettings, Glob } from '@cspell/cspell-types';
|
|
2
2
|
import { GlobMatcher, GlobPatternWithRoot } from 'cspell-glob';
|
|
3
|
-
|
|
4
|
-
|
|
3
|
+
/**
|
|
4
|
+
* This is a subset of IOptions from 'glob'.
|
|
5
|
+
*/
|
|
6
|
+
export interface GlobOptions {
|
|
7
|
+
cwd?: string | undefined;
|
|
8
|
+
root?: string | undefined;
|
|
9
|
+
dot?: boolean | undefined;
|
|
10
|
+
nodir?: boolean | undefined;
|
|
11
|
+
ignore?: string | ReadonlyArray<string> | undefined;
|
|
12
|
+
}
|
|
5
13
|
/**
|
|
6
14
|
*
|
|
7
15
|
* @param pattern - glob patterns and NOT file paths. It can be a file path turned into a glob.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.18.1",
|
|
4
4
|
"description": "A Spelling Checker for Code!",
|
|
5
5
|
"funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
],
|
|
37
37
|
"scripts": {
|
|
38
38
|
"clean": "rimraf dist coverage .tsbuildinfo",
|
|
39
|
-
"build": "npm run compile",
|
|
39
|
+
"build": "npm run compile && npm run build-api",
|
|
40
|
+
"build-api": "rollup -c rollup.config.mjs",
|
|
40
41
|
"build-dev": "tsc -p tsconfig.dev.json",
|
|
41
42
|
"clean-build": "npm run clean && npm run build",
|
|
42
43
|
"compile": "tsc -p .",
|
|
@@ -69,12 +70,13 @@
|
|
|
69
70
|
},
|
|
70
71
|
"homepage": "https://streetsidesoftware.github.io/cspell/",
|
|
71
72
|
"dependencies": {
|
|
73
|
+
"@cspell/cspell-pipe": "^5.18.1",
|
|
72
74
|
"chalk": "^4.1.2",
|
|
73
|
-
"commander": "^
|
|
75
|
+
"commander": "^9.0.0",
|
|
74
76
|
"comment-json": "^4.1.1",
|
|
75
|
-
"cspell-gitignore": "^5.
|
|
76
|
-
"cspell-glob": "^5.
|
|
77
|
-
"cspell-lib": "^5.
|
|
77
|
+
"cspell-gitignore": "^5.18.1",
|
|
78
|
+
"cspell-glob": "^5.18.1",
|
|
79
|
+
"cspell-lib": "^5.18.1",
|
|
78
80
|
"fast-json-stable-stringify": "^2.1.0",
|
|
79
81
|
"file-entry-cache": "^6.0.1",
|
|
80
82
|
"fs-extra": "^10.0.0",
|
|
@@ -89,8 +91,8 @@
|
|
|
89
91
|
"node": ">=12.13.0"
|
|
90
92
|
},
|
|
91
93
|
"devDependencies": {
|
|
92
|
-
"@cspell/cspell-json-reporter": "^5.
|
|
93
|
-
"@cspell/cspell-types": "^5.
|
|
94
|
+
"@cspell/cspell-json-reporter": "^5.18.1",
|
|
95
|
+
"@cspell/cspell-types": "^5.18.1",
|
|
94
96
|
"@types/file-entry-cache": "^5.0.2",
|
|
95
97
|
"@types/fs-extra": "^9.0.13",
|
|
96
98
|
"@types/glob": "^7.2.0",
|
|
@@ -101,7 +103,9 @@
|
|
|
101
103
|
"jest": "^27.4.7",
|
|
102
104
|
"micromatch": "^4.0.4",
|
|
103
105
|
"minimatch": "^3.0.4",
|
|
104
|
-
"rimraf": "^3.0.2"
|
|
106
|
+
"rimraf": "^3.0.2",
|
|
107
|
+
"rollup": "^2.66.1",
|
|
108
|
+
"rollup-plugin-dts": "^4.1.0"
|
|
105
109
|
},
|
|
106
|
-
"gitHead": "
|
|
110
|
+
"gitHead": "8b94979b57a7b1a11f8efbd5bc086d29d496f7be"
|
|
107
111
|
}
|