@markuplint/types 3.12.0 → 4.0.0-alpha.10
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/LICENSE +1 -1
- package/lib/check-multi-types.d.ts +2 -5
- package/lib/check-multi-types.js +9 -14
- package/lib/check.d.ts +1 -1
- package/lib/check.js +20 -30
- package/lib/css-syntax.d.ts +1 -1
- package/lib/css-syntax.js +33 -33
- package/lib/debug.js +2 -6
- package/lib/defs.d.ts +2 -1
- package/lib/defs.js +188 -138
- package/lib/enum.d.ts +2 -2
- package/lib/enum.js +7 -12
- package/lib/get-candidate.d.ts +1 -4
- package/lib/get-candidate.js +5 -10
- package/lib/index.d.ts +3 -3
- package/lib/index.js +3 -6
- package/lib/keyword-type.d.ts +2 -2
- package/lib/keyword-type.js +20 -25
- package/lib/list.d.ts +2 -2
- package/lib/list.js +9 -14
- package/lib/match-result.d.ts +8 -21
- package/lib/match-result.js +6 -13
- package/lib/number.d.ts +3 -3
- package/lib/number.js +13 -17
- package/lib/primitive/index.d.ts +7 -7
- package/lib/primitive/index.js +7 -17
- package/lib/primitive/is-float.js +2 -6
- package/lib/primitive/is-int.js +2 -6
- package/lib/primitive/is-non-zero-uint.js +2 -6
- package/lib/primitive/is-quantity.d.ts +1 -5
- package/lib/primitive/is-quantity.js +9 -13
- package/lib/primitive/is-uint.d.ts +3 -6
- package/lib/primitive/is-uint.js +4 -8
- package/lib/primitive/range.js +3 -7
- package/lib/primitive/split-unit.d.ts +2 -2
- package/lib/primitive/split-unit.js +4 -8
- package/lib/rfc/is-bcp-47.d.ts +1 -1
- package/lib/rfc/is-bcp-47.js +3 -7
- package/lib/token/index.d.ts +2 -2
- package/lib/token/index.js +2 -7
- package/lib/token/token-collection.d.ts +58 -70
- package/lib/token/token-collection.js +47 -56
- package/lib/token/token.d.ts +54 -59
- package/lib/token/token.js +14 -20
- package/lib/token/types.js +1 -2
- package/lib/types.d.ts +58 -82
- package/lib/types.js +1 -2
- package/lib/types.schema.d.ts +31 -1087
- package/lib/types.schema.js +1 -2
- package/lib/w3c/check-serialized-permissions-policy.d.ts +1 -1
- package/lib/w3c/check-serialized-permissions-policy.js +21 -25
- package/lib/whatwg/check-autocomplete.d.ts +1 -1
- package/lib/whatwg/check-autocomplete.js +34 -41
- package/lib/whatwg/check-datetime/date-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/date-string.js +12 -16
- package/lib/whatwg/check-datetime/datetime-tokens.d.ts +2 -22
- package/lib/whatwg/check-datetime/datetime-tokens.js +58 -64
- package/lib/whatwg/check-datetime/duration-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/duration-string.js +64 -69
- package/lib/whatwg/check-datetime/global-date-and-time-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/global-date-and-time-string.js +24 -28
- package/lib/whatwg/check-datetime/index.d.ts +1 -1
- package/lib/whatwg/check-datetime/index.js +25 -29
- package/lib/whatwg/check-datetime/local-date-and-time-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/local-date-and-time-string.js +37 -41
- package/lib/whatwg/check-datetime/month-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/month-string.js +9 -13
- package/lib/whatwg/check-datetime/time-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/time-string.js +13 -17
- package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +3 -3
- package/lib/whatwg/check-datetime/time-zone-offset-string.js +22 -28
- package/lib/whatwg/check-datetime/week-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/week-string.js +11 -15
- package/lib/whatwg/check-datetime/year-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/year-string.js +9 -13
- package/lib/whatwg/check-datetime/yearless-date-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/yearless-date-string.js +11 -15
- package/lib/whatwg/check-mime-type.d.ts +5 -5
- package/lib/whatwg/check-mime-type.js +11 -17
- package/lib/whatwg/is-abs-url.d.ts +1 -1
- package/lib/whatwg/is-abs-url.js +8 -12
- package/lib/whatwg/is-browser-context-name.d.ts +1 -1
- package/lib/whatwg/is-browser-context-name.js +1 -5
- package/lib/whatwg/is-custom-element-name.d.ts +10 -5
- package/lib/whatwg/is-custom-element-name.js +22 -38
- package/lib/whatwg/is-itemprop-name.d.ts +1 -1
- package/lib/whatwg/is-itemprop-name.js +1 -5
- package/lib/whatwg/is-navigable-target-name.d.ts +1 -1
- package/lib/whatwg/is-navigable-target-name.js +1 -5
- package/package.json +17 -9
- package/test/check.spec.js +0 -89
- package/test/css-syntax.spec.js +0 -170
- package/test/list.spec.js +0 -133
- package/test/primitive/index.spec.js +0 -65
- package/test/rfc/is-bcp-47.spec.js +0 -23
- package/test/token/token-collection.spec.js +0 -146
- package/test/w3c/check-serialized-permissions-policy.spec.js +0 -36
- package/test/whatwg/check-autocomplete.spec.js +0 -387
- package/test/whatwg/check-datetime/index.spec.js +0 -336
- package/test/whatwg/check-mime-type.spec.js +0 -59
- package/test/whatwg/is-abs-url.spec.js +0 -8
package/lib/types.d.ts
CHANGED
|
@@ -1,103 +1,79 @@
|
|
|
1
|
-
import type { cssSyntaxMatch } from './css-syntax';
|
|
2
|
-
export type { Type, List, Enum, CssSyntax, KeywordDefinedType, Number } from './types.schema';
|
|
1
|
+
import type { cssSyntaxMatch } from './css-syntax.js';
|
|
2
|
+
export type { Type, List, Enum, CssSyntax, KeywordDefinedType, Number } from './types.schema.js';
|
|
3
3
|
export type Result = UnmatchedResult | MatchedResult;
|
|
4
4
|
export type UnmatchedResult = {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
5
|
+
readonly matched: false;
|
|
6
|
+
readonly ref: string | null;
|
|
7
|
+
readonly raw: string;
|
|
8
|
+
readonly length: number;
|
|
9
|
+
readonly offset: number;
|
|
10
|
+
readonly line: number;
|
|
11
|
+
readonly column: number;
|
|
12
|
+
readonly reason: UnmatchedResultReason;
|
|
13
|
+
readonly passCount?: number;
|
|
14
14
|
} & UnmatchedResultOptions;
|
|
15
15
|
export type UnmatchedResultOptions = {
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
16
|
+
readonly partName?: string;
|
|
17
|
+
readonly expects?: readonly Expect[];
|
|
18
|
+
readonly extra?: Expect;
|
|
19
|
+
readonly candidate?: string;
|
|
20
|
+
readonly fallbackTo?: string;
|
|
21
|
+
};
|
|
22
|
+
export type UnmatchedResultReason = 'syntax-error' | 'typo' | 'missing-token' | 'missing-comma' | 'unexpected-token' | 'unexpected-space' | 'unexpected-newline' | 'unexpected-comma' | 'empty-token' | 'out-of-range' | 'doesnt-exist-in-enum' | 'duplicated' | 'illegal-combination' | 'illegal-order' | 'extra-token' | 'must-be-percent-encoded' | 'must-be-serialized' | {
|
|
23
|
+
readonly type: 'out-of-range';
|
|
24
|
+
readonly gt?: number;
|
|
25
|
+
readonly gte?: number;
|
|
26
|
+
readonly lt?: number;
|
|
27
|
+
readonly lte?: number;
|
|
28
|
+
} | {
|
|
29
|
+
readonly type: 'out-of-range-length-char';
|
|
30
|
+
readonly gte: number;
|
|
31
|
+
readonly lte?: number;
|
|
32
|
+
} | {
|
|
33
|
+
readonly type: 'out-of-range-length-digit';
|
|
34
|
+
readonly gte: number;
|
|
35
|
+
readonly lte?: number;
|
|
21
36
|
};
|
|
22
|
-
export type UnmatchedResultReason =
|
|
23
|
-
| 'syntax-error'
|
|
24
|
-
| 'typo'
|
|
25
|
-
| 'missing-token'
|
|
26
|
-
| 'missing-comma'
|
|
27
|
-
| 'unexpected-token'
|
|
28
|
-
| 'unexpected-space'
|
|
29
|
-
| 'unexpected-newline'
|
|
30
|
-
| 'unexpected-comma'
|
|
31
|
-
| 'empty-token'
|
|
32
|
-
| 'out-of-range'
|
|
33
|
-
| 'doesnt-exist-in-enum'
|
|
34
|
-
| 'duplicated'
|
|
35
|
-
| 'illegal-combination'
|
|
36
|
-
| 'illegal-order'
|
|
37
|
-
| 'extra-token'
|
|
38
|
-
| 'must-be-percent-encoded'
|
|
39
|
-
| 'must-be-serialized'
|
|
40
|
-
| {
|
|
41
|
-
readonly type: 'out-of-range';
|
|
42
|
-
readonly gt?: number;
|
|
43
|
-
readonly gte?: number;
|
|
44
|
-
readonly lt?: number;
|
|
45
|
-
readonly lte?: number;
|
|
46
|
-
}
|
|
47
|
-
| {
|
|
48
|
-
readonly type: 'out-of-range-length-char';
|
|
49
|
-
readonly gte: number;
|
|
50
|
-
readonly lte?: number;
|
|
51
|
-
}
|
|
52
|
-
| {
|
|
53
|
-
readonly type: 'out-of-range-length-digit';
|
|
54
|
-
readonly gte: number;
|
|
55
|
-
readonly lte?: number;
|
|
56
|
-
};
|
|
57
37
|
export type MatchedResult = {
|
|
58
|
-
|
|
38
|
+
readonly matched: true;
|
|
59
39
|
};
|
|
60
40
|
export type Expect = {
|
|
61
|
-
|
|
62
|
-
|
|
41
|
+
readonly type: 'const' | 'format' | 'syntax' | 'regexp' | 'common';
|
|
42
|
+
readonly value: string;
|
|
63
43
|
};
|
|
64
44
|
export type FormattedPrimitiveTypeCheck = (value: string) => boolean;
|
|
65
45
|
export type FormattedPrimitiveTypeCreator<O = never> = (options?: O) => FormattedPrimitiveTypeCheck;
|
|
66
46
|
export type Defs = Record<string, CustomCssSyntax | CustomSyntax>;
|
|
67
47
|
export type CustomSyntax = {
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
48
|
+
readonly ref: string;
|
|
49
|
+
readonly expects?: readonly Expect[];
|
|
50
|
+
readonly is: CustomSyntaxCheck;
|
|
71
51
|
};
|
|
72
52
|
export type CustomSyntaxCheck = (value: string) => Result;
|
|
73
53
|
export type CustomSyntaxChecker<O = {}> = (options?: O) => CustomSyntaxCheck;
|
|
74
54
|
export type CustomCssSyntax = {
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
55
|
+
readonly ref: string;
|
|
56
|
+
readonly caseSensitive?: boolean;
|
|
57
|
+
readonly expects?: readonly Expect[];
|
|
58
|
+
readonly syntax: {
|
|
59
|
+
readonly apply: `<${string}>`;
|
|
60
|
+
readonly def: Readonly<Record<string, string | CssSyntaxTokenizer>>;
|
|
61
|
+
/**
|
|
62
|
+
* @deprecated
|
|
63
|
+
*/
|
|
64
|
+
readonly ebnf?: Readonly<Record<string, string | readonly string[]>>;
|
|
65
|
+
/**
|
|
66
|
+
* @deprecated
|
|
67
|
+
*/
|
|
68
|
+
readonly properties?: Readonly<Record<string, string>>;
|
|
69
|
+
};
|
|
90
70
|
};
|
|
91
71
|
export type CSSSyntaxToken = {
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
72
|
+
readonly type: number;
|
|
73
|
+
readonly value: string;
|
|
74
|
+
readonly index: number;
|
|
75
|
+
readonly balance: number;
|
|
76
|
+
readonly node?: any;
|
|
97
77
|
};
|
|
98
|
-
export type CssSyntaxTokenizer = (
|
|
99
|
-
token: Readonly<CSSSyntaxToken> | null,
|
|
100
|
-
getNextToken: GetNextToken,
|
|
101
|
-
match: typeof cssSyntaxMatch,
|
|
102
|
-
) => number;
|
|
78
|
+
export type CssSyntaxTokenizer = (token: Readonly<CSSSyntaxToken> | null, getNextToken: GetNextToken, match: typeof cssSyntaxMatch) => number;
|
|
103
79
|
export type GetNextToken = (length: number) => CSSSyntaxToken | null;
|
package/lib/types.js
CHANGED
|
@@ -1,2 +1 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
1
|
+
export {};
|