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

@warpkit/data

v0.0.6

Published

Reactive data fetching and caching client for WarpKit with Svelte 5 integration

Readme

@warpkit/data

Type-safe data fetching hooks for Svelte 5 with caching and event-driven invalidation.

Installation

bun add @warpkit/data

Features

  • useQuery - Reactive data fetching hook with caching and SWR
  • useMutation - Standalone mutation hook with lifecycle callbacks
  • useData - Query hook with call-site invalidateOn and enabled config
  • Type-safe - Full TypeScript support with registry pattern
  • Caching - Pluggable cache providers with E-Tag support
  • Svelte 5 - Built on runes ($state, $derived, $effect)

Usage

Define Data Registry

// types.ts
declare module '@warpkit/data' {
  interface DataRegistry {
    user: { data: User };
    monitors: { data: Monitor[] };
  }
}

Setup DataClient

import { DataClient } from '@warpkit/data';

const client = new DataClient({
  baseUrl: '/api',
  keys: {
    user: { key: 'user', url: '/user' },
    monitors: { key: 'monitors', url: '/monitors', staleTime: 30000 }
  }
});

Fetch Data with useQuery

<script lang="ts">
  import { useQuery } from '@warpkit/data';

  const monitors = useQuery({ key: 'monitors' });
</script>

{#if monitors.isLoading}
  <Spinner />
{:else if monitors.isError}
  <Error message={monitors.error.message} />
{:else}
  {#each monitors.data as monitor}
    <Monitor {monitor} />
  {/each}
{/if}

Mutations with useMutation

<script lang="ts">
  import { useMutation } from '@warpkit/data';

  const createMonitor = useMutation({
    mutationFn: async (input) => {
      const res = await fetch('/api/monitors', { method: 'POST', body: JSON.stringify(input) });
      return res.json();
    },
    onSuccess: () => warpkit.events.emit('monitor:created')
  });
</script>

<button onclick={() => createMonitor.mutate({ name: 'New' })}>
  Add Monitor
</button>

useData (query + call-site config)

useData is a thin wrapper over useQuery that accepts call-site invalidateOn events and an enabled flag:

<script lang="ts">
  import { useData } from '@warpkit/data';

  const monitors = useData('monitors', {
    invalidateOn: ['monitor:created', 'monitor:deleted'],
    enabled: () => !!userId
  });
</script>

API

useQuery(options)

Returns reactive query state: data, isLoading, isError, error, isSuccess, isRevalidating, refetch().

useData(key, config)

Same return shape as useQuery. Config accepts invalidateOn?: string[] and enabled?: boolean | (() => boolean).

useMutation(options)

Returns mutation state: mutate(), mutateAsync(), isPending, isSuccess, isError, error, data, reset().

DataClient

Options:

  • baseUrl - API base URL
  • cache - Cache provider (optional)
  • keys - Data key configurations
  • onRequest - Request interceptor
  • retryOn429 - Auto-retry on 429 (default: true)
  • maxRetries - Max 429 retries (default: 3)