vue-docgen-api
Advanced tools
Comparing version 4.39.0 to 4.40.0
@@ -137,12 +137,21 @@ "use strict"; | ||
var propDecoratorArg = propDecoratorPath.get('arguments', 0); | ||
if (propDecoratorArg && bt.isObjectExpression(propDecoratorArg.node)) { | ||
var propsPath = propDecoratorArg | ||
.get('properties') | ||
.filter(function (p) { return bt.isObjectProperty(p.node); }); | ||
// if there is no type annotation, get it from the decorators arguments | ||
if (!propPath.node.typeAnnotation) { | ||
litteralType = propHandler_1.describeType(propsPath, propDescriptor); | ||
if (propDecoratorArg) { | ||
if (bt.isObjectExpression(propDecoratorArg.node)) { | ||
var propsPath = propDecoratorArg | ||
.get('properties') | ||
.filter(function (p) { | ||
return bt.isObjectProperty(p.node); | ||
}); | ||
// if there is no type annotation, get it from the decorators arguments | ||
if (!propPath.node.typeAnnotation) { | ||
litteralType = propHandler_1.describeType(propsPath, propDescriptor); | ||
} | ||
propHandler_1.describeDefault(propsPath, propDescriptor, litteralType || ''); | ||
propHandler_1.describeRequired(propsPath, propDescriptor); | ||
// this compares the node to its supposed args | ||
// if it finds no args it will return itself | ||
} | ||
propHandler_1.describeDefault(propsPath, propDescriptor, litteralType || ''); | ||
propHandler_1.describeRequired(propsPath, propDescriptor); | ||
else if (propDecoratorArg.node !== propDecoratorPath.node) { | ||
propDescriptor.type = propHandler_1.getTypeFromTypePath(propDecoratorArg); | ||
} | ||
} | ||
@@ -149,0 +158,0 @@ } |
@@ -18,2 +18,6 @@ import * as bt from '@babel/types'; | ||
export declare function describeType(propPropertiesPath: NodePath<bt.ObjectProperty | bt.ObjectMethod>[], propDescriptor: PropDescriptor): string | undefined; | ||
export declare function getTypeFromTypePath(typePath: NodePath<bt.TSAsExpression | bt.Identifier>): { | ||
name: string; | ||
func?: boolean; | ||
}; | ||
export declare function getValuesFromTypeAnnotation(type: bt.TSType): string[] | undefined; | ||
@@ -20,0 +24,0 @@ export declare function describeRequired(propPropertiesPath: NodePath<bt.ObjectProperty | bt.ObjectMethod>[], propDescriptor: PropDescriptor): void; |
@@ -61,3 +61,3 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.extractValuesFromTags = exports.describeDefault = exports.describeRequired = exports.getValuesFromTypeAnnotation = exports.describeType = void 0; | ||
exports.extractValuesFromTags = exports.describeDefault = exports.describeRequired = exports.getValuesFromTypeAnnotation = exports.getTypeFromTypePath = exports.describeType = void 0; | ||
var bt = __importStar(require("@babel/types")); | ||
@@ -307,2 +307,3 @@ var recast_1 = require("recast"); | ||
} | ||
exports.getTypeFromTypePath = getTypeFromTypePath; | ||
/** | ||
@@ -309,0 +310,0 @@ * When a prop is type annotated with the "as" keyword, |
{ | ||
"name": "vue-docgen-api", | ||
"version": "4.39.0", | ||
"version": "4.40.0", | ||
"description": "Toolbox to extract information from Vue component files for documentation generation purposes.", | ||
@@ -41,3 +41,3 @@ "homepage": "https://vue-styleguidist.github.io", | ||
"ts-map": "^1.0.3", | ||
"vue-inbrowser-compiler-utils": "^4.39.0" | ||
"vue-inbrowser-compiler-utils": "^4.40.0" | ||
}, | ||
@@ -48,9 +48,9 @@ "devDependencies": { | ||
"globby": "10.0.2", | ||
"vue": "2.6.12", | ||
"vue": "2.6.14", | ||
"vue-class-component": "7.2.6", | ||
"vue-clickaway": "2.2.2", | ||
"vue-property-decorator": "7.3.0", | ||
"vuetify": "2.5.0" | ||
"vuetify": "2.5.3" | ||
}, | ||
"gitHead": "7810971dde12f93a4d7909a4575afd0e621e2566" | ||
"gitHead": "3d21924976c150f869d165e2b92bb6269e54eaa4" | ||
} |
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
304955
6057