Package Exports
- resolve-dep
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 (resolve-dep) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
resolve-dep 
Return an array of resolved filepaths for require-able local or named npm modules. Wildcard (glob) patterns may be used.
Similar in concept to matchdep and load-grunt-tasks, but returns an array of fully resolved file paths to any local modules or npm modules listed in package.json dependencies.
Install
Install with npm:
npm i resolve-dep --save-dev
Usage
var resolve = require('resolve-dep');
resolve( patterns, options )
API
###resolveDep
Resolve both npm packages and local modules by:
patterns
{Array|String}: Glob patterns for files or npm modules.options
{Object}returns: {Array}
- Attempting to expand glob patterns to local modules, then
- Attempting to match glob patterns to deps in package.json
Examples:
// file path
resolve('foo/bar.js');
// glob patterns
resolve('foo/*.js');
// named npm module (installed in node_modules)
resolve('chai');
// combination
resolve(['chai', 'foo/*.js']);
###.npm
Resolve npm packages in node_modules by matching glob patterns to deps in package.json. NPM modules will only be resolved if they are defined in one of the "dependencies" fields in package.json.
patterns
{Array|String}options
{Object}- returns: {Array}
// resolve npm modules only
resolve.npm(['chai', 'lodash']);
###.local
Resolve local modules by expanding glob patterns to file paths.
patterns
{Array|String}options
{Object}- returns: {Array}
// resolve local modules only
resolve.local(['a/*.js', 'b/*.json']);
Options
Type: object
The options object supports any globby options, as well as the following:
patterns
Type: string|array
The file path, glob pattern, or name of the npm module to resolve.
File paths
resolve('templates/*.hbs')
resolve(['a/*.hbs', 'b/*.hbs'])
NPM modules
resolve('*')
resolve(['grunt-*', 'gulp-*'])
resolve(['grunt-*', 'gulp-*'], {type: 'devDependencies'})
resolve(['lodash', 'assemble']);
options.config
Type: Object
Default value: package.json
Pass an explicit config object to use instead of package.json.
options.type
Type: String|Array
Default value: all
Valid values: all|dependencies|devDepencies|peerDependencies
Any valid npm dependency field that can be used in package.json is a valid value for this option.
Examples:
// resolve chai and mocha, if in devDependencies, otherwise an empty array
resolve(['chai', 'mocha'], {type: 'devDependencies'});
// resolve lodash if in dependencies, otherwise an empty array
resolve(['lodash'], {type: 'dependencies'});
// all dependencies
resolve(['*'], {type: 'dependencies'});
// all dependencies, devDependencies and peerDependencies
resolve('*');
Author
Jon Schlinkert
License
Copyright (c) 2014 Jon Schlinkert, contributors.
Released under the MIT license
This file was generated by verb-cli on August 22, 2014.