import { SUPPORTED_EXTENSIONS } from "../constants.ts";import { path } from "../deps/path.ts";
interface GetPatternProps { name: string; extension: string; directory: string;}export function getPattern(props: GetPatternProps) { return [ path.join(props.directory, `${props.name}.config${props.extension}`), ];}export function generateLookupFiles(name: string): string[] { const files: string[] = [];
for (const directory of ["", ".config"]) { for (const extension of SUPPORTED_EXTENSIONS) { files.push(...getPattern({ name, extension, directory })); } }
return files;}export const DEFAULT_GET_ARGUMENT = () => {};
export type GetPattern = typeof getPattern;type ConfigAsFunction<Config extends object, Argument = unknown> = ( argument: Argument,) => Config | Promise<Config>;
export type ExportedConfig<Config extends object, Argument = unknown> = | Config | Promise<Config> | ConfigAsFunction<Config, Argument>;
export interface LoadConfigOptions { name: string;
cwd?: string | URL;}
export interface LoadConfigResult<Config extends object = any> { path: string;
config: Config;}