Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
9277fbd
feat: upgrade to Zod v4
matthewp Dec 2, 2025
0318297
Remove Zod v3 support, keep only v4
matthewp Dec 2, 2025
0bb5419
Finish upgrade
matthewp Dec 3, 2025
c78a21e
Merge branch 'next' into zod4-m
matthewp Dec 3, 2025
9fdfe72
skip these tests for now
matthewp Dec 3, 2025
be4e226
skip this one too
matthewp Dec 3, 2025
11766e1
correct mark the received item
matthewp Dec 3, 2025
beb8c67
fix config-validate tests
matthewp Dec 4, 2025
45b6c46
Merge branch 'next' into zod4-m
matthewp Dec 4, 2025
085e663
merge: resolve conflicts between zod4-m and next
matthewp Dec 4, 2025
19a3c1b
fix remaining build error
matthewp Dec 4, 2025
94f42c1
remove references to zod4 thing
matthewp Dec 4, 2025
86b54be
fixes
matthewp Dec 4, 2025
59e5cdf
prevent the crash
matthewp Dec 4, 2025
bb8f885
switch to the native zod to json schema
matthewp Dec 4, 2025
1ae84f2
oops
matthewp Dec 4, 2025
8084da5
fix content layer tests
matthewp Dec 4, 2025
62edc31
fix error map tests
matthewp Dec 4, 2025
ef994e5
fix actions test
matthewp Dec 5, 2025
4f005eb
fix intellisense tsts
matthewp Dec 5, 2025
2ddd549
fix schema test
matthewp Dec 5, 2025
215afa0
fix: types
florian-lefebvre Dec 5, 2025
3a61f4e
Update Svelte to exactly 5.43.8 in package and fixtures
matthewp Dec 5, 2025
713cb7e
fix svelte tests
matthewp Dec 5, 2025
8c429bc
fix more e2e
matthewp Dec 5, 2025
725859f
fix cloudflare tests
matthewp Dec 5, 2025
bfe74e8
fix defineMiddleware issue
matthewp Dec 5, 2025
530e2e0
remove unused reference
matthewp Dec 5, 2025
c51a23a
fix examples types
matthewp Dec 5, 2025
dcb3bdc
pr comment stuff
matthewp Dec 5, 2025
af68956
changeset
matthewp Dec 5, 2025
fcdf90d
remove experiemental flag
matthewp Dec 5, 2025
afd6528
add some debugging here
matthewp Dec 5, 2025
0f181c3
remove debugging stuff
matthewp Dec 5, 2025
7db7f57
Update packages/astro/src/actions/vite-plugin-actions.ts
matthewp Dec 8, 2025
b4a5b6b
fix
matthewp Dec 8, 2025
5301b0b
fix: import
florian-lefebvre Dec 8, 2025
a2e44cf
use zod/v4 imports in core
matthewp Dec 8, 2025
8c22939
Merge branch 'zod4-m' of github.com:withastro/astro into zod4-m
matthewp Dec 8, 2025
fe6659d
remove createDefineAction
matthewp Dec 8, 2025
9fe4f6b
remove unnecessary type alias
matthewp Dec 8, 2025
50ed91d
remove unused z4reference
matthewp Dec 8, 2025
73fa08d
rename stuff
matthewp Dec 8, 2025
4e90dae
unskip tests
matthewp Dec 8, 2025
2f4823f
rename back to createImage
matthewp Dec 8, 2025
a0099f4
nit
matthewp Dec 8, 2025
3e85a19
revert markdown change
matthewp Dec 8, 2025
f9caab6
put errorMap name back
matthewp Dec 8, 2025
c951ce2
address feedback on rss
matthewp Dec 8, 2025
58b6fc8
Merge branch 'next' into zod4-m
florian-lefebvre Dec 8, 2025
eb52371
fix: exports
florian-lefebvre Dec 8, 2025
7f760fa
Update packages/astro-rss/src/index.ts
matthewp Dec 8, 2025
dd9eadb
Update packages/astro-rss/src/schema.ts
matthewp Dec 8, 2025
8c18e1e
Update packages/astro-rss/src/util.ts
matthewp Dec 8, 2025
12485ed
Update packages/astro/src/assets/fonts/config.ts
matthewp Dec 8, 2025
1e084d2
Update packages/astro/src/assets/fonts/types.ts
matthewp Dec 8, 2025
bd8aecf
Update packages/astro/src/content/loaders/types.ts
matthewp Dec 8, 2025
fc02d97
Update packages/astro/src/content/config.ts
matthewp Dec 8, 2025
2d8ea90
Update packages/astro/src/core/config/schemas/relative.ts
matthewp Dec 8, 2025
16843f6
Update packages/astro/test/units/config/config-validate.test.js
matthewp Dec 8, 2025
c618507
Update packages/astro/test/units/actions/form-data-to-object.test.js
matthewp Dec 8, 2025
0422b86
Update packages/astro/src/core/config/schemas/refined.ts
matthewp Dec 8, 2025
d8ede75
Update packages/astro/src/content/content-layer.ts
matthewp Dec 8, 2025
e34b316
Update packages/astro/src/content/types-generator.ts
matthewp Dec 8, 2025
a70b1fc
Update packages/astro/src/content/utils.ts
matthewp Dec 8, 2025
7edf39c
Use $ZodError
matthewp Dec 8, 2025
df3795b
Update packages/astro/src/core/csp/config.ts
matthewp Dec 8, 2025
89692d3
fix the build
matthewp Dec 8, 2025
219d2cb
Merge branch 'zod4-m' of github.com:withastro/astro into zod4-m
matthewp Dec 8, 2025
1f422e3
fix e2e test
matthewp Dec 8, 2025
c64836d
replace z4 with z
matthewp Dec 8, 2025
be58ac5
increase vercel test timeout
matthewp Dec 8, 2025
3570d2a
pr comments
matthewp Dec 9, 2025
c346cb4
export ImageFunction
matthewp Dec 9, 2025
11b3dc1
use prefault
matthewp Dec 9, 2025
f6bfd6c
Validate experimental features special
matthewp Dec 9, 2025
d10cb61
bring back old locales
matthewp Dec 9, 2025
31c612a
fix test
matthewp Dec 9, 2025
50919d4
db needs to be a patch too
matthewp Dec 9, 2025
f149f99
fix chainability of image
matthewp Dec 9, 2025
528f6f1
Merge branch 'next' into zod4-m
matthewp Dec 9, 2025
f55cfcb
update zod imports
florian-lefebvre Dec 10, 2025
2a4b1da
Discard changes to packages/integrations/svelte/package.json
florian-lefebvre Dec 10, 2025
dfac302
Discard changes to packages/integrations/svelte/test/fixtures/async-r…
florian-lefebvre Dec 10, 2025
9d03430
refresh lockfile
florian-lefebvre Dec 10, 2025
c35609b
chore: changeset
florian-lefebvre Dec 10, 2025
82f1de6
fix: reference()
florian-lefebvre Dec 10, 2025
787325d
skip broken svelte test
matthewp Dec 10, 2025
1e3ac98
Update .changeset/dance-ornate-keen.md
matthewp Dec 11, 2025
4de6372
Merge branch 'next' into zod4-m
florian-lefebvre Dec 11, 2025
357480d
Merge branch 'next' into zod4-m
florian-lefebvre Dec 11, 2025
64f1796
fix config vlaidate test
matthewp Dec 11, 2025
93acc31
Merge branch 'next' into zod4-m
matthewp Dec 12, 2025
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
7 changes: 7 additions & 0 deletions .changeset/busy-humans-smoke.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
'@astrojs/sitemap': patch
'@astrojs/rss': patch
'@astrojs/db': patch
---

