dependency-owners
Version:
Determine ownership of dependencies in a project
38 lines (37 loc) • 1.3 kB
TypeScript
/**
* Type representing a dependency.
*/
export interface Dependency {
/**
* The name of the dependency.
*/
name: string;
/**
* The version of the dependency.
*/
version: string;
}
/**
* Interface for loading dependencies from various file types.
*/
export interface DependencyLoader {
/**
* Check if the loader can handle the specified file.
* @param {string} filePath The path to the file to check.
* @returns {boolean} True if the loader can handle the file, false otherwise.
*/
canLoad(filePath: string): Promise<boolean>;
/**
* Load the dependencies from the specified file.
* @param {string} filePath The path to the file to load dependencies from.
* @returns {Dependency[]} The list of loaded dependencies.
*/
load(filePath: string): Promise<Dependency[]>;
}
/**
* Resolve a dependency loader for a specific file.
* @param {DependencyLoader | string} loader The loader to use.
* @param {string} depFilePath The path to the dependency file.
* @returns {Promise<DependencyLoader | undefined>} The resolved dependency loader or undefined if not found.
*/
export declare function resolveDependencyLoader(loader: DependencyLoader | string, depFilePath: string): Promise<DependencyLoader | undefined>;