diff --git a/src/content/docs/en/reference/adapter-reference.mdx b/src/content/docs/en/reference/adapter-reference.mdx index 7313348ed0cb4..7ad70ddc446cb 100644 --- a/src/content/docs/en/reference/adapter-reference.mdx +++ b/src/content/docs/en/reference/adapter-reference.mdx @@ -254,7 +254,7 @@ You will need to create a file that executes during server-side requests to enab

-**Type:** `(manifest: SSRManifest, options: any) => Record` +**Type:** (manifest: SSRManifest, options: any) => Record\

An exported function that takes an SSR manifest as its first argument and an object containing your adapter [`args`](#args) as its second argument. This should provide the exports required by your host. @@ -314,7 +314,7 @@ export function createExports(manifest, args) {

-**Type:** `(manifest: SSRManifest, options: any) => Record` +**Type:** (manifest: SSRManifest, options: any) => Record\

An exported function that takes an SSR manifest as its first argument and an object containing your adapter [`args`](#args) as its second argument. diff --git a/src/content/docs/en/reference/integrations-reference.mdx b/src/content/docs/en/reference/integrations-reference.mdx index d7b824679d128..725c36de9be77 100644 --- a/src/content/docs/en/reference/integrations-reference.mdx +++ b/src/content/docs/en/reference/integrations-reference.mdx @@ -194,7 +194,7 @@ export default {

-**Type:** `(renderer:` [`AstroRenderer`](https://github.com/withastro/astro/blob/fdd607c5755034edf262e7b275732519328a33b2/packages/astro/src/%40types/astro.ts#L872-L883) `) => void;`
+**Type:** (renderer: AstroRenderer) => void;
**Examples:** [`svelte`](https://github.com/withastro/astro/blob/main/packages/integrations/svelte/src/index.ts), [`react`](https://github.com/withastro/astro/blob/main/packages/integrations/react/src/index.ts), [`preact`](https://github.com/withastro/astro/blob/main/packages/integrations/preact/src/index.ts), [`vue`](https://github.com/withastro/astro/blob/main/packages/integrations/vue/src/index.ts), [`solid`](https://github.com/withastro/astro/blob/main/packages/integrations/solid/src/index.ts)

@@ -215,7 +215,7 @@ The functions `clientEntrypoint` and `serverEntrypoint` accept a `URL`.

-If your integration depends on some configuration file that Vite doesn't watch and/or needs a full dev server restart to take effect, add it with `addWatchFile`. Whenever that file changes, the Astro dev server will be reloaded (you can check when a reload happens with `isRestart`). +If your integration depends on some configuration file that Vite doesn't watch and/or needs a full dev server restart to take effect, add it with `addWatchFile()`. Whenever that file changes, the Astro dev server will be reloaded (you can check when a reload happens with [`isRestart`](#isrestart-option)). Example usage: @@ -229,7 +229,7 @@ addWatchFile(new URL('./ec.config.mjs', config.root));

-**Type:** `(directive:` [`ClientDirectiveConfig`](https://github.com/withastro/astro/blob/00327c213f74627ac9ca1dec774efa5bf71e9375/packages/astro/src/%40types/astro.ts#L1872-L1875) `) => void;`
+**Type:** (directive: ClientDirectiveConfig) => void;

@@ -352,7 +352,7 @@ export default {

-**Type:** `(middleware:` [`AstroIntegrationMiddleware`](https://github.com/withastro/astro/blob/852ac0f75dfca1b2602e9cdbfa0447d9998e2449/packages/astro/src/%40types/astro.ts#L2124-L2127) `) => void;`
+**Type:** (middleware: AstroIntegrationMiddleware) => void;

@@ -375,7 +375,7 @@ export default () => ({ }); ``` -Middleware is defined in a package with an `onRequest` function, as with user-defined middleware. +Middleware is defined in a package with an [`onRequest()` function](/en/reference/modules/astro-middleware/#onrequest), as with user-defined middleware. ```js title="@my-package/middleware.js" import { defineMiddleware } from 'astro:middleware'; @@ -421,7 +421,7 @@ export default () => ({ A callback function to inject routes into an Astro project. Injected routes can be [`.astro` pages](/en/basics/astro-pages/) or [`.js` and `.ts` route handlers](/en/guides/endpoints/#static-file-endpoints). -`injectRoute` takes an object with a `pattern` and an `entrypoint`. +`injectRoute()` takes an object with a `pattern` and an `entrypoint`. - `pattern` - where the route should be output in the browser, for example `/foo/bar`. A `pattern` can use Astro's filepath syntax for denoting dynamic routes, for example `/foo/[bar]` or `/foo/[...bar]`. Note that a file extension is **not** needed in the `pattern`. - `entrypoint` - a bare module specifier pointing towards the `.astro` page or `.js`/`.ts` route handler that handles the route denoted in the `pattern`. @@ -541,7 +541,7 @@ const integration = {

-**Type:** [`RouteOptions`](https://github.com/withastro/astro/blob/3b10b97a4fecd1dfd959b160a07b5b8427fe40a7/packages/astro/src/types/public/integrations.ts#L14-L27) +**Type:** `{ readonly component: string; prerender?: boolean; }`

An object with a `component` property to identify the route and the following additional values to allow you to configure the generated route: `prerender`. @@ -810,7 +810,7 @@ A function that sends a message to the dev toolbar that an app can listen for. T A function for integrations to trigger an update to the content layer during `astro dev`. This can be used, for example, to register a webhook endpoint during dev, or to open a socket to a CMS to listen for changes. -By default, `refreshContent` will refresh all collections. You can optionally pass a `loaders` property, which is an array of loader names. If provided, only collections that use those loaders will be refreshed. For example, A CMS integration could use this property to only refresh its own collections. +By default, `refreshContent()` will refresh all collections. You can optionally pass a `loaders` property, which is an array of loader names. If provided, only collections that use those loaders will be refreshed. For example, A CMS integration could use this property to only refresh its own collections. You can also pass a `context` object to the loaders. This can be used to pass arbitrary data such as the webhook body, or an event from the websocket. @@ -873,10 +873,10 @@ The loader can then access the `refreshContextData` property to get the webhook

-**Type:** [`AddressInfo`](https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules__types_node_net_d_._net_.addressinfo.html) +**Type:** `AddressInfo`

-The address, family and port number supplied by the [Node.js Net module](https://nodejs.org/api/net.html). +The address, family and port number supplied by the [`server.address()` method of the Node.js Net module](https://nodejs.org/api/net.html#serveraddress). ### `astro:server:done` @@ -955,10 +955,10 @@ export default {

-**Type:** Map\PageBuildData\> +**Type:** `Map`

-A `Map` with a list of pages as key and their build data as value. +A `Map` with a list of pages as key and [their build data](#page-build-data) as value. This can be used to perform an action if a route matches a criteria: @@ -977,6 +977,57 @@ export default { } ``` +#### Page build data + +An object describing how to build a page. + +###### `key` + +

+ +**Type:** `string`
+ +

+ +Specifies a unique identifier for the page. + +###### `component` + +

+ +**Type:** `string` +

+ +Specifies the source component URL. + +###### `route` + +

+ +**Type:** [`RouteData`](#routedata) +

+ +Describes the information about the page route. + +###### `moduleSpecifier` + +

+ +**Type:** `string` +

+ +Defines a string that can be resolved into a file path for the module. + +###### `styles` + +

+ +**Type:** `Array<{ depth: number; order: number; sheet: { type: 'inline'; content: string } | { type: 'external'; src: string } }>`
+ +

+ +A list of styles to render on the page. Each style contains its `depth` in the components tree and its display `order` on the page, as well as an indication of whether this should be applied as an inline or external style. + #### `target` option

@@ -1052,7 +1103,7 @@ export default {

-**Type:** [`SerializedSSRManifest`](https://github.com/withastro/astro/blob/3b10b97a4fecd1dfd959b160a07b5b8427fe40a7/packages/astro/src/core/app/types.ts#L91-L109) +**Type:** [`SerializedSSRManifest`](#serialized-ssr-manifest-properties)

Allows you to create a custom build by accessing the SSR manifest. @@ -1071,6 +1122,77 @@ export default { } ``` +##### Serialized SSR manifest properties + +A serialized version of the [`SSRManifest`](#ssrmanifest), accessible through the [`astro:build:ssr` hook](#astrobuildssr). This contains the same information as `SSRManifest`, with some properties converted to serializable formats. + +###### `routes` + +

+ +**Type:** `SerializedRouteInfo[]` +

+ +Defines a list of serialized route information. Each route contains the same properties as [`SSRManifest.routes`](#routes-1), with `routeData` converted to a JSON-serializable format. + +###### `assets` + +

+ +**Type:** `string[]` +

+ +Defines a list of serialized asset file paths. + +###### `componentMetadata` + +

+ +**Type:** [string, SSRComponentMetadata][]
+ +

+ +Defines an array of key-value pairs where the first element is the component identifier and the second is an object describing the build metadata. + +###### `inlinedScripts` + +

+ +**Type:** `[string, string][]` +

+ +Defines an array of key-value pairs where each entry is a tuple. The first element is the script identifier and the second is the script content. + +###### `clientDirectives` + +

+ +**Type:** `[string, string][]`
+ +

+ +Defines an array of key-value pairs where the first element is the directive name (e.g. `load`, `visible`) and the second is the directive's implementation code. + +###### `serverIslandNameMap` + +

+ +**Type:** `[string, string][]`
+ +

+ +Defines an array of key-value pairs where each entry is a tuple. The first element is the component path and the second is the assigned name. + +###### `key` + +

+ +**Type:** `string`
+ +

+ +Specifies the cryptographic key, serialized as a string, used for encrypting server island props. + #### `entryPoints` option

@@ -1146,7 +1268,9 @@ export default { **Type:** [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL)

-A URL path to the build output directory. Note that if you need a valid absolute path string, you should use Node's built-in [`fileURLToPath`](https://nodejs.org/api/url.html#urlfileurltopathurl-options) utility. +A URL path to the build output directory. + +The following example uses Node's built-in [`fileURLToPath()`](https://nodejs.org/api/url.html#urlfileurltopathurl-options) utility to compute a valid absolute path string for a file provided by the integration: ```js import { fileURLToPath } from 'node:url'; @@ -1187,7 +1311,9 @@ export default { **Type:** [`URL`](https://developer.mozilla.org/en-US/docs/Web/API/URL)

-A URL path to the build output directory. Note that if you need a valid absolute path string, you should use Node's built-in [`fileURLToPath`](https://nodejs.org/api/url.html#urlfileurltopathurl-options) utility. +A URL path to the build output directory. + +The following example uses Node's built-in [`fileURLToPath()`](https://nodejs.org/api/url.html#urlfileurltopathurl-options) utility to compute a valid absolute path string for a file provided by the integration before writing to it: ```js import { writeFile } from 'node:fs/promises'; @@ -1242,7 +1368,7 @@ Contains URLs to output files paths, grouped by [`IntegrationResolvedRoute`](#in **Type:** `{ pathname: string }[]`

-A list of all generated pages. It is an object with one property. +A list of all generated pages. Each entry is an object with one property: - `pathname` - the finalized path of the page. @@ -1269,12 +1395,21 @@ The following types can be imported from the `astro` module: ```ts import type { AstroIntegrationLogger, + AstroIntegrationMiddleware, + AstroMiddlewareInstance, + AstroRenderer, + ClientDirectiveConfig, HookParameters, IntegrationResolvedRoute, RedirectConfig, RouteData, RoutePart, RouteType, + SSRComponentMetadata, + SSRLoadedRenderer, + SSRLoadedRendererValue, + SSRManifest, + SSRManifestCSP, ValidRedirectStatus, // The following are deprecated: IntegrationRouteData, @@ -1344,9 +1479,110 @@ The example above will produce logs with `[astro-format]` by default, and `[astr [astro-format/build] Build finished. ``` +### `AstroIntegrationMiddleware` + +

+ +**Type:** `{ order: "pre" | "post"; entrypoint: string | URL; }` +

+ +Describes a [middleware added by an integration](#addmiddleware-option). + +#### `order` + +

+ +**Type:** `"pre" | "post"` +

+ +Specifies whether the middleware should run before (`pre`) or after (`post`) other middleware. + +#### `entrypoint` + +

+ +**Type:** `string | URL` +

+ +Defines the import path of the middleware. + +### `AstroMiddlewareInstance` + +

+ +**Type:** \{ onRequest?: MiddlewareHandler; \} +

+ +An object containing an [`onRequest()`](/en/reference/modules/astro-middleware/#onrequest) property defined with the project's middleware function when it exists. + +### `AstroRenderer` + +

+ +**Type:** `{ name: string; clientEntrypoint?: string | URL; serverEntrypoint: string | URL; }` +

+ +Describes a [component framework renderer added by an integration](#addrenderer-option). + +#### `name` + +

+ +**Type:** `string` +

+ +The name of the component framework renderer. + +#### `clientEntrypoint` + +

+ +**Type:** `string | URL` +

+ +Defines the import path of the renderer that runs on the client whenever your component is used. + +#### `serverEntrypoint` + +

+ +**Type:** `string | URL` +

+ +Defines the import path of the renderer that runs during server-side requests or static builds whenever your component is used. + +### `ClientDirectiveConfig` + +

+ +**Type:** `{ name: string; entrypoint: string | URL; }` +

+ +Describes a [custom client directive added by an integration](#addclientdirective-option). + +#### `name` + +

+ +**Type:** `string` +

+ +A custom name for the event triggered by the directive. + +#### `entrypoint` + +

+ +**Type:** `string | URL` +

+ +Defines the import path of the code executed whenever the directive is used. + ### `HookParameters` -You can get the type of a hook’s arguments by passing the hook’s name to the `HookParameters` utility type. In the following example, a function’s `options` argument is typed to match the parameters of the `astro:config:setup` hook: +You can get the type of a hook’s arguments by passing the hook’s name to the `HookParameters` utility type. + +In the following example, a function’s `options` argument is typed to match the parameters of the [`astro:config:setup` hook](#astroconfigsetup): ```ts /HookParameters(?:<.+>)?/ import type { HookParameters } from 'astro'; @@ -1436,7 +1672,7 @@ Describes the destination of a redirect. This can be a string or an object conta ### `RouteData` -Describes the information about a route. This contains the following properties: +Describes the information about a route. #### `route` @@ -1609,7 +1845,7 @@ Determines if a route comes from Astro core (`internal`), an integration (`exter **Type:** `{ content: string; dynamic: boolean; spread: boolean; }`

-Describes a route segment. This contains the following properties: +Describes a route segment. #### `content` @@ -1655,6 +1891,659 @@ A union of supported route types: * `redirect`: a route points to another route that lives in the file system * `fallback`: a route that doesn't exist in the file system that needs to be handled with other means, usually a middleware +### `SSRComponentMetadata` + +

+ +**Type:** `{ propagation: PropagationHint; containsHead: boolean; }` +

+ +Describes the build metadata of a component rendered by the server. + +#### `propagation` + +

+ +**Type:** `'none' | 'self' | 'in-tree'` +

+ +A description of how to render head content from this component, including whether the Astro runtime needs to wait for a component: +- `none`: The component does not propagate the head content. +- `self`: The component appends the head content. +- `in-tree`: Another component within this component's dependency tree appends the head content. + +#### `containsHead` + +

+ +**Type**: `boolean` +

+ +Determines whether the component contains the head content. + +### `SSRLoadedRenderer` + +

+ +**Type:** `{ name: string; clientEntrypoint?: string | URL; ssr: SSRLoadedRendererValue; }` +

+ +Describes a renderer available for the server to use. This is a subset of [`AstroRenderer`](#astrorenderer) with additional properties. + +#### `ssr` + +

+ +**Type:** [`SSRLoadedRendererValue`](#ssrloadedrenderervalue) +

+ +Defines the functions and configuration used by the server for this framework. + +### `SSRLoadedRendererValue` + +Contains the functions and configuration necessary to render components on the server from a specific UI framework. + +#### `name` + +

+ +**Type:** `string` +

+ +Specifies the name identifier for the renderer. + +#### `check()` + +

+ +**Type:** `AsyncRendererComponentFn` +

+ +Determines whether the renderer should handle the component. + +#### `renderToStaticMarkup()` + +

+ +**Type:** `AsyncRendererComponentFn<{ html: string; attrs?: Record; }>` +

+ +Renders a framework component to static HTML markup on the server. + +#### `supportsAstroStaticSlot` + +

+ +**Type:** `boolean`
+ +

+ +Indicates whether the renderer supports Astro's static slot optimization. When true, Astro prevents the removal of nested slots within islands. + +#### `renderHydrationScript()` + +

+ +**Type:** `() => string`
+ +

+ +Returns a framework-specific hydration script that must be injected into the HTML before the first component that uses this renderer. + +### `SSRManifest` + +An object containing build configuration and project metadata that the server adapters use at runtime to serve on-demand rendered pages. + +#### `hrefRoot` + +

+ +**Type:** `string`
+ +

+ +Specifies the root path used to generate URLs. + +#### `adapterName` + +

+ +**Type:** `string` +

+ +Defines the name of the [server adapter](/en/guides/on-demand-rendering/#server-adapters) used for on-demand rendering. + +#### `routes` + +

+ +**Type:** `RouteInfo[]` +

+ +A list of information about the routes available in this project. Each entry contains the following properties. + +##### `routeData` + +

+ +**Type:** [`RouteData`](#routedata) +

+ +An object describing known information about a route. + +##### `file` + +

+ +**Type:** `string` +

+ +Specifies the file path to the built route entrypoint. + +##### `links` + +

+ +**Type:** `string[]` +

+ +Defines a list of [HTML `link` element](https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/link) required by this route. + +##### `scripts` + +

+ +**Type:** `Array<{ children: string; stage: string } | { type: 'inline' | 'external'; value: string }>` +

+ +Defines a list of scripts associated with this route. This includes both integration-injected scripts with `children` and `stage` properties and hoisted scripts with `type` and `value` properties. + +##### `styles` + +

+ +**Type:** `Array<{ type: "inline"; content: string; } | { type: "external"; src: string; }>`
+ +

+ +Defines the list of stylesheets associated with this route. This includes both inline styles and stylesheet URLs. + +#### `site` + +

+ +**Type:** `string` +

+ +Specifies the [configured `site`](/en/reference/configuration-reference/#site). + +#### `base` + +

+ +**Type:** `string` +

+ +Specifies the [configured `base` path](/en/reference/configuration-reference/#base) to deploy to. + +#### `userAssetsBase` + +

+ +**Type:** `string | undefined`
+ +

+ +Specifies the base path to use in development mode for user-generated assets, such as scripts and styles. + +#### `trailingSlash` + +

+ +**Type:** [`AstroConfig['trailingSlash']`](/en/reference/configuration-reference/#trailingslash)
+ +

+ +Specifies the [configured behavior for trailing slashes](/en/reference/configuration-reference/#trailingslash) in development mode and for on-demand rendered pages. + +#### `buildFormat` + +

+ +**Type:** [`NonNullable['format']`](/en/reference/configuration-reference/#buildformat)
+ +

+ +Specifies the [configured output file format](/en/reference/configuration-reference/#buildformat). + +#### `compressHTML` + +

+ +**Type:** `boolean`
+ +

+ +Determines whether [HTML minification is enabled in the project configuration](/en/reference/configuration-reference/#compresshtml). + +#### `assetsPrefix` + +

+ +**Type:** `string | ({ fallback: string; } & Record) | undefined`
+ +

+ +Specifies the [configured prefix for Astro-generated asset links](/en/reference/configuration-reference/#buildassetsprefix). + +#### `renderers` + +

+ +**Type:** SSRLoadedRenderer[] +

+ +A list of renderers (e.g. React, Vue, Svelte, MDX) available for the server to use. + +#### `clientDirectives` + +

+ +**Type:** `Map`
+ +

+ +Defines a mapping of client directive names (e.g. `load`, `visible`) to their implementation code. This includes both [built-in client directives](/en/reference/directives-reference/#client-directives) and [custom client directives](/en/reference/directives-reference/#custom-client-directives). + +#### `entryModules` + +

+ +**Type:** `Record` +

+ +Defines a mapping of entrypoints to their output file paths. + +#### `inlinedScripts` + +

+ +**Type:** `Map`
+ +

+ +Defines a mapping of script identifiers to their content for scripts that will be inlined in the HTML output. + +#### `assets` + +

+ +**Type:** `Set` +

+ +Defines a set of file paths for all assets that are part of the build. + +#### `componentMetadata` + +

+ +**Type:** Map\SSRComponentMetadata\>
+ +

+ +Defines a mapping of component identifiers to their build metadata. Each entry contains information about the [`propagation`](#propagation) behavior and whether it contains head elements. + +#### `pageModule` + +

+ +**Type:** `{ page: ImportComponentInstance; onRequest?: MiddlewareHandler; renderers: SSRLoadedRenderer[]; }`
+ +

+ +Specifies information about a page module. + +##### `page()` + +

+ +**Type:** `() => Promise` +

+ +A function to retrieve an instance of the page component. + +##### `onRequest()` + +

+ +**Type:** [`MiddlewareHandler`](/en/reference/modules/astro-middleware/#middlewarehandler)
+ +

+ +An [Astro middleware function](/en/reference/modules/astro-middleware/#onrequest) when defined in the user project. + +##### `renderers` + +

+ +**Type:** SSRLoadedRenderer[] +

+ +A list of renderers that a server can use for this page. + +#### `pageMap` + +

+ +**Type:** Map\ Promise\<typeof pageModule\>\> +

+ +Defines a mapping of component paths to their importable instances. + +#### `serverIslandMap` + +

+ +**Type:** `Map Promise>`
+ +

+ +Defines a mapping of server island IDs to their component instances. + +#### `serverIslandNameMap` + +

+ +**Type:** `Map`
+ +

+ +Defines a mapping of server island component paths to their assigned names. + +#### `key` + +

+ +**Type:** `Promise`
+ +

+ +Determines the [cryptographic key](https://developer.mozilla.org/en-US/docs/Web/API/CryptoKey) used for encrypting server island props. + +#### `i18n` + +

+ +**Type:** `SSRManifestI18n | undefined`
+ +

+ +Specifies the resolved [`i18n` configuration](/en/reference/configuration-reference/#i18n) when enabled in the project. + +##### `strategy` + +

+ +**Type:** `"manual" | "pathname-prefix-always" | "pathname-prefix-other-locales" | "pathname-prefix-always-no-redirect" | "domains-prefix-always" | "domains-prefix-other-locales" | "domains-prefix-always-no-redirect"` +

+ +Defines the [i18n routing strategy](/en/reference/configuration-reference/#i18nrouting) configured. This determines how locales are handled in URLs and whether redirects occur. + +##### `locales` + +

+ +**Type:** `Locales` +

+ +Specifies a list of [supported locales configured in the project](/en/reference/configuration-reference/#i18nlocales). + +##### `defaultLocale` + +

+ +**Type:** `string` +

+ +Determines the [default locale configured in the project](/en/reference/configuration-reference/#i18ndefaultlocale). + +##### `fallback` + +

+ +**Type:** `Record | undefined` +

+ +Specifies a mapping of locales to their fallback locales as [configured in `i18n.fallback`](/en/reference/configuration-reference/#i18nfallback). + +##### `fallbackType` + +

+ +**Type:** `"redirect" | "rewrite"` +

+ +Determines the [configured fallback strategy for the project](/en/reference/configuration-reference/#i18nroutingfallbacktype). + +##### `domainLookupTable` + +

+ +**Type:** `Record` +

+ +A mapping of [configured domains](/en/reference/configuration-reference/#i18ndomains) to their associated locales. + +#### `middleware` + +

+ +**Type:** () => Promise\<AstroMiddlewareInstance\> | AstroMiddlewareInstance
+ +

+ +Defines an instance to load the middleware. + +#### `actions` + +

+ +**Type:** () => Promise\<\{ server: Record\ActionClient\>; \}\> | \{ server: Record\ActionClient\>; \}
+ +

+ +An object, or a function that returns an object, with a `server` property that maps action names to their callable functions. + +#### `checkOrigin` + +

+ +**Type:** `boolean`
+ +

+ +Determines whether [origin checking is enabled in the security configuration](/en/reference/configuration-reference/#securitycheckorigin). + +#### `allowedDomains` + +

+ +**Type:** Partial\<RemotePattern\>[] +

+ +Specifies the [configured list of permitted host patterns](/en/reference/configuration-reference/#securityalloweddomains) for incoming requests when using on-demand rendering. + +#### `sessionConfig` + +

+ +**Type:** SessionConfig\ & \{ driverModule?: () => Promise\<\{ default: () => unstorage.Driver \}\>; }
+ +

+ +An object containing the [resolved session configuration](/en/reference/configuration-reference/#session-options) and an additional property defining the driver in use. + +#### `cacheDir` + +

+ +**Type:** `string | URL`
+ +

+ +Specifies the [configured directory for caching build artifacts](/en/reference/configuration-reference/#cachedir). + +#### `srcDir` + +

+ +**Type:** `string | URL`
+ +

+ +Specifies the [configured directory that Astro will read the site from](/en/reference/configuration-reference/#srcdir). + +#### `outDir` + +

+ +**Type:** `string | URL`
+ +

+ +Specifies the [configured directory in which to write the final build](/en/reference/configuration-reference/#outdir). + +#### `publicDir` + +

+ +**Type:** `string | URL`
+ +

+ +Specifies the [configured directory for the static assets](/en/reference/configuration-reference/#publicdir). + +#### `buildClientDir` + +

+ +**Type:** `string | URL`
+ +

+ +Determines the path where client-side build artifacts (e.g. JavaScript, CSS) are output within the build directory. + +#### `buildServerDir` + +

+ +**Type:** `string | URL`
+ +

+ +Determines the path where server-side build artifacts are output within the build directory. + +#### `csp` + +

+ +**Type:** SSRManifestCSP | undefined
+ +

+ +An object describing the Content Security Policy configuration. + +#### `internalFetchHeaders` + +

+ +**Type:** `Record`
+ +

+ +Specifies the headers that are automatically added to internal fetch requests made during rendering. + +### `SSRManifestCSP` + +

+ + +

+ +Describes the [Content Security Policy configuration](/en/reference/experimental-flags/csp/). + +#### `cspDestination` + +

+ +**Type:** `'adapter' | 'meta' | 'header' | undefined` +

+ +Specifies whether CSP directives should be injected as a `meta` element, as a response `header`, or by the [`adapter` when it supports setting response headers](/en/reference/adapter-reference/#experimentalstaticheaders). + +#### `algorithm` + +

+ +**Type:** `'SHA-256' | 'SHA-384' | 'SHA-512'` +

+ +Specifies the [configured hash function](/en/reference/experimental-flags/csp/#algorithm). + +#### `scriptHashes` + +

+ +**Type:** `string[]` +

+ +Specifies a list of generated hashes for project scripts and [user-supplied hashes](/en/reference/experimental-flags/csp/#hashes) for external scripts. + +#### `scriptResources` + +

+ +**Type:** `string[]` +

+ +Specifies a list of valid sources combining the [configured script resources](/en/reference/experimental-flags/csp/#resources) and the [injected script resources](/en/reference/experimental-flags/csp/#cspinsertscriptresource). + +#### `isStrictDynamic` + +

+ +**Type:** `boolean` +

+ +Determines whether support for [dynamic script injection is enabled in the configuration](/en/reference/experimental-flags/csp/#strictdynamic). + +#### `styleHashes` + +

+ +**Type:** `string[]` +

+ +Specifies a list of generated hashes for project styles and [user-supplied hashes](/en/reference/experimental-flags/csp/#hashes) for external styles. + +#### `styleResources` + +

+ +**Type:** `string[]` +

+ +Specifies a list of valid sources combining the [configured style resources](/en/reference/experimental-flags/csp/#resources) and the [injected script resources](/en/reference/experimental-flags/csp/#cspinsertscriptresource). + +#### `directives` + +

+ +**Type:** `CspDirective[]` +

+ +Specifies the [configured list of valid sources](/en/reference/experimental-flags/csp/#directives) for specific content types. + ### `ValidRedirectStatus`