angular/aio/tools/transforms/angular-api-package/processors/processBlocks.js
Jeremy Elbourn a49ee46dae docs(docs-infra): add support for block syntax to dgeni (#52123)
This adds the new block syntax to dgeni docs pipeline, mainly copying
the way that elements (`<ng-content>` etc.) work. Actual doc content is
just a placeholder for this PR.

PR Close #52123
2023-10-10 13:55:04 -07:00

24 lines
655 B
JavaScript

const path = require('canonical-path');
module.exports = function processBlocks() {
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 'block' doc to its containing module/package.
if (doc.docType === 'block') {
doc.moduleDoc = moduleDocs[path.dirname(doc.fileInfo.relativePath)];
doc.moduleDoc.exports.push(doc);
}
});
}
};
};