build(aio): do not render private classes and members
This commit is contained in:
parent
45e2126273
commit
8c12374c4c
|
@ -47,6 +47,7 @@ module.exports =
|
|||
.processor(require('./processors/filterMemberDocs'))
|
||||
.processor(require('./processors/convertToJson'))
|
||||
.processor(require('./processors/markBarredODocsAsPrivate'))
|
||||
.processor(require('./processors/filterPrivateDocs'))
|
||||
|
||||
// overrides base packageInfo and returns the one for the 'angular/angular' repo.
|
||||
.factory('packageInfo', function() { return require(path.resolve(PROJECT_ROOT, 'package.json')); })
|
||||
|
|
|
@ -0,0 +1,9 @@
|
|||
module.exports = function filterPrivateDocs() {
|
||||
return {
|
||||
$runAfter: ['extra-docs-added'],
|
||||
$runBefore: ['computing-paths'],
|
||||
$process: function(docs) {
|
||||
return docs.filter(function(doc) { return doc.privateExport !== true });
|
||||
}
|
||||
}
|
||||
};
|
|
@ -0,0 +1,40 @@
|
|||
const testPackage = require('../../helpers/test-package');
|
||||
const processorFactory = require('./filterPrivateDocs');
|
||||
const Dgeni = require('dgeni');
|
||||
|
||||
describe('filterPrivateDocs processor', () => {
|
||||
|
||||
it('should be available on the injector', () => {
|
||||
const dgeni = new Dgeni([testPackage('angular.io-package')]);
|
||||
const injector = dgeni.configureInjector();
|
||||
const processor = injector.get('filterPrivateDocs');
|
||||
expect(processor.$process).toBeDefined();
|
||||
});
|
||||
|
||||
it('should run before computing-paths', () => {
|
||||
const processor = processorFactory();
|
||||
expect(processor.$runBefore).toEqual(['computing-paths'])
|
||||
});
|
||||
|
||||
it('should run before computing-paths', () => {
|
||||
const processor = processorFactory();
|
||||
expect(processor.$runAfter).toEqual(['extra-docs-added']);
|
||||
});
|
||||
|
||||
it('should remove docs that are marked as private exports', () => {
|
||||
const processor = processorFactory();
|
||||
const docs = [
|
||||
{ name: 'public1'},
|
||||
{ name: 'ɵPrivate1', privateExport: true },
|
||||
{ name: 'public2'},
|
||||
{ name: 'ɵPrivate2', privateExport: true },
|
||||
{ id: 'other'}
|
||||
];
|
||||
const filteredDocs = processor.$process(docs);
|
||||
expect(filteredDocs).toEqual([
|
||||
{ name: 'public1'},
|
||||
{ name: 'public2'},
|
||||
{ id: 'other'}
|
||||
]);
|
||||
})
|
||||
});
|
Loading…
Reference in New Issue