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

resource-registry

v0.1.0

Published

A metadata registry keyed by JSON-LD IRI, with similarity lookup by type and tags.

Readme

resource-registry

A metadata registry keyed by JSON-LD IRI, with similarity lookup for when the exact IRI is unknown.

The problem it solves: an application declares "resources" — the description of a data type, its view, its form — and later needs to find the right one from an item returned by the API. Sometimes the IRI is enough; often all you know is the type, or the intended usage.

import { createResource, getResource, searchMetaData } from "resource-registry"

createResource("articles", {
  "@type": "Article",
  "@for": ["blog", "public"],
  name: "Articles",
})

getResource("articles") // by exact IRI
searchMetaData({ "@id": "", "@type": "Article" }) // by similarity

Installation

pnpm add resource-registry

jsonld-item is a dependency; no React, no framework.

API

createResource(iri, resource)

Registers a resource under its IRI and returns the built object. Reusing the same IRI replaces the previous entry.

const articles = createResource("articles", { "@type": "Article" })
// → { "@id": "articles", "@type": "Article" }

getResource(iriOrItem)

Reads a resource by IRI. Accepts either the string or any JSON-LD object carrying an @id — convenient when starting from an item returned by the API.

searchMetaData(query)

Finds the resource closest to a query. An exact IRI match always wins; otherwise each candidate is scored:

| Criterion | Points | | --- | --- | | Same @type | 20 | | Each shared @for tag | 10 |

The highest score wins, and a score of zero returns nothing. Two shared tags are therefore worth exactly as much as a type match; on a tie, the resource registered first is kept.

createResource("articleCard", { "@type": "Article", "@for": ["list"] })
createResource("articleFull", { "@type": "Article", "@for": ["detail"] })

searchMetaData({ "@id": "", "@type": "Article", "@for": ["detail"] })
// → articleFull (20 + 10) over articleCard (20)

The @for tag exists to hold several resources of the same type apart by usage: a compact card for a list, a full sheet for a detail page.

resourceRegistered

The registry itself, exposed so you can iterate it or clear it in tests.

Object.values(resourceRegistered).filter((r) => r["@type"] === "Article")

One registry per application

resourceRegistered is a module-level singleton. Two copies of the package in node_modules would mean two registries: a resource registered on one side would be invisible from the other.

Libraries consuming this package must therefore declare it as a peerDependency, never a dependency — as react-data-form does, registering its forms alongside the application's own resources.

Development

pnpm install
pnpm test
pnpm typecheck
pnpm lint
pnpm build

License

MIT