{"name":"resolve-modules","description":"Resolves local and global npm modules that match specified patterns, and returns a configuration object for each resolved module.","version":"0.4.2","homepage":"https://github.com/jonschlinkert/resolve-modules","author":{"name":"Jon Schlinkert","url":"https://github.com/jonschlinkert"},"repository":{"type":"git","url":"git+https://github.com/jonschlinkert/resolve-modules.git"},"bugs":{"url":"https://github.com/jonschlinkert/resolve-modules/issues"},"license":"MIT","files":["index.js","lib"],"main":"index.js","engines":{"node":">=0.10.0"},"scripts":{"test":"mocha"},"dependencies":{"component-emitter":"^1.2.1","define-property":"^0.2.5","extend-shallow":"^2.0.1","fs-exists-sync":"^0.1.0","kind-of":"^3.0.3","lazy-cache":"^2.0.1","map-cache":"^0.2.2","micromatch":"^2.3.8","npm-paths":"^0.1.3"},"devDependencies":{"gulp":"^3.9.1","gulp-eslint":"^2.0.0","gulp-format-md":"^0.1.7","gulp-istanbul":"^0.10.3","gulp-mocha":"^2.2.0","gulp-unused":"^0.1.2","mocha":"^2.4.5"},"keywords":["config","configfile","env","filepath","find","generator","glob","global","match","module","modules","npm","pattern","resolve"],"verb":{"toc":false,"layout":"default","tasks":["readme"],"plugins":["gulp-format-md"],"related":{"list":["global-modules","global-paths","global-prefix","npm-paths"]},"reflinks":["matchers","micromatch","npm-paths","verb","vinyl"],"lint":{"reflinks":true}},"gitHead":"5617b666edbdc1ca98854c99effa00d83d066bd1","_id":"resolve-modules@0.4.2","_shasum":"481b71c92f6931a7288df2b2d942b9c8de6e3814","_from":".","_npmVersion":"3.6.0","_nodeVersion":"5.5.0","_npmUser":{"name":"jonschlinkert","email":"github@sellside.com"},"maintainers":[{"name":"jonschlinkert","email":"github@sellside.com"}],"dist":{"shasum":"481b71c92f6931a7288df2b2d942b9c8de6e3814","tarball":"http://registry-npm.ywwl.com/resolve-modules/download/resolve-modules-0.4.2.tgz","integrity":"sha512-6MgMOlYPjKlla3OiV6v1fmZJOh1yCBVIxplB65MW7q+IY3hXoF0+MY1MtzHIlO7OlKndP/TxTrAGMbz+FMvLZA==","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBw9VuI22VW47vBugXB3WpXU4+eHddVrWpSa9Z+/fhu+AiAd9fePAs7h17wyL2IAP6WNeHZT1CujqVOHTiPPykIJSA=="}],"size":6795,"noattachment":false,"key":"/resolve-modules/-/resolve-modules-0.4.2.tgz"},"_npmOperationalInternal":{"host":"packages-12-west.internal.npmjs.com","tmp":"tmp/resolve-modules-0.4.2.tgz_1463453385821_0.03356729820370674"},"directories":{},"readme":"# resolve-modules [![NPM version](https://img.shields.io/npm/v/resolve-modules.svg?style=flat)](https://www.npmjs.com/package/resolve-modules) [![NPM downloads](https://img.shields.io/npm/dm/resolve-modules.svg?style=flat)](https://npmjs.org/package/resolve-modules) [![Build Status](https://img.shields.io/travis/jonschlinkert/resolve-modules.svg?style=flat)](https://travis-ci.org/jonschlinkert/resolve-modules)\n\nResolves local and global npm modules that match specified patterns, and returns a configuration object for each resolved module.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install resolve-modules --save\n```\n\n## Usage\n\n```js\nvar Resolver = require('resolve-modules');\nvar resolver = new Resolver();\n```\n\n## API\n\n### [Resolver](index.js#L28)\n\nIterates over [npm-paths](https://github.com/jonschlinkert/npm-paths) and emits `file` for every resolved filepath, and `match` for files that match any specified [matchers](https://github.com/cezary/matchers). Paths are cached in memory using a few different objects:\n\n* `cache.paths`: array of absolute directory and file paths\n* `cache.names`: object of [vinyl](http://github.com/gulpjs/vinyl) files, where `file.name` is the object key. `file.name` is the basename of the filepath, but it's aliased as `name` so we can use it without touching the getters/setters on the vinyl file.\n* `cache.files`: array of [vinyl](http://github.com/gulpjs/vinyl) files\n\n**Params**\n\n* `options` **{Object}**: Specify a cache to use on `options.cache`.\n\n**Example**\n\n```js\nvar resolver = new Resolver();\nresolver.resolve();\nconsole.log(resolver);\n```\n\n### [.resolve](index.js#L105)\n\nIterates over [npm-paths](https://github.com/jonschlinkert/npm-paths) and returns an array of [vinyl](http://github.com/gulpjs/vinyl) files that match any provided matchers. Also emits `file` for all files, and `match` for matches. Additionally, paths are cached on the first call to `.resolve` so that any subsequent calls during the same process will use the cached filepaths instead of hitting the file system again. You can force `.resolve` to hit the file system again by deleting or nulling `resolver.cache.dirs`.\n\n**Params**\n\n* `fn` **{Function|String|Array|RegExp}**: Optionally specify a matcher value.\n* `options` **{Object}**\n* `returns` **{Array}**: Returns an array of [vinyl](http://github.com/gulpjs/vinyl) files.\n\n**Example**\n\n```js\nresolver.match('verb', function(basename, file) {\n  return basename === 'verb';\n});\n\n// matches\nconsole.log(resolver.resolve());\n\n// all cached paths\nconsole.log(resolver);\n```\n\n### [.find](index.js#L128)\n\nFind a filepath where `file.basename` exactly matches the given `name`. This method is standalone and does not require use of the `.resolve` method or matchers.\n\n**Params**\n\n* `name` **{String}**: Basename of the file to match.\n* `returns` **{String|undefined}**: Returns the absolute filepath if a match is found, otherwise undefined.\n\n**Example**\n\n```js\nvar filepath = resolver.find('foo');\n```\n\n### [.match](index.js#L157)\n\nDefine a matcher to use for matching files when the `resolve` method is called. If a string or array of strings is passed, strict equality is used for comparisons with `file.name`.\n\n**Params**\n\n* `name` **{String|Function|Array|RegExp}**: Optionally provide `name` to emit when a match is found, a matcher function, string to match, array of strings, or regex.\n* `val` **{String|Function|Array|RegExp}**: Matcher function, string to match, array of strings, or regex.\n* `options` **{Object}**: If a string is passed, options may be passed to [micromatch](https://github.com/jonschlinkert/micromatch) to convert the string to regex.\n* `returns` **{Object}**: Returns the instance for chaining.\n\n**Example**\n\n```js\nresolver.match('foo');\n```\n\n### [.filter](index.js#L186)\n\nDefine a filter function, glob, string or regex to use for excluding files before matchers are run.\n\n**Params**\n\n* `val` **{String|RegExp|Function}**\n* `options` **{Object}**\n* `returns` **{Object}**\n\n**Example**\n\n```js\nresolver.filter('*.foo');\n```\n\n### [.contains](index.js#L204)\n\nDefine a matcher to use for matching files when the `resolve` method is called. If a string or array of strings is passed, any `file.name` that contains the given string or strings will return true.\n\n**Params**\n\n* `name` **{String|Function|Array|RegExp}**: Optionally provide `name` to emit when a match is found, a matcher function, string to match, array of strings, or regex.\n* `val` **{String|Function|Array|RegExp}**: Matcher function, string to match, array of strings, or regex.\n* `options` **{Object}**: If a string is passed, options may be passed to [micromatch](https://github.com/jonschlinkert/micromatch) to convert the string to regex.\n* `returns` **{Object}**: Returns the instance for chaining.\n\n**Example**\n\n```js\nresolver.contains('foo');\n```\n\n### [.resolveDirs](index.js#L261)\n\nResolve sub-directories from npm-paths. This method probably doesn't need to be used directly, but it's exposed in case you want to customize behavior. Also note that `options.recurse` must be defined as `true` to recurse into child directories. Alternative, if **any** matcher is a glob pattern with a globstar (double star: `**`), `options.recurse` will automatically be set to `true`.\n\n**Params**\n\n* `fn` **{Function}**: Optionally specify a filter function to use on filepaths. If provided, the function will be called before any matchers are called. `basename` and `file` are exposed to the filter function as arguments, where `file` is an instance of [vinyl](http://github.com/gulpjs/vinyl).\n* `returns` **{Object}**: Returns the [cache](#cache).\n\n**Events**\n\n* `emits`: `ignore` when a file is removed.\n\n**Example**\n\n```js\nresolver.resolveDirs(function(basename, file) {\n  return !/foo/.test(file.path);\n});\n```\n\n## Related projects\n\nYou might also be interested in these projects:\n\n* [global-modules](https://www.npmjs.com/package/global-modules): The directory used by npm for globally installed npm modules. | [homepage](https://github.com/jonschlinkert/global-modules)\n* [global-paths](https://www.npmjs.com/package/global-paths): Returns an array of unique \"global\" directories based on the user's platform and environment. The… [more](https://www.npmjs.com/package/global-paths) | [homepage](https://github.com/jonschlinkert/global-paths)\n* [global-prefix](https://www.npmjs.com/package/global-prefix): Get the npm global path prefix. | [homepage](https://github.com/jonschlinkert/global-prefix)\n* [npm-paths](https://www.npmjs.com/package/npm-paths): Returns an array of unique \"npm\" directories based on the user's platform and environment. | [homepage](https://github.com/jonschlinkert/npm-paths)\n\n## Contributing\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](https://github.com/jonschlinkert/resolve-modules/issues/new).\n\n## Building docs\n\nGenerate readme and API documentation with [verb](https://github.com/verbose/verb):\n\n```sh\n$ npm install verb && npm run docs\n```\n\nOr, if [verb](https://github.com/verbose/verb) is installed globally:\n\n```sh\n$ verb\n```\n\n## Running tests\n\nInstall dev dependencies:\n\n```sh\n$ npm install -d && npm test\n```\n\n## Author\n\n**Jon Schlinkert**\n\n* [github/jonschlinkert](https://github.com/jonschlinkert)\n* [twitter/jonschlinkert](http://twitter.com/jonschlinkert)\n\n## License\n\nCopyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT license](https://github.com/jonschlinkert/resolve-modules/blob/master/LICENSE).\n\n***\n\n_This file was generated by [verb](https://github.com/verbose/verb), v0.9.0, on May 19, 2016._","publish_time":1463453388447,"_cnpm_publish_time":1463453388447,"dist-tags":{"latest":"0.5.0"}}