Skip to content

Resolves the location of a node package given a path

License

Notifications You must be signed in to change notification settings

stjordanis/resolve-package

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

28 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

snyk-resolve

Finds the filename for a given package name and starting directory. This is used to resolve packages in situations like npm@3 and deduped packages.

Supports both async (via promises) and sync methods of looking up.

Usage

var resolve = require('snyk-resolve');

// async (promise based)
resolve('foo', process.cwd()).then(function (dir) {
  // assuming that `foo` lived in the root of your drive
  console.assert(dir === '/node_modules/foo');
});

// sync
var dir = resolve.sync('bar', process.cwd());
// throws Error('package not found bar')

See tests for more examples.

Supports

  • npm@2 directory structure
  • npm@3 directory structure
  • deduped modules
  • scoped modules

About

Resolves the location of a node package given a path

Resources

License

Code of conduct

Security policy

Stars

Watchers

Forks

Packages

No packages published

Languages

  • HTML 52.2%
  • JavaScript 32.6%
  • CSS 15.2%