@markuplint/types 3.0.0-alpha.6 → 3.0.0-dev.176

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.
Files changed (107) hide show
  1. package/README.md +12 -8
  2. package/lib/check-multi-types.d.ts +1 -1
  3. package/lib/check-multi-types.js +5 -4
  4. package/lib/check.d.ts +6 -5
  5. package/lib/check.spec.js +64 -58
  6. package/lib/css-syntax.js +49 -47
  7. package/lib/css-syntax.spec.js +152 -149
  8. package/lib/defs.js +2 -2
  9. package/lib/enum.d.ts +2 -1
  10. package/lib/enum.js +1 -1
  11. package/lib/get-candidate.d.ts +1 -1
  12. package/lib/keyword-type.js +3 -2
  13. package/lib/list.d.ts +2 -1
  14. package/lib/list.js +2 -1
  15. package/lib/list.spec.js +118 -117
  16. package/lib/match-result.d.ts +3 -3
  17. package/lib/match-result.js +2 -1
  18. package/lib/number.d.ts +1 -1
  19. package/lib/primitive/index.spec.js +53 -52
  20. package/lib/primitive/is-quantity.d.ts +5 -1
  21. package/lib/primitive/is-uint.d.ts +1 -1
  22. package/lib/primitive/split-unit.js +2 -2
  23. package/lib/rfc/is-bcp-47.spec.js +9 -8
  24. package/lib/token/token-collection.d.ts +20 -14
  25. package/lib/token/token-collection.js +30 -23
  26. package/lib/token/token-collection.spec.js +156 -134
  27. package/lib/token/token.d.ts +10 -9
  28. package/lib/token/token.js +19 -20
  29. package/lib/token/types.d.ts +3 -0
  30. package/lib/token/types.js +2 -0
  31. package/lib/types.d.ts +44 -44
  32. package/lib/types.schema.d.ts +369 -318
  33. package/lib/w3c/check-serialized-permissions-policy.spec.js +30 -28
  34. package/lib/whatwg/check-autocomplete.js +6 -6
  35. package/lib/whatwg/check-autocomplete.spec.js +361 -360
  36. package/lib/whatwg/check-datetime/datetime-tokens.js +9 -6
  37. package/lib/whatwg/check-datetime/duration-string.js +12 -2
  38. package/lib/whatwg/check-datetime/index.spec.js +277 -276
  39. package/lib/whatwg/check-datetime/local-date-and-time-string.js +6 -2
  40. package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +1 -1
  41. package/lib/whatwg/check-datetime/time-zone-offset-string.js +3 -2
  42. package/lib/whatwg/check-mime-type.js +1 -1
  43. package/lib/whatwg/check-mime-type.spec.js +53 -52
  44. package/lib/whatwg/is-abs-url.spec.js +6 -5
  45. package/lib/whatwg/is-itemprop-name.js +1 -1
  46. package/package.json +13 -11
  47. package/{src/check.spec.ts → test/check.spec.js} +7 -1
  48. package/{src/css-syntax.spec.ts → test/css-syntax.spec.js} +10 -12
  49. package/{src/list.spec.ts → test/list.spec.js} +7 -7
  50. package/{src/primitive/index.spec.ts → test/primitive/index.spec.js} +1 -1
  51. package/{src/rfc/is-bcp-47.spec.ts → test/rfc/is-bcp-47.spec.js} +1 -1
  52. package/{src/token/token-collection.spec.ts → test/token/token-collection.spec.js} +2 -3
  53. package/{src/w3c/check-serialized-permissions-policy.spec.ts → test/w3c/check-serialized-permissions-policy.spec.js} +1 -3
  54. package/{src/whatwg/check-autocomplete.spec.ts → test/whatwg/check-autocomplete.spec.js} +1 -1
  55. package/{src/whatwg/check-datetime/index.spec.ts → test/whatwg/check-datetime/index.spec.js} +18 -15
  56. package/{src/whatwg/check-mime-type.spec.ts → test/whatwg/check-mime-type.spec.js} +1 -1
  57. package/{src/whatwg/is-abs-url.spec.ts → test/whatwg/is-abs-url.spec.js} +1 -1
  58. package/types.schema.json +369 -318
  59. package/gen/specific-schema.json +0 -98
  60. package/gen/types.ts +0 -66
  61. package/src/check-multi-types.ts +0 -35
  62. package/src/check.ts +0 -48
  63. package/src/css-syntax.ts +0 -188
  64. package/src/debug.ts +0 -3
  65. package/src/defs.ts +0 -811
  66. package/src/enum.ts +0 -25
  67. package/src/get-candidate.ts +0 -24
  68. package/src/index.ts +0 -3
  69. package/src/keyword-type.ts +0 -64
  70. package/src/list.ts +0 -34
  71. package/src/match-result.ts +0 -49
  72. package/src/number.ts +0 -46
  73. package/src/primitive/index.ts +0 -7
  74. package/src/primitive/is-float.ts +0 -8
  75. package/src/primitive/is-int.ts +0 -8
  76. package/src/primitive/is-non-zero-uint.ts +0 -8
  77. package/src/primitive/is-quantity.ts +0 -38
  78. package/src/primitive/is-uint.ts +0 -15
  79. package/src/primitive/range.ts +0 -14
  80. package/src/primitive/split-unit.ts +0 -20
  81. package/src/rfc/is-bcp-47.ts +0 -13
  82. package/src/token/index.ts +0 -2
  83. package/src/token/token-collection.ts +0 -444
  84. package/src/token/token.ts +0 -144
  85. package/src/types.schema.ts +0 -1062
  86. package/src/types.ts +0 -118
  87. package/src/w3c/check-serialized-permissions-policy.ts +0 -303
  88. package/src/whatwg/check-autocomplete.ts +0 -380
  89. package/src/whatwg/check-datetime/date-string.ts +0 -44
  90. package/src/whatwg/check-datetime/datetime-tokens.ts +0 -600
  91. package/src/whatwg/check-datetime/duration-string.ts +0 -399
  92. package/src/whatwg/check-datetime/global-date-and-time-string.ts +0 -96
  93. package/src/whatwg/check-datetime/index.ts +0 -36
  94. package/src/whatwg/check-datetime/local-date-and-time-string.ts +0 -163
  95. package/src/whatwg/check-datetime/month-string.ts +0 -31
  96. package/src/whatwg/check-datetime/time-string.ts +0 -49
  97. package/src/whatwg/check-datetime/time-zone-offset-string.ts +0 -93
  98. package/src/whatwg/check-datetime/week-string.ts +0 -41
  99. package/src/whatwg/check-datetime/year-string.ts +0 -26
  100. package/src/whatwg/check-datetime/yearless-date-string.ts +0 -38
  101. package/src/whatwg/check-mime-type.ts +0 -46
  102. package/src/whatwg/is-abs-url.ts +0 -31
  103. package/src/whatwg/is-browser-context-name.ts +0 -16
  104. package/src/whatwg/is-custom-element-name.ts +0 -76
  105. package/src/whatwg/is-itemprop-name.ts +0 -17
  106. package/tsconfig.test.json +0 -3
  107. package/tsconfig.tsbuildinfo +0 -1
