Skip to content
Merged
Changes from all commits
Commits
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
19 changes: 18 additions & 1 deletion packages/angular/ssr/src/routes/route-config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ import { EnvironmentProviders, InjectionToken, makeEnvironmentProviders } from '

/**
* Different rendering modes for server routes.
* @see {@link provideServerRoutesConfig}
* @see {@link ServerRoute}
* @developerPreview
*/
export enum RenderMode {
Expand All @@ -29,7 +31,7 @@ export enum RenderMode {
/**
* Defines the fallback strategies for Static Site Generation (SSG) routes when a pre-rendered path is not available.
* This is particularly relevant for routes with parameterized URLs where some paths might not be pre-rendered at build time.
*
* @see {@link ServerRoutePrerenderWithParams}
* @developerPreview
*/
export enum PrerenderFallback {
Expand All @@ -54,6 +56,7 @@ export enum PrerenderFallback {

/**
* Common interface for server routes, providing shared properties.
* @developerPreview
*/
export interface ServerRouteCommon {
/** The path associated with this route. */
Expand All @@ -68,6 +71,8 @@ export interface ServerRouteCommon {

/**
* A server route that uses AppShell rendering mode.
* @see {@link RenderMode}
* @developerPreview
*/
export interface ServerRouteAppShell extends Omit<ServerRouteCommon, 'headers' | 'status'> {
/** Specifies that the route uses AppShell rendering mode. */
Expand All @@ -76,6 +81,8 @@ export interface ServerRouteAppShell extends Omit<ServerRouteCommon, 'headers' |

/**
* A server route that uses Client-Side Rendering (CSR) mode.
* @see {@link RenderMode}
* @developerPreview
*/
export interface ServerRouteClient extends ServerRouteCommon {
/** Specifies that the route uses Client-Side Rendering (CSR) mode. */
Expand All @@ -84,6 +91,8 @@ export interface ServerRouteClient extends ServerRouteCommon {

/**
* A server route that uses Static Site Generation (SSG) mode.
* @see {@link RenderMode}
* @developerPreview
*/
export interface ServerRoutePrerender extends Omit<ServerRouteCommon, 'status'> {
/** Specifies that the route uses Static Site Generation (SSG) mode. */
Expand All @@ -95,6 +104,10 @@ export interface ServerRoutePrerender extends Omit<ServerRouteCommon, 'status'>

/**
* A server route configuration that uses Static Site Generation (SSG) mode, including support for routes with parameters.
* @see {@link RenderMode}
* @see {@link ServerRoutePrerender}
* @see {@link PrerenderFallback}
* @developerPreview
*/
export interface ServerRoutePrerenderWithParams extends Omit<ServerRoutePrerender, 'fallback'> {
/**
Expand Down Expand Up @@ -138,6 +151,8 @@ export interface ServerRoutePrerenderWithParams extends Omit<ServerRoutePrerende

/**
* A server route that uses Server-Side Rendering (SSR) mode.
* @see {@link RenderMode}
* @developerPreview
*/
export interface ServerRouteServer extends ServerRouteCommon {
/** Specifies that the route uses Server-Side Rendering (SSR) mode. */
Expand All @@ -146,6 +161,7 @@ export interface ServerRouteServer extends ServerRouteCommon {

/**
* Server route configuration.
* @see {@link provideServerRoutesConfig}
* @developerPreview
*/
export type ServerRoute =
Expand All @@ -166,6 +182,7 @@ export const SERVER_ROUTES_CONFIG = new InjectionToken<ServerRoute[]>('SERVER_RO
*
* @param routes - An array of server routes to be provided.
* @returns An `EnvironmentProviders` object that contains the server routes configuration.
* @see {@link ServerRoute}
* @developerPreview
*/
export function provideServerRoutesConfig(routes: ServerRoute[]): EnvironmentProviders {
Expand Down