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

@dathomir/reactivity

v0.0.1-beta.1

Published

dathomir reactivity package

Readme

@dathomir/reactivity

@dathomir/reactivityalien-signals の低レベル API(alien-signals/system)を土台にしたリアクティビティ層です。TC39 Signals 提案に近い signal / computed / effect インターフェイスを提供し、設定なしで軽量・高速なリアクティビティを構築できます。

特徴

  • signal.value プロパティと set / update メソッドを備えたオブジェクトを生成します。
  • computed は依存するシグナルに追従し、自動的に再計算される value を提供します。
  • effect は依存するシグナルの変化を監視し、副作用を実行します。戻り値のクリーンアップ関数で停止可能です。
  • batch で複数更新をまとめて通知できます。
  • peek() でトラッキングなしに現在値へアクセスできます。

使い方

import { signal, computed, effect, batch } from '@dathomir/reactivity';

const count = signal(0);
const doubled = computed(() => count.value * 2);

const stop = effect(() => {
  console.log(`${count.value} is effected`);
});

console.log(doubled.value); // 0

count.set(prev => prev + 1);
console.log(count.value);   // 1
console.log(doubled.value); // 2

batch(() => {
  count.value = 5;
  count.value = 10;
});

stop();

信号 API

signal(initialValue)

  • value: 現在値(getter/setter 両対応)
  • set(next):
    • 直接値、または (prev) => next 形式の更新関数を渡せます。
  • update(updater):
    • set の関数呼び出し版。返り値はなく、値を更新します。
  • peek():
    • 依存関係をトラッキングせずに現在値を取得します。

computed(getter)

  • value: 最新の計算結果。
  • peek(): トラッキングなしで現在値を取得。

effect(callback)

  • 依存するシグナルが更新されるたびに callback を再実行します。
  • 戻り値はクリーンアップ関数。呼び出すとエフェクトが停止します。

batch(fn)

  • fn 内の更新通知を遅延させ、一括で再計算を行います。

実装メモ

  • createReactiveSystem を介して alien-signals の伝播アルゴリズムを再利用しています。
  • 追加した Signal / Computed / Effectkind フラグを持ち、alien-signals のフラグ管理と共存するよう調整しています。
  • peek() は内部的にトラッキングを無効化することで副作用を発生させず安全に値を読み取ります。

ライセンス

本パッケージは MPL-2.0 ライセンスに基づいて提供されます。内部で使用している alien-signals は MIT ライセンスです。