hermes-estree 0.10.1 → 0.11.0

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.
Files changed (39) hide show
  1. package/dist/generated/HermesESTreeSelectorTypes.js.flow +445 -0
  2. package/dist/generated/predicates.js +70 -0
  3. package/dist/generated/predicates.js.flow +70 -0
  4. package/dist/types.js.flow +132 -5
  5. package/package.json +1 -1
  6. package/dist/HermesAST.js.flow +0 -57
  7. package/dist/HermesASTAdapter.js +0 -186
  8. package/dist/HermesASTAdapter.js.flow +0 -183
  9. package/dist/HermesParser.js +0 -83
  10. package/dist/HermesParser.js.flow +0 -123
  11. package/dist/HermesParserDecodeUTF8String.js +0 -68
  12. package/dist/HermesParserDecodeUTF8String.js.flow +0 -65
  13. package/dist/HermesParserDeserializer.js +0 -243
  14. package/dist/HermesParserDeserializer.js.flow +0 -261
  15. package/dist/HermesParserNodeDeserializers.js +0 -2008
  16. package/dist/HermesParserNodeDeserializers.js.flow +0 -16
  17. package/dist/HermesParserWASM.js +0 -6
  18. package/dist/HermesParserWASM.js.flow +0 -75
  19. package/dist/HermesToBabelAdapter.js +0 -514
  20. package/dist/HermesToBabelAdapter.js.flow +0 -490
  21. package/dist/HermesToESTreeAdapter.js +0 -439
  22. package/dist/HermesToESTreeAdapter.js.flow +0 -422
  23. package/dist/ParserOptions.js.flow +0 -18
  24. package/dist/generated/ESTreeVisitorKeys.js +0 -180
  25. package/dist/generated/ESTreeVisitorKeys.js.flow +0 -15
  26. package/dist/generated/ParserVisitorKeys.js +0 -622
  27. package/dist/generated/ParserVisitorKeys.js.flow +0 -17
  28. package/dist/getModuleDocblock.js +0 -112
  29. package/dist/getModuleDocblock.js.flow +0 -118
  30. package/dist/transform/SimpleTransform.js +0 -92
  31. package/dist/transform/SimpleTransform.js.flow +0 -104
  32. package/dist/transform/astArrayMutationHelpers.js +0 -62
  33. package/dist/transform/astArrayMutationHelpers.js.flow +0 -71
  34. package/dist/transform/astNodeMutationHelpers.js +0 -186
  35. package/dist/transform/astNodeMutationHelpers.js.flow +0 -205
  36. package/dist/traverse/SimpleTraverser.js +0 -138
  37. package/dist/traverse/SimpleTraverser.js.flow +0 -132
  38. package/dist/traverse/getVisitorKeys.js +0 -35
  39. package/dist/traverse/getVisitorKeys.js.flow +0 -36
@@ -72,13 +72,20 @@ exports.isClosingCurlyBracketToken = isClosingCurlyBracketToken;
72
72
  exports.isClosingParenthesisToken = isClosingParenthesisToken;
73
73
  exports.isColonToken = isColonToken;
74
74
  exports.isCommaToken = isCommaToken;
75
+ exports.isComponentDeclaration = isComponentDeclaration;
76
+ exports.isComponentParameter = isComponentParameter;
77
+ exports.isComponentTypeAnnotation = isComponentTypeAnnotation;
78
+ exports.isComponentTypeParameter = isComponentTypeParameter;
75
79
  exports.isConditionalExpression = isConditionalExpression;
80
+ exports.isConditionalTypeAnnotation = isConditionalTypeAnnotation;
76
81
  exports.isConstToken = isConstToken;
77
82
  exports.isContinueStatement = isContinueStatement;
78
83
  exports.isContinueToken = isContinueToken;
79
84
  exports.isDebuggerStatement = isDebuggerStatement;
80
85
  exports.isDebuggerToken = isDebuggerToken;
81
86
  exports.isDeclareClass = isDeclareClass;
87
+ exports.isDeclareComponent = isDeclareComponent;
88
+ exports.isDeclareEnum = isDeclareEnum;
82
89
  exports.isDeclareExportAllDeclaration = isDeclareExportAllDeclaration;
83
90
  exports.isDeclareExportDeclaration = isDeclareExportDeclaration;
