declare const Reflect ; export const getAnnotationsFromModule = module => { if ( Reflect && Reflect . getMetadata && Reflect . getMetadata ( 'annotations' , module ) ) { return Reflect . getMetadata ( 'annotations' , module ) [ 0 ] ; } else if ( module . __annotations__ ) { return module . __annotations__ [ 0 ] ; } else if ( module . decorators && module . decorators [ 0 ] . args ) { return module . decorators [ 0 ] . args [ 0 ] ; } else { return { } ; } } ; export const getImportedModulesFromModule = module => { return ( getAnnotationsFromModule ( module ) . imports || [ ] ) . reduce ( ( flattened , importedModule ) => flattened . concat ( importedModule ) . concat ( getImportedModulesFromModule ( importedModule ) ) , [ ] ) . filter ( p => typeof p === 'function' ) ; } ; export const getComponentsFromModule = module => { return ( getAnnotationsFromModule ( module ) . declarations || [ ] ) . filter ( p => typeof p === 'function' ) . map ( Component => Object . assign ( Component , { __m : module } ) ) ; } ; export const getServicesFromModule = module => { return ( getAnnotationsFromModule ( module ) . providers || [ ] ) . filter ( p => typeof p === 'function' ) . map ( Service => Object . assign ( Service , { __m : module } ) ) ; } ; export function getAllObjectsInAngularApplication ( getAllFromModule , module ) { const allInModule = getAllFromModule ( module ) ; const recursiveImports = getImportedModulesFromModule ( module ) ; const allInImports = recursiveImports . reduce ( ( all , importedModule ) => all . concat ( getAllFromModule ( importedModule ) ) , [ ] ) ; return allInModule . concat ( allInImports ) ; }