unjs / ipx

๐Ÿ–ผ๏ธ High performance, secure and easy-to-use image optimizer.
MIT License
1.21k stars 58 forks source link

feat: optimize + sanitize svg sources with svgo #180

Closed pi0 closed 9 months ago

pi0 commented 9 months ago

๐Ÿ”— Linked issue

Resolves #25

โ“ Type of change

๐Ÿ“š Description

This PR enables svgo optimization for SVG sources.

With SVGO integration, also we can now properly sanitize svg files to remove xss possibilities. Even tough already we are enable Content-Security-Policy, it was only available for on demand server.

XSS plugin is based on https://github.com/svg/svgo/pull/1664 by @cakeinpanic's pending PR โค๏ธ

๐Ÿ“ Checklist

codecov[bot] commented 9 months ago

Codecov Report

Merging #180 (5ab78e0) into main (3a2d92d) will decrease coverage by 0.61%. Report is 1 commits behind head on main. The diff coverage is 24.13%.

@@            Coverage Diff             @@
##             main     #180      +/-   ##
==========================================
- Coverage   54.62%   54.01%   -0.61%     
==========================================
  Files          11       11              
  Lines        1060     1083      +23     
  Branches       45       45              
==========================================
+ Hits          579      585       +6     
- Misses        481      498      +17     
Files Coverage ฮ”
src/ipx.ts 68.27% <24.13%> (-4.30%) :arrow_down: