@backstage/backend-plugin-api
Version:
Core API used by Backstage backend plugins
31 lines (29 loc) • 1.19 kB
TypeScript
/** @public */
interface PackagePathResolutionOverride {
/** Restores the normal behavior of resolvePackagePath */
restore(): void;
}
/** @public */
interface OverridePackagePathResolutionOptions {
/** The name of the package to mock the resolved path of */
packageName: string;
/** A replacement for the root package path */
path?: string;
/**
* Replacements for package sub-paths, each key must be an exact match of the posix-style path
* that is being resolved within the package.
*
* For example, code calling `resolvePackagePath('x', 'foo', 'bar')` would match only the following
* configuration: `overridePackagePathResolution({ packageName: 'x', paths: { 'foo/bar': baz } })`
*/
paths?: {
[path in string]: string | (() => string);
};
}
/**
* This utility helps you override the paths returned by `resolvePackagePath` for a given package.
*
* @public
*/
declare function overridePackagePathResolution(options: OverridePackagePathResolutionOptions): PackagePathResolutionOverride;
export { type OverridePackagePathResolutionOptions, type PackagePathResolutionOverride, overridePackagePathResolution };