{"name":"resolve-dependency-path","version":"2.0.0","description":"Convert a dependency path into a filepath","main":"index.js","directories":{"test":"test"},"scripts":{"test":"jscs -p google index.js test/test.js && mocha test/test.js"},"engines":{"node":">=6.0.0"},"repository":{"type":"git","url":"git+https://github.com/mrjoelkemp/node-resolve-dependency-path.git"},"keywords":["dependency","filepath","module"],"author":{"name":"Joel Kemp","email":"joel@mrjoelkemp.com","url":"http://www.mrjoelkemp.com/"},"license":"MIT","bugs":{"url":"https://github.com/mrjoelkemp/node-resolve-dependency-path/issues"},"homepage":"https://github.com/mrjoelkemp/node-resolve-dependency-path","devDependencies":{"jscs":"^3.0.7","jscs-preset-mrjoelkemp":"^2.0.0","mocha":"~2.0.1"},"gitHead":"6d668d15f620c33c7d29963d626988b9cbc767dc","_id":"resolve-dependency-path@2.0.0","_npmVersion":"6.4.1","_nodeVersion":"8.12.0","_npmUser":{"name":"mrjoelkemp","email":"joel@mrjoelkemp.com"},"dist":{"integrity":"sha512-DIgu+0Dv+6v2XwRaNWnumKu7GPufBBOr5I1gRPJHkvghrfCGOooJODFvgFimX/KRxk9j0whD2MnKHzM1jYvk9w==","shasum":"11700e340717b865d216c66cabeb4a2a3c696736","tarball":"http://registry-npm.ywwl.com/resolve-dependency-path/download/resolve-dependency-path-2.0.0.tgz","fileCount":5,"unpackedSize":10961,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.4\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJcHQeNCRA9TVsSAnZWagAAOHUP/AqxnW2FmTdaHlbg/zsq\nbPUNp8S/zk1UoEfv5yu6+vuLeuVLFhrv3B5CKH1NAe5zNSDqCvfEHJmBz10D\nxteQdfOXx3pILWda9c2Qxuc6Ynqzw3YKhJiR6Ne6Ehs6mO90vRQThA+Fgz4E\nadB65ZDtIbZ1wGARpiTXb3nw6eT9Fw8P86W2y5XDZmFQGCYJY6nMLhf9jtMS\n6+hXSWcGknmRsW+b4Atnp78y2i4N2iOeQTVxSlHNaf3BmZF1lhhkV+wlLTxU\nBikeS4cLo+XsG7tw9vuNehSyp13e4UfI7Trp/mLcQJRwQeYySmda0VUZ+oq1\nJyZ2QWO4/VpkVx+6H+vIh1ldHfyImoj5IQRygzqUr9fox+fWTJxDp9VSGnJ5\nIWxo8aoUNFPYsjmx399eVI8mYlKx+cif7DMqYnjWhvxICgNdLcCxUSpzJsPB\ne5I8Q/0vpHkercSo+lacJhGOTWHSMljTR6+44VA+znn2K7SaWJlsWHYYO488\nXXyDAt4dhb5KPntguaRN9SAdbYAto0u/X0MWgtwh2a/wfFrEQdAJkWxDGJ9E\nc2s9N0dBG3icM8Tm81JK2nG6FWl9Ta8+F9wJN381hQy9o4MZgnn1DAxvGjtS\nPe3oH+mbRnOnpDEP0w9Qud+7fLG/M9XKqlZ99qwkHlOYT8mV6wVIYZC3Pd/z\n7dfh\r\n=Dlva\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQC5p/42p2CdqsklKUPwnBQHvfeyeO4RPtOUV+si1WkIewIgCx9/XR4RZP0r9viP8q8mwx7Dv9dztHsCfxPFC7oDzrM="}],"size":2559,"noattachment":false,"key":"/resolve-dependency-path/-/resolve-dependency-path-2.0.0.tgz"},"maintainers":[{"name":"mrjoelkemp","email":"joel@mrjoelkemp.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-dependency-path_2.0.0_1545406348816_0.856459948464519"},"_hasShrinkwrap":false,"readme":"# resolve-dependency-path\n\n[![CI](https://img.shields.io/github/actions/workflow/status/dependents/node-resolve-dependency-path/ci.yml?branch=main&label=CI&logo=github)](https://github.com/dependents/node-resolve-dependency-path/actions/workflows/ci.yml?query=branch%3Amain)\n[![npm version](https://img.shields.io/npm/v/resolve-dependency-path?logo=npm&logoColor=fff)](https://www.npmjs.com/package/resolve-dependency-path)\n[![npm downloads](https://img.shields.io/npm/dm/resolve-dependency-path)](https://www.npmjs.com/package/resolve-dependency-path)\n\n> Convert a dependency path into a filepath\n\n```sh\nnpm install resolve-dependency-path\n```\n\n## Usage\n\n```js\nconst resolvePath = require('resolve-dependency-path');\n\nconst resolved = resolvePath({\n  dependency: './foobar',\n  filename: 'path/to/file/containing/dependency.js',\n  directory: 'path/to/all/files'\n});\n```\n\n* `dependency`: the actual dependency path (probably extracted from a `require()`)\n* `filename`: the file that required this dependency (likely the file whose dependencies are being extracted)\n* `directory`: the root of all modules being processed. Dependencies are often about this root unless they're relative.\n\n## Example\n\nIf you have a file like:\n\n*myapp/foo.js*\n\n```js\nvar require('./bar');\n```\n\nThen if you want to open the file associated with the dependency, you need to resolve `./bar` onto the filesystem.\n\nSince `./bar` is a relative path, it should be resolved relative to `foo.js`,\nmore specifically the directory containing `foo.js`, `myapp/`. This resolution would yield\n`myapp/bar.js`.\n\nThis is why the `filename` attribute is required to use this library.\n\nIf you have a non-relative dependency path like:\n\n*myapp/foo.js*\n\n```js\ndefine([\n  'bar'\n], function(bar) {\n\n});\n```\n\nThen `bar` is relative to the root of all files, `myapp`. The resolution would yield\n`myapp/bar.js`.\n\nA more complex example with subdirectories:\n\n*myapp/feature1/foo.js*\n\n```js\ndefine([\n  'feature2/bar'\n], function(bar) {\n\n});\n```\n\nThe dependency `feature2/bar` is relative to the root of all files, `myapp`, *not* the file `foo.js`.\n\nThis is why the `directory` attribute is required to use this library.\n\n## License\n\n[MIT](LICENSE)\n","publish_time":1545406348932,"_cnpm_publish_time":1545406348932,"dist-tags":{"latest":"5.0.0"}}