Skip to content
Svartz v2.6.0

@svartz/vite

55 exported symbols.

Interfaces

i HostDiscoveryVaultPublished vault data used by an opt-in host feed or sitemap.
i HostFeedOptions
i HostStyleManifestGenerated runtime entry points and the CSS manifest for one host vault.
i SvartzViteContext
i SvartzVitePluginOptions

Types

t ResolvedSvartzVirtualModuleId
t SvartzVirtualModuleId
t ThemeImportWhat `virtual:svartz/theme` imports: one theme module, or several and the `composeThemes` entry that composes them.
t ThemeModule
t ThemeSourcesLocal 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

f assertNoNotesUnderPagesA 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.
f assertRequiredStages
f assertServerPluginsA 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`.
f clearPublicAssetsForget every recorded file. The CLI calls this before each build, so one vault's files never ship in the next's.
f createArtifactsVirtualModuleSource
f createHostIndexSource`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.
f createHostRegistrySource`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.
f createHostServerSource`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.
f createServerRegistrySourceThe 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.
f createSvartzViteContext
f createThemeVirtualModuleSourceGenerates the `virtual:svartz/theme` module source.
f createVaultChangeEvent
f getGeneratedArtifactsRoot
f getGeneratedHostIndexPath
f getGeneratedHostRegistryPath
f getGeneratedHostServerPath
f getGeneratedHostStylesPathUse a fixed-length lowercase digest so every valid ID fits a filesystem filename.
f getGeneratedIndexModulePath
f getGeneratedPageModulePath
f getGeneratedPagesRoot
f getGeneratedRuntimeArtifactsModulePath
f getGeneratedRuntimeServerModulePath
f getGeneratedRuntimeThemeModulePath
f getGeneratedSearchModulePath
f getThemePresetPlugins
f getVaultBuildRoot
f hostStylesPluginCapture CSS from SvelteKit's client build without importing every vault runtime eagerly.
f isSvelteKit3Whether 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.
f loadThemeModuleThe 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.
f loadVirtualModule
f publicAssetsPluginEmit the recorded files in the client build, unless the Svartz plugin there already did.
f renderHostRssRender a summary RSS feed for an explicit set of host vaults.
f renderHostSitemapRender a sitemap for selected mounts on the same public host.
f resolveRuntimePluginsMerge 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`.
f resolveThemeExport
f resolveThemeModuleIdsThe theme modules a vault lists, in order.
f resolveThemePackageRootFind a package root from the host app for Vite, CLI, and Tailwind consumers.
f resolveThemeRuntimeImportWhat `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.
f resolveVirtualModuleId
f svartz
f svelteKitBasePathSvelteKit's `paths.base` alone, from the same definitions as `svelteKitPaths`.
f svelteKitPathsRead SvelteKit's paths from the definitions it puts in Vite's resolved config, the same in SvelteKit 2 and 3.
f themeSourceAliasesVite 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.
f withMarkdownNegotiationRun the shared Svartz handle ahead of the standalone adapters' static-file handlers.
f withSvartzHostPreserve virtual modules and let Svelte compile packaged components in host apps.