@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
@@ -91,8 +91,12 @@ const checkNormalizedLocalDateAndTimeString = () => function checkNormalizedLoca
91
91
  * > if the given time is zero seconds past the minute)
92
92
  */
93
93
  const [, , , , , , , , , , second, , fp] = tokens;
94
- const _second = second.toNumber() || 0;
95
- const _fp = fp.toNumber() || 0;
94
+ if (!second || !fp) {
95
+ (0, debug_1.log)('Failed: %O', res);
96
+ return res;
97
+ }
98
+ const _second = second.toNumber();
99
+ const _fp = fp.toNumber();
96
100
  (0, debug_1.log)('Omitting the seconds component: "%s.%s" => %d, %d', second === null || second === void 0 ? void 0 : second.value, fp === null || fp === void 0 ? void 0 : fp.value, _second, _fp);
97
101
  if (second.value && _second === 0 && (!fp.value || (fp.value && _fp === 0))) {
98
102
  const res = second.unmatched({
@@ -4,4 +4,4 @@ import type { CustomSyntaxChecker } from '../../types';
4
4
  * @see https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#time-zones
5
5
  */
6
6
  export declare const checkTimeZoneOffsetString: CustomSyntaxChecker;
7
- export declare function parseTimeZone(zone: string | Token): import("../../types").Result;
7
+ export declare function parseTimeZone(zone: string | Readonly<Token>): import('../../types').Result;
@@ -27,6 +27,7 @@ function parseTimeZone(zone) {
27
27
  ]);
28
28
  (0, debug_1.log)('Time-zone Part: "%s" => %O', value, zoneTokens);
29
29
  const res = zoneTokens.eachCheck((sign, tail) => {
30
+ var _a, _b;
30
31
  if (!sign || !sign.value) {
31
32
  return (0, match_result_1.unmatched)(value, 'missing-token', {
32
33
  expects: [
@@ -39,9 +40,9 @@ function parseTimeZone(zone) {
39
40
  }
40
41
  if (sign.match('Z')) {
41
42
  if (tail.value) {
42
- return tail[0].unmatched({
43
+ return ((_b = (_a = tail[0]) === null || _a === void 0 ? void 0 : _a.unmatched({
43
44
  reason: 'extra-token',
44
- });
45
+ })) !== null && _b !== void 0 ? _b : (0, match_result_1.unmatched)(tail.value, 'extra-token'));
45
46
  }
46
47
  return (0, match_result_1.matched)();
47
48
  }
@@ -4,8 +4,8 @@ import type { CustomSyntaxChecker } from '../types';
4
4
  * @see https://mimesniff.spec.whatwg.org/#valid-mime-type
5
5
  */
6
6
  export declare const checkMIMEType: CustomSyntaxChecker<{
7
- /**
8
- * @see https://mimesniff.spec.whatwg.org/#valid-mime-type-with-no-parameters
9
- */
10
- withoutParameters?: boolean;
7
+ /**
8
+ * @see https://mimesniff.spec.whatwg.org/#valid-mime-type-with-no-parameters
9
+ */
10
+ withoutParameters?: boolean;
11
11
  }>;
@@ -27,7 +27,7 @@ const checkMIMEType = options => value => {
27
27
  if (value.toLowerCase() === mimeType.essence) {
28
28
  return (0, match_result_1.matched)();
29
29
  }
30
- if (!withoutParameters && mimeType.parameters.size) {
30
+ if (!withoutParameters && mimeType.parameters.size > 0) {
31
31
  return (0, match_result_1.matched)();
32
32
  }
33
33
  const extraToken = value.slice(mimeType.essence.length);
@@ -1,58 +1,59 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const check_mime_type_1 = require("./check-mime-type");
1
+ 'use strict';
2
+ // @ts-nocheck
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+ const check_mime_type_1 = require('./check-mime-type');
4
5
  const check = (0, check_mime_type_1.checkMIMEType)();
5
6
  const checkNoParam = (0, check_mime_type_1.checkMIMEType)({ withoutParameters: true });
6
7
  test('valid', () => {
7
- expect(check('x/y').matched).toBe(true);
8
- expect(check('x/y;a=b;c=D;E="F"').matched).toBe(true);
8
+ expect(check('x/y').matched).toBe(true);
9
+ expect(check('x/y;a=b;c=D;E="F"').matched).toBe(true);
9
10
  });
10
11
  test('excrescence-token', () => {
11
- expect(check('xy;')).toStrictEqual({
12
- column: 1,
13
- expects: [{ type: 'format', value: 'MIME Type' }],
14
- length: 3,
15
- line: 1,
16
- matched: false,
17
- offset: 0,
18
- raw: 'xy;',
19
- reason: 'syntax-error',
20
- ref: null,
21
- });
22
- expect(check('x/y;')).toStrictEqual({
23
- candidate: 'x/y',
24
- column: 4,
25
- expects: [{ type: 'format', value: 'MIME Type' }],
26
- length: 1,
27
- line: 1,
28
- matched: false,
29
- offset: 3,
30
- raw: ';',
31
- reason: 'extra-token',
32
- ref: null,
33
- });
34
- expect(checkNoParam('x/y;')).toStrictEqual({
35
- candidate: 'x/y',
36
- column: 4,
37
- expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
38
- length: 1,
39
- line: 1,
40
- matched: false,
41
- offset: 3,
42
- raw: ';',
43
- reason: 'extra-token',
44
- ref: null,
45
- });
46
- expect(checkNoParam('x/y;a=b;c=D;E="F"')).toStrictEqual({
47
- candidate: 'x/y',
48
- column: 4,
49
- expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
50
- length: 14,
51
- line: 1,
52
- matched: false,
53
- offset: 3,
54
- raw: ';a=b;c=D;E="F"',
55
- reason: 'extra-token',
56
- ref: null,
57
- });
12
+ expect(check('xy;')).toStrictEqual({
13
+ column: 1,
14
+ expects: [{ type: 'format', value: 'MIME Type' }],
15
+ length: 3,
16
+ line: 1,
17
+ matched: false,
18
+ offset: 0,
19
+ raw: 'xy;',
20
+ reason: 'syntax-error',
21
+ ref: null,
22
+ });
23
+ expect(check('x/y;')).toStrictEqual({
24
+ candidate: 'x/y',
25
+ column: 4,
26
+ expects: [{ type: 'format', value: 'MIME Type' }],
27
+ length: 1,
28
+ line: 1,
29
+ matched: false,
30
+ offset: 3,
31
+ raw: ';',
32
+ reason: 'extra-token',
33
+ ref: null,
34
+ });
35
+ expect(checkNoParam('x/y;')).toStrictEqual({
36
+ candidate: 'x/y',
37
+ column: 4,
38
+ expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
39
+ length: 1,
40
+ line: 1,
41
+ matched: false,
42
+ offset: 3,
43
+ raw: ';',
44
+ reason: 'extra-token',
45
+ ref: null,
46
+ });
47
+ expect(checkNoParam('x/y;a=b;c=D;E="F"')).toStrictEqual({
48
+ candidate: 'x/y',
49
+ column: 4,
50
+ expects: [{ type: 'format', value: 'MIME Type with no parameters' }],
51
+ length: 14,
52
+ line: 1,
53
+ matched: false,
54
+ offset: 3,
55
+ raw: ';a=b;c=D;E="F"',
56
+ reason: 'extra-token',
57
+ ref: null,
58
+ });
58
59
  });
@@ -1,8 +1,9 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- const is_abs_url_1 = require("./is-abs-url");
1
+ 'use strict';
2
+ // @ts-nocheck
3
+ Object.defineProperty(exports, '__esModule', { value: true });
4
+ const is_abs_url_1 = require('./is-abs-url');
4
5
  const is = (0, is_abs_url_1.isAbsURL)();
5
6
  test('valid', () => {
6
- expect(is('https://markuplint.dev')).toBe(true);
7
- expect(is('markuplint.dev')).toBe(false);
7
+ expect(is('https://markuplint.dev')).toBe(true);
8
+ expect(is('markuplint.dev')).toBe(false);
8
9
  });
@@ -13,7 +13,7 @@ exports.isItempropName = void 0;
13
13
  */
14
14
  const isItempropName = () => {
15
15
  return value => {
16
- return value.indexOf(':') === -1 && value.indexOf('.') === -1 && value.indexOf(' ') === -1;
16
+ return !value.includes(':') && !value.includes('.') && !value.includes(' ');
17
17
  };
18
18
  };
19
19
  exports.isItempropName = isItempropName;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/types",
3
- "version": "3.0.0-canary.5+382d1365",
3
+ "version": "3.0.0-dev.177+e94f3601",
4
4
  "description": "Type declaration and value checker",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -11,23 +11,25 @@
11
11
  "publishConfig": {
12
12
  "access": "public"
13
13
  },
14
+ "typedoc": {
15
+ "entryPoint": "./src/index.ts"
16
+ },
14
17
  "scripts": {
15
18
  "build": "tsc",
16
19
  "clean": "tsc --build --clean",
17
20
  "schema": "ts-node './gen/types.ts'; json2ts './types.schema.json' > './src/types.schema.ts'; prettier './src/types.schema.ts' './types.schema.json' --write; eslint './src/types.schema.ts' --fix; tsc;"
18
21
  },
19
22
  "dependencies": {
23
+ "@types/bcp-47": "1",
24
+ "@types/css-tree": "^2.0.1",
25
+ "@types/debug": "^4.1.7",
26
+ "@types/whatwg-mimetype": "3.0.0",
20
27
  "bcp-47": "1",
21
- "css-tree": "1",
28
+ "css-tree": "^2.3.1",
22
29
  "debug": "^4.3.4",
23
30
  "leven": "3",
24
- "whatwg-mimetype": "2"
25
- },
26
- "devDependencies": {
27
- "@types/bcp-47": "1",
28
- "@types/css-tree": "1",
29
- "@types/debug": "^4.1.7",
30
- "@types/whatwg-mimetype": "2"
31
+ "type-fest": "^3.8.0",
32
+ "whatwg-mimetype": "^3.0.0"
31
33
  },
32
- "gitHead": "382d13653071bd02210d5430403d1a87c840398c"
34
+ "gitHead": "e94f3601bf93366d1a2c7385ff7235817d82f7c9"
33
35
  }
@@ -1,4 +1,4 @@
1
- import { check } from './check';
1
+ const { check } = require('../lib/check');
2
2
 
3
3
  test('Any', () => {
4
4
  expect(check('', 'Any').matched).toBe(true);
@@ -81,3 +81,9 @@ test('Non-exist types', () => {
81
81
  // @ts-ignore
82
82
  expect(check('abc', '').matched).toBe(true);
83
83
  });
84
+
85
+ test('ItemProp', () => {
86
+ expect(check('itemListElement', 'ItemProp').matched).toBe(true);
87
+ expect(check('item', 'ItemProp').matched).toBe(true);
88
+ expect(check('position', 'ItemProp').matched).toBe(true);
89
+ });
@@ -1,6 +1,4 @@
1
- import type { CustomCssSyntax } from './types';
2
-
3
- import { cssSyntaxMatch } from './css-syntax';
1
+ const { cssSyntaxMatch } = require('../lib/css-syntax');
4
2
 
5
3
  test('CSS Standard', () => {
6
4
  expect(cssSyntaxMatch('10px', '<length>').matched).toBe(true);
@@ -9,7 +7,7 @@ test('CSS Standard', () => {
9
7
  });
10
8
 
11
9
  test('Extends', () => {
12
- const sourceSizeList: CustomCssSyntax = {
10
+ const sourceSizeList = {
13
11
  ref: 'https://html.spec.whatwg.org/multipage/images.html#sizes-attributes',
14
12
  syntax: {
15
13
  apply: '<source-size-list>',
@@ -34,7 +32,7 @@ test('Extends', () => {
34
32
  }).matched,
35
33
  ).toBe(true);
36
34
 
37
- const keyTimes: CustomCssSyntax = {
35
+ const keyTimes = {
38
36
  ref: 'https://svgwg.org/specs/animations/#KeyTimesAttribute',
39
37
  syntax: {
40
38
  apply: '<key-times>',
@@ -48,7 +46,7 @@ test('Extends', () => {
48
46
  expect(cssSyntaxMatch('20; 20; abc;', keyTimes).matched).toBe(false);
49
47
  expect(cssSyntaxMatch('20; 20; ;', keyTimes).matched).toBe(false);
50
48
 
51
- const SVGViewBox: CustomCssSyntax = {
49
+ const SVGViewBox = {
52
50
  ref: 'https://svgwg.org/svg2-draft/coords.html#ViewBoxAttribute',
53
51
  syntax: {
54
52
  apply: '<view-box>',
@@ -65,7 +63,7 @@ test('Extends', () => {
65
63
  expect(cssSyntaxMatch('0 0, 30, 10', SVGViewBox).matched).toBe(true);
66
64
  expect(cssSyntaxMatch('0 0, 30', SVGViewBox).matched).toBe(false);
67
65
 
68
- const percentageList: CustomCssSyntax = {
66
+ const percentageList = {
69
67
  ref: 'https://developer.mozilla.org/en-US/docs/Web/SVG/Content_type#percentage',
70
68
  syntax: {
71
69
  apply: '<percentage-list>',
@@ -79,7 +77,7 @@ test('Extends', () => {
79
77
  expect(cssSyntaxMatch('0', percentageList).matched).toBe(true);
80
78
  expect(cssSyntaxMatch('', percentageList).matched).toBe(false);
81
79
 
82
- const custom: CustomCssSyntax = {
80
+ const custom = {
83
81
  ref: 'n/a',
84
82
  syntax: {
85
83
  apply: '<custom>',
@@ -96,7 +94,7 @@ test('Extends', () => {
96
94
  });
97
95
 
98
96
  test('custom-type-checking', () => {
99
- const custom: CustomCssSyntax = {
97
+ const custom = {
100
98
  ref: 'n/a',
101
99
  caseSensitive: true,
102
100
  syntax: {
@@ -117,7 +115,7 @@ test('custom-type-checking', () => {
117
115
  });
118
116
 
119
117
  test('case-sensitive', () => {
120
- const custom: CustomCssSyntax = {
118
+ const custom = {
121
119
  ref: 'n/a',
122
120
  caseSensitive: true,
123
121
  syntax: {
@@ -143,7 +141,7 @@ test('case-sensitive', () => {
143
141
  expects: [
144
142
  {
145
143
  type: 'syntax',
146
- value: 'CaSeS [ a | B | aBc ]',
144
+ value: '<custom>',
147
145
  },
148
146
  ],
149
147
  });
@@ -160,7 +158,7 @@ test('case-sensitive', () => {
160
158
  expects: [
161
159
  {
162
160
  type: 'syntax',
163
- value: 'CaSeS [ a | B | aBc ]',
161
+ value: '<custom>',
164
162
  },
165
163
  ],
166
164
  });
@@ -1,7 +1,7 @@
1
- import { checkList } from './list';
1
+ const { checkList } = require('../lib/list');
2
2
 
3
3
  test('Zero space', () => {
4
- const type = { token: 'Zero', separator: 'space' } as const;
4
+ const type = { token: 'Zero', separator: 'space' };
5
5
  expect(checkList('0', type).matched).toBe(true);
6
6
  expect(checkList(' 0 ', type).matched).toBe(true);
7
7
  expect(checkList(' 0 0', type).matched).toBe(true);
@@ -19,7 +19,7 @@ test('Zero space', () => {
19
19
  });
20
20
 
21
21
  test('Zero comma', () => {
22
- const type = { token: 'Zero', separator: 'comma' } as const;
22
+ const type = { token: 'Zero', separator: 'comma' };
23
23
  expect(checkList('0', type).matched).toBe(true);
24
24
  expect(checkList(' 0 ', type).matched).toBe(true);
25
25
  expect(checkList(' 0 0', type).matched).toBe(false);
@@ -33,7 +33,7 @@ test('Zero comma', () => {
33
33
  });
34
34
 
35
35
  test('Zero comma (disallowToSurroundBySpaces)', () => {
36
- const type = { token: 'Zero', separator: 'comma', disallowToSurroundBySpaces: true } as const;
36
+ const type = { token: 'Zero', separator: 'comma', disallowToSurroundBySpaces: true };
37
37
  expect(checkList('0', type).matched).toBe(true);
38
38
  expect(checkList(' 0 ', type).matched).toBe(false);
39
39
  expect(checkList(' 0 0', type).matched).toBe(false);
@@ -48,7 +48,7 @@ test('Zero comma (disallowToSurroundBySpaces)', () => {
48
48
  });
49
49
 
50
50
  test('Location of the token', () => {
51
- const type = { token: 'Accept', separator: 'comma' } as const;
51
+ const type = { token: 'Accept', separator: 'comma' };
52
52
  expect(checkList('x/y;a=b', type)).toStrictEqual({
53
53
  candidate: 'x/y',
54
54
  column: 4,
@@ -91,7 +91,7 @@ test('Location of the token', () => {
91
91
  });
92
92
 
93
93
  test('Expected comma', () => {
94
- const type = { token: 'Accept', separator: 'comma' } as const;
94
+ const type = { token: 'Accept', separator: 'comma' };
95
95
  expect(checkList('x/y,', type)).toStrictEqual({
96
96
  column: 4,
97
97
  expects: undefined,
@@ -117,7 +117,7 @@ test('Expected comma', () => {
117
117
  });
118
118
 
119
119
  test('Missing comma', () => {
120
- const type = { token: 'Accept', separator: 'comma' } as const;
120
+ const type = { token: 'Accept', separator: 'comma' };
121
121
  expect(checkList('a/b,x/y a/z', type)).toStrictEqual({
122
122
  column: 9,
123
123
  candidate: ',a/z',
@@ -1,4 +1,4 @@
1
- import { isInt, isUint, isFloat, isNonZeroUint, isQuantity } from '.';
1
+ const { isInt, isUint, isFloat, isNonZeroUint, isQuantity } = require('../../lib/primitive');
2
2
 
3
3
  test('int', () => {
4
4
  expect(isInt('0')).toBe(true);
@@ -1,4 +1,4 @@
1
- import { isBCP47 } from './is-bcp-47';
1
+ const { isBCP47 } = require('../../lib/rfc/is-bcp-47');
2
2
 
3
3
  const is = isBCP47();
4
4
 
@@ -1,6 +1,5 @@
1
- import { TokenCollection } from './token-collection';
2
-
3
- import { Token } from '.';
1
+ const { Token } = require('../../lib/token/token');
2
+ const { TokenCollection } = require('../../lib/token/token-collection');
4
3
 
5
4
  test('parse', () => {
6
5
  expect(new TokenCollection(' a b c ').toJSON()).toStrictEqual([
@@ -1,6 +1,4 @@
1
- // @ts-nocheck
2
-
3
- import { checkSerializedPermissionsPolicy } from './check-serialized-permissions-policy';
1
+ const { checkSerializedPermissionsPolicy } = require('../../lib/w3c/check-serialized-permissions-policy');
4
2
 
5
3
  const check = checkSerializedPermissionsPolicy();
6
4
 
@@ -1,4 +1,4 @@
1
- import { checkAutoComplete } from './check-autocomplete';
1
+ const { checkAutoComplete } = require('../../lib/whatwg/check-autocomplete');
2
2
 
3
3
  const check = checkAutoComplete();
4
4
 
@@ -1,18 +1,21 @@
1
- // @ts-nocheck
2
-
3
- import { checkDateString } from './date-string';
4
- import { getMaxWeekNum } from './datetime-tokens';
5
- import { checkDurationISO8601LikeString, checkDurationComponentListString } from './duration-string';
6
- import { checkGlobalDateAndTimeString } from './global-date-and-time-string';
7
- import { checkLocalDateAndTimeString, checkNormalizedLocalDateAndTimeString } from './local-date-and-time-string';
8
- import { checkMonthString } from './month-string';
9
- import { checkTimeString } from './time-string';
10
- import { checkTimeZoneOffsetString } from './time-zone-offset-string';
11
- import { checkWeekString } from './week-string';
12
- import { checkYearString } from './year-string';
13
- import { checkYearlessDateString } from './yearless-date-string';
14
-
15
- import { checkDateTime } from '.';
1
+ const { checkDateTime } = require('../../../lib/whatwg/check-datetime');
2
+ const { checkDateString } = require('../../../lib/whatwg/check-datetime/date-string');
3
+ const { getMaxWeekNum } = require('../../../lib/whatwg/check-datetime/datetime-tokens');
4
+ const {
5
+ checkDurationISO8601LikeString,
6
+ checkDurationComponentListString,
7
+ } = require('../../../lib/whatwg/check-datetime/duration-string');
8
+ const { checkGlobalDateAndTimeString } = require('../../../lib/whatwg/check-datetime/global-date-and-time-string');
9
+ const {
10
+ checkLocalDateAndTimeString,
11
+ checkNormalizedLocalDateAndTimeString,
12
+ } = require('../../../lib/whatwg/check-datetime/local-date-and-time-string');
13
+ const { checkMonthString } = require('../../../lib/whatwg/check-datetime/month-string');
14
+ const { checkTimeString } = require('../../../lib/whatwg/check-datetime/time-string');
15
+ const { checkTimeZoneOffsetString } = require('../../../lib/whatwg/check-datetime/time-zone-offset-string');
16
+ const { checkWeekString } = require('../../../lib/whatwg/check-datetime/week-string');
17
+ const { checkYearString } = require('../../../lib/whatwg/check-datetime/year-string');
18
+ const { checkYearlessDateString } = require('../../../lib/whatwg/check-datetime/yearless-date-string');
16
19
 
17
20
  const isMonth = checkMonthString();
18
21
  const isDate = checkDateString();
@@ -1,4 +1,4 @@
1
- import { checkMIMEType } from './check-mime-type';
1
+ const { checkMIMEType } = require('../../lib/whatwg/check-mime-type');
2
2
 
3
3
  const check = checkMIMEType();
4
4
  const checkNoParam = checkMIMEType({ withoutParameters: true });
@@ -1,4 +1,4 @@
1
- import { isAbsURL } from './is-abs-url';
1
+ const { isAbsURL } = require('../../lib/whatwg/is-abs-url');
2
2
 
3
3
  const is = isAbsURL();
4
4