hermes-estree 0.8.0 → 0.9.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.
- package/dist/types.js.flow +99 -23
- package/package.json +4 -2
package/dist/types.js.flow
CHANGED
|
@@ -221,34 +221,35 @@ export type AFunction =
|
|
|
221
221
|
| ArrowFunctionExpression;
|
|
222
222
|
|
|
223
223
|
export type Statement =
|
|
224
|
-
| ExpressionStatement
|
|
225
224
|
| BlockStatement
|
|
226
|
-
| EmptyStatement
|
|
227
|
-
| DebuggerStatement
|
|
228
|
-
| WithStatement
|
|
229
|
-
| ReturnStatement
|
|
230
|
-
| LabeledStatement
|
|
231
225
|
| BreakStatement
|
|
226
|
+
| ClassDeclaration
|
|
232
227
|
| ContinueStatement
|
|
228
|
+
| DebuggerStatement
|
|
229
|
+
| DeclareInterface
|
|
230
|
+
| DeclareModule
|
|
231
|
+
| DeclareOpaqueType
|
|
232
|
+
| DeclareTypeAlias
|
|
233
|
+
| DoWhileStatement
|
|
234
|
+
| EmptyStatement
|
|
235
|
+
| EnumDeclaration
|
|
236
|
+
| ExpressionStatement
|
|
237
|
+
| ForInStatement
|
|
238
|
+
| ForOfStatement
|
|
239
|
+
| ForStatement
|
|
240
|
+
| FunctionDeclaration
|
|
233
241
|
| IfStatement
|
|
242
|
+
| InterfaceDeclaration
|
|
243
|
+
| LabeledStatement
|
|
244
|
+
| OpaqueType
|
|
245
|
+
| ReturnStatement
|
|
234
246
|
| SwitchStatement
|
|
235
247
|
| ThrowStatement
|
|
236
248
|
| TryStatement
|
|
237
|
-
| WhileStatement
|
|
238
|
-
| DoWhileStatement
|
|
239
|
-
| ForStatement
|
|
240
|
-
| ForInStatement
|
|
241
|
-
| ForOfStatement
|
|
242
249
|
| TypeAlias
|
|
243
|
-
| OpaqueType
|
|
244
|
-
| InterfaceDeclaration
|
|
245
|
-
| FunctionDeclaration
|
|
246
250
|
| VariableDeclaration
|
|
247
|
-
|
|
|
248
|
-
|
|
|
249
|
-
| DeclareOpaqueType
|
|
250
|
-
| DeclareInterface
|
|
251
|
-
| DeclareModule;
|
|
251
|
+
| WhileStatement
|
|
252
|
+
| WithStatement;
|
|
252
253
|
|
|
253
254
|
// nodes that can be the direct parent of a statement
|
|
254
255
|
export type StatementParentSingle =
|
|
@@ -388,6 +389,8 @@ export interface VariableDeclarator extends BaseNode {
|
|
|
388
389
|
+type: 'VariableDeclarator';
|
|
389
390
|
+id: BindingName;
|
|
390
391
|
+init?: Expression | null;
|
|
392
|
+
|
|
393
|
+
+parent: VariableDeclaration;
|
|
391
394
|
}
|
|
392
395
|
|
|
393
396
|
export type Expression =
|
|
@@ -445,7 +448,11 @@ export type ObjectProperty =
|
|
|
445
448
|
| ObjectPropertyWithNonShorthandStaticName
|
|
446
449
|
| ObjectPropertyWithShorthandStaticName
|
|
447
450
|
| ObjectPropertyWithComputedName;
|
|
448
|
-
|
|
451
|
+
interface ObjectPropertyBase extends BaseNode {
|
|
452
|
+
+parent: ObjectExpression | ObjectPattern;
|
|
453
|
+
}
|
|
454
|
+
export interface ObjectPropertyWithNonShorthandStaticName
|
|
455
|
+
extends ObjectPropertyBase {
|
|
449
456
|
+type: 'Property';
|
|
450
457
|
+computed: false;
|
|
451
458
|
// non-computed, non-shorthand names are constrained significantly
|
|
@@ -455,7 +462,8 @@ export interface ObjectPropertyWithNonShorthandStaticName extends BaseNode {
|
|
|
455
462
|
+method: boolean;
|
|
456
463
|
+shorthand: false;
|
|
457
464
|
}
|
|
458
|
-
export interface ObjectPropertyWithShorthandStaticName
|
|
465
|
+
export interface ObjectPropertyWithShorthandStaticName
|
|
466
|
+
extends ObjectPropertyBase {
|
|
459
467
|
+type: 'Property';
|
|
460
468
|
+computed: false;
|
|
461
469
|
// shorthand keys *must* be identifiers
|
|
@@ -466,7 +474,7 @@ export interface ObjectPropertyWithShorthandStaticName extends BaseNode {
|
|
|
466
474
|
+method: boolean;
|
|
467
475
|
+shorthand: true;
|
|
468
476
|
}
|
|
469
|
-
export interface ObjectPropertyWithComputedName extends
|
|
477
|
+
export interface ObjectPropertyWithComputedName extends ObjectPropertyBase {
|
|
470
478
|
+type: 'Property';
|
|
471
479
|
+computed: true;
|
|
472
480
|
// computed names can be any expression
|
|
@@ -486,6 +494,8 @@ interface DestructuringObjectPropertyBase extends BaseNode {
|
|
|
486
494
|
// destructuring properties cannot be methods
|
|
487
495
|
+kind: 'init';
|
|
488
496
|
+method: false;
|
|
497
|
+
|
|
498
|
+
+parent: ObjectExpression | ObjectPattern;
|
|
489
499
|
}
|
|
490
500
|
export interface DestructuringObjectPropertyWithNonShorthandStaticName
|
|
491
501
|
extends DestructuringObjectPropertyBase {
|
|
@@ -862,6 +872,8 @@ export type ClassMemberWithNonComputedName =
|
|
|
862
872
|
export interface ClassBody extends BaseNode {
|
|
863
873
|
+type: 'ClassBody';
|
|
864
874
|
+body: $ReadOnlyArray<ClassMember>;
|
|
875
|
+
|
|
876
|
+
+parent: AClass;
|
|
865
877
|
}
|
|
866
878
|
|
|
867
879
|
export type MethodDefinition =
|
|
@@ -870,6 +882,8 @@ export type MethodDefinition =
|
|
|
870
882
|
| MethodDefinitionWithNonComputedName;
|
|
871
883
|
interface MethodDefinitionBase extends BaseNode {
|
|
872
884
|
+value: FunctionExpression;
|
|
885
|
+
|
|
886
|
+
+parent: ClassBody;
|
|
873
887
|
}
|
|
874
888
|
export interface MethodDefinitionConstructor extends MethodDefinitionBase {
|
|
875
889
|
+type: 'MethodDefinition';
|
|
@@ -906,6 +920,8 @@ interface PropertyDefinitionBase extends BaseNode {
|
|
|
906
920
|
+declare: boolean;
|
|
907
921
|
// hermes always emit this as false
|
|
908
922
|
+optional: false;
|
|
923
|
+
|
|
924
|
+
+parent: ClassBody;
|
|
909
925
|
}
|
|
910
926
|
export interface PropertyDefinitionWithComputedName
|
|
911
927
|
extends PropertyDefinitionBase {
|
|
@@ -966,6 +982,8 @@ export interface ImportAttribute extends BaseNode {
|
|
|
966
982
|
+type: 'ImportAttribute';
|
|
967
983
|
+key: Identifier;
|
|
968
984
|
+value: StringLiteral;
|
|
985
|
+
|
|
986
|
+
+parent: ImportDeclaration | ImportExpression;
|
|
969
987
|
}
|
|
970
988
|
|
|
971
989
|
export interface ImportSpecifier extends BaseNode {
|
|
@@ -973,6 +991,8 @@ export interface ImportSpecifier extends BaseNode {
|
|
|
973
991
|
+imported: Identifier;
|
|
974
992
|
+local: Identifier;
|
|
975
993
|
+importKind: null | 'type' | 'typeof';
|
|
994
|
+
|
|
995
|
+
+parent: ImportDeclaration;
|
|
976
996
|
}
|
|
977
997
|
|
|
978
998
|
export interface ImportExpression extends BaseNode {
|
|
@@ -984,11 +1004,15 @@ export interface ImportExpression extends BaseNode {
|
|
|
984
1004
|
export interface ImportDefaultSpecifier extends BaseNode {
|
|
985
1005
|
+type: 'ImportDefaultSpecifier';
|
|
986
1006
|
+local: Identifier;
|
|
1007
|
+
|
|
1008
|
+
+parent: ImportDeclaration;
|
|
987
1009
|
}
|
|
988
1010
|
|
|
989
1011
|
export interface ImportNamespaceSpecifier extends BaseNode {
|
|
990
1012
|
+type: 'ImportNamespaceSpecifier';
|
|
991
1013
|
+local: Identifier;
|
|
1014
|
+
|
|
1015
|
+
+parent: ImportDeclaration;
|
|
992
1016
|
}
|
|
993
1017
|
|
|
994
1018
|
export type DefaultDeclaration = FunctionDeclaration | ClassDeclaration;
|
|
@@ -1183,6 +1207,8 @@ export interface ObjectTypeInternalSlot extends BaseNode {
|
|
|
1183
1207
|
+static: boolean;
|
|
1184
1208
|
+method: boolean;
|
|
1185
1209
|
+value: TypeAnnotation;
|
|
1210
|
+
|
|
1211
|
+
+parent: ObjectTypeAnnotation;
|
|
1186
1212
|
}
|
|
1187
1213
|
|
|
1188
1214
|
export interface InterfaceTypeAnnotation extends BaseInterfaceNode {
|
|
@@ -1211,9 +1237,13 @@ export interface FunctionTypeParam extends BaseNode {
|
|
|
1211
1237
|
+name: Identifier | null;
|
|
1212
1238
|
+typeAnnotation: TypeAnnotationType;
|
|
1213
1239
|
+optional: boolean;
|
|
1240
|
+
|
|
1241
|
+
+parent: FunctionTypeAnnotation;
|
|
1214
1242
|
}
|
|
1215
1243
|
export interface InferredPredicate extends BaseNode {
|
|
1216
1244
|
+type: 'InferredPredicate';
|
|
1245
|
+
|
|
1246
|
+
+parent: AFunction | DeclareFunction;
|
|
1217
1247
|
}
|
|
1218
1248
|
|
|
1219
1249
|
export interface ObjectTypeAnnotation extends BaseNode {
|
|
@@ -1235,11 +1265,15 @@ export interface ObjectTypeProperty extends BaseNode {
|
|
|
1235
1265
|
+proto: false; // ???
|
|
1236
1266
|
+variance: Variance | null;
|
|
1237
1267
|
+kind: 'init';
|
|
1268
|
+
|
|
1269
|
+
+parent: ObjectTypeAnnotation;
|
|
1238
1270
|
}
|
|
1239
1271
|
export interface ObjectTypeCallProperty extends BaseNode {
|
|
1240
1272
|
+type: 'ObjectTypeCallProperty';
|
|
1241
1273
|
+value: FunctionTypeAnnotation;
|
|
1242
1274
|
+static: false; // can't be static
|
|
1275
|
+
|
|
1276
|
+
+parent: ObjectTypeAnnotation;
|
|
1243
1277
|
}
|
|
1244
1278
|
export interface ObjectTypeIndexer extends BaseNode {
|
|
1245
1279
|
+type: 'ObjectTypeIndexer';
|
|
@@ -1248,10 +1282,14 @@ export interface ObjectTypeIndexer extends BaseNode {
|
|
|
1248
1282
|
+value: TypeAnnotationType;
|
|
1249
1283
|
+static: false; // can't be static
|
|
1250
1284
|
+variance: null | Variance;
|
|
1285
|
+
|
|
1286
|
+
+parent: ObjectTypeAnnotation;
|
|
1251
1287
|
}
|
|
1252
1288
|
export interface ObjectTypeSpreadProperty extends BaseNode {
|
|
1253
1289
|
+type: 'ObjectTypeSpreadProperty';
|
|
1254
1290
|
+argument: TypeAnnotationType;
|
|
1291
|
+
|
|
1292
|
+
+parent: ObjectTypeAnnotation;
|
|
1255
1293
|
}
|
|
1256
1294
|
|
|
1257
1295
|
export interface IndexedAccessType extends BaseNode {
|
|
@@ -1289,17 +1327,23 @@ export interface InterfaceExtends extends BaseNode {
|
|
|
1289
1327
|
+type: 'InterfaceExtends';
|
|
1290
1328
|
+id: Identifier;
|
|
1291
1329
|
+typeParameters: null | TypeParameterDeclaration;
|
|
1330
|
+
|
|
1331
|
+
+parent: InterfaceDeclaration | DeclareInterface;
|
|
1292
1332
|
}
|
|
1293
1333
|
|
|
1294
1334
|
export interface ClassImplements extends BaseNode {
|
|
1295
1335
|
+type: 'ClassImplements';
|
|
1296
1336
|
+id: Identifier;
|
|
1297
1337
|
+typeParameters: null | TypeParameterDeclaration;
|
|
1338
|
+
|
|
1339
|
+
+parent: AClass | DeclareClass;
|
|
1298
1340
|
}
|
|
1299
1341
|
|
|
1300
1342
|
export interface Decorator extends BaseNode {
|
|
1301
1343
|
+type: 'Decorator';
|
|
1302
1344
|
+expression: Expression;
|
|
1345
|
+
|
|
1346
|
+
+parent: AClass;
|
|
1303
1347
|
}
|
|
1304
1348
|
|
|
1305
1349
|
export interface TypeParameterDeclaration extends BaseNode {
|
|
@@ -1312,10 +1356,14 @@ export interface TypeParameter extends BaseNode {
|
|
|
1312
1356
|
+bound: null | TypeAnnotation;
|
|
1313
1357
|
+variance: null | Variance;
|
|
1314
1358
|
+default: null | TypeAnnotationType;
|
|
1359
|
+
|
|
1360
|
+
+parent: TypeParameterDeclaration;
|
|
1315
1361
|
}
|
|
1316
1362
|
export interface TypeParameterInstantiation extends BaseNode {
|
|
1317
1363
|
+type: 'TypeParameterInstantiation';
|
|
1318
1364
|
+params: $ReadOnlyArray<TypeAnnotationType>;
|
|
1365
|
+
|
|
1366
|
+
+parent: GenericTypeAnnotation | CallExpression | NewExpression;
|
|
1319
1367
|
}
|
|
1320
1368
|
|
|
1321
1369
|
export interface EnumDeclaration extends BaseNode {
|
|
@@ -1336,46 +1384,62 @@ export interface EnumNumberBody extends BaseInferrableEnumBody {
|
|
|
1336
1384
|
// enum number members cannot be defaulted
|
|
1337
1385
|
+members: $ReadOnlyArray<EnumNumberMember>;
|
|
1338
1386
|
+explicitType: boolean;
|
|
1387
|
+
|
|
1388
|
+
+parent: EnumDeclaration;
|
|
1339
1389
|
}
|
|
1340
1390
|
|
|
1341
1391
|
export interface EnumNumberMember extends BaseNode {
|
|
1342
1392
|
+type: 'EnumNumberMember';
|
|
1343
1393
|
+id: Identifier;
|
|
1344
1394
|
+init: NumericLiteral;
|
|
1395
|
+
|
|
1396
|
+
+parent: EnumNumberBody;
|
|
1345
1397
|
}
|
|
1346
1398
|
|
|
1347
1399
|
export interface EnumStringBody extends BaseInferrableEnumBody {
|
|
1348
1400
|
+type: 'EnumStringBody';
|
|
1349
1401
|
+members: $ReadOnlyArray<EnumStringMember | EnumDefaultedMember>;
|
|
1402
|
+
|
|
1403
|
+
+parent: EnumDeclaration;
|
|
1350
1404
|
}
|
|
1351
1405
|
|
|
1352
1406
|
export interface EnumStringMember extends BaseNode {
|
|
1353
1407
|
+type: 'EnumStringMember';
|
|
1354
1408
|
+id: Identifier;
|
|
1355
1409
|
+init: StringLiteral;
|
|
1410
|
+
|
|
1411
|
+
+parent: EnumStringBody;
|
|
1356
1412
|
}
|
|
1357
1413
|
|
|
1358
1414
|
export interface EnumBooleanBody extends BaseInferrableEnumBody {
|
|
1359
1415
|
+type: 'EnumBooleanBody';
|
|
1360
1416
|
// enum boolean members cannot be defaulted
|
|
1361
1417
|
+members: $ReadOnlyArray<EnumBooleanMember>;
|
|
1418
|
+
|
|
1419
|
+
+parent: EnumDeclaration;
|
|
1362
1420
|
}
|
|
1363
1421
|
|
|
1364
1422
|
export interface EnumBooleanMember extends BaseNode {
|
|
1365
1423
|
+type: 'EnumBooleanMember';
|
|
1366
1424
|
+id: Identifier;
|
|
1367
1425
|
+init: BooleanLiteral;
|
|
1426
|
+
|
|
1427
|
+
+parent: EnumBooleanBody;
|
|
1368
1428
|
}
|
|
1369
1429
|
|
|
1370
1430
|
export interface EnumSymbolBody extends BaseEnumBody {
|
|
1371
1431
|
+type: 'EnumSymbolBody';
|
|
1372
1432
|
// enum symbol members can only be defaulted
|
|
1373
1433
|
+members: $ReadOnlyArray<EnumDefaultedMember>;
|
|
1434
|
+
|
|
1435
|
+
+parent: EnumDeclaration;
|
|
1374
1436
|
}
|
|
1375
1437
|
|
|
1376
1438
|
export interface EnumDefaultedMember extends BaseNode {
|
|
1377
1439
|
+type: 'EnumDefaultedMember';
|
|
1378
1440
|
+id: Identifier;
|
|
1441
|
+
|
|
1442
|
+
+parent: EnumStringBody | EnumSymbolBody;
|
|
1379
1443
|
}
|
|
1380
1444
|
|
|
1381
1445
|
/*****************
|
|
@@ -1502,15 +1566,21 @@ export interface JSXAttribute extends BaseNode {
|
|
|
1502
1566
|
+type: 'JSXAttribute';
|
|
1503
1567
|
+name: JSXIdentifier;
|
|
1504
1568
|
+value: Literal | JSXExpression | null;
|
|
1569
|
+
|
|
1570
|
+
+parent: JSXOpeningElement;
|
|
1505
1571
|
}
|
|
1506
1572
|
|
|
1507
1573
|
export interface JSXClosingElement extends BaseNode {
|
|
1508
1574
|
+type: 'JSXClosingElement';
|
|
1509
1575
|
+name: JSXTagNameExpression;
|
|
1576
|
+
|
|
1577
|
+
+parent: JSXElement;
|
|
1510
1578
|
}
|
|
1511
1579
|
|
|
1512
1580
|
export interface JSXClosingFragment extends BaseNode {
|
|
1513
1581
|
+type: 'JSXClosingFragment';
|
|
1582
|
+
|
|
1583
|
+
+parent: JSXFragment;
|
|
1514
1584
|
}
|
|
1515
1585
|
|
|
1516
1586
|
export interface JSXElement extends BaseNode {
|
|
@@ -1526,7 +1596,7 @@ export interface JSXEmptyExpression extends BaseNode {
|
|
|
1526
1596
|
|
|
1527
1597
|
export interface JSXExpressionContainer extends BaseNode {
|
|
1528
1598
|
+type: 'JSXExpressionContainer';
|
|
1529
|
-
+expression: Expression;
|
|
1599
|
+
+expression: Expression | JSXEmptyExpression;
|
|
1530
1600
|
}
|
|
1531
1601
|
|
|
1532
1602
|
export interface JSXFragment extends BaseNode {
|
|
@@ -1558,15 +1628,21 @@ export interface JSXOpeningElement extends BaseNode {
|
|
|
1558
1628
|
+selfClosing: boolean;
|
|
1559
1629
|
+name: JSXTagNameExpression;
|
|
1560
1630
|
+attributes: $ReadOnlyArray<JSXAttribute | JSXSpreadAttribute>;
|
|
1631
|
+
|
|
1632
|
+
+parent: JSXElement;
|
|
1561
1633
|
}
|
|
1562
1634
|
|
|
1563
1635
|
export interface JSXOpeningFragment extends BaseNode {
|
|
1564
1636
|
+type: 'JSXOpeningFragment';
|
|
1637
|
+
|
|
1638
|
+
+parent: JSXFragment;
|
|
1565
1639
|
}
|
|
1566
1640
|
|
|
1567
1641
|
export interface JSXSpreadAttribute extends BaseNode {
|
|
1568
1642
|
+type: 'JSXSpreadAttribute';
|
|
1569
1643
|
+argument: Expression;
|
|
1644
|
+
|
|
1645
|
+
+parent: JSXOpeningElement;
|
|
1570
1646
|
}
|
|
1571
1647
|
|
|
1572
1648
|
export interface JSXText extends BaseNode {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "hermes-estree",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.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",
|
|
@@ -9,6 +9,8 @@
|
|
|
9
9
|
"url": "git@github.com:facebook/hermes.git"
|
|
10
10
|
},
|
|
11
11
|
"files": [
|
|
12
|
-
"dist"
|
|
12
|
+
"dist",
|
|
13
|
+
"LICENCE",
|
|
14
|
+
"README.md"
|
|
13
15
|
]
|
|
14
16
|
}
|