vue-docgen-api
Advanced tools
Comparing version 4.44.23 to 4.45.0
@@ -18,3 +18,2 @@ "use strict"; | ||
var matchRecursiveRegexp_1 = __importDefault(require("./matchRecursiveRegexp")); | ||
var DOCLET_PATTERN = /^(?:\s+)?@(\w+)(?:$|\s((?:[^](?!^(?:\s+)?@\w))*))/gim; | ||
function getParamInfo(content, hasName) { | ||
@@ -56,3 +55,9 @@ content = content || ''; | ||
} | ||
/** | ||
* This is used to ignore the name tag if it does not make sense | ||
*/ | ||
var UNNAMED_TAG_TITLES = ['returns', 'throws', 'type']; | ||
/** | ||
* For those arguments we will try and parse type of the content | ||
*/ | ||
var TYPED_TAG_TITLES = [ | ||
@@ -70,4 +75,13 @@ 'param', | ||
]; | ||
/** | ||
* These tags don't have content and we push them as 'access' | ||
*/ | ||
var ACCESS_TAG_TITLES = ['private', 'public']; | ||
/** | ||
* If one of these tags is placed above content | ||
* the content is still taken as the description | ||
* they are usually placed at the top of the docblock | ||
*/ | ||
var PREFIX_TAG_TITLES = ['slot', 'ignore']; | ||
/** | ||
* Given a string, this functions returns an object with | ||
@@ -79,19 +93,36 @@ * two keys: | ||
function getDocblockTags(str) { | ||
var DOCLET_PATTERN = /^(?:\s+)?@(\w+) ?(.+)?/; | ||
var tags = []; | ||
var match = DOCLET_PATTERN.exec(str); | ||
for (; match; match = DOCLET_PATTERN.exec(str)) { | ||
var title = match[1]; | ||
if (TYPED_TAG_TITLES.indexOf(title) > -1) { | ||
tags.push(__assign({ title: title }, getParamInfo(match[2], UNNAMED_TAG_TITLES.indexOf(title) < 0))); | ||
var lines = str.split('\n').reverse(); | ||
var accNonTagLines = ''; | ||
lines.forEach(function (line) { | ||
var _a = DOCLET_PATTERN.exec(line) || [], title = _a[1], tagContents = _a[2]; | ||
if (!title) { | ||
accNonTagLines = line + '\n' + accNonTagLines; | ||
return; | ||
} | ||
if (TYPED_TAG_TITLES.includes(title)) { | ||
tags.push(__assign({ title: title }, getParamInfo(tagContents, !UNNAMED_TAG_TITLES.includes(title)))); | ||
} | ||
else if (ACCESS_TAG_TITLES.indexOf(title) > -1) { | ||
tags.push({ title: 'access', content: title }); | ||
return; | ||
} | ||
else if (PREFIX_TAG_TITLES.indexOf(title) > -1) { | ||
tags.push({ title: title, content: tagContents !== null && tagContents !== void 0 ? tagContents : true }); | ||
return; | ||
} | ||
else { | ||
tags.push({ title: title, content: match[2] || true }); | ||
var content = tagContents | ||
? (tagContents + '\n' + accNonTagLines).trim() | ||
: accNonTagLines | ||
? accNonTagLines.trim() | ||
: true; | ||
tags.push({ title: title, content: content }); | ||
} | ||
} | ||
var description = str.replace(DOCLET_PATTERN, '').trim(); | ||
return { description: description, tags: tags }; | ||
accNonTagLines = ''; | ||
}); | ||
var description = accNonTagLines.trim().length ? accNonTagLines.trim() : undefined; | ||
return { description: description, tags: tags.reverse() }; | ||
} | ||
exports.default = getDocblockTags; |
{ | ||
"name": "vue-docgen-api", | ||
"version": "4.44.23", | ||
"version": "4.45.0", | ||
"description": "Toolbox to extract information from Vue component files for documentation generation purposes.", | ||
@@ -46,3 +46,5 @@ "homepage": "https://vue-styleguidist.github.io", | ||
"@test-vue-docgen/mixins": "^4.44.15", | ||
"@types/dedent": "0.7.0", | ||
"@types/pug": "2.0.6", | ||
"dedent": "0.7.0", | ||
"globby": "10.0.2", | ||
@@ -55,3 +57,3 @@ "vue": "2.6.14", | ||
}, | ||
"gitHead": "c67dce1ee82a08d320f00d8d2db8fc7255c7a02d" | ||
"gitHead": "a668a816ea87559cf3cd89da5bf35c257c7da743" | ||
} |
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
343929
6777
10