84
91
  exports.isDeclareFunction = isDeclareFunction;
@@ -152,6 +159,7 @@ exports.isImportToken = isImportToken;
152
159
  exports.isInToken = isInToken;
153
160
  exports.isIncrementToken = isIncrementToken;
154
161
  exports.isIndexedAccessType = isIndexedAccessType;
162
+ exports.isInferTypeAnnotation = isInferTypeAnnotation;
155
163
  exports.isInferredPredicate = isInferredPredicate;
156
164
  exports.isInstanceOfToken = isInstanceOfToken;
157
165
  exports.isInterfaceDeclaration = isInterfaceDeclaration;
@@ -175,6 +183,7 @@ exports.isJSXOpeningFragment = isJSXOpeningFragment;
175
183
  exports.isJSXSpreadAttribute = isJSXSpreadAttribute;
176
184
  exports.isJSXSpreadChild = isJSXSpreadChild;
177
185
  exports.isJSXText = isJSXText;
186
+ exports.isKeyofTypeAnnotation = isKeyofTypeAnnotation;
178
187
  exports.isLabeledStatement = isLabeledStatement;
179
188
  exports.isLessThanOrEqualToToken = isLessThanOrEqualToToken;
180
189
  exports.isLessThanToken = isLessThanToken;
@@ -211,6 +220,7 @@ exports.isObjectTypeAnnotation = isObjectTypeAnnotation;
211
220
  exports.isObjectTypeCallProperty = isObjectTypeCallProperty;
212
221
  exports.isObjectTypeIndexer = isObjectTypeIndexer;
213
222
  exports.isObjectTypeInternalSlot = isObjectTypeInternalSlot;
223
+ exports.isObjectTypeMappedTypeProperty = isObjectTypeMappedTypeProperty;
214
224
  exports.isObjectTypeProperty = isObjectTypeProperty;
215
225
  exports.isObjectTypeSpreadProperty = isObjectTypeSpreadProperty;
216
226
  exports.isOfKeyword = isOfKeyword;
@@ -227,6 +237,7 @@ exports.isPrivateIdentifier = isPrivateIdentifier;
227
237
  exports.isProperty = isProperty;
228
238
  exports.isPropertyDefinition = isPropertyDefinition;
229
239
  exports.isQualifiedTypeIdentifier = isQualifiedTypeIdentifier;
240
+ exports.isQualifiedTypeofIdentifier = isQualifiedTypeofIdentifier;
230
241
  exports.isQuestionMarkToken = isQuestionMarkToken;
231
242
  exports.isRemainderEqualToken = isRemainderEqualToken;
232
243
  exports.isRestElement = isRestElement;
@@ -258,6 +269,8 @@ exports.isThrowToken = isThrowToken;
258
269
  exports.isTryStatement = isTryStatement;
259
270
  exports.isTryToken = isTryToken;
260
271
  exports.isTupleTypeAnnotation = isTupleTypeAnnotation;
272
+ exports.isTupleTypeLabeledElement = isTupleTypeLabeledElement;
273
+ exports.isTupleTypeSpreadElement = isTupleTypeSpreadElement;
261
274
  exports.isTypeAlias = isTypeAlias;
262
275
  exports.isTypeAnnotation = isTypeAnnotation;
263
276
  exports.isTypeCastExpression = isTypeCastExpression;
@@ -266,6 +279,7 @@ exports.isTypeOfToken = isTypeOfToken;
266
279
  exports.isTypeParameter = isTypeParameter;
267
280
  exports.isTypeParameterDeclaration = isTypeParameterDeclaration;
268
281
  exports.isTypeParameterInstantiation = isTypeParameterInstantiation;
282
+ exports.isTypePredicate = isTypePredicate;
269
283
  exports.isTypeofTypeAnnotation = isTypeofTypeAnnotation;
270
284
  exports.isUnaryExpression = isUnaryExpression;
271
285
  exports.isUnaryNegationToken = isUnaryNegationToken;
@@ -373,10 +387,30 @@ function isClassImplements(node) {
373
387
  return node.type === 'ClassImplements';
374
388
  }
375
389
 
