# dependency-path

> Utilities for working with symlinked node_modules

Latest version **9.2.8** (published 2022-11-09) · MIT license · 0 weekly downloads

## Install

```sh
npm install dependency-path
pnpm add dependency-path
yarn add dependency-path
bun add dependency-path
```

## Health

**Score 50/100 (C)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score; popular repo.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 9.2.8 |
| Published | 2022-11-09 |
| First published | 2017-07-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=14.6 |
| Dependencies | 4 |
| Unpacked size | 16.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 36524 |
| Maintainers | zkochan, pnpmuser |
| Keywords | pnpm7, node_modules, pnpm, path |

## Links

- npm: https://www.npmjs.com/package/dependency-path
- Repository: https://github.com/pnpm/pnpm/blob/main/packages/dependency-path
- Homepage: https://github.com/pnpm/pnpm/blob/main/packages/dependency-path#readme
- Issues: https://github.com/pnpm/pnpm/issues
- Funding: https://opencollective.com/pnpm
- npm.io page: https://npm.io/package/dependency-path

## Dependencies (4)

- [semver](https://npm.io/package/semver.md) ^7.3.8
- [@pnpm/types](https://npm.io/package/@pnpm/types.md) 8.9.0
- [encode-registry](https://npm.io/package/encode-registry.md) ^3.0.0
- [@pnpm/crypto.base32-hash](https://npm.io/package/@pnpm/crypto.base32-hash.md) 1.0.1

## Alternatives

- [base64url](https://npm.io/package/base64url.md) — 6.1M weekly downloads
- [get-installed-path](https://npm.io/package/get-installed-path.md) — 502.9K weekly downloads
- [@uppy/url](https://npm.io/package/@uppy/url.md) — 185.8K weekly downloads
- [@d3fc/d3fc-shape](https://npm.io/package/@d3fc/d3fc-shape.md) — 16.2K weekly downloads
- [localizer](https://npm.io/package/localizer.md) — 226 weekly downloads

## Recent versions

- 9.2.8 (latest) — 2022-11-09
- 8.0.13 (latest-6) — 2022-07-05
- 5.0.3 (pnpm-temp) — 2020-07-31
- 4.0.6 (next) — 2020-04-09
- 9.2.7 — 2022-10-19
- 9.2.6 — 2022-10-03
- 9.2.5 — 2022-09-18
- 9.2.4 — 2022-07-31
- 9.2.3 — 2022-07-02
- 9.2.2 — 2022-06-27
- 9.2.1 — 2022-06-24
- 9.2.0 — 2022-06-22
- 9.1.4 — 2022-06-18
- 9.1.3 — 2022-06-10
- 8.0.12 — 2022-05-17
- … 54 more at https://npm.io/package/dependency-path/versions

## README

# dependency-path

> Utilities for working with symlinked node_modules

<!--@shields('npm')-->
[![npm version](https://img.shields.io/npm/v/dependency-path.svg)](https://www.npmjs.com/package/dependency-path)
<!--/@-->

Like `path` but for packages in a symlinked `node_modules`. Symlinked `node_modules` is a unique dependencies layout that
[pnpm](https://github.com/pnpm/pnpm) creates.

## Installation

```sh
pnpm add dependency-path
```

## Usage

<!--@example('./example.js')-->
```js
const dependencyPath = require('dependency-path')

const registry = 'https://registry.npmjs.org/'

console.log(dependencyPath.isAbsolute('/foo/1.0.0'))
//> false

// it is confusing currently because relative starts with /.
// It will be changed in the future to vice versa
console.log(dependencyPath.resolve(registry, '/foo/1.0.0'))
//> registry.npmjs.org/foo/1.0.0

console.log(dependencyPath.relative(registry, 'registry.npmjs.org/foo/1.0.0'))
//> /foo/1.0.0

console.log(dependencyPath.refToAbsolute('1.0.1', 'foo', registry))
//> registry.npmjs.org/foo/1.0.1

console.log(dependencyPath.refToAbsolute('github.com/foo/bar/twe0jger043t0ew', 'foo', registry))
//> github.com/foo/bar/twe0jger043t0ew

console.log(dependencyPath.refToRelative('1.0.1', 'foo', registry))
//> /foo/1.0.1

console.log(dependencyPath.parse('/foo/2.0.0'))
//> { isAbsolute: false, name: 'foo', version: '2.0.0' }
```
<!--/@-->

## License

MIT

---
_Source: https://npm.io/package/dependency-path · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
