@foldkit/vite-plugin weekly downloads statistics
By foldkit · npm · Vite plugins
Vite plugin for Foldkit with state-preserving live reload
@foldkit/vite-plugin has 12,745 recorded weekly downloads on npm, a decrease of 0.9% over the past 30 days.
It ranks #853 of 2,256 tracked npm listings by weekly downloads.
Over 90 days, weekly downloads changed by +432%.
PluginStats has 542 daily observations since Apr 24, 2025; the latest is from Oct 17, 2026.
About @foldkit/vite-plugin
@foldkit/vite-plugin
Vite plugin for Foldkit: view identity branding for the differ, plus state-preserving live reload.
Installation
Usage
Add the plugin to your vite.config.ts:
View identity
Foldkit's differ tracks two independent kinds of identity: user keys, which match siblings in dynamic lists, and a framework-managed identity, which decides whether a matched position is still the same thing. When the producing view function changes, the differ replaces the node instead of patching it, so DOM state cannot bleed across an identity change. Branches rendered inline by one view function share that function's identity and patch in place, exactly as same-type elements do in React; extracting the branches into named view functions makes them identity boundaries.
This plugin supplies that identity. At build time, in dev and production alike, it wraps every function return in your application modules with a branding call that stamps returned vnodes with the function's id (module path plus function name), set-if-absent. The identity is nothing else: it ships in the client bundle, so anything derived from the module's contents would be a published check against those contents. Identity therefore attaches at view-function boundaries, and any branching syntax behaves the same: if/else, ternaries, Effect Match, switch statements, and pattern-matching libraries are all equivalent, because identity belongs to the function that produced the subtree, not to the branch that selected it.
Foldkit core modules are never instrumented, and functions that never return vnodes are wrapped inertly. Builds without this plugin fall back to positional matching plus keys, where branch points need hand-written keys.
State-preserving live reload
When you save a file during development, the plugin:
1. Preserves your application's current Model 2. Triggers a full page reload 3. Restores the preserved Model after reload
Code changes do not reset the application. Forms stay filled, counters keep their values, and games keep their positions.
How it works
The plugin uses Vite's WebSocket connection to communicate between the dev server and browser:
• On file change: The browser sends the current Model to the Vite server for preservation. • On reload: The browser requests the preserved Model from the server and initializes the Foldkit Runtime with it.
The Model survives development reloads but clears on a manual browser refresh, so a refresh still resets the application.
Server rendering dev host
Pass ssr with the path to your server entry to render page requests through it during development:
With this set, the dev server converts HTML page requests to Web Request values, passes them to the entry's renderPage, and serves the returned Response. The request URL retains Vite's configured base prefix and the browser's query string. Vite continues to serve the client entry, HMR, and assets, and the server entry runs through Vite's module graph, so edits to it apply without a restart. The client side of the handoff needs no plugin configuration: a server-rendered application's client entry calls Runtime.hydrate instead of Runtime.run. Hydration adopts matching DOM, rebuilds mismatched subtrees, and refuses an invalid or cross-deployment handoff. The option shapes only the dev server; production hosts import the built server entry themselves. See the Server Rendering documentation for the full contract.
Vite retains ownership of configured proxy routes before Foldkit handles application requests. Vite's server.cors option applies to Vite-owned source modules, assets, and HMR. It does not add headers to application responses or answer their preflights. Preflight ownership follows Access-Control-Request-Method, so a preflight for an application POST reaches renderPage even when its path looks like an asset. An OPTIONS request without both Origin and Access-Control-Request-Method is not a preflight and also reaches renderPage. Define application CORS in renderPage, where development and the deployed host share one policy. Vite's allowedHosts check runs before proxy and application handling, including OPTIONS and methods the Web Request API cannot represent.
Server-rendered documents
With ssr.build, the client input is a script and the server entry produces the complete HTML document. Configure the script beside the server entry:
Import CSS from the client script. Export renderDocument alongside renderPage in the server entry:
Server.renderDocument(application, assets, options) assembles the document with the application's title, language, direction, canonical URL, and Open Graph URL. assets contains the emitted entryScript, ordered stylesheets, and modulePreloads. The plugin collects static imports and their CSS, leaves lazy imports to Vite's runtime, and supplies the same assets to request-time rendering and prerendering. The default document includes UTF-8 and viewport metadata. Wrap the helper to set a default lang or add trusted author-owned head markup, such as a favicon. Never interpolate unescaped request data into head.
The client build starts from a script rather than HTML. index.html appears in the client output only when prerendering generates /. The build refuses an existing root document copied from publicDir, emitted by another plugin, or left by an earlier build when emptyOutDir is disabled. Remove the source index.html when migrating an SSR build, move its stylesheet links into client imports, and move document tags into renderDocument. Build-time transformIndexHtml hooks do not run with a script input. In development, Vite transforms the rendered document for HMR and dev HTML hooks. containerId belongs only to a template-based custom host and cannot be combined with clientEntry.…
Description from the npm listing.
- vite
- vite-plugin
- foldkit
- live-reload
- state-preservation
Charts
Images: 30d · 1y · all time · 1600×900 dark
Adoption over time
7/30/90-day growth
Ranking history
Listing placement
Filled points are observed values; hollow points come from Internet Archive snapshots of the listing page. Dashed segments span periods with no observations — values between points are not interpolated.
Each band is one page of 20. Weekly downloads on a log scale. Placement is projected from weekly downloads, so it can differ from the marketplace's own sort order. Hover a dot to see the listing.
Recent observations
Full history (542)Similar npm Vite plugins plugins
All 20 @foldkit/vite-plugin alternativesData source
Weekly downloads (trailing 7 complete days) come from the official npm downloads API. Downloads include CI and mirrors and are not equivalent to installs or users. npm publishes no ratings.
Listing: https://www.npmjs.com/package/@foldkit/vite-plugin. First seen Oct 16, 2026; last successful collection Oct 19, 2026. See the methodology.