chore(doc-gen): include exported variable declaration in public docs
This commit is contained in:
parent
8a10edec01
commit
0f20c39f42
|
@ -26,6 +26,15 @@ module.exports = new Package('angular', [jsdocPackage, nunjucksPackage])
|
|||
.factory(require('./readers/atScript'))
|
||||
.factory(require('./readers/ngdoc'))
|
||||
|
||||
.factory('EXPORT_DOC_TYPES', function() {
|
||||
return [
|
||||
'class',
|
||||
'function',
|
||||
'var',
|
||||
'const'
|
||||
];
|
||||
})
|
||||
|
||||
|
||||
// Register the processors
|
||||
.processor(require('./processors/generateDocsFromComments'))
|
||||
|
@ -82,15 +91,10 @@ module.exports = new Package('angular', [jsdocPackage, nunjucksPackage])
|
|||
|
||||
|
||||
// Configure ids and paths
|
||||
.config(function(computeIdsProcessor, computePathsProcessor) {
|
||||
.config(function(computeIdsProcessor, computePathsProcessor, EXPORT_DOC_TYPES) {
|
||||
|
||||
computeIdsProcessor.idTemplates.push({
|
||||
docTypes: [
|
||||
'class',
|
||||
'function',
|
||||
'NAMED_EXPORT',
|
||||
'VARIABLE_STATEMENT'
|
||||
],
|
||||
docTypes: EXPORT_DOC_TYPES,
|
||||
idTemplate: '${moduleDoc.id}.${name}',
|
||||
getAliases: function(doc) { return [doc.id]; }
|
||||
});
|
||||
|
@ -123,12 +127,7 @@ module.exports = new Package('angular', [jsdocPackage, nunjucksPackage])
|
|||
});
|
||||
|
||||
computePathsProcessor.pathTemplates.push({
|
||||
docTypes: [
|
||||
'class',
|
||||
'function',
|
||||
'NAMED_EXPORT',
|
||||
'VARIABLE_STATEMENT'
|
||||
],
|
||||
docTypes: EXPORT_DOC_TYPES,
|
||||
pathTemplate: '${moduleDoc.path}/${name}',
|
||||
outputPathTemplate: MODULES_DOCS_PATH + '/${path}/index.html'
|
||||
});
|
||||
|
|
|
@ -24,17 +24,11 @@ module.exports = function ExportTreeVisitor(ParseTreeVisitor, log) {
|
|||
this.currentExport = null;
|
||||
},
|
||||
|
||||
visitVariableStatement: function(tree) {
|
||||
if ( this.currentExport ) {
|
||||
this.updateExport(tree);
|
||||
this.currentExport.name = "VARIABLE_STATEMENT";
|
||||
}
|
||||
},
|
||||
|
||||
visitVariableDeclaration: function(tree) {
|
||||
if ( this.currentExport ) {
|
||||
this.updateExport(tree);
|
||||
this.currentExport.name = tree.lvalue;
|
||||
this.currentExport.docType = 'var';
|
||||
this.currentExport.name = tree.lvalue.identifierToken.value;
|
||||
this.currentExport.variableDeclaration = tree;
|
||||
}
|
||||
},
|
||||
|
|
|
@ -10,8 +10,9 @@ module.exports = new Package('angular-public', [basePackage])
|
|||
parseTagsProcessor.tagDefinitions.push({ name: 'publicModule' });
|
||||
})
|
||||
|
||||
.config(function(processClassDocs) {
|
||||
.config(function(processClassDocs, filterPublicDocs, EXPORT_DOC_TYPES) {
|
||||
processClassDocs.ignorePrivateMembers = true;
|
||||
filterPublicDocs.docTypes = EXPORT_DOC_TYPES;
|
||||
})
|
||||
|
||||
// Configure file writing
|
||||
|
|
|
@ -4,16 +4,20 @@ module.exports = function filterPublicDocs(modules) {
|
|||
return {
|
||||
$runAfter: ['tags-parsed'],
|
||||
$runBefore: ['computing-ids'],
|
||||
docTypes: [],
|
||||
$validate: {
|
||||
docTypes: { presence: true }
|
||||
},
|
||||
$process: function(docs) {
|
||||
|
||||
//console.log('filterPublicDocs', Object.keys(modules));
|
||||
docTypes = this.docTypes;
|
||||
|
||||
|
||||
docs = _.filter(docs, function(doc) {
|
||||
if (doc.docType !== 'class') return true;
|
||||
|
||||
if (docTypes.indexOf(doc.docType) === -1) return true;
|
||||
if (!doc.publicModule) return false;
|
||||
|
||||
//console.log('CLASS:', doc.name, doc.moduleDoc.id);
|
||||
updateModule(doc);
|
||||
|
||||
return true;
|
||||
|
@ -39,8 +43,6 @@ module.exports = function filterPublicDocs(modules) {
|
|||
|
||||
publicModule.isPublic = true;
|
||||
|
||||
//console.log('UPDATE CLASS', classDoc.id, originalModule.id, publicModule.id);
|
||||
|
||||
_.remove(classDoc.moduleDoc.exports, function(doc) { return doc === classDoc; });
|
||||
classDoc.moduleDoc = publicModule;
|
||||
publicModule.exports.push(classDoc);
|
||||
|
|
Loading…
Reference in New Issue