@cspell/cspell-types 10.0.1 → 10.1.0

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.
@@ -2152,11 +2152,11 @@
2152
2152
  "type": "string"
2153
2153
  },
2154
2154
  "ignorePaths": {
2155
- "description": "Glob patterns of files to be ignored.\n\nGlob patterns are relative to the {@link globRoot } of the configuration file that defines them.",
2155
+ "description": "Glob patterns of files to be ignored.\n\nGlob patterns are relative to the {@link globRoot } of the configuration file that defines them.\n\nThe default is `[\"node_modules/\"]`.\n\nWarning: if you ignore `\".git/\"` then it will also ignore `\".git/COMMIT_EDITMSG\"` which is needed for the `commit-msg` git hook; in that case, rather use `[\".git/{info,lfs,logs,refs,objects}/**\", \".git/{index,*refs,*HEAD}\"]`.",
2156
2156
  "items": {
2157
2157
  "$ref": "#/definitions/Glob"
2158
2158
  },
2159
- "markdownDescription": "Glob patterns of files to be ignored.\n\nGlob patterns are relative to the {@link globRoot } of the configuration file that defines them.",
2159
+ "markdownDescription": "Glob patterns of files to be ignored.\n\nGlob patterns are relative to the {@link globRoot } of the configuration file that defines them.\n\nThe default is `[\"node_modules/\"]`.\n\nWarning: if you ignore `\".git/\"` then it will also ignore `\".git/COMMIT_EDITMSG\"` which is needed for the `commit-msg` git hook; in that case, rather use `[\".git/{info,lfs,logs,refs,objects}/**\", \".git/{index,*refs,*HEAD}\"]`.",
2160
2160
  "type": "array"
2161
2161
  },
