mirror of
https://github.com/withastro/astro.git
synced 2025-03-31 23:31:30 -05:00
[ci] format
This commit is contained in:
parent
9a08d74bc0
commit
080156fc65
3 changed files with 8 additions and 7 deletions
|
@ -3,11 +3,11 @@ import { AstroError, AstroErrorData } from '../core/errors/index.js';
|
|||
import { DEFAULT_HASH_PROPS } from './consts.js';
|
||||
import { type ImageService, isLocalService } from './services/service.js';
|
||||
import {
|
||||
isImageMetadata,
|
||||
type GetImageResult,
|
||||
type ImageTransform,
|
||||
type SrcSetValue,
|
||||
type UnresolvedImageTransform,
|
||||
isImageMetadata,
|
||||
} from './types.js';
|
||||
import { isESMImportedImage, isRemoteImage, resolveSrc } from './utils/imageKind.js';
|
||||
import { probe } from './utils/remoteProbe.js';
|
||||
|
@ -51,8 +51,8 @@ export async function getImage(
|
|||
),
|
||||
});
|
||||
}
|
||||
|
||||
if(isImageMetadata(options)) {
|
||||
|
||||
if (isImageMetadata(options)) {
|
||||
throw new AstroError(AstroErrorData.ExpectedNotESMImage);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
import type { PluginContext } from 'rollup';
|
||||
import { z } from 'zod';
|
||||
import type { ImageMetadata, OmitBrand } from '../assets/types.js';
|
||||
import { emitESMImage } from '../assets/utils/emitAsset.js';
|
||||
import type { OmitBrand, ImageMetadata } from '../assets/types.js';
|
||||
|
||||
export function createImage(
|
||||
pluginContext: PluginContext,
|
||||
|
|
|
@ -668,7 +668,7 @@ export const ExpectedImageOptions = {
|
|||
* - [Images](https://docs.astro.build/en/guides/images/)
|
||||
* @description
|
||||
* An ESM-imported image cannot be passed directly to `getImage()`. Instead, pass an object with the image in the `src` property.
|
||||
*
|
||||
*
|
||||
* ```diff
|
||||
* import { getImage } from "astro:assets";
|
||||
* import myImage from "../assets/my_image.png";
|
||||
|
@ -680,8 +680,9 @@ export const ExpectedImageOptions = {
|
|||
export const ExpectedNotESMImage = {
|
||||
name: 'ExpectedNotESMImage',
|
||||
title: 'Expected image options, not an ESM-imported image.',
|
||||
message: 'An ESM-imported image cannot be passed directly to `getImage()`. Instead, pass an object with the image in the `src` property.',
|
||||
hint: 'Try changing `getImage(myImage)` to `getImage({ src: myImage })`'
|
||||
message:
|
||||
'An ESM-imported image cannot be passed directly to `getImage()`. Instead, pass an object with the image in the `src` property.',
|
||||
hint: 'Try changing `getImage(myImage)` to `getImage({ src: myImage })`',
|
||||
} satisfies ErrorData;
|
||||
|
||||
/**
|
||||
|
|
Loading…
Add table
Reference in a new issue