summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar Oliver Speir <Princesseuh@users.noreply.github.com> 2024-02-15 09:25:15 +0000
committerGravatar astrobot-houston <fred+astrobot@astro.build> 2024-02-15 09:25:15 +0000
commitb386d2d7ae5884d3fce5eee186ee28033f7c0cfe (patch)
treed049164dffebcb53f3afdbb5b276eaa5adb8771d
parent91f75afbc642b6e73dd4ec18a1fe2c3128c68132 (diff)
downloadastro-b386d2d7ae5884d3fce5eee186ee28033f7c0cfe.tar.gz
astro-b386d2d7ae5884d3fce5eee186ee28033f7c0cfe.tar.zst
astro-b386d2d7ae5884d3fce5eee186ee28033f7c0cfe.zip
[ci] format
-rw-r--r--packages/astro/components/Image.astro6
-rw-r--r--packages/astro/components/Picture.astro6
-rw-r--r--packages/astro/src/assets/internal.ts2
-rw-r--r--packages/astro/src/assets/utils/metadata.ts5
-rw-r--r--packages/astro/src/assets/utils/remoteProbe.ts23
-rw-r--r--packages/astro/src/core/errors/errors-data.ts3
6 files changed, 17 insertions, 28 deletions
diff --git a/packages/astro/components/Image.astro b/packages/astro/components/Image.astro
index 4b496daa6..aee198a60 100644
--- a/packages/astro/components/Image.astro
+++ b/packages/astro/components/Image.astro
@@ -1,9 +1,5 @@
---
-import {
- getImage,
- type LocalImageProps,
- type RemoteImageProps,
-} from 'astro:assets';
+import { getImage, type LocalImageProps, type RemoteImageProps } from 'astro:assets';
import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
import type { HTMLAttributes } from '../types';
diff --git a/packages/astro/components/Picture.astro b/packages/astro/components/Picture.astro
index 2ddee3125..b37b2d545 100644
--- a/packages/astro/components/Picture.astro
+++ b/packages/astro/components/Picture.astro
@@ -1,9 +1,5 @@
---
-import {
- getImage,
- type LocalImageProps,
- type RemoteImageProps,
-} from 'astro:assets';
+import { getImage, type LocalImageProps, type RemoteImageProps } from 'astro:assets';
import type { GetImageResult, ImageOutputFormat } from '../dist/@types/astro';
import { isESMImportedImage } from '../dist/assets/utils/imageKind';
import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
diff --git a/packages/astro/src/assets/internal.ts b/packages/astro/src/assets/internal.ts
index cf758f8f1..1c55c84d5 100644
--- a/packages/astro/src/assets/internal.ts
+++ b/packages/astro/src/assets/internal.ts
@@ -9,7 +9,7 @@ import type {
UnresolvedImageTransform,
} from './types.js';
import { isESMImportedImage, isRemoteImage } from './utils/imageKind.js';
-import { probe } from "./utils/remoteProbe.js"
+import { probe } from './utils/remoteProbe.js';
export async function getConfiguredImageService(): Promise<ImageService> {
if (!globalThis?.astroAsset?.imageService) {
diff --git a/packages/astro/src/assets/utils/metadata.ts b/packages/astro/src/assets/utils/metadata.ts
index adc75bfb3..bf8dfb9b3 100644
--- a/packages/astro/src/assets/utils/metadata.ts
+++ b/packages/astro/src/assets/utils/metadata.ts
@@ -1,5 +1,4 @@
-
-import { lookup as probe } from '../utils/vendor/image-size/lookup.js'
+import { lookup as probe } from '../utils/vendor/image-size/lookup.js';
import { AstroError, AstroErrorData } from '../../core/errors/index.js';
import type { ImageInputFormat, ImageMetadata } from '../types.js';
@@ -9,7 +8,7 @@ export async function imageMetadata(
): Promise<Omit<ImageMetadata, 'src' | 'fsPath'>> {
const result = probe(data);
- if (!result.height || !result.width || !result.type ) {
+ if (!result.height || !result.width || !result.type) {
throw new AstroError({
...AstroErrorData.NoImageMetadata,
message: AstroErrorData.NoImageMetadata.message(src),
diff --git a/packages/astro/src/assets/utils/remoteProbe.ts b/packages/astro/src/assets/utils/remoteProbe.ts
index 0c045d129..1cda4ca45 100644
--- a/packages/astro/src/assets/utils/remoteProbe.ts
+++ b/packages/astro/src/assets/utils/remoteProbe.ts
@@ -1,5 +1,4 @@
-
-import { lookup } from './vendor/image-size/lookup.js'
+import { lookup } from './vendor/image-size/lookup.js';
import type { ISize } from './vendor/image-size/types/interface.ts';
export async function probe(url: string): Promise<ISize> {
@@ -31,16 +30,16 @@ export async function probe(url: string): Promise<ISize> {
accumulatedChunks = tmp;
try {
- // Attempt to determine the size with each new chunk
- const dimensions = lookup(accumulatedChunks);
- if (dimensions) {
- await reader.cancel(); // stop stream as we have size now
- return dimensions;
- }
- } catch (error) {
- // This catch block is specifically for `sizeOf` failures,
- // which might occur if the accumulated data isn't yet sufficient.
- }
+ // Attempt to determine the size with each new chunk
+ const dimensions = lookup(accumulatedChunks);
+ if (dimensions) {
+ await reader.cancel(); // stop stream as we have size now
+ return dimensions;
+ }
+ } catch (error) {
+ // This catch block is specifically for `sizeOf` failures,
+ // which might occur if the accumulated data isn't yet sufficient.
+ }
}
}
diff --git a/packages/astro/src/core/errors/errors-data.ts b/packages/astro/src/core/errors/errors-data.ts
index b7585d421..6df25c748 100644
--- a/packages/astro/src/core/errors/errors-data.ts
+++ b/packages/astro/src/core/errors/errors-data.ts
@@ -543,8 +543,7 @@ export const MissingImageDimension = {
export const FailedToFetchRemoteImageDimensions = {
name: 'FailedToFetchRemoteImageDimensions',
title: 'Failed to retrieve remote image dimensions',
- message: (imageURL: string) =>
- `Failed to get the dimensions for ${imageURL}.`,
+ message: (imageURL: string) => `Failed to get the dimensions for ${imageURL}.`,
hint: 'Verify your remote image URL is accurate, and that you are not using `inferSize` with a file located in your `public/` folder.',
} satisfies ErrorData;
/**