typedoc-plugin-typescript-declaration
Advanced tools
Comparing version 0.1.17 to 0.1.18
@@ -162,2 +162,37 @@ 'use strict'; | ||
var OmitTagsPlugin_1; | ||
let OmitTagsPlugin = OmitTagsPlugin_1 = class OmitTagsPlugin extends components$1.ConverterComponent { | ||
initialize() { | ||
this.listenTo(this.owner, { | ||
[converter.Converter.EVENT_RESOLVE_BEGIN]: this.onBeginResolve, | ||
}); | ||
} | ||
onBeginResolve(context) { | ||
if (this._omitTags) { | ||
const project = context.project; | ||
OmitTagsPlugin_1.removeTags(Object.values(project.reflections), this._omitTags); | ||
} | ||
} | ||
static removeTags(reflections, tags) { | ||
reflections.forEach(r => { | ||
var _a; | ||
if ((_a = r.comment) === null || _a === void 0 ? void 0 : _a.tags) { | ||
const tagsToKeep = r.comment.tags | ||
.filter(t => !tags.find(o => o === t.tagName)); | ||
r.comment.tags = tagsToKeep; | ||
} | ||
}); | ||
} | ||
}; | ||
__decorate([ | ||
utils.Option({ | ||
name: 'omitTag', | ||
type: declaration.ParameterType.Array, | ||
help: 'A list of tags to remove from the generated output', | ||
}) | ||
], OmitTagsPlugin.prototype, "_omitTags", void 0); | ||
OmitTagsPlugin = OmitTagsPlugin_1 = __decorate([ | ||
components.Component({ name: 'omit-tags' }) | ||
], OmitTagsPlugin); | ||
function join(delimiter, ...values) { | ||
@@ -171,7 +206,6 @@ return values.filter(v => v !== null && v !== undefined && v !== '') | ||
var _a; | ||
const lines = []; | ||
let lines = []; | ||
const sections = []; | ||
const comment = node.comment; | ||
if (comment) { | ||
lines.push('/**'); | ||
if (comment.shortText) { | ||
@@ -208,5 +242,9 @@ sections.push(this.renderMultilineComment('', comment.shortText)); | ||
} | ||
lines.push(sections.join('\n *\n')); | ||
lines.push(' */'); | ||
if (sections.length) { | ||
lines.push(sections.join('\n *\n')); | ||
} | ||
} | ||
if (lines.length) { | ||
lines = ['/**', ...lines, ' */']; | ||
} | ||
return lines.join('\n'); | ||
@@ -295,2 +333,7 @@ } | ||
} | ||
pushIfTruthy(array, value) { | ||
if (value) { | ||
array.push(value); | ||
} | ||
} | ||
} | ||
@@ -414,3 +457,3 @@ | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -437,3 +480,3 @@ const method = node; | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -467,3 +510,3 @@ const method = node; | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -552,3 +595,3 @@ const declarationNode = node; | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -597,3 +640,3 @@ const member = node; | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -620,3 +663,3 @@ const method = node; | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -656,3 +699,3 @@ const method = node; | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -719,3 +762,3 @@ const declarationNode = node; | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -745,3 +788,3 @@ const member = node; | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -775,3 +818,3 @@ const method = node; | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -804,3 +847,3 @@ const declarationNode = node; | ||
if (node.comment) { | ||
lines.push(this.renderComment(node)); | ||
this.pushIfTruthy(lines, this.renderComment(node)); | ||
} | ||
@@ -1146,2 +1189,3 @@ const member = node; | ||
app.converter.addComponent('keyof-comment', new KeyOfCommentPlugin(app.converter)); | ||
app.converter.addComponent('omit-tags', new OmitTagsPlugin(app.converter)); | ||
const declarationPlugin = app.renderer.addComponent('typescript-declaration', new TypeScriptDeclarationPlugin(app.renderer)); | ||
@@ -1148,0 +1192,0 @@ // work-around for typedoc options not being read: https://github.com/TypeStrong/typedoc/issues/1165 |
{ | ||
"name": "typedoc-plugin-typescript-declaration", | ||
"version": "0.1.17", | ||
"version": "0.1.18", | ||
"description": "Typedoc plugin to render to typescript declaration file", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
51786
1157