UNPKG

11.8 kBTypeScriptView Raw
1/**
2 * @license
3 * Copyright (c) 2017 The Polymer Project Authors. All rights reserved.
4 * This code may only be used under the BSD style license found at
5 * http://polymer.github.io/LICENSE.txt
6 * The complete set of authors may be found at
7 * http://polymer.github.io/AUTHORS.txt
8 * The complete set of contributors may be found at
9 * http://polymer.github.io/CONTRIBUTORS.txt
10 * Code distributed by Google as part of the polymer project is also
11 * subject to an additional IP rights grant found at
12 * http://polymer.github.io/PATENTS.txt
13 */
14import { NodePath } from '@babel/traverse';
15import * as babel from '@babel/types';
16import { VisitorOption } from './estraverse-shim';
17export declare type VisitResult = VisitorOption | null | undefined | void;
18export declare type VisitorCallback<N extends babel.Node> = (node: N, parent: babel.Node | undefined | null, path: NodePath<N>) => VisitResult;
19export interface Visitor {
20 readonly enter?: VisitorCallback<babel.Node>;
21 readonly leave?: VisitorCallback<babel.Node>;
22 readonly enterIdentifier?: VisitorCallback<babel.Identifier>;
23 readonly leaveIdentifier?: VisitorCallback<babel.Identifier>;
24 readonly enterLiteral?: VisitorCallback<babel.Literal>;
25 readonly leaveLiteral?: VisitorCallback<babel.Literal>;
26 readonly enterProgram?: VisitorCallback<babel.Program>;
27 readonly leaveProgram?: VisitorCallback<babel.Program>;
28 readonly enterExpressionStatement?: VisitorCallback<babel.ExpressionStatement>;
29 readonly leaveExpressionStatement?: VisitorCallback<babel.ExpressionStatement>;
30 readonly enterBlockStatement?: VisitorCallback<babel.BlockStatement>;
31 readonly leaveBlockStatement?: VisitorCallback<babel.BlockStatement>;
32 readonly enterEmptyStatement?: VisitorCallback<babel.EmptyStatement>;
33 readonly leaveEmptyStatement?: VisitorCallback<babel.EmptyStatement>;
34 readonly enterDebuggerStatement?: VisitorCallback<babel.DebuggerStatement>;
35 readonly leaveDebuggerStatement?: VisitorCallback<babel.DebuggerStatement>;
36 readonly enterWithStatement?: VisitorCallback<babel.WithStatement>;
37 readonly leaveWithStatement?: VisitorCallback<babel.WithStatement>;
38 readonly enterReturnStatement?: VisitorCallback<babel.ReturnStatement>;
39 readonly leaveReturnStatement?: VisitorCallback<babel.ReturnStatement>;
40 readonly enterLabeledStatement?: VisitorCallback<babel.LabeledStatement>;
41 readonly leaveLabeledStatement?: VisitorCallback<babel.LabeledStatement>;
42 readonly enterBreakStatement?: VisitorCallback<babel.BreakStatement>;
43 readonly leaveBreakStatement?: VisitorCallback<babel.BreakStatement>;
44 readonly enterContinueStatement?: VisitorCallback<babel.ContinueStatement>;
45 readonly leaveContinueStatement?: VisitorCallback<babel.ContinueStatement>;
46 readonly enterIfStatement?: VisitorCallback<babel.IfStatement>;
47 readonly leaveIfStatement?: VisitorCallback<babel.IfStatement>;
48 readonly enterSwitchStatement?: VisitorCallback<babel.SwitchStatement>;
49 readonly leaveSwitchStatement?: VisitorCallback<babel.SwitchStatement>;
50 readonly enterSwitchCase?: VisitorCallback<babel.SwitchCase>;
51 readonly leaveSwitchCase?: VisitorCallback<babel.SwitchCase>;
52 readonly enterThrowStatement?: VisitorCallback<babel.ThrowStatement>;
53 readonly leaveThrowStatement?: VisitorCallback<babel.ThrowStatement>;
54 readonly enterTryStatement?: VisitorCallback<babel.TryStatement>;
55 readonly leaveTryStatement?: VisitorCallback<babel.TryStatement>;
56 readonly enterCatchClause?: VisitorCallback<babel.CatchClause>;
57 readonly leaveCatchClause?: VisitorCallback<babel.CatchClause>;
58 readonly enterWhileStatement?: VisitorCallback<babel.WhileStatement>;
59 readonly leaveWhileStatement?: VisitorCallback<babel.WhileStatement>;
60 readonly enterDoWhileStatement?: VisitorCallback<babel.DoWhileStatement>;
61 readonly leaveDoWhileStatement?: VisitorCallback<babel.DoWhileStatement>;
62 readonly enterForStatement?: VisitorCallback<babel.ForStatement>;
63 readonly leaveForStatement?: VisitorCallback<babel.ForStatement>;
64 readonly enterForInStatement?: VisitorCallback<babel.ForInStatement>;
65 readonly leaveForInStatement?: VisitorCallback<babel.ForInStatement>;
66 readonly enterForOfStatement?: VisitorCallback<babel.ForOfStatement>;
67 readonly leaveForOfStatement?: VisitorCallback<babel.ForOfStatement>;
68 readonly enterFunctionDeclaration?: VisitorCallback<babel.FunctionDeclaration>;
69 readonly leaveFunctionDeclaration?: VisitorCallback<babel.FunctionDeclaration>;
70 readonly enterVariableDeclaration?: VisitorCallback<babel.VariableDeclaration>;
71 readonly leaveVariableDeclaration?: VisitorCallback<babel.VariableDeclaration>;
72 readonly enterVariableDeclarator?: VisitorCallback<babel.VariableDeclarator>;
73 readonly leaveVariableDeclarator?: VisitorCallback<babel.VariableDeclarator>;
74 readonly enterThisExpression?: VisitorCallback<babel.ThisExpression>;
75 readonly leaveThisExpression?: VisitorCallback<babel.ThisExpression>;
76 readonly enterArrayExpression?: VisitorCallback<babel.ArrayExpression>;
77 readonly leaveArrayExpression?: VisitorCallback<babel.ArrayExpression>;
78 readonly enterObjectExpression?: VisitorCallback<babel.ObjectExpression>;
79 readonly leaveObjectExpression?: VisitorCallback<babel.ObjectExpression>;
80 readonly enterProperty?: VisitorCallback<babel.Property>;
81 readonly leaveProperty?: VisitorCallback<babel.Property>;
82 readonly enterFunctionExpression?: VisitorCallback<babel.FunctionExpression>;
83 readonly leaveFunctionExpression?: VisitorCallback<babel.FunctionExpression>;
84 readonly enterArrowFunctionExpression?: VisitorCallback<babel.ArrowFunctionExpression>;
85 readonly leaveArrowFunctionExpression?: VisitorCallback<babel.ArrowFunctionExpression>;
86 readonly enterYieldExpression?: VisitorCallback<babel.YieldExpression>;
87 readonly leaveYieldExpression?: VisitorCallback<babel.YieldExpression>;
88 readonly enterSuper?: VisitorCallback<babel.Super>;
89 readonly leaveSuper?: VisitorCallback<babel.Super>;
90 readonly enterUnaryExpression?: VisitorCallback<babel.UnaryExpression>;
91 readonly leaveUnaryExpression?: VisitorCallback<babel.UnaryExpression>;
92 readonly enterUpdateExpression?: VisitorCallback<babel.UpdateExpression>;
93 readonly leaveUpdateExpression?: VisitorCallback<babel.UpdateExpression>;
94 readonly enterBinaryExpression?: VisitorCallback<babel.BinaryExpression>;
95 readonly leaveBinaryExpression?: VisitorCallback<babel.BinaryExpression>;
96 readonly enterAssignmentExpression?: VisitorCallback<babel.AssignmentExpression>;
97 readonly leaveAssignmentExpression?: VisitorCallback<babel.AssignmentExpression>;
98 readonly enterLogicalExpression?: VisitorCallback<babel.LogicalExpression>;
99 readonly leaveLogicalExpression?: VisitorCallback<babel.LogicalExpression>;
100 readonly enterMemberExpression?: VisitorCallback<babel.MemberExpression>;
101 readonly leaveMemberExpression?: VisitorCallback<babel.MemberExpression>;
102 readonly enterConditionalExpression?: VisitorCallback<babel.ConditionalExpression>;
103 readonly leaveConditionalExpression?: VisitorCallback<babel.ConditionalExpression>;
104 readonly enterCallExpression?: VisitorCallback<babel.CallExpression>;
105 readonly leaveCallExpression?: VisitorCallback<babel.CallExpression>;
106 readonly enterNewExpression?: VisitorCallback<babel.NewExpression>;
107 readonly leaveNewExpression?: VisitorCallback<babel.NewExpression>;
108 readonly enterSequenceExpression?: VisitorCallback<babel.SequenceExpression>;
109 readonly leaveSequenceExpression?: VisitorCallback<babel.SequenceExpression>;
110 readonly enterTemplateLiteral?: VisitorCallback<babel.TemplateLiteral>;
111 readonly leaveTemplateLiteral?: VisitorCallback<babel.TemplateLiteral>;
112 readonly enterTaggedTemplateExpression?: VisitorCallback<babel.TaggedTemplateExpression>;
113 readonly leaveTaggedTemplateExpression?: VisitorCallback<babel.TaggedTemplateExpression>;
114 readonly enterTemplateElement?: VisitorCallback<babel.TemplateElement>;
115 readonly leaveTemplateElement?: VisitorCallback<babel.TemplateElement>;
116 readonly enterSpreadElement?: VisitorCallback<babel.SpreadElement>;
117 readonly leaveSpreadElement?: VisitorCallback<babel.SpreadElement>;
118 readonly enterPattern?: VisitorCallback<babel.Pattern>;
119 readonly leavePattern?: VisitorCallback<babel.Pattern>;
120 readonly enterAssignmentProperty?: VisitorCallback<babel.AssignmentProperty>;
121 readonly leaveAssignmentProperty?: VisitorCallback<babel.AssignmentProperty>;
122 readonly enterObjectPattern?: VisitorCallback<babel.ObjectPattern>;
123 readonly leaveObjectPattern?: VisitorCallback<babel.ObjectPattern>;
124 readonly enterObjectMethod?: VisitorCallback<babel.ObjectMethod>;
125 readonly leaveObjectMethod?: VisitorCallback<babel.ObjectMethod>;
126 readonly enterObjectProperty?: VisitorCallback<babel.ObjectProperty>;
127 readonly leaveObjectProperty?: VisitorCallback<babel.ObjectProperty>;
128 readonly enterArrayPattern?: VisitorCallback<babel.ArrayPattern>;
129 readonly leaveArrayPattern?: VisitorCallback<babel.ArrayPattern>;
130 readonly enterRestElement?: VisitorCallback<babel.RestElement>;
131 readonly leaveRestElement?: VisitorCallback<babel.RestElement>;
132 readonly enterAssignmentPattern?: VisitorCallback<babel.AssignmentPattern>;
133 readonly leaveAssignmentPattern?: VisitorCallback<babel.AssignmentPattern>;
134 readonly enterMethod?: VisitorCallback<babel.Method>;
135 readonly leaveMethod?: VisitorCallback<babel.Method>;
136 readonly enterClassMethod?: VisitorCallback<babel.ClassMethod>;
137 readonly leaveClassMethod?: VisitorCallback<babel.ClassMethod>;
138 readonly enterClassDeclaration?: VisitorCallback<babel.ClassDeclaration>;
139 readonly leaveClassDeclaration?: VisitorCallback<babel.ClassDeclaration>;
140 readonly enterClassExpression?: VisitorCallback<babel.ClassExpression>;
141 readonly leaveClassExpression?: VisitorCallback<babel.ClassExpression>;
142 readonly enterMetaProperty?: VisitorCallback<babel.MetaProperty>;
143 readonly leaveMetaProperty?: VisitorCallback<babel.MetaProperty>;
144 readonly enterModuleDeclaration?: VisitorCallback<babel.ModuleDeclaration>;
145 readonly leaveModuleDeclaration?: VisitorCallback<babel.ModuleDeclaration>;
146 readonly enterModuleSpecifier?: VisitorCallback<babel.ModuleSpecifier>;
147 readonly leaveModuleSpecifier?: VisitorCallback<babel.ModuleSpecifier>;
148 readonly enterImportDeclaration?: VisitorCallback<babel.ImportDeclaration>;
149 readonly leaveImportDeclaration?: VisitorCallback<babel.ImportDeclaration>;
150 readonly enterImportSpecifier?: VisitorCallback<babel.ImportSpecifier>;
151 readonly leaveImportSpecifier?: VisitorCallback<babel.ImportSpecifier>;
152 readonly enterImportDefaultSpecifier?: VisitorCallback<babel.ImportDefaultSpecifier>;
153 readonly leaveImportDefaultSpecifier?: VisitorCallback<babel.ImportDefaultSpecifier>;
154 readonly enterImportNamespaceSpecifier?: VisitorCallback<babel.ImportNamespaceSpecifier>;
155 readonly leaveImportNamespaceSpecifier?: VisitorCallback<babel.ImportNamespaceSpecifier>;
156 readonly enterExportNamedDeclaration?: VisitorCallback<babel.ExportNamedDeclaration>;
157 readonly leaveExportNamedDeclaration?: VisitorCallback<babel.ExportNamedDeclaration>;
158 readonly enterExportSpecifier?: VisitorCallback<babel.ExportSpecifier>;
159 readonly leaveExportSpecifier?: VisitorCallback<babel.ExportSpecifier>;
160 readonly enterExportDefaultDeclaration?: VisitorCallback<babel.ExportDefaultDeclaration>;
161 readonly leaveExportDefaultDeclaration?: VisitorCallback<babel.ExportDefaultDeclaration>;
162 readonly enterExportAllDeclaration?: VisitorCallback<babel.ExportAllDeclaration>;
163 readonly leaveExportAllDeclaration?: VisitorCallback<babel.ExportAllDeclaration>;
164}