UNPKG

5.07 kBJavaScriptView Raw
1const KEYS = {
2 AssignmentExpression: [
3 "left",
4 "right"
5 ],
6 AssignmentPattern: [
7 "left",
8 "right"
9 ],
10 ArrayExpression: [
11 "elements"
12 ],
13 ArrayPattern: [
14 "elements"
15 ],
16 ArrowFunctionExpression: [
17 "params",
18 "body"
19 ],
20 AwaitExpression: [
21 "argument"
22 ],
23 BlockStatement: [
24 "body"
25 ],
26 BinaryExpression: [
27 "left",
28 "right"
29 ],
30 BreakStatement: [
31 "label"
32 ],
33 CallExpression: [
34 "callee",
35 "arguments"
36 ],
37 CatchClause: [
38 "param",
39 "body"
40 ],
41 ChainExpression: [
42 "expression"
43 ],
44 ClassBody: [
45 "body"
46 ],
47 ClassDeclaration: [
48 "id",
49 "superClass",
50 "body"
51 ],
52 ClassExpression: [
53 "id",
54 "superClass",
55 "body"
56 ],
57 ConditionalExpression: [
58 "test",
59 "consequent",
60 "alternate"
61 ],
62 ContinueStatement: [
63 "label"
64 ],
65 DebuggerStatement: [],
66 DoWhileStatement: [
67 "body",
68 "test"
69 ],
70 EmptyStatement: [],
71 ExportAllDeclaration: [
72 "exported",
73 "source"
74 ],
75 ExportDefaultDeclaration: [
76 "declaration"
77 ],
78 ExportNamedDeclaration: [
79 "declaration",
80 "specifiers",
81 "source"
82 ],
83 ExportSpecifier: [
84 "exported",
85 "local"
86 ],
87 ExpressionStatement: [
88 "expression"
89 ],
90 ExperimentalRestProperty: [
91 "argument"
92 ],
93 ExperimentalSpreadProperty: [
94 "argument"
95 ],
96 ForStatement: [
97 "init",
98 "test",
99 "update",
100 "body"
101 ],
102 ForInStatement: [
103 "left",
104 "right",
105 "body"
106 ],
107 ForOfStatement: [
108 "left",
109 "right",
110 "body"
111 ],
112 FunctionDeclaration: [
113 "id",
114 "params",
115 "body"
116 ],
117 FunctionExpression: [
118 "id",
119 "params",
120 "body"
121 ],
122 Identifier: [],
123 IfStatement: [
124 "test",
125 "consequent",
126 "alternate"
127 ],
128 ImportDeclaration: [
129 "specifiers",
130 "source"
131 ],
132 ImportDefaultSpecifier: [
133 "local"
134 ],
135 ImportExpression: [
136 "source"
137 ],
138 ImportNamespaceSpecifier: [
139 "local"
140 ],
141 ImportSpecifier: [
142 "imported",
143 "local"
144 ],
145 JSXAttribute: [
146 "name",
147 "value"
148 ],
149 JSXClosingElement: [
150 "name"
151 ],
152 JSXElement: [
153 "openingElement",
154 "children",
155 "closingElement"
156 ],
157 JSXEmptyExpression: [],
158 JSXExpressionContainer: [
159 "expression"
160 ],
161 JSXIdentifier: [],
162 JSXMemberExpression: [
163 "object",
164 "property"
165 ],
166 JSXNamespacedName: [
167 "namespace",
168 "name"
169 ],
170 JSXOpeningElement: [
171 "name",
172 "attributes"
173 ],
174 JSXSpreadAttribute: [
175 "argument"
176 ],
177 JSXText: [],
178 JSXFragment: [
179 "openingFragment",
180 "children",
181 "closingFragment"
182 ],
183 Literal: [],
184 LabeledStatement: [
185 "label",
186 "body"
187 ],
188 LogicalExpression: [
189 "left",
190 "right"
191 ],
192 MemberExpression: [
193 "object",
194 "property"
195 ],
196 MetaProperty: [
197 "meta",
198 "property"
199 ],
200 MethodDefinition: [
201 "key",
202 "value"
203 ],
204 NewExpression: [
205 "callee",
206 "arguments"
207 ],
208 ObjectExpression: [
209 "properties"
210 ],
211 ObjectPattern: [
212 "properties"
213 ],
214 PrivateIdentifier: [],
215 Program: [
216 "body"
217 ],
218 Property: [
219 "key",
220 "value"
221 ],
222 PropertyDefinition: [
223 "key",
224 "value"
225 ],
226 RestElement: [
227 "argument"
228 ],
229 ReturnStatement: [
230 "argument"
231 ],
232 SequenceExpression: [
233 "expressions"
234 ],
235 SpreadElement: [
236 "argument"
237 ],
238 StaticBlock: [
239 "body"
240 ],
241 Super: [],
242 SwitchStatement: [
243 "discriminant",
244 "cases"
245 ],
246 SwitchCase: [
247 "test",
248 "consequent"
249 ],
250 TaggedTemplateExpression: [
251 "tag",
252 "quasi"
253 ],
254 TemplateElement: [],
255 TemplateLiteral: [
256 "quasis",
257 "expressions"
258 ],
259 ThisExpression: [],
260 ThrowStatement: [
261 "argument"
262 ],
263 TryStatement: [
264 "block",
265 "handler",
266 "finalizer"
267 ],
268 UnaryExpression: [
269 "argument"
270 ],
271 UpdateExpression: [
272 "argument"
273 ],
274 VariableDeclaration: [
275 "declarations"
276 ],
277 VariableDeclarator: [
278 "id",
279 "init"
280 ],
281 WhileStatement: [
282 "test",
283 "body"
284 ],
285 WithStatement: [
286 "object",
287 "body"
288 ],
289 YieldExpression: [
290 "argument"
291 ]
292};
293
294// Types.
295const NODE_TYPES = Object.keys(KEYS);
296
297// Freeze the keys.
298for (const type of NODE_TYPES) {
299 Object.freeze(KEYS[type]);
300}
301Object.freeze(KEYS);
302
303export default KEYS;