-
Notifications
You must be signed in to change notification settings - Fork 7
/
index.d.ts
131 lines (107 loc) · 2.66 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
export function parser(commitText: string): Message;
export interface Note {
title: string,
text: string
}
export interface Reference {
action: string;
owner?: string;
repository?: string;
issue: string;
raw?: string;
prefix: string;
}
export interface ConventionalChangelogCommit {
type: string;
scope: string | null;
subject: string;
merge: boolean | null;
header: string;
body: string | null;
footer: string | null;
notes: Note[];
references: Reference[];
mentions: string[];
revert: boolean | null;
}
export function toConventionalChangelogFormat(ast: Message): ConventionalChangelogCommit;
// unist core - copied from @types/unist
export interface Point {
/** Line in a source file (1-indexed integer) */
line: number;
/** Column in a source file (1-indexed integer) */
column: number;
/** Character in a source file (0-indexed integer) */
offset?: number;
}
export interface Position {
/** Place of the first character of the parsed source region */
start: Point;
/** Place of the first character after the parsed source region */
end: Point;
}
export interface Node {
/** The semantic type of the node */
type: string;
/** Location of a node in a source document. Undefined when generated */
position?: Position;
}
export interface Literal extends Node {
value: unknown;
}
export interface Parent extends Node {
children: unknown[];
}
// unist conventional commits structure
export interface Message extends Parent {
type: 'message';
children: (Summary | Body | Newline | Footer)[];
}
export interface Text extends Literal {
type: 'text';
value: string;
}
export interface Newline extends Literal {
type: 'newline';
value: string;
}
export interface BreakingChange extends Literal {
type: 'breaking-change';
value: '!' | 'BREAKING-CHANGE' | 'BREAKING CHANGE';
}
export interface Summary extends Parent {
type: 'summary';
children: (Type | Scope | Separator)[];
}
export interface Type extends Literal {
type: 'type';
value: string;
}
export interface Scope extends Literal {
type: 'scope';
value: string;
}
export interface Separator extends Literal {
type: 'separator';
value: ':' | ' #';
}
export interface Body extends Parent {
type: 'body';
children: (Text | Newline)[];
}
export interface Footer extends Parent {
type: 'footer';
children: (Token | Separator | Value)[];
}
export interface Token extends Parent {
type: 'token';
children: (Type | Scope | BreakingChange)[];
}
export interface Value extends Parent {
type: 'value';
children: (Text | Continuation)[];
}
export interface Continuation extends Parent {
type: 'continuation';
children: (Newline | Text)[];
}