Pete Bacon Darwin 62aca30286 feat(docs-infra): add support for "special elements" (#41299)
This commit adds support for generating pages that document
special Angular elements, such as `ng-content` and `ng-template`,
which have special behavior in Angular but are not directives nor
components.

Resolves #41273

PR Close #41299
2021-06-16 14:01:16 -07:00

25 lines
668 B
JavaScript

const path = require('canonical-path');
module.exports = function processSpecialElements() {
return {
$runAfter: ['tags-extracted'],
$runBefore: ['collectPackageContentDocsProcessor'],
$process(docs) {
const moduleDocs = {};
docs.forEach(doc => {
if (doc.docType === 'module') {
moduleDocs[doc.id] = doc;
}
});
docs.forEach(doc => {
// Wire up each 'element' doc to its containing module/package.
if (doc.docType === 'element') {
doc.moduleDoc = moduleDocs[path.dirname(doc.fileInfo.relativePath)];
doc.moduleDoc.exports.push(doc);
}
});
}
};
};