Contributing
Issues and pull requests are welcome at github.com/webmaxru/offlibrary. Please add tests for behaviour changes and keep the size budget green.
The library
Section titled “The library”git clone https://github.com/webmaxru/offlibrary && cd offlibrarynpm installnpm test # unit tests (Vitest)npx playwright-core install chromiumnpm run test:e2e # real Background Fetch, the fallback and a Workbox SW in Chromiumnpm run typecheck && npm run build && npm run sizenpm run check:package # pack, install and type-check as a consumer wouldnpm run demo # the demo app at http://127.0.0.1:5173- The e2e suite needs full Chromium in new headless mode;
chrome-headless-shellexposes Background Fetch but never completes one. SetCHROMIUM_PATHto use a specific binary. - Size budgets (gzip):
offlibrary11 KB,offlibrary/sw4.5 KB,offlibrary/workbox4.5 KB, and 2 KB for the Workbox route alone.npm run sizeenforces them in CI. - Public API changes need TSDoc comments: the API reference is generated from them.
This site
Section titled “This site”The site lives in website/ and is built with Astro and Starlight. The API pages are generated from the library’s source with TypeDoc through starlight-typedoc.
npm run demo:build # in the repo root: builds demo/dist, copied into the site under /demo/cd websitenpm installnpm run dev # http://localhost:4321/offlibrary/npm run build # dist/, with the demo under dist/demo/npm run check:links # every internal link and asset in dist/ resolvesEvery page has an Edit page link at the bottom. The site and the demo deploy to GitHub Pages from main with the Docs site + demo → GitHub Pages workflow.
Design notes
Section titled “Design notes”- docs/ANALYSIS.md: the analysis behind the design.
- docs/ROADMAP.md: what’s shipped and what’s next.
- RELEASING.md: how releases are published.
License
Section titled “License”MIT © Maxim Salnikov. The range-request handling was inspired by workbox-range-requests (MIT); no code was copied. Demo audio: LibriVox, public domain.