index.js
function _getStatsAndParts (tp, cb){
      fs.stat(tp.absPath, function(err, stats){
        if (err) return cb(err);
        if (stats.isDirectory) {
          glob(path.join(tp.absPath, '**/*'), function(err, dirAbsPaths){
            if (err) return cb(err);
            async.map(dirAbsPaths, fs.stat, function(err, dirAbsPathStats){
              if (err) return cb(err);
              var parts = dirAbsPathStats
                .map(function(x, i){ return {stats: x, absPath: dirAbsPaths[i]}; })
                .filter(function(x){ return x.stats.isFile(); });
              cb(null, stats, parts);
            });
          });
        } else {
          return cb(null, stats);
        }
      });
    }
function _getStatsAndParts (tp, cb){
      fs.stat(tp.absPath, function(err, stats){
        if (err) return cb(err);
        if (stats.isDirectory) {
          glob(path.join(tp.absPath, '**/*'), function(err, dirAbsPaths){
            if (err) return cb(err);
            async.map(dirAbsPaths, fs.stat, function(err, dirAbsPathStats){
              if (err) return cb(err);
              var parts = dirAbsPathStats
                .map(function(x, i){ return {stats: x, absPath: dirAbsPaths[i]}; })
                .filter(function(x){ return x.stats.isFile(); });
              cb(null, stats, parts);
            });
          });
        } else {
          return cb(null, stats);
        }
      });
    }
function _getStatsAndParts ( tp , cb ) { fs . stat ( tp . absPath , function ( err , stats ) { if ( err ) return cb ( err ) ; if ( stats . isDirectory ) { glob ( path . join ( tp . absPath , '**/*' ) , function ( err , dirAbsPaths ) { if ( err ) return cb ( err ) ; async . map ( dirAbsPaths , fs . stat , function ( err , dirAbsPathStats ) { if ( err ) return cb ( err ) ; var parts = dirAbsPathStats . map ( function ( x , i ) { return { stats : x , absPath : dirAbsPaths [ i ] } ; } ) . filter ( function ( x ) { return x . stats . isFile ( ) ; } ) ; cb ( null , stats , parts ) ; } ) ; } ) ; } else { return cb ( null , stats ) ; } } ) ; }
transform abs paths to resources and make source each resource has a unique @id
transform abs paths to resources and make source each resource has a unique