@markuplint/types 3.0.0-canary.5 → 3.0.0-dev.177

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 (110) hide show
  1. package/README.md +1 -1
  2. package/lib/check-multi-types.d.ts +4 -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 +4 -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 +21 -8
  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 +6 -3
  22. package/lib/primitive/split-unit.d.ts +2 -2
  23. package/lib/primitive/split-unit.js +2 -2
  24. package/lib/rfc/is-bcp-47.spec.js +9 -8
  25. package/lib/token/token-collection.d.ts +71 -56
  26. package/lib/token/token-collection.js +30 -23
  27. package/lib/token/token-collection.spec.js +156 -134
  28. package/lib/token/token.d.ts +58 -52
  29. package/lib/token/token.js +19 -20
  30. package/lib/token/types.d.ts +3 -0
  31. package/lib/token/types.js +2 -0
  32. package/lib/types.d.ts +79 -55
  33. package/lib/types.schema.d.ts +1084 -31
  34. package/lib/w3c/check-serialized-permissions-policy.spec.js +30 -28
  35. package/lib/whatwg/check-autocomplete.js +6 -6
  36. package/lib/whatwg/check-autocomplete.spec.js +361 -360
  37. package/lib/whatwg/check-datetime/datetime-tokens.d.ts +21 -1
  38. package/lib/whatwg/check-datetime/datetime-tokens.js +9 -6
  39. package/lib/whatwg/check-datetime/duration-string.js +12 -2
  40. package/lib/whatwg/check-datetime/index.spec.js +277 -276
  41. package/lib/whatwg/check-datetime/local-date-and-time-string.js +6 -2
  42. package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +1 -1
  43. package/lib/whatwg/check-datetime/time-zone-offset-string.js +3 -2
  44. package/lib/whatwg/check-mime-type.d.ts +4 -4
  45. package/lib/whatwg/check-mime-type.js +1 -1
  46. package/lib/whatwg/check-mime-type.spec.js +53 -52
  47. package/lib/whatwg/is-abs-url.spec.js +6 -5
  48. package/lib/whatwg/is-itemprop-name.js +1 -1
  49. package/package.json +12 -10
  50. package/{src/check.spec.ts → test/check.spec.js} +7 -1
  51. package/{src/css-syntax.spec.ts → test/css-syntax.spec.js} +10 -12
  52. package/{src/list.spec.ts → test/list.spec.js} +7 -7
  53. package/{src/primitive/index.spec.ts → test/primitive/index.spec.js} +1 -1
  54. package/{src/rfc/is-bcp-47.spec.ts → test/rfc/is-bcp-47.spec.js} +1 -1
  55. package/{src/token/token-collection.spec.ts → test/token/token-collection.spec.js} +2 -3
  56. package/{src/w3c/check-serialized-permissions-policy.spec.ts → test/w3c/check-serialized-permissions-policy.spec.js} +1 -3
  57. package/{src/whatwg/check-autocomplete.spec.ts → test/whatwg/check-autocomplete.spec.js} +1 -1
  58. package/{src/whatwg/check-datetime/index.spec.ts → test/whatwg/check-datetime/index.spec.js} +18 -15
  59. package/{src/whatwg/check-mime-type.spec.ts → test/whatwg/check-mime-type.spec.js} +1 -1
  60. package/{src/whatwg/is-abs-url.spec.ts → test/whatwg/is-abs-url.spec.js} +1 -1
  61. package/types.schema.json +369 -318
  62. package/gen/specific-schema.json +0 -98
  63. package/gen/types.ts +0 -66
  64. package/src/check-multi-types.ts +0 -35
  65. package/src/check.ts +0 -48
  66. package/src/css-syntax.ts +0 -188
  67. package/src/debug.ts +0 -3
  68. package/src/defs.ts +0 -811
  69. package/src/enum.ts +0 -25
  70. package/src/get-candidate.ts +0 -24
  71. package/src/index.ts +0 -3
  72. package/src/keyword-type.ts +0 -64
  73. package/src/list.ts +0 -34
  74. package/src/match-result.ts +0 -49
  75. package/src/number.ts +0 -46
  76. package/src/primitive/index.ts +0 -7
  77. package/src/primitive/is-float.ts +0 -8
  78. package/src/primitive/is-int.ts +0 -8
  79. package/src/primitive/is-non-zero-uint.ts +0 -8
  80. package/src/primitive/is-quantity.ts +0 -38
  81. package/src/primitive/is-uint.ts +0 -15
  82. package/src/primitive/range.ts +0 -14
  83. package/src/primitive/split-unit.ts +0 -20
  84. package/src/rfc/is-bcp-47.ts +0 -13
  85. package/src/token/index.ts +0 -2
  86. package/src/token/token-collection.ts +0 -444
  87. package/src/token/token.ts +0 -144
  88. package/src/types.schema.ts +0 -1062
  89. package/src/types.ts +0 -118
  90. package/src/w3c/check-serialized-permissions-policy.ts +0 -303
  91. package/src/whatwg/check-autocomplete.ts +0 -380
  92. package/src/whatwg/check-datetime/date-string.ts +0 -44
  93. package/src/whatwg/check-datetime/datetime-tokens.ts +0 -600
  94. package/src/whatwg/check-datetime/duration-string.ts +0 -399
  95. package/src/whatwg/check-datetime/global-date-and-time-string.ts +0 -96
  96. package/src/whatwg/check-datetime/index.ts +0 -36
  97. package/src/whatwg/check-datetime/local-date-and-time-string.ts +0 -163
  98. package/src/whatwg/check-datetime/month-string.ts +0 -31
  99. package/src/whatwg/check-datetime/time-string.ts +0 -49
  100. package/src/whatwg/check-datetime/time-zone-offset-string.ts +0 -93
  101. package/src/whatwg/check-datetime/week-string.ts +0 -41
  102. package/src/whatwg/check-datetime/year-string.ts +0 -26
  103. package/src/whatwg/check-datetime/yearless-date-string.ts +0 -38
  104. package/src/whatwg/check-mime-type.ts +0 -46
  105. package/src/whatwg/is-abs-url.ts +0 -31
  106. package/src/whatwg/is-browser-context-name.ts +0 -16
  107. package/src/whatwg/is-custom-element-name.ts +0 -76
  108. package/src/whatwg/is-itemprop-name.ts +0 -17
  109. package/tsconfig.test.json +0 -3
  110. package/tsconfig.tsbuildinfo +0 -1
