Sign In

@cspell/cspell-types

Package Overview
Dependencies
Maintainers
1
Versions
279
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@cspell/cspell-types - npm Package Compare versions

Comparing version
9.6.4
to
9.7.0
+176
dist/TextMap-B1Fq1qVW.d.ts
//#region src/Parser/types.d.ts
/**
* A SourceMap is used to map or transform the location of a piece of text back to its original offsets.
* This is necessary in order to report the correct location of a spelling issue.
* An empty source map indicates that it was a 1:1 transformation.
*
* Non-1:1 transformations are considered to be a single segment and cannot be split.
*
* A partial index into a non-linear segment will get mapped to the start of the segment.
*
* To signal a non-1:1 transformation a 0,0 pair can be used in the source map. This indicates that the
* following segment is a non-linear transformation and should not be split.
*
* This is important when multiple transformations have been applied to the same text, and the source map
* is being used to map back to the original text.
*
* For example: `\u00e9` might be transformed to `é` in one transformation and then to HTML entity `é`.
* The resulting sourceMap would be `[..., 0, 0, 6, 6, ...]` to indicate that the 6 character segment should
* not be split when mapping back to the original text.
*
* The values in a source map are number pairs (even, odd) relative to the beginning of each
* string segment.
* - even - span length in the source text
* - odd - span length in the transformed text
*
* Offsets start at 0
*
* Example:
*
* - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
* - Transformed text: `Grand Café Bjørvika`
* - Map: [9, 9, 6, 1, 3, 3, 6, 1, 5, 5]
*
* | offset | span | original | offset | span | transformed |
* | ------ | ---- | ----------- | ------ | ---- | ----------- |
* | 0-9 | 9 | `Grand Caf` | 0-9 | 9 | `Grand Caf` |
* | 9-15 | 6 | `\u00e9` | 9-10 | 1 | `é` |
* | 15-18 | 3 | ` Bj` | 10-13 | 3 | ` Bj` |
* | 18-24 | 6 | `\u00f8` | 13-14 | 1 | `ø` |
* | 24-29 | 5 | `rvika` | 14-19 | 5 | `rvika` |
*
* Note: The trailing 5,5 is not necessary since it is a 1:1 mapping, but it is included for clarity.
*
* <!--- cspell:ignore Bjørvika rvika --->
*/
type SourceMap = number[];
/**
* A range of text in a document.
* The range is inclusive of the start and exclusive of the end.
*/
type Range = readonly [start: number, end: number];
//#endregion
//#region src/Parser/Mapped.d.ts
interface Mapped {
/**
* The absolute start and end offset of the text in the source.
*/
range: Range;
/**
* `(i, j)` number pairs where
* - `i` is the offset in the source relative to the start of the range
* - `j` is the offset in the transformed destination
*
* Example:
* - source text = `"caf\xe9"`
* - mapped text = `"café"`
* - map = `[3, 3, 4, 1]`
*
* See: {@link SourceMap}
*
*/
map?: SourceMap | undefined;
}
//#endregion
//#region src/Parser/parser.d.ts
type ParserOptions = Record<string, unknown>;
type ParserName = string;
interface Parser {
/** Name of parser */
readonly name: ParserName;
/**
* Parse Method
* @param content - full content of the file
* @param filename - filename
*/
parse(content: string, filename: string): ParseResult;
}
interface ParseResult {
readonly content: string;
readonly filename: string;
readonly parsedTexts: Iterable<ParsedText>;
}
interface ParsedText extends Readonly<Mapped> {
/**
* The text extracted and possibly transformed
*/
readonly text: string;
/**
* The raw text before it has been transformed
*/
readonly rawText?: string | undefined;
/**
* The Scope annotation for a segment of text.
* Used by the spell checker to apply spell checking options
* based upon the value of the scope.
*/
readonly scope?: Scope | undefined;
/**
* Used to delegate parsing the contents of `text` to another parser.
*
*/
readonly delegate?: DelegateInfo | undefined;
}
/**
* DelegateInfo is used by a parser to delegate parsing a subsection of a document to
* another parser. The following information is used by the spell checker to match
* the parser.
*/
interface DelegateInfo {
/**
* Proposed virtual file name including the extension.
* Format: `./${source_filename}/${block_number}.${ext}
* Example: `./README.md/1.js`
*/
readonly filename: string;
/**
* The filename of the origin of the virtual file block.
* Example: `./README.md`
*/
readonly originFilename: string;
/**
* Proposed file extension
* Example: `.js`
*/
readonly extension: string;
/**
* Filetype to use
* Example: `javascript`
*/
readonly fileType?: string;
}
/**
* Scope - chain of scope going from local to global
*
* Example:
* ```
* `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
* ```
*/
interface ScopeChain {
readonly value: string;
readonly parent?: ScopeChain | undefined;
}
/**
* A string representing a scope chain separated by spaces
*
* Example: `comment.block.documentation.ts meta.interface.ts source.ts`
*/
type ScopeString = string;
type Scope = ScopeChain | ScopeString;
//#endregion
//#region src/Parser/TextMap.d.ts
type MappedText = Readonly<TransformedText>;
interface TransformedText extends Mapped {
/**
* Transformed text with an optional map.
*/
text: string;
/**
* The original text
*/
rawText?: string | undefined;
}
//#endregion
export { Parser as a, Scope as c, Range as d, SourceMap as f, ParsedText as i, ScopeChain as l, DelegateInfo as n, ParserName as o, ParseResult as r, ParserOptions as s, MappedText as t, ScopeString as u };
//# sourceMappingURL=TextMap-B1Fq1qVW.d.ts.map
//#region src/Parser/types.d.ts
/**
* A SourceMap is used to map or transform the location of a piece of text back to its original offsets.
* This is necessary in order to report the correct location of a spelling issue.
* An empty source map indicates that it was a 1:1 transformation.
*
* Non-1:1 transformations are considered to be a single segment and cannot be split.
*
* A partial index into a non-linear segment will get mapped to the start of the segment.
*
* To signal a non-1:1 transformation a 0,0 pair can be used in the source map. This indicates that the
* following segment is a non-linear transformation and should not be split.
*
* This is important when multiple transformations have been applied to the same text, and the source map
* is being used to map back to the original text.
*
* For example: `\u00e9` might be transformed to `é` in one transformation and then to HTML entity `&#233;`.
* The resulting sourceMap would be `[..., 0, 0, 6, 6, ...]` to indicate that the 6 character segment should
* not be split when mapping back to the original text.
*
* The values in a source map are number pairs (even, odd) relative to the beginning of each
* string segment.
* - even - span length in the source text
* - odd - span length in the transformed text
*
* Offsets start at 0
*
* Example:
*
* - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
* - Transformed text: `Grand Café Bjørvika`
* - Map: [9, 9, 6, 1, 3, 3, 6, 1, 5, 5]
*
* | offset | span | original | offset | span | transformed |
* | ------ | ---- | ----------- | ------ | ---- | ----------- |
* | 0-9 | 9 | `Grand Caf` | 0-9 | 9 | `Grand Caf` |
* | 9-15 | 6 | `\u00e9` | 9-10 | 1 | `é` |
* | 15-18 | 3 | ` Bj` | 10-13 | 3 | ` Bj` |
* | 18-24 | 6 | `\u00f8` | 13-14 | 1 | `ø` |
* | 24-29 | 5 | `rvika` | 14-19 | 5 | `rvika` |
*
* Note: The trailing 5,5 is not necessary since it is a 1:1 mapping, but it is included for clarity.
*
* <!--- cspell:ignore Bjørvika rvika --->
*/
type SourceMap = number[];
/**
* A range of text in a document.
* The range is inclusive of the start and exclusive of the end.
*/
type Range = readonly [start: number, end: number];
//#endregion
//#region src/Parser/Mapped.d.ts
interface Mapped {
/**
* The absolute start and end offset of the text in the source.
*/
range: Range;
/**
* `(i, j)` number pairs where
* - `i` is the offset in the source relative to the start of the range
* - `j` is the offset in the transformed destination
*
* Example:
* - source text = `"caf\xe9"`
* - mapped text = `"café"`
* - map = `[3, 3, 4, 1]`
*
* See: {@link SourceMap}
*
*/
map?: SourceMap | undefined;
}
//#endregion
//#region src/Parser/parser.d.ts
type ParserOptions = Record<string, unknown>;
type ParserName = string;
interface Parser {
/** Name of parser */
readonly name: ParserName;
/**
* Parse Method
* @param content - full content of the file
* @param filename - filename
*/
parse(content: string, filename: string): ParseResult;
}
interface ParseResult {
readonly content: string;
readonly filename: string;
readonly parsedTexts: Iterable<ParsedText>;
}
interface ParsedText extends Readonly<Mapped> {
/**
* The text extracted and possibly transformed
*/
readonly text: string;
/**
* The raw text before it has been transformed
*/
readonly rawText?: string | undefined;
/**
* The Scope annotation for a segment of text.
* Used by the spell checker to apply spell checking options
* based upon the value of the scope.
*/
readonly scope?: Scope | undefined;
/**
* Used to delegate parsing the contents of `text` to another parser.
*
*/
readonly delegate?: DelegateInfo | undefined;
}
/**
* DelegateInfo is used by a parser to delegate parsing a subsection of a document to
* another parser. The following information is used by the spell checker to match
* the parser.
*/
interface DelegateInfo {
/**
* Proposed virtual file name including the extension.
* Format: `./${source_filename}/${block_number}.${ext}
* Example: `./README.md/1.js`
*/
readonly filename: string;
/**
* The filename of the origin of the virtual file block.
* Example: `./README.md`
*/
readonly originFilename: string;
/**
* Proposed file extension
* Example: `.js`
*/
readonly extension: string;
/**
* Filetype to use
* Example: `javascript`
*/
readonly fileType?: string;
}
/**
* Scope - chain of scope going from local to global
*
* Example:
* ```
* `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
* ```
*/
interface ScopeChain {
readonly value: string;
readonly parent?: ScopeChain | undefined;
}
/**
* A string representing a scope chain separated by spaces
*
* Example: `comment.block.documentation.ts meta.interface.ts source.ts`
*/
type ScopeString = string;
type Scope = ScopeChain | ScopeString;
//#endregion
//#region src/Parser/TextMap.d.ts
type MappedText = Readonly<TransformedText>;
interface TransformedText extends Mapped {
/**
* Transformed text with an optional map.
*/
text: string;
/**
* The original text
*/
rawText?: string | undefined;
}
//#endregion
export { Parser as a, Scope as c, Range as d, SourceMap as f, ParsedText as i, ScopeChain as l, DelegateInfo as n, ParserName as o, ParseResult as r, ParserOptions as s, MappedText as t, ScopeString as u };
//# sourceMappingURL=TextMap-Cs2Bypvi.d.mts.map
+76
-38

