hermes-parser 0.9.0 → 0.10.1

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.
@@ -18,15 +18,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
18
18
  *
19
19
  * @format
20
20
  */
21
-
22
- /*
23
- This class does some very "javascripty" things in the name of
24
- performance which are ultimately impossible to soundly type.
25
-
26
- So instead of adding strict types and a large number of suppression
27
- comments, instead it is left untyped and subclasses are strictly
28
- typed via a separate flow declaration file.
29
- */
30
21
  class HermesToBabelAdapter extends _HermesASTAdapter.default {
31
22
  fixSourceLocation(node) {
32
23
  var _this$sourceFilename;
@@ -121,6 +112,12 @@ class HermesToBabelAdapter extends _HermesASTAdapter.default {
121
112
  case 'BigIntLiteral':
122
113
  return this.mapBigIntLiteral(node);
123
114
 
115
+ case 'BigIntLiteralTypeAnnotation':
116
+ return this.mapBigIntLiteralTypeAnnotation(node);
117
+
118
+ case 'BigIntTypeAnnotation':
119
+ return this.mapBigIntTypeAnnotation(node);
120
+
124
121
  default:
125
122
  return this.mapNodeDefault(node);
126
123
  }
@@ -436,10 +433,36 @@ class HermesToBabelAdapter extends _HermesASTAdapter.default {
436
433
  }
437
434
 
438
435
  mapBigIntLiteral(node) {
439
- const bigint = node.bigint.replace(/n$/, '').replace(/_/, '');
440
- node.value = typeof BigInt === 'function' ? BigInt(bigint) : null;
436
+ node.value = this.getBigIntLiteralValue(node.bigint).value;
437
+ return node;
438
+ }
439
+
440
+ mapBigIntLiteralTypeAnnotation(node) {
441
+ node.value = this.getBigIntLiteralValue(node.raw).value;
441
442
  return node;
442
443
  }
444
+ /**
445
+ * Babel does not parse the bigint keyword type as the keyword node.
446
+ * So we need to down-level the AST to a plain GenericTypeAnnotation
447
+ */
448
+
449
+
450
+ mapBigIntTypeAnnotation(node) {
451
+ return {
452
+ type: 'GenericTypeAnnotation',
453
+ id: {
454
+ type: 'Identifier',
455
+ name: 'bigint',
456
+ loc: node.loc,
457
+ start: node.start,
458
+ end: node.end
459
+ },
460
+ typeParameters: null,
461
+ loc: node.loc,
462
+ start: node.start,
463
+ end: node.end
464
+ };
465
+ }
443
466
 
444
467
  mapPrivateProperty(nodeUnprocessed) {
445
468
  const node = this.mapNodeDefault(nodeUnprocessed);
@@ -4,19 +4,10 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
11
- /*
12
- This class does some very "javascripty" things in the name of
13
- performance which are ultimately impossible to soundly type.
14
-
15
- So instead of adding strict types and a large number of suppression
16
- comments, instead it is left untyped and subclasses are strictly
17
- typed via a separate flow declaration file.
18
- */
19
-
20
11
  import type {HermesNode} from './HermesAST';
21
12
 
22
13
  import HermesASTAdapter from './HermesASTAdapter';
@@ -91,6 +82,10 @@ export default class HermesToBabelAdapter extends HermesASTAdapter {
91
82
  return this.mapUnsupportedTypeAnnotation(node);
92
83
  case 'BigIntLiteral':
93
84
  return this.mapBigIntLiteral(node);
85
+ case 'BigIntLiteralTypeAnnotation':
86
+ return this.mapBigIntLiteralTypeAnnotation(node);
87
+ case 'BigIntTypeAnnotation':
88
+ return this.mapBigIntTypeAnnotation(node);
94
89
  default:
95
90
  return this.mapNodeDefault(node);
96
91
  }
@@ -413,10 +408,33 @@ export default class HermesToBabelAdapter extends HermesASTAdapter {
413
408
  }
414
409
 
415
410
  mapBigIntLiteral(node: HermesNode): HermesNode {
416
- const bigint = node.bigint.replace(/n$/, '').replace(/_/, '');
417
- node.value = typeof BigInt === 'function' ? BigInt(bigint) : null;
411
+ node.value = this.getBigIntLiteralValue(node.bigint).value;
418
412
  return node;
419
413
  }
414
+ mapBigIntLiteralTypeAnnotation(node: HermesNode): HermesNode {
415
+ node.value = this.getBigIntLiteralValue(node.raw).value;
416
+ return node;
417
+ }
418
+ /**
419
+ * Babel does not parse the bigint keyword type as the keyword node.
420
+ * So we need to down-level the AST to a plain GenericTypeAnnotation
421
+ */
422
+ mapBigIntTypeAnnotation(node: HermesNode): HermesNode {
423
+ return {
424
+ type: 'GenericTypeAnnotation',
425
+ id: {
426
+ type: 'Identifier',
427
+ name: 'bigint',
428
+ loc: node.loc,
429
+ start: node.start,
430
+ end: node.end,
431
+ },
432
+ typeParameters: null,
433
+ loc: node.loc,
434
+ start: node.start,
435
+ end: node.end,
436
+ };
437
+ }
420
438
 
421
439
  mapPrivateProperty(nodeUnprocessed: HermesNode): HermesNode {
422
440
  const node = this.mapNodeDefault(nodeUnprocessed);
@@ -20,15 +20,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
20
20
  *
21
21
  * @format
22
22
  */
23
-
24
- /*
25
- This class does some very "javascripty" things in the name of
26
- performance which are ultimately impossible to soundly type.
27
-
28
- So instead of adding strict types and a large number of suppression
29
- comments, instead it is left untyped and subclasses are strictly
30
- typed via a separate flow declaration file.
31
- */
32
23
  class HermesToESTreeAdapter extends _HermesASTAdapter.default {
33
24
  constructor(options, code) {
34
25
  super(options);
@@ -131,10 +122,10 @@ class HermesToESTreeAdapter extends _HermesASTAdapter.default {
131
122
  }
132
123
 
133
124
  mapProgram(node) {
134
- node = this.mapNodeDefault(node);
125
+ const nodeDefault = this.mapNodeDefault(node);
135
126
  node.sourceType = this.getSourceType();
136
- node.docblock = (0, _getModuleDocblock.getModuleDocblock)(node);
137
- return node;
127
+ node.docblock = (0, _getModuleDocblock.getModuleDocblock)(nodeDefault);
128
+ return nodeDefault;
138
129
  }
139
130
 
140
131
  mapSimpleLiteral(node) {
@@ -173,14 +164,8 @@ class HermesToESTreeAdapter extends _HermesASTAdapter.default {
173
164
 
174
165
  mapBigIntLiteral(node) {
175
166
  const newNode = this.mapSimpleLiteral(node);
176
- const bigint = node.bigint // estree spec is to not have a trailing `n` on this property
177
- // https://github.com/estree/estree/blob/db962bb417a97effcfe9892f87fbb93c81a68584/es2020.md#bigintliteral
178
- .replace(/n$/, '') // `BigInt` doesn't accept numeric separator and `bigint` property should not include numeric separator
179
- .replace(/_/, '');
180
167
  return { ...newNode,
181
- // coerce the string to a bigint value if supported by the environment
182
- value: typeof BigInt === 'function' ? BigInt(bigint) : null,
183
- bigint
168
+ ...this.getBigIntLiteralValue(node.bigint)
184
169
  };
185
170
  }
186
171
 
@@ -214,8 +199,9 @@ class HermesToESTreeAdapter extends _HermesASTAdapter.default {
214
199
  }
215
200
 
216
201
  mapBigIntLiteralTypeAnnotation(node) {
217
- node.value = null;
218
- return node;
202
+ return { ...node,
203
+ ...this.getBigIntLiteralValue(node.raw)
204
+ };
219
205
  }
220
206
 
221
207
  mapTemplateElement(node) {
@@ -4,19 +4,10 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
11
- /*
12
- This class does some very "javascripty" things in the name of
13
- performance which are ultimately impossible to soundly type.
14
-
15
- So instead of adding strict types and a large number of suppression
16
- comments, instead it is left untyped and subclasses are strictly
17
- typed via a separate flow declaration file.
18
- */
19
-
20
11
  import type {HermesNode} from './HermesAST';
21
12
  import type {ParserOptions} from './ParserOptions';
22
13
 
@@ -107,12 +98,12 @@ export default class HermesToESTreeAdapter extends HermesASTAdapter {
107
98
  }
108
99
 
109
100
  mapProgram(node: HermesNode): HermesNode {
110
- node = this.mapNodeDefault(node);
101
+ const nodeDefault = this.mapNodeDefault(node);
111
102
  node.sourceType = this.getSourceType();
112
103
 
113
- node.docblock = getModuleDocblock(node);
104
+ node.docblock = getModuleDocblock(nodeDefault);
114
105
 
115
- return node;
106
+ return nodeDefault;
116
107
  }
117
108
 
118
109
  mapSimpleLiteral(node: HermesNode): HermesNode {
@@ -150,17 +141,9 @@ export default class HermesToESTreeAdapter extends HermesASTAdapter {
150
141
 
151
142
  mapBigIntLiteral(node: HermesNode): HermesNode {
152
143
  const newNode = this.mapSimpleLiteral(node);
153
- const bigint = node.bigint
154
- // estree spec is to not have a trailing `n` on this property
155
- // https://github.com/estree/estree/blob/db962bb417a97effcfe9892f87fbb93c81a68584/es2020.md#bigintliteral
156
- .replace(/n$/, '')
157
- // `BigInt` doesn't accept numeric separator and `bigint` property should not include numeric separator
158
- .replace(/_/, '');
159
144
  return {
160
145
  ...newNode,
161
- // coerce the string to a bigint value if supported by the environment
162
- value: typeof BigInt === 'function' ? BigInt(bigint) : null,
163
- bigint,
146
+ ...this.getBigIntLiteralValue(node.bigint),
164
147
  };
165
148
  }
166
149
 
@@ -193,8 +176,10 @@ export default class HermesToESTreeAdapter extends HermesASTAdapter {
193
176
  }
194
177
 
195
178
  mapBigIntLiteralTypeAnnotation(node: HermesNode): HermesNode {
196
- node.value = null;
197
- return node;
179
+ return {
180
+ ...node,
181
+ ...this.getBigIntLiteralValue(node.raw),
182
+ };
198
183
  }
199
184
 
200
185
  mapTemplateElement(node: HermesNode): HermesNode {
@@ -0,0 +1,180 @@
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
+ *
8
+ * @format
9
+ * @generated
10
+ */
11
+
12
+ /*
13
+ * !!! GENERATED FILE !!!
14
+ *
15
+ * Any manual changes to this file will be overwritten. To regenerate run `yarn build`.
16
+ */
17
+ // lint directives to let us do some basic validation of generated files
18
+
19
+ /* eslint no-undef: 'error', no-unused-vars: ['error', {vars: "local"}], no-redeclare: 'error' */
20
+
21
+ /* global $NonMaybeType, Partial, $ReadOnly, $ReadOnlyArray */
22
+ 'use strict';
23
+
24
+ module.exports = {
25
+ AnyTypeAnnotation: [],
26
+ ArrayExpression: ['elements'],
27
+ ArrayPattern: ['elements', 'typeAnnotation'],
28
+ ArrayTypeAnnotation: ['elementType'],
29
+ ArrowFunctionExpression: ['id', 'params', 'body', 'typeParameters', 'returnType', 'predicate'],
30
+ AssignmentExpression: ['left', 'right'],
31
+ AssignmentPattern: ['left', 'right'],
32
+ AwaitExpression: ['argument'],
33
+ BigIntLiteralTypeAnnotation: [],
34
+ BigIntTypeAnnotation: [],
35
+ BinaryExpression: ['left', 'right'],
36
+ BlockStatement: ['body'],
37
+ BooleanLiteralTypeAnnotation: [],
38
+ BooleanTypeAnnotation: [],
39
+ BreakStatement: ['label'],
40
+ CallExpression: ['callee', 'typeArguments', 'arguments'],
41
+ CatchClause: ['param', 'body'],
42
+ ChainExpression: ['expression'],
43
+ ClassBody: ['body'],
44
+ ClassDeclaration: ['id', 'typeParameters', 'superClass', 'superTypeParameters', 'implements', 'decorators', 'body'],
45
+ ClassExpression: ['id', 'typeParameters', 'superClass', 'superTypeParameters', 'implements', 'decorators', 'body'],
46
+ ClassImplements: ['id', 'typeParameters'],
47
+ ConditionalExpression: ['test', 'consequent', 'alternate'],
48
+ ContinueStatement: ['label'],
49
+ DebuggerStatement: [],
50
+ DeclareClass: ['id', 'typeParameters', 'extends', 'implements', 'mixins', 'body'],
51
+ DeclaredPredicate: ['value'],
52
+ DeclareExportAllDeclaration: ['source'],
53
+ DeclareExportDeclaration: ['declaration', 'specifiers', 'source'],
54
+ DeclareFunction: ['id', 'predicate'],
55
+ DeclareInterface: ['id', 'typeParameters', 'extends', 'body'],
56
+ DeclareModule: ['id', 'body'],
57
+ DeclareModuleExports: ['typeAnnotation'],
58
+ DeclareOpaqueType: ['id', 'typeParameters', 'impltype', 'supertype'],
59
+ DeclareTypeAlias: ['id', 'typeParameters', 'right'],
60
+ DeclareVariable: ['id'],
61
+ DoWhileStatement: ['body', 'test'],
62
+ EmptyStatement: [],
63
+ EmptyTypeAnnotation: [],
64
+ EnumBooleanBody: ['members'],
65
+ EnumBooleanMember: ['id', 'init'],
66
+ EnumDeclaration: ['id', 'body'],
67
+ EnumDefaultedMember: ['id'],
68
+ EnumNumberBody: ['members'],
69
+ EnumNumberMember: ['id', 'init'],
70
+ EnumStringBody: ['members'],
71
+ EnumStringMember: ['id', 'init'],
72
+ EnumSymbolBody: ['members'],
73
+ ExistsTypeAnnotation: [],
74
+ ExportAllDeclaration: ['exported', 'source'],
75
+ ExportDefaultDeclaration: ['declaration'],
76
+ ExportNamedDeclaration: ['declaration', 'specifiers', 'source'],
77
+ ExportSpecifier: ['exported', 'local'],
78
+ ExpressionStatement: ['expression'],
79
+ ForInStatement: ['left', 'right', 'body'],
80
+ ForOfStatement: ['left', 'right', 'body'],
81
+ ForStatement: ['init', 'test', 'update', 'body'],
82
+ FunctionDeclaration: ['id', 'params', 'body', 'typeParameters', 'returnType', 'predicate'],
83
+ FunctionExpression: ['id', 'params', 'body', 'typeParameters', 'returnType', 'predicate'],
84
+ FunctionTypeAnnotation: ['params', 'this', 'returnType', 'rest', 'typeParameters'],
85
+ FunctionTypeParam: ['name', 'typeAnnotation'],
86
+ GenericTypeAnnotation: ['id', 'typeParameters'],
87
+ Identifier: ['typeAnnotation'],
88
+ IfStatement: ['test', 'consequent', 'alternate'],
89
+ ImportAttribute: ['key', 'value'],
90
+ ImportDeclaration: ['specifiers', 'source', 'assertions'],
91
+ ImportDefaultSpecifier: ['local'],
92
+ ImportExpression: ['source', 'attributes'],
93
+ ImportNamespaceSpecifier: ['local'],
94
+ ImportSpecifier: ['imported', 'local'],
95
+ IndexedAccessType: ['objectType', 'indexType'],
96
+ InferredPredicate: [],
97
+ InterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'],
98
+ InterfaceExtends: ['id', 'typeParameters'],
99
+ InterfaceTypeAnnotation: ['extends', 'body'],
100
+ IntersectionTypeAnnotation: ['types'],
101
+ JSXAttribute: ['name', 'value'],
102
+ JSXClosingElement: ['name'],
103
+ JSXClosingFragment: [],
104
+ JSXElement: ['openingElement', 'children', 'closingElement'],
105
+ JSXEmptyExpression: [],
106
+ JSXExpressionContainer: ['expression'],
107
+ JSXFragment: ['openingFragment', 'children', 'closingFragment'],
108
+ JSXIdentifier: [],
109
+ JSXMemberExpression: ['object', 'property'],
110
+ JSXNamespacedName: ['namespace', 'name'],
111
+ JSXOpeningElement: ['name', 'attributes'],
112
+ JSXOpeningFragment: [],
113
+ JSXSpreadAttribute: ['argument'],
114
+ JSXSpreadChild: ['expression'],
115
+ JSXText: [],
116
+ LabeledStatement: ['label', 'body'],
117
+ LogicalExpression: ['left', 'right'],
118
+ MemberExpression: ['object', 'property'],
119
+ MetaProperty: ['meta', 'property'],
120
+ MethodDefinition: ['key', 'value'],
121
+ MixedTypeAnnotation: [],
122
+ NewExpression: ['callee', 'typeArguments', 'arguments'],
123
+ NullableTypeAnnotation: ['typeAnnotation'],
124
+ NullLiteralTypeAnnotation: [],
125
+ NumberLiteralTypeAnnotation: [],
126
+ NumberTypeAnnotation: [],
127
+ ObjectExpression: ['properties'],
128
+ ObjectPattern: ['properties', 'typeAnnotation'],
129
+ ObjectTypeAnnotation: ['properties', 'indexers', 'callProperties', 'internalSlots'],
130
+ ObjectTypeCallProperty: ['value'],
131
+ ObjectTypeIndexer: ['id', 'key', 'value', 'variance'],
132
+ ObjectTypeInternalSlot: ['id', 'value'],
133
+ ObjectTypeProperty: ['key', 'value', 'variance'],
134
+ ObjectTypeSpreadProperty: ['argument'],
135
+ OpaqueType: ['id', 'typeParameters', 'impltype', 'supertype'],
136
+ OptionalIndexedAccessType: ['objectType', 'indexType'],
137
+ PrivateIdentifier: [],
138
+ Program: ['body'],
139
+ Property: ['key', 'value'],
140
+ PropertyDefinition: ['key', 'value', 'variance', 'typeAnnotation', 'tsModifiers'],
141
+ QualifiedTypeIdentifier: ['qualification', 'id'],
142
+ RestElement: ['argument'],
143
+ ReturnStatement: ['argument'],
144
+ SequenceExpression: ['expressions'],
145
+ SpreadElement: ['argument'],
146
+ StringLiteralTypeAnnotation: [],
147
+ StringTypeAnnotation: [],
148
+ Super: [],
149
+ SwitchCase: ['test', 'consequent'],
150
+ SwitchStatement: ['discriminant', 'cases'],
151
+ SymbolTypeAnnotation: [],
152
+ TaggedTemplateExpression: ['tag', 'quasi'],
153
+ TemplateElement: [],
154
+ TemplateLiteral: ['quasis', 'expressions'],
155
+ ThisExpression: [],
156
+ ThisTypeAnnotation: [],
157
+ ThrowStatement: ['argument'],
158
+ TryStatement: ['block', 'handler', 'finalizer'],
159
+ TupleTypeAnnotation: ['types'],
160
+ TypeAlias: ['id', 'typeParameters', 'right'],
161
+ TypeAnnotation: ['typeAnnotation'],
162
+ TypeCastExpression: ['expression', 'typeAnnotation'],
163
+ TypeofTypeAnnotation: ['argument'],
164
+ TypeParameter: ['bound', 'variance', 'default'],
165
+ TypeParameterDeclaration: ['params'],
166
+ TypeParameterInstantiation: ['params'],
167
+ UnaryExpression: ['argument'],
168
+ UnionTypeAnnotation: ['types'],
169
+ UpdateExpression: ['argument'],
170
+ VariableDeclaration: ['declarations'],
171
+ VariableDeclarator: ['id', 'init'],
172
+ Variance: [],
173
+ VoidTypeAnnotation: [],
174
+ WhileStatement: ['test', 'body'],
175
+ WithStatement: ['object', 'body'],
176
+ YieldExpression: ['argument'],
177
+ OptionalMemberExpression: ['object', 'property'],
178
+ OptionalCallExpression: ['callee', 'typeArguments', 'arguments'],
179
+ Literal: []
180
+ };
@@ -0,0 +1,15 @@
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
+ 'use strict';
12
+
13
+ export type VisitorKeys = $ReadOnly<{[string]: $ReadOnlyArray<string>}>;
14
+
15
+ declare module.exports: VisitorKeys;
@@ -6,12 +6,19 @@
6
6
  *
7
7
  *
8
8
  * @format
9
+ * @generated
10
+ */
11
+
12
+ /*
13
+ * !!! GENERATED FILE !!!
14
+ *
15
+ * Any manual changes to this file will be overwritten. To regenerate run `yarn build`.
9
16
  */
10
17
  // lint directives to let us do some basic validation of generated files
11
18
 
12
19
  /* eslint no-undef: 'error', no-unused-vars: ['error', {vars: "local"}], no-redeclare: 'error' */
13
20
 
14
- /* global $NonMaybeType, $Partial, $ReadOnly, $ReadOnlyArray */
21
+ /* global $NonMaybeType, Partial, $ReadOnly, $ReadOnlyArray */
15
22
  'use strict';
16
23
 
17
24
  Object.defineProperty(exports, "__esModule", {
@@ -55,6 +62,7 @@ const HERMES_AST_VISITOR_KEYS = {
55
62
  },
56
63
  BigIntLiteral: {},
57
64
  BigIntLiteralTypeAnnotation: {},
65
+ BigIntTypeAnnotation: {},
58
66
  BinaryExpression: {
59
67
  left: 'Node',
60
68
  right: 'Node'
@@ -454,7 +462,8 @@ const HERMES_AST_VISITOR_KEYS = {
454
462
  key: 'Node',
455
463
  value: 'Node',
456
464
  variance: 'Node',
457
- typeAnnotation: 'Node'
465
+ typeAnnotation: 'Node',
466
+ tsModifiers: 'Node'
458
467
  },
459
468
  QualifiedTypeIdentifier: {
460
469
  qualification: 'Node',
@@ -19,7 +19,8 @@ const DIRECTIVE_REGEX = /^\s*@([a-zA-Z0-9_-]+)( +.+)?$/;
19
19
  function parseDocblockString(docblock) {
20
20
  const directiveLines = docblock.split('\n') // remove the leading " *" from each line
21
21
  .map(line => line.trimStart().replace(/^\* ?/, '').trim()).filter(line => line.startsWith('@'));
22
- const directives = {};
22
+ const directives = // $FlowExpectedError[incompatible-type] - flow types this return as {...}
23
+ Object.create(null);
23
24
 
24
25
  for (const line of directiveLines) {
25
26
  var _match$;
@@ -24,7 +24,9 @@ export function parseDocblockString(docblock: string): DocblockDirectives {
24
24
 
25
25
  const directives: {
26
26
  [string]: Array<string>,
27
- } = {};
27
+ } =
28
+ // $FlowExpectedError[incompatible-type] - flow types this return as {...}
29
+ Object.create(null);
28
30
 
29
31
  for (const line of directiveLines) {
30
32
  const match = DIRECTIVE_REGEX.exec(line);
package/dist/index.js CHANGED
@@ -12,6 +12,13 @@
12
12
  Object.defineProperty(exports, "__esModule", {
13
13
  value: true
14
14
  });
15
+ var _exportNames = {
16
+ parse: true,
17
+ FlowVisitorKeys: true,
18
+ astArrayMutationHelpers: true,
19
+ astNodeMutationHelpers: true
20
+ };
21
+ exports.astNodeMutationHelpers = exports.astArrayMutationHelpers = void 0;
15
22
  exports.parse = parse;
16
23
 
17
24
  var HermesParser = _interopRequireWildcard(require("./HermesParser"));
@@ -20,6 +27,45 @@ var _HermesToBabelAdapter = _interopRequireDefault(require("./HermesToBabelAdapt
20
27
 
21
28
  var _HermesToESTreeAdapter = _interopRequireDefault(require("./HermesToESTreeAdapter"));
22
29
 
30
+ var _ESTreeVisitorKeys = _interopRequireDefault(require("./generated/ESTreeVisitorKeys"));
31
+
32
+ exports.FlowVisitorKeys = _ESTreeVisitorKeys.default;
33
+
34
+ var _SimpleTraverser = require("./traverse/SimpleTraverser");
35
+
36
+ Object.keys(_SimpleTraverser).forEach(function (key) {
37
+ if (key === "default" || key === "__esModule") return;
38
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
39
+ if (key in exports && exports[key] === _SimpleTraverser[key]) return;
40
+ exports[key] = _SimpleTraverser[key];
41
+ });
42
+
43
+ var _SimpleTransform = require("./transform/SimpleTransform");
44
+
45
+ Object.keys(_SimpleTransform).forEach(function (key) {
46
+ if (key === "default" || key === "__esModule") return;
47
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
48
+ if (key in exports && exports[key] === _SimpleTransform[key]) return;
49
+ exports[key] = _SimpleTransform[key];
50
+ });
51
+
52
+ var _getVisitorKeys = require("./traverse/getVisitorKeys");
53
+
54
+ Object.keys(_getVisitorKeys).forEach(function (key) {
55
+ if (key === "default" || key === "__esModule") return;
56
+ if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
57
+ if (key in exports && exports[key] === _getVisitorKeys[key]) return;
58
+ exports[key] = _getVisitorKeys[key];
59
+ });
60
+
61
+ var _astArrayMutationHelpers = _interopRequireWildcard(require("./transform/astArrayMutationHelpers"));
62
+
63
+ exports.astArrayMutationHelpers = _astArrayMutationHelpers;
64
+
65
+ var _astNodeMutationHelpers = _interopRequireWildcard(require("./transform/astNodeMutationHelpers"));
66
+
67
+ exports.astNodeMutationHelpers = _astNodeMutationHelpers;
68
+
23
69
  function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
24
70
 
25
71
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
@@ -4,7 +4,7 @@
4
4
  * This source code is licensed under the MIT license found in the
5
5
  * LICENSE file in the root directory of this source tree.
6
6
  *
7
- * @flow strict-local
7
+ * @flow strict
8
8
  * @format
9
9
  */
10
10
 
@@ -16,6 +16,7 @@ import type {ParserOptions} from './ParserOptions';
16
16
  import * as HermesParser from './HermesParser';
17
17
  import HermesToBabelAdapter from './HermesToBabelAdapter';
18
18
  import HermesToESTreeAdapter from './HermesToESTreeAdapter';
19
+ import FlowVisitorKeys from './generated/ESTreeVisitorKeys';
19
20
 
20
21
  const DEFAULTS = {
21
22
  flow: 'detect',
@@ -83,3 +84,9 @@ export function parse(
83
84
  }
84
85
 
85
86
  export type {ParserOptions} from './ParserOptions';
87
+ export * from './traverse/SimpleTraverser';
88
+ export * from './transform/SimpleTransform';
89
+ export * from './traverse/getVisitorKeys';
90
+ export {FlowVisitorKeys};
91
+ export * as astArrayMutationHelpers from './transform/astArrayMutationHelpers';
92
+ export * as astNodeMutationHelpers from './transform/astNodeMutationHelpers';