Pulse · web performance
thirdparty-pulse
How much does each third-party script cost your pages? Estimated bytes, requests and main-thread time per page and per vendor, checked against budgets.
npm i -D @mrlouiswright/thirdparty-pulsePublished to GitHub Packages: add @mrlouiswright:registry=https://npm.pkg.github.com to .npmrc first (installing needs a token with read:packages).
What it checks
- Budgets per pagethird-party script KB (
maxKb, default 150), requests (maxRequests, default 10) and estimated main-thread time (maxMainThreadMs, default 250 ms, atmsPerKb2.5 ms per compressed KB). - Budgets per vendor
vendorBudgetscaps a single vendor (e.g.{"google-tag-manager": 80}). - Weightsa built-in table of ~45 vendors (analytics, tag managers, chat, video, maps, payments, CDNs) with typical compressed sizes; override or add hosts with
weights(host, URL glob or vendor id)… - Loadingsynchronous third-party scripts (high in
<head>, medium in<body>), duplicate includes, heavy vendors that have a facade (YouTube, Maps, chat), early origins withoutpreconnect, and preconnects that nothing uses. - Reportthe JSON report lists every vendor/origin with its weight, requests and the number of pages it is on.
Quick usage
CLI
npx thirdparty-pulse dist
npx thirdparty-pulse _site --max-kb 100 --max-requests 6
npx thirdparty-pulse public -f json > third-party.json
API
import { check, weightOf, vendorForUrl } from "thirdparty-pulse";
const report = check("dist", { maxKb: 120 });
report.info.vendors; // [{ id, vendor, category, kb, pages, requests }]
vendorForUrl("https://www.googletagmanager.com/gtm.js").kb; // 90
Every option is documented in the thirdparty-pulse docs.
CI / GitHub Action
permissions:
contents: read
security-events: write # only needed for the SARIF upload
jobs:
thirdparty-pulse:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11d5960a326750d5838078e36cf38b85af677262 # v4
with: { persist-credentials: false }
- run: npm ci && npm run build # produce the static site first
- uses: MrLouisWright/thirdparty-pulse@v1
with:
path: dist
fail-on: high
sarif: thirdparty-pulse.sarif
- uses: github/codeql-action/upload-sarif@v3
if: always()
with: { sarif_file: thirdparty-pulse.sarif }