hermes-parser 0.18.1 → 0.19.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.
@@ -60,6 +60,7 @@ module.exports = {
60
60
  DeclareExportAllDeclaration: ['source'],
61
61
  DeclareExportDeclaration: ['declaration', 'specifiers', 'source'],
62
62
  DeclareFunction: ['id', 'predicate'],
63
+ DeclareHook: ['id'],
63
64
  DeclareInterface: ['id', 'typeParameters', 'extends', 'body'],
64
65
  DeclareModule: ['id', 'body'],
65
66
  DeclareModuleExports: ['typeAnnotation'],
@@ -92,6 +93,8 @@ module.exports = {
92
93
  FunctionTypeAnnotation: ['params', 'this', 'returnType', 'rest', 'typeParameters'],
93
94
  FunctionTypeParam: ['name', 'typeAnnotation'],
94
95
  GenericTypeAnnotation: ['id', 'typeParameters'],
96
+ HookDeclaration: ['id', 'params', 'body', 'typeParameters', 'returnType'],
97
+ HookTypeAnnotation: ['params', 'returnType', 'rest', 'typeParameters'],
95
98
  Identifier: ['typeAnnotation'],
96
99
  IfStatement: ['test', 'consequent', 'alternate'],
97
100
  ImportAttribute: ['key', 'value'],
@@ -174,7 +177,7 @@ module.exports = {
174
177
  TypeAlias: ['id', 'typeParameters', 'right'],
175
178
  TypeAnnotation: ['typeAnnotation'],
176
179
  TypeCastExpression: ['expression', 'typeAnnotation'],
177
- TypeofTypeAnnotation: ['argument'],
180
+ TypeofTypeAnnotation: ['argument', 'typeArguments'],
178
181
  TypeOperator: ['typeAnnotation'],
179
182
  TypeParameter: ['bound', 'variance', 'default'],
180
183
  TypeParameterDeclaration: ['params'],
@@ -187,6 +187,9 @@ const HERMES_AST_VISITOR_KEYS = {
187
187
  id: 'Node',
188
188
  predicate: 'Node'
189
189
  },
190
+ DeclareHook: {
191
+ id: 'Node'
192
+ },
190
193
  DeclareInterface: {
191
194
  id: 'Node',
192
195
  typeParameters: 'Node',
@@ -318,6 +321,19 @@ const HERMES_AST_VISITOR_KEYS = {
318
321
  id: 'Node',
319
322
  typeParameters: 'Node'
320
323
  },
324
+ HookDeclaration: {
325
+ id: 'Node',
326
+ params: 'NodeList',
327
+ body: 'Node',
328
+ typeParameters: 'Node',
329
+ returnType: 'Node'
330
+ },
331
+ HookTypeAnnotation: {
332
+ params: 'NodeList',
333
+ returnType: 'Node',
334
+ rest: 'Node',
335
+ typeParameters: 'Node'
336
+ },
321
337
  Identifier: {
322
338
  typeAnnotation: 'Node'
323
339
  },
@@ -597,7 +613,8 @@ const HERMES_AST_VISITOR_KEYS = {
597
613
  typeAnnotation: 'Node'
598
614
  },
599
615
  TypeofTypeAnnotation: {
600
- argument: 'Node'
616
+ argument: 'Node',
617
+ typeArguments: 'Node'
601
618
  },
602
619
  TypeOperator: {
603
620
  typeAnnotation: 'Node'
@@ -19,6 +19,7 @@ var _ESTreeVisitorKeys = _interopRequireDefault(require("../generated/ESTreeVisi
19
19
 
20
20
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
21
21
 
22
+ // $FlowFixMe[deprecated-type]
22
23
  function isNode(thing) {
23
24
  return typeof thing === 'object' && thing != null && typeof thing.type === 'string';
24
25
  }
@@ -15,6 +15,7 @@ import type {VisitorKeys as VisitorKeysType} from '../generated/ESTreeVisitorKey
15
15
 
16
16
  import FlowVisitorKeys from '../generated/ESTreeVisitorKeys';
17
17
 
18
+ // $FlowFixMe[deprecated-type]
18
19
  export function isNode(thing: mixed): boolean %checks {
19
20
  return (
20
21
  typeof thing === 'object' && thing != null && typeof thing.type === 'string'
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-parser",
3
- "version": "0.18.1",
3
+ "version": "0.19.0",
4
4
  "description": "A JavaScript parser built from the Hermes engine",
5
5
  "main": "dist/index.js",
6
6
  "license": "MIT",
@@ -9,7 +9,7 @@
9
9
  "url": "git@github.com:facebook/hermes.git"
10
10
  },
11
11
  "dependencies": {
12
- "hermes-estree": "0.18.1"
12
+ "hermes-estree": "0.19.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@babel/parser": "7.7.4",