cspell-lib 9.6.3 → 9.7.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/Models/ValidationIssue.d.ts +8 -1
- package/dist/lib/Models/ValidationIssue.js +15 -1
- package/dist/lib/Models/ValidationResult.d.ts +24 -3
- package/dist/lib/Settings/CSpellSettingsServer.js +1 -0
- package/dist/lib/Settings/Controller/configLoader/configLoader.d.ts +2 -2
- package/dist/lib/Settings/Controller/configLoader/configLoader.js +26 -4
- package/dist/lib/Settings/Controller/configLoader/defaultConfigLoader.d.ts +0 -1
- package/dist/lib/Settings/DefaultSettings.d.ts +11 -0
- package/dist/lib/Settings/DefaultSettings.js +14 -3
- package/dist/lib/Settings/DictionaryReferenceCollection.d.ts +9 -1
- package/dist/lib/Settings/DictionaryReferenceCollection.js +5 -0
- package/dist/lib/Settings/constants.js +1 -0
- package/dist/lib/Settings/index.d.ts +2 -0
- package/dist/lib/Settings/index.js +1 -0
- package/dist/lib/Settings/sanitizeSettings.js +6 -0
- package/dist/lib/Transform/SourceMap.d.ts +115 -0
- package/dist/lib/Transform/SourceMap.js +469 -0
- package/dist/lib/Transform/SubstitutionTransformer.d.ts +32 -0
- package/dist/lib/Transform/SubstitutionTransformer.js +121 -0
- package/dist/lib/Transform/TextMap.d.ts +35 -0
- package/dist/lib/Transform/TextMap.js +86 -0
- package/dist/lib/{util → Transform}/TextRange.js +6 -7
- package/dist/lib/Transform/index.d.ts +9 -0
- package/dist/lib/Transform/index.js +5 -0
- package/dist/lib/{textValidation → Transform}/parsedText.d.ts +5 -6
- package/dist/lib/{textValidation → Transform}/parsedText.js +6 -34
- package/dist/lib/Transform/types.d.ts +5 -0
- package/dist/lib/Transform/types.js +2 -0
- package/dist/lib/index.d.ts +2 -3
- package/dist/lib/index.js +1 -2
- package/dist/lib/spellCheckFile.d.ts +26 -1
- package/dist/lib/spellCheckFile.js +21 -8
- package/dist/lib/textValidation/docValidator.d.ts +4 -5
- package/dist/lib/textValidation/docValidator.js +14 -5
- package/dist/lib/textValidation/index.d.ts +1 -1
- package/dist/lib/textValidation/lineValidatorFactory.d.ts +5 -1
- package/dist/lib/textValidation/lineValidatorFactory.js +5 -3
- package/dist/lib/textValidation/settingsToValidateOptions.js +10 -1
- package/dist/lib/textValidation/textValidator.d.ts +1 -1
- package/dist/lib/textValidation/textValidator.js +1 -1
- package/dist/lib/trace.d.ts +2 -0
- package/dist/lib/trace.js +9 -4
- package/package.json +22 -22
- package/dist/lib/util/TextMap.d.ts +0 -15
- package/dist/lib/util/TextMap.js +0 -54
- /package/dist/lib/{util → Transform}/TextRange.d.ts +0 -0
package/package.json
CHANGED
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
"access": "public",
|
|
5
5
|
"provenance": true
|
|
6
6
|
},
|
|
7
|
-
"version": "9.
|
|
7
|
+
"version": "9.7.0",
|
|
8
8
|
"description": "A library of useful functions used across various cspell tools.",
|
|
9
9
|
"type": "module",
|
|
10
10
|
"sideEffects": false,
|
|
@@ -46,7 +46,6 @@
|
|
|
46
46
|
"coverage": "vitest run --coverage --pool=forks",
|
|
47
47
|
"test-watch": "vitest",
|
|
48
48
|
"prepublishOnly": "pnpm run clean-build",
|
|
49
|
-
"#test": "vitest run --reporter=hanging-process --reporter=default",
|
|
50
49
|
"test": "vitest run --pool=forks",
|
|
51
50
|
"test:update-snapshot": "vitest run -u",
|
|
52
51
|
"test:perf": "NODE_ENV=production insight --file \"**/*.perf.{mjs,js}\"",
|
|
@@ -76,23 +75,23 @@
|
|
|
76
75
|
},
|
|
77
76
|
"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-lib#readme",
|
|
78
77
|
"dependencies": {
|
|
79
|
-
"@cspell/cspell-bundled-dicts": "9.
|
|
80
|
-
"@cspell/cspell-performance-monitor": "9.
|
|
81
|
-
"@cspell/cspell-pipe": "9.
|
|
82
|
-
"@cspell/cspell-resolver": "9.
|
|
83
|
-
"@cspell/cspell-types": "9.
|
|
84
|
-
"@cspell/dynamic-import": "9.
|
|
85
|
-
"@cspell/filetypes": "9.
|
|
86
|
-
"@cspell/rpc": "9.
|
|
87
|
-
"@cspell/strong-weak-map": "9.
|
|
88
|
-
"@cspell/url": "9.
|
|
78
|
+
"@cspell/cspell-bundled-dicts": "9.7.0",
|
|
79
|
+
"@cspell/cspell-performance-monitor": "9.7.0",
|
|
80
|
+
"@cspell/cspell-pipe": "9.7.0",
|
|
81
|
+
"@cspell/cspell-resolver": "9.7.0",
|
|
82
|
+
"@cspell/cspell-types": "9.7.0",
|
|
83
|
+
"@cspell/dynamic-import": "9.7.0",
|
|
84
|
+
"@cspell/filetypes": "9.7.0",
|
|
85
|
+
"@cspell/rpc": "9.7.0",
|
|
86
|
+
"@cspell/strong-weak-map": "9.7.0",
|
|
87
|
+
"@cspell/url": "9.7.0",
|
|
89
88
|
"clear-module": "^4.1.2",
|
|
90
|
-
"cspell-config-lib": "9.
|
|
91
|
-
"cspell-dictionary": "9.
|
|
92
|
-
"cspell-glob": "9.
|
|
93
|
-
"cspell-grammar": "9.
|
|
94
|
-
"cspell-io": "9.
|
|
95
|
-
"cspell-trie-lib": "9.
|
|
89
|
+
"cspell-config-lib": "9.7.0",
|
|
90
|
+
"cspell-dictionary": "9.7.0",
|
|
91
|
+
"cspell-glob": "9.7.0",
|
|
92
|
+
"cspell-grammar": "9.7.0",
|
|
93
|
+
"cspell-io": "9.7.0",
|
|
94
|
+
"cspell-trie-lib": "9.7.0",
|
|
96
95
|
"env-paths": "^4.0.0",
|
|
97
96
|
"gensequence": "^8.0.8",
|
|
98
97
|
"import-fresh": "^3.3.1",
|
|
@@ -105,23 +104,24 @@
|
|
|
105
104
|
"node": ">=20"
|
|
106
105
|
},
|
|
107
106
|
"devDependencies": {
|
|
108
|
-
"@cspell/cspell-tools": "9.
|
|
107
|
+
"@cspell/cspell-tools": "9.7.0",
|
|
109
108
|
"@cspell/dict-cpp": "^7.0.2",
|
|
110
109
|
"@cspell/dict-csharp": "^4.0.8",
|
|
111
110
|
"@cspell/dict-css": "^4.0.19",
|
|
112
|
-
"@cspell/dict-en_us": "^4.4.
|
|
111
|
+
"@cspell/dict-en_us": "^4.4.29",
|
|
113
112
|
"@cspell/dict-fa-ir": "^4.0.5",
|
|
114
113
|
"@cspell/dict-fr-fr": "^2.3.2",
|
|
115
114
|
"@cspell/dict-html": "^4.0.14",
|
|
116
115
|
"@cspell/dict-nl-nl": "^2.4.2",
|
|
117
116
|
"@cspell/dict-python": "^4.2.25",
|
|
117
|
+
"@cspell/dictionary-bundler-plugin": "",
|
|
118
118
|
"@types/configstore": "^6.0.2",
|
|
119
119
|
"comment-json": "^4.5.1",
|
|
120
|
-
"configstore": "^
|
|
120
|
+
"configstore": "^8.0.0",
|
|
121
121
|
"cspell-dict-nl-nl": "^1.1.2",
|
|
122
122
|
"leaked-handles": "^5.2.0",
|
|
123
123
|
"lorem-ipsum": "^2.0.8",
|
|
124
124
|
"perf-insight": "^2.0.1"
|
|
125
125
|
},
|
|
126
|
-
"gitHead": "
|
|
126
|
+
"gitHead": "48f64e0bd95b39011af6dc80cd8ae4d519511f73"
|
|
127
127
|
}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import type { MappedText } from '@cspell/cspell-types';
|
|
2
|
-
import type { Range } from '@cspell/cspell-types/Parser';
|
|
3
|
-
/**
|
|
4
|
-
* Extract a substring from a TextMap.
|
|
5
|
-
* @param textMap - A text range with an optional map
|
|
6
|
-
* @param extractRange - The range in the original document to extract
|
|
7
|
-
* @returns The TextMap covering extractRange
|
|
8
|
-
*/
|
|
9
|
-
export declare function extractTextMapRangeOrigin(textMap: MappedText, extractRange: Range): MappedText;
|
|
10
|
-
interface WithRange {
|
|
11
|
-
readonly range: Range;
|
|
12
|
-
}
|
|
13
|
-
export declare function doesIntersect(textMap: WithRange, rangeOrigin: Range): boolean;
|
|
14
|
-
export {};
|
|
15
|
-
//# sourceMappingURL=TextMap.d.ts.map
|
package/dist/lib/util/TextMap.js
DELETED
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
import assert from 'node:assert';
|
|
2
|
-
/**
|
|
3
|
-
* Extract a substring from a TextMap.
|
|
4
|
-
* @param textMap - A text range with an optional map
|
|
5
|
-
* @param extractRange - The range in the original document to extract
|
|
6
|
-
* @returns The TextMap covering extractRange
|
|
7
|
-
*/
|
|
8
|
-
export function extractTextMapRangeOrigin(textMap, extractRange) {
|
|
9
|
-
const { text: srcTxt, range: srcRange, map: srcMap } = textMap;
|
|
10
|
-
const [r0, r1] = srcRange;
|
|
11
|
-
const startOrig = Math.min(Math.max(extractRange[0], r0), r1);
|
|
12
|
-
const endOrig = Math.min(Math.max(extractRange[1], r0), r1);
|
|
13
|
-
const a = startOrig - r0;
|
|
14
|
-
const b = endOrig - r0;
|
|
15
|
-
const range = [startOrig, endOrig];
|
|
16
|
-
if (!srcMap || !srcMap.length || a === b) {
|
|
17
|
-
const text = srcTxt.slice(a, b);
|
|
18
|
-
return { text, range };
|
|
19
|
-
}
|
|
20
|
-
assert((srcMap.length & 1) === 0, 'Map must be pairs of values.');
|
|
21
|
-
const mapLen = srcMap.length;
|
|
22
|
-
const mapEndSrc = srcMap[mapLen - 2];
|
|
23
|
-
const mapEndDst = srcMap[mapLen - 1];
|
|
24
|
-
const endDiff = srcTxt.length - mapEndDst;
|
|
25
|
-
const head = !srcMap[0] && !srcMap[1] ? [] : [0, 0];
|
|
26
|
-
const tail = [mapEndSrc + endDiff, mapEndDst + endDiff];
|
|
27
|
-
const sMap = [...head, ...srcMap, ...tail];
|
|
28
|
-
let idx = 0;
|
|
29
|
-
for (; idx < sMap.length && a >= sMap[idx]; idx += 2) {
|
|
30
|
-
// empty
|
|
31
|
-
}
|
|
32
|
-
const aIdx = idx;
|
|
33
|
-
idx -= 2;
|
|
34
|
-
const a0 = a - sMap[idx];
|
|
35
|
-
const a1 = a0 + sMap[idx + 1];
|
|
36
|
-
for (; idx < sMap.length && b > sMap[idx]; idx += 2) {
|
|
37
|
-
// empty
|
|
38
|
-
}
|
|
39
|
-
const bIdx = idx;
|
|
40
|
-
const b0 = b - sMap[idx];
|
|
41
|
-
const b1 = b0 + sMap[idx + 1];
|
|
42
|
-
const text = srcTxt.slice(a1, b1);
|
|
43
|
-
if (bIdx === aIdx) {
|
|
44
|
-
return { text, range };
|
|
45
|
-
}
|
|
46
|
-
const ab = [a0, a1];
|
|
47
|
-
const map = sMap.slice(aIdx, bIdx + 2).map((v, i) => v - ab[i & 1]);
|
|
48
|
-
return { text, range, map };
|
|
49
|
-
}
|
|
50
|
-
export function doesIntersect(textMap, rangeOrigin) {
|
|
51
|
-
const r = textMap.range;
|
|
52
|
-
return r[0] < rangeOrigin[1] && r[1] > rangeOrigin[0];
|
|
53
|
-
}
|
|
54
|
-
//# sourceMappingURL=TextMap.js.map
|
|
File without changes
|