image icon indicating copy to clipboard operation
image copied to clipboard

feat: add support for image helpers in nitro endpoints

Open Afshar07 opened this issue 1 year ago โ€ข 1 comments

Implement image helper utilities usage in nitro endpoints, by adding image options and nitro compatible utils in server directory. But to be honest, it's my first contribution and i might (probably am) mess with a wrong config, so, it will be so kind for anyone to point out if i have done anything wrong!

๐Ÿ”— Linked issue

resolves #1447

โ“ Type of change

  • [ ] ๐Ÿ“– Documentation (updates to the documentation or readme)
  • [ ] ๐Ÿž Bug fix (a non-breaking change that fixes an issue)
  • [x] ๐Ÿ‘Œ Enhancement (improving an existing functionality)
  • [ ] โœจ 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

Add an utility on server folder and auto import it into nitro, and also write image options into a virtual path in nitro. Set a boolean to check if the utility is used in nitro environment, if it is, ignore prerendering static images.

Afshar07 avatar Sep 05 '24 16:09 Afshar07

Codecov Report

Attention: Patch coverage is 53.48837% with 20 lines in your changes missing coverage. Please review.

Project coverage is 62.93%. Comparing base (a12c220) to head (2b938b4). Report is 67 commits behind head on main.

Files with missing lines Patch % Lines
src/runtime/server/utils/image.ts 7.14% 13 Missing :warning:
src/module.ts 90.00% 1 Missing and 1 partial :warning:
src/runtime/utils/prerender.ts 33.33% 2 Missing :warning:
src/runtime/components/NuxtImg.vue 0.00% 1 Missing :warning:
src/runtime/components/NuxtPicture.vue 0.00% 1 Missing :warning:
src/runtime/image.ts 50.00% 1 Missing :warning:
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1473      +/-   ##
==========================================
- Coverage   63.01%   62.93%   -0.08%     
==========================================
  Files          80       81       +1     
  Lines        3742     3772      +30     
  Branches      426      429       +3     
==========================================
+ Hits         2358     2374      +16     
- Misses       1356     1369      +13     
- Partials       28       29       +1     

: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 Sep 10 '24 13:09 codecov-commenter

Open in StackBlitz

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

commit: 2b938b4

pkg-pr-new[bot] avatar Apr 04 '25 10:04 pkg-pr-new[bot]