Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions src/providers/imgix.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ import {
toUrl,
} from "../utils.ts";

type Auto = "true" | "format" | "compress" | "enhance" | "redeye";
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should allow boolean true here too. I won't block on that, because it should also have runtime handling, but it would be a good thing to have as a follow-up.

Copy link
Contributor Author

@GeKorm GeKorm Nov 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's how I did it initially, but in the end I felt it could be confusing.

0 <Image />
1 <Image auto />
2 <Image auto="compress" />
3 <Image auto="true,compress" />
4 <Image auto="format" />

Without digging into how it works I expected that (1) would be implied in (2) as a truthy value, but it needs to be explicit like in (3). What's more, if omitted (0) it kinda breaks the convention with booleans being falsy by default, when in reality the default is (4) auto="format".

Despite all this, I don't have a particularly strong opinion about it. It should be fine, as long as it's documented with @default and a short explanation. I'd like to open a follow-up Imgix PR with some improvements and more operations, so I'll include it there.

Edit: Thanks for responding so quickly by the way!


export type ImixFormats =
| ImageFormat
| "gif"
Expand Down Expand Up @@ -76,10 +78,15 @@ export interface ImgixOperations extends Operations<ImixFormats> {

/**
* Automatic optimizations to apply.
* Can be a combination of "format", "compress", "enhance", "redeye".
* Can be a combination of "format", "compress", "enhance", "redeye", "true".
* @example "format,compress"
*/
auto?: "format" | "compress" | "enhance" | "redeye";
auto?:
| Auto
| `${Auto},${Auto}`
| `${Auto},${Auto},${Auto}`
| `${Auto},${Auto},${Auto},${Auto}`
| `${Auto},${Auto},${Auto},${Auto},${Auto}`;

/**
* Contrast adjustment (-100 to 100).
Expand Down
Loading