@@ -1,2 +0,2 @@

import { ParseResult, ParsedText, Parser, ParserName, ParserOptions } from "./Parser/index.mjs";
import { a as Parser, d as Range, f as SourceMap, i as ParsedText, o as ParserName, r as ParseResult, s as ParserOptions, t as MappedText } from "./TextMap-Cs2Bypvi.mjs";

@@ -9,3 +9,3 @@ //#region src/cspell-vfs.d.ts

*/
type CSpellVFSBinaryData = Uint8Array;
type CSpellVFSBinaryData = Uint8Array<ArrayBuffer>;
/**

@@ -105,6 +105,6 @@ * Data content stored in a string for CSpellVFS file.

*/
length?: number;
length?: number | undefined;
}
interface TextDocumentOffset extends TextOffset {
uri?: string;
uri?: string | undefined;
doc: string;

@@ -1127,2 +1127,59 @@ row: number;

//#endregion
//#region src/Substitutions.d.ts
/**
* The ID for a substitution definition. This is used to reference the substitution definition in the substitutions array.
* @since 9.7.0
*/
type SubstitutionID = string;
/**
* A substitution entry is a tuple of the form `[find, replacement]`. The find string is the string to find,
* and the replacement string is the string to replace it with.
*
* - `find` - The string to find. This is the string that will be replaced in the text. Only an exact match will be replaced.
* The find string is not treated as a regular expression.
* - `replacement` - The string to replace the `find` string with. This is the string that will be used to replace the `find`
* string in the text.
*
* @since 9.7.0
*/
type SubstitutionEntry = [find: string, replacement: string];
/**
* Allows for the definition of a substitution set. A substitution set is a collection of substitution
* entries that can be applied to a document before spell checking. This is useful for converting html entities, url encodings,
* or other transformations that may be necessary to get the correct text for spell checking.
*
* Substitutions are applied based upon the longest matching find string. If there are multiple matches of the same `find`,
* the last one in the list is used. This allows for the overriding of substitutions. For example, if you have a substitution
* for `&` to `and`, and then a substitution for `&amp;` to `&`, the `&amp;` substitution will be used for the string `&amp;`,
* and the `&` substitution will be used for the string `&`.
*
* @since 9.7.0
*/
interface SubstitutionDefinition {
/**
* The name of the substitution definition. This is used to reference the substitution definition in the substitutions array.
*/
name: SubstitutionID;
/**
* An optional description of the substitution definition. This is not used for anything, but can be useful for
* documentation purposes.
*/
description?: string;
/**
* The entries for the substitution definition. This is a collection of substitution entries that can be applied to a
* document before spell checking.
*/
entries: SubstitutionEntry[];
}
/**
* The set of available substitutions. This is a collection of substitution definitions that can be applied to a document
* before spell checking.
*/
type SubstitutionDefinitions = SubstitutionDefinition[];
/**
* The set of substitutions to apply to a document before spell checking.
* This is a collection of substitution entries that can be applied to a document before spell checking.
*/
type Substitutions = (SubstitutionEntry | SubstitutionID)[];
//#endregion
//#region src/types.d.ts

@@ -1665,2 +1722,12 @@ type Serializable = number | string | boolean | null | object;

patterns?: RegExpPatternDefinition[];
/**
* The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.
* @since 9.7.0
*/
substitutionDefinitions?: SubstitutionDefinitions;
/**
* The set of substitutions to apply to a document before spell checking.
* @since 9.7.0
*/
substitutions?: Substitutions;
}

@@ -1938,37 +2005,8 @@ interface LanguageSetting extends LanguageSettingFilterFields, BaseSetting {}

//#endregion
//#region src/TextMap.d.ts
type MappedText = Readonly<TransformedText>;
type Range = readonly [start: number, end: number];
interface Mapped {
/**
* `(i, j)` number pairs where
* - `i` is the offset in the source
* - `j` is the offset in the destination
*
* Example:
* - source text = `"caf\xe9"`
* - mapped text = `"café"`
* - map = `[3, 3, 7, 4]`, which is equivalent to `[0, 0, 3, 3, 7, 4]`
* where the `[0, 0]` is unnecessary.
*
*/
map: number[];
}
interface TransformedText extends PartialOrUndefined<Mapped> {
/**
* Transformed text with an optional map.
*/
text: string;
/**
* The original text
*/
rawText?: string | undefined;
/**
* The start and end offset of the text in the document.
*/
range: Range;
}
type PartialOrUndefined<T> = { [P in keyof T]?: T[P] | undefined };
//#region src/merge.d.ts
declare function mergeConfig(settings: CSpellSettings[]): CSpellSettings;
declare function mergeConfig(...settings: [CSpellSettings, ...CSpellSettings[]]): CSpellSettings;
declare function mergeConfig(...settings: [CSpellSettings[], ...CSpellSettings[]]): CSpellSettings;
//#endregion
export { type AdvancedCSpellSettings, type AdvancedCSpellSettingsWithSourceTrace, type BaseSetting, type CSpellPackageSettings, type CSpellReporter, type CSpellReporterEmitters, type CSpellReporterModule, type CSpellSettings, type CSpellSettingsWithSourceTrace, type CSpellUserSettings, type CSpellUserSettingsFields, type CSpellUserSettingsWithComments, type CSpellVFS, type CSpellVFSBinaryData, type CSpellVFSData, type CSpellVFSFile, type CSpellVFSFileEntry, type CSpellVFSFileUrl, type CSpellVFSTextData, type CacheFormat, type CacheSettings, type CacheStrategy, type CharacterSet, type CharacterSetCosts, type CommandLineSettings, ConfigFields, type CustomDictionaryPath, type CustomDictionaryScope, type DebugEmitter, type DictionaryDefinition, type DictionaryDefinitionAlternate, type DictionaryDefinitionAugmented, type DictionaryDefinitionBase, type DictionaryDefinitionCustom, type DictionaryDefinitionInline, type DictionaryDefinitionInlineFlagWords, type DictionaryDefinitionInlineIgnoreWords, type DictionaryDefinitionInlineWords, type DictionaryDefinitionLegacy, type DictionaryDefinitionPreferred, type DictionaryDefinitionSimple, type DictionaryFileTypes, type DictionaryId, type DictionaryInformation, type DictionaryNegRef, type DictionaryPath, type DictionaryRef, type DictionaryReference, type EditCosts, type ErrorEmitter, type ErrorLike, type ExperimentalBaseSettings, type ExperimentalFileSettings, type ExtendableSettings, type FSPathResolvable, type Feature, type Features, type FeaturesSupportedByReporter, type FileSettings, type FileSource, type FsPath, type Glob, type GlobDef, type ImportFileRef, type InMemorySource, type Issue, IssueType, type LanguageId, type LanguageIdMultiple, type LanguageIdMultipleNeg, type LanguageIdSingle, type LanguageSetting, type LanguageSettingFilterFields, type LanguageSettingFilterFieldsDeprecated, type LanguageSettingFilterFieldsPreferred, type LegacySettings, type LocalId, type LocaleId, type MappedText, type MatchingFileType, type MergeSource, type MessageEmitter, type MessageType, type MessageTypeLookup, MessageTypes, type OverrideFilterFields, type OverrideSettings, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, type Pattern, type PatternId, type PatternRef, type Plugin, type PnPSettings, type PredefinedPatterns, type ProgressBase, type ProgressEmitter, type ProgressFileBase, type ProgressFileBegin, type ProgressFileComplete, type ProgressItem, type ProgressTypes, type RegExpPatternDefinition, type RegExpPatternList, type ReplaceEntry, type ReplaceMap, type ReportIssueOptions, type ReporterConfiguration, type ReporterSettings, type ReportingConfiguration, type ResultEmitter, type RunResult, type Settings, type SimpleGlob, type Source, type SpellingErrorEmitter, type SuggestionCostMapDef, type SuggestionCostsDefs, type SuggestionsConfiguration, type TextDocumentOffset, type TextOffset, type TrustLevel, type UnknownWordsChoices, type UnknownWordsConfiguration, type Version, type VersionLatest, type VersionLegacy, type WorkspaceTrustSettings, defaultCSpellSettings, defineConfig, unknownWordsChoices };
export { type AdvancedCSpellSettings, type AdvancedCSpellSettingsWithSourceTrace, type BaseSetting, type CSpellPackageSettings, type CSpellReporter, type CSpellReporterEmitters, type CSpellReporterModule, type CSpellSettings, type CSpellSettingsWithSourceTrace, type CSpellUserSettings, type CSpellUserSettingsFields, type CSpellUserSettingsWithComments, type CSpellVFS, type CSpellVFSBinaryData, type CSpellVFSData, type CSpellVFSFile, type CSpellVFSFileEntry, type CSpellVFSFileUrl, type CSpellVFSTextData, type CacheFormat, type CacheSettings, type CacheStrategy, type CharacterSet, type CharacterSetCosts, type CommandLineSettings, ConfigFields, type CustomDictionaryPath, type CustomDictionaryScope, type DebugEmitter, type DictionaryDefinition, type DictionaryDefinitionAlternate, type DictionaryDefinitionAugmented, type DictionaryDefinitionBase, type DictionaryDefinitionCustom, type DictionaryDefinitionInline, type DictionaryDefinitionInlineFlagWords, type DictionaryDefinitionInlineIgnoreWords, type DictionaryDefinitionInlineWords, type DictionaryDefinitionLegacy, type DictionaryDefinitionPreferred, type DictionaryDefinitionSimple, type DictionaryFileTypes, type DictionaryId, type DictionaryInformation, type DictionaryNegRef, type DictionaryPath, type DictionaryRef, type DictionaryReference, type EditCosts, type ErrorEmitter, type ErrorLike, type ExperimentalBaseSettings, type ExperimentalFileSettings, type ExtendableSettings, type FSPathResolvable, type Feature, type Features, type FeaturesSupportedByReporter, type FileSettings, type FileSource, type FsPath, type Glob, type GlobDef, type ImportFileRef, type InMemorySource, type Issue, IssueType, type LanguageId, type LanguageIdMultiple, type LanguageIdMultipleNeg, type LanguageIdSingle, type LanguageSetting, type LanguageSettingFilterFields, type LanguageSettingFilterFieldsDeprecated, type LanguageSettingFilterFieldsPreferred, type LegacySettings, type LocalId, type LocaleId, type MappedText, type MatchingFileType, type MergeSource, type MessageEmitter, type MessageType, type MessageTypeLookup, MessageTypes, type OverrideFilterFields, type OverrideSettings, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, type Pattern, type PatternId, type PatternRef, type Plugin, type PnPSettings, type PredefinedPatterns, type ProgressBase, type ProgressEmitter, type ProgressFileBase, type ProgressFileBegin, type ProgressFileComplete, type ProgressItem, type ProgressTypes, type Range, type RegExpPatternDefinition, type RegExpPatternList, type ReplaceEntry, type ReplaceMap, type ReportIssueOptions, type ReporterConfiguration, type ReporterSettings, type ReportingConfiguration, type ResultEmitter, type RunResult, type Settings, type SimpleGlob, type Source, type SourceMap, type SpellingErrorEmitter, type SubstitutionDefinition, type SubstitutionDefinitions, type SubstitutionEntry, type SubstitutionID, type Substitutions, type SuggestionCostMapDef, type SuggestionCostsDefs, type SuggestionsConfiguration, type TextDocumentOffset, type TextOffset, type TrustLevel, type UnknownWordsChoices, type UnknownWordsConfiguration, type Version, type VersionLatest, type VersionLegacy, type WorkspaceTrustSettings, defaultCSpellSettings, defineConfig, mergeConfig, unknownWordsChoices };
//# sourceMappingURL=index.d.mts.map