package/lib/types.d.ts CHANGED
@@ -2,21 +2,21 @@ import type { cssSyntaxMatch } from './css-syntax';
2
2
  export type { Type, List, Enum, CssSyntax, KeywordDefinedType, Number } from './types.schema';
3
3
  export type Result = UnmatchedResult | MatchedResult;
4
4
  export type UnmatchedResult = {
5
- matched: false;
6
- ref: string | null;
7
- raw: string;
8
- length: number;
9
- offset: number;
10
- line: number;
11
- column: number;
12
- reason: UnmatchedResultReason;
13
- passCount?: number;
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
- partName?: string;
17
- expects?: Expect[];
18
- extra?: Expect;
19
- candidate?: string;
16
+ readonly partName?: string;
17
+ readonly expects?: readonly Expect[];
18
+ readonly extra?: Expect;
19
+ readonly candidate?: string;
20
20
  };
21
21
  export type UnmatchedResultReason =
22
22
  | 'syntax-error'
@@ -37,65 +37,65 @@ export type UnmatchedResultReason =
37
37
  | 'must-be-percent-encoded'
38
38
  | 'must-be-serialized'
39
39
  | {
40
- type: 'out-of-range';
41
- gt?: number;
42
- gte?: number;
43
- lt?: number;
44
- lte?: number;
40
+ readonly type: 'out-of-range';
41
+ readonly gt?: number;
42
+ readonly gte?: number;
43
+ readonly lt?: number;
44
+ readonly lte?: number;
45
45
  }
