fix(image-service-reference): add API reference blocks + fix snippets#12230
Conversation
✅ Deploy Preview for astro-docs-2 ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
sarah11918
left a comment
There was a problem hiding this comment.
Thank you for this very detailed PR @ArmandPhilippot and sorry it took me a while to get around to it! I only spotted one thing, but otherwise just looking at syntax (and trusting you to have done all the research 😅 ) , what I am in a position to review LGTM!
Is there someone else you think we should ping to pull in here for a more technical review of this?
|
No worries, anyone could have reviewed this one I think! I mean there is no new content, I only:
So, thank you for taking the time for this one! 🙌🏽 I don't see anyone in particular we should ping to look into this. Maybe JSPark if he has the time, since he's both technical and sufficiently thorough to spot any mistake/oversight? |
Co-authored-by: Sarah Rainsberger <[email protected]>
|
OK @ArmandPhilippot I leave this completely to you! If you're happy with my having proofread it, and it LGTM, you are welcome to merge it as NWTWWHB! (I'm sure jspark will alert us of any errors when translating, and we can fix them then! 😂 ) So go ahead whenever you feel comfortable! 💜 |
Description (required)
Type/Sinceblock to follow the API references format.import type))You can check the details per heading below. I'm using an expandable content here because the list to track all the changes is quite long. 😅
Show details
options.widthcan be undefinedAstroConfig["image"]as type parameter to avoid overridingimageConfigtype in each hookparamsvariable inparseURL(see https://github.com/withastro/astro/blob/24b04c159ff2e5e1b15efcf8f3a77a131b5a9f92/packages/astro/src/assets/services/service.ts#L374)transformmethodasyncbecause this is always asynchronous (and Typescript complains without it)bufferto prevent conflictsawaitbeforemySuperLibraryThatEncodesImagesto justify the asynchronousity and because I think most of the time this would be an async call.<Since />for each hook. Most were added in 2.1.0 (see Implement RFC "A core story for images" astro#6344 and the related docs PR Add assets page #2779) andvalidateOptionswas added in2.1.4(see Add validateOptions hook to Image Service API astro#6555)getURL():ImageTransformtype (noaltbutfitandposition, see https://github.com/withastro/astro/blob/24b04c159ff2e5e1b15efcf8f3a77a131b5a9f92/packages/astro/src/assets/types.ts#L82-L93)parseUrl():getSrcSet():UnresolvedSrcSetValuenotSrcSetValue, see https://github.com/withastro/astro/blob/24b04c159ff2e5e1b15efcf8f3a77a131b5a9f92/packages/astro/src/assets/services/service.ts#L53-L56)SrcSetValuewithUnresolvedSrcSetValuein the code snippet, they are not exactly the same type (see https://github.com/withastro/astro/blob/24b04c159ff2e5e1b15efcf8f3a77a131b5a9f92/packages/astro/src/assets/types.ts#L57-L65)transform():OutputFormatshould beImageOutputFormat, see https://github.com/withastro/astro/blob/24b04c159ff2e5e1b15efcf8f3a77a131b5a9f92/packages/astro/src/assets/services/service.ts#L104-L108)validateOptions():emitImageMetadata) inastro/assets/utilssrcproperty ingenerateTransformHash()example=>instead of:to represent the return type... so let's stay consistent?)Related issues & labels (optional)
code snippet update,consistency/formatting