@babel/types
Advanced tools
Comparing version 7.20.0 to 7.20.2
@@ -7,9 +7,6 @@ "use strict"; | ||
exports.default = assertNode; | ||
var _isNode = require("../validators/isNode"); | ||
function assertNode(node) { | ||
if (!(0, _isNode.default)(node)) { | ||
var _node$type; | ||
const type = (_node$type = node == null ? void 0 : node.type) != null ? _node$type : JSON.stringify(node); | ||
@@ -16,0 +13,0 @@ throw new TypeError(`Not a valid node of type "${type}"`); |
@@ -308,3 +308,2 @@ "use strict"; | ||
exports.assertYieldExpression = assertYieldExpression; | ||
var _is = require("../../validators/is"); | ||
@@ -317,1195 +316,896 @@ | ||
} | ||
function assertArrayExpression(node, opts) { | ||
assert("ArrayExpression", node, opts); | ||
} | ||
function assertAssignmentExpression(node, opts) { | ||
assert("AssignmentExpression", node, opts); | ||
} | ||
function assertBinaryExpression(node, opts) { | ||
assert("BinaryExpression", node, opts); | ||
} | ||
function assertInterpreterDirective(node, opts) { | ||
assert("InterpreterDirective", node, opts); | ||
} | ||
function assertDirective(node, opts) { | ||
assert("Directive", node, opts); | ||
} | ||
function assertDirectiveLiteral(node, opts) { | ||
assert("DirectiveLiteral", node, opts); | ||
} | ||
function assertBlockStatement(node, opts) { | ||
assert("BlockStatement", node, opts); | ||
} | ||
function assertBreakStatement(node, opts) { | ||
assert("BreakStatement", node, opts); | ||
} | ||
function assertCallExpression(node, opts) { | ||
assert("CallExpression", node, opts); | ||
} | ||
function assertCatchClause(node, opts) { | ||
assert("CatchClause", node, opts); | ||
} | ||
function assertConditionalExpression(node, opts) { | ||
assert("ConditionalExpression", node, opts); | ||
} | ||
function assertContinueStatement(node, opts) { | ||
assert("ContinueStatement", node, opts); | ||
} | ||
function assertDebuggerStatement(node, opts) { | ||
assert("DebuggerStatement", node, opts); | ||
} | ||
function assertDoWhileStatement(node, opts) { | ||
assert("DoWhileStatement", node, opts); | ||
} | ||
function assertEmptyStatement(node, opts) { | ||
assert("EmptyStatement", node, opts); | ||
} | ||
function assertExpressionStatement(node, opts) { | ||
assert("ExpressionStatement", node, opts); | ||
} | ||
function assertFile(node, opts) { | ||
assert("File", node, opts); | ||
} | ||
function assertForInStatement(node, opts) { | ||
assert("ForInStatement", node, opts); | ||
} | ||
function assertForStatement(node, opts) { | ||
assert("ForStatement", node, opts); | ||
} | ||
function assertFunctionDeclaration(node, opts) { | ||
assert("FunctionDeclaration", node, opts); | ||
} | ||
function assertFunctionExpression(node, opts) { | ||
assert("FunctionExpression", node, opts); | ||
} | ||
function assertIdentifier(node, opts) { | ||
assert("Identifier", node, opts); | ||
} | ||
function assertIfStatement(node, opts) { | ||
assert("IfStatement", node, opts); | ||
} | ||
function assertLabeledStatement(node, opts) { | ||
assert("LabeledStatement", node, opts); | ||
} | ||
function assertStringLiteral(node, opts) { | ||
assert("StringLiteral", node, opts); | ||
} | ||
function assertNumericLiteral(node, opts) { | ||
assert("NumericLiteral", node, opts); | ||
} | ||
function assertNullLiteral(node, opts) { | ||
assert("NullLiteral", node, opts); | ||
} | ||
function assertBooleanLiteral(node, opts) { | ||
assert("BooleanLiteral", node, opts); | ||
} | ||
function assertRegExpLiteral(node, opts) { | ||
assert("RegExpLiteral", node, opts); | ||
} | ||
function assertLogicalExpression(node, opts) { | ||
assert("LogicalExpression", node, opts); | ||
} | ||
function assertMemberExpression(node, opts) { | ||
assert("MemberExpression", node, opts); | ||
} | ||
function assertNewExpression(node, opts) { | ||
assert("NewExpression", node, opts); | ||
} | ||
function assertProgram(node, opts) { | ||
assert("Program", node, opts); | ||
} | ||
function assertObjectExpression(node, opts) { | ||
assert("ObjectExpression", node, opts); | ||
} | ||
function assertObjectMethod(node, opts) { | ||
assert("ObjectMethod", node, opts); | ||
} | ||
function assertObjectProperty(node, opts) { | ||
assert("ObjectProperty", node, opts); | ||
} | ||
function assertRestElement(node, opts) { | ||
assert("RestElement", node, opts); | ||
} | ||
function assertReturnStatement(node, opts) { | ||
assert("ReturnStatement", node, opts); | ||
} | ||
function assertSequenceExpression(node, opts) { | ||
assert("SequenceExpression", node, opts); | ||
} | ||
function assertParenthesizedExpression(node, opts) { | ||
assert("ParenthesizedExpression", node, opts); | ||
} | ||
function assertSwitchCase(node, opts) { | ||
assert("SwitchCase", node, opts); | ||
} | ||
function assertSwitchStatement(node, opts) { | ||
assert("SwitchStatement", node, opts); | ||
} | ||
function assertThisExpression(node, opts) { | ||
assert("ThisExpression", node, opts); | ||
} | ||
function assertThrowStatement(node, opts) { | ||
assert("ThrowStatement", node, opts); | ||
} | ||
function assertTryStatement(node, opts) { | ||
assert("TryStatement", node, opts); | ||
} | ||
function assertUnaryExpression(node, opts) { | ||
assert("UnaryExpression", node, opts); | ||
} | ||
function assertUpdateExpression(node, opts) { | ||
assert("UpdateExpression", node, opts); | ||
} | ||
function assertVariableDeclaration(node, opts) { | ||
assert("VariableDeclaration", node, opts); | ||
} | ||
function assertVariableDeclarator(node, opts) { | ||
assert("VariableDeclarator", node, opts); | ||
} | ||
function assertWhileStatement(node, opts) { | ||
assert("WhileStatement", node, opts); | ||
} | ||
function assertWithStatement(node, opts) { | ||
assert("WithStatement", node, opts); | ||
} | ||
function assertAssignmentPattern(node, opts) { | ||
assert("AssignmentPattern", node, opts); | ||
} | ||
function assertArrayPattern(node, opts) { | ||
assert("ArrayPattern", node, opts); | ||
} | ||
function assertArrowFunctionExpression(node, opts) { | ||
assert("ArrowFunctionExpression", node, opts); | ||
} | ||
function assertClassBody(node, opts) { | ||
assert("ClassBody", node, opts); | ||
} | ||
function assertClassExpression(node, opts) { | ||
assert("ClassExpression", node, opts); | ||
} | ||
function assertClassDeclaration(node, opts) { | ||
assert("ClassDeclaration", node, opts); | ||
} | ||
function assertExportAllDeclaration(node, opts) { | ||
assert("ExportAllDeclaration", node, opts); | ||
} | ||
function assertExportDefaultDeclaration(node, opts) { | ||
assert("ExportDefaultDeclaration", node, opts); | ||
} | ||
function assertExportNamedDeclaration(node, opts) { | ||
assert("ExportNamedDeclaration", node, opts); | ||
} | ||
function assertExportSpecifier(node, opts) { | ||
assert("ExportSpecifier", node, opts); | ||
} | ||
function assertForOfStatement(node, opts) { | ||
assert("ForOfStatement", node, opts); | ||
} | ||
function assertImportDeclaration(node, opts) { | ||
assert("ImportDeclaration", node, opts); | ||
} | ||
function assertImportDefaultSpecifier(node, opts) { | ||
assert("ImportDefaultSpecifier", node, opts); | ||
} | ||
function assertImportNamespaceSpecifier(node, opts) { | ||
assert("ImportNamespaceSpecifier", node, opts); | ||
} | ||
function assertImportSpecifier(node, opts) { | ||
assert("ImportSpecifier", node, opts); | ||
} | ||
function assertMetaProperty(node, opts) { | ||
assert("MetaProperty", node, opts); | ||
} | ||
function assertClassMethod(node, opts) { | ||
assert("ClassMethod", node, opts); | ||
} | ||
function assertObjectPattern(node, opts) { | ||
assert("ObjectPattern", node, opts); | ||
} | ||
function assertSpreadElement(node, opts) { | ||
assert("SpreadElement", node, opts); | ||
} | ||
function assertSuper(node, opts) { | ||
assert("Super", node, opts); | ||
} | ||
function assertTaggedTemplateExpression(node, opts) { | ||
assert("TaggedTemplateExpression", node, opts); | ||
} | ||
function assertTemplateElement(node, opts) { | ||
assert("TemplateElement", node, opts); | ||
} | ||
function assertTemplateLiteral(node, opts) { | ||
assert("TemplateLiteral", node, opts); | ||
} | ||
function assertYieldExpression(node, opts) { | ||
assert("YieldExpression", node, opts); | ||
} | ||
function assertAwaitExpression(node, opts) { | ||
assert("AwaitExpression", node, opts); | ||
} | ||
function assertImport(node, opts) { | ||
assert("Import", node, opts); | ||
} | ||
function assertBigIntLiteral(node, opts) { | ||
assert("BigIntLiteral", node, opts); | ||
} | ||
function assertExportNamespaceSpecifier(node, opts) { | ||
assert("ExportNamespaceSpecifier", node, opts); | ||
} | ||
function assertOptionalMemberExpression(node, opts) { | ||
assert("OptionalMemberExpression", node, opts); | ||
} | ||
function assertOptionalCallExpression(node, opts) { | ||
assert("OptionalCallExpression", node, opts); | ||
} | ||
function assertClassProperty(node, opts) { | ||
assert("ClassProperty", node, opts); | ||
} | ||
function assertClassAccessorProperty(node, opts) { | ||
assert("ClassAccessorProperty", node, opts); | ||
} | ||
function assertClassPrivateProperty(node, opts) { | ||
assert("ClassPrivateProperty", node, opts); | ||
} | ||
function assertClassPrivateMethod(node, opts) { | ||
assert("ClassPrivateMethod", node, opts); | ||
} | ||
function assertPrivateName(node, opts) { | ||
assert("PrivateName", node, opts); | ||
} | ||
function assertStaticBlock(node, opts) { | ||
assert("StaticBlock", node, opts); | ||
} | ||
function assertAnyTypeAnnotation(node, opts) { | ||
assert("AnyTypeAnnotation", node, opts); | ||
} | ||
function assertArrayTypeAnnotation(node, opts) { | ||
assert("ArrayTypeAnnotation", node, opts); | ||
} | ||
function assertBooleanTypeAnnotation(node, opts) { | ||
assert("BooleanTypeAnnotation", node, opts); | ||
} | ||
function assertBooleanLiteralTypeAnnotation(node, opts) { | ||
assert("BooleanLiteralTypeAnnotation", node, opts); | ||
} | ||
function assertNullLiteralTypeAnnotation(node, opts) { | ||
assert("NullLiteralTypeAnnotation", node, opts); | ||
} | ||
function assertClassImplements(node, opts) { | ||
assert("ClassImplements", node, opts); | ||
} | ||
function assertDeclareClass(node, opts) { | ||
assert("DeclareClass", node, opts); | ||
} | ||
function assertDeclareFunction(node, opts) { | ||
assert("DeclareFunction", node, opts); | ||
} | ||
function assertDeclareInterface(node, opts) { | ||
assert("DeclareInterface", node, opts); | ||
} | ||
function assertDeclareModule(node, opts) { | ||
assert("DeclareModule", node, opts); | ||
} | ||
function assertDeclareModuleExports(node, opts) { | ||
assert("DeclareModuleExports", node, opts); | ||
} | ||
function assertDeclareTypeAlias(node, opts) { | ||
assert("DeclareTypeAlias", node, opts); | ||
} | ||
function assertDeclareOpaqueType(node, opts) { | ||
assert("DeclareOpaqueType", node, opts); | ||
} | ||
function assertDeclareVariable(node, opts) { | ||
assert("DeclareVariable", node, opts); | ||
} | ||
function assertDeclareExportDeclaration(node, opts) { | ||
assert("DeclareExportDeclaration", node, opts); | ||
} | ||
function assertDeclareExportAllDeclaration(node, opts) { | ||
assert("DeclareExportAllDeclaration", node, opts); | ||
} | ||
function assertDeclaredPredicate(node, opts) { | ||
assert("DeclaredPredicate", node, opts); | ||
} | ||
function assertExistsTypeAnnotation(node, opts) { | ||
assert("ExistsTypeAnnotation", node, opts); | ||
} | ||
function assertFunctionTypeAnnotation(node, opts) { | ||
assert("FunctionTypeAnnotation", node, opts); | ||
} | ||
function assertFunctionTypeParam(node, opts) { | ||
assert("FunctionTypeParam", node, opts); | ||
} | ||
function assertGenericTypeAnnotation(node, opts) { | ||
assert("GenericTypeAnnotation", node, opts); | ||
} | ||
function assertInferredPredicate(node, opts) { | ||
assert("InferredPredicate", node, opts); | ||
} | ||
function assertInterfaceExtends(node, opts) { | ||
assert("InterfaceExtends", node, opts); | ||
} | ||
function assertInterfaceDeclaration(node, opts) { | ||
assert("InterfaceDeclaration", node, opts); | ||
} | ||
function assertInterfaceTypeAnnotation(node, opts) { | ||
assert("InterfaceTypeAnnotation", node, opts); | ||
} | ||
function assertIntersectionTypeAnnotation(node, opts) { | ||
assert("IntersectionTypeAnnotation", node, opts); | ||
} | ||
function assertMixedTypeAnnotation(node, opts) { | ||
assert("MixedTypeAnnotation", node, opts); | ||
} | ||
function assertEmptyTypeAnnotation(node, opts) { | ||
assert("EmptyTypeAnnotation", node, opts); | ||
} | ||
function assertNullableTypeAnnotation(node, opts) { | ||
assert("NullableTypeAnnotation", node, opts); | ||
} | ||
function assertNumberLiteralTypeAnnotation(node, opts) { | ||
assert("NumberLiteralTypeAnnotation", node, opts); | ||
} | ||
function assertNumberTypeAnnotation(node, opts) { | ||
assert("NumberTypeAnnotation", node, opts); | ||
} | ||
function assertObjectTypeAnnotation(node, opts) { | ||
assert("ObjectTypeAnnotation", node, opts); | ||
} | ||
function assertObjectTypeInternalSlot(node, opts) { | ||
assert("ObjectTypeInternalSlot", node, opts); | ||
} | ||
function assertObjectTypeCallProperty(node, opts) { | ||
assert("ObjectTypeCallProperty", node, opts); | ||
} | ||
function assertObjectTypeIndexer(node, opts) { | ||
assert("ObjectTypeIndexer", node, opts); | ||
} | ||
function assertObjectTypeProperty(node, opts) { | ||
assert("ObjectTypeProperty", node, opts); | ||
} | ||
function assertObjectTypeSpreadProperty(node, opts) { | ||
assert("ObjectTypeSpreadProperty", node, opts); | ||
} | ||
function assertOpaqueType(node, opts) { | ||
assert("OpaqueType", node, opts); | ||
} | ||
function assertQualifiedTypeIdentifier(node, opts) { | ||
assert("QualifiedTypeIdentifier", node, opts); | ||
} | ||
function assertStringLiteralTypeAnnotation(node, opts) { | ||
assert("StringLiteralTypeAnnotation", node, opts); | ||
} | ||
function assertStringTypeAnnotation(node, opts) { | ||
assert("StringTypeAnnotation", node, opts); | ||
} | ||
function assertSymbolTypeAnnotation(node, opts) { | ||
assert("SymbolTypeAnnotation", node, opts); | ||
} | ||
function assertThisTypeAnnotation(node, opts) { | ||
assert("ThisTypeAnnotation", node, opts); | ||
} | ||
function assertTupleTypeAnnotation(node, opts) { | ||
assert("TupleTypeAnnotation", node, opts); | ||
} | ||
function assertTypeofTypeAnnotation(node, opts) { | ||
assert("TypeofTypeAnnotation", node, opts); | ||
} | ||
function assertTypeAlias(node, opts) { | ||
assert("TypeAlias", node, opts); | ||
} | ||
function assertTypeAnnotation(node, opts) { | ||
assert("TypeAnnotation", node, opts); | ||
} | ||
function assertTypeCastExpression(node, opts) { | ||
assert("TypeCastExpression", node, opts); | ||
} | ||
function assertTypeParameter(node, opts) { | ||
assert("TypeParameter", node, opts); | ||
} | ||
function assertTypeParameterDeclaration(node, opts) { | ||
assert("TypeParameterDeclaration", node, opts); | ||
} | ||
function assertTypeParameterInstantiation(node, opts) { | ||
assert("TypeParameterInstantiation", node, opts); | ||
} | ||
function assertUnionTypeAnnotation(node, opts) { | ||
assert("UnionTypeAnnotation", node, opts); | ||
} | ||
function assertVariance(node, opts) { | ||
assert("Variance", node, opts); | ||
} | ||
function assertVoidTypeAnnotation(node, opts) { | ||
assert("VoidTypeAnnotation", node, opts); | ||
} | ||
function assertEnumDeclaration(node, opts) { | ||
assert("EnumDeclaration", node, opts); | ||
} | ||
function assertEnumBooleanBody(node, opts) { | ||
assert("EnumBooleanBody", node, opts); | ||
} | ||
function assertEnumNumberBody(node, opts) { | ||
assert("EnumNumberBody", node, opts); | ||
} | ||
function assertEnumStringBody(node, opts) { | ||
assert("EnumStringBody", node, opts); | ||
} | ||
function assertEnumSymbolBody(node, opts) { | ||
assert("EnumSymbolBody", node, opts); | ||
} | ||
function assertEnumBooleanMember(node, opts) { | ||
assert("EnumBooleanMember", node, opts); | ||
} | ||
function assertEnumNumberMember(node, opts) { | ||
assert("EnumNumberMember", node, opts); | ||
} | ||
function assertEnumStringMember(node, opts) { | ||
assert("EnumStringMember", node, opts); | ||
} | ||
function assertEnumDefaultedMember(node, opts) { | ||
assert("EnumDefaultedMember", node, opts); | ||
} | ||
function assertIndexedAccessType(node, opts) { | ||
assert("IndexedAccessType", node, opts); | ||
} | ||
function assertOptionalIndexedAccessType(node, opts) { | ||
assert("OptionalIndexedAccessType", node, opts); | ||
} | ||
function assertJSXAttribute(node, opts) { | ||
assert("JSXAttribute", node, opts); | ||
} | ||
function assertJSXClosingElement(node, opts) { | ||
assert("JSXClosingElement", node, opts); | ||
} | ||
function assertJSXElement(node, opts) { | ||
assert("JSXElement", node, opts); | ||
} | ||
function assertJSXEmptyExpression(node, opts) { | ||
assert("JSXEmptyExpression", node, opts); | ||
} | ||
function assertJSXExpressionContainer(node, opts) { | ||
assert("JSXExpressionContainer", node, opts); | ||
} | ||
function assertJSXSpreadChild(node, opts) { | ||
assert("JSXSpreadChild", node, opts); | ||
} | ||
function assertJSXIdentifier(node, opts) { | ||
assert("JSXIdentifier", node, opts); | ||
} | ||
function assertJSXMemberExpression(node, opts) { | ||
assert("JSXMemberExpression", node, opts); | ||
} | ||
function assertJSXNamespacedName(node, opts) { | ||
assert("JSXNamespacedName", node, opts); | ||
} | ||
function assertJSXOpeningElement(node, opts) { | ||
assert("JSXOpeningElement", node, opts); | ||
} | ||
function assertJSXSpreadAttribute(node, opts) { | ||
assert("JSXSpreadAttribute", node, opts); | ||
} | ||
function assertJSXText(node, opts) { | ||
assert("JSXText", node, opts); | ||
} | ||
function assertJSXFragment(node, opts) { | ||
assert("JSXFragment", node, opts); | ||
} | ||
function assertJSXOpeningFragment(node, opts) { | ||
assert("JSXOpeningFragment", node, opts); | ||
} | ||
function assertJSXClosingFragment(node, opts) { | ||
assert("JSXClosingFragment", node, opts); | ||
} | ||
function assertNoop(node, opts) { | ||
assert("Noop", node, opts); | ||
} | ||
function assertPlaceholder(node, opts) { | ||
assert("Placeholder", node, opts); | ||
} | ||
function assertV8IntrinsicIdentifier(node, opts) { | ||
assert("V8IntrinsicIdentifier", node, opts); | ||
} | ||
function assertArgumentPlaceholder(node, opts) { | ||
assert("ArgumentPlaceholder", node, opts); | ||
} | ||
function assertBindExpression(node, opts) { | ||
assert("BindExpression", node, opts); | ||
} | ||
function assertImportAttribute(node, opts) { | ||
assert("ImportAttribute", node, opts); | ||
} | ||
function assertDecorator(node, opts) { | ||
assert("Decorator", node, opts); | ||
} | ||
function assertDoExpression(node, opts) { | ||
assert("DoExpression", node, opts); | ||
} | ||
function assertExportDefaultSpecifier(node, opts) { | ||
assert("ExportDefaultSpecifier", node, opts); | ||
} | ||
function assertRecordExpression(node, opts) { | ||
assert("RecordExpression", node, opts); | ||
} | ||
function assertTupleExpression(node, opts) { | ||
assert("TupleExpression", node, opts); | ||
} | ||
function assertDecimalLiteral(node, opts) { | ||
assert("DecimalLiteral", node, opts); | ||
} | ||
function assertModuleExpression(node, opts) { | ||
assert("ModuleExpression", node, opts); | ||
} | ||
function assertTopicReference(node, opts) { | ||
assert("TopicReference", node, opts); | ||
} | ||
function assertPipelineTopicExpression(node, opts) { | ||
assert("PipelineTopicExpression", node, opts); | ||
} | ||
function assertPipelineBareFunction(node, opts) { | ||
assert("PipelineBareFunction", node, opts); | ||
} | ||
function assertPipelinePrimaryTopicReference(node, opts) { | ||
assert("PipelinePrimaryTopicReference", node, opts); | ||
} | ||
function assertTSParameterProperty(node, opts) { | ||
assert("TSParameterProperty", node, opts); | ||
} | ||
function assertTSDeclareFunction(node, opts) { | ||
assert("TSDeclareFunction", node, opts); | ||
} | ||
function assertTSDeclareMethod(node, opts) { | ||
assert("TSDeclareMethod", node, opts); | ||
} | ||
function assertTSQualifiedName(node, opts) { | ||
assert("TSQualifiedName", node, opts); | ||
} | ||
function assertTSCallSignatureDeclaration(node, opts) { | ||
assert("TSCallSignatureDeclaration", node, opts); | ||
} | ||
function assertTSConstructSignatureDeclaration(node, opts) { | ||
assert("TSConstructSignatureDeclaration", node, opts); | ||
} | ||
function assertTSPropertySignature(node, opts) { | ||
assert("TSPropertySignature", node, opts); | ||
} | ||
function assertTSMethodSignature(node, opts) { | ||
assert("TSMethodSignature", node, opts); | ||
} | ||
function assertTSIndexSignature(node, opts) { | ||
assert("TSIndexSignature", node, opts); | ||
} | ||
function assertTSAnyKeyword(node, opts) { | ||
assert("TSAnyKeyword", node, opts); | ||
} | ||
function assertTSBooleanKeyword(node, opts) { | ||
assert("TSBooleanKeyword", node, opts); | ||
} | ||
function assertTSBigIntKeyword(node, opts) { | ||
assert("TSBigIntKeyword", node, opts); | ||
} | ||
function assertTSIntrinsicKeyword(node, opts) { | ||
assert("TSIntrinsicKeyword", node, opts); | ||
} | ||
function assertTSNeverKeyword(node, opts) { | ||
assert("TSNeverKeyword", node, opts); | ||
} | ||
function assertTSNullKeyword(node, opts) { | ||
assert("TSNullKeyword", node, opts); | ||
} | ||
function assertTSNumberKeyword(node, opts) { | ||
assert("TSNumberKeyword", node, opts); | ||
} | ||
function assertTSObjectKeyword(node, opts) { | ||
assert("TSObjectKeyword", node, opts); | ||
} | ||
function assertTSStringKeyword(node, opts) { | ||
assert("TSStringKeyword", node, opts); | ||
} | ||
function assertTSSymbolKeyword(node, opts) { | ||
assert("TSSymbolKeyword", node, opts); | ||
} | ||
function assertTSUndefinedKeyword(node, opts) { | ||
assert("TSUndefinedKeyword", node, opts); | ||
} | ||
function assertTSUnknownKeyword(node, opts) { | ||
assert("TSUnknownKeyword", node, opts); | ||
} | ||
function assertTSVoidKeyword(node, opts) { | ||
assert("TSVoidKeyword", node, opts); | ||
} | ||
function assertTSThisType(node, opts) { | ||
assert("TSThisType", node, opts); | ||
} | ||
function assertTSFunctionType(node, opts) { | ||
assert("TSFunctionType", node, opts); | ||
} | ||
function assertTSConstructorType(node, opts) { | ||
assert("TSConstructorType", node, opts); | ||
} | ||
function assertTSTypeReference(node, opts) { | ||
assert("TSTypeReference", node, opts); | ||
} | ||
function assertTSTypePredicate(node, opts) { | ||
assert("TSTypePredicate", node, opts); | ||
} | ||
function assertTSTypeQuery(node, opts) { | ||
assert("TSTypeQuery", node, opts); | ||
} | ||
function assertTSTypeLiteral(node, opts) { | ||
assert("TSTypeLiteral", node, opts); | ||
} | ||
function assertTSArrayType(node, opts) { | ||
assert("TSArrayType", node, opts); | ||
} | ||
function assertTSTupleType(node, opts) { | ||
assert("TSTupleType", node, opts); | ||
} | ||
function assertTSOptionalType(node, opts) { | ||
assert("TSOptionalType", node, opts); | ||
} | ||
function assertTSRestType(node, opts) { | ||
assert("TSRestType", node, opts); | ||
} | ||
function assertTSNamedTupleMember(node, opts) { | ||
assert("TSNamedTupleMember", node, opts); | ||
} | ||
function assertTSUnionType(node, opts) { | ||
assert("TSUnionType", node, opts); | ||
} | ||
function assertTSIntersectionType(node, opts) { | ||
assert("TSIntersectionType", node, opts); | ||
} | ||
function assertTSConditionalType(node, opts) { | ||
assert("TSConditionalType", node, opts); | ||
} | ||
function assertTSInferType(node, opts) { | ||
assert("TSInferType", node, opts); | ||
} | ||
function assertTSParenthesizedType(node, opts) { | ||
assert("TSParenthesizedType", node, opts); | ||
} | ||
function assertTSTypeOperator(node, opts) { | ||
assert("TSTypeOperator", node, opts); | ||
} | ||
function assertTSIndexedAccessType(node, opts) { | ||
assert("TSIndexedAccessType", node, opts); | ||
} | ||
function assertTSMappedType(node, opts) { | ||
assert("TSMappedType", node, opts); | ||
} | ||
function assertTSLiteralType(node, opts) { | ||
assert("TSLiteralType", node, opts); | ||
} | ||
function assertTSExpressionWithTypeArguments(node, opts) { | ||
assert("TSExpressionWithTypeArguments", node, opts); | ||
} | ||
function assertTSInterfaceDeclaration(node, opts) { | ||
assert("TSInterfaceDeclaration", node, opts); | ||
} | ||
function assertTSInterfaceBody(node, opts) { | ||
assert("TSInterfaceBody", node, opts); | ||
} | ||
function assertTSTypeAliasDeclaration(node, opts) { | ||
assert("TSTypeAliasDeclaration", node, opts); | ||
} | ||
function assertTSInstantiationExpression(node, opts) { | ||
assert("TSInstantiationExpression", node, opts); | ||
} | ||
function assertTSAsExpression(node, opts) { | ||
assert("TSAsExpression", node, opts); | ||
} | ||
function assertTSSatisfiesExpression(node, opts) { | ||
assert("TSSatisfiesExpression", node, opts); | ||
} | ||
function assertTSTypeAssertion(node, opts) { | ||
assert("TSTypeAssertion", node, opts); | ||
} | ||
function assertTSEnumDeclaration(node, opts) { | ||
assert("TSEnumDeclaration", node, opts); | ||
} | ||
function assertTSEnumMember(node, opts) { | ||
assert("TSEnumMember", node, opts); | ||
} | ||
function assertTSModuleDeclaration(node, opts) { | ||
assert("TSModuleDeclaration", node, opts); | ||
} | ||
function assertTSModuleBlock(node, opts) { | ||
assert("TSModuleBlock", node, opts); | ||
} | ||
function assertTSImportType(node, opts) { | ||
assert("TSImportType", node, opts); | ||
} | ||
function assertTSImportEqualsDeclaration(node, opts) { | ||
assert("TSImportEqualsDeclaration", node, opts); | ||
} | ||
function assertTSExternalModuleReference(node, opts) { | ||
assert("TSExternalModuleReference", node, opts); | ||
} | ||
function assertTSNonNullExpression(node, opts) { | ||
assert("TSNonNullExpression", node, opts); | ||
} | ||
function assertTSExportAssignment(node, opts) { | ||
assert("TSExportAssignment", node, opts); | ||
} | ||
function assertTSNamespaceExportDeclaration(node, opts) { | ||
assert("TSNamespaceExportDeclaration", node, opts); | ||
} | ||
function assertTSTypeAnnotation(node, opts) { | ||
assert("TSTypeAnnotation", node, opts); | ||
} | ||
function assertTSTypeParameterInstantiation(node, opts) { | ||
assert("TSTypeParameterInstantiation", node, opts); | ||
} | ||
function assertTSTypeParameterDeclaration(node, opts) { | ||
assert("TSTypeParameterDeclaration", node, opts); | ||
} | ||
function assertTSTypeParameter(node, opts) { | ||
assert("TSTypeParameter", node, opts); | ||
} | ||
function assertStandardized(node, opts) { | ||
assert("Standardized", node, opts); | ||
} | ||
function assertExpression(node, opts) { | ||
assert("Expression", node, opts); | ||
} | ||
function assertBinary(node, opts) { | ||
assert("Binary", node, opts); | ||
} | ||
function assertScopable(node, opts) { | ||
assert("Scopable", node, opts); | ||
} | ||
function assertBlockParent(node, opts) { | ||
assert("BlockParent", node, opts); | ||
} | ||
function assertBlock(node, opts) { | ||
assert("Block", node, opts); | ||
} | ||
function assertStatement(node, opts) { | ||
assert("Statement", node, opts); | ||
} | ||
function assertTerminatorless(node, opts) { | ||
assert("Terminatorless", node, opts); | ||
} | ||
function assertCompletionStatement(node, opts) { | ||
assert("CompletionStatement", node, opts); | ||
} | ||
function assertConditional(node, opts) { | ||
assert("Conditional", node, opts); | ||
} | ||
function assertLoop(node, opts) { | ||
assert("Loop", node, opts); | ||
} | ||
function assertWhile(node, opts) { | ||
assert("While", node, opts); | ||
} | ||
function assertExpressionWrapper(node, opts) { | ||
assert("ExpressionWrapper", node, opts); | ||
} | ||
function assertFor(node, opts) { | ||
assert("For", node, opts); | ||
} | ||
function assertForXStatement(node, opts) { | ||
assert("ForXStatement", node, opts); | ||
} | ||
function assertFunction(node, opts) { | ||
assert("Function", node, opts); | ||
} | ||
function assertFunctionParent(node, opts) { | ||
assert("FunctionParent", node, opts); | ||
} | ||
function assertPureish(node, opts) { | ||
assert("Pureish", node, opts); | ||
} | ||
function assertDeclaration(node, opts) { | ||
assert("Declaration", node, opts); | ||
} | ||
function assertPatternLike(node, opts) { | ||
assert("PatternLike", node, opts); | ||
} | ||
function assertLVal(node, opts) { | ||
assert("LVal", node, opts); | ||
} | ||
function assertTSEntityName(node, opts) { | ||
assert("TSEntityName", node, opts); | ||
} | ||
function assertLiteral(node, opts) { | ||
assert("Literal", node, opts); | ||
} | ||
function assertImmutable(node, opts) { | ||
assert("Immutable", node, opts); | ||
} | ||
function assertUserWhitespacable(node, opts) { | ||
assert("UserWhitespacable", node, opts); | ||
} | ||
function assertMethod(node, opts) { | ||
assert("Method", node, opts); | ||
} | ||
function assertObjectMember(node, opts) { | ||
assert("ObjectMember", node, opts); | ||
} | ||
function assertProperty(node, opts) { | ||
assert("Property", node, opts); | ||
} | ||
function assertUnaryLike(node, opts) { | ||
assert("UnaryLike", node, opts); | ||
} | ||
function assertPattern(node, opts) { | ||
assert("Pattern", node, opts); | ||
} | ||
function assertClass(node, opts) { | ||
assert("Class", node, opts); | ||
} | ||
function assertModuleDeclaration(node, opts) { | ||
assert("ModuleDeclaration", node, opts); | ||
} | ||
function assertExportDeclaration(node, opts) { | ||
assert("ExportDeclaration", node, opts); | ||
} | ||
function assertModuleSpecifier(node, opts) { | ||
assert("ModuleSpecifier", node, opts); | ||
} | ||
function assertAccessor(node, opts) { | ||
assert("Accessor", node, opts); | ||
} | ||
function assertPrivate(node, opts) { | ||
assert("Private", node, opts); | ||
} | ||
function assertFlow(node, opts) { | ||
assert("Flow", node, opts); | ||
} | ||
function assertFlowType(node, opts) { | ||
assert("FlowType", node, opts); | ||
} | ||
function assertFlowBaseAnnotation(node, opts) { | ||
assert("FlowBaseAnnotation", node, opts); | ||
} | ||
function assertFlowDeclaration(node, opts) { | ||
assert("FlowDeclaration", node, opts); | ||
} | ||
function assertFlowPredicate(node, opts) { | ||
assert("FlowPredicate", node, opts); | ||
} | ||
function assertEnumBody(node, opts) { | ||
assert("EnumBody", node, opts); | ||
} | ||
function assertEnumMember(node, opts) { | ||
assert("EnumMember", node, opts); | ||
} | ||
function assertJSX(node, opts) { | ||
assert("JSX", node, opts); | ||
} | ||
function assertMiscellaneous(node, opts) { | ||
assert("Miscellaneous", node, opts); | ||
} | ||
function assertTypeScript(node, opts) { | ||
assert("TypeScript", node, opts); | ||
} | ||
function assertTSTypeElement(node, opts) { | ||
assert("TSTypeElement", node, opts); | ||
} | ||
function assertTSType(node, opts) { | ||
assert("TSType", node, opts); | ||
} | ||
function assertTSBaseType(node, opts) { | ||
assert("TSBaseType", node, opts); | ||
} | ||
function assertNumberLiteral(node, opts) { | ||
@@ -1515,3 +1215,2 @@ console.trace("The node type NumberLiteral has been renamed to NumericLiteral"); | ||
} | ||
function assertRegexLiteral(node, opts) { | ||
@@ -1521,3 +1220,2 @@ console.trace("The node type RegexLiteral has been renamed to RegExpLiteral"); | ||
} | ||
function assertRestProperty(node, opts) { | ||
@@ -1527,3 +1225,2 @@ console.trace("The node type RestProperty has been renamed to RestElement"); | ||
} | ||
function assertSpreadProperty(node, opts) { | ||
@@ -1530,0 +1227,0 @@ console.trace("The node type SpreadProperty has been renamed to SpreadElement"); |
@@ -7,10 +7,6 @@ "use strict"; | ||
exports.default = createFlowUnionType; | ||
var _generated = require("../generated"); | ||
var _removeTypeDuplicates = require("../../modifications/flow/removeTypeDuplicates"); | ||
function createFlowUnionType(types) { | ||
const flattened = (0, _removeTypeDuplicates.default)(types); | ||
if (flattened.length === 1) { | ||
@@ -17,0 +13,0 @@ return flattened[0]; |
@@ -7,8 +7,5 @@ "use strict"; | ||
exports.default = void 0; | ||
var _generated = require("../generated"); | ||
var _default = createTypeAnnotationBasedOnTypeof; | ||
exports.default = _default; | ||
function createTypeAnnotationBasedOnTypeof(type) { | ||
@@ -18,25 +15,17 @@ switch (type) { | ||
return (0, _generated.stringTypeAnnotation)(); | ||
case "number": | ||
return (0, _generated.numberTypeAnnotation)(); | ||
case "undefined": | ||
return (0, _generated.voidTypeAnnotation)(); | ||
case "boolean": | ||
return (0, _generated.booleanTypeAnnotation)(); | ||
case "function": | ||
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Function")); | ||
case "object": | ||
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Object")); | ||
case "symbol": | ||
return (0, _generated.genericTypeAnnotation)((0, _generated.identifier)("Symbol")); | ||
case "bigint": | ||
return (0, _generated.anyTypeAnnotation)(); | ||
} | ||
throw new Error("Invalid typeof value: " + type); | ||
@@ -43,0 +32,0 @@ } |
@@ -259,3 +259,2 @@ "use strict"; | ||
exports.yieldExpression = yieldExpression; | ||
var _validateNode = require("../validateNode"); | ||
@@ -269,3 +268,2 @@ | ||
} | ||
function assignmentExpression(operator, left, right) { | ||
@@ -279,3 +277,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function binaryExpression(operator, left, right) { | ||
@@ -289,3 +286,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function interpreterDirective(value) { | ||
@@ -297,3 +293,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function directive(value) { | ||
@@ -305,3 +300,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function directiveLiteral(value) { | ||
@@ -313,3 +307,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function blockStatement(body, directives = []) { | ||
@@ -322,3 +315,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function breakStatement(label = null) { | ||
@@ -330,3 +322,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function callExpression(callee, _arguments) { | ||
@@ -339,3 +330,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function catchClause(param = null, body) { | ||
@@ -348,3 +338,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function conditionalExpression(test, consequent, alternate) { | ||
@@ -358,3 +347,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function continueStatement(label = null) { | ||
@@ -366,3 +354,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function debuggerStatement() { | ||
@@ -373,3 +360,2 @@ return { | ||
} | ||
function doWhileStatement(test, body) { | ||
@@ -382,3 +368,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function emptyStatement() { | ||
@@ -389,3 +374,2 @@ return { | ||
} | ||
function expressionStatement(expression) { | ||
@@ -397,3 +381,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function file(program, comments = null, tokens = null) { | ||
@@ -407,3 +390,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function forInStatement(left, right, body) { | ||
@@ -417,3 +399,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function forStatement(init = null, test = null, update = null, body) { | ||
@@ -428,3 +409,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function functionDeclaration(id = null, params, body, generator = false, async = false) { | ||
@@ -440,3 +420,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function functionExpression(id = null, params, body, generator = false, async = false) { | ||
@@ -452,3 +431,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function identifier(name) { | ||
@@ -460,3 +438,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function ifStatement(test, consequent, alternate = null) { | ||
@@ -470,3 +447,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function labeledStatement(label, body) { | ||
@@ -479,3 +455,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function stringLiteral(value) { | ||
@@ -487,3 +462,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function numericLiteral(value) { | ||
@@ -495,3 +469,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function nullLiteral() { | ||
@@ -502,3 +475,2 @@ return { | ||
} | ||
function booleanLiteral(value) { | ||
@@ -510,3 +482,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function regExpLiteral(pattern, flags = "") { | ||
@@ -519,3 +490,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function logicalExpression(operator, left, right) { | ||
@@ -529,3 +499,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function memberExpression(object, property, computed = false, optional = null) { | ||
@@ -540,3 +509,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function newExpression(callee, _arguments) { | ||
@@ -549,3 +517,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function program(body, directives = [], sourceType = "script", interpreter = null) { | ||
@@ -561,3 +528,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function objectExpression(properties) { | ||
@@ -569,3 +535,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function objectMethod(kind = "method", key, params, body, computed = false, generator = false, async = false) { | ||
@@ -583,3 +548,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function objectProperty(key, value, computed = false, shorthand = false, decorators = null) { | ||
@@ -595,3 +559,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function restElement(argument) { | ||
@@ -603,3 +566,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function returnStatement(argument = null) { | ||
@@ -611,3 +573,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function sequenceExpression(expressions) { | ||
@@ -619,3 +580,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function parenthesizedExpression(expression) { | ||
@@ -627,3 +587,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function switchCase(test = null, consequent) { | ||
@@ -636,3 +595,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function switchStatement(discriminant, cases) { | ||
@@ -645,3 +603,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function thisExpression() { | ||
@@ -652,3 +609,2 @@ return { | ||
} | ||
function throwStatement(argument) { | ||
@@ -660,3 +616,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tryStatement(block, handler = null, finalizer = null) { | ||
@@ -670,3 +625,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function unaryExpression(operator, argument, prefix = true) { | ||
@@ -680,3 +634,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function updateExpression(operator, argument, prefix = false) { | ||
@@ -690,3 +643,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function variableDeclaration(kind, declarations) { | ||
@@ -699,3 +651,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function variableDeclarator(id, init = null) { | ||
@@ -708,3 +659,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function whileStatement(test, body) { | ||
@@ -717,3 +667,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function withStatement(object, body) { | ||
@@ -726,3 +675,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function assignmentPattern(left, right) { | ||
@@ -735,3 +683,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function arrayPattern(elements) { | ||
@@ -743,3 +690,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function arrowFunctionExpression(params, body, async = false) { | ||
@@ -754,3 +700,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function classBody(body) { | ||
@@ -762,3 +707,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function classExpression(id = null, superClass = null, body, decorators = null) { | ||
@@ -773,3 +717,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function classDeclaration(id, superClass = null, body, decorators = null) { | ||
@@ -784,3 +727,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function exportAllDeclaration(source) { | ||
@@ -792,3 +734,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function exportDefaultDeclaration(declaration) { | ||
@@ -800,3 +741,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function exportNamedDeclaration(declaration = null, specifiers = [], source = null) { | ||
@@ -810,3 +750,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function exportSpecifier(local, exported) { | ||
@@ -819,3 +758,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function forOfStatement(left, right, body, _await = false) { | ||
@@ -830,3 +768,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function importDeclaration(specifiers, source) { | ||
@@ -839,3 +776,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function importDefaultSpecifier(local) { | ||
@@ -847,3 +783,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function importNamespaceSpecifier(local) { | ||
@@ -855,3 +790,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function importSpecifier(local, imported) { | ||
@@ -864,3 +798,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function metaProperty(meta, property) { | ||
@@ -873,3 +806,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function classMethod(kind = "method", key, params, body, computed = false, _static = false, generator = false, async = false) { | ||
@@ -888,3 +820,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function objectPattern(properties) { | ||
@@ -896,3 +827,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function spreadElement(argument) { | ||
@@ -904,3 +834,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function _super() { | ||
@@ -911,3 +840,2 @@ return { | ||
} | ||
function taggedTemplateExpression(tag, quasi) { | ||
@@ -920,3 +848,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function templateElement(value, tail = false) { | ||
@@ -929,3 +856,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function templateLiteral(quasis, expressions) { | ||
@@ -938,3 +864,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function yieldExpression(argument = null, delegate = false) { | ||
@@ -947,3 +872,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function awaitExpression(argument) { | ||
@@ -955,3 +879,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function _import() { | ||
@@ -962,3 +885,2 @@ return { | ||
} | ||
function bigIntLiteral(value) { | ||
@@ -970,3 +892,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function exportNamespaceSpecifier(exported) { | ||
@@ -978,3 +899,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function optionalMemberExpression(object, property, computed = false, optional) { | ||
@@ -989,3 +909,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function optionalCallExpression(callee, _arguments, optional) { | ||
@@ -999,3 +918,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function classProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) { | ||
@@ -1012,3 +930,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function classAccessorProperty(key, value = null, typeAnnotation = null, decorators = null, computed = false, _static = false) { | ||
@@ -1025,3 +942,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function classPrivateProperty(key, value = null, decorators = null, _static = false) { | ||
@@ -1036,3 +952,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function classPrivateMethod(kind = "method", key, params, body, _static = false) { | ||
@@ -1048,3 +963,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function privateName(id) { | ||
@@ -1056,3 +970,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function staticBlock(body) { | ||
@@ -1064,3 +977,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function anyTypeAnnotation() { | ||
@@ -1071,3 +983,2 @@ return { | ||
} | ||
function arrayTypeAnnotation(elementType) { | ||
@@ -1079,3 +990,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function booleanTypeAnnotation() { | ||
@@ -1086,3 +996,2 @@ return { | ||
} | ||
function booleanLiteralTypeAnnotation(value) { | ||
@@ -1094,3 +1003,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function nullLiteralTypeAnnotation() { | ||
@@ -1101,3 +1009,2 @@ return { | ||
} | ||
function classImplements(id, typeParameters = null) { | ||
@@ -1110,3 +1017,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declareClass(id, typeParameters = null, _extends = null, body) { | ||
@@ -1121,3 +1027,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declareFunction(id) { | ||
@@ -1129,3 +1034,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declareInterface(id, typeParameters = null, _extends = null, body) { | ||
@@ -1140,3 +1044,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declareModule(id, body, kind = null) { | ||
@@ -1150,3 +1053,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declareModuleExports(typeAnnotation) { | ||
@@ -1158,3 +1060,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declareTypeAlias(id, typeParameters = null, right) { | ||
@@ -1168,3 +1069,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declareOpaqueType(id, typeParameters = null, supertype = null) { | ||
@@ -1178,3 +1078,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declareVariable(id) { | ||
@@ -1186,3 +1085,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declareExportDeclaration(declaration = null, specifiers = null, source = null) { | ||
@@ -1196,3 +1094,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declareExportAllDeclaration(source) { | ||
@@ -1204,3 +1101,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function declaredPredicate(value) { | ||
@@ -1212,3 +1108,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function existsTypeAnnotation() { | ||
@@ -1219,3 +1114,2 @@ return { | ||
} | ||
function functionTypeAnnotation(typeParameters = null, params, rest = null, returnType) { | ||
@@ -1230,3 +1124,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function functionTypeParam(name = null, typeAnnotation) { | ||
@@ -1239,3 +1132,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function genericTypeAnnotation(id, typeParameters = null) { | ||
@@ -1248,3 +1140,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function inferredPredicate() { | ||
@@ -1255,3 +1146,2 @@ return { | ||
} | ||
function interfaceExtends(id, typeParameters = null) { | ||
@@ -1264,3 +1154,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function interfaceDeclaration(id, typeParameters = null, _extends = null, body) { | ||
@@ -1275,3 +1164,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function interfaceTypeAnnotation(_extends = null, body) { | ||
@@ -1284,3 +1172,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function intersectionTypeAnnotation(types) { | ||
@@ -1292,3 +1179,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function mixedTypeAnnotation() { | ||
@@ -1299,3 +1185,2 @@ return { | ||
} | ||
function emptyTypeAnnotation() { | ||
@@ -1306,3 +1191,2 @@ return { | ||
} | ||
function nullableTypeAnnotation(typeAnnotation) { | ||
@@ -1314,3 +1198,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function numberLiteralTypeAnnotation(value) { | ||
@@ -1322,3 +1205,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function numberTypeAnnotation() { | ||
@@ -1329,3 +1211,2 @@ return { | ||
} | ||
function objectTypeAnnotation(properties, indexers = [], callProperties = [], internalSlots = [], exact = false) { | ||
@@ -1341,3 +1222,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function objectTypeInternalSlot(id, value, optional, _static, method) { | ||
@@ -1353,3 +1233,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function objectTypeCallProperty(value) { | ||
@@ -1362,3 +1241,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function objectTypeIndexer(id = null, key, value, variance = null) { | ||
@@ -1374,3 +1252,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function objectTypeProperty(key, value, variance = null) { | ||
@@ -1389,3 +1266,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function objectTypeSpreadProperty(argument) { | ||
@@ -1397,3 +1273,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function opaqueType(id, typeParameters = null, supertype = null, impltype) { | ||
@@ -1408,3 +1283,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function qualifiedTypeIdentifier(id, qualification) { | ||
@@ -1417,3 +1291,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function stringLiteralTypeAnnotation(value) { | ||
@@ -1425,3 +1298,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function stringTypeAnnotation() { | ||
@@ -1432,3 +1304,2 @@ return { | ||
} | ||
function symbolTypeAnnotation() { | ||
@@ -1439,3 +1310,2 @@ return { | ||
} | ||
function thisTypeAnnotation() { | ||
@@ -1446,3 +1316,2 @@ return { | ||
} | ||
function tupleTypeAnnotation(types) { | ||
@@ -1454,3 +1323,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function typeofTypeAnnotation(argument) { | ||
@@ -1462,3 +1330,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function typeAlias(id, typeParameters = null, right) { | ||
@@ -1472,3 +1339,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function typeAnnotation(typeAnnotation) { | ||
@@ -1480,3 +1346,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function typeCastExpression(expression, typeAnnotation) { | ||
@@ -1489,3 +1354,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function typeParameter(bound = null, _default = null, variance = null) { | ||
@@ -1500,3 +1364,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function typeParameterDeclaration(params) { | ||
@@ -1508,3 +1371,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function typeParameterInstantiation(params) { | ||
@@ -1516,3 +1378,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function unionTypeAnnotation(types) { | ||
@@ -1524,3 +1385,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function variance(kind) { | ||
@@ -1532,3 +1392,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function voidTypeAnnotation() { | ||
@@ -1539,3 +1398,2 @@ return { | ||
} | ||
function enumDeclaration(id, body) { | ||
@@ -1548,3 +1406,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function enumBooleanBody(members) { | ||
@@ -1558,3 +1415,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function enumNumberBody(members) { | ||
@@ -1568,3 +1424,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function enumStringBody(members) { | ||
@@ -1578,3 +1433,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function enumSymbolBody(members) { | ||
@@ -1587,3 +1441,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function enumBooleanMember(id) { | ||
@@ -1596,3 +1449,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function enumNumberMember(id, init) { | ||
@@ -1605,3 +1457,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function enumStringMember(id, init) { | ||
@@ -1614,3 +1465,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function enumDefaultedMember(id) { | ||
@@ -1622,3 +1472,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function indexedAccessType(objectType, indexType) { | ||
@@ -1631,3 +1480,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function optionalIndexedAccessType(objectType, indexType) { | ||
@@ -1641,3 +1489,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxAttribute(name, value = null) { | ||
@@ -1650,3 +1497,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxClosingElement(name) { | ||
@@ -1658,3 +1504,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxElement(openingElement, closingElement = null, children, selfClosing = null) { | ||
@@ -1669,3 +1514,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxEmptyExpression() { | ||
@@ -1676,3 +1520,2 @@ return { | ||
} | ||
function jsxExpressionContainer(expression) { | ||
@@ -1684,3 +1527,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxSpreadChild(expression) { | ||
@@ -1692,3 +1534,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxIdentifier(name) { | ||
@@ -1700,3 +1541,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxMemberExpression(object, property) { | ||
@@ -1709,3 +1549,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxNamespacedName(namespace, name) { | ||
@@ -1718,3 +1557,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxOpeningElement(name, attributes, selfClosing = false) { | ||
@@ -1728,3 +1566,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxSpreadAttribute(argument) { | ||
@@ -1736,3 +1573,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxText(value) { | ||
@@ -1744,3 +1580,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxFragment(openingFragment, closingFragment, children) { | ||
@@ -1754,3 +1589,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function jsxOpeningFragment() { | ||
@@ -1761,3 +1595,2 @@ return { | ||
} | ||
function jsxClosingFragment() { | ||
@@ -1768,3 +1601,2 @@ return { | ||
} | ||
function noop() { | ||
@@ -1775,3 +1607,2 @@ return { | ||
} | ||
function placeholder(expectedNode, name) { | ||
@@ -1784,3 +1615,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function v8IntrinsicIdentifier(name) { | ||
@@ -1792,3 +1622,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function argumentPlaceholder() { | ||
@@ -1799,3 +1628,2 @@ return { | ||
} | ||
function bindExpression(object, callee) { | ||
@@ -1808,3 +1636,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function importAttribute(key, value) { | ||
@@ -1817,3 +1644,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function decorator(expression) { | ||
@@ -1825,3 +1651,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function doExpression(body, async = false) { | ||
@@ -1834,3 +1659,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function exportDefaultSpecifier(exported) { | ||
@@ -1842,3 +1666,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function recordExpression(properties) { | ||
@@ -1850,3 +1673,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tupleExpression(elements = []) { | ||
@@ -1858,3 +1680,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function decimalLiteral(value) { | ||
@@ -1866,3 +1687,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function moduleExpression(body) { | ||
@@ -1874,3 +1694,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function topicReference() { | ||
@@ -1881,3 +1700,2 @@ return { | ||
} | ||
function pipelineTopicExpression(expression) { | ||
@@ -1889,3 +1707,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function pipelineBareFunction(callee) { | ||
@@ -1897,3 +1714,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function pipelinePrimaryTopicReference() { | ||
@@ -1904,3 +1720,2 @@ return { | ||
} | ||
function tsParameterProperty(parameter) { | ||
@@ -1912,3 +1727,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsDeclareFunction(id = null, typeParameters = null, params, returnType = null) { | ||
@@ -1923,3 +1737,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsDeclareMethod(decorators = null, key, typeParameters = null, params, returnType = null) { | ||
@@ -1935,3 +1748,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsQualifiedName(left, right) { | ||
@@ -1944,3 +1756,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsCallSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) { | ||
@@ -1954,3 +1765,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsConstructSignatureDeclaration(typeParameters = null, parameters, typeAnnotation = null) { | ||
@@ -1964,3 +1774,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsPropertySignature(key, typeAnnotation = null, initializer = null) { | ||
@@ -1975,3 +1784,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsMethodSignature(key, typeParameters = null, parameters, typeAnnotation = null) { | ||
@@ -1987,3 +1795,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsIndexSignature(parameters, typeAnnotation = null) { | ||
@@ -1996,3 +1803,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsAnyKeyword() { | ||
@@ -2003,3 +1809,2 @@ return { | ||
} | ||
function tsBooleanKeyword() { | ||
@@ -2010,3 +1815,2 @@ return { | ||
} | ||
function tsBigIntKeyword() { | ||
@@ -2017,3 +1821,2 @@ return { | ||
} | ||
function tsIntrinsicKeyword() { | ||
@@ -2024,3 +1827,2 @@ return { | ||
} | ||
function tsNeverKeyword() { | ||
@@ -2031,3 +1833,2 @@ return { | ||
} | ||
function tsNullKeyword() { | ||
@@ -2038,3 +1839,2 @@ return { | ||
} | ||
function tsNumberKeyword() { | ||
@@ -2045,3 +1845,2 @@ return { | ||
} | ||
function tsObjectKeyword() { | ||
@@ -2052,3 +1851,2 @@ return { | ||
} | ||
function tsStringKeyword() { | ||
@@ -2059,3 +1857,2 @@ return { | ||
} | ||
function tsSymbolKeyword() { | ||
@@ -2066,3 +1863,2 @@ return { | ||
} | ||
function tsUndefinedKeyword() { | ||
@@ -2073,3 +1869,2 @@ return { | ||
} | ||
function tsUnknownKeyword() { | ||
@@ -2080,3 +1875,2 @@ return { | ||
} | ||
function tsVoidKeyword() { | ||
@@ -2087,3 +1881,2 @@ return { | ||
} | ||
function tsThisType() { | ||
@@ -2094,3 +1887,2 @@ return { | ||
} | ||
function tsFunctionType(typeParameters = null, parameters, typeAnnotation = null) { | ||
@@ -2104,3 +1896,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsConstructorType(typeParameters = null, parameters, typeAnnotation = null) { | ||
@@ -2114,3 +1905,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypeReference(typeName, typeParameters = null) { | ||
@@ -2123,3 +1913,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypePredicate(parameterName, typeAnnotation = null, asserts = null) { | ||
@@ -2133,3 +1922,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypeQuery(exprName, typeParameters = null) { | ||
@@ -2142,3 +1930,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypeLiteral(members) { | ||
@@ -2150,3 +1937,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsArrayType(elementType) { | ||
@@ -2158,3 +1944,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTupleType(elementTypes) { | ||
@@ -2166,3 +1951,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsOptionalType(typeAnnotation) { | ||
@@ -2174,3 +1958,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsRestType(typeAnnotation) { | ||
@@ -2182,3 +1965,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsNamedTupleMember(label, elementType, optional = false) { | ||
@@ -2192,3 +1974,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsUnionType(types) { | ||
@@ -2200,3 +1981,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsIntersectionType(types) { | ||
@@ -2208,3 +1988,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsConditionalType(checkType, extendsType, trueType, falseType) { | ||
@@ -2219,3 +1998,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsInferType(typeParameter) { | ||
@@ -2227,3 +2005,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsParenthesizedType(typeAnnotation) { | ||
@@ -2235,3 +2012,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypeOperator(typeAnnotation) { | ||
@@ -2244,3 +2020,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsIndexedAccessType(objectType, indexType) { | ||
@@ -2253,3 +2028,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsMappedType(typeParameter, typeAnnotation = null, nameType = null) { | ||
@@ -2263,3 +2037,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsLiteralType(literal) { | ||
@@ -2271,3 +2044,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsExpressionWithTypeArguments(expression, typeParameters = null) { | ||
@@ -2280,3 +2052,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsInterfaceDeclaration(id, typeParameters = null, _extends = null, body) { | ||
@@ -2291,3 +2062,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsInterfaceBody(body) { | ||
@@ -2299,3 +2069,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypeAliasDeclaration(id, typeParameters = null, typeAnnotation) { | ||
@@ -2309,3 +2078,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsInstantiationExpression(expression, typeParameters = null) { | ||
@@ -2318,3 +2086,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsAsExpression(expression, typeAnnotation) { | ||
@@ -2327,3 +2094,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsSatisfiesExpression(expression, typeAnnotation) { | ||
@@ -2336,3 +2102,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypeAssertion(typeAnnotation, expression) { | ||
@@ -2345,3 +2110,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsEnumDeclaration(id, members) { | ||
@@ -2354,3 +2118,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsEnumMember(id, initializer = null) { | ||
@@ -2363,3 +2126,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsModuleDeclaration(id, body) { | ||
@@ -2372,3 +2134,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsModuleBlock(body) { | ||
@@ -2380,3 +2141,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsImportType(argument, qualifier = null, typeParameters = null) { | ||
@@ -2390,3 +2150,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsImportEqualsDeclaration(id, moduleReference) { | ||
@@ -2400,3 +2159,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsExternalModuleReference(expression) { | ||
@@ -2408,3 +2166,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsNonNullExpression(expression) { | ||
@@ -2416,3 +2173,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsExportAssignment(expression) { | ||
@@ -2424,3 +2180,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsNamespaceExportDeclaration(id) { | ||
@@ -2432,3 +2187,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypeAnnotation(typeAnnotation) { | ||
@@ -2440,3 +2194,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypeParameterInstantiation(params) { | ||
@@ -2448,3 +2201,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypeParameterDeclaration(params) { | ||
@@ -2456,3 +2208,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function tsTypeParameter(constraint = null, _default = null, name) { | ||
@@ -2466,3 +2217,2 @@ return (0, _validateNode.default)({ | ||
} | ||
function NumberLiteral(value) { | ||
@@ -2472,3 +2222,2 @@ console.trace("The node type NumberLiteral has been renamed to NumericLiteral"); | ||
} | ||
function RegexLiteral(pattern, flags = "") { | ||
@@ -2478,3 +2227,2 @@ console.trace("The node type RegexLiteral has been renamed to RegExpLiteral"); | ||
} | ||
function RestProperty(argument) { | ||
@@ -2484,3 +2232,2 @@ console.trace("The node type RestProperty has been renamed to RestElement"); | ||
} | ||
function SpreadProperty(argument) { | ||
@@ -2487,0 +2234,0 @@ console.trace("The node type SpreadProperty has been renamed to SpreadElement"); |
@@ -1524,5 +1524,4 @@ "use strict"; | ||
}); | ||
var _index = require("./index"); | ||
//# sourceMappingURL=uppercase.js.map |
@@ -7,13 +7,8 @@ "use strict"; | ||
exports.default = buildChildren; | ||
var _generated = require("../../validators/generated"); | ||
var _cleanJSXElementLiteralChild = require("../../utils/react/cleanJSXElementLiteralChild"); | ||
function buildChildren(node) { | ||
const elements = []; | ||
for (let i = 0; i < node.children.length; i++) { | ||
let child = node.children[i]; | ||
if ((0, _generated.isJSXText)(child)) { | ||
@@ -23,3 +18,2 @@ (0, _cleanJSXElementLiteralChild.default)(child, elements); | ||
} | ||
if ((0, _generated.isJSXExpressionContainer)(child)) child = child.expression; | ||
@@ -29,3 +23,2 @@ if ((0, _generated.isJSXEmptyExpression)(child)) continue; | ||
} | ||
return elements; | ||
@@ -32,0 +25,0 @@ } |
@@ -7,9 +7,5 @@ "use strict"; | ||
exports.default = createTSUnionType; | ||
var _generated = require("../generated"); | ||
var _removeTypeDuplicates = require("../../modifications/typescript/removeTypeDuplicates"); | ||
var _index = require("../../validators/generated/index"); | ||
function createTSUnionType(typeAnnotations) { | ||
@@ -20,3 +16,2 @@ const types = typeAnnotations.map(type => { | ||
const flattened = (0, _removeTypeDuplicates.default)(types); | ||
if (flattened.length === 1) { | ||
@@ -23,0 +18,0 @@ return flattened[0]; |
@@ -7,14 +7,9 @@ "use strict"; | ||
exports.default = validateNode; | ||
var _validate = require("../validators/validate"); | ||
var _ = require(".."); | ||
function validateNode(node) { | ||
const keys = _.BUILDER_KEYS[node.type]; | ||
for (const key of keys) { | ||
(0, _validate.default)(node, key, node[key]); | ||
} | ||
return node; | ||
@@ -21,0 +16,0 @@ } |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = clone; | ||
var _cloneNode = require("./cloneNode"); | ||
function clone(node) { | ||
@@ -12,0 +10,0 @@ return (0, _cloneNode.default)(node, false); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = cloneDeep; | ||
var _cloneNode = require("./cloneNode"); | ||
function cloneDeep(node) { | ||
@@ -12,0 +10,0 @@ return (0, _cloneNode.default)(node); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = cloneDeepWithoutLoc; | ||
var _cloneNode = require("./cloneNode"); | ||
function cloneDeepWithoutLoc(node) { | ||
@@ -12,0 +10,0 @@ return (0, _cloneNode.default)(node, true, true); |
@@ -7,9 +7,5 @@ "use strict"; | ||
exports.default = cloneNode; | ||
var _definitions = require("../definitions"); | ||
var _generated = require("../validators/generated"); | ||
const has = Function.call.bind(Object.prototype.hasOwnProperty); | ||
function cloneIfNode(obj, deep, withoutLoc, commentsCache) { | ||
@@ -19,6 +15,4 @@ if (obj && typeof obj.type === "string") { | ||
} | ||
return obj; | ||
} | ||
function cloneIfNodeOrArray(obj, deep, withoutLoc, commentsCache) { | ||
@@ -28,3 +22,2 @@ if (Array.isArray(obj)) { | ||
} | ||
return cloneIfNode(obj, deep, withoutLoc, commentsCache); | ||
@@ -36,3 +29,2 @@ } | ||
} | ||
function cloneNodeInternal(node, deep = true, withoutLoc = false, commentsCache) { | ||
@@ -49,7 +41,5 @@ if (!node) return node; | ||
newNode.name = node.name; | ||
if (has(node, "optional") && typeof node.optional === "boolean") { | ||
newNode.optional = node.optional; | ||
} | ||
if (has(node, "typeAnnotation")) { | ||
@@ -64,5 +54,7 @@ newNode.typeAnnotation = deep ? cloneIfNodeOrArray(node.typeAnnotation, true, withoutLoc, commentsCache) : node.typeAnnotation; | ||
if (deep) { | ||
newNode[field] = (0, _generated.isFile)(node) && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc, commentsCache) : cloneIfNodeOrArray(node[field], true, withoutLoc, commentsCache); | ||
newNode[field] = (0, _generated.isFile)(node) && field === "comments" ? maybeCloneComments(node.comments, deep, withoutLoc, commentsCache) : cloneIfNodeOrArray( | ||
node[field], true, withoutLoc, commentsCache); | ||
} else { | ||
newNode[field] = node[field]; | ||
newNode[field] = | ||
node[field]; | ||
} | ||
@@ -72,3 +64,2 @@ } | ||
} | ||
if (has(node, "loc")) { | ||
@@ -81,22 +72,16 @@ if (withoutLoc) { | ||
} | ||
if (has(node, "leadingComments")) { | ||
newNode.leadingComments = maybeCloneComments(node.leadingComments, deep, withoutLoc, commentsCache); | ||
} | ||
if (has(node, "innerComments")) { | ||
newNode.innerComments = maybeCloneComments(node.innerComments, deep, withoutLoc, commentsCache); | ||
} | ||
if (has(node, "trailingComments")) { | ||
newNode.trailingComments = maybeCloneComments(node.trailingComments, deep, withoutLoc, commentsCache); | ||
} | ||
if (has(node, "extra")) { | ||
newNode.extra = Object.assign({}, node.extra); | ||
} | ||
return newNode; | ||
} | ||
function maybeCloneComments(comments, deep, withoutLoc, commentsCache) { | ||
@@ -106,3 +91,2 @@ if (!comments || !deep) { | ||
} | ||
return comments.map(comment => { | ||
@@ -121,7 +105,5 @@ const cache = commentsCache.get(comment); | ||
}; | ||
if (withoutLoc) { | ||
ret.loc = null; | ||
} | ||
commentsCache.set(comment, ret); | ||
@@ -128,0 +110,0 @@ return ret; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = cloneWithoutLoc; | ||
var _cloneNode = require("./cloneNode"); | ||
function cloneWithoutLoc(node) { | ||
@@ -12,0 +10,0 @@ return (0, _cloneNode.default)(node, false, true); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = addComment; | ||
var _addComments = require("./addComments"); | ||
function addComment(node, type, content, line) { | ||
@@ -12,0 +10,0 @@ return (0, _addComments.default)(node, type, [{ |
@@ -7,7 +7,5 @@ "use strict"; | ||
exports.default = addComments; | ||
function addComments(node, type, comments) { | ||
if (!comments || !node) return node; | ||
const key = `${type}Comments`; | ||
if (node[key]) { | ||
@@ -22,3 +20,2 @@ if (type === "leading") { | ||
} | ||
return node; | ||
@@ -25,0 +22,0 @@ } |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = inheritInnerComments; | ||
var _inherit = require("../utils/inherit"); | ||
function inheritInnerComments(child, parent) { | ||
@@ -12,0 +10,0 @@ (0, _inherit.default)("innerComments", child, parent); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = inheritLeadingComments; | ||
var _inherit = require("../utils/inherit"); | ||
function inheritLeadingComments(child, parent) { | ||
@@ -12,0 +10,0 @@ (0, _inherit.default)("leadingComments", child, parent); |
@@ -7,9 +7,5 @@ "use strict"; | ||
exports.default = inheritsComments; | ||
var _inheritTrailingComments = require("./inheritTrailingComments"); | ||
var _inheritLeadingComments = require("./inheritLeadingComments"); | ||
var _inheritInnerComments = require("./inheritInnerComments"); | ||
function inheritsComments(child, parent) { | ||
@@ -16,0 +12,0 @@ (0, _inheritTrailingComments.default)(child, parent); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = inheritTrailingComments; | ||
var _inherit = require("../utils/inherit"); | ||
function inheritTrailingComments(child, parent) { | ||
@@ -12,0 +10,0 @@ (0, _inherit.default)("trailingComments", child, parent); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = removeComments; | ||
var _constants = require("../constants"); | ||
function removeComments(node) { | ||
@@ -15,3 +13,2 @@ _constants.COMMENT_KEYS.forEach(key => { | ||
}); | ||
return node; | ||
@@ -18,0 +15,0 @@ } |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.WHILE_TYPES = exports.USERWHITESPACABLE_TYPES = exports.UNARYLIKE_TYPES = exports.TYPESCRIPT_TYPES = exports.TSTYPE_TYPES = exports.TSTYPEELEMENT_TYPES = exports.TSENTITYNAME_TYPES = exports.TSBASETYPE_TYPES = exports.TERMINATORLESS_TYPES = exports.STATEMENT_TYPES = exports.STANDARDIZED_TYPES = exports.SCOPABLE_TYPES = exports.PUREISH_TYPES = exports.PROPERTY_TYPES = exports.PRIVATE_TYPES = exports.PATTERN_TYPES = exports.PATTERNLIKE_TYPES = exports.OBJECTMEMBER_TYPES = exports.MODULESPECIFIER_TYPES = exports.MODULEDECLARATION_TYPES = exports.MISCELLANEOUS_TYPES = exports.METHOD_TYPES = exports.LVAL_TYPES = exports.LOOP_TYPES = exports.LITERAL_TYPES = exports.JSX_TYPES = exports.IMMUTABLE_TYPES = exports.FUNCTION_TYPES = exports.FUNCTIONPARENT_TYPES = exports.FOR_TYPES = exports.FORXSTATEMENT_TYPES = exports.FLOW_TYPES = exports.FLOWTYPE_TYPES = exports.FLOWPREDICATE_TYPES = exports.FLOWDECLARATION_TYPES = exports.FLOWBASEANNOTATION_TYPES = exports.EXPRESSION_TYPES = exports.EXPRESSIONWRAPPER_TYPES = exports.EXPORTDECLARATION_TYPES = exports.ENUMMEMBER_TYPES = exports.ENUMBODY_TYPES = exports.DECLARATION_TYPES = exports.CONDITIONAL_TYPES = exports.COMPLETIONSTATEMENT_TYPES = exports.CLASS_TYPES = exports.BLOCK_TYPES = exports.BLOCKPARENT_TYPES = exports.BINARY_TYPES = exports.ACCESSOR_TYPES = void 0; | ||
var _definitions = require("../../definitions"); | ||
@@ -10,0 +9,0 @@ |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = ensureBlock; | ||
var _toBlock = require("./toBlock"); | ||
function ensureBlock(node, key = "body") { | ||
@@ -12,0 +10,0 @@ const result = (0, _toBlock.default)(node[key], node); |
@@ -7,15 +7,9 @@ "use strict"; | ||
exports.default = gatherSequenceExpressions; | ||
var _getBindingIdentifiers = require("../retrievers/getBindingIdentifiers"); | ||
var _generated = require("../validators/generated"); | ||
var _generated2 = require("../builders/generated"); | ||
var _cloneNode = require("../clone/cloneNode"); | ||
function gatherSequenceExpressions(nodes, scope, declars) { | ||
const exprs = []; | ||
let ensureLastUndefined = true; | ||
for (const node of nodes) { | ||
@@ -25,3 +19,2 @@ if (!(0, _generated.isEmptyStatement)(node)) { | ||
} | ||
if ((0, _generated.isExpression)(node)) { | ||
@@ -36,3 +29,2 @@ exprs.push(node); | ||
const bindings = (0, _getBindingIdentifiers.default)(declar); | ||
for (const key of Object.keys(bindings)) { | ||
@@ -44,3 +36,2 @@ declars.push({ | ||
} | ||
if (declar.init) { | ||
@@ -50,3 +41,2 @@ exprs.push((0, _generated2.assignmentExpression)("=", declar.id, declar.init)); | ||
} | ||
ensureLastUndefined = true; | ||
@@ -57,2 +47,3 @@ } else if ((0, _generated.isIfStatement)(node)) { | ||
if (!consequent || !alternate) return; | ||
exprs.push((0, _generated2.conditionalExpression)(node.test, consequent, alternate)); | ||
@@ -62,2 +53,3 @@ } else if ((0, _generated.isBlockStatement)(node)) { | ||
if (!body) return; | ||
exprs.push(body); | ||
@@ -72,7 +64,5 @@ } else if ((0, _generated.isEmptyStatement)(node)) { | ||
} | ||
if (ensureLastUndefined) { | ||
exprs.push(scope.buildUndefinedNode()); | ||
} | ||
if (exprs.length === 1) { | ||
@@ -79,0 +69,0 @@ return exprs[0]; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = toBindingIdentifierName; | ||
var _toIdentifier = require("./toIdentifier"); | ||
function toBindingIdentifierName(name) { | ||
@@ -12,0 +10,0 @@ name = (0, _toIdentifier.default)(name); |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.default = toBlock; | ||
var _generated = require("../validators/generated"); | ||
var _generated2 = require("../builders/generated"); | ||
function toBlock(node, parent) { | ||
@@ -17,5 +14,3 @@ if ((0, _generated.isBlockStatement)(node)) { | ||
} | ||
let blockNodes = []; | ||
if ((0, _generated.isEmptyStatement)(node)) { | ||
@@ -31,6 +26,4 @@ blockNodes = []; | ||
} | ||
blockNodes = [node]; | ||
} | ||
return (0, _generated2.blockStatement)(blockNodes); | ||
@@ -37,0 +30,0 @@ } |
@@ -7,8 +7,6 @@ "use strict"; | ||
exports.default = toComputedKey; | ||
var _generated = require("../validators/generated"); | ||
var _generated2 = require("../builders/generated"); | ||
function toComputedKey(node, key = node.key || node.property) { | ||
function toComputedKey(node, | ||
key = node.key || node.property) { | ||
if (!node.computed && (0, _generated.isIdentifier)(key)) key = (0, _generated2.stringLiteral)(key.name); | ||
@@ -15,0 +13,0 @@ return key; |
@@ -7,8 +7,5 @@ "use strict"; | ||
exports.default = void 0; | ||
var _generated = require("../validators/generated"); | ||
var _default = toExpression; | ||
exports.default = _default; | ||
function toExpression(node) { | ||
@@ -32,3 +29,2 @@ if ((0, _generated.isExpressionStatement)(node)) { | ||
} | ||
return node; | ||
@@ -35,0 +31,0 @@ } |
@@ -7,11 +7,8 @@ "use strict"; | ||
exports.default = toIdentifier; | ||
var _isValidIdentifier = require("../validators/isValidIdentifier"); | ||
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier"); | ||
function toIdentifier(input) { | ||
input = input + ""; | ||
let name = ""; | ||
for (const c of input) { | ||
@@ -22,10 +19,9 @@ name += (0, _helperValidatorIdentifier.isIdentifierChar)(c.codePointAt(0)) ? c : "-"; | ||
name = name.replace(/^[-0-9]+/, ""); | ||
name = name.replace(/[-\s]+(.)?/g, function (match, c) { | ||
return c ? c.toUpperCase() : ""; | ||
}); | ||
if (!(0, _isValidIdentifier.default)(name)) { | ||
name = `_${name}`; | ||
} | ||
return name || "_"; | ||
@@ -32,0 +28,0 @@ } |
@@ -7,9 +7,5 @@ "use strict"; | ||
exports.default = toKeyAlias; | ||
var _generated = require("../validators/generated"); | ||
var _cloneNode = require("../clone/cloneNode"); | ||
var _removePropertiesDeep = require("../modifications/removePropertiesDeep"); | ||
function toKeyAlias(node, key = node.key) { | ||
@@ -35,8 +31,5 @@ let alias; | ||
} | ||
return alias; | ||
} | ||
toKeyAlias.uid = 0; | ||
toKeyAlias.increment = function () { | ||
@@ -43,0 +36,0 @@ if (toKeyAlias.uid >= Number.MAX_SAFE_INTEGER) { |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = toSequenceExpression; | ||
var _gatherSequenceExpressions = require("./gatherSequenceExpressions"); | ||
function toSequenceExpression(nodes, scope) { | ||
@@ -16,3 +14,2 @@ if (!(nodes != null && nodes.length)) return; | ||
if (!result) return; | ||
for (const declar of declars) { | ||
@@ -19,0 +16,0 @@ scope.push(declar); |
@@ -7,10 +7,6 @@ "use strict"; | ||
exports.default = void 0; | ||
var _generated = require("../validators/generated"); | ||
var _generated2 = require("../builders/generated"); | ||
var _default = toStatement; | ||
exports.default = _default; | ||
function toStatement(node, ignore) { | ||
@@ -20,6 +16,4 @@ if ((0, _generated.isStatement)(node)) { | ||
} | ||
let mustHaveId = false; | ||
let newType; | ||
if ((0, _generated.isClass)(node)) { | ||
@@ -38,3 +32,2 @@ mustHaveId = true; | ||
} | ||
if (!newType) { | ||
@@ -49,2 +42,3 @@ if (ignore) { | ||
node.type = newType; | ||
return node; | ||
@@ -51,0 +45,0 @@ } |
@@ -7,15 +7,10 @@ "use strict"; | ||
exports.default = void 0; | ||
var _isValidIdentifier = require("../validators/isValidIdentifier"); | ||
var _generated = require("../builders/generated"); | ||
var _default = valueToNode; | ||
exports.default = _default; | ||
const objectToString = Function.call.bind(Object.prototype.toString); | ||
function isRegExp(value) { | ||
return objectToString(value) === "[object RegExp]"; | ||
} | ||
function isPlainObject(value) { | ||
@@ -25,7 +20,5 @@ if (typeof value !== "object" || value === null || Object.prototype.toString.call(value) !== "[object Object]") { | ||
} | ||
const proto = Object.getPrototypeOf(value); | ||
return proto === null || Object.getPrototypeOf(proto) === null; | ||
} | ||
function valueToNode(value) { | ||
@@ -50,3 +43,2 @@ if (value === undefined) { | ||
let result; | ||
if (Number.isFinite(value)) { | ||
@@ -56,3 +48,2 @@ result = (0, _generated.numericLiteral)(Math.abs(value)); | ||
let numerator; | ||
if (Number.isNaN(value)) { | ||
@@ -63,10 +54,7 @@ numerator = (0, _generated.numericLiteral)(0); | ||
} | ||
result = (0, _generated.binaryExpression)("/", numerator, (0, _generated.numericLiteral)(0)); | ||
} | ||
if (value < 0 || Object.is(value, -0)) { | ||
result = (0, _generated.unaryExpression)("-", result); | ||
} | ||
return result; | ||
@@ -87,6 +75,4 @@ } | ||
const props = []; | ||
for (const key of Object.keys(value)) { | ||
let nodeKey; | ||
if ((0, _isValidIdentifier.default)(key)) { | ||
@@ -97,9 +83,7 @@ nodeKey = (0, _generated.identifier)(key); | ||
} | ||
props.push((0, _generated.objectProperty)(nodeKey, valueToNode(value[key]))); | ||
props.push((0, _generated.objectProperty)(nodeKey, valueToNode( | ||
value[key]))); | ||
} | ||
return (0, _generated.objectExpression)(props); | ||
} | ||
throw new Error("don't know how to turn this value into a node"); | ||
@@ -106,0 +90,0 @@ } |
@@ -7,15 +7,8 @@ "use strict"; | ||
exports.patternLikeCommon = exports.functionTypeAnnotationCommon = exports.functionDeclarationCommon = exports.functionCommon = exports.classMethodOrPropertyCommon = exports.classMethodOrDeclareMethodCommon = void 0; | ||
var _is = require("../validators/is"); | ||
var _isValidIdentifier = require("../validators/isValidIdentifier"); | ||
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier"); | ||
var _helperStringParser = require("@babel/helper-string-parser"); | ||
var _constants = require("../constants"); | ||
var _utils = require("./utils"); | ||
const defineType = (0, _utils.defineAliasedType)("Standardized"); | ||
@@ -39,3 +32,2 @@ defineType("ArrayExpression", { | ||
} | ||
const identifier = (0, _utils.assertOneOf)(..._constants.ASSIGNMENT_OPERATORS); | ||
@@ -73,3 +65,4 @@ const pattern = (0, _utils.assertOneOf)("="); | ||
validator(node, key, val); | ||
}, { | ||
}, | ||
{ | ||
oneOfNodeTypes: ["Expression", "PrivateName"] | ||
@@ -286,3 +279,2 @@ }); | ||
}); | ||
const functionCommon = () => ({ | ||
@@ -299,18 +291,16 @@ params: { | ||
}); | ||
exports.functionCommon = functionCommon; | ||
const functionTypeAnnotationCommon = () => ({ | ||
returnType: { | ||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), | ||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", | ||
"Noop"), | ||
optional: true | ||
}, | ||
typeParameters: { | ||
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), | ||
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", | ||
"Noop"), | ||
optional: true | ||
} | ||
}); | ||
exports.functionTypeAnnotationCommon = functionTypeAnnotationCommon; | ||
const functionDeclarationCommon = () => Object.assign({}, functionCommon(), { | ||
@@ -326,3 +316,2 @@ declare: { | ||
}); | ||
exports.functionDeclarationCommon = functionDeclarationCommon; | ||
@@ -369,6 +358,6 @@ defineType("FunctionDeclaration", { | ||
}); | ||
const patternLikeCommon = () => ({ | ||
typeAnnotation: { | ||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), | ||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", | ||
"Noop"), | ||
optional: true | ||
@@ -381,3 +370,2 @@ }, | ||
}); | ||
exports.patternLikeCommon = patternLikeCommon; | ||
@@ -392,3 +380,2 @@ defineType("Identifier", { | ||
if (!process.env.BABEL_TYPES_8_BREAKING) return; | ||
if (!(0, _isValidIdentifier.default)(val, false)) { | ||
@@ -406,3 +393,2 @@ throw new TypeError(`"${val}" is not a valid identifier name`); | ||
}), | ||
validate(parent, key, node) { | ||
@@ -434,8 +420,8 @@ if (!process.env.BABEL_TYPES_8_BREAKING) return; | ||
} | ||
if (((0, _helperValidatorIdentifier.isKeyword)(node.name) || (0, _helperValidatorIdentifier.isReservedWord)(node.name, false)) && node.name !== "this") { | ||
if ( | ||
((0, _helperValidatorIdentifier.isKeyword)(node.name) || (0, _helperValidatorIdentifier.isReservedWord)(node.name, false)) && | ||
node.name !== "this") { | ||
throw new TypeError(`"${node.name}" is not a valid identifier`); | ||
} | ||
} | ||
}); | ||
@@ -513,3 +499,2 @@ defineType("IfStatement", { | ||
const invalid = /[^gimsuy]/.exec(val); | ||
if (invalid) { | ||
@@ -553,3 +538,2 @@ throw new TypeError(`"${invalid[0]}" is not a valid RegExp flag`); | ||
const computed = (0, _utils.assertNodeType)("Expression"); | ||
const validator = function (node, key, val) { | ||
@@ -559,3 +543,2 @@ const validator = node.computed ? computed : normal; | ||
}; | ||
validator.oneOfNodeTypes = ["Expression", "Identifier", "PrivateName"]; | ||
@@ -628,3 +611,2 @@ return validator; | ||
const computed = (0, _utils.assertNodeType)("Expression"); | ||
const validator = function (node, key, val) { | ||
@@ -634,3 +616,2 @@ const validator = node.computed ? computed : normal; | ||
}; | ||
validator.oneOfNodeTypes = ["Expression", "Identifier", "StringLiteral", "NumericLiteral", "BigIntLiteral"]; | ||
@@ -676,3 +657,2 @@ return validator; | ||
if (!process.env.BABEL_TYPES_8_BREAKING) return; | ||
if (val && node.computed) { | ||
@@ -685,3 +665,2 @@ throw new TypeError("Property shorthand of ObjectProperty cannot be true if computed is true"); | ||
if (!process.env.BABEL_TYPES_8_BREAKING) return; | ||
if (val && !(0, _is.default)("Identifier", node.key)) { | ||
@@ -724,3 +703,2 @@ throw new TypeError("Property shorthand of ObjectProperty cannot be true if key is not an Identifier"); | ||
}), | ||
validate(parent, key) { | ||
@@ -731,3 +709,2 @@ if (!process.env.BABEL_TYPES_8_BREAKING) return; | ||
const [, listKey, index] = match; | ||
if (parent[listKey].length > +index + 1) { | ||
@@ -737,3 +714,2 @@ throw new TypeError(`RestElement must be last element of ${listKey}`); | ||
} | ||
}); | ||
@@ -871,3 +847,4 @@ defineType("ReturnStatement", { | ||
kind: { | ||
validate: (0, _utils.assertOneOf)("var", "let", "const", "using") | ||
validate: (0, _utils.assertOneOf)("var", "let", "const", | ||
"using") | ||
}, | ||
@@ -878,3 +855,2 @@ declarations: { | ||
}, | ||
validate(parent, key, node) { | ||
@@ -885,3 +861,2 @@ if (!process.env.BABEL_TYPES_8_BREAKING) return; | ||
})) return; | ||
if (node.declarations.length !== 1) { | ||
@@ -891,3 +866,2 @@ throw new TypeError(`Exactly one VariableDeclarator is required in the VariableDeclaration of a ${parent.type}`); | ||
} | ||
}); | ||
@@ -902,3 +876,2 @@ defineType("VariableDeclarator", { | ||
} | ||
const normal = (0, _utils.assertNodeType)("Identifier", "ArrayPattern", "ObjectPattern"); | ||
@@ -946,2 +919,3 @@ const without = (0, _utils.assertNodeType)("Identifier"); | ||
}); | ||
defineType("AssignmentPattern", { | ||
@@ -1017,3 +991,4 @@ visitor: ["left", "right", "decorators"], | ||
typeParameters: { | ||
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), | ||
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", | ||
"Noop"), | ||
optional: true | ||
@@ -1054,3 +1029,4 @@ }, | ||
typeParameters: { | ||
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", "Noop"), | ||
validate: (0, _utils.assertNodeType)("TypeParameterDeclaration", "TSTypeParameterDeclaration", | ||
"Noop"), | ||
optional: true | ||
@@ -1094,3 +1070,2 @@ }, | ||
if (!process.env.BABEL_TYPES_8_BREAKING) return; | ||
if (!(0, _is.default)("ExportDefaultDeclaration", parent)) { | ||
@@ -1197,3 +1172,2 @@ identifier(node, "id", node.id); | ||
} | ||
const declaration = (0, _utils.assertNodeType)("VariableDeclaration"); | ||
@@ -1287,3 +1261,2 @@ const lval = (0, _utils.assertNodeType)("Identifier", "MemberExpression", "ArrayPattern", "ObjectPattern", "TSAsExpression", "TSSatisfiesExpression", "TSTypeAssertion", "TSNonNullExpression"); | ||
let property; | ||
switch (val.name) { | ||
@@ -1293,7 +1266,5 @@ case "function": | ||
break; | ||
case "new": | ||
property = "target"; | ||
break; | ||
case "import": | ||
@@ -1303,3 +1274,2 @@ property = "meta"; | ||
} | ||
if (!(0, _is.default)("Identifier", node.property, { | ||
@@ -1319,3 +1289,2 @@ name: property | ||
}); | ||
const classMethodOrPropertyCommon = () => ({ | ||
@@ -1354,5 +1323,3 @@ abstract: { | ||
}); | ||
exports.classMethodOrPropertyCommon = classMethodOrPropertyCommon; | ||
const classMethodOrDeclareMethodCommon = () => Object.assign({}, functionCommon(), classMethodOrPropertyCommon(), { | ||
@@ -1375,3 +1342,2 @@ params: { | ||
}); | ||
exports.classMethodOrDeclareMethodCommon = classMethodOrDeclareMethodCommon; | ||
@@ -1390,2 +1356,3 @@ defineType("ClassMethod", { | ||
visitor: ["properties", "typeAnnotation", "decorators"], | ||
builder: ["properties"], | ||
@@ -1444,7 +1411,5 @@ aliases: ["Pattern", "PatternLike", "LVal"], | ||
let unterminatedCalled = false; | ||
const error = () => { | ||
throw new Error("Internal @babel/types error."); | ||
}; | ||
const { | ||
@@ -1457,3 +1422,2 @@ str, | ||
}, | ||
strictNumericEscape: error, | ||
@@ -1483,3 +1447,4 @@ invalidEscapeSequence: error, | ||
expressions: { | ||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", "TSType")), function (node, key, val) { | ||
validate: (0, _utils.chain)((0, _utils.assertValueType)("array"), (0, _utils.assertEach)((0, _utils.assertNodeType)("Expression", | ||
"TSType")), function (node, key, val) { | ||
if (node.quasis.length !== val.length + 1) { | ||
@@ -1500,3 +1465,2 @@ throw new TypeError(`Number of ${node.type} quasis should be exactly one more than the number of expressions.\nExpected ${val.length + 1} quasis but got ${node.quasis.length}`); | ||
if (!process.env.BABEL_TYPES_8_BREAKING) return; | ||
if (val && !node.argument) { | ||
@@ -1516,2 +1480,3 @@ throw new TypeError("Property delegate of YieldExpression cannot be true if there is no argument"); | ||
}); | ||
defineType("AwaitExpression", { | ||
@@ -1527,5 +1492,7 @@ builder: ["argument"], | ||
}); | ||
defineType("Import", { | ||
aliases: ["Expression"] | ||
}); | ||
defineType("BigIntLiteral", { | ||
@@ -1564,3 +1531,4 @@ builder: ["value"], | ||
validator(node, key, val); | ||
}, { | ||
}, | ||
{ | ||
oneOfNodeTypes: ["Expression", "Identifier"] | ||
@@ -1603,2 +1571,3 @@ }); | ||
}); | ||
defineType("ClassProperty", { | ||
@@ -1618,3 +1587,4 @@ visitor: ["key", "value", "typeAnnotation", "decorators"], | ||
typeAnnotation: { | ||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), | ||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", | ||
"Noop"), | ||
optional: true | ||
@@ -1664,3 +1634,4 @@ }, | ||
typeAnnotation: { | ||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), | ||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", | ||
"Noop"), | ||
optional: true | ||
@@ -1699,3 +1670,4 @@ }, | ||
typeAnnotation: { | ||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", "Noop"), | ||
validate: (0, _utils.assertNodeType)("TypeAnnotation", "TSTypeAnnotation", | ||
"Noop"), | ||
optional: true | ||
@@ -1702,0 +1674,0 @@ }, |
"use strict"; | ||
var _utils = require("./utils"); | ||
(0, _utils.default)("ArgumentPlaceholder", {}); | ||
@@ -99,2 +98,3 @@ (0, _utils.default)("BindExpression", { | ||
}); | ||
(0, _utils.default)("ModuleExpression", { | ||
@@ -109,5 +109,7 @@ visitor: ["body"], | ||
}); | ||
(0, _utils.default)("TopicReference", { | ||
aliases: ["Expression"] | ||
}); | ||
(0, _utils.default)("PipelineTopicExpression", { | ||
@@ -114,0 +116,0 @@ builder: ["expression"], |
"use strict"; | ||
var _utils = require("./utils"); | ||
const defineType = (0, _utils.defineAliasedType)("Flow"); | ||
const defineInterfaceishType = name => { | ||
@@ -22,3 +20,2 @@ defineType(name, { | ||
}; | ||
defineType("AnyTypeAnnotation", { | ||
@@ -397,2 +394,3 @@ aliases: ["FlowType", "FlowBaseAnnotation"] | ||
}); | ||
defineType("EnumDeclaration", { | ||
@@ -399,0 +397,0 @@ aliases: ["Statement", "Declaration"], |
@@ -67,37 +67,19 @@ "use strict"; | ||
}); | ||
var _toFastProperties = require("to-fast-properties"); | ||
require("./core"); | ||
require("./flow"); | ||
require("./jsx"); | ||
require("./misc"); | ||
require("./experimental"); | ||
require("./typescript"); | ||
var _utils = require("./utils"); | ||
var _placeholders = require("./placeholders"); | ||
_toFastProperties(_utils.VISITOR_KEYS); | ||
_toFastProperties(_utils.ALIAS_KEYS); | ||
_toFastProperties(_utils.FLIPPED_ALIAS_KEYS); | ||
_toFastProperties(_utils.NODE_FIELDS); | ||
_toFastProperties(_utils.BUILDER_KEYS); | ||
_toFastProperties(_utils.DEPRECATED_KEYS); | ||
_toFastProperties(_placeholders.PLACEHOLDERS_ALIAS); | ||
_toFastProperties(_placeholders.PLACEHOLDERS_FLIPPED_ALIAS); | ||
const TYPES = [].concat(Object.keys(_utils.VISITOR_KEYS), Object.keys(_utils.FLIPPED_ALIAS_KEYS), Object.keys(_utils.DEPRECATED_KEYS)); | ||
@@ -104,0 +86,0 @@ exports.TYPES = TYPES; |
"use strict"; | ||
var _utils = require("./utils"); | ||
const defineType = (0, _utils.defineAliasedType)("JSX"); | ||
@@ -6,0 +5,0 @@ defineType("JSXAttribute", { |
"use strict"; | ||
var _utils = require("./utils"); | ||
var _placeholders = require("./placeholders"); | ||
const defineType = (0, _utils.defineAliasedType)("Miscellaneous"); | ||
@@ -8,0 +6,0 @@ { |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.PLACEHOLDERS_FLIPPED_ALIAS = exports.PLACEHOLDERS_ALIAS = exports.PLACEHOLDERS = void 0; | ||
var _utils = require("./utils"); | ||
const PLACEHOLDERS = ["Identifier", "StringLiteral", "Expression", "Statement", "Declaration", "BlockStatement", "ClassBody", "Pattern"]; | ||
@@ -18,3 +16,2 @@ exports.PLACEHOLDERS = PLACEHOLDERS; | ||
exports.PLACEHOLDERS_ALIAS = PLACEHOLDERS_ALIAS; | ||
for (const type of PLACEHOLDERS) { | ||
@@ -24,3 +21,2 @@ const alias = _utils.ALIAS_KEYS[type]; | ||
} | ||
const PLACEHOLDERS_FLIPPED_ALIAS = {}; | ||
@@ -33,3 +29,2 @@ exports.PLACEHOLDERS_FLIPPED_ALIAS = PLACEHOLDERS_FLIPPED_ALIAS; | ||
} | ||
PLACEHOLDERS_FLIPPED_ALIAS[alias].push(type); | ||
@@ -36,0 +31,0 @@ }); |
"use strict"; | ||
var _utils = require("./utils"); | ||
var _core = require("./core"); | ||
var _is = require("../validators/is"); | ||
const defineType = (0, _utils.defineAliasedType)("TypeScript"); | ||
const bool = (0, _utils.assertValueType)("boolean"); | ||
const tSFunctionTypeAnnotationCommon = () => ({ | ||
returnType: { | ||
validate: (0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"), | ||
validate: | ||
(0, _utils.assertNodeType)("TSTypeAnnotation", "Noop"), | ||
optional: true | ||
}, | ||
typeParameters: { | ||
validate: (0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"), | ||
validate: | ||
(0, _utils.assertNodeType)("TSTypeParameterDeclaration", "Noop"), | ||
optional: true | ||
} | ||
}); | ||
defineType("TSParameterProperty", { | ||
@@ -65,3 +62,2 @@ aliases: ["LVal"], | ||
}); | ||
const signatureDeclarationCommon = () => ({ | ||
@@ -72,3 +68,2 @@ typeParameters: (0, _utils.validateOptionalType)("TSTypeParameterDeclaration"), | ||
}); | ||
const callConstructSignatureDeclaration = { | ||
@@ -81,3 +76,2 @@ aliases: ["TSTypeElement"], | ||
defineType("TSConstructSignatureDeclaration", callConstructSignatureDeclaration); | ||
const namedTypeElementCommon = () => ({ | ||
@@ -90,3 +84,2 @@ key: (0, _utils.validateType)("Expression"), | ||
}); | ||
defineType("TSPropertySignature", { | ||
@@ -124,3 +117,2 @@ aliases: ["TSTypeElement"], | ||
const tsKeywordTypes = ["TSAnyKeyword", "TSBooleanKeyword", "TSBigIntKeyword", "TSIntrinsicKeyword", "TSNeverKeyword", "TSNullKeyword", "TSNumberKeyword", "TSObjectKeyword", "TSStringKeyword", "TSSymbolKeyword", "TSUndefinedKeyword", "TSUnknownKeyword", "TSVoidKeyword"]; | ||
for (const type of tsKeywordTypes) { | ||
@@ -133,3 +125,2 @@ defineType(type, { | ||
} | ||
defineType("TSThisType", { | ||
@@ -294,3 +285,2 @@ aliases: ["TSType", "TSBaseType"], | ||
const literal = (0, _utils.assertNodeType)("NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral", "TemplateLiteral"); | ||
function validator(parent, key, node) { | ||
@@ -304,3 +294,2 @@ if ((0, _is.default)("UnaryExpression", node)) { | ||
} | ||
validator.oneOfNodeTypes = ["NumericLiteral", "StringLiteral", "BooleanLiteral", "BigIntLiteral", "TemplateLiteral", "UnaryExpression"]; | ||
@@ -307,0 +296,0 @@ return validator; |
@@ -25,7 +25,4 @@ "use strict"; | ||
exports.validateType = validateType; | ||
var _is = require("../validators/is"); | ||
var _validate = require("../validators/validate"); | ||
const VISITOR_KEYS = {}; | ||
@@ -45,3 +42,2 @@ exports.VISITOR_KEYS = VISITOR_KEYS; | ||
exports.NODE_PARENT_VALIDATIONS = NODE_PARENT_VALIDATIONS; | ||
function getType(val) { | ||
@@ -56,3 +52,2 @@ if (Array.isArray(val)) { | ||
} | ||
function validate(validate) { | ||
@@ -63,11 +58,8 @@ return { | ||
} | ||
function typeIs(typeName) { | ||
return typeof typeName === "string" ? assertNodeType(typeName) : assertNodeType(...typeName); | ||
} | ||
function validateType(typeName) { | ||
return validate(typeIs(typeName)); | ||
} | ||
function validateOptional(validate) { | ||
@@ -79,3 +71,2 @@ return { | ||
} | ||
function validateOptionalType(typeName) { | ||
@@ -87,19 +78,14 @@ return { | ||
} | ||
function arrayOf(elementType) { | ||
return chain(assertValueType("array"), assertEach(elementType)); | ||
} | ||
function arrayOfType(typeName) { | ||
return arrayOf(typeIs(typeName)); | ||
} | ||
function validateArrayOfType(typeName) { | ||
return validate(arrayOfType(typeName)); | ||
} | ||
function assertEach(callback) { | ||
function validator(node, key, val) { | ||
if (!Array.isArray(val)) return; | ||
for (let i = 0; i < val.length; i++) { | ||
@@ -112,7 +98,5 @@ const subkey = `${key}[${i}]`; | ||
} | ||
validator.each = callback; | ||
return validator; | ||
} | ||
function assertOneOf(...values) { | ||
@@ -124,7 +108,5 @@ function validate(node, key, val) { | ||
} | ||
validate.oneOf = values; | ||
return validate; | ||
} | ||
function assertNodeType(...types) { | ||
@@ -138,10 +120,7 @@ function validate(node, key, val) { | ||
} | ||
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`); | ||
} | ||
validate.oneOfNodeTypes = types; | ||
return validate; | ||
} | ||
function assertNodeOrValueType(...types) { | ||
@@ -155,14 +134,10 @@ function validate(node, key, val) { | ||
} | ||
throw new TypeError(`Property ${key} of ${node.type} expected node to be of a type ${JSON.stringify(types)} but instead got ${JSON.stringify(val == null ? void 0 : val.type)}`); | ||
} | ||
validate.oneOfNodeOrValueTypes = types; | ||
return validate; | ||
} | ||
function assertValueType(type) { | ||
function validate(node, key, val) { | ||
const valid = getType(val) === type; | ||
if (!valid) { | ||
@@ -172,11 +147,8 @@ throw new TypeError(`Property ${key} expected type of ${type} but got ${getType(val)}`); | ||
} | ||
validate.type = type; | ||
return validate; | ||
} | ||
function assertShape(shape) { | ||
function validate(node, key, val) { | ||
const errors = []; | ||
for (const property of Object.keys(shape)) { | ||
@@ -190,7 +162,5 @@ try { | ||
} | ||
throw error; | ||
} | ||
} | ||
if (errors.length) { | ||
@@ -200,13 +170,9 @@ throw new TypeError(`Property ${key} of ${node.type} expected to have the following:\n${errors.join("\n")}`); | ||
} | ||
validate.shapeOf = shape; | ||
return validate; | ||
} | ||
function assertOptionalChainStart() { | ||
function validate(node) { | ||
var _current; | ||
let current = node; | ||
while (node) { | ||
@@ -216,3 +182,2 @@ const { | ||
} = current; | ||
if (type === "OptionalCallExpression") { | ||
@@ -223,3 +188,2 @@ if (current.optional) return; | ||
} | ||
if (type === "OptionalMemberExpression") { | ||
@@ -230,12 +194,8 @@ if (current.optional) return; | ||
} | ||
break; | ||
} | ||
throw new TypeError(`Non-optional ${node.type} must chain from an optional OptionalMemberExpression or OptionalCallExpression. Found chain from ${(_current = current) == null ? void 0 : _current.type}`); | ||
} | ||
return validate; | ||
} | ||
function chain(...fns) { | ||
@@ -247,14 +207,11 @@ function validate(...args) { | ||
} | ||
validate.chainOf = fns; | ||
if (fns.length >= 2 && "type" in fns[0] && fns[0].type === "array" && !("each" in fns[1])) { | ||
throw new Error(`An assertValueType("array") validator can only be followed by an assertEach(...) validator.`); | ||
} | ||
return validate; | ||
} | ||
const validTypeOpts = ["aliases", "builder", "deprecatedAlias", "fields", "inherits", "visitor", "validate"]; | ||
const validFieldKeys = ["default", "optional", "validate"]; | ||
const store = {}; | ||
@@ -264,6 +221,4 @@ function defineAliasedType(...aliases) { | ||
let defined = opts.aliases; | ||
if (!defined) { | ||
var _store$opts$inherits$, _defined; | ||
if (opts.inherits) defined = (_store$opts$inherits$ = store[opts.inherits].aliases) == null ? void 0 : _store$opts$inherits$.slice(); | ||
@@ -273,3 +228,2 @@ (_defined = defined) != null ? _defined : defined = []; | ||
} | ||
const additional = aliases.filter(a => !defined.includes(a)); | ||
@@ -280,21 +234,15 @@ defined.unshift(...additional); | ||
} | ||
function defineType(type, opts = {}) { | ||
const inherits = opts.inherits && store[opts.inherits] || {}; | ||
let fields = opts.fields; | ||
if (!fields) { | ||
fields = {}; | ||
if (inherits.fields) { | ||
const keys = Object.getOwnPropertyNames(inherits.fields); | ||
for (const key of keys) { | ||
const field = inherits.fields[key]; | ||
const def = field.default; | ||
if (Array.isArray(def) ? def.length > 0 : def && typeof def === "object") { | ||
throw new Error("field defaults can only be primitives or empty arrays currently"); | ||
} | ||
fields[key] = { | ||
@@ -308,7 +256,5 @@ default: Array.isArray(def) ? [] : def, | ||
} | ||
const visitor = opts.visitor || inherits.visitor || []; | ||
const aliases = opts.aliases || inherits.aliases || []; | ||
const builder = opts.builder || inherits.builder || opts.visitor || []; | ||
for (const k of Object.keys(opts)) { | ||
@@ -319,3 +265,2 @@ if (validTypeOpts.indexOf(k) === -1) { | ||
} | ||
if (opts.deprecatedAlias) { | ||
@@ -328,10 +273,7 @@ DEPRECATED_KEYS[opts.deprecatedAlias] = type; | ||
} | ||
for (const key of Object.keys(fields)) { | ||
const field = fields[key]; | ||
if (field.default !== undefined && builder.indexOf(key) === -1) { | ||
field.optional = true; | ||
} | ||
if (field.default === undefined) { | ||
@@ -342,3 +284,2 @@ field.default = null; | ||
} | ||
for (const k of Object.keys(field)) { | ||
@@ -350,3 +291,2 @@ if (validFieldKeys.indexOf(k) === -1) { | ||
} | ||
VISITOR_KEYS[type] = opts.visitor = visitor; | ||
@@ -360,12 +300,8 @@ BUILDER_KEYS[type] = opts.builder = builder; | ||
}); | ||
if (opts.validate) { | ||
NODE_PARENT_VALIDATIONS[type] = opts.validate; | ||
} | ||
store[type] = opts; | ||
} | ||
const store = {}; | ||
//# sourceMappingURL=utils.js.map |
@@ -402,13 +402,7 @@ "use strict"; | ||
}); | ||
var _isReactComponent = require("./validators/react/isReactComponent"); | ||
var _isCompatTag = require("./validators/react/isCompatTag"); | ||
var _buildChildren = require("./builders/react/buildChildren"); | ||
var _assertNode = require("./asserts/assertNode"); | ||
var _generated = require("./asserts/generated"); | ||
Object.keys(_generated).forEach(function (key) { | ||
@@ -425,11 +419,6 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _createTypeAnnotationBasedOnTypeof = require("./builders/flow/createTypeAnnotationBasedOnTypeof"); | ||
var _createFlowUnionType = require("./builders/flow/createFlowUnionType"); | ||
var _createTSUnionType = require("./builders/typescript/createTSUnionType"); | ||
var _generated2 = require("./builders/generated"); | ||
Object.keys(_generated2).forEach(function (key) { | ||
@@ -446,5 +435,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _uppercase = require("./builders/generated/uppercase"); | ||
Object.keys(_uppercase).forEach(function (key) { | ||
@@ -461,29 +448,15 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _cloneNode = require("./clone/cloneNode"); | ||
var _clone = require("./clone/clone"); | ||
var _cloneDeep = require("./clone/cloneDeep"); | ||
var _cloneDeepWithoutLoc = require("./clone/cloneDeepWithoutLoc"); | ||
var _cloneWithoutLoc = require("./clone/cloneWithoutLoc"); | ||
var _addComment = require("./comments/addComment"); | ||
var _addComments = require("./comments/addComments"); | ||
var _inheritInnerComments = require("./comments/inheritInnerComments"); | ||
var _inheritLeadingComments = require("./comments/inheritLeadingComments"); | ||
var _inheritsComments = require("./comments/inheritsComments"); | ||
var _inheritTrailingComments = require("./comments/inheritTrailingComments"); | ||
var _removeComments = require("./comments/removeComments"); | ||
var _generated3 = require("./constants/generated"); | ||
Object.keys(_generated3).forEach(function (key) { | ||
@@ -500,5 +473,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _constants = require("./constants"); | ||
Object.keys(_constants).forEach(function (key) { | ||
@@ -515,25 +486,13 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _ensureBlock = require("./converters/ensureBlock"); | ||
var _toBindingIdentifierName = require("./converters/toBindingIdentifierName"); | ||
var _toBlock = require("./converters/toBlock"); | ||
var _toComputedKey = require("./converters/toComputedKey"); | ||
var _toExpression = require("./converters/toExpression"); | ||
var _toIdentifier = require("./converters/toIdentifier"); | ||
var _toKeyAlias = require("./converters/toKeyAlias"); | ||
var _toSequenceExpression = require("./converters/toSequenceExpression"); | ||
var _toStatement = require("./converters/toStatement"); | ||
var _valueToNode = require("./converters/valueToNode"); | ||
var _definitions = require("./definitions"); | ||
Object.keys(_definitions).forEach(function (key) { | ||
@@ -550,21 +509,11 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _appendToMemberExpression = require("./modifications/appendToMemberExpression"); | ||
var _inherits = require("./modifications/inherits"); | ||
var _prependToMemberExpression = require("./modifications/prependToMemberExpression"); | ||
var _removeProperties = require("./modifications/removeProperties"); | ||
var _removePropertiesDeep = require("./modifications/removePropertiesDeep"); | ||
var _removeTypeDuplicates = require("./modifications/flow/removeTypeDuplicates"); | ||
var _getBindingIdentifiers = require("./retrievers/getBindingIdentifiers"); | ||
var _getOuterBindingIdentifiers = require("./retrievers/getOuterBindingIdentifiers"); | ||
var _traverse = require("./traverse/traverse"); | ||
Object.keys(_traverse).forEach(function (key) { | ||
@@ -581,45 +530,23 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _traverseFast = require("./traverse/traverseFast"); | ||
var _shallowEqual = require("./utils/shallowEqual"); | ||
var _is = require("./validators/is"); | ||
var _isBinding = require("./validators/isBinding"); | ||
var _isBlockScoped = require("./validators/isBlockScoped"); | ||
var _isImmutable = require("./validators/isImmutable"); | ||
var _isLet = require("./validators/isLet"); | ||
var _isNode = require("./validators/isNode"); | ||
var _isNodesEquivalent = require("./validators/isNodesEquivalent"); | ||
var _isPlaceholderType = require("./validators/isPlaceholderType"); | ||
var _isReferenced = require("./validators/isReferenced"); | ||
var _isScope = require("./validators/isScope"); | ||
var _isSpecifierDefault = require("./validators/isSpecifierDefault"); | ||
var _isType = require("./validators/isType"); | ||
var _isValidES3Identifier = require("./validators/isValidES3Identifier"); | ||
var _isValidIdentifier = require("./validators/isValidIdentifier"); | ||
var _isVar = require("./validators/isVar"); | ||
var _matchesPattern = require("./validators/matchesPattern"); | ||
var _validate = require("./validators/validate"); | ||
var _buildMatchMemberExpression = require("./validators/buildMatchMemberExpression"); | ||
var _generated4 = require("./validators/generated"); | ||
Object.keys(_generated4).forEach(function (key) { | ||
@@ -636,5 +563,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
var _generated5 = require("./ast-types/generated"); | ||
Object.keys(_generated5).forEach(function (key) { | ||
@@ -651,2 +576,3 @@ if (key === "default" || key === "__esModule") return; | ||
}); | ||
const react = { | ||
@@ -653,0 +579,0 @@ isReactComponent: _isReactComponent.default, |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = appendToMemberExpression; | ||
var _generated = require("../builders/generated"); | ||
function appendToMemberExpression(member, append, computed = false) { | ||
@@ -12,0 +10,0 @@ member.object = (0, _generated.memberExpression)(member.object, member.property, member.computed); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = removeTypeDuplicates; | ||
var _generated = require("../../validators/generated"); | ||
function getQualifiedName(node) { | ||
@@ -15,8 +13,9 @@ return (0, _generated.isIdentifier)(node) ? node.name : `${node.id.name}.${getQualifiedName(node.qualification)}`; | ||
function removeTypeDuplicates(nodes) { | ||
function removeTypeDuplicates( | ||
nodes) { | ||
const generics = new Map(); | ||
const bases = new Map(); | ||
const typeGroups = new Set(); | ||
const types = []; | ||
for (let i = 0; i < nodes.length; i++) { | ||
@@ -33,3 +32,2 @@ const node = nodes[i]; | ||
} | ||
if ((0, _generated.isFlowBaseAnnotation)(node)) { | ||
@@ -39,3 +37,2 @@ bases.set(node.type, node); | ||
} | ||
if ((0, _generated.isUnionTypeAnnotation)(node)) { | ||
@@ -46,3 +43,2 @@ if (!typeGroups.has(node.types)) { | ||
} | ||
continue; | ||
@@ -53,6 +49,4 @@ } | ||
const name = getQualifiedName(node.id); | ||
if (generics.has(name)) { | ||
let existing = generics.get(name); | ||
if (existing.typeParameters) { | ||
@@ -68,6 +62,4 @@ if (node.typeParameters) { | ||
} | ||
continue; | ||
} | ||
types.push(node); | ||
@@ -83,3 +75,2 @@ } | ||
} | ||
return types; | ||
@@ -86,0 +77,0 @@ } |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.default = inherits; | ||
var _constants = require("../constants"); | ||
var _inheritsComments = require("../comments/inheritsComments"); | ||
function inherits(child, parent) { | ||
@@ -31,3 +28,2 @@ if (!child || !parent) return child; | ||
} | ||
(0, _inheritsComments.default)(child, parent); | ||
@@ -34,0 +30,0 @@ return child; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.default = prependToMemberExpression; | ||
var _generated = require("../builders/generated"); | ||
var _ = require(".."); | ||
function prependToMemberExpression(member, prepend) { | ||
@@ -17,3 +14,2 @@ if ((0, _.isSuper)(member.object)) { | ||
} | ||
member.object = (0, _generated.memberExpression)(prepend, member.object); | ||
@@ -20,0 +16,0 @@ return member; |
@@ -7,21 +7,16 @@ "use strict"; | ||
exports.default = removeProperties; | ||
var _constants = require("../constants"); | ||
const CLEAR_KEYS = ["tokens", "start", "end", "loc", "raw", "rawValue"]; | ||
const CLEAR_KEYS = ["tokens", | ||
"start", "end", "loc", | ||
"raw", "rawValue"]; | ||
const CLEAR_KEYS_PLUS_COMMENTS = [..._constants.COMMENT_KEYS, "comments", ...CLEAR_KEYS]; | ||
function removeProperties(node, opts = {}) { | ||
const map = opts.preserveComments ? CLEAR_KEYS : CLEAR_KEYS_PLUS_COMMENTS; | ||
for (const key of map) { | ||
if (node[key] != null) node[key] = undefined; | ||
} | ||
for (const key of Object.keys(node)) { | ||
if (key[0] === "_" && node[key] != null) node[key] = undefined; | ||
} | ||
const symbols = Object.getOwnPropertySymbols(node); | ||
for (const sym of symbols) { | ||
@@ -28,0 +23,0 @@ node[sym] = null; |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.default = removePropertiesDeep; | ||
var _traverseFast = require("../traverse/traverseFast"); | ||
var _removeProperties = require("./removeProperties"); | ||
function removePropertiesDeep(tree, opts) { | ||
@@ -14,0 +11,0 @@ (0, _traverseFast.default)(tree, _removeProperties.default, opts); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = removeTypeDuplicates; | ||
var _generated = require("../../validators/generated"); | ||
function getQualifiedName(node) { | ||
@@ -18,5 +16,5 @@ return (0, _generated.isIdentifier)(node) ? node.name : `${node.right.name}.${getQualifiedName(node.left)}`; | ||
const bases = new Map(); | ||
const typeGroups = new Set(); | ||
const types = []; | ||
for (let i = 0; i < nodes.length; i++) { | ||
@@ -38,3 +36,2 @@ const node = nodes[i]; | ||
} | ||
if ((0, _generated.isTSUnionType)(node)) { | ||
@@ -45,3 +42,2 @@ if (!typeGroups.has(node.types)) { | ||
} | ||
continue; | ||
@@ -52,6 +48,4 @@ } | ||
const name = getQualifiedName(node.typeName); | ||
if (generics.has(name)) { | ||
let existing = generics.get(name); | ||
if (existing.typeParameters) { | ||
@@ -67,6 +61,4 @@ if (node.typeParameters) { | ||
} | ||
continue; | ||
} | ||
types.push(node); | ||
@@ -82,3 +74,2 @@ } | ||
} | ||
return types; | ||
@@ -85,0 +76,0 @@ } |
@@ -7,18 +7,14 @@ "use strict"; | ||
exports.default = getBindingIdentifiers; | ||
var _generated = require("../validators/generated"); | ||
function getBindingIdentifiers(node, duplicates, outerOnly) { | ||
const search = [].concat(node); | ||
const ids = Object.create(null); | ||
while (search.length) { | ||
const id = search.shift(); | ||
if (!id) continue; | ||
const keys = getBindingIdentifiers.keys[id.type]; | ||
const keys = | ||
getBindingIdentifiers.keys[id.type]; | ||
if ((0, _generated.isIdentifier)(id)) { | ||
if (duplicates) { | ||
const _ids = ids[id.name] = ids[id.name] || []; | ||
_ids.push(id); | ||
@@ -28,6 +24,4 @@ } else { | ||
} | ||
continue; | ||
} | ||
if ((0, _generated.isExportDeclaration)(id) && !(0, _generated.isExportAllDeclaration)(id)) { | ||
@@ -37,6 +31,4 @@ if ((0, _generated.isDeclaration)(id.declaration)) { | ||
} | ||
continue; | ||
} | ||
if (outerOnly) { | ||
@@ -47,3 +39,2 @@ if ((0, _generated.isFunctionDeclaration)(id)) { | ||
} | ||
if ((0, _generated.isFunctionExpression)(id)) { | ||
@@ -53,8 +44,7 @@ continue; | ||
} | ||
if (keys) { | ||
for (let i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
const nodes = id[key]; | ||
const nodes = | ||
id[key]; | ||
if (nodes) { | ||
@@ -61,0 +51,0 @@ Array.isArray(nodes) ? search.push(...nodes) : search.push(nodes); |
@@ -7,8 +7,5 @@ "use strict"; | ||
exports.default = void 0; | ||
var _getBindingIdentifiers = require("./getBindingIdentifiers"); | ||
var _default = getOuterBindingIdentifiers; | ||
exports.default = _default; | ||
function getOuterBindingIdentifiers(node, duplicates) { | ||
@@ -15,0 +12,0 @@ return (0, _getBindingIdentifiers.default)(node, duplicates, true); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = traverse; | ||
var _definitions = require("../definitions"); | ||
function traverse(node, handlers, state) { | ||
@@ -17,3 +15,2 @@ if (typeof handlers === "function") { | ||
} | ||
const { | ||
@@ -25,3 +22,2 @@ enter, | ||
} | ||
function traverseSimpleImpl(node, enter, exit, state, ancestors) { | ||
@@ -31,6 +27,4 @@ const keys = _definitions.VISITOR_KEYS[node.type]; | ||
if (enter) enter(node, ancestors, state); | ||
for (const key of keys) { | ||
const subNode = node[key]; | ||
if (Array.isArray(subNode)) { | ||
@@ -57,3 +51,2 @@ for (let i = 0; i < subNode.length; i++) { | ||
} | ||
if (exit) exit(node, ancestors, state); | ||
@@ -60,0 +53,0 @@ } |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = traverseFast; | ||
var _definitions = require("../definitions"); | ||
function traverseFast(node, enter, opts) { | ||
@@ -17,6 +15,5 @@ if (!node) return; | ||
enter(node, opts); | ||
for (const key of keys) { | ||
const subNode = node[key]; | ||
const subNode = | ||
node[key]; | ||
if (Array.isArray(subNode)) { | ||
@@ -23,0 +20,0 @@ for (const node of subNode) { |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.default = inherit; | ||
function inherit(key, child, parent) { | ||
@@ -10,0 +9,0 @@ if (child && parent) { |
@@ -7,9 +7,6 @@ "use strict"; | ||
exports.default = cleanJSXElementLiteralChild; | ||
var _generated = require("../../builders/generated"); | ||
function cleanJSXElementLiteralChild(child, args) { | ||
const lines = child.value.split(/\r\n|\n|\r/); | ||
let lastNonEmptyLine = 0; | ||
for (let i = 0; i < lines.length; i++) { | ||
@@ -20,5 +17,3 @@ if (lines[i].match(/[^ \t]/)) { | ||
} | ||
let str = ""; | ||
for (let i = 0; i < lines.length; i++) { | ||
@@ -29,2 +24,3 @@ const line = lines[i]; | ||
const isLastNonEmptyLine = i === lastNonEmptyLine; | ||
let trimmedLine = line.replace(/\t/g, " "); | ||
@@ -39,3 +35,2 @@ | ||
} | ||
if (trimmedLine) { | ||
@@ -45,7 +40,5 @@ if (!isLastNonEmptyLine) { | ||
} | ||
str += trimmedLine; | ||
} | ||
} | ||
if (str) args.push((0, _generated.stringLiteral)(str)); | ||
@@ -52,0 +45,0 @@ } |
@@ -7,12 +7,10 @@ "use strict"; | ||
exports.default = shallowEqual; | ||
function shallowEqual(actual, expected) { | ||
const keys = Object.keys(expected); | ||
for (const key of keys) { | ||
if (actual[key] !== expected[key]) { | ||
if ( | ||
actual[key] !== expected[key]) { | ||
return false; | ||
} | ||
} | ||
return true; | ||
@@ -19,0 +17,0 @@ } |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = buildMatchMemberExpression; | ||
var _matchesPattern = require("./matchesPattern"); | ||
function buildMatchMemberExpression(match, allowPartial) { | ||
@@ -12,0 +10,0 @@ const parts = match.split("."); |
@@ -7,15 +7,9 @@ "use strict"; | ||
exports.default = is; | ||
var _shallowEqual = require("../utils/shallowEqual"); | ||
var _isType = require("./isType"); | ||
var _isPlaceholderType = require("./isPlaceholderType"); | ||
var _definitions = require("../definitions"); | ||
function is(type, node, opts) { | ||
if (!node) return false; | ||
const matches = (0, _isType.default)(node.type, type); | ||
if (!matches) { | ||
@@ -25,6 +19,4 @@ if (!opts && node.type === "Placeholder" && type in _definitions.FLIPPED_ALIAS_KEYS) { | ||
} | ||
return false; | ||
} | ||
if (typeof opts === "undefined") { | ||
@@ -31,0 +23,0 @@ return true; |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = isBinding; | ||
var _getBindingIdentifiers = require("../retrievers/getBindingIdentifiers"); | ||
function isBinding(node, parent, grandparent) { | ||
@@ -15,10 +13,9 @@ if (grandparent && node.type === "Identifier" && parent.type === "ObjectProperty" && grandparent.type === "ObjectExpression") { | ||
} | ||
const keys = _getBindingIdentifiers.default.keys[parent.type]; | ||
const keys = | ||
_getBindingIdentifiers.default.keys[parent.type]; | ||
if (keys) { | ||
for (let i = 0; i < keys.length; i++) { | ||
const key = keys[i]; | ||
const val = parent[key]; | ||
const val = | ||
parent[key]; | ||
if (Array.isArray(val)) { | ||
@@ -31,3 +28,2 @@ if (val.indexOf(node) >= 0) return true; | ||
} | ||
return false; | ||
@@ -34,0 +30,0 @@ } |
@@ -7,7 +7,4 @@ "use strict"; | ||
exports.default = isBlockScoped; | ||
var _generated = require("./generated"); | ||
var _isLet = require("./isLet"); | ||
function isBlockScoped(node) { | ||
@@ -14,0 +11,0 @@ return (0, _generated.isFunctionDeclaration)(node) || (0, _generated.isClassDeclaration)(node) || (0, _isLet.default)(node); |
@@ -7,10 +7,6 @@ "use strict"; | ||
exports.default = isImmutable; | ||
var _isType = require("./isType"); | ||
var _generated = require("./generated"); | ||
function isImmutable(node) { | ||
if ((0, _isType.default)(node.type, "Immutable")) return true; | ||
if ((0, _generated.isIdentifier)(node)) { | ||
@@ -23,3 +19,2 @@ if (node.name === "undefined") { | ||
} | ||
return false; | ||
@@ -26,0 +21,0 @@ } |
@@ -7,11 +7,9 @@ "use strict"; | ||
exports.default = isLet; | ||
var _generated = require("./generated"); | ||
var _constants = require("../constants"); | ||
function isLet(node) { | ||
return (0, _generated.isVariableDeclaration)(node) && (node.kind !== "var" || node[_constants.BLOCK_SCOPED_SYMBOL]); | ||
return (0, _generated.isVariableDeclaration)(node) && (node.kind !== "var" || | ||
node[_constants.BLOCK_SCOPED_SYMBOL]); | ||
} | ||
//# sourceMappingURL=isLet.js.map |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = isNode; | ||
var _definitions = require("../definitions"); | ||
function isNode(node) { | ||
@@ -12,0 +10,0 @@ return !!(node && _definitions.VISITOR_KEYS[node.type]); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = isNodesEquivalent; | ||
var _definitions = require("../definitions"); | ||
function isNodesEquivalent(a, b) { | ||
@@ -15,18 +13,14 @@ if (typeof a !== "object" || typeof b !== "object" || a == null || b == null) { | ||
} | ||
if (a.type !== b.type) { | ||
return false; | ||
} | ||
const fields = Object.keys(_definitions.NODE_FIELDS[a.type] || a.type); | ||
const visitorKeys = _definitions.VISITOR_KEYS[a.type]; | ||
for (const field of fields) { | ||
const val_a = a[field]; | ||
const val_a = | ||
a[field]; | ||
const val_b = b[field]; | ||
if (typeof val_a !== typeof val_b) { | ||
return false; | ||
} | ||
if (val_a == null && val_b == null) { | ||
@@ -37,3 +31,2 @@ continue; | ||
} | ||
if (Array.isArray(val_a)) { | ||
@@ -43,7 +36,5 @@ if (!Array.isArray(val_b)) { | ||
} | ||
if (val_a.length !== val_b.length) { | ||
return false; | ||
} | ||
for (let i = 0; i < val_a.length; i++) { | ||
@@ -54,6 +45,4 @@ if (!isNodesEquivalent(val_a[i], val_b[i])) { | ||
} | ||
continue; | ||
} | ||
if (typeof val_a === "object" && !(visitorKeys != null && visitorKeys.includes(field))) { | ||
@@ -65,6 +54,4 @@ for (const key of Object.keys(val_a)) { | ||
} | ||
continue; | ||
} | ||
if (!isNodesEquivalent(val_a, val_b)) { | ||
@@ -74,3 +61,2 @@ return false; | ||
} | ||
return true; | ||
@@ -77,0 +63,0 @@ } |
@@ -7,9 +7,6 @@ "use strict"; | ||
exports.default = isPlaceholderType; | ||
var _definitions = require("../definitions"); | ||
function isPlaceholderType(placeholderType, targetType) { | ||
if (placeholderType === targetType) return true; | ||
const aliases = _definitions.PLACEHOLDERS_ALIAS[placeholderType]; | ||
if (aliases) { | ||
@@ -20,3 +17,2 @@ for (const alias of aliases) { | ||
} | ||
return false; | ||
@@ -23,0 +19,0 @@ } |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.default = isReferenced; | ||
function isReferenced(node, parent, grandparent) { | ||
@@ -16,8 +15,5 @@ switch (parent.type) { | ||
} | ||
return parent.object === node; | ||
case "JSXMemberExpression": | ||
return parent.object === node; | ||
case "VariableDeclarator": | ||
@@ -38,3 +34,2 @@ return parent.init === node; | ||
} | ||
return false; | ||
@@ -46,5 +41,3 @@ | ||
} | ||
return !grandparent || grandparent.type !== "ObjectPattern"; | ||
case "ClassProperty": | ||
@@ -55,5 +48,3 @@ case "ClassAccessorProperty": | ||
} | ||
return true; | ||
case "ClassPrivateProperty": | ||
@@ -80,3 +71,2 @@ return parent.key !== node; | ||
return false; | ||
case "BreakStatement": | ||
@@ -98,3 +88,2 @@ case "ContinueStatement": | ||
} | ||
return parent.local === node; | ||
@@ -130,6 +119,4 @@ | ||
} | ||
return true; | ||
} | ||
return true; | ||
@@ -136,0 +123,0 @@ } |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = isScope; | ||
var _generated = require("./generated"); | ||
function isScope(node, parent) { | ||
@@ -19,3 +17,2 @@ if ((0, _generated.isBlockStatement)(node) && ((0, _generated.isFunction)(parent) || (0, _generated.isCatchClause)(parent))) { | ||
} | ||
return (0, _generated.isScopable)(node); | ||
@@ -22,0 +19,0 @@ } |
@@ -7,7 +7,6 @@ "use strict"; | ||
exports.default = isSpecifierDefault; | ||
var _generated = require("./generated"); | ||
function isSpecifierDefault(specifier) { | ||
return (0, _generated.isImportDefaultSpecifier)(specifier) || (0, _generated.isIdentifier)(specifier.imported || specifier.exported, { | ||
return (0, _generated.isImportDefaultSpecifier)(specifier) || | ||
(0, _generated.isIdentifier)(specifier.imported || specifier.exported, { | ||
name: "default" | ||
@@ -14,0 +13,0 @@ }); |
@@ -7,13 +7,10 @@ "use strict"; | ||
exports.default = isType; | ||
var _definitions = require("../definitions"); | ||
function isType(nodeType, targetType) { | ||
if (nodeType === targetType) return true; | ||
if (_definitions.ALIAS_KEYS[targetType]) return false; | ||
const aliases = _definitions.FLIPPED_ALIAS_KEYS[targetType]; | ||
if (aliases) { | ||
if (aliases[0] === nodeType) return true; | ||
for (const alias of aliases) { | ||
@@ -23,3 +20,2 @@ if (nodeType === alias) return true; | ||
} | ||
return false; | ||
@@ -26,0 +22,0 @@ } |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = isValidES3Identifier; | ||
var _isValidIdentifier = require("./isValidIdentifier"); | ||
const RESERVED_WORDS_ES3_ONLY = new Set(["abstract", "boolean", "byte", "char", "double", "enum", "final", "float", "goto", "implements", "int", "interface", "long", "native", "package", "private", "protected", "public", "short", "static", "synchronized", "throws", "transient", "volatile"]); | ||
@@ -12,0 +10,0 @@ |
@@ -7,8 +7,5 @@ "use strict"; | ||
exports.default = isValidIdentifier; | ||
var _helperValidatorIdentifier = require("@babel/helper-validator-identifier"); | ||
function isValidIdentifier(name, reserved = true) { | ||
if (typeof name !== "string") return false; | ||
if (reserved) { | ||
@@ -19,3 +16,2 @@ if ((0, _helperValidatorIdentifier.isKeyword)(name) || (0, _helperValidatorIdentifier.isStrictReservedWord)(name, true)) { | ||
} | ||
return (0, _helperValidatorIdentifier.isIdentifierName)(name); | ||
@@ -22,0 +18,0 @@ } |
@@ -7,13 +7,11 @@ "use strict"; | ||
exports.default = isVar; | ||
var _generated = require("./generated"); | ||
var _constants = require("../constants"); | ||
function isVar(node) { | ||
return (0, _generated.isVariableDeclaration)(node, { | ||
kind: "var" | ||
}) && !node[_constants.BLOCK_SCOPED_SYMBOL]; | ||
}) && ! | ||
node[_constants.BLOCK_SCOPED_SYMBOL]; | ||
} | ||
//# sourceMappingURL=isVar.js.map |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = matchesPattern; | ||
var _generated = require("./generated"); | ||
function matchesPattern(member, match, allowPartial) { | ||
@@ -16,15 +14,11 @@ if (!(0, _generated.isMemberExpression)(member)) return false; | ||
let node; | ||
for (node = member; (0, _generated.isMemberExpression)(node); node = node.object) { | ||
nodes.push(node.property); | ||
} | ||
nodes.push(node); | ||
if (nodes.length < parts.length) return false; | ||
if (!allowPartial && nodes.length > parts.length) return false; | ||
for (let i = 0, j = nodes.length - 1; i < parts.length; i++, j--) { | ||
const node = nodes[j]; | ||
let value; | ||
if ((0, _generated.isIdentifier)(node)) { | ||
@@ -39,6 +33,4 @@ value = node.name; | ||
} | ||
if (parts[i] !== value) return false; | ||
} | ||
return true; | ||
@@ -45,0 +37,0 @@ } |
@@ -7,3 +7,2 @@ "use strict"; | ||
exports.default = isCompatTag; | ||
function isCompatTag(tagName) { | ||
@@ -10,0 +9,0 @@ return !!tagName && /^[a-z]/.test(tagName); |
@@ -7,5 +7,3 @@ "use strict"; | ||
exports.default = void 0; | ||
var _buildMatchMemberExpression = require("../buildMatchMemberExpression"); | ||
const isReactComponent = (0, _buildMatchMemberExpression.default)("React.Component"); | ||
@@ -12,0 +10,0 @@ var _default = isReactComponent; |
@@ -9,5 +9,3 @@ "use strict"; | ||
exports.validateField = validateField; | ||
var _definitions = require("../definitions"); | ||
function validate(node, key, val) { | ||
@@ -21,3 +19,2 @@ if (!node) return; | ||
} | ||
function validateField(node, key, val, field) { | ||
@@ -28,3 +25,2 @@ if (!(field != null && field.validate)) return; | ||
} | ||
function validateChild(node, key, val) { | ||
@@ -31,0 +27,0 @@ if (val == null) return; |
{ | ||
"name": "@babel/types", | ||
"version": "7.20.0", | ||
"version": "7.20.2", | ||
"description": "Babel Types is a Lodash-esque utility library for AST nodes", | ||
@@ -32,4 +32,4 @@ "author": "The Babel Team (https://babel.dev/team)", | ||
"devDependencies": { | ||
"@babel/generator": "^7.20.0", | ||
"@babel/parser": "^7.20.0", | ||
"@babel/generator": "^7.20.2", | ||
"@babel/parser": "^7.20.2", | ||
"chalk": "^4.1.0", | ||
@@ -36,0 +36,0 @@ "glob": "^7.2.0" |
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
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
21404
2451741
166