/** * Special key added to path objects to reference the directory itself */ export declare const DIR_KEY: "$"; /** * Input type for path maps - plain nested objects with string values */ export interface PathInput { [key: string]: string | PathInput; } /** * Processed paths with $ properties added to directories */ export type ProcessedPaths = { [K in keyof T]: T[K] extends string ? string : ProcessedPaths & { [DIR_KEY]: string; }; } & (T extends PathInput ? { [DIR_KEY]: string; } : {}); /** * Path map containing only relative paths */ export type RelativePathMap = ProcessedPaths; /** * Path map containing paths rooted at the PathMap's origin */ export type RootedPathMap = ProcessedPaths; /** * Path map containing absolute paths */ export type AbsolutePathMap = ProcessedPaths; /** * Combined path map with relative, rooted, and absolute variants */ export interface PathMap { /** * Paths relative to their parent directory * @example * paths.relative.template.server.app // 'app.ts' */ relative: RelativePathMap; /** * Paths from the PathMap's root * @example * paths.rooted.template.server.app // 'template/server/app.ts' */ rooted: RootedPathMap; /** * Absolute paths from the filesystem root * @example * paths.absolute.template.server.app // '/project/template/server/app.ts' */ absolute: AbsolutePathMap; /** * The base path used for absolute paths */ base: string; } /** * Create a path map from nested path definitions * * @param paths - Nested object structure defining paths * @param base - Optional base path for absolute paths * @returns RelativePathMap if no base provided, PathMap if base provided * * @example * ```ts * // Without base - returns RelativePathMap * const paths = PathMap.create({ * src: { * lib: { * utils: 'utils.ts' * } * } * }) * * // With base - returns PathMap with all variants * const paths = PathMap.create({ * src: { * lib: { * utils: 'utils.ts' * } * } * }, '/project') * * paths.relative.src.lib.utils // 'utils.ts' * paths.rooted.src.lib.utils // 'src/lib/utils.ts' * paths.absolute.src.lib.utils // '/project/src/lib/utils.ts' * ``` */ export declare function create(paths: T): RelativePathMap; export declare function create(paths: T, base: string): PathMap; /** * Create a new PathMap with a different base path * * @param pathMap - Existing PathMap or RelativePathMap * @param base - New base path * @returns New PathMap with updated absolute paths * * @example * ```ts * const dev = PathMap.create(paths, '/dev') * const prod = PathMap.rebase(dev, '/prod') * * prod.absolute.src.lib.utils // '/prod/src/lib/utils.ts' * ``` */ export declare const rebase: (pathMap: PathMap | RelativePathMap, base: string) => PathMap; //# sourceMappingURL=path-map.d.ts.map