image icon indicating copy to clipboard operation
image copied to clipboard

feat: Add support for custom provider modifiers in ImageModifiers int…

Open nathanchase opened this issue 6 months ago • 3 comments

🔗 Linked issue

(https://github.com/nuxt/image/issues/1843)

❓ Type of change

  • [ ] 📖 Documentation (updates to the documentation or readme)
  • [ ] 🐞 Bug fix (a non-breaking change that fixes an issue)
  • [ ] 👌 Enhancement (improving an existing functionality)
  • [x] ✨ New feature (a non-breaking change that adds functionality)
  • [ ] 🧹 Chore (updates to the build process or auxiliary tools and libraries)
  • [ ] ⚠️ Breaking change (fix or feature that would cause existing functionality to change)

📚 Description

This modifies the ImageModifiers interface to support custom provider modifiers by adding an index signature.

nathanchase avatar May 16 '25 01:05 nathanchase

Open in StackBlitz

npm i https://pkg.pr.new/@nuxt/image@1844

commit: ca0a20f

pkg-pr-new[bot] avatar May 16 '25 01:05 pkg-pr-new[bot]

I think instead of this (which removes type safety for modifiers) we should amend useImage to respect the generic provider type.

danielroe avatar May 16 '25 08:05 danielroe

Ok, I've updated the PR to preserve type-safety based on the selected provider. Please review and let me know what you think! Thanks, @danielroe!

nathanchase avatar May 16 '25 15:05 nathanchase

Codecov Report

:x: Patch coverage is 0% with 2 lines in your changes missing coverage. Please review. :white_check_mark: Project coverage is 7.02%. Comparing base (7c0555d) to head (ca0a20f).

Files with missing lines Patch % Lines
src/module.ts 0.00% 2 Missing :warning:
Additional details and impacted files
@@           Coverage Diff            @@
##            main   #1844      +/-   ##
========================================
- Coverage   7.02%   7.02%   -0.01%     
========================================
  Files         77      77              
  Lines       3573    3575       +2     
  Branches     138     138              
========================================
  Hits         251     251              
- Misses      3274    3276       +2     
  Partials      48      48              

: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-commenter avatar Nov 03 '25 10:11 codecov-commenter