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

@weave-framework/data

v3.4.1

Published

Weave data — signal-native async resources + a tiny fetch client. Zero third-party deps.

Readme

@weave-framework/data

Weave data — signal-native async resources + a tiny fetch client. Zero third-party deps.

Part of Weave — a fine-grained reactive, signal-native UI framework: no Virtual DOM, zero third-party runtime dependencies.

npm install @weave-framework/data

Most apps get this (and the rest of Weave) in one step:

npm create weave@latest my-app

Resources

A resource turns an async fetcher into reactive { data, loading, error } — plus refetch and mutate. Drive it from a reactive source and it re-fetches when that source changes, aborting the previous request.

import { resource } from '@weave-framework/data';

// Standalone: fetch once.
const users = resource(async (_, { signal }) => {
  const res = await fetch('/api/users', { signal });
  return res.json();
});

// Source-driven: re-fetches whenever `userId()` changes.
const user = resource(
  () => userId(),
  async (id, { signal }) => (await fetch(`/api/users/${id}`, { signal })).json()
);

user.loading(); // reactive
user.data();    // reactive — undefined until the first fetch resolves
user.error();   // reactive
user.refetch();

A source of undefined, null, or false means "not ready" and skips the fetch. Pass { initialValue } to seed data() before the first resolve. The shape is @await-compatible, so @await (user) renders pending / value / error branches straight from a template.

The client

createClient gives you get / post / put / patch / delete (and a generic request) over a shared config. Its methods are ready-made resource fetchers.

import { createClient, HttpError } from '@weave-framework/data';

const api = createClient({
  baseUrl: '/api',
  headers: () => ({ Authorization: `Bearer ${token()}` }), // called per request
});

await api.get('/users', { params: { page: 2 } });
await api.post('/users', { name: 'Ada' }); // JSON body + Content-Type set for you

A non-2xx response throws an HttpError carrying status, statusText, and the raw Response. interceptors is a functional chain — each gets (req, next) and may read or replace the request, inspect or retry the response, or short-circuit without calling next. The first interceptor is outermost.

Mutations

action wraps a mutation with reactive pending / error / result. Overlapping runs are safe — only the latest updates the signals, while every caller still gets its own promise back.

import { action } from '@weave-framework/data';

const save = action((values: Draft) => api.post('/posts', values));

await save.run(draft);
save.pending(); // reactive
save.error();   // reactive

optimistic(base, reduce?) layers in-flight updates over a base value and clears them automatically once base next changes. Call it inside an owner (a component's setup) so its watcher disposes on unmount.

📚 Guides + full API reference: Recipes · API reference

License

MIT