import type { PolicyShape } from "../policy.js"; /** * @alpha */ export interface FileHeaderPolicyConfig { /** * The text to use as the header. */ headerText: string; /** * An optional string that will be appended to the headerText. */ autoGenText?: string; } /** * Configuration for generating file headers with specific formatting rules. * * @remarks * This interface extends FileHeaderPolicyConfig and adds formatting-specific * properties to control how headers are inserted into different file types. * * @alpha */ export interface FileHeaderGeneratorConfig extends Partial { /** Regular expression that matches files this header generator applies to */ match: RegExp; /** * Regex matching header prefix (e.g. `/*!\r?\n`) */ headerStart?: RegExp; /** * Regex matching beginning of each line (e.g. ' * ') */ lineStart: RegExp; /** * Regex matching the end of each line (e.g., `\r?\n`) */ lineEnd: RegExp; /** * Regex matching the header postfix. */ headerEnd?: RegExp; /** * Function that generates the properly formatted header content for insertion into files. * * @param content - The original file content * @param config - The file header policy configuration * @returns The formatted header string to insert */ replacer: (content: string, config: FileHeaderPolicyConfig) => string; } /** * Input arguments for defining a file header policy. * * @alpha */ export interface DefineFileHeaderPolicyArgs { /** * The name of the policy. */ name: string; /** * A description of the policy's purpose. */ description: string; /** * Configuration for how headers are detected and inserted. */ config: FileHeaderGeneratorConfig; } /** * Given a {@link FileHeaderPolicyConfig}, produces a function that detects correct file headers * and returns an error string if the header is missing or incorrect. * * @example * ```typescript * const MyHeaderPolicy = defineFileHeaderPolicy({ * name: "MyHeaderPolicy", * description: "Ensures files have required headers", * config: { match: /\.ts$/, lineStart: /\/\/ /, lineEnd: /\r?\n/, replacer: ... }, * }); * ``` * * @alpha */ export declare function defineFileHeaderPolicy(args: DefineFileHeaderPolicyArgs): PolicyShape; /** * Alias for defineFileHeaderPolicy. * @alpha */ export declare const fileHeaderPolicy: typeof defineFileHeaderPolicy; //# sourceMappingURL=defineFileHeaderPolicy.d.ts.map