cspell-lib 8.15.1 → 8.15.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/lib/Settings/Controller/configLoader/configLoader.d.ts +10 -4
- package/dist/lib/Settings/Controller/configLoader/configLoader.js +10 -3
- package/dist/lib/Settings/Controller/configLoader/defaultConfigLoader.d.ts +2 -1
- package/dist/lib/Settings/Controller/configLoader/defaultConfigLoader.js +3 -0
- package/dist/lib/Settings/Controller/configLoader/index.d.ts +1 -1
- package/dist/lib/Settings/Controller/configLoader/index.js +1 -1
- package/dist/lib/Settings/index.d.ts +1 -1
- package/dist/lib/Settings/index.js +1 -1
- package/dist/lib/index.d.ts +1 -1
- package/dist/lib/index.js +1 -1
- package/package.json +24 -24
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import type { CSpellUserSettings, ImportFileRef } from '@cspell/cspell-types';
|
|
2
|
-
import
|
|
3
|
-
import { CSpellConfigFileInMemory } from 'cspell-config-lib';
|
|
2
|
+
import { CSpellConfigFile, CSpellConfigFileReaderWriter, ICSpellConfigFile } from 'cspell-config-lib';
|
|
4
3
|
import type { VFileSystem } from '../../../fileSystem.js';
|
|
5
4
|
import { AutoResolveCache } from '../../../util/AutoResolve.js';
|
|
6
5
|
import { FileResolver } from '../../../util/resolveFile.js';
|
|
@@ -75,6 +74,12 @@ export interface IConfigLoader {
|
|
|
75
74
|
* @param settings - settings to use.
|
|
76
75
|
*/
|
|
77
76
|
createCSpellConfigFile(filename: URL | string, settings: CSpellUserSettings): CSpellConfigFile;
|
|
77
|
+
/**
|
|
78
|
+
* Convert a ICSpellConfigFile into a CSpellConfigFile.
|
|
79
|
+
* If cfg is a CSpellConfigFile, it is returned as is.
|
|
80
|
+
* @param cfg - configuration file to convert.
|
|
81
|
+
*/
|
|
82
|
+
toCSpellConfigFile(cfg: ICSpellConfigFile): CSpellConfigFile;
|
|
78
83
|
/**
|
|
79
84
|
* Unsubscribe from any events and dispose of any resources including caches.
|
|
80
85
|
*/
|
|
@@ -99,7 +104,7 @@ export declare class ConfigLoader implements IConfigLoader {
|
|
|
99
104
|
protected cachedConfigFiles: Map<string, CSpellConfigFile>;
|
|
100
105
|
protected cachedPendingConfigFile: AutoResolveCache<string, Promise<Error | CSpellConfigFile>>;
|
|
101
106
|
protected cachedMergedConfig: WeakMap<CSpellConfigFile, CacheMergeConfigFileWithImports>;
|
|
102
|
-
protected cachedCSpellConfigFileInMemory: WeakMap<import("@cspell/cspell-types").CSpellSettings, Map<string,
|
|
107
|
+
protected cachedCSpellConfigFileInMemory: WeakMap<import("@cspell/cspell-types").CSpellSettings, Map<string, CSpellConfigFile>>;
|
|
103
108
|
protected globalSettings: CSpellSettingsI | undefined;
|
|
104
109
|
protected cspellConfigFileReaderWriter: CSpellConfigFileReaderWriter;
|
|
105
110
|
protected configSearch: ConfigSearch;
|
|
@@ -131,7 +136,7 @@ export declare class ConfigLoader implements IConfigLoader {
|
|
|
131
136
|
protected resolveDefaultConfig(): Promise<URL>;
|
|
132
137
|
protected importSettings(fileRef: ImportFileRef, pnpSettings: PnPSettingsOptional | undefined, backReferences: string[]): ImportedConfigEntry;
|
|
133
138
|
private setupPnp;
|
|
134
|
-
mergeConfigFileWithImports(
|
|
139
|
+
mergeConfigFileWithImports(cfg: CSpellConfigFile | ICSpellConfigFile, pnpSettings: PnPSettingsOptional | undefined, referencedBy?: string[] | undefined): Promise<CSpellSettingsI>;
|
|
135
140
|
private _mergeConfigFileWithImports;
|
|
136
141
|
/**
|
|
137
142
|
* normalizeSettings handles correcting all relative paths, anchoring globs, and importing other config files.
|
|
@@ -140,6 +145,7 @@ export declare class ConfigLoader implements IConfigLoader {
|
|
|
140
145
|
*/
|
|
141
146
|
protected mergeImports(cfgFile: CSpellConfigFile, importedSettings: CSpellUserSettings[]): Promise<CSpellSettingsI>;
|
|
142
147
|
createCSpellConfigFile(filename: URL | string, settings: CSpellUserSettings): CSpellConfigFile;
|
|
148
|
+
toCSpellConfigFile(cfg: ICSpellConfigFile): CSpellConfigFile;
|
|
143
149
|
dispose(): void;
|
|
144
150
|
getStats(): {
|
|
145
151
|
cacheMergeListUnique: Readonly<import("../../../util/AutoResolve.js").CacheStats>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
4
|
-
import {
|
|
4
|
+
import { CSpellConfigFile } from 'cspell-config-lib';
|
|
5
|
+
import { createReaderWriter } from 'cspell-config-lib';
|
|
5
6
|
import { isUrlLike, toFileURL } from 'cspell-io';
|
|
6
7
|
import { URI, Utils as UriUtils } from 'vscode-uri';
|
|
7
8
|
import { onClearCache } from '../../../events/index.js';
|
|
@@ -254,7 +255,8 @@ export class ConfigLoader {
|
|
|
254
255
|
const pathToSettingsDir = new URL('.', cfgFile.url);
|
|
255
256
|
await loadPnP(pnpSettingsToUse, pathToSettingsDir);
|
|
256
257
|
}
|
|
257
|
-
mergeConfigFileWithImports(
|
|
258
|
+
mergeConfigFileWithImports(cfg, pnpSettings, referencedBy) {
|
|
259
|
+
const cfgFile = this.toCSpellConfigFile(cfg);
|
|
258
260
|
const cached = this.cachedMergedConfig.get(cfgFile);
|
|
259
261
|
if (cached && cached.pnpSettings === pnpSettings && cached.referencedBy === referencedBy) {
|
|
260
262
|
return cached.result;
|
|
@@ -333,7 +335,12 @@ export class ConfigLoader {
|
|
|
333
335
|
}
|
|
334
336
|
createCSpellConfigFile(filename, settings) {
|
|
335
337
|
const map = autoResolveWeak(this.cachedCSpellConfigFileInMemory, settings, () => new Map());
|
|
336
|
-
return autoResolve(map, filename, () =>
|
|
338
|
+
return autoResolve(map, filename, () => this.cspellConfigFileReaderWriter.toCSpellConfigFile({ url: toFileURL(filename), settings }));
|
|
339
|
+
}
|
|
340
|
+
toCSpellConfigFile(cfg) {
|
|
341
|
+
if (cfg instanceof CSpellConfigFile)
|
|
342
|
+
return cfg;
|
|
343
|
+
return this.createCSpellConfigFile(cfg.url, cfg.settings);
|
|
337
344
|
}
|
|
338
345
|
dispose() {
|
|
339
346
|
while (this.toDispose.length) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { CSpellSettings } from '@cspell/cspell-types';
|
|
2
|
-
import type { CSpellConfigFile } from 'cspell-config-lib';
|
|
2
|
+
import type { CSpellConfigFile, ICSpellConfigFile } from 'cspell-config-lib';
|
|
3
3
|
import type { IConfigLoader } from './configLoader.js';
|
|
4
4
|
import type { PnPSettingsOptional } from './PnPSettings.js';
|
|
5
5
|
import type { CSpellSettingsI, CSpellSettingsWST } from './types.js';
|
|
@@ -25,6 +25,7 @@ export declare function loadConfig(file: string, pnpSettings?: PnPSettingsOption
|
|
|
25
25
|
*/
|
|
26
26
|
export declare function resolveSettingsImports(settings: CSpellSettings, filename: string | URL): Promise<CSpellSettingsI>;
|
|
27
27
|
export declare function readConfigFile(filename: string | URL, relativeTo?: string | URL): Promise<CSpellConfigFile>;
|
|
28
|
+
export declare function resolveConfigFileImports(configFile: CSpellConfigFile | ICSpellConfigFile): Promise<CSpellSettingsI>;
|
|
28
29
|
/**
|
|
29
30
|
* Might throw if the settings have not yet been loaded.
|
|
30
31
|
* @deprecated use {@link getGlobalSettingsAsync} instead.
|
|
@@ -38,6 +38,9 @@ export async function readConfigFile(filename, relativeTo) {
|
|
|
38
38
|
}
|
|
39
39
|
return result;
|
|
40
40
|
}
|
|
41
|
+
export async function resolveConfigFileImports(configFile) {
|
|
42
|
+
return gcl().mergeConfigFileWithImports(configFile, configFile.settings);
|
|
43
|
+
}
|
|
41
44
|
/**
|
|
42
45
|
* Might throw if the settings have not yet been loaded.
|
|
43
46
|
* @deprecated use {@link getGlobalSettingsAsync} instead.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { __testing__, ConfigLoader, createConfigLoader, defaultFileName, loadPnP, sectionCSpell, } from './configLoader.js';
|
|
2
2
|
export { defaultConfigFilenames } from './configLocations.js';
|
|
3
|
-
export { clearCachedSettingsFiles, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, readRawSettings, resolveSettingsImports, searchForConfig, } from './defaultConfigLoader.js';
|
|
3
|
+
export { clearCachedSettingsFiles, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, readConfigFile, readRawSettings, resolveConfigFileImports, resolveSettingsImports, searchForConfig, } from './defaultConfigLoader.js';
|
|
4
4
|
export { extractImportErrors, ImportFileRefWithError } from './extractImportErrors.js';
|
|
5
5
|
export { readSettings } from './readSettings.js';
|
|
6
6
|
export { readSettingsFiles } from './readSettingsFiles.js';
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { __testing__, ConfigLoader, createConfigLoader, defaultFileName, loadPnP, sectionCSpell, } from './configLoader.js';
|
|
2
2
|
export { defaultConfigFilenames } from './configLocations.js';
|
|
3
|
-
export { clearCachedSettingsFiles, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, readRawSettings, resolveSettingsImports, searchForConfig, } from './defaultConfigLoader.js';
|
|
3
|
+
export { clearCachedSettingsFiles, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, readConfigFile, readRawSettings, resolveConfigFileImports, resolveSettingsImports, searchForConfig, } from './defaultConfigLoader.js';
|
|
4
4
|
export { extractImportErrors } from './extractImportErrors.js';
|
|
5
5
|
export { readSettings } from './readSettings.js';
|
|
6
6
|
export { readSettingsFiles } from './readSettingsFiles.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { calcOverrideSettings } from './calcOverrideSettings.js';
|
|
2
2
|
export { checkFilenameMatchesGlob } from './checkFilenameMatchesGlob.js';
|
|
3
3
|
export { currentSettingsFileVersion, ENV_CSPELL_GLOB_ROOT } from './constants.js';
|
|
4
|
-
export { clearCachedSettingsFiles, createConfigLoader, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, loadPnP, readRawSettings, readSettings, readSettingsFiles, resolveSettingsImports, searchForConfig, sectionCSpell, } from './Controller/configLoader/index.js';
|
|
4
|
+
export { clearCachedSettingsFiles, createConfigLoader, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, loadPnP, readConfigFile, readRawSettings, readSettings, readSettingsFiles, resolveConfigFileImports, resolveSettingsImports, searchForConfig, sectionCSpell, } from './Controller/configLoader/index.js';
|
|
5
5
|
export { ImportError } from './Controller/ImportError.js';
|
|
6
6
|
export type { ConfigurationDependencies, ImportFileRefWithError } from './CSpellSettingsServer.js';
|
|
7
7
|
export { extractDependencies, finalizeSettings, getSources, mergeInDocSettings, mergeSettings, } from './CSpellSettingsServer.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { calcOverrideSettings } from './calcOverrideSettings.js';
|
|
2
2
|
export { checkFilenameMatchesGlob } from './checkFilenameMatchesGlob.js';
|
|
3
3
|
export { currentSettingsFileVersion, ENV_CSPELL_GLOB_ROOT } from './constants.js';
|
|
4
|
-
export { clearCachedSettingsFiles, createConfigLoader, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, loadPnP, readRawSettings, readSettings, readSettingsFiles, resolveSettingsImports, searchForConfig, sectionCSpell, } from './Controller/configLoader/index.js';
|
|
4
|
+
export { clearCachedSettingsFiles, createConfigLoader, defaultConfigFilenames, defaultFileName, extractImportErrors, getCachedFileSize, getDefaultConfigLoader, getGlobalSettings, getGlobalSettingsAsync, loadConfig, loadPnP, readConfigFile, readRawSettings, readSettings, readSettingsFiles, resolveConfigFileImports, resolveSettingsImports, searchForConfig, sectionCSpell, } from './Controller/configLoader/index.js';
|
|
5
5
|
export { ImportError } from './Controller/ImportError.js';
|
|
6
6
|
export { extractDependencies, finalizeSettings, getSources, mergeInDocSettings, mergeSettings, } from './CSpellSettingsServer.js';
|
|
7
7
|
export { defaultSettingsLoader, getDefaultBundledSettingsAsync, getDefaultSettings } from './DefaultSettings.js';
|
package/dist/lib/index.d.ts
CHANGED
|
@@ -12,7 +12,7 @@ export type { CreateTextDocumentParams, TextDocument, TextDocumentLine, TextDocu
|
|
|
12
12
|
export { createTextDocument, updateTextDocument } from './Models/TextDocument.js';
|
|
13
13
|
export type { PerfTimer } from './perf/index.js';
|
|
14
14
|
export { createPerfTimer } from './perf/index.js';
|
|
15
|
-
export { calcOverrideSettings, checkFilenameMatchesGlob, type ConfigurationDependencies, createConfigLoader, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, finalizeSettings, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultConfigLoader, getDefaultSettings, getGlobalSettings, getGlobalSettingsAsync, getSources, ImportError, type ImportFileRefWithError, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Settings/index.js';
|
|
15
|
+
export { calcOverrideSettings, checkFilenameMatchesGlob, type ConfigurationDependencies, createConfigLoader, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, finalizeSettings, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultConfigLoader, getDefaultSettings, getGlobalSettings, getGlobalSettingsAsync, getSources, ImportError, type ImportFileRefWithError, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readConfigFile, readRawSettings, readSettings, readSettingsFiles, resolveConfigFileImports, searchForConfig, sectionCSpell, } from './Settings/index.js';
|
|
16
16
|
export { defaultFileName as defaultSettingsFilename } from './Settings/index.js';
|
|
17
17
|
export * as Link from './Settings/index.link.js';
|
|
18
18
|
export { combineTextAndLanguageSettings, combineTextAndLanguageSettings as constructSettingsForText, } from './Settings/TextDocumentSettings.js';
|
package/dist/lib/index.js
CHANGED
|
@@ -7,7 +7,7 @@ export { getLanguagesForBasename as getLanguageIdsForBaseFilename, getLanguagesF
|
|
|
7
7
|
export { getDictionary } from './getDictionary.js';
|
|
8
8
|
export { createTextDocument, updateTextDocument } from './Models/TextDocument.js';
|
|
9
9
|
export { createPerfTimer } from './perf/index.js';
|
|
10
|
-
export { calcOverrideSettings, checkFilenameMatchesGlob, createConfigLoader, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, finalizeSettings, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultConfigLoader, getDefaultSettings, getGlobalSettings, getGlobalSettingsAsync, getSources, ImportError, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readRawSettings, readSettings, readSettingsFiles, searchForConfig, sectionCSpell, } from './Settings/index.js';
|
|
10
|
+
export { calcOverrideSettings, checkFilenameMatchesGlob, createConfigLoader, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, ENV_CSPELL_GLOB_ROOT, extractDependencies, extractImportErrors, finalizeSettings, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultConfigLoader, getDefaultSettings, getGlobalSettings, getGlobalSettingsAsync, getSources, ImportError, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readConfigFile, readRawSettings, readSettings, readSettingsFiles, resolveConfigFileImports, searchForConfig, sectionCSpell, } from './Settings/index.js';
|
|
11
11
|
export { defaultFileName as defaultSettingsFilename } from './Settings/index.js';
|
|
12
12
|
export * as Link from './Settings/index.link.js';
|
|
13
13
|
export { combineTextAndLanguageSettings, combineTextAndLanguageSettings as constructSettingsForText, } from './Settings/TextDocumentSettings.js';
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"provenance": true
|
|
6
6
|
},
|
|
7
|
-
"version": "8.15.
|
|
7
|
+
"version": "8.15.2",
|
|
8
8
|
"description": "A library of useful functions used across various cspell tools.",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": false,
|
|
@@ -64,22 +64,22 @@
|
|
|
64
64
|
},
|
|
65
65
|
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-lib#readme",
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@cspell/cspell-bundled-dicts": "8.15.
|
|
68
|
-
"@cspell/cspell-pipe": "8.15.
|
|
69
|
-
"@cspell/cspell-resolver": "8.15.
|
|
70
|
-
"@cspell/cspell-types": "8.15.
|
|
71
|
-
"@cspell/dynamic-import": "8.15.
|
|
72
|
-
"@cspell/filetypes": "8.15.
|
|
73
|
-
"@cspell/strong-weak-map": "8.15.
|
|
74
|
-
"@cspell/url": "8.15.
|
|
67
|
+
"@cspell/cspell-bundled-dicts": "8.15.2",
|
|
68
|
+
"@cspell/cspell-pipe": "8.15.2",
|
|
69
|
+
"@cspell/cspell-resolver": "8.15.2",
|
|
70
|
+
"@cspell/cspell-types": "8.15.2",
|
|
71
|
+
"@cspell/dynamic-import": "8.15.2",
|
|
72
|
+
"@cspell/filetypes": "8.15.2",
|
|
73
|
+
"@cspell/strong-weak-map": "8.15.2",
|
|
74
|
+
"@cspell/url": "8.15.2",
|
|
75
75
|
"clear-module": "^4.1.2",
|
|
76
76
|
"comment-json": "^4.2.5",
|
|
77
|
-
"cspell-config-lib": "8.15.
|
|
78
|
-
"cspell-dictionary": "8.15.
|
|
79
|
-
"cspell-glob": "8.15.
|
|
80
|
-
"cspell-grammar": "8.15.
|
|
81
|
-
"cspell-io": "8.15.
|
|
82
|
-
"cspell-trie-lib": "8.15.
|
|
77
|
+
"cspell-config-lib": "8.15.2",
|
|
78
|
+
"cspell-dictionary": "8.15.2",
|
|
79
|
+
"cspell-glob": "8.15.2",
|
|
80
|
+
"cspell-grammar": "8.15.2",
|
|
81
|
+
"cspell-io": "8.15.2",
|
|
82
|
+
"cspell-trie-lib": "8.15.2",
|
|
83
83
|
"env-paths": "^3.0.0",
|
|
84
84
|
"fast-equals": "^5.0.1",
|
|
85
85
|
"gensequence": "^7.0.0",
|
|
@@ -93,14 +93,14 @@
|
|
|
93
93
|
"node": ">=18"
|
|
94
94
|
},
|
|
95
95
|
"devDependencies": {
|
|
96
|
-
"@cspell/dict-cpp": "^5.1.
|
|
97
|
-
"@cspell/dict-csharp": "^4.0.
|
|
98
|
-
"@cspell/dict-css": "^4.0.
|
|
99
|
-
"@cspell/dict-fa-ir": "^4.0.
|
|
100
|
-
"@cspell/dict-fr-fr": "^2.2.
|
|
101
|
-
"@cspell/dict-html": "^4.0.
|
|
102
|
-
"@cspell/dict-nl-nl": "^2.3.
|
|
103
|
-
"@cspell/dict-python": "^4.2.
|
|
96
|
+
"@cspell/dict-cpp": "^5.1.22",
|
|
97
|
+
"@cspell/dict-csharp": "^4.0.5",
|
|
98
|
+
"@cspell/dict-css": "^4.0.16",
|
|
99
|
+
"@cspell/dict-fa-ir": "^4.0.3",
|
|
100
|
+
"@cspell/dict-fr-fr": "^2.2.5",
|
|
101
|
+
"@cspell/dict-html": "^4.0.9",
|
|
102
|
+
"@cspell/dict-nl-nl": "^2.3.3",
|
|
103
|
+
"@cspell/dict-python": "^4.2.11",
|
|
104
104
|
"@types/configstore": "^6.0.2",
|
|
105
105
|
"configstore": "^7.0.0",
|
|
106
106
|
"cspell-dict-nl-nl": "^1.1.2",
|
|
@@ -108,5 +108,5 @@
|
|
|
108
108
|
"lorem-ipsum": "^2.0.8",
|
|
109
109
|
"perf-insight": "^1.2.0"
|
|
110
110
|
},
|
|
111
|
-
"gitHead": "
|
|
111
|
+
"gitHead": "63f8b976a0711780646f63283cf4f0457db740ee"
|
|
112
112
|
}
|