{"name":"resolve-dependency-path","version":"5.0.0","description":"Convert a dependency path into a filepath","type":"module","exports":{".":{"types":"./index.d.ts","default":"./index.js"}},"scripts":{"lint":"xo","fix":"xo --fix","uvu":"uvu test","test":"npm run lint && npm run uvu","test:ci":"c8 npm run uvu"},"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":">=20.19.0 || >=22.12.0"},"devDependencies":{"c8":"^11.0.0","uvu":"^0.5.6","xo":"^2.0.2"},"gitHead":"42d2b109bd88367ab96c148faa51ba01104d30dd","types":"./index.d.ts","_id":"resolve-dependency-path@5.0.0","_nodeVersion":"24.15.0","_npmVersion":"11.12.1","dist":{"integrity":"sha512-gIMtQ6WW2SZjRmcVKX8iupioC54LgNMaEtTqy4AFD6gScGzFVXLUfDcIDcVmbO4Q1wFzp+oXA6IgVd9Is3mQug==","shasum":"b15718839623b2c00e79c041790f60c147ef4567","tarball":"http://registry-npm.ywwl.com/resolve-dependency-path/download/resolve-dependency-path-5.0.0.tgz","fileCount":5,"unpackedSize":7442,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCICXyqTnb6/CVbEr/OGhmP/H4MgO/dnbU0xezJmwMS5DsAiBKscpCU7D9dMs/pEI1rFwhIvf3x4lKSdsuIm8RjFZK5A=="}],"size":2782,"noattachment":false,"key":"/resolve-dependency-path/-/resolve-dependency-path-5.0.0.tgz"},"_npmUser":{"name":"xhmikosr","email":"xhmikosr@gmail.com"},"directories":{},"maintainers":[{"name":"pahen","email":"patrik.henningsson@gmail.com"},{"name":"mrjoelkemp","email":"mrjoelkemp@gmail.com"},{"name":"xhmikosr","email":"xhmikosr@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/resolve-dependency-path_5.0.0_1779193363385_0.1445583891367177"},"_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### ESM\n\n```js\nimport resolvePath from '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### CommonJS\n\n```js\nconst { default: resolvePath } = require('resolve-dependency-path');\n```\n\n### Options\n\n| Option | Type | Required | Description |\n|---|---|---|---|\n| `dependency` | `string` | Yes | The dependency specifier (e.g. the argument to `require()`) |\n| `filename` | `string` | Yes | Absolute or relative path of the file that contains the dependency |\n| `directory` | `string` | Yes | Root directory used to resolve non-relative dependencies |\n\n## Example\n\nIf you have a file like:\n\n*myapp/foo.js*\n\n```js\nrequire('./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":1779193363526,"_cnpm_publish_time":1779193363526,"dist-tags":{"latest":"5.0.0"}}