@webgrip/astro-site-toolkit (0.2.1)
Installation
@webgrip:registry=npm install @webgrip/astro-site-toolkit@0.2.1"@webgrip/astro-site-toolkit": "0.2.1"About this package
@webgrip/astro-site-toolkit
Build-time guards and rigs shared by Webgrip Astro static sites. Extracted after the two sites' copies of the CSP validator diverged 125 vs 171 lines within a month — copy-reuse demonstrably fails for these; this package is reference-reuse.
Bins
webgrip-validate-csp [dist]— asserts every governed inline script AND stylesheet is authorised by its page's own meta CSP, per directive (a style-src hash cannot authorise a script). Wire into the build:"build": "astro build && webgrip-validate-csp".webgrip-serve-dist [dist]— serves dist/ with Cloudflare's auto-trailing-slash semantics and gzip, for Lighthouse rigs that must measure the site, not the server.PORT=0binds ephemerally; the bound port is printed.
Axe engine
// scripts/axe-scan.ts — the thin per-site file that stays in the consumer:
import { runAxeScan } from '@webgrip/astro-site-toolkit/axe-engine';
await runAxeScan({
// Pages that matter for a11y but carry no Lighthouse budget — with each
// site's own argued rationale. This is exactly the part that must NOT be
// shared.
a11yOnlyPages: ['/404.html'],
});
Ships TypeScript declarations (lib/axe-engine.d.mts), so a strict consumer needs no shims.
Peer deps (consumer installs): @axe-core/playwright, playwright-core. The page list is
read from lighthouserc.json so the two gates cannot drift apart.
Dependencies
Peer dependencies
| ID | Version |
|---|---|
| @axe-core/playwright | ^4.10.0 |
| playwright-core | ^1.50.0 |
Details
Assets (1)
Versions (7)
View all
astro-site-toolkit-0.2.1.tgz
6.9 KiB