cspell-lib 6.8.1 → 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 +4 -7
- 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.js +8 -8
- 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/util/errors.js +0 -1
- package/package.json +16 -16
- package/dist/Settings/Controller/configLoader.d.ts +0 -84
- package/dist/Settings/Controller/configLoader.js +0 -564
|
@@ -0,0 +1,136 @@
|
|
|
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.normalizeCacheSettings = exports.normalizeSettingsGlobs = exports.normalizeGitignoreRoot = exports.normalizeLanguageSettings = exports.normalizeReporters = exports.normalizeOverrides = exports.normalizeDictionaryDefs = exports.normalizeRawConfig = void 0;
|
|
27
|
+
const path = __importStar(require("path"));
|
|
28
|
+
const resolveFile_1 = require("../../../util/resolveFile");
|
|
29
|
+
const util = __importStar(require("../../../util/util"));
|
|
30
|
+
const DictionarySettings_1 = require("../../DictionarySettings");
|
|
31
|
+
const toGlobDef_1 = require("./toGlobDef");
|
|
32
|
+
function normalizeRawConfig(config) {
|
|
33
|
+
if (typeof config.version === 'number') {
|
|
34
|
+
config.version = config.version.toString();
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
exports.normalizeRawConfig = normalizeRawConfig;
|
|
38
|
+
function normalizeDictionaryDefs(settings, pathToSettingsFile) {
|
|
39
|
+
const dictionaryDefinitions = (0, DictionarySettings_1.mapDictDefsToInternal)(settings.dictionaryDefinitions, pathToSettingsFile);
|
|
40
|
+
const languageSettings = settings.languageSettings?.map((langSetting) => util.clean({
|
|
41
|
+
...langSetting,
|
|
42
|
+
dictionaryDefinitions: (0, DictionarySettings_1.mapDictDefsToInternal)(langSetting.dictionaryDefinitions, pathToSettingsFile),
|
|
43
|
+
}));
|
|
44
|
+
return util.clean({
|
|
45
|
+
dictionaryDefinitions,
|
|
46
|
+
languageSettings,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
exports.normalizeDictionaryDefs = normalizeDictionaryDefs;
|
|
50
|
+
function normalizeOverrides(settings, pathToSettingsFile) {
|
|
51
|
+
const { globRoot = path.dirname(pathToSettingsFile) } = settings;
|
|
52
|
+
const overrides = settings.overrides?.map((override) => {
|
|
53
|
+
const filename = (0, toGlobDef_1.toGlobDef)(override.filename, globRoot, pathToSettingsFile);
|
|
54
|
+
const { dictionaryDefinitions, languageSettings } = normalizeDictionaryDefs(override, pathToSettingsFile);
|
|
55
|
+
return util.clean({
|
|
56
|
+
...override,
|
|
57
|
+
filename,
|
|
58
|
+
dictionaryDefinitions,
|
|
59
|
+
languageSettings: normalizeLanguageSettings(languageSettings),
|
|
60
|
+
});
|
|
61
|
+
});
|
|
62
|
+
return overrides ? { overrides } : {};
|
|
63
|
+
}
|
|
64
|
+
exports.normalizeOverrides = normalizeOverrides;
|
|
65
|
+
function normalizeReporters(settings, pathToSettingsFile) {
|
|
66
|
+
if (settings.reporters === undefined)
|
|
67
|
+
return {};
|
|
68
|
+
const folder = path.dirname(pathToSettingsFile);
|
|
69
|
+
function resolve(s) {
|
|
70
|
+
const r = (0, resolveFile_1.resolveFile)(s, folder);
|
|
71
|
+
if (!r.found) {
|
|
72
|
+
throw new Error(`Not found: "${s}"`);
|
|
73
|
+
}
|
|
74
|
+
return r.filename;
|
|
75
|
+
}
|
|
76
|
+
function resolveReporter(s) {
|
|
77
|
+
if (typeof s === 'string') {
|
|
78
|
+
return resolve(s);
|
|
79
|
+
}
|
|
80
|
+
if (!Array.isArray(s) || typeof s[0] !== 'string')
|
|
81
|
+
throw new Error('Invalid Reporter');
|
|
82
|
+
// Preserve the shape of Reporter Setting while resolving the reporter file.
|
|
83
|
+
const [r, ...rest] = s;
|
|
84
|
+
return [resolve(r), ...rest];
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
reporters: settings.reporters.map(resolveReporter),
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
exports.normalizeReporters = normalizeReporters;
|
|
91
|
+
function normalizeLanguageSettings(languageSettings) {
|
|
92
|
+
if (!languageSettings)
|
|
93
|
+
return undefined;
|
|
94
|
+
function fixLocale(s) {
|
|
95
|
+
const { local: locale, ...rest } = s;
|
|
96
|
+
return util.clean({ locale, ...rest });
|
|
97
|
+
}
|
|
98
|
+
return languageSettings.map(fixLocale);
|
|
99
|
+
}
|
|
100
|
+
exports.normalizeLanguageSettings = normalizeLanguageSettings;
|
|
101
|
+
function normalizeGitignoreRoot(settings, pathToSettingsFile) {
|
|
102
|
+
const { gitignoreRoot } = settings;
|
|
103
|
+
if (!gitignoreRoot)
|
|
104
|
+
return {};
|
|
105
|
+
const dir = path.dirname(pathToSettingsFile);
|
|
106
|
+
const roots = Array.isArray(gitignoreRoot) ? gitignoreRoot : [gitignoreRoot];
|
|
107
|
+
return {
|
|
108
|
+
gitignoreRoot: roots.map((p) => path.resolve(dir, p)),
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
exports.normalizeGitignoreRoot = normalizeGitignoreRoot;
|
|
112
|
+
function normalizeSettingsGlobs(settings, pathToSettingsFile) {
|
|
113
|
+
const { globRoot } = settings;
|
|
114
|
+
if (settings.ignorePaths === undefined)
|
|
115
|
+
return {};
|
|
116
|
+
const ignorePaths = (0, toGlobDef_1.toGlobDef)(settings.ignorePaths, globRoot, pathToSettingsFile);
|
|
117
|
+
return {
|
|
118
|
+
ignorePaths,
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
exports.normalizeSettingsGlobs = normalizeSettingsGlobs;
|
|
122
|
+
function normalizeCacheSettings(settings, pathToSettingsDir) {
|
|
123
|
+
const { cache } = settings;
|
|
124
|
+
if (cache === undefined)
|
|
125
|
+
return {};
|
|
126
|
+
const { cacheLocation } = cache;
|
|
127
|
+
if (cacheLocation === undefined)
|
|
128
|
+
return { cache };
|
|
129
|
+
return { cache: { ...cache, cacheLocation: resolveFilePath(cacheLocation, pathToSettingsDir) } };
|
|
130
|
+
}
|
|
131
|
+
exports.normalizeCacheSettings = normalizeCacheSettings;
|
|
132
|
+
function resolveFilePath(filename, pathToSettingsFile) {
|
|
133
|
+
const cwd = process.cwd();
|
|
134
|
+
return path.resolve(pathToSettingsFile, filename.replace('${cwd}', cwd));
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=normalizeRawSettings.js.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { CSpellSettingsI, CSpellSettingsWST } from './configLoader';
|
|
2
|
+
/**
|
|
3
|
+
* Read / import a cspell configuration file.
|
|
4
|
+
* @param filename - the path to the file.
|
|
5
|
+
* Supported types: json, yaml, js, and cjs. ES Modules are not supported.
|
|
6
|
+
* - absolute path `/absolute/path/to/file`
|
|
7
|
+
* - relative path `./path/to/file` (relative to the current working directory)
|
|
8
|
+
* - package `@cspell/dict-typescript/cspell-ext.json`
|
|
9
|
+
*/
|
|
10
|
+
export declare function readSettings(filename: string): CSpellSettingsI;
|
|
11
|
+
export declare function readSettings(filename: string, defaultValues: CSpellSettingsWST): CSpellSettingsI;
|
|
12
|
+
/**
|
|
13
|
+
* Read / import a cspell configuration file.
|
|
14
|
+
* @param filename - the path to the file.
|
|
15
|
+
* Supported types: json, yaml, js, and cjs. ES Modules are not supported.
|
|
16
|
+
* - absolute path `/absolute/path/to/file`
|
|
17
|
+
* - relative path `./path/to/file` (relative to `relativeTo`)
|
|
18
|
+
* - package `@cspell/dict-typescript/cspell-ext.json` searches for node_modules relative to `relativeTo`
|
|
19
|
+
* @param relativeTo - absolute path to start searching for relative files or node_modules.
|
|
20
|
+
*/
|
|
21
|
+
export declare function readSettings(filename: string, relativeTo: string): CSpellSettingsI;
|
|
22
|
+
export declare function readSettings(filename: string, relativeTo: string, defaultValues: CSpellSettingsWST): CSpellSettingsI;
|
|
23
|
+
//# sourceMappingURL=readSettings.d.ts.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.readSettings = void 0;
|
|
4
|
+
const configLoader_1 = require("./configLoader");
|
|
5
|
+
function readSettings(filename, relativeToOrDefault, defaultValue) {
|
|
6
|
+
const loader = (0, configLoader_1.getDefaultConfigLoader)();
|
|
7
|
+
if (typeof relativeToOrDefault !== 'string' || defaultValue === undefined)
|
|
8
|
+
return loader.readSettings(filename, relativeToOrDefault);
|
|
9
|
+
return loader.readSettings(filename, relativeToOrDefault, defaultValue);
|
|
10
|
+
}
|
|
11
|
+
exports.readSettings = readSettings;
|
|
12
|
+
//# sourceMappingURL=readSettings.js.map
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { Glob, GlobDef } from '@cspell/cspell-types';
|
|
2
|
+
export declare function toGlobDef(g: undefined, root: string | undefined, source: string | undefined): undefined;
|
|
3
|
+
export declare function toGlobDef(g: Glob, root: string | undefined, source: string | undefined): GlobDef;
|
|
4
|
+
export declare function toGlobDef(g: Glob[], root: string | undefined, source: string | undefined): GlobDef[];
|
|
5
|
+
export declare function toGlobDef(g: Glob | Glob[], root: string | undefined, source: string | undefined): GlobDef | GlobDef[];
|
|
6
|
+
//# sourceMappingURL=toGlobDef.d.ts.map
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.toGlobDef = void 0;
|
|
4
|
+
function toGlobDef(g, root, source) {
|
|
5
|
+
if (g === undefined)
|
|
6
|
+
return undefined;
|
|
7
|
+
if (Array.isArray(g)) {
|
|
8
|
+
return g.map((g) => toGlobDef(g, root, source));
|
|
9
|
+
}
|
|
10
|
+
if (typeof g === 'string') {
|
|
11
|
+
const glob = { glob: g };
|
|
12
|
+
if (root !== undefined) {
|
|
13
|
+
glob.root = root;
|
|
14
|
+
}
|
|
15
|
+
return toGlobDef(glob, root, source);
|
|
16
|
+
}
|
|
17
|
+
if (source) {
|
|
18
|
+
return { ...g, source };
|
|
19
|
+
}
|
|
20
|
+
return g;
|
|
21
|
+
}
|
|
22
|
+
exports.toGlobDef = toGlobDef;
|
|
23
|
+
//# sourceMappingURL=toGlobDef.js.map
|
|
@@ -104,18 +104,18 @@ function validateInDocumentSettings(docText, _settings) {
|
|
|
104
104
|
}
|
|
105
105
|
exports.validateInDocumentSettings = validateInDocumentSettings;
|
|
106
106
|
const settingParsers = [
|
|
107
|
-
[/^(?:enable|disable)(?:allow)?CompoundWords\b/i, parseCompoundWords],
|
|
108
|
-
[/^(?:enable|disable)CaseSensitive\b/i, parseCaseSensitive],
|
|
107
|
+
[/^(?:enable|disable)(?:allow)?CompoundWords\b(?!-)/i, parseCompoundWords],
|
|
108
|
+
[/^(?:enable|disable)CaseSensitive\b(?!-)/i, parseCaseSensitive],
|
|
109
109
|
[/^enable\b(?!-)/i, parseEnable],
|
|
110
110
|
[/^disable(-line|-next(-line)?)?\b(?!-)/i, parseDisable],
|
|
111
|
-
[/^words?\b/i, parseWords],
|
|
112
|
-
[/^ignore(?:-?words?)?\b/i, parseIgnoreWords],
|
|
113
|
-
[/^(?:flag|forbid)(?:-?words?)?\b/i, parseFlagWords],
|
|
111
|
+
[/^words?\b(?!-)/i, parseWords],
|
|
112
|
+
[/^ignore(?:-?words?)?\b(?!-)/i, parseIgnoreWords],
|
|
113
|
+
[/^(?:flag|forbid)(?:-?words?)?\b(?!-)/i, parseFlagWords],
|
|
114
114
|
[/^ignore_?Reg_?Exp\s+.+$/i, parseIgnoreRegExp],
|
|
115
115
|
[/^include_?Reg_?Exp\s+.+$/i, parseIncludeRegExp],
|
|
116
|
-
[/^locale?\b/i, parseLocale],
|
|
117
|
-
[/^language\s/i, parseLocale],
|
|
118
|
-
[/^dictionar(?:y|ies)\b/i, parseDictionaries],
|
|
116
|
+
[/^locale?\b(?!-)/i, parseLocale],
|
|
117
|
+
[/^language\s\b(?!-)/i, parseLocale],
|
|
118
|
+
[/^dictionar(?:y|ies)\b(?!-)/i, parseDictionaries],
|
|
119
119
|
[/^LocalWords:/, (w) => parseWords(w.replace(/^LocalWords:?/gi, ' '))],
|
|
120
120
|
];
|
|
121
121
|
exports.regExSpellingGuardBlock = /(\bc?spell(?:-?checker)?::?)\s*disable(?!-line|-next)\b[\s\S]*?((?:\1\s*enable\b)|$)/gi;
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare const configSettingsFileVersion0_1 = "0.1";
|
|
2
|
+
export declare const configSettingsFileVersion0_2 = "0.2";
|
|
3
|
+
export declare const currentSettingsFileVersion = "0.2";
|
|
4
|
+
export declare const ENV_CSPELL_GLOB_ROOT = "CSPELL_GLOB_ROOT";
|
|
5
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ENV_CSPELL_GLOB_ROOT = exports.currentSettingsFileVersion = exports.configSettingsFileVersion0_2 = exports.configSettingsFileVersion0_1 = void 0;
|
|
4
|
+
exports.configSettingsFileVersion0_1 = '0.1';
|
|
5
|
+
exports.configSettingsFileVersion0_2 = '0.2';
|
|
6
|
+
exports.currentSettingsFileVersion = exports.configSettingsFileVersion0_2;
|
|
7
|
+
exports.ENV_CSPELL_GLOB_ROOT = 'CSPELL_GLOB_ROOT';
|
|
8
|
+
//# sourceMappingURL=constants.js.map
|
package/dist/Settings/index.d.ts
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
export { clearCachedSettingsFiles, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getGlobalSettings, loadConfig, loadPnP, loadPnPSync, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Controller/configLoader';
|
|
2
|
-
export { calcOverrideSettings, checkFilenameMatchesGlob,
|
|
2
|
+
export { calcOverrideSettings, checkFilenameMatchesGlob, extractDependencies, finalizeSettings, getSources, mergeInDocSettings, mergeSettings, } from './CSpellSettingsServer';
|
|
3
|
+
export { currentSettingsFileVersion, ENV_CSPELL_GLOB_ROOT } from './constants';
|
|
3
4
|
export type { ConfigurationDependencies, ImportFileRefWithError } from './CSpellSettingsServer';
|
|
4
5
|
export { getDefaultSettings, getDefaultBundledSettings } from './DefaultSettings';
|
|
5
6
|
export { ImportError } from './Controller/ImportError';
|
package/dist/Settings/index.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.ImportError = exports.getDefaultBundledSettings = exports.getDefaultSettings = exports.
|
|
3
|
+
exports.ImportError = exports.getDefaultBundledSettings = exports.getDefaultSettings = exports.ENV_CSPELL_GLOB_ROOT = exports.currentSettingsFileVersion = exports.mergeSettings = exports.mergeInDocSettings = exports.getSources = exports.finalizeSettings = exports.extractDependencies = exports.checkFilenameMatchesGlob = exports.calcOverrideSettings = exports.sectionCSpell = exports.searchForConfig = exports.readSettingsFiles = exports.readSettings = exports.readRawSettings = exports.loadPnPSync = exports.loadPnP = exports.loadConfig = exports.getGlobalSettings = exports.getCachedFileSize = exports.extractImportErrors = exports.defaultFileName = exports.defaultConfigFilenames = exports.clearCachedSettingsFiles = void 0;
|
|
4
4
|
var configLoader_1 = require("./Controller/configLoader");
|
|
5
5
|
Object.defineProperty(exports, "clearCachedSettingsFiles", { enumerable: true, get: function () { return configLoader_1.clearCachedSettingsFiles; } });
|
|
6
6
|
Object.defineProperty(exports, "defaultConfigFilenames", { enumerable: true, get: function () { return configLoader_1.defaultConfigFilenames; } });
|
|
@@ -19,13 +19,14 @@ Object.defineProperty(exports, "sectionCSpell", { enumerable: true, get: functio
|
|
|
19
19
|
var CSpellSettingsServer_1 = require("./CSpellSettingsServer");
|
|
20
20
|
Object.defineProperty(exports, "calcOverrideSettings", { enumerable: true, get: function () { return CSpellSettingsServer_1.calcOverrideSettings; } });
|
|
21
21
|
Object.defineProperty(exports, "checkFilenameMatchesGlob", { enumerable: true, get: function () { return CSpellSettingsServer_1.checkFilenameMatchesGlob; } });
|
|
22
|
-
Object.defineProperty(exports, "currentSettingsFileVersion", { enumerable: true, get: function () { return CSpellSettingsServer_1.currentSettingsFileVersion; } });
|
|
23
|
-
Object.defineProperty(exports, "ENV_CSPELL_GLOB_ROOT", { enumerable: true, get: function () { return CSpellSettingsServer_1.ENV_CSPELL_GLOB_ROOT; } });
|
|
24
22
|
Object.defineProperty(exports, "extractDependencies", { enumerable: true, get: function () { return CSpellSettingsServer_1.extractDependencies; } });
|
|
25
23
|
Object.defineProperty(exports, "finalizeSettings", { enumerable: true, get: function () { return CSpellSettingsServer_1.finalizeSettings; } });
|
|
26
24
|
Object.defineProperty(exports, "getSources", { enumerable: true, get: function () { return CSpellSettingsServer_1.getSources; } });
|
|
27
25
|
Object.defineProperty(exports, "mergeInDocSettings", { enumerable: true, get: function () { return CSpellSettingsServer_1.mergeInDocSettings; } });
|
|
28
26
|
Object.defineProperty(exports, "mergeSettings", { enumerable: true, get: function () { return CSpellSettingsServer_1.mergeSettings; } });
|
|
27
|
+
var constants_1 = require("./constants");
|
|
28
|
+
Object.defineProperty(exports, "currentSettingsFileVersion", { enumerable: true, get: function () { return constants_1.currentSettingsFileVersion; } });
|
|
29
|
+
Object.defineProperty(exports, "ENV_CSPELL_GLOB_ROOT", { enumerable: true, get: function () { return constants_1.ENV_CSPELL_GLOB_ROOT; } });
|
|
29
30
|
var DefaultSettings_1 = require("./DefaultSettings");
|
|
30
31
|
Object.defineProperty(exports, "getDefaultSettings", { enumerable: true, get: function () { return DefaultSettings_1.getDefaultSettings; } });
|
|
31
32
|
Object.defineProperty(exports, "getDefaultBundledSettings", { enumerable: true, get: function () { return DefaultSettings_1.getDefaultBundledSettings; } });
|
package/dist/util/errors.js
CHANGED
|
@@ -2,7 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.__testing__ = exports.UnknownError = exports.toError = exports.isError = exports.isErrnoException = void 0;
|
|
4
4
|
const util_1 = require("util");
|
|
5
|
-
// eslint-disable-next-line @typescript-eslint/explicit-module-boundary-types
|
|
6
5
|
function getTypeOf(t) {
|
|
7
6
|
return typeof t;
|
|
8
7
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cspell-lib",
|
|
3
|
-
"version": "6.8.
|
|
3
|
+
"version": "6.8.2",
|
|
4
4
|
"description": "A library of useful functions used across various cspell tools.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"typings": "dist/index.d.ts",
|
|
@@ -48,25 +48,25 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/streetsidesoftware/cspell#readme",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@cspell/cspell-bundled-dicts": "^6.8.
|
|
52
|
-
"@cspell/cspell-pipe": "^6.8.
|
|
53
|
-
"@cspell/cspell-types": "^6.8.
|
|
51
|
+
"@cspell/cspell-bundled-dicts": "^6.8.2",
|
|
52
|
+
"@cspell/cspell-pipe": "^6.8.2",
|
|
53
|
+
"@cspell/cspell-types": "^6.8.2",
|
|
54
54
|
"clear-module": "^4.1.2",
|
|
55
55
|
"comment-json": "^4.2.3",
|
|
56
56
|
"configstore": "^5.0.1",
|
|
57
57
|
"cosmiconfig": "^7.0.1",
|
|
58
|
-
"cspell-glob": "^6.8.
|
|
59
|
-
"cspell-grammar": "^6.8.
|
|
60
|
-
"cspell-io": "^6.8.
|
|
61
|
-
"cspell-trie-lib": "^6.8.
|
|
58
|
+
"cspell-glob": "^6.8.2",
|
|
59
|
+
"cspell-grammar": "^6.8.2",
|
|
60
|
+
"cspell-io": "^6.8.2",
|
|
61
|
+
"cspell-trie-lib": "^6.8.2",
|
|
62
62
|
"fast-equals": "^4.0.3",
|
|
63
63
|
"find-up": "^5.0.0",
|
|
64
64
|
"fs-extra": "^10.1.0",
|
|
65
|
-
"gensequence": "^
|
|
65
|
+
"gensequence": "^4.0.2",
|
|
66
66
|
"import-fresh": "^3.3.0",
|
|
67
67
|
"resolve-from": "^5.0.0",
|
|
68
68
|
"resolve-global": "^1.0.0",
|
|
69
|
-
"vscode-languageserver-textdocument": "^1.0.
|
|
69
|
+
"vscode-languageserver-textdocument": "^1.0.7",
|
|
70
70
|
"vscode-uri": "^3.0.3"
|
|
71
71
|
},
|
|
72
72
|
"engines": {
|
|
@@ -83,15 +83,15 @@
|
|
|
83
83
|
"@cspell/dict-python": "^2.0.6",
|
|
84
84
|
"@types/configstore": "^5.0.1",
|
|
85
85
|
"@types/fs-extra": "^9.0.13",
|
|
86
|
-
"@types/jest": "^
|
|
87
|
-
"@types/node": "^18.7.
|
|
86
|
+
"@types/jest": "^29.0.1",
|
|
87
|
+
"@types/node": "^18.7.16",
|
|
88
88
|
"cspell-dict-nl-nl": "^1.1.2",
|
|
89
|
-
"jest": "^
|
|
89
|
+
"jest": "^29.0.3",
|
|
90
90
|
"lorem-ipsum": "^2.0.8",
|
|
91
91
|
"rimraf": "^3.0.2",
|
|
92
|
-
"rollup": "^2.
|
|
92
|
+
"rollup": "^2.79.0",
|
|
93
93
|
"rollup-plugin-dts": "^4.2.2",
|
|
94
|
-
"ts-jest": "^
|
|
94
|
+
"ts-jest": "^29.0.0"
|
|
95
95
|
},
|
|
96
|
-
"gitHead": "
|
|
96
|
+
"gitHead": "fb47a5f2f93d333fe5540142f3217e4981a7c27d"
|
|
97
97
|
}
|
|
@@ -1,84 +0,0 @@
|
|
|
1
|
-
import type { CSpellSettingsWithSourceTrace, CSpellUserSettings, ImportFileRef, PnPSettings as PnPSettingsStrict } from '@cspell/cspell-types';
|
|
2
|
-
import { URI } from 'vscode-uri';
|
|
3
|
-
import { CSpellSettingsInternal } from '../../Models/CSpellSettingsInternalDef';
|
|
4
|
-
import { OptionalOrUndefined } from '../../util/types';
|
|
5
|
-
import { LoaderResult } from './pnpLoader';
|
|
6
|
-
declare type CSpellSettingsWST = CSpellSettingsWithSourceTrace;
|
|
7
|
-
declare type CSpellSettingsI = CSpellSettingsInternal;
|
|
8
|
-
declare type PnPSettings = OptionalOrUndefined<PnPSettingsStrict>;
|
|
9
|
-
export declare const sectionCSpell = "cSpell";
|
|
10
|
-
export declare const defaultFileName = "cspell.json";
|
|
11
|
-
export declare const defaultConfigFilenames: readonly string[];
|
|
12
|
-
/**
|
|
13
|
-
* normalizeSettings handles correcting all relative paths, anchoring globs, and importing other config files.
|
|
14
|
-
* @param rawSettings - raw configuration settings
|
|
15
|
-
* @param pathToSettingsFile - path to the source file of the configuration settings.
|
|
16
|
-
*/
|
|
17
|
-
declare function normalizeSettings(rawSettings: CSpellSettingsWST, pathToSettingsFile: string, pnpSettings: PnPSettings): CSpellSettingsI;
|
|
18
|
-
/**
|
|
19
|
-
* Read / import a cspell configuration file.
|
|
20
|
-
* @param filename - the path to the file.
|
|
21
|
-
* Supported types: json, yaml, js, and cjs. ES Modules are not supported.
|
|
22
|
-
* - absolute path `/absolute/path/to/file`
|
|
23
|
-
* - relative path `./path/to/file` (relative to the current working directory)
|
|
24
|
-
* - package `@cspell/dict-typescript/cspell-ext.json`
|
|
25
|
-
*/
|
|
26
|
-
export declare function readSettings(filename: string): CSpellSettingsI;
|
|
27
|
-
export declare function readSettings(filename: string, defaultValues: CSpellSettingsWST): CSpellSettingsI;
|
|
28
|
-
/**
|
|
29
|
-
* Read / import a cspell configuration file.
|
|
30
|
-
* @param filename - the path to the file.
|
|
31
|
-
* Supported types: json, yaml, js, and cjs. ES Modules are not supported.
|
|
32
|
-
* - absolute path `/absolute/path/to/file`
|
|
33
|
-
* - relative path `./path/to/file` (relative to `relativeTo`)
|
|
34
|
-
* - package `@cspell/dict-typescript/cspell-ext.json` searches for node_modules relative to `relativeTo`
|
|
35
|
-
* @param relativeTo - absolute path to start searching for relative files or node_modules.
|
|
36
|
-
*/
|
|
37
|
-
export declare function readSettings(filename: string, relativeTo: string): CSpellSettingsI;
|
|
38
|
-
export declare function readSettings(filename: string, relativeTo: string, defaultValues: CSpellSettingsWST): CSpellSettingsI;
|
|
39
|
-
export declare function searchForConfig(searchFrom: string | undefined, pnpSettings?: PnPSettings): Promise<CSpellSettingsI | undefined>;
|
|
40
|
-
export declare function searchForConfigSync(searchFrom: string | undefined, pnpSettings?: PnPSettings): CSpellSettingsI | undefined;
|
|
41
|
-
/**
|
|
42
|
-
* Load a CSpell configuration files.
|
|
43
|
-
* @param file - path or package reference to load.
|
|
44
|
-
* @param pnpSettings - PnP settings
|
|
45
|
-
* @returns normalized CSpellSettings
|
|
46
|
-
*/
|
|
47
|
-
export declare function loadConfig(file: string, pnpSettings?: PnPSettings): Promise<CSpellSettingsI>;
|
|
48
|
-
/**
|
|
49
|
-
* Load a CSpell configuration files.
|
|
50
|
-
* @param filename - path or package reference to load.
|
|
51
|
-
* @param pnpSettings - PnP settings
|
|
52
|
-
* @returns normalized CSpellSettings
|
|
53
|
-
*/
|
|
54
|
-
export declare function loadConfigSync(filename: string, pnpSettings?: PnPSettings): CSpellSettingsI;
|
|
55
|
-
export declare function loadPnP(pnpSettings: PnPSettings, searchFrom: URI): Promise<LoaderResult>;
|
|
56
|
-
export declare function loadPnPSync(pnpSettings: PnPSettings, searchFrom: URI): LoaderResult;
|
|
57
|
-
export declare function readRawSettings(filename: string, relativeTo?: string): CSpellSettingsWST;
|
|
58
|
-
/**
|
|
59
|
-
*
|
|
60
|
-
* @param filenames - settings files to read
|
|
61
|
-
* @returns combined configuration
|
|
62
|
-
* @deprecated true
|
|
63
|
-
*/
|
|
64
|
-
export declare function readSettingsFiles(filenames: string[]): CSpellSettingsI;
|
|
65
|
-
export declare function getGlobalSettings(): CSpellSettingsI;
|
|
66
|
-
export declare function getCachedFileSize(): number;
|
|
67
|
-
export declare function clearCachedSettingsFiles(): void;
|
|
68
|
-
export interface ImportFileRefWithError extends ImportFileRef {
|
|
69
|
-
error: Error;
|
|
70
|
-
}
|
|
71
|
-
export declare function extractImportErrors(settings: CSpellSettingsWST): ImportFileRefWithError[];
|
|
72
|
-
declare function normalizeCacheSettings(settings: Pick<CSpellUserSettings, 'cache'>, pathToSettingsDir: string): Pick<CSpellUserSettings, 'cache'>;
|
|
73
|
-
declare function validateRawConfigVersion(config: CSpellUserSettings | {
|
|
74
|
-
version: unknown;
|
|
75
|
-
}, fileRef: ImportFileRef): void;
|
|
76
|
-
declare function validateRawConfigExports(config: CSpellUserSettings, fileRef: ImportFileRef): void;
|
|
77
|
-
export declare const __testing__: {
|
|
78
|
-
normalizeCacheSettings: typeof normalizeCacheSettings;
|
|
79
|
-
normalizeSettings: typeof normalizeSettings;
|
|
80
|
-
validateRawConfigExports: typeof validateRawConfigExports;
|
|
81
|
-
validateRawConfigVersion: typeof validateRawConfigVersion;
|
|
82
|
-
};
|
|
83
|
-
export {};
|
|
84
|
-
//# sourceMappingURL=configLoader.d.ts.map
|