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>
495 B
495 B
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:
import { defineCollection, z } from "astro:content";
defineCollection({
schema: ({ image }) =>
z.object({
image: image().refine((img) => img.width >= 200, {
message: "image too small",
}),
}),
});