@cspell/cspell-tools 6.29.1 → 6.29.3
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.
|
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.legacyLinesToWords = exports.legacyLineToWords = void 0;
|
|
4
4
|
const sync_1 = require("@cspell/cspell-pipe/sync");
|
|
5
5
|
const splitCamelCaseIfAllowed_1 = require("./splitCamelCaseIfAllowed");
|
|
6
|
-
const regNonWord = /[^\p{L}\p{M}' \d]+/giu;
|
|
6
|
+
const regNonWord = /[^\p{L}\p{M}' _\d]+/giu;
|
|
7
7
|
const regExpRepeatChars = /(.)\1{5}/i;
|
|
8
8
|
function legacyLineToWords(line, keepCase, allowedSplitWords) {
|
|
9
9
|
// Remove punctuation and non-letters.
|
|
@@ -56,7 +56,7 @@ function isUnknown(word, allowedWords) {
|
|
|
56
56
|
return !allowedWords.has(word) && !allowedWords.has(word.toLowerCase());
|
|
57
57
|
}
|
|
58
58
|
function splitCamelCase(word) {
|
|
59
|
-
const splitWords = Text.splitCamelCaseWord(word).filter((word) => !exports.regExpIsNumber.test(word));
|
|
59
|
+
const splitWords = Text.splitCamelCaseWord(word, false).filter((word) => !exports.regExpIsNumber.test(word));
|
|
60
60
|
// We only want to preserve this: "New York" and not "Namespace DNSLookup"
|
|
61
61
|
if (splitWords.length > 1 && exports.regExpSpaceOrDash.test(word)) {
|
|
62
62
|
return splitWords.flatMap((w) => w.split(exports.regExpSpaceOrDash));
|
package/dist/compiler/text.d.ts
CHANGED
package/dist/compiler/text.js
CHANGED
|
@@ -8,8 +8,8 @@ const regExSplitWords2 = /(\p{Lu})(\p{Lu}\p{Ll})/gu;
|
|
|
8
8
|
/**
|
|
9
9
|
* Split camelCase words into an array of strings.
|
|
10
10
|
*/
|
|
11
|
-
function splitCamelCaseWord(word) {
|
|
12
|
-
const wPrime = word.replace(regExUpperSOrIng, (s) => s[0] + s.slice(1).toLowerCase());
|
|
11
|
+
function splitCamelCaseWord(word, autoStem = true) {
|
|
12
|
+
const wPrime = autoStem ? word.replace(regExUpperSOrIng, (s) => s[0] + s.slice(1).toLowerCase()) : word;
|
|
13
13
|
const pass1 = wPrime.replace(regExSplitWords, '$1|$2');
|
|
14
14
|
const pass2 = pass1.replace(regExSplitWords2, '$1|$2');
|
|
15
15
|
const pass3 = pass2.replace(/[\d_]+/g, '|');
|
|
@@ -40,11 +40,19 @@ const wordListHeader = `
|
|
|
40
40
|
`;
|
|
41
41
|
const wordListHeaderLines = wordListHeader.split('\n').map((a) => a.trim());
|
|
42
42
|
async function compileWordList(lines, destFilename, options) {
|
|
43
|
-
const
|
|
44
|
-
const finalSeq = (0, sync_1.pipe)(wordListHeaderLines, (0, sync_1.opAppend)(
|
|
43
|
+
const finalLines = normalize(lines, options);
|
|
44
|
+
const finalSeq = (0, sync_1.pipe)(wordListHeaderLines, (0, sync_1.opAppend)(finalLines));
|
|
45
45
|
return createWordListTarget(destFilename)(finalSeq);
|
|
46
46
|
}
|
|
47
47
|
exports.compileWordList = compileWordList;
|
|
48
|
+
function normalize(lines, options) {
|
|
49
|
+
const filter = (0, wordListParser_1.normalizeTargetWords)(options);
|
|
50
|
+
const iter = (0, sync_1.pipe)(lines, filter);
|
|
51
|
+
if (!options.sort)
|
|
52
|
+
return iter;
|
|
53
|
+
const result = new Set(iter);
|
|
54
|
+
return [...result].sort();
|
|
55
|
+
}
|
|
48
56
|
function createWordListTarget(destFilename) {
|
|
49
57
|
const target = createTarget(destFilename);
|
|
50
58
|
return (seq) => target((0, sync_1.pipe)(seq, (0, sync_1.opMap)((a) => a + '\n')));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cspell/cspell-tools",
|
|
3
|
-
"version": "6.29.
|
|
3
|
+
"version": "6.29.3",
|
|
4
4
|
"description": "Tools to assist with the development of cSpell",
|
|
5
5
|
"typings": "dist/index.d.ts",
|
|
6
6
|
"publishConfig": {
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
},
|
|
49
49
|
"homepage": "https://github.com/streetsidesoftware/cspell#readme",
|
|
50
50
|
"dependencies": {
|
|
51
|
-
"@cspell/cspell-pipe": "6.29.
|
|
51
|
+
"@cspell/cspell-pipe": "6.29.3",
|
|
52
52
|
"commander": "^10.0.0",
|
|
53
53
|
"cosmiconfig": "^8.1.0",
|
|
54
|
-
"cspell-trie-lib": "6.29.
|
|
54
|
+
"cspell-trie-lib": "6.29.3",
|
|
55
55
|
"gensequence": "^5.0.2",
|
|
56
56
|
"glob": "^8.1.0",
|
|
57
|
-
"hunspell-reader": "6.29.
|
|
57
|
+
"hunspell-reader": "6.29.3"
|
|
58
58
|
},
|
|
59
59
|
"engines": {
|
|
60
60
|
"node": ">=14"
|
|
@@ -69,5 +69,5 @@
|
|
|
69
69
|
"ts-json-schema-generator": "^1.2.0"
|
|
70
70
|
},
|
|
71
71
|
"main": "bin.js",
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "a46e27dd5e9d52d83f0bfdbeeafcda58ca516fc1"
|
|
73
73
|
}
|