double-meh-sw
v1.0.0
Published
Service-worker sibling of double-meh: shared cache tier, cross-tab request coalescing, transparent bundling, invalidation hub, and version upgrades — composable modules plus a ready assembly. Works with or without double-meh.
Maintainers
Readme
double-meh-sw :// 
The service-worker sibling of double-meh: one worker owning what only a service worker can — a shared cache tier served to every tab (and to code that has never heard of double-meh), cross-tab request coalescing (identical concurrent GETs collapse to one wire call), transparent request bundling for pages without the library, an invalidation hub, a version-upgrade flow, and the io:fetch message transport whose requests survive page navigation.
Docs: browse the wiki · search it.
Composable modules plus a ready assembly — compose into an existing service worker, or deploy the assembly directly:
// sw.js — bundle this, serve the output from your origin, register it with {type: 'module'}
import {install} from 'double-meh-sw/sw.js';
install({
version: '2026.07.04',
cache: {cacheName: 'app-shared'},
bundler: {url: '/bundle', match: '/api/'} // transparent bundling via double-meh-bundler
});A module service worker does not resolve bare specifiers — an unbundled worker with the import above
fails to register. Bundle it, or import by URL (/node_modules/double-meh-sw/src/sw.js).
Everything degrades to plain fetches by design: bundler trouble, missing parts, or the worker being absent entirely (first visit, hard reload) must be logically invisible — the whole package is a performance adornment, never a semantic layer. Pages running double-meh announce themselves over io:hello and keep ownership of their own bundling (the SW passes them through); pages without it get zero-integration acceleration.
Install
npm i double-meh-swThe pieces
| Module | What it owns |
| -------------------------------------- | -------------------------------------------------------------------------- |
| double-meh-sw/sw.js | install(options) — wires fetch/message/activate on the worker scope |
| double-meh-sw/cache-tier.js | The shared Cache API tier: serve-first, opt-in store, pattern invalidation |
| double-meh-sw/coalesce.js | Cross-tab in-flight coalescing |
| double-meh-sw/bundle-window.js | Micro-window bundling (the double-meh wire format v1) |
| double-meh-sw/messages.js | io:hello / io:invalidate / io:version / io:upgrade / io:fetch |
| double-meh-sw/contract.js, wire.js | The message contract and the bundle wire format |
The ecosystem: double-meh (the client), double-meh-bundler (the server endpoint), and this worker between them — each useful alone, better together.
Zero runtime dependencies. ESM. Browser service workers are the product; Node ≥ 18, Bun, and Deno run the test suite (injected scope/fetch/caches), and npm run test:e2e drives a real Chromium against the real bundler and the published client.
Release history
- 1.0.0 The initial release: shared cache tier, cross-tab coalescing, transparent bundling, the
io:*message contract, and a transport that can negotiate a streamed body.
See the release notes for the long-form history.
License: BSD-3-Clause.
