cspell-lib 10.3.6 → 10.4.0-alpha.1

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.
package/dist/index.d.ts CHANGED
@@ -1,2 +1,4 @@
1
- export * from './lib/index.js';
1
+ export type { CheckTextInfo, ConfigurationDependencies, CreateTextDocumentParams, CSpellConfigFile, DetermineFinalDocumentSettingsResult, DictionaryReferenceCollection, Document, DocumentValidatorOptions, ExcludeFilesGlobMap, ExclusionFunction, FeatureFlag, ICSpellConfigFile, ImportFileRefWithError, IncludeExcludeOptions, Logger, PerfTimer, SpellCheckFileOptions, SpellCheckFilePerf, SpellCheckFileResult, SpellingDictionary, SpellingDictionaryCollection, SuggestedWord, SuggestionCollector, SuggestionOptions, SuggestionResult, SuggestionsForWordResult, SuggestOptions, TextDocument, TextDocumentLine, TextDocumentRef, TextInfoItem, TraceOptions, TraceResult, TraceWordResult, ValidationIssue, VFileSystemProvider, VirtualFS, } from './lib/index.js';
2
+ export { asyncIterableToArray, calcOverrideSettings, checkFilenameMatchesGlob, checkText, checkTextDocument, clearCachedFiles, clearCaches, combineTextAndLanguageSettings, CompoundWordsMethod, constructSettingsForText, createConfigLoader, createDictionaryReferenceCollection, createPerfTimer, createSpellingDictionary, createSpellingDictionaryCollection, createTextDocument, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, defaultSettingsFilename, determineFinalDocumentSettings, DocumentValidator, ENV_CSPELL_GLOB_ROOT, ExclusionHelper, extractDependencies, extractImportErrors, FeatureFlags, fileToDocument, fileToTextDocument, finalizeSettings, FSCapabilityFlags, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultConfigLoader, getDefaultSettings, getDictionary, getGlobalSettings, getGlobalSettingsAsync, getLanguageIdsForBaseFilename, getLanguagesForExt, getLogger, getSources, getSystemFeatureFlags, getVirtualFS, ImportError, IncludeExcludeFlag, isBinaryFile, isSpellingDictionaryLoadError, Link, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readConfigFile, readFile, readFileSync, readRawSettings, readSettings, readSettingsFiles, refreshDictionaryCache, resolveConfigFileImports, resolveFile, searchForConfig, sectionCSpell, setLogger, shouldCheckDocument, spellCheckDocument, spellCheckDocumentRPC, spellCheckFile, SpellingDictionaryLoadError, SuggestionError, suggestionsForWord, suggestionsForWords, Text, toCSpellSettingsWithOutSourceTrace, traceWords, traceWordsAsync, UnknownFeatureFlagError, updateTextDocument, validateText, writeToFile, writeToFileIterable, writeToFileIterableP, } from './lib/index.js';
3
+ export * from '@cspell/cspell-types';
2
4
  //# sourceMappingURL=index.d.ts.map
