@webgrip/astro-site-toolkit (0.2.0)

Published 2026-09-04 11:23:16 +00:00 by webgrip-ci in webgrip/frontend-toolkit

Installation

@webgrip:registry=
npm install @webgrip/astro-site-toolkit@0.2.0
"@webgrip/astro-site-toolkit": "0.2.0"

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=0 binds 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'],
});

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
npm
2026-09-04 11:23:16 +00:00
3
MIT
6.7 KiB
Assets (1)
Versions (7) View all
0.6.0 2026-09-18
0.5.0 2026-09-05
0.4.0 2026-09-05
0.3.0 2026-09-05
0.2.1 2026-09-04