feat(mdsvex): preprocess mochi:hydrate inside markdown files#22
Conversation
Threads the post-mdsvex Svelte source through preprocessHydratable so `mochi:hydrate`, `mochi:hydrate:visible`, and `mochi:defer` directives on components instantiated in `.md` / `.svx` files now create real islands the same way they do in `.svelte` pages. Drops the CSS-checkbox trick in `IslandsDemo.svelte` and replaces it with a real Svelte 5 component (`$state` + onclick), wired via `<IslandsDemo mochi:hydrate />` on the intro page. Updates the mdsvex doc page to describe the new capability.
Mochi review reportLines of code (non-blank lines) packages/mochi
Unchanged: packages/site
Unchanged: packages/demos
Unchanged: packages/minimal
Unchanged: packages/cli
Unchanged: |
🤖 I have created a release *beep* *boop* --- <details><summary>mochi-framework: 0.3.0</summary> ## [0.3.0](mochi-framework-v0.2.0...mochi-framework-v0.3.0) (2026-05-23) ### Features * add liveReload option to disable dev WS ([#23](#23)) ([616ab7a](616ab7a)) * **mdsvex:** preprocess mochi:hydrate inside markdown files ([#22](#22)) ([bcf08e4](bcf08e4)) ### Bug Fixes * **debug-bar:** show green status dot when liveReload is disabled ([#27](#27)) ([f8896f5](f8896f5)) </details> --- This PR was generated with [Release Please](https://github.com/googleapis/release-please). See [documentation](https://github.com/googleapis/release-please#release-please). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Co-authored-by: Stanislav Khromov <stanislav.khromov+github@gmail.com>
Summary
preprocessHydratableinComponentRegistry.ts, somochi:hydrate,mochi:hydrate:visible, andmochi:deferdirectives on components inside a.md/.svxfile create real islands the same way they do in.sveltepages.IslandsDemo.svelteon the intro page with a real Svelte 5 component ($state+ onclick); the doc invokes it as<IslandsDemo mochi:hydrate />.docs/158-mdsvex.mdto document the new capability (drops the old SSR-only warning).Test plan
bun run checkspasses (lint + format + typecheck + tests)/docs/introrenders with the<mochi-hydratable-island component-name="IslandsDemo" …>wrapper around the demo and ships a_hydrate-IslandsDemo-*.jsclient bundle/docs/mdsvex,/docs/cache,/docs/hydratable,/docs/lazy-hydration,/docs/coming-from-sveltekit) still render