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

@yiero/gmlib

v0.4.6

Published

GM Lib for Tampermonkey/ScriptCat

Downloads

1,371

Readme

GmLib

Tampermonkey / ScriptCat 脚本开发辅助函数库

封装常用的油猴 API,简化脚本开发流程。提供网络请求、DOM 操作、存储管理、UI 工具等功能模块。

安装

pnpm add @yiero/gmlib
# 或
npm install @yiero/gmlib

快速开始

import { onKeydown, gmRequest, elementWaiter, Message } from '@yiero/gmlib';

// 等待元素出现
const button = await elementWaiter('#submit-button');

// 监听快捷键
onKeydown(() => {
    console.log('Ctrl+S pressed');
}, { key: 's', ctrl: true });

// 发送跨域请求
const response = await gmRequest({
    method: 'GET',
    url: 'https://api.example.com/data',
});

// 显示消息通知
Message.success('操作成功');

API 文档

API - 网络请求

| 函数 | 说明 | | :--- | :--- | | getCookie | 获取网站 Cookie | | gmDownload | 下载文件到本地 | | gmRequest | 通过 GM_xmlhttpRequest 发送网络请求 (Promise) | | hookXhr | 劫持 XHR 请求,获取并篡改返回内容 |

DOM - 元素操作

| 函数 | 说明 | | :--- | :--- | | elementGetter | 通过定时器轮询获取元素 | | elementWaiter | 等待元素加载完成 | | extractDOMInfo | 从 DOM 节点批量提取数据 | | scroll | 页面滚动到指定位置 | | setValue | 设置输入框的值(绕过框架拦截) | | simulateClick | 模拟鼠标点击 | | simulateKeyboard | 模拟键盘输入 |

UserInteraction - 用户交互

| 函数 | 说明 | | :--- | :--- | | Message | 消息通知组件 | | gmMenuCommand | 油猴菜单命令管理 | | onKeydown | 监听键盘按下事件 | | onKeydownMultiple | 批量监听多个键盘快捷键 | | onKeyup | 监听键盘释放事件 | | onKeyupMultiple | 批量监听多个键盘释放事件 | | onRouteChange | 监听页面路由变化 |

Env - 环境检测

| 函数 | 说明 | | :--- | :--- | | environmentTest | 检测脚本运行环境 (ScriptCat / Tampermonkey) | | isIframe | 判断当前页面是否在 iframe 中 |

Storage - 存储管理

| 函数/类 | 说明 | | :--- | :--- | | createUserConfigStorage | 将 ScriptCat 用户配置转换为 GmStorage 存储对象集合 | | GmStorage | 油猴存储管理基类 | | GmArrayStorage | 数组存储管理,GmStorage 子类 | | GmObjectStorage | 对象存储管理,GmStorage 子类 |

UI - 界面工具

| 函数 | 说明 | | :--- | :--- | | uiImporter | 解析并载入 HTML/CSS 文本 |

开发

# 安装依赖
pnpm install

# 开发模式 (监听文件变化)
pnpm dev

# 构建
pnpm build

# 代码检查
pnpm check

# 运行测试
pnpm test

许可证

MIT

链接