@@ -1,34 +1,36 @@
1
- "use strict";
1
+ 'use strict';
2
2
  // @ts-nocheck
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- const check_serialized_permissions_policy_1 = require("./check-serialized-permissions-policy");
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+ const check_serialized_permissions_policy_1 = require('./check-serialized-permissions-policy');
5
5
  const check = (0, check_serialized_permissions_policy_1.checkSerializedPermissionsPolicy)();
6
6
  test('checkSerializedPermissionsPolicy', () => {
7
- expect(check('').reason).toBe('empty-token');
8
- expect(check(' ').reason).toBe('unexpected-token');
9
- // expect(check('a').reason).toBe('missing-token');
10
- expect(check('a').matched).toBe(true); // Current supported
11
- expect(check('a:').reason).toBe('unexpected-token');
12
- // expect(check('a ').reason).toBe('missing-token'); // Current supported
13
- expect(check('a ').matched).toBe(true);
14
- expect(check('a a').reason).toBe('unexpected-token');
15
- expect(check('a *').matched).toBe(true);
16
- expect(check('a *a').reason).toBe('unexpected-token');
17
- expect(check('a none').reason).toBe('missing-token');
18
- expect(check("a 'none'").matched).toBe(true);
19
- expect(check('a https://markuplint.dev').matched).toBe(true);
20
- expect(check('a https://markuplint.dev/path/to').reason).toBe('extra-token');
21
- expect(check('a https://マルチバイト.abc.xyz').reason).toBe('must-be-serialized');
22
- expect(check('a * https://markuplint.dev').matched).toBe(true);
23
- expect(check("a * https://markuplint.dev 'none'").matched).toBe(true);
24
- // expect(check("a * https://markuplint.dev 'none';b").reason).toBe('missing-token');
25
- expect(check("a * https://markuplint.dev 'none';b").matched).toBe(true); // Current supported
26
- // expect(check("a * https://markuplint.dev 'none';b ").reason).toBe('missing-token');
27
- expect(check("a * https://markuplint.dev 'none';b ").matched).toBe(true); // Current supported
28
- expect(check("a * https://markuplint.dev 'none';b *").matched).toBe(true);
29
- expect(check("a * https://markuplint.dev 'none';b *;c 'none'").matched).toBe(true);
30
- expect(check("a * https://markuplint.dev 'none'; b *; c 'none'").matched).toBe(true);
7
+ expect(check('').reason).toBe('empty-token');
8
+ expect(check(' ').reason).toBe('unexpected-token');
9
+ // expect(check('a').reason).toBe('missing-token');
10
+ expect(check('a').matched).toBe(true); // Current supported
11
+ expect(check('a:').reason).toBe('unexpected-token');
12
+ // expect(check('a ').reason).toBe('missing-token'); // Current supported
13
+ expect(check('a ').matched).toBe(true);
14
+ expect(check('a a').reason).toBe('unexpected-token');
15
+ expect(check('a *').matched).toBe(true);
16
+ expect(check('a *a').reason).toBe('unexpected-token');
17
+ expect(check('a none').reason).toBe('missing-token');
18
+ expect(check("a 'none'").matched).toBe(true);
19
+ expect(check('a https://markuplint.dev').matched).toBe(true);
20
+ expect(check('a https://markuplint.dev/path/to').reason).toBe('extra-token');
21
+ expect(check('a https://マルチバイト.abc.xyz').reason).toBe('must-be-serialized');
22
+ expect(check('a * https://markuplint.dev').matched).toBe(true);
23
+ expect(check("a * https://markuplint.dev 'none'").matched).toBe(true);
24
+ // expect(check("a * https://markuplint.dev 'none';b").reason).toBe('missing-token');
25
+ expect(check("a * https://markuplint.dev 'none';b").matched).toBe(true); // Current supported
26
+ // expect(check("a * https://markuplint.dev 'none';b ").reason).toBe('missing-token');
27
+ expect(check("a * https://markuplint.dev 'none';b ").matched).toBe(true); // Current supported
28
+ expect(check("a * https://markuplint.dev 'none';b *").matched).toBe(true);
29
+ expect(check("a * https://markuplint.dev 'none';b *;c 'none'").matched).toBe(true);
30
+ expect(check("a * https://markuplint.dev 'none'; b *; c 'none'").matched).toBe(true);
31
31
  });
