-
Notifications
You must be signed in to change notification settings - Fork 1
/
babel-packages.js.flow
214 lines (189 loc) · 5.69 KB
/
babel-packages.js.flow
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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
declare module "@babel/template" {
declare type PublicOpts = {
placeholderWhitelist?: ?Set<string>,
placeholderPattern?: ?(RegExp | false),
preserveComments?: ?boolean,
syntacticPlaceholders?: ?boolean,
};
declare type PublicReplacements = { [string]: mixed } | Array<mixed>;
declare type TemplateBuilder<T> = {
ast: {
(tpl: string, opts: ?PublicOpts): T,
(tpl: Array<string>, ...args: Array<mixed>): T,
},
(opts: PublicOpts): TemplateBuilder<T>,
(tpl: string, opts: ?PublicOpts): (?PublicReplacements) => T,
(tpl: Array<string>, ...args: Array<mixed>): (?PublicReplacements) => T,
};
declare type Smart = TemplateBuilder<
Array<BabelNodeStatement> | BabelNodeStatement
>;
declare type Statement = TemplateBuilder<BabelNodeStatement>;
declare type Statements = TemplateBuilder<Array<BabelNodeStatement>>;
declare type Expression = TemplateBuilder<BabelNodeExpression>;
declare type Program = TemplateBuilder<BabelNodeProgram>;
declare export default Smart & {
smart: Smart,
statement: Statement,
statements: Statements,
expression: Expression,
program: Program,
};
}
declare module "@babel/helper-optimise-call-expression" {
declare export default function optimiseCallExpression(
callee: BabelNodeExpression,
thisNode: BabelNodeExpression,
args: $Readonly<Array<BabelNodeExpression | BabelNodeSpreadElement>>,
optional: boolean
): BabelNodeCallExpression | BabelNodeOptionalCallExpression;
}
declare module "@babel/helper-get-function-arity" {
declare export default function helperGetFunctionArity(
node: BabelNodeFunction
): number;
}
declare module "@babel/helper-annotate-as-pure" {
declare export default function annotateAsPure(
pathOrNode:
| BabelNode
| {
node: BabelNode,
}
): void;
}
declare module "@babel/code-frame" {
declare type Location = {
column: number,
line: number,
};
declare type NodeLocation = {
end?: Location,
start: Location,
};
declare export interface Options {
/**
* Syntax highlight the code as JavaScript for terminals. default: false
*/
highlightCode?: boolean;
/**
* The number of lines to show above the error. default: 2
*/
linesAbove?: number;
/**
* The number of lines to show below the error. default: 3
*/
linesBelow?: number;
/**
* Forcibly syntax highlight the code as JavaScript (for non-terminals);
* overrides highlightCode.
* default: false
*/
forceColor?: boolean;
/**
* Pass in a string to be displayed inline (if possible) next to the
* highlighted location in the code. If it can't be positioned inline,
* it will be placed above the code frame.
* default: nothing
*/
message?: string;
}
declare export function codeFrameColumns(
rawLines: string,
loc: NodeLocation,
opts?: Options
): string;
/**
* Create a code frame, adding line numbers, code highlighting, and pointing to a given position.
*/
declare export default function codeFrame(
rawLines: string,
lineNumber: number,
colNumber?: number | null,
opts?: Options
): string;
}
declare module "@babel/helper-validator-identifier" {
declare function isReservedWord(word: string, inModule: boolean): boolean;
declare function isStrictReservedWord(
word: string,
inModule: boolean
): boolean;
declare function isStrictBindOnlyReservedWord(word: string): boolean;
declare function isStrictBindReservedWord(
word: string,
inModule: boolean
): boolean;
declare function isKeyword(word: string): boolean;
declare function isIdentifierStart(code: number): boolean;
declare function isIdentifierChar(code: number): boolean;
declare function isIdentifierName(name: string): boolean;
}
declare module "@babel/helper-validator-option" {
declare class OptionValidator {
descriptor: string;
constructor(descriptor: string): OptionValidator;
validateTopLevelOptions(options: Object, TopLevelOptionShape: Object): void;
validateBooleanOption<T>(
name: string,
value?: boolean,
defaultValue?: T
): boolean | T;
validateStringOption<T>(
name: string,
value?: string,
defaultValue?: T
): string | T;
invariant(condition: boolean, message: string): void;
formatMessage(message: string): string;
}
declare function findSuggestion(
str: string,
arr: $ReadonlyArray<string>
): string;
}
declare module "@babel/helper-function-name" {
declare export default function helperFunctionNamefunction(
options: any,
localBinding?: boolean
): any;
}
declare module "@babel/helper-split-export-declaration" {
declare export default function splitExportDeclaration(
exportDeclaration: any
): any;
}
declare module "@babel/traverse" {
declare module.exports: any;
}
declare module "@babel/generator" {
declare module.exports: any;
}
declare module "@babel/highlight" {
import typeof { Chalk } from "chalk";
declare type Options = {
forceColor?: boolean,
};
/**
* Whether the code should be highlighted given the passed options.
*/
declare function shouldHighlight(options: Options): boolean;
/**
* The Chalk instance that should be used given the passed options.
*/
declare function getChalk(options: Options): Chalk;
/**
* Highlight `code`.
*/
declare export default function highlight(
code: string,
options?: Options
): string;
declare export { getChalk, shouldHighlight };
}
declare module "@babel/plugin-bugfix-v8-spread-parameters-in-optional-chaining" {
declare module.exports: any;
}
declare module "@babel/helper-module-transforms" {
declare module.exports: any;
}