runtime/AstroComponentProxy
Functions
'Read the “', Functions, '” section'createComponentProxy()
'Read the “', createComponentProxy(), '” section'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.
Parameters
'Read the “', Parameters, '” section'SSRResult
The result object used for rendering JSX.
_components
'Read the “', _components, '” section'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.
Parameters
'Read the “', Parameters, '” section'string
The string from which to remove leading indentation.
string
The dedented string.
transformHTML()
'Read the “', transformHTML(), '” section'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.
Parameters
'Read the “', Parameters, '” section'string
The HTML string to be transformed.
components
'Read the “', components, '” section'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.
sanitizeOpts?
'Read the “', sanitizeOpts?, '” section'SanitizeOptions
Optional sanitization options to be applied to the HTML.
Promise
<string
>
A promise that resolves to the transformed HTML string.