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

@verevoir/media

v0.2.0-alpha.1

Published

Media display — deterministic URL builder, AssetSource abstraction, and rendering helpers for NextLake

Readme

@verevoir/media

Display concern for NextLake assets — deterministic imgproxy URL builder, AssetSource abstraction, image/video block definitions, and React editor components.

What It Does

  • URL BuilderbuildImageUrl() and buildSrcSet() produce deterministic imgproxy URLs from asset metadata and resize options.
  • AssetSource — pluggable interface for resolving asset metadata. Decoupled from @verevoir/assets via structural typing.
  • Block DefinitionsimageBlock and videoBlock via defineBlock from @verevoir/schema.
  • React ComponentsImageField (asset picker + preview), HotspotOverlay (click-to-set focal point), context providers.
  • Rendering HelperimageProps() returns ready-made <img> tag attributes.

Install

npm install @verevoir/media

Peer dependencies: react, react-dom (optional — only needed for React components).

Quick Example

import { createAssetSource, buildImageUrl, imageProps } from '@verevoir/media';

// Bridge an AssetManager to the AssetSource interface
const source = createAssetSource({
  manager,
  blobUrl: (key) => `https://cdn.example.com/blobs/${key}`,
});

// Build a resize URL
const asset = await source.getAsset('asset-id');
const url = buildImageUrl(
  asset,
  { width: 400, height: 300 },
  { baseUrl: 'https://imgproxy.example.com' },
);
// → https://imgproxy.example.com/resize:fill:400:300/plain/https://cdn.example.com/blobs/...

// Get <img> tag props
const props = imageProps(asset, 400, 300, {
  baseUrl: 'https://imgproxy.example.com',
});
// { src, srcSet, width, height }

React Usage

import {
  AssetSourceProvider,
  ImgproxyConfigProvider,
  ImageField,
  HotspotOverlay,
} from '@verevoir/media';

function App() {
  return (
    <AssetSourceProvider source={source}>
      <ImgproxyConfigProvider
        config={{ baseUrl: 'https://imgproxy.example.com' }}
      >
        <ImageField value={assetId} onChange={setAssetId} label="Hero Image" />
        <HotspotOverlay
          src={imageUrl}
          hotspot={hotspot}
          onChange={setHotspot}
        />
      </ImgproxyConfigProvider>
    </AssetSourceProvider>
  );
}

API

URL Builder

| Export | Description | | -------------------------------------- | --------------------------------------------------------- | | buildImageUrl(asset, resize, config) | Deterministic imgproxy URL with optional hotspot gravity | | buildSrcSet(asset, w, h, config) | 1x + 2x srcSet string | | imageProps(asset, w, h, config) | Returns { src, srcSet, width, height } for <img> tags |

AssetSource

| Export | Description | | ----------------------------------------- | ----------------------------------------------------- | | AssetSource | Interface: getAsset(id), listAssets(options?) | | createAssetSource({ manager, blobUrl }) | Bridge AssetManager → AssetSource (structural typing) |

Block Definitions

| Export | Fields | | ------------ | ---------------------------------------------------------------------------------------------- | | imageBlock | asset (reference), alt (text, optional), displayWidth (number), displayHeight (number) | | videoBlock | Same as image + autoplay (boolean), loop (boolean) |

React Components

| Export | Description | | ------------------------------------------------ | -------------------------------------------- | | AssetSourceProvider / useAssetSource() | Context for asset resolution | | ImgproxyConfigProvider / useImgproxyConfig() | Context for imgproxy config | | ImageField | Asset picker dropdown with thumbnail preview | | HotspotOverlay | Click-to-set focal point with visual marker |

Types

| Type | Description | | ---------------- | ---------------------------------------------------------------- | | Hotspot | { x: number, y: number } — 0–1 normalised focal point | | AssetInfo | Resolved asset metadata with HTTP URL | | ResizeOptions | { width, height, fit? } — fit: 'fill' | 'fit' | 'auto' | | ImgproxyConfig | { baseUrl, key?, salt? } — HMAC fields reserved for future |

Architecture

| File | Responsibility | | ----------------- | ------------------------------------------------------------------------------- | | src/types.ts | Core interfaces: Hotspot, AssetInfo, AssetSource, ResizeOptions, ImgproxyConfig | | src/url.ts | buildImageUrl() and buildSrcSet() — deterministic URL generation | | src/source.ts | createAssetSource() — AssetManager bridge via structural typing | | src/render.ts | imageProps()<img> tag attribute generator | | src/blocks/ | imageBlock and videoBlock definitions | | src/components/ | React contexts and editor components | | src/index.ts | Public API exports |

Design Decisions

  • No runtime dependency on @verevoir/assets — uses structural typing (duck typing).
  • Display, not persistence — never stores data; reads metadata and produces URLs.
  • Deterministic URLs — same inputs always produce the same URL, enabling CDN caching.
  • Unsigned URLs for v1 — HMAC signing reserved for future via key/salt fields.
  • Sharp-free — no image processing. imgproxy handles all resizing at serve time.

Development

npm install    # Install dependencies
make build     # Compile TypeScript
make test      # Run test suite
make lint      # Check formatting