@cspell/cspell-types 6.1.3-alpha.1 → 6.2.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.
- package/cspell.schema.json +22 -1
- package/dist/CSpellSettingsDef.d.ts +20 -10
- 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/configFields.js +0 -1
- package/dist/index.d.ts +2 -1
- package/dist/types.d.ts +9 -0
- package/dist/types.js +5 -0
- package/package.json +4 -4
package/cspell.schema.json
CHANGED
|
@@ -1103,7 +1103,9 @@
|
|
|
1103
1103
|
{
|
|
1104
1104
|
"type": "string"
|
|
1105
1105
|
},
|
|
1106
|
-
{
|
|
1106
|
+
{
|
|
1107
|
+
"$ref": "#/definitions/Serializable"
|
|
1108
|
+
}
|
|
1107
1109
|
],
|
|
1108
1110
|
"maxItems": 2,
|
|
1109
1111
|
"minItems": 2,
|
|
@@ -1112,6 +1114,25 @@
|
|
|
1112
1114
|
],
|
|
1113
1115
|
"description": "Reporter name or reporter name + reporter config."
|
|
1114
1116
|
},
|
|
1117
|
+
"Serializable": {
|
|
1118
|
+
"anyOf": [
|
|
1119
|
+
{
|
|
1120
|
+
"type": "number"
|
|
1121
|
+
},
|
|
1122
|
+
{
|
|
1123
|
+
"type": "string"
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
"type": "boolean"
|
|
1127
|
+
},
|
|
1128
|
+
{
|
|
1129
|
+
"type": "null"
|
|
1130
|
+
},
|
|
1131
|
+
{
|
|
1132
|
+
"type": "object"
|
|
1133
|
+
}
|
|
1134
|
+
]
|
|
1135
|
+
},
|
|
1115
1136
|
"SimpleGlob": {
|
|
1116
1137
|
"description": "Simple Glob string, the root will be globRoot.",
|
|
1117
1138
|
"type": "string"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { DictionaryInformation } from './DictionaryInformation';
|
|
2
2
|
import type { Features } from './features';
|
|
3
3
|
import { Parser, ParserName } from './Parser';
|
|
4
|
+
import { Serializable } from './types';
|
|
4
5
|
export declare type ReplaceEntry = [string, string];
|
|
5
6
|
export declare type ReplaceMap = ReplaceEntry[];
|
|
6
7
|
/**
|
|
@@ -9,11 +10,6 @@ export declare type ReplaceMap = ReplaceEntry[];
|
|
|
9
10
|
export declare type CSpellPackageSettings = CSpellUserSettings;
|
|
10
11
|
export declare type CSpellUserSettings = CSpellSettings;
|
|
11
12
|
export interface CSpellSettings extends FileSettings, LegacySettings {
|
|
12
|
-
/**
|
|
13
|
-
* Url to JSON Schema
|
|
14
|
-
* @default "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json"
|
|
15
|
-
*/
|
|
16
|
-
$schema?: string;
|
|
17
13
|
}
|
|
18
14
|
export interface ImportFileRef {
|
|
19
15
|
filename: string;
|
|
@@ -25,7 +21,14 @@ export interface CSpellSettingsWithSourceTrace extends CSpellSettings {
|
|
|
25
21
|
__importRef?: ImportFileRef;
|
|
26
22
|
__imports?: Map<string, ImportFileRef>;
|
|
27
23
|
}
|
|
28
|
-
export interface
|
|
24
|
+
export interface AdvancedCSpellSettingsWithSourceTrace extends CSpellSettingsWithSourceTrace, ExperimentalFileSettings {
|
|
25
|
+
}
|
|
26
|
+
export interface FileSettings extends ExtendableSettings, CommandLineSettings {
|
|
27
|
+
/**
|
|
28
|
+
* Url to JSON Schema
|
|
29
|
+
* @default "https://raw.githubusercontent.com/streetsidesoftware/cspell/main/cspell.schema.json"
|
|
30
|
+
*/
|
|
31
|
+
$schema?: string;
|
|
29
32
|
/**
|
|
30
33
|
* Configuration format version of the settings file.
|
|
31
34
|
*
|
|
@@ -802,7 +805,7 @@ interface BaseSource {
|
|
|
802
805
|
/**
|
|
803
806
|
* Reporter name or reporter name + reporter config.
|
|
804
807
|
*/
|
|
805
|
-
export declare type ReporterSettings = string | [string] | [string,
|
|
808
|
+
export declare type ReporterSettings = string | [string] | [string, Serializable];
|
|
806
809
|
/**
|
|
807
810
|
* Experimental Configuration / Options
|
|
808
811
|
*
|
|
@@ -816,7 +819,14 @@ export interface ExperimentalFileSettings {
|
|
|
816
819
|
* @experimental
|
|
817
820
|
* @version 6.2.0
|
|
818
821
|
*/
|
|
819
|
-
plugins?: Plugin[]
|
|
822
|
+
plugins?: Plugin[];
|
|
823
|
+
}
|
|
824
|
+
/**
|
|
825
|
+
* Extends CSpellSettings with ExperimentalFileSettings
|
|
826
|
+
* @experimental
|
|
827
|
+
* @hidden
|
|
828
|
+
*/
|
|
829
|
+
export interface AdvancedCSpellSettings extends CSpellSettings, ExperimentalFileSettings {
|
|
820
830
|
}
|
|
821
831
|
/**
|
|
822
832
|
* Experimental Configuration / Options
|
|
@@ -831,7 +841,7 @@ export interface ExperimentalBaseSettings {
|
|
|
831
841
|
* @experimental
|
|
832
842
|
* @version 6.2.0
|
|
833
843
|
*/
|
|
834
|
-
parser?: ParserName
|
|
844
|
+
parser?: ParserName;
|
|
835
845
|
}
|
|
836
846
|
/**
|
|
837
847
|
* Plugin API
|
|
@@ -839,7 +849,7 @@ export interface ExperimentalBaseSettings {
|
|
|
839
849
|
* @version 6.2.0
|
|
840
850
|
*/
|
|
841
851
|
export interface Plugin {
|
|
842
|
-
parsers?: Parser[]
|
|
852
|
+
parsers?: Parser[];
|
|
843
853
|
}
|
|
844
854
|
export {};
|
|
845
855
|
//# sourceMappingURL=CSpellSettingsDef.d.ts.map
|
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/configFields.js
CHANGED
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/dist/types.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export declare type Serialize<T> = T extends Function ? never : T extends null ? null : T extends any[] ? SerializeArray<T> : T extends object ? SerializeObj<T> : Primitives<T>;
|
|
2
|
+
declare type SerializeObj<T extends object> = {
|
|
3
|
+
[K in keyof T]: K extends string | number ? Serialize<T[K]> : never;
|
|
4
|
+
};
|
|
5
|
+
declare type SerializeArray<T extends Array<any>> = T extends [infer R] ? [Serialize<R>] : T extends [infer R0, infer R1] ? [Serialize<R0>, Serialize<R1>] : T extends [infer R0, infer R1, infer R2] ? [Serialize<R0>, Serialize<R1>, Serialize<R2>] : T extends Array<infer R> ? Serialize<R>[] : never;
|
|
6
|
+
declare type Primitives<T> = Extract<T, number | string | null | boolean>;
|
|
7
|
+
export declare type Serializable = number | string | boolean | null | object;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
package/dist/types.js
ADDED
package/package.json
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "6.
|
|
6
|
+
"version": "6.2.0",
|
|
7
7
|
"description": "Types for cspell and cspell-lib",
|
|
8
8
|
"type": "commonjs",
|
|
9
9
|
"main": "dist/index.js",
|
|
@@ -64,10 +64,10 @@
|
|
|
64
64
|
},
|
|
65
65
|
"devDependencies": {
|
|
66
66
|
"ajv-cli": "^5.0.0",
|
|
67
|
-
"jest": "^28.1.
|
|
67
|
+
"jest": "^28.1.2",
|
|
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": "ef9bf8e390692145b067843dbcc44a6dc2d9aa31"
|
|
73
73
|
}
|