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

@hello-terrain/work

v0.1.1

Published

A small reactive task graph library for scheduling dependent computations.

Readme

@hello-terrain/work

npm version

A small reactive task graph for typed async computations.

Quick start

import { graph, param, task } from "@hello-terrain/work";

const value = param(2);

const calcSquare = task((get, work) => {
  const currentValue = get(value);
  return work(() => currentValue * currentValue);
});

const calcGraph = graph();
calcGraph.add(calcSquare);

await calcGraph.run();
calcGraph.get(calcSquare); // 4

value.set(4);

await calcGraph.run();
calcGraph.get(calcSquare); // 16

Semantics

  • Dependency tracking: tasks discover dependencies by calling get(ref) before work(...).
  • Targets must be registered: tasks passed as targets must be registered via g.add(task).
  • Upstream tasks referenced by get(otherTask) are registered automatically when discovered.
  • cache:"none":\n - the task recomputes on every run\n - any downstream tasks are treated as dirty every run\n - within a run, downstream tasks can still depend on values computed earlier in the run

Lanes and laneConcurrency

Tasks can be tagged with a lane (default "cpu"). Lanes become meaningful when you pass laneConcurrency to graph.run(), which enables per-lane concurrency limits for that run.

  • If laneConcurrency is omitted (or {}), tasks are not throttled by lane.
  • If laneConcurrency is provided and non-empty, tasks acquire a permit for their lane before running. Lanes not listed in laneConcurrency default to 1 permit.
import { graph, task } from "@hello-terrain/work";

const cpuTask = task((_get, work) => work(() => expensiveCompute()))
  .lane("cpu")
  .displayName("cpuTask");

const ioTask = task(async (_get, work, ctx) =>
  work(async () => fetch("https://example.com", { signal: ctx.signal })),
)
  .lane("io")
  .displayName("ioTask");

const g = graph();
g.add(cpuTask);
g.add(ioTask);

await g.run({
  targets: [cpuTask, ioTask],
  laneConcurrency: {
    cpu: 2,
    io: 8,
  },
});

Benchmarks

This package uses mitata for microbenchmarks:

pnpm --filter @hello-terrain/work bench

Project Architecture

This library uses unbuild for building.

  • src/index.ts is the main entry point for your library exports
  • Add your library code in the src folder
  • tests/ contains your test files

Libraries

The following libraries are used - checkout the linked docs to learn more

  • unbuild - Unified JavaScript build system

Tools

  • Vitest - Fast unit test framework powered by Vite
  • Oxlint - A fast linter for JavaScript and TypeScript
  • Oxfmt - Fast Prettier-compatible code formatter

Development Commands

  • pnpm install to install the dependencies
  • pnpm run build to build the library into the dist folder
  • pnpm run test to run the tests
  • pnpm run release to build and publish to npm

This library was generated with create-krispya