package/dist/index.js CHANGED
@@ -1,2 +1,3 @@
1
- export * from './lib/index.js';
1
+ export { asyncIterableToArray, calcOverrideSettings, checkFilenameMatchesGlob, checkText, checkTextDocument, clearCachedFiles, clearCaches, combineTextAndLanguageSettings, CompoundWordsMethod, constructSettingsForText, createConfigLoader, createDictionaryReferenceCollection, createPerfTimer, createSpellingDictionary, createSpellingDictionaryCollection, createTextDocument, currentSettingsFileVersion, defaultConfigFilenames, defaultFileName, defaultSettingsFilename, determineFinalDocumentSettings, DocumentValidator, ENV_CSPELL_GLOB_ROOT, ExclusionHelper, extractDependencies, extractImportErrors, FeatureFlags, fileToDocument, fileToTextDocument, finalizeSettings, FSCapabilityFlags, getCachedFileSize, getDefaultBundledSettingsAsync, getDefaultConfigLoader, getDefaultSettings, getDictionary, getGlobalSettings, getGlobalSettingsAsync, getLanguageIdsForBaseFilename, getLanguagesForExt, getLogger, getSources, getSystemFeatureFlags, getVirtualFS, ImportError, IncludeExcludeFlag, isBinaryFile, isSpellingDictionaryLoadError, Link, loadConfig, loadPnP, mergeInDocSettings, mergeSettings, readConfigFile, readFile, readFileSync, readRawSettings, readSettings, readSettingsFiles, refreshDictionaryCache, resolveConfigFileImports, resolveFile, searchForConfig, sectionCSpell, setLogger, shouldCheckDocument, spellCheckDocument, spellCheckDocumentRPC, spellCheckFile, SpellingDictionaryLoadError, SuggestionError, suggestionsForWord, suggestionsForWords, Text, toCSpellSettingsWithOutSourceTrace, traceWords, traceWordsAsync, UnknownFeatureFlagError, updateTextDocument, validateText, writeToFile, writeToFileIterable, writeToFileIterableP, } from './lib/index.js';
2
+ export * from '@cspell/cspell-types';
2
3
  //# sourceMappingURL=index.js.map
@@ -1,10 +1,14 @@
1
+ import type { TextEncoding } from 'cspell-io';
2
+ import type { BufferEncoding } from '../Models/BufferEncoding.js';
1
3
  import type { TextDocument } from '../Models/TextDocument.js';
2
4
  import type { Document, DocumentWithText } from './Document.js';
5
+ type DocumentEncoding = Extract<BufferEncoding, TextEncoding>;
3
6
  export declare function fileToDocument(file: string): Document;
4
7
  export declare function fileToDocument(file: string, text: string, languageId?: string, locale?: string): DocumentWithText;
5
8
  export declare function fileToDocument(file: string, text?: string, languageId?: string, locale?: string): Document | DocumentWithText;
6
9
  export declare function fileToTextDocument(file: string): Promise<TextDocument>;
7
10
  export declare function documentToTextDocument(document: DocumentWithText): TextDocument;
8
11
  export declare function resolveDocumentToTextDocument(doc: Document): Promise<TextDocument>;
9
- export declare function resolveDocument(document: DocumentWithText | Document, encoding?: BufferEncoding): Promise<DocumentWithText>;
12
+ export declare function resolveDocument(document: DocumentWithText | Document, encoding?: DocumentEncoding): Promise<DocumentWithText>;
13
+ export {};
10
14
  //# sourceMappingURL=resolveDocument.d.ts.map
@@ -1,4 +1,5 @@
1
1
  import { readFile } from 'node:fs/promises';
2
+ import { readTextFile } from '../fileSystem.js';
2
3
  import { createTextDocument } from '../Models/TextDocument.js';
3
4
  import * as Uri from '../util/Uri.js';
4
5
  import { clean } from '../util/util.js';
