Skip to content

runtime/AstroComponentProxy

function createComponentProxy(result: SSRResult, _components: Record<string, any>): Record<string, any>

Defined in: studiocms/packages/studiocms/src/runtime/AstroComponentProxy.ts:19

Creates a proxy for components that can either be strings or functions. If the component is a string, it is directly assigned to the proxy. If the component is a function, it is wrapped in an async function that processes the props and children before rendering.

SSRResult

The result object used for rendering JSX.

Record<string, any> = {}

An optional record of components to be proxied. Defaults to an empty object.

Record<string, any>

A record of proxied components.


function dedent(str: string): string

Defined in: studiocms/packages/studiocms/src/runtime/AstroComponentProxy.ts:67

Removes leading indentation from a multi-line string.

string

The string from which to remove leading indentation.

string

The dedented string.


function transformHTML(
html: string,
components: Record<string, any>,
sanitizeOpts?: SanitizeOptions): Promise<string>

Defined in: studiocms/packages/studiocms/src/runtime/AstroComponentProxy.ts:87

Transforms the provided HTML string by applying sanitization and component swapping.

string

The HTML string to be transformed.

Record<string, any>

A record of components to be swapped within the HTML. The keys are component names and the values are the corresponding component implementations.

SanitizeOptions

Optional sanitization options to be applied to the HTML.

Promise<string>

A promise that resolves to the transformed HTML string.