390
+ function isComponentDeclaration(node) {
391
+ return node.type === 'ComponentDeclaration';
392
+ }
393
+
394
+ function isComponentParameter(node) {
395
+ return node.type === 'ComponentParameter';
396
+ }
397
+
398
+ function isComponentTypeAnnotation(node) {
399
+ return node.type === 'ComponentTypeAnnotation';
400
+ }
401
+
402
+ function isComponentTypeParameter(node) {
403
+ return node.type === 'ComponentTypeParameter';
404
+ }
405
+
376
406
  function isConditionalExpression(node) {
377
407
  return node.type === 'ConditionalExpression';
378
408
  }
379
409
 
410
+ function isConditionalTypeAnnotation(node) {
411
+ return node.type === 'ConditionalTypeAnnotation';
412
+ }
413
+
380
414
  function isContinueStatement(node) {
381
415
  return node.type === 'ContinueStatement';
382
416
  }
@@ -389,10 +423,18 @@ function isDeclareClass(node) {
389
423
  return node.type === 'DeclareClass';
390
424
  }
391
425
 
426
+ function isDeclareComponent(node) {
427
+ return node.type === 'DeclareComponent';
428
+ }
429
+
392
430
  function isDeclaredPredicate(node) {
393
431
  return node.type === 'DeclaredPredicate';
394
432
  }
395
433
 
434
+ function isDeclareEnum(node) {
435
+ return node.type === 'DeclareEnum';
436
+ }
437
+
396
438
  function isDeclareExportAllDeclaration(node) {
397
439
  return node.type === 'DeclareExportAllDeclaration';
398
440
  }
@@ -573,6 +615,10 @@ function isInferredPredicate(node) {
573
615
  return node.type === 'InferredPredicate';
574
616
  }
575
617
 
618
+ function isInferTypeAnnotation(node) {
619
+ return node.type === 'InferTypeAnnotation';
620
+ }
621
+
576
622
  function isInterfaceDeclaration(node) {
577
623
  return node.type === 'InterfaceDeclaration';
578
624
  }
@@ -649,6 +695,10 @@ function isJSXText(node) {
649
695
  return node.type === 'JSXText';
650
696
  }
651
697
 
698
+ function isKeyofTypeAnnotation(node) {
699
+ return node.type === 'KeyofTypeAnnotation';
700
+ }
701
+
652
702
  function isLabeledStatement(node) {
653
703
  return node.type === 'LabeledStatement';
654
704
  }
@@ -717,6 +767,10 @@ function isObjectTypeInternalSlot(node) {
717
767
  return node.type === 'ObjectTypeInternalSlot';
718
768
  }
719
769
 
770
+ function isObjectTypeMappedTypeProperty(node) {
771
+ return node.type === 'ObjectTypeMappedTypeProperty';
772
+ }
773
+
720
774
  function isObjectTypeProperty(node) {
721
775
  return node.type === 'ObjectTypeProperty';
722
776
  }
@@ -749,6 +803,10 @@ function isQualifiedTypeIdentifier(node) {
749
803
  return node.type === 'QualifiedTypeIdentifier';
750
804
  }
751
805
 
806
+ function isQualifiedTypeofIdentifier(node) {
807
+ return node.type === 'QualifiedTypeofIdentifier';
808
+ }
809
+
752
810
  function isRestElement(node) {
753
811
  return node.type === 'RestElement';
754
812
  }
@@ -821,6 +879,14 @@ function isTupleTypeAnnotation(node) {
821
879
  return node.type === 'TupleTypeAnnotation';
822
880
  }
823
881
 
882
+ function isTupleTypeLabeledElement(node) {
883
+ return node.type === 'TupleTypeLabeledElement';
884
+ }
885
+
886
+ function isTupleTypeSpreadElement(node) {
887
+ return node.type === 'TupleTypeSpreadElement';
888
+ }
889
+
824
890
  function isTypeAlias(node) {
825
891
  return node.type === 'TypeAlias';
826
892
  }
@@ -849,6 +915,10 @@ function isTypeParameterInstantiation(node) {
849
915
  return node.type === 'TypeParameterInstantiation';
850
916
  }
851
917
 
918
+ function isTypePredicate(node) {
919
+ return node.type === 'TypePredicate';
920
+ }
921
+
852
922
  function isUnaryExpression(node) {
853
923
  return node.type === 'UnaryExpression';
854
924
  }
@@ -117,10 +117,36 @@ export function isClassImplements(node: ESNode | Token): boolean %checks {
117
117
  return node.type === 'ClassImplements';
118
118
  }
