lib/bower.js
function _eachDependencies( packageName, bowerJson, packageFunc, options, packageList, firstLevel, dotBowerJson ){
        bowerJson = bowerJson || {};
        dotBowerJson = dotBowerJson || {};
        var dependenciesPackageName,
            dependencies = bowerJson.dependencies || dotBowerJson.dependencies || {};

        packageFunc(packageName, bowerJson, options, firstLevel, dotBowerJson);

        //Find dependencies
        for (dependenciesPackageName in dependencies)
            if ( dependencies.hasOwnProperty(dependenciesPackageName) ){
                //If the package already has been check => continue
                if (packageList[ dependenciesPackageName ])
                  continue;
                packageList[ dependenciesPackageName ] = true;

                //Read the dependences of the package
                _eachDependencies(
                    dependenciesPackageName,
                    common.readJSONFile(paths.bower_components + dependenciesPackageName + '/bower.json'),
                    packageFunc,
                    options,
                    packageList,
                    false,
                    common.readJSONFile(paths.bower_components + dependenciesPackageName + '/.bower.json')
                );
        }
    }
function _eachDependencies( packageName, bowerJson, packageFunc, options, packageList, firstLevel, dotBowerJson ){
        bowerJson = bowerJson || {};
        dotBowerJson = dotBowerJson || {};
        var dependenciesPackageName,
            dependencies = bowerJson.dependencies || dotBowerJson.dependencies || {};

        packageFunc(packageName, bowerJson, options, firstLevel, dotBowerJson);

        //Find dependencies
        for (dependenciesPackageName in dependencies)
            if ( dependencies.hasOwnProperty(dependenciesPackageName) ){
                //If the package already has been check => continue
                if (packageList[ dependenciesPackageName ])
                  continue;
                packageList[ dependenciesPackageName ] = true;

                //Read the dependences of the package
                _eachDependencies(
                    dependenciesPackageName,
                    common.readJSONFile(paths.bower_components + dependenciesPackageName + '/bower.json'),
                    packageFunc,
                    options,
                    packageList,
                    false,
                    common.readJSONFile(paths.bower_components + dependenciesPackageName + '/.bower.json')
                );
        }
    }
_eachDependencies( bwr, packageFunc, options, packageList, firstLevel )
Internal version with additional parametre
packageList = [PACKAGENAME] of boolean