@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.
- package/README.md +12 -8
- package/lib/check-multi-types.d.ts +1 -1
- package/lib/check-multi-types.js +5 -4
- package/lib/check.d.ts +6 -5
- package/lib/check.spec.js +64 -58
- package/lib/css-syntax.js +49 -47
- package/lib/css-syntax.spec.js +152 -149
- package/lib/defs.js +2 -2
- package/lib/enum.d.ts +2 -1
- package/lib/enum.js +1 -1
- package/lib/get-candidate.d.ts +1 -1
- package/lib/keyword-type.js +3 -2
- package/lib/list.d.ts +2 -1
- package/lib/list.js +2 -1
- package/lib/list.spec.js +118 -117
- package/lib/match-result.d.ts +3 -3
- package/lib/match-result.js +2 -1
- package/lib/number.d.ts +1 -1
- package/lib/primitive/index.spec.js +53 -52
- package/lib/primitive/is-quantity.d.ts +5 -1
- package/lib/primitive/is-uint.d.ts +1 -1
- package/lib/primitive/split-unit.js +2 -2
- package/lib/rfc/is-bcp-47.spec.js +9 -8
- package/lib/token/token-collection.d.ts +20 -14
- package/lib/token/token-collection.js +30 -23
- package/lib/token/token-collection.spec.js +156 -134
- package/lib/token/token.d.ts +10 -9
- package/lib/token/token.js +19 -20
- package/lib/token/types.d.ts +3 -0
- package/lib/token/types.js +2 -0
- package/lib/types.d.ts +44 -44
- package/lib/types.schema.d.ts +369 -318
- package/lib/w3c/check-serialized-permissions-policy.spec.js +30 -28
- package/lib/whatwg/check-autocomplete.js +6 -6
- package/lib/whatwg/check-autocomplete.spec.js +361 -360
- package/lib/whatwg/check-datetime/datetime-tokens.js +9 -6
- package/lib/whatwg/check-datetime/duration-string.js +12 -2
- package/lib/whatwg/check-datetime/index.spec.js +277 -276
- package/lib/whatwg/check-datetime/local-date-and-time-string.js +6 -2
- package/lib/whatwg/check-datetime/time-zone-offset-string.d.ts +1 -1
- package/lib/whatwg/check-datetime/time-zone-offset-string.js +3 -2
- package/lib/whatwg/check-mime-type.js +1 -1
- package/lib/whatwg/check-mime-type.spec.js +53 -52
- package/lib/whatwg/is-abs-url.spec.js +6 -5
- package/lib/whatwg/is-itemprop-name.js +1 -1
- package/package.json +13 -11
- package/{src/check.spec.ts → test/check.spec.js} +7 -1
- package/{src/css-syntax.spec.ts → test/css-syntax.spec.js} +10 -12
- package/{src/list.spec.ts → test/list.spec.js} +7 -7
- package/{src/primitive/index.spec.ts → test/primitive/index.spec.js} +1 -1
- package/{src/rfc/is-bcp-47.spec.ts → test/rfc/is-bcp-47.spec.js} +1 -1
- package/{src/token/token-collection.spec.ts → test/token/token-collection.spec.js} +2 -3
- package/{src/w3c/check-serialized-permissions-policy.spec.ts → test/w3c/check-serialized-permissions-policy.spec.js} +1 -3
- package/{src/whatwg/check-autocomplete.spec.ts → test/whatwg/check-autocomplete.spec.js} +1 -1
- package/{src/whatwg/check-datetime/index.spec.ts → test/whatwg/check-datetime/index.spec.js} +18 -15
- package/{src/whatwg/check-mime-type.spec.ts → test/whatwg/check-mime-type.spec.js} +1 -1
- package/{src/whatwg/is-abs-url.spec.ts → test/whatwg/is-abs-url.spec.js} +1 -1
- package/types.schema.json +369 -318
- package/gen/specific-schema.json +0 -98
- package/gen/types.ts +0 -66
- package/src/check-multi-types.ts +0 -35
- package/src/check.ts +0 -48
- package/src/css-syntax.ts +0 -188
- package/src/debug.ts +0 -3
- package/src/defs.ts +0 -811
- package/src/enum.ts +0 -25
- package/src/get-candidate.ts +0 -24
- package/src/index.ts +0 -3
- package/src/keyword-type.ts +0 -64
- package/src/list.ts +0 -34
- package/src/match-result.ts +0 -49
- package/src/number.ts +0 -46
- package/src/primitive/index.ts +0 -7
- package/src/primitive/is-float.ts +0 -8
- package/src/primitive/is-int.ts +0 -8
- package/src/primitive/is-non-zero-uint.ts +0 -8
- package/src/primitive/is-quantity.ts +0 -38
- package/src/primitive/is-uint.ts +0 -15
- package/src/primitive/range.ts +0 -14
- package/src/primitive/split-unit.ts +0 -20
- package/src/rfc/is-bcp-47.ts +0 -13
- package/src/token/index.ts +0 -2
- package/src/token/token-collection.ts +0 -444
- package/src/token/token.ts +0 -144
- package/src/types.schema.ts +0 -1062
- package/src/types.ts +0 -118
- package/src/w3c/check-serialized-permissions-policy.ts +0 -303
- package/src/whatwg/check-autocomplete.ts +0 -380
- package/src/whatwg/check-datetime/date-string.ts +0 -44
- package/src/whatwg/check-datetime/datetime-tokens.ts +0 -600
- package/src/whatwg/check-datetime/duration-string.ts +0 -399
- package/src/whatwg/check-datetime/global-date-and-time-string.ts +0 -96
- package/src/whatwg/check-datetime/index.ts +0 -36
- package/src/whatwg/check-datetime/local-date-and-time-string.ts +0 -163
- package/src/whatwg/check-datetime/month-string.ts +0 -31
- package/src/whatwg/check-datetime/time-string.ts +0 -49
- package/src/whatwg/check-datetime/time-zone-offset-string.ts +0 -93
- package/src/whatwg/check-datetime/week-string.ts +0 -41
- package/src/whatwg/check-datetime/year-string.ts +0 -26
- package/src/whatwg/check-datetime/yearless-date-string.ts +0 -38
- package/src/whatwg/check-mime-type.ts +0 -46
- package/src/whatwg/is-abs-url.ts +0 -31
- package/src/whatwg/is-browser-context-name.ts +0 -16
- package/src/whatwg/is-custom-element-name.ts +0 -76
- package/src/whatwg/is-itemprop-name.ts +0 -17
- package/tsconfig.test.json +0 -3
- package/tsconfig.tsbuildinfo +0 -1
|
@@ -1,34 +1,36 @@
|
|
|
1
|
-
|
|
1
|
+
'use strict';
|
|
2
2
|
// @ts-nocheck
|
|
3
|
-
Object.defineProperty(exports,
|
|
4
|
-
const check_serialized_permissions_policy_1 = require(
|
|
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
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
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
|
-
|
|
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
|
|
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.
|
|
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
|
|
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.
|
|
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
|
|
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
|
}
|