hermes-estree 0.25.0 → 0.26.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.
@@ -133,6 +133,22 @@ import type {
133
133
  KeyofTypeAnnotation,
134
134
  LabeledStatement,
135
135
  LogicalExpression,
136
+ MatchArrayPattern,
137
+ MatchAsPattern,
138
+ MatchBindingPattern,
139
+ MatchExpression,
140
+ MatchExpressionCase,
141
+ MatchIdentifierPattern,
142
+ MatchLiteralPattern,
143
+ MatchMemberPattern,
144
+ MatchObjectPattern,
145
+ MatchObjectPatternProperty,
146
+ MatchOrPattern,
147
+ MatchRestPattern,
148
+ MatchStatement,
149
+ MatchStatementCase,
150
+ MatchUnaryPattern,
151
+ MatchWildcardPattern,
136
152
  MemberExpression,
137
153
  MetaProperty,
138
154
  MethodDefinition,
@@ -163,6 +179,7 @@ import type {
163
179
  ReturnStatement,
164
180
  SequenceExpression,
165
181
  SpreadElement,
182
+ StaticBlock,
166
183
  StringLiteralTypeAnnotation,
167
184
  StringTypeAnnotation,
168
185
  Super,
@@ -1015,6 +1032,96 @@ interface LogicalExpression_With_right extends LogicalExpression {
1015
1032
  interface LogicalExpression_With_operator extends LogicalExpression {
1016
1033
  +operator: $NonMaybeType<LogicalExpression['operator']>;
1017
1034
  }
1035
+ interface MatchArrayPattern_With_elements extends MatchArrayPattern {
1036
+ +elements: $NonMaybeType<MatchArrayPattern['elements']>;
1037
+ }
1038
+ interface MatchArrayPattern_With_rest extends MatchArrayPattern {
1039
+ +rest: $NonMaybeType<MatchArrayPattern['rest']>;
1040
+ }
1041
+ interface MatchAsPattern_With_pattern extends MatchAsPattern {
1042
+ +pattern: $NonMaybeType<MatchAsPattern['pattern']>;
1043
+ }
1044
+ interface MatchAsPattern_With_target extends MatchAsPattern {
1045
+ +target: $NonMaybeType<MatchAsPattern['target']>;
1046
+ }
1047
+ interface MatchBindingPattern_With_id extends MatchBindingPattern {
1048
+ +id: $NonMaybeType<MatchBindingPattern['id']>;
1049
+ }
1050
+ interface MatchBindingPattern_With_kind extends MatchBindingPattern {
1051
+ +kind: $NonMaybeType<MatchBindingPattern['kind']>;
1052
+ }
1053
+ interface MatchExpression_With_argument extends MatchExpression {
1054
+ +argument: $NonMaybeType<MatchExpression['argument']>;
1055
+ }
1056
+ interface MatchExpression_With_cases extends MatchExpression {
1057
+ +cases: $NonMaybeType<MatchExpression['cases']>;
1058
+ }
1059
+ interface MatchExpressionCase_With_pattern extends MatchExpressionCase {
1060
+ +pattern: $NonMaybeType<MatchExpressionCase['pattern']>;
1061
+ }
1062
+ interface MatchExpressionCase_With_body extends MatchExpressionCase {
1063
+ +body: $NonMaybeType<MatchExpressionCase['body']>;
1064
+ }
1065
+ interface MatchExpressionCase_With_guard extends MatchExpressionCase {
1066
+ +guard: $NonMaybeType<MatchExpressionCase['guard']>;
1067
+ }
1068
+ interface MatchIdentifierPattern_With_id extends MatchIdentifierPattern {
1069
+ +id: $NonMaybeType<MatchIdentifierPattern['id']>;
1070
+ }
1071
+ interface MatchLiteralPattern_With_literal extends MatchLiteralPattern {
1072
+ +literal: $NonMaybeType<MatchLiteralPattern['literal']>;
1073
+ }
1074
+ interface MatchMemberPattern_With_base extends MatchMemberPattern {
1075
+ +base: $NonMaybeType<MatchMemberPattern['base']>;
1076
+ }
1077
+ interface MatchMemberPattern_With_property extends MatchMemberPattern {
1078
+ +property: $NonMaybeType<MatchMemberPattern['property']>;
1079
+ }
1080
+ interface MatchObjectPattern_With_properties extends MatchObjectPattern {
1081
+ +properties: $NonMaybeType<MatchObjectPattern['properties']>;
1082
+ }
1083
+ interface MatchObjectPattern_With_rest extends MatchObjectPattern {
1084
+ +rest: $NonMaybeType<MatchObjectPattern['rest']>;
1085
+ }
1086
+ interface MatchObjectPatternProperty_With_key
1087
+ extends MatchObjectPatternProperty {
1088
+ +key: $NonMaybeType<MatchObjectPatternProperty['key']>;
1089
+ }
1090
+ interface MatchObjectPatternProperty_With_pattern
1091
+ extends MatchObjectPatternProperty {
1092
+ +pattern: $NonMaybeType<MatchObjectPatternProperty['pattern']>;
1093
+ }
1094
+ interface MatchObjectPatternProperty_With_shorthand
1095
+ extends MatchObjectPatternProperty {
1096
+ +shorthand: $NonMaybeType<MatchObjectPatternProperty['shorthand']>;
1097
+ }
1098
+ interface MatchOrPattern_With_patterns extends MatchOrPattern {
1099
+ +patterns: $NonMaybeType<MatchOrPattern['patterns']>;
1100
+ }
1101
+ interface MatchRestPattern_With_argument extends MatchRestPattern {
1102
+ +argument: $NonMaybeType<MatchRestPattern['argument']>;
1103
+ }
1104
+ interface MatchStatement_With_argument extends MatchStatement {
1105
+ +argument: $NonMaybeType<MatchStatement['argument']>;
1106
+ }
1107
+ interface MatchStatement_With_cases extends MatchStatement {
1108
+ +cases: $NonMaybeType<MatchStatement['cases']>;
1109
+ }
1110
+ interface MatchStatementCase_With_pattern extends MatchStatementCase {
1111
+ +pattern: $NonMaybeType<MatchStatementCase['pattern']>;
1112
+ }
1113
+ interface MatchStatementCase_With_body extends MatchStatementCase {
1114
+ +body: $NonMaybeType<MatchStatementCase['body']>;
1115
+ }
1116
+ interface MatchStatementCase_With_guard extends MatchStatementCase {
1117
+ +guard: $NonMaybeType<MatchStatementCase['guard']>;
1118
+ }
1119
+ interface MatchUnaryPattern_With_argument extends MatchUnaryPattern {
1120
+ +argument: $NonMaybeType<MatchUnaryPattern['argument']>;
1121
+ }
1122
+ interface MatchUnaryPattern_With_operator extends MatchUnaryPattern {
1123
+ +operator: $NonMaybeType<MatchUnaryPattern['operator']>;
1124
+ }
1018
1125
  interface MemberExpression_With_object extends MemberExpression {
1019
1126
  +object: $NonMaybeType<MemberExpression['object']>;
1020
1127
  }
@@ -1279,6 +1386,9 @@ interface SequenceExpression_With_expressions extends SequenceExpression {
1279
1386
  interface SpreadElement_With_argument extends SpreadElement {
1280
1387
  +argument: $NonMaybeType<SpreadElement['argument']>;
1281
1388
  }
1389
+ interface StaticBlock_With_body extends StaticBlock {
1390
+ +body: $NonMaybeType<StaticBlock['body']>;
1391
+ }
1282
1392
  interface StringLiteralTypeAnnotation_With_value
1283
1393
  extends StringLiteralTypeAnnotation {
1284
1394
  +value: $NonMaybeType<StringLiteralTypeAnnotation['value']>;
@@ -1393,6 +1503,9 @@ interface TypeOperator_With_typeAnnotation extends TypeOperator {
1393
1503
  interface TypeParameter_With_name extends TypeParameter {
1394
1504
  +name: $NonMaybeType<TypeParameter['name']>;
1395
1505
  }
1506
+ interface TypeParameter_With_const extends TypeParameter {
1507
+ +const: $NonMaybeType<TypeParameter['const']>;
1508
+ }
1396
1509
  interface TypeParameter_With_bound extends TypeParameter {
1397
1510
  +bound: $NonMaybeType<TypeParameter['bound']>;
1398
1511
  }
@@ -1490,6 +1603,7 @@ type StatementSpecialSelector =
1490
1603
  | ForStatement
1491
1604
  | IfStatement
1492
1605
  | LabeledStatement
1606
+ | MatchStatement
1493
1607
  | ReturnStatement
1494
1608
  | SwitchStatement
1495
1609
  | ThrowStatement
@@ -1511,7 +1625,21 @@ type DeclarationSpecialSelector =
1511
1625
  | InterfaceDeclaration
1512
1626
  | TypeParameterDeclaration
1513
1627
  | VariableDeclaration;
1514
- type PatternSpecialSelector = ArrayPattern | AssignmentPattern | ObjectPattern;
1628
+ type PatternSpecialSelector =
1629
+ | ArrayPattern
1630
+ | AssignmentPattern
1631
+ | MatchArrayPattern
1632
+ | MatchAsPattern
1633
+ | MatchBindingPattern
1634
+ | MatchIdentifierPattern
1635
+ | MatchLiteralPattern
1636
+ | MatchMemberPattern
1637
+ | MatchObjectPattern
1638
+ | MatchOrPattern
1639
+ | MatchRestPattern
1640
+ | MatchUnaryPattern
1641
+ | MatchWildcardPattern
1642
+ | ObjectPattern;
1515
1643
  type ExpressionSpecialSelector =
1516
1644
  | Identifier
1517
1645
  | MetaProperty
@@ -1531,6 +1659,7 @@ type ExpressionSpecialSelector =
1531
1659
  | JSXEmptyExpression
1532
1660
  | JSXMemberExpression
1533
1661
  | LogicalExpression
1662
+ | MatchExpression
1534
1663
  | MemberExpression
1535
1664
  | NewExpression
1536
1665
  | ObjectExpression
@@ -2205,6 +2334,79 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2205
2334
  +'LogicalExpression[operator]'?: (
2206
2335
  node: LogicalExpression_With_operator,
2207
2336
  ) => void,
2337
+ +MatchArrayPattern?: (node: MatchArrayPattern) => void,
2338
+ +'MatchArrayPattern[elements]'?: (
2339
+ node: MatchArrayPattern_With_elements,
2340
+ ) => void,
2341
+ +'MatchArrayPattern[rest]'?: (node: MatchArrayPattern_With_rest) => void,
2342
+ +MatchAsPattern?: (node: MatchAsPattern) => void,
2343
+ +'MatchAsPattern[pattern]'?: (node: MatchAsPattern_With_pattern) => void,
2344
+ +'MatchAsPattern[target]'?: (node: MatchAsPattern_With_target) => void,
2345
+ +MatchBindingPattern?: (node: MatchBindingPattern) => void,
2346
+ +'MatchBindingPattern[id]'?: (node: MatchBindingPattern_With_id) => void,
2347
+ +'MatchBindingPattern[kind]'?: (node: MatchBindingPattern_With_kind) => void,
2348
+ +MatchExpression?: (node: MatchExpression) => void,
2349
+ +'MatchExpression[argument]'?: (node: MatchExpression_With_argument) => void,
2350
+ +'MatchExpression[cases]'?: (node: MatchExpression_With_cases) => void,
2351
+ +MatchExpressionCase?: (node: MatchExpressionCase) => void,
2352
+ +'MatchExpressionCase[pattern]'?: (
2353
+ node: MatchExpressionCase_With_pattern,
2354
+ ) => void,
2355
+ +'MatchExpressionCase[body]'?: (node: MatchExpressionCase_With_body) => void,
2356
+ +'MatchExpressionCase[guard]'?: (
2357
+ node: MatchExpressionCase_With_guard,
2358
+ ) => void,
2359
+ +MatchIdentifierPattern?: (node: MatchIdentifierPattern) => void,
2360
+ +'MatchIdentifierPattern[id]'?: (
2361
+ node: MatchIdentifierPattern_With_id,
2362
+ ) => void,
2363
+ +MatchLiteralPattern?: (node: MatchLiteralPattern) => void,
2364
+ +'MatchLiteralPattern[literal]'?: (
2365
+ node: MatchLiteralPattern_With_literal,
2366
+ ) => void,
2367
+ +MatchMemberPattern?: (node: MatchMemberPattern) => void,
2368
+ +'MatchMemberPattern[base]'?: (node: MatchMemberPattern_With_base) => void,
2369
+ +'MatchMemberPattern[property]'?: (
2370
+ node: MatchMemberPattern_With_property,
2371
+ ) => void,
2372
+ +MatchObjectPattern?: (node: MatchObjectPattern) => void,
2373
+ +'MatchObjectPattern[properties]'?: (
2374
+ node: MatchObjectPattern_With_properties,
2375
+ ) => void,
2376
+ +'MatchObjectPattern[rest]'?: (node: MatchObjectPattern_With_rest) => void,
2377
+ +MatchObjectPatternProperty?: (node: MatchObjectPatternProperty) => void,
2378
+ +'MatchObjectPatternProperty[key]'?: (
2379
+ node: MatchObjectPatternProperty_With_key,
2380
+ ) => void,
2381
+ +'MatchObjectPatternProperty[pattern]'?: (
2382
+ node: MatchObjectPatternProperty_With_pattern,
2383
+ ) => void,
2384
+ +'MatchObjectPatternProperty[shorthand]'?: (
2385
+ node: MatchObjectPatternProperty_With_shorthand,
2386
+ ) => void,
2387
+ +MatchOrPattern?: (node: MatchOrPattern) => void,
2388
+ +'MatchOrPattern[patterns]'?: (node: MatchOrPattern_With_patterns) => void,
2389
+ +MatchRestPattern?: (node: MatchRestPattern) => void,
2390
+ +'MatchRestPattern[argument]'?: (
2391
+ node: MatchRestPattern_With_argument,
2392
+ ) => void,
2393
+ +MatchStatement?: (node: MatchStatement) => void,
2394
+ +'MatchStatement[argument]'?: (node: MatchStatement_With_argument) => void,
2395
+ +'MatchStatement[cases]'?: (node: MatchStatement_With_cases) => void,
2396
+ +MatchStatementCase?: (node: MatchStatementCase) => void,
2397
+ +'MatchStatementCase[pattern]'?: (
2398
+ node: MatchStatementCase_With_pattern,
2399
+ ) => void,
2400
+ +'MatchStatementCase[body]'?: (node: MatchStatementCase_With_body) => void,
2401
+ +'MatchStatementCase[guard]'?: (node: MatchStatementCase_With_guard) => void,
2402
+ +MatchUnaryPattern?: (node: MatchUnaryPattern) => void,
2403
+ +'MatchUnaryPattern[argument]'?: (
2404
+ node: MatchUnaryPattern_With_argument,
2405
+ ) => void,
2406
+ +'MatchUnaryPattern[operator]'?: (
2407
+ node: MatchUnaryPattern_With_operator,
2408
+ ) => void,
2409
+ +MatchWildcardPattern?: (node: MatchWildcardPattern) => void,
2208
2410
  +MemberExpression?: (node: MemberExpression) => void,
2209
2411
  +'MemberExpression[object]'?: (node: MemberExpression_With_object) => void,
2210
2412
  +'MemberExpression[property]'?: (
@@ -2416,6 +2618,8 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2416
2618
  ) => void,
2417
2619
  +SpreadElement?: (node: SpreadElement) => void,
2418
2620
  +'SpreadElement[argument]'?: (node: SpreadElement_With_argument) => void,
2621
+ +StaticBlock?: (node: StaticBlock) => void,
2622
+ +'StaticBlock[body]'?: (node: StaticBlock_With_body) => void,
2419
2623
  +StringLiteralTypeAnnotation?: (node: StringLiteralTypeAnnotation) => void,
2420
2624
  +'StringLiteralTypeAnnotation[value]'?: (
2421
2625
  node: StringLiteralTypeAnnotation_With_value,
@@ -2514,6 +2718,7 @@ export type ESQueryNodeSelectorsWithoutFallback = {
2514
2718
  ) => void,
2515
2719
  +TypeParameter?: (node: TypeParameter) => void,
2516
2720
  +'TypeParameter[name]'?: (node: TypeParameter_With_name) => void,
2721
+ +'TypeParameter[const]'?: (node: TypeParameter_With_const) => void,
2517
2722
  +'TypeParameter[bound]'?: (node: TypeParameter_With_bound) => void,
2518
2723
  +'TypeParameter[variance]'?: (node: TypeParameter_With_variance) => void,
2519
2724
  +'TypeParameter[default]'?: (node: TypeParameter_With_default) => void,
@@ -3294,6 +3499,99 @@ export type ESQueryNodeSelectorsWithoutFallback = {
3294
3499
  +'LogicalExpression[operator]:exit'?: (
3295
3500
  node: LogicalExpression_With_operator,
3296
3501
  ) => void,
3502
+ +'MatchArrayPattern:exit'?: (node: MatchArrayPattern) => void,
3503
+ +'MatchArrayPattern[elements]:exit'?: (
3504
+ node: MatchArrayPattern_With_elements,
3505
+ ) => void,
3506
+ +'MatchArrayPattern[rest]:exit'?: (node: MatchArrayPattern_With_rest) => void,
3507
+ +'MatchAsPattern:exit'?: (node: MatchAsPattern) => void,
3508
+ +'MatchAsPattern[pattern]:exit'?: (node: MatchAsPattern_With_pattern) => void,
3509
+ +'MatchAsPattern[target]:exit'?: (node: MatchAsPattern_With_target) => void,
3510
+ +'MatchBindingPattern:exit'?: (node: MatchBindingPattern) => void,
3511
+ +'MatchBindingPattern[id]:exit'?: (node: MatchBindingPattern_With_id) => void,
3512
+ +'MatchBindingPattern[kind]:exit'?: (
3513
+ node: MatchBindingPattern_With_kind,
3514
+ ) => void,
3515
+ +'MatchExpression:exit'?: (node: MatchExpression) => void,
3516
+ +'MatchExpression[argument]:exit'?: (
3517
+ node: MatchExpression_With_argument,
3518
+ ) => void,
3519
+ +'MatchExpression[cases]:exit'?: (node: MatchExpression_With_cases) => void,
3520
+ +'MatchExpressionCase:exit'?: (node: MatchExpressionCase) => void,
3521
+ +'MatchExpressionCase[pattern]:exit'?: (
3522
+ node: MatchExpressionCase_With_pattern,
3523
+ ) => void,
3524
+ +'MatchExpressionCase[body]:exit'?: (
3525
+ node: MatchExpressionCase_With_body,
3526
+ ) => void,
3527
+ +'MatchExpressionCase[guard]:exit'?: (
3528
+ node: MatchExpressionCase_With_guard,
3529
+ ) => void,
3530
+ +'MatchIdentifierPattern:exit'?: (node: MatchIdentifierPattern) => void,
3531
+ +'MatchIdentifierPattern[id]:exit'?: (
3532
+ node: MatchIdentifierPattern_With_id,
3533
+ ) => void,
3534
+ +'MatchLiteralPattern:exit'?: (node: MatchLiteralPattern) => void,
3535
+ +'MatchLiteralPattern[literal]:exit'?: (
3536
+ node: MatchLiteralPattern_With_literal,
3537
+ ) => void,
3538
+ +'MatchMemberPattern:exit'?: (node: MatchMemberPattern) => void,
3539
+ +'MatchMemberPattern[base]:exit'?: (
3540
+ node: MatchMemberPattern_With_base,
3541
+ ) => void,
3542
+ +'MatchMemberPattern[property]:exit'?: (
3543
+ node: MatchMemberPattern_With_property,
3544
+ ) => void,
3545
+ +'MatchObjectPattern:exit'?: (node: MatchObjectPattern) => void,
3546
+ +'MatchObjectPattern[properties]:exit'?: (
3547
+ node: MatchObjectPattern_With_properties,
3548
+ ) => void,
3549
+ +'MatchObjectPattern[rest]:exit'?: (
3550
+ node: MatchObjectPattern_With_rest,
3551
+ ) => void,
3552
+ +'MatchObjectPatternProperty:exit'?: (
3553
+ node: MatchObjectPatternProperty,
3554
+ ) => void,
3555
+ +'MatchObjectPatternProperty[key]:exit'?: (
3556
+ node: MatchObjectPatternProperty_With_key,
3557
+ ) => void,
3558
+ +'MatchObjectPatternProperty[pattern]:exit'?: (
3559
+ node: MatchObjectPatternProperty_With_pattern,
3560
+ ) => void,
3561
+ +'MatchObjectPatternProperty[shorthand]:exit'?: (
3562
+ node: MatchObjectPatternProperty_With_shorthand,
3563
+ ) => void,
3564
+ +'MatchOrPattern:exit'?: (node: MatchOrPattern) => void,
3565
+ +'MatchOrPattern[patterns]:exit'?: (
3566
+ node: MatchOrPattern_With_patterns,
3567
+ ) => void,
3568
+ +'MatchRestPattern:exit'?: (node: MatchRestPattern) => void,
3569
+ +'MatchRestPattern[argument]:exit'?: (
3570
+ node: MatchRestPattern_With_argument,
3571
+ ) => void,
3572
+ +'MatchStatement:exit'?: (node: MatchStatement) => void,
3573
+ +'MatchStatement[argument]:exit'?: (
3574
+ node: MatchStatement_With_argument,
3575
+ ) => void,
3576
+ +'MatchStatement[cases]:exit'?: (node: MatchStatement_With_cases) => void,
3577
+ +'MatchStatementCase:exit'?: (node: MatchStatementCase) => void,
3578
+ +'MatchStatementCase[pattern]:exit'?: (
3579
+ node: MatchStatementCase_With_pattern,
3580
+ ) => void,
3581
+ +'MatchStatementCase[body]:exit'?: (
3582
+ node: MatchStatementCase_With_body,
3583
+ ) => void,
3584
+ +'MatchStatementCase[guard]:exit'?: (
3585
+ node: MatchStatementCase_With_guard,
3586
+ ) => void,
3587
+ +'MatchUnaryPattern:exit'?: (node: MatchUnaryPattern) => void,
3588
+ +'MatchUnaryPattern[argument]:exit'?: (
3589
+ node: MatchUnaryPattern_With_argument,
3590
+ ) => void,
3591
+ +'MatchUnaryPattern[operator]:exit'?: (
3592
+ node: MatchUnaryPattern_With_operator,
3593
+ ) => void,
3594
+ +'MatchWildcardPattern:exit'?: (node: MatchWildcardPattern) => void,
3297
3595
  +'MemberExpression:exit'?: (node: MemberExpression) => void,
3298
3596
  +'MemberExpression[object]:exit'?: (
3299
3597
  node: MemberExpression_With_object,
@@ -3531,6 +3829,8 @@ export type ESQueryNodeSelectorsWithoutFallback = {
3531
3829
  ) => void,
3532
3830
  +'SpreadElement:exit'?: (node: SpreadElement) => void,
3533
3831
  +'SpreadElement[argument]:exit'?: (node: SpreadElement_With_argument) => void,
3832
+ +'StaticBlock:exit'?: (node: StaticBlock) => void,
3833
+ +'StaticBlock[body]:exit'?: (node: StaticBlock_With_body) => void,
3534
3834
  +'StringLiteralTypeAnnotation:exit'?: (
3535
3835
  node: StringLiteralTypeAnnotation,
3536
3836
  ) => void,
@@ -3635,6 +3935,7 @@ export type ESQueryNodeSelectorsWithoutFallback = {
3635
3935
  ) => void,
3636
3936
  +'TypeParameter:exit'?: (node: TypeParameter) => void,
3637
3937
  +'TypeParameter[name]:exit'?: (node: TypeParameter_With_name) => void,
3938
+ +'TypeParameter[const]:exit'?: (node: TypeParameter_With_const) => void,
3638
3939
  +'TypeParameter[bound]:exit'?: (node: TypeParameter_With_bound) => void,
3639
3940
  +'TypeParameter[variance]:exit'?: (node: TypeParameter_With_variance) => void,
3640
3941
  +'TypeParameter[default]:exit'?: (node: TypeParameter_With_default) => void,
@@ -141,6 +141,22 @@ import type {
141
141
  KeyofTypeAnnotation,
142
142
  LabeledStatement,
143
143
  LogicalExpression,
144
+ MatchArrayPattern,
145
+ MatchAsPattern,
146
+ MatchBindingPattern,
147
+ MatchExpression,
148
+ MatchExpressionCase,
149
+ MatchIdentifierPattern,
150
+ MatchLiteralPattern,
151
+ MatchMemberPattern,
152
+ MatchObjectPattern,
153
+ MatchObjectPatternProperty,
154
+ MatchOrPattern,
155
+ MatchRestPattern,
156
+ MatchStatement,
157
+ MatchStatementCase,
158
+ MatchUnaryPattern,
159
+ MatchWildcardPattern,
144
160
  MemberExpression,
145
161
  MetaProperty,
146
162
  MethodDefinition,
@@ -171,6 +187,7 @@ import type {
171
187
  ReturnStatement,
172
188
  SequenceExpression,
173
189
  SpreadElement,
190
+ StaticBlock,
174
191
  StringLiteralTypeAnnotation,
175
192
  StringTypeAnnotation,
176
193
  Super,
@@ -398,6 +415,22 @@ exports.isLogicalOREqualToken = isLogicalOREqualToken;
398
415
  exports.isLogicalORToken = isLogicalORToken;
399
416
  exports.isLooseEqualToken = isLooseEqualToken;
400
417
  exports.isLooseNotEqualToken = isLooseNotEqualToken;
418
+ exports.isMatchArrayPattern = isMatchArrayPattern;
419
+ exports.isMatchAsPattern = isMatchAsPattern;
420
+ exports.isMatchBindingPattern = isMatchBindingPattern;
421
+ exports.isMatchExpression = isMatchExpression;
422
+ exports.isMatchExpressionCase = isMatchExpressionCase;
423
+ exports.isMatchIdentifierPattern = isMatchIdentifierPattern;
424
+ exports.isMatchLiteralPattern = isMatchLiteralPattern;
425
+ exports.isMatchMemberPattern = isMatchMemberPattern;
426
+ exports.isMatchObjectPattern = isMatchObjectPattern;
427
+ exports.isMatchObjectPatternProperty = isMatchObjectPatternProperty;
428
+ exports.isMatchOrPattern = isMatchOrPattern;
429
+ exports.isMatchRestPattern = isMatchRestPattern;
430
+ exports.isMatchStatement = isMatchStatement;
431
+ exports.isMatchStatementCase = isMatchStatementCase;
432
+ exports.isMatchUnaryPattern = isMatchUnaryPattern;
433
+ exports.isMatchWildcardPattern = isMatchWildcardPattern;
401
434
  exports.isMemberExpression = isMemberExpression;
402
435
  exports.isMetaProperty = isMetaProperty;
403
436
  exports.isMethodDefinition = isMethodDefinition;
@@ -448,6 +481,7 @@ exports.isSemicolonToken = isSemicolonToken;
448
481
  exports.isSequenceExpression = isSequenceExpression;
449
482
  exports.isSetKeyword = isSetKeyword;
450
483
  exports.isSpreadElement = isSpreadElement;
484
+ exports.isStaticBlock = isStaticBlock;
451
485
  exports.isStaticToken = isStaticToken;
452
486
  exports.isStrictEqualToken = isStrictEqualToken;
453
487
  exports.isStrictNotEqualToken = isStrictNotEqualToken;
@@ -1381,6 +1415,134 @@ function isLogicalExpression(node
1381
1415
  return node.type === 'LogicalExpression';
1382
1416
  }
1383
1417
 
1418
+ function isMatchArrayPattern(node
1419
+ /*: ESNode | Token */
1420
+ )
1421
+ /*: implies node is MatchArrayPattern */
1422
+ {
1423
+ return node.type === 'MatchArrayPattern';
1424
+ }
1425
+
1426
+ function isMatchAsPattern(node
1427
+ /*: ESNode | Token */
1428
+ )
1429
+ /*: implies node is MatchAsPattern */
1430
+ {
1431
+ return node.type === 'MatchAsPattern';
1432
+ }
1433
+
1434
+ function isMatchBindingPattern(node
1435
+ /*: ESNode | Token */
1436
+ )
1437
+ /*: implies node is MatchBindingPattern */
1438
+ {
1439
+ return node.type === 'MatchBindingPattern';
1440
+ }
1441
+
1442
+ function isMatchExpression(node
1443
+ /*: ESNode | Token */
1444
+ )
1445
+ /*: implies node is MatchExpression */
1446
+ {
1447
+ return node.type === 'MatchExpression';
1448
+ }
1449
+
1450
+ function isMatchExpressionCase(node
1451
+ /*: ESNode | Token */
1452
+ )
1453
+ /*: implies node is MatchExpressionCase */
1454
+ {
1455
+ return node.type === 'MatchExpressionCase';
1456
+ }
1457
+
1458
+ function isMatchIdentifierPattern(node
1459
+ /*: ESNode | Token */
1460
+ )
1461
+ /*: implies node is MatchIdentifierPattern */
1462
+ {
1463
+ return node.type === 'MatchIdentifierPattern';
1464
+ }
1465
+
1466
+ function isMatchLiteralPattern(node
1467
+ /*: ESNode | Token */
1468
+ )
1469
+ /*: implies node is MatchLiteralPattern */
1470
+ {
1471
+ return node.type === 'MatchLiteralPattern';
1472
+ }
1473
+
1474
+ function isMatchMemberPattern(node
1475
+ /*: ESNode | Token */
1476
+ )
1477
+ /*: implies node is MatchMemberPattern */
1478
+ {
1479
+ return node.type === 'MatchMemberPattern';
1480
+ }
1481
+
1482
+ function isMatchObjectPattern(node
1483
+ /*: ESNode | Token */
1484
+ )
1485
+ /*: implies node is MatchObjectPattern */
1486
+ {
1487
+ return node.type === 'MatchObjectPattern';
1488
+ }
1489
+
1490
+ function isMatchObjectPatternProperty(node
1491
+ /*: ESNode | Token */
1492
+ )
1493
+ /*: implies node is MatchObjectPatternProperty */
1494
+ {
1495
+ return node.type === 'MatchObjectPatternProperty';
1496
+ }
1497
+
1498
+ function isMatchOrPattern(node
1499
+ /*: ESNode | Token */
1500
+ )
1501
+ /*: implies node is MatchOrPattern */
1502
+ {
1503
+ return node.type === 'MatchOrPattern';
1504
+ }
1505
+
1506
+ function isMatchRestPattern(node
1507
+ /*: ESNode | Token */
1508
+ )
1509
+ /*: implies node is MatchRestPattern */
1510
+ {
1511
+ return node.type === 'MatchRestPattern';
1512
+ }
1513
+
1514
+ function isMatchStatement(node
1515
+ /*: ESNode | Token */
1516
+ )
1517
+ /*: implies node is MatchStatement */
1518
+ {
1519
+ return node.type === 'MatchStatement';
1520
+ }
1521
+
1522
+ function isMatchStatementCase(node
1523
+ /*: ESNode | Token */
1524
+ )
1525
+ /*: implies node is MatchStatementCase */
1526
+ {
1527
+ return node.type === 'MatchStatementCase';
1528
+ }
1529
+
1530
+ function isMatchUnaryPattern(node
1531
+ /*: ESNode | Token */
1532
+ )
1533
+ /*: implies node is MatchUnaryPattern */
1534
+ {
1535
+ return node.type === 'MatchUnaryPattern';
1536
+ }
1537
+
1538
+ function isMatchWildcardPattern(node
1539
+ /*: ESNode | Token */
1540
+ )
1541
+ /*: implies node is MatchWildcardPattern */
1542
+ {
1543
+ return node.type === 'MatchWildcardPattern';
1544
+ }
1545
+
1384
1546
  function isMemberExpression(node
1385
1547
  /*: ESNode | Token */
1386
1548
  )
@@ -1621,6 +1783,14 @@ function isSpreadElement(node
1621
1783
  return node.type === 'SpreadElement';
1622
1784
  }
1623
1785
 
1786
+ function isStaticBlock(node
1787
+ /*: ESNode | Token */
1788
+ )
1789
+ /*: implies node is StaticBlock */
1790
+ {
1791
+ return node.type === 'StaticBlock';
1792
+ }
1793
+
1624
1794
  function isStringLiteralTypeAnnotation(node
1625
1795
  /*: ESNode | Token */
1626
1796
  )
@@ -142,6 +142,22 @@ import type {
142
142
  KeyofTypeAnnotation,
143
143
  LabeledStatement,
144
144
  LogicalExpression,
145
+ MatchArrayPattern,
146
+ MatchAsPattern,
147
+ MatchBindingPattern,
148
+ MatchExpression,
149
+ MatchExpressionCase,
150
+ MatchIdentifierPattern,
151
+ MatchLiteralPattern,
152
+ MatchMemberPattern,
153
+ MatchObjectPattern,
154
+ MatchObjectPatternProperty,
155
+ MatchOrPattern,
156
+ MatchRestPattern,
157
+ MatchStatement,
158
+ MatchStatementCase,
159
+ MatchUnaryPattern,
160
+ MatchWildcardPattern,
145
161
  MemberExpression,
146
162
  MetaProperty,
147
163
  MethodDefinition,
@@ -172,6 +188,7 @@ import type {
172
188
  ReturnStatement,
173
189
  SequenceExpression,
174
190
  SpreadElement,
191
+ StaticBlock,
175
192
  StringLiteralTypeAnnotation,
176
193
  StringTypeAnnotation,
177
194
  Super,
@@ -765,6 +782,86 @@ export function isLogicalExpression(node /*: ESNode | Token */) /*: implies node
765
782
  }
766
783
 
767
784
 
785
+ export function isMatchArrayPattern(node /*: ESNode | Token */) /*: implies node is MatchArrayPattern */ {
786
+ return node.type === 'MatchArrayPattern';
787
+ }
788
+
789
+
790
+ export function isMatchAsPattern(node /*: ESNode | Token */) /*: implies node is MatchAsPattern */ {
791
+ return node.type === 'MatchAsPattern';
792
+ }
793
+
794
+
795
+ export function isMatchBindingPattern(node /*: ESNode | Token */) /*: implies node is MatchBindingPattern */ {
796
+ return node.type === 'MatchBindingPattern';
797
+ }
798
+
799
+
800
+ export function isMatchExpression(node /*: ESNode | Token */) /*: implies node is MatchExpression */ {
801
+ return node.type === 'MatchExpression';
802
+ }
803
+
804
+
805
+ export function isMatchExpressionCase(node /*: ESNode | Token */) /*: implies node is MatchExpressionCase */ {
806
+ return node.type === 'MatchExpressionCase';
807
+ }
808
+
809
+
810
+ export function isMatchIdentifierPattern(node /*: ESNode | Token */) /*: implies node is MatchIdentifierPattern */ {
811
+ return node.type === 'MatchIdentifierPattern';
812
+ }
813
+
814
+
815
+ export function isMatchLiteralPattern(node /*: ESNode | Token */) /*: implies node is MatchLiteralPattern */ {
816
+ return node.type === 'MatchLiteralPattern';
817
+ }
818
+
819
+
820
+ export function isMatchMemberPattern(node /*: ESNode | Token */) /*: implies node is MatchMemberPattern */ {
821
+ return node.type === 'MatchMemberPattern';
822
+ }
823
+
824
+
825
+ export function isMatchObjectPattern(node /*: ESNode | Token */) /*: implies node is MatchObjectPattern */ {
826
+ return node.type === 'MatchObjectPattern';
827
+ }
828
+
829
+
830
+ export function isMatchObjectPatternProperty(node /*: ESNode | Token */) /*: implies node is MatchObjectPatternProperty */ {
831
+ return node.type === 'MatchObjectPatternProperty';
832
+ }
833
+
834
+
835
+ export function isMatchOrPattern(node /*: ESNode | Token */) /*: implies node is MatchOrPattern */ {
836
+ return node.type === 'MatchOrPattern';
837
+ }
838
+
839
+
840
+ export function isMatchRestPattern(node /*: ESNode | Token */) /*: implies node is MatchRestPattern */ {
841
+ return node.type === 'MatchRestPattern';
842
+ }
843
+
844
+
845
+ export function isMatchStatement(node /*: ESNode | Token */) /*: implies node is MatchStatement */ {
846
+ return node.type === 'MatchStatement';
847
+ }
848
+
849
+
850
+ export function isMatchStatementCase(node /*: ESNode | Token */) /*: implies node is MatchStatementCase */ {
851
+ return node.type === 'MatchStatementCase';
852
+ }
853
+
854
+
855
+ export function isMatchUnaryPattern(node /*: ESNode | Token */) /*: implies node is MatchUnaryPattern */ {
856
+ return node.type === 'MatchUnaryPattern';
857
+ }
858
+
859
+
860
+ export function isMatchWildcardPattern(node /*: ESNode | Token */) /*: implies node is MatchWildcardPattern */ {
861
+ return node.type === 'MatchWildcardPattern';
862
+ }
863
+
864
+
768
865
  export function isMemberExpression(node /*: ESNode | Token */) /*: implies node is MemberExpression */ {
769
866
  return node.type === 'MemberExpression';
770
867
  }
@@ -915,6 +1012,11 @@ export function isSpreadElement(node /*: ESNode | Token */) /*: implies node is
915
1012
  }
916
1013
 
917
1014
 
1015
+ export function isStaticBlock(node /*: ESNode | Token */) /*: implies node is StaticBlock */ {
1016
+ return node.type === 'StaticBlock';
1017
+ }
1018
+
1019
+
918
1020
  export function isStringLiteralTypeAnnotation(node /*: ESNode | Token */) /*: implies node is StringLiteralTypeAnnotation */ {
919
1021
  return node.type === 'StringLiteralTypeAnnotation';
920
1022
  }
@@ -203,6 +203,12 @@ export type ESNode =
203
203
  | EnumSymbolBody
204
204
  | DeclaredNode
205
205
  | ObjectTypeInternalSlot
206
+ // Match
207
+ | MatchPattern
208
+ | MatchRestPattern
209
+ | MatchObjectPatternProperty
210
+ | MatchExpressionCase
211
+ | MatchStatementCase
206
212
  // JSX
207
213
  | JSXNode;
208
214
 
@@ -262,13 +268,15 @@ export type Statement =
262
268
  | LabeledStatement
263
269
  | OpaqueType
264
270
  | ReturnStatement
271
+ | StaticBlock
265
272
  | SwitchStatement
266
273
  | ThrowStatement
267
274
  | TryStatement
268
275
  | TypeAlias
269
276
  | VariableDeclaration
270
277
  | WhileStatement
271
- | WithStatement;
278
+ | WithStatement
279
+ | MatchStatement;
272
280
 
273
281
  // nodes that can be the direct parent of a statement
274
282
  export type StatementParentSingle =
@@ -281,7 +289,11 @@ export type StatementParentSingle =
281
289
  | ForInStatement
282
290
  | ForOfStatement;
283
291
  // nodes that can be the parent of a statement that store the statements in an array
284
- export type StatementParentArray = SwitchCase | Program | BlockStatement;
292
+ export type StatementParentArray =
293
+ | SwitchCase
294
+ | Program
295
+ | BlockStatement
296
+ | StaticBlock;
285
297
  export type StatementParent = StatementParentSingle | StatementParentArray;
286
298
 
287
299
  export interface EmptyStatement extends BaseNode {
@@ -293,6 +305,11 @@ export interface BlockStatement extends BaseNode {
293
305
  +body: $ReadOnlyArray<Statement>;
294
306
  }
295
307
 
308
+ export interface StaticBlock extends BaseNode {
309
+ +type: 'StaticBlock';
310
+ +body: $ReadOnlyArray<Statement>;
311
+ }
312
+
296
313
  export interface ExpressionStatement extends BaseNode {
297
314
  +type: 'ExpressionStatement';
298
315
  +expression: Expression;
@@ -468,6 +485,7 @@ export type Expression =
468
485
  | TypeCastExpression
469
486
  | AsExpression
470
487
  | AsConstExpression
488
+ | MatchExpression
471
489
  | JSXFragment
472
490
  | JSXElement;
473
491
 
@@ -910,7 +928,7 @@ export type ClassPropertyNameNonComputed =
910
928
  | Identifier
911
929
  | StringLiteral;
912
930
 
913
- export type ClassMember = PropertyDefinition | MethodDefinition;
931
+ export type ClassMember = PropertyDefinition | MethodDefinition | StaticBlock;
914
932
  export type ClassMemberWithNonComputedName =
915
933
  | PropertyDefinitionWithNonComputedName
916
934
  | MethodDefinitionConstructor
@@ -1588,6 +1606,7 @@ export interface TypeParameterDeclaration extends BaseNode {
1588
1606
  export interface TypeParameter extends BaseNode {
1589
1607
  +type: 'TypeParameter';
1590
1608
  +name: string;
1609
+ +const: boolean;
1591
1610
  +bound: null | TypeAnnotation;
1592
1611
  +variance: null | Variance;
1593
1612
  +default: null | TypeAnnotationType;
@@ -1991,6 +2010,106 @@ export interface JSXSpreadChild extends BaseNode {
1991
2010
  +expression: Expression;
1992
2011
  }
1993
2012
 
2013
+ /************************************
2014
+ * Match expressions and statements *
2015
+ ************************************/
2016
+
2017
+ export interface MatchExpression extends BaseNode {
2018
+ +type: 'MatchExpression';
2019
+ +argument: Expression;
2020
+ +cases: $ReadOnlyArray<MatchExpressionCase>;
2021
+ }
2022
+ export interface MatchExpressionCase extends BaseNode {
2023
+ +type: 'MatchExpressionCase';
2024
+ +pattern: MatchPattern;
2025
+ +body: Expression;
2026
+ +guard: Expression | null;
2027
+ }
2028
+
2029
+ export interface MatchStatement extends BaseNode {
2030
+ +type: 'MatchStatement';
2031
+ +argument: Expression;
2032
+ +cases: $ReadOnlyArray<MatchStatementCase>;
2033
+ }
2034
+ export interface MatchStatementCase extends BaseNode {
2035
+ +type: 'MatchStatementCase';
2036
+ +pattern: MatchPattern;
2037
+ +body: BlockStatement;
2038
+ +guard: Expression | null;
2039
+ }
2040
+
2041
+ /******************
2042
+ * Match patterns *
2043
+ ******************/
2044
+
2045
+ export type MatchPattern =
2046
+ | MatchOrPattern
2047
+ | MatchAsPattern
2048
+ | MatchWildcardPattern
2049
+ | MatchLiteralPattern
2050
+ | MatchUnaryPattern
2051
+ | MatchIdentifierPattern
2052
+ | MatchMemberPattern
2053
+ | MatchBindingPattern
2054
+ | MatchObjectPattern
2055
+ | MatchArrayPattern;
2056
+
2057
+ export interface MatchOrPattern extends BaseNode {
2058
+ +type: 'MatchOrPattern';
2059
+ +patterns: $ReadOnlyArray<MatchPattern>;
2060
+ }
2061
+ export interface MatchAsPattern extends BaseNode {
2062
+ +type: 'MatchAsPattern';
2063
+ +pattern: MatchPattern;
2064
+ +target: Identifier | MatchBindingPattern;
2065
+ }
2066
+ export interface MatchWildcardPattern extends BaseNode {
2067
+ +type: 'MatchWildcardPattern';
2068
+ }
2069
+ export interface MatchLiteralPattern extends BaseNode {
2070
+ +type: 'MatchLiteralPattern';
2071
+ +literal: Literal;
2072
+ }
2073
+ export interface MatchUnaryPattern extends BaseNode {
2074
+ +type: 'MatchUnaryPattern';
2075
+ +argument: Literal;
2076
+ +operator: '-' | '+';
2077
+ }
2078
+ export interface MatchIdentifierPattern extends BaseNode {
2079
+ +type: 'MatchIdentifierPattern';
2080
+ +id: Identifier;
2081
+ }
2082
+ export interface MatchMemberPattern extends BaseNode {
2083
+ +type: 'MatchMemberPattern';
2084
+ +base: MatchIdentifierPattern | MatchMemberPattern;
2085
+ +property: Identifier | StringLiteral | NumericLiteral | BigIntLiteral;
2086
+ }
2087
+ export interface MatchBindingPattern extends BaseNode {
2088
+ +type: 'MatchBindingPattern';
2089
+ +id: Identifier;
2090
+ +kind: 'let' | 'const' | 'var';
2091
+ }
2092
+ export interface MatchObjectPattern extends BaseNode {
2093
+ +type: 'MatchObjectPattern';
2094
+ +properties: $ReadOnlyArray<MatchObjectPatternProperty>;
2095
+ +rest: MatchRestPattern | null;
2096
+ }
2097
+ export interface MatchObjectPatternProperty extends BaseNode {
2098
+ +type: 'MatchObjectPatternProperty';
2099
+ +key: Identifier | StringLiteral | NumericLiteral | BigIntLiteral;
2100
+ +pattern: MatchPattern;
2101
+ +shorthand: boolean;
2102
+ }
2103
+ export interface MatchArrayPattern extends BaseNode {
2104
+ +type: 'MatchArrayPattern';
2105
+ +elements: $ReadOnlyArray<MatchPattern>;
2106
+ +rest: MatchRestPattern | null;
2107
+ }
2108
+ export interface MatchRestPattern extends BaseNode {
2109
+ +type: 'MatchRestPattern';
2110
+ +argument: MatchBindingPattern | null;
2111
+ }
2112
+
1994
2113
  /******************************************************
1995
2114
  * Deprecated spec nodes awaiting migration by Hermes *
1996
2115
  ******************************************************/
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-estree",
3
- "version": "0.25.0",
3
+ "version": "0.26.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",