@@ -1,2 +0,2 @@

import { ParseResult, ParsedText, Parser, ParserName, ParserOptions } from "./Parser/index.js";
import { a as Parser, d as Range, f as SourceMap, i as ParsedText, o as ParserName, r as ParseResult, s as ParserOptions, t as MappedText } from "./TextMap-B1Fq1qVW.js";

@@ -9,3 +9,3 @@ //#region src/cspell-vfs.d.ts

*/
type CSpellVFSBinaryData = Uint8Array;
type CSpellVFSBinaryData = Uint8Array<ArrayBuffer>;
/**

@@ -105,6 +105,6 @@ * Data content stored in a string for CSpellVFS file.

*/
length?: number;
length?: number | undefined;
}
interface TextDocumentOffset extends TextOffset {
uri?: string;
uri?: string | undefined;
doc: string;

@@ -1127,2 +1127,59 @@ row: number;

//#endregion
//#region src/Substitutions.d.ts
/**
* The ID for a substitution definition. This is used to reference the substitution definition in the substitutions array.
* @since 9.7.0
*/
type SubstitutionID = string;
/**
* A substitution entry is a tuple of the form `[find, replacement]`. The find string is the string to find,
* and the replacement string is the string to replace it with.
*
* - `find` - The string to find. This is the string that will be replaced in the text. Only an exact match will be replaced.
* The find string is not treated as a regular expression.
* - `replacement` - The string to replace the `find` string with. This is the string that will be used to replace the `find`
* string in the text.
*
* @since 9.7.0
*/
type SubstitutionEntry = [find: string, replacement: string];
/**
* Allows for the definition of a substitution set. A substitution set is a collection of substitution
* entries that can be applied to a document before spell checking. This is useful for converting html entities, url encodings,
* or other transformations that may be necessary to get the correct text for spell checking.
*
* Substitutions are applied based upon the longest matching find string. If there are multiple matches of the same `find`,
* the last one in the list is used. This allows for the overriding of substitutions. For example, if you have a substitution
* for `&` to `and`, and then a substitution for `&amp;` to `&`, the `&amp;` substitution will be used for the string `&amp;`,
* and the `&` substitution will be used for the string `&`.
*
* @since 9.7.0
*/
interface SubstitutionDefinition {
/**
* The name of the substitution definition. This is used to reference the substitution definition in the substitutions array.
*/
name: SubstitutionID;
/**
* An optional description of the substitution definition. This is not used for anything, but can be useful for
* documentation purposes.
*/
description?: string;
/**
* The entries for the substitution definition. This is a collection of substitution entries that can be applied to a
* document before spell checking.
*/
entries: SubstitutionEntry[];
}
/**
* The set of available substitutions. This is a collection of substitution definitions that can be applied to a document
* before spell checking.
*/
type SubstitutionDefinitions = SubstitutionDefinition[];
/**
* The set of substitutions to apply to a document before spell checking.
* This is a collection of substitution entries that can be applied to a document before spell checking.
*/
type Substitutions = (SubstitutionEntry | SubstitutionID)[];
//#endregion
//#region src/types.d.ts

@@ -1665,2 +1722,12 @@ type Serializable = number | string | boolean | null | object;

patterns?: RegExpPatternDefinition[];
/**
* The set of available substitutions. This is a collection of substitution definitions that can be applied to a document before spell checking.
* @since 9.7.0
*/
substitutionDefinitions?: SubstitutionDefinitions;
/**
* The set of substitutions to apply to a document before spell checking.
* @since 9.7.0
*/
substitutions?: Substitutions;
}

@@ -1938,37 +2005,8 @@ interface LanguageSetting extends LanguageSettingFilterFields, BaseSetting {}

