vue-docgen-api
Advanced tools
Comparing version 4.74.2 to 4.75.0
@@ -82,6 +82,13 @@ "use strict"; | ||
function buildEventDescriptor(eventName, eventPath) { | ||
var _a; | ||
var eventDescriptor = documentation.getEventDescriptor(eventName); | ||
var typeParam = eventPath.get('parameters', 1, 'typeAnnotation'); | ||
var isPropertyEmitSyntax = bt.isTSPropertySignature(eventPath.node); | ||
var typeParam = isPropertyEmitSyntax | ||
? eventPath.get('typeAnnotation') | ||
: eventPath.get('parameters', 1, 'typeAnnotation'); | ||
if (bt.isTSTypeAnnotation(typeParam.node)) { | ||
var type = (0, getTypeFromAnnotation_1.default)(typeParam.node); | ||
if (isPropertyEmitSyntax && type) { | ||
type = (_a = type.elements) === null || _a === void 0 ? void 0 : _a[0]; | ||
} | ||
if (type) { | ||
@@ -117,2 +124,10 @@ eventDescriptor.type = { | ||
} | ||
else if (bt.isTSPropertySignature(member.node)) { | ||
if (bt.isIdentifier(member.node.key)) { | ||
buildEventDescriptor(member.node.key.name, member); | ||
} | ||
else if (bt.isStringLiteral(member.node.key)) { | ||
buildEventDescriptor(member.node.key.value, member); | ||
} | ||
} | ||
}); | ||
@@ -119,0 +134,0 @@ } |
@@ -121,3 +121,9 @@ "use strict"; | ||
if (bt.isIdentifier(nodePath.node.id) && nodePath.node.id.name === typeName) { | ||
typeBody = nodePath.get('typeAnnotation', 'members'); | ||
var typeAnnotation = nodePath.get('typeAnnotation'); | ||
if (bt.isTSTypeLiteral(typeAnnotation.node)) { | ||
typeBody = typeAnnotation.get('members'); | ||
} | ||
else if (bt.isTSTypeReference(typeAnnotation.node)) { | ||
typeBody = getTypeDefinitionFromIdentifier(astPath, typeAnnotation.node.typeName.name, opt); | ||
} | ||
} | ||
@@ -124,0 +130,0 @@ return false; |
@@ -61,3 +61,4 @@ "use strict"; | ||
TSUnionType: 'union', | ||
TSIntersectionType: 'intersection' | ||
TSIntersectionType: 'intersection', | ||
TSTupleType: 'tuple' | ||
}; | ||
@@ -90,7 +91,21 @@ function printType(t) { | ||
function getTypeObjectFromTSType(type) { | ||
return bt.isTSUnionType(type) || bt.isTSIntersectionType(type) | ||
? { name: TS_TYPE_NAME_MAP[type.type], elements: type.types.map(getTypeObjectFromTSType) } | ||
: bt.isTSArrayType(type) | ||
? { name: TS_TYPE_NAME_MAP[type.type], elements: [getTypeObjectFromTSType(type.elementType)] } | ||
: printType(type); | ||
if (bt.isTSUnionType(type) || bt.isTSIntersectionType(type)) { | ||
return { name: TS_TYPE_NAME_MAP[type.type], elements: type.types.map(getTypeObjectFromTSType) }; | ||
} | ||
if (bt.isTSArrayType(type)) { | ||
return { | ||
name: TS_TYPE_NAME_MAP[type.type], | ||
elements: [getTypeObjectFromTSType(type.elementType)] | ||
}; | ||
} | ||
if (bt.isTSTupleType(type)) { | ||
return { | ||
name: TS_TYPE_NAME_MAP[type.type], | ||
elements: type.elementTypes.map(getTypeObjectFromTSType) | ||
}; | ||
} | ||
if (bt.isTSNamedTupleMember(type)) { | ||
return getTypeObjectFromTSType(type.elementType); | ||
} | ||
return printType(type); | ||
} | ||
@@ -97,0 +112,0 @@ var FLOW_TYPE_NAME_MAP = { |
{ | ||
"name": "vue-docgen-api", | ||
"version": "4.74.2", | ||
"version": "4.75.0", | ||
"description": "Toolbox to extract information from Vue component files for documentation generation purposes.", | ||
@@ -5,0 +5,0 @@ "homepage": "https://vue-styleguidist.github.io", |
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
801455
12520