Thread markdown, source files and review diffs all import a Shiki highlighter, and every screen is statically reachable from App.tsx. With Expo's `inlineRequires: false`, that meant @shikijs/core, its runtime deps, two themes and seven or eight grammars (~1.2MB of module source) were evaluated during cold launch for screens behind a tap. Both highlighters also built their own core with their own copy of the engine probe and grammar registry. Move engine selection and grammar loading into one mobile lib module that imports @shikijs/core, the themes and every grammar lazily, and create the highlighter on first highlight instead of at module evaluation. The review highlighter and the native review diff highlighter now share it: the diff sheet registers the grammar for each file segment on demand, and the language alias map finally agrees with the grammar names Shiki registers (`svg` used to load the xml grammar under a name nothing had registered). Startup graph measured from index.ts over Metro's dependency graph, counting only static require edges (what actually evaluates at launch): before: 3686 modules, 21.65MB (shiki: 25 modules, 1.11MB of it) after: 3618 modules, 20.48MB (shiki: none) The single-bundle graph is unchanged at 3796 modules, since RN ships no on-demand chunks; the win is startup evaluation, not download size.
Julius Marminge committed on 9/22/2026, 11:27:07 PMparentd7819c1
6 files changedLine totals unavailable