mirror of
https://github.com/withastro/astro.git
synced 2024-12-30 22:03:56 -05:00
a1108e0371
* feat(images): Move image() to schema so we can do relative images easily instead of clumsily * chore: changeset * fix: apply feedback * test: add more tests * fix: properly infer type if a function is used * feat(iamge): Add errors when using the old methods * chore: update to minor * feat(image): Move function shape to be experimental.asets only * Update packages/astro/src/content/template/virtual-mod.mjs Co-authored-by: Ben Holmes <hey@bholmes.dev> --------- Co-authored-by: Ben Holmes <hey@bholmes.dev>
22 lines
495 B
Markdown
22 lines
495 B
Markdown
---
|
|
'astro': minor
|
|
---
|
|
|
|
Move `image()` to come from `schema` instead to fix it not working with refine and inside complex types
|
|
|
|
**Migration**:
|
|
|
|
Remove the `image` import from `astro:content`, and instead use a function to generate your schema, like such:
|
|
|
|
```ts
|
|
import { defineCollection, z } from "astro:content";
|
|
|
|
defineCollection({
|
|
schema: ({ image }) =>
|
|
z.object({
|
|
image: image().refine((img) => img.width >= 200, {
|
|
message: "image too small",
|
|
}),
|
|
}),
|
|
});
|
|
```
|