import type { CopyOptions, Editor } from 'mem-fs-editor'; import type { TabInfo } from '../common/types.js'; /** * Options for creating an ID generator with cached file contents. */ export interface CreateIdGeneratorWithCacheOptions { basePath?: never; fsEditor?: never; /** * * cache for file contents to optimize ID generation. */ fileContentCache: string[]; } /** * Options for creating an ID generator with filesystem access. */ export interface CreateIdGeneratorWithFilesystemOptions { /** * Base path of the project. */ basePath: string; /** * mem-fs-editor instance. */ fsEditor: Editor; fileContentCache?: string[]; } /** * Options for creating an empty ID generator (no validation). */ export interface CreateIdGeneratorEmptyOptions { basePath?: never; fsEditor?: never; fileContentCache?: never; } /** * Options for creating an ID generator. */ export type CreateIdGeneratorOptions = CreateIdGeneratorWithCacheOptions | CreateIdGeneratorWithFilesystemOptions | CreateIdGeneratorEmptyOptions; interface ButtonGroup { id?: string; } export type IdGeneratorFunction = (baseId: string, validatedIds?: string[]) => string; export interface TemplateContext { buttonGroups?: ButtonGroup[]; name?: string; data?: { buttonGroups?: ButtonGroup[]; }; } export declare const CONFIG: { "page/custom/1.94/ext/View.xml": { getData: (generateId: IdGeneratorFunction, context?: TemplateContext) => { ids: Record; }; }; "page/custom/1.84/ext/View.xml": { getData: (generateId: IdGeneratorFunction, context?: TemplateContext) => { ids: Record; }; }; "common/FragmentWithForm.xml": { getData: (generateId: IdGeneratorFunction) => { ids: Record; }; }; "common/FragmentWithVBox.xml": { getData: (generateId: IdGeneratorFunction) => { ids: Record; }; }; "view/ext/CustomViewWithTable.xml": { getData: (generateId: IdGeneratorFunction) => { ids: Record; }; }; "filter/fragment.xml": { getData: (generateId: IdGeneratorFunction) => { ids: Record; }; }; "building-block/rich-text-editor-button-groups/View.xml": { getData: (generateId: IdGeneratorFunction, context?: Partial) => { ids: Record; }; }; "building-block/custom-column/View.xml": { getData: (generateId: IdGeneratorFunction) => { ids: Record; }; }; }; /** * Retrieves all view and fragment files in the application. * * @param appPath - The root path of the application * @param fs - The file system object for reading files * @returns A list of view and fragment files */ export declare function getFragmentAndViewFiles(appPath: string, fs: Editor): Promise; /** * Creates an ID generator function for a given base path and editor. * The generator ensures unique IDs across all fragment and view files in the project. * * @param options - Options for creating the ID generator * @returns A function that generates unique IDs based on a base ID string, or a Promise resolving to such function */ export declare function createIdGenerator(options?: CreateIdGeneratorOptions): Promise | IdGeneratorFunction; export declare const COPY_TEMPLATE_OPTIONS: CopyOptions & { noGlob: boolean; }; type WriteJsonReplacer = ((key: string, value: any) => any) | Array; type WriteJsonSpace = number | string; interface ExtendJsonParams { filepath: string; content: string; replacer?: WriteJsonReplacer; tabInfo?: TabInfo; } /** * Method calculates tab space info for passed file content. * * @param content - file content. * @returns tab size information. */ export declare function detectTabSpacing(content: string): TabInfo | undefined; /** * Method calculates tab spacing parameter for 'JSON.stringify' method. * * @param fs - the mem-fs editor instance. * @param filePath - path to file to read. * @param tabInfo - External tab configuration. * @returns tab size information. */ export declare function getJsonSpace(fs: Editor, filePath: string, tabInfo?: TabInfo | undefined): WriteJsonSpace | undefined; /** * Method extends target JSON file with passed JSOn content. * Method uses 'fs.extendJSON', but applies additional calculation to reuse existing content tab sizing information. * * @param fs - the mem-fs editor instance. * @param params - options for JSON extend. */ export declare function extendJSON(fs: Editor, params: ExtendJsonParams): void; /** * Copies a template file or directory to a target location and applies template interpolation. * This method wraps `mem-fs-editor`'s `copyTpl` and passes predefined copy options * (e.g. `noGlob: true`) to prevent glob pattern expansion in source paths. * * @param fs - The mem-fs editor instance used to perform the file operations. * @param from - Source path of the template file or directory. * @param to - Destination path where the rendered files will be written. * @param context - Optional template context used for interpolation. * @param {(baseId: string) => string} generateId - Function to generate unique IDs for the building block elements. */ export declare function copyTpl(fs: Editor, from: string, to: string, context?: object, generateId?: (baseId: string) => string): void; /** * Extracts the relative path from the templates directory. * Works cross-platform by normalizing path separators. * * @param absolutePath - Absolute path to a template file or directory * @returns Relative path from templates directory with forward slashes, or original path if 'templates' not found */ export declare function getRelativeTemplateComponentPath(absolutePath: string): string; export {}; //# sourceMappingURL=file.d.ts.map