@knodes/typedoc-pluginutils
Version:
A set of utilities for TypeDoc plugins
50 lines • 2.55 kB
TypeScript
import { LiteralUnion } from 'type-fest';
import { DeclarationReflection, ProjectReflection, Reflection } from 'typedoc';
export declare const findModuleRoot: ((reflection: Reflection, rootMatcher?: (dir: string, file: string) => boolean) => string) & import("lodash").MemoizedFunction;
export declare const getWorkspaces: (project: ProjectReflection) => [ProjectReflection, ...DeclarationReflection[]];
export declare const isModule: (reflection: Reflection) => reflection is DeclarationReflection;
export declare const getReflectionParentMatching: {
<T extends Reflection>(reflection: Reflection, filter: (reflection: Reflection) => reflection is T): T | undefined;
(reflection: Reflection, filter: (reflection: Reflection) => boolean): Reflection | undefined;
};
export declare const getReflectionModule: (reflection: Reflection) => DeclarationReflection | ProjectReflection;
/**
* Don't worry about typings, it's just a string with special prefixes. See {@page resolving-paths.md} for details.
*/
export type NamedPath = LiteralUnion<NamedPath.Relative | NamedPath.Project | NamedPath.ExplicitModule | NamedPath.CurrentModule, string>;
export declare namespace NamedPath {
type Relative = `.${'.' | ''}/${string}`;
type Project = `~~:${string}`;
type ExplicitModule = `~${string}:${string}`;
type CurrentModule = LiteralUnion<`~:${string}`, string>;
}
export declare class ResolveError extends Error {
readonly triedPath: string;
constructor(triedPath: string, options?: ErrorOptions);
}
/**
* Resolve a named path. See {@page resolving-paths.md} for details.
*
* @param args - The reflection to resolve from, an optional container folder, and the target path specifier.
* @returns the resolved path.
*/
export declare const resolveNamedPath: {
/**
* Resolve a named path. See {@page resolving-paths.md} for details.
*
* @param currentReflection - The reflection to resolve from.
* @param containerFolder - An optional container folder.
* @param path - The target path specifier.
* @returns the resolved path.
*/
(currentReflection: Reflection, containerFolder: string | undefined, path: NamedPath): string;
/**
* Resolve a named path. See {@page resolving-paths.md} for details.
*
* @param currentReflection - The reflection to resolve from.
* @param path - The target path specifier.
* @returns the resolved path.
*/
(currentReflection: Reflection, path: NamedPath): string;
};
//# sourceMappingURL=reflection-paths.d.ts.map