@markuplint/types 3.1.0 → 3.3.0

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.
@@ -1,2 +1,5 @@
1
1
  import type { CustomSyntaxCheck, UnmatchedResult } from './types';
2
- export declare function checkMultiTypes(value: string, checks: CustomSyntaxCheck[]): import("./types").MatchedResult | UnmatchedResult;
2
+ export declare function checkMultiTypes(
3
+ value: string,
4
+ checks: CustomSyntaxCheck[],
5
+ ): UnmatchedResult | import('./types').MatchedResult;
package/lib/check.spec.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @ts-nocheck
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const check_1 = require("./check");
4
5
  test('Any', () => {
package/lib/css-syntax.js CHANGED
@@ -1,8 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.cssSyntaxMatch = void 0;
4
- const tslib_1 = require("tslib");
5
- const css_tree_1 = tslib_1.__importDefault(require("css-tree"));
4
+ const css_tree_1 = require("css-tree");
6
5
  const debug_1 = require("./debug");
7
6
  const defs_1 = require("./defs");
8
7
  const match_result_1 = require("./match-result");
@@ -39,7 +38,7 @@ function cssSyntaxMatch(value, type) {
39
38
  if (typeof valueOrChecker === 'string') {
40
39
  typesExtended[key] = valueOrChecker;
41
40
  }
42
- else {
41
+ else if (valueOrChecker) {
43
42
  typesCheckers[key] = valueOrChecker;
44
43
  }
45
44
  });
@@ -53,15 +52,17 @@ function cssSyntaxMatch(value, type) {
53
52
  ref = type.ref;
54
53
  }
55
54
  // @ts-ignore
56
- const lexer = css_tree_1.default.fork({
55
+ const lexer = (0, css_tree_1.fork)({
57
56
  types: typesExtended,
58
57
  properties: propsExtended,
59
58
  }).lexer;
60
59
  Object.keys(typesCheckers).forEach(key => {
61
60
  const checker = typesCheckers[key];
62
- lexer.addType_(key, (token, getNextToken) => checker(token, getNextToken, cssSyntaxMatch));
61
+ // @ts-ignore
62
+ lexer.addType_(key, (token, getNextToken) => checker === null || checker === void 0 ? void 0 : checker(token, getNextToken, cssSyntaxMatch));
63
63
  });
64
64
  const { isProp, name } = detectName(defName);
65
+ // @ts-ignore
65
66
  const matcher = isProp ? lexer.properties[name] : lexer.types[name];
66
67
  if (!matcher) {
67
68
  (0, debug_1.log)('"%s" CSS syntax not found', defName);
@@ -79,12 +80,12 @@ function cssSyntaxMatch(value, type) {
79
80
  (0, debug_1.log)('css-tree/result: %O', result);
80
81
  // eslint-disable-next-line no-console
81
82
  console.warn = _w;
82
- if (result.matched) {
83
- if (debug_1.log.enabled) {
84
- (0, debug_1.log)('css-tree/result.matched: %s', JSON.stringify(result.matched, null, 2));
85
- }
83
+ if (!result.error) {
86
84
  return (0, match_result_1.matched)();
87
85
  }
86
+ if (!('css' in result.error)) {
87
+ throw result.error;
88
+ }
88
89
  const error = result.error;
89
90
  if (caseSensitive) {
90
91
  const offset = error.mismatchOffset % MIMIC_LENGTH;
@@ -127,6 +128,9 @@ function detectName(def) {
127
128
  }
128
129
  function eachMimicCases(key, obj) {
129
130
  const value = obj[key];
131
+ if (!value) {
132
+ return;
133
+ }
130
134
  obj[key] = mimicCases(value);
131
135
  }
132
136
  function mimicCases(value) {
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @ts-nocheck
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const css_syntax_1 = require("./css-syntax");
4
5
  test('CSS Standard', () => {
package/lib/defs.js CHANGED
@@ -431,7 +431,7 @@ exports.types = {
431
431
  if (!height) {
432
432
  return sep.unmatched({ reason: 'unexpected-token' });
433
433
  }
434
- if (tail && tail.length) {
434
+ if (tail && tail[0]) {
435
435
  return tail[0].unmatched({ reason: 'extra-token' });
436
436
  }
437
437
  if (!(0, primitive_1.isUint)(width.value)) {
@@ -1,3 +1,6 @@
1
1
  type NullableString = string | null | undefined;
2
- export declare function getCandidate(value: NullableString, ...candidates: (NullableString | NullableString[])[]): string | undefined;
2
+ export declare function getCandidate(
3
+ value: NullableString,
4
+ ...candidates: (NullableString | NullableString[])[]
5
+ ): string | undefined;
3
6
  export {};
package/lib/list.spec.js CHANGED
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @ts-nocheck
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const list_1 = require("./list");
4
5
  test('Zero space', () => {
@@ -1,9 +1,22 @@
1
- import type { FormattedPrimitiveTypeCheck, MatchedResult, UnmatchedResult, UnmatchedResultOptions, UnmatchedResultReason } from './types';
2
- export declare function matches(checker: FormattedPrimitiveTypeCheck, options?: UnmatchedResultOptions & {
3
- ref?: string;
4
- reason?: UnmatchedResultReason;
5
- }): (value: string) => MatchedResult | UnmatchedResult;
1
+ import type {
2
+ FormattedPrimitiveTypeCheck,
3
+ MatchedResult,
4
+ UnmatchedResult,
5
+ UnmatchedResultOptions,
6
+ UnmatchedResultReason,
7
+ } from './types';
8
+ export declare function matches(
9
+ checker: FormattedPrimitiveTypeCheck,
10
+ options?: UnmatchedResultOptions & {
11
+ ref?: string;
12
+ reason?: UnmatchedResultReason;
13
+ },
14
+ ): (value: string) => UnmatchedResult | MatchedResult;
6
15
  export declare function matched(): MatchedResult;
7
- export declare function unmatched(value: string, reason?: UnmatchedResultReason, options?: UnmatchedResultOptions & {
8
- ref?: string;
9
- }): UnmatchedResult;
16
+ export declare function unmatched(
17
+ value: string,
18
+ reason?: UnmatchedResultReason,
19
+ options?: UnmatchedResultOptions & {
20
+ ref?: string;
21
+ },
22
+ ): UnmatchedResult;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @ts-nocheck
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const _1 = require(".");
4
5
  test('int', () => {
@@ -3,6 +3,9 @@
3
3
  *
4
4
  * @param value
5
5
  */
6
- export declare function isUint(value: string, options?: {
7
- gt?: number;
8
- }): boolean;
6
+ export declare function isUint(
7
+ value: string,
8
+ options?: {
9
+ gt?: number;
10
+ },
11
+ ): boolean;
@@ -4,6 +4,6 @@
4
4
  * @returns
5
5
  */
6
6
  export declare function splitUnit(value: string): {
7
- num: string;
8
- unit: string;
7
+ num: string;
8
+ unit: string;
9
9
  };
@@ -17,8 +17,8 @@ function splitUnit(value) {
17
17
  }
18
18
  const [, num, unit] = matched;
19
19
  return {
20
- num,
21
- unit,
20
+ num: num !== null && num !== void 0 ? num : value,
21
+ unit: unit !== null && unit !== void 0 ? unit : '',
22
22
  };
23
23
  }
24
24
  exports.splitUnit = splitUnit;
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @ts-nocheck
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const is_bcp_47_1 = require("./is-bcp-47");
4
5
  const is = (0, is_bcp_47_1.isBCP47)();
@@ -1,62 +1,71 @@
1
1
  import type { UnmatchedResult } from '..';
2
2
  import type { Expect, Result, List } from '../types';
3
3
  import { Token } from './token';
4
- type TokenCollectionOptions = Partial<Omit<List, 'token'> & {
5
- specificSeparator: string | string[];
6
- }>;
4
+ type TokenCollectionOptions = Partial<
5
+ Omit<List, 'token'> & {
6
+ specificSeparator: string | string[];
7
+ }
8
+ >;
7
9
  export type TokenEachCheck = (head: Token | null, tail: TokenCollection) => Result | void;
8
10
  export declare class TokenCollection extends Array<Token> {
9
- static fromPatterns(value: Token | string, patterns: RegExp[], typeOptions?: Omit<TokenCollectionOptions, 'specificSeparator'> & {
10
- repeat?: boolean;
11
- }): TokenCollection;
12
- static get [Symbol.species](): ArrayConstructor;
13
- readonly allowEmpty: NonNullable<List['allowEmpty']>;
14
- readonly caseInsensitive: NonNullable<List['caseInsensitive']>;
15
- readonly disallowToSurroundBySpaces: NonNullable<List['disallowToSurroundBySpaces']>;
16
- readonly number: List['number'];
17
- readonly ordered: NonNullable<List['ordered']>;
18
- readonly separator: NonNullable<List['separator']>;
19
- readonly unique: NonNullable<List['unique']>;
20
- constructor(value?: string, typeOptions?: TokenCollectionOptions);
21
- constructor(value?: number);
22
- get value(): string;
23
- check(options?: {
24
- expects?: Expect[];
25
- ref?: string;
26
- cache?: boolean;
27
- }): import("..").MatchedResult | UnmatchedResult;
28
- chunk(split: number): TokenCollection[];
29
- compareTokens(callback: (prev: Token, current: Token) => Token | null | void): Token | null | undefined;
30
- divide(position: number): readonly [TokenCollection, TokenCollection];
31
- eachCheck(...callbacks: TokenEachCheck[]): Result;
32
- filter(callback: (value: Token, index: number, array: Token[]) => boolean): TokenCollection;
33
- getConsecutiveToken(tokenType: number): Token | null;
34
- getDuplicated(): Token | null;
35
- getIdentTokens(): TokenCollection;
36
- /**
37
- *
38
- * @param value The token value or the token type or its list
39
- */
40
- has(value: string | RegExp | number | (string | RegExp | number)[]): boolean;
41
- headAndTail(): {
42
- head: Token | null;
43
- tail: TokenCollection;
44
- };
45
- /**
46
- *
47
- * @param value The token value or the token type or its list
48
- */
49
- search(value: string | RegExp | number | (string | RegExp | number)[]): Token | null;
50
- takeTurns(tokenNumbers: ReadonlyArray<number>, lastTokenNumber?: number): {
51
- unexpectedLastToken: boolean;
52
- expectedTokenNumber: number;
53
- token: Token;
54
- } | null;
55
- toJSON(): {
56
- type: number;
57
- value: string;
58
- offset: number;
59
- }[];
60
- private static _new;
11
+ static fromPatterns(
12
+ value: Token | string,
13
+ patterns: RegExp[],
14
+ typeOptions?: Omit<TokenCollectionOptions, 'specificSeparator'> & {
15
+ repeat?: boolean;
16
+ },
17
+ ): TokenCollection;
18
+ static get [Symbol.species](): ArrayConstructor;
19
+ readonly allowEmpty: NonNullable<List['allowEmpty']>;
20
+ readonly caseInsensitive: NonNullable<List['caseInsensitive']>;
21
+ readonly disallowToSurroundBySpaces: NonNullable<List['disallowToSurroundBySpaces']>;
22
+ readonly number: List['number'];
23
+ readonly ordered: NonNullable<List['ordered']>;
24
+ readonly separator: NonNullable<List['separator']>;
25
+ readonly unique: NonNullable<List['unique']>;
26
+ constructor(value?: string, typeOptions?: TokenCollectionOptions);
27
+ constructor(value?: number);
28
+ get value(): string;
29
+ check(options?: {
30
+ expects?: Expect[];
31
+ ref?: string;
32
+ cache?: boolean;
33
+ }): UnmatchedResult | import('..').MatchedResult;
34
+ chunk(split: number): TokenCollection[];
35
+ compareTokens(callback: (prev: Token, current: Token) => Token | null | void): Token | null | undefined;
36
+ divide(position: number): readonly [TokenCollection, TokenCollection];
37
+ eachCheck(...callbacks: TokenEachCheck[]): Result;
38
+ filter(callback: (value: Token, index: number, array: Token[]) => boolean): TokenCollection;
39
+ getConsecutiveToken(tokenType: number): Token | null;
40
+ getDuplicated(): Token | null;
41
+ getIdentTokens(): TokenCollection;
42
+ /**
43
+ *
44
+ * @param value The token value or the token type or its list
45
+ */
46
+ has(value: string | RegExp | number | (string | RegExp | number)[]): boolean;
47
+ headAndTail(): {
48
+ head: Token | null;
49
+ tail: TokenCollection;
50
+ };
51
+ /**
52
+ *
53
+ * @param value The token value or the token type or its list
54
+ */
55
+ search(value: string | RegExp | number | (string | RegExp | number)[]): Token | null;
56
+ takeTurns(
57
+ tokenNumbers: ReadonlyArray<number>,
58
+ lastTokenNumber?: number,
59
+ ): {
60
+ unexpectedLastToken: boolean;
61
+ expectedTokenNumber: number | undefined;
62
+ token: Token;
63
+ } | null;
64
+ toJSON(): {
65
+ type: number;
66
+ value: string;
67
+ offset: number;
68
+ }[];
69
+ private static _new;
61
70
  }
62
71
  export {};
@@ -88,8 +88,9 @@ class TokenCollection extends Array {
88
88
  continue;
89
89
  }
90
90
  const lastChar = last[0];
91
- if (!separators.includes(char) &&
92
- !separators.includes(last[0]) &&
91
+ if (lastChar &&
92
+ !separators.includes(char) &&
93
+ !separators.includes(lastChar) &&
93
94
  ((token_1.Token.whitespace.includes(lastChar) && token_1.Token.whitespace.includes(char)) ||
94
95
  (!token_1.Token.whitespace.includes(lastChar) && !token_1.Token.whitespace.includes(char)))) {
95
96
  values.push(last + char);
@@ -353,6 +354,9 @@ class TokenCollection extends Array {
353
354
  const tokens = this.slice();
354
355
  for (let i = 0; i < tokens.length; i++) {
355
356
  const token = tokens[i];
357
+ if (!token) {
358
+ continue;
359
+ }
356
360
  const expectedTokenNumber = tokenNumbers[i % tokenNumbers.length];
357
361
  if (token.type !== expectedTokenNumber) {
358
362
  return {
@@ -1,4 +1,5 @@
1
1
  "use strict";
2
+ // @ts-nocheck
2
3
  Object.defineProperty(exports, "__esModule", { value: true });
3
4
  const token_collection_1 = require("./token-collection");
4
5
  const _1 = require(".");
@@ -1,55 +1,60 @@
1
1
  import type { UnmatchedResult, UnmatchedResultOptions, UnmatchedResultReason } from '../types';
2
2
  export declare class Token {
3
- #private;
4
- /**
5
- * @see https://github.com/csstree/csstree/blob/master/lib/tokenizer/types.js
6
- */
7
- static readonly Comma = 18;
8
- static readonly Ident = 1;
9
- static readonly WhiteSpace = 13;
10
- /**
11
- * ASCII whitespace is
12
- * - U+0009 TAB
13
- * - U+000A LF
14
- * - U+000C FF
15
- * - U+000D CR
16
- * - U+0020 SPACE.
17
- *
18
- * @see https://infra.spec.whatwg.org/#ascii-whitespace
19
- */
20
- static readonly whitespace: ReadonlyArray<string>;
21
- static getCol(value: string, offset: number): number;
22
- static getLine(value: string, offset: number): number;
23
- static getType(value: string, separators?: string[]): 1 | 13 | 18;
24
- static shiftLocation(token: Token, offset: number): {
25
- offset: number;
26
- line: number;
27
- column: number;
28
- };
29
- readonly offset: number;
30
- readonly type: number;
31
- readonly value: string;
32
- constructor(value: string, offset: number, originalValue: string, separators?: string[]);
33
- get length(): number;
34
- get origin(): string;
35
- /**
36
- *
37
- * @param value The token value or the token type or its list
38
- */
39
- includes(value: string | RegExp | number | (string | RegExp | number)[], caseInsensitive?: boolean): boolean;
40
- /**
41
- *
42
- * @param value The token value or the token type or its list
43
- */
44
- match(value: string | RegExp | number | (string | RegExp | number)[], caseInsensitive?: boolean): boolean;
45
- toJSON(): {
46
- type: number;
47
- value: string;
48
- offset: number;
49
- };
50
- toNumber(): number;
51
- unmatched(options?: UnmatchedResultOptions & {
52
- ref?: string;
53
- reason?: UnmatchedResultReason;
54
- }): UnmatchedResult;
3
+ #private;
4
+ /**
5
+ * @see https://github.com/csstree/csstree/blob/master/lib/tokenizer/types.js
6
+ */
7
+ static readonly Comma = 18;
8
+ static readonly Ident = 1;
9
+ static readonly WhiteSpace = 13;
10
+ /**
11
+ * ASCII whitespace is
12
+ * - U+0009 TAB
13
+ * - U+000A LF
14
+ * - U+000C FF
15
+ * - U+000D CR
16
+ * - U+0020 SPACE.
17
+ *
18
+ * @see https://infra.spec.whatwg.org/#ascii-whitespace
19
+ */
20
+ static readonly whitespace: ReadonlyArray<string>;
21
+ static getCol(value: string, offset: number): number;
22
+ static getLine(value: string, offset: number): number;
23
+ static getType(value: string, separators?: string[]): 1 | 13 | 18;
24
+ static shiftLocation(
25
+ token: Token,
26
+ offset: number,
27
+ ): {
28
+ offset: number;
29
+ line: number;
30
+ column: number;
31
+ };
32
+ readonly offset: number;
33
+ readonly type: number;
34
+ readonly value: string;
35
+ constructor(value: string, offset: number, originalValue: string, separators?: string[]);
36
+ get length(): number;
37
+ get origin(): string;
38
+ /**
39
+ *
40
+ * @param value The token value or the token type or its list
41
+ */
42
+ includes(value: string | RegExp | number | (string | RegExp | number)[], caseInsensitive?: boolean): boolean;
43
+ /**
44
+ *
45
+ * @param value The token value or the token type or its list
46
+ */
47
+ match(value: string | RegExp | number | (string | RegExp | number)[], caseInsensitive?: boolean): boolean;
48
+ toJSON(): {
49
+ type: number;
50
+ value: string;
51
+ offset: number;
52
+ };
53
+ toNumber(): number;
54
+ unmatched(
55
+ options?: UnmatchedResultOptions & {
56
+ ref?: string;
57
+ reason?: UnmatchedResultReason;
58
+ },
59
+ ): UnmatchedResult;
55
60
  }
@@ -5,17 +5,19 @@ exports.Token = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  class Token {
7
7
  static getCol(value, offset) {
8
+ var _a;
8
9
  const lines = value.slice(0, offset).split(/\n/g);
9
- return lines[lines.length - 1].length + 1;
10
+ return ((_a = lines[lines.length - 1]) !== null && _a !== void 0 ? _a : '').length + 1;
10
11
  }
11
12
  static getLine(value, offset) {
12
13
  return value.slice(0, offset).split(/\n/g).length;
13
14
  }
14
15
  static getType(value, separators) {
15
- if (Token.whitespace.includes(value[0])) {
16
+ var _a, _b;
17
+ if (Token.whitespace.includes((_a = value[0]) !== null && _a !== void 0 ? _a : '')) {
16
18
  return Token.WhiteSpace;
17
19
  }
18
- if (separators === null || separators === void 0 ? void 0 : separators.includes(value[0])) {
20
+ if (separators === null || separators === void 0 ? void 0 : separators.includes((_b = value[0]) !== null && _b !== void 0 ? _b : '')) {
19
21
  switch (value[0]) {
20
22
  case ',':
21
23
  return Token.Comma;
package/lib/types.d.ts CHANGED
@@ -2,77 +2,101 @@ 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
+ 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;
14
14
  } & UnmatchedResultOptions;
15
15
  export type UnmatchedResultOptions = {
16
- partName?: string;
17
- expects?: Expect[];
18
- extra?: Expect;
19
- candidate?: string;
20
- };
21
- 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' | {
22
- type: 'out-of-range';
23
- gt?: number;
24
- gte?: number;
25
- lt?: number;
26
- lte?: number;
27
- } | {
28
- type: 'out-of-range-length-char';
29
- gte: number;
30
- lte?: number;
31
- } | {
32
- type: 'out-of-range-length-digit';
33
- gte: number;
34
- lte?: number;
16
+ partName?: string;
17
+ expects?: Expect[];
18
+ extra?: Expect;
19
+ candidate?: string;
35
20
  };
21
+ export type UnmatchedResultReason =
22
+ | 'syntax-error'
23
+ | 'typo'
24
+ | 'missing-token'
25
+ | 'missing-comma'
26
+ | 'unexpected-token'
27
+ | 'unexpected-space'
28
+ | 'unexpected-newline'
29
+ | 'unexpected-comma'
30
+ | 'empty-token'
31
+ | 'out-of-range'
32
+ | 'doesnt-exist-in-enum'
33
+ | 'duplicated'
34
+ | 'illegal-combination'
35
+ | 'illegal-order'
36
+ | 'extra-token'
37
+ | 'must-be-percent-encoded'
38
+ | 'must-be-serialized'
39
+ | {
40
+ type: 'out-of-range';
41
+ gt?: number;
42
+ gte?: number;
43
+ lt?: number;
44
+ lte?: number;
45
+ }
46
+ | {
47
+ type: 'out-of-range-length-char';
48
+ gte: number;
49
+ lte?: number;
50
+ }
51
+ | {
52
+ type: 'out-of-range-length-digit';
53
+ gte: number;
54
+ lte?: number;
55
+ };
36
56
  export type MatchedResult = {
37
- matched: true;
57
+ matched: true;
38
58
  };
39
59
  export type Expect = {
40
- type: 'const' | 'format' | 'syntax' | 'regexp' | 'common';
41
- value: string;
60
+ type: 'const' | 'format' | 'syntax' | 'regexp' | 'common';
61
+ value: string;
42
62
  };
43
63
  export type FormattedPrimitiveTypeCheck = (value: string) => boolean;
44
64
  export type FormattedPrimitiveTypeCreator<O = never> = (options?: O) => FormattedPrimitiveTypeCheck;
45
65
  export type Defs = Record<string, CustomCssSyntax | CustomSyntax>;
46
66
  export type CustomSyntax = {
47
- ref: string;
48
- expects?: Expect[];
49
- is: CustomSyntaxCheck;
67
+ ref: string;
68
+ expects?: Expect[];
69
+ is: CustomSyntaxCheck;
50
70
  };
51
71
  export type CustomSyntaxCheck = (value: string) => Result;
52
72
  export type CustomSyntaxChecker<O = {}> = (options?: O) => CustomSyntaxCheck;
53
73
  export type CustomCssSyntax = {
54
- ref: string;
55
- caseSensitive?: boolean;
56
- expects?: Expect[];
57
- syntax: {
58
- apply: `<${string}>`;
59
- def: Record<string, string | CssSyntaxTokenizer>;
60
- /**
61
- * @deprecated
62
- */
63
- ebnf?: Record<string, string | string[]>;
64
- /**
65
- * @deprecated
66
- */
67
- properties?: Record<string, string>;
68
- };
74
+ ref: string;
75
+ caseSensitive?: boolean;
76
+ expects?: Expect[];
77
+ syntax: {
78
+ apply: `<${string}>`;
79
+ def: Record<string, string | CssSyntaxTokenizer>;
80
+ /**
81
+ * @deprecated
82
+ */
83
+ ebnf?: Record<string, string | string[]>;
84
+ /**
85
+ * @deprecated
86
+ */
87
+ properties?: Record<string, string>;
88
+ };
69
89
  };
70
90
  export type CSSSyntaxToken = {
71
- type: number;
72
- value: string;
73
- index: number;
74
- balance: number;
75
- node?: any;
91
+ type: number;
92
+ value: string;
93
+ index: number;
94
+ balance: number;
95
+ node?: any;
76
96
  };
77
- export type CssSyntaxTokenizer = (token: CSSSyntaxToken | null, getNextToken: GetNextToken, match: typeof cssSyntaxMatch) => number;
97
+ export type CssSyntaxTokenizer = (
98
+ token: CSSSyntaxToken | null,
99
+ getNextToken: GetNextToken,
100
+ match: typeof cssSyntaxMatch,
101
+ ) => number;
78
102
  export type GetNextToken = (length: number) => CSSSyntaxToken | null;