Updates usage of zod to own dependency rather than relying on `astro/zod`
5 changes: 5 additions & 0 deletions .changeset/dance-ornate-keen.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': major
---

Astro v6.0 upgrades to Zod v4 for schema validation - ([v6 upgrade guidance](https://v6.docs.astro.build/en/guides/upgrade-to/v6/#zod-4))
4 changes: 2 additions & 2 deletions examples/blog/src/content.config.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { defineCollection } from 'astro:content';
import { glob } from 'astro/loaders';
import { z } from 'astro/zod';
import { z } from 'astro/zod'

const blog = defineCollection({
// Load Markdown and MDX files in the `src/content/blog/` directory.
Expand All @@ -13,7 +13,7 @@ const blog = defineCollection({
// Transform string to Date object
pubDate: z.coerce.date(),
updatedDate: z.coerce.date().optional(),
heroImage: image().optional(),
heroImage: z.optional(image()),
}),
});

Expand Down
2 changes: 1 addition & 1 deletion examples/starlog/src/content.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ const releases = defineCollection({
alt: z.string(),
}),
// Transform string to Date object
date: z.date({ coerce: true }),
date: z.coerce.date(),
}),
});

Expand Down
1 change: 1 addition & 0 deletions packages/astro-rss/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@
"@types/xml2js": "^0.4.14",
"astro": "workspace:*",
"astro-scripts": "workspace:*",
"zod": "^3.25.76",
"xml2js": "0.6.2"
},
"dependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-rss/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { z } from 'astro/zod';
import { z } from 'zod/v3';
import { XMLBuilder, XMLParser } from 'fast-xml-parser';
import colors from 'piccolore';
import { rssSchema } from './schema.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-rss/src/schema.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { z } from 'astro/zod';
import { z } from 'zod/v3';

