From 2e4124de673b95cf2bedf8edd52290f044d43b32 Mon Sep 17 00:00:00 2001
From: Armand Philippot
-**Type:** `(renderer:` [`AstroRenderer`](https://github.com/withastro/astro/blob/fdd607c5755034edf262e7b275732519328a33b2/packages/astro/src/%40types/astro.ts#L872-L883) `) => void;`
-**Type:** `(directive:` [`ClientDirectiveConfig`](https://github.com/withastro/astro/blob/00327c213f74627ac9ca1dec774efa5bf71e9375/packages/astro/src/%40types/astro.ts#L1872-L1875) `) => void;`
-**Type:** `(middleware:` [`AstroIntegrationMiddleware`](https://github.com/withastro/astro/blob/852ac0f75dfca1b2602e9cdbfa0447d9998e2449/packages/astro/src/%40types/astro.ts#L2124-L2127) `) => void;`
+
+**Type:** `{ order: "pre" | "post"; entrypoint: string | URL; }`
+
+
+**Type:** `"pre" | "post"`
+
+
+**Type:** `string | URL`
+
+
+**Type:** `{ name: string; clientEntrypoint?: string | URL; serverEntrypoint: string | URL; }`
+
+
+**Type:** `string`
+
+
+**Type:** `string | URL`
+
+
+**Type:** `string | URL`
+
+
+**Type:** `{ name: string; entrypoint: string | URL; }`
+
+
+**Type:** `string`
+
+
+**Type:** `string | URL`
+
-**Type:** [`RouteOptions`](https://github.com/withastro/astro/blob/3b10b97a4fecd1dfd959b160a07b5b8427fe40a7/packages/astro/src/types/public/integrations.ts#L14-L27)
+**Type:** `{ readonly component: string; prerender?: boolean; }`
-**Type:**
+
+**Type:** `string`
+
+**Type:** `string`
+
+
+**Type:** [`RouteData`](#routedata)
+
+
+**Type:** `string`
+
+
+**Type:** `Array<{ depth: number; order: number; sheet: { type: 'inline'; content: string } | { type: 'external'; src: string } }>`
From d174b1d5f561b406ea64dba58147380e23718794 Mon Sep 17 00:00:00 2001
From: Armand Philippot
-**Type:** [`AddressInfo`](https://microsoft.github.io/PowerBI-JavaScript/interfaces/_node_modules__types_node_net_d_._net_.addressinfo.html)
+**Type:** `AddressInfo`
-**Type:** [`SerializedSSRManifest`](https://github.com/withastro/astro/blob/3b10b97a4fecd1dfd959b160a07b5b8427fe40a7/packages/astro/src/core/app/types.ts#L91-L109)
+**Type:** [`SerializedSSRManifest`](#serialized-ssr-manifest-properties)
+
+**Type:** `SerializedRouteInfo[]`
+
+
+**Type:** `string[]`
+
+
+**Type:** `[string, string][]`
+
+
+**Type:** `[string, string][]`
+
+
+**Type:** `[string, string][]`
+
+
+**Type:** `string`
+
@@ -1319,22 +1377,35 @@ The following types can be imported from the `astro` module:
```ts
import type {
+ AssetsPrefix,
AstroIntegrationLogger,
AstroIntegrationMiddleware,
+ AstroMiddlewareInstance,
AstroRenderer,
ClientDirectiveConfig,
HookParameters,
IntegrationResolvedRoute,
RedirectConfig,
+ ResolvedSessionConfig,
RouteData,
RoutePart,
RouteType,
+ SSRLoadedRenderer,
+ SSRLoadedRendererValue,
+ SSRManifest,
ValidRedirectStatus,
// The following are deprecated:
IntegrationRouteData,
} from "astro";
```
+### `AssetsPrefix`
+
+
+
+**Type:** `string | ({ fallback: string; } & Record
+
+**Type:**
@@ -1578,6 +1658,15 @@ When the value of `IntegrationResolvedRoute.type` is `redirect`, the value will
Describes the destination of a redirect. This can be a string or an object containing information about the status code and its destination.
+### `ResolvedSessionConfig`
+
+
+
+**Type:**
+
+**Type:** `{ name: string; clientEntrypoint?: string | URL; ssr: SSRLoadedRendererValue; }`
+
+
+**Type:** [`SSRLoadedRendererValue`](#ssrloadedrenderervalue)
+
+
+**Type:** `string`
+
+
+**Type:** `AsyncRendererComponentFn
+
+**Type:** `AsyncRendererComponentFn<{ html: string; attrs?: Record
+
+**Type:** `boolean`
+
+
+**Type:** `() => string`
+
+
+**Type:** `string`
+
+
+**Type:** `string`
+
+
+**Type:** `RouteInfo[]`
+
+
+**Type:** `string`
+
+
+**Type:** `string`
+
+
+**Type:** `string | undefined`
+
+
+**Type:** [`AstroConfig['trailingSlash']`](/en/reference/configuration-reference/#trailingslash)
+
+
+**Type:** [`NonNullable
+
+**Type:** `boolean`
+
+
+**Type:** [`AssetsPrefix`](#assetsprefix)
+
+
+**Type:**
+
+**Type:** `Map
+
+**Type:** `Record
+
+**Type:** `Map
+
+**Type:** `Set
+
+**Type:** `Map
+
+**Type:** `{ page: ImportComponentInstance; onRequest?: MiddlewareHandler; renderers: SSRLoadedRenderer[]; }`
+
+
+**Type:** `() => Promise
+
+**Type:** [`MiddlewareHandler`](/en/reference/modules/astro-middleware/#middlewarehandler)
+
+
+**Type:**
+
+**Type:** `Map
+
+**Type:** `Map
+
+**Type:** `Map
+
+**Type:** `Promise
+
+**Type:** `SSRManifestI18n | undefined`
+
+
+**Type:**
+
+**Type:** `() => Promise
+
+**Type:** `boolean`
+
+
+**Type:**
+
+**Type:** [`ResolvedSessionConfig
+
+**Type:** `string | URL`
+
+
+**Type:** `string | URL`
+
+
+**Type:** `string | URL`
+
+
+**Type:** `string | URL`
+
+
+**Type:** `string | URL`
+
+
+**Type:** `string | URL`
+
+
+**Type:** `SSRManifestCSP | undefined`
+
+
+**Type:** `Record
From b62df909f0cb8153facad557b17a76043d0be65b Mon Sep 17 00:00:00 2001
From: Armand Philippot
+
+**Type:** `[string, SSRComponentMetadata][]`
@@ -1157,7 +1167,8 @@ A subset of the [`SSRManifest`](#ssrmanifest) with the following additional prop
-**Type:** `[string, string][]`
+**Type:** `[string, string][]`
-**Type:** `[string, string][]`
+**Type:** `[string, string][]`
-**Type:** `string`
+**Type:** `string`
-**Type:** `string`
+**Type:** `string`
-**Type:** `string | undefined`
+**Type:** `string | undefined`
-**Type:** [`AstroConfig['trailingSlash']`](/en/reference/configuration-reference/#trailingslash)
+**Type:** [`AstroConfig['trailingSlash']`](/en/reference/configuration-reference/#trailingslash)
-**Type:** [`NonNullable
-**Type:** `boolean`
+**Type:** `boolean`
-**Type:** [`AssetsPrefix`](#assetsprefix)
+**Type:** [`AssetsPrefix`](#assetsprefix)
-**Type:** `Map
-**Type:** `Map
-**Type:** `Map
-**Type:** `{ page: ImportComponentInstance; onRequest?: MiddlewareHandler; renderers: SSRLoadedRenderer[]; }`
+**Type:** `{ page: ImportComponentInstance; onRequest?: MiddlewareHandler; renderers: SSRLoadedRenderer[]; }`
-**Type:** [`MiddlewareHandler`](/en/reference/modules/astro-middleware/#middlewarehandler)
+**Type:** [`MiddlewareHandler`](/en/reference/modules/astro-middleware/#middlewarehandler)
-**Type:** `Map
-**Type:** `Map
-**Type:** `Promise
-**Type:** `SSRManifestI18n | undefined`
+**Type:** `SSRManifestI18n | undefined`
-**Type:**
-**Type:** `() => Promise
-**Type:** `boolean`
+**Type:** `boolean`
-**Type:** [`ResolvedSessionConfig
-**Type:** `string | URL`
+**Type:** `string | URL`
-**Type:** `string | URL`
+**Type:** `string | URL`
-**Type:** `string | URL`
+**Type:** `string | URL`
-**Type:** `string | URL`
+**Type:** `string | URL`
-**Type:** `string | URL`
+**Type:** `string | URL`
-**Type:** `string | URL`
+**Type:** `string | URL`
-**Type:** `SSRManifestCSP | undefined`
+**Type:** `SSRManifestCSP | undefined`
-**Type:** `Record
-
-**Type:** `string | ({ fallback: string; } & Record
+**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)
+**Type:** (directive: ClientDirectiveConfig) => void;
+**Type:** (middleware: AstroIntegrationMiddleware) => void;
Map\
+**Type:** `Map
+
+\{ onRequest?: MiddlewareHandler; \}
+SessionConfig\
+SSRLoadedRenderer[]
+SSRLoadedRenderer[]
+() => Promise\<AstroMiddlewareInstance\> | AstroMiddlewareInstance
+Partial\<RemotePattern\>[]
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+() => Promise\<AstroMiddlewareInstance\> | AstroMiddlewareInstance
+**Type:** () => Promise\<AstroMiddlewareInstance\> | AstroMiddlewareInstance
+
+
+
+
+
+
+
+
+
+
+
+
-**Type:** [`AssetsPrefix`](#assetsprefix)
+**Type:** `string | ({ fallback: string; } & Record
SSRLoadedRenderer[]
-{/* TODO */}
+An array containing information about each loaded UI framework renderer (e.g., React, Vue, Svelte).
#### `clientDirectives`
@@ -2091,9 +2081,7 @@ The base of the assets generated **by the user**. For example, scripts created b
-**Type:** `() => Promise
+**Type:** () => Promise\<\{ server: Record\
Partial\<RemotePattern\>[]
-{/* TODO */}
+Specifies the [configured list of permitted host patterns](/en/reference/configuration-reference/#securityalloweddomains) for incoming requests when using on-demand rendering.
#### `sessionConfig`
@@ -2279,7 +2265,7 @@ This contains the following properties:
-
-**Type:** SessionConfig\
-
@@ -2148,7 +2140,7 @@ Specifies information about a page module. This contains the following propertie
SSRLoadedRenderer[]
-{/* TODO */}
+An array of loaded UI framework renderer.
#### `pageMap`
@@ -2208,7 +2200,7 @@ Determines the cryptographic key used for encrypting server island props.
Specifies the `i18n` resolved configuration when defined by the user.
-#### middleware
+#### `middleware`
@@ -2251,11 +2243,11 @@ Specifies the [configured list of permitted host patterns](/en/reference/configu
-**Type:** [`ResolvedSessionConfig
+**Type:** SessionConfig\
-**Type:** `SSRManifestCSP | undefined`
+**Type:** SSRManifestCSP | undefined
+
+
+ +**Type:** `'adapter' | 'meta' | 'header' | undefined` +
+ +A union of literals determining 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 for project scripts. + +#### `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 for project styles. + +#### `directives` + ++ +**Type:** `CspDirective[]` +
+ +Specifies the [configured list of valid sources](/en/reference/experimental-flags/csp/#directives) for specific content types. ### `ValidRedirectStatus` From 8d0d387a77df6c58c4ae0c466135f26cd650d829 Mon Sep 17 00:00:00 2001 From: Armand Philippot\{ onRequest?: MiddlewareHandler; \}
-{/* TODO */}
+An object containing an `onRequest` property defined with the project's middleware function when it exists.
### `AstroRenderer`
@@ -1901,11 +1900,11 @@ Describes a loaded UI framework renderer. This is a subset of [`AstroRenderer`](
**Type:** [`SSRLoadedRendererValue`](#ssrloadedrenderervalue)
-{/* TODO */}
+Defines the on-demand rendering functions and configuration for this framework.
### `SSRLoadedRendererValue`
-{/* TODO */}
+Contains the functions and configuration necessary to render components on the server from a specific UI framework.
#### `name`
@@ -1914,7 +1913,7 @@ Describes a loaded UI framework renderer. This is a subset of [`AstroRenderer`](
**Type:** `string`
-{/* TODO */}
+Specifies the name identifier for the renderer.
#### `check()`
@@ -1923,7 +1922,7 @@ Describes a loaded UI framework renderer. This is a subset of [`AstroRenderer`](
**Type:** `AsyncRendererComponentFn
-**Type:** `boolean`
+**Type:** `boolean`
+
-**Type:** `() => string`
+**Type:** `() => string`
+
-**Type:** `[string, SSRComponentMetadata][]`
+**Type:** [string, SSRComponentMetadata][]
\{ onRequest?: MiddlewareHandler; \}
-An object containing an `onRequest` property defined with the project's middleware function when it exists.
+An object containing an [`onRequest()`](/en/reference/modules/astro-middleware/#onrequest) property defined with the project's middleware function when it exists.
### `AstroRenderer`
@@ -1575,7 +1576,7 @@ 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';
@@ -1884,6 +1885,36 @@ 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. This contains the following properties: + +#### `propagation` + ++ +**Type:** `'none' | 'self' | 'in-tree'` +
+ +A union of literals indicating whether the Astro runtime needs to wait for a component to render the head content: +- `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`@@ -1900,7 +1931,7 @@ Describes a loaded UI framework renderer. This is a subset of [`AstroRenderer`]( **Type:** [`SSRLoadedRendererValue`](#ssrloadedrenderervalue)
-Defines the on-demand rendering functions and configuration for this framework. +Defines the functions and configuration used by the server for this framework. ### `SSRLoadedRendererValue` @@ -1983,7 +2014,53 @@ Defines the name of the [server adapter](/en/guides/on-demand-rendering/#server- **Type:** `RouteInfo[]` -An array containing information about all routes in the project. Each route includes its path pattern, whether it's prerendered, and other routing metadata. +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; }>`
+
-**Type:** `Map
+**Type:** Map\
-**Type:** `MapMap\
-**Type:** `Map
+**Type:** `Map
+ +**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 routing strategy used [based on the project configuration](/en/reference/configuration-reference/#i18nrouting). 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
+ +**Type:** `"redirect" | "rewrite"` +
+ +Determines the [configured fallback strategy for the project](/en/reference/configuration-reference/#i18nroutingfallbacktype). + +##### `domainLookupTable` + +
+
+**Type:** `Record
-**Type:** `(manifest: SSRManifest, options: any) => Record(manifest: SSRManifest, options: any) => Record\
-**Type:** `(manifest: SSRManifest, options: any) => Record(manifest: SSRManifest, options: any) => Record\
@@ -2346,7 +2346,7 @@ Defines an instance to load the middleware.
SSRLoadedRenderer[]
-An array containing information about each loaded UI framework renderer (e.g., React, Vue, Svelte).
+An array containing information about each loaded UI framework renderer (e.g. React, Vue, Svelte).
#### `clientDirectives`
@@ -2147,7 +2149,7 @@ An array containing information about each loaded UI framework renderer (e.g., R
SSRLoadedRenderer[]
-An array containing information about each loaded UI framework renderer (e.g. React, Vue, Svelte).
+A list of renderers (e.g. React, Vue, Svelte) available for the server to use.
#### `clientDirectives`
@@ -2229,7 +2229,7 @@ An [Astro middleware function](/en/reference/modules/astro-middleware/#onrequest
**Type:** SSRLoadedRenderer[]
-An array of loaded UI framework renderer.
+A list of renderers that a server can use for this page.
#### `pageMap`
From 8ecf0d2820c1b3fa0c65d26f0a4accf9adfd54b2 Mon Sep 17 00:00:00 2001
From: Armand Philippot SSRLoadedRenderer[]
-A list of renderers (e.g. React, Vue, Svelte) available for the server to use.
+A list of renderers (e.g. React, Vue, Svelte, MDX) available for the server to use.
#### `clientDirectives`
@@ -2506,7 +2506,7 @@ Specifies a list of generated hashes for project scripts and [user-supplied hash
**Type:** `string[]`
-Specifies a list of valid sources combining the [configured resources](/en/reference/experimental-flags/csp/#resources) and the [injected script resources](/en/reference/experimental-flags/csp/#cspinsertscriptresource).
+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`
@@ -2533,7 +2533,7 @@ Specifies a list of generated hashes for project styles and [user-supplied hashe
**Type:** `string[]`
-Specifies a list of valid sources for project styles.
+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`
From f812c24680d5ea4b0a0e947a5a505411550b3304 Mon Sep 17 00:00:00 2001
From: Armand Philippot