2162
2162
  "ignoreRandomStrings": {
@@ -1,2 +1,2 @@
1
- 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 "../index-ufqGDeKQ.mjs";
1
+ 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 "../index-BXiGhX2J.mjs";
2
2
  export type { DelegateInfo, MappedText, ParseResult, ParsedText, Parser, ParserName, ParserOptions, Range, Scope, ScopeChain, ScopeString, SourceMap };
@@ -1,2 +1,2 @@
1
- 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 "../index-ufqGDeKQ.js";
1
+ 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 "../index-BXiGhX2J.js";
2
2
  export type { DelegateInfo, MappedText, ParseResult, ParsedText, Parser, ParserName, ParserOptions, Range, Scope, ScopeChain, ScopeString, SourceMap };
@@ -0,0 +1,176 @@
1
+ //#region src/Parser/types.d.ts
2
+ /**
3
+ * A SourceMap is used to map or transform the location of a piece of text back to its original offsets.
4
+ * This is necessary in order to report the correct location of a spelling issue.
5
+ * An empty source map indicates that it was a 1:1 transformation.
6
+ *
7
+ * Non-1:1 transformations are considered to be a single segment and cannot be split.
8
+ *
9
+ * A partial index into a non-linear segment will get mapped to the start of the segment.
10
+ *
11
+ * To signal a non-1:1 transformation a 0,0 pair can be used in the source map. This indicates that the
12
+ * following segment is a non-linear transformation and should not be split.
13
+ *
14
+ * This is important when multiple transformations have been applied to the same text, and the source map
15
+ * is being used to map back to the original text.
16
+ *
17
+ * For example: `\u00e9` might be transformed to `é` in one transformation and then to HTML entity `é`.
18
+ * The resulting sourceMap would be `[..., 0, 0, 6, 6, ...]` to indicate that the 6 character segment should
19
+ * not be split when mapping back to the original text.
20
+ *
21
+ * The values in a source map are number pairs (even, odd) relative to the beginning of each
22
+ * string segment.
23
+ * - even - span length in the source text
24
+ * - odd - span length in the transformed text
25
+ *
26
+ * Offsets start at 0
27
+ *
28
+ * Example:
29
+ *
30
+ * - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
31
+ * - Transformed text: `Grand Café Bjørvika`
32
+ * - Map: [9, 9, 6, 1, 3, 3, 6, 1, 5, 5]
33
+ *
34
+ * | offset | span | original | offset | span | transformed |
35
+ * | ------ | ---- | ----------- | ------ | ---- | ----------- |
36
+ * | 0-9 | 9 | `Grand Caf` | 0-9 | 9 | `Grand Caf` |
37
+ * | 9-15 | 6 | `\u00e9` | 9-10 | 1 | `é` |
38
+ * | 15-18 | 3 | ` Bj` | 10-13 | 3 | ` Bj` |
39
+ * | 18-24 | 6 | `\u00f8` | 13-14 | 1 | `ø` |
40
+ * | 24-29 | 5 | `rvika` | 14-19 | 5 | `rvika` |
41
+ *
42
+ * Note: The trailing 5,5 is not necessary since it is a 1:1 mapping, but it is included for clarity.
43
+ *
44
+ * <!--- cspell:ignore Bjørvika rvika --->
45
+ */
46
+ type SourceMap = number[];
47
+ /**
48
+ * A range of text in a document.
49
+ * The range is inclusive of the start and exclusive of the end.
50
+ */
51
+ type Range = readonly [start: number, end: number];
52
+ //#endregion
53
+ //#region src/Parser/Mapped.d.ts
54
+ interface Mapped {
55
+ /**
56
+ * The absolute start and end offset of the text in the source.
57
+ */
58
+ range: Range;
59
+ /**
60
+ * `(i, j)` number pairs where
61
+ * - `i` is the offset in the source relative to the start of the range
62
+ * - `j` is the offset in the transformed destination
63
+ *
64
+ * Example:
65
+ * - source text = `"caf\xe9"`
66
+ * - mapped text = `"café"`
67
+ * - map = `[3, 3, 4, 1]`
68
+ *
69
+ * See: {@link SourceMap}
70
+ *
71
+ */
72
+ map?: SourceMap | undefined;
73
+ }
74
+ //#endregion
75
+ //#region src/Parser/parser.d.ts
76
+ type ParserOptions = Record<string, unknown>;
77
+ type ParserName = string;
78
+ interface Parser {
79
+ /** Name of parser */
80
+ readonly name: ParserName;
81
+ /**
82
+ * Parse Method
83
+ * @param content - full content of the file
84
+ * @param filename - filename
85
+ */
86
+ parse(content: string, filename: string): ParseResult;
87
+ }
88
+ interface ParseResult {
89
+ readonly content: string;
90
+ readonly filename: string;
91
+ readonly parsedTexts: Iterable<ParsedText>;
92
+ }
93
+ interface ParsedText extends Readonly<Mapped> {
94
+ /**
95
+ * The text extracted and possibly transformed
96
+ */
97
+ readonly text: string;
98
+ /**
99
+ * The raw text before it has been transformed
100
+ */
101
+ readonly rawText?: string | undefined;
102
+ /**
103
+ * The Scope annotation for a segment of text.
104
+ * Used by the spell checker to apply spell checking options
105
+ * based upon the value of the scope.
106
+ */
107
+ readonly scope?: Scope | undefined;
108
+ /**
109
+ * Used to delegate parsing the contents of `text` to another parser.
110
+ *
111
+ */
112
+ readonly delegate?: DelegateInfo | undefined;
113
+ }
114
+ /**
115
+ * DelegateInfo is used by a parser to delegate parsing a subsection of a document to
116
+ * another parser. The following information is used by the spell checker to match
117
+ * the parser.
118
+ */
119
+ interface DelegateInfo {
120
+ /**
121
+ * Proposed virtual file name including the extension.
122
+ * Format: `./${source_filename}/${block_number}.${ext}
123
+ * Example: `./README.md/1.js`
124
+ */
125
+ readonly filename: string;
126
+ /**
127
+ * The filename of the origin of the virtual file block.
128
+ * Example: `./README.md`
129
+ */
130
+ readonly originFilename: string;
131
+ /**
132
+ * Proposed file extension
133
+ * Example: `.js`
134
+ */
135
+ readonly extension: string;
136
+ /**
137
+ * Filetype to use
138
+ * Example: `javascript`
139
+ */
140
+ readonly fileType?: string;
141
+ }
142
+ /**
143
+ * Scope - chain of scope going from local to global
144
+ *
145
+ * Example:
146
+ * ```
147
+ * `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
148
+ * ```
149
+ */
150
+ interface ScopeChain {
151
+ readonly value: string;
152
+ readonly parent?: ScopeChain | undefined;
153
+ }
154
+ /**
155
+ * A string representing a scope chain separated by spaces
156
+ *
157
+ * Example: `comment.block.documentation.ts meta.interface.ts source.ts`
158
+ */
159
+ type ScopeString = string;
160
+ type Scope = ScopeChain | ScopeString;
161
+ //#endregion
162
+ //#region src/Parser/TextMap.d.ts
163
+ type MappedText = Readonly<TransformedText>;
164
+ interface TransformedText extends Mapped {
165
+ /**
166
+ * Transformed text with an optional map.
167
+ */
168
+ text: string;
169
+ /**
170
+ * The original text
171
+ */
172
+ rawText?: string | undefined;
173
+ }
174
+ //#endregion
175
+ 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 };
176
+ //# sourceMappingURL=index-BXiGhX2J.d.mts.map
@@ -0,0 +1,176 @@
1
+ //#region src/Parser/types.d.ts
2
+ /**
3
+ * A SourceMap is used to map or transform the location of a piece of text back to its original offsets.
4
+ * This is necessary in order to report the correct location of a spelling issue.
5
+ * An empty source map indicates that it was a 1:1 transformation.
6
+ *
7
+ * Non-1:1 transformations are considered to be a single segment and cannot be split.
8
+ *
9
+ * A partial index into a non-linear segment will get mapped to the start of the segment.
10
+ *
11
+ * To signal a non-1:1 transformation a 0,0 pair can be used in the source map. This indicates that the
12
+ * following segment is a non-linear transformation and should not be split.
13
+ *
14
+ * This is important when multiple transformations have been applied to the same text, and the source map
15
+ * is being used to map back to the original text.
16
+ *
17
+ * For example: `\u00e9` might be transformed to `é` in one transformation and then to HTML entity `&#233;`.
18
+ * The resulting sourceMap would be `[..., 0, 0, 6, 6, ...]` to indicate that the 6 character segment should
19
+ * not be split when mapping back to the original text.
20
+ *
21
+ * The values in a source map are number pairs (even, odd) relative to the beginning of each
22
+ * string segment.
23
+ * - even - span length in the source text
24
+ * - odd - span length in the transformed text
25
+ *
26
+ * Offsets start at 0
27
+ *
28
+ * Example:
29
+ *
30
+ * - Original text: `Grand Caf\u00e9 Bj\u00f8rvika`
31
+ * - Transformed text: `Grand Café Bjørvika`
32
+ * - Map: [9, 9, 6, 1, 3, 3, 6, 1, 5, 5]
33
+ *
34
+ * | offset | span | original | offset | span | transformed |
35
+ * | ------ | ---- | ----------- | ------ | ---- | ----------- |
36
+ * | 0-9 | 9 | `Grand Caf` | 0-9 | 9 | `Grand Caf` |
37
+ * | 9-15 | 6 | `\u00e9` | 9-10 | 1 | `é` |
38
+ * | 15-18 | 3 | ` Bj` | 10-13 | 3 | ` Bj` |
39
+ * | 18-24 | 6 | `\u00f8` | 13-14 | 1 | `ø` |
40
+ * | 24-29 | 5 | `rvika` | 14-19 | 5 | `rvika` |
41
+ *
42
+ * Note: The trailing 5,5 is not necessary since it is a 1:1 mapping, but it is included for clarity.
43
+ *
44
+ * <!--- cspell:ignore Bjørvika rvika --->
45
+ */
46
+ type SourceMap = number[];
47
+ /**
48
+ * A range of text in a document.
49
+ * The range is inclusive of the start and exclusive of the end.
50
+ */
51
+ type Range = readonly [start: number, end: number];
52
+ //#endregion
53
+ //#region src/Parser/Mapped.d.ts
54
+ interface Mapped {
55
+ /**
56
+ * The absolute start and end offset of the text in the source.
57
+ */
58
+ range: Range;
59
+ /**
60
+ * `(i, j)` number pairs where
61
+ * - `i` is the offset in the source relative to the start of the range
62
+ * - `j` is the offset in the transformed destination
63
+ *
64
+ * Example:
65
+ * - source text = `"caf\xe9"`
66
+ * - mapped text = `"café"`
67
+ * - map = `[3, 3, 4, 1]`
68
+ *
69
+ * See: {@link SourceMap}
70
+ *
71
+ */
72
+ map?: SourceMap | undefined;
73
+ }
74
+ //#endregion
75
+ //#region src/Parser/parser.d.ts
76
+ type ParserOptions = Record<string, unknown>;
77
+ type ParserName = string;
78
+ interface Parser {
79
+ /** Name of parser */
80
+ readonly name: ParserName;
81
+ /**
82
+ * Parse Method
83
+ * @param content - full content of the file
84
+ * @param filename - filename
85
+ */
86
+ parse(content: string, filename: string): ParseResult;
87
+ }
88
+ interface ParseResult {
89
+ readonly content: string;
90
+ readonly filename: string;
91
+ readonly parsedTexts: Iterable<ParsedText>;
92
+ }
93
+ interface ParsedText extends Readonly<Mapped> {
94
+ /**
95
+ * The text extracted and possibly transformed
96
+ */
97
+ readonly text: string;
98
+ /**
99
+ * The raw text before it has been transformed
100
+ */
101
+ readonly rawText?: string | undefined;
102
+ /**
103
+ * The Scope annotation for a segment of text.
104
+ * Used by the spell checker to apply spell checking options
105
+ * based upon the value of the scope.
106
+ */
107
+ readonly scope?: Scope | undefined;
108
+ /**
109
+ * Used to delegate parsing the contents of `text` to another parser.
110
+ *
111
+ */
112
+ readonly delegate?: DelegateInfo | undefined;
113
+ }
114
+ /**
115
+ * DelegateInfo is used by a parser to delegate parsing a subsection of a document to
116
+ * another parser. The following information is used by the spell checker to match
117
+ * the parser.
118
+ */
119
+ interface DelegateInfo {
120
+ /**
121
+ * Proposed virtual file name including the extension.
122
+ * Format: `./${source_filename}/${block_number}.${ext}
123
+ * Example: `./README.md/1.js`
124
+ */
125
+ readonly filename: string;
126
+ /**
127
+ * The filename of the origin of the virtual file block.
128
+ * Example: `./README.md`
129
+ */
130
+ readonly originFilename: string;
131
+ /**
132
+ * Proposed file extension
133
+ * Example: `.js`
134
+ */
135
+ readonly extension: string;
136
+ /**
137
+ * Filetype to use
138
+ * Example: `javascript`
139
+ */
140
+ readonly fileType?: string;
141
+ }
142
+ /**
143
+ * Scope - chain of scope going from local to global
144
+ *
145
+ * Example:
146
+ * ```
147
+ * `comment.block.documentation.ts` -> `meta.interface.ts` -> `source.ts`
148
+ * ```
149
+ */
150
+ interface ScopeChain {
151
+ readonly value: string;
152
+ readonly parent?: ScopeChain | undefined;
153
+ }
154
+ /**
155
+ * A string representing a scope chain separated by spaces
156
+ *
157
+ * Example: `comment.block.documentation.ts meta.interface.ts source.ts`
158
+ */
159
+ type ScopeString = string;
160
+ type Scope = ScopeChain | ScopeString;
161
+ //#endregion
162
+ //#region src/Parser/TextMap.d.ts
163
+ type MappedText = Readonly<TransformedText>;
164
+ interface TransformedText extends Mapped {
165
+ /**
166
+ * Transformed text with an optional map.
167
+ */
168
+ text: string;
169
+ /**
170
+ * The original text
171
+ */
172
+ rawText?: string | undefined;
173
+ }
174
+ //#endregion
175
+ 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 };
176
+ //# sourceMappingURL=index-BXiGhX2J.d.ts.map