Skip to content
This repository was archived by the owner on Mar 23, 2024. It is now read-only.

Commit 04b3274

Browse files
committed
Internal: inline visitor-keys temporarily
Fixes #1972
1 parent 1afee41 commit 04b3274

3 files changed

Lines changed: 128 additions & 4 deletions

File tree

lib/tree-iterator.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
var estraverse = require('estraverse');
22
var assign = require('lodash').assign;
3-
var types = require('babel-core').types;
4-
var keys = assign({}, types.VISITOR_KEYS, estraverse.VisitorKeys, {
3+
var VISITOR_KEYS = require('./visitor-keys');
54

6-
// Those are deprecated, need to remove it in the future
5+
var keys = assign({}, VISITOR_KEYS, estraverse.VisitorKeys, {
6+
// These are deprecated, need to remove it in the future
77
XJSIdentifier: [],
88
XJSNamespacedName: ['namespace', 'name'],
99
XJSMemberExpression: ['object', 'property'],

lib/visitor-keys.js

Lines changed: 125 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,125 @@
1+
module.exports = {
2+
AnyTypeAnnotation: [],
3+
ArrayExpression: ['elements'],
4+
ArrayPattern: ['elements', 'typeAnnotation'],
5+
ArrayTypeAnnotation: ['elementType'],
6+
ArrowFunctionExpression: ['params', 'body', 'returnType'],
7+
AssignmentExpression: ['left', 'right'],
8+
AssignmentPattern: ['left', 'right'],
9+
AwaitExpression: ['argument'],
10+
BinaryExpression: ['left', 'right'],
11+
BindExpression: ['object', 'callee'],
12+
BlockStatement: ['body'],
13+
BooleanLiteralTypeAnnotation: [],
14+
BooleanTypeAnnotation: [],
15+
BreakStatement: ['label'],
16+
CallExpression: ['callee', 'arguments'],
17+
CatchClause: ['param', 'body'],
18+
ClassBody: ['body'],
19+
ClassDeclaration: ['id','body', 'superClass', 'typeParameters', 'superTypeParameters', 'implements', 'decorators'],
20+
ClassExpression: ['id', 'body', 'superClass', 'typeParameters', 'superTypeParameters', 'implements', 'decorators'],
21+
ClassImplements: ['id', 'typeParameters'],
22+
ClassProperty: ['key', 'value', 'typeAnnotation', 'decorators'],
23+
ComprehensionBlock: ['left', 'right'],
24+
ComprehensionExpression: ['filter', 'blocks', 'body'],
25+
ConditionalExpression: ['test', 'consequent', 'alternate'],
26+
ContinueStatement: ['label'],
27+
DebuggerStatement: [],
28+
DeclareClass: ['id', 'typeParameters', 'extends', 'body'],
29+
DeclareFunction: ['id'],
30+
DeclareModule: ['id', 'body'],
31+
DeclareVariable: ['id'],
32+
Decorator: ['expression'],
33+
DoExpression: ['body'],
34+
DoWhileStatement: ['body', 'test'],
35+
EmptyStatement: [],
36+
ExportAllDeclaration: ['source', 'exported'],
37+
ExportDefaultDeclaration: ['declaration'],
38+
ExportDefaultSpecifier: ['exported'],
39+
ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],
40+
ExportNamespaceSpecifier: ['exported'],
41+
ExportSpecifier: ['local', 'exported'],
42+
ExpressionStatement: ['expression'],
43+
File: ['program'],
44+
ForInStatement: ['left', 'right', 'body'],
45+
ForOfStatement: ['left', 'right', 'body'],
46+
ForStatement: ['init', 'test', 'update', 'body'],
47+
FunctionDeclaration: ['id', 'params', 'body', 'returnType', 'typeParameters'],
48+
FunctionExpression: ['id', 'params', 'body', 'returnType', 'typeParameters'],
49+
FunctionTypeAnnotation: ['typeParameters', 'params', 'rest', 'returnType'],
50+
FunctionTypeParam: ['name', 'typeAnnotation'],
51+
GenericTypeAnnotation: ['id', 'typeParameters'],
52+
Identifier: ['typeAnnotation'],
53+
IfStatement: ['test', 'consequent', 'alternate'],
54+
ImportDeclaration: ['specifiers', 'source'],
55+
ImportDefaultSpecifier: ['local'],
56+
ImportNamespaceSpecifier: ['local'],
57+
ImportSpecifier: ['local', 'imported'],
58+
InterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'],
59+
InterfaceExtends: ['id', 'typeParameters'],
60+
IntersectionTypeAnnotation: ['types'],
61+
JSXAttribute: ['name', 'value'],
62+
JSXClosingElement: ['name'],
63+
JSXElement: ['openingElement', 'closingElement', 'children'],
64+
JSXEmptyExpression: [],
65+
JSXExpressionContainer: ['expression'],
66+
JSXIdentifier: [],
67+
JSXMemberExpression: ['object', 'property'],
68+
JSXNamespacedName: ['namespace', 'name'],
69+
JSXOpeningElement: ['name', 'attributes'],
70+
JSXSpreadAttribute: ['argument'],
71+
LabeledStatement: ['label', 'body'],
72+
Literal: [],
73+
LogicalExpression: ['left', 'right'],
74+
MemberExpression: ['object', 'property'],
75+
MetaProperty: ['meta', 'property'],
76+
MethodDefinition: ['key', 'value', 'decorators'],
77+
MixedTypeAnnotation: [],
78+
NewExpression: ['callee', 'arguments'],
79+
Noop: [],
80+
NullableTypeAnnotation: ['typeAnnotation'],
81+
NumberLiteralTypeAnnotation: [],
82+
NumberTypeAnnotation: [],
83+
ObjectExpression: ['properties'],
84+
ObjectPattern: ['properties', 'typeAnnotation'],
85+
ObjectTypeAnnotation: ['properties', 'indexers', 'callProperties'],
86+
ObjectTypeCallProperty: ['value'],
87+
ObjectTypeIndexer: ['id', 'key', 'value'],
88+
ObjectTypeProperty: ['key', 'value'],
89+
ParenthesizedExpression: ['expression'],
90+
Program: ['body'],
91+
Property: ['key', 'value', 'decorators'],
92+
QualifiedTypeIdentifier: ['id', 'qualification'],
93+
RestElement: ['argument', 'typeAnnotation'],
94+
ReturnStatement: ['argument'],
95+
SequenceExpression: ['expressions'],
96+
SpreadElement: ['argument'],
97+
SpreadProperty: ['argument'],
98+
StringLiteralTypeAnnotation: [],
99+
StringTypeAnnotation: [],
100+
Super: [],
101+
SwitchCase: ['test', 'consequent'],
102+
SwitchStatement: ['discriminant', 'cases'],
103+
TaggedTemplateExpression: ['tag', 'quasi'],
104+
TemplateElement: [],
105+
TemplateLiteral: ['quasis', 'expressions'],
106+
ThisExpression: [],
107+
ThrowStatement: ['argument'],
108+
TryStatement: ['block', 'handlers', 'handler', 'guardedHandlers', 'finalizer'],
109+
TupleTypeAnnotation: ['types'],
110+
TypeAlias: ['id', 'typeParameters', 'right'],
111+
TypeAnnotation: ['typeAnnotation'],
112+
TypeCastExpression: ['expression', 'typeAnnotation'],
113+
TypeofTypeAnnotation: ['argument'],
114+
TypeParameterDeclaration: ['params'],
115+
TypeParameterInstantiation: ['params'],
116+
UnaryExpression: ['argument'],
117+
UnionTypeAnnotation: ['types'],
118+
UpdateExpression: ['argument'],
119+
VariableDeclaration: ['declarations'],
120+
VariableDeclarator: ['id', 'init'],
121+
VoidTypeAnnotation: [],
122+
WhileStatement: ['test', 'body'],
123+
WithStatement: ['object', 'body'],
124+
YieldExpression: ['argument']
125+
};

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
"node": ">= 0.10.0"
6161
},
6262
"dependencies": {
63-
"babel-core": "^5.6.15",
6463
"babel-jscs": "^2.0.0",
6564
"chalk": "~1.1.0",
6665
"cli-table": "~0.3.1",

0 commit comments

Comments
 (0)