-
Notifications
You must be signed in to change notification settings - Fork 270
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
feat: add support for image helpers in nitro endpoints #1473
base: main
Are you sure you want to change the base?
feat: add support for image helpers in nitro endpoints #1473
Conversation
// Prerender static images | ||
if (import.meta.server && import.meta.prerender) { | ||
if (import.meta.server && import.meta.prerender && !isCalledInNitro) { |
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.
why do we not want to hint to prerender static images if called from a server endpoint?
maybe instead we use getEvent
and prerender them if it's available?
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.
Thanks for the hint, i have tried the generate command and i see that beside this, i have a lot of unhandled situations!
But my main problem is i do not have access to image-options virtual file in nitro when generating, i need to handle that.
I investigate the source code more precisely, review my code and come back with a solution ASAP.
Is there anything specific i need to know? like about writing tests or anything else?
Thanks for your time.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1473 +/- ##
==========================================
- Coverage 63.37% 63.22% -0.16%
==========================================
Files 79 80 +1
Lines 3607 3630 +23
Branches 407 411 +4
==========================================
+ Hits 2286 2295 +9
- Misses 1292 1304 +12
- Partials 29 31 +2 ☔ View full report in Codecov by Sentry. |
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
📚 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.