-
Notifications
You must be signed in to change notification settings - Fork 0
/
type.ts
53 lines (45 loc) · 945 Bytes
/
type.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
import { acorn, periscopic } from "./deps.ts";
export type Fragment = Element | Text | Expression | Script
export type Element = {
type: string,
name: string,
attributes: Attribute[],
children: Fragment[],
value: any,
expression: any
}
export type Attribute = {
type: 'Attribute',
name: string,
value: any
}
export type Text = {
type: 'Text',
content: string
}
export type Expression = {
type: 'Expression',
content: string,
name: string,
expression: any
}
export type Script = {
type: 'Script',
ast: AST
}
export type AST = {
html: Fragment[]
script: acorn.Node
}
export type Token<T> = {
variables: Set<T>,
willChange: Set<T>,
willUseInTemplate: Set<T>,
};
export interface AnalysisResult {
variables: Set<string>;
willChange: Set<string>;
willUseInTemplate: Set<string>;
rootScope: periscopic.Scope;
map: WeakMap<any, any>;
}