{"_id":"cspell-lib@10.4.0","bugs":{"url":"https://github.com/streetsidesoftware/cspell/issues?q=is%3Aissue%20state%3Aopen%20label%3Acspell-lib"},"dist":{"shasum":"8402cef29f7c6649f07b0e40ac9cabf7c471daeb","tarball":"http://registry-npm.ywwl.com/cspell-lib/download/cspell-lib-10.4.0.tgz","fileCount":313,"integrity":"sha512-wfqmn19pfEUjWy7UJ4xPeRwyb/LFXHxFVJ6maX87OLRuSE9fTP+cr74VANpKycd/rieuB2ffKta7l38n+Xhj/Q==","signatures":[{"sig":"MEUCIQDwHhvmyR38sYNKO1NHRk7BC0+Hgnoo80GLp2kmAKBy7QIgex2Oo4mW63AJ6q4Sxkf97dZa2WfOAH9/Ge0Ounv1lAI=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQDblZSg2hsdv9UUhNa9qH2ChU8kjsFwZOCpw4p9/sqOOgIgV1bNvVtQ7/uGprDauED3J4pgetMN0rByTUEl6lSdrMg="}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/cspell-lib@10.4.0","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":578424,"size":141682,"noattachment":false,"key":"/cspell-lib/-/cspell-lib-10.4.0.tgz"},"name":"cspell-lib","type":"module","types":"dist/index.d.ts","author":{"name":"Jason Dent"},"module":"dist/index.js","engines":{"node":">=22.18.0"},"exports":{".":{"import":"./dist/index.js"},"./rpc":{"import":"./dist/rpc.js"},"./cspell-rpc":{"import":"./dist/cspell-rpc/index.js"},"./cspell-rpc/client":{"import":"./dist/cspell-rpc/client.js"},"./cspell-rpc/server":{"import":"./dist/cspell-rpc/server.js"}},"gitHead":"7e2bbb5e866c827ac5d2cf6b84bf3e1a016d0823","license":"MIT","scripts":{"test":"vitest run --pool=forks","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":"tsdown","test:perf":"NODE_ENV=production insight --file \"**/*.perf.{mjs,js}\"","test-watch":"vitest","clean-build":"pnpm clean && pnpm build","test:perf:ts":"NODE_ENV=production insight --file \"**/*.perf.{mts,ts}\" ","prepublishOnly":"pnpm run clean-build","test:perf:prof":"NODE_ENV=production node --cpu-prof ../../node_modules/perf-insight/bin.mjs --file \"dist/**/*.perf.{mjs,js}\" -t 1000","test:update-snapshot":"vitest run -u"},"version":"10.4.0","_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"eea86c79-cfd5-4015-b05b-cc4c6d5d483d"}},"homepage":"https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-lib#readme","keywords":["spell","checker","code","camel","case","spelling","spell checker","spelling checker","lint"],"repository":{"url":"git+https://github.com/streetsidesoftware/cspell.git","type":"git","directory":"packages/cspell-lib"},"_npmVersion":"lerna/5.6.2/node@v24.21.0+x64 (linux)","description":"A library of useful functions used across various cspell tools.","directories":{},"maintainers":[{"name":"jason-dent","email":"jason@streetsidesoftware.nl"}],"sideEffects":false,"_nodeVersion":"24.21.0","dependencies":{"cspell-io":"10.4.0","env-paths":"^4.0.0","vscode-uri":"^3.2.0","@cspell/rpc":"10.4.0","@cspell/url":"10.4.0","cspell-glob":"10.4.0","gensequence":"^8.0.8","xdg-basedir":"^5.1.0","import-fresh":"^4.0.1","resolve-from":"^5.0.0","cspell-grammar":"10.4.0","cspell-trie-lib":"10.4.0","@cspell/filetypes":"10.4.0","cspell-config-lib":"10.4.0","cspell-dictionary":"10.4.0","@cspell/cspell-pipe":"10.4.0","@cspell/cspell-types":"10.4.0","@cspell/dynamic-import":"10.4.0","@cspell/cspell-resolver":"10.4.0","@cspell/strong-weak-map":"10.4.0","@cspell/cspell-bundled-dicts":"10.4.0","@cspell/cspell-performance-monitor":"10.4.0","vscode-languageserver-textdocument":"^1.0.15"},"publishConfig":{"access":"public","provenance":true},"_hasShrinkwrap":false,"devDependencies":{"configstore":"^8.0.0","lorem-ipsum":"^3.0.0","comment-json":"^5.0.0","perf-insight":"^2.0.1","leaked-handles":"^5.2.0","@cspell/dict-cpp":"^7.1.3","@cspell/dict-css":"^4.1.2","@cspell/dict-html":"^4.0.16","cspell-dict-nl-nl":"^1.1.2","@cspell/dict-en_us":"^4.4.41","@cspell/dict-fa-ir":"^4.0.6","@cspell/dict-fr-fr":"^2.3.2","@cspell/dict-nl-nl":"^2.4.2","@cspell/dict-th-th":"^1.0.3","@types/configstore":"^6.0.2","@cspell/dict-csharp":"^4.0.8","@cspell/dict-python":"^4.5.2","@cspell/dictionary-bundler-plugin":""},"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/cspell-lib_10.4.0_1791970074142_0.8767640722077015"},"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\nPlease show your support through one of the following sites:\n\n[![GitHub Sponsor](https://cspell.org/img/sponsor/github-sponsor-176px.png)](https://github.com/sponsors/streetsidesoftware) [![PayPal](https://cspell.org/img/sponsor/paypal-176px.png)](https://www.paypal.com/donate/?hosted_button_id=26LNBP2Q6MKCY) [![Open Collective](https://cspell.org/img/sponsor/open-collective-176px.png)](https://opencollective.com/cspell) [![CSpell](https://cspell.org/img/sponsor/cspell-176px.png)](https://streetsidesoftware.com/sponsor/)\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":1791970074254,"_cnpm_publish_time":1791970074254,"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"}}