🍡 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}. The src is resolved 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>Reach for it when you have a chunk of pre-authored JS, JSON, or CSS on disk that you want inlined into the document — an inline <script>, speculation rules, a critical-CSS blob — without a build step or a fetch.
<RawScript src="./src/inline/snippet.js" />
<!-- relative to the working dir -->
<RawScript src={absolutePath} />
<!-- absolute paths work too -->To inline content you already have as a string instead of a file, pass string. Provide exactly one of src or string — passing both (or neither) throws:
<RawScript string={`window.__BUILD__ = ${JSON.stringify(buildInfo)};`} />