@@ -33,11 +34,18 @@ export function resolveDocument(document, encoding) {
33
34
  if (isDocumentWithText(document))
34
35
  return Promise.resolve(document);
35
36
  const uri = Uri.toUri(document.uri);
36
- if (uri.scheme !== 'file') {
37
+ if (uri.scheme === 'stdin') {
37
38
  throw new Error(`Unsupported schema: "${uri.scheme}", open "${uri.toString()}"`);
38
39
  }
40
+ if (uri.scheme !== 'file') {
41
+ return readDocumentFromUrl(document.uri, encoding);
42
+ }
39
43
  return readDocument(Uri.uriToFilePath(uri), encoding);
40
44
  }
45
+ async function readDocumentFromUrl(uri, encoding = defaultEncoding) {
46
+ const text = await readTextFile(Uri.documentUriToURL(uri), encoding);
47
+ return { uri, text };
48
+ }
41
49
  function isDocumentWithText(doc) {
42
50
  return doc.text !== undefined;
43
51
  }
@@ -0,0 +1,6 @@
1
+ /**
2
+ * The text encodings Node.js supports, the same as its global `BufferEncoding`.
3
+ * Declared here so the published types do not need `@types/node`.
4
+ */
5
+ export type BufferEncoding = 'ascii' | 'utf8' | 'utf-8' | 'utf16le' | 'utf-16le' | 'ucs2' | 'ucs-2' | 'base64' | 'base64url' | 'latin1' | 'binary' | 'hex';
6
+ //# sourceMappingURL=BufferEncoding.d.ts.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=BufferEncoding.js.map
@@ -1,4 +1,6 @@
1
- export * from './Dictionaries.js';
2
- export * from './SpellingDictionary.js';
3
- export * from './SpellingDictionaryError.js';
1
+ export type { DictionaryNameFields } from './Dictionaries.js';
2
+ export { getDictionaryInternal, getInlineConfigDictionaries, loadDictionaryDefs, mapSpecialDictionaryNamesToSettings, refreshDictionaryCache, specialDictionaryNames, } from './Dictionaries.js';
3
+ export type { FindOptions, FindResult, HasOptions, SearchOptions, SpellingDictionary, SpellingDictionaryCollection, SpellingDictionaryOptions, SuggestionCollector, SuggestionResult, SuggestOptions, } from './SpellingDictionary.js';
4
+ export { CompoundWordsMethod, createCollection, createInlineSpellingDictionary, createSpellingDictionary, } from './SpellingDictionary.js';
5
+ export { isSpellingDictionaryLoadError, SpellingDictionaryLoadError } from './SpellingDictionaryError.js';
4
6
  //# sourceMappingURL=index.d.ts.map
@@ -1,4 +1,4 @@
1
- export * from './Dictionaries.js';
2
- export * from './SpellingDictionary.js';
3
- export * from './SpellingDictionaryError.js';
1
+ export { getDictionaryInternal, getInlineConfigDictionaries, loadDictionaryDefs, mapSpecialDictionaryNamesToSettings, refreshDictionaryCache, specialDictionaryNames, } from './Dictionaries.js';
2
+ export { CompoundWordsMethod, createCollection, createInlineSpellingDictionary, createSpellingDictionary, } from './SpellingDictionary.js';
3
+ export { isSpellingDictionaryLoadError, SpellingDictionaryLoadError } from './SpellingDictionaryError.js';
4
4
  //# sourceMappingURL=index.js.map
@@ -1,6 +1,7 @@
1
1
  import type { CSpellSettingsWithSourceTrace, CSpellUserSettings } from '@cspell/cspell-types';
2
2
  import type { ICSpellConfigFile } from 'cspell-config-lib';
3
3
  import type { Document, DocumentWithText } from './Document/index.js';
4
+ import type { BufferEncoding } from './Models/BufferEncoding.js';
4
5
  import type { ValidationIssueRPC } from './Models/ValidationIssue.js';
5
6
  import type { ImportFileRefWithError } from './Settings/index.js';
6
7
  import type { Uri } from './util/IUri.js';
package/dist/rpc.d.ts CHANGED
@@ -1,2 +1,47 @@
1
- export * from '@cspell/rpc';
1
+ export type {
2
+ /** @deprecated Import from `@cspell/rpc` instead. */
3
+ MessagePortLike,
4
+ /** @deprecated Import from `@cspell/rpc` instead. */
5
+ NotifyEvent,
6
+ /** @deprecated Import from `@cspell/rpc` instead. */
7
+ NotifyHandler,
8
+ /** @deprecated Import from `@cspell/rpc` instead. */
9
+ NotifyOnceEvent,
10
+ /** @deprecated Import from `@cspell/rpc` instead. */
11
+ RPCClientConfiguration,
12
+ /** @deprecated Import from `@cspell/rpc` instead. */
13
+ RPCClientOptions,
14
+ /** @deprecated Import from `@cspell/rpc` instead. */
15
+ RPCProtocol,
16
+ /** @deprecated Import from `@cspell/rpc` instead. */
17
+ RPCProtocolMethods,
18
+ /** @deprecated Import from `@cspell/rpc` instead. */
19
+ RPCServerConfiguration,
20
+ /** @deprecated Import from `@cspell/rpc` instead. */
21
+ RPCServerOptions, } from '@cspell/rpc';
22
+ export {
23
+ /** @deprecated Import from `@cspell/rpc` instead. */
24
+ AbortRPCRequestError,
25
+ /** @deprecated Import from `@cspell/rpc` instead. */
26
+ CanceledRPCRequestError,
27
+ /** @deprecated Import from `@cspell/rpc` instead. */
28
+ NotifyEmitter,
29
+ /** @deprecated Import from `@cspell/rpc` instead. */
30
+ notifyEventOnce,
31
+ /** @deprecated Import from `@cspell/rpc` instead. */
32
+ notifyEventToPromise,
33
+ /** @deprecated Import from `@cspell/rpc` instead. */
34
+ protocolDefinition,
35
+ /** @deprecated Import from `@cspell/rpc` instead. */
36
+ protocolMethods,
37
+ /** @deprecated Import from `@cspell/rpc` instead. */
38
+ RPCClient,
39
+ /** @deprecated Import from `@cspell/rpc` instead. */
40
+ RPCRequestError,
41
+ /** @deprecated Import from `@cspell/rpc` instead. */
42
+ RPCServer,
43
+ /** @deprecated Import from `@cspell/rpc` instead. */
44
+ TimeoutRPCRequestError,
45
+ /** @deprecated Import from `@cspell/rpc` instead. */
46
+ UnknownMethodRPCRequestError, } from '@cspell/rpc';
2
47
  //# sourceMappingURL=rpc.d.ts.map
package/dist/rpc.js CHANGED
@@ -1,2 +1,26 @@
1
- export * from '@cspell/rpc';
1
+ export {
2
+ /** @deprecated Import from `@cspell/rpc` instead. */
3
+ AbortRPCRequestError,
4
+ /** @deprecated Import from `@cspell/rpc` instead. */
5
+ CanceledRPCRequestError,
6
+ /** @deprecated Import from `@cspell/rpc` instead. */
7
+ NotifyEmitter,
8
+ /** @deprecated Import from `@cspell/rpc` instead. */
9
+ notifyEventOnce,
10
+ /** @deprecated Import from `@cspell/rpc` instead. */
11
+ notifyEventToPromise,
12
+ /** @deprecated Import from `@cspell/rpc` instead. */
13
+ protocolDefinition,
14
+ /** @deprecated Import from `@cspell/rpc` instead. */
15
+ protocolMethods,
16
+ /** @deprecated Import from `@cspell/rpc` instead. */
17
+ RPCClient,
18
+ /** @deprecated Import from `@cspell/rpc` instead. */
19
+ RPCRequestError,
20
+ /** @deprecated Import from `@cspell/rpc` instead. */
21
+ RPCServer,
22
+ /** @deprecated Import from `@cspell/rpc` instead. */
23
+ TimeoutRPCRequestError,
24
+ /** @deprecated Import from `@cspell/rpc` instead. */
25
+ UnknownMethodRPCRequestError, } from '@cspell/rpc';
2
26
  //# sourceMappingURL=rpc.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cspell-lib",
3
- "version": "10.3.6",
3
+ "version": "10.4.0-alpha.1",
4
4
  "description": "A library of useful functions used across various cspell tools.",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -75,41 +75,41 @@
75
75
  "watch": "tsc -p . --watch"
76
76
  },
