sveltejs/svelte
57.9
Weak · 1 October 2026
57.7k
lines of production code
JavaScript
primary language
2
measurements over time
What this system is
This system is the Svelte 5 framework, a compiler and runtime for building user interfaces that replaces the previous class-based component model with a function-based approach using runes for reactivity. It provides a complete toolchain including a rewritten parser and compiler with native TypeScript support, a modular client and server-side rendering engine, and a new reactive state management system. The codebase also includes comprehensive benchmarking infrastructure, automated migration tools for upgrading from Svelte 4, and extensive test suites to ensure correctness across browser and server environments.
How it got here
2016–2023 — Svelte 5 monorepo and compiler rewrite
67 changes.
This period focused on restructuring the project into a pnpm monorepo and completely rewriting the compiler and runtime for Svelte 5. Key developments included replacing the legacy parser with a new architecture supporting runes mode, native TypeScript integration, and a modular visitor-based transformation pipeline. The work also established comprehensive test infrastructure and modernized the repository tooling to support the new version's features.
2024 — Svelte 5 runtime and compiler architecture
53 changes.
This period focused on the comprehensive overhaul of Svelte 5's internal architecture, migrating the compiler and runtime to a modular visitor-based structure using zimmerframe. It introduced the new Runes reactivity system, async handling, and legacy compatibility layers, alongside extensive TypeScript type updates and a migration tool for Svelte 4 code.
2025–2026 — attachments, async support, and compiler robustness
30 changes.
This period introduced the new attachments module and the @attach directive, while significantly expanding compiler support for async expressions in derived state, if/else blocks, and top-level awaits. The team also implemented functional tree-based templating for improved performance and XHTML compliance, alongside a new AST printer for code generation. Extensive test coverage was added across parser, snapshot, runtime, and benchmark suites to validate these features and ensure stability.
Features
Add SSR benchmark suite for rendering performance measurement
A new benchmarking suite has been added to measure Server-Side Rendering (SSR) performance. It includes a test component (\App.svelte\) that renders a spiral pattern of tiles and a benchmark runner (\wrapper\_bench.js\) that compiles the component for server-side generation and measures the rendering speed using a JIT warm-up phase followed by repeated render cycles.
benchmarking/benchmarks/ssr · high confidence
Added SSR reactivity benchmark suite
A new benchmark suite for reactivity has been added to the \benchmarking/benchmarks/reactivity\ directory. This suite includes utilities and test cases (\sbench.js\, \util.js\, \index.js\) that measure the performance of creating signals and derived states with varying source-to-derived ratios (e.g., 1-to-1, 1-to-1000, 0-to-1). The benchmarks utilize the internal Svelte client API (\svelte/internal/client\) to assess the cost of state creation and dependency management in both owned and unowned contexts.
benchmarking/benchmarks/reactivity · high confidence
Added funding manifest URL
A new .well-known/funding-manifest-urls file has been added to the repository, pointing to https://svelte.dev/funding.json. This allows tools and users to discover the project's funding information via the standard well-known URI path.
.well-known · high confidence
Automated generation of compiler warning and error documentation
The Svelte build process now automatically generates reference documentation for all compiler warnings and errors. A new script located at \packages/svelte/scripts/process-messages\ parses Markdown files from the \messages\ directory, extracts message codes and details, and writes structured documentation pages to \documentation/docs/98-reference/.generated\. This ensures that the documentation for runtime errors and warnings is always synchronized with the source definitions and is formatted consistently for the user guide.
packages/svelte/scripts/process-messages · high confidence
Compiler analysis visitors restructured and expanded
The compiler's analysis phase has been reorganized into individual visitor files for each AST node type (e.g., AnimateDirective, AwaitBlock, BindDirective, ClassBody). This change introduces stricter validation for runes mode, including checks for invalid rune usage, duplicate class fields, and proper placement of state/derived declarations. It also adds support for new features like async const tags, bind getters/setters, and improved error messages for invalid bindings and exports.
packages/svelte/src/compiler/phases/2-analyze/visitors · high confidence
Introduce \`svelte/legacy\` package for Svelte 4 component migration
A new \svelte/legacy\ entry point is added, providing \createClassComponent\ and \asClassComponent\ utilities to wrap Svelte 5 components as Svelte 4-compatible class instances. This allows existing imperative code using \new Component()\ or \Component.render()\ to function during the transition, with the server-side render output mapping \body\ to \html\ to maintain Svelte 4 API compatibility. The package is explicitly deprecated and intended only as a temporary migration aid.
packages/svelte/src/legacy · high confidence
Introduce async server rendering with context preservation and hydration safety
The server rendering engine now supports asynchronous rendering, allowing components to await data during the render phase. This change introduces a new \hydratable\ API for safely serializing and comparing asynchronous values between the server and client to prevent hydration mismatches, and adds a \getAbortSignal()\ utility for managing request lifecycles. To ensure reliability, the system now preserves component context across \await\ boundaries using \AsyncLocalStorage\ and includes robust error handling for serialization failures and invalid HTML structures.
packages/svelte/src/internal/server · high confidence
Native TypeScript support with AST stripping
The parser now natively supports TypeScript syntax by extending Acorn with the @sveltejs/acorn-typescript plugin, allowing Svelte components to be written with TypeScript annotations. To ensure compatibility with the existing compiler pipeline, a new \remove\_typescript\_nodes.js\ module walks the AST and strips all TypeScript-specific nodes (such as type annotations, interfaces, enums, and type-only imports) before analysis, while also enforcing restrictions on unsupported features like decorators and class access modifiers.
packages/svelte/src/compiler/phases/1-parse · high confidence
New AST printer for Svelte components
A new \print()\ function has been added to the Svelte compiler, allowing tools to convert a parsed Svelte AST back into source code. This feature supports modern AST nodes and includes options for custom indentation and comment handling, enabling reliable code generation and transformation workflows.
packages/svelte/src/compiler/print · high confidence
New Svelte 4 to Runes migration tool
A new migration script is now available in the compiler to automatically transform Svelte 4 components to use the new Runes syntax. This tool handles converting reactive statements, props, slots, and CSS selectors (such as wrapping :has, :is, :where, and :not with :global) while preserving comments and TypeScript types. It also provides feedback via migration-task comments for code that could not be automatically migrated or requires manual attention.
packages/svelte/src/compiler/migrate · high confidence
New async reactivity system for handling await expressions
The reactivity engine now includes a dedicated async module that manages asynchronous state and effect batching. This introduces new runtime primitives like \async\_derived\ for handling promises within reactive expressions, and context-saving mechanisms (\save\/\unsave\) to ensure reactive dependencies are correctly tracked across \await\ boundaries. The system also implements a blocker-based batching model (\flatten\, \run\_after\_blockers\) to coordinate synchronous and asynchronous updates, ensuring that derived values and effects are updated in the correct order after async work completes.
packages/svelte/src/internal/client/reactivity · high confidence
New attachments module with \`fromAction\` utility
The \svelte/attachments\ module is introduced, providing a programmatic way to attach behaviors to elements via \createAttachmentKey\ and a new \fromAction\ utility that converts existing Svelte actions into attachments for use with the \{@attach}\ directive.
packages/svelte/src/attachments · high confidence
New benchmark comparison tool with HTML reports and CPU profiling
Added a new \benchmarking/compare\ tool that runs benchmarks across multiple branches, generates a text-based comparison report, and produces an interactive HTML report (\results.html\) for visual analysis. The tool now runs each benchmark in a separate child process to prevent state contamination between tests, and captures CPU profiles for performance investigation, accessible via a new \profile-diff.mjs\ script.
benchmarking/compare · high confidence
New benchmarking infrastructure with compiler profiling and isolated execution
The benchmarking directory now includes a comprehensive tooling suite for measuring Svelte performance. The main runner (run.js) executes compiler, reactivity, and SSR benchmarks in isolated child processes to prevent state contamination, reporting execution time and garbage collection metrics. A new compiler profiling system (profile-compiler.js, analyze-compiler-profile.js) captures V8 CPU profiles during test runs, generating flame graphs (speedscope format) and hotspot summaries (summary.md/json) to identify performance bottlenecks in the parser, walker, and printer. The suite also includes specific parser benchmarks (parser.bench.js) and a configuration for TypeScript/JavaScript type checking (tsconfig.json).
benchmarking · high confidence
New dev-time runtime modules for assignment, inspection, and HMR
The Svelte dev client now includes dedicated modules for handling assignment operators (\&&=\, \\|\|=\, \??=\) with stale-state warnings, inspecting reactive values with stack traces, and managing Hot Module Replacement (HMR) wrappers that preserve DOM anchors and getters/setters. It also adds utilities for logging effect trees, validating state ownership and binding integrity, and monkey-patching array methods to detect equality mismatches with proxied state.
packages/svelte/src/internal/client/dev · high confidence
New internal server blocks for HTML and raw snippets
The server-side rendering internals now include dedicated modules for handling HTML content and raw snippets. The new \html\ function safely renders string values, wrapping them with optional dev-mode hash comments for debugging, while the new \createRawSnippet\ function allows for the programmatic creation of snippets that render their output directly to the renderer's output buffer.
packages/svelte/src/internal/server/blocks · high confidence
New public compiler type definitions for Svelte 5
The compiler now exposes a comprehensive set of TypeScript type definitions for the Svelte 5 AST, CSS parsing, and compilation results. Users can now import specific types such as \CompileResult\, \CompileOptions\, \Warning\, and \CompileError\ from \svelte/compiler\, along with detailed AST node structures for templates and styles. This replaces the previous opaque \any\ return types and legacy interfaces, providing better type safety and IDE support for tooling that interacts with the Svelte compiler programmatically.
packages/svelte/src/compiler/types · high confidence
New reactive primitives for Date, Map, Set, URL, and media queries
The \svelte/reactivity\ module now exports reactive wrappers for common JavaScript built-ins: \SvelteDate\, \SvelteMap\, \SvelteSet\, \SvelteURL\, and \SvelteURLSearchParams\, along with a \MediaQuery\ helper. Reading properties or contents of these objects inside effects or deriveds will now trigger re-evaluation when the underlying data changes. \SvelteMap\ and \SvelteSet\ also include \getOrInsert\ and \getOrInsertComputed\ methods for convenient lazy initialization. A new \createSubscriber\ utility is provided to help integrate external event-based systems (like observers or websockets) with Svelte's reactivity.
packages/svelte/src/reactivity · high confidence
New reactivity module for window properties
The \svelte/reactivity/window\ module is now available, providing reactive views for common browser window and screen properties such as \scrollX\, \scrollY\, \innerWidth\, \innerHeight\, \online\, and \devicePixelRatio\. These values automatically update in response to relevant events (like resize or scroll) and return \undefined\ during server-side rendering, allowing components to safely track browser state without manual event handling.
packages/svelte/src/reactivity/window · high confidence
New sandbox utility scripts for test generation and project downloading
The sandbox now includes several new Node.js scripts to streamline development workflows. The \create-test.js\ script allows developers to convert an existing playground project into a structured test case by copying source files and generating a config file. The \download.js\ script enables downloading projects from local directories, GitHub repositories, or StackBlitz URLs (including browser-automated downloads for non-GitHub StackBlitz links). Additionally, \hash.js\ provides improved text versus binary file detection to ensure correct encoding when generating playground hashes, and \create-app-svelte.js\ helps scaffold the main application file from a template.
playgrounds/sandbox/scripts · high confidence
New shared store implementation module
A new \packages/svelte/src/store/shared/index.js\ module has been added, providing the core implementations for Svelte stores (\readable\, \writable\, \derived\, and \readonly\). This file centralizes the logic for store creation, subscription management, and value derivation, serving as the foundational runtime support for reactive state management in Svelte applications.
packages/svelte/src/store/shared · high confidence
New svelte/events package exports the on function with improved type definitions
A new \svelte/events\ package has been introduced, re-exporting the \on\ function from the internal client module. This package provides TypeScript definitions that explicitly support attaching event handlers to \Window\ and \Document\ objects, in addition to standard HTML elements and \MediaQueryList\. The type signatures ensure that the \currentTarget\ property within event handlers is correctly typed to match the target object (e.g., \Window\ or \Document\), improving type safety for developers using these APIs.
packages/svelte/src/events · high confidence
New toStore and fromStore utilities for bridging Svelte 5 state and stores
The store module now exports \toStore\ and \fromStore\ to facilitate interoperability between Svelte 5's reactive state and the traditional store API. \toStore\ creates a standard readable or writable store from a getter/setter pair, ensuring the store's subscription is correctly connected to the current effect context on the client (while providing a non-reactive fallback on the server). \fromStore\ converts a store into an object with a reactive \current\ property that tracks store updates in client-side effects, allowing store values to be used directly in reactive contexts. These utilities are implemented in new \index-client.js\ and \index-server.js\ files, with corresponding type definitions in \public.d.ts\ and \private.d.ts\.
packages/svelte/src/store · high confidence
Svelte 5 release with native TypeScript support and new runtime features
This release introduces Svelte 5, featuring native TypeScript support and a major overhaul of the compiler and runtime. Key additions include support for objects and arrays in the class attribute, variadic snippets, error boundaries, and new bindings for activeElement and pointerLockElement. The package also adds comprehensive type definitions for HTML and SVG elements, including new attributes like command, closedby, and fetchpriority, while removing legacy Sapper-related code and CJS runtime support.
packages/svelte · high confidence
Svelte 5 runtime and compiler foundations
This release introduces the Svelte 5 runtime, replacing the previous class-based component model with a function-based approach using runes like $state, $derived, and $effect. It adds new APIs such as $state.eager, $state.raw, and $state.snapshot, alongside lifecycle functions like onMount and onDestroy. The compiler now supports HTML tree validation, hydration markers, and MathML. Legacy compatibility is maintained via a legacy mode flag and the SvelteComponent class. The version is set to 5.57.1.
packages/svelte/src · high confidence
Removals
Removal of compiler entry point module
The main entry point file for the compiler (compiler/index.js) has been deleted. This file previously exported the parse and generate functions, meaning these core capabilities are no longer accessible through this specific module path.
compiler · high confidence
Removal of legacy template parser implementation
The legacy template parser located in the compiler/parse module has been removed. This deletion eliminates the previous hand-rolled recursive descent parser that handled basic HTML elements, text nodes, and mustache-style interpolation, along with its associated unit tests. Users relying on this specific parsing logic will no longer have access to it, indicating a shift to a different parsing strategy or module elsewhere in the codebase.
compiler/parse · high confidence
Architecture
CSS transformation engine migrated to zimmerframe
The CSS compiler's transformation phase now uses the zimmerframe library for AST walking instead of the previous implementation. This change restructures how CSS nodes are visited and modified, affecting internal processing of selectors, keyframes, and global blocks, while preserving the external compilation output and source map behavior.
packages/svelte/src/compiler/phases/3-transform/css · high confidence
Introduce new internal client runtime modules
The internal client runtime has been reorganized into dedicated modules. A new constants file defines bitflags for effect and reaction states (e.g., DERIVED, CLEAN, DIRTY) and symbols for state tracking. Error handling is now centralized in a dedicated module that manages error bubbling and component stack adjustments. A new hydratable module provides a runtime check for hydration state, and a legacy module captures deprecated signal logic. Additionally, a loop module manages requestAnimationFrame-based tasks, and the proxy implementation is expanded with new tests for property definition and array mutations.
packages/svelte/src/internal/client · high confidence
New client-side compiler transform architecture
The client-side compilation pipeline has been restructured to use a visitor-based AST transformation system powered by \zimmerframe\. This change introduces a new \transform-client.js\ entry point that walks the component's module, instance, and template ASTs using a comprehensive set of visitors (e.g., \Component\, \EachBlock\, \BindDirective\) to generate the final client code. It also adds a dedicated \types.d.ts\ file defining the \ClientTransformState\ and \ComponentClientTransformState\ interfaces, which track scope, hoisted templates, and reactive updates, alongside \utils.js\ containing helper functions for building getters, prop sources, and derived values. This refactors how Svelte generates client-side JavaScript, moving away from the previous linear transformation approach to a more modular visitor pattern.
packages/svelte/src/compiler/phases/3-transform/client · high confidence
New modular server-side rendering compiler implementation
The server-side rendering (SSR) compiler logic has been restructured into a new, modular architecture. The main transformation entry point (\transform-server.js\) now explicitly imports and utilizes dedicated visitor modules for every AST node type (such as \Component\, \EachBlock\, \RenderTag\, and \SvelteElement\) located in a \visitors/\ subdirectory, replacing the previous monolithic structure. This change is accompanied by a new \types.d.ts\ file that defines the specific state interfaces (\ServerTransformState\, \ComponentServerTransformState\) and visitor types required for this new SSR pipeline, establishing the foundation for the updated server rendering behavior.
packages/svelte/src/compiler/phases/3-transform/server · high confidence
New server-side compiler visitor architecture
The server-side compilation pipeline has been refactored to use a modular visitor pattern, introducing dedicated handler files for every AST node type (such as AwaitBlock, EachBlock, IfBlock, and SvelteBoundary) within the \packages/svelte/src/compiler/phases/3-transform/server/visitors\ directory. This change replaces the previous monolithic transformation logic with specialized visitors that handle specific template constructs, enabling more precise control over server-side rendering output and simplifying the maintenance of complex features like async blocks and error boundaries.
packages/svelte/src/compiler/phases/3-transform/server/visitors · high confidence
Refactor client transform visitors into individual modules
The client-side compiler transform logic has been reorganized from a monolithic structure into individual visitor modules (e.g., AnimateDirective, AssignmentExpression, AwaitBlock). This change improves code maintainability and modularity without altering the generated output or runtime behavior for users.
packages/svelte/src/compiler/phases/3-transform/client/visitors · high confidence
Refactor client-side compiler transform visitors into shared utilities
The client-side compiler's transformation logic for components, elements, fragments, events, and declarations has been reorganized into a new shared directory (\packages/svelte/src/compiler/phases/3-transform/client/visitors/shared\). This refactoring consolidates common logic—such as attribute building, event handling, and state transformation—into reusable modules, improving code maintainability and consistency across the compiler's client output generation.
packages/svelte/src/compiler/phases/3-transform/client/visitors/shared · high confidence
Refactor server-side rendering visitors into shared utilities
The server-side rendering compiler logic for components, elements, and shared utilities has been reorganized into a new \shared\ directory. This change introduces dedicated visitor files (\component.js\, \element.js\) and a \utils.js\ module to handle attribute building, slot serialization, and template construction, consolidating previously scattered logic into a modular structure for SSR code generation.
packages/svelte/src/compiler/phases/3-transform/server/visitors/shared · high confidence
Refactored A11y analysis into modular constants and visitor logic
The accessibility analysis logic in the compiler has been reorganized to improve maintainability. A new \constants.js\ file now centralizes ARIA attribute definitions, implicit role mappings, and interactive handler lists, while \index.js\ consolidates the visitor logic that checks elements against these rules. This structural change supports the numerous underlying fixes for specific A11y warnings (such as handling \pointer\/\touch\ events, \aria-braillelabel\, and \inert\ elements) by separating static data from the dynamic analysis flow.
packages/svelte/src/compiler/phases/2-analyze/visitors/shared/a11y · high confidence
Refactored DOM block runtime into modular, dedicated files
The internal client runtime for DOM blocks has been reorganized from a single monolithic file into separate, dedicated modules (async, await, boundary, branches, css-props, each, html, if, key, slot, snippet, svelte-component, svelte-element, and svelte-head). This change improves code maintainability and readability by isolating the logic for each block type, while preserving the existing behavior and hydration handling for all block types.
packages/svelte/src/internal/client/dom/blocks · high confidence
Refactored DOM element handling into modular internal files
The internal DOM element logic in \packages/svelte/src/internal/client/dom/elements\ has been reorganized into distinct, focused modules. New files now handle specific concerns: \actions.js\ manages element actions with reactive updates, \attachments.js\ handles stable attachment functions, \attributes.js\ centralizes attribute and property setting (including hydration fixes for inputs and selects), \class.js\ and \style.js\ manage CSS classes and inline styles, \custom-element.js\ implements the Svelte custom element wrapper, \customizable-select.js\ adds support for rich HTML content in \\<option\>\ elements, \events.js\ refactors event delegation and propagation, \misc.js\ contains utilities like autofocus and form reset handling, and \transitions.js\ manages intro/outro transitions and animations. This modularization improves maintainability and allows for more targeted fixes and optimizations in each area.
packages/svelte/src/internal/client/dom/elements · high confidence
Refactored compiler analysis visitors into shared modules
The Svelte compiler's analysis phase has been restructured by extracting shared validation and visitor logic into dedicated modules within \packages/svelte/src/compiler/phases/2-analyze/visitors/shared\. This change introduces new files for handling attributes, components, elements, fragments, functions, and snippets, centralizing logic such as attribute validation (including slot and event handler checks), component snippet resolution, and assignment validation. This refactoring improves code organization and maintainability within the compiler's analysis phase without altering the external behavior of the framework.
packages/svelte/src/compiler/phases/2-analyze/visitors/shared · high confidence
Refactored internal DOM runtime into modular files
The internal client DOM runtime has been reorganized from a monolithic structure into distinct modules (css.js, hydration.js, operations.js, reconciler.js, task.js, template.js, types.d.ts). This refactoring improves code maintainability and allows for better tree-shaking of unused hydration logic, but does not change the external API or user-facing behavior of Svelte components.
packages/svelte/src/internal/client/dom · high confidence
Svelte 5 compiler utility modules introduced
The compiler's internal utility layer has been restructured into a dedicated \packages/svelte/src/compiler/utils\ directory, introducing new modules for AST manipulation (\ast.js\), code generation (\builders.js\), source map handling (\mapped\_code.js\), and diagnostic reporting (\compile\_diagnostic.js\). This change includes new helpers for extracting identifiers, building AST nodes, and managing source maps, alongside utilities for fuzzy-matching warning codes and sanitizing template strings, laying the groundwork for the Svelte 5 compiler architecture.
packages/svelte/src/compiler/utils · high confidence
Behavioural changes
Automated browser support detection and treeshakeability checks
The Svelte build process now includes automated scripts to verify that runtime code is fully treeshakeable and to generate an up-to-date browser support documentation page. The new \check-treeshakeability.js\ script bundles runtime entry points and ensures unused code (such as hydration or legacy mode logic) is removed, while \generate-browser-support.ts\ analyzes the compiled runtime against the \web-features\ dataset to automatically document which browser versions are required for specific Svelte features and APIs.
packages/svelte/scripts · high confidence
Improved FLIP animation handling for scaled and zoomed elements
The \flip\ animation function in \packages/svelte/src/animate\ has been updated to correctly account for parent element scaling and browser zoom levels. By calculating the effective zoom factor and adjusting the translation and scale values based on the transform origin, animations now maintain visual consistency when elements are nested within scaled containers or when the page is zoomed, preventing layout shifts or incorrect positioning during the transition.
packages/svelte/src/animate · high confidence
Improved source map handling for preprocessors
The compiler's preprocessing pipeline now correctly tracks and combines source maps when script or style tags are transformed. This ensures that error messages and debugging tools accurately point back to the original source code, even after preprocessing steps modify the content.
packages/svelte/src/compiler/preprocess · high confidence
Improved template generation and XHTML compliance
The client-side template transformation now supports functional template generation, allowing templates to be built as structured trees rather than raw HTML strings, which enables more efficient deduplication of identical hoisted templates. Additionally, the compiler now ensures XHTML compliance by always lowercasing HTML element names and properly self-closing void elements, while also preserving node locations in development mode to improve source map accuracy for debugging.
packages/svelte/src/compiler/phases/3-transform/client/transform-template · high confidence
Introduces internal flags for async, legacy, and tracing modes
The internal flags module now exposes boolean flags to control async mode, legacy mode, and tracing mode. These flags allow the runtime to conditionally enable or disable specific behaviors, such as supporting \await\ in components, maintaining compatibility with older Svelte code, or managing the overhead of \$inspect.trace\ during development.
packages/svelte/src/internal/flags · high confidence
Legacy event modifiers and lifecycle hooks now use Svelte 4-compatible behavior
In the legacy compatibility layer, event modifiers (such as \self\, \stopPropagation\, \once\, \preventDefault\, and \passive\) and lifecycle hooks (\onMount\, \beforeUpdate\, \afterUpdate\) have been reimplemented to align with Svelte 4 semantics. This ensures that event handling and component lifecycle execution in legacy mode behave consistently with Svelte 4 applications, particularly regarding how event propagation is managed and when update callbacks are triggered.
packages/svelte/src/internal/client/dom/legacy · high confidence
New Spring and Tween classes with prefersReducedMotion support
The \svelte/motion\ module now exports \Spring\ and \Tween\ classes alongside the legacy \spring\ and \tweened\ stores, offering a modern API with \target\ and \current\ properties for more intuitive animation control. A new \prefersReducedMotion\ media query is also exported, allowing developers to easily disable animations for users who prefer reduced motion. The underlying animation logic has been updated to handle non-numeric values by snapping immediately, fix erratic spring behavior during long delays, and correctly manage tween state when targets change continuously.
packages/svelte/src/motion · high confidence
New client-side bindings implementation for document, input, media, select, and window elements
The \packages/svelte/src/internal/client/dom/elements/bindings\ directory now contains the new runtime implementations for element bindings. This includes \bind\_active\_element\ for tracking the document's active element, comprehensive handlers for \bind:value\ and \bind:group\ on inputs (including cursor restoration and hydration support), bindings for media elements (\bind:paused\, \bind:current\_time\, etc.), \bind:select\_value\ with mutation observer support for dynamic options, and bindings for window scroll/size and document scroll. These files replace the previous logic for these bindings in the client runtime.
packages/svelte/src/internal/client/dom/elements/bindings · high confidence
Refactored parser utilities for bracket matching and HTML entity decoding
The parser's utility layer has been restructured into dedicated modules: \bracket.js\ now handles matching brackets while correctly skipping strings, comments, and regexes; \entities.js\ provides a comprehensive map of HTML named character references; and \html.js\ implements character reference decoding that supports uppercase hex escapes, preserves line feeds in attribute values, and validates Unicode code points against HTML spec rules. A new \whitespace.js\ utility standardizes whitespace detection using code points. These changes improve parsing accuracy for complex expressions and special characters while optimizing performance.
packages/svelte/src/compiler/phases/1-parse/utils · high confidence
Refactored runtime internals into a shared module
The internal runtime logic previously scattered across the client and server packages has been consolidated into a new \packages/svelte/src/internal/shared\ directory. This change introduces dedicated modules for handling DOM attributes (\attributes.js\), deep cloning and state snapshots (\clone.js\), context management (\context.js\), and development-time utilities like error formatting and invariant checks (\dev.js\, \errors.js\, \warnings.js\). By centralizing these core utilities, the framework ensures consistent behavior for features like \$state.snapshot\ and attribute rendering across both client and server environments.
packages/svelte/src/internal/shared · high confidence
Removal of private 'svelte/internal' API with runtime error
The private 'svelte/internal' module has been removed in Svelte 5. Importing from this path now throws a runtime error, alerting users that the module is no longer public API and suggesting they raise an issue if they are library authors relying on it. A new 'svelte/internal/disclose-version' file has been added to register the Svelte version on the window object for debugging purposes.
packages/svelte/src/internal · high confidence
Repository infrastructure overhaul for Svelte 5 development
The repository has been restructured to support the Svelte 5 monorepo and its new tooling chain. Key changes include migrating the test runner from Mocha to Vitest (evidenced by the new \vitest.config.js\ and removal of \mocha.opts\), adopting pnpm workspaces (\pnpm-workspace.yaml\), and configuring ESLint v9 (\eslint.config.js\) with a custom rule to prevent compiler imports in runtime code. The project now enforces consistent code formatting via \.editorconfig\ and \.prettierrc\ (using tabs for code, spaces for JSON/Markdown) and adds a custom JSDOM environment for XHTML tests. Documentation and contribution guidelines have been updated (\CONTRIBUTING.md\, \AGENTS.md\), and the repository now includes \FUNDING.json\ for Drips support.
(repo-wide) · high confidence
Sandbox restructured for Svelte 5 async support and unified SSR
The sandbox playground has been completely restructured to support Svelte 5 features, specifically enabling async components and Server-Side Rendering (SSR). The new setup uses a dedicated \run.js\ script to compile components with the \experimental.async\ flag, while \ssr-dev.js\ and \ssr-prod.js\ handle development and production SSR rendering via Vite and Polka respectively. Configuration is now centralized in \svelte.config.js\ with CSS injection and HMR disabled, and the UI styling has been updated to use modern CSS selectors like \:is()\ and \:where()\.
playgrounds/sandbox · high confidence
Server-side rendering API restructured with new options and types
The server-side rendering entry point has been updated to expose a refined \render\ function and associated types. Users can now configure rendering with an \idPrefix\ for consistent DOM IDs, \csp\ settings for Content Security Policy support, and a \transformError\ hook to customize error handling during server-side rendering. The API also exports new type definitions including \RenderOutput\, \SyncRenderOutput\, \Csp\, and \Sha256Source\ to provide better type safety and clarity for server-rendered HTML output.
packages/svelte/src/server · high confidence
Standardized runtime and compile-time error and warning templates
The message generation templates for client, server, shared, and compile-time errors and warnings have been updated to consistently include documentation links (https://svelte.dev/e/{code}) in all output. Runtime errors and warnings now suppress verbose stack traces and console output in production builds, showing only the documentation link, while compile-time errors now extend the native Error class to improve compatibility with bundler plugins and include position diagnostics.
packages/svelte/scripts/process-messages/templates · high confidence
Svelte 5 compiler analysis phase restructured
The compiler's analysis phase (packages/svelte/src/compiler/phases/2-analyze) has been completely rewritten for Svelte 5. The new implementation introduces a modular visitor architecture using zimmerframe, replacing the previous monolithic analysis logic. This change establishes the foundational analysis infrastructure for Svelte 5's runes mode, including support for new state management patterns, improved async handling, and enhanced TypeScript integration. The restructured analysis phase provides the core capability for the new component model and reactive system introduced in Svelte 5.
packages/svelte/src/compiler/phases/2-analyze · high confidence
Svelte 5 compiler architecture and binding definitions
The compiler in \packages/svelte/src/compiler/phases\ has been restructured for Svelte 5, introducing new core modules that define the compiler's internal model. A new \bindings.js\ file centralizes the configuration for all supported bindings (such as \bind:value\, \bind:focused\, and \bind:group\), specifying their valid elements, SSR omission rules, and event listeners. The \scope.js\ module now defines the \Binding\ class and manages scope analysis, while \nodes.js\ introduces the \ExpressionMetadata\ class to track reactive dependencies, async blockers, and state references in expressions. Additionally, \css.js\ and \patterns.js\ provide dedicated utilities for CSS analysis and regex patterns, and \types.d.ts\ updates the TypeScript definitions to reflect these new internal structures.
packages/svelte/src/compiler/phases · high confidence
Svelte 5 compiler initialization and new error/warning infrastructure
The compiler has been initialized for Svelte 5, introducing a new error and warning system where diagnostics are generated from a central message catalog and exposed as structured \CompileError\ and \CompileWarning\ objects. This change brings stricter validation for compiler options (such as removing legacy options like \legacy\ and \format\), enforces runes-mode syntax rules, and improves source map accuracy by preserving node locations. Users will see more precise error messages with direct links to documentation, and the compiler now supports modern AST output via the \modernAst\ option while maintaining backward compatibility through a legacy AST converter.
packages/svelte/src/compiler · high confidence
Svelte 5 compiler parser rewritten for runes mode and new syntax
The template parser in \packages/svelte/src/compiler/phases/1-parse/state\ has been completely rewritten from scratch to support Svelte 5's new runes mode and syntax. This change introduces new state handlers for elements, fragments, tags, and text, replacing the previous implementation. The new parser enforces stricter validation for component names, element names, and meta-tags (like \svelte:element\ and \svelte:component\), and introduces support for new features such as declarations in templates (\{let x = ...}\), arbitrary call expressions in render tags, and variadic snippets. It also handles loose parsing modes more robustly, allowing for incomplete syntax during typing, and improves error reporting for invalid tags and attributes.
packages/svelte/src/compiler/phases/1-parse/state · high confidence
Svelte 5 compiler parser rewritten with new parsing modules
The compiler's parsing logic for component context, expressions, options, scripts, and styles has been completely rewritten in new files (context.js, expression.js, options.js, script.js, style.js). This structural change introduces a new parser implementation that handles TypeScript type annotations in patterns, optimizes simple expression parsing for performance, enforces stricter validation for \\<svelte:options\>\ (including custom element configuration), and updates CSS selector parsing. For users, this represents the foundational shift to the Svelte 5 compiler architecture, bringing improved performance, better TypeScript support, and stricter adherence to modern web standards in how components are parsed.
packages/svelte/src/compiler/phases/1-parse/read · high confidence
Svelte 5 compiler transform phase restructured with new state and utility modules
The compiler's transform phase has been reorganized into new entry points and supporting modules. The main \index.js\ now explicitly routes component and module transformations to dedicated server and client handlers, ensuring generated code includes version comments and robust source maps. A new \types.d.ts\ defines a \TransformState\ interface that centralizes analysis, options, and scope data for the transformation process. Additionally, \utils.js\ introduces logic to sort \ConstTag\ nodes in topological order for non-runes mode and implements whitespace cleaning rules for template nodes, separating hoisted declarations from regular content.
packages/svelte/src/compiler/phases/3-transform · high confidence
Svelte 5 introduces new TypeScript types for Actions
The Svelte 5 release introduces new TypeScript interfaces, \Action\ and \ActionReturn\, for defining and typing element actions. These types allow developers to specify the element type, action parameters, and additional attributes or events enabled by the action, improving type safety and developer experience when working with custom actions in Svelte 5.
packages/svelte/src/action · high confidence
Svelte 5 introduces new easing functions
The easing module has been rewritten for Svelte 5, providing a fresh set of animation easing functions (such as linear, back, bounce, circ, cubic, elastic, and exponential variants) adapted from the mattdesl/eases library. This change represents a breaking update to the easing API, replacing the previous implementation with this new set of exports.
packages/svelte/src/easing · high confidence
Svelte 5 transition module restructured with slide behavior fixes
The \svelte/transition\ module has been reorganized for Svelte 5, introducing a new public API surface (\public.d.ts\) and updating the implementation in \index.js\. The \slide\ transition now accounts for \min-width\ and \min-height\ constraints to prevent layout issues, and it emits a development warning when used on elements with invalid display styles (such as \inline\ or \contents\). Internal helper functions have been removed from the public exports, and missing transition functions have been added to ensure completeness.
packages/svelte/src/transition · high confidence
Svelte 5 type definitions overhaul
The \packages/svelte/types\ package has been replaced with a new \index.d.ts\ file that reflects the Svelte 5 architecture. Components are now functions rather than classes, introducing a new \Component\ interface for type-safe component definitions and deprecating legacy types like \SvelteComponent\ and \SvelteComponentTyped\. The API for instantiation has shifted from the \new\ keyword to the \mount\ function, and the \ComponentConstructorOptions\ interface is marked as deprecated. This change aligns the public type definitions with the runtime behavior of Svelte 5, requiring users to update their TypeScript typings to use the new \Component\ type and \mount\ API.
packages/svelte/types · high confidence
Fixes
Improved async code generation and destructuring handling in the compiler
The compiler now generates more efficient server-side code by transforming async statements into non-blocking thunks, allowing multiple await expressions to run concurrently rather than sequentially. Additionally, a new shared assignment visitor ensures that array and object destructuring assignments are correctly compiled, particularly when they involve await expressions or iterators, preventing build errors and ensuring correct variable initialization in both client and server contexts.
packages/svelte/src/compiler/phases/3-transform/shared · high confidence
Refactored CSS analysis and pruning logic
The CSS analysis and pruning logic in the compiler has been refactored to use the \zimmerframe\ walker instead of the previous visitor system. This change introduces new files (\css-analyze.js\, \css-prune.js\, \css-warn.js\) that handle selector validation, scoping, and unused selector warnings. The refactoring ensures more robust handling of \:global\ selectors, nesting selectors (\&\), and pseudo-classes like \:has\, \:is\, and \:where\, while also fixing issues with CSS pruning inside snippets and \\<svelte:head\>\ elements.
packages/svelte/src/compiler/phases/2-analyze/css · high confidence
Test coverage
Add parser test for svelte:options and module script attributes; Add runtime production environment tests; Add snapshot test for binding to component props with snippets; Added CSS test runner for Svelte 5; Added CSS test suite for Svelte 5; Added compiler error test suite infrastructure; Added legacy runtime tests for actions, animations, and directive ordering; Added parser test for CSS :nth syntax; Added parser test for Svelte files with script and style but no markup; Added parser test for TypeScript types in event handlers; Added parser test for TypeScript-typed snippets; Added parser test for comments in function binding; Added parser test for comments preceding script tags; Added parser test for comments within HTML tags; Added parser test for parenthesized template expressions with comments; Added parser test for semicolons inside CSS quotes; Added parser test for template with shadowrootmode attribute; Added parser tests for CSS pseudo-classes and pseudo-elements; Added parser tests for generic snippets; Added parser tests for if-block structures; Added parser tests for loose mode edge cases; Added parser tests for object destructuring defaults in each blocks; Added parser tests for template declarations and type identifier handling; Added parser tests for the @attach directive; Added parser tests for {@const} with parenthesized initializers; Added parser-legacy test suite for Svelte components; Added parser-modern test suite with BOM stripping verification; Added reactivity benchmark tests; Added runtime XHTML compliance test suite; Added runtime browser tests for Svelte 5 features and fixes; Added runtime-legacy test infrastructure; Added server-side rendering tests for async features and error boundaries; Added snapshot test for async const tags; Added snapshot test for delegated event handling with shadowed local variables; Added snapshot test for derived text nodes; Added snapshot test for each block with string templates; Added snapshot test for each loop with non-null index; Added snapshot test for function props without getters; Added snapshot test for state proxy with template literals; Added snapshot test infrastructure for Svelte compiler output; Added snapshot tests for $inspect with top-level await in SSR; Added snapshot tests for HMR compilation output; Added snapshot tests for TypeScript optional parameter handling; Added snapshot tests for \\<svelte:element\>\ component; Added snapshot tests for \bind:this\ directive; Added snapshot tests for async derived values and top-level sync grouping; Added snapshot tests for async each block hoisting and fallback handling; Added snapshot tests for async if-else chains; Added snapshot tests for async if/else hoisting; Added snapshot tests for await block scope isolation; Added snapshot tests for class state field assignments in constructors; Added snapshot tests for customizable select with rich content; Added snapshot tests for destructuring assignments; Added snapshot tests for dynamic attribute casing; Added snapshot tests for exporting reactive state; Added snapshot tests for functional tree-based templating; Added snapshot tests for nullish coalescing omission; Added snapshot tests for static subtree skipping logic; Added snapshot tests for the basic 'hello world' component; Added snapshot tests for the purity compiler optimization; Added sourcemap test suite for Svelte components; Added sourcemap validation tests; Added test coverage for Svelte motion utilities; Added test coverage for Svelte preprocess API; Added test coverage for minified CSS :nth-child selectors; Added test for destructuring with default values in each blocks; Added tests for the Svelte AST printer; Added type tests for Svelte 5 APIs; Added unit tests for Svelte store primitives; Added unit tests for the Svelte 5 signal runtime; Added validator test cases for accessibility rules; Added validator test infrastructure and specific validation tests; Expanded compiler error test coverage for Svelte 5; Expanded runtime runes test coverage; Expanded test coverage for Svelte custom element runtime behavior; Migration test suite expanded for runes, slots, and event handlers; New hydration test runner infrastructure; New runtime-browser test harness with SSR and custom-element support; New test infrastructure for Svelte 5 compiler and runtime; SSR test runner now supports async rendering, CSP, and idPrefix; Snapshot tests for non-destructured $props() identifier usage.
Dependencies
Svelte 5.57.1 monorepo release with Node 18+ requirement and pnpm 10 support
This release updates the Svelte package to version 5.57.1 and restructures the project as a pnpm monorepo. The main \svelte\ package now requires Node.js 18 or higher and exposes a comprehensive set of subpath exports (including \./reactivity\, \./store\, \./server\, \./legacy\, and \./internal/\*\) alongside internal import maps for client and server types. The repository root now uses pnpm 10.33.4 as the package manager, and the build/test tooling has shifted to Vitest, ESLint v10, and TypeScript 5.5.4, replacing the previous Mocha-based test suite.
(dependencies) · high confidence
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
How this codebase got here
This is the PUBLIC form of this artifact. Findings are listed in full, but the details of SECURITY findings — which rule fired, in which file, on which line, and how to fix it — are deliberately withheld, and any secret-scanner results are excluded entirely. Where detail is absent here it was REMOVED FOR PUBLICATION; it is not missing from the analysis. The complete artifact is available from the repository owner.
Score
- CAI 58 → 58 (+0.4)
- Rubric changed (rubric-2026.09.11 → rubric-2026.09.18) — scores are not directly comparable.
Lenses
- Code Health 60 → 62 (+1.6)
- Architecture 57 → 61 (+4.6)
- Maturity 54 → 54 (-0.4)
- Readiness 62 → 63 (+0.5)
- Security 65 → 66 (+1.4)
- Accessibility 87 → 75 (-11.9)
- Performance 60 (new)
Resolved (24)
- Documentation: no usage examples (README.md)
- Hotspot: packages/svelte/src/compiler/phases/1-parse/acorn.js (packages/svelte/src/compiler/phases/1-parse/acorn.js)
- Hotspot: packages/svelte/src/compiler/phases/1-parse/state/element.js (packages/svelte/src/compiler/phases/1-parse/state/element.js)
- Hotspot: packages/svelte/src/compiler/phases/1-parse/state/tag.js (packages/svelte/src/compiler/phases/1-parse/state/tag.js)
- Hotspot: packages/svelte/src/compiler/phases/1-parse/utils/html.js (packages/svelte/src/compiler/phases/1-parse/utils/html.js)
- Hotspot: packages/svelte/src/compiler/phases/2-analyze/css/css-prune.js (packages/svelte/src/compiler/phases/2-analyze/css/css-prune.js)
- Hotspot: packages/svelte/src/compiler/phases/2-analyze/visitors/shared/utils.js (packages/svelte/src/compiler/phases/2-analyze/visitors/shared/utils.js)
- Hotspot: packages/svelte/src/compiler/phases/3-transform/client/utils.js (packages/svelte/src/compiler/phases/3-transform/client/utils.js)
- Hotspot: packages/svelte/src/compiler/phases/3-transform/client/visitors/AssignmentExpression.js (packages/svelte/src/compiler/phases/3-transform/client/visitors/AssignmentExpression.js)
- Hotspot: packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/fragment.js (packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/fragment.js)
- Hotspot: packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js (packages/svelte/src/compiler/phases/3-transform/client/visitors/shared/utils.js)
- Hotspot: packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/utils.js (packages/svelte/src/compiler/phases/3-transform/server/visitors/shared/utils.js)
- Hotspot: packages/svelte/src/compiler/phases/nodes.js (packages/svelte/src/compiler/phases/nodes.js)
- Hotspot: packages/svelte/src/compiler/utils/mapped_code.js (packages/svelte/src/compiler/utils/mapped_code.js)
- Hotspot: packages/svelte/src/internal/client/dom/elements/events.js (packages/svelte/src/internal/client/dom/elements/events.js)
- Hotspot: packages/svelte/src/internal/client/reactivity/deriveds.js (packages/svelte/src/internal/client/reactivity/deriveds.js)
- Hotspot: packages/svelte/src/internal/client/reactivity/effects.js (packages/svelte/src/internal/client/reactivity/effects.js)
- Hotspot: packages/svelte/src/internal/client/runtime.js (packages/svelte/src/internal/client/runtime.js)
- Hotspot: packages/svelte/src/internal/shared/attributes.js (packages/svelte/src/internal/shared/attributes.js)
- Off-boarding risk: anonymized user #1
- …and 4 more
New (34)
- #handle_error (cognitive 17) (packages/svelte/src/internal/client/dom/blocks/boundary.js)
- Boundary.#handle_error (cyclomatic 16) (packages/svelte/src/internal/client/dom/blocks/boundary.js)
- Documentation: no project overview (README.md)
- High: security finding (details withheld)
- High: security finding (details withheld)
- Hotspot: packages/svelte/src/internal/client/dom/blocks/boundary.js (packages/svelte/src/internal/client/dom/blocks/boundary.js)
- Hotspot: packages/svelte/src/internal/client/dom/elements/transitions.js (packages/svelte/src/internal/client/dom/elements/transitions.js)
- Hotspot: packages/svelte/src/internal/client/proxy.js (packages/svelte/src/internal/client/proxy.js)
- LetDirective.LetDirective (cyclomatic 18) (packages/svelte/src/compiler/phases/2-analyze/visitors/LetDirective.js)
- Medium: security finding (details withheld)
- Medium: security finding (details withheld)
- Off-boarding risk: anonymized user #1
- Outdated (npm): devalue
- Skipped (documented): (unnamed test) (packages/svelte/tests/compiler-errors/samples/let-directive-children-snippet-expression/_config.js)
- Skipped (documented): (unnamed test) (packages/svelte/tests/compiler-errors/samples/let-directive-children-snippet/_config.js)
- Skipped (documented): (unnamed test) (packages/svelte/tests/hydration/samples/boundary-mismatch-recovery/_config.js)
- Skipped (documented): (unnamed test) (packages/svelte/tests/hydration/samples/dynamic-element-child-mismatch/_config.js)
- Skipped (documented): (unnamed test) (packages/svelte/tests/runtime-browser/samples/dynamic-element-hydration-preserves-connection/_config.js)
- Skipped (documented): (unnamed test) (packages/svelte/tests/runtime-browser/samples/dynamic-element-hydration-preserves-connection/_config.js)
- Skipped (documented): (unnamed test) (packages/svelte/tests/runtime-browser/samples/spread-input-number-incomplete-value/_config.js)
- …and 14 more
Changes since last survey
- 20 commits — 3 feature/other, 17 fixes
By area
- packages/svelte — 17 commits
- .changeset/major-papayas-run.md — 1 commit
- .changeset/major-roses-help.md — 1 commit
- .changeset/short-radios-sneeze.md — 1 commit
Notable commits
- fix: fix: avoid reinserting dynamic elements during hydration (#18855)
- fix: fix: bypass error boundaries for hydration recovery (#18841)
- fix: fix: don't hang migrate on a declaration that shares a line with its script tag (#18816)
- fix: fix: don't overwrite an unchanged spread value (#18864)
- fix: fix: don't warn about redundant link role on <area> without href (#18872)
- fix: fix: ensure hydration state restoration for custom element attribute updates (#18467)
- fix: fix: error at compile time when a declaration in a snippet redeclares one of its parameters (#18842)
- fix: fix: error when using let: directives on a component with a children snippet (#18873)
- fix: fix: flush anything pending before invoking flushSync callback function (#18878)
- fix: fix: handle deferred transitions aborted before initialization (#18776)
- fix: fix: ignore stale boundary resets after destruction (#18886)
- fix: fix: keep a reactive assignment with no dependencies when migrate cannot turn it into a declaration (#18817)
- fix: fix: make Object.hasOwn reactive for state proxies (#18838)
- fix: fix: preserve location information for await wrappers (#18859)
- fix: fix: prevent untracked derived reads from retaining dependencies (#18829)
- fix: fix: read batch-local array on each-block commit (#18879)
- fix: fix: remove incorrect special handling of :export pseudo-selectors (#18839)
- change: Version Packages (#18750)
- change: chore: extract some minor changes from #18861 (#18866)
- change: chore: fix typos in code comments (#18860)
Written by watchdog.canine.dev from the codebase's own history, inside the signed delivery this page is composed from.
Survey your own repository
sveltejs/svelte was measured the same way every project in this corpus was: the same rubric, at a pinned commit, with the result published in full. Point a surveyor at a repository you know and see whether you agree with it.
About this page
- The score is its most recent published measurement, taken on 1 October 2026 at a pinned commit. It is not a live figure and does not change until the project is measured again.
- Measured at commit 020242d6bef059df9ae8c13dc8dbff4c9b31e0ff — the exact code this score is about.
- Scored under rubric-2026.09.18 — the same rubric and the same method as every other entry in this index.
- Measured by watchdog.canine.dev using codehealth-analyzer preprod-e569280dd5e2.