docs(test_lib/test_injector): fix invalid jsdoc type
chore(doc-gen): capture docs for modules from comments Closes #1258 docs(*): add module description jsdoc tags docs(*): add @public tag to public modules chore(doc-gen): fix overview-dump template The template was referencing an invalid property chore(doc-gen): use `@exportedAs` and `@public` rather than `@publicModule` This commit refactors how we describe components that are re-exported in another module. For example the "public" modules like `angular/angular` and `angular/annotations` are public but they only re-export components from "private" modules. Previously, you must apply the `@publicModule` tag to a component that was to be re-exported. Applying this tag caused the destination module to become public. Now, you specify that a module is public by applying the `@public` tag and then you can "re-export" components to other modules by applying the `@exportedAs` giving the name of the module from which the component will be re-exported. tag. This tag can be used multiple times on a single component, allowing the component to be exported on multiple modules. docs(*): rename `@publicModule` to `@exportedAs` The `@publicModule` dgeni tag has been replaced by the `@exportedAs` dgeni tag on components that are to be re-exported on another module. Closes #1290
This commit is contained in:

committed by
Misko Hevery

parent
82127571b5
commit
b5002fb46b
@ -1,63 +1,28 @@
|
||||
var _ = require('lodash');
|
||||
|
||||
module.exports = function filterPublicDocs(modules) {
|
||||
module.exports = function filterPublicDocs(modules, EXPORT_DOC_TYPES) {
|
||||
return {
|
||||
$runAfter: ['tags-parsed'],
|
||||
$runAfter: ['tags-parsed', 'cloneExportedFromDocs'],
|
||||
$runBefore: ['computing-ids'],
|
||||
docTypes: [],
|
||||
$validate: {
|
||||
docTypes: { presence: true }
|
||||
},
|
||||
$process: function(docs) {
|
||||
|
||||
var extraPublicDocs = [];
|
||||
docTypes = this.docTypes;
|
||||
|
||||
_.forEach(docs, function(doc) {
|
||||
|
||||
if (docTypes.indexOf(doc.docType) === -1 || !doc.publicModule) return;
|
||||
|
||||
var publicModule = modules[doc.publicModule];
|
||||
|
||||
if (!publicModule) {
|
||||
throw new Error('Missing module definition: "' + doc.publicModule + '"\n' +
|
||||
'Referenced in class: "' + doc.moduleDoc.id + '/' + doc.name + '"');
|
||||
} else {
|
||||
|
||||
// Ensure module is marked as public
|
||||
publicModule.isPublic = true;
|
||||
|
||||
// Add a clone of export to its "public" module
|
||||
var publicDoc = _.clone(doc);
|
||||
publicDoc.moduleDoc = publicModule;
|
||||
publicModule.exports.push(publicDoc);
|
||||
extraPublicDocs.push(publicDoc);
|
||||
}
|
||||
});
|
||||
|
||||
// Filter out the documents that are not public
|
||||
docs = _.filter(docs, function(doc) {
|
||||
return _.filter(docs, function(doc) {
|
||||
|
||||
if (doc.docType === 'module') {
|
||||
// doc is a module - is it public?
|
||||
return doc.isPublic;
|
||||
return doc.public;
|
||||
}
|
||||
|
||||
if (docTypes.indexOf(doc.docType) === -1) {
|
||||
if (EXPORT_DOC_TYPES.indexOf(doc.docType) === -1) {
|
||||
// doc is not a type we care about
|
||||
return true;
|
||||
}
|
||||
|
||||
// doc is in a public module
|
||||
return doc.moduleDoc && doc.moduleDoc.isPublic;
|
||||
return doc.moduleDoc && doc.moduleDoc.public;
|
||||
|
||||
});
|
||||
|
||||
docs = docs.concat(extraPublicDocs);
|
||||
|
||||
return docs;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
};
|
Reference in New Issue
Block a user