@withstudiocms/internal_helpers
Version:
Internal helper utilities for StudioCMS
27 lines (26 loc) • 1.23 kB
TypeScript
import type { InjectedScriptStage } from 'astro';
/**
* Represents a script to be injected at a specific stage of the integration process.
*
* @property stage - The stage at which the script should be injected.
* @property content - The actual script content as a string.
* @property enabled - Indicates whether the script is enabled for injection.
*/
export interface ScriptEntry {
stage: InjectedScriptStage;
content: string;
enabled: boolean;
}
/**
* Injects scripts into the Astro configuration setup stage.
*
* This utility iterates over an array of script entries and injects each enabled script
* at the specified stage using the provided `params.injectScript` method.
*
* @param params - The parameters provided by the Astro integration context, including the `injectScript` function.
* @param entries - An array of script entries to be injected. Each entry contains:
* - `stage`: The stage at which the script should be injected.
* - `content`: The script content to inject.
* - `enabled`: A boolean indicating whether the script should be injected.
*/
export declare const injectScripts: import("astro-integration-kit").HookUtility<"astro:config:setup", [entries: ScriptEntry[]], void>;