@markuplint/types 3.8.0 → 3.9.1
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,16 +1,15 @@
|
|
|
1
1
|
import type { TokenValue } from './types';
|
|
2
2
|
import type { UnmatchedResult } from '..';
|
|
3
3
|
import type { Expect, Result, List } from '../types';
|
|
4
|
-
import type { ReadonlyDeep } from 'type-fest';
|
|
5
4
|
import { Token } from './token';
|
|
6
5
|
type TokenCollectionOptions = Partial<Omit<List, 'token'> & {
|
|
7
6
|
specificSeparator: string | string[];
|
|
8
7
|
}>;
|
|
9
|
-
export type TokenEachCheck = (head: Readonly<Token> | null, tail:
|
|
8
|
+
export type TokenEachCheck = (head: Readonly<Token> | null, tail: TokenCollection) => Result | void;
|
|
10
9
|
export declare class TokenCollection extends Array<Token> {
|
|
11
|
-
static fromPatterns(value: Readonly<Token> | string, patterns: readonly Readonly<RegExp>[], typeOptions?:
|
|
10
|
+
static fromPatterns(value: Readonly<Token> | string, patterns: readonly Readonly<RegExp>[], typeOptions?: Omit<TokenCollectionOptions, 'specificSeparator'> & {
|
|
12
11
|
repeat?: boolean;
|
|
13
|
-
}
|
|
12
|
+
}): TokenCollection;
|
|
14
13
|
static get [Symbol.species](): ArrayConstructor;
|
|
15
14
|
readonly allowEmpty: NonNullable<List['allowEmpty']>;
|
|
16
15
|
readonly caseInsensitive: NonNullable<List['caseInsensitive']>;
|
|
@@ -19,7 +18,7 @@ export declare class TokenCollection extends Array<Token> {
|
|
|
19
18
|
readonly ordered: NonNullable<List['ordered']>;
|
|
20
19
|
readonly separator: NonNullable<List['separator']>;
|
|
21
20
|
readonly unique: NonNullable<List['unique']>;
|
|
22
|
-
constructor(value?: string, typeOptions?:
|
|
21
|
+
constructor(value?: string, typeOptions?: TokenCollectionOptions);
|
|
23
22
|
constructor(value?: number);
|
|
24
23
|
get value(): string;
|
|
25
24
|
check(options?: {
|
|
@@ -4,7 +4,9 @@ exports.TokenCollection = void 0;
|
|
|
4
4
|
const match_result_1 = require("../match-result");
|
|
5
5
|
const token_1 = require("./token");
|
|
6
6
|
class TokenCollection extends Array {
|
|
7
|
-
static fromPatterns(value, patterns,
|
|
7
|
+
static fromPatterns(value, patterns,
|
|
8
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
9
|
+
typeOptions) {
|
|
8
10
|
var _c;
|
|
9
11
|
const originalValue = typeof value === 'string' ? value : value.originalValue;
|
|
10
12
|
let strings = typeof value === 'string' ? value : value.value;
|
|
@@ -51,7 +53,9 @@ class TokenCollection extends Array {
|
|
|
51
53
|
static get [Symbol.species]() {
|
|
52
54
|
return Array;
|
|
53
55
|
}
|
|
54
|
-
constructor(value,
|
|
56
|
+
constructor(value,
|
|
57
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
58
|
+
typeOptions) {
|
|
55
59
|
var _c, _d, _e, _f, _g, _h;
|
|
56
60
|
super();
|
|
57
61
|
this.disallowToSurroundBySpaces = (_c = typeOptions === null || typeOptions === void 0 ? void 0 : typeOptions.disallowToSurroundBySpaces) !== null && _c !== void 0 ? _c : false;
|
|
@@ -381,7 +385,9 @@ class TokenCollection extends Array {
|
|
|
381
385
|
toJSON() {
|
|
382
386
|
return this.map(t => t.toJSON());
|
|
383
387
|
}
|
|
384
|
-
static _new(tokens,
|
|
388
|
+
static _new(tokens,
|
|
389
|
+
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
390
|
+
old) {
|
|
385
391
|
const newCollection = new TokenCollection('', old);
|
|
386
392
|
newCollection.push(...tokens);
|
|
387
393
|
return newCollection;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/types",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.9.1",
|
|
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>",
|
|
@@ -21,15 +21,15 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@types/bcp-47": "1",
|
|
24
|
-
"@types/css-tree": "^2.
|
|
24
|
+
"@types/css-tree": "^2.3.2",
|
|
25
25
|
"@types/debug": "^4.1.8",
|
|
26
26
|
"@types/whatwg-mimetype": "3.0.0",
|
|
27
27
|
"bcp-47": "1",
|
|
28
28
|
"css-tree": "^2.3.1",
|
|
29
29
|
"debug": "^4.3.4",
|
|
30
30
|
"leven": "3",
|
|
31
|
-
"type-fest": "^3.
|
|
31
|
+
"type-fest": "^4.3.1",
|
|
32
32
|
"whatwg-mimetype": "^3.0.0"
|
|
33
33
|
},
|
|
34
|
-
"gitHead": "
|
|
34
|
+
"gitHead": "09100b8baa14dd930602daa458197322197c79c2"
|
|
35
35
|
}
|