@ng-doc/builder
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
37 lines • 1.48 kB
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.apiAction = apiAction;
const core_1 = require("@ng-doc/core");
const ts_morph_1 = require("ts-morph");
const helpers_1 = require("../../../helpers");
const index_1 = require("../../../index");
/**
*
* @param declarationPath
*/
function apiAction(declarationPath) {
return (entry) => {
const project = entry.sourceFile.getProject();
const declaration = (0, helpers_1.getDeclarationByPath)(project, declarationPath);
const declarationName = declaration.getName() || '[Unknown]';
const kindName = (0, core_1.kebabCase)(declaration.getKindName());
const output = (0, index_1.renderTemplate)(`./api/${kindName}.html.nunj`, {
context: {
declaration,
docNode: ts_morph_1.Node.isVariableDeclaration(declaration)
? declaration.getVariableStatement()
: declaration,
hideDescription: true,
hideSeeAlso: true,
hideUsageNotes: true,
hideRemarks: true,
hideExamples: true,
},
});
return {
output: (0, helpers_1.minifyHtml)(`<ng-doc-keyword-scope id="${declarationName}" title="${declarationName}">${output}</ng-doc-keyword-scope>`),
dependencies: [declaration.getSourceFile().getFilePath()],
};
};
}
//# sourceMappingURL=api.action.js.map
;