cspell-lib 9.7.0 → 10.0.0
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/CSpellSettingsServer.js +1 -2
- package/dist/lib/Settings/Controller/configLoader/configLoader.js +1 -2
- package/dist/lib/Settings/Controller/pnpLoader.js +16 -18
- package/dist/lib/spellCheckFile.d.ts +1 -1
- package/dist/lib/textValidation/docValidator.d.ts +1 -2
- package/dist/lib/util/fileReader.d.ts +1 -1
- package/package.json +26 -27
|
@@ -4,8 +4,7 @@ import { autoResolveWeak, AutoResolveWeakCache } from '../util/AutoResolve.js';
|
|
|
4
4
|
import { toFileUrl } from '../util/url.js';
|
|
5
5
|
import * as util from '../util/util.js';
|
|
6
6
|
import { configSettingsFileVersion0_1, ENV_CSPELL_GLOB_ROOT } from './constants.js';
|
|
7
|
-
import { calcDictionaryDefsToLoad, mapDictDefsToInternal } from './internal/index.js';
|
|
8
|
-
import { cleanCSpellSettingsInternal as csi, isCSpellSettingsInternal } from './internal/index.js';
|
|
7
|
+
import { calcDictionaryDefsToLoad, cleanCSpellSettingsInternal as csi, isCSpellSettingsInternal, mapDictDefsToInternal, } from './internal/index.js';
|
|
9
8
|
import { mergeList, mergeListUnique } from './mergeList.js';
|
|
10
9
|
import { resolvePatterns } from './patterns.js';
|
|
11
10
|
import { CwdUrlResolver } from './resolveCwd.js';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import assert from 'node:assert';
|
|
2
2
|
import path from 'node:path';
|
|
3
3
|
import { fileURLToPath } from 'node:url';
|
|
4
|
-
import { CSpellConfigFile, CSpellConfigFileWithErrors } from 'cspell-config-lib';
|
|
5
|
-
import { createReaderWriter } from 'cspell-config-lib';
|
|
4
|
+
import { createReaderWriter, CSpellConfigFile, CSpellConfigFileWithErrors } from 'cspell-config-lib';
|
|
6
5
|
import { CSPELL_VFS_PROTOCOL, isUrlLike, toFileURL } from 'cspell-io';
|
|
7
6
|
import { URI, Utils as UriUtils } from 'vscode-uri';
|
|
8
7
|
import { onClearCache } from '../../../events/index.js';
|
|
@@ -2,8 +2,7 @@
|
|
|
2
2
|
* Handles loading of `.pnp.js` and `.pnp.js` files.
|
|
3
3
|
*/
|
|
4
4
|
import { fileURLToPath } from 'node:url';
|
|
5
|
-
import
|
|
6
|
-
import importFresh from 'import-fresh';
|
|
5
|
+
import createImportFresh from 'import-fresh';
|
|
7
6
|
import { findUp } from '../../util/findUp.js';
|
|
8
7
|
import { toFileUrl } from '../../util/url.js';
|
|
9
8
|
import { UnsupportedPnpFile } from './ImportError.js';
|
|
@@ -11,7 +10,7 @@ const defaultPnpFiles = ['.pnp.cjs', '.pnp.js'];
|
|
|
11
10
|
const supportedSchemas = new Set(['file:']);
|
|
12
11
|
const cachedRequests = new Map();
|
|
13
12
|
let lock = undefined;
|
|
14
|
-
const
|
|
13
|
+
const cachedPnpImports = new Map();
|
|
15
14
|
const cachedRequestsSync = new Map();
|
|
16
15
|
export class PnpLoader {
|
|
17
16
|
pnpFiles;
|
|
@@ -59,28 +58,29 @@ export class PnpLoader {
|
|
|
59
58
|
export function pnpLoader(pnpFiles) {
|
|
60
59
|
return new PnpLoader(pnpFiles);
|
|
61
60
|
}
|
|
62
|
-
/**
|
|
63
|
-
* @param urlDirectory - directory to start at.
|
|
64
|
-
*/
|
|
65
61
|
async function findPnpAndLoad(urlDirectory, pnpFiles) {
|
|
66
62
|
const found = await findUp(pnpFiles, { cwd: fileURLToPath(urlDirectory) });
|
|
67
63
|
return loadPnpIfNeeded(found);
|
|
68
64
|
}
|
|
69
|
-
function loadPnpIfNeeded(found) {
|
|
65
|
+
async function loadPnpIfNeeded(found) {
|
|
70
66
|
if (!found)
|
|
71
67
|
return undefined;
|
|
72
|
-
const
|
|
73
|
-
if (
|
|
74
|
-
return
|
|
68
|
+
const cached = cachedPnpImports.get(found);
|
|
69
|
+
if (cached)
|
|
70
|
+
return cached;
|
|
75
71
|
const r = loadPnp(found);
|
|
76
|
-
|
|
72
|
+
cachedPnpImports.set(found, r);
|
|
73
|
+
// If loading fails, remove from cache so subsequent calls can retry.
|
|
74
|
+
r.catch(() => cachedPnpImports.delete(found));
|
|
77
75
|
return r;
|
|
78
76
|
}
|
|
79
|
-
function loadPnp(pnpFile) {
|
|
80
|
-
const
|
|
81
|
-
|
|
77
|
+
async function loadPnp(pnpFile) {
|
|
78
|
+
const pnpFileUrl = toFileUrl(pnpFile);
|
|
79
|
+
const importFresh = createImportFresh(pnpFileUrl);
|
|
80
|
+
const { default: pnp } = await importFresh(pnpFileUrl.href);
|
|
81
|
+
if (pnp?.setup) {
|
|
82
82
|
pnp.setup();
|
|
83
|
-
return
|
|
83
|
+
return pnpFileUrl;
|
|
84
84
|
}
|
|
85
85
|
throw new UnsupportedPnpFile(`Unsupported pnp file: "${pnpFile}"`);
|
|
86
86
|
}
|
|
@@ -94,11 +94,9 @@ export function clearPnPGlobalCache() {
|
|
|
94
94
|
}
|
|
95
95
|
async function _cleanCache() {
|
|
96
96
|
await Promise.all([...cachedRequests.values()].map(rejectToUndefined));
|
|
97
|
-
|
|
98
|
-
modules.forEach((r) => r && clearModule.single(fileURLToPath(r)));
|
|
97
|
+
cachedPnpImports.clear();
|
|
99
98
|
cachedRequests.clear();
|
|
100
99
|
cachedRequestsSync.clear();
|
|
101
|
-
cachedPnpImportsSync.clear();
|
|
102
100
|
return undefined;
|
|
103
101
|
}
|
|
104
102
|
function rejectToUndefined(p) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { CSpellSettingsWithSourceTrace, CSpellUserSettings } from '@cspell/cspell-types';
|
|
2
2
|
import type { ICSpellConfigFile } from 'cspell-config-lib';
|
|
3
3
|
import type { Document, DocumentWithText } from './Document/index.js';
|
|
4
|
-
import {
|
|
4
|
+
import type { ValidationIssueRPC } from './Models/ValidationIssue.js';
|
|
5
5
|
import type { ImportFileRefWithError } from './Settings/index.js';
|
|
6
6
|
import type { Uri } from './util/IUri.js';
|
|
7
7
|
import type { ValidateTextOptions, ValidationIssue } from './validator.js';
|
|
@@ -3,8 +3,7 @@ import type { ICSpellConfigFile } from 'cspell-config-lib';
|
|
|
3
3
|
import type { ExtendedSuggestion } from '../Models/Suggestion.js';
|
|
4
4
|
import type { TextDocument, TextDocumentRef } from '../Models/TextDocument.js';
|
|
5
5
|
import type { ValidationIssue } from '../Models/ValidationIssue.js';
|
|
6
|
-
import type { ImportFileRefWithError } from '../Settings/index.js';
|
|
7
|
-
import type { CSpellSettingsInternal, CSpellSettingsInternalFinalized } from '../Settings/index.js';
|
|
6
|
+
import type { CSpellSettingsInternal, CSpellSettingsInternalFinalized, ImportFileRefWithError } from '../Settings/index.js';
|
|
8
7
|
import type { SpellingDictionaryCollection } from '../SpellingDictionary/index.js';
|
|
9
8
|
import type { WordSuggestion } from '../suggestions.js';
|
|
10
9
|
import type { MatchRange, SimpleRange, SubstitutionTransformer } from '../Transform/index.js';
|
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"provenance": true
|
|
6
6
|
},
|
|
7
|
-
"version": "
|
|
7
|
+
"version": "10.0.0",
|
|
8
8
|
"description": "A library of useful functions used across various cspell tools.",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": false,
|
|
@@ -75,53 +75,52 @@
|
|
|
75
75
|
},
|
|
76
76
|
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-lib#readme",
|
|
77
77
|
"dependencies": {
|
|
78
|
-
"@cspell/cspell-bundled-dicts": "
|
|
79
|
-
"@cspell/cspell-performance-monitor": "
|
|
80
|
-
"@cspell/cspell-pipe": "
|
|
81
|
-
"@cspell/cspell-resolver": "
|
|
82
|
-
"@cspell/cspell-types": "
|
|
83
|
-
"@cspell/dynamic-import": "
|
|
84
|
-
"@cspell/filetypes": "
|
|
85
|
-
"@cspell/rpc": "
|
|
86
|
-
"@cspell/strong-weak-map": "
|
|
87
|
-
"@cspell/url": "
|
|
88
|
-
"
|
|
89
|
-
"cspell-
|
|
90
|
-
"cspell-
|
|
91
|
-
"cspell-
|
|
92
|
-
"cspell-
|
|
93
|
-
"cspell-
|
|
94
|
-
"cspell-trie-lib": "9.7.0",
|
|
78
|
+
"@cspell/cspell-bundled-dicts": "10.0.0",
|
|
79
|
+
"@cspell/cspell-performance-monitor": "10.0.0",
|
|
80
|
+
"@cspell/cspell-pipe": "10.0.0",
|
|
81
|
+
"@cspell/cspell-resolver": "10.0.0",
|
|
82
|
+
"@cspell/cspell-types": "10.0.0",
|
|
83
|
+
"@cspell/dynamic-import": "10.0.0",
|
|
84
|
+
"@cspell/filetypes": "10.0.0",
|
|
85
|
+
"@cspell/rpc": "10.0.0",
|
|
86
|
+
"@cspell/strong-weak-map": "10.0.0",
|
|
87
|
+
"@cspell/url": "10.0.0",
|
|
88
|
+
"cspell-config-lib": "10.0.0",
|
|
89
|
+
"cspell-dictionary": "10.0.0",
|
|
90
|
+
"cspell-glob": "10.0.0",
|
|
91
|
+
"cspell-grammar": "10.0.0",
|
|
92
|
+
"cspell-io": "10.0.0",
|
|
93
|
+
"cspell-trie-lib": "10.0.0",
|
|
95
94
|
"env-paths": "^4.0.0",
|
|
96
95
|
"gensequence": "^8.0.8",
|
|
97
|
-
"import-fresh": "^
|
|
96
|
+
"import-fresh": "^4.0.0",
|
|
98
97
|
"resolve-from": "^5.0.0",
|
|
99
98
|
"vscode-languageserver-textdocument": "^1.0.12",
|
|
100
99
|
"vscode-uri": "^3.1.0",
|
|
101
100
|
"xdg-basedir": "^5.1.0"
|
|
102
101
|
},
|
|
103
102
|
"engines": {
|
|
104
|
-
"node": ">=
|
|
103
|
+
"node": ">=22.18.0"
|
|
105
104
|
},
|
|
106
105
|
"devDependencies": {
|
|
107
|
-
"@cspell/cspell-tools": "
|
|
106
|
+
"@cspell/cspell-tools": "10.0.0",
|
|
108
107
|
"@cspell/dict-cpp": "^7.0.2",
|
|
109
108
|
"@cspell/dict-csharp": "^4.0.8",
|
|
110
|
-
"@cspell/dict-css": "^4.
|
|
111
|
-
"@cspell/dict-en_us": "^4.4.
|
|
109
|
+
"@cspell/dict-css": "^4.1.1",
|
|
110
|
+
"@cspell/dict-en_us": "^4.4.33",
|
|
112
111
|
"@cspell/dict-fa-ir": "^4.0.5",
|
|
113
112
|
"@cspell/dict-fr-fr": "^2.3.2",
|
|
114
|
-
"@cspell/dict-html": "^4.0.
|
|
113
|
+
"@cspell/dict-html": "^4.0.15",
|
|
115
114
|
"@cspell/dict-nl-nl": "^2.4.2",
|
|
116
|
-
"@cspell/dict-python": "^4.2.
|
|
115
|
+
"@cspell/dict-python": "^4.2.26",
|
|
117
116
|
"@cspell/dictionary-bundler-plugin": "",
|
|
118
117
|
"@types/configstore": "^6.0.2",
|
|
119
|
-
"comment-json": "^4.
|
|
118
|
+
"comment-json": "^4.6.2",
|
|
120
119
|
"configstore": "^8.0.0",
|
|
121
120
|
"cspell-dict-nl-nl": "^1.1.2",
|
|
122
121
|
"leaked-handles": "^5.2.0",
|
|
123
122
|
"lorem-ipsum": "^2.0.8",
|
|
124
123
|
"perf-insight": "^2.0.1"
|
|
125
124
|
},
|
|
126
|
-
"gitHead": "
|
|
125
|
+
"gitHead": "6ddfd576b6bb554a7cb8dba1ab053a0b6ff8021f"
|
|
127
126
|
}
|