@cspell/cspell-types 6.19.2 → 6.20.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/{ajv.config.js → ajv.config.cjs} +0 -0
- package/dist/{CSpellReporter.d.ts → cjs/CSpellReporter.d.ts} +1 -1
- package/dist/{CSpellSettingsDef.d.ts → cjs/CSpellSettingsDef.d.ts} +4 -4
- package/dist/{DictionaryDefinition.d.ts → cjs/DictionaryDefinition.d.ts} +1 -1
- package/dist/{DictionaryInformation.d.ts → cjs/DictionaryInformation.d.ts} +1 -1
- package/dist/cjs/Parser/CSpellReporter.d.ts +103 -0
- package/dist/cjs/Parser/CSpellSettingsDef.d.ts +689 -0
- package/dist/cjs/Parser/DictionaryDefinition.d.ts +184 -0
- package/dist/cjs/Parser/DictionaryInformation.d.ts +210 -0
- package/dist/{Parser.d.ts → cjs/Parser/Parser/index.d.ts} +1 -1
- package/dist/{TextMap.d.ts → cjs/Parser/TextMap.d.ts} +0 -0
- package/dist/{TextOffset.d.ts → cjs/Parser/TextOffset.d.ts} +0 -0
- package/dist/{configFields.d.ts → cjs/Parser/configFields.d.ts} +1 -1
- package/dist/{features.d.ts → cjs/Parser/features.d.ts} +0 -0
- package/dist/cjs/Parser/index.cjs +3 -0
- package/dist/{index.d.ts → cjs/Parser/index.d.ts} +12 -12
- package/dist/{suggestionCostsDef.d.ts → cjs/Parser/suggestionCostsDef.d.ts} +0 -0
- package/dist/{types.d.ts → cjs/Parser/types.d.ts} +0 -0
- package/dist/cjs/TextMap.d.ts +36 -0
- package/dist/cjs/TextOffset.d.ts +23 -0
- package/dist/cjs/configFields.d.ts +7 -0
- package/dist/cjs/features.d.ts +38 -0
- package/dist/cjs/index.cjs +68 -0
- package/dist/cjs/index.d.ts +13 -0
- package/dist/cjs/suggestionCostsDef.d.ts +88 -0
- package/dist/cjs/types.d.ts +9 -0
- package/dist/esm/CSpellReporter.d.ts +103 -0
- package/dist/esm/CSpellReporter.js +11 -0
- package/dist/esm/CSpellSettingsDef.d.ts +689 -0
- package/dist/esm/CSpellSettingsDef.js +2 -0
- package/dist/esm/DictionaryDefinition.d.ts +184 -0
- package/dist/esm/DictionaryDefinition.js +2 -0
- package/dist/esm/DictionaryInformation.d.ts +210 -0
- package/dist/esm/DictionaryInformation.js +2 -0
- package/dist/esm/Parser/index.d.ts +126 -0
- package/dist/esm/Parser/index.js +2 -0
- package/dist/esm/TextMap.d.ts +36 -0
- package/dist/esm/TextMap.js +2 -0
- package/dist/esm/TextOffset.d.ts +23 -0
- package/dist/esm/TextOffset.js +2 -0
- package/dist/esm/configFields.d.ts +7 -0
- package/dist/{configFields.js → esm/configFields.js} +1 -4
- package/dist/esm/features.d.ts +38 -0
- package/dist/esm/features.js +3 -0
- package/dist/esm/index.d.ts +13 -0
- package/dist/esm/index.js +3 -0
- package/dist/esm/suggestionCostsDef.d.ts +88 -0
- package/dist/esm/suggestionCostsDef.js +2 -0
- package/dist/esm/types.d.ts +9 -0
- package/dist/esm/types.js +4 -0
- package/package.json +53 -27
- package/dist/CSpellReporter.js +0 -14
- package/dist/CSpellSettingsDef.js +0 -3
- package/dist/DictionaryDefinition.js +0 -3
- package/dist/DictionaryInformation.js +0 -3
- package/dist/Parser.js +0 -3
- package/dist/TextMap.js +0 -3
- package/dist/TextOffset.js +0 -3
- package/dist/features.js +0 -4
- package/dist/index.js +0 -9
- package/dist/suggestionCostsDef.js +0 -3
- package/dist/types.js +0 -5
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A WeightedMapDef enables setting weights for edits between related characters and substrings.
|
|
3
|
+
*
|
|
4
|
+
* Multiple groups can be defined using a `|`.
|
|
5
|
+
* A multi-character substring is defined using `()`.
|
|
6
|
+
*
|
|
7
|
+
* For example, in some languages, some letters sound alike.
|
|
8
|
+
*
|
|
9
|
+
* ```yaml
|
|
10
|
+
* map: 'sc(sh)(sch)(ss)|t(tt)' # two groups.
|
|
11
|
+
* replace: 50 # Make it 1/2 the cost of a normal edit to replace a `t` with `tt`.
|
|
12
|
+
* ```
|
|
13
|
+
*
|
|
14
|
+
* The following could be used to make inserting, removing, or replacing vowels cheaper.
|
|
15
|
+
* ```yaml
|
|
16
|
+
* map: 'aeiouy'
|
|
17
|
+
* insDel: 50 # Make it is cheaper to insert or delete a vowel.
|
|
18
|
+
* replace: 45 # It is even cheaper to replace one with another.
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* Note: the default edit distance is 100.
|
|
22
|
+
*/
|
|
23
|
+
export type SuggestionCostMapDef = CostMapDefReplace | CostMapDefInsDel | CostMapDefSwap;
|
|
24
|
+
export type SuggestionCostsDefs = SuggestionCostMapDef[];
|
|
25
|
+
interface CostMapDefBase {
|
|
26
|
+
/**
|
|
27
|
+
* The set of substrings to map, these are generally single character strings.
|
|
28
|
+
*
|
|
29
|
+
* Multiple sets can be defined by using a `|` to separate them.
|
|
30
|
+
*
|
|
31
|
+
* Example: `"eéê|aåá"` contains two different sets.
|
|
32
|
+
*
|
|
33
|
+
* To add a multi-character substring use `()`.
|
|
34
|
+
*
|
|
35
|
+
* Example: `"f(ph)(gh)"` results in the following set: `f`, `ph`, `gh`.
|
|
36
|
+
*
|
|
37
|
+
* - To match the beginning of a word, use `^`: `"(^I)""`.
|
|
38
|
+
* - To match the end of a word, use `$`: `"(e$)(ing$)"`.
|
|
39
|
+
*
|
|
40
|
+
*/
|
|
41
|
+
map: string;
|
|
42
|
+
/** The cost to insert/delete one of the substrings in the map. Note: insert/delete costs are symmetrical. */
|
|
43
|
+
insDel?: number;
|
|
44
|
+
/**
|
|
45
|
+
* The cost to replace of of the substrings in the map with another substring in the map.
|
|
46
|
+
* Example: Map['a', 'i']
|
|
47
|
+
* This would be the cost to substitute `a` with `i`: Like `bat` to `bit` or the reverse.
|
|
48
|
+
*/
|
|
49
|
+
replace?: number;
|
|
50
|
+
/**
|
|
51
|
+
* The cost to swap two adjacent substrings found in the map.
|
|
52
|
+
* Example: Map['e', 'i']
|
|
53
|
+
* This represents the cost to change `ei` to `ie` or the reverse.
|
|
54
|
+
*/
|
|
55
|
+
swap?: number;
|
|
56
|
+
/**
|
|
57
|
+
* A description to describe the purpose of the map.
|
|
58
|
+
*/
|
|
59
|
+
description?: string;
|
|
60
|
+
/**
|
|
61
|
+
* Add a penalty to the final cost.
|
|
62
|
+
* This is used to discourage certain suggestions.
|
|
63
|
+
*
|
|
64
|
+
* Example:
|
|
65
|
+
* ```yaml
|
|
66
|
+
* # Match adding/removing `-` to the end of a word.
|
|
67
|
+
* map: "$(-$)"
|
|
68
|
+
* replace: 50
|
|
69
|
+
* penalty: 100
|
|
70
|
+
* ```
|
|
71
|
+
*
|
|
72
|
+
* This makes adding a `-` to the end of a word more expensive.
|
|
73
|
+
*
|
|
74
|
+
* Think of it as taking the toll way for speed but getting the bill later.
|
|
75
|
+
*/
|
|
76
|
+
penalty?: number;
|
|
77
|
+
}
|
|
78
|
+
export interface CostMapDefReplace extends CostMapDefBase {
|
|
79
|
+
replace: number;
|
|
80
|
+
}
|
|
81
|
+
export interface CostMapDefInsDel extends CostMapDefBase {
|
|
82
|
+
insDel: number;
|
|
83
|
+
}
|
|
84
|
+
export interface CostMapDefSwap extends CostMapDefBase {
|
|
85
|
+
swap: number;
|
|
86
|
+
}
|
|
87
|
+
export {};
|
|
88
|
+
//# sourceMappingURL=suggestionCostsDef.d.ts.map
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type Serialize<T> = T extends Function ? never : T extends null ? null : T extends any[] ? SerializeArray<T> : T extends object ? SerializeObj<T> : Primitives<T>;
|
|
2
|
+
type SerializeObj<T extends object> = {
|
|
3
|
+
[K in keyof T]: K extends string | number ? Serialize<T[K]> : never;
|
|
4
|
+
};
|
|
5
|
+
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
|
+
type Primitives<T> = Extract<T, number | string | null | boolean>;
|
|
7
|
+
export type Serializable = number | string | boolean | null | object;
|
|
8
|
+
export {};
|
|
9
|
+
//# sourceMappingURL=types.d.ts.map
|
package/package.json
CHANGED
|
@@ -3,41 +3,66 @@
|
|
|
3
3
|
"publishConfig": {
|
|
4
4
|
"access": "public"
|
|
5
5
|
},
|
|
6
|
-
"version": "6.
|
|
6
|
+
"version": "6.20.1",
|
|
7
7
|
"description": "Types for cspell and cspell-lib",
|
|
8
|
-
"type": "
|
|
9
|
-
"main": "dist/index.
|
|
10
|
-
"
|
|
8
|
+
"type": "module",
|
|
9
|
+
"main": "./dist/cjs/index.cjs",
|
|
10
|
+
"module": "./dist/esm/index.js",
|
|
11
|
+
"exports": {
|
|
12
|
+
".": {
|
|
13
|
+
"import": "./dist/esm/index.js",
|
|
14
|
+
"types": "./dist/esm/index.d.ts",
|
|
15
|
+
"require": "./dist/cjs/index.cjs"
|
|
16
|
+
},
|
|
17
|
+
"./Parser": {
|
|
18
|
+
"import": "./dist/esm/Parser/index.js",
|
|
19
|
+
"types": "./dist/esm/Parser/index.d.ts",
|
|
20
|
+
"require": "./dist/cjs/Parser/index.cjs"
|
|
21
|
+
},
|
|
22
|
+
"./cspell.schema.json": {
|
|
23
|
+
"import": "./cspell.schema.json",
|
|
24
|
+
"require": "./cspell.schema.json"
|
|
25
|
+
},
|
|
26
|
+
"./ajv.config": {
|
|
27
|
+
"import": "./ajv.config.cjs",
|
|
28
|
+
"require": "./ajv.config.cjs"
|
|
29
|
+
},
|
|
30
|
+
"./ajv.config.js": {
|
|
31
|
+
"require": "./ajv.config.cjs"
|
|
32
|
+
}
|
|
33
|
+
},
|
|
34
|
+
"types": "index.d.ts",
|
|
11
35
|
"typesVersions": {
|
|
12
36
|
"*": {
|
|
13
|
-
"
|
|
14
|
-
"dist
|
|
37
|
+
"index.d.ts": [
|
|
38
|
+
"dist/esm/index.d.ts"
|
|
15
39
|
],
|
|
16
|
-
"dist/index.d.ts": [
|
|
17
|
-
"dist/index.d.ts"
|
|
40
|
+
"dist/esm/index.d.ts": [
|
|
41
|
+
"dist/esm/index.d.ts"
|
|
18
42
|
],
|
|
19
|
-
"
|
|
20
|
-
"dist/index.d.ts"
|
|
43
|
+
"Parser": [
|
|
44
|
+
"dist/esm/Parser/index.d.ts"
|
|
45
|
+
],
|
|
46
|
+
"*": [
|
|
47
|
+
"dist/esm/*.d.ts",
|
|
48
|
+
"dist/esm/*/index.d.ts"
|
|
21
49
|
]
|
|
22
50
|
}
|
|
23
51
|
},
|
|
24
|
-
"exports": {
|
|
25
|
-
".": "./dist/index.js",
|
|
26
|
-
"./Parser": "./dist/Parser.js",
|
|
27
|
-
"./Parser.js": "./dist/Parser.js",
|
|
28
|
-
"./cspell.schema.json": "./cspell.schema.json",
|
|
29
|
-
"./ajv.config": "./ajv.config.js",
|
|
30
|
-
"./ajv.config.js": "./ajv.config.js"
|
|
31
|
-
},
|
|
32
52
|
"scripts": {
|
|
33
53
|
"clean": "shx rm -rf dist coverage .tsbuildinfo",
|
|
34
|
-
"build": "pnpm
|
|
35
|
-
"build
|
|
54
|
+
"build": "pnpm build:cjs && pnpm build:esm && pnpm run build-schema",
|
|
55
|
+
"build:cjs": "rollup -c rollup.config.mjs",
|
|
56
|
+
"build:esm": "tsc -p tsconfig.esm.json",
|
|
57
|
+
"build:dev": "tsc -p tsconfig.dev.json",
|
|
36
58
|
"build-schema": "ts-json-schema-generator --no-top-ref --path src/CSpellSettingsDef.ts --type CSpellSettings --validation-keywords markdownDescription --validation-keywords scope --validation-keywords deprecated --validation-keywords deprecationMessage -o ./cspell.schema.json && shx cp ./cspell.schema.json ../..",
|
|
37
59
|
"clean-build": "pnpm run clean && pnpm run build",
|
|
38
|
-
"
|
|
39
|
-
"
|
|
40
|
-
"
|
|
60
|
+
"coverage": "pnpm coverage:vitest && pnpm coverage:fix",
|
|
61
|
+
"coverage:vitest": "vitest run --coverage",
|
|
62
|
+
"coverage:fix": "nyc report --temp-dir \"$(pwd)/coverage\" --reporter lcov --report-dir \"$(pwd)/coverage\" --cwd ../..",
|
|
63
|
+
"test": "pnpm test:unit && pnpm test:schema",
|
|
64
|
+
"test:unit": "vitest run",
|
|
65
|
+
"test:schema": "ajv -s ./cspell.schema.json -d \"cspell.test.{json,yaml}\" -c ./ajv.config.cjs",
|
|
41
66
|
"prepare": "echo Skip Building Types"
|
|
42
67
|
},
|
|
43
68
|
"repository": {
|
|
@@ -46,7 +71,7 @@
|
|
|
46
71
|
},
|
|
47
72
|
"files": [
|
|
48
73
|
"dist",
|
|
49
|
-
"ajv.config.
|
|
74
|
+
"ajv.config.cjs",
|
|
50
75
|
"cspell.schema.json",
|
|
51
76
|
"!**/__mocks__",
|
|
52
77
|
"!**/*.test.*",
|
|
@@ -64,9 +89,10 @@
|
|
|
64
89
|
},
|
|
65
90
|
"devDependencies": {
|
|
66
91
|
"ajv-cli": "^5.0.0",
|
|
67
|
-
"jest": "^29.
|
|
92
|
+
"jest": "^29.4.1",
|
|
68
93
|
"ts-json-schema-generator": "^1.2.0",
|
|
69
|
-
"typescript": "^4.9.
|
|
94
|
+
"typescript": "^4.9.5",
|
|
95
|
+
"vitest": "^0.28.3"
|
|
70
96
|
},
|
|
71
|
-
"gitHead": "
|
|
97
|
+
"gitHead": "508a06d32dd59d881d07cb60fe8c0a7c0bddf8eb"
|
|
72
98
|
}
|
package/dist/CSpellReporter.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageTypes = exports.IssueType = void 0;
|
|
4
|
-
var IssueType;
|
|
5
|
-
(function (IssueType) {
|
|
6
|
-
IssueType[IssueType["spelling"] = 0] = "spelling";
|
|
7
|
-
IssueType[IssueType["directive"] = 1] = "directive";
|
|
8
|
-
})(IssueType = exports.IssueType || (exports.IssueType = {}));
|
|
9
|
-
exports.MessageTypes = {
|
|
10
|
-
Debug: 'Debug',
|
|
11
|
-
Info: 'Info',
|
|
12
|
-
Warning: 'Warning',
|
|
13
|
-
};
|
|
14
|
-
//# sourceMappingURL=CSpellReporter.js.map
|
package/dist/Parser.js
DELETED
package/dist/TextMap.js
DELETED
package/dist/TextOffset.js
DELETED
package/dist/features.js
DELETED
package/dist/index.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.MessageTypes = exports.IssueType = exports.ConfigFields = void 0;
|
|
4
|
-
var configFields_1 = require("./configFields");
|
|
5
|
-
Object.defineProperty(exports, "ConfigFields", { enumerable: true, get: function () { return configFields_1.ConfigFields; } });
|
|
6
|
-
var CSpellReporter_1 = require("./CSpellReporter");
|
|
7
|
-
Object.defineProperty(exports, "IssueType", { enumerable: true, get: function () { return CSpellReporter_1.IssueType; } });
|
|
8
|
-
Object.defineProperty(exports, "MessageTypes", { enumerable: true, get: function () { return CSpellReporter_1.MessageTypes; } });
|
|
9
|
-
//# sourceMappingURL=index.js.map
|