npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@amazon-devices/asset-resolver-lib

v1.0.1767254403

Published

This document will serve as a user guide and will explain library installation (in a KSDK app) and API usage.

Readme

AssetResolver

This document will serve as a user guide and will explain library installation (in a KSDK app) and API usage.

Library Setup

  1. Update the package's package.json file to add the library as a dependency:

    "dependencies": {
        "@amazon-devices/asset-resolver-lib": "*"
    }
  2. With these changes, the AssetResolver turbo module can be consumed. To include the class and its types, the following include line should be used:

    import { AssetResolver, AssetType } from '@amazon-devices/asset-resolver-lib'

Asset Resolution

As previously mentioned, AssetResolver turbo module is a wrapper for the AssetResolver Application Framework library. The AssetResolver library provides applications a means of seamless asset resolution whereby assets are ranked according to device system qualifiers.

Applications can contain assets which are files that can be used for things such as images and text. Assets must be located in the application's assets directory, and the following directory structure must be used for AssetResolver API use:

└── assets
    ├── image
    ├── raw
    └── text

These directories will hold asset files for images, raw files, and text-defining files, respectively. These are the supported asset types in the AssetResolver.

For text localization, Asset Resolver expects text asset files to use the puff.json format for defining string and numeric values. PUFF-J files define text resources used in an application and are used by Asset Resolver in its getString() and getNumber() APIs.

Configuration Qualifiers

The AssetResolver's APIs resolve assets based on the system's current configuration qualifiers. These are values which define certain device properties such as locale, UI mode, and so on.

For example, the qualifier locale can take values en-US, es-AR, or es-SP. This qualifier will directly influence which assets are resolved.

└── assets
    ├── image
    ├── raw
    └── text
        ├── en
        │   └── strings.puff.json
        ├── en-US
        │   └── strings.puff.json
        ├── es
        │   └── strings.puff.json
        ├── es-AR
        │   └── strings.puff.json
        └── strings.puff.json

In the above asset directory structure, the file strings.puff.json is defined in multiple directories: one for each locale and one in text to act as a default. Depending on the current system configuration qualifiers, the AssetResolver will resolve text based on the most appropriate match; if there is none, the default file will be used.

NOTE: when an application supports a locale (such as en-GB), it must also define support for that locale's default qualifier (in this case en).

NOTE: defining a default asset file is recommended as it ensures there is always an asset matched in case asset resolution fails.

If the system configuration qualifier for locale is es-AR, then the file assets/text/es-AR/strings.puff.json will be chosen when using the AssetResolver APIs. If multiple locales contain the same text assets, symbolic links to a single asset file may be used to save device storage space.

NOTE: only locale is supported as a configuration qualifier to resolve assets around.

Access Control

The AssetResolver APIs are not access-controlled. AssetResolver APIs only execute within an application's subset of the device's filesystem. Moreover, other applications cannot explicitly resolve assets from another application, ensuring app-to-app isolation.

Usage

The AssetResolver is an application library that allows retrieval of assets from packages. These assets are resolved based on various system qualifiers such as locale, day/night mode, UI mode, etc. Assets can be text-based, images, or raw files.

The AssetResolver turbo module provides various APIs which packages may use to retrieve asset values as well as paths which will be demonstrated below.

AssetConfiguration type

Certain APIs take in an AssetConfiguration object. This object is used to specify which qualifiers should be used when resolving assets. Currently locale is supported.

getString()

In order to retrieve an internationalized string value, the getString() API should be used. This API takes in the identifier of the string being queried and an optional configuration object which specifies which qualifiers should be used in asset resolution.

On failure, this API will throw an Error whose message indicates the error condition.

const stringResult = AssetResolver.getString("welcome-string");

console.log("string value: {}", stringResult.value);
console.log("string direction: {}", stringResult.dir);

const config = { locale: "fr-CA" };
const stringConfigResult = AssetResolver.getString("welcome-string", config);

console.log("string value: {}", stringConfigResult.value);
console.log("string direction: {}", stringConfigResult.dir);

getNumber()

In order to retrieve an internationalized number value, the getNumber() API should be used. Similar to getString(), this takes in a string which is the identifier for the number value being queried. Furthermore, the API also takes in an optional configuration object which specifies which qualifiers should be used in asset resolution.

This API similarly throws an Error if there is an issue in execution.

const numberResult = AssetResolver.getNumber("numeral");

console.log("number value: {}", numberResult);

const config = { locale: "en-US" };
const numberConfigResult = AssetResolver.getNumber("numeral", config);

console.log("number value: {}", numberConfigResult);