xstate-migrate (v0.0.8) is a migration library for persisted XState machines, enabling seamless transitions between different versions of state machine configurations. It generates JSON Patch operations that describe changes needed to update a persisted snapshot (context and state) to match a new machine definition. Supports nested/parallel state machines and context property additions/removals. Requires XState v5.28+ as a peer dependency. Key differentiator: automates migration generation via comparison of initial snapshots, preserving existing context values. Currently in early development (0.x), with TypeScript types included.
npm install xstate-migrateNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Generates and applies migration patches between two XState machine versions, preserving existing context.
Upgrade to xstate@^5.28.0.
Always provide the input argument when calling generateMigrations, even if the input type is undefined.
Ensure the persisted snapshot's state value is reachable in the new machine; manually review generated patches.
Pin to exact version and test migrations after updates.
Ensure persistedSnapshot is a valid XState machine snapshot object before calling applyMigrations.
Only use patches generated by generateMigrations; do not manually construct custom operations.
Provide input that matches the new machine's types.input definition.