Repository navigation
chore(deps): bump [email protected] - #95507
Conversation
Tests PassedCommit: e754027 |
Stats from current PR🔴 1 regression
📊 All Metrics📖 Metrics GlossaryDev Server Metrics:
Build Metrics:
Change Thresholds:
⚡ Dev Server
📦 Dev Server (Webpack) (Legacy)📦 Dev Server (Webpack)
⚡ Production Builds
📦 Production Builds (Webpack) (Legacy)📦 Production Builds (Webpack)
📦 Bundle SizesBundle Sizes⚡ TurbopackClient Main Bundles
Server Middleware
Build DetailsBuild Manifests
📦 WebpackClient Main Bundles
Polyfills
Pages
Server Edge SSR
Middleware
Build DetailsBuild Manifests
Build Cache
🔄 Shared (bundler-independent)Runtimes
📎 Tarball URLCommit: e754027 |
| const t = meta?.mediaType | ||
| if (t && [AVIF, WEBP, JPEG, PNG, GIF, SVG, TIFF].includes(t)) { | ||
| return t | ||
| } |
There was a problem hiding this comment.
The new version of sharp changed the metadata response.
- Before
{ "format": "avif" } - After
{ "format": "heic", "mediaType": "image/avif" }
Since this code is after the mediaType, we can just return it here instead of needing to merge with the other detector response.
Also we can probably remove this sharp metadata call in a future PR anyway.
| default: | ||
| return null | ||
| format satisfies never // exhaustive check | ||
| return null // impossible to reach |
There was a problem hiding this comment.
The satisfies makes it safer in the future since we'll get a build error if we forget to add a case
| if (contentType === AVIF) { | ||
| transformer.avif({ | ||
| quality: Math.max(quality - 20, 1), | ||
| quality: Math.max(quality - 30, 1), |
There was a problem hiding this comment.
This was necessary since the avif output was larger than the webp output and we have a test to catch this problem.
I checked what sharp recommends and they have a default quality of 80 for webp and 50 for avif so a difference of 30 is expected here.
I also used my human eye balls to verify there is no discernable difference when converting mountains.jpg to webp or avif at this new quality.
There was a problem hiding this comment.
Also here's an anaylsis for the output comparing before/after
There was a problem hiding this comment.
I checked what sharp recommends and they have a default quality of 80 for webp and 50 for avif so a difference of 30 is expected here.
It'd be good to add a comment here with a link to the docs.
Also, unclear if just subtracting 30 is better, or if multiplying by 50/80 is better. The second option would probably scale better to really low quality settings?
Looking around I found this:
https://www.industrialempathy.com/posts/avif-webp-quality-settings/#quality-settings-for-a-range-of-jpeg-qualities
https://docs.google.com/spreadsheets/d/1E29kPLR5_0PThsw6SVbco7HvMU0aynBLfVN0RfIXgPk/edit?gid=1245219304#gid=1245219304
That implies something closer to a coefficient than a constant offset.
There was a problem hiding this comment.
I applied your suggestion for the 50/80 ratio in 78d062f since it makes avif better match webp at an value of quality 👍
See results here: avif-quality-comparison-ratio-w1024.html.zip
| } | ||
| if ( | ||
| file.match( | ||
| /\/node_modules\/@img\/sharp-\w+-\w+\/lib\/sharp-\w+-\w+.node$/ |
There was a problem hiding this comment.
This regex was too brittle before so I changed it to be more explicit which is simply replace the platform and arch so this test will pass on windows/mac/linux/etc but still fail if its missing the files sharp needs to run.
There was a problem hiding this comment.
can you still remove the version from the filename though? i.e. the 0.35.3
| if (contentType === AVIF) { | ||
| transformer.avif({ | ||
| quality: Math.max(quality - 20, 1), | ||
| quality: Math.max(quality - 30, 1), |
There was a problem hiding this comment.
I checked what sharp recommends and they have a default quality of 80 for webp and 50 for avif so a difference of 30 is expected here.
It'd be good to add a comment here with a link to the docs.
Also, unclear if just subtracting 30 is better, or if multiplying by 50/80 is better. The second option would probably scale better to really low quality settings?
Looking around I found this:
https://www.industrialempathy.com/posts/avif-webp-quality-settings/#quality-settings-for-a-range-of-jpeg-qualities
https://docs.google.com/spreadsheets/d/1E29kPLR5_0PThsw6SVbco7HvMU0aynBLfVN0RfIXgPk/edit?gid=1245219304#gid=1245219304
That implies something closer to a coefficient than a constant offset.
|
Changing to draft per @eps1lon so we can merge another PR first and avoid merge conflicts |
07cb155 to
e754027
Compare
## Notable changes - No more install script needed - No more dynamic require/import tracing workaround - AVIF uses [tune iq](https://aomedia.org/blog%20posts/Libavif_v1_4_0-Boasts-Major-Updates-to-Encoder-Technology/#the-tune-iq-image-quality-tuning-mode) to better match human perception ## All changes - https://github.com/lovell/sharp/releases/tag/v0.35.0 - https://github.com/lovell/sharp/releases/tag/v0.35.1 - https://github.com/lovell/sharp/releases/tag/v0.35.2 - https://github.com/lovell/sharp/releases/tag/v0.35.3 --------- Co-authored-by: Sebastian Sebbie Silbermann <[email protected]>
Notable changes
All changes