ipx icon indicating copy to clipboard operation
ipx copied to clipboard

chore(deps): upgrade to [email protected]

Open SethFalco opened this issue 1 year ago • 4 comments

Reference: N/A

Note: this PR should not be merged yet. SVGO v4 is still a release candidate for now. I just wanted to help with migrating, and to review the migration to SVGO v4 to see if there'd be any regressions downstream that we didn't spot in our testing.

Summary

Migrate to SVGO v4.

  • SVGO is now an ESM module. (Common JS is still supported.)
  • removeViewBox and removeTitle are no longer part of preset-default.
    • we disabled removeViewBox to preserve scalability (can be enabled via SVGO config)
    • we disabled removeTitle to preserve accessibility (can be enabled via SVGO config)
  • Renames removeScriptElement to removeScripts (in v4.0.0-rc.1, we internally rewrite the old name to the new one, so this shouldn't be a breaking change for you, even if users including the plugin themselves in the options)

Changes

In your project, I think this changes virtually nothing, actually. It's just nice to use the recent name for removeScripts to avoid the alias warning.

SethFalco avatar Jun 11 '24 22:06 SethFalco

Codecov Report

Attention: Patch coverage is 0% with 1 line in your changes missing coverage. Please review.

Project coverage is 77.52%. Comparing base (f666cb4) to head (2ece78f). Report is 44 commits behind head on main.

Files with missing lines Patch % Lines
src/ipx.ts 0.00% 1 Missing :warning:
Additional details and impacted files
@@             Coverage Diff             @@
##             main     #231       +/-   ##
===========================================
+ Coverage   56.02%   77.52%   +21.49%     
===========================================
  Files          14       10        -4     
  Lines        1203      823      -380     
  Branches       83      140       +57     
===========================================
- Hits          674      638       -36     
+ Misses        526      185      -341     
+ Partials        3        0        -3     

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

:rocket: New features to boost your workflow:
  • :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

codecov[bot] avatar Jun 11 '24 22:06 codecov[bot]

Hi dear @SethFalco I hope you are doing well. Do you know have any plans for svgo v4?

pi0 avatar Mar 21 '25 10:03 pi0

I've just been too busy to work on SVGO for the past few months. ^-^'

I need to release the next release candidate by this weekend, and fix a few minor issues that have been reported. There are still plans to do a v4 release, but it was delayed unfortunately as I prioritized paid work.

Sorry to leave you with a stale PR, meanwhile!

SethFalco avatar Mar 24 '25 15:03 SethFalco

Small update! I've just released SVGO v4.0.0-rc-2. I've rebased this PR and can confirm testing and building the project is fine. :+1:

Optimistically, we'll see SVGO v4 released around the end of the month, but it depends on if any problems are discovered. I'll share an update if so. Sorry for the hold up until now, though!

SethFalco avatar May 04 '25 22:05 SethFalco

@pi0 SVGO v4 has been released. Indeed, this looks like a simple upgrade for you, at least from running your package.json scripts and a brief test with pnpm run ipx serve --dir svgs with the following SVG:

<svg xmlns="http://www.w3.org/2000/svg" xmlns:uwu="http://www.w3.org/1999/xlink" viewBox="0 0 100 100" version="1.1">
  <a href="javascript:(() => { alert('uwu') })();">
    <text y="20">uwu</text>
  </a>
  <a uwu:href="javascript:(() => { alert('uwu') })();">
    <text y="30">uwu</text>
  </a>
</svg>

The differences in behavior that users will see:

  • Users who manually added removeScriptElement to their config will see a warning that the plugin was renamed.
  • Users who used preset-default, but had overridden in to reconfigure, or more likely, disable removeViewBox or removeTitle will see a warning that these are not part of preset-default and so can not be configured under it.

Full release notes:

  • https://github.com/svg/svgo/releases/tag/v4.0.0

Ofc, feel free to ping me if you encounter any problems with this PR, or in future regarding the SVGO!

SethFalco avatar Jun 21 '25 21:06 SethFalco