const npa = require('npm-package-arg')
const dat = require('./fetchers/dat')
const git = require('./fetchers/git')
const local = require('./fetchers/local')
const remote = require('./fetchers/remote')
const registry = require('./fetchers/registry')

module.exports = (name, spec) => {
  var result
  try {
    if (spec.startsWith('dat:')) {
      result = {
        type: 'dat',
        fetchSpec: spec
      }
    } else {
      result = npa.resolve(name, spec, process.cwd())
    }
  } catch (e) { throw new Error(e) }

  switch (result.type) {
    // type git
    case 'dat':
      process.stdout.write(
        'Using dat as deps is an experimental feature.\n' +
        'It can be changed at any time.\n\n'
      )
      return dat(name, result.fetchSpec, result)
    // type git
    case 'git':
      return git(name, result.fetchSpec, result)
    // type remote
    case 'remote':
      return remote(name, result.fetchSpec, result)
    // type local
    case 'file':
    case 'directory':
      return local(name, result.fetchSpec, result)
    // type registry
    case 'tag':
    case 'range':
    case 'version':
    default:
      return registry(name, result.fetchSpec, result)
  }
}

@@ -427,39 +427,74 @@
     
-result = npa.resolve(name, spec
+const pkg = spec ? %60$%7Bname%7D@$%7Bspec%7D%60 : name%0A      result = npa(pkg
 , pr

install path directly