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

@cxkit/version-core

v0.0.6

Published

Framework-agnostic runtime core for frontend version update detection and notification.

Readme

@cxkit/version-core

核心的纯净运行时逻辑库,零前端框架依赖,由 TypeScript 保证类型安全。

它是整个 @cxkit 版本检测体系的心脏,负责接管轮询(Poller)、提取(Fetcher)和状态机(State Machine)流转。所有的 React、Vue 或 Vanilla 适配器其实都是基于对 Checker 事件总线的包装。

特色

  • 🚀 极小巧:不包含任何 UI 或是繁杂的依赖。
  • 🔧 零耦合:能够在 Node.js 或任何未知的框架中运行,只要宿主环境支持基础的 fetch 和事件。
  • 无感热更:支持静默拦截 version.json 请求,解析 buildIdbuildTime

安装

npm install @cxkit/version-core

API 概览

createVersionChecker(options: CheckerOptions)

初始化一个版本检查器实例,它是全部单向数据流的源头。

import { createVersionChecker } from '@cxkit/version-core'

const checker = createVersionChecker({
  pollInterval: 1000 * 60 * 5, // 轮询检查的时间间隔
  remindDelay: 1000 * 60 * 60,  // 稍后提醒的延迟时间
  devMock: false,             // 是否开启开发环境 Mock 模式
  refreshStrategy: 'auto',    // 触发更新后刷新页面的策略
  baseUrl: '/',               // version.json 的请求基地址
  versionUrl: (env) => '...'  // 高级:自定义推导版号路径
});

// 订阅事件:每当状态变更时触发
checker.on('state-change', (state) => {
  console.log(state.hasPendingUpdate);
});

// 明确检测到了全新的版本发版
checker.on('update-detected', (manifest) => {
  console.log("新版本来了!", manifest);
});

// 开启轮询
checker.start();

实例控制流方法

  • checker.check(): 挂载立刻执行一次强制检查。
  • checker.confirm(): 接受更新版本通知。通常这会执行你预设或默认的刷新策略并改写本地缓存存储记录。
  • checker.defer(delay?): 稍后提醒。在静默期内,hasPendingUpdate 将保持为假。
  • checker.destroy(): 销毁事件总线及所有计时器轮询,回收内存(通常用于组件销毁生命周期)。

阅读完整文档

完整的 API 定义、高级用法与系统架构解析,请访问 官方开发文档