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

@ricenote/plugin-hello

v1.0.0

Published

RiceNote 最小示例插件:验证插件启停、路由注册与事件订阅

Readme

rice.hello —— Hello 示例插件

用于演示与验证插件 API 的最小示例:它同时用到服务发布、公开路由、事件订阅与后台菜单, 但不持有数据表、不依赖任何插件 —— 适合作为你自己写第一个插件时的参照。

清单摘要

| 项 | 值 | | --- | --- | | id | rice.hello | | version | 1.0.0 | | apiVersion | ^1.0.0 | | entry | ./dist/index.js | | provides | demo.hello@1 | | requires | 无 | | capabilities | routes:public、services:provide、events:publish、events:subscribe、admin:menu | | migrations | 无 | | 数据表 | 无 |

扩展点(Hook)

公开路由

| 方法 | 路径 | 说明 | | --- | --- | --- | | GET | /hello | 返回 JSON:插件 id、版本、启动时间与问候语(支持 ?name=) |

curl 'http://localhost:3000/hello?name=RiceNote'

服务契约(提供)

demo.hello@1:

interface HelloService {
  greet(name: string): string;
  startedAt: string;   // ISO 8601
}

事件

  • 订阅 core.hello.ping.v1:收到后写一条 info 日志(用于演示事件通道与请求 ID 透传)。

后台菜单

{ id: 'demo.hello', label: 'Hello 示例', path: '/hello', icon: 'Sparkles', order: -10, permission: 'plugin.view' }

path 指向的是前台路径而非后台页面,因此左侧导航会退化为普通链接; 这正好演示了"插件可以是任意 path,后台未注册路由时降级为普通链接"的防御行为。

设置项

无。

一个最小插件的完整结构

plugins/official/hello/
├── manifest.json     # 必须:id / version / apiVersion / entry + 能力声明
├── package.json
├── tsconfig.json
├── README.md
└── src/index.ts      # definePlugin({ start, stop })

start(ctx) 中做注册,stop(ctx) 中不需要手动注销 —— ctx.*.register/add/provide/on 返回的句柄由 Core 统一收集并在停用后回收, 停用后残留会被 assertNoLeaks() 判为失败。