* ui: load highlight.js on first use highlight.js and every lowlight language (~900 KB raw) moved out of Llama Chat's first load into a chunk that loads with the first code block. - @ggml-org/llama-ui/code: highlightCode stays synchronous. Until highlight.js has loaded it returns the code escaped as plain text and starts the load; a $derived or $effect that called it runs again once it has loaded. New loadHighlighter() and isHighlighterLoaded(). - Markdown: rehype-highlight runs through a lazy rehype step, like KaTeX's: the first message with a code block waits for it, every other one renders in the same pass. First-load JS of the chat page: 3.47 -> 2.56 MB raw, 1.05 -> 0.75 MB gzip, 0.84 -> 0.60 MB brotli. Assisted-by: Claude (Opus 5.5 Medium) * ui: load each highlight.js language on first use highlight.js now loads one language at a time instead of all ~190 at once with the first code block: every language is its own chunk, and the core loads with the first one. - @ggml-org/llama-ui/code: highlightCode looks a language or alias up in a generated table (scripts/generate-highlight-languages.mjs), loads it with the languages it embeds (CSS and JavaScript inside HTML, say) and returns plain text until then; a $derived or $effect that called it runs again once it has loaded. Auto-detection picks among lowlight's 37 common languages, loaded the first time something auto-detects. New loadHighlightLanguages(), isHighlightLanguageLoaded(), resolveHighlightLanguage() and getLoadedHighlightLanguages() replace loadHighlighter() and isHighlighterLoaded(). - Markdown: rehypeLazyHighlight highlights with lowlight's core and the languages a message uses, waiting only for one it is the first to use. rehype-highlight is no longer in the pipeline, since it bundles lowlight's common languages. First-load JS of the chat page stays at 2.58 MB raw, 0.76 MB gzip, 0.61 MB brotli: no highlight.js code, only the 14 KB language table. The first code block now loads its language (1-12 KB for most) and the 20 KB core instead of 900 KB. Assisted-by: Claude (Opus 5.5 Medium) * ui: name the code-block class names and shell language as constants Assisted-by: Claude (Opus 5.5 Medium)
ui
The UI of llama.cpp: the packages in lib and the apps built on them.
ui/
├── lib/
│ └── ui/ @ggml-org/llama-ui: design tokens, fonts, surfaces and components
└── apps/
└── chat/ Llama Chat, the chat app that llama-server serves
lib/uidraws the parts and handles interaction, with no business logic. It is built with@sveltejs/packageand published to npm as@ggml-org/llama-ui. Apps in this repo skip the package: they compile its sources as part of their own build, so they hold no copy of a component, a token or a font.apps/chattalks to llama-server, stores conversations and runs the agentic loop. CMake builds it into llama-server (seescripts/ui-assets.cmake), and it is published to npm as@ggml-org/llama-chat(withllama-chatas its short name), sonpx llama-chatruns it against any llama-server.
Each folder is its own npm package with its own package-lock.json: run npm ci in the one you work on. Building,
checking and testing apps/chat needs no install in lib/ui.
Releases
The npm packages are versioned by hand, with semver, and published by CI:
| Package | Version in | Published by |
|---|---|---|
@ggml-org/llama-ui |
lib/ui/package.json |
ui-lib-publish.yml |
@ggml-org/llama-chat and llama-chat |
apps/chat/package.json and apps/chat/alias/package.json, always the same |
ui-chat-publish.yml |
To release, bump the version in the PR that should ship the change: a patch for fixes, a minor for new or changed
features or API while the version is 0.x. When that PR reaches master with a version npm does not have yet, the
workflow builds the package and publishes it; any other commit publishes nothing. A version lower than the one on npm
fails the run.
Llama Chat as bundled in llama-server is not versioned this way: it ships in every llama.cpp release, as b<build>.