architecture #

svelte-docinfo analyzes its own source and draws the result below. Each node is one module under src/lib/ (the index.ts barrel left out); each arrow is an internal import. Click a module to open its API page.

How to read it
#

  • Arrows point from importer to imported: X depends on Y. Reads with gravity, so dependencies fall downward toward the foundation.
  • Layers are assigned by longest-path-from-sink. A module's layer is one plus the deepest layer it transitively depends on. Sinks (no internal imports) land at the bottom.
  • Hover a module to isolate its immediate neighbors. Edges split by direction: what the module depends on and what depends on it.

What the layers say
#

The bottom row is the modules that import nothing else in the library: path and error helpers, concurrency caps, logging, the schema helpers, and the Svelte script scanners. The middle rows are the per-kind TypeScript extractors and the file-system helpers. The top rows are the orchestrators: the persistent session on top of core analysis, then the one-shot wrappers and the Vite plugin (both built directly on the session), then the CLI and its main.ts entry.

Across 37 modules and 166 internal imports, the graph is naturally acyclic, so no back-edges had to be reversed to lay it out.

How this was drawn
#

The layout is precomputed at build time by dependency_graph.gen.json.ts, which calls analyzeFromFiles on this project and runs a Sugiyama-style layered layout: longest-path-from-sink for layer assignment, dummy nodes on long edges, median-heuristic crossing reduction. The result is a small JSON sibling the Svelte component renders to SVG. No layout libraries, just a few hundred lines of layout code.