Skip to content

bundle window

Eugene Lazutkin edited this page Jul 5, 2026 · 1 revision

Bundle window

Transparent request bundling for pages that do not run double-meh: eligible GET fetch events collect in a micro-window, ride one PUT to a double-meh-bundler endpoint, and fan back out — wire format v1.

import {createBundleWindow} from 'double-meh-sw/bundle-window.js';

const window = createBundleWindow({url: '/bundle', waitTime: 10});
const response = await window.intake(request);

Through the assembly it activates with bundler: {url, match}; pages that announced double-meh over io:hello are never bundled (client-wins).

Options

Option Default Meaning
url The bundler endpoint. Required.
waitTime 10 The micro-window, ms.
maxSize 20 A window reaching this flushes immediately.
minSize 2 Below this the flush degrades to direct fetches.
onPart Observes every non-synthetic part — the assembly writes them through to the cache tier.

Degradation is the contract

Every failure path resolves waiters with direct fetches, never synthetic errors: a lone request below minSize, a failed or malformed bundler response (the whole window), an omitted part (that waiter alone). A transparent adornment must never hand a page an error it didn't earn — error semantics belong to page libraries, and pages with one aren't bundled here in the first place.

See also: The assembly, Cache tier.

Clone this wiki locally