{"name":"resolve-dependency-path","version":"4.0.0","description":"Convert a dependency path into a filepath","main":"index.js","scripts":{"lint":"xo","fix":"xo --fix","mocha":"mocha","test":"npm run lint && npm run mocha","test:ci":"c8 npm run mocha"},"repository":{"type":"git","url":"git+https://github.com/dependents/node-resolve-dependency-path.git"},"keywords":["dependency","filepath","module"],"author":{"name":"Joel Kemp","email":"joel@mrjoelkemp.com"},"license":"MIT","bugs":{"url":"https://github.com/dependents/node-resolve-dependency-path/issues"},"homepage":"https://github.com/dependents/node-resolve-dependency-path","engines":{"node":">=18"},"devDependencies":{"c8":"^9.1.0","mocha":"^10.4.0","xo":"^0.58.0"},"xo":{"space":true,"ignores":["test/fixtures/*"],"rules":{"arrow-body-style":"off","capitalized-comments":"off","comma-dangle":["error","never"],"curly":["error","multi-line"],"operator-linebreak":["error","after"],"object-curly-spacing":["error","always"],"space-before-function-paren":["error","never"],"unicorn/prefer-module":"off","unicorn/prefer-node-protocol":"off","unicorn/prefer-string-slice":"off","unicorn/prefer-top-level-await":"off","unicorn/prevent-abbreviations":"off"}},"_id":"resolve-dependency-path@4.0.0","gitHead":"bfdc1f901da9a07004094790d141680be4b811ac","_nodeVersion":"20.11.1","_npmVersion":"10.2.4","dist":{"integrity":"sha512-hlY1SybBGm5aYN3PC4rp15MzsJLM1w+MEA/4KU3UBPfz4S0lL3FL6mgv7JgaA8a+ZTeEQAiF1a1BuN2nkqiIlg==","shasum":"ec0b2aa83ce8cd125c7db734a40b4809959bf688","tarball":"http://registry-npm.ywwl.com/resolve-dependency-path/download/resolve-dependency-path-4.0.0.tgz","fileCount":4,"unpackedSize":6796,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEYCIQDk7tj1bw/uIzPgNqiOkWMLsMAcGKe53MOFsO2Nwvw+AgIhANQW11qLKp8ElUYUdpyhiOcBD8Y0OuRvS4+WTdSyDKyK"}],"size":2801,"noattachment":false,"key":"/resolve-dependency-path/-/resolve-dependency-path-4.0.0.tgz"},"_npmUser":{"name":"xhmikosr","email":"xhmikosr@gmail.com"},"directories":{},"maintainers":[{"name":"pahen","email":"patrik.henningsson@gmail.com"},{"name":"xhmikosr","email":"xhmikosr@gmail.com"},{"name":"mrjoelkemp","email":"mrjoelkemp@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/resolve-dependency-path_4.0.0_1712730014207_0.8904747451773627"},"_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":1712730014370,"_cnpm_publish_time":1712730014370,"dist-tags":{"latest":"5.0.0"}}