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

@myfinal/module-runtime

v0.2.5

Published

[Dian](https://github.com/FinalDevHQ/Dian) 框架的模块生命周期管理,提供 `Module` 接口和 `HookBus` 广播/管道机制。

Readme

@myfinal/module-runtime

Dian 框架的模块生命周期管理,提供 Module 接口和 HookBus 广播/管道机制。

安装

npm install @myfinal/module-runtime

使用

Module 接口

import type { Module } from "@myfinal/module-runtime";

class MyModule implements Module {
  readonly name = "my-module";

  async setup() {
    // 启动逻辑
  }

  async teardown() {
    // 清理逻辑
  }
}

HookBus

import { HookBus } from "@myfinal/module-runtime";

const bus = new HookBus();

// 广播模型:并发触发所有 handler
bus.register("bot:ready", async (botId) => {
  console.log(`Bot ${botId} 已就绪`);
});
await bus.broadcast("bot:ready", "my-bot");

// 管道模型:顺序传递,每个 handler 可修改值
bus.register("message:filter", async (text) => text.trim());
const result = await bus.pipe("message:filter", "  hello  ");
// result => "hello"

API

Module 接口

| 方法 | 说明 | |------|------| | setup() | 模块启动,由 ModuleManager 调用 | | teardown() | 模块停止,由 ModuleManager 调用 |

HookBus

| 方法 | 说明 | |------|------| | register(hook, handler) | 注册 hook handler | | unregister(hook, handler) | 注销 hook handler | | broadcast(hook, ...args) | 并发触发所有 handler(fire-and-forget) | | pipe(hook, value) | 顺序管道,每个 handler 接收并返回修改后的值 |

相关包