//#endregion
//#region src/TextMap.d.ts
type MappedText = Readonly<TransformedText>;
type Range = readonly [start: number, end: number];
interface Mapped {
/**
* `(i, j)` number pairs where
* - `i` is the offset in the source
* - `j` is the offset in the destination
*
* Example:
* - source text = `"caf\xe9"`
* - mapped text = `"café"`
* - map = `[3, 3, 7, 4]`, which is equivalent to `[0, 0, 3, 3, 7, 4]`
* where the `[0, 0]` is unnecessary.
*
*/
map: number[];
}
interface TransformedText extends PartialOrUndefined<Mapped> {
/**
* Transformed text with an optional map.
*/
text: string;
/**
* The original text
*/
rawText?: string | undefined;
/**
* The start and end offset of the text in the document.
*/
range: Range;
}
type PartialOrUndefined<T> = { [P in keyof T]?: T[P] | undefined };
//#region src/merge.d.ts
declare function mergeConfig(settings: CSpellSettings[]): CSpellSettings;
declare function mergeConfig(...settings: [CSpellSettings, ...CSpellSettings[]]): CSpellSettings;
declare function mergeConfig(...settings: [CSpellSettings[], ...CSpellSettings[]]): CSpellSettings;
//#endregion
export { type AdvancedCSpellSettings, type AdvancedCSpellSettingsWithSourceTrace, type BaseSetting, type CSpellPackageSettings, type CSpellReporter, type CSpellReporterEmitters, type CSpellReporterModule, type CSpellSettings, type CSpellSettingsWithSourceTrace, type CSpellUserSettings, type CSpellUserSettingsFields, type CSpellUserSettingsWithComments, type CSpellVFS, type CSpellVFSBinaryData, type CSpellVFSData, type CSpellVFSFile, type CSpellVFSFileEntry, type CSpellVFSFileUrl, type CSpellVFSTextData, type CacheFormat, type CacheSettings, type CacheStrategy, type CharacterSet, type CharacterSetCosts, type CommandLineSettings, ConfigFields, type CustomDictionaryPath, type CustomDictionaryScope, type DebugEmitter, type DictionaryDefinition, type DictionaryDefinitionAlternate, type DictionaryDefinitionAugmented, type DictionaryDefinitionBase, type DictionaryDefinitionCustom, type DictionaryDefinitionInline, type DictionaryDefinitionInlineFlagWords, type DictionaryDefinitionInlineIgnoreWords, type DictionaryDefinitionInlineWords, type DictionaryDefinitionLegacy, type DictionaryDefinitionPreferred, type DictionaryDefinitionSimple, type DictionaryFileTypes, type DictionaryId, type DictionaryInformation, type DictionaryNegRef, type DictionaryPath, type DictionaryRef, type DictionaryReference, type EditCosts, type ErrorEmitter, type ErrorLike, type ExperimentalBaseSettings, type ExperimentalFileSettings, type ExtendableSettings, type FSPathResolvable, type Feature, type Features, type FeaturesSupportedByReporter, type FileSettings, type FileSource, type FsPath, type Glob, type GlobDef, type ImportFileRef, type InMemorySource, type Issue, IssueType, type LanguageId, type LanguageIdMultiple, type LanguageIdMultipleNeg, type LanguageIdSingle, type LanguageSetting, type LanguageSettingFilterFields, type LanguageSettingFilterFieldsDeprecated, type LanguageSettingFilterFieldsPreferred, type LegacySettings, type LocalId, type LocaleId, type MappedText, type MatchingFileType, type MergeSource, type MessageEmitter, type MessageType, type MessageTypeLookup, MessageTypes, type OverrideFilterFields, type OverrideSettings, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, type Pattern, type PatternId, type PatternRef, type Plugin, type PnPSettings, type PredefinedPatterns, type ProgressBase, type ProgressEmitter, type ProgressFileBase, type ProgressFileBegin, type ProgressFileComplete, type ProgressItem, type ProgressTypes, type RegExpPatternDefinition, type RegExpPatternList, type ReplaceEntry, type ReplaceMap, type ReportIssueOptions, type ReporterConfiguration, type ReporterSettings, type ReportingConfiguration, type ResultEmitter, type RunResult, type Settings, type SimpleGlob, type Source, type SpellingErrorEmitter, type SuggestionCostMapDef, type SuggestionCostsDefs, type SuggestionsConfiguration, type TextDocumentOffset, type TextOffset, type TrustLevel, type UnknownWordsChoices, type UnknownWordsConfiguration, type Version, type VersionLatest, type VersionLegacy, type WorkspaceTrustSettings, defaultCSpellSettings, defineConfig, unknownWordsChoices };
export { type AdvancedCSpellSettings, type AdvancedCSpellSettingsWithSourceTrace, type BaseSetting, type CSpellPackageSettings, type CSpellReporter, type CSpellReporterEmitters, type CSpellReporterModule, type CSpellSettings, type CSpellSettingsWithSourceTrace, type CSpellUserSettings, type CSpellUserSettingsFields, type CSpellUserSettingsWithComments, type CSpellVFS, type CSpellVFSBinaryData, type CSpellVFSData, type CSpellVFSFile, type CSpellVFSFileEntry, type CSpellVFSFileUrl, type CSpellVFSTextData, type CacheFormat, type CacheSettings, type CacheStrategy, type CharacterSet, type CharacterSetCosts, type CommandLineSettings, ConfigFields, type CustomDictionaryPath, type CustomDictionaryScope, type DebugEmitter, type DictionaryDefinition, type DictionaryDefinitionAlternate, type DictionaryDefinitionAugmented, type DictionaryDefinitionBase, type DictionaryDefinitionCustom, type DictionaryDefinitionInline, type DictionaryDefinitionInlineFlagWords, type DictionaryDefinitionInlineIgnoreWords, type DictionaryDefinitionInlineWords, type DictionaryDefinitionLegacy, type DictionaryDefinitionPreferred, type DictionaryDefinitionSimple, type DictionaryFileTypes, type DictionaryId, type DictionaryInformation, type DictionaryNegRef, type DictionaryPath, type DictionaryRef, type DictionaryReference, type EditCosts, type ErrorEmitter, type ErrorLike, type ExperimentalBaseSettings, type ExperimentalFileSettings, type ExtendableSettings, type FSPathResolvable, type Feature, type Features, type FeaturesSupportedByReporter, type FileSettings, type FileSource, type FsPath, type Glob, type GlobDef, type ImportFileRef, type InMemorySource, type Issue, IssueType, type LanguageId, type LanguageIdMultiple, type LanguageIdMultipleNeg, type LanguageIdSingle, type LanguageSetting, type LanguageSettingFilterFields, type LanguageSettingFilterFieldsDeprecated, type LanguageSettingFilterFieldsPreferred, type LegacySettings, type LocalId, type LocaleId, type MappedText, type MatchingFileType, type MergeSource, type MessageEmitter, type MessageType, type MessageTypeLookup, MessageTypes, type OverrideFilterFields, type OverrideSettings, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, type Pattern, type PatternId, type PatternRef, type Plugin, type PnPSettings, type PredefinedPatterns, type ProgressBase, type ProgressEmitter, type ProgressFileBase, type ProgressFileBegin, type ProgressFileComplete, type ProgressItem, type ProgressTypes, type Range, type RegExpPatternDefinition, type RegExpPatternList, type ReplaceEntry, type ReplaceMap, type ReportIssueOptions, type ReporterConfiguration, type ReporterSettings, type ReportingConfiguration, type ResultEmitter, type RunResult, type Settings, type SimpleGlob, type Source, type SourceMap, type SpellingErrorEmitter, type SubstitutionDefinition, type SubstitutionDefinitions, type SubstitutionEntry, type SubstitutionID, type Substitutions, type SuggestionCostMapDef, type SuggestionCostsDefs, type SuggestionsConfiguration, type TextDocumentOffset, type TextOffset, type TrustLevel, type UnknownWordsChoices, type UnknownWordsConfiguration, type Version, type VersionLatest, type VersionLegacy, type WorkspaceTrustSettings, defaultCSpellSettings, defineConfig, mergeConfig, unknownWordsChoices };
//# sourceMappingURL=index.d.ts.map