46
46
  | {
47
- type: 'out-of-range-length-char';
48
- gte: number;
49
- lte?: number;
47
+ readonly type: 'out-of-range-length-char';
48
+ readonly gte: number;
49
+ readonly lte?: number;
50
50
  }
51
51
  | {
52
- type: 'out-of-range-length-digit';
53
- gte: number;
54
- lte?: number;
52
+ readonly type: 'out-of-range-length-digit';
53
+ readonly gte: number;
54
+ readonly lte?: number;
55
55
  };
56
56
  export type MatchedResult = {
57
- matched: true;
57
+ readonly matched: true;
58
58
  };
59
59
  export type Expect = {
60
- type: 'const' | 'format' | 'syntax' | 'regexp' | 'common';
61
- value: string;
60
+ readonly type: 'const' | 'format' | 'syntax' | 'regexp' | 'common';
61
+ readonly value: string;
62
62
  };
63
63
  export type FormattedPrimitiveTypeCheck = (value: string) => boolean;
64
64
  export type FormattedPrimitiveTypeCreator<O = never> = (options?: O) => FormattedPrimitiveTypeCheck;
65
65
  export type Defs = Record<string, CustomCssSyntax | CustomSyntax>;
66
66
  export type CustomSyntax = {
67
- ref: string;
68
- expects?: Expect[];
69
- is: CustomSyntaxCheck;
67
+ readonly ref: string;
68
+ readonly expects?: readonly Expect[];
69
+ readonly is: CustomSyntaxCheck;
70
70
  };
71
71
  export type CustomSyntaxCheck = (value: string) => Result;
72
72
  export type CustomSyntaxChecker<O = {}> = (options?: O) => CustomSyntaxCheck;
73
73
  export type CustomCssSyntax = {
74
- ref: string;
75
- caseSensitive?: boolean;
76
- expects?: Expect[];
77
- syntax: {
78
- apply: `<${string}>`;
79
- def: Record<string, string | CssSyntaxTokenizer>;
74
+ readonly ref: string;
75
+ readonly caseSensitive?: boolean;
76
+ readonly expects?: readonly Expect[];
77
+ readonly syntax: {
78
+ readonly apply: `<${string}>`;
79
+ readonly def: Readonly<Record<string, string | CssSyntaxTokenizer>>;
80
80
  /**
81
81
  * @deprecated
82
82
  */
83
- ebnf?: Record<string, string | string[]>;
83
+ readonly ebnf?: Readonly<Record<string, string | readonly string[]>>;
84
84
  /**
85
85
  * @deprecated
86
86
  */
87
- properties?: Record<string, string>;
87
+ readonly properties?: Readonly<Record<string, string>>;
88
88
  };
89
89
  };
90
90
  export type CSSSyntaxToken = {
91
- type: number;
92
- value: string;
93
- index: number;
94
- balance: number;
95
- node?: any;
91
+ readonly type: number;
92
+ readonly value: string;
93
+ readonly index: number;
94
+ readonly balance: number;
95
+ readonly node?: any;
96
96
  };
97
97
  export type CssSyntaxTokenizer = (
98
- token: CSSSyntaxToken | null,
98
+ token: Readonly<CSSSyntaxToken> | null,
99
99
  getNextToken: GetNextToken,
100
100
  match: typeof cssSyntaxMatch,
101
101
  ) => number;