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

@stackra/decorators

v2.0.0

Published

Centralised decorator library for the Stackra framework — generic factories for class-level, method-level, and property-level metadata decorators, plus domain wrappers (@OnEvent, @Cacheable, @Route, @Widget, ...). Feature packages import from here to stay

Readme

@stackra/decorators

Centralised decorator library for the Stackra framework.

Purpose

Feature packages that want to CONTRIBUTE a discoverable class or method (an analytics provider, an event listener, a cache store, ...) should NOT need to depend on the runtime package that OWNS the loader for that concern. @stackra/decorators breaks the coupling.

  • Each runtime package (e.g. @stackra/cache, @stackra/events) owns the runtime that reads stamped metadata via discovery.getProvidersByMetadata(...).
  • @stackra/decorators owns the stamping side — the class / method / property decorators that write the metadata.
  • @stackra/contracts owns the metadata keys + options interfaces.

Result: a package like @stackra/analytics can ship a decorated provider by importing from @stackra/decorators/<domain> without ever loading the loader runtime that consumes it.

API — factories

Import from @stackra/decorators/core:

  • createDiscoverableClassDecorator(metadataKey, overrides?) — class-level, auto-applies @Injectable(), stamps options under metadataKey. Optional secondary discoveryKey for a boolean marker.
  • createMetadataClassDecorator(metadataKey, overrides?) — same as above but does NOT apply @Injectable(). Used for DTOs and policies (@Setting, @CspPolicy, @Route).
  • createDiscoverableMethodDecorator(methodMetadataKey, toOptions, overrides?) — method-level. Stamps per-method options on the prototype. Optional classDiscoveryKey marker on the constructor so class-level discovery can find candidate classes.
  • createMapAccumulatorPropertyDecorator(metadataKey, overrides?) — property-level. Maintains a Map<propertyKey, Entry> on the constructor with optional toEntry transform and merge strategy for repeated applications.
  • createMetadataReader(metadataKey) — companion reader helper returning { get, has, hasOwn }. Inheritance-aware.

Domain wrappers

Each domain barrel exports the specific decorators for that concern:

  • @stackra/decorators/cacheCacheable, CacheEvict, ...
  • @stackra/decorators/dashboardWidget.
  • @stackra/decorators/eventsOnEvent.
  • @stackra/decorators/http — HTTP-layer decorators.
  • @stackra/decorators/loggerReporter.
  • @stackra/decorators/queue — queue processor decorators.
  • @stackra/decorators/routingRoute, AsController.
  • @stackra/decorators/sdui — SDUI component + layout stamps.

More domain wrappers land as their runtime packages get promoted.

Inheritance semantics

Metadata is stored via @vivtel/metadata on top of reflect-metadata. Standard Reflect.getMetadata semantics apply:

  • Class-level decorators: subclass inherits parent's stamp through the prototype chain. Re-decorating the subclass writes to the subclass's own metadata slot — child wins for that class, parent's stamp remains untouched.
  • Method-level decorators: metadata is stamped on the prototype[method] pair. If the subclass inherits the method (does NOT override), lookup walks the chain and finds the parent's stamp. If the subclass overrides + re-decorates, its own stamp wins for that method.
  • Property-level (Map-accumulator) decorators: the Map lives on the constructor. Subclasses that re-decorate get their OWN Map; the parent's Map is unaffected. Domain readers can merge across the chain if needed via hasOwnMetadata + prototype walk.

Why this package exists

Before: every feature package that wanted to contribute a discoverable class would import from the OWNING runtime package purely for the decorator, adding that runtime as a peer dep even when the feature package didn't need any of the runtime's services.

After: feature packages import from @stackra/decorators/<domain>. Their dependency chain is contracts + container + decorators. The runtime packages that OWN the loader — the ones that actually surface the discovery

  • registry semantics — stay as peers of the CONSUMING app, not of every individual feature package.