cspell-lib 8.8.1 → 8.8.2

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.
Files changed (2) hide show
  1. package/README.md +92 -2
  2. package/package.json +15 -15
package/README.md CHANGED
@@ -1,3 +1,93 @@
1
- # cspell-lib
1
+ # CSpell Library
2
2
 
3
- A library of useful functions used across various cspell tools.
3
+ `cspell-lib` is the workhorse behind cspell. It does all the heavy lifting necessary to spell check files.
4
+
5
+ ## Support Future Development
6
+
7
+ <!--- @@inject: ../../static/sponsor.md --->
8
+
9
+ - [![GitHub Sponsors](https://img.shields.io/badge/-black?style=social&logo=githubsponsors&label=GitHub%20Sponsor%3A%20Street%20Side%20Software)](https://github.com/sponsors/streetsidesoftware)
10
+ - [![Patreon](https://img.shields.io/badge/-black?style=social&logo=patreon&label=Patreon%3A%20Street%20Side%20Software)](https://patreon.com/streetsidesoftware)
11
+ - [![PayPal](https://img.shields.io/badge/-black?style=social&logo=paypal&label=PayPal%20Donate%3A%20Street%20Side%20Software)](https://www.paypal.com/donate/?hosted_button_id=26LNBP2Q6MKCY)
12
+ - [![Open Collective](https://img.shields.io/badge/-black?style=social&logo=opencollective&label=Open%20Collective%3A%20CSpell)](https://opencollective.com/cspell)
13
+
14
+ <!--- @@inject-end: ../../static/sponsor.md --->
15
+
16
+ ## Installation
17
+
18
+ ```
19
+ npm i -S cspell-lib
20
+ ```
21
+
22
+ ## Usage
23
+
24
+ ### Example - Check some text
25
+
26
+ Here is an example of using `spellCheckDocument` to spell check some text with a spelling issue.
27
+
28
+ ```ts
29
+ import assert from 'node:assert';
30
+
31
+ import { spellCheckDocument } from 'cspell-lib';
32
+
33
+ // cspell:ignore wordz coztom clockz cuztom
34
+ const customWords = ['wordz', 'cuztom', 'clockz'];
35
+
36
+ async function checkSpelling(phrase: string) {
37
+ const result = await spellCheckDocument(
38
+ { uri: 'text.txt', text: phrase, languageId: 'plaintext', locale: 'en' },
39
+ { generateSuggestions: true, noConfigSearch: true },
40
+ { words: customWords, suggestionsTimeout: 2000 }
41
+ );
42
+ return result.issues;
43
+ }
44
+
45
+ export async function run() {
46
+ console.log(`Start: ${new Date().toISOString()}`);
47
+ const r = await checkSpelling('These are my coztom wordz.');
48
+ console.log(`End: ${new Date().toISOString()}`);
49
+ // console.log(r);
50
+ assert(r.length === 1, 'Make sure we got 1 spelling issue back.');
51
+ assert(r[0].text === 'coztom');
52
+ assert(r[0].suggestions?.includes('cuztom'));
53
+ // console.log('%o', r);
54
+ }
55
+ ```
56
+
57
+ ### Example - Check a file
58
+
59
+ ```ts
60
+ import { resolve } from 'node:path';
61
+ import { pathToFileURL } from 'node:url';
62
+ import { spellCheckDocument } from 'cspell-lib';
63
+
64
+ export async function checkFile(filename: string) {
65
+ const uri = pathToFileURL(resolve(filename)).toString();
66
+ const result = await spellCheckDocument(
67
+ { uri },
68
+ { generateSuggestions: true, noConfigSearch: true },
69
+ { words: customWords, suggestionsTimeout: 2000 }
70
+ );
71
+ return result.issues;
72
+ }
73
+ ```
74
+
75
+ ## CSpell for Enterprise
76
+
77
+ <!--- @@inject: ../../static/tidelift.md --->
78
+
79
+ Available as part of the Tidelift Subscription.
80
+
81
+ The maintainers of cspell and thousands of other packages are working with Tidelift to deliver commercial support and maintenance for the open source packages you use to build your applications. Save time, reduce risk, and improve code health, while paying the maintainers of the exact packages you use. [Learn more.](https://tidelift.com/subscription/pkg/npm-cspell?utm_source=npm-cspell&utm_medium=referral&utm_campaign=enterprise&utm_term=repo)
82
+
83
+ <!--- @@inject-end: ../../static/tidelift.md --->
84
+
85
+ <!--- @@inject: ../../static/footer.md --->
86
+
87
+ <br/>
88
+
89
+ ---
90
+
91
+ <p align="center">Brought to you by<a href="https://streetsidesoftware.com" title="Street Side Software"><img width="16" alt="Street Side Software Logo" src="https://i.imgur.com/CyduuVY.png" /> Street Side Software</a></p>
92
+
93
+ <!--- @@inject-end: ../../static/footer.md --->
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell-lib",
3
- "version": "8.8.1",
3
+ "version": "8.8.2",
4
4
  "description": "A library of useful functions used across various cspell tools.",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -59,20 +59,20 @@
59
59
  },
60
60
  "homepage": "https://github.com/streetsidesoftware/cspell#readme",
61
61
  "dependencies": {
62
- "@cspell/cspell-bundled-dicts": "8.8.1",
63
- "@cspell/cspell-pipe": "8.8.1",
64
- "@cspell/cspell-resolver": "8.8.1",
65
- "@cspell/cspell-types": "8.8.1",
66
- "@cspell/dynamic-import": "8.8.1",
67
- "@cspell/strong-weak-map": "8.8.1",
62
+ "@cspell/cspell-bundled-dicts": "8.8.2",
63
+ "@cspell/cspell-pipe": "8.8.2",
64
+ "@cspell/cspell-resolver": "8.8.2",
65
+ "@cspell/cspell-types": "8.8.2",
66
+ "@cspell/dynamic-import": "8.8.2",
67
+ "@cspell/strong-weak-map": "8.8.2",
68
68
  "clear-module": "^4.1.2",
69
69
  "comment-json": "^4.2.3",
70
- "cspell-config-lib": "8.8.1",
71
- "cspell-dictionary": "8.8.1",
72
- "cspell-glob": "8.8.1",
73
- "cspell-grammar": "8.8.1",
74
- "cspell-io": "8.8.1",
75
- "cspell-trie-lib": "8.8.1",
70
+ "cspell-config-lib": "8.8.2",
71
+ "cspell-dictionary": "8.8.2",
72
+ "cspell-glob": "8.8.2",
73
+ "cspell-grammar": "8.8.2",
74
+ "cspell-io": "8.8.2",
75
+ "cspell-trie-lib": "8.8.2",
76
76
  "env-paths": "^3.0.0",
77
77
  "fast-equals": "^5.0.1",
78
78
  "gensequence": "^7.0.0",
@@ -86,7 +86,7 @@
86
86
  "node": ">=18"
87
87
  },
88
88
  "devDependencies": {
89
- "@cspell/dict-cpp": "^5.1.3",
89
+ "@cspell/dict-cpp": "^5.1.6",
90
90
  "@cspell/dict-csharp": "^4.0.2",
91
91
  "@cspell/dict-css": "^4.0.12",
92
92
  "@cspell/dict-fa-ir": "^4.0.0",
@@ -100,5 +100,5 @@
100
100
  "leaked-handles": "^5.2.0",
101
101
  "lorem-ipsum": "^2.0.8"
102
102
  },
103
- "gitHead": "6381846ffce8b9a349bfda03262297aa8e301ef5"
103
+ "gitHead": "e82ec807677c040c38b7d5608c8a8d42185d3b24"
104
104
  }