ast-types 0.12.0 → 0.12.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -86,29 +86,6 @@ export interface NamedTypes {
86
86
  SpreadProperty: Type<N.SpreadProperty>;
87
87
  SpreadPropertyPattern: Type<N.SpreadPropertyPattern>;
88
88
  AwaitExpression: Type<N.AwaitExpression>;
89
- LetStatement: Type<N.LetStatement>;
90
- LetExpression: Type<N.LetExpression>;
91
- GraphExpression: Type<N.GraphExpression>;
92
- GraphIndexExpression: Type<N.GraphIndexExpression>;
93
- XMLDefaultDeclaration: Type<N.XMLDefaultDeclaration>;
94
- XMLAnyName: Type<N.XMLAnyName>;
95
- XMLQualifiedIdentifier: Type<N.XMLQualifiedIdentifier>;
96
- XMLFunctionQualifiedIdentifier: Type<N.XMLFunctionQualifiedIdentifier>;
97
- XMLAttributeSelector: Type<N.XMLAttributeSelector>;
98
- XMLFilterExpression: Type<N.XMLFilterExpression>;
99
- XML: Type<N.XML>;
100
- XMLElement: Type<N.XMLElement>;
101
- XMLList: Type<N.XMLList>;
102
- XMLEscape: Type<N.XMLEscape>;
103
- XMLText: Type<N.XMLText>;
104
- XMLStartTag: Type<N.XMLStartTag>;
105
- XMLEndTag: Type<N.XMLEndTag>;
106
- XMLPointTag: Type<N.XMLPointTag>;
107
- XMLName: Type<N.XMLName>;
108
- XMLAttribute: Type<N.XMLAttribute>;
109
- XMLCdata: Type<N.XMLCdata>;
110
- XMLComment: Type<N.XMLComment>;
111
- XMLProcessingInstruction: Type<N.XMLProcessingInstruction>;
112
89
  JSXAttribute: Type<N.JSXAttribute>;
113
90
  JSXIdentifier: Type<N.JSXIdentifier>;
114
91
  JSXNamespacedName: Type<N.JSXNamespacedName>;
@@ -130,6 +107,7 @@ export interface NamedTypes {
130
107
  TSTypeParameterInstantiation: Type<N.TSTypeParameterInstantiation>;
131
108
  ClassImplements: Type<N.ClassImplements>;
132
109
  TSType: Type<N.TSType>;
110
+ TSHasOptionalTypeParameterInstantiation: Type<N.TSHasOptionalTypeParameterInstantiation>;
133
111
  TSExpressionWithTypeArguments: Type<N.TSExpressionWithTypeArguments>;
134
112
  Flow: Type<N.Flow>;
135
113
  FlowType: Type<N.FlowType>;
@@ -230,6 +208,7 @@ export interface NamedTypes {
230
208
  TSAsExpression: Type<N.TSAsExpression>;
231
209
  TSNonNullExpression: Type<N.TSNonNullExpression>;
232
210
  TSAnyKeyword: Type<N.TSAnyKeyword>;
211
+ TSBigIntKeyword: Type<N.TSBigIntKeyword>;
233
212
  TSBooleanKeyword: Type<N.TSBooleanKeyword>;
234
213
  TSNeverKeyword: Type<N.TSNeverKeyword>;
235
214
  TSNullKeyword: Type<N.TSNullKeyword>;
@@ -267,6 +246,7 @@ export interface NamedTypes {
267
246
  TSConstructSignatureDeclaration: Type<N.TSConstructSignatureDeclaration>;
268
247
  TSEnumMember: Type<N.TSEnumMember>;
269
248
  TSTypeQuery: Type<N.TSTypeQuery>;
249
+ TSImportType: Type<N.TSImportType>;
270
250
  TSTypeLiteral: Type<N.TSTypeLiteral>;
271
251
  TSTypeAssertion: Type<N.TSTypeAssertion>;
272
252
  TSEnumDeclaration: Type<N.TSEnumDeclaration>;
package/gen/nodes.d.ts CHANGED
@@ -37,7 +37,7 @@ export interface Statement extends Node {
37
37
  export interface Function extends Node {
38
38
  id: K.IdentifierKind | null;
39
39
  params: K.PatternKind[];
40
- body: K.BlockStatementKind | K.ExpressionKind;
40
+ body: K.BlockStatementKind;
41
41
  generator: boolean;
42
42
  async: boolean;
43
43
  expression: boolean;
@@ -154,7 +154,6 @@ export interface ForInStatement extends Omit<Statement, "type"> {
154
154
  left: K.VariableDeclarationKind | K.ExpressionKind;
155
155
  right: K.ExpressionKind;
156
156
  body: K.StatementKind;
157
- each: boolean;
158
157
  }
159
158
  export interface DebuggerStatement extends Omit<Statement, "type"> {
160
159
  type: "DebuggerStatement";
@@ -212,7 +211,7 @@ export interface UnaryExpression extends Omit<Expression, "type"> {
212
211
  }
213
212
  export interface BinaryExpression extends Omit<Expression, "type"> {
214
213
  type: "BinaryExpression";
215
- operator: "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "&" | "|" | "^" | "in" | "instanceof" | "..";
214
+ operator: "==" | "!=" | "===" | "!==" | "<" | "<=" | ">" | ">=" | "<<" | ">>" | ">>>" | "+" | "-" | "*" | "/" | "%" | "**" | "&" | "|" | "^" | "in" | "instanceof";
216
215
  left: K.ExpressionKind;
217
216
  right: K.ExpressionKind;
218
217
  }
@@ -362,6 +361,7 @@ export interface ClassProperty extends Omit<Declaration, "type"> {
362
361
  static: boolean;
363
362
  typeAnnotation: K.TypeAnnotationKind | K.TSTypeAnnotationKind | null;
364
363
  variance: K.VarianceKind | "plus" | "minus" | null;
364
+ access: "public" | "private" | "protected" | undefined;
365
365
  }
366
366
  export interface ClassBody extends Omit<Declaration, "type"> {
367
367
  type: "ClassBody";
@@ -439,85 +439,6 @@ export interface AwaitExpression extends Omit<Expression, "type"> {
439
439
  argument: K.ExpressionKind | null;
440
440
  all: boolean;
441
441
  }
442
- export interface LetStatement extends Omit<Statement, "type"> {
443
- type: "LetStatement";
444
- head: K.VariableDeclaratorKind[];
445
- body: K.StatementKind;
446
- }
447
- export interface LetExpression extends Omit<Expression, "type"> {
448
- type: "LetExpression";
449
- head: K.VariableDeclaratorKind[];
450
- body: K.ExpressionKind;
451
- }
452
- export interface GraphExpression extends Omit<Expression, "type"> {
453
- type: "GraphExpression";
454
- index: number;
455
- expression: K.LiteralKind;
456
- }
457
- export interface GraphIndexExpression extends Omit<Expression, "type"> {
458
- type: "GraphIndexExpression";
459
- index: number;
460
- }
461
- export interface XMLDefaultDeclaration extends Declaration {
462
- namespace: K.ExpressionKind;
463
- }
464
- export interface XMLAnyName extends Expression {
465
- }
466
- export interface XMLQualifiedIdentifier extends Expression {
467
- left: K.IdentifierKind | K.XMLAnyNameKind;
468
- right: K.IdentifierKind | K.ExpressionKind;
469
- computed: boolean;
470
- }
471
- export interface XMLFunctionQualifiedIdentifier extends Expression {
472
- right: K.IdentifierKind | K.ExpressionKind;
473
- computed: boolean;
474
- }
475
- export interface XMLAttributeSelector extends Expression {
476
- attribute: K.ExpressionKind;
477
- }
478
- export interface XMLFilterExpression extends Expression {
479
- left: K.ExpressionKind;
480
- right: K.ExpressionKind;
481
- }
482
- export interface XML extends Node {
483
- }
484
- export interface XMLElement extends XML, Expression {
485
- contents: K.XMLKind[];
486
- }
487
- export interface XMLList extends XML, Expression {
488
- contents: K.XMLKind[];
489
- }
490
- export interface XMLEscape extends XML {
491
- expression: K.ExpressionKind;
492
- }
493
- export interface XMLText extends XML {
494
- text: string;
495
- }
496
- export interface XMLStartTag extends XML {
497
- contents: K.XMLKind[];
498
- }
499
- export interface XMLEndTag extends XML {
500
- contents: K.XMLKind[];
501
- }
502
- export interface XMLPointTag extends XML {
503
- contents: K.XMLKind[];
504
- }
505
- export interface XMLName extends XML {
506
- contents: string | K.XMLKind[];
507
- }
508
- export interface XMLAttribute extends XML {
509
- value: string;
510
- }
511
- export interface XMLCdata extends XML {
512
- contents: string;
513
- }
514
- export interface XMLComment extends XML {
515
- contents: string;
516
- }
517
- export interface XMLProcessingInstruction extends XML {
518
- target: string;
519
- contents: string | null;
520
- }
521
442
  export interface JSXAttribute extends Omit<Node, "type"> {
522
443
  type: "JSXAttribute";
523
444
  name: K.JSXIdentifierKind | K.JSXNamespacedNameKind;
@@ -612,10 +533,12 @@ export interface ClassImplements extends Omit<Node, "type"> {
612
533
  }
613
534
  export interface TSType extends Node {
614
535
  }
615
- export interface TSExpressionWithTypeArguments extends Omit<TSType, "type"> {
536
+ export interface TSHasOptionalTypeParameterInstantiation {
537
+ typeParameters: K.TSTypeParameterInstantiationKind | null;
538
+ }
539
+ export interface TSExpressionWithTypeArguments extends Omit<TSType, "type">, TSHasOptionalTypeParameterInstantiation {
616
540
  type: "TSExpressionWithTypeArguments";
617
541
  expression: K.IdentifierKind | K.TSQualifiedNameKind;
618
- typeParameters: K.TSTypeParameterInstantiationKind | null;
619
542
  }
620
543
  export interface Flow extends Node {
621
544
  }
@@ -703,6 +626,7 @@ export interface ObjectTypeAnnotation extends Omit<FlowType, "type"> {
703
626
  properties: (K.ObjectTypePropertyKind | K.ObjectTypeSpreadPropertyKind)[];
704
627
  indexers: K.ObjectTypeIndexerKind[];
705
628
  callProperties: K.ObjectTypeCallPropertyKind[];
629
+ inexact: boolean | undefined;
706
630
  exact: boolean;
707
631
  internalSlots: K.ObjectTypeInternalSlotKind[];
708
632
  }
@@ -804,8 +728,8 @@ export interface OpaqueType extends Omit<Declaration, "type"> {
804
728
  type: "OpaqueType";
805
729
  id: K.IdentifierKind;
806
730
  typeParameters: K.TypeParameterDeclarationKind | null;
807
- implType: K.FlowTypeKind;
808
- superType: K.FlowTypeKind;
731
+ impltype: K.FlowTypeKind;
732
+ supertype: K.FlowTypeKind;
809
733
  }
810
734
  export interface DeclareTypeAlias extends Omit<TypeAlias, "type"> {
811
735
  type: "DeclareTypeAlias";
@@ -1051,10 +975,9 @@ export interface TSQualifiedName extends Omit<Node, "type"> {
1051
975
  left: K.IdentifierKind | K.TSQualifiedNameKind;
1052
976
  right: K.IdentifierKind | K.TSQualifiedNameKind;
1053
977
  }
1054
- export interface TSTypeReference extends Omit<TSType, "type"> {
978
+ export interface TSTypeReference extends Omit<TSType, "type">, TSHasOptionalTypeParameterInstantiation {
1055
979
  type: "TSTypeReference";
1056
980
  typeName: K.IdentifierKind | K.TSQualifiedNameKind;
1057
- typeParameters: K.TSTypeParameterInstantiationKind | null;
1058
981
  }
1059
982
  export interface TSHasOptionalTypeParameters {
1060
983
  typeParameters: K.TSTypeParameterDeclarationKind | null | undefined;
@@ -1077,6 +1000,9 @@ export interface TSNonNullExpression extends Omit<Expression, "type"> {
1077
1000
  export interface TSAnyKeyword extends Omit<TSType, "type"> {
1078
1001
  type: "TSAnyKeyword";
1079
1002
  }
1003
+ export interface TSBigIntKeyword extends Omit<TSType, "type"> {
1004
+ type: "TSBigIntKeyword";
1005
+ }
1080
1006
  export interface TSBooleanKeyword extends Omit<TSType, "type"> {
1081
1007
  type: "TSBooleanKeyword";
1082
1008
  }
@@ -1116,7 +1042,7 @@ export interface TSArrayType extends Omit<TSType, "type"> {
1116
1042
  }
1117
1043
  export interface TSLiteralType extends Omit<TSType, "type"> {
1118
1044
  type: "TSLiteralType";
1119
- literal: K.NumericLiteralKind | K.StringLiteralKind | K.BooleanLiteralKind;
1045
+ literal: K.NumericLiteralKind | K.StringLiteralKind | K.BooleanLiteralKind | K.TemplateLiteralKind | K.UnaryExpressionKind;
1120
1046
  }
1121
1047
  export interface TSUnionType extends Omit<TSType, "type"> {
1122
1048
  type: "TSUnionType";
@@ -1149,11 +1075,11 @@ export interface TSParenthesizedType extends Omit<TSType, "type"> {
1149
1075
  }
1150
1076
  export interface TSFunctionType extends Omit<TSType, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
1151
1077
  type: "TSFunctionType";
1152
- parameters: (K.IdentifierKind | K.RestElementKind | K.ObjectPatternKind)[];
1078
+ parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1153
1079
  }
1154
1080
  export interface TSConstructorType extends Omit<TSType, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
1155
1081
  type: "TSConstructorType";
1156
- parameters: (K.IdentifierKind | K.RestElementKind | K.ObjectPatternKind)[];
1082
+ parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1157
1083
  }
1158
1084
  export interface TSDeclareFunction extends Omit<Declaration, "type">, TSHasOptionalTypeParameters {
1159
1085
  type: "TSDeclareFunction";
@@ -1227,7 +1153,7 @@ export interface TSMethodSignature extends Omit<Declaration, "type">, TSHasOptio
1227
1153
  key: K.ExpressionKind;
1228
1154
  computed: boolean;
1229
1155
  optional: boolean;
1230
- parameters: (K.IdentifierKind | K.RestElementKind | K.ObjectPatternKind)[];
1156
+ parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1231
1157
  }
1232
1158
  export interface TSTypePredicate extends Omit<TSTypeAnnotation, "type" | "typeAnnotation"> {
1233
1159
  type: "TSTypePredicate";
@@ -1236,11 +1162,11 @@ export interface TSTypePredicate extends Omit<TSTypeAnnotation, "type" | "typeAn
1236
1162
  }
1237
1163
  export interface TSCallSignatureDeclaration extends Omit<Declaration, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
1238
1164
  type: "TSCallSignatureDeclaration";
1239
- parameters: (K.IdentifierKind | K.RestElementKind | K.ObjectPatternKind)[];
1165
+ parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1240
1166
  }
1241
1167
  export interface TSConstructSignatureDeclaration extends Omit<Declaration, "type">, TSHasOptionalTypeParameters, TSHasOptionalTypeAnnotation {
1242
1168
  type: "TSConstructSignatureDeclaration";
1243
- parameters: (K.IdentifierKind | K.RestElementKind | K.ObjectPatternKind)[];
1169
+ parameters: (K.IdentifierKind | K.RestElementKind | K.ArrayPatternKind | K.ObjectPatternKind)[];
1244
1170
  }
1245
1171
  export interface TSEnumMember extends Omit<Node, "type"> {
1246
1172
  type: "TSEnumMember";
@@ -1249,7 +1175,12 @@ export interface TSEnumMember extends Omit<Node, "type"> {
1249
1175
  }
1250
1176
  export interface TSTypeQuery extends Omit<TSType, "type"> {
1251
1177
  type: "TSTypeQuery";
1252
- exprName: K.IdentifierKind | K.TSQualifiedNameKind;
1178
+ exprName: K.IdentifierKind | K.TSQualifiedNameKind | K.TSImportTypeKind;
1179
+ }
1180
+ export interface TSImportType extends Omit<TSType, "type">, TSHasOptionalTypeParameterInstantiation {
1181
+ type: "TSImportType";
1182
+ argument: K.StringLiteralKind;
1183
+ qualifier: K.IdentifierKind | K.TSQualifiedNameKind | undefined;
1253
1184
  }
1254
1185
  export interface TSTypeLiteral extends Omit<TSType, "type"> {
1255
1186
  type: "TSTypeLiteral";
@@ -1331,4 +1262,4 @@ export interface OptionalCallExpression extends Omit<CallExpression, "type"> {
1331
1262
  type: "OptionalCallExpression";
1332
1263
  optional: boolean;
1333
1264
  }
1334
- export declare type ASTNode = File | Program | Identifier | BlockStatement | EmptyStatement | ExpressionStatement | IfStatement | LabeledStatement | BreakStatement | ContinueStatement | WithStatement | SwitchStatement | SwitchCase | ReturnStatement | ThrowStatement | TryStatement | CatchClause | WhileStatement | DoWhileStatement | ForStatement | VariableDeclaration | ForInStatement | DebuggerStatement | FunctionDeclaration | FunctionExpression | VariableDeclarator | ThisExpression | ArrayExpression | ObjectExpression | Property | Literal | SequenceExpression | UnaryExpression | BinaryExpression | AssignmentExpression | UpdateExpression | LogicalExpression | ConditionalExpression | NewExpression | CallExpression | MemberExpression | RestElement | TypeAnnotation | TSTypeAnnotation | SpreadElementPattern | ArrowFunctionExpression | ForOfStatement | YieldExpression | GeneratorExpression | ComprehensionBlock | ComprehensionExpression | ObjectProperty | PropertyPattern | ObjectPattern | ArrayPattern | MethodDefinition | SpreadElement | AssignmentPattern | ClassPropertyDefinition | ClassProperty | ClassBody | ClassDeclaration | ClassExpression | ImportSpecifier | ImportNamespaceSpecifier | ImportDefaultSpecifier | ImportDeclaration | TaggedTemplateExpression | TemplateLiteral | TemplateElement | SpreadProperty | SpreadPropertyPattern | AwaitExpression | LetStatement | LetExpression | GraphExpression | GraphIndexExpression | JSXAttribute | JSXIdentifier | JSXNamespacedName | JSXExpressionContainer | JSXMemberExpression | JSXSpreadAttribute | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXText | JSXOpeningFragment | JSXClosingFragment | JSXEmptyExpression | JSXSpreadChild | TypeParameterDeclaration | TSTypeParameterDeclaration | TypeParameterInstantiation | TSTypeParameterInstantiation | ClassImplements | TSExpressionWithTypeArguments | AnyTypeAnnotation | EmptyTypeAnnotation | MixedTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | NumberLiteralTypeAnnotation | NumericLiteralTypeAnnotation | StringTypeAnnotation | StringLiteralTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullableTypeAnnotation | NullLiteralTypeAnnotation | NullTypeAnnotation | ThisTypeAnnotation | ExistsTypeAnnotation | ExistentialTypeParam | FunctionTypeAnnotation | FunctionTypeParam | ArrayTypeAnnotation | ObjectTypeAnnotation | ObjectTypeProperty | ObjectTypeSpreadProperty | ObjectTypeIndexer | ObjectTypeCallProperty | ObjectTypeInternalSlot | Variance | QualifiedTypeIdentifier | GenericTypeAnnotation | MemberTypeAnnotation | UnionTypeAnnotation | IntersectionTypeAnnotation | TypeofTypeAnnotation | TypeParameter | InterfaceTypeAnnotation | InterfaceExtends | InterfaceDeclaration | DeclareInterface | TypeAlias | OpaqueType | DeclareTypeAlias | DeclareOpaqueType | TypeCastExpression | TupleTypeAnnotation | DeclareVariable | DeclareFunction | DeclareClass | DeclareModule | DeclareModuleExports | DeclareExportDeclaration | ExportSpecifier | ExportBatchSpecifier | DeclareExportAllDeclaration | InferredPredicate | DeclaredPredicate | ExportDeclaration | Block | Line | Noop | DoExpression | Super | BindExpression | Decorator | MetaProperty | ParenthesizedExpression | ExportDefaultDeclaration | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportDefaultSpecifier | ExportAllDeclaration | CommentBlock | CommentLine | Directive | DirectiveLiteral | InterpreterDirective | StringLiteral | NumericLiteral | BigIntLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | ObjectMethod | ClassPrivateProperty | ClassMethod | ClassPrivateMethod | PrivateName | RestProperty | ForAwaitStatement | Import | TSQualifiedName | TSTypeReference | TSAsExpression | TSNonNullExpression | TSAnyKeyword | TSBooleanKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSArrayType | TSLiteralType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSTypeParameter | TSParenthesizedType | TSFunctionType | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSMappedType | TSTupleType | TSRestType | TSOptionalType | TSIndexedAccessType | TSTypeOperator | TSIndexSignature | TSPropertySignature | TSMethodSignature | TSTypePredicate | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSEnumMember | TSTypeQuery | TSTypeLiteral | TSTypeAssertion | TSEnumDeclaration | TSTypeAliasDeclaration | TSModuleBlock | TSModuleDeclaration | TSImportEqualsDeclaration | TSExternalModuleReference | TSExportAssignment | TSNamespaceExportDeclaration | TSInterfaceBody | TSInterfaceDeclaration | TSParameterProperty | OptionalMemberExpression | OptionalCallExpression;
1265
+ export declare type ASTNode = File | Program | Identifier | BlockStatement | EmptyStatement | ExpressionStatement | IfStatement | LabeledStatement | BreakStatement | ContinueStatement | WithStatement | SwitchStatement | SwitchCase | ReturnStatement | ThrowStatement | TryStatement | CatchClause | WhileStatement | DoWhileStatement | ForStatement | VariableDeclaration | ForInStatement | DebuggerStatement | FunctionDeclaration | FunctionExpression | VariableDeclarator | ThisExpression | ArrayExpression | ObjectExpression | Property | Literal | SequenceExpression | UnaryExpression | BinaryExpression | AssignmentExpression | UpdateExpression | LogicalExpression | ConditionalExpression | NewExpression | CallExpression | MemberExpression | RestElement | TypeAnnotation | TSTypeAnnotation | SpreadElementPattern | ArrowFunctionExpression | ForOfStatement | YieldExpression | GeneratorExpression | ComprehensionBlock | ComprehensionExpression | ObjectProperty | PropertyPattern | ObjectPattern | ArrayPattern | MethodDefinition | SpreadElement | AssignmentPattern | ClassPropertyDefinition | ClassProperty | ClassBody | ClassDeclaration | ClassExpression | ImportSpecifier | ImportNamespaceSpecifier | ImportDefaultSpecifier | ImportDeclaration | TaggedTemplateExpression | TemplateLiteral | TemplateElement | SpreadProperty | SpreadPropertyPattern | AwaitExpression | JSXAttribute | JSXIdentifier | JSXNamespacedName | JSXExpressionContainer | JSXMemberExpression | JSXSpreadAttribute | JSXElement | JSXOpeningElement | JSXClosingElement | JSXFragment | JSXText | JSXOpeningFragment | JSXClosingFragment | JSXEmptyExpression | JSXSpreadChild | TypeParameterDeclaration | TSTypeParameterDeclaration | TypeParameterInstantiation | TSTypeParameterInstantiation | ClassImplements | TSExpressionWithTypeArguments | AnyTypeAnnotation | EmptyTypeAnnotation | MixedTypeAnnotation | VoidTypeAnnotation | NumberTypeAnnotation | NumberLiteralTypeAnnotation | NumericLiteralTypeAnnotation | StringTypeAnnotation | StringLiteralTypeAnnotation | BooleanTypeAnnotation | BooleanLiteralTypeAnnotation | NullableTypeAnnotation | NullLiteralTypeAnnotation | NullTypeAnnotation | ThisTypeAnnotation | ExistsTypeAnnotation | ExistentialTypeParam | FunctionTypeAnnotation | FunctionTypeParam | ArrayTypeAnnotation | ObjectTypeAnnotation | ObjectTypeProperty | ObjectTypeSpreadProperty | ObjectTypeIndexer | ObjectTypeCallProperty | ObjectTypeInternalSlot | Variance | QualifiedTypeIdentifier | GenericTypeAnnotation | MemberTypeAnnotation | UnionTypeAnnotation | IntersectionTypeAnnotation | TypeofTypeAnnotation | TypeParameter | InterfaceTypeAnnotation | InterfaceExtends | InterfaceDeclaration | DeclareInterface | TypeAlias | OpaqueType | DeclareTypeAlias | DeclareOpaqueType | TypeCastExpression | TupleTypeAnnotation | DeclareVariable | DeclareFunction | DeclareClass | DeclareModule | DeclareModuleExports | DeclareExportDeclaration | ExportSpecifier | ExportBatchSpecifier | DeclareExportAllDeclaration | InferredPredicate | DeclaredPredicate | ExportDeclaration | Block | Line | Noop | DoExpression | Super | BindExpression | Decorator | MetaProperty | ParenthesizedExpression | ExportDefaultDeclaration | ExportNamedDeclaration | ExportNamespaceSpecifier | ExportDefaultSpecifier | ExportAllDeclaration | CommentBlock | CommentLine | Directive | DirectiveLiteral | InterpreterDirective | StringLiteral | NumericLiteral | BigIntLiteral | NullLiteral | BooleanLiteral | RegExpLiteral | ObjectMethod | ClassPrivateProperty | ClassMethod | ClassPrivateMethod | PrivateName | RestProperty | ForAwaitStatement | Import | TSQualifiedName | TSTypeReference | TSAsExpression | TSNonNullExpression | TSAnyKeyword | TSBigIntKeyword | TSBooleanKeyword | TSNeverKeyword | TSNullKeyword | TSNumberKeyword | TSObjectKeyword | TSStringKeyword | TSSymbolKeyword | TSUndefinedKeyword | TSUnknownKeyword | TSVoidKeyword | TSThisType | TSArrayType | TSLiteralType | TSUnionType | TSIntersectionType | TSConditionalType | TSInferType | TSTypeParameter | TSParenthesizedType | TSFunctionType | TSConstructorType | TSDeclareFunction | TSDeclareMethod | TSMappedType | TSTupleType | TSRestType | TSOptionalType | TSIndexedAccessType | TSTypeOperator | TSIndexSignature | TSPropertySignature | TSMethodSignature | TSTypePredicate | TSCallSignatureDeclaration | TSConstructSignatureDeclaration | TSEnumMember | TSTypeQuery | TSImportType | TSTypeLiteral | TSTypeAssertion | TSEnumDeclaration | TSTypeAliasDeclaration | TSModuleBlock | TSModuleDeclaration | TSImportEqualsDeclaration | TSExternalModuleReference | TSExportAssignment | TSNamespaceExportDeclaration | TSInterfaceBody | TSInterfaceDeclaration | TSParameterProperty | OptionalMemberExpression | OptionalCallExpression;
package/gen/visitor.d.ts CHANGED
@@ -87,29 +87,6 @@ export interface Visitor<M = {}> {
87
87
  visitSpreadProperty?(this: Context & M, path: NodePath<N.SpreadProperty>): any;
88
88
  visitSpreadPropertyPattern?(this: Context & M, path: NodePath<N.SpreadPropertyPattern>): any;
89
89
  visitAwaitExpression?(this: Context & M, path: NodePath<N.AwaitExpression>): any;
90
- visitLetStatement?(this: Context & M, path: NodePath<N.LetStatement>): any;
91
- visitLetExpression?(this: Context & M, path: NodePath<N.LetExpression>): any;
92
- visitGraphExpression?(this: Context & M, path: NodePath<N.GraphExpression>): any;
93
- visitGraphIndexExpression?(this: Context & M, path: NodePath<N.GraphIndexExpression>): any;
94
- visitXMLDefaultDeclaration?(this: Context & M, path: NodePath<N.XMLDefaultDeclaration>): any;
95
- visitXMLAnyName?(this: Context & M, path: NodePath<N.XMLAnyName>): any;
96
- visitXMLQualifiedIdentifier?(this: Context & M, path: NodePath<N.XMLQualifiedIdentifier>): any;
97
- visitXMLFunctionQualifiedIdentifier?(this: Context & M, path: NodePath<N.XMLFunctionQualifiedIdentifier>): any;
98
- visitXMLAttributeSelector?(this: Context & M, path: NodePath<N.XMLAttributeSelector>): any;
99
- visitXMLFilterExpression?(this: Context & M, path: NodePath<N.XMLFilterExpression>): any;
100
- visitXML?(this: Context & M, path: NodePath<N.XML>): any;
101
- visitXMLElement?(this: Context & M, path: NodePath<N.XMLElement>): any;
102
- visitXMLList?(this: Context & M, path: NodePath<N.XMLList>): any;
103
- visitXMLEscape?(this: Context & M, path: NodePath<N.XMLEscape>): any;
104
- visitXMLText?(this: Context & M, path: NodePath<N.XMLText>): any;
105
- visitXMLStartTag?(this: Context & M, path: NodePath<N.XMLStartTag>): any;
106
- visitXMLEndTag?(this: Context & M, path: NodePath<N.XMLEndTag>): any;
107
- visitXMLPointTag?(this: Context & M, path: NodePath<N.XMLPointTag>): any;
108
- visitXMLName?(this: Context & M, path: NodePath<N.XMLName>): any;
109
- visitXMLAttribute?(this: Context & M, path: NodePath<N.XMLAttribute>): any;
110
- visitXMLCdata?(this: Context & M, path: NodePath<N.XMLCdata>): any;
111
- visitXMLComment?(this: Context & M, path: NodePath<N.XMLComment>): any;
112
- visitXMLProcessingInstruction?(this: Context & M, path: NodePath<N.XMLProcessingInstruction>): any;
113
90
  visitJSXAttribute?(this: Context & M, path: NodePath<N.JSXAttribute>): any;
114
91
  visitJSXIdentifier?(this: Context & M, path: NodePath<N.JSXIdentifier>): any;
115
92
  visitJSXNamespacedName?(this: Context & M, path: NodePath<N.JSXNamespacedName>): any;
@@ -131,6 +108,7 @@ export interface Visitor<M = {}> {
131
108
  visitTSTypeParameterInstantiation?(this: Context & M, path: NodePath<N.TSTypeParameterInstantiation>): any;
132
109
  visitClassImplements?(this: Context & M, path: NodePath<N.ClassImplements>): any;
133
110
  visitTSType?(this: Context & M, path: NodePath<N.TSType>): any;
111
+ visitTSHasOptionalTypeParameterInstantiation?(this: Context & M, path: NodePath<N.TSHasOptionalTypeParameterInstantiation>): any;
134
112
  visitTSExpressionWithTypeArguments?(this: Context & M, path: NodePath<N.TSExpressionWithTypeArguments>): any;
135
113
  visitFlow?(this: Context & M, path: NodePath<N.Flow>): any;
136
114
  visitFlowType?(this: Context & M, path: NodePath<N.FlowType>): any;
@@ -231,6 +209,7 @@ export interface Visitor<M = {}> {
231
209
  visitTSAsExpression?(this: Context & M, path: NodePath<N.TSAsExpression>): any;
232
210
  visitTSNonNullExpression?(this: Context & M, path: NodePath<N.TSNonNullExpression>): any;
233
211
  visitTSAnyKeyword?(this: Context & M, path: NodePath<N.TSAnyKeyword>): any;
212
+ visitTSBigIntKeyword?(this: Context & M, path: NodePath<N.TSBigIntKeyword>): any;
234
213
  visitTSBooleanKeyword?(this: Context & M, path: NodePath<N.TSBooleanKeyword>): any;
235
214
  visitTSNeverKeyword?(this: Context & M, path: NodePath<N.TSNeverKeyword>): any;
236
215
  visitTSNullKeyword?(this: Context & M, path: NodePath<N.TSNullKeyword>): any;
@@ -268,6 +247,7 @@ export interface Visitor<M = {}> {
268
247
  visitTSConstructSignatureDeclaration?(this: Context & M, path: NodePath<N.TSConstructSignatureDeclaration>): any;
269
248
  visitTSEnumMember?(this: Context & M, path: NodePath<N.TSEnumMember>): any;
270
249
  visitTSTypeQuery?(this: Context & M, path: NodePath<N.TSTypeQuery>): any;
250
+ visitTSImportType?(this: Context & M, path: NodePath<N.TSImportType>): any;
271
251
  visitTSTypeLiteral?(this: Context & M, path: NodePath<N.TSTypeLiteral>): any;
272
252
  visitTSTypeAssertion?(this: Context & M, path: NodePath<N.TSTypeAssertion>): any;
273
253
  visitTSEnumDeclaration?(this: Context & M, path: NodePath<N.TSEnumDeclaration>): any;
package/lib/path.js CHANGED
@@ -192,7 +192,7 @@ function pathPlugin(fork) {
192
192
  Pp.insertAt = function insertAt(index) {
193
193
  var argc = arguments.length;
194
194
  var move = getMoves(this, argc - 1, index);
195
- if (move === emptyMoves) {
195
+ if (move === emptyMoves && argc <= 1) {
196
196
  return this;
197
197
  }
198
198
  index = Math.max(index, 0);
package/lib/scope.js CHANGED
@@ -145,7 +145,10 @@ function scopePlugin(fork) {
145
145
  });
146
146
  recursiveScanChild(path.get("body"), bindings, scopeTypes);
147
147
  }
148
- else if (namedTypes.TypeAlias && namedTypes.TypeAlias.check(node)) {
148
+ else if ((namedTypes.TypeAlias && namedTypes.TypeAlias.check(node)) ||
149
+ (namedTypes.InterfaceDeclaration && namedTypes.InterfaceDeclaration.check(node)) ||
150
+ (namedTypes.TSTypeAliasDeclaration && namedTypes.TSTypeAliasDeclaration.check(node)) ||
151
+ (namedTypes.TSInterfaceDeclaration && namedTypes.TSInterfaceDeclaration.check(node))) {
149
152
  addTypePattern(path.get("id"), scopeTypes);
150
153
  }
151
154
  else if (namedTypes.VariableDeclarator.check(node)) {
package/main.js CHANGED
@@ -7,8 +7,6 @@ var fork_1 = __importDefault(require("./fork"));
7
7
  var core_1 = __importDefault(require("./def/core"));
8
8
  var es6_1 = __importDefault(require("./def/es6"));
9
9
  var es7_1 = __importDefault(require("./def/es7"));
10
- var mozilla_1 = __importDefault(require("./def/mozilla"));
11
- var e4x_1 = __importDefault(require("./def/e4x"));
12
10
  var jsx_1 = __importDefault(require("./def/jsx"));
13
11
  var flow_1 = __importDefault(require("./def/flow"));
14
12
  var esprima_1 = __importDefault(require("./def/esprima"));
@@ -23,8 +21,6 @@ var defs = [
23
21
  // configure the precise type hierarchy that you need.
24
22
  es6_1.default,
25
23
  es7_1.default,
26
- mozilla_1.default,
27
- e4x_1.default,
28
24
  jsx_1.default,
29
25
  flow_1.default,
30
26
  esprima_1.default,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "author": "Ben Newman <bn@cs.stanford.edu>",
3
3
  "name": "ast-types",
4
- "version": "0.12.0",
4
+ "version": "0.12.4",
5
5
  "description": "Esprima-compatible implementation of the Mozilla JS Parser API",
6
6
  "keywords": [
7
7
  "ast",
@@ -29,9 +29,8 @@
29
29
  "types": "main.d.ts",
30
30
  "scripts": {
31
31
  "gen": "ts-node --transpile-only script/gen-types.ts",
32
- "tsc": "tsc --noEmit",
33
32
  "mocha": "test/run.sh",
34
- "test": "npm run gen && npm run tsc && npm run mocha",
33
+ "test": "npm run gen && npm run build && npm run mocha",
35
34
  "clean": "ts-emit-clean",
36
35
  "build": "tsc && ts-add-module-exports",
37
36
  "prepack": "npm run clean && npm run gen && npm run build",
@@ -39,24 +38,24 @@
39
38
  },
40
39
  "dependencies": {},
41
40
  "devDependencies": {
42
- "@babel/parser": "^7.1.6",
43
- "@babel/types": "^7.1.6",
44
- "@types/esprima": "^4.0.2",
45
- "@types/glob": "^7.1.1",
46
- "@types/mocha": "^5.2.5",
47
- "@types/node": "^10.12.9",
48
- "espree": "^4.0.0",
49
- "esprima": "~4.0.0",
50
- "esprima-fb": "~14001.1.0-dev-harmony-fb",
51
- "flow-parser": "^0.83.0",
52
- "glob": "^7.1.2",
53
- "mocha": "^5.0.0",
54
- "recast": "^0.16.1",
55
- "reify": "^0.18.1",
56
- "ts-add-module-exports": "^1.0.0",
57
- "ts-emit-clean": "^1.0.0",
58
- "ts-node": "^7.0.1",
59
- "typescript": "^3.2.2"
41
+ "@babel/parser": "7.4.3",
42
+ "@babel/types": "7.4.0",
43
+ "@types/esprima": "4.0.2",
44
+ "@types/glob": "7.1.1",
45
+ "@types/mocha": "5.2.6",
46
+ "@types/node": "11.13.7",
47
+ "espree": "5.0.1",
48
+ "esprima": "4.0.1",
49
+ "esprima-fb": "15001.1001.0-dev-harmony-fb",
50
+ "flow-parser": "0.97.0",
51
+ "glob": "7.1.3",
52
+ "mocha": "6.1.4",
53
+ "recast": "0.17.5",
54
+ "reify": "0.18.1",
55
+ "ts-add-module-exports": "1.0.0",
56
+ "ts-emit-clean": "1.0.0",
57
+ "ts-node": "7.0.1",
58
+ "typescript": "3.4.3"
60
59
  },
61
60
  "engines": {
62
61
  "node": ">=4"
package/def/e4x.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { Fork } from "../types";
2
- export default function (fork: Fork): void;
package/def/e4x.js DELETED
@@ -1,75 +0,0 @@
1
- "use strict";;
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var types_1 = __importDefault(require("../lib/types"));
7
- var core_1 = __importDefault(require("./core"));
8
- function default_1(fork) {
9
- fork.use(core_1.default);
10
- var types = fork.use(types_1.default);
11
- var def = types.Type.def;
12
- var or = types.Type.or;
13
- // Note that none of these types are buildable because the Mozilla Parser
14
- // API doesn't specify any builder functions, and nobody uses E4X anymore.
15
- def("XMLDefaultDeclaration")
16
- .bases("Declaration")
17
- .field("namespace", def("Expression"));
18
- def("XMLAnyName").bases("Expression");
19
- def("XMLQualifiedIdentifier")
20
- .bases("Expression")
21
- .field("left", or(def("Identifier"), def("XMLAnyName")))
22
- .field("right", or(def("Identifier"), def("Expression")))
23
- .field("computed", Boolean);
24
- def("XMLFunctionQualifiedIdentifier")
25
- .bases("Expression")
26
- .field("right", or(def("Identifier"), def("Expression")))
27
- .field("computed", Boolean);
28
- def("XMLAttributeSelector")
29
- .bases("Expression")
30
- .field("attribute", def("Expression"));
31
- def("XMLFilterExpression")
32
- .bases("Expression")
33
- .field("left", def("Expression"))
34
- .field("right", def("Expression"));
35
- def("XMLElement")
36
- .bases("XML", "Expression")
37
- .field("contents", [def("XML")]);
38
- def("XMLList")
39
- .bases("XML", "Expression")
40
- .field("contents", [def("XML")]);
41
- def("XML").bases("Node");
42
- def("XMLEscape")
43
- .bases("XML")
44
- .field("expression", def("Expression"));
45
- def("XMLText")
46
- .bases("XML")
47
- .field("text", String);
48
- def("XMLStartTag")
49
- .bases("XML")
50
- .field("contents", [def("XML")]);
51
- def("XMLEndTag")
52
- .bases("XML")
53
- .field("contents", [def("XML")]);
54
- def("XMLPointTag")
55
- .bases("XML")
56
- .field("contents", [def("XML")]);
57
- def("XMLName")
58
- .bases("XML")
59
- .field("contents", or(String, [def("XML")]));
60
- def("XMLAttribute")
61
- .bases("XML")
62
- .field("value", String);
63
- def("XMLCdata")
64
- .bases("XML")
65
- .field("contents", String);
66
- def("XMLComment")
67
- .bases("XML")
68
- .field("contents", String);
69
- def("XMLProcessingInstruction")
70
- .bases("XML")
71
- .field("target", String)
72
- .field("contents", or(String, null));
73
- }
74
- exports.default = default_1;
75
- module.exports = exports["default"];
package/def/mozilla.d.ts DELETED
@@ -1,2 +0,0 @@
1
- import { Fork } from "../types";
2
- export default function (fork: Fork): void;
package/def/mozilla.js DELETED
@@ -1,46 +0,0 @@
1
- "use strict";;
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- var core_1 = __importDefault(require("./core"));
7
- var types_1 = __importDefault(require("../lib/types"));
8
- var shared_1 = __importDefault(require("../lib/shared"));
9
- function default_1(fork) {
10
- fork.use(core_1.default);
11
- var types = fork.use(types_1.default);
12
- var def = types.Type.def;
13
- var or = types.Type.or;
14
- var shared = fork.use(shared_1.default);
15
- var geq = shared.geq;
16
- var defaults = shared.defaults;
17
- def("Function")
18
- // SpiderMonkey allows expression closures: function(x) x+1
19
- .field("body", or(def("BlockStatement"), def("Expression")));
20
- def("ForInStatement")
21
- .build("left", "right", "body", "each")
22
- .field("each", Boolean, defaults["false"]);
23
- def("LetStatement")
24
- .bases("Statement")
25
- .build("head", "body")
26
- // TODO Deviating from the spec by reusing VariableDeclarator here.
27
- .field("head", [def("VariableDeclarator")])
28
- .field("body", def("Statement"));
29
- def("LetExpression")
30
- .bases("Expression")
31
- .build("head", "body")
32
- // TODO Deviating from the spec by reusing VariableDeclarator here.
33
- .field("head", [def("VariableDeclarator")])
34
- .field("body", def("Expression"));
35
- def("GraphExpression")
36
- .bases("Expression")
37
- .build("index", "expression")
38
- .field("index", geq(0))
39
- .field("expression", def("Literal"));
40
- def("GraphIndexExpression")
41
- .bases("Expression")
42
- .build("index")
43
- .field("index", geq(0));
44
- }
45
- exports.default = default_1;
46
- module.exports = exports["default"];
@@ -1,11 +0,0 @@
1
- import { Fork } from "../types";
2
- import { Field, Type } from "./types";
3
- export interface TSTypeAnnotatorConfig {
4
- getReferenceToKind(typeName: string): any;
5
- }
6
- export default function typeAnnotationsPlugin(fork: Fork): {
7
- createTSTypeAnnotator: (config: TSTypeAnnotatorConfig) => {
8
- getTSTypeAnnotation: (type: Type<any>) => any;
9
- getTSPropertySignature: (field: Field<any>) => any;
10
- };
11
- };