-
Couldn't load subscription status.
- Fork 303
feat!: typed providers + modifiers #1802
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
Conversation
commit: |
Deploying nuxt-image with Β
|
| Latest commit: |
bc1e148
|
| Status: | Β β Β Deploy successful! |
| Preview URL: | https://db0666bd.nuxt-image.pages.dev |
| Branch Preview URL: | https://feat-typed-providers.nuxt-image.pages.dev |
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #1802 +/- ##
==========================================
+ Coverage 63.09% 63.12% +0.03%
==========================================
Files 79 77 -2
Lines 3785 3824 +39
Branches 434 442 +8
==========================================
+ Hits 2388 2414 +26
- Misses 1371 1384 +13
Partials 26 26 β View full report in Codecov by Sentry. π New features to boost your workflow:
|
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.
Really good changes IMO, I like the defineProvider util!
I let you fix conflicts with pnpm lock before merging of course π
π Linked issue
β Type of change
π Description
This adds strong typing for image providers + modifiers throughout, including in the image module options. (For example, a provider that requires you set a baseURL will enforce that in the nuxt config.
This is a breaking change because image providers are now no longer using named exports but a single default export wrapped in a
defineProviderfunction (which can also have an optional setup function).I've also done quite a lot of cleaning up of types elsewhere, and dropped image props that we weren't using - they should be fine to be attributes inherited by the
<img>element.The next steps will need to be actually getting and setting the types for provider modifiers. (As an interim fix we can support key signatures
[key: string]: string | numberthat would allow the same permissive approach that's working at the moment.)Because types live in the individual provider files, it should be easy for users to add their own types for custom providers - and also to keep the types in sync for future providers + updates to existing ones.