cspell-lib 10.1.0 → 10.1.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;
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"provenance": true
|
|
6
6
|
},
|
|
7
|
-
"version": "10.1.
|
|
7
|
+
"version": "10.1.1",
|
|
8
8
|
"description": "A library of useful functions used across various cspell tools.",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": false,
|
|
@@ -75,22 +75,22 @@
|
|
|
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.1.
|
|
79
|
-
"@cspell/cspell-performance-monitor": "10.1.
|
|
80
|
-
"@cspell/cspell-pipe": "10.1.
|
|
81
|
-
"@cspell/cspell-resolver": "10.1.
|
|
82
|
-
"@cspell/cspell-types": "10.1.
|
|
83
|
-
"@cspell/dynamic-import": "10.1.
|
|
84
|
-
"@cspell/filetypes": "10.1.
|
|
85
|
-
"@cspell/rpc": "10.1.
|
|
86
|
-
"@cspell/strong-weak-map": "10.1.
|
|
87
|
-
"@cspell/url": "10.1.
|
|
88
|
-
"cspell-config-lib": "10.1.
|
|
89
|
-
"cspell-dictionary": "10.1.
|
|
90
|
-
"cspell-glob": "10.1.
|
|
91
|
-
"cspell-grammar": "10.1.
|
|
92
|
-
"cspell-io": "10.1.
|
|
93
|
-
"cspell-trie-lib": "10.1.
|
|
78
|
+
"@cspell/cspell-bundled-dicts": "10.1.1",
|
|
79
|
+
"@cspell/cspell-performance-monitor": "10.1.1",
|
|
80
|
+
"@cspell/cspell-pipe": "10.1.1",
|
|
81
|
+
"@cspell/cspell-resolver": "10.1.1",
|
|
82
|
+
"@cspell/cspell-types": "10.1.1",
|
|
83
|
+
"@cspell/dynamic-import": "10.1.1",
|
|
84
|
+
"@cspell/filetypes": "10.1.1",
|
|
85
|
+
"@cspell/rpc": "10.1.1",
|
|
86
|
+
"@cspell/strong-weak-map": "10.1.1",
|
|
87
|
+
"@cspell/url": "10.1.1",
|
|
88
|
+
"cspell-config-lib": "10.1.1",
|
|
89
|
+
"cspell-dictionary": "10.1.1",
|
|
90
|
+
"cspell-glob": "10.1.1",
|
|
91
|
+
"cspell-grammar": "10.1.1",
|
|
92
|
+
"cspell-io": "10.1.1",
|
|
93
|
+
"cspell-trie-lib": "10.1.1",
|
|
94
94
|
"env-paths": "^4.0.0",
|
|
95
95
|
"gensequence": "^8.0.8",
|
|
96
96
|
"import-fresh": "^4.0.0",
|
|
@@ -103,7 +103,7 @@
|
|
|
103
103
|
"node": ">=22.18.0"
|
|
104
104
|
},
|
|
105
105
|
"devDependencies": {
|
|
106
|
-
"@cspell/cspell-tools": "10.1.
|
|
106
|
+
"@cspell/cspell-tools": "10.1.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",
|
|
@@ -122,5 +122,5 @@
|
|
|
122
122
|
"lorem-ipsum": "^3.0.0",
|
|
123
123
|
"perf-insight": "^2.0.1"
|
|
124
124
|
},
|
|
125
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "bc3bc22aa1aa1b3073768f2ac9cf0d9a06f65177"
|
|
126
126
|
}
|