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

@pwa-platform/engine-workbox

v0.4.3

Published

Internal Workbox precache and runtime-cache engine for PWA Platform.

Readme

@pwa-platform/engine-workbox

PWA Platform 的内部 Workbox 引擎:在构建期注入预缓存清单,在 worker 中提供预缓存和受限运行时缓存端口。

谁会使用

业务应用通常不直接安装或调用本包。@pwa-platform/vite 和 @pwa-platform/sw-runtime 会按平台计划组装它。需要开发新的 worker 运行时或构建适配器时才直接使用。

npm install @pwa-platform/engine-workbox

要求 Node.js 22 或更高版本。

入口

@pwa-platform/engine-workbox

Node/构建期入口:

| 导出 | 作用 | | --- | --- | | WORKBOX_INJECTION_POINT | 固定注入点 self.__WB_MANIFEST | | injectPrecacheManifest(workerSource, plan) | 把计划中的预缓存条目注入已生成的 worker 源码 |

@pwa-platform/engine-workbox/worker

Service Worker 入口:

| 导出 | 作用 | | --- | --- | | createPrecacheEngine(options) | 创建 install/activate/match 所需的预缓存引擎 | | createRuntimeCacheEngine(options) | 创建带容量、时效和策略限制的运行时缓存引擎 | | PwaPrecacheEngine* | 预缓存输入、安装与激活结果类型 | | PwaRuntimeCacheEngine* | 运行时缓存选项、命中和响应结果类型 |

import { injectPrecacheManifest } from "@pwa-platform/engine-workbox";
import { createPrecacheEngine } from "@pwa-platform/engine-workbox/worker";

两个入口对应不同运行环境,不应把 worker 入口导入 Node 构建代码,也不应把构建入口打进 Service Worker。

平台约束

  • 本包只接受平台编译出的精确条目和限制,不向业务暴露任意 Workbox route、plugin 或 callback 配置。
  • 运行时缓存不会决定一个请求是否安全;请求分类、同源/GET 基线拒绝和响应准入由 @pwa-platform/sw-runtime 完成。
  • cache-first 只用于预缓存和允许的静态资源;公共数据运行时缓存只支持平台批准的 network-first 与 stale-while-revalidate 路径。
  • opaque、重定向、超限、过期或不满足响应头要求的结果不会因为使用 Workbox 而绕过平台策略。

什么时候不要用

如果目标是给 Vite + Vue/React 应用接入 PWA,请使用 @pwa-platform/vite 与对应框架包。若你需要完全自由的 Workbox 配置,本平台的受限引擎并不是通用 Workbox 封装。

完整缓存边界见公共读取缓存和缓存安全模型。

License: MIT.