hermes-parser 0.31.0 → 0.32.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.
@@ -126,7 +126,7 @@ function mapNodeWithDirectives(node) {
126
126
  break;
127
127
  }
128
128
  } // Move directives from body to new directives array
129
- // $FlowExpectedError[incompatible-call] We are adding properties for babel that don't exist in the ESTree types.
129
+ // $FlowExpectedError[incompatible-type] We are adding properties for babel that don't exist in the ESTree types.
130
130
 
131
131
 
132
132
  return nodeWith(node, {
@@ -189,7 +189,7 @@ function mapProgram(node) {
189
189
 
190
190
  return {
191
191
  type: 'File',
192
- // $FlowExpectedError[prop-missing] Comments, docblock and tokens are purposely missing to match the Babel AST.
192
+ // $FlowExpectedError[incompatible-type] Comments, docblock and tokens are purposely missing to match the Babel AST.
193
193
  program: {
194
194
  type: 'Program',
195
195
  body: program.body,
@@ -280,7 +280,7 @@ function mapProperty(node) {
280
280
  type: 'ObjectProperty',
281
281
  computed: node.computed,
282
282
  key: node.key,
283
- // $FlowExpectedError[incompatible-cast]
283
+ // $FlowExpectedError[incompatible-type]
284
284
  value: node.value,
285
285
  method: node.method,
286
286
  shorthand: node.shorthand,
@@ -398,10 +398,10 @@ function mapRestElement(node) {
398
398
  function mapImportExpression(node) {
399
399
  // Babel expects ImportExpression to be structured as a regular
400
400
  // CallExpression where the callee is an Import node.
401
- // $FlowExpectedError[prop-missing] optional and typeArguments are missing to match existing output.
401
+ // $FlowExpectedError[incompatible-type] optional and typeArguments are missing to match existing output.
402
402
  return {
403
403
  type: 'CallExpression',
404
- // $FlowExpectedError[incompatible-return] This is a babel specific node
404
+ // $FlowExpectedError[incompatible-type] This is a babel specific node
405
405
  callee: {
406
406
  type: 'Import',
407
407
  loc: {
@@ -483,7 +483,7 @@ function mapTypeofTypeAnnotation(node) {
483
483
 
484
484
  if (node.argument.type !== 'GenericTypeAnnotation') {
485
485
  return nodeWith(node, {
486
- // $FlowExpectedError[incompatible-call] Special override for Babel
486
+ // $FlowExpectedError[incompatible-type] Special override for Babel
487
487
  argument: {
488
488
  type: 'GenericTypeAnnotation',
489
489
  id: node.argument,
@@ -1093,12 +1093,12 @@ function transformProgram(program, options) {
1093
1093
 
1094
1094
  const resultNode = _SimpleTransform.SimpleTransform.transform(program, {
1095
1095
  transform(node) {
1096
- // $FlowExpectedError[incompatible-call] We override the type to support the additional Babel types
1096
+ // $FlowExpectedError[incompatible-type] We override the type to support the additional Babel types
1097
1097
  return transformNode(node);
1098
1098
  },
1099
1099
 
1100
1100
  visitorKeys: FlowESTreeAndBabelVisitorKeys
1101
- }); // $FlowExpectedError[incompatible-call] We override the type to support the additional Babel types
1101
+ }); // $FlowExpectedError[incompatible-type] We override the type to support the additional Babel types
1102
1102
 
1103
1103
 
1104
1104
  _SimpleTraverser.SimpleTraverser.traverse(resultNode, {
@@ -374,7 +374,7 @@ function mapNodeWithDirectives<T: Program | BlockStatement>(node: T): T {
374
374
  }
375
375
 
376
376
  // Move directives from body to new directives array
377
- // $FlowExpectedError[incompatible-call] We are adding properties for babel that don't exist in the ESTree types.
377
+ // $FlowExpectedError[incompatible-type] We are adding properties for babel that don't exist in the ESTree types.
378
378
  return nodeWith(node, {
379
379
  directives,
380
380
  body:
@@ -432,7 +432,7 @@ function mapProgram(node: Program): BabelFile {
432
432
  // Rename root node to File node and move Program node under program property
433
433
  return {
434
434
  type: 'File',
435
- // $FlowExpectedError[prop-missing] Comments, docblock and tokens are purposely missing to match the Babel AST.
435
+ // $FlowExpectedError[incompatible-type] Comments, docblock and tokens are purposely missing to match the Babel AST.
436
436
  program: {
437
437
  type: 'Program',
438
438
  body: program.body,
@@ -532,7 +532,7 @@ function mapProperty(node: Property): BabelObjectMethod | BabelObjectProperty {
532
532
  type: 'ObjectProperty',
533
533
  computed: node.computed,
534
534
  key: node.key,
535
- // $FlowExpectedError[incompatible-cast]
535
+ // $FlowExpectedError[incompatible-type]
536
536
  value: (node.value: Expression),
537
537
  method: node.method,
538
538
  shorthand: node.shorthand,
@@ -666,10 +666,10 @@ function mapImportExpression(node: ImportExpression): CallExpression {
666
666
  // Babel expects ImportExpression to be structured as a regular
667
667
  // CallExpression where the callee is an Import node.
668
668
 
669
- // $FlowExpectedError[prop-missing] optional and typeArguments are missing to match existing output.
669
+ // $FlowExpectedError[incompatible-type] optional and typeArguments are missing to match existing output.
670
670
  return {
671
671
  type: 'CallExpression',
672
- // $FlowExpectedError[incompatible-return] This is a babel specific node
672
+ // $FlowExpectedError[incompatible-type] This is a babel specific node
673
673
  callee: {
674
674
  type: 'Import',
675
675
  loc: {
@@ -755,7 +755,7 @@ function mapTypeofTypeAnnotation(
755
755
  // $FlowFixMe[incompatible-type]
756
756
  if (node.argument.type !== 'GenericTypeAnnotation') {
757
757
  return nodeWith(node, {
758
- // $FlowExpectedError[incompatible-call] Special override for Babel
758
+ // $FlowExpectedError[incompatible-type] Special override for Babel
759
759
  argument: {
760
760
  type: 'GenericTypeAnnotation',
761
761
  id: node.argument,
@@ -1247,13 +1247,13 @@ export function transformProgram(
1247
1247
  ): BabelFile {
1248
1248
  const resultNode = SimpleTransform.transform(program, {
1249
1249
  transform(node) {
1250
- // $FlowExpectedError[incompatible-call] We override the type to support the additional Babel types
1250
+ // $FlowExpectedError[incompatible-type] We override the type to support the additional Babel types
1251
1251
  return transformNode(node);
1252
1252
  },
1253
1253
  visitorKeys: FlowESTreeAndBabelVisitorKeys,
1254
1254
  });
1255
1255
 
1256
- // $FlowExpectedError[incompatible-call] We override the type to support the additional Babel types
1256
+ // $FlowExpectedError[incompatible-type] We override the type to support the additional Babel types
1257
1257
  SimpleTraverser.traverse(resultNode, {
1258
1258
  enter(node) {
1259
1259
  fixSourceLocation(node, options);
@@ -757,7 +757,7 @@ function transformProgram(program, options) {
757
757
  {
758
758
  const consequent = mapStatementList(node.consequent, options);
759
759
  return nodeWith(node, {
760
- /* $FlowExpectedError[incompatible-call] We know `mapStatementList` will
760
+ /* $FlowExpectedError[incompatible-type] We know `mapStatementList` will
761
761
  not return `ModuleDeclaration` nodes if it is not passed any */
762
762
  consequent
763
763
  });
@@ -836,7 +836,7 @@ export function transformProgram(
836
836
  case 'SwitchCase': {
837
837
  const consequent = mapStatementList(node.consequent, options);
838
838
  return nodeWith(node, {
839
- /* $FlowExpectedError[incompatible-call] We know `mapStatementList` will
839
+ /* $FlowExpectedError[incompatible-type] We know `mapStatementList` will
840
840
  not return `ModuleDeclaration` nodes if it is not passed any */
841
841
  consequent,
842
842
  });
@@ -59,7 +59,7 @@ class HermesASTAdapter {
59
59
 
60
60
  if (resultNode.type !== 'Program') {
61
61
  throw new Error(`HermesToESTreeAdapter: Must return a Program node, instead of "${resultNode.type}". `);
62
- } // $FlowExpectedError[incompatible-return] We know this is a program at this point.
62
+ } // $FlowExpectedError[incompatible-type] We know this is a program at this point.
63
63
 
64
64
 
65
65
  return resultNode;
@@ -126,7 +126,7 @@ function mapNodeWithDirectives(node) {
126
126
  break;
127
127
  }
128
128
  } // Move directives from body to new directives array
129
- // $FlowExpectedError[incompatible-call] We are adding properties for babel that don't exist in the ESTree types.
129
+ // $FlowExpectedError[incompatible-type] We are adding properties for babel that don't exist in the ESTree types.
130
130
 
131
131
 
132
132
  return nodeWith(node, {
@@ -189,7 +189,7 @@ function mapProgram(node) {
189
189
 
190
190
  return {
191
191
  type: 'File',
192
- // $FlowExpectedError[prop-missing] Comments, docblock and tokens are purposely missing to match the Babel AST.
192
+ // $FlowExpectedError[incompatible-type] Comments, docblock and tokens are purposely missing to match the Babel AST.
193
193
  program: {
194
194
  type: 'Program',
195
195
  body: program.body,
@@ -280,7 +280,7 @@ function mapProperty(node) {
280
280
  type: 'ObjectProperty',
281
281
  computed: node.computed,
282
282
  key: node.key,
283
- // $FlowExpectedError[incompatible-cast]
283
+ // $FlowExpectedError[incompatible-type]
284
284
  value: node.value,
285
285
  method: node.method,
286
286
  shorthand: node.shorthand,
@@ -398,10 +398,10 @@ function mapRestElement(node) {
398
398
  function mapImportExpression(node) {
399
399
  // Babel expects ImportExpression to be structured as a regular
400
400
  // CallExpression where the callee is an Import node.
401
- // $FlowExpectedError[prop-missing] optional and typeArguments are missing to match existing output.
401
+ // $FlowExpectedError[incompatible-type] optional and typeArguments are missing to match existing output.
402
402
  return {
403
403
  type: 'CallExpression',
404
- // $FlowExpectedError[incompatible-return] This is a babel specific node
404
+ // $FlowExpectedError[incompatible-type] This is a babel specific node
405
405
  callee: {
406
406
  type: 'Import',
407
407
  loc: {
@@ -483,7 +483,7 @@ function mapTypeofTypeAnnotation(node) {
483
483
 
484
484
  if (node.argument.type !== 'GenericTypeAnnotation') {
485
485
  return nodeWith(node, {
486
- // $FlowExpectedError[incompatible-call] Special override for Babel
486
+ // $FlowExpectedError[incompatible-type] Special override for Babel
487
487
  argument: {
488
488
  type: 'GenericTypeAnnotation',
489
489
  id: node.argument,
@@ -1093,12 +1093,12 @@ function transformProgram(program, options) {
1093
1093
 
1094
1094
  const resultNode = _SimpleTransform.SimpleTransform.transform(program, {
1095
1095
  transform(node) {
1096
- // $FlowExpectedError[incompatible-call] We override the type to support the additional Babel types
1096
+ // $FlowExpectedError[incompatible-type] We override the type to support the additional Babel types
1097
1097
  return transformNode(node);
1098
1098
  },
1099
1099
 
1100
1100
  visitorKeys: FlowESTreeAndBabelVisitorKeys
1101
- }); // $FlowExpectedError[incompatible-call] We override the type to support the additional Babel types
1101
+ }); // $FlowExpectedError[incompatible-type] We override the type to support the additional Babel types
1102
1102
 
1103
1103
 
1104
1104
  _SimpleTraverser.SimpleTraverser.traverse(resultNode, {
@@ -757,7 +757,7 @@ function transformProgram(program, options) {
757
757
  {
758
758
  const consequent = mapStatementList(node.consequent, options);
759
759
  return nodeWith(node, {
760
- /* $FlowExpectedError[incompatible-call] We know `mapStatementList` will
760
+ /* $FlowExpectedError[incompatible-type] We know `mapStatementList` will
761
761
  not return `ModuleDeclaration` nodes if it is not passed any */
762
762
  consequent
763
763
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "hermes-parser",
3
- "version": "0.31.0",
3
+ "version": "0.32.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.31.0"
12
+ "hermes-estree": "0.32.0"
13
13
  },
14
14
  "devDependencies": {
15
15
  "@babel/parser": "7.7.4",