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

swpp-backends

v3.1.1

Published

Generate a powerful ServiceWorker for your website.

Readme

swpp logo

官方文档:https://swpp.kmar.top/

什么是 swpp

swpp(Service Worker Plus Plus)是一个现代化的 Service Worker 生成工具,专注于为静态网站提供精准、高效的缓存控制和离线访问能力。

与传统的 Service Worker 工具相比,swpp 提供了更细粒度的控制能力和更灵活的配置选项,让开发者能够精确管理网站资源的缓存策略。

核心特性

精准缓存控制

  • 智能缓存规则匹配:基于 URL 模式的精细化缓存策略配置
  • 缓存过期时间管理:可为不同类型的资源设置独立的过期时间
  • 增量更新机制:只更新发生变化的资源,避免全量刷新

性能优化

  • URL 竞速加载:同时请求多个 CDN 源,使用最快响应的资源
  • 备用 URL 机制:主资源加载失败时自动切换到备用地址

高度可定制

  • 模块化配置:将 Service Worker 功能拆分为独立的配置模块
  • TypeScript 支持:完整的类型定义,提供更好的开发体验
  • 全面开放:允许用户修改生成的 Service Worker 文件中任意一处代码

swpp 与 hexo-offline 对比

hexo-offline 是基于 Workbox 构建的 Hexo 插件,采用预缓存(precaching)的工作方式,与 swpp 的设计理念存在本质区别:

swpp 设计目标是在提供一系列内置的常用操作的前提下,尽可能地允许用户自定义 Service Worker 的行为,离线访问只是缓存控制产生的“副作用”; hexo-offline 的设计目标是实现网站的离线访问。

| 特性 | swpp | hexo-offline | |----------|----------------------|-------------------| | 核心技术 | 自研 Service Worker 框架 | 基于 Google Workbox | | 配置方式 | 可编程配置,支持 TypeScript | JSON/CJS 配置文件 | | 缓存策略 | 细粒度 URL 规则匹配 | 文件扩展名模式匹配 | | 更新机制 | 智能增量更新 | 全量预缓存更新 | | 性能特性 | URL 竞速、备用地址 | 基础缓存策略 | | 定制能力 | 高度可定制,完全控制 | 零配置开箱即用 | | 适用场景 | 复杂网站、高性能要求 | 简单博客、快速部署 |

选择建议

如果你:

  • 希望对动态资源(如 API 响应、用户内容)的缓存进行精细策略控制;
  • 重视代码的透明度和可审计性,希望完全理解底层逻辑;
  • 享受深入技术细节、亲手构建网络层控制逻辑的过程;
  • 在个人项目或技术实验中探索 Service Worker 的潜力

那么 swpp 是一个非常值得一试的选择。

社区支持

  • GitHub Issues:报告问题和功能请求
  • QQ 群:545028909(官方技术支持群)