{"name":"cspell-lib","version":"8.13.3","keywords":["spell","checker","code","camel","case","spelling","spell checker","spelling checker","lint"],"author":"Jason Dent","license":"MIT","_id":"cspell-lib@8.13.3","homepage":"https://github.com/streetsidesoftware/cspell#readme","bugs":{"url":"https://github.com/streetsidesoftware/cspell/labels/cspell-lib"},"dist":{"shasum":"4d2516bbb09148079d634f73c65ffa05a62ae02c","tarball":"http://registry-npm.ywwl.com/cspell-lib/download/cspell-lib-8.13.3.tgz","fileCount":257,"integrity":"sha512-aEqxIILeqDtNoCa47/oSl5c926b50ue3PobYs4usn0Ymf0434RopCP+DCGsF7BPtog4j4XWnEmvkcJs57DYWDg==","signatures":[{"sig":"MEQCIGQbgHhVNGJX2QjuOYNQBzIefgFG3xWjfTrXQpowA6sqAiAQOMmhFeCEMqEEtyM0Kgz7iqGgsbA+0gPbKUtPx0Ddqw==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":448667,"size":110917,"noattachment":false,"key":"/cspell-lib/-/cspell-lib-8.13.3.tgz"},"type":"module","types":"dist/lib/index.d.ts","module":"dist/lib/index.js","engines":{"node":">=18"},"exports":{".":{"import":"./dist/lib/index.js"}},"gitHead":"e017775a1d181b20abce3c6325f2527a7554a3a9","scripts":{"test":"vitest run --pool=forks","#test":"vitest run --reporter=hanging-process --reporter=default","build":"tsc -p . && pnpm run build:api","clean":"shx rm -rf dist temp coverage \"*.tsbuildInfo\"","watch":"tsc -p . --watch","coverage":"vitest run --coverage --pool=forks","build:api":"rollup -c api/rollup.config.mjs","test:perf":"NODE_ENV=production insight --register ts-node/esm --file \"**/*.perf.{mts,ts}\"","test-watch":"vitest","clean-build":"pnpm clean && pnpm build","prepublishOnly":"pnpm run clean-build","test:update-snapshot":"vitest run -u"},"_npmUser":{"name":"jason-dent","email":"jason@streetsidesoftware.nl"},"repository":{"url":"https://github.com/streetsidesoftware/cspell.git","type":"git","directory":"packages/cspell-lib"},"_npmVersion":"lerna/3.8.0/node@v18.20.4+x64 (linux)","description":"A library of useful functions used across various cspell tools.","directories":{},"sideEffects":false,"_nodeVersion":"18.20.4","dependencies":{"cspell-io":"8.13.3","env-paths":"^3.0.0","vscode-uri":"^3.0.8","@cspell/url":"8.13.3","cspell-glob":"8.13.3","fast-equals":"^5.0.1","gensequence":"^7.0.0","xdg-basedir":"^5.1.0","clear-module":"^4.1.2","comment-json":"^4.2.5","import-fresh":"^3.3.0","resolve-from":"^5.0.0","cspell-grammar":"8.13.3","cspell-trie-lib":"8.13.3","cspell-config-lib":"8.13.3","cspell-dictionary":"8.13.3","@cspell/cspell-pipe":"8.13.3","@cspell/cspell-types":"8.13.3","@cspell/dynamic-import":"8.13.3","@cspell/cspell-resolver":"8.13.3","@cspell/strong-weak-map":"8.13.3","@cspell/cspell-bundled-dicts":"8.13.3","vscode-languageserver-textdocument":"^1.0.12"},"_hasShrinkwrap":false,"devDependencies":{"configstore":"^7.0.0","lorem-ipsum":"^2.0.8","perf-insight":"^1.2.0","leaked-handles":"^5.2.0","@cspell/dict-cpp":"^5.1.12","@cspell/dict-css":"^4.0.12","@cspell/dict-html":"^4.0.5","cspell-dict-nl-nl":"^1.1.2","@cspell/dict-fa-ir":"^4.0.0","@cspell/dict-fr-fr":"^2.2.2","@cspell/dict-nl-nl":"^2.3.0","@types/configstore":"^6.0.2","@cspell/dict-csharp":"^4.0.2","@cspell/dict-python":"^4.2.4"},"_npmOperationalInternal":{"tmp":"tmp/cspell-lib_8.13.3_1723467416001_0.19440705042960316","host":"s3://npm-registry-packages"},"readme":"# CSpell Library\n\n`cspell-lib` is the workhorse behind cspell. It does all the heavy lifting necessary to spell check files.\n\n## Support Future Development\n\n<!--- @@inject: ../../static/sponsor.md --->\n\nIf our spell checkers save you time, please consider supporting their development.\n\n<p align=\"left\">\n  <a href=\"https://github.com/sponsors/streetsidesoftware\" title=\"GitHub Sponsor\"><picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cspell.org/img/sponsor/github-sponsor-dark.png\" /><img alt=\"GitHub Sponsor\" src=\"https://cspell.org/img/sponsor/github-sponsor.png\" width=\"180\" /></picture></a> &nbsp; <a href=\"https://www.paypal.com/donate/?hosted_button_id=26LNBP2Q6MKCY\" title=\"PayPal\"><picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cspell.org/img/sponsor/paypal-dark.png\" /><img alt=\"PayPal\" src=\"https://cspell.org/img/sponsor/paypal.png\" width=\"180\" /></picture></a> &nbsp; <a href=\"https://opencollective.com/cspell\" title=\"Open Collective\"><picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cspell.org/img/sponsor/open-collective-dark.png\" /><img alt=\"Open Collective\" src=\"https://cspell.org/img/sponsor/open-collective.png\" width=\"180\" /></picture></a> &nbsp; <a href=\"https://streetsidesoftware.com/sponsor/\" title=\"Street Side Software\"><picture><source media=\"(prefers-color-scheme: dark)\" srcset=\"https://cspell.org/img/sponsor/cspell-dark.png\" /><img alt=\"CSpell\" src=\"https://cspell.org/img/sponsor/cspell.png\" width=\"180\" /></picture></a>\n</p>\n\n<!--- @@inject-end: ../../static/sponsor.md --->\n\n## Installation\n\n```\nnpm i -S cspell-lib\n```\n\n## Usage\n\n### Example - Check some text\n\nHere is an example of using `spellCheckDocument` to spell check some text with a spelling issue.\n\n```ts\nimport assert from 'node:assert';\n\nimport { spellCheckDocument } from 'cspell-lib';\n\n// cspell:ignore wordz coztom clockz cuztom\nconst customWords = ['wordz', 'cuztom', 'clockz'];\n\nasync function checkSpelling(phrase: string) {\n  const result = await spellCheckDocument(\n    { uri: 'text.txt', text: phrase, languageId: 'plaintext', locale: 'en' },\n    { generateSuggestions: true, noConfigSearch: true },\n    { words: customWords, suggestionsTimeout: 2000 }\n  );\n  return result.issues;\n}\n\nexport async function run() {\n  console.log(`Start: ${new Date().toISOString()}`);\n  const r = await checkSpelling('These are my coztom wordz.');\n  console.log(`End: ${new Date().toISOString()}`);\n  // console.log(r);\n  assert(r.length === 1, 'Make sure we got 1 spelling issue back.');\n  assert(r[0].text === 'coztom');\n  assert(r[0].suggestions?.includes('cuztom'));\n  // console.log('%o', r);\n}\n```\n\n### Example - Check a file\n\n```ts\nimport { resolve } from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport { spellCheckDocument } from 'cspell-lib';\n\nexport async function checkFile(filename: string) {\n  const uri = pathToFileURL(resolve(filename)).toString();\n  const result = await spellCheckDocument(\n    { uri },\n    { generateSuggestions: true, noConfigSearch: true },\n    { words: customWords, suggestionsTimeout: 2000 }\n  );\n  return result.issues;\n}\n```\n\n## CSpell for Enterprise\n\n<!--- @@inject: ../../static/tidelift.md --->\n\nAvailable as part of the Tidelift Subscription.\n\nThe 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)\n\n<!--- @@inject-end: ../../static/tidelift.md --->\n\n<!--- @@inject: ../../static/footer.md --->\n\n<br/>\n\n---\n\n<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>\n\n<!--- @@inject-end: ../../static/footer.md --->\n","publish_time":1723467416220,"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"_cnpm_publish_time":1723467416220,"dist-tags":{"cspell4":"4.3.12","cspell5":"5.21.2","cspell5-next":"5.21.2-alpha.0","latest":"10.4.0","next":"10.4.0-alpha.1"}}