77
77
  "dependencies": {
78
- "@cspell/cspell-bundled-dicts": "10.3.6",
79
- "@cspell/cspell-performance-monitor": "10.3.6",
80
- "@cspell/cspell-pipe": "10.3.6",
81
- "@cspell/cspell-resolver": "10.3.6",
82
- "@cspell/cspell-types": "10.3.6",
83
- "@cspell/dynamic-import": "10.3.6",
84
- "@cspell/filetypes": "10.3.6",
85
- "@cspell/rpc": "10.3.6",
86
- "@cspell/strong-weak-map": "10.3.6",
87
- "@cspell/url": "10.3.6",
88
- "cspell-config-lib": "10.3.6",
89
- "cspell-dictionary": "10.3.6",
90
- "cspell-glob": "10.3.6",
91
- "cspell-grammar": "10.3.6",
92
- "cspell-io": "10.3.6",
93
- "cspell-trie-lib": "10.3.6",
78
+ "@cspell/cspell-bundled-dicts": "10.4.0-alpha.1",
79
+ "@cspell/cspell-performance-monitor": "10.4.0-alpha.1",
80
+ "@cspell/cspell-pipe": "10.4.0-alpha.1",
81
+ "@cspell/cspell-resolver": "10.4.0-alpha.1",
82
+ "@cspell/cspell-types": "10.4.0-alpha.1",
83
+ "@cspell/dynamic-import": "10.4.0-alpha.1",
84
+ "@cspell/filetypes": "10.4.0-alpha.1",
85
+ "@cspell/rpc": "10.4.0-alpha.1",
86
+ "@cspell/strong-weak-map": "10.4.0-alpha.1",
87
+ "@cspell/url": "10.4.0-alpha.1",
88
+ "cspell-config-lib": "10.4.0-alpha.1",
89
+ "cspell-dictionary": "10.4.0-alpha.1",
90
+ "cspell-glob": "10.4.0-alpha.1",
91
+ "cspell-grammar": "10.4.0-alpha.1",
92
+ "cspell-io": "10.4.0-alpha.1",
93
+ "cspell-trie-lib": "10.4.0-alpha.1",
94
94
  "env-paths": "^4.0.0",
95
95
  "gensequence": "^8.0.8",
96
- "import-fresh": "^4.0.0",
96
+ "import-fresh": "^4.0.1",
97
97
  "resolve-from": "^5.0.0",
98
- "vscode-languageserver-textdocument": "^1.0.14",
98
+ "vscode-languageserver-textdocument": "^1.0.15",
99
99
  "vscode-uri": "^3.2.0",
100
100
  "xdg-basedir": "^5.1.0"
101
101
  },
