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

@flare-engine/assets

v0.4.13

Published

Asset loading, sprite sheet parsing

Readme

@flare-engine/assets

Manifest-driven asset loading — AssetManager with progress signal, SpriteSheet (TexturePacker hash + array, Aseprite JSON), Texture wrapper around SkImage, createProceduralAtlas for shape-atlas / placeholder generation. Audio buffer types live in @flare-engine/audio.

Install

bun add @flare-engine/assets

Usage

A manifest is a list of { key, type, path } entries. AssetManager delegates the actual fetch+decode to an injected AssetLoader; two default loaders ship — one for web (fetch) and one for native (a filesystem readFile). Both take a decodeImage you wire to your Skia/CanvasKit instance, so the package pulls in no renderer of its own.

Web (CanvasKit)

import { AssetManager, createFetchAssetLoader, type ManifestEntry, type SkImageLike } from '@flare-engine/assets';

declare const kit: { MakeImageFromEncoded(bytes: Uint8Array): SkImageLike | null };

const loader = createFetchAssetLoader({
  decodeImage: (bytes) => kit.MakeImageFromEncoded(bytes),
});

const manifest: ManifestEntry[] = [
  { key: 'hero', type: 'texture', path: '/assets/hero.png' },
  { key: 'atlas', type: 'spritesheet', path: '/assets/hero.json' },
];

const assets = new AssetManager(loader);
assets.onProgress.add((p) => console.log(`loading ${Math.round(p * 100)}%`));
await assets.load(manifest);

const hero = assets.get('hero'); // Texture

Native (React Native + Skia)

import { Skia } from '@shopify/react-native-skia';
import * as FileSystem from 'expo-file-system';
import { AssetManager, createFileAssetLoader, decodeImage } from '@flare-engine/assets';

const loader = createFileAssetLoader({
  readFile: async (path) => {
    const base64 = await FileSystem.readAsStringAsync(path, {
      encoding: FileSystem.EncodingType.Base64,
    });
    return Uint8Array.from(atob(base64), (c) => c.charCodeAt(0));
  },
  decodeImage: (bytes) => decodeImage(Skia, bytes),
});

const assets = new AssetManager(loader);
await assets.load(manifest);

Per entry type: texture → a Texture; binary → Uint8Array; json / spritesheet → the parsed JSON (feed a spritesheet result to parseTexturePackerHash / parseTexturePackerArray / parseAseprite).

Partial-failure loading

load() is fail-fast — one failed entry rejects the whole call. When a partial asset set is acceptable, use loadManifestSettled():

import { AssetManager, type ManifestEntry } from '@flare-engine/assets';
declare const assets: AssetManager;
declare const manifest: ManifestEntry[];

const { loaded, failed } = await assets.loadManifestSettled(manifest);
if (failed.length) console.warn('some assets failed', failed);
// loaded: string[] of cached keys; failed: { key, error }[]

Sprite sheets & procedural atlases

import { parseTexturePackerHash, createProceduralAtlas, type SkiaAtlasModuleLike } from '@flare-engine/assets';

declare const json: unknown;
declare const skia: SkiaAtlasModuleLike;

const sheet = parseTexturePackerHash(json);

// Procedural placeholder atlas:
const { image, sheet: atlas } = createProceduralAtlas(skia, [
  { name: 'enemy', w: 32, h: 32, color: 0xff_00_ff_00 },
]);

packAtlasRows(sizes, maxWidth, padding) is the row layout behind createProceduralAtlas, exported for other atlas builders: it takes { w, h }[] and returns one { x, y } per entry plus the atlas width and height.

Rotated frames are not supported. TexturePacker's "Allow rotation" packs some frames sideways; the parser cannot yet remap them, so they render rotated. Frames with rotated: true emit a dev-mode console.warn naming the frame — re-export the atlas with rotation disabled. Full rotation support is post-launch.

See API spec.

License

Apache-2.0