@cspell/cspell-types 9.0.2 → 9.1.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/cspell.schema.json +38 -132
- package/dist/Parser/index.d.mts +2 -127
- package/dist/Parser/index.d.ts +2 -127
- package/dist/Parser/index.js +0 -18
- package/dist/index-B8R3-rR5.d.mts +129 -0
- package/dist/index-CY-3Hv0u.d.ts +129 -0
- package/dist/index.d.mts +1577 -1436
- package/dist/index.d.ts +1577 -1436
- package/dist/index.js +87 -107
- package/dist/index.mjs +83 -77
- package/package.json +4 -7
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
//#region src/Parser/index.d.ts
|
|
2
|
+
type ParserOptions = Record<string, unknown>;
|
|
3
|
+
type ParserName = string;
|
|
4
|
+
interface Parser {
|
|
5
|
+
/** Name of parser */
|
|
6
|
+
readonly name: ParserName;
|
|
7
|
+
/**
|
|
8
|
+
* Parse Method
|
|
9
|
+
* @param content - full content of the file
|
|
10
|
+
* @param filename - filename
|
|
11
|
+
*/
|
|
12
|
+
parse(content: string, filename: string): ParseResult;
|
|
13
|
+
}
|
|
14
|
+
interface ParseResult {
|
|
15
|
+
readonly content: string;
|
|
16
|
+
readonly filename: string;
|
|
17
|
+
readonly parsedTexts: Iterable<ParsedText>;
|
|
18
|
+
}
|
|
19
|
+
interface ParsedText {
|
|
20
|
+
/**
|
|
21
|
+
* The text extracted and possibly transformed
|
|
22
|
+
*/
|
|
23
|
+
readonly text: string;
|
|
24
|
+
/**
|
|
25
|
+
* The raw text before it has been transformed
|
|
26
|
+
*/
|
|
27
|
+
readonly rawText?: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* start and end offsets of the text
|
|
30
|
+
*/
|
|
31
|
+
readonly range: Range;
|
|
32
|
+
/**
|
|
33
|
+
* The Scope annotation for a segment of text.
|
|
34
|
+
* Used by the spell checker to apply spell checking options
|
|
35
|
+
* based upon the value of the scope.
|
|
36
|
+
*/
|
|
37
|
+
readonly scope?: Scope | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The source map is used to support text transformations.
|
|
40
|
+
*
|
|
41
|
+
* See: {@link SourceMap}
|
|
42
|
+
*/
|
|
43
|
+
readonly map?: SourceMap | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Used to delegate parsing the contents of `text` to another parser.
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
readonly delegate?: DelegateInfo | undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A SourceMap is used to map transform a piece of text back to its original text.
|
|
52
|
+
* This is necessary in order to report the correct location of a spelling issue.
|
|
53
|
+
* An empty source map indicates that it was a 1:1 transformation.
|
|
54
|
+
*
|
|
55
|
+
* The values in a source map are number pairs (even, odd) relative to the beginning of each
|
|
56
|
+
* string segment.
|
|
57
|
+
* - even - offset in the source text
|
|
58
|
+
* - odd - offset in the transformed text
|
|
59
|
+
*
|
|
60
|
+
* Offsets start a 0
|
|
61
|
+
*
|
|
62
|
+
* Example:
|
|
63
|
+
*
|
|
64
|
+
* - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
|
|
65
|
+
* - Transformed text: `Grand Café Bjørvika`
|
|
66
|
+
* - Map: [9, 9, 15, 10, 18, 13, 24, 14]
|
|
67
|
+
*
|
|
68
|
+
* | offset | original | offset | transformed |
|
|
69
|
+
* | ------ | ----------- | ------ | ----------- |
|
|
70
|
+
* | 0-9 | `Grand Caf` | 0-9 | `Grand Caf` |
|
|
71
|
+
* | 9-15 | `\u00e9` | 9-10 | `é` |
|
|
72
|
+
* | 15-18 | ` Bj` | 10-13 | ` Bj` |
|
|
73
|
+
* | 18-24 | `\u00f8` | 13-14 | `ø` |
|
|
74
|
+
* | 24-29 | `rvika` | 14-19 | `rvika` |
|
|
75
|
+
*
|
|
76
|
+
* <!--- cspell:ignore Bjørvika rvika --->
|
|
77
|
+
*/
|
|
78
|
+
type SourceMap = number[];
|
|
79
|
+
type Range = readonly [start: number, end: number];
|
|
80
|
+
/**
|
|
81
|
+
* DelegateInfo is used by a parser to delegate parsing a subsection of a document to
|
|
82
|
+
* another parser. The following information is used by the spell checker to match
|
|
83
|
+
* the parser.
|
|
84
|
+
*/
|
|
85
|
+
interface DelegateInfo {
|
|
86
|
+
/**
|
|
87
|
+
* Proposed virtual file name including the extension.
|
|
88
|
+
* Format: `./${source_filename}/${block_number}.${ext}
|
|
89
|
+
* Example: `./README.md/1.js`
|
|
90
|
+
*/
|
|
91
|
+
readonly filename: string;
|
|
92
|
+
/**
|
|
93
|
+
* The filename of the origin of the virtual file block.
|
|
94
|
+
* Example: `./README.md`
|
|
95
|
+
*/
|
|
96
|
+
readonly originFilename: string;
|
|
97
|
+
/**
|
|
98
|
+
* Proposed file extension
|
|
99
|
+
* Example: `.js`
|
|
100
|
+
*/
|
|
101
|
+
readonly extension: string;
|
|
102
|
+
/**
|
|
103
|
+
* Filetype to use
|
|
104
|
+
* Example: `javascript`
|
|
105
|
+
*/
|
|
106
|
+
readonly fileType?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Scope - chain of scope going from local to global
|
|
110
|
+
*
|
|
111
|
+
* Example:
|
|
112
|
+
* ```
|
|
113
|
+
* `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
interface ScopeChain {
|
|
117
|
+
readonly value: string;
|
|
118
|
+
readonly parent?: ScopeChain | undefined;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* A string representing a scope chain separated by spaces
|
|
122
|
+
*
|
|
123
|
+
* Example: `comment.block.documentation.ts meta.interface.ts source.ts`
|
|
124
|
+
*/
|
|
125
|
+
type ScopeString = string;
|
|
126
|
+
type Scope = ScopeChain | ScopeString;
|
|
127
|
+
//#endregion
|
|
128
|
+
export { DelegateInfo, ParseResult, ParsedText, Parser, ParserName, ParserOptions, Range, Scope, ScopeChain, ScopeString, SourceMap };
|
|
129
|
+
//# sourceMappingURL=index-B8R3-rR5.d.mts.map
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
//#region src/Parser/index.d.ts
|
|
2
|
+
type ParserOptions = Record<string, unknown>;
|
|
3
|
+
type ParserName = string;
|
|
4
|
+
interface Parser {
|
|
5
|
+
/** Name of parser */
|
|
6
|
+
readonly name: ParserName;
|
|
7
|
+
/**
|
|
8
|
+
* Parse Method
|
|
9
|
+
* @param content - full content of the file
|
|
10
|
+
* @param filename - filename
|
|
11
|
+
*/
|
|
12
|
+
parse(content: string, filename: string): ParseResult;
|
|
13
|
+
}
|
|
14
|
+
interface ParseResult {
|
|
15
|
+
readonly content: string;
|
|
16
|
+
readonly filename: string;
|
|
17
|
+
readonly parsedTexts: Iterable<ParsedText>;
|
|
18
|
+
}
|
|
19
|
+
interface ParsedText {
|
|
20
|
+
/**
|
|
21
|
+
* The text extracted and possibly transformed
|
|
22
|
+
*/
|
|
23
|
+
readonly text: string;
|
|
24
|
+
/**
|
|
25
|
+
* The raw text before it has been transformed
|
|
26
|
+
*/
|
|
27
|
+
readonly rawText?: string | undefined;
|
|
28
|
+
/**
|
|
29
|
+
* start and end offsets of the text
|
|
30
|
+
*/
|
|
31
|
+
readonly range: Range;
|
|
32
|
+
/**
|
|
33
|
+
* The Scope annotation for a segment of text.
|
|
34
|
+
* Used by the spell checker to apply spell checking options
|
|
35
|
+
* based upon the value of the scope.
|
|
36
|
+
*/
|
|
37
|
+
readonly scope?: Scope | undefined;
|
|
38
|
+
/**
|
|
39
|
+
* The source map is used to support text transformations.
|
|
40
|
+
*
|
|
41
|
+
* See: {@link SourceMap}
|
|
42
|
+
*/
|
|
43
|
+
readonly map?: SourceMap | undefined;
|
|
44
|
+
/**
|
|
45
|
+
* Used to delegate parsing the contents of `text` to another parser.
|
|
46
|
+
*
|
|
47
|
+
*/
|
|
48
|
+
readonly delegate?: DelegateInfo | undefined;
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* A SourceMap is used to map transform a piece of text back to its original text.
|
|
52
|
+
* This is necessary in order to report the correct location of a spelling issue.
|
|
53
|
+
* An empty source map indicates that it was a 1:1 transformation.
|
|
54
|
+
*
|
|
55
|
+
* The values in a source map are number pairs (even, odd) relative to the beginning of each
|
|
56
|
+
* string segment.
|
|
57
|
+
* - even - offset in the source text
|
|
58
|
+
* - odd - offset in the transformed text
|
|
59
|
+
*
|
|
60
|
+
* Offsets start a 0
|
|
61
|
+
*
|
|
62
|
+
* Example:
|
|
63
|
+
*
|
|
64
|
+
* - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
|
|
65
|
+
* - Transformed text: `Grand Café Bjørvika`
|
|
66
|
+
* - Map: [9, 9, 15, 10, 18, 13, 24, 14]
|
|
67
|
+
*
|
|
68
|
+
* | offset | original | offset | transformed |
|
|
69
|
+
* | ------ | ----------- | ------ | ----------- |
|
|
70
|
+
* | 0-9 | `Grand Caf` | 0-9 | `Grand Caf` |
|
|
71
|
+
* | 9-15 | `\u00e9` | 9-10 | `é` |
|
|
72
|
+
* | 15-18 | ` Bj` | 10-13 | ` Bj` |
|
|
73
|
+
* | 18-24 | `\u00f8` | 13-14 | `ø` |
|
|
74
|
+
* | 24-29 | `rvika` | 14-19 | `rvika` |
|
|
75
|
+
*
|
|
76
|
+
* <!--- cspell:ignore Bjørvika rvika --->
|
|
77
|
+
*/
|
|
78
|
+
type SourceMap = number[];
|
|
79
|
+
type Range = readonly [start: number, end: number];
|
|
80
|
+
/**
|
|
81
|
+
* DelegateInfo is used by a parser to delegate parsing a subsection of a document to
|
|
82
|
+
* another parser. The following information is used by the spell checker to match
|
|
83
|
+
* the parser.
|
|
84
|
+
*/
|
|
85
|
+
interface DelegateInfo {
|
|
86
|
+
/**
|
|
87
|
+
* Proposed virtual file name including the extension.
|
|
88
|
+
* Format: `./${source_filename}/${block_number}.${ext}
|
|
89
|
+
* Example: `./README.md/1.js`
|
|
90
|
+
*/
|
|
91
|
+
readonly filename: string;
|
|
92
|
+
/**
|
|
93
|
+
* The filename of the origin of the virtual file block.
|
|
94
|
+
* Example: `./README.md`
|
|
95
|
+
*/
|
|
96
|
+
readonly originFilename: string;
|
|
97
|
+
/**
|
|
98
|
+
* Proposed file extension
|
|
99
|
+
* Example: `.js`
|
|
100
|
+
*/
|
|
101
|
+
readonly extension: string;
|
|
102
|
+
/**
|
|
103
|
+
* Filetype to use
|
|
104
|
+
* Example: `javascript`
|
|
105
|
+
*/
|
|
106
|
+
readonly fileType?: string;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Scope - chain of scope going from local to global
|
|
110
|
+
*
|
|
111
|
+
* Example:
|
|
112
|
+
* ```
|
|
113
|
+
* `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
interface ScopeChain {
|
|
117
|
+
readonly value: string;
|
|
118
|
+
readonly parent?: ScopeChain | undefined;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* A string representing a scope chain separated by spaces
|
|
122
|
+
*
|
|
123
|
+
* Example: `comment.block.documentation.ts meta.interface.ts source.ts`
|
|
124
|
+
*/
|
|
125
|
+
type ScopeString = string;
|
|
126
|
+
type Scope = ScopeChain | ScopeString;
|
|
127
|
+
//#endregion
|
|
128
|
+
export { DelegateInfo, ParseResult, ParsedText, Parser, ParserName, ParserOptions, Range, Scope, ScopeChain, ScopeString, SourceMap };
|
|
129
|
+
//# sourceMappingURL=index-CY-3Hv0u.d.ts.map
|