hermes-parser
Advanced tools
Comparing version 0.10.1 to 0.11.0
@@ -47,7 +47,14 @@ /** | ||
ClassImplements: ['id', 'typeParameters'], | ||
ComponentDeclaration: ['id', 'params', 'body', 'typeParameters', 'returnType'], | ||
ComponentParameter: ['name', 'local'], | ||
ComponentTypeAnnotation: ['params', 'rest', 'typeParameters', 'returnType'], | ||
ComponentTypeParameter: ['name', 'typeAnnotation'], | ||
ConditionalExpression: ['test', 'consequent', 'alternate'], | ||
ConditionalTypeAnnotation: ['checkType', 'extendsType', 'trueType', 'falseType'], | ||
ContinueStatement: ['label'], | ||
DebuggerStatement: [], | ||
DeclareClass: ['id', 'typeParameters', 'extends', 'implements', 'mixins', 'body'], | ||
DeclareComponent: ['id', 'params', 'rest', 'typeParameters', 'returnType'], | ||
DeclaredPredicate: ['value'], | ||
DeclareEnum: ['id', 'body'], | ||
DeclareExportAllDeclaration: ['source'], | ||
@@ -98,2 +105,3 @@ DeclareExportDeclaration: ['declaration', 'specifiers', 'source'], | ||
InferredPredicate: [], | ||
InferTypeAnnotation: ['typeParameter'], | ||
InterfaceDeclaration: ['id', 'typeParameters', 'extends', 'body'], | ||
@@ -113,3 +121,3 @@ InterfaceExtends: ['id', 'typeParameters'], | ||
JSXNamespacedName: ['namespace', 'name'], | ||
JSXOpeningElement: ['name', 'attributes'], | ||
JSXOpeningElement: ['name', 'attributes', 'typeArguments'], | ||
JSXOpeningFragment: [], | ||
@@ -119,2 +127,3 @@ JSXSpreadAttribute: ['argument'], | ||
JSXText: [], | ||
KeyofTypeAnnotation: ['argument'], | ||
LabeledStatement: ['label', 'body'], | ||
@@ -137,2 +146,3 @@ LogicalExpression: ['left', 'right'], | ||
ObjectTypeInternalSlot: ['id', 'value'], | ||
ObjectTypeMappedTypeProperty: ['keyTparam', 'propType', 'sourceType', 'variance'], | ||
ObjectTypeProperty: ['key', 'value', 'variance'], | ||
@@ -147,2 +157,3 @@ ObjectTypeSpreadProperty: ['argument'], | ||
QualifiedTypeIdentifier: ['qualification', 'id'], | ||
QualifiedTypeofIdentifier: ['qualification', 'id'], | ||
RestElement: ['argument'], | ||
@@ -166,2 +177,4 @@ ReturnStatement: ['argument'], | ||
TupleTypeAnnotation: ['types'], | ||
TupleTypeLabeledElement: ['label', 'elementType', 'variance'], | ||
TupleTypeSpreadElement: ['label', 'typeAnnotation'], | ||
TypeAlias: ['id', 'typeParameters', 'right'], | ||
@@ -174,2 +187,3 @@ TypeAnnotation: ['typeAnnotation'], | ||
TypeParameterInstantiation: ['params'], | ||
TypePredicate: ['parameterName', 'typeAnnotation'], | ||
UnaryExpression: ['argument'], | ||
@@ -176,0 +190,0 @@ UnionTypeAnnotation: ['types'], |
@@ -116,2 +116,23 @@ /** | ||
}, | ||
ComponentDeclaration: { | ||
id: 'Node', | ||
params: 'NodeList', | ||
body: 'Node', | ||
typeParameters: 'Node', | ||
returnType: 'Node' | ||
}, | ||
ComponentParameter: { | ||
name: 'Node', | ||
local: 'Node' | ||
}, | ||
ComponentTypeAnnotation: { | ||
params: 'NodeList', | ||
rest: 'Node', | ||
typeParameters: 'Node', | ||
returnType: 'Node' | ||
}, | ||
ComponentTypeParameter: { | ||
name: 'Node', | ||
typeAnnotation: 'Node' | ||
}, | ||
ConditionalExpression: { | ||
@@ -122,2 +143,8 @@ test: 'Node', | ||
}, | ||
ConditionalTypeAnnotation: { | ||
checkType: 'Node', | ||
extendsType: 'Node', | ||
trueType: 'Node', | ||
falseType: 'Node' | ||
}, | ||
ContinueStatement: { | ||
@@ -135,5 +162,16 @@ label: 'Node' | ||
}, | ||
DeclareComponent: { | ||
id: 'Node', | ||
params: 'NodeList', | ||
rest: 'Node', | ||
typeParameters: 'Node', | ||
returnType: 'Node' | ||
}, | ||
DeclaredPredicate: { | ||
value: 'Node' | ||
}, | ||
DeclareEnum: { | ||
id: 'Node', | ||
body: 'Node' | ||
}, | ||
DeclareExportAllDeclaration: { | ||
@@ -318,2 +356,5 @@ source: 'Node' | ||
InferredPredicate: {}, | ||
InferTypeAnnotation: { | ||
typeParameter: 'Node' | ||
}, | ||
InterfaceDeclaration: { | ||
@@ -369,3 +410,4 @@ id: 'Node', | ||
name: 'Node', | ||
attributes: 'NodeList' | ||
attributes: 'NodeList', | ||
typeArguments: 'Node' | ||
}, | ||
@@ -380,2 +422,5 @@ JSXOpeningFragment: {}, | ||
JSXText: {}, | ||
KeyofTypeAnnotation: { | ||
argument: 'Node' | ||
}, | ||
LabeledStatement: { | ||
@@ -441,2 +486,8 @@ label: 'Node', | ||
}, | ||
ObjectTypeMappedTypeProperty: { | ||
keyTparam: 'Node', | ||
propType: 'Node', | ||
sourceType: 'Node', | ||
variance: 'Node' | ||
}, | ||
ObjectTypeProperty: { | ||
@@ -479,2 +530,6 @@ key: 'Node', | ||
}, | ||
QualifiedTypeofIdentifier: { | ||
qualification: 'Node', | ||
id: 'Node' | ||
}, | ||
RegExpLiteral: {}, | ||
@@ -528,2 +583,11 @@ RestElement: { | ||
}, | ||
TupleTypeLabeledElement: { | ||
label: 'Node', | ||
elementType: 'Node', | ||
variance: 'Node' | ||
}, | ||
TupleTypeSpreadElement: { | ||
label: 'Node', | ||
typeAnnotation: 'Node' | ||
}, | ||
TypeAlias: { | ||
@@ -555,2 +619,6 @@ id: 'Node', | ||
}, | ||
TypePredicate: { | ||
parameterName: 'Node', | ||
typeAnnotation: 'Node' | ||
}, | ||
UnaryExpression: { | ||
@@ -557,0 +625,0 @@ argument: 'Node' |
@@ -23,3 +23,3 @@ /** | ||
const hermesParse = _HermesParserWASM.default.cwrap('hermesParse', 'number', ['number', 'number', 'number', 'number', 'number']); | ||
const hermesParse = _HermesParserWASM.default.cwrap('hermesParse', 'number', ['number', 'number', 'number', 'number', 'number', 'number']); | ||
@@ -60,3 +60,3 @@ const hermesParseResult_free = _HermesParserWASM.default.cwrap('hermesParseResult_free', 'void', ['number']); | ||
copyToHeap(sourceBuffer, sourceAddr); | ||
const parseResult = hermesParse(sourceAddr, sourceBuffer.length + 1, options.flow === 'detect', options.tokens, options.allowReturnOutsideFunction); | ||
const parseResult = hermesParse(sourceAddr, sourceBuffer.length + 1, options.flow === 'detect', options.enableExperimentalComponentSyntax, options.tokens, options.allowReturnOutsideFunction); | ||
@@ -63,0 +63,0 @@ try { |
@@ -912,3 +912,4 @@ /** | ||
attributes: this.deserializeNodeList(), | ||
selfClosing: this.deserializeBoolean() | ||
selfClosing: this.deserializeBoolean(), | ||
typeArguments: this.deserializeNode() | ||
}; | ||
@@ -1128,2 +1129,23 @@ } | ||
function deserializeComponentTypeAnnotation() { | ||
return { | ||
type: 'ComponentTypeAnnotation', | ||
loc: this.addEmptyLoc(), | ||
params: this.deserializeNodeList(), | ||
rest: this.deserializeNode(), | ||
typeParameters: this.deserializeNode(), | ||
returnType: this.deserializeNode() | ||
}; | ||
} | ||
function deserializeComponentTypeParameter() { | ||
return { | ||
type: 'ComponentTypeParameter', | ||
loc: this.addEmptyLoc(), | ||
name: this.deserializeNode(), | ||
typeAnnotation: this.deserializeNode(), | ||
optional: this.deserializeBoolean() | ||
}; | ||
} | ||
function deserializeNullableTypeAnnotation() { | ||
@@ -1154,2 +1176,19 @@ return { | ||
function deserializeKeyofTypeAnnotation() { | ||
return { | ||
type: 'KeyofTypeAnnotation', | ||
loc: this.addEmptyLoc(), | ||
argument: this.deserializeNode() | ||
}; | ||
} | ||
function deserializeQualifiedTypeofIdentifier() { | ||
return { | ||
type: 'QualifiedTypeofIdentifier', | ||
loc: this.addEmptyLoc(), | ||
qualification: this.deserializeNode(), | ||
id: this.deserializeNode() | ||
}; | ||
} | ||
function deserializeTupleTypeAnnotation() { | ||
@@ -1163,2 +1202,22 @@ return { | ||
function deserializeTupleTypeSpreadElement() { | ||
return { | ||
type: 'TupleTypeSpreadElement', | ||
loc: this.addEmptyLoc(), | ||
label: this.deserializeNode(), | ||
typeAnnotation: this.deserializeNode() | ||
}; | ||
} | ||
function deserializeTupleTypeLabeledElement() { | ||
return { | ||
type: 'TupleTypeLabeledElement', | ||
loc: this.addEmptyLoc(), | ||
label: this.deserializeNode(), | ||
elementType: this.deserializeNode(), | ||
optional: this.deserializeBoolean(), | ||
variance: this.deserializeNode() | ||
}; | ||
} | ||
function deserializeArrayTypeAnnotation() { | ||
@@ -1172,2 +1231,10 @@ return { | ||
function deserializeInferTypeAnnotation() { | ||
return { | ||
type: 'InferTypeAnnotation', | ||
loc: this.addEmptyLoc(), | ||
typeParameter: this.deserializeNode() | ||
}; | ||
} | ||
function deserializeUnionTypeAnnotation() { | ||
@@ -1217,2 +1284,23 @@ return { | ||
function deserializeConditionalTypeAnnotation() { | ||
return { | ||
type: 'ConditionalTypeAnnotation', | ||
loc: this.addEmptyLoc(), | ||
checkType: this.deserializeNode(), | ||
extendsType: this.deserializeNode(), | ||
trueType: this.deserializeNode(), | ||
falseType: this.deserializeNode() | ||
}; | ||
} | ||
function deserializeTypePredicate() { | ||
return { | ||
type: 'TypePredicate', | ||
loc: this.addEmptyLoc(), | ||
parameterName: this.deserializeNode(), | ||
typeAnnotation: this.deserializeNode(), | ||
asserts: this.deserializeBoolean() | ||
}; | ||
} | ||
function deserializeInterfaceTypeAnnotation() { | ||
@@ -1313,2 +1401,14 @@ return { | ||
function deserializeDeclareComponent() { | ||
return { | ||
type: 'DeclareComponent', | ||
loc: this.addEmptyLoc(), | ||
id: this.deserializeNode(), | ||
params: this.deserializeNodeList(), | ||
rest: this.deserializeNode(), | ||
typeParameters: this.deserializeNode(), | ||
returnType: this.deserializeNode() | ||
}; | ||
} | ||
function deserializeDeclareVariable() { | ||
@@ -1318,6 +1418,16 @@ return { | ||
loc: this.addEmptyLoc(), | ||
id: this.deserializeNode() | ||
id: this.deserializeNode(), | ||
kind: this.deserializeString() | ||
}; | ||
} | ||
function deserializeDeclareEnum() { | ||
return { | ||
type: 'DeclareEnum', | ||
loc: this.addEmptyLoc(), | ||
id: this.deserializeNode(), | ||
body: this.deserializeNode() | ||
}; | ||
} | ||
function deserializeDeclareExportDeclaration() { | ||
@@ -1455,2 +1565,14 @@ return { | ||
function deserializeObjectTypeMappedTypeProperty() { | ||
return { | ||
type: 'ObjectTypeMappedTypeProperty', | ||
loc: this.addEmptyLoc(), | ||
keyTparam: this.deserializeNode(), | ||
propType: this.deserializeNode(), | ||
sourceType: this.deserializeNode(), | ||
variance: this.deserializeNode(), | ||
optional: this.deserializeString() | ||
}; | ||
} | ||
function deserializeVariance() { | ||
@@ -1598,2 +1720,24 @@ return { | ||
function deserializeComponentDeclaration() { | ||
return { | ||
type: 'ComponentDeclaration', | ||
loc: this.addEmptyLoc(), | ||
id: this.deserializeNode(), | ||
params: this.deserializeNodeList(), | ||
body: this.deserializeNode(), | ||
typeParameters: this.deserializeNode(), | ||
returnType: this.deserializeNode() | ||
}; | ||
} | ||
function deserializeComponentParameter() { | ||
return { | ||
type: 'ComponentParameter', | ||
loc: this.addEmptyLoc(), | ||
name: this.deserializeNode(), | ||
local: this.deserializeNode(), | ||
shorthand: this.deserializeBoolean() | ||
}; | ||
} | ||
function deserializeTSTypeAnnotation() { | ||
@@ -1902,6 +2046,6 @@ return { | ||
loc: this.addEmptyLoc(), | ||
checkType: this.deserializeNode(), | ||
extendsType: this.deserializeNode(), | ||
checkType: this.deserializeNode(), | ||
trueType: this.deserializeNode(), | ||
falseTYpe: this.deserializeNode() | ||
falseType: this.deserializeNode() | ||
}; | ||
@@ -2019,2 +2163,2 @@ } | ||
module.exports = [deserializeEmpty, deserializeMetadata, deserializeFunctionLikeFirst, deserializeProgram, deserializeFunctionExpression, deserializeArrowFunctionExpression, deserializeFunctionDeclaration, deserializeFunctionLikeLast, deserializeStatementFirst, deserializeLoopStatementFirst, deserializeWhileStatement, deserializeDoWhileStatement, deserializeForInStatement, deserializeForOfStatement, deserializeForStatement, deserializeLoopStatementLast, deserializeDebuggerStatement, deserializeEmptyStatement, deserializeBlockStatement, deserializeBreakStatement, deserializeContinueStatement, deserializeThrowStatement, deserializeReturnStatement, deserializeWithStatement, deserializeSwitchStatement, deserializeLabeledStatement, deserializeExpressionStatement, deserializeTryStatement, deserializeIfStatement, deserializeStatementLast, deserializeNullLiteral, deserializeBooleanLiteral, deserializeStringLiteral, deserializeNumericLiteral, deserializeRegExpLiteral, deserializeBigIntLiteral, deserializeThisExpression, deserializeSuper, deserializeSequenceExpression, deserializeObjectExpression, deserializeArrayExpression, deserializeSpreadElement, deserializeNewExpression, deserializeYieldExpression, deserializeAwaitExpression, deserializeImportExpression, deserializeCallExpressionLikeFirst, deserializeCallExpression, deserializeOptionalCallExpression, deserializeCallExpressionLikeLast, deserializeAssignmentExpression, deserializeUnaryExpression, deserializeUpdateExpression, deserializeMemberExpressionLikeFirst, deserializeMemberExpression, deserializeOptionalMemberExpression, deserializeMemberExpressionLikeLast, deserializeLogicalExpression, deserializeConditionalExpression, deserializeBinaryExpression, deserializeDirective, deserializeDirectiveLiteral, deserializeIdentifier, deserializePrivateName, deserializeMetaProperty, deserializeSwitchCase, deserializeCatchClause, deserializeVariableDeclarator, deserializeVariableDeclaration, deserializeTemplateLiteral, deserializeTaggedTemplateExpression, deserializeTemplateElement, deserializeProperty, deserializeClassDeclaration, deserializeClassExpression, deserializeClassBody, deserializeClassProperty, deserializeClassPrivateProperty, deserializeMethodDefinition, deserializeImportDeclaration, deserializeImportSpecifier, deserializeImportDefaultSpecifier, deserializeImportNamespaceSpecifier, deserializeImportAttribute, deserializeExportNamedDeclaration, deserializeExportSpecifier, deserializeExportNamespaceSpecifier, deserializeExportDefaultDeclaration, deserializeExportAllDeclaration, deserializePatternFirst, deserializeObjectPattern, deserializeArrayPattern, deserializeRestElement, deserializeAssignmentPattern, deserializePatternLast, deserializeJSXIdentifier, deserializeJSXMemberExpression, deserializeJSXNamespacedName, deserializeJSXEmptyExpression, deserializeJSXExpressionContainer, deserializeJSXSpreadChild, deserializeJSXOpeningElement, deserializeJSXClosingElement, deserializeJSXAttribute, deserializeJSXSpreadAttribute, deserializeJSXStringLiteral, deserializeJSXText, deserializeJSXElement, deserializeJSXFragment, deserializeJSXOpeningFragment, deserializeJSXClosingFragment, deserializeExistsTypeAnnotation, deserializeEmptyTypeAnnotation, deserializeStringTypeAnnotation, deserializeNumberTypeAnnotation, deserializeStringLiteralTypeAnnotation, deserializeNumberLiteralTypeAnnotation, deserializeBigIntLiteralTypeAnnotation, deserializeBooleanTypeAnnotation, deserializeBooleanLiteralTypeAnnotation, deserializeNullLiteralTypeAnnotation, deserializeSymbolTypeAnnotation, deserializeAnyTypeAnnotation, deserializeMixedTypeAnnotation, deserializeBigIntTypeAnnotation, deserializeVoidTypeAnnotation, deserializeFunctionTypeAnnotation, deserializeFunctionTypeParam, deserializeNullableTypeAnnotation, deserializeQualifiedTypeIdentifier, deserializeTypeofTypeAnnotation, deserializeTupleTypeAnnotation, deserializeArrayTypeAnnotation, deserializeUnionTypeAnnotation, deserializeIntersectionTypeAnnotation, deserializeGenericTypeAnnotation, deserializeIndexedAccessType, deserializeOptionalIndexedAccessType, deserializeInterfaceTypeAnnotation, deserializeTypeAlias, deserializeOpaqueType, deserializeInterfaceDeclaration, deserializeDeclareTypeAlias, deserializeDeclareOpaqueType, deserializeDeclareInterface, deserializeDeclareClass, deserializeDeclareFunction, deserializeDeclareVariable, deserializeDeclareExportDeclaration, deserializeDeclareExportAllDeclaration, deserializeDeclareModule, deserializeDeclareModuleExports, deserializeInterfaceExtends, deserializeClassImplements, deserializeTypeAnnotation, deserializeObjectTypeAnnotation, deserializeObjectTypeProperty, deserializeObjectTypeSpreadProperty, deserializeObjectTypeInternalSlot, deserializeObjectTypeCallProperty, deserializeObjectTypeIndexer, deserializeVariance, deserializeTypeParameterDeclaration, deserializeTypeParameter, deserializeTypeParameterInstantiation, deserializeTypeCastExpression, deserializeInferredPredicate, deserializeDeclaredPredicate, deserializeEnumDeclaration, deserializeEnumStringBody, deserializeEnumNumberBody, deserializeEnumBooleanBody, deserializeEnumSymbolBody, deserializeEnumDefaultedMember, deserializeEnumStringMember, deserializeEnumNumberMember, deserializeEnumBooleanMember, deserializeTSTypeAnnotation, deserializeTSAnyKeyword, deserializeTSNumberKeyword, deserializeTSBooleanKeyword, deserializeTSStringKeyword, deserializeTSSymbolKeyword, deserializeTSVoidKeyword, deserializeTSThisType, deserializeTSLiteralType, deserializeTSIndexedAccessType, deserializeTSArrayType, deserializeTSTypeReference, deserializeTSQualifiedName, deserializeTSFunctionType, deserializeTSConstructorType, deserializeTSTypePredicate, deserializeTSTupleType, deserializeTSTypeAssertion, deserializeTSAsExpression, deserializeTSParameterProperty, deserializeTSTypeAliasDeclaration, deserializeTSInterfaceDeclaration, deserializeTSInterfaceHeritage, deserializeTSInterfaceBody, deserializeTSEnumDeclaration, deserializeTSEnumMember, deserializeTSModuleDeclaration, deserializeTSModuleBlock, deserializeTSModuleMember, deserializeTSTypeParameterDeclaration, deserializeTSTypeParameter, deserializeTSTypeParameterInstantiation, deserializeTSUnionType, deserializeTSIntersectionType, deserializeTSTypeQuery, deserializeTSConditionalType, deserializeTSTypeLiteral, deserializeTSPropertySignature, deserializeTSMethodSignature, deserializeTSIndexSignature, deserializeTSCallSignatureDeclaration, deserializeTSModifiers, deserializeCoverFirst, deserializeCoverEmptyArgs, deserializeCoverTrailingComma, deserializeCoverInitializer, deserializeCoverRestElement, deserializeCoverTypedIdentifier, deserializeCoverLast]; | ||
module.exports = [deserializeEmpty, deserializeMetadata, deserializeFunctionLikeFirst, deserializeProgram, deserializeFunctionExpression, deserializeArrowFunctionExpression, deserializeFunctionDeclaration, deserializeFunctionLikeLast, deserializeStatementFirst, deserializeLoopStatementFirst, deserializeWhileStatement, deserializeDoWhileStatement, deserializeForInStatement, deserializeForOfStatement, deserializeForStatement, deserializeLoopStatementLast, deserializeDebuggerStatement, deserializeEmptyStatement, deserializeBlockStatement, deserializeBreakStatement, deserializeContinueStatement, deserializeThrowStatement, deserializeReturnStatement, deserializeWithStatement, deserializeSwitchStatement, deserializeLabeledStatement, deserializeExpressionStatement, deserializeTryStatement, deserializeIfStatement, deserializeStatementLast, deserializeNullLiteral, deserializeBooleanLiteral, deserializeStringLiteral, deserializeNumericLiteral, deserializeRegExpLiteral, deserializeBigIntLiteral, deserializeThisExpression, deserializeSuper, deserializeSequenceExpression, deserializeObjectExpression, deserializeArrayExpression, deserializeSpreadElement, deserializeNewExpression, deserializeYieldExpression, deserializeAwaitExpression, deserializeImportExpression, deserializeCallExpressionLikeFirst, deserializeCallExpression, deserializeOptionalCallExpression, deserializeCallExpressionLikeLast, deserializeAssignmentExpression, deserializeUnaryExpression, deserializeUpdateExpression, deserializeMemberExpressionLikeFirst, deserializeMemberExpression, deserializeOptionalMemberExpression, deserializeMemberExpressionLikeLast, deserializeLogicalExpression, deserializeConditionalExpression, deserializeBinaryExpression, deserializeDirective, deserializeDirectiveLiteral, deserializeIdentifier, deserializePrivateName, deserializeMetaProperty, deserializeSwitchCase, deserializeCatchClause, deserializeVariableDeclarator, deserializeVariableDeclaration, deserializeTemplateLiteral, deserializeTaggedTemplateExpression, deserializeTemplateElement, deserializeProperty, deserializeClassDeclaration, deserializeClassExpression, deserializeClassBody, deserializeClassProperty, deserializeClassPrivateProperty, deserializeMethodDefinition, deserializeImportDeclaration, deserializeImportSpecifier, deserializeImportDefaultSpecifier, deserializeImportNamespaceSpecifier, deserializeImportAttribute, deserializeExportNamedDeclaration, deserializeExportSpecifier, deserializeExportNamespaceSpecifier, deserializeExportDefaultDeclaration, deserializeExportAllDeclaration, deserializePatternFirst, deserializeObjectPattern, deserializeArrayPattern, deserializeRestElement, deserializeAssignmentPattern, deserializePatternLast, deserializeJSXIdentifier, deserializeJSXMemberExpression, deserializeJSXNamespacedName, deserializeJSXEmptyExpression, deserializeJSXExpressionContainer, deserializeJSXSpreadChild, deserializeJSXOpeningElement, deserializeJSXClosingElement, deserializeJSXAttribute, deserializeJSXSpreadAttribute, deserializeJSXStringLiteral, deserializeJSXText, deserializeJSXElement, deserializeJSXFragment, deserializeJSXOpeningFragment, deserializeJSXClosingFragment, deserializeExistsTypeAnnotation, deserializeEmptyTypeAnnotation, deserializeStringTypeAnnotation, deserializeNumberTypeAnnotation, deserializeStringLiteralTypeAnnotation, deserializeNumberLiteralTypeAnnotation, deserializeBigIntLiteralTypeAnnotation, deserializeBooleanTypeAnnotation, deserializeBooleanLiteralTypeAnnotation, deserializeNullLiteralTypeAnnotation, deserializeSymbolTypeAnnotation, deserializeAnyTypeAnnotation, deserializeMixedTypeAnnotation, deserializeBigIntTypeAnnotation, deserializeVoidTypeAnnotation, deserializeFunctionTypeAnnotation, deserializeFunctionTypeParam, deserializeComponentTypeAnnotation, deserializeComponentTypeParameter, deserializeNullableTypeAnnotation, deserializeQualifiedTypeIdentifier, deserializeTypeofTypeAnnotation, deserializeKeyofTypeAnnotation, deserializeQualifiedTypeofIdentifier, deserializeTupleTypeAnnotation, deserializeTupleTypeSpreadElement, deserializeTupleTypeLabeledElement, deserializeArrayTypeAnnotation, deserializeInferTypeAnnotation, deserializeUnionTypeAnnotation, deserializeIntersectionTypeAnnotation, deserializeGenericTypeAnnotation, deserializeIndexedAccessType, deserializeOptionalIndexedAccessType, deserializeConditionalTypeAnnotation, deserializeTypePredicate, deserializeInterfaceTypeAnnotation, deserializeTypeAlias, deserializeOpaqueType, deserializeInterfaceDeclaration, deserializeDeclareTypeAlias, deserializeDeclareOpaqueType, deserializeDeclareInterface, deserializeDeclareClass, deserializeDeclareFunction, deserializeDeclareComponent, deserializeDeclareVariable, deserializeDeclareEnum, deserializeDeclareExportDeclaration, deserializeDeclareExportAllDeclaration, deserializeDeclareModule, deserializeDeclareModuleExports, deserializeInterfaceExtends, deserializeClassImplements, deserializeTypeAnnotation, deserializeObjectTypeAnnotation, deserializeObjectTypeProperty, deserializeObjectTypeSpreadProperty, deserializeObjectTypeInternalSlot, deserializeObjectTypeCallProperty, deserializeObjectTypeIndexer, deserializeObjectTypeMappedTypeProperty, deserializeVariance, deserializeTypeParameterDeclaration, deserializeTypeParameter, deserializeTypeParameterInstantiation, deserializeTypeCastExpression, deserializeInferredPredicate, deserializeDeclaredPredicate, deserializeEnumDeclaration, deserializeEnumStringBody, deserializeEnumNumberBody, deserializeEnumBooleanBody, deserializeEnumSymbolBody, deserializeEnumDefaultedMember, deserializeEnumStringMember, deserializeEnumNumberMember, deserializeEnumBooleanMember, deserializeComponentDeclaration, deserializeComponentParameter, deserializeTSTypeAnnotation, deserializeTSAnyKeyword, deserializeTSNumberKeyword, deserializeTSBooleanKeyword, deserializeTSStringKeyword, deserializeTSSymbolKeyword, deserializeTSVoidKeyword, deserializeTSThisType, deserializeTSLiteralType, deserializeTSIndexedAccessType, deserializeTSArrayType, deserializeTSTypeReference, deserializeTSQualifiedName, deserializeTSFunctionType, deserializeTSConstructorType, deserializeTSTypePredicate, deserializeTSTupleType, deserializeTSTypeAssertion, deserializeTSAsExpression, deserializeTSParameterProperty, deserializeTSTypeAliasDeclaration, deserializeTSInterfaceDeclaration, deserializeTSInterfaceHeritage, deserializeTSInterfaceBody, deserializeTSEnumDeclaration, deserializeTSEnumMember, deserializeTSModuleDeclaration, deserializeTSModuleBlock, deserializeTSModuleMember, deserializeTSTypeParameterDeclaration, deserializeTSTypeParameter, deserializeTSTypeParameterInstantiation, deserializeTSUnionType, deserializeTSIntersectionType, deserializeTSTypeQuery, deserializeTSConditionalType, deserializeTSTypeLiteral, deserializeTSPropertySignature, deserializeTSMethodSignature, deserializeTSIndexSignature, deserializeTSCallSignatureDeclaration, deserializeTSModifiers, deserializeCoverFirst, deserializeCoverEmptyArgs, deserializeCoverTrailingComma, deserializeCoverInitializer, deserializeCoverRestElement, deserializeCoverTypedIdentifier, deserializeCoverLast]; |
@@ -110,2 +110,8 @@ "use strict"; | ||
case 'OptionalIndexedAccessType': | ||
case 'KeyofTypeAnnotation': | ||
case 'ConditionalType': | ||
case 'InferType': | ||
case 'TupleTypeLabeledElement': | ||
case 'TupleTypeSpreadElement': | ||
case 'ObjectTypeMappedTypeProperty': | ||
return this.mapUnsupportedTypeAnnotation(node); | ||
@@ -122,2 +128,17 @@ | ||
case 'TypeofTypeAnnotation': | ||
return this.mapTypeofTypeAnnotation(node); | ||
case 'QualifiedTypeofIdentifier': | ||
return this.mapQualifiedTypeofIdentifier(node); | ||
case 'DeclareVariable': | ||
return this.mapDeclareVariable(node); | ||
case 'DeclareEnum': | ||
return this.mapDeclareEnum(node); | ||
case 'JSXElement': | ||
return this.mapJSXElement(node); | ||
default: | ||
@@ -514,4 +535,36 @@ return this.mapNodeDefault(node); | ||
mapTypeofTypeAnnotation(nodeUnprocessed) { | ||
nodeUnprocessed.argument = { | ||
type: 'GenericTypeAnnotation', | ||
id: nodeUnprocessed.argument, | ||
typeParameters: null, | ||
loc: nodeUnprocessed.argument.loc | ||
}; | ||
return this.mapNodeDefault(nodeUnprocessed); | ||
} | ||
mapQualifiedTypeofIdentifier(nodeUnprocessed) { | ||
nodeUnprocessed.type = 'QualifiedTypeIdentifier'; | ||
return this.mapNodeDefault(nodeUnprocessed); | ||
} | ||
mapDeclareVariable(nodeUnprocessed) { | ||
delete nodeUnprocessed.kind; | ||
return this.mapNodeDefault(nodeUnprocessed); | ||
} | ||
mapDeclareEnum(nodeUnprocessed) { | ||
nodeUnprocessed.id.typeAnnotation = this.mapUnsupportedTypeAnnotation(nodeUnprocessed.body); | ||
delete nodeUnprocessed.body; | ||
nodeUnprocessed.type = 'DeclareVariable'; | ||
return this.mapDeclareVariable(nodeUnprocessed); | ||
} | ||
mapJSXElement(nodeUnprocessed) { | ||
delete nodeUnprocessed.openingElement.typeArguments; | ||
return this.mapNodeDefault(nodeUnprocessed); | ||
} | ||
} | ||
exports.default = HermesToBabelAdapter; |
{ | ||
"name": "hermes-parser", | ||
"version": "0.10.1", | ||
"version": "0.11.0", | ||
"description": "A JavaScript parser built from the Hermes engine", | ||
@@ -12,6 +12,7 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"hermes-estree": "0.10.1" | ||
"hermes-estree": "0.11.0" | ||
}, | ||
"devDependencies": { | ||
"@babel/parser": "7.7.4", | ||
"@babel/types": "7.7.4", | ||
"espree": "9.3.2" | ||
@@ -18,0 +19,0 @@ }, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
Found 1 instance in 1 package
934100
4661
3
+ Addedhermes-estree@0.11.0(transitive)
- Removedhermes-estree@0.10.1(transitive)
Updatedhermes-estree@0.11.0