cspell 6.10.1 → 6.11.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 +1 -1
- package/dist/app.js +7 -4
- package/dist/application.d.ts +2 -1
- package/dist/application.js +13 -1
- package/dist/commandCheck.js +1 -0
- package/dist/commandLint.js +1 -0
- package/dist/commandSuggestion.js +1 -0
- package/dist/commandTrace.js +1 -0
- package/dist/featureFlags/featureFlags.d.ts +4 -0
- package/dist/featureFlags/featureFlags.js +25 -0
- package/dist/featureFlags/index.d.ts +2 -0
- package/dist/featureFlags/index.js +7 -0
- package/dist/lint/lint.js +6 -0
- package/dist/options.d.ts +6 -0
- package/package.json +10 -10
package/dist/app.d.ts
CHANGED
package/dist/app.js
CHANGED
|
@@ -21,11 +21,14 @@ async function run(command, argv) {
|
|
|
21
21
|
if (!(0, semver_1.satisfies)(process.versions.node, npmPackage.engines.node)) {
|
|
22
22
|
throw new errors_1.ApplicationError(`Unsupported NodeJS version (${process.versions.node}); ${npmPackage.engines.node} is required`);
|
|
23
23
|
}
|
|
24
|
-
(
|
|
25
|
-
|
|
26
|
-
|
|
24
|
+
const optionFlags = new commander_1.Option('-f,--flag <flag:value>', 'Declare an execution flag value')
|
|
25
|
+
.hideHelp()
|
|
26
|
+
.argParser((value, prev) => prev?.concat(value) || [value]);
|
|
27
|
+
(0, commandLint_1.commandLint)(prog).addOption(optionFlags);
|
|
28
|
+
(0, commandTrace_1.commandTrace)(prog).addOption(optionFlags);
|
|
29
|
+
(0, commandCheck_1.commandCheck)(prog).addOption(optionFlags);
|
|
30
|
+
(0, commandSuggestion_1.commandSuggestion)(prog).addOption(optionFlags);
|
|
27
31
|
(0, commandLink_1.commandLink)(prog);
|
|
28
|
-
(0, commandSuggestion_1.commandSuggestion)(prog);
|
|
29
32
|
/*
|
|
30
33
|
program
|
|
31
34
|
.command('init')
|
package/dist/application.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/// <reference types="node" />
|
|
2
2
|
import type { CSpellReporter, RunResult } from '@cspell/cspell-types';
|
|
3
|
-
import { CheckTextInfo, TraceResult } from 'cspell-lib';
|
|
3
|
+
import { CheckTextInfo, FeatureFlags, TraceResult } from 'cspell-lib';
|
|
4
4
|
import { TimedSuggestionsForWordResult } from './emitters/suggestionsEmitter';
|
|
5
5
|
import { BaseOptions, LegacyOptions, LinterCliOptions, SuggestionOptions, TraceOptions } from './options';
|
|
6
6
|
export { IncludeExcludeFlag } from 'cspell-lib';
|
|
@@ -12,4 +12,5 @@ export declare type CheckTextResult = CheckTextInfo;
|
|
|
12
12
|
export declare function checkText(filename: string, options: BaseOptions & LegacyOptions): Promise<CheckTextResult>;
|
|
13
13
|
export declare function suggestions(words: string[], options: SuggestionOptions): AsyncIterable<TimedSuggestionsForWordResult>;
|
|
14
14
|
export declare function createInit(): Promise<void>;
|
|
15
|
+
export declare function parseApplicationFeatureFlags(flags: string[] | undefined): FeatureFlags;
|
|
15
16
|
//# sourceMappingURL=application.d.ts.map
|
package/dist/application.js
CHANGED
|
@@ -23,10 +23,11 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.createInit = exports.suggestions = exports.checkText = exports.trace = exports.lint = exports.IncludeExcludeFlag = void 0;
|
|
26
|
+
exports.parseApplicationFeatureFlags = exports.createInit = exports.suggestions = exports.checkText = exports.trace = exports.lint = exports.IncludeExcludeFlag = void 0;
|
|
27
27
|
const cspell_pipe_1 = require("@cspell/cspell-pipe");
|
|
28
28
|
const cspell_lib_1 = require("cspell-lib");
|
|
29
29
|
const cli_reporter_1 = require("./cli-reporter");
|
|
30
|
+
const featureFlags_1 = require("./featureFlags");
|
|
30
31
|
const lint_1 = require("./lint");
|
|
31
32
|
const options_1 = require("./options");
|
|
32
33
|
const repl_1 = require("./repl");
|
|
@@ -105,4 +106,15 @@ function createInit() {
|
|
|
105
106
|
return Promise.reject();
|
|
106
107
|
}
|
|
107
108
|
exports.createInit = createInit;
|
|
109
|
+
function registerApplicationFeatureFlags() {
|
|
110
|
+
const ff = (0, featureFlags_1.getFeatureFlags)();
|
|
111
|
+
const flags = [{ name: 'timer', description: 'Display elapsed time for command.' }];
|
|
112
|
+
flags.forEach((flag) => ff.register(flag));
|
|
113
|
+
return ff;
|
|
114
|
+
}
|
|
115
|
+
function parseApplicationFeatureFlags(flags) {
|
|
116
|
+
const ff = registerApplicationFeatureFlags();
|
|
117
|
+
return (0, featureFlags_1.parseFeatureFlags)(flags, ff);
|
|
118
|
+
}
|
|
119
|
+
exports.parseApplicationFeatureFlags = parseApplicationFeatureFlags;
|
|
108
120
|
//# sourceMappingURL=application.js.map
|
package/dist/commandCheck.js
CHANGED
|
@@ -41,6 +41,7 @@ function commandCheck(prog) {
|
|
|
41
41
|
.addOption(new commander_1.Option('--default-configuration', 'Load the default configuration and dictionaries.').hideHelp())
|
|
42
42
|
.addOption(new commander_1.Option('--no-default-configuration', 'Do not load the default configuration and dictionaries.'))
|
|
43
43
|
.action(async (files, options) => {
|
|
44
|
+
App.parseApplicationFeatureFlags(options.flag);
|
|
44
45
|
let issueCount = 0;
|
|
45
46
|
for (const filename of files) {
|
|
46
47
|
console.log(chalk.yellowBright(`Check file: ${filename}`));
|
package/dist/commandLint.js
CHANGED
|
@@ -100,6 +100,7 @@ function commandLint(prog) {
|
|
|
100
100
|
.addHelpText('after', usage)
|
|
101
101
|
.arguments('[globs...]')
|
|
102
102
|
.action((fileGlobs, options) => {
|
|
103
|
+
App.parseApplicationFeatureFlags(options.flag);
|
|
103
104
|
const { mustFindFiles, fileList } = options;
|
|
104
105
|
return App.lint(fileGlobs, options).then((result) => {
|
|
105
106
|
if (!fileGlobs.length && !result.files && !result.errors && !fileList) {
|
|
@@ -64,6 +64,7 @@ function commandSuggestion(prog) {
|
|
|
64
64
|
.option('--color', 'Force color')
|
|
65
65
|
.arguments('[words...]')
|
|
66
66
|
.action(async (words, options) => {
|
|
67
|
+
App.parseApplicationFeatureFlags(options.flag);
|
|
67
68
|
options.useStdin = options.stdin;
|
|
68
69
|
options.dictionaries = mergeArrays(options.dictionaries, options.dictionary);
|
|
69
70
|
if (!words.length && !options.useStdin && !options.repl) {
|
package/dist/commandTrace.js
CHANGED
|
@@ -47,6 +47,7 @@ function commandTrace(prog) {
|
|
|
47
47
|
.addOption(new commander_1.Option('--no-default-configuration', 'Do not load the default configuration and dictionaries.'))
|
|
48
48
|
.arguments('[words...]')
|
|
49
49
|
.action(async (words, options) => {
|
|
50
|
+
App.parseApplicationFeatureFlags(options.flag);
|
|
50
51
|
let numFound = 0;
|
|
51
52
|
for await (const results of App.trace(words, options)) {
|
|
52
53
|
(0, traceEmitter_1.emitTraceResults)(results, { cwd: process.cwd() });
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseFeatureFlags = exports.getFeatureFlags = void 0;
|
|
4
|
+
const cspell_lib_1 = require("cspell-lib");
|
|
5
|
+
function getFeatureFlags() {
|
|
6
|
+
return (0, cspell_lib_1.getSystemFeatureFlags)();
|
|
7
|
+
}
|
|
8
|
+
exports.getFeatureFlags = getFeatureFlags;
|
|
9
|
+
function parseFeatureFlags(flags, featureFlags = getFeatureFlags()) {
|
|
10
|
+
if (!flags)
|
|
11
|
+
return featureFlags;
|
|
12
|
+
const flagsKvP = flags.map((f) => f.split(':', 2));
|
|
13
|
+
for (const flag of flagsKvP) {
|
|
14
|
+
const [name, value] = flag;
|
|
15
|
+
try {
|
|
16
|
+
featureFlags.setFlag(name, value);
|
|
17
|
+
}
|
|
18
|
+
catch (e) {
|
|
19
|
+
console.warn(`Unknown flag: "${name}"`);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
return featureFlags;
|
|
23
|
+
}
|
|
24
|
+
exports.parseFeatureFlags = parseFeatureFlags;
|
|
25
|
+
//# sourceMappingURL=featureFlags.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.parseFeatureFlags = exports.getFeatureFlags = void 0;
|
|
4
|
+
var featureFlags_1 = require("./featureFlags");
|
|
5
|
+
Object.defineProperty(exports, "getFeatureFlags", { enumerable: true, get: function () { return featureFlags_1.getFeatureFlags; } });
|
|
6
|
+
Object.defineProperty(exports, "parseFeatureFlags", { enumerable: true, get: function () { return featureFlags_1.parseFeatureFlags; } });
|
|
7
|
+
//# sourceMappingURL=index.js.map
|
package/dist/lint/lint.js
CHANGED
|
@@ -40,6 +40,7 @@ const reporters_1 = require("../util/reporters");
|
|
|
40
40
|
const timer_1 = require("../util/timer");
|
|
41
41
|
const util = __importStar(require("../util/util"));
|
|
42
42
|
const chalk = require("chalk");
|
|
43
|
+
const featureFlags_1 = require("../featureFlags");
|
|
43
44
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
44
45
|
const npmPackage = require('../../package.json');
|
|
45
46
|
const version = npmPackage.version;
|
|
@@ -48,8 +49,13 @@ async function runLint(cfg) {
|
|
|
48
49
|
let { reporter } = cfg;
|
|
49
50
|
cspell.setLogger(getLoggerFromReporter(reporter));
|
|
50
51
|
const configErrors = new Set();
|
|
52
|
+
const timer = (0, timer_1.getTimeMeasurer)();
|
|
51
53
|
const lintResult = await run();
|
|
52
54
|
await reporter.result(lintResult);
|
|
55
|
+
const elapsed = timer();
|
|
56
|
+
if ((0, featureFlags_1.getFeatureFlags)().getFlag('timer')) {
|
|
57
|
+
console.log(`Elapsed Time: ${elapsed.toFixed(2)}ms`);
|
|
58
|
+
}
|
|
53
59
|
return lintResult;
|
|
54
60
|
async function processFile(filename, configInfo, cache) {
|
|
55
61
|
const getElapsedTimeMs = (0, timer_1.getTimeMeasurer)();
|
package/dist/options.d.ts
CHANGED
|
@@ -128,6 +128,12 @@ export interface BaseOptions {
|
|
|
128
128
|
* Check In-Document CSpell directives for correctness.
|
|
129
129
|
*/
|
|
130
130
|
validateDirectives?: boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Execution flags.
|
|
133
|
+
* Used primarily for releasing experimental features.
|
|
134
|
+
* Flags are of the form key:value
|
|
135
|
+
*/
|
|
136
|
+
flag?: string[];
|
|
131
137
|
}
|
|
132
138
|
export interface LinterCliOptions extends LinterOptions {
|
|
133
139
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell",
|
|
3
|
-
"version": "6.
|
|
3
|
+
"version": "6.11.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",
|
|
@@ -70,12 +70,12 @@
|
|
|
70
70
|
},
|
|
71
71
|
"homepage": "https://streetsidesoftware.github.io/cspell/",
|
|
72
72
|
"dependencies": {
|
|
73
|
-
"@cspell/cspell-pipe": "^6.
|
|
73
|
+
"@cspell/cspell-pipe": "^6.11.1",
|
|
74
74
|
"chalk": "^4.1.2",
|
|
75
75
|
"commander": "^9.4.0",
|
|
76
|
-
"cspell-gitignore": "^6.
|
|
77
|
-
"cspell-glob": "^6.
|
|
78
|
-
"cspell-lib": "^6.
|
|
76
|
+
"cspell-gitignore": "^6.11.1",
|
|
77
|
+
"cspell-glob": "^6.11.1",
|
|
78
|
+
"cspell-lib": "^6.11.1",
|
|
79
79
|
"fast-json-stable-stringify": "^2.1.0",
|
|
80
80
|
"file-entry-cache": "^6.0.1",
|
|
81
81
|
"fs-extra": "^10.1.0",
|
|
@@ -90,8 +90,8 @@
|
|
|
90
90
|
"node": ">=14"
|
|
91
91
|
},
|
|
92
92
|
"devDependencies": {
|
|
93
|
-
"@cspell/cspell-json-reporter": "^6.
|
|
94
|
-
"@cspell/cspell-types": "^6.
|
|
93
|
+
"@cspell/cspell-json-reporter": "^6.11.1",
|
|
94
|
+
"@cspell/cspell-types": "^6.11.1",
|
|
95
95
|
"@types/file-entry-cache": "^5.0.2",
|
|
96
96
|
"@types/fs-extra": "^9.0.13",
|
|
97
97
|
"@types/glob": "^8.0.0",
|
|
@@ -99,12 +99,12 @@
|
|
|
99
99
|
"@types/micromatch": "^4.0.2",
|
|
100
100
|
"@types/minimatch": "^5.1.2",
|
|
101
101
|
"@types/semver": "^7.3.12",
|
|
102
|
-
"jest": "^29.
|
|
102
|
+
"jest": "^29.1.1",
|
|
103
103
|
"micromatch": "^4.0.5",
|
|
104
104
|
"minimatch": "^5.1.0",
|
|
105
105
|
"rimraf": "^3.0.2",
|
|
106
|
-
"rollup": "^2.79.
|
|
106
|
+
"rollup": "^2.79.1",
|
|
107
107
|
"rollup-plugin-dts": "^4.2.2"
|
|
108
108
|
},
|
|
109
|
-
"gitHead": "
|
|
109
|
+
"gitHead": "1a4559d3a82de15c7442ec15dbb3b7db99fb355e"
|
|
110
110
|
}
|