-
-
Notifications
You must be signed in to change notification settings - Fork 413
/
types.ts
49 lines (43 loc) 路 1.14 KB
/
types.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
import type { types as t } from '@babel/core'
import type { TemplateBuilder } from '@babel/template'
export interface TemplateVariables {
componentName: t.Identifier
interfaces: t.TSInterfaceDeclaration[]
props: (t.ObjectPattern | t.Identifier)[]
imports: t.ImportDeclaration[]
exports: (t.VariableDeclaration | t.ExportDeclaration)[]
jsx: t.JSXElement
}
interface TemplateContext {
options: Options
tpl: TemplateBuilder<t.Statement | t.Statement[]>['ast']
}
export interface Template {
(variables: TemplateVariables, context: TemplateContext):
| t.Statement
| t.Statement[]
}
interface State {
componentName: string
caller?: { previousExport?: string | null }
}
export interface JSXRuntimeImport {
source: string
namespace?: string
specifiers?: string[]
}
export interface Options {
typescript?: boolean
titleProp?: boolean
expandProps?: boolean | 'start' | 'end'
ref?: boolean
template?: Template
state: State
native?: boolean
memo?: boolean
exportType?: 'named' | 'default'
namedExport?: string
jsxRuntime?: 'automatic' | 'classic'
jsxRuntimeImport?: JSXRuntimeImport
importSource?: string
}