Summary
hasSignalsSyntax scans the raw template for directive patterns with no notion of where they appear, so a documentation page that quotes stx syntax inside an escaped code sample counts as reactive. The page ships the full signals runtime and gets data-stx-auto stamped on <body>, for markup that is inert text.
Repro
<main>
<h1>The :if directive</h1>
<pre><code><div :if="open"></div></code></pre>
</main>Through processDirectives:
ships runtime? trueThe sample is HTML-escaped — <div — so it is unambiguously text, not markup. /\s:[a-z][\w-]*\s*=\s*["']/i matches it anyway, because :if="open" survives escaping intact (only < and > are encoded).
Cost
The runtime is ~159KB uncompressed / ~39KB gzip. Every page of the stx documentation that shows a :if=, x-model= or @click= example pays it. This is the framework's own docs site, and any consumer docs site built with stx.
Second-order effect
Since #1827, fragment responses carry X-STX-Runtime, keyed on whether the page actually shipped a runtime. That header faithfully reports true for these pages, so a runtime-less page navigating to a docs page hands off to a full load rather than an SPA swap. The header is doing the right thing with the answer it is given — the over-shipping is upstream of it, here.
The cost is bounded (once any runtime-shipping page has loaded, window.stx persists for the session, so at most one hand-off follows), but it is avoidable.
Suggested direction
Strip <pre>, <code>, <script>, <style> and HTML comments before scanning — the same treatment stripInertRegions now applies in packages/router/src/client.ts. Measured over the 339 rendered docs pages in this repo, that reduces raw {{ matches from 53 to 4.
Worth checking whether @raw/@endraw regions should be excluded on the same pass; there is a separate leak where @raw@endraw renders literally into output.
Related
Found while verifying #1827.