import * as fs from "fs" ; import * as path from "path" ; export namespace SourceFinder { export async function find ( directory ) { const output = [ ] ; await gather ( output , directory ) ; return output ; } async function gather ( output , directory ) { const children = await fs . promises . readdir ( directory ) ; for ( const file of children ) { const current = `${ directory }${ path . sep }${ file }` ; const stats = await fs . promises . lstat ( current ) ; if ( stats . isDirectory ( ) === true ) { await gather ( output , current ) ; continue ; } else if ( file . substr ( - 3 ) !== ".ts" || file . substr ( - 5 ) === ".d.ts" ) continue ; output . push ( current ) ; } } }