102
102
  "devDependencies": {
103
- "@cspell/dict-cpp": "^7.1.0",
103
+ "@cspell/dict-cpp": "^7.1.2",
104
104
  "@cspell/dict-csharp": "^4.0.8",
105
105
  "@cspell/dict-css": "^4.1.2",
106
- "@cspell/dict-en_us": "^4.4.37",
106
+ "@cspell/dict-en_us": "^4.4.40",
107
107
  "@cspell/dict-fa-ir": "^4.0.5",
108
108
  "@cspell/dict-fr-fr": "^2.3.2",
109
109
  "@cspell/dict-html": "^4.0.16",
110
110
  "@cspell/dict-nl-nl": "^2.4.2",
111
- "@cspell/dict-python": "^4.5.0",
112
- "@cspell/dict-th-th": "^1.0.0",
111
+ "@cspell/dict-python": "^4.5.2",
112
+ "@cspell/dict-th-th": "^1.0.1",
113
113
  "@cspell/dictionary-bundler-plugin": "",
114
114
  "@types/configstore": "^6.0.2",
115
115
  "comment-json": "^5.0.0",
@@ -122,5 +122,5 @@
122
122
  "engines": {
123
123
  "node": ">=22.18.0"
124
124
  },
125
- "gitHead": "8559198ccfcac2f745911db1ffe2ee62c17cba49"
125
+ "gitHead": "628768a6e62b792e628189b41e63e12e5d3d8fe3"
126
126
  }
package/dist/api.d.ts DELETED
@@ -1,2 +0,0 @@
1
- export * from './lib/index.js';
2
- //# sourceMappingURL=api.d.ts.map
package/dist/api.js DELETED
@@ -1,2 +0,0 @@
1
- export * from './lib/index.js';
2
- //# sourceMappingURL=api.js.map