export const rssSchema = z.object({
title: z.string().optional(),
Expand Down
2 changes: 1 addition & 1 deletion packages/astro-rss/src/util.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { z } from 'astro/zod';
import type { z } from 'zod/v3';
import type { RSSOptions } from './index.js';

/** Normalize URL to its canonical form */
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/components/Code.astro
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import type { ThemePresets } from '@astrojs/markdown-remark';
import type { ShikiTransformer, ThemeRegistration, ThemeRegistrationRaw } from 'shiki';
import { bundledLanguages } from 'shiki/langs';
import { getCachedHighlighter } from '../dist/core/shiki.js';
import type { CodeLanguage } from '../dist/types/public';
import type { HTMLAttributes } from '../types';
import type { CodeLanguage } from '../dist/types/public/common.js';
import type { HTMLAttributes } from '../types.js';

interface Props extends Omit<HTMLAttributes<'pre'>, 'lang'> {
/** The code to highlight. Required. */
Expand Down
4 changes: 2 additions & 2 deletions packages/astro/components/Image.astro
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
---
import { getImage, imageConfig, type LocalImageProps, type RemoteImageProps } from 'astro:assets';
import type { UnresolvedImageTransform } from '../dist/assets/types';
import type { UnresolvedImageTransform } from '../dist/assets/types.js';
import { AstroError, AstroErrorData } from '../dist/core/errors/index.js';
import type { HTMLAttributes } from '../types';
import type { HTMLAttributes } from '../types.js';

// The TypeScript diagnostic for JSX props uses the last member of the union to suggest props, so it would be better for
// LocalImageProps to be last. Unfortunately, when we do this the error messages that remote images get are complete nonsense
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/components/Picture.astro
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import type {
ImageOutputFormat,
UnresolvedImageTransform,
} from '../dist/types/public/index.js';
import type { HTMLAttributes } from '../types';
import type { HTMLAttributes } from '../types.js';
export type Props = (LocalImageProps | RemoteImageProps) & {
formats?: ImageOutputFormat[];
Expand Down
2 changes: 1 addition & 1 deletion packages/astro/e2e/actions-blog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ test.describe('Astro Actions - Blog', () => {
const submitButton = form.getByRole('button');
await submitButton.click();

const expectedText = 'Expected string, received null';
const expectedText = 'Invalid input: expected string, received null';

const fields = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine', 'ten'];

Expand Down
7 changes: 4 additions & 3 deletions packages/astro/e2e/fixtures/cloudflare/src/content.config.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
import { defineCollection, z, reference } from 'astro:content';
import { defineCollection, reference } from 'astro:content';
import { file, glob } from 'astro/loaders';
import { loader } from './loaders/post-loader.js';
import { readFile } from 'fs/promises';
import { z } from 'astro/zod';

const blog = defineCollection({
loader: loader({ url: 'https://jsonplaceholder.typicode.com/posts' }),
Expand Down Expand Up @@ -82,8 +83,8 @@ const spacecraft = defineCollection({
description: z.string(),
publishedDate: z.coerce.date(),
tags: z.array(z.string()),
heroImage: image().optional(),
cat: reference('cats').default('siamese'),
heroImage: z.optional(image()),
cat: reference('cats').prefault('siamese'),
something: z
.string()
.optional()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function astroClientClickDirective() {

function astroClientPasswordDirective() {
return {
name: 'astro-client-click',
name: 'astro-client-password',
hooks: {
'astro:config:setup': (opts) => {
opts.addClientDirective({
Expand Down
3 changes: 1 addition & 2 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,7 @@
"xxhash-wasm": "^1.1.0",
"yargs-parser": "^21.1.1",
"yocto-spinner": "^0.2.3",
"zod": "^3.25.76",
"zod-to-json-schema": "^3.25.0"
"zod": "^4.0.0"
},
"optionalDependencies": {
"sharp": "^0.34.0"
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/src/actions/runtime/client.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// It's safe to import this file on both server and client

import { parse as devalueParse } from 'devalue';
import type z from 'zod';
import type * as z from 'zod/v4/core';
import { ACTION_QUERY_PARAMS } from '../consts.js';
import type {
ActionClient,
Expand Down Expand Up @@ -132,10 +132,10 @@ export class ActionInputError<T extends ErrorInferenceObject> extends ActionErro
// Not all properties will serialize from server to client,
// and we don't want to import the full ZodError object into the client.

issues: z.ZodIssue[];
fields: z.ZodError<T>['formErrors']['fieldErrors'];
issues: z.$ZodIssue[];
fields: { [P in keyof T]?: string[] | undefined };

constructor(issues: z.ZodIssue[]) {
constructor(issues: z.$ZodIssue[]) {
super({
message: `Failed to validate: ${JSON.stringify(issues, null, 2)}`,
code: 'BAD_REQUEST',
Expand Down
96 changes: 50 additions & 46 deletions packages/astro/src/actions/runtime/server.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { stringify as devalueStringify } from 'devalue';
import { z } from 'zod';
import * as z from 'zod/v4/core';
import type { Pipeline } from '../../core/base-pipeline.js';
import { shouldAppendForwardSlash } from '../../core/build/util.js';
import { pipelineSymbol, REDIRECT_STATUS_CODES } from '../../core/constants.js';
Expand Down Expand Up @@ -32,9 +32,9 @@ import type {
export function defineAction<
TOutput,
TAccept extends ActionAccept | undefined = undefined,
TInputSchema extends z.ZodType | undefined = TAccept extends 'form'
TInputSchema extends z.$ZodType | undefined = TAccept extends 'form'
? // If `input` is omitted, default to `FormData` for forms and `any` for JSON.
z.ZodType<FormData>
z.$ZodType<FormData>
: undefined,
>({
accept,
Expand Down Expand Up @@ -70,7 +70,7 @@ export function defineAction<
return safeServerHandler as ActionClient<TOutput, TAccept, TInputSchema> & string;
}

function getFormServerHandler<TOutput, TInputSchema extends z.ZodType>(
function getFormServerHandler<TOutput, TInputSchema extends z.$ZodType>(
handler: ActionHandler<TInputSchema, TOutput>,
inputSchema?: TInputSchema,
) {
Expand All @@ -84,20 +84,27 @@ function getFormServerHandler<TOutput, TInputSchema extends z.ZodType>(

if (!inputSchema) return await handler(unparsedInput, context);

const baseSchema = unwrapBaseObjectSchema(inputSchema, unparsedInput);
const parsed = await inputSchema.safeParseAsync(
baseSchema instanceof z.ZodObject
? formDataToObject(unparsedInput, baseSchema)
: unparsedInput,
);
const parsed = await parseFormInput(inputSchema, unparsedInput);

if (!parsed.success) {
throw new ActionInputError(parsed.error.issues);
}
return await handler(parsed.data, context);
};
}

function getJsonServerHandler<TOutput, TInputSchema extends z.ZodType>(
async function parseFormInput(inputSchema: z.$ZodType, unparsedInput: FormData) {
const baseSchema = unwrapBaseZ4ObjectSchema(inputSchema, unparsedInput);
const input =
baseSchema instanceof z.$ZodObject
? formDataToObject(unparsedInput, baseSchema)
: unparsedInput;

const parsed = await z.safeParseAsync(inputSchema, input);
return parsed;
}

function getJsonServerHandler<TOutput, TInputSchema extends z.$ZodType>(
handler: ActionHandler<TInputSchema, TOutput>,
inputSchema?: TInputSchema,
) {
Expand All @@ -110,7 +117,7 @@ function getJsonServerHandler<TOutput, TInputSchema extends z.ZodType>(
}

if (!inputSchema) return await handler(unparsedInput, context);
const parsed = await inputSchema.safeParseAsync(unparsedInput);
const parsed = await z.safeParseAsync(inputSchema, unparsedInput);
if (!parsed.success) {
throw new ActionInputError(parsed.error.issues);
}
Expand Down Expand Up @@ -275,34 +282,38 @@ function isActionAPIContext(ctx: ActionAPIContext): boolean {
}

/** Transform form data to an object based on a Zod schema. */
export function formDataToObject<T extends z.AnyZodObject>(
export function formDataToObject<T extends z.$ZodObject>(
formData: FormData,
schema: T,
): Record<string, unknown> {
const obj: Record<string, unknown> =
schema._def.unknownKeys === 'passthrough' ? Object.fromEntries(formData.entries()) : {};
for (const [key, baseValidator] of Object.entries(schema.shape)) {
const obj: Record<string, unknown> = schema._zod.def.catchall
? Object.fromEntries(formData.entries())
: {};
for (const [key, baseValidator] of Object.entries(schema._zod.def.shape)) {
let validator = baseValidator;

while (
validator instanceof z.ZodOptional ||
validator instanceof z.ZodNullable ||
validator instanceof z.ZodDefault
validator instanceof z.$ZodOptional ||
validator instanceof z.$ZodNullable ||
validator instanceof z.$ZodDefault
) {
// use default value when key is undefined
if (validator instanceof z.ZodDefault && !formData.has(key)) {
obj[key] = validator._def.defaultValue();
if (validator instanceof z.$ZodDefault && !formData.has(key)) {
obj[key] =
validator._zod.def.defaultValue instanceof Function
? validator._zod.def.defaultValue()
: validator._zod.def.defaultValue;
}
validator = validator._def.innerType;
validator = validator._zod.def.innerType;
}

if (!formData.has(key) && key in obj) {
// continue loop if form input is not found and default value is set
continue;
} else if (validator instanceof z.ZodBoolean) {
} else if (validator instanceof z.$ZodBoolean) {
const val = formData.get(key);
obj[key] = val === 'true' ? true : val === 'false' ? false : formData.has(key);
} else if (validator instanceof z.ZodArray) {
} else if (validator instanceof z.$ZodArray) {
obj[key] = handleFormDataGetAll(key, formData, validator);
} else {
obj[key] = handleFormDataGet(key, formData, validator, baseValidator);
Expand All @@ -311,16 +322,12 @@ export function formDataToObject<T extends z.AnyZodObject>(
return obj;
}

function handleFormDataGetAll(
key: string,
formData: FormData,
validator: z.ZodArray<z.ZodUnknown>,
) {
function handleFormDataGetAll(key: string, formData: FormData, validator: z.$ZodArray) {
const entries = Array.from(formData.getAll(key));
const elementValidator = validator._def.type;
if (elementValidator instanceof z.ZodNumber) {
const elementValidator = validator._zod.def.element;
if (elementValidator instanceof z.$ZodNumber) {
return entries.map(Number);
} else if (elementValidator instanceof z.ZodBoolean) {
} else if (elementValidator instanceof z.$ZodBoolean) {
return entries.map(Boolean);
}
return entries;
Expand All @@ -334,26 +341,23 @@ function handleFormDataGet(
) {
const value = formData.get(key);
if (!value) {
return baseValidator instanceof z.ZodOptional ? undefined : null;
return baseValidator instanceof z.$ZodOptional ? undefined : null;
}
return validator instanceof z.ZodNumber ? Number(value) : value;
return validator instanceof z.$ZodNumber ? Number(value) : value;
}

function unwrapBaseObjectSchema(schema: z.ZodType, unparsedInput: FormData) {
while (schema instanceof z.ZodEffects || schema instanceof z.ZodPipeline) {
if (schema instanceof z.ZodEffects) {
schema = schema._def.schema;
}
if (schema instanceof z.ZodPipeline) {
schema = schema._def.in;
}
function unwrapBaseZ4ObjectSchema(schema: z.$ZodType, unparsedInput: FormData) {
if (schema instanceof z.$ZodPipe) {
return unwrapBaseZ4ObjectSchema(schema._zod.def.in, unparsedInput);
}
if (schema instanceof z.ZodDiscriminatedUnion) {
const typeKey = schema._def.discriminator;
if (schema instanceof z.$ZodDiscriminatedUnion) {
const typeKey = schema._zod.def.discriminator;
const typeValue = unparsedInput.get(typeKey);
if (typeof typeValue !== 'string') return schema;

const objSchema = schema._def.optionsMap.get(typeValue);
const objSchema = schema._zod.def.options.find((option) =>
(option as any).def.shape[typeKey].values.has(typeValue),
);
if (!objSchema) return schema;

return objSchema;
Expand All @@ -363,7 +367,7 @@ function unwrapBaseObjectSchema(schema: z.ZodType, unparsedInput: FormData) {

async function callSafely<TOutput>(
handler: () => MaybePromise<TOutput>,
): Promise<SafeResult<z.ZodType, TOutput>> {
): Promise<SafeResult<z.$ZodType, TOutput>> {
try {
const data = await handler();
return { data, error: undefined };
Expand Down
8 changes: 4 additions & 4 deletions packages/astro/src/actions/runtime/types.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
import type z from 'zod';
import type * as z from 'zod/v4/core';
import type { APIContext } from '../../types/public/index.js';
import type { ActionError, codeToStatusMap } from './client.js';

export type ActionErrorCode = keyof typeof codeToStatusMap;

export type ActionAccept = 'form' | 'json';

export type ActionHandler<TInputSchema, TOutput> = TInputSchema extends z.ZodType
export type ActionHandler<TInputSchema, TOutput> = TInputSchema extends z.$ZodType
? (input: z.infer<TInputSchema>, context: ActionAPIContext) => MaybePromise<TOutput>
: (input: any, context: ActionAPIContext) => MaybePromise<TOutput>;

Expand All @@ -28,8 +28,8 @@ export type ActionInputSchema<T extends ActionClient<any, any, any>> = T extends
export type ActionClient<
TOutput,
TAccept extends ActionAccept | undefined,
TInputSchema extends z.ZodType | undefined,
> = TInputSchema extends z.ZodType
TInputSchema extends z.$ZodType | undefined,
> = TInputSchema extends z.$ZodType
? ((
input: TAccept extends 'form' ? FormData : z.input<TInputSchema>,
) => Promise<
Expand Down
6 changes: 5 additions & 1 deletion packages/astro/src/actions/vite-plugin-actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,11 @@ export function vitePluginActionsBuild(
name: '@astro/plugin-actions-build',

applyToEnvironment(environment) {
return environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr;
return (
environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.ssr ||
environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.prerender ||
environment.name === ASTRO_VITE_ENVIRONMENT_NAMES.astro
);
},

writeBundle(_, bundle) {
Expand Down
Loading