JSPM

snyk-resolve

1.1.0
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 65828
  • Score
    100M100P100Q165159F
  • License Apache-2.0

Resolves the location of a node package given a path

Package Exports

  • snyk-resolve

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (snyk-resolve) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

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