119
119
 
120
+ export function isComponentDeclaration(node: ESNode | Token): boolean %checks {
121
+ return node.type === 'ComponentDeclaration';
122
+ }
123
+
124
+ export function isComponentParameter(node: ESNode | Token): boolean %checks {
125
+ return node.type === 'ComponentParameter';
126
+ }
127
+
128
+ export function isComponentTypeAnnotation(
129
+ node: ESNode | Token,
130
+ ): boolean %checks {
131
+ return node.type === 'ComponentTypeAnnotation';
132
+ }
133
+
134
+ export function isComponentTypeParameter(
135
+ node: ESNode | Token,
136
+ ): boolean %checks {
137
+ return node.type === 'ComponentTypeParameter';
138
+ }
139
+
120
140
  export function isConditionalExpression(node: ESNode | Token): boolean %checks {
121
141
  return node.type === 'ConditionalExpression';
122
142
  }
123
143
 
144
+ export function isConditionalTypeAnnotation(
145
+ node: ESNode | Token,
146
+ ): boolean %checks {
147
+ return node.type === 'ConditionalTypeAnnotation';
148
+ }
149
+
124
150
  export function isContinueStatement(node: ESNode | Token): boolean %checks {
125
151
  return node.type === 'ContinueStatement';
126
152
  }
@@ -133,10 +159,18 @@ export function isDeclareClass(node: ESNode | Token): boolean %checks {
133
159
  return node.type === 'DeclareClass';
134
160
  }
135
161
 
162
+ export function isDeclareComponent(node: ESNode | Token): boolean %checks {
163
+ return node.type === 'DeclareComponent';
164
+ }
165
+
136
166
  export function isDeclaredPredicate(node: ESNode | Token): boolean %checks {
137
167
  return node.type === 'DeclaredPredicate';
138
168
  }
139
169
 
