cspell-lib 6.7.0 → 6.8.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/dist/LanguageIds.js +2 -0
- package/dist/Settings/CSpellSettingsServer.d.ts +0 -4
- package/dist/Settings/CSpellSettingsServer.js +6 -9
- package/dist/Settings/Controller/configLoader/configLoader.d.ts +137 -0
- package/dist/Settings/Controller/configLoader/configLoader.js +489 -0
- package/dist/Settings/Controller/configLoader/extractImportErrors.d.ts +7 -0
- package/dist/Settings/Controller/configLoader/extractImportErrors.js +26 -0
- package/dist/Settings/Controller/configLoader/index.d.ts +4 -0
- package/dist/Settings/Controller/configLoader/index.js +26 -0
- package/dist/Settings/Controller/configLoader/normalizeRawSettings.d.ts +50 -0
- package/dist/Settings/Controller/configLoader/normalizeRawSettings.js +136 -0
- package/dist/Settings/Controller/configLoader/readSettings.d.ts +23 -0
- package/dist/Settings/Controller/configLoader/readSettings.js +12 -0
- package/dist/Settings/Controller/configLoader/toGlobDef.d.ts +6 -0
- package/dist/Settings/Controller/configLoader/toGlobDef.js +23 -0
- package/dist/Settings/InDocSettings.d.ts +16 -0
- package/dist/Settings/InDocSettings.js +132 -15
- package/dist/Settings/RegExpPatterns.js +1 -1
- package/dist/Settings/constants.d.ts +5 -0
- package/dist/Settings/constants.js +8 -0
- package/dist/Settings/index.d.ts +2 -1
- package/dist/Settings/index.js +4 -3
- package/dist/SpellingDictionary/SpellingDictionary.d.ts +13 -0
- package/dist/SpellingDictionary/createSpellingDictionary.js +2 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +3 -1
- package/dist/spellCheckFile.d.ts +3 -0
- package/dist/spellCheckFile.js +14 -3
- package/dist/textValidation/ValidationTypes.d.ts +2 -2
- package/dist/textValidation/checkText.d.ts +47 -0
- package/dist/textValidation/checkText.js +152 -0
- package/dist/textValidation/docValidator.d.ts +16 -1
- package/dist/textValidation/docValidator.js +43 -1
- package/dist/textValidation/index.d.ts +6 -4
- package/dist/textValidation/index.js +7 -5
- package/dist/textValidation/validator.d.ts +11 -19
- package/dist/textValidation/validator.js +25 -69
- package/dist/util/errors.js +0 -1
- package/dist/util/util.d.ts +1 -1
- package/dist/validator.d.ts +1 -1
- package/dist/validator.js +2 -1
- package/package.json +19 -19
- package/dist/Settings/Controller/configLoader.d.ts +0 -84
- package/dist/Settings/Controller/configLoader.js +0 -564
package/dist/LanguageIds.js
CHANGED
|
@@ -16,6 +16,8 @@ exports.languageExtensionDefinitions = [
|
|
|
16
16
|
{ id: 'clojure', extensions: ['.clj', '.cljs', '.cljx', '.clojure', '.edn'] },
|
|
17
17
|
{ id: 'coffeescript', extensions: ['.coffee', '.cson'] },
|
|
18
18
|
{ id: 'c', extensions: ['.c'] },
|
|
19
|
+
// cspell:ignore cmake
|
|
20
|
+
{ id: 'cmake', extensions: ['.cmake'], filenames: ['CMakeLists.txt'] },
|
|
19
21
|
{
|
|
20
22
|
id: 'cpp',
|
|
21
23
|
extensions: ['.cpp', '.cc', '.cxx', '.hpp', '.hh', '.hxx', '.h', '.mm', '.ino', '.inl'],
|
|
@@ -4,10 +4,6 @@ import { OptionalOrUndefined } from '../util/types';
|
|
|
4
4
|
declare type CSpellSettingsWST = AdvancedCSpellSettingsWithSourceTrace;
|
|
5
5
|
declare type CSpellSettingsWSTO = OptionalOrUndefined<AdvancedCSpellSettingsWithSourceTrace>;
|
|
6
6
|
declare type CSpellSettingsI = CSpellSettingsInternal;
|
|
7
|
-
export declare const configSettingsFileVersion0_1 = "0.1";
|
|
8
|
-
export declare const configSettingsFileVersion0_2 = "0.2";
|
|
9
|
-
export declare const currentSettingsFileVersion = "0.2";
|
|
10
|
-
export declare const ENV_CSPELL_GLOB_ROOT = "CSPELL_GLOB_ROOT";
|
|
11
7
|
declare function mergeObjects(left: undefined, right: undefined): undefined;
|
|
12
8
|
declare function mergeObjects<T>(left: T, right: undefined): T;
|
|
13
9
|
declare function mergeObjects<T>(left: T, right: T): T;
|
|
@@ -26,18 +26,15 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
26
26
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
27
27
|
};
|
|
28
28
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
29
|
-
exports.__testing__ = exports.extractDependencies = exports.getSources = exports.checkFilenameMatchesGlob = exports.toInternalSettings = exports.finalizeSettings = exports.calcOverrideSettings = exports.mergeInDocSettings = exports.mergeSettings =
|
|
29
|
+
exports.__testing__ = exports.extractDependencies = exports.getSources = exports.checkFilenameMatchesGlob = exports.toInternalSettings = exports.finalizeSettings = exports.calcOverrideSettings = exports.mergeInDocSettings = exports.mergeSettings = void 0;
|
|
30
30
|
const assert_1 = __importDefault(require("assert"));
|
|
31
31
|
const cspell_glob_1 = require("cspell-glob");
|
|
32
32
|
const path = __importStar(require("path"));
|
|
33
33
|
const CSpellSettingsInternalDef_1 = require("../Models/CSpellSettingsInternalDef");
|
|
34
34
|
const util = __importStar(require("../util/util"));
|
|
35
|
+
const constants_1 = require("./constants");
|
|
35
36
|
const DictionarySettings_1 = require("./DictionarySettings");
|
|
36
37
|
const patterns_1 = require("./patterns");
|
|
37
|
-
exports.configSettingsFileVersion0_1 = '0.1';
|
|
38
|
-
exports.configSettingsFileVersion0_2 = '0.2';
|
|
39
|
-
exports.currentSettingsFileVersion = exports.configSettingsFileVersion0_2;
|
|
40
|
-
exports.ENV_CSPELL_GLOB_ROOT = 'CSPELL_GLOB_ROOT';
|
|
41
38
|
function _unique(a) {
|
|
42
39
|
return [...new Set(a)];
|
|
43
40
|
}
|
|
@@ -157,7 +154,7 @@ function merge(left, right) {
|
|
|
157
154
|
return settings;
|
|
158
155
|
}
|
|
159
156
|
function versionBasedMergeList(left, right, version) {
|
|
160
|
-
if (version ===
|
|
157
|
+
if (version === constants_1.configSettingsFileVersion0_1) {
|
|
161
158
|
return takeRightOtherwiseLeft(left, right);
|
|
162
159
|
}
|
|
163
160
|
return mergeListUnique(left, right);
|
|
@@ -269,9 +266,9 @@ function mergeSources(left, right) {
|
|
|
269
266
|
};
|
|
270
267
|
}
|
|
271
268
|
function max(a, b) {
|
|
272
|
-
if (a === undefined)
|
|
269
|
+
if (a === undefined || a === null)
|
|
273
270
|
return b;
|
|
274
|
-
if (b === undefined)
|
|
271
|
+
if (b === undefined || b === null)
|
|
275
272
|
return a;
|
|
276
273
|
return a > b ? a : b;
|
|
277
274
|
}
|
|
@@ -321,7 +318,7 @@ function extractDependencies(settings) {
|
|
|
321
318
|
}
|
|
322
319
|
exports.extractDependencies = extractDependencies;
|
|
323
320
|
function resolveCwd() {
|
|
324
|
-
const envGlobRoot = process.env[
|
|
321
|
+
const envGlobRoot = process.env[constants_1.ENV_CSPELL_GLOB_ROOT];
|
|
325
322
|
const cwd = envGlobRoot || process.cwd();
|
|
326
323
|
return cwd;
|
|
327
324
|
}
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import type { CSpellSettingsWithSourceTrace, CSpellUserSettings, ImportFileRef, PnPSettings as PnPSettingsStrict } from '@cspell/cspell-types';
|
|
2
|
+
import { CSpellIO } from 'cspell-io';
|
|
3
|
+
import { URI } from 'vscode-uri';
|
|
4
|
+
import { CSpellSettingsInternal } from '../../../Models/CSpellSettingsInternalDef';
|
|
5
|
+
import { OptionalOrUndefined } from '../../../util/types';
|
|
6
|
+
import { LoaderResult } from '../pnpLoader';
|
|
7
|
+
import { normalizeCacheSettings } from './normalizeRawSettings';
|
|
8
|
+
export declare type CSpellSettingsWST = CSpellSettingsWithSourceTrace;
|
|
9
|
+
export declare type CSpellSettingsI = CSpellSettingsInternal;
|
|
10
|
+
declare type PnPSettings = OptionalOrUndefined<PnPSettingsStrict>;
|
|
11
|
+
export declare const sectionCSpell = "cSpell";
|
|
12
|
+
export declare const defaultFileName = "cspell.json";
|
|
13
|
+
export declare const defaultConfigFilenames: readonly string[];
|
|
14
|
+
export declare class ConfigLoader {
|
|
15
|
+
readonly cspellIO: CSpellIO;
|
|
16
|
+
/**
|
|
17
|
+
* Use `createConfigLoader`
|
|
18
|
+
* @param cspellIO - CSpellIO interface for reading files.
|
|
19
|
+
*/
|
|
20
|
+
protected constructor(cspellIO: CSpellIO);
|
|
21
|
+
protected cachedFiles: Map<string, CSpellSettingsInternal>;
|
|
22
|
+
protected cspellConfigExplorer: {
|
|
23
|
+
readonly search: (searchFrom?: string | undefined) => Promise<import("cosmiconfig/dist/types").CosmiconfigResult>;
|
|
24
|
+
readonly load: (filepath: string) => Promise<import("cosmiconfig/dist/types").CosmiconfigResult>;
|
|
25
|
+
readonly clearLoadCache: () => void;
|
|
26
|
+
readonly clearSearchCache: () => void;
|
|
27
|
+
readonly clearCaches: () => void;
|
|
28
|
+
};
|
|
29
|
+
protected cspellConfigExplorerSync: {
|
|
30
|
+
readonly search: (searchFrom?: string | undefined) => import("cosmiconfig/dist/types").CosmiconfigResult;
|
|
31
|
+
readonly load: (filepath: string) => import("cosmiconfig/dist/types").CosmiconfigResult;
|
|
32
|
+
readonly clearLoadCache: () => void;
|
|
33
|
+
readonly clearSearchCache: () => void;
|
|
34
|
+
readonly clearCaches: () => void;
|
|
35
|
+
};
|
|
36
|
+
protected globalSettings: CSpellSettingsI | undefined;
|
|
37
|
+
/**
|
|
38
|
+
* Read / import a cspell configuration file.
|
|
39
|
+
* @param filename - the path to the file.
|
|
40
|
+
* Supported types: json, yaml, js, and cjs. ES Modules are not supported.
|
|
41
|
+
* - absolute path `/absolute/path/to/file`
|
|
42
|
+
* - relative path `./path/to/file` (relative to the current working directory)
|
|
43
|
+
* - package `@cspell/dict-typescript/cspell-ext.json`
|
|
44
|
+
*/
|
|
45
|
+
readSettings(filename: string): CSpellSettingsI;
|
|
46
|
+
readSettings(filename: string, defaultValues: CSpellSettingsWST): CSpellSettingsI;
|
|
47
|
+
/**
|
|
48
|
+
* Read / import a cspell configuration file.
|
|
49
|
+
* @param filename - the path to the file.
|
|
50
|
+
* Supported types: json, yaml, js, and cjs. ES Modules are not supported.
|
|
51
|
+
* - absolute path `/absolute/path/to/file`
|
|
52
|
+
* - relative path `./path/to/file` (relative to `relativeTo`)
|
|
53
|
+
* - package `@cspell/dict-typescript/cspell-ext.json` searches for node_modules relative to `relativeTo`
|
|
54
|
+
* @param relativeTo - absolute path to start searching for relative files or node_modules.
|
|
55
|
+
*/
|
|
56
|
+
readSettings(filename: string, relativeTo?: string): CSpellSettingsI;
|
|
57
|
+
readSettings(filename: string, relativeTo: string, defaultValues: CSpellSettingsWST): CSpellSettingsI;
|
|
58
|
+
readSettings(filename: string, relativeToOrDefault?: CSpellSettingsWST | string): CSpellSettingsI;
|
|
59
|
+
getGlobalSettings(): CSpellSettingsI;
|
|
60
|
+
clearCachedSettingsFiles(): void;
|
|
61
|
+
/**
|
|
62
|
+
* Read a config file and inject the fileRef.
|
|
63
|
+
* @param fileRef - filename plus context, injected into the resulting config.
|
|
64
|
+
*/
|
|
65
|
+
protected readConfig(fileRef: ImportFileRef): CSpellSettingsWST;
|
|
66
|
+
protected importSettings(fileRef: ImportFileRef, defaultValues: CSpellSettingsWST | undefined, pnpSettings: PnPSettings): CSpellSettingsI;
|
|
67
|
+
/**
|
|
68
|
+
* normalizeSettings handles correcting all relative paths, anchoring globs, and importing other config files.
|
|
69
|
+
* @param rawSettings - raw configuration settings
|
|
70
|
+
* @param pathToSettingsFile - path to the source file of the configuration settings.
|
|
71
|
+
*/
|
|
72
|
+
protected normalizeSettings(rawSettings: CSpellSettingsWST, pathToSettingsFile: string, pnpSettings: PnPSettings): CSpellSettingsI;
|
|
73
|
+
}
|
|
74
|
+
declare class ConfigLoaderInternal extends ConfigLoader {
|
|
75
|
+
constructor(cspellIO: CSpellIO);
|
|
76
|
+
get _cachedFiles(): Map<string, CSpellSettingsInternal>;
|
|
77
|
+
get _cspellConfigExplorer(): {
|
|
78
|
+
readonly search: (searchFrom?: string | undefined) => Promise<import("cosmiconfig/dist/types").CosmiconfigResult>;
|
|
79
|
+
readonly load: (filepath: string) => Promise<import("cosmiconfig/dist/types").CosmiconfigResult>;
|
|
80
|
+
readonly clearLoadCache: () => void;
|
|
81
|
+
readonly clearSearchCache: () => void;
|
|
82
|
+
readonly clearCaches: () => void;
|
|
83
|
+
};
|
|
84
|
+
get _cspellConfigExplorerSync(): {
|
|
85
|
+
readonly search: (searchFrom?: string | undefined) => import("cosmiconfig/dist/types").CosmiconfigResult;
|
|
86
|
+
readonly load: (filepath: string) => import("cosmiconfig/dist/types").CosmiconfigResult;
|
|
87
|
+
readonly clearLoadCache: () => void;
|
|
88
|
+
readonly clearSearchCache: () => void;
|
|
89
|
+
readonly clearCaches: () => void;
|
|
90
|
+
};
|
|
91
|
+
readonly _readConfig: (fileRef: ImportFileRef) => CSpellSettingsWithSourceTrace;
|
|
92
|
+
readonly _normalizeSettings: (rawSettings: CSpellSettingsWithSourceTrace, pathToSettingsFile: string, pnpSettings: OptionalOrUndefined<PnPSettingsStrict>) => CSpellSettingsInternal;
|
|
93
|
+
}
|
|
94
|
+
export declare function searchForConfig(searchFrom: string | undefined, pnpSettings?: PnPSettings): Promise<CSpellSettingsI | undefined>;
|
|
95
|
+
export declare function searchForConfigSync(searchFrom: string | undefined, pnpSettings?: PnPSettings): CSpellSettingsI | undefined;
|
|
96
|
+
/**
|
|
97
|
+
* Load a CSpell configuration files.
|
|
98
|
+
* @param file - path or package reference to load.
|
|
99
|
+
* @param pnpSettings - PnP settings
|
|
100
|
+
* @returns normalized CSpellSettings
|
|
101
|
+
*/
|
|
102
|
+
export declare function loadConfig(file: string, pnpSettings?: PnPSettings): Promise<CSpellSettingsI>;
|
|
103
|
+
/**
|
|
104
|
+
* Load a CSpell configuration files.
|
|
105
|
+
* @param filename - path or package reference to load.
|
|
106
|
+
* @param pnpSettings - PnP settings
|
|
107
|
+
* @returns normalized CSpellSettings
|
|
108
|
+
*/
|
|
109
|
+
export declare function loadConfigSync(filename: string, pnpSettings?: PnPSettings): CSpellSettingsI;
|
|
110
|
+
export declare function loadPnP(pnpSettings: PnPSettings, searchFrom: URI): Promise<LoaderResult>;
|
|
111
|
+
export declare function loadPnPSync(pnpSettings: PnPSettings, searchFrom: URI): LoaderResult;
|
|
112
|
+
export declare function readRawSettings(filename: string, relativeTo?: string): CSpellSettingsWST;
|
|
113
|
+
/**
|
|
114
|
+
*
|
|
115
|
+
* @param filenames - settings files to read
|
|
116
|
+
* @returns combined configuration
|
|
117
|
+
* @deprecated true
|
|
118
|
+
*/
|
|
119
|
+
export declare function readSettingsFiles(filenames: string[]): CSpellSettingsI;
|
|
120
|
+
export declare function getGlobalSettings(): CSpellSettingsI;
|
|
121
|
+
export declare function getCachedFileSize(): number;
|
|
122
|
+
export declare function clearCachedSettingsFiles(): void;
|
|
123
|
+
declare function validateRawConfigVersion(config: CSpellUserSettings | {
|
|
124
|
+
version: unknown;
|
|
125
|
+
}, fileRef: ImportFileRef): void;
|
|
126
|
+
declare function validateRawConfigExports(config: CSpellUserSettings, fileRef: ImportFileRef): void;
|
|
127
|
+
export declare function createConfigLoader(cspellIO?: CSpellIO): ConfigLoader;
|
|
128
|
+
declare function getDefaultConfigLoaderInternal(): ConfigLoaderInternal;
|
|
129
|
+
export declare function getDefaultConfigLoader(): ConfigLoader;
|
|
130
|
+
export declare const __testing__: {
|
|
131
|
+
getDefaultConfigLoaderInternal: typeof getDefaultConfigLoaderInternal;
|
|
132
|
+
normalizeCacheSettings: typeof normalizeCacheSettings;
|
|
133
|
+
validateRawConfigExports: typeof validateRawConfigExports;
|
|
134
|
+
validateRawConfigVersion: typeof validateRawConfigVersion;
|
|
135
|
+
};
|
|
136
|
+
export {};
|
|
137
|
+
//# sourceMappingURL=configLoader.d.ts.map
|