hermes-parser 0.31.2 → 0.32.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.
- package/README.md +3 -0
- package/dist/HermesASTAdapter.js +2 -2
- package/dist/HermesASTAdapter.js.flow +2 -2
- package/dist/HermesParserDeserializer.js +0 -1
- package/dist/HermesParserDeserializer.js.flow +0 -1
- package/dist/HermesParserWASM.js +1 -1
- package/dist/ParserOptions.js +1 -1
- package/dist/ParserOptions.js.flow +8 -0
- package/dist/babel/TransformESTreeToBabel.js +11 -8
- package/dist/babel/TransformESTreeToBabel.js.flow +11 -8
- package/dist/estree/{StripComponentSyntax.js → TransformComponentSyntax.js} +2 -2
- package/dist/estree/{StripComponentSyntax.js.flow → TransformComponentSyntax.js.flow} +2 -2
- package/dist/estree/TransformEnumSyntax.js +106 -0
- package/dist/estree/TransformEnumSyntax.js.flow +125 -0
- package/dist/index.js +6 -3
- package/dist/index.js.flow +6 -3
- package/dist/src/HermesASTAdapter.js +2 -2
- package/dist/src/HermesParserDeserializer.js +0 -1
- package/dist/src/ParserOptions.js +1 -1
- package/dist/src/babel/TransformESTreeToBabel.js +11 -8
- package/dist/src/estree/{StripComponentSyntax.js → TransformComponentSyntax.js} +2 -2
- package/dist/src/estree/TransformEnumSyntax.js +106 -0
- package/dist/src/index.js +6 -3
- package/dist/src/transform/SimpleTransform.js +20 -4
- package/dist/src/transform/astNodeMutationHelpers.js +7 -2
- package/dist/transform/SimpleTransform.js +20 -4
- package/dist/transform/SimpleTransform.js.flow +34 -8
- package/dist/transform/astNodeMutationHelpers.js +7 -2
- package/dist/transform/astNodeMutationHelpers.js.flow +10 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,3 +9,6 @@ The Hermes parser exposes a single `parse(code, [options])` function, where `cod
|
|
|
9
9
|
- **sourceFilename**: `string`, defaults to `null`. The filename corresponding to the code that is to be parsed. If non-null, the filename will be added to all source locations in the output AST.
|
|
10
10
|
- **sourceType**: `"module"`, `"script"`, or `"unambiguous"` (default). If `"unambiguous"`, source type will be automatically detected and set to `"module"` if any ES6 imports or exports are present in the code, otherwise source type will be set to `"script"`.
|
|
11
11
|
- **tokens**: `boolean`, defaults to `false`. If `true`, add all tokens to a `tokens` property on the root node.
|
|
12
|
+
- **transformOptions**: `object`. Options to be supplied to relevant transforms.
|
|
13
|
+
- `TransformEnumSyntax`
|
|
14
|
+
- `getRuntime` (optional): `() => Expression` - The expression which should be a reference to the Flow Enums runtime. By default, is `require('flow-enums-runtime')`.
|
package/dist/HermesASTAdapter.js
CHANGED
|
@@ -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-
|
|
62
|
+
} // $FlowExpectedError[incompatible-type] We know this is a program at this point.
|
|
63
63
|
|
|
64
64
|
|
|
65
65
|
return resultNode;
|
|
@@ -130,7 +130,7 @@ class HermesASTAdapter {
|
|
|
130
130
|
}
|
|
131
131
|
|
|
132
132
|
mapEmpty(_node) {
|
|
133
|
-
// $FlowExpectedError
|
|
133
|
+
// $FlowExpectedError[incompatible-type]
|
|
134
134
|
return null;
|
|
135
135
|
}
|
|
136
136
|
|
|
@@ -65,7 +65,7 @@ export default class HermesASTAdapter {
|
|
|
65
65
|
);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
-
// $FlowExpectedError[incompatible-
|
|
68
|
+
// $FlowExpectedError[incompatible-type] We know this is a program at this point.
|
|
69
69
|
return resultNode;
|
|
70
70
|
}
|
|
71
71
|
|
|
@@ -125,7 +125,7 @@ export default class HermesASTAdapter {
|
|
|
125
125
|
}
|
|
126
126
|
|
|
127
127
|
mapEmpty(_node: HermesNode): HermesNode {
|
|
128
|
-
// $FlowExpectedError
|
|
128
|
+
// $FlowExpectedError[incompatible-type]
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
131
|
|
|
@@ -223,7 +223,6 @@ export default class HermesParserDeserializer {
|
|
|
223
223
|
* objects that are filled after the AST has been deserialized.
|
|
224
224
|
*/
|
|
225
225
|
addEmptyLoc(): HermesSourceLocation {
|
|
226
|
-
// $FlowExpectedError
|
|
227
226
|
const loc: HermesSourceLocation = {};
|
|
228
227
|
this.locMap[this.next()] = loc;
|
|
229
228
|
return loc;
|