170
+ export function isDeclareEnum(node: ESNode | Token): boolean %checks {
171
+ return node.type === 'DeclareEnum';
172
+ }
173
+
140
174
  export function isDeclareExportAllDeclaration(
141
175
  node: ESNode | Token,
142
176
  ): boolean %checks {
@@ -331,6 +365,10 @@ export function isInferredPredicate(node: ESNode | Token): boolean %checks {
331
365
  return node.type === 'InferredPredicate';
332
366
  }
333
367
 
368
+ export function isInferTypeAnnotation(node: ESNode | Token): boolean %checks {
369
+ return node.type === 'InferTypeAnnotation';
370
+ }
371
+
334
372
  export function isInterfaceDeclaration(node: ESNode | Token): boolean %checks {
335
373
  return node.type === 'InterfaceDeclaration';
336
374
  }
@@ -413,6 +451,10 @@ export function isJSXText(node: ESNode | Token): boolean %checks {
413
451
  return node.type === 'JSXText';
414
452
  }
415
453
 
454
+ export function isKeyofTypeAnnotation(node: ESNode | Token): boolean %checks {
455
+ return node.type === 'KeyofTypeAnnotation';
456
+ }
457
+
416
458
  export function isLabeledStatement(node: ESNode | Token): boolean %checks {
417
459
  return node.type === 'LabeledStatement';
418
460
  }
@@ -491,6 +533,12 @@ export function isObjectTypeInternalSlot(
491
533
  return node.type === 'ObjectTypeInternalSlot';
492
534
  }
493
535
 
536
+ export function isObjectTypeMappedTypeProperty(
537
+ node: ESNode | Token,
538
+ ): boolean %checks {
539
+ return node.type === 'ObjectTypeMappedTypeProperty';
540
+ }
541
+
494
542
  export function isObjectTypeProperty(node: ESNode | Token): boolean %checks {
495
543
  return node.type === 'ObjectTypeProperty';
496
544
  }
@@ -529,6 +577,12 @@ export function isQualifiedTypeIdentifier(
529
577
  return node.type === 'QualifiedTypeIdentifier';
530
578
  }
531
579
 
580
+ export function isQualifiedTypeofIdentifier(
581
+ node: ESNode | Token,
582
+ ): boolean %checks {
583
+ return node.type === 'QualifiedTypeofIdentifier';
584
+ }
585
+
532
586
  export function isRestElement(node: ESNode | Token): boolean %checks {
533
587
  return node.type === 'RestElement';
534
588
  }
@@ -605,6 +659,18 @@ export function isTupleTypeAnnotation(node: ESNode | Token): boolean %checks {
605
659
  return node.type === 'TupleTypeAnnotation';
606
660
  }
607
661
 
662
+ export function isTupleTypeLabeledElement(
663
+ node: ESNode | Token,
664
+ ): boolean %checks {
665
+ return node.type === 'TupleTypeLabeledElement';
666
+ }
667
+
668
+ export function isTupleTypeSpreadElement(
669
+ node: ESNode | Token,
670
+ ): boolean %checks {
671
+ return node.type === 'TupleTypeSpreadElement';
672
+ }
673
+
608
674
  export function isTypeAlias(node: ESNode | Token): boolean %checks {
609
675
  return node.type === 'TypeAlias';
610
676
  }
@@ -637,6 +703,10 @@ export function isTypeParameterInstantiation(
637
703
  return node.type === 'TypeParameterInstantiation';
638
704
  }
639
705
 
706
+ export function isTypePredicate(node: ESNode | Token): boolean %checks {
707
+ return node.type === 'TypePredicate';
708
+ }
709
+
640
710
  export function isUnaryExpression(node: ESNode | Token): boolean %checks {
641
711
  return node.type === 'UnaryExpression';
642
712
  }
@@ -174,17 +174,21 @@ export type ESNode =
174
174
  | TypeAnnotationType
175
175
  | Variance
176
176
  | FunctionTypeParam
177
+ | ComponentTypeParameter
177
178
  | InferredPredicate
178
179
  | ObjectTypeProperty
179
180
  | ObjectTypeCallProperty
180
181
  | ObjectTypeIndexer
181
182
  | ObjectTypeSpreadProperty
183
+ | ObjectTypeMappedTypeProperty
182
184
  | InterfaceExtends
183
185
  | ClassImplements
184
186
  | Decorator
185
187
  | TypeParameterDeclaration
186
188
  | TypeParameter
187
189
  | TypeParameterInstantiation
190
+ | ComponentDeclaration
191
+ | ComponentParameter
188
192
  | EnumDeclaration
189
193
  | EnumNumberBody
190
194
  | EnumStringBody
@@ -227,10 +231,13 @@ export type Statement =
227
231
  | BlockStatement
228
232
  | BreakStatement
229
233
  | ClassDeclaration
234
+ | ComponentDeclaration
230
235
  | ContinueStatement
231
236
  | DebuggerStatement
232
237
  | DeclareClass
238
+ | DeclareComponent
233
239
  | DeclareVariable
240
+ | DeclareEnum
234
241
  | DeclareFunction
235
242
  | DeclareInterface
236
243
  | DeclareModule
@@ -377,6 +384,24 @@ export interface DebuggerStatement extends BaseNode {
377
384
  +type: 'DebuggerStatement';
378
385
  }
379
386
 
387
+ type ComponentParameterAndRestElement = ComponentParameter | RestElement;
388
+
389
+ export interface ComponentParameter extends BaseNode {
390
+ +type: 'ComponentParameter';
391
+ +name: Identifier | StringLiteral;
392
+ +local: BindingName | AssignmentPattern;
393
+ +shorthand: boolean;
394
+ }
395
+
396
+ export interface ComponentDeclaration extends BaseNode {
397
+ +type: 'ComponentDeclaration';
398
+ +body: BlockStatement;
399
+ +id: Identifier;
400
+ +params: $ReadOnlyArray<ComponentParameterAndRestElement>;
401
+ +returnType: null | TypeAnnotation;
402
+ +typeParameters: null | TypeParameterDeclaration;
403
+ }
404
+
380
405
  export interface FunctionDeclaration extends BaseFunction {
381
406
  +type: 'FunctionDeclaration';
382
407
  /** It is null when a function declaration is a part of the `export default function` statement */
@@ -619,7 +644,6 @@ export type MemberExpression =
619
644
  | MemberExpressionWithNonComputedName;
620
645
  export interface MemberExpressionWithComputedName extends BaseNode {
621
646
  +type: 'MemberExpression';
622
- +computed: true;
623
647
  +object: Expression | Super;
624
648
  +property: Expression;
625
649
  +computed: true;
@@ -627,7 +651,6 @@ export interface MemberExpressionWithComputedName extends BaseNode {
627
651
  }
628
652
  export interface MemberExpressionWithNonComputedName extends BaseNode {
629
653
  +type: 'MemberExpression';
630
- +computed: false;
631
654
  +object: Expression | Super;
632
655
  +property: Identifier | PrivateIdentifier;
633
656
  +computed: false;
@@ -1021,7 +1044,10 @@ export interface ImportNamespaceSpecifier extends BaseNode {
1021
1044
  +parent: ImportDeclaration;
1022
1045
  }
1023
1046
 
1024
- export type DefaultDeclaration = FunctionDeclaration | ClassDeclaration;
1047
+ export type DefaultDeclaration =
1048
+ | FunctionDeclaration
1049
+ | ClassDeclaration
1050
+ | ComponentDeclaration;
1025
1051
  export type NamedDeclaration =
1026
1052
  | DefaultDeclaration
1027
1053
  | VariableDeclaration
@@ -1103,12 +1129,20 @@ export type TypeAnnotationType =
1103
1129
  | ExistsTypeAnnotation
1104
1130
  | GenericTypeAnnotation
1105
1131
  | QualifiedTypeIdentifier
1132
+ | QualifiedTypeofIdentifier
1106
1133
  | TypeofTypeAnnotation
1134
+ | KeyofTypeAnnotation
1107
1135
  | TupleTypeAnnotation
1136
+ | TupleTypeSpreadElement
1137
+ | TupleTypeLabeledElement
1138
+ | InferTypeAnnotation
1108
1139
  | InterfaceTypeAnnotation
1109
1140
  | UnionTypeAnnotation
1110
1141
  | IntersectionTypeAnnotation
1142
+ | ConditionalTypeAnnotation
1143
+ | TypePredicate
1111
1144
  | FunctionTypeAnnotation
1145
+ | ComponentTypeAnnotation
1112
1146
  | ObjectTypeAnnotation
1113
1147
  | IndexedAccessType
1114
1148
  | OptionalIndexedAccessType;
@@ -1218,14 +1252,40 @@ export interface QualifiedTypeIdentifier extends BaseNode {
1218
1252
  +id: Identifier;
1219
1253
  +qualification: QualifiedTypeIdentifier | Identifier;
1220
1254
  }
1255
+ export interface QualifiedTypeofIdentifier extends BaseNode {
1256
+ +type: 'QualifiedTypeofIdentifier';
1257
+ +id: Identifier;
1258
+ +qualification: QualifiedTypeofIdentifier | Identifier;
1259
+ }
1221
1260
  export interface TypeofTypeAnnotation extends BaseNode {
1222
1261
  +type: 'TypeofTypeAnnotation';
1262
+ +argument: QualifiedTypeofIdentifier | Identifier;
1263
+ }
1264
+ export interface KeyofTypeAnnotation extends BaseNode {
1265
+ +type: 'KeyofTypeAnnotation';
1223
1266
  +argument: TypeAnnotationType;
1224
1267
  }
1225
1268
  export interface TupleTypeAnnotation extends BaseNode {
1226
1269
  +type: 'TupleTypeAnnotation';
1227
1270
  +types: $ReadOnlyArray<TypeAnnotationType>;
1228
1271
  }
1272
+ export interface TupleTypeSpreadElement extends BaseNode {
1273
+ +type: 'TupleTypeSpreadElement';
1274
+ +label?: Identifier | null;
1275
+ +typeAnnotation: TypeAnnotationType;
1276
+ }
1277
+ export interface TupleTypeLabeledElement extends BaseNode {
1278
+ +type: 'TupleTypeLabeledElement';
1279
+ +label: Identifier;
1280
+ +elementType: TypeAnnotationType;
1281
+ +optional: boolean;
1282
+ +variance: Variance | null;
1283
+ }
1284
+
1285
+ export interface InferTypeAnnotation extends BaseNode {
1286
+ +type: 'InferTypeAnnotation';
1287
+ +typeParameter: TypeParameter;
1288
+ }
1229
1289
 
1230
1290
  // type T = { [[foo]]: number };
1231
1291
  export interface ObjectTypeInternalSlot extends BaseNode {
@@ -1252,6 +1312,21 @@ export interface IntersectionTypeAnnotation extends BaseNode {
1252
1312
  +types: $ReadOnlyArray<TypeAnnotationType>;
1253
1313
  }
1254
1314
 
1315
+ export interface ConditionalTypeAnnotation extends BaseNode {
1316
+ +type: 'ConditionalTypeAnnotation';
1317
+ +checkType: TypeAnnotationType;
1318
+ +extendsType: TypeAnnotationType;
1319
+ +trueType: TypeAnnotationType;
1320
+ +falseType: TypeAnnotationType;
1321
+ }
1322
+
1323
+ export interface TypePredicate extends BaseNode {
1324
+ +type: 'TypePredicate';
1325
+ +parameterName: Identifier;
1326
+ +typeAnnotation: TypeAnnotationType | null;
1327
+ +asserts: boolean;
1328
+ }
1329
+
1255
1330
  export interface FunctionTypeAnnotation extends BaseNode {
1256
1331
  +type: 'FunctionTypeAnnotation';
1257
1332
  +params: $ReadOnlyArray<FunctionTypeParam>;
@@ -1268,6 +1343,23 @@ export interface FunctionTypeParam extends BaseNode {
1268
1343
 
1269
1344
  +parent: FunctionTypeAnnotation;
1270
1345
  }
1346
+
1347
+ export interface ComponentTypeAnnotation extends BaseNode {
1348
+ +type: 'ComponentTypeAnnotation';
1349
+ +params: $ReadOnlyArray<ComponentTypeParameter>;
1350
+ +rest: null | ComponentTypeParameter;
1351
+ +typeParameters: null | TypeParameterDeclaration;
1352
+ +returnType: null | TypeAnnotationType;
1353
+ }
1354
+ export interface ComponentTypeParameter extends BaseNode {
1355
+ +type: 'ComponentTypeParameter';
1356
+ +name: Identifier | StringLiteral | null;
1357
+ +typeAnnotation: TypeAnnotationType | null;
1358
+ +optional: boolean;
1359
+
1360
+ +parent: ComponentTypeAnnotation | DeclareComponent;
1361
+ }
1362
+
1271
1363
  export interface InferredPredicate extends BaseNode {
1272
1364
  +type: 'InferredPredicate';
1273
1365
 
@@ -1278,7 +1370,11 @@ export interface ObjectTypeAnnotation extends BaseNode {
1278
1370
  +type: 'ObjectTypeAnnotation';
1279
1371
  +inexact: false;
1280
1372
  +exact: boolean;
1281
- +properties: $ReadOnlyArray<ObjectTypeProperty | ObjectTypeSpreadProperty>;
1373
+ +properties: $ReadOnlyArray<
1374
+ | ObjectTypeProperty
1375
+ | ObjectTypeSpreadProperty
1376
+ | ObjectTypeMappedTypeProperty,
1377
+ >;
1282
1378
  +indexers: $ReadOnlyArray<ObjectTypeIndexer>;
1283
1379
  +callProperties: $ReadOnlyArray<ObjectTypeCallProperty>;
1284
1380
  +internalSlots: $ReadOnlyArray<ObjectTypeInternalSlot>;
@@ -1348,6 +1444,17 @@ export interface ObjectTypeIndexer extends BaseNode {
1348
1444
 
1349
1445
  +parent: ObjectTypeAnnotation;
1350
1446
  }
1447
+ export interface ObjectTypeMappedTypeProperty extends BaseNode {
1448
+ +type: 'ObjectTypeMappedTypeProperty';
1449
+ +keyTparam: TypeParameter;
1450
+ +propType: TypeAnnotationType;
1451
+ +sourceType: TypeAnnotationType;
1452
+ +variance: null | Variance;
1453
+ +optional: null | 'PlusOptional' | 'MinusOptional' | 'Optional';
1454
+
1455
+ +parent: ObjectTypeAnnotation;
1456
+ }
1457
+
1351
1458
  export interface ObjectTypeSpreadProperty extends BaseNode {
1352
1459
  +type: 'ObjectTypeSpreadProperty';
1353
1460
  +argument: TypeAnnotationType;
@@ -1511,7 +1618,9 @@ export interface EnumDefaultedMember extends BaseNode {
1511
1618
 
1512
1619
  export type DeclaredNode =
1513
1620
  | DeclareClass
1621
+ | DeclareComponent
1514
1622
  | DeclareVariable
1623
+ | DeclareEnum
1515
1624
  | DeclareFunction
1516
1625
  | DeclareModule
1517
1626
  | DeclareInterface
@@ -1532,9 +1641,25 @@ export interface DeclareClass extends BaseNode {
1532
1641
  +mixins: $ReadOnlyArray<InterfaceExtends>;
1533
1642
  }
1534
1643
 
1644
+ export interface DeclareComponent extends BaseNode {
1645
+ +type: 'DeclareComponent';
1646
+ +id: Identifier;
1647
+ +params: Array<ComponentTypeParameter>;
1648
+ +rest: null | ComponentTypeParameter;
1649
+ +typeParameters: null | TypeParameterDeclaration;
1650
+ +returnType: null | TypeAnnotation;
1651
+ }
1652
+
1535
1653
  export interface DeclareVariable extends BaseNode {
1536
1654
  +type: 'DeclareVariable';
1537
1655
  +id: Identifier;
1656
+ +kind: 'var' | 'let' | 'const';
1657
+ }
1658
+
1659
+ export interface DeclareEnum extends BaseNode {
1660
+ +type: 'DeclareEnum';
1661
+ +id: Identifier;
1662
+ +body: EnumNumberBody | EnumStringBody | EnumBooleanBody | EnumSymbolBody;
1538
1663
  }
1539
1664
 
1540
1665
  export interface DeclareFunction extends BaseNode {
@@ -1597,7 +1722,8 @@ export interface DeclareExportDeclarationNamedWithDeclaration
1597
1722
  | DeclareFunction
1598
1723
  | DeclareInterface
1599
1724
  | DeclareOpaqueType
1600
- | DeclareVariable;
1725
+ | DeclareVariable
1726
+ | DeclareEnum;
1601
1727
  +default: false;
1602
1728
  +source: null;
1603
1729
  // default cannot have specifiers and a declaration
@@ -1726,6 +1852,7 @@ export interface JSXOpeningElement extends BaseNode {
1726
1852
  +selfClosing: boolean;
1727
1853
  +name: JSXTagNameExpression;
1728
1854
  +attributes: $ReadOnlyArray<JSXAttribute | JSXSpreadAttribute>;
1855
+ +typeArguments?: TypeParameterInstantiation | null;
1729
1856
 
1730
1857
  +parent: JSXElement;
1731
1858
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-estree",
3
- "version": "0.10.1",
3
+ "version": "0.11.0",
4
4
  "description": "Flow types for the Flow-ESTree spec produced by the hermes parser",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -1,57 +0,0 @@
1
- /**
2
- * Copyright (c) Meta Platforms, Inc. and affiliates.
3
- *
4
- * This source code is licensed under the MIT license found in the
5
- * LICENSE file in the root directory of this source tree.
6
- *
7
- * @flow strict
8
- * @format
9
- */
10
-
11
- // flowlint unclear-type:off
12
-
13
- export interface HermesPosition {
14
- /** >= 1 */
15
- +line: number;
16
- /** >= 0 */
17
- +column: number;
18
- }
19
- export type HermesSourceLocation = {
20
- start?: HermesPosition,
21
- end?: HermesPosition,
22
- rangeStart?: number,
23
- rangeEnd?: number,
24
- };
25
- export type HermesNode = {
26
- type: string,
27
- [string]: any,
28
- };
29
- export type HermesToken = {
30
- type:
31
- | 'Boolean'
32
- | 'Identifier'
33
- | 'Keyword'
34
- | 'Null'
35
- | 'Numeric'
36
- | 'BigInt'
37
- | 'Punctuator'
38
- | 'String'
39
- | 'RegularExpression'
40
- | 'Template'
41
- | 'JSXText',
42
- loc: HermesSourceLocation,
43
- value: ?string,
44
- };
45
- export type HermesComment = {
46
- type: 'CommentLine' | 'CommentBlock' | 'InterpreterDirective',
47
- loc: HermesSourceLocation,
48
- value: ?string,
49
- };
50
- export type HermesProgram = {
51
- type: 'Program',
52
- loc: HermesSourceLocation,
53
- body: Array<?HermesNode>,
54
- comments: Array<HermesComment>,
55
- tokens?: Array<HermesToken>,
56
- interpreter?: ?HermesComment,
57
- };