UNPKG

studiocms

Version:

Astro Native CMS for AstroDB. Built from the ground up by the Astro community.

325 lines (324 loc) 14.6 kB
import { type Messages } from '@withstudiocms/internal_helpers/astro-integration'; import type { AstroIntegration, InjectedRoute } from 'astro'; import { type RobotsConfig } from '../integrations/plugins.js'; import type { StudioCMSPlugin } from '../schemas/index.js'; import type { PluginAugmentsTranslationCollection, PluginTranslationCollection } from '../schemas/plugins/i18n.js'; /** * **Default StudioCMS Plugin** * * **NOTE** - Internal use only * * The default StudioCMS Plugin that comes with StudioCMS. * * @see The [StudioCMS Docs](https://docs.studiocms.dev) for more information on how to use StudioCMS. */ export declare const defaultPlugin: StudioCMSPlugin; /** * Configuration options for the StudioCMS plugin handler. * * @property dbStartPage - Indicates whether to use the database for the start page. * @property verbose - Enables verbose logging output. * @property name - The name of the plugin or application. * @property pkgVersion - The version of the package. * @property plugins - An array of StudioCMSPlugin instances, or undefined if no plugins are provided. * @property robotsTXTConfig - Configuration for robots.txt, either a boolean or a RobotsConfig object. * @property dashboardRoute - A function that returns the dashboard route for a given path. */ type Options = { dbStartPage: boolean; verbose: boolean; name: string; pkgVersion: string; plugins: StudioCMSPlugin[] | undefined; robotsTXTConfig: boolean | RobotsConfig; dashboardRoute: (path: string) => string; }; /** * Handles the setup and configuration of StudioCMS plugins during the Astro build process. * * This utility function is registered for the `astro:config:setup` hook and is responsible for: * - Initializing and validating StudioCMS plugins, including checking minimum version requirements. * - Collecting integrations, dashboard grid items, dashboard pages, plugin endpoints, renderers, image services, and other plugin-related data. * - Invoking plugin hooks (`studiocms:astro:config`, `studiocms:config:setup`) to allow plugins to register their features and integrations. * - Setting up virtual imports for plugin components, endpoints, renderers, and image services for use in the StudioCMS dashboard and editor. * - Managing sitemap and robots.txt integrations based on plugin and configuration options. * - Verifying plugin dependencies and requirements. * - Logging information about installed plugins and their configuration. * * @param params - Parameters provided by Astro during the config setup phase, including the logger. * @param options - StudioCMS configuration options, including plugins, dashboard route, robots.txt config, and other settings. * @returns An object containing: * - `integrations`: Array of Astro integrations to be registered. * - `extraRoutes`: Additional routes to be injected into the Astro app (e.g., dashboard plugin pages). * - `safePluginList`: List of validated and processed plugins with their safe configuration data. * - `messages`: Informational messages about the plugin setup process. * * @throws {StudioCMSError} If a plugin specifies an invalid minimum version requirement or if no rendering plugins are found. * @throws {AstroError} If no rendering plugins are installed. */ export declare const pluginHandler: import("astro-integration-kit").HookUtility<"astro:config:setup", [options: Options], Promise<{ integrations: { integration: AstroIntegration; }[]; extraRoutes: InjectedRoute[]; safePluginList: { name: string; identifier: string; settingsPage?: { fields: ({ name: string; label: string; input: "checkbox"; required?: boolean | undefined; readOnly?: boolean | undefined; color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined; defaultChecked?: boolean | undefined; size?: "sm" | "md" | "lg" | undefined; } | { name: string; label: string; input: "input"; type?: "number" | "text" | "password" | "email" | "tel" | "url" | "search" | undefined; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; } | { name: string; label: string; input: "textarea"; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; } | { options: { value: string; label: string; disabled?: boolean | undefined; }[]; name: string; label: string; input: "radio"; required?: boolean | undefined; readOnly?: boolean | undefined; color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined; defaultValue?: string | undefined; direction?: "horizontal" | "vertical" | undefined; } | { options: { value: string; label: string; disabled?: boolean | undefined; }[]; name: string; label: string; input: "select"; type?: "search" | "basic" | undefined; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; } | { name: string; label: string; input: "row"; fields: ({ name: string; label: string; input: "checkbox"; required?: boolean | undefined; readOnly?: boolean | undefined; color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined; defaultChecked?: boolean | undefined; size?: "sm" | "md" | "lg" | undefined; } | { name: string; label: string; input: "input"; type?: "number" | "text" | "password" | "email" | "tel" | "url" | "search" | undefined; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; } | { name: string; label: string; input: "textarea"; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; } | { options: { value: string; label: string; disabled?: boolean | undefined; }[]; name: string; label: string; input: "radio"; required?: boolean | undefined; readOnly?: boolean | undefined; color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined; defaultValue?: string | undefined; direction?: "horizontal" | "vertical" | undefined; } | { options: { value: string; label: string; disabled?: boolean | undefined; }[]; name: string; label: string; input: "select"; type?: "search" | "basic" | undefined; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; })[]; required?: boolean | undefined; readOnly?: boolean | undefined; alignCenter?: boolean | undefined; gapSize?: "sm" | "md" | "lg" | undefined; })[]; endpoint: string; } | undefined; frontendNavigationLinks?: { label: string; href: string; }[] | undefined; pageTypes?: { label: string; identifier: string; fields?: ({ name: string; label: string; input: "checkbox"; required?: boolean | undefined; readOnly?: boolean | undefined; color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined; defaultChecked?: boolean | undefined; size?: "sm" | "md" | "lg" | undefined; } | { name: string; label: string; input: "input"; type?: "number" | "text" | "password" | "email" | "tel" | "url" | "search" | undefined; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; } | { name: string; label: string; input: "textarea"; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; } | { options: { value: string; label: string; disabled?: boolean | undefined; }[]; name: string; label: string; input: "radio"; required?: boolean | undefined; readOnly?: boolean | undefined; color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined; defaultValue?: string | undefined; direction?: "horizontal" | "vertical" | undefined; } | { options: { value: string; label: string; disabled?: boolean | undefined; }[]; name: string; label: string; input: "select"; type?: "search" | "basic" | undefined; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; } | { name: string; label: string; input: "row"; fields: ({ name: string; label: string; input: "checkbox"; required?: boolean | undefined; readOnly?: boolean | undefined; color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined; defaultChecked?: boolean | undefined; size?: "sm" | "md" | "lg" | undefined; } | { name: string; label: string; input: "input"; type?: "number" | "text" | "password" | "email" | "tel" | "url" | "search" | undefined; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; } | { name: string; label: string; input: "textarea"; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; } | { options: { value: string; label: string; disabled?: boolean | undefined; }[]; name: string; label: string; input: "radio"; required?: boolean | undefined; readOnly?: boolean | undefined; color?: "primary" | "success" | "warning" | "danger" | "info" | "mono" | undefined; defaultValue?: string | undefined; direction?: "horizontal" | "vertical" | undefined; } | { options: { value: string; label: string; disabled?: boolean | undefined; }[]; name: string; label: string; input: "select"; type?: "search" | "basic" | undefined; required?: boolean | undefined; readOnly?: boolean | undefined; placeholder?: string | undefined; defaultValue?: string | undefined; })[]; required?: boolean | undefined; readOnly?: boolean | undefined; alignCenter?: boolean | undefined; gapSize?: "sm" | "md" | "lg" | undefined; })[] | undefined; description?: string | undefined; pageContentComponent?: string | undefined; rendererComponent?: string | undefined; apiEndpoint?: string | undefined; }[] | undefined; }[]; messages: Messages; oAuthProvidersConfigured: boolean; pluginsTranslations: PluginTranslationCollection; augmentTranslations: PluginAugmentsTranslationCollection; }>>; export {};