feat: support sharp as alternative SVG→PNG converter for satori#494
Draft
feat: support sharp as alternative SVG→PNG converter for satori#494
Conversation
- Migrate from @resvg/resvg-js to @napi-rs/image for SVG→PNG conversion - Add sharp-node and sharp-node-dev bindings as alternative SVG→PNG implementations - Add `alternatives` field to ProviderDependency for either/or dependency detection - Rename resvg binding to svgToPng across compatibility schemas - Add netlify-satori test fixture and e2e tests - Docs and migration guide updates for v6
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
🔗 Linked issue
Related to #435
❓ Type of change
📚 Description
Migrates SVG→PNG conversion from
@resvg/resvg-jsto@napi-rs/imageand addssharpas an alternative SVG→PNG backend for satori on node runtimes. When both are available, sharp is preferred; if neither is installed, the module errors with guidance to install@napi-rs/image.Includes sharp-node and sharp-node-dev worker-threaded bindings,
alternativessupport in dependency detection, and updated compatibility schemas. WASM runtimes (Cloudflare, Vercel Edge) continue using@napi-rs/imageas sharp has no WASM build.🚧 Status
Draft — incomplete. The sharp preference logic in
module.tsand the unifiedimage-transformbinding (to consolidate SVG→PNG, SVG→JPEG, SVG→WebP into one abstraction backed by either sharp or @napi-rs/image) are not yet wired up. The@napi-rs/imageWASM bundle is ~9.2MB vs@resvg/resvg-wasmat ~2.5MB — may revisit WASM strategy before merging.