Repository navigation
Conversation
Follow-up to trailhq#101, which left Svelte and Astro out of the container tier "until someone has a repo to verify them against". Both grammars ship in the tree-sitter-wasm bundle graft already depends on, so this is two registry rows plus one generalisation, now verified against four real repos. Svelte is Vue-shaped (script_element > raw_text) with one wrinkle: raw_text starts at the first non-blank character of the line after the tag, not right after its `>`. The span shift reads the offset off the body node's own row, so the formula holds unchanged; a fixture pins it because taking the row from the tag would misplace every span silently. Astro keeps its code in two kinds of node, the `---` frontmatter and <script>, so ContainerLang.block/body became blocks: EmbeddedBlock[]. Astro also hoists a <script> from anywhere in the markup, and in its own repo a quarter of the import-bearing ones sit inside a <Layout>, so the Astro row sets deep: true and the scan descends. Vue and Svelte stay top-level only, which is what their compilers do. Verified beyond the fixtures on sveltejs/kit, huntabyte/shadcn-svelte, withastro/astro and withastro/docs: every one of the 399 Svelte and 324 Astro symbols extracted has its name on the line its span points to, and no <script> block is lost to the errors tree-sitter-svelte raises on Svelte 5 markup.
🌱 graft blast radius1 area changed → 3 areas can be affected. 8 dependent symbols, depth 2. flowchart TB
A0(("Workspace Graph<br/>4 symbols"))
A1(("Graph Engine<br/>2 symbols"))
A2(("Pull Request Review<br/>2 symbols"))
classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
class A0,A1,A2 reached;
Who knows this code — 2 people across 4 areas
Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no All 8 dependent symbols, grouped by areaWorkspace Graph — 4 symbols in 4 files
Graph Engine — 2 symbols in 1 file
Pull Request Review — 2 symbols in 2 files
Test signal per changed area — 1 ✓Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.
32 test suites also reference this code34 symbols, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.
Open the interactive graph → — click an area to see its dependent symbols at file:line. |
|
Heads-up: #430 (opened two days before this) covers the same ground. I missed it — sorry. For the maintainers, the delta here: Astro |
Re-landed from #444 with the conflicts against main resolved; the contributor's fork couldn't take the merge commit. Co-Authored-By: Shrish Dwivedi <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Follow-up to #101, which left this on the table: "Svelte and Astro are the same shape and would be a registry row each, but they are left out until someone has a repo to verify them against." They are now verified, so here are the rows.
What
.svelteand.astrojoin.vuein the container tier. The wrapper grammar (both ship in thetree-sitter-wasmbundle graft already depends on — no new dependency) only answers "where does the embedded code start and end"; the code itself goes through the depth-tier TypeScript extractor, so a component gets bindings, imports and resolved calls, and a call from a component into a.tsmodule is a real edge.How
Svelte is a one-row addition. Its
<script>isscript_element>raw_text, exactly like Vue, with one wrinkle:raw_textdoes not start right after the tag's>. It starts at the first non-blank character of the next line, so its row is one past the tag's and the slice begins mid-line. The span shift already reads the offset off the body node's own start row rather than the tag's, so the formula "add the start row to a 1-based span" holds unchanged — but it is the kind of thing that would have silently misplaced every span had the shift been taken from the tag, so there is a fixture that pins it (attributes on the tag, indented script, markup above).Astro needed a small generalisation of the registry: an Astro component keeps its code in two kinds of node. The
---frontmatter (frontmatter>frontmatter_js_block) is where imports and logic live;<script>(script_element>raw_text, Vue-shaped) is the client-side island.ContainerLang.block/bodybecameblocks: EmbeddedBlock[], andblocks()matches any registered pair. The two-script Vue path already handled multiple bodies with their own offsets, so Astro reuses it as-is.Astro also hoists a
<script>from wherever it sits in the markup, and the common shape is a page wrapped in<Layout>with the script inside it. In Astro's own repo, 50 of 169<script>blocks are nested and 12 of those carry imports — a quarter of all import-bearing scripts. So the Astro row setsdeep: trueand the scan descends through the tree (stopping at a block, since a block cannot nest inside another). Vue and Svelte stay top-level only: Vue's compiler ignores a<script>inside<template>, and Svelte treats only a top-level one as the component script.Verification
test/container-extract.test.ts: 9 new tests. Svelte: the start-a-line-late span,<script module>+ instance script each with its own offset (Svelte 5 runes are plain calls to the TS grammar), no-script degradation. Astro: frontmatter span, frontmatter +<script>each with its own offset, a nested<script>inside<Layout>, and no/empty frontmatter degradation. Plus an end-to-end build for both that asserts thecallsedge into a.tshelper resolves and thatgraft checkreads a clean build as in sync (graft checkreports every.vuenode asremovedafter a clean build —checkGraphhas no container-tier branch #236).test/supported-extensions.test.ts:.sveltewas the "unsupported" example, as its header comment predicted;.hbscarries that side now.npm test),tsc --noEmitclean..vue, against four real repos — sveltejs/kit, huntabyte/shadcn-svelte, withastro/astro, withastro/docs (2,838.svelteand 1,667.astrofiles): every one of the 399 Svelte and 324 Astro symbols extracted has its name on the line its span points to, and every file that yields nothing yields nothing as.tseither (the inner extractor only emits declarations, and most components arelet/$props()plus markup).graft buildon real projects, before → after:docs/(1,729.svelte): 951 → 2,680 files parsed, 1,292 → 3,311 nodes, 1,132 → 8,323 edges. 7,191 of them leave a component (6,785 imports, 114 resolved calls), 182 land in a.ts/.jsmodule..astro): 67 → 149 files parsed, 233 → 394 nodes, 476 → 796 edges. 321 leave a component (175 imports, 53 resolved calls), 40 land in.ts/.js.Known edges
tree-sitter-sveltepredates Svelte 5 and errors on{@render …}/{#snippet}in the markup (286 of 2,838 files in the corpus). Checked that no<script>block is lost to those errors: script elements parse fine either side of them.<script>inside a string literal or a{…}expression is not a block, and the grammar rightly does not report one (4 fixtures in Astro's own test suite do this on purpose).