import type { Editor } from 'mem-fs-editor';
import type { AllAppResults, CapProjectType, FioriArtifactTypes, FoundFioriArtifacts, WorkspaceFolder } from '../types/index.js';
/**
 * Type that is used locally only to keep list of found files with cache of the
 * content in order to avoid multiple file reads. It also caches result of call
 * getCapProjectType() this is expensive.
 */
type FileMapAndCache = {
    files: {
        [path: string]: null | string | object;
    };
    capProjectType: Map<string, CapProjectType | undefined>;
};
/**
 * Find root folder of the project containing the given file.
 *
 * @param path path of a project file
 * @param sapuxRequired if true, only find sapux projects
 * @param silent if true, then does not throw an error but returns an empty path
 * @param memFs - optional mem-fs-editor instance
 * @returns {*}  {Promise<string>} - Project Root
 */
export declare function findProjectRoot(path: string, sapuxRequired?: boolean, silent?: boolean, memFs?: Editor): Promise<string>;
/**
 * Get the application root for a given webapp path.
 *
 * @param webappPath - path to webapp folder, where manifest.json is
 * @returns - root path of the application, where usually ui5.yaml and package.json are
 */
export declare function getAppRootFromWebappPath(webappPath: string): Promise<string | null>;
/**
 * Find the app root and project root folder for a given path. In case of apps in non CAP projects they are the same.
 * This function also validates if an app is supported by tools considering Fiori elements apps and SAPUI5
 * freestyle apps. Only if project root and app root can be determined, they are returned, otherwise null is returned.
 * This function is used e.g. to get a filtered list of all manifest.json files in a workspace for tools
 * supported apps and retrieve the respective root paths.
 *
 * This function makes following assumptions:
 * - All applications have a package.json in root folder.
 * - If sapux=true in package.json the app is NOT inside a CAP project.
 * - Freestyle application (non CAP) has in package.json dependency to @sap/ux-ui5-tooling and <appRoot>/ui5-local.yaml.
 *
 * @param path - path to check, e.g. to the manifest.json
 * @param options - optional mem-fs-editor instance or options object with optional memFs and cache
 * @returns - in case a supported app is found this function returns the appRoot and projectRoot path
 */
export declare function findRootsForPath(path: string, options?: Editor | {
    memFs?: Editor;
    cache?: FileMapAndCache;
}): Promise<{
    appRoot: string;
    projectRoot: string;
} | null>;
/**
 * Find CAP project root path.
 *
 * @param path - path inside CAP project
 * @param checkForAppRouter - if true, checks for app router in CAP project app folder
 * @param options - optional mem-fs-editor instance or options object with optional memFs and cache
 * @returns - CAP project root path
 */
export declare function findCapProjectRoot(path: string, checkForAppRouter?: boolean, options?: Editor | {
    memFs?: Editor;
    cache?: FileMapAndCache;
}): Promise<string | null>;
/**
 * Find all app that are supported by Fiori tools for a given list of roots (workspace folders).
 * This is a convenient function to retrieve all apps. Same result can be achieved with call
 * findFioriArtifacts({ wsFolders, artifacts: ['applications'] }); from same module.
 *
 * @param wsFolders - list of roots, either as vscode WorkspaceFolder[] or array of paths
 * @param memFs - optional mem-fs-editor instance
 * @returns - results as path to apps plus files already parsed, e.g. manifest.json
 */
export declare function findAllApps(wsFolders: readonly WorkspaceFolder[] | string[] | undefined, memFs?: Editor): Promise<AllAppResults[]>;
/**
 * Find all requested Fiori artifacts like apps, adaptations, extensions, that are supported by Fiori tools, for a given list of roots (workspace folders).
 *
 * @param options - find options
 * @param options.wsFolders - list of roots, either as vscode WorkspaceFolder[] or array of paths
 * @param options.artifacts - list of artifacts to search for: 'application', 'adaptation', 'extension' see FioriArtifactTypes
 * @param options.memFs - optional mem-fs-editor instance
 * @returns - data structure containing the search results, for app e.g. as path to app plus files already parsed, e.g. manifest.json
 */
export declare function findFioriArtifacts(options: {
    wsFolders?: readonly WorkspaceFolder[] | string[];
    artifacts: FioriArtifactTypes[];
    memFs?: Editor;
}): Promise<FoundFioriArtifacts>;
/**
 * Find all CAP project roots by locating pom.xml or package.json in a given workspace.
 *
 * @param options - find options
 * @param options.wsFolders - list of roots, either as vscode WorkspaceFolder[] or array of paths
 * @param options.noTraversal - optional flag to disable folder traversal for given paths
 * @returns - root file paths that may contain a CAP project
 */
export declare function findCapProjects(options: {
    readonly wsFolders: WorkspaceFolder[] | string[];
    noTraversal?: boolean;
}): Promise<string[]>;
export {};
//# sourceMappingURL=search.d.ts.map