🍡 mochi
SSR framework for Svelte 5 + Bun with islands-based selective hydration
RawScript
<RawScript /> reads a file at SSR time and prints its contents verbatim with {@html}. Mochi resolves src relative to the working directory — the same convention as the paths you pass to Mochi.page('./src/...').
<script>
import { RawScript } from 'mochi-framework/components';
</script>
<script type="speculationrules">
<RawScript src="./src/inline/rules.json" />
</script>Use it when you have a chunk of pre-authored JavaScript, JSON, or CSS on disk that you want inlined into the document — an inline <script>, speculation rules, or a critical-CSS blob — without a build step or a fetch.
To inline content you already have as a string, pass string. Provide exactly one of src or string. Passing both, or neither, throws.
<RawScript string={`window.__BUILD__ = ${JSON.stringify(buildInfo)};`} />