lib/index.js
function getDepInfo (dep, currFile, customDepResolve) {
  let depResolve

  if (!customDepResolve) {
    depResolve = defaultDepResolve
  } else {
    depResolve = (dep, currFile) => {
      // parse defaultResolve as third param
      return customDepResolve(dep, currFile, defaultDepResolve)
    }
  }

  let currType = getParseType(currFile)
  let type = getParseType(dep) || currType
  let info = {
    parent: currFile,     // parent file path
    type: type,           // current file type (js/css)
    raw: dep,             // raw dependency name (require('./xxx') => './xxx')
    name: null,           // formated dependency name ('~@alife/xxx' => '@alife/xxx')
    module: null,         // module name (only external module)
    file: null            // resolved file name (only relative file)
  }

  info.name = depResolve(dep, currFile)

  if (!info.name.startsWith('.')) {
    if (info.name.startsWith('@')) {
      info.module = info.name.split('/', 2).join('/')
    } else {
      info.module = info.name.split('/', 1)[0]
    }
  } else {
    info.file = fileResolve(info.name, currFile)

    if (!info.file) {
      throw new ResolveError(info.name, currFile)
    }
  }

  return info
}
function getDepInfo (dep, currFile, customDepResolve) {
  let depResolve

  if (!customDepResolve) {
    depResolve = defaultDepResolve
  } else {
    depResolve = (dep, currFile) => {
      // parse defaultResolve as third param
      return customDepResolve(dep, currFile, defaultDepResolve)
    }
  }

  let currType = getParseType(currFile)
  let type = getParseType(dep) || currType
  let info = {
    parent: currFile,     // parent file path
    type: type,           // current file type (js/css)
    raw: dep,             // raw dependency name (require('./xxx') => './xxx')
    name: null,           // formated dependency name ('~@alife/xxx' => '@alife/xxx')
    module: null,         // module name (only external module)
    file: null            // resolved file name (only relative file)
  }

  info.name = depResolve(dep, currFile)

  if (!info.name.startsWith('.')) {
    if (info.name.startsWith('@')) {
      info.module = info.name.split('/', 2).join('/')
    } else {
      info.module = info.name.split('/', 1)[0]
    }
  } else {
    info.file = fileResolve(info.name, currFile)

    if (!info.file) {
      throw new ResolveError(info.name, currFile)
    }
  }

  return info
}
function getDepInfo ( dep , currFile , customDepResolve ) { let depResolve if ( ! customDepResolve ) { depResolve = defaultDepResolve } else { depResolve = ( dep , currFile ) => { // parse defaultResolve as third param return customDepResolve ( dep , currFile , defaultDepResolve ) } } let currType = getParseType ( currFile ) let type = getParseType ( dep ) || currType let info = { parent : currFile , // parent file path type : type , // current file type (js/css) raw : dep , // raw dependency name (require('./xxx') => './xxx') name : null , // formated dependency name ('~@alife/xxx' => '@alife/xxx') module : null , // module name (only external module) file : null // resolved file name (only relative file) } info . name = depResolve ( dep , currFile ) if ( ! info . name . startsWith ( '.' ) ) { if ( info . name . startsWith ( '@' ) ) { info . module = info . name . split ( '/' , 2 ) . join ( '/' ) } else { info . module = info . name . split ( '/' , 1 ) [ 0 ] } } else { info . file = fileResolve ( info . name , currFile ) if ( ! info . file ) { throw new ResolveError ( info . name , currFile ) } } return info }
get dependency info
@param  {String} dep  dependency
@param  {String} currFile current file
@param  {Function} customDepResolve custom dep resolve function
@return {Object}
get dependency info