hermes-parser 0.28.0 → 0.29.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.
Files changed (41) hide show
  1. package/dist/HermesASTAdapter.js +1 -2
  2. package/dist/HermesASTAdapter.js.flow +2 -5
  3. package/dist/HermesParserNodeDeserializers.js +3 -2
  4. package/dist/HermesParserWASM.js +1 -1
  5. package/dist/HermesToESTreeAdapter.js +12 -0
  6. package/dist/HermesToESTreeAdapter.js.flow +10 -0
  7. package/dist/babel/TransformESTreeToBabel.js.flow +21 -19
  8. package/dist/estree/StripComponentSyntax.js.flow +6 -5
  9. package/dist/estree/TransformMatchSyntax.js +4 -15
  10. package/dist/estree/TransformMatchSyntax.js.flow +18 -19
  11. package/dist/generated/ESTreeVisitorKeys.js +1 -1
  12. package/dist/generated/ParserVisitorKeys.js +1 -1
  13. package/dist/index.js.flow +1 -1
  14. package/dist/src/HermesASTAdapter.js +192 -0
  15. package/dist/src/HermesParser.js +108 -0
  16. package/dist/src/HermesParserDecodeUTF8String.js +68 -0
  17. package/dist/src/HermesParserDeserializer.js +243 -0
  18. package/dist/src/HermesParserNodeDeserializers.js +2473 -0
  19. package/dist/src/HermesToESTreeAdapter.js +453 -0
  20. package/dist/src/ParserOptions.js +18 -0
  21. package/dist/src/babel/TransformESTreeToBabel.js +1104 -0
  22. package/dist/src/estree/StripComponentSyntax.js +788 -0
  23. package/dist/src/estree/StripFlowTypes.js +175 -0
  24. package/dist/src/estree/StripFlowTypesForBabel.js +215 -0
  25. package/dist/src/estree/TransformMatchSyntax.js +1005 -0
  26. package/dist/src/generated/ESTreeVisitorKeys.js +220 -0
  27. package/dist/src/generated/ParserVisitorKeys.js +790 -0
  28. package/dist/src/getModuleDocblock.js +112 -0
  29. package/dist/src/index.js +153 -0
  30. package/dist/src/transform/SimpleTransform.js +120 -0
  31. package/dist/src/transform/astArrayMutationHelpers.js +62 -0
  32. package/dist/src/transform/astNodeMutationHelpers.js +195 -0
  33. package/dist/src/traverse/SimpleTraverser.js +137 -0
  34. package/dist/src/traverse/getVisitorKeys.js +37 -0
  35. package/dist/src/utils/Builders.js +191 -0
  36. package/dist/src/utils/GenID.js +41 -0
  37. package/dist/src/utils/createSyntaxError.js +25 -0
  38. package/dist/src/utils/mutateESTreeASTForPrettier.js +127 -0
  39. package/dist/utils/Builders.js +17 -0
  40. package/dist/utils/Builders.js.flow +20 -0
  41. package/package.json +2 -2
@@ -176,11 +176,10 @@ class HermesASTAdapter {
176
176
  }
177
177
 
178
178
  getBigIntLiteralValue(bigintString) {
179
- // TODO - once we update flow we can remove this
180
179
  const bigint = bigintString // estree spec is to not have a trailing `n` on this property
181
180
  // https://github.com/estree/estree/blob/db962bb417a97effcfe9892f87fbb93c81a68584/es2020.md#bigintliteral
182
181
  .replace(/n$/, '') // `BigInt` doesn't accept numeric separator and `bigint` property should not include numeric separator
183
- .replace(/_/, '');
182
+ .replaceAll('_', '');
184
183
  return {
185
184
  bigint,
186
185
  // coerce the string to a bigint value if supported by the environment
@@ -172,17 +172,14 @@ export default class HermesASTAdapter {
172
172
 
173
173
  getBigIntLiteralValue(bigintString: string): {
174
174
  bigint: string,
175
- value: $FlowFixMe /* bigint */,
175
+ value: bigint | null,
176
176
  } {
177
- // TODO - once we update flow we can remove this
178
- declare var BigInt: ?(value: $FlowFixMe) => mixed;
179
-
180
177
  const bigint = bigintString
181
178
  // estree spec is to not have a trailing `n` on this property
182
179
  // https://github.com/estree/estree/blob/db962bb417a97effcfe9892f87fbb93c81a68584/es2020.md#bigintliteral
183
180
  .replace(/n$/, '')
184
181
  // `BigInt` doesn't accept numeric separator and `bigint` property should not include numeric separator
185
- .replace(/_/, '');
182
+ .replaceAll('_', '');
186
183
  return {
187
184
  bigint,
188
185
  // coerce the string to a bigint value if supported by the environment
@@ -209,7 +209,8 @@ function deserializeBlockStatement() {
209
209
  return {
210
210
  type: 'BlockStatement',
211
211
  loc: this.addEmptyLoc(),
212
- body: this.deserializeNodeList()
212
+ body: this.deserializeNodeList(),
213
+ implicit: this.deserializeBoolean()
213
214
  };
214
215
  }
215
216
 
@@ -440,7 +441,7 @@ function deserializeImportExpression() {
440
441
  type: 'ImportExpression',
441
442
  loc: this.addEmptyLoc(),
442
443
  source: this.deserializeNode(),
443
- attributes: this.deserializeNode()
444
+ options: this.deserializeNode()
444
445
  };
445
446
  }
446
447