From 2f1a1a2ac974ceb9958e141859bb3568e2a9e7fd Mon Sep 17 00:00:00 2001 From: dovvnloading <157447210+dovvnloading@users.noreply.github.com> Date: Fri, 4 Sep 2026 18:19:51 -0400 Subject: [PATCH] Get the markdown stack and the PNG exporter out of the initial chunk A sourcemap attribution of the initial chunk - every output byte charged back to the module it came from - found two things sitting in it that are reachable only through a click. The bigger one was the Document View's markdown machinery. App.tsx statically imported DocumentViewPanel, and that pulled in DocumentViewMarkdown (react-markdown plus six remark/rehype plugins and react-medium-image-zoom) and documentViewHeadings, which runs its own unified/remark-parse pass so the table of contents' ids provably match what rehype-slug will render. The eleven node views that also render markdown were already lazy; this single eager importer was holding the whole unified/micromark/mdast stack in the initial chunk for every session, including the many that never open the panel at all. The smaller one was html-to-image, reached from AppBar's Export PNG button and the command palette's export command. Measured: largest chunk 781,060 -> 595,517 bytes, -185,543 (-23.8%). Total JS 1,456,011 -> 1,458,443 (+2,432), the usual per-chunk overhead of splitting; the budget ADR-019 sets is on the initial chunk. THE PANEL SHELL DELIBERATELY STAYS EAGER, and that is the whole design of this change. The panel is an