-
Notifications
You must be signed in to change notification settings - Fork 5.3k
chore: Remove imagemin
#36563
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
chore: Remove imagemin
#36563
Conversation
@metamaskbot update-policies |
Review the following changes in direct dependencies. Learn more about Socket for GitHub.
|
Policies updated. 🧠 Learn how: https://lavamoat.github.io/guides/policy-diff/#what-to-look-for-when-reviewing-a-policy-diff |
✨ Files requiring CODEOWNER review ✨🧩 @MetaMask/extension-devs (5 files, +5 -5)
📜 @MetaMask/policy-reviewers (5 files, +5 -5)
Tip Follow the policy review process outlined in the LavaMoat Policy Review Process doc before expecting an approval from Policy Reviewers. 🔗 @MetaMask/supply-chain (5 files, +5 -5)
|
📊 Page Load Benchmark ResultsCurrent Commit: 📄 Localhost MetaMask Test DappSamples: 100 Summary
📈 Detailed Results
Results generated automatically by MetaMask CI |
Builds ready [c6a9ae5]
UI Startup Metrics (1233 ± 78 ms)
Bundle size diffs [🚀 Bundle size reduced!]
|
}); | ||
} else { | ||
optimizedBuffer = await sharp(filePath, { | ||
const optimizedBuffer = await sharp(filePath, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bug: Image Optimization Issues with Sharp
The code now uses sharp
for all image optimizations, including GIFs, but applies toFormat()
options like compressionLevel
, effort
, quality
, and lossless
universally. These options are not valid for all formats, particularly GIFs, which can cause runtime errors, suboptimal compression, or loss of animation quality.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to have worked for optimizing spinner.gif
🤷♂️
<!-- Please submit this PR as a draft initially. Do not mark it as "Ready for review" until the template has been completely filled out, and PR status checks have passed at least once. --> ## **Description** Seemingly `sharp` is as efficient at optimizing GIFs as `imagemin` and doesn't have the same install-script problems on some systems that `gifsicle` brings. This PR proposes to use `sharp` for optimizing all images. Needs a sanity check. [](https://codespaces.new/MetaMask/metamask-extension/pull/36563?quickstart=1) <!-- CURSOR_SUMMARY --> --- > [!NOTE] > Replace `imagemin`/`gifsicle` with `sharp` for image optimization and remove related dependencies, updating configs and LavaMoat policies accordingly. > > - **Development tooling**: > - `development/optimize-media.mts`: Use `sharp` exclusively for all image formats; remove `imagemin`/`imagemin-gifsicle` logic and imports. > - **Dependencies**: > - Remove `imagemin`, `imagemin-gifsicle`, and their `@types` from `package.json`; prune related entries from `yarn.lock`. > - Update `.depcheckrc.yml` to drop `imagemin*` from ignored deps. > - **Security/Policies**: > - Update LavaMoat policies (`lavamoat/browserify/*/policy.json`, `lavamoat/build-system/policy.json`) to adjust package mappings (e.g., `is-plain-obj` path) and remove allowlist for `imagemin-gifsicle>gifsicle`. > > <sup>Written by [Cursor Bugbot](https://cursor.com/dashboard?tab=bugbot) for commit c6a9ae5. This will update automatically on new commits. Configure [here](https://cursor.com/dashboard?tab=bugbot).</sup> <!-- /CURSOR_SUMMARY --> --------- Co-authored-by: MetaMask Bot <[email protected]>
Description
Seemingly
sharp
is as efficient at optimizing GIFs asimagemin
and doesn't have the same install-script problems on some systems thatgifsicle
brings. This PR proposes to usesharp
for optimizing all images.Needs a sanity check.
Note
Replace
imagemin
/gifsicle
withsharp
for image optimization and remove related dependencies, updating configs and LavaMoat policies accordingly.development/optimize-media.mts
: Usesharp
exclusively for all image formats; removeimagemin
/imagemin-gifsicle
logic and imports.imagemin
,imagemin-gifsicle
, and their@types
frompackage.json
; prune related entries fromyarn.lock
..depcheckrc.yml
to dropimagemin*
from ignored deps.lavamoat/browserify/*/policy.json
,lavamoat/build-system/policy.json
) to adjust package mappings (e.g.,is-plain-obj
path) and remove allowlist forimagemin-gifsicle>gifsicle
.Written by Cursor Bugbot for commit c6a9ae5. This will update automatically on new commits. Configure here.