chore: upgrade sharp to 0.35.2#594
Conversation
|
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
|
@lovell I wouldn't expect the special case to be required now that sharp fixed the logic to be statically analyzable here: I think we should figure out the failure mode instead of changing the special case (the special case should just be for old versions of sharp) |
|
The prebuilt sharp packages e.g. For a file to be considered necessary, is it enough to reference that file in the |
|
Typically it needs to be part of a require() or import or readFile() to be statically analyzed and emitted, but there is a bit more nuance. For example this sharedLibEmit() does some magic that might be relevant here: nft/src/utils/sharedlib-emit.ts Line 20 in 7e43ba4 |
|
I had claude try a few different solutions and they were pretty verbose since it tried to parse the One of the solutions was much more simple seen here: However, it feels relatively similar to the special case we already have for sharp here (checking package.json for optionalDependencies), so I'm thinking we might as well merge your PR since its less risk. |
| JSON.stringify({ | ||
| packageManager: 'pnpm@8.14.3', | ||
| dependencies: { sharp: '0.33.2' }, | ||
| dependencies: { sharp: '0.35.1' }, |
There was a problem hiding this comment.
Lets rever this to the old version so we still have coverage for the old version
|
How about a possible alternative where the For example, the logic in try { require('@img/sharp-libvips-linux-x64/empty.node') } catch {}This might be enough for the existing |
|
@lovell Yes that would be great! |
The special case is no longer required for sharp >= 0.35.2 as it can take advantage of the existing sharedLibEmit logic.
1c7aa85 to
6e02aec
Compare
|
I've published a release candidate v0.35.2-rc.2 of sharp with the Marking this PR as draft for now until after v0.35.2 is released and the 2-day new package cool-down has passed. I note the logic in TurboPack is slightly different from the logic in this package as it only has an nft/src/utils/sharedlib-emit.ts Line 16 in 8673d63 |
Extends the sharp "special case" with additional ESM/CJS-specific paths added in v0.35.0.No longer requires the "special case" from 0.35.2 onwards.
The existing path check remains to support older versions
and future-proof for when we switch to ESM-only.