Changelog
Follow the changes included in each SER release.4.0.0
Query.live is stream-native
Query.live now returns Effect's Stream data type directly. It no longer resolves to the old live-resource object with current, loading, ready, connected, and reconnect properties.
const clock = Clock();
yield * clock.pipe(Stream.runForEach((time) => Effect.sync(() => update_clock(time))));Live-query handlers must return a Stream as well. Native iterables and async generators remain usable, although they first need a Stream constructor such as Stream.fromIterable(...) or Stream.fromAsyncIterable(...). Returning an ordinary value, Promise, iterable, or an effect that later produces a Stream raises InvalidLiveQueryReturnError.
Transport controls have moved to the new Live helpers:
Live.status(stream)returns a Stream of connection states.Live.reconnect(stream)returns an effect that requests a reconnect.
Stream operators preserve SER's hidden transport metadata through pipe(...), so a derived remote Stream can still be passed to both helpers. A direct yield* stream reads its first element; if the Stream completes before emitting, it fails with EmptyStreamYieldError.
See Query.live for the complete API and migration table.
Native SvelteKit handlers can run effects
The new Handler(...) adapter runs native SvelteKit server callbacks through ServerRuntime. This covers route handlers such as GET and POST while leaving method selection, request arguments, and response validation with SvelteKit.
import type { RequestHandler } from "./$types";
import { Handler } from "svelte-effect-runtime";
export const GET = Handler<RequestHandler>(function* ({ params }) {
const post = yield* Posts.Get(params.slug);
return Response.json(post);
});The active RequestEvent is available as an effect service throughout the handler call. Native HTTP handlers do not expose a typed effect error channel, however, so domain failures must be recovered or translated into SvelteKit control flow before returning.
See Handler for request scope and error-boundary details.
Compiler entrypoint renamed
The Vite plugin entrypoint moved from svelte-effect-runtime/vite to svelte-effect-runtime/compiler.
import { effect } from "svelte-effect-runtime/vite";
import { effect } from "svelte-effect-runtime/compiler";The root svelte-effect-runtime export remains available. Projects that import the compiler subpath directly must update that import when moving to 4.0.0.
Compiler and markup changes
Script, markup, diagnostics, and language-server transforms now share one bounded Svelte source scanner. Apart from removing duplicated parsing logic, this changes a few observable edges:
- Event attributes follow Svelte's conventions instead of relying on a loose name check. Current
onclickattributes and legacyon:clickdirectives are both recognized at the AST boundary. - Script effects are split into independent runtime blocks, which keeps unrelated effect work from being coupled to one generated block.
- Server import rewriting parses imports structurally, including supported server and remote module forms, instead of depending on textual matches.
- Markup and editor diagnostics use the same source ranges as the compiler, reducing disagreements between the editor and the build.
Forms preserve array indices
Nested array values now use indexed FormData paths such as items[0] and items[1]. Previously, repeated items[] paths lost the original index, which made nested validation paths ambiguous once an array contained structured values.
Runtime and error behavior
ClientRuntime.make(...) and ServerRuntime.make(...) now reject a second initialization with RuntimeAlreadyInitializedError. Vite development SSR remains the exception: HMR disposes the previous server runtime before installing its replacement.
SER's public errors now use one documented hierarchy for compiler, runtime, remote-handler, factory, and transport failures. Dead exports that could no longer be reached, including UnknownRuntimeError and VitePreTransformPluginConflictError, have been removed. The old in-package documentation module has also been removed.
Documentation
SER 4.0.0 ships with documentation redesigned from scratch.