Skip to content

feat(report): a JavaScript shipped line in every report format (squirrelscan/repo#3397) - #1205

Merged
nc9 merged 1 commit into
mainfrom
feat/3397-javascript-shipped
Nov 18, 2026
Merged

nc9 merged 1 commit into
mainfrom
feat/3397-javascript-shipped

Conversation

@nc9

@nc9 nc9 commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Public half of squirrelscan/repo#3397: a "JavaScript shipped" line in every report format.

Rebased onto main as one commit, after #1181 (link sections, renderers) and #1203 (Markdown escaping) landed.

What it says

JavaScript shipped: 1.2 MB across 34 scripts (Next.js runtime 640.0 KB, 52%; third-party 210.0 KB; 2 not measured)
Heaviest pages by script: https://example.com/blog/post (980.0 KB, 12 scripts), https://example.com/ (870.0 KB, 10 scripts)
  • Total: distinct <script src> files with a measured size. Same-site scripts count their decoded body (or Content-Length over the 5 MB fetch cap). Third-party scripts count the Content-Length from their HEAD check; those run with reliability/broken-resources and never offline. Inline scripts are not counted.
  • Framework runtime: named only from its own chunk path among same-site scripts: /_next/static/, /_nuxt/, /_astro/ or /_app/immutable/. Gatsby and Remix have no unambiguous path, so they are not claimed. Its share is of the whole total.
  • Not measured: failed (non-2xx), sizeless or zero-size scripts, plus the fetch cap's dropped count.
  • Heaviest pages: the 3 pages loading the most script bytes, ties broken by URL.
  • Omitted when nothing was measured. Report-only: it never feeds the score.

How

  • core-contracts: javascript-shipped.ts holds the JavascriptShipped type and a pure buildJavascriptShipped. Adds AuditReport.javascript and CrawlMetadata.javascript. JSON_REPORT_SCHEMA_VERSION is now 1.28.
  • audit-engine: both rules paths (streaming and runRulesOnStorage) put the block on RuleExecutionResult.javascript from the fetched assets (a caller with no fetched scripts gets no block). buildV1Report and buildV2Report attach it through one shared helper, falling back to the block stamped on the crawl.
  • crawler: sqlite migration 44 adds crawls.javascript_shipped (additive, nullable, also in the reconcile list), after main's 43. updateCrawl writes it and getCrawl reads it.
  • CLI: squirrel audit and squirrel analyze stamp it; reconstructReport restores it, so the live report and a later squirrel report agree; the console prints the summary line under Scan details.
  • report: text and Markdown print two summary lines; HTML a "JavaScript shipped" panel in the Site section; JSON a top-level javascript; llm and xml a <javascript> element with <page> children. Markdown escapes the framework name and URLs; HTML renders them as text; llm and xml escape attributes.

Schema

The JSON report gains a top-level javascript field, so this claims schema 1.28 (no other open PR claims it). The version tests and docs/configuration/output.mdx are updated.

Changelog

changelog.d/3397-javascript-shipped.added.md. CHANGELOG.md is unchanged from main.

Tests

  • report javascript-shipped.test.ts: literal expected lines for text, Markdown (both lines in full), HTML, llm, xml and JSON; omission in every format; a hostile framework name or URL is escaped. Removing each renderer's wiring fails its test (checked for text, Markdown, HTML, JSON, llm, xml).
  • cli console-javascript-shipped-3397.test.ts: the console line, literal; fails when the line is unwired. reconstruct-scan-scope-1050 gains the round-trip.
  • crawler javascript-shipped-migration.test.ts: the v43 upgrade, the round-trip with status, an old-CLI insert, and the schema pinned at 44.
  • audit-engine javascript-shipped-report.test.ts: the rules phase measures, v1 and v2 agree, no scripts means no block, the stamped-crawl fallback.
  • core-contracts javascript-shipped.test.ts: totals, dedupe, unmeasured classes, framework paths, top 3 with ties.

Checks

  • bun run scripts/test-suites.ts --check: covers every test file
  • --run report: 1406 pass, 0 fail
  • --run cli: 4516 pass, 14 skip, 0 fail
  • --run audit-engine: 2317 pass, 3 skip, 0 fail
  • --run crawler: 1150 pass, 0 fail
  • typecheck clean on core-contracts, crawler, audit-engine, report and cli; cli format:check and lint ok; report build:css:check up to date
  • docs make validate: all checks passed

Docs and skill

  • Docs: docs/reports.mdx has a "JavaScript shipped" section; docs/configuration/output.mdx adds the javascript key, its fields and the 1.28 note.
  • Skill: yes. The llm and json formats gain a field agents read. Filed as squirrelscan/repo#3575 (label skills).
  • Private follow-up (after the gitlink bump): the strict report schema in the cloud API (unknown keys are stripped today, so nothing breaks before then), the dashboard summary, the shared report and the cloud report docs.

@nc9
nc9 force-pushed the feat/3397-javascript-shipped branch from 9c90ff6 to 45305c3 Compare November 18, 2026 17:05
@nc9
nc9 merged commit c71c032 into main Nov 18, 2026
16 checks passed
@nc9
nc9 deleted the feat/3397-javascript-shipped branch November 18, 2026 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant