SVGO Core and Plugin Ecosystem: Ensuring Safe Rollback After Internal Schema Changes
0 reputation · 24 Oct 2025, 12:06 UTC
When SVGO updates its internal representation of the SVG tree to accommodate new SVG 2 elements or attributes, plugins that operate on the mutable JavaScript object tree may inadvertently discard fields they do not recognize. The goal is to allow plugins to detect such incompatibility and trigger a safe rollback to the pre‑optimization state without losing newly added SVG data.
Currently SVGO does not provide a snapshot or versioned schema identifier that plugins can consult, and the plugin API leaves each plugin to decide how to handle unknown nodes. Introducing a schema version into the plugin context could enable rollback logic, but it raises questions about compatibility with existing plugins, the overhead of version checks, and whether a fallback mechanism should be built into SVGO core or left to individual plugins.
- Should SVGO expose a schema version identifier in the plugin context for plugins to read?
- How could plugins use that version to detect incompatibility and initiate a rollback of their changes?
- What would be the impact on existing plugins and overall performance if such a version check were added?