32
32
  test('YouTube embed', () => {
33
- expect(check('accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture').matched).toBe(true);
33
+ expect(
34
+ check('accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture').matched,
35
+ ).toBe(true);
34
36
  });
@@ -132,7 +132,7 @@ const checkAutoComplete = () => value => {
132
132
  // > just autofill detail tokens
133
133
  // > (i.e. the "on" and "off" keywords are not allowed).
134
134
  if (head.match(['on', 'off'], true)) {
135
- if (tail.length) {
135
+ if (tail[0]) {
136
136
  acLog('[Unmatched ("%s")] Unexpected pair with "on" or "off": "%s"', value, tail.value);
137
137
  return tail[0].unmatched({
138
138
  reason: 'extra-token',
@@ -209,7 +209,7 @@ const checkAutoComplete = () => value => {
209
209
  acLog('[Unmatched ("%s")] Unexpected token: "%s"', value, contactableFiledToken.value);
210
210
  return contactableFiledToken.unmatched({
211
211
  reason: 'unexpected-token',
212
- expects: contactableFieldNames.slice().map(token => ({
212
+ expects: contactableFieldNames.map(token => ({
213
213
  type: 'const',
214
214
  value: token,
215
215
  })),
@@ -242,7 +242,7 @@ const checkAutoComplete = () => value => {
242
242
  return (0, match_result_1.matched)();
243
243
  }
244
244
  if (head.match([...autofillFieldNames, ...contactableFieldNames], true)) {
245
- if (tail.length) {
245
+ if (tail[0]) {
246
246
  if (tail[0].match(webauthnFieldNames)) {
247
247
  return (0, match_result_1.matched)();
248
248
  }
@@ -285,7 +285,7 @@ const checkAutoComplete = () => value => {
285
285
  const [prefix, namedGroupStr] = head.value.split('-');
286
286
  const candidatePrefix = (0, get_candidate_1.getCandidate)(prefix, 'section');
287
287
  if (candidatePrefix) {
288
- candidate = `${candidatePrefix}-${namedGroupStr || ''}`;
288
+ candidate = `${candidatePrefix}-${namedGroupStr !== null && namedGroupStr !== void 0 ? namedGroupStr : ''}`;
289
289
  }
290
290
  }
291
291
  else if (!hasPartOfAddress) {
@@ -299,13 +299,13 @@ const checkAutoComplete = () => value => {
299
299
  candidate = (0, get_candidate_1.getCandidate)(head.value, partOfAddress, autofillFieldNames, contactingTokens, contactableFieldNames);
300
300
  }
301
301
  else if (!hasContactingToken) {
302
- expects.push(...contactingTokens.slice().map(token => ({
302
+ expects.push(...contactingTokens.map(token => ({
303
303
  type: 'const',
304
304
  value: token,
305
305
  })));
306
306
  candidate = (0, get_candidate_1.getCandidate)(head.value, autofillFieldNames, contactingTokens, contactableFieldNames);
307
307
  }
308
- candidate = candidate || (0, get_candidate_1.getCandidate)(head.value, autofillFieldNames);
308
+ candidate = candidate !== null && candidate !== void 0 ? candidate : (0, get_candidate_1.getCandidate)(head.value, autofillFieldNames);
309
309
  if (candidate) {
310
310
  acLog('[Unmatched ("%s")] Unexpected token: "%s", Do you mean "%s"? ', value, head.value, candidate);
311
311
  }