UNPKG

@webdoc/template-library

Version:

Goodies for @webdoc template packages! See @webdoc/legacy-template for an example!

28 lines (26 loc) 845 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RelationsPlugin = void 0; var _model = require("@webdoc/model"); const RelationsPlugin = { buildRelations(docTree = this.renderer.docTree) { this.relations = new Map(); (0, _model.traverse)(docTree, (doc) => { this.relations.set(doc.path, { ancestry: { classes: Array.from((0, _model.searchExtendedClasses)(doc)), interfaces: Array.from((0, _model.searchImplementedInterfaces)(doc)) } }); }); }, getAncestorClasses(doc) { return this.relations.get(typeof doc === "string" ? doc : doc.path).ancestry.classes; }, getAncestorInterfaces(doc) { return this.relations.get(typeof doc === "string" ? doc : doc.path).ancestry.interfaces; } }; exports.RelationsPlugin = RelationsPlugin;