import type { CascadedEditFileCallback, EditFileCallback } from '../api.ts';
import type CoreGenerator from '../index.ts';
export type NeedleCallback = (content: string) => string;
type NeedleContentToAddCallback = {
    /**
     * Position of the needle start.
     */
    needleIndex: number;
    /**
     * Position of the needle line's new line char.
     */
    needleLineIndex: number;
    needleIndent: number;
    indentPrefix: string;
};
type ContentToAdd = {
    content: string;
    contentToCheck?: string | RegExp;
};
export type NeedleInsertion = {
    /**
     * Needle identifier.
     * The `jhipster-needle-` prefix is optional.
     * An empty string can be provided to append content at the end of the file.
     */
    needle: string;
    /**
     * Content to add.
     */
    contentToAdd: string | string[] | ContentToAdd[] | ((content: string, options: NeedleContentToAddCallback) => string);
    contentToCheck?: string | RegExp;
    /**
     * check existing content ignoring white spaces and new lines.
     */
    ignoreWhitespaces?: boolean;
    /**
     * throw error if needle was not found
     */
    optional?: boolean;
    /**
     * Detect and apply indent
     */
    autoIndent?: boolean;
};
type NeedleFileInsertion = Omit<NeedleInsertion, 'needle' | 'contentToAdd'> & {
    /**
     * Path to file.
     * The generator context must be passed.
     */
    filePath?: string;
    /**
     * Common needle prefix
     */
    needlesPrefix?: string;
};
type NeedleContentInsertion = Pick<NeedleInsertion, 'needle' | 'autoIndent'> & {
    content: string;
    contentToAdd: string | string[] | ((content: string, options: NeedleContentToAddCallback) => string);
};
/**
 * Change spaces sequences and characters that prettier breaks line (<>()) to allow any number of spaces or new line prefix
 */
export declare const convertToPrettierExpressions: (str: string) => string;
export declare const createNeedleRegexp: (needle: string, start?: boolean) => RegExp;
type NeedleLinePosition = {
    /**
     * Position of the needle line start.
     */
    start: number;
    /**
     * Position of the needle next line start or end of content.
     */
    end: number;
};
export declare const getNeedlesPositions: (content: string, needle?: string) => NeedleLinePosition[];
/**
 * Check if contentToCheck existing in content
 *
 * @param contentToCheck
 * @param content
 * @param [ignoreWhitespaces=true]
 */
export declare const checkContentIn: (contentToCheck: string | RegExp, content: string, ignoreWhitespaces?: boolean) => boolean;
/**
 * Write content before needle applying indentation
 *
 * @param args
 * @returns null if needle was not found, new content otherwise
 */
export declare const insertContentBeforeNeedle: ({ content, contentToAdd, needle, autoIndent }: NeedleContentInsertion) => string | null;
/**
 * Create a callback to insert the new content into existing content.
 *
 * A `contentToAdd` of string type will remove leading `\n`.
 * Leading `\n` allows a prettier template formatting.
 *
 * @param options
 */
export declare const createNeedleCallback: <Generator extends CoreGenerator = CoreGenerator>({ needle, contentToAdd, contentToCheck, optional, ignoreWhitespaces, autoIndent, }: NeedleInsertion) => EditFileCallback<Generator>;
/**
 * Inject content before needle or create a needle insertion callback.
 *
 * @param this - generator if provided, editFile will be executed
 */
export declare function createBaseNeedle(options: Omit<NeedleFileInsertion, 'filePath'>, needles: Record<string, string>): NeedleCallback;
export declare function createBaseNeedle(needles: Record<string, string>): NeedleCallback;
export declare function createBaseNeedle<Generator extends CoreGenerator = CoreGenerator>(this: Generator, options: NeedleFileInsertion, needles: Record<string, string>): CascadedEditFileCallback<Generator>;
export declare const createNeedleTransform: () => import("stream").Transform;
export {};
