---
title: "@vltpkg/dep-id: browser — vlt docs"
description: "Documentation for the vlt client and the vlt registry."
url: "https://docs.vlt.io/client/api-reference/dep-id/browser"
image: "https://docs.vlt.io/og/client/api-reference/dep-id/browser"
lang: "en"
---

# browser

## Type Aliases

### Delimiter

```ts
type Delimiter = "~";
```

Defined in: browser.ts:11

---

### DepID

```ts
type DepID = 
  | `${"" | "git"}${Delimiter}${string}${Delimiter}${string}${Delimiter}${string}`
  | `${"" | "git"}${Delimiter}${string}${Delimiter}${string}`
  | `${"file" | "remote" | "workspace"}${Delimiter}${string}${Delimiter}${string}`
  | `${"file" | "remote" | "workspace"}${Delimiter}${string}`;
```

Defined in: browser.ts:39

Dependency IDs are a URI-encoded set of strings, separated by the [Delimiter](https://docs.vlt.io/client/api-reference/dep-id/browser.md#delimiter) character (`'~'`).

The first entry is always the specifier type. The rest depend on the type. `git`, `registry`, and `workspace` entries have 3 fields, the rest have 2.

- `registry`: `'registry~<registry>~name@specifier'` The `<registry>` portion can be a known named registry name, or a url to a registry. If empty, it is the default registry. Examples:

  - `~~some-package@2.0.1`
  - `~npm~whatever@1.2.3`
  - `~http%3A%2F%2Fvlt.sh%2F~x@1.2.3`

- `git`: `'git~<git remote>~<git selector>'`. For example:

  - `git~github:user/project~branchname`
  - `git~git%2Bssh%3A%2F%2Fuser%40host%3Aproject.git~semver:1.x`

- `workspace`: `'workspace~<path>'`. For example:
  - `workspace~src/mything`

- `remote`: `'remote~<url>'`

- `file`: `'file~<path>'`

Lastly, the final portion can contain arbitrary string data, and is used to store peer dep resolutions to maintain the peerDep contract.

---

### DepIDTuple

```ts
type DepIDTuple = 
  | ["git", string, string, string]
  | ["registry", string, string, string]
  | ["file", string, string]
  | ["remote", string, string]
  | ["workspace", string, string];
```

Defined in: browser.ts:48

A [DepID](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid), split apart and URI-decoded

## Variables

### delimiter

```ts
const delimiter: Delimiter = '~';
```

Defined in: browser.ts:10

## Functions

### asDepID()

```ts
function asDepID(str): DepID
```

Defined in: browser.ts:86

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `str`     | `string` |

#### Returns

[`DepID`](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid)

---

### baseDepID()

```ts
function baseDepID(id): DepID
```

Defined in: browser.ts:330

Retrieves the base [DepID](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid) for a given depID, ignoring any extra information that may be present.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `id`      | `string` |

#### Returns

[`DepID`](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid)

---

### getId()

```ts
function getId(
   spec, 
   mani, 
   extra?): DepID
```

Defined in: browser.ts:626

Get the [DepID](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid) for a given [Spec](https://docs.vlt.io/client/api-reference/spec/browser.md#spec) and [Manifest](https://docs.vlt.io/client/api-reference/types/reference.md#manifest). The Manifest is used to get the name and version, if possible. If not found in the manifest, registry ID types will use the name or bareSpec from the specifier, so at least there's something to use later.

#### Parameters

| Parameter | Type                                                                                                                |
| --------- | ------------------------------------------------------------------------------------------------------------------- |
| `spec`    | [`Spec`](https://docs.vlt.io/client/api-reference/spec/browser.md#spec)                                             |
| `mani`    | `Pick`<[`Manifest`](https://docs.vlt.io/client/api-reference/types/reference.md#manifest), `"name"` \| `"version"`> |
| `extra`?  | `string`                                                                                                            |

#### Returns

[`DepID`](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid)

---

### getTuple()

```ts
function getTuple(
   spec, 
   mani, 
   extra?): DepIDTuple
```

Defined in: browser.ts:531

Get the [DepIDTuple](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depidtuple) for a given [Spec](https://docs.vlt.io/client/api-reference/spec/browser.md#spec) and [Manifest](https://docs.vlt.io/client/api-reference/types/reference.md#manifest). The Manifest is used to get the name and version, if possible. If not found in the manifest, registry ID types will use the name or bareSpec from the specifier, so at least there's something to use later.

#### Parameters

| Parameter | Type                                                                                                                |
| --------- | ------------------------------------------------------------------------------------------------------------------- |
| `spec`    | [`Spec`](https://docs.vlt.io/client/api-reference/spec/browser.md#spec)                                             |
| `mani`    | `Pick`<[`Manifest`](https://docs.vlt.io/client/api-reference/types/reference.md#manifest), `"name"` \| `"version"`> |
| `extra`?  | `string`                                                                                                            |

#### Returns

[`DepIDTuple`](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depidtuple)

---

### hydrate()

```ts
function hydrate(
   id, 
   name?, 
   options?): Spec
```

Defined in: browser.ts:346

Turn a [DepID](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid) into a [Spec](https://docs.vlt.io/client/api-reference/spec/browser.md#spec) object

#### Parameters

| Parameter  | Type                                                                                       |
| ---------- | ------------------------------------------------------------------------------------------ |
| `id`       | [`DepID`](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid)                |
| `name`?    | `string`                                                                                   |
| `options`? | [`SpecOptions`](https://docs.vlt.io/client/api-reference/spec/module_index.md#specoptions) |

#### Returns

[`Spec`](https://docs.vlt.io/client/api-reference/spec/browser.md#spec)

---

### hydrateTuple()

```ts
function hydrateTuple(
   tuple, 
   name?, 
   options?): Spec
```

Defined in: browser.ts:365

Turn a [DepIDTuple](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depidtuple) into a [Spec](https://docs.vlt.io/client/api-reference/spec/browser.md#spec) object

#### Parameters

| Parameter  | Type                                                                                       |
| ---------- | ------------------------------------------------------------------------------------------ |
| `tuple`    | [`DepIDTuple`](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depidtuple)      |
| `name`?    | `string`                                                                                   |
| `options`? | [`SpecOptions`](https://docs.vlt.io/client/api-reference/spec/module_index.md#specoptions) |

#### Returns

[`Spec`](https://docs.vlt.io/client/api-reference/spec/browser.md#spec)

---

### isDepID()

```ts
function isDepID(str): str is DepID
```

Defined in: browser.ts:81

#### Parameters

| Parameter | Type      |
| --------- | --------- |
| `str`     | `unknown` |

#### Returns

`str is DepID`

---

### isPackageNameConfused()

```ts
function isPackageNameConfused(spec?, name?): boolean
```

Defined in: browser.ts:614

Checks for a potentially manifest-confused package name. Returns `true` if the package name is confused, `false` otherwise.

#### Parameters

| Parameter | Type                                                                    |
| --------- | ----------------------------------------------------------------------- |
| `spec`?   | [`Spec`](https://docs.vlt.io/client/api-reference/spec/browser.md#spec) |
| `name`?   | `string`                                                                |

#### Returns

`boolean`

---

### joinDepIDTuple()

```ts
function joinDepIDTuple(list): DepID
```

Defined in: browser.ts:99

turn a [DepIDTuple](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depidtuple) into a [DepID](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid)

#### Parameters

| Parameter | Type                                                                                  |
| --------- | ------------------------------------------------------------------------------------- |
| `list`    | [`DepIDTuple`](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depidtuple) |

#### Returns

[`DepID`](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid)

---

### joinExtra()

```ts
function joinExtra(__namedParameters): undefined | string
```

Defined in: browser.ts:635

Join a modifier and a peer set hash into a single "extra" string.

#### Parameters

| Parameter                        | Type                                               |
| -------------------------------- | -------------------------------------------------- |
| `__namedParameters`              | { `modifier`: `string`; `peerSetHash`: `string`; } |
| `__namedParameters.modifier`?    | `string`                                           |
| `__namedParameters.peerSetHash`? | `string`                                           |

#### Returns

`undefined` | `string`

---

### resetCaches()

```ts
function resetCaches(): void
```

Defined in: browser.ts:679

Reset internal caches. This should be used when options change since they're not take into account in the memoization keys.

#### Returns

`void`

---

### splitDepID()

```ts
function splitDepID(id): DepIDTuple
```

Defined in: browser.ts:285

turn a [DepID](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depid) into a [DepIDTuple](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depidtuple)

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `id`      | `string` |

#### Returns

[`DepIDTuple`](https://docs.vlt.io/client/api-reference/dep-id/browser.md#depidtuple)

---

### splitExtra()

```ts
function splitExtra(extra): object
```

Defined in: browser.ts:651

Split an "extra" string into a modifier and a peerSetHash.

#### Parameters

| Parameter | Type     |
| --------- | -------- |
| `extra`   | `string` |

#### Returns

`object`

| Name           | Type     |
| -------------- | -------- |
| `modifier`?    | `string` |
| `peerSetHash`? | `string` |
