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

@sepveneto/update-check

v0.3.1

Published

定时查询版本更新

Readme

@sepveneto/update-check

定时查询版本更新

兼容性

| Edge | Firefox | Chrome | Safari | | --- | --- | --- | --- | | >= 15 | >= 52 | >= 55 | >= 11 |

使用

pnpm i @sepveneto/update-check
// vite.config.ts
import Starter from '@sepveneto/update-check/vite'

export default defineConfig({
  plugins: [
    Starter({ /* options */ }),
  ],
})

Example: playground/

// webpack.config.js
module.exports = {
  /* ... */
  plugins: [
    require('@sepveneto/update-check/webpack')({ /* options */ })
  ]
}

// vue.config.js
module.exports = {
  configureWebpack: {
    plugins: [
      require('@sepveneto/update-check/webpack').default({ /* options */ }),
    ],
  },
}

// esbuild.config.js
import { build } from 'esbuild'
import Starter from '@sepveneto/update-check/esbuild'

build({
  plugins: [Starter()],
})

// main.ts/main.js
import { onUpdate } from '@sepveneto/update-check'
onUpdate(() => {
  /**
   * 询问用户是否需要刷新页面
   */
})

选项

| 名称 | 类型 | 默认值 | 说明 | | :--- | :--- | :---- | :--- | | timer | number | 60 * 1000 | 检查的间隔,单位毫秒 | | base | string | '' | 版本文件的访问位置 | | cache | no-cache, storage | storage | 文件的缓存策略,默认是强缓存stroag,如果设置为no-cache,则不会携带时间戳 | | once | boolean | false | 是否只在应用打开时检查版本号 | | immediate | boolean | false | 是否在定时器创建时立即执行一次查询 |

关于base: 一般保持与vite中的base或是webpack/vue-cli中的publicPath一致即可,但是当其配置为./auto需要设置为具体的地址

方法

| 名称 | 参数 | 说明 | | :--- | :--- | :-- | | onUpdate | function | 当版本发生变动时执行 | | check | - | 手动向worker下发版本查询任务,如果有更新会触发onUpdate |

原理

  1. 项目构建时在公共目录生成版本文件
  2. 依赖worker创建定时器,向服务器请求版本并比较,当版本变动时通知主线程

注意

  1. 仅通知一次
  2. 一旦版本文件请求失败,会立即销毁线程