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

@starci/next-data

v0.1.0

Published

The data helpers of a StarCi Next.js front end over SWR, as pure logic with no component: the pollingRestart middleware (a function refreshInterval that stopped at 0 starts again when newer data makes it answer above 0), the viewer and tenant key helpers

Readme

@starci/next-data

The data helpers of a StarCi Next.js front end over SWR: pure logic and one middleware, no component, no class string, no lifecycle of its own (FE-PACKAGES-2). Each operation's SWR hook stays in the app (FE-DATA-SWR): it reads the store, builds its key with the helpers below and calls the transport.

| export | what it is for | |---|---| | pollingRestart | SWR middleware. A function refreshInterval that answered 0 is never scheduled again by SWR; this starts it again when newer data makes it answer above 0. A numeric or absent interval is untouched. | | viewerSwrConfig(defaults) | the SWRConfig value of the provider keyed by the viewer: the defaults, pollingRestart in use, a fresh cache Map per mount | | viewerCacheKey(viewerId) | the key of that SWRConfig: "pending" before the session answers, "signed-out", or the user id, so a change of person remounts the cache | | viewerKey(name, viewerId), viewerKeyId | the key of a viewer-scoped read, [name, viewer], null until the session answers | | tenantKey(name, tenantId, rest, enabled?), tenantParamsKey, tenantRequestKey | the key of a tenant-scoped read: [name, tenantId, ...], null while an input is missing | | createViewerCache() | the writes to the cache of the viewer on screen (bind, unbind, mutate); SWR's exported mutate is bound to the default cache and reaches none of the viewers' |

In an app

// modules/viewer-cache/index.ts: the one instance
export const viewerCache = createViewerCache()

// components/providers/AppProviders: one SWR cache per viewer
const ViewerCacheBinding = () => {
    viewerCache.bind(useSWRConfig().mutate)
    return null
}
<SWRConfig key={viewerCacheKey(viewerId)} value={viewerSwrConfig({ focusThrottleInterval: 30_000 })}>
    <ViewerCacheBinding />
    {children}
</SWRConfig>

// hooks/workspaceKey/useWorkspaceKey.ts: the app's hook reads the store, the package builds the key
export const useWorkspaceKey = <Rest extends readonly (string | null)[]>(name: string, rest: Rest, enabled = true) =>
    tenantKey(name, useAppSelector((state) => state.workspace.activeWorkspaceId), rest, enabled)

The package pins no SWR or React: swr (>= 2) and react (>= 18) are peers, the versions of the app's stack.

Tests

npm test typechecks, lints and runs the node:test specs under 90% line coverage; the middleware spec drives real SWR in jsdom.