cspell-lib 10.1.0 → 10.2.0-alpha.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.
|
@@ -95,6 +95,7 @@ export interface IConfigLoader {
|
|
|
95
95
|
getStats(): Readonly<Record<string, Readonly<Record<string, number>>>>;
|
|
96
96
|
readonly isTrusted: boolean;
|
|
97
97
|
setIsTrusted(isTrusted: boolean): void;
|
|
98
|
+
isTrustedUrl(url: URL): boolean;
|
|
98
99
|
}
|
|
99
100
|
export declare const defaultExtensionsAll: string[];
|
|
100
101
|
export declare class ConfigLoader implements IConfigLoader {
|
|
@@ -166,6 +167,7 @@ export declare class ConfigLoader implements IConfigLoader {
|
|
|
166
167
|
private resolveFilename;
|
|
167
168
|
get isTrusted(): boolean;
|
|
168
169
|
setIsTrusted(isTrusted: boolean): void;
|
|
170
|
+
isTrustedUrl(url: URL): boolean;
|
|
169
171
|
}
|
|
170
172
|
declare class ConfigLoaderInternal extends ConfigLoader {
|
|
171
173
|
constructor(vfs: VFileSystem);
|
|
@@ -176,7 +176,8 @@ export class ConfigLoader {
|
|
|
176
176
|
async resolveDefaultConfig() {
|
|
177
177
|
const r = await this.fileResolver.resolveFile(defaultConfigFileModuleRef, srcDirectory);
|
|
178
178
|
const url = toFileURL(r.filename);
|
|
179
|
-
|
|
179
|
+
const baseUrl = new URL('../..', url); // go up two directories to get out of the node_modules directory.
|
|
180
|
+
this.cspellConfigFileReaderWriter.setTrustedUrls([baseUrl]);
|
|
180
181
|
return url;
|
|
181
182
|
}
|
|
182
183
|
importSettings(fileRef, pnpSettings, backReferences) {
|
|
@@ -250,6 +251,8 @@ export class ConfigLoader {
|
|
|
250
251
|
}
|
|
251
252
|
}
|
|
252
253
|
async setupPnp(cfgFile, pnpSettings) {
|
|
254
|
+
if (!this.#isTrusted)
|
|
255
|
+
return;
|
|
253
256
|
if (!pnpSettings?.usePnP || pnpSettings === defaultPnPSettings)
|
|
254
257
|
return;
|
|
255
258
|
if (cfgFile.url.protocol !== 'file:')
|
|
@@ -410,6 +413,14 @@ export class ConfigLoader {
|
|
|
410
413
|
this.configSearch = new ConfigSearch(searchPlaces, isTrusted ? trustedSearch : unTrustedSearch, this.fs);
|
|
411
414
|
this.cspellConfigFileReaderWriter.setUntrustedExtensions(isTrusted ? [] : defaultJsExtensions);
|
|
412
415
|
}
|
|
416
|
+
isTrustedUrl(url) {
|
|
417
|
+
if (!this.#isTrusted) {
|
|
418
|
+
const ext = path.extname(url.pathname).toLowerCase();
|
|
419
|
+
if (defaultJsExtensions.includes(ext))
|
|
420
|
+
return false;
|
|
421
|
+
}
|
|
422
|
+
return this.cspellConfigFileReaderWriter.isTrusted(url);
|
|
423
|
+
}
|
|
413
424
|
async #extractStopSearchAtURLs(options) {
|
|
414
425
|
if (!options?.stopSearchAt)
|
|
415
426
|
return undefined;
|
|
@@ -30,6 +30,10 @@ export interface DocumentValidatorOptions extends ValidateTextOptions {
|
|
|
30
30
|
* If not set, the current working directory will be used.
|
|
31
31
|
*/
|
|
32
32
|
resolveImportsRelativeTo?: string | URL;
|
|
33
|
+
/**
|
|
34
|
+
* If true, the document will be checked even if it would normally be excluded.
|
|
35
|
+
*/
|
|
36
|
+
forceCheck?: boolean;
|
|
33
37
|
}
|
|
34
38
|
type PerfTimings = Record<string, number>;
|
|
35
39
|
export declare class DocumentValidator {
|
|
@@ -97,7 +97,7 @@ export class DocumentValidator {
|
|
|
97
97
|
recGlobMatcherTime();
|
|
98
98
|
const recShouldCheckTime = recordPerfTime(this.perfTiming, '_shouldCheck');
|
|
99
99
|
// eslint-disable-next-line unicorn/prefer-regexp-test
|
|
100
|
-
const shouldCheck = !matcher.match(uriToFilePath(uri)) && (docSettings.enabled ?? true);
|
|
100
|
+
const shouldCheck = options.forceCheck || (!matcher.match(uriToFilePath(uri)) && (docSettings.enabled ?? true));
|
|
101
101
|
recShouldCheckTime();
|
|
102
102
|
const recFinalizeTime = recordPerfTime(this.perfTiming, '_finalizeSettings');
|
|
103
103
|
const finalSettings = finalizeSettings(docSettings);
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"provenance": true
|
|
6
6
|
},
|
|
7
|
-
"version": "10.
|
|
7
|
+
"version": "10.2.0-alpha.1",
|
|
8
8
|
"description": "A library of useful functions used across various cspell tools.",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": false,
|
|
@@ -75,44 +75,44 @@
|
|
|
75
75
|
},
|
|
76
76
|
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-lib#readme",
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@cspell/cspell-bundled-dicts": "10.
|
|
79
|
-
"@cspell/cspell-performance-monitor": "10.
|
|
80
|
-
"@cspell/cspell-pipe": "10.
|
|
81
|
-
"@cspell/cspell-resolver": "10.
|
|
82
|
-
"@cspell/cspell-types": "10.
|
|
83
|
-
"@cspell/dynamic-import": "10.
|
|
84
|
-
"@cspell/filetypes": "10.
|
|
85
|
-
"@cspell/rpc": "10.
|
|
86
|
-
"@cspell/strong-weak-map": "10.
|
|
87
|
-
"@cspell/url": "10.
|
|
88
|
-
"cspell-config-lib": "10.
|
|
89
|
-
"cspell-dictionary": "10.
|
|
90
|
-
"cspell-glob": "10.
|
|
91
|
-
"cspell-grammar": "10.
|
|
92
|
-
"cspell-io": "10.
|
|
93
|
-
"cspell-trie-lib": "10.
|
|
78
|
+
"@cspell/cspell-bundled-dicts": "10.2.0-alpha.1",
|
|
79
|
+
"@cspell/cspell-performance-monitor": "10.2.0-alpha.1",
|
|
80
|
+
"@cspell/cspell-pipe": "10.2.0-alpha.1",
|
|
81
|
+
"@cspell/cspell-resolver": "10.2.0-alpha.1",
|
|
82
|
+
"@cspell/cspell-types": "10.2.0-alpha.1",
|
|
83
|
+
"@cspell/dynamic-import": "10.2.0-alpha.1",
|
|
84
|
+
"@cspell/filetypes": "10.2.0-alpha.1",
|
|
85
|
+
"@cspell/rpc": "10.2.0-alpha.1",
|
|
86
|
+
"@cspell/strong-weak-map": "10.2.0-alpha.1",
|
|
87
|
+
"@cspell/url": "10.2.0-alpha.1",
|
|
88
|
+
"cspell-config-lib": "10.2.0-alpha.1",
|
|
89
|
+
"cspell-dictionary": "10.2.0-alpha.1",
|
|
90
|
+
"cspell-glob": "10.2.0-alpha.1",
|
|
91
|
+
"cspell-grammar": "10.2.0-alpha.1",
|
|
92
|
+
"cspell-io": "10.2.0-alpha.1",
|
|
93
|
+
"cspell-trie-lib": "10.2.0-alpha.1",
|
|
94
94
|
"env-paths": "^4.0.0",
|
|
95
95
|
"gensequence": "^8.0.8",
|
|
96
96
|
"import-fresh": "^4.0.0",
|
|
97
97
|
"resolve-from": "^5.0.0",
|
|
98
|
-
"vscode-languageserver-textdocument": "^1.0.
|
|
99
|
-
"vscode-uri": "^3.
|
|
98
|
+
"vscode-languageserver-textdocument": "^1.0.14",
|
|
99
|
+
"vscode-uri": "^3.2.0",
|
|
100
100
|
"xdg-basedir": "^5.1.0"
|
|
101
101
|
},
|
|
102
102
|
"engines": {
|
|
103
103
|
"node": ">=22.18.0"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
|
-
"@cspell/cspell-tools": "10.
|
|
106
|
+
"@cspell/cspell-tools": "10.2.0-alpha.1",
|
|
107
107
|
"@cspell/dict-cpp": "^7.1.0",
|
|
108
108
|
"@cspell/dict-csharp": "^4.0.8",
|
|
109
109
|
"@cspell/dict-css": "^4.1.2",
|
|
110
|
-
"@cspell/dict-en_us": "^4.4.
|
|
110
|
+
"@cspell/dict-en_us": "^4.4.37",
|
|
111
111
|
"@cspell/dict-fa-ir": "^4.0.5",
|
|
112
112
|
"@cspell/dict-fr-fr": "^2.3.2",
|
|
113
113
|
"@cspell/dict-html": "^4.0.16",
|
|
114
114
|
"@cspell/dict-nl-nl": "^2.4.2",
|
|
115
|
-
"@cspell/dict-python": "^4.4.
|
|
115
|
+
"@cspell/dict-python": "^4.4.1",
|
|
116
116
|
"@cspell/dictionary-bundler-plugin": "",
|
|
117
117
|
"@types/configstore": "^6.0.2",
|
|
118
118
|
"comment-json": "^5.0.0",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"lorem-ipsum": "^3.0.0",
|
|
123
123
|
"perf-insight": "^2.0.1"
|
|
124
124
|
},
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "6f2e2705b7f91a807273cbbd821582a372774a9d"
|
|
126
126
|
}
|