@@ -0,1 +1,2 @@

Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });

@@ -48,2 +49,4 @@ //#region src/configFields.ts

spellCheckDelayMs: "spellCheckDelayMs",
substitutionDefinitions: "substitutionDefinitions",
substitutions: "substitutions",
suggestionNumChanges: "suggestionNumChanges",

@@ -95,2 +98,115 @@ suggestionsTimeout: "suggestionsTimeout",

//#endregion
//#region src/merge.ts
const mArr = mergeAppendArrays;
const mRec = mergeRecords;
const exKV = extractKeyValues;
const mergeDefinitionFunctions = {
$schema: (key) => recKV(key, void 0),
allowCompoundWords: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
cache: (key, settings) => recKV(key, mRec(exKV(key, settings))),
caseSensitive: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
description: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
dictionaries: (key, settings) => recKV(key, mArr(exKV(key, settings))),
dictionaryDefinitions: (key, settings) => recKV(key, mArr(exKV(key, settings))),
enabled: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
enabledFileTypes: (key, settings) => recKV(key, mRec(exKV(key, settings))),
enabledLanguageIds: (key, settings) => recKV(key, mArr(exKV(key, settings))),
enableFiletypes: (key, settings) => recKV(key, mArr(exKV(key, settings))),
enableGlobDot: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
engines: (key, settings) => recKV(key, mRec(exKV(key, settings))),
failFast: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
features: (key, settings) => recKV(key, mRec(exKV(key, settings))),
files: (key, settings) => recKV(key, mArr(exKV(key, settings))),
flagWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
gitignoreRoot: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
globRoot: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
id: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
ignorePaths: (key, settings) => recKV(key, mArr(exKV(key, settings))),
ignoreRandomStrings: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
ignoreRegExpList: (key, settings) => recKV(key, mArr(exKV(key, settings))),
ignoreWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
import: (key, settings) => recKV(key, mArr(exKV(key, settings).map(strArrToArr))),
includeRegExpList: (key, settings) => recKV(key, mArr(exKV(key, settings))),
language: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
languageId: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
languageSettings: (key, settings) => recKV(key, mArr(exKV(key, settings))),
loadDefaultConfiguration: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
maxDuplicateProblems: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
maxFileSize: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
maxNumberOfProblems: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
minRandomLength: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
minWordLength: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
name: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
noConfigSearch: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
noSuggestDictionaries: (key, settings) => recKV(key, mArr(exKV(key, settings))),
numSuggestions: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
overrides: (key, settings) => recKV(key, mArr(exKV(key, settings))),
parser: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
patterns: (key, settings) => recKV(key, mArr(exKV(key, settings))),
pnpFiles: (key, settings) => recKV(key, mArr(exKV(key, settings))),
readonly: (key, settings) => recKV(key, orValue(exKV(key, settings))),
reporters: (key, settings) => recKV(key, mArr(exKV(key, settings))),
showStatus: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
spellCheckDelayMs: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
substitutionDefinitions: (key, settings) => recKV(key, mArr(exKV(key, settings))),
substitutions: (key, settings) => recKV(key, mArr(exKV(key, settings))),
suggestionNumChanges: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
suggestionsTimeout: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
suggestWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
unknownWords: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
useGitignore: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
usePnP: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
userWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
validateDirectives: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
version: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
vfs: (key, settings) => recKV(key, mRec(exKV(key, settings))),
words: (key, settings) => recKV(key, mArr(exKV(key, settings)))
};
function makeMergeFn(key) {
const fn = mergeDefinitionFunctions[key];
return (settings) => fn(key, settings);
}
const mergeIndividualSettingsFns = Object.keys(mergeDefinitionFunctions).map((k) => makeMergeFn(k));
function mergeConfig(first, ...configs) {
const settings = [first, ...configs].flat();
if (settings.length === 1) return settings[0];
const result = Object.assign(Object.create(null), ...settings);
Object.assign(result, ...mergeIndividualSettingsFns.map((fn) => fn(settings)));
return result;
}
function orValue(values) {
let v = void 0;
for (const value of values) v ||= value;
return v;
}
function lastValue(values) {
for (let i = values.length - 1; i >= 0; i--) {
const value = values[i];
if (value !== void 0) return value;
}
}
function strArrToArr(value) {
return Array.isArray(value) ? value : [value];
}
function mergeAppendArrays(arrays) {
const values = arrays.filter((a) => !!a);
if (values.length === 1) return values[0];
const merged = values.flat();
return merged.length ? merged : void 0;
}
function mergeRecords(records) {
const values = records.filter((r) => !!r);
if (!values.length) return void 0;
if (values.length === 1) return values[0];
return Object.assign(Object.create(null), ...values);
}
function extractKeyValues(key, records) {
return records.filter((r) => !!r).map((r) => r[key]).filter((v) => v !== void 0);
}
function recKV(key, value) {
if (value === void 0) return void 0;
return { [key]: value };
}
//#endregion
exports.ConfigFields = ConfigFields;

@@ -101,3 +217,4 @@ exports.IssueType = IssueType;

exports.defineConfig = defineConfig;
exports.mergeConfig = mergeConfig;
exports.unknownWordsChoices = unknownWordsChoices;
//# sourceMappingURL=index.js.map

@@ -47,2 +47,4 @@ //#region src/configFields.ts

spellCheckDelayMs: "spellCheckDelayMs",
substitutionDefinitions: "substitutionDefinitions",
substitutions: "substitutions",
suggestionNumChanges: "suggestionNumChanges",

@@ -94,3 +96,116 @@ suggestionsTimeout: "suggestionsTimeout",

//#endregion
export { ConfigFields, IssueType, MessageTypes, defaultCSpellSettings, defineConfig, unknownWordsChoices };
//#region src/merge.ts
const mArr = mergeAppendArrays;
const mRec = mergeRecords;
const exKV = extractKeyValues;
const mergeDefinitionFunctions = {
$schema: (key) => recKV(key, void 0),
allowCompoundWords: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
cache: (key, settings) => recKV(key, mRec(exKV(key, settings))),
caseSensitive: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
description: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
dictionaries: (key, settings) => recKV(key, mArr(exKV(key, settings))),
dictionaryDefinitions: (key, settings) => recKV(key, mArr(exKV(key, settings))),
enabled: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
enabledFileTypes: (key, settings) => recKV(key, mRec(exKV(key, settings))),
enabledLanguageIds: (key, settings) => recKV(key, mArr(exKV(key, settings))),
enableFiletypes: (key, settings) => recKV(key, mArr(exKV(key, settings))),
enableGlobDot: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
engines: (key, settings) => recKV(key, mRec(exKV(key, settings))),
failFast: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
features: (key, settings) => recKV(key, mRec(exKV(key, settings))),
files: (key, settings) => recKV(key, mArr(exKV(key, settings))),
flagWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
gitignoreRoot: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
globRoot: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
id: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
ignorePaths: (key, settings) => recKV(key, mArr(exKV(key, settings))),
ignoreRandomStrings: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
ignoreRegExpList: (key, settings) => recKV(key, mArr(exKV(key, settings))),
ignoreWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
import: (key, settings) => recKV(key, mArr(exKV(key, settings).map(strArrToArr))),
includeRegExpList: (key, settings) => recKV(key, mArr(exKV(key, settings))),
language: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
languageId: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
languageSettings: (key, settings) => recKV(key, mArr(exKV(key, settings))),
loadDefaultConfiguration: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
maxDuplicateProblems: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
maxFileSize: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
maxNumberOfProblems: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
minRandomLength: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
minWordLength: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
name: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
noConfigSearch: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
noSuggestDictionaries: (key, settings) => recKV(key, mArr(exKV(key, settings))),
numSuggestions: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
overrides: (key, settings) => recKV(key, mArr(exKV(key, settings))),
parser: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
patterns: (key, settings) => recKV(key, mArr(exKV(key, settings))),
pnpFiles: (key, settings) => recKV(key, mArr(exKV(key, settings))),
readonly: (key, settings) => recKV(key, orValue(exKV(key, settings))),
reporters: (key, settings) => recKV(key, mArr(exKV(key, settings))),
showStatus: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
spellCheckDelayMs: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
substitutionDefinitions: (key, settings) => recKV(key, mArr(exKV(key, settings))),
substitutions: (key, settings) => recKV(key, mArr(exKV(key, settings))),
suggestionNumChanges: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
suggestionsTimeout: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
suggestWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
unknownWords: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
useGitignore: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
usePnP: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
userWords: (key, settings) => recKV(key, mArr(exKV(key, settings))),
validateDirectives: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
version: (key, settings) => recKV(key, lastValue(exKV(key, settings))),
vfs: (key, settings) => recKV(key, mRec(exKV(key, settings))),
words: (key, settings) => recKV(key, mArr(exKV(key, settings)))
};
function makeMergeFn(key) {
const fn = mergeDefinitionFunctions[key];
return (settings) => fn(key, settings);
}
const mergeIndividualSettingsFns = Object.keys(mergeDefinitionFunctions).map((k) => makeMergeFn(k));
function mergeConfig(first, ...configs) {
const settings = [first, ...configs].flat();
if (settings.length === 1) return settings[0];
const result = Object.assign(Object.create(null), ...settings);
Object.assign(result, ...mergeIndividualSettingsFns.map((fn) => fn(settings)));
return result;
}
function orValue(values) {
let v = void 0;
for (const value of values) v ||= value;
return v;
}
function lastValue(values) {
for (let i = values.length - 1; i >= 0; i--) {
const value = values[i];
if (value !== void 0) return value;
}
}
function strArrToArr(value) {
return Array.isArray(value) ? value : [value];
}
function mergeAppendArrays(arrays) {
const values = arrays.filter((a) => !!a);
if (values.length === 1) return values[0];
const merged = values.flat();
return merged.length ? merged : void 0;
}
function mergeRecords(records) {
const values = records.filter((r) => !!r);
if (!values.length) return void 0;
if (values.length === 1) return values[0];
return Object.assign(Object.create(null), ...values);
}
function extractKeyValues(key, records) {
return records.filter((r) => !!r).map((r) => r[key]).filter((v) => v !== void 0);
}
function recKV(key, value) {
if (value === void 0) return void 0;
return { [key]: value };
}
//#endregion
export { ConfigFields, IssueType, MessageTypes, defaultCSpellSettings, defineConfig, mergeConfig, unknownWordsChoices };
//# sourceMappingURL=index.mjs.map

@@ -1,129 +0,2 @@

//#region src/Parser/index.d.ts
type ParserOptions = Record<string, unknown>;
type ParserName = string;
interface Parser {
/** Name of parser */
readonly name: ParserName;
/**
* Parse Method
* @param content - full content of the file
* @param filename - filename
*/
parse(content: string, filename: string): ParseResult;
}
interface ParseResult {
readonly content: string;
readonly filename: string;
readonly parsedTexts: Iterable<ParsedText>;
}
interface ParsedText {
/**
* The text extracted and possibly transformed
*/
readonly text: string;
/**
* The raw text before it has been transformed
*/
readonly rawText?: string | undefined;
/**
* start and end offsets of the text
*/
readonly range: Range;
/**
* The Scope annotation for a segment of text.
* Used by the spell checker to apply spell checking options
* based upon the value of the scope.
*/
readonly scope?: Scope | undefined;
/**
* The source map is used to support text transformations.
*
* See: {@link SourceMap}
*/
readonly map?: SourceMap | undefined;
/**
* Used to delegate parsing the contents of `text` to another parser.
*
*/
readonly delegate?: DelegateInfo | undefined;
}
/**
* A SourceMap is used to map transform a piece of text back to its original text.
* This is necessary in order to report the correct location of a spelling issue.
* An empty source map indicates that it was a 1:1 transformation.
*
* The values in a source map are number pairs (even, odd) relative to the beginning of each
* string segment.
* - even - offset in the source text
* - odd - offset in the transformed text
*
* Offsets start a 0
*
* Example:
*
* - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
* - Transformed text: `Grand Café Bjørvika`
* - Map: [9, 9, 15, 10, 18, 13, 24, 14]
*
* | offset | original | offset | transformed |
* | ------ | ----------- | ------ | ----------- |
* | 0-9 | `Grand Caf` | 0-9 | `Grand Caf` |
* | 9-15 | `\u00e9` | 9-10 | `é` |
* | 15-18 | ` Bj` | 10-13 | ` Bj` |
* | 18-24 | `\u00f8` | 13-14 | `ø` |
* | 24-29 | `rvika` | 14-19 | `rvika` |
*
* <!--- cspell:ignore Bjørvika rvika --->
*/
type SourceMap = number[];
type Range = readonly [start: number, end: number];
/**
* DelegateInfo is used by a parser to delegate parsing a subsection of a document to
* another parser. The following information is used by the spell checker to match
* the parser.
*/
interface DelegateInfo {
/**
* Proposed virtual file name including the extension.
* Format: `./${source_filename}/${block_number}.${ext}
* Example: `./README.md/1.js`
*/
readonly filename: string;
/**
* The filename of the origin of the virtual file block.
* Example: `./README.md`
*/
readonly originFilename: string;
/**
* Proposed file extension
* Example: `.js`
*/
readonly extension: string;
/**
* Filetype to use
* Example: `javascript`
*/
readonly fileType?: string;
}
/**
* Scope - chain of scope going from local to global
*
* Example:
* ```
* `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
* ```
*/
interface ScopeChain {
readonly value: string;
readonly parent?: ScopeChain | undefined;
}
/**
* A string representing a scope chain separated by spaces
*
* Example: `comment.block.documentation.ts meta.interface.ts source.ts`
*/
type ScopeString = string;
type Scope = ScopeChain | ScopeString;
//#endregion
export { DelegateInfo, ParseResult, ParsedText, Parser, ParserName, ParserOptions, Range, Scope, ScopeChain, ScopeString, SourceMap };
//# sourceMappingURL=index.d.mts.map
import { a as Parser, c as Scope, d as Range, f as SourceMap, i as ParsedText, l as ScopeChain, n as DelegateInfo, o as ParserName, r as ParseResult, s as ParserOptions, t as MappedText, u as ScopeString } from "../TextMap-Cs2Bypvi.mjs";
export { type DelegateInfo, type MappedText, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, type Range, type Scope, type ScopeChain, type ScopeString, type SourceMap };

@@ -1,129 +0,2 @@

//#region src/Parser/index.d.ts
type ParserOptions = Record<string, unknown>;
type ParserName = string;
interface Parser {
/** Name of parser */
readonly name: ParserName;
/**
* Parse Method
* @param content - full content of the file
* @param filename - filename
*/
parse(content: string, filename: string): ParseResult;
}
interface ParseResult {
readonly content: string;
readonly filename: string;
readonly parsedTexts: Iterable<ParsedText>;
}
interface ParsedText {
/**
* The text extracted and possibly transformed
*/
readonly text: string;
/**
* The raw text before it has been transformed
*/
readonly rawText?: string | undefined;
/**
* start and end offsets of the text
*/
readonly range: Range;
/**
* The Scope annotation for a segment of text.
* Used by the spell checker to apply spell checking options
* based upon the value of the scope.
*/
readonly scope?: Scope | undefined;
/**
* The source map is used to support text transformations.
*
* See: {@link SourceMap}
*/
readonly map?: SourceMap | undefined;
/**
* Used to delegate parsing the contents of `text` to another parser.
*
*/
readonly delegate?: DelegateInfo | undefined;
}
/**
* A SourceMap is used to map transform a piece of text back to its original text.
* This is necessary in order to report the correct location of a spelling issue.
* An empty source map indicates that it was a 1:1 transformation.
*
* The values in a source map are number pairs (even, odd) relative to the beginning of each
* string segment.
* - even - offset in the source text
* - odd - offset in the transformed text
*
* Offsets start a 0
*
* Example:
*
* - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
* - Transformed text: `Grand Café Bjørvika`
* - Map: [9, 9, 15, 10, 18, 13, 24, 14]
*
* | offset | original | offset | transformed |
* | ------ | ----------- | ------ | ----------- |
* | 0-9 | `Grand Caf` | 0-9 | `Grand Caf` |
* | 9-15 | `\u00e9` | 9-10 | `é` |
* | 15-18 | ` Bj` | 10-13 | ` Bj` |
* | 18-24 | `\u00f8` | 13-14 | `ø` |
* | 24-29 | `rvika` | 14-19 | `rvika` |
*
* <!--- cspell:ignore Bjørvika rvika --->
*/
type SourceMap = number[];
type Range = readonly [start: number, end: number];
/**
* DelegateInfo is used by a parser to delegate parsing a subsection of a document to
* another parser. The following information is used by the spell checker to match
* the parser.
*/
interface DelegateInfo {
/**
* Proposed virtual file name including the extension.
* Format: `./${source_filename}/${block_number}.${ext}
* Example: `./README.md/1.js`
*/
readonly filename: string;
/**
* The filename of the origin of the virtual file block.
* Example: `./README.md`
*/
readonly originFilename: string;
/**
* Proposed file extension
* Example: `.js`
*/
readonly extension: string;
/**
* Filetype to use
* Example: `javascript`
*/
readonly fileType?: string;
}
/**
* Scope - chain of scope going from local to global
*
* Example:
* ```
* `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
* ```
*/
interface ScopeChain {
readonly value: string;
readonly parent?: ScopeChain | undefined;
}
/**
* A string representing a scope chain separated by spaces
*
* Example: `comment.block.documentation.ts meta.interface.ts source.ts`
*/
type ScopeString = string;
type Scope = ScopeChain | ScopeString;
//#endregion
export { DelegateInfo, ParseResult, ParsedText, Parser, ParserName, ParserOptions, Range, Scope, ScopeChain, ScopeString, SourceMap };
//# sourceMappingURL=index.d.ts.map
import { a as Parser, c as Scope, d as Range, f as SourceMap, i as ParsedText, l as ScopeChain, n as DelegateInfo, o as ParserName, r as ParseResult, s as ParserOptions, t as MappedText, u as ScopeString } from "../TextMap-B1Fq1qVW.js";
export { type DelegateInfo, type MappedText, type ParseResult, type ParsedText, type Parser, type ParserName, type ParserOptions, type Range, type Scope, type ScopeChain, type ScopeString, type SourceMap };

@@ -7,3 +7,3 @@ {

},
"version": "9.6.4",
"version": "9.7.0",
"description": "Types for cspell and cspell-lib",

@@ -89,3 +89,3 @@ "type": "commonjs",

"homepage": "https://github.com/streetsidesoftware/cspell/tree/main/packages/cspell-types#readme",
"gitHead": "e126c7f5708d4258ada35ba1d29d18952d7f0886"
"gitHead": "48f64e0bd95b39011af6dc80cd8ae4d519511f73"
}

Sorry, the diff of this file is too big to display