lib/detect.js
function (config) {
    /**
     * The iterator function, which is called on each component.
     *
     * @param  {string} version    the version of the component
     * @param  {string} component  the name of the component
     * @return {undefined}
     */
    return function (version, component) {
        var dep = config.get('global-dependencies').get(component) || {
            main: '',
            type: '',
            name: '',
            dependencies: {}
        };

        console.log(version, component);

        var componentConfigFile = findComponentConfigFile(config, component);
        var warnings = config.get('warnings');

        var overrides = config.get('overrides');

        if (overrides && overrides[component]) {
            if (overrides[component].dependencies) {
                componentConfigFile.dependencies = overrides[component].dependencies;
            }

            if (overrides[component].main) {
                componentConfigFile.main = overrides[component].main;
            }
        }

        var mains = findMainFiles(config, component, componentConfigFile);
        var fileTypes = _.chain(mains).map(path.extname).unique().value();

        dep.main = mains;
        dep.type = fileTypes;
        dep.name = componentConfigFile.name;

        var depIsExcluded = _.find(config.get('exclude'), function (pattern) {
            return path.join(config.get('bower-directory'), component).match(pattern);
        });

        if (dep.main.length === 0 && !depIsExcluded) {
            // can't find the main file. this config file is useless!
            warnings.push(component + ' was not injected in your file.');
            warnings.push(
                'Please go take a look in "' + path.join(config.get('bower-directory'), component) + '" for the file you need, then manually include it in your file.');

            config.set('warnings', warnings);
            return;
        }

        if (componentConfigFile.dependencies) {
            dep.dependencies = componentConfigFile.dependencies;

            _.each(componentConfigFile.dependencies, gatherInfo(config));
        }

        config.get('global-dependencies').set(component, dep);
    };
}
function (config) {
    /**
     * The iterator function, which is called on each component.
     *
     * @param  {string} version    the version of the component
     * @param  {string} component  the name of the component
     * @return {undefined}
     */
    return function (version, component) {
        var dep = config.get('global-dependencies').get(component) || {
            main: '',
            type: '',
            name: '',
            dependencies: {}
        };

        console.log(version, component);

        var componentConfigFile = findComponentConfigFile(config, component);
        var warnings = config.get('warnings');

        var overrides = config.get('overrides');

        if (overrides && overrides[component]) {
            if (overrides[component].dependencies) {
                componentConfigFile.dependencies = overrides[component].dependencies;
            }

            if (overrides[component].main) {
                componentConfigFile.main = overrides[component].main;
            }
        }

        var mains = findMainFiles(config, component, componentConfigFile);
        var fileTypes = _.chain(mains).map(path.extname).unique().value();

        dep.main = mains;
        dep.type = fileTypes;
        dep.name = componentConfigFile.name;

        var depIsExcluded = _.find(config.get('exclude'), function (pattern) {
            return path.join(config.get('bower-directory'), component).match(pattern);
        });

        if (dep.main.length === 0 && !depIsExcluded) {
            // can't find the main file. this config file is useless!
            warnings.push(component + ' was not injected in your file.');
            warnings.push(
                'Please go take a look in "' + path.join(config.get('bower-directory'), component) + '" for the file you need, then manually include it in your file.');

            config.set('warnings', warnings);
            return;
        }

        if (componentConfigFile.dependencies) {
            dep.dependencies = componentConfigFile.dependencies;

            _.each(componentConfigFile.dependencies, gatherInfo(config));
        }

        config.get('global-dependencies').set(component, dep);
    };
}
function ( config ) { /**
     * The iterator function, which is called on each component.
     *
     * @param  {string} version    the version of the component
     * @param  {string} component  the name of the component
     * @return {undefined}
     */ return function ( version , component ) { var dep = config . get ( 'global-dependencies' ) . get ( component ) || { main : '' , type : '' , name : '' , dependencies : { } } ; console . log ( version , component ) ; var componentConfigFile = findComponentConfigFile ( config , component ) ; var warnings = config . get ( 'warnings' ) ; var overrides = config . get ( 'overrides' ) ; if ( overrides && overrides [ component ] ) { if ( overrides [ component ] . dependencies ) { componentConfigFile . dependencies = overrides [ component ] . dependencies ; } if ( overrides [ component ] . main ) { componentConfigFile . main = overrides [ component ] . main ; } } var mains = findMainFiles ( config , component , componentConfigFile ) ; var fileTypes = _ . chain ( mains ) . map ( path . extname ) . unique ( ) . value ( ) ; dep . main = mains ; dep . type = fileTypes ; dep . name = componentConfigFile . name ; var depIsExcluded = _ . find ( config . get ( 'exclude' ) , function ( pattern ) { return path . join ( config . get ( 'bower-directory' ) , component ) . match ( pattern ) ; } ) ; if ( dep . main . length === 0 && ! depIsExcluded ) { // can't find the main file. this config file is useless! warnings . push ( component + ' was not injected in your file.' ) ; warnings . push ( 'Please go take a look in "' + path . join ( config . get ( 'bower-directory' ) , component ) + '" for the file you need, then manually include it in your file.' ) ; config . set ( 'warnings' , warnings ) ; return ; } if ( componentConfigFile . dependencies ) { dep . dependencies = componentConfigFile . dependencies ; _ . each ( componentConfigFile . dependencies , gatherInfo ( config ) ) ; } config . get ( 'global-dependencies' ) . set ( component , dep ) ; } ; }
Store the information our prioritizer will need to determine rank.

@param  {object} config   the global configuration object
@return {function} the iterator function, called on every component
Store the information our prioritizer will need to determine rank .