---
title: "AssetResolver"
description: "Resolves portable source keys, such as `app/entry.browser.ts` or `file:app/counter.tsx#Counter`, to the URLs a build or development server produced for them."
url: "https://pitlane.tools/package/assets/interface/AssetResolver"
---

# AssetResolver

```ts
import type { AssetResolver } from "@pitlane/assets";
```

Resolves portable source keys, such as `app/entry.browser.ts` or `file:app/counter.tsx#Counter`, to the URLs a build or development server produced for them.

Structurally compatible with the resolution methods of a `remix/assets` asset server, so it can be passed to `render({ assets })`.

## Methods

### getHref()

```ts
getHref(path): Promise<string>;
```

The URL of a registered browser entry, stylesheet, or other asset.

#### Parameters

##### path

`string`

#### Returns

`Promise`\<`string`>

---

### getImportMap()

```ts
getImportMap(path): Promise<ImportMap>;
```

The complete client import map, after checking the keys belong to the client graph.

#### Parameters

##### path

`string` | readonly `string`\[\]

#### Returns

`Promise`\<[`ImportMap`](https://pitlane.tools/package/assets/interface/ImportMap.md)>

---

### getPreloads()

```ts
getPreloads(path): Promise<string[]>;
```

Scripts' chunks and static JavaScript dependencies, and explicitly requested stylesheets.

#### Parameters

##### path

`string` | readonly `string`\[\]

#### Returns

`Promise`\<`string`\[\]>

---

### getScriptEntry()

```ts
getScriptEntry(path): Promise<ScriptEntry>;
```

A registered browser entry's URL, `modulepreload` URLs, and the client import map.

#### Parameters

##### path

`string`

#### Returns

`Promise`\<[`ScriptEntry`](https://pitlane.tools/package/assets/interface/ScriptEntry.md)>

---

### getStylesheets()

```ts
getStylesheets(path): Promise<string[]>;
```

Stylesheets the modules need, from the client graph and the current server graph.

#### Parameters

##### path

`string` | readonly `string`\[\]

#### Returns

`Promise`\<`string`\[\]>
