@cspell/cspell-types 6.1.3-alpha.1 → 6.1.3
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/Parser.d.ts +17 -13
- package/dist/TextMap.d.ts +36 -0
- package/dist/TextMap.js +3 -0
- package/dist/TextOffset.d.ts +0 -21
- package/dist/index.d.ts +2 -1
- package/package.json +3 -3
package/dist/Parser.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ export declare type ParserOptions = Record<string, unknown>;
|
|
|
2
2
|
export declare type ParserName = string;
|
|
3
3
|
export interface Parser {
|
|
4
4
|
/** Name of parser */
|
|
5
|
-
name: ParserName;
|
|
5
|
+
readonly name: ParserName;
|
|
6
6
|
/**
|
|
7
7
|
* Parse Method
|
|
8
8
|
* @param content - full content of the file
|
|
@@ -11,36 +11,40 @@ export interface Parser {
|
|
|
11
11
|
parse(content: string, filename: string): ParseResult;
|
|
12
12
|
}
|
|
13
13
|
export interface ParseResult {
|
|
14
|
-
content: string;
|
|
15
|
-
filename: string;
|
|
16
|
-
parsedTexts: Iterable<ParsedText>;
|
|
14
|
+
readonly content: string;
|
|
15
|
+
readonly filename: string;
|
|
16
|
+
readonly parsedTexts: Iterable<ParsedText>;
|
|
17
17
|
}
|
|
18
18
|
export interface ParsedText {
|
|
19
19
|
/**
|
|
20
20
|
* The text extracted and possibly transformed
|
|
21
21
|
*/
|
|
22
|
-
text: string;
|
|
22
|
+
readonly text: string;
|
|
23
|
+
/**
|
|
24
|
+
* The raw text before it has been transformed
|
|
25
|
+
*/
|
|
26
|
+
readonly rawText?: string | undefined;
|
|
23
27
|
/**
|
|
24
28
|
* start and end offsets of the text
|
|
25
29
|
*/
|
|
26
|
-
range: Range;
|
|
30
|
+
readonly range: Range;
|
|
27
31
|
/**
|
|
28
32
|
* The Scope annotation for a segment of text.
|
|
29
33
|
* Used by the spell checker to apply spell checking options
|
|
30
34
|
* based upon the value of the scope.
|
|
31
35
|
*/
|
|
32
|
-
scope?: Scope | undefined;
|
|
36
|
+
readonly scope?: Scope | undefined;
|
|
33
37
|
/**
|
|
34
38
|
* The source map is used to support text transformations.
|
|
35
39
|
*
|
|
36
40
|
* See: {@link SourceMap}
|
|
37
41
|
*/
|
|
38
|
-
map?: SourceMap | undefined;
|
|
42
|
+
readonly map?: SourceMap | undefined;
|
|
39
43
|
/**
|
|
40
44
|
* Used to delegate parsing the contents of `text` to another parser.
|
|
41
45
|
*
|
|
42
46
|
*/
|
|
43
|
-
delegate?: DelegateInfo | undefined;
|
|
47
|
+
readonly delegate?: DelegateInfo | undefined;
|
|
44
48
|
}
|
|
45
49
|
/**
|
|
46
50
|
* A SourceMap is used to map transform a piece of text back to its original text.
|
|
@@ -83,22 +87,22 @@ export interface DelegateInfo {
|
|
|
83
87
|
* Format: `./${source_filename}/${block_number}.${ext}
|
|
84
88
|
* Example: `./README.md/1.js`
|
|
85
89
|
*/
|
|
86
|
-
filename: string;
|
|
90
|
+
readonly filename: string;
|
|
87
91
|
/**
|
|
88
92
|
* The filename of the origin of the virtual file block.
|
|
89
93
|
* Example: `./README.md`
|
|
90
94
|
*/
|
|
91
|
-
originFilename: string;
|
|
95
|
+
readonly originFilename: string;
|
|
92
96
|
/**
|
|
93
97
|
* Proposed file extension
|
|
94
98
|
* Example: `.js`
|
|
95
99
|
*/
|
|
96
|
-
extension: string;
|
|
100
|
+
readonly extension: string;
|
|
97
101
|
/**
|
|
98
102
|
* Filetype to use
|
|
99
103
|
* Example: `javascript`
|
|
100
104
|
*/
|
|
101
|
-
fileType
|
|
105
|
+
readonly fileType?: string;
|
|
102
106
|
}
|
|
103
107
|
/**
|
|
104
108
|
* Scope - chain of scope going from local to global
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
export declare type MappedText = Readonly<TransformedText>;
|
|
2
|
+
export declare type Range = readonly [start: number, end: number];
|
|
3
|
+
export interface Mapped {
|
|
4
|
+
/**
|
|
5
|
+
* `(i, j)` number pairs where
|
|
6
|
+
* - `i` is the offset in the source
|
|
7
|
+
* - `j` is the offset in the destination
|
|
8
|
+
*
|
|
9
|
+
* Example:
|
|
10
|
+
* - source text = `"caf\xe9"`
|
|
11
|
+
* - mapped text = `"café"`
|
|
12
|
+
* - map = `[3, 3, 7, 4]`, which is equivalent to `[0, 0, 3, 3, 7, 4]`
|
|
13
|
+
* where the `[0, 0]` is unnecessary.
|
|
14
|
+
*
|
|
15
|
+
*/
|
|
16
|
+
map: number[];
|
|
17
|
+
}
|
|
18
|
+
interface TransformedText extends PartialOrUndefined<Mapped> {
|
|
19
|
+
/**
|
|
20
|
+
* Transformed text with an optional map.
|
|
21
|
+
*/
|
|
22
|
+
text: string;
|
|
23
|
+
/**
|
|
24
|
+
* The original text
|
|
25
|
+
*/
|
|
26
|
+
rawText?: string | undefined;
|
|
27
|
+
/**
|
|
28
|
+
* The start and end offset of the text in the document.
|
|
29
|
+
*/
|
|
30
|
+
range: Range;
|
|
31
|
+
}
|
|
32
|
+
declare type PartialOrUndefined<T> = {
|
|
33
|
+
[P in keyof T]?: T[P] | undefined;
|
|
34
|
+
};
|
|
35
|
+
export {};
|
|
36
|
+
//# sourceMappingURL=TextMap.d.ts.map
|
package/dist/TextMap.js
ADDED
package/dist/TextOffset.d.ts
CHANGED
|
@@ -20,25 +20,4 @@ export interface TextDocumentOffset extends TextOffset {
|
|
|
20
20
|
col: number;
|
|
21
21
|
line: TextOffset;
|
|
22
22
|
}
|
|
23
|
-
export interface Mapped {
|
|
24
|
-
/**
|
|
25
|
-
* `(i, j)` number pairs where
|
|
26
|
-
* - `i` is the offset in the source
|
|
27
|
-
* - `j` is the offset in the destination
|
|
28
|
-
*
|
|
29
|
-
* Example:
|
|
30
|
-
* - source text = `"caf\xe9"`
|
|
31
|
-
* - mapped text = `"café"`
|
|
32
|
-
* - map = `[3, 3, 7, 4]`, which is equivalent to `[0, 0, 3, 3, 7, 4]`
|
|
33
|
-
* where the `[0, 0]` is unnecessary.
|
|
34
|
-
*
|
|
35
|
-
*/
|
|
36
|
-
map: number[];
|
|
37
|
-
}
|
|
38
|
-
export interface TransformedText extends Partial<Mapped> {
|
|
39
|
-
/**
|
|
40
|
-
* Transformed text with an optional map.
|
|
41
|
-
*/
|
|
42
|
-
text: string;
|
|
43
|
-
}
|
|
44
23
|
//# sourceMappingURL=TextOffset.d.ts.map
|
package/dist/index.d.ts
CHANGED
|
@@ -4,7 +4,8 @@ export * from './CSpellReporter';
|
|
|
4
4
|
export * from './CSpellSettingsDef';
|
|
5
5
|
export type { CharacterSet, CharacterSetCosts, DictionaryInformation, EditCosts } from './DictionaryInformation';
|
|
6
6
|
export type { Feature, Features } from './features';
|
|
7
|
+
export type { ParsedText, Parser, ParseResult, ParserName, ParserOptions } from './Parser';
|
|
7
8
|
export type { SuggestionCostMapDef, SuggestionCostsDefs } from './suggestionCostsDef';
|
|
9
|
+
export type { MappedText } from './TextMap';
|
|
8
10
|
export type { TextDocumentOffset, TextOffset } from './TextOffset';
|
|
9
|
-
export type { ParseResult, ParsedText, Parser, ParserName, ParserOptions } from './Parser';
|
|
10
11
|
//# sourceMappingURL=index.d.ts.map
|
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "6.1.3
|
|
6
|
+
"version": "6.1.3",
|
|
7
7
|
"description": "Types for cspell and cspell-lib",
|
|
8
8
|
"type": "commonjs",
|
|
9
9
|
"main": "dist/index.js",
|
|
@@ -67,7 +67,7 @@
|
|
|
67
67
|
"jest": "^28.1.1",
|
|
68
68
|
"rimraf": "^3.0.2",
|
|
69
69
|
"ts-json-schema-generator": "^1.0.0",
|
|
70
|
-
"typescript": "^4.7.
|
|
70
|
+
"typescript": "^4.7.4"
|
|
71
71
|
},
|
|
72
|
-
"gitHead": "
|
|
72
|
+
"gitHead": "e96b313542f2ec0a38ac04d1422d97e724ded3a6"
|
|
73
73
|
}
|