UNPKG

@aws-sdk/client-documentation-generator

Version:

[![NPM version](https://img.shields.io/npm/v/@aws-sdk/client-documentation-generator/latest.svg)](https://www.npmjs.com/package/@aws-sdk/client-documentation-generator) [![NPM downloads](https://img.shields.io/npm/dm/@aws-sdk/client-documentation-generato

39 lines (38 loc) 1.72 kB
import { __decorate, __extends } from "tslib"; import { Converter } from "typedoc/dist/lib/converter"; import { Component, ConverterComponent } from "typedoc/dist/lib/converter/components"; import { getRawComment, parseComment } from "typedoc/dist/lib/converter/factories/comment"; var SdkClientCommentUpdatePlugin = (function (_super) { __extends(SdkClientCommentUpdatePlugin, _super); function SdkClientCommentUpdatePlugin() { return _super !== null && _super.apply(this, arguments) || this; } SdkClientCommentUpdatePlugin.prototype.initialize = function () { var _a; this.listenTo(this.owner, (_a = {}, _a[Converter.EVENT_CREATE_DECLARATION] = this.onDeclaration, _a)); }; SdkClientCommentUpdatePlugin.prototype.onDeclaration = function (context, reflection, node) { if (!node) return; var rawComment = getRawComment(node); if (!rawComment) return; var comment = parseComment(this.cleanEmptyCommentLines(rawComment)); reflection.comment = comment; }; SdkClientCommentUpdatePlugin.prototype.cleanEmptyCommentLines = function (comment) { return comment.startsWith("/*") && comment.endsWith("*/") ? comment .split("\n") .filter(function (line) { return line.substr(line.indexOf("*") + 1).trim().length !== 0; }) .join("\n") : comment; }; SdkClientCommentUpdatePlugin = __decorate([ Component({ name: "SdkClientCommentUpdatePlugin" }) ], SdkClientCommentUpdatePlugin); return SdkClientCommentUpdatePlugin; }(ConverterComponent)); export { SdkClientCommentUpdatePlugin };