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

huawei-sample-plugin

v1.0.6

Published

A simple whistle plugin example

Readme

Huawei Sample Whistle Plugin

这是一个简单的 Whistle 插件示例,用于演示插件的基本功能。

插件信息

  • 插件名称: whistle.huawei-sample-plugin
  • 版本: 1.0.4
  • Options 页面 URL: http://127.0.0.1:8899/whistle.huawei-sample-plugin/

注意: Options 页面 URL 必须使用 whistle. 前缀,而不是 plugin. 前缀。

功能特性

  • 支持 sample://test 协议请求处理
  • 支持 HTTP 路径 /sample-plugin-test 访问
  • 支持域名 http://test.sample-plugin.com/ 的请求处理

使用方法

在 Whistle 规则配置中添加以下任意规则:

sample://test your-target-url
your-domain.com/sample-plugin-test sample://test  
test.sample-plugin.com http://your-target-server

安装与调试

插件必需文件

Whistle 插件必须包含以下关键文件:

.
├── lib/
│   └── index.js          # 插件主逻辑文件
├── public/
│   └── index.html        # Options 页面入口文件
├── whistle.js            # ⭐ 插件配置文件(必需)
├── package.json          # 插件元数据
└── README.md             # 本说明文件

whistle.js 文件内容

module.exports = {
  main: require('./lib/index.js'),
  ui: './public'
};

安装插件

# 方式1: 通过npm安装(如果已发布到npm)
w2 plugin install whistle.huawei-sample-plugin

# 方式2: 本地开发安装(创建符号链接)
# 在 ~/.whistle/plugins 目录下创建指向本项目的符号链接
ln -s /path/to/your/sample-plugin ~/.whistle/plugins/whistle.huawei-sample-plugin

重启服务

修改插件代码后,需要重启 Whistle 服务才能生效:

w2 restart

验证插件

  1. 访问 Whistle 管理界面: http://127.0.0.1:8899/
  2. 点击 "Plugins" 标签页,确认插件已加载
  3. 访问 Options 页面: http://127.0.0.1:8899/whistle.huawei-sample-plugin/

常见问题

Q: 访问 Options 页面返回 404

A: 请检查以下几点:

  1. URL 是否正确: 确保使用 whistle.huawei-sample-plugin 而不是 plugin.huawei-sample-plugin
  2. public 目录是否存在: 确认插件根目录下存在 public/index.html 文件
  3. whistle.js 配置文件: 确认存在 whistle.js 文件并正确配置了 ui: './public'
  4. 服务是否重启: 修改文件后执行 w2 restart 重启服务
  5. 插件是否加载: 在 Plugins 页面确认插件状态

Q: 插件规则不生效

A:

  • 确认 Whistle 规则配置正确
  • 检查插件是否在 Plugins 页面显示为已启用状态
  • 重启 Whistle 服务

目录结构

.
├── lib/
│   └── index.js          # 插件主逻辑文件
├── public/
│   └── index.html        # Options 页面入口文件
├── whistle.js            # 插件配置文件(必需)
├── package.json          # 插件元数据
└── README.md             # 本说明文件