import { logger } from '../../../../../logger' ; import type { PackageLockDependency , PackageLockOrEntry } from './types' ; export function getLockedDependencies ( entry , depName , currentVersion ) { let res = [ ] ; try { const { dependencies } = entry ; if ( ! dependencies ) { return [ ] ; } if ( dependencies [ depName ] ?. version === currentVersion ) { res . push ( dependencies [ depName ] ) ; } for ( const dependency of Object . values ( dependencies ) ) { res = res . concat ( getLockedDependencies ( dependency , depName , currentVersion ) ) ; } } catch ( err ) { logger . warn ( { err } , 'getLockedDependencies() error' ) ; } return res ; }