---
title: '@svartz/vite'
description: Runtime-driven Vite integration for Svartz vault builds
updated_at: '2026-11-26T01:39:36+01:00'
---

# @svartz/vite

## Entry points

- [@svartz/vite/host](https://svartz.dev/reference/api/vite/host.md)
- [@svartz/vite/discovery](https://svartz.dev/reference/api/vite/discovery.md)

## Interfaces

- [SvartzViteContext](https://svartz.dev/reference/api/vite/svartzvitecontext.md)
- [SvartzVitePluginOptions](https://svartz.dev/reference/api/vite/svartzvitepluginoptions.md)

## Types

- [ResolvedSvartzVirtualModuleId](https://svartz.dev/reference/api/vite/resolvedsvartzvirtualmoduleid.md)
- [SvartzVirtualModuleId](https://svartz.dev/reference/api/vite/svartzvirtualmoduleid.md)
- [ThemeImport](https://svartz.dev/reference/api/vite/themeimport.md) — What `virtual:svartz/theme` imports: one theme module, or several and the `composeThemes` entry that composes them.
- [ThemeModule](https://svartz.dev/reference/api/vite/thememodule.md)
- [ThemeSources](https://svartz.dev/reference/api/vite/themesources.md) — Local theme ids mapped to their source manifests (`src/lib/index.ts`), so dev loads unbuilt themes. The CLI passes it as JSON in `SVARTZ_THEME_SOURCES`.

## Functions

- [assertNoNotesUnderPages](https://svartz.dev/reference/api/vite/assertnonotesunderpages.md) — A page name owns `<mount>/-/<name>/` and everything below it, so a published note there would be shadowed at runtime: fail the build naming it. Notes elsewhere under `<mount>/-/` stay notes. `routes` are the vault's published routes, mount path included.
- [assertRequiredStages](https://svartz.dev/reference/api/vite/assertrequiredstages.md)
- [assertServerPlugins](https://svartz.dev/reference/api/vite/assertserverplugins.md) — A server plugin needs a server target (or a host app whose adapter isn't `adapter-static`), a path-segment id, an importable module and JSON options. `hostAdapter` is the host's `kit.adapter.name`.
- [clearPublicAssets](https://svartz.dev/reference/api/vite/clearpublicassets.md) — Forget every recorded file. The CLI calls this before each build, so one vault's files never ship in the next's.
- [createArtifactsVirtualModuleSource](https://svartz.dev/reference/api/vite/createartifactsvirtualmodulesource.md)
- [createHostIndexSource](https://svartz.dev/reference/api/vite/createhostindexsource.md) — `virtual:svartz/index`: each vault's published index and site metadata, in config order. It imports no page runtime or theme, not even dynamically, so a host that only reads the index never compiles Svartz's page runtime.
- [createHostRegistrySource](https://svartz.dev/reference/api/vite/createhostregistrysource.md) — `virtual:svartz/host`: the host eagerly reads route metadata and loads runtime code only for the selected mount. It also exports SvelteKit's `base` and `assets`, which SvelteKit 3's `$app/paths` no longer does.
- [createHostServerSource](https://svartz.dev/reference/api/vite/createhostserversource.md) — `virtual:svartz/server` in a host app: `svartzHandle` runs every host vault's generated handle in turn, and `svartzPage` asks each vault for the plugin page at a URL.
- [createServerRegistrySource](https://svartz.dev/reference/api/vite/createserverregistrysource.md) — The vault's server-only module: its active server plugins as a registry; `svartzHandle`, the SvelteKit `handle` that routes `/_svartz/<id>/` to them; and `svartzPage`, which renders their pages under `/-/` for the plugin page route's `load`. `virtual:svartz/server` is this module in the standalone shell; host apps get one that chains every vault's. Its env imports keep it out of client bundles. `serverData` is what each plugin's hooks recorded for its server module this build, keyed by plugin id.
- [createSvartzViteContext](https://svartz.dev/reference/api/vite/createsvartzvitecontext.md)
- [createThemeVirtualModuleSource](https://svartz.dev/reference/api/vite/createthemevirtualmodulesource.md) — Generates the `virtual:svartz/theme` module source.
- [createVaultChangeEvent](https://svartz.dev/reference/api/vite/createvaultchangeevent.md)
- [getGeneratedArtifactsRoot](https://svartz.dev/reference/api/vite/getgeneratedartifactsroot.md)
- [getGeneratedHostIndexPath](https://svartz.dev/reference/api/vite/getgeneratedhostindexpath.md)
- [getGeneratedHostRegistryPath](https://svartz.dev/reference/api/vite/getgeneratedhostregistrypath.md)
- [getGeneratedHostServerPath](https://svartz.dev/reference/api/vite/getgeneratedhostserverpath.md)
- [getGeneratedHostStylesPath](https://svartz.dev/reference/api/vite/getgeneratedhoststylespath.md) — Use a fixed-length lowercase digest so every valid ID fits a filesystem filename.
- [getGeneratedIndexModulePath](https://svartz.dev/reference/api/vite/getgeneratedindexmodulepath.md)
- [getGeneratedPageModulePath](https://svartz.dev/reference/api/vite/getgeneratedpagemodulepath.md)
- [getGeneratedPagesRoot](https://svartz.dev/reference/api/vite/getgeneratedpagesroot.md)
- [getGeneratedRuntimeArtifactsModulePath](https://svartz.dev/reference/api/vite/getgeneratedruntimeartifactsmodulepath.md)
- [getGeneratedRuntimeServerModulePath](https://svartz.dev/reference/api/vite/getgeneratedruntimeservermodulepath.md)
- [getGeneratedRuntimeThemeModulePath](https://svartz.dev/reference/api/vite/getgeneratedruntimethememodulepath.md)
- [getGeneratedSearchModulePath](https://svartz.dev/reference/api/vite/getgeneratedsearchmodulepath.md)
- [getThemePresetPlugins](https://svartz.dev/reference/api/vite/getthemepresetplugins.md)
- [getVaultBuildRoot](https://svartz.dev/reference/api/vite/getvaultbuildroot.md)
- [isSvelteKit3](https://svartz.dev/reference/api/vite/issveltekit3.md) — Whether the app in `root` installs SvelteKit 3 or later. Its options can't tell: SvelteKit 2.62 and later also take them in `sveltekit({ … })`. An app without a resolvable SvelteKit counts as SvelteKit 2, whose behaviour Svartz assumed before SvelteKit 3.
- [loadThemeModule](https://svartz.dev/reference/api/vite/loadthememodule.md) — The vault's build manifest. A `theme.base` list composes every listed theme's `extensions` with theme-minimal's `composeThemes`; a theme with a selected source loads unbuilt.
- [loadVirtualModule](https://svartz.dev/reference/api/vite/loadvirtualmodule.md)
- [resolveRuntimePlugins](https://svartz.dev/reference/api/vite/resolveruntimeplugins.md) — Merge runtime plugins in specificity order. `config.plugins` is already the defaults→vault merge from @svartz/config. `hostAdapter` is the host app's `kit.adapter.name` when the vault targets `host`.
- [resolveThemeExport](https://svartz.dev/reference/api/vite/resolvethemeexport.md)
- [resolveThemeModuleIds](https://svartz.dev/reference/api/vite/resolvethememoduleids.md) — The theme modules a vault lists, in order.
- [resolveThemePackageRoot](https://svartz.dev/reference/api/vite/resolvethemepackageroot.md) — Find a package root from the host app for Vite, CLI, and Tailwind consumers.
- [resolveThemeRuntimeImport](https://svartz.dev/reference/api/vite/resolvethemeruntimeimport.md) — What `virtual:svartz/theme` imports for this vault. A theme with a selected source imports its `runtime.ts`, or its package id, which Vite aliases to the source.
- [resolveVirtualModuleId](https://svartz.dev/reference/api/vite/resolvevirtualmoduleid.md)
- [svartz](https://svartz.dev/reference/api/vite/svartz.md)
- [svelteKitBasePath](https://svartz.dev/reference/api/vite/sveltekitbasepath.md) — SvelteKit's `paths.base` alone, from the same definitions as `svelteKitPaths`.
- [svelteKitPaths](https://svartz.dev/reference/api/vite/sveltekitpaths.md) — Read SvelteKit's paths from the definitions it puts in Vite's resolved config, the same in SvelteKit 2 and 3.
- [themeSourceAliases](https://svartz.dev/reference/api/vite/themesourcealiases.md) — Vite aliases that point each workspace theme at its source, by exact id. A string alias also captures subpaths, so `@svartz/theme-minimal` would rewrite another listed theme's `@svartz/theme-minimal/runtime` import.

## Re-exports

- [default](https://svartz.dev/reference/api/vite/svartz.md)
