cspell 6.31.1 → 7.0.0-alpha.2
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 +2 -2
- package/dist/esm/application.d.mts +1 -1
- package/dist/esm/cli-reporter.mjs +2 -1
- package/dist/esm/util/constants.d.mts +1 -1
- package/dist/esm/util/fileHelper.d.mts +1 -1
- package/dist/lib/file-entry-cache.cjs +3 -2
- package/dist/lib/file-entry-cache.d.cts +2 -2
- package/dist/lib/pkgInfo.cjs +3 -25
- package/package.json +31 -36
- package/bin.js +0 -16
- package/dist/cjs/app.d.ts +0 -5
- package/dist/cjs/app.js +0 -50
- package/dist/cjs/application.d.ts +0 -16
- package/dist/cjs/application.js +0 -121
- package/dist/cjs/cli-reporter.d.ts +0 -16
- package/dist/cjs/cli-reporter.js +0 -247
- package/dist/cjs/commandCheck.d.ts +0 -3
- package/dist/cjs/commandCheck.js +0 -78
- package/dist/cjs/commandLink.d.ts +0 -3
- package/dist/cjs/commandLink.js +0 -51
- package/dist/cjs/commandLint.d.ts +0 -3
- package/dist/cjs/commandLint.js +0 -150
- package/dist/cjs/commandSuggestion.d.ts +0 -3
- package/dist/cjs/commandSuggestion.js +0 -88
- package/dist/cjs/commandTrace.d.ts +0 -3
- package/dist/cjs/commandTrace.js +0 -87
- package/dist/cjs/emitters/DictionaryPathFormat.d.ts +0 -3
- package/dist/cjs/emitters/DictionaryPathFormat.js +0 -16
- package/dist/cjs/emitters/suggestionsEmitter.d.ts +0 -13
- package/dist/cjs/emitters/suggestionsEmitter.js +0 -84
- package/dist/cjs/emitters/traceEmitter.d.ts +0 -21
- package/dist/cjs/emitters/traceEmitter.js +0 -171
- package/dist/cjs/featureFlags/featureFlags.d.ts +0 -4
- package/dist/cjs/featureFlags/featureFlags.js +0 -25
- package/dist/cjs/featureFlags/index.d.ts +0 -2
- package/dist/cjs/featureFlags/index.js +0 -7
- package/dist/cjs/index.d.ts +0 -5
- package/dist/cjs/index.js +0 -22
- package/dist/cjs/link.d.ts +0 -8
- package/dist/cjs/link.js +0 -47
- package/dist/cjs/lint/LintRequest.d.ts +0 -23
- package/dist/cjs/lint/LintRequest.js +0 -48
- package/dist/cjs/lint/index.d.ts +0 -3
- package/dist/cjs/lint/index.js +0 -8
- package/dist/cjs/lint/lint.d.ts +0 -4
- package/dist/cjs/lint/lint.js +0 -499
- package/dist/cjs/options.d.ts +0 -178
- package/dist/cjs/options.js +0 -12
- package/dist/cjs/repl/index.d.ts +0 -18
- package/dist/cjs/repl/index.js +0 -75
- package/dist/cjs/util/InMemoryReporter.d.ts +0 -28
- package/dist/cjs/util/InMemoryReporter.js +0 -47
- package/dist/cjs/util/async.d.ts +0 -3
- package/dist/cjs/util/async.js +0 -12
- package/dist/cjs/util/cache/CSpellLintResultCache.d.ts +0 -20
- package/dist/cjs/util/cache/CSpellLintResultCache.js +0 -3
- package/dist/cjs/util/cache/CacheOptions.d.ts +0 -34
- package/dist/cjs/util/cache/CacheOptions.js +0 -3
- package/dist/cjs/util/cache/DiskCache.d.ts +0 -63
- package/dist/cjs/util/cache/DiskCache.js +0 -237
- package/dist/cjs/util/cache/DummyCache.d.ts +0 -11
- package/dist/cjs/util/cache/DummyCache.js +0 -22
- package/dist/cjs/util/cache/ObjectCollection.d.ts +0 -17
- package/dist/cjs/util/cache/ObjectCollection.js +0 -136
- package/dist/cjs/util/cache/createCache.d.ts +0 -31
- package/dist/cjs/util/cache/createCache.js +0 -77
- package/dist/cjs/util/cache/fileEntryCache.d.ts +0 -9
- package/dist/cjs/util/cache/fileEntryCache.js +0 -107
- package/dist/cjs/util/cache/index.d.ts +0 -4
- package/dist/cjs/util/cache/index.js +0 -8
- package/dist/cjs/util/constants.d.ts +0 -6
- package/dist/cjs/util/constants.js +0 -8
- package/dist/cjs/util/errors.d.ts +0 -23
- package/dist/cjs/util/errors.js +0 -60
- package/dist/cjs/util/fileHelper.d.ts +0 -63
- package/dist/cjs/util/fileHelper.js +0 -226
- package/dist/cjs/util/glob.d.ts +0 -45
- package/dist/cjs/util/glob.js +0 -175
- package/dist/cjs/util/prefetch.d.ts +0 -2
- package/dist/cjs/util/prefetch.js +0 -23
- package/dist/cjs/util/reporters.d.ts +0 -14
- package/dist/cjs/util/reporters.js +0 -68
- package/dist/cjs/util/stdin.d.ts +0 -2
- package/dist/cjs/util/stdin.js +0 -32
- package/dist/cjs/util/table.d.ts +0 -10
- package/dist/cjs/util/table.js +0 -40
- package/dist/cjs/util/timer.d.ts +0 -8
- package/dist/cjs/util/timer.js +0 -17
- package/dist/cjs/util/types.d.ts +0 -7
- package/dist/cjs/util/types.js +0 -6
- package/dist/cjs/util/util.d.ts +0 -13
- package/dist/cjs/util/util.js +0 -55
package/README.md
CHANGED
|
@@ -58,13 +58,13 @@ cspell
|
|
|
58
58
|
with:
|
|
59
59
|
|
|
60
60
|
```
|
|
61
|
-
docker run -
|
|
61
|
+
docker run -it -v $PWD:/workdir ghcr.io/streetsidesoftware/cspell:latest
|
|
62
62
|
```
|
|
63
63
|
|
|
64
64
|
**Example:**
|
|
65
65
|
|
|
66
66
|
```sh
|
|
67
|
-
docker run -
|
|
67
|
+
docker run -it -v $PWD:/workdir ghcr.io/streetsidesoftware/cspell:latest lint --help
|
|
68
68
|
```
|
|
69
69
|
|
|
70
70
|
## Basic Usage
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
1
|
+
/// <reference types="node" resolution-mode="require"/>
|
|
2
2
|
import type { CSpellReporter, RunResult } from '@cspell/cspell-types';
|
|
3
3
|
import type { CheckTextInfo, FeatureFlags, TraceResult } from 'cspell-lib';
|
|
4
4
|
import type { TimedSuggestionsForWordResult } from './emitters/suggestionsEmitter.mjs';
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import chalk from 'chalk';
|
|
2
|
+
import chalkTemplate from 'chalk-template';
|
|
2
3
|
import { isSpellingDictionaryLoadError } from 'cspell-lib';
|
|
3
4
|
import * as path from 'path';
|
|
4
5
|
import { URI } from '../lib/uri.cjs';
|
|
@@ -157,7 +158,7 @@ function formatIssue(templateStr, issue, maxIssueTextWidth) {
|
|
|
157
158
|
$quickFix: formatQuickFix(issue),
|
|
158
159
|
};
|
|
159
160
|
const t = template(templateStr.replace(/\$message/g, message));
|
|
160
|
-
return substitute(
|
|
161
|
+
return substitute(chalkTemplate(t), substitutions).trimEnd();
|
|
161
162
|
}
|
|
162
163
|
function formatSuggestions(issue) {
|
|
163
164
|
if (issue.suggestionsEx) {
|
|
@@ -24,9 +24,10 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.createFromFile = void 0;
|
|
27
|
-
|
|
27
|
+
/* This is to work around a bug in file-entry-cache that uses `this` */
|
|
28
|
+
const fileEntryCache = __importStar(require("file-entry-cache"));
|
|
28
29
|
function createFromFile(pathToCache, useChecksum) {
|
|
29
|
-
return
|
|
30
|
+
return fileEntryCache.createFromFile(pathToCache, useChecksum);
|
|
30
31
|
}
|
|
31
32
|
exports.createFromFile = createFromFile;
|
|
32
33
|
//# sourceMappingURL=file-entry-cache.cjs.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
export type { FileDescriptor, FileEntryCache } from 'file-entry-cache';
|
|
2
|
-
import
|
|
3
|
-
export declare function createFromFile(pathToCache: string, useChecksum?: boolean):
|
|
2
|
+
import type { FileEntryCache } from 'file-entry-cache';
|
|
3
|
+
export declare function createFromFile(pathToCache: string, useChecksum?: boolean): FileEntryCache;
|
|
4
4
|
//# sourceMappingURL=file-entry-cache.d.cts.map
|
package/dist/lib/pkgInfo.cjs
CHANGED
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
3
|
exports.npmPackage = exports.pkgDir = void 0;
|
|
27
|
-
const
|
|
28
|
-
exports.pkgDir =
|
|
4
|
+
const path_1 = require("path");
|
|
5
|
+
exports.pkgDir = (0, path_1.join)(__dirname, '../..');
|
|
6
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
29
7
|
exports.npmPackage = require('../../package.json');
|
|
30
8
|
//# sourceMappingURL=pkgInfo.cjs.map
|
package/package.json
CHANGED
|
@@ -1,36 +1,33 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0-alpha.2",
|
|
4
4
|
"description": "A Spelling Checker for Code!",
|
|
5
5
|
"funding": "https://github.com/streetsidesoftware/cspell?sponsor=1",
|
|
6
6
|
"bin": {
|
|
7
|
-
"cspell": "bin.
|
|
7
|
+
"cspell": "bin.mjs",
|
|
8
8
|
"cspell-esm": "bin.mjs"
|
|
9
9
|
},
|
|
10
|
-
"type": "
|
|
11
|
-
"
|
|
12
|
-
"types": "dist/cjs/index.d.ts",
|
|
10
|
+
"type": "module",
|
|
11
|
+
"types": "dist/esm/index.d.mts",
|
|
13
12
|
"module": "dist/esm/index.mjs",
|
|
14
13
|
"exports": {
|
|
15
14
|
".": {
|
|
16
|
-
"import": "./dist/esm/index.mjs"
|
|
17
|
-
"require": "./dist/cjs/index.js"
|
|
15
|
+
"import": "./dist/esm/index.mjs"
|
|
18
16
|
},
|
|
19
17
|
"./app": {
|
|
20
|
-
"import": "./dist/esm/app.mjs"
|
|
21
|
-
"require": "./dist/cjs/app.js"
|
|
18
|
+
"import": "./dist/esm/app.mjs"
|
|
22
19
|
},
|
|
23
20
|
"./bin": {
|
|
24
|
-
"import": "./bin.mjs"
|
|
25
|
-
|
|
21
|
+
"import": "./bin.mjs"
|
|
22
|
+
},
|
|
23
|
+
"./bin.mjs": {
|
|
24
|
+
"import": "./bin.mjs"
|
|
26
25
|
},
|
|
27
26
|
"./application": {
|
|
28
|
-
"import": "./dist/esm/application.mjs"
|
|
29
|
-
"require": "./dist/cjs/application.js"
|
|
27
|
+
"import": "./dist/esm/application.mjs"
|
|
30
28
|
}
|
|
31
29
|
},
|
|
32
30
|
"files": [
|
|
33
|
-
"bin.js",
|
|
34
31
|
"bin.mjs",
|
|
35
32
|
"dist",
|
|
36
33
|
"!dist/esm/**/*.js",
|
|
@@ -43,17 +40,16 @@
|
|
|
43
40
|
"!**/*.map"
|
|
44
41
|
],
|
|
45
42
|
"scripts": {
|
|
46
|
-
"clean": "shx rm -rf dist coverage
|
|
43
|
+
"clean": "shx rm -rf dist temp coverage \"*.tsbuildInfo\"",
|
|
47
44
|
"build": "tsc -b . && ts2mjs dist/esm && pnpm run build:api",
|
|
48
45
|
"build:api": "rollup -c rollup.config.mjs",
|
|
49
|
-
"build:cjs": "tsc -b tsconfig.cjs.json",
|
|
50
46
|
"build:esm": "tsc -b tsconfig.esm.json",
|
|
51
47
|
"build:esm:ts2mjs": "tsc -b tsconfig.esm.json && ts2mjs dist/esm",
|
|
52
48
|
"build:lib": "tsc -b src/lib/tsconfig.json",
|
|
53
49
|
"build:readme": "pnpm build:readme:help",
|
|
54
50
|
"build:readme:help": "pnpm build:readme:help:lint && pnpm build:readme:help:trace && inject-markdown README.md && prettier -w README.md",
|
|
55
|
-
"build:readme:help:lint": "./bin.
|
|
56
|
-
"build:readme:help:trace": "./bin.
|
|
51
|
+
"build:readme:help:lint": "./bin.mjs lint --help > static/help-lint.txt",
|
|
52
|
+
"build:readme:help:trace": "./bin.mjs trace --help > static/help-trace.txt",
|
|
57
53
|
"clean-build": "pnpm run clean && pnpm run build",
|
|
58
54
|
"coverage": "pnpm coverage:vitest && pnpm coverage:fix",
|
|
59
55
|
"coverage:vitest": "vitest run --coverage",
|
|
@@ -88,36 +84,35 @@
|
|
|
88
84
|
},
|
|
89
85
|
"homepage": "https://streetsidesoftware.github.io/cspell/",
|
|
90
86
|
"dependencies": {
|
|
91
|
-
"@cspell/cspell-pipe": "
|
|
92
|
-
"@cspell/dynamic-import": "
|
|
93
|
-
"chalk": "^
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"cspell-
|
|
97
|
-
"cspell-
|
|
98
|
-
"cspell-
|
|
87
|
+
"@cspell/cspell-pipe": "7.0.0-alpha.2",
|
|
88
|
+
"@cspell/dynamic-import": "7.0.0-alpha.2",
|
|
89
|
+
"chalk": "^5.2.0",
|
|
90
|
+
"chalk-template": "^1.0.0",
|
|
91
|
+
"commander": "^10.0.1",
|
|
92
|
+
"cspell-gitignore": "7.0.0-alpha.2",
|
|
93
|
+
"cspell-glob": "7.0.0-alpha.2",
|
|
94
|
+
"cspell-io": "7.0.0-alpha.2",
|
|
95
|
+
"cspell-lib": "7.0.0-alpha.2",
|
|
99
96
|
"fast-glob": "^3.2.12",
|
|
100
97
|
"fast-json-stable-stringify": "^2.1.0",
|
|
101
98
|
"file-entry-cache": "^6.0.1",
|
|
102
|
-
"get-stdin": "^
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"strip-ansi": "^6.0.1",
|
|
99
|
+
"get-stdin": "^9.0.0",
|
|
100
|
+
"semver": "^7.5.0",
|
|
101
|
+
"strip-ansi": "^7.0.1",
|
|
106
102
|
"vscode-uri": "^3.0.7"
|
|
107
103
|
},
|
|
108
104
|
"engines": {
|
|
109
|
-
"node": ">=
|
|
105
|
+
"node": ">=16"
|
|
110
106
|
},
|
|
111
107
|
"devDependencies": {
|
|
112
|
-
"@cspell/cspell-json-reporter": "
|
|
113
|
-
"@cspell/cspell-types": "
|
|
108
|
+
"@cspell/cspell-json-reporter": "7.0.0-alpha.2",
|
|
109
|
+
"@cspell/cspell-types": "7.0.0-alpha.2",
|
|
114
110
|
"@types/file-entry-cache": "^5.0.2",
|
|
115
111
|
"@types/glob": "^8.1.0",
|
|
116
|
-
"@types/imurmurhash": "^0.1.1",
|
|
117
112
|
"@types/micromatch": "^4.0.2",
|
|
118
113
|
"@types/semver": "^7.3.13",
|
|
119
114
|
"micromatch": "^4.0.5",
|
|
120
|
-
"minimatch": "^
|
|
115
|
+
"minimatch": "^9.0.0"
|
|
121
116
|
},
|
|
122
|
-
"gitHead": "
|
|
117
|
+
"gitHead": "a1b7c5daeef5afdb14d6444318f450b9fd9c035a"
|
|
123
118
|
}
|
package/bin.js
DELETED
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
'use strict';
|
|
3
|
-
|
|
4
|
-
const app = require('./dist/cjs/app');
|
|
5
|
-
const program = require('commander');
|
|
6
|
-
|
|
7
|
-
app.run(program, process.argv).catch((e) => {
|
|
8
|
-
if (!(e instanceof program.CommanderError) && !(e instanceof app.CheckFailed)) {
|
|
9
|
-
console.log(e);
|
|
10
|
-
// It is possible an explicit exit code was set, use it if it was.
|
|
11
|
-
process.exitCode = process.exitCode || 1;
|
|
12
|
-
}
|
|
13
|
-
if (e instanceof app.CheckFailed) {
|
|
14
|
-
process.exitCode = e.exitCode;
|
|
15
|
-
}
|
|
16
|
-
});
|
package/dist/cjs/app.d.ts
DELETED
package/dist/cjs/app.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.run = exports.CheckFailed = void 0;
|
|
4
|
-
const commander_1 = require("commander");
|
|
5
|
-
const semver_1 = require("semver");
|
|
6
|
-
const pkgInfo_cjs_1 = require("../lib/pkgInfo.cjs");
|
|
7
|
-
const commandCheck_js_1 = require("./commandCheck.js");
|
|
8
|
-
const commandLink_js_1 = require("./commandLink.js");
|
|
9
|
-
const commandLint_js_1 = require("./commandLint.js");
|
|
10
|
-
const commandSuggestion_js_1 = require("./commandSuggestion.js");
|
|
11
|
-
const commandTrace_js_1 = require("./commandTrace.js");
|
|
12
|
-
const errors_js_1 = require("./util/errors.js");
|
|
13
|
-
var errors_js_2 = require("./util/errors.js");
|
|
14
|
-
Object.defineProperty(exports, "CheckFailed", { enumerable: true, get: function () { return errors_js_2.CheckFailed; } });
|
|
15
|
-
async function run(command, argv) {
|
|
16
|
-
const prog = command || commander_1.program;
|
|
17
|
-
const args = argv || process.argv;
|
|
18
|
-
prog.exitOverride();
|
|
19
|
-
prog.version(pkgInfo_cjs_1.npmPackage.version).description('Spelling Checker for Code').name('cspell');
|
|
20
|
-
if (!(0, semver_1.satisfies)(process.versions.node, pkgInfo_cjs_1.npmPackage.engines.node)) {
|
|
21
|
-
throw new errors_js_1.ApplicationError(`Unsupported NodeJS version (${process.versions.node}); ${pkgInfo_cjs_1.npmPackage.engines.node} is required`);
|
|
22
|
-
}
|
|
23
|
-
const optionFlags = new commander_1.Option('-f,--flag <flag:value>', 'Declare an execution flag value')
|
|
24
|
-
.hideHelp()
|
|
25
|
-
.argParser((value, prev) => prev?.concat(value) || [value]);
|
|
26
|
-
(0, commandLint_js_1.commandLint)(prog).addOption(optionFlags);
|
|
27
|
-
(0, commandTrace_js_1.commandTrace)(prog).addOption(optionFlags);
|
|
28
|
-
(0, commandCheck_js_1.commandCheck)(prog).addOption(optionFlags);
|
|
29
|
-
(0, commandSuggestion_js_1.commandSuggestion)(prog).addOption(optionFlags);
|
|
30
|
-
(0, commandLink_js_1.commandLink)(prog);
|
|
31
|
-
/*
|
|
32
|
-
program
|
|
33
|
-
.command('init')
|
|
34
|
-
.description('(Alpha) Initialize a cspell.json file.')
|
|
35
|
-
.option('-o, --output <cspell.json>', 'define where to write file.')
|
|
36
|
-
.option('--extends <cspell.json>', 'extend an existing cspell.json file.')
|
|
37
|
-
.action((options: InitOptions) => {
|
|
38
|
-
showHelp = false;
|
|
39
|
-
CSpellApplication.createInit(options).then(
|
|
40
|
-
() => process.exit(0),
|
|
41
|
-
() => process.exit(1)
|
|
42
|
-
);
|
|
43
|
-
console.log('Init');
|
|
44
|
-
});
|
|
45
|
-
*/
|
|
46
|
-
prog.exitOverride();
|
|
47
|
-
await prog.parseAsync(args);
|
|
48
|
-
}
|
|
49
|
-
exports.run = run;
|
|
50
|
-
//# sourceMappingURL=app.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import type { CSpellReporter, RunResult } from '@cspell/cspell-types';
|
|
3
|
-
import type { CheckTextInfo, FeatureFlags, TraceResult } from 'cspell-lib';
|
|
4
|
-
import type { TimedSuggestionsForWordResult } from './emitters/suggestionsEmitter.js';
|
|
5
|
-
import type { BaseOptions, LegacyOptions, LinterCliOptions, SuggestionOptions, TraceOptions } from './options.js';
|
|
6
|
-
export type { TraceResult } from 'cspell-lib';
|
|
7
|
-
export { IncludeExcludeFlag } from 'cspell-lib';
|
|
8
|
-
export type AppError = NodeJS.ErrnoException;
|
|
9
|
-
export declare function lint(fileGlobs: string[], options: LinterCliOptions, reporter?: CSpellReporter): Promise<RunResult>;
|
|
10
|
-
export declare function trace(words: string[], options: TraceOptions): AsyncIterableIterator<TraceResult[]>;
|
|
11
|
-
export type CheckTextResult = CheckTextInfo;
|
|
12
|
-
export declare function checkText(filename: string, options: BaseOptions & LegacyOptions): Promise<CheckTextResult>;
|
|
13
|
-
export declare function suggestions(words: string[], options: SuggestionOptions): AsyncIterable<TimedSuggestionsForWordResult>;
|
|
14
|
-
export declare function createInit(): Promise<void>;
|
|
15
|
-
export declare function parseApplicationFeatureFlags(flags: string[] | undefined): FeatureFlags;
|
|
16
|
-
//# sourceMappingURL=application.d.ts.map
|
package/dist/cjs/application.js
DELETED
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
-
if (k2 === undefined) k2 = k;
|
|
4
|
-
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
-
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
-
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
-
}
|
|
8
|
-
Object.defineProperty(o, k2, desc);
|
|
9
|
-
}) : (function(o, m, k, k2) {
|
|
10
|
-
if (k2 === undefined) k2 = k;
|
|
11
|
-
o[k2] = m[k];
|
|
12
|
-
}));
|
|
13
|
-
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
-
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
-
}) : function(o, v) {
|
|
16
|
-
o["default"] = v;
|
|
17
|
-
});
|
|
18
|
-
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
-
if (mod && mod.__esModule) return mod;
|
|
20
|
-
var result = {};
|
|
21
|
-
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
-
__setModuleDefault(result, mod);
|
|
23
|
-
return result;
|
|
24
|
-
};
|
|
25
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.parseApplicationFeatureFlags = exports.createInit = exports.suggestions = exports.checkText = exports.trace = exports.lint = exports.IncludeExcludeFlag = void 0;
|
|
27
|
-
const cspell_pipe_1 = require("@cspell/cspell-pipe");
|
|
28
|
-
const cspell_lib_1 = require("cspell-lib");
|
|
29
|
-
const cli_reporter_js_1 = require("./cli-reporter.js");
|
|
30
|
-
const index_js_1 = require("./featureFlags/index.js");
|
|
31
|
-
const index_js_2 = require("./lint/index.js");
|
|
32
|
-
const options_js_1 = require("./options.js");
|
|
33
|
-
const index_js_3 = require("./repl/index.js");
|
|
34
|
-
const fileHelper_js_1 = require("./util/fileHelper.js");
|
|
35
|
-
const reporters_js_1 = require("./util/reporters.js");
|
|
36
|
-
const stdin_js_1 = require("./util/stdin.js");
|
|
37
|
-
const timer_js_1 = require("./util/timer.js");
|
|
38
|
-
const util = __importStar(require("./util/util.js"));
|
|
39
|
-
var cspell_lib_2 = require("cspell-lib");
|
|
40
|
-
Object.defineProperty(exports, "IncludeExcludeFlag", { enumerable: true, get: function () { return cspell_lib_2.IncludeExcludeFlag; } });
|
|
41
|
-
function lint(fileGlobs, options, reporter) {
|
|
42
|
-
options = (0, options_js_1.fixLegacy)(options);
|
|
43
|
-
const cfg = new index_js_2.LintRequest(fileGlobs, options, (0, reporters_js_1.finalizeReporter)(reporter) ?? (0, cli_reporter_js_1.getReporter)({ ...options, fileGlobs }));
|
|
44
|
-
return (0, index_js_2.runLint)(cfg);
|
|
45
|
-
}
|
|
46
|
-
exports.lint = lint;
|
|
47
|
-
async function* trace(words, options) {
|
|
48
|
-
options = (0, options_js_1.fixLegacy)(options);
|
|
49
|
-
const iWords = options.stdin ? (0, cspell_pipe_1.toAsyncIterable)(words, (0, stdin_js_1.readStdin)()) : words;
|
|
50
|
-
const { languageId, locale, allowCompoundWords, ignoreCase } = options;
|
|
51
|
-
const configFile = await (0, fileHelper_js_1.readConfig)(options.config, undefined);
|
|
52
|
-
const loadDefault = options.defaultConfiguration ?? configFile.config.loadDefaultConfiguration ?? true;
|
|
53
|
-
const config = (0, cspell_lib_1.mergeSettings)((0, cspell_lib_1.getDefaultSettings)(loadDefault), (0, cspell_lib_1.getGlobalSettings)(), configFile.config);
|
|
54
|
-
yield* (0, cspell_lib_1.traceWordsAsync)(iWords, config, util.clean({ languageId, locale, ignoreCase, allowCompoundWords }));
|
|
55
|
-
}
|
|
56
|
-
exports.trace = trace;
|
|
57
|
-
async function checkText(filename, options) {
|
|
58
|
-
options = (0, options_js_1.fixLegacy)(options);
|
|
59
|
-
const fileInfo = await (0, fileHelper_js_1.readFileInfo)(filename);
|
|
60
|
-
const { locale, languageId, validateDirectives } = options;
|
|
61
|
-
const doc = (0, fileHelper_js_1.fileInfoToDocument)(fileInfo, languageId, locale);
|
|
62
|
-
const checkOptions = {
|
|
63
|
-
configFile: options.config,
|
|
64
|
-
validateDirectives,
|
|
65
|
-
};
|
|
66
|
-
const settingsFromCommandLine = util.clean({
|
|
67
|
-
languageId,
|
|
68
|
-
language: locale,
|
|
69
|
-
loadDefaultConfiguration: options.defaultConfiguration,
|
|
70
|
-
});
|
|
71
|
-
return (0, cspell_lib_1.checkTextDocument)(doc, util.clean({ ...checkOptions }), settingsFromCommandLine);
|
|
72
|
-
}
|
|
73
|
-
exports.checkText = checkText;
|
|
74
|
-
async function* suggestions(words, options) {
|
|
75
|
-
options = (0, options_js_1.fixLegacy)(options);
|
|
76
|
-
const configFile = await (0, fileHelper_js_1.readConfig)(options.config, undefined);
|
|
77
|
-
let timer;
|
|
78
|
-
function tapStart() {
|
|
79
|
-
timer = (0, timer_js_1.getTimeMeasurer)();
|
|
80
|
-
}
|
|
81
|
-
function mapStart(v) {
|
|
82
|
-
tapStart();
|
|
83
|
-
return v;
|
|
84
|
-
}
|
|
85
|
-
function mapEnd(v) {
|
|
86
|
-
const elapsedTimeMs = timer?.();
|
|
87
|
-
return elapsedTimeMs ? { ...v, elapsedTimeMs } : v;
|
|
88
|
-
}
|
|
89
|
-
const iWords = options.repl
|
|
90
|
-
? (0, cspell_pipe_1.pipeAsync)((0, cspell_pipe_1.toAsyncIterable)(words, (0, index_js_3.simpleRepl)()), (0, cspell_pipe_1.opTap)(tapStart))
|
|
91
|
-
: options.useStdin
|
|
92
|
-
? (0, cspell_pipe_1.pipeAsync)((0, cspell_pipe_1.toAsyncIterable)(words, (0, stdin_js_1.readStdin)()), (0, cspell_pipe_1.opTap)(tapStart))
|
|
93
|
-
: words.map(mapStart);
|
|
94
|
-
try {
|
|
95
|
-
const results = (0, cspell_pipe_1.pipeAsync)((0, cspell_lib_1.suggestionsForWords)(iWords, util.clean({ ...options }), configFile.config), (0, cspell_pipe_1.opMap)(mapEnd));
|
|
96
|
-
yield* results;
|
|
97
|
-
}
|
|
98
|
-
catch (e) {
|
|
99
|
-
if (!(e instanceof cspell_lib_1.SuggestionError))
|
|
100
|
-
throw e;
|
|
101
|
-
console.error(e.message);
|
|
102
|
-
process.exitCode = 1;
|
|
103
|
-
}
|
|
104
|
-
}
|
|
105
|
-
exports.suggestions = suggestions;
|
|
106
|
-
function createInit() {
|
|
107
|
-
return Promise.reject();
|
|
108
|
-
}
|
|
109
|
-
exports.createInit = createInit;
|
|
110
|
-
function registerApplicationFeatureFlags() {
|
|
111
|
-
const ff = (0, index_js_1.getFeatureFlags)();
|
|
112
|
-
const flags = [{ name: 'timer', description: 'Display elapsed time for command.' }];
|
|
113
|
-
flags.forEach((flag) => ff.register(flag));
|
|
114
|
-
return ff;
|
|
115
|
-
}
|
|
116
|
-
function parseApplicationFeatureFlags(flags) {
|
|
117
|
-
const ff = registerApplicationFeatureFlags();
|
|
118
|
-
return (0, index_js_1.parseFeatureFlags)(flags, ff);
|
|
119
|
-
}
|
|
120
|
-
exports.parseApplicationFeatureFlags = parseApplicationFeatureFlags;
|
|
121
|
-
//# sourceMappingURL=application.js.map
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import type { Issue } from '@cspell/cspell-types';
|
|
2
|
-
import type { LinterCliOptions } from './options.js';
|
|
3
|
-
import type { FinalizedReporter } from './util/reporters.js';
|
|
4
|
-
export interface ReporterIssue extends Issue {
|
|
5
|
-
filename: string;
|
|
6
|
-
}
|
|
7
|
-
export interface ReporterOptions extends Pick<LinterCliOptions, 'debug' | 'issues' | 'legacy' | 'progress' | 'relative' | 'root' | 'showContext' | 'showSuggestions' | 'silent' | 'summary' | 'verbose' | 'wordsOnly'> {
|
|
8
|
-
fileGlobs: string[];
|
|
9
|
-
}
|
|
10
|
-
export declare function getReporter(options: ReporterOptions): FinalizedReporter;
|
|
11
|
-
declare function formatIssue(templateStr: string, issue: ReporterIssue, maxIssueTextWidth: number): string;
|
|
12
|
-
export declare const __testing__: {
|
|
13
|
-
formatIssue: typeof formatIssue;
|
|
14
|
-
};
|
|
15
|
-
export {};
|
|
16
|
-
//# sourceMappingURL=cli-reporter.d.ts.map
|