cspell-lib 5.12.2 → 5.12.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.
@@ -14,6 +14,7 @@ export interface Loaders {
14
14
  S: Loader;
15
15
  C: Loader;
16
16
  T: Loader;
17
+ W: Loader;
17
18
  default: Loader;
18
19
  }
19
20
  export declare function loadDictionary(uri: string, options: DictionaryDefinitionPreferred): Promise<SpellingDictionary>;
@@ -31,6 +31,7 @@ const MAX_AGE = 10000;
31
31
  const loaders = {
32
32
  S: loadSimpleWordList,
33
33
  C: legacyWordList,
34
+ W: wordsPerLineWordList,
34
35
  T: loadTrie,
35
36
  default: loadSimpleWordList,
36
37
  };
@@ -115,6 +116,16 @@ async function legacyWordList(filename, options) {
115
116
  .filter((word) => !!word);
116
117
  return (0, createSpellingDictionary_1.createSpellingDictionary)(words, determineName(filename, options), filename, options);
117
118
  }
119
+ async function wordsPerLineWordList(filename, options) {
120
+ const lines = await (0, fileReader_1.readLines)(filename);
121
+ const words = (0, gensequence_1.genSequence)(lines)
122
+ // Remove comments
123
+ .map((line) => line.replace(/#.*/g, ''))
124
+ // Split on everything else
125
+ .concatMap((line) => line.split(/\s+/gu))
126
+ .filter((word) => !!word);
127
+ return (0, createSpellingDictionary_1.createSpellingDictionary)(words, determineName(filename, options), filename, options);
128
+ }
118
129
  async function loadSimpleWordList(filename, options) {
119
130
  const lines = await (0, fileReader_1.readLines)(filename);
120
131
  return (0, createSpellingDictionary_1.createSpellingDictionary)(lines, determineName(filename, options), filename, options);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell-lib",
3
- "version": "5.12.2",
3
+ "version": "5.12.3",
4
4
  "description": "A library of useful functions used across various cspell tools.",
5
5
  "main": "dist/index.js",
6
6
  "typings": "dist/index.d.ts",
@@ -47,15 +47,15 @@
47
47
  },
48
48
  "homepage": "https://github.com/streetsidesoftware/cspell#readme",
49
49
  "dependencies": {
50
- "@cspell/cspell-bundled-dicts": "^5.12.2",
51
- "@cspell/cspell-types": "^5.12.2",
50
+ "@cspell/cspell-bundled-dicts": "^5.12.3",
51
+ "@cspell/cspell-types": "^5.12.3",
52
52
  "clear-module": "^4.1.1",
53
53
  "comment-json": "^4.1.1",
54
54
  "configstore": "^5.0.1",
55
55
  "cosmiconfig": "^7.0.1",
56
- "cspell-glob": "^5.12.2",
57
- "cspell-io": "^5.12.2",
58
- "cspell-trie-lib": "^5.12.2",
56
+ "cspell-glob": "^5.12.3",
57
+ "cspell-io": "^5.12.3",
58
+ "cspell-trie-lib": "^5.12.3",
59
59
  "find-up": "^5.0.0",
60
60
  "fs-extra": "^10.0.0",
61
61
  "gensequence": "^3.1.1",
@@ -81,10 +81,10 @@
81
81
  "@types/jest": "^27.0.2",
82
82
  "@types/node": "^16.10.3",
83
83
  "cspell-dict-nl-nl": "^1.1.2",
84
- "jest": "^27.2.4",
84
+ "jest": "^27.2.5",
85
85
  "lorem-ipsum": "^2.0.4",
86
86
  "rimraf": "^3.0.2",
87
87
  "ts-jest": "^27.0.5"
88
88
  },
89
- "gitHead": "1418785bb9c3a29b794a6e9d447b5638f8eb9fbf"
89
+ "gitHead": "6c424aed933adb8d983ab09dd45042d63d7a5cd8"
90
90
  }