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');
resolve('foo', process.cwd()).then(function (dir) {
console.assert(dir === '/node_modules/foo');
});
var dir = resolve.sync('bar', process.cwd());
See tests for more examples.
Supports
- npm@2 directory structure
- npm@3 directory structure
- deduped modules
- scoped modules