import { SourceFile , TypeGuards , ClassDeclaration } from 'ts-simple-ast' ; import { format } from '../helpers' ; export default function ( sourceFiles ) { const classes = [ ] ; const classesAnnotated = [ ] ; function visit ( decorator , stats ) { stats . push ( decorator ) ; } for ( const sourceFile of sourceFiles ) { sourceFile . forEachDescendant ( descendant => { if ( TypeGuards . isClassDeclaration ( descendant ) ) { const classeDeclaration = descendant as ClassDeclaration ; if ( classeDeclaration . getDecorators ( ) . length === 0 ) { visit ( classeDeclaration . getName ( ) , classes ) ; } else { visit ( classeDeclaration . getName ( ) , classesAnnotated ) ; } } } ) ; } return { keys : [ [ 'Classes' , 'Classes (w/ annotation)' , 'Classes (w/o annotation)' ] . join ( '\n' ) ] , values : [ [ format ( classesAnnotated . length + classes . length ) , format ( classesAnnotated . length ) , format ( classes . length ) ] . join ( '\n' ) ] } ; }