mirror of
https://github.com/withastro/astro.git
synced 2025-03-10 23:01:26 -05:00
[ci] format
This commit is contained in:
parent
3ce4ad965f
commit
61ba33283b
2 changed files with 6 additions and 4 deletions
|
@ -22,11 +22,13 @@ export function isRemoteImage(src: ImageMetadata | string): src is string {
|
|||
|
||||
/**
|
||||
* Resolves the source of an image transformation by handling asynchronous or synchronous inputs.
|
||||
*
|
||||
* @param {UnresolvedImageTransform['src']} src - The source of the image transformation.
|
||||
*
|
||||
* @param {UnresolvedImageTransform['src']} src - The source of the image transformation.
|
||||
* @return {Promise<string | ImageMetadata>} A promise that resolves to the image source. It returns either the default export of the resolved source or the resolved source itself if the default export doesn't exist.
|
||||
*/
|
||||
export async function resolveSrc(src: UnresolvedImageTransform['src']): Promise<string | ImageMetadata> {
|
||||
export async function resolveSrc(
|
||||
src: UnresolvedImageTransform['src'],
|
||||
): Promise<string | ImageMetadata> {
|
||||
if (typeof src === 'object' && 'then' in src) {
|
||||
const resource = await src;
|
||||
return resource.default ?? resource;
|
||||
|
|
|
@ -3,7 +3,7 @@ import type { ImageInputFormat, ImageMetadata } from '../types.js';
|
|||
/**
|
||||
* Extracts the original image query parameters (width, height, format) from the given `URLSearchParams` object
|
||||
* and returns them as an object. If any of the required parameters are missing or invalid, the function returns undefined.
|
||||
*
|
||||
*
|
||||
* The `width` and `height` are parsed to integer values.
|
||||
*
|
||||
* @param {URLSearchParams} params - The `URLSearchParams` object containing the query parameters.
|
||||
|
|
Loading…
Add table
Reference in a new issue