componentRegistry/runtime
Esta página aún no está disponible en tu idioma.
Variables
Section titled “Variables”componentProps
Section titled “componentProps”const componentProps: ComponentRegistryEntry[];
Defined in: studiocms/packages/studiocms/src/virtual.d.ts:214^
List of component properties that are registered in the component registry.
Each entry in the array is an object with a name
and props
property.
The props
property is an array of objects representing the properties of the component.
Functions
Section titled “Functions”createRenderer()
Section titled “createRenderer()”function createRenderer( result: SSRResult, sanitizeOpts?: SanitizeOptions,preRenderer?: (content: string) => Promise<string>): Promise<(content: string) => Promise<string>>
Defined in: studiocms/packages/studiocms/src/componentRegistry/runtime.ts:90^
Creates a renderer function that transforms HTML content using the provided components and sanitization options.
Parameters
Section titled “Parameters”result
Section titled “result”SSRResult
The SSRResult object from Astro.
sanitizeOpts?
Section titled “sanitizeOpts?”SanitizeOptions
Optional sanitization options for the HTML content.
preRenderer?
Section titled “preRenderer?”(content
: string
) => Promise
<string
>
An optional function to preprocess the HTML content before rendering.
Returns
Section titled “Returns”Promise
<(content
: string
) => Promise
<string
>>
A function that takes HTML content as input and returns the transformed HTML.
getRegistryComponents()
Section titled “getRegistryComponents()”function getRegistryComponents(): ComponentRegistryEntry[]
Defined in: studiocms/packages/studiocms/src/componentRegistry/runtime.ts:21^
Returns the component registry entries.
Returns
Section titled “Returns”An object mapping safe component names to their registry entries.
getRendererComponents()
Section titled “getRendererComponents()”function getRendererComponents(): Promise<Record<string, any>>
Defined in: studiocms/packages/studiocms/src/componentRegistry/runtime.ts:28^
Returns
Section titled “Returns”Promise
<Record
<string
, any
>>
A promise that resolves to an object containing the imported components.
importComponentsKeys()
Section titled “importComponentsKeys()”function importComponentsKeys(): Promise<Record<string, any>>
Defined in: studiocms/packages/studiocms/src/componentRegistry/runtime.ts:66^
Imports components by their keys from the ‘studiocms:markdown-remark/user-components’ module.
Returns
Section titled “Returns”Promise
<Record
<string
, any
>>
A promise that resolves to an object containing the imported components.
Throws
Section titled “Throws”If any component fails to import, an error is thrown with a prefixed message.
setupRendererComponentProxy()
Section titled “setupRendererComponentProxy()”function setupRendererComponentProxy(result: SSRResult): Promise<ComponentType>
Defined in: studiocms/packages/studiocms/src/componentRegistry/runtime.ts:77^
Sets up a component proxy for the renderer.
Parameters
Section titled “Parameters”result
Section titled “result”SSRResult
The SSRResult object from Astro.
Returns
Section titled “Returns”Promise
<ComponentType
>
A promise that resolves to a component proxy containing the components.
Throws
Section titled “Throws”If there is an error during setup, it will be prefixed and logged.
References
Section titled “References”ComponentRegistryEntry
Section titled “ComponentRegistryEntry”Re-exports ComponentRegistryEntry
convertHyphensToUnderscores
Section titled “convertHyphensToUnderscores”Re-exports convertHyphensToUnderscores
convertUnderscoresToHyphens
Section titled “convertUnderscoresToHyphens”Re-exports convertUnderscoresToHyphens