import Loader from '@denali-js/loader'; export interface AvailableForTypeMethod { (type: string): string[]; } export declare type Registry = Map; export default class Resolver { /** * The loader scope to retrieve from */ loader: Loader; /** * The debug logger instance for this resolver - we create a separate * instance per resolver to make it easier to trace resolutions. */ debug: any; /** * The name of this resolver - typically the addon name * * @since 0.1.0 */ name: string; /** * The internal cache of available references */ protected registry: Registry; constructor(loader?: Loader); /** * Manually add a member to this resolver. Manually registered members take * precedence over any retrieved from the filesystem. This same pattern * exists at the container level, but having it here allows an addon to * specify a manual override _for it's own scope_, but not necessarily force * it onto the consuming application * * @since 0.1.0 */ register(specifier: string, value: any): void; /** * Fetch the member matching the given parsedName. First checks for any * manually registered members, then falls back to type specific retrieve * methods that typically find the matching file on the filesystem. * * @since 0.1.0 */ retrieve(specifier: string): T; protected _retrieve(type: string, entry: string, relativepath: string): boolean | {}; /** * Unknown types are assumed to exist underneath the `app/` folder */ protected retrieveOther(type: string, entry: string): boolean | {}; /** * App files are found in `app/*` */ protected retrieveApp(type: string, entry: string): boolean | {}; /** * Config files are found in `config/` */ protected retrieveConfig(type: string, entry: string): boolean | {}; /** * Initializer files are found in `config/initializers/` */ protected retrieveInitializer(type: string, entry: string): boolean | {}; /** * Returns an array of entry names that are available from this resolver for * the given type. * * @since 0.1.0 */ availableForType(type: string): string[]; protected _availableForType(prefix: string): string[]; /** * Unknown types are assumed to exist in the `app/` folder */ protected availableForOther(type: string): string[]; /** * App files are found in `app/*` */ protected availableForApp(type: string, entry: string): string[]; /** * Config files are found in the `config/` folder. Initializers are _not_ included in this group */ protected availableForConfig(type: string): string[]; /** * Initializers files are found in the `config/initializers/` folder */ protected